@dudousxd/nestjs-agent 1.30.0 → 1.31.1
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 +2 -2
- package/dist/a2ui/index.d.ts +2 -2
- package/dist/a2ui/index.js +203 -12
- package/dist/a2ui/index.js.map +1 -1
- package/dist/{chat-queue.service-Bk7DCKGV.d.cts → chat-queue.service-QIuTS-5c.d.cts} +11 -3
- package/dist/{chat-queue.service-B-fVOJGf.d.ts → chat-queue.service-wNWaoUN8.d.ts} +11 -3
- package/dist/durable/index.cjs +286 -44
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.d.cts +1 -1
- package/dist/durable/index.d.ts +1 -1
- package/dist/durable/index.js +279 -42
- 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 +68 -2
- package/dist/genui/index.d.ts +68 -2
- package/dist/genui/index.js +205 -12
- package/dist/genui/index.js.map +1 -1
- package/dist/{index-APh8WN3z.d.ts → index-DFKUTFfZ.d.ts} +8 -1
- package/dist/{index-D9EM7ivO.d.cts → index-DIFUEKPr.d.cts} +8 -1
- package/dist/index.cjs +276 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +273 -40
- 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/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 });
|
|
@@ -17,8 +22,66 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
22
|
return to;
|
|
18
23
|
};
|
|
19
24
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
26
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
27
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
28
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
29
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
30
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
|
+
mod
|
|
32
|
+
));
|
|
20
33
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
34
|
|
|
35
|
+
// src/vite/index.ts
|
|
36
|
+
var import_kit, NEST_SANDBOX_KIT_DESCRIPTOR;
|
|
37
|
+
var init_vite = __esm({
|
|
38
|
+
"src/vite/index.ts"() {
|
|
39
|
+
"use strict";
|
|
40
|
+
import_kit = require("@dudousxd/nestjs-agent-core/genui/kit");
|
|
41
|
+
NEST_SANDBOX_KIT_DESCRIPTOR = ".genui/sandbox-kit.json";
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// src/genui/kit.ts
|
|
46
|
+
var kit_exports = {};
|
|
47
|
+
__export(kit_exports, {
|
|
48
|
+
NEST_SANDBOX_KIT_MANIFEST: () => NEST_SANDBOX_KIT_MANIFEST,
|
|
49
|
+
nestSandboxKitDiscovery: () => nestSandboxKitDiscovery
|
|
50
|
+
});
|
|
51
|
+
function nestSandboxKitDiscovery(options = {}) {
|
|
52
|
+
const manifest = options.manifest ?? NEST_SANDBOX_KIT_MANIFEST;
|
|
53
|
+
return (0, import_kit2.sandboxKitDiscovery)({
|
|
54
|
+
root: (0, import_node_path.resolve)(options.root ?? process.cwd()),
|
|
55
|
+
descriptor: options.descriptor ?? NEST_SANDBOX_KIT_DESCRIPTOR,
|
|
56
|
+
...manifest !== false ? {
|
|
57
|
+
manifest: {
|
|
58
|
+
file: manifest.file,
|
|
59
|
+
outDir: manifest.outDir
|
|
60
|
+
}
|
|
61
|
+
} : {},
|
|
62
|
+
...options.kitUrl !== void 0 ? {
|
|
63
|
+
kitUrl: options.kitUrl
|
|
64
|
+
} : {},
|
|
65
|
+
...options.production !== void 0 ? {
|
|
66
|
+
production: options.production
|
|
67
|
+
} : {}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
var import_node_path, import_kit2, NEST_SANDBOX_KIT_MANIFEST;
|
|
71
|
+
var init_kit = __esm({
|
|
72
|
+
"src/genui/kit.ts"() {
|
|
73
|
+
"use strict";
|
|
74
|
+
import_node_path = require("path");
|
|
75
|
+
import_kit2 = require("@dudousxd/nestjs-agent-core/genui/kit");
|
|
76
|
+
init_vite();
|
|
77
|
+
NEST_SANDBOX_KIT_MANIFEST = Object.freeze({
|
|
78
|
+
file: "public/.vite/manifest.json",
|
|
79
|
+
outDir: "public"
|
|
80
|
+
});
|
|
81
|
+
__name(nestSandboxKitDiscovery, "nestSandboxKitDiscovery");
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
22
85
|
// src/index.ts
|
|
23
86
|
var index_exports = {};
|
|
24
87
|
__export(index_exports, {
|
|
@@ -143,6 +206,26 @@ function provideAgentTools(factory, inject) {
|
|
|
143
206
|
__name(provideAgentTools, "provideAgentTools");
|
|
144
207
|
var defineTool = import_nestjs_agent_core.createFunctionalTool;
|
|
145
208
|
|
|
209
|
+
// src/genui/agent-genui.token.ts
|
|
210
|
+
var AGENT_GENUI = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:genui");
|
|
211
|
+
var AgentGenui2 = class {
|
|
212
|
+
static {
|
|
213
|
+
__name(this, "AgentGenui");
|
|
214
|
+
}
|
|
215
|
+
catalog;
|
|
216
|
+
resolveCatalog;
|
|
217
|
+
channels;
|
|
218
|
+
base;
|
|
219
|
+
sandboxClient;
|
|
220
|
+
constructor(catalog, resolveCatalog2, channels, base = {}, sandboxClient) {
|
|
221
|
+
this.catalog = catalog;
|
|
222
|
+
this.resolveCatalog = resolveCatalog2;
|
|
223
|
+
this.channels = channels;
|
|
224
|
+
this.base = base;
|
|
225
|
+
this.sandboxClient = sandboxClient;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
146
229
|
// src/genui/agent-genui.module.ts
|
|
147
230
|
function _ts_decorate(decorators, target, key, desc) {
|
|
148
231
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -160,6 +243,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
160
243
|
__name(_ts_decorate, "_ts_decorate");
|
|
161
244
|
var GENUI_CATALOG = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:genui-catalog");
|
|
162
245
|
var GENUI_OPTIONS = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:genui-options");
|
|
246
|
+
var GENUI_RESOLVED = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:genui-resolved");
|
|
163
247
|
var GenuiCatalogResolver = class {
|
|
164
248
|
static {
|
|
165
249
|
__name(this, "GenuiCatalogResolver");
|
|
@@ -178,20 +262,99 @@ function resolverProviders(resolver) {
|
|
|
178
262
|
];
|
|
179
263
|
}
|
|
180
264
|
__name(resolverProviders, "resolverProviders");
|
|
181
|
-
function
|
|
182
|
-
const
|
|
265
|
+
function mergeSandboxClients(clients) {
|
|
266
|
+
const merged = {
|
|
267
|
+
theme: false
|
|
268
|
+
};
|
|
269
|
+
for (const client of clients) {
|
|
270
|
+
const one = client();
|
|
271
|
+
merged.theme ||= one.theme;
|
|
272
|
+
if (one.tailwind !== void 0) merged.tailwind ??= one.tailwind;
|
|
273
|
+
if (one.kit !== void 0) merged.kit ??= one.kit;
|
|
274
|
+
}
|
|
275
|
+
return merged;
|
|
276
|
+
}
|
|
277
|
+
__name(mergeSandboxClients, "mergeSandboxClients");
|
|
278
|
+
async function resolveGenui(options) {
|
|
279
|
+
const { sandbox: asked, channels: askedChannels } = options;
|
|
280
|
+
(0, import_genui.assertGenuiChannels)(askedChannels);
|
|
281
|
+
const clients = [];
|
|
282
|
+
let discovery;
|
|
283
|
+
const resolveSandbox = /* @__PURE__ */ __name(async (value) => {
|
|
284
|
+
if (value === void 0 || value === false) return value;
|
|
285
|
+
const [{ nestSandboxKitDiscovery: nestSandboxKitDiscovery2 }, { resolveSandboxServer }] = await Promise.all([
|
|
286
|
+
Promise.resolve().then(() => (init_kit(), kit_exports)),
|
|
287
|
+
import("@dudousxd/nestjs-agent-core/genui/kit")
|
|
288
|
+
]);
|
|
289
|
+
discovery ??= nestSandboxKitDiscovery2(options.sandboxKit);
|
|
290
|
+
const resolved = resolveSandboxServer(value, discovery);
|
|
291
|
+
clients.push(resolved.client);
|
|
292
|
+
return resolved.define;
|
|
293
|
+
}, "resolveSandbox");
|
|
294
|
+
const sandbox = await resolveSandbox(asked);
|
|
295
|
+
const own = options.catalog?.components.find((each) => (0, import_genui.sandboxPolicyOf)(each) !== void 0);
|
|
296
|
+
const ownOptions = asked === void 0 && own?.sandboxOptions !== void 0 && (own.sandboxView?.kit === true || own.sandboxView?.tailwind === true) ? await resolveSandbox({
|
|
297
|
+
...own.sandboxOptions,
|
|
298
|
+
name: own.name
|
|
299
|
+
}) : void 0;
|
|
300
|
+
let channels;
|
|
301
|
+
if (askedChannels !== void 0) {
|
|
302
|
+
channels = {};
|
|
303
|
+
for (const [name, entry] of Object.entries(askedChannels)) {
|
|
304
|
+
if (entry === void 0) continue;
|
|
305
|
+
const own2 = await resolveSandbox(entry.sandbox);
|
|
306
|
+
channels[name] = {
|
|
307
|
+
...entry,
|
|
308
|
+
...own2 !== void 0 ? {
|
|
309
|
+
sandbox: own2
|
|
310
|
+
} : {}
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return {
|
|
315
|
+
...sandbox !== void 0 ? {
|
|
316
|
+
sandbox
|
|
317
|
+
} : {},
|
|
318
|
+
...typeof ownOptions === "object" ? {
|
|
319
|
+
catalogSandbox: ownOptions
|
|
320
|
+
} : {},
|
|
321
|
+
...channels !== void 0 ? {
|
|
322
|
+
channels
|
|
323
|
+
} : {},
|
|
324
|
+
...clients.length > 0 ? {
|
|
325
|
+
sandboxClient: /* @__PURE__ */ __name(() => mergeSandboxClients(clients), "sandboxClient")
|
|
326
|
+
} : {}
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
__name(resolveGenui, "resolveGenui");
|
|
330
|
+
function perRequest(resolver) {
|
|
331
|
+
return resolver === void 0 ? void 0 : (scope) => resolver.resolve(scope);
|
|
332
|
+
}
|
|
333
|
+
__name(perRequest, "perRequest");
|
|
334
|
+
function toolOptions(options, resolved, resolver) {
|
|
335
|
+
const { catalog: _catalog, sandbox: _sandbox, channels: _channels, sandboxKit: _sandboxKit, ...rest } = options;
|
|
336
|
+
const resolveCatalog2 = perRequest(resolver);
|
|
183
337
|
return {
|
|
184
338
|
...rest,
|
|
185
|
-
...
|
|
186
|
-
|
|
339
|
+
...resolved.channels !== void 0 ? {
|
|
340
|
+
channels: resolved.channels
|
|
341
|
+
} : {},
|
|
342
|
+
...resolved.sandbox !== void 0 ? {
|
|
343
|
+
sandbox: resolved.sandbox
|
|
344
|
+
} : {},
|
|
345
|
+
...resolveCatalog2 !== void 0 ? {
|
|
346
|
+
resolveCatalog: resolveCatalog2
|
|
187
347
|
} : {}
|
|
188
348
|
};
|
|
189
349
|
}
|
|
190
350
|
__name(toolOptions, "toolOptions");
|
|
191
|
-
function withSandbox(options) {
|
|
351
|
+
function withSandbox(options, resolved) {
|
|
192
352
|
const base = options.catalog ?? (0, import_genui.defineCatalog)([]);
|
|
193
|
-
const { sandbox } =
|
|
194
|
-
|
|
353
|
+
const { sandbox, catalogSandbox } = resolved;
|
|
354
|
+
if (sandbox === void 0 || sandbox === false) return catalogSandbox !== void 0 ? base.extend([
|
|
355
|
+
(0, import_genui.defineSandbox)(catalogSandbox)
|
|
356
|
+
]) : base;
|
|
357
|
+
return base.extend([
|
|
195
358
|
(0, import_genui.defineSandbox)(sandbox === true ? {} : sandbox)
|
|
196
359
|
]);
|
|
197
360
|
}
|
|
@@ -199,18 +362,50 @@ __name(withSandbox, "withSandbox");
|
|
|
199
362
|
function coreProviders(resolver) {
|
|
200
363
|
return [
|
|
201
364
|
{
|
|
202
|
-
provide:
|
|
203
|
-
useFactory: /* @__PURE__ */ __name((options) =>
|
|
365
|
+
provide: GENUI_RESOLVED,
|
|
366
|
+
useFactory: /* @__PURE__ */ __name((options) => resolveGenui(options), "useFactory"),
|
|
204
367
|
inject: [
|
|
205
368
|
GENUI_OPTIONS
|
|
206
369
|
]
|
|
207
370
|
},
|
|
371
|
+
{
|
|
372
|
+
provide: GENUI_CATALOG,
|
|
373
|
+
useFactory: /* @__PURE__ */ __name((options, resolved) => withSandbox(options, resolved), "useFactory"),
|
|
374
|
+
inject: [
|
|
375
|
+
GENUI_OPTIONS,
|
|
376
|
+
GENUI_RESOLVED
|
|
377
|
+
]
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
provide: AGENT_GENUI,
|
|
381
|
+
useFactory: /* @__PURE__ */ __name((options, catalog, resolved, resolverInstance) => new AgentGenui2(catalog, perRequest(resolverInstance), resolved.channels, {
|
|
382
|
+
...options.mode !== void 0 ? {
|
|
383
|
+
mode: options.mode
|
|
384
|
+
} : {},
|
|
385
|
+
...options.streaming !== void 0 ? {
|
|
386
|
+
streaming: options.streaming
|
|
387
|
+
} : {},
|
|
388
|
+
...resolved.sandbox !== void 0 ? {
|
|
389
|
+
sandbox: resolved.sandbox
|
|
390
|
+
} : {}
|
|
391
|
+
}, resolved.sandboxClient), "useFactory"),
|
|
392
|
+
inject: [
|
|
393
|
+
GENUI_OPTIONS,
|
|
394
|
+
GENUI_CATALOG,
|
|
395
|
+
GENUI_RESOLVED,
|
|
396
|
+
{
|
|
397
|
+
token: GenuiCatalogResolver,
|
|
398
|
+
optional: true
|
|
399
|
+
}
|
|
400
|
+
]
|
|
401
|
+
},
|
|
208
402
|
...resolverProviders(resolver),
|
|
209
403
|
// The generated tools, registered by the agent module's discovery like any `provideAgentTool`.
|
|
210
404
|
// Built from the injected catalog, so `overrideProvider(GENUI_CATALOG)` changes them too.
|
|
211
|
-
provideAgentTools((options, catalog,
|
|
405
|
+
provideAgentTools((options, catalog, resolved, perRequestResolver) => (0, import_genui.genuiTools)(catalog, toolOptions(options, resolved, perRequestResolver)), [
|
|
212
406
|
GENUI_OPTIONS,
|
|
213
407
|
GENUI_CATALOG,
|
|
408
|
+
GENUI_RESOLVED,
|
|
214
409
|
{
|
|
215
410
|
token: GenuiCatalogResolver,
|
|
216
411
|
optional: true
|
|
@@ -221,7 +416,8 @@ function coreProviders(resolver) {
|
|
|
221
416
|
__name(coreProviders, "coreProviders");
|
|
222
417
|
var EXPORTS = [
|
|
223
418
|
GENUI_CATALOG,
|
|
224
|
-
GENUI_OPTIONS
|
|
419
|
+
GENUI_OPTIONS,
|
|
420
|
+
AGENT_GENUI
|
|
225
421
|
];
|
|
226
422
|
var AgentGenuiModule = class _AgentGenuiModule {
|
|
227
423
|
static {
|
|
@@ -318,7 +514,8 @@ var AgentDepsFactory2 = class {
|
|
|
318
514
|
memory;
|
|
319
515
|
uiCatalog;
|
|
320
516
|
uiCatalogResolver;
|
|
321
|
-
|
|
517
|
+
genui;
|
|
518
|
+
constructor(options, model, store, sink, rolesPolicy, registry, agents, promptContributors, pricingStore, skills, memory, uiCatalog, uiCatalogResolver, genui) {
|
|
322
519
|
this.options = options;
|
|
323
520
|
this.model = model;
|
|
324
521
|
this.store = store;
|
|
@@ -332,6 +529,7 @@ var AgentDepsFactory2 = class {
|
|
|
332
529
|
this.memory = memory;
|
|
333
530
|
this.uiCatalog = uiCatalog;
|
|
334
531
|
this.uiCatalogResolver = uiCatalogResolver;
|
|
532
|
+
this.genui = genui;
|
|
335
533
|
if (options.actionApprovalMode === "independent") (0, import_nestjs_agent_core2.assertIndependentActionCapabilities)(store, options.backgroundActorResolver);
|
|
336
534
|
}
|
|
337
535
|
/** The turn's memory seam, shared with the read-back endpoint. Undefined → memory is not configured. */
|
|
@@ -433,6 +631,30 @@ var AgentDepsFactory2 = class {
|
|
|
433
631
|
}
|
|
434
632
|
return deps;
|
|
435
633
|
}
|
|
634
|
+
/** The turn's UI catalog: the per-request resolver's, else the app's. */
|
|
635
|
+
resolveUiCatalog = /* @__PURE__ */ __name((scope) => {
|
|
636
|
+
const catalog = this.uiCatalogResolver?.resolve({
|
|
637
|
+
...scope,
|
|
638
|
+
...scope.actor.tenantRef !== void 0 ? {
|
|
639
|
+
tenant: scope.actor.tenantRef
|
|
640
|
+
} : {}
|
|
641
|
+
}) ?? this.uiCatalog;
|
|
642
|
+
if (!catalog) throw new Error("UI catalog unavailable");
|
|
643
|
+
return catalog;
|
|
644
|
+
}, "resolveUiCatalog");
|
|
645
|
+
#uiChannelGuide;
|
|
646
|
+
/** genui `channels`: what the model is told per channel. Built once; `undefined` without channels. */
|
|
647
|
+
uiChannelGuide() {
|
|
648
|
+
if (this.#uiChannelGuide === void 0) {
|
|
649
|
+
const channels = this.genui?.channels;
|
|
650
|
+
this.#uiChannelGuide = channels === void 0 || this.uiCatalog === void 0 && this.uiCatalogResolver === void 0 ? null : (0, import_nestjs_agent_core2.createToolUiChannelGuide)({
|
|
651
|
+
channels,
|
|
652
|
+
base: this.genui?.base ?? {},
|
|
653
|
+
resolveCatalog: this.resolveUiCatalog
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
return this.#uiChannelGuide ?? void 0;
|
|
657
|
+
}
|
|
436
658
|
forAgent(agentName) {
|
|
437
659
|
const name = agentName ?? this.defaultAgentName();
|
|
438
660
|
if (agentName !== void 0 && !this.agents.has(agentName)) {
|
|
@@ -448,6 +670,7 @@ var AgentDepsFactory2 = class {
|
|
|
448
670
|
const retrieval = this.options.retrieval;
|
|
449
671
|
const historyPolicy = this.historyPolicy(definition);
|
|
450
672
|
const ask = definition?.ask ?? this.options.ask;
|
|
673
|
+
const uiChannelGuide = this.uiChannelGuide();
|
|
451
674
|
return {
|
|
452
675
|
model: this.model,
|
|
453
676
|
store: this.store,
|
|
@@ -461,16 +684,10 @@ var AgentDepsFactory2 = class {
|
|
|
461
684
|
} : {},
|
|
462
685
|
registry: this.registry,
|
|
463
686
|
...this.uiCatalog !== void 0 || this.uiCatalogResolver !== void 0 ? {
|
|
464
|
-
resolveUiCatalog:
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
tenant: scope.actor.tenantRef
|
|
469
|
-
} : {}
|
|
470
|
-
}) ?? this.uiCatalog;
|
|
471
|
-
if (!catalog) throw new Error("UI catalog unavailable");
|
|
472
|
-
return catalog;
|
|
473
|
-
}, "resolveUiCatalog")
|
|
687
|
+
resolveUiCatalog: this.resolveUiCatalog
|
|
688
|
+
} : {},
|
|
689
|
+
...uiChannelGuide !== void 0 ? {
|
|
690
|
+
uiChannelGuide
|
|
474
691
|
} : {},
|
|
475
692
|
promptContributors: this.promptContributors,
|
|
476
693
|
systemPrompt: definition?.systemPrompt ?? this.options.systemPrompt ?? "You are a helpful assistant.",
|
|
@@ -553,7 +770,7 @@ var AgentDepsFactory2 = class {
|
|
|
553
770
|
id: persona.id,
|
|
554
771
|
label: persona.label
|
|
555
772
|
};
|
|
556
|
-
const
|
|
773
|
+
const resolve2 = /* @__PURE__ */ __name(async (prompt, ctx) => typeof prompt === "function" ? prompt(ctx) : prompt, "resolve");
|
|
557
774
|
const own = persona.systemPrompt;
|
|
558
775
|
const systemPrompt = /* @__PURE__ */ __name(async (ctx) => {
|
|
559
776
|
const scoped = {
|
|
@@ -561,10 +778,10 @@ var AgentDepsFactory2 = class {
|
|
|
561
778
|
persona: ref
|
|
562
779
|
};
|
|
563
780
|
if (own === void 0) {
|
|
564
|
-
return
|
|
781
|
+
return resolve2(base, scoped);
|
|
565
782
|
}
|
|
566
|
-
const basePrompt = typeof own === "function" ? await
|
|
567
|
-
return
|
|
783
|
+
const basePrompt = typeof own === "function" ? await resolve2(base, scoped) : void 0;
|
|
784
|
+
return resolve2(own, {
|
|
568
785
|
...scoped,
|
|
569
786
|
...basePrompt !== void 0 ? {
|
|
570
787
|
basePrompt
|
|
@@ -641,6 +858,8 @@ AgentDepsFactory2 = _ts_decorate2([
|
|
|
641
858
|
_ts_param(11, (0, import_common2.Optional)()),
|
|
642
859
|
_ts_param(11, (0, import_common2.Inject)(GENUI_CATALOG)),
|
|
643
860
|
_ts_param(12, (0, import_common2.Optional)()),
|
|
861
|
+
_ts_param(13, (0, import_common2.Optional)()),
|
|
862
|
+
_ts_param(13, (0, import_common2.Inject)(AGENT_GENUI)),
|
|
644
863
|
_ts_metadata("design:type", Function),
|
|
645
864
|
_ts_metadata("design:paramtypes", [
|
|
646
865
|
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
@@ -655,7 +874,8 @@ AgentDepsFactory2 = _ts_decorate2([
|
|
|
655
874
|
Object,
|
|
656
875
|
Object,
|
|
657
876
|
typeof Catalog === "undefined" ? Object : Catalog,
|
|
658
|
-
typeof GenuiCatalogResolver === "undefined" ? Object : GenuiCatalogResolver
|
|
877
|
+
typeof GenuiCatalogResolver === "undefined" ? Object : GenuiCatalogResolver,
|
|
878
|
+
typeof AgentGenui === "undefined" ? Object : AgentGenui
|
|
659
879
|
])
|
|
660
880
|
], AgentDepsFactory2);
|
|
661
881
|
|
|
@@ -1485,8 +1705,16 @@ function sendableParams(params) {
|
|
|
1485
1705
|
message: "nothing to answer: send a non-empty message, an attachment, or regenerate"
|
|
1486
1706
|
});
|
|
1487
1707
|
}
|
|
1488
|
-
|
|
1489
|
-
|
|
1708
|
+
const { channel, ...rest } = params;
|
|
1709
|
+
const stamped = channel === void 0 ? params : {
|
|
1710
|
+
...rest,
|
|
1711
|
+
pageContext: {
|
|
1712
|
+
...params.pageContext,
|
|
1713
|
+
channel
|
|
1714
|
+
}
|
|
1715
|
+
};
|
|
1716
|
+
return text === message ? stamped : {
|
|
1717
|
+
...stamped,
|
|
1490
1718
|
message: text
|
|
1491
1719
|
};
|
|
1492
1720
|
}
|
|
@@ -3408,11 +3636,13 @@ var ConfigController = class {
|
|
|
3408
3636
|
actorResolver;
|
|
3409
3637
|
staging;
|
|
3410
3638
|
models;
|
|
3411
|
-
|
|
3639
|
+
genui;
|
|
3640
|
+
constructor(options, actorResolver, staging, models, genui) {
|
|
3412
3641
|
this.options = options;
|
|
3413
3642
|
this.actorResolver = actorResolver;
|
|
3414
3643
|
this.staging = staging;
|
|
3415
3644
|
this.models = models;
|
|
3645
|
+
this.genui = genui;
|
|
3416
3646
|
}
|
|
3417
3647
|
async config(req) {
|
|
3418
3648
|
await this.actorResolver.resolve(req);
|
|
@@ -3426,7 +3656,12 @@ var ConfigController = class {
|
|
|
3426
3656
|
},
|
|
3427
3657
|
identity: {
|
|
3428
3658
|
anonymous: this.actorResolver instanceof AnonymousActorResolver
|
|
3429
|
-
}
|
|
3659
|
+
},
|
|
3660
|
+
...this.genui?.sandboxClient !== void 0 ? {
|
|
3661
|
+
genui: {
|
|
3662
|
+
sandbox: this.genui.sandboxClient()
|
|
3663
|
+
}
|
|
3664
|
+
} : {}
|
|
3430
3665
|
};
|
|
3431
3666
|
}
|
|
3432
3667
|
};
|
|
@@ -3447,11 +3682,14 @@ ConfigController = _ts_decorate10([
|
|
|
3447
3682
|
_ts_param9(2, (0, import_common11.Inject)(import_nestjs_agent_core13.AGENT_ATTACHMENT_STAGING)),
|
|
3448
3683
|
_ts_param9(3, (0, import_common11.Optional)()),
|
|
3449
3684
|
_ts_param9(3, (0, import_common11.Inject)(import_nestjs_agent_core13.AGENT_MODEL_CATALOG)),
|
|
3685
|
+
_ts_param9(4, (0, import_common11.Optional)()),
|
|
3686
|
+
_ts_param9(4, (0, import_common11.Inject)(AGENT_GENUI)),
|
|
3450
3687
|
_ts_metadata9("design:type", Function),
|
|
3451
3688
|
_ts_metadata9("design:paramtypes", [
|
|
3452
3689
|
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
3453
3690
|
typeof ActorResolver === "undefined" ? Object : ActorResolver,
|
|
3454
3691
|
Object,
|
|
3692
|
+
Object,
|
|
3455
3693
|
Object
|
|
3456
3694
|
])
|
|
3457
3695
|
], ConfigController);
|
|
@@ -5133,8 +5371,8 @@ var InProcessTokenStreamSink = class {
|
|
|
5133
5371
|
return buf;
|
|
5134
5372
|
}
|
|
5135
5373
|
wake(buf) {
|
|
5136
|
-
for (const
|
|
5137
|
-
|
|
5374
|
+
for (const resolve2 of buf.notify) {
|
|
5375
|
+
resolve2();
|
|
5138
5376
|
}
|
|
5139
5377
|
buf.notify.clear();
|
|
5140
5378
|
}
|
|
@@ -5173,7 +5411,7 @@ var InProcessTokenStreamSink = class {
|
|
|
5173
5411
|
}
|
|
5174
5412
|
return;
|
|
5175
5413
|
}
|
|
5176
|
-
await new Promise((
|
|
5414
|
+
await new Promise((resolve2) => buf.notify.add(resolve2));
|
|
5177
5415
|
}
|
|
5178
5416
|
}
|
|
5179
5417
|
close(runId) {
|
|
@@ -5850,12 +6088,12 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
5850
6088
|
}
|
|
5851
6089
|
const key = `${runId}:${toolCallId2}`;
|
|
5852
6090
|
let timer;
|
|
5853
|
-
const lapse = new Promise((
|
|
6091
|
+
const lapse = new Promise((resolve2) => {
|
|
5854
6092
|
timer = setTimeout(() => {
|
|
5855
6093
|
const entry = this.pending.get(key);
|
|
5856
6094
|
if (entry !== void 0) {
|
|
5857
6095
|
this.pending.delete(key);
|
|
5858
|
-
|
|
6096
|
+
resolve2({
|
|
5859
6097
|
approved: false,
|
|
5860
6098
|
expired: true
|
|
5861
6099
|
});
|
|
@@ -5869,9 +6107,9 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
5869
6107
|
]).finally(() => clearTimeout(timer));
|
|
5870
6108
|
}
|
|
5871
6109
|
park(runId, toolCallId2) {
|
|
5872
|
-
return new Promise((
|
|
6110
|
+
return new Promise((resolve2, reject) => {
|
|
5873
6111
|
this.pending.set(`${runId}:${toolCallId2}`, {
|
|
5874
|
-
resolve,
|
|
6112
|
+
resolve: resolve2,
|
|
5875
6113
|
reject
|
|
5876
6114
|
});
|
|
5877
6115
|
});
|