agent-swarm-kit 1.0.154 → 1.0.155
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 +49 -35
- package/build/index.mjs +49 -35
- package/package.json +1 -1
package/build/index.cjs
CHANGED
|
@@ -2339,10 +2339,15 @@ var ClientAgent = /** @class */ (function () {
|
|
|
2339
2339
|
})];
|
|
2340
2340
|
case 2:
|
|
2341
2341
|
_b.sent();
|
|
2342
|
-
return [
|
|
2342
|
+
if (!(GLOBAL_CONFIG.CC_RESQUE_STRATEGY === "flush")) return [3 /*break*/, 4];
|
|
2343
|
+
return [4 /*yield*/, this._resqueSubject.next(MODEL_RESQUE_SYMBOL)];
|
|
2343
2344
|
case 3:
|
|
2345
|
+
_b.sent();
|
|
2346
|
+
return [2 /*return*/, placeholder];
|
|
2347
|
+
case 4: return [4 /*yield*/, this.getCompletion(mode)];
|
|
2348
|
+
case 5:
|
|
2344
2349
|
rawMessage = _b.sent();
|
|
2345
|
-
if (!((_a = rawMessage.tool_calls) === null || _a === void 0 ? void 0 : _a.length)) return [3 /*break*/,
|
|
2350
|
+
if (!((_a = rawMessage.tool_calls) === null || _a === void 0 ? void 0 : _a.length)) return [3 /*break*/, 8];
|
|
2346
2351
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2347
2352
|
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " _resurrectModel should not emit tool_calls"));
|
|
2348
2353
|
console.warn("agent-swarm _resurrectModel should not emit tool_calls for agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " strategy=").concat(GLOBAL_CONFIG.CC_RESQUE_STRATEGY));
|
|
@@ -2352,22 +2357,22 @@ var ClientAgent = /** @class */ (function () {
|
|
|
2352
2357
|
agentName: this.params.agentName,
|
|
2353
2358
|
content: "_resurrectModel should not emit tool calls",
|
|
2354
2359
|
})];
|
|
2355
|
-
case
|
|
2360
|
+
case 6:
|
|
2356
2361
|
_b.sent();
|
|
2357
2362
|
return [4 /*yield*/, this._resqueSubject.next(MODEL_RESQUE_SYMBOL)];
|
|
2358
|
-
case
|
|
2363
|
+
case 7:
|
|
2359
2364
|
_b.sent();
|
|
2360
2365
|
return [2 /*return*/, placeholder];
|
|
2361
|
-
case
|
|
2362
|
-
case
|
|
2366
|
+
case 8: return [4 /*yield*/, this.params.map(rawMessage, this.params.clientId, this.params.agentName)];
|
|
2367
|
+
case 9:
|
|
2363
2368
|
message = _b.sent();
|
|
2364
2369
|
return [4 /*yield*/, this.params.transform(message.content, this.params.clientId, this.params.agentName)];
|
|
2365
|
-
case
|
|
2370
|
+
case 10:
|
|
2366
2371
|
result = _b.sent();
|
|
2367
2372
|
validation = null;
|
|
2368
2373
|
return [4 /*yield*/, this.params.validate(result)];
|
|
2369
|
-
case
|
|
2370
|
-
if (!(validation = _b.sent())) return [3 /*break*/,
|
|
2374
|
+
case 11:
|
|
2375
|
+
if (!(validation = _b.sent())) return [3 /*break*/, 13];
|
|
2371
2376
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2372
2377
|
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " _resurrectModel validation error: ").concat(validation));
|
|
2373
2378
|
console.warn("agent-swarm model resurrect did not solved the problem for agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " strategy=").concat(GLOBAL_CONFIG.CC_RESQUE_STRATEGY, " validation=").concat(validation));
|
|
@@ -2377,15 +2382,15 @@ var ClientAgent = /** @class */ (function () {
|
|
|
2377
2382
|
agentName: this.params.agentName,
|
|
2378
2383
|
content: "_resurrectModel failed validation: ".concat(validation),
|
|
2379
2384
|
})];
|
|
2380
|
-
case 10:
|
|
2381
|
-
_b.sent();
|
|
2382
|
-
return [3 /*break*/, 13];
|
|
2383
|
-
case 11: return [4 /*yield*/, this.params.history.push(__assign(__assign({}, message), { agentName: this.params.agentName }))];
|
|
2384
2385
|
case 12:
|
|
2385
2386
|
_b.sent();
|
|
2386
|
-
|
|
2387
|
-
case 13: return [4 /*yield*/, this.
|
|
2387
|
+
return [3 /*break*/, 15];
|
|
2388
|
+
case 13: return [4 /*yield*/, this.params.history.push(__assign(__assign({}, message), { agentName: this.params.agentName }))];
|
|
2388
2389
|
case 14:
|
|
2390
|
+
_b.sent();
|
|
2391
|
+
_b.label = 15;
|
|
2392
|
+
case 15: return [4 /*yield*/, this._resqueSubject.next(MODEL_RESQUE_SYMBOL)];
|
|
2393
|
+
case 16:
|
|
2389
2394
|
_b.sent();
|
|
2390
2395
|
return [2 /*return*/, placeholder];
|
|
2391
2396
|
}
|
|
@@ -2416,15 +2421,15 @@ var ClientAgent = /** @class */ (function () {
|
|
|
2416
2421
|
ClientAgent.prototype.getCompletion = function (mode) {
|
|
2417
2422
|
return __awaiter(this, void 0, void 0, function () {
|
|
2418
2423
|
var messages, args, output, message, result, validation, messages_1, args_1, output_1, output_2;
|
|
2419
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2420
|
-
return __generator(this, function (
|
|
2421
|
-
switch (
|
|
2424
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
2425
|
+
return __generator(this, function (_r) {
|
|
2426
|
+
switch (_r.label) {
|
|
2422
2427
|
case 0:
|
|
2423
2428
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2424
2429
|
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " getCompletion"));
|
|
2425
2430
|
return [4 /*yield*/, this.params.history.toArrayForAgent(this.params.prompt, this.params.system)];
|
|
2426
2431
|
case 1:
|
|
2427
|
-
messages =
|
|
2432
|
+
messages = _r.sent();
|
|
2428
2433
|
args = {
|
|
2429
2434
|
clientId: this.params.clientId,
|
|
2430
2435
|
agentName: this.params.agentName,
|
|
@@ -2436,22 +2441,29 @@ var ClientAgent = /** @class */ (function () {
|
|
|
2436
2441
|
};
|
|
2437
2442
|
return [4 /*yield*/, this.params.completion.getCompletion(args)];
|
|
2438
2443
|
case 2:
|
|
2439
|
-
output =
|
|
2444
|
+
output = _r.sent();
|
|
2445
|
+
if (GLOBAL_CONFIG.CC_RESQUE_STRATEGY === "flush") {
|
|
2446
|
+
((_b = this.params.completion.callbacks) === null || _b === void 0 ? void 0 : _b.onComplete) &&
|
|
2447
|
+
((_c = this.params.completion.callbacks) === null || _c === void 0 ? void 0 : _c.onComplete(args, output));
|
|
2448
|
+
return [2 /*return*/, __assign(__assign({}, output), { content: output.content || "" })];
|
|
2449
|
+
}
|
|
2440
2450
|
return [4 /*yield*/, this.params.map(output, this.params.clientId, this.params.agentName)];
|
|
2441
2451
|
case 3:
|
|
2442
|
-
message =
|
|
2452
|
+
message = _r.sent();
|
|
2443
2453
|
return [4 /*yield*/, this.params.transform(message.content, this.params.clientId, this.params.agentName)];
|
|
2444
2454
|
case 4:
|
|
2445
|
-
result =
|
|
2446
|
-
if ((
|
|
2455
|
+
result = _r.sent();
|
|
2456
|
+
if ((_d = message.tool_calls) === null || _d === void 0 ? void 0 : _d.length) {
|
|
2457
|
+
((_e = this.params.completion.callbacks) === null || _e === void 0 ? void 0 : _e.onComplete) &&
|
|
2458
|
+
((_f = this.params.completion.callbacks) === null || _f === void 0 ? void 0 : _f.onComplete(args, output));
|
|
2447
2459
|
return [2 /*return*/, __assign(__assign({}, output), { content: output.content || "" })];
|
|
2448
2460
|
}
|
|
2449
2461
|
return [4 /*yield*/, this.params.validate(result)];
|
|
2450
2462
|
case 5:
|
|
2451
|
-
validation =
|
|
2463
|
+
validation = _r.sent();
|
|
2452
2464
|
if (!!validation) return [3 /*break*/, 6];
|
|
2453
|
-
((
|
|
2454
|
-
((
|
|
2465
|
+
((_g = this.params.completion.callbacks) === null || _g === void 0 ? void 0 : _g.onComplete) &&
|
|
2466
|
+
((_h = this.params.completion.callbacks) === null || _h === void 0 ? void 0 : _h.onComplete(args, output));
|
|
2455
2467
|
return [2 /*return*/, __assign(__assign({}, output), { content: output.content || "" })];
|
|
2456
2468
|
case 6:
|
|
2457
2469
|
if (!(GLOBAL_CONFIG.CC_RESQUE_STRATEGY === "recomplete")) return [3 /*break*/, 10];
|
|
@@ -2463,36 +2475,38 @@ var ClientAgent = /** @class */ (function () {
|
|
|
2463
2475
|
content: GLOBAL_CONFIG.CC_TOOL_CALL_EXCEPTION_RECOMPLETE_PROMPT,
|
|
2464
2476
|
})];
|
|
2465
2477
|
case 7:
|
|
2466
|
-
|
|
2478
|
+
_r.sent();
|
|
2467
2479
|
return [4 /*yield*/, this.params.history.toArrayForAgent(this.params.prompt, this.params.system)];
|
|
2468
2480
|
case 8:
|
|
2469
|
-
messages_1 =
|
|
2481
|
+
messages_1 = _r.sent();
|
|
2470
2482
|
args_1 = {
|
|
2471
2483
|
clientId: this.params.clientId,
|
|
2472
2484
|
agentName: this.params.agentName,
|
|
2473
2485
|
messages: messages_1,
|
|
2474
2486
|
mode: mode,
|
|
2475
|
-
tools: (
|
|
2487
|
+
tools: (_j = this.params.tools) === null || _j === void 0 ? void 0 : _j.map(function (t) {
|
|
2476
2488
|
return lodashEs.omit(t, "toolName", "docNote", "call", "validate", "callbacks");
|
|
2477
2489
|
}),
|
|
2478
2490
|
};
|
|
2479
2491
|
return [4 /*yield*/, this.params.completion.getCompletion(args_1)];
|
|
2480
2492
|
case 9:
|
|
2481
|
-
output_1 =
|
|
2493
|
+
output_1 = _r.sent();
|
|
2494
|
+
((_k = this.params.completion.callbacks) === null || _k === void 0 ? void 0 : _k.onComplete) &&
|
|
2495
|
+
((_l = this.params.completion.callbacks) === null || _l === void 0 ? void 0 : _l.onComplete(args_1, output_1));
|
|
2482
2496
|
return [2 /*return*/, __assign(__assign({}, output_1), { content: output_1.content || "" })];
|
|
2483
2497
|
case 10:
|
|
2484
2498
|
if (!(GLOBAL_CONFIG.CC_RESQUE_STRATEGY === "custom")) return [3 /*break*/, 12];
|
|
2485
2499
|
console.warn("agent-swarm model using custom resurrect for agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " validation=").concat(validation));
|
|
2486
2500
|
return [4 /*yield*/, GLOBAL_CONFIG.CC_TOOL_CALL_EXCEPTION_CUSTOM_FUNCTION(this.params.clientId, this.params.agentName)];
|
|
2487
2501
|
case 11:
|
|
2488
|
-
output_2 =
|
|
2489
|
-
((
|
|
2490
|
-
((
|
|
2502
|
+
output_2 = _r.sent();
|
|
2503
|
+
((_m = this.params.completion.callbacks) === null || _m === void 0 ? void 0 : _m.onComplete) &&
|
|
2504
|
+
((_o = this.params.completion.callbacks) === null || _o === void 0 ? void 0 : _o.onComplete(args, output_2));
|
|
2491
2505
|
return [2 /*return*/, output_2];
|
|
2492
2506
|
case 12:
|
|
2493
2507
|
console.warn("agent-swarm model completion pending resurrect for agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " strategy=").concat(GLOBAL_CONFIG.CC_RESQUE_STRATEGY, " validation=").concat(validation));
|
|
2494
|
-
((
|
|
2495
|
-
((
|
|
2508
|
+
((_p = this.params.completion.callbacks) === null || _p === void 0 ? void 0 : _p.onComplete) &&
|
|
2509
|
+
((_q = this.params.completion.callbacks) === null || _q === void 0 ? void 0 : _q.onComplete(args, output));
|
|
2496
2510
|
return [2 /*return*/, __assign(__assign({}, output), { content: output.content || "" })];
|
|
2497
2511
|
}
|
|
2498
2512
|
});
|
package/build/index.mjs
CHANGED
|
@@ -2337,10 +2337,15 @@ var ClientAgent = /** @class */ (function () {
|
|
|
2337
2337
|
})];
|
|
2338
2338
|
case 2:
|
|
2339
2339
|
_b.sent();
|
|
2340
|
-
return [
|
|
2340
|
+
if (!(GLOBAL_CONFIG.CC_RESQUE_STRATEGY === "flush")) return [3 /*break*/, 4];
|
|
2341
|
+
return [4 /*yield*/, this._resqueSubject.next(MODEL_RESQUE_SYMBOL)];
|
|
2341
2342
|
case 3:
|
|
2343
|
+
_b.sent();
|
|
2344
|
+
return [2 /*return*/, placeholder];
|
|
2345
|
+
case 4: return [4 /*yield*/, this.getCompletion(mode)];
|
|
2346
|
+
case 5:
|
|
2342
2347
|
rawMessage = _b.sent();
|
|
2343
|
-
if (!((_a = rawMessage.tool_calls) === null || _a === void 0 ? void 0 : _a.length)) return [3 /*break*/,
|
|
2348
|
+
if (!((_a = rawMessage.tool_calls) === null || _a === void 0 ? void 0 : _a.length)) return [3 /*break*/, 8];
|
|
2344
2349
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2345
2350
|
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " _resurrectModel should not emit tool_calls"));
|
|
2346
2351
|
console.warn("agent-swarm _resurrectModel should not emit tool_calls for agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " strategy=").concat(GLOBAL_CONFIG.CC_RESQUE_STRATEGY));
|
|
@@ -2350,22 +2355,22 @@ var ClientAgent = /** @class */ (function () {
|
|
|
2350
2355
|
agentName: this.params.agentName,
|
|
2351
2356
|
content: "_resurrectModel should not emit tool calls",
|
|
2352
2357
|
})];
|
|
2353
|
-
case
|
|
2358
|
+
case 6:
|
|
2354
2359
|
_b.sent();
|
|
2355
2360
|
return [4 /*yield*/, this._resqueSubject.next(MODEL_RESQUE_SYMBOL)];
|
|
2356
|
-
case
|
|
2361
|
+
case 7:
|
|
2357
2362
|
_b.sent();
|
|
2358
2363
|
return [2 /*return*/, placeholder];
|
|
2359
|
-
case
|
|
2360
|
-
case
|
|
2364
|
+
case 8: return [4 /*yield*/, this.params.map(rawMessage, this.params.clientId, this.params.agentName)];
|
|
2365
|
+
case 9:
|
|
2361
2366
|
message = _b.sent();
|
|
2362
2367
|
return [4 /*yield*/, this.params.transform(message.content, this.params.clientId, this.params.agentName)];
|
|
2363
|
-
case
|
|
2368
|
+
case 10:
|
|
2364
2369
|
result = _b.sent();
|
|
2365
2370
|
validation = null;
|
|
2366
2371
|
return [4 /*yield*/, this.params.validate(result)];
|
|
2367
|
-
case
|
|
2368
|
-
if (!(validation = _b.sent())) return [3 /*break*/,
|
|
2372
|
+
case 11:
|
|
2373
|
+
if (!(validation = _b.sent())) return [3 /*break*/, 13];
|
|
2369
2374
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2370
2375
|
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " _resurrectModel validation error: ").concat(validation));
|
|
2371
2376
|
console.warn("agent-swarm model resurrect did not solved the problem for agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " strategy=").concat(GLOBAL_CONFIG.CC_RESQUE_STRATEGY, " validation=").concat(validation));
|
|
@@ -2375,15 +2380,15 @@ var ClientAgent = /** @class */ (function () {
|
|
|
2375
2380
|
agentName: this.params.agentName,
|
|
2376
2381
|
content: "_resurrectModel failed validation: ".concat(validation),
|
|
2377
2382
|
})];
|
|
2378
|
-
case 10:
|
|
2379
|
-
_b.sent();
|
|
2380
|
-
return [3 /*break*/, 13];
|
|
2381
|
-
case 11: return [4 /*yield*/, this.params.history.push(__assign(__assign({}, message), { agentName: this.params.agentName }))];
|
|
2382
2383
|
case 12:
|
|
2383
2384
|
_b.sent();
|
|
2384
|
-
|
|
2385
|
-
case 13: return [4 /*yield*/, this.
|
|
2385
|
+
return [3 /*break*/, 15];
|
|
2386
|
+
case 13: return [4 /*yield*/, this.params.history.push(__assign(__assign({}, message), { agentName: this.params.agentName }))];
|
|
2386
2387
|
case 14:
|
|
2388
|
+
_b.sent();
|
|
2389
|
+
_b.label = 15;
|
|
2390
|
+
case 15: return [4 /*yield*/, this._resqueSubject.next(MODEL_RESQUE_SYMBOL)];
|
|
2391
|
+
case 16:
|
|
2387
2392
|
_b.sent();
|
|
2388
2393
|
return [2 /*return*/, placeholder];
|
|
2389
2394
|
}
|
|
@@ -2414,15 +2419,15 @@ var ClientAgent = /** @class */ (function () {
|
|
|
2414
2419
|
ClientAgent.prototype.getCompletion = function (mode) {
|
|
2415
2420
|
return __awaiter(this, void 0, void 0, function () {
|
|
2416
2421
|
var messages, args, output, message, result, validation, messages_1, args_1, output_1, output_2;
|
|
2417
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2418
|
-
return __generator(this, function (
|
|
2419
|
-
switch (
|
|
2422
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
2423
|
+
return __generator(this, function (_r) {
|
|
2424
|
+
switch (_r.label) {
|
|
2420
2425
|
case 0:
|
|
2421
2426
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2422
2427
|
this.params.logger.debug("ClientAgent agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " getCompletion"));
|
|
2423
2428
|
return [4 /*yield*/, this.params.history.toArrayForAgent(this.params.prompt, this.params.system)];
|
|
2424
2429
|
case 1:
|
|
2425
|
-
messages =
|
|
2430
|
+
messages = _r.sent();
|
|
2426
2431
|
args = {
|
|
2427
2432
|
clientId: this.params.clientId,
|
|
2428
2433
|
agentName: this.params.agentName,
|
|
@@ -2434,22 +2439,29 @@ var ClientAgent = /** @class */ (function () {
|
|
|
2434
2439
|
};
|
|
2435
2440
|
return [4 /*yield*/, this.params.completion.getCompletion(args)];
|
|
2436
2441
|
case 2:
|
|
2437
|
-
output =
|
|
2442
|
+
output = _r.sent();
|
|
2443
|
+
if (GLOBAL_CONFIG.CC_RESQUE_STRATEGY === "flush") {
|
|
2444
|
+
((_b = this.params.completion.callbacks) === null || _b === void 0 ? void 0 : _b.onComplete) &&
|
|
2445
|
+
((_c = this.params.completion.callbacks) === null || _c === void 0 ? void 0 : _c.onComplete(args, output));
|
|
2446
|
+
return [2 /*return*/, __assign(__assign({}, output), { content: output.content || "" })];
|
|
2447
|
+
}
|
|
2438
2448
|
return [4 /*yield*/, this.params.map(output, this.params.clientId, this.params.agentName)];
|
|
2439
2449
|
case 3:
|
|
2440
|
-
message =
|
|
2450
|
+
message = _r.sent();
|
|
2441
2451
|
return [4 /*yield*/, this.params.transform(message.content, this.params.clientId, this.params.agentName)];
|
|
2442
2452
|
case 4:
|
|
2443
|
-
result =
|
|
2444
|
-
if ((
|
|
2453
|
+
result = _r.sent();
|
|
2454
|
+
if ((_d = message.tool_calls) === null || _d === void 0 ? void 0 : _d.length) {
|
|
2455
|
+
((_e = this.params.completion.callbacks) === null || _e === void 0 ? void 0 : _e.onComplete) &&
|
|
2456
|
+
((_f = this.params.completion.callbacks) === null || _f === void 0 ? void 0 : _f.onComplete(args, output));
|
|
2445
2457
|
return [2 /*return*/, __assign(__assign({}, output), { content: output.content || "" })];
|
|
2446
2458
|
}
|
|
2447
2459
|
return [4 /*yield*/, this.params.validate(result)];
|
|
2448
2460
|
case 5:
|
|
2449
|
-
validation =
|
|
2461
|
+
validation = _r.sent();
|
|
2450
2462
|
if (!!validation) return [3 /*break*/, 6];
|
|
2451
|
-
((
|
|
2452
|
-
((
|
|
2463
|
+
((_g = this.params.completion.callbacks) === null || _g === void 0 ? void 0 : _g.onComplete) &&
|
|
2464
|
+
((_h = this.params.completion.callbacks) === null || _h === void 0 ? void 0 : _h.onComplete(args, output));
|
|
2453
2465
|
return [2 /*return*/, __assign(__assign({}, output), { content: output.content || "" })];
|
|
2454
2466
|
case 6:
|
|
2455
2467
|
if (!(GLOBAL_CONFIG.CC_RESQUE_STRATEGY === "recomplete")) return [3 /*break*/, 10];
|
|
@@ -2461,36 +2473,38 @@ var ClientAgent = /** @class */ (function () {
|
|
|
2461
2473
|
content: GLOBAL_CONFIG.CC_TOOL_CALL_EXCEPTION_RECOMPLETE_PROMPT,
|
|
2462
2474
|
})];
|
|
2463
2475
|
case 7:
|
|
2464
|
-
|
|
2476
|
+
_r.sent();
|
|
2465
2477
|
return [4 /*yield*/, this.params.history.toArrayForAgent(this.params.prompt, this.params.system)];
|
|
2466
2478
|
case 8:
|
|
2467
|
-
messages_1 =
|
|
2479
|
+
messages_1 = _r.sent();
|
|
2468
2480
|
args_1 = {
|
|
2469
2481
|
clientId: this.params.clientId,
|
|
2470
2482
|
agentName: this.params.agentName,
|
|
2471
2483
|
messages: messages_1,
|
|
2472
2484
|
mode: mode,
|
|
2473
|
-
tools: (
|
|
2485
|
+
tools: (_j = this.params.tools) === null || _j === void 0 ? void 0 : _j.map(function (t) {
|
|
2474
2486
|
return omit(t, "toolName", "docNote", "call", "validate", "callbacks");
|
|
2475
2487
|
}),
|
|
2476
2488
|
};
|
|
2477
2489
|
return [4 /*yield*/, this.params.completion.getCompletion(args_1)];
|
|
2478
2490
|
case 9:
|
|
2479
|
-
output_1 =
|
|
2491
|
+
output_1 = _r.sent();
|
|
2492
|
+
((_k = this.params.completion.callbacks) === null || _k === void 0 ? void 0 : _k.onComplete) &&
|
|
2493
|
+
((_l = this.params.completion.callbacks) === null || _l === void 0 ? void 0 : _l.onComplete(args_1, output_1));
|
|
2480
2494
|
return [2 /*return*/, __assign(__assign({}, output_1), { content: output_1.content || "" })];
|
|
2481
2495
|
case 10:
|
|
2482
2496
|
if (!(GLOBAL_CONFIG.CC_RESQUE_STRATEGY === "custom")) return [3 /*break*/, 12];
|
|
2483
2497
|
console.warn("agent-swarm model using custom resurrect for agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " validation=").concat(validation));
|
|
2484
2498
|
return [4 /*yield*/, GLOBAL_CONFIG.CC_TOOL_CALL_EXCEPTION_CUSTOM_FUNCTION(this.params.clientId, this.params.agentName)];
|
|
2485
2499
|
case 11:
|
|
2486
|
-
output_2 =
|
|
2487
|
-
((
|
|
2488
|
-
((
|
|
2500
|
+
output_2 = _r.sent();
|
|
2501
|
+
((_m = this.params.completion.callbacks) === null || _m === void 0 ? void 0 : _m.onComplete) &&
|
|
2502
|
+
((_o = this.params.completion.callbacks) === null || _o === void 0 ? void 0 : _o.onComplete(args, output_2));
|
|
2489
2503
|
return [2 /*return*/, output_2];
|
|
2490
2504
|
case 12:
|
|
2491
2505
|
console.warn("agent-swarm model completion pending resurrect for agentName=".concat(this.params.agentName, " clientId=").concat(this.params.clientId, " strategy=").concat(GLOBAL_CONFIG.CC_RESQUE_STRATEGY, " validation=").concat(validation));
|
|
2492
|
-
((
|
|
2493
|
-
((
|
|
2506
|
+
((_p = this.params.completion.callbacks) === null || _p === void 0 ? void 0 : _p.onComplete) &&
|
|
2507
|
+
((_q = this.params.completion.callbacks) === null || _q === void 0 ? void 0 : _q.onComplete(args, output));
|
|
2494
2508
|
return [2 /*return*/, __assign(__assign({}, output), { content: output.content || "" })];
|
|
2495
2509
|
}
|
|
2496
2510
|
});
|