agent-swarm-kit 1.0.12 → 1.0.14

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 🐝 agent-swarm-kit
2
2
 
3
- > A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems
3
+ > A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems. Documentation [available in docs folder](https://github.com/tripolskypetr/agent-swarm-kit/tree/master/docs)
4
4
 
5
5
  ## Installation
6
6
 
@@ -10,6 +10,109 @@ In comparison with langchain js this library provide the lightweight API so you
10
10
  npm install agent-swarm-kit
11
11
  ```
12
12
 
13
+ ## The Idea
14
+
15
+ 1. Several chatgpt sessions (agents) [execute tool calls](https://ollama.com/blog/tool-support). Each agent can use different model, for example, [mistral 7b](https://ollama.com/library/mistral) for small talk, [nemotron](https://ollama.com/library/nemotron) for business conversation
16
+
17
+ 2. The agent swarm navigate messages to the active chatgpt session (agent) for each `WebSocket` channel [by using `clientId` url parameter](src/routes/session.ts#L5)
18
+
19
+ 3. The active chatgpt session (agent) in the swarm could be changed [by executing function tool](https://platform.openai.com/docs/assistants/tools/function-calling)
20
+
21
+ 4. Each client sessions [share the same chat message history](https://platform.openai.com/docs/api-reference/messages/getMessage) for all agents. Each client chat history keep the last 25 messages with rotation. Only `assistant` and `user` messages are shared between chatgpt sessions (agents), the `system` and `tool` messages are agent-scoped so each agent knows only those tools related to It. As a result, each chatgpt session (agent) has it's [unique system prompt](https://platform.openai.com/docs/api-reference/messages/createMessage#messages-createmessage-role)
22
+
23
+ 5. If the agent output do not pass the validation (not existing tool call, tool call with invalid arguments, empty output, XML tags in output or JSON in output by default), the resque algorithm will try to fix the model. At first it will hide the previos messeges from a model, if this will not help, it return a placeholder like `Sorry, I missed that. Could you say it again?`
24
+
25
+ ## Test Cases
26
+
27
+ ### Validation Test Cases
28
+
29
+ 1. **Passes validation when all dependencies are provided**
30
+ - Tests if validation passes when all dependencies are present.
31
+
32
+ 2. **Fails validation when swarm is missing**
33
+ - Tests if validation fails when the swarm is missing.
34
+
35
+ 3. **Fails validation when completion is missing**
36
+ - Tests if validation fails when the completion is missing.
37
+
38
+ 4. **Fails validation when agent is missing**
39
+ - Tests if validation fails when the agent is missing.
40
+
41
+ 5. **Fails validation when tool is missing**
42
+ - Tests if validation fails when the tool is missing.
43
+
44
+ 6. **Fails validation when swarm's default agent is not in the list**
45
+ - Tests if validation fails when the swarm's default agent is not included in the list.
46
+
47
+ ### Model Recovery Test Cases
48
+
49
+ 7. **Rescues model on non-existing tool call**
50
+ - Tests if the model can recover when a non-existing tool is called.
51
+
52
+ 8. **Rescues model on empty output**
53
+ - Tests if the model can recover when the output is empty.
54
+
55
+ 9. **Rescues model on failed tool validation**
56
+ - Tests if the model can recover when tool validation fails.
57
+
58
+ 10. **Failed rescue raises a placeholder**
59
+ - Tests if a placeholder is returned when the rescue algorithm fails.
60
+
61
+ ### Navigation Test Cases
62
+
63
+ 11. **Navigates to sales agent on request**
64
+ - Tests if the system navigates to the sales agent upon request.
65
+
66
+ 12. **Navigates to refund agent on request**
67
+ - Tests if the system navigates to the refund agent upon request.
68
+
69
+ ### Deadlock Prevention Test Cases
70
+
71
+ 13. **Avoids deadlock if commitToolOutput was not executed before navigation**
72
+ - Tests if the system avoids deadlock when commitToolOutput is not executed before navigation.
73
+
74
+ 14. **Avoids deadlock when commitToolOutput is executed in parallel with next completion**
75
+ - Tests if the system avoids deadlock when commitToolOutput is executed in parallel with the next completion.
76
+
77
+ ### Agent Execution Test Cases
78
+
79
+ 15. **Ignores execution due to obsolete agent**
80
+ - Tests if the system ignores execution due to an obsolete agent.
81
+
82
+ 16. **Ignores commitToolOutput due to obsolete agent**
83
+ - Tests if the system ignores commitToolOutput due to an obsolete agent.
84
+
85
+ 17. **Ignores commitSystemMessage due to obsolete agent**
86
+ - Tests if the system ignores commitSystemMessage due to an obsolete agent.
87
+
88
+ ### Connection Disposal Test Cases
89
+
90
+ 18. **Disposes connections for session function**
91
+ - Tests if the system disposes of connections for the session function.
92
+
93
+ 19. **Disposes connections for makeConnection function**
94
+ - Tests if the system disposes of connections for the makeConnection function.
95
+
96
+ 20. **Disposes connections for complete function**
97
+ - Tests if the system disposes of connections for the complete function.
98
+
99
+ ### Additional System Behavior Test Cases
100
+
101
+ 21. **Uses different completions on multiple agents**
102
+ - Tests if the system uses different completions for multiple agents.
103
+
104
+ 22. **Clears history for similar clientId after each parallel complete call**
105
+ - Tests if the system clears history for similar clientId after each parallel complete call.
106
+
107
+ 23. **Orchestrates swarms for each connection**
108
+ - Tests if the system orchestrates swarms for each connection.
109
+
110
+ 24. **Queues user messages in connection**
111
+ - Tests if the system queues user messages in connection.
112
+
113
+ 25. **Allows server-side emit for makeConnection**
114
+ - Tests if the system allows server-side emit for makeConnection.
115
+
13
116
  ## Code sample
14
117
 
15
118
  ```tsx
package/build/index.cjs CHANGED
@@ -425,7 +425,7 @@ var ClientAgent = /** @class */ (function () {
425
425
  case 1:
426
426
  _f.sent();
427
427
  if (!!targetFn) return [3 /*break*/, 4];
428
- this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " functionName=").concat(tool.function.name, " tool function not found"));
428
+ this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " functionName=").concat(tool.function.name, " tool function not found"), this_1.params.tools);
429
429
  return [4 /*yield*/, this_1._resurrectModel("No target function for ".concat(tool.function.name))];
