@dudousxd/nestjs-agent 1.4.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,7 @@ function childSinkWriter(writer) {
24
24
  __name(childSinkWriter, "childSinkWriter");
25
25
 
26
26
  // src/durable/agent-run.steps.ts
27
- import { AGENT_DEPS_FACTORY, createFrameBuffer, invokeWithTransientRetry, observeTurnFrames, publishAgentToolRetry, stampToolKinds, traceLlmTurn, traceToolExecution, withAskTool, withMemoryTool, withSkillTool, withToolTimeout, withTurnFrames } from "@dudousxd/nestjs-agent-core";
27
+ import { AGENT_DEPS_FACTORY, createFrameBuffer, createUiCollector, encodeStreamEvent, invokeWithTransientRetry, observeTurnFrames, publishAgentToolRetry, stampToolKinds, traceLlmTurn, traceToolExecution, withAskTool, withMemoryTool, withSkillTool, withToolTimeout, withTurnFrames, wrapToolStepOutput } from "@dudousxd/nestjs-agent-core";
28
28
  import { Step } from "@dudousxd/nestjs-durable";
29
29
  import { Inject, Injectable } from "@nestjs/common";
30
30
  function _ts_decorate(decorators, target, key, desc) {
@@ -115,8 +115,15 @@ var AgentRunSteps = class {
115
115
  if (deps.registry.spec(input.toolName)?.kind === "action" && input.toolType !== "action") {
116
116
  throw new Error(`tool "${input.toolName}" is an action tool but was dispatched without approval: the dispatching process resolved its kind against a registry that does not have it`);
117
117
  }
118
+ const sinkRunId = input.sinkRunId;
119
+ let opened;
120
+ const ui = createUiCollector(input.toolCallId, sinkRunId === void 0 ? void 0 : async (event) => {
121
+ opened ??= Promise.resolve(deps.sink.open(sinkRunId)).then((writer) => input.childSink === true ? childSinkWriter(writer) : writer);
122
+ await (await opened).write(encodeStreamEvent(event));
123
+ });
118
124
  const ctx = {
119
- ...input.ctx
125
+ ...input.ctx,
126
+ emitUi: ui.emit
120
127
  };
121
128
  const localClassify = deps.toolTransientRetry !== false ? deps.toolTransientRetry?.classify : void 0;
122
129
  const transientRetry = input.transientRetry === false ? false : {
@@ -126,11 +133,12 @@ var AgentRunSteps = class {
126
133
  classify: localClassify
127
134
  } : {}
128
135
  };
129
- return traceToolExecution(input.ctx.runId, {
136
+ const output = await traceToolExecution(input.ctx.runId, {
130
137
  toolCallId: input.toolCallId,
131
138
  toolName: input.toolName,
132
139
  toolType: input.toolType
133
140
  }, () => invokeWithTransientRetry(() => {
141
+ ui.restart();
134
142
  const invocation = deps.registry.invoke(input.toolName, input.input, ctx, deps.rolesPolicy);
135
143
  return input.timeoutMs !== void 0 ? withToolTimeout(invocation, input.timeoutMs, input.toolName) : invocation;
136
144
  }, transientRetry, {
@@ -143,6 +151,7 @@ var AgentRunSteps = class {
143
151
  });
144
152
  }, "onRetry")
145
153
  }));
154
+ return input.collectUi === true ? wrapToolStepOutput(output, ui.components()) : output;
146
155
  }
147
156
  };
