agent-swarm-kit 1.0.8 → 1.0.10

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 CHANGED
@@ -2437,30 +2437,84 @@ var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0,
2437
2437
  });
2438
2438
  }); };
2439
2439
 
2440
- var commitToolOutput = function (content, clientId) {
2441
- swarm.sessionValidationService.validate(clientId, "commitToolOutput");
2442
- var swarmName = swarm.sessionValidationService.getSwarm(clientId);
2443
- swarm.swarmValidationService.validate(swarmName, "commitToolOutput");
2444
- swarm.sessionPublicService.commitToolOutput(content, clientId, swarmName);
2445
- };
2440
+ var commitToolOutput = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
2441
+ var swarmName, currentAgentName;
2442
+ return __generator(this, function (_a) {
2443
+ switch (_a.label) {
2444
+ case 0:
2445
+ swarm.agentValidationService.validate(agentName, "commitSystemMessage");
2446
+ swarm.sessionValidationService.validate(clientId, "commitToolOutput");
2447
+ swarmName = swarm.sessionValidationService.getSwarm(clientId);
2448
+ swarm.swarmValidationService.validate(swarmName, "commitToolOutput");
2449
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(clientId, swarmName)];
2450
+ case 1:
2451
+ currentAgentName = _a.sent();
2452
+ if (currentAgentName !== agentName) {
2453
+ swarm.loggerService.log('function "commitToolOutput" skipped due to the agent change', {
2454
+ currentAgentName: currentAgentName,
2455
+ agentName: agentName,
2456
+ clientId: clientId,
2457
+ });
2458
+ return [2 /*return*/];
2459
+ }
2460
+ return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(content, clientId, swarmName)];
2461
+ case 2:
2462
+ _a.sent();
2463
+ return [2 /*return*/];
2464
+ }
2465
+ });
2466
+ }); };
2446
2467
 
2447
- var commitSystemMessage = function (content, clientId) {
2448
- swarm.sessionValidationService.validate(clientId, "commitSystemMessage");
2449
- var swarmName = swarm.sessionValidationService.getSwarm(clientId);
2450
- swarm.swarmValidationService.validate(swarmName, "commitSystemMessage");
2451
- swarm.sessionPublicService.commitSystemMessage(content, clientId, swarmName);
2452
- };
2468
+ var commitSystemMessage = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
2469
+ var swarmName, currentAgentName;
2470
+ return __generator(this, function (_a) {
2471
+ switch (_a.label) {
2472
+ case 0:
2473
+ swarm.agentValidationService.validate(agentName, "commitSystemMessage");
2474
+ swarm.sessionValidationService.validate(clientId, "commitSystemMessage");
2475
+ swarmName = swarm.sessionValidationService.getSwarm(clientId);
2476
+ swarm.swarmValidationService.validate(swarmName, "commitSystemMessage");
2477
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(clientId, swarmName)];
2478
+ case 1:
2479
+ currentAgentName = _a.sent();
2480
+ if (currentAgentName !== agentName) {
2481
+ swarm.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
2482
+ currentAgentName: currentAgentName,
2483
+ agentName: agentName,
2484
+ clientId: clientId,
2485
+ });
2486
+ return [2 /*return*/];
2487
+ }
2488
+ return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, clientId, swarmName)];
2489
+ case 2:
2490
+ _a.sent();
2491
+ return [2 /*return*/];
2492
+ }
2493
+ });
2494
+ }); };
2453
2495
 
2454
- var execute = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
2455
- var swarmName;
2496
+ var execute = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
2497
+ var swarmName, currentAgentName;
2456
2498
  return __generator(this, function (_a) {
2457
2499
  switch (_a.label) {
2458
2500
  case 0:
2501
+ swarm.agentValidationService.validate(agentName, "commitSystemMessage");
2459
2502
  swarm.sessionValidationService.validate(clientId, "execute");
2460
2503
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
2461
2504
  swarm.swarmValidationService.validate(swarmName, "execute");
2505
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(clientId, swarmName)];
2506
+ case 1:
2507
+ currentAgentName = _a.sent();
2508
+ if (currentAgentName !== agentName) {
2509
+ swarm.loggerService.log('function "execute" skipped due to the agent change', {
2510
+ currentAgentName: currentAgentName,
2511
+ agentName: agentName,
2512
+ clientId: clientId,
2513
+ });
2514
+ return [2 /*return*/];
2515
+ }
2462
2516
  return [4 /*yield*/, swarm.sessionPublicService.execute(content, clientId, swarmName)];
2463
- case 1: return [2 /*return*/, _a.sent()];
2517
+ case 2: return [2 /*return*/, _a.sent()];
2464
2518
  }
2465
2519
  });
2466
2520
  }); };
package/build/index.mjs CHANGED
@@ -2435,30 +2435,84 @@ var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0,
2435
2435
  });
2436
2436
  }); };
2437
2437
 
