@dudousxd/nestjs-agent 1.25.2 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chat-queue.service-Crf9uwum.d.cts → chat-queue.service-BN6Ljswx.d.cts} +13 -1
- package/dist/{chat-queue.service-ZQkqb1Yw.d.ts → chat-queue.service-DG44iDJA.d.ts} +13 -1
- package/dist/durable/index.cjs +255 -163
- 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 +177 -85
- package/dist/durable/index.js.map +1 -1
- package/dist/index.cjs +288 -196
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +200 -108
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/durable/index.cjs
CHANGED
|
@@ -1216,8 +1216,8 @@ AgentDurableModule = _ts_decorate4([
|
|
|
1216
1216
|
], AgentDurableModule);
|
|
1217
1217
|
|
|
1218
1218
|
// src/agent.module.ts
|
|
1219
|
-
var
|
|
1220
|
-
var
|
|
1219
|
+
var import_nestjs_agent_core40 = require("@dudousxd/nestjs-agent-core");
|
|
1220
|
+
var import_common32 = require("@nestjs/common");
|
|
1221
1221
|
var import_core4 = require("@nestjs/core");
|
|
1222
1222
|
|
|
1223
1223
|
// src/agent-deps.factory.ts
|
|
@@ -6209,8 +6209,7 @@ var LedgerQuotaProvider = class {
|
|
|
6209
6209
|
}
|
|
6210
6210
|
};
|
|
6211
6211
|
|
|
6212
|
-
// src/
|
|
6213
|
-
var import_node_crypto3 = require("crypto");
|
|
6212
|
+
// src/pricing-boot.service.ts
|
|
6214
6213
|
var import_nestjs_agent_core35 = require("@dudousxd/nestjs-agent-core");
|
|
6215
6214
|
var import_common28 = require("@nestjs/common");
|
|
6216
6215
|
function _ts_decorate27(decorators, target, key, desc) {
|
|
@@ -6239,6 +6238,96 @@ function _ts_param25(paramIndex, decorator) {
|
|
|
6239
6238
|
};
|
|
6240
6239
|
}
|
|
6241
6240
|
__name(_ts_param25, "_ts_param");
|
|
6241
|
+
var logger = new import_common28.Logger("AgentPricing");
|
|
6242
|
+
var PricingBootService = class {
|
|
6243
|
+
static {
|
|
6244
|
+
__name(this, "PricingBootService");
|
|
6245
|
+
}
|
|
6246
|
+
options;
|
|
6247
|
+
model;
|
|
6248
|
+
pricingStore;
|
|
6249
|
+
#run = null;
|
|
6250
|
+
constructor(options, model, pricingStore) {
|
|
6251
|
+
this.options = options;
|
|
6252
|
+
this.model = model;
|
|
6253
|
+
this.pricingStore = pricingStore;
|
|
6254
|
+
}
|
|
6255
|
+
onApplicationBootstrap() {
|
|
6256
|
+
this.#run = this.check();
|
|
6257
|
+
}
|
|
6258
|
+
/** Awaits a check still in flight, so a test (or a fast shutdown) never leaks it. */
|
|
6259
|
+
async onApplicationShutdown() {
|
|
6260
|
+
await this.#run;
|
|
6261
|
+
this.#run = null;
|
|
6262
|
+
}
|
|
6263
|
+
/** The check itself; resolves once it is done (exposed for tests). */
|
|
6264
|
+
async check() {
|
|
6265
|
+
let models;
|
|
6266
|
+
try {
|
|
6267
|
+
models = this.model?.describeModels?.() ?? [];
|
|
6268
|
+
} catch (error) {
|
|
6269
|
+
logger.warn(`describeModels() threw; boot pricing skipped: ${String(error)}`);
|
|
6270
|
+
return;
|
|
6271
|
+
}
|
|
6272
|
+
if (models.length === 0) return;
|
|
6273
|
+
const catalog = this.options.priceCatalog;
|
|
6274
|
+
if (catalog === void 0 && process.env.NODE_ENV === "test") return;
|
|
6275
|
+
await (0, import_nestjs_agent_core35.ensureModelPricing)({
|
|
6276
|
+
models,
|
|
6277
|
+
pricingStore: this.pricingStore,
|
|
6278
|
+
catalog: catalog ?? {},
|
|
6279
|
+
log: {
|
|
6280
|
+
info: /* @__PURE__ */ __name((message) => logger.log(message), "info"),
|
|
6281
|
+
warn: /* @__PURE__ */ __name((message) => logger.warn(message), "warn")
|
|
6282
|
+
}
|
|
6283
|
+
}).catch(() => void 0);
|
|
6284
|
+
}
|
|
6285
|
+
};
|
|
6286
|
+
PricingBootService = _ts_decorate27([
|
|
6287
|
+
(0, import_common28.Injectable)(),
|
|
6288
|
+
_ts_param25(0, (0, import_common28.Inject)(import_nestjs_agent_core35.AGENT_OPTIONS)),
|
|
6289
|
+
_ts_param25(1, (0, import_common28.Optional)()),
|
|
6290
|
+
_ts_param25(1, (0, import_common28.Inject)(import_nestjs_agent_core35.AGENT_MODEL)),
|
|
6291
|
+
_ts_param25(2, (0, import_common28.Optional)()),
|
|
6292
|
+
_ts_param25(2, (0, import_common28.Inject)(import_nestjs_agent_core35.AGENT_PRICING_STORE)),
|
|
6293
|
+
_ts_metadata25("design:type", Function),
|
|
6294
|
+
_ts_metadata25("design:paramtypes", [
|
|
6295
|
+
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
6296
|
+
Object,
|
|
6297
|
+
Object
|
|
6298
|
+
])
|
|
6299
|
+
], PricingBootService);
|
|
6300
|
+
|
|
6301
|
+
// src/proposals/action-proposal-worker.service.ts
|
|
6302
|
+
var import_node_crypto3 = require("crypto");
|
|
6303
|
+
var import_nestjs_agent_core36 = require("@dudousxd/nestjs-agent-core");
|
|
6304
|
+
var import_common29 = require("@nestjs/common");
|
|
6305
|
+
function _ts_decorate28(decorators, target, key, desc) {
|
|
6306
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6307
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
6308
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
6309
|
+
} else {
|
|
6310
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
6311
|
+
if (d = decorators[i]) {
|
|
6312
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6313
|
+
}
|
|
6314
|
+
}
|
|
6315
|
+
}
|
|
6316
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6317
|
+
}
|
|
6318
|
+
__name(_ts_decorate28, "_ts_decorate");
|
|
6319
|
+
function _ts_metadata26(metadataKey, metadataValue) {
|
|
6320
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
6321
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
6322
|
+
}
|
|
6323
|
+
}
|
|
6324
|
+
__name(_ts_metadata26, "_ts_metadata");
|
|
6325
|
+
function _ts_param26(paramIndex, decorator) {
|
|
6326
|
+
return function(target, key) {
|
|
6327
|
+
decorator(target, key, paramIndex);
|
|
6328
|
+
};
|
|
6329
|
+
}
|
|
6330
|
+
__name(_ts_param26, "_ts_param");
|
|
6242
6331
|
var ActionProposalWorkerService = class _ActionProposalWorkerService {
|
|
6243
6332
|
static {
|
|
6244
6333
|
__name(this, "ActionProposalWorkerService");
|
|
@@ -6247,7 +6336,7 @@ var ActionProposalWorkerService = class _ActionProposalWorkerService {
|
|
|
6247
6336
|
options;
|
|
6248
6337
|
deps;
|
|
6249
6338
|
worker;
|
|
6250
|
-
logger = new
|
|
6339
|
+
logger = new import_common29.Logger(_ActionProposalWorkerService.name);
|
|
6251
6340
|
settledListeners = /* @__PURE__ */ new Set();
|
|
6252
6341
|
/**
|
|
6253
6342
|
* Run `listener` after every proposal this process's worker settles — how a module relays an
|
|
@@ -6283,16 +6372,16 @@ var ActionProposalWorkerService = class _ActionProposalWorkerService {
|
|
|
6283
6372
|
}
|
|
6284
6373
|
onModuleInit() {
|
|
6285
6374
|
if (this.options.actionApprovalMode !== "independent") return;
|
|
6286
|
-
(0,
|
|
6375
|
+
(0, import_nestjs_agent_core36.assertIndependentActionCapabilities)(this.store, this.options.backgroundActorResolver);
|
|
6287
6376
|
if (this.options.surface === "http") return;
|
|
6288
6377
|
const resolver = this.options.backgroundActorResolver;
|
|
6289
6378
|
if (!resolver) throw new Error("BackgroundActorResolver is required");
|
|
6290
|
-
this.worker = new
|
|
6379
|
+
this.worker = new import_nestjs_agent_core36.ActionProposalWorker({
|
|
6291
6380
|
store: this.store,
|
|
6292
6381
|
workerId: (0, import_node_crypto3.randomUUID)(),
|
|
6293
6382
|
...this.options.actionProposalWorker,
|
|
6294
6383
|
onSettled: /* @__PURE__ */ __name((proposal) => this.settled(proposal), "onSettled"),
|
|
6295
|
-
executor: new
|
|
6384
|
+
executor: new import_nestjs_agent_core36.ActionProposalExecutor({
|
|
6296
6385
|
resolver,
|
|
6297
6386
|
resolveExecution: /* @__PURE__ */ __name(async (proposal, actor) => {
|
|
6298
6387
|
const deps = this.deps.forProposal(proposal, actor);
|
|
@@ -6316,13 +6405,13 @@ var ActionProposalWorkerService = class _ActionProposalWorkerService {
|
|
|
6316
6405
|
await this.worker?.stop();
|
|
6317
6406
|
}
|
|
6318
6407
|
};
|
|
6319
|
-
ActionProposalWorkerService =
|
|
6320
|
-
(0,
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6408
|
+
ActionProposalWorkerService = _ts_decorate28([
|
|
6409
|
+
(0, import_common29.Injectable)(),
|
|
6410
|
+
_ts_param26(0, (0, import_common29.Inject)(import_nestjs_agent_core36.AGENT_STORE)),
|
|
6411
|
+
_ts_param26(1, (0, import_common29.Inject)(import_nestjs_agent_core36.AGENT_OPTIONS)),
|
|
6412
|
+
_ts_param26(2, (0, import_common29.Inject)(import_nestjs_agent_core36.AGENT_DEPS_FACTORY)),
|
|
6413
|
+
_ts_metadata26("design:type", Function),
|
|
6414
|
+
_ts_metadata26("design:paramtypes", [
|
|
6326
6415
|
typeof AgentStore === "undefined" ? Object : AgentStore,
|
|
6327
6416
|
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
6328
6417
|
typeof AgentDepsFactory2 === "undefined" ? Object : AgentDepsFactory2
|
|
@@ -6330,9 +6419,9 @@ ActionProposalWorkerService = _ts_decorate27([
|
|
|
6330
6419
|
], ActionProposalWorkerService);
|
|
6331
6420
|
|
|
6332
6421
|
// src/proposals/action-proposal.controller.ts
|
|
6333
|
-
var
|
|
6334
|
-
var
|
|
6335
|
-
function
|
|
6422
|
+
var import_nestjs_agent_core37 = require("@dudousxd/nestjs-agent-core");
|
|
6423
|
+
var import_common30 = require("@nestjs/common");
|
|
6424
|
+
function _ts_decorate29(decorators, target, key, desc) {
|
|
6336
6425
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6337
6426
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
6338
6427
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -6345,24 +6434,24 @@ function _ts_decorate28(decorators, target, key, desc) {
|
|
|
6345
6434
|
}
|
|
6346
6435
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6347
6436
|
}
|
|
6348
|
-
__name(
|
|
6349
|
-
function
|
|
6437
|
+
__name(_ts_decorate29, "_ts_decorate");
|
|
6438
|
+
function _ts_metadata27(metadataKey, metadataValue) {
|
|
6350
6439
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
6351
6440
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
6352
6441
|
}
|
|
6353
6442
|
}
|
|
6354
|
-
__name(
|
|
6355
|
-
function
|
|
6443
|
+
__name(_ts_metadata27, "_ts_metadata");
|
|
6444
|
+
function _ts_param27(paramIndex, decorator) {
|
|
6356
6445
|
return function(target, key) {
|
|
6357
6446
|
decorator(target, key, paramIndex);
|
|
6358
6447
|
};
|
|
6359
6448
|
}
|
|
6360
|
-
__name(
|
|
6449
|
+
__name(_ts_param27, "_ts_param");
|
|
6361
6450
|
function bodyFields(body, field) {
|
|
6362
6451
|
if (body === void 0) return {};
|
|
6363
|
-
if (typeof body !== "object" || body === null || Array.isArray(body) || Object.keys(body).some((key) => key !== field)) throw new
|
|
6452
|
+
if (typeof body !== "object" || body === null || Array.isArray(body) || Object.keys(body).some((key) => key !== field)) throw new import_common30.BadRequestException(`Only ${field} is accepted`);
|
|
6364
6453
|
const value = body;
|
|
6365
|
-
if (value[field] !== void 0 && (field === "remember" && typeof value[field] !== "boolean" || field === "reason" && typeof value[field] !== "string")) throw new
|
|
6454
|
+
if (value[field] !== void 0 && (field === "remember" && typeof value[field] !== "boolean" || field === "reason" && typeof value[field] !== "string")) throw new import_common30.BadRequestException(`Invalid ${field}`);
|
|
6366
6455
|
return value;
|
|
6367
6456
|
}
|
|
6368
6457
|
__name(bodyFields, "bodyFields");
|
|
@@ -6384,9 +6473,9 @@ var ActionProposalController = class {
|
|
|
6384
6473
|
query = {
|
|
6385
6474
|
after: JSON.parse(cursor)
|
|
6386
6475
|
};
|
|
6387
|
-
(0,
|
|
6476
|
+
(0, import_nestjs_agent_core37.validateActionProposalListQuery)(query);
|
|
6388
6477
|
} catch {
|
|
6389
|
-
throw new
|
|
6478
|
+
throw new import_common30.BadRequestException("Invalid action proposal cursor");
|
|
6390
6479
|
}
|
|
6391
6480
|
}
|
|
6392
6481
|
const page = await this.proposals.listPage(threadId, await this.actors.resolve(request), query);
|
|
@@ -6416,67 +6505,67 @@ var ActionProposalController = class {
|
|
|
6416
6505
|
});
|
|
6417
6506
|
}
|
|
6418
6507
|
};
|
|
6419
|
-
|
|
6420
|
-
(0,
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6508
|
+
_ts_decorate29([
|
|
6509
|
+
(0, import_common30.Get)(),
|
|
6510
|
+
_ts_param27(0, (0, import_common30.Param)("threadId")),
|
|
6511
|
+
_ts_param27(1, (0, import_common30.Req)()),
|
|
6512
|
+
_ts_param27(2, (0, import_common30.Query)("after")),
|
|
6513
|
+
_ts_param27(3, (0, import_common30.Res)({
|
|
6425
6514
|
passthrough: true
|
|
6426
6515
|
})),
|
|
6427
|
-
|
|
6428
|
-
|
|
6516
|
+
_ts_metadata27("design:type", Function),
|
|
6517
|
+
_ts_metadata27("design:paramtypes", [
|
|
6429
6518
|
String,
|
|
6430
6519
|
typeof Request === "undefined" ? Object : Request,
|
|
6431
6520
|
Object,
|
|
6432
6521
|
typeof Response === "undefined" ? Object : Response
|
|
6433
6522
|
]),
|
|
6434
|
-
|
|
6523
|
+
_ts_metadata27("design:returntype", Promise)
|
|
6435
6524
|
], ActionProposalController.prototype, "list", null);
|
|
6436
|
-
|
|
6437
|
-
(0,
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6525
|
+
_ts_decorate29([
|
|
6526
|
+
(0, import_common30.Post)(":proposalId/approve"),
|
|
6527
|
+
_ts_param27(0, (0, import_common30.Param)("threadId")),
|
|
6528
|
+
_ts_param27(1, (0, import_common30.Param)("proposalId")),
|
|
6529
|
+
_ts_param27(2, (0, import_common30.Req)()),
|
|
6530
|
+
_ts_param27(3, (0, import_common30.Body)()),
|
|
6531
|
+
_ts_metadata27("design:type", Function),
|
|
6532
|
+
_ts_metadata27("design:paramtypes", [
|
|
6444
6533
|
String,
|
|
6445
6534
|
String,
|
|
6446
6535
|
typeof Request === "undefined" ? Object : Request,
|
|
6447
6536
|
Object
|
|
6448
6537
|
]),
|
|
6449
|
-
|
|
6538
|
+
_ts_metadata27("design:returntype", Promise)
|
|
6450
6539
|
], ActionProposalController.prototype, "approve", null);
|
|
6451
|
-
|
|
6452
|
-
(0,
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6540
|
+
_ts_decorate29([
|
|
6541
|
+
(0, import_common30.Post)(":proposalId/reject"),
|
|
6542
|
+
_ts_param27(0, (0, import_common30.Param)("threadId")),
|
|
6543
|
+
_ts_param27(1, (0, import_common30.Param)("proposalId")),
|
|
6544
|
+
_ts_param27(2, (0, import_common30.Req)()),
|
|
6545
|
+
_ts_param27(3, (0, import_common30.Body)()),
|
|
6546
|
+
_ts_metadata27("design:type", Function),
|
|
6547
|
+
_ts_metadata27("design:paramtypes", [
|
|
6459
6548
|
String,
|
|
6460
6549
|
String,
|
|
6461
6550
|
typeof Request === "undefined" ? Object : Request,
|
|
6462
6551
|
Object
|
|
6463
6552
|
]),
|
|
6464
|
-
|
|
6553
|
+
_ts_metadata27("design:returntype", Promise)
|
|
6465
6554
|
], ActionProposalController.prototype, "reject", null);
|
|
6466
|
-
ActionProposalController =
|
|
6467
|
-
(0,
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6555
|
+
ActionProposalController = _ts_decorate29([
|
|
6556
|
+
(0, import_common30.Controller)("threads/:threadId/action-proposals"),
|
|
6557
|
+
_ts_param27(1, (0, import_common30.Inject)(import_nestjs_agent_core37.AGENT_ACTOR_RESOLVER)),
|
|
6558
|
+
_ts_metadata27("design:type", Function),
|
|
6559
|
+
_ts_metadata27("design:paramtypes", [
|
|
6471
6560
|
typeof ActionProposalService === "undefined" ? Object : ActionProposalService,
|
|
6472
6561
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
6473
6562
|
])
|
|
6474
6563
|
], ActionProposalController);
|
|
6475
6564
|
|
|
6476
6565
|
// src/runner/inline-agent-runner.ts
|
|
6477
|
-
var
|
|
6478
|
-
var
|
|
6479
|
-
function
|
|
6566
|
+
var import_nestjs_agent_core38 = require("@dudousxd/nestjs-agent-core");
|
|
6567
|
+
var import_common31 = require("@nestjs/common");
|
|
6568
|
+
function _ts_decorate30(decorators, target, key, desc) {
|
|
6480
6569
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6481
6570
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
6482
6571
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -6489,19 +6578,19 @@ function _ts_decorate29(decorators, target, key, desc) {
|
|
|
6489
6578
|
}
|
|
6490
6579
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6491
6580
|
}
|
|
6492
|
-
__name(
|
|
6493
|
-
function
|
|
6581
|
+
__name(_ts_decorate30, "_ts_decorate");
|
|
6582
|
+
function _ts_metadata28(metadataKey, metadataValue) {
|
|
6494
6583
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
6495
6584
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
6496
6585
|
}
|
|
6497
6586
|
}
|
|
6498
|
-
__name(
|
|
6499
|
-
function
|
|
6587
|
+
__name(_ts_metadata28, "_ts_metadata");
|
|
6588
|
+
function _ts_param28(paramIndex, decorator) {
|
|
6500
6589
|
return function(target, key) {
|
|
6501
6590
|
decorator(target, key, paramIndex);
|
|
6502
6591
|
};
|
|
6503
6592
|
}
|
|
6504
|
-
__name(
|
|
6593
|
+
__name(_ts_param28, "_ts_param");
|
|
6505
6594
|
var InlineAgentRunner = class _InlineAgentRunner {
|
|
6506
6595
|
static {
|
|
6507
6596
|
__name(this, "InlineAgentRunner");
|
|
@@ -6509,7 +6598,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6509
6598
|
factory;
|
|
6510
6599
|
store;
|
|
6511
6600
|
queue;
|
|
6512
|
-
logger = new
|
|
6601
|
+
logger = new import_common31.Logger(_InlineAgentRunner.name);
|
|
6513
6602
|
pending = /* @__PURE__ */ new Map();
|
|
6514
6603
|
/**
|
|
6515
6604
|
* Runs someone has asked to stop. In-process, like `pending`, and for the same reason: this runner
|
|
@@ -6563,18 +6652,18 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6563
6652
|
],
|
|
6564
6653
|
input
|
|
6565
6654
|
});
|
|
6566
|
-
void (0,
|
|
6655
|
+
void (0, import_nestjs_agent_core38.runAgentLoop)({
|
|
6567
6656
|
...deps,
|
|
6568
6657
|
day
|
|
6569
|
-
}, input, hooks).then(() => (0,
|
|
6570
|
-
if (error instanceof
|
|
6658
|
+
}, input, hooks).then(() => (0, import_nestjs_agent_core38.releaseThreadRun)(this.store, input.threadId, runId)).catch(async (error) => {
|
|
6659
|
+
if (error instanceof import_nestjs_agent_core38.RunCancelledError) {
|
|
6571
6660
|
await this.settleCancelled(runId, input, deps);
|
|
6572
6661
|
return;
|
|
6573
6662
|
}
|
|
6574
6663
|
const message = error instanceof Error ? error.message : String(error);
|
|
6575
|
-
const code = (0,
|
|
6664
|
+
const code = (0, import_nestjs_agent_core38.agentFailureCode)(error);
|
|
6576
6665
|
this.logger.error(`agent run ${runId} failed (${code}): ${message}`);
|
|
6577
|
-
(0,
|
|
6666
|
+
(0, import_nestjs_agent_core38.publishAgentRunFailed)({
|
|
6578
6667
|
runId,
|
|
6579
6668
|
code,
|
|
6580
6669
|
message
|
|
@@ -6585,11 +6674,11 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6585
6674
|
errorCode: code,
|
|
6586
6675
|
errorMessage: message
|
|
6587
6676
|
});
|
|
6588
|
-
await Promise.resolve(this.store.failUnsettledToolCalls?.(runId,
|
|
6677
|
+
await Promise.resolve(this.store.failUnsettledToolCalls?.(runId, import_nestjs_agent_core38.RUN_ENDED_BEFORE_TOOL_CALL)).catch(() => 0);
|
|
6589
6678
|
const writer = await deps.sink.open(runId);
|
|
6590
6679
|
await this.settleQueue(writer, input, runId, "failed", message);
|
|
6591
|
-
await (0,
|
|
6592
|
-
await writer.fail((0,
|
|
6680
|
+
await (0, import_nestjs_agent_core38.releaseThreadRun)(this.store, input.threadId, runId);
|
|
6681
|
+
await writer.fail((0, import_nestjs_agent_core38.streamFailure)(error));
|
|
6593
6682
|
}).finally(() => {
|
|
6594
6683
|
this.forgetCancel(runId);
|
|
6595
6684
|
this.live.delete(runId);
|
|
@@ -6624,11 +6713,11 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6624
6713
|
*/
|
|
6625
6714
|
async cancel(runId) {
|
|
6626
6715
|
this.cancelled.add(runId);
|
|
6627
|
-
this.aborts.get(runId)?.abort(new
|
|
6716
|
+
this.aborts.get(runId)?.abort(new import_nestjs_agent_core38.RunCancelledError());
|
|
6628
6717
|
for (const [key, waiter] of this.pending) {
|
|
6629
6718
|
if (key.startsWith(`${runId}:`)) {
|
|
6630
6719
|
this.pending.delete(key);
|
|
6631
|
-
waiter.reject(new
|
|
6720
|
+
waiter.reject(new import_nestjs_agent_core38.RunCancelledError());
|
|
6632
6721
|
}
|
|
6633
6722
|
}
|
|
6634
6723
|
await Promise.resolve();
|
|
@@ -6657,8 +6746,8 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6657
6746
|
this.logger.log(`agent run ${runId} cancelled`);
|
|
6658
6747
|
const writer = await deps.sink.open(runId);
|
|
6659
6748
|
await this.settleQueue(writer, input, runId, "cancelled");
|
|
6660
|
-
await (0,
|
|
6661
|
-
await writer.write((0,
|
|
6749
|
+
await (0, import_nestjs_agent_core38.releaseThreadRun)(this.store, input.threadId, runId);
|
|
6750
|
+
await writer.write((0, import_nestjs_agent_core38.encodeStreamEvent)({
|
|
6662
6751
|
kind: "cancelled"
|
|
6663
6752
|
}));
|
|
6664
6753
|
await writer.end();
|
|
@@ -6693,7 +6782,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6693
6782
|
runId: nextRunId
|
|
6694
6783
|
}));
|
|
6695
6784
|
if (frame !== void 0) {
|
|
6696
|
-
await writer.write((0,
|
|
6785
|
+
await writer.write((0, import_nestjs_agent_core38.encodeStreamEvent)(frame));
|
|
6697
6786
|
}
|
|
6698
6787
|
} catch (failure) {
|
|
6699
6788
|
this.logger.error(`could not advance the queue of thread ${input.threadId} after run ${runId}: ${failure instanceof Error ? failure.message : String(failure)}`);
|
|
@@ -6764,7 +6853,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6764
6853
|
awaitApproval: /* @__PURE__ */ __name((call, _ctx, opts) => this.parkApproval(runId, call.id, opts?.timeoutMs), "awaitApproval"),
|
|
6765
6854
|
awaitAnswers: /* @__PURE__ */ __name((request) => this.park(runId, request.id), "awaitAnswers"),
|
|
6766
6855
|
step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
|
|
6767
|
-
parallel:
|
|
6856
|
+
parallel: import_nestjs_agent_core38.settleAll,
|
|
6768
6857
|
cancelled: /* @__PURE__ */ __name(async () => this.cancelled.has(runId), "cancelled"),
|
|
6769
6858
|
abortSignal: this.abortSignalFor(runId),
|
|
6770
6859
|
runAgent: /* @__PURE__ */ __name((agentName, task) => this.runNested({
|
|
@@ -6816,7 +6905,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6816
6905
|
awaitApproval: /* @__PURE__ */ __name((call, _ctx, opts) => this.parkApproval(runId, call.id, opts?.timeoutMs), "awaitApproval"),
|
|
6817
6906
|
awaitAnswers: /* @__PURE__ */ __name((request) => this.park(runId, request.id), "awaitAnswers"),
|
|
6818
6907
|
step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
|
|
6819
|
-
parallel:
|
|
6908
|
+
parallel: import_nestjs_agent_core38.settleAll,
|
|
6820
6909
|
cancelled: /* @__PURE__ */ __name(async () => this.cancelled.has(runId), "cancelled"),
|
|
6821
6910
|
abortSignal: this.abortSignalFor(runId),
|
|
6822
6911
|
runAgent: /* @__PURE__ */ __name((childName, childTask) => this.runNested({
|
|
@@ -6850,7 +6939,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6850
6939
|
}
|
|
6851
6940
|
}), "startAgent")
|
|
6852
6941
|
};
|
|
6853
|
-
void (0,
|
|
6942
|
+
void (0, import_nestjs_agent_core38.runAgentLoop)({
|
|
6854
6943
|
...deps,
|
|
6855
6944
|
day
|
|
6856
6945
|
}, {
|
|
@@ -6864,13 +6953,13 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6864
6953
|
parentRunId,
|
|
6865
6954
|
deliverTo
|
|
6866
6955
|
}, hooks).catch(async (error) => {
|
|
6867
|
-
const cancelled = error instanceof
|
|
6956
|
+
const cancelled = error instanceof import_nestjs_agent_core38.RunCancelledError;
|
|
6868
6957
|
const message = error instanceof Error ? error.message : String(error);
|
|
6869
6958
|
if (!cancelled) {
|
|
6870
6959
|
this.logger.error(`detached agent run ${runId} failed: ${message}`);
|
|
6871
|
-
(0,
|
|
6960
|
+
(0, import_nestjs_agent_core38.publishAgentRunFailed)({
|
|
6872
6961
|
runId,
|
|
6873
|
-
code: (0,
|
|
6962
|
+
code: (0, import_nestjs_agent_core38.agentFailureCode)(error),
|
|
6874
6963
|
message
|
|
6875
6964
|
});
|
|
6876
6965
|
}
|
|
@@ -6878,12 +6967,12 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6878
6967
|
runId,
|
|
6879
6968
|
status: cancelled ? "cancelled" : "failed",
|
|
6880
6969
|
...cancelled ? {} : {
|
|
6881
|
-
errorCode: (0,
|
|
6970
|
+
errorCode: (0, import_nestjs_agent_core38.agentFailureCode)(error),
|
|
6882
6971
|
errorMessage: message
|
|
6883
6972
|
}
|
|
6884
6973
|
});
|
|
6885
|
-
await Promise.resolve(this.store.failUnsettledToolCalls?.(runId,
|
|
6886
|
-
await (0,
|
|
6974
|
+
await Promise.resolve(this.store.failUnsettledToolCalls?.(runId, import_nestjs_agent_core38.RUN_ENDED_BEFORE_TOOL_CALL)).catch(() => 0);
|
|
6975
|
+
await (0, import_nestjs_agent_core38.settleUnsettledDelegation)({
|
|
6887
6976
|
store: this.store,
|
|
6888
6977
|
delivery: deliverTo,
|
|
6889
6978
|
agent: agentName,
|
|
@@ -6922,7 +7011,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6922
7011
|
awaitApproval: /* @__PURE__ */ __name((call, _ctx, opts) => this.parkApproval(runId, call.id, opts?.timeoutMs), "awaitApproval"),
|
|
6923
7012
|
awaitAnswers: /* @__PURE__ */ __name((request) => this.park(runId, request.id), "awaitAnswers"),
|
|
6924
7013
|
step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
|
|
6925
|
-
parallel:
|
|
7014
|
+
parallel: import_nestjs_agent_core38.settleAll,
|
|
6926
7015
|
// A child stops when it is cancelled OR when the run a human is actually watching is: the
|
|
6927
7016
|
// canceller names the top-level run, which is the only id that ever left the server.
|
|
6928
7017
|
cancelled: /* @__PURE__ */ __name(async () => this.cancelled.has(runId) || this.cancelled.has(sinkRunId), "cancelled"),
|
|
@@ -6959,7 +7048,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6959
7048
|
}), "startAgent")
|
|
6960
7049
|
};
|
|
6961
7050
|
try {
|
|
6962
|
-
return await (0,
|
|
7051
|
+
return await (0, import_nestjs_agent_core38.runAgentLoop)({
|
|
6963
7052
|
...deps,
|
|
6964
7053
|
day
|
|
6965
7054
|
}, {
|
|
@@ -6978,13 +7067,13 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6978
7067
|
}
|
|
6979
7068
|
}
|
|
6980
7069
|
};
|
|
6981
|
-
InlineAgentRunner =
|
|
6982
|
-
(0,
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
7070
|
+
InlineAgentRunner = _ts_decorate30([
|
|
7071
|
+
(0, import_common31.Injectable)(),
|
|
7072
|
+
_ts_param28(0, (0, import_common31.Inject)(import_nestjs_agent_core38.AGENT_DEPS_FACTORY)),
|
|
7073
|
+
_ts_param28(1, (0, import_common31.Inject)(import_nestjs_agent_core38.AGENT_STORE)),
|
|
7074
|
+
_ts_param28(2, (0, import_common31.Optional)()),
|
|
7075
|
+
_ts_metadata28("design:type", Function),
|
|
7076
|
+
_ts_metadata28("design:paramtypes", [
|
|
6988
7077
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
6989
7078
|
typeof AgentStore === "undefined" ? Object : AgentStore,
|
|
6990
7079
|
typeof ChatQueueService2 === "undefined" ? Object : ChatQueueService2
|
|
@@ -6996,7 +7085,7 @@ function isThreadTurn2(input) {
|
|
|
6996
7085
|
__name(isThreadTurn2, "isThreadTurn");
|
|
6997
7086
|
|
|
6998
7087
|
// src/skills-config.ts
|
|
6999
|
-
var
|
|
7088
|
+
var import_nestjs_agent_core39 = require("@dudousxd/nestjs-agent-core");
|
|
7000
7089
|
function declaredSkillProvider(declared) {
|
|
7001
7090
|
return {
|
|
7002
7091
|
list: /* @__PURE__ */ __name(({ scopes }) => declared.filter((skill) => scopes.includes(skill.scope)).map(({ name, description, scope }) => ({
|
|
@@ -7022,7 +7111,7 @@ function resolveSkillsConfig(options, declared) {
|
|
|
7022
7111
|
declaredSkillProvider(declared)
|
|
7023
7112
|
];
|
|
7024
7113
|
return {
|
|
7025
|
-
provider: providers.length === 1 ? providers[0] : (0,
|
|
7114
|
+
provider: providers.length === 1 ? providers[0] : (0, import_nestjs_agent_core39.compositeSkillProvider)(providers),
|
|
7026
7115
|
...options.scopes !== void 0 ? {
|
|
7027
7116
|
scopes: options.scopes
|
|
7028
7117
|
} : {},
|
|
@@ -7034,7 +7123,7 @@ function resolveSkillsConfig(options, declared) {
|
|
|
7034
7123
|
__name(resolveSkillsConfig, "resolveSkillsConfig");
|
|
7035
7124
|
|
|
7036
7125
|
// src/agent.module.ts
|
|
7037
|
-
function
|
|
7126
|
+
function _ts_decorate31(decorators, target, key, desc) {
|
|
7038
7127
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7039
7128
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
7040
7129
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -7047,9 +7136,9 @@ function _ts_decorate30(decorators, target, key, desc) {
|
|
|
7047
7136
|
}
|
|
7048
7137
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7049
7138
|
}
|
|
7050
|
-
__name(
|
|
7139
|
+
__name(_ts_decorate31, "_ts_decorate");
|
|
7051
7140
|
var DEFAULT_PATH = "agent";
|
|
7052
|
-
var
|
|
7141
|
+
var logger2 = new import_common32.Logger("AgentModule");
|
|
7053
7142
|
function externalWrapper(modules, token) {
|
|
7054
7143
|
for (const module2 of modules.values()) {
|
|
7055
7144
|
if (module2.metatype === AgentModule) continue;
|
|
@@ -7081,22 +7170,22 @@ function forwardingStore(wrapper) {
|
|
|
7081
7170
|
__name(forwardingStore, "forwardingStore");
|
|
7082
7171
|
function resolveStore(options, modules) {
|
|
7083
7172
|
if (options.store !== void 0) return options.store;
|
|
7084
|
-
const external = externalWrapper(modules,
|
|
7173
|
+
const external = externalWrapper(modules, import_nestjs_agent_core40.AGENT_STORE);
|
|
7085
7174
|
if (external !== void 0) return forwardingStore(external);
|
|
7086
|
-
|
|
7087
|
-
return new
|
|
7175
|
+
logger2.warn("No `store` configured and no store module imported \u2014 using the in-memory store. Threads are lost on restart and not shared between processes: not for production. Pass `store`, or import a store module (e.g. MikroOrmAgentStoreModule.forFeature()).");
|
|
7176
|
+
return new import_nestjs_agent_core40.InMemoryAgentStore();
|
|
7088
7177
|
}
|
|
7089
7178
|
__name(resolveStore, "resolveStore");
|
|
7090
7179
|
function resolveRolesPolicy(options, modules) {
|
|
7091
|
-
const external = externalWrapper(modules,
|
|
7180
|
+
const external = externalWrapper(modules, import_nestjs_agent_core40.AGENT_ROLES_POLICY);
|
|
7092
7181
|
if (options.rolesPolicy !== void 0) {
|
|
7093
7182
|
if (external !== void 0) {
|
|
7094
|
-
|
|
7183
|
+
logger2.warn("Both a `rolesPolicy` option and a module binding AGENT_ROLES_POLICY (e.g. AgentAuthzModule) are configured \u2014 the `rolesPolicy` option wins.");
|
|
7095
7184
|
}
|
|
7096
7185
|
return options.rolesPolicy;
|
|
7097
7186
|
}
|
|
7098
7187
|
if (external !== void 0) return forwardingPolicy(external);
|
|
7099
|
-
return options.emptyRoles === "deny" ? new
|
|
7188
|
+
return options.emptyRoles === "deny" ? new import_nestjs_agent_core40.ClosedRolesPolicy(options.defaultRoles) : new import_nestjs_agent_core40.DefaultRolesPolicy(options.defaultRoles);
|
|
7100
7189
|
}
|
|
7101
7190
|
__name(resolveRolesPolicy, "resolveRolesPolicy");
|
|
7102
7191
|
function forwardingPolicy(wrapper) {
|
|
@@ -7124,102 +7213,105 @@ __name(resolveCatalog, "resolveCatalog");
|
|
|
7124
7213
|
function sharedProviders(durable, engine) {
|
|
7125
7214
|
const providers = [
|
|
7126
7215
|
{
|
|
7127
|
-
provide:
|
|
7128
|
-
useFactory: /* @__PURE__ */ __name(() => new
|
|
7216
|
+
provide: import_nestjs_agent_core40.AGENT_TOOL_REGISTRY,
|
|
7217
|
+
useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core40.ToolRegistry(), "useFactory")
|
|
7129
7218
|
},
|
|
7130
7219
|
// Starts empty; AgentDiscoveryService populates it from `@Agent`-decorated providers at boot.
|
|
7131
7220
|
{
|
|
7132
|
-
provide:
|
|
7133
|
-
useFactory: /* @__PURE__ */ __name(() => new
|
|
7221
|
+
provide: import_nestjs_agent_core40.AGENT_REGISTRY,
|
|
7222
|
+
useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core40.AgentRegistry(), "useFactory")
|
|
7134
7223
|
},
|
|
7135
7224
|
// A shared, mutable list AgentDiscoveryService fills with `@SystemPromptContributor()` methods.
|
|
7136
7225
|
{
|
|
7137
|
-
provide:
|
|
7226
|
+
provide: import_nestjs_agent_core40.AGENT_PROMPT_CONTRIBUTORS,
|
|
7138
7227
|
useFactory: /* @__PURE__ */ __name(() => [], "useFactory")
|
|
7139
7228
|
},
|
|
7140
7229
|
// Likewise for `@Skill`-decorated providers — filled by SkillDiscoveryService at onModuleInit,
|
|
7141
7230
|
// read lazily by the AGENT_SKILLS provider below (which DI builds before discovery has run).
|
|
7142
7231
|
{
|
|
7143
|
-
provide:
|
|
7232
|
+
provide: import_nestjs_agent_core40.AGENT_SKILL_SOURCES,
|
|
7144
7233
|
useFactory: /* @__PURE__ */ __name(() => [], "useFactory")
|
|
7145
7234
|
},
|
|
7146
7235
|
{
|
|
7147
7236
|
// One resolution, shared by the loop's deps and the listing endpoint: a second one would
|
|
7148
7237
|
// drift, and a user would be offered a skill the agent cannot reach. `undefined` when the
|
|
7149
7238
|
// host configured none — which is what keeps the turn's checkpoint sequence unchanged.
|
|
7150
|
-
provide:
|
|
7239
|
+
provide: import_nestjs_agent_core40.AGENT_SKILLS,
|
|
7151
7240
|
useFactory: /* @__PURE__ */ __name((options, declared) => resolveSkillsConfig(options.skills, declared), "useFactory"),
|
|
7152
7241
|
inject: [
|
|
7153
|
-
|
|
7154
|
-
|
|
7242
|
+
import_nestjs_agent_core40.AGENT_OPTIONS,
|
|
7243
|
+
import_nestjs_agent_core40.AGENT_SKILL_SOURCES
|
|
7155
7244
|
]
|
|
7156
7245
|
},
|
|
7157
7246
|
{
|
|
7158
7247
|
// One resolution, shared by the loop's deps and the read-back endpoint: a person has to be
|
|
7159
7248
|
// shown what the model was shown, and two resolutions would eventually disagree about that.
|
|
7160
|
-
provide:
|
|
7249
|
+
provide: import_nestjs_agent_core40.AGENT_MEMORY,
|
|
7161
7250
|
useFactory: /* @__PURE__ */ __name((options) => options.memory, "useFactory"),
|
|
7162
7251
|
inject: [
|
|
7163
|
-
|
|
7252
|
+
import_nestjs_agent_core40.AGENT_OPTIONS
|
|
7164
7253
|
]
|
|
7165
7254
|
},
|
|
7166
7255
|
{
|
|
7167
|
-
provide:
|
|
7256
|
+
provide: import_nestjs_agent_core40.AGENT_SINK,
|
|
7168
7257
|
useFactory: /* @__PURE__ */ __name((options) => options.sink ?? new InProcessTokenStreamSink(), "useFactory"),
|
|
7169
7258
|
inject: [
|
|
7170
|
-
|
|
7259
|
+
import_nestjs_agent_core40.AGENT_OPTIONS
|
|
7171
7260
|
]
|
|
7172
7261
|
},
|
|
7173
7262
|
{
|
|
7174
|
-
provide:
|
|
7263
|
+
provide: import_nestjs_agent_core40.AGENT_ROLES_POLICY,
|
|
7175
7264
|
useFactory: /* @__PURE__ */ __name((options, modules) => resolveRolesPolicy(options, modules), "useFactory"),
|
|
7176
7265
|
inject: [
|
|
7177
|
-
|
|
7266
|
+
import_nestjs_agent_core40.AGENT_OPTIONS,
|
|
7178
7267
|
import_core4.ModulesContainer
|
|
7179
7268
|
]
|
|
7180
7269
|
},
|
|
7181
7270
|
{
|
|
7182
|
-
provide:
|
|
7271
|
+
provide: import_nestjs_agent_core40.AGENT_ACTOR_RESOLVER,
|
|
7183
7272
|
useFactory: /* @__PURE__ */ __name((options) => {
|
|
7184
7273
|
if (options.actorResolver !== void 0) return options.actorResolver;
|
|
7185
|
-
|
|
7274
|
+
logger2.warn("No `actorResolver` configured \u2014 the agent endpoints are PUBLIC: every browser gets its own anonymous identity (an HttpOnly cookie). Set `actorResolver: requestUserActorResolver()` (or your own) to require login.");
|
|
7186
7275
|
return new AnonymousActorResolver();
|
|
7187
7276
|
}, "useFactory"),
|
|
7188
7277
|
inject: [
|
|
7189
|
-
|
|
7278
|
+
import_nestjs_agent_core40.AGENT_OPTIONS
|
|
7190
7279
|
]
|
|
7191
7280
|
},
|
|
7192
7281
|
{
|
|
7193
|
-
provide:
|
|
7282
|
+
provide: import_nestjs_agent_core40.AGENT_MODEL,
|
|
7194
7283
|
useFactory: /* @__PURE__ */ __name((o) => o.model, "useFactory"),
|
|
7195
7284
|
inject: [
|
|
7196
|
-
|
|
7285
|
+
import_nestjs_agent_core40.AGENT_OPTIONS
|
|
7197
7286
|
]
|
|
7198
7287
|
},
|
|
7199
7288
|
{
|
|
7200
7289
|
// `quota` is either a provider of the host's own or ceilings for the built-in ledger one;
|
|
7201
7290
|
// omitted, the ledger provider still reports usage, with no ceiling to block on.
|
|
7202
|
-
provide:
|
|
7291
|
+
provide: import_nestjs_agent_core40.AGENT_QUOTA_PROVIDER,
|
|
7203
7292
|
useFactory: /* @__PURE__ */ __name((o, store) => isQuotaProvider(o.quota) ? o.quota : new LedgerQuotaProvider(store, o.quota?.limits, o.quota?.warnAt !== void 0 ? {
|
|
7204
7293
|
warnAt: o.quota.warnAt
|
|
7205
7294
|
} : {}), "useFactory"),
|
|
7206
7295
|
inject: [
|
|
7207
|
-
|
|
7208
|
-
|
|
7296
|
+
import_nestjs_agent_core40.AGENT_OPTIONS,
|
|
7297
|
+
import_nestjs_agent_core40.AGENT_STORE
|
|
7209
7298
|
]
|
|
7210
7299
|
},
|
|
7211
7300
|
{
|
|
7212
|
-
provide:
|
|
7301
|
+
provide: import_nestjs_agent_core40.AGENT_MODEL_CATALOG,
|
|
7213
7302
|
useFactory: /* @__PURE__ */ __name((o) => resolveCatalog(o), "useFactory"),
|
|
7214
7303
|
inject: [
|
|
7215
|
-
|
|
7304
|
+
import_nestjs_agent_core40.AGENT_OPTIONS
|
|
7216
7305
|
]
|
|
7217
7306
|
},
|
|
7218
7307
|
AgentDepsFactory2,
|
|
7219
7308
|
{
|
|
7220
|
-
provide:
|
|
7309
|
+
provide: import_nestjs_agent_core40.AGENT_DEPS_FACTORY,
|
|
7221
7310
|
useExisting: AgentDepsFactory2
|
|
7222
7311
|
},
|
|
7312
|
+
// Seeds a configured model's missing price row from models.dev and warns about one that would
|
|
7313
|
+
// record no cost (`priceCatalog`), once the app has bootstrapped.
|
|
7314
|
+
PricingBootService,
|
|
7223
7315
|
// Populates the registry + contributors (onModuleInit) BEFORE AiToolDiscoveryService synthesizes
|
|
7224
7316
|
// handoff tools (onApplicationBootstrap) reads the registry.
|
|
7225
7317
|
AgentDiscoveryService,
|
|
@@ -7240,26 +7332,26 @@ function sharedProviders(durable, engine) {
|
|
|
7240
7332
|
// through AgentService.signalToolCall, which reaches whichever AGENT_RUNNER is bound above.
|
|
7241
7333
|
AgentApprovalPortAdapter,
|
|
7242
7334
|
{
|
|
7243
|
-
provide:
|
|
7335
|
+
provide: import_nestjs_agent_core40.AGENT_APPROVAL_PORT,
|
|
7244
7336
|
useExisting: AgentApprovalPortAdapter
|
|
7245
7337
|
}
|
|
7246
7338
|
];
|
|
7247
7339
|
providers.push({
|
|
7248
|
-
provide:
|
|
7340
|
+
provide: import_nestjs_agent_core40.AGENT_STORE,
|
|
7249
7341
|
useFactory: /* @__PURE__ */ __name((o, modules) => resolveStore(o, modules), "useFactory"),
|
|
7250
7342
|
inject: [
|
|
7251
|
-
|
|
7343
|
+
import_nestjs_agent_core40.AGENT_OPTIONS,
|
|
7252
7344
|
import_core4.ModulesContainer
|
|
7253
7345
|
]
|
|
7254
7346
|
});
|
|
7255
7347
|
if (engine !== void 0) {
|
|
7256
7348
|
providers.push(...engine.providers, {
|
|
7257
|
-
provide:
|
|
7349
|
+
provide: import_nestjs_agent_core40.AGENT_RUNNER,
|
|
7258
7350
|
useExisting: engine.runner
|
|
7259
7351
|
});
|
|
7260
7352
|
} else if (durable) {
|
|
7261
7353
|
providers.push({
|
|
7262
|
-
provide:
|
|
7354
|
+
provide: import_nestjs_agent_core40.AGENT_RUNNER,
|
|
7263
7355
|
useFactory: /* @__PURE__ */ __name((durableRunner) => {
|
|
7264
7356
|
if (durableRunner === void 0) {
|
|
7265
7357
|
throw new Error("AgentModule.forRoot({ durable: true }) requires importing AgentDurableModule from '@dudousxd/nestjs-agent/durable' (alongside a configured DurableModule). It was not found.");
|
|
@@ -7268,14 +7360,14 @@ function sharedProviders(durable, engine) {
|
|
|
7268
7360
|
}, "useFactory"),
|
|
7269
7361
|
inject: [
|
|
7270
7362
|
{
|
|
7271
|
-
token:
|
|
7363
|
+
token: import_nestjs_agent_core40.AGENT_DURABLE_RUNNER,
|
|
7272
7364
|
optional: true
|
|
7273
7365
|
}
|
|
7274
7366
|
]
|
|
7275
7367
|
});
|
|
7276
7368
|
} else {
|
|
7277
7369
|
providers.push({
|
|
7278
|
-
provide:
|
|
7370
|
+
provide: import_nestjs_agent_core40.AGENT_RUNNER,
|
|
7279
7371
|
useExisting: InlineAgentRunner
|
|
7280
7372
|
});
|
|
7281
7373
|
}
|
|
@@ -7285,20 +7377,20 @@ __name(sharedProviders, "sharedProviders");
|
|
|
7285
7377
|
function exportsFor(engine) {
|
|
7286
7378
|
return [
|
|
7287
7379
|
...engine?.exports ?? [],
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7380
|
+
import_nestjs_agent_core40.AGENT_OPTIONS,
|
|
7381
|
+
import_nestjs_agent_core40.AGENT_TOOL_REGISTRY,
|
|
7382
|
+
import_nestjs_agent_core40.AGENT_REGISTRY,
|
|
7383
|
+
import_nestjs_agent_core40.AGENT_SINK,
|
|
7384
|
+
import_nestjs_agent_core40.AGENT_ROLES_POLICY,
|
|
7385
|
+
import_nestjs_agent_core40.AGENT_ACTOR_RESOLVER,
|
|
7386
|
+
import_nestjs_agent_core40.AGENT_MODEL,
|
|
7387
|
+
import_nestjs_agent_core40.AGENT_STORE,
|
|
7388
|
+
import_nestjs_agent_core40.AGENT_MODEL_CATALOG,
|
|
7389
|
+
import_nestjs_agent_core40.AGENT_QUOTA_PROVIDER,
|
|
7390
|
+
import_nestjs_agent_core40.AGENT_PROMPT_CONTRIBUTORS,
|
|
7391
|
+
import_nestjs_agent_core40.AGENT_SKILLS,
|
|
7392
|
+
import_nestjs_agent_core40.AGENT_MEMORY,
|
|
7393
|
+
import_nestjs_agent_core40.AGENT_DEPS_FACTORY,
|
|
7302
7394
|
AgentDepsFactory2,
|
|
7303
7395
|
AgentService,
|
|
7304
7396
|
ActionProposalService,
|
|
@@ -7306,7 +7398,7 @@ function exportsFor(engine) {
|
|
|
7306
7398
|
ChatQueueService2,
|
|
7307
7399
|
AGENT_CHAT_QUEUE,
|
|
7308
7400
|
InlineAgentRunner,
|
|
7309
|
-
|
|
7401
|
+
import_nestjs_agent_core40.AGENT_APPROVAL_PORT
|
|
7310
7402
|
];
|
|
7311
7403
|
}
|
|
7312
7404
|
__name(exportsFor, "exportsFor");
|
|
@@ -7395,7 +7487,7 @@ var AgentModule = class _AgentModule {
|
|
|
7395
7487
|
controllers: controllersForSurface(options.surface, options.adapters, options.engine),
|
|
7396
7488
|
providers: [
|
|
7397
7489
|
{
|
|
7398
|
-
provide:
|
|
7490
|
+
provide: import_nestjs_agent_core40.AGENT_OPTIONS,
|
|
7399
7491
|
useValue: options
|
|
7400
7492
|
},
|
|
7401
7493
|
...sharedProviders(options.durable ?? false, options.engine),
|
|
@@ -7425,7 +7517,7 @@ var AgentModule = class _AgentModule {
|
|
|
7425
7517
|
controllers: controllersForSurface(options.surface, options.adapters, options.engine),
|
|
7426
7518
|
providers: [
|
|
7427
7519
|
{
|
|
7428
|
-
provide:
|
|
7520
|
+
provide: import_nestjs_agent_core40.AGENT_OPTIONS,
|
|
7429
7521
|
// Stamp the STATIC wiring flags onto the factory result: `durable`/`surface` are
|
|
7430
7522
|
// authoritative on the async config object (they decided the actual wiring above), and
|
|
7431
7523
|
// the durable module reads `durable` back off AGENT_OPTIONS. `surface` isn't read back by
|
|
@@ -7454,9 +7546,9 @@ var AgentModule = class _AgentModule {
|
|
|
7454
7546
|
};
|
|
7455
7547
|
}
|
|
7456
7548
|
};
|
|
7457
|
-
AgentModule =
|
|
7458
|
-
(0,
|
|
7459
|
-
(0,
|
|
7549
|
+
AgentModule = _ts_decorate31([
|
|
7550
|
+
(0, import_common32.Global)(),
|
|
7551
|
+
(0, import_common32.Module)({})
|
|
7460
7552
|
], AgentModule);
|
|
7461
7553
|
|
|
7462
7554
|
// src/durable/agent-durable.ts
|