@dudousxd/nestjs-agent 0.4.1 → 0.6.0
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/{agent-deps.factory-BM_RB6br.d.cts → agent-deps.factory-BlC9tumI.d.cts} +24 -0
- package/dist/{agent-deps.factory-BM_RB6br.d.ts → agent-deps.factory-BlC9tumI.d.ts} +24 -0
- package/dist/durable/index.cjs +701 -459
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.d.cts +76 -12
- package/dist/durable/index.d.ts +76 -12
- package/dist/durable/index.js +614 -374
- package/dist/durable/index.js.map +1 -1
- package/dist/index.cjs +327 -226
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -9
- package/dist/index.d.ts +48 -9
- package/dist/index.js +244 -144
- 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_RESOLVER6, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY4, AGENT_DURABLE_RUNNER, AGENT_MODEL as AGENT_MODEL2, AGENT_OPTIONS as AGENT_OPTIONS4, 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";
|
|
5
|
+
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER6, AGENT_APPROVAL_PORT, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY4, AGENT_DURABLE_RUNNER, AGENT_MODEL as AGENT_MODEL2, AGENT_OPTIONS as AGENT_OPTIONS4, 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
|
|
|
@@ -258,20 +258,32 @@ var AgentService = class {
|
|
|
258
258
|
return this.deps.forAgent().sink.subscribe(runId);
|
|
259
259
|
}
|
|
260
260
|
async approve(actor, toolCallId) {
|
|
261
|
-
|
|
262
|
-
return this.
|
|
261
|
+
await this.assertOwnsToolCall(actor, toolCallId);
|
|
262
|
+
return this.signalToolCall(toolCallId, {
|
|
263
263
|
approved: true
|
|
264
264
|
});
|
|
265
265
|
}
|
|
266
266
|
async reject(actor, toolCallId, reason) {
|
|
267
|
-
|
|
268
|
-
return this.
|
|
267
|
+
await this.assertOwnsToolCall(actor, toolCallId);
|
|
268
|
+
return this.signalToolCall(toolCallId, {
|
|
269
269
|
approved: false,
|
|
270
270
|
...reason !== void 0 ? {
|
|
271
271
|
reason
|
|
272
272
|
} : {}
|
|
273
273
|
});
|
|
274
274
|
}
|
|
275
|
+
/**
|
|
276
|
+
* The decision core behind approve/reject, WITHOUT an ownership check: resolves the run
|
|
277
|
+
* currently awaiting `toolCallId` and signals it. `approve`/`reject` above call this after their
|
|
278
|
+
* own `assertOwnsToolCall` gate; the console `AgentApprovalPort` adapter (bound by `AgentModule`)
|
|
279
|
+
* calls it directly — a console caller is already authorized by the dashboard's own guards, and
|
|
280
|
+
* re-deriving thread ownership here would reject a legitimate operator decision (an operator is
|
|
281
|
+
* not the thread's own actor).
|
|
282
|
+
*/
|
|
283
|
+
async signalToolCall(toolCallId, decision) {
|
|
284
|
+
const runId = await this.resolveRunForToolCall(toolCallId);
|
|
285
|
+
return this.runner.signal(runId, toolCallId, decision);
|
|
286
|
+
}
|
|
275
287
|
async cancel(actor, runId) {
|
|
276
288
|
await this.assertOwnsActiveStream(actor, runId);
|
|
277
289
|
return this.runner.cancel(runId);
|
|
@@ -419,12 +431,11 @@ var AgentService = class {
|
|
|
419
431
|
}
|
|
420
432
|
}
|
|
421
433
|
/**
|
|
422
|
-
* Authorization
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
* never knows or supplies a runId; it is derived here from the tool call alone.
|
|
434
|
+
* Authorization seam for HITL approve/reject: the caller must own the tool call's thread. Split
|
|
435
|
+
* out from run resolution (see {@link resolveRunForToolCall}) so the console `AgentApprovalPort`
|
|
436
|
+
* adapter can resolve+signal a decision WITHOUT this check — it is authorized upstream instead.
|
|
426
437
|
*/
|
|
427
|
-
async
|
|
438
|
+
async assertOwnsToolCall(actor, toolCallId) {
|
|
428
439
|
const owner = await this.store.ownerOfToolCall(toolCallId);
|
|
429
440
|
if (owner === null) {
|
|
430
441
|
throw new NotFoundException(`tool call ${toolCallId} not found`);
|
|
@@ -432,6 +443,13 @@ var AgentService = class {
|
|
|
432
443
|
if (owner !== actor.id) {
|
|
433
444
|
throw new ForbiddenException("tool call belongs to another actor");
|
|
434
445
|
}
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Resolve the run currently awaiting `toolCallId` (its thread's active stream). That run is the
|
|
449
|
+
* sub-agent's own child run when the pending call belongs to a delegated agent — the client never
|
|
450
|
+
* knows or supplies a runId; it is derived here from the tool call alone.
|
|
451
|
+
*/
|
|
452
|
+
async resolveRunForToolCall(toolCallId) {
|
|
435
453
|
const runId = await this.store.runForToolCall(toolCallId);
|
|
436
454
|
if (runId === null) {
|
|
437
455
|
throw new NotFoundException(`tool call ${toolCallId} has no active run to signal`);
|
|
@@ -464,9 +482,8 @@ AgentService = _ts_decorate2([
|
|
|
464
482
|
])
|
|
465
483
|
], AgentService);
|
|
466
484
|
|
|
467
|
-
// src/
|
|
468
|
-
import {
|
|
469
|
-
import { Controller, Get, Inject as Inject3 } from "@nestjs/common";
|
|
485
|
+
// src/approval-port.adapter.ts
|
|
486
|
+
import { Injectable as Injectable3 } from "@nestjs/common";
|
|
470
487
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
471
488
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
472
489
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -478,6 +495,56 @@ function _ts_metadata3(k, v) {
|
|
|
478
495
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
479
496
|
}
|
|
480
497
|
__name(_ts_metadata3, "_ts_metadata");
|
|
498
|
+
var AgentApprovalPortAdapter = class {
|
|
499
|
+
static {
|
|
500
|
+
__name(this, "AgentApprovalPortAdapter");
|
|
501
|
+
}
|
|
502
|
+
agent;
|
|
503
|
+
constructor(agent) {
|
|
504
|
+
this.agent = agent;
|
|
505
|
+
}
|
|
506
|
+
async approve(toolCallId, opts) {
|
|
507
|
+
await this.agent.signalToolCall(toolCallId, {
|
|
508
|
+
approved: true,
|
|
509
|
+
...opts?.executedByRef !== void 0 ? {
|
|
510
|
+
executedByRef: opts.executedByRef
|
|
511
|
+
} : {}
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
async reject(toolCallId, opts) {
|
|
515
|
+
await this.agent.signalToolCall(toolCallId, {
|
|
516
|
+
approved: false,
|
|
517
|
+
...opts?.executedByRef !== void 0 ? {
|
|
518
|
+
executedByRef: opts.executedByRef
|
|
519
|
+
} : {},
|
|
520
|
+
...opts?.reason !== void 0 ? {
|
|
521
|
+
reason: opts.reason
|
|
522
|
+
} : {}
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
AgentApprovalPortAdapter = _ts_decorate3([
|
|
527
|
+
Injectable3(),
|
|
528
|
+
_ts_metadata3("design:type", Function),
|
|
529
|
+
_ts_metadata3("design:paramtypes", [
|
|
530
|
+
typeof AgentService === "undefined" ? Object : AgentService
|
|
531
|
+
])
|
|
532
|
+
], AgentApprovalPortAdapter);
|
|
533
|
+
|
|
534
|
+
// src/controller/agents.controller.ts
|
|
535
|
+
import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY2, AGENT_REGISTRY as AGENT_REGISTRY2, AgentRegistry as AgentRegistry3 } from "@dudousxd/nestjs-agent-core";
|
|
536
|
+
import { Controller, Get, Inject as Inject3 } from "@nestjs/common";
|
|
537
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
538
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
539
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
540
|
+
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;
|
|
541
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
542
|
+
}
|
|
543
|
+
__name(_ts_decorate4, "_ts_decorate");
|
|
544
|
+
function _ts_metadata4(k, v) {
|
|
545
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
546
|
+
}
|
|
547
|
+
__name(_ts_metadata4, "_ts_metadata");
|
|
481
548
|
function _ts_param3(paramIndex, decorator) {
|
|
482
549
|
return function(target, key) {
|
|
483
550
|
decorator(target, key, paramIndex);
|
|
@@ -505,18 +572,18 @@ var AgentsController = class {
|
|
|
505
572
|
}));
|
|
506
573
|
}
|
|
507
574
|
};
|
|
508
|
-
|
|
575
|
+
_ts_decorate4([
|
|
509
576
|
Get(),
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
577
|
+
_ts_metadata4("design:type", Function),
|
|
578
|
+
_ts_metadata4("design:paramtypes", []),
|
|
579
|
+
_ts_metadata4("design:returntype", Array)
|
|
513
580
|
], AgentsController.prototype, "list", null);
|
|
514
|
-
AgentsController =
|
|
581
|
+
AgentsController = _ts_decorate4([
|
|
515
582
|
Controller("agents"),
|
|
516
583
|
_ts_param3(0, Inject3(AGENT_REGISTRY2)),
|
|
517
584
|
_ts_param3(1, Inject3(AGENT_DEPS_FACTORY2)),
|
|
518
|
-
|
|
519
|
-
|
|
585
|
+
_ts_metadata4("design:type", Function),
|
|
586
|
+
_ts_metadata4("design:paramtypes", [
|
|
520
587
|
typeof AgentRegistry3 === "undefined" ? Object : AgentRegistry3,
|
|
521
588
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory
|
|
522
589
|
])
|
|
@@ -526,17 +593,17 @@ AgentsController = _ts_decorate3([
|
|
|
526
593
|
import { AGENT_ACTOR_RESOLVER, AGENT_ATTACHMENT_STAGING, AGENT_OPTIONS as AGENT_OPTIONS2 } from "@dudousxd/nestjs-agent-core";
|
|
527
594
|
import { BadRequestException as BadRequestException2, Controller as Controller2, Inject as Inject4, NotImplementedException as NotImplementedException2, Optional as Optional2, PayloadTooLargeException, Post, Req, UnsupportedMediaTypeException, UploadedFile, UseInterceptors } from "@nestjs/common";
|
|
528
595
|
import { FileInterceptor } from "@nestjs/platform-express";
|
|
529
|
-
function
|
|
596
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
530
597
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
531
598
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
532
599
|
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;
|
|
533
600
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
534
601
|
}
|
|
535
|
-
__name(
|
|
536
|
-
function
|
|
602
|
+
__name(_ts_decorate5, "_ts_decorate");
|
|
603
|
+
function _ts_metadata5(k, v) {
|
|
537
604
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
538
605
|
}
|
|
539
|
-
__name(
|
|
606
|
+
__name(_ts_metadata5, "_ts_metadata");
|
|
540
607
|
function _ts_param4(paramIndex, decorator) {
|
|
541
608
|
return function(target, key) {
|
|
542
609
|
decorator(target, key, paramIndex);
|
|
@@ -601,26 +668,26 @@ var AttachmentsController = class {
|
|
|
601
668
|
});
|
|
602
669
|
}
|
|
603
670
|
};
|
|
604
|
-
|
|
671
|
+
_ts_decorate5([
|
|
605
672
|
Post(),
|
|
606
673
|
UseInterceptors(FileInterceptor("file")),
|
|
607
674
|
_ts_param4(0, Req()),
|
|
608
675
|
_ts_param4(1, UploadedFile()),
|
|
609
|
-
|
|
610
|
-
|
|
676
|
+
_ts_metadata5("design:type", Function),
|
|
677
|
+
_ts_metadata5("design:paramtypes", [
|
|
611
678
|
typeof Request === "undefined" ? Object : Request,
|
|
612
679
|
Object
|
|
613
680
|
]),
|
|
614
|
-
|
|
681
|
+
_ts_metadata5("design:returntype", Promise)
|
|
615
682
|
], AttachmentsController.prototype, "upload", null);
|
|
616
|
-
AttachmentsController =
|
|
683
|
+
AttachmentsController = _ts_decorate5([
|
|
617
684
|
Controller2("attachments"),
|
|
618
685
|
_ts_param4(0, Inject4(AGENT_OPTIONS2)),
|
|
619
686
|
_ts_param4(1, Inject4(AGENT_ACTOR_RESOLVER)),
|
|
620
687
|
_ts_param4(2, Optional2()),
|
|
621
688
|
_ts_param4(2, Inject4(AGENT_ATTACHMENT_STAGING)),
|
|
622
|
-
|
|
623
|
-
|
|
689
|
+
_ts_metadata5("design:type", Function),
|
|
690
|
+
_ts_metadata5("design:paramtypes", [
|
|
624
691
|
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
625
692
|
typeof ActorResolver === "undefined" ? Object : ActorResolver,
|
|
626
693
|
Object
|
|
@@ -630,17 +697,17 @@ AttachmentsController = _ts_decorate4([
|
|
|
630
697
|
// src/controller/chat.controller.ts
|
|
631
698
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER2, AgentStreamError } from "@dudousxd/nestjs-agent-core";
|
|
632
699
|
import { Body, Controller as Controller3, Get as Get2, Inject as Inject5, Param, Post as Post2, Req as Req2, Res } from "@nestjs/common";
|
|
633
|
-
function
|
|
700
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
634
701
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
635
702
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
636
703
|
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;
|
|
637
704
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
638
705
|
}
|
|
639
|
-
__name(
|
|
640
|
-
function
|
|
706
|
+
__name(_ts_decorate6, "_ts_decorate");
|
|
707
|
+
function _ts_metadata6(k, v) {
|
|
641
708
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
642
709
|
}
|
|
643
|
-
__name(
|
|
710
|
+
__name(_ts_metadata6, "_ts_metadata");
|
|
644
711
|
function _ts_param5(paramIndex, decorator) {
|
|
645
712
|
return function(target, key) {
|
|
646
713
|
decorator(target, key, paramIndex);
|
|
@@ -749,46 +816,46 @@ data: ${JSON.stringify(payload)}
|
|
|
749
816
|
res.end();
|
|
750
817
|
}
|
|
751
818
|
};
|
|
752
|
-
|
|
819
|
+
_ts_decorate6([
|
|
753
820
|
Post2("chat"),
|
|
754
821
|
_ts_param5(0, Req2()),
|
|
755
822
|
_ts_param5(1, Res()),
|
|
756
823
|
_ts_param5(2, Body()),
|
|
757
|
-
|
|
758
|
-
|
|
824
|
+
_ts_metadata6("design:type", Function),
|
|
825
|
+
_ts_metadata6("design:paramtypes", [
|
|
759
826
|
typeof Request === "undefined" ? Object : Request,
|
|
760
827
|
typeof Response === "undefined" ? Object : Response,
|
|
761
828
|
typeof ChatBody === "undefined" ? Object : ChatBody
|
|
762
829
|
]),
|
|
763
|
-
|
|
830
|
+
_ts_metadata6("design:returntype", Promise)
|
|
764
831
|
], ChatController.prototype, "chat", null);
|
|
765
|
-
|
|
832
|
+
_ts_decorate6([
|
|
766
833
|
Get2("chat/:runId/stream"),
|
|
767
834
|
_ts_param5(0, Param("runId")),
|
|
768
835
|
_ts_param5(1, Res()),
|
|
769
|
-
|
|
770
|
-
|
|
836
|
+
_ts_metadata6("design:type", Function),
|
|
837
|
+
_ts_metadata6("design:paramtypes", [
|
|
771
838
|
String,
|
|
772
839
|
typeof Response === "undefined" ? Object : Response
|
|
773
840
|
]),
|
|
774
|
-
|
|
841
|
+
_ts_metadata6("design:returntype", Promise)
|
|
775
842
|
], ChatController.prototype, "stream", null);
|
|
776
|
-
|
|
843
|
+
_ts_decorate6([
|
|
777
844
|
Post2("chat/:runId/cancel"),
|
|
778
845
|
_ts_param5(0, Req2()),
|
|
779
846
|
_ts_param5(1, Param("runId")),
|
|
780
|
-
|
|
781
|
-
|
|
847
|
+
_ts_metadata6("design:type", Function),
|
|
848
|
+
_ts_metadata6("design:paramtypes", [
|
|
782
849
|
typeof Request === "undefined" ? Object : Request,
|
|
783
850
|
String
|
|
784
851
|
]),
|
|
785
|
-
|
|
852
|
+
_ts_metadata6("design:returntype", Promise)
|
|
786
853
|
], ChatController.prototype, "cancel", null);
|
|
787
|
-
ChatController =
|
|
854
|
+
ChatController = _ts_decorate6([
|
|
788
855
|
Controller3(),
|
|
789
856
|
_ts_param5(1, Inject5(AGENT_ACTOR_RESOLVER2)),
|
|
790
|
-
|
|
791
|
-
|
|
857
|
+
_ts_metadata6("design:type", Function),
|
|
858
|
+
_ts_metadata6("design:paramtypes", [
|
|
792
859
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
793
860
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
794
861
|
])
|
|
@@ -797,17 +864,17 @@ ChatController = _ts_decorate5([
|
|
|
797
864
|
// src/controller/quota.controller.ts
|
|
798
865
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER3 } from "@dudousxd/nestjs-agent-core";
|
|
799
866
|
import { Controller as Controller4, Get as Get3, Inject as Inject6, Req as Req3 } from "@nestjs/common";
|
|
800
|
-
function
|
|
867
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
801
868
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
802
869
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
803
870
|
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;
|
|
804
871
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
805
872
|
}
|
|
806
|
-
__name(
|
|
807
|
-
function
|
|
873
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
874
|
+
function _ts_metadata7(k, v) {
|
|
808
875
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
809
876
|
}
|
|
810
|
-
__name(
|
|
877
|
+
__name(_ts_metadata7, "_ts_metadata");
|
|
811
878
|
function _ts_param6(paramIndex, decorator) {
|
|
812
879
|
return function(target, key) {
|
|
813
880
|
decorator(target, key, paramIndex);
|
|
@@ -829,20 +896,20 @@ var QuotaController = class {
|
|
|
829
896
|
return this.agent.quotaToday(actor.id);
|
|
830
897
|
}
|
|
831
898
|
};
|
|
832
|
-
|
|
899
|
+
_ts_decorate7([
|
|
833
900
|
Get3("today"),
|
|
834
901
|
_ts_param6(0, Req3()),
|
|
835
|
-
|
|
836
|
-
|
|
902
|
+
_ts_metadata7("design:type", Function),
|
|
903
|
+
_ts_metadata7("design:paramtypes", [
|
|
837
904
|
typeof Request === "undefined" ? Object : Request
|
|
838
905
|
]),
|
|
839
|
-
|
|
906
|
+
_ts_metadata7("design:returntype", Promise)
|
|
840
907
|
], QuotaController.prototype, "today", null);
|
|
841
|
-
QuotaController =
|
|
908
|
+
QuotaController = _ts_decorate7([
|
|
842
909
|
Controller4("quota"),
|
|
843
910
|
_ts_param6(1, Inject6(AGENT_ACTOR_RESOLVER3)),
|
|
844
|
-
|
|
845
|
-
|
|
911
|
+
_ts_metadata7("design:type", Function),
|
|
912
|
+
_ts_metadata7("design:paramtypes", [
|
|
846
913
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
847
914
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
848
915
|
])
|
|
@@ -851,17 +918,17 @@ QuotaController = _ts_decorate6([
|
|
|
851
918
|
// src/controller/threads.controller.ts
|
|
852
919
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER4 } from "@dudousxd/nestjs-agent-core";
|
|
853
920
|
import { Body as Body2, Controller as Controller5, Delete, Get as Get4, Inject as Inject7, Param as Param2, Patch, Post as Post3, Req as Req4 } from "@nestjs/common";
|
|
854
|
-
function
|
|
921
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
855
922
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
856
923
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
857
924
|
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;
|
|
858
925
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
859
926
|
}
|
|
860
|
-
__name(
|
|
861
|
-
function
|
|
927
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
928
|
+
function _ts_metadata8(k, v) {
|
|
862
929
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
863
930
|
}
|
|
864
|
-
__name(
|
|
931
|
+
__name(_ts_metadata8, "_ts_metadata");
|
|
865
932
|
function _ts_param7(paramIndex, decorator) {
|
|
866
933
|
return function(target, key) {
|
|
867
934
|
decorator(target, key, paramIndex);
|
|
@@ -931,92 +998,92 @@ var ThreadsController = class {
|
|
|
931
998
|
};
|
|
932
999
|
}
|
|
933
1000
|
};
|
|
934
|
-
|
|
1001
|
+
_ts_decorate8([
|
|
935
1002
|
Get4(),
|
|
936
1003
|
_ts_param7(0, Req4()),
|
|
937
|
-
|
|
938
|
-
|
|
1004
|
+
_ts_metadata8("design:type", Function),
|
|
1005
|
+
_ts_metadata8("design:paramtypes", [
|
|
939
1006
|
typeof Request === "undefined" ? Object : Request
|
|
940
1007
|
]),
|
|
941
|
-
|
|
1008
|
+
_ts_metadata8("design:returntype", Promise)
|
|
942
1009
|
], ThreadsController.prototype, "list", null);
|
|
943
|
-
|
|
1010
|
+
_ts_decorate8([
|
|
944
1011
|
Get4(":id"),
|
|
945
1012
|
_ts_param7(0, Req4()),
|
|
946
1013
|
_ts_param7(1, Param2("id")),
|
|
947
|
-
|
|
948
|
-
|
|
1014
|
+
_ts_metadata8("design:type", Function),
|
|
1015
|
+
_ts_metadata8("design:paramtypes", [
|
|
949
1016
|
typeof Request === "undefined" ? Object : Request,
|
|
950
1017
|
String
|
|
951
1018
|
]),
|
|
952
|
-
|
|
1019
|
+
_ts_metadata8("design:returntype", Promise)
|
|
953
1020
|
], ThreadsController.prototype, "detail", null);
|
|
954
|
-
|
|
1021
|
+
_ts_decorate8([
|
|
955
1022
|
Delete(":id"),
|
|
956
1023
|
_ts_param7(0, Req4()),
|
|
957
1024
|
_ts_param7(1, Param2("id")),
|
|
958
|
-
|
|
959
|
-
|
|
1025
|
+
_ts_metadata8("design:type", Function),
|
|
1026
|
+
_ts_metadata8("design:paramtypes", [
|
|
960
1027
|
typeof Request === "undefined" ? Object : Request,
|
|
961
1028
|
String
|
|
962
1029
|
]),
|
|
963
|
-
|
|
1030
|
+
_ts_metadata8("design:returntype", Promise)
|
|
964
1031
|
], ThreadsController.prototype, "remove", null);
|
|
965
|
-
|
|
1032
|
+
_ts_decorate8([
|
|
966
1033
|
Post3(":id/fork-from/:messageId"),
|
|
967
1034
|
_ts_param7(0, Req4()),
|
|
968
1035
|
_ts_param7(1, Param2("id")),
|
|
969
1036
|
_ts_param7(2, Param2("messageId")),
|
|
970
|
-
|
|
971
|
-
|
|
1037
|
+
_ts_metadata8("design:type", Function),
|
|
1038
|
+
_ts_metadata8("design:paramtypes", [
|
|
972
1039
|
typeof Request === "undefined" ? Object : Request,
|
|
973
1040
|
String,
|
|
974
1041
|
String
|
|
975
1042
|
]),
|
|
976
|
-
|
|
1043
|
+
_ts_metadata8("design:returntype", Promise)
|
|
977
1044
|
], ThreadsController.prototype, "fork", null);
|
|
978
|
-
|
|
1045
|
+
_ts_decorate8([
|
|
979
1046
|
Patch(":id"),
|
|
980
1047
|
_ts_param7(0, Req4()),
|
|
981
1048
|
_ts_param7(1, Param2("id")),
|
|
982
1049
|
_ts_param7(2, Body2()),
|
|
983
|
-
|
|
984
|
-
|
|
1050
|
+
_ts_metadata8("design:type", Function),
|
|
1051
|
+
_ts_metadata8("design:paramtypes", [
|
|
985
1052
|
typeof Request === "undefined" ? Object : Request,
|
|
986
1053
|
String,
|
|
987
1054
|
typeof UpdateThreadBody === "undefined" ? Object : UpdateThreadBody
|
|
988
1055
|
]),
|
|
989
|
-
|
|
1056
|
+
_ts_metadata8("design:returntype", Promise)
|
|
990
1057
|
], ThreadsController.prototype, "update", null);
|
|
991
|
-
|
|
1058
|
+
_ts_decorate8([
|
|
992
1059
|
Post3(":id/promote"),
|
|
993
1060
|
_ts_param7(0, Req4()),
|
|
994
1061
|
_ts_param7(1, Param2("id")),
|
|
995
|
-
|
|
996
|
-
|
|
1062
|
+
_ts_metadata8("design:type", Function),
|
|
1063
|
+
_ts_metadata8("design:paramtypes", [
|
|
997
1064
|
typeof Request === "undefined" ? Object : Request,
|
|
998
1065
|
String
|
|
999
1066
|
]),
|
|
1000
|
-
|
|
1067
|
+
_ts_metadata8("design:returntype", Promise)
|
|
1001
1068
|
], ThreadsController.prototype, "promote", null);
|
|
1002
|
-
|
|
1069
|
+
_ts_decorate8([
|
|
1003
1070
|
Delete(":id/from/:messageId"),
|
|
1004
1071
|
_ts_param7(0, Req4()),
|
|
1005
1072
|
_ts_param7(1, Param2("id")),
|
|
1006
1073
|
_ts_param7(2, Param2("messageId")),
|
|
1007
|
-
|
|
1008
|
-
|
|
1074
|
+
_ts_metadata8("design:type", Function),
|
|
1075
|
+
_ts_metadata8("design:paramtypes", [
|
|
1009
1076
|
typeof Request === "undefined" ? Object : Request,
|
|
1010
1077
|
String,
|
|
1011
1078
|
String
|
|
1012
1079
|
]),
|
|
1013
|
-
|
|
1080
|
+
_ts_metadata8("design:returntype", Promise)
|
|
1014
1081
|
], ThreadsController.prototype, "truncateFrom", null);
|
|
1015
|
-
ThreadsController =
|
|
1082
|
+
ThreadsController = _ts_decorate8([
|
|
1016
1083
|
Controller5("threads"),
|
|
1017
1084
|
_ts_param7(1, Inject7(AGENT_ACTOR_RESOLVER4)),
|
|
1018
|
-
|
|
1019
|
-
|
|
1085
|
+
_ts_metadata8("design:type", Function),
|
|
1086
|
+
_ts_metadata8("design:paramtypes", [
|
|
1020
1087
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
1021
1088
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
1022
1089
|
])
|
|
@@ -1025,17 +1092,17 @@ ThreadsController = _ts_decorate7([
|
|
|
1025
1092
|
// src/controller/tool-call.controller.ts
|
|
1026
1093
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER5 } from "@dudousxd/nestjs-agent-core";
|
|
1027
1094
|
import { Body as Body3, Controller as Controller6, Inject as Inject8, Post as Post4, Req as Req5 } from "@nestjs/common";
|
|
1028
|
-
function
|
|
1095
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
1029
1096
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1030
1097
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1031
1098
|
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;
|
|
1032
1099
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1033
1100
|
}
|
|
1034
|
-
__name(
|
|
1035
|
-
function
|
|
1101
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
1102
|
+
function _ts_metadata9(k, v) {
|
|
1036
1103
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1037
1104
|
}
|
|
1038
|
-
__name(
|
|
1105
|
+
__name(_ts_metadata9, "_ts_metadata");
|
|
1039
1106
|
function _ts_param8(paramIndex, decorator) {
|
|
1040
1107
|
return function(target, key) {
|
|
1041
1108
|
decorator(target, key, paramIndex);
|
|
@@ -1067,33 +1134,33 @@ var ToolCallController = class {
|
|
|
1067
1134
|
};
|
|
1068
1135
|
}
|
|
1069
1136
|
};
|
|
1070
|
-
|
|
1137
|
+
_ts_decorate9([
|
|
1071
1138
|
Post4("approve"),
|
|
1072
1139
|
_ts_param8(0, Req5()),
|
|
1073
1140
|
_ts_param8(1, Body3()),
|
|
1074
|
-
|
|
1075
|
-
|
|
1141
|
+
_ts_metadata9("design:type", Function),
|
|
1142
|
+
_ts_metadata9("design:paramtypes", [
|
|
1076
1143
|
typeof Request === "undefined" ? Object : Request,
|
|
1077
1144
|
typeof ApproveBody === "undefined" ? Object : ApproveBody
|
|
1078
1145
|
]),
|
|
1079
|
-
|
|
1146
|
+
_ts_metadata9("design:returntype", Promise)
|
|
1080
1147
|
], ToolCallController.prototype, "approve", null);
|
|
1081
|
-
|
|
1148
|
+
_ts_decorate9([
|
|
1082
1149
|
Post4("reject"),
|
|
1083
1150
|
_ts_param8(0, Req5()),
|
|
1084
1151
|
_ts_param8(1, Body3()),
|
|
1085
|
-
|
|
1086
|
-
|
|
1152
|
+
_ts_metadata9("design:type", Function),
|
|
1153
|
+
_ts_metadata9("design:paramtypes", [
|
|
1087
1154
|
typeof Request === "undefined" ? Object : Request,
|
|
1088
1155
|
typeof RejectBody === "undefined" ? Object : RejectBody
|
|
1089
1156
|
]),
|
|
1090
|
-
|
|
1157
|
+
_ts_metadata9("design:returntype", Promise)
|
|
1091
1158
|
], ToolCallController.prototype, "reject", null);
|
|
1092
|
-
ToolCallController =
|
|
1159
|
+
ToolCallController = _ts_decorate9([
|
|
1093
1160
|
Controller6("tool-call"),
|
|
1094
1161
|
_ts_param8(1, Inject8(AGENT_ACTOR_RESOLVER5)),
|
|
1095
|
-
|
|
1096
|
-
|
|
1162
|
+
_ts_metadata9("design:type", Function),
|
|
1163
|
+
_ts_metadata9("design:paramtypes", [
|
|
1097
1164
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
1098
1165
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
1099
1166
|
])
|
|
@@ -1101,7 +1168,7 @@ ToolCallController = _ts_decorate8([
|
|
|
1101
1168
|
|
|
1102
1169
|
// src/discovery/agent-discovery.service.ts
|
|
1103
1170
|
import { AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS2, AGENT_REGISTRY as AGENT_REGISTRY3, AgentRegistry as AgentRegistry4 } from "@dudousxd/nestjs-agent-core";
|
|
1104
|
-
import { Inject as Inject9, Injectable as
|
|
1171
|
+
import { Inject as Inject9, Injectable as Injectable4, Logger } from "@nestjs/common";
|
|
1105
1172
|
import { DiscoveryService, MetadataScanner } from "@nestjs/core";
|
|
1106
1173
|
|
|
1107
1174
|
// src/decorator/agent.decorator.ts
|
|
@@ -1136,17 +1203,17 @@ function SystemPromptContributor() {
|
|
|
1136
1203
|
__name(SystemPromptContributor, "SystemPromptContributor");
|
|
1137
1204
|
|
|
1138
1205
|
// src/discovery/agent-discovery.service.ts
|
|
1139
|
-
function
|
|
1206
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
1140
1207
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1141
1208
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1142
1209
|
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;
|
|
1143
1210
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1144
1211
|
}
|
|
1145
|
-
__name(
|
|
1146
|
-
function
|
|
1212
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
1213
|
+
function _ts_metadata10(k, v) {
|
|
1147
1214
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1148
1215
|
}
|
|
1149
|
-
__name(
|
|
1216
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
1150
1217
|
function _ts_param9(paramIndex, decorator) {
|
|
1151
1218
|
return function(target, key) {
|
|
1152
1219
|
decorator(target, key, paramIndex);
|
|
@@ -1249,12 +1316,12 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
1249
1316
|
return (ctx) => candidate.call(instance, ctx);
|
|
1250
1317
|
}
|
|
1251
1318
|
};
|
|
1252
|
-
AgentDiscoveryService =
|
|
1253
|
-
|
|
1319
|
+
AgentDiscoveryService = _ts_decorate10([
|
|
1320
|
+
Injectable4(),
|
|
1254
1321
|
_ts_param9(2, Inject9(AGENT_REGISTRY3)),
|
|
1255
1322
|
_ts_param9(3, Inject9(AGENT_PROMPT_CONTRIBUTORS2)),
|
|
1256
|
-
|
|
1257
|
-
|
|
1323
|
+
_ts_metadata10("design:type", Function),
|
|
1324
|
+
_ts_metadata10("design:paramtypes", [
|
|
1258
1325
|
typeof DiscoveryService === "undefined" ? Object : DiscoveryService,
|
|
1259
1326
|
typeof MetadataScanner === "undefined" ? Object : MetadataScanner,
|
|
1260
1327
|
typeof AgentRegistry4 === "undefined" ? Object : AgentRegistry4,
|
|
@@ -1264,7 +1331,7 @@ AgentDiscoveryService = _ts_decorate9([
|
|
|
1264
1331
|
|
|
1265
1332
|
// src/discovery/ai-tool-discovery.service.ts
|
|
1266
1333
|
import { AGENT_OPTIONS as AGENT_OPTIONS3, AGENT_REGISTRY as AGENT_REGISTRY4, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY2 } from "@dudousxd/nestjs-agent-core";
|
|
1267
|
-
import { Inject as Inject10, Injectable as
|
|
1334
|
+
import { Inject as Inject10, Injectable as Injectable5, Logger as Logger2 } from "@nestjs/common";
|
|
1268
1335
|
import { DiscoveryService as DiscoveryService2 } from "@nestjs/core";
|
|
1269
1336
|
import { z } from "zod";
|
|
1270
1337
|
|
|
@@ -1313,17 +1380,17 @@ function provideAgentTool(factoryOrTool, inject) {
|
|
|
1313
1380
|
__name(provideAgentTool, "provideAgentTool");
|
|
1314
1381
|
|
|
1315
1382
|
// src/discovery/ai-tool-discovery.service.ts
|
|
1316
|
-
function
|
|
1383
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
1317
1384
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1318
1385
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1319
1386
|
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;
|
|
1320
1387
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1321
1388
|
}
|
|
1322
|
-
__name(
|
|
1323
|
-
function
|
|
1389
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
1390
|
+
function _ts_metadata11(k, v) {
|
|
1324
1391
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1325
1392
|
}
|
|
1326
|
-
__name(
|
|
1393
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
1327
1394
|
function _ts_param10(paramIndex, decorator) {
|
|
1328
1395
|
return function(target, key) {
|
|
1329
1396
|
decorator(target, key, paramIndex);
|
|
@@ -1436,13 +1503,13 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
1436
1503
|
return true;
|
|
1437
1504
|
}
|
|
1438
1505
|
};
|
|
1439
|
-
AiToolDiscoveryService =
|
|
1440
|
-
|
|
1506
|
+
AiToolDiscoveryService = _ts_decorate11([
|
|
1507
|
+
Injectable5(),
|
|
1441
1508
|
_ts_param10(1, Inject10(AGENT_TOOL_REGISTRY2)),
|
|
1442
1509
|
_ts_param10(2, Inject10(AGENT_REGISTRY4)),
|
|
1443
1510
|
_ts_param10(3, Inject10(AGENT_OPTIONS3)),
|
|
1444
|
-
|
|
1445
|
-
|
|
1511
|
+
_ts_metadata11("design:type", Function),
|
|
1512
|
+
_ts_metadata11("design:paramtypes", [
|
|
1446
1513
|
typeof DiscoveryService2 === "undefined" ? Object : DiscoveryService2,
|
|
1447
1514
|
typeof ToolRegistry === "undefined" ? Object : ToolRegistry,
|
|
1448
1515
|
typeof AgentRegistry === "undefined" ? Object : AgentRegistry,
|
|
@@ -1543,18 +1610,18 @@ var LedgerQuotaStore = class {
|
|
|
1543
1610
|
|
|
1544
1611
|
// src/runner/inline-agent-runner.ts
|
|
1545
1612
|
import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY3, AGENT_STORE as AGENT_STORE3, QuotaExceededError, publishAgentRunFailed, runAgentLoop } from "@dudousxd/nestjs-agent-core";
|
|
1546
|
-
import { Inject as Inject11, Injectable as
|
|
1547
|
-
function
|
|
1613
|
+
import { Inject as Inject11, Injectable as Injectable6, Logger as Logger3 } from "@nestjs/common";
|
|
1614
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
1548
1615
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1549
1616
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1550
1617
|
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;
|
|
1551
1618
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1552
1619
|
}
|
|
1553
|
-
__name(
|
|
1554
|
-
function
|
|
1620
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
1621
|
+
function _ts_metadata12(k, v) {
|
|
1555
1622
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1556
1623
|
}
|
|
1557
|
-
__name(
|
|
1624
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
1558
1625
|
function _ts_param11(paramIndex, decorator) {
|
|
1559
1626
|
return function(target, key) {
|
|
1560
1627
|
decorator(target, key, paramIndex);
|
|
@@ -1590,6 +1657,12 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
1590
1657
|
code,
|
|
1591
1658
|
message
|
|
1592
1659
|
});
|
|
1660
|
+
await this.store.recordRunEnd?.({
|
|
1661
|
+
runId,
|
|
1662
|
+
status: "failed",
|
|
1663
|
+
errorCode: code,
|
|
1664
|
+
errorMessage: message
|
|
1665
|
+
});
|
|
1593
1666
|
await this.store.setActiveStream(input.threadId, null);
|
|
1594
1667
|
const writer = await deps.sink.open(runId);
|
|
1595
1668
|
await writer.fail({
|
|
@@ -1666,25 +1739,25 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
1666
1739
|
}
|
|
1667
1740
|
}
|
|
1668
1741
|
};
|
|
1669
|
-
InlineAgentRunner =
|
|
1670
|
-
|
|
1742
|
+
InlineAgentRunner = _ts_decorate12([
|
|
1743
|
+
Injectable6(),
|
|
1671
1744
|
_ts_param11(0, Inject11(AGENT_DEPS_FACTORY3)),
|
|
1672
1745
|
_ts_param11(1, Inject11(AGENT_STORE3)),
|
|
1673
|
-
|
|
1674
|
-
|
|
1746
|
+
_ts_metadata12("design:type", Function),
|
|
1747
|
+
_ts_metadata12("design:paramtypes", [
|
|
1675
1748
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
1676
1749
|
typeof AgentStore === "undefined" ? Object : AgentStore
|
|
1677
1750
|
])
|
|
1678
1751
|
], InlineAgentRunner);
|
|
1679
1752
|
|
|
1680
1753
|
// src/agent.module.ts
|
|
1681
|
-
function
|
|
1754
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
1682
1755
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1683
1756
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1684
1757
|
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;
|
|
1685
1758
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1686
1759
|
}
|
|
1687
|
-
__name(
|
|
1760
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
1688
1761
|
var DEFAULT_PATH = "agent";
|
|
1689
1762
|
function sharedProviders(durable, includeStore) {
|
|
1690
1763
|
const providers = [
|
|
@@ -1751,7 +1824,14 @@ function sharedProviders(durable, includeStore) {
|
|
|
1751
1824
|
AgentDiscoveryService,
|
|
1752
1825
|
AiToolDiscoveryService,
|
|
1753
1826
|
InlineAgentRunner,
|
|
1754
|
-
AgentService
|
|
1827
|
+
AgentService,
|
|
1828
|
+
// Bound ALWAYS (durable or inline) — the console's cross-thread approvals inbox routes decisions
|
|
1829
|
+
// through AgentService.signalToolCall, which reaches whichever AGENT_RUNNER is bound above.
|
|
1830
|
+
AgentApprovalPortAdapter,
|
|
1831
|
+
{
|
|
1832
|
+
provide: AGENT_APPROVAL_PORT,
|
|
1833
|
+
useExisting: AgentApprovalPortAdapter
|
|
1834
|
+
}
|
|
1755
1835
|
];
|
|
1756
1836
|
if (includeStore) {
|
|
1757
1837
|
providers.push({
|
|
@@ -1804,7 +1884,8 @@ function exportsFor(includeStore) {
|
|
|
1804
1884
|
AGENT_DEPS_FACTORY4,
|
|
1805
1885
|
AgentDepsFactory2,
|
|
1806
1886
|
AgentService,
|
|
1807
|
-
InlineAgentRunner
|
|
1887
|
+
InlineAgentRunner,
|
|
1888
|
+
AGENT_APPROVAL_PORT
|
|
1808
1889
|
];
|
|
1809
1890
|
}
|
|
1810
1891
|
__name(exportsFor, "exportsFor");
|
|
@@ -1849,11 +1930,18 @@ function routerFor(path) {
|
|
|
1849
1930
|
]);
|
|
1850
1931
|
}
|
|
1851
1932
|
__name(routerFor, "routerFor");
|
|
1933
|
+
function assertDispatchedStepsRequiresDurable(dispatchedSteps, durable) {
|
|
1934
|
+
if (dispatchedSteps && !durable) {
|
|
1935
|
+
throw new Error("AgentModule dispatchedSteps: true requires durable: true \u2014 dispatched steps are routed durable steps (AgentRunSteps.llm/tool) with no in-process equivalent.");
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
__name(assertDispatchedStepsRequiresDurable, "assertDispatchedStepsRequiresDurable");
|
|
1852
1939
|
var AgentModule = class _AgentModule {
|
|
1853
1940
|
static {
|
|
1854
1941
|
__name(this, "AgentModule");
|
|
1855
1942
|
}
|
|
1856
1943
|
static forRoot(options) {
|
|
1944
|
+
assertDispatchedStepsRequiresDurable(options.dispatchedSteps ?? false, options.durable ?? false);
|
|
1857
1945
|
const path = options.path ?? DEFAULT_PATH;
|
|
1858
1946
|
const includeStore = options.store !== void 0;
|
|
1859
1947
|
applyGuards(options.guards);
|
|
@@ -1877,6 +1965,7 @@ var AgentModule = class _AgentModule {
|
|
|
1877
1965
|
};
|
|
1878
1966
|
}
|
|
1879
1967
|
static forRootAsync(options) {
|
|
1968
|
+
assertDispatchedStepsRequiresDurable(options.dispatchedSteps ?? false, options.durable ?? false);
|
|
1880
1969
|
const path = options.path ?? DEFAULT_PATH;
|
|
1881
1970
|
const includeStore = options.externalStore !== true;
|
|
1882
1971
|
applyGuards(options.guards);
|
|
@@ -1892,7 +1981,17 @@ var AgentModule = class _AgentModule {
|
|
|
1892
1981
|
providers: [
|
|
1893
1982
|
{
|
|
1894
1983
|
provide: AGENT_OPTIONS4,
|
|
1895
|
-
|
|
1984
|
+
// Stamp the STATIC wiring flags onto the factory result: `durable`/`dispatchedSteps` are
|
|
1985
|
+
// authoritative on the async config object (they decided the actual wiring above), and
|
|
1986
|
+
// `AgentDurableModule` derives the effective dispatched-steps value from AGENT_OPTIONS —
|
|
1987
|
+
// without this stamp, an async host would get in-process localSteps despite durable: true.
|
|
1988
|
+
useFactory: /* @__PURE__ */ __name(async (...args) => ({
|
|
1989
|
+
...await options.useFactory(...args),
|
|
1990
|
+
durable: options.durable ?? false,
|
|
1991
|
+
...options.dispatchedSteps !== void 0 ? {
|
|
1992
|
+
dispatchedSteps: options.dispatchedSteps
|
|
1993
|
+
} : {}
|
|
1994
|
+
}), "useFactory"),
|
|
1896
1995
|
inject: options.inject ?? []
|
|
1897
1996
|
},
|
|
1898
1997
|
...sharedProviders(options.durable ?? false, includeStore),
|
|
@@ -1902,7 +2001,7 @@ var AgentModule = class _AgentModule {
|
|
|
1902
2001
|
};
|
|
1903
2002
|
}
|
|
1904
2003
|
};
|
|
1905
|
-
AgentModule =
|
|
2004
|
+
AgentModule = _ts_decorate13([
|
|
1906
2005
|
Global(),
|
|
1907
2006
|
Module({})
|
|
1908
2007
|
], AgentModule);
|
|
@@ -1944,6 +2043,7 @@ export {
|
|
|
1944
2043
|
AGENT_TOOL_BRAND,
|
|
1945
2044
|
AI_TOOL_METADATA,
|
|
1946
2045
|
Agent,
|
|
2046
|
+
AgentApprovalPortAdapter,
|
|
1947
2047
|
AgentDepsFactory2 as AgentDepsFactory,
|
|
1948
2048
|
AgentDiscoveryService,
|
|
1949
2049
|
AgentModule,
|