agent-swarm-kit 1.0.62 → 1.0.63
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 +56 -32
- package/build/index.mjs +56 -32
- package/package.json +1 -1
- package/types.d.ts +13 -1
package/build/index.cjs
CHANGED
|
@@ -489,6 +489,8 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
489
489
|
agentName: agentName,
|
|
490
490
|
});
|
|
491
491
|
if (!this.callbacks.onRead) return [3 /*break*/, 12];
|
|
492
|
+
this.callbacks.onReadBegin &&
|
|
493
|
+
this.callbacks.onReadBegin(this.clientId, agentName);
|
|
492
494
|
_g.label = 1;
|
|
493
495
|
case 1:
|
|
494
496
|
_g.trys.push([1, 8, 9, 10]);
|
|
@@ -497,7 +499,7 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
497
499
|
case 2:
|
|
498
500
|
if (!!_b.done) return [3 /*break*/, 7];
|
|
499
501
|
item = _b.value;
|
|
500
|
-
return [4 /*yield*/, __await(callbacks.filterCondition(item, this.clientId, agentName))];
|
|
502
|
+
return [4 /*yield*/, __await(this.callbacks.filterCondition(item, this.clientId, agentName))];
|
|
501
503
|
case 3:
|
|
502
504
|
if (!_g.sent()) return [3 /*break*/, 6];
|
|
503
505
|
this.callbacks.onRead(item, this.clientId, agentName);
|
|
@@ -520,38 +522,48 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
520
522
|
}
|
|
521
523
|
finally { if (e_1) throw e_1.error; }
|
|
522
524
|
return [7 /*endfinally*/];
|
|
523
|
-
case 10:
|
|
525
|
+
case 10:
|
|
526
|
+
this.callbacks.onReadEnd &&
|
|
527
|
+
this.callbacks.onReadEnd(this.clientId, agentName);
|
|
528
|
+
return [4 /*yield*/, __await(void 0)];
|
|
524
529
|
case 11: return [2 /*return*/, _g.sent()];
|
|
525
530
|
case 12:
|
|
526
|
-
|
|
527
|
-
|
|
531
|
+
this.callbacks.onReadBegin &&
|
|
532
|
+
this.callbacks.onReadBegin(this.clientId, agentName);
|
|
528
533
|
_g.label = 13;
|
|
529
534
|
case 13:
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
535
|
+
_g.trys.push([13, 20, 21, 22]);
|
|
536
|
+
_c = __values(this._array), _d = _c.next();
|
|
537
|
+
_g.label = 14;
|
|
533
538
|
case 14:
|
|
534
|
-
if (
|
|
539
|
+
if (!!_d.done) return [3 /*break*/, 19];
|
|
540
|
+
item = _d.value;
|
|
541
|
+
return [4 /*yield*/, __await(this.callbacks.filterCondition(item, this.clientId, agentName))];
|
|
542
|
+
case 15:
|
|
543
|
+
if (!_g.sent()) return [3 /*break*/, 18];
|
|
535
544
|
return [4 /*yield*/, __await(item)];
|
|
536
|
-
case
|
|
537
|
-
case 16:
|
|
538
|
-
_g.sent();
|
|
539
|
-
_g.label = 17;
|
|
545
|
+
case 16: return [4 /*yield*/, _g.sent()];
|
|
540
546
|
case 17:
|
|
547
|
+
_g.sent();
|
|
548
|
+
_g.label = 18;
|
|
549
|
+
case 18:
|
|
541
550
|
_d = _c.next();
|
|
542
|
-
return [3 /*break*/,
|
|
543
|
-
case
|
|
544
|
-
case
|
|
551
|
+
return [3 /*break*/, 14];
|
|
552
|
+
case 19: return [3 /*break*/, 22];
|
|
553
|
+
case 20:
|
|
545
554
|
e_2_1 = _g.sent();
|
|
546
555
|
e_2 = { error: e_2_1 };
|
|
547
|
-
return [3 /*break*/,
|
|
548
|
-
case
|
|
556
|
+
return [3 /*break*/, 22];
|
|
557
|
+
case 21:
|
|
549
558
|
try {
|
|
550
559
|
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
551
560
|
}
|
|
552
561
|
finally { if (e_2) throw e_2.error; }
|
|
553
562
|
return [7 /*endfinally*/];
|
|
554
|
-
case
|
|
563
|
+
case 22:
|
|
564
|
+
this.callbacks.onReadEnd &&
|
|
565
|
+
this.callbacks.onReadEnd(this.clientId, agentName);
|
|
566
|
+
return [2 /*return*/];
|
|
555
567
|
}
|
|
556
568
|
});
|
|
557
569
|
});
|
|
@@ -575,6 +587,8 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
575
587
|
agentName: agentName,
|
|
576
588
|
});
|
|
577
589
|
if (!this.callbacks.onRead) return [3 /*break*/, 11];
|
|
590
|
+
this.callbacks.onReadBegin &&
|
|
591
|
+
this.callbacks.onReadBegin(this.clientId, agentName);
|
|
578
592
|
_g.label = 1;
|
|
579
593
|
case 1:
|
|
580
594
|
_g.trys.push([1, 7, 8, 9]);
|
|
@@ -603,35 +617,45 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
603
617
|
}
|
|
604
618
|
finally { if (e_3) throw e_3.error; }
|
|
605
619
|
return [7 /*endfinally*/];
|
|
606
|
-
case 9:
|
|
620
|
+
case 9:
|
|
621
|
+
this.callbacks.onReadEnd &&
|
|
622
|
+
this.callbacks.onReadEnd(this.clientId, agentName);
|
|
623
|
+
return [4 /*yield*/, __await(void 0)];
|
|
607
624
|
case 10: return [2 /*return*/, _g.sent()];
|
|
608
625
|
case 11:
|
|
609
|
-
|
|
610
|
-
|
|
626
|
+
this.callbacks.onReadBegin &&
|
|
627
|
+
this.callbacks.onReadBegin(this.clientId, agentName);
|
|
611
628
|
_g.label = 12;
|
|
612
629
|
case 12:
|
|
613
|
-
|
|
630
|
+
_g.trys.push([12, 18, 19, 20]);
|
|
631
|
+
_c = __values(this._array), _d = _c.next();
|
|
632
|
+
_g.label = 13;
|
|
633
|
+
case 13:
|
|
634
|
+
if (!!_d.done) return [3 /*break*/, 17];
|
|
614
635
|
item = _d.value;
|
|
615
636
|
return [4 /*yield*/, __await(item)];
|
|
616
|
-
case
|
|
617
|
-
case 14:
|
|
618
|
-
_g.sent();
|
|
619
|
-
_g.label = 15;
|
|
637
|
+
case 14: return [4 /*yield*/, _g.sent()];
|
|
620
638
|
case 15:
|
|
639
|
+
_g.sent();
|
|
640
|
+
_g.label = 16;
|
|
641
|
+
case 16:
|
|
621
642
|
_d = _c.next();
|
|
622
|
-
return [3 /*break*/,
|
|
623
|
-
case
|
|
624
|
-
case
|
|
643
|
+
return [3 /*break*/, 13];
|
|
644
|
+
case 17: return [3 /*break*/, 20];
|
|
645
|
+
case 18:
|
|
625
646
|
e_4_1 = _g.sent();
|
|
626
647
|
e_4 = { error: e_4_1 };
|
|
627
|
-
return [3 /*break*/,
|
|
628
|
-
case
|
|
648
|
+
return [3 /*break*/, 20];
|
|
649
|
+
case 19:
|
|
629
650
|
try {
|
|
630
651
|
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
631
652
|
}
|
|
632
653
|
finally { if (e_4) throw e_4.error; }
|
|
633
654
|
return [7 /*endfinally*/];
|
|
634
|
-
case
|
|
655
|
+
case 20:
|
|
656
|
+
this.callbacks.onReadEnd &&
|
|
657
|
+
this.callbacks.onReadEnd(this.clientId, agentName);
|
|
658
|
+
return [2 /*return*/];
|
|
635
659
|
}
|
|
636
660
|
});
|
|
637
661
|
});
|
package/build/index.mjs
CHANGED
|
@@ -487,6 +487,8 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
487
487
|
agentName: agentName,
|
|
488
488
|
});
|
|
489
489
|
if (!this.callbacks.onRead) return [3 /*break*/, 12];
|
|
490
|
+
this.callbacks.onReadBegin &&
|
|
491
|
+
this.callbacks.onReadBegin(this.clientId, agentName);
|
|
490
492
|
_g.label = 1;
|
|
491
493
|
case 1:
|
|
492
494
|
_g.trys.push([1, 8, 9, 10]);
|
|
@@ -495,7 +497,7 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
495
497
|
case 2:
|
|
496
498
|
if (!!_b.done) return [3 /*break*/, 7];
|
|
497
499
|
item = _b.value;
|
|
498
|
-
return [4 /*yield*/, __await(callbacks.filterCondition(item, this.clientId, agentName))];
|
|
500
|
+
return [4 /*yield*/, __await(this.callbacks.filterCondition(item, this.clientId, agentName))];
|
|
499
501
|
case 3:
|
|
500
502
|
if (!_g.sent()) return [3 /*break*/, 6];
|
|
501
503
|
this.callbacks.onRead(item, this.clientId, agentName);
|
|
@@ -518,38 +520,48 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
518
520
|
}
|
|
519
521
|
finally { if (e_1) throw e_1.error; }
|
|
520
522
|
return [7 /*endfinally*/];
|
|
521
|
-
case 10:
|
|
523
|
+
case 10:
|
|
524
|
+
this.callbacks.onReadEnd &&
|
|
525
|
+
this.callbacks.onReadEnd(this.clientId, agentName);
|
|
526
|
+
return [4 /*yield*/, __await(void 0)];
|
|
522
527
|
case 11: return [2 /*return*/, _g.sent()];
|
|
523
528
|
case 12:
|
|
524
|
-
|
|
525
|
-
|
|
529
|
+
this.callbacks.onReadBegin &&
|
|
530
|
+
this.callbacks.onReadBegin(this.clientId, agentName);
|
|
526
531
|
_g.label = 13;
|
|
527
532
|
case 13:
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
533
|
+
_g.trys.push([13, 20, 21, 22]);
|
|
534
|
+
_c = __values(this._array), _d = _c.next();
|
|
535
|
+
_g.label = 14;
|
|
531
536
|
case 14:
|
|
532
|
-
if (
|
|
537
|
+
if (!!_d.done) return [3 /*break*/, 19];
|
|
538
|
+
item = _d.value;
|
|
539
|
+
return [4 /*yield*/, __await(this.callbacks.filterCondition(item, this.clientId, agentName))];
|
|
540
|
+
case 15:
|
|
541
|
+
if (!_g.sent()) return [3 /*break*/, 18];
|
|
533
542
|
return [4 /*yield*/, __await(item)];
|
|
534
|
-
case
|
|
535
|
-
case 16:
|
|
536
|
-
_g.sent();
|
|
537
|
-
_g.label = 17;
|
|
543
|
+
case 16: return [4 /*yield*/, _g.sent()];
|
|
538
544
|
case 17:
|
|
545
|
+
_g.sent();
|
|
546
|
+
_g.label = 18;
|
|
547
|
+
case 18:
|
|
539
548
|
_d = _c.next();
|
|
540
|
-
return [3 /*break*/,
|
|
541
|
-
case
|
|
542
|
-
case
|
|
549
|
+
return [3 /*break*/, 14];
|
|
550
|
+
case 19: return [3 /*break*/, 22];
|
|
551
|
+
case 20:
|
|
543
552
|
e_2_1 = _g.sent();
|
|
544
553
|
e_2 = { error: e_2_1 };
|
|
545
|
-
return [3 /*break*/,
|
|
546
|
-
case
|
|
554
|
+
return [3 /*break*/, 22];
|
|
555
|
+
case 21:
|
|
547
556
|
try {
|
|
548
557
|
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
549
558
|
}
|
|
550
559
|
finally { if (e_2) throw e_2.error; }
|
|
551
560
|
return [7 /*endfinally*/];
|
|
552
|
-
case
|
|
561
|
+
case 22:
|
|
562
|
+
this.callbacks.onReadEnd &&
|
|
563
|
+
this.callbacks.onReadEnd(this.clientId, agentName);
|
|
564
|
+
return [2 /*return*/];
|
|
553
565
|
}
|
|
554
566
|
});
|
|
555
567
|
});
|
|
@@ -573,6 +585,8 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
573
585
|
agentName: agentName,
|
|
574
586
|
});
|
|
575
587
|
if (!this.callbacks.onRead) return [3 /*break*/, 11];
|
|
588
|
+
this.callbacks.onReadBegin &&
|
|
589
|
+
this.callbacks.onReadBegin(this.clientId, agentName);
|
|
576
590
|
_g.label = 1;
|
|
577
591
|
case 1:
|
|
578
592
|
_g.trys.push([1, 7, 8, 9]);
|
|
@@ -601,35 +615,45 @@ var HistoryInstance = /** @class */ (function () {
|
|
|
601
615
|
}
|
|
602
616
|
finally { if (e_3) throw e_3.error; }
|
|
603
617
|
return [7 /*endfinally*/];
|
|
604
|
-
case 9:
|
|
618
|
+
case 9:
|
|
619
|
+
this.callbacks.onReadEnd &&
|
|
620
|
+
this.callbacks.onReadEnd(this.clientId, agentName);
|
|
621
|
+
return [4 /*yield*/, __await(void 0)];
|
|
605
622
|
case 10: return [2 /*return*/, _g.sent()];
|
|
606
623
|
case 11:
|
|
607
|
-
|
|
608
|
-
|
|
624
|
+
this.callbacks.onReadBegin &&
|
|
625
|
+
this.callbacks.onReadBegin(this.clientId, agentName);
|
|
609
626
|
_g.label = 12;
|
|
610
627
|
case 12:
|
|
611
|
-
|
|
628
|
+
_g.trys.push([12, 18, 19, 20]);
|
|
629
|
+
_c = __values(this._array), _d = _c.next();
|
|
630
|
+
_g.label = 13;
|
|
631
|
+
case 13:
|
|
632
|
+
if (!!_d.done) return [3 /*break*/, 17];
|
|
612
633
|
item = _d.value;
|
|
613
634
|
return [4 /*yield*/, __await(item)];
|
|
614
|
-
case
|
|
615
|
-
case 14:
|
|
616
|
-
_g.sent();
|
|
617
|
-
_g.label = 15;
|
|
635
|
+
case 14: return [4 /*yield*/, _g.sent()];
|
|
618
636
|
case 15:
|
|
637
|
+
_g.sent();
|
|
638
|
+
_g.label = 16;
|
|
639
|
+
case 16:
|
|
619
640
|
_d = _c.next();
|
|
620
|
-
return [3 /*break*/,
|
|
621
|
-
case
|
|
622
|
-
case
|
|
641
|
+
return [3 /*break*/, 13];
|
|
642
|
+
case 17: return [3 /*break*/, 20];
|
|
643
|
+
case 18:
|
|
623
644
|
e_4_1 = _g.sent();
|
|
624
645
|
e_4 = { error: e_4_1 };
|
|
625
|
-
return [3 /*break*/,
|
|
626
|
-
case
|
|
646
|
+
return [3 /*break*/, 20];
|
|
647
|
+
case 19:
|
|
627
648
|
try {
|
|
628
649
|
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
629
650
|
}
|
|
630
651
|
finally { if (e_4) throw e_4.error; }
|
|
631
652
|
return [7 /*endfinally*/];
|
|
632
|
-
case
|
|
653
|
+
case 20:
|
|
654
|
+
this.callbacks.onReadEnd &&
|
|
655
|
+
this.callbacks.onReadEnd(this.clientId, agentName);
|
|
656
|
+
return [2 /*return*/];
|
|
633
657
|
}
|
|
634
658
|
});
|
|
635
659
|
});
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -401,12 +401,24 @@ interface IHistoryInstanceCallbacks {
|
|
|
401
401
|
*/
|
|
402
402
|
onChange: (data: IModelMessage[], clientId: string, agentName: AgentName) => void;
|
|
403
403
|
/**
|
|
404
|
-
* Callback for when the history is read.
|
|
404
|
+
* Callback for when the history is read. Will be called for each message
|
|
405
405
|
* @param message - The model message.
|
|
406
406
|
* @param clientId - The client ID.
|
|
407
407
|
* @param agentName - The agent name.
|
|
408
408
|
*/
|
|
409
409
|
onRead: (message: IModelMessage, clientId: string, agentName: AgentName) => void;
|
|
410
|
+
/**
|
|
411
|
+
* Callback for when the read is begin
|
|
412
|
+
* @param clientId - The client ID.
|
|
413
|
+
* @param agentName - The agent name.
|
|
414
|
+
*/
|
|
415
|
+
onReadBegin: (clientId: string, agentName: AgentName) => void;
|
|
416
|
+
/**
|
|
417
|
+
* Callback for when the read is end
|
|
418
|
+
* @param clientId - The client ID.
|
|
419
|
+
* @param agentName - The agent name.
|
|
420
|
+
*/
|
|
421
|
+
onReadEnd: (clientId: string, agentName: AgentName) => void;
|
|
410
422
|
/**
|
|
411
423
|
* Callback for when the history is disposed.
|
|
412
424
|
* @param clientId - The client ID.
|