148
157
  _ts_decorate([
@@ -386,7 +395,10 @@ var AgentRunWorkflow = class _AgentRunWorkflow {
386
395
  dispatchTool: /* @__PURE__ */ __name((call, envelope) => ctx.step(AgentRunSteps.prototype.tool, {
387
396
  ...envelope,
388
397
  toolCallId: call.id,
389
- toolType: call.kind === "action" ? "action" : "read"
398
+ toolType: call.kind === "action" ? "action" : "read",
399
+ // Where `ctx.emitUi` streams from the worker — the llm step's routing.
400
+ sinkRunId,
401
+ childSink: input.sinkRunId !== void 0
390
402
  }), "dispatchTool")
391
403
  } : {}
392
404
  };
@@ -471,7 +483,7 @@ __name(isSignalTimeout, "isSignalTimeout");
471
483
 
472
484
  // src/durable/durable-agent-runner.ts
473
485
  import { randomUUID } from "crypto";
474
- import { AGENT_SINK, AGENT_STORE as AGENT_STORE2, encodeStreamEvent } from "@dudousxd/nestjs-agent-core";
486
+ import { AGENT_SINK, AGENT_STORE as AGENT_STORE2, encodeStreamEvent as encodeStreamEvent2 } from "@dudousxd/nestjs-agent-core";
475
487
  import { RUN_GATEWAY as RUN_GATEWAY2, WorkflowService } from "@dudousxd/nestjs-durable";
476
488
  import { isWorkflowControlFlowSignal as isWorkflowControlFlowSignal2 } from "@dudousxd/nestjs-durable-core";
477
489
  import { Inject as Inject3, Injectable as Injectable3, Logger } from "@nestjs/common";
@@ -650,7 +662,7 @@ var DurableAgentRunner = class _DurableAgentRunner {
650
662
  await this.store.setActiveStream(threadId, null);
651
663
  }
652
664
  const writer = await this.sink.open(runId);
653
- await writer.write(encodeStreamEvent({
665
+ await writer.write(encodeStreamEvent2({
654
666
  kind: "cancelled"
655
667
  }));
656
668
  await writer.end();
@@ -778,7 +790,7 @@ AgentDurableModule = _ts_decorate4([
778
790
  ], AgentDurableModule);
779
791
 
780
792
  // src/agent.module.ts
781
- import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER9, AGENT_APPROVAL_PORT, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY7, AGENT_DURABLE_RUNNER as AGENT_DURABLE_RUNNER2, AGENT_MEMORY as AGENT_MEMORY3, AGENT_MODEL as AGENT_MODEL2, AGENT_OPTIONS as AGENT_OPTIONS4, AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS3, AGENT_QUOTA_STORE as AGENT_QUOTA_STORE3, AGENT_REGISTRY as AGENT_REGISTRY6, AGENT_ROLES_POLICY as AGENT_ROLES_POLICY2, AGENT_RUNNER as AGENT_RUNNER2, AGENT_SINK as AGENT_SINK3, AGENT_SKILLS as AGENT_SKILLS3, AGENT_SKILL_SOURCES as AGENT_SKILL_SOURCES2, AGENT_STORE as AGENT_STORE6, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY3, AgentRegistry as AgentRegistry6, DefaultRolesPolicy, ToolRegistry as ToolRegistry3 } from "@dudousxd/nestjs-agent-core";
793
+ import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER10, AGENT_APPROVAL_PORT, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY7, AGENT_DURABLE_RUNNER as AGENT_DURABLE_RUNNER2, AGENT_MEMORY as AGENT_MEMORY3, AGENT_MODEL as AGENT_MODEL2, AGENT_OPTIONS as AGENT_OPTIONS4, AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS3, AGENT_QUOTA_STORE as AGENT_QUOTA_STORE3, AGENT_REGISTRY as AGENT_REGISTRY6, AGENT_ROLES_POLICY as AGENT_ROLES_POLICY2, AGENT_RUNNER as AGENT_RUNNER2, AGENT_SINK as AGENT_SINK3, AGENT_SKILLS as AGENT_SKILLS3, AGENT_SKILL_SOURCES as AGENT_SKILL_SOURCES2, AGENT_STORE as AGENT_STORE6, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY3, AgentRegistry as AgentRegistry6, DefaultRolesPolicy, ToolRegistry as ToolRegistry3 } from "@dudousxd/nestjs-agent-core";
782
794
  import { Global as Global2, Module as Module2 } from "@nestjs/common";
783
795
  import { DiscoveryModule, RouterModule } from "@nestjs/core";
784
796
 
@@ -1381,6 +1393,40 @@ var AgentService = class {
1381
1393
  return this.store.truncateFrom(threadId, messageId);
1382
1394
  }
1383
1395
  /**
1396
+ * Rate a message in one of `actor`'s threads: `'up'`/`'down'` with an optional comment, or `null`
1397
+ * to clear the rating. Answers `404` for an unknown message, `403` for another actor's, and `501`
1398
+ * on a store without `threadOfMessage` + `setMessageFeedback`.
1399
+ */
1400
+ async setMessageFeedback(actor, messageId, input) {
1401
+ if (input.value !== null && input.value !== "up" && input.value !== "down") {
1402
+ throw new BadRequestException("value must be 'up', 'down' or null");
1403
+ }
1404
+ if (input.comment !== void 0 && typeof input.comment !== "string") {
1405
+ throw new BadRequestException("comment must be a string");
1406
+ }
1407
+ const comment = input.comment?.trim();
1408
+ if (comment !== void 0 && comment.length > 2e3) {
1409
+ throw new BadRequestException("comment must be at most 2000 characters");
1410
+ }
1411
+ if (this.store.threadOfMessage === void 0 || this.store.setMessageFeedback === void 0) {
1412
+ throw new NotImplementedException("Message feedback requires an AgentStore that implements threadOfMessage() and setMessageFeedback(); the bound store does not support it.");
1413
+ }
1414
+ const threadId = await this.store.threadOfMessage(messageId);
1415
+ if (threadId === null) {
1416
+ throw new NotFoundException(`message ${messageId} not found`);
1417
+ }
1418
+ await this.assertOwnsThread(actor, threadId);
1419
+ const feedback = input.value === null ? null : {
1420
+ value: input.value,
1421
+ ...comment !== void 0 && comment.length > 0 ? {
1422
+ comment
1423
+ } : {},
1424
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
1425
+ };
1426
+ await this.store.setMessageFeedback(messageId, feedback);
1427
+ return feedback;
1428
+ }
1429
+ /**
1384
1430
  * Every file this actor has staged, newest first — across threads, including uploads that were
1385
1431
  * never sent, which nothing else on this surface can see.
1386
1432
  *
@@ -1880,7 +1926,7 @@ AttachmentsController = _ts_decorate9([
1880
1926
 
1881
1927
  // src/controller/chat.controller.ts
1882
1928
  import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER2, AgentStreamError as AgentStreamError2 } from "@dudousxd/nestjs-agent-core";
1883
- import { BadRequestException as BadRequestException3, Body, Controller as Controller3, Get as Get3, Inject as Inject8, Param, Post as Post2, Req as Req2, Res } from "@nestjs/common";
1929
+ import { BadRequestException as BadRequestException3, Body, Controller as Controller3, Get as Get3, Inject as Inject8, Param, Post as Post2, Query, Req as Req2, Res } from "@nestjs/common";
1884
1930
  function _ts_decorate10(decorators, target, key, desc) {
1885
1931
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1886
1932
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
@@ -1969,9 +2015,15 @@ var ChatController = class {
1969
2015
  });
1970
2016
  await this.pipe(res, runId, this.agent.subscribe(runId), threadId);
1971
2017
  }
1972
- async stream(req, runId, res) {
2018
+ /**
2019
+ * Attach to a run's stream: every buffered frame, then live ones. `?after=<seq>` (or the SSE
2020
+ * `Last-Event-ID` header a browser `EventSource` sends on its own) skips the frames a reconnecting
2021
+ * client already has — see {@link pipe} for how frames are numbered.
2022
+ */
2023
+ async stream(req, runId, res, after) {
1973
2024
  const actor = await this.actorResolver.resolve(req);
1974
- await this.pipe(res, runId, await this.agent.subscribeAs(actor, runId));
2025
+ const cursor = parseCursor(after) ?? parseCursor(req.headers["last-event-id"]) ?? 0;
2026
+ await this.pipe(res, runId, await this.agent.subscribeAs(actor, runId), void 0, cursor);
1975
2027
  }
1976
2028
  async cancel(req, runId) {
1977
2029
  const actor = await this.actorResolver.resolve(req);
@@ -1980,7 +2032,15 @@ var ChatController = class {
1980
2032
  aborted: true
1981
2033
  };
1982
2034
  }
1983
- async pipe(res, runId, events, threadId) {
2035
+ /**
2036
+ * Every `data:` frame carries an SSE `id:` — its 1-based sequence number within the run. The
2037
+ * number is a pure function of the run's buffered stream (every sink replays a run from its first
2038
+ * chunk, in write order), so the same frame gets the same number on the POST that started the run
2039
+ * and on any later `GET …/stream`, whichever replica serves it. A reconnecting client passes the
2040
+ * last one it saw as `?after=`; frames at or below it are read off the sink but not re-sent.
2041
+ * `meta`, `done` and `error` carry no id: `meta` is re-sent on every attach, the terminals once.
2042
+ */
2043
+ async pipe(res, runId, events, threadId, after = 0) {
1984
2044
  res.setHeader("Content-Type", "text/event-stream");
1985
2045
  res.setHeader("Cache-Control", "no-cache");
1986
2046
  res.setHeader("Connection", "keep-alive");
@@ -1997,6 +2057,16 @@ data: ${JSON.stringify({
1997
2057
  `);
1998
2058
  const decoder = new TextDecoder();
1999
2059
  let buffer = "";
2060
+ let seq = 0;
2061
+ const forward = /* @__PURE__ */ __name((line) => {
2062
+ seq += 1;
2063
+ if (seq > after) {
2064
+ res.write(`id: ${seq}
2065
+ data: ${line}
2066
+
2067
+ `);
2068
+ }
2069
+ }, "forward");
2000
2070
  try {
2001
2071
  for await (const chunk of events) {
2002
2072
  buffer += decoder.decode(chunk, {
@@ -2007,17 +2077,13 @@ data: ${JSON.stringify({
2007
2077
  const line = buffer.slice(0, newline);
2008
2078
  buffer = buffer.slice(newline + 1);
2009
2079
  if (line.length > 0) {
2010
- res.write(`data: ${line}
2011
-
2012
- `);
2080
+ forward(line);
2013
2081
  }
2014
2082
  newline = buffer.indexOf("\n");
2015
2083
  }
2016
2084
  }
2017
2085
  if (buffer.length > 0) {
2018
- res.write(`data: ${buffer}
2019
-
2020
- `);
2086
+ forward(buffer);
2021
2087
  }
2022
2088
  res.write("event: done\ndata: {}\n\n");
2023
2089
  } catch (error) {
@@ -2054,11 +2120,13 @@ _ts_decorate10([
2054
2120
  _ts_param8(0, Req2()),
2055
2121
  _ts_param8(1, Param("runId")),
2056
2122
  _ts_param8(2, Res()),
2123
+ _ts_param8(3, Query("after")),
2057
2124
  _ts_metadata9("design:type", Function),
2058
2125
  _ts_metadata9("design:paramtypes", [
2059
2126
  typeof Request === "undefined" ? Object : Request,
2060
2127
  String,
2061
- typeof Response === "undefined" ? Object : Response
2128
+ typeof Response === "undefined" ? Object : Response,
2129
+ String
2062
2130
  ]),
2063
2131
  _ts_metadata9("design:returntype", Promise)
2064
2132
  ], ChatController.prototype, "stream", null);
@@ -2082,10 +2150,19 @@ ChatController = _ts_decorate10([
2082
2150
  typeof ActorResolver === "undefined" ? Object : ActorResolver
2083
2151
  ])
2084
2152
  ], ChatController);
2153
+ function parseCursor(raw) {
2154
+ const value = Array.isArray(raw) ? raw[0] : raw;
2155
+ if (typeof value !== "string" || !/^\d+$/.test(value.trim())) {
2156
+ return void 0;
2157
+ }
2158
+ const parsed = Number(value.trim());
2159
+ return Number.isSafeInteger(parsed) ? parsed : void 0;
2160
+ }
2161
+ __name(parseCursor, "parseCursor");
2085
2162
 
2086
2163
  // src/controller/memories.controller.ts
2087
2164
  import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER3, AGENT_MEMORY as AGENT_MEMORY2, memoryForgetVerdict, offerMemories } from "@dudousxd/nestjs-agent-core";
2088
- import { Controller as Controller4, Delete, ForbiddenException as ForbiddenException2, Get as Get4, Inject as Inject9, NotFoundException as NotFoundException2, Optional as Optional5, Param as Param2, Query, Req as Req3 } from "@nestjs/common";
2165
+ import { Controller as Controller4, Delete, ForbiddenException as ForbiddenException2, Get as Get4, Inject as Inject9, NotFoundException as NotFoundException2, Optional as Optional5, Param as Param2, Query as Query2, Req as Req3 } from "@nestjs/common";
2089
2166
  function _ts_decorate11(decorators, target, key, desc) {
2090
2167
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2091
2168
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
@@ -2187,7 +2264,7 @@ var MemoriesController = class {
2187
2264
  _ts_decorate11([
2188
2265
  Get4(),
2189
2266
  _ts_param9(0, Req3()),
2190
- _ts_param9(1, Query("threadId")),
2267
+ _ts_param9(1, Query2("threadId")),
2191
2268
  _ts_metadata10("design:type", Function),
2192
2269
  _ts_metadata10("design:paramtypes", [
2193
2270
  typeof Request === "undefined" ? Object : Request,
@@ -2218,9 +2295,9 @@ MemoriesController = _ts_decorate11([
2218
2295
  ])
2219
2296
  ], MemoriesController);
2220
2297
 
2221
- // src/controller/quota.controller.ts
2298
+ // src/controller/messages.controller.ts
2222
2299
  import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER4 } from "@dudousxd/nestjs-agent-core";
2223
- import { Controller as Controller5, Get as Get5, Inject as Inject10, Req as Req4 } from "@nestjs/common";
2300
+ import { Body as Body2, Controller as Controller5, HttpCode, Inject as Inject10, Param as Param3, Post as Post3, Req as Req4 } from "@nestjs/common";
2224
2301
  function _ts_decorate12(decorators, target, key, desc) {
2225
2302
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2226
2303
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
@@ -2247,9 +2324,9 @@ function _ts_param10(paramIndex, decorator) {
2247
2324
  };
2248
2325
  }
2249
2326
  __name(_ts_param10, "_ts_param");
2250
- var QuotaController = class {
2327
+ var MessagesController = class {
2251
2328
  static {
2252
- __name(this, "QuotaController");
2329
+ __name(this, "MessagesController");
2253
2330
  }
2254
2331
  agent;
2255
2332
  actorResolver;
@@ -2257,33 +2334,50 @@ var QuotaController = class {
2257
2334
  this.agent = agent;
2258
2335
  this.actorResolver = actorResolver;
2259
2336
  }
2260
- async today(req) {
2337
+ /**
2338
+ * Rate a message: `{ value: 'up' | 'down' | null, comment? }`. Answers the stored rating
2339
+ * (`{ feedback: null }` once cleared). Only the thread's owner may rate its messages.
2340
+ */
2341
+ async feedback(req, id, body) {
2261
2342
  const actor = await this.actorResolver.resolve(req);
2262
- return this.agent.quotaToday(actor.id);
2343
+ const feedback = await this.agent.setMessageFeedback(actor, id, {
2344
+ value: body?.value ?? null,
2345
+ ...body?.comment !== void 0 ? {
2346
+ comment: body.comment
2347
+ } : {}
2348
+ });
2349
+ return {
2350
+ feedback
2351
+ };
2263
2352
  }
2264
2353
  };
2265
2354
  _ts_decorate12([
2266
- Get5("today"),
2355
+ Post3(":id/feedback"),
2356
+ HttpCode(200),
2267
2357
  _ts_param10(0, Req4()),
2358
+ _ts_param10(1, Param3("id")),
2359
+ _ts_param10(2, Body2()),
2268
2360
  _ts_metadata11("design:type", Function),
2269
2361
  _ts_metadata11("design:paramtypes", [
2270
- typeof Request === "undefined" ? Object : Request
2362
+ typeof Request === "undefined" ? Object : Request,
2363
+ String,
2364
+ typeof FeedbackBody === "undefined" ? Object : FeedbackBody
2271
2365
  ]),
2272
2366
  _ts_metadata11("design:returntype", Promise)
2273
- ], QuotaController.prototype, "today", null);
2274
- QuotaController = _ts_decorate12([
2275
- Controller5("quota"),
2367
+ ], MessagesController.prototype, "feedback", null);
2368
+ MessagesController = _ts_decorate12([
2369
+ Controller5("messages"),
2276
2370
  _ts_param10(1, Inject10(AGENT_ACTOR_RESOLVER4)),
2277
2371
  _ts_metadata11("design:type", Function),
2278
2372
  _ts_metadata11("design:paramtypes", [
2279
2373
  typeof AgentService === "undefined" ? Object : AgentService,
2280
2374
  typeof ActorResolver === "undefined" ? Object : ActorResolver
2281
2375
  ])
2282
- ], QuotaController);
2376
+ ], MessagesController);
2283
2377
 
2284
- // src/controller/skills.controller.ts
2285
- import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER5, AGENT_SKILLS as AGENT_SKILLS2, offerSkills } from "@dudousxd/nestjs-agent-core";
2286
- import { Controller as Controller6, Get as Get6, Inject as Inject11, Optional as Optional6, Query as Query2, Req as Req5 } from "@nestjs/common";
2378
+ // src/controller/quota.controller.ts
2379
+ import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER5 } from "@dudousxd/nestjs-agent-core";
2380
+ import { Controller as Controller6, Get as Get5, Inject as Inject11, Req as Req5 } from "@nestjs/common";
2287
2381
  function _ts_decorate13(decorators, target, key, desc) {
2288
2382
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2289
2383
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
@@ -2310,6 +2404,69 @@ function _ts_param11(paramIndex, decorator) {
2310
2404
  };
2311
2405
  }
2312
2406
  __name(_ts_param11, "_ts_param");
2407
+ var QuotaController = class {
2408
+ static {
2409
+ __name(this, "QuotaController");
2410
+ }
2411
+ agent;
2412
+ actorResolver;
2413
+ constructor(agent, actorResolver) {
2414
+ this.agent = agent;
2415
+ this.actorResolver = actorResolver;
2416
+ }
2417
+ async today(req) {
2418
+ const actor = await this.actorResolver.resolve(req);
2419
+ return this.agent.quotaToday(actor.id);
2420
+ }
2421
+ };
2422
+ _ts_decorate13([
2423
+ Get5("today"),
2424
+ _ts_param11(0, Req5()),
2425
+ _ts_metadata12("design:type", Function),
2426
+ _ts_metadata12("design:paramtypes", [
2427
+ typeof Request === "undefined" ? Object : Request
2428
+ ]),
2429
+ _ts_metadata12("design:returntype", Promise)
2430
+ ], QuotaController.prototype, "today", null);
2431
+ QuotaController = _ts_decorate13([
2432
+ Controller6("quota"),
2433
+ _ts_param11(1, Inject11(AGENT_ACTOR_RESOLVER5)),
2434
+ _ts_metadata12("design:type", Function),
2435
+ _ts_metadata12("design:paramtypes", [
2436
+ typeof AgentService === "undefined" ? Object : AgentService,
2437
+ typeof ActorResolver === "undefined" ? Object : ActorResolver
2438
+ ])
2439
+ ], QuotaController);
2440
+
2441
+ // src/controller/skills.controller.ts
2442
+ import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER6, AGENT_SKILLS as AGENT_SKILLS2, offerSkills } from "@dudousxd/nestjs-agent-core";
2443
+ import { Controller as Controller7, Get as Get6, Inject as Inject12, Optional as Optional6, Query as Query3, Req as Req6 } from "@nestjs/common";
2444
+ function _ts_decorate14(decorators, target, key, desc) {
2445
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2446
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
2447
+ r = Reflect.decorate(decorators, target, key, desc);
2448
+ } else {
2449
+ for (var i = decorators.length - 1; i >= 0; i--) {
2450
+ if (d = decorators[i]) {
2451
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2452
+ }
2453
+ }
2454
+ }
2455
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2456
+ }
2457
+ __name(_ts_decorate14, "_ts_decorate");
2458
+ function _ts_metadata13(metadataKey, metadataValue) {
2459
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
2460
+ return Reflect.metadata(metadataKey, metadataValue);
2461
+ }
2462
+ }
2463
+ __name(_ts_metadata13, "_ts_metadata");
2464
+ function _ts_param12(paramIndex, decorator) {
2465
+ return function(target, key) {
2466
+ decorator(target, key, paramIndex);
2467
+ };
2468
+ }
2469
+ __name(_ts_param12, "_ts_param");
2313
2470
  var SkillsController = class {
2314
2471
  static {
2315
2472
  __name(this, "SkillsController");
@@ -2332,33 +2489,33 @@ var SkillsController = class {
2332
2489
  return offer.entries;
2333
2490
  }
2334
2491
  };
2335
- _ts_decorate13([
2492
+ _ts_decorate14([
2336
2493
  Get6(),
2337
- _ts_param11(0, Req5()),
2338
- _ts_param11(1, Query2("threadId")),
2339
- _ts_metadata12("design:type", Function),
2340
- _ts_metadata12("design:paramtypes", [
2494
+ _ts_param12(0, Req6()),
2495
+ _ts_param12(1, Query3("threadId")),
2496
+ _ts_metadata13("design:type", Function),
2497
+ _ts_metadata13("design:paramtypes", [
2341
2498
  typeof Request === "undefined" ? Object : Request,
2342
2499
  String
2343
2500
  ]),
2344
- _ts_metadata12("design:returntype", Promise)
2501
+ _ts_metadata13("design:returntype", Promise)
2345
2502
  ], SkillsController.prototype, "list", null);
2346
- SkillsController = _ts_decorate13([
2347
- Controller6("skills"),
2348
- _ts_param11(0, Inject11(AGENT_ACTOR_RESOLVER5)),
2349
- _ts_param11(1, Optional6()),
2350
- _ts_param11(1, Inject11(AGENT_SKILLS2)),
2351
- _ts_metadata12("design:type", Function),
2352
- _ts_metadata12("design:paramtypes", [
2503
+ SkillsController = _ts_decorate14([
2504
+ Controller7("skills"),
2505
+ _ts_param12(0, Inject12(AGENT_ACTOR_RESOLVER6)),
2506
+ _ts_param12(1, Optional6()),
2507
+ _ts_param12(1, Inject12(AGENT_SKILLS2)),
2508
+ _ts_metadata13("design:type", Function),
2509
+ _ts_metadata13("design:paramtypes", [
2353
2510
  typeof ActorResolver === "undefined" ? Object : ActorResolver,
2354
2511
  Object
2355
2512
  ])
2356
2513
  ], SkillsController);
2357
2514
 
2358
2515
  // src/controller/threads.controller.ts
2359
- import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER6 } from "@dudousxd/nestjs-agent-core";
2360
- import { Body as Body2, Controller as Controller7, Delete as Delete2, Get as Get7, Inject as Inject12, Param as Param3, Patch, Post as Post3, Req as Req6 } from "@nestjs/common";
2361
- function _ts_decorate14(decorators, target, key, desc) {
2516
+ import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER7 } from "@dudousxd/nestjs-agent-core";
2517
+ import { Body as Body3, Controller as Controller8, Delete as Delete2, Get as Get7, Inject as Inject13, Param as Param4, Patch, Post as Post4, Req as Req7 } from "@nestjs/common";
2518
+ function _ts_decorate15(decorators, target, key, desc) {
2362
2519
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2363
2520
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
2364
2521
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2371,19 +2528,19 @@ function _ts_decorate14(decorators, target, key, desc) {
2371
2528
  }
2372
2529
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2373
2530
  }
2374
- __name(_ts_decorate14, "_ts_decorate");
2375
- function _ts_metadata13(metadataKey, metadataValue) {
2531
+ __name(_ts_decorate15, "_ts_decorate");
2532
+ function _ts_metadata14(metadataKey, metadataValue) {
2376
2533
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
2377
2534
  return Reflect.metadata(metadataKey, metadataValue);
2378
2535
  }
2379
2536
  }
2380
- __name(_ts_metadata13, "_ts_metadata");
2381
- function _ts_param12(paramIndex, decorator) {
2537
+ __name(_ts_metadata14, "_ts_metadata");
2538
+ function _ts_param13(paramIndex, decorator) {
2382
2539
  return function(target, key) {
2383
2540
  decorator(target, key, paramIndex);
2384
2541
  };
2385
2542
  }
2386
- __name(_ts_param12, "_ts_param");
2543
+ __name(_ts_param13, "_ts_param");
2387
2544
  var ThreadsController = class {
2388
2545
  static {
2389
2546
  __name(this, "ThreadsController");
@@ -2447,101 +2604,101 @@ var ThreadsController = class {
2447
2604
  };
2448
2605
  }
2449
2606
  };
2450
- _ts_decorate14([
2607
+ _ts_decorate15([
2451
2608
  Get7(),
2452
- _ts_param12(0, Req6()),
2453
- _ts_metadata13("design:type", Function),
2454
- _ts_metadata13("design:paramtypes", [
2609
+ _ts_param13(0, Req7()),
2610
+ _ts_metadata14("design:type", Function),
2611
+ _ts_metadata14("design:paramtypes", [
2455
2612
  typeof Request === "undefined" ? Object : Request
2456
2613
  ]),
2457
- _ts_metadata13("design:returntype", Promise)
2614
+ _ts_metadata14("design:returntype", Promise)
2458
2615
  ], ThreadsController.prototype, "list", null);
2459
- _ts_decorate14([
2616
+ _ts_decorate15([
2460
2617
  Get7(":id"),
2461
- _ts_param12(0, Req6()),
2462
- _ts_param12(1, Param3("id")),
2463
- _ts_metadata13("design:type", Function),
2464
- _ts_metadata13("design:paramtypes", [
2618
+ _ts_param13(0, Req7()),
2619
+ _ts_param13(1, Param4("id")),
2620
+ _ts_metadata14("design:type", Function),
2621
+ _ts_metadata14("design:paramtypes", [
2465
2622
  typeof Request === "undefined" ? Object : Request,
2466
2623
  String
2467
2624
  ]),
2468
- _ts_metadata13("design:returntype", Promise)
2625
+ _ts_metadata14("design:returntype", Promise)
2469
2626
  ], ThreadsController.prototype, "detail", null);
2470
- _ts_decorate14([
2627
+ _ts_decorate15([
2471
2628
  Delete2(":id"),
2472
- _ts_param12(0, Req6()),
2473
- _ts_param12(1, Param3("id")),
2474
- _ts_metadata13("design:type", Function),
2475
- _ts_metadata13("design:paramtypes", [
2629
+ _ts_param13(0, Req7()),
2630
+ _ts_param13(1, Param4("id")),
2631
+ _ts_metadata14("design:type", Function),
2632
+ _ts_metadata14("design:paramtypes", [
2476
2633
  typeof Request === "undefined" ? Object : Request,
2477
2634
  String
2478
2635
  ]),
2479
- _ts_metadata13("design:returntype", Promise)
2636
+ _ts_metadata14("design:returntype", Promise)
2480
2637
  ], ThreadsController.prototype, "remove", null);
2481
- _ts_decorate14([
2482
- Post3(":id/fork-from/:messageId"),
2483
- _ts_param12(0, Req6()),
2484
- _ts_param12(1, Param3("id")),
2485
- _ts_param12(2, Param3("messageId")),
2486
- _ts_metadata13("design:type", Function),
2487
- _ts_metadata13("design:paramtypes", [
2638
+ _ts_decorate15([
2639
+ Post4(":id/fork-from/:messageId"),
2640
+ _ts_param13(0, Req7()),
2641
+ _ts_param13(1, Param4("id")),
2642
+ _ts_param13(2, Param4("messageId")),
2643
+ _ts_metadata14("design:type", Function),
2644
+ _ts_metadata14("design:paramtypes", [
2488
2645
  typeof Request === "undefined" ? Object : Request,
2489
2646
  String,
2490
2647
  String
2491
2648
  ]),
2492
- _ts_metadata13("design:returntype", Promise)
2649
+ _ts_metadata14("design:returntype", Promise)
2493
2650
  ], ThreadsController.prototype, "fork", null);
2494
- _ts_decorate14([
2651
+ _ts_decorate15([
2495
2652
  Patch(":id"),
2496
- _ts_param12(0, Req6()),
2497
- _ts_param12(1, Param3("id")),
2498
- _ts_param12(2, Body2()),
2499
- _ts_metadata13("design:type", Function),
2500
- _ts_metadata13("design:paramtypes", [
2653
+ _ts_param13(0, Req7()),
2654
+ _ts_param13(1, Param4("id")),
2655
+ _ts_param13(2, Body3()),
2656
+ _ts_metadata14("design:type", Function),
2657
+ _ts_metadata14("design:paramtypes", [
2501
2658
  typeof Request === "undefined" ? Object : Request,
2502
2659
  String,
2503
2660
  typeof UpdateThreadBody === "undefined" ? Object : UpdateThreadBody
2504
2661
  ]),
2505
- _ts_metadata13("design:returntype", Promise)
2662
+ _ts_metadata14("design:returntype", Promise)
2506
2663
  ], ThreadsController.prototype, "update", null);
2507
- _ts_decorate14([
2508
- Post3(":id/promote"),
2509
- _ts_param12(0, Req6()),
2510
- _ts_param12(1, Param3("id")),
2511
- _ts_metadata13("design:type", Function),
2512
- _ts_metadata13("design:paramtypes", [
2664
+ _ts_decorate15([
2665
+ Post4(":id/promote"),
2666
+ _ts_param13(0, Req7()),
2667
+ _ts_param13(1, Param4("id")),
2668
+ _ts_metadata14("design:type", Function),
2669
+ _ts_metadata14("design:paramtypes", [
2513
2670
  typeof Request === "undefined" ? Object : Request,
2514
2671
  String
2515
2672
  ]),
2516
- _ts_metadata13("design:returntype", Promise)
2673
+ _ts_metadata14("design:returntype", Promise)
2517
2674
  ], ThreadsController.prototype, "promote", null);
2518
- _ts_decorate14([
2675
+ _ts_decorate15([
2519
2676
  Delete2(":id/from/:messageId"),
2520
- _ts_param12(0, Req6()),
2521
- _ts_param12(1, Param3("id")),
2522
- _ts_param12(2, Param3("messageId")),
2523
- _ts_metadata13("design:type", Function),
2524
- _ts_metadata13("design:paramtypes", [
2677
+ _ts_param13(0, Req7()),
2678
+ _ts_param13(1, Param4("id")),
2679
+ _ts_param13(2, Param4("messageId")),
2680
+ _ts_metadata14("design:type", Function),
2681
+ _ts_metadata14("design:paramtypes", [
2525
2682
  typeof Request === "undefined" ? Object : Request,
2526
2683
  String,
2527
2684
  String
2528
2685
  ]),
2529
- _ts_metadata13("design:returntype", Promise)
2686
+ _ts_metadata14("design:returntype", Promise)
2530
2687
  ], ThreadsController.prototype, "truncateFrom", null);
2531
- ThreadsController = _ts_decorate14([
2532
- Controller7("threads"),
2533
- _ts_param12(1, Inject12(AGENT_ACTOR_RESOLVER6)),
2534
- _ts_metadata13("design:type", Function),
2535
- _ts_metadata13("design:paramtypes", [
2688
+ ThreadsController = _ts_decorate15([
2689
+ Controller8("threads"),
2690
+ _ts_param13(1, Inject13(AGENT_ACTOR_RESOLVER7)),
2691
+ _ts_metadata14("design:type", Function),
2692
+ _ts_metadata14("design:paramtypes", [
2536
2693
  typeof AgentService === "undefined" ? Object : AgentService,
2537
2694
  typeof ActorResolver === "undefined" ? Object : ActorResolver
2538
2695
  ])
2539
2696
  ], ThreadsController);
2540
2697
 
2541
2698
  // src/controller/tool-call.controller.ts
2542
- import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER7 } from "@dudousxd/nestjs-agent-core";
2543
- import { BadRequestException as BadRequestException4, Body as Body3, Controller as Controller8, Inject as Inject13, Post as Post4, Req as Req7 } from "@nestjs/common";
2544
- function _ts_decorate15(decorators, target, key, desc) {
2699
+ import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER8 } from "@dudousxd/nestjs-agent-core";
2700
+ import { BadRequestException as BadRequestException4, Body as Body4, Controller as Controller9, Inject as Inject14, Post as Post5, Req as Req8 } from "@nestjs/common";
2701
+ function _ts_decorate16(decorators, target, key, desc) {
2545
2702
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2546
2703
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
2547
2704
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2554,19 +2711,19 @@ function _ts_decorate15(decorators, target, key, desc) {
2554
2711
  }
2555
2712
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2556
2713
  }
2557
- __name(_ts_decorate15, "_ts_decorate");
2558
- function _ts_metadata14(metadataKey, metadataValue) {
2714
+ __name(_ts_decorate16, "_ts_decorate");
2715
+ function _ts_metadata15(metadataKey, metadataValue) {
2559
2716
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
2560
2717
  return Reflect.metadata(metadataKey, metadataValue);
2561
2718
  }
2562
2719
  }
2563
- __name(_ts_metadata14, "_ts_metadata");
2564
- function _ts_param13(paramIndex, decorator) {
2720
+ __name(_ts_metadata15, "_ts_metadata");
2721
+ function _ts_param14(paramIndex, decorator) {
2565
2722
  return function(target, key) {
2566
2723
  decorator(target, key, paramIndex);
2567
2724
  };
2568
2725
  }
2569
- __name(_ts_param13, "_ts_param");
2726
+ __name(_ts_param14, "_ts_param");
2570
2727
  var MAX_ANSWERED_QUESTIONS = 100;
2571
2728
  var MAX_VALUES_PER_QUESTION = 100;
2572
2729
  var MAX_ANSWER_VALUE_LENGTH = 4096;
@@ -2695,64 +2852,64 @@ var ToolCallController = class {
2695
2852
  };
2696
2853
  }
2697
2854
  };
2698
- _ts_decorate15([
2699
- Post4("approve"),
2700
- _ts_param13(0, Req7()),
2701
- _ts_param13(1, Body3()),
2702
- _ts_metadata14("design:type", Function),
2703
- _ts_metadata14("design:paramtypes", [
2855
+ _ts_decorate16([
2856
+ Post5("approve"),
2857
+ _ts_param14(0, Req8()),
2858
+ _ts_param14(1, Body4()),
2859
+ _ts_metadata15("design:type", Function),
2860
+ _ts_metadata15("design:paramtypes", [
2704
2861
  typeof Request === "undefined" ? Object : Request,
2705
2862
  typeof ApproveBody === "undefined" ? Object : ApproveBody
2706
2863
  ]),
2707
- _ts_metadata14("design:returntype", Promise)
2864
+ _ts_metadata15("design:returntype", Promise)
2708
2865
  ], ToolCallController.prototype, "approve", null);
2709
- _ts_decorate15([
2710
- Post4("reject"),
2711
- _ts_param13(0, Req7()),
2712
- _ts_param13(1, Body3()),
2713
- _ts_metadata14("design:type", Function),
2714
- _ts_metadata14("design:paramtypes", [
2866
+ _ts_decorate16([
2867
+ Post5("reject"),
2868
+ _ts_param14(0, Req8()),
2869
+ _ts_param14(1, Body4()),
2870
+ _ts_metadata15("design:type", Function),
2871
+ _ts_metadata15("design:paramtypes", [
2715
2872
  typeof Request === "undefined" ? Object : Request,
2716
2873
  typeof RejectBody === "undefined" ? Object : RejectBody
2717
2874
  ]),
2718
- _ts_metadata14("design:returntype", Promise)
2875
+ _ts_metadata15("design:returntype", Promise)
2719
2876
  ], ToolCallController.prototype, "reject", null);
2720
- _ts_decorate15([
2721
- Post4("answer"),
2722
- _ts_param13(0, Req7()),
2723
- _ts_param13(1, Body3()),
2724
- _ts_metadata14("design:type", Function),
2725
- _ts_metadata14("design:paramtypes", [
2877
+ _ts_decorate16([
2878
+ Post5("answer"),
2879
+ _ts_param14(0, Req8()),
2880
+ _ts_param14(1, Body4()),
2881
+ _ts_metadata15("design:type", Function),
2882
+ _ts_metadata15("design:paramtypes", [
2726
2883
  typeof Request === "undefined" ? Object : Request,
2727
2884
  typeof AnswerBody === "undefined" ? Object : AnswerBody
2728
2885
  ]),
2729
- _ts_metadata14("design:returntype", Promise)
2886
+ _ts_metadata15("design:returntype", Promise)
2730
2887
  ], ToolCallController.prototype, "answer", null);
2731
- _ts_decorate15([
2732
- Post4("skip"),
2733
- _ts_param13(0, Req7()),
2734
- _ts_param13(1, Body3()),
2735
- _ts_metadata14("design:type", Function),
2736
- _ts_metadata14("design:paramtypes", [
2888
+ _ts_decorate16([
2889
+ Post5("skip"),
2890
+ _ts_param14(0, Req8()),
2891
+ _ts_param14(1, Body4()),
2892
+ _ts_metadata15("design:type", Function),
2893
+ _ts_metadata15("design:paramtypes", [
2737
2894
  typeof Request === "undefined" ? Object : Request,
2738
2895
  Object
2739
2896
  ]),
2740
- _ts_metadata14("design:returntype", Promise)
2897
+ _ts_metadata15("design:returntype", Promise)
2741
2898
  ], ToolCallController.prototype, "skip", null);
2742
- ToolCallController = _ts_decorate15([
2743
- Controller8("tool-call"),
2744
- _ts_param13(1, Inject13(AGENT_ACTOR_RESOLVER7)),
2745
- _ts_metadata14("design:type", Function),
2746
- _ts_metadata14("design:paramtypes", [
2899
+ ToolCallController = _ts_decorate16([
2900
+ Controller9("tool-call"),
2901
+ _ts_param14(1, Inject14(AGENT_ACTOR_RESOLVER8)),
2902
+ _ts_metadata15("design:type", Function),
2903
+ _ts_metadata15("design:paramtypes", [
2747
2904
  typeof AgentService === "undefined" ? Object : AgentService,
2748
2905
  typeof ActorResolver === "undefined" ? Object : ActorResolver
2749
2906
  ])
2750
2907
  ], ToolCallController);
2751
2908
 
2752
2909
  // src/controller/tools.controller.ts
2753
- import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER8, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY5, AGENT_REGISTRY as AGENT_REGISTRY3, AgentRegistry as AgentRegistry4 } from "@dudousxd/nestjs-agent-core";
2754
- import { Controller as Controller9, Get as Get8, Inject as Inject14, NotFoundException as NotFoundException3, Query as Query3, Req as Req8 } from "@nestjs/common";
2755
- function _ts_decorate16(decorators, target, key, desc) {
2910
+ import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER9, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY5, AGENT_REGISTRY as AGENT_REGISTRY3, AgentRegistry as AgentRegistry4 } from "@dudousxd/nestjs-agent-core";
2911
+ import { Controller as Controller10, Get as Get8, Inject as Inject15, NotFoundException as NotFoundException3, Query as Query4, Req as Req9 } from "@nestjs/common";
2912
+ function _ts_decorate17(decorators, target, key, desc) {
2756
2913
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2757
2914
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
2758
2915
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2765,19 +2922,19 @@ function _ts_decorate16(decorators, target, key, desc) {
2765
2922
  }
2766
2923
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2767
2924
  }
2768
- __name(_ts_decorate16, "_ts_decorate");
2769
- function _ts_metadata15(metadataKey, metadataValue) {
2925
+ __name(_ts_decorate17, "_ts_decorate");
2926
+ function _ts_metadata16(metadataKey, metadataValue) {
2770
2927
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
2771
2928
  return Reflect.metadata(metadataKey, metadataValue);
2772
2929
  }
2773
2930
  }
2774
- __name(_ts_metadata15, "_ts_metadata");
2775
- function _ts_param14(paramIndex, decorator) {
2931
+ __name(_ts_metadata16, "_ts_metadata");
2932
+ function _ts_param15(paramIndex, decorator) {
2776
2933
  return function(target, key) {
2777
2934
  decorator(target, key, paramIndex);
2778
2935
  };
2779
2936
  }
2780
- __name(_ts_param14, "_ts_param");
2937
+ __name(_ts_param15, "_ts_param");
2781
2938
  var ToolsController = class {
2782
2939
  static {
2783
2940
  __name(this, "ToolsController");
@@ -2806,24 +2963,24 @@ var ToolsController = class {
2806
2963
  }));
2807
2964
  }
2808
2965
  };
2809
- _ts_decorate16([
2966
+ _ts_decorate17([
2810
2967
  Get8(),
2811
- _ts_param14(0, Req8()),
2812
- _ts_param14(1, Query3("agent")),
2813
- _ts_metadata15("design:type", Function),
2814
- _ts_metadata15("design:paramtypes", [
2968
+ _ts_param15(0, Req9()),
2969
+ _ts_param15(1, Query4("agent")),
2970
+ _ts_metadata16("design:type", Function),
2971
+ _ts_metadata16("design:paramtypes", [
2815
2972
  typeof Request === "undefined" ? Object : Request,
2816
2973
  String
2817
2974
  ]),
2818
- _ts_metadata15("design:returntype", Promise)
2975
+ _ts_metadata16("design:returntype", Promise)
2819
2976
  ], ToolsController.prototype, "list", null);
2820
- ToolsController = _ts_decorate16([
2821
- Controller9("tools"),
2822
- _ts_param14(0, Inject14(AGENT_ACTOR_RESOLVER8)),
2823
- _ts_param14(1, Inject14(AGENT_DEPS_FACTORY5)),
2824
- _ts_param14(2, Inject14(AGENT_REGISTRY3)),
2825
- _ts_metadata15("design:type", Function),
2826
- _ts_metadata15("design:paramtypes", [
2977
+ ToolsController = _ts_decorate17([
2978
+ Controller10("tools"),
2979
+ _ts_param15(0, Inject15(AGENT_ACTOR_RESOLVER9)),
2980
+ _ts_param15(1, Inject15(AGENT_DEPS_FACTORY5)),
2981
+ _ts_param15(2, Inject15(AGENT_REGISTRY3)),
2982
+ _ts_metadata16("design:type", Function),
2983
+ _ts_metadata16("design:paramtypes", [
2827
2984
  typeof ActorResolver === "undefined" ? Object : ActorResolver,
2828
2985
  typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
2829
2986
  typeof AgentRegistry4 === "undefined" ? Object : AgentRegistry4
@@ -2832,7 +2989,7 @@ ToolsController = _ts_decorate16([
2832
2989
 
2833
2990
  // src/discovery/agent-discovery.service.ts
2834
2991
  import { AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS2, AGENT_REGISTRY as AGENT_REGISTRY4, AgentRegistry as AgentRegistry5 } from "@dudousxd/nestjs-agent-core";
2835
- import { Inject as Inject15, Injectable as Injectable7, Logger as Logger2 } from "@nestjs/common";
2992
+ import { Inject as Inject16, Injectable as Injectable7, Logger as Logger2 } from "@nestjs/common";
2836
2993
  import { DiscoveryService, MetadataScanner } from "@nestjs/core";
2837
2994
 
2838
2995
  // src/decorator/agent.decorator.ts
@@ -2849,7 +3006,7 @@ var SYSTEM_PROMPT_METADATA = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:
2849
3006
  var SYSTEM_PROMPT_CONTRIBUTOR_METADATA = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:system-prompt-contributor");
2850
3007
 
2851
3008
  // src/discovery/agent-discovery.service.ts
2852
- function _ts_decorate17(decorators, target, key, desc) {
3009
+ function _ts_decorate18(decorators, target, key, desc) {
2853
3010
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2854
3011
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
2855
3012
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2862,19 +3019,19 @@ function _ts_decorate17(decorators, target, key, desc) {
2862
3019
  }
2863
3020
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2864
3021
  }
2865
- __name(_ts_decorate17, "_ts_decorate");
2866
- function _ts_metadata16(metadataKey, metadataValue) {
3022
+ __name(_ts_decorate18, "_ts_decorate");
3023
+ function _ts_metadata17(metadataKey, metadataValue) {
2867
3024
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
2868
3025
  return Reflect.metadata(metadataKey, metadataValue);
2869
3026
  }
2870
3027
  }
2871
- __name(_ts_metadata16, "_ts_metadata");
2872
- function _ts_param15(paramIndex, decorator) {
3028
+ __name(_ts_metadata17, "_ts_metadata");
3029
+ function _ts_param16(paramIndex, decorator) {
2873
3030
  return function(target, key) {
2874
3031
  decorator(target, key, paramIndex);
2875
3032
  };
2876
3033
  }
2877
- __name(_ts_param15, "_ts_param");
3034
+ __name(_ts_param16, "_ts_param");
2878
3035
  var AgentDiscoveryService = class _AgentDiscoveryService {
2879
3036
  static {
2880
3037
  __name(this, "AgentDiscoveryService");
@@ -3001,12 +3158,12 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
3001
3158
  return (ctx) => candidate.call(instance, ctx);
3002
3159
  }
3003
3160
  };
3004
- AgentDiscoveryService = _ts_decorate17([
3161
+ AgentDiscoveryService = _ts_decorate18([
3005
3162
  Injectable7(),
3006
- _ts_param15(2, Inject15(AGENT_REGISTRY4)),
3007
- _ts_param15(3, Inject15(AGENT_PROMPT_CONTRIBUTORS2)),
3008
- _ts_metadata16("design:type", Function),
3009
- _ts_metadata16("design:paramtypes", [
3163
+ _ts_param16(2, Inject16(AGENT_REGISTRY4)),
3164
+ _ts_param16(3, Inject16(AGENT_PROMPT_CONTRIBUTORS2)),
3165
+ _ts_metadata17("design:type", Function),
3166
+ _ts_metadata17("design:paramtypes", [
3010
3167
  typeof DiscoveryService === "undefined" ? Object : DiscoveryService,
3011
3168
  typeof MetadataScanner === "undefined" ? Object : MetadataScanner,
3012
3169
  typeof AgentRegistry5 === "undefined" ? Object : AgentRegistry5,
@@ -3016,7 +3173,7 @@ AgentDiscoveryService = _ts_decorate17([
3016
3173
 
3017
3174
  // src/discovery/ai-tool-discovery.service.ts
3018
3175
  import { AGENT_OPTIONS as AGENT_OPTIONS3, AGENT_REGISTRY as AGENT_REGISTRY5, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY2, normalizeDelegation as normalizeDelegation2 } from "@dudousxd/nestjs-agent-core";
3019
- import { Inject as Inject16, Injectable as Injectable8, Logger as Logger3 } from "@nestjs/common";
3176
+ import { Inject as Inject17, Injectable as Injectable8, Logger as Logger3 } from "@nestjs/common";
3020
3177
  import { DiscoveryService as DiscoveryService2 } from "@nestjs/core";
3021
3178
  import { z } from "zod";
3022
3179
 
@@ -3036,7 +3193,7 @@ function isBrandedFunctionalTool(value) {
3036
3193
  __name(isBrandedFunctionalTool, "isBrandedFunctionalTool");
3037
3194
 
3038
3195
  // src/discovery/ai-tool-discovery.service.ts
3039
- function _ts_decorate18(decorators, target, key, desc) {
3196
+ function _ts_decorate19(decorators, target, key, desc) {
3040
3197
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3041
3198
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
3042
3199
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3049,19 +3206,19 @@ function _ts_decorate18(decorators, target, key, desc) {
3049
3206
  }
3050
3207
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3051
3208
  }
3052
- __name(_ts_decorate18, "_ts_decorate");
3053
- function _ts_metadata17(metadataKey, metadataValue) {
3209
+ __name(_ts_decorate19, "_ts_decorate");
3210
+ function _ts_metadata18(metadataKey, metadataValue) {
3054
3211
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
3055
3212
  return Reflect.metadata(metadataKey, metadataValue);
3056
3213
  }
3057
3214
  }
3058
- __name(_ts_metadata17, "_ts_metadata");
3059
- function _ts_param16(paramIndex, decorator) {
3215
+ __name(_ts_metadata18, "_ts_metadata");
3216
+ function _ts_param17(paramIndex, decorator) {
3060
3217
  return function(target, key) {
3061
3218
  decorator(target, key, paramIndex);
3062
3219
  };
3063
3220
  }
3064
- __name(_ts_param16, "_ts_param");
3221
+ __name(_ts_param17, "_ts_param");
3065
3222
  var AiToolDiscoveryService = class _AiToolDiscoveryService {
3066
3223
  static {
3067
3224
  __name(this, "AiToolDiscoveryService");
@@ -3118,6 +3275,9 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
3118
3275
  } : {},
3119
3276
  ...meta.presentation !== void 0 ? {
3120
3277
  presentation: meta.presentation
3278
+ } : {},
3279
+ ...meta.terminal === true ? {
3280
+ terminal: true
3121
3281
  } : {}
3122
3282
  }, {
3123
3283
  execute: /* @__PURE__ */ __name((input, ctx) => instance.execute(input, ctx), "execute"),
@@ -3191,13 +3351,13 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
3191
3351
  return true;
3192
3352
  }
3193
3353
  };
3194
- AiToolDiscoveryService = _ts_decorate18([
3354
+ AiToolDiscoveryService = _ts_decorate19([
3195
3355
  Injectable8(),
3196
- _ts_param16(1, Inject16(AGENT_TOOL_REGISTRY2)),
3197
- _ts_param16(2, Inject16(AGENT_REGISTRY5)),
3198
- _ts_param16(3, Inject16(AGENT_OPTIONS3)),
3199
- _ts_metadata17("design:type", Function),
3200
- _ts_metadata17("design:paramtypes", [
3356
+ _ts_param17(1, Inject17(AGENT_TOOL_REGISTRY2)),
3357
+ _ts_param17(2, Inject17(AGENT_REGISTRY5)),
3358
+ _ts_param17(3, Inject17(AGENT_OPTIONS3)),
3359
+ _ts_metadata18("design:type", Function),
3360
+ _ts_metadata18("design:paramtypes", [
3201
3361
  typeof DiscoveryService2 === "undefined" ? Object : DiscoveryService2,
3202
3362
  typeof ToolRegistry === "undefined" ? Object : ToolRegistry,
3203
3363
  typeof AgentRegistry === "undefined" ? Object : AgentRegistry,
@@ -3207,7 +3367,7 @@ AiToolDiscoveryService = _ts_decorate18([
3207
3367
 
3208
3368
  // src/discovery/skill-discovery.service.ts
3209
3369
  import { AGENT_SKILL_SOURCES } from "@dudousxd/nestjs-agent-core";
3210
- import { Inject as Inject17, Injectable as Injectable9, Logger as Logger4 } from "@nestjs/common";
3370
+ import { Inject as Inject18, Injectable as Injectable9, Logger as Logger4 } from "@nestjs/common";
3211
3371
  import { DiscoveryService as DiscoveryService3 } from "@nestjs/core";
3212
3372
 
3213
3373
  // src/decorator/skill.decorator.ts
@@ -3224,7 +3384,7 @@ function skillScope(options) {
3224
3384
  __name(skillScope, "skillScope");
3225
3385
 
3226
3386
  // src/discovery/skill-discovery.service.ts
3227
- function _ts_decorate19(decorators, target, key, desc) {
3387
+ function _ts_decorate20(decorators, target, key, desc) {
3228
3388
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3229
3389
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
3230
3390
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3237,19 +3397,19 @@ function _ts_decorate19(decorators, target, key, desc) {
3237
3397
  }
3238
3398
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3239
3399
  }
3240
- __name(_ts_decorate19, "_ts_decorate");
3241
- function _ts_metadata18(metadataKey, metadataValue) {
3400
+ __name(_ts_decorate20, "_ts_decorate");
3401
+ function _ts_metadata19(metadataKey, metadataValue) {
3242
3402
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
3243
3403
  return Reflect.metadata(metadataKey, metadataValue);
3244
3404
  }
3245
3405
  }
3246
- __name(_ts_metadata18, "_ts_metadata");
3247
- function _ts_param17(paramIndex, decorator) {
3406
+ __name(_ts_metadata19, "_ts_metadata");
3407
+ function _ts_param18(paramIndex, decorator) {
3248
3408
  return function(target, key) {
3249
3409
  decorator(target, key, paramIndex);
3250
3410
  };
3251
3411
  }
3252
- __name(_ts_param17, "_ts_param");
3412
+ __name(_ts_param18, "_ts_param");
3253
3413
  var SkillDiscoveryService = class _SkillDiscoveryService {
3254
3414
  static {
3255
3415
  __name(this, "SkillDiscoveryService");
@@ -3293,11 +3453,11 @@ var SkillDiscoveryService = class _SkillDiscoveryService {
3293
3453
  return flat === void 0 ? void 0 : () => flat;
3294
3454
  }
3295
3455
  };
3296
- SkillDiscoveryService = _ts_decorate19([
3456
+ SkillDiscoveryService = _ts_decorate20([
3297
3457
  Injectable9(),
3298
- _ts_param17(1, Inject17(AGENT_SKILL_SOURCES)),
3299
- _ts_metadata18("design:type", Function),
3300
- _ts_metadata18("design:paramtypes", [
3458
+ _ts_param18(1, Inject18(AGENT_SKILL_SOURCES)),
3459
+ _ts_metadata19("design:type", Function),
3460
+ _ts_metadata19("design:paramtypes", [
3301
3461
  typeof DiscoveryService3 === "undefined" ? Object : DiscoveryService3,
3302
3462
  Array
3303
3463
  ])
@@ -3327,9 +3487,9 @@ var LedgerQuotaStore = class {
3327
3487
  };
3328
3488
 
3329
3489
  // src/runner/inline-agent-runner.ts
3330
- import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY6, AGENT_STORE as AGENT_STORE5, RunCancelledError as RunCancelledError2, agentFailureCode as agentFailureCode2, encodeStreamEvent as encodeStreamEvent2, publishAgentRunFailed as publishAgentRunFailed2, runAgentLoop as runAgentLoop2, settleAll as settleAll2, settleUnsettledDelegation as settleUnsettledDelegation2 } from "@dudousxd/nestjs-agent-core";
3331
- import { Inject as Inject18, Injectable as Injectable10, Logger as Logger5 } from "@nestjs/common";
3332
- function _ts_decorate20(decorators, target, key, desc) {
3490
+ import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY6, AGENT_STORE as AGENT_STORE5, RunCancelledError as RunCancelledError2, agentFailureCode as agentFailureCode2, encodeStreamEvent as encodeStreamEvent3, publishAgentRunFailed as publishAgentRunFailed2, runAgentLoop as runAgentLoop2, settleAll as settleAll2, settleUnsettledDelegation as settleUnsettledDelegation2 } from "@dudousxd/nestjs-agent-core";
3491
+ import { Inject as Inject19, Injectable as Injectable10, Logger as Logger5 } from "@nestjs/common";
3492
+ function _ts_decorate21(decorators, target, key, desc) {
3333
3493
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3334
3494
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
3335
3495
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3342,19 +3502,19 @@ function _ts_decorate20(decorators, target, key, desc) {
3342
3502
  }
3343
3503
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3344
3504
  }
3345
- __name(_ts_decorate20, "_ts_decorate");
3346
- function _ts_metadata19(metadataKey, metadataValue) {
3505
+ __name(_ts_decorate21, "_ts_decorate");
3506
+ function _ts_metadata20(metadataKey, metadataValue) {
3347
3507
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
3348
3508
  return Reflect.metadata(metadataKey, metadataValue);
3349
3509
  }
3350
3510
  }
3351
- __name(_ts_metadata19, "_ts_metadata");
3352
- function _ts_param18(paramIndex, decorator) {
3511
+ __name(_ts_metadata20, "_ts_metadata");
3512
+ function _ts_param19(paramIndex, decorator) {
3353
3513
  return function(target, key) {
3354
3514
  decorator(target, key, paramIndex);
3355
3515
  };
3356
3516
  }
3357
- __name(_ts_param18, "_ts_param");
3517
+ __name(_ts_param19, "_ts_param");
3358
3518
  var InlineAgentRunner = class _InlineAgentRunner {
3359
3519
  static {
3360
3520
  __name(this, "InlineAgentRunner");
@@ -3465,7 +3625,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
3465
3625
  this.logger.log(`agent run ${runId} cancelled`);
3466
3626
  await this.store.setActiveStream(threadId, null);
3467
3627
  const writer = await deps.sink.open(runId);
3468
- await writer.write(encodeStreamEvent2({
3628
+ await writer.write(encodeStreamEvent3({
3469
3629
  kind: "cancelled"
3470
3630
  }));
3471
3631
  await writer.end();
@@ -3735,12 +3895,12 @@ var InlineAgentRunner = class _InlineAgentRunner {
3735
3895
  }
3736
3896
  }
3737
3897
  };
3738
- InlineAgentRunner = _ts_decorate20([
3898
+ InlineAgentRunner = _ts_decorate21([
3739
3899
  Injectable10(),
3740
- _ts_param18(0, Inject18(AGENT_DEPS_FACTORY6)),
3741
- _ts_param18(1, Inject18(AGENT_STORE5)),
3742
- _ts_metadata19("design:type", Function),
3743
- _ts_metadata19("design:paramtypes", [
3900
+ _ts_param19(0, Inject19(AGENT_DEPS_FACTORY6)),
3901
+ _ts_param19(1, Inject19(AGENT_STORE5)),
3902
+ _ts_metadata20("design:type", Function),
3903
+ _ts_metadata20("design:paramtypes", [
3744
3904
  typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
3745
3905
  typeof AgentStore === "undefined" ? Object : AgentStore
3746
3906
  ])
@@ -3785,7 +3945,7 @@ function resolveSkillsConfig(options, declared) {
3785
3945
  __name(resolveSkillsConfig, "resolveSkillsConfig");
3786
3946
 
3787
3947
  // src/agent.module.ts
3788
- function _ts_decorate21(decorators, target, key, desc) {
3948
+ function _ts_decorate22(decorators, target, key, desc) {
3789
3949
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3790
3950
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
3791
3951
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3798,7 +3958,7 @@ function _ts_decorate21(decorators, target, key, desc) {
3798
3958
  }
3799
3959
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3800
3960
  }
3801
- __name(_ts_decorate21, "_ts_decorate");
3961
+ __name(_ts_decorate22, "_ts_decorate");
3802
3962
  var DEFAULT_PATH = "agent";
3803
3963
  function sharedProviders(durable, includeStore) {
3804
3964
  const providers = [
@@ -3857,7 +4017,7 @@ function sharedProviders(durable, includeStore) {
3857
4017
  ]
3858
4018
  },
3859
4019
  {
3860
- provide: AGENT_ACTOR_RESOLVER9,
4020
+ provide: AGENT_ACTOR_RESOLVER10,
3861
4021
  useFactory: /* @__PURE__ */ __name((options) => options.actorResolver, "useFactory"),
3862
4022
  inject: [
3863
4023
  AGENT_OPTIONS4
@@ -3942,7 +4102,7 @@ function exportsFor(includeStore) {
3942
4102
  AGENT_REGISTRY6,
3943
4103
  AGENT_SINK3,
3944
4104
  AGENT_ROLES_POLICY2,
3945
- AGENT_ACTOR_RESOLVER9,
4105
+ AGENT_ACTOR_RESOLVER10,
3946
4106
  AGENT_MODEL2,
3947
4107
  ...includeStore ? [
3948
4108
  AGENT_STORE6
@@ -3967,7 +4127,8 @@ var BASE_CONTROLLERS = [
3967
4127
  AgentsController,
3968
4128
  SkillsController,
3969
4129
  MemoriesController,
3970
- ToolsController
4130
+ ToolsController,
4131
+ MessagesController
3971
4132
  ];
3972
4133
  var GUARDABLE_CONTROLLERS = [
3973
4134
  ...BASE_CONTROLLERS,
@@ -4070,7 +4231,7 @@ var AgentModule = class _AgentModule {
4070
4231
  };
4071
4232
  }
4072
4233
  };
4073
- AgentModule = _ts_decorate21([
4234
+ AgentModule = _ts_decorate22([
4074
4235
  Global2(),
4075
4236
  Module2({})
4076
4237
  ], AgentModule);