@dudousxd/nestjs-agent 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -32,6 +32,9 @@ __export(index_exports, {
32
32
  AgentService: () => AgentService,
33
33
  AiTool: () => AiTool,
34
34
  AiToolDiscoveryService: () => AiToolDiscoveryService,
35
+ AttachmentsController: () => AttachmentsController,
36
+ DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES: () => DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES,
37
+ DEFAULT_MAX_ATTACHMENT_BYTES: () => DEFAULT_MAX_ATTACHMENT_BYTES,
35
38
  HeaderActorResolver: () => HeaderActorResolver,
36
39
  InProcessTokenStreamSink: () => InProcessTokenStreamSink,
37
40
  InlineAgentRunner: () => InlineAgentRunner,
@@ -49,8 +52,8 @@ __export(index_exports, {
49
52
  module.exports = __toCommonJS(index_exports);
50
53
 
51
54
  // src/agent.module.ts
52
- var import_nestjs_agent_core13 = require("@dudousxd/nestjs-agent-core");
53
- var import_common11 = require("@nestjs/common");
55
+ var import_nestjs_agent_core14 = require("@dudousxd/nestjs-agent-core");
56
+ var import_common12 = require("@nestjs/common");
54
57
  var import_core3 = require("@nestjs/core");
55
58
 
56
59
  // src/agent-deps.factory.ts
@@ -91,7 +94,8 @@ var AgentDepsFactory2 = class {
91
94
  agents;
92
95
  promptContributors;
93
96
  quota;
94
- constructor(options, model, store, sink, rolesPolicy, registry, agents, promptContributors, quota) {
97
+ pricingStore;
98
+ constructor(options, model, store, sink, rolesPolicy, registry, agents, promptContributors, quota, pricingStore) {
95
99
  this.options = options;
96
100
  this.model = model;
97
101
  this.store = store;
@@ -101,6 +105,7 @@ var AgentDepsFactory2 = class {
101
105
  this.agents = agents;
102
106
  this.promptContributors = promptContributors;
103
107
  this.quota = quota;
108
+ this.pricingStore = pricingStore;
104
109
  }
105
110
  /**
106
111
  * The agent a turn uses when the caller names none: the explicit `defaultAgent` option, else the
@@ -147,6 +152,9 @@ var AgentDepsFactory2 = class {
147
152
  ...this.quota !== void 0 ? {
148
153
  quota: this.quota
149
154
  } : {},
155
+ ...this.pricingStore !== void 0 ? {
156
+ pricingStore: this.pricingStore
157
+ } : {},
150
158
  ...toolAllowList !== void 0 ? {
151
159
  toolAllowList
152
160
  } : {},
@@ -187,6 +195,8 @@ AgentDepsFactory2 = _ts_decorate([
187
195
  _ts_param(6, (0, import_common.Inject)(import_nestjs_agent_core.AGENT_REGISTRY)),
188
196
  _ts_param(7, (0, import_common.Inject)(import_nestjs_agent_core.AGENT_PROMPT_CONTRIBUTORS)),
189
197
  _ts_param(8, (0, import_common.Inject)(import_nestjs_agent_core.AGENT_QUOTA_STORE)),
198
+ _ts_param(9, (0, import_common.Optional)()),
199
+ _ts_param(9, (0, import_common.Inject)(import_nestjs_agent_core.AGENT_PRICING_STORE)),
190
200
  _ts_metadata("design:type", Function),
191
201
  _ts_metadata("design:paramtypes", [
192
202
  typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
@@ -197,6 +207,7 @@ AgentDepsFactory2 = _ts_decorate([
197
207
  typeof import_nestjs_agent_core.ToolRegistry === "undefined" ? Object : import_nestjs_agent_core.ToolRegistry,
198
208
  typeof import_nestjs_agent_core.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core.AgentRegistry,
199
209
  Array,
210
+ Object,
200
211
  Object
201
212
  ])
202
213
  ], AgentDepsFactory2);
@@ -254,7 +265,7 @@ var AgentService = class {
254
265
  this.quota = quota;
255
266
  }
256
267
  async chat(params) {
257
- const agentName = params.agentName ?? this.deps.defaultAgentName();
268
+ const agentName = await this.resolveAgentName(params.agentName, params.threadId);
258
269
  let threadId = params.threadId;
259
270
  if (threadId === void 0) {
260
271
  if (params.regenerate === true) {
@@ -279,6 +290,9 @@ var AgentService = class {
279
290
  ...params.regenerate === true ? {
280
291
  regenerate: true
281
292
  } : {},
293
+ ...params.attachments !== void 0 ? {
294
+ attachments: params.attachments
295
+ } : {},
282
296
  ...params.pageContext !== void 0 ? {
283
297
  pageContext: params.pageContext
284
298
  } : {}
@@ -312,12 +326,14 @@ var AgentService = class {
312
326
  await this.assertOwnsActiveStream(actor, runId);
313
327
  return this.runner.cancel(runId);
314
328
  }
315
- listThreads(actorRef) {
316
- return this.store.listThreads(actorRef);
329
+ async listThreads(actorRef) {
330
+ const threads = await this.store.listThreads(actorRef);
331
+ return Promise.all(threads.map((thread) => this.toSummaryView(thread)));
317
332
  }
318
333
  async getThread(actor, threadId) {
319
334
  await this.assertOwnsThread(actor, threadId);
320
- return this.store.getThread(threadId);
335
+ const thread = await this.store.getThread(threadId);
336
+ return thread === null ? null : this.toDetailView(thread);
321
337
  }
322
338
  async deleteThread(actor, threadId) {
323
339
  await this.assertOwnsThread(actor, threadId);
@@ -327,7 +343,38 @@ var AgentService = class {
327
343
  await this.assertOwnsThread(actor, threadId);
328
344
  return this.store.forkThread(threadId, fromMessageId);
329
345
  }
346
+ /** Kept for source compatibility — a thin wrapper over the more general `updateThread`. */
330
347
  async renameThread(actor, threadId, title) {
348
+ return this.updateThread(actor, threadId, {
349
+ title
350
+ });
351
+ }
352
+ /**
353
+ * Rename a thread and/or set its default agent. Title-only patches work against ANY store (via
354
+ * the required `setTitle`); a `defaultAgent` change requires the bound store to implement the
355
+ * optional `updateThread` — 501 with a clear message when it doesn't, rather than silently
356
+ * dropping the field.
357
+ */
358
+ async updateThread(actor, threadId, patch) {
359
+ const title = patch.title !== void 0 ? this.validateTitle(patch.title) : void 0;
360
+ await this.assertOwnsThread(actor, threadId);
361
+ if (patch.defaultAgent === void 0) {
362
+ if (title !== void 0) {
363
+ await this.store.setTitle(threadId, title);
364
+ }
365
+ return;
366
+ }
367
+ if (this.store.updateThread === void 0) {
368
+ throw new import_common2.NotImplementedException("Setting a thread's defaultAgent requires an AgentStore that implements updateThread(); the bound store does not support it.");
369
+ }
370
+ await this.store.updateThread(threadId, {
371
+ ...title !== void 0 ? {
372
+ title
373
+ } : {},
374
+ defaultAgent: patch.defaultAgent
375
+ });
376
+ }
377
+ validateTitle(title) {
331
378
  const trimmed = title.trim();
332
379
  if (trimmed.length === 0) {
333
380
  throw new import_common2.BadRequestException("title must not be empty");
@@ -335,8 +382,41 @@ var AgentService = class {
335
382
  if (trimmed.length > 200) {
336
383
  throw new import_common2.BadRequestException("title must be at most 200 characters");
337
384
  }
338
- await this.assertOwnsThread(actor, threadId);
339
- return this.store.setTitle(threadId, trimmed);
385
+ return trimmed;
386
+ }
387
+ /**
388
+ * Agent-selection precedence for a `chat()` call with no explicit `agentName`: the thread's own
389
+ * `defaultAgent` (if the thread exists and one is set) wins over the module's configured default.
390
+ * Skips the thread lookup entirely when the caller already named an agent or there's no thread yet.
391
+ */
392
+ async resolveAgentName(agentName, threadId) {
393
+ if (agentName !== void 0) {
394
+ return agentName;
395
+ }
396
+ if (threadId !== void 0) {
397
+ const thread = await this.store.getThread(threadId);
398
+ if (thread?.defaultAgent !== void 0 && thread.defaultAgent !== null) {
399
+ return thread.defaultAgent;
400
+ }
401
+ }
402
+ return this.deps.defaultAgentName();
403
+ }
404
+ async toSummaryView(thread) {
405
+ return {
406
+ ...thread,
407
+ defaultAgent: thread.defaultAgent ?? null,
408
+ activeRunId: await this.store.activeRunForThread?.(thread.id) ?? null
409
+ };
410
+ }
411
+ async toDetailView(thread) {
412
+ const summary = await this.toSummaryView(thread);
413
+ return {
414
+ ...summary,
415
+ messages: thread.messages,
416
+ ...thread.activeStreamId !== void 0 ? {
417
+ activeStreamId: thread.activeStreamId
418
+ } : {}
419
+ };
340
420
  }
341
421
  async promoteThread(actor, threadId) {
342
422
  await this.assertOwnsThread(actor, threadId);
@@ -492,9 +572,10 @@ AgentsController = _ts_decorate3([
492
572
  ])
493
573
  ], AgentsController);
494
574
 
495
- // src/controller/chat.controller.ts
575
+ // src/controller/attachments.controller.ts
496
576
  var import_nestjs_agent_core5 = require("@dudousxd/nestjs-agent-core");
497
577
  var import_common4 = require("@nestjs/common");
578
+ var import_platform_express = require("@nestjs/platform-express");
498
579
  function _ts_decorate4(decorators, target, key, desc) {
499
580
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
500
581
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -512,6 +593,110 @@ function _ts_param4(paramIndex, decorator) {
512
593
  };
513
594
  }
514
595
  __name(_ts_param4, "_ts_param");
596
+ var DEFAULT_MAX_ATTACHMENT_BYTES = 20 * 1024 * 1024;
597
+ var DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES = [
598
+ "image/png",
599
+ "image/jpeg",
600
+ "image/gif",
601
+ "image/webp",
602
+ "application/pdf",
603
+ "text/plain",
604
+ "text/csv"
605
+ ];
606
+ var AttachmentsController = class {
607
+ static {
608
+ __name(this, "AttachmentsController");
609
+ }
610
+ options;
611
+ actorResolver;
612
+ staging;
613
+ constructor(options, actorResolver, staging) {
614
+ this.options = options;
615
+ this.actorResolver = actorResolver;
616
+ this.staging = staging;
617
+ }
618
+ /**
619
+ * `attachments.upload: true` is what mounts this controller at all (see `agent.module.ts`), so by
620
+ * the time an instance exists the host clearly intends uploads to work. Fail boot loudly rather
621
+ * than mounting a controller that would 501 on every single request because nobody bound
622
+ * `AGENT_ATTACHMENT_STAGING`.
623
+ */
624
+ onModuleInit() {
625
+ if (this.options.attachments?.upload === true && this.staging === void 0) {
626
+ throw new Error("AgentModule: attachments.upload is true but no AGENT_ATTACHMENT_STAGING provider is bound. Bind one (e.g. `{ provide: AGENT_ATTACHMENT_STAGING, useClass: MyStagingStore }`) in a module imported alongside AgentModule, or set attachments.upload to false.");
627
+ }
628
+ }
629
+ async upload(req, file) {
630
+ if (this.staging === void 0) {
631
+ throw new import_common4.NotImplementedException("Attachment upload is not configured on this server.");
632
+ }
633
+ if (file === void 0) {
634
+ throw new import_common4.BadRequestException('multipart field "file" is required');
635
+ }
636
+ const allowedContentTypes = this.options.attachments?.allowedContentTypes ?? DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES;
637
+ if (!allowedContentTypes.includes(file.mimetype)) {
638
+ throw new import_common4.UnsupportedMediaTypeException(`content type "${file.mimetype}" is not allowed (allowed: ${allowedContentTypes.join(", ")})`);
639
+ }
640
+ const maxBytes = this.options.attachments?.maxBytes ?? DEFAULT_MAX_ATTACHMENT_BYTES;
641
+ if (file.size > maxBytes) {
642
+ throw new import_common4.PayloadTooLargeException(`file exceeds the ${maxBytes}-byte limit`);
643
+ }
644
+ const actor = await this.actorResolver.resolve(req);
645
+ return this.staging.stage({
646
+ data: file.buffer,
647
+ filename: file.originalname,
648
+ contentType: file.mimetype,
649
+ sizeBytes: file.size,
650
+ actor
651
+ });
652
+ }
653
+ };
654
+ _ts_decorate4([
655
+ (0, import_common4.Post)(),
656
+ (0, import_common4.UseInterceptors)((0, import_platform_express.FileInterceptor)("file")),
657
+ _ts_param4(0, (0, import_common4.Req)()),
658
+ _ts_param4(1, (0, import_common4.UploadedFile)()),
659
+ _ts_metadata4("design:type", Function),
660
+ _ts_metadata4("design:paramtypes", [
661
+ typeof Request === "undefined" ? Object : Request,
662
+ Object
663
+ ]),
664
+ _ts_metadata4("design:returntype", Promise)
665
+ ], AttachmentsController.prototype, "upload", null);
666
+ AttachmentsController = _ts_decorate4([
667
+ (0, import_common4.Controller)("attachments"),
668
+ _ts_param4(0, (0, import_common4.Inject)(import_nestjs_agent_core5.AGENT_OPTIONS)),
669
+ _ts_param4(1, (0, import_common4.Inject)(import_nestjs_agent_core5.AGENT_ACTOR_RESOLVER)),
670
+ _ts_param4(2, (0, import_common4.Optional)()),
671
+ _ts_param4(2, (0, import_common4.Inject)(import_nestjs_agent_core5.AGENT_ATTACHMENT_STAGING)),
672
+ _ts_metadata4("design:type", Function),
673
+ _ts_metadata4("design:paramtypes", [
674
+ typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
675
+ typeof ActorResolver === "undefined" ? Object : ActorResolver,
676
+ Object
677
+ ])
678
+ ], AttachmentsController);
679
+
680
+ // src/controller/chat.controller.ts
681
+ var import_nestjs_agent_core6 = require("@dudousxd/nestjs-agent-core");
682
+ var import_common5 = require("@nestjs/common");
683
+ function _ts_decorate5(decorators, target, key, desc) {
684
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
685
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
686
+ 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;
687
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
688
+ }
689
+ __name(_ts_decorate5, "_ts_decorate");
690
+ function _ts_metadata5(k, v) {
691
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
692
+ }
693
+ __name(_ts_metadata5, "_ts_metadata");
694
+ function _ts_param5(paramIndex, decorator) {
695
+ return function(target, key) {
696
+ decorator(target, key, paramIndex);
697
+ };
698
+ }
699
+ __name(_ts_param5, "_ts_param");
515
700
  var ChatController = class {
516
701
  static {
517
702
  __name(this, "ChatController");
@@ -533,6 +718,9 @@ var ChatController = class {
533
718
  ...body.agent !== void 0 ? {
534
719
  agentName: body.agent
535
720
  } : {},
721
+ ...body.attachments !== void 0 ? {
722
+ attachments: body.attachments
723
+ } : {},
536
724
  ...body.pageContext !== void 0 ? {
537
725
  pageContext: body.pageContext
538
726
  } : {},
@@ -571,17 +759,32 @@ data: ${JSON.stringify({
571
759
 
572
760
  `);
573
761
  const decoder = new TextDecoder();
762
+ let buffer = "";
574
763
  try {
575
764
  for await (const chunk of this.agent.subscribe(runId)) {
576
- res.write(`data: ${JSON.stringify({
577
- delta: decoder.decode(chunk)
578
- })}
765
+ buffer += decoder.decode(chunk, {
766
+ stream: true
767
+ });
768
+ let newline = buffer.indexOf("\n");
769
+ while (newline !== -1) {
770
+ const line = buffer.slice(0, newline);
771
+ buffer = buffer.slice(newline + 1);
772
+ if (line.length > 0) {
773
+ res.write(`data: ${line}
774
+
775
+ `);
776
+ }
777
+ newline = buffer.indexOf("\n");
778
+ }
779
+ }
780
+ if (buffer.length > 0) {
781
+ res.write(`data: ${buffer}
579
782
 
580
783
  `);
581
784
  }
582
785
  res.write("event: done\ndata: {}\n\n");
583
786
  } catch (error) {
584
- const payload = error instanceof import_nestjs_agent_core5.AgentStreamError ? {
787
+ const payload = error instanceof import_nestjs_agent_core6.AgentStreamError ? {
585
788
  code: error.code,
586
789
  message: error.message
587
790
  } : {
@@ -596,71 +799,71 @@ data: ${JSON.stringify(payload)}
596
799
  res.end();
597
800
  }
598
801
  };
599
- _ts_decorate4([
600
- (0, import_common4.Post)("chat"),
601
- _ts_param4(0, (0, import_common4.Req)()),
602
- _ts_param4(1, (0, import_common4.Res)()),
603
- _ts_param4(2, (0, import_common4.Body)()),
604
- _ts_metadata4("design:type", Function),
605
- _ts_metadata4("design:paramtypes", [
802
+ _ts_decorate5([
803
+ (0, import_common5.Post)("chat"),
804
+ _ts_param5(0, (0, import_common5.Req)()),
805
+ _ts_param5(1, (0, import_common5.Res)()),
806
+ _ts_param5(2, (0, import_common5.Body)()),
807
+ _ts_metadata5("design:type", Function),
808
+ _ts_metadata5("design:paramtypes", [
606
809
  typeof Request === "undefined" ? Object : Request,
607
810
  typeof Response === "undefined" ? Object : Response,
608
811
  typeof ChatBody === "undefined" ? Object : ChatBody
609
812
  ]),
610
- _ts_metadata4("design:returntype", Promise)
813
+ _ts_metadata5("design:returntype", Promise)
611
814
  ], ChatController.prototype, "chat", null);
612
- _ts_decorate4([
613
- (0, import_common4.Get)("chat/:runId/stream"),
614
- _ts_param4(0, (0, import_common4.Param)("runId")),
615
- _ts_param4(1, (0, import_common4.Res)()),
616
- _ts_metadata4("design:type", Function),
617
- _ts_metadata4("design:paramtypes", [
815
+ _ts_decorate5([
816
+ (0, import_common5.Get)("chat/:runId/stream"),
817
+ _ts_param5(0, (0, import_common5.Param)("runId")),
818
+ _ts_param5(1, (0, import_common5.Res)()),
819
+ _ts_metadata5("design:type", Function),
820
+ _ts_metadata5("design:paramtypes", [
618
821
  String,
619
822
  typeof Response === "undefined" ? Object : Response
620
823
  ]),
621
- _ts_metadata4("design:returntype", Promise)
824
+ _ts_metadata5("design:returntype", Promise)
622
825
  ], ChatController.prototype, "stream", null);
623
- _ts_decorate4([
624
- (0, import_common4.Post)("chat/:runId/cancel"),
625
- _ts_param4(0, (0, import_common4.Req)()),
626
- _ts_param4(1, (0, import_common4.Param)("runId")),
627
- _ts_metadata4("design:type", Function),
628
- _ts_metadata4("design:paramtypes", [
826
+ _ts_decorate5([
827
+ (0, import_common5.Post)("chat/:runId/cancel"),
828
+ _ts_param5(0, (0, import_common5.Req)()),
829
+ _ts_param5(1, (0, import_common5.Param)("runId")),
830
+ _ts_metadata5("design:type", Function),
831
+ _ts_metadata5("design:paramtypes", [
629
832
  typeof Request === "undefined" ? Object : Request,
630
833
  String
631
834
  ]),
632
- _ts_metadata4("design:returntype", Promise)
835
+ _ts_metadata5("design:returntype", Promise)
633
836
  ], ChatController.prototype, "cancel", null);
634
- ChatController = _ts_decorate4([
635
- (0, import_common4.Controller)(),
636
- _ts_param4(1, (0, import_common4.Inject)(import_nestjs_agent_core5.AGENT_ACTOR_RESOLVER)),
637
- _ts_metadata4("design:type", Function),
638
- _ts_metadata4("design:paramtypes", [
837
+ ChatController = _ts_decorate5([
838
+ (0, import_common5.Controller)(),
839
+ _ts_param5(1, (0, import_common5.Inject)(import_nestjs_agent_core6.AGENT_ACTOR_RESOLVER)),
840
+ _ts_metadata5("design:type", Function),
841
+ _ts_metadata5("design:paramtypes", [
639
842
  typeof AgentService === "undefined" ? Object : AgentService,
640
843
  typeof ActorResolver === "undefined" ? Object : ActorResolver
641
844
  ])
642
845
  ], ChatController);
643
846
 
644
847
  // src/controller/quota.controller.ts
645
- var import_nestjs_agent_core6 = require("@dudousxd/nestjs-agent-core");
646
- var import_common5 = require("@nestjs/common");
647
- function _ts_decorate5(decorators, target, key, desc) {
848
+ var import_nestjs_agent_core7 = require("@dudousxd/nestjs-agent-core");
849
+ var import_common6 = require("@nestjs/common");
850
+ function _ts_decorate6(decorators, target, key, desc) {
648
851
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
649
852
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
650
853
  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;
651
854
  return c > 3 && r && Object.defineProperty(target, key, r), r;
652
855
  }
653
- __name(_ts_decorate5, "_ts_decorate");
654
- function _ts_metadata5(k, v) {
856
+ __name(_ts_decorate6, "_ts_decorate");
857
+ function _ts_metadata6(k, v) {
655
858
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
656
859
  }
657
- __name(_ts_metadata5, "_ts_metadata");
658
- function _ts_param5(paramIndex, decorator) {
860
+ __name(_ts_metadata6, "_ts_metadata");
861
+ function _ts_param6(paramIndex, decorator) {
659
862
  return function(target, key) {
660
863
  decorator(target, key, paramIndex);
661
864
  };
662
865
  }
663
- __name(_ts_param5, "_ts_param");
866
+ __name(_ts_param6, "_ts_param");
664
867
  var QuotaController = class {
665
868
  static {
666
869
  __name(this, "QuotaController");
@@ -676,45 +879,45 @@ var QuotaController = class {
676
879
  return this.agent.quotaToday(actor.id);
677
880
  }
678
881
  };
679
- _ts_decorate5([
680
- (0, import_common5.Get)("today"),
681
- _ts_param5(0, (0, import_common5.Req)()),
682
- _ts_metadata5("design:type", Function),
683
- _ts_metadata5("design:paramtypes", [
882
+ _ts_decorate6([
883
+ (0, import_common6.Get)("today"),
884
+ _ts_param6(0, (0, import_common6.Req)()),
885
+ _ts_metadata6("design:type", Function),
886
+ _ts_metadata6("design:paramtypes", [
684
887
  typeof Request === "undefined" ? Object : Request
685
888
  ]),
686
- _ts_metadata5("design:returntype", Promise)
889
+ _ts_metadata6("design:returntype", Promise)
687
890
  ], QuotaController.prototype, "today", null);
688
- QuotaController = _ts_decorate5([
689
- (0, import_common5.Controller)("quota"),
690
- _ts_param5(1, (0, import_common5.Inject)(import_nestjs_agent_core6.AGENT_ACTOR_RESOLVER)),
691
- _ts_metadata5("design:type", Function),
692
- _ts_metadata5("design:paramtypes", [
891
+ QuotaController = _ts_decorate6([
892
+ (0, import_common6.Controller)("quota"),
893
+ _ts_param6(1, (0, import_common6.Inject)(import_nestjs_agent_core7.AGENT_ACTOR_RESOLVER)),
894
+ _ts_metadata6("design:type", Function),
895
+ _ts_metadata6("design:paramtypes", [
693
896
  typeof AgentService === "undefined" ? Object : AgentService,
694
897
  typeof ActorResolver === "undefined" ? Object : ActorResolver
695
898
  ])
696
899
  ], QuotaController);
697
900
 
698
901
  // src/controller/threads.controller.ts
699
- var import_nestjs_agent_core7 = require("@dudousxd/nestjs-agent-core");
700
- var import_common6 = require("@nestjs/common");
701
- function _ts_decorate6(decorators, target, key, desc) {
902
+ var import_nestjs_agent_core8 = require("@dudousxd/nestjs-agent-core");
903
+ var import_common7 = require("@nestjs/common");
904
+ function _ts_decorate7(decorators, target, key, desc) {
702
905
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
703
906
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
704
907
  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;
705
908
  return c > 3 && r && Object.defineProperty(target, key, r), r;
706
909
  }
707
- __name(_ts_decorate6, "_ts_decorate");
708
- function _ts_metadata6(k, v) {
910
+ __name(_ts_decorate7, "_ts_decorate");
911
+ function _ts_metadata7(k, v) {
709
912
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
710
913
  }
711
- __name(_ts_metadata6, "_ts_metadata");
712
- function _ts_param6(paramIndex, decorator) {
914
+ __name(_ts_metadata7, "_ts_metadata");
915
+ function _ts_param7(paramIndex, decorator) {
713
916
  return function(target, key) {
714
917
  decorator(target, key, paramIndex);
715
918
  };
716
919
  }
717
- __name(_ts_param6, "_ts_param");
920
+ __name(_ts_param7, "_ts_param");
718
921
  var ThreadsController = class {
719
922
  static {
720
923
  __name(this, "ThreadsController");
@@ -744,9 +947,21 @@ var ThreadsController = class {
744
947
  const actor = await this.actorResolver.resolve(req);
745
948
  return this.agent.forkThread(actor, id, messageId);
746
949
  }
747
- async rename(req, id, body) {
950
+ /**
951
+ * Renames the thread and/or sets its default agent. `defaultAgent` is only present in the request
952
+ * body when the client actually sent the key (JSON has no `undefined`), so `'defaultAgent' in body`
953
+ * distinguishes "leave it alone" from "set it to null" (clear it) unambiguously.
954
+ */
955
+ async update(req, id, body) {
748
956
  const actor = await this.actorResolver.resolve(req);
749
- await this.agent.renameThread(actor, id, body.title);
957
+ await this.agent.updateThread(actor, id, {
958
+ ...body.title !== void 0 ? {
959
+ title: body.title
960
+ } : {},
961
+ ..."defaultAgent" in body ? {
962
+ defaultAgent: body.defaultAgent ?? null
963
+ } : {}
964
+ });
750
965
  return {
751
966
  ok: true
752
967
  };
@@ -766,117 +981,117 @@ var ThreadsController = class {
766
981
  };
767
982
  }
768
983
  };
769
- _ts_decorate6([
770
- (0, import_common6.Get)(),
771
- _ts_param6(0, (0, import_common6.Req)()),
772
- _ts_metadata6("design:type", Function),
773
- _ts_metadata6("design:paramtypes", [
984
+ _ts_decorate7([
985
+ (0, import_common7.Get)(),
986
+ _ts_param7(0, (0, import_common7.Req)()),
987
+ _ts_metadata7("design:type", Function),
988
+ _ts_metadata7("design:paramtypes", [
774
989
  typeof Request === "undefined" ? Object : Request
775
990
  ]),
776
- _ts_metadata6("design:returntype", Promise)
991
+ _ts_metadata7("design:returntype", Promise)
777
992
  ], ThreadsController.prototype, "list", null);
778
- _ts_decorate6([
779
- (0, import_common6.Get)(":id"),
780
- _ts_param6(0, (0, import_common6.Req)()),
781
- _ts_param6(1, (0, import_common6.Param)("id")),
782
- _ts_metadata6("design:type", Function),
783
- _ts_metadata6("design:paramtypes", [
993
+ _ts_decorate7([
994
+ (0, import_common7.Get)(":id"),
995
+ _ts_param7(0, (0, import_common7.Req)()),
996
+ _ts_param7(1, (0, import_common7.Param)("id")),
997
+ _ts_metadata7("design:type", Function),
998
+ _ts_metadata7("design:paramtypes", [
784
999
  typeof Request === "undefined" ? Object : Request,
785
1000
  String
786
1001
  ]),
787
- _ts_metadata6("design:returntype", Promise)
1002
+ _ts_metadata7("design:returntype", Promise)
788
1003
  ], ThreadsController.prototype, "detail", null);
789
- _ts_decorate6([
790
- (0, import_common6.Delete)(":id"),
791
- _ts_param6(0, (0, import_common6.Req)()),
792
- _ts_param6(1, (0, import_common6.Param)("id")),
793
- _ts_metadata6("design:type", Function),
794
- _ts_metadata6("design:paramtypes", [
1004
+ _ts_decorate7([
1005
+ (0, import_common7.Delete)(":id"),
1006
+ _ts_param7(0, (0, import_common7.Req)()),
1007
+ _ts_param7(1, (0, import_common7.Param)("id")),
1008
+ _ts_metadata7("design:type", Function),
1009
+ _ts_metadata7("design:paramtypes", [
795
1010
  typeof Request === "undefined" ? Object : Request,
796
1011
  String
797
1012
  ]),
798
- _ts_metadata6("design:returntype", Promise)
1013
+ _ts_metadata7("design:returntype", Promise)
799
1014
  ], ThreadsController.prototype, "remove", null);
800
- _ts_decorate6([
801
- (0, import_common6.Post)(":id/fork-from/:messageId"),
802
- _ts_param6(0, (0, import_common6.Req)()),
803
- _ts_param6(1, (0, import_common6.Param)("id")),
804
- _ts_param6(2, (0, import_common6.Param)("messageId")),
805
- _ts_metadata6("design:type", Function),
806
- _ts_metadata6("design:paramtypes", [
1015
+ _ts_decorate7([
1016
+ (0, import_common7.Post)(":id/fork-from/:messageId"),
1017
+ _ts_param7(0, (0, import_common7.Req)()),
1018
+ _ts_param7(1, (0, import_common7.Param)("id")),
1019
+ _ts_param7(2, (0, import_common7.Param)("messageId")),
1020
+ _ts_metadata7("design:type", Function),
1021
+ _ts_metadata7("design:paramtypes", [
807
1022
  typeof Request === "undefined" ? Object : Request,
808
1023
  String,
809
1024
  String
810
1025
  ]),
811
- _ts_metadata6("design:returntype", Promise)
1026
+ _ts_metadata7("design:returntype", Promise)
812
1027
  ], ThreadsController.prototype, "fork", null);
813
- _ts_decorate6([
814
- (0, import_common6.Patch)(":id"),
815
- _ts_param6(0, (0, import_common6.Req)()),
816
- _ts_param6(1, (0, import_common6.Param)("id")),
817
- _ts_param6(2, (0, import_common6.Body)()),
818
- _ts_metadata6("design:type", Function),
819
- _ts_metadata6("design:paramtypes", [
1028
+ _ts_decorate7([
1029
+ (0, import_common7.Patch)(":id"),
1030
+ _ts_param7(0, (0, import_common7.Req)()),
1031
+ _ts_param7(1, (0, import_common7.Param)("id")),
1032
+ _ts_param7(2, (0, import_common7.Body)()),
1033
+ _ts_metadata7("design:type", Function),
1034
+ _ts_metadata7("design:paramtypes", [
820
1035
  typeof Request === "undefined" ? Object : Request,
821
1036
  String,
822
- typeof RenameThreadBody === "undefined" ? Object : RenameThreadBody
1037
+ typeof UpdateThreadBody === "undefined" ? Object : UpdateThreadBody
823
1038
  ]),
824
- _ts_metadata6("design:returntype", Promise)
825
- ], ThreadsController.prototype, "rename", null);
826
- _ts_decorate6([
827
- (0, import_common6.Post)(":id/promote"),
828
- _ts_param6(0, (0, import_common6.Req)()),
829
- _ts_param6(1, (0, import_common6.Param)("id")),
830
- _ts_metadata6("design:type", Function),
831
- _ts_metadata6("design:paramtypes", [
1039
+ _ts_metadata7("design:returntype", Promise)
1040
+ ], ThreadsController.prototype, "update", null);
1041
+ _ts_decorate7([
1042
+ (0, import_common7.Post)(":id/promote"),
1043
+ _ts_param7(0, (0, import_common7.Req)()),
1044
+ _ts_param7(1, (0, import_common7.Param)("id")),
1045
+ _ts_metadata7("design:type", Function),
1046
+ _ts_metadata7("design:paramtypes", [
832
1047
  typeof Request === "undefined" ? Object : Request,
833
1048
  String
834
1049
  ]),
835
- _ts_metadata6("design:returntype", Promise)
1050
+ _ts_metadata7("design:returntype", Promise)
836
1051
  ], ThreadsController.prototype, "promote", null);
837
- _ts_decorate6([
838
- (0, import_common6.Delete)(":id/from/:messageId"),
839
- _ts_param6(0, (0, import_common6.Req)()),
840
- _ts_param6(1, (0, import_common6.Param)("id")),
841
- _ts_param6(2, (0, import_common6.Param)("messageId")),
842
- _ts_metadata6("design:type", Function),
843
- _ts_metadata6("design:paramtypes", [
1052
+ _ts_decorate7([
1053
+ (0, import_common7.Delete)(":id/from/:messageId"),
1054
+ _ts_param7(0, (0, import_common7.Req)()),
1055
+ _ts_param7(1, (0, import_common7.Param)("id")),
1056
+ _ts_param7(2, (0, import_common7.Param)("messageId")),
1057
+ _ts_metadata7("design:type", Function),
1058
+ _ts_metadata7("design:paramtypes", [
844
1059
  typeof Request === "undefined" ? Object : Request,
845
1060
  String,
846
1061
  String
847
1062
  ]),
848
- _ts_metadata6("design:returntype", Promise)
1063
+ _ts_metadata7("design:returntype", Promise)
849
1064
  ], ThreadsController.prototype, "truncateFrom", null);
850
- ThreadsController = _ts_decorate6([
851
- (0, import_common6.Controller)("threads"),
852
- _ts_param6(1, (0, import_common6.Inject)(import_nestjs_agent_core7.AGENT_ACTOR_RESOLVER)),
853
- _ts_metadata6("design:type", Function),
854
- _ts_metadata6("design:paramtypes", [
1065
+ ThreadsController = _ts_decorate7([
1066
+ (0, import_common7.Controller)("threads"),
1067
+ _ts_param7(1, (0, import_common7.Inject)(import_nestjs_agent_core8.AGENT_ACTOR_RESOLVER)),
1068
+ _ts_metadata7("design:type", Function),
1069
+ _ts_metadata7("design:paramtypes", [
855
1070
  typeof AgentService === "undefined" ? Object : AgentService,
856
1071
  typeof ActorResolver === "undefined" ? Object : ActorResolver
857
1072
  ])
858
1073
  ], ThreadsController);
859
1074
 
860
1075
  // src/controller/tool-call.controller.ts
861
- var import_nestjs_agent_core8 = require("@dudousxd/nestjs-agent-core");
862
- var import_common7 = require("@nestjs/common");
863
- function _ts_decorate7(decorators, target, key, desc) {
1076
+ var import_nestjs_agent_core9 = require("@dudousxd/nestjs-agent-core");
1077
+ var import_common8 = require("@nestjs/common");
1078
+ function _ts_decorate8(decorators, target, key, desc) {
864
1079
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
865
1080
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
866
1081
  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;
867
1082
  return c > 3 && r && Object.defineProperty(target, key, r), r;
868
1083
  }
869
- __name(_ts_decorate7, "_ts_decorate");
870
- function _ts_metadata7(k, v) {
1084
+ __name(_ts_decorate8, "_ts_decorate");
1085
+ function _ts_metadata8(k, v) {
871
1086
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
872
1087
  }
873
- __name(_ts_metadata7, "_ts_metadata");
874
- function _ts_param7(paramIndex, decorator) {
1088
+ __name(_ts_metadata8, "_ts_metadata");
1089
+ function _ts_param8(paramIndex, decorator) {
875
1090
  return function(target, key) {
876
1091
  decorator(target, key, paramIndex);
877
1092
  };
878
1093
  }
879
- __name(_ts_param7, "_ts_param");
1094
+ __name(_ts_param8, "_ts_param");
880
1095
  var ToolCallController = class {
881
1096
  static {
882
1097
  __name(this, "ToolCallController");
@@ -902,41 +1117,41 @@ var ToolCallController = class {
902
1117
  };
903
1118
  }
904
1119
  };
905
- _ts_decorate7([
906
- (0, import_common7.Post)("approve"),
907
- _ts_param7(0, (0, import_common7.Req)()),
908
- _ts_param7(1, (0, import_common7.Body)()),
909
- _ts_metadata7("design:type", Function),
910
- _ts_metadata7("design:paramtypes", [
1120
+ _ts_decorate8([
1121
+ (0, import_common8.Post)("approve"),
1122
+ _ts_param8(0, (0, import_common8.Req)()),
1123
+ _ts_param8(1, (0, import_common8.Body)()),
1124
+ _ts_metadata8("design:type", Function),
1125
+ _ts_metadata8("design:paramtypes", [
911
1126
  typeof Request === "undefined" ? Object : Request,
912
1127
  typeof ApproveBody === "undefined" ? Object : ApproveBody
913
1128
  ]),
914
- _ts_metadata7("design:returntype", Promise)
1129
+ _ts_metadata8("design:returntype", Promise)
915
1130
  ], ToolCallController.prototype, "approve", null);
916
- _ts_decorate7([
917
- (0, import_common7.Post)("reject"),
918
- _ts_param7(0, (0, import_common7.Req)()),
919
- _ts_param7(1, (0, import_common7.Body)()),
920
- _ts_metadata7("design:type", Function),
921
- _ts_metadata7("design:paramtypes", [
1131
+ _ts_decorate8([
1132
+ (0, import_common8.Post)("reject"),
1133
+ _ts_param8(0, (0, import_common8.Req)()),
1134
+ _ts_param8(1, (0, import_common8.Body)()),
1135
+ _ts_metadata8("design:type", Function),
1136
+ _ts_metadata8("design:paramtypes", [
922
1137
  typeof Request === "undefined" ? Object : Request,
923
1138
  typeof RejectBody === "undefined" ? Object : RejectBody
924
1139
  ]),
925
- _ts_metadata7("design:returntype", Promise)
1140
+ _ts_metadata8("design:returntype", Promise)
926
1141
  ], ToolCallController.prototype, "reject", null);
927
- ToolCallController = _ts_decorate7([
928
- (0, import_common7.Controller)("tool-call"),
929
- _ts_param7(1, (0, import_common7.Inject)(import_nestjs_agent_core8.AGENT_ACTOR_RESOLVER)),
930
- _ts_metadata7("design:type", Function),
931
- _ts_metadata7("design:paramtypes", [
1142
+ ToolCallController = _ts_decorate8([
1143
+ (0, import_common8.Controller)("tool-call"),
1144
+ _ts_param8(1, (0, import_common8.Inject)(import_nestjs_agent_core9.AGENT_ACTOR_RESOLVER)),
1145
+ _ts_metadata8("design:type", Function),
1146
+ _ts_metadata8("design:paramtypes", [
932
1147
  typeof AgentService === "undefined" ? Object : AgentService,
933
1148
  typeof ActorResolver === "undefined" ? Object : ActorResolver
934
1149
  ])
935
1150
  ], ToolCallController);
936
1151
 
937
1152
  // src/discovery/agent-discovery.service.ts
938
- var import_nestjs_agent_core9 = require("@dudousxd/nestjs-agent-core");
939
- var import_common8 = require("@nestjs/common");
1153
+ var import_nestjs_agent_core10 = require("@dudousxd/nestjs-agent-core");
1154
+ var import_common9 = require("@nestjs/common");
940
1155
  var import_core = require("@nestjs/core");
941
1156
 
942
1157
  // src/decorator/agent.decorator.ts
@@ -971,23 +1186,23 @@ function SystemPromptContributor() {
971
1186
  __name(SystemPromptContributor, "SystemPromptContributor");
972
1187
 
973
1188
  // src/discovery/agent-discovery.service.ts
974
- function _ts_decorate8(decorators, target, key, desc) {
1189
+ function _ts_decorate9(decorators, target, key, desc) {
975
1190
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
976
1191
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
977
1192
  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;
978
1193
  return c > 3 && r && Object.defineProperty(target, key, r), r;
979
1194
  }
980
- __name(_ts_decorate8, "_ts_decorate");
981
- function _ts_metadata8(k, v) {
1195
+ __name(_ts_decorate9, "_ts_decorate");
1196
+ function _ts_metadata9(k, v) {
982
1197
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
983
1198
  }
984
- __name(_ts_metadata8, "_ts_metadata");
985
- function _ts_param8(paramIndex, decorator) {
1199
+ __name(_ts_metadata9, "_ts_metadata");
1200
+ function _ts_param9(paramIndex, decorator) {
986
1201
  return function(target, key) {
987
1202
  decorator(target, key, paramIndex);
988
1203
  };
989
1204
  }
990
- __name(_ts_param8, "_ts_param");
1205
+ __name(_ts_param9, "_ts_param");
991
1206
  var AgentDiscoveryService = class _AgentDiscoveryService {
992
1207
  static {
993
1208
  __name(this, "AgentDiscoveryService");
@@ -996,7 +1211,7 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
996
1211
  scanner;
997
1212
  registry;
998
1213
  contributors;
999
- logger = new import_common8.Logger(_AgentDiscoveryService.name);
1214
+ logger = new import_common9.Logger(_AgentDiscoveryService.name);
1000
1215
  constructor(discovery, scanner, registry, contributors) {
1001
1216
  this.discovery = discovery;
1002
1217
  this.scanner = scanner;
@@ -1084,22 +1299,22 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
1084
1299
  return (ctx) => candidate.call(instance, ctx);
1085
1300
  }
1086
1301
  };
1087
- AgentDiscoveryService = _ts_decorate8([
1088
- (0, import_common8.Injectable)(),
1089
- _ts_param8(2, (0, import_common8.Inject)(import_nestjs_agent_core9.AGENT_REGISTRY)),
1090
- _ts_param8(3, (0, import_common8.Inject)(import_nestjs_agent_core9.AGENT_PROMPT_CONTRIBUTORS)),
1091
- _ts_metadata8("design:type", Function),
1092
- _ts_metadata8("design:paramtypes", [
1302
+ AgentDiscoveryService = _ts_decorate9([
1303
+ (0, import_common9.Injectable)(),
1304
+ _ts_param9(2, (0, import_common9.Inject)(import_nestjs_agent_core10.AGENT_REGISTRY)),
1305
+ _ts_param9(3, (0, import_common9.Inject)(import_nestjs_agent_core10.AGENT_PROMPT_CONTRIBUTORS)),
1306
+ _ts_metadata9("design:type", Function),
1307
+ _ts_metadata9("design:paramtypes", [
1093
1308
  typeof import_core.DiscoveryService === "undefined" ? Object : import_core.DiscoveryService,
1094
1309
  typeof import_core.MetadataScanner === "undefined" ? Object : import_core.MetadataScanner,
1095
- typeof import_nestjs_agent_core9.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core9.AgentRegistry,
1310
+ typeof import_nestjs_agent_core10.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core10.AgentRegistry,
1096
1311
  Array
1097
1312
  ])
1098
1313
  ], AgentDiscoveryService);
1099
1314
 
1100
1315
  // src/discovery/ai-tool-discovery.service.ts
1101
- var import_nestjs_agent_core10 = require("@dudousxd/nestjs-agent-core");
1102
- var import_common9 = require("@nestjs/common");
1316
+ var import_nestjs_agent_core11 = require("@dudousxd/nestjs-agent-core");
1317
+ var import_common10 = require("@nestjs/common");
1103
1318
  var import_core2 = require("@nestjs/core");
1104
1319
  var import_zod = require("zod");
1105
1320
 
@@ -1148,23 +1363,23 @@ function provideAgentTool(factoryOrTool, inject) {
1148
1363
  __name(provideAgentTool, "provideAgentTool");
1149
1364
 
1150
1365
  // src/discovery/ai-tool-discovery.service.ts
1151
- function _ts_decorate9(decorators, target, key, desc) {
1366
+ function _ts_decorate10(decorators, target, key, desc) {
1152
1367
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1153
1368
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1154
1369
  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;
1155
1370
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1156
1371
  }
1157
- __name(_ts_decorate9, "_ts_decorate");
1158
- function _ts_metadata9(k, v) {
1372
+ __name(_ts_decorate10, "_ts_decorate");
1373
+ function _ts_metadata10(k, v) {
1159
1374
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1160
1375
  }
1161
- __name(_ts_metadata9, "_ts_metadata");
1162
- function _ts_param9(paramIndex, decorator) {
1376
+ __name(_ts_metadata10, "_ts_metadata");
1377
+ function _ts_param10(paramIndex, decorator) {
1163
1378
  return function(target, key) {
1164
1379
  decorator(target, key, paramIndex);
1165
1380
  };
1166
1381
  }
1167
- __name(_ts_param9, "_ts_param");
1382
+ __name(_ts_param10, "_ts_param");
1168
1383
  var AiToolDiscoveryService = class _AiToolDiscoveryService {
1169
1384
  static {
1170
1385
  __name(this, "AiToolDiscoveryService");
@@ -1173,7 +1388,7 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
1173
1388
  registry;
1174
1389
  agents;
1175
1390
  options;
1176
- logger = new import_common9.Logger(_AiToolDiscoveryService.name);
1391
+ logger = new import_common10.Logger(_AiToolDiscoveryService.name);
1177
1392
  constructor(discovery, registry, agents, options) {
1178
1393
  this.discovery = discovery;
1179
1394
  this.registry = registry;
@@ -1271,13 +1486,13 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
1271
1486
  return true;
1272
1487
  }
1273
1488
  };
1274
- AiToolDiscoveryService = _ts_decorate9([
1275
- (0, import_common9.Injectable)(),
1276
- _ts_param9(1, (0, import_common9.Inject)(import_nestjs_agent_core10.AGENT_TOOL_REGISTRY)),
1277
- _ts_param9(2, (0, import_common9.Inject)(import_nestjs_agent_core10.AGENT_REGISTRY)),
1278
- _ts_param9(3, (0, import_common9.Inject)(import_nestjs_agent_core10.AGENT_OPTIONS)),
1279
- _ts_metadata9("design:type", Function),
1280
- _ts_metadata9("design:paramtypes", [
1489
+ AiToolDiscoveryService = _ts_decorate10([
1490
+ (0, import_common10.Injectable)(),
1491
+ _ts_param10(1, (0, import_common10.Inject)(import_nestjs_agent_core11.AGENT_TOOL_REGISTRY)),
1492
+ _ts_param10(2, (0, import_common10.Inject)(import_nestjs_agent_core11.AGENT_REGISTRY)),
1493
+ _ts_param10(3, (0, import_common10.Inject)(import_nestjs_agent_core11.AGENT_OPTIONS)),
1494
+ _ts_metadata10("design:type", Function),
1495
+ _ts_metadata10("design:paramtypes", [
1281
1496
  typeof import_core2.DiscoveryService === "undefined" ? Object : import_core2.DiscoveryService,
1282
1497
  typeof ToolRegistry === "undefined" ? Object : ToolRegistry,
1283
1498
  typeof AgentRegistry === "undefined" ? Object : AgentRegistry,
@@ -1286,7 +1501,7 @@ AiToolDiscoveryService = _ts_decorate9([
1286
1501
  ], AiToolDiscoveryService);
1287
1502
 
1288
1503
  // src/in-process-sink.ts
1289
- var import_nestjs_agent_core11 = require("@dudousxd/nestjs-agent-core");
1504
+ var import_nestjs_agent_core12 = require("@dudousxd/nestjs-agent-core");
1290
1505
  var InProcessTokenStreamSink = class {
1291
1506
  static {
1292
1507
  __name(this, "InProcessTokenStreamSink");
@@ -1341,7 +1556,7 @@ var InProcessTokenStreamSink = class {
1341
1556
  }
1342
1557
  if (buf.ended) {
1343
1558
  if (buf.failure !== void 0) {
1344
- throw new import_nestjs_agent_core11.AgentStreamError(buf.failure);
1559
+ throw new import_nestjs_agent_core12.AgentStreamError(buf.failure);
1345
1560
  }
1346
1561
  return;
1347
1562
  }
@@ -1377,32 +1592,32 @@ var LedgerQuotaStore = class {
1377
1592
  };
1378
1593
 
1379
1594
  // src/runner/inline-agent-runner.ts
1380
- var import_nestjs_agent_core12 = require("@dudousxd/nestjs-agent-core");
1381
- var import_common10 = require("@nestjs/common");
1382
- function _ts_decorate10(decorators, target, key, desc) {
1595
+ var import_nestjs_agent_core13 = require("@dudousxd/nestjs-agent-core");
1596
+ var import_common11 = require("@nestjs/common");
1597
+ function _ts_decorate11(decorators, target, key, desc) {
1383
1598
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1384
1599
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1385
1600
  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;
1386
1601
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1387
1602
  }
1388
- __name(_ts_decorate10, "_ts_decorate");
1389
- function _ts_metadata10(k, v) {
1603
+ __name(_ts_decorate11, "_ts_decorate");
1604
+ function _ts_metadata11(k, v) {
1390
1605
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1391
1606
  }
1392
- __name(_ts_metadata10, "_ts_metadata");
1393
- function _ts_param10(paramIndex, decorator) {
1607
+ __name(_ts_metadata11, "_ts_metadata");
1608
+ function _ts_param11(paramIndex, decorator) {
1394
1609
  return function(target, key) {
1395
1610
  decorator(target, key, paramIndex);
1396
1611
  };
1397
1612
  }
1398
- __name(_ts_param10, "_ts_param");
1613
+ __name(_ts_param11, "_ts_param");
1399
1614
  var InlineAgentRunner = class _InlineAgentRunner {
1400
1615
  static {
1401
1616
  __name(this, "InlineAgentRunner");
1402
1617
  }
1403
1618
  factory;
1404
1619
  store;
1405
- logger = new import_common10.Logger(_InlineAgentRunner.name);
1620
+ logger = new import_common11.Logger(_InlineAgentRunner.name);
1406
1621
  pending = /* @__PURE__ */ new Map();
1407
1622
  constructor(factory, store) {
1408
1623
  this.factory = factory;
@@ -1413,18 +1628,19 @@ var InlineAgentRunner = class _InlineAgentRunner {
1413
1628
  const day = input.day ?? utcDay();
1414
1629
  const deps = this.factory.forAgent(input.agentName);
1415
1630
  const hooks = this.topLevelHooks(runId, deps, input.actor, day);
1416
- void (0, import_nestjs_agent_core12.runAgentLoop)({
1631
+ void (0, import_nestjs_agent_core13.runAgentLoop)({
1417
1632
  ...deps,
1418
1633
  day
1419
- }, input, hooks).catch(async (error) => {
1634
+ }, input, hooks).then(() => this.store.setActiveStream(input.threadId, null)).catch(async (error) => {
1420
1635
  const message = error instanceof Error ? error.message : String(error);
1421
- const code = error instanceof import_nestjs_agent_core12.QuotaExceededError ? "quota_exceeded" : "run_failed";
1636
+ const code = error instanceof import_nestjs_agent_core13.QuotaExceededError ? "quota_exceeded" : "run_failed";
1422
1637
  this.logger.error(`agent run ${runId} failed (${code}): ${message}`);
1423
- (0, import_nestjs_agent_core12.publishAgentRunFailed)({
1638
+ (0, import_nestjs_agent_core13.publishAgentRunFailed)({
1424
1639
  runId,
1425
1640
  code,
1426
1641
  message
1427
1642
  });
1643
+ await this.store.setActiveStream(input.threadId, null);
1428
1644
  const writer = await deps.sink.open(runId);
1429
1645
  await writer.fail({
1430
1646
  code,
@@ -1482,98 +1698,102 @@ var InlineAgentRunner = class _InlineAgentRunner {
1482
1698
  step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
1483
1699
  runAgent: /* @__PURE__ */ __name((childName, childTask) => this.runNested(childName, childTask, actor, day, depth + 1, sinkRunId), "runAgent")
1484
1700
  };
1485
- return (0, import_nestjs_agent_core12.runAgentLoop)({
1486
- ...deps,
1487
- day
1488
- }, {
1489
- threadId: subThread.id,
1490
- actor,
1491
- userText: task,
1492
- agentName,
1493
- day,
1494
- delegationDepth: depth,
1495
- sinkRunId
1496
- }, hooks);
1701
+ try {
1702
+ return await (0, import_nestjs_agent_core13.runAgentLoop)({
1703
+ ...deps,
1704
+ day
1705
+ }, {
1706
+ threadId: subThread.id,
1707
+ actor,
1708
+ userText: task,
1709
+ agentName,
1710
+ day,
1711
+ delegationDepth: depth,
1712
+ sinkRunId
1713
+ }, hooks);
1714
+ } finally {
1715
+ await this.store.setActiveStream(subThread.id, null);
1716
+ }
1497
1717
  }
1498
1718
  };
1499
- InlineAgentRunner = _ts_decorate10([
1500
- (0, import_common10.Injectable)(),
1501
- _ts_param10(0, (0, import_common10.Inject)(import_nestjs_agent_core12.AGENT_DEPS_FACTORY)),
1502
- _ts_param10(1, (0, import_common10.Inject)(import_nestjs_agent_core12.AGENT_STORE)),
1503
- _ts_metadata10("design:type", Function),
1504
- _ts_metadata10("design:paramtypes", [
1719
+ InlineAgentRunner = _ts_decorate11([
1720
+ (0, import_common11.Injectable)(),
1721
+ _ts_param11(0, (0, import_common11.Inject)(import_nestjs_agent_core13.AGENT_DEPS_FACTORY)),
1722
+ _ts_param11(1, (0, import_common11.Inject)(import_nestjs_agent_core13.AGENT_STORE)),
1723
+ _ts_metadata11("design:type", Function),
1724
+ _ts_metadata11("design:paramtypes", [
1505
1725
  typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
1506
1726
  typeof AgentStore === "undefined" ? Object : AgentStore
1507
1727
  ])
1508
1728
  ], InlineAgentRunner);
1509
1729
 
1510
1730
  // src/agent.module.ts
1511
- function _ts_decorate11(decorators, target, key, desc) {
1731
+ function _ts_decorate12(decorators, target, key, desc) {
1512
1732
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1513
1733
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1514
1734
  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;
1515
1735
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1516
1736
  }
1517
- __name(_ts_decorate11, "_ts_decorate");
1737
+ __name(_ts_decorate12, "_ts_decorate");
1518
1738
  var DEFAULT_PATH = "agent";
1519
1739
  function sharedProviders(durable, includeStore) {
1520
1740
  const providers = [
1521
1741
  {
1522
- provide: import_nestjs_agent_core13.AGENT_TOOL_REGISTRY,
1523
- useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core13.ToolRegistry(), "useFactory")
1742
+ provide: import_nestjs_agent_core14.AGENT_TOOL_REGISTRY,
1743
+ useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core14.ToolRegistry(), "useFactory")
1524
1744
  },
1525
1745
  // Starts empty; AgentDiscoveryService populates it from `@Agent`-decorated providers at boot.
1526
1746
  {
1527
- provide: import_nestjs_agent_core13.AGENT_REGISTRY,
1528
- useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core13.AgentRegistry(), "useFactory")
1747
+ provide: import_nestjs_agent_core14.AGENT_REGISTRY,
1748
+ useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core14.AgentRegistry(), "useFactory")
1529
1749
  },
1530
1750
  // A shared, mutable list AgentDiscoveryService fills with `@SystemPromptContributor()` methods.
1531
1751
  {
1532
- provide: import_nestjs_agent_core13.AGENT_PROMPT_CONTRIBUTORS,
1752
+ provide: import_nestjs_agent_core14.AGENT_PROMPT_CONTRIBUTORS,
1533
1753
  useFactory: /* @__PURE__ */ __name(() => [], "useFactory")
1534
1754
  },
1535
1755
  {
1536
- provide: import_nestjs_agent_core13.AGENT_SINK,
1756
+ provide: import_nestjs_agent_core14.AGENT_SINK,
1537
1757
  useFactory: /* @__PURE__ */ __name((options) => options.sink ?? new InProcessTokenStreamSink(), "useFactory"),
1538
1758
  inject: [
1539
- import_nestjs_agent_core13.AGENT_OPTIONS
1759
+ import_nestjs_agent_core14.AGENT_OPTIONS
1540
1760
  ]
1541
1761
  },
1542
1762
  {
1543
- provide: import_nestjs_agent_core13.AGENT_ROLES_POLICY,
1544
- useFactory: /* @__PURE__ */ __name((options) => options.rolesPolicy ?? new import_nestjs_agent_core13.DefaultRolesPolicy(options.defaultRoles), "useFactory"),
1763
+ provide: import_nestjs_agent_core14.AGENT_ROLES_POLICY,
1764
+ useFactory: /* @__PURE__ */ __name((options) => options.rolesPolicy ?? new import_nestjs_agent_core14.DefaultRolesPolicy(options.defaultRoles), "useFactory"),
1545
1765
  inject: [
1546
- import_nestjs_agent_core13.AGENT_OPTIONS
1766
+ import_nestjs_agent_core14.AGENT_OPTIONS
1547
1767
  ]
1548
1768
  },
1549
1769
  {
1550
- provide: import_nestjs_agent_core13.AGENT_ACTOR_RESOLVER,
1770
+ provide: import_nestjs_agent_core14.AGENT_ACTOR_RESOLVER,
1551
1771
  useFactory: /* @__PURE__ */ __name((options) => options.actorResolver, "useFactory"),
1552
1772
  inject: [
1553
- import_nestjs_agent_core13.AGENT_OPTIONS
1773
+ import_nestjs_agent_core14.AGENT_OPTIONS
1554
1774
  ]
1555
1775
  },
1556
1776
  {
1557
- provide: import_nestjs_agent_core13.AGENT_MODEL,
1777
+ provide: import_nestjs_agent_core14.AGENT_MODEL,
1558
1778
  useFactory: /* @__PURE__ */ __name((o) => o.model, "useFactory"),
1559
1779
  inject: [
1560
- import_nestjs_agent_core13.AGENT_OPTIONS
1780
+ import_nestjs_agent_core14.AGENT_OPTIONS
1561
1781
  ]
1562
1782
  },
1563
1783
  {
1564
1784
  // An explicit `quota` wins; otherwise `quotaLimitTokens` binds the built-in ledger-backed
1565
1785
  // store; otherwise quotas are off (undefined). The ledger store reads the same usage rows
1566
1786
  // the loop already writes, so enforcement needs no extra shared state across replicas.
1567
- provide: import_nestjs_agent_core13.AGENT_QUOTA_STORE,
1787
+ provide: import_nestjs_agent_core14.AGENT_QUOTA_STORE,
1568
1788
  useFactory: /* @__PURE__ */ __name((o, store) => o.quota ?? (o.quotaLimitTokens !== void 0 ? new LedgerQuotaStore(store, o.quotaLimitTokens) : void 0), "useFactory"),
1569
1789
  inject: [
1570
- import_nestjs_agent_core13.AGENT_OPTIONS,
1571
- import_nestjs_agent_core13.AGENT_STORE
1790
+ import_nestjs_agent_core14.AGENT_OPTIONS,
1791
+ import_nestjs_agent_core14.AGENT_STORE
1572
1792
  ]
1573
1793
  },
1574
1794
  AgentDepsFactory2,
1575
1795
  {
1576
- provide: import_nestjs_agent_core13.AGENT_DEPS_FACTORY,
1796
+ provide: import_nestjs_agent_core14.AGENT_DEPS_FACTORY,
1577
1797
  useExisting: AgentDepsFactory2
1578
1798
  },
1579
1799
  // Populates the registry + contributors (onModuleInit) BEFORE AiToolDiscoveryService synthesizes
@@ -1585,16 +1805,16 @@ function sharedProviders(durable, includeStore) {
1585
1805
  ];
1586
1806
  if (includeStore) {
1587
1807
  providers.push({
1588
- provide: import_nestjs_agent_core13.AGENT_STORE,
1808
+ provide: import_nestjs_agent_core14.AGENT_STORE,
1589
1809
  useFactory: /* @__PURE__ */ __name((o) => o.store, "useFactory"),
1590
1810
  inject: [
1591
- import_nestjs_agent_core13.AGENT_OPTIONS
1811
+ import_nestjs_agent_core14.AGENT_OPTIONS
1592
1812
  ]
1593
1813
  });
1594
1814
  }
1595
1815
  if (durable) {
1596
1816
  providers.push({
1597
- provide: import_nestjs_agent_core13.AGENT_RUNNER,
1817
+ provide: import_nestjs_agent_core14.AGENT_RUNNER,
1598
1818
  useFactory: /* @__PURE__ */ __name((durableRunner) => {
1599
1819
  if (durableRunner === void 0) {
1600
1820
  throw new Error("AgentModule.forRoot({ durable: true }) requires importing AgentDurableModule from '@dudousxd/nestjs-agent/durable' (alongside a configured DurableModule). It was not found.");
@@ -1603,14 +1823,14 @@ function sharedProviders(durable, includeStore) {
1603
1823
  }, "useFactory"),
1604
1824
  inject: [
1605
1825
  {
1606
- token: import_nestjs_agent_core13.AGENT_DURABLE_RUNNER,
1826
+ token: import_nestjs_agent_core14.AGENT_DURABLE_RUNNER,
1607
1827
  optional: true
1608
1828
  }
1609
1829
  ]
1610
1830
  });
1611
1831
  } else {
1612
1832
  providers.push({
1613
- provide: import_nestjs_agent_core13.AGENT_RUNNER,
1833
+ provide: import_nestjs_agent_core14.AGENT_RUNNER,
1614
1834
  useExisting: InlineAgentRunner
1615
1835
  });
1616
1836
  }
@@ -1619,32 +1839,57 @@ function sharedProviders(durable, includeStore) {
1619
1839
  __name(sharedProviders, "sharedProviders");
1620
1840
  function exportsFor(includeStore) {
1621
1841
  return [
1622
- import_nestjs_agent_core13.AGENT_OPTIONS,
1623
- import_nestjs_agent_core13.AGENT_TOOL_REGISTRY,
1624
- import_nestjs_agent_core13.AGENT_REGISTRY,
1625
- import_nestjs_agent_core13.AGENT_SINK,
1626
- import_nestjs_agent_core13.AGENT_ROLES_POLICY,
1627
- import_nestjs_agent_core13.AGENT_ACTOR_RESOLVER,
1628
- import_nestjs_agent_core13.AGENT_MODEL,
1842
+ import_nestjs_agent_core14.AGENT_OPTIONS,
1843
+ import_nestjs_agent_core14.AGENT_TOOL_REGISTRY,
1844
+ import_nestjs_agent_core14.AGENT_REGISTRY,
1845
+ import_nestjs_agent_core14.AGENT_SINK,
1846
+ import_nestjs_agent_core14.AGENT_ROLES_POLICY,
1847
+ import_nestjs_agent_core14.AGENT_ACTOR_RESOLVER,
1848
+ import_nestjs_agent_core14.AGENT_MODEL,
1629
1849
  ...includeStore ? [
1630
- import_nestjs_agent_core13.AGENT_STORE
1850
+ import_nestjs_agent_core14.AGENT_STORE
1631
1851
  ] : [],
1632
- import_nestjs_agent_core13.AGENT_QUOTA_STORE,
1633
- import_nestjs_agent_core13.AGENT_PROMPT_CONTRIBUTORS,
1634
- import_nestjs_agent_core13.AGENT_DEPS_FACTORY,
1852
+ import_nestjs_agent_core14.AGENT_QUOTA_STORE,
1853
+ import_nestjs_agent_core14.AGENT_PROMPT_CONTRIBUTORS,
1854
+ import_nestjs_agent_core14.AGENT_DEPS_FACTORY,
1635
1855
  AgentDepsFactory2,
1636
1856
  AgentService,
1637
1857
  InlineAgentRunner
1638
1858
  ];
1639
1859
  }
1640
1860
  __name(exportsFor, "exportsFor");
1641
- var CONTROLLERS = [
1861
+ var BASE_CONTROLLERS = [
1642
1862
  ChatController,
1643
1863
  ThreadsController,
1644
1864
  ToolCallController,
1645
1865
  QuotaController,
1646
1866
  AgentsController
1647
1867
  ];
1868
+ var GUARDABLE_CONTROLLERS = [
1869
+ ...BASE_CONTROLLERS,
1870
+ AttachmentsController
1871
+ ];
1872
+ function controllersFor(mountAttachments) {
1873
+ return mountAttachments ? [
1874
+ ...BASE_CONTROLLERS,
1875
+ AttachmentsController
1876
+ ] : BASE_CONTROLLERS;
1877
+ }
1878
+ __name(controllersFor, "controllersFor");
1879
+ var GUARDS_METADATA = "__guards__";
1880
+ function applyGuards(guards) {
1881
+ const resolved = guards ?? [];
1882
+ for (const controller of GUARDABLE_CONTROLLERS) {
1883
+ Reflect.defineMetadata(GUARDS_METADATA, resolved, controller);
1884
+ }
1885
+ }
1886
+ __name(applyGuards, "applyGuards");
1887
+ function guardProviders(guards) {
1888
+ return [
1889
+ ...new Set(guards ?? [])
1890
+ ];
1891
+ }
1892
+ __name(guardProviders, "guardProviders");
1648
1893
  function routerFor(path) {
1649
1894
  return import_core3.RouterModule.register([
1650
1895
  {
@@ -1661,6 +1906,7 @@ var AgentModule = class _AgentModule {
1661
1906
  static forRoot(options) {
1662
1907
  const path = options.path ?? DEFAULT_PATH;
1663
1908
  const includeStore = options.store !== void 0;
1909
+ applyGuards(options.guards);
1664
1910
  return {
1665
1911
  module: _AgentModule,
1666
1912
  global: true,
@@ -1668,19 +1914,22 @@ var AgentModule = class _AgentModule {
1668
1914
  import_core3.DiscoveryModule,
1669
1915
  routerFor(path)
1670
1916
  ],
1671
- controllers: CONTROLLERS,
1917
+ controllers: controllersFor(options.attachments?.upload === true),
1672
1918
  providers: [
1673
1919
  {
1674
- provide: import_nestjs_agent_core13.AGENT_OPTIONS,
1920
+ provide: import_nestjs_agent_core14.AGENT_OPTIONS,
1675
1921
  useValue: options
1676
1922
  },
1677
- ...sharedProviders(options.durable ?? false, includeStore)
1923
+ ...sharedProviders(options.durable ?? false, includeStore),
1924
+ ...guardProviders(options.guards)
1678
1925
  ],
1679
1926
  exports: exportsFor(includeStore)
1680
1927
  };
1681
1928
  }
1682
1929
  static forRootAsync(options) {
1683
1930
  const path = options.path ?? DEFAULT_PATH;
1931
+ const includeStore = options.externalStore !== true;
1932
+ applyGuards(options.guards);
1684
1933
  return {
1685
1934
  module: _AgentModule,
1686
1935
  global: true,
@@ -1689,24 +1938,23 @@ var AgentModule = class _AgentModule {
1689
1938
  routerFor(path),
1690
1939
  ...options.imports ?? []
1691
1940
  ],
1692
- controllers: CONTROLLERS,
1941
+ controllers: controllersFor(options.attachmentsUpload === true),
1693
1942
  providers: [
1694
1943
  {
1695
- provide: import_nestjs_agent_core13.AGENT_OPTIONS,
1944
+ provide: import_nestjs_agent_core14.AGENT_OPTIONS,
1696
1945
  useFactory: options.useFactory,
1697
1946
  inject: options.inject ?? []
1698
1947
  },
1699
- // The async factory resolves too late to inspect `store`, so we always bind AGENT_STORE here
1700
- // (its factory reads the resolved options). Omit-and-import-a-store-module is a `forRoot` path.
1701
- ...sharedProviders(options.durable ?? false, true)
1948
+ ...sharedProviders(options.durable ?? false, includeStore),
1949
+ ...guardProviders(options.guards)
1702
1950
  ],
1703
- exports: exportsFor(true)
1951
+ exports: exportsFor(includeStore)
1704
1952
  };
1705
1953
  }
1706
1954
  };
1707
- AgentModule = _ts_decorate11([
1708
- (0, import_common11.Global)(),
1709
- (0, import_common11.Module)({})
1955
+ AgentModule = _ts_decorate12([
1956
+ (0, import_common12.Global)(),
1957
+ (0, import_common12.Module)({})
1710
1958
  ], AgentModule);
1711
1959
 
1712
1960
  // src/resolver/header-actor-resolver.ts
@@ -1753,6 +2001,9 @@ __reExport(index_exports, require("@dudousxd/nestjs-agent-core"), module.exports
1753
2001
  AgentService,
1754
2002
  AiTool,
1755
2003
  AiToolDiscoveryService,
2004
+ AttachmentsController,
2005
+ DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES,
2006
+ DEFAULT_MAX_ATTACHMENT_BYTES,
1756
2007
  HeaderActorResolver,
1757
2008
  InProcessTokenStreamSink,
1758
2009
  InlineAgentRunner,