@dudousxd/nestjs-agent 0.3.1 → 0.3.2
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/dist/durable/index.cjs +298 -236
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.js +241 -179
- package/dist/durable/index.js.map +1 -1
- package/dist/index.cjs +298 -236
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +241 -179
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
4
|
// src/agent.module.ts
|
|
5
|
-
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER5, AGENT_DEPS_FACTORY as
|
|
5
|
+
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER5, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY4, AGENT_DURABLE_RUNNER, AGENT_MODEL as AGENT_MODEL2, AGENT_OPTIONS as AGENT_OPTIONS3, AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS3, AGENT_QUOTA_STORE as AGENT_QUOTA_STORE3, AGENT_REGISTRY as AGENT_REGISTRY5, AGENT_ROLES_POLICY as AGENT_ROLES_POLICY2, AGENT_RUNNER as AGENT_RUNNER2, AGENT_SINK as AGENT_SINK2, AGENT_STORE as AGENT_STORE4, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY3, AgentRegistry as AgentRegistry5, DefaultRolesPolicy, ToolRegistry as ToolRegistry3 } from "@dudousxd/nestjs-agent-core";
|
|
6
6
|
import { Global, Module } from "@nestjs/common";
|
|
7
7
|
import { DiscoveryModule, RouterModule } from "@nestjs/core";
|
|
8
8
|
|
|
@@ -387,9 +387,9 @@ AgentService = _ts_decorate2([
|
|
|
387
387
|
])
|
|
388
388
|
], AgentService);
|
|
389
389
|
|
|
390
|
-
// src/controller/
|
|
391
|
-
import {
|
|
392
|
-
import {
|
|
390
|
+
// src/controller/agents.controller.ts
|
|
391
|
+
import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY2, AGENT_REGISTRY as AGENT_REGISTRY2, AgentRegistry as AgentRegistry3 } from "@dudousxd/nestjs-agent-core";
|
|
392
|
+
import { Controller, Get, Inject as Inject3 } from "@nestjs/common";
|
|
393
393
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
394
394
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
395
395
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -407,6 +407,64 @@ function _ts_param3(paramIndex, decorator) {
|
|
|
407
407
|
};
|
|
408
408
|
}
|
|
409
409
|
__name(_ts_param3, "_ts_param");
|
|
410
|
+
var AgentsController = class {
|
|
411
|
+
static {
|
|
412
|
+
__name(this, "AgentsController");
|
|
413
|
+
}
|
|
414
|
+
agents;
|
|
415
|
+
depsFactory;
|
|
416
|
+
constructor(agents, depsFactory) {
|
|
417
|
+
this.agents = agents;
|
|
418
|
+
this.depsFactory = depsFactory;
|
|
419
|
+
}
|
|
420
|
+
list() {
|
|
421
|
+
const defaultAgentName = this.depsFactory.defaultAgentName();
|
|
422
|
+
return this.agents.list().map((definition) => ({
|
|
423
|
+
name: definition.name,
|
|
424
|
+
description: definition.description ?? "",
|
|
425
|
+
...definition.name === defaultAgentName ? {
|
|
426
|
+
isDefault: true
|
|
427
|
+
} : {}
|
|
428
|
+
}));
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
_ts_decorate3([
|
|
432
|
+
Get(),
|
|
433
|
+
_ts_metadata3("design:type", Function),
|
|
434
|
+
_ts_metadata3("design:paramtypes", []),
|
|
435
|
+
_ts_metadata3("design:returntype", Array)
|
|
436
|
+
], AgentsController.prototype, "list", null);
|
|
437
|
+
AgentsController = _ts_decorate3([
|
|
438
|
+
Controller("agents"),
|
|
439
|
+
_ts_param3(0, Inject3(AGENT_REGISTRY2)),
|
|
440
|
+
_ts_param3(1, Inject3(AGENT_DEPS_FACTORY2)),
|
|
441
|
+
_ts_metadata3("design:type", Function),
|
|
442
|
+
_ts_metadata3("design:paramtypes", [
|
|
443
|
+
typeof AgentRegistry3 === "undefined" ? Object : AgentRegistry3,
|
|
444
|
+
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory
|
|
445
|
+
])
|
|
446
|
+
], AgentsController);
|
|
447
|
+
|
|
448
|
+
// src/controller/chat.controller.ts
|
|
449
|
+
import { AGENT_ACTOR_RESOLVER, AgentStreamError } from "@dudousxd/nestjs-agent-core";
|
|
450
|
+
import { Body, Controller as Controller2, Get as Get2, Inject as Inject4, Param, Post, Req, Res } from "@nestjs/common";
|
|
451
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
452
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
453
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
454
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
455
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
456
|
+
}
|
|
457
|
+
__name(_ts_decorate4, "_ts_decorate");
|
|
458
|
+
function _ts_metadata4(k, v) {
|
|
459
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
460
|
+
}
|
|
461
|
+
__name(_ts_metadata4, "_ts_metadata");
|
|
462
|
+
function _ts_param4(paramIndex, decorator) {
|
|
463
|
+
return function(target, key) {
|
|
464
|
+
decorator(target, key, paramIndex);
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
__name(_ts_param4, "_ts_param");
|
|
410
468
|
var ChatController = class {
|
|
411
469
|
static {
|
|
412
470
|
__name(this, "ChatController");
|
|
@@ -491,46 +549,46 @@ data: ${JSON.stringify(payload)}
|
|
|
491
549
|
res.end();
|
|
492
550
|
}
|
|
493
551
|
};
|
|
494
|
-
|
|
552
|
+
_ts_decorate4([
|
|
495
553
|
Post("chat"),
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
554
|
+
_ts_param4(0, Req()),
|
|
555
|
+
_ts_param4(1, Res()),
|
|
556
|
+
_ts_param4(2, Body()),
|
|
557
|
+
_ts_metadata4("design:type", Function),
|
|
558
|
+
_ts_metadata4("design:paramtypes", [
|
|
501
559
|
typeof Request === "undefined" ? Object : Request,
|
|
502
560
|
typeof Response === "undefined" ? Object : Response,
|
|
503
561
|
typeof ChatBody === "undefined" ? Object : ChatBody
|
|
504
562
|
]),
|
|
505
|
-
|
|
563
|
+
_ts_metadata4("design:returntype", Promise)
|
|
506
564
|
], ChatController.prototype, "chat", null);
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
565
|
+
_ts_decorate4([
|
|
566
|
+
Get2("chat/:runId/stream"),
|
|
567
|
+
_ts_param4(0, Param("runId")),
|
|
568
|
+
_ts_param4(1, Res()),
|
|
569
|
+
_ts_metadata4("design:type", Function),
|
|
570
|
+
_ts_metadata4("design:paramtypes", [
|
|
513
571
|
String,
|
|
514
572
|
typeof Response === "undefined" ? Object : Response
|
|
515
573
|
]),
|
|
516
|
-
|
|
574
|
+
_ts_metadata4("design:returntype", Promise)
|
|
517
575
|
], ChatController.prototype, "stream", null);
|
|
518
|
-
|
|
576
|
+
_ts_decorate4([
|
|
519
577
|
Post("chat/:runId/cancel"),
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
578
|
+
_ts_param4(0, Req()),
|
|
579
|
+
_ts_param4(1, Param("runId")),
|
|
580
|
+
_ts_metadata4("design:type", Function),
|
|
581
|
+
_ts_metadata4("design:paramtypes", [
|
|
524
582
|
typeof Request === "undefined" ? Object : Request,
|
|
525
583
|
String
|
|
526
584
|
]),
|
|
527
|
-
|
|
585
|
+
_ts_metadata4("design:returntype", Promise)
|
|
528
586
|
], ChatController.prototype, "cancel", null);
|
|
529
|
-
ChatController =
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
587
|
+
ChatController = _ts_decorate4([
|
|
588
|
+
Controller2(),
|
|
589
|
+
_ts_param4(1, Inject4(AGENT_ACTOR_RESOLVER)),
|
|
590
|
+
_ts_metadata4("design:type", Function),
|
|
591
|
+
_ts_metadata4("design:paramtypes", [
|
|
534
592
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
535
593
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
536
594
|
])
|
|
@@ -538,24 +596,24 @@ ChatController = _ts_decorate3([
|
|
|
538
596
|
|
|
539
597
|
// src/controller/quota.controller.ts
|
|
540
598
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER2 } from "@dudousxd/nestjs-agent-core";
|
|
541
|
-
import { Controller as
|
|
542
|
-
function
|
|
599
|
+
import { Controller as Controller3, Get as Get3, Inject as Inject5, Req as Req2 } from "@nestjs/common";
|
|
600
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
543
601
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
544
602
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
545
603
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
546
604
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
547
605
|
}
|
|
548
|
-
__name(
|
|
549
|
-
function
|
|
606
|
+
__name(_ts_decorate5, "_ts_decorate");
|
|
607
|
+
function _ts_metadata5(k, v) {
|
|
550
608
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
551
609
|
}
|
|
552
|
-
__name(
|
|
553
|
-
function
|
|
610
|
+
__name(_ts_metadata5, "_ts_metadata");
|
|
611
|
+
function _ts_param5(paramIndex, decorator) {
|
|
554
612
|
return function(target, key) {
|
|
555
613
|
decorator(target, key, paramIndex);
|
|
556
614
|
};
|
|
557
615
|
}
|
|
558
|
-
__name(
|
|
616
|
+
__name(_ts_param5, "_ts_param");
|
|
559
617
|
var QuotaController = class {
|
|
560
618
|
static {
|
|
561
619
|
__name(this, "QuotaController");
|
|
@@ -571,20 +629,20 @@ var QuotaController = class {
|
|
|
571
629
|
return this.agent.quotaToday(actor.id);
|
|
572
630
|
}
|
|
573
631
|
};
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
632
|
+
_ts_decorate5([
|
|
633
|
+
Get3("today"),
|
|
634
|
+
_ts_param5(0, Req2()),
|
|
635
|
+
_ts_metadata5("design:type", Function),
|
|
636
|
+
_ts_metadata5("design:paramtypes", [
|
|
579
637
|
typeof Request === "undefined" ? Object : Request
|
|
580
638
|
]),
|
|
581
|
-
|
|
639
|
+
_ts_metadata5("design:returntype", Promise)
|
|
582
640
|
], QuotaController.prototype, "today", null);
|
|
583
|
-
QuotaController =
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
641
|
+
QuotaController = _ts_decorate5([
|
|
642
|
+
Controller3("quota"),
|
|
643
|
+
_ts_param5(1, Inject5(AGENT_ACTOR_RESOLVER2)),
|
|
644
|
+
_ts_metadata5("design:type", Function),
|
|
645
|
+
_ts_metadata5("design:paramtypes", [
|
|
588
646
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
589
647
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
590
648
|
])
|
|
@@ -592,24 +650,24 @@ QuotaController = _ts_decorate4([
|
|
|
592
650
|
|
|
593
651
|
// src/controller/threads.controller.ts
|
|
594
652
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER3 } from "@dudousxd/nestjs-agent-core";
|
|
595
|
-
import { Body as Body2, Controller as
|
|
596
|
-
function
|
|
653
|
+
import { Body as Body2, Controller as Controller4, Delete, Get as Get4, Inject as Inject6, Param as Param2, Patch, Post as Post2, Req as Req3 } from "@nestjs/common";
|
|
654
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
597
655
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
598
656
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
599
657
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
600
658
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
601
659
|
}
|
|
602
|
-
__name(
|
|
603
|
-
function
|
|
660
|
+
__name(_ts_decorate6, "_ts_decorate");
|
|
661
|
+
function _ts_metadata6(k, v) {
|
|
604
662
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
605
663
|
}
|
|
606
|
-
__name(
|
|
607
|
-
function
|
|
664
|
+
__name(_ts_metadata6, "_ts_metadata");
|
|
665
|
+
function _ts_param6(paramIndex, decorator) {
|
|
608
666
|
return function(target, key) {
|
|
609
667
|
decorator(target, key, paramIndex);
|
|
610
668
|
};
|
|
611
669
|
}
|
|
612
|
-
__name(
|
|
670
|
+
__name(_ts_param6, "_ts_param");
|
|
613
671
|
var ThreadsController = class {
|
|
614
672
|
static {
|
|
615
673
|
__name(this, "ThreadsController");
|
|
@@ -661,92 +719,92 @@ var ThreadsController = class {
|
|
|
661
719
|
};
|
|
662
720
|
}
|
|
663
721
|
};
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
722
|
+
_ts_decorate6([
|
|
723
|
+
Get4(),
|
|
724
|
+
_ts_param6(0, Req3()),
|
|
725
|
+
_ts_metadata6("design:type", Function),
|
|
726
|
+
_ts_metadata6("design:paramtypes", [
|
|
669
727
|
typeof Request === "undefined" ? Object : Request
|
|
670
728
|
]),
|
|
671
|
-
|
|
729
|
+
_ts_metadata6("design:returntype", Promise)
|
|
672
730
|
], ThreadsController.prototype, "list", null);
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
731
|
+
_ts_decorate6([
|
|
732
|
+
Get4(":id"),
|
|
733
|
+
_ts_param6(0, Req3()),
|
|
734
|
+
_ts_param6(1, Param2("id")),
|
|
735
|
+
_ts_metadata6("design:type", Function),
|
|
736
|
+
_ts_metadata6("design:paramtypes", [
|
|
679
737
|
typeof Request === "undefined" ? Object : Request,
|
|
680
738
|
String
|
|
681
739
|
]),
|
|
682
|
-
|
|
740
|
+
_ts_metadata6("design:returntype", Promise)
|
|
683
741
|
], ThreadsController.prototype, "detail", null);
|
|
684
|
-
|
|
742
|
+
_ts_decorate6([
|
|
685
743
|
Delete(":id"),
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
744
|
+
_ts_param6(0, Req3()),
|
|
745
|
+
_ts_param6(1, Param2("id")),
|
|
746
|
+
_ts_metadata6("design:type", Function),
|
|
747
|
+
_ts_metadata6("design:paramtypes", [
|
|
690
748
|
typeof Request === "undefined" ? Object : Request,
|
|
691
749
|
String
|
|
692
750
|
]),
|
|
693
|
-
|
|
751
|
+
_ts_metadata6("design:returntype", Promise)
|
|
694
752
|
], ThreadsController.prototype, "remove", null);
|
|
695
|
-
|
|
753
|
+
_ts_decorate6([
|
|
696
754
|
Post2(":id/fork-from/:messageId"),
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
755
|
+
_ts_param6(0, Req3()),
|
|
756
|
+
_ts_param6(1, Param2("id")),
|
|
757
|
+
_ts_param6(2, Param2("messageId")),
|
|
758
|
+
_ts_metadata6("design:type", Function),
|
|
759
|
+
_ts_metadata6("design:paramtypes", [
|
|
702
760
|
typeof Request === "undefined" ? Object : Request,
|
|
703
761
|
String,
|
|
704
762
|
String
|
|
705
763
|
]),
|
|
706
|
-
|
|
764
|
+
_ts_metadata6("design:returntype", Promise)
|
|
707
765
|
], ThreadsController.prototype, "fork", null);
|
|
708
|
-
|
|
766
|
+
_ts_decorate6([
|
|
709
767
|
Patch(":id"),
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
768
|
+
_ts_param6(0, Req3()),
|
|
769
|
+
_ts_param6(1, Param2("id")),
|
|
770
|
+
_ts_param6(2, Body2()),
|
|
771
|
+
_ts_metadata6("design:type", Function),
|
|
772
|
+
_ts_metadata6("design:paramtypes", [
|
|
715
773
|
typeof Request === "undefined" ? Object : Request,
|
|
716
774
|
String,
|
|
717
775
|
typeof RenameThreadBody === "undefined" ? Object : RenameThreadBody
|
|
718
776
|
]),
|
|
719
|
-
|
|
777
|
+
_ts_metadata6("design:returntype", Promise)
|
|
720
778
|
], ThreadsController.prototype, "rename", null);
|
|
721
|
-
|
|
779
|
+
_ts_decorate6([
|
|
722
780
|
Post2(":id/promote"),
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
781
|
+
_ts_param6(0, Req3()),
|
|
782
|
+
_ts_param6(1, Param2("id")),
|
|
783
|
+
_ts_metadata6("design:type", Function),
|
|
784
|
+
_ts_metadata6("design:paramtypes", [
|
|
727
785
|
typeof Request === "undefined" ? Object : Request,
|
|
728
786
|
String
|
|
729
787
|
]),
|
|
730
|
-
|
|
788
|
+
_ts_metadata6("design:returntype", Promise)
|
|
731
789
|
], ThreadsController.prototype, "promote", null);
|
|
732
|
-
|
|
790
|
+
_ts_decorate6([
|
|
733
791
|
Delete(":id/from/:messageId"),
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
792
|
+
_ts_param6(0, Req3()),
|
|
793
|
+
_ts_param6(1, Param2("id")),
|
|
794
|
+
_ts_param6(2, Param2("messageId")),
|
|
795
|
+
_ts_metadata6("design:type", Function),
|
|
796
|
+
_ts_metadata6("design:paramtypes", [
|
|
739
797
|
typeof Request === "undefined" ? Object : Request,
|
|
740
798
|
String,
|
|
741
799
|
String
|
|
742
800
|
]),
|
|
743
|
-
|
|
801
|
+
_ts_metadata6("design:returntype", Promise)
|
|
744
802
|
], ThreadsController.prototype, "truncateFrom", null);
|
|
745
|
-
ThreadsController =
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
803
|
+
ThreadsController = _ts_decorate6([
|
|
804
|
+
Controller4("threads"),
|
|
805
|
+
_ts_param6(1, Inject6(AGENT_ACTOR_RESOLVER3)),
|
|
806
|
+
_ts_metadata6("design:type", Function),
|
|
807
|
+
_ts_metadata6("design:paramtypes", [
|
|
750
808
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
751
809
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
752
810
|
])
|
|
@@ -754,24 +812,24 @@ ThreadsController = _ts_decorate5([
|
|
|
754
812
|
|
|
755
813
|
// src/controller/tool-call.controller.ts
|
|
756
814
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER4 } from "@dudousxd/nestjs-agent-core";
|
|
757
|
-
import { Body as Body3, Controller as
|
|
758
|
-
function
|
|
815
|
+
import { Body as Body3, Controller as Controller5, Inject as Inject7, Post as Post3, Req as Req4 } from "@nestjs/common";
|
|
816
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
759
817
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
760
818
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
761
819
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
762
820
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
763
821
|
}
|
|
764
|
-
__name(
|
|
765
|
-
function
|
|
822
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
823
|
+
function _ts_metadata7(k, v) {
|
|
766
824
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
767
825
|
}
|
|
768
|
-
__name(
|
|
769
|
-
function
|
|
826
|
+
__name(_ts_metadata7, "_ts_metadata");
|
|
827
|
+
function _ts_param7(paramIndex, decorator) {
|
|
770
828
|
return function(target, key) {
|
|
771
829
|
decorator(target, key, paramIndex);
|
|
772
830
|
};
|
|
773
831
|
}
|
|
774
|
-
__name(
|
|
832
|
+
__name(_ts_param7, "_ts_param");
|
|
775
833
|
var ToolCallController = class {
|
|
776
834
|
static {
|
|
777
835
|
__name(this, "ToolCallController");
|
|
@@ -797,41 +855,41 @@ var ToolCallController = class {
|
|
|
797
855
|
};
|
|
798
856
|
}
|
|
799
857
|
};
|
|
800
|
-
|
|
858
|
+
_ts_decorate7([
|
|
801
859
|
Post3("approve"),
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
860
|
+
_ts_param7(0, Req4()),
|
|
861
|
+
_ts_param7(1, Body3()),
|
|
862
|
+
_ts_metadata7("design:type", Function),
|
|
863
|
+
_ts_metadata7("design:paramtypes", [
|
|
806
864
|
typeof Request === "undefined" ? Object : Request,
|
|
807
865
|
typeof ApproveBody === "undefined" ? Object : ApproveBody
|
|
808
866
|
]),
|
|
809
|
-
|
|
867
|
+
_ts_metadata7("design:returntype", Promise)
|
|
810
868
|
], ToolCallController.prototype, "approve", null);
|
|
811
|
-
|
|
869
|
+
_ts_decorate7([
|
|
812
870
|
Post3("reject"),
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
871
|
+
_ts_param7(0, Req4()),
|
|
872
|
+
_ts_param7(1, Body3()),
|
|
873
|
+
_ts_metadata7("design:type", Function),
|
|
874
|
+
_ts_metadata7("design:paramtypes", [
|
|
817
875
|
typeof Request === "undefined" ? Object : Request,
|
|
818
876
|
typeof RejectBody === "undefined" ? Object : RejectBody
|
|
819
877
|
]),
|
|
820
|
-
|
|
878
|
+
_ts_metadata7("design:returntype", Promise)
|
|
821
879
|
], ToolCallController.prototype, "reject", null);
|
|
822
|
-
ToolCallController =
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
880
|
+
ToolCallController = _ts_decorate7([
|
|
881
|
+
Controller5("tool-call"),
|
|
882
|
+
_ts_param7(1, Inject7(AGENT_ACTOR_RESOLVER4)),
|
|
883
|
+
_ts_metadata7("design:type", Function),
|
|
884
|
+
_ts_metadata7("design:paramtypes", [
|
|
827
885
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
828
886
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
829
887
|
])
|
|
830
888
|
], ToolCallController);
|
|
831
889
|
|
|
832
890
|
// src/discovery/agent-discovery.service.ts
|
|
833
|
-
import { AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS2, AGENT_REGISTRY as
|
|
834
|
-
import { Inject as
|
|
891
|
+
import { AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS2, AGENT_REGISTRY as AGENT_REGISTRY3, AgentRegistry as AgentRegistry4 } from "@dudousxd/nestjs-agent-core";
|
|
892
|
+
import { Inject as Inject8, Injectable as Injectable3, Logger } from "@nestjs/common";
|
|
835
893
|
import { DiscoveryService, MetadataScanner } from "@nestjs/core";
|
|
836
894
|
|
|
837
895
|
// src/decorator/agent.decorator.ts
|
|
@@ -866,23 +924,23 @@ function SystemPromptContributor() {
|
|
|
866
924
|
__name(SystemPromptContributor, "SystemPromptContributor");
|
|
867
925
|
|
|
868
926
|
// src/discovery/agent-discovery.service.ts
|
|
869
|
-
function
|
|
927
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
870
928
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
871
929
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
872
930
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
873
931
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
874
932
|
}
|
|
875
|
-
__name(
|
|
876
|
-
function
|
|
933
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
934
|
+
function _ts_metadata8(k, v) {
|
|
877
935
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
878
936
|
}
|
|
879
|
-
__name(
|
|
880
|
-
function
|
|
937
|
+
__name(_ts_metadata8, "_ts_metadata");
|
|
938
|
+
function _ts_param8(paramIndex, decorator) {
|
|
881
939
|
return function(target, key) {
|
|
882
940
|
decorator(target, key, paramIndex);
|
|
883
941
|
};
|
|
884
942
|
}
|
|
885
|
-
__name(
|
|
943
|
+
__name(_ts_param8, "_ts_param");
|
|
886
944
|
var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
887
945
|
static {
|
|
888
946
|
__name(this, "AgentDiscoveryService");
|
|
@@ -917,6 +975,9 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
917
975
|
const systemPrompt = promptMethod !== void 0 ? (ctx) => promptMethod(ctx) : meta.systemPrompt ?? "You are a helpful assistant.";
|
|
918
976
|
return {
|
|
919
977
|
name: meta.name,
|
|
978
|
+
...meta.description !== void 0 ? {
|
|
979
|
+
description: meta.description
|
|
980
|
+
} : {},
|
|
920
981
|
systemPrompt,
|
|
921
982
|
...meta.tools !== void 0 ? {
|
|
922
983
|
tools: meta.tools
|
|
@@ -976,22 +1037,22 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
976
1037
|
return (ctx) => candidate.call(instance, ctx);
|
|
977
1038
|
}
|
|
978
1039
|
};
|
|
979
|
-
AgentDiscoveryService =
|
|
1040
|
+
AgentDiscoveryService = _ts_decorate8([
|
|
980
1041
|
Injectable3(),
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1042
|
+
_ts_param8(2, Inject8(AGENT_REGISTRY3)),
|
|
1043
|
+
_ts_param8(3, Inject8(AGENT_PROMPT_CONTRIBUTORS2)),
|
|
1044
|
+
_ts_metadata8("design:type", Function),
|
|
1045
|
+
_ts_metadata8("design:paramtypes", [
|
|
985
1046
|
typeof DiscoveryService === "undefined" ? Object : DiscoveryService,
|
|
986
1047
|
typeof MetadataScanner === "undefined" ? Object : MetadataScanner,
|
|
987
|
-
typeof
|
|
1048
|
+
typeof AgentRegistry4 === "undefined" ? Object : AgentRegistry4,
|
|
988
1049
|
Array
|
|
989
1050
|
])
|
|
990
1051
|
], AgentDiscoveryService);
|
|
991
1052
|
|
|
992
1053
|
// src/discovery/ai-tool-discovery.service.ts
|
|
993
|
-
import { AGENT_OPTIONS as AGENT_OPTIONS2, AGENT_REGISTRY as
|
|
994
|
-
import { Inject as
|
|
1054
|
+
import { AGENT_OPTIONS as AGENT_OPTIONS2, AGENT_REGISTRY as AGENT_REGISTRY4, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY2 } from "@dudousxd/nestjs-agent-core";
|
|
1055
|
+
import { Inject as Inject9, Injectable as Injectable4, Logger as Logger2 } from "@nestjs/common";
|
|
995
1056
|
import { DiscoveryService as DiscoveryService2 } from "@nestjs/core";
|
|
996
1057
|
import { z } from "zod";
|
|
997
1058
|
|
|
@@ -1040,23 +1101,23 @@ function provideAgentTool(factoryOrTool, inject) {
|
|
|
1040
1101
|
__name(provideAgentTool, "provideAgentTool");
|
|
1041
1102
|
|
|
1042
1103
|
// src/discovery/ai-tool-discovery.service.ts
|
|
1043
|
-
function
|
|
1104
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
1044
1105
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1045
1106
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1046
1107
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1047
1108
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1048
1109
|
}
|
|
1049
|
-
__name(
|
|
1050
|
-
function
|
|
1110
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
1111
|
+
function _ts_metadata9(k, v) {
|
|
1051
1112
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1052
1113
|
}
|
|
1053
|
-
__name(
|
|
1054
|
-
function
|
|
1114
|
+
__name(_ts_metadata9, "_ts_metadata");
|
|
1115
|
+
function _ts_param9(paramIndex, decorator) {
|
|
1055
1116
|
return function(target, key) {
|
|
1056
1117
|
decorator(target, key, paramIndex);
|
|
1057
1118
|
};
|
|
1058
1119
|
}
|
|
1059
|
-
__name(
|
|
1120
|
+
__name(_ts_param9, "_ts_param");
|
|
1060
1121
|
var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
1061
1122
|
static {
|
|
1062
1123
|
__name(this, "AiToolDiscoveryService");
|
|
@@ -1163,13 +1224,13 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
1163
1224
|
return true;
|
|
1164
1225
|
}
|
|
1165
1226
|
};
|
|
1166
|
-
AiToolDiscoveryService =
|
|
1227
|
+
AiToolDiscoveryService = _ts_decorate9([
|
|
1167
1228
|
Injectable4(),
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1229
|
+
_ts_param9(1, Inject9(AGENT_TOOL_REGISTRY2)),
|
|
1230
|
+
_ts_param9(2, Inject9(AGENT_REGISTRY4)),
|
|
1231
|
+
_ts_param9(3, Inject9(AGENT_OPTIONS2)),
|
|
1232
|
+
_ts_metadata9("design:type", Function),
|
|
1233
|
+
_ts_metadata9("design:paramtypes", [
|
|
1173
1234
|
typeof DiscoveryService2 === "undefined" ? Object : DiscoveryService2,
|
|
1174
1235
|
typeof ToolRegistry === "undefined" ? Object : ToolRegistry,
|
|
1175
1236
|
typeof AgentRegistry === "undefined" ? Object : AgentRegistry,
|
|
@@ -1269,25 +1330,25 @@ var LedgerQuotaStore = class {
|
|
|
1269
1330
|
};
|
|
1270
1331
|
|
|
1271
1332
|
// src/runner/inline-agent-runner.ts
|
|
1272
|
-
import { AGENT_DEPS_FACTORY as
|
|
1273
|
-
import { Inject as
|
|
1274
|
-
function
|
|
1333
|
+
import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY3, AGENT_STORE as AGENT_STORE3, QuotaExceededError, publishAgentRunFailed, runAgentLoop } from "@dudousxd/nestjs-agent-core";
|
|
1334
|
+
import { Inject as Inject10, Injectable as Injectable5, Logger as Logger3 } from "@nestjs/common";
|
|
1335
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
1275
1336
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1276
1337
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1277
1338
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1278
1339
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1279
1340
|
}
|
|
1280
|
-
__name(
|
|
1281
|
-
function
|
|
1341
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
1342
|
+
function _ts_metadata10(k, v) {
|
|
1282
1343
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1283
1344
|
}
|
|
1284
|
-
__name(
|
|
1285
|
-
function
|
|
1345
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
1346
|
+
function _ts_param10(paramIndex, decorator) {
|
|
1286
1347
|
return function(target, key) {
|
|
1287
1348
|
decorator(target, key, paramIndex);
|
|
1288
1349
|
};
|
|
1289
1350
|
}
|
|
1290
|
-
__name(
|
|
1351
|
+
__name(_ts_param10, "_ts_param");
|
|
1291
1352
|
var InlineAgentRunner = class _InlineAgentRunner {
|
|
1292
1353
|
static {
|
|
1293
1354
|
__name(this, "InlineAgentRunner");
|
|
@@ -1388,25 +1449,25 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
1388
1449
|
}, hooks);
|
|
1389
1450
|
}
|
|
1390
1451
|
};
|
|
1391
|
-
InlineAgentRunner =
|
|
1452
|
+
InlineAgentRunner = _ts_decorate10([
|
|
1392
1453
|
Injectable5(),
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1454
|
+
_ts_param10(0, Inject10(AGENT_DEPS_FACTORY3)),
|
|
1455
|
+
_ts_param10(1, Inject10(AGENT_STORE3)),
|
|
1456
|
+
_ts_metadata10("design:type", Function),
|
|
1457
|
+
_ts_metadata10("design:paramtypes", [
|
|
1397
1458
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
1398
1459
|
typeof AgentStore === "undefined" ? Object : AgentStore
|
|
1399
1460
|
])
|
|
1400
1461
|
], InlineAgentRunner);
|
|
1401
1462
|
|
|
1402
1463
|
// src/agent.module.ts
|
|
1403
|
-
function
|
|
1464
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
1404
1465
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1405
1466
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1406
1467
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1407
1468
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1408
1469
|
}
|
|
1409
|
-
__name(
|
|
1470
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
1410
1471
|
var DEFAULT_PATH = "agent";
|
|
1411
1472
|
function sharedProviders(durable, includeStore) {
|
|
1412
1473
|
const providers = [
|
|
@@ -1416,8 +1477,8 @@ function sharedProviders(durable, includeStore) {
|
|
|
1416
1477
|
},
|
|
1417
1478
|
// Starts empty; AgentDiscoveryService populates it from `@Agent`-decorated providers at boot.
|
|
1418
1479
|
{
|
|
1419
|
-
provide:
|
|
1420
|
-
useFactory: /* @__PURE__ */ __name(() => new
|
|
1480
|
+
provide: AGENT_REGISTRY5,
|
|
1481
|
+
useFactory: /* @__PURE__ */ __name(() => new AgentRegistry5(), "useFactory")
|
|
1421
1482
|
},
|
|
1422
1483
|
// A shared, mutable list AgentDiscoveryService fills with `@SystemPromptContributor()` methods.
|
|
1423
1484
|
{
|
|
@@ -1465,7 +1526,7 @@ function sharedProviders(durable, includeStore) {
|
|
|
1465
1526
|
},
|
|
1466
1527
|
AgentDepsFactory2,
|
|
1467
1528
|
{
|
|
1468
|
-
provide:
|
|
1529
|
+
provide: AGENT_DEPS_FACTORY4,
|
|
1469
1530
|
useExisting: AgentDepsFactory2
|
|
1470
1531
|
},
|
|
1471
1532
|
// Populates the registry + contributors (onModuleInit) BEFORE AiToolDiscoveryService synthesizes
|
|
@@ -1513,7 +1574,7 @@ function exportsFor(includeStore) {
|
|
|
1513
1574
|
return [
|
|
1514
1575
|
AGENT_OPTIONS3,
|
|
1515
1576
|
AGENT_TOOL_REGISTRY3,
|
|
1516
|
-
|
|
1577
|
+
AGENT_REGISTRY5,
|
|
1517
1578
|
AGENT_SINK2,
|
|
1518
1579
|
AGENT_ROLES_POLICY2,
|
|
1519
1580
|
AGENT_ACTOR_RESOLVER5,
|
|
@@ -1523,7 +1584,7 @@ function exportsFor(includeStore) {
|
|
|
1523
1584
|
] : [],
|
|
1524
1585
|
AGENT_QUOTA_STORE3,
|
|
1525
1586
|
AGENT_PROMPT_CONTRIBUTORS3,
|
|
1526
|
-
|
|
1587
|
+
AGENT_DEPS_FACTORY4,
|
|
1527
1588
|
AgentDepsFactory2,
|
|
1528
1589
|
AgentService,
|
|
1529
1590
|
InlineAgentRunner
|
|
@@ -1534,7 +1595,8 @@ var CONTROLLERS = [
|
|
|
1534
1595
|
ChatController,
|
|
1535
1596
|
ThreadsController,
|
|
1536
1597
|
ToolCallController,
|
|
1537
|
-
QuotaController
|
|
1598
|
+
QuotaController,
|
|
1599
|
+
AgentsController
|
|
1538
1600
|
];
|
|
1539
1601
|
function routerFor(path) {
|
|
1540
1602
|
return RouterModule.register([
|
|
@@ -1595,7 +1657,7 @@ var AgentModule = class _AgentModule {
|
|
|
1595
1657
|
};
|
|
1596
1658
|
}
|
|
1597
1659
|
};
|
|
1598
|
-
AgentModule =
|
|
1660
|
+
AgentModule = _ts_decorate11([
|
|
1599
1661
|
Global(),
|
|
1600
1662
|
Module({})
|
|
1601
1663
|
], AgentModule);
|