agent-swarm-kit 1.0.8 → 1.0.9

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,81 @@ 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
+ });
2457
+ return [2 /*return*/];
2458
+ }
2459
+ return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(content, clientId, swarmName)];
2460
+ case 2:
2461
+ _a.sent();
2462
+ return [2 /*return*/];
2463
+ }
2464
+ });
2465
+ }); };
2446
2466
 
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
- };
2467
+ var commitSystemMessage = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
2468
+ var swarmName, currentAgentName;
2469
+ return __generator(this, function (_a) {
2470
+ switch (_a.label) {
2471
+ case 0:
2472
+ swarm.agentValidationService.validate(agentName, "commitSystemMessage");
2473
+ swarm.sessionValidationService.validate(clientId, "commitSystemMessage");
2474
+ swarmName = swarm.sessionValidationService.getSwarm(clientId);
2475
+ swarm.swarmValidationService.validate(swarmName, "commitSystemMessage");
2476
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(clientId, swarmName)];
2477
+ case 1:
2478
+ currentAgentName = _a.sent();
2479
+ if (currentAgentName !== agentName) {
2480
+ swarm.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
2481
+ currentAgentName: currentAgentName,
2482
+ agentName: agentName,
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
+ }); };
2453
2493
 
2454
- var execute = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
2455
- var swarmName;
2494
+ var execute = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
2495
+ var swarmName, currentAgentName;
2456
2496
  return __generator(this, function (_a) {
2457
2497
  switch (_a.label) {
2458
2498
  case 0:
2499
+ swarm.agentValidationService.validate(agentName, "commitSystemMessage");
2459
2500
  swarm.sessionValidationService.validate(clientId, "execute");
2460
2501
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
2461
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
+ });
2511
+ return [2 /*return*/];
2512
+ }
2462
2513
  return [4 /*yield*/, swarm.sessionPublicService.execute(content, clientId, swarmName)];
2463
- case 1: return [2 /*return*/, _a.sent()];
2514
+ case 2: return [2 /*return*/, _a.sent()];
2464
2515
  }
2465
2516
  });
2466
2517
  }); };
package/build/index.mjs CHANGED
@@ -2435,30 +2435,81 @@ 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
+ });
2455
+ return [2 /*return*/];
2456
+ }
2457
+ return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(content, clientId, swarmName)];
2458
+ case 2:
2459
+ _a.sent();
2460
+ return [2 /*return*/];
2461
+ }
2462
+ });
2463
+ }); };
2444
2464
 
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
- };
2465
+ var commitSystemMessage = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
2466
+ var swarmName, currentAgentName;
2467
+ return __generator(this, function (_a) {
2468
+ switch (_a.label) {
2469
+ case 0:
2470
+ swarm.agentValidationService.validate(agentName, "commitSystemMessage");
2471
+ swarm.sessionValidationService.validate(clientId, "commitSystemMessage");
2472
+ swarmName = swarm.sessionValidationService.getSwarm(clientId);
2473
+ swarm.swarmValidationService.validate(swarmName, "commitSystemMessage");
2474
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(clientId, swarmName)];
2475
+ case 1:
2476
+ currentAgentName = _a.sent();
2477
+ if (currentAgentName !== agentName) {
2478
+ swarm.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
2479
+ currentAgentName: currentAgentName,
2480
+ agentName: agentName,
2481
+ });
2482
+ return [2 /*return*/];
2483
+ }
2484
+ return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, clientId, swarmName)];
2485
+ case 2:
2486
+ _a.sent();
2487
+ return [2 /*return*/];
2488
+ }
2489
+ });
2490
+ }); };
2451
2491
 
2452
- var execute = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
2453
- var swarmName;
2492
+ var execute = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
2493
+ var swarmName, currentAgentName;
2454
2494
  return __generator(this, function (_a) {
2455
2495
  switch (_a.label) {
2456
2496
  case 0:
2497
+ swarm.agentValidationService.validate(agentName, "commitSystemMessage");
2457
2498
  swarm.sessionValidationService.validate(clientId, "execute");
2458
2499
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
2459
2500
  swarm.swarmValidationService.validate(swarmName, "execute");
2501
+ return [4 /*yield*/, swarm.swarmPublicService.getAgentName(clientId, swarmName)];
2502
+ case 1:
2503
+ currentAgentName = _a.sent();
2504
+ if (currentAgentName !== agentName) {
2505
+ swarm.loggerService.log('function "execute" skipped due to the agent change', {
2506
+ currentAgentName: currentAgentName,
2507
+ agentName: agentName,
2508
+ });
2509
+ return [2 /*return*/];
2510
+ }
2460
2511
  return [4 /*yield*/, swarm.sessionPublicService.execute(content, clientId, swarmName)];
2461
- case 1: return [2 /*return*/, _a.sent()];
2512
+ case 2: return [2 /*return*/, _a.sent()];
2462
2513
  }
2463
2514
  });
2464
2515
  }); };
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.9",
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;