@dudousxd/nestjs-agent 1.6.0 → 1.8.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.
@@ -120,7 +120,10 @@ var AgentRunSteps = class {
120
120
  system: input.system,
121
121
  messages: input.messages,
122
122
  tools,
123
- sink: frames.writer
123
+ sink: frames.writer,
124
+ ...input.model !== void 0 ? {
125
+ model: input.model
126
+ } : {}
124
127
  })), frames.summary());
125
128
  const stamped = (0, import_nestjs_agent_core.stampToolKinds)(turn, deps);
126
129
  return buffer === void 0 ? stamped : {
@@ -818,8 +821,8 @@ AgentDurableModule = _ts_decorate4([
818
821
  ], AgentDurableModule);
819
822
 
820
823
  // src/agent.module.ts
821
- var import_nestjs_agent_core25 = require("@dudousxd/nestjs-agent-core");
822
- var import_common22 = require("@nestjs/common");
824
+ var import_nestjs_agent_core27 = require("@dudousxd/nestjs-agent-core");
825
+ var import_common23 = require("@nestjs/common");
823
826
  var import_core4 = require("@nestjs/core");
824
827
 
825
828
  // src/agent-deps.factory.ts
@@ -1125,15 +1128,128 @@ var AgentService = class {
1125
1128
  deps;
1126
1129
  quota;
1127
1130
  staging;
1128
- constructor(runner, store, deps, quota, staging) {
1131
+ models;
1132
+ quotaProvider;
1133
+ options;
1134
+ constructor(runner, store, deps, quota, staging, models, quotaProvider, options) {
1129
1135
  this.runner = runner;
1130
1136
  this.store = store;
1131
1137
  this.deps = deps;
1132
1138
  this.quota = quota;
1133
1139
  this.staging = staging;
1140
+ this.models = models;
1141
+ this.quotaProvider = quotaProvider;
1142
+ this.options = options;
1143
+ }
1144
+ /**
1145
+ * The actor's budget across windows (`GET <base>/quota`) — the bound {@link QuotaProvider}'s
1146
+ * report. Without one (a service built outside the module), a day window from the ledger.
1147
+ */
1148
+ async quotaReport(actor) {
1149
+ if (this.quotaProvider !== void 0) {
1150
+ return this.quotaProvider.report({
1151
+ actor
1152
+ });
1153
+ }
1154
+ const today = await this.quotaToday(actor.id);
1155
+ return {
1156
+ windows: [
1157
+ {
1158
+ period: "day",
1159
+ usedTokens: today.usedTokens,
1160
+ ...today.limitTokens !== null ? {
1161
+ limitTokens: today.limitTokens
1162
+ } : {},
1163
+ usedUsd: today.costUsd
1164
+ }
1165
+ ],
1166
+ ...today.withinLimit ? {} : {
1167
+ blocked: {
1168
+ period: "day"
1169
+ }
1170
+ }
1171
+ };
1172
+ }
1173
+ /**
1174
+ * Refuse a turn the actor's budget no longer covers — only when the host configured one
1175
+ * (`quotaProvider` or `quotaLimits`): the default report is informational, and the daily token
1176
+ * quota the loop enforces keeps working as it always has.
1177
+ */
1178
+ async assertWithinQuota(actor) {
1179
+ const gated = this.options?.quotaProvider !== void 0 || this.options?.quotaLimits !== void 0;
1180
+ if (!gated || this.quotaProvider === void 0) {
1181
+ return;
1182
+ }
1183
+ const { blocked } = await this.quotaProvider.report({
1184
+ actor
1185
+ });
1186
+ if (blocked !== void 0) {
1187
+ throw new import_common6.HttpException({
1188
+ statusCode: import_common6.HttpStatus.TOO_MANY_REQUESTS,
1189
+ code: "quota_exceeded",
1190
+ period: blocked.period,
1191
+ message: blocked.reason ?? `The ${blocked.period === "day" ? "daily" : "monthly"} quota is used up`
1192
+ }, import_common6.HttpStatus.TOO_MANY_REQUESTS);
1193
+ }
1194
+ }
1195
+ /**
1196
+ * The models `actor` may pick for `agent` (`GET <base>/models`). An empty catalog when none is
1197
+ * bound, so a picker simply has nothing to offer.
1198
+ */
1199
+ async listModels(actor, agent) {
1200
+ if (this.models === void 0) {
1201
+ return {
1202
+ providers: [],
1203
+ default: null
1204
+ };
1205
+ }
1206
+ return this.models.list({
1207
+ actor,
1208
+ ...agent !== void 0 ? {
1209
+ agent
1210
+ } : {}
1211
+ });
1212
+ }
1213
+ /**
1214
+ * `model` if the catalog offers it to this actor and agent right now, else a 400 naming why. The
1215
+ * one gate every model choice passes — a send's own, and a thread's pinned one at the moment it is
1216
+ * pinned and again at every turn that runs on it (availability can change in between).
1217
+ */
1218
+ async assertModelAllowed(actor, agent, model) {
1219
+ if (this.models === void 0) {
1220
+ throw new import_common6.BadRequestException(`model "${model}" cannot be selected: no ModelCatalog is configured (AgentModule.forRoot({ models }))`);
1221
+ }
1222
+ const entry = (0, import_nestjs_agent_core8.findCatalogModel)(await this.models.list({
1223
+ actor,
1224
+ agent
1225
+ }), model);
1226
+ if (entry === void 0) {
1227
+ throw new import_common6.BadRequestException(`model "${model}" is not offered`);
1228
+ }
1229
+ if (!entry.available) {
1230
+ throw new import_common6.BadRequestException(`model "${model}" is not available${entry.unavailableReason ? `: ${entry.unavailableReason}` : ""}`);
1231
+ }
1232
+ return entry.id;
1233
+ }
1234
+ /** The model a turn runs on: the send's own, else the thread's pinned one, else none. */
1235
+ async resolveModel(actor, agent, requested, threadId) {
1236
+ const model = requested ?? (threadId !== void 0 ? await this.threadModel(threadId) : null);
1237
+ if (model === null || model === void 0) {
1238
+ return void 0;
1239
+ }
1240
+ return this.assertModelAllowed(actor, agent, model);
1241
+ }
1242
+ async threadModel(threadId) {
1243
+ const projecting = this.store;
1244
+ if (typeof projecting.modelForThread === "function") {
1245
+ return projecting.modelForThread(threadId);
1246
+ }
1247
+ return (await this.store.getThread(threadId))?.model ?? null;
1134
1248
  }
1135
1249
  async chat(params) {
1250
+ await this.assertWithinQuota(params.actor);
1136
1251
  const agentName = await this.resolveAgentName(params.agentName, params.threadId);
1252
+ const model = await this.resolveModel(params.actor, agentName, params.model, params.threadId);
1137
1253
  const attachments = await this.resolveAttachments(params.actor, params.attachments ?? []);
1138
1254
  let threadId = params.threadId;
1139
1255
  if (threadId === void 0) {
@@ -1164,6 +1280,9 @@ var AgentService = class {
1164
1280
  } : {},
1165
1281
  ...params.pageContext !== void 0 ? {
1166
1282
  pageContext: params.pageContext
1283
+ } : {},
1284
+ ...model !== void 0 ? {
1285
+ model
1167
1286
  } : {}
1168
1287
  };
1169
1288
  const { runId } = await this.runner.start(input);
@@ -1334,20 +1453,26 @@ var AgentService = class {
1334
1453
  async updateThread(actor, threadId, patch) {
1335
1454
  const title = patch.title !== void 0 ? this.validateTitle(patch.title) : void 0;
1336
1455
  await this.assertOwnsThread(actor, threadId);
1337
- if (patch.defaultAgent === void 0) {
1456
+ if (patch.defaultAgent === void 0 && patch.model === void 0) {
1338
1457
  if (title !== void 0) {
1339
1458
  await this.store.setTitle(threadId, title);
1340
1459
  }
1341
1460
  return;
1342
1461
  }
1343
1462
  if (this.store.updateThread === void 0) {
1344
- throw new import_common6.NotImplementedException("Setting a thread's defaultAgent requires an AgentStore that implements updateThread(); the bound store does not support it.");
1463
+ throw new import_common6.NotImplementedException("Setting a thread's defaultAgent or model requires an AgentStore that implements updateThread(); the bound store does not support it.");
1345
1464
  }
1465
+ const model = patch.model === void 0 || patch.model === null ? patch.model : await this.assertModelAllowed(actor, patch.defaultAgent ?? await this.resolveAgentName(void 0, threadId), patch.model);
1346
1466
  await this.store.updateThread(threadId, {
1347
1467
  ...title !== void 0 ? {
1348
1468
  title
1349
1469
  } : {},
1350
- defaultAgent: patch.defaultAgent
1470
+ ...patch.defaultAgent !== void 0 ? {
1471
+ defaultAgent: patch.defaultAgent
1472
+ } : {},
1473
+ ...model !== void 0 ? {
1474
+ model
1475
+ } : {}
1351
1476
  });
1352
1477
  }
1353
1478
  validateTitle(title) {
@@ -1394,6 +1519,7 @@ var AgentService = class {
1394
1519
  return {
1395
1520
  ...thread,
1396
1521
  defaultAgent: thread.defaultAgent ?? null,
1522
+ model: thread.model ?? null,
1397
1523
  activeRunId: await this.store.activeRunForThread?.(thread.id) ?? null
1398
1524
  };
1399
1525
  }
@@ -1661,13 +1787,22 @@ AgentService = _ts_decorate6([
1661
1787
  _ts_param5(3, (0, import_common6.Inject)(import_nestjs_agent_core8.AGENT_QUOTA_STORE)),
1662
1788
  _ts_param5(4, (0, import_common6.Optional)()),
1663
1789
  _ts_param5(4, (0, import_common6.Inject)(import_nestjs_agent_core8.AGENT_ATTACHMENT_STAGING)),
1790
+ _ts_param5(5, (0, import_common6.Optional)()),
1791
+ _ts_param5(5, (0, import_common6.Inject)(import_nestjs_agent_core8.AGENT_MODEL_CATALOG)),
1792
+ _ts_param5(6, (0, import_common6.Optional)()),
1793
+ _ts_param5(6, (0, import_common6.Inject)(import_nestjs_agent_core8.AGENT_QUOTA_PROVIDER)),
1794
+ _ts_param5(7, (0, import_common6.Optional)()),
1795
+ _ts_param5(7, (0, import_common6.Inject)(import_nestjs_agent_core8.AGENT_OPTIONS)),
1664
1796
  _ts_metadata5("design:type", Function),
1665
1797
  _ts_metadata5("design:paramtypes", [
1666
1798
  typeof AgentRunner === "undefined" ? Object : AgentRunner,
1667
1799
  typeof AgentStore === "undefined" ? Object : AgentStore,
1668
1800
  typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
1669
1801
  Object,
1670
- typeof AttachmentStagingStore === "undefined" ? Object : AttachmentStagingStore
1802
+ typeof AttachmentStagingStore === "undefined" ? Object : AttachmentStagingStore,
1803
+ typeof ModelCatalog === "undefined" ? Object : ModelCatalog,
1804
+ typeof QuotaProvider === "undefined" ? Object : QuotaProvider,
1805
+ typeof Pick === "undefined" ? Object : Pick
1671
1806
  ])
1672
1807
  ], AgentService);
1673
1808
 
@@ -2039,6 +2174,9 @@ var ChatController = class {
2039
2174
  } : {},
2040
2175
  ...body.transient === true ? {
2041
2176
  transient: true
2177
+ } : {},
2178
+ ...typeof body.model === "string" && body.model.length > 0 ? {
2179
+ model: body.model
2042
2180
  } : {}
2043
2181
  });
2044
2182
  await this.pipe(res, runId, this.agent.subscribe(runId), threadId);
@@ -2403,7 +2541,7 @@ MessagesController = _ts_decorate12([
2403
2541
  ])
2404
2542
  ], MessagesController);
2405
2543
 
2406
- // src/controller/quota.controller.ts
2544
+ // src/controller/models.controller.ts
2407
2545
  var import_nestjs_agent_core14 = require("@dudousxd/nestjs-agent-core");
2408
2546
  var import_common13 = require("@nestjs/common");
2409
2547
  function _ts_decorate13(decorators, target, key, desc) {
@@ -2432,9 +2570,9 @@ function _ts_param11(paramIndex, decorator) {
2432
2570
  };
2433
2571
  }
2434
2572
  __name(_ts_param11, "_ts_param");
2435
- var QuotaController = class {
2573
+ var ModelsController = class {
2436
2574
  static {
2437
- __name(this, "QuotaController");
2575
+ __name(this, "ModelsController");
2438
2576
  }
2439
2577
  agent;
2440
2578
  actorResolver;
@@ -2442,31 +2580,37 @@ var QuotaController = class {
2442
2580
  this.agent = agent;
2443
2581
  this.actorResolver = actorResolver;
2444
2582
  }
2445
- async today(req) {
2583
+ /**
2584
+ * The models the caller may pick for `agent` (the default agent when omitted), grouped by
2585
+ * provider, with badges and availability — the bound `ModelCatalog`'s answer, or an empty one.
2586
+ */
2587
+ async list(req, agent) {
2446
2588
  const actor = await this.actorResolver.resolve(req);
2447
- return this.agent.quotaToday(actor.id);
2589
+ return this.agent.listModels(actor, agent);
2448
2590
  }
2449
2591
  };
2450
2592
  _ts_decorate13([
2451
- (0, import_common13.Get)("today"),
2593
+ (0, import_common13.Get)(),
2452
2594
  _ts_param11(0, (0, import_common13.Req)()),
2595
+ _ts_param11(1, (0, import_common13.Query)("agent")),
2453
2596
  _ts_metadata12("design:type", Function),
2454
2597
  _ts_metadata12("design:paramtypes", [
2455
- typeof Request === "undefined" ? Object : Request
2598
+ typeof Request === "undefined" ? Object : Request,
2599
+ String
2456
2600
  ]),
2457
2601
  _ts_metadata12("design:returntype", Promise)
2458
- ], QuotaController.prototype, "today", null);
2459
- QuotaController = _ts_decorate13([
2460
- (0, import_common13.Controller)("quota"),
2602
+ ], ModelsController.prototype, "list", null);
2603
+ ModelsController = _ts_decorate13([
2604
+ (0, import_common13.Controller)("models"),
2461
2605
  _ts_param11(1, (0, import_common13.Inject)(import_nestjs_agent_core14.AGENT_ACTOR_RESOLVER)),
2462
2606
  _ts_metadata12("design:type", Function),
2463
2607
  _ts_metadata12("design:paramtypes", [
2464
2608
  typeof AgentService === "undefined" ? Object : AgentService,
2465
2609
  typeof ActorResolver === "undefined" ? Object : ActorResolver
2466
2610
  ])
2467
- ], QuotaController);
2611
+ ], ModelsController);
2468
2612
 
2469
- // src/controller/skills.controller.ts
2613
+ // src/controller/quota.controller.ts
2470
2614
  var import_nestjs_agent_core15 = require("@dudousxd/nestjs-agent-core");
2471
2615
  var import_common14 = require("@nestjs/common");
2472
2616
  function _ts_decorate14(decorators, target, key, desc) {
@@ -2495,6 +2639,86 @@ function _ts_param12(paramIndex, decorator) {
2495
2639
  };
2496
2640
  }
2497
2641
  __name(_ts_param12, "_ts_param");
2642
+ var QuotaController = class {
2643
+ static {
2644
+ __name(this, "QuotaController");
2645
+ }
2646
+ agent;
2647
+ actorResolver;
2648
+ constructor(agent, actorResolver) {
2649
+ this.agent = agent;
2650
+ this.actorResolver = actorResolver;
2651
+ }
2652
+ /**
2653
+ * The caller's budget across windows — `{ windows: [{ period, usedTokens, limitTokens?, usedUsd,
2654
+ * limitUsd?, resetsAt? }], blocked?: { period, reason? } }` — from the bound `QuotaProvider`.
2655
+ */
2656
+ async report(req) {
2657
+ const actor = await this.actorResolver.resolve(req);
2658
+ return this.agent.quotaReport(actor);
2659
+ }
2660
+ async today(req) {
2661
+ const actor = await this.actorResolver.resolve(req);
2662
+ return this.agent.quotaToday(actor.id);
2663
+ }
2664
+ };
2665
+ _ts_decorate14([
2666
+ (0, import_common14.Get)(),
2667
+ _ts_param12(0, (0, import_common14.Req)()),
2668
+ _ts_metadata13("design:type", Function),
2669
+ _ts_metadata13("design:paramtypes", [
2670
+ typeof Request === "undefined" ? Object : Request
2671
+ ]),
2672
+ _ts_metadata13("design:returntype", Promise)
2673
+ ], QuotaController.prototype, "report", null);
2674
+ _ts_decorate14([
2675
+ (0, import_common14.Get)("today"),
2676
+ _ts_param12(0, (0, import_common14.Req)()),
2677
+ _ts_metadata13("design:type", Function),
2678
+ _ts_metadata13("design:paramtypes", [
2679
+ typeof Request === "undefined" ? Object : Request
2680
+ ]),
2681
+ _ts_metadata13("design:returntype", Promise)
2682
+ ], QuotaController.prototype, "today", null);
2683
+ QuotaController = _ts_decorate14([
2684
+ (0, import_common14.Controller)("quota"),
2685
+ _ts_param12(1, (0, import_common14.Inject)(import_nestjs_agent_core15.AGENT_ACTOR_RESOLVER)),
2686
+ _ts_metadata13("design:type", Function),
2687
+ _ts_metadata13("design:paramtypes", [
2688
+ typeof AgentService === "undefined" ? Object : AgentService,
2689
+ typeof ActorResolver === "undefined" ? Object : ActorResolver
2690
+ ])
2691
+ ], QuotaController);
2692
+
2693
+ // src/controller/skills.controller.ts
2694
+ var import_nestjs_agent_core16 = require("@dudousxd/nestjs-agent-core");
2695
+ var import_common15 = require("@nestjs/common");
2696
+ function _ts_decorate15(decorators, target, key, desc) {
2697
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2698
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
2699
+ r = Reflect.decorate(decorators, target, key, desc);
2700
+ } else {
2701
+ for (var i = decorators.length - 1; i >= 0; i--) {
2702
+ if (d = decorators[i]) {
2703
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2704
+ }
2705
+ }
2706
+ }
2707
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2708
+ }
2709
+ __name(_ts_decorate15, "_ts_decorate");
2710
+ function _ts_metadata14(metadataKey, metadataValue) {
2711
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
2712
+ return Reflect.metadata(metadataKey, metadataValue);
2713
+ }
2714
+ }
2715
+ __name(_ts_metadata14, "_ts_metadata");
2716
+ function _ts_param13(paramIndex, decorator) {
2717
+ return function(target, key) {
2718
+ decorator(target, key, paramIndex);
2719
+ };
2720
+ }
2721
+ __name(_ts_param13, "_ts_param");
2498
2722
  var SkillsController = class {
2499
2723
  static {
2500
2724
  __name(this, "SkillsController");
@@ -2510,40 +2734,40 @@ var SkillsController = class {
2510
2734
  return [];
2511
2735
  }
2512
2736
  const actor = await this.actorResolver.resolve(req);
2513
- const offer = await (0, import_nestjs_agent_core15.offerSkills)(this.skills, {
2737
+ const offer = await (0, import_nestjs_agent_core16.offerSkills)(this.skills, {
2514
2738
  actor,
2515
2739
  threadId: threadId ?? ""
2516
2740
  });
2517
2741
  return offer.entries;
2518
2742
  }
2519
2743
  };
2520
- _ts_decorate14([
2521
- (0, import_common14.Get)(),
2522
- _ts_param12(0, (0, import_common14.Req)()),
2523
- _ts_param12(1, (0, import_common14.Query)("threadId")),
2524
- _ts_metadata13("design:type", Function),
2525
- _ts_metadata13("design:paramtypes", [
2744
+ _ts_decorate15([
2745
+ (0, import_common15.Get)(),
2746
+ _ts_param13(0, (0, import_common15.Req)()),
2747
+ _ts_param13(1, (0, import_common15.Query)("threadId")),
2748
+ _ts_metadata14("design:type", Function),
2749
+ _ts_metadata14("design:paramtypes", [
2526
2750
  typeof Request === "undefined" ? Object : Request,
2527
2751
  String
2528
2752
  ]),
2529
- _ts_metadata13("design:returntype", Promise)
2753
+ _ts_metadata14("design:returntype", Promise)
2530
2754
  ], SkillsController.prototype, "list", null);
2531
- SkillsController = _ts_decorate14([
2532
- (0, import_common14.Controller)("skills"),
2533
- _ts_param12(0, (0, import_common14.Inject)(import_nestjs_agent_core15.AGENT_ACTOR_RESOLVER)),
2534
- _ts_param12(1, (0, import_common14.Optional)()),
2535
- _ts_param12(1, (0, import_common14.Inject)(import_nestjs_agent_core15.AGENT_SKILLS)),
2536
- _ts_metadata13("design:type", Function),
2537
- _ts_metadata13("design:paramtypes", [
2755
+ SkillsController = _ts_decorate15([
2756
+ (0, import_common15.Controller)("skills"),
2757
+ _ts_param13(0, (0, import_common15.Inject)(import_nestjs_agent_core16.AGENT_ACTOR_RESOLVER)),
2758
+ _ts_param13(1, (0, import_common15.Optional)()),
2759
+ _ts_param13(1, (0, import_common15.Inject)(import_nestjs_agent_core16.AGENT_SKILLS)),
2760
+ _ts_metadata14("design:type", Function),
2761
+ _ts_metadata14("design:paramtypes", [
2538
2762
  typeof ActorResolver === "undefined" ? Object : ActorResolver,
2539
2763
  Object
2540
2764
  ])
2541
2765
  ], SkillsController);
2542
2766
 
2543
2767
  // src/controller/threads.controller.ts
2544
- var import_nestjs_agent_core16 = require("@dudousxd/nestjs-agent-core");
2545
- var import_common15 = require("@nestjs/common");
2546
- function _ts_decorate15(decorators, target, key, desc) {
2768
+ var import_nestjs_agent_core17 = require("@dudousxd/nestjs-agent-core");
2769
+ var import_common16 = require("@nestjs/common");
2770
+ function _ts_decorate16(decorators, target, key, desc) {
2547
2771
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2548
2772
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
2549
2773
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2556,19 +2780,19 @@ function _ts_decorate15(decorators, target, key, desc) {
2556
2780
  }
2557
2781
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2558
2782
  }
2559
- __name(_ts_decorate15, "_ts_decorate");
2560
- function _ts_metadata14(metadataKey, metadataValue) {
2783
+ __name(_ts_decorate16, "_ts_decorate");
2784
+ function _ts_metadata15(metadataKey, metadataValue) {
2561
2785
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
2562
2786
  return Reflect.metadata(metadataKey, metadataValue);
2563
2787
  }
2564
2788
  }
2565
- __name(_ts_metadata14, "_ts_metadata");
2566
- function _ts_param13(paramIndex, decorator) {
2789
+ __name(_ts_metadata15, "_ts_metadata");
2790
+ function _ts_param14(paramIndex, decorator) {
2567
2791
  return function(target, key) {
2568
2792
  decorator(target, key, paramIndex);
2569
2793
  };
2570
2794
  }
2571
- __name(_ts_param13, "_ts_param");
2795
+ __name(_ts_param14, "_ts_param");
2572
2796
  var ThreadsController = class {
2573
2797
  static {
2574
2798
  __name(this, "ThreadsController");
@@ -2611,6 +2835,9 @@ var ThreadsController = class {
2611
2835
  } : {},
2612
2836
  ..."defaultAgent" in body ? {
2613
2837
  defaultAgent: body.defaultAgent ?? null
2838
+ } : {},
2839
+ ..."model" in body ? {
2840
+ model: body.model ?? null
2614
2841
  } : {}
2615
2842
  });
2616
2843
  return {
@@ -2632,101 +2859,101 @@ var ThreadsController = class {
2632
2859
  };
2633
2860
  }
2634
2861
  };
2635
- _ts_decorate15([
2636
- (0, import_common15.Get)(),
2637
- _ts_param13(0, (0, import_common15.Req)()),
2638
- _ts_metadata14("design:type", Function),
2639
- _ts_metadata14("design:paramtypes", [
2862
+ _ts_decorate16([
2863
+ (0, import_common16.Get)(),
2864
+ _ts_param14(0, (0, import_common16.Req)()),
2865
+ _ts_metadata15("design:type", Function),
2866
+ _ts_metadata15("design:paramtypes", [
2640
2867
  typeof Request === "undefined" ? Object : Request
2641
2868
  ]),
2642
- _ts_metadata14("design:returntype", Promise)
2869
+ _ts_metadata15("design:returntype", Promise)
2643
2870
  ], ThreadsController.prototype, "list", null);
2644
- _ts_decorate15([
2645
- (0, import_common15.Get)(":id"),
2646
- _ts_param13(0, (0, import_common15.Req)()),
2647
- _ts_param13(1, (0, import_common15.Param)("id")),
2648
- _ts_metadata14("design:type", Function),
2649
- _ts_metadata14("design:paramtypes", [
2871
+ _ts_decorate16([
2872
+ (0, import_common16.Get)(":id"),
2873
+ _ts_param14(0, (0, import_common16.Req)()),
2874
+ _ts_param14(1, (0, import_common16.Param)("id")),
2875
+ _ts_metadata15("design:type", Function),
2876
+ _ts_metadata15("design:paramtypes", [
2650
2877
  typeof Request === "undefined" ? Object : Request,
2651
2878
  String
2652
2879
  ]),
2653
- _ts_metadata14("design:returntype", Promise)
2880
+ _ts_metadata15("design:returntype", Promise)
2654
2881
  ], ThreadsController.prototype, "detail", null);
2655
- _ts_decorate15([
2656
- (0, import_common15.Delete)(":id"),
2657
- _ts_param13(0, (0, import_common15.Req)()),
2658
- _ts_param13(1, (0, import_common15.Param)("id")),
2659
- _ts_metadata14("design:type", Function),
2660
- _ts_metadata14("design:paramtypes", [
2882
+ _ts_decorate16([
2883
+ (0, import_common16.Delete)(":id"),
2884
+ _ts_param14(0, (0, import_common16.Req)()),
2885
+ _ts_param14(1, (0, import_common16.Param)("id")),
2886
+ _ts_metadata15("design:type", Function),
2887
+ _ts_metadata15("design:paramtypes", [
2661
2888
  typeof Request === "undefined" ? Object : Request,
2662
2889
  String
2663
2890
  ]),
2664
- _ts_metadata14("design:returntype", Promise)
2891
+ _ts_metadata15("design:returntype", Promise)
2665
2892
  ], ThreadsController.prototype, "remove", null);
2666
- _ts_decorate15([
2667
- (0, import_common15.Post)(":id/fork-from/:messageId"),
2668
- _ts_param13(0, (0, import_common15.Req)()),
2669
- _ts_param13(1, (0, import_common15.Param)("id")),
2670
- _ts_param13(2, (0, import_common15.Param)("messageId")),
2671
- _ts_metadata14("design:type", Function),
2672
- _ts_metadata14("design:paramtypes", [
2893
+ _ts_decorate16([
2894
+ (0, import_common16.Post)(":id/fork-from/:messageId"),
2895
+ _ts_param14(0, (0, import_common16.Req)()),
2896
+ _ts_param14(1, (0, import_common16.Param)("id")),
2897
+ _ts_param14(2, (0, import_common16.Param)("messageId")),
2898
+ _ts_metadata15("design:type", Function),
2899
+ _ts_metadata15("design:paramtypes", [
2673
2900
  typeof Request === "undefined" ? Object : Request,
2674
2901
  String,
2675
2902
  String
2676
2903
  ]),
2677
- _ts_metadata14("design:returntype", Promise)
2904
+ _ts_metadata15("design:returntype", Promise)
2678
2905
  ], ThreadsController.prototype, "fork", null);
2679
- _ts_decorate15([
2680
- (0, import_common15.Patch)(":id"),
2681
- _ts_param13(0, (0, import_common15.Req)()),
2682
- _ts_param13(1, (0, import_common15.Param)("id")),
2683
- _ts_param13(2, (0, import_common15.Body)()),
2684
- _ts_metadata14("design:type", Function),
2685
- _ts_metadata14("design:paramtypes", [
2906
+ _ts_decorate16([
2907
+ (0, import_common16.Patch)(":id"),
2908
+ _ts_param14(0, (0, import_common16.Req)()),
2909
+ _ts_param14(1, (0, import_common16.Param)("id")),
2910
+ _ts_param14(2, (0, import_common16.Body)()),
2911
+ _ts_metadata15("design:type", Function),
2912
+ _ts_metadata15("design:paramtypes", [
2686
2913
  typeof Request === "undefined" ? Object : Request,
2687
2914
  String,
2688
2915
  typeof UpdateThreadBody === "undefined" ? Object : UpdateThreadBody
2689
2916
  ]),
2690
- _ts_metadata14("design:returntype", Promise)
2917
+ _ts_metadata15("design:returntype", Promise)
2691
2918
  ], ThreadsController.prototype, "update", null);
2692
- _ts_decorate15([
2693
- (0, import_common15.Post)(":id/promote"),
2694
- _ts_param13(0, (0, import_common15.Req)()),
2695
- _ts_param13(1, (0, import_common15.Param)("id")),
2696
- _ts_metadata14("design:type", Function),
2697
- _ts_metadata14("design:paramtypes", [
2919
+ _ts_decorate16([
2920
+ (0, import_common16.Post)(":id/promote"),
2921
+ _ts_param14(0, (0, import_common16.Req)()),
2922
+ _ts_param14(1, (0, import_common16.Param)("id")),
2923
+ _ts_metadata15("design:type", Function),
2924
+ _ts_metadata15("design:paramtypes", [
2698
2925
  typeof Request === "undefined" ? Object : Request,
2699
2926
  String
2700
2927
  ]),
2701
- _ts_metadata14("design:returntype", Promise)
2928
+ _ts_metadata15("design:returntype", Promise)
2702
2929
  ], ThreadsController.prototype, "promote", null);
2703
- _ts_decorate15([
2704
- (0, import_common15.Delete)(":id/from/:messageId"),
2705
- _ts_param13(0, (0, import_common15.Req)()),
2706
- _ts_param13(1, (0, import_common15.Param)("id")),
2707
- _ts_param13(2, (0, import_common15.Param)("messageId")),
2708
- _ts_metadata14("design:type", Function),
2709
- _ts_metadata14("design:paramtypes", [
2930
+ _ts_decorate16([
2931
+ (0, import_common16.Delete)(":id/from/:messageId"),
2932
+ _ts_param14(0, (0, import_common16.Req)()),
2933
+ _ts_param14(1, (0, import_common16.Param)("id")),
2934
+ _ts_param14(2, (0, import_common16.Param)("messageId")),
2935
+ _ts_metadata15("design:type", Function),
2936
+ _ts_metadata15("design:paramtypes", [
2710
2937
  typeof Request === "undefined" ? Object : Request,
2711
2938
  String,
2712
2939
  String
2713
2940
  ]),
2714
- _ts_metadata14("design:returntype", Promise)
2941
+ _ts_metadata15("design:returntype", Promise)
2715
2942
  ], ThreadsController.prototype, "truncateFrom", null);
2716
- ThreadsController = _ts_decorate15([
2717
- (0, import_common15.Controller)("threads"),
2718
- _ts_param13(1, (0, import_common15.Inject)(import_nestjs_agent_core16.AGENT_ACTOR_RESOLVER)),
2719
- _ts_metadata14("design:type", Function),
2720
- _ts_metadata14("design:paramtypes", [
2943
+ ThreadsController = _ts_decorate16([
2944
+ (0, import_common16.Controller)("threads"),
2945
+ _ts_param14(1, (0, import_common16.Inject)(import_nestjs_agent_core17.AGENT_ACTOR_RESOLVER)),
2946
+ _ts_metadata15("design:type", Function),
2947
+ _ts_metadata15("design:paramtypes", [
2721
2948
  typeof AgentService === "undefined" ? Object : AgentService,
2722
2949
  typeof ActorResolver === "undefined" ? Object : ActorResolver
2723
2950
  ])
2724
2951
  ], ThreadsController);
2725
2952
 
2726
2953
  // src/controller/tool-call.controller.ts
2727
- var import_nestjs_agent_core17 = require("@dudousxd/nestjs-agent-core");
2728
- var import_common16 = require("@nestjs/common");
2729
- function _ts_decorate16(decorators, target, key, desc) {
2954
+ var import_nestjs_agent_core18 = require("@dudousxd/nestjs-agent-core");
2955
+ var import_common17 = require("@nestjs/common");
2956
+ function _ts_decorate17(decorators, target, key, desc) {
2730
2957
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2731
2958
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
2732
2959
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2739,19 +2966,19 @@ function _ts_decorate16(decorators, target, key, desc) {
2739
2966
  }
2740
2967
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2741
2968
  }
2742
- __name(_ts_decorate16, "_ts_decorate");
2743
- function _ts_metadata15(metadataKey, metadataValue) {
2969
+ __name(_ts_decorate17, "_ts_decorate");
2970
+ function _ts_metadata16(metadataKey, metadataValue) {
2744
2971
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
2745
2972
  return Reflect.metadata(metadataKey, metadataValue);
2746
2973
  }
2747
2974
  }
2748
- __name(_ts_metadata15, "_ts_metadata");
2749
- function _ts_param14(paramIndex, decorator) {
2975
+ __name(_ts_metadata16, "_ts_metadata");
2976
+ function _ts_param15(paramIndex, decorator) {
2750
2977
  return function(target, key) {
2751
2978
  decorator(target, key, paramIndex);
2752
2979
  };
2753
2980
  }
2754
- __name(_ts_param14, "_ts_param");
2981
+ __name(_ts_param15, "_ts_param");
2755
2982
  var MAX_ANSWERED_QUESTIONS = 100;
2756
2983
  var MAX_VALUES_PER_QUESTION = 100;
2757
2984
  var MAX_ANSWER_VALUE_LENGTH = 4096;
@@ -2760,7 +2987,7 @@ var MAX_VIA_LENGTH = 64;
2760
2987
  var DEFAULT_VIA = "web";
2761
2988
  function toolCallId(claimed) {
2762
2989
  if (typeof claimed !== "string" || claimed.length === 0) {
2763
- throw new import_common16.BadRequestException("toolCallId must be a non-empty string");
2990
+ throw new import_common17.BadRequestException("toolCallId must be a non-empty string");
2764
2991
  }
2765
2992
  return claimed;
2766
2993
  }
@@ -2770,10 +2997,10 @@ function rejectReason(claimed) {
2770
2997
  return void 0;
2771
2998
  }
2772
2999
  if (typeof claimed !== "string") {
2773
- throw new import_common16.BadRequestException("reason must be a string");
3000
+ throw new import_common17.BadRequestException("reason must be a string");
2774
3001
  }
2775
3002
  if (claimed.length > MAX_REJECT_REASON_LENGTH) {
2776
- throw new import_common16.BadRequestException(`reason must be at most ${MAX_REJECT_REASON_LENGTH} characters`);
3003
+ throw new import_common17.BadRequestException(`reason must be at most ${MAX_REJECT_REASON_LENGTH} characters`);
2777
3004
  }
2778
3005
  return claimed;
2779
3006
  }
@@ -2783,7 +3010,7 @@ function remember(claimed) {
2783
3010
  return false;
2784
3011
  }
2785
3012
  if (typeof claimed !== "boolean") {
2786
- throw new import_common16.BadRequestException("remember must be a boolean");
3013
+ throw new import_common17.BadRequestException("remember must be a boolean");
2787
3014
  }
2788
3015
  return claimed;
2789
3016
  }
@@ -2793,7 +3020,7 @@ function via(claimed) {
2793
3020
  return DEFAULT_VIA;
2794
3021
  }
2795
3022
  if (typeof claimed !== "string" || claimed.length === 0 || claimed.length > MAX_VIA_LENGTH) {
2796
- throw new import_common16.BadRequestException(`via must be a string of 1-${MAX_VIA_LENGTH} characters`);
3023
+ throw new import_common17.BadRequestException(`via must be a string of 1-${MAX_VIA_LENGTH} characters`);
2797
3024
  }
2798
3025
  return claimed;
2799
3026
  }
@@ -2803,26 +3030,26 @@ function answers(claimed) {
2803
3030
  return void 0;
2804
3031
  }
2805
3032
  if (typeof claimed !== "object" || claimed === null || Array.isArray(claimed)) {
2806
- throw new import_common16.BadRequestException("answers must be an object of questionId \u2192 chosen values");
3033
+ throw new import_common17.BadRequestException("answers must be an object of questionId \u2192 chosen values");
2807
3034
  }
2808
3035
  const entries = Object.entries(claimed);
2809
3036
  if (entries.length > MAX_ANSWERED_QUESTIONS) {
2810
- throw new import_common16.BadRequestException(`answers may cover at most ${MAX_ANSWERED_QUESTIONS} questions`);
3037
+ throw new import_common17.BadRequestException(`answers may cover at most ${MAX_ANSWERED_QUESTIONS} questions`);
2811
3038
  }
2812
3039
  const validated = /* @__PURE__ */ Object.create(null);
2813
3040
  for (const [questionId, values] of entries) {
2814
3041
  if (!Array.isArray(values)) {
2815
- throw new import_common16.BadRequestException(`answers["${questionId}"] must be an array of chosen values`);
3042
+ throw new import_common17.BadRequestException(`answers["${questionId}"] must be an array of chosen values`);
2816
3043
  }
2817
3044
  if (values.length > MAX_VALUES_PER_QUESTION) {
2818
- throw new import_common16.BadRequestException(`answers["${questionId}"] may carry at most ${MAX_VALUES_PER_QUESTION} values`);
3045
+ throw new import_common17.BadRequestException(`answers["${questionId}"] may carry at most ${MAX_VALUES_PER_QUESTION} values`);
2819
3046
  }
2820
3047
  for (const value of values) {
2821
3048
  if (typeof value !== "string") {
2822
- throw new import_common16.BadRequestException(`answers["${questionId}"] must contain only strings`);
3049
+ throw new import_common17.BadRequestException(`answers["${questionId}"] must contain only strings`);
2823
3050
  }
2824
3051
  if (value.length > MAX_ANSWER_VALUE_LENGTH) {
2825
- throw new import_common16.BadRequestException(`answers["${questionId}"] values must be at most ${MAX_ANSWER_VALUE_LENGTH} characters`);
3052
+ throw new import_common17.BadRequestException(`answers["${questionId}"] values must be at most ${MAX_ANSWER_VALUE_LENGTH} characters`);
2826
3053
  }
2827
3054
  }
2828
3055
  validated[questionId] = values;
@@ -2880,64 +3107,64 @@ var ToolCallController = class {
2880
3107
  };
2881
3108
  }
2882
3109
  };
2883
- _ts_decorate16([
2884
- (0, import_common16.Post)("approve"),
2885
- _ts_param14(0, (0, import_common16.Req)()),
2886
- _ts_param14(1, (0, import_common16.Body)()),
2887
- _ts_metadata15("design:type", Function),
2888
- _ts_metadata15("design:paramtypes", [
3110
+ _ts_decorate17([
3111
+ (0, import_common17.Post)("approve"),
3112
+ _ts_param15(0, (0, import_common17.Req)()),
3113
+ _ts_param15(1, (0, import_common17.Body)()),
3114
+ _ts_metadata16("design:type", Function),
3115
+ _ts_metadata16("design:paramtypes", [
2889
3116
  typeof Request === "undefined" ? Object : Request,
2890
3117
  typeof ApproveBody === "undefined" ? Object : ApproveBody
2891
3118
  ]),
2892
- _ts_metadata15("design:returntype", Promise)
3119
+ _ts_metadata16("design:returntype", Promise)
2893
3120
  ], ToolCallController.prototype, "approve", null);
2894
- _ts_decorate16([
2895
- (0, import_common16.Post)("reject"),
2896
- _ts_param14(0, (0, import_common16.Req)()),
2897
- _ts_param14(1, (0, import_common16.Body)()),
2898
- _ts_metadata15("design:type", Function),
2899
- _ts_metadata15("design:paramtypes", [
3121
+ _ts_decorate17([
3122
+ (0, import_common17.Post)("reject"),
3123
+ _ts_param15(0, (0, import_common17.Req)()),
3124
+ _ts_param15(1, (0, import_common17.Body)()),
3125
+ _ts_metadata16("design:type", Function),
3126
+ _ts_metadata16("design:paramtypes", [
2900
3127
  typeof Request === "undefined" ? Object : Request,
2901
3128
  typeof RejectBody === "undefined" ? Object : RejectBody
2902
3129
  ]),
2903
- _ts_metadata15("design:returntype", Promise)
3130
+ _ts_metadata16("design:returntype", Promise)
2904
3131
  ], ToolCallController.prototype, "reject", null);
2905
- _ts_decorate16([
2906
- (0, import_common16.Post)("answer"),
2907
- _ts_param14(0, (0, import_common16.Req)()),
2908
- _ts_param14(1, (0, import_common16.Body)()),
2909
- _ts_metadata15("design:type", Function),
2910
- _ts_metadata15("design:paramtypes", [
3132
+ _ts_decorate17([
3133
+ (0, import_common17.Post)("answer"),
3134
+ _ts_param15(0, (0, import_common17.Req)()),
3135
+ _ts_param15(1, (0, import_common17.Body)()),
3136
+ _ts_metadata16("design:type", Function),
3137
+ _ts_metadata16("design:paramtypes", [
2911
3138
  typeof Request === "undefined" ? Object : Request,
2912
3139
  typeof AnswerBody === "undefined" ? Object : AnswerBody
2913
3140
  ]),
2914
- _ts_metadata15("design:returntype", Promise)
3141
+ _ts_metadata16("design:returntype", Promise)
2915
3142
  ], ToolCallController.prototype, "answer", null);
2916
- _ts_decorate16([
2917
- (0, import_common16.Post)("skip"),
2918
- _ts_param14(0, (0, import_common16.Req)()),
2919
- _ts_param14(1, (0, import_common16.Body)()),
2920
- _ts_metadata15("design:type", Function),
2921
- _ts_metadata15("design:paramtypes", [
3143
+ _ts_decorate17([
3144
+ (0, import_common17.Post)("skip"),
3145
+ _ts_param15(0, (0, import_common17.Req)()),
3146
+ _ts_param15(1, (0, import_common17.Body)()),
3147
+ _ts_metadata16("design:type", Function),
3148
+ _ts_metadata16("design:paramtypes", [
2922
3149
  typeof Request === "undefined" ? Object : Request,
2923
3150
  Object
2924
3151
  ]),
2925
- _ts_metadata15("design:returntype", Promise)
3152
+ _ts_metadata16("design:returntype", Promise)
2926
3153
  ], ToolCallController.prototype, "skip", null);
2927
- ToolCallController = _ts_decorate16([
2928
- (0, import_common16.Controller)("tool-call"),
2929
- _ts_param14(1, (0, import_common16.Inject)(import_nestjs_agent_core17.AGENT_ACTOR_RESOLVER)),
2930
- _ts_metadata15("design:type", Function),
2931
- _ts_metadata15("design:paramtypes", [
3154
+ ToolCallController = _ts_decorate17([
3155
+ (0, import_common17.Controller)("tool-call"),
3156
+ _ts_param15(1, (0, import_common17.Inject)(import_nestjs_agent_core18.AGENT_ACTOR_RESOLVER)),
3157
+ _ts_metadata16("design:type", Function),
3158
+ _ts_metadata16("design:paramtypes", [
2932
3159
  typeof AgentService === "undefined" ? Object : AgentService,
2933
3160
  typeof ActorResolver === "undefined" ? Object : ActorResolver
2934
3161
  ])
2935
3162
  ], ToolCallController);
2936
3163
 
2937
3164
  // src/controller/tools.controller.ts
2938
- var import_nestjs_agent_core18 = require("@dudousxd/nestjs-agent-core");
2939
- var import_common17 = require("@nestjs/common");
2940
- function _ts_decorate17(decorators, target, key, desc) {
3165
+ var import_nestjs_agent_core19 = require("@dudousxd/nestjs-agent-core");
3166
+ var import_common18 = require("@nestjs/common");
3167
+ function _ts_decorate18(decorators, target, key, desc) {
2941
3168
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2942
3169
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
2943
3170
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2950,19 +3177,19 @@ function _ts_decorate17(decorators, target, key, desc) {
2950
3177
  }
2951
3178
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2952
3179
  }
2953
- __name(_ts_decorate17, "_ts_decorate");
2954
- function _ts_metadata16(metadataKey, metadataValue) {
3180
+ __name(_ts_decorate18, "_ts_decorate");
3181
+ function _ts_metadata17(metadataKey, metadataValue) {
2955
3182
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
2956
3183
  return Reflect.metadata(metadataKey, metadataValue);
2957
3184
  }
2958
3185
  }
2959
- __name(_ts_metadata16, "_ts_metadata");
2960
- function _ts_param15(paramIndex, decorator) {
3186
+ __name(_ts_metadata17, "_ts_metadata");
3187
+ function _ts_param16(paramIndex, decorator) {
2961
3188
  return function(target, key) {
2962
3189
  decorator(target, key, paramIndex);
2963
3190
  };
2964
3191
  }
2965
- __name(_ts_param15, "_ts_param");
3192
+ __name(_ts_param16, "_ts_param");
2966
3193
  var ToolsController = class {
2967
3194
  static {
2968
3195
  __name(this, "ToolsController");
@@ -2977,7 +3204,7 @@ var ToolsController = class {
2977
3204
  }
2978
3205
  async list(req, agent) {
2979
3206
  if (agent !== void 0 && this.agents.get(agent) === void 0) {
2980
- throw new import_common17.NotFoundException(`No agent named "${agent}"`);
3207
+ throw new import_common18.NotFoundException(`No agent named "${agent}"`);
2981
3208
  }
2982
3209
  const actor = await this.actorResolver.resolve(req);
2983
3210
  const deps = this.depsFactory.forAgent(agent);
@@ -2991,33 +3218,33 @@ var ToolsController = class {
2991
3218
  }));
2992
3219
  }
2993
3220
  };
2994
- _ts_decorate17([
2995
- (0, import_common17.Get)(),
2996
- _ts_param15(0, (0, import_common17.Req)()),
2997
- _ts_param15(1, (0, import_common17.Query)("agent")),
2998
- _ts_metadata16("design:type", Function),
2999
- _ts_metadata16("design:paramtypes", [
3221
+ _ts_decorate18([
3222
+ (0, import_common18.Get)(),
3223
+ _ts_param16(0, (0, import_common18.Req)()),
3224
+ _ts_param16(1, (0, import_common18.Query)("agent")),
3225
+ _ts_metadata17("design:type", Function),
3226
+ _ts_metadata17("design:paramtypes", [
3000
3227
  typeof Request === "undefined" ? Object : Request,
3001
3228
  String
3002
3229
  ]),
3003
- _ts_metadata16("design:returntype", Promise)
3230
+ _ts_metadata17("design:returntype", Promise)
3004
3231
  ], ToolsController.prototype, "list", null);
3005
- ToolsController = _ts_decorate17([
3006
- (0, import_common17.Controller)("tools"),
3007
- _ts_param15(0, (0, import_common17.Inject)(import_nestjs_agent_core18.AGENT_ACTOR_RESOLVER)),
3008
- _ts_param15(1, (0, import_common17.Inject)(import_nestjs_agent_core18.AGENT_DEPS_FACTORY)),
3009
- _ts_param15(2, (0, import_common17.Inject)(import_nestjs_agent_core18.AGENT_REGISTRY)),
3010
- _ts_metadata16("design:type", Function),
3011
- _ts_metadata16("design:paramtypes", [
3232
+ ToolsController = _ts_decorate18([
3233
+ (0, import_common18.Controller)("tools"),
3234
+ _ts_param16(0, (0, import_common18.Inject)(import_nestjs_agent_core19.AGENT_ACTOR_RESOLVER)),
3235
+ _ts_param16(1, (0, import_common18.Inject)(import_nestjs_agent_core19.AGENT_DEPS_FACTORY)),
3236
+ _ts_param16(2, (0, import_common18.Inject)(import_nestjs_agent_core19.AGENT_REGISTRY)),
3237
+ _ts_metadata17("design:type", Function),
3238
+ _ts_metadata17("design:paramtypes", [
3012
3239
  typeof ActorResolver === "undefined" ? Object : ActorResolver,
3013
3240
  typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
3014
- typeof import_nestjs_agent_core18.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core18.AgentRegistry
3241
+ typeof import_nestjs_agent_core19.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core19.AgentRegistry
3015
3242
  ])
3016
3243
  ], ToolsController);
3017
3244
 
3018
3245
  // src/discovery/agent-discovery.service.ts
3019
- var import_nestjs_agent_core19 = require("@dudousxd/nestjs-agent-core");
3020
- var import_common18 = require("@nestjs/common");
3246
+ var import_nestjs_agent_core20 = require("@dudousxd/nestjs-agent-core");
3247
+ var import_common19 = require("@nestjs/common");
3021
3248
  var import_core = require("@nestjs/core");
3022
3249
 
3023
3250
  // src/decorator/agent.decorator.ts
@@ -3034,7 +3261,7 @@ var SYSTEM_PROMPT_METADATA = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:
3034
3261
  var SYSTEM_PROMPT_CONTRIBUTOR_METADATA = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:system-prompt-contributor");
3035
3262
 
3036
3263
  // src/discovery/agent-discovery.service.ts
3037
- function _ts_decorate18(decorators, target, key, desc) {
3264
+ function _ts_decorate19(decorators, target, key, desc) {
3038
3265
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3039
3266
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
3040
3267
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3047,19 +3274,19 @@ function _ts_decorate18(decorators, target, key, desc) {
3047
3274
  }
3048
3275
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3049
3276
  }
3050
- __name(_ts_decorate18, "_ts_decorate");
3051
- function _ts_metadata17(metadataKey, metadataValue) {
3277
+ __name(_ts_decorate19, "_ts_decorate");
3278
+ function _ts_metadata18(metadataKey, metadataValue) {
3052
3279
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
3053
3280
  return Reflect.metadata(metadataKey, metadataValue);
3054
3281
  }
3055
3282
  }
3056
- __name(_ts_metadata17, "_ts_metadata");
3057
- function _ts_param16(paramIndex, decorator) {
3283
+ __name(_ts_metadata18, "_ts_metadata");
3284
+ function _ts_param17(paramIndex, decorator) {
3058
3285
  return function(target, key) {
3059
3286
  decorator(target, key, paramIndex);
3060
3287
  };
3061
3288
  }
3062
- __name(_ts_param16, "_ts_param");
3289
+ __name(_ts_param17, "_ts_param");
3063
3290
  var AgentDiscoveryService = class _AgentDiscoveryService {
3064
3291
  static {
3065
3292
  __name(this, "AgentDiscoveryService");
@@ -3068,7 +3295,7 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
3068
3295
  scanner;
3069
3296
  registry;
3070
3297
  contributors;
3071
- logger = new import_common18.Logger(_AgentDiscoveryService.name);
3298
+ logger = new import_common19.Logger(_AgentDiscoveryService.name);
3072
3299
  constructor(discovery, scanner, registry, contributors) {
3073
3300
  this.discovery = discovery;
3074
3301
  this.scanner = scanner;
@@ -3186,22 +3413,22 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
3186
3413
  return (ctx) => candidate.call(instance, ctx);
3187
3414
  }
3188
3415
  };
3189
- AgentDiscoveryService = _ts_decorate18([
3190
- (0, import_common18.Injectable)(),
3191
- _ts_param16(2, (0, import_common18.Inject)(import_nestjs_agent_core19.AGENT_REGISTRY)),
3192
- _ts_param16(3, (0, import_common18.Inject)(import_nestjs_agent_core19.AGENT_PROMPT_CONTRIBUTORS)),
3193
- _ts_metadata17("design:type", Function),
3194
- _ts_metadata17("design:paramtypes", [
3416
+ AgentDiscoveryService = _ts_decorate19([
3417
+ (0, import_common19.Injectable)(),
3418
+ _ts_param17(2, (0, import_common19.Inject)(import_nestjs_agent_core20.AGENT_REGISTRY)),
3419
+ _ts_param17(3, (0, import_common19.Inject)(import_nestjs_agent_core20.AGENT_PROMPT_CONTRIBUTORS)),
3420
+ _ts_metadata18("design:type", Function),
3421
+ _ts_metadata18("design:paramtypes", [
3195
3422
  typeof import_core.DiscoveryService === "undefined" ? Object : import_core.DiscoveryService,
3196
3423
  typeof import_core.MetadataScanner === "undefined" ? Object : import_core.MetadataScanner,
3197
- typeof import_nestjs_agent_core19.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core19.AgentRegistry,
3424
+ typeof import_nestjs_agent_core20.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core20.AgentRegistry,
3198
3425
  Array
3199
3426
  ])
3200
3427
  ], AgentDiscoveryService);
3201
3428
 
3202
3429
  // src/discovery/ai-tool-discovery.service.ts
3203
- var import_nestjs_agent_core20 = require("@dudousxd/nestjs-agent-core");
3204
- var import_common19 = require("@nestjs/common");
3430
+ var import_nestjs_agent_core21 = require("@dudousxd/nestjs-agent-core");
3431
+ var import_common20 = require("@nestjs/common");
3205
3432
  var import_core2 = require("@nestjs/core");
3206
3433
  var import_zod = require("zod");
3207
3434
 
@@ -3221,7 +3448,7 @@ function isBrandedFunctionalTool(value) {
3221
3448
  __name(isBrandedFunctionalTool, "isBrandedFunctionalTool");
3222
3449
 
3223
3450
  // src/discovery/ai-tool-discovery.service.ts
3224
- function _ts_decorate19(decorators, target, key, desc) {
3451
+ function _ts_decorate20(decorators, target, key, desc) {
3225
3452
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3226
3453
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
3227
3454
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3234,19 +3461,19 @@ function _ts_decorate19(decorators, target, key, desc) {
3234
3461
  }
3235
3462
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3236
3463
  }
3237
- __name(_ts_decorate19, "_ts_decorate");
3238
- function _ts_metadata18(metadataKey, metadataValue) {
3464
+ __name(_ts_decorate20, "_ts_decorate");
3465
+ function _ts_metadata19(metadataKey, metadataValue) {
3239
3466
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
3240
3467
  return Reflect.metadata(metadataKey, metadataValue);
3241
3468
  }
3242
3469
  }
3243
- __name(_ts_metadata18, "_ts_metadata");
3244
- function _ts_param17(paramIndex, decorator) {
3470
+ __name(_ts_metadata19, "_ts_metadata");
3471
+ function _ts_param18(paramIndex, decorator) {
3245
3472
  return function(target, key) {
3246
3473
  decorator(target, key, paramIndex);
3247
3474
  };
3248
3475
  }
3249
- __name(_ts_param17, "_ts_param");
3476
+ __name(_ts_param18, "_ts_param");
3250
3477
  var AiToolDiscoveryService = class _AiToolDiscoveryService {
3251
3478
  static {
3252
3479
  __name(this, "AiToolDiscoveryService");
@@ -3255,7 +3482,7 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
3255
3482
  registry;
3256
3483
  agents;
3257
3484
  options;
3258
- logger = new import_common19.Logger(_AiToolDiscoveryService.name);
3485
+ logger = new import_common20.Logger(_AiToolDiscoveryService.name);
3259
3486
  constructor(discovery, registry, agents, options) {
3260
3487
  this.discovery = discovery;
3261
3488
  this.registry = registry;
@@ -3329,7 +3556,7 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
3329
3556
  let delegates = 0;
3330
3557
  for (const definition of this.agents.list()) {
3331
3558
  for (const edge of definition.delegatesTo ?? []) {
3332
- const { agent: target, detached } = (0, import_nestjs_agent_core20.normalizeDelegation)(edge);
3559
+ const { agent: target, detached } = (0, import_nestjs_agent_core21.normalizeDelegation)(edge);
3333
3560
  const targetDefinition = this.agents.get(target);
3334
3561
  if (targetDefinition === void 0) {
3335
3562
  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.`);
@@ -3379,13 +3606,13 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
3379
3606
  return true;
3380
3607
  }
3381
3608
  };
3382
- AiToolDiscoveryService = _ts_decorate19([
3383
- (0, import_common19.Injectable)(),
3384
- _ts_param17(1, (0, import_common19.Inject)(import_nestjs_agent_core20.AGENT_TOOL_REGISTRY)),
3385
- _ts_param17(2, (0, import_common19.Inject)(import_nestjs_agent_core20.AGENT_REGISTRY)),
3386
- _ts_param17(3, (0, import_common19.Inject)(import_nestjs_agent_core20.AGENT_OPTIONS)),
3387
- _ts_metadata18("design:type", Function),
3388
- _ts_metadata18("design:paramtypes", [
3609
+ AiToolDiscoveryService = _ts_decorate20([
3610
+ (0, import_common20.Injectable)(),
3611
+ _ts_param18(1, (0, import_common20.Inject)(import_nestjs_agent_core21.AGENT_TOOL_REGISTRY)),
3612
+ _ts_param18(2, (0, import_common20.Inject)(import_nestjs_agent_core21.AGENT_REGISTRY)),
3613
+ _ts_param18(3, (0, import_common20.Inject)(import_nestjs_agent_core21.AGENT_OPTIONS)),
3614
+ _ts_metadata19("design:type", Function),
3615
+ _ts_metadata19("design:paramtypes", [
3389
3616
  typeof import_core2.DiscoveryService === "undefined" ? Object : import_core2.DiscoveryService,
3390
3617
  typeof ToolRegistry === "undefined" ? Object : ToolRegistry,
3391
3618
  typeof AgentRegistry === "undefined" ? Object : AgentRegistry,
@@ -3394,25 +3621,25 @@ AiToolDiscoveryService = _ts_decorate19([
3394
3621
  ], AiToolDiscoveryService);
3395
3622
 
3396
3623
  // src/discovery/skill-discovery.service.ts
3397
- var import_nestjs_agent_core22 = require("@dudousxd/nestjs-agent-core");
3398
- var import_common20 = require("@nestjs/common");
3624
+ var import_nestjs_agent_core23 = require("@dudousxd/nestjs-agent-core");
3625
+ var import_common21 = require("@nestjs/common");
3399
3626
  var import_core3 = require("@nestjs/core");
3400
3627
 
3401
3628
  // src/decorator/skill.decorator.ts
3402
3629
  var import_reflect_metadata4 = require("reflect-metadata");
3403
- var import_nestjs_agent_core21 = require("@dudousxd/nestjs-agent-core");
3630
+ var import_nestjs_agent_core22 = require("@dudousxd/nestjs-agent-core");
3404
3631
  var SKILL_METADATA = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:skill-metadata");
3405
3632
  function readSkillMetadata(target) {
3406
3633
  return Reflect.getMetadata(SKILL_METADATA, target);
3407
3634
  }
3408
3635
  __name(readSkillMetadata, "readSkillMetadata");
3409
3636
  function skillScope(options) {
3410
- return options.scope ?? import_nestjs_agent_core21.GLOBAL_SCOPE;
3637
+ return options.scope ?? import_nestjs_agent_core22.GLOBAL_SCOPE;
3411
3638
  }
3412
3639
  __name(skillScope, "skillScope");
3413
3640
 
3414
3641
  // src/discovery/skill-discovery.service.ts
3415
- function _ts_decorate20(decorators, target, key, desc) {
3642
+ function _ts_decorate21(decorators, target, key, desc) {
3416
3643
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3417
3644
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
3418
3645
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3425,26 +3652,26 @@ function _ts_decorate20(decorators, target, key, desc) {
3425
3652
  }
3426
3653
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3427
3654
  }
3428
- __name(_ts_decorate20, "_ts_decorate");
3429
- function _ts_metadata19(metadataKey, metadataValue) {
3655
+ __name(_ts_decorate21, "_ts_decorate");
3656
+ function _ts_metadata20(metadataKey, metadataValue) {
3430
3657
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
3431
3658
  return Reflect.metadata(metadataKey, metadataValue);
3432
3659
  }
3433
3660
  }
3434
- __name(_ts_metadata19, "_ts_metadata");
3435
- function _ts_param18(paramIndex, decorator) {
3661
+ __name(_ts_metadata20, "_ts_metadata");
3662
+ function _ts_param19(paramIndex, decorator) {
3436
3663
  return function(target, key) {
3437
3664
  decorator(target, key, paramIndex);
3438
3665
  };
3439
3666
  }
3440
- __name(_ts_param18, "_ts_param");
3667
+ __name(_ts_param19, "_ts_param");
3441
3668
  var SkillDiscoveryService = class _SkillDiscoveryService {
3442
3669
  static {
3443
3670
  __name(this, "SkillDiscoveryService");
3444
3671
  }
3445
3672
  discovery;
3446
3673
  declared;
3447
- logger = new import_common20.Logger(_SkillDiscoveryService.name);
3674
+ logger = new import_common21.Logger(_SkillDiscoveryService.name);
3448
3675
  constructor(discovery, declared) {
3449
3676
  this.discovery = discovery;
3450
3677
  this.declared = declared;
@@ -3481,16 +3708,79 @@ var SkillDiscoveryService = class _SkillDiscoveryService {
3481
3708
  return flat === void 0 ? void 0 : () => flat;
3482
3709
  }
3483
3710
  };
3484
- SkillDiscoveryService = _ts_decorate20([
3485
- (0, import_common20.Injectable)(),
3486
- _ts_param18(1, (0, import_common20.Inject)(import_nestjs_agent_core22.AGENT_SKILL_SOURCES)),
3487
- _ts_metadata19("design:type", Function),
3488
- _ts_metadata19("design:paramtypes", [
3711
+ SkillDiscoveryService = _ts_decorate21([
3712
+ (0, import_common21.Injectable)(),
3713
+ _ts_param19(1, (0, import_common21.Inject)(import_nestjs_agent_core23.AGENT_SKILL_SOURCES)),
3714
+ _ts_metadata20("design:type", Function),
3715
+ _ts_metadata20("design:paramtypes", [
3489
3716
  typeof import_core3.DiscoveryService === "undefined" ? Object : import_core3.DiscoveryService,
3490
3717
  Array
3491
3718
  ])
3492
3719
  ], SkillDiscoveryService);
3493
3720
 
3721
+ // src/ledger-quota-provider.ts
3722
+ var import_nestjs_agent_core24 = require("@dudousxd/nestjs-agent-core");
3723
+ var LedgerQuotaProvider = class {
3724
+ static {
3725
+ __name(this, "LedgerQuotaProvider");
3726
+ }
3727
+ store;
3728
+ quota;
3729
+ limits;
3730
+ constructor(store, quota, limits = {}) {
3731
+ this.store = store;
3732
+ this.quota = quota;
3733
+ this.limits = limits;
3734
+ }
3735
+ async report(query) {
3736
+ const now = query.now ?? /* @__PURE__ */ new Date();
3737
+ const actorRef = query.actor.id;
3738
+ const windows = [
3739
+ await this.dayWindow(actorRef, now)
3740
+ ];
3741
+ if (this.store.usageBetween !== void 0) {
3742
+ const range = (0, import_nestjs_agent_core24.quotaPeriodRange)("month", now);
3743
+ const used = await this.store.usageBetween(actorRef, range.fromDay, range.toDay);
3744
+ windows.push(this.window("month", used.usedTokens, used.costUsd, range.resetsAt));
3745
+ }
3746
+ const blocked = (0, import_nestjs_agent_core24.exhaustedWindow)(windows);
3747
+ return {
3748
+ windows,
3749
+ ...blocked !== void 0 ? {
3750
+ blocked
3751
+ } : {}
3752
+ };
3753
+ }
3754
+ async dayWindow(actorRef, now) {
3755
+ const range = (0, import_nestjs_agent_core24.quotaPeriodRange)("day", now);
3756
+ const { usedTokens, costUsd } = await this.store.quotaToday(actorRef, range.fromDay);
3757
+ if (this.quota === void 0) {
3758
+ return this.window("day", usedTokens, costUsd, range.resetsAt);
3759
+ }
3760
+ const state = await this.quota.check(actorRef, range.fromDay);
3761
+ const window = this.window("day", state.usedTokens, costUsd, range.resetsAt);
3762
+ if (window.limitTokens === void 0) {
3763
+ window.limitTokens = state.limitTokens;
3764
+ }
3765
+ return window;
3766
+ }
3767
+ window(period, usedTokens, usedUsd, resetsAt) {
3768
+ const limits = this.limits[period] ?? {};
3769
+ return {
3770
+ period,
3771
+ usedTokens,
3772
+ ...limits.tokens !== void 0 ? {
3773
+ limitTokens: limits.tokens
3774
+ } : {},
3775
+ usedUsd,
3776
+ ...limits.usd !== void 0 ? {
3777
+ limitUsd: limits.usd
3778
+ } : {},
3779
+ resetsAt
3780
+ };
3781
+ }
3782
+ };
3783
+
3494
3784
  // src/ledger-quota-store.ts
3495
3785
  var LedgerQuotaStore = class {
3496
3786
  static {
@@ -3515,9 +3805,9 @@ var LedgerQuotaStore = class {
3515
3805
  };
3516
3806
 
3517
3807
  // src/runner/inline-agent-runner.ts
3518
- var import_nestjs_agent_core23 = require("@dudousxd/nestjs-agent-core");
3519
- var import_common21 = require("@nestjs/common");
3520
- function _ts_decorate21(decorators, target, key, desc) {
3808
+ var import_nestjs_agent_core25 = require("@dudousxd/nestjs-agent-core");
3809
+ var import_common22 = require("@nestjs/common");
3810
+ function _ts_decorate22(decorators, target, key, desc) {
3521
3811
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3522
3812
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
3523
3813
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3530,26 +3820,26 @@ function _ts_decorate21(decorators, target, key, desc) {
3530
3820
  }
3531
3821
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3532
3822
  }
3533
- __name(_ts_decorate21, "_ts_decorate");
3534
- function _ts_metadata20(metadataKey, metadataValue) {
3823
+ __name(_ts_decorate22, "_ts_decorate");
3824
+ function _ts_metadata21(metadataKey, metadataValue) {
3535
3825
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
3536
3826
  return Reflect.metadata(metadataKey, metadataValue);
3537
3827
  }
3538
3828
  }
3539
- __name(_ts_metadata20, "_ts_metadata");
3540
- function _ts_param19(paramIndex, decorator) {
3829
+ __name(_ts_metadata21, "_ts_metadata");
3830
+ function _ts_param20(paramIndex, decorator) {
3541
3831
  return function(target, key) {
3542
3832
  decorator(target, key, paramIndex);
3543
3833
  };
3544
3834
  }
3545
- __name(_ts_param19, "_ts_param");
3835
+ __name(_ts_param20, "_ts_param");
3546
3836
  var InlineAgentRunner = class _InlineAgentRunner {
3547
3837
  static {
3548
3838
  __name(this, "InlineAgentRunner");
3549
3839
  }
3550
3840
  factory;
3551
3841
  store;
3552
- logger = new import_common21.Logger(_InlineAgentRunner.name);
3842
+ logger = new import_common22.Logger(_InlineAgentRunner.name);
3553
3843
  pending = /* @__PURE__ */ new Map();
3554
3844
  /**
3555
3845
  * Runs someone has asked to stop. In-process, like `pending`, and for the same reason: this runner
@@ -3578,18 +3868,18 @@ var InlineAgentRunner = class _InlineAgentRunner {
3578
3868
  ] : []
3579
3869
  ]
3580
3870
  });
3581
- void (0, import_nestjs_agent_core23.runAgentLoop)({
3871
+ void (0, import_nestjs_agent_core25.runAgentLoop)({
3582
3872
  ...deps,
3583
3873
  day
3584
3874
  }, input, hooks).then(() => this.store.setActiveStream(input.threadId, null)).catch(async (error) => {
3585
- if (error instanceof import_nestjs_agent_core23.RunCancelledError) {
3875
+ if (error instanceof import_nestjs_agent_core25.RunCancelledError) {
3586
3876
  await this.settleCancelled(runId, input.threadId, deps);
3587
3877
  return;
3588
3878
  }
3589
3879
  const message = error instanceof Error ? error.message : String(error);
3590
- const code = (0, import_nestjs_agent_core23.agentFailureCode)(error);
3880
+ const code = (0, import_nestjs_agent_core25.agentFailureCode)(error);
3591
3881
  this.logger.error(`agent run ${runId} failed (${code}): ${message}`);
3592
- (0, import_nestjs_agent_core23.publishAgentRunFailed)({
3882
+ (0, import_nestjs_agent_core25.publishAgentRunFailed)({
3593
3883
  runId,
3594
3884
  code,
3595
3885
  message
@@ -3638,7 +3928,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
3638
3928
  for (const [key, waiter] of this.pending) {
3639
3929
  if (key.startsWith(`${runId}:`)) {
3640
3930
  this.pending.delete(key);
3641
- waiter.reject(new import_nestjs_agent_core23.RunCancelledError());
3931
+ waiter.reject(new import_nestjs_agent_core25.RunCancelledError());
3642
3932
  }
3643
3933
  }
3644
3934
  await Promise.resolve();
@@ -3653,7 +3943,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
3653
3943
  this.logger.log(`agent run ${runId} cancelled`);
3654
3944
  await this.store.setActiveStream(threadId, null);
3655
3945
  const writer = await deps.sink.open(runId);
3656
- await writer.write((0, import_nestjs_agent_core23.encodeStreamEvent)({
3946
+ await writer.write((0, import_nestjs_agent_core25.encodeStreamEvent)({
3657
3947
  kind: "cancelled"
3658
3948
  }));
3659
3949
  await writer.end();
@@ -3714,7 +4004,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
3714
4004
  awaitApproval: /* @__PURE__ */ __name((call, _ctx, opts) => this.parkApproval(runId, call.id, opts?.timeoutMs), "awaitApproval"),
3715
4005
  awaitAnswers: /* @__PURE__ */ __name((request) => this.park(runId, request.id), "awaitAnswers"),
3716
4006
  step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
3717
- parallel: import_nestjs_agent_core23.settleAll,
4007
+ parallel: import_nestjs_agent_core25.settleAll,
3718
4008
  cancelled: /* @__PURE__ */ __name(async () => this.cancelled.has(runId), "cancelled"),
3719
4009
  runAgent: /* @__PURE__ */ __name((agentName, task) => this.runNested({
3720
4010
  agentName,
@@ -3765,7 +4055,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
3765
4055
  awaitApproval: /* @__PURE__ */ __name((call, _ctx, opts) => this.parkApproval(runId, call.id, opts?.timeoutMs), "awaitApproval"),
3766
4056
  awaitAnswers: /* @__PURE__ */ __name((request) => this.park(runId, request.id), "awaitAnswers"),
3767
4057
  step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
3768
- parallel: import_nestjs_agent_core23.settleAll,
4058
+ parallel: import_nestjs_agent_core25.settleAll,
3769
4059
  cancelled: /* @__PURE__ */ __name(async () => this.cancelled.has(runId), "cancelled"),
3770
4060
  runAgent: /* @__PURE__ */ __name((childName, childTask) => this.runNested({
3771
4061
  agentName: childName,
@@ -3798,7 +4088,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
3798
4088
  }
3799
4089
  }), "startAgent")
3800
4090
  };
3801
- void (0, import_nestjs_agent_core23.runAgentLoop)({
4091
+ void (0, import_nestjs_agent_core25.runAgentLoop)({
3802
4092
  ...deps,
3803
4093
  day
3804
4094
  }, {
@@ -3812,13 +4102,13 @@ var InlineAgentRunner = class _InlineAgentRunner {
3812
4102
  parentRunId,
3813
4103
  deliverTo
3814
4104
  }, hooks).catch(async (error) => {
3815
- const cancelled = error instanceof import_nestjs_agent_core23.RunCancelledError;
4105
+ const cancelled = error instanceof import_nestjs_agent_core25.RunCancelledError;
3816
4106
  const message = error instanceof Error ? error.message : String(error);
3817
4107
  if (!cancelled) {
3818
4108
  this.logger.error(`detached agent run ${runId} failed: ${message}`);
3819
- (0, import_nestjs_agent_core23.publishAgentRunFailed)({
4109
+ (0, import_nestjs_agent_core25.publishAgentRunFailed)({
3820
4110
  runId,
3821
- code: (0, import_nestjs_agent_core23.agentFailureCode)(error),
4111
+ code: (0, import_nestjs_agent_core25.agentFailureCode)(error),
3822
4112
  message
3823
4113
  });
3824
4114
  }
@@ -3826,11 +4116,11 @@ var InlineAgentRunner = class _InlineAgentRunner {
3826
4116
  runId,
3827
4117
  status: cancelled ? "cancelled" : "failed",
3828
4118
  ...cancelled ? {} : {
3829
- errorCode: (0, import_nestjs_agent_core23.agentFailureCode)(error),
4119
+ errorCode: (0, import_nestjs_agent_core25.agentFailureCode)(error),
3830
4120
  errorMessage: message
3831
4121
  }
3832
4122
  });
3833
- await (0, import_nestjs_agent_core23.settleUnsettledDelegation)({
4123
+ await (0, import_nestjs_agent_core25.settleUnsettledDelegation)({
3834
4124
  store: this.store,
3835
4125
  delivery: deliverTo,
3836
4126
  agent: agentName,
@@ -3869,7 +4159,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
3869
4159
  awaitApproval: /* @__PURE__ */ __name((call, _ctx, opts) => this.parkApproval(runId, call.id, opts?.timeoutMs), "awaitApproval"),
3870
4160
  awaitAnswers: /* @__PURE__ */ __name((request) => this.park(runId, request.id), "awaitAnswers"),
3871
4161
  step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
3872
- parallel: import_nestjs_agent_core23.settleAll,
4162
+ parallel: import_nestjs_agent_core25.settleAll,
3873
4163
  // A child stops when it is cancelled OR when the run a human is actually watching is: the
3874
4164
  // canceller names the top-level run, which is the only id that ever left the server.
3875
4165
  cancelled: /* @__PURE__ */ __name(async () => this.cancelled.has(runId) || this.cancelled.has(sinkRunId), "cancelled"),
@@ -3904,7 +4194,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
3904
4194
  }), "startAgent")
3905
4195
  };
3906
4196
  try {
3907
- return await (0, import_nestjs_agent_core23.runAgentLoop)({
4197
+ return await (0, import_nestjs_agent_core25.runAgentLoop)({
3908
4198
  ...deps,
3909
4199
  day
3910
4200
  }, {
@@ -3923,19 +4213,19 @@ var InlineAgentRunner = class _InlineAgentRunner {
3923
4213
  }
3924
4214
  }
3925
4215
  };
3926
- InlineAgentRunner = _ts_decorate21([
3927
- (0, import_common21.Injectable)(),
3928
- _ts_param19(0, (0, import_common21.Inject)(import_nestjs_agent_core23.AGENT_DEPS_FACTORY)),
3929
- _ts_param19(1, (0, import_common21.Inject)(import_nestjs_agent_core23.AGENT_STORE)),
3930
- _ts_metadata20("design:type", Function),
3931
- _ts_metadata20("design:paramtypes", [
4216
+ InlineAgentRunner = _ts_decorate22([
4217
+ (0, import_common22.Injectable)(),
4218
+ _ts_param20(0, (0, import_common22.Inject)(import_nestjs_agent_core25.AGENT_DEPS_FACTORY)),
4219
+ _ts_param20(1, (0, import_common22.Inject)(import_nestjs_agent_core25.AGENT_STORE)),
4220
+ _ts_metadata21("design:type", Function),
4221
+ _ts_metadata21("design:paramtypes", [
3932
4222
  typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
3933
4223
  typeof AgentStore === "undefined" ? Object : AgentStore
3934
4224
  ])
3935
4225
  ], InlineAgentRunner);
3936
4226
 
3937
4227
  // src/skills-config.ts
3938
- var import_nestjs_agent_core24 = require("@dudousxd/nestjs-agent-core");
4228
+ var import_nestjs_agent_core26 = require("@dudousxd/nestjs-agent-core");
3939
4229
  function declaredSkillProvider(declared) {
3940
4230
  return {
3941
4231
  list: /* @__PURE__ */ __name(({ scopes }) => declared.filter((skill) => scopes.includes(skill.scope)).map(({ name, description, scope }) => ({
@@ -3961,7 +4251,7 @@ function resolveSkillsConfig(options, declared) {
3961
4251
  declaredSkillProvider(declared)
3962
4252
  ];
3963
4253
  return {
3964
- provider: providers.length === 1 ? providers[0] : (0, import_nestjs_agent_core24.compositeSkillProvider)(providers),
4254
+ provider: providers.length === 1 ? providers[0] : (0, import_nestjs_agent_core26.compositeSkillProvider)(providers),
3965
4255
  ...options.scopes !== void 0 ? {
3966
4256
  scopes: options.scopes
3967
4257
  } : {},
@@ -3973,7 +4263,7 @@ function resolveSkillsConfig(options, declared) {
3973
4263
  __name(resolveSkillsConfig, "resolveSkillsConfig");
3974
4264
 
3975
4265
  // src/agent.module.ts
3976
- function _ts_decorate22(decorators, target, key, desc) {
4266
+ function _ts_decorate23(decorators, target, key, desc) {
3977
4267
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3978
4268
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
3979
4269
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3986,92 +4276,108 @@ function _ts_decorate22(decorators, target, key, desc) {
3986
4276
  }
3987
4277
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3988
4278
  }
3989
- __name(_ts_decorate22, "_ts_decorate");
4279
+ __name(_ts_decorate23, "_ts_decorate");
3990
4280
  var DEFAULT_PATH = "agent";
3991
4281
  function sharedProviders(durable, includeStore) {
3992
4282
  const providers = [
3993
4283
  {
3994
- provide: import_nestjs_agent_core25.AGENT_TOOL_REGISTRY,
3995
- useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core25.ToolRegistry(), "useFactory")
4284
+ provide: import_nestjs_agent_core27.AGENT_TOOL_REGISTRY,
4285
+ useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core27.ToolRegistry(), "useFactory")
3996
4286
  },
3997
4287
  // Starts empty; AgentDiscoveryService populates it from `@Agent`-decorated providers at boot.
3998
4288
  {
3999
- provide: import_nestjs_agent_core25.AGENT_REGISTRY,
4000
- useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core25.AgentRegistry(), "useFactory")
4289
+ provide: import_nestjs_agent_core27.AGENT_REGISTRY,
4290
+ useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core27.AgentRegistry(), "useFactory")
4001
4291
  },
4002
4292
  // A shared, mutable list AgentDiscoveryService fills with `@SystemPromptContributor()` methods.
4003
4293
  {
4004
- provide: import_nestjs_agent_core25.AGENT_PROMPT_CONTRIBUTORS,
4294
+ provide: import_nestjs_agent_core27.AGENT_PROMPT_CONTRIBUTORS,
4005
4295
  useFactory: /* @__PURE__ */ __name(() => [], "useFactory")
4006
4296
  },
4007
4297
  // Likewise for `@Skill`-decorated providers — filled by SkillDiscoveryService at onModuleInit,
4008
4298
  // read lazily by the AGENT_SKILLS provider below (which DI builds before discovery has run).
4009
4299
  {
4010
- provide: import_nestjs_agent_core25.AGENT_SKILL_SOURCES,
4300
+ provide: import_nestjs_agent_core27.AGENT_SKILL_SOURCES,
4011
4301
  useFactory: /* @__PURE__ */ __name(() => [], "useFactory")
4012
4302
  },
4013
4303
  {
4014
4304
  // One resolution, shared by the loop's deps and the listing endpoint: a second one would
4015
4305
  // drift, and a user would be offered a skill the agent cannot reach. `undefined` when the
4016
4306
  // host configured none — which is what keeps the turn's checkpoint sequence unchanged.
4017
- provide: import_nestjs_agent_core25.AGENT_SKILLS,
4307
+ provide: import_nestjs_agent_core27.AGENT_SKILLS,
4018
4308
  useFactory: /* @__PURE__ */ __name((options, declared) => resolveSkillsConfig(options.skills, declared), "useFactory"),
4019
4309
  inject: [
4020
- import_nestjs_agent_core25.AGENT_OPTIONS,
4021
- import_nestjs_agent_core25.AGENT_SKILL_SOURCES
4310
+ import_nestjs_agent_core27.AGENT_OPTIONS,
4311
+ import_nestjs_agent_core27.AGENT_SKILL_SOURCES
4022
4312
  ]
4023
4313
  },
4024
4314
  {
4025
4315
  // One resolution, shared by the loop's deps and the read-back endpoint: a person has to be
4026
4316
  // shown what the model was shown, and two resolutions would eventually disagree about that.
4027
- provide: import_nestjs_agent_core25.AGENT_MEMORY,
4317
+ provide: import_nestjs_agent_core27.AGENT_MEMORY,
4028
4318
  useFactory: /* @__PURE__ */ __name((options) => options.memory, "useFactory"),
4029
4319
  inject: [
4030
- import_nestjs_agent_core25.AGENT_OPTIONS
4320
+ import_nestjs_agent_core27.AGENT_OPTIONS
4031
4321
  ]
4032
4322
  },
4033
4323
  {
4034
- provide: import_nestjs_agent_core25.AGENT_SINK,
4324
+ provide: import_nestjs_agent_core27.AGENT_SINK,
4035
4325
  useFactory: /* @__PURE__ */ __name((options) => options.sink ?? new InProcessTokenStreamSink(), "useFactory"),
4036
4326
  inject: [
4037
- import_nestjs_agent_core25.AGENT_OPTIONS
4327
+ import_nestjs_agent_core27.AGENT_OPTIONS
4038
4328
  ]
4039
4329
  },
4040
4330
  {
4041
- provide: import_nestjs_agent_core25.AGENT_ROLES_POLICY,
4042
- useFactory: /* @__PURE__ */ __name((options) => options.rolesPolicy ?? new import_nestjs_agent_core25.DefaultRolesPolicy(options.defaultRoles), "useFactory"),
4331
+ provide: import_nestjs_agent_core27.AGENT_ROLES_POLICY,
4332
+ useFactory: /* @__PURE__ */ __name((options) => options.rolesPolicy ?? new import_nestjs_agent_core27.DefaultRolesPolicy(options.defaultRoles), "useFactory"),
4043
4333
  inject: [
4044
- import_nestjs_agent_core25.AGENT_OPTIONS
4334
+ import_nestjs_agent_core27.AGENT_OPTIONS
4045
4335
  ]
4046
4336
  },
4047
4337
  {
4048
- provide: import_nestjs_agent_core25.AGENT_ACTOR_RESOLVER,
4338
+ provide: import_nestjs_agent_core27.AGENT_ACTOR_RESOLVER,
4049
4339
  useFactory: /* @__PURE__ */ __name((options) => options.actorResolver, "useFactory"),
4050
4340
  inject: [
4051
- import_nestjs_agent_core25.AGENT_OPTIONS
4341
+ import_nestjs_agent_core27.AGENT_OPTIONS
4052
4342
  ]
4053
4343
  },
4054
4344
  {
4055
- provide: import_nestjs_agent_core25.AGENT_MODEL,
4345
+ provide: import_nestjs_agent_core27.AGENT_MODEL,
4056
4346
  useFactory: /* @__PURE__ */ __name((o) => o.model, "useFactory"),
4057
4347
  inject: [
4058
- import_nestjs_agent_core25.AGENT_OPTIONS
4348
+ import_nestjs_agent_core27.AGENT_OPTIONS
4059
4349
  ]
4060
4350
  },
4061
4351
  {
4062
4352
  // An explicit `quota` wins; otherwise `quotaLimitTokens` binds the built-in ledger-backed
4063
4353
  // store; otherwise quotas are off (undefined). The ledger store reads the same usage rows
4064
4354
  // the loop already writes, so enforcement needs no extra shared state across replicas.
4065
- provide: import_nestjs_agent_core25.AGENT_QUOTA_STORE,
4355
+ provide: import_nestjs_agent_core27.AGENT_QUOTA_STORE,
4066
4356
  useFactory: /* @__PURE__ */ __name((o, store) => o.quota ?? (o.quotaLimitTokens !== void 0 ? new LedgerQuotaStore(store, o.quotaLimitTokens) : void 0), "useFactory"),
4067
4357
  inject: [
4068
- import_nestjs_agent_core25.AGENT_OPTIONS,
4069
- import_nestjs_agent_core25.AGENT_STORE
4358
+ import_nestjs_agent_core27.AGENT_OPTIONS,
4359
+ import_nestjs_agent_core27.AGENT_STORE
4360
+ ]
4361
+ },
4362
+ {
4363
+ provide: import_nestjs_agent_core27.AGENT_QUOTA_PROVIDER,
4364
+ useFactory: /* @__PURE__ */ __name((o, store, quota) => o.quotaProvider ?? new LedgerQuotaProvider(store, quota, o.quotaLimits), "useFactory"),
4365
+ inject: [
4366
+ import_nestjs_agent_core27.AGENT_OPTIONS,
4367
+ import_nestjs_agent_core27.AGENT_STORE,
4368
+ import_nestjs_agent_core27.AGENT_QUOTA_STORE
4369
+ ]
4370
+ },
4371
+ {
4372
+ provide: import_nestjs_agent_core27.AGENT_MODEL_CATALOG,
4373
+ useFactory: /* @__PURE__ */ __name((o) => o.models, "useFactory"),
4374
+ inject: [
4375
+ import_nestjs_agent_core27.AGENT_OPTIONS
4070
4376
  ]
4071
4377
  },
4072
4378
  AgentDepsFactory2,
4073
4379
  {
4074
- provide: import_nestjs_agent_core25.AGENT_DEPS_FACTORY,
4380
+ provide: import_nestjs_agent_core27.AGENT_DEPS_FACTORY,
4075
4381
  useExisting: AgentDepsFactory2
4076
4382
  },
4077
4383
  // Populates the registry + contributors (onModuleInit) BEFORE AiToolDiscoveryService synthesizes
@@ -4085,22 +4391,22 @@ function sharedProviders(durable, includeStore) {
4085
4391
  // through AgentService.signalToolCall, which reaches whichever AGENT_RUNNER is bound above.
4086
4392
  AgentApprovalPortAdapter,
4087
4393
  {
4088
- provide: import_nestjs_agent_core25.AGENT_APPROVAL_PORT,
4394
+ provide: import_nestjs_agent_core27.AGENT_APPROVAL_PORT,
4089
4395
  useExisting: AgentApprovalPortAdapter
4090
4396
  }
4091
4397
  ];
4092
4398
  if (includeStore) {
4093
4399
  providers.push({
4094
- provide: import_nestjs_agent_core25.AGENT_STORE,
4400
+ provide: import_nestjs_agent_core27.AGENT_STORE,
4095
4401
  useFactory: /* @__PURE__ */ __name((o) => o.store, "useFactory"),
4096
4402
  inject: [
4097
- import_nestjs_agent_core25.AGENT_OPTIONS
4403
+ import_nestjs_agent_core27.AGENT_OPTIONS
4098
4404
  ]
4099
4405
  });
4100
4406
  }
4101
4407
  if (durable) {
4102
4408
  providers.push({
4103
- provide: import_nestjs_agent_core25.AGENT_RUNNER,
4409
+ provide: import_nestjs_agent_core27.AGENT_RUNNER,
4104
4410
  useFactory: /* @__PURE__ */ __name((durableRunner) => {
4105
4411
  if (durableRunner === void 0) {
4106
4412
  throw new Error("AgentModule.forRoot({ durable: true }) requires importing AgentDurableModule from '@dudousxd/nestjs-agent/durable' (alongside a configured DurableModule). It was not found.");
@@ -4109,14 +4415,14 @@ function sharedProviders(durable, includeStore) {
4109
4415
  }, "useFactory"),
4110
4416
  inject: [
4111
4417
  {
4112
- token: import_nestjs_agent_core25.AGENT_DURABLE_RUNNER,
4418
+ token: import_nestjs_agent_core27.AGENT_DURABLE_RUNNER,
4113
4419
  optional: true
4114
4420
  }
4115
4421
  ]
4116
4422
  });
4117
4423
  } else {
4118
4424
  providers.push({
4119
- provide: import_nestjs_agent_core25.AGENT_RUNNER,
4425
+ provide: import_nestjs_agent_core27.AGENT_RUNNER,
4120
4426
  useExisting: InlineAgentRunner
4121
4427
  });
4122
4428
  }
@@ -4125,25 +4431,27 @@ function sharedProviders(durable, includeStore) {
4125
4431
  __name(sharedProviders, "sharedProviders");
4126
4432
  function exportsFor(includeStore) {
4127
4433
  return [
4128
- import_nestjs_agent_core25.AGENT_OPTIONS,
4129
- import_nestjs_agent_core25.AGENT_TOOL_REGISTRY,
4130
- import_nestjs_agent_core25.AGENT_REGISTRY,
4131
- import_nestjs_agent_core25.AGENT_SINK,
4132
- import_nestjs_agent_core25.AGENT_ROLES_POLICY,
4133
- import_nestjs_agent_core25.AGENT_ACTOR_RESOLVER,
4134
- import_nestjs_agent_core25.AGENT_MODEL,
4434
+ import_nestjs_agent_core27.AGENT_OPTIONS,
4435
+ import_nestjs_agent_core27.AGENT_TOOL_REGISTRY,
4436
+ import_nestjs_agent_core27.AGENT_REGISTRY,
4437
+ import_nestjs_agent_core27.AGENT_SINK,
4438
+ import_nestjs_agent_core27.AGENT_ROLES_POLICY,
4439
+ import_nestjs_agent_core27.AGENT_ACTOR_RESOLVER,
4440
+ import_nestjs_agent_core27.AGENT_MODEL,
4135
4441
  ...includeStore ? [
4136
- import_nestjs_agent_core25.AGENT_STORE
4442
+ import_nestjs_agent_core27.AGENT_STORE
4137
4443
  ] : [],
4138
- import_nestjs_agent_core25.AGENT_QUOTA_STORE,
4139
- import_nestjs_agent_core25.AGENT_PROMPT_CONTRIBUTORS,
4140
- import_nestjs_agent_core25.AGENT_SKILLS,
4141
- import_nestjs_agent_core25.AGENT_MEMORY,
4142
- import_nestjs_agent_core25.AGENT_DEPS_FACTORY,
4444
+ import_nestjs_agent_core27.AGENT_QUOTA_STORE,
4445
+ import_nestjs_agent_core27.AGENT_MODEL_CATALOG,
4446
+ import_nestjs_agent_core27.AGENT_QUOTA_PROVIDER,
4447
+ import_nestjs_agent_core27.AGENT_PROMPT_CONTRIBUTORS,
4448
+ import_nestjs_agent_core27.AGENT_SKILLS,
4449
+ import_nestjs_agent_core27.AGENT_MEMORY,
4450
+ import_nestjs_agent_core27.AGENT_DEPS_FACTORY,
4143
4451
  AgentDepsFactory2,
4144
4452
  AgentService,
4145
4453
  InlineAgentRunner,
4146
- import_nestjs_agent_core25.AGENT_APPROVAL_PORT
4454
+ import_nestjs_agent_core27.AGENT_APPROVAL_PORT
4147
4455
  ];
4148
4456
  }
4149
4457
  __name(exportsFor, "exportsFor");
@@ -4156,7 +4464,8 @@ var BASE_CONTROLLERS = [
4156
4464
  SkillsController,
4157
4465
  MemoriesController,
4158
4466
  ToolsController,
4159
- MessagesController
4467
+ MessagesController,
4468
+ ModelsController
4160
4469
  ];
4161
4470
  var GUARDABLE_CONTROLLERS = [
4162
4471
  ...BASE_CONTROLLERS,
@@ -4214,7 +4523,7 @@ var AgentModule = class _AgentModule {
4214
4523
  controllers: controllersForSurface(options.surface, options.attachments?.upload === true),
4215
4524
  providers: [
4216
4525
  {
4217
- provide: import_nestjs_agent_core25.AGENT_OPTIONS,
4526
+ provide: import_nestjs_agent_core27.AGENT_OPTIONS,
4218
4527
  useValue: options
4219
4528
  },
4220
4529
  ...sharedProviders(options.durable ?? false, includeStore),
@@ -4238,7 +4547,7 @@ var AgentModule = class _AgentModule {
4238
4547
  controllers: controllersForSurface(options.surface, options.attachmentsUpload === true),
4239
4548
  providers: [
4240
4549
  {
4241
- provide: import_nestjs_agent_core25.AGENT_OPTIONS,
4550
+ provide: import_nestjs_agent_core27.AGENT_OPTIONS,
4242
4551
  // Stamp the STATIC wiring flags onto the factory result: `durable`/`surface` are
4243
4552
  // authoritative on the async config object (they decided the actual wiring above), and
4244
4553
  // the durable module reads `durable` back off AGENT_OPTIONS. `surface` isn't read back by
@@ -4259,9 +4568,9 @@ var AgentModule = class _AgentModule {
4259
4568
  };
4260
4569
  }
4261
4570
  };
4262
- AgentModule = _ts_decorate22([
4263
- (0, import_common22.Global)(),
4264
- (0, import_common22.Module)({})
4571
+ AgentModule = _ts_decorate23([
4572
+ (0, import_common23.Global)(),
4573
+ (0, import_common23.Module)({})
4265
4574
  ], AgentModule);
4266
4575
 
4267
4576
  // src/durable/agent-durable.ts