2438
- var commitToolOutput = function (content, clientId) {
2439
- swarm.sessionValidationService.validate(clientId, "commitToolOutput");
2440
- var swarmName = swarm.sessionValidationService.getSwarm(clientId);
2441
- swarm.swarmValidationService.validate(swarmName, "commitToolOutput");
2442
- swarm.sessionPublicService.commitToolOutput(content, clientId, swarmName);
2443
- };
2438
+ var commitToolOutput = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
2439
+ var swarmName, currentAgentName;
2440
+ return __generator(this, function (_a) {
2441
+ switch (_a.label) {
2442
+ case 0:
2443
+ swarm.agentValidationService.validate(agentName, "commitSystemMessage");
2444
+ swarm.sessionValidationService.validate(clientId, "commitToolOutput");
2445
+ swarmName = swarm.sessionValidationService.getSwarm(clientId);
2446
+ swarm.swarmValidationService.validate(swarmName, "commitToolOutput");
2447
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(clientId, swarmName)];
2448
+ case 1:
2449
+ currentAgentName = _a.sent();
2450
+ if (currentAgentName !== agentName) {
2451
+ swarm.loggerService.log('function "commitToolOutput" skipped due to the agent change', {
2452
+ currentAgentName: currentAgentName,
2453
+ agentName: agentName,
2454
+ clientId: clientId,
2455
+ });
2456
+ return [2 /*return*/];
2457
+ }
2458
+ return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(content, clientId, swarmName)];
2459
+ case 2:
2460
+ _a.sent();
2461
+ return [2 /*return*/];
2462
+ }
2463
+ });
2464
+ }); };
2444
2465
 
2445
- var commitSystemMessage = function (content, clientId) {
2446
- swarm.sessionValidationService.validate(clientId, "commitSystemMessage");
2447
- var swarmName = swarm.sessionValidationService.getSwarm(clientId);
2448
- swarm.swarmValidationService.validate(swarmName, "commitSystemMessage");
2449
- swarm.sessionPublicService.commitSystemMessage(content, clientId, swarmName);
2450
- };
2466
+ var commitSystemMessage = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
2467
+ var swarmName, currentAgentName;
2468
+ return __generator(this, function (_a) {
2469
+ switch (_a.label) {
2470
+ case 0:
2471
+ swarm.agentValidationService.validate(agentName, "commitSystemMessage");
2472
+ swarm.sessionValidationService.validate(clientId, "commitSystemMessage");
2473
+ swarmName = swarm.sessionValidationService.getSwarm(clientId);
2474
+ swarm.swarmValidationService.validate(swarmName, "commitSystemMessage");
2475
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(clientId, swarmName)];
2476
+ case 1:
2477
+ currentAgentName = _a.sent();
2478
+ if (currentAgentName !== agentName) {
2479
+ swarm.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
2480
+ currentAgentName: currentAgentName,
2481
+ agentName: agentName,
2482
+ clientId: clientId,
2483
+ });
2484
+ return [2 /*return*/];
2485
+ }
2486
+ return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, clientId, swarmName)];
2487
+ case 2:
2488
+ _a.sent();
2489
+ return [2 /*return*/];
2490
+ }
2491
+ });
2492
+ }); };
2451
2493
 
2452
- var execute = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
2453
- var swarmName;
2494
+ var execute = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
2495
+ var swarmName, currentAgentName;
2454
2496
  return __generator(this, function (_a) {
2455
2497
  switch (_a.label) {
2456
2498
  case 0:
2499
+ swarm.agentValidationService.validate(agentName, "commitSystemMessage");
2457
2500
  swarm.sessionValidationService.validate(clientId, "execute");
2458
2501
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
2459
2502
  swarm.swarmValidationService.validate(swarmName, "execute");
2503
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(clientId, swarmName)];
2504
+ case 1:
2505
+ currentAgentName = _a.sent();
2506
+ if (currentAgentName !== agentName) {
2507
+ swarm.loggerService.log('function "execute" skipped due to the agent change', {
2508
+ currentAgentName: currentAgentName,
2509
+ agentName: agentName,
2510
+ clientId: clientId,
2511
+ });
2512
+ return [2 /*return*/];
2513
+ }
2460
2514
  return [4 /*yield*/, swarm.sessionPublicService.execute(content, clientId, swarmName)];
2461
- case 1: return [2 /*return*/, _a.sent()];
2515
+ case 2: return [2 /*return*/, _a.sent()];
2462
2516
  }
2463
2517
  });
2464
2518
  }); };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",
package/types.d.ts CHANGED
@@ -465,11 +465,11 @@ declare const getRawHistory: (clientId: string) => Promise<IModelMessage[]>;
465
465
 
466
466
  declare const getAgentHistory: (clientId: string, agentName: AgentName) => Promise<IModelMessage[]>;
467
467
 
468
- declare const commitToolOutput: (content: string, clientId: string) => void;
468
+ declare const commitToolOutput: (content: string, clientId: string, agentName: AgentName) => Promise<void>;
469
469
 
470
- declare const commitSystemMessage: (content: string, clientId: string) => void;
470
+ declare const commitSystemMessage: (content: string, clientId: string, agentName: string) => Promise<void>;
471
471
 
472
- declare const execute: (content: string, clientId: string) => Promise<string>;
472
+ declare const execute: (content: string, clientId: string, agentName: AgentName) => Promise<string>;
473
473
 
474
474
  declare const GLOBAL_CONFIG: {
475
475
  CC_TOOL_CALL_EXCEPTION_PROMPT: string;