@dudousxd/nestjs-agent 1.25.1 → 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 +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DynamicModule, Type, OnApplicationBootstrap, OnModuleInit, ConflictException, OnModuleDestroy } from '@nestjs/common';
|
|
2
|
-
import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter, e as AgentSkillsOptions } from './chat-queue.service-
|
|
3
|
-
export { f as AGENT_TOOL_BRAND, g as AgentAttachmentsOptions, h as AgentDeps, i as AgentEngine, j as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, L as LedgerQuotaProvider, Q as QueuePlan, k as QueueSettleOutcome, l as QueuedTurn, m as QueuedTurnStarter, n as QuotaLimits, o as QuotaWindowLimits, p as defineTool, q as delegateToolName, r as provideAgentTool, s as provideAgentTools, u as utcDay } from './chat-queue.service-
|
|
2
|
+
import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter, e as AgentSkillsOptions } from './chat-queue.service-BN6Ljswx.cjs';
|
|
3
|
+
export { f as AGENT_TOOL_BRAND, g as AgentAttachmentsOptions, h as AgentDeps, i as AgentEngine, j as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, L as LedgerQuotaProvider, Q as QueuePlan, k as QueueSettleOutcome, l as QueuedTurn, m as QueuedTurnStarter, n as QuotaLimits, o as QuotaWindowLimits, p as defineTool, q as delegateToolName, r as provideAgentTool, s as provideAgentTools, u as utcDay } from './chat-queue.service-BN6Ljswx.cjs';
|
|
4
4
|
import * as _dudousxd_nestjs_agent_core from '@dudousxd/nestjs-agent-core';
|
|
5
5
|
import { AgentAttachmentConfig, AttachmentStagingStore, AgentStore, Actor, ListActionProposals, ActionProposalView, ActionProposalMutationView, TextActionProposalVocabulary, AgentRunner, ModelCatalog, QuotaProvider, ActionApprovalMode, MessageAttachment, QuotaReport, ModelCatalogView, AgentHostContext, AttachmentRef, PageContext, ChatQueueState, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, ActorResolver, AgentApprovalPort, AgentClientConfig, ToolSpec, ToolPresentation, AgentHistoryWindow, AgentIntake, Persona, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, ToolCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, AgentRunStartOptions, TokenStreamSink, SinkWriter, ActionProposal } from '@dudousxd/nestjs-agent-core';
|
|
6
6
|
export * from '@dudousxd/nestjs-agent-core';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DynamicModule, Type, OnApplicationBootstrap, OnModuleInit, ConflictException, OnModuleDestroy } from '@nestjs/common';
|
|
2
|
-
import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter, e as AgentSkillsOptions } from './chat-queue.service-
|
|
3
|
-
export { f as AGENT_TOOL_BRAND, g as AgentAttachmentsOptions, h as AgentDeps, i as AgentEngine, j as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, L as LedgerQuotaProvider, Q as QueuePlan, k as QueueSettleOutcome, l as QueuedTurn, m as QueuedTurnStarter, n as QuotaLimits, o as QuotaWindowLimits, p as defineTool, q as delegateToolName, r as provideAgentTool, s as provideAgentTools, u as utcDay } from './chat-queue.service-
|
|
2
|
+
import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, C as ChatQueueService, d as AgentProtocolAdapter, e as AgentSkillsOptions } from './chat-queue.service-DG44iDJA.js';
|
|
3
|
+
export { f as AGENT_TOOL_BRAND, g as AgentAttachmentsOptions, h as AgentDeps, i as AgentEngine, j as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, L as LedgerQuotaProvider, Q as QueuePlan, k as QueueSettleOutcome, l as QueuedTurn, m as QueuedTurnStarter, n as QuotaLimits, o as QuotaWindowLimits, p as defineTool, q as delegateToolName, r as provideAgentTool, s as provideAgentTools, u as utcDay } from './chat-queue.service-DG44iDJA.js';
|
|
4
4
|
import * as _dudousxd_nestjs_agent_core from '@dudousxd/nestjs-agent-core';
|
|
5
5
|
import { AgentAttachmentConfig, AttachmentStagingStore, AgentStore, Actor, ListActionProposals, ActionProposalView, ActionProposalMutationView, TextActionProposalVocabulary, AgentRunner, ModelCatalog, QuotaProvider, ActionApprovalMode, MessageAttachment, QuotaReport, ModelCatalogView, AgentHostContext, AttachmentRef, PageContext, ChatQueueState, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, ActorResolver, AgentApprovalPort, AgentClientConfig, ToolSpec, ToolPresentation, AgentHistoryWindow, AgentIntake, Persona, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, ToolCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, AgentRunStartOptions, TokenStreamSink, SinkWriter, ActionProposal } from '@dudousxd/nestjs-agent-core';
|
|
6
6
|
export * from '@dudousxd/nestjs-agent-core';
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
4
|
// src/agent.module.ts
|
|
5
|
-
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER14, AGENT_APPROVAL_PORT, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY7, AGENT_DURABLE_RUNNER, AGENT_MEMORY as AGENT_MEMORY3, AGENT_MODEL as
|
|
6
|
-
import { Global, Logger as
|
|
5
|
+
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER14, AGENT_APPROVAL_PORT, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY7, AGENT_DURABLE_RUNNER, AGENT_MEMORY as AGENT_MEMORY3, AGENT_MODEL as AGENT_MODEL3, AGENT_MODEL_CATALOG as AGENT_MODEL_CATALOG3, AGENT_OPTIONS as AGENT_OPTIONS10, AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS3, AGENT_QUOTA_PROVIDER as AGENT_QUOTA_PROVIDER3, 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_STORE7, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY3, AgentRegistry as AgentRegistry6, ClosedRolesPolicy, DefaultRolesPolicy, InMemoryAgentStore, ToolRegistry as ToolRegistry3 } from "@dudousxd/nestjs-agent-core";
|
|
6
|
+
import { Global, Logger as Logger8, Module as Module2 } from "@nestjs/common";
|
|
7
7
|
import { DiscoveryModule, ModulesContainer, RouterModule } from "@nestjs/core";
|
|
8
8
|
|
|
9
9
|
// src/agent-deps.factory.ts
|
|
@@ -5145,10 +5145,9 @@ var LedgerQuotaProvider = class {
|
|
|
5145
5145
|
}
|
|
5146
5146
|
};
|
|
5147
5147
|
|
|
5148
|
-
// src/
|
|
5149
|
-
import {
|
|
5150
|
-
import {
|
|
5151
|
-
import { Inject as Inject22, Injectable as Injectable9, Logger as Logger5 } from "@nestjs/common";
|
|
5148
|
+
// src/pricing-boot.service.ts
|
|
5149
|
+
import { AGENT_MODEL as AGENT_MODEL2, AGENT_OPTIONS as AGENT_OPTIONS8, AGENT_PRICING_STORE as AGENT_PRICING_STORE2, ensureModelPricing } from "@dudousxd/nestjs-agent-core";
|
|
5150
|
+
import { Inject as Inject22, Injectable as Injectable9, Logger as Logger5, Optional as Optional9 } from "@nestjs/common";
|
|
5152
5151
|
function _ts_decorate23(decorators, target, key, desc) {
|
|
5153
5152
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5154
5153
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
@@ -5175,6 +5174,96 @@ function _ts_param22(paramIndex, decorator) {
|
|
|
5175
5174
|
};
|
|
5176
5175
|
}
|
|
5177
5176
|
__name(_ts_param22, "_ts_param");
|
|
5177
|
+
var logger = new Logger5("AgentPricing");
|
|
5178
|
+
var PricingBootService = class {
|
|
5179
|
+
static {
|
|
5180
|
+
__name(this, "PricingBootService");
|
|
5181
|
+
}
|
|
5182
|
+
options;
|
|
5183
|
+
model;
|
|
5184
|
+
pricingStore;
|
|
5185
|
+
#run = null;
|
|
5186
|
+
constructor(options, model, pricingStore) {
|
|
5187
|
+
this.options = options;
|
|
5188
|
+
this.model = model;
|
|
5189
|
+
this.pricingStore = pricingStore;
|
|
5190
|
+
}
|
|
5191
|
+
onApplicationBootstrap() {
|
|
5192
|
+
this.#run = this.check();
|
|
5193
|
+
}
|
|
5194
|
+
/** Awaits a check still in flight, so a test (or a fast shutdown) never leaks it. */
|
|
5195
|
+
async onApplicationShutdown() {
|
|
5196
|
+
await this.#run;
|
|
5197
|
+
this.#run = null;
|
|
5198
|
+
}
|
|
5199
|
+
/** The check itself; resolves once it is done (exposed for tests). */
|
|
5200
|
+
async check() {
|
|
5201
|
+
let models;
|
|
5202
|
+
try {
|
|
5203
|
+
models = this.model?.describeModels?.() ?? [];
|
|
5204
|
+
} catch (error) {
|
|
5205
|
+
logger.warn(`describeModels() threw; boot pricing skipped: ${String(error)}`);
|
|
5206
|
+
return;
|
|
5207
|
+
}
|
|
5208
|
+
if (models.length === 0) return;
|
|
5209
|
+
const catalog = this.options.priceCatalog;
|
|
5210
|
+
if (catalog === void 0 && process.env.NODE_ENV === "test") return;
|
|
5211
|
+
await ensureModelPricing({
|
|
5212
|
+
models,
|
|
5213
|
+
pricingStore: this.pricingStore,
|
|
5214
|
+
catalog: catalog ?? {},
|
|
5215
|
+
log: {
|
|
5216
|
+
info: /* @__PURE__ */ __name((message) => logger.log(message), "info"),
|
|
5217
|
+
warn: /* @__PURE__ */ __name((message) => logger.warn(message), "warn")
|
|
5218
|
+
}
|
|
5219
|
+
}).catch(() => void 0);
|
|
5220
|
+
}
|
|
5221
|
+
};
|
|
5222
|
+
PricingBootService = _ts_decorate23([
|
|
5223
|
+
Injectable9(),
|
|
5224
|
+
_ts_param22(0, Inject22(AGENT_OPTIONS8)),
|
|
5225
|
+
_ts_param22(1, Optional9()),
|
|
5226
|
+
_ts_param22(1, Inject22(AGENT_MODEL2)),
|
|
5227
|
+
_ts_param22(2, Optional9()),
|
|
5228
|
+
_ts_param22(2, Inject22(AGENT_PRICING_STORE2)),
|
|
5229
|
+
_ts_metadata22("design:type", Function),
|
|
5230
|
+
_ts_metadata22("design:paramtypes", [
|
|
5231
|
+
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
5232
|
+
Object,
|
|
5233
|
+
Object
|
|
5234
|
+
])
|
|
5235
|
+
], PricingBootService);
|
|
5236
|
+
|
|
5237
|
+
// src/proposals/action-proposal-worker.service.ts
|
|
5238
|
+
import { randomUUID } from "crypto";
|
|
5239
|
+
import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY5, AGENT_OPTIONS as AGENT_OPTIONS9, AGENT_STORE as AGENT_STORE5, ActionProposalExecutor, ActionProposalWorker, assertIndependentActionCapabilities as assertIndependentActionCapabilities2 } from "@dudousxd/nestjs-agent-core";
|
|
5240
|
+
import { Inject as Inject23, Injectable as Injectable10, Logger as Logger6 } from "@nestjs/common";
|
|
5241
|
+
function _ts_decorate24(decorators, target, key, desc) {
|
|
5242
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5243
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
5244
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
5245
|
+
} else {
|
|
5246
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
5247
|
+
if (d = decorators[i]) {
|
|
5248
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5249
|
+
}
|
|
5250
|
+
}
|
|
5251
|
+
}
|
|
5252
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5253
|
+
}
|
|
5254
|
+
__name(_ts_decorate24, "_ts_decorate");
|
|
5255
|
+
function _ts_metadata23(metadataKey, metadataValue) {
|
|
5256
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
5257
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
5258
|
+
}
|
|
5259
|
+
}
|
|
5260
|
+
__name(_ts_metadata23, "_ts_metadata");
|
|
5261
|
+
function _ts_param23(paramIndex, decorator) {
|
|
5262
|
+
return function(target, key) {
|
|
5263
|
+
decorator(target, key, paramIndex);
|
|
5264
|
+
};
|
|
5265
|
+
}
|
|
5266
|
+
__name(_ts_param23, "_ts_param");
|
|
5178
5267
|
var ActionProposalWorkerService = class _ActionProposalWorkerService {
|
|
5179
5268
|
static {
|
|
5180
5269
|
__name(this, "ActionProposalWorkerService");
|
|
@@ -5183,7 +5272,7 @@ var ActionProposalWorkerService = class _ActionProposalWorkerService {
|
|
|
5183
5272
|
options;
|
|
5184
5273
|
deps;
|
|
5185
5274
|
worker;
|
|
5186
|
-
logger = new
|
|
5275
|
+
logger = new Logger6(_ActionProposalWorkerService.name);
|
|
5187
5276
|
settledListeners = /* @__PURE__ */ new Set();
|
|
5188
5277
|
/**
|
|
5189
5278
|
* Run `listener` after every proposal this process's worker settles — how a module relays an
|
|
@@ -5252,13 +5341,13 @@ var ActionProposalWorkerService = class _ActionProposalWorkerService {
|
|
|
5252
5341
|
await this.worker?.stop();
|
|
5253
5342
|
}
|
|
5254
5343
|
};
|
|
5255
|
-
ActionProposalWorkerService =
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5344
|
+
ActionProposalWorkerService = _ts_decorate24([
|
|
5345
|
+
Injectable10(),
|
|
5346
|
+
_ts_param23(0, Inject23(AGENT_STORE5)),
|
|
5347
|
+
_ts_param23(1, Inject23(AGENT_OPTIONS9)),
|
|
5348
|
+
_ts_param23(2, Inject23(AGENT_DEPS_FACTORY5)),
|
|
5349
|
+
_ts_metadata23("design:type", Function),
|
|
5350
|
+
_ts_metadata23("design:paramtypes", [
|
|
5262
5351
|
typeof AgentStore === "undefined" ? Object : AgentStore,
|
|
5263
5352
|
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
5264
5353
|
typeof AgentDepsFactory2 === "undefined" ? Object : AgentDepsFactory2
|
|
@@ -5267,8 +5356,8 @@ ActionProposalWorkerService = _ts_decorate23([
|
|
|
5267
5356
|
|
|
5268
5357
|
// src/proposals/action-proposal.controller.ts
|
|
5269
5358
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER13, validateActionProposalListQuery } from "@dudousxd/nestjs-agent-core";
|
|
5270
|
-
import { BadRequestException as BadRequestException7, Body as Body6, Controller as Controller14, Get as Get12, Inject as
|
|
5271
|
-
function
|
|
5359
|
+
import { BadRequestException as BadRequestException7, Body as Body6, Controller as Controller14, Get as Get12, Inject as Inject24, Param as Param6, Post as Post7, Query as Query6, Req as Req13, Res as Res2 } from "@nestjs/common";
|
|
5360
|
+
function _ts_decorate25(decorators, target, key, desc) {
|
|
5272
5361
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5273
5362
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
5274
5363
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -5281,19 +5370,19 @@ function _ts_decorate24(decorators, target, key, desc) {
|
|
|
5281
5370
|
}
|
|
5282
5371
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5283
5372
|
}
|
|
5284
|
-
__name(
|
|
5285
|
-
function
|
|
5373
|
+
__name(_ts_decorate25, "_ts_decorate");
|
|
5374
|
+
function _ts_metadata24(metadataKey, metadataValue) {
|
|
5286
5375
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
5287
5376
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
5288
5377
|
}
|
|
5289
5378
|
}
|
|
5290
|
-
__name(
|
|
5291
|
-
function
|
|
5379
|
+
__name(_ts_metadata24, "_ts_metadata");
|
|
5380
|
+
function _ts_param24(paramIndex, decorator) {
|
|
5292
5381
|
return function(target, key) {
|
|
5293
5382
|
decorator(target, key, paramIndex);
|
|
5294
5383
|
};
|
|
5295
5384
|
}
|
|
5296
|
-
__name(
|
|
5385
|
+
__name(_ts_param24, "_ts_param");
|
|
5297
5386
|
function bodyFields(body, field2) {
|
|
5298
5387
|
if (body === void 0) return {};
|
|
5299
5388
|
if (typeof body !== "object" || body === null || Array.isArray(body) || Object.keys(body).some((key) => key !== field2)) throw new BadRequestException7(`Only ${field2} is accepted`);
|
|
@@ -5352,58 +5441,58 @@ var ActionProposalController = class {
|
|
|
5352
5441
|
});
|
|
5353
5442
|
}
|
|
5354
5443
|
};
|
|
5355
|
-
|
|
5444
|
+
_ts_decorate25([
|
|
5356
5445
|
Get12(),
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5446
|
+
_ts_param24(0, Param6("threadId")),
|
|
5447
|
+
_ts_param24(1, Req13()),
|
|
5448
|
+
_ts_param24(2, Query6("after")),
|
|
5449
|
+
_ts_param24(3, Res2({
|
|
5361
5450
|
passthrough: true
|
|
5362
5451
|
})),
|
|
5363
|
-
|
|
5364
|
-
|
|
5452
|
+
_ts_metadata24("design:type", Function),
|
|
5453
|
+
_ts_metadata24("design:paramtypes", [
|
|
5365
5454
|
String,
|
|
5366
5455
|
typeof Request === "undefined" ? Object : Request,
|
|
5367
5456
|
Object,
|
|
5368
5457
|
typeof Response === "undefined" ? Object : Response
|
|
5369
5458
|
]),
|
|
5370
|
-
|
|
5459
|
+
_ts_metadata24("design:returntype", Promise)
|
|
5371
5460
|
], ActionProposalController.prototype, "list", null);
|
|
5372
|
-
|
|
5461
|
+
_ts_decorate25([
|
|
5373
5462
|
Post7(":proposalId/approve"),
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5463
|
+
_ts_param24(0, Param6("threadId")),
|
|
5464
|
+
_ts_param24(1, Param6("proposalId")),
|
|
5465
|
+
_ts_param24(2, Req13()),
|
|
5466
|
+
_ts_param24(3, Body6()),
|
|
5467
|
+
_ts_metadata24("design:type", Function),
|
|
5468
|
+
_ts_metadata24("design:paramtypes", [
|
|
5380
5469
|
String,
|
|
5381
5470
|
String,
|
|
5382
5471
|
typeof Request === "undefined" ? Object : Request,
|
|
5383
5472
|
Object
|
|
5384
5473
|
]),
|
|
5385
|
-
|
|
5474
|
+
_ts_metadata24("design:returntype", Promise)
|
|
5386
5475
|
], ActionProposalController.prototype, "approve", null);
|
|
5387
|
-
|
|
5476
|
+
_ts_decorate25([
|
|
5388
5477
|
Post7(":proposalId/reject"),
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5478
|
+
_ts_param24(0, Param6("threadId")),
|
|
5479
|
+
_ts_param24(1, Param6("proposalId")),
|
|
5480
|
+
_ts_param24(2, Req13()),
|
|
5481
|
+
_ts_param24(3, Body6()),
|
|
5482
|
+
_ts_metadata24("design:type", Function),
|
|
5483
|
+
_ts_metadata24("design:paramtypes", [
|
|
5395
5484
|
String,
|
|
5396
5485
|
String,
|
|
5397
5486
|
typeof Request === "undefined" ? Object : Request,
|
|
5398
5487
|
Object
|
|
5399
5488
|
]),
|
|
5400
|
-
|
|
5489
|
+
_ts_metadata24("design:returntype", Promise)
|
|
5401
5490
|
], ActionProposalController.prototype, "reject", null);
|
|
5402
|
-
ActionProposalController =
|
|
5491
|
+
ActionProposalController = _ts_decorate25([
|
|
5403
5492
|
Controller14("threads/:threadId/action-proposals"),
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5493
|
+
_ts_param24(1, Inject24(AGENT_ACTOR_RESOLVER13)),
|
|
5494
|
+
_ts_metadata24("design:type", Function),
|
|
5495
|
+
_ts_metadata24("design:paramtypes", [
|
|
5407
5496
|
typeof ActionProposalService === "undefined" ? Object : ActionProposalService,
|
|
5408
5497
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
5409
5498
|
])
|
|
@@ -5414,8 +5503,8 @@ var AGENT_CHAT_QUEUE = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:chat-q
|
|
|
5414
5503
|
|
|
5415
5504
|
// src/runner/inline-agent-runner.ts
|
|
5416
5505
|
import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY6, AGENT_STORE as AGENT_STORE6, RUN_ENDED_BEFORE_TOOL_CALL, RunCancelledError, agentFailureCode, encodeStreamEvent as encodeStreamEvent2, publishAgentRunFailed, releaseThreadRun, runAgentLoop, settleAll, settleUnsettledDelegation, streamFailure as streamFailure2 } from "@dudousxd/nestjs-agent-core";
|
|
5417
|
-
import { Inject as
|
|
5418
|
-
function
|
|
5506
|
+
import { Inject as Inject25, Injectable as Injectable11, Logger as Logger7, Optional as Optional10 } from "@nestjs/common";
|
|
5507
|
+
function _ts_decorate26(decorators, target, key, desc) {
|
|
5419
5508
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5420
5509
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
5421
5510
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -5428,19 +5517,19 @@ function _ts_decorate25(decorators, target, key, desc) {
|
|
|
5428
5517
|
}
|
|
5429
5518
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5430
5519
|
}
|
|
5431
|
-
__name(
|
|
5432
|
-
function
|
|
5520
|
+
__name(_ts_decorate26, "_ts_decorate");
|
|
5521
|
+
function _ts_metadata25(metadataKey, metadataValue) {
|
|
5433
5522
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
5434
5523
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
5435
5524
|
}
|
|
5436
5525
|
}
|
|
5437
|
-
__name(
|
|
5438
|
-
function
|
|
5526
|
+
__name(_ts_metadata25, "_ts_metadata");
|
|
5527
|
+
function _ts_param25(paramIndex, decorator) {
|
|
5439
5528
|
return function(target, key) {
|
|
5440
5529
|
decorator(target, key, paramIndex);
|
|
5441
5530
|
};
|
|
5442
5531
|
}
|
|
5443
|
-
__name(
|
|
5532
|
+
__name(_ts_param25, "_ts_param");
|
|
5444
5533
|
var InlineAgentRunner = class _InlineAgentRunner {
|
|
5445
5534
|
static {
|
|
5446
5535
|
__name(this, "InlineAgentRunner");
|
|
@@ -5448,7 +5537,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
5448
5537
|
factory;
|
|
5449
5538
|
store;
|
|
5450
5539
|
queue;
|
|
5451
|
-
logger = new
|
|
5540
|
+
logger = new Logger7(_InlineAgentRunner.name);
|
|
5452
5541
|
pending = /* @__PURE__ */ new Map();
|
|
5453
5542
|
/**
|
|
5454
5543
|
* Runs someone has asked to stop. In-process, like `pending`, and for the same reason: this runner
|
|
@@ -5917,13 +6006,13 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
5917
6006
|
}
|
|
5918
6007
|
}
|
|
5919
6008
|
};
|
|
5920
|
-
InlineAgentRunner =
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
6009
|
+
InlineAgentRunner = _ts_decorate26([
|
|
6010
|
+
Injectable11(),
|
|
6011
|
+
_ts_param25(0, Inject25(AGENT_DEPS_FACTORY6)),
|
|
6012
|
+
_ts_param25(1, Inject25(AGENT_STORE6)),
|
|
6013
|
+
_ts_param25(2, Optional10()),
|
|
6014
|
+
_ts_metadata25("design:type", Function),
|
|
6015
|
+
_ts_metadata25("design:paramtypes", [
|
|
5927
6016
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
5928
6017
|
typeof AgentStore === "undefined" ? Object : AgentStore,
|
|
5929
6018
|
typeof ChatQueueService === "undefined" ? Object : ChatQueueService
|
|
@@ -5973,7 +6062,7 @@ function resolveSkillsConfig(options, declared) {
|
|
|
5973
6062
|
__name(resolveSkillsConfig, "resolveSkillsConfig");
|
|
5974
6063
|
|
|
5975
6064
|
// src/agent.module.ts
|
|
5976
|
-
function
|
|
6065
|
+
function _ts_decorate27(decorators, target, key, desc) {
|
|
5977
6066
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5978
6067
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
5979
6068
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -5986,9 +6075,9 @@ function _ts_decorate26(decorators, target, key, desc) {
|
|
|
5986
6075
|
}
|
|
5987
6076
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5988
6077
|
}
|
|
5989
|
-
__name(
|
|
6078
|
+
__name(_ts_decorate27, "_ts_decorate");
|
|
5990
6079
|
var DEFAULT_PATH = "agent";
|
|
5991
|
-
var
|
|
6080
|
+
var logger2 = new Logger8("AgentModule");
|
|
5992
6081
|
function externalWrapper(modules, token) {
|
|
5993
6082
|
for (const module of modules.values()) {
|
|
5994
6083
|
if (module.metatype === AgentModule) continue;
|
|
@@ -6022,7 +6111,7 @@ function resolveStore(options, modules) {
|
|
|
6022
6111
|
if (options.store !== void 0) return options.store;
|
|
6023
6112
|
const external = externalWrapper(modules, AGENT_STORE7);
|
|
6024
6113
|
if (external !== void 0) return forwardingStore(external);
|
|
6025
|
-
|
|
6114
|
+
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()).");
|
|
6026
6115
|
return new InMemoryAgentStore();
|
|
6027
6116
|
}
|
|
6028
6117
|
__name(resolveStore, "resolveStore");
|
|
@@ -6030,7 +6119,7 @@ function resolveRolesPolicy(options, modules) {
|
|
|
6030
6119
|
const external = externalWrapper(modules, AGENT_ROLES_POLICY2);
|
|
6031
6120
|
if (options.rolesPolicy !== void 0) {
|
|
6032
6121
|
if (external !== void 0) {
|
|
6033
|
-
|
|
6122
|
+
logger2.warn("Both a `rolesPolicy` option and a module binding AGENT_ROLES_POLICY (e.g. AgentAuthzModule) are configured \u2014 the `rolesPolicy` option wins.");
|
|
6034
6123
|
}
|
|
6035
6124
|
return options.rolesPolicy;
|
|
6036
6125
|
}
|
|
@@ -6089,7 +6178,7 @@ function sharedProviders(durable, engine) {
|
|
|
6089
6178
|
provide: AGENT_SKILLS3,
|
|
6090
6179
|
useFactory: /* @__PURE__ */ __name((options, declared) => resolveSkillsConfig(options.skills, declared), "useFactory"),
|
|
6091
6180
|
inject: [
|
|
6092
|
-
|
|
6181
|
+
AGENT_OPTIONS10,
|
|
6093
6182
|
AGENT_SKILL_SOURCES2
|
|
6094
6183
|
]
|
|
6095
6184
|
},
|
|
@@ -6099,21 +6188,21 @@ function sharedProviders(durable, engine) {
|
|
|
6099
6188
|
provide: AGENT_MEMORY3,
|
|
6100
6189
|
useFactory: /* @__PURE__ */ __name((options) => options.memory, "useFactory"),
|
|
6101
6190
|
inject: [
|
|
6102
|
-
|
|
6191
|
+
AGENT_OPTIONS10
|
|
6103
6192
|
]
|
|
6104
6193
|
},
|
|
6105
6194
|
{
|
|
6106
6195
|
provide: AGENT_SINK3,
|
|
6107
6196
|
useFactory: /* @__PURE__ */ __name((options) => options.sink ?? new InProcessTokenStreamSink(), "useFactory"),
|
|
6108
6197
|
inject: [
|
|
6109
|
-
|
|
6198
|
+
AGENT_OPTIONS10
|
|
6110
6199
|
]
|
|
6111
6200
|
},
|
|
6112
6201
|
{
|
|
6113
6202
|
provide: AGENT_ROLES_POLICY2,
|
|
6114
6203
|
useFactory: /* @__PURE__ */ __name((options, modules) => resolveRolesPolicy(options, modules), "useFactory"),
|
|
6115
6204
|
inject: [
|
|
6116
|
-
|
|
6205
|
+
AGENT_OPTIONS10,
|
|
6117
6206
|
ModulesContainer
|
|
6118
6207
|
]
|
|
6119
6208
|
},
|
|
@@ -6121,18 +6210,18 @@ function sharedProviders(durable, engine) {
|
|
|
6121
6210
|
provide: AGENT_ACTOR_RESOLVER14,
|
|
6122
6211
|
useFactory: /* @__PURE__ */ __name((options) => {
|
|
6123
6212
|
if (options.actorResolver !== void 0) return options.actorResolver;
|
|
6124
|
-
|
|
6213
|
+
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.");
|
|
6125
6214
|
return new AnonymousActorResolver();
|
|
6126
6215
|
}, "useFactory"),
|
|
6127
6216
|
inject: [
|
|
6128
|
-
|
|
6217
|
+
AGENT_OPTIONS10
|
|
6129
6218
|
]
|
|
6130
6219
|
},
|
|
6131
6220
|
{
|
|
6132
|
-
provide:
|
|
6221
|
+
provide: AGENT_MODEL3,
|
|
6133
6222
|
useFactory: /* @__PURE__ */ __name((o) => o.model, "useFactory"),
|
|
6134
6223
|
inject: [
|
|
6135
|
-
|
|
6224
|
+
AGENT_OPTIONS10
|
|
6136
6225
|
]
|
|
6137
6226
|
},
|
|
6138
6227
|
{
|
|
@@ -6143,7 +6232,7 @@ function sharedProviders(durable, engine) {
|
|
|
6143
6232
|
warnAt: o.quota.warnAt
|
|
6144
6233
|
} : {}), "useFactory"),
|
|
6145
6234
|
inject: [
|
|
6146
|
-
|
|
6235
|
+
AGENT_OPTIONS10,
|
|
6147
6236
|
AGENT_STORE7
|
|
6148
6237
|
]
|
|
6149
6238
|
},
|
|
@@ -6151,7 +6240,7 @@ function sharedProviders(durable, engine) {
|
|
|
6151
6240
|
provide: AGENT_MODEL_CATALOG3,
|
|
6152
6241
|
useFactory: /* @__PURE__ */ __name((o) => resolveCatalog(o), "useFactory"),
|
|
6153
6242
|
inject: [
|
|
6154
|
-
|
|
6243
|
+
AGENT_OPTIONS10
|
|
6155
6244
|
]
|
|
6156
6245
|
},
|
|
6157
6246
|
AgentDepsFactory2,
|
|
@@ -6159,6 +6248,9 @@ function sharedProviders(durable, engine) {
|
|
|
6159
6248
|
provide: AGENT_DEPS_FACTORY7,
|
|
6160
6249
|
useExisting: AgentDepsFactory2
|
|
6161
6250
|
},
|
|
6251
|
+
// Seeds a configured model's missing price row from models.dev and warns about one that would
|
|
6252
|
+
// record no cost (`priceCatalog`), once the app has bootstrapped.
|
|
6253
|
+
PricingBootService,
|
|
6162
6254
|
// Populates the registry + contributors (onModuleInit) BEFORE AiToolDiscoveryService synthesizes
|
|
6163
6255
|
// handoff tools (onApplicationBootstrap) reads the registry.
|
|
6164
6256
|
AgentDiscoveryService,
|
|
@@ -6187,7 +6279,7 @@ function sharedProviders(durable, engine) {
|
|
|
6187
6279
|
provide: AGENT_STORE7,
|
|
6188
6280
|
useFactory: /* @__PURE__ */ __name((o, modules) => resolveStore(o, modules), "useFactory"),
|
|
6189
6281
|
inject: [
|
|
6190
|
-
|
|
6282
|
+
AGENT_OPTIONS10,
|
|
6191
6283
|
ModulesContainer
|
|
6192
6284
|
]
|
|
6193
6285
|
});
|
|
@@ -6224,13 +6316,13 @@ __name(sharedProviders, "sharedProviders");
|
|
|
6224
6316
|
function exportsFor(engine) {
|
|
6225
6317
|
return [
|
|
6226
6318
|
...engine?.exports ?? [],
|
|
6227
|
-
|
|
6319
|
+
AGENT_OPTIONS10,
|
|
6228
6320
|
AGENT_TOOL_REGISTRY3,
|
|
6229
6321
|
AGENT_REGISTRY6,
|
|
6230
6322
|
AGENT_SINK3,
|
|
6231
6323
|
AGENT_ROLES_POLICY2,
|
|
6232
6324
|
AGENT_ACTOR_RESOLVER14,
|
|
6233
|
-
|
|
6325
|
+
AGENT_MODEL3,
|
|
6234
6326
|
AGENT_STORE7,
|
|
6235
6327
|
AGENT_MODEL_CATALOG3,
|
|
6236
6328
|
AGENT_QUOTA_PROVIDER3,
|
|
@@ -6334,7 +6426,7 @@ var AgentModule = class _AgentModule {
|
|
|
6334
6426
|
controllers: controllersForSurface(options.surface, options.adapters, options.engine),
|
|
6335
6427
|
providers: [
|
|
6336
6428
|
{
|
|
6337
|
-
provide:
|
|
6429
|
+
provide: AGENT_OPTIONS10,
|
|
6338
6430
|
useValue: options
|
|
6339
6431
|
},
|
|
6340
6432
|
...sharedProviders(options.durable ?? false, options.engine),
|
|
@@ -6364,7 +6456,7 @@ var AgentModule = class _AgentModule {
|
|
|
6364
6456
|
controllers: controllersForSurface(options.surface, options.adapters, options.engine),
|
|
6365
6457
|
providers: [
|
|
6366
6458
|
{
|
|
6367
|
-
provide:
|
|
6459
|
+
provide: AGENT_OPTIONS10,
|
|
6368
6460
|
// Stamp the STATIC wiring flags onto the factory result: `durable`/`surface` are
|
|
6369
6461
|
// authoritative on the async config object (they decided the actual wiring above), and
|
|
6370
6462
|
// the durable module reads `durable` back off AGENT_OPTIONS. `surface` isn't read back by
|
|
@@ -6393,16 +6485,16 @@ var AgentModule = class _AgentModule {
|
|
|
6393
6485
|
};
|
|
6394
6486
|
}
|
|
6395
6487
|
};
|
|
6396
|
-
AgentModule =
|
|
6488
|
+
AgentModule = _ts_decorate27([
|
|
6397
6489
|
Global(),
|
|
6398
6490
|
Module2({})
|
|
6399
6491
|
], AgentModule);
|
|
6400
6492
|
|
|
6401
6493
|
// src/ag-ui/ag-ui.adapter.ts
|
|
6402
|
-
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER15, AGENT_ATTACHMENT_STAGING as AGENT_ATTACHMENT_STAGING5, AGENT_OPTIONS as
|
|
6494
|
+
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER15, AGENT_ATTACHMENT_STAGING as AGENT_ATTACHMENT_STAGING5, AGENT_OPTIONS as AGENT_OPTIONS11 } from "@dudousxd/nestjs-agent-core";
|
|
6403
6495
|
import { AG_UI_CUSTOM, actionProposalDecisionEvents, agUiEvents, agUiFramesFromNdjson, agUiSse, parseRunInput, planResume, readAnswersPayload, readApprovalPayload, readContext, readForwardedProps, readUserTurn } from "@dudousxd/nestjs-agent-core/ag-ui";
|
|
6404
|
-
import { BadRequestException as BadRequestException8, Body as Body7, Controller as Controller15, ForbiddenException as ForbiddenException4, HttpCode as HttpCode2, Inject as
|
|
6405
|
-
function
|
|
6496
|
+
import { BadRequestException as BadRequestException8, Body as Body7, Controller as Controller15, ForbiddenException as ForbiddenException4, HttpCode as HttpCode2, Inject as Inject26, Optional as Optional11, Post as Post8, Req as Req14, Res as Res3 } from "@nestjs/common";
|
|
6497
|
+
function _ts_decorate28(decorators, target, key, desc) {
|
|
6406
6498
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6407
6499
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
6408
6500
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -6415,19 +6507,19 @@ function _ts_decorate27(decorators, target, key, desc) {
|
|
|
6415
6507
|
}
|
|
6416
6508
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6417
6509
|
}
|
|
6418
|
-
__name(
|
|
6419
|
-
function
|
|
6510
|
+
__name(_ts_decorate28, "_ts_decorate");
|
|
6511
|
+
function _ts_metadata26(metadataKey, metadataValue) {
|
|
6420
6512
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
6421
6513
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
6422
6514
|
}
|
|
6423
6515
|
}
|
|
6424
|
-
__name(
|
|
6425
|
-
function
|
|
6516
|
+
__name(_ts_metadata26, "_ts_metadata");
|
|
6517
|
+
function _ts_param26(paramIndex, decorator) {
|
|
6426
6518
|
return function(target, key) {
|
|
6427
6519
|
decorator(target, key, paramIndex);
|
|
6428
6520
|
};
|
|
6429
6521
|
}
|
|
6430
|
-
__name(
|
|
6522
|
+
__name(_ts_param26, "_ts_param");
|
|
6431
6523
|
var AG_UI_VIA = "ag-ui";
|
|
6432
6524
|
function invalid(code, message) {
|
|
6433
6525
|
return new BadRequestException8({
|
|
@@ -6787,29 +6879,29 @@ function agUiAdapter(options = {}) {
|
|
|
6787
6879
|
return this.handle(req, res, body);
|
|
6788
6880
|
}
|
|
6789
6881
|
};
|
|
6790
|
-
|
|
6882
|
+
_ts_decorate28([
|
|
6791
6883
|
Post8(path),
|
|
6792
6884
|
HttpCode2(200),
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6885
|
+
_ts_param26(0, Req14()),
|
|
6886
|
+
_ts_param26(1, Res3()),
|
|
6887
|
+
_ts_param26(2, Body7()),
|
|
6888
|
+
_ts_metadata26("design:type", Function),
|
|
6889
|
+
_ts_metadata26("design:paramtypes", [
|
|
6798
6890
|
typeof Request === "undefined" ? Object : Request,
|
|
6799
6891
|
typeof Response === "undefined" ? Object : Response,
|
|
6800
6892
|
Object
|
|
6801
6893
|
]),
|
|
6802
|
-
|
|
6894
|
+
_ts_metadata26("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
6803
6895
|
], AgUiController.prototype, "run", null);
|
|
6804
|
-
AgUiController =
|
|
6896
|
+
AgUiController = _ts_decorate28([
|
|
6805
6897
|
Controller15(),
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6898
|
+
_ts_param26(0, Inject26(AgentService)),
|
|
6899
|
+
_ts_param26(1, Inject26(AGENT_ACTOR_RESOLVER15)),
|
|
6900
|
+
_ts_param26(2, Inject26(AGENT_OPTIONS11)),
|
|
6901
|
+
_ts_param26(3, Optional11()),
|
|
6902
|
+
_ts_param26(3, Inject26(AGENT_ATTACHMENT_STAGING5)),
|
|
6903
|
+
_ts_metadata26("design:type", Function),
|
|
6904
|
+
_ts_metadata26("design:paramtypes", [
|
|
6813
6905
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
6814
6906
|
typeof ActorResolver === "undefined" ? Object : ActorResolver,
|
|
6815
6907
|
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|