agent-swarm-kit 1.0.80 → 1.0.82
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 +864 -575
- package/build/index.mjs +864 -577
- package/package.json +1 -1
- package/types.d.ts +184 -25
package/build/index.cjs
CHANGED
|
@@ -167,8 +167,8 @@ var MethodContextService = diScoped.scoped(/** @class */ (function () {
|
|
|
167
167
|
return class_1;
|
|
168
168
|
}()));
|
|
169
169
|
|
|
170
|
-
var _a;
|
|
171
|
-
var init = (_a = diKit.createActivator("agent-swarm"), _a.init), inject = _a.inject, provide = _a.provide;
|
|
170
|
+
var _a$2;
|
|
171
|
+
var init = (_a$2 = diKit.createActivator("agent-swarm"), _a$2.init), inject = _a$2.inject, provide = _a$2.provide;
|
|
172
172
|
|
|
173
173
|
var baseServices$1 = {
|
|
174
174
|
busService: Symbol('busService'),
|
|
@@ -228,103 +228,6 @@ var ExecutionContextService = diScoped.scoped(/** @class */ (function () {
|
|
|
228
228
|
return class_1;
|
|
229
229
|
}()));
|
|
230
230
|
|
|
231
|
-
/**
|
|
232
|
-
* LoggerService class that implements the ILogger interface.
|
|
233
|
-
* Provides methods to log and debug messages.
|
|
234
|
-
*/
|
|
235
|
-
var LoggerService = /** @class */ (function () {
|
|
236
|
-
function LoggerService() {
|
|
237
|
-
var _this = this;
|
|
238
|
-
this.methodContextService = inject(TYPES.methodContextService);
|
|
239
|
-
this.executionContextService = inject(TYPES.executionContextService);
|
|
240
|
-
this._logger = {
|
|
241
|
-
/**
|
|
242
|
-
* Logs messages.
|
|
243
|
-
* @param {...any} args - The messages to log.
|
|
244
|
-
*/
|
|
245
|
-
log: function () {
|
|
246
|
-
},
|
|
247
|
-
/**
|
|
248
|
-
* Logs debug messages.
|
|
249
|
-
* @param {...any} args - The debug messages to log.
|
|
250
|
-
*/
|
|
251
|
-
debug: function () {
|
|
252
|
-
},
|
|
253
|
-
/**
|
|
254
|
-
* Logs info messages.
|
|
255
|
-
* @param {...any} args - The info messages to log.
|
|
256
|
-
*/
|
|
257
|
-
info: function () {
|
|
258
|
-
},
|
|
259
|
-
};
|
|
260
|
-
/**
|
|
261
|
-
* Logs messages using the current logger.
|
|
262
|
-
* @param {...any} args - The messages to log.
|
|
263
|
-
*/
|
|
264
|
-
this.log = function () {
|
|
265
|
-
var _a;
|
|
266
|
-
var args = [];
|
|
267
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
268
|
-
args[_i] = arguments[_i];
|
|
269
|
-
}
|
|
270
|
-
var methodContext = MethodContextService.hasContext()
|
|
271
|
-
? _this.methodContextService.context
|
|
272
|
-
: null;
|
|
273
|
-
var executionContext = ExecutionContextService.hasContext()
|
|
274
|
-
? _this.executionContextService.context
|
|
275
|
-
: null;
|
|
276
|
-
(_a = _this._logger).log.apply(_a, __spreadArray(__spreadArray([], __read(args), false), [{
|
|
277
|
-
methodContext: methodContext,
|
|
278
|
-
executionContext: executionContext,
|
|
279
|
-
}], false));
|
|
280
|
-
};
|
|
281
|
-
/**
|
|
282
|
-
* Logs debug messages using the current logger.
|
|
283
|
-
* @param {...any} args - The debug messages to log.
|
|
284
|
-
*/
|
|
285
|
-
this.debug = function () {
|
|
286
|
-
var _a;
|
|
287
|
-
var args = [];
|
|
288
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
289
|
-
args[_i] = arguments[_i];
|
|
290
|
-
}
|
|
291
|
-
var methodContext = MethodContextService.hasContext()
|
|
292
|
-
? _this.methodContextService.context
|
|
293
|
-
: null;
|
|
294
|
-
var executionContext = ExecutionContextService.hasContext()
|
|
295
|
-
? _this.executionContextService.context
|
|
296
|
-
: null;
|
|
297
|
-
(_a = _this._logger).debug.apply(_a, __spreadArray(__spreadArray([], __read(args), false), [{ methodContext: methodContext, executionContext: executionContext }], false));
|
|
298
|
-
};
|
|
299
|
-
/**
|
|
300
|
-
* Logs info messages using the current logger.
|
|
301
|
-
* @param {...any} args - The info messages to log.
|
|
302
|
-
*/
|
|
303
|
-
this.info = function () {
|
|
304
|
-
var _a;
|
|
305
|
-
var args = [];
|
|
306
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
307
|
-
args[_i] = arguments[_i];
|
|
308
|
-
}
|
|
309
|
-
var methodContext = MethodContextService.hasContext()
|
|
310
|
-
? _this.methodContextService.context
|
|
311
|
-
: null;
|
|
312
|
-
var executionContext = ExecutionContextService.hasContext()
|
|
313
|
-
? _this.executionContextService.context
|
|
314
|
-
: null;
|
|
315
|
-
(_a = _this._logger).info.apply(_a, __spreadArray(__spreadArray([], __read(args), false), [{ methodContext: methodContext, executionContext: executionContext }], false));
|
|
316
|
-
};
|
|
317
|
-
/**
|
|
318
|
-
* Sets a new logger.
|
|
319
|
-
* @param {ILogger} logger - The new logger to set.
|
|
320
|
-
*/
|
|
321
|
-
this.setLogger = function (logger) {
|
|
322
|
-
_this._logger = logger;
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
return LoggerService;
|
|
326
|
-
}());
|
|
327
|
-
|
|
328
231
|
/**
|
|
329
232
|
* Validates that the given output string is not empty.
|
|
330
233
|
*
|
|
@@ -429,6 +332,8 @@ var removeXmlTags = function (input) {
|
|
|
429
332
|
.trim();
|
|
430
333
|
};
|
|
431
334
|
|
|
335
|
+
var _a$1;
|
|
336
|
+
var HISTORY_INSTANCE_WAIT_FOR_INIT = Symbol("wait-for-init");
|
|
432
337
|
var INSTANCE_METHOD_NAME_WAIT_FOR_INIT = "HistoryInstance.waitForInit";
|
|
433
338
|
var INSTANCE_METHOD_NAME_CTOR = "HistoryInstance.CTOR";
|
|
434
339
|
var INSTANCE_METHOD_NAME_ITERATE_CONDITION = "HistoryInstance.iterate condition";
|
|
@@ -455,71 +360,31 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
455
360
|
this.callbacks = callbacks;
|
|
456
361
|
this._array = [];
|
|
457
362
|
/**
|
|
458
|
-
*
|
|
363
|
+
* Makes the singleshot for initialization
|
|
459
364
|
* @param agentName - The agent name.
|
|
460
365
|
*/
|
|
461
|
-
this
|
|
462
|
-
var
|
|
463
|
-
return __generator(this, function (
|
|
464
|
-
switch (
|
|
366
|
+
this[_a$1] = functoolsKit.singleshot(function (agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
367
|
+
var _b;
|
|
368
|
+
return __generator(this, function (_c) {
|
|
369
|
+
switch (_c.label) {
|
|
465
370
|
case 0:
|
|
466
|
-
GLOBAL_CONFIG.
|
|
467
|
-
swarm.loggerService.
|
|
371
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
372
|
+
swarm$1.loggerService.debug(INSTANCE_METHOD_NAME_WAIT_FOR_INIT, {
|
|
468
373
|
clientId: this.clientId,
|
|
469
374
|
agentName: agentName,
|
|
470
375
|
});
|
|
471
376
|
if (!this.callbacks.getData) return [3 /*break*/, 2];
|
|
472
|
-
|
|
377
|
+
_b = this;
|
|
473
378
|
return [4 /*yield*/, this.callbacks.getData(this.clientId, agentName)];
|
|
474
379
|
case 1:
|
|
475
|
-
|
|
476
|
-
|
|
380
|
+
_b._array = _c.sent();
|
|
381
|
+
_c.label = 2;
|
|
477
382
|
case 2: return [2 /*return*/];
|
|
478
383
|
}
|
|
479
384
|
});
|
|
480
385
|
}); });
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
* @param value - The model message to push.
|
|
484
|
-
* @param agentName - The agent name.
|
|
485
|
-
* @returns A promise that resolves when the message is pushed.
|
|
486
|
-
*/
|
|
487
|
-
this.push = function (value, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
488
|
-
return __generator(this, function (_a) {
|
|
489
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
490
|
-
swarm.loggerService.log(INSTANCE_METHOD_NAME_PUSH, {
|
|
491
|
-
clientId: this.clientId,
|
|
492
|
-
agentName: agentName,
|
|
493
|
-
});
|
|
494
|
-
this.callbacks.onPush &&
|
|
495
|
-
this.callbacks.onPush(value, this.clientId, agentName);
|
|
496
|
-
this._array.push(value);
|
|
497
|
-
this.callbacks.onChange &&
|
|
498
|
-
this.callbacks.onChange(this._array, this.clientId, agentName);
|
|
499
|
-
return [2 /*return*/, Promise.resolve()];
|
|
500
|
-
});
|
|
501
|
-
}); };
|
|
502
|
-
/**
|
|
503
|
-
* Dispose of the history for a given agent.
|
|
504
|
-
* @param agentName - The agent name or null.
|
|
505
|
-
* @returns A promise that resolves when the history is disposed.
|
|
506
|
-
*/
|
|
507
|
-
this.dispose = function (agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
508
|
-
return __generator(this, function (_a) {
|
|
509
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
510
|
-
swarm.loggerService.log(INSTANCE_METHOD_NAME_DISPOSE, {
|
|
511
|
-
clientId: this.clientId,
|
|
512
|
-
agentName: agentName,
|
|
513
|
-
});
|
|
514
|
-
if (agentName === null) {
|
|
515
|
-
this.callbacks.onDispose && this.callbacks.onDispose(this.clientId);
|
|
516
|
-
this._array = [];
|
|
517
|
-
}
|
|
518
|
-
return [2 /*return*/, Promise.resolve()];
|
|
519
|
-
});
|
|
520
|
-
}); };
|
|
521
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
522
|
-
swarm.loggerService.log(INSTANCE_METHOD_NAME_CTOR, {
|
|
386
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
387
|
+
swarm$1.loggerService.debug(INSTANCE_METHOD_NAME_CTOR, {
|
|
523
388
|
clientId: this.clientId,
|
|
524
389
|
});
|
|
525
390
|
if (callbacks.onInit) {
|
|
@@ -531,47 +396,47 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
531
396
|
if (callbacks.filterCondition) {
|
|
532
397
|
this.iterate = function (agentName) {
|
|
533
398
|
return __asyncGenerator(this, arguments, function () {
|
|
534
|
-
var
|
|
535
|
-
var e_1,
|
|
536
|
-
return __generator(this, function (
|
|
537
|
-
switch (
|
|
399
|
+
var _b, _c, item, e_1_1, _d, _e, item, e_2_1;
|
|
400
|
+
var e_1, _f, e_2, _g;
|
|
401
|
+
return __generator(this, function (_h) {
|
|
402
|
+
switch (_h.label) {
|
|
538
403
|
case 0:
|
|
539
|
-
GLOBAL_CONFIG.
|
|
540
|
-
swarm.loggerService.
|
|
404
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
405
|
+
swarm$1.loggerService.debug(INSTANCE_METHOD_NAME_ITERATE_CONDITION, {
|
|
541
406
|
clientId: this.clientId,
|
|
542
407
|
agentName: agentName,
|
|
543
408
|
});
|
|
544
409
|
if (!this.callbacks.onRead) return [3 /*break*/, 12];
|
|
545
410
|
this.callbacks.onReadBegin &&
|
|
546
411
|
this.callbacks.onReadBegin(this.clientId, agentName);
|
|
547
|
-
|
|
412
|
+
_h.label = 1;
|
|
548
413
|
case 1:
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
414
|
+
_h.trys.push([1, 8, 9, 10]);
|
|
415
|
+
_b = __values(this._array), _c = _b.next();
|
|
416
|
+
_h.label = 2;
|
|
552
417
|
case 2:
|
|
553
|
-
if (!!
|
|
554
|
-
item =
|
|
418
|
+
if (!!_c.done) return [3 /*break*/, 7];
|
|
419
|
+
item = _c.value;
|
|
555
420
|
return [4 /*yield*/, __await(this.callbacks.filterCondition(item, this.clientId, agentName))];
|
|
556
421
|
case 3:
|
|
557
|
-
if (!
|
|
422
|
+
if (!_h.sent()) return [3 /*break*/, 6];
|
|
558
423
|
this.callbacks.onRead(item, this.clientId, agentName);
|
|
559
424
|
return [4 /*yield*/, __await(item)];
|
|
560
|
-
case 4: return [4 /*yield*/,
|
|
425
|
+
case 4: return [4 /*yield*/, _h.sent()];
|
|
561
426
|
case 5:
|
|
562
|
-
|
|
563
|
-
|
|
427
|
+
_h.sent();
|
|
428
|
+
_h.label = 6;
|
|
564
429
|
case 6:
|
|
565
|
-
|
|
430
|
+
_c = _b.next();
|
|
566
431
|
return [3 /*break*/, 2];
|
|
567
432
|
case 7: return [3 /*break*/, 10];
|
|
568
433
|
case 8:
|
|
569
|
-
e_1_1 =
|
|
434
|
+
e_1_1 = _h.sent();
|
|
570
435
|
e_1 = { error: e_1_1 };
|
|
571
436
|
return [3 /*break*/, 10];
|
|
572
437
|
case 9:
|
|
573
438
|
try {
|
|
574
|
-
if (
|
|
439
|
+
if (_c && !_c.done && (_f = _b.return)) _f.call(_b);
|
|
575
440
|
}
|
|
576
441
|
finally { if (e_1) throw e_1.error; }
|
|
577
442
|
return [7 /*endfinally*/];
|
|
@@ -579,37 +444,37 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
579
444
|
this.callbacks.onReadEnd &&
|
|
580
445
|
this.callbacks.onReadEnd(this.clientId, agentName);
|
|
581
446
|
return [4 /*yield*/, __await(void 0)];
|
|
582
|
-
case 11: return [2 /*return*/,
|
|
447
|
+
case 11: return [2 /*return*/, _h.sent()];
|
|
583
448
|
case 12:
|
|
584
449
|
this.callbacks.onReadBegin &&
|
|
585
450
|
this.callbacks.onReadBegin(this.clientId, agentName);
|
|
586
|
-
|
|
451
|
+
_h.label = 13;
|
|
587
452
|
case 13:
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
453
|
+
_h.trys.push([13, 20, 21, 22]);
|
|
454
|
+
_d = __values(this._array), _e = _d.next();
|
|
455
|
+
_h.label = 14;
|
|
591
456
|
case 14:
|
|
592
|
-
if (!!
|
|
593
|
-
item =
|
|
457
|
+
if (!!_e.done) return [3 /*break*/, 19];
|
|
458
|
+
item = _e.value;
|
|
594
459
|
return [4 /*yield*/, __await(this.callbacks.filterCondition(item, this.clientId, agentName))];
|
|
595
460
|
case 15:
|
|
596
|
-
if (!
|
|
461
|
+
if (!_h.sent()) return [3 /*break*/, 18];
|
|
597
462
|
return [4 /*yield*/, __await(item)];
|
|
598
|
-
case 16: return [4 /*yield*/,
|
|
463
|
+
case 16: return [4 /*yield*/, _h.sent()];
|
|
599
464
|
case 17:
|
|
600
|
-
|
|
601
|
-
|
|
465
|
+
_h.sent();
|
|
466
|
+
_h.label = 18;
|
|
602
467
|
case 18:
|
|
603
|
-
|
|
468
|
+
_e = _d.next();
|
|
604
469
|
return [3 /*break*/, 14];
|
|
605
470
|
case 19: return [3 /*break*/, 22];
|
|
606
471
|
case 20:
|
|
607
|
-
e_2_1 =
|
|
472
|
+
e_2_1 = _h.sent();
|
|
608
473
|
e_2 = { error: e_2_1 };
|
|
609
474
|
return [3 /*break*/, 22];
|
|
610
475
|
case 21:
|
|
611
476
|
try {
|
|
612
|
-
if (
|
|
477
|
+
if (_e && !_e.done && (_g = _d.return)) _g.call(_d);
|
|
613
478
|
}
|
|
614
479
|
finally { if (e_2) throw e_2.error; }
|
|
615
480
|
return [7 /*endfinally*/];
|
|
@@ -623,6 +488,20 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
623
488
|
};
|
|
624
489
|
}
|
|
625
490
|
}
|
|
491
|
+
/**
|
|
492
|
+
* Wait for the history to initialize.
|
|
493
|
+
* @param agentName - The agent name.
|
|
494
|
+
*/
|
|
495
|
+
HistoryInstance.prototype.waitForInit = function (agentName) {
|
|
496
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
497
|
+
return __generator(this, function (_b) {
|
|
498
|
+
switch (_b.label) {
|
|
499
|
+
case 0: return [4 /*yield*/, this[HISTORY_INSTANCE_WAIT_FOR_INIT](agentName)];
|
|
500
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
};
|
|
626
505
|
/**
|
|
627
506
|
* Iterate over the history messages for a given agent.
|
|
628
507
|
* @param agentName - The agent name.
|
|
@@ -630,44 +509,44 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
630
509
|
*/
|
|
631
510
|
HistoryInstance.prototype.iterate = function (agentName) {
|
|
632
511
|
return __asyncGenerator(this, arguments, function iterate_1() {
|
|
633
|
-
var
|
|
634
|
-
var e_3,
|
|
635
|
-
return __generator(this, function (
|
|
636
|
-
switch (
|
|
512
|
+
var _b, _c, item, e_3_1, _d, _e, item, e_4_1;
|
|
513
|
+
var e_3, _f, e_4, _g;
|
|
514
|
+
return __generator(this, function (_h) {
|
|
515
|
+
switch (_h.label) {
|
|
637
516
|
case 0:
|
|
638
|
-
GLOBAL_CONFIG.
|
|
639
|
-
swarm.loggerService.
|
|
517
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
518
|
+
swarm$1.loggerService.debug(INSTANCE_METHOD_NAME_ITERATE, {
|
|
640
519
|
clientId: this.clientId,
|
|
641
520
|
agentName: agentName,
|
|
642
521
|
});
|
|
643
522
|
if (!this.callbacks.onRead) return [3 /*break*/, 11];
|
|
644
523
|
this.callbacks.onReadBegin &&
|
|
645
524
|
this.callbacks.onReadBegin(this.clientId, agentName);
|
|
646
|
-
|
|
525
|
+
_h.label = 1;
|
|
647
526
|
case 1:
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
527
|
+
_h.trys.push([1, 7, 8, 9]);
|
|
528
|
+
_b = __values(this._array), _c = _b.next();
|
|
529
|
+
_h.label = 2;
|
|
651
530
|
case 2:
|
|
652
|
-
if (!!
|
|
653
|
-
item =
|
|
531
|
+
if (!!_c.done) return [3 /*break*/, 6];
|
|
532
|
+
item = _c.value;
|
|
654
533
|
this.callbacks.onRead(item, this.clientId, agentName);
|
|
655
534
|
return [4 /*yield*/, __await(item)];
|
|
656
|
-
case 3: return [4 /*yield*/,
|
|
535
|
+
case 3: return [4 /*yield*/, _h.sent()];
|
|
657
536
|
case 4:
|
|
658
|
-
|
|
659
|
-
|
|
537
|
+
_h.sent();
|
|
538
|
+
_h.label = 5;
|
|
660
539
|
case 5:
|
|
661
|
-
|
|
540
|
+
_c = _b.next();
|
|
662
541
|
return [3 /*break*/, 2];
|
|
663
542
|
case 6: return [3 /*break*/, 9];
|
|
664
543
|
case 7:
|
|
665
|
-
e_3_1 =
|
|
544
|
+
e_3_1 = _h.sent();
|
|
666
545
|
e_3 = { error: e_3_1 };
|
|
667
546
|
return [3 /*break*/, 9];
|
|
668
547
|
case 8:
|
|
669
548
|
try {
|
|
670
|
-
if (
|
|
549
|
+
if (_c && !_c.done && (_f = _b.return)) _f.call(_b);
|
|
671
550
|
}
|
|
672
551
|
finally { if (e_3) throw e_3.error; }
|
|
673
552
|
return [7 /*endfinally*/];
|
|
@@ -675,34 +554,34 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
675
554
|
this.callbacks.onReadEnd &&
|
|
676
555
|
this.callbacks.onReadEnd(this.clientId, agentName);
|
|
677
556
|
return [4 /*yield*/, __await(void 0)];
|
|
678
|
-
case 10: return [2 /*return*/,
|
|
557
|
+
case 10: return [2 /*return*/, _h.sent()];
|
|
679
558
|
case 11:
|
|
680
559
|
this.callbacks.onReadBegin &&
|
|
681
560
|
this.callbacks.onReadBegin(this.clientId, agentName);
|
|
682
|
-
|
|
561
|
+
_h.label = 12;
|
|
683
562
|
case 12:
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
563
|
+
_h.trys.push([12, 18, 19, 20]);
|
|
564
|
+
_d = __values(this._array), _e = _d.next();
|
|
565
|
+
_h.label = 13;
|
|
687
566
|
case 13:
|
|
688
|
-
if (!!
|
|
689
|
-
item =
|
|
567
|
+
if (!!_e.done) return [3 /*break*/, 17];
|
|
568
|
+
item = _e.value;
|
|
690
569
|
return [4 /*yield*/, __await(item)];
|
|
691
|
-
case 14: return [4 /*yield*/,
|
|
570
|
+
case 14: return [4 /*yield*/, _h.sent()];
|
|
692
571
|
case 15:
|
|
693
|
-
|
|
694
|
-
|
|
572
|
+
_h.sent();
|
|
573
|
+
_h.label = 16;
|
|
695
574
|
case 16:
|
|
696
|
-
|
|
575
|
+
_e = _d.next();
|
|
697
576
|
return [3 /*break*/, 13];
|
|
698
577
|
case 17: return [3 /*break*/, 20];
|
|
699
578
|
case 18:
|
|
700
|
-
e_4_1 =
|
|
579
|
+
e_4_1 = _h.sent();
|
|
701
580
|
e_4 = { error: e_4_1 };
|
|
702
581
|
return [3 /*break*/, 20];
|
|
703
582
|
case 19:
|
|
704
583
|
try {
|
|
705
|
-
if (
|
|
584
|
+
if (_e && !_e.done && (_g = _d.return)) _g.call(_d);
|
|
706
585
|
}
|
|
707
586
|
finally { if (e_4) throw e_4.error; }
|
|
708
587
|
return [7 /*endfinally*/];
|
|
@@ -714,8 +593,45 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
714
593
|
});
|
|
715
594
|
});
|
|
716
595
|
};
|
|
596
|
+
/**
|
|
597
|
+
* Push a new message to the history for a given agent.
|
|
598
|
+
* @param value - The model message to push.
|
|
599
|
+
* @param agentName - The agent name.
|
|
600
|
+
* @returns A promise that resolves when the message is pushed.
|
|
601
|
+
*/
|
|
602
|
+
HistoryInstance.prototype.push = function (value, agentName) {
|
|
603
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
604
|
+
swarm$1.loggerService.debug(INSTANCE_METHOD_NAME_PUSH, {
|
|
605
|
+
clientId: this.clientId,
|
|
606
|
+
agentName: agentName,
|
|
607
|
+
});
|
|
608
|
+
this.callbacks.onPush &&
|
|
609
|
+
this.callbacks.onPush(value, this.clientId, agentName);
|
|
610
|
+
this._array.push(value);
|
|
611
|
+
this.callbacks.onChange &&
|
|
612
|
+
this.callbacks.onChange(this._array, this.clientId, agentName);
|
|
613
|
+
return Promise.resolve();
|
|
614
|
+
};
|
|
615
|
+
/**
|
|
616
|
+
* Dispose of the history for a given agent.
|
|
617
|
+
* @param agentName - The agent name or null.
|
|
618
|
+
* @returns A promise that resolves when the history is disposed.
|
|
619
|
+
*/
|
|
620
|
+
HistoryInstance.prototype.dispose = function (agentName) {
|
|
621
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
622
|
+
swarm$1.loggerService.debug(INSTANCE_METHOD_NAME_DISPOSE, {
|
|
623
|
+
clientId: this.clientId,
|
|
624
|
+
agentName: agentName,
|
|
625
|
+
});
|
|
626
|
+
if (agentName === null) {
|
|
627
|
+
this.callbacks.onDispose && this.callbacks.onDispose(this.clientId);
|
|
628
|
+
this._array = [];
|
|
629
|
+
}
|
|
630
|
+
return Promise.resolve();
|
|
631
|
+
};
|
|
717
632
|
return HistoryInstance;
|
|
718
633
|
}());
|
|
634
|
+
_a$1 = HISTORY_INSTANCE_WAIT_FOR_INIT;
|
|
719
635
|
/**
|
|
720
636
|
* Class representing History Utilities
|
|
721
637
|
*/
|
|
@@ -724,8 +640,8 @@ var HistoryUtils = /** @class */ (function () {
|
|
|
724
640
|
var _this = this;
|
|
725
641
|
this.HistoryFactory = HistoryInstance;
|
|
726
642
|
this.HistoryCallbacks = {};
|
|
727
|
-
this.getHistory = functoolsKit.memoize(function (
|
|
728
|
-
var
|
|
643
|
+
this.getHistory = functoolsKit.memoize(function (_b) {
|
|
644
|
+
var _c = __read(_b, 1), clientId = _c[0];
|
|
729
645
|
return clientId;
|
|
730
646
|
}, function (clientId) {
|
|
731
647
|
return new _this.HistoryFactory(clientId, _this.HistoryCallbacks);
|
|
@@ -736,7 +652,7 @@ var HistoryUtils = /** @class */ (function () {
|
|
|
736
652
|
*/
|
|
737
653
|
this.useHistoryAdapter = function (Ctor) {
|
|
738
654
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
739
|
-
swarm.loggerService.log(METHOD_NAME_USE_HISTORY_ADAPTER);
|
|
655
|
+
swarm$1.loggerService.log(METHOD_NAME_USE_HISTORY_ADAPTER);
|
|
740
656
|
_this.HistoryFactory = Ctor;
|
|
741
657
|
};
|
|
742
658
|
/**
|
|
@@ -745,7 +661,7 @@ var HistoryUtils = /** @class */ (function () {
|
|
|
745
661
|
*/
|
|
746
662
|
this.useHistoryCallbacks = function (Callbacks) {
|
|
747
663
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
748
|
-
swarm.loggerService.log(METHOD_NAME_USE_HISTORY_CALLBACKS);
|
|
664
|
+
swarm$1.loggerService.log(METHOD_NAME_USE_HISTORY_CALLBACKS);
|
|
749
665
|
Object.assign(_this.HistoryCallbacks, Callbacks);
|
|
750
666
|
};
|
|
751
667
|
/**
|
|
@@ -757,11 +673,11 @@ var HistoryUtils = /** @class */ (function () {
|
|
|
757
673
|
*/
|
|
758
674
|
this.push = function (value, clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
759
675
|
var isInitial, history;
|
|
760
|
-
return __generator(this, function (
|
|
761
|
-
switch (
|
|
676
|
+
return __generator(this, function (_b) {
|
|
677
|
+
switch (_b.label) {
|
|
762
678
|
case 0:
|
|
763
679
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
764
|
-
swarm.loggerService.log(METHOD_NAME_PUSH, {
|
|
680
|
+
swarm$1.loggerService.log(METHOD_NAME_PUSH, {
|
|
765
681
|
clientId: clientId,
|
|
766
682
|
agentName: agentName,
|
|
767
683
|
value: value,
|
|
@@ -769,12 +685,12 @@ var HistoryUtils = /** @class */ (function () {
|
|
|
769
685
|
isInitial = this.getHistory.has(clientId);
|
|
770
686
|
return [4 /*yield*/, this.getHistory(clientId)];
|
|
771
687
|
case 1:
|
|
772
|
-
history =
|
|
688
|
+
history = _b.sent();
|
|
773
689
|
return [4 /*yield*/, history.waitForInit(agentName, isInitial)];
|
|
774
690
|
case 2:
|
|
775
|
-
|
|
691
|
+
_b.sent();
|
|
776
692
|
return [4 /*yield*/, history.push(value, agentName)];
|
|
777
|
-
case 3: return [2 /*return*/,
|
|
693
|
+
case 3: return [2 /*return*/, _b.sent()];
|
|
778
694
|
}
|
|
779
695
|
});
|
|
780
696
|
}); };
|
|
@@ -785,25 +701,27 @@ var HistoryUtils = /** @class */ (function () {
|
|
|
785
701
|
* @returns A promise that resolves when the history is disposed.
|
|
786
702
|
*/
|
|
787
703
|
this.dispose = function (clientId, agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
788
|
-
var
|
|
789
|
-
return __generator(this, function (
|
|
790
|
-
switch (
|
|
704
|
+
var history;
|
|
705
|
+
return __generator(this, function (_b) {
|
|
706
|
+
switch (_b.label) {
|
|
791
707
|
case 0:
|
|
792
708
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
793
|
-
swarm.loggerService.log(METHOD_NAME_DISPOSE, {
|
|
709
|
+
swarm$1.loggerService.log(METHOD_NAME_DISPOSE, {
|
|
794
710
|
clientId: clientId,
|
|
795
711
|
agentName: agentName,
|
|
796
712
|
});
|
|
797
|
-
|
|
713
|
+
if (!this.getHistory.has(clientId)) {
|
|
714
|
+
return [2 /*return*/];
|
|
715
|
+
}
|
|
798
716
|
return [4 /*yield*/, this.getHistory(clientId)];
|
|
799
717
|
case 1:
|
|
800
|
-
history =
|
|
801
|
-
return [4 /*yield*/, history.waitForInit(agentName,
|
|
718
|
+
history = _b.sent();
|
|
719
|
+
return [4 /*yield*/, history.waitForInit(agentName, false)];
|
|
802
720
|
case 2:
|
|
803
|
-
|
|
721
|
+
_b.sent();
|
|
804
722
|
return [4 /*yield*/, history.dispose(agentName)];
|
|
805
723
|
case 3:
|
|
806
|
-
|
|
724
|
+
_b.sent();
|
|
807
725
|
if (agentName === null) {
|
|
808
726
|
this.getHistory.clear(clientId);
|
|
809
727
|
}
|
|
@@ -820,54 +738,54 @@ var HistoryUtils = /** @class */ (function () {
|
|
|
820
738
|
*/
|
|
821
739
|
HistoryUtils.prototype.iterate = function (clientId, agentName) {
|
|
822
740
|
return __asyncGenerator(this, arguments, function iterate_2() {
|
|
823
|
-
var isInitial, history,
|
|
824
|
-
var
|
|
825
|
-
return __generator(this, function (
|
|
826
|
-
switch (
|
|
741
|
+
var isInitial, history, _b, _c, _d, item, e_5_1;
|
|
742
|
+
var _e, e_5, _f, _g;
|
|
743
|
+
return __generator(this, function (_h) {
|
|
744
|
+
switch (_h.label) {
|
|
827
745
|
case 0:
|
|
828
746
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
829
|
-
swarm.loggerService.log(METHOD_NAME_ITERATE, {
|
|
747
|
+
swarm$1.loggerService.log(METHOD_NAME_ITERATE, {
|
|
830
748
|
clientId: clientId,
|
|
831
749
|
agentName: agentName,
|
|
832
750
|
});
|
|
833
751
|
isInitial = this.getHistory.has(clientId);
|
|
834
752
|
return [4 /*yield*/, __await(this.getHistory(clientId))];
|
|
835
753
|
case 1:
|
|
836
|
-
history =
|
|
754
|
+
history = _h.sent();
|
|
837
755
|
return [4 /*yield*/, __await(history.waitForInit(agentName, isInitial))];
|
|
838
756
|
case 2:
|
|
839
|
-
|
|
840
|
-
|
|
757
|
+
_h.sent();
|
|
758
|
+
_h.label = 3;
|
|
841
759
|
case 3:
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
case 4: return [4 /*yield*/, __await(
|
|
760
|
+
_h.trys.push([3, 10, 11, 16]);
|
|
761
|
+
_b = true, _c = __asyncValues(history.iterate(agentName));
|
|
762
|
+
_h.label = 4;
|
|
763
|
+
case 4: return [4 /*yield*/, __await(_c.next())];
|
|
846
764
|
case 5:
|
|
847
|
-
if (!(
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
item =
|
|
765
|
+
if (!(_d = _h.sent(), _e = _d.done, !_e)) return [3 /*break*/, 9];
|
|
766
|
+
_g = _d.value;
|
|
767
|
+
_b = false;
|
|
768
|
+
item = _g;
|
|
851
769
|
return [4 /*yield*/, __await(item)];
|
|
852
|
-
case 6: return [4 /*yield*/,
|
|
770
|
+
case 6: return [4 /*yield*/, _h.sent()];
|
|
853
771
|
case 7:
|
|
854
|
-
|
|
855
|
-
|
|
772
|
+
_h.sent();
|
|
773
|
+
_h.label = 8;
|
|
856
774
|
case 8:
|
|
857
|
-
|
|
775
|
+
_b = true;
|
|
858
776
|
return [3 /*break*/, 4];
|
|
859
777
|
case 9: return [3 /*break*/, 16];
|
|
860
778
|
case 10:
|
|
861
|
-
e_5_1 =
|
|
779
|
+
e_5_1 = _h.sent();
|
|
862
780
|
e_5 = { error: e_5_1 };
|
|
863
781
|
return [3 /*break*/, 16];
|
|
864
782
|
case 11:
|
|
865
|
-
|
|
866
|
-
if (!(!
|
|
867
|
-
return [4 /*yield*/, __await(
|
|
783
|
+
_h.trys.push([11, , 14, 15]);
|
|
784
|
+
if (!(!_b && !_e && (_f = _c.return))) return [3 /*break*/, 13];
|
|
785
|
+
return [4 /*yield*/, __await(_f.call(_c))];
|
|
868
786
|
case 12:
|
|
869
|
-
|
|
870
|
-
|
|
787
|
+
_h.sent();
|
|
788
|
+
_h.label = 13;
|
|
871
789
|
case 13: return [3 /*break*/, 15];
|
|
872
790
|
case 14:
|
|
873
791
|
if (e_5) throw e_5.error;
|
|
@@ -908,6 +826,291 @@ var nameToTitle = function (name) {
|
|
|
908
826
|
return __spreadArray(["".concat(word.charAt(0).toUpperCase()).concat(word.slice(1))], __read(rest), false).join(' ');
|
|
909
827
|
};
|
|
910
828
|
|
|
829
|
+
var _a;
|
|
830
|
+
var LOGGER_INSTANCE_WAIT_FOR_INIT = Symbol('wait-for-init');
|
|
831
|
+
/**
|
|
832
|
+
* @class LoggerInstance
|
|
833
|
+
* @implements ILoggerInstance
|
|
834
|
+
* @description Logger instance class.
|
|
835
|
+
*/
|
|
836
|
+
var LoggerInstance = /** @class */ (function () {
|
|
837
|
+
function LoggerInstance(clientId, callbacks) {
|
|
838
|
+
var _this = this;
|
|
839
|
+
this.clientId = clientId;
|
|
840
|
+
this.callbacks = callbacks;
|
|
841
|
+
this[_a] = functoolsKit.singleshot(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
842
|
+
return __generator(this, function (_b) {
|
|
843
|
+
if (this.callbacks.onInit) {
|
|
844
|
+
this.callbacks.onInit(this.clientId);
|
|
845
|
+
}
|
|
846
|
+
return [2 /*return*/];
|
|
847
|
+
});
|
|
848
|
+
}); });
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* @method waitForInit
|
|
852
|
+
* @description Waits for initialization.
|
|
853
|
+
* @returns {Promise<void>}
|
|
854
|
+
*/
|
|
855
|
+
LoggerInstance.prototype.waitForInit = function () {
|
|
856
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
857
|
+
return __generator(this, function (_b) {
|
|
858
|
+
switch (_b.label) {
|
|
859
|
+
case 0: return [4 /*yield*/, this[LOGGER_INSTANCE_WAIT_FOR_INIT]()];
|
|
860
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
});
|
|
864
|
+
};
|
|
865
|
+
/**
|
|
866
|
+
* @method log
|
|
867
|
+
* @description Logs a message.
|
|
868
|
+
* @param {string} topic - The topic of the log.
|
|
869
|
+
* @param {...any[]} args - The log arguments.
|
|
870
|
+
*/
|
|
871
|
+
LoggerInstance.prototype.log = function (topic) {
|
|
872
|
+
var _b;
|
|
873
|
+
var args = [];
|
|
874
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
875
|
+
args[_i - 1] = arguments[_i];
|
|
876
|
+
}
|
|
877
|
+
if (this.callbacks.onLog) {
|
|
878
|
+
(_b = this.callbacks).onLog.apply(_b, __spreadArray([this.clientId, topic], __read(args), false));
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
/**
|
|
882
|
+
* @method debug
|
|
883
|
+
* @description Logs a debug message.
|
|
884
|
+
* @param {string} topic - The topic of the debug log.
|
|
885
|
+
* @param {...any[]} args - The debug log arguments.
|
|
886
|
+
*/
|
|
887
|
+
LoggerInstance.prototype.debug = function (topic) {
|
|
888
|
+
var _b;
|
|
889
|
+
var args = [];
|
|
890
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
891
|
+
args[_i - 1] = arguments[_i];
|
|
892
|
+
}
|
|
893
|
+
if (this.callbacks.onDebug) {
|
|
894
|
+
(_b = this.callbacks).onDebug.apply(_b, __spreadArray([this.clientId, topic], __read(args), false));
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
/**
|
|
898
|
+
* @method info
|
|
899
|
+
* @description Logs an info message.
|
|
900
|
+
* @param {string} topic - The topic of the info log.
|
|
901
|
+
* @param {...any[]} args - The info log arguments.
|
|
902
|
+
*/
|
|
903
|
+
LoggerInstance.prototype.info = function (topic) {
|
|
904
|
+
var _b;
|
|
905
|
+
var args = [];
|
|
906
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
907
|
+
args[_i - 1] = arguments[_i];
|
|
908
|
+
}
|
|
909
|
+
if (this.callbacks.onInfo) {
|
|
910
|
+
(_b = this.callbacks).onInfo.apply(_b, __spreadArray([this.clientId, topic], __read(args), false));
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
/**
|
|
914
|
+
* @method dispose
|
|
915
|
+
* @description Disposes the logger instance.
|
|
916
|
+
*/
|
|
917
|
+
LoggerInstance.prototype.dispose = function () {
|
|
918
|
+
if (this.callbacks.onDispose) {
|
|
919
|
+
this.callbacks.onDispose(this.clientId);
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
return LoggerInstance;
|
|
923
|
+
}());
|
|
924
|
+
_a = LOGGER_INSTANCE_WAIT_FOR_INIT;
|
|
925
|
+
/**
|
|
926
|
+
* @class LoggerUtils
|
|
927
|
+
* @implements ILoggerAdapter, ILoggerControl
|
|
928
|
+
* @description Utility class for logger.
|
|
929
|
+
*/
|
|
930
|
+
var LoggerUtils = /** @class */ (function () {
|
|
931
|
+
function LoggerUtils() {
|
|
932
|
+
var _this = this;
|
|
933
|
+
this.LoggerFactory = LoggerInstance;
|
|
934
|
+
this.LoggerCallbacks = {};
|
|
935
|
+
this.getLogger = functoolsKit.memoize(function (_b) {
|
|
936
|
+
var _c = __read(_b, 1), clientId = _c[0];
|
|
937
|
+
return clientId;
|
|
938
|
+
}, function (clientId) { return new _this.LoggerFactory(clientId, _this.LoggerCallbacks); });
|
|
939
|
+
/**
|
|
940
|
+
* @method useCommonAdapter
|
|
941
|
+
* @description Sets the common logger adapter.
|
|
942
|
+
* @param {ILogger} logger - The logger instance.
|
|
943
|
+
*/
|
|
944
|
+
this.useCommonAdapter = function (logger) {
|
|
945
|
+
swarm$1.loggerService.setLogger(logger);
|
|
946
|
+
};
|
|
947
|
+
/**
|
|
948
|
+
* @method useClientCallbacks
|
|
949
|
+
* @description Sets the client-specific callbacks.
|
|
950
|
+
* @param {Partial<ILoggerInstanceCallbacks>} Callbacks - The callbacks.
|
|
951
|
+
*/
|
|
952
|
+
this.useClientCallbacks = function (Callbacks) {
|
|
953
|
+
Object.assign(_this.LoggerCallbacks, Callbacks);
|
|
954
|
+
};
|
|
955
|
+
/**
|
|
956
|
+
* @method useClientAdapter
|
|
957
|
+
* @description Sets the client-specific logger adapter.
|
|
958
|
+
* @param {TLoggerInstanceCtor} Ctor - The logger instance constructor.
|
|
959
|
+
*/
|
|
960
|
+
this.useClientAdapter = function (Ctor) {
|
|
961
|
+
_this.LoggerFactory = Ctor;
|
|
962
|
+
};
|
|
963
|
+
/**
|
|
964
|
+
* @method log
|
|
965
|
+
* @description Logs a message.
|
|
966
|
+
* @param {string} clientId - The client ID.
|
|
967
|
+
* @param {string} topic - The topic of the log.
|
|
968
|
+
* @param {...any[]} args - The log arguments.
|
|
969
|
+
* @returns {Promise<void>}
|
|
970
|
+
*/
|
|
971
|
+
this.log = function (clientId, topic) {
|
|
972
|
+
var args = [];
|
|
973
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
974
|
+
args[_i - 2] = arguments[_i];
|
|
975
|
+
}
|
|
976
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
977
|
+
var isInitial, logger;
|
|
978
|
+
return __generator(this, function (_b) {
|
|
979
|
+
switch (_b.label) {
|
|
980
|
+
case 0:
|
|
981
|
+
if (!GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG) {
|
|
982
|
+
return [2 /*return*/];
|
|
983
|
+
}
|
|
984
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
985
|
+
return [2 /*return*/];
|
|
986
|
+
}
|
|
987
|
+
isInitial = this.getLogger.has(clientId);
|
|
988
|
+
logger = this.getLogger(clientId);
|
|
989
|
+
return [4 /*yield*/, logger.waitForInit(isInitial)];
|
|
990
|
+
case 1:
|
|
991
|
+
_b.sent();
|
|
992
|
+
return [4 /*yield*/, logger.log.apply(logger, __spreadArray([topic], __read(args), false))];
|
|
993
|
+
case 2:
|
|
994
|
+
_b.sent();
|
|
995
|
+
return [2 /*return*/];
|
|
996
|
+
}
|
|
997
|
+
});
|
|
998
|
+
});
|
|
999
|
+
};
|
|
1000
|
+
/**
|
|
1001
|
+
* @method debug
|
|
1002
|
+
* @description Logs a debug message.
|
|
1003
|
+
* @param {string} clientId - The client ID.
|
|
1004
|
+
* @param {string} topic - The topic of the debug log.
|
|
1005
|
+
* @param {...any[]} args - The debug log arguments.
|
|
1006
|
+
* @returns {Promise<void>}
|
|
1007
|
+
*/
|
|
1008
|
+
this.debug = function (clientId, topic) {
|
|
1009
|
+
var args = [];
|
|
1010
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1011
|
+
args[_i - 2] = arguments[_i];
|
|
1012
|
+
}
|
|
1013
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
1014
|
+
var isInitial, logger;
|
|
1015
|
+
return __generator(this, function (_b) {
|
|
1016
|
+
switch (_b.label) {
|
|
1017
|
+
case 0:
|
|
1018
|
+
if (!GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG) {
|
|
1019
|
+
return [2 /*return*/];
|
|
1020
|
+
}
|
|
1021
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
1022
|
+
return [2 /*return*/];
|
|
1023
|
+
}
|
|
1024
|
+
isInitial = this.getLogger.has(clientId);
|
|
1025
|
+
logger = this.getLogger(clientId);
|
|
1026
|
+
return [4 /*yield*/, logger.waitForInit(isInitial)];
|
|
1027
|
+
case 1:
|
|
1028
|
+
_b.sent();
|
|
1029
|
+
return [4 /*yield*/, logger.debug.apply(logger, __spreadArray([topic], __read(args), false))];
|
|
1030
|
+
case 2:
|
|
1031
|
+
_b.sent();
|
|
1032
|
+
return [2 /*return*/];
|
|
1033
|
+
}
|
|
1034
|
+
});
|
|
1035
|
+
});
|
|
1036
|
+
};
|
|
1037
|
+
/**
|
|
1038
|
+
* @method info
|
|
1039
|
+
* @description Logs an info message.
|
|
1040
|
+
* @param {string} clientId - The client ID.
|
|
1041
|
+
* @param {string} topic - The topic of the info log.
|
|
1042
|
+
* @param {...any[]} args - The info log arguments.
|
|
1043
|
+
* @returns {Promise<void>}
|
|
1044
|
+
*/
|
|
1045
|
+
this.info = function (clientId, topic) {
|
|
1046
|
+
var args = [];
|
|
1047
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1048
|
+
args[_i - 2] = arguments[_i];
|
|
1049
|
+
}
|
|
1050
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
1051
|
+
var isInitial, logger;
|
|
1052
|
+
return __generator(this, function (_b) {
|
|
1053
|
+
switch (_b.label) {
|
|
1054
|
+
case 0:
|
|
1055
|
+
if (!GLOBAL_CONFIG.CC_LOGGER_ENABLE_INFO) {
|
|
1056
|
+
return [2 /*return*/];
|
|
1057
|
+
}
|
|
1058
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
1059
|
+
return [2 /*return*/];
|
|
1060
|
+
}
|
|
1061
|
+
isInitial = this.getLogger.has(clientId);
|
|
1062
|
+
logger = this.getLogger(clientId);
|
|
1063
|
+
return [4 /*yield*/, logger.waitForInit(isInitial)];
|
|
1064
|
+
case 1:
|
|
1065
|
+
_b.sent();
|
|
1066
|
+
return [4 /*yield*/, logger.info.apply(logger, __spreadArray([topic], __read(args), false))];
|
|
1067
|
+
case 2:
|
|
1068
|
+
_b.sent();
|
|
1069
|
+
return [2 /*return*/];
|
|
1070
|
+
}
|
|
1071
|
+
});
|
|
1072
|
+
});
|
|
1073
|
+
};
|
|
1074
|
+
/**
|
|
1075
|
+
* @method dispose
|
|
1076
|
+
* @description Disposes the logger instance.
|
|
1077
|
+
* @param {string} clientId - The client ID.
|
|
1078
|
+
* @returns {Promise<void>}
|
|
1079
|
+
*/
|
|
1080
|
+
this.dispose = function (clientId) { return __awaiter(_this, void 0, void 0, function () {
|
|
1081
|
+
var logger;
|
|
1082
|
+
return __generator(this, function (_b) {
|
|
1083
|
+
switch (_b.label) {
|
|
1084
|
+
case 0:
|
|
1085
|
+
if (!this.getLogger.has(clientId)) {
|
|
1086
|
+
return [2 /*return*/];
|
|
1087
|
+
}
|
|
1088
|
+
logger = this.getLogger(clientId);
|
|
1089
|
+
return [4 /*yield*/, logger.waitForInit(false)];
|
|
1090
|
+
case 1:
|
|
1091
|
+
_b.sent();
|
|
1092
|
+
return [4 /*yield*/, logger.dispose()];
|
|
1093
|
+
case 2:
|
|
1094
|
+
_b.sent();
|
|
1095
|
+
this.getLogger.clear(clientId);
|
|
1096
|
+
return [2 /*return*/];
|
|
1097
|
+
}
|
|
1098
|
+
});
|
|
1099
|
+
}); };
|
|
1100
|
+
}
|
|
1101
|
+
return LoggerUtils;
|
|
1102
|
+
}());
|
|
1103
|
+
/**
|
|
1104
|
+
* @constant LoggerAdapter
|
|
1105
|
+
* @description Singleton instance of LoggerUtils.
|
|
1106
|
+
*/
|
|
1107
|
+
var LoggerAdapter = new LoggerUtils();
|
|
1108
|
+
/**
|
|
1109
|
+
* @constant Logger
|
|
1110
|
+
* @description Logger control interface.
|
|
1111
|
+
*/
|
|
1112
|
+
var Logger = LoggerAdapter;
|
|
1113
|
+
|
|
911
1114
|
/**
|
|
912
1115
|
* @description `ask for agent function` in `llama3.1:8b` to troubleshoot (need CC_OLLAMA_EMIT_TOOL_PROTOCOL to be turned off)
|
|
913
1116
|
*/
|
|
@@ -928,19 +1131,11 @@ var CC_EMPTY_OUTPUT_PLACEHOLDERS = [
|
|
|
928
1131
|
"Could you please repeat that? I didn’t catch it.",
|
|
929
1132
|
];
|
|
930
1133
|
var CC_SWARM_AGENT_CHANGED = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
931
|
-
|
|
932
|
-
case 0: return [4 /*yield*/, functoolsKit.sleep(100)];
|
|
933
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
934
|
-
}
|
|
1134
|
+
return [2 /*return*/, Promise.resolve()];
|
|
935
1135
|
}); }); };
|
|
936
1136
|
var CC_SWARM_DEFAULT_AGENT = function (_a, _b, defaultAgent_1) { return __awaiter(void 0, [_a, _b, defaultAgent_1], void 0, function (_c, _d, defaultAgent) {
|
|
937
1137
|
return __generator(this, function (_e) {
|
|
938
|
-
|
|
939
|
-
case 0: return [4 /*yield*/, functoolsKit.sleep(100)];
|
|
940
|
-
case 1:
|
|
941
|
-
_e.sent();
|
|
942
|
-
return [2 /*return*/, defaultAgent];
|
|
943
|
-
}
|
|
1138
|
+
return [2 /*return*/, defaultAgent];
|
|
944
1139
|
});
|
|
945
1140
|
}); };
|
|
946
1141
|
var CC_AGENT_DEFAULT_VALIDATION = validateDefault;
|
|
@@ -961,12 +1156,13 @@ var CC_AGENT_HISTORY_FILTER = function (agentName) {
|
|
|
961
1156
|
var CC_AGENT_OUTPUT_TRANSFORM = removeXmlTags;
|
|
962
1157
|
var CC_KEEP_MESSAGES = 5;
|
|
963
1158
|
var CC_GET_AGENT_HISTORY_ADAPTER = function () { return HistoryAdapter; };
|
|
1159
|
+
var CC_GET_CLIENT_LOGGER_ADAPTER = function () { return LoggerAdapter; };
|
|
964
1160
|
var CC_AGENT_OUTPUT_MAP = function (message) { return message; };
|
|
965
1161
|
var CC_AGENT_SYSTEM_PROMPT = undefined;
|
|
966
1162
|
var CC_STORAGE_SEARCH_SIMILARITY = 0.65;
|
|
967
1163
|
var CC_STORAGE_SEARCH_POOL = 5;
|
|
968
1164
|
var CC_LOGGER_ENABLE_INFO = false;
|
|
969
|
-
var CC_LOGGER_ENABLE_DEBUG =
|
|
1165
|
+
var CC_LOGGER_ENABLE_DEBUG = false;
|
|
970
1166
|
var CC_LOGGER_ENABLE_LOG = true;
|
|
971
1167
|
var CC_NAME_TO_TITLE = nameToTitle;
|
|
972
1168
|
var GLOBAL_CONFIG = {
|
|
@@ -974,6 +1170,7 @@ var GLOBAL_CONFIG = {
|
|
|
974
1170
|
CC_EMPTY_OUTPUT_PLACEHOLDERS: CC_EMPTY_OUTPUT_PLACEHOLDERS,
|
|
975
1171
|
CC_KEEP_MESSAGES: CC_KEEP_MESSAGES,
|
|
976
1172
|
CC_GET_AGENT_HISTORY_ADAPTER: CC_GET_AGENT_HISTORY_ADAPTER,
|
|
1173
|
+
CC_GET_CLIENT_LOGGER_ADAPTER: CC_GET_CLIENT_LOGGER_ADAPTER,
|
|
977
1174
|
CC_SWARM_AGENT_CHANGED: CC_SWARM_AGENT_CHANGED,
|
|
978
1175
|
CC_SWARM_DEFAULT_AGENT: CC_SWARM_DEFAULT_AGENT,
|
|
979
1176
|
CC_AGENT_DEFAULT_VALIDATION: CC_AGENT_DEFAULT_VALIDATION,
|
|
@@ -994,6 +1191,123 @@ var setConfig = function (config) {
|
|
|
994
1191
|
Object.assign(GLOBAL_CONFIG, config);
|
|
995
1192
|
};
|
|
996
1193
|
|
|
1194
|
+
var NOOP_LOGGER = {
|
|
1195
|
+
/**
|
|
1196
|
+
* Logs normal level messages.
|
|
1197
|
+
*/
|
|
1198
|
+
log: function () {
|
|
1199
|
+
},
|
|
1200
|
+
/**
|
|
1201
|
+
* Logs debug level messages.
|
|
1202
|
+
*/
|
|
1203
|
+
debug: function () {
|
|
1204
|
+
},
|
|
1205
|
+
/**
|
|
1206
|
+
* Logs info level messages.
|
|
1207
|
+
*/
|
|
1208
|
+
info: function () {
|
|
1209
|
+
},
|
|
1210
|
+
};
|
|
1211
|
+
/**
|
|
1212
|
+
* LoggerService class that implements the ILogger interface.
|
|
1213
|
+
* Provides methods to log and debug messages.
|
|
1214
|
+
*/
|
|
1215
|
+
var LoggerService = /** @class */ (function () {
|
|
1216
|
+
function LoggerService() {
|
|
1217
|
+
var _this = this;
|
|
1218
|
+
this.methodContextService = inject(TYPES.methodContextService);
|
|
1219
|
+
this.executionContextService = inject(TYPES.executionContextService);
|
|
1220
|
+
this._commonLogger = NOOP_LOGGER;
|
|
1221
|
+
/**
|
|
1222
|
+
* Creates the client logs adapter using factory
|
|
1223
|
+
*/
|
|
1224
|
+
this.getLoggerAdapter = functoolsKit.singleshot(GLOBAL_CONFIG.CC_GET_CLIENT_LOGGER_ADAPTER);
|
|
1225
|
+
/**
|
|
1226
|
+
* Logs messages using the current logger.
|
|
1227
|
+
* @param {...any} args - The messages to log.
|
|
1228
|
+
*/
|
|
1229
|
+
this.log = function (topic) {
|
|
1230
|
+
var _a, _b;
|
|
1231
|
+
var _c;
|
|
1232
|
+
var args = [];
|
|
1233
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1234
|
+
args[_i - 1] = arguments[_i];
|
|
1235
|
+
}
|
|
1236
|
+
var methodContext = MethodContextService.hasContext()
|
|
1237
|
+
? _this.methodContextService.context
|
|
1238
|
+
: null;
|
|
1239
|
+
var executionContext = ExecutionContextService.hasContext()
|
|
1240
|
+
? _this.executionContextService.context
|
|
1241
|
+
: null;
|
|
1242
|
+
var clientId = (_c = methodContext === null || methodContext === void 0 ? void 0 : methodContext.clientId) !== null && _c !== void 0 ? _c : executionContext === null || executionContext === void 0 ? void 0 : executionContext.clientId;
|
|
1243
|
+
var context = {
|
|
1244
|
+
methodContext: methodContext,
|
|
1245
|
+
executionContext: executionContext,
|
|
1246
|
+
};
|
|
1247
|
+
clientId && (_a = _this.getLoggerAdapter()).log.apply(_a, __spreadArray(__spreadArray([clientId, topic], __read(args), false), [context], false));
|
|
1248
|
+
(_b = _this._commonLogger).log.apply(_b, __spreadArray(__spreadArray([topic], __read(args), false), [context], false));
|
|
1249
|
+
};
|
|
1250
|
+
/**
|
|
1251
|
+
* Logs debug messages using the current logger.
|
|
1252
|
+
* @param {...any} args - The debug messages to log.
|
|
1253
|
+
*/
|
|
1254
|
+
this.debug = function (topic) {
|
|
1255
|
+
var _a, _b;
|
|
1256
|
+
var _c;
|
|
1257
|
+
var args = [];
|
|
1258
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1259
|
+
args[_i - 1] = arguments[_i];
|
|
1260
|
+
}
|
|
1261
|
+
var methodContext = MethodContextService.hasContext()
|
|
1262
|
+
? _this.methodContextService.context
|
|
1263
|
+
: null;
|
|
1264
|
+
var executionContext = ExecutionContextService.hasContext()
|
|
1265
|
+
? _this.executionContextService.context
|
|
1266
|
+
: null;
|
|
1267
|
+
var clientId = (_c = methodContext === null || methodContext === void 0 ? void 0 : methodContext.clientId) !== null && _c !== void 0 ? _c : executionContext === null || executionContext === void 0 ? void 0 : executionContext.clientId;
|
|
1268
|
+
var context = {
|
|
1269
|
+
methodContext: methodContext,
|
|
1270
|
+
executionContext: executionContext,
|
|
1271
|
+
};
|
|
1272
|
+
clientId && (_a = _this.getLoggerAdapter()).debug.apply(_a, __spreadArray(__spreadArray([clientId, topic], __read(args), false), [context], false));
|
|
1273
|
+
(_b = _this._commonLogger).debug.apply(_b, __spreadArray(__spreadArray([topic], __read(args), false), [context], false));
|
|
1274
|
+
};
|
|
1275
|
+
/**
|
|
1276
|
+
* Logs info messages using the current logger.
|
|
1277
|
+
* @param {...any} args - The info messages to log.
|
|
1278
|
+
*/
|
|
1279
|
+
this.info = function (topic) {
|
|
1280
|
+
var _a, _b;
|
|
1281
|
+
var _c;
|
|
1282
|
+
var args = [];
|
|
1283
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1284
|
+
args[_i - 1] = arguments[_i];
|
|
1285
|
+
}
|
|
1286
|
+
var methodContext = MethodContextService.hasContext()
|
|
1287
|
+
? _this.methodContextService.context
|
|
1288
|
+
: null;
|
|
1289
|
+
var executionContext = ExecutionContextService.hasContext()
|
|
1290
|
+
? _this.executionContextService.context
|
|
1291
|
+
: null;
|
|
1292
|
+
var clientId = (_c = methodContext === null || methodContext === void 0 ? void 0 : methodContext.clientId) !== null && _c !== void 0 ? _c : executionContext === null || executionContext === void 0 ? void 0 : executionContext.clientId;
|
|
1293
|
+
var context = {
|
|
1294
|
+
methodContext: methodContext,
|
|
1295
|
+
executionContext: executionContext,
|
|
1296
|
+
};
|
|
1297
|
+
clientId && (_a = _this.getLoggerAdapter()).info.apply(_a, __spreadArray(__spreadArray([clientId, topic], __read(args), false), [context], false));
|
|
1298
|
+
(_b = _this._commonLogger).info.apply(_b, __spreadArray(__spreadArray([topic], __read(args), false), [context], false));
|
|
1299
|
+
};
|
|
1300
|
+
/**
|
|
1301
|
+
* Sets a new logger.
|
|
1302
|
+
* @param {ILogger} logger - The new logger to set.
|
|
1303
|
+
*/
|
|
1304
|
+
this.setLogger = function (logger) {
|
|
1305
|
+
_this._commonLogger = logger;
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1308
|
+
return LoggerService;
|
|
1309
|
+
}());
|
|
1310
|
+
|
|
997
1311
|
/**
|
|
998
1312
|
* Service for managing agent schemas.
|
|
999
1313
|
*/
|
|
@@ -2377,7 +2691,7 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2377
2691
|
this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " getAgentName"));
|
|
2378
2692
|
if (!(this._activeAgent === AGENT_NEED_FETCH)) return [3 /*break*/, 2];
|
|
2379
2693
|
_a = this;
|
|
2380
|
-
return [4 /*yield*/,
|
|
2694
|
+
return [4 /*yield*/, this.params.getActiveAgent(this.params.clientId, this.params.swarmName, this.params.defaultAgent)];
|
|
2381
2695
|
case 1:
|
|
2382
2696
|
_a._activeAgent = _b.sent();
|
|
2383
2697
|
_b.label = 2;
|
|
@@ -2475,15 +2789,19 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2475
2789
|
* @param {AgentName} agentName - The name of the agent to set as active.
|
|
2476
2790
|
*/
|
|
2477
2791
|
this.setAgentName = function (agentName) { return __awaiter(_this, void 0, void 0, function () {
|
|
2478
|
-
|
|
2479
|
-
|
|
2792
|
+
var _a;
|
|
2793
|
+
return __generator(this, function (_b) {
|
|
2794
|
+
switch (_b.label) {
|
|
2480
2795
|
case 0:
|
|
2481
2796
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_DEBUG &&
|
|
2482
2797
|
this.params.logger.debug("ClientSwarm swarmName=".concat(this.params.swarmName, " clientId=").concat(this.params.clientId, " setAgentName agentName=").concat(agentName));
|
|
2483
2798
|
this._activeAgent = agentName;
|
|
2484
|
-
return [4 /*yield*/, this.params.
|
|
2799
|
+
return [4 /*yield*/, this.params.setActiveAgent(this.params.clientId, agentName, this.params.swarmName)];
|
|
2485
2800
|
case 1:
|
|
2486
|
-
|
|
2801
|
+
_b.sent();
|
|
2802
|
+
if ((_a = this.params.callbacks) === null || _a === void 0 ? void 0 : _a.onAgentChanged) {
|
|
2803
|
+
this.params.callbacks.onAgentChanged(this.params.clientId, agentName, this.params.swarmName);
|
|
2804
|
+
}
|
|
2487
2805
|
return [4 /*yield*/, this.params.bus.emit(this.params.clientId, {
|
|
2488
2806
|
type: "set-agent-name",
|
|
2489
2807
|
source: "swarm-bus",
|
|
@@ -2497,7 +2815,7 @@ var ClientSwarm = /** @class */ (function () {
|
|
|
2497
2815
|
clientId: this.params.clientId,
|
|
2498
2816
|
})];
|
|
2499
2817
|
case 2:
|
|
2500
|
-
|
|
2818
|
+
_b.sent();
|
|
2501
2819
|
return [2 /*return*/];
|
|
2502
2820
|
}
|
|
2503
2821
|
});
|
|
@@ -2540,7 +2858,7 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2540
2858
|
return "".concat(clientId, "-").concat(swarmName);
|
|
2541
2859
|
}, function (clientId, swarmName) {
|
|
2542
2860
|
var e_1, _a;
|
|
2543
|
-
var _b = _this.swarmSchemaService.get(swarmName), agentList = _b.agentList, defaultAgent = _b.defaultAgent, callbacks = _b.callbacks;
|
|
2861
|
+
var _b = _this.swarmSchemaService.get(swarmName), agentList = _b.agentList, defaultAgent = _b.defaultAgent, callbacks = _b.callbacks, _c = _b.getActiveAgent, getActiveAgent = _c === void 0 ? GLOBAL_CONFIG.CC_SWARM_DEFAULT_AGENT : _c, _d = _b.setActiveAgent, setActiveAgent = _d === void 0 ? GLOBAL_CONFIG.CC_SWARM_AGENT_CHANGED : _d;
|
|
2544
2862
|
var agentMap = {};
|
|
2545
2863
|
try {
|
|
2546
2864
|
for (var agentList_1 = __values(agentList), agentList_1_1 = agentList_1.next(); !agentList_1_1.done; agentList_1_1 = agentList_1.next()) {
|
|
@@ -2562,22 +2880,8 @@ var SwarmConnectionService = /** @class */ (function () {
|
|
|
2562
2880
|
swarmName: swarmName,
|
|
2563
2881
|
logger: _this.loggerService,
|
|
2564
2882
|
bus: _this.busService,
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
return __generator(this, function (_a) {
|
|
2568
|
-
switch (_a.label) {
|
|
2569
|
-
case 0:
|
|
2570
|
-
if (callbacks && callbacks.onAgentChanged) {
|
|
2571
|
-
callbacks.onAgentChanged(clientId, agentName, swarmName);
|
|
2572
|
-
}
|
|
2573
|
-
return [4 /*yield*/, GLOBAL_CONFIG.CC_SWARM_AGENT_CHANGED(clientId, agentName, swarmName)];
|
|
2574
|
-
case 1:
|
|
2575
|
-
_a.sent();
|
|
2576
|
-
return [2 /*return*/];
|
|
2577
|
-
}
|
|
2578
|
-
});
|
|
2579
|
-
});
|
|
2580
|
-
},
|
|
2883
|
+
getActiveAgent: getActiveAgent,
|
|
2884
|
+
setActiveAgent: setActiveAgent,
|
|
2581
2885
|
callbacks: callbacks,
|
|
2582
2886
|
});
|
|
2583
2887
|
});
|
|
@@ -6718,6 +7022,7 @@ var validationServices = {
|
|
|
6718
7022
|
};
|
|
6719
7023
|
var swarm = __assign(__assign(__assign(__assign(__assign(__assign({}, baseServices), contextServices), connectionServices), schemaServices), publicServices), validationServices);
|
|
6720
7024
|
init();
|
|
7025
|
+
var swarm$1 = swarm;
|
|
6721
7026
|
|
|
6722
7027
|
var METHOD_NAME$C = "function.addAgent";
|
|
6723
7028
|
/**
|
|
@@ -6728,11 +7033,11 @@ var METHOD_NAME$C = "function.addAgent";
|
|
|
6728
7033
|
*/
|
|
6729
7034
|
var addAgent = function (agentSchema) {
|
|
6730
7035
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6731
|
-
swarm.loggerService.log(METHOD_NAME$C, {
|
|
7036
|
+
swarm$1.loggerService.log(METHOD_NAME$C, {
|
|
6732
7037
|
agentSchema: agentSchema,
|
|
6733
7038
|
});
|
|
6734
|
-
swarm.agentValidationService.addAgent(agentSchema.agentName, agentSchema);
|
|
6735
|
-
swarm.agentSchemaService.register(agentSchema.agentName, agentSchema);
|
|
7039
|
+
swarm$1.agentValidationService.addAgent(agentSchema.agentName, agentSchema);
|
|
7040
|
+
swarm$1.agentSchemaService.register(agentSchema.agentName, agentSchema);
|
|
6736
7041
|
return agentSchema.agentName;
|
|
6737
7042
|
};
|
|
6738
7043
|
|
|
@@ -6746,11 +7051,11 @@ var METHOD_NAME$B = "function.addCompletion";
|
|
|
6746
7051
|
*/
|
|
6747
7052
|
var addCompletion = function (completionSchema) {
|
|
6748
7053
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6749
|
-
swarm.loggerService.log(METHOD_NAME$B, {
|
|
7054
|
+
swarm$1.loggerService.log(METHOD_NAME$B, {
|
|
6750
7055
|
completionSchema: completionSchema,
|
|
6751
7056
|
});
|
|
6752
|
-
swarm.completionValidationService.addCompletion(completionSchema.completionName);
|
|
6753
|
-
swarm.completionSchemaService.register(completionSchema.completionName, completionSchema);
|
|
7057
|
+
swarm$1.completionValidationService.addCompletion(completionSchema.completionName);
|
|
7058
|
+
swarm$1.completionSchemaService.register(completionSchema.completionName, completionSchema);
|
|
6754
7059
|
return completionSchema.completionName;
|
|
6755
7060
|
};
|
|
6756
7061
|
|
|
@@ -6763,11 +7068,11 @@ var METHOD_NAME$A = "function.addSwarm";
|
|
|
6763
7068
|
*/
|
|
6764
7069
|
var addSwarm = function (swarmSchema) {
|
|
6765
7070
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6766
|
-
swarm.loggerService.log(METHOD_NAME$A, {
|
|
7071
|
+
swarm$1.loggerService.log(METHOD_NAME$A, {
|
|
6767
7072
|
swarmSchema: swarmSchema,
|
|
6768
7073
|
});
|
|
6769
|
-
swarm.swarmValidationService.addSwarm(swarmSchema.swarmName, swarmSchema);
|
|
6770
|
-
swarm.swarmSchemaService.register(swarmSchema.swarmName, swarmSchema);
|
|
7074
|
+
swarm$1.swarmValidationService.addSwarm(swarmSchema.swarmName, swarmSchema);
|
|
7075
|
+
swarm$1.swarmSchemaService.register(swarmSchema.swarmName, swarmSchema);
|
|
6771
7076
|
return swarmSchema.swarmName;
|
|
6772
7077
|
};
|
|
6773
7078
|
|
|
@@ -6781,11 +7086,11 @@ var METHOD_NAME$z = "function.addTool";
|
|
|
6781
7086
|
*/
|
|
6782
7087
|
var addTool = function (toolSchema) {
|
|
6783
7088
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6784
|
-
swarm.loggerService.log(METHOD_NAME$z, {
|
|
7089
|
+
swarm$1.loggerService.log(METHOD_NAME$z, {
|
|
6785
7090
|
toolSchema: toolSchema,
|
|
6786
7091
|
});
|
|
6787
|
-
swarm.toolValidationService.addTool(toolSchema.toolName, toolSchema);
|
|
6788
|
-
swarm.toolSchemaService.register(toolSchema.toolName, toolSchema);
|
|
7092
|
+
swarm$1.toolValidationService.addTool(toolSchema.toolName, toolSchema);
|
|
7093
|
+
swarm$1.toolSchemaService.register(toolSchema.toolName, toolSchema);
|
|
6789
7094
|
return toolSchema.toolName;
|
|
6790
7095
|
};
|
|
6791
7096
|
|
|
@@ -6798,12 +7103,12 @@ var METHOD_NAME$y = "function.addState";
|
|
|
6798
7103
|
*/
|
|
6799
7104
|
var addState = function (stateSchema) {
|
|
6800
7105
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6801
|
-
swarm.loggerService.log(METHOD_NAME$y, {
|
|
7106
|
+
swarm$1.loggerService.log(METHOD_NAME$y, {
|
|
6802
7107
|
stateSchema: stateSchema,
|
|
6803
7108
|
});
|
|
6804
|
-
swarm.stateSchemaService.register(stateSchema.stateName, stateSchema);
|
|
7109
|
+
swarm$1.stateSchemaService.register(stateSchema.stateName, stateSchema);
|
|
6805
7110
|
if (stateSchema.shared) {
|
|
6806
|
-
swarm.stateConnectionService
|
|
7111
|
+
swarm$1.stateConnectionService
|
|
6807
7112
|
.getSharedStateRef("shared", stateSchema.stateName)
|
|
6808
7113
|
.waitForInit();
|
|
6809
7114
|
}
|
|
@@ -6819,11 +7124,11 @@ var METHOD_NAME$x = "function.addEmbedding";
|
|
|
6819
7124
|
*/
|
|
6820
7125
|
var addEmbedding = function (embeddingSchema) {
|
|
6821
7126
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6822
|
-
swarm.loggerService.log(METHOD_NAME$x, {
|
|
7127
|
+
swarm$1.loggerService.log(METHOD_NAME$x, {
|
|
6823
7128
|
embeddingSchema: embeddingSchema,
|
|
6824
7129
|
});
|
|
6825
|
-
swarm.embeddingValidationService.addEmbedding(embeddingSchema.embeddingName, embeddingSchema);
|
|
6826
|
-
swarm.embeddingSchemaService.register(embeddingSchema.embeddingName, embeddingSchema);
|
|
7130
|
+
swarm$1.embeddingValidationService.addEmbedding(embeddingSchema.embeddingName, embeddingSchema);
|
|
7131
|
+
swarm$1.embeddingSchemaService.register(embeddingSchema.embeddingName, embeddingSchema);
|
|
6827
7132
|
return embeddingSchema.embeddingName;
|
|
6828
7133
|
};
|
|
6829
7134
|
|
|
@@ -6836,13 +7141,13 @@ var METHOD_NAME$w = "function.addStorage";
|
|
|
6836
7141
|
*/
|
|
6837
7142
|
var addStorage = function (storageSchema) {
|
|
6838
7143
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6839
|
-
swarm.loggerService.log(METHOD_NAME$w, {
|
|
7144
|
+
swarm$1.loggerService.log(METHOD_NAME$w, {
|
|
6840
7145
|
storageSchema: storageSchema,
|
|
6841
7146
|
});
|
|
6842
|
-
swarm.storageValidationService.addStorage(storageSchema.storageName, storageSchema);
|
|
6843
|
-
swarm.storageSchemaService.register(storageSchema.storageName, storageSchema);
|
|
7147
|
+
swarm$1.storageValidationService.addStorage(storageSchema.storageName, storageSchema);
|
|
7148
|
+
swarm$1.storageSchemaService.register(storageSchema.storageName, storageSchema);
|
|
6844
7149
|
if (storageSchema.shared) {
|
|
6845
|
-
swarm.storageConnectionService
|
|
7150
|
+
swarm$1.storageConnectionService
|
|
6846
7151
|
.getSharedStorage("shared", storageSchema.storageName)
|
|
6847
7152
|
.waitForInit();
|
|
6848
7153
|
}
|
|
@@ -6864,28 +7169,28 @@ var commitUserMessage = function (content, clientId, agentName) { return __await
|
|
|
6864
7169
|
switch (_a.label) {
|
|
6865
7170
|
case 0:
|
|
6866
7171
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6867
|
-
swarm.loggerService.log(METHOD_NAME$v, {
|
|
7172
|
+
swarm$1.loggerService.log(METHOD_NAME$v, {
|
|
6868
7173
|
content: content,
|
|
6869
7174
|
clientId: clientId,
|
|
6870
7175
|
agentName: agentName,
|
|
6871
7176
|
});
|
|
6872
|
-
swarm.agentValidationService.validate(agentName, METHOD_NAME$v);
|
|
6873
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME$v);
|
|
6874
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
6875
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$v);
|
|
6876
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$v, clientId, swarmName)];
|
|
7177
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$v);
|
|
7178
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$v);
|
|
7179
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
7180
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$v);
|
|
7181
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$v, clientId, swarmName)];
|
|
6877
7182
|
case 1:
|
|
6878
7183
|
currentAgentName = _a.sent();
|
|
6879
7184
|
if (currentAgentName !== agentName) {
|
|
6880
7185
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6881
|
-
swarm.loggerService.log('function "commitUserMessage" skipped due to the agent change', {
|
|
7186
|
+
swarm$1.loggerService.log('function "commitUserMessage" skipped due to the agent change', {
|
|
6882
7187
|
currentAgentName: currentAgentName,
|
|
6883
7188
|
agentName: agentName,
|
|
6884
7189
|
clientId: clientId,
|
|
6885
7190
|
});
|
|
6886
7191
|
return [2 /*return*/];
|
|
6887
7192
|
}
|
|
6888
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, METHOD_NAME$v, clientId, swarmName)];
|
|
7193
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$v, clientId, swarmName)];
|
|
6889
7194
|
case 2:
|
|
6890
7195
|
_a.sent();
|
|
6891
7196
|
return [2 /*return*/];
|
|
@@ -6907,13 +7212,13 @@ var getAgentName = function (clientId) { return __awaiter(void 0, void 0, void 0
|
|
|
6907
7212
|
switch (_a.label) {
|
|
6908
7213
|
case 0:
|
|
6909
7214
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6910
|
-
swarm.loggerService.log(METHOD_NAME$u, {
|
|
7215
|
+
swarm$1.loggerService.log(METHOD_NAME$u, {
|
|
6911
7216
|
clientId: clientId,
|
|
6912
7217
|
});
|
|
6913
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME$u);
|
|
6914
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
6915
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$u);
|
|
6916
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$u, clientId, swarmName)];
|
|
7218
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$u);
|
|
7219
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
7220
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$u);
|
|
7221
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$u, clientId, swarmName)];
|
|
6917
7222
|
case 1: return [2 /*return*/, _a.sent()];
|
|
6918
7223
|
}
|
|
6919
7224
|
});
|
|
@@ -6931,25 +7236,25 @@ var METHOD_NAME$t = "function.makeConnection";
|
|
|
6931
7236
|
*/
|
|
6932
7237
|
var makeConnection = function (connector, clientId, swarmName) {
|
|
6933
7238
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
6934
|
-
swarm.loggerService.log(METHOD_NAME$t, {
|
|
7239
|
+
swarm$1.loggerService.log(METHOD_NAME$t, {
|
|
6935
7240
|
clientId: clientId,
|
|
6936
7241
|
swarmName: swarmName,
|
|
6937
7242
|
});
|
|
6938
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$t);
|
|
6939
|
-
swarm.sessionValidationService.addSession(clientId, swarmName, "makeConnection");
|
|
6940
|
-
var send = swarm.sessionPublicService.connect(connector, METHOD_NAME$t, clientId, swarmName);
|
|
7243
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$t);
|
|
7244
|
+
swarm$1.sessionValidationService.addSession(clientId, swarmName, "makeConnection");
|
|
7245
|
+
var send = swarm$1.sessionPublicService.connect(connector, METHOD_NAME$t, clientId, swarmName);
|
|
6941
7246
|
return functoolsKit.queued(function (outgoing) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6942
7247
|
var _a;
|
|
6943
7248
|
var _b;
|
|
6944
7249
|
return __generator(this, function (_c) {
|
|
6945
7250
|
switch (_c.label) {
|
|
6946
7251
|
case 0:
|
|
6947
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME$t);
|
|
7252
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$t);
|
|
6948
7253
|
_a = send;
|
|
6949
7254
|
_b = {
|
|
6950
7255
|
data: outgoing
|
|
6951
7256
|
};
|
|
6952
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$t, clientId, swarmName)];
|
|
7257
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$t, clientId, swarmName)];
|
|
6953
7258
|
case 1: return [4 /*yield*/, _a.apply(void 0, [(_b.agentName = _c.sent(),
|
|
6954
7259
|
_b.clientId = clientId,
|
|
6955
7260
|
_b)])];
|
|
@@ -6980,7 +7285,7 @@ makeConnection.scheduled = function (connector, clientId, swarmName, _a) {
|
|
|
6980
7285
|
return __generator(this, function (_a) {
|
|
6981
7286
|
switch (_a.label) {
|
|
6982
7287
|
case 0:
|
|
6983
|
-
if (!swarm.sessionValidationService.hasSession(clientId)) {
|
|
7288
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
6984
7289
|
return [2 /*return*/];
|
|
6985
7290
|
}
|
|
6986
7291
|
return [4 /*yield*/, send(content)];
|
|
@@ -7000,7 +7305,7 @@ makeConnection.scheduled = function (connector, clientId, swarmName, _a) {
|
|
|
7000
7305
|
return __generator(this, function (_f) {
|
|
7001
7306
|
switch (_f.label) {
|
|
7002
7307
|
case 0:
|
|
7003
|
-
if (!swarm.sessionValidationService.hasSession(clientId)) {
|
|
7308
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
7004
7309
|
return [2 /*return*/];
|
|
7005
7310
|
}
|
|
7006
7311
|
_c = commitUserMessage;
|
|
@@ -7058,15 +7363,15 @@ var createChangeAgent = functoolsKit.ttl(function (clientId) {
|
|
|
7058
7363
|
return __generator(this, function (_d) {
|
|
7059
7364
|
switch (_d.label) {
|
|
7060
7365
|
case 0:
|
|
7061
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME$s);
|
|
7062
|
-
swarm.agentValidationService.validate(agentName, METHOD_NAME$s);
|
|
7063
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7064
|
-
return [4 /*yield*/, Promise.all(swarm.swarmValidationService
|
|
7366
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$s);
|
|
7367
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$s);
|
|
7368
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
7369
|
+
return [4 /*yield*/, Promise.all(swarm$1.swarmValidationService
|
|
7065
7370
|
.getAgentList(swarmName)
|
|
7066
7371
|
.map(function (agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7067
7372
|
return __generator(this, function (_a) {
|
|
7068
7373
|
switch (_a.label) {
|
|
7069
|
-
case 0: return [4 /*yield*/, swarm.agentPublicService.commitAgentChange(methodName, clientId, agentName)];
|
|
7374
|
+
case 0: return [4 /*yield*/, swarm$1.agentPublicService.commitAgentChange(methodName, clientId, agentName)];
|
|
7070
7375
|
case 1:
|
|
7071
7376
|
_a.sent();
|
|
7072
7377
|
return [2 /*return*/];
|
|
@@ -7075,22 +7380,22 @@ var createChangeAgent = functoolsKit.ttl(function (clientId) {
|
|
|
7075
7380
|
}); }))];
|
|
7076
7381
|
case 1:
|
|
7077
7382
|
_d.sent();
|
|
7078
|
-
return [4 /*yield*/, swarm.agentPublicService.dispose(methodName, clientId, agentName)];
|
|
7383
|
+
return [4 /*yield*/, swarm$1.agentPublicService.dispose(methodName, clientId, agentName)];
|
|
7079
7384
|
case 2:
|
|
7080
7385
|
_d.sent();
|
|
7081
|
-
return [4 /*yield*/, swarm.historyPublicService.dispose(methodName, clientId, agentName)];
|
|
7386
|
+
return [4 /*yield*/, swarm$1.historyPublicService.dispose(methodName, clientId, agentName)];
|
|
7082
7387
|
case 3:
|
|
7083
7388
|
_d.sent();
|
|
7084
|
-
_b = (_a = swarm.swarmPublicService).setAgentRef;
|
|
7389
|
+
_b = (_a = swarm$1.swarmPublicService).setAgentRef;
|
|
7085
7390
|
_c = [methodName,
|
|
7086
7391
|
clientId,
|
|
7087
7392
|
swarmName,
|
|
7088
7393
|
agentName];
|
|
7089
|
-
return [4 /*yield*/, swarm.agentPublicService.createAgentRef(methodName, clientId, agentName)];
|
|
7394
|
+
return [4 /*yield*/, swarm$1.agentPublicService.createAgentRef(methodName, clientId, agentName)];
|
|
7090
7395
|
case 4: return [4 /*yield*/, _b.apply(_a, _c.concat([_d.sent()]))];
|
|
7091
7396
|
case 5:
|
|
7092
7397
|
_d.sent();
|
|
7093
|
-
return [4 /*yield*/, swarm.swarmPublicService.setAgentName(agentName, methodName, clientId, swarmName)];
|
|
7398
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.setAgentName(agentName, methodName, clientId, swarmName)];
|
|
7094
7399
|
case 6:
|
|
7095
7400
|
_d.sent();
|
|
7096
7401
|
return [2 /*return*/];
|
|
@@ -7129,7 +7434,7 @@ var changeAgent = function (agentName, clientId) { return __awaiter(void 0, void
|
|
|
7129
7434
|
switch (_a.label) {
|
|
7130
7435
|
case 0:
|
|
7131
7436
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7132
|
-
swarm.loggerService.log(METHOD_NAME$s, {
|
|
7437
|
+
swarm$1.loggerService.log(METHOD_NAME$s, {
|
|
7133
7438
|
agentName: agentName,
|
|
7134
7439
|
clientId: clientId,
|
|
7135
7440
|
});
|
|
@@ -7162,28 +7467,26 @@ var disposeConnection = function (clientId_1, swarmName_1) {
|
|
|
7162
7467
|
switch (_a.label) {
|
|
7163
7468
|
case 0:
|
|
7164
7469
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7165
|
-
swarm.loggerService.log(METHOD_NAME$r, {
|
|
7470
|
+
swarm$1.loggerService.log(METHOD_NAME$r, {
|
|
7166
7471
|
clientId: clientId,
|
|
7167
7472
|
swarmName: swarmName,
|
|
7168
7473
|
});
|
|
7169
|
-
swarm.swarmValidationService.validate(swarmName, methodName);
|
|
7170
|
-
swarm.
|
|
7171
|
-
swarm.busService.dispose(clientId);
|
|
7172
|
-
return [4 /*yield*/, swarm.sessionPublicService.dispose(methodName, clientId, swarmName)];
|
|
7474
|
+
swarm$1.swarmValidationService.validate(swarmName, methodName);
|
|
7475
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.dispose(methodName, clientId, swarmName)];
|
|
7173
7476
|
case 1:
|
|
7174
7477
|
_a.sent();
|
|
7175
|
-
return [4 /*yield*/, swarm.swarmPublicService.dispose(methodName, clientId, swarmName)];
|
|
7478
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.dispose(methodName, clientId, swarmName)];
|
|
7176
7479
|
case 2:
|
|
7177
7480
|
_a.sent();
|
|
7178
|
-
return [4 /*yield*/, Promise.all(swarm.swarmValidationService
|
|
7481
|
+
return [4 /*yield*/, Promise.all(swarm$1.swarmValidationService
|
|
7179
7482
|
.getAgentList(swarmName)
|
|
7180
7483
|
.map(function (agentName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7181
7484
|
return __generator(this, function (_a) {
|
|
7182
7485
|
switch (_a.label) {
|
|
7183
|
-
case 0: return [4 /*yield*/, swarm.agentPublicService.dispose(methodName, clientId, agentName)];
|
|
7486
|
+
case 0: return [4 /*yield*/, swarm$1.agentPublicService.dispose(methodName, clientId, agentName)];
|
|
7184
7487
|
case 1:
|
|
7185
7488
|
_a.sent();
|
|
7186
|
-
return [4 /*yield*/, swarm.historyPublicService.dispose(methodName, clientId, agentName)];
|
|
7489
|
+
return [4 /*yield*/, swarm$1.historyPublicService.dispose(methodName, clientId, agentName)];
|
|
7187
7490
|
case 2:
|
|
7188
7491
|
_a.sent();
|
|
7189
7492
|
return [2 /*return*/];
|
|
@@ -7192,16 +7495,16 @@ var disposeConnection = function (clientId_1, swarmName_1) {
|
|
|
7192
7495
|
}); }))];
|
|
7193
7496
|
case 3:
|
|
7194
7497
|
_a.sent();
|
|
7195
|
-
return [4 /*yield*/, Promise.all(swarm.swarmValidationService
|
|
7498
|
+
return [4 /*yield*/, Promise.all(swarm$1.swarmValidationService
|
|
7196
7499
|
.getAgentList(swarmName)
|
|
7197
7500
|
.flatMap(function (agentName) {
|
|
7198
|
-
return swarm.agentValidationService.getStorageList(agentName);
|
|
7501
|
+
return swarm$1.agentValidationService.getStorageList(agentName);
|
|
7199
7502
|
})
|
|
7200
7503
|
.filter(function (storageName) { return !!storageName; })
|
|
7201
7504
|
.map(function (storageName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7202
7505
|
return __generator(this, function (_a) {
|
|
7203
7506
|
switch (_a.label) {
|
|
7204
|
-
case 0: return [4 /*yield*/, swarm.storagePublicService.dispose(methodName, clientId, storageName)];
|
|
7507
|
+
case 0: return [4 /*yield*/, swarm$1.storagePublicService.dispose(methodName, clientId, storageName)];
|
|
7205
7508
|
case 1:
|
|
7206
7509
|
_a.sent();
|
|
7207
7510
|
return [2 /*return*/];
|
|
@@ -7210,16 +7513,16 @@ var disposeConnection = function (clientId_1, swarmName_1) {
|
|
|
7210
7513
|
}); }))];
|
|
7211
7514
|
case 4:
|
|
7212
7515
|
_a.sent();
|
|
7213
|
-
return [4 /*yield*/, Promise.all(swarm.swarmValidationService
|
|
7516
|
+
return [4 /*yield*/, Promise.all(swarm$1.swarmValidationService
|
|
7214
7517
|
.getAgentList(swarmName)
|
|
7215
7518
|
.flatMap(function (agentName) {
|
|
7216
|
-
return swarm.agentValidationService.getStateList(agentName);
|
|
7519
|
+
return swarm$1.agentValidationService.getStateList(agentName);
|
|
7217
7520
|
})
|
|
7218
7521
|
.filter(function (stateName) { return !!stateName; })
|
|
7219
7522
|
.map(function (stateName) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7220
7523
|
return __generator(this, function (_a) {
|
|
7221
7524
|
switch (_a.label) {
|
|
7222
|
-
case 0: return [4 /*yield*/, swarm.statePublicService.dispose(methodName, clientId, stateName)];
|
|
7525
|
+
case 0: return [4 /*yield*/, swarm$1.statePublicService.dispose(methodName, clientId, stateName)];
|
|
7223
7526
|
case 1:
|
|
7224
7527
|
_a.sent();
|
|
7225
7528
|
return [2 /*return*/];
|
|
@@ -7231,6 +7534,11 @@ var disposeConnection = function (clientId_1, swarmName_1) {
|
|
|
7231
7534
|
return [4 /*yield*/, HistoryAdapter.dispose(clientId, null)];
|
|
7232
7535
|
case 6:
|
|
7233
7536
|
_a.sent();
|
|
7537
|
+
return [4 /*yield*/, LoggerAdapter.dispose(clientId)];
|
|
7538
|
+
case 7:
|
|
7539
|
+
_a.sent();
|
|
7540
|
+
swarm$1.sessionValidationService.removeSession(clientId);
|
|
7541
|
+
swarm$1.busService.dispose(clientId);
|
|
7234
7542
|
return [2 /*return*/];
|
|
7235
7543
|
}
|
|
7236
7544
|
});
|
|
@@ -7252,9 +7560,9 @@ var createComplete = functoolsKit.ttl(function (clientId, swarmName) {
|
|
|
7252
7560
|
return __generator(this, function (_a) {
|
|
7253
7561
|
switch (_a.label) {
|
|
7254
7562
|
case 0:
|
|
7255
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME);
|
|
7256
|
-
swarm.sessionValidationService.addSession(clientId, swarmName, "complete");
|
|
7257
|
-
return [4 /*yield*/, swarm.sessionPublicService.execute(content, "user", METHOD_NAME, clientId, swarmName)];
|
|
7563
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME);
|
|
7564
|
+
swarm$1.sessionValidationService.addSession(clientId, swarmName, "complete");
|
|
7565
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.execute(content, "user", METHOD_NAME, clientId, swarmName)];
|
|
7258
7566
|
case 1:
|
|
7259
7567
|
result = _a.sent();
|
|
7260
7568
|
return [4 /*yield*/, disposeConnection(clientId, swarmName, METHOD_NAME)];
|
|
@@ -7297,7 +7605,7 @@ var complete = function (content, clientId, swarmName) { return __awaiter(void 0
|
|
|
7297
7605
|
case 0:
|
|
7298
7606
|
executionId = functoolsKit.randomString();
|
|
7299
7607
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7300
|
-
swarm.loggerService.log(METHOD_NAME$q, {
|
|
7608
|
+
swarm$1.loggerService.log(METHOD_NAME$q, {
|
|
7301
7609
|
content: content,
|
|
7302
7610
|
clientId: clientId,
|
|
7303
7611
|
executionId: executionId,
|
|
@@ -7336,13 +7644,13 @@ var METHOD_NAME$p = "function.session";
|
|
|
7336
7644
|
var session = function (clientId, swarmName) {
|
|
7337
7645
|
var executionId = functoolsKit.randomString();
|
|
7338
7646
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7339
|
-
swarm.loggerService.log(METHOD_NAME$p, {
|
|
7647
|
+
swarm$1.loggerService.log(METHOD_NAME$p, {
|
|
7340
7648
|
clientId: clientId,
|
|
7341
7649
|
swarmName: swarmName,
|
|
7342
7650
|
executionId: executionId,
|
|
7343
7651
|
});
|
|
7344
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$p);
|
|
7345
|
-
swarm.sessionValidationService.addSession(clientId, swarmName, "session");
|
|
7652
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$p);
|
|
7653
|
+
swarm$1.sessionValidationService.addSession(clientId, swarmName, "session");
|
|
7346
7654
|
return {
|
|
7347
7655
|
/**
|
|
7348
7656
|
* Completes the session with the given content.
|
|
@@ -7352,11 +7660,11 @@ var session = function (clientId, swarmName) {
|
|
|
7352
7660
|
*/
|
|
7353
7661
|
complete: functoolsKit.queued(function (content) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7354
7662
|
return __generator(this, function (_a) {
|
|
7355
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME$p);
|
|
7663
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$p);
|
|
7356
7664
|
return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
7357
7665
|
return __generator(this, function (_a) {
|
|
7358
7666
|
switch (_a.label) {
|
|
7359
|
-
case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "user", METHOD_NAME$p, clientId, swarmName)];
|
|
7667
|
+
case 0: return [4 /*yield*/, swarm$1.sessionPublicService.execute(content, "user", METHOD_NAME$p, clientId, swarmName)];
|
|
7360
7668
|
case 1: return [2 /*return*/, _a.sent()];
|
|
7361
7669
|
}
|
|
7362
7670
|
});
|
|
@@ -7492,16 +7800,16 @@ var getRawHistory = function (clientId_1) {
|
|
|
7492
7800
|
switch (_a.label) {
|
|
7493
7801
|
case 0:
|
|
7494
7802
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7495
|
-
swarm.loggerService.log(METHOD_NAME$o, {
|
|
7803
|
+
swarm$1.loggerService.log(METHOD_NAME$o, {
|
|
7496
7804
|
clientId: clientId,
|
|
7497
7805
|
});
|
|
7498
|
-
swarm.sessionValidationService.validate(clientId, methodName);
|
|
7499
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7500
|
-
swarm.swarmValidationService.validate(swarmName, methodName);
|
|
7501
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
7806
|
+
swarm$1.sessionValidationService.validate(clientId, methodName);
|
|
7807
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
7808
|
+
swarm$1.swarmValidationService.validate(swarmName, methodName);
|
|
7809
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(methodName, clientId, swarmName)];
|
|
7502
7810
|
case 1:
|
|
7503
7811
|
agentName = _a.sent();
|
|
7504
|
-
return [4 /*yield*/, swarm.historyPublicService.toArrayForRaw(methodName, clientId, agentName)];
|
|
7812
|
+
return [4 /*yield*/, swarm$1.historyPublicService.toArrayForRaw(methodName, clientId, agentName)];
|
|
7505
7813
|
case 2:
|
|
7506
7814
|
history = _a.sent();
|
|
7507
7815
|
return [2 /*return*/, __spreadArray([], __read(history), false)];
|
|
@@ -7524,13 +7832,13 @@ var getAgentHistory = function (clientId, agentName) { return __awaiter(void 0,
|
|
|
7524
7832
|
switch (_a.label) {
|
|
7525
7833
|
case 0:
|
|
7526
7834
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7527
|
-
swarm.loggerService.log(METHOD_NAME$n, {
|
|
7835
|
+
swarm$1.loggerService.log(METHOD_NAME$n, {
|
|
7528
7836
|
clientId: clientId,
|
|
7529
7837
|
agentName: agentName,
|
|
7530
7838
|
});
|
|
7531
|
-
swarm.agentValidationService.validate(agentName, METHOD_NAME$n);
|
|
7532
|
-
prompt = swarm.agentSchemaService.get(agentName).prompt;
|
|
7533
|
-
return [4 /*yield*/, swarm.historyPublicService.toArrayForAgent(prompt, METHOD_NAME$n, clientId, agentName)];
|
|
7839
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$n);
|
|
7840
|
+
prompt = swarm$1.agentSchemaService.get(agentName).prompt;
|
|
7841
|
+
return [4 /*yield*/, swarm$1.historyPublicService.toArrayForAgent(prompt, METHOD_NAME$n, clientId, agentName)];
|
|
7534
7842
|
case 1:
|
|
7535
7843
|
history = _a.sent();
|
|
7536
7844
|
return [2 /*return*/, __spreadArray([], __read(history), false)];
|
|
@@ -7548,12 +7856,12 @@ var getSessionMode = function (clientId) { return __awaiter(void 0, void 0, void
|
|
|
7548
7856
|
var swarmName;
|
|
7549
7857
|
return __generator(this, function (_a) {
|
|
7550
7858
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7551
|
-
swarm.loggerService.log(METHOD_NAME$m, {
|
|
7859
|
+
swarm$1.loggerService.log(METHOD_NAME$m, {
|
|
7552
7860
|
clientId: clientId,
|
|
7553
7861
|
});
|
|
7554
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7555
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$m);
|
|
7556
|
-
return [2 /*return*/, swarm.sessionValidationService.getSessionMode(clientId)];
|
|
7862
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
7863
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$m);
|
|
7864
|
+
return [2 /*return*/, swarm$1.sessionValidationService.getSessionMode(clientId)];
|
|
7557
7865
|
});
|
|
7558
7866
|
}); };
|
|
7559
7867
|
|
|
@@ -7572,22 +7880,22 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
|
|
|
7572
7880
|
switch (_a.label) {
|
|
7573
7881
|
case 0:
|
|
7574
7882
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7575
|
-
swarm.loggerService.log(METHOD_NAME$l, {
|
|
7883
|
+
swarm$1.loggerService.log(METHOD_NAME$l, {
|
|
7576
7884
|
toolId: toolId,
|
|
7577
7885
|
content: content,
|
|
7578
7886
|
clientId: clientId,
|
|
7579
7887
|
agentName: agentName,
|
|
7580
7888
|
});
|
|
7581
|
-
swarm.agentValidationService.validate(agentName, METHOD_NAME$l);
|
|
7582
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME$l);
|
|
7583
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7584
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$l);
|
|
7585
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$l, clientId, swarmName)];
|
|
7889
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$l);
|
|
7890
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$l);
|
|
7891
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
7892
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$l);
|
|
7893
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$l, clientId, swarmName)];
|
|
7586
7894
|
case 1:
|
|
7587
7895
|
currentAgentName = _a.sent();
|
|
7588
7896
|
if (currentAgentName !== agentName) {
|
|
7589
7897
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7590
|
-
swarm.loggerService.log('function "commitToolOutput" skipped due to the agent change', {
|
|
7898
|
+
swarm$1.loggerService.log('function "commitToolOutput" skipped due to the agent change', {
|
|
7591
7899
|
toolId: toolId,
|
|
7592
7900
|
currentAgentName: currentAgentName,
|
|
7593
7901
|
agentName: agentName,
|
|
@@ -7595,7 +7903,7 @@ var commitToolOutput = function (toolId, content, clientId, agentName) { return
|
|
|
7595
7903
|
});
|
|
7596
7904
|
return [2 /*return*/];
|
|
7597
7905
|
}
|
|
7598
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$l, clientId, swarmName)];
|
|
7906
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$l, clientId, swarmName)];
|
|
7599
7907
|
case 2:
|
|
7600
7908
|
_a.sent();
|
|
7601
7909
|
return [2 /*return*/];
|
|
@@ -7618,28 +7926,28 @@ var commitSystemMessage = function (content, clientId, agentName) { return __awa
|
|
|
7618
7926
|
switch (_a.label) {
|
|
7619
7927
|
case 0:
|
|
7620
7928
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7621
|
-
swarm.loggerService.log(METHOD_NAME$k, {
|
|
7929
|
+
swarm$1.loggerService.log(METHOD_NAME$k, {
|
|
7622
7930
|
content: content,
|
|
7623
7931
|
clientId: clientId,
|
|
7624
7932
|
agentName: agentName,
|
|
7625
7933
|
});
|
|
7626
|
-
swarm.agentValidationService.validate(agentName, METHOD_NAME$k);
|
|
7627
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME$k);
|
|
7628
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7629
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$k);
|
|
7630
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$k, clientId, swarmName)];
|
|
7934
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$k);
|
|
7935
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$k);
|
|
7936
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
7937
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$k);
|
|
7938
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$k, clientId, swarmName)];
|
|
7631
7939
|
case 1:
|
|
7632
7940
|
currentAgentName = _a.sent();
|
|
7633
7941
|
if (currentAgentName !== agentName) {
|
|
7634
7942
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7635
|
-
swarm.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
|
|
7943
|
+
swarm$1.loggerService.log('function "commitSystemMessage" skipped due to the agent change', {
|
|
7636
7944
|
currentAgentName: currentAgentName,
|
|
7637
7945
|
agentName: agentName,
|
|
7638
7946
|
clientId: clientId,
|
|
7639
7947
|
});
|
|
7640
7948
|
return [2 /*return*/];
|
|
7641
7949
|
}
|
|
7642
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, METHOD_NAME$k, clientId, swarmName)];
|
|
7950
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$k, clientId, swarmName)];
|
|
7643
7951
|
case 2:
|
|
7644
7952
|
_a.sent();
|
|
7645
7953
|
return [2 /*return*/];
|
|
@@ -7661,27 +7969,27 @@ var commitFlush = function (clientId, agentName) { return __awaiter(void 0, void
|
|
|
7661
7969
|
switch (_a.label) {
|
|
7662
7970
|
case 0:
|
|
7663
7971
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7664
|
-
swarm.loggerService.log(METHOD_NAME$j, {
|
|
7972
|
+
swarm$1.loggerService.log(METHOD_NAME$j, {
|
|
7665
7973
|
clientId: clientId,
|
|
7666
7974
|
agentName: agentName,
|
|
7667
7975
|
});
|
|
7668
|
-
swarm.agentValidationService.validate(agentName, METHOD_NAME$j);
|
|
7669
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME$j);
|
|
7670
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7671
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$j);
|
|
7672
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$j, clientId, swarmName)];
|
|
7976
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$j);
|
|
7977
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$j);
|
|
7978
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
7979
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$j);
|
|
7980
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$j, clientId, swarmName)];
|
|
7673
7981
|
case 1:
|
|
7674
7982
|
currentAgentName = _a.sent();
|
|
7675
7983
|
if (currentAgentName !== agentName) {
|
|
7676
7984
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7677
|
-
swarm.loggerService.log('function "commitFlush" skipped due to the agent change', {
|
|
7985
|
+
swarm$1.loggerService.log('function "commitFlush" skipped due to the agent change', {
|
|
7678
7986
|
currentAgentName: currentAgentName,
|
|
7679
7987
|
agentName: agentName,
|
|
7680
7988
|
clientId: clientId,
|
|
7681
7989
|
});
|
|
7682
7990
|
return [2 /*return*/];
|
|
7683
7991
|
}
|
|
7684
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitFlush(METHOD_NAME$j, clientId, swarmName)];
|
|
7992
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitFlush(METHOD_NAME$j, clientId, swarmName)];
|
|
7685
7993
|
case 2:
|
|
7686
7994
|
_a.sent();
|
|
7687
7995
|
return [2 /*return*/];
|
|
@@ -7706,22 +8014,22 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
|
|
|
7706
8014
|
case 0:
|
|
7707
8015
|
executionId = functoolsKit.randomString();
|
|
7708
8016
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7709
|
-
swarm.loggerService.log(METHOD_NAME$i, {
|
|
8017
|
+
swarm$1.loggerService.log(METHOD_NAME$i, {
|
|
7710
8018
|
content: content,
|
|
7711
8019
|
clientId: clientId,
|
|
7712
8020
|
agentName: agentName,
|
|
7713
8021
|
executionId: executionId,
|
|
7714
8022
|
});
|
|
7715
|
-
swarm.agentValidationService.validate(agentName, METHOD_NAME$i);
|
|
7716
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME$i);
|
|
7717
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7718
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$i);
|
|
7719
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$i, clientId, swarmName)];
|
|
8023
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$i);
|
|
8024
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$i);
|
|
8025
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
8026
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$i);
|
|
8027
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$i, clientId, swarmName)];
|
|
7720
8028
|
case 1:
|
|
7721
8029
|
currentAgentName = _a.sent();
|
|
7722
8030
|
if (currentAgentName !== agentName) {
|
|
7723
8031
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7724
|
-
swarm.loggerService.log('function "execute" skipped due to the agent change', {
|
|
8032
|
+
swarm$1.loggerService.log('function "execute" skipped due to the agent change', {
|
|
7725
8033
|
currentAgentName: currentAgentName,
|
|
7726
8034
|
agentName: agentName,
|
|
7727
8035
|
clientId: clientId,
|
|
@@ -7731,7 +8039,7 @@ var execute = function (content, clientId, agentName) { return __awaiter(void 0,
|
|
|
7731
8039
|
return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
7732
8040
|
return __generator(this, function (_a) {
|
|
7733
8041
|
switch (_a.label) {
|
|
7734
|
-
case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "tool", METHOD_NAME$i, clientId, swarmName)];
|
|
8042
|
+
case 0: return [4 /*yield*/, swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$i, clientId, swarmName)];
|
|
7735
8043
|
case 1: return [2 /*return*/, _a.sent()];
|
|
7736
8044
|
}
|
|
7737
8045
|
});
|
|
@@ -7760,31 +8068,31 @@ var emit = function (content, clientId, agentName) { return __awaiter(void 0, vo
|
|
|
7760
8068
|
switch (_a.label) {
|
|
7761
8069
|
case 0:
|
|
7762
8070
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7763
|
-
swarm.loggerService.log(METHOD_NAME$h, {
|
|
8071
|
+
swarm$1.loggerService.log(METHOD_NAME$h, {
|
|
7764
8072
|
content: content,
|
|
7765
8073
|
clientId: clientId,
|
|
7766
8074
|
agentName: agentName,
|
|
7767
8075
|
});
|
|
7768
|
-
if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
8076
|
+
if (swarm$1.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
7769
8077
|
throw new Error("agent-swarm-kit emit session is not makeConnection clientId=".concat(clientId));
|
|
7770
8078
|
}
|
|
7771
|
-
swarm.agentValidationService.validate(agentName, METHOD_NAME$h);
|
|
7772
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME$h);
|
|
7773
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7774
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$h);
|
|
7775
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$h, clientId, swarmName)];
|
|
8079
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$h);
|
|
8080
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$h);
|
|
8081
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
8082
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$h);
|
|
8083
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$h, clientId, swarmName)];
|
|
7776
8084
|
case 1:
|
|
7777
8085
|
currentAgentName = _a.sent();
|
|
7778
8086
|
if (currentAgentName !== agentName) {
|
|
7779
8087
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7780
|
-
swarm.loggerService.log('function "emit" skipped due to the agent change', {
|
|
8088
|
+
swarm$1.loggerService.log('function "emit" skipped due to the agent change', {
|
|
7781
8089
|
currentAgentName: currentAgentName,
|
|
7782
8090
|
agentName: agentName,
|
|
7783
8091
|
clientId: clientId,
|
|
7784
8092
|
});
|
|
7785
8093
|
return [2 /*return*/];
|
|
7786
8094
|
}
|
|
7787
|
-
return [4 /*yield*/, swarm.sessionPublicService.emit(content, METHOD_NAME$h, clientId, swarmName)];
|
|
8095
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.emit(content, METHOD_NAME$h, clientId, swarmName)];
|
|
7788
8096
|
case 2: return [2 /*return*/, _a.sent()];
|
|
7789
8097
|
}
|
|
7790
8098
|
});
|
|
@@ -7804,15 +8112,15 @@ var commitToolOutputForce = function (toolId, content, clientId) { return __awai
|
|
|
7804
8112
|
switch (_a.label) {
|
|
7805
8113
|
case 0:
|
|
7806
8114
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7807
|
-
swarm.loggerService.log(METHOD_NAME$g, {
|
|
8115
|
+
swarm$1.loggerService.log(METHOD_NAME$g, {
|
|
7808
8116
|
toolId: toolId,
|
|
7809
8117
|
content: content,
|
|
7810
8118
|
clientId: clientId,
|
|
7811
8119
|
});
|
|
7812
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME$g);
|
|
7813
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7814
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$g);
|
|
7815
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$g, clientId, swarmName)];
|
|
8120
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$g);
|
|
8121
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
8122
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$g);
|
|
8123
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitToolOutput(toolId, content, METHOD_NAME$g, clientId, swarmName)];
|
|
7816
8124
|
case 1:
|
|
7817
8125
|
_a.sent();
|
|
7818
8126
|
return [2 /*return*/];
|
|
@@ -7834,14 +8142,14 @@ var commitSystemMessageForce = function (content, clientId) { return __awaiter(v
|
|
|
7834
8142
|
switch (_a.label) {
|
|
7835
8143
|
case 0:
|
|
7836
8144
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7837
|
-
swarm.loggerService.log(METHOD_NAME$f, {
|
|
8145
|
+
swarm$1.loggerService.log(METHOD_NAME$f, {
|
|
7838
8146
|
content: content,
|
|
7839
8147
|
clientId: clientId,
|
|
7840
8148
|
});
|
|
7841
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME$f);
|
|
7842
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7843
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$f);
|
|
7844
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitSystemMessage(content, METHOD_NAME$f, clientId, swarmName)];
|
|
8149
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$f);
|
|
8150
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
8151
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$f);
|
|
8152
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitSystemMessage(content, METHOD_NAME$f, clientId, swarmName)];
|
|
7845
8153
|
case 1:
|
|
7846
8154
|
_a.sent();
|
|
7847
8155
|
return [2 /*return*/];
|
|
@@ -7862,14 +8170,14 @@ var commitFlushForce = function (clientId) { return __awaiter(void 0, void 0, vo
|
|
|
7862
8170
|
switch (_a.label) {
|
|
7863
8171
|
case 0:
|
|
7864
8172
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7865
|
-
swarm.loggerService.log(METHOD_NAME$e, {
|
|
8173
|
+
swarm$1.loggerService.log(METHOD_NAME$e, {
|
|
7866
8174
|
clientId: clientId,
|
|
7867
8175
|
METHOD_NAME: METHOD_NAME$e,
|
|
7868
8176
|
});
|
|
7869
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME$e);
|
|
7870
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7871
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$e);
|
|
7872
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitFlush(METHOD_NAME$e, clientId, swarmName)];
|
|
8177
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$e);
|
|
8178
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
8179
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$e);
|
|
8180
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitFlush(METHOD_NAME$e, clientId, swarmName)];
|
|
7873
8181
|
case 1:
|
|
7874
8182
|
_a.sent();
|
|
7875
8183
|
return [2 /*return*/];
|
|
@@ -7891,14 +8199,14 @@ var commitUserMessageForce = function (content, clientId) { return __awaiter(voi
|
|
|
7891
8199
|
switch (_a.label) {
|
|
7892
8200
|
case 0:
|
|
7893
8201
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7894
|
-
swarm.loggerService.log(METHOD_NAME$d, {
|
|
8202
|
+
swarm$1.loggerService.log(METHOD_NAME$d, {
|
|
7895
8203
|
content: content,
|
|
7896
8204
|
clientId: clientId,
|
|
7897
8205
|
});
|
|
7898
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME$d);
|
|
7899
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7900
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$d);
|
|
7901
|
-
return [4 /*yield*/, swarm.sessionPublicService.commitUserMessage(content, METHOD_NAME$d, clientId, swarmName)];
|
|
8206
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$d);
|
|
8207
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
8208
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$d);
|
|
8209
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.commitUserMessage(content, METHOD_NAME$d, clientId, swarmName)];
|
|
7902
8210
|
case 1:
|
|
7903
8211
|
_a.sent();
|
|
7904
8212
|
return [2 /*return*/];
|
|
@@ -7923,17 +8231,17 @@ var emitForce = function (content, clientId) { return __awaiter(void 0, void 0,
|
|
|
7923
8231
|
switch (_a.label) {
|
|
7924
8232
|
case 0:
|
|
7925
8233
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7926
|
-
swarm.loggerService.log(METHOD_NAME$c, {
|
|
8234
|
+
swarm$1.loggerService.log(METHOD_NAME$c, {
|
|
7927
8235
|
content: content,
|
|
7928
8236
|
clientId: clientId,
|
|
7929
8237
|
});
|
|
7930
|
-
if (swarm.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
8238
|
+
if (swarm$1.sessionValidationService.getSessionMode(clientId) !== "makeConnection") {
|
|
7931
8239
|
throw new Error("agent-swarm-kit emitForce session is not makeConnection clientId=".concat(clientId));
|
|
7932
8240
|
}
|
|
7933
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME$c);
|
|
7934
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7935
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$c);
|
|
7936
|
-
return [4 /*yield*/, swarm.sessionPublicService.emit(content, METHOD_NAME$c, clientId, swarmName)];
|
|
8241
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$c);
|
|
8242
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
8243
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$c);
|
|
8244
|
+
return [4 /*yield*/, swarm$1.sessionPublicService.emit(content, METHOD_NAME$c, clientId, swarmName)];
|
|
7937
8245
|
case 1: return [2 /*return*/, _a.sent()];
|
|
7938
8246
|
}
|
|
7939
8247
|
});
|
|
@@ -7955,18 +8263,18 @@ var executeForce = function (content, clientId) { return __awaiter(void 0, void
|
|
|
7955
8263
|
return __generator(this, function (_a) {
|
|
7956
8264
|
executionId = functoolsKit.randomString();
|
|
7957
8265
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
7958
|
-
swarm.loggerService.log(METHOD_NAME$b, {
|
|
8266
|
+
swarm$1.loggerService.log(METHOD_NAME$b, {
|
|
7959
8267
|
content: content,
|
|
7960
8268
|
clientId: clientId,
|
|
7961
8269
|
executionId: executionId,
|
|
7962
8270
|
});
|
|
7963
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME$b);
|
|
7964
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
7965
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$b);
|
|
8271
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$b);
|
|
8272
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
8273
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$b);
|
|
7966
8274
|
return [2 /*return*/, ExecutionContextService.runInContext(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
7967
8275
|
return __generator(this, function (_a) {
|
|
7968
8276
|
switch (_a.label) {
|
|
7969
|
-
case 0: return [4 /*yield*/, swarm.sessionPublicService.execute(content, "tool", METHOD_NAME$b, clientId, swarmName)];
|
|
8277
|
+
case 0: return [4 /*yield*/, swarm$1.sessionPublicService.execute(content, "tool", METHOD_NAME$b, clientId, swarmName)];
|
|
7970
8278
|
case 1: return [2 /*return*/, _a.sent()];
|
|
7971
8279
|
}
|
|
7972
8280
|
});
|
|
@@ -7990,7 +8298,7 @@ var validateClientId$d = function (clientId) {
|
|
|
7990
8298
|
if (clientId === "*") {
|
|
7991
8299
|
return;
|
|
7992
8300
|
}
|
|
7993
|
-
if (!swarm.sessionValidationService.hasSession(clientId)) {
|
|
8301
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
7994
8302
|
throw new Error("agent-swarm listenEvent session not found for clientId=".concat(clientId));
|
|
7995
8303
|
}
|
|
7996
8304
|
};
|
|
@@ -8003,14 +8311,14 @@ var validateClientId$d = function (clientId) {
|
|
|
8003
8311
|
*/
|
|
8004
8312
|
var listenEvent = function (clientId, topicName, fn) {
|
|
8005
8313
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8006
|
-
swarm.loggerService.log(METHOD_NAME$a, {
|
|
8314
|
+
swarm$1.loggerService.log(METHOD_NAME$a, {
|
|
8007
8315
|
clientId: clientId,
|
|
8008
8316
|
});
|
|
8009
8317
|
if (DISALLOWED_EVENT_SOURCE_LIST$2.has(topicName)) {
|
|
8010
8318
|
throw new Error("agent-swarm listenEvent topic is reserved topicName=".concat(topicName));
|
|
8011
8319
|
}
|
|
8012
8320
|
validateClientId$d(clientId);
|
|
8013
|
-
return swarm.busService.subscribe(clientId, topicName, function (_a) {
|
|
8321
|
+
return swarm$1.busService.subscribe(clientId, topicName, function (_a) {
|
|
8014
8322
|
var payload = _a.payload;
|
|
8015
8323
|
return fn(payload);
|
|
8016
8324
|
});
|
|
@@ -8029,7 +8337,7 @@ var validateClientId$c = function (clientId) {
|
|
|
8029
8337
|
if (clientId === "*") {
|
|
8030
8338
|
return;
|
|
8031
8339
|
}
|
|
8032
|
-
if (!swarm.sessionValidationService.hasSession(clientId)) {
|
|
8340
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
8033
8341
|
throw new Error("agent-swarm listenEventOnce session not found for clientId=".concat(clientId));
|
|
8034
8342
|
}
|
|
8035
8343
|
};
|
|
@@ -8042,14 +8350,14 @@ var validateClientId$c = function (clientId) {
|
|
|
8042
8350
|
*/
|
|
8043
8351
|
var listenEventOnce = function (clientId, topicName, filterFn, fn) {
|
|
8044
8352
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8045
|
-
swarm.loggerService.log(METHOD_NAME$9, {
|
|
8353
|
+
swarm$1.loggerService.log(METHOD_NAME$9, {
|
|
8046
8354
|
clientId: clientId,
|
|
8047
8355
|
});
|
|
8048
8356
|
if (DISALLOWED_EVENT_SOURCE_LIST$1.has(topicName)) {
|
|
8049
8357
|
throw new Error("agent-swarm listenEventOnce topic is reserved topicName=".concat(topicName));
|
|
8050
8358
|
}
|
|
8051
8359
|
validateClientId$c(clientId);
|
|
8052
|
-
return swarm.busService.once(clientId, topicName, function (_a) {
|
|
8360
|
+
return swarm$1.busService.once(clientId, topicName, function (_a) {
|
|
8053
8361
|
var payload = _a.payload;
|
|
8054
8362
|
return filterFn(payload);
|
|
8055
8363
|
}, function (_a) {
|
|
@@ -8071,7 +8379,7 @@ var getLastUserMessage = function (clientId) { return __awaiter(void 0, void 0,
|
|
|
8071
8379
|
switch (_a.label) {
|
|
8072
8380
|
case 0:
|
|
8073
8381
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8074
|
-
swarm.loggerService.log(METHOD_NAME$8, {
|
|
8382
|
+
swarm$1.loggerService.log(METHOD_NAME$8, {
|
|
8075
8383
|
clientId: clientId,
|
|
8076
8384
|
});
|
|
8077
8385
|
return [4 /*yield*/, getRawHistory(clientId, METHOD_NAME$8)];
|
|
@@ -8099,7 +8407,7 @@ var getUserHistory = function (clientId) { return __awaiter(void 0, void 0, void
|
|
|
8099
8407
|
switch (_a.label) {
|
|
8100
8408
|
case 0:
|
|
8101
8409
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8102
|
-
swarm.loggerService.log(METHOD_NAME$7, {
|
|
8410
|
+
swarm$1.loggerService.log(METHOD_NAME$7, {
|
|
8103
8411
|
clientId: clientId,
|
|
8104
8412
|
});
|
|
8105
8413
|
return [4 /*yield*/, getRawHistory(clientId, METHOD_NAME$7)];
|
|
@@ -8126,7 +8434,7 @@ var getAssistantHistory = function (clientId) { return __awaiter(void 0, void 0,
|
|
|
8126
8434
|
switch (_a.label) {
|
|
8127
8435
|
case 0:
|
|
8128
8436
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8129
|
-
swarm.loggerService.log(METHOD_NAME$6, {
|
|
8437
|
+
swarm$1.loggerService.log(METHOD_NAME$6, {
|
|
8130
8438
|
clientId: clientId,
|
|
8131
8439
|
});
|
|
8132
8440
|
return [4 /*yield*/, getRawHistory(clientId, METHOD_NAME$6)];
|
|
@@ -8153,7 +8461,7 @@ var getLastAssistantMessage = function (clientId) { return __awaiter(void 0, voi
|
|
|
8153
8461
|
switch (_a.label) {
|
|
8154
8462
|
case 0:
|
|
8155
8463
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8156
|
-
swarm.loggerService.log(METHOD_NAME$5, {
|
|
8464
|
+
swarm$1.loggerService.log(METHOD_NAME$5, {
|
|
8157
8465
|
clientId: clientId,
|
|
8158
8466
|
});
|
|
8159
8467
|
return [4 /*yield*/, getRawHistory(clientId, METHOD_NAME$5)];
|
|
@@ -8181,7 +8489,7 @@ var getLastSystemMessage = function (clientId) { return __awaiter(void 0, void 0
|
|
|
8181
8489
|
switch (_a.label) {
|
|
8182
8490
|
case 0:
|
|
8183
8491
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8184
|
-
swarm.loggerService.log(METHOD_NAME$4, {
|
|
8492
|
+
swarm$1.loggerService.log(METHOD_NAME$4, {
|
|
8185
8493
|
clientId: clientId,
|
|
8186
8494
|
});
|
|
8187
8495
|
return [4 /*yield*/, getRawHistory(clientId, METHOD_NAME$4)];
|
|
@@ -8209,7 +8517,7 @@ var DEFAULT_TIMEOUT = 15 * 60;
|
|
|
8209
8517
|
var makeAutoDispose = function (clientId, swarmName, _a) {
|
|
8210
8518
|
var _b = _a === void 0 ? {} : _a, _c = _b.timeoutSeconds, timeoutSeconds = _c === void 0 ? DEFAULT_TIMEOUT : _c, onDestroy = _b.onDestroy;
|
|
8211
8519
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8212
|
-
swarm.loggerService.log(METHOD_NAME$3, {
|
|
8520
|
+
swarm$1.loggerService.log(METHOD_NAME$3, {
|
|
8213
8521
|
clientId: clientId,
|
|
8214
8522
|
swarmName: swarmName,
|
|
8215
8523
|
});
|
|
@@ -8228,7 +8536,7 @@ var makeAutoDispose = function (clientId, swarmName, _a) {
|
|
|
8228
8536
|
switch (_a.label) {
|
|
8229
8537
|
case 0:
|
|
8230
8538
|
unSource();
|
|
8231
|
-
if (!swarm.sessionValidationService.hasSession(clientId)) return [3 /*break*/, 2];
|
|
8539
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) return [3 /*break*/, 2];
|
|
8232
8540
|
return [4 /*yield*/, disposeConnection(clientId, swarmName)];
|
|
8233
8541
|
case 1:
|
|
8234
8542
|
_a.sent();
|
|
@@ -8275,13 +8583,13 @@ var DISALLOWED_EVENT_SOURCE_LIST = new Set([
|
|
|
8275
8583
|
*/
|
|
8276
8584
|
var event = function (clientId, topicName, payload) {
|
|
8277
8585
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8278
|
-
swarm.loggerService.log(METHOD_NAME$2, {
|
|
8586
|
+
swarm$1.loggerService.log(METHOD_NAME$2, {
|
|
8279
8587
|
clientId: clientId,
|
|
8280
8588
|
});
|
|
8281
8589
|
if (DISALLOWED_EVENT_SOURCE_LIST.has(topicName)) {
|
|
8282
8590
|
throw new Error("agent-swarm event topic is reserved topicName=".concat(topicName));
|
|
8283
8591
|
}
|
|
8284
|
-
return swarm.busService.emit(clientId, {
|
|
8592
|
+
return swarm$1.busService.emit(clientId, {
|
|
8285
8593
|
source: topicName,
|
|
8286
8594
|
payload: payload,
|
|
8287
8595
|
clientId: clientId,
|
|
@@ -8302,27 +8610,27 @@ var cancelOutput = function (clientId, agentName) { return __awaiter(void 0, voi
|
|
|
8302
8610
|
switch (_a.label) {
|
|
8303
8611
|
case 0:
|
|
8304
8612
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8305
|
-
swarm.loggerService.log(METHOD_NAME$1, {
|
|
8613
|
+
swarm$1.loggerService.log(METHOD_NAME$1, {
|
|
8306
8614
|
clientId: clientId,
|
|
8307
8615
|
agentName: agentName,
|
|
8308
8616
|
});
|
|
8309
|
-
swarm.agentValidationService.validate(agentName, METHOD_NAME$1);
|
|
8310
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME$1);
|
|
8311
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
8312
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME$1);
|
|
8313
|
-
return [4 /*yield*/, swarm.swarmPublicService.getAgentName(METHOD_NAME$1, clientId, swarmName)];
|
|
8617
|
+
swarm$1.agentValidationService.validate(agentName, METHOD_NAME$1);
|
|
8618
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME$1);
|
|
8619
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
8620
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME$1);
|
|
8621
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.getAgentName(METHOD_NAME$1, clientId, swarmName)];
|
|
8314
8622
|
case 1:
|
|
8315
8623
|
currentAgentName = _a.sent();
|
|
8316
8624
|
if (currentAgentName !== agentName) {
|
|
8317
8625
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8318
|
-
swarm.loggerService.log('function "cancelOutput" skipped due to the agent change', {
|
|
8626
|
+
swarm$1.loggerService.log('function "cancelOutput" skipped due to the agent change', {
|
|
8319
8627
|
currentAgentName: currentAgentName,
|
|
8320
8628
|
agentName: agentName,
|
|
8321
8629
|
clientId: clientId,
|
|
8322
8630
|
});
|
|
8323
8631
|
return [2 /*return*/];
|
|
8324
8632
|
}
|
|
8325
|
-
return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(METHOD_NAME$1, clientId, swarmName)];
|
|
8633
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.cancelOutput(METHOD_NAME$1, clientId, swarmName)];
|
|
8326
8634
|
case 2:
|
|
8327
8635
|
_a.sent();
|
|
8328
8636
|
return [2 /*return*/];
|
|
@@ -8344,13 +8652,13 @@ var cancelOutputForce = function (clientId) { return __awaiter(void 0, void 0, v
|
|
|
8344
8652
|
switch (_a.label) {
|
|
8345
8653
|
case 0:
|
|
8346
8654
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8347
|
-
swarm.loggerService.log(METHOD_NAME, {
|
|
8655
|
+
swarm$1.loggerService.log(METHOD_NAME, {
|
|
8348
8656
|
clientId: clientId,
|
|
8349
8657
|
});
|
|
8350
|
-
swarm.sessionValidationService.validate(clientId, METHOD_NAME);
|
|
8351
|
-
swarmName = swarm.sessionValidationService.getSwarm(clientId);
|
|
8352
|
-
swarm.swarmValidationService.validate(swarmName, METHOD_NAME);
|
|
8353
|
-
return [4 /*yield*/, swarm.swarmPublicService.cancelOutput(METHOD_NAME, clientId, swarmName)];
|
|
8658
|
+
swarm$1.sessionValidationService.validate(clientId, METHOD_NAME);
|
|
8659
|
+
swarmName = swarm$1.sessionValidationService.getSwarm(clientId);
|
|
8660
|
+
swarm$1.swarmValidationService.validate(swarmName, METHOD_NAME);
|
|
8661
|
+
return [4 /*yield*/, swarm$1.swarmPublicService.cancelOutput(METHOD_NAME, clientId, swarmName)];
|
|
8354
8662
|
case 1:
|
|
8355
8663
|
_a.sent();
|
|
8356
8664
|
return [2 /*return*/];
|
|
@@ -8362,7 +8670,7 @@ var validateClientId$b = function (clientId) {
|
|
|
8362
8670
|
if (clientId === "*") {
|
|
8363
8671
|
return;
|
|
8364
8672
|
}
|
|
8365
|
-
if (!swarm.sessionValidationService.hasSession(clientId)) {
|
|
8673
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
8366
8674
|
throw new Error("agent-swarm listenAgentEvent session not found for clientId=".concat(clientId));
|
|
8367
8675
|
}
|
|
8368
8676
|
};
|
|
@@ -8373,18 +8681,18 @@ var validateClientId$b = function (clientId) {
|
|
|
8373
8681
|
* @param {function} fn - The callback function to handle the event.
|
|
8374
8682
|
*/
|
|
8375
8683
|
var listenAgentEvent = function (clientId, fn) {
|
|
8376
|
-
swarm.loggerService.log("middleware listenAgentEvent", {
|
|
8684
|
+
swarm$1.loggerService.log("middleware listenAgentEvent", {
|
|
8377
8685
|
clientId: clientId,
|
|
8378
8686
|
});
|
|
8379
8687
|
validateClientId$b(clientId);
|
|
8380
|
-
return swarm.busService.subscribe(clientId, "agent-bus", fn);
|
|
8688
|
+
return swarm$1.busService.subscribe(clientId, "agent-bus", fn);
|
|
8381
8689
|
};
|
|
8382
8690
|
|
|
8383
8691
|
var validateClientId$a = function (clientId) {
|
|
8384
8692
|
if (clientId === "*") {
|
|
8385
8693
|
return;
|
|
8386
8694
|
}
|
|
8387
|
-
if (!swarm.sessionValidationService.hasSession(clientId)) {
|
|
8695
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
8388
8696
|
throw new Error("agent-swarm listenHistoryEvent session not found for clientId=".concat(clientId));
|
|
8389
8697
|
}
|
|
8390
8698
|
};
|
|
@@ -8395,18 +8703,18 @@ var validateClientId$a = function (clientId) {
|
|
|
8395
8703
|
* @param {(event: IBusEvent) => void} fn - The callback function to handle the event.
|
|
8396
8704
|
*/
|
|
8397
8705
|
var listenHistoryEvent = function (clientId, fn) {
|
|
8398
|
-
swarm.loggerService.log("middleware listenHistoryEvent", {
|
|
8706
|
+
swarm$1.loggerService.log("middleware listenHistoryEvent", {
|
|
8399
8707
|
clientId: clientId,
|
|
8400
8708
|
});
|
|
8401
8709
|
validateClientId$a(clientId);
|
|
8402
|
-
return swarm.busService.subscribe(clientId, "history-bus", fn);
|
|
8710
|
+
return swarm$1.busService.subscribe(clientId, "history-bus", fn);
|
|
8403
8711
|
};
|
|
8404
8712
|
|
|
8405
8713
|
var validateClientId$9 = function (clientId) {
|
|
8406
8714
|
if (clientId === "*") {
|
|
8407
8715
|
return;
|
|
8408
8716
|
}
|
|
8409
|
-
if (!swarm.sessionValidationService.hasSession(clientId)) {
|
|
8717
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
8410
8718
|
throw new Error("agent-swarm listenSessionEvent session not found for clientId=".concat(clientId));
|
|
8411
8719
|
}
|
|
8412
8720
|
};
|
|
@@ -8417,18 +8725,18 @@ var validateClientId$9 = function (clientId) {
|
|
|
8417
8725
|
* @param {function} fn - The callback function to handle the session events.
|
|
8418
8726
|
*/
|
|
8419
8727
|
var listenSessionEvent = function (clientId, fn) {
|
|
8420
|
-
swarm.loggerService.log("middleware listenSessionEvent", {
|
|
8728
|
+
swarm$1.loggerService.log("middleware listenSessionEvent", {
|
|
8421
8729
|
clientId: clientId,
|
|
8422
8730
|
});
|
|
8423
8731
|
validateClientId$9(clientId);
|
|
8424
|
-
return swarm.busService.subscribe(clientId, "session-bus", fn);
|
|
8732
|
+
return swarm$1.busService.subscribe(clientId, "session-bus", fn);
|
|
8425
8733
|
};
|
|
8426
8734
|
|
|
8427
8735
|
var validateClientId$8 = function (clientId) {
|
|
8428
8736
|
if (clientId === "*") {
|
|
8429
8737
|
return;
|
|
8430
8738
|
}
|
|
8431
|
-
if (!swarm.sessionValidationService.hasSession(clientId)) {
|
|
8739
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
8432
8740
|
throw new Error("agent-swarm listenStateEvent session not found for clientId=".concat(clientId));
|
|
8433
8741
|
}
|
|
8434
8742
|
};
|
|
@@ -8439,18 +8747,18 @@ var validateClientId$8 = function (clientId) {
|
|
|
8439
8747
|
* @param {function} fn - The callback function to handle the event.
|
|
8440
8748
|
*/
|
|
8441
8749
|
var listenStateEvent = function (clientId, fn) {
|
|
8442
|
-
swarm.loggerService.log("middleware listenStateEvent", {
|
|
8750
|
+
swarm$1.loggerService.log("middleware listenStateEvent", {
|
|
8443
8751
|
clientId: clientId,
|
|
8444
8752
|
});
|
|
8445
8753
|
validateClientId$8(clientId);
|
|
8446
|
-
return swarm.busService.subscribe(clientId, "state-bus", fn);
|
|
8754
|
+
return swarm$1.busService.subscribe(clientId, "state-bus", fn);
|
|
8447
8755
|
};
|
|
8448
8756
|
|
|
8449
8757
|
var validateClientId$7 = function (clientId) {
|
|
8450
8758
|
if (clientId === "*") {
|
|
8451
8759
|
return;
|
|
8452
8760
|
}
|
|
8453
|
-
if (!swarm.sessionValidationService.hasSession(clientId)) {
|
|
8761
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
8454
8762
|
throw new Error("agent-swarm listenStorageEvent session not found for clientId=".concat(clientId));
|
|
8455
8763
|
}
|
|
8456
8764
|
};
|
|
@@ -8461,18 +8769,18 @@ var validateClientId$7 = function (clientId) {
|
|
|
8461
8769
|
* @param {function} fn - The callback function to handle the storage event.
|
|
8462
8770
|
*/
|
|
8463
8771
|
var listenStorageEvent = function (clientId, fn) {
|
|
8464
|
-
swarm.loggerService.log("middleware listenStorageEvent", {
|
|
8772
|
+
swarm$1.loggerService.log("middleware listenStorageEvent", {
|
|
8465
8773
|
clientId: clientId,
|
|
8466
8774
|
});
|
|
8467
8775
|
validateClientId$7(clientId);
|
|
8468
|
-
return swarm.busService.subscribe(clientId, "storage-bus", fn);
|
|
8776
|
+
return swarm$1.busService.subscribe(clientId, "storage-bus", fn);
|
|
8469
8777
|
};
|
|
8470
8778
|
|
|
8471
8779
|
var validateClientId$6 = function (clientId) {
|
|
8472
8780
|
if (clientId === "*") {
|
|
8473
8781
|
return;
|
|
8474
8782
|
}
|
|
8475
|
-
if (!swarm.sessionValidationService.hasSession(clientId)) {
|
|
8783
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
8476
8784
|
throw new Error("agent-swarm listenSwarmEvent session not found for clientId=".concat(clientId));
|
|
8477
8785
|
}
|
|
8478
8786
|
};
|
|
@@ -8483,18 +8791,18 @@ var validateClientId$6 = function (clientId) {
|
|
|
8483
8791
|
* @param {(event: IBusEvent) => void} fn - The callback function to handle the event.
|
|
8484
8792
|
*/
|
|
8485
8793
|
var listenSwarmEvent = function (clientId, fn) {
|
|
8486
|
-
swarm.loggerService.log("middleware listenSwarmEvent", {
|
|
8794
|
+
swarm$1.loggerService.log("middleware listenSwarmEvent", {
|
|
8487
8795
|
clientId: clientId,
|
|
8488
8796
|
});
|
|
8489
8797
|
validateClientId$6(clientId);
|
|
8490
|
-
return swarm.busService.subscribe(clientId, "swarm-bus", fn);
|
|
8798
|
+
return swarm$1.busService.subscribe(clientId, "swarm-bus", fn);
|
|
8491
8799
|
};
|
|
8492
8800
|
|
|
8493
8801
|
var validateClientId$5 = function (clientId) {
|
|
8494
8802
|
if (clientId === "*") {
|
|
8495
8803
|
return;
|
|
8496
8804
|
}
|
|
8497
|
-
if (!swarm.sessionValidationService.hasSession(clientId)) {
|
|
8805
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
8498
8806
|
throw new Error("agent-swarm listenAgentEventOnce session not found for clientId=".concat(clientId));
|
|
8499
8807
|
}
|
|
8500
8808
|
};
|
|
@@ -8505,18 +8813,18 @@ var validateClientId$5 = function (clientId) {
|
|
|
8505
8813
|
* @param {function} fn - The callback function to handle the event.
|
|
8506
8814
|
*/
|
|
8507
8815
|
var listenAgentEventOnce = function (clientId, filterFn, fn) {
|
|
8508
|
-
swarm.loggerService.log("middleware listenAgentEventOnce", {
|
|
8816
|
+
swarm$1.loggerService.log("middleware listenAgentEventOnce", {
|
|
8509
8817
|
clientId: clientId,
|
|
8510
8818
|
});
|
|
8511
8819
|
validateClientId$5(clientId);
|
|
8512
|
-
return swarm.busService.once(clientId, "agent-bus", filterFn, fn);
|
|
8820
|
+
return swarm$1.busService.once(clientId, "agent-bus", filterFn, fn);
|
|
8513
8821
|
};
|
|
8514
8822
|
|
|
8515
8823
|
var validateClientId$4 = function (clientId) {
|
|
8516
8824
|
if (clientId === "*") {
|
|
8517
8825
|
return;
|
|
8518
8826
|
}
|
|
8519
|
-
if (!swarm.sessionValidationService.hasSession(clientId)) {
|
|
8827
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
8520
8828
|
throw new Error("agent-swarm listenHistoryEventOnce session not found for clientId=".concat(clientId));
|
|
8521
8829
|
}
|
|
8522
8830
|
};
|
|
@@ -8527,18 +8835,18 @@ var validateClientId$4 = function (clientId) {
|
|
|
8527
8835
|
* @param {(event: IBusEvent) => void} fn - The callback function to handle the event.
|
|
8528
8836
|
*/
|
|
8529
8837
|
var listenHistoryEventOnce = function (clientId, filterFn, fn) {
|
|
8530
|
-
swarm.loggerService.log("middleware listenHistoryEventOnce", {
|
|
8838
|
+
swarm$1.loggerService.log("middleware listenHistoryEventOnce", {
|
|
8531
8839
|
clientId: clientId,
|
|
8532
8840
|
});
|
|
8533
8841
|
validateClientId$4(clientId);
|
|
8534
|
-
return swarm.busService.once(clientId, "history-bus", filterFn, fn);
|
|
8842
|
+
return swarm$1.busService.once(clientId, "history-bus", filterFn, fn);
|
|
8535
8843
|
};
|
|
8536
8844
|
|
|
8537
8845
|
var validateClientId$3 = function (clientId) {
|
|
8538
8846
|
if (clientId === "*") {
|
|
8539
8847
|
return;
|
|
8540
8848
|
}
|
|
8541
|
-
if (!swarm.sessionValidationService.hasSession(clientId)) {
|
|
8849
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
8542
8850
|
throw new Error("agent-swarm listenSessionEventOnce session not found for clientId=".concat(clientId));
|
|
8543
8851
|
}
|
|
8544
8852
|
};
|
|
@@ -8549,18 +8857,18 @@ var validateClientId$3 = function (clientId) {
|
|
|
8549
8857
|
* @param {function} fn - The callback function to handle the session events.
|
|
8550
8858
|
*/
|
|
8551
8859
|
var listenSessionEventOnce = function (clientId, filterFn, fn) {
|
|
8552
|
-
swarm.loggerService.log("middleware listenSessionEventOnce", {
|
|
8860
|
+
swarm$1.loggerService.log("middleware listenSessionEventOnce", {
|
|
8553
8861
|
clientId: clientId,
|
|
8554
8862
|
});
|
|
8555
8863
|
validateClientId$3(clientId);
|
|
8556
|
-
return swarm.busService.once(clientId, "session-bus", filterFn, fn);
|
|
8864
|
+
return swarm$1.busService.once(clientId, "session-bus", filterFn, fn);
|
|
8557
8865
|
};
|
|
8558
8866
|
|
|
8559
8867
|
var validateClientId$2 = function (clientId) {
|
|
8560
8868
|
if (clientId === "*") {
|
|
8561
8869
|
return;
|
|
8562
8870
|
}
|
|
8563
|
-
if (!swarm.sessionValidationService.hasSession(clientId)) {
|
|
8871
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
8564
8872
|
throw new Error("agent-swarm listenStateEventOnce session not found for clientId=".concat(clientId));
|
|
8565
8873
|
}
|
|
8566
8874
|
};
|
|
@@ -8571,18 +8879,18 @@ var validateClientId$2 = function (clientId) {
|
|
|
8571
8879
|
* @param {function} fn - The callback function to handle the event.
|
|
8572
8880
|
*/
|
|
8573
8881
|
var listenStateEventOnce = function (clientId, filterFn, fn) {
|
|
8574
|
-
swarm.loggerService.log("middleware listenStateEventOnce", {
|
|
8882
|
+
swarm$1.loggerService.log("middleware listenStateEventOnce", {
|
|
8575
8883
|
clientId: clientId,
|
|
8576
8884
|
});
|
|
8577
8885
|
validateClientId$2(clientId);
|
|
8578
|
-
return swarm.busService.once(clientId, "state-bus", filterFn, fn);
|
|
8886
|
+
return swarm$1.busService.once(clientId, "state-bus", filterFn, fn);
|
|
8579
8887
|
};
|
|
8580
8888
|
|
|
8581
8889
|
var validateClientId$1 = function (clientId) {
|
|
8582
8890
|
if (clientId === "*") {
|
|
8583
8891
|
return;
|
|
8584
8892
|
}
|
|
8585
|
-
if (!swarm.sessionValidationService.hasSession(clientId)) {
|
|
8893
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
8586
8894
|
throw new Error("agent-swarm listenStorageEventOnce session not found for clientId=".concat(clientId));
|
|
8587
8895
|
}
|
|
8588
8896
|
};
|
|
@@ -8593,18 +8901,18 @@ var validateClientId$1 = function (clientId) {
|
|
|
8593
8901
|
* @param {function} fn - The callback function to handle the storage event.
|
|
8594
8902
|
*/
|
|
8595
8903
|
var listenStorageEventOnce = function (clientId, filterFn, fn) {
|
|
8596
|
-
swarm.loggerService.log("middleware listenStorageEventOnce", {
|
|
8904
|
+
swarm$1.loggerService.log("middleware listenStorageEventOnce", {
|
|
8597
8905
|
clientId: clientId,
|
|
8598
8906
|
});
|
|
8599
8907
|
validateClientId$1(clientId);
|
|
8600
|
-
return swarm.busService.once(clientId, "storage-bus", filterFn, fn);
|
|
8908
|
+
return swarm$1.busService.once(clientId, "storage-bus", filterFn, fn);
|
|
8601
8909
|
};
|
|
8602
8910
|
|
|
8603
8911
|
var validateClientId = function (clientId) {
|
|
8604
8912
|
if (clientId === "*") {
|
|
8605
8913
|
return;
|
|
8606
8914
|
}
|
|
8607
|
-
if (!swarm.sessionValidationService.hasSession(clientId)) {
|
|
8915
|
+
if (!swarm$1.sessionValidationService.hasSession(clientId)) {
|
|
8608
8916
|
throw new Error("agent-swarm listenSwarmEventOnce session not found for clientId=".concat(clientId));
|
|
8609
8917
|
}
|
|
8610
8918
|
};
|
|
@@ -8615,11 +8923,11 @@ var validateClientId = function (clientId) {
|
|
|
8615
8923
|
* @param {(event: IBusEvent) => void} fn - The callback function to handle the event.
|
|
8616
8924
|
*/
|
|
8617
8925
|
var listenSwarmEventOnce = function (clientId, filterFn, fn) {
|
|
8618
|
-
swarm.loggerService.log("middleware listenSwarmEventOnce", {
|
|
8926
|
+
swarm$1.loggerService.log("middleware listenSwarmEventOnce", {
|
|
8619
8927
|
clientId: clientId,
|
|
8620
8928
|
});
|
|
8621
8929
|
validateClientId(clientId);
|
|
8622
|
-
return swarm.busService.once(clientId, "swarm-bus", filterFn, fn);
|
|
8930
|
+
return swarm$1.busService.once(clientId, "swarm-bus", filterFn, fn);
|
|
8623
8931
|
};
|
|
8624
8932
|
|
|
8625
8933
|
var METHOD_NAME_TAKE = "StorageUtils.take";
|
|
@@ -8646,18 +8954,18 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8646
8954
|
switch (_a.label) {
|
|
8647
8955
|
case 0:
|
|
8648
8956
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8649
|
-
swarm.loggerService.log(METHOD_NAME_TAKE, {
|
|
8957
|
+
swarm$1.loggerService.log(METHOD_NAME_TAKE, {
|
|
8650
8958
|
search: payload.search,
|
|
8651
8959
|
total: payload.total,
|
|
8652
8960
|
clientId: payload.clientId,
|
|
8653
8961
|
storageName: payload.storageName,
|
|
8654
8962
|
score: payload.score,
|
|
8655
8963
|
});
|
|
8656
|
-
swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_TAKE);
|
|
8657
|
-
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8964
|
+
swarm$1.storageValidationService.validate(payload.storageName, METHOD_NAME_TAKE);
|
|
8965
|
+
if (!swarm$1.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8658
8966
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (take)"));
|
|
8659
8967
|
}
|
|
8660
|
-
return [4 /*yield*/, swarm.storagePublicService.take(payload.search, payload.total, METHOD_NAME_TAKE, payload.clientId, payload.storageName, payload.score)];
|
|
8968
|
+
return [4 /*yield*/, swarm$1.storagePublicService.take(payload.search, payload.total, METHOD_NAME_TAKE, payload.clientId, payload.storageName, payload.score)];
|
|
8661
8969
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
8662
8970
|
}
|
|
8663
8971
|
});
|
|
@@ -8676,16 +8984,16 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8676
8984
|
switch (_a.label) {
|
|
8677
8985
|
case 0:
|
|
8678
8986
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8679
|
-
swarm.loggerService.log(METHOD_NAME_UPSERT, {
|
|
8987
|
+
swarm$1.loggerService.log(METHOD_NAME_UPSERT, {
|
|
8680
8988
|
item: payload.item,
|
|
8681
8989
|
clientId: payload.clientId,
|
|
8682
8990
|
storageName: payload.storageName,
|
|
8683
8991
|
});
|
|
8684
|
-
swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_UPSERT);
|
|
8685
|
-
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8992
|
+
swarm$1.storageValidationService.validate(payload.storageName, METHOD_NAME_UPSERT);
|
|
8993
|
+
if (!swarm$1.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8686
8994
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (upsert)"));
|
|
8687
8995
|
}
|
|
8688
|
-
return [4 /*yield*/, swarm.storagePublicService.upsert(payload.item, METHOD_NAME_UPSERT, payload.clientId, payload.storageName)];
|
|
8996
|
+
return [4 /*yield*/, swarm$1.storagePublicService.upsert(payload.item, METHOD_NAME_UPSERT, payload.clientId, payload.storageName)];
|
|
8689
8997
|
case 1: return [2 /*return*/, _a.sent()];
|
|
8690
8998
|
}
|
|
8691
8999
|
});
|
|
@@ -8703,16 +9011,16 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8703
9011
|
switch (_a.label) {
|
|
8704
9012
|
case 0:
|
|
8705
9013
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8706
|
-
swarm.loggerService.log(METHOD_NAME_REMOVE, {
|
|
9014
|
+
swarm$1.loggerService.log(METHOD_NAME_REMOVE, {
|
|
8707
9015
|
itemId: payload.itemId,
|
|
8708
9016
|
clientId: payload.clientId,
|
|
8709
9017
|
storageName: payload.storageName,
|
|
8710
9018
|
});
|
|
8711
|
-
swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_REMOVE);
|
|
8712
|
-
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
9019
|
+
swarm$1.storageValidationService.validate(payload.storageName, METHOD_NAME_REMOVE);
|
|
9020
|
+
if (!swarm$1.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8713
9021
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (remove)"));
|
|
8714
9022
|
}
|
|
8715
|
-
return [4 /*yield*/, swarm.storagePublicService.remove(payload.itemId, METHOD_NAME_REMOVE, payload.clientId, payload.storageName)];
|
|
9023
|
+
return [4 /*yield*/, swarm$1.storagePublicService.remove(payload.itemId, METHOD_NAME_REMOVE, payload.clientId, payload.storageName)];
|
|
8716
9024
|
case 1: return [2 /*return*/, _a.sent()];
|
|
8717
9025
|
}
|
|
8718
9026
|
});
|
|
@@ -8731,16 +9039,16 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8731
9039
|
switch (_a.label) {
|
|
8732
9040
|
case 0:
|
|
8733
9041
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8734
|
-
swarm.loggerService.log(METHOD_NAME_GET$1, {
|
|
9042
|
+
swarm$1.loggerService.log(METHOD_NAME_GET$1, {
|
|
8735
9043
|
itemId: payload.itemId,
|
|
8736
9044
|
clientId: payload.clientId,
|
|
8737
9045
|
storageName: payload.storageName,
|
|
8738
9046
|
});
|
|
8739
|
-
swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_GET$1);
|
|
8740
|
-
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
9047
|
+
swarm$1.storageValidationService.validate(payload.storageName, METHOD_NAME_GET$1);
|
|
9048
|
+
if (!swarm$1.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8741
9049
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (get)"));
|
|
8742
9050
|
}
|
|
8743
|
-
return [4 /*yield*/, swarm.storagePublicService.get(payload.itemId, METHOD_NAME_GET$1, payload.clientId, payload.storageName)];
|
|
9051
|
+
return [4 /*yield*/, swarm$1.storagePublicService.get(payload.itemId, METHOD_NAME_GET$1, payload.clientId, payload.storageName)];
|
|
8744
9052
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
8745
9053
|
}
|
|
8746
9054
|
});
|
|
@@ -8759,15 +9067,15 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8759
9067
|
switch (_a.label) {
|
|
8760
9068
|
case 0:
|
|
8761
9069
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8762
|
-
swarm.loggerService.log(METHOD_NAME_LIST, {
|
|
9070
|
+
swarm$1.loggerService.log(METHOD_NAME_LIST, {
|
|
8763
9071
|
clientId: payload.clientId,
|
|
8764
9072
|
storageName: payload.storageName,
|
|
8765
9073
|
});
|
|
8766
|
-
swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_LIST);
|
|
8767
|
-
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
9074
|
+
swarm$1.storageValidationService.validate(payload.storageName, METHOD_NAME_LIST);
|
|
9075
|
+
if (!swarm$1.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8768
9076
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (list)"));
|
|
8769
9077
|
}
|
|
8770
|
-
return [4 /*yield*/, swarm.storagePublicService.list(METHOD_NAME_LIST, payload.clientId, payload.storageName, payload.filter)];
|
|
9078
|
+
return [4 /*yield*/, swarm$1.storagePublicService.list(METHOD_NAME_LIST, payload.clientId, payload.storageName, payload.filter)];
|
|
8771
9079
|
case 1: return [2 /*return*/, (_a.sent())];
|
|
8772
9080
|
}
|
|
8773
9081
|
});
|
|
@@ -8784,15 +9092,15 @@ var StorageUtils = /** @class */ (function () {
|
|
|
8784
9092
|
switch (_a.label) {
|
|
8785
9093
|
case 0:
|
|
8786
9094
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8787
|
-
swarm.loggerService.log(METHOD_NAME_CLEAR, {
|
|
9095
|
+
swarm$1.loggerService.log(METHOD_NAME_CLEAR, {
|
|
8788
9096
|
clientId: payload.clientId,
|
|
8789
9097
|
storageName: payload.storageName,
|
|
8790
9098
|
});
|
|
8791
|
-
swarm.storageValidationService.validate(payload.storageName, METHOD_NAME_CLEAR);
|
|
8792
|
-
if (!swarm.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
9099
|
+
swarm$1.storageValidationService.validate(payload.storageName, METHOD_NAME_CLEAR);
|
|
9100
|
+
if (!swarm$1.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
8793
9101
|
throw new Error("agent-swarm StorageUtils ".concat(payload.storageName, " not registered in ").concat(payload.agentName, " (clear)"));
|
|
8794
9102
|
}
|
|
8795
|
-
return [4 /*yield*/, swarm.storagePublicService.clear(METHOD_NAME_CLEAR, payload.clientId, payload.storageName)];
|
|
9103
|
+
return [4 /*yield*/, swarm$1.storagePublicService.clear(METHOD_NAME_CLEAR, payload.clientId, payload.storageName)];
|
|
8796
9104
|
case 1: return [2 /*return*/, _a.sent()];
|
|
8797
9105
|
}
|
|
8798
9106
|
});
|
|
@@ -8826,14 +9134,14 @@ var StateUtils = /** @class */ (function () {
|
|
|
8826
9134
|
switch (_a.label) {
|
|
8827
9135
|
case 0:
|
|
8828
9136
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8829
|
-
swarm.loggerService.log(METHOD_NAME_GET, {
|
|
9137
|
+
swarm$1.loggerService.log(METHOD_NAME_GET, {
|
|
8830
9138
|
clientId: payload.clientId,
|
|
8831
9139
|
stateName: payload.stateName,
|
|
8832
9140
|
});
|
|
8833
|
-
if (!swarm.agentValidationService.hasState(payload.agentName, payload.stateName)) {
|
|
9141
|
+
if (!swarm$1.agentValidationService.hasState(payload.agentName, payload.stateName)) {
|
|
8834
9142
|
throw new Error("agent-swarm StateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (getState)"));
|
|
8835
9143
|
}
|
|
8836
|
-
return [4 /*yield*/, swarm.statePublicService.getState(METHOD_NAME_GET, payload.clientId, payload.stateName)];
|
|
9144
|
+
return [4 /*yield*/, swarm$1.statePublicService.getState(METHOD_NAME_GET, payload.clientId, payload.stateName)];
|
|
8837
9145
|
case 1: return [2 /*return*/, _a.sent()];
|
|
8838
9146
|
}
|
|
8839
9147
|
});
|
|
@@ -8855,17 +9163,17 @@ var StateUtils = /** @class */ (function () {
|
|
|
8855
9163
|
switch (_a.label) {
|
|
8856
9164
|
case 0:
|
|
8857
9165
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8858
|
-
swarm.loggerService.log(METHOD_NAME_SET, {
|
|
9166
|
+
swarm$1.loggerService.log(METHOD_NAME_SET, {
|
|
8859
9167
|
clientId: payload.clientId,
|
|
8860
9168
|
stateName: payload.stateName,
|
|
8861
9169
|
});
|
|
8862
|
-
if (!swarm.agentValidationService.hasState(payload.agentName, payload.stateName)) {
|
|
9170
|
+
if (!swarm$1.agentValidationService.hasState(payload.agentName, payload.stateName)) {
|
|
8863
9171
|
throw new Error("agent-swarm StateUtils ".concat(payload.stateName, " not registered in ").concat(payload.agentName, " (setState)"));
|
|
8864
9172
|
}
|
|
8865
9173
|
if (!(typeof dispatchFn === "function")) return [3 /*break*/, 2];
|
|
8866
|
-
return [4 /*yield*/, swarm.statePublicService.setState(dispatchFn, METHOD_NAME_SET, payload.clientId, payload.stateName)];
|
|
9174
|
+
return [4 /*yield*/, swarm$1.statePublicService.setState(dispatchFn, METHOD_NAME_SET, payload.clientId, payload.stateName)];
|
|
8867
9175
|
case 1: return [2 /*return*/, _a.sent()];
|
|
8868
|
-
case 2: return [4 /*yield*/, swarm.statePublicService.setState(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
9176
|
+
case 2: return [4 /*yield*/, swarm$1.statePublicService.setState(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
8869
9177
|
return [2 /*return*/, dispatchFn];
|
|
8870
9178
|
}); }); }, METHOD_NAME_SET, payload.clientId, payload.stateName)];
|
|
8871
9179
|
case 3: return [2 /*return*/, _a.sent()];
|
|
@@ -8881,27 +9189,6 @@ var StateUtils = /** @class */ (function () {
|
|
|
8881
9189
|
*/
|
|
8882
9190
|
var State = new StateUtils();
|
|
8883
9191
|
|
|
8884
|
-
var METHOD_NAME_USE_LOGGER = "HistoryInstance.useLogger";
|
|
8885
|
-
var LoggerUtils = /** @class */ (function () {
|
|
8886
|
-
function LoggerUtils() {
|
|
8887
|
-
/**
|
|
8888
|
-
* Sets the provided logger to the logger service.
|
|
8889
|
-
* @param {ILogger} logger - The logger instance to be used.
|
|
8890
|
-
*/
|
|
8891
|
-
this.useLogger = function (logger) {
|
|
8892
|
-
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8893
|
-
swarm.loggerService.log(METHOD_NAME_USE_LOGGER);
|
|
8894
|
-
swarm.loggerService.setLogger(logger);
|
|
8895
|
-
};
|
|
8896
|
-
}
|
|
8897
|
-
return LoggerUtils;
|
|
8898
|
-
}());
|
|
8899
|
-
/**
|
|
8900
|
-
* Instance of LoggerUtils to be used for logging.
|
|
8901
|
-
* @type {LoggerUtils}
|
|
8902
|
-
*/
|
|
8903
|
-
var Logger = new LoggerUtils();
|
|
8904
|
-
|
|
8905
9192
|
/**
|
|
8906
9193
|
* Function that recursively flattens a nested object to array of entries.
|
|
8907
9194
|
*/
|
|
@@ -8951,7 +9238,7 @@ var SchemaUtils = /** @class */ (function () {
|
|
|
8951
9238
|
*/
|
|
8952
9239
|
this.serialize = function (data) {
|
|
8953
9240
|
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
8954
|
-
swarm.loggerService.log(METHOD_NAME_SERIALIZE, {
|
|
9241
|
+
swarm$1.loggerService.log(METHOD_NAME_SERIALIZE, {
|
|
8955
9242
|
data: data,
|
|
8956
9243
|
});
|
|
8957
9244
|
if (Array.isArray(data)) {
|
|
@@ -8994,6 +9281,8 @@ exports.History = History;
|
|
|
8994
9281
|
exports.HistoryAdapter = HistoryAdapter;
|
|
8995
9282
|
exports.HistoryInstance = HistoryInstance;
|
|
8996
9283
|
exports.Logger = Logger;
|
|
9284
|
+
exports.LoggerAdapter = LoggerAdapter;
|
|
9285
|
+
exports.LoggerInstance = LoggerInstance;
|
|
8997
9286
|
exports.MethodContextService = MethodContextService;
|
|
8998
9287
|
exports.Schema = Schema;
|
|
8999
9288
|
exports.State = State;
|