@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.
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
4
  // src/agent.module.ts
5
- import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER9, AGENT_APPROVAL_PORT, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY5, AGENT_DURABLE_RUNNER, 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_SINK2, AGENT_SKILLS as AGENT_SKILLS3, AGENT_SKILL_SOURCES as AGENT_SKILL_SOURCES2, AGENT_STORE as AGENT_STORE4, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY3, AgentRegistry as AgentRegistry6, DefaultRolesPolicy, ToolRegistry as ToolRegistry3 } from "@dudousxd/nestjs-agent-core";
5
+ import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER10, AGENT_APPROVAL_PORT, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY5, AGENT_DURABLE_RUNNER, 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_SINK2, AGENT_SKILLS as AGENT_SKILLS3, AGENT_SKILL_SOURCES as AGENT_SKILL_SOURCES2, AGENT_STORE as AGENT_STORE4, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY3, AgentRegistry as AgentRegistry6, DefaultRolesPolicy, ToolRegistry as ToolRegistry3 } from "@dudousxd/nestjs-agent-core";
6
6
  import { Global, Module } from "@nestjs/common";
7
7
  import { DiscoveryModule, RouterModule } from "@nestjs/core";
8
8
 
@@ -623,6 +623,40 @@ var AgentService = class {
623
623
  return this.store.truncateFrom(threadId, messageId);
624
624
  }
625
625
  /**
626
+ * Rate a message in one of `actor`'s threads: `'up'`/`'down'` with an optional comment, or `null`
627
+ * to clear the rating. Answers `404` for an unknown message, `403` for another actor's, and `501`
628
+ * on a store without `threadOfMessage` + `setMessageFeedback`.
629
+ */
630
+ async setMessageFeedback(actor, messageId, input) {
631
+ if (input.value !== null && input.value !== "up" && input.value !== "down") {
632
+ throw new BadRequestException("value must be 'up', 'down' or null");
633
+ }
634
+ if (input.comment !== void 0 && typeof input.comment !== "string") {
635
+ throw new BadRequestException("comment must be a string");
636
+ }
637
+ const comment = input.comment?.trim();
638
+ if (comment !== void 0 && comment.length > 2e3) {
639
+ throw new BadRequestException("comment must be at most 2000 characters");
640
+ }
641
+ if (this.store.threadOfMessage === void 0 || this.store.setMessageFeedback === void 0) {
642
+ throw new NotImplementedException("Message feedback requires an AgentStore that implements threadOfMessage() and setMessageFeedback(); the bound store does not support it.");
643
+ }
644
+ const threadId = await this.store.threadOfMessage(messageId);
645
+ if (threadId === null) {
646
+ throw new NotFoundException(`message ${messageId} not found`);
647
+ }
648
+ await this.assertOwnsThread(actor, threadId);
649
+ const feedback = input.value === null ? null : {
650
+ value: input.value,
651
+ ...comment !== void 0 && comment.length > 0 ? {
652
+ comment
653
+ } : {},
654
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
655
+ };
656
+ await this.store.setMessageFeedback(messageId, feedback);
657
+ return feedback;
658
+ }
659
+ /**
626
660
  * Every file this actor has staged, newest first — across threads, including uploads that were
627
661
  * never sent, which nothing else on this surface can see.
628
662
  *
@@ -1122,7 +1156,7 @@ AttachmentsController = _ts_decorate5([
1122
1156
 
1123
1157
  // src/controller/chat.controller.ts
1124
1158
  import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER2, AgentStreamError } from "@dudousxd/nestjs-agent-core";
1125
- import { BadRequestException as BadRequestException3, Body, Controller as Controller3, Get as Get3, Inject as Inject5, Param, Post as Post2, Req as Req2, Res } from "@nestjs/common";
1159
+ import { BadRequestException as BadRequestException3, Body, Controller as Controller3, Get as Get3, Inject as Inject5, Param, Post as Post2, Query, Req as Req2, Res } from "@nestjs/common";
1126
1160
  function _ts_decorate6(decorators, target, key, desc) {
1127
1161
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1128
1162
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
@@ -1211,9 +1245,15 @@ var ChatController = class {
1211
1245
  });
1212
1246
  await this.pipe(res, runId, this.agent.subscribe(runId), threadId);
1213
1247
  }
1214
- async stream(req, runId, res) {
1248
+ /**
1249
+ * Attach to a run's stream: every buffered frame, then live ones. `?after=<seq>` (or the SSE
1250
+ * `Last-Event-ID` header a browser `EventSource` sends on its own) skips the frames a reconnecting
1251
+ * client already has — see {@link pipe} for how frames are numbered.
1252
+ */
1253
+ async stream(req, runId, res, after) {
1215
1254
  const actor = await this.actorResolver.resolve(req);
1216
- await this.pipe(res, runId, await this.agent.subscribeAs(actor, runId));
1255
+ const cursor = parseCursor(after) ?? parseCursor(req.headers["last-event-id"]) ?? 0;
1256
+ await this.pipe(res, runId, await this.agent.subscribeAs(actor, runId), void 0, cursor);
1217
1257
  }
1218
1258
  async cancel(req, runId) {
1219
1259
  const actor = await this.actorResolver.resolve(req);
@@ -1222,7 +1262,15 @@ var ChatController = class {
1222
1262
  aborted: true
1223
1263
  };
1224
1264
  }
