@uipath/maestro-builder-sdk 6.88.1 → 6.88.3
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/api-index.md +36 -35
- package/dist/api-members.md +166 -164
- package/dist/case/case-sdk.d.ts +1 -0
- package/dist/case/case-sdk.js +1 -0
- package/dist/case/check.js +12 -4
- package/dist/case/document-extraction-saved.d.ts +50 -1
- package/dist/case/document-extraction-saved.js +106 -4
- package/dist/case/http-request.js +17 -2
- package/dist/case/plan-check/rules/tasks.js +7 -2
- package/dist/case/serialize.js +8 -3
- package/dist/check.js +1 -1
- package/dist/core/actions.d.ts +16 -2
- package/dist/core/event-subscription.d.ts +1 -1
- package/dist/core/event-subscription.js +1 -1
- package/dist/core/refusals.d.ts +31 -29
- package/dist/core/refusals.js +33 -30
- package/dist/decompile.js +9 -4
- package/dist/flow-node-type.d.ts +14 -6
- package/dist/nodes/agent/flow/check.d.ts +9 -1
- package/dist/nodes/agent/flow/check.js +132 -118
- package/dist/nodes/agent/flow/inline-agent-lift.d.ts +13 -0
- package/dist/nodes/agent/flow/inline-agent-lift.js +168 -50
- package/dist/nodes/agent/flow/inline-agent.d.ts +21 -1
- package/dist/nodes/agent/flow/inline-agent.js +97 -68
- package/dist/nodes/agent/flow/node-type.js +39 -7
- package/dist/nodes/agent/flow/resources.d.ts +15 -2
- package/dist/nodes/agent/flow/resources.js +36 -5
- package/dist/nodes/agent/flow/spec.d.ts +25 -4
- package/dist/serialize.js +5 -5
- package/package.json +2 -2
|
@@ -20,8 +20,112 @@ import { formFieldRowLoss, formFieldRowLossMessage, formFieldSettingsSource, lif
|
|
|
20
20
|
import { ownEntry } from '../../../core/own-entry.js';
|
|
21
21
|
import { tsKey as key, tsLiteral, tsNumber, tsObject as objLit, tsOptions as opts, tsText } from '../../../core/ts-literal.js';
|
|
22
22
|
import { wireExprBody } from '../../../core/wire-expr.js';
|
|
23
|
+
import { BUILTIN_TOOL_DEFS, escalationDef, voiceAgentRevision } from './resources.js';
|
|
23
24
|
/** Where the agent's own `inputs` go in the option list: the printer writes them, as expressions. */
|
|
24
25
|
const INPUT_ROWS = Symbol('inputs');
|
|
26
|
+
/** The per-instance resource tool kinds (process / api / flow / maestro / agent / function), by node-type prefix. */
|
|
27
|
+
const PROCESS_NS = [
|
|
28
|
+
['uipath.agent.resource.tool.processorchestration.', 'maestro'],
|
|
29
|
+
['uipath.agent.resource.tool.process.', 'process'],
|
|
30
|
+
['uipath.agent.resource.tool.function.', 'function'],
|
|
31
|
+
['uipath.agent.resource.tool.api.', 'api'],
|
|
32
|
+
['uipath.agent.resource.tool.flow.', 'flow'],
|
|
33
|
+
['uipath.agent.resource.tool.agent.', 'agent'],
|
|
34
|
+
];
|
|
35
|
+
/**
|
|
36
|
+
* Which tool nodes on an agent of type `agentType` the lift can write as a
|
|
37
|
+
* `tools` entry. Only tools compile writes back to the same node, at the same
|
|
38
|
+
* version, are claimed; any other edge stays reported as dropped. Compile
|
|
39
|
+
* writes the HTTP request tool at 1.0 and a bundled built-in at its
|
|
40
|
+
* definition's version (1.1, or 1.2 on a voice agent); `BuiltinToolRef` has no
|
|
41
|
+
* version to carry another.
|
|
42
|
+
*/
|
|
43
|
+
function liftableToolFor(agentType) {
|
|
44
|
+
const builtinVersion = (def) => (agentType === VOICE_AGENT_TYPE ? voiceAgentRevision(def).version : def.version);
|
|
45
|
+
return (n) => {
|
|
46
|
+
const t = n.type;
|
|
47
|
+
if (t === 'uipath.agent.resource.tool.builtin.httprequest')
|
|
48
|
+
return String(n.typeVersion ?? '') === '1.0';
|
|
49
|
+
if (t.startsWith(BUILTIN_PREFIX)) {
|
|
50
|
+
const def = ownEntry(BUILTIN_TOOL_DEFS, t.slice(BUILTIN_PREFIX.length));
|
|
51
|
+
return def !== undefined && String(n.typeVersion ?? '') === builtinVersion(def);
|
|
52
|
+
}
|
|
53
|
+
return t === 'uipath.agent.resource.tool.clientside'
|
|
54
|
+
|| ['mcp.', 'a2a.', 'ixp.'].some((k) => t.startsWith(`uipath.agent.resource.tool.${k}`))
|
|
55
|
+
|| PROCESS_NS.some(([prefix]) => t.startsWith(prefix));
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Which escalation nodes on an agent of type `agentType` the lift can write as
|
|
60
|
+
* an `escalation` entry, by the same rule as `liftableToolFor`: the quick-form
|
|
61
|
+
* at 1.2, and the app escalation at the version compile writes for this agent
|
|
62
|
+
* (1.1, or 1.2 on a voice agent).
|
|
63
|
+
*/
|
|
64
|
+
function liftableEscalationFor(agentType) {
|
|
65
|
+
const appVersion = agentType === VOICE_AGENT_TYPE ? voiceAgentRevision(escalationDef()).version : escalationDef().version;
|
|
66
|
+
return (n) => {
|
|
67
|
+
const v = String(n.typeVersion ?? '');
|
|
68
|
+
if (n.type === QUICK_FORM_ESCALATION)
|
|
69
|
+
return v === '1.2';
|
|
70
|
+
return n.type === 'uipath.agent.resource.escalation.coded-action-app' && v === appVersion;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const QUICK_FORM_ESCALATION = 'uipath.agent.resource.escalation.quick-form';
|
|
74
|
+
const BUILTIN_PREFIX = 'uipath.agent.resource.tool.builtin.';
|
|
75
|
+
const VOICE_AGENT_TYPE = 'uipath.agent.voice';
|
|
76
|
+
/**
|
|
77
|
+
* A client-side tool's schema as the factory's options: `inputs` when every
|
|
78
|
+
* property is a bare `{ type }` (all `fieldSchema` writes), else the whole
|
|
79
|
+
* schema as `inputSchema`, so property descriptions, `items` and `required`
|
|
80
|
+
* survive. Nothing for the definition's empty default.
|
|
81
|
+
*/
|
|
82
|
+
function clientsideSchema(v, fields, whole) {
|
|
83
|
+
if (v === undefined || v === null || typeof v !== 'object')
|
|
84
|
+
return [];
|
|
85
|
+
const s = v;
|
|
86
|
+
const props = s.properties && typeof s.properties === 'object' ? s.properties : undefined;
|
|
87
|
+
const keys = Object.keys(s);
|
|
88
|
+
if (s.type === 'object' && props !== undefined && keys.every((k) => k === 'type' || k === 'properties')) {
|
|
89
|
+
if (Object.keys(props).length === 0)
|
|
90
|
+
return [];
|
|
91
|
+
const plain = Object.values(props).every((p) => p !== null && typeof p === 'object'
|
|
92
|
+
&& Object.keys(p).length === 1 && typeof p.type === 'string');
|
|
93
|
+
if (plain)
|
|
94
|
+
return [[fields, objLit(Object.entries(props).map(([k, p]) => [k, tsLiteral(p.type)]))]];
|
|
95
|
+
}
|
|
96
|
+
return [[whole, dataSource(v)]];
|
|
97
|
+
}
|
|
98
|
+
const FIELD_TYPES = new Set(['string', 'number', 'integer', 'boolean', 'object', 'array']);
|
|
99
|
+
/**
|
|
100
|
+
* A tool's JSON schema as a `{ name: type }` map (`ProcessToolRef.inputs` /
|
|
101
|
+
* `returns`), or nothing for an empty one. The map carries only each
|
|
102
|
+
* property's `type`, so anything else the schema says (a property's
|
|
103
|
+
* `description` or `items`, a type it cannot name) is reported as lost.
|
|
104
|
+
* `required` is not: compile marks every input required.
|
|
105
|
+
*/
|
|
106
|
+
function fieldTypes(v, what, ctx) {
|
|
107
|
+
if (v === undefined || v === null || typeof v !== 'object' || Array.isArray(v))
|
|
108
|
+
return undefined;
|
|
109
|
+
const s = v;
|
|
110
|
+
const props = s.properties !== null && typeof s.properties === 'object' && !Array.isArray(s.properties)
|
|
111
|
+
? s.properties : {};
|
|
112
|
+
const lost = Object.keys(s).filter((k) => k !== 'type' && k !== 'properties' && k !== 'required');
|
|
113
|
+
const rows = [];
|
|
114
|
+
for (const [name, p] of Object.entries(props)) {
|
|
115
|
+
const type = p !== null && typeof p === 'object' ? p.type : undefined;
|
|
116
|
+
if (typeof type !== 'string' || !FIELD_TYPES.has(type)) {
|
|
117
|
+
lost.push(`${name} (type ${JSON.stringify(type)})`);
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
rows.push([name, tsLiteral(type)]);
|
|
121
|
+
for (const k of Object.keys(p))
|
|
122
|
+
if (k !== 'type')
|
|
123
|
+
lost.push(`${name}.${k}`);
|
|
124
|
+
}
|
|
125
|
+
if (lost.length > 0)
|
|
126
|
+
ctx.lossy(`${what}: the source keeps only each property's type, so ${lost.join(', ')} ${lost.length === 1 ? 'is' : 'are'} dropped.`);
|
|
127
|
+
return rows.length ? objLit(rows) : undefined;
|
|
128
|
+
}
|
|
25
129
|
/** Plain JSON data as source, in the `{ k: v }` / `[a, b]` spelling (a form field's `options`, `rules`, `defaultValue`). */
|
|
26
130
|
function dataSource(v) {
|
|
27
131
|
if (Array.isArray(v))
|
|
@@ -55,7 +159,7 @@ function dataSource(v) {
|
|
|
55
159
|
*/
|
|
56
160
|
function contextIndexIdentity(agent, c, rPlain, ctx) {
|
|
57
161
|
const fromType = parseContextIndexType(c.type);
|
|
58
|
-
const sidecar =
|
|
162
|
+
const sidecar = resourceSidecar(agent, c, ctx, 'context index');
|
|
59
163
|
const sidecarText = (k) => typeof sidecar?.[k] === 'string' && sidecar[k] !== '' ? sidecar[k] : undefined;
|
|
60
164
|
const label = typeof c.display?.label === 'string' && c.display.label !== '' ? c.display.label : undefined;
|
|
61
165
|
// The canvas can set both sidecar `name` and `indexName`, and they can differ.
|
|
@@ -215,7 +319,7 @@ function contextIndexSettings(agent, c, sidecar, ctx) {
|
|
|
215
319
|
* A context resource's `resource.json` sidecar, parsed; `undefined` when it is
|
|
216
320
|
* not beside the `.flow`, or (with a warning) when it is not a JSON object.
|
|
217
321
|
*/
|
|
218
|
-
function
|
|
322
|
+
function resourceSidecar(agent, c, ctx, what) {
|
|
219
323
|
const agentSource = ctx.sourceText(agent.inputs?.source);
|
|
220
324
|
const resourceSource = ctx.sourceText(c.inputs?.source);
|
|
221
325
|
if (!agentSource || !resourceSource)
|
|
@@ -232,7 +336,7 @@ function contextResourceSidecar(agent, c, ctx) {
|
|
|
232
336
|
catch {
|
|
233
337
|
// Reported below with the non-object case.
|
|
234
338
|
}
|
|
235
|
-
ctx.warn(
|
|
339
|
+
ctx.warn(`${what} "${c.id}": ${path} is not valid JSON, so the resource decompiles from the node.`);
|
|
236
340
|
return undefined;
|
|
237
341
|
}
|
|
238
342
|
/**
|
|
@@ -301,10 +405,49 @@ export function liftInlineAgent(node, ctx) {
|
|
|
301
405
|
const returns = outVars.length
|
|
302
406
|
? objLit(outVars.map((v) => [String(v.id ?? ''), tsLiteral(String(v.type ?? 'string'))]))
|
|
303
407
|
: undefined;
|
|
408
|
+
const resources = liftAgentResources(node, ctx, true);
|
|
409
|
+
const guardrails = Array.isArray(i.guardrails) && i.guardrails.length > 0
|
|
410
|
+
? JSON.stringify(i.guardrails)
|
|
411
|
+
: undefined;
|
|
412
|
+
return { kind: 'inlineAgent', inputs: { inputRows, options: [
|
|
413
|
+
['model', tsLiteral(plain(i.model) ?? '')],
|
|
414
|
+
['systemPrompt', promptSrc(i.systemPrompt) ?? tsLiteral('')],
|
|
415
|
+
['userPrompt', promptSrc(i.userPrompt) ?? tsLiteral('')],
|
|
416
|
+
['inputs', INPUT_ROWS],
|
|
417
|
+
['returns', returns],
|
|
418
|
+
['temperature', num(i.temperature)],
|
|
419
|
+
['maxTokenPerResponse', num(i.maxTokenPerResponse)],
|
|
420
|
+
['maxIterations', num(i.maxIterations)],
|
|
421
|
+
['mode', plain(i.mode) !== undefined ? tsLiteral(plain(i.mode)) : undefined],
|
|
422
|
+
['guardrails', guardrails],
|
|
423
|
+
['context', resources.context],
|
|
424
|
+
['tools', resources.tools],
|
|
425
|
+
['escalation', resources.escalation],
|
|
426
|
+
['memory', resources.memory],
|
|
427
|
+
// The agent's directory uuid is derived from the flow and step ids, but a
|
|
428
|
+
// decompiled flow must keep the ORIGINAL — the sidecar lives at
|
|
429
|
+
// `<source>/agent.json`, so a re-derived one would point at nothing.
|
|
430
|
+
['source', tsLiteral(plain(i.source) ?? '')],
|
|
431
|
+
] } };
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* The resources on an agent's artifact handles, as the factory's `context`,
|
|
435
|
+
* `tools`, `escalation` and `memory` options in source: the inline agent's, and
|
|
436
|
+
* the voice and conversational agents', which take the same three
|
|
437
|
+
* resources but no memory. With `withMemory` false a `memory` edge is left
|
|
438
|
+
* unclaimed, so decompile reports it as an edge the source cannot spell.
|
|
439
|
+
*/
|
|
440
|
+
export function liftAgentResources(node, ctx, withMemory) {
|
|
441
|
+
const num = (v) => {
|
|
442
|
+
const raw = ctx.plainValue(v);
|
|
443
|
+
return typeof raw === 'number' ? String(raw) : undefined;
|
|
444
|
+
};
|
|
445
|
+
const liftable = liftableToolFor(node.type);
|
|
446
|
+
const liftableEscalation = liftableEscalationFor(node.type);
|
|
304
447
|
// The resources, from the agent's own artifact edges. Each edge read here is
|
|
305
448
|
// carried by the agent spec (edge accounting, #1125); `limit` is for a port
|
|
306
449
|
// the spec carries only one resource on.
|
|
307
|
-
const resource = (port, limit = Infinity) => ctx.attached(port, limit);
|
|
450
|
+
const resource = (port, limit = Infinity, accept) => ctx.attached(port, limit, accept);
|
|
308
451
|
// Record what compile will call each folded resource node. Serialize mints
|
|
309
452
|
// `uid(scope, \`${step.name}<Kind>\`)` per resource, in spec order, and the
|
|
310
453
|
// spec order is this edge order: the first is `<agent><Kind>`, the n-th
|
|
@@ -322,9 +465,9 @@ export function liftInlineAgent(node, ctx) {
|
|
|
322
465
|
const keepIds = new Set();
|
|
323
466
|
for (const [port, kind, emittedCount] of [
|
|
324
467
|
['context', 'Context', Infinity], ['tool', 'Tool', Infinity],
|
|
325
|
-
['escalation', 'Escalation', Infinity], ['memory', 'Memory', 1],
|
|
468
|
+
['escalation', 'Escalation', Infinity], ...(withMemory ? [['memory', 'Memory', 1]] : []),
|
|
326
469
|
]) {
|
|
327
|
-
const targets = ctx.attachedIds(port);
|
|
470
|
+
const targets = ctx.attachedIds(port, port === 'tool' ? liftable : port === 'escalation' ? liftableEscalation : undefined);
|
|
328
471
|
const keep = port !== 'memory'
|
|
329
472
|
&& targets.some((id, k) => id !== derivedResourceNodeId(node.id, kind, k));
|
|
330
473
|
targets.forEach((id, k) => {
|
|
@@ -352,22 +495,16 @@ export function liftInlineAgent(node, ctx) {
|
|
|
352
495
|
const raw = ctx.sourceText(rInputs(n)[k]);
|
|
353
496
|
return raw === undefined || raw === '' ? undefined : raw;
|
|
354
497
|
};
|
|
355
|
-
const toolSrc =
|
|
498
|
+
const toolSrc = ctx.attached('tool', Infinity, liftable).map((t) => {
|
|
356
499
|
const ti = rInputs(t);
|
|
357
500
|
const type = t.type;
|
|
358
501
|
if (type === 'uipath.agent.resource.tool.clientside') {
|
|
359
|
-
const schemaTypes = (v) => {
|
|
360
|
-
const props = v?.properties;
|
|
361
|
-
if (!props || Object.keys(props).length === 0)
|
|
362
|
-
return undefined;
|
|
363
|
-
return objLit(Object.entries(props).map(([k, x]) => [k, tsLiteral(String(x?.type ?? 'string'))]));
|
|
364
|
-
};
|
|
365
502
|
return toolOpts(t, { kind: 'clientside', name: rPlain(t, 'name') ?? '' }, [
|
|
366
503
|
['kind', tsLiteral('clientside')],
|
|
367
504
|
['name', tsLiteral(rPlain(t, 'name') ?? '')],
|
|
368
505
|
['description', rPlain(t, 'description') !== undefined ? tsLiteral(rPlain(t, 'description')) : undefined],
|
|
369
|
-
|
|
370
|
-
|
|
506
|
+
...clientsideSchema(ti.inputSchema, 'inputs', 'inputSchema'),
|
|
507
|
+
...clientsideSchema(ti.outputSchema, 'returns', 'outputSchema'),
|
|
371
508
|
]);
|
|
372
509
|
}
|
|
373
510
|
if (type === 'uipath.agent.resource.tool.builtin.httprequest') {
|
|
@@ -426,14 +563,6 @@ export function liftInlineAgent(node, ctx) {
|
|
|
426
563
|
}
|
|
427
564
|
// The per-instance resource kinds (process / api / flow / maestro / agent /
|
|
428
565
|
// function): the key is the node type's tail, the rest is a binding pair.
|
|
429
|
-
const PROCESS_NS = [
|
|
430
|
-
['uipath.agent.resource.tool.processorchestration.', 'maestro'],
|
|
431
|
-
['uipath.agent.resource.tool.process.', 'process'],
|
|
432
|
-
['uipath.agent.resource.tool.function.', 'function'],
|
|
433
|
-
['uipath.agent.resource.tool.api.', 'api'],
|
|
434
|
-
['uipath.agent.resource.tool.flow.', 'flow'],
|
|
435
|
-
['uipath.agent.resource.tool.agent.', 'agent'],
|
|
436
|
-
];
|
|
437
566
|
const ns = PROCESS_NS.find(([prefix]) => type.startsWith(prefix));
|
|
438
567
|
if (ns) {
|
|
439
568
|
const def = ctx.definitionOf(t);
|
|
@@ -443,14 +572,25 @@ export function liftInlineAgent(node, ctx) {
|
|
|
443
572
|
return typeof row?.default === 'string' ? row.default : undefined;
|
|
444
573
|
};
|
|
445
574
|
const key = type.slice(ns[0].length);
|
|
575
|
+
// The tool's contract: compile writes `inputs` / `returns` as the
|
|
576
|
+
// definition's `inputDefaults.inputSchema` / `outputSchema` and the
|
|
577
|
+
// resource.json's, and `description` only into the resource.json.
|
|
578
|
+
const sidecar = resourceSidecar(node, t, ctx, `${ns[1]} tool`);
|
|
579
|
+
const defaults = (def?.inputDefaults ?? {});
|
|
580
|
+
const what = `${ns[1]} tool ${JSON.stringify(t.id)} on agent ${JSON.stringify(node.id)}`;
|
|
581
|
+
const description = typeof sidecar?.description === 'string' && sidecar.description !== '' ? sidecar.description : undefined;
|
|
446
582
|
return toolOpts(t, { kind: 'process', name: '', folderPath: '', key }, [
|
|
447
583
|
['kind', tsLiteral(ns[1])],
|
|
448
584
|
['key', tsLiteral(key)],
|
|
449
585
|
['name', tsLiteral(bound('name') ?? rPlain(t, 'name') ?? '')],
|
|
450
586
|
['folderPath', tsLiteral(bound('folderPath') ?? '')],
|
|
587
|
+
['description', description !== undefined ? tsLiteral(description) : undefined],
|
|
588
|
+
['inputs', fieldTypes(defaults.inputSchema ?? sidecar?.inputSchema, `${what}'s inputSchema`, ctx)],
|
|
589
|
+
['returns', fieldTypes(defaults.outputSchema ?? sidecar?.outputSchema, `${what}'s outputSchema`, ctx)],
|
|
451
590
|
]);
|
|
452
591
|
}
|
|
453
|
-
|
|
592
|
+
// `liftableToolFor` admits no other type.
|
|
593
|
+
throw new Error(`internal SDK error: tool "${t.id}" of type ${type} has no lift.`);
|
|
454
594
|
});
|
|
455
595
|
const contextSrc = resource('context').map((c) => {
|
|
456
596
|
const { name, id, folderPath, sidecar } = contextIndexIdentity(node, c, rPlain, ctx);
|
|
@@ -468,13 +608,13 @@ export function liftInlineAgent(node, ctx) {
|
|
|
468
608
|
...placement(c, derivedContextSource(ctx.flowId, node.id, id)),
|
|
469
609
|
]);
|
|
470
610
|
});
|
|
471
|
-
const escalationSrc = resource('escalation').map((e) => {
|
|
611
|
+
const escalationSrc = resource('escalation', Infinity, liftableEscalation).map((e) => {
|
|
472
612
|
const ei = rInputs(e);
|
|
473
613
|
const recipients = Array.isArray(ei.recipients)
|
|
474
614
|
? ei.recipients.map((r) => tsText(r.value))
|
|
475
615
|
: [];
|
|
476
616
|
const outcomeNames = Object.keys((ei.outcomeMapping ?? {}));
|
|
477
|
-
const isQuickForm = e.type ===
|
|
617
|
+
const isQuickForm = e.type === QUICK_FORM_ESCALATION;
|
|
478
618
|
const rows = isQuickForm
|
|
479
619
|
? (ei.schema?.fields ?? [])
|
|
480
620
|
: [];
|
|
@@ -517,7 +657,7 @@ export function liftInlineAgent(node, ctx) {
|
|
|
517
657
|
...placement(e, derivedEscalationSource(ctx.flowId, node.id, rPlain(e, 'name') ?? '')),
|
|
518
658
|
]);
|
|
519
659
|
});
|
|
520
|
-
const mem = resource('memory', 1)[0];
|
|
660
|
+
const mem = withMemory ? resource('memory', 1)[0] : undefined;
|
|
521
661
|
const memorySrc = mem === undefined ? undefined : (() => {
|
|
522
662
|
// The memory's id is the node type's tail; the def carries it too.
|
|
523
663
|
const tail = mem.type.slice('uipath.agent.resource.memory.'.length);
|
|
@@ -535,30 +675,8 @@ export function liftInlineAgent(node, ctx) {
|
|
|
535
675
|
? tsLiteral(rPlain(mem, 'searchMode')) : undefined],
|
|
536
676
|
]);
|
|
537
677
|
})();
|
|
538
|
-
const guardrails = Array.isArray(i.guardrails) && i.guardrails.length > 0
|
|
539
|
-
? JSON.stringify(i.guardrails)
|
|
540
|
-
: undefined;
|
|
541
678
|
const list = (items) => (items.length ? `[${items.join(', ')}]` : undefined);
|
|
542
|
-
return {
|
|
543
|
-
['model', tsLiteral(plain(i.model) ?? '')],
|
|
544
|
-
['systemPrompt', promptSrc(i.systemPrompt) ?? tsLiteral('')],
|
|
545
|
-
['userPrompt', promptSrc(i.userPrompt) ?? tsLiteral('')],
|
|
546
|
-
['inputs', INPUT_ROWS],
|
|
547
|
-
['returns', returns],
|
|
548
|
-
['temperature', num(i.temperature)],
|
|
549
|
-
['maxTokenPerResponse', num(i.maxTokenPerResponse)],
|
|
550
|
-
['maxIterations', num(i.maxIterations)],
|
|
551
|
-
['mode', plain(i.mode) !== undefined ? tsLiteral(plain(i.mode)) : undefined],
|
|
552
|
-
['guardrails', guardrails],
|
|
553
|
-
['context', list(contextSrc)],
|
|
554
|
-
['tools', list(toolSrc)],
|
|
555
|
-
['escalation', list(escalationSrc)],
|
|
556
|
-
['memory', memorySrc],
|
|
557
|
-
// The agent's directory uuid is derived from the flow and step ids, but a
|
|
558
|
-
// decompiled flow must keep the ORIGINAL — the sidecar lives at
|
|
559
|
-
// `<source>/agent.json`, so a re-derived one would point at nothing.
|
|
560
|
-
['source', tsLiteral(plain(i.source) ?? '')],
|
|
561
|
-
] } };
|
|
679
|
+
return { context: list(contextSrc), tools: list(toolSrc), escalation: list(escalationSrc), memory: memorySrc };
|
|
562
680
|
}
|
|
563
681
|
export function printInlineAgent(spec, ctx) {
|
|
564
682
|
const { inputRows, options } = spec.inputs;
|
|
@@ -6,10 +6,30 @@
|
|
|
6
6
|
* in Phase 4 of docs/NODE_TYPE_ARCHITECTURE_DESIGN.md; nodes, edges,
|
|
7
7
|
* definitions, bindings and files unchanged.
|
|
8
8
|
*/
|
|
9
|
-
import type { InlineAgentInputs } from './spec.js';
|
|
9
|
+
import type { AgentResources, InlineAgentInputs } from './spec.js';
|
|
10
10
|
import type { FlowNodeContribution, FlowSerializeContext } from '../../../flow-node-type.js';
|
|
11
|
+
import { CompileRefusal } from '../../../core/compile-refusal.js';
|
|
11
12
|
/** Every bundled version of the inline agent, oldest first; the newest is the default (#956). */
|
|
12
13
|
export declare const INLINE_AGENT_VERSIONS: readonly string[];
|
|
13
14
|
export declare const INLINE_AGENT_DEFAULT_VERSION: string;
|
|
15
|
+
type Attached = NonNullable<FlowNodeContribution['attach']>[number];
|
|
16
|
+
/** The agent a shared resource message names: `Voice agent step "a" declares …`. */
|
|
17
|
+
export type AgentKindLabel = 'Inline agent' | 'Voice agent' | 'Conversational agent';
|
|
14
18
|
/** The inline agent's node, sidecar and resources. */
|
|
15
19
|
export declare function serializeInlineAgent(s: InlineAgentInputs, ctx: FlowSerializeContext): FlowNodeContribution;
|
|
20
|
+
/**
|
|
21
|
+
* The resources an agent attaches — a node per context index, tool and
|
|
22
|
+
* escalation on the agent's `context`, `tool` and `escalation` handles, and the
|
|
23
|
+
* `<source>/resources/<id>/resource.json` each one resolves from. Shared by the
|
|
24
|
+
* inline, voice and conversational agents (#1670): all three definitions declare
|
|
25
|
+
* the three handles, and the canvas writes the same resource nodes and files
|
|
26
|
+
* under each agent's own `source`. Memory is the inline agent's alone.
|
|
27
|
+
*
|
|
28
|
+
* A connector tool with no library is not thrown here but returned as
|
|
29
|
+
* `libraryRequired`, for the caller to throw once it has judged the rest.
|
|
30
|
+
*/
|
|
31
|
+
export declare function attachAgentResources(s: AgentResources, ctx: FlowSerializeContext, source: string, who: AgentKindLabel): {
|
|
32
|
+
attach: Attached[];
|
|
33
|
+
libraryRequired?: CompileRefusal;
|
|
34
|
+
};
|
|
35
|
+
export {};
|