@dudousxd/nestjs-agent 1.6.0 → 1.7.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/README.md +35 -0
- package/dist/{agent-deps.factory-CUyVPsa1.d.cts → agent-deps.factory-CiC5Va9J.d.cts} +7 -1
- package/dist/{agent-deps.factory-CUyVPsa1.d.ts → agent-deps.factory-CiC5Va9J.d.ts} +7 -1
- package/dist/durable/index.cjs +466 -309
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.d.cts +1 -1
- package/dist/durable/index.d.ts +1 -1
- package/dist/durable/index.js +366 -209
- package/dist/durable/index.js.map +1 -1
- package/dist/index.cjs +468 -312
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -5
- package/dist/index.d.ts +40 -5
- package/dist/index.js +363 -208
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -43,6 +43,7 @@ __export(index_exports, {
|
|
|
43
43
|
LedgerQuotaStore: () => LedgerQuotaStore,
|
|
44
44
|
MemoriesController: () => MemoriesController,
|
|
45
45
|
MessagesController: () => MessagesController,
|
|
46
|
+
ModelsController: () => ModelsController,
|
|
46
47
|
SKILL_METADATA: () => SKILL_METADATA,
|
|
47
48
|
SYSTEM_PROMPT_CONTRIBUTOR_METADATA: () => SYSTEM_PROMPT_CONTRIBUTOR_METADATA,
|
|
48
49
|
SYSTEM_PROMPT_METADATA: () => SYSTEM_PROMPT_METADATA,
|
|
@@ -65,8 +66,8 @@ __export(index_exports, {
|
|
|
65
66
|
module.exports = __toCommonJS(index_exports);
|
|
66
67
|
|
|
67
68
|
// src/agent.module.ts
|
|
68
|
-
var
|
|
69
|
-
var
|
|
69
|
+
var import_nestjs_agent_core22 = require("@dudousxd/nestjs-agent-core");
|
|
70
|
+
var import_common19 = require("@nestjs/common");
|
|
70
71
|
var import_core4 = require("@nestjs/core");
|
|
71
72
|
|
|
72
73
|
// src/agent-deps.factory.ts
|
|
@@ -390,15 +391,72 @@ var AgentService = class {
|
|
|
390
391
|
deps;
|
|
391
392
|
quota;
|
|
392
393
|
staging;
|
|
393
|
-
|
|
394
|
+
models;
|
|
395
|
+
constructor(runner, store, deps, quota, staging, models) {
|
|
394
396
|
this.runner = runner;
|
|
395
397
|
this.store = store;
|
|
396
398
|
this.deps = deps;
|
|
397
399
|
this.quota = quota;
|
|
398
400
|
this.staging = staging;
|
|
401
|
+
this.models = models;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* The models `actor` may pick for `agent` (`GET <base>/models`). An empty catalog when none is
|
|
405
|
+
* bound, so a picker simply has nothing to offer.
|
|
406
|
+
*/
|
|
407
|
+
async listModels(actor, agent) {
|
|
408
|
+
if (this.models === void 0) {
|
|
409
|
+
return {
|
|
410
|
+
providers: [],
|
|
411
|
+
default: null
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
return this.models.list({
|
|
415
|
+
actor,
|
|
416
|
+
...agent !== void 0 ? {
|
|
417
|
+
agent
|
|
418
|
+
} : {}
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* `model` if the catalog offers it to this actor and agent right now, else a 400 naming why. The
|
|
423
|
+
* one gate every model choice passes — a send's own, and a thread's pinned one at the moment it is
|
|
424
|
+
* pinned and again at every turn that runs on it (availability can change in between).
|
|
425
|
+
*/
|
|
426
|
+
async assertModelAllowed(actor, agent, model) {
|
|
427
|
+
if (this.models === void 0) {
|
|
428
|
+
throw new import_common2.BadRequestException(`model "${model}" cannot be selected: no ModelCatalog is configured (AgentModule.forRoot({ models }))`);
|
|
429
|
+
}
|
|
430
|
+
const entry = (0, import_nestjs_agent_core3.findCatalogModel)(await this.models.list({
|
|
431
|
+
actor,
|
|
432
|
+
agent
|
|
433
|
+
}), model);
|
|
434
|
+
if (entry === void 0) {
|
|
435
|
+
throw new import_common2.BadRequestException(`model "${model}" is not offered`);
|
|
436
|
+
}
|
|
437
|
+
if (!entry.available) {
|
|
438
|
+
throw new import_common2.BadRequestException(`model "${model}" is not available${entry.unavailableReason ? `: ${entry.unavailableReason}` : ""}`);
|
|
439
|
+
}
|
|
440
|
+
return entry.id;
|
|
441
|
+
}
|
|
442
|
+
/** The model a turn runs on: the send's own, else the thread's pinned one, else none. */
|
|
443
|
+
async resolveModel(actor, agent, requested, threadId) {
|
|
444
|
+
const model = requested ?? (threadId !== void 0 ? await this.threadModel(threadId) : null);
|
|
445
|
+
if (model === null || model === void 0) {
|
|
446
|
+
return void 0;
|
|
447
|
+
}
|
|
448
|
+
return this.assertModelAllowed(actor, agent, model);
|
|
449
|
+
}
|
|
450
|
+
async threadModel(threadId) {
|
|
451
|
+
const projecting = this.store;
|
|
452
|
+
if (typeof projecting.modelForThread === "function") {
|
|
453
|
+
return projecting.modelForThread(threadId);
|
|
454
|
+
}
|
|
455
|
+
return (await this.store.getThread(threadId))?.model ?? null;
|
|
399
456
|
}
|
|
400
457
|
async chat(params) {
|
|
401
458
|
const agentName = await this.resolveAgentName(params.agentName, params.threadId);
|
|
459
|
+
const model = await this.resolveModel(params.actor, agentName, params.model, params.threadId);
|
|
402
460
|
const attachments = await this.resolveAttachments(params.actor, params.attachments ?? []);
|
|
403
461
|
let threadId = params.threadId;
|
|
404
462
|
if (threadId === void 0) {
|
|
@@ -429,6 +487,9 @@ var AgentService = class {
|
|
|
429
487
|
} : {},
|
|
430
488
|
...params.pageContext !== void 0 ? {
|
|
431
489
|
pageContext: params.pageContext
|
|
490
|
+
} : {},
|
|
491
|
+
...model !== void 0 ? {
|
|
492
|
+
model
|
|
432
493
|
} : {}
|
|
433
494
|
};
|
|
434
495
|
const { runId } = await this.runner.start(input);
|
|
@@ -599,20 +660,26 @@ var AgentService = class {
|
|
|
599
660
|
async updateThread(actor, threadId, patch) {
|
|
600
661
|
const title = patch.title !== void 0 ? this.validateTitle(patch.title) : void 0;
|
|
601
662
|
await this.assertOwnsThread(actor, threadId);
|
|
602
|
-
if (patch.defaultAgent === void 0) {
|
|
663
|
+
if (patch.defaultAgent === void 0 && patch.model === void 0) {
|
|
603
664
|
if (title !== void 0) {
|
|
604
665
|
await this.store.setTitle(threadId, title);
|
|
605
666
|
}
|
|
606
667
|
return;
|
|
607
668
|
}
|
|
608
669
|
if (this.store.updateThread === void 0) {
|
|
609
|
-
throw new import_common2.NotImplementedException("Setting a thread's defaultAgent requires an AgentStore that implements updateThread(); the bound store does not support it.");
|
|
670
|
+
throw new import_common2.NotImplementedException("Setting a thread's defaultAgent or model requires an AgentStore that implements updateThread(); the bound store does not support it.");
|
|
610
671
|
}
|
|
672
|
+
const model = patch.model === void 0 || patch.model === null ? patch.model : await this.assertModelAllowed(actor, patch.defaultAgent ?? await this.resolveAgentName(void 0, threadId), patch.model);
|
|
611
673
|
await this.store.updateThread(threadId, {
|
|
612
674
|
...title !== void 0 ? {
|
|
613
675
|
title
|
|
614
676
|
} : {},
|
|
615
|
-
|
|
677
|
+
...patch.defaultAgent !== void 0 ? {
|
|
678
|
+
defaultAgent: patch.defaultAgent
|
|
679
|
+
} : {},
|
|
680
|
+
...model !== void 0 ? {
|
|
681
|
+
model
|
|
682
|
+
} : {}
|
|
616
683
|
});
|
|
617
684
|
}
|
|
618
685
|
validateTitle(title) {
|
|
@@ -659,6 +726,7 @@ var AgentService = class {
|
|
|
659
726
|
return {
|
|
660
727
|
...thread,
|
|
661
728
|
defaultAgent: thread.defaultAgent ?? null,
|
|
729
|
+
model: thread.model ?? null,
|
|
662
730
|
activeRunId: await this.store.activeRunForThread?.(thread.id) ?? null
|
|
663
731
|
};
|
|
664
732
|
}
|
|
@@ -926,13 +994,16 @@ AgentService = _ts_decorate2([
|
|
|
926
994
|
_ts_param2(3, (0, import_common2.Inject)(import_nestjs_agent_core3.AGENT_QUOTA_STORE)),
|
|
927
995
|
_ts_param2(4, (0, import_common2.Optional)()),
|
|
928
996
|
_ts_param2(4, (0, import_common2.Inject)(import_nestjs_agent_core3.AGENT_ATTACHMENT_STAGING)),
|
|
997
|
+
_ts_param2(5, (0, import_common2.Optional)()),
|
|
998
|
+
_ts_param2(5, (0, import_common2.Inject)(import_nestjs_agent_core3.AGENT_MODEL_CATALOG)),
|
|
929
999
|
_ts_metadata2("design:type", Function),
|
|
930
1000
|
_ts_metadata2("design:paramtypes", [
|
|
931
1001
|
typeof AgentRunner === "undefined" ? Object : AgentRunner,
|
|
932
1002
|
typeof AgentStore === "undefined" ? Object : AgentStore,
|
|
933
1003
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
934
1004
|
Object,
|
|
935
|
-
typeof AttachmentStagingStore === "undefined" ? Object : AttachmentStagingStore
|
|
1005
|
+
typeof AttachmentStagingStore === "undefined" ? Object : AttachmentStagingStore,
|
|
1006
|
+
typeof ModelCatalog === "undefined" ? Object : ModelCatalog
|
|
936
1007
|
])
|
|
937
1008
|
], AgentService);
|
|
938
1009
|
|
|
@@ -1304,6 +1375,9 @@ var ChatController = class {
|
|
|
1304
1375
|
} : {},
|
|
1305
1376
|
...body.transient === true ? {
|
|
1306
1377
|
transient: true
|
|
1378
|
+
} : {},
|
|
1379
|
+
...typeof body.model === "string" && body.model.length > 0 ? {
|
|
1380
|
+
model: body.model
|
|
1307
1381
|
} : {}
|
|
1308
1382
|
});
|
|
1309
1383
|
await this.pipe(res, runId, this.agent.subscribe(runId), threadId);
|
|
@@ -1668,7 +1742,7 @@ MessagesController = _ts_decorate8([
|
|
|
1668
1742
|
])
|
|
1669
1743
|
], MessagesController);
|
|
1670
1744
|
|
|
1671
|
-
// src/controller/
|
|
1745
|
+
// src/controller/models.controller.ts
|
|
1672
1746
|
var import_nestjs_agent_core9 = require("@dudousxd/nestjs-agent-core");
|
|
1673
1747
|
var import_common9 = require("@nestjs/common");
|
|
1674
1748
|
function _ts_decorate9(decorators, target, key, desc) {
|
|
@@ -1697,9 +1771,9 @@ function _ts_param8(paramIndex, decorator) {
|
|
|
1697
1771
|
};
|
|
1698
1772
|
}
|
|
1699
1773
|
__name(_ts_param8, "_ts_param");
|
|
1700
|
-
var
|
|
1774
|
+
var ModelsController = class {
|
|
1701
1775
|
static {
|
|
1702
|
-
__name(this, "
|
|
1776
|
+
__name(this, "ModelsController");
|
|
1703
1777
|
}
|
|
1704
1778
|
agent;
|
|
1705
1779
|
actorResolver;
|
|
@@ -1707,31 +1781,37 @@ var QuotaController = class {
|
|
|
1707
1781
|
this.agent = agent;
|
|
1708
1782
|
this.actorResolver = actorResolver;
|
|
1709
1783
|
}
|
|
1710
|
-
|
|
1784
|
+
/**
|
|
1785
|
+
* The models the caller may pick for `agent` (the default agent when omitted), grouped by
|
|
1786
|
+
* provider, with badges and availability — the bound `ModelCatalog`'s answer, or an empty one.
|
|
1787
|
+
*/
|
|
1788
|
+
async list(req, agent) {
|
|
1711
1789
|
const actor = await this.actorResolver.resolve(req);
|
|
1712
|
-
return this.agent.
|
|
1790
|
+
return this.agent.listModels(actor, agent);
|
|
1713
1791
|
}
|
|
1714
1792
|
};
|
|
1715
1793
|
_ts_decorate9([
|
|
1716
|
-
(0, import_common9.Get)(
|
|
1794
|
+
(0, import_common9.Get)(),
|
|
1717
1795
|
_ts_param8(0, (0, import_common9.Req)()),
|
|
1796
|
+
_ts_param8(1, (0, import_common9.Query)("agent")),
|
|
1718
1797
|
_ts_metadata9("design:type", Function),
|
|
1719
1798
|
_ts_metadata9("design:paramtypes", [
|
|
1720
|
-
typeof Request === "undefined" ? Object : Request
|
|
1799
|
+
typeof Request === "undefined" ? Object : Request,
|
|
1800
|
+
String
|
|
1721
1801
|
]),
|
|
1722
1802
|
_ts_metadata9("design:returntype", Promise)
|
|
1723
|
-
],
|
|
1724
|
-
|
|
1725
|
-
(0, import_common9.Controller)("
|
|
1803
|
+
], ModelsController.prototype, "list", null);
|
|
1804
|
+
ModelsController = _ts_decorate9([
|
|
1805
|
+
(0, import_common9.Controller)("models"),
|
|
1726
1806
|
_ts_param8(1, (0, import_common9.Inject)(import_nestjs_agent_core9.AGENT_ACTOR_RESOLVER)),
|
|
1727
1807
|
_ts_metadata9("design:type", Function),
|
|
1728
1808
|
_ts_metadata9("design:paramtypes", [
|
|
1729
1809
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
1730
1810
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
1731
1811
|
])
|
|
1732
|
-
],
|
|
1812
|
+
], ModelsController);
|
|
1733
1813
|
|
|
1734
|
-
// src/controller/
|
|
1814
|
+
// src/controller/quota.controller.ts
|
|
1735
1815
|
var import_nestjs_agent_core10 = require("@dudousxd/nestjs-agent-core");
|
|
1736
1816
|
var import_common10 = require("@nestjs/common");
|
|
1737
1817
|
function _ts_decorate10(decorators, target, key, desc) {
|
|
@@ -1760,6 +1840,69 @@ function _ts_param9(paramIndex, decorator) {
|
|
|
1760
1840
|
};
|
|
1761
1841
|
}
|
|
1762
1842
|
__name(_ts_param9, "_ts_param");
|
|
1843
|
+
var QuotaController = class {
|
|
1844
|
+
static {
|
|
1845
|
+
__name(this, "QuotaController");
|
|
1846
|
+
}
|
|
1847
|
+
agent;
|
|
1848
|
+
actorResolver;
|
|
1849
|
+
constructor(agent, actorResolver) {
|
|
1850
|
+
this.agent = agent;
|
|
1851
|
+
this.actorResolver = actorResolver;
|
|
1852
|
+
}
|
|
1853
|
+
async today(req) {
|
|
1854
|
+
const actor = await this.actorResolver.resolve(req);
|
|
1855
|
+
return this.agent.quotaToday(actor.id);
|
|
1856
|
+
}
|
|
1857
|
+
};
|
|
1858
|
+
_ts_decorate10([
|
|
1859
|
+
(0, import_common10.Get)("today"),
|
|
1860
|
+
_ts_param9(0, (0, import_common10.Req)()),
|
|
1861
|
+
_ts_metadata10("design:type", Function),
|
|
1862
|
+
_ts_metadata10("design:paramtypes", [
|
|
1863
|
+
typeof Request === "undefined" ? Object : Request
|
|
1864
|
+
]),
|
|
1865
|
+
_ts_metadata10("design:returntype", Promise)
|
|
1866
|
+
], QuotaController.prototype, "today", null);
|
|
1867
|
+
QuotaController = _ts_decorate10([
|
|
1868
|
+
(0, import_common10.Controller)("quota"),
|
|
1869
|
+
_ts_param9(1, (0, import_common10.Inject)(import_nestjs_agent_core10.AGENT_ACTOR_RESOLVER)),
|
|
1870
|
+
_ts_metadata10("design:type", Function),
|
|
1871
|
+
_ts_metadata10("design:paramtypes", [
|
|
1872
|
+
typeof AgentService === "undefined" ? Object : AgentService,
|
|
1873
|
+
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
1874
|
+
])
|
|
1875
|
+
], QuotaController);
|
|
1876
|
+
|
|
1877
|
+
// src/controller/skills.controller.ts
|
|
1878
|
+
var import_nestjs_agent_core11 = require("@dudousxd/nestjs-agent-core");
|
|
1879
|
+
var import_common11 = require("@nestjs/common");
|
|
1880
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
1881
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1882
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1883
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1884
|
+
} else {
|
|
1885
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1886
|
+
if (d = decorators[i]) {
|
|
1887
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1892
|
+
}
|
|
1893
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
1894
|
+
function _ts_metadata11(metadataKey, metadataValue) {
|
|
1895
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1896
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
1900
|
+
function _ts_param10(paramIndex, decorator) {
|
|
1901
|
+
return function(target, key) {
|
|
1902
|
+
decorator(target, key, paramIndex);
|
|
1903
|
+
};
|
|
1904
|
+
}
|
|
1905
|
+
__name(_ts_param10, "_ts_param");
|
|
1763
1906
|
var SkillsController = class {
|
|
1764
1907
|
static {
|
|
1765
1908
|
__name(this, "SkillsController");
|
|
@@ -1775,40 +1918,40 @@ var SkillsController = class {
|
|
|
1775
1918
|
return [];
|
|
1776
1919
|
}
|
|
1777
1920
|
const actor = await this.actorResolver.resolve(req);
|
|
1778
|
-
const offer = await (0,
|
|
1921
|
+
const offer = await (0, import_nestjs_agent_core11.offerSkills)(this.skills, {
|
|
1779
1922
|
actor,
|
|
1780
1923
|
threadId: threadId ?? ""
|
|
1781
1924
|
});
|
|
1782
1925
|
return offer.entries;
|
|
1783
1926
|
}
|
|
1784
1927
|
};
|
|
1785
|
-
|
|
1786
|
-
(0,
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1928
|
+
_ts_decorate11([
|
|
1929
|
+
(0, import_common11.Get)(),
|
|
1930
|
+
_ts_param10(0, (0, import_common11.Req)()),
|
|
1931
|
+
_ts_param10(1, (0, import_common11.Query)("threadId")),
|
|
1932
|
+
_ts_metadata11("design:type", Function),
|
|
1933
|
+
_ts_metadata11("design:paramtypes", [
|
|
1791
1934
|
typeof Request === "undefined" ? Object : Request,
|
|
1792
1935
|
String
|
|
1793
1936
|
]),
|
|
1794
|
-
|
|
1937
|
+
_ts_metadata11("design:returntype", Promise)
|
|
1795
1938
|
], SkillsController.prototype, "list", null);
|
|
1796
|
-
SkillsController =
|
|
1797
|
-
(0,
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1939
|
+
SkillsController = _ts_decorate11([
|
|
1940
|
+
(0, import_common11.Controller)("skills"),
|
|
1941
|
+
_ts_param10(0, (0, import_common11.Inject)(import_nestjs_agent_core11.AGENT_ACTOR_RESOLVER)),
|
|
1942
|
+
_ts_param10(1, (0, import_common11.Optional)()),
|
|
1943
|
+
_ts_param10(1, (0, import_common11.Inject)(import_nestjs_agent_core11.AGENT_SKILLS)),
|
|
1944
|
+
_ts_metadata11("design:type", Function),
|
|
1945
|
+
_ts_metadata11("design:paramtypes", [
|
|
1803
1946
|
typeof ActorResolver === "undefined" ? Object : ActorResolver,
|
|
1804
1947
|
Object
|
|
1805
1948
|
])
|
|
1806
1949
|
], SkillsController);
|
|
1807
1950
|
|
|
1808
1951
|
// src/controller/threads.controller.ts
|
|
1809
|
-
var
|
|
1810
|
-
var
|
|
1811
|
-
function
|
|
1952
|
+
var import_nestjs_agent_core12 = require("@dudousxd/nestjs-agent-core");
|
|
1953
|
+
var import_common12 = require("@nestjs/common");
|
|
1954
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
1812
1955
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1813
1956
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1814
1957
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1821,19 +1964,19 @@ function _ts_decorate11(decorators, target, key, desc) {
|
|
|
1821
1964
|
}
|
|
1822
1965
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1823
1966
|
}
|
|
1824
|
-
__name(
|
|
1825
|
-
function
|
|
1967
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
1968
|
+
function _ts_metadata12(metadataKey, metadataValue) {
|
|
1826
1969
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1827
1970
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
1828
1971
|
}
|
|
1829
1972
|
}
|
|
1830
|
-
__name(
|
|
1831
|
-
function
|
|
1973
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
1974
|
+
function _ts_param11(paramIndex, decorator) {
|
|
1832
1975
|
return function(target, key) {
|
|
1833
1976
|
decorator(target, key, paramIndex);
|
|
1834
1977
|
};
|
|
1835
1978
|
}
|
|
1836
|
-
__name(
|
|
1979
|
+
__name(_ts_param11, "_ts_param");
|
|
1837
1980
|
var ThreadsController = class {
|
|
1838
1981
|
static {
|
|
1839
1982
|
__name(this, "ThreadsController");
|
|
@@ -1876,6 +2019,9 @@ var ThreadsController = class {
|
|
|
1876
2019
|
} : {},
|
|
1877
2020
|
..."defaultAgent" in body ? {
|
|
1878
2021
|
defaultAgent: body.defaultAgent ?? null
|
|
2022
|
+
} : {},
|
|
2023
|
+
..."model" in body ? {
|
|
2024
|
+
model: body.model ?? null
|
|
1879
2025
|
} : {}
|
|
1880
2026
|
});
|
|
1881
2027
|
return {
|
|
@@ -1897,101 +2043,101 @@ var ThreadsController = class {
|
|
|
1897
2043
|
};
|
|
1898
2044
|
}
|
|
1899
2045
|
};
|
|
1900
|
-
|
|
1901
|
-
(0,
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
2046
|
+
_ts_decorate12([
|
|
2047
|
+
(0, import_common12.Get)(),
|
|
2048
|
+
_ts_param11(0, (0, import_common12.Req)()),
|
|
2049
|
+
_ts_metadata12("design:type", Function),
|
|
2050
|
+
_ts_metadata12("design:paramtypes", [
|
|
1905
2051
|
typeof Request === "undefined" ? Object : Request
|
|
1906
2052
|
]),
|
|
1907
|
-
|
|
2053
|
+
_ts_metadata12("design:returntype", Promise)
|
|
1908
2054
|
], ThreadsController.prototype, "list", null);
|
|
1909
|
-
|
|
1910
|
-
(0,
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
2055
|
+
_ts_decorate12([
|
|
2056
|
+
(0, import_common12.Get)(":id"),
|
|
2057
|
+
_ts_param11(0, (0, import_common12.Req)()),
|
|
2058
|
+
_ts_param11(1, (0, import_common12.Param)("id")),
|
|
2059
|
+
_ts_metadata12("design:type", Function),
|
|
2060
|
+
_ts_metadata12("design:paramtypes", [
|
|
1915
2061
|
typeof Request === "undefined" ? Object : Request,
|
|
1916
2062
|
String
|
|
1917
2063
|
]),
|
|
1918
|
-
|
|
2064
|
+
_ts_metadata12("design:returntype", Promise)
|
|
1919
2065
|
], ThreadsController.prototype, "detail", null);
|
|
1920
|
-
|
|
1921
|
-
(0,
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
2066
|
+
_ts_decorate12([
|
|
2067
|
+
(0, import_common12.Delete)(":id"),
|
|
2068
|
+
_ts_param11(0, (0, import_common12.Req)()),
|
|
2069
|
+
_ts_param11(1, (0, import_common12.Param)("id")),
|
|
2070
|
+
_ts_metadata12("design:type", Function),
|
|
2071
|
+
_ts_metadata12("design:paramtypes", [
|
|
1926
2072
|
typeof Request === "undefined" ? Object : Request,
|
|
1927
2073
|
String
|
|
1928
2074
|
]),
|
|
1929
|
-
|
|
2075
|
+
_ts_metadata12("design:returntype", Promise)
|
|
1930
2076
|
], ThreadsController.prototype, "remove", null);
|
|
1931
|
-
|
|
1932
|
-
(0,
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
2077
|
+
_ts_decorate12([
|
|
2078
|
+
(0, import_common12.Post)(":id/fork-from/:messageId"),
|
|
2079
|
+
_ts_param11(0, (0, import_common12.Req)()),
|
|
2080
|
+
_ts_param11(1, (0, import_common12.Param)("id")),
|
|
2081
|
+
_ts_param11(2, (0, import_common12.Param)("messageId")),
|
|
2082
|
+
_ts_metadata12("design:type", Function),
|
|
2083
|
+
_ts_metadata12("design:paramtypes", [
|
|
1938
2084
|
typeof Request === "undefined" ? Object : Request,
|
|
1939
2085
|
String,
|
|
1940
2086
|
String
|
|
1941
2087
|
]),
|
|
1942
|
-
|
|
2088
|
+
_ts_metadata12("design:returntype", Promise)
|
|
1943
2089
|
], ThreadsController.prototype, "fork", null);
|
|
1944
|
-
|
|
1945
|
-
(0,
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
2090
|
+
_ts_decorate12([
|
|
2091
|
+
(0, import_common12.Patch)(":id"),
|
|
2092
|
+
_ts_param11(0, (0, import_common12.Req)()),
|
|
2093
|
+
_ts_param11(1, (0, import_common12.Param)("id")),
|
|
2094
|
+
_ts_param11(2, (0, import_common12.Body)()),
|
|
2095
|
+
_ts_metadata12("design:type", Function),
|
|
2096
|
+
_ts_metadata12("design:paramtypes", [
|
|
1951
2097
|
typeof Request === "undefined" ? Object : Request,
|
|
1952
2098
|
String,
|
|
1953
2099
|
typeof UpdateThreadBody === "undefined" ? Object : UpdateThreadBody
|
|
1954
2100
|
]),
|
|
1955
|
-
|
|
2101
|
+
_ts_metadata12("design:returntype", Promise)
|
|
1956
2102
|
], ThreadsController.prototype, "update", null);
|
|
1957
|
-
|
|
1958
|
-
(0,
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
2103
|
+
_ts_decorate12([
|
|
2104
|
+
(0, import_common12.Post)(":id/promote"),
|
|
2105
|
+
_ts_param11(0, (0, import_common12.Req)()),
|
|
2106
|
+
_ts_param11(1, (0, import_common12.Param)("id")),
|
|
2107
|
+
_ts_metadata12("design:type", Function),
|
|
2108
|
+
_ts_metadata12("design:paramtypes", [
|
|
1963
2109
|
typeof Request === "undefined" ? Object : Request,
|
|
1964
2110
|
String
|
|
1965
2111
|
]),
|
|
1966
|
-
|
|
2112
|
+
_ts_metadata12("design:returntype", Promise)
|
|
1967
2113
|
], ThreadsController.prototype, "promote", null);
|
|
1968
|
-
|
|
1969
|
-
(0,
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
2114
|
+
_ts_decorate12([
|
|
2115
|
+
(0, import_common12.Delete)(":id/from/:messageId"),
|
|
2116
|
+
_ts_param11(0, (0, import_common12.Req)()),
|
|
2117
|
+
_ts_param11(1, (0, import_common12.Param)("id")),
|
|
2118
|
+
_ts_param11(2, (0, import_common12.Param)("messageId")),
|
|
2119
|
+
_ts_metadata12("design:type", Function),
|
|
2120
|
+
_ts_metadata12("design:paramtypes", [
|
|
1975
2121
|
typeof Request === "undefined" ? Object : Request,
|
|
1976
2122
|
String,
|
|
1977
2123
|
String
|
|
1978
2124
|
]),
|
|
1979
|
-
|
|
2125
|
+
_ts_metadata12("design:returntype", Promise)
|
|
1980
2126
|
], ThreadsController.prototype, "truncateFrom", null);
|
|
1981
|
-
ThreadsController =
|
|
1982
|
-
(0,
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
2127
|
+
ThreadsController = _ts_decorate12([
|
|
2128
|
+
(0, import_common12.Controller)("threads"),
|
|
2129
|
+
_ts_param11(1, (0, import_common12.Inject)(import_nestjs_agent_core12.AGENT_ACTOR_RESOLVER)),
|
|
2130
|
+
_ts_metadata12("design:type", Function),
|
|
2131
|
+
_ts_metadata12("design:paramtypes", [
|
|
1986
2132
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
1987
2133
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
1988
2134
|
])
|
|
1989
2135
|
], ThreadsController);
|
|
1990
2136
|
|
|
1991
2137
|
// src/controller/tool-call.controller.ts
|
|
1992
|
-
var
|
|
1993
|
-
var
|
|
1994
|
-
function
|
|
2138
|
+
var import_nestjs_agent_core13 = require("@dudousxd/nestjs-agent-core");
|
|
2139
|
+
var import_common13 = require("@nestjs/common");
|
|
2140
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
1995
2141
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1996
2142
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1997
2143
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2004,19 +2150,19 @@ function _ts_decorate12(decorators, target, key, desc) {
|
|
|
2004
2150
|
}
|
|
2005
2151
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2006
2152
|
}
|
|
2007
|
-
__name(
|
|
2008
|
-
function
|
|
2153
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
2154
|
+
function _ts_metadata13(metadataKey, metadataValue) {
|
|
2009
2155
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2010
2156
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
2011
2157
|
}
|
|
2012
2158
|
}
|
|
2013
|
-
__name(
|
|
2014
|
-
function
|
|
2159
|
+
__name(_ts_metadata13, "_ts_metadata");
|
|
2160
|
+
function _ts_param12(paramIndex, decorator) {
|
|
2015
2161
|
return function(target, key) {
|
|
2016
2162
|
decorator(target, key, paramIndex);
|
|
2017
2163
|
};
|
|
2018
2164
|
}
|
|
2019
|
-
__name(
|
|
2165
|
+
__name(_ts_param12, "_ts_param");
|
|
2020
2166
|
var MAX_ANSWERED_QUESTIONS = 100;
|
|
2021
2167
|
var MAX_VALUES_PER_QUESTION = 100;
|
|
2022
2168
|
var MAX_ANSWER_VALUE_LENGTH = 4096;
|
|
@@ -2025,7 +2171,7 @@ var MAX_VIA_LENGTH = 64;
|
|
|
2025
2171
|
var DEFAULT_VIA = "web";
|
|
2026
2172
|
function toolCallId(claimed) {
|
|
2027
2173
|
if (typeof claimed !== "string" || claimed.length === 0) {
|
|
2028
|
-
throw new
|
|
2174
|
+
throw new import_common13.BadRequestException("toolCallId must be a non-empty string");
|
|
2029
2175
|
}
|
|
2030
2176
|
return claimed;
|
|
2031
2177
|
}
|
|
@@ -2035,10 +2181,10 @@ function rejectReason(claimed) {
|
|
|
2035
2181
|
return void 0;
|
|
2036
2182
|
}
|
|
2037
2183
|
if (typeof claimed !== "string") {
|
|
2038
|
-
throw new
|
|
2184
|
+
throw new import_common13.BadRequestException("reason must be a string");
|
|
2039
2185
|
}
|
|
2040
2186
|
if (claimed.length > MAX_REJECT_REASON_LENGTH) {
|
|
2041
|
-
throw new
|
|
2187
|
+
throw new import_common13.BadRequestException(`reason must be at most ${MAX_REJECT_REASON_LENGTH} characters`);
|
|
2042
2188
|
}
|
|
2043
2189
|
return claimed;
|
|
2044
2190
|
}
|
|
@@ -2048,7 +2194,7 @@ function remember(claimed) {
|
|
|
2048
2194
|
return false;
|
|
2049
2195
|
}
|
|
2050
2196
|
if (typeof claimed !== "boolean") {
|
|
2051
|
-
throw new
|
|
2197
|
+
throw new import_common13.BadRequestException("remember must be a boolean");
|
|
2052
2198
|
}
|
|
2053
2199
|
return claimed;
|
|
2054
2200
|
}
|
|
@@ -2058,7 +2204,7 @@ function via(claimed) {
|
|
|
2058
2204
|
return DEFAULT_VIA;
|
|
2059
2205
|
}
|
|
2060
2206
|
if (typeof claimed !== "string" || claimed.length === 0 || claimed.length > MAX_VIA_LENGTH) {
|
|
2061
|
-
throw new
|
|
2207
|
+
throw new import_common13.BadRequestException(`via must be a string of 1-${MAX_VIA_LENGTH} characters`);
|
|
2062
2208
|
}
|
|
2063
2209
|
return claimed;
|
|
2064
2210
|
}
|
|
@@ -2068,26 +2214,26 @@ function answers(claimed) {
|
|
|
2068
2214
|
return void 0;
|
|
2069
2215
|
}
|
|
2070
2216
|
if (typeof claimed !== "object" || claimed === null || Array.isArray(claimed)) {
|
|
2071
|
-
throw new
|
|
2217
|
+
throw new import_common13.BadRequestException("answers must be an object of questionId \u2192 chosen values");
|
|
2072
2218
|
}
|
|
2073
2219
|
const entries = Object.entries(claimed);
|
|
2074
2220
|
if (entries.length > MAX_ANSWERED_QUESTIONS) {
|
|
2075
|
-
throw new
|
|
2221
|
+
throw new import_common13.BadRequestException(`answers may cover at most ${MAX_ANSWERED_QUESTIONS} questions`);
|
|
2076
2222
|
}
|
|
2077
2223
|
const validated = /* @__PURE__ */ Object.create(null);
|
|
2078
2224
|
for (const [questionId, values] of entries) {
|
|
2079
2225
|
if (!Array.isArray(values)) {
|
|
2080
|
-
throw new
|
|
2226
|
+
throw new import_common13.BadRequestException(`answers["${questionId}"] must be an array of chosen values`);
|
|
2081
2227
|
}
|
|
2082
2228
|
if (values.length > MAX_VALUES_PER_QUESTION) {
|
|
2083
|
-
throw new
|
|
2229
|
+
throw new import_common13.BadRequestException(`answers["${questionId}"] may carry at most ${MAX_VALUES_PER_QUESTION} values`);
|
|
2084
2230
|
}
|
|
2085
2231
|
for (const value of values) {
|
|
2086
2232
|
if (typeof value !== "string") {
|
|
2087
|
-
throw new
|
|
2233
|
+
throw new import_common13.BadRequestException(`answers["${questionId}"] must contain only strings`);
|
|
2088
2234
|
}
|
|
2089
2235
|
if (value.length > MAX_ANSWER_VALUE_LENGTH) {
|
|
2090
|
-
throw new
|
|
2236
|
+
throw new import_common13.BadRequestException(`answers["${questionId}"] values must be at most ${MAX_ANSWER_VALUE_LENGTH} characters`);
|
|
2091
2237
|
}
|
|
2092
2238
|
}
|
|
2093
2239
|
validated[questionId] = values;
|
|
@@ -2145,64 +2291,64 @@ var ToolCallController = class {
|
|
|
2145
2291
|
};
|
|
2146
2292
|
}
|
|
2147
2293
|
};
|
|
2148
|
-
|
|
2149
|
-
(0,
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2294
|
+
_ts_decorate13([
|
|
2295
|
+
(0, import_common13.Post)("approve"),
|
|
2296
|
+
_ts_param12(0, (0, import_common13.Req)()),
|
|
2297
|
+
_ts_param12(1, (0, import_common13.Body)()),
|
|
2298
|
+
_ts_metadata13("design:type", Function),
|
|
2299
|
+
_ts_metadata13("design:paramtypes", [
|
|
2154
2300
|
typeof Request === "undefined" ? Object : Request,
|
|
2155
2301
|
typeof ApproveBody === "undefined" ? Object : ApproveBody
|
|
2156
2302
|
]),
|
|
2157
|
-
|
|
2303
|
+
_ts_metadata13("design:returntype", Promise)
|
|
2158
2304
|
], ToolCallController.prototype, "approve", null);
|
|
2159
|
-
|
|
2160
|
-
(0,
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2305
|
+
_ts_decorate13([
|
|
2306
|
+
(0, import_common13.Post)("reject"),
|
|
2307
|
+
_ts_param12(0, (0, import_common13.Req)()),
|
|
2308
|
+
_ts_param12(1, (0, import_common13.Body)()),
|
|
2309
|
+
_ts_metadata13("design:type", Function),
|
|
2310
|
+
_ts_metadata13("design:paramtypes", [
|
|
2165
2311
|
typeof Request === "undefined" ? Object : Request,
|
|
2166
2312
|
typeof RejectBody === "undefined" ? Object : RejectBody
|
|
2167
2313
|
]),
|
|
2168
|
-
|
|
2314
|
+
_ts_metadata13("design:returntype", Promise)
|
|
2169
2315
|
], ToolCallController.prototype, "reject", null);
|
|
2170
|
-
|
|
2171
|
-
(0,
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2316
|
+
_ts_decorate13([
|
|
2317
|
+
(0, import_common13.Post)("answer"),
|
|
2318
|
+
_ts_param12(0, (0, import_common13.Req)()),
|
|
2319
|
+
_ts_param12(1, (0, import_common13.Body)()),
|
|
2320
|
+
_ts_metadata13("design:type", Function),
|
|
2321
|
+
_ts_metadata13("design:paramtypes", [
|
|
2176
2322
|
typeof Request === "undefined" ? Object : Request,
|
|
2177
2323
|
typeof AnswerBody === "undefined" ? Object : AnswerBody
|
|
2178
2324
|
]),
|
|
2179
|
-
|
|
2325
|
+
_ts_metadata13("design:returntype", Promise)
|
|
2180
2326
|
], ToolCallController.prototype, "answer", null);
|
|
2181
|
-
|
|
2182
|
-
(0,
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2327
|
+
_ts_decorate13([
|
|
2328
|
+
(0, import_common13.Post)("skip"),
|
|
2329
|
+
_ts_param12(0, (0, import_common13.Req)()),
|
|
2330
|
+
_ts_param12(1, (0, import_common13.Body)()),
|
|
2331
|
+
_ts_metadata13("design:type", Function),
|
|
2332
|
+
_ts_metadata13("design:paramtypes", [
|
|
2187
2333
|
typeof Request === "undefined" ? Object : Request,
|
|
2188
2334
|
Object
|
|
2189
2335
|
]),
|
|
2190
|
-
|
|
2336
|
+
_ts_metadata13("design:returntype", Promise)
|
|
2191
2337
|
], ToolCallController.prototype, "skip", null);
|
|
2192
|
-
ToolCallController =
|
|
2193
|
-
(0,
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2338
|
+
ToolCallController = _ts_decorate13([
|
|
2339
|
+
(0, import_common13.Controller)("tool-call"),
|
|
2340
|
+
_ts_param12(1, (0, import_common13.Inject)(import_nestjs_agent_core13.AGENT_ACTOR_RESOLVER)),
|
|
2341
|
+
_ts_metadata13("design:type", Function),
|
|
2342
|
+
_ts_metadata13("design:paramtypes", [
|
|
2197
2343
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
2198
2344
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
2199
2345
|
])
|
|
2200
2346
|
], ToolCallController);
|
|
2201
2347
|
|
|
2202
2348
|
// src/controller/tools.controller.ts
|
|
2203
|
-
var
|
|
2204
|
-
var
|
|
2205
|
-
function
|
|
2349
|
+
var import_nestjs_agent_core14 = require("@dudousxd/nestjs-agent-core");
|
|
2350
|
+
var import_common14 = require("@nestjs/common");
|
|
2351
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
2206
2352
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2207
2353
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2208
2354
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2215,19 +2361,19 @@ function _ts_decorate13(decorators, target, key, desc) {
|
|
|
2215
2361
|
}
|
|
2216
2362
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2217
2363
|
}
|
|
2218
|
-
__name(
|
|
2219
|
-
function
|
|
2364
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
2365
|
+
function _ts_metadata14(metadataKey, metadataValue) {
|
|
2220
2366
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2221
2367
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
2222
2368
|
}
|
|
2223
2369
|
}
|
|
2224
|
-
__name(
|
|
2225
|
-
function
|
|
2370
|
+
__name(_ts_metadata14, "_ts_metadata");
|
|
2371
|
+
function _ts_param13(paramIndex, decorator) {
|
|
2226
2372
|
return function(target, key) {
|
|
2227
2373
|
decorator(target, key, paramIndex);
|
|
2228
2374
|
};
|
|
2229
2375
|
}
|
|
2230
|
-
__name(
|
|
2376
|
+
__name(_ts_param13, "_ts_param");
|
|
2231
2377
|
var ToolsController = class {
|
|
2232
2378
|
static {
|
|
2233
2379
|
__name(this, "ToolsController");
|
|
@@ -2242,7 +2388,7 @@ var ToolsController = class {
|
|
|
2242
2388
|
}
|
|
2243
2389
|
async list(req, agent) {
|
|
2244
2390
|
if (agent !== void 0 && this.agents.get(agent) === void 0) {
|
|
2245
|
-
throw new
|
|
2391
|
+
throw new import_common14.NotFoundException(`No agent named "${agent}"`);
|
|
2246
2392
|
}
|
|
2247
2393
|
const actor = await this.actorResolver.resolve(req);
|
|
2248
2394
|
const deps = this.depsFactory.forAgent(agent);
|
|
@@ -2256,33 +2402,33 @@ var ToolsController = class {
|
|
|
2256
2402
|
}));
|
|
2257
2403
|
}
|
|
2258
2404
|
};
|
|
2259
|
-
|
|
2260
|
-
(0,
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2405
|
+
_ts_decorate14([
|
|
2406
|
+
(0, import_common14.Get)(),
|
|
2407
|
+
_ts_param13(0, (0, import_common14.Req)()),
|
|
2408
|
+
_ts_param13(1, (0, import_common14.Query)("agent")),
|
|
2409
|
+
_ts_metadata14("design:type", Function),
|
|
2410
|
+
_ts_metadata14("design:paramtypes", [
|
|
2265
2411
|
typeof Request === "undefined" ? Object : Request,
|
|
2266
2412
|
String
|
|
2267
2413
|
]),
|
|
2268
|
-
|
|
2414
|
+
_ts_metadata14("design:returntype", Promise)
|
|
2269
2415
|
], ToolsController.prototype, "list", null);
|
|
2270
|
-
ToolsController =
|
|
2271
|
-
(0,
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2416
|
+
ToolsController = _ts_decorate14([
|
|
2417
|
+
(0, import_common14.Controller)("tools"),
|
|
2418
|
+
_ts_param13(0, (0, import_common14.Inject)(import_nestjs_agent_core14.AGENT_ACTOR_RESOLVER)),
|
|
2419
|
+
_ts_param13(1, (0, import_common14.Inject)(import_nestjs_agent_core14.AGENT_DEPS_FACTORY)),
|
|
2420
|
+
_ts_param13(2, (0, import_common14.Inject)(import_nestjs_agent_core14.AGENT_REGISTRY)),
|
|
2421
|
+
_ts_metadata14("design:type", Function),
|
|
2422
|
+
_ts_metadata14("design:paramtypes", [
|
|
2277
2423
|
typeof ActorResolver === "undefined" ? Object : ActorResolver,
|
|
2278
2424
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
2279
|
-
typeof
|
|
2425
|
+
typeof import_nestjs_agent_core14.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core14.AgentRegistry
|
|
2280
2426
|
])
|
|
2281
2427
|
], ToolsController);
|
|
2282
2428
|
|
|
2283
2429
|
// src/discovery/agent-discovery.service.ts
|
|
2284
|
-
var
|
|
2285
|
-
var
|
|
2430
|
+
var import_nestjs_agent_core15 = require("@dudousxd/nestjs-agent-core");
|
|
2431
|
+
var import_common15 = require("@nestjs/common");
|
|
2286
2432
|
var import_core = require("@nestjs/core");
|
|
2287
2433
|
|
|
2288
2434
|
// src/decorator/agent.decorator.ts
|
|
@@ -2317,7 +2463,7 @@ function SystemPromptContributor() {
|
|
|
2317
2463
|
__name(SystemPromptContributor, "SystemPromptContributor");
|
|
2318
2464
|
|
|
2319
2465
|
// src/discovery/agent-discovery.service.ts
|
|
2320
|
-
function
|
|
2466
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
2321
2467
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2322
2468
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2323
2469
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2330,19 +2476,19 @@ function _ts_decorate14(decorators, target, key, desc) {
|
|
|
2330
2476
|
}
|
|
2331
2477
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2332
2478
|
}
|
|
2333
|
-
__name(
|
|
2334
|
-
function
|
|
2479
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
2480
|
+
function _ts_metadata15(metadataKey, metadataValue) {
|
|
2335
2481
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2336
2482
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
2337
2483
|
}
|
|
2338
2484
|
}
|
|
2339
|
-
__name(
|
|
2340
|
-
function
|
|
2485
|
+
__name(_ts_metadata15, "_ts_metadata");
|
|
2486
|
+
function _ts_param14(paramIndex, decorator) {
|
|
2341
2487
|
return function(target, key) {
|
|
2342
2488
|
decorator(target, key, paramIndex);
|
|
2343
2489
|
};
|
|
2344
2490
|
}
|
|
2345
|
-
__name(
|
|
2491
|
+
__name(_ts_param14, "_ts_param");
|
|
2346
2492
|
var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
2347
2493
|
static {
|
|
2348
2494
|
__name(this, "AgentDiscoveryService");
|
|
@@ -2351,7 +2497,7 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
2351
2497
|
scanner;
|
|
2352
2498
|
registry;
|
|
2353
2499
|
contributors;
|
|
2354
|
-
logger = new
|
|
2500
|
+
logger = new import_common15.Logger(_AgentDiscoveryService.name);
|
|
2355
2501
|
constructor(discovery, scanner, registry, contributors) {
|
|
2356
2502
|
this.discovery = discovery;
|
|
2357
2503
|
this.scanner = scanner;
|
|
@@ -2469,22 +2615,22 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
2469
2615
|
return (ctx) => candidate.call(instance, ctx);
|
|
2470
2616
|
}
|
|
2471
2617
|
};
|
|
2472
|
-
AgentDiscoveryService =
|
|
2473
|
-
(0,
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2618
|
+
AgentDiscoveryService = _ts_decorate15([
|
|
2619
|
+
(0, import_common15.Injectable)(),
|
|
2620
|
+
_ts_param14(2, (0, import_common15.Inject)(import_nestjs_agent_core15.AGENT_REGISTRY)),
|
|
2621
|
+
_ts_param14(3, (0, import_common15.Inject)(import_nestjs_agent_core15.AGENT_PROMPT_CONTRIBUTORS)),
|
|
2622
|
+
_ts_metadata15("design:type", Function),
|
|
2623
|
+
_ts_metadata15("design:paramtypes", [
|
|
2478
2624
|
typeof import_core.DiscoveryService === "undefined" ? Object : import_core.DiscoveryService,
|
|
2479
2625
|
typeof import_core.MetadataScanner === "undefined" ? Object : import_core.MetadataScanner,
|
|
2480
|
-
typeof
|
|
2626
|
+
typeof import_nestjs_agent_core15.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core15.AgentRegistry,
|
|
2481
2627
|
Array
|
|
2482
2628
|
])
|
|
2483
2629
|
], AgentDiscoveryService);
|
|
2484
2630
|
|
|
2485
2631
|
// src/discovery/ai-tool-discovery.service.ts
|
|
2486
|
-
var
|
|
2487
|
-
var
|
|
2632
|
+
var import_nestjs_agent_core16 = require("@dudousxd/nestjs-agent-core");
|
|
2633
|
+
var import_common16 = require("@nestjs/common");
|
|
2488
2634
|
var import_core2 = require("@nestjs/core");
|
|
2489
2635
|
var import_zod = require("zod");
|
|
2490
2636
|
|
|
@@ -2533,7 +2679,7 @@ function provideAgentTool(factoryOrTool, inject) {
|
|
|
2533
2679
|
__name(provideAgentTool, "provideAgentTool");
|
|
2534
2680
|
|
|
2535
2681
|
// src/discovery/ai-tool-discovery.service.ts
|
|
2536
|
-
function
|
|
2682
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
2537
2683
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2538
2684
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2539
2685
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2546,19 +2692,19 @@ function _ts_decorate15(decorators, target, key, desc) {
|
|
|
2546
2692
|
}
|
|
2547
2693
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2548
2694
|
}
|
|
2549
|
-
__name(
|
|
2550
|
-
function
|
|
2695
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
2696
|
+
function _ts_metadata16(metadataKey, metadataValue) {
|
|
2551
2697
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2552
2698
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
2553
2699
|
}
|
|
2554
2700
|
}
|
|
2555
|
-
__name(
|
|
2556
|
-
function
|
|
2701
|
+
__name(_ts_metadata16, "_ts_metadata");
|
|
2702
|
+
function _ts_param15(paramIndex, decorator) {
|
|
2557
2703
|
return function(target, key) {
|
|
2558
2704
|
decorator(target, key, paramIndex);
|
|
2559
2705
|
};
|
|
2560
2706
|
}
|
|
2561
|
-
__name(
|
|
2707
|
+
__name(_ts_param15, "_ts_param");
|
|
2562
2708
|
var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
2563
2709
|
static {
|
|
2564
2710
|
__name(this, "AiToolDiscoveryService");
|
|
@@ -2567,7 +2713,7 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
2567
2713
|
registry;
|
|
2568
2714
|
agents;
|
|
2569
2715
|
options;
|
|
2570
|
-
logger = new
|
|
2716
|
+
logger = new import_common16.Logger(_AiToolDiscoveryService.name);
|
|
2571
2717
|
constructor(discovery, registry, agents, options) {
|
|
2572
2718
|
this.discovery = discovery;
|
|
2573
2719
|
this.registry = registry;
|
|
@@ -2641,7 +2787,7 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
2641
2787
|
let delegates = 0;
|
|
2642
2788
|
for (const definition of this.agents.list()) {
|
|
2643
2789
|
for (const edge of definition.delegatesTo ?? []) {
|
|
2644
|
-
const { agent: target, detached } = (0,
|
|
2790
|
+
const { agent: target, detached } = (0, import_nestjs_agent_core16.normalizeDelegation)(edge);
|
|
2645
2791
|
const targetDefinition = this.agents.get(target);
|
|
2646
2792
|
if (targetDefinition === void 0) {
|
|
2647
2793
|
throw new Error(`Agent "${definition.name}" hands off to "${target}", which is not a registered @Agent. Declare it as an @Agent provider or fix the reference.`);
|
|
@@ -2691,13 +2837,13 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
2691
2837
|
return true;
|
|
2692
2838
|
}
|
|
2693
2839
|
};
|
|
2694
|
-
AiToolDiscoveryService =
|
|
2695
|
-
(0,
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2840
|
+
AiToolDiscoveryService = _ts_decorate16([
|
|
2841
|
+
(0, import_common16.Injectable)(),
|
|
2842
|
+
_ts_param15(1, (0, import_common16.Inject)(import_nestjs_agent_core16.AGENT_TOOL_REGISTRY)),
|
|
2843
|
+
_ts_param15(2, (0, import_common16.Inject)(import_nestjs_agent_core16.AGENT_REGISTRY)),
|
|
2844
|
+
_ts_param15(3, (0, import_common16.Inject)(import_nestjs_agent_core16.AGENT_OPTIONS)),
|
|
2845
|
+
_ts_metadata16("design:type", Function),
|
|
2846
|
+
_ts_metadata16("design:paramtypes", [
|
|
2701
2847
|
typeof import_core2.DiscoveryService === "undefined" ? Object : import_core2.DiscoveryService,
|
|
2702
2848
|
typeof ToolRegistry === "undefined" ? Object : ToolRegistry,
|
|
2703
2849
|
typeof AgentRegistry === "undefined" ? Object : AgentRegistry,
|
|
@@ -2706,13 +2852,13 @@ AiToolDiscoveryService = _ts_decorate15([
|
|
|
2706
2852
|
], AiToolDiscoveryService);
|
|
2707
2853
|
|
|
2708
2854
|
// src/discovery/skill-discovery.service.ts
|
|
2709
|
-
var
|
|
2710
|
-
var
|
|
2855
|
+
var import_nestjs_agent_core18 = require("@dudousxd/nestjs-agent-core");
|
|
2856
|
+
var import_common17 = require("@nestjs/common");
|
|
2711
2857
|
var import_core3 = require("@nestjs/core");
|
|
2712
2858
|
|
|
2713
2859
|
// src/decorator/skill.decorator.ts
|
|
2714
2860
|
var import_reflect_metadata4 = require("reflect-metadata");
|
|
2715
|
-
var
|
|
2861
|
+
var import_nestjs_agent_core17 = require("@dudousxd/nestjs-agent-core");
|
|
2716
2862
|
var SKILL_METADATA = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:skill-metadata");
|
|
2717
2863
|
function Skill(options) {
|
|
2718
2864
|
return (target) => {
|
|
@@ -2725,12 +2871,12 @@ function readSkillMetadata(target) {
|
|
|
2725
2871
|
}
|
|
2726
2872
|
__name(readSkillMetadata, "readSkillMetadata");
|
|
2727
2873
|
function skillScope(options) {
|
|
2728
|
-
return options.scope ??
|
|
2874
|
+
return options.scope ?? import_nestjs_agent_core17.GLOBAL_SCOPE;
|
|
2729
2875
|
}
|
|
2730
2876
|
__name(skillScope, "skillScope");
|
|
2731
2877
|
|
|
2732
2878
|
// src/discovery/skill-discovery.service.ts
|
|
2733
|
-
function
|
|
2879
|
+
function _ts_decorate17(decorators, target, key, desc) {
|
|
2734
2880
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2735
2881
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2736
2882
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2743,26 +2889,26 @@ function _ts_decorate16(decorators, target, key, desc) {
|
|
|
2743
2889
|
}
|
|
2744
2890
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2745
2891
|
}
|
|
2746
|
-
__name(
|
|
2747
|
-
function
|
|
2892
|
+
__name(_ts_decorate17, "_ts_decorate");
|
|
2893
|
+
function _ts_metadata17(metadataKey, metadataValue) {
|
|
2748
2894
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2749
2895
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
2750
2896
|
}
|
|
2751
2897
|
}
|
|
2752
|
-
__name(
|
|
2753
|
-
function
|
|
2898
|
+
__name(_ts_metadata17, "_ts_metadata");
|
|
2899
|
+
function _ts_param16(paramIndex, decorator) {
|
|
2754
2900
|
return function(target, key) {
|
|
2755
2901
|
decorator(target, key, paramIndex);
|
|
2756
2902
|
};
|
|
2757
2903
|
}
|
|
2758
|
-
__name(
|
|
2904
|
+
__name(_ts_param16, "_ts_param");
|
|
2759
2905
|
var SkillDiscoveryService = class _SkillDiscoveryService {
|
|
2760
2906
|
static {
|
|
2761
2907
|
__name(this, "SkillDiscoveryService");
|
|
2762
2908
|
}
|
|
2763
2909
|
discovery;
|
|
2764
2910
|
declared;
|
|
2765
|
-
logger = new
|
|
2911
|
+
logger = new import_common17.Logger(_SkillDiscoveryService.name);
|
|
2766
2912
|
constructor(discovery, declared) {
|
|
2767
2913
|
this.discovery = discovery;
|
|
2768
2914
|
this.declared = declared;
|
|
@@ -2799,18 +2945,18 @@ var SkillDiscoveryService = class _SkillDiscoveryService {
|
|
|
2799
2945
|
return flat === void 0 ? void 0 : () => flat;
|
|
2800
2946
|
}
|
|
2801
2947
|
};
|
|
2802
|
-
SkillDiscoveryService =
|
|
2803
|
-
(0,
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2948
|
+
SkillDiscoveryService = _ts_decorate17([
|
|
2949
|
+
(0, import_common17.Injectable)(),
|
|
2950
|
+
_ts_param16(1, (0, import_common17.Inject)(import_nestjs_agent_core18.AGENT_SKILL_SOURCES)),
|
|
2951
|
+
_ts_metadata17("design:type", Function),
|
|
2952
|
+
_ts_metadata17("design:paramtypes", [
|
|
2807
2953
|
typeof import_core3.DiscoveryService === "undefined" ? Object : import_core3.DiscoveryService,
|
|
2808
2954
|
Array
|
|
2809
2955
|
])
|
|
2810
2956
|
], SkillDiscoveryService);
|
|
2811
2957
|
|
|
2812
2958
|
// src/in-process-sink.ts
|
|
2813
|
-
var
|
|
2959
|
+
var import_nestjs_agent_core19 = require("@dudousxd/nestjs-agent-core");
|
|
2814
2960
|
var InProcessTokenStreamSink = class {
|
|
2815
2961
|
static {
|
|
2816
2962
|
__name(this, "InProcessTokenStreamSink");
|
|
@@ -2865,7 +3011,7 @@ var InProcessTokenStreamSink = class {
|
|
|
2865
3011
|
}
|
|
2866
3012
|
if (buf.ended) {
|
|
2867
3013
|
if (buf.failure !== void 0) {
|
|
2868
|
-
throw new
|
|
3014
|
+
throw new import_nestjs_agent_core19.AgentStreamError(buf.failure);
|
|
2869
3015
|
}
|
|
2870
3016
|
return;
|
|
2871
3017
|
}
|
|
@@ -2901,9 +3047,9 @@ var LedgerQuotaStore = class {
|
|
|
2901
3047
|
};
|
|
2902
3048
|
|
|
2903
3049
|
// src/runner/inline-agent-runner.ts
|
|
2904
|
-
var
|
|
2905
|
-
var
|
|
2906
|
-
function
|
|
3050
|
+
var import_nestjs_agent_core20 = require("@dudousxd/nestjs-agent-core");
|
|
3051
|
+
var import_common18 = require("@nestjs/common");
|
|
3052
|
+
function _ts_decorate18(decorators, target, key, desc) {
|
|
2907
3053
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2908
3054
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2909
3055
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2916,26 +3062,26 @@ function _ts_decorate17(decorators, target, key, desc) {
|
|
|
2916
3062
|
}
|
|
2917
3063
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2918
3064
|
}
|
|
2919
|
-
__name(
|
|
2920
|
-
function
|
|
3065
|
+
__name(_ts_decorate18, "_ts_decorate");
|
|
3066
|
+
function _ts_metadata18(metadataKey, metadataValue) {
|
|
2921
3067
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2922
3068
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
2923
3069
|
}
|
|
2924
3070
|
}
|
|
2925
|
-
__name(
|
|
2926
|
-
function
|
|
3071
|
+
__name(_ts_metadata18, "_ts_metadata");
|
|
3072
|
+
function _ts_param17(paramIndex, decorator) {
|
|
2927
3073
|
return function(target, key) {
|
|
2928
3074
|
decorator(target, key, paramIndex);
|
|
2929
3075
|
};
|
|
2930
3076
|
}
|
|
2931
|
-
__name(
|
|
3077
|
+
__name(_ts_param17, "_ts_param");
|
|
2932
3078
|
var InlineAgentRunner = class _InlineAgentRunner {
|
|
2933
3079
|
static {
|
|
2934
3080
|
__name(this, "InlineAgentRunner");
|
|
2935
3081
|
}
|
|
2936
3082
|
factory;
|
|
2937
3083
|
store;
|
|
2938
|
-
logger = new
|
|
3084
|
+
logger = new import_common18.Logger(_InlineAgentRunner.name);
|
|
2939
3085
|
pending = /* @__PURE__ */ new Map();
|
|
2940
3086
|
/**
|
|
2941
3087
|
* Runs someone has asked to stop. In-process, like `pending`, and for the same reason: this runner
|
|
@@ -2964,18 +3110,18 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
2964
3110
|
] : []
|
|
2965
3111
|
]
|
|
2966
3112
|
});
|
|
2967
|
-
void (0,
|
|
3113
|
+
void (0, import_nestjs_agent_core20.runAgentLoop)({
|
|
2968
3114
|
...deps,
|
|
2969
3115
|
day
|
|
2970
3116
|
}, input, hooks).then(() => this.store.setActiveStream(input.threadId, null)).catch(async (error) => {
|
|
2971
|
-
if (error instanceof
|
|
3117
|
+
if (error instanceof import_nestjs_agent_core20.RunCancelledError) {
|
|
2972
3118
|
await this.settleCancelled(runId, input.threadId, deps);
|
|
2973
3119
|
return;
|
|
2974
3120
|
}
|
|
2975
3121
|
const message = error instanceof Error ? error.message : String(error);
|
|
2976
|
-
const code = (0,
|
|
3122
|
+
const code = (0, import_nestjs_agent_core20.agentFailureCode)(error);
|
|
2977
3123
|
this.logger.error(`agent run ${runId} failed (${code}): ${message}`);
|
|
2978
|
-
(0,
|
|
3124
|
+
(0, import_nestjs_agent_core20.publishAgentRunFailed)({
|
|
2979
3125
|
runId,
|
|
2980
3126
|
code,
|
|
2981
3127
|
message
|
|
@@ -3024,7 +3170,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3024
3170
|
for (const [key, waiter] of this.pending) {
|
|
3025
3171
|
if (key.startsWith(`${runId}:`)) {
|
|
3026
3172
|
this.pending.delete(key);
|
|
3027
|
-
waiter.reject(new
|
|
3173
|
+
waiter.reject(new import_nestjs_agent_core20.RunCancelledError());
|
|
3028
3174
|
}
|
|
3029
3175
|
}
|
|
3030
3176
|
await Promise.resolve();
|
|
@@ -3039,7 +3185,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3039
3185
|
this.logger.log(`agent run ${runId} cancelled`);
|
|
3040
3186
|
await this.store.setActiveStream(threadId, null);
|
|
3041
3187
|
const writer = await deps.sink.open(runId);
|
|
3042
|
-
await writer.write((0,
|
|
3188
|
+
await writer.write((0, import_nestjs_agent_core20.encodeStreamEvent)({
|
|
3043
3189
|
kind: "cancelled"
|
|
3044
3190
|
}));
|
|
3045
3191
|
await writer.end();
|
|
@@ -3100,7 +3246,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3100
3246
|
awaitApproval: /* @__PURE__ */ __name((call, _ctx, opts) => this.parkApproval(runId, call.id, opts?.timeoutMs), "awaitApproval"),
|
|
3101
3247
|
awaitAnswers: /* @__PURE__ */ __name((request) => this.park(runId, request.id), "awaitAnswers"),
|
|
3102
3248
|
step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
|
|
3103
|
-
parallel:
|
|
3249
|
+
parallel: import_nestjs_agent_core20.settleAll,
|
|
3104
3250
|
cancelled: /* @__PURE__ */ __name(async () => this.cancelled.has(runId), "cancelled"),
|
|
3105
3251
|
runAgent: /* @__PURE__ */ __name((agentName, task) => this.runNested({
|
|
3106
3252
|
agentName,
|
|
@@ -3151,7 +3297,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3151
3297
|
awaitApproval: /* @__PURE__ */ __name((call, _ctx, opts) => this.parkApproval(runId, call.id, opts?.timeoutMs), "awaitApproval"),
|
|
3152
3298
|
awaitAnswers: /* @__PURE__ */ __name((request) => this.park(runId, request.id), "awaitAnswers"),
|
|
3153
3299
|
step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
|
|
3154
|
-
parallel:
|
|
3300
|
+
parallel: import_nestjs_agent_core20.settleAll,
|
|
3155
3301
|
cancelled: /* @__PURE__ */ __name(async () => this.cancelled.has(runId), "cancelled"),
|
|
3156
3302
|
runAgent: /* @__PURE__ */ __name((childName, childTask) => this.runNested({
|
|
3157
3303
|
agentName: childName,
|
|
@@ -3184,7 +3330,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3184
3330
|
}
|
|
3185
3331
|
}), "startAgent")
|
|
3186
3332
|
};
|
|
3187
|
-
void (0,
|
|
3333
|
+
void (0, import_nestjs_agent_core20.runAgentLoop)({
|
|
3188
3334
|
...deps,
|
|
3189
3335
|
day
|
|
3190
3336
|
}, {
|
|
@@ -3198,13 +3344,13 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3198
3344
|
parentRunId,
|
|
3199
3345
|
deliverTo
|
|
3200
3346
|
}, hooks).catch(async (error) => {
|
|
3201
|
-
const cancelled = error instanceof
|
|
3347
|
+
const cancelled = error instanceof import_nestjs_agent_core20.RunCancelledError;
|
|
3202
3348
|
const message = error instanceof Error ? error.message : String(error);
|
|
3203
3349
|
if (!cancelled) {
|
|
3204
3350
|
this.logger.error(`detached agent run ${runId} failed: ${message}`);
|
|
3205
|
-
(0,
|
|
3351
|
+
(0, import_nestjs_agent_core20.publishAgentRunFailed)({
|
|
3206
3352
|
runId,
|
|
3207
|
-
code: (0,
|
|
3353
|
+
code: (0, import_nestjs_agent_core20.agentFailureCode)(error),
|
|
3208
3354
|
message
|
|
3209
3355
|
});
|
|
3210
3356
|
}
|
|
@@ -3212,11 +3358,11 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3212
3358
|
runId,
|
|
3213
3359
|
status: cancelled ? "cancelled" : "failed",
|
|
3214
3360
|
...cancelled ? {} : {
|
|
3215
|
-
errorCode: (0,
|
|
3361
|
+
errorCode: (0, import_nestjs_agent_core20.agentFailureCode)(error),
|
|
3216
3362
|
errorMessage: message
|
|
3217
3363
|
}
|
|
3218
3364
|
});
|
|
3219
|
-
await (0,
|
|
3365
|
+
await (0, import_nestjs_agent_core20.settleUnsettledDelegation)({
|
|
3220
3366
|
store: this.store,
|
|
3221
3367
|
delivery: deliverTo,
|
|
3222
3368
|
agent: agentName,
|
|
@@ -3255,7 +3401,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3255
3401
|
awaitApproval: /* @__PURE__ */ __name((call, _ctx, opts) => this.parkApproval(runId, call.id, opts?.timeoutMs), "awaitApproval"),
|
|
3256
3402
|
awaitAnswers: /* @__PURE__ */ __name((request) => this.park(runId, request.id), "awaitAnswers"),
|
|
3257
3403
|
step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
|
|
3258
|
-
parallel:
|
|
3404
|
+
parallel: import_nestjs_agent_core20.settleAll,
|
|
3259
3405
|
// A child stops when it is cancelled OR when the run a human is actually watching is: the
|
|
3260
3406
|
// canceller names the top-level run, which is the only id that ever left the server.
|
|
3261
3407
|
cancelled: /* @__PURE__ */ __name(async () => this.cancelled.has(runId) || this.cancelled.has(sinkRunId), "cancelled"),
|
|
@@ -3290,7 +3436,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3290
3436
|
}), "startAgent")
|
|
3291
3437
|
};
|
|
3292
3438
|
try {
|
|
3293
|
-
return await (0,
|
|
3439
|
+
return await (0, import_nestjs_agent_core20.runAgentLoop)({
|
|
3294
3440
|
...deps,
|
|
3295
3441
|
day
|
|
3296
3442
|
}, {
|
|
@@ -3309,19 +3455,19 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3309
3455
|
}
|
|
3310
3456
|
}
|
|
3311
3457
|
};
|
|
3312
|
-
InlineAgentRunner =
|
|
3313
|
-
(0,
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3458
|
+
InlineAgentRunner = _ts_decorate18([
|
|
3459
|
+
(0, import_common18.Injectable)(),
|
|
3460
|
+
_ts_param17(0, (0, import_common18.Inject)(import_nestjs_agent_core20.AGENT_DEPS_FACTORY)),
|
|
3461
|
+
_ts_param17(1, (0, import_common18.Inject)(import_nestjs_agent_core20.AGENT_STORE)),
|
|
3462
|
+
_ts_metadata18("design:type", Function),
|
|
3463
|
+
_ts_metadata18("design:paramtypes", [
|
|
3318
3464
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
3319
3465
|
typeof AgentStore === "undefined" ? Object : AgentStore
|
|
3320
3466
|
])
|
|
3321
3467
|
], InlineAgentRunner);
|
|
3322
3468
|
|
|
3323
3469
|
// src/skills-config.ts
|
|
3324
|
-
var
|
|
3470
|
+
var import_nestjs_agent_core21 = require("@dudousxd/nestjs-agent-core");
|
|
3325
3471
|
function declaredSkillProvider(declared) {
|
|
3326
3472
|
return {
|
|
3327
3473
|
list: /* @__PURE__ */ __name(({ scopes }) => declared.filter((skill) => scopes.includes(skill.scope)).map(({ name, description, scope }) => ({
|
|
@@ -3347,7 +3493,7 @@ function resolveSkillsConfig(options, declared) {
|
|
|
3347
3493
|
declaredSkillProvider(declared)
|
|
3348
3494
|
];
|
|
3349
3495
|
return {
|
|
3350
|
-
provider: providers.length === 1 ? providers[0] : (0,
|
|
3496
|
+
provider: providers.length === 1 ? providers[0] : (0, import_nestjs_agent_core21.compositeSkillProvider)(providers),
|
|
3351
3497
|
...options.scopes !== void 0 ? {
|
|
3352
3498
|
scopes: options.scopes
|
|
3353
3499
|
} : {},
|
|
@@ -3359,7 +3505,7 @@ function resolveSkillsConfig(options, declared) {
|
|
|
3359
3505
|
__name(resolveSkillsConfig, "resolveSkillsConfig");
|
|
3360
3506
|
|
|
3361
3507
|
// src/agent.module.ts
|
|
3362
|
-
function
|
|
3508
|
+
function _ts_decorate19(decorators, target, key, desc) {
|
|
3363
3509
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3364
3510
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3365
3511
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3372,92 +3518,99 @@ function _ts_decorate18(decorators, target, key, desc) {
|
|
|
3372
3518
|
}
|
|
3373
3519
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3374
3520
|
}
|
|
3375
|
-
__name(
|
|
3521
|
+
__name(_ts_decorate19, "_ts_decorate");
|
|
3376
3522
|
var DEFAULT_PATH = "agent";
|
|
3377
3523
|
function sharedProviders(durable, includeStore) {
|
|
3378
3524
|
const providers = [
|
|
3379
3525
|
{
|
|
3380
|
-
provide:
|
|
3381
|
-
useFactory: /* @__PURE__ */ __name(() => new
|
|
3526
|
+
provide: import_nestjs_agent_core22.AGENT_TOOL_REGISTRY,
|
|
3527
|
+
useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core22.ToolRegistry(), "useFactory")
|
|
3382
3528
|
},
|
|
3383
3529
|
// Starts empty; AgentDiscoveryService populates it from `@Agent`-decorated providers at boot.
|
|
3384
3530
|
{
|
|
3385
|
-
provide:
|
|
3386
|
-
useFactory: /* @__PURE__ */ __name(() => new
|
|
3531
|
+
provide: import_nestjs_agent_core22.AGENT_REGISTRY,
|
|
3532
|
+
useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core22.AgentRegistry(), "useFactory")
|
|
3387
3533
|
},
|
|
3388
3534
|
// A shared, mutable list AgentDiscoveryService fills with `@SystemPromptContributor()` methods.
|
|
3389
3535
|
{
|
|
3390
|
-
provide:
|
|
3536
|
+
provide: import_nestjs_agent_core22.AGENT_PROMPT_CONTRIBUTORS,
|
|
3391
3537
|
useFactory: /* @__PURE__ */ __name(() => [], "useFactory")
|
|
3392
3538
|
},
|
|
3393
3539
|
// Likewise for `@Skill`-decorated providers — filled by SkillDiscoveryService at onModuleInit,
|
|
3394
3540
|
// read lazily by the AGENT_SKILLS provider below (which DI builds before discovery has run).
|
|
3395
3541
|
{
|
|
3396
|
-
provide:
|
|
3542
|
+
provide: import_nestjs_agent_core22.AGENT_SKILL_SOURCES,
|
|
3397
3543
|
useFactory: /* @__PURE__ */ __name(() => [], "useFactory")
|
|
3398
3544
|
},
|
|
3399
3545
|
{
|
|
3400
3546
|
// One resolution, shared by the loop's deps and the listing endpoint: a second one would
|
|
3401
3547
|
// drift, and a user would be offered a skill the agent cannot reach. `undefined` when the
|
|
3402
3548
|
// host configured none — which is what keeps the turn's checkpoint sequence unchanged.
|
|
3403
|
-
provide:
|
|
3549
|
+
provide: import_nestjs_agent_core22.AGENT_SKILLS,
|
|
3404
3550
|
useFactory: /* @__PURE__ */ __name((options, declared) => resolveSkillsConfig(options.skills, declared), "useFactory"),
|
|
3405
3551
|
inject: [
|
|
3406
|
-
|
|
3407
|
-
|
|
3552
|
+
import_nestjs_agent_core22.AGENT_OPTIONS,
|
|
3553
|
+
import_nestjs_agent_core22.AGENT_SKILL_SOURCES
|
|
3408
3554
|
]
|
|
3409
3555
|
},
|
|
3410
3556
|
{
|
|
3411
3557
|
// One resolution, shared by the loop's deps and the read-back endpoint: a person has to be
|
|
3412
3558
|
// shown what the model was shown, and two resolutions would eventually disagree about that.
|
|
3413
|
-
provide:
|
|
3559
|
+
provide: import_nestjs_agent_core22.AGENT_MEMORY,
|
|
3414
3560
|
useFactory: /* @__PURE__ */ __name((options) => options.memory, "useFactory"),
|
|
3415
3561
|
inject: [
|
|
3416
|
-
|
|
3562
|
+
import_nestjs_agent_core22.AGENT_OPTIONS
|
|
3417
3563
|
]
|
|
3418
3564
|
},
|
|
3419
3565
|
{
|
|
3420
|
-
provide:
|
|
3566
|
+
provide: import_nestjs_agent_core22.AGENT_SINK,
|
|
3421
3567
|
useFactory: /* @__PURE__ */ __name((options) => options.sink ?? new InProcessTokenStreamSink(), "useFactory"),
|
|
3422
3568
|
inject: [
|
|
3423
|
-
|
|
3569
|
+
import_nestjs_agent_core22.AGENT_OPTIONS
|
|
3424
3570
|
]
|
|
3425
3571
|
},
|
|
3426
3572
|
{
|
|
3427
|
-
provide:
|
|
3428
|
-
useFactory: /* @__PURE__ */ __name((options) => options.rolesPolicy ?? new
|
|
3573
|
+
provide: import_nestjs_agent_core22.AGENT_ROLES_POLICY,
|
|
3574
|
+
useFactory: /* @__PURE__ */ __name((options) => options.rolesPolicy ?? new import_nestjs_agent_core22.DefaultRolesPolicy(options.defaultRoles), "useFactory"),
|
|
3429
3575
|
inject: [
|
|
3430
|
-
|
|
3576
|
+
import_nestjs_agent_core22.AGENT_OPTIONS
|
|
3431
3577
|
]
|
|
3432
3578
|
},
|
|
3433
3579
|
{
|
|
3434
|
-
provide:
|
|
3580
|
+
provide: import_nestjs_agent_core22.AGENT_ACTOR_RESOLVER,
|
|
3435
3581
|
useFactory: /* @__PURE__ */ __name((options) => options.actorResolver, "useFactory"),
|
|
3436
3582
|
inject: [
|
|
3437
|
-
|
|
3583
|
+
import_nestjs_agent_core22.AGENT_OPTIONS
|
|
3438
3584
|
]
|
|
3439
3585
|
},
|
|
3440
3586
|
{
|
|
3441
|
-
provide:
|
|
3587
|
+
provide: import_nestjs_agent_core22.AGENT_MODEL,
|
|
3442
3588
|
useFactory: /* @__PURE__ */ __name((o) => o.model, "useFactory"),
|
|
3443
3589
|
inject: [
|
|
3444
|
-
|
|
3590
|
+
import_nestjs_agent_core22.AGENT_OPTIONS
|
|
3445
3591
|
]
|
|
3446
3592
|
},
|
|
3447
3593
|
{
|
|
3448
3594
|
// An explicit `quota` wins; otherwise `quotaLimitTokens` binds the built-in ledger-backed
|
|
3449
3595
|
// store; otherwise quotas are off (undefined). The ledger store reads the same usage rows
|
|
3450
3596
|
// the loop already writes, so enforcement needs no extra shared state across replicas.
|
|
3451
|
-
provide:
|
|
3597
|
+
provide: import_nestjs_agent_core22.AGENT_QUOTA_STORE,
|
|
3452
3598
|
useFactory: /* @__PURE__ */ __name((o, store) => o.quota ?? (o.quotaLimitTokens !== void 0 ? new LedgerQuotaStore(store, o.quotaLimitTokens) : void 0), "useFactory"),
|
|
3453
3599
|
inject: [
|
|
3454
|
-
|
|
3455
|
-
|
|
3600
|
+
import_nestjs_agent_core22.AGENT_OPTIONS,
|
|
3601
|
+
import_nestjs_agent_core22.AGENT_STORE
|
|
3602
|
+
]
|
|
3603
|
+
},
|
|
3604
|
+
{
|
|
3605
|
+
provide: import_nestjs_agent_core22.AGENT_MODEL_CATALOG,
|
|
3606
|
+
useFactory: /* @__PURE__ */ __name((o) => o.models, "useFactory"),
|
|
3607
|
+
inject: [
|
|
3608
|
+
import_nestjs_agent_core22.AGENT_OPTIONS
|
|
3456
3609
|
]
|
|
3457
3610
|
},
|
|
3458
3611
|
AgentDepsFactory2,
|
|
3459
3612
|
{
|
|
3460
|
-
provide:
|
|
3613
|
+
provide: import_nestjs_agent_core22.AGENT_DEPS_FACTORY,
|
|
3461
3614
|
useExisting: AgentDepsFactory2
|
|
3462
3615
|
},
|
|
3463
3616
|
// Populates the registry + contributors (onModuleInit) BEFORE AiToolDiscoveryService synthesizes
|
|
@@ -3471,22 +3624,22 @@ function sharedProviders(durable, includeStore) {
|
|
|
3471
3624
|
// through AgentService.signalToolCall, which reaches whichever AGENT_RUNNER is bound above.
|
|
3472
3625
|
AgentApprovalPortAdapter,
|
|
3473
3626
|
{
|
|
3474
|
-
provide:
|
|
3627
|
+
provide: import_nestjs_agent_core22.AGENT_APPROVAL_PORT,
|
|
3475
3628
|
useExisting: AgentApprovalPortAdapter
|
|
3476
3629
|
}
|
|
3477
3630
|
];
|
|
3478
3631
|
if (includeStore) {
|
|
3479
3632
|
providers.push({
|
|
3480
|
-
provide:
|
|
3633
|
+
provide: import_nestjs_agent_core22.AGENT_STORE,
|
|
3481
3634
|
useFactory: /* @__PURE__ */ __name((o) => o.store, "useFactory"),
|
|
3482
3635
|
inject: [
|
|
3483
|
-
|
|
3636
|
+
import_nestjs_agent_core22.AGENT_OPTIONS
|
|
3484
3637
|
]
|
|
3485
3638
|
});
|
|
3486
3639
|
}
|
|
3487
3640
|
if (durable) {
|
|
3488
3641
|
providers.push({
|
|
3489
|
-
provide:
|
|
3642
|
+
provide: import_nestjs_agent_core22.AGENT_RUNNER,
|
|
3490
3643
|
useFactory: /* @__PURE__ */ __name((durableRunner) => {
|
|
3491
3644
|
if (durableRunner === void 0) {
|
|
3492
3645
|
throw new Error("AgentModule.forRoot({ durable: true }) requires importing AgentDurableModule from '@dudousxd/nestjs-agent/durable' (alongside a configured DurableModule). It was not found.");
|
|
@@ -3495,14 +3648,14 @@ function sharedProviders(durable, includeStore) {
|
|
|
3495
3648
|
}, "useFactory"),
|
|
3496
3649
|
inject: [
|
|
3497
3650
|
{
|
|
3498
|
-
token:
|
|
3651
|
+
token: import_nestjs_agent_core22.AGENT_DURABLE_RUNNER,
|
|
3499
3652
|
optional: true
|
|
3500
3653
|
}
|
|
3501
3654
|
]
|
|
3502
3655
|
});
|
|
3503
3656
|
} else {
|
|
3504
3657
|
providers.push({
|
|
3505
|
-
provide:
|
|
3658
|
+
provide: import_nestjs_agent_core22.AGENT_RUNNER,
|
|
3506
3659
|
useExisting: InlineAgentRunner
|
|
3507
3660
|
});
|
|
3508
3661
|
}
|
|
@@ -3511,25 +3664,26 @@ function sharedProviders(durable, includeStore) {
|
|
|
3511
3664
|
__name(sharedProviders, "sharedProviders");
|
|
3512
3665
|
function exportsFor(includeStore) {
|
|
3513
3666
|
return [
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3667
|
+
import_nestjs_agent_core22.AGENT_OPTIONS,
|
|
3668
|
+
import_nestjs_agent_core22.AGENT_TOOL_REGISTRY,
|
|
3669
|
+
import_nestjs_agent_core22.AGENT_REGISTRY,
|
|
3670
|
+
import_nestjs_agent_core22.AGENT_SINK,
|
|
3671
|
+
import_nestjs_agent_core22.AGENT_ROLES_POLICY,
|
|
3672
|
+
import_nestjs_agent_core22.AGENT_ACTOR_RESOLVER,
|
|
3673
|
+
import_nestjs_agent_core22.AGENT_MODEL,
|
|
3521
3674
|
...includeStore ? [
|
|
3522
|
-
|
|
3675
|
+
import_nestjs_agent_core22.AGENT_STORE
|
|
3523
3676
|
] : [],
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3677
|
+
import_nestjs_agent_core22.AGENT_QUOTA_STORE,
|
|
3678
|
+
import_nestjs_agent_core22.AGENT_MODEL_CATALOG,
|
|
3679
|
+
import_nestjs_agent_core22.AGENT_PROMPT_CONTRIBUTORS,
|
|
3680
|
+
import_nestjs_agent_core22.AGENT_SKILLS,
|
|
3681
|
+
import_nestjs_agent_core22.AGENT_MEMORY,
|
|
3682
|
+
import_nestjs_agent_core22.AGENT_DEPS_FACTORY,
|
|
3529
3683
|
AgentDepsFactory2,
|
|
3530
3684
|
AgentService,
|
|
3531
3685
|
InlineAgentRunner,
|
|
3532
|
-
|
|
3686
|
+
import_nestjs_agent_core22.AGENT_APPROVAL_PORT
|
|
3533
3687
|
];
|
|
3534
3688
|
}
|
|
3535
3689
|
__name(exportsFor, "exportsFor");
|
|
@@ -3542,7 +3696,8 @@ var BASE_CONTROLLERS = [
|
|
|
3542
3696
|
SkillsController,
|
|
3543
3697
|
MemoriesController,
|
|
3544
3698
|
ToolsController,
|
|
3545
|
-
MessagesController
|
|
3699
|
+
MessagesController,
|
|
3700
|
+
ModelsController
|
|
3546
3701
|
];
|
|
3547
3702
|
var GUARDABLE_CONTROLLERS = [
|
|
3548
3703
|
...BASE_CONTROLLERS,
|
|
@@ -3600,7 +3755,7 @@ var AgentModule = class _AgentModule {
|
|
|
3600
3755
|
controllers: controllersForSurface(options.surface, options.attachments?.upload === true),
|
|
3601
3756
|
providers: [
|
|
3602
3757
|
{
|
|
3603
|
-
provide:
|
|
3758
|
+
provide: import_nestjs_agent_core22.AGENT_OPTIONS,
|
|
3604
3759
|
useValue: options
|
|
3605
3760
|
},
|
|
3606
3761
|
...sharedProviders(options.durable ?? false, includeStore),
|
|
@@ -3624,7 +3779,7 @@ var AgentModule = class _AgentModule {
|
|
|
3624
3779
|
controllers: controllersForSurface(options.surface, options.attachmentsUpload === true),
|
|
3625
3780
|
providers: [
|
|
3626
3781
|
{
|
|
3627
|
-
provide:
|
|
3782
|
+
provide: import_nestjs_agent_core22.AGENT_OPTIONS,
|
|
3628
3783
|
// Stamp the STATIC wiring flags onto the factory result: `durable`/`surface` are
|
|
3629
3784
|
// authoritative on the async config object (they decided the actual wiring above), and
|
|
3630
3785
|
// the durable module reads `durable` back off AGENT_OPTIONS. `surface` isn't read back by
|
|
@@ -3645,13 +3800,13 @@ var AgentModule = class _AgentModule {
|
|
|
3645
3800
|
};
|
|
3646
3801
|
}
|
|
3647
3802
|
};
|
|
3648
|
-
AgentModule =
|
|
3649
|
-
(0,
|
|
3650
|
-
(0,
|
|
3803
|
+
AgentModule = _ts_decorate19([
|
|
3804
|
+
(0, import_common19.Global)(),
|
|
3805
|
+
(0, import_common19.Module)({})
|
|
3651
3806
|
], AgentModule);
|
|
3652
3807
|
|
|
3653
3808
|
// src/resolver/header-actor-resolver.ts
|
|
3654
|
-
var
|
|
3809
|
+
var import_common20 = require("@nestjs/common");
|
|
3655
3810
|
function readHeader(req, name) {
|
|
3656
3811
|
if (typeof req !== "object" || req === null || !("headers" in req)) return void 0;
|
|
3657
3812
|
const { headers } = req;
|
|
@@ -3667,7 +3822,7 @@ var HeaderActorResolver = class {
|
|
|
3667
3822
|
resolve(req) {
|
|
3668
3823
|
const id = readHeader(req, "x-actor-id");
|
|
3669
3824
|
if (id === void 0 || id.length === 0) {
|
|
3670
|
-
throw new
|
|
3825
|
+
throw new import_common20.UnauthorizedException("HeaderActorResolver: missing x-actor-id header. No default actor is fabricated. Send x-actor-id from a trusted gateway, or configure AgentModule.forRoot({ actorResolver }) with a resolver that reads your authenticated principal.");
|
|
3671
3826
|
}
|
|
3672
3827
|
const roles = (readHeader(req, "x-actor-role") ?? "").split(",").map((role) => role.trim()).filter((role) => role.length > 0);
|
|
3673
3828
|
const tenantRef = readHeader(req, "x-tenant-ref");
|
|
@@ -3706,6 +3861,7 @@ __reExport(index_exports, require("@dudousxd/nestjs-agent-core"), module.exports
|
|
|
3706
3861
|
LedgerQuotaStore,
|
|
3707
3862
|
MemoriesController,
|
|
3708
3863
|
MessagesController,
|
|
3864
|
+
ModelsController,
|
|
3709
3865
|
SKILL_METADATA,
|
|
3710
3866
|
SYSTEM_PROMPT_CONTRIBUTOR_METADATA,
|
|
3711
3867
|
SYSTEM_PROMPT_METADATA,
|