agent-swarm-kit 1.0.199 → 1.0.201
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.cjs +8 -8
- package/build/index.mjs +8 -8
- package/package.json +1 -1
package/build/index.cjs
CHANGED
|
@@ -2787,7 +2787,7 @@ const CC_AGENT_HISTORY_FILTER = (agentName) => (message) => {
|
|
|
2787
2787
|
if (message.role === "tool") {
|
|
2788
2788
|
isOk = isOk && message.agentName === agentName;
|
|
2789
2789
|
}
|
|
2790
|
-
if (message.tool_calls) {
|
|
2790
|
+
if (message.tool_calls?.length) {
|
|
2791
2791
|
isOk = isOk && message.agentName === agentName;
|
|
2792
2792
|
}
|
|
2793
2793
|
return isOk;
|
|
@@ -3264,7 +3264,7 @@ const RUN_FN = async (incoming, self) => {
|
|
|
3264
3264
|
},
|
|
3265
3265
|
clientId: self.params.clientId,
|
|
3266
3266
|
});
|
|
3267
|
-
if (message.tool_calls) {
|
|
3267
|
+
if (message.tool_calls?.length) {
|
|
3268
3268
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
3269
3269
|
self.params.logger.debug(`ClientAgent agentName=${self.params.agentName} clientId=${self.params.clientId} run should not call tools`, { incoming, result });
|
|
3270
3270
|
return "";
|
|
@@ -3301,7 +3301,7 @@ const EXECUTE_FN = async (incoming, mode, self) => {
|
|
|
3301
3301
|
});
|
|
3302
3302
|
const rawMessage = await self.getCompletion(mode);
|
|
3303
3303
|
const message = await self.params.map(rawMessage, self.params.clientId, self.params.agentName);
|
|
3304
|
-
if (message.tool_calls) {
|
|
3304
|
+
if (message.tool_calls?.length) {
|
|
3305
3305
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
3306
3306
|
self.params.logger.debug(`ClientAgent agentName=${self.params.agentName} clientId=${self.params.clientId} tool call begin`);
|
|
3307
3307
|
let toolCalls = await self.params.mapToolCalls(message.tool_calls.map((call) => ({
|
|
@@ -3424,7 +3424,7 @@ const EXECUTE_FN = async (incoming, mode, self) => {
|
|
|
3424
3424
|
run(true);
|
|
3425
3425
|
return;
|
|
3426
3426
|
}
|
|
3427
|
-
if (!message.tool_calls) {
|
|
3427
|
+
if (!message.tool_calls?.length) {
|
|
3428
3428
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
3429
3429
|
self.params.logger.debug(`ClientAgent agentName=${self.params.agentName} clientId=${self.params.clientId} execute no tool calls detected`);
|
|
3430
3430
|
}
|
|
@@ -4349,9 +4349,6 @@ class ClientHistory {
|
|
|
4349
4349
|
const systemMessagesRaw = [];
|
|
4350
4350
|
for await (const content of this.params.items.iterate(this.params.clientId, this.params.agentName)) {
|
|
4351
4351
|
const message = content;
|
|
4352
|
-
if (!message.tool_calls?.length && !message.content && !message.payload) {
|
|
4353
|
-
continue;
|
|
4354
|
-
}
|
|
4355
4352
|
if (message.role === "resque") {
|
|
4356
4353
|
commonMessagesRaw.splice(0, commonMessagesRaw.length);
|
|
4357
4354
|
systemMessagesRaw.splice(0, systemMessagesRaw.length);
|
|
@@ -4362,6 +4359,9 @@ class ClientHistory {
|
|
|
4362
4359
|
systemMessagesRaw.splice(0, systemMessagesRaw.length);
|
|
4363
4360
|
continue;
|
|
4364
4361
|
}
|
|
4362
|
+
if (!message.tool_calls?.length && !message.content && !message.payload) {
|
|
4363
|
+
continue;
|
|
4364
|
+
}
|
|
4365
4365
|
if (message.role === "system") {
|
|
4366
4366
|
systemMessagesRaw.push(message);
|
|
4367
4367
|
}
|
|
@@ -4388,7 +4388,7 @@ class ClientHistory {
|
|
|
4388
4388
|
}))
|
|
4389
4389
|
.filter(({ content, tool_calls }) => !!content || !!tool_calls?.length);
|
|
4390
4390
|
const assistantToolCallSet = new Set(assistantRawMessages
|
|
4391
|
-
.filter(({ tool_calls }) => !!tool_calls)
|
|
4391
|
+
.filter(({ tool_calls }) => !!tool_calls?.length)
|
|
4392
4392
|
.flatMap(({ tool_calls }) => tool_calls?.map(({ id }) => id)));
|
|
4393
4393
|
const assistantMessages = assistantRawMessages.filter(({ tool_call_id }) => {
|
|
4394
4394
|
if (tool_call_id) {
|
package/build/index.mjs
CHANGED
|
@@ -2785,7 +2785,7 @@ const CC_AGENT_HISTORY_FILTER = (agentName) => (message) => {
|
|
|
2785
2785
|
if (message.role === "tool") {
|
|
2786
2786
|
isOk = isOk && message.agentName === agentName;
|
|
2787
2787
|
}
|
|
2788
|
-
if (message.tool_calls) {
|
|
2788
|
+
if (message.tool_calls?.length) {
|
|
2789
2789
|
isOk = isOk && message.agentName === agentName;
|
|
2790
2790
|
}
|
|
2791
2791
|
return isOk;
|
|
@@ -3262,7 +3262,7 @@ const RUN_FN = async (incoming, self) => {
|
|
|
3262
3262
|
},
|
|
3263
3263
|
clientId: self.params.clientId,
|
|
3264
3264
|
});
|
|
3265
|
-
if (message.tool_calls) {
|
|
3265
|
+
if (message.tool_calls?.length) {
|
|
3266
3266
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
3267
3267
|
self.params.logger.debug(`ClientAgent agentName=${self.params.agentName} clientId=${self.params.clientId} run should not call tools`, { incoming, result });
|
|
3268
3268
|
return "";
|
|
@@ -3299,7 +3299,7 @@ const EXECUTE_FN = async (incoming, mode, self) => {
|
|
|
3299
3299
|
});
|
|
3300
3300
|
const rawMessage = await self.getCompletion(mode);
|
|
3301
3301
|
const message = await self.params.map(rawMessage, self.params.clientId, self.params.agentName);
|
|
3302
|
-
if (message.tool_calls) {
|
|
3302
|
+
if (message.tool_calls?.length) {
|
|
3303
3303
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
3304
3304
|
self.params.logger.debug(`ClientAgent agentName=${self.params.agentName} clientId=${self.params.clientId} tool call begin`);
|
|
3305
3305
|
let toolCalls = await self.params.mapToolCalls(message.tool_calls.map((call) => ({
|
|
@@ -3422,7 +3422,7 @@ const EXECUTE_FN = async (incoming, mode, self) => {
|
|
|
3422
3422
|
run(true);
|
|
3423
3423
|
return;
|
|
3424
3424
|
}
|
|
3425
|
-
if (!message.tool_calls) {
|
|
3425
|
+
if (!message.tool_calls?.length) {
|
|
3426
3426
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
3427
3427
|
self.params.logger.debug(`ClientAgent agentName=${self.params.agentName} clientId=${self.params.clientId} execute no tool calls detected`);
|
|
3428
3428
|
}
|
|
@@ -4347,9 +4347,6 @@ class ClientHistory {
|
|
|
4347
4347
|
const systemMessagesRaw = [];
|
|
4348
4348
|
for await (const content of this.params.items.iterate(this.params.clientId, this.params.agentName)) {
|
|
4349
4349
|
const message = content;
|
|
4350
|
-
if (!message.tool_calls?.length && !message.content && !message.payload) {
|
|
4351
|
-
continue;
|
|
4352
|
-
}
|
|
4353
4350
|
if (message.role === "resque") {
|
|
4354
4351
|
commonMessagesRaw.splice(0, commonMessagesRaw.length);
|
|
4355
4352
|
systemMessagesRaw.splice(0, systemMessagesRaw.length);
|
|
@@ -4360,6 +4357,9 @@ class ClientHistory {
|
|
|
4360
4357
|
systemMessagesRaw.splice(0, systemMessagesRaw.length);
|
|
4361
4358
|
continue;
|
|
4362
4359
|
}
|
|
4360
|
+
if (!message.tool_calls?.length && !message.content && !message.payload) {
|
|
4361
|
+
continue;
|
|
4362
|
+
}
|
|
4363
4363
|
if (message.role === "system") {
|
|
4364
4364
|
systemMessagesRaw.push(message);
|
|
4365
4365
|
}
|
|
@@ -4386,7 +4386,7 @@ class ClientHistory {
|
|
|
4386
4386
|
}))
|
|
4387
4387
|
.filter(({ content, tool_calls }) => !!content || !!tool_calls?.length);
|
|
4388
4388
|
const assistantToolCallSet = new Set(assistantRawMessages
|
|
4389
|
-
.filter(({ tool_calls }) => !!tool_calls)
|
|
4389
|
+
.filter(({ tool_calls }) => !!tool_calls?.length)
|
|
4390
4390
|
.flatMap(({ tool_calls }) => tool_calls?.map(({ id }) => id)));
|
|
4391
4391
|
const assistantMessages = assistantRawMessages.filter(({ tool_call_id }) => {
|
|
4392
4392
|
if (tool_call_id) {
|