1225
- async pipe(res, runId, events, threadId) {
1265
+ /**
1266
+ * Every `data:` frame carries an SSE `id:` — its 1-based sequence number within the run. The
1267
+ * number is a pure function of the run's buffered stream (every sink replays a run from its first
1268
+ * chunk, in write order), so the same frame gets the same number on the POST that started the run
1269
+ * and on any later `GET …/stream`, whichever replica serves it. A reconnecting client passes the
1270
+ * last one it saw as `?after=`; frames at or below it are read off the sink but not re-sent.
1271
+ * `meta`, `done` and `error` carry no id: `meta` is re-sent on every attach, the terminals once.
1272
+ */
1273
+ async pipe(res, runId, events, threadId, after = 0) {
1226
1274
  res.setHeader("Content-Type", "text/event-stream");
1227
1275
  res.setHeader("Cache-Control", "no-cache");
1228
1276
  res.setHeader("Connection", "keep-alive");
@@ -1239,6 +1287,16 @@ data: ${JSON.stringify({
1239
1287
  `);
1240
1288
  const decoder = new TextDecoder();
1241
1289
  let buffer = "";
1290
+ let seq = 0;
1291
+ const forward = /* @__PURE__ */ __name((line) => {
1292
+ seq += 1;
1293
+ if (seq > after) {
1294
+ res.write(`id: ${seq}
1295
+ data: ${line}
1296
+
1297
+ `);
1298
+ }
1299
+ }, "forward");
1242
1300
  try {
1243
1301
  for await (const chunk of events) {
1244
1302
  buffer += decoder.decode(chunk, {
@@ -1249,17 +1307,13 @@ data: ${JSON.stringify({
1249
1307
  const line = buffer.slice(0, newline);
1250
1308
  buffer = buffer.slice(newline + 1);
1251
1309
  if (line.length > 0) {
1252
- res.write(`data: ${line}
1253
-
1254
- `);
1310
+ forward(line);
1255
1311
  }
1256
1312
  newline = buffer.indexOf("\n");
1257
1313
  }
1258
1314
  }
1259
1315
  if (buffer.length > 0) {
1260
- res.write(`data: ${buffer}
1261
-
1262
- `);
1316
+ forward(buffer);
1263
1317
  }
1264
1318
  res.write("event: done\ndata: {}\n\n");
1265
1319
  } catch (error) {
@@ -1296,11 +1350,13 @@ _ts_decorate6([
1296
1350
  _ts_param5(0, Req2()),
1297
1351
  _ts_param5(1, Param("runId")),
1298
1352
  _ts_param5(2, Res()),
1353
+ _ts_param5(3, Query("after")),
1299
1354
  _ts_metadata6("design:type", Function),
1300
1355
  _ts_metadata6("design:paramtypes", [
1301
1356
  typeof Request === "undefined" ? Object : Request,
1302
1357
  String,
1303
- typeof Response === "undefined" ? Object : Response
1358
+ typeof Response === "undefined" ? Object : Response,
1359
+ String
1304
1360
  ]),
1305
1361
  _ts_metadata6("design:returntype", Promise)
1306
1362
  ], ChatController.prototype, "stream", null);
@@ -1324,10 +1380,19 @@ ChatController = _ts_decorate6([
1324
1380
  typeof ActorResolver === "undefined" ? Object : ActorResolver
1325
1381
  ])
1326
1382
  ], ChatController);
1383
+ function parseCursor(raw) {
1384
+ const value = Array.isArray(raw) ? raw[0] : raw;
1385
+ if (typeof value !== "string" || !/^\d+$/.test(value.trim())) {
1386
+ return void 0;
1387
+ }
1388
+ const parsed = Number(value.trim());
1389
+ return Number.isSafeInteger(parsed) ? parsed : void 0;
1390
+ }
1391
+ __name(parseCursor, "parseCursor");
1327
1392
 
1328
1393
  // src/controller/memories.controller.ts
1329
1394
  import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER3, AGENT_MEMORY as AGENT_MEMORY2, memoryForgetVerdict, offerMemories } from "@dudousxd/nestjs-agent-core";
1330
- import { Controller as Controller4, Delete, ForbiddenException as ForbiddenException2, Get as Get4, Inject as Inject6, NotFoundException as NotFoundException2, Optional as Optional4, Param as Param2, Query, Req as Req3 } from "@nestjs/common";
1395
+ import { Controller as Controller4, Delete, ForbiddenException as ForbiddenException2, Get as Get4, Inject as Inject6, NotFoundException as NotFoundException2, Optional as Optional4, Param as Param2, Query as Query2, Req as Req3 } from "@nestjs/common";
1331
1396
  function _ts_decorate7(decorators, target, key, desc) {
1332
1397
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1333
1398
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
@@ -1429,7 +1494,7 @@ var MemoriesController = class {
1429
1494
  _ts_decorate7([
1430
1495
  Get4(),
1431
1496
  _ts_param6(0, Req3()),
1432
- _ts_param6(1, Query("threadId")),
1497
+ _ts_param6(1, Query2("threadId")),
1433
1498
  _ts_metadata7("design:type", Function),
1434
1499
  _ts_metadata7("design:paramtypes", [
1435
1500
  typeof Request === "undefined" ? Object : Request,
@@ -1460,9 +1525,9 @@ MemoriesController = _ts_decorate7([
1460
1525
  ])
1461
1526
  ], MemoriesController);
1462
1527
 
1463
- // src/controller/quota.controller.ts
1528
+ // src/controller/messages.controller.ts
1464
1529
  import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER4 } from "@dudousxd/nestjs-agent-core";
1465
- import { Controller as Controller5, Get as Get5, Inject as Inject7, Req as Req4 } from "@nestjs/common";
1530
+ import { Body as Body2, Controller as Controller5, HttpCode, Inject as Inject7, Param as Param3, Post as Post3, Req as Req4 } from "@nestjs/common";
1466
1531
  function _ts_decorate8(decorators, target, key, desc) {
1467
1532
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1468
1533
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
@@ -1489,9 +1554,9 @@ function _ts_param7(paramIndex, decorator) {
1489
1554
  };
1490
1555
  }
1491
1556
  __name(_ts_param7, "_ts_param");
1492
- var QuotaController = class {
1557
+ var MessagesController = class {
1493
1558
  static {
1494
- __name(this, "QuotaController");
1559
+ __name(this, "MessagesController");
1495
1560
  }
1496
1561
  agent;
1497
1562
  actorResolver;
@@ -1499,33 +1564,50 @@ var QuotaController = class {
1499
1564
  this.agent = agent;
1500
1565
  this.actorResolver = actorResolver;
1501
1566
  }
1502
- async today(req) {
1567
+ /**
1568
+ * Rate a message: `{ value: 'up' | 'down' | null, comment? }`. Answers the stored rating
1569
+ * (`{ feedback: null }` once cleared). Only the thread's owner may rate its messages.
1570
+ */
1571
+ async feedback(req, id, body) {
1503
1572
  const actor = await this.actorResolver.resolve(req);
1504
- return this.agent.quotaToday(actor.id);
1573
+ const feedback = await this.agent.setMessageFeedback(actor, id, {
1574
+ value: body?.value ?? null,
1575
+ ...body?.comment !== void 0 ? {
1576
+ comment: body.comment
1577
+ } : {}
1578
+ });
1579
+ return {
1580
+ feedback
1581
+ };
1505
1582
  }
1506
1583
  };
1507
1584
  _ts_decorate8([
1508
- Get5("today"),
1585
+ Post3(":id/feedback"),
1586
+ HttpCode(200),
1509
1587
  _ts_param7(0, Req4()),
1588
+ _ts_param7(1, Param3("id")),
1589
+ _ts_param7(2, Body2()),
1510
1590
  _ts_metadata8("design:type", Function),
1511
1591
  _ts_metadata8("design:paramtypes", [
1512
- typeof Request === "undefined" ? Object : Request
1592
+ typeof Request === "undefined" ? Object : Request,
1593
+ String,
1594
+ typeof FeedbackBody === "undefined" ? Object : FeedbackBody
1513
1595
  ]),
1514
1596
  _ts_metadata8("design:returntype", Promise)
1515
- ], QuotaController.prototype, "today", null);
1516
- QuotaController = _ts_decorate8([
1517
- Controller5("quota"),
1597
+ ], MessagesController.prototype, "feedback", null);
1598
+ MessagesController = _ts_decorate8([
1599
+ Controller5("messages"),
1518
1600
  _ts_param7(1, Inject7(AGENT_ACTOR_RESOLVER4)),
1519
1601
  _ts_metadata8("design:type", Function),
1520
1602
  _ts_metadata8("design:paramtypes", [
1521
1603
  typeof AgentService === "undefined" ? Object : AgentService,
1522
1604
  typeof ActorResolver === "undefined" ? Object : ActorResolver
1523
1605
  ])
1524
- ], QuotaController);
1606
+ ], MessagesController);
1525
1607
 
1526
- // src/controller/skills.controller.ts
1527
- import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER5, AGENT_SKILLS as AGENT_SKILLS2, offerSkills } from "@dudousxd/nestjs-agent-core";
1528
- import { Controller as Controller6, Get as Get6, Inject as Inject8, Optional as Optional5, Query as Query2, Req as Req5 } from "@nestjs/common";
1608
+ // src/controller/quota.controller.ts
1609
+ import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER5 } from "@dudousxd/nestjs-agent-core";
1610
+ import { Controller as Controller6, Get as Get5, Inject as Inject8, Req as Req5 } from "@nestjs/common";
1529
1611
  function _ts_decorate9(decorators, target, key, desc) {
1530
1612
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1531
1613
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
@@ -1552,6 +1634,69 @@ function _ts_param8(paramIndex, decorator) {
1552
1634
  };
1553
1635
  }
1554
1636
  __name(_ts_param8, "_ts_param");
1637
+ var QuotaController = class {
1638
+ static {
1639
+ __name(this, "QuotaController");
1640
+ }
1641
+ agent;
1642
+ actorResolver;
1643
+ constructor(agent, actorResolver) {
1644
+ this.agent = agent;
1645
+ this.actorResolver = actorResolver;
1646
+ }
1647
+ async today(req) {
1648
+ const actor = await this.actorResolver.resolve(req);
1649
+ return this.agent.quotaToday(actor.id);
1650
+ }
1651
+ };
1652
+ _ts_decorate9([
1653
+ Get5("today"),
1654
+ _ts_param8(0, Req5()),
1655
+ _ts_metadata9("design:type", Function),
1656
+ _ts_metadata9("design:paramtypes", [
1657
+ typeof Request === "undefined" ? Object : Request
1658
+ ]),
1659
+ _ts_metadata9("design:returntype", Promise)
1660
+ ], QuotaController.prototype, "today", null);
1661
+ QuotaController = _ts_decorate9([
1662
+ Controller6("quota"),
1663
+ _ts_param8(1, Inject8(AGENT_ACTOR_RESOLVER5)),
1664
+ _ts_metadata9("design:type", Function),
1665
+ _ts_metadata9("design:paramtypes", [
1666
+ typeof AgentService === "undefined" ? Object : AgentService,
1667
+ typeof ActorResolver === "undefined" ? Object : ActorResolver
1668
+ ])
1669
+ ], QuotaController);
1670
+
1671
+ // src/controller/skills.controller.ts
1672
+ import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER6, AGENT_SKILLS as AGENT_SKILLS2, offerSkills } from "@dudousxd/nestjs-agent-core";
1673
+ import { Controller as Controller7, Get as Get6, Inject as Inject9, Optional as Optional5, Query as Query3, Req as Req6 } from "@nestjs/common";
1674
+ function _ts_decorate10(decorators, target, key, desc) {
1675
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1676
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1677
+ r = Reflect.decorate(decorators, target, key, desc);
1678
+ } else {
1679
+ for (var i = decorators.length - 1; i >= 0; i--) {
1680
+ if (d = decorators[i]) {
1681
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1682
+ }
1683
+ }
1684
+ }
1685
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1686
+ }
1687
+ __name(_ts_decorate10, "_ts_decorate");
1688
+ function _ts_metadata10(metadataKey, metadataValue) {
1689
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
1690
+ return Reflect.metadata(metadataKey, metadataValue);
1691
+ }
1692
+ }
1693
+ __name(_ts_metadata10, "_ts_metadata");
1694
+ function _ts_param9(paramIndex, decorator) {
1695
+ return function(target, key) {
1696
+ decorator(target, key, paramIndex);
1697
+ };
1698
+ }
1699
+ __name(_ts_param9, "_ts_param");
1555
1700
  var SkillsController = class {
1556
1701
  static {
1557
1702
  __name(this, "SkillsController");
@@ -1574,33 +1719,33 @@ var SkillsController = class {
1574
1719
  return offer.entries;
1575
1720
  }
1576
1721
  };
1577
- _ts_decorate9([
1722
+ _ts_decorate10([
1578
1723
  Get6(),
1579
- _ts_param8(0, Req5()),
1580
- _ts_param8(1, Query2("threadId")),
1581
- _ts_metadata9("design:type", Function),
1582
- _ts_metadata9("design:paramtypes", [
1724
+ _ts_param9(0, Req6()),
1725
+ _ts_param9(1, Query3("threadId")),
1726
+ _ts_metadata10("design:type", Function),
1727
+ _ts_metadata10("design:paramtypes", [
1583
1728
  typeof Request === "undefined" ? Object : Request,
1584
1729
  String
1585
1730
  ]),
1586
- _ts_metadata9("design:returntype", Promise)
1731
+ _ts_metadata10("design:returntype", Promise)
1587
1732
  ], SkillsController.prototype, "list", null);
1588
- SkillsController = _ts_decorate9([
1589
- Controller6("skills"),
1590
- _ts_param8(0, Inject8(AGENT_ACTOR_RESOLVER5)),
1591
- _ts_param8(1, Optional5()),
1592
- _ts_param8(1, Inject8(AGENT_SKILLS2)),
1593
- _ts_metadata9("design:type", Function),
1594
- _ts_metadata9("design:paramtypes", [
1733
+ SkillsController = _ts_decorate10([
1734
+ Controller7("skills"),
1735
+ _ts_param9(0, Inject9(AGENT_ACTOR_RESOLVER6)),
1736
+ _ts_param9(1, Optional5()),
1737
+ _ts_param9(1, Inject9(AGENT_SKILLS2)),
1738
+ _ts_metadata10("design:type", Function),
1739
+ _ts_metadata10("design:paramtypes", [
1595
1740
  typeof ActorResolver === "undefined" ? Object : ActorResolver,
1596
1741
  Object
1597
1742
  ])
1598
1743
  ], SkillsController);
1599
1744
 
1600
1745
  // src/controller/threads.controller.ts
1601
- import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER6 } from "@dudousxd/nestjs-agent-core";
1602
- import { Body as Body2, Controller as Controller7, Delete as Delete2, Get as Get7, Inject as Inject9, Param as Param3, Patch, Post as Post3, Req as Req6 } from "@nestjs/common";
1603
- function _ts_decorate10(decorators, target, key, desc) {
1746
+ import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER7 } from "@dudousxd/nestjs-agent-core";
1747
+ import { Body as Body3, Controller as Controller8, Delete as Delete2, Get as Get7, Inject as Inject10, Param as Param4, Patch, Post as Post4, Req as Req7 } from "@nestjs/common";
1748
+ function _ts_decorate11(decorators, target, key, desc) {
1604
1749
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1605
1750
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1606
1751
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1613,19 +1758,19 @@ function _ts_decorate10(decorators, target, key, desc) {
1613
1758
  }
1614
1759
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1615
1760
  }
1616
- __name(_ts_decorate10, "_ts_decorate");
1617
- function _ts_metadata10(metadataKey, metadataValue) {
1761
+ __name(_ts_decorate11, "_ts_decorate");
1762
+ function _ts_metadata11(metadataKey, metadataValue) {
1618
1763
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
1619
1764
  return Reflect.metadata(metadataKey, metadataValue);
1620
1765
  }
1621
1766
  }
1622
- __name(_ts_metadata10, "_ts_metadata");
1623
- function _ts_param9(paramIndex, decorator) {
1767
+ __name(_ts_metadata11, "_ts_metadata");
1768
+ function _ts_param10(paramIndex, decorator) {
1624
1769
  return function(target, key) {
1625
1770
  decorator(target, key, paramIndex);
1626
1771
  };
1627
1772
  }
1628
- __name(_ts_param9, "_ts_param");
1773
+ __name(_ts_param10, "_ts_param");
1629
1774
  var ThreadsController = class {
1630
1775
  static {
1631
1776
  __name(this, "ThreadsController");
@@ -1689,101 +1834,101 @@ var ThreadsController = class {
1689
1834
  };
1690
1835
  }
1691
1836
  };
1692
- _ts_decorate10([
1837
+ _ts_decorate11([
1693
1838
  Get7(),
1694
- _ts_param9(0, Req6()),
1695
- _ts_metadata10("design:type", Function),
1696
- _ts_metadata10("design:paramtypes", [
1839
+ _ts_param10(0, Req7()),
1840
+ _ts_metadata11("design:type", Function),
1841
+ _ts_metadata11("design:paramtypes", [
1697
1842
  typeof Request === "undefined" ? Object : Request
1698
1843
  ]),
1699
- _ts_metadata10("design:returntype", Promise)
1844
+ _ts_metadata11("design:returntype", Promise)
1700
1845
  ], ThreadsController.prototype, "list", null);
1701
- _ts_decorate10([
1846
+ _ts_decorate11([
1702
1847
  Get7(":id"),
1703
- _ts_param9(0, Req6()),
1704
- _ts_param9(1, Param3("id")),
1705
- _ts_metadata10("design:type", Function),
1706
- _ts_metadata10("design:paramtypes", [
1848
+ _ts_param10(0, Req7()),
1849
+ _ts_param10(1, Param4("id")),
1850
+ _ts_metadata11("design:type", Function),
1851
+ _ts_metadata11("design:paramtypes", [
1707
1852
  typeof Request === "undefined" ? Object : Request,
1708
1853
  String
1709
1854
  ]),
1710
- _ts_metadata10("design:returntype", Promise)
1855
+ _ts_metadata11("design:returntype", Promise)
1711
1856
  ], ThreadsController.prototype, "detail", null);
1712
- _ts_decorate10([
1857
+ _ts_decorate11([
1713
1858
  Delete2(":id"),
1714
- _ts_param9(0, Req6()),
1715
- _ts_param9(1, Param3("id")),
1716
- _ts_metadata10("design:type", Function),
1717
- _ts_metadata10("design:paramtypes", [
1859
+ _ts_param10(0, Req7()),
1860
+ _ts_param10(1, Param4("id")),
1861
+ _ts_metadata11("design:type", Function),
1862
+ _ts_metadata11("design:paramtypes", [
1718
1863
  typeof Request === "undefined" ? Object : Request,
1719
1864
  String
1720
1865
  ]),
1721
- _ts_metadata10("design:returntype", Promise)
1866
+ _ts_metadata11("design:returntype", Promise)
1722
1867
  ], ThreadsController.prototype, "remove", null);
1723
- _ts_decorate10([
1724
- Post3(":id/fork-from/:messageId"),
1725
- _ts_param9(0, Req6()),
1726
- _ts_param9(1, Param3("id")),
1727
- _ts_param9(2, Param3("messageId")),
1728
- _ts_metadata10("design:type", Function),
1729
- _ts_metadata10("design:paramtypes", [
1868
+ _ts_decorate11([
1869
+ Post4(":id/fork-from/:messageId"),
1870
+ _ts_param10(0, Req7()),
1871
+ _ts_param10(1, Param4("id")),
1872
+ _ts_param10(2, Param4("messageId")),
1873
+ _ts_metadata11("design:type", Function),
1874
+ _ts_metadata11("design:paramtypes", [
1730
1875
  typeof Request === "undefined" ? Object : Request,
1731
1876
  String,
1732
1877
  String
1733
1878
  ]),
1734
- _ts_metadata10("design:returntype", Promise)
1879
+ _ts_metadata11("design:returntype", Promise)
1735
1880
  ], ThreadsController.prototype, "fork", null);
1736
- _ts_decorate10([
1881
+ _ts_decorate11([
1737
1882
  Patch(":id"),
1738
- _ts_param9(0, Req6()),
1739
- _ts_param9(1, Param3("id")),
1740
- _ts_param9(2, Body2()),
1741
- _ts_metadata10("design:type", Function),
1742
- _ts_metadata10("design:paramtypes", [
1883
+ _ts_param10(0, Req7()),
1884
+ _ts_param10(1, Param4("id")),
1885
+ _ts_param10(2, Body3()),
1886
+ _ts_metadata11("design:type", Function),
1887
+ _ts_metadata11("design:paramtypes", [
1743
1888
  typeof Request === "undefined" ? Object : Request,
1744
1889
  String,
1745
1890
  typeof UpdateThreadBody === "undefined" ? Object : UpdateThreadBody
1746
1891
  ]),
1747
- _ts_metadata10("design:returntype", Promise)
1892
+ _ts_metadata11("design:returntype", Promise)
1748
1893
  ], ThreadsController.prototype, "update", null);
1749
- _ts_decorate10([
1750
- Post3(":id/promote"),
1751
- _ts_param9(0, Req6()),
1752
- _ts_param9(1, Param3("id")),
1753
- _ts_metadata10("design:type", Function),
1754
- _ts_metadata10("design:paramtypes", [
1894
+ _ts_decorate11([
1895
+ Post4(":id/promote"),
1896
+ _ts_param10(0, Req7()),
1897
+ _ts_param10(1, Param4("id")),
1898
+ _ts_metadata11("design:type", Function),
1899
+ _ts_metadata11("design:paramtypes", [
1755
1900
  typeof Request === "undefined" ? Object : Request,
1756
1901
  String
1757
1902
  ]),
1758
- _ts_metadata10("design:returntype", Promise)
1903
+ _ts_metadata11("design:returntype", Promise)
1759
1904
  ], ThreadsController.prototype, "promote", null);
1760
- _ts_decorate10([
1905
+ _ts_decorate11([
1761
1906
  Delete2(":id/from/:messageId"),
1762
- _ts_param9(0, Req6()),
1763
- _ts_param9(1, Param3("id")),
1764
- _ts_param9(2, Param3("messageId")),
1765
- _ts_metadata10("design:type", Function),
1766
- _ts_metadata10("design:paramtypes", [
1907
+ _ts_param10(0, Req7()),
1908
+ _ts_param10(1, Param4("id")),
1909
+ _ts_param10(2, Param4("messageId")),
1910
+ _ts_metadata11("design:type", Function),
1911
+ _ts_metadata11("design:paramtypes", [
1767
1912
  typeof Request === "undefined" ? Object : Request,
1768
1913
  String,
1769
1914
  String
1770
1915
  ]),
1771
- _ts_metadata10("design:returntype", Promise)
1916
+ _ts_metadata11("design:returntype", Promise)
1772
1917
  ], ThreadsController.prototype, "truncateFrom", null);
1773
- ThreadsController = _ts_decorate10([
1774
- Controller7("threads"),
1775
- _ts_param9(1, Inject9(AGENT_ACTOR_RESOLVER6)),
1776
- _ts_metadata10("design:type", Function),
1777
- _ts_metadata10("design:paramtypes", [
1918
+ ThreadsController = _ts_decorate11([
1919
+ Controller8("threads"),
1920
+ _ts_param10(1, Inject10(AGENT_ACTOR_RESOLVER7)),
1921
+ _ts_metadata11("design:type", Function),
1922
+ _ts_metadata11("design:paramtypes", [
1778
1923
  typeof AgentService === "undefined" ? Object : AgentService,
1779
1924
  typeof ActorResolver === "undefined" ? Object : ActorResolver
1780
1925
  ])
1781
1926
  ], ThreadsController);
1782
1927
 
1783
1928
  // src/controller/tool-call.controller.ts
1784
- import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER7 } from "@dudousxd/nestjs-agent-core";
1785
- import { BadRequestException as BadRequestException4, Body as Body3, Controller as Controller8, Inject as Inject10, Post as Post4, Req as Req7 } from "@nestjs/common";
1786
- function _ts_decorate11(decorators, target, key, desc) {
1929
+ import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER8 } from "@dudousxd/nestjs-agent-core";
1930
+ import { BadRequestException as BadRequestException4, Body as Body4, Controller as Controller9, Inject as Inject11, Post as Post5, Req as Req8 } from "@nestjs/common";
1931
+ function _ts_decorate12(decorators, target, key, desc) {
1787
1932
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1788
1933
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1789
1934
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1796,19 +1941,19 @@ function _ts_decorate11(decorators, target, key, desc) {
1796
1941
  }
1797
1942
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1798
1943
  }
1799
- __name(_ts_decorate11, "_ts_decorate");
1800
- function _ts_metadata11(metadataKey, metadataValue) {
1944
+ __name(_ts_decorate12, "_ts_decorate");
1945
+ function _ts_metadata12(metadataKey, metadataValue) {
1801
1946
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
1802
1947
  return Reflect.metadata(metadataKey, metadataValue);
1803
1948
  }
1804
1949
  }
1805
- __name(_ts_metadata11, "_ts_metadata");
1806
- function _ts_param10(paramIndex, decorator) {
1950
+ __name(_ts_metadata12, "_ts_metadata");
1951
+ function _ts_param11(paramIndex, decorator) {
1807
1952
  return function(target, key) {
1808
1953
  decorator(target, key, paramIndex);
1809
1954
  };
1810
1955
  }
1811
- __name(_ts_param10, "_ts_param");
1956
+ __name(_ts_param11, "_ts_param");
1812
1957
  var MAX_ANSWERED_QUESTIONS = 100;
1813
1958
  var MAX_VALUES_PER_QUESTION = 100;
1814
1959
  var MAX_ANSWER_VALUE_LENGTH = 4096;
@@ -1937,64 +2082,64 @@ var ToolCallController = class {
1937
2082
  };
1938
2083
  }
1939
2084
  };
1940
- _ts_decorate11([
1941
- Post4("approve"),
1942
- _ts_param10(0, Req7()),
1943
- _ts_param10(1, Body3()),
1944
- _ts_metadata11("design:type", Function),
1945
- _ts_metadata11("design:paramtypes", [
2085
+ _ts_decorate12([
2086
+ Post5("approve"),
2087
+ _ts_param11(0, Req8()),
2088
+ _ts_param11(1, Body4()),
2089
+ _ts_metadata12("design:type", Function),
2090
+ _ts_metadata12("design:paramtypes", [
1946
2091
  typeof Request === "undefined" ? Object : Request,
1947
2092
  typeof ApproveBody === "undefined" ? Object : ApproveBody
1948
2093
  ]),
1949
- _ts_metadata11("design:returntype", Promise)
2094
+ _ts_metadata12("design:returntype", Promise)
1950
2095
  ], ToolCallController.prototype, "approve", null);
1951
- _ts_decorate11([
1952
- Post4("reject"),
1953
- _ts_param10(0, Req7()),
1954
- _ts_param10(1, Body3()),
1955
- _ts_metadata11("design:type", Function),
1956
- _ts_metadata11("design:paramtypes", [
2096
+ _ts_decorate12([
2097
+ Post5("reject"),
2098
+ _ts_param11(0, Req8()),
2099
+ _ts_param11(1, Body4()),
2100
+ _ts_metadata12("design:type", Function),
2101
+ _ts_metadata12("design:paramtypes", [
1957
2102
  typeof Request === "undefined" ? Object : Request,
1958
2103
  typeof RejectBody === "undefined" ? Object : RejectBody
1959
2104
  ]),
1960
- _ts_metadata11("design:returntype", Promise)
2105
+ _ts_metadata12("design:returntype", Promise)
1961
2106
  ], ToolCallController.prototype, "reject", null);
1962
- _ts_decorate11([
1963
- Post4("answer"),
1964
- _ts_param10(0, Req7()),
1965
- _ts_param10(1, Body3()),
1966
- _ts_metadata11("design:type", Function),
1967
- _ts_metadata11("design:paramtypes", [
2107
+ _ts_decorate12([
2108
+ Post5("answer"),
2109
+ _ts_param11(0, Req8()),
2110
+ _ts_param11(1, Body4()),
2111
+ _ts_metadata12("design:type", Function),
2112
+ _ts_metadata12("design:paramtypes", [
1968
2113
  typeof Request === "undefined" ? Object : Request,
1969
2114
  typeof AnswerBody === "undefined" ? Object : AnswerBody
1970
2115
  ]),
1971
- _ts_metadata11("design:returntype", Promise)
2116
+ _ts_metadata12("design:returntype", Promise)
1972
2117
  ], ToolCallController.prototype, "answer", null);
1973
- _ts_decorate11([
1974
- Post4("skip"),
1975
- _ts_param10(0, Req7()),
1976
- _ts_param10(1, Body3()),
1977
- _ts_metadata11("design:type", Function),
1978
- _ts_metadata11("design:paramtypes", [
2118
+ _ts_decorate12([
2119
+ Post5("skip"),
2120
+ _ts_param11(0, Req8()),
2121
+ _ts_param11(1, Body4()),
2122
+ _ts_metadata12("design:type", Function),
2123
+ _ts_metadata12("design:paramtypes", [
1979
2124
  typeof Request === "undefined" ? Object : Request,
1980
2125
  Object
1981
2126
  ]),
1982
- _ts_metadata11("design:returntype", Promise)
2127
+ _ts_metadata12("design:returntype", Promise)
1983
2128
  ], ToolCallController.prototype, "skip", null);
1984
- ToolCallController = _ts_decorate11([
1985
- Controller8("tool-call"),
1986
- _ts_param10(1, Inject10(AGENT_ACTOR_RESOLVER7)),
1987
- _ts_metadata11("design:type", Function),
1988
- _ts_metadata11("design:paramtypes", [
2129
+ ToolCallController = _ts_decorate12([
2130
+ Controller9("tool-call"),
2131
+ _ts_param11(1, Inject11(AGENT_ACTOR_RESOLVER8)),
2132
+ _ts_metadata12("design:type", Function),
2133
+ _ts_metadata12("design:paramtypes", [
1989
2134
  typeof AgentService === "undefined" ? Object : AgentService,
1990
2135
  typeof ActorResolver === "undefined" ? Object : ActorResolver
1991
2136
  ])
1992
2137
  ], ToolCallController);
1993
2138
 
1994
2139
  // src/controller/tools.controller.ts
1995
- import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER8, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY3, AGENT_REGISTRY as AGENT_REGISTRY3, AgentRegistry as AgentRegistry4 } from "@dudousxd/nestjs-agent-core";
1996
- import { Controller as Controller9, Get as Get8, Inject as Inject11, NotFoundException as NotFoundException3, Query as Query3, Req as Req8 } from "@nestjs/common";
1997
- function _ts_decorate12(decorators, target, key, desc) {
2140
+ import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER9, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY3, AGENT_REGISTRY as AGENT_REGISTRY3, AgentRegistry as AgentRegistry4 } from "@dudousxd/nestjs-agent-core";
2141
+ import { Controller as Controller10, Get as Get8, Inject as Inject12, NotFoundException as NotFoundException3, Query as Query4, Req as Req9 } from "@nestjs/common";
2142
+ function _ts_decorate13(decorators, target, key, desc) {
1998
2143
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1999
2144
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
2000
2145
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2007,19 +2152,19 @@ function _ts_decorate12(decorators, target, key, desc) {
2007
2152
  }
2008
2153
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2009
2154
  }
2010
- __name(_ts_decorate12, "_ts_decorate");
2011
- function _ts_metadata12(metadataKey, metadataValue) {
2155
+ __name(_ts_decorate13, "_ts_decorate");
2156
+ function _ts_metadata13(metadataKey, metadataValue) {
2012
2157
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
2013
2158
  return Reflect.metadata(metadataKey, metadataValue);
2014
2159
  }
2015
2160
  }
2016
- __name(_ts_metadata12, "_ts_metadata");
2017
- function _ts_param11(paramIndex, decorator) {
2161
+ __name(_ts_metadata13, "_ts_metadata");
2162
+ function _ts_param12(paramIndex, decorator) {
2018
2163
  return function(target, key) {
2019
2164
  decorator(target, key, paramIndex);
2020
2165
  };
2021
2166
  }
2022
- __name(_ts_param11, "_ts_param");
2167
+ __name(_ts_param12, "_ts_param");
2023
2168
  var ToolsController = class {
2024
2169
  static {
2025
2170
  __name(this, "ToolsController");
@@ -2048,24 +2193,24 @@ var ToolsController = class {
2048
2193
  }));
2049
2194
  }
2050
2195
  };
2051
- _ts_decorate12([
2196
+ _ts_decorate13([
2052
2197
  Get8(),
2053
- _ts_param11(0, Req8()),
2054
- _ts_param11(1, Query3("agent")),
2055
- _ts_metadata12("design:type", Function),
2056
- _ts_metadata12("design:paramtypes", [
2198
+ _ts_param12(0, Req9()),
2199
+ _ts_param12(1, Query4("agent")),
2200
+ _ts_metadata13("design:type", Function),
2201
+ _ts_metadata13("design:paramtypes", [
2057
2202
  typeof Request === "undefined" ? Object : Request,
2058
2203
  String
2059
2204
  ]),
2060
- _ts_metadata12("design:returntype", Promise)
2205
+ _ts_metadata13("design:returntype", Promise)
2061
2206
  ], ToolsController.prototype, "list", null);
2062
- ToolsController = _ts_decorate12([
2063
- Controller9("tools"),
2064
- _ts_param11(0, Inject11(AGENT_ACTOR_RESOLVER8)),
2065
- _ts_param11(1, Inject11(AGENT_DEPS_FACTORY3)),
2066
- _ts_param11(2, Inject11(AGENT_REGISTRY3)),
2067
- _ts_metadata12("design:type", Function),
2068
- _ts_metadata12("design:paramtypes", [
2207
+ ToolsController = _ts_decorate13([
2208
+ Controller10("tools"),
2209
+ _ts_param12(0, Inject12(AGENT_ACTOR_RESOLVER9)),
2210
+ _ts_param12(1, Inject12(AGENT_DEPS_FACTORY3)),
2211
+ _ts_param12(2, Inject12(AGENT_REGISTRY3)),
2212
+ _ts_metadata13("design:type", Function),
2213
+ _ts_metadata13("design:paramtypes", [
2069
2214
  typeof ActorResolver === "undefined" ? Object : ActorResolver,
2070
2215
  typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
2071
2216
  typeof AgentRegistry4 === "undefined" ? Object : AgentRegistry4
@@ -2074,7 +2219,7 @@ ToolsController = _ts_decorate12([
2074
2219
 
2075
2220
  // src/discovery/agent-discovery.service.ts
2076
2221
  import { AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS2, AGENT_REGISTRY as AGENT_REGISTRY4, AgentRegistry as AgentRegistry5 } from "@dudousxd/nestjs-agent-core";
2077
- import { Inject as Inject12, Injectable as Injectable4, Logger } from "@nestjs/common";
2222
+ import { Inject as Inject13, Injectable as Injectable4, Logger } from "@nestjs/common";
2078
2223
  import { DiscoveryService, MetadataScanner } from "@nestjs/core";
2079
2224
 
2080
2225
  // src/decorator/agent.decorator.ts
@@ -2109,7 +2254,7 @@ function SystemPromptContributor() {
2109
2254
  __name(SystemPromptContributor, "SystemPromptContributor");
2110
2255
 
2111
2256
  // src/discovery/agent-discovery.service.ts
2112
- function _ts_decorate13(decorators, target, key, desc) {
2257
+ function _ts_decorate14(decorators, target, key, desc) {
2113
2258
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2114
2259
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
2115
2260
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2122,19 +2267,19 @@ function _ts_decorate13(decorators, target, key, desc) {
2122
2267
  }
2123
2268
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2124
2269
  }
2125
- __name(_ts_decorate13, "_ts_decorate");
2126
- function _ts_metadata13(metadataKey, metadataValue) {
2270
+ __name(_ts_decorate14, "_ts_decorate");
2271
+ function _ts_metadata14(metadataKey, metadataValue) {
2127
2272
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
2128
2273
  return Reflect.metadata(metadataKey, metadataValue);
2129
2274
  }
2130
2275
  }
2131
- __name(_ts_metadata13, "_ts_metadata");
2132
- function _ts_param12(paramIndex, decorator) {
2276
+ __name(_ts_metadata14, "_ts_metadata");
2277
+ function _ts_param13(paramIndex, decorator) {
2133
2278
  return function(target, key) {
2134
2279
  decorator(target, key, paramIndex);
2135
2280
  };
2136
2281
  }
2137
- __name(_ts_param12, "_ts_param");
2282
+ __name(_ts_param13, "_ts_param");
2138
2283
  var AgentDiscoveryService = class _AgentDiscoveryService {
2139
2284
  static {
2140
2285
  __name(this, "AgentDiscoveryService");
@@ -2261,12 +2406,12 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
2261
2406
  return (ctx) => candidate.call(instance, ctx);
2262
2407
  }
2263
2408
  };
2264
- AgentDiscoveryService = _ts_decorate13([
2409
+ AgentDiscoveryService = _ts_decorate14([
2265
2410
  Injectable4(),
2266
- _ts_param12(2, Inject12(AGENT_REGISTRY4)),
2267
- _ts_param12(3, Inject12(AGENT_PROMPT_CONTRIBUTORS2)),
2268
- _ts_metadata13("design:type", Function),
2269
- _ts_metadata13("design:paramtypes", [
2411
+ _ts_param13(2, Inject13(AGENT_REGISTRY4)),
2412
+ _ts_param13(3, Inject13(AGENT_PROMPT_CONTRIBUTORS2)),
2413
+ _ts_metadata14("design:type", Function),
2414
+ _ts_metadata14("design:paramtypes", [
2270
2415
  typeof DiscoveryService === "undefined" ? Object : DiscoveryService,
2271
2416
  typeof MetadataScanner === "undefined" ? Object : MetadataScanner,
2272
2417
  typeof AgentRegistry5 === "undefined" ? Object : AgentRegistry5,
@@ -2276,7 +2421,7 @@ AgentDiscoveryService = _ts_decorate13([
2276
2421
 
2277
2422
  // src/discovery/ai-tool-discovery.service.ts
2278
2423
  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";
2279
- import { Inject as Inject13, Injectable as Injectable5, Logger as Logger2 } from "@nestjs/common";
2424
+ import { Inject as Inject14, Injectable as Injectable5, Logger as Logger2 } from "@nestjs/common";
2280
2425
  import { DiscoveryService as DiscoveryService2 } from "@nestjs/core";
2281
2426
  import { z } from "zod";
2282
2427
 
@@ -2325,7 +2470,7 @@ function provideAgentTool(factoryOrTool, inject) {
2325
2470
  __name(provideAgentTool, "provideAgentTool");
2326
2471
 
2327
2472
  // src/discovery/ai-tool-discovery.service.ts
2328
- function _ts_decorate14(decorators, target, key, desc) {
2473
+ function _ts_decorate15(decorators, target, key, desc) {
2329
2474
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2330
2475
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
2331
2476
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2338,19 +2483,19 @@ function _ts_decorate14(decorators, target, key, desc) {
2338
2483
  }
2339
2484
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2340
2485
  }
2341
- __name(_ts_decorate14, "_ts_decorate");
2342
- function _ts_metadata14(metadataKey, metadataValue) {
2486
+ __name(_ts_decorate15, "_ts_decorate");
2487
+ function _ts_metadata15(metadataKey, metadataValue) {
2343
2488
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
2344
2489
  return Reflect.metadata(metadataKey, metadataValue);
2345
2490
  }
2346
2491
  }
2347
- __name(_ts_metadata14, "_ts_metadata");
2348
- function _ts_param13(paramIndex, decorator) {
2492
+ __name(_ts_metadata15, "_ts_metadata");
2493
+ function _ts_param14(paramIndex, decorator) {
2349
2494
  return function(target, key) {
2350
2495
  decorator(target, key, paramIndex);
2351
2496
  };
2352
2497
  }
2353
- __name(_ts_param13, "_ts_param");
2498
+ __name(_ts_param14, "_ts_param");
2354
2499
  var AiToolDiscoveryService = class _AiToolDiscoveryService {
2355
2500
  static {
2356
2501
  __name(this, "AiToolDiscoveryService");
@@ -2407,6 +2552,9 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
2407
2552
  } : {},
2408
2553
  ...meta.presentation !== void 0 ? {
2409
2554
  presentation: meta.presentation
2555
+ } : {},
2556
+ ...meta.terminal === true ? {
2557
+ terminal: true
2410
2558
  } : {}
2411
2559
  }, {
2412
2560
  execute: /* @__PURE__ */ __name((input, ctx) => instance.execute(input, ctx), "execute"),
@@ -2480,13 +2628,13 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
2480
2628
  return true;
2481
2629
  }
2482
2630
  };
2483
- AiToolDiscoveryService = _ts_decorate14([
2631
+ AiToolDiscoveryService = _ts_decorate15([
2484
2632
  Injectable5(),
2485
- _ts_param13(1, Inject13(AGENT_TOOL_REGISTRY2)),
2486
- _ts_param13(2, Inject13(AGENT_REGISTRY5)),
2487
- _ts_param13(3, Inject13(AGENT_OPTIONS3)),
2488
- _ts_metadata14("design:type", Function),
2489
- _ts_metadata14("design:paramtypes", [
2633
+ _ts_param14(1, Inject14(AGENT_TOOL_REGISTRY2)),
2634
+ _ts_param14(2, Inject14(AGENT_REGISTRY5)),
2635
+ _ts_param14(3, Inject14(AGENT_OPTIONS3)),
2636
+ _ts_metadata15("design:type", Function),
2637
+ _ts_metadata15("design:paramtypes", [
2490
2638
  typeof DiscoveryService2 === "undefined" ? Object : DiscoveryService2,
2491
2639
  typeof ToolRegistry === "undefined" ? Object : ToolRegistry,
2492
2640
  typeof AgentRegistry === "undefined" ? Object : AgentRegistry,
@@ -2496,7 +2644,7 @@ AiToolDiscoveryService = _ts_decorate14([
2496
2644
 
2497
2645
  // src/discovery/skill-discovery.service.ts
2498
2646
  import { AGENT_SKILL_SOURCES } from "@dudousxd/nestjs-agent-core";
2499
- import { Inject as Inject14, Injectable as Injectable6, Logger as Logger3 } from "@nestjs/common";
2647
+ import { Inject as Inject15, Injectable as Injectable6, Logger as Logger3 } from "@nestjs/common";
2500
2648
  import { DiscoveryService as DiscoveryService3 } from "@nestjs/core";
2501
2649
 
2502
2650
  // src/decorator/skill.decorator.ts
@@ -2519,7 +2667,7 @@ function skillScope(options) {
2519
2667
  __name(skillScope, "skillScope");
2520
2668
 
2521
2669
  // src/discovery/skill-discovery.service.ts
2522
- function _ts_decorate15(decorators, target, key, desc) {
2670
+ function _ts_decorate16(decorators, target, key, desc) {
2523
2671
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2524
2672
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
2525
2673
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2532,19 +2680,19 @@ function _ts_decorate15(decorators, target, key, desc) {
2532
2680
  }
2533
2681
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2534
2682
  }
2535
- __name(_ts_decorate15, "_ts_decorate");
2536
- function _ts_metadata15(metadataKey, metadataValue) {
2683
+ __name(_ts_decorate16, "_ts_decorate");
2684
+ function _ts_metadata16(metadataKey, metadataValue) {
2537
2685
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
2538
2686
  return Reflect.metadata(metadataKey, metadataValue);
2539
2687
  }
2540
2688
  }
2541
- __name(_ts_metadata15, "_ts_metadata");
2542
- function _ts_param14(paramIndex, decorator) {
2689
+ __name(_ts_metadata16, "_ts_metadata");
2690
+ function _ts_param15(paramIndex, decorator) {
2543
2691
  return function(target, key) {
2544
2692
  decorator(target, key, paramIndex);
2545
2693
  };
2546
2694
  }
2547
- __name(_ts_param14, "_ts_param");
2695
+ __name(_ts_param15, "_ts_param");
2548
2696
  var SkillDiscoveryService = class _SkillDiscoveryService {
2549
2697
  static {
2550
2698
  __name(this, "SkillDiscoveryService");
@@ -2588,11 +2736,11 @@ var SkillDiscoveryService = class _SkillDiscoveryService {
2588
2736
  return flat === void 0 ? void 0 : () => flat;
2589
2737
  }
2590
2738
  };
2591
- SkillDiscoveryService = _ts_decorate15([
2739
+ SkillDiscoveryService = _ts_decorate16([
2592
2740
  Injectable6(),
2593
- _ts_param14(1, Inject14(AGENT_SKILL_SOURCES)),
2594
- _ts_metadata15("design:type", Function),
2595
- _ts_metadata15("design:paramtypes", [
2741
+ _ts_param15(1, Inject15(AGENT_SKILL_SOURCES)),
2742
+ _ts_metadata16("design:type", Function),
2743
+ _ts_metadata16("design:paramtypes", [
2596
2744
  typeof DiscoveryService3 === "undefined" ? Object : DiscoveryService3,
2597
2745
  Array
2598
2746
  ])
@@ -2691,8 +2839,8 @@ var LedgerQuotaStore = class {
2691
2839
 
2692
2840
  // src/runner/inline-agent-runner.ts
2693
2841
  import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY4, AGENT_STORE as AGENT_STORE3, RunCancelledError, agentFailureCode, encodeStreamEvent, publishAgentRunFailed, runAgentLoop, settleAll, settleUnsettledDelegation } from "@dudousxd/nestjs-agent-core";
2694
- import { Inject as Inject15, Injectable as Injectable7, Logger as Logger4 } from "@nestjs/common";
2695
- function _ts_decorate16(decorators, target, key, desc) {
2842
+ import { Inject as Inject16, Injectable as Injectable7, Logger as Logger4 } from "@nestjs/common";
2843
+ function _ts_decorate17(decorators, target, key, desc) {
2696
2844
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2697
2845
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
2698
2846
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2705,19 +2853,19 @@ function _ts_decorate16(decorators, target, key, desc) {
2705
2853
  }
2706
2854
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2707
2855
  }
2708
- __name(_ts_decorate16, "_ts_decorate");
2709
- function _ts_metadata16(metadataKey, metadataValue) {
2856
+ __name(_ts_decorate17, "_ts_decorate");
2857
+ function _ts_metadata17(metadataKey, metadataValue) {
2710
2858
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
2711
2859
  return Reflect.metadata(metadataKey, metadataValue);
2712
2860
  }
2713
2861
  }
2714
- __name(_ts_metadata16, "_ts_metadata");
2715
- function _ts_param15(paramIndex, decorator) {
2862
+ __name(_ts_metadata17, "_ts_metadata");
2863
+ function _ts_param16(paramIndex, decorator) {
2716
2864
  return function(target, key) {
2717
2865
  decorator(target, key, paramIndex);
2718
2866
  };
2719
2867
  }
2720
- __name(_ts_param15, "_ts_param");
2868
+ __name(_ts_param16, "_ts_param");
2721
2869
  var InlineAgentRunner = class _InlineAgentRunner {
2722
2870
  static {
2723
2871
  __name(this, "InlineAgentRunner");
@@ -3098,12 +3246,12 @@ var InlineAgentRunner = class _InlineAgentRunner {
3098
3246
  }
3099
3247
  }
3100
3248
  };
3101
- InlineAgentRunner = _ts_decorate16([
3249
+ InlineAgentRunner = _ts_decorate17([
3102
3250
  Injectable7(),
3103
- _ts_param15(0, Inject15(AGENT_DEPS_FACTORY4)),
3104
- _ts_param15(1, Inject15(AGENT_STORE3)),
3105
- _ts_metadata16("design:type", Function),
3106
- _ts_metadata16("design:paramtypes", [
3251
+ _ts_param16(0, Inject16(AGENT_DEPS_FACTORY4)),
3252
+ _ts_param16(1, Inject16(AGENT_STORE3)),
3253
+ _ts_metadata17("design:type", Function),
3254
+ _ts_metadata17("design:paramtypes", [
3107
3255
  typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
3108
3256
  typeof AgentStore === "undefined" ? Object : AgentStore
3109
3257
  ])
@@ -3148,7 +3296,7 @@ function resolveSkillsConfig(options, declared) {
3148
3296
  __name(resolveSkillsConfig, "resolveSkillsConfig");
3149
3297
 
3150
3298
  // src/agent.module.ts
3151
- function _ts_decorate17(decorators, target, key, desc) {
3299
+ function _ts_decorate18(decorators, target, key, desc) {
3152
3300
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3153
3301
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
3154
3302
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3161,7 +3309,7 @@ function _ts_decorate17(decorators, target, key, desc) {
3161
3309
  }
3162
3310
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3163
3311
  }
3164
- __name(_ts_decorate17, "_ts_decorate");
3312
+ __name(_ts_decorate18, "_ts_decorate");
3165
3313
  var DEFAULT_PATH = "agent";
3166
3314
  function sharedProviders(durable, includeStore) {
3167
3315
  const providers = [
@@ -3220,7 +3368,7 @@ function sharedProviders(durable, includeStore) {
3220
3368
  ]
3221
3369
  },
3222
3370
  {
3223
- provide: AGENT_ACTOR_RESOLVER9,
3371
+ provide: AGENT_ACTOR_RESOLVER10,
3224
3372
  useFactory: /* @__PURE__ */ __name((options) => options.actorResolver, "useFactory"),
3225
3373
  inject: [
3226
3374
  AGENT_OPTIONS4
@@ -3305,7 +3453,7 @@ function exportsFor(includeStore) {
3305
3453
  AGENT_REGISTRY6,
3306
3454
  AGENT_SINK2,
3307
3455
  AGENT_ROLES_POLICY2,
3308
- AGENT_ACTOR_RESOLVER9,
3456
+ AGENT_ACTOR_RESOLVER10,
3309
3457
  AGENT_MODEL2,
3310
3458
  ...includeStore ? [
3311
3459
  AGENT_STORE4
@@ -3330,7 +3478,8 @@ var BASE_CONTROLLERS = [
3330
3478
  AgentsController,
3331
3479
  SkillsController,
3332
3480
  MemoriesController,
3333
- ToolsController
3481
+ ToolsController,
3482
+ MessagesController
3334
3483
  ];
3335
3484
  var GUARDABLE_CONTROLLERS = [
3336
3485
  ...BASE_CONTROLLERS,
@@ -3433,7 +3582,7 @@ var AgentModule = class _AgentModule {
3433
3582
  };
3434
3583
  }
3435
3584
  };
3436
- AgentModule = _ts_decorate17([
3585
+ AgentModule = _ts_decorate18([
3437
3586
  Global(),
3438
3587
  Module({})
3439
3588
  ], AgentModule);
@@ -3492,6 +3641,7 @@ export {
3492
3641
  InlineAgentRunner,
3493
3642
  LedgerQuotaStore,
3494
3643
  MemoriesController,
3644
+ MessagesController,
3495
3645
  SKILL_METADATA,
3496
3646
  SYSTEM_PROMPT_CONTRIBUTOR_METADATA,
3497
3647
  SYSTEM_PROMPT_METADATA,