@dudousxd/nestjs-agent 0.1.0 → 0.3.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.
@@ -95,7 +95,6 @@ var AgentRunWorkflow = class _AgentRunWorkflow {
95
95
  const subThreadId = await ctx.step(`subthread:${agentName}`, async () => {
96
96
  const thread = await this.store.createThread({
97
97
  actor: input.actor,
98
- persona: "default",
99
98
  transient: true
100
99
  });
101
100
  return thread.id;
@@ -243,9 +242,9 @@ AgentDurableModule = _ts_decorate3([
243
242
  ], AgentDurableModule);
244
243
 
245
244
  // src/agent.module.ts
246
- var import_nestjs_agent_core13 = require("@dudousxd/nestjs-agent-core");
247
- var import_common12 = require("@nestjs/common");
248
- var import_core2 = require("@nestjs/core");
245
+ var import_nestjs_agent_core14 = require("@dudousxd/nestjs-agent-core");
246
+ var import_common13 = require("@nestjs/common");
247
+ var import_core3 = require("@nestjs/core");
249
248
 
250
249
  // src/agent-deps.factory.ts
251
250
  var import_nestjs_agent_core3 = require("@dudousxd/nestjs-agent-core");
@@ -283,8 +282,9 @@ var AgentDepsFactory2 = class {
283
282
  rolesPolicy;
284
283
  registry;
285
284
  agents;
285
+ promptContributors;
286
286
  quota;
287
- constructor(options, model, store, sink, rolesPolicy, registry, agents, quota) {
287
+ constructor(options, model, store, sink, rolesPolicy, registry, agents, promptContributors, quota) {
288
288
  this.options = options;
289
289
  this.model = model;
290
290
  this.store = store;
@@ -292,10 +292,19 @@ var AgentDepsFactory2 = class {
292
292
  this.rolesPolicy = rolesPolicy;
293
293
  this.registry = registry;
294
294
  this.agents = agents;
295
+ this.promptContributors = promptContributors;
295
296
  this.quota = quota;
296
297
  }
298
+ /**
299
+ * The agent a turn uses when the caller names none: the explicit `defaultAgent` option, else the
300
+ * sole registered `@Agent` when there is exactly one, else `'default'` (a bare assistant).
301
+ */
297
302
  defaultAgentName() {
298
- return this.options.defaultAgent?.name ?? "default";
303
+ if (this.options.defaultAgent !== void 0) {
304
+ return this.options.defaultAgent;
305
+ }
306
+ const registered = this.agents.list();
307
+ return registered.length === 1 ? registered[0]?.name ?? "default" : "default";
299
308
  }
300
309
  effectiveTools(definition) {
301
310
  if (definition === void 0) {
@@ -313,10 +322,6 @@ var AgentDepsFactory2 = class {
313
322
  forAgent(agentName) {
314
323
  const name = agentName ?? this.defaultAgentName();
315
324
  const definition = this.agents.get(name);
316
- const personas = /* @__PURE__ */ new Map();
317
- for (const persona of definition?.personas ?? []) {
318
- personas.set(persona.id, persona);
319
- }
320
325
  const toolAllowList = this.effectiveTools(definition);
321
326
  const followUpsCount = this.followUpsCount();
322
327
  const retrieval = this.options.retrieval;
@@ -326,10 +331,9 @@ var AgentDepsFactory2 = class {
326
331
  sink: this.sink,
327
332
  rolesPolicy: this.rolesPolicy,
328
333
  registry: this.registry,
334
+ promptContributors: this.promptContributors,
329
335
  systemPrompt: definition?.systemPrompt ?? "You are a helpful assistant.",
330
336
  maxSteps: definition?.maxSteps ?? 8,
331
- personas,
332
- defaultPersona: definition?.defaultPersona ?? "default",
333
337
  ...definition?.modelId !== void 0 ? {
334
338
  modelId: definition.modelId
335
339
  } : {},
@@ -374,7 +378,8 @@ AgentDepsFactory2 = _ts_decorate4([
374
378
  _ts_param2(4, (0, import_common4.Inject)(import_nestjs_agent_core3.AGENT_ROLES_POLICY)),
375
379
  _ts_param2(5, (0, import_common4.Inject)(import_nestjs_agent_core3.AGENT_TOOL_REGISTRY)),
376
380
  _ts_param2(6, (0, import_common4.Inject)(import_nestjs_agent_core3.AGENT_REGISTRY)),
377
- _ts_param2(7, (0, import_common4.Inject)(import_nestjs_agent_core3.AGENT_QUOTA_STORE)),
381
+ _ts_param2(7, (0, import_common4.Inject)(import_nestjs_agent_core3.AGENT_PROMPT_CONTRIBUTORS)),
382
+ _ts_param2(8, (0, import_common4.Inject)(import_nestjs_agent_core3.AGENT_QUOTA_STORE)),
378
383
  _ts_metadata3("design:type", Function),
379
384
  _ts_metadata3("design:paramtypes", [
380
385
  typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
@@ -384,6 +389,7 @@ AgentDepsFactory2 = _ts_decorate4([
384
389
  typeof RolesPolicy === "undefined" ? Object : RolesPolicy,
385
390
  typeof import_nestjs_agent_core3.ToolRegistry === "undefined" ? Object : import_nestjs_agent_core3.ToolRegistry,
386
391
  typeof import_nestjs_agent_core3.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core3.AgentRegistry,
392
+ Array,
387
393
  Object
388
394
  ])
389
395
  ], AgentDepsFactory2);
@@ -415,10 +421,12 @@ var AgentService = class {
415
421
  runner;
416
422
  store;
417
423
  deps;
418
- constructor(runner, store, deps) {
424
+ quota;
425
+ constructor(runner, store, deps, quota) {
419
426
  this.runner = runner;
420
427
  this.store = store;
421
428
  this.deps = deps;
429
+ this.quota = quota;
422
430
  }
423
431
  async chat(params) {
424
432
  const agentName = params.agentName ?? this.deps.defaultAgentName();
@@ -429,13 +437,14 @@ var AgentService = class {
429
437
  }
430
438
  const created = await this.store.createThread({
431
439
  actor: params.actor,
432
- persona: params.personaId ?? this.deps.forAgent(agentName).defaultPersona
440
+ ...params.transient === true ? {
441
+ transient: true
442
+ } : {}
433
443
  });
434
444
  threadId = created.id;
435
445
  } else if (params.regenerate === true) {
436
446
  await this.assertOwnsThread(params.actor, threadId);
437
447
  }
438
- const persona = this.resolvePersona(agentName, params.personaId);
439
448
  const input = {
440
449
  threadId,
441
450
  actor: params.actor,
@@ -445,9 +454,6 @@ var AgentService = class {
445
454
  ...params.regenerate === true ? {
446
455
  regenerate: true
447
456
  } : {},
448
- ...persona !== void 0 ? {
449
- persona
450
- } : {},
451
457
  ...params.pageContext !== void 0 ? {
452
458
  pageContext: params.pageContext
453
459
  } : {}
@@ -481,18 +487,6 @@ var AgentService = class {
481
487
  await this.assertOwnsActiveStream(actor, runId);
482
488
  return this.runner.cancel(runId);
483
489
  }
484
- resolvePersona(agentName, id) {
485
- const deps = this.deps.forAgent(agentName);
486
- return deps.personas.get(id ?? deps.defaultPersona);
487
- }
488
- personaCatalog(agentName) {
489
- return [
490
- ...this.deps.forAgent(agentName).personas.values()
491
- ].map((persona) => ({
492
- id: persona.id,
493
- label: persona.label
494
- }));
495
- }
496
490
  listThreads(actorRef) {
497
491
  return this.store.listThreads(actorRef);
498
492
  }
@@ -508,8 +502,53 @@ var AgentService = class {
508
502
  await this.assertOwnsThread(actor, threadId);
509
503
  return this.store.forkThread(threadId, fromMessageId);
510
504
  }
505
+ async renameThread(actor, threadId, title) {
506
+ const trimmed = title.trim();
507
+ if (trimmed.length === 0) {
508
+ throw new import_common5.BadRequestException("title must not be empty");
509
+ }
510
+ if (trimmed.length > 200) {
511
+ throw new import_common5.BadRequestException("title must be at most 200 characters");
512
+ }
513
+ await this.assertOwnsThread(actor, threadId);
514
+ return this.store.setTitle(threadId, trimmed);
515
+ }
516
+ async promoteThread(actor, threadId) {
517
+ await this.assertOwnsThread(actor, threadId);
518
+ return this.store.promoteThread(threadId);
519
+ }
520
+ /**
521
+ * Drop a message and everything after it — the "edit and resend" / "delete from here" primitive.
522
+ * The client then sends a fresh turn on the truncated thread. Ownership-gated like the other
523
+ * thread-scoped mutations.
524
+ */
525
+ async truncateThreadFrom(actor, threadId, messageId) {
526
+ await this.assertOwnsThread(actor, threadId);
527
+ return this.store.truncateFrom(threadId, messageId);
528
+ }
529
+ /**
530
+ * The day's usage for the badge: tokens + summed USD cost from the store, and the configured
531
+ * limit from the quota store (null → unlimited). `withinLimit` comes from the quota store so it
532
+ * can never drift from what enforcement uses.
533
+ */
511
534
  async quotaToday(actorRef) {
512
- return this.store.quotaToday(actorRef, utcDay());
535
+ const day = utcDay();
536
+ const { usedTokens, costUsd } = await this.store.quotaToday(actorRef, day);
537
+ if (this.quota === void 0) {
538
+ return {
539
+ usedTokens,
540
+ costUsd,
541
+ limitTokens: null,
542
+ withinLimit: true
543
+ };
544
+ }
545
+ const state = await this.quota.check(actorRef, day);
546
+ return {
547
+ usedTokens: state.usedTokens,
548
+ costUsd,
549
+ limitTokens: state.limitTokens,
550
+ withinLimit: state.withinLimit
551
+ };
513
552
  }
514
553
  /**
515
554
  * Authorization seam for thread-scoped endpoints: the caller must own the thread. A missing
@@ -560,11 +599,13 @@ AgentService = _ts_decorate5([
560
599
  _ts_param3(0, (0, import_common5.Inject)(import_nestjs_agent_core5.AGENT_RUNNER)),
561
600
  _ts_param3(1, (0, import_common5.Inject)(import_nestjs_agent_core5.AGENT_STORE)),
562
601
  _ts_param3(2, (0, import_common5.Inject)(import_nestjs_agent_core5.AGENT_DEPS_FACTORY)),
602
+ _ts_param3(3, (0, import_common5.Inject)(import_nestjs_agent_core5.AGENT_QUOTA_STORE)),
563
603
  _ts_metadata4("design:type", Function),
564
604
  _ts_metadata4("design:paramtypes", [
565
605
  typeof AgentRunner === "undefined" ? Object : AgentRunner,
566
606
  typeof AgentStore === "undefined" ? Object : AgentStore,
567
- typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory
607
+ typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
608
+ Object
568
609
  ])
569
610
  ], AgentService);
570
611
 
@@ -609,14 +650,14 @@ var ChatController = class {
609
650
  ...body.agent !== void 0 ? {
610
651
  agentName: body.agent
611
652
  } : {},
612
- ...body.persona !== void 0 ? {
613
- personaId: body.persona
614
- } : {},
615
653
  ...body.pageContext !== void 0 ? {
616
654
  pageContext: body.pageContext
617
655
  } : {},
618
656
  ...body.regenerate === true ? {
619
657
  regenerate: true
658
+ } : {},
659
+ ...body.transient === true ? {
660
+ transient: true
620
661
  } : {}
621
662
  });
622
663
  await this.pipe(res, runId, threadId);
@@ -805,9 +846,6 @@ var ThreadsController = class {
805
846
  const actor = await this.actorResolver.resolve(req);
806
847
  return this.agent.listThreads(actor.id);
807
848
  }
808
- personas() {
809
- return this.agent.personaCatalog();
810
- }
811
849
  async detail(req, id) {
812
850
  const actor = await this.actorResolver.resolve(req);
813
851
  return this.agent.getThread(actor, id);
@@ -823,6 +861,27 @@ var ThreadsController = class {
823
861
  const actor = await this.actorResolver.resolve(req);
824
862
  return this.agent.forkThread(actor, id, messageId);
825
863
  }
864
+ async rename(req, id, body) {
865
+ const actor = await this.actorResolver.resolve(req);
866
+ await this.agent.renameThread(actor, id, body.title);
867
+ return {
868
+ ok: true
869
+ };
870
+ }
871
+ async promote(req, id) {
872
+ const actor = await this.actorResolver.resolve(req);
873
+ await this.agent.promoteThread(actor, id);
874
+ return {
875
+ ok: true
876
+ };
877
+ }
878
+ async truncateFrom(req, id, messageId) {
879
+ const actor = await this.actorResolver.resolve(req);
880
+ await this.agent.truncateThreadFrom(actor, id, messageId);
881
+ return {
882
+ ok: true
883
+ };
884
+ }
826
885
  };
827
886
  _ts_decorate8([
828
887
  (0, import_common8.Get)(),
@@ -833,12 +892,6 @@ _ts_decorate8([
833
892
  ]),
834
893
  _ts_metadata7("design:returntype", Promise)
835
894
  ], ThreadsController.prototype, "list", null);
836
- _ts_decorate8([
837
- (0, import_common8.Get)("personas/catalog"),
838
- _ts_metadata7("design:type", Function),
839
- _ts_metadata7("design:paramtypes", []),
840
- _ts_metadata7("design:returntype", void 0)
841
- ], ThreadsController.prototype, "personas", null);
842
895
  _ts_decorate8([
843
896
  (0, import_common8.Get)(":id"),
844
897
  _ts_param6(0, (0, import_common8.Req)()),
@@ -874,6 +927,43 @@ _ts_decorate8([
874
927
  ]),
875
928
  _ts_metadata7("design:returntype", Promise)
876
929
  ], ThreadsController.prototype, "fork", null);
930
+ _ts_decorate8([
931
+ (0, import_common8.Patch)(":id"),
932
+ _ts_param6(0, (0, import_common8.Req)()),
933
+ _ts_param6(1, (0, import_common8.Param)("id")),
934
+ _ts_param6(2, (0, import_common8.Body)()),
935
+ _ts_metadata7("design:type", Function),
936
+ _ts_metadata7("design:paramtypes", [
937
+ typeof Request === "undefined" ? Object : Request,
938
+ String,
939
+ typeof RenameThreadBody === "undefined" ? Object : RenameThreadBody
940
+ ]),
941
+ _ts_metadata7("design:returntype", Promise)
942
+ ], ThreadsController.prototype, "rename", null);
943
+ _ts_decorate8([
944
+ (0, import_common8.Post)(":id/promote"),
945
+ _ts_param6(0, (0, import_common8.Req)()),
946
+ _ts_param6(1, (0, import_common8.Param)("id")),
947
+ _ts_metadata7("design:type", Function),
948
+ _ts_metadata7("design:paramtypes", [
949
+ typeof Request === "undefined" ? Object : Request,
950
+ String
951
+ ]),
952
+ _ts_metadata7("design:returntype", Promise)
953
+ ], ThreadsController.prototype, "promote", null);
954
+ _ts_decorate8([
955
+ (0, import_common8.Delete)(":id/from/:messageId"),
956
+ _ts_param6(0, (0, import_common8.Req)()),
957
+ _ts_param6(1, (0, import_common8.Param)("id")),
958
+ _ts_param6(2, (0, import_common8.Param)("messageId")),
959
+ _ts_metadata7("design:type", Function),
960
+ _ts_metadata7("design:paramtypes", [
961
+ typeof Request === "undefined" ? Object : Request,
962
+ String,
963
+ String
964
+ ]),
965
+ _ts_metadata7("design:returntype", Promise)
966
+ ], ThreadsController.prototype, "truncateFrom", null);
877
967
  ThreadsController = _ts_decorate8([
878
968
  (0, import_common8.Controller)("threads"),
879
969
  _ts_param6(1, (0, import_common8.Inject)(import_nestjs_agent_core8.AGENT_ACTOR_RESOLVER)),
@@ -961,14 +1051,156 @@ ToolCallController = _ts_decorate9([
961
1051
  ])
962
1052
  ], ToolCallController);
963
1053
 
964
- // src/discovery/ai-tool-discovery.service.ts
1054
+ // src/discovery/agent-discovery.service.ts
965
1055
  var import_nestjs_agent_core10 = require("@dudousxd/nestjs-agent-core");
966
1056
  var import_common10 = require("@nestjs/common");
967
1057
  var import_core = require("@nestjs/core");
1058
+
1059
+ // src/decorator/agent.decorator.ts
1060
+ var import_reflect_metadata = require("reflect-metadata");
1061
+ var AGENT_METADATA = Symbol.for("@dudousxd/nestjs-agent:agent-metadata");
1062
+ function readAgentMetadata(target) {
1063
+ return Reflect.getMetadata(AGENT_METADATA, target);
1064
+ }
1065
+ __name(readAgentMetadata, "readAgentMetadata");
1066
+
1067
+ // src/decorator/system-prompt.decorator.ts
1068
+ var import_reflect_metadata2 = require("reflect-metadata");
1069
+ var SYSTEM_PROMPT_METADATA = Symbol.for("@dudousxd/nestjs-agent:system-prompt");
1070
+ var SYSTEM_PROMPT_CONTRIBUTOR_METADATA = Symbol.for("@dudousxd/nestjs-agent:system-prompt-contributor");
1071
+
1072
+ // src/discovery/agent-discovery.service.ts
1073
+ function _ts_decorate10(decorators, target, key, desc) {
1074
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1075
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1076
+ 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;
1077
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1078
+ }
1079
+ __name(_ts_decorate10, "_ts_decorate");
1080
+ function _ts_metadata9(k, v) {
1081
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1082
+ }
1083
+ __name(_ts_metadata9, "_ts_metadata");
1084
+ function _ts_param8(paramIndex, decorator) {
1085
+ return function(target, key) {
1086
+ decorator(target, key, paramIndex);
1087
+ };
1088
+ }
1089
+ __name(_ts_param8, "_ts_param");
1090
+ var AgentDiscoveryService = class _AgentDiscoveryService {
1091
+ static {
1092
+ __name(this, "AgentDiscoveryService");
1093
+ }
1094
+ discovery;
1095
+ scanner;
1096
+ registry;
1097
+ contributors;
1098
+ logger = new import_common10.Logger(_AgentDiscoveryService.name);
1099
+ constructor(discovery, scanner, registry, contributors) {
1100
+ this.discovery = discovery;
1101
+ this.scanner = scanner;
1102
+ this.registry = registry;
1103
+ this.contributors = contributors;
1104
+ }
1105
+ onModuleInit() {
1106
+ for (const wrapper of this.discovery.getProviders()) {
1107
+ const instance = wrapper.instance;
1108
+ if (instance === null || typeof instance !== "object") {
1109
+ continue;
1110
+ }
1111
+ const meta = readAgentMetadata(instance.constructor);
1112
+ if (meta !== void 0) {
1113
+ this.registry.register(this.definitionFrom(instance, meta));
1114
+ }
1115
+ this.collectContributors(instance);
1116
+ }
1117
+ }
1118
+ /** Build the internal {@link AgentDefinition} from an `@Agent` instance and its options. */
1119
+ definitionFrom(instance, meta) {
1120
+ const promptMethod = this.methodWith(instance, SYSTEM_PROMPT_METADATA);
1121
+ const systemPrompt = promptMethod !== void 0 ? (ctx) => promptMethod(ctx) : meta.systemPrompt ?? "You are a helpful assistant.";
1122
+ return {
1123
+ name: meta.name,
1124
+ systemPrompt,
1125
+ ...meta.tools !== void 0 ? {
1126
+ tools: meta.tools
1127
+ } : {},
1128
+ ...meta.model !== void 0 ? {
1129
+ modelId: meta.model
1130
+ } : {},
1131
+ ...meta.maxSteps !== void 0 ? {
1132
+ maxSteps: meta.maxSteps
1133
+ } : {},
1134
+ ...meta.handoff !== void 0 ? {
1135
+ delegatesTo: this.handoffNames(meta)
1136
+ } : {}
1137
+ };
1138
+ }
1139
+ /** Resolve each handoff `@Agent` class to its registered name (skipping non-agent classes). */
1140
+ handoffNames(meta) {
1141
+ const names = [];
1142
+ for (const target of meta.handoff ?? []) {
1143
+ const targetMeta = readAgentMetadata(target);
1144
+ if (targetMeta === void 0) {
1145
+ this.logger.warn(`Agent "${meta.name}" hands off to ${target.name}, which is not an @Agent \u2014 skipped.`);
1146
+ continue;
1147
+ }
1148
+ names.push(targetMeta.name);
1149
+ }
1150
+ return names;
1151
+ }
1152
+ /** Push every `@SystemPromptContributor()` method on `instance` (bound) into the contributor list. */
1153
+ collectContributors(instance) {
1154
+ const prototype = Object.getPrototypeOf(instance);
1155
+ for (const name of this.scanner.getAllMethodNames(prototype)) {
1156
+ if (Reflect.getMetadata(SYSTEM_PROMPT_CONTRIBUTOR_METADATA, prototype, name) === true) {
1157
+ const method = this.boundMethod(instance, name);
1158
+ if (method !== void 0) {
1159
+ this.contributors.push((ctx) => method(ctx));
1160
+ }
1161
+ }
1162
+ }
1163
+ }
1164
+ /** The single method on `instance` carrying `metadataKey`, bound to the instance, or undefined. */
1165
+ methodWith(instance, metadataKey) {
1166
+ const prototype = Object.getPrototypeOf(instance);
1167
+ for (const name of this.scanner.getAllMethodNames(prototype)) {
1168
+ if (Reflect.getMetadata(metadataKey, prototype, name) === true) {
1169
+ return this.boundMethod(instance, name);
1170
+ }
1171
+ }
1172
+ return void 0;
1173
+ }
1174
+ /** Bind a named method to its instance, guarding that it is actually a function. */
1175
+ boundMethod(instance, name) {
1176
+ const candidate = instance[name];
1177
+ if (typeof candidate !== "function") {
1178
+ return void 0;
1179
+ }
1180
+ return (ctx) => candidate.call(instance, ctx);
1181
+ }
1182
+ };
1183
+ AgentDiscoveryService = _ts_decorate10([
1184
+ (0, import_common10.Injectable)(),
1185
+ _ts_param8(2, (0, import_common10.Inject)(import_nestjs_agent_core10.AGENT_REGISTRY)),
1186
+ _ts_param8(3, (0, import_common10.Inject)(import_nestjs_agent_core10.AGENT_PROMPT_CONTRIBUTORS)),
1187
+ _ts_metadata9("design:type", Function),
1188
+ _ts_metadata9("design:paramtypes", [
1189
+ typeof import_core.DiscoveryService === "undefined" ? Object : import_core.DiscoveryService,
1190
+ typeof import_core.MetadataScanner === "undefined" ? Object : import_core.MetadataScanner,
1191
+ typeof import_nestjs_agent_core10.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core10.AgentRegistry,
1192
+ Array
1193
+ ])
1194
+ ], AgentDiscoveryService);
1195
+
1196
+ // src/discovery/ai-tool-discovery.service.ts
1197
+ var import_nestjs_agent_core11 = require("@dudousxd/nestjs-agent-core");
1198
+ var import_common11 = require("@nestjs/common");
1199
+ var import_core2 = require("@nestjs/core");
968
1200
  var import_zod = require("zod");
969
1201
 
970
1202
  // src/decorator/ai-tool.decorator.ts
971
- var import_reflect_metadata = require("reflect-metadata");
1203
+ var import_reflect_metadata3 = require("reflect-metadata");
972
1204
  var AI_TOOL_METADATA = Symbol("nestjs-agent:ai-tool");
973
1205
  function readAiToolMetadata(target) {
974
1206
  return Reflect.getMetadata(AI_TOOL_METADATA, target.constructor);
@@ -983,23 +1215,23 @@ function isBrandedFunctionalTool(value) {
983
1215
  __name(isBrandedFunctionalTool, "isBrandedFunctionalTool");
984
1216
 
985
1217
  // src/discovery/ai-tool-discovery.service.ts
986
- function _ts_decorate10(decorators, target, key, desc) {
1218
+ function _ts_decorate11(decorators, target, key, desc) {
987
1219
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
988
1220
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
989
1221
  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;
990
1222
  return c > 3 && r && Object.defineProperty(target, key, r), r;
991
1223
  }
992
- __name(_ts_decorate10, "_ts_decorate");
993
- function _ts_metadata9(k, v) {
1224
+ __name(_ts_decorate11, "_ts_decorate");
1225
+ function _ts_metadata10(k, v) {
994
1226
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
995
1227
  }
996
- __name(_ts_metadata9, "_ts_metadata");
997
- function _ts_param8(paramIndex, decorator) {
1228
+ __name(_ts_metadata10, "_ts_metadata");
1229
+ function _ts_param9(paramIndex, decorator) {
998
1230
  return function(target, key) {
999
1231
  decorator(target, key, paramIndex);
1000
1232
  };
1001
1233
  }
1002
- __name(_ts_param8, "_ts_param");
1234
+ __name(_ts_param9, "_ts_param");
1003
1235
  var AiToolDiscoveryService = class _AiToolDiscoveryService {
1004
1236
  static {
1005
1237
  __name(this, "AiToolDiscoveryService");
@@ -1008,7 +1240,7 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
1008
1240
  registry;
1009
1241
  agents;
1010
1242
  options;
1011
- logger = new import_common10.Logger(_AiToolDiscoveryService.name);
1243
+ logger = new import_common11.Logger(_AiToolDiscoveryService.name);
1012
1244
  constructor(discovery, registry, agents, options) {
1013
1245
  this.discovery = discovery;
1014
1246
  this.registry = registry;
@@ -1066,7 +1298,7 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
1066
1298
  for (const target of definition.delegatesTo ?? []) {
1067
1299
  const targetDefinition = this.agents.get(target);
1068
1300
  if (targetDefinition === void 0) {
1069
- throw new Error(`Agent "${definition.name}" delegatesTo "${target}", which is not a registered agent. Register it via AgentModule.forFeature([...]) or fix the name.`);
1301
+ throw new Error(`Agent "${definition.name}" hands off to "${target}", which is not a registered @Agent. Declare it as an @Agent provider or fix the reference.`);
1070
1302
  }
1071
1303
  const name = delegateToolName(target);
1072
1304
  if (this.registry.has(name)) {
@@ -1106,14 +1338,14 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
1106
1338
  return true;
1107
1339
  }
1108
1340
  };
1109
- AiToolDiscoveryService = _ts_decorate10([
1110
- (0, import_common10.Injectable)(),
1111
- _ts_param8(1, (0, import_common10.Inject)(import_nestjs_agent_core10.AGENT_TOOL_REGISTRY)),
1112
- _ts_param8(2, (0, import_common10.Inject)(import_nestjs_agent_core10.AGENT_REGISTRY)),
1113
- _ts_param8(3, (0, import_common10.Inject)(import_nestjs_agent_core10.AGENT_OPTIONS)),
1114
- _ts_metadata9("design:type", Function),
1115
- _ts_metadata9("design:paramtypes", [
1116
- typeof import_core.DiscoveryService === "undefined" ? Object : import_core.DiscoveryService,
1341
+ AiToolDiscoveryService = _ts_decorate11([
1342
+ (0, import_common11.Injectable)(),
1343
+ _ts_param9(1, (0, import_common11.Inject)(import_nestjs_agent_core11.AGENT_TOOL_REGISTRY)),
1344
+ _ts_param9(2, (0, import_common11.Inject)(import_nestjs_agent_core11.AGENT_REGISTRY)),
1345
+ _ts_param9(3, (0, import_common11.Inject)(import_nestjs_agent_core11.AGENT_OPTIONS)),
1346
+ _ts_metadata10("design:type", Function),
1347
+ _ts_metadata10("design:paramtypes", [
1348
+ typeof import_core2.DiscoveryService === "undefined" ? Object : import_core2.DiscoveryService,
1117
1349
  typeof ToolRegistry === "undefined" ? Object : ToolRegistry,
1118
1350
  typeof AgentRegistry === "undefined" ? Object : AgentRegistry,
1119
1351
  typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions
@@ -1121,7 +1353,7 @@ AiToolDiscoveryService = _ts_decorate10([
1121
1353
  ], AiToolDiscoveryService);
1122
1354
 
1123
1355
  // src/in-process-sink.ts
1124
- var import_nestjs_agent_core11 = require("@dudousxd/nestjs-agent-core");
1356
+ var import_nestjs_agent_core12 = require("@dudousxd/nestjs-agent-core");
1125
1357
  var InProcessTokenStreamSink = class {
1126
1358
  static {
1127
1359
  __name(this, "InProcessTokenStreamSink");
@@ -1176,7 +1408,7 @@ var InProcessTokenStreamSink = class {
1176
1408
  }
1177
1409
  if (buf.ended) {
1178
1410
  if (buf.failure !== void 0) {
1179
- throw new import_nestjs_agent_core11.AgentStreamError(buf.failure);
1411
+ throw new import_nestjs_agent_core12.AgentStreamError(buf.failure);
1180
1412
  }
1181
1413
  return;
1182
1414
  }
@@ -1212,32 +1444,32 @@ var LedgerQuotaStore = class {
1212
1444
  };
1213
1445
 
1214
1446
  // src/runner/inline-agent-runner.ts
1215
- var import_nestjs_agent_core12 = require("@dudousxd/nestjs-agent-core");
1216
- var import_common11 = require("@nestjs/common");
1217
- function _ts_decorate11(decorators, target, key, desc) {
1447
+ var import_nestjs_agent_core13 = require("@dudousxd/nestjs-agent-core");
1448
+ var import_common12 = require("@nestjs/common");
1449
+ function _ts_decorate12(decorators, target, key, desc) {
1218
1450
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1219
1451
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1220
1452
  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;
1221
1453
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1222
1454
  }
1223
- __name(_ts_decorate11, "_ts_decorate");
1224
- function _ts_metadata10(k, v) {
1455
+ __name(_ts_decorate12, "_ts_decorate");
1456
+ function _ts_metadata11(k, v) {
1225
1457
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1226
1458
  }
1227
- __name(_ts_metadata10, "_ts_metadata");
1228
- function _ts_param9(paramIndex, decorator) {
1459
+ __name(_ts_metadata11, "_ts_metadata");
1460
+ function _ts_param10(paramIndex, decorator) {
1229
1461
  return function(target, key) {
1230
1462
  decorator(target, key, paramIndex);
1231
1463
  };
1232
1464
  }
1233
- __name(_ts_param9, "_ts_param");
1465
+ __name(_ts_param10, "_ts_param");
1234
1466
  var InlineAgentRunner = class _InlineAgentRunner {
1235
1467
  static {
1236
1468
  __name(this, "InlineAgentRunner");
1237
1469
  }
1238
1470
  factory;
1239
1471
  store;
1240
- logger = new import_common11.Logger(_InlineAgentRunner.name);
1472
+ logger = new import_common12.Logger(_InlineAgentRunner.name);
1241
1473
  pending = /* @__PURE__ */ new Map();
1242
1474
  constructor(factory, store) {
1243
1475
  this.factory = factory;
@@ -1248,14 +1480,14 @@ var InlineAgentRunner = class _InlineAgentRunner {
1248
1480
  const day = input.day ?? utcDay();
1249
1481
  const deps = this.factory.forAgent(input.agentName);
1250
1482
  const hooks = this.topLevelHooks(runId, deps, input.actor, day);
1251
- void (0, import_nestjs_agent_core12.runAgentLoop)({
1483
+ void (0, import_nestjs_agent_core13.runAgentLoop)({
1252
1484
  ...deps,
1253
1485
  day
1254
1486
  }, input, hooks).catch(async (error) => {
1255
1487
  const message = error instanceof Error ? error.message : String(error);
1256
- const code = error instanceof import_nestjs_agent_core12.QuotaExceededError ? "quota_exceeded" : "run_failed";
1488
+ const code = error instanceof import_nestjs_agent_core13.QuotaExceededError ? "quota_exceeded" : "run_failed";
1257
1489
  this.logger.error(`agent run ${runId} failed (${code}): ${message}`);
1258
- (0, import_nestjs_agent_core12.publishAgentRunFailed)({
1490
+ (0, import_nestjs_agent_core13.publishAgentRunFailed)({
1259
1491
  runId,
1260
1492
  code,
1261
1493
  message
@@ -1302,7 +1534,6 @@ var InlineAgentRunner = class _InlineAgentRunner {
1302
1534
  async runNested(agentName, task, actor, day, depth, sinkRunId) {
1303
1535
  const subThread = await this.store.createThread({
1304
1536
  actor,
1305
- persona: "default",
1306
1537
  transient: true
1307
1538
  });
1308
1539
  const runId = crypto.randomUUID();
@@ -1318,7 +1549,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
1318
1549
  step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
1319
1550
  runAgent: /* @__PURE__ */ __name((childName, childTask) => this.runNested(childName, childTask, actor, day, depth + 1, sinkRunId), "runAgent")
1320
1551
  };
1321
- return (0, import_nestjs_agent_core12.runAgentLoop)({
1552
+ return (0, import_nestjs_agent_core13.runAgentLoop)({
1322
1553
  ...deps,
1323
1554
  day
1324
1555
  }, {
@@ -1332,111 +1563,105 @@ var InlineAgentRunner = class _InlineAgentRunner {
1332
1563
  }, hooks);
1333
1564
  }
1334
1565
  };
1335
- InlineAgentRunner = _ts_decorate11([
1336
- (0, import_common11.Injectable)(),
1337
- _ts_param9(0, (0, import_common11.Inject)(import_nestjs_agent_core12.AGENT_DEPS_FACTORY)),
1338
- _ts_param9(1, (0, import_common11.Inject)(import_nestjs_agent_core12.AGENT_STORE)),
1339
- _ts_metadata10("design:type", Function),
1340
- _ts_metadata10("design:paramtypes", [
1566
+ InlineAgentRunner = _ts_decorate12([
1567
+ (0, import_common12.Injectable)(),
1568
+ _ts_param10(0, (0, import_common12.Inject)(import_nestjs_agent_core13.AGENT_DEPS_FACTORY)),
1569
+ _ts_param10(1, (0, import_common12.Inject)(import_nestjs_agent_core13.AGENT_STORE)),
1570
+ _ts_metadata11("design:type", Function),
1571
+ _ts_metadata11("design:paramtypes", [
1341
1572
  typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
1342
1573
  typeof AgentStore === "undefined" ? Object : AgentStore
1343
1574
  ])
1344
1575
  ], InlineAgentRunner);
1345
1576
 
1346
1577
  // src/agent.module.ts
1347
- function _ts_decorate12(decorators, target, key, desc) {
1578
+ function _ts_decorate13(decorators, target, key, desc) {
1348
1579
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1349
1580
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1350
1581
  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;
1351
1582
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1352
1583
  }
1353
- __name(_ts_decorate12, "_ts_decorate");
1354
- var FEATURE_INIT = Symbol("nestjs-agent:feature-init");
1584
+ __name(_ts_decorate13, "_ts_decorate");
1355
1585
  var DEFAULT_PATH = "agent";
1356
- function defaultDefinition(options) {
1357
- return {
1358
- name: "default",
1359
- ...options.defaultAgent
1360
- };
1361
- }
1362
- __name(defaultDefinition, "defaultDefinition");
1363
1586
  function sharedProviders(durable, includeStore) {
1364
1587
  const providers = [
1365
1588
  {
1366
- provide: import_nestjs_agent_core13.AGENT_TOOL_REGISTRY,
1367
- useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core13.ToolRegistry(), "useFactory")
1589
+ provide: import_nestjs_agent_core14.AGENT_TOOL_REGISTRY,
1590
+ useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core14.ToolRegistry(), "useFactory")
1368
1591
  },
1592
+ // Starts empty; AgentDiscoveryService populates it from `@Agent`-decorated providers at boot.
1369
1593
  {
1370
- provide: import_nestjs_agent_core13.AGENT_REGISTRY,
1371
- useFactory: /* @__PURE__ */ __name((options) => {
1372
- const registry = new import_nestjs_agent_core13.AgentRegistry();
1373
- registry.register(defaultDefinition(options));
1374
- return registry;
1375
- }, "useFactory"),
1376
- inject: [
1377
- import_nestjs_agent_core13.AGENT_OPTIONS
1378
- ]
1594
+ provide: import_nestjs_agent_core14.AGENT_REGISTRY,
1595
+ useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core14.AgentRegistry(), "useFactory")
1596
+ },
1597
+ // A shared, mutable list AgentDiscoveryService fills with `@SystemPromptContributor()` methods.
1598
+ {
1599
+ provide: import_nestjs_agent_core14.AGENT_PROMPT_CONTRIBUTORS,
1600
+ useFactory: /* @__PURE__ */ __name(() => [], "useFactory")
1379
1601
  },
1380
1602
  {
1381
- provide: import_nestjs_agent_core13.AGENT_SINK,
1603
+ provide: import_nestjs_agent_core14.AGENT_SINK,
1382
1604
  useFactory: /* @__PURE__ */ __name((options) => options.sink ?? new InProcessTokenStreamSink(), "useFactory"),
1383
1605
  inject: [
1384
- import_nestjs_agent_core13.AGENT_OPTIONS
1606
+ import_nestjs_agent_core14.AGENT_OPTIONS
1385
1607
  ]
1386
1608
  },
1387
1609
  {
1388
- provide: import_nestjs_agent_core13.AGENT_ROLES_POLICY,
1389
- useFactory: /* @__PURE__ */ __name((options) => options.rolesPolicy ?? new import_nestjs_agent_core13.DefaultRolesPolicy(options.defaultRoles), "useFactory"),
1610
+ provide: import_nestjs_agent_core14.AGENT_ROLES_POLICY,
1611
+ useFactory: /* @__PURE__ */ __name((options) => options.rolesPolicy ?? new import_nestjs_agent_core14.DefaultRolesPolicy(options.defaultRoles), "useFactory"),
1390
1612
  inject: [
1391
- import_nestjs_agent_core13.AGENT_OPTIONS
1613
+ import_nestjs_agent_core14.AGENT_OPTIONS
1392
1614
  ]
1393
1615
  },
1394
1616
  {
1395
- provide: import_nestjs_agent_core13.AGENT_ACTOR_RESOLVER,
1617
+ provide: import_nestjs_agent_core14.AGENT_ACTOR_RESOLVER,
1396
1618
  useFactory: /* @__PURE__ */ __name((options) => options.actorResolver, "useFactory"),
1397
1619
  inject: [
1398
- import_nestjs_agent_core13.AGENT_OPTIONS
1620
+ import_nestjs_agent_core14.AGENT_OPTIONS
1399
1621
  ]
1400
1622
  },
1401
1623
  {
1402
- provide: import_nestjs_agent_core13.AGENT_MODEL,
1624
+ provide: import_nestjs_agent_core14.AGENT_MODEL,
1403
1625
  useFactory: /* @__PURE__ */ __name((o) => o.model, "useFactory"),
1404
1626
  inject: [
1405
- import_nestjs_agent_core13.AGENT_OPTIONS
1627
+ import_nestjs_agent_core14.AGENT_OPTIONS
1406
1628
  ]
1407
1629
  },
1408
1630
  {
1409
1631
  // An explicit `quota` wins; otherwise `quotaLimitTokens` binds the built-in ledger-backed
1410
1632
  // store; otherwise quotas are off (undefined). The ledger store reads the same usage rows
1411
1633
  // the loop already writes, so enforcement needs no extra shared state across replicas.
1412
- provide: import_nestjs_agent_core13.AGENT_QUOTA_STORE,
1634
+ provide: import_nestjs_agent_core14.AGENT_QUOTA_STORE,
1413
1635
  useFactory: /* @__PURE__ */ __name((o, store) => o.quota ?? (o.quotaLimitTokens !== void 0 ? new LedgerQuotaStore(store, o.quotaLimitTokens) : void 0), "useFactory"),
1414
1636
  inject: [
1415
- import_nestjs_agent_core13.AGENT_OPTIONS,
1416
- import_nestjs_agent_core13.AGENT_STORE
1637
+ import_nestjs_agent_core14.AGENT_OPTIONS,
1638
+ import_nestjs_agent_core14.AGENT_STORE
1417
1639
  ]
1418
1640
  },
1419
1641
  AgentDepsFactory2,
1420
1642
  {
1421
- provide: import_nestjs_agent_core13.AGENT_DEPS_FACTORY,
1643
+ provide: import_nestjs_agent_core14.AGENT_DEPS_FACTORY,
1422
1644
  useExisting: AgentDepsFactory2
1423
1645
  },
1646
+ // Populates the registry + contributors (onModuleInit) BEFORE AiToolDiscoveryService synthesizes
1647
+ // handoff tools (onApplicationBootstrap) reads the registry.
1648
+ AgentDiscoveryService,
1424
1649
  AiToolDiscoveryService,
1425
1650
  InlineAgentRunner,
1426
1651
  AgentService
1427
1652
  ];
1428
1653
  if (includeStore) {
1429
1654
  providers.push({
1430
- provide: import_nestjs_agent_core13.AGENT_STORE,
1655
+ provide: import_nestjs_agent_core14.AGENT_STORE,
1431
1656
  useFactory: /* @__PURE__ */ __name((o) => o.store, "useFactory"),
1432
1657
  inject: [
1433
- import_nestjs_agent_core13.AGENT_OPTIONS
1658
+ import_nestjs_agent_core14.AGENT_OPTIONS
1434
1659
  ]
1435
1660
  });
1436
1661
  }
1437
1662
  if (durable) {
1438
1663
  providers.push({
1439
- provide: import_nestjs_agent_core13.AGENT_RUNNER,
1664
+ provide: import_nestjs_agent_core14.AGENT_RUNNER,
1440
1665
  useFactory: /* @__PURE__ */ __name((durableRunner) => {
1441
1666
  if (durableRunner === void 0) {
1442
1667
  throw new Error("AgentModule.forRoot({ durable: true }) requires importing AgentDurableModule from '@dudousxd/nestjs-agent/durable' (alongside a configured DurableModule). It was not found.");
@@ -1445,14 +1670,14 @@ function sharedProviders(durable, includeStore) {
1445
1670
  }, "useFactory"),
1446
1671
  inject: [
1447
1672
  {
1448
- token: import_nestjs_agent_core13.AGENT_DURABLE_RUNNER,
1673
+ token: import_nestjs_agent_core14.AGENT_DURABLE_RUNNER,
1449
1674
  optional: true
1450
1675
  }
1451
1676
  ]
1452
1677
  });
1453
1678
  } else {
1454
1679
  providers.push({
1455
- provide: import_nestjs_agent_core13.AGENT_RUNNER,
1680
+ provide: import_nestjs_agent_core14.AGENT_RUNNER,
1456
1681
  useExisting: InlineAgentRunner
1457
1682
  });
1458
1683
  }
@@ -1461,18 +1686,19 @@ function sharedProviders(durable, includeStore) {
1461
1686
  __name(sharedProviders, "sharedProviders");
1462
1687
  function exportsFor(includeStore) {
1463
1688
  return [
1464
- import_nestjs_agent_core13.AGENT_OPTIONS,
1465
- import_nestjs_agent_core13.AGENT_TOOL_REGISTRY,
1466
- import_nestjs_agent_core13.AGENT_REGISTRY,
1467
- import_nestjs_agent_core13.AGENT_SINK,
1468
- import_nestjs_agent_core13.AGENT_ROLES_POLICY,
1469
- import_nestjs_agent_core13.AGENT_ACTOR_RESOLVER,
1470
- import_nestjs_agent_core13.AGENT_MODEL,
1689
+ import_nestjs_agent_core14.AGENT_OPTIONS,
1690
+ import_nestjs_agent_core14.AGENT_TOOL_REGISTRY,
1691
+ import_nestjs_agent_core14.AGENT_REGISTRY,
1692
+ import_nestjs_agent_core14.AGENT_SINK,
1693
+ import_nestjs_agent_core14.AGENT_ROLES_POLICY,
1694
+ import_nestjs_agent_core14.AGENT_ACTOR_RESOLVER,
1695
+ import_nestjs_agent_core14.AGENT_MODEL,
1471
1696
  ...includeStore ? [
1472
- import_nestjs_agent_core13.AGENT_STORE
1697
+ import_nestjs_agent_core14.AGENT_STORE
1473
1698
  ] : [],
1474
- import_nestjs_agent_core13.AGENT_QUOTA_STORE,
1475
- import_nestjs_agent_core13.AGENT_DEPS_FACTORY,
1699
+ import_nestjs_agent_core14.AGENT_QUOTA_STORE,
1700
+ import_nestjs_agent_core14.AGENT_PROMPT_CONTRIBUTORS,
1701
+ import_nestjs_agent_core14.AGENT_DEPS_FACTORY,
1476
1702
  AgentDepsFactory2,
1477
1703
  AgentService,
1478
1704
  InlineAgentRunner
@@ -1486,7 +1712,7 @@ var CONTROLLERS = [
1486
1712
  QuotaController
1487
1713
  ];
1488
1714
  function routerFor(path) {
1489
- return import_core2.RouterModule.register([
1715
+ return import_core3.RouterModule.register([
1490
1716
  {
1491
1717
  path,
1492
1718
  module: AgentModule
@@ -1505,13 +1731,13 @@ var AgentModule = class _AgentModule {
1505
1731
  module: _AgentModule,
1506
1732
  global: true,
1507
1733
  imports: [
1508
- import_core2.DiscoveryModule,
1734
+ import_core3.DiscoveryModule,
1509
1735
  routerFor(path)
1510
1736
  ],
1511
1737
  controllers: CONTROLLERS,
1512
1738
  providers: [
1513
1739
  {
1514
- provide: import_nestjs_agent_core13.AGENT_OPTIONS,
1740
+ provide: import_nestjs_agent_core14.AGENT_OPTIONS,
1515
1741
  useValue: options
1516
1742
  },
1517
1743
  ...sharedProviders(options.durable ?? false, includeStore)
@@ -1525,14 +1751,14 @@ var AgentModule = class _AgentModule {
1525
1751
  module: _AgentModule,
1526
1752
  global: true,
1527
1753
  imports: [
1528
- import_core2.DiscoveryModule,
1754
+ import_core3.DiscoveryModule,
1529
1755
  routerFor(path),
1530
1756
  ...options.imports ?? []
1531
1757
  ],
1532
1758
  controllers: CONTROLLERS,
1533
1759
  providers: [
1534
1760
  {
1535
- provide: import_nestjs_agent_core13.AGENT_OPTIONS,
1761
+ provide: import_nestjs_agent_core14.AGENT_OPTIONS,
1536
1762
  useFactory: options.useFactory,
1537
1763
  inject: options.inject ?? []
1538
1764
  },
@@ -1543,30 +1769,10 @@ var AgentModule = class _AgentModule {
1543
1769
  exports: exportsFor(true)
1544
1770
  };
1545
1771
  }
1546
- /** Register additional named agents (an orchestrator + its sub-agents). */
1547
- static forFeature(definitions) {
1548
- return {
1549
- module: _AgentModule,
1550
- providers: [
1551
- {
1552
- provide: FEATURE_INIT,
1553
- useFactory: /* @__PURE__ */ __name((registry) => {
1554
- for (const definition of definitions) {
1555
- registry.register(definition);
1556
- }
1557
- return true;
1558
- }, "useFactory"),
1559
- inject: [
1560
- import_nestjs_agent_core13.AGENT_REGISTRY
1561
- ]
1562
- }
1563
- ]
1564
- };
1565
- }
1566
1772
  };
1567
- AgentModule = _ts_decorate12([
1568
- (0, import_common12.Global)(),
1569
- (0, import_common12.Module)({})
1773
+ AgentModule = _ts_decorate13([
1774
+ (0, import_common13.Global)(),
1775
+ (0, import_common13.Module)({})
1570
1776
  ], AgentModule);
1571
1777
 
1572
1778
  // src/durable/agent-durable.ts