430
430
  case 2:
431
431
  result_2 = _f.sent();
@@ -522,7 +522,9 @@ var ClientAgent = /** @class */ (function () {
522
522
  }
523
523
  });
524
524
  }); });
525
- this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " CTOR"));
525
+ this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " CTOR"), {
526
+ params: params,
527
+ });
526
528
  }
527
529
  return ClientAgent;
528
530
  }());
@@ -848,7 +850,9 @@ var ClientHistory = /** @class */ (function () {
848
850
  }
849
851
  });
850
852
  }); };
851
- this.params.logger.debug("ClientHistory agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " CTOR"));
853
+ this.params.logger.debug("ClientHistory agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " CTOR"), {
854
+ params: params,
855
+ });
852
856
  }
853
857
  return ClientHistory;
854
858
  }());
@@ -1044,7 +1048,9 @@ var ClientSwarm = /** @class */ (function () {
1044
1048
  return [2 /*return*/];
1045
1049
  });
1046
1050
  }); };
1047
- this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " CTOR"));
1051
+ this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " CTOR"), {
1052
+ params: params,
1053
+ });
1048
1054
  this._activeAgent = params.defaultAgent;
1049
1055
  }
1050
1056
  return ClientSwarm;
@@ -1308,7 +1314,9 @@ var ClientSession = /** @class */ (function () {
1308
1314
  });
1309
1315
  }); };
1310
1316
  };
1311
- this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " CTOR"));
1317
+ this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " CTOR"), {
1318
+ params: params,
1319
+ });
1312
1320
  }
1313
1321
  return ClientSession;
1314
1322
  }());
@@ -2318,30 +2326,46 @@ var swarm = __assign(__assign(__assign(__assign(__assign({}, baseServices), conn
2318
2326
  init();
2319
2327
 
2320
2328
  var addAgent = function (agentSchema) {
2329
+ swarm.loggerService.log('function addAgent', {
2330
+ agentSchema: agentSchema
2331
+ });
2321
2332
  swarm.agentValidationService.addAgent(agentSchema.agentName, agentSchema);
2322
2333
  swarm.agentSchemaService.register(agentSchema.agentName, agentSchema);
2323
2334
  return agentSchema.agentName;
2324
2335
  };
2325
2336
 
2326
2337
  var addCompletion = function (completionSchema) {
2338
+ swarm.loggerService.log('function addCompletion', {
2339
+ completionSchema: completionSchema,
2340
+ });
2327
2341
  swarm.completionValidationService.addCompletion(completionSchema.completionName);
2328
2342
  swarm.completionSchemaService.register(completionSchema.completionName, completionSchema);
2329
2343
  return completionSchema.completionName;
2330
2344
  };
2331
2345
 
2332
2346
  var addSwarm = function (swarmSchema) {
2347
+ swarm.loggerService.log('function addSwarm', {
2348
+ swarmSchema: swarmSchema,
2349
+ });
2333
2350
  swarm.swarmValidationService.addSwarm(swarmSchema.swarmName, swarmSchema);
2334
2351
  swarm.swarmSchemaService.register(swarmSchema.swarmName, swarmSchema);
2335
2352
  return swarmSchema.swarmName;
2336
2353
  };
2337
2354
 
2338
2355
  var addTool = function (toolSchema) {
2356
+ swarm.loggerService.log('function addTool', {
2357
+ toolSchema: toolSchema,
2358
+ });
2339
2359
  swarm.toolValidationService.addTool(toolSchema.toolName, toolSchema);
2340
2360
  swarm.toolSchemaService.register(toolSchema.toolName, toolSchema);
2341
2361
  return toolSchema.toolName;
2342
2362
  };
2343
2363
 
2344
2364
  var makeConnection = function (connector, clientId, swarmName) {
2365
+ swarm.loggerService.log("function makeConnection", {
2366
+ clientId: clientId,
2367
+ swarmName: swarmName,
2368
+ });
2345
2369
  swarm.swarmValidationService.validate(swarmName, "makeConnection");
2346
2370
  swarm.sessionValidationService.addSession(clientId, swarmName);
2347
2371
  var send = swarm.sessionPublicService.connect(connector, clientId, swarmName);
@@ -2415,7 +2439,12 @@ var changeAgent = function (agentName, clientId) { return __awaiter(void 0, void
2415
2439
  var run;
2416
2440
  return __generator(this, function (_a) {
2417
2441
  switch (_a.label) {
2418
- case 0: return [4 /*yield*/, createChangeAgent(clientId)];
2442
+ case 0:
2443
+ swarm.loggerService.log('function changeAgent', {
2444
+ agentName: agentName,
2445
+ clientId: clientId,
2446
+ });
2447
+ return [4 /*yield*/, createChangeAgent(clientId)];
2419
2448
  case 1:
2420
2449
  run = _a.sent();
2421
2450
  createGc$1();
@@ -2429,6 +2458,10 @@ var disposeConnection = function (clientId, swarmName) { return __awaiter(void 0
2429
2458
  return __generator(this, function (_a) {
2430
2459
  switch (_a.label) {
2431
2460
  case 0:
2461
+ swarm.loggerService.log("function disposeConnection", {
2462
+ clientId: clientId,
2463
+ swarmName: swarmName,
2464
+ });
2432
2465
  swarm.swarmValidationService.validate(swarmName, "disposeConnection");
2433
2466
  swarm.sessionValidationService.removeSession(clientId);
2434
2467
  return [4 /*yield*/, swarm.sessionPublicService.dispose(clientId, swarmName)];
@@ -2498,7 +2531,13 @@ var complete = function (content, clientId, swarmName) { return __awaiter(void 0
2498
2531
  var run;
2499
2532
  return __generator(this, function (_a) {
2500
2533
  switch (_a.label) {
2501
- case 0: return [4 /*yield*/, createComplete(clientId, swarmName)];
2534
+ case 0:
2535
+ swarm.loggerService.log("function complete", {
2536
+ content: content,
2537
+ clientId: clientId,
2538
+ swarmName: swarmName,
2539
+ });
2540
+ return [4 /*yield*/, createComplete(clientId, swarmName)];
2502
2541
  case 1:
2503
2542
  run = _a.sent();
2504
2543
  createGc();
@@ -2509,6 +2548,10 @@ var complete = function (content, clientId, swarmName) { return __awaiter(void 0
2509
2548
  }); };
2510
2549
 
2511
2550
  var session = function (clientId, swarmName) {
2551
+ swarm.loggerService.log("function session", {
2552
+ clientId: clientId,
2553
+ swarmName: swarmName,
2554
+ });
2512
2555
  swarm.swarmValidationService.validate(swarmName, "session");
2513
2556
  swarm.sessionValidationService.addSession(clientId, swarmName);
2514
2557
  return {
@@ -2538,6 +2581,9 @@ var getRawHistory = function (clientId) { return __awaiter(void 0, void 0, void
2538
2581
  return __generator(this, function (_a) {
2539
2582
  switch (_a.label) {
2540
2583
  case 0:
2584
+ swarm.loggerService.log("function getRawHistory", {
2585
+ clientId: clientId,
2586
+ });
2541
2587
  swarm.sessionValidationService.validate(clientId, "getRawHistory");
2542
2588
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
2543
2589
  swarm.swarmValidationService.validate(swarmName, "getRawHistory");
@@ -2557,6 +2603,10 @@ var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0,
2557
2603
  return __generator(this, function (_a) {
2558
2604
  switch (_a.label) {
2559
2605
  case 0:
2606
+ swarm.loggerService.log("function getAgentHistory", {
2607
+ clientId: clientId,
2608
+ agentName: agentName,
2609
+ });
2560
2610
  swarm.agentValidationService.validate(agentName, "getAgentHistory");
2561
2611
  prompt = swarm.agentSchemaService.get(agentName).prompt;
2562
2612
  return [4 /*yield*/, swarm.historyPublicService.toArrayForAgent(prompt, clientId, agentName)];
@@ -2572,6 +2622,11 @@ var commitToolOutput = function (content, clientId, agentName) { return __awaite
2572
2622
  return __generator(this, function (_a) {
2573
2623
  switch (_a.label) {
2574
2624
  case 0:
2625
+ swarm.loggerService.log('function commitToolOutput', {
2626
+ content: content,
2627
+ clientId: clientId,
2628
+ agentName: agentName,
2629
+ });
2575
2630
  swarm.agentValidationService.validate(agentName, "commitSystemMessage");
2576
2631
  swarm.sessionValidationService.validate(clientId, "commitToolOutput");
2577
2632
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
@@ -2600,6 +2655,11 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
2600
2655
  return __generator(this, function (_a) {
2601
2656
  switch (_a.label) {
2602
2657
  case 0:
2658
+ swarm.loggerService.log('function commitSystemMessage', {
2659
+ content: content,
2660
+ clientId: clientId,
2661
+ agentName: agentName,
2662
+ });
2603
2663
  swarm.agentValidationService.validate(agentName, "commitSystemMessage");
2604
2664
  swarm.sessionValidationService.validate(clientId, "commitSystemMessage");
2605
2665
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
@@ -2628,6 +2688,11 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
2628
2688
  return __generator(this, function (_a) {
2629
2689
  switch (_a.label) {
2630
2690
  case 0:
2691
+ swarm.loggerService.log("function execute", {
2692
+ content: content,
2693
+ clientId: clientId,
2694
+ agentName: agentName,
2695
+ });
2631
2696
  swarm.agentValidationService.validate(agentName, "commitSystemMessage");
2632
2697
  swarm.sessionValidationService.validate(clientId, "execute");
2633
2698
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
package/build/index.mjs CHANGED
@@ -423,7 +423,7 @@ var ClientAgent = /** @class */ (function () {
423
423
  case 1:
424
424
  _f.sent();
425
425
  if (!!targetFn) return [3 /*break*/, 4];
426
- this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " functionName=").concat(tool.function.name, " tool function not found"));
426
+ this_1.params.logger.debug("ClientAgent agentName=".concat(this_1.params.agentName, " clientId=").concat(this_1.params.clientId, " functionName=").concat(tool.function.name, " tool function not found"), this_1.params.tools);
427
427
  return [4 /*yield*/, this_1._resurrectModel("No target function for ".concat(tool.function.name))];
428
428
  case 2:
429
429
  result_2 = _f.sent();
@@ -520,7 +520,9 @@ var ClientAgent = /** @class */ (function () {
520
520
  }
521
521
  });
522
522
  }); });
523
- this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " CTOR"));
523
+ this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " CTOR"), {
524
+ params: params,
525
+ });
524
526
  }
525
527
  return ClientAgent;
526
528
  }());
@@ -846,7 +848,9 @@ var ClientHistory = /** @class */ (function () {
846
848
  }
847
849
  });
848
850
  }); };
849
- this.params.logger.debug("ClientHistory agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " CTOR"));
851
+ this.params.logger.debug("ClientHistory agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " CTOR"), {
852
+ params: params,
853
+ });
850
854
  }
851
855
  return ClientHistory;
852
856
  }());
@@ -1042,7 +1046,9 @@ var ClientSwarm = /** @class */ (function () {
1042
1046
  return [2 /*return*/];
1043
1047
  });
1044
1048
  }); };
1045
- this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " CTOR"));
1049
+ this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " CTOR"), {
1050
+ params: params,
1051
+ });
1046
1052
  this._activeAgent = params.defaultAgent;
1047
1053
  }
1048
1054
  return ClientSwarm;
@@ -1306,7 +1312,9 @@ var ClientSession = /** @class */ (function () {
1306
1312
  });
1307
1313
  }); };
1308
1314
  };
1309
- this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " CTOR"));
1315
+ this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " CTOR"), {
1316
+ params: params,
1317
+ });
1310
1318
  }
1311
1319
  return ClientSession;
1312
1320
  }());
@@ -2316,30 +2324,46 @@ var swarm = __assign(__assign(__assign(__assign(__assign({}, baseServices), conn
2316
2324
  init();
2317
2325
 
2318
2326
  var addAgent = function (agentSchema) {
2327
+ swarm.loggerService.log('function addAgent', {
2328
+ agentSchema: agentSchema
2329
+ });
2319
2330
  swarm.agentValidationService.addAgent(agentSchema.agentName, agentSchema);
2320
2331
  swarm.agentSchemaService.register(agentSchema.agentName, agentSchema);
2321
2332
  return agentSchema.agentName;
2322
2333
  };
2323
2334
 
2324
2335
  var addCompletion = function (completionSchema) {
2336
+ swarm.loggerService.log('function addCompletion', {
2337
+ completionSchema: completionSchema,
2338
+ });
2325
2339
  swarm.completionValidationService.addCompletion(completionSchema.completionName);
2326
2340
  swarm.completionSchemaService.register(completionSchema.completionName, completionSchema);
2327
2341
  return completionSchema.completionName;
2328
2342
  };
2329
2343
 
2330
2344
  var addSwarm = function (swarmSchema) {
2345
+ swarm.loggerService.log('function addSwarm', {
2346
+ swarmSchema: swarmSchema,
2347
+ });
2331
2348
  swarm.swarmValidationService.addSwarm(swarmSchema.swarmName, swarmSchema);
2332
2349
  swarm.swarmSchemaService.register(swarmSchema.swarmName, swarmSchema);
2333
2350
  return swarmSchema.swarmName;
2334
2351
  };
2335
2352
 
2336
2353
  var addTool = function (toolSchema) {
2354
+ swarm.loggerService.log('function addTool', {
2355
+ toolSchema: toolSchema,
2356
+ });
2337
2357
  swarm.toolValidationService.addTool(toolSchema.toolName, toolSchema);
2338
2358
  swarm.toolSchemaService.register(toolSchema.toolName, toolSchema);
2339
2359
  return toolSchema.toolName;
2340
2360
  };
2341
2361
 
2342
2362
  var makeConnection = function (connector, clientId, swarmName) {
2363
+ swarm.loggerService.log("function makeConnection", {
2364
+ clientId: clientId,
2365
+ swarmName: swarmName,
2366
+ });
2343
2367
  swarm.swarmValidationService.validate(swarmName, "makeConnection");
2344
2368
  swarm.sessionValidationService.addSession(clientId, swarmName);
2345
2369
  var send = swarm.sessionPublicService.connect(connector, clientId, swarmName);
@@ -2413,7 +2437,12 @@ var changeAgent = function (agentName, clientId) { return __awaiter(void 0, void
2413
2437
  var run;
2414
2438
  return __generator(this, function (_a) {
2415
2439
  switch (_a.label) {
2416
- case 0: return [4 /*yield*/, createChangeAgent(clientId)];
2440
+ case 0:
2441
+ swarm.loggerService.log('function changeAgent', {
2442
+ agentName: agentName,
2443
+ clientId: clientId,
2444
+ });
2445
+ return [4 /*yield*/, createChangeAgent(clientId)];
2417
2446
  case 1:
2418
2447
  run = _a.sent();
2419
2448
  createGc$1();
@@ -2427,6 +2456,10 @@ var disposeConnection = function (clientId, swarmName) { return __awaiter(void 0
2427
2456
  return __generator(this, function (_a) {
2428
2457
  switch (_a.label) {
2429
2458
  case 0:
2459
+ swarm.loggerService.log("function disposeConnection", {
2460
+ clientId: clientId,
2461
+ swarmName: swarmName,
2462
+ });
2430
2463
  swarm.swarmValidationService.validate(swarmName, "disposeConnection");
2431
2464
  swarm.sessionValidationService.removeSession(clientId);
2432
2465
  return [4 /*yield*/, swarm.sessionPublicService.dispose(clientId, swarmName)];
@@ -2496,7 +2529,13 @@ var complete = function (content, clientId, swarmName) { return __awaiter(void 0
2496
2529
  var run;
2497
2530
  return __generator(this, function (_a) {
2498
2531
  switch (_a.label) {
2499
- case 0: return [4 /*yield*/, createComplete(clientId, swarmName)];
2532
+ case 0:
2533
+ swarm.loggerService.log("function complete", {
2534
+ content: content,
2535
+ clientId: clientId,
2536
+ swarmName: swarmName,
2537
+ });
2538
+ return [4 /*yield*/, createComplete(clientId, swarmName)];
2500
2539
  case 1:
2501
2540
  run = _a.sent();
2502
2541
  createGc();
@@ -2507,6 +2546,10 @@ var complete = function (content, clientId, swarmName) { return __awaiter(void 0
2507
2546
  }); };
2508
2547
 
2509
2548
  var session = function (clientId, swarmName) {
2549
+ swarm.loggerService.log("function session", {
2550
+ clientId: clientId,
2551
+ swarmName: swarmName,
2552
+ });
2510
2553
  swarm.swarmValidationService.validate(swarmName, "session");
2511
2554
  swarm.sessionValidationService.addSession(clientId, swarmName);
2512
2555
  return {
@@ -2536,6 +2579,9 @@ var getRawHistory = function (clientId) { return __awaiter(void 0, void 0, void
2536
2579
  return __generator(this, function (_a) {
2537
2580
  switch (_a.label) {
2538
2581
  case 0:
2582
+ swarm.loggerService.log("function getRawHistory", {
2583
+ clientId: clientId,
2584
+ });
2539
2585
  swarm.sessionValidationService.validate(clientId, "getRawHistory");
2540
2586
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
2541
2587
  swarm.swarmValidationService.validate(swarmName, "getRawHistory");
@@ -2555,6 +2601,10 @@ var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0,
2555
2601
  return __generator(this, function (_a) {
2556
2602
  switch (_a.label) {
2557
2603
  case 0:
2604
+ swarm.loggerService.log("function getAgentHistory", {
2605
+ clientId: clientId,
2606
+ agentName: agentName,
2607
+ });
2558
2608
  swarm.agentValidationService.validate(agentName, "getAgentHistory");
2559
2609
  prompt = swarm.agentSchemaService.get(agentName).prompt;
2560
2610
  return [4 /*yield*/, swarm.historyPublicService.toArrayForAgent(prompt, clientId, agentName)];
@@ -2570,6 +2620,11 @@ var commitToolOutput = function (content, clientId, agentName) { return __awaite
2570
2620
  return __generator(this, function (_a) {
2571
2621
  switch (_a.label) {
2572
2622
  case 0:
2623
+ swarm.loggerService.log('function commitToolOutput', {
2624
+ content: content,
2625
+ clientId: clientId,
2626
+ agentName: agentName,
2627
+ });
2573
2628
  swarm.agentValidationService.validate(agentName, "commitSystemMessage");
2574
2629
  swarm.sessionValidationService.validate(clientId, "commitToolOutput");
2575
2630
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
@@ -2598,6 +2653,11 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
2598
2653
  return __generator(this, function (_a) {
2599
2654
  switch (_a.label) {
2600
2655
  case 0:
2656
+ swarm.loggerService.log('function commitSystemMessage', {
2657
+ content: content,
2658
+ clientId: clientId,
2659
+ agentName: agentName,
2660
+ });
2601
2661
  swarm.agentValidationService.validate(agentName, "commitSystemMessage");
2602
2662
  swarm.sessionValidationService.validate(clientId, "commitSystemMessage");
2603
2663
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
@@ -2626,6 +2686,11 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
2626
2686
  return __generator(this, function (_a) {
2627
2687
  switch (_a.label) {
2628
2688
  case 0:
2689
+ swarm.loggerService.log("function execute", {
2690
+ content: content,
2691
+ clientId: clientId,
2692
+ agentName: agentName,
2693
+ });
2629
2694
  swarm.agentValidationService.validate(agentName, "commitSystemMessage");
2630
2695
  swarm.sessionValidationService.validate(clientId, "execute");
2631
2696
  swarmName = swarm.sessionValidationService.getSwarm(clientId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",