@dudousxd/nestjs-agent 1.30.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 -102
- package/dist/genui/index.d.ts +27 -102
- 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.cjs
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __esm = (fn, res) => function __init() {
|
|
10
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
11
|
+
};
|
|
7
12
|
var __export = (target, all) => {
|
|
8
13
|
for (var name in all)
|
|
9
14
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -16,8 +21,66 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
21
|
}
|
|
17
22
|
return to;
|
|
18
23
|
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
19
32
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
33
|
|
|
34
|
+
// src/vite/index.ts
|
|
35
|
+
var import_kit, NEST_SANDBOX_KIT_DESCRIPTOR;
|
|
36
|
+
var init_vite = __esm({
|
|
37
|
+
"src/vite/index.ts"() {
|
|
38
|
+
"use strict";
|
|
39
|
+
import_kit = require("@dudousxd/nestjs-agent-core/genui/kit");
|
|
40
|
+
NEST_SANDBOX_KIT_DESCRIPTOR = ".genui/sandbox-kit.json";
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// src/genui/kit.ts
|
|
45
|
+
var kit_exports = {};
|
|
46
|
+
__export(kit_exports, {
|
|
47
|
+
NEST_SANDBOX_KIT_MANIFEST: () => NEST_SANDBOX_KIT_MANIFEST,
|
|
48
|
+
nestSandboxKitDiscovery: () => nestSandboxKitDiscovery
|
|
49
|
+
});
|
|
50
|
+
function nestSandboxKitDiscovery(options = {}) {
|
|
51
|
+
const manifest = options.manifest ?? NEST_SANDBOX_KIT_MANIFEST;
|
|
52
|
+
return (0, import_kit2.sandboxKitDiscovery)({
|
|
53
|
+
root: (0, import_node_path.resolve)(options.root ?? process.cwd()),
|
|
54
|
+
descriptor: options.descriptor ?? NEST_SANDBOX_KIT_DESCRIPTOR,
|
|
55
|
+
...manifest !== false ? {
|
|
56
|
+
manifest: {
|
|
57
|
+
file: manifest.file,
|
|
58
|
+
outDir: manifest.outDir
|
|
59
|
+
}
|
|
60
|
+
} : {},
|
|
61
|
+
...options.kitUrl !== void 0 ? {
|
|
62
|
+
kitUrl: options.kitUrl
|
|
63
|
+
} : {},
|
|
64
|
+
...options.production !== void 0 ? {
|
|
65
|
+
production: options.production
|
|
66
|
+
} : {}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
var import_node_path, import_kit2, NEST_SANDBOX_KIT_MANIFEST;
|
|
70
|
+
var init_kit = __esm({
|
|
71
|
+
"src/genui/kit.ts"() {
|
|
72
|
+
"use strict";
|
|
73
|
+
import_node_path = require("path");
|
|
74
|
+
import_kit2 = require("@dudousxd/nestjs-agent-core/genui/kit");
|
|
75
|
+
init_vite();
|
|
76
|
+
NEST_SANDBOX_KIT_MANIFEST = Object.freeze({
|
|
77
|
+
file: "public/.vite/manifest.json",
|
|
78
|
+
outDir: "public"
|
|
79
|
+
});
|
|
80
|
+
__name(nestSandboxKitDiscovery, "nestSandboxKitDiscovery");
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
21
84
|
// src/durable/index.ts
|
|
22
85
|
var durable_exports = {};
|
|
23
86
|
__export(durable_exports, {
|
|
@@ -64,6 +127,7 @@ var AGENT_CHAT_QUEUE = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:chat-q
|
|
|
64
127
|
var import_nestjs_agent_core = require("@dudousxd/nestjs-agent-core");
|
|
65
128
|
var import_nestjs_agent_core2 = require("@dudousxd/nestjs-agent-core");
|
|
66
129
|
var import_nestjs_agent_core3 = require("@dudousxd/nestjs-agent-core");
|
|
130
|
+
var import_genui = require("@dudousxd/nestjs-agent-core/genui");
|
|
67
131
|
var import_nestjs_durable = require("@dudousxd/nestjs-durable");
|
|
68
132
|
var import_common = require("@nestjs/common");
|
|
69
133
|
|
|
@@ -140,6 +204,7 @@ var AgentRunSteps = class {
|
|
|
140
204
|
...input.preflightContext?.uiCapabilities !== void 0 ? {
|
|
141
205
|
uiCapabilities: input.preflightContext.uiCapabilities
|
|
142
206
|
} : {},
|
|
207
|
+
channel: (0, import_genui.turnChannel)(input.preflightContext?.pageContext),
|
|
143
208
|
...input.agentName !== void 0 ? {
|
|
144
209
|
agentName: input.agentName
|
|
145
210
|
} : {}
|
|
@@ -169,7 +234,8 @@ var AgentRunSteps = class {
|
|
|
169
234
|
} : {},
|
|
170
235
|
...input.preflightContext?.uiCapabilities !== void 0 ? {
|
|
171
236
|
uiCapabilities: input.preflightContext.uiCapabilities
|
|
172
|
-
} : {}
|
|
237
|
+
} : {},
|
|
238
|
+
channel: (0, import_genui.turnChannel)(input.preflightContext?.pageContext)
|
|
173
239
|
}));
|
|
174
240
|
const frames = (0, import_nestjs_agent_core3.observeTurnFrames)(previews.writer);
|
|
175
241
|
const turn = (0, import_nestjs_agent_core3.withTurnFrames)(await (0, import_nestjs_agent_core3.traceLlmTurn)(input.runId, input.step, () => deps.model.runTurn({
|
|
@@ -826,8 +892,8 @@ var InProcessTokenStreamSink = class {
|
|
|
826
892
|
return buf;
|
|
827
893
|
}
|
|
828
894
|
wake(buf) {
|
|
829
|
-
for (const
|
|
830
|
-
|
|
895
|
+
for (const resolve2 of buf.notify) {
|
|
896
|
+
resolve2();
|
|
831
897
|
}
|
|
832
898
|
buf.notify.clear();
|
|
833
899
|
}
|
|
@@ -866,7 +932,7 @@ var InProcessTokenStreamSink = class {
|
|
|
866
932
|
}
|
|
867
933
|
return;
|
|
868
934
|
}
|
|
869
|
-
await new Promise((
|
|
935
|
+
await new Promise((resolve2) => buf.notify.add(resolve2));
|
|
870
936
|
}
|
|
871
937
|
}
|
|
872
938
|
close(runId) {
|
|
@@ -1227,7 +1293,7 @@ var import_nestjs_agent_core11 = require("@dudousxd/nestjs-agent-core");
|
|
|
1227
1293
|
var import_common6 = require("@nestjs/common");
|
|
1228
1294
|
|
|
1229
1295
|
// src/genui/agent-genui.module.ts
|
|
1230
|
-
var
|
|
1296
|
+
var import_genui2 = require("@dudousxd/nestjs-agent-core/genui");
|
|
1231
1297
|
var import_common5 = require("@nestjs/common");
|
|
1232
1298
|
|
|
1233
1299
|
// src/functional-tool.ts
|
|
@@ -1254,6 +1320,26 @@ function provideAgentTools(factory, inject) {
|
|
|
1254
1320
|
}
|
|
1255
1321
|
__name(provideAgentTools, "provideAgentTools");
|
|
1256
1322
|
|
|
1323
|
+
// src/genui/agent-genui.token.ts
|
|
1324
|
+
var AGENT_GENUI = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:genui");
|
|
1325
|
+
var AgentGenui = class {
|
|
1326
|
+
static {
|
|
1327
|
+
__name(this, "AgentGenui");
|
|
1328
|
+
}
|
|
1329
|
+
catalog;
|
|
1330
|
+
resolveCatalog;
|
|
1331
|
+
channels;
|
|
1332
|
+
base;
|
|
1333
|
+
sandboxClient;
|
|
1334
|
+
constructor(catalog, resolveCatalog2, channels, base = {}, sandboxClient) {
|
|
1335
|
+
this.catalog = catalog;
|
|
1336
|
+
this.resolveCatalog = resolveCatalog2;
|
|
1337
|
+
this.channels = channels;
|
|
1338
|
+
this.base = base;
|
|
1339
|
+
this.sandboxClient = sandboxClient;
|
|
1340
|
+
}
|
|
1341
|
+
};
|
|
1342
|
+
|
|
1257
1343
|
// src/genui/agent-genui.module.ts
|
|
1258
1344
|
function _ts_decorate5(decorators, target, key, desc) {
|
|
1259
1345
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1271,6 +1357,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
1271
1357
|
__name(_ts_decorate5, "_ts_decorate");
|
|
1272
1358
|
var GENUI_CATALOG = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:genui-catalog");
|
|
1273
1359
|
var GENUI_OPTIONS = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:genui-options");
|
|
1360
|
+
var GENUI_RESOLVED = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:genui-resolved");
|
|
1274
1361
|
var GenuiCatalogResolver = class {
|
|
1275
1362
|
static {
|
|
1276
1363
|
__name(this, "GenuiCatalogResolver");
|
|
@@ -1289,39 +1376,150 @@ function resolverProviders(resolver) {
|
|
|
1289
1376
|
];
|
|
1290
1377
|
}
|
|
1291
1378
|
__name(resolverProviders, "resolverProviders");
|
|
1292
|
-
function
|
|
1293
|
-
const
|
|
1379
|
+
function mergeSandboxClients(clients) {
|
|
1380
|
+
const merged = {
|
|
1381
|
+
theme: false
|
|
1382
|
+
};
|
|
1383
|
+
for (const client of clients) {
|
|
1384
|
+
const one = client();
|
|
1385
|
+
merged.theme ||= one.theme;
|
|
1386
|
+
if (one.tailwind !== void 0) merged.tailwind ??= one.tailwind;
|
|
1387
|
+
if (one.kit !== void 0) merged.kit ??= one.kit;
|
|
1388
|
+
}
|
|
1389
|
+
return merged;
|
|
1390
|
+
}
|
|
1391
|
+
__name(mergeSandboxClients, "mergeSandboxClients");
|
|
1392
|
+
async function resolveGenui(options) {
|
|
1393
|
+
const { sandbox: asked, channels: askedChannels } = options;
|
|
1394
|
+
(0, import_genui2.assertGenuiChannels)(askedChannels);
|
|
1395
|
+
const clients = [];
|
|
1396
|
+
let discovery;
|
|
1397
|
+
const resolveSandbox = /* @__PURE__ */ __name(async (value) => {
|
|
1398
|
+
if (value === void 0 || value === false) return value;
|
|
1399
|
+
const [{ nestSandboxKitDiscovery: nestSandboxKitDiscovery2 }, { resolveSandboxServer }] = await Promise.all([
|
|
1400
|
+
Promise.resolve().then(() => (init_kit(), kit_exports)),
|
|
1401
|
+
import("@dudousxd/nestjs-agent-core/genui/kit")
|
|
1402
|
+
]);
|
|
1403
|
+
discovery ??= nestSandboxKitDiscovery2(options.sandboxKit);
|
|
1404
|
+
const resolved = resolveSandboxServer(value, discovery);
|
|
1405
|
+
clients.push(resolved.client);
|
|
1406
|
+
return resolved.define;
|
|
1407
|
+
}, "resolveSandbox");
|
|
1408
|
+
const sandbox = await resolveSandbox(asked);
|
|
1409
|
+
const own = options.catalog?.components.find((each) => (0, import_genui2.sandboxPolicyOf)(each) !== void 0);
|
|
1410
|
+
const ownOptions = asked === void 0 && own?.sandboxOptions !== void 0 && (own.sandboxView?.kit === true || own.sandboxView?.tailwind === true) ? await resolveSandbox({
|
|
1411
|
+
...own.sandboxOptions,
|
|
1412
|
+
name: own.name
|
|
1413
|
+
}) : void 0;
|
|
1414
|
+
let channels;
|
|
1415
|
+
if (askedChannels !== void 0) {
|
|
1416
|
+
channels = {};
|
|
1417
|
+
for (const [name, entry] of Object.entries(askedChannels)) {
|
|
1418
|
+
if (entry === void 0) continue;
|
|
1419
|
+
const own2 = await resolveSandbox(entry.sandbox);
|
|
1420
|
+
channels[name] = {
|
|
1421
|
+
...entry,
|
|
1422
|
+
...own2 !== void 0 ? {
|
|
1423
|
+
sandbox: own2
|
|
1424
|
+
} : {}
|
|
1425
|
+
};
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
return {
|
|
1429
|
+
...sandbox !== void 0 ? {
|
|
1430
|
+
sandbox
|
|
1431
|
+
} : {},
|
|
1432
|
+
...typeof ownOptions === "object" ? {
|
|
1433
|
+
catalogSandbox: ownOptions
|
|
1434
|
+
} : {},
|
|
1435
|
+
...channels !== void 0 ? {
|
|
1436
|
+
channels
|
|
1437
|
+
} : {},
|
|
1438
|
+
...clients.length > 0 ? {
|
|
1439
|
+
sandboxClient: /* @__PURE__ */ __name(() => mergeSandboxClients(clients), "sandboxClient")
|
|
1440
|
+
} : {}
|
|
1441
|
+
};
|
|
1442
|
+
}
|
|
1443
|
+
__name(resolveGenui, "resolveGenui");
|
|
1444
|
+
function perRequest(resolver) {
|
|
1445
|
+
return resolver === void 0 ? void 0 : (scope) => resolver.resolve(scope);
|
|
1446
|
+
}
|
|
1447
|
+
__name(perRequest, "perRequest");
|
|
1448
|
+
function toolOptions(options, resolved, resolver) {
|
|
1449
|
+
const { catalog: _catalog, sandbox: _sandbox, channels: _channels, sandboxKit: _sandboxKit, ...rest } = options;
|
|
1450
|
+
const resolveCatalog2 = perRequest(resolver);
|
|
1294
1451
|
return {
|
|
1295
1452
|
...rest,
|
|
1296
|
-
...
|
|
1297
|
-
|
|
1453
|
+
...resolved.channels !== void 0 ? {
|
|
1454
|
+
channels: resolved.channels
|
|
1455
|
+
} : {},
|
|
1456
|
+
...resolved.sandbox !== void 0 ? {
|
|
1457
|
+
sandbox: resolved.sandbox
|
|
1458
|
+
} : {},
|
|
1459
|
+
...resolveCatalog2 !== void 0 ? {
|
|
1460
|
+
resolveCatalog: resolveCatalog2
|
|
1298
1461
|
} : {}
|
|
1299
1462
|
};
|
|
1300
1463
|
}
|
|
1301
1464
|
__name(toolOptions, "toolOptions");
|
|
1302
|
-
function withSandbox(options) {
|
|
1303
|
-
const base = options.catalog ?? (0,
|
|
1304
|
-
const { sandbox } =
|
|
1305
|
-
|
|
1306
|
-
(0,
|
|
1465
|
+
function withSandbox(options, resolved) {
|
|
1466
|
+
const base = options.catalog ?? (0, import_genui2.defineCatalog)([]);
|
|
1467
|
+
const { sandbox, catalogSandbox } = resolved;
|
|
1468
|
+
if (sandbox === void 0 || sandbox === false) return catalogSandbox !== void 0 ? base.extend([
|
|
1469
|
+
(0, import_genui2.defineSandbox)(catalogSandbox)
|
|
1470
|
+
]) : base;
|
|
1471
|
+
return base.extend([
|
|
1472
|
+
(0, import_genui2.defineSandbox)(sandbox === true ? {} : sandbox)
|
|
1307
1473
|
]);
|
|
1308
1474
|
}
|
|
1309
1475
|
__name(withSandbox, "withSandbox");
|
|
1310
1476
|
function coreProviders(resolver) {
|
|
1311
1477
|
return [
|
|
1312
1478
|
{
|
|
1313
|
-
provide:
|
|
1314
|
-
useFactory: /* @__PURE__ */ __name((options) =>
|
|
1479
|
+
provide: GENUI_RESOLVED,
|
|
1480
|
+
useFactory: /* @__PURE__ */ __name((options) => resolveGenui(options), "useFactory"),
|
|
1315
1481
|
inject: [
|
|
1316
1482
|
GENUI_OPTIONS
|
|
1317
1483
|
]
|
|
1318
1484
|
},
|
|
1485
|
+
{
|
|
1486
|
+
provide: GENUI_CATALOG,
|
|
1487
|
+
useFactory: /* @__PURE__ */ __name((options, resolved) => withSandbox(options, resolved), "useFactory"),
|
|
1488
|
+
inject: [
|
|
1489
|
+
GENUI_OPTIONS,
|
|
1490
|
+
GENUI_RESOLVED
|
|
1491
|
+
]
|
|
1492
|
+
},
|
|
1493
|
+
{
|
|
1494
|
+
provide: AGENT_GENUI,
|
|
1495
|
+
useFactory: /* @__PURE__ */ __name((options, catalog, resolved, resolverInstance) => new AgentGenui(catalog, perRequest(resolverInstance), resolved.channels, {
|
|
1496
|
+
...options.mode !== void 0 ? {
|
|
1497
|
+
mode: options.mode
|
|
1498
|
+
} : {},
|
|
1499
|
+
...options.streaming !== void 0 ? {
|
|
1500
|
+
streaming: options.streaming
|
|
1501
|
+
} : {},
|
|
1502
|
+
...resolved.sandbox !== void 0 ? {
|
|
1503
|
+
sandbox: resolved.sandbox
|
|
1504
|
+
} : {}
|
|
1505
|
+
}, resolved.sandboxClient), "useFactory"),
|
|
1506
|
+
inject: [
|
|
1507
|
+
GENUI_OPTIONS,
|
|
1508
|
+
GENUI_CATALOG,
|
|
1509
|
+
GENUI_RESOLVED,
|
|
1510
|
+
{
|
|
1511
|
+
token: GenuiCatalogResolver,
|
|
1512
|
+
optional: true
|
|
1513
|
+
}
|
|
1514
|
+
]
|
|
1515
|
+
},
|
|
1319
1516
|
...resolverProviders(resolver),
|
|
1320
1517
|
// The generated tools, registered by the agent module's discovery like any `provideAgentTool`.
|
|
1321
1518
|
// Built from the injected catalog, so `overrideProvider(GENUI_CATALOG)` changes them too.
|
|
1322
|
-
provideAgentTools((options, catalog,
|
|
1519
|
+
provideAgentTools((options, catalog, resolved, perRequestResolver) => (0, import_genui2.genuiTools)(catalog, toolOptions(options, resolved, perRequestResolver)), [
|
|
1323
1520
|
GENUI_OPTIONS,
|
|
1324
1521
|
GENUI_CATALOG,
|
|
1522
|
+
GENUI_RESOLVED,
|
|
1325
1523
|
{
|
|
1326
1524
|
token: GenuiCatalogResolver,
|
|
1327
1525
|
optional: true
|
|
@@ -1332,7 +1530,8 @@ function coreProviders(resolver) {
|
|
|
1332
1530
|
__name(coreProviders, "coreProviders");
|
|
1333
1531
|
var EXPORTS = [
|
|
1334
1532
|
GENUI_CATALOG,
|
|
1335
|
-
GENUI_OPTIONS
|
|
1533
|
+
GENUI_OPTIONS,
|
|
1534
|
+
AGENT_GENUI
|
|
1336
1535
|
];
|
|
1337
1536
|
var AgentGenuiModule = class _AgentGenuiModule {
|
|
1338
1537
|
static {
|
|
@@ -1664,7 +1863,7 @@ var AgentDepsFactory2 = class {
|
|
|
1664
1863
|
id: persona.id,
|
|
1665
1864
|
label: persona.label
|
|
1666
1865
|
};
|
|
1667
|
-
const
|
|
1866
|
+
const resolve2 = /* @__PURE__ */ __name(async (prompt, ctx) => typeof prompt === "function" ? prompt(ctx) : prompt, "resolve");
|
|
1668
1867
|
const own = persona.systemPrompt;
|
|
1669
1868
|
const systemPrompt = /* @__PURE__ */ __name(async (ctx) => {
|
|
1670
1869
|
const scoped = {
|
|
@@ -1672,10 +1871,10 @@ var AgentDepsFactory2 = class {
|
|
|
1672
1871
|
persona: ref
|
|
1673
1872
|
};
|
|
1674
1873
|
if (own === void 0) {
|
|
1675
|
-
return
|
|
1874
|
+
return resolve2(base, scoped);
|
|
1676
1875
|
}
|
|
1677
|
-
const basePrompt = typeof own === "function" ? await
|
|
1678
|
-
return
|
|
1876
|
+
const basePrompt = typeof own === "function" ? await resolve2(base, scoped) : void 0;
|
|
1877
|
+
return resolve2(own, {
|
|
1679
1878
|
...scoped,
|
|
1680
1879
|
...basePrompt !== void 0 ? {
|
|
1681
1880
|
basePrompt
|
|
@@ -2574,8 +2773,16 @@ function sendableParams(params) {
|
|
|
2574
2773
|
message: "nothing to answer: send a non-empty message, an attachment, or regenerate"
|
|
2575
2774
|
});
|
|
2576
2775
|
}
|
|
2577
|
-
|
|
2578
|
-
|
|
2776
|
+
const { channel, ...rest } = params;
|
|
2777
|
+
const stamped = channel === void 0 ? params : {
|
|
2778
|
+
...rest,
|
|
2779
|
+
pageContext: {
|
|
2780
|
+
...params.pageContext,
|
|
2781
|
+
channel
|
|
2782
|
+
}
|
|
2783
|
+
};
|
|
2784
|
+
return text === message ? stamped : {
|
|
2785
|
+
...stamped,
|
|
2579
2786
|
message: text
|
|
2580
2787
|
};
|
|
2581
2788
|
}
|
|
@@ -4092,7 +4299,7 @@ AttachmentsController = _ts_decorate12([
|
|
|
4092
4299
|
|
|
4093
4300
|
// src/controller/chat.controller.ts
|
|
4094
4301
|
var import_nestjs_agent_core19 = require("@dudousxd/nestjs-agent-core");
|
|
4095
|
-
var
|
|
4302
|
+
var import_genui3 = require("@dudousxd/nestjs-agent-core/genui");
|
|
4096
4303
|
var import_common14 = require("@nestjs/common");
|
|
4097
4304
|
function _ts_decorate13(decorators, target, key, desc) {
|
|
4098
4305
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -4182,7 +4389,7 @@ var ChatController = class {
|
|
|
4182
4389
|
const mode = sendMode(body);
|
|
4183
4390
|
let uiCapabilities;
|
|
4184
4391
|
try {
|
|
4185
|
-
uiCapabilities = body.uiCapabilities === void 0 ? void 0 : (0,
|
|
4392
|
+
uiCapabilities = body.uiCapabilities === void 0 ? void 0 : (0, import_genui3.validateUiCapabilities)(body.uiCapabilities);
|
|
4186
4393
|
} catch {
|
|
4187
4394
|
throw new import_common14.BadRequestException("Invalid UI capabilities");
|
|
4188
4395
|
}
|
|
@@ -4497,11 +4704,13 @@ var ConfigController = class {
|
|
|
4497
4704
|
actorResolver;
|
|
4498
4705
|
staging;
|
|
4499
4706
|
models;
|
|
4500
|
-
|
|
4707
|
+
genui;
|
|
4708
|
+
constructor(options, actorResolver, staging, models, genui) {
|
|
4501
4709
|
this.options = options;
|
|
4502
4710
|
this.actorResolver = actorResolver;
|
|
4503
4711
|
this.staging = staging;
|
|
4504
4712
|
this.models = models;
|
|
4713
|
+
this.genui = genui;
|
|
4505
4714
|
}
|
|
4506
4715
|
async config(req) {
|
|
4507
4716
|
await this.actorResolver.resolve(req);
|
|
@@ -4515,7 +4724,12 @@ var ConfigController = class {
|
|
|
4515
4724
|
},
|
|
4516
4725
|
identity: {
|
|
4517
4726
|
anonymous: this.actorResolver instanceof AnonymousActorResolver
|
|
4518
|
-
}
|
|
4727
|
+
},
|
|
4728
|
+
...this.genui?.sandboxClient !== void 0 ? {
|
|
4729
|
+
genui: {
|
|
4730
|
+
sandbox: this.genui.sandboxClient()
|
|
4731
|
+
}
|
|
4732
|
+
} : {}
|
|
4519
4733
|
};
|
|
4520
4734
|
}
|
|
4521
4735
|
};
|
|
@@ -4536,11 +4750,14 @@ ConfigController = _ts_decorate14([
|
|
|
4536
4750
|
_ts_param12(2, (0, import_common15.Inject)(import_nestjs_agent_core20.AGENT_ATTACHMENT_STAGING)),
|
|
4537
4751
|
_ts_param12(3, (0, import_common15.Optional)()),
|
|
4538
4752
|
_ts_param12(3, (0, import_common15.Inject)(import_nestjs_agent_core20.AGENT_MODEL_CATALOG)),
|
|
4753
|
+
_ts_param12(4, (0, import_common15.Optional)()),
|
|
4754
|
+
_ts_param12(4, (0, import_common15.Inject)(AGENT_GENUI)),
|
|
4539
4755
|
_ts_metadata12("design:type", Function),
|
|
4540
4756
|
_ts_metadata12("design:paramtypes", [
|
|
4541
4757
|
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
4542
4758
|
typeof ActorResolver === "undefined" ? Object : ActorResolver,
|
|
4543
4759
|
Object,
|
|
4760
|
+
Object,
|
|
4544
4761
|
Object
|
|
4545
4762
|
])
|
|
4546
4763
|
], ConfigController);
|
|
@@ -6824,12 +7041,12 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6824
7041
|
}
|
|
6825
7042
|
const key = `${runId}:${toolCallId2}`;
|
|
6826
7043
|
let timer;
|
|
6827
|
-
const lapse = new Promise((
|
|
7044
|
+
const lapse = new Promise((resolve2) => {
|
|
6828
7045
|
timer = setTimeout(() => {
|
|
6829
7046
|
const entry = this.pending.get(key);
|
|
6830
7047
|
if (entry !== void 0) {
|
|
6831
7048
|
this.pending.delete(key);
|
|
6832
|
-
|
|
7049
|
+
resolve2({
|
|
6833
7050
|
approved: false,
|
|
6834
7051
|
expired: true
|
|
6835
7052
|
});
|
|
@@ -6843,9 +7060,9 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
6843
7060
|
]).finally(() => clearTimeout(timer));
|
|
6844
7061
|
}
|
|
6845
7062
|
park(runId, toolCallId2) {
|
|
6846
|
-
return new Promise((
|
|
7063
|
+
return new Promise((resolve2, reject) => {
|
|
6847
7064
|
this.pending.set(`${runId}:${toolCallId2}`, {
|
|
6848
|
-
resolve,
|
|
7065
|
+
resolve: resolve2,
|
|
6849
7066
|
reject
|
|
6850
7067
|
});
|
|
6851
7068
|
});
|