@dudousxd/nestjs-agent 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/dist/{agent-deps.factory-CiC5Va9J.d.cts → agent-deps.factory-Cus_RqwJ.d.cts} +43 -2
- package/dist/{agent-deps.factory-CiC5Va9J.d.ts → agent-deps.factory-Cus_RqwJ.d.ts} +43 -2
- package/dist/durable/index.cjs +225 -73
- 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 +173 -21
- package/dist/durable/index.js.map +1 -1
- package/dist/index.cjs +227 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -4
- package/dist/index.d.ts +17 -4
- package/dist/index.js +174 -21
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/durable/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgentStore, AgentRunInput, AgentLoopResult, LlmStepEnvelope, BufferedModelTurnResult, ToolStepEnvelope, AgentRunner, TokenStreamSink, HumanReply } from '@dudousxd/nestjs-agent-core';
|
|
2
2
|
import { RunGateway, WorkflowCtx } from '@dudousxd/nestjs-durable-core';
|
|
3
|
-
import { A as AgentDepsFactory, a as AgentSurface, b as AgentModuleOptions } from '../agent-deps.factory-
|
|
3
|
+
import { A as AgentDepsFactory, a as AgentSurface, b as AgentModuleOptions } from '../agent-deps.factory-Cus_RqwJ.cjs';
|
|
4
4
|
import { WorkflowService } from '@dudousxd/nestjs-durable';
|
|
5
5
|
import { DynamicModule } from '@nestjs/common';
|
|
6
6
|
import '@standard-schema/spec';
|
package/dist/durable/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgentStore, AgentRunInput, AgentLoopResult, LlmStepEnvelope, BufferedModelTurnResult, ToolStepEnvelope, AgentRunner, TokenStreamSink, HumanReply } from '@dudousxd/nestjs-agent-core';
|
|
2
2
|
import { RunGateway, WorkflowCtx } from '@dudousxd/nestjs-durable-core';
|
|
3
|
-
import { A as AgentDepsFactory, a as AgentSurface, b as AgentModuleOptions } from '../agent-deps.factory-
|
|
3
|
+
import { A as AgentDepsFactory, a as AgentSurface, b as AgentModuleOptions } from '../agent-deps.factory-Cus_RqwJ.js';
|
|
4
4
|
import { WorkflowService } from '@dudousxd/nestjs-durable';
|
|
5
5
|
import { DynamicModule } from '@nestjs/common';
|
|
6
6
|
import '@standard-schema/spec';
|
package/dist/durable/index.js
CHANGED
|
@@ -793,7 +793,7 @@ AgentDurableModule = _ts_decorate4([
|
|
|
793
793
|
], AgentDurableModule);
|
|
794
794
|
|
|
795
795
|
// src/agent.module.ts
|
|
796
|
-
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER11, AGENT_APPROVAL_PORT, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY7, AGENT_DURABLE_RUNNER as AGENT_DURABLE_RUNNER2, AGENT_MEMORY as AGENT_MEMORY3, AGENT_MODEL as AGENT_MODEL2, AGENT_MODEL_CATALOG as AGENT_MODEL_CATALOG2, AGENT_OPTIONS as
|
|
796
|
+
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER11, AGENT_APPROVAL_PORT, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY7, AGENT_DURABLE_RUNNER as AGENT_DURABLE_RUNNER2, AGENT_MEMORY as AGENT_MEMORY3, AGENT_MODEL as AGENT_MODEL2, AGENT_MODEL_CATALOG as AGENT_MODEL_CATALOG2, AGENT_OPTIONS as AGENT_OPTIONS5, AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS3, AGENT_QUOTA_PROVIDER as AGENT_QUOTA_PROVIDER2, AGENT_QUOTA_STORE as AGENT_QUOTA_STORE3, AGENT_REGISTRY as AGENT_REGISTRY6, AGENT_ROLES_POLICY as AGENT_ROLES_POLICY2, AGENT_RUNNER as AGENT_RUNNER2, AGENT_SINK as AGENT_SINK3, AGENT_SKILLS as AGENT_SKILLS3, AGENT_SKILL_SOURCES as AGENT_SKILL_SOURCES2, AGENT_STORE as AGENT_STORE6, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY3, AgentRegistry as AgentRegistry6, DefaultRolesPolicy, ToolRegistry as ToolRegistry3 } from "@dudousxd/nestjs-agent-core";
|
|
797
797
|
import { Global as Global2, Module as Module2 } from "@nestjs/common";
|
|
798
798
|
import { DiscoveryModule, RouterModule } from "@nestjs/core";
|
|
799
799
|
|
|
@@ -1063,8 +1063,8 @@ AgentDepsFactory2 = _ts_decorate5([
|
|
|
1063
1063
|
], AgentDepsFactory2);
|
|
1064
1064
|
|
|
1065
1065
|
// src/agent.service.ts
|
|
1066
|
-
import { AGENT_ATTACHMENT_STAGING, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY3, AGENT_MODEL_CATALOG, AGENT_QUOTA_STORE as AGENT_QUOTA_STORE2, AGENT_RUNNER, AGENT_STORE as AGENT_STORE4, REQUESTER_APPROVER, findCatalogModel, mayDecideApproval, readElicitationQuestions, validateElicitationAnswer } from "@dudousxd/nestjs-agent-core";
|
|
1067
|
-
import { BadRequestException, ForbiddenException, GoneException, Inject as Inject5, Injectable as Injectable5, NotFoundException, NotImplementedException, Optional as Optional3 } from "@nestjs/common";
|
|
1066
|
+
import { AGENT_ATTACHMENT_STAGING, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY3, AGENT_MODEL_CATALOG, AGENT_OPTIONS as AGENT_OPTIONS2, AGENT_QUOTA_PROVIDER, AGENT_QUOTA_STORE as AGENT_QUOTA_STORE2, AGENT_RUNNER, AGENT_STORE as AGENT_STORE4, REQUESTER_APPROVER, findCatalogModel, mayDecideApproval, readElicitationQuestions, validateElicitationAnswer } from "@dudousxd/nestjs-agent-core";
|
|
1067
|
+
import { BadRequestException, ForbiddenException, GoneException, HttpException, HttpStatus, Inject as Inject5, Injectable as Injectable5, NotFoundException, NotImplementedException, Optional as Optional3 } from "@nestjs/common";
|
|
1068
1068
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
1069
1069
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1070
1070
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
@@ -1101,13 +1101,68 @@ var AgentService = class {
|
|
|
1101
1101
|
quota;
|
|
1102
1102
|
staging;
|
|
1103
1103
|
models;
|
|
1104
|
-
|
|
1104
|
+
quotaProvider;
|
|
1105
|
+
options;
|
|
1106
|
+
constructor(runner, store, deps, quota, staging, models, quotaProvider, options) {
|
|
1105
1107
|
this.runner = runner;
|
|
1106
1108
|
this.store = store;
|
|
1107
1109
|
this.deps = deps;
|
|
1108
1110
|
this.quota = quota;
|
|
1109
1111
|
this.staging = staging;
|
|
1110
1112
|
this.models = models;
|
|
1113
|
+
this.quotaProvider = quotaProvider;
|
|
1114
|
+
this.options = options;
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* The actor's budget across windows (`GET <base>/quota`) — the bound {@link QuotaProvider}'s
|
|
1118
|
+
* report. Without one (a service built outside the module), a day window from the ledger.
|
|
1119
|
+
*/
|
|
1120
|
+
async quotaReport(actor) {
|
|
1121
|
+
if (this.quotaProvider !== void 0) {
|
|
1122
|
+
return this.quotaProvider.report({
|
|
1123
|
+
actor
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
const today = await this.quotaToday(actor.id);
|
|
1127
|
+
return {
|
|
1128
|
+
windows: [
|
|
1129
|
+
{
|
|
1130
|
+
period: "day",
|
|
1131
|
+
usedTokens: today.usedTokens,
|
|
1132
|
+
...today.limitTokens !== null ? {
|
|
1133
|
+
limitTokens: today.limitTokens
|
|
1134
|
+
} : {},
|
|
1135
|
+
usedUsd: today.costUsd
|
|
1136
|
+
}
|
|
1137
|
+
],
|
|
1138
|
+
...today.withinLimit ? {} : {
|
|
1139
|
+
blocked: {
|
|
1140
|
+
period: "day"
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Refuse a turn the actor's budget no longer covers — only when the host configured one
|
|
1147
|
+
* (`quotaProvider` or `quotaLimits`): the default report is informational, and the daily token
|
|
1148
|
+
* quota the loop enforces keeps working as it always has.
|
|
1149
|
+
*/
|
|
1150
|
+
async assertWithinQuota(actor) {
|
|
1151
|
+
const gated = this.options?.quotaProvider !== void 0 || this.options?.quotaLimits !== void 0;
|
|
1152
|
+
if (!gated || this.quotaProvider === void 0) {
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
1155
|
+
const { blocked } = await this.quotaProvider.report({
|
|
1156
|
+
actor
|
|
1157
|
+
});
|
|
1158
|
+
if (blocked !== void 0) {
|
|
1159
|
+
throw new HttpException({
|
|
1160
|
+
statusCode: HttpStatus.TOO_MANY_REQUESTS,
|
|
1161
|
+
code: "quota_exceeded",
|
|
1162
|
+
period: blocked.period,
|
|
1163
|
+
message: blocked.reason ?? `The ${blocked.period === "day" ? "daily" : "monthly"} quota is used up`
|
|
1164
|
+
}, HttpStatus.TOO_MANY_REQUESTS);
|
|
1165
|
+
}
|
|
1111
1166
|
}
|
|
1112
1167
|
/**
|
|
1113
1168
|
* The models `actor` may pick for `agent` (`GET <base>/models`). An empty catalog when none is
|
|
@@ -1164,6 +1219,7 @@ var AgentService = class {
|
|
|
1164
1219
|
return (await this.store.getThread(threadId))?.model ?? null;
|
|
1165
1220
|
}
|
|
1166
1221
|
async chat(params) {
|
|
1222
|
+
await this.assertWithinQuota(params.actor);
|
|
1167
1223
|
const agentName = await this.resolveAgentName(params.agentName, params.threadId);
|
|
1168
1224
|
const model = await this.resolveModel(params.actor, agentName, params.model, params.threadId);
|
|
1169
1225
|
const attachments = await this.resolveAttachments(params.actor, params.attachments ?? []);
|
|
@@ -1705,6 +1761,10 @@ AgentService = _ts_decorate6([
|
|
|
1705
1761
|
_ts_param5(4, Inject5(AGENT_ATTACHMENT_STAGING)),
|
|
1706
1762
|
_ts_param5(5, Optional3()),
|
|
1707
1763
|
_ts_param5(5, Inject5(AGENT_MODEL_CATALOG)),
|
|
1764
|
+
_ts_param5(6, Optional3()),
|
|
1765
|
+
_ts_param5(6, Inject5(AGENT_QUOTA_PROVIDER)),
|
|
1766
|
+
_ts_param5(7, Optional3()),
|
|
1767
|
+
_ts_param5(7, Inject5(AGENT_OPTIONS2)),
|
|
1708
1768
|
_ts_metadata5("design:type", Function),
|
|
1709
1769
|
_ts_metadata5("design:paramtypes", [
|
|
1710
1770
|
typeof AgentRunner === "undefined" ? Object : AgentRunner,
|
|
@@ -1712,7 +1772,9 @@ AgentService = _ts_decorate6([
|
|
|
1712
1772
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
1713
1773
|
Object,
|
|
1714
1774
|
typeof AttachmentStagingStore === "undefined" ? Object : AttachmentStagingStore,
|
|
1715
|
-
typeof ModelCatalog === "undefined" ? Object : ModelCatalog
|
|
1775
|
+
typeof ModelCatalog === "undefined" ? Object : ModelCatalog,
|
|
1776
|
+
typeof QuotaProvider === "undefined" ? Object : QuotaProvider,
|
|
1777
|
+
typeof Pick === "undefined" ? Object : Pick
|
|
1716
1778
|
])
|
|
1717
1779
|
], AgentService);
|
|
1718
1780
|
|
|
@@ -1851,7 +1913,7 @@ AgentsController = _ts_decorate8([
|
|
|
1851
1913
|
], AgentsController);
|
|
1852
1914
|
|
|
1853
1915
|
// src/controller/attachments.controller.ts
|
|
1854
|
-
import { AGENT_ACTOR_RESOLVER, AGENT_ATTACHMENT_STAGING as AGENT_ATTACHMENT_STAGING2, AGENT_OPTIONS as
|
|
1916
|
+
import { AGENT_ACTOR_RESOLVER, AGENT_ATTACHMENT_STAGING as AGENT_ATTACHMENT_STAGING2, AGENT_OPTIONS as AGENT_OPTIONS3 } from "@dudousxd/nestjs-agent-core";
|
|
1855
1917
|
import { BadRequestException as BadRequestException2, Controller as Controller2, Get as Get2, Inject as Inject7, NotImplementedException as NotImplementedException2, Optional as Optional4, PayloadTooLargeException, Post, Req, UnsupportedMediaTypeException, UploadedFile, UseInterceptors } from "@nestjs/common";
|
|
1856
1918
|
import { FileInterceptor } from "@nestjs/platform-express";
|
|
1857
1919
|
function _ts_decorate9(decorators, target, key, desc) {
|
|
@@ -1984,7 +2046,7 @@ _ts_decorate9([
|
|
|
1984
2046
|
], AttachmentsController.prototype, "upload", null);
|
|
1985
2047
|
AttachmentsController = _ts_decorate9([
|
|
1986
2048
|
Controller2("attachments"),
|
|
1987
|
-
_ts_param7(0, Inject7(
|
|
2049
|
+
_ts_param7(0, Inject7(AGENT_OPTIONS3)),
|
|
1988
2050
|
_ts_param7(1, Inject7(AGENT_ACTOR_RESOLVER)),
|
|
1989
2051
|
_ts_param7(3, Optional4()),
|
|
1990
2052
|
_ts_param7(3, Inject7(AGENT_ATTACHMENT_STAGING2)),
|
|
@@ -2559,11 +2621,28 @@ var QuotaController = class {
|
|
|
2559
2621
|
this.agent = agent;
|
|
2560
2622
|
this.actorResolver = actorResolver;
|
|
2561
2623
|
}
|
|
2624
|
+
/**
|
|
2625
|
+
* The caller's budget across windows — `{ windows: [{ period, usedTokens, limitTokens?, usedUsd,
|
|
2626
|
+
* limitUsd?, resetsAt? }], blocked?: { period, reason? } }` — from the bound `QuotaProvider`.
|
|
2627
|
+
*/
|
|
2628
|
+
async report(req) {
|
|
2629
|
+
const actor = await this.actorResolver.resolve(req);
|
|
2630
|
+
return this.agent.quotaReport(actor);
|
|
2631
|
+
}
|
|
2562
2632
|
async today(req) {
|
|
2563
2633
|
const actor = await this.actorResolver.resolve(req);
|
|
2564
2634
|
return this.agent.quotaToday(actor.id);
|
|
2565
2635
|
}
|
|
2566
2636
|
};
|
|
2637
|
+
_ts_decorate14([
|
|
2638
|
+
Get6(),
|
|
2639
|
+
_ts_param12(0, Req6()),
|
|
2640
|
+
_ts_metadata13("design:type", Function),
|
|
2641
|
+
_ts_metadata13("design:paramtypes", [
|
|
2642
|
+
typeof Request === "undefined" ? Object : Request
|
|
2643
|
+
]),
|
|
2644
|
+
_ts_metadata13("design:returntype", Promise)
|
|
2645
|
+
], QuotaController.prototype, "report", null);
|
|
2567
2646
|
_ts_decorate14([
|
|
2568
2647
|
Get6("today"),
|
|
2569
2648
|
_ts_param12(0, Req6()),
|
|
@@ -3320,7 +3399,7 @@ AgentDiscoveryService = _ts_decorate19([
|
|
|
3320
3399
|
], AgentDiscoveryService);
|
|
3321
3400
|
|
|
3322
3401
|
// src/discovery/ai-tool-discovery.service.ts
|
|
3323
|
-
import { AGENT_OPTIONS as
|
|
3402
|
+
import { AGENT_OPTIONS as AGENT_OPTIONS4, AGENT_REGISTRY as AGENT_REGISTRY5, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY2, normalizeDelegation as normalizeDelegation2 } from "@dudousxd/nestjs-agent-core";
|
|
3324
3403
|
import { Inject as Inject18, Injectable as Injectable8, Logger as Logger3 } from "@nestjs/common";
|
|
3325
3404
|
import { DiscoveryService as DiscoveryService2 } from "@nestjs/core";
|
|
3326
3405
|
import { z } from "zod";
|
|
@@ -3503,7 +3582,7 @@ AiToolDiscoveryService = _ts_decorate20([
|
|
|
3503
3582
|
Injectable8(),
|
|
3504
3583
|
_ts_param18(1, Inject18(AGENT_TOOL_REGISTRY2)),
|
|
3505
3584
|
_ts_param18(2, Inject18(AGENT_REGISTRY5)),
|
|
3506
|
-
_ts_param18(3, Inject18(
|
|
3585
|
+
_ts_param18(3, Inject18(AGENT_OPTIONS4)),
|
|
3507
3586
|
_ts_metadata19("design:type", Function),
|
|
3508
3587
|
_ts_metadata19("design:paramtypes", [
|
|
3509
3588
|
typeof DiscoveryService2 === "undefined" ? Object : DiscoveryService2,
|
|
@@ -3611,6 +3690,69 @@ SkillDiscoveryService = _ts_decorate21([
|
|
|
3611
3690
|
])
|
|
3612
3691
|
], SkillDiscoveryService);
|
|
3613
3692
|
|
|
3693
|
+
// src/ledger-quota-provider.ts
|
|
3694
|
+
import { exhaustedWindow, quotaPeriodRange } from "@dudousxd/nestjs-agent-core";
|
|
3695
|
+
var LedgerQuotaProvider = class {
|
|
3696
|
+
static {
|
|
3697
|
+
__name(this, "LedgerQuotaProvider");
|
|
3698
|
+
}
|
|
3699
|
+
store;
|
|
3700
|
+
quota;
|
|
3701
|
+
limits;
|
|
3702
|
+
constructor(store, quota, limits = {}) {
|
|
3703
|
+
this.store = store;
|
|
3704
|
+
this.quota = quota;
|
|
3705
|
+
this.limits = limits;
|
|
3706
|
+
}
|
|
3707
|
+
async report(query) {
|
|
3708
|
+
const now = query.now ?? /* @__PURE__ */ new Date();
|
|
3709
|
+
const actorRef = query.actor.id;
|
|
3710
|
+
const windows = [
|
|
3711
|
+
await this.dayWindow(actorRef, now)
|
|
3712
|
+
];
|
|
3713
|
+
if (this.store.usageBetween !== void 0) {
|
|
3714
|
+
const range = quotaPeriodRange("month", now);
|
|
3715
|
+
const used = await this.store.usageBetween(actorRef, range.fromDay, range.toDay);
|
|
3716
|
+
windows.push(this.window("month", used.usedTokens, used.costUsd, range.resetsAt));
|
|
3717
|
+
}
|
|
3718
|
+
const blocked = exhaustedWindow(windows);
|
|
3719
|
+
return {
|
|
3720
|
+
windows,
|
|
3721
|
+
...blocked !== void 0 ? {
|
|
3722
|
+
blocked
|
|
3723
|
+
} : {}
|
|
3724
|
+
};
|
|
3725
|
+
}
|
|
3726
|
+
async dayWindow(actorRef, now) {
|
|
3727
|
+
const range = quotaPeriodRange("day", now);
|
|
3728
|
+
const { usedTokens, costUsd } = await this.store.quotaToday(actorRef, range.fromDay);
|
|
3729
|
+
if (this.quota === void 0) {
|
|
3730
|
+
return this.window("day", usedTokens, costUsd, range.resetsAt);
|
|
3731
|
+
}
|
|
3732
|
+
const state = await this.quota.check(actorRef, range.fromDay);
|
|
3733
|
+
const window = this.window("day", state.usedTokens, costUsd, range.resetsAt);
|
|
3734
|
+
if (window.limitTokens === void 0) {
|
|
3735
|
+
window.limitTokens = state.limitTokens;
|
|
3736
|
+
}
|
|
3737
|
+
return window;
|
|
3738
|
+
}
|
|
3739
|
+
window(period, usedTokens, usedUsd, resetsAt) {
|
|
3740
|
+
const limits = this.limits[period] ?? {};
|
|
3741
|
+
return {
|
|
3742
|
+
period,
|
|
3743
|
+
usedTokens,
|
|
3744
|
+
...limits.tokens !== void 0 ? {
|
|
3745
|
+
limitTokens: limits.tokens
|
|
3746
|
+
} : {},
|
|
3747
|
+
usedUsd,
|
|
3748
|
+
...limits.usd !== void 0 ? {
|
|
3749
|
+
limitUsd: limits.usd
|
|
3750
|
+
} : {},
|
|
3751
|
+
resetsAt
|
|
3752
|
+
};
|
|
3753
|
+
}
|
|
3754
|
+
};
|
|
3755
|
+
|
|
3614
3756
|
// src/ledger-quota-store.ts
|
|
3615
3757
|
var LedgerQuotaStore = class {
|
|
3616
3758
|
static {
|
|
@@ -4137,7 +4279,7 @@ function sharedProviders(durable, includeStore) {
|
|
|
4137
4279
|
provide: AGENT_SKILLS3,
|
|
4138
4280
|
useFactory: /* @__PURE__ */ __name((options, declared) => resolveSkillsConfig(options.skills, declared), "useFactory"),
|
|
4139
4281
|
inject: [
|
|
4140
|
-
|
|
4282
|
+
AGENT_OPTIONS5,
|
|
4141
4283
|
AGENT_SKILL_SOURCES2
|
|
4142
4284
|
]
|
|
4143
4285
|
},
|
|
@@ -4147,35 +4289,35 @@ function sharedProviders(durable, includeStore) {
|
|
|
4147
4289
|
provide: AGENT_MEMORY3,
|
|
4148
4290
|
useFactory: /* @__PURE__ */ __name((options) => options.memory, "useFactory"),
|
|
4149
4291
|
inject: [
|
|
4150
|
-
|
|
4292
|
+
AGENT_OPTIONS5
|
|
4151
4293
|
]
|
|
4152
4294
|
},
|
|
4153
4295
|
{
|
|
4154
4296
|
provide: AGENT_SINK3,
|
|
4155
4297
|
useFactory: /* @__PURE__ */ __name((options) => options.sink ?? new InProcessTokenStreamSink(), "useFactory"),
|
|
4156
4298
|
inject: [
|
|
4157
|
-
|
|
4299
|
+
AGENT_OPTIONS5
|
|
4158
4300
|
]
|
|
4159
4301
|
},
|
|
4160
4302
|
{
|
|
4161
4303
|
provide: AGENT_ROLES_POLICY2,
|
|
4162
4304
|
useFactory: /* @__PURE__ */ __name((options) => options.rolesPolicy ?? new DefaultRolesPolicy(options.defaultRoles), "useFactory"),
|
|
4163
4305
|
inject: [
|
|
4164
|
-
|
|
4306
|
+
AGENT_OPTIONS5
|
|
4165
4307
|
]
|
|
4166
4308
|
},
|
|
4167
4309
|
{
|
|
4168
4310
|
provide: AGENT_ACTOR_RESOLVER11,
|
|
4169
4311
|
useFactory: /* @__PURE__ */ __name((options) => options.actorResolver, "useFactory"),
|
|
4170
4312
|
inject: [
|
|
4171
|
-
|
|
4313
|
+
AGENT_OPTIONS5
|
|
4172
4314
|
]
|
|
4173
4315
|
},
|
|
4174
4316
|
{
|
|
4175
4317
|
provide: AGENT_MODEL2,
|
|
4176
4318
|
useFactory: /* @__PURE__ */ __name((o) => o.model, "useFactory"),
|
|
4177
4319
|
inject: [
|
|
4178
|
-
|
|
4320
|
+
AGENT_OPTIONS5
|
|
4179
4321
|
]
|
|
4180
4322
|
},
|
|
4181
4323
|
{
|
|
@@ -4185,15 +4327,24 @@ function sharedProviders(durable, includeStore) {
|
|
|
4185
4327
|
provide: AGENT_QUOTA_STORE3,
|
|
4186
4328
|
useFactory: /* @__PURE__ */ __name((o, store) => o.quota ?? (o.quotaLimitTokens !== void 0 ? new LedgerQuotaStore(store, o.quotaLimitTokens) : void 0), "useFactory"),
|
|
4187
4329
|
inject: [
|
|
4188
|
-
|
|
4330
|
+
AGENT_OPTIONS5,
|
|
4189
4331
|
AGENT_STORE6
|
|
4190
4332
|
]
|
|
4191
4333
|
},
|
|
4334
|
+
{
|
|
4335
|
+
provide: AGENT_QUOTA_PROVIDER2,
|
|
4336
|
+
useFactory: /* @__PURE__ */ __name((o, store, quota) => o.quotaProvider ?? new LedgerQuotaProvider(store, quota, o.quotaLimits), "useFactory"),
|
|
4337
|
+
inject: [
|
|
4338
|
+
AGENT_OPTIONS5,
|
|
4339
|
+
AGENT_STORE6,
|
|
4340
|
+
AGENT_QUOTA_STORE3
|
|
4341
|
+
]
|
|
4342
|
+
},
|
|
4192
4343
|
{
|
|
4193
4344
|
provide: AGENT_MODEL_CATALOG2,
|
|
4194
4345
|
useFactory: /* @__PURE__ */ __name((o) => o.models, "useFactory"),
|
|
4195
4346
|
inject: [
|
|
4196
|
-
|
|
4347
|
+
AGENT_OPTIONS5
|
|
4197
4348
|
]
|
|
4198
4349
|
},
|
|
4199
4350
|
AgentDepsFactory2,
|
|
@@ -4221,7 +4372,7 @@ function sharedProviders(durable, includeStore) {
|
|
|
4221
4372
|
provide: AGENT_STORE6,
|
|
4222
4373
|
useFactory: /* @__PURE__ */ __name((o) => o.store, "useFactory"),
|
|
4223
4374
|
inject: [
|
|
4224
|
-
|
|
4375
|
+
AGENT_OPTIONS5
|
|
4225
4376
|
]
|
|
4226
4377
|
});
|
|
4227
4378
|
}
|
|
@@ -4252,7 +4403,7 @@ function sharedProviders(durable, includeStore) {
|
|
|
4252
4403
|
__name(sharedProviders, "sharedProviders");
|
|
4253
4404
|
function exportsFor(includeStore) {
|
|
4254
4405
|
return [
|
|
4255
|
-
|
|
4406
|
+
AGENT_OPTIONS5,
|
|
4256
4407
|
AGENT_TOOL_REGISTRY3,
|
|
4257
4408
|
AGENT_REGISTRY6,
|
|
4258
4409
|
AGENT_SINK3,
|
|
@@ -4264,6 +4415,7 @@ function exportsFor(includeStore) {
|
|
|
4264
4415
|
] : [],
|
|
4265
4416
|
AGENT_QUOTA_STORE3,
|
|
4266
4417
|
AGENT_MODEL_CATALOG2,
|
|
4418
|
+
AGENT_QUOTA_PROVIDER2,
|
|
4267
4419
|
AGENT_PROMPT_CONTRIBUTORS3,
|
|
4268
4420
|
AGENT_SKILLS3,
|
|
4269
4421
|
AGENT_MEMORY3,
|
|
@@ -4343,7 +4495,7 @@ var AgentModule = class _AgentModule {
|
|
|
4343
4495
|
controllers: controllersForSurface(options.surface, options.attachments?.upload === true),
|
|
4344
4496
|
providers: [
|
|
4345
4497
|
{
|
|
4346
|
-
provide:
|
|
4498
|
+
provide: AGENT_OPTIONS5,
|
|
4347
4499
|
useValue: options
|
|
4348
4500
|
},
|
|
4349
4501
|
...sharedProviders(options.durable ?? false, includeStore),
|
|
@@ -4367,7 +4519,7 @@ var AgentModule = class _AgentModule {
|
|
|
4367
4519
|
controllers: controllersForSurface(options.surface, options.attachmentsUpload === true),
|
|
4368
4520
|
providers: [
|
|
4369
4521
|
{
|
|
4370
|
-
provide:
|
|
4522
|
+
provide: AGENT_OPTIONS5,
|
|
4371
4523
|
// Stamp the STATIC wiring flags onto the factory result: `durable`/`surface` are
|
|
4372
4524
|
// authoritative on the async config object (they decided the actual wiring above), and
|
|
4373
4525
|
// the durable module reads `durable` back off AGENT_OPTIONS. `surface` isn't read back by
|