@dudousxd/nestjs-agent 1.29.0 → 1.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/a2ui/index.cjs +207 -11
- package/dist/a2ui/index.cjs.map +1 -1
- package/dist/a2ui/index.d.cts +3 -3
- package/dist/a2ui/index.d.ts +3 -3
- package/dist/a2ui/index.js +203 -12
- package/dist/a2ui/index.js.map +1 -1
- package/dist/agent-genui.module-D0X3YnzO.d.cts +147 -0
- package/dist/agent-genui.module-D0X3YnzO.d.ts +147 -0
- package/dist/{chat-queue.service-B-fVOJGf.d.ts → chat-queue.service-Bdz43pAC.d.ts} +1 -1
- package/dist/{chat-queue.service-Bk7DCKGV.d.cts → chat-queue.service-ZwQ9p-Ps.d.cts} +1 -1
- package/dist/durable/index.cjs +249 -32
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.d.cts +2 -2
- package/dist/durable/index.d.ts +2 -2
- package/dist/durable/index.js +240 -28
- package/dist/durable/index.js.map +1 -1
- package/dist/genui/index.cjs +211 -11
- package/dist/genui/index.cjs.map +1 -1
- package/dist/genui/index.d.cts +27 -94
- package/dist/genui/index.d.ts +27 -94
- package/dist/genui/index.js +205 -12
- package/dist/genui/index.js.map +1 -1
- package/dist/{index-APh8WN3z.d.ts → index-BGevU_Ih.d.ts} +8 -1
- package/dist/{index-D9EM7ivO.d.cts → index-DoCdfNrO.d.cts} +8 -1
- package/dist/index.cjs +240 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -6
- package/dist/index.d.ts +8 -6
- package/dist/index.js +236 -27
- package/dist/index.js.map +1 -1
- package/dist/vite/index.cjs +48 -0
- package/dist/vite/index.cjs.map +1 -0
- package/dist/vite/index.d.cts +32 -0
- package/dist/vite/index.d.ts +32 -0
- package/dist/vite/index.js +21 -0
- package/dist/vite/index.js.map +1 -0
- package/package.json +17 -3
package/dist/durable/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AgentStore, AgentRunInput, AgentLoopResult, LlmStepEnvelope, BufferedModelTurnResult, ToolStepEnvelope, AgentRunner, TokenStreamSink, AgentRunStartOptions, HumanReply } from '@dudousxd/nestjs-agent-core';
|
|
2
2
|
import { WorkflowService } from '@dudousxd/nestjs-durable';
|
|
3
3
|
import { RunGateway, WorkflowCtx } from '@dudousxd/nestjs-durable-core';
|
|
4
|
-
import { A as AgentDepsFactory, C as ChatQueueService, a as AgentSurface, b as AgentModuleOptions } from '../chat-queue.service-
|
|
4
|
+
import { A as AgentDepsFactory, C as ChatQueueService, a as AgentSurface, b as AgentModuleOptions } from '../chat-queue.service-ZwQ9p-Ps.cjs';
|
|
5
5
|
import { DynamicModule } from '@nestjs/common';
|
|
6
6
|
import '@dudousxd/nestjs-agent-core/genui';
|
|
7
7
|
import '@standard-schema/spec';
|
|
8
|
-
import '../genui
|
|
8
|
+
import '../agent-genui.module-D0X3YnzO.cjs';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* The agent turn AS a durable workflow. Persist/stream checkpoints are `ctx.localStep`s — the
|
package/dist/durable/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AgentStore, AgentRunInput, AgentLoopResult, LlmStepEnvelope, BufferedModelTurnResult, ToolStepEnvelope, AgentRunner, TokenStreamSink, AgentRunStartOptions, HumanReply } from '@dudousxd/nestjs-agent-core';
|
|
2
2
|
import { WorkflowService } from '@dudousxd/nestjs-durable';
|
|
3
3
|
import { RunGateway, WorkflowCtx } from '@dudousxd/nestjs-durable-core';
|
|
4
|
-
import { A as AgentDepsFactory, C as ChatQueueService, a as AgentSurface, b as AgentModuleOptions } from '../chat-queue.service-
|
|
4
|
+
import { A as AgentDepsFactory, C as ChatQueueService, a as AgentSurface, b as AgentModuleOptions } from '../chat-queue.service-Bdz43pAC.js';
|
|
5
5
|
import { DynamicModule } from '@nestjs/common';
|
|
6
6
|
import '@dudousxd/nestjs-agent-core/genui';
|
|
7
7
|
import '@standard-schema/spec';
|
|
8
|
-
import '../genui
|
|
8
|
+
import '../agent-genui.module-D0X3YnzO.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* The agent turn AS a durable workflow. Persist/stream checkpoints are `ctx.localStep`s — the
|
package/dist/durable/index.js
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
|
+
var __esm = (fn, res) => function __init() {
|
|
5
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
6
|
+
};
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// src/vite/index.ts
|
|
13
|
+
import { SANDBOX_KIT_DEV_PREFIX, SANDBOX_KIT_MANIFEST_KEYS, SANDBOX_KIT_UPDATE_EVENT, createGenuiSandboxKitPlugin } from "@dudousxd/nestjs-agent-core/genui/kit";
|
|
14
|
+
var NEST_SANDBOX_KIT_DESCRIPTOR;
|
|
15
|
+
var init_vite = __esm({
|
|
16
|
+
"src/vite/index.ts"() {
|
|
17
|
+
"use strict";
|
|
18
|
+
NEST_SANDBOX_KIT_DESCRIPTOR = ".genui/sandbox-kit.json";
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// src/genui/kit.ts
|
|
23
|
+
var kit_exports = {};
|
|
24
|
+
__export(kit_exports, {
|
|
25
|
+
NEST_SANDBOX_KIT_MANIFEST: () => NEST_SANDBOX_KIT_MANIFEST,
|
|
26
|
+
nestSandboxKitDiscovery: () => nestSandboxKitDiscovery
|
|
27
|
+
});
|
|
28
|
+
import { resolve } from "path";
|
|
29
|
+
import { sandboxKitDiscovery } from "@dudousxd/nestjs-agent-core/genui/kit";
|
|
30
|
+
function nestSandboxKitDiscovery(options = {}) {
|
|
31
|
+
const manifest = options.manifest ?? NEST_SANDBOX_KIT_MANIFEST;
|
|
32
|
+
return sandboxKitDiscovery({
|
|
33
|
+
root: resolve(options.root ?? process.cwd()),
|
|
34
|
+
descriptor: options.descriptor ?? NEST_SANDBOX_KIT_DESCRIPTOR,
|
|
35
|
+
...manifest !== false ? {
|
|
36
|
+
manifest: {
|
|
37
|
+
file: manifest.file,
|
|
38
|
+
outDir: manifest.outDir
|
|
39
|
+
}
|
|
40
|
+
} : {},
|
|
41
|
+
...options.kitUrl !== void 0 ? {
|
|
42
|
+
kitUrl: options.kitUrl
|
|
43
|
+
} : {},
|
|
44
|
+
...options.production !== void 0 ? {
|
|
45
|
+
production: options.production
|
|
46
|
+
} : {}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
var NEST_SANDBOX_KIT_MANIFEST;
|
|
50
|
+
var init_kit = __esm({
|
|
51
|
+
"src/genui/kit.ts"() {
|
|
52
|
+
"use strict";
|
|
53
|
+
init_vite();
|
|
54
|
+
NEST_SANDBOX_KIT_MANIFEST = Object.freeze({
|
|
55
|
+
file: "public/.vite/manifest.json",
|
|
56
|
+
outDir: "public"
|
|
57
|
+
});
|
|
58
|
+
__name(nestSandboxKitDiscovery, "nestSandboxKitDiscovery");
|
|
59
|
+
}
|
|
60
|
+
});
|
|
3
61
|
|
|
4
62
|
// src/durable/agent-run.workflow.ts
|
|
5
63
|
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";
|
|
@@ -36,6 +94,7 @@ var AGENT_CHAT_QUEUE = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:chat-q
|
|
|
36
94
|
import { createNegotiatedUiCollector } from "@dudousxd/nestjs-agent-core";
|
|
37
95
|
import { prepareActionProposal, resolveActionProposalApproval } from "@dudousxd/nestjs-agent-core";
|
|
38
96
|
import { AGENT_DEPS_FACTORY, createFrameBuffer, createNoopEmitUi, encodeStreamEvent, intersectAllowLists, invokeWithTransientRetry, isControlFlowSignal, isReplayIntegrityError, observeTurnFrames, previewToolInputs, publishAgentToolRetry, registryInputPreviews, stampToolKinds, toolCallContext, traceLlmTurn, traceToolExecution, withAskTool, withMemoryTool, withSkillTool, withToolTimeout, withTurnFrames, wrapToolPreflightDenied, wrapToolStepOutput } from "@dudousxd/nestjs-agent-core";
|
|
97
|
+
import { turnChannel } from "@dudousxd/nestjs-agent-core/genui";
|
|
39
98
|
import { Step } from "@dudousxd/nestjs-durable";
|
|
40
99
|
import { Inject, Injectable } from "@nestjs/common";
|
|
41
100
|
|
|
@@ -112,6 +171,7 @@ var AgentRunSteps = class {
|
|
|
112
171
|
...input.preflightContext?.uiCapabilities !== void 0 ? {
|
|
113
172
|
uiCapabilities: input.preflightContext.uiCapabilities
|
|
114
173
|
} : {},
|
|
174
|
+
channel: turnChannel(input.preflightContext?.pageContext),
|
|
115
175
|
...input.agentName !== void 0 ? {
|
|
116
176
|
agentName: input.agentName
|
|
117
177
|
} : {}
|
|
@@ -141,7 +201,8 @@ var AgentRunSteps = class {
|
|
|
141
201
|
} : {},
|
|
142
202
|
...input.preflightContext?.uiCapabilities !== void 0 ? {
|
|
143
203
|
uiCapabilities: input.preflightContext.uiCapabilities
|
|
144
|
-
} : {}
|
|
204
|
+
} : {},
|
|
205
|
+
channel: turnChannel(input.preflightContext?.pageContext)
|
|
145
206
|
}));
|
|
146
207
|
const frames = observeTurnFrames(previews.writer);
|
|
147
208
|
const turn = withTurnFrames(await traceLlmTurn(input.runId, input.step, () => deps.model.runTurn({
|
|
@@ -798,8 +859,8 @@ var InProcessTokenStreamSink = class {
|
|
|
798
859
|
return buf;
|
|
799
860
|
}
|
|
800
861
|
wake(buf) {
|
|
801
|
-
for (const
|
|
802
|
-
|
|
862
|
+
for (const resolve2 of buf.notify) {
|
|
863
|
+
resolve2();
|
|
803
864
|
}
|
|
804
865
|
buf.notify.clear();
|
|
805
866
|
}
|
|
@@ -838,7 +899,7 @@ var InProcessTokenStreamSink = class {
|
|
|
838
899
|
}
|
|
839
900
|
return;
|
|
840
901
|
}
|
|
841
|
-
await new Promise((
|
|
902
|
+
await new Promise((resolve2) => buf.notify.add(resolve2));
|
|
842
903
|
}
|
|
843
904
|
}
|
|
844
905
|
close(runId) {
|
|
@@ -1199,7 +1260,7 @@ import { AGENT_OPTIONS } from "@dudousxd/nestjs-agent-core";
|
|
|
1199
1260
|
import { BadRequestException, Inject as Inject5, Injectable as Injectable4, Optional as Optional3 } from "@nestjs/common";
|
|
1200
1261
|
|
|
1201
1262
|
// src/genui/agent-genui.module.ts
|
|
1202
|
-
import { defineCatalog, defineSandbox, genuiTools } from "@dudousxd/nestjs-agent-core/genui";
|
|
1263
|
+
import { assertGenuiChannels, defineCatalog, defineSandbox, genuiTools, sandboxPolicyOf } from "@dudousxd/nestjs-agent-core/genui";
|
|
1203
1264
|
import { Inject as Inject4, Module as Module2 } from "@nestjs/common";
|
|
1204
1265
|
|
|
1205
1266
|
// src/functional-tool.ts
|
|
@@ -1226,6 +1287,26 @@ function provideAgentTools(factory, inject) {
|
|
|
1226
1287
|
}
|
|
1227
1288
|
__name(provideAgentTools, "provideAgentTools");
|
|
1228
1289
|
|
|
1290
|
+
// src/genui/agent-genui.token.ts
|
|
1291
|
+
var AGENT_GENUI = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:genui");
|
|
1292
|
+
var AgentGenui = class {
|
|
1293
|
+
static {
|
|
1294
|
+
__name(this, "AgentGenui");
|
|
1295
|
+
}
|
|
1296
|
+
catalog;
|
|
1297
|
+
resolveCatalog;
|
|
1298
|
+
channels;
|
|
1299
|
+
base;
|
|
1300
|
+
sandboxClient;
|
|
1301
|
+
constructor(catalog, resolveCatalog2, channels, base = {}, sandboxClient) {
|
|
1302
|
+
this.catalog = catalog;
|
|
1303
|
+
this.resolveCatalog = resolveCatalog2;
|
|
1304
|
+
this.channels = channels;
|
|
1305
|
+
this.base = base;
|
|
1306
|
+
this.sandboxClient = sandboxClient;
|
|
1307
|
+
}
|
|
1308
|
+
};
|
|
1309
|
+
|
|
1229
1310
|
// src/genui/agent-genui.module.ts
|
|
1230
1311
|
function _ts_decorate5(decorators, target, key, desc) {
|
|
1231
1312
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1243,6 +1324,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
1243
1324
|
__name(_ts_decorate5, "_ts_decorate");
|
|
1244
1325
|
var GENUI_CATALOG = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:genui-catalog");
|
|
1245
1326
|
var GENUI_OPTIONS = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:genui-options");
|
|
1327
|
+
var GENUI_RESOLVED = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:genui-resolved");
|
|
1246
1328
|
var GenuiCatalogResolver = class {
|
|
1247
1329
|
static {
|
|
1248
1330
|
__name(this, "GenuiCatalogResolver");
|
|
@@ -1261,20 +1343,99 @@ function resolverProviders(resolver) {
|
|
|
1261
1343
|
];
|
|
1262
1344
|
}
|
|
1263
1345
|
__name(resolverProviders, "resolverProviders");
|
|
1264
|
-
function
|
|
1265
|
-
const
|
|
1346
|
+
function mergeSandboxClients(clients) {
|
|
1347
|
+
const merged = {
|
|
1348
|
+
theme: false
|
|
1349
|
+
};
|
|
1350
|
+
for (const client of clients) {
|
|
1351
|
+
const one = client();
|
|
1352
|
+
merged.theme ||= one.theme;
|
|
1353
|
+
if (one.tailwind !== void 0) merged.tailwind ??= one.tailwind;
|
|
1354
|
+
if (one.kit !== void 0) merged.kit ??= one.kit;
|
|
1355
|
+
}
|
|
1356
|
+
return merged;
|
|
1357
|
+
}
|
|
1358
|
+
__name(mergeSandboxClients, "mergeSandboxClients");
|
|
1359
|
+
async function resolveGenui(options) {
|
|
1360
|
+
const { sandbox: asked, channels: askedChannels } = options;
|
|
1361
|
+
assertGenuiChannels(askedChannels);
|
|
1362
|
+
const clients = [];
|
|
1363
|
+
let discovery;
|
|
1364
|
+
const resolveSandbox = /* @__PURE__ */ __name(async (value) => {
|
|
1365
|
+
if (value === void 0 || value === false) return value;
|
|
1366
|
+
const [{ nestSandboxKitDiscovery: nestSandboxKitDiscovery2 }, { resolveSandboxServer }] = await Promise.all([
|
|
1367
|
+
Promise.resolve().then(() => (init_kit(), kit_exports)),
|
|
1368
|
+
import("@dudousxd/nestjs-agent-core/genui/kit")
|
|
1369
|
+
]);
|
|
1370
|
+
discovery ??= nestSandboxKitDiscovery2(options.sandboxKit);
|
|
1371
|
+
const resolved = resolveSandboxServer(value, discovery);
|
|
1372
|
+
clients.push(resolved.client);
|
|
1373
|
+
return resolved.define;
|
|
1374
|
+
}, "resolveSandbox");
|
|
1375
|
+
const sandbox = await resolveSandbox(asked);
|
|
1376
|
+
const own = options.catalog?.components.find((each) => sandboxPolicyOf(each) !== void 0);
|
|
1377
|
+
const ownOptions = asked === void 0 && own?.sandboxOptions !== void 0 && (own.sandboxView?.kit === true || own.sandboxView?.tailwind === true) ? await resolveSandbox({
|
|
1378
|
+
...own.sandboxOptions,
|
|
1379
|
+
name: own.name
|
|
1380
|
+
}) : void 0;
|
|
1381
|
+
let channels;
|
|
1382
|
+
if (askedChannels !== void 0) {
|
|
1383
|
+
channels = {};
|
|
1384
|
+
for (const [name, entry] of Object.entries(askedChannels)) {
|
|
1385
|
+
if (entry === void 0) continue;
|
|
1386
|
+
const own2 = await resolveSandbox(entry.sandbox);
|
|
1387
|
+
channels[name] = {
|
|
1388
|
+
...entry,
|
|
1389
|
+
...own2 !== void 0 ? {
|
|
1390
|
+
sandbox: own2
|
|
1391
|
+
} : {}
|
|
1392
|
+
};
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
return {
|
|
1396
|
+
...sandbox !== void 0 ? {
|
|
1397
|
+
sandbox
|
|
1398
|
+
} : {},
|
|
1399
|
+
...typeof ownOptions === "object" ? {
|
|
1400
|
+
catalogSandbox: ownOptions
|
|
1401
|
+
} : {},
|
|
1402
|
+
...channels !== void 0 ? {
|
|
1403
|
+
channels
|
|
1404
|
+
} : {},
|
|
1405
|
+
...clients.length > 0 ? {
|
|
1406
|
+
sandboxClient: /* @__PURE__ */ __name(() => mergeSandboxClients(clients), "sandboxClient")
|
|
1407
|
+
} : {}
|
|
1408
|
+
};
|
|
1409
|
+
}
|
|
1410
|
+
__name(resolveGenui, "resolveGenui");
|
|
1411
|
+
function perRequest(resolver) {
|
|
1412
|
+
return resolver === void 0 ? void 0 : (scope) => resolver.resolve(scope);
|
|
1413
|
+
}
|
|
1414
|
+
__name(perRequest, "perRequest");
|
|
1415
|
+
function toolOptions(options, resolved, resolver) {
|
|
1416
|
+
const { catalog: _catalog, sandbox: _sandbox, channels: _channels, sandboxKit: _sandboxKit, ...rest } = options;
|
|
1417
|
+
const resolveCatalog2 = perRequest(resolver);
|
|
1266
1418
|
return {
|
|
1267
1419
|
...rest,
|
|
1268
|
-
...
|
|
1269
|
-
|
|
1420
|
+
...resolved.channels !== void 0 ? {
|
|
1421
|
+
channels: resolved.channels
|
|
1422
|
+
} : {},
|
|
1423
|
+
...resolved.sandbox !== void 0 ? {
|
|
1424
|
+
sandbox: resolved.sandbox
|
|
1425
|
+
} : {},
|
|
1426
|
+
...resolveCatalog2 !== void 0 ? {
|
|
1427
|
+
resolveCatalog: resolveCatalog2
|
|
1270
1428
|
} : {}
|
|
1271
1429
|
};
|
|
1272
1430
|
}
|
|
1273
1431
|
__name(toolOptions, "toolOptions");
|
|
1274
|
-
function withSandbox(options) {
|
|
1432
|
+
function withSandbox(options, resolved) {
|
|
1275
1433
|
const base = options.catalog ?? defineCatalog([]);
|
|
1276
|
-
const { sandbox } =
|
|
1277
|
-
|
|
1434
|
+
const { sandbox, catalogSandbox } = resolved;
|
|
1435
|
+
if (sandbox === void 0 || sandbox === false) return catalogSandbox !== void 0 ? base.extend([
|
|
1436
|
+
defineSandbox(catalogSandbox)
|
|
1437
|
+
]) : base;
|
|
1438
|
+
return base.extend([
|
|
1278
1439
|
defineSandbox(sandbox === true ? {} : sandbox)
|
|
1279
1440
|
]);
|
|
1280
1441
|
}
|
|
@@ -1282,18 +1443,50 @@ __name(withSandbox, "withSandbox");
|
|
|
1282
1443
|
function coreProviders(resolver) {
|
|
1283
1444
|
return [
|
|
1284
1445
|
{
|
|
1285
|
-
provide:
|
|
1286
|
-
useFactory: /* @__PURE__ */ __name((options) =>
|
|
1446
|
+
provide: GENUI_RESOLVED,
|
|
1447
|
+
useFactory: /* @__PURE__ */ __name((options) => resolveGenui(options), "useFactory"),
|
|
1287
1448
|
inject: [
|
|
1288
1449
|
GENUI_OPTIONS
|
|
1289
1450
|
]
|
|
1290
1451
|
},
|
|
1452
|
+
{
|
|
1453
|
+
provide: GENUI_CATALOG,
|
|
1454
|
+
useFactory: /* @__PURE__ */ __name((options, resolved) => withSandbox(options, resolved), "useFactory"),
|
|
1455
|
+
inject: [
|
|
1456
|
+
GENUI_OPTIONS,
|
|
1457
|
+
GENUI_RESOLVED
|
|
1458
|
+
]
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
provide: AGENT_GENUI,
|
|
1462
|
+
useFactory: /* @__PURE__ */ __name((options, catalog, resolved, resolverInstance) => new AgentGenui(catalog, perRequest(resolverInstance), resolved.channels, {
|
|
1463
|
+
...options.mode !== void 0 ? {
|
|
1464
|
+
mode: options.mode
|
|
1465
|
+
} : {},
|
|
1466
|
+
...options.streaming !== void 0 ? {
|
|
1467
|
+
streaming: options.streaming
|
|
1468
|
+
} : {},
|
|
1469
|
+
...resolved.sandbox !== void 0 ? {
|
|
1470
|
+
sandbox: resolved.sandbox
|
|
1471
|
+
} : {}
|
|
1472
|
+
}, resolved.sandboxClient), "useFactory"),
|
|
1473
|
+
inject: [
|
|
1474
|
+
GENUI_OPTIONS,
|
|
1475
|
+
GENUI_CATALOG,
|
|
1476
|
+
GENUI_RESOLVED,
|
|
1477
|
+
{
|
|
1478
|
+
token: GenuiCatalogResolver,
|
|
1479
|
+
optional: true
|
|
1480
|
+
}
|
|
1481
|
+
]
|
|
1482
|
+
},
|
|
1291
1483
|
...resolverProviders(resolver),
|
|
1292
1484
|
// The generated tools, registered by the agent module's discovery like any `provideAgentTool`.
|
|
1293
1485
|
// Built from the injected catalog, so `overrideProvider(GENUI_CATALOG)` changes them too.
|
|
1294
|
-
provideAgentTools((options, catalog,
|
|
1486
|
+
provideAgentTools((options, catalog, resolved, perRequestResolver) => genuiTools(catalog, toolOptions(options, resolved, perRequestResolver)), [
|
|
1295
1487
|
GENUI_OPTIONS,
|
|
1296
1488
|
GENUI_CATALOG,
|
|
1489
|
+
GENUI_RESOLVED,
|
|
1297
1490
|
{
|
|
1298
1491
|
token: GenuiCatalogResolver,
|
|
1299
1492
|
optional: true
|
|
@@ -1304,7 +1497,8 @@ function coreProviders(resolver) {
|
|
|
1304
1497
|
__name(coreProviders, "coreProviders");
|
|
1305
1498
|
var EXPORTS = [
|
|
1306
1499
|
GENUI_CATALOG,
|
|
1307
|
-
GENUI_OPTIONS
|
|
1500
|
+
GENUI_OPTIONS,
|
|
1501
|
+
AGENT_GENUI
|
|
1308
1502
|
];
|
|
1309
1503
|
var AgentGenuiModule = class _AgentGenuiModule {
|
|
1310
1504
|
static {
|
|
@@ -1636,7 +1830,7 @@ var AgentDepsFactory2 = class {
|
|
|
1636
1830
|
id: persona.id,
|
|
1637
1831
|
label: persona.label
|
|
1638
1832
|
};
|
|
1639
|
-
const
|
|
1833
|
+
const resolve2 = /* @__PURE__ */ __name(async (prompt, ctx) => typeof prompt === "function" ? prompt(ctx) : prompt, "resolve");
|
|
1640
1834
|
const own = persona.systemPrompt;
|
|
1641
1835
|
const systemPrompt = /* @__PURE__ */ __name(async (ctx) => {
|
|
1642
1836
|
const scoped = {
|
|
@@ -1644,10 +1838,10 @@ var AgentDepsFactory2 = class {
|
|
|
1644
1838
|
persona: ref
|
|
1645
1839
|
};
|
|
1646
1840
|
if (own === void 0) {
|
|
1647
|
-
return
|
|
1841
|
+
return resolve2(base, scoped);
|
|
1648
1842
|
}
|
|
1649
|
-
const basePrompt = typeof own === "function" ? await
|
|
1650
|
-
return
|
|
1843
|
+
const basePrompt = typeof own === "function" ? await resolve2(base, scoped) : void 0;
|
|
1844
|
+
return resolve2(own, {
|
|
1651
1845
|
...scoped,
|
|
1652
1846
|
...basePrompt !== void 0 ? {
|
|
1653
1847
|
basePrompt
|
|
@@ -2546,8 +2740,16 @@ function sendableParams(params) {
|
|
|
2546
2740
|
message: "nothing to answer: send a non-empty message, an attachment, or regenerate"
|
|
2547
2741
|
});
|
|
2548
2742
|
}
|
|
2549
|
-
|
|
2550
|
-
|
|
2743
|
+
const { channel, ...rest } = params;
|
|
2744
|
+
const stamped = channel === void 0 ? params : {
|
|
2745
|
+
...rest,
|
|
2746
|
+
pageContext: {
|
|
2747
|
+
...params.pageContext,
|
|
2748
|
+
channel
|
|
2749
|
+
}
|
|
2750
|
+
};
|
|
2751
|
+
return text === message ? stamped : {
|
|
2752
|
+
...stamped,
|
|
2551
2753
|
message: text
|
|
2552
2754
|
};
|
|
2553
2755
|
}
|
|
@@ -4469,11 +4671,13 @@ var ConfigController = class {
|
|
|
4469
4671
|
actorResolver;
|
|
4470
4672
|
staging;
|
|
4471
4673
|
models;
|
|
4472
|
-
|
|
4674
|
+
genui;
|
|
4675
|
+
constructor(options, actorResolver, staging, models, genui) {
|
|
4473
4676
|
this.options = options;
|
|
4474
4677
|
this.actorResolver = actorResolver;
|
|
4475
4678
|
this.staging = staging;
|
|
4476
4679
|
this.models = models;
|
|
4680
|
+
this.genui = genui;
|
|
4477
4681
|
}
|
|
4478
4682
|
async config(req) {
|
|
4479
4683
|
await this.actorResolver.resolve(req);
|
|
@@ -4487,7 +4691,12 @@ var ConfigController = class {
|
|
|
4487
4691
|
},
|
|
4488
4692
|
identity: {
|
|
4489
4693
|
anonymous: this.actorResolver instanceof AnonymousActorResolver
|
|
4490
|
-
}
|
|
4694
|
+
},
|
|
4695
|
+
...this.genui?.sandboxClient !== void 0 ? {
|
|
4696
|
+
genui: {
|
|
4697
|
+
sandbox: this.genui.sandboxClient()
|
|
4698
|
+
}
|
|
4699
|
+
} : {}
|
|
4491
4700
|
};
|
|
4492
4701
|
}
|
|
4493
4702
|
};
|
|
@@ -4508,11 +4717,14 @@ ConfigController = _ts_decorate14([
|
|
|
4508
4717
|
_ts_param12(2, Inject12(AGENT_ATTACHMENT_STAGING4)),
|
|
4509
4718
|
_ts_param12(3, Optional8()),
|
|
4510
4719
|
_ts_param12(3, Inject12(AGENT_MODEL_CATALOG2)),
|
|
4720
|
+
_ts_param12(4, Optional8()),
|
|
4721
|
+
_ts_param12(4, Inject12(AGENT_GENUI)),
|
|
4511
4722
|
_ts_metadata12("design:type", Function),
|
|
4512
4723
|
_ts_metadata12("design:paramtypes", [
|
|
4513
4724
|
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
4514
4725
|
typeof ActorResolver === "undefined" ? Object : ActorResolver,
|
|
4515
4726
|
Object,
|
|
4727
|
+
Object,
|
|
4516
4728
|
Object
|
|
4517
4729
|
])
|
|
4518
4730
|
], ConfigController);
|
|
@@ -6796,12 +7008,12 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6796
7008
|
}
|
|
6797
7009
|
const key = `${runId}:${toolCallId2}`;
|
|
6798
7010
|
let timer;
|
|
6799
|
-
const lapse = new Promise((
|
|
7011
|
+
const lapse = new Promise((resolve2) => {
|
|
6800
7012
|
timer = setTimeout(() => {
|
|
6801
7013
|
const entry = this.pending.get(key);
|
|
6802
7014
|
if (entry !== void 0) {
|
|
6803
7015
|
this.pending.delete(key);
|
|
6804
|
-
|
|
7016
|
+
resolve2({
|
|
6805
7017
|
approved: false,
|
|
6806
7018
|
expired: true
|
|
6807
7019
|
});
|
|
@@ -6815,9 +7027,9 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6815
7027
|
]).finally(() => clearTimeout(timer));
|
|
6816
7028
|
}
|
|
6817
7029
|
park(runId, toolCallId2) {
|
|
6818
|
-
return new Promise((
|
|
7030
|
+
return new Promise((resolve2, reject) => {
|
|
6819
7031
|
this.pending.set(`${runId}:${toolCallId2}`, {
|
|
6820
|
-
resolve,
|
|
7032
|
+
resolve: resolve2,
|
|
6821
7033
|
reject
|
|
6822
7034
|
});
|
|
6823
7035
|
});
|