@dudousxd/nestjs-agent 1.20.0 → 1.22.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 +58 -0
- package/dist/{chat-queue.service-C0hr7dqx.d.cts → chat-queue.service-CTyX_yNr.d.ts} +48 -3
- package/dist/{chat-queue.service-C0hr7dqx.d.ts → chat-queue.service-Dx9OsjcF.d.cts} +48 -3
- package/dist/durable/index.cjs +1662 -839
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.d.cts +3 -1
- package/dist/durable/index.d.ts +3 -1
- package/dist/durable/index.js +1395 -572
- package/dist/durable/index.js.map +1 -1
- package/dist/genui/index.cjs +1 -0
- package/dist/genui/index.cjs.map +1 -1
- package/dist/genui/index.d.cts +1 -1
- package/dist/genui/index.d.ts +1 -1
- package/dist/genui/index.js +1 -0
- package/dist/genui/index.js.map +1 -1
- package/dist/index.cjs +1647 -831
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +140 -9
- package/dist/index.d.ts +140 -9
- package/dist/index.js +1417 -605
- package/dist/index.js.map +1 -1
- package/dist/sink-redis/index.cjs +7 -2
- package/dist/sink-redis/index.cjs.map +1 -1
- package/dist/sink-redis/index.d.cts +6 -3
- package/dist/sink-redis/index.d.ts +6 -3
- package/dist/sink-redis/index.js +7 -2
- package/dist/sink-redis/index.js.map +1 -1
- package/package.json +6 -6
package/dist/durable/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
4
|
// src/durable/agent-run.workflow.ts
|
|
5
|
-
import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY2, AGENT_STORE, RUN_ENDED_BEFORE_TOOL_CALL, RunCancelledError, agentFailureCode, encodeStreamEvent as encodeStreamEvent2, isReplayIntegrityError, publishAgentRunFailed, releaseThreadRun, runAgentLoop, settleAll, settleDeadRun, settleUnsettledDelegation, streamFailure } from "@dudousxd/nestjs-agent-core";
|
|
5
|
+
import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY2, AGENT_STORE, RUN_ENDED_BEFORE_TOOL_CALL, RunCancelledError, agentFailureCode, encodeStreamEvent as encodeStreamEvent2, isReplayIntegrityError as isReplayIntegrityError2, publishAgentRunFailed, releaseThreadRun, runAgentLoop, settleAll, settleDeadRun, settleUnsettledDelegation, streamFailure } from "@dudousxd/nestjs-agent-core";
|
|
6
6
|
import { RUN_GATEWAY, Workflow, WorkflowService } from "@dudousxd/nestjs-durable";
|
|
7
7
|
import { isWorkflowControlFlowSignal } from "@dudousxd/nestjs-durable-core";
|
|
8
8
|
import { Inject as Inject2, Injectable as Injectable2, Logger, Optional } from "@nestjs/common";
|
|
@@ -33,7 +33,9 @@ __name(childSinkWriter, "childSinkWriter");
|
|
|
33
33
|
var AGENT_CHAT_QUEUE = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:chat-queue");
|
|
34
34
|
|
|
35
35
|
// src/durable/agent-run.steps.ts
|
|
36
|
-
import {
|
|
36
|
+
import { createNegotiatedUiCollector } from "@dudousxd/nestjs-agent-core";
|
|
37
|
+
import { prepareActionProposal, resolveActionProposalApproval } from "@dudousxd/nestjs-agent-core";
|
|
38
|
+
import { AGENT_DEPS_FACTORY, createFrameBuffer, createNoopEmitUi, encodeStreamEvent, intersectAllowLists, invokeWithTransientRetry, isControlFlowSignal, isReplayIntegrityError, observeTurnFrames, publishAgentToolRetry, stampToolKinds, toolCallContext, traceLlmTurn, traceToolExecution, withAskTool, withMemoryTool, withSkillTool, withToolTimeout, withTurnFrames, wrapToolPreflightDenied, wrapToolStepOutput } from "@dudousxd/nestjs-agent-core";
|
|
37
39
|
import { Step } from "@dudousxd/nestjs-durable";
|
|
38
40
|
import { Inject, Injectable } from "@nestjs/common";
|
|
39
41
|
|
|
@@ -107,6 +109,9 @@ var AgentRunSteps = class {
|
|
|
107
109
|
...input.threadId !== void 0 ? {
|
|
108
110
|
threadId: input.threadId
|
|
109
111
|
} : {},
|
|
112
|
+
...input.preflightContext?.uiCapabilities !== void 0 ? {
|
|
113
|
+
uiCapabilities: input.preflightContext.uiCapabilities
|
|
114
|
+
} : {},
|
|
110
115
|
...input.agentName !== void 0 ? {
|
|
111
116
|
agentName: input.agentName
|
|
112
117
|
} : {}
|
|
@@ -137,6 +142,67 @@ var AgentRunSteps = class {
|
|
|
137
142
|
} : {}
|
|
138
143
|
})), frames.summary());
|
|
139
144
|
const stamped = stampToolKinds(turn, deps);
|
|
145
|
+
const allowedTools = intersectAllowLists(deps.toolAllowList, input.personaAllowedTools);
|
|
146
|
+
for (const call of stamped.toolCalls) {
|
|
147
|
+
if (call.kind !== "action") continue;
|
|
148
|
+
try {
|
|
149
|
+
const context = input.preflightContext ?? {
|
|
150
|
+
actor: input.actor,
|
|
151
|
+
threadId: input.threadId ?? "",
|
|
152
|
+
runId: input.runId,
|
|
153
|
+
requestId: input.runId,
|
|
154
|
+
...input.agentName !== void 0 ? {
|
|
155
|
+
agentName: input.agentName
|
|
156
|
+
} : {}
|
|
157
|
+
};
|
|
158
|
+
if (input.actionApprovalMode === "independent") {
|
|
159
|
+
const spec = deps.registry.spec(call.name);
|
|
160
|
+
call.actionApproval = await resolveActionProposalApproval({
|
|
161
|
+
actor: input.actor,
|
|
162
|
+
store: deps.store,
|
|
163
|
+
tool: {
|
|
164
|
+
name: call.name,
|
|
165
|
+
kind: "action",
|
|
166
|
+
...spec !== void 0 ? {
|
|
167
|
+
spec
|
|
168
|
+
} : {}
|
|
169
|
+
},
|
|
170
|
+
thread: {
|
|
171
|
+
threadId: context.threadId,
|
|
172
|
+
runId: input.runId,
|
|
173
|
+
...input.agentName !== void 0 ? {
|
|
174
|
+
agentName: input.agentName
|
|
175
|
+
} : {}
|
|
176
|
+
},
|
|
177
|
+
...deps.approvalPolicy !== void 0 ? {
|
|
178
|
+
policy: deps.approvalPolicy
|
|
179
|
+
} : {}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
if (call.actionApproval?.mode === "ask") {
|
|
183
|
+
call.prepared = await prepareActionProposal(deps.registry, call.name, call.input, {
|
|
184
|
+
...toolCallContext(context, call.id),
|
|
185
|
+
emitUi: createNoopEmitUi(call.id)
|
|
186
|
+
}, deps.rolesPolicy, allowedTools === void 0 ? {} : {
|
|
187
|
+
allowedTools
|
|
188
|
+
});
|
|
189
|
+
call.preflight = call.prepared.preflight;
|
|
190
|
+
} else {
|
|
191
|
+
call.preflight = await deps.registry.prepare(call.name, call.input, {
|
|
192
|
+
...toolCallContext(context, call.id),
|
|
193
|
+
emitUi: createNoopEmitUi(call.id)
|
|
194
|
+
}, deps.rolesPolicy, allowedTools === void 0 ? {} : {
|
|
195
|
+
allowedTools
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
} catch (error) {
|
|
199
|
+
if (isControlFlowSignal(error) || isReplayIntegrityError(error)) throw error;
|
|
200
|
+
call.preflight = {
|
|
201
|
+
status: "failed",
|
|
202
|
+
error: error instanceof Error ? error.message : String(error)
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
}
|
|
140
206
|
return buffer === void 0 ? stamped : {
|
|
141
207
|
...stamped,
|
|
142
208
|
bufferedFrames: buffer.frames()
|
|
@@ -162,7 +228,7 @@ var AgentRunSteps = class {
|
|
|
162
228
|
}
|
|
163
229
|
const sinkRunId = input.sinkRunId;
|
|
164
230
|
let opened;
|
|
165
|
-
const ui =
|
|
231
|
+
const ui = createNegotiatedUiCollector(input.toolCallId, input.ctx, deps.resolveUiCatalog, sinkRunId === void 0 ? void 0 : async (event) => {
|
|
166
232
|
opened ??= Promise.resolve(deps.sink.open(sinkRunId)).then((writer) => input.childSink === true ? childSinkWriter(writer) : writer);
|
|
167
233
|
await (await opened).write(encodeStreamEvent(event));
|
|
168
234
|
});
|
|
@@ -178,27 +244,38 @@ var AgentRunSteps = class {
|
|
|
178
244
|
classify: localClassify
|
|
179
245
|
} : {}
|
|
180
246
|
};
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
toolName: input.toolName,
|
|
195
|
-
toolCallId: input.toolCallId,
|
|
196
|
-
attempt,
|
|
197
|
-
message: error instanceof Error ? error.message : String(error)
|
|
247
|
+
const allowedTools = intersectAllowLists(deps.toolAllowList, input.allowedTools === void 0 ? void 0 : [
|
|
248
|
+
...input.allowedTools
|
|
249
|
+
]);
|
|
250
|
+
let output;
|
|
251
|
+
try {
|
|
252
|
+
output = await traceToolExecution(input.ctx.runId, {
|
|
253
|
+
toolCallId: input.toolCallId,
|
|
254
|
+
toolName: input.toolName,
|
|
255
|
+
toolType: input.toolType
|
|
256
|
+
}, () => invokeWithTransientRetry(() => {
|
|
257
|
+
ui.restart();
|
|
258
|
+
const invocation = deps.registry.invoke(input.toolName, input.input, ctx, deps.rolesPolicy, allowedTools === void 0 ? {} : {
|
|
259
|
+
allowedTools
|
|
198
260
|
});
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
261
|
+
return input.timeoutMs !== void 0 ? withToolTimeout(invocation, input.timeoutMs, input.toolName) : invocation;
|
|
262
|
+
}, transientRetry, {
|
|
263
|
+
onRetry: /* @__PURE__ */ __name((attempt, error) => {
|
|
264
|
+
publishAgentToolRetry({
|
|
265
|
+
toolName: input.toolName,
|
|
266
|
+
toolCallId: input.toolCallId,
|
|
267
|
+
attempt,
|
|
268
|
+
message: error instanceof Error ? error.message : String(error)
|
|
269
|
+
});
|
|
270
|
+
}, "onRetry")
|
|
271
|
+
}));
|
|
272
|
+
} catch (error) {
|
|
273
|
+
if (error instanceof Error && error.name === "ToolPreflightDeniedError") {
|
|
274
|
+
return wrapToolPreflightDenied(error.message);
|
|
275
|
+
}
|
|
276
|
+
throw error;
|
|
277
|
+
}
|
|
278
|
+
return input.collectUi === true ? wrapToolStepOutput(output, ui.components(), ui.text()) : output;
|
|
202
279
|
}
|
|
203
280
|
};
|
|
204
281
|
_ts_decorate([
|
|
@@ -598,7 +675,7 @@ var AgentRunWorkflow = class _AgentRunWorkflow {
|
|
|
598
675
|
});
|
|
599
676
|
throw error;
|
|
600
677
|
}
|
|
601
|
-
if (
|
|
678
|
+
if (isReplayIntegrityError2(error)) {
|
|
602
679
|
const detail = error.message;
|
|
603
680
|
const code2 = agentFailureCode(error);
|
|
604
681
|
this.logger.error(`agent run ${ctx.runId} failed (${code2}): ${detail}`);
|
|
@@ -1094,14 +1171,45 @@ AgentDurableModule = _ts_decorate4([
|
|
|
1094
1171
|
], AgentDurableModule);
|
|
1095
1172
|
|
|
1096
1173
|
// src/agent.module.ts
|
|
1097
|
-
import { AGENT_ACTOR_RESOLVER as
|
|
1098
|
-
import { Global as Global2, Logger as
|
|
1174
|
+
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER14, AGENT_APPROVAL_PORT, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY9, AGENT_DURABLE_RUNNER as AGENT_DURABLE_RUNNER2, AGENT_MEMORY as AGENT_MEMORY3, AGENT_MODEL as AGENT_MODEL2, AGENT_MODEL_CATALOG as AGENT_MODEL_CATALOG3, AGENT_OPTIONS as AGENT_OPTIONS9, 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_SINK4, AGENT_SKILLS as AGENT_SKILLS3, AGENT_SKILL_SOURCES as AGENT_SKILL_SOURCES2, AGENT_STORE as AGENT_STORE9, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY3, AgentRegistry as AgentRegistry6, ClosedRolesPolicy, DefaultRolesPolicy, InMemoryAgentStore, ToolRegistry as ToolRegistry3 } from "@dudousxd/nestjs-agent-core";
|
|
1175
|
+
import { Global as Global2, Logger as Logger9, Module as Module3 } from "@nestjs/common";
|
|
1099
1176
|
import { DiscoveryModule, ModulesContainer, RouterModule } from "@nestjs/core";
|
|
1100
1177
|
|
|
1101
1178
|
// src/agent-deps.factory.ts
|
|
1179
|
+
import { assertIndependentActionCapabilities } from "@dudousxd/nestjs-agent-core";
|
|
1102
1180
|
import { AGENT_MEMORY, AGENT_MODEL, AGENT_PRICING_STORE, AGENT_PROMPT_CONTRIBUTORS, AGENT_REGISTRY, AGENT_ROLES_POLICY, AGENT_SINK as AGENT_SINK2, AGENT_SKILLS, AGENT_STORE as AGENT_STORE3, AGENT_TOOL_REGISTRY, AgentRegistry as AgentRegistry2, ToolRegistry as ToolRegistry2, findPersona, intersectAllowLists as intersectAllowLists2, normalizeDelegation, personaCatalogEntry, resolvePersonaAlias, summarizeWithModel, windowHistory } from "@dudousxd/nestjs-agent-core";
|
|
1103
1181
|
import { AGENT_OPTIONS } from "@dudousxd/nestjs-agent-core";
|
|
1104
|
-
import { BadRequestException, Inject as
|
|
1182
|
+
import { BadRequestException, Inject as Inject5, Injectable as Injectable4, Optional as Optional3 } from "@nestjs/common";
|
|
1183
|
+
|
|
1184
|
+
// src/genui/agent-genui.module.ts
|
|
1185
|
+
import { defineCatalog, genuiTools } from "@dudousxd/nestjs-agent-core/genui";
|
|
1186
|
+
import { Inject as Inject4, Module as Module2 } from "@nestjs/common";
|
|
1187
|
+
|
|
1188
|
+
// src/functional-tool.ts
|
|
1189
|
+
import { createFunctionalTool } from "@dudousxd/nestjs-agent-core";
|
|
1190
|
+
var AGENT_TOOL_BRAND = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:functional-tool");
|
|
1191
|
+
function brand(tool) {
|
|
1192
|
+
return {
|
|
1193
|
+
[AGENT_TOOL_BRAND]: true,
|
|
1194
|
+
spec: tool.spec,
|
|
1195
|
+
handler: tool.handler
|
|
1196
|
+
};
|
|
1197
|
+
}
|
|
1198
|
+
__name(brand, "brand");
|
|
1199
|
+
function isBrandedFunctionalTool(value) {
|
|
1200
|
+
return AGENT_TOOL_BRAND in value && "spec" in value && "handler" in value;
|
|
1201
|
+
}
|
|
1202
|
+
__name(isBrandedFunctionalTool, "isBrandedFunctionalTool");
|
|
1203
|
+
function provideAgentTools(factory, inject) {
|
|
1204
|
+
return {
|
|
1205
|
+
provide: /* @__PURE__ */ Symbol("nestjs-agent:functional-tool-list"),
|
|
1206
|
+
useFactory: /* @__PURE__ */ __name(async (...deps) => (await factory(...deps)).map(brand), "useFactory"),
|
|
1207
|
+
inject: inject ?? []
|
|
1208
|
+
};
|
|
1209
|
+
}
|
|
1210
|
+
__name(provideAgentTools, "provideAgentTools");
|
|
1211
|
+
|
|
1212
|
+
// src/genui/agent-genui.module.ts
|
|
1105
1213
|
function _ts_decorate5(decorators, target, key, desc) {
|
|
1106
1214
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1107
1215
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
@@ -1116,6 +1224,124 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
1116
1224
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1117
1225
|
}
|
|
1118
1226
|
__name(_ts_decorate5, "_ts_decorate");
|
|
1227
|
+
var GENUI_CATALOG = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:genui-catalog");
|
|
1228
|
+
var GENUI_OPTIONS = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:genui-options");
|
|
1229
|
+
var GenuiCatalogResolver = class {
|
|
1230
|
+
static {
|
|
1231
|
+
__name(this, "GenuiCatalogResolver");
|
|
1232
|
+
}
|
|
1233
|
+
};
|
|
1234
|
+
function resolverProviders(resolver) {
|
|
1235
|
+
if (resolver === void 0) return [];
|
|
1236
|
+
return [
|
|
1237
|
+
typeof resolver === "function" ? {
|
|
1238
|
+
provide: GenuiCatalogResolver,
|
|
1239
|
+
useClass: resolver
|
|
1240
|
+
} : {
|
|
1241
|
+
provide: GenuiCatalogResolver,
|
|
1242
|
+
useValue: resolver
|
|
1243
|
+
}
|
|
1244
|
+
];
|
|
1245
|
+
}
|
|
1246
|
+
__name(resolverProviders, "resolverProviders");
|
|
1247
|
+
function toolOptions(options, resolver) {
|
|
1248
|
+
const { catalog: _catalog, ...rest } = options;
|
|
1249
|
+
return {
|
|
1250
|
+
...rest,
|
|
1251
|
+
...resolver !== void 0 ? {
|
|
1252
|
+
resolveCatalog: /* @__PURE__ */ __name((scope) => resolver.resolve(scope), "resolveCatalog")
|
|
1253
|
+
} : {}
|
|
1254
|
+
};
|
|
1255
|
+
}
|
|
1256
|
+
__name(toolOptions, "toolOptions");
|
|
1257
|
+
function coreProviders(resolver) {
|
|
1258
|
+
return [
|
|
1259
|
+
{
|
|
1260
|
+
provide: GENUI_CATALOG,
|
|
1261
|
+
useFactory: /* @__PURE__ */ __name((options) => options.catalog ?? defineCatalog([]), "useFactory"),
|
|
1262
|
+
inject: [
|
|
1263
|
+
GENUI_OPTIONS
|
|
1264
|
+
]
|
|
1265
|
+
},
|
|
1266
|
+
...resolverProviders(resolver),
|
|
1267
|
+
// The generated tools, registered by the agent module's discovery like any `provideAgentTool`.
|
|
1268
|
+
// Built from the injected catalog, so `overrideProvider(GENUI_CATALOG)` changes them too.
|
|
1269
|
+
provideAgentTools((options, catalog, perRequest) => genuiTools(catalog, toolOptions(options, perRequest)), [
|
|
1270
|
+
GENUI_OPTIONS,
|
|
1271
|
+
GENUI_CATALOG,
|
|
1272
|
+
{
|
|
1273
|
+
token: GenuiCatalogResolver,
|
|
1274
|
+
optional: true
|
|
1275
|
+
}
|
|
1276
|
+
])
|
|
1277
|
+
];
|
|
1278
|
+
}
|
|
1279
|
+
__name(coreProviders, "coreProviders");
|
|
1280
|
+
var EXPORTS = [
|
|
1281
|
+
GENUI_CATALOG,
|
|
1282
|
+
GENUI_OPTIONS
|
|
1283
|
+
];
|
|
1284
|
+
var AgentGenuiModule = class _AgentGenuiModule {
|
|
1285
|
+
static {
|
|
1286
|
+
__name(this, "AgentGenuiModule");
|
|
1287
|
+
}
|
|
1288
|
+
static forRoot(options = {}) {
|
|
1289
|
+
const { resolver, ...rest } = options;
|
|
1290
|
+
return {
|
|
1291
|
+
module: _AgentGenuiModule,
|
|
1292
|
+
global: true,
|
|
1293
|
+
providers: [
|
|
1294
|
+
{
|
|
1295
|
+
provide: GENUI_OPTIONS,
|
|
1296
|
+
useValue: rest
|
|
1297
|
+
},
|
|
1298
|
+
...coreProviders(resolver)
|
|
1299
|
+
],
|
|
1300
|
+
exports: resolver === void 0 ? EXPORTS : [
|
|
1301
|
+
...EXPORTS,
|
|
1302
|
+
GenuiCatalogResolver
|
|
1303
|
+
]
|
|
1304
|
+
};
|
|
1305
|
+
}
|
|
1306
|
+
static forRootAsync(options) {
|
|
1307
|
+
return {
|
|
1308
|
+
module: _AgentGenuiModule,
|
|
1309
|
+
global: true,
|
|
1310
|
+
imports: options.imports ?? [],
|
|
1311
|
+
providers: [
|
|
1312
|
+
{
|
|
1313
|
+
provide: GENUI_OPTIONS,
|
|
1314
|
+
useFactory: options.useFactory,
|
|
1315
|
+
inject: options.inject ?? []
|
|
1316
|
+
},
|
|
1317
|
+
...coreProviders(options.resolver)
|
|
1318
|
+
],
|
|
1319
|
+
exports: options.resolver === void 0 ? EXPORTS : [
|
|
1320
|
+
...EXPORTS,
|
|
1321
|
+
GenuiCatalogResolver
|
|
1322
|
+
]
|
|
1323
|
+
};
|
|
1324
|
+
}
|
|
1325
|
+
};
|
|
1326
|
+
AgentGenuiModule = _ts_decorate5([
|
|
1327
|
+
Module2({})
|
|
1328
|
+
], AgentGenuiModule);
|
|
1329
|
+
|
|
1330
|
+
// src/agent-deps.factory.ts
|
|
1331
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
1332
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1333
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1334
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1335
|
+
} else {
|
|
1336
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1337
|
+
if (d = decorators[i]) {
|
|
1338
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1343
|
+
}
|
|
1344
|
+
__name(_ts_decorate6, "_ts_decorate");
|
|
1119
1345
|
function _ts_metadata4(metadataKey, metadataValue) {
|
|
1120
1346
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1121
1347
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -1148,7 +1374,9 @@ var AgentDepsFactory2 = class {
|
|
|
1148
1374
|
pricingStore;
|
|
1149
1375
|
skills;
|
|
1150
1376
|
memory;
|
|
1151
|
-
|
|
1377
|
+
uiCatalog;
|
|
1378
|
+
uiCatalogResolver;
|
|
1379
|
+
constructor(options, model, store, sink, rolesPolicy, registry, agents, promptContributors, pricingStore, skills, memory, uiCatalog, uiCatalogResolver) {
|
|
1152
1380
|
this.options = options;
|
|
1153
1381
|
this.model = model;
|
|
1154
1382
|
this.store = store;
|
|
@@ -1160,6 +1388,9 @@ var AgentDepsFactory2 = class {
|
|
|
1160
1388
|
this.pricingStore = pricingStore;
|
|
1161
1389
|
this.skills = skills;
|
|
1162
1390
|
this.memory = memory;
|
|
1391
|
+
this.uiCatalog = uiCatalog;
|
|
1392
|
+
this.uiCatalogResolver = uiCatalogResolver;
|
|
1393
|
+
if (options.actionApprovalMode === "independent") assertIndependentActionCapabilities(store, options.backgroundActorResolver);
|
|
1163
1394
|
}
|
|
1164
1395
|
/** The turn's memory seam, shared with the read-back endpoint. Undefined → memory is not configured. */
|
|
1165
1396
|
memoryConfig() {
|
|
@@ -1248,6 +1479,18 @@ var AgentDepsFactory2 = class {
|
|
|
1248
1479
|
}
|
|
1249
1480
|
return definition?.defaultPersona;
|
|
1250
1481
|
}
|
|
1482
|
+
forProposal(proposal, _actor) {
|
|
1483
|
+
const name = proposal.executionContext?.agentName;
|
|
1484
|
+
if (name !== void 0 && !this.agents.has(name) && !(name === "default" && this.defaultAgentName() === "default" && this.agents.list().length === 0)) throw new Error(`Recorded agent ${name} no longer exists`);
|
|
1485
|
+
const deps = this.forAgent(name);
|
|
1486
|
+
const id = proposal.executionContext?.persona;
|
|
1487
|
+
if (id !== void 0) {
|
|
1488
|
+
const persona = deps.personas?.find((persona2) => persona2.id === id);
|
|
1489
|
+
if (!persona) throw new Error(`Recorded persona ${id} no longer exists`);
|
|
1490
|
+
return this.withPersona(deps, persona);
|
|
1491
|
+
}
|
|
1492
|
+
return deps;
|
|
1493
|
+
}
|
|
1251
1494
|
forAgent(agentName) {
|
|
1252
1495
|
const name = agentName ?? this.defaultAgentName();
|
|
1253
1496
|
if (agentName !== void 0 && !this.agents.has(agentName)) {
|
|
@@ -1266,12 +1509,27 @@ var AgentDepsFactory2 = class {
|
|
|
1266
1509
|
return {
|
|
1267
1510
|
model: this.model,
|
|
1268
1511
|
store: this.store,
|
|
1512
|
+
...this.options.actionApprovalMode !== void 0 ? {
|
|
1513
|
+
actionApprovalMode: this.options.actionApprovalMode
|
|
1514
|
+
} : {},
|
|
1269
1515
|
sink: this.sink,
|
|
1270
1516
|
rolesPolicy: this.rolesPolicy,
|
|
1271
1517
|
...this.options.approvalPolicy !== void 0 ? {
|
|
1272
1518
|
approvalPolicy: this.options.approvalPolicy
|
|
1273
1519
|
} : {},
|
|
1274
1520
|
registry: this.registry,
|
|
1521
|
+
...this.uiCatalog !== void 0 || this.uiCatalogResolver !== void 0 ? {
|
|
1522
|
+
resolveUiCatalog: /* @__PURE__ */ __name((scope) => {
|
|
1523
|
+
const catalog = this.uiCatalogResolver?.resolve({
|
|
1524
|
+
...scope,
|
|
1525
|
+
...scope.actor.tenantRef !== void 0 ? {
|
|
1526
|
+
tenant: scope.actor.tenantRef
|
|
1527
|
+
} : {}
|
|
1528
|
+
}) ?? this.uiCatalog;
|
|
1529
|
+
if (!catalog) throw new Error("UI catalog unavailable");
|
|
1530
|
+
return catalog;
|
|
1531
|
+
}, "resolveUiCatalog")
|
|
1532
|
+
} : {},
|
|
1275
1533
|
promptContributors: this.promptContributors,
|
|
1276
1534
|
systemPrompt: definition?.systemPrompt ?? this.options.systemPrompt ?? "You are a helpful assistant.",
|
|
1277
1535
|
maxSteps: definition?.maxSteps ?? 8,
|
|
@@ -1422,22 +1680,25 @@ var AgentDepsFactory2 = class {
|
|
|
1422
1680
|
return void 0;
|
|
1423
1681
|
}
|
|
1424
1682
|
};
|
|
1425
|
-
AgentDepsFactory2 =
|
|
1683
|
+
AgentDepsFactory2 = _ts_decorate6([
|
|
1426
1684
|
Injectable4(),
|
|
1427
|
-
_ts_param4(0,
|
|
1428
|
-
_ts_param4(1,
|
|
1429
|
-
_ts_param4(2,
|
|
1430
|
-
_ts_param4(3,
|
|
1431
|
-
_ts_param4(4,
|
|
1432
|
-
_ts_param4(5,
|
|
1433
|
-
_ts_param4(6,
|
|
1434
|
-
_ts_param4(7,
|
|
1685
|
+
_ts_param4(0, Inject5(AGENT_OPTIONS)),
|
|
1686
|
+
_ts_param4(1, Inject5(AGENT_MODEL)),
|
|
1687
|
+
_ts_param4(2, Inject5(AGENT_STORE3)),
|
|
1688
|
+
_ts_param4(3, Inject5(AGENT_SINK2)),
|
|
1689
|
+
_ts_param4(4, Inject5(AGENT_ROLES_POLICY)),
|
|
1690
|
+
_ts_param4(5, Inject5(AGENT_TOOL_REGISTRY)),
|
|
1691
|
+
_ts_param4(6, Inject5(AGENT_REGISTRY)),
|
|
1692
|
+
_ts_param4(7, Inject5(AGENT_PROMPT_CONTRIBUTORS)),
|
|
1435
1693
|
_ts_param4(8, Optional3()),
|
|
1436
|
-
_ts_param4(8,
|
|
1694
|
+
_ts_param4(8, Inject5(AGENT_PRICING_STORE)),
|
|
1437
1695
|
_ts_param4(9, Optional3()),
|
|
1438
|
-
_ts_param4(9,
|
|
1696
|
+
_ts_param4(9, Inject5(AGENT_SKILLS)),
|
|
1439
1697
|
_ts_param4(10, Optional3()),
|
|
1440
|
-
_ts_param4(10,
|
|
1698
|
+
_ts_param4(10, Inject5(AGENT_MEMORY)),
|
|
1699
|
+
_ts_param4(11, Optional3()),
|
|
1700
|
+
_ts_param4(11, Inject5(GENUI_CATALOG)),
|
|
1701
|
+
_ts_param4(12, Optional3()),
|
|
1441
1702
|
_ts_metadata4("design:type", Function),
|
|
1442
1703
|
_ts_metadata4("design:paramtypes", [
|
|
1443
1704
|
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
@@ -1450,17 +1711,218 @@ AgentDepsFactory2 = _ts_decorate5([
|
|
|
1450
1711
|
Array,
|
|
1451
1712
|
Object,
|
|
1452
1713
|
Object,
|
|
1453
|
-
Object
|
|
1714
|
+
Object,
|
|
1715
|
+
typeof Catalog === "undefined" ? Object : Catalog,
|
|
1716
|
+
typeof GenuiCatalogResolver === "undefined" ? Object : GenuiCatalogResolver
|
|
1454
1717
|
])
|
|
1455
1718
|
], AgentDepsFactory2);
|
|
1456
1719
|
|
|
1457
1720
|
// src/agent.service.ts
|
|
1458
|
-
import { AGENT_ATTACHMENT_STAGING as AGENT_ATTACHMENT_STAGING2, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY4, AGENT_MODEL_CATALOG, AGENT_OPTIONS as
|
|
1459
|
-
import { BadRequestException as BadRequestException2, ConflictException as ConflictException2, ForbiddenException, GoneException, HttpException, HttpStatus, Inject as
|
|
1721
|
+
import { AGENT_ATTACHMENT_STAGING as AGENT_ATTACHMENT_STAGING2, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY4, AGENT_MODEL_CATALOG, AGENT_OPTIONS as AGENT_OPTIONS4, AGENT_QUOTA_PROVIDER as AGENT_QUOTA_PROVIDER2, AGENT_RUNNER, AGENT_STORE as AGENT_STORE6, REQUESTER_APPROVER, findCatalogModel, mayDecideApproval as mayDecideApproval2, readElicitationQuestions, settleDeadRun as settleDeadRun2, validateElicitationAnswer } from "@dudousxd/nestjs-agent-core";
|
|
1722
|
+
import { BadRequestException as BadRequestException2, ConflictException as ConflictException2, ForbiddenException as ForbiddenException2, GoneException, HttpException, HttpStatus, Inject as Inject8, Injectable as Injectable7, NotFoundException as NotFoundException2, NotImplementedException as NotImplementedException3, Optional as Optional5 } from "@nestjs/common";
|
|
1723
|
+
|
|
1724
|
+
// src/proposals/action-proposal.service.ts
|
|
1725
|
+
import { AGENT_OPTIONS as AGENT_OPTIONS2, AGENT_STORE as AGENT_STORE4, DEFAULT_TEXT_ACTION_PROPOSAL_REPLIES, DEFAULT_TEXT_ACTION_PROPOSAL_VOCABULARY, mayDecideApproval, parseTextActionProposalCommand, resolveTextActionProposalDecision, textActionProposalReply, toActionProposalMutationView, toActionProposalView } from "@dudousxd/nestjs-agent-core";
|
|
1726
|
+
import { ForbiddenException, Inject as Inject6, Injectable as Injectable5, NotFoundException, NotImplementedException } from "@nestjs/common";
|
|
1727
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
1728
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1729
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1730
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1731
|
+
} else {
|
|
1732
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1733
|
+
if (d = decorators[i]) {
|
|
1734
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1739
|
+
}
|
|
1740
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
1741
|
+
function _ts_metadata5(metadataKey, metadataValue) {
|
|
1742
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1743
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
__name(_ts_metadata5, "_ts_metadata");
|
|
1747
|
+
function _ts_param5(paramIndex, decorator) {
|
|
1748
|
+
return function(target, key) {
|
|
1749
|
+
decorator(target, key, paramIndex);
|
|
1750
|
+
};
|
|
1751
|
+
}
|
|
1752
|
+
__name(_ts_param5, "_ts_param");
|
|
1753
|
+
var ActionProposalService = class {
|
|
1754
|
+
static {
|
|
1755
|
+
__name(this, "ActionProposalService");
|
|
1756
|
+
}
|
|
1757
|
+
store;
|
|
1758
|
+
options;
|
|
1759
|
+
constructor(store, options) {
|
|
1760
|
+
this.store = store;
|
|
1761
|
+
this.options = options;
|
|
1762
|
+
const text = options.actionProposalText;
|
|
1763
|
+
this.vocabulary = {
|
|
1764
|
+
...DEFAULT_TEXT_ACTION_PROPOSAL_VOCABULARY,
|
|
1765
|
+
...text?.vocabulary
|
|
1766
|
+
};
|
|
1767
|
+
this.replies = {
|
|
1768
|
+
...DEFAULT_TEXT_ACTION_PROPOSAL_REPLIES,
|
|
1769
|
+
...text?.replies
|
|
1770
|
+
};
|
|
1771
|
+
}
|
|
1772
|
+
/** The words a text decision is made of, and what the agent answers — English unless configured. */
|
|
1773
|
+
vocabulary;
|
|
1774
|
+
replies;
|
|
1775
|
+
capability() {
|
|
1776
|
+
const store = this.store;
|
|
1777
|
+
if (typeof store.getThreadActionProposalScope !== "function" || typeof store.listActionProposals !== "function") throw new NotImplementedException("Action proposals are unavailable");
|
|
1778
|
+
return store;
|
|
1779
|
+
}
|
|
1780
|
+
async scope(threadId, actor) {
|
|
1781
|
+
const scope = await this.capability().getThreadActionProposalScope(threadId);
|
|
1782
|
+
if (!scope) throw new NotFoundException("Thread not found");
|
|
1783
|
+
if (scope.tenantRef !== (actor.tenantRef ?? null)) throw new ForbiddenException("Wrong proposal tenant");
|
|
1784
|
+
return scope;
|
|
1785
|
+
}
|
|
1786
|
+
mayDecide(actor, proposal) {
|
|
1787
|
+
return mayDecideApproval(this.options.approvalPolicy, actor, {
|
|
1788
|
+
toolCallId: proposal.originToolCallId,
|
|
1789
|
+
approver: proposal.approver,
|
|
1790
|
+
requesterRef: proposal.actorRef
|
|
1791
|
+
});
|
|
1792
|
+
}
|
|
1793
|
+
async listPage(threadId, actor, query = {}) {
|
|
1794
|
+
const scope = await this.scope(threadId, actor);
|
|
1795
|
+
const rows = await this.capability().listActionProposals(scope, {
|
|
1796
|
+
limit: 1e3,
|
|
1797
|
+
...query
|
|
1798
|
+
});
|
|
1799
|
+
const visible = [];
|
|
1800
|
+
for (const row of rows) if (scope.actorRef === actor.id || await this.mayDecide(actor, row)) visible.push(row);
|
|
1801
|
+
const last = rows.at(-1);
|
|
1802
|
+
return {
|
|
1803
|
+
// The public view: a row carries the worker's lease token and the tool's idempotency key.
|
|
1804
|
+
items: visible.map(toActionProposalView),
|
|
1805
|
+
...rows.length === 1e3 && last ? {
|
|
1806
|
+
next: {
|
|
1807
|
+
createdAt: last.createdAt,
|
|
1808
|
+
id: last.id
|
|
1809
|
+
}
|
|
1810
|
+
} : {}
|
|
1811
|
+
};
|
|
1812
|
+
}
|
|
1813
|
+
async list(threadId, actor) {
|
|
1814
|
+
return (await this.listPage(threadId, actor)).items;
|
|
1815
|
+
}
|
|
1816
|
+
async decide(threadId, proposalId, actor, command) {
|
|
1817
|
+
const scope = await this.scope(threadId, actor);
|
|
1818
|
+
const proposal = await this.capability().getActionProposal(scope, proposalId);
|
|
1819
|
+
if (!proposal) throw new NotFoundException("Proposal not found");
|
|
1820
|
+
if (!await this.mayDecide(actor, proposal)) throw new ForbiddenException("May not decide this proposal");
|
|
1821
|
+
const result = await this.capability().decideActionProposal(scope, proposalId, {
|
|
1822
|
+
decision: command.decision,
|
|
1823
|
+
actorRef: actor.id,
|
|
1824
|
+
via: command.via ?? "web",
|
|
1825
|
+
...command.remember !== void 0 ? {
|
|
1826
|
+
remember: command.remember
|
|
1827
|
+
} : {},
|
|
1828
|
+
...command.reason !== void 0 ? {
|
|
1829
|
+
reason: command.reason
|
|
1830
|
+
} : {}
|
|
1831
|
+
});
|
|
1832
|
+
return toActionProposalMutationView(result);
|
|
1833
|
+
}
|
|
1834
|
+
async handleTextDecision(threadId, actor, text) {
|
|
1835
|
+
const command = parseTextActionProposalCommand(text, this.vocabulary);
|
|
1836
|
+
if (command.status === "unmatched") return command;
|
|
1837
|
+
if (command.proposalId !== void 0) {
|
|
1838
|
+
const result2 = await this.decide(threadId, command.proposalId, actor, {
|
|
1839
|
+
decision: command.decision,
|
|
1840
|
+
remember: command.remember,
|
|
1841
|
+
via: "text"
|
|
1842
|
+
});
|
|
1843
|
+
return this.textReceipt(threadId, result2, command.decision);
|
|
1844
|
+
}
|
|
1845
|
+
const candidates = [];
|
|
1846
|
+
const scope = await this.scope(threadId, actor);
|
|
1847
|
+
const pending = await this.capability().listActionProposals(scope, {
|
|
1848
|
+
decision: "pending",
|
|
1849
|
+
limit: 1e3
|
|
1850
|
+
});
|
|
1851
|
+
for (const proposal of pending) if (await this.mayDecide(actor, proposal)) candidates.push(proposal);
|
|
1852
|
+
const resolution = resolveTextActionProposalDecision(text, candidates, this.vocabulary);
|
|
1853
|
+
if (resolution.status === "unmatched") return resolution;
|
|
1854
|
+
const saturated = pending.length === 1e3 && !text.includes("#");
|
|
1855
|
+
if (resolution.status === "ambiguous" || saturated) {
|
|
1856
|
+
const proposalIds = candidates.map(({ id }) => id);
|
|
1857
|
+
return {
|
|
1858
|
+
threadId,
|
|
1859
|
+
proposalDecision: {
|
|
1860
|
+
status: "ambiguous",
|
|
1861
|
+
proposalIds
|
|
1862
|
+
},
|
|
1863
|
+
text: saturated ? this.replies.tooMany : this.replies.ambiguous(proposalIds)
|
|
1864
|
+
};
|
|
1865
|
+
}
|
|
1866
|
+
const result = await this.decide(threadId, resolution.proposalId, actor, {
|
|
1867
|
+
decision: resolution.decision,
|
|
1868
|
+
remember: resolution.remember,
|
|
1869
|
+
via: "text"
|
|
1870
|
+
});
|
|
1871
|
+
return this.textReceipt(threadId, result, resolution.decision);
|
|
1872
|
+
}
|
|
1873
|
+
textReceipt(threadId, result, decision) {
|
|
1874
|
+
return {
|
|
1875
|
+
threadId,
|
|
1876
|
+
proposalDecision: result,
|
|
1877
|
+
text: this.reply(result, decision)
|
|
1878
|
+
};
|
|
1879
|
+
}
|
|
1880
|
+
/** The configured reply to a decision the store answered with `result`. */
|
|
1881
|
+
reply(result, decision) {
|
|
1882
|
+
return textActionProposalReply(result, decision, this.replies);
|
|
1883
|
+
}
|
|
1884
|
+
};
|
|
1885
|
+
ActionProposalService = _ts_decorate7([
|
|
1886
|
+
Injectable5(),
|
|
1887
|
+
_ts_param5(0, Inject6(AGENT_STORE4)),
|
|
1888
|
+
_ts_param5(1, Inject6(AGENT_OPTIONS2)),
|
|
1889
|
+
_ts_metadata5("design:type", Function),
|
|
1890
|
+
_ts_metadata5("design:paramtypes", [
|
|
1891
|
+
typeof AgentStore === "undefined" ? Object : AgentStore,
|
|
1892
|
+
typeof Pick === "undefined" ? Object : Pick
|
|
1893
|
+
])
|
|
1894
|
+
], ActionProposalService);
|
|
1460
1895
|
|
|
1461
1896
|
// src/queue/chat-queue.service.ts
|
|
1462
|
-
import { AGENT_ATTACHMENT_STAGING, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY3, AGENT_OPTIONS as
|
|
1463
|
-
import { Inject as
|
|
1897
|
+
import { AGENT_ATTACHMENT_STAGING, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY3, AGENT_OPTIONS as AGENT_OPTIONS3, AGENT_QUOTA_PROVIDER, AGENT_SINK as AGENT_SINK3, AGENT_STORE as AGENT_STORE5, encodeStreamEvent as encodeStreamEvent4, isChatQueueStore, queuedMessageView } from "@dudousxd/nestjs-agent-core";
|
|
1898
|
+
import { Inject as Inject7, Injectable as Injectable6, Logger as Logger3, NotImplementedException as NotImplementedException2, Optional as Optional4 } from "@nestjs/common";
|
|
1899
|
+
|
|
1900
|
+
// src/quota-exceeded.ts
|
|
1901
|
+
import { publishAgentQuotaExceeded } from "@dudousxd/nestjs-agent-core";
|
|
1902
|
+
function publishQuotaBlocked(actor, report, blocked) {
|
|
1903
|
+
const window = report.windows.find((candidate) => candidate.period === blocked.period);
|
|
1904
|
+
const payload = {
|
|
1905
|
+
actorId: actor.id,
|
|
1906
|
+
period: blocked.period,
|
|
1907
|
+
...blocked.reason !== void 0 ? {
|
|
1908
|
+
reason: blocked.reason
|
|
1909
|
+
} : {},
|
|
1910
|
+
...window?.usedTokens !== void 0 ? {
|
|
1911
|
+
usedTokens: window.usedTokens
|
|
1912
|
+
} : {},
|
|
1913
|
+
...window?.limitTokens !== void 0 ? {
|
|
1914
|
+
limitTokens: window.limitTokens
|
|
1915
|
+
} : {},
|
|
1916
|
+
...window !== void 0 ? {
|
|
1917
|
+
usedUsd: window.usedUsd
|
|
1918
|
+
} : {},
|
|
1919
|
+
...window?.limitUsd !== void 0 ? {
|
|
1920
|
+
limitUsd: window.limitUsd
|
|
1921
|
+
} : {}
|
|
1922
|
+
};
|
|
1923
|
+
publishAgentQuotaExceeded(payload);
|
|
1924
|
+
}
|
|
1925
|
+
__name(publishQuotaBlocked, "publishQuotaBlocked");
|
|
1464
1926
|
|
|
1465
1927
|
// src/thread-persona.ts
|
|
1466
1928
|
async function threadPersona(store, threadId) {
|
|
@@ -1473,7 +1935,7 @@ async function threadPersona(store, threadId) {
|
|
|
1473
1935
|
__name(threadPersona, "threadPersona");
|
|
1474
1936
|
|
|
1475
1937
|
// src/queue/chat-queue.service.ts
|
|
1476
|
-
function
|
|
1938
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
1477
1939
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1478
1940
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1479
1941
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1486,19 +1948,19 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
1486
1948
|
}
|
|
1487
1949
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1488
1950
|
}
|
|
1489
|
-
__name(
|
|
1490
|
-
function
|
|
1951
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
1952
|
+
function _ts_metadata6(metadataKey, metadataValue) {
|
|
1491
1953
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1492
1954
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
1493
1955
|
}
|
|
1494
1956
|
}
|
|
1495
|
-
__name(
|
|
1496
|
-
function
|
|
1957
|
+
__name(_ts_metadata6, "_ts_metadata");
|
|
1958
|
+
function _ts_param6(paramIndex, decorator) {
|
|
1497
1959
|
return function(target, key) {
|
|
1498
1960
|
decorator(target, key, paramIndex);
|
|
1499
1961
|
};
|
|
1500
1962
|
}
|
|
1501
|
-
__name(
|
|
1963
|
+
__name(_ts_param6, "_ts_param");
|
|
1502
1964
|
var MAX_DRAIN_ATTEMPTS = 8;
|
|
1503
1965
|
var ChatQueueService2 = class _ChatQueueService {
|
|
1504
1966
|
static {
|
|
@@ -1531,7 +1993,7 @@ var ChatQueueService2 = class _ChatQueueService {
|
|
|
1531
1993
|
/** The bound store as a queue store, or a 501 naming what is missing. */
|
|
1532
1994
|
queueStore() {
|
|
1533
1995
|
if (!isChatQueueStore(this.store)) {
|
|
1534
|
-
throw new
|
|
1996
|
+
throw new NotImplementedException2("Queueing messages requires an AgentStore that implements ChatQueueStore (enqueueMessage, listQueue, \u2026, claimActiveStream, releaseActiveStream); the bound store does not.");
|
|
1535
1997
|
}
|
|
1536
1998
|
return this.store;
|
|
1537
1999
|
}
|
|
@@ -1758,6 +2220,9 @@ var ChatQueueService2 = class _ChatQueueService {
|
|
|
1758
2220
|
} : {},
|
|
1759
2221
|
...input.pageContext !== void 0 ? {
|
|
1760
2222
|
pageContext: input.pageContext
|
|
2223
|
+
} : {},
|
|
2224
|
+
...input.uiCapabilities !== void 0 ? {
|
|
2225
|
+
uiCapabilities: input.uiCapabilities
|
|
1761
2226
|
} : {}
|
|
1762
2227
|
});
|
|
1763
2228
|
await store.setQueuePause(threadId, {
|
|
@@ -1802,12 +2267,14 @@ var ChatQueueService2 = class _ChatQueueService {
|
|
|
1802
2267
|
return null;
|
|
1803
2268
|
}
|
|
1804
2269
|
try {
|
|
1805
|
-
const
|
|
2270
|
+
const report = await this.quotaProvider.report({
|
|
1806
2271
|
actor
|
|
1807
2272
|
});
|
|
2273
|
+
const { blocked } = report;
|
|
1808
2274
|
if (blocked === void 0) {
|
|
1809
2275
|
return null;
|
|
1810
2276
|
}
|
|
2277
|
+
publishQuotaBlocked(actor, report, blocked);
|
|
1811
2278
|
return blocked.reason ?? `The ${blocked.period === "day" ? "daily" : "monthly"} quota is used up`;
|
|
1812
2279
|
} catch {
|
|
1813
2280
|
return null;
|
|
@@ -1838,6 +2305,9 @@ var ChatQueueService2 = class _ChatQueueService {
|
|
|
1838
2305
|
...message.pageContext !== void 0 ? {
|
|
1839
2306
|
pageContext: message.pageContext
|
|
1840
2307
|
} : {},
|
|
2308
|
+
...message.uiCapabilities !== void 0 ? {
|
|
2309
|
+
uiCapabilities: message.uiCapabilities
|
|
2310
|
+
} : {},
|
|
1841
2311
|
...message.model !== void 0 ? {
|
|
1842
2312
|
model: message.model
|
|
1843
2313
|
} : {}
|
|
@@ -1891,20 +2361,20 @@ var ChatQueueService2 = class _ChatQueueService {
|
|
|
1891
2361
|
}));
|
|
1892
2362
|
}
|
|
1893
2363
|
};
|
|
1894
|
-
ChatQueueService2 =
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
2364
|
+
ChatQueueService2 = _ts_decorate8([
|
|
2365
|
+
Injectable6(),
|
|
2366
|
+
_ts_param6(0, Inject7(AGENT_STORE5)),
|
|
2367
|
+
_ts_param6(1, Inject7(AGENT_SINK3)),
|
|
2368
|
+
_ts_param6(2, Optional4()),
|
|
2369
|
+
_ts_param6(2, Inject7(AGENT_QUOTA_PROVIDER)),
|
|
2370
|
+
_ts_param6(3, Optional4()),
|
|
2371
|
+
_ts_param6(3, Inject7(AGENT_OPTIONS3)),
|
|
2372
|
+
_ts_param6(4, Optional4()),
|
|
2373
|
+
_ts_param6(4, Inject7(AGENT_ATTACHMENT_STAGING)),
|
|
2374
|
+
_ts_param6(5, Optional4()),
|
|
2375
|
+
_ts_param6(5, Inject7(AGENT_DEPS_FACTORY3)),
|
|
2376
|
+
_ts_metadata6("design:type", Function),
|
|
2377
|
+
_ts_metadata6("design:paramtypes", [
|
|
1908
2378
|
typeof AgentStore === "undefined" ? Object : AgentStore,
|
|
1909
2379
|
typeof TokenStreamSink === "undefined" ? Object : TokenStreamSink,
|
|
1910
2380
|
typeof QuotaProvider === "undefined" ? Object : QuotaProvider,
|
|
@@ -1956,7 +2426,7 @@ var RunNotActiveException = class extends ConflictException {
|
|
|
1956
2426
|
};
|
|
1957
2427
|
|
|
1958
2428
|
// src/agent.service.ts
|
|
1959
|
-
function
|
|
2429
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
1960
2430
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1961
2431
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1962
2432
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1969,19 +2439,19 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
1969
2439
|
}
|
|
1970
2440
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1971
2441
|
}
|
|
1972
|
-
__name(
|
|
1973
|
-
function
|
|
2442
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
2443
|
+
function _ts_metadata7(metadataKey, metadataValue) {
|
|
1974
2444
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1975
2445
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
1976
2446
|
}
|
|
1977
2447
|
}
|
|
1978
|
-
__name(
|
|
1979
|
-
function
|
|
2448
|
+
__name(_ts_metadata7, "_ts_metadata");
|
|
2449
|
+
function _ts_param7(paramIndex, decorator) {
|
|
1980
2450
|
return function(target, key) {
|
|
1981
2451
|
decorator(target, key, paramIndex);
|
|
1982
2452
|
};
|
|
1983
2453
|
}
|
|
1984
|
-
__name(
|
|
2454
|
+
__name(_ts_param7, "_ts_param");
|
|
1985
2455
|
var AgentService = class {
|
|
1986
2456
|
static {
|
|
1987
2457
|
__name(this, "AgentService");
|
|
@@ -1994,7 +2464,8 @@ var AgentService = class {
|
|
|
1994
2464
|
quotaProvider;
|
|
1995
2465
|
options;
|
|
1996
2466
|
queue;
|
|
1997
|
-
|
|
2467
|
+
proposals;
|
|
2468
|
+
constructor(runner, store, deps, staging, models, quotaProvider, options, queue, proposals) {
|
|
1998
2469
|
this.runner = runner;
|
|
1999
2470
|
this.store = store;
|
|
2000
2471
|
this.deps = deps;
|
|
@@ -2003,6 +2474,28 @@ var AgentService = class {
|
|
|
2003
2474
|
this.quotaProvider = quotaProvider;
|
|
2004
2475
|
this.options = options;
|
|
2005
2476
|
this.queue = queue;
|
|
2477
|
+
this.proposals = proposals;
|
|
2478
|
+
}
|
|
2479
|
+
/**
|
|
2480
|
+
* Decide one independent proposal through the scoped proposal service — what the native
|
|
2481
|
+
* `action-proposals/:id/approve|reject` routes call — and the reply to show for it. `404` when
|
|
2482
|
+
* proposals are not on, `403`/`404` when this actor may not decide it.
|
|
2483
|
+
*/
|
|
2484
|
+
async decideActionProposal(actor, threadId, proposalId, command) {
|
|
2485
|
+
if (this.options?.actionApprovalMode !== "independent" || !this.proposals) {
|
|
2486
|
+
throw new NotFoundException2("Proposal not found");
|
|
2487
|
+
}
|
|
2488
|
+
const result = await this.proposals.decide(threadId, proposalId, actor, command);
|
|
2489
|
+
return {
|
|
2490
|
+
proposalDecision: result,
|
|
2491
|
+
text: this.proposals.reply(result, command.decision)
|
|
2492
|
+
};
|
|
2493
|
+
}
|
|
2494
|
+
async handleTextDecision(threadId, actor, text) {
|
|
2495
|
+
if (this.options?.actionApprovalMode !== "independent" || !this.proposals) return {
|
|
2496
|
+
status: "unmatched"
|
|
2497
|
+
};
|
|
2498
|
+
return this.proposals.handleTextDecision(threadId, actor, text);
|
|
2006
2499
|
}
|
|
2007
2500
|
/** The queue service when the bound store can hold a queue, else `undefined`. */
|
|
2008
2501
|
queueing() {
|
|
@@ -2012,7 +2505,7 @@ var AgentService = class {
|
|
|
2012
2505
|
requireQueue() {
|
|
2013
2506
|
const queue = this.queueing();
|
|
2014
2507
|
if (queue === void 0) {
|
|
2015
|
-
throw new
|
|
2508
|
+
throw new NotImplementedException3("Queueing messages requires an AgentStore that implements ChatQueueStore; the bound store does not.");
|
|
2016
2509
|
}
|
|
2017
2510
|
return queue;
|
|
2018
2511
|
}
|
|
@@ -2045,10 +2538,12 @@ var AgentService = class {
|
|
|
2045
2538
|
if (this.options?.quota === void 0 || this.quotaProvider === void 0) {
|
|
2046
2539
|
return;
|
|
2047
2540
|
}
|
|
2048
|
-
const
|
|
2541
|
+
const report = await this.quotaProvider.report({
|
|
2049
2542
|
actor
|
|
2050
2543
|
});
|
|
2544
|
+
const { blocked } = report;
|
|
2051
2545
|
if (blocked !== void 0) {
|
|
2546
|
+
publishQuotaBlocked(actor, report, blocked);
|
|
2052
2547
|
throw new HttpException({
|
|
2053
2548
|
statusCode: HttpStatus.TOO_MANY_REQUESTS,
|
|
2054
2549
|
code: "quota_exceeded",
|
|
@@ -2134,7 +2629,10 @@ var AgentService = class {
|
|
|
2134
2629
|
const result = await this.send({
|
|
2135
2630
|
...params,
|
|
2136
2631
|
mode: "auto"
|
|
2632
|
+
}, {
|
|
2633
|
+
textDecisions: false
|
|
2137
2634
|
});
|
|
2635
|
+
if ("proposalDecision" in result) throw new Error("Unexpected text decision in run-only API");
|
|
2138
2636
|
if (result.queued !== true) {
|
|
2139
2637
|
return result;
|
|
2140
2638
|
}
|
|
@@ -2162,7 +2660,11 @@ var AgentService = class {
|
|
|
2162
2660
|
* Send a message: start a turn, or — when its thread already has one running — queue the message
|
|
2163
2661
|
* to run after it (see {@link ChatSendMode}). What `POST <base>/chat` calls.
|
|
2164
2662
|
*/
|
|
2165
|
-
async send(params) {
|
|
2663
|
+
async send(params, sendOptions = {}) {
|
|
2664
|
+
if (sendOptions.textDecisions !== false && this.options?.actionApprovalMode === "independent" && params.threadId !== void 0 && params.regenerate !== true && this.proposals) {
|
|
2665
|
+
const decision = await this.proposals.handleTextDecision(params.threadId, params.actor, params.message);
|
|
2666
|
+
if ("proposalDecision" in decision) return decision;
|
|
2667
|
+
}
|
|
2166
2668
|
await this.assertWithinQuota(params.actor);
|
|
2167
2669
|
const target = this.deps.resolveAgent(await this.resolveAgentName(params.agentName, params.threadId));
|
|
2168
2670
|
const agentName = target.agentName;
|
|
@@ -2211,12 +2713,16 @@ var AgentService = class {
|
|
|
2211
2713
|
...params.pageContext !== void 0 ? {
|
|
2212
2714
|
pageContext: params.pageContext
|
|
2213
2715
|
} : {},
|
|
2716
|
+
...params.uiCapabilities !== void 0 ? {
|
|
2717
|
+
uiCapabilities: params.uiCapabilities
|
|
2718
|
+
} : {},
|
|
2214
2719
|
...model !== void 0 ? {
|
|
2215
2720
|
model
|
|
2216
2721
|
} : {}
|
|
2217
2722
|
};
|
|
2218
2723
|
const queue = this.queueing();
|
|
2219
2724
|
if (queue === void 0) {
|
|
2725
|
+
if (this.options?.actionApprovalMode === "independent") throw new Error("Independent actions require queued thread admission");
|
|
2220
2726
|
const { runId } = await this.runner.start(input);
|
|
2221
2727
|
await this.store.setActiveStream(threadId, runId);
|
|
2222
2728
|
return {
|
|
@@ -2297,6 +2803,9 @@ var AgentService = class {
|
|
|
2297
2803
|
...input.pageContext !== void 0 ? {
|
|
2298
2804
|
pageContext: input.pageContext
|
|
2299
2805
|
} : {},
|
|
2806
|
+
...input.uiCapabilities !== void 0 ? {
|
|
2807
|
+
uiCapabilities: input.uiCapabilities
|
|
2808
|
+
} : {},
|
|
2300
2809
|
...interrupting !== void 0 ? {
|
|
2301
2810
|
interrupt: true,
|
|
2302
2811
|
at: "head"
|
|
@@ -2401,7 +2910,7 @@ var AgentService = class {
|
|
|
2401
2910
|
throw gone();
|
|
2402
2911
|
}
|
|
2403
2912
|
if (marked.interrupt !== true) {
|
|
2404
|
-
throw new
|
|
2913
|
+
throw new NotImplementedException3("Interrupting a queued message requires a ChatQueueStore whose updateQueuedMessage stores `interrupt`; the bound store ignored it.");
|
|
2405
2914
|
}
|
|
2406
2915
|
if (!await store.moveQueuedMessage(messageId, 0)) {
|
|
2407
2916
|
throw gone();
|
|
@@ -2460,7 +2969,7 @@ var AgentService = class {
|
|
|
2460
2969
|
async assertOwnsQueuedMessage(actor, messageId) {
|
|
2461
2970
|
const message = await this.requireQueue().queueStore().getQueuedMessage(messageId);
|
|
2462
2971
|
if (message === null) {
|
|
2463
|
-
throw new
|
|
2972
|
+
throw new NotFoundException2(`queued message ${messageId} not found`);
|
|
2464
2973
|
}
|
|
2465
2974
|
await this.assertOwnsThread(actor, message.threadId);
|
|
2466
2975
|
return message.threadId;
|
|
@@ -2481,7 +2990,7 @@ var AgentService = class {
|
|
|
2481
2990
|
}
|
|
2482
2991
|
const staging = this.staging;
|
|
2483
2992
|
if (staging === void 0 || typeof staging.resolve !== "function") {
|
|
2484
|
-
throw new
|
|
2993
|
+
throw new NotImplementedException3("Message attachments require an AGENT_ATTACHMENT_STAGING provider implementing resolve(); attachment urls are never taken from the request.");
|
|
2485
2994
|
}
|
|
2486
2995
|
const resolved = [];
|
|
2487
2996
|
for (const ref of refs) {
|
|
@@ -2490,7 +2999,7 @@ var AgentService = class {
|
|
|
2490
2999
|
actor
|
|
2491
3000
|
});
|
|
2492
3001
|
if (attachment === null) {
|
|
2493
|
-
throw new
|
|
3002
|
+
throw new ForbiddenException2(`attachment ${ref.mediaId} is not available to this actor`);
|
|
2494
3003
|
}
|
|
2495
3004
|
resolved.push(attachment);
|
|
2496
3005
|
}
|
|
@@ -2592,6 +3101,7 @@ var AgentService = class {
|
|
|
2592
3101
|
* not the thread's own actor).
|
|
2593
3102
|
*/
|
|
2594
3103
|
async signalToolCall(toolCallId2, reply) {
|
|
3104
|
+
if ((await this.store.toolCallApproval?.(toolCallId2))?.status === "proposed") throw new ConflictException2("Independent proposals require the scoped proposal decision route");
|
|
2595
3105
|
await this.assertNotExpired(toolCallId2);
|
|
2596
3106
|
const runId = await this.resolveRunForToolCall(toolCallId2);
|
|
2597
3107
|
await this.assertRunWaiting(runId);
|
|
@@ -2632,7 +3142,7 @@ var AgentService = class {
|
|
|
2632
3142
|
throw new RunNotActiveException(runId);
|
|
2633
3143
|
}
|
|
2634
3144
|
if (owner !== actor.id) {
|
|
2635
|
-
throw new
|
|
3145
|
+
throw new ForbiddenException2("run belongs to another actor");
|
|
2636
3146
|
}
|
|
2637
3147
|
}
|
|
2638
3148
|
/**
|
|
@@ -2692,7 +3202,7 @@ var AgentService = class {
|
|
|
2692
3202
|
return;
|
|
2693
3203
|
}
|
|
2694
3204
|
if (this.store.updateThread === void 0) {
|
|
2695
|
-
throw new
|
|
3205
|
+
throw new NotImplementedException3("Setting a thread's defaultAgent, model or persona requires an AgentStore that implements updateThread(); the bound store does not support it.");
|
|
2696
3206
|
}
|
|
2697
3207
|
const model = patch.model === void 0 || patch.model === null ? patch.model : await this.assertModelAllowed(actor, patch.defaultAgent ?? await this.resolveAgentName(void 0, threadId), patch.model);
|
|
2698
3208
|
if (patch.persona !== void 0 && patch.persona !== null) {
|
|
@@ -2863,11 +3373,11 @@ var AgentService = class {
|
|
|
2863
3373
|
throw new BadRequestException2("comment must be at most 2000 characters");
|
|
2864
3374
|
}
|
|
2865
3375
|
if (this.store.threadOfMessage === void 0 || this.store.setMessageFeedback === void 0) {
|
|
2866
|
-
throw new
|
|
3376
|
+
throw new NotImplementedException3("Message feedback requires an AgentStore that implements threadOfMessage() and setMessageFeedback(); the bound store does not support it.");
|
|
2867
3377
|
}
|
|
2868
3378
|
const threadId = await this.store.threadOfMessage(messageId);
|
|
2869
3379
|
if (threadId === null) {
|
|
2870
|
-
throw new
|
|
3380
|
+
throw new NotFoundException2(`message ${messageId} not found`);
|
|
2871
3381
|
}
|
|
2872
3382
|
await this.assertOwnsThread(actor, threadId);
|
|
2873
3383
|
const feedback = input.value === null ? null : {
|
|
@@ -2915,7 +3425,7 @@ var AgentService = class {
|
|
|
2915
3425
|
const list = this.attachmentInventory();
|
|
2916
3426
|
const referencedMediaIds = this.store.referencedMediaIds?.bind(this.store);
|
|
2917
3427
|
if (referencedMediaIds === void 0) {
|
|
2918
|
-
throw new
|
|
3428
|
+
throw new NotImplementedException3("Collecting attachments requires an AgentStore that implements referencedMediaIds(); the bound store cannot say which media a message still references, and guessing would delete files that are in use.");
|
|
2919
3429
|
}
|
|
2920
3430
|
const stagedBefore = options.olderThan.toISOString();
|
|
2921
3431
|
const inventory = await list({
|
|
@@ -2937,7 +3447,7 @@ var AgentService = class {
|
|
|
2937
3447
|
attachmentInventory() {
|
|
2938
3448
|
const list = this.staging?.list?.bind(this.staging);
|
|
2939
3449
|
if (list === void 0) {
|
|
2940
|
-
throw new
|
|
3450
|
+
throw new NotImplementedException3("Listing attachments requires an AGENT_ATTACHMENT_STAGING provider implementing list(); the host owns the staged bytes, so only it can enumerate them.");
|
|
2941
3451
|
}
|
|
2942
3452
|
return list;
|
|
2943
3453
|
}
|
|
@@ -2948,10 +3458,10 @@ var AgentService = class {
|
|
|
2948
3458
|
async assertOwnsThread(actor, threadId) {
|
|
2949
3459
|
const owner = await this.store.ownerOfThread(threadId);
|
|
2950
3460
|
if (owner === null) {
|
|
2951
|
-
throw new
|
|
3461
|
+
throw new NotFoundException2(`thread ${threadId} not found`);
|
|
2952
3462
|
}
|
|
2953
3463
|
if (owner !== actor.id) {
|
|
2954
|
-
throw new
|
|
3464
|
+
throw new ForbiddenException2("thread belongs to another actor");
|
|
2955
3465
|
}
|
|
2956
3466
|
}
|
|
2957
3467
|
/**
|
|
@@ -2962,10 +3472,10 @@ var AgentService = class {
|
|
|
2962
3472
|
async assertOwnsToolCall(actor, toolCallId2) {
|
|
2963
3473
|
const owner = await this.store.ownerOfToolCall(toolCallId2);
|
|
2964
3474
|
if (owner === null) {
|
|
2965
|
-
throw new
|
|
3475
|
+
throw new NotFoundException2(`tool call ${toolCallId2} not found`);
|
|
2966
3476
|
}
|
|
2967
3477
|
if (owner !== actor.id) {
|
|
2968
|
-
throw new
|
|
3478
|
+
throw new ForbiddenException2("tool call belongs to another actor");
|
|
2969
3479
|
}
|
|
2970
3480
|
}
|
|
2971
3481
|
/**
|
|
@@ -3003,15 +3513,15 @@ var AgentService = class {
|
|
|
3003
3513
|
}
|
|
3004
3514
|
const requesterRef = await this.store.ownerOfToolCall(toolCallId2);
|
|
3005
3515
|
if (requesterRef === null) {
|
|
3006
|
-
throw new
|
|
3516
|
+
throw new NotFoundException2(`tool call ${toolCallId2} not found`);
|
|
3007
3517
|
}
|
|
3008
|
-
const allowed = await
|
|
3518
|
+
const allowed = await mayDecideApproval2(this.deps.forAgent().approvalPolicy, actor, {
|
|
3009
3519
|
toolCallId: toolCallId2,
|
|
3010
3520
|
approver,
|
|
3011
3521
|
requesterRef
|
|
3012
3522
|
});
|
|
3013
3523
|
if (!allowed) {
|
|
3014
|
-
throw new
|
|
3524
|
+
throw new ForbiddenException2(`this approval is for ${approver}`);
|
|
3015
3525
|
}
|
|
3016
3526
|
}
|
|
3017
3527
|
/**
|
|
@@ -3040,7 +3550,7 @@ var AgentService = class {
|
|
|
3040
3550
|
async resolveRunForToolCall(toolCallId2) {
|
|
3041
3551
|
const runId = await this.store.runForToolCall(toolCallId2);
|
|
3042
3552
|
if (runId === null) {
|
|
3043
|
-
throw new
|
|
3553
|
+
throw new NotFoundException2(`tool call ${toolCallId2} has no active run to signal`);
|
|
3044
3554
|
}
|
|
3045
3555
|
return runId;
|
|
3046
3556
|
}
|
|
@@ -3048,29 +3558,30 @@ var AgentService = class {
|
|
|
3048
3558
|
async assertOwnsActiveStream(actor, runId) {
|
|
3049
3559
|
const owner = await this.store.ownerOfActiveStream(runId);
|
|
3050
3560
|
if (owner === null) {
|
|
3051
|
-
throw new
|
|
3561
|
+
throw new NotFoundException2(`no active run ${runId}`);
|
|
3052
3562
|
}
|
|
3053
3563
|
if (owner !== actor.id) {
|
|
3054
|
-
throw new
|
|
3564
|
+
throw new ForbiddenException2("run belongs to another actor");
|
|
3055
3565
|
}
|
|
3056
3566
|
}
|
|
3057
3567
|
};
|
|
3058
|
-
AgentService =
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3568
|
+
AgentService = _ts_decorate9([
|
|
3569
|
+
Injectable7(),
|
|
3570
|
+
_ts_param7(0, Inject8(AGENT_RUNNER)),
|
|
3571
|
+
_ts_param7(1, Inject8(AGENT_STORE6)),
|
|
3572
|
+
_ts_param7(2, Inject8(AGENT_DEPS_FACTORY4)),
|
|
3573
|
+
_ts_param7(3, Optional5()),
|
|
3574
|
+
_ts_param7(3, Inject8(AGENT_ATTACHMENT_STAGING2)),
|
|
3575
|
+
_ts_param7(4, Optional5()),
|
|
3576
|
+
_ts_param7(4, Inject8(AGENT_MODEL_CATALOG)),
|
|
3577
|
+
_ts_param7(5, Optional5()),
|
|
3578
|
+
_ts_param7(5, Inject8(AGENT_QUOTA_PROVIDER2)),
|
|
3579
|
+
_ts_param7(6, Optional5()),
|
|
3580
|
+
_ts_param7(6, Inject8(AGENT_OPTIONS4)),
|
|
3581
|
+
_ts_param7(7, Optional5()),
|
|
3582
|
+
_ts_param7(8, Optional5()),
|
|
3583
|
+
_ts_metadata7("design:type", Function),
|
|
3584
|
+
_ts_metadata7("design:paramtypes", [
|
|
3074
3585
|
typeof AgentRunner === "undefined" ? Object : AgentRunner,
|
|
3075
3586
|
typeof AgentStore === "undefined" ? Object : AgentStore,
|
|
3076
3587
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
@@ -3078,13 +3589,14 @@ AgentService = _ts_decorate7([
|
|
|
3078
3589
|
typeof ModelCatalog === "undefined" ? Object : ModelCatalog,
|
|
3079
3590
|
typeof QuotaProvider === "undefined" ? Object : QuotaProvider,
|
|
3080
3591
|
typeof Pick === "undefined" ? Object : Pick,
|
|
3081
|
-
typeof ChatQueueService2 === "undefined" ? Object : ChatQueueService2
|
|
3592
|
+
typeof ChatQueueService2 === "undefined" ? Object : ChatQueueService2,
|
|
3593
|
+
typeof ActionProposalService === "undefined" ? Object : ActionProposalService
|
|
3082
3594
|
])
|
|
3083
3595
|
], AgentService);
|
|
3084
3596
|
|
|
3085
3597
|
// src/approval-port.adapter.ts
|
|
3086
|
-
import { Injectable as
|
|
3087
|
-
function
|
|
3598
|
+
import { Injectable as Injectable8, NotImplementedException as NotImplementedException4, Optional as Optional6 } from "@nestjs/common";
|
|
3599
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
3088
3600
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3089
3601
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3090
3602
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3097,22 +3609,50 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
3097
3609
|
}
|
|
3098
3610
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3099
3611
|
}
|
|
3100
|
-
__name(
|
|
3101
|
-
function
|
|
3612
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
3613
|
+
function _ts_metadata8(metadataKey, metadataValue) {
|
|
3102
3614
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
3103
3615
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
3104
3616
|
}
|
|
3105
3617
|
}
|
|
3106
|
-
__name(
|
|
3618
|
+
__name(_ts_metadata8, "_ts_metadata");
|
|
3619
|
+
function _ts_param8(paramIndex, decorator) {
|
|
3620
|
+
return function(target, key) {
|
|
3621
|
+
decorator(target, key, paramIndex);
|
|
3622
|
+
};
|
|
3623
|
+
}
|
|
3624
|
+
__name(_ts_param8, "_ts_param");
|
|
3107
3625
|
var AgentApprovalPortAdapter = class {
|
|
3108
3626
|
static {
|
|
3109
3627
|
__name(this, "AgentApprovalPortAdapter");
|
|
3110
3628
|
}
|
|
3111
3629
|
agent;
|
|
3112
|
-
|
|
3630
|
+
proposals;
|
|
3631
|
+
constructor(agent, proposals) {
|
|
3113
3632
|
this.agent = agent;
|
|
3633
|
+
this.proposals = proposals;
|
|
3634
|
+
}
|
|
3635
|
+
async approveActionProposal(actor, target, opts) {
|
|
3636
|
+
if (!this.proposals) throw new NotImplementedException4("Action proposals unavailable");
|
|
3637
|
+
return this.proposals.decide(target.threadId, target.proposalId, actor, {
|
|
3638
|
+
decision: "approved",
|
|
3639
|
+
...opts?.remember !== void 0 ? {
|
|
3640
|
+
remember: opts.remember
|
|
3641
|
+
} : {},
|
|
3642
|
+
via: opts?.decidedVia ?? "console"
|
|
3643
|
+
});
|
|
3114
3644
|
}
|
|
3115
|
-
async
|
|
3645
|
+
async rejectActionProposal(actor, target, opts) {
|
|
3646
|
+
if (!this.proposals) throw new NotImplementedException4("Action proposals unavailable");
|
|
3647
|
+
return this.proposals.decide(target.threadId, target.proposalId, actor, {
|
|
3648
|
+
decision: "rejected",
|
|
3649
|
+
...opts?.reason !== void 0 ? {
|
|
3650
|
+
reason: opts.reason
|
|
3651
|
+
} : {},
|
|
3652
|
+
via: opts?.decidedVia ?? "console"
|
|
3653
|
+
});
|
|
3654
|
+
}
|
|
3655
|
+
async approve(toolCallId2, opts) {
|
|
3116
3656
|
await this.agent.signalToolCall(toolCallId2, {
|
|
3117
3657
|
approved: true,
|
|
3118
3658
|
...opts?.executedByRef !== void 0 ? {
|
|
@@ -3141,18 +3681,20 @@ var AgentApprovalPortAdapter = class {
|
|
|
3141
3681
|
});
|
|
3142
3682
|
}
|
|
3143
3683
|
};
|
|
3144
|
-
AgentApprovalPortAdapter =
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3684
|
+
AgentApprovalPortAdapter = _ts_decorate10([
|
|
3685
|
+
Injectable8(),
|
|
3686
|
+
_ts_param8(1, Optional6()),
|
|
3687
|
+
_ts_metadata8("design:type", Function),
|
|
3688
|
+
_ts_metadata8("design:paramtypes", [
|
|
3689
|
+
typeof AgentService === "undefined" ? Object : AgentService,
|
|
3690
|
+
typeof ActionProposalService === "undefined" ? Object : ActionProposalService
|
|
3149
3691
|
])
|
|
3150
3692
|
], AgentApprovalPortAdapter);
|
|
3151
3693
|
|
|
3152
3694
|
// src/controller/agents.controller.ts
|
|
3153
3695
|
import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY5, AGENT_REGISTRY as AGENT_REGISTRY2, AgentRegistry as AgentRegistry3 } from "@dudousxd/nestjs-agent-core";
|
|
3154
|
-
import { Controller, Get, Inject as
|
|
3155
|
-
function
|
|
3696
|
+
import { Controller, Get, Inject as Inject9 } from "@nestjs/common";
|
|
3697
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
3156
3698
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3157
3699
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3158
3700
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3165,19 +3707,19 @@ function _ts_decorate9(decorators, target, key, desc) {
|
|
|
3165
3707
|
}
|
|
3166
3708
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3167
3709
|
}
|
|
3168
|
-
__name(
|
|
3169
|
-
function
|
|
3710
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
3711
|
+
function _ts_metadata9(metadataKey, metadataValue) {
|
|
3170
3712
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
3171
3713
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
3172
3714
|
}
|
|
3173
3715
|
}
|
|
3174
|
-
__name(
|
|
3175
|
-
function
|
|
3716
|
+
__name(_ts_metadata9, "_ts_metadata");
|
|
3717
|
+
function _ts_param9(paramIndex, decorator) {
|
|
3176
3718
|
return function(target, key) {
|
|
3177
3719
|
decorator(target, key, paramIndex);
|
|
3178
3720
|
};
|
|
3179
3721
|
}
|
|
3180
|
-
__name(
|
|
3722
|
+
__name(_ts_param9, "_ts_param");
|
|
3181
3723
|
var AgentsController = class {
|
|
3182
3724
|
static {
|
|
3183
3725
|
__name(this, "AgentsController");
|
|
@@ -3208,26 +3750,26 @@ var AgentsController = class {
|
|
|
3208
3750
|
});
|
|
3209
3751
|
}
|
|
3210
3752
|
};
|
|
3211
|
-
|
|
3753
|
+
_ts_decorate11([
|
|
3212
3754
|
Get(),
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3755
|
+
_ts_metadata9("design:type", Function),
|
|
3756
|
+
_ts_metadata9("design:paramtypes", []),
|
|
3757
|
+
_ts_metadata9("design:returntype", Array)
|
|
3216
3758
|
], AgentsController.prototype, "list", null);
|
|
3217
|
-
AgentsController =
|
|
3759
|
+
AgentsController = _ts_decorate11([
|
|
3218
3760
|
Controller("agents"),
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3761
|
+
_ts_param9(0, Inject9(AGENT_REGISTRY2)),
|
|
3762
|
+
_ts_param9(1, Inject9(AGENT_DEPS_FACTORY5)),
|
|
3763
|
+
_ts_metadata9("design:type", Function),
|
|
3764
|
+
_ts_metadata9("design:paramtypes", [
|
|
3223
3765
|
typeof AgentRegistry3 === "undefined" ? Object : AgentRegistry3,
|
|
3224
3766
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory
|
|
3225
3767
|
])
|
|
3226
3768
|
], AgentsController);
|
|
3227
3769
|
|
|
3228
3770
|
// src/controller/attachments.controller.ts
|
|
3229
|
-
import { AGENT_ACTOR_RESOLVER, AGENT_ATTACHMENT_STAGING as AGENT_ATTACHMENT_STAGING3, AGENT_OPTIONS as
|
|
3230
|
-
import { BadRequestException as BadRequestException3, Controller as Controller2, Get as Get2, Inject as
|
|
3771
|
+
import { AGENT_ACTOR_RESOLVER, AGENT_ATTACHMENT_STAGING as AGENT_ATTACHMENT_STAGING3, AGENT_OPTIONS as AGENT_OPTIONS5 } from "@dudousxd/nestjs-agent-core";
|
|
3772
|
+
import { BadRequestException as BadRequestException3, Controller as Controller2, Get as Get2, Inject as Inject10, NotImplementedException as NotImplementedException5, Optional as Optional7, PayloadTooLargeException, Post, Req, UnsupportedMediaTypeException, UploadedFile, UseInterceptors } from "@nestjs/common";
|
|
3231
3773
|
import { FileInterceptor } from "@nestjs/platform-express";
|
|
3232
3774
|
|
|
3233
3775
|
// src/attachment-limits.ts
|
|
@@ -3256,7 +3798,7 @@ function attachmentLimits(options, staging) {
|
|
|
3256
3798
|
__name(attachmentLimits, "attachmentLimits");
|
|
3257
3799
|
|
|
3258
3800
|
// src/controller/attachments.controller.ts
|
|
3259
|
-
function
|
|
3801
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
3260
3802
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3261
3803
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3262
3804
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3269,19 +3811,19 @@ function _ts_decorate10(decorators, target, key, desc) {
|
|
|
3269
3811
|
}
|
|
3270
3812
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3271
3813
|
}
|
|
3272
|
-
__name(
|
|
3273
|
-
function
|
|
3814
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
3815
|
+
function _ts_metadata10(metadataKey, metadataValue) {
|
|
3274
3816
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
3275
3817
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
3276
3818
|
}
|
|
3277
3819
|
}
|
|
3278
|
-
__name(
|
|
3279
|
-
function
|
|
3820
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
3821
|
+
function _ts_param10(paramIndex, decorator) {
|
|
3280
3822
|
return function(target, key) {
|
|
3281
3823
|
decorator(target, key, paramIndex);
|
|
3282
3824
|
};
|
|
3283
3825
|
}
|
|
3284
|
-
__name(
|
|
3826
|
+
__name(_ts_param10, "_ts_param");
|
|
3285
3827
|
var HARD_MAX_ATTACHMENT_BYTES = 32 * 1024 * 1024;
|
|
3286
3828
|
var ATTACHMENT_PAGE_SIZE = 50;
|
|
3287
3829
|
var AttachmentsController = class {
|
|
@@ -3315,7 +3857,7 @@ var AttachmentsController = class {
|
|
|
3315
3857
|
}
|
|
3316
3858
|
async upload(req, file) {
|
|
3317
3859
|
if (this.staging === void 0) {
|
|
3318
|
-
throw new
|
|
3860
|
+
throw new NotImplementedException5("Attachment upload is not configured on this server: bind AGENT_ATTACHMENT_STAGING (e.g. import AgentMediaAttachmentsModule).");
|
|
3319
3861
|
}
|
|
3320
3862
|
if (file === void 0) {
|
|
3321
3863
|
throw new BadRequestException3('multipart field "file" is required');
|
|
@@ -3337,39 +3879,39 @@ var AttachmentsController = class {
|
|
|
3337
3879
|
});
|
|
3338
3880
|
}
|
|
3339
3881
|
};
|
|
3340
|
-
|
|
3882
|
+
_ts_decorate12([
|
|
3341
3883
|
Get2(),
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3884
|
+
_ts_param10(0, Req()),
|
|
3885
|
+
_ts_metadata10("design:type", Function),
|
|
3886
|
+
_ts_metadata10("design:paramtypes", [
|
|
3345
3887
|
typeof Request === "undefined" ? Object : Request
|
|
3346
3888
|
]),
|
|
3347
|
-
|
|
3889
|
+
_ts_metadata10("design:returntype", Promise)
|
|
3348
3890
|
], AttachmentsController.prototype, "list", null);
|
|
3349
|
-
|
|
3891
|
+
_ts_decorate12([
|
|
3350
3892
|
Post(),
|
|
3351
3893
|
UseInterceptors(FileInterceptor("file", {
|
|
3352
3894
|
limits: {
|
|
3353
3895
|
fileSize: HARD_MAX_ATTACHMENT_BYTES
|
|
3354
3896
|
}
|
|
3355
3897
|
})),
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3898
|
+
_ts_param10(0, Req()),
|
|
3899
|
+
_ts_param10(1, UploadedFile()),
|
|
3900
|
+
_ts_metadata10("design:type", Function),
|
|
3901
|
+
_ts_metadata10("design:paramtypes", [
|
|
3360
3902
|
typeof Request === "undefined" ? Object : Request,
|
|
3361
3903
|
Object
|
|
3362
3904
|
]),
|
|
3363
|
-
|
|
3905
|
+
_ts_metadata10("design:returntype", Promise)
|
|
3364
3906
|
], AttachmentsController.prototype, "upload", null);
|
|
3365
|
-
AttachmentsController =
|
|
3907
|
+
AttachmentsController = _ts_decorate12([
|
|
3366
3908
|
Controller2("attachments"),
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3909
|
+
_ts_param10(0, Inject10(AGENT_OPTIONS5)),
|
|
3910
|
+
_ts_param10(1, Inject10(AGENT_ACTOR_RESOLVER)),
|
|
3911
|
+
_ts_param10(3, Optional7()),
|
|
3912
|
+
_ts_param10(3, Inject10(AGENT_ATTACHMENT_STAGING3)),
|
|
3913
|
+
_ts_metadata10("design:type", Function),
|
|
3914
|
+
_ts_metadata10("design:paramtypes", [
|
|
3373
3915
|
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
3374
3916
|
typeof ActorResolver === "undefined" ? Object : ActorResolver,
|
|
3375
3917
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
@@ -3379,8 +3921,9 @@ AttachmentsController = _ts_decorate10([
|
|
|
3379
3921
|
|
|
3380
3922
|
// src/controller/chat.controller.ts
|
|
3381
3923
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER2, AgentStreamError as AgentStreamError2, streamFailure as streamFailure2 } from "@dudousxd/nestjs-agent-core";
|
|
3382
|
-
import {
|
|
3383
|
-
|
|
3924
|
+
import { validateUiCapabilities } from "@dudousxd/nestjs-agent-core/genui";
|
|
3925
|
+
import { BadRequestException as BadRequestException4, Body, Controller as Controller3, Get as Get3, Inject as Inject11, Param, Post as Post2, Query, Req as Req2, Res } from "@nestjs/common";
|
|
3926
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
3384
3927
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3385
3928
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3386
3929
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3393,19 +3936,19 @@ function _ts_decorate11(decorators, target, key, desc) {
|
|
|
3393
3936
|
}
|
|
3394
3937
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3395
3938
|
}
|
|
3396
|
-
__name(
|
|
3397
|
-
function
|
|
3939
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
3940
|
+
function _ts_metadata11(metadataKey, metadataValue) {
|
|
3398
3941
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
3399
3942
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
3400
3943
|
}
|
|
3401
3944
|
}
|
|
3402
|
-
__name(
|
|
3403
|
-
function
|
|
3945
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
3946
|
+
function _ts_param11(paramIndex, decorator) {
|
|
3404
3947
|
return function(target, key) {
|
|
3405
3948
|
decorator(target, key, paramIndex);
|
|
3406
3949
|
};
|
|
3407
3950
|
}
|
|
3408
|
-
__name(
|
|
3951
|
+
__name(_ts_param11, "_ts_param");
|
|
3409
3952
|
function sendMode(body) {
|
|
3410
3953
|
if (body.interrupt === true) {
|
|
3411
3954
|
return "interrupt";
|
|
@@ -3466,9 +4009,18 @@ var ChatController = class {
|
|
|
3466
4009
|
const actor = await this.actorResolver.resolve(req);
|
|
3467
4010
|
const attachments = attachmentRefs(body.attachments);
|
|
3468
4011
|
const mode = sendMode(body);
|
|
4012
|
+
let uiCapabilities;
|
|
4013
|
+
try {
|
|
4014
|
+
uiCapabilities = body.uiCapabilities === void 0 ? void 0 : validateUiCapabilities(body.uiCapabilities);
|
|
4015
|
+
} catch {
|
|
4016
|
+
throw new BadRequestException4("Invalid UI capabilities");
|
|
4017
|
+
}
|
|
3469
4018
|
const result = await this.agent.send({
|
|
3470
4019
|
actor,
|
|
3471
4020
|
message: body.message,
|
|
4021
|
+
...uiCapabilities !== void 0 ? {
|
|
4022
|
+
uiCapabilities
|
|
4023
|
+
} : {},
|
|
3472
4024
|
...body.threadId !== void 0 ? {
|
|
3473
4025
|
threadId: body.threadId
|
|
3474
4026
|
} : {},
|
|
@@ -3495,6 +4047,10 @@ var ChatController = class {
|
|
|
3495
4047
|
} : {},
|
|
3496
4048
|
mode
|
|
3497
4049
|
});
|
|
4050
|
+
if ("proposalDecision" in result) {
|
|
4051
|
+
res.status(200).json(result);
|
|
4052
|
+
return;
|
|
4053
|
+
}
|
|
3498
4054
|
if (result.queued === true) {
|
|
3499
4055
|
res.status(202).json(result);
|
|
3500
4056
|
return;
|
|
@@ -3586,50 +4142,50 @@ data: ${JSON.stringify(payload)}
|
|
|
3586
4142
|
res.end();
|
|
3587
4143
|
}
|
|
3588
4144
|
};
|
|
3589
|
-
|
|
4145
|
+
_ts_decorate13([
|
|
3590
4146
|
Post2("chat"),
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
4147
|
+
_ts_param11(0, Req2()),
|
|
4148
|
+
_ts_param11(1, Res()),
|
|
4149
|
+
_ts_param11(2, Body()),
|
|
4150
|
+
_ts_metadata11("design:type", Function),
|
|
4151
|
+
_ts_metadata11("design:paramtypes", [
|
|
3596
4152
|
typeof Request === "undefined" ? Object : Request,
|
|
3597
4153
|
typeof Response === "undefined" ? Object : Response,
|
|
3598
4154
|
typeof ChatBody === "undefined" ? Object : ChatBody
|
|
3599
4155
|
]),
|
|
3600
|
-
|
|
4156
|
+
_ts_metadata11("design:returntype", Promise)
|
|
3601
4157
|
], ChatController.prototype, "chat", null);
|
|
3602
|
-
|
|
4158
|
+
_ts_decorate13([
|
|
3603
4159
|
Get3("chat/:runId/stream"),
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
4160
|
+
_ts_param11(0, Req2()),
|
|
4161
|
+
_ts_param11(1, Param("runId")),
|
|
4162
|
+
_ts_param11(2, Res()),
|
|
4163
|
+
_ts_param11(3, Query("after")),
|
|
4164
|
+
_ts_metadata11("design:type", Function),
|
|
4165
|
+
_ts_metadata11("design:paramtypes", [
|
|
3610
4166
|
typeof Request === "undefined" ? Object : Request,
|
|
3611
4167
|
String,
|
|
3612
4168
|
typeof Response === "undefined" ? Object : Response,
|
|
3613
4169
|
String
|
|
3614
4170
|
]),
|
|
3615
|
-
|
|
4171
|
+
_ts_metadata11("design:returntype", Promise)
|
|
3616
4172
|
], ChatController.prototype, "stream", null);
|
|
3617
|
-
|
|
4173
|
+
_ts_decorate13([
|
|
3618
4174
|
Post2("chat/:runId/cancel"),
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
4175
|
+
_ts_param11(0, Req2()),
|
|
4176
|
+
_ts_param11(1, Param("runId")),
|
|
4177
|
+
_ts_metadata11("design:type", Function),
|
|
4178
|
+
_ts_metadata11("design:paramtypes", [
|
|
3623
4179
|
typeof Request === "undefined" ? Object : Request,
|
|
3624
4180
|
String
|
|
3625
4181
|
]),
|
|
3626
|
-
|
|
4182
|
+
_ts_metadata11("design:returntype", Promise)
|
|
3627
4183
|
], ChatController.prototype, "cancel", null);
|
|
3628
|
-
ChatController =
|
|
4184
|
+
ChatController = _ts_decorate13([
|
|
3629
4185
|
Controller3(),
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
4186
|
+
_ts_param11(1, Inject11(AGENT_ACTOR_RESOLVER2)),
|
|
4187
|
+
_ts_metadata11("design:type", Function),
|
|
4188
|
+
_ts_metadata11("design:paramtypes", [
|
|
3633
4189
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
3634
4190
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
3635
4191
|
])
|
|
@@ -3645,8 +4201,8 @@ function parseCursor(raw) {
|
|
|
3645
4201
|
__name(parseCursor, "parseCursor");
|
|
3646
4202
|
|
|
3647
4203
|
// src/controller/config.controller.ts
|
|
3648
|
-
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER3, AGENT_ATTACHMENT_STAGING as AGENT_ATTACHMENT_STAGING4, AGENT_MODEL_CATALOG as AGENT_MODEL_CATALOG2, AGENT_OPTIONS as
|
|
3649
|
-
import { Controller as Controller4, Get as Get4, Inject as
|
|
4204
|
+
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER3, AGENT_ATTACHMENT_STAGING as AGENT_ATTACHMENT_STAGING4, AGENT_MODEL_CATALOG as AGENT_MODEL_CATALOG2, AGENT_OPTIONS as AGENT_OPTIONS6 } from "@dudousxd/nestjs-agent-core";
|
|
4205
|
+
import { Controller as Controller4, Get as Get4, Inject as Inject12, Optional as Optional8, Req as Req3 } from "@nestjs/common";
|
|
3650
4206
|
|
|
3651
4207
|
// src/resolver/anonymous-actor-resolver.ts
|
|
3652
4208
|
import { createHash, randomBytes } from "crypto";
|
|
@@ -3736,7 +4292,7 @@ var AnonymousActorResolver = class {
|
|
|
3736
4292
|
};
|
|
3737
4293
|
|
|
3738
4294
|
// src/controller/config.controller.ts
|
|
3739
|
-
function
|
|
4295
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
3740
4296
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3741
4297
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3742
4298
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3749,19 +4305,19 @@ function _ts_decorate12(decorators, target, key, desc) {
|
|
|
3749
4305
|
}
|
|
3750
4306
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3751
4307
|
}
|
|
3752
|
-
__name(
|
|
3753
|
-
function
|
|
4308
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
4309
|
+
function _ts_metadata12(metadataKey, metadataValue) {
|
|
3754
4310
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
3755
4311
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
3756
4312
|
}
|
|
3757
4313
|
}
|
|
3758
|
-
__name(
|
|
3759
|
-
function
|
|
4314
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
4315
|
+
function _ts_param12(paramIndex, decorator) {
|
|
3760
4316
|
return function(target, key) {
|
|
3761
4317
|
decorator(target, key, paramIndex);
|
|
3762
4318
|
};
|
|
3763
4319
|
}
|
|
3764
|
-
__name(
|
|
4320
|
+
__name(_ts_param12, "_ts_param");
|
|
3765
4321
|
var ConfigController = class {
|
|
3766
4322
|
static {
|
|
3767
4323
|
__name(this, "ConfigController");
|
|
@@ -3792,25 +4348,25 @@ var ConfigController = class {
|
|
|
3792
4348
|
};
|
|
3793
4349
|
}
|
|
3794
4350
|
};
|
|
3795
|
-
|
|
4351
|
+
_ts_decorate14([
|
|
3796
4352
|
Get4(),
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
4353
|
+
_ts_param12(0, Req3()),
|
|
4354
|
+
_ts_metadata12("design:type", Function),
|
|
4355
|
+
_ts_metadata12("design:paramtypes", [
|
|
3800
4356
|
typeof Request === "undefined" ? Object : Request
|
|
3801
4357
|
]),
|
|
3802
|
-
|
|
4358
|
+
_ts_metadata12("design:returntype", Promise)
|
|
3803
4359
|
], ConfigController.prototype, "config", null);
|
|
3804
|
-
ConfigController =
|
|
4360
|
+
ConfigController = _ts_decorate14([
|
|
3805
4361
|
Controller4("config"),
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
4362
|
+
_ts_param12(0, Inject12(AGENT_OPTIONS6)),
|
|
4363
|
+
_ts_param12(1, Inject12(AGENT_ACTOR_RESOLVER3)),
|
|
4364
|
+
_ts_param12(2, Optional8()),
|
|
4365
|
+
_ts_param12(2, Inject12(AGENT_ATTACHMENT_STAGING4)),
|
|
4366
|
+
_ts_param12(3, Optional8()),
|
|
4367
|
+
_ts_param12(3, Inject12(AGENT_MODEL_CATALOG2)),
|
|
4368
|
+
_ts_metadata12("design:type", Function),
|
|
4369
|
+
_ts_metadata12("design:paramtypes", [
|
|
3814
4370
|
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
3815
4371
|
typeof ActorResolver === "undefined" ? Object : ActorResolver,
|
|
3816
4372
|
Object,
|
|
@@ -3820,8 +4376,8 @@ ConfigController = _ts_decorate12([
|
|
|
3820
4376
|
|
|
3821
4377
|
// src/controller/memories.controller.ts
|
|
3822
4378
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER4, AGENT_MEMORY as AGENT_MEMORY2, memoryForgetVerdict, offerMemories } from "@dudousxd/nestjs-agent-core";
|
|
3823
|
-
import { Controller as Controller5, Delete, ForbiddenException as
|
|
3824
|
-
function
|
|
4379
|
+
import { Controller as Controller5, Delete, ForbiddenException as ForbiddenException3, Get as Get5, Inject as Inject13, NotFoundException as NotFoundException3, Optional as Optional9, Param as Param2, Query as Query2, Req as Req4 } from "@nestjs/common";
|
|
4380
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
3825
4381
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3826
4382
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3827
4383
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3834,19 +4390,19 @@ function _ts_decorate13(decorators, target, key, desc) {
|
|
|
3834
4390
|
}
|
|
3835
4391
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3836
4392
|
}
|
|
3837
|
-
__name(
|
|
3838
|
-
function
|
|
4393
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
4394
|
+
function _ts_metadata13(metadataKey, metadataValue) {
|
|
3839
4395
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
3840
4396
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
3841
4397
|
}
|
|
3842
4398
|
}
|
|
3843
|
-
__name(
|
|
3844
|
-
function
|
|
4399
|
+
__name(_ts_metadata13, "_ts_metadata");
|
|
4400
|
+
function _ts_param13(paramIndex, decorator) {
|
|
3845
4401
|
return function(target, key) {
|
|
3846
4402
|
decorator(target, key, paramIndex);
|
|
3847
4403
|
};
|
|
3848
4404
|
}
|
|
3849
|
-
__name(
|
|
4405
|
+
__name(_ts_param13, "_ts_param");
|
|
3850
4406
|
var MemoriesController = class {
|
|
3851
4407
|
static {
|
|
3852
4408
|
__name(this, "MemoriesController");
|
|
@@ -3880,20 +4436,20 @@ var MemoriesController = class {
|
|
|
3880
4436
|
*/
|
|
3881
4437
|
async forget(req, id) {
|
|
3882
4438
|
if (this.memory === void 0) {
|
|
3883
|
-
throw new
|
|
4439
|
+
throw new NotFoundException3("No memory is configured in this deployment.");
|
|
3884
4440
|
}
|
|
3885
4441
|
const actor = await this.actorResolver.resolve(req);
|
|
3886
4442
|
const digest = await this.unbounded("", actor);
|
|
3887
4443
|
const entry = digest.entries.find((candidate) => candidate.id === id);
|
|
3888
4444
|
if (entry === void 0) {
|
|
3889
|
-
throw new
|
|
4445
|
+
throw new NotFoundException3(`No memory with id "${id}".`);
|
|
3890
4446
|
}
|
|
3891
4447
|
const verdict = memoryForgetVerdict({
|
|
3892
4448
|
record: entry,
|
|
3893
4449
|
actor
|
|
3894
4450
|
});
|
|
3895
4451
|
if (!verdict.allowed) {
|
|
3896
|
-
throw new
|
|
4452
|
+
throw new ForbiddenException3(verdict.reason);
|
|
3897
4453
|
}
|
|
3898
4454
|
return {
|
|
3899
4455
|
forgotten: await this.memory.provider.forget({
|
|
@@ -3919,35 +4475,35 @@ var MemoriesController = class {
|
|
|
3919
4475
|
});
|
|
3920
4476
|
}
|
|
3921
4477
|
};
|
|
3922
|
-
|
|
4478
|
+
_ts_decorate15([
|
|
3923
4479
|
Get5(),
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
4480
|
+
_ts_param13(0, Req4()),
|
|
4481
|
+
_ts_param13(1, Query2("threadId")),
|
|
4482
|
+
_ts_metadata13("design:type", Function),
|
|
4483
|
+
_ts_metadata13("design:paramtypes", [
|
|
3928
4484
|
typeof Request === "undefined" ? Object : Request,
|
|
3929
4485
|
String
|
|
3930
4486
|
]),
|
|
3931
|
-
|
|
4487
|
+
_ts_metadata13("design:returntype", Promise)
|
|
3932
4488
|
], MemoriesController.prototype, "list", null);
|
|
3933
|
-
|
|
4489
|
+
_ts_decorate15([
|
|
3934
4490
|
Delete(":id"),
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
4491
|
+
_ts_param13(0, Req4()),
|
|
4492
|
+
_ts_param13(1, Param2("id")),
|
|
4493
|
+
_ts_metadata13("design:type", Function),
|
|
4494
|
+
_ts_metadata13("design:paramtypes", [
|
|
3939
4495
|
typeof Request === "undefined" ? Object : Request,
|
|
3940
4496
|
String
|
|
3941
4497
|
]),
|
|
3942
|
-
|
|
4498
|
+
_ts_metadata13("design:returntype", Promise)
|
|
3943
4499
|
], MemoriesController.prototype, "forget", null);
|
|
3944
|
-
MemoriesController =
|
|
4500
|
+
MemoriesController = _ts_decorate15([
|
|
3945
4501
|
Controller5("memories"),
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
4502
|
+
_ts_param13(0, Inject13(AGENT_ACTOR_RESOLVER4)),
|
|
4503
|
+
_ts_param13(1, Optional9()),
|
|
4504
|
+
_ts_param13(1, Inject13(AGENT_MEMORY2)),
|
|
4505
|
+
_ts_metadata13("design:type", Function),
|
|
4506
|
+
_ts_metadata13("design:paramtypes", [
|
|
3951
4507
|
typeof ActorResolver === "undefined" ? Object : ActorResolver,
|
|
3952
4508
|
Object
|
|
3953
4509
|
])
|
|
@@ -3955,8 +4511,8 @@ MemoriesController = _ts_decorate13([
|
|
|
3955
4511
|
|
|
3956
4512
|
// src/controller/messages.controller.ts
|
|
3957
4513
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER5 } from "@dudousxd/nestjs-agent-core";
|
|
3958
|
-
import { Body as Body2, Controller as Controller6, HttpCode, Inject as
|
|
3959
|
-
function
|
|
4514
|
+
import { Body as Body2, Controller as Controller6, HttpCode, Inject as Inject14, Param as Param3, Post as Post3, Req as Req5 } from "@nestjs/common";
|
|
4515
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
3960
4516
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3961
4517
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3962
4518
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3969,19 +4525,19 @@ function _ts_decorate14(decorators, target, key, desc) {
|
|
|
3969
4525
|
}
|
|
3970
4526
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3971
4527
|
}
|
|
3972
|
-
__name(
|
|
3973
|
-
function
|
|
4528
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
4529
|
+
function _ts_metadata14(metadataKey, metadataValue) {
|
|
3974
4530
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
3975
4531
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
3976
4532
|
}
|
|
3977
4533
|
}
|
|
3978
|
-
__name(
|
|
3979
|
-
function
|
|
4534
|
+
__name(_ts_metadata14, "_ts_metadata");
|
|
4535
|
+
function _ts_param14(paramIndex, decorator) {
|
|
3980
4536
|
return function(target, key) {
|
|
3981
4537
|
decorator(target, key, paramIndex);
|
|
3982
4538
|
};
|
|
3983
4539
|
}
|
|
3984
|
-
__name(
|
|
4540
|
+
__name(_ts_param14, "_ts_param");
|
|
3985
4541
|
var MessagesController = class {
|
|
3986
4542
|
static {
|
|
3987
4543
|
__name(this, "MessagesController");
|
|
@@ -4009,25 +4565,25 @@ var MessagesController = class {
|
|
|
4009
4565
|
};
|
|
4010
4566
|
}
|
|
4011
4567
|
};
|
|
4012
|
-
|
|
4568
|
+
_ts_decorate16([
|
|
4013
4569
|
Post3(":id/feedback"),
|
|
4014
4570
|
HttpCode(200),
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4571
|
+
_ts_param14(0, Req5()),
|
|
4572
|
+
_ts_param14(1, Param3("id")),
|
|
4573
|
+
_ts_param14(2, Body2()),
|
|
4574
|
+
_ts_metadata14("design:type", Function),
|
|
4575
|
+
_ts_metadata14("design:paramtypes", [
|
|
4020
4576
|
typeof Request === "undefined" ? Object : Request,
|
|
4021
4577
|
String,
|
|
4022
4578
|
typeof FeedbackBody === "undefined" ? Object : FeedbackBody
|
|
4023
4579
|
]),
|
|
4024
|
-
|
|
4580
|
+
_ts_metadata14("design:returntype", Promise)
|
|
4025
4581
|
], MessagesController.prototype, "feedback", null);
|
|
4026
|
-
MessagesController =
|
|
4582
|
+
MessagesController = _ts_decorate16([
|
|
4027
4583
|
Controller6("messages"),
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4584
|
+
_ts_param14(1, Inject14(AGENT_ACTOR_RESOLVER5)),
|
|
4585
|
+
_ts_metadata14("design:type", Function),
|
|
4586
|
+
_ts_metadata14("design:paramtypes", [
|
|
4031
4587
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
4032
4588
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
4033
4589
|
])
|
|
@@ -4035,8 +4591,8 @@ MessagesController = _ts_decorate14([
|
|
|
4035
4591
|
|
|
4036
4592
|
// src/controller/models.controller.ts
|
|
4037
4593
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER6 } from "@dudousxd/nestjs-agent-core";
|
|
4038
|
-
import { Controller as Controller7, Get as Get6, Inject as
|
|
4039
|
-
function
|
|
4594
|
+
import { Controller as Controller7, Get as Get6, Inject as Inject15, Query as Query3, Req as Req6 } from "@nestjs/common";
|
|
4595
|
+
function _ts_decorate17(decorators, target, key, desc) {
|
|
4040
4596
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4041
4597
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
4042
4598
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4049,19 +4605,19 @@ function _ts_decorate15(decorators, target, key, desc) {
|
|
|
4049
4605
|
}
|
|
4050
4606
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4051
4607
|
}
|
|
4052
|
-
__name(
|
|
4053
|
-
function
|
|
4608
|
+
__name(_ts_decorate17, "_ts_decorate");
|
|
4609
|
+
function _ts_metadata15(metadataKey, metadataValue) {
|
|
4054
4610
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
4055
4611
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
4056
4612
|
}
|
|
4057
4613
|
}
|
|
4058
|
-
__name(
|
|
4059
|
-
function
|
|
4614
|
+
__name(_ts_metadata15, "_ts_metadata");
|
|
4615
|
+
function _ts_param15(paramIndex, decorator) {
|
|
4060
4616
|
return function(target, key) {
|
|
4061
4617
|
decorator(target, key, paramIndex);
|
|
4062
4618
|
};
|
|
4063
4619
|
}
|
|
4064
|
-
__name(
|
|
4620
|
+
__name(_ts_param15, "_ts_param");
|
|
4065
4621
|
var ModelsController = class {
|
|
4066
4622
|
static {
|
|
4067
4623
|
__name(this, "ModelsController");
|
|
@@ -4081,22 +4637,22 @@ var ModelsController = class {
|
|
|
4081
4637
|
return this.agent.listModels(actor, agent);
|
|
4082
4638
|
}
|
|
4083
4639
|
};
|
|
4084
|
-
|
|
4640
|
+
_ts_decorate17([
|
|
4085
4641
|
Get6(),
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4642
|
+
_ts_param15(0, Req6()),
|
|
4643
|
+
_ts_param15(1, Query3("agent")),
|
|
4644
|
+
_ts_metadata15("design:type", Function),
|
|
4645
|
+
_ts_metadata15("design:paramtypes", [
|
|
4090
4646
|
typeof Request === "undefined" ? Object : Request,
|
|
4091
4647
|
String
|
|
4092
4648
|
]),
|
|
4093
|
-
|
|
4649
|
+
_ts_metadata15("design:returntype", Promise)
|
|
4094
4650
|
], ModelsController.prototype, "list", null);
|
|
4095
|
-
ModelsController =
|
|
4651
|
+
ModelsController = _ts_decorate17([
|
|
4096
4652
|
Controller7("models"),
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4653
|
+
_ts_param15(1, Inject15(AGENT_ACTOR_RESOLVER6)),
|
|
4654
|
+
_ts_metadata15("design:type", Function),
|
|
4655
|
+
_ts_metadata15("design:paramtypes", [
|
|
4100
4656
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
4101
4657
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
4102
4658
|
])
|
|
@@ -4104,8 +4660,8 @@ ModelsController = _ts_decorate15([
|
|
|
4104
4660
|
|
|
4105
4661
|
// src/controller/queue.controller.ts
|
|
4106
4662
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER7 } from "@dudousxd/nestjs-agent-core";
|
|
4107
|
-
import { BadRequestException as BadRequestException5, Body as Body3, Controller as Controller8, Delete as Delete2, Get as Get7, Inject as
|
|
4108
|
-
function
|
|
4663
|
+
import { BadRequestException as BadRequestException5, Body as Body3, Controller as Controller8, Delete as Delete2, Get as Get7, Inject as Inject16, Param as Param4, Patch, Post as Post4, Req as Req7 } from "@nestjs/common";
|
|
4664
|
+
function _ts_decorate18(decorators, target, key, desc) {
|
|
4109
4665
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4110
4666
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
4111
4667
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4118,19 +4674,19 @@ function _ts_decorate16(decorators, target, key, desc) {
|
|
|
4118
4674
|
}
|
|
4119
4675
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4120
4676
|
}
|
|
4121
|
-
__name(
|
|
4122
|
-
function
|
|
4677
|
+
__name(_ts_decorate18, "_ts_decorate");
|
|
4678
|
+
function _ts_metadata16(metadataKey, metadataValue) {
|
|
4123
4679
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
4124
4680
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
4125
4681
|
}
|
|
4126
4682
|
}
|
|
4127
|
-
__name(
|
|
4128
|
-
function
|
|
4683
|
+
__name(_ts_metadata16, "_ts_metadata");
|
|
4684
|
+
function _ts_param16(paramIndex, decorator) {
|
|
4129
4685
|
return function(target, key) {
|
|
4130
4686
|
decorator(target, key, paramIndex);
|
|
4131
4687
|
};
|
|
4132
4688
|
}
|
|
4133
|
-
__name(
|
|
4689
|
+
__name(_ts_param16, "_ts_param");
|
|
4134
4690
|
var QueueController = class {
|
|
4135
4691
|
static {
|
|
4136
4692
|
__name(this, "QueueController");
|
|
@@ -4184,79 +4740,79 @@ var QueueController = class {
|
|
|
4184
4740
|
return this.agent.removeQueuedMessage(await this.actorResolver.resolve(req), messageId);
|
|
4185
4741
|
}
|
|
4186
4742
|
};
|
|
4187
|
-
|
|
4743
|
+
_ts_decorate18([
|
|
4188
4744
|
Get7("threads/:id/queue"),
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4745
|
+
_ts_param16(0, Req7()),
|
|
4746
|
+
_ts_param16(1, Param4("id")),
|
|
4747
|
+
_ts_metadata16("design:type", Function),
|
|
4748
|
+
_ts_metadata16("design:paramtypes", [
|
|
4193
4749
|
typeof Request === "undefined" ? Object : Request,
|
|
4194
4750
|
String
|
|
4195
4751
|
]),
|
|
4196
|
-
|
|
4752
|
+
_ts_metadata16("design:returntype", Promise)
|
|
4197
4753
|
], QueueController.prototype, "list", null);
|
|
4198
|
-
|
|
4754
|
+
_ts_decorate18([
|
|
4199
4755
|
Delete2("threads/:id/queue"),
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4756
|
+
_ts_param16(0, Req7()),
|
|
4757
|
+
_ts_param16(1, Param4("id")),
|
|
4758
|
+
_ts_metadata16("design:type", Function),
|
|
4759
|
+
_ts_metadata16("design:paramtypes", [
|
|
4204
4760
|
typeof Request === "undefined" ? Object : Request,
|
|
4205
4761
|
String
|
|
4206
4762
|
]),
|
|
4207
|
-
|
|
4763
|
+
_ts_metadata16("design:returntype", Promise)
|
|
4208
4764
|
], QueueController.prototype, "clear", null);
|
|
4209
|
-
|
|
4765
|
+
_ts_decorate18([
|
|
4210
4766
|
Post4("threads/:id/queue/resume"),
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4767
|
+
_ts_param16(0, Req7()),
|
|
4768
|
+
_ts_param16(1, Param4("id")),
|
|
4769
|
+
_ts_metadata16("design:type", Function),
|
|
4770
|
+
_ts_metadata16("design:paramtypes", [
|
|
4215
4771
|
typeof Request === "undefined" ? Object : Request,
|
|
4216
4772
|
String
|
|
4217
4773
|
]),
|
|
4218
|
-
|
|
4774
|
+
_ts_metadata16("design:returntype", Promise)
|
|
4219
4775
|
], QueueController.prototype, "resume", null);
|
|
4220
|
-
|
|
4776
|
+
_ts_decorate18([
|
|
4221
4777
|
Patch("queue/:messageId"),
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4778
|
+
_ts_param16(0, Req7()),
|
|
4779
|
+
_ts_param16(1, Param4("messageId")),
|
|
4780
|
+
_ts_param16(2, Body3()),
|
|
4781
|
+
_ts_metadata16("design:type", Function),
|
|
4782
|
+
_ts_metadata16("design:paramtypes", [
|
|
4227
4783
|
typeof Request === "undefined" ? Object : Request,
|
|
4228
4784
|
String,
|
|
4229
4785
|
typeof UpdateQueuedMessageBody === "undefined" ? Object : UpdateQueuedMessageBody
|
|
4230
4786
|
]),
|
|
4231
|
-
|
|
4787
|
+
_ts_metadata16("design:returntype", Promise)
|
|
4232
4788
|
], QueueController.prototype, "update", null);
|
|
4233
|
-
|
|
4789
|
+
_ts_decorate18([
|
|
4234
4790
|
Post4("queue/:messageId/interrupt"),
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4791
|
+
_ts_param16(0, Req7()),
|
|
4792
|
+
_ts_param16(1, Param4("messageId")),
|
|
4793
|
+
_ts_metadata16("design:type", Function),
|
|
4794
|
+
_ts_metadata16("design:paramtypes", [
|
|
4239
4795
|
typeof Request === "undefined" ? Object : Request,
|
|
4240
4796
|
String
|
|
4241
4797
|
]),
|
|
4242
|
-
|
|
4798
|
+
_ts_metadata16("design:returntype", Promise)
|
|
4243
4799
|
], QueueController.prototype, "interrupt", null);
|
|
4244
|
-
|
|
4800
|
+
_ts_decorate18([
|
|
4245
4801
|
Delete2("queue/:messageId"),
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4802
|
+
_ts_param16(0, Req7()),
|
|
4803
|
+
_ts_param16(1, Param4("messageId")),
|
|
4804
|
+
_ts_metadata16("design:type", Function),
|
|
4805
|
+
_ts_metadata16("design:paramtypes", [
|
|
4250
4806
|
typeof Request === "undefined" ? Object : Request,
|
|
4251
4807
|
String
|
|
4252
4808
|
]),
|
|
4253
|
-
|
|
4809
|
+
_ts_metadata16("design:returntype", Promise)
|
|
4254
4810
|
], QueueController.prototype, "remove", null);
|
|
4255
|
-
QueueController =
|
|
4811
|
+
QueueController = _ts_decorate18([
|
|
4256
4812
|
Controller8(),
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4813
|
+
_ts_param16(1, Inject16(AGENT_ACTOR_RESOLVER7)),
|
|
4814
|
+
_ts_metadata16("design:type", Function),
|
|
4815
|
+
_ts_metadata16("design:paramtypes", [
|
|
4260
4816
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
4261
4817
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
4262
4818
|
])
|
|
@@ -4264,8 +4820,8 @@ QueueController = _ts_decorate16([
|
|
|
4264
4820
|
|
|
4265
4821
|
// src/controller/quota.controller.ts
|
|
4266
4822
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER8 } from "@dudousxd/nestjs-agent-core";
|
|
4267
|
-
import { Controller as Controller9, Get as Get8, Inject as
|
|
4268
|
-
function
|
|
4823
|
+
import { Controller as Controller9, Get as Get8, Inject as Inject17, Req as Req8 } from "@nestjs/common";
|
|
4824
|
+
function _ts_decorate19(decorators, target, key, desc) {
|
|
4269
4825
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4270
4826
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
4271
4827
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4278,19 +4834,19 @@ function _ts_decorate17(decorators, target, key, desc) {
|
|
|
4278
4834
|
}
|
|
4279
4835
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4280
4836
|
}
|
|
4281
|
-
__name(
|
|
4282
|
-
function
|
|
4837
|
+
__name(_ts_decorate19, "_ts_decorate");
|
|
4838
|
+
function _ts_metadata17(metadataKey, metadataValue) {
|
|
4283
4839
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
4284
4840
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
4285
4841
|
}
|
|
4286
4842
|
}
|
|
4287
|
-
__name(
|
|
4288
|
-
function
|
|
4843
|
+
__name(_ts_metadata17, "_ts_metadata");
|
|
4844
|
+
function _ts_param17(paramIndex, decorator) {
|
|
4289
4845
|
return function(target, key) {
|
|
4290
4846
|
decorator(target, key, paramIndex);
|
|
4291
4847
|
};
|
|
4292
4848
|
}
|
|
4293
|
-
__name(
|
|
4849
|
+
__name(_ts_param17, "_ts_param");
|
|
4294
4850
|
var QuotaController = class {
|
|
4295
4851
|
static {
|
|
4296
4852
|
__name(this, "QuotaController");
|
|
@@ -4310,20 +4866,20 @@ var QuotaController = class {
|
|
|
4310
4866
|
return this.agent.quotaReport(actor);
|
|
4311
4867
|
}
|
|
4312
4868
|
};
|
|
4313
|
-
|
|
4869
|
+
_ts_decorate19([
|
|
4314
4870
|
Get8(),
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4871
|
+
_ts_param17(0, Req8()),
|
|
4872
|
+
_ts_metadata17("design:type", Function),
|
|
4873
|
+
_ts_metadata17("design:paramtypes", [
|
|
4318
4874
|
typeof Request === "undefined" ? Object : Request
|
|
4319
4875
|
]),
|
|
4320
|
-
|
|
4876
|
+
_ts_metadata17("design:returntype", Promise)
|
|
4321
4877
|
], QuotaController.prototype, "report", null);
|
|
4322
|
-
QuotaController =
|
|
4878
|
+
QuotaController = _ts_decorate19([
|
|
4323
4879
|
Controller9("quota"),
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4880
|
+
_ts_param17(1, Inject17(AGENT_ACTOR_RESOLVER8)),
|
|
4881
|
+
_ts_metadata17("design:type", Function),
|
|
4882
|
+
_ts_metadata17("design:paramtypes", [
|
|
4327
4883
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
4328
4884
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
4329
4885
|
])
|
|
@@ -4331,8 +4887,8 @@ QuotaController = _ts_decorate17([
|
|
|
4331
4887
|
|
|
4332
4888
|
// src/controller/skills.controller.ts
|
|
4333
4889
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER9, AGENT_SKILLS as AGENT_SKILLS2, offerSkills } from "@dudousxd/nestjs-agent-core";
|
|
4334
|
-
import { Controller as Controller10, Get as Get9, Inject as
|
|
4335
|
-
function
|
|
4890
|
+
import { Controller as Controller10, Get as Get9, Inject as Inject18, Optional as Optional10, Query as Query4, Req as Req9 } from "@nestjs/common";
|
|
4891
|
+
function _ts_decorate20(decorators, target, key, desc) {
|
|
4336
4892
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4337
4893
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
4338
4894
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4345,19 +4901,19 @@ function _ts_decorate18(decorators, target, key, desc) {
|
|
|
4345
4901
|
}
|
|
4346
4902
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4347
4903
|
}
|
|
4348
|
-
__name(
|
|
4349
|
-
function
|
|
4904
|
+
__name(_ts_decorate20, "_ts_decorate");
|
|
4905
|
+
function _ts_metadata18(metadataKey, metadataValue) {
|
|
4350
4906
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
4351
4907
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
4352
4908
|
}
|
|
4353
4909
|
}
|
|
4354
|
-
__name(
|
|
4355
|
-
function
|
|
4910
|
+
__name(_ts_metadata18, "_ts_metadata");
|
|
4911
|
+
function _ts_param18(paramIndex, decorator) {
|
|
4356
4912
|
return function(target, key) {
|
|
4357
4913
|
decorator(target, key, paramIndex);
|
|
4358
4914
|
};
|
|
4359
4915
|
}
|
|
4360
|
-
__name(
|
|
4916
|
+
__name(_ts_param18, "_ts_param");
|
|
4361
4917
|
var SkillsController = class {
|
|
4362
4918
|
static {
|
|
4363
4919
|
__name(this, "SkillsController");
|
|
@@ -4380,24 +4936,24 @@ var SkillsController = class {
|
|
|
4380
4936
|
return offer.entries;
|
|
4381
4937
|
}
|
|
4382
4938
|
};
|
|
4383
|
-
|
|
4939
|
+
_ts_decorate20([
|
|
4384
4940
|
Get9(),
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4941
|
+
_ts_param18(0, Req9()),
|
|
4942
|
+
_ts_param18(1, Query4("threadId")),
|
|
4943
|
+
_ts_metadata18("design:type", Function),
|
|
4944
|
+
_ts_metadata18("design:paramtypes", [
|
|
4389
4945
|
typeof Request === "undefined" ? Object : Request,
|
|
4390
4946
|
String
|
|
4391
4947
|
]),
|
|
4392
|
-
|
|
4948
|
+
_ts_metadata18("design:returntype", Promise)
|
|
4393
4949
|
], SkillsController.prototype, "list", null);
|
|
4394
|
-
SkillsController =
|
|
4950
|
+
SkillsController = _ts_decorate20([
|
|
4395
4951
|
Controller10("skills"),
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4952
|
+
_ts_param18(0, Inject18(AGENT_ACTOR_RESOLVER9)),
|
|
4953
|
+
_ts_param18(1, Optional10()),
|
|
4954
|
+
_ts_param18(1, Inject18(AGENT_SKILLS2)),
|
|
4955
|
+
_ts_metadata18("design:type", Function),
|
|
4956
|
+
_ts_metadata18("design:paramtypes", [
|
|
4401
4957
|
typeof ActorResolver === "undefined" ? Object : ActorResolver,
|
|
4402
4958
|
Object
|
|
4403
4959
|
])
|
|
@@ -4405,8 +4961,8 @@ SkillsController = _ts_decorate18([
|
|
|
4405
4961
|
|
|
4406
4962
|
// src/controller/threads.controller.ts
|
|
4407
4963
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER10 } from "@dudousxd/nestjs-agent-core";
|
|
4408
|
-
import { Body as Body4, Controller as Controller11, Delete as Delete3, Get as Get10, Inject as
|
|
4409
|
-
function
|
|
4964
|
+
import { Body as Body4, Controller as Controller11, Delete as Delete3, Get as Get10, Inject as Inject19, Param as Param5, Patch as Patch2, Post as Post5, Req as Req10 } from "@nestjs/common";
|
|
4965
|
+
function _ts_decorate21(decorators, target, key, desc) {
|
|
4410
4966
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4411
4967
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
4412
4968
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4419,19 +4975,19 @@ function _ts_decorate19(decorators, target, key, desc) {
|
|
|
4419
4975
|
}
|
|
4420
4976
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4421
4977
|
}
|
|
4422
|
-
__name(
|
|
4423
|
-
function
|
|
4978
|
+
__name(_ts_decorate21, "_ts_decorate");
|
|
4979
|
+
function _ts_metadata19(metadataKey, metadataValue) {
|
|
4424
4980
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
4425
4981
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
4426
4982
|
}
|
|
4427
4983
|
}
|
|
4428
|
-
__name(
|
|
4429
|
-
function
|
|
4984
|
+
__name(_ts_metadata19, "_ts_metadata");
|
|
4985
|
+
function _ts_param19(paramIndex, decorator) {
|
|
4430
4986
|
return function(target, key) {
|
|
4431
4987
|
decorator(target, key, paramIndex);
|
|
4432
4988
|
};
|
|
4433
4989
|
}
|
|
4434
|
-
__name(
|
|
4990
|
+
__name(_ts_param19, "_ts_param");
|
|
4435
4991
|
var ThreadsController = class {
|
|
4436
4992
|
static {
|
|
4437
4993
|
__name(this, "ThreadsController");
|
|
@@ -4501,92 +5057,92 @@ var ThreadsController = class {
|
|
|
4501
5057
|
};
|
|
4502
5058
|
}
|
|
4503
5059
|
};
|
|
4504
|
-
|
|
5060
|
+
_ts_decorate21([
|
|
4505
5061
|
Get10(),
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
5062
|
+
_ts_param19(0, Req10()),
|
|
5063
|
+
_ts_metadata19("design:type", Function),
|
|
5064
|
+
_ts_metadata19("design:paramtypes", [
|
|
4509
5065
|
typeof Request === "undefined" ? Object : Request
|
|
4510
5066
|
]),
|
|
4511
|
-
|
|
5067
|
+
_ts_metadata19("design:returntype", Promise)
|
|
4512
5068
|
], ThreadsController.prototype, "list", null);
|
|
4513
|
-
|
|
5069
|
+
_ts_decorate21([
|
|
4514
5070
|
Get10(":id"),
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
5071
|
+
_ts_param19(0, Req10()),
|
|
5072
|
+
_ts_param19(1, Param5("id")),
|
|
5073
|
+
_ts_metadata19("design:type", Function),
|
|
5074
|
+
_ts_metadata19("design:paramtypes", [
|
|
4519
5075
|
typeof Request === "undefined" ? Object : Request,
|
|
4520
5076
|
String
|
|
4521
5077
|
]),
|
|
4522
|
-
|
|
5078
|
+
_ts_metadata19("design:returntype", Promise)
|
|
4523
5079
|
], ThreadsController.prototype, "detail", null);
|
|
4524
|
-
|
|
5080
|
+
_ts_decorate21([
|
|
4525
5081
|
Delete3(":id"),
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
5082
|
+
_ts_param19(0, Req10()),
|
|
5083
|
+
_ts_param19(1, Param5("id")),
|
|
5084
|
+
_ts_metadata19("design:type", Function),
|
|
5085
|
+
_ts_metadata19("design:paramtypes", [
|
|
4530
5086
|
typeof Request === "undefined" ? Object : Request,
|
|
4531
5087
|
String
|
|
4532
5088
|
]),
|
|
4533
|
-
|
|
5089
|
+
_ts_metadata19("design:returntype", Promise)
|
|
4534
5090
|
], ThreadsController.prototype, "remove", null);
|
|
4535
|
-
|
|
5091
|
+
_ts_decorate21([
|
|
4536
5092
|
Post5(":id/fork-from/:messageId"),
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
5093
|
+
_ts_param19(0, Req10()),
|
|
5094
|
+
_ts_param19(1, Param5("id")),
|
|
5095
|
+
_ts_param19(2, Param5("messageId")),
|
|
5096
|
+
_ts_metadata19("design:type", Function),
|
|
5097
|
+
_ts_metadata19("design:paramtypes", [
|
|
4542
5098
|
typeof Request === "undefined" ? Object : Request,
|
|
4543
5099
|
String,
|
|
4544
5100
|
String
|
|
4545
5101
|
]),
|
|
4546
|
-
|
|
5102
|
+
_ts_metadata19("design:returntype", Promise)
|
|
4547
5103
|
], ThreadsController.prototype, "fork", null);
|
|
4548
|
-
|
|
5104
|
+
_ts_decorate21([
|
|
4549
5105
|
Patch2(":id"),
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
5106
|
+
_ts_param19(0, Req10()),
|
|
5107
|
+
_ts_param19(1, Param5("id")),
|
|
5108
|
+
_ts_param19(2, Body4()),
|
|
5109
|
+
_ts_metadata19("design:type", Function),
|
|
5110
|
+
_ts_metadata19("design:paramtypes", [
|
|
4555
5111
|
typeof Request === "undefined" ? Object : Request,
|
|
4556
5112
|
String,
|
|
4557
5113
|
typeof UpdateThreadBody === "undefined" ? Object : UpdateThreadBody
|
|
4558
5114
|
]),
|
|
4559
|
-
|
|
5115
|
+
_ts_metadata19("design:returntype", Promise)
|
|
4560
5116
|
], ThreadsController.prototype, "update", null);
|
|
4561
|
-
|
|
5117
|
+
_ts_decorate21([
|
|
4562
5118
|
Post5(":id/promote"),
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
5119
|
+
_ts_param19(0, Req10()),
|
|
5120
|
+
_ts_param19(1, Param5("id")),
|
|
5121
|
+
_ts_metadata19("design:type", Function),
|
|
5122
|
+
_ts_metadata19("design:paramtypes", [
|
|
4567
5123
|
typeof Request === "undefined" ? Object : Request,
|
|
4568
5124
|
String
|
|
4569
5125
|
]),
|
|
4570
|
-
|
|
5126
|
+
_ts_metadata19("design:returntype", Promise)
|
|
4571
5127
|
], ThreadsController.prototype, "promote", null);
|
|
4572
|
-
|
|
4573
|
-
Delete3(":id/from/:messageId"),
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
5128
|
+
_ts_decorate21([
|
|
5129
|
+
Delete3(":id/from/:messageId"),
|
|
5130
|
+
_ts_param19(0, Req10()),
|
|
5131
|
+
_ts_param19(1, Param5("id")),
|
|
5132
|
+
_ts_param19(2, Param5("messageId")),
|
|
5133
|
+
_ts_metadata19("design:type", Function),
|
|
5134
|
+
_ts_metadata19("design:paramtypes", [
|
|
4579
5135
|
typeof Request === "undefined" ? Object : Request,
|
|
4580
5136
|
String,
|
|
4581
5137
|
String
|
|
4582
5138
|
]),
|
|
4583
|
-
|
|
5139
|
+
_ts_metadata19("design:returntype", Promise)
|
|
4584
5140
|
], ThreadsController.prototype, "truncateFrom", null);
|
|
4585
|
-
ThreadsController =
|
|
5141
|
+
ThreadsController = _ts_decorate21([
|
|
4586
5142
|
Controller11("threads"),
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
5143
|
+
_ts_param19(1, Inject19(AGENT_ACTOR_RESOLVER10)),
|
|
5144
|
+
_ts_metadata19("design:type", Function),
|
|
5145
|
+
_ts_metadata19("design:paramtypes", [
|
|
4590
5146
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
4591
5147
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
4592
5148
|
])
|
|
@@ -4594,8 +5150,8 @@ ThreadsController = _ts_decorate19([
|
|
|
4594
5150
|
|
|
4595
5151
|
// src/controller/tool-call.controller.ts
|
|
4596
5152
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER11 } from "@dudousxd/nestjs-agent-core";
|
|
4597
|
-
import { BadRequestException as BadRequestException6, Body as Body5, Controller as Controller12, Inject as
|
|
4598
|
-
function
|
|
5153
|
+
import { BadRequestException as BadRequestException6, Body as Body5, Controller as Controller12, Inject as Inject20, Post as Post6, Req as Req11 } from "@nestjs/common";
|
|
5154
|
+
function _ts_decorate22(decorators, target, key, desc) {
|
|
4599
5155
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4600
5156
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
4601
5157
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4608,19 +5164,19 @@ function _ts_decorate20(decorators, target, key, desc) {
|
|
|
4608
5164
|
}
|
|
4609
5165
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4610
5166
|
}
|
|
4611
|
-
__name(
|
|
4612
|
-
function
|
|
5167
|
+
__name(_ts_decorate22, "_ts_decorate");
|
|
5168
|
+
function _ts_metadata20(metadataKey, metadataValue) {
|
|
4613
5169
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
4614
5170
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
4615
5171
|
}
|
|
4616
5172
|
}
|
|
4617
|
-
__name(
|
|
4618
|
-
function
|
|
5173
|
+
__name(_ts_metadata20, "_ts_metadata");
|
|
5174
|
+
function _ts_param20(paramIndex, decorator) {
|
|
4619
5175
|
return function(target, key) {
|
|
4620
5176
|
decorator(target, key, paramIndex);
|
|
4621
5177
|
};
|
|
4622
5178
|
}
|
|
4623
|
-
__name(
|
|
5179
|
+
__name(_ts_param20, "_ts_param");
|
|
4624
5180
|
var MAX_ANSWERED_QUESTIONS = 100;
|
|
4625
5181
|
var MAX_VALUES_PER_QUESTION = 100;
|
|
4626
5182
|
var MAX_ANSWER_VALUE_LENGTH = 4096;
|
|
@@ -4753,55 +5309,55 @@ var ToolCallController = class {
|
|
|
4753
5309
|
};
|
|
4754
5310
|
}
|
|
4755
5311
|
};
|
|
4756
|
-
|
|
5312
|
+
_ts_decorate22([
|
|
4757
5313
|
Post6("approve"),
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
5314
|
+
_ts_param20(0, Req11()),
|
|
5315
|
+
_ts_param20(1, Body5()),
|
|
5316
|
+
_ts_metadata20("design:type", Function),
|
|
5317
|
+
_ts_metadata20("design:paramtypes", [
|
|
4762
5318
|
typeof Request === "undefined" ? Object : Request,
|
|
4763
5319
|
typeof ApproveBody === "undefined" ? Object : ApproveBody
|
|
4764
5320
|
]),
|
|
4765
|
-
|
|
5321
|
+
_ts_metadata20("design:returntype", Promise)
|
|
4766
5322
|
], ToolCallController.prototype, "approve", null);
|
|
4767
|
-
|
|
5323
|
+
_ts_decorate22([
|
|
4768
5324
|
Post6("reject"),
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
5325
|
+
_ts_param20(0, Req11()),
|
|
5326
|
+
_ts_param20(1, Body5()),
|
|
5327
|
+
_ts_metadata20("design:type", Function),
|
|
5328
|
+
_ts_metadata20("design:paramtypes", [
|
|
4773
5329
|
typeof Request === "undefined" ? Object : Request,
|
|
4774
5330
|
typeof RejectBody === "undefined" ? Object : RejectBody
|
|
4775
5331
|
]),
|
|
4776
|
-
|
|
5332
|
+
_ts_metadata20("design:returntype", Promise)
|
|
4777
5333
|
], ToolCallController.prototype, "reject", null);
|
|
4778
|
-
|
|
5334
|
+
_ts_decorate22([
|
|
4779
5335
|
Post6("answer"),
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
5336
|
+
_ts_param20(0, Req11()),
|
|
5337
|
+
_ts_param20(1, Body5()),
|
|
5338
|
+
_ts_metadata20("design:type", Function),
|
|
5339
|
+
_ts_metadata20("design:paramtypes", [
|
|
4784
5340
|
typeof Request === "undefined" ? Object : Request,
|
|
4785
5341
|
typeof AnswerBody === "undefined" ? Object : AnswerBody
|
|
4786
5342
|
]),
|
|
4787
|
-
|
|
5343
|
+
_ts_metadata20("design:returntype", Promise)
|
|
4788
5344
|
], ToolCallController.prototype, "answer", null);
|
|
4789
|
-
|
|
5345
|
+
_ts_decorate22([
|
|
4790
5346
|
Post6("skip"),
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
5347
|
+
_ts_param20(0, Req11()),
|
|
5348
|
+
_ts_param20(1, Body5()),
|
|
5349
|
+
_ts_metadata20("design:type", Function),
|
|
5350
|
+
_ts_metadata20("design:paramtypes", [
|
|
4795
5351
|
typeof Request === "undefined" ? Object : Request,
|
|
4796
5352
|
Object
|
|
4797
5353
|
]),
|
|
4798
|
-
|
|
5354
|
+
_ts_metadata20("design:returntype", Promise)
|
|
4799
5355
|
], ToolCallController.prototype, "skip", null);
|
|
4800
|
-
ToolCallController =
|
|
5356
|
+
ToolCallController = _ts_decorate22([
|
|
4801
5357
|
Controller12("tool-call"),
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
5358
|
+
_ts_param20(1, Inject20(AGENT_ACTOR_RESOLVER11)),
|
|
5359
|
+
_ts_metadata20("design:type", Function),
|
|
5360
|
+
_ts_metadata20("design:paramtypes", [
|
|
4805
5361
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
4806
5362
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
4807
5363
|
])
|
|
@@ -4809,8 +5365,8 @@ ToolCallController = _ts_decorate20([
|
|
|
4809
5365
|
|
|
4810
5366
|
// src/controller/tools.controller.ts
|
|
4811
5367
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER12, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY6, AGENT_REGISTRY as AGENT_REGISTRY3, ALL_AGENTS, AgentRegistry as AgentRegistry4 } from "@dudousxd/nestjs-agent-core";
|
|
4812
|
-
import { Controller as Controller13, Get as Get11, Inject as
|
|
4813
|
-
function
|
|
5368
|
+
import { Controller as Controller13, Get as Get11, Inject as Inject21, NotFoundException as NotFoundException4, Query as Query5, Req as Req12 } from "@nestjs/common";
|
|
5369
|
+
function _ts_decorate23(decorators, target, key, desc) {
|
|
4814
5370
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4815
5371
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
4816
5372
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4823,19 +5379,19 @@ function _ts_decorate21(decorators, target, key, desc) {
|
|
|
4823
5379
|
}
|
|
4824
5380
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4825
5381
|
}
|
|
4826
|
-
__name(
|
|
4827
|
-
function
|
|
5382
|
+
__name(_ts_decorate23, "_ts_decorate");
|
|
5383
|
+
function _ts_metadata21(metadataKey, metadataValue) {
|
|
4828
5384
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
4829
5385
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
4830
5386
|
}
|
|
4831
5387
|
}
|
|
4832
|
-
__name(
|
|
4833
|
-
function
|
|
5388
|
+
__name(_ts_metadata21, "_ts_metadata");
|
|
5389
|
+
function _ts_param21(paramIndex, decorator) {
|
|
4834
5390
|
return function(target, key) {
|
|
4835
5391
|
decorator(target, key, paramIndex);
|
|
4836
5392
|
};
|
|
4837
5393
|
}
|
|
4838
|
-
__name(
|
|
5394
|
+
__name(_ts_param21, "_ts_param");
|
|
4839
5395
|
var ToolsController = class {
|
|
4840
5396
|
static {
|
|
4841
5397
|
__name(this, "ToolsController");
|
|
@@ -4850,7 +5406,7 @@ var ToolsController = class {
|
|
|
4850
5406
|
}
|
|
4851
5407
|
async list(req, agent) {
|
|
4852
5408
|
if (agent !== void 0 && agent !== ALL_AGENTS && this.agents.get(agent) === void 0) {
|
|
4853
|
-
throw new
|
|
5409
|
+
throw new NotFoundException4(`No agent named "${agent}"`);
|
|
4854
5410
|
}
|
|
4855
5411
|
const actor = await this.actorResolver.resolve(req);
|
|
4856
5412
|
const names = agent === ALL_AGENTS ? [
|
|
@@ -4879,24 +5435,24 @@ var ToolsController = class {
|
|
|
4879
5435
|
];
|
|
4880
5436
|
}
|
|
4881
5437
|
};
|
|
4882
|
-
|
|
5438
|
+
_ts_decorate23([
|
|
4883
5439
|
Get11(),
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
5440
|
+
_ts_param21(0, Req12()),
|
|
5441
|
+
_ts_param21(1, Query5("agent")),
|
|
5442
|
+
_ts_metadata21("design:type", Function),
|
|
5443
|
+
_ts_metadata21("design:paramtypes", [
|
|
4888
5444
|
typeof Request === "undefined" ? Object : Request,
|
|
4889
5445
|
String
|
|
4890
5446
|
]),
|
|
4891
|
-
|
|
5447
|
+
_ts_metadata21("design:returntype", Promise)
|
|
4892
5448
|
], ToolsController.prototype, "list", null);
|
|
4893
|
-
ToolsController =
|
|
5449
|
+
ToolsController = _ts_decorate23([
|
|
4894
5450
|
Controller13("tools"),
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
5451
|
+
_ts_param21(0, Inject21(AGENT_ACTOR_RESOLVER12)),
|
|
5452
|
+
_ts_param21(1, Inject21(AGENT_DEPS_FACTORY6)),
|
|
5453
|
+
_ts_param21(2, Inject21(AGENT_REGISTRY3)),
|
|
5454
|
+
_ts_metadata21("design:type", Function),
|
|
5455
|
+
_ts_metadata21("design:paramtypes", [
|
|
4900
5456
|
typeof ActorResolver === "undefined" ? Object : ActorResolver,
|
|
4901
5457
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
4902
5458
|
typeof AgentRegistry4 === "undefined" ? Object : AgentRegistry4
|
|
@@ -4905,7 +5461,7 @@ ToolsController = _ts_decorate21([
|
|
|
4905
5461
|
|
|
4906
5462
|
// src/discovery/agent-discovery.service.ts
|
|
4907
5463
|
import { AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS2, AGENT_REGISTRY as AGENT_REGISTRY4, AgentRegistry as AgentRegistry5 } from "@dudousxd/nestjs-agent-core";
|
|
4908
|
-
import { Inject as
|
|
5464
|
+
import { Inject as Inject22, Injectable as Injectable9, Logger as Logger4 } from "@nestjs/common";
|
|
4909
5465
|
import { DiscoveryService, MetadataScanner } from "@nestjs/core";
|
|
4910
5466
|
|
|
4911
5467
|
// src/decorator/agent.decorator.ts
|
|
@@ -4922,7 +5478,7 @@ var SYSTEM_PROMPT_METADATA = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:
|
|
|
4922
5478
|
var SYSTEM_PROMPT_CONTRIBUTOR_METADATA = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:system-prompt-contributor");
|
|
4923
5479
|
|
|
4924
5480
|
// src/discovery/agent-discovery.service.ts
|
|
4925
|
-
function
|
|
5481
|
+
function _ts_decorate24(decorators, target, key, desc) {
|
|
4926
5482
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4927
5483
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
4928
5484
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4935,19 +5491,19 @@ function _ts_decorate22(decorators, target, key, desc) {
|
|
|
4935
5491
|
}
|
|
4936
5492
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4937
5493
|
}
|
|
4938
|
-
__name(
|
|
4939
|
-
function
|
|
5494
|
+
__name(_ts_decorate24, "_ts_decorate");
|
|
5495
|
+
function _ts_metadata22(metadataKey, metadataValue) {
|
|
4940
5496
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
4941
5497
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
4942
5498
|
}
|
|
4943
5499
|
}
|
|
4944
|
-
__name(
|
|
4945
|
-
function
|
|
5500
|
+
__name(_ts_metadata22, "_ts_metadata");
|
|
5501
|
+
function _ts_param22(paramIndex, decorator) {
|
|
4946
5502
|
return function(target, key) {
|
|
4947
5503
|
decorator(target, key, paramIndex);
|
|
4948
5504
|
};
|
|
4949
5505
|
}
|
|
4950
|
-
__name(
|
|
5506
|
+
__name(_ts_param22, "_ts_param");
|
|
4951
5507
|
var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
4952
5508
|
static {
|
|
4953
5509
|
__name(this, "AgentDiscoveryService");
|
|
@@ -5113,12 +5669,12 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
5113
5669
|
return (ctx) => candidate.call(instance, ctx);
|
|
5114
5670
|
}
|
|
5115
5671
|
};
|
|
5116
|
-
AgentDiscoveryService =
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5672
|
+
AgentDiscoveryService = _ts_decorate24([
|
|
5673
|
+
Injectable9(),
|
|
5674
|
+
_ts_param22(2, Inject22(AGENT_REGISTRY4)),
|
|
5675
|
+
_ts_param22(3, Inject22(AGENT_PROMPT_CONTRIBUTORS2)),
|
|
5676
|
+
_ts_metadata22("design:type", Function),
|
|
5677
|
+
_ts_metadata22("design:paramtypes", [
|
|
5122
5678
|
typeof DiscoveryService === "undefined" ? Object : DiscoveryService,
|
|
5123
5679
|
typeof MetadataScanner === "undefined" ? Object : MetadataScanner,
|
|
5124
5680
|
typeof AgentRegistry5 === "undefined" ? Object : AgentRegistry5,
|
|
@@ -5127,8 +5683,8 @@ AgentDiscoveryService = _ts_decorate22([
|
|
|
5127
5683
|
], AgentDiscoveryService);
|
|
5128
5684
|
|
|
5129
5685
|
// src/discovery/ai-tool-discovery.service.ts
|
|
5130
|
-
import { AGENT_OPTIONS as
|
|
5131
|
-
import { Inject as
|
|
5686
|
+
import { AGENT_OPTIONS as AGENT_OPTIONS7, AGENT_REGISTRY as AGENT_REGISTRY5, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY2, normalizeDelegation as normalizeDelegation2 } from "@dudousxd/nestjs-agent-core";
|
|
5687
|
+
import { Inject as Inject23, Injectable as Injectable10, Logger as Logger5 } from "@nestjs/common";
|
|
5132
5688
|
import { DiscoveryService as DiscoveryService2 } from "@nestjs/core";
|
|
5133
5689
|
import { z } from "zod";
|
|
5134
5690
|
|
|
@@ -5140,15 +5696,8 @@ function readAiToolMetadata(target) {
|
|
|
5140
5696
|
}
|
|
5141
5697
|
__name(readAiToolMetadata, "readAiToolMetadata");
|
|
5142
5698
|
|
|
5143
|
-
// src/functional-tool.ts
|
|
5144
|
-
var AGENT_TOOL_BRAND = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:functional-tool");
|
|
5145
|
-
function isBrandedFunctionalTool(value) {
|
|
5146
|
-
return AGENT_TOOL_BRAND in value && "spec" in value && "handler" in value;
|
|
5147
|
-
}
|
|
5148
|
-
__name(isBrandedFunctionalTool, "isBrandedFunctionalTool");
|
|
5149
|
-
|
|
5150
5699
|
// src/discovery/ai-tool-discovery.service.ts
|
|
5151
|
-
function
|
|
5700
|
+
function _ts_decorate25(decorators, target, key, desc) {
|
|
5152
5701
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5153
5702
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
5154
5703
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -5161,19 +5710,19 @@ function _ts_decorate23(decorators, target, key, desc) {
|
|
|
5161
5710
|
}
|
|
5162
5711
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5163
5712
|
}
|
|
5164
|
-
__name(
|
|
5165
|
-
function
|
|
5713
|
+
__name(_ts_decorate25, "_ts_decorate");
|
|
5714
|
+
function _ts_metadata23(metadataKey, metadataValue) {
|
|
5166
5715
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
5167
5716
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
5168
5717
|
}
|
|
5169
5718
|
}
|
|
5170
|
-
__name(
|
|
5171
|
-
function
|
|
5719
|
+
__name(_ts_metadata23, "_ts_metadata");
|
|
5720
|
+
function _ts_param23(paramIndex, decorator) {
|
|
5172
5721
|
return function(target, key) {
|
|
5173
5722
|
decorator(target, key, paramIndex);
|
|
5174
5723
|
};
|
|
5175
5724
|
}
|
|
5176
|
-
__name(
|
|
5725
|
+
__name(_ts_param23, "_ts_param");
|
|
5177
5726
|
var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
5178
5727
|
static {
|
|
5179
5728
|
__name(this, "AiToolDiscoveryService");
|
|
@@ -5241,9 +5790,18 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
5241
5790
|
} : {},
|
|
5242
5791
|
...meta.terminal === true ? {
|
|
5243
5792
|
terminal: true
|
|
5793
|
+
} : {},
|
|
5794
|
+
...meta.replacementKey !== void 0 ? {
|
|
5795
|
+
replacementKey: meta.replacementKey
|
|
5244
5796
|
} : {}
|
|
5245
5797
|
}, {
|
|
5246
5798
|
execute: /* @__PURE__ */ __name((input, ctx) => instance.execute(input, ctx), "execute"),
|
|
5799
|
+
...typeof handler.present === "function" ? {
|
|
5800
|
+
present: /* @__PURE__ */ __name((output, ctx) => instance.present(output, ctx), "present")
|
|
5801
|
+
} : {},
|
|
5802
|
+
...typeof handler.preflight === "function" ? {
|
|
5803
|
+
preflight: /* @__PURE__ */ __name((input, ctx, options) => instance.preflight(input, ctx, options), "preflight")
|
|
5804
|
+
} : {},
|
|
5247
5805
|
// Forwarded, not copied: the registry holds this wrapper rather than the provider, so an
|
|
5248
5806
|
// `isEnabled()`/`canUse()` left behind here would be a gate that silently never applies.
|
|
5249
5807
|
// Called through `instance` so each keeps its `this` (and its injected deps).
|
|
@@ -5317,13 +5875,13 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
5317
5875
|
return true;
|
|
5318
5876
|
}
|
|
5319
5877
|
};
|
|
5320
|
-
AiToolDiscoveryService =
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5878
|
+
AiToolDiscoveryService = _ts_decorate25([
|
|
5879
|
+
Injectable10(),
|
|
5880
|
+
_ts_param23(1, Inject23(AGENT_TOOL_REGISTRY2)),
|
|
5881
|
+
_ts_param23(2, Inject23(AGENT_REGISTRY5)),
|
|
5882
|
+
_ts_param23(3, Inject23(AGENT_OPTIONS7)),
|
|
5883
|
+
_ts_metadata23("design:type", Function),
|
|
5884
|
+
_ts_metadata23("design:paramtypes", [
|
|
5327
5885
|
typeof DiscoveryService2 === "undefined" ? Object : DiscoveryService2,
|
|
5328
5886
|
typeof ToolRegistry === "undefined" ? Object : ToolRegistry,
|
|
5329
5887
|
typeof AgentRegistry === "undefined" ? Object : AgentRegistry,
|
|
@@ -5333,7 +5891,7 @@ AiToolDiscoveryService = _ts_decorate23([
|
|
|
5333
5891
|
|
|
5334
5892
|
// src/discovery/skill-discovery.service.ts
|
|
5335
5893
|
import { AGENT_SKILL_SOURCES } from "@dudousxd/nestjs-agent-core";
|
|
5336
|
-
import { Inject as
|
|
5894
|
+
import { Inject as Inject24, Injectable as Injectable11, Logger as Logger6 } from "@nestjs/common";
|
|
5337
5895
|
import { DiscoveryService as DiscoveryService3 } from "@nestjs/core";
|
|
5338
5896
|
|
|
5339
5897
|
// src/decorator/skill.decorator.ts
|
|
@@ -5350,7 +5908,7 @@ function skillScope(options) {
|
|
|
5350
5908
|
__name(skillScope, "skillScope");
|
|
5351
5909
|
|
|
5352
5910
|
// src/discovery/skill-discovery.service.ts
|
|
5353
|
-
function
|
|
5911
|
+
function _ts_decorate26(decorators, target, key, desc) {
|
|
5354
5912
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5355
5913
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
5356
5914
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -5363,19 +5921,19 @@ function _ts_decorate24(decorators, target, key, desc) {
|
|
|
5363
5921
|
}
|
|
5364
5922
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5365
5923
|
}
|
|
5366
|
-
__name(
|
|
5367
|
-
function
|
|
5924
|
+
__name(_ts_decorate26, "_ts_decorate");
|
|
5925
|
+
function _ts_metadata24(metadataKey, metadataValue) {
|
|
5368
5926
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
5369
5927
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
5370
5928
|
}
|
|
5371
5929
|
}
|
|
5372
|
-
__name(
|
|
5373
|
-
function
|
|
5930
|
+
__name(_ts_metadata24, "_ts_metadata");
|
|
5931
|
+
function _ts_param24(paramIndex, decorator) {
|
|
5374
5932
|
return function(target, key) {
|
|
5375
5933
|
decorator(target, key, paramIndex);
|
|
5376
5934
|
};
|
|
5377
5935
|
}
|
|
5378
|
-
__name(
|
|
5936
|
+
__name(_ts_param24, "_ts_param");
|
|
5379
5937
|
var SkillDiscoveryService = class _SkillDiscoveryService {
|
|
5380
5938
|
static {
|
|
5381
5939
|
__name(this, "SkillDiscoveryService");
|
|
@@ -5419,11 +5977,11 @@ var SkillDiscoveryService = class _SkillDiscoveryService {
|
|
|
5419
5977
|
return flat === void 0 ? void 0 : () => flat;
|
|
5420
5978
|
}
|
|
5421
5979
|
};
|
|
5422
|
-
SkillDiscoveryService =
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5980
|
+
SkillDiscoveryService = _ts_decorate26([
|
|
5981
|
+
Injectable11(),
|
|
5982
|
+
_ts_param24(1, Inject24(AGENT_SKILL_SOURCES)),
|
|
5983
|
+
_ts_metadata24("design:type", Function),
|
|
5984
|
+
_ts_metadata24("design:paramtypes", [
|
|
5427
5985
|
typeof DiscoveryService3 === "undefined" ? Object : DiscoveryService3,
|
|
5428
5986
|
Array
|
|
5429
5987
|
])
|
|
@@ -5491,10 +6049,245 @@ var LedgerQuotaProvider = class {
|
|
|
5491
6049
|
}
|
|
5492
6050
|
};
|
|
5493
6051
|
|
|
6052
|
+
// src/proposals/action-proposal-worker.service.ts
|
|
6053
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
6054
|
+
import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY7, AGENT_OPTIONS as AGENT_OPTIONS8, AGENT_STORE as AGENT_STORE7, ActionProposalExecutor, ActionProposalWorker, assertIndependentActionCapabilities as assertIndependentActionCapabilities2 } from "@dudousxd/nestjs-agent-core";
|
|
6055
|
+
import { Inject as Inject25, Injectable as Injectable12, Logger as Logger7 } from "@nestjs/common";
|
|
6056
|
+
function _ts_decorate27(decorators, target, key, desc) {
|
|
6057
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6058
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
6059
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
6060
|
+
} else {
|
|
6061
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
6062
|
+
if (d = decorators[i]) {
|
|
6063
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6064
|
+
}
|
|
6065
|
+
}
|
|
6066
|
+
}
|
|
6067
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6068
|
+
}
|
|
6069
|
+
__name(_ts_decorate27, "_ts_decorate");
|
|
6070
|
+
function _ts_metadata25(metadataKey, metadataValue) {
|
|
6071
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
6072
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
6073
|
+
}
|
|
6074
|
+
}
|
|
6075
|
+
__name(_ts_metadata25, "_ts_metadata");
|
|
6076
|
+
function _ts_param25(paramIndex, decorator) {
|
|
6077
|
+
return function(target, key) {
|
|
6078
|
+
decorator(target, key, paramIndex);
|
|
6079
|
+
};
|
|
6080
|
+
}
|
|
6081
|
+
__name(_ts_param25, "_ts_param");
|
|
6082
|
+
var ActionProposalWorkerService = class _ActionProposalWorkerService {
|
|
6083
|
+
static {
|
|
6084
|
+
__name(this, "ActionProposalWorkerService");
|
|
6085
|
+
}
|
|
6086
|
+
store;
|
|
6087
|
+
options;
|
|
6088
|
+
deps;
|
|
6089
|
+
worker;
|
|
6090
|
+
logger = new Logger7(_ActionProposalWorkerService.name);
|
|
6091
|
+
constructor(store, options, deps) {
|
|
6092
|
+
this.store = store;
|
|
6093
|
+
this.options = options;
|
|
6094
|
+
this.deps = deps;
|
|
6095
|
+
}
|
|
6096
|
+
onModuleInit() {
|
|
6097
|
+
if (this.options.actionApprovalMode !== "independent") return;
|
|
6098
|
+
assertIndependentActionCapabilities2(this.store, this.options.backgroundActorResolver);
|
|
6099
|
+
if (this.options.surface === "http") return;
|
|
6100
|
+
const resolver = this.options.backgroundActorResolver;
|
|
6101
|
+
if (!resolver) throw new Error("BackgroundActorResolver is required");
|
|
6102
|
+
this.worker = new ActionProposalWorker({
|
|
6103
|
+
store: this.store,
|
|
6104
|
+
workerId: randomUUID2(),
|
|
6105
|
+
...this.options.actionProposalWorker,
|
|
6106
|
+
executor: new ActionProposalExecutor({
|
|
6107
|
+
resolver,
|
|
6108
|
+
resolveExecution: /* @__PURE__ */ __name(async (proposal, actor) => {
|
|
6109
|
+
const deps = this.deps.forProposal(proposal, actor);
|
|
6110
|
+
return {
|
|
6111
|
+
registry: deps.registry,
|
|
6112
|
+
rolesPolicy: deps.rolesPolicy,
|
|
6113
|
+
...deps.resolveUiCatalog !== void 0 ? {
|
|
6114
|
+
resolveUiCatalog: deps.resolveUiCatalog
|
|
6115
|
+
} : {},
|
|
6116
|
+
...deps.toolAllowList !== void 0 ? {
|
|
6117
|
+
allowedTools: deps.toolAllowList
|
|
6118
|
+
} : {}
|
|
6119
|
+
};
|
|
6120
|
+
}, "resolveExecution")
|
|
6121
|
+
}),
|
|
6122
|
+
onError: /* @__PURE__ */ __name((error) => this.logger.error(error), "onError")
|
|
6123
|
+
});
|
|
6124
|
+
this.worker.start();
|
|
6125
|
+
}
|
|
6126
|
+
async onModuleDestroy() {
|
|
6127
|
+
await this.worker?.stop();
|
|
6128
|
+
}
|
|
6129
|
+
};
|
|
6130
|
+
ActionProposalWorkerService = _ts_decorate27([
|
|
6131
|
+
Injectable12(),
|
|
6132
|
+
_ts_param25(0, Inject25(AGENT_STORE7)),
|
|
6133
|
+
_ts_param25(1, Inject25(AGENT_OPTIONS8)),
|
|
6134
|
+
_ts_param25(2, Inject25(AGENT_DEPS_FACTORY7)),
|
|
6135
|
+
_ts_metadata25("design:type", Function),
|
|
6136
|
+
_ts_metadata25("design:paramtypes", [
|
|
6137
|
+
typeof AgentStore === "undefined" ? Object : AgentStore,
|
|
6138
|
+
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
6139
|
+
typeof AgentDepsFactory2 === "undefined" ? Object : AgentDepsFactory2
|
|
6140
|
+
])
|
|
6141
|
+
], ActionProposalWorkerService);
|
|
6142
|
+
|
|
6143
|
+
// src/proposals/action-proposal.controller.ts
|
|
6144
|
+
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER13, validateActionProposalListQuery } from "@dudousxd/nestjs-agent-core";
|
|
6145
|
+
import { BadRequestException as BadRequestException7, Body as Body6, Controller as Controller14, Get as Get12, Inject as Inject26, Param as Param6, Post as Post7, Query as Query6, Req as Req13, Res as Res2 } from "@nestjs/common";
|
|
6146
|
+
function _ts_decorate28(decorators, target, key, desc) {
|
|
6147
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6148
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
6149
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
6150
|
+
} else {
|
|
6151
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
6152
|
+
if (d = decorators[i]) {
|
|
6153
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6154
|
+
}
|
|
6155
|
+
}
|
|
6156
|
+
}
|
|
6157
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6158
|
+
}
|
|
6159
|
+
__name(_ts_decorate28, "_ts_decorate");
|
|
6160
|
+
function _ts_metadata26(metadataKey, metadataValue) {
|
|
6161
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
6162
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
6163
|
+
}
|
|
6164
|
+
}
|
|
6165
|
+
__name(_ts_metadata26, "_ts_metadata");
|
|
6166
|
+
function _ts_param26(paramIndex, decorator) {
|
|
6167
|
+
return function(target, key) {
|
|
6168
|
+
decorator(target, key, paramIndex);
|
|
6169
|
+
};
|
|
6170
|
+
}
|
|
6171
|
+
__name(_ts_param26, "_ts_param");
|
|
6172
|
+
function bodyFields(body, field) {
|
|
6173
|
+
if (body === void 0) return {};
|
|
6174
|
+
if (typeof body !== "object" || body === null || Array.isArray(body) || Object.keys(body).some((key) => key !== field)) throw new BadRequestException7(`Only ${field} is accepted`);
|
|
6175
|
+
const value = body;
|
|
6176
|
+
if (value[field] !== void 0 && (field === "remember" && typeof value[field] !== "boolean" || field === "reason" && typeof value[field] !== "string")) throw new BadRequestException7(`Invalid ${field}`);
|
|
6177
|
+
return value;
|
|
6178
|
+
}
|
|
6179
|
+
__name(bodyFields, "bodyFields");
|
|
6180
|
+
var ActionProposalController = class {
|
|
6181
|
+
static {
|
|
6182
|
+
__name(this, "ActionProposalController");
|
|
6183
|
+
}
|
|
6184
|
+
proposals;
|
|
6185
|
+
actors;
|
|
6186
|
+
constructor(proposals, actors) {
|
|
6187
|
+
this.proposals = proposals;
|
|
6188
|
+
this.actors = actors;
|
|
6189
|
+
}
|
|
6190
|
+
async list(threadId, request, cursor, response) {
|
|
6191
|
+
let query = {};
|
|
6192
|
+
if (cursor !== void 0) {
|
|
6193
|
+
try {
|
|
6194
|
+
if (typeof cursor !== "string") throw new Error("Invalid cursor");
|
|
6195
|
+
query = {
|
|
6196
|
+
after: JSON.parse(cursor)
|
|
6197
|
+
};
|
|
6198
|
+
validateActionProposalListQuery(query);
|
|
6199
|
+
} catch {
|
|
6200
|
+
throw new BadRequestException7("Invalid action proposal cursor");
|
|
6201
|
+
}
|
|
6202
|
+
}
|
|
6203
|
+
const page = await this.proposals.listPage(threadId, await this.actors.resolve(request), query);
|
|
6204
|
+
if (page.next) {
|
|
6205
|
+
response.setHeader("X-Action-Proposals-Next", encodeURIComponent(JSON.stringify(page.next)));
|
|
6206
|
+
const exposed = response.getHeader("Access-Control-Expose-Headers");
|
|
6207
|
+
response.setHeader("Access-Control-Expose-Headers", `${exposed === void 0 ? "" : `${String(exposed)}, `}X-Action-Proposals-Next`);
|
|
6208
|
+
}
|
|
6209
|
+
return page.items;
|
|
6210
|
+
}
|
|
6211
|
+
async approve(threadId, proposalId, request, body) {
|
|
6212
|
+
const value = bodyFields(body, "remember");
|
|
6213
|
+
return this.proposals.decide(threadId, proposalId, await this.actors.resolve(request), {
|
|
6214
|
+
decision: "approved",
|
|
6215
|
+
...typeof value.remember === "boolean" ? {
|
|
6216
|
+
remember: value.remember
|
|
6217
|
+
} : {}
|
|
6218
|
+
});
|
|
6219
|
+
}
|
|
6220
|
+
async reject(threadId, proposalId, request, body) {
|
|
6221
|
+
const value = bodyFields(body, "reason");
|
|
6222
|
+
return this.proposals.decide(threadId, proposalId, await this.actors.resolve(request), {
|
|
6223
|
+
decision: "rejected",
|
|
6224
|
+
...typeof value.reason === "string" ? {
|
|
6225
|
+
reason: value.reason
|
|
6226
|
+
} : {}
|
|
6227
|
+
});
|
|
6228
|
+
}
|
|
6229
|
+
};
|
|
6230
|
+
_ts_decorate28([
|
|
6231
|
+
Get12(),
|
|
6232
|
+
_ts_param26(0, Param6("threadId")),
|
|
6233
|
+
_ts_param26(1, Req13()),
|
|
6234
|
+
_ts_param26(2, Query6("after")),
|
|
6235
|
+
_ts_param26(3, Res2({
|
|
6236
|
+
passthrough: true
|
|
6237
|
+
})),
|
|
6238
|
+
_ts_metadata26("design:type", Function),
|
|
6239
|
+
_ts_metadata26("design:paramtypes", [
|
|
6240
|
+
String,
|
|
6241
|
+
typeof Request === "undefined" ? Object : Request,
|
|
6242
|
+
Object,
|
|
6243
|
+
typeof Response === "undefined" ? Object : Response
|
|
6244
|
+
]),
|
|
6245
|
+
_ts_metadata26("design:returntype", Promise)
|
|
6246
|
+
], ActionProposalController.prototype, "list", null);
|
|
6247
|
+
_ts_decorate28([
|
|
6248
|
+
Post7(":proposalId/approve"),
|
|
6249
|
+
_ts_param26(0, Param6("threadId")),
|
|
6250
|
+
_ts_param26(1, Param6("proposalId")),
|
|
6251
|
+
_ts_param26(2, Req13()),
|
|
6252
|
+
_ts_param26(3, Body6()),
|
|
6253
|
+
_ts_metadata26("design:type", Function),
|
|
6254
|
+
_ts_metadata26("design:paramtypes", [
|
|
6255
|
+
String,
|
|
6256
|
+
String,
|
|
6257
|
+
typeof Request === "undefined" ? Object : Request,
|
|
6258
|
+
Object
|
|
6259
|
+
]),
|
|
6260
|
+
_ts_metadata26("design:returntype", Promise)
|
|
6261
|
+
], ActionProposalController.prototype, "approve", null);
|
|
6262
|
+
_ts_decorate28([
|
|
6263
|
+
Post7(":proposalId/reject"),
|
|
6264
|
+
_ts_param26(0, Param6("threadId")),
|
|
6265
|
+
_ts_param26(1, Param6("proposalId")),
|
|
6266
|
+
_ts_param26(2, Req13()),
|
|
6267
|
+
_ts_param26(3, Body6()),
|
|
6268
|
+
_ts_metadata26("design:type", Function),
|
|
6269
|
+
_ts_metadata26("design:paramtypes", [
|
|
6270
|
+
String,
|
|
6271
|
+
String,
|
|
6272
|
+
typeof Request === "undefined" ? Object : Request,
|
|
6273
|
+
Object
|
|
6274
|
+
]),
|
|
6275
|
+
_ts_metadata26("design:returntype", Promise)
|
|
6276
|
+
], ActionProposalController.prototype, "reject", null);
|
|
6277
|
+
ActionProposalController = _ts_decorate28([
|
|
6278
|
+
Controller14("threads/:threadId/action-proposals"),
|
|
6279
|
+
_ts_param26(1, Inject26(AGENT_ACTOR_RESOLVER13)),
|
|
6280
|
+
_ts_metadata26("design:type", Function),
|
|
6281
|
+
_ts_metadata26("design:paramtypes", [
|
|
6282
|
+
typeof ActionProposalService === "undefined" ? Object : ActionProposalService,
|
|
6283
|
+
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
6284
|
+
])
|
|
6285
|
+
], ActionProposalController);
|
|
6286
|
+
|
|
5494
6287
|
// src/runner/inline-agent-runner.ts
|
|
5495
|
-
import { AGENT_DEPS_FACTORY as
|
|
5496
|
-
import { Inject as
|
|
5497
|
-
function
|
|
6288
|
+
import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY8, AGENT_STORE as AGENT_STORE8, RUN_ENDED_BEFORE_TOOL_CALL as RUN_ENDED_BEFORE_TOOL_CALL2, RunCancelledError as RunCancelledError2, agentFailureCode as agentFailureCode2, encodeStreamEvent as encodeStreamEvent5, publishAgentRunFailed as publishAgentRunFailed2, releaseThreadRun as releaseThreadRun3, runAgentLoop as runAgentLoop2, settleAll as settleAll2, settleUnsettledDelegation as settleUnsettledDelegation3, streamFailure as streamFailure3 } from "@dudousxd/nestjs-agent-core";
|
|
6289
|
+
import { Inject as Inject27, Injectable as Injectable13, Logger as Logger8, Optional as Optional11 } from "@nestjs/common";
|
|
6290
|
+
function _ts_decorate29(decorators, target, key, desc) {
|
|
5498
6291
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5499
6292
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
5500
6293
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -5507,19 +6300,19 @@ function _ts_decorate25(decorators, target, key, desc) {
|
|
|
5507
6300
|
}
|
|
5508
6301
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5509
6302
|
}
|
|
5510
|
-
__name(
|
|
5511
|
-
function
|
|
6303
|
+
__name(_ts_decorate29, "_ts_decorate");
|
|
6304
|
+
function _ts_metadata27(metadataKey, metadataValue) {
|
|
5512
6305
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
5513
6306
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
5514
6307
|
}
|
|
5515
6308
|
}
|
|
5516
|
-
__name(
|
|
5517
|
-
function
|
|
6309
|
+
__name(_ts_metadata27, "_ts_metadata");
|
|
6310
|
+
function _ts_param27(paramIndex, decorator) {
|
|
5518
6311
|
return function(target, key) {
|
|
5519
6312
|
decorator(target, key, paramIndex);
|
|
5520
6313
|
};
|
|
5521
6314
|
}
|
|
5522
|
-
__name(
|
|
6315
|
+
__name(_ts_param27, "_ts_param");
|
|
5523
6316
|
var InlineAgentRunner = class _InlineAgentRunner {
|
|
5524
6317
|
static {
|
|
5525
6318
|
__name(this, "InlineAgentRunner");
|
|
@@ -5527,7 +6320,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
5527
6320
|
factory;
|
|
5528
6321
|
store;
|
|
5529
6322
|
queue;
|
|
5530
|
-
logger = new
|
|
6323
|
+
logger = new Logger8(_InlineAgentRunner.name);
|
|
5531
6324
|
pending = /* @__PURE__ */ new Map();
|
|
5532
6325
|
/**
|
|
5533
6326
|
* Runs someone has asked to stop. In-process, like `pending`, and for the same reason: this runner
|
|
@@ -5970,13 +6763,13 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
5970
6763
|
}
|
|
5971
6764
|
}
|
|
5972
6765
|
};
|
|
5973
|
-
InlineAgentRunner =
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
6766
|
+
InlineAgentRunner = _ts_decorate29([
|
|
6767
|
+
Injectable13(),
|
|
6768
|
+
_ts_param27(0, Inject27(AGENT_DEPS_FACTORY8)),
|
|
6769
|
+
_ts_param27(1, Inject27(AGENT_STORE8)),
|
|
6770
|
+
_ts_param27(2, Optional11()),
|
|
6771
|
+
_ts_metadata27("design:type", Function),
|
|
6772
|
+
_ts_metadata27("design:paramtypes", [
|
|
5980
6773
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
5981
6774
|
typeof AgentStore === "undefined" ? Object : AgentStore,
|
|
5982
6775
|
typeof ChatQueueService2 === "undefined" ? Object : ChatQueueService2
|
|
@@ -6026,7 +6819,7 @@ function resolveSkillsConfig(options, declared) {
|
|
|
6026
6819
|
__name(resolveSkillsConfig, "resolveSkillsConfig");
|
|
6027
6820
|
|
|
6028
6821
|
// src/agent.module.ts
|
|
6029
|
-
function
|
|
6822
|
+
function _ts_decorate30(decorators, target, key, desc) {
|
|
6030
6823
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6031
6824
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
6032
6825
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -6039,18 +6832,18 @@ function _ts_decorate26(decorators, target, key, desc) {
|
|
|
6039
6832
|
}
|
|
6040
6833
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6041
6834
|
}
|
|
6042
|
-
__name(
|
|
6835
|
+
__name(_ts_decorate30, "_ts_decorate");
|
|
6043
6836
|
var DEFAULT_PATH = "agent";
|
|
6044
|
-
var logger = new
|
|
6045
|
-
function
|
|
6837
|
+
var logger = new Logger9("AgentModule");
|
|
6838
|
+
function externalWrapper(modules, token) {
|
|
6046
6839
|
for (const module of modules.values()) {
|
|
6047
6840
|
if (module.metatype === AgentModule) continue;
|
|
6048
|
-
const wrapper = module.providers.get(
|
|
6841
|
+
const wrapper = module.providers.get(token);
|
|
6049
6842
|
if (wrapper !== void 0) return wrapper;
|
|
6050
6843
|
}
|
|
6051
6844
|
return void 0;
|
|
6052
6845
|
}
|
|
6053
|
-
__name(
|
|
6846
|
+
__name(externalWrapper, "externalWrapper");
|
|
6054
6847
|
function forwardingStore(wrapper) {
|
|
6055
6848
|
const target = /* @__PURE__ */ __name(() => {
|
|
6056
6849
|
const instance = wrapper.instance;
|
|
@@ -6073,12 +6866,36 @@ function forwardingStore(wrapper) {
|
|
|
6073
6866
|
__name(forwardingStore, "forwardingStore");
|
|
6074
6867
|
function resolveStore(options, modules) {
|
|
6075
6868
|
if (options.store !== void 0) return options.store;
|
|
6076
|
-
const external =
|
|
6869
|
+
const external = externalWrapper(modules, AGENT_STORE9);
|
|
6077
6870
|
if (external !== void 0) return forwardingStore(external);
|
|
6078
6871
|
logger.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()).");
|
|
6079
6872
|
return new InMemoryAgentStore();
|
|
6080
6873
|
}
|
|
6081
6874
|
__name(resolveStore, "resolveStore");
|
|
6875
|
+
function resolveRolesPolicy(options, modules) {
|
|
6876
|
+
const external = externalWrapper(modules, AGENT_ROLES_POLICY2);
|
|
6877
|
+
if (options.rolesPolicy !== void 0) {
|
|
6878
|
+
if (external !== void 0) {
|
|
6879
|
+
logger.warn("Both a `rolesPolicy` option and a module binding AGENT_ROLES_POLICY (e.g. AgentAuthzModule) are configured \u2014 the `rolesPolicy` option wins.");
|
|
6880
|
+
}
|
|
6881
|
+
return options.rolesPolicy;
|
|
6882
|
+
}
|
|
6883
|
+
if (external !== void 0) return forwardingPolicy(external);
|
|
6884
|
+
return options.emptyRoles === "deny" ? new ClosedRolesPolicy(options.defaultRoles) : new DefaultRolesPolicy(options.defaultRoles);
|
|
6885
|
+
}
|
|
6886
|
+
__name(resolveRolesPolicy, "resolveRolesPolicy");
|
|
6887
|
+
function forwardingPolicy(wrapper) {
|
|
6888
|
+
return {
|
|
6889
|
+
can(actor, tool) {
|
|
6890
|
+
const policy = wrapper.instance;
|
|
6891
|
+
if (policy === void 0 || policy === null) {
|
|
6892
|
+
throw new Error("AgentModule: the AGENT_ROLES_POLICY bound by another module is not ready yet");
|
|
6893
|
+
}
|
|
6894
|
+
return policy.can(actor, tool);
|
|
6895
|
+
}
|
|
6896
|
+
};
|
|
6897
|
+
}
|
|
6898
|
+
__name(forwardingPolicy, "forwardingPolicy");
|
|
6082
6899
|
function isQuotaProvider(quota) {
|
|
6083
6900
|
return quota !== void 0 && typeof quota.report === "function";
|
|
6084
6901
|
}
|
|
@@ -6118,7 +6935,7 @@ function sharedProviders(durable) {
|
|
|
6118
6935
|
provide: AGENT_SKILLS3,
|
|
6119
6936
|
useFactory: /* @__PURE__ */ __name((options, declared) => resolveSkillsConfig(options.skills, declared), "useFactory"),
|
|
6120
6937
|
inject: [
|
|
6121
|
-
|
|
6938
|
+
AGENT_OPTIONS9,
|
|
6122
6939
|
AGENT_SKILL_SOURCES2
|
|
6123
6940
|
]
|
|
6124
6941
|
},
|
|
@@ -6128,39 +6945,40 @@ function sharedProviders(durable) {
|
|
|
6128
6945
|
provide: AGENT_MEMORY3,
|
|
6129
6946
|
useFactory: /* @__PURE__ */ __name((options) => options.memory, "useFactory"),
|
|
6130
6947
|
inject: [
|
|
6131
|
-
|
|
6948
|
+
AGENT_OPTIONS9
|
|
6132
6949
|
]
|
|
6133
6950
|
},
|
|
6134
6951
|
{
|
|
6135
6952
|
provide: AGENT_SINK4,
|
|
6136
6953
|
useFactory: /* @__PURE__ */ __name((options) => options.sink ?? new InProcessTokenStreamSink(), "useFactory"),
|
|
6137
6954
|
inject: [
|
|
6138
|
-
|
|
6955
|
+
AGENT_OPTIONS9
|
|
6139
6956
|
]
|
|
6140
6957
|
},
|
|
6141
6958
|
{
|
|
6142
6959
|
provide: AGENT_ROLES_POLICY2,
|
|
6143
|
-
useFactory: /* @__PURE__ */ __name((options) =>
|
|
6960
|
+
useFactory: /* @__PURE__ */ __name((options, modules) => resolveRolesPolicy(options, modules), "useFactory"),
|
|
6144
6961
|
inject: [
|
|
6145
|
-
|
|
6962
|
+
AGENT_OPTIONS9,
|
|
6963
|
+
ModulesContainer
|
|
6146
6964
|
]
|
|
6147
6965
|
},
|
|
6148
6966
|
{
|
|
6149
|
-
provide:
|
|
6967
|
+
provide: AGENT_ACTOR_RESOLVER14,
|
|
6150
6968
|
useFactory: /* @__PURE__ */ __name((options) => {
|
|
6151
6969
|
if (options.actorResolver !== void 0) return options.actorResolver;
|
|
6152
6970
|
logger.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.");
|
|
6153
6971
|
return new AnonymousActorResolver();
|
|
6154
6972
|
}, "useFactory"),
|
|
6155
6973
|
inject: [
|
|
6156
|
-
|
|
6974
|
+
AGENT_OPTIONS9
|
|
6157
6975
|
]
|
|
6158
6976
|
},
|
|
6159
6977
|
{
|
|
6160
6978
|
provide: AGENT_MODEL2,
|
|
6161
6979
|
useFactory: /* @__PURE__ */ __name((o) => o.model, "useFactory"),
|
|
6162
6980
|
inject: [
|
|
6163
|
-
|
|
6981
|
+
AGENT_OPTIONS9
|
|
6164
6982
|
]
|
|
6165
6983
|
},
|
|
6166
6984
|
{
|
|
@@ -6171,20 +6989,20 @@ function sharedProviders(durable) {
|
|
|
6171
6989
|
warnAt: o.quota.warnAt
|
|
6172
6990
|
} : {}), "useFactory"),
|
|
6173
6991
|
inject: [
|
|
6174
|
-
|
|
6175
|
-
|
|
6992
|
+
AGENT_OPTIONS9,
|
|
6993
|
+
AGENT_STORE9
|
|
6176
6994
|
]
|
|
6177
6995
|
},
|
|
6178
6996
|
{
|
|
6179
6997
|
provide: AGENT_MODEL_CATALOG3,
|
|
6180
6998
|
useFactory: /* @__PURE__ */ __name((o) => resolveCatalog(o), "useFactory"),
|
|
6181
6999
|
inject: [
|
|
6182
|
-
|
|
7000
|
+
AGENT_OPTIONS9
|
|
6183
7001
|
]
|
|
6184
7002
|
},
|
|
6185
7003
|
AgentDepsFactory2,
|
|
6186
7004
|
{
|
|
6187
|
-
provide:
|
|
7005
|
+
provide: AGENT_DEPS_FACTORY9,
|
|
6188
7006
|
useExisting: AgentDepsFactory2
|
|
6189
7007
|
},
|
|
6190
7008
|
// Populates the registry + contributors (onModuleInit) BEFORE AiToolDiscoveryService synthesizes
|
|
@@ -6201,6 +7019,8 @@ function sharedProviders(durable) {
|
|
|
6201
7019
|
},
|
|
6202
7020
|
InlineAgentRunner,
|
|
6203
7021
|
AgentService,
|
|
7022
|
+
ActionProposalService,
|
|
7023
|
+
ActionProposalWorkerService,
|
|
6204
7024
|
// Bound ALWAYS (durable or inline) — the console's cross-thread approvals inbox routes decisions
|
|
6205
7025
|
// through AgentService.signalToolCall, which reaches whichever AGENT_RUNNER is bound above.
|
|
6206
7026
|
AgentApprovalPortAdapter,
|
|
@@ -6210,10 +7030,10 @@ function sharedProviders(durable) {
|
|
|
6210
7030
|
}
|
|
6211
7031
|
];
|
|
6212
7032
|
providers.push({
|
|
6213
|
-
provide:
|
|
7033
|
+
provide: AGENT_STORE9,
|
|
6214
7034
|
useFactory: /* @__PURE__ */ __name((o, modules) => resolveStore(o, modules), "useFactory"),
|
|
6215
7035
|
inject: [
|
|
6216
|
-
|
|
7036
|
+
AGENT_OPTIONS9,
|
|
6217
7037
|
ModulesContainer
|
|
6218
7038
|
]
|
|
6219
7039
|
});
|
|
@@ -6244,22 +7064,24 @@ function sharedProviders(durable) {
|
|
|
6244
7064
|
__name(sharedProviders, "sharedProviders");
|
|
6245
7065
|
function exportsFor() {
|
|
6246
7066
|
return [
|
|
6247
|
-
|
|
7067
|
+
AGENT_OPTIONS9,
|
|
6248
7068
|
AGENT_TOOL_REGISTRY3,
|
|
6249
7069
|
AGENT_REGISTRY6,
|
|
6250
7070
|
AGENT_SINK4,
|
|
6251
7071
|
AGENT_ROLES_POLICY2,
|
|
6252
|
-
|
|
7072
|
+
AGENT_ACTOR_RESOLVER14,
|
|
6253
7073
|
AGENT_MODEL2,
|
|
6254
|
-
|
|
7074
|
+
AGENT_STORE9,
|
|
6255
7075
|
AGENT_MODEL_CATALOG3,
|
|
6256
7076
|
AGENT_QUOTA_PROVIDER3,
|
|
6257
7077
|
AGENT_PROMPT_CONTRIBUTORS3,
|
|
6258
7078
|
AGENT_SKILLS3,
|
|
6259
7079
|
AGENT_MEMORY3,
|
|
6260
|
-
|
|
7080
|
+
AGENT_DEPS_FACTORY9,
|
|
6261
7081
|
AgentDepsFactory2,
|
|
6262
7082
|
AgentService,
|
|
7083
|
+
ActionProposalService,
|
|
7084
|
+
ActionProposalWorkerService,
|
|
6263
7085
|
ChatQueueService2,
|
|
6264
7086
|
AGENT_CHAT_QUEUE,
|
|
6265
7087
|
InlineAgentRunner,
|
|
@@ -6268,6 +7090,7 @@ function exportsFor() {
|
|
|
6268
7090
|
}
|
|
6269
7091
|
__name(exportsFor, "exportsFor");
|
|
6270
7092
|
var BASE_CONTROLLERS = [
|
|
7093
|
+
ActionProposalController,
|
|
6271
7094
|
ChatController,
|
|
6272
7095
|
QueueController,
|
|
6273
7096
|
ThreadsController,
|
|
@@ -6340,7 +7163,7 @@ var AgentModule = class _AgentModule {
|
|
|
6340
7163
|
controllers: controllersForSurface(options.surface, options.adapters),
|
|
6341
7164
|
providers: [
|
|
6342
7165
|
{
|
|
6343
|
-
provide:
|
|
7166
|
+
provide: AGENT_OPTIONS9,
|
|
6344
7167
|
useValue: options
|
|
6345
7168
|
},
|
|
6346
7169
|
...sharedProviders(options.durable ?? false),
|
|
@@ -6364,7 +7187,7 @@ var AgentModule = class _AgentModule {
|
|
|
6364
7187
|
controllers: controllersForSurface(options.surface, options.adapters),
|
|
6365
7188
|
providers: [
|
|
6366
7189
|
{
|
|
6367
|
-
provide:
|
|
7190
|
+
provide: AGENT_OPTIONS9,
|
|
6368
7191
|
// Stamp the STATIC wiring flags onto the factory result: `durable`/`surface` are
|
|
6369
7192
|
// authoritative on the async config object (they decided the actual wiring above), and
|
|
6370
7193
|
// the durable module reads `durable` back off AGENT_OPTIONS. `surface` isn't read back by
|
|
@@ -6386,9 +7209,9 @@ var AgentModule = class _AgentModule {
|
|
|
6386
7209
|
};
|
|
6387
7210
|
}
|
|
6388
7211
|
};
|
|
6389
|
-
AgentModule =
|
|
7212
|
+
AgentModule = _ts_decorate30([
|
|
6390
7213
|
Global2(),
|
|
6391
|
-
|
|
7214
|
+
Module3({})
|
|
6392
7215
|
], AgentModule);
|
|
6393
7216
|
|
|
6394
7217
|
// src/durable/agent-durable.ts
|