agent-swarm-kit 1.0.113 → 1.0.115
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 +753 -270
- package/build/index.mjs +751 -271
- package/package.json +1 -1
- package/types.d.ts +169 -50
package/build/index.cjs
CHANGED
|
@@ -199,6 +199,7 @@ var schemaServices$1 = {
|
|
|
199
199
|
embeddingSchemaService: Symbol('embeddingSchemaService'),
|
|
200
200
|
storageSchemaService: Symbol('storageSchemaService'),
|
|
201
201
|
stateSchemaService: Symbol('stateSchemaService'),
|
|
202
|
+
memorySchemaService: Symbol('memorySchemaService'),
|
|
202
203
|
};
|
|
203
204
|
var metaServices$1 = {
|
|
204
205
|
agentMetaService: Symbol('agentMetaService'),
|
|
@@ -2352,6 +2353,85 @@ var ClientAgent = /** @class */ (function () {
|
|
|
2352
2353
|
}
|
|
2353
2354
|
});
|
|
2354
2355
|
}); });
|
|
2356
|
+
/**
|
|
2357
|
+
* Run the completion stateless and return the output
|
|
2358
|
+
* @param {string} incoming - The incoming message content.
|
|
2359
|
+
* @returns {Promise<void>}
|
|
2360
|
+
*/
|
|
2361
|
+
this.run = functoolsKit.queued(function (incoming) { return __awaiter(_this, void 0, void 0, function () {
|
|
2362
|
+
var messages, args, rawMessage, message, result, validation;
|
|
2363
|
+
var _a, _b, _c;
|
|
2364
|
+
return __generator(this, function (_d) {
|
|
2365
|
+
switch (_d.label) {
|
|
2366
|
+
case 0:
|
|
2367
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2368
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " run begin"), { incoming: incoming });
|
|
2369
|
+
this.params.onRun &&
|
|
2370
|
+
this.params.onRun(this.params.clientId, this.params.agentName, incoming);
|
|
2371
|
+
return [4 /*yield*/, this.params.history.toArrayForAgent(this.params.prompt, this.params.system)];
|
|
2372
|
+
case 1:
|
|
2373
|
+
messages = _d.sent();
|
|
2374
|
+
messages.push({
|
|
2375
|
+
agentName: this.params.agentName,
|
|
2376
|
+
content: incoming,
|
|
2377
|
+
mode: "user",
|
|
2378
|
+
role: "assistant",
|
|
2379
|
+
});
|
|
2380
|
+
args = {
|
|
2381
|
+
clientId: this.params.clientId,
|
|
2382
|
+
agentName: this.params.agentName,
|
|
2383
|
+
messages: messages,
|
|
2384
|
+
mode: "user",
|
|
2385
|
+
tools: (_a = this.params.tools) === null || _a === void 0 ? void 0 : _a.map(function (t) {
|
|
2386
|
+
return lodashEs.omit(t, "toolName", "docNote", "call", "validate", "callbacks");
|
|
2387
|
+
}),
|
|
2388
|
+
};
|
|
2389
|
+
return [4 /*yield*/, this.params.completion.getCompletion(args)];
|
|
2390
|
+
case 2:
|
|
2391
|
+
rawMessage = _d.sent();
|
|
2392
|
+
((_b = this.params.completion.callbacks) === null || _b === void 0 ? void 0 : _b.onComplete) &&
|
|
2393
|
+
((_c = this.params.completion.callbacks) === null || _c === void 0 ? void 0 : _c.onComplete(args, rawMessage));
|
|
2394
|
+
return [4 /*yield*/, this.params.map(rawMessage, this.params.clientId, this.params.agentName)];
|
|
2395
|
+
case 3:
|
|
2396
|
+
message = _d.sent();
|
|
2397
|
+
return [4 /*yield*/, this.params.transform(message.content, this.params.clientId, this.params.agentName)];
|
|
2398
|
+
case 4:
|
|
2399
|
+
result = _d.sent();
|
|
2400
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
2401
|
+
type: "run",
|
|
2402
|
+
source: "agent-bus",
|
|
2403
|
+
input: {
|
|
2404
|
+
message: message,
|
|
2405
|
+
},
|
|
2406
|
+
output: {
|
|
2407
|
+
result: result,
|
|
2408
|
+
},
|
|
2409
|
+
context: {
|
|
2410
|
+
agentName: this.params.agentName,
|
|
2411
|
+
},
|
|
2412
|
+
clientId: this.params.clientId,
|
|
2413
|
+
})];
|
|
2414
|
+
case 5:
|
|
2415
|
+
_d.sent();
|
|
2416
|
+
if (message.tool_calls) {
|
|
2417
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2418
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " run should not call tools"), { incoming: incoming, result: result });
|
|
2419
|
+
return [2 /*return*/, ""];
|
|
2420
|
+
}
|
|
2421
|
+
validation = null;
|
|
2422
|
+
return [4 /*yield*/, this.params.validate(result)];
|
|
2423
|
+
case 6:
|
|
2424
|
+
if ((validation = _d.sent())) {
|
|
2425
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2426
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " run validation not passed: ").concat(validation), { incoming: incoming, result: result });
|
|
2427
|
+
return [2 /*return*/, ""];
|
|
2428
|
+
}
|
|
2429
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2430
|
+
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " run end result=").concat(result));
|
|
2431
|
+
return [2 /*return*/, result];
|
|
2432
|
+
}
|
|
2433
|
+
});
|
|
2434
|
+
}); });
|
|
2355
2435
|
/**
|
|
2356
2436
|
* Should call on agent dispose
|
|
2357
2437
|
* @returns {Promise<void>}
|
|
@@ -2434,6 +2514,24 @@ var AgentConnectionService = /** @class */ (function () {
|
|
|
2434
2514
|
}
|
|
2435
2515
|
});
|
|
2436
2516
|
}); };
|
|
2517
|
+
/**
|
|
2518
|
+
* Run the completion stateless
|
|
2519
|
+
* @param {string} input - The input command.
|
|
2520
|
+
* @returns {Promise<any>} The execution result.
|
|
2521
|
+
*/
|
|
2522
|
+
this.run = function (input) { return __awaiter(_this, void 0, void 0, function () {
|
|
2523
|
+
return __generator(this, function (_a) {
|
|
2524
|
+
switch (_a.label) {
|
|
2525
|
+
case 0:
|
|
2526
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
2527
|
+
this.loggerService.info("agentConnectionService run", {
|
|
2528
|
+
input: input,
|
|
2529
|
+
});
|
|
2530
|
+
return [4 /*yield*/, this.getAgent(this.methodContextService.context.clientId, this.methodContextService.context.agentName).run(input)];
|
|
2531
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
2532
|
+
}
|
|
2533
|
+
});
|
|
2534
|
+
}); };
|
|
2437
2535
|
/**
|
|
2438
2536
|
* Waits for the output from the agent.
|
|
2439
2537
|
* @returns {Promise<any>} The output result.
|
|
@@ -3734,6 +3832,48 @@ var ClientSession = /** @class */ (function () {
|
|
|
3734
3832
|
}
|
|
3735
3833
|
});
|
|
3736
3834
|
}); };
|
|
3835
|
+
/**
|
|
3836
|
+
* Run the completion stateless
|
|
3837
|
+
* @param {string} message - The message to run.
|
|
3838
|
+
* @returns {Promise<string>} - The output of the execution.
|
|
3839
|
+
*/
|
|
3840
|
+
this.run = function (message) { return __awaiter(_this, void 0, void 0, function () {
|
|
3841
|
+
var agent, output;
|
|
3842
|
+
return __generator(this, function (_a) {
|
|
3843
|
+
switch (_a.label) {
|
|
3844
|
+
case 0:
|
|
3845
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
3846
|
+
this.params.logger.debug("ClientSession clientId=".concat(this.params.clientId, " run"), {
|
|
3847
|
+
message: message,
|
|
3848
|
+
});
|
|
3849
|
+
this.params.onRun &&
|
|
3850
|
+
this.params.onRun(this.params.clientId, this.params.swarmName, message);
|
|
3851
|
+
return [4 /*yield*/, this.params.swarm.getAgent()];
|
|
3852
|
+
case 1:
|
|
3853
|
+
agent = _a.sent();
|
|
3854
|
+
return [4 /*yield*/, agent.run(message)];
|
|
3855
|
+
case 2:
|
|
3856
|
+
output = _a.sent();
|
|
3857
|
+
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
3858
|
+
type: "run",
|
|
3859
|
+
source: "session-bus",
|
|
3860
|
+
input: {
|
|
3861
|
+
message: message,
|
|
3862
|
+
},
|
|
3863
|
+
output: {
|
|
3864
|
+
result: output,
|
|
3865
|
+
},
|
|
3866
|
+
context: {
|
|
3867
|
+
swarmName: this.params.swarmName,
|
|
3868
|
+
},
|
|
3869
|
+
clientId: this.params.clientId,
|
|
3870
|
+
})];
|
|
3871
|
+
case 3:
|
|
3872
|
+
_a.sent();
|
|
3873
|
+
return [2 /*return*/, output];
|
|
3874
|
+
}
|
|
3875
|
+
});
|
|
3876
|
+
}); };
|
|
3737
3877
|
/**
|
|
3738
3878
|
* Commits tool output.
|
|
3739
3879
|
* @param {string} toolId - The `tool_call_id` for openai history
|
|
@@ -4106,6 +4246,24 @@ var SessionConnectionService = /** @class */ (function () {
|
|
|
4106
4246
|
}
|
|
4107
4247
|
});
|
|
4108
4248
|
}); };
|
|
4249
|
+
/**
|
|
4250
|
+
* Run the completion stateless
|
|
4251
|
+
* @param {string} content - The content to execute.
|
|
4252
|
+
* @returns {Promise<string>} A promise that resolves with the execution result.
|
|
4253
|
+
*/
|
|
4254
|
+
this.run = function (content) { return __awaiter(_this, void 0, void 0, function () {
|
|
4255
|
+
return __generator(this, function (_a) {
|
|
4256
|
+
switch (_a.label) {
|
|
4257
|
+
case 0:
|
|
4258
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4259
|
+
this.loggerService.info("sessionConnectionService run", {
|
|
4260
|
+
content: content,
|
|
4261
|
+
});
|
|
4262
|
+
return [4 /*yield*/, this.getSession(this.methodContextService.context.clientId, this.methodContextService.context.swarmName).run(content)];
|
|
4263
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
4264
|
+
}
|
|
4265
|
+
});
|
|
4266
|
+
}); };
|
|
4109
4267
|
/**
|
|
4110
4268
|
* Connects to the session using the provided connector.
|
|
4111
4269
|
* @param {SendMessageFn} connector - The function to send messages.
|
|
@@ -4332,6 +4490,44 @@ var AgentPublicService = /** @class */ (function () {
|
|
|
4332
4490
|
}
|
|
4333
4491
|
});
|
|
4334
4492
|
}); };
|
|
4493
|
+
/**
|
|
4494
|
+
* Run the completion stateless
|
|
4495
|
+
* @param {string} input - The input command.
|
|
4496
|
+
* @param {string} clientId - The client ID.
|
|
4497
|
+
* @param {AgentName} agentName - The name of the agent.
|
|
4498
|
+
* @returns {Promise<unknown>} The execution result.
|
|
4499
|
+
*/
|
|
4500
|
+
this.run = function (input, methodName, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
4501
|
+
var _this = this;
|
|
4502
|
+
return __generator(this, function (_a) {
|
|
4503
|
+
switch (_a.label) {
|
|
4504
|
+
case 0:
|
|
4505
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
4506
|
+
this.loggerService.info("agentPublicService run", {
|
|
4507
|
+
methodName: methodName,
|
|
4508
|
+
input: input,
|
|
4509
|
+
clientId: clientId,
|
|
4510
|
+
agentName: agentName,
|
|
4511
|
+
});
|
|
4512
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
4513
|
+
return __generator(this, function (_a) {
|
|
4514
|
+
switch (_a.label) {
|
|
4515
|
+
case 0: return [4 /*yield*/, this.agentConnectionService.run(input)];
|
|
4516
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
4517
|
+
}
|
|
4518
|
+
});
|
|
4519
|
+
}); }, {
|
|
4520
|
+
methodName: methodName,
|
|
4521
|
+
clientId: clientId,
|
|
4522
|
+
agentName: agentName,
|
|
4523
|
+
swarmName: "",
|
|
4524
|
+
storageName: "",
|
|
4525
|
+
stateName: "",
|
|
4526
|
+
})];
|
|
4527
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
4528
|
+
}
|
|
4529
|
+
});
|
|
4530
|
+
}); };
|
|
4335
4531
|
/**
|
|
4336
4532
|
* Waits for the agent's output.
|
|
4337
4533
|
* @param {string} clientId - The client ID.
|
|
@@ -4912,6 +5108,43 @@ var SessionPublicService = /** @class */ (function () {
|
|
|
4912
5108
|
}
|
|
4913
5109
|
});
|
|
4914
5110
|
}); };
|
|
5111
|
+
/**
|
|
5112
|
+
* Run the completion stateless
|
|
5113
|
+
* @param {string} content - The content to execute.
|
|
5114
|
+
* @param {string} clientId - The client ID.
|
|
5115
|
+
* @param {SwarmName} swarmName - The swarm name.
|
|
5116
|
+
* @returns {Promise<void>}
|
|
5117
|
+
*/
|
|
5118
|
+
this.run = function (content, methodName, clientId, swarmName) { return __awaiter(_this, void 0, void 0, function () {
|
|
5119
|
+
var _this = this;
|
|
5120
|
+
return __generator(this, function (_a) {
|
|
5121
|
+
switch (_a.label) {
|
|
5122
|
+
case 0:
|
|
5123
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
5124
|
+
this.loggerService.info("sessionPublicService run", {
|
|
5125
|
+
content: content,
|
|
5126
|
+
clientId: clientId,
|
|
5127
|
+
swarmName: swarmName,
|
|
5128
|
+
});
|
|
5129
|
+
return [4 /*yield*/, MethodContextService.runInContext(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5130
|
+
return __generator(this, function (_a) {
|
|
5131
|
+
switch (_a.label) {
|
|
5132
|
+
case 0: return [4 /*yield*/, this.sessionConnectionService.run(content)];
|
|
5133
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
5134
|
+
}
|
|
5135
|
+
});
|
|
5136
|
+
}); }, {
|
|
5137
|
+
methodName: methodName,
|
|
5138
|
+
clientId: clientId,
|
|
5139
|
+
swarmName: swarmName,
|
|
5140
|
+
agentName: "",
|
|
5141
|
+
storageName: "",
|
|
5142
|
+
stateName: "",
|
|
5143
|
+
})];
|
|
5144
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
5145
|
+
}
|
|
5146
|
+
});
|
|
5147
|
+
}); };
|
|
4915
5148
|
/**
|
|
4916
5149
|
* Connects to the session.
|
|
4917
5150
|
* @param {SendMessageFn} connector - The function to send messages.
|
|
@@ -9180,6 +9413,63 @@ var SharedStoragePublicService = /** @class */ (function () {
|
|
|
9180
9413
|
return SharedStoragePublicService;
|
|
9181
9414
|
}());
|
|
9182
9415
|
|
|
9416
|
+
/**
|
|
9417
|
+
* Service to manage memory schema for different sessions.
|
|
9418
|
+
*/
|
|
9419
|
+
var MemorySchemaService = /** @class */ (function () {
|
|
9420
|
+
function MemorySchemaService() {
|
|
9421
|
+
var _this = this;
|
|
9422
|
+
this.loggerService = inject(TYPES.loggerService);
|
|
9423
|
+
this.memoryMap = new Map();
|
|
9424
|
+
/**
|
|
9425
|
+
* Writes a value to the memory map for a given client ID.
|
|
9426
|
+
*
|
|
9427
|
+
* @template T - The type of the value to be written.
|
|
9428
|
+
* @param {string} clientId - The ID of the client.
|
|
9429
|
+
* @param {T} value - The value to be written.
|
|
9430
|
+
*/
|
|
9431
|
+
this.writeValue = function (clientId, value) {
|
|
9432
|
+
var _a;
|
|
9433
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
9434
|
+
_this.loggerService.info("memorySchemaService setValue", {
|
|
9435
|
+
clientId: clientId,
|
|
9436
|
+
value: value,
|
|
9437
|
+
});
|
|
9438
|
+
var pendingValue = Object.assign((_a = _this.memoryMap.get(clientId)) !== null && _a !== void 0 ? _a : {}, value);
|
|
9439
|
+
_this.memoryMap.set(clientId, pendingValue);
|
|
9440
|
+
return pendingValue;
|
|
9441
|
+
};
|
|
9442
|
+
/**
|
|
9443
|
+
* Reads a value from the memory map for a given client ID.
|
|
9444
|
+
*
|
|
9445
|
+
* @template T - The type of the value to be read.
|
|
9446
|
+
* @param {string} clientId - The ID of the client.
|
|
9447
|
+
* @returns {T} - The value associated with the client ID.
|
|
9448
|
+
*/
|
|
9449
|
+
this.readValue = function (clientId) {
|
|
9450
|
+
var _a;
|
|
9451
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
9452
|
+
_this.loggerService.info("memorySchemaService getValue", {
|
|
9453
|
+
clientId: clientId,
|
|
9454
|
+
});
|
|
9455
|
+
return ((_a = _this.memoryMap.get(clientId)) !== null && _a !== void 0 ? _a : {});
|
|
9456
|
+
};
|
|
9457
|
+
/**
|
|
9458
|
+
* Disposes the memory map entry for a given client ID.
|
|
9459
|
+
*
|
|
9460
|
+
* @param {string} clientId - The ID of the client.
|
|
9461
|
+
*/
|
|
9462
|
+
this.dispose = function (clientId) {
|
|
9463
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO &&
|
|
9464
|
+
_this.loggerService.info("memorySchemaService dispose", {
|
|
9465
|
+
clientId: clientId,
|
|
9466
|
+
});
|
|
9467
|
+
_this.memoryMap.delete(clientId);
|
|
9468
|
+
};
|
|
9469
|
+
}
|
|
9470
|
+
return MemorySchemaService;
|
|
9471
|
+
}());
|
|
9472
|
+
|
|
9183
9473
|
{
|
|
9184
9474
|
provide(TYPES.docService, function () { return new DocService(); });
|
|
9185
9475
|
provide(TYPES.busService, function () { return new BusService(); });
|
|
@@ -9207,6 +9497,7 @@ var SharedStoragePublicService = /** @class */ (function () {
|
|
|
9207
9497
|
provide(TYPES.embeddingSchemaService, function () { return new EmbeddingSchemaService(); });
|
|
9208
9498
|
provide(TYPES.storageSchemaService, function () { return new StorageSchemaService(); });
|
|
9209
9499
|
provide(TYPES.stateSchemaService, function () { return new StateSchemaService(); });
|
|
9500
|
+
provide(TYPES.memorySchemaService, function () { return new MemorySchemaService(); });
|
|
9210
9501
|
}
|
|
9211
9502
|
{
|
|
9212
9503
|
provide(TYPES.agentPublicService, function () { return new AgentPublicService(); });
|
|
@@ -9259,6 +9550,7 @@ var schemaServices = {
|
|
|
9259
9550
|
embeddingSchemaService: inject(TYPES.embeddingSchemaService),
|
|
9260
9551
|
storageSchemaService: inject(TYPES.storageSchemaService),
|
|
9261
9552
|
stateSchemaService: inject(TYPES.stateSchemaService),
|
|
9553
|
+
memorySchemaService: inject(TYPES.memorySchemaService),
|
|
9262
9554
|
};
|
|
9263
9555
|
var publicServices = {
|
|
9264
9556
|
agentPublicService: inject(TYPES.agentPublicService),
|
|
@@ -9287,7 +9579,7 @@ var swarm = __assign(__assign(__assign(__assign(__assign(__assign(__assign({}, b
|
|
|
9287
9579
|
init();
|
|
9288
9580
|
var swarm$1 = swarm;
|
|
9289
9581
|
|
|
9290
|
-
var METHOD_NAME$
|
|
9582
|
+
var METHOD_NAME$O = "cli.dumpDocs";
|
|
9291
9583
|
/**
|
|
9292
9584
|
* Dumps the documentation for the agents and swarms.
|
|
9293
9585
|
*
|
|
@@ -9298,7 +9590,7 @@ var METHOD_NAME$L = "cli.dumpDocs";
|
|
|
9298
9590
|
var dumpDocs = function (dirName, PlantUML) {
|
|
9299
9591
|
if (dirName === void 0) { dirName = "./docs/chat"; }
|
|
9300
9592
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9301
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
9593
|
+
swarm$1.loggerService.log(METHOD_NAME$O, {
|
|
9302
9594
|
dirName: dirName,
|
|
9303
9595
|
});
|
|
9304
9596
|
if (PlantUML) {
|
|
@@ -9309,12 +9601,12 @@ var dumpDocs = function (dirName, PlantUML) {
|
|
|
9309
9601
|
swarm$1.agentValidationService
|
|
9310
9602
|
.getAgentList()
|
|
9311
9603
|
.forEach(function (agentName) {
|
|
9312
|
-
return swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
9604
|
+
return swarm$1.agentValidationService.validate(agentName, METHOD_NAME$O);
|
|
9313
9605
|
});
|
|
9314
9606
|
swarm$1.swarmValidationService
|
|
9315
9607
|
.getSwarmList()
|
|
9316
9608
|
.forEach(function (swarmName) {
|
|
9317
|
-
return swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
9609
|
+
return swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$O);
|
|
9318
9610
|
});
|
|
9319
9611
|
swarm$1.agentValidationService.getAgentList().forEach(function (agentName) {
|
|
9320
9612
|
var dependsOn = swarm$1.agentSchemaService.get(agentName).dependsOn;
|
|
@@ -9325,7 +9617,7 @@ var dumpDocs = function (dirName, PlantUML) {
|
|
|
9325
9617
|
return swarm$1.docService.dumpDocs(dirName);
|
|
9326
9618
|
};
|
|
9327
9619
|
|
|
9328
|
-
var METHOD_NAME$
|
|
9620
|
+
var METHOD_NAME$N = "cli.dumpAgent";
|
|
9329
9621
|
/**
|
|
9330
9622
|
* Dumps the agent information into PlantUML format.
|
|
9331
9623
|
*
|
|
@@ -9335,14 +9627,14 @@ var METHOD_NAME$K = "cli.dumpAgent";
|
|
|
9335
9627
|
var dumpAgent = function (agentName, _a) {
|
|
9336
9628
|
var _b = _a === void 0 ? {} : _a, _c = _b.withSubtree, withSubtree = _c === void 0 ? false : _c;
|
|
9337
9629
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9338
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
9630
|
+
swarm$1.loggerService.log(METHOD_NAME$N, {
|
|
9339
9631
|
agentName: agentName,
|
|
9340
9632
|
});
|
|
9341
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
9633
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$N);
|
|
9342
9634
|
return swarm$1.agentMetaService.toUML(agentName, withSubtree);
|
|
9343
9635
|
};
|
|
9344
9636
|
|
|
9345
|
-
var METHOD_NAME$
|
|
9637
|
+
var METHOD_NAME$M = "cli.dumpSwarm";
|
|
9346
9638
|
/**
|
|
9347
9639
|
* Dumps the swarm information into PlantUML format.
|
|
9348
9640
|
*
|
|
@@ -9351,14 +9643,14 @@ var METHOD_NAME$J = "cli.dumpSwarm";
|
|
|
9351
9643
|
*/
|
|
9352
9644
|
var dumpSwarm = function (swarmName) {
|
|
9353
9645
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9354
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
9646
|
+
swarm$1.loggerService.log(METHOD_NAME$M, {
|
|
9355
9647
|
swarmName: swarmName,
|
|
9356
9648
|
});
|
|
9357
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
9649
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$M);
|
|
9358
9650
|
return swarm$1.swarmMetaService.toUML(swarmName);
|
|
9359
9651
|
};
|
|
9360
9652
|
|
|
9361
|
-
var METHOD_NAME$
|
|
9653
|
+
var METHOD_NAME$L = "function.setup.addAgent";
|
|
9362
9654
|
/**
|
|
9363
9655
|
* Adds a new agent to the agent registry. The swarm takes only those agents which was registered
|
|
9364
9656
|
*
|
|
@@ -9367,7 +9659,7 @@ var METHOD_NAME$I = "function.addAgent";
|
|
|
9367
9659
|
*/
|
|
9368
9660
|
var addAgent = function (agentSchema) {
|
|
9369
9661
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9370
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
9662
|
+
swarm$1.loggerService.log(METHOD_NAME$L, {
|
|
9371
9663
|
agentSchema: agentSchema,
|
|
9372
9664
|
});
|
|
9373
9665
|
swarm$1.agentValidationService.addAgent(agentSchema.agentName, agentSchema);
|
|
@@ -9375,7 +9667,7 @@ var addAgent = function (agentSchema) {
|
|
|
9375
9667
|
return agentSchema.agentName;
|
|
9376
9668
|
};
|
|
9377
9669
|
|
|
9378
|
-
var METHOD_NAME$
|
|
9670
|
+
var METHOD_NAME$K = "function.setup.addCompletion";
|
|
9379
9671
|
/**
|
|
9380
9672
|
* Adds a completion engine for agents. Agents could use different models and
|
|
9381
9673
|
* framewords for completion like: mock, gpt4all, ollama, openai
|
|
@@ -9385,7 +9677,7 @@ var METHOD_NAME$H = "function.addCompletion";
|
|
|
9385
9677
|
*/
|
|
9386
9678
|
var addCompletion = function (completionSchema) {
|
|
9387
9679
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9388
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
9680
|
+
swarm$1.loggerService.log(METHOD_NAME$K, {
|
|
9389
9681
|
completionSchema: completionSchema,
|
|
9390
9682
|
});
|
|
9391
9683
|
swarm$1.completionValidationService.addCompletion(completionSchema.completionName);
|
|
@@ -9393,7 +9685,7 @@ var addCompletion = function (completionSchema) {
|
|
|
9393
9685
|
return completionSchema.completionName;
|
|
9394
9686
|
};
|
|
9395
9687
|
|
|
9396
|
-
var METHOD_NAME$
|
|
9688
|
+
var METHOD_NAME$J = "function.setup.addSwarm";
|
|
9397
9689
|
/**
|
|
9398
9690
|
* Adds a new swarm to the system. The swarm is a root for starting client session
|
|
9399
9691
|
*
|
|
@@ -9402,7 +9694,7 @@ var METHOD_NAME$G = "function.addSwarm";
|
|
|
9402
9694
|
*/
|
|
9403
9695
|
var addSwarm = function (swarmSchema) {
|
|
9404
9696
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9405
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
9697
|
+
swarm$1.loggerService.log(METHOD_NAME$J, {
|
|
9406
9698
|
swarmSchema: swarmSchema,
|
|
9407
9699
|
});
|
|
9408
9700
|
swarm$1.swarmValidationService.addSwarm(swarmSchema.swarmName, swarmSchema);
|
|
@@ -9410,7 +9702,7 @@ var addSwarm = function (swarmSchema) {
|
|
|
9410
9702
|
return swarmSchema.swarmName;
|
|
9411
9703
|
};
|
|
9412
9704
|
|
|
9413
|
-
var METHOD_NAME$
|
|
9705
|
+
var METHOD_NAME$I = "function.setup.addTool";
|
|
9414
9706
|
/**
|
|
9415
9707
|
* Adds a new tool for agents in a swarm. Tool should be registered in `addAgent`
|
|
9416
9708
|
* declaration
|
|
@@ -9420,7 +9712,7 @@ var METHOD_NAME$F = "function.addTool";
|
|
|
9420
9712
|
*/
|
|
9421
9713
|
var addTool = function (toolSchema) {
|
|
9422
9714
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9423
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
9715
|
+
swarm$1.loggerService.log(METHOD_NAME$I, {
|
|
9424
9716
|
toolSchema: toolSchema,
|
|
9425
9717
|
});
|
|
9426
9718
|
swarm$1.toolValidationService.addTool(toolSchema.toolName, toolSchema);
|
|
@@ -9428,7 +9720,7 @@ var addTool = function (toolSchema) {
|
|
|
9428
9720
|
return toolSchema.toolName;
|
|
9429
9721
|
};
|
|
9430
9722
|
|
|
9431
|
-
var METHOD_NAME$
|
|
9723
|
+
var METHOD_NAME$H = "function.setup.addState";
|
|
9432
9724
|
/**
|
|
9433
9725
|
* Adds a new state to the state registry. The swarm takes only those states which was registered
|
|
9434
9726
|
*
|
|
@@ -9437,7 +9729,7 @@ var METHOD_NAME$E = "function.addState";
|
|
|
9437
9729
|
*/
|
|
9438
9730
|
var addState = function (stateSchema) {
|
|
9439
9731
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9440
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
9732
|
+
swarm$1.loggerService.log(METHOD_NAME$H, {
|
|
9441
9733
|
stateSchema: stateSchema,
|
|
9442
9734
|
});
|
|
9443
9735
|
swarm$1.stateSchemaService.register(stateSchema.stateName, stateSchema);
|
|
@@ -9449,7 +9741,7 @@ var addState = function (stateSchema) {
|
|
|
9449
9741
|
return stateSchema.stateName;
|
|
9450
9742
|
};
|
|
9451
9743
|
|
|
9452
|
-
var METHOD_NAME$
|
|
9744
|
+
var METHOD_NAME$G = "function.setup.addEmbedding";
|
|
9453
9745
|
/**
|
|
9454
9746
|
* Adds a new embedding to the embedding registry. The swarm takes only those embeddings which was registered
|
|
9455
9747
|
*
|
|
@@ -9458,7 +9750,7 @@ var METHOD_NAME$D = "function.addEmbedding";
|
|
|
9458
9750
|
*/
|
|
9459
9751
|
var addEmbedding = function (embeddingSchema) {
|
|
9460
9752
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9461
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
9753
|
+
swarm$1.loggerService.log(METHOD_NAME$G, {
|
|
9462
9754
|
embeddingSchema: embeddingSchema,
|
|
9463
9755
|
});
|
|
9464
9756
|
swarm$1.embeddingValidationService.addEmbedding(embeddingSchema.embeddingName, embeddingSchema);
|
|
@@ -9466,7 +9758,7 @@ var addEmbedding = function (embeddingSchema) {
|
|
|
9466
9758
|
return embeddingSchema.embeddingName;
|
|
9467
9759
|
};
|
|
9468
9760
|
|
|
9469
|
-
var METHOD_NAME$
|
|
9761
|
+
var METHOD_NAME$F = "function.setup.addStorage";
|
|
9470
9762
|
/**
|
|
9471
9763
|
* Adds a new storage to the storage registry. The swarm takes only those storages which was registered
|
|
9472
9764
|
*
|
|
@@ -9475,7 +9767,7 @@ var METHOD_NAME$C = "function.addStorage";
|
|
|
9475
9767
|
*/
|
|
9476
9768
|
var addStorage = function (storageSchema) {
|
|
9477
9769
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9478
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
9770
|
+
swarm$1.loggerService.log(METHOD_NAME$F, {
|
|
9479
9771
|
storageSchema: storageSchema,
|
|
9480
9772
|
});
|
|
9481
9773
|
swarm$1.storageValidationService.addStorage(storageSchema.storageName, storageSchema);
|
|
@@ -9488,7 +9780,7 @@ var addStorage = function (storageSchema) {
|
|
|
9488
9780
|
return storageSchema.storageName;
|
|
9489
9781
|
};
|
|
9490
9782
|
|
|
9491
|
-
var METHOD_NAME$
|
|
9783
|
+
var METHOD_NAME$E = "function.commit.commitToolOutput";
|
|
9492
9784
|
/**
|
|
9493
9785
|
* Commits the tool output to the active agent in a swarm session
|
|
9494
9786
|
*
|
|
@@ -9503,17 +9795,17 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
|
|
|
9503
9795
|
switch (_a.label) {
|
|
9504
9796
|
case 0:
|
|
9505
9797
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9506
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
9798
|
+
swarm$1.loggerService.log(METHOD_NAME$E, {
|
|
9507
9799
|
toolId: toolId,
|
|
9508
9800
|
content: content,
|
|
9509
9801
|
clientId: clientId,
|
|
9510
9802
|
agentName: agentName,
|
|
9511
9803
|
});
|
|
9512
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
9513
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
9804
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$E);
|
|
9805
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$E);
|
|
9514
9806
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
9515
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
9516
|
-
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
9807
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$E);
|
|
9808
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$E, clientId, swarmName)];
|
|
9517
9809
|
case 1:
|
|
9518
9810
|
currentAgentName = _a.sent();
|
|
9519
9811
|
if (currentAgentName !== agentName) {
|
|
@@ -9526,7 +9818,7 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
|
|
|
9526
9818
|
});
|
|
9527
9819
|
return [2 /*return*/];
|
|
9528
9820
|
}
|
|
9529
|
-
return [4 /*yield*/, swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$
|
|
9821
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$E, clientId, swarmName)];
|
|
9530
9822
|
case 2:
|
|
9531
9823
|
_a.sent();
|
|
9532
9824
|
return [2 /*return*/];
|
|
@@ -9534,7 +9826,7 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
|
|
|
9534
9826
|
});
|
|
9535
9827
|
}); };
|
|
9536
9828
|
|
|
9537
|
-
var METHOD_NAME$
|
|
9829
|
+
var METHOD_NAME$D = "function.commit.commitSystemMessage";
|
|
9538
9830
|
/**
|
|
9539
9831
|
* Commits a system message to the active agent in the swarm.
|
|
9540
9832
|
*
|
|
@@ -9549,16 +9841,16 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
|
|
|
9549
9841
|
switch (_a.label) {
|
|
9550
9842
|
case 0:
|
|
9551
9843
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9552
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
9844
|
+
swarm$1.loggerService.log(METHOD_NAME$D, {
|
|
9553
9845
|
content: content,
|
|
9554
9846
|
clientId: clientId,
|
|
9555
9847
|
agentName: agentName,
|
|
9556
9848
|
});
|
|
9557
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
9558
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
9849
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$D);
|
|
9850
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$D);
|
|
9559
9851
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
9560
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
9561
|
-
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
9852
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$D);
|
|
9853
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$D, clientId, swarmName)];
|
|
9562
9854
|
case 1:
|
|
9563
9855
|
currentAgentName = _a.sent();
|
|
9564
9856
|
if (currentAgentName !== agentName) {
|
|
@@ -9570,7 +9862,7 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
|
|
|
9570
9862
|
});
|
|
9571
9863
|
return [2 /*return*/];
|
|
9572
9864
|
}
|
|
9573
|
-
return [4 /*yield*/, swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$
|
|
9865
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$D, clientId, swarmName)];
|
|
9574
9866
|
case 2:
|
|
9575
9867
|
_a.sent();
|
|
9576
9868
|
return [2 /*return*/];
|
|
@@ -9578,7 +9870,7 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
|
|
|
9578
9870
|
});
|
|
9579
9871
|
}); };
|
|
9580
9872
|
|
|
9581
|
-
var METHOD_NAME$
|
|
9873
|
+
var METHOD_NAME$C = "function.commit.commitFlush";
|
|
9582
9874
|
/**
|
|
9583
9875
|
* Commits flush of agent history
|
|
9584
9876
|
*
|
|
@@ -9592,15 +9884,15 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
|
|
|
9592
9884
|
switch (_a.label) {
|
|
9593
9885
|
case 0:
|
|
9594
9886
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9595
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
9887
|
+
swarm$1.loggerService.log(METHOD_NAME$C, {
|
|
9596
9888
|
clientId: clientId,
|
|
9597
9889
|
agentName: agentName,
|
|
9598
9890
|
});
|
|
9599
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
9600
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
9891
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$C);
|
|
9892
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$C);
|
|
9601
9893
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
9602
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
9603
|
-
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
9894
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$C);
|
|
9895
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$C, clientId, swarmName)];
|
|
9604
9896
|
case 1:
|
|
9605
9897
|
currentAgentName = _a.sent();
|
|
9606
9898
|
if (currentAgentName !== agentName) {
|
|
@@ -9612,7 +9904,7 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
|
|
|
9612
9904
|
});
|
|
9613
9905
|
return [2 /*return*/];
|
|
9614
9906
|
}
|
|
9615
|
-
return [4 /*yield*/, swarm$1.sessionPublicService.commitFlush(METHOD_NAME$
|
|
9907
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitFlush(METHOD_NAME$C, clientId, swarmName)];
|
|
9616
9908
|
case 2:
|
|
9617
9909
|
_a.sent();
|
|
9618
9910
|
return [2 /*return*/];
|
|
@@ -9620,7 +9912,7 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
|
|
|
9620
9912
|
});
|
|
9621
9913
|
}); };
|
|
9622
9914
|
|
|
9623
|
-
var METHOD_NAME$
|
|
9915
|
+
var METHOD_NAME$B = "function.commit.commitSystemMessage";
|
|
9624
9916
|
/**
|
|
9625
9917
|
* Commits a user message to the active agent history in as swarm without answer.
|
|
9626
9918
|
*
|
|
@@ -9635,16 +9927,16 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
|
|
|
9635
9927
|
switch (_a.label) {
|
|
9636
9928
|
case 0:
|
|
9637
9929
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9638
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
9930
|
+
swarm$1.loggerService.log(METHOD_NAME$B, {
|
|
9639
9931
|
content: content,
|
|
9640
9932
|
clientId: clientId,
|
|
9641
9933
|
agentName: agentName,
|
|
9642
9934
|
});
|
|
9643
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
9644
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
9935
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$B);
|
|
9936
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$B);
|
|
9645
9937
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
9646
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
9647
|
-
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
9938
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$B);
|
|
9939
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$B, clientId, swarmName)];
|
|
9648
9940
|
case 1:
|
|
9649
9941
|
currentAgentName = _a.sent();
|
|
9650
9942
|
if (currentAgentName !== agentName) {
|
|
@@ -9656,7 +9948,7 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
|
|
|
9656
9948
|
});
|
|
9657
9949
|
return [2 /*return*/];
|
|
9658
9950
|
}
|
|
9659
|
-
return [4 /*yield*/, swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$
|
|
9951
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$B, clientId, swarmName)];
|
|
9660
9952
|
case 2:
|
|
9661
9953
|
_a.sent();
|
|
9662
9954
|
return [2 /*return*/];
|
|
@@ -9664,7 +9956,7 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
|
|
|
9664
9956
|
});
|
|
9665
9957
|
}); };
|
|
9666
9958
|
|
|
9667
|
-
var METHOD_NAME$
|
|
9959
|
+
var METHOD_NAME$A = "function.commit.commitToolOutputForce";
|
|
9668
9960
|
/**
|
|
9669
9961
|
* Commits the tool output to the active agent in a swarm session without checking active agent
|
|
9670
9962
|
*
|
|
@@ -9678,15 +9970,15 @@ var commitToolOutputForce = function (toolId, content, clientId) { return __awai
|
|
|
9678
9970
|
switch (_a.label) {
|
|
9679
9971
|
case 0:
|
|
9680
9972
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9681
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
9973
|
+
swarm$1.loggerService.log(METHOD_NAME$A, {
|
|
9682
9974
|
toolId: toolId,
|
|
9683
9975
|
content: content,
|
|
9684
9976
|
clientId: clientId,
|
|
9685
9977
|
});
|
|
9686
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
9978
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$A);
|
|
9687
9979
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
9688
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
9689
|
-
return [4 /*yield*/, swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$
|
|
9980
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$A);
|
|
9981
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$A, clientId, swarmName)];
|
|
9690
9982
|
case 1:
|
|
9691
9983
|
_a.sent();
|
|
9692
9984
|
return [2 /*return*/];
|
|
@@ -9694,7 +9986,7 @@ var commitToolOutputForce = function (toolId, content, clientId) { return __awai
|
|
|
9694
9986
|
});
|
|
9695
9987
|
}); };
|
|
9696
9988
|
|
|
9697
|
-
var METHOD_NAME$
|
|
9989
|
+
var METHOD_NAME$z = "function.commit.commitSystemMessageForce";
|
|
9698
9990
|
/**
|
|
9699
9991
|
* Commits a system message to the active agent in as swarm without checking active agent.
|
|
9700
9992
|
*
|
|
@@ -9708,14 +10000,14 @@ var commitSystemMessageForce = function (content, clientId) { return __awaiter(v
|
|
|
9708
10000
|
switch (_a.label) {
|
|
9709
10001
|
case 0:
|
|
9710
10002
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9711
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10003
|
+
swarm$1.loggerService.log(METHOD_NAME$z, {
|
|
9712
10004
|
content: content,
|
|
9713
10005
|
clientId: clientId,
|
|
9714
10006
|
});
|
|
9715
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
10007
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$z);
|
|
9716
10008
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
9717
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
9718
|
-
return [4 /*yield*/, swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$
|
|
10009
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$z);
|
|
10010
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$z, clientId, swarmName)];
|
|
9719
10011
|
case 1:
|
|
9720
10012
|
_a.sent();
|
|
9721
10013
|
return [2 /*return*/];
|
|
@@ -9723,7 +10015,7 @@ var commitSystemMessageForce = function (content, clientId) { return __awaiter(v
|
|
|
9723
10015
|
});
|
|
9724
10016
|
}); };
|
|
9725
10017
|
|
|
9726
|
-
var METHOD_NAME$
|
|
10018
|
+
var METHOD_NAME$y = "function.commit.commitFlushForce";
|
|
9727
10019
|
/**
|
|
9728
10020
|
* Commits flush of agent history without active agent check
|
|
9729
10021
|
*
|
|
@@ -9736,14 +10028,14 @@ var commitFlushForce = function (clientId) { return __awaiter(void 0, void 0, vo
|
|
|
9736
10028
|
switch (_a.label) {
|
|
9737
10029
|
case 0:
|
|
9738
10030
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9739
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10031
|
+
swarm$1.loggerService.log(METHOD_NAME$y, {
|
|
9740
10032
|
clientId: clientId,
|
|
9741
|
-
METHOD_NAME: METHOD_NAME$
|
|
10033
|
+
METHOD_NAME: METHOD_NAME$y,
|
|
9742
10034
|
});
|
|
9743
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
10035
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$y);
|
|
9744
10036
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
9745
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
9746
|
-
return [4 /*yield*/, swarm$1.sessionPublicService.commitFlush(METHOD_NAME$
|
|
10037
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$y);
|
|
10038
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitFlush(METHOD_NAME$y, clientId, swarmName)];
|
|
9747
10039
|
case 1:
|
|
9748
10040
|
_a.sent();
|
|
9749
10041
|
return [2 /*return*/];
|
|
@@ -9751,7 +10043,7 @@ var commitFlushForce = function (clientId) { return __awaiter(void 0, void 0, vo
|
|
|
9751
10043
|
});
|
|
9752
10044
|
}); };
|
|
9753
10045
|
|
|
9754
|
-
var METHOD_NAME$
|
|
10046
|
+
var METHOD_NAME$x = "function.commit.commitSystemMessage";
|
|
9755
10047
|
/**
|
|
9756
10048
|
* Commits a user message to the active agent history in as swarm without answer and checking active agent
|
|
9757
10049
|
*
|
|
@@ -9765,14 +10057,14 @@ var commitUserMessageForce = function (content, clientId) { return __awaiter(voi
|
|
|
9765
10057
|
switch (_a.label) {
|
|
9766
10058
|
case 0:
|
|
9767
10059
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9768
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10060
|
+
swarm$1.loggerService.log(METHOD_NAME$x, {
|
|
9769
10061
|
content: content,
|
|
9770
10062
|
clientId: clientId,
|
|
9771
10063
|
});
|
|
9772
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
10064
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$x);
|
|
9773
10065
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
9774
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
9775
|
-
return [4 /*yield*/, swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$
|
|
10066
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$x);
|
|
10067
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$x, clientId, swarmName)];
|
|
9776
10068
|
case 1:
|
|
9777
10069
|
_a.sent();
|
|
9778
10070
|
return [2 /*return*/];
|
|
@@ -9780,7 +10072,7 @@ var commitUserMessageForce = function (content, clientId) { return __awaiter(voi
|
|
|
9780
10072
|
});
|
|
9781
10073
|
}); };
|
|
9782
10074
|
|
|
9783
|
-
var METHOD_NAME$
|
|
10075
|
+
var METHOD_NAME$w = "function.commit.commitAssistantMessage";
|
|
9784
10076
|
/**
|
|
9785
10077
|
* Commits an assistant message to the active agent in the swarm.
|
|
9786
10078
|
*
|
|
@@ -9795,16 +10087,16 @@ var commitAssistantMessage = function (content, clientId, agentName) { return __
|
|
|
9795
10087
|
switch (_a.label) {
|
|
9796
10088
|
case 0:
|
|
9797
10089
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9798
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10090
|
+
swarm$1.loggerService.log(METHOD_NAME$w, {
|
|
9799
10091
|
content: content,
|
|
9800
10092
|
clientId: clientId,
|
|
9801
10093
|
agentName: agentName,
|
|
9802
10094
|
});
|
|
9803
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
9804
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
10095
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$w);
|
|
10096
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$w);
|
|
9805
10097
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
9806
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
9807
|
-
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
10098
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$w);
|
|
10099
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$w, clientId, swarmName)];
|
|
9808
10100
|
case 1:
|
|
9809
10101
|
currentAgentName = _a.sent();
|
|
9810
10102
|
if (currentAgentName !== agentName) {
|
|
@@ -9816,7 +10108,7 @@ var commitAssistantMessage = function (content, clientId, agentName) { return __
|
|
|
9816
10108
|
});
|
|
9817
10109
|
return [2 /*return*/];
|
|
9818
10110
|
}
|
|
9819
|
-
return [4 /*yield*/, swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$
|
|
10111
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$w, clientId, swarmName)];
|
|
9820
10112
|
case 2:
|
|
9821
10113
|
_a.sent();
|
|
9822
10114
|
return [2 /*return*/];
|
|
@@ -9824,7 +10116,7 @@ var commitAssistantMessage = function (content, clientId, agentName) { return __
|
|
|
9824
10116
|
});
|
|
9825
10117
|
}); };
|
|
9826
10118
|
|
|
9827
|
-
var METHOD_NAME$
|
|
10119
|
+
var METHOD_NAME$v = "function.commit.commitAssistantMessageForce";
|
|
9828
10120
|
/**
|
|
9829
10121
|
* Commits an assistant message to the active agent in as swarm without checking active agent.
|
|
9830
10122
|
*
|
|
@@ -9838,14 +10130,14 @@ var commitAssistantMessageForce = function (content, clientId) { return __awaite
|
|
|
9838
10130
|
switch (_a.label) {
|
|
9839
10131
|
case 0:
|
|
9840
10132
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9841
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10133
|
+
swarm$1.loggerService.log(METHOD_NAME$v, {
|
|
9842
10134
|
content: content,
|
|
9843
10135
|
clientId: clientId,
|
|
9844
10136
|
});
|
|
9845
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
10137
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$v);
|
|
9846
10138
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
9847
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
9848
|
-
return [4 /*yield*/, swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$
|
|
10139
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$v);
|
|
10140
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitAssistantMessage(content, METHOD_NAME$v, clientId, swarmName)];
|
|
9849
10141
|
case 1:
|
|
9850
10142
|
_a.sent();
|
|
9851
10143
|
return [2 /*return*/];
|
|
@@ -9853,7 +10145,7 @@ var commitAssistantMessageForce = function (content, clientId) { return __awaite
|
|
|
9853
10145
|
});
|
|
9854
10146
|
}); };
|
|
9855
10147
|
|
|
9856
|
-
var METHOD_NAME$
|
|
10148
|
+
var METHOD_NAME$u = "function.commit.cancelOutput";
|
|
9857
10149
|
/**
|
|
9858
10150
|
* Cancel the await of output by emit of empty string
|
|
9859
10151
|
*
|
|
@@ -9867,15 +10159,15 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
|
|
|
9867
10159
|
switch (_a.label) {
|
|
9868
10160
|
case 0:
|
|
9869
10161
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9870
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10162
|
+
swarm$1.loggerService.log(METHOD_NAME$u, {
|
|
9871
10163
|
clientId: clientId,
|
|
9872
10164
|
agentName: agentName,
|
|
9873
10165
|
});
|
|
9874
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
9875
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
10166
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$u);
|
|
10167
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$u);
|
|
9876
10168
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
9877
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
9878
|
-
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
10169
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$u);
|
|
10170
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$u, clientId, swarmName)];
|
|
9879
10171
|
case 1:
|
|
9880
10172
|
currentAgentName = _a.sent();
|
|
9881
10173
|
if (currentAgentName !== agentName) {
|
|
@@ -9887,7 +10179,7 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
|
|
|
9887
10179
|
});
|
|
9888
10180
|
return [2 /*return*/];
|
|
9889
10181
|
}
|
|
9890
|
-
return [4 /*yield*/, swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$
|
|
10182
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$u, clientId, swarmName)];
|
|
9891
10183
|
case 2:
|
|
9892
10184
|
_a.sent();
|
|
9893
10185
|
return [2 /*return*/];
|
|
@@ -9895,7 +10187,7 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
|
|
|
9895
10187
|
});
|
|
9896
10188
|
}); };
|
|
9897
10189
|
|
|
9898
|
-
var METHOD_NAME$
|
|
10190
|
+
var METHOD_NAME$t = "function.commit.cancelOutputForce";
|
|
9899
10191
|
/**
|
|
9900
10192
|
* Cancel the await of output by emit of empty string without checking active agent
|
|
9901
10193
|
*
|
|
@@ -9909,13 +10201,13 @@ var cancelOutputForce = function (clientId) { return __awaiter(void 0, void 0, v
|
|
|
9909
10201
|
switch (_a.label) {
|
|
9910
10202
|
case 0:
|
|
9911
10203
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9912
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10204
|
+
swarm$1.loggerService.log(METHOD_NAME$t, {
|
|
9913
10205
|
clientId: clientId,
|
|
9914
10206
|
});
|
|
9915
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
10207
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$t);
|
|
9916
10208
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
9917
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
9918
|
-
return [4 /*yield*/, swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$
|
|
10209
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$t);
|
|
10210
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$t, clientId, swarmName)];
|
|
9919
10211
|
case 1:
|
|
9920
10212
|
_a.sent();
|
|
9921
10213
|
return [2 /*return*/];
|
|
@@ -9923,7 +10215,7 @@ var cancelOutputForce = function (clientId) { return __awaiter(void 0, void 0, v
|
|
|
9923
10215
|
});
|
|
9924
10216
|
}); };
|
|
9925
10217
|
|
|
9926
|
-
var METHOD_NAME$
|
|
10218
|
+
var METHOD_NAME$s = "function.commit.commitStopTools";
|
|
9927
10219
|
/**
|
|
9928
10220
|
* Prevent the next tool from being executed
|
|
9929
10221
|
*
|
|
@@ -9937,15 +10229,15 @@ var commitStopTools = function (clientId, agentName) { return __awaiter(void 0,
|
|
|
9937
10229
|
switch (_a.label) {
|
|
9938
10230
|
case 0:
|
|
9939
10231
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9940
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10232
|
+
swarm$1.loggerService.log(METHOD_NAME$s, {
|
|
9941
10233
|
clientId: clientId,
|
|
9942
10234
|
agentName: agentName,
|
|
9943
10235
|
});
|
|
9944
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
9945
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
10236
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$s);
|
|
10237
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$s);
|
|
9946
10238
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
9947
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
9948
|
-
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
10239
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$s);
|
|
10240
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$s, clientId, swarmName)];
|
|
9949
10241
|
case 1:
|
|
9950
10242
|
currentAgentName = _a.sent();
|
|
9951
10243
|
if (currentAgentName !== agentName) {
|
|
@@ -9957,7 +10249,7 @@ var commitStopTools = function (clientId, agentName) { return __awaiter(void 0,
|
|
|
9957
10249
|
});
|
|
9958
10250
|
return [2 /*return*/];
|
|
9959
10251
|
}
|
|
9960
|
-
return [4 /*yield*/, swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$
|
|
10252
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$s, clientId, swarmName)];
|
|
9961
10253
|
case 2:
|
|
9962
10254
|
_a.sent();
|
|
9963
10255
|
return [2 /*return*/];
|
|
@@ -9965,7 +10257,7 @@ var commitStopTools = function (clientId, agentName) { return __awaiter(void 0,
|
|
|
9965
10257
|
});
|
|
9966
10258
|
}); };
|
|
9967
10259
|
|
|
9968
|
-
var METHOD_NAME$
|
|
10260
|
+
var METHOD_NAME$r = "function.commit.commitStopToolsForce";
|
|
9969
10261
|
/**
|
|
9970
10262
|
* Prevent the next tool from being executed without active agent check
|
|
9971
10263
|
*
|
|
@@ -9978,14 +10270,14 @@ var commitStopToolsForce = function (clientId) { return __awaiter(void 0, void 0
|
|
|
9978
10270
|
switch (_a.label) {
|
|
9979
10271
|
case 0:
|
|
9980
10272
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
9981
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10273
|
+
swarm$1.loggerService.log(METHOD_NAME$r, {
|
|
9982
10274
|
clientId: clientId,
|
|
9983
|
-
METHOD_NAME: METHOD_NAME$
|
|
10275
|
+
METHOD_NAME: METHOD_NAME$r,
|
|
9984
10276
|
});
|
|
9985
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
10277
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$r);
|
|
9986
10278
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
9987
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
9988
|
-
return [4 /*yield*/, swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$
|
|
10279
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$r);
|
|
10280
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitStopTools(METHOD_NAME$r, clientId, swarmName)];
|
|
9989
10281
|
case 1:
|
|
9990
10282
|
_a.sent();
|
|
9991
10283
|
return [2 /*return*/];
|
|
@@ -9993,7 +10285,7 @@ var commitStopToolsForce = function (clientId) { return __awaiter(void 0, void 0
|
|
|
9993
10285
|
});
|
|
9994
10286
|
}); };
|
|
9995
10287
|
|
|
9996
|
-
var METHOD_NAME$
|
|
10288
|
+
var METHOD_NAME$q = "function.target.emitForce";
|
|
9997
10289
|
/**
|
|
9998
10290
|
* Emits a string constant as the model output without executing incoming message and checking active agent
|
|
9999
10291
|
* Works only for `makeConnection`
|
|
@@ -10010,23 +10302,23 @@ var emitForce = function (content, clientId) { return __awaiter(void 0, void 0,
|
|
|
10010
10302
|
switch (_a.label) {
|
|
10011
10303
|
case 0:
|
|
10012
10304
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
10013
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10305
|
+
swarm$1.loggerService.log(METHOD_NAME$q, {
|
|
10014
10306
|
content: content,
|
|
10015
10307
|
clientId: clientId,
|
|
10016
10308
|
});
|
|
10017
10309
|
if (swarm$1.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
10018
10310
|
throw new Error("agent-swarm-kit emitForce session is not makeConnection clientId=".concat(clientId));
|
|
10019
10311
|
}
|
|
10020
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
10312
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$q);
|
|
10021
10313
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
10022
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
10023
|
-
return [4 /*yield*/, swarm$1.sessionPublicService.emit(content, METHOD_NAME$
|
|
10314
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$q);
|
|
10315
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.emit(content, METHOD_NAME$q, clientId, swarmName)];
|
|
10024
10316
|
case 1: return [2 /*return*/, _a.sent()];
|
|
10025
10317
|
}
|
|
10026
10318
|
});
|
|
10027
10319
|
}); };
|
|
10028
10320
|
|
|
10029
|
-
var METHOD_NAME$
|
|
10321
|
+
var METHOD_NAME$p = "function.target.executeForce";
|
|
10030
10322
|
/**
|
|
10031
10323
|
* Send the message to the active agent in the swarm content like it income from client side
|
|
10032
10324
|
* Should be used to review tool output and initiate conversation from the model side to client
|
|
@@ -10042,18 +10334,18 @@ var executeForce = function (content, clientId) { return __awaiter(void 0, void
|
|
|
10042
10334
|
return __generator(this, function (_a) {
|
|
10043
10335
|
executionId = functoolsKit.randomString();
|
|
10044
10336
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
10045
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10337
|
+
swarm$1.loggerService.log(METHOD_NAME$p, {
|
|
10046
10338
|
content: content,
|
|
10047
10339
|
clientId: clientId,
|
|
10048
10340
|
executionId: executionId,
|
|
10049
10341
|
});
|
|
10050
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
10342
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$p);
|
|
10051
10343
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
10052
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
10344
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$p);
|
|
10053
10345
|
return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
10054
10346
|
return __generator(this, function (_a) {
|
|
10055
10347
|
switch (_a.label) {
|
|
10056
|
-
case 0: return [4 /*yield*/, swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$
|
|
10348
|
+
case 0: return [4 /*yield*/, swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$p, clientId, swarmName)];
|
|
10057
10349
|
case 1: return [2 /*return*/, _a.sent()];
|
|
10058
10350
|
}
|
|
10059
10351
|
});
|
|
@@ -10064,7 +10356,7 @@ var executeForce = function (content, clientId) { return __awaiter(void 0, void
|
|
|
10064
10356
|
});
|
|
10065
10357
|
}); };
|
|
10066
10358
|
|
|
10067
|
-
var METHOD_NAME$
|
|
10359
|
+
var METHOD_NAME$o = "function.target.disposeConnection";
|
|
10068
10360
|
/**
|
|
10069
10361
|
* Disposes the session for a given client with all related swarms and agents.
|
|
10070
10362
|
*
|
|
@@ -10078,12 +10370,12 @@ var disposeConnection = function (clientId_1, swarmName_1) {
|
|
|
10078
10370
|
args_1[_i - 2] = arguments[_i];
|
|
10079
10371
|
}
|
|
10080
10372
|
return __awaiter(void 0, __spreadArray([clientId_1, swarmName_1], __read(args_1), false), void 0, function (clientId, swarmName, methodName) {
|
|
10081
|
-
if (methodName === void 0) { methodName = METHOD_NAME$
|
|
10373
|
+
if (methodName === void 0) { methodName = METHOD_NAME$o; }
|
|
10082
10374
|
return __generator(this, function (_a) {
|
|
10083
10375
|
switch (_a.label) {
|
|
10084
10376
|
case 0:
|
|
10085
10377
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
10086
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10378
|
+
swarm$1.loggerService.log(METHOD_NAME$o, {
|
|
10087
10379
|
clientId: clientId,
|
|
10088
10380
|
swarmName: swarmName,
|
|
10089
10381
|
});
|
|
@@ -10157,13 +10449,14 @@ var disposeConnection = function (clientId_1, swarmName_1) {
|
|
|
10157
10449
|
swarm$1.sessionValidationService.removeSession(clientId);
|
|
10158
10450
|
swarm$1.busService.dispose(clientId);
|
|
10159
10451
|
swarm$1.sessionValidationService.dispose(clientId);
|
|
10452
|
+
swarm$1.memorySchemaService.dispose(clientId);
|
|
10160
10453
|
return [2 /*return*/];
|
|
10161
10454
|
}
|
|
10162
10455
|
});
|
|
10163
10456
|
});
|
|
10164
10457
|
};
|
|
10165
10458
|
|
|
10166
|
-
var METHOD_NAME$
|
|
10459
|
+
var METHOD_NAME$n = "function.target.makeAutoDispose";
|
|
10167
10460
|
var DEFAULT_TIMEOUT = 15 * 60;
|
|
10168
10461
|
/**
|
|
10169
10462
|
* Creates an auto-dispose mechanism for a client in a swarm.
|
|
@@ -10176,7 +10469,7 @@ var DEFAULT_TIMEOUT = 15 * 60;
|
|
|
10176
10469
|
var makeAutoDispose = function (clientId, swarmName, _a) {
|
|
10177
10470
|
var _b = _a === void 0 ? {} : _a, _c = _b.timeoutSeconds, timeoutSeconds = _c === void 0 ? DEFAULT_TIMEOUT : _c, onDestroy = _b.onDestroy;
|
|
10178
10471
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
10179
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10472
|
+
swarm$1.loggerService.log(METHOD_NAME$n, {
|
|
10180
10473
|
clientId: clientId,
|
|
10181
10474
|
swarmName: swarmName,
|
|
10182
10475
|
});
|
|
@@ -10223,7 +10516,7 @@ var makeAutoDispose = function (clientId, swarmName, _a) {
|
|
|
10223
10516
|
};
|
|
10224
10517
|
};
|
|
10225
10518
|
|
|
10226
|
-
var METHOD_NAME$
|
|
10519
|
+
var METHOD_NAME$m = "function.target.execute";
|
|
10227
10520
|
/**
|
|
10228
10521
|
* Send the message to the active agent in the swarm content like it income from client side
|
|
10229
10522
|
* Should be used to review tool output and initiate conversation from the model side to client
|
|
@@ -10240,17 +10533,17 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
|
|
|
10240
10533
|
case 0:
|
|
10241
10534
|
executionId = functoolsKit.randomString();
|
|
10242
10535
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
10243
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10536
|
+
swarm$1.loggerService.log(METHOD_NAME$m, {
|
|
10244
10537
|
content: content,
|
|
10245
10538
|
clientId: clientId,
|
|
10246
10539
|
agentName: agentName,
|
|
10247
10540
|
executionId: executionId,
|
|
10248
10541
|
});
|
|
10249
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
10250
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
10542
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$m);
|
|
10543
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$m);
|
|
10251
10544
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
10252
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
10253
|
-
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
10545
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$m);
|
|
10546
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$m, clientId, swarmName)];
|
|
10254
10547
|
case 1:
|
|
10255
10548
|
currentAgentName = _a.sent();
|
|
10256
10549
|
if (currentAgentName !== agentName) {
|
|
@@ -10265,7 +10558,7 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
|
|
|
10265
10558
|
return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
10266
10559
|
return __generator(this, function (_a) {
|
|
10267
10560
|
switch (_a.label) {
|
|
10268
|
-
case 0: return [4 /*yield*/, swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$
|
|
10561
|
+
case 0: return [4 /*yield*/, swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$m, clientId, swarmName)];
|
|
10269
10562
|
case 1: return [2 /*return*/, _a.sent()];
|
|
10270
10563
|
}
|
|
10271
10564
|
});
|
|
@@ -10277,7 +10570,7 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
|
|
|
10277
10570
|
});
|
|
10278
10571
|
}); };
|
|
10279
10572
|
|
|
10280
|
-
var METHOD_NAME$
|
|
10573
|
+
var METHOD_NAME$l = "function.target.emit";
|
|
10281
10574
|
/**
|
|
10282
10575
|
* Emits a string constant as the model output without executing incoming message
|
|
10283
10576
|
* Works only for `makeConnection`
|
|
@@ -10294,7 +10587,7 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
10294
10587
|
switch (_a.label) {
|
|
10295
10588
|
case 0:
|
|
10296
10589
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
10297
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10590
|
+
swarm$1.loggerService.log(METHOD_NAME$l, {
|
|
10298
10591
|
content: content,
|
|
10299
10592
|
clientId: clientId,
|
|
10300
10593
|
agentName: agentName,
|
|
@@ -10302,11 +10595,11 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
10302
10595
|
if (swarm$1.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
10303
10596
|
throw new Error("agent-swarm-kit emit session is not makeConnection clientId=".concat(clientId));
|
|
10304
10597
|
}
|
|
10305
|
-
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$
|
|
10306
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
10598
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$l);
|
|
10599
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$l);
|
|
10307
10600
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
10308
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
10309
|
-
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
10601
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$l);
|
|
10602
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$l, clientId, swarmName)];
|
|
10310
10603
|
case 1:
|
|
10311
10604
|
currentAgentName = _a.sent();
|
|
10312
10605
|
if (currentAgentName !== agentName) {
|
|
@@ -10318,13 +10611,105 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
10318
10611
|
});
|
|
10319
10612
|
return [2 /*return*/];
|
|
10320
10613
|
}
|
|
10321
|
-
return [4 /*yield*/, swarm$1.sessionPublicService.emit(content, METHOD_NAME$
|
|
10614
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.emit(content, METHOD_NAME$l, clientId, swarmName)];
|
|
10322
10615
|
case 2: return [2 /*return*/, _a.sent()];
|
|
10323
10616
|
}
|
|
10324
10617
|
});
|
|
10325
10618
|
}); };
|
|
10326
10619
|
|
|
10327
|
-
var METHOD_NAME$
|
|
10620
|
+
var METHOD_NAME$k = "function.target.run";
|
|
10621
|
+
/**
|
|
10622
|
+
* Complete the message stateless without append to the chat history
|
|
10623
|
+
* Use to prevent model from history overflow while handling storage output
|
|
10624
|
+
*
|
|
10625
|
+
* @param {string} content - The content to be runned.
|
|
10626
|
+
* @param {string} clientId - The ID of the client requesting run.
|
|
10627
|
+
* @param {AgentName} agentName - The name of the agent running the command.
|
|
10628
|
+
* @returns {Promise<string>} - A promise that resolves the run result
|
|
10629
|
+
*/
|
|
10630
|
+
var run = function (content, clientId, agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
10631
|
+
var executionId, swarmName, currentAgentName;
|
|
10632
|
+
return __generator(this, function (_a) {
|
|
10633
|
+
switch (_a.label) {
|
|
10634
|
+
case 0:
|
|
10635
|
+
executionId = functoolsKit.randomString();
|
|
10636
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
10637
|
+
swarm$1.loggerService.log(METHOD_NAME$k, {
|
|
10638
|
+
content: content,
|
|
10639
|
+
clientId: clientId,
|
|
10640
|
+
agentName: agentName,
|
|
10641
|
+
executionId: executionId,
|
|
10642
|
+
});
|
|
10643
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$k);
|
|
10644
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$k);
|
|
10645
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
10646
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$k);
|
|
10647
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$k, clientId, swarmName)];
|
|
10648
|
+
case 1:
|
|
10649
|
+
currentAgentName = _a.sent();
|
|
10650
|
+
if (currentAgentName !== agentName) {
|
|
10651
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
10652
|
+
swarm$1.loggerService.log('function "run" skipped due to the agent change', {
|
|
10653
|
+
currentAgentName: currentAgentName,
|
|
10654
|
+
agentName: agentName,
|
|
10655
|
+
clientId: clientId,
|
|
10656
|
+
});
|
|
10657
|
+
return [2 /*return*/];
|
|
10658
|
+
}
|
|
10659
|
+
return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
10660
|
+
return __generator(this, function (_a) {
|
|
10661
|
+
switch (_a.label) {
|
|
10662
|
+
case 0: return [4 /*yield*/, swarm$1.sessionPublicService.run(content, METHOD_NAME$k, clientId, swarmName)];
|
|
10663
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
10664
|
+
}
|
|
10665
|
+
});
|
|
10666
|
+
}); }, {
|
|
10667
|
+
clientId: clientId,
|
|
10668
|
+
executionId: executionId,
|
|
10669
|
+
})];
|
|
10670
|
+
}
|
|
10671
|
+
});
|
|
10672
|
+
}); };
|
|
10673
|
+
|
|
10674
|
+
var METHOD_NAME$j = "function.target.runForce";
|
|
10675
|
+
/**
|
|
10676
|
+
* Complete the message stateless without append to the chat history
|
|
10677
|
+
* Use to prevent model from history overflow while handling storage output
|
|
10678
|
+
*
|
|
10679
|
+
* Will run even if the agent is inactive
|
|
10680
|
+
*
|
|
10681
|
+
* @param {string} content - The content to be runned.
|
|
10682
|
+
* @param {string} clientId - The ID of the client requesting run.
|
|
10683
|
+
* @returns {Promise<string>} - A promise that resolves the run result
|
|
10684
|
+
*/
|
|
10685
|
+
var runForce = function (content, clientId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
10686
|
+
var executionId, swarmName;
|
|
10687
|
+
return __generator(this, function (_a) {
|
|
10688
|
+
executionId = functoolsKit.randomString();
|
|
10689
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
10690
|
+
swarm$1.loggerService.log(METHOD_NAME$j, {
|
|
10691
|
+
content: content,
|
|
10692
|
+
clientId: clientId,
|
|
10693
|
+
executionId: executionId,
|
|
10694
|
+
});
|
|
10695
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$j);
|
|
10696
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
10697
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$j);
|
|
10698
|
+
return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
10699
|
+
return __generator(this, function (_a) {
|
|
10700
|
+
switch (_a.label) {
|
|
10701
|
+
case 0: return [4 /*yield*/, swarm$1.sessionPublicService.run(content, METHOD_NAME$j, clientId, swarmName)];
|
|
10702
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
10703
|
+
}
|
|
10704
|
+
});
|
|
10705
|
+
}); }, {
|
|
10706
|
+
clientId: clientId,
|
|
10707
|
+
executionId: executionId,
|
|
10708
|
+
})];
|
|
10709
|
+
});
|
|
10710
|
+
}); };
|
|
10711
|
+
|
|
10712
|
+
var METHOD_NAME$i = "function.common.getAgentName";
|
|
10328
10713
|
/**
|
|
10329
10714
|
* Retrieves the agent name for a given client ID.
|
|
10330
10715
|
*
|
|
@@ -10338,20 +10723,20 @@ var getAgentName = function (clientId) { return __awaiter(void 0, void 0, void 0
|
|
|
10338
10723
|
switch (_a.label) {
|
|
10339
10724
|
case 0:
|
|
10340
10725
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
10341
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10726
|
+
swarm$1.loggerService.log(METHOD_NAME$i, {
|
|
10342
10727
|
clientId: clientId,
|
|
10343
10728
|
});
|
|
10344
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
10729
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$i);
|
|
10345
10730
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
10346
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
10347
|
-
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
10731
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$i);
|
|
10732
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$i, clientId, swarmName)];
|
|
10348
10733
|
case 1: return [2 /*return*/, _a.sent()];
|
|
10349
10734
|
}
|
|
10350
10735
|
});
|
|
10351
10736
|
}); };
|
|
10352
10737
|
|
|
10353
10738
|
var SCHEDULED_DELAY$1 = 1000;
|
|
10354
|
-
var METHOD_NAME$
|
|
10739
|
+
var METHOD_NAME$h = "function.target.makeConnection";
|
|
10355
10740
|
/**
|
|
10356
10741
|
* A connection factory for a client to a swarm and returns a function to send messages.
|
|
10357
10742
|
*
|
|
@@ -10362,25 +10747,25 @@ var METHOD_NAME$g = "function.makeConnection";
|
|
|
10362
10747
|
*/
|
|
10363
10748
|
var makeConnection = function (connector, clientId, swarmName) {
|
|
10364
10749
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
10365
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10750
|
+
swarm$1.loggerService.log(METHOD_NAME$h, {
|
|
10366
10751
|
clientId: clientId,
|
|
10367
10752
|
swarmName: swarmName,
|
|
10368
10753
|
});
|
|
10369
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
10754
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$h);
|
|
10370
10755
|
swarm$1.sessionValidationService.addSession(clientId, swarmName, "makeConnection");
|
|
10371
|
-
var send = swarm$1.sessionPublicService.connect(connector, METHOD_NAME$
|
|
10756
|
+
var send = swarm$1.sessionPublicService.connect(connector, METHOD_NAME$h, clientId, swarmName);
|
|
10372
10757
|
return functoolsKit.queued(function (outgoing) { return __awaiter(void 0, void 0, void 0, function () {
|
|
10373
10758
|
var _a;
|
|
10374
10759
|
var _b;
|
|
10375
10760
|
return __generator(this, function (_c) {
|
|
10376
10761
|
switch (_c.label) {
|
|
10377
10762
|
case 0:
|
|
10378
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
10763
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$h);
|
|
10379
10764
|
_a = send;
|
|
10380
10765
|
_b = {
|
|
10381
10766
|
data: outgoing
|
|
10382
10767
|
};
|
|
10383
|
-
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$
|
|
10768
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$h, clientId, swarmName)];
|
|
10384
10769
|
case 1: return [4 /*yield*/, _a.apply(void 0, [(_b.agentName = _c.sent(),
|
|
10385
10770
|
_b.clientId = clientId,
|
|
10386
10771
|
_b)])];
|
|
@@ -10466,7 +10851,7 @@ makeConnection.scheduled = function (connector, clientId, swarmName, _a) {
|
|
|
10466
10851
|
}); };
|
|
10467
10852
|
};
|
|
10468
10853
|
|
|
10469
|
-
var METHOD_NAME$
|
|
10854
|
+
var METHOD_NAME$g = "function.target.complete";
|
|
10470
10855
|
var COMPLETE_TTL = 15 * 60 * 1000;
|
|
10471
10856
|
var COMPLETE_GC = 60 * 1000;
|
|
10472
10857
|
/**
|
|
@@ -10526,7 +10911,7 @@ var complete = function (content, clientId, swarmName) { return __awaiter(void 0
|
|
|
10526
10911
|
case 0:
|
|
10527
10912
|
executionId = functoolsKit.randomString();
|
|
10528
10913
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
10529
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10914
|
+
swarm$1.loggerService.log(METHOD_NAME$g, {
|
|
10530
10915
|
content: content,
|
|
10531
10916
|
clientId: clientId,
|
|
10532
10917
|
executionId: executionId,
|
|
@@ -10539,7 +10924,7 @@ var complete = function (content, clientId, swarmName) { return __awaiter(void 0
|
|
|
10539
10924
|
return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
10540
10925
|
return __generator(this, function (_a) {
|
|
10541
10926
|
switch (_a.label) {
|
|
10542
|
-
case 0: return [4 /*yield*/, run(METHOD_NAME$
|
|
10927
|
+
case 0: return [4 /*yield*/, run(METHOD_NAME$g, content)];
|
|
10543
10928
|
case 1: return [2 /*return*/, _a.sent()];
|
|
10544
10929
|
}
|
|
10545
10930
|
});
|
|
@@ -10552,7 +10937,7 @@ var complete = function (content, clientId, swarmName) { return __awaiter(void 0
|
|
|
10552
10937
|
}); };
|
|
10553
10938
|
|
|
10554
10939
|
var SCHEDULED_DELAY = 1000;
|
|
10555
|
-
var METHOD_NAME$
|
|
10940
|
+
var METHOD_NAME$f = "function.target.session";
|
|
10556
10941
|
/**
|
|
10557
10942
|
* Creates a session for the given client and swarm.
|
|
10558
10943
|
*
|
|
@@ -10565,12 +10950,12 @@ var METHOD_NAME$e = "function.session";
|
|
|
10565
10950
|
var session = function (clientId, swarmName) {
|
|
10566
10951
|
var executionId = functoolsKit.randomString();
|
|
10567
10952
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
10568
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
10953
|
+
swarm$1.loggerService.log(METHOD_NAME$f, {
|
|
10569
10954
|
clientId: clientId,
|
|
10570
10955
|
swarmName: swarmName,
|
|
10571
10956
|
executionId: executionId,
|
|
10572
10957
|
});
|
|
10573
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
10958
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$f);
|
|
10574
10959
|
swarm$1.sessionValidationService.addSession(clientId, swarmName, "session");
|
|
10575
10960
|
return {
|
|
10576
10961
|
/**
|
|
@@ -10581,11 +10966,11 @@ var session = function (clientId, swarmName) {
|
|
|
10581
10966
|
*/
|
|
10582
10967
|
complete: functoolsKit.queued(function (content) { return __awaiter(void 0, void 0, void 0, function () {
|
|
10583
10968
|
return __generator(this, function (_a) {
|
|
10584
|
-
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$
|
|
10969
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$f);
|
|
10585
10970
|
return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
10586
10971
|
return __generator(this, function (_a) {
|
|
10587
10972
|
switch (_a.label) {
|
|
10588
|
-
case 0: return [4 /*yield*/, swarm$1.sessionPublicService.execute(content, "user", METHOD_NAME$
|
|
10973
|
+
case 0: return [4 /*yield*/, swarm$1.sessionPublicService.execute(content, "user", METHOD_NAME$f, clientId, swarmName)];
|
|
10589
10974
|
case 1: return [2 /*return*/, _a.sent()];
|
|
10590
10975
|
}
|
|
10591
10976
|
});
|
|
@@ -10603,7 +10988,7 @@ var session = function (clientId, swarmName) {
|
|
|
10603
10988
|
dispose: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
10604
10989
|
return __generator(this, function (_a) {
|
|
10605
10990
|
switch (_a.label) {
|
|
10606
|
-
case 0: return [4 /*yield*/, disposeConnection(clientId, swarmName, METHOD_NAME$
|
|
10991
|
+
case 0: return [4 /*yield*/, disposeConnection(clientId, swarmName, METHOD_NAME$f)];
|
|
10607
10992
|
case 1: return [2 /*return*/, _a.sent()];
|
|
10608
10993
|
}
|
|
10609
10994
|
});
|
|
@@ -10702,7 +11087,7 @@ session.scheduled = function (clientId, swarmName, _a) {
|
|
|
10702
11087
|
};
|
|
10703
11088
|
};
|
|
10704
11089
|
|
|
10705
|
-
var METHOD_NAME$
|
|
11090
|
+
var METHOD_NAME$e = "function.common.getAgentHistory";
|
|
10706
11091
|
/**
|
|
10707
11092
|
* Retrieves the history prepared for a specific agent with resque algorithm tweaks
|
|
10708
11093
|
*
|
|
@@ -10716,13 +11101,14 @@ var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0,
|
|
|
10716
11101
|
switch (_a.label) {
|
|
10717
11102
|
case 0:
|
|
10718
11103
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
10719
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
11104
|
+
swarm$1.loggerService.log(METHOD_NAME$e, {
|
|
10720
11105
|
clientId: clientId,
|
|
10721
11106
|
agentName: agentName,
|
|
10722
11107
|
});
|
|
10723
|
-
swarm$1.
|
|
11108
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$e);
|
|
11109
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$e);
|
|
10724
11110
|
prompt = swarm$1.agentSchemaService.get(agentName).prompt;
|
|
10725
|
-
return [4 /*yield*/, swarm$1.historyPublicService.toArrayForAgent(prompt, METHOD_NAME$
|
|
11111
|
+
return [4 /*yield*/, swarm$1.historyPublicService.toArrayForAgent(prompt, METHOD_NAME$e, clientId, agentName)];
|
|
10726
11112
|
case 1:
|
|
10727
11113
|
history = _a.sent();
|
|
10728
11114
|
return [2 /*return*/, __spreadArray([], __read(history), false)];
|
|
@@ -10730,7 +11116,7 @@ var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0,
|
|
|
10730
11116
|
});
|
|
10731
11117
|
}); };
|
|
10732
11118
|
|
|
10733
|
-
var METHOD_NAME$
|
|
11119
|
+
var METHOD_NAME$d = "function.common.getSessionMode";
|
|
10734
11120
|
/**
|
|
10735
11121
|
* Return the session mode (`"session" | "makeConnection" | "complete"`) for clientId
|
|
10736
11122
|
*
|
|
@@ -10740,16 +11126,45 @@ var getSessionMode = function (clientId) { return __awaiter(void 0, void 0, void
|
|
|
10740
11126
|
var swarmName;
|
|
10741
11127
|
return __generator(this, function (_a) {
|
|
10742
11128
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
10743
|
-
swarm$1.loggerService.log(METHOD_NAME$
|
|
11129
|
+
swarm$1.loggerService.log(METHOD_NAME$d, {
|
|
10744
11130
|
clientId: clientId,
|
|
10745
11131
|
});
|
|
11132
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$d);
|
|
10746
11133
|
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
10747
|
-
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$
|
|
11134
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$d);
|
|
10748
11135
|
return [2 /*return*/, swarm$1.sessionValidationService.getSessionMode(clientId)];
|
|
10749
11136
|
});
|
|
10750
11137
|
}); };
|
|
10751
11138
|
|
|
10752
|
-
var METHOD_NAME$
|
|
11139
|
+
var METHOD_NAME$c = "function.common.getSessionContext";
|
|
11140
|
+
/**
|
|
11141
|
+
* Retrieves the session context for a given client ID.
|
|
11142
|
+
*
|
|
11143
|
+
* @param {string} clientId - The ID of the client.
|
|
11144
|
+
* @returns {Promise<ISessionContext>} A promise that resolves to the session context.
|
|
11145
|
+
*/
|
|
11146
|
+
var getSessionContext = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
11147
|
+
var methodContext, executionContext, clientId;
|
|
11148
|
+
var _a;
|
|
11149
|
+
return __generator(this, function (_b) {
|
|
11150
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
11151
|
+
swarm$1.loggerService.log(METHOD_NAME$c);
|
|
11152
|
+
methodContext = MethodContextService.hasContext()
|
|
11153
|
+
? swarm$1.methodContextService.context
|
|
11154
|
+
: null;
|
|
11155
|
+
executionContext = ExecutionContextService.hasContext()
|
|
11156
|
+
? swarm$1.executionContextService.context
|
|
11157
|
+
: null;
|
|
11158
|
+
clientId = (_a = methodContext === null || methodContext === void 0 ? void 0 : methodContext.clientId) !== null && _a !== void 0 ? _a : executionContext === null || executionContext === void 0 ? void 0 : executionContext.clientId;
|
|
11159
|
+
return [2 /*return*/, {
|
|
11160
|
+
clientId: clientId,
|
|
11161
|
+
methodContext: methodContext,
|
|
11162
|
+
executionContext: executionContext,
|
|
11163
|
+
}];
|
|
11164
|
+
});
|
|
11165
|
+
}); };
|
|
11166
|
+
|
|
11167
|
+
var METHOD_NAME$b = "function.history.getRawHistory";
|
|
10753
11168
|
/**
|
|
10754
11169
|
* Retrieves the raw history as it is for a given client ID without any modifications.
|
|
10755
11170
|
*
|
|
@@ -10786,7 +11201,7 @@ var getRawHistory = function (clientId_1) {
|
|
|
10786
11201
|
});
|
|
10787
11202
|
};
|
|
10788
11203
|
|
|
10789
|
-
var METHOD_NAME$a = "function.getLastUserMessage";
|
|
11204
|
+
var METHOD_NAME$a = "function.history.getLastUserMessage";
|
|
10790
11205
|
/**
|
|
10791
11206
|
* Retrieves the last message sent by the user from the client's message history.
|
|
10792
11207
|
*
|
|
@@ -10814,7 +11229,7 @@ var getLastUserMessage = function (clientId) { return __awaiter(void 0, void 0,
|
|
|
10814
11229
|
});
|
|
10815
11230
|
}); };
|
|
10816
11231
|
|
|
10817
|
-
var METHOD_NAME$9 = "function.getUserHistory";
|
|
11232
|
+
var METHOD_NAME$9 = "function.history.getUserHistory";
|
|
10818
11233
|
/**
|
|
10819
11234
|
* Retrieves the user history for a given client ID.
|
|
10820
11235
|
*
|
|
@@ -10841,7 +11256,7 @@ var getUserHistory = function (clientId) { return __awaiter(void 0, void 0, void
|
|
|
10841
11256
|
});
|
|
10842
11257
|
}); };
|
|
10843
11258
|
|
|
10844
|
-
var METHOD_NAME$8 = "function.getAssistantHistory";
|
|
11259
|
+
var METHOD_NAME$8 = "function.history.getAssistantHistory";
|
|
10845
11260
|
/**
|
|
10846
11261
|
* Retrieves the assistant's history for a given client.
|
|
10847
11262
|
*
|
|
@@ -10868,7 +11283,7 @@ var getAssistantHistory = function (clientId) { return __awaiter(void 0, void 0,
|
|
|
10868
11283
|
});
|
|
10869
11284
|
}); };
|
|
10870
11285
|
|
|
10871
|
-
var METHOD_NAME$7 = "function.getLastAssistantMessage";
|
|
11286
|
+
var METHOD_NAME$7 = "function.history.getLastAssistantMessage";
|
|
10872
11287
|
/**
|
|
10873
11288
|
* Retrieves the last message sent by the assistant from the client's message history.
|
|
10874
11289
|
*
|
|
@@ -10896,7 +11311,7 @@ var getLastAssistantMessage = function (clientId) { return __awaiter(void 0, voi
|
|
|
10896
11311
|
});
|
|
10897
11312
|
}); };
|
|
10898
11313
|
|
|
10899
|
-
var METHOD_NAME$6 = "function.getLastSystemMessage";
|
|
11314
|
+
var METHOD_NAME$6 = "function.history.getLastSystemMessage";
|
|
10900
11315
|
/**
|
|
10901
11316
|
* Retrieves the last message sent by the system from the client's message history.
|
|
10902
11317
|
*
|
|
@@ -10924,7 +11339,7 @@ var getLastSystemMessage = function (clientId) { return __awaiter(void 0, void 0
|
|
|
10924
11339
|
});
|
|
10925
11340
|
}); };
|
|
10926
11341
|
|
|
10927
|
-
var METHOD_NAME$5 = "function.listenEvent";
|
|
11342
|
+
var METHOD_NAME$5 = "function.event.listenEvent";
|
|
10928
11343
|
var DISALLOWED_EVENT_SOURCE_LIST$2 = new Set([
|
|
10929
11344
|
"agent-bus",
|
|
10930
11345
|
"history-bus",
|
|
@@ -10956,7 +11371,7 @@ var event = function (clientId, topicName, payload) {
|
|
|
10956
11371
|
});
|
|
10957
11372
|
};
|
|
10958
11373
|
|
|
10959
|
-
var METHOD_NAME$4 = "function.listenEvent";
|
|
11374
|
+
var METHOD_NAME$4 = "function.event.listenEvent";
|
|
10960
11375
|
var DISALLOWED_EVENT_SOURCE_LIST$1 = new Set([
|
|
10961
11376
|
"agent-bus",
|
|
10962
11377
|
"history-bus",
|
|
@@ -10989,13 +11404,18 @@ var listenEvent = function (clientId, topicName, fn) {
|
|
|
10989
11404
|
throw new Error("agent-swarm listenEvent topic is reserved topicName=".concat(topicName));
|
|
10990
11405
|
}
|
|
10991
11406
|
validateClientId$d(clientId);
|
|
10992
|
-
return swarm$1.busService.subscribe(clientId, topicName, function (_a) {
|
|
10993
|
-
var payload =
|
|
10994
|
-
return
|
|
10995
|
-
|
|
11407
|
+
return swarm$1.busService.subscribe(clientId, topicName, functoolsKit.queued(function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
11408
|
+
var payload = _b.payload;
|
|
11409
|
+
return __generator(this, function (_c) {
|
|
11410
|
+
switch (_c.label) {
|
|
11411
|
+
case 0: return [4 /*yield*/, fn(payload)];
|
|
11412
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
11413
|
+
}
|
|
11414
|
+
});
|
|
11415
|
+
}); }));
|
|
10996
11416
|
};
|
|
10997
11417
|
|
|
10998
|
-
var METHOD_NAME$3 = "function.listenEventOnce";
|
|
11418
|
+
var METHOD_NAME$3 = "function.event.listenEventOnce";
|
|
10999
11419
|
var DISALLOWED_EVENT_SOURCE_LIST = new Set([
|
|
11000
11420
|
"agent-bus",
|
|
11001
11421
|
"history-bus",
|
|
@@ -11031,13 +11451,18 @@ var listenEventOnce = function (clientId, topicName, filterFn, fn) {
|
|
|
11031
11451
|
return swarm$1.busService.once(clientId, topicName, function (_a) {
|
|
11032
11452
|
var payload = _a.payload;
|
|
11033
11453
|
return filterFn(payload);
|
|
11034
|
-
}, function (_a) {
|
|
11035
|
-
var payload =
|
|
11036
|
-
return
|
|
11037
|
-
|
|
11454
|
+
}, functoolsKit.queued(function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
11455
|
+
var payload = _b.payload;
|
|
11456
|
+
return __generator(this, function (_c) {
|
|
11457
|
+
switch (_c.label) {
|
|
11458
|
+
case 0: return [4 /*yield*/, fn(payload)];
|
|
11459
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
11460
|
+
}
|
|
11461
|
+
});
|
|
11462
|
+
}); }));
|
|
11038
11463
|
};
|
|
11039
11464
|
|
|
11040
|
-
var METHOD_NAME$2 = "function.changeToAgent";
|
|
11465
|
+
var METHOD_NAME$2 = "function.navigate.changeToAgent";
|
|
11041
11466
|
/**
|
|
11042
11467
|
* Time-to-live for the change agent function in milliseconds.
|
|
11043
11468
|
* @constant {number}
|
|
@@ -11153,7 +11578,7 @@ var changeToAgent = function (agentName, clientId) { return __awaiter(void 0, vo
|
|
|
11153
11578
|
});
|
|
11154
11579
|
}); };
|
|
11155
11580
|
|
|
11156
|
-
var METHOD_NAME$1 = "function.changeToPrevAgent";
|
|
11581
|
+
var METHOD_NAME$1 = "function.navigate.changeToPrevAgent";
|
|
11157
11582
|
/**
|
|
11158
11583
|
* Time-to-live for the change agent function in milliseconds.
|
|
11159
11584
|
* @constant {number}
|
|
@@ -11266,7 +11691,7 @@ var changeToPrevAgent = function (clientId) { return __awaiter(void 0, void 0, v
|
|
|
11266
11691
|
});
|
|
11267
11692
|
}); };
|
|
11268
11693
|
|
|
11269
|
-
var METHOD_NAME = "function.changeToDefaultAgent";
|
|
11694
|
+
var METHOD_NAME = "function.navigate.changeToDefaultAgent";
|
|
11270
11695
|
/**
|
|
11271
11696
|
* Time-to-live for the change agent function in milliseconds.
|
|
11272
11697
|
* @constant {number}
|
|
@@ -11396,7 +11821,12 @@ var listenAgentEvent = function (clientId, fn) {
|
|
|
11396
11821
|
clientId: clientId,
|
|
11397
11822
|
});
|
|
11398
11823
|
validateClientId$b(clientId);
|
|
11399
|
-
return swarm$1.busService.subscribe(clientId, "agent-bus",
|
|
11824
|
+
return swarm$1.busService.subscribe(clientId, "agent-bus", functoolsKit.queued(function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
11825
|
+
switch (_a.label) {
|
|
11826
|
+
case 0: return [4 /*yield*/, fn(e)];
|
|
11827
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
11828
|
+
}
|
|
11829
|
+
}); }); }));
|
|
11400
11830
|
};
|
|
11401
11831
|
|
|
11402
11832
|
var validateClientId$a = function (clientId) {
|
|
@@ -11418,7 +11848,12 @@ var listenHistoryEvent = function (clientId, fn) {
|
|
|
11418
11848
|
clientId: clientId,
|
|
11419
11849
|
});
|
|
11420
11850
|
validateClientId$a(clientId);
|
|
11421
|
-
return swarm$1.busService.subscribe(clientId, "history-bus",
|
|
11851
|
+
return swarm$1.busService.subscribe(clientId, "history-bus", functoolsKit.queued(function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
11852
|
+
switch (_a.label) {
|
|
11853
|
+
case 0: return [4 /*yield*/, fn(e)];
|
|
11854
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
11855
|
+
}
|
|
11856
|
+
}); }); }));
|
|
11422
11857
|
};
|
|
11423
11858
|
|
|
11424
11859
|
var validateClientId$9 = function (clientId) {
|
|
@@ -11440,7 +11875,12 @@ var listenSessionEvent = function (clientId, fn) {
|
|
|
11440
11875
|
clientId: clientId,
|
|
11441
11876
|
});
|
|
11442
11877
|
validateClientId$9(clientId);
|
|
11443
|
-
return swarm$1.busService.subscribe(clientId, "session-bus",
|
|
11878
|
+
return swarm$1.busService.subscribe(clientId, "session-bus", functoolsKit.queued(function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
11879
|
+
switch (_a.label) {
|
|
11880
|
+
case 0: return [4 /*yield*/, fn(e)];
|
|
11881
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
11882
|
+
}
|
|
11883
|
+
}); }); }));
|
|
11444
11884
|
};
|
|
11445
11885
|
|
|
11446
11886
|
var validateClientId$8 = function (clientId) {
|
|
@@ -11462,7 +11902,12 @@ var listenStateEvent = function (clientId, fn) {
|
|
|
11462
11902
|
clientId: clientId,
|
|
11463
11903
|
});
|
|
11464
11904
|
validateClientId$8(clientId);
|
|
11465
|
-
return swarm$1.busService.subscribe(clientId, "state-bus",
|
|
11905
|
+
return swarm$1.busService.subscribe(clientId, "state-bus", functoolsKit.queued(function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
11906
|
+
switch (_a.label) {
|
|
11907
|
+
case 0: return [4 /*yield*/, fn(e)];
|
|
11908
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
11909
|
+
}
|
|
11910
|
+
}); }); }));
|
|
11466
11911
|
};
|
|
11467
11912
|
|
|
11468
11913
|
var validateClientId$7 = function (clientId) {
|
|
@@ -11484,7 +11929,12 @@ var listenStorageEvent = function (clientId, fn) {
|
|
|
11484
11929
|
clientId: clientId,
|
|
11485
11930
|
});
|
|
11486
11931
|
validateClientId$7(clientId);
|
|
11487
|
-
return swarm$1.busService.subscribe(clientId, "storage-bus",
|
|
11932
|
+
return swarm$1.busService.subscribe(clientId, "storage-bus", functoolsKit.queued(function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
11933
|
+
switch (_a.label) {
|
|
11934
|
+
case 0: return [4 /*yield*/, fn(e)];
|
|
11935
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
11936
|
+
}
|
|
11937
|
+
}); }); }));
|
|
11488
11938
|
};
|
|
11489
11939
|
|
|
11490
11940
|
var validateClientId$6 = function (clientId) {
|
|
@@ -11506,7 +11956,12 @@ var listenSwarmEvent = function (clientId, fn) {
|
|
|
11506
11956
|
clientId: clientId,
|
|
11507
11957
|
});
|
|
11508
11958
|
validateClientId$6(clientId);
|
|
11509
|
-
return swarm$1.busService.subscribe(clientId, "swarm-bus",
|
|
11959
|
+
return swarm$1.busService.subscribe(clientId, "swarm-bus", functoolsKit.queued(function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
11960
|
+
switch (_a.label) {
|
|
11961
|
+
case 0: return [4 /*yield*/, fn(e)];
|
|
11962
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
11963
|
+
}
|
|
11964
|
+
}); }); }));
|
|
11510
11965
|
};
|
|
11511
11966
|
|
|
11512
11967
|
var validateClientId$5 = function (clientId) {
|
|
@@ -11528,7 +11983,12 @@ var listenAgentEventOnce = function (clientId, filterFn, fn) {
|
|
|
11528
11983
|
clientId: clientId,
|
|
11529
11984
|
});
|
|
11530
11985
|
validateClientId$5(clientId);
|
|
11531
|
-
return swarm$1.busService.once(clientId, "agent-bus", filterFn,
|
|
11986
|
+
return swarm$1.busService.once(clientId, "agent-bus", filterFn, functoolsKit.queued(function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
11987
|
+
switch (_a.label) {
|
|
11988
|
+
case 0: return [4 /*yield*/, fn(e)];
|
|
11989
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
11990
|
+
}
|
|
11991
|
+
}); }); }));
|
|
11532
11992
|
};
|
|
11533
11993
|
|
|
11534
11994
|
var validateClientId$4 = function (clientId) {
|
|
@@ -11550,7 +12010,12 @@ var listenHistoryEventOnce = function (clientId, filterFn, fn) {
|
|
|
11550
12010
|
clientId: clientId,
|
|
11551
12011
|
});
|
|
11552
12012
|
validateClientId$4(clientId);
|
|
11553
|
-
return swarm$1.busService.once(clientId, "history-bus", filterFn,
|
|
12013
|
+
return swarm$1.busService.once(clientId, "history-bus", filterFn, functoolsKit.queued(function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
12014
|
+
switch (_a.label) {
|
|
12015
|
+
case 0: return [4 /*yield*/, fn(e)];
|
|
12016
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
12017
|
+
}
|
|
12018
|
+
}); }); }));
|
|
11554
12019
|
};
|
|
11555
12020
|
|
|
11556
12021
|
var validateClientId$3 = function (clientId) {
|
|
@@ -11572,7 +12037,12 @@ var listenSessionEventOnce = function (clientId, filterFn, fn) {
|
|
|
11572
12037
|
clientId: clientId,
|
|
11573
12038
|
});
|
|
11574
12039
|
validateClientId$3(clientId);
|
|
11575
|
-
return swarm$1.busService.once(clientId, "session-bus", filterFn,
|
|
12040
|
+
return swarm$1.busService.once(clientId, "session-bus", filterFn, functoolsKit.queued(function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
12041
|
+
switch (_a.label) {
|
|
12042
|
+
case 0: return [4 /*yield*/, fn(e)];
|
|
12043
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
12044
|
+
}
|
|
12045
|
+
}); }); }));
|
|
11576
12046
|
};
|
|
11577
12047
|
|
|
11578
12048
|
var validateClientId$2 = function (clientId) {
|
|
@@ -11594,7 +12064,12 @@ var listenStateEventOnce = function (clientId, filterFn, fn) {
|
|
|
11594
12064
|
clientId: clientId,
|
|
11595
12065
|
});
|
|
11596
12066
|
validateClientId$2(clientId);
|
|
11597
|
-
return swarm$1.busService.once(clientId, "state-bus", filterFn,
|
|
12067
|
+
return swarm$1.busService.once(clientId, "state-bus", filterFn, functoolsKit.queued(function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
12068
|
+
switch (_a.label) {
|
|
12069
|
+
case 0: return [4 /*yield*/, fn(e)];
|
|
12070
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
12071
|
+
}
|
|
12072
|
+
}); }); }));
|
|
11598
12073
|
};
|
|
11599
12074
|
|
|
11600
12075
|
var validateClientId$1 = function (clientId) {
|
|
@@ -11616,7 +12091,12 @@ var listenStorageEventOnce = function (clientId, filterFn, fn) {
|
|
|
11616
12091
|
clientId: clientId,
|
|
11617
12092
|
});
|
|
11618
12093
|
validateClientId$1(clientId);
|
|
11619
|
-
return swarm$1.busService.once(clientId, "storage-bus", filterFn,
|
|
12094
|
+
return swarm$1.busService.once(clientId, "storage-bus", filterFn, functoolsKit.queued(function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
12095
|
+
switch (_a.label) {
|
|
12096
|
+
case 0: return [4 /*yield*/, fn(e)];
|
|
12097
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
12098
|
+
}
|
|
12099
|
+
}); }); }));
|
|
11620
12100
|
};
|
|
11621
12101
|
|
|
11622
12102
|
var validateClientId = function (clientId) {
|
|
@@ -11638,7 +12118,12 @@ var listenSwarmEventOnce = function (clientId, filterFn, fn) {
|
|
|
11638
12118
|
clientId: clientId,
|
|
11639
12119
|
});
|
|
11640
12120
|
validateClientId(clientId);
|
|
11641
|
-
return swarm$1.busService.once(clientId, "swarm-bus", filterFn,
|
|
12121
|
+
return swarm$1.busService.once(clientId, "swarm-bus", filterFn, functoolsKit.queued(function (e) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
12122
|
+
switch (_a.label) {
|
|
12123
|
+
case 0: return [4 /*yield*/, fn(e)];
|
|
12124
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
12125
|
+
}
|
|
12126
|
+
}); }); }));
|
|
11642
12127
|
};
|
|
11643
12128
|
|
|
11644
12129
|
var METHOD_NAME_GET$3 = "StateUtils.getState";
|
|
@@ -11765,23 +12250,19 @@ var SharedStateUtils = /** @class */ (function () {
|
|
|
11765
12250
|
* Retrieves the state for a given client and state name.
|
|
11766
12251
|
* @template T
|
|
11767
12252
|
* @param {Object} payload - The payload containing client and state information.
|
|
11768
|
-
* @param {AgentName} payload.agentName - The agent name.
|
|
11769
12253
|
* @param {StateName} payload.stateName - The state name.
|
|
11770
12254
|
* @returns {Promise<T>} The state data.
|
|
11771
12255
|
* @throws Will throw an error if the state is not registered in the agent.
|
|
11772
12256
|
*/
|
|
11773
|
-
this.getState = function (
|
|
12257
|
+
this.getState = function (stateName) { return __awaiter(_this, void 0, void 0, function () {
|
|
11774
12258
|
return __generator(this, function (_a) {
|
|
11775
12259
|
switch (_a.label) {
|
|
11776
12260
|
case 0:
|
|
11777
12261
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
11778
12262
|
swarm$1.loggerService.log(METHOD_NAME_GET$2, {
|
|
11779
|
-
stateName:
|
|
12263
|
+
stateName: stateName,
|
|
11780
12264
|
});
|
|
11781
|
-
|
|
11782
|
-
throw new Error("agent-swarm SharedStateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (getSharedState)"));
|
|
11783
|
-
}
|
|
11784
|
-
return [4 /*yield*/, swarm$1.sharedStatePublicService.getState(METHOD_NAME_GET$2, payload.stateName)];
|
|
12265
|
+
return [4 /*yield*/, swarm$1.sharedStatePublicService.getState(METHOD_NAME_GET$2, stateName)];
|
|
11785
12266
|
case 1: return [2 /*return*/, _a.sent()];
|
|
11786
12267
|
}
|
|
11787
12268
|
});
|
|
@@ -11790,30 +12271,25 @@ var SharedStateUtils = /** @class */ (function () {
|
|
|
11790
12271
|
* Sets the state for a given client and state name.
|
|
11791
12272
|
* @template T
|
|
11792
12273
|
* @param {T | ((prevSharedState: T) => Promise<T>)} dispatchFn - The new state or a function that returns the new state.
|
|
11793
|
-
* @param {
|
|
11794
|
-
* @param {AgentName} payload.agentName - The agent name.
|
|
11795
|
-
* @param {StateName} payload.stateName - The state name.
|
|
12274
|
+
* @param {StateName} stateName - The state name.
|
|
11796
12275
|
* @returns {Promise<void>}
|
|
11797
12276
|
* @throws Will throw an error if the state is not registered in the agent.
|
|
11798
12277
|
*/
|
|
11799
|
-
this.setState = function (dispatchFn,
|
|
12278
|
+
this.setState = function (dispatchFn, stateName) { return __awaiter(_this, void 0, void 0, function () {
|
|
11800
12279
|
var _this = this;
|
|
11801
12280
|
return __generator(this, function (_a) {
|
|
11802
12281
|
switch (_a.label) {
|
|
11803
12282
|
case 0:
|
|
11804
12283
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
11805
12284
|
swarm$1.loggerService.log(METHOD_NAME_SET, {
|
|
11806
|
-
stateName:
|
|
12285
|
+
stateName: stateName,
|
|
11807
12286
|
});
|
|
11808
|
-
if (!swarm$1.agentValidationService.hasState(payload.agentName, payload.stateName)) {
|
|
11809
|
-
throw new Error("agent-swarm SharedStateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (setState)"));
|
|
11810
|
-
}
|
|
11811
12287
|
if (!(typeof dispatchFn === "function")) return [3 /*break*/, 2];
|
|
11812
|
-
return [4 /*yield*/, swarm$1.sharedStatePublicService.setState(dispatchFn, METHOD_NAME_SET,
|
|
12288
|
+
return [4 /*yield*/, swarm$1.sharedStatePublicService.setState(dispatchFn, METHOD_NAME_SET, stateName)];
|
|
11813
12289
|
case 1: return [2 /*return*/, _a.sent()];
|
|
11814
12290
|
case 2: return [4 /*yield*/, swarm$1.sharedStatePublicService.setState(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
11815
12291
|
return [2 /*return*/, dispatchFn];
|
|
11816
|
-
}); }); }, METHOD_NAME_SET,
|
|
12292
|
+
}); }); }, METHOD_NAME_SET, stateName)];
|
|
11817
12293
|
case 3: return [2 /*return*/, _a.sent()];
|
|
11818
12294
|
}
|
|
11819
12295
|
});
|
|
@@ -11821,24 +12297,19 @@ var SharedStateUtils = /** @class */ (function () {
|
|
|
11821
12297
|
/**
|
|
11822
12298
|
* Set the state to initial value
|
|
11823
12299
|
* @template T
|
|
11824
|
-
* @param {Object} payload - The payload containing client and state information.
|
|
11825
|
-
* @param {AgentName} payload.agentName - The agent name.
|
|
11826
12300
|
* @param {StateName} payload.stateName - The state name.
|
|
11827
12301
|
* @returns {Promise<void>}
|
|
11828
12302
|
* @throws Will throw an error if the state is not registered in the agent.
|
|
11829
12303
|
*/
|
|
11830
|
-
this.clearState = function (
|
|
12304
|
+
this.clearState = function (stateName) { return __awaiter(_this, void 0, void 0, function () {
|
|
11831
12305
|
return __generator(this, function (_a) {
|
|
11832
12306
|
switch (_a.label) {
|
|
11833
12307
|
case 0:
|
|
11834
12308
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
11835
12309
|
swarm$1.loggerService.log(METHOD_NAME_SET, {
|
|
11836
|
-
stateName:
|
|
12310
|
+
stateName: stateName,
|
|
11837
12311
|
});
|
|
11838
|
-
|
|
11839
|
-
throw new Error("agent-swarm SharedStateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (clearState)"));
|
|
11840
|
-
}
|
|
11841
|
-
return [4 /*yield*/, swarm$1.sharedStatePublicService.clearState(METHOD_NAME_CLEAR$2, payload.stateName)];
|
|
12312
|
+
return [4 /*yield*/, swarm$1.sharedStatePublicService.clearState(METHOD_NAME_CLEAR$2, stateName)];
|
|
11842
12313
|
case 1: return [2 /*return*/, _a.sent()];
|
|
11843
12314
|
}
|
|
11844
12315
|
});
|
|
@@ -12048,7 +12519,6 @@ var SharedStorageUtils = /** @class */ (function () {
|
|
|
12048
12519
|
* Takes items from the storage.
|
|
12049
12520
|
* @param {string} search - The search query.
|
|
12050
12521
|
* @param {number} total - The total number of items to take.
|
|
12051
|
-
* @param {AgentName} agentName - The agent name.
|
|
12052
12522
|
* @param {StorageName} storageName - The storage name.
|
|
12053
12523
|
* @returns {Promise<T[]>} - A promise that resolves to an array of items.
|
|
12054
12524
|
* @template T
|
|
@@ -12065,9 +12535,6 @@ var SharedStorageUtils = /** @class */ (function () {
|
|
|
12065
12535
|
score: payload.score,
|
|
12066
12536
|
});
|
|
12067
12537
|
swarm$1.storageValidationService.validate(payload.storageName, METHOD_NAME_TAKE);
|
|
12068
|
-
if (!swarm$1.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
12069
|
-
throw new Error("agent-swarm SharedStorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (take)"));
|
|
12070
|
-
}
|
|
12071
12538
|
return [4 /*yield*/, swarm$1.sharedStoragePublicService.take(payload.search, payload.total, METHOD_NAME_TAKE, payload.storageName, payload.score)];
|
|
12072
12539
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
12073
12540
|
}
|
|
@@ -12076,25 +12543,21 @@ var SharedStorageUtils = /** @class */ (function () {
|
|
|
12076
12543
|
/**
|
|
12077
12544
|
* Upserts an item in the storage.
|
|
12078
12545
|
* @param {T} item - The item to upsert.
|
|
12079
|
-
* @param {AgentName} agentName - The agent name.
|
|
12080
12546
|
* @param {StorageName} storageName - The storage name.
|
|
12081
12547
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
12082
12548
|
* @template T
|
|
12083
12549
|
*/
|
|
12084
|
-
this.upsert = function (
|
|
12550
|
+
this.upsert = function (item, storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
12085
12551
|
return __generator(this, function (_a) {
|
|
12086
12552
|
switch (_a.label) {
|
|
12087
12553
|
case 0:
|
|
12088
12554
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
12089
12555
|
swarm$1.loggerService.log(METHOD_NAME_UPSERT, {
|
|
12090
|
-
item:
|
|
12091
|
-
storageName:
|
|
12556
|
+
item: item,
|
|
12557
|
+
storageName: storageName,
|
|
12092
12558
|
});
|
|
12093
|
-
swarm$1.storageValidationService.validate(
|
|
12094
|
-
|
|
12095
|
-
throw new Error("agent-swarm SharedStorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (upsert)"));
|
|
12096
|
-
}
|
|
12097
|
-
return [4 /*yield*/, swarm$1.sharedStoragePublicService.upsert(payload.item, METHOD_NAME_UPSERT, payload.storageName)];
|
|
12559
|
+
swarm$1.storageValidationService.validate(storageName, METHOD_NAME_UPSERT);
|
|
12560
|
+
return [4 /*yield*/, swarm$1.sharedStoragePublicService.upsert(item, METHOD_NAME_UPSERT, storageName)];
|
|
12098
12561
|
case 1: return [2 /*return*/, _a.sent()];
|
|
12099
12562
|
}
|
|
12100
12563
|
});
|
|
@@ -12102,24 +12565,20 @@ var SharedStorageUtils = /** @class */ (function () {
|
|
|
12102
12565
|
/**
|
|
12103
12566
|
* Removes an item from the storage.
|
|
12104
12567
|
* @param {IStorageData["id"]} itemId - The ID of the item to remove.
|
|
12105
|
-
* @param {AgentName} agentName - The agent name.
|
|
12106
12568
|
* @param {StorageName} storageName - The storage name.
|
|
12107
12569
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
12108
12570
|
*/
|
|
12109
|
-
this.remove = function (
|
|
12571
|
+
this.remove = function (itemId, storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
12110
12572
|
return __generator(this, function (_a) {
|
|
12111
12573
|
switch (_a.label) {
|
|
12112
12574
|
case 0:
|
|
12113
12575
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
12114
12576
|
swarm$1.loggerService.log(METHOD_NAME_REMOVE, {
|
|
12115
|
-
itemId:
|
|
12116
|
-
storageName:
|
|
12577
|
+
itemId: itemId,
|
|
12578
|
+
storageName: storageName,
|
|
12117
12579
|
});
|
|
12118
|
-
swarm$1.storageValidationService.validate(
|
|
12119
|
-
|
|
12120
|
-
throw new Error("agent-swarm SharedStorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (remove)"));
|
|
12121
|
-
}
|
|
12122
|
-
return [4 /*yield*/, swarm$1.sharedStoragePublicService.remove(payload.itemId, METHOD_NAME_REMOVE, payload.storageName)];
|
|
12580
|
+
swarm$1.storageValidationService.validate(storageName, METHOD_NAME_REMOVE);
|
|
12581
|
+
return [4 /*yield*/, swarm$1.sharedStoragePublicService.remove(itemId, METHOD_NAME_REMOVE, storageName)];
|
|
12123
12582
|
case 1: return [2 /*return*/, _a.sent()];
|
|
12124
12583
|
}
|
|
12125
12584
|
});
|
|
@@ -12127,73 +12586,61 @@ var SharedStorageUtils = /** @class */ (function () {
|
|
|
12127
12586
|
/**
|
|
12128
12587
|
* Gets an item from the storage.
|
|
12129
12588
|
* @param {IStorageData["id"]} itemId - The ID of the item to get.
|
|
12130
|
-
* @param {AgentName} agentName - The agent name.
|
|
12131
12589
|
* @param {StorageName} storageName - The storage name.
|
|
12132
12590
|
* @returns {Promise<T | null>} - A promise that resolves to the item or null if not found.
|
|
12133
12591
|
* @template T
|
|
12134
12592
|
*/
|
|
12135
|
-
this.get = function (
|
|
12593
|
+
this.get = function (itemId, storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
12136
12594
|
return __generator(this, function (_a) {
|
|
12137
12595
|
switch (_a.label) {
|
|
12138
12596
|
case 0:
|
|
12139
12597
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
12140
12598
|
swarm$1.loggerService.log(METHOD_NAME_GET, {
|
|
12141
|
-
itemId:
|
|
12142
|
-
storageName:
|
|
12599
|
+
itemId: itemId,
|
|
12600
|
+
storageName: storageName,
|
|
12143
12601
|
});
|
|
12144
|
-
swarm$1.storageValidationService.validate(
|
|
12145
|
-
|
|
12146
|
-
throw new Error("agent-swarm SharedStorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (get)"));
|
|
12147
|
-
}
|
|
12148
|
-
return [4 /*yield*/, swarm$1.sharedStoragePublicService.get(payload.itemId, METHOD_NAME_GET, payload.storageName)];
|
|
12602
|
+
swarm$1.storageValidationService.validate(storageName, METHOD_NAME_GET);
|
|
12603
|
+
return [4 /*yield*/, swarm$1.sharedStoragePublicService.get(itemId, METHOD_NAME_GET, storageName)];
|
|
12149
12604
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
12150
12605
|
}
|
|
12151
12606
|
});
|
|
12152
12607
|
}); };
|
|
12153
12608
|
/**
|
|
12154
12609
|
* Lists items from the storage.
|
|
12155
|
-
* @param {AgentName} agentName - The agent name.
|
|
12156
12610
|
* @param {StorageName} storageName - The storage name.
|
|
12157
12611
|
* @param {(item: T) => boolean} [filter] - Optional filter function.
|
|
12158
12612
|
* @returns {Promise<T[]>} - A promise that resolves to an array of items.
|
|
12159
12613
|
* @template T
|
|
12160
12614
|
*/
|
|
12161
|
-
this.list = function (
|
|
12615
|
+
this.list = function (storageName, filter) { return __awaiter(_this, void 0, void 0, function () {
|
|
12162
12616
|
return __generator(this, function (_a) {
|
|
12163
12617
|
switch (_a.label) {
|
|
12164
12618
|
case 0:
|
|
12165
12619
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
12166
12620
|
swarm$1.loggerService.log(METHOD_NAME_LIST, {
|
|
12167
|
-
storageName:
|
|
12621
|
+
storageName: storageName,
|
|
12168
12622
|
});
|
|
12169
|
-
swarm$1.storageValidationService.validate(
|
|
12170
|
-
|
|
12171
|
-
throw new Error("agent-swarm SharedStorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (list)"));
|
|
12172
|
-
}
|
|
12173
|
-
return [4 /*yield*/, swarm$1.sharedStoragePublicService.list(METHOD_NAME_LIST, payload.storageName, payload.filter)];
|
|
12623
|
+
swarm$1.storageValidationService.validate(storageName, METHOD_NAME_LIST);
|
|
12624
|
+
return [4 /*yield*/, swarm$1.sharedStoragePublicService.list(METHOD_NAME_LIST, storageName, filter)];
|
|
12174
12625
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
12175
12626
|
}
|
|
12176
12627
|
});
|
|
12177
12628
|
}); };
|
|
12178
12629
|
/**
|
|
12179
12630
|
* Clears the storage.
|
|
12180
|
-
* @param {AgentName} agentName - The agent name.
|
|
12181
12631
|
* @param {StorageName} storageName - The storage name.
|
|
12182
12632
|
* @returns {Promise<void>} - A promise that resolves when the operation is complete.
|
|
12183
12633
|
*/
|
|
12184
|
-
this.clear = function (
|
|
12634
|
+
this.clear = function (storageName) { return __awaiter(_this, void 0, void 0, function () {
|
|
12185
12635
|
return __generator(this, function (_a) {
|
|
12186
12636
|
switch (_a.label) {
|
|
12187
12637
|
case 0:
|
|
12188
12638
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
12189
12639
|
swarm$1.loggerService.log(METHOD_NAME_CLEAR, {
|
|
12190
|
-
storageName:
|
|
12640
|
+
storageName: storageName,
|
|
12191
12641
|
});
|
|
12192
|
-
swarm$1.storageValidationService.validate(
|
|
12193
|
-
|
|
12194
|
-
throw new Error("agent-swarm SharedStorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (clear)"));
|
|
12195
|
-
}
|
|
12196
|
-
return [4 /*yield*/, swarm$1.sharedStoragePublicService.clear(METHOD_NAME_CLEAR, payload.storageName)];
|
|
12642
|
+
swarm$1.storageValidationService.validate(storageName, METHOD_NAME_CLEAR);
|
|
12643
|
+
return [4 /*yield*/, swarm$1.sharedStoragePublicService.clear(METHOD_NAME_CLEAR, storageName)];
|
|
12197
12644
|
case 1: return [2 /*return*/, _a.sent()];
|
|
12198
12645
|
}
|
|
12199
12646
|
});
|
|
@@ -12238,11 +12685,44 @@ var objectFlat = function (data) {
|
|
|
12238
12685
|
|
|
12239
12686
|
var LIST_SEPARATOR = Array.from({ length: 80 }, function () { return "-"; });
|
|
12240
12687
|
var METHOD_NAME_SERIALIZE = "SchemaUtils.serialize";
|
|
12688
|
+
var METHOD_NAME_WRITE = "SchemaUtils.write";
|
|
12241
12689
|
/**
|
|
12242
12690
|
* Utility class for schema-related operations.
|
|
12243
12691
|
*/
|
|
12244
12692
|
var SchemaUtils = /** @class */ (function () {
|
|
12245
12693
|
function SchemaUtils() {
|
|
12694
|
+
/**
|
|
12695
|
+
* Writes a value to the session memory for a given client.
|
|
12696
|
+
*
|
|
12697
|
+
* @template T - The type of the value to write.
|
|
12698
|
+
* @param {string} clientId - The ID of the client.
|
|
12699
|
+
* @param {T} value - The value to write to the session memory.
|
|
12700
|
+
* @returns {T} The actual value from the session memory.
|
|
12701
|
+
*/
|
|
12702
|
+
this.writeSessionMemory = function (clientId, value) {
|
|
12703
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
12704
|
+
swarm$1.loggerService.log(METHOD_NAME_WRITE, {
|
|
12705
|
+
clientId: clientId,
|
|
12706
|
+
value: value,
|
|
12707
|
+
});
|
|
12708
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME_WRITE);
|
|
12709
|
+
return swarm$1.memorySchemaService.writeValue(clientId, value);
|
|
12710
|
+
};
|
|
12711
|
+
/**
|
|
12712
|
+
* Reads a value from the session memory for a given client.
|
|
12713
|
+
*
|
|
12714
|
+
* @template T - The type of the value to read.
|
|
12715
|
+
* @param {string} clientId - The ID of the client.
|
|
12716
|
+
* @returns {T} The value read from the session memory.
|
|
12717
|
+
*/
|
|
12718
|
+
this.readSessionMemory = function (clientId) {
|
|
12719
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
12720
|
+
swarm$1.loggerService.log(METHOD_NAME_WRITE, {
|
|
12721
|
+
clientId: clientId,
|
|
12722
|
+
});
|
|
12723
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME_WRITE);
|
|
12724
|
+
return swarm$1.memorySchemaService.readValue(clientId);
|
|
12725
|
+
};
|
|
12246
12726
|
/**
|
|
12247
12727
|
* Serializes an object or an array of objects into a formatted string.
|
|
12248
12728
|
*
|
|
@@ -12344,6 +12824,7 @@ exports.getLastAssistantMessage = getLastAssistantMessage;
|
|
|
12344
12824
|
exports.getLastSystemMessage = getLastSystemMessage;
|
|
12345
12825
|
exports.getLastUserMessage = getLastUserMessage;
|
|
12346
12826
|
exports.getRawHistory = getRawHistory;
|
|
12827
|
+
exports.getSessionContext = getSessionContext;
|
|
12347
12828
|
exports.getSessionMode = getSessionMode;
|
|
12348
12829
|
exports.getUserHistory = getUserHistory;
|
|
12349
12830
|
exports.listenAgentEvent = listenAgentEvent;
|
|
@@ -12362,6 +12843,8 @@ exports.listenSwarmEvent = listenSwarmEvent;
|
|
|
12362
12843
|
exports.listenSwarmEventOnce = listenSwarmEventOnce;
|
|
12363
12844
|
exports.makeAutoDispose = makeAutoDispose;
|
|
12364
12845
|
exports.makeConnection = makeConnection;
|
|
12846
|
+
exports.run = run;
|
|
12847
|
+
exports.runForce = runForce;
|
|
12365
12848
|
exports.session = session;
|
|
12366
12849
|
exports.setConfig = setConfig;
|
|
12367
12850
|
exports.swarm = swarm;
|