@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.
@@ -10,7 +10,7 @@ import { ownEntry } from '../../../core/own-entry.js';
10
10
  import { processResourceBindings } from '../../../core/process-resource.js';
11
11
  import { fnv1aX4Uuid, schemaId } from '../../../core/stable-id.js';
12
12
  import { synthesizedDefinitionRefusal } from '../../../core/synthesized-definition.js';
13
- import { BUILTIN_TOOL_DEFS, INLINE_AGENT, PROCESS_TOOL_META, a2aToolDef, builtinToolResourceJson, connectorToolDef, connectorToolDescription, connectorToolDetail, connectorToolResourceJson, contextIndexDef, contextResourceJson, declaresMemoryHandle, escalationAppFolder, escalationDef, escalationResourceJson, fieldSchema, httpRequestToolResourceJson, inlineAgentDef, ixpToolDef, mcpToolDef, memoryResourceDef, processToolDef, renderContextQuery, toolResourceJson, } from './resources.js';
13
+ import { BUILTIN_TOOL_DEFS, INLINE_AGENT, PROCESS_TOOL_META, a2aToolDef, builtinToolResourceJson, connectorToolDef, connectorToolDescription, connectorToolDetail, connectorToolResourceJson, contextIndexDef, contextResourceJson, declaresMemoryHandle, escalationAppFolder, escalationDef, escalationResourceJson, fieldSchema, httpRequestToolResourceJson, inlineAgentDef, ixpToolDef, mcpToolDef, memoryResourceDef, processToolDef, renderContextQuery, toolResourceJson, voiceAgentRevision, } from './resources.js';
14
14
  import { CompileRefusal } from '../../../core/compile-refusal.js';
15
15
  /** Every bundled version of the inline agent, oldest first; the newest is the default (#956). */
16
16
  export const INLINE_AGENT_VERSIONS = ['1.2', '1.3', '1.4'];
@@ -128,6 +128,62 @@ export function serializeInlineAgent(s, ctx) {
128
128
  // not exist yet: the `properties` object is filled in place when the scope
129
129
  // closes.
130
130
  ctx.typeAgentInputs(agentJson.inputSchema, plan.refs);
131
+ const { attach, libraryRequired } = attachAgentResources(s, ctx, source, 'Inline agent');
132
+ // MEMORY — one episodic-memory resource on the agent's `memory` handle (the
133
+ // 1.4 definition selected above). Same artifact shape as context.
134
+ if (s.memory !== undefined) {
135
+ const m = s.memory;
136
+ attach.push({
137
+ id: ctx.resourceNodeId(undefined, `${step}Memory`, `inline agent "${step}": memory "${m.name}"`),
138
+ definition: memoryResourceDef(m), label: m.name, port: 'memory',
139
+ inputs: {
140
+ source: fnv1aX4Uuid(`${ctx.flowId}/${step}/memory/${m.id}`),
141
+ name: m.name,
142
+ description: m.description ?? '',
143
+ dynamicFewShotLearning: m.dynamicFewShotLearning ?? true,
144
+ semanticSimilarity: m.semanticSimilarity ?? 0,
145
+ kValue: m.kValue ?? 3,
146
+ searchMode: m.searchMode ?? 'hybrid',
147
+ },
148
+ });
149
+ // No `features/<id>/feature.json` until `check` stops refusing memory
150
+ // (AGENT_MEMORY_NOT_AUTHORABLE); its shape maps cleanly off `AgentMemoryRef`
151
+ // but cannot be exercised while the handle does not exist.
152
+ }
153
+ if (compositeInput)
154
+ throw compositeInput;
155
+ if (libraryRequired)
156
+ throw libraryRequired;
157
+ return {
158
+ definition: { source: 'snapshot', nodeType: def.nodeType, version: def.version, manifest: def },
159
+ // Unlike the published families the inline agent KEEPS no node-level model:
160
+ // 29 of 29 deployed instances carry none (the def's `model.source: true` is
161
+ // what tells the serializer the node has a `source` input).
162
+ model: 'omit',
163
+ // The forward handle is `success`, not `output` — the definition declares
164
+ // `success` (with `isDefaultForType`) + `error` on the right, and 29 of 29
165
+ // deployed instances wire the outgoing edge to `success`. Named, because the
166
+ // definition's first handles are the artifact handles a resource attaches to.
167
+ port: 'success',
168
+ inputs,
169
+ ...(outputs !== undefined ? { outputs, replaceOutputs: true } : {}),
170
+ attach,
171
+ };
172
+ }
173
+ /**
174
+ * The resources an agent attaches — a node per context index, tool and
175
+ * escalation on the agent's `context`, `tool` and `escalation` handles, and the
176
+ * `<source>/resources/<id>/resource.json` each one resolves from. Shared by the
177
+ * inline, voice and conversational agents (#1670): all three definitions declare
178
+ * the three handles, and the canvas writes the same resource nodes and files
179
+ * under each agent's own `source`. Memory is the inline agent's alone.
180
+ *
181
+ * A connector tool with no library is not thrown here but returned as
182
+ * `libraryRequired`, for the caller to throw once it has judged the rest.
183
+ */
184
+ export function attachAgentResources(s, ctx, source, who) {
185
+ const step = ctx.step;
186
+ const render = (v) => ctx.render(v);
131
187
  const attach = [];
132
188
  // GROUNDING — one resource node per context index, joined to the agent's own
133
189
  // `context` handle. An ARTIFACT, not a step: it takes no incoming control
@@ -144,7 +200,7 @@ export function serializeInlineAgent(s, ctx) {
144
200
  // emitted as written.
145
201
  if (typeof cx?.id !== 'string' || !GUID_RE.test(cx.id)) {
146
202
  const id = typeof cx?.id === 'string' ? cx.id : '';
147
- throw new CompileRefusal('AGENT_CONTEXT_NO_ID', `Inline agent step "${step}" grounds on context index "${cx?.name ?? ''}" with `
203
+ throw new CompileRefusal('FLOW_AGENT_CONTEXT_NO_ID', `${who} step "${step}" grounds on context index "${cx?.name ?? ''}" with `
148
204
  + (id.trim() === '' ? 'no `id`'
149
205
  : GUID_RE.test(id.trim()) ? `\`id\` ${JSON.stringify(cx?.id)}, which has whitespace around the GUID`
150
206
  : `\`id\` ${JSON.stringify(cx?.id)}, which is not a GUID`) + '. '
@@ -157,7 +213,7 @@ export function serializeInlineAgent(s, ctx) {
157
213
  // author placed it (`nodeId`, which decompile writes for a node the canvas
158
214
  // named). Not slugged from the index NAME: an id is the author's handle on
159
215
  // the node and a 40-character one helps nobody.
160
- const cid = ctx.resourceNodeId(cx.nodeId, `${step}Context`, `inline agent "${step}": context index "${cx.name}"`);
216
+ const cid = ctx.resourceNodeId(cx.nodeId, `${step}Context`, `${who.toLowerCase()} "${step}": context index "${cx.name}"`);
161
217
  // ONE identity, spent twice: the node's `inputs.source` and the sidecar
162
218
  // resource's `id` are the same uuid, because that is what joins them. The
163
219
  // platform validator says so in its own refusal text — *"the resource id
@@ -202,7 +258,7 @@ export function serializeInlineAgent(s, ctx) {
202
258
  ctx.sidecar({
203
259
  path: `${source}/resources/${contextResourceId}/resource.json`,
204
260
  json: contextResourceJson(cx, { id: contextResourceId, query: contextQuery }),
205
- }, cx.source !== undefined ? `inline agent step "${step}"'s context index "${cx.name ?? ''}"` : undefined);
261
+ }, cx.source !== undefined ? `${who.toLowerCase()} step "${step}"'s context index "${cx.name ?? ''}"` : undefined);
206
262
  }
207
263
  // TOOLS — one resource node per tool, joined to the agent's `tool` handle; the
208
264
  // same artifact shape as context (no incoming control flow, no output, never
@@ -222,16 +278,17 @@ export function serializeInlineAgent(s, ctx) {
222
278
  for (const tr of toolRefs) {
223
279
  // An entry that is no object (null, a hole, a string) has no kind at all.
224
280
  if (tr === null || typeof tr !== 'object')
225
- throw unknownToolKind(step, undefined);
281
+ throw unknownToolKind(step, undefined, who);
226
282
  let tdef;
227
283
  let label;
228
284
  let extraInputs = {};
229
285
  let connectorTool;
230
286
  if (tr.kind === 'builtin') {
231
287
  const bdef = ownEntry(BUILTIN_TOOL_DEFS, tr.tool);
232
- tdef = bdef === undefined ? undefined : jsonClone(bdef);
288
+ // A voice agent needs the revision that lists it as a source (#1670).
289
+ tdef = bdef === undefined ? undefined : who === 'Voice agent' ? voiceAgentRevision(bdef) : jsonClone(bdef);
233
290
  if (!tdef) {
234
- throw new CompileRefusal('INLINE_AGENT_TOOL_UNKNOWN_BUILTIN', `Inline agent step "${step}" declares a builtin tool ${JSON.stringify(tr.tool)}. `
291
+ throw new CompileRefusal('FLOW_AGENT_TOOL_UNKNOWN_BUILTIN', `${who} step "${step}" declares a builtin tool ${JSON.stringify(tr.tool)}. `
235
292
  + `The platform ships exactly three: ${Object.keys(BUILTIN_TOOL_DEFS).map((b) => `'${b}'`).join(', ')} — the node `
236
293
  + `type is a fixed string, so any other name is a node the tenant has never heard of.`, `{ kind: 'builtin', tool: 'summarize' }`);
237
294
  }
@@ -271,14 +328,14 @@ export function serializeInlineAgent(s, ctx) {
271
328
  if (!ctx.library) {
272
329
  // Its labels are bindings.json's to judge, as a connector step's are:
273
330
  // refused ahead of the library, so a run without one still hears about them.
274
- const where = `inline agent "${step}"'s connector tool "${tr.connector}/${tr.operation}"`;
331
+ const where = `${who.toLowerCase()} "${step}"'s connector tool "${tr.connector}/${tr.operation}"`;
275
332
  ctx.resolveBinding(tr.connection, 'connection', where, { key: tr.connector, action: tr.operation });
276
333
  ctx.resolveBinding(tr.folder, 'folder', where, { key: tr.connector, action: tr.operation });
277
334
  // Its node id is still claimed, as with a library, so the ids derived
278
335
  // for the tools after it, and another resource's `nodeId` that takes
279
336
  // one, are judged as compile with a library judges them.
280
- ctx.resourceNodeId(tr.nodeId, `${step}Tool`, `inline agent "${step}": connector tool "${tr.name ?? tr.operation}"`);
281
- libraryRequired ??= new CompileRefusal('LIBRARY_REQUIRED', `inline agent "${step}"'s connector tool needs a library (pass --library / set $FLOW_SDK_LIBRARY_JSON).`);
337
+ ctx.resourceNodeId(tr.nodeId, `${step}Tool`, `${who.toLowerCase()} "${step}": connector tool "${tr.name ?? tr.operation}"`);
338
+ libraryRequired ??= new CompileRefusal('LIBRARY_REQUIRED', `${who.toLowerCase()} "${step}"'s connector tool needs a library (pass --library / set $FLOW_SDK_LIBRARY_JSON).`);
282
339
  continue;
283
340
  }
284
341
  const rc = ctx.library.resolve(tr.connector, tr.operation, tr.version, tr.object);
@@ -301,7 +358,7 @@ export function serializeInlineAgent(s, ctx) {
301
358
  // (`<bindings.… connection>` / `<bindings.FolderKey>`) name.
302
359
  // * the agent's `resources/<id>/resource.json` (below).
303
360
  // Emitting none of them left the tool with no connection anywhere.
304
- const where = `inline agent "${step}"'s connector tool "${tr.connector}/${tr.operation}"`;
361
+ const where = `${who.toLowerCase()} "${step}"'s connector tool "${tr.connector}/${tr.operation}"`;
305
362
  const target = { key: tr.connector, action: tr.operation };
306
363
  const conn = ctx.resolveBinding(tr.connection, 'connection', where, target);
307
364
  const folder = ctx.resolveBinding(tr.folder, 'folder', where, target);
@@ -335,12 +392,23 @@ export function serializeInlineAgent(s, ctx) {
335
392
  // application owns the implementation.
336
393
  tdef = jsonClone(ctx.definition('uipath.agent.resource.tool.clientside', '1.0'));
337
394
  label = tr.name;
395
+ for (const [fields, schema] of [['inputs', 'inputSchema'], ['returns', 'outputSchema']]) {
396
+ if (tr[fields] !== undefined && tr[schema] !== undefined) {
397
+ throw new CompileRefusal('FLOW_AGENT_TOOL_CLIENTSIDE_SCHEMA_TWICE', `${who} step "${step}"'s client-side tool "${tr.name}" gives both \`${fields}\` and \`${schema}\`. `
398
+ + `They write the same schema: give \`${fields}\` for plain typed fields, or \`${schema}\` for the whole JSON schema.`);
399
+ }
400
+ }
401
+ // `inputSchema` / `outputSchema` are written as given: the property
402
+ // descriptions, `items` and `required` are what the model reads (#1670).
403
+ const schemaOf = (fields, schema) => schema !== undefined ? jsonClone(schema) : fields !== undefined ? fieldSchema(fields) : undefined;
404
+ const inputSchema = schemaOf(tr.inputs, tr.inputSchema);
405
+ const outputSchema = schemaOf(tr.returns, tr.outputSchema);
338
406
  extraInputs = {
339
407
  ...jsonClone(tdef.inputDefaults),
340
408
  name: tr.name,
341
409
  ...(tr.description !== undefined ? { description: tr.description } : {}),
342
- ...(tr.inputs !== undefined ? { inputSchema: fieldSchema(tr.inputs) } : {}),
343
- ...(tr.returns !== undefined ? { outputSchema: fieldSchema(tr.returns) } : {}),
410
+ ...(inputSchema !== undefined ? { inputSchema } : {}),
411
+ ...(outputSchema !== undefined ? { outputSchema } : {}),
344
412
  };
345
413
  }
346
414
  else if (tr.kind === 'httpRequest') {
@@ -375,7 +443,7 @@ export function serializeInlineAgent(s, ctx) {
375
443
  else {
376
444
  const meta = ownEntry(PROCESS_TOOL_META, tr.kind);
377
445
  if (!meta)
378
- throw unknownToolKind(step, tr.kind);
446
+ throw unknownToolKind(step, tr.kind, who);
379
447
  tdef = processToolDef(tr.kind, tr);
380
448
  label = tr.name;
381
449
  // The definition's `model.context` names `<bindings.name>` /
@@ -394,7 +462,7 @@ export function serializeInlineAgent(s, ctx) {
394
462
  // emitting it on the node too would set inputs the def's own schema does
395
463
  // not declare (our own output would be flagged).
396
464
  }
397
- const tid = ctx.resourceNodeId(tr.nodeId, `${step}Tool`, `inline agent "${step}": ${tr.kind} tool "${label}"`);
465
+ const tid = ctx.resourceNodeId(tr.nodeId, `${step}Tool`, `${who.toLowerCase()} "${step}": ${tr.kind} tool "${label}"`);
398
466
  const toolResourceId = tr.source ?? derivedToolSource(ctx.flowId, step, tr);
399
467
  const toolInputs = { source: toolResourceId, ...extraInputs };
400
468
  attach.push({
@@ -414,7 +482,7 @@ export function serializeInlineAgent(s, ctx) {
414
482
  ? httpRequestToolResourceJson(label, toolInputs, { id: toolResourceId, canvasNodeId: tid })
415
483
  : toolResourceJson(tr, { id: toolResourceId });
416
484
  if (toolResource !== undefined) {
417
- ctx.sidecar({ path: `${source}/resources/${toolResourceId}/resource.json`, json: toolResource }, tr.source !== undefined ? `inline agent step "${step}"'s ${tr.kind} tool` : undefined);
485
+ ctx.sidecar({ path: `${source}/resources/${toolResourceId}/resource.json`, json: toolResource }, tr.source !== undefined ? `${who.toLowerCase()} step "${step}"'s ${tr.kind} tool` : undefined);
418
486
  }
419
487
  }
420
488
  // ESCALATION — the agent's TOP handle; an Action Center app task a human
@@ -422,8 +490,8 @@ export function serializeInlineAgent(s, ctx) {
422
490
  // the author's values — the exact shape the deployed corpus carries.
423
491
  const escalations = s.escalation === undefined ? [] : Array.isArray(s.escalation) ? s.escalation : [s.escalation];
424
492
  for (const esc of escalations) {
425
- refuseLossyEscalation(esc, step);
426
- const where = `inline agent "${step}": escalation "${esc.name}"`;
493
+ refuseLossyEscalation(esc, step, who);
494
+ const where = `${who.toLowerCase()} "${step}": escalation "${esc.name}"`;
427
495
  const channelId = fnv1aX4Uuid(`${ctx.flowId}/${step}/escalation/${esc.name}/channel`);
428
496
  if (esc.variant === 'quick-form') {
429
497
  // The INLINE-form escalation: the same schema rows a human task's quick
@@ -481,11 +549,11 @@ export function serializeInlineAgent(s, ctx) {
481
549
  ctx.sidecar({
482
550
  path: `${source}/resources/${qsource}/resource.json`,
483
551
  json: escalationResourceJson(esc, { id: qsource, channelId, quickFormSchema: schema }),
484
- }, esc.source !== undefined ? `inline agent step "${step}"'s escalation "${esc.name ?? ''}"` : undefined);
552
+ }, esc.source !== undefined ? `${who.toLowerCase()} step "${step}"'s escalation "${esc.name ?? ''}"` : undefined);
485
553
  continue;
486
554
  }
487
555
  const app = esc.app;
488
- const edef = escalationDef();
556
+ const edef = who === 'Voice agent' ? voiceAgentRevision(escalationDef()) : escalationDef();
489
557
  const eid = ctx.resourceNodeId(esc.nodeId, `${step}Escalation`, where);
490
558
  const esource = esc.source ?? derivedEscalationSource(ctx.flowId, step, esc.name);
491
559
  attach.push({
@@ -524,52 +592,13 @@ export function serializeInlineAgent(s, ctx) {
524
592
  ctx.sidecar({
525
593
  path: `${source}/resources/${esource}/resource.json`,
526
594
  json: escalationResourceJson(esc, { id: esource, channelId }),
527
- }, esc.source !== undefined ? `inline agent step "${step}"'s escalation "${esc.name ?? ''}"` : undefined);
595
+ }, esc.source !== undefined ? `${who.toLowerCase()} step "${step}"'s escalation "${esc.name ?? ''}"` : undefined);
528
596
  }
529
- // MEMORY — one episodic-memory resource on the agent's `memory` handle (the
530
- // 1.4 definition selected above). Same artifact shape as context.
531
- if (s.memory !== undefined) {
532
- const m = s.memory;
533
- attach.push({
534
- id: ctx.resourceNodeId(undefined, `${step}Memory`, `inline agent "${step}": memory "${m.name}"`),
535
- definition: memoryResourceDef(m), label: m.name, port: 'memory',
536
- inputs: {
537
- source: fnv1aX4Uuid(`${ctx.flowId}/${step}/memory/${m.id}`),
538
- name: m.name,
539
- description: m.description ?? '',
540
- dynamicFewShotLearning: m.dynamicFewShotLearning ?? true,
541
- semanticSimilarity: m.semanticSimilarity ?? 0,
542
- kValue: m.kValue ?? 3,
543
- searchMode: m.searchMode ?? 'hybrid',
544
- },
545
- });
546
- // No `features/<id>/feature.json` until `check` stops refusing memory
547
- // (AGENT_MEMORY_NOT_AUTHORABLE); its shape maps cleanly off `AgentMemoryRef`
548
- // but cannot be exercised while the handle does not exist.
549
- }
550
- if (compositeInput)
551
- throw compositeInput;
552
- if (libraryRequired)
553
- throw libraryRequired;
554
- return {
555
- definition: { source: 'snapshot', nodeType: def.nodeType, version: def.version, manifest: def },
556
- // Unlike the published families the inline agent KEEPS no node-level model:
557
- // 29 of 29 deployed instances carry none (the def's `model.source: true` is
558
- // what tells the serializer the node has a `source` input).
559
- model: 'omit',
560
- // The forward handle is `success`, not `output` — the definition declares
561
- // `success` (with `isDefaultForType`) + `error` on the right, and 29 of 29
562
- // deployed instances wire the outgoing edge to `success`. Named, because the
563
- // definition's first handles are the artifact handles a resource attaches to.
564
- port: 'success',
565
- inputs,
566
- ...(outputs !== undefined ? { outputs, replaceOutputs: true } : {}),
567
- attach,
568
- };
597
+ return { attach, libraryRequired };
569
598
  }
570
- /** INLINE_AGENT_TOOL_UNKNOWN_KIND: a tool whose `kind` names no tool the platform has. */
571
- function unknownToolKind(step, kind) {
572
- return new CompileRefusal('INLINE_AGENT_TOOL_UNKNOWN_KIND', `Inline agent step "${step}" declares a tool with kind ${JSON.stringify(kind)}. Valid `
599
+ /** FLOW_AGENT_TOOL_UNKNOWN_KIND: a tool whose `kind` names no tool the platform has. */
600
+ function unknownToolKind(step, kind, who) {
601
+ return new CompileRefusal('FLOW_AGENT_TOOL_UNKNOWN_KIND', `${who} step "${step}" declares a tool with kind ${JSON.stringify(kind)}. Valid `
573
602
  + "kinds: 'builtin', 'connector', 'process', 'agent', 'api', 'flow', 'maestro', 'function', 'ixp', 'mcp', 'a2a', "
574
603
  + "'clientside', 'httpRequest'.");
575
604
  }
@@ -607,22 +636,22 @@ function compositeInputRefusal(s, byName, step) {
607
636
  * so an unknown variant would become an app task, a quick form's \`app\` would
608
637
  * be dropped, and an app task's inline \`fields\` would be dropped.
609
638
  */
610
- function refuseLossyEscalation(e, step) {
639
+ function refuseLossyEscalation(e, step, who) {
611
640
  const esc = e;
612
641
  if (esc.variant !== undefined && esc.variant !== 'quick-form') {
613
- throw new CompileRefusal('INLINE_AGENT_ESCALATION_VARIANT', `Inline agent step "${step}"'s escalation names the variant ${JSON.stringify(esc.variant)}. Valid: `
642
+ throw new CompileRefusal('FLOW_AGENT_ESCALATION_VARIANT', `${who} step "${step}"'s escalation names the variant ${JSON.stringify(esc.variant)}. Valid: `
614
643
  + `'quick-form' — or omit it for the app-backed default.`);
615
644
  }
616
645
  if (esc.variant === 'quick-form') {
617
646
  // The form lives INLINE: an app would be emitted nowhere.
618
647
  if (esc.app !== undefined) {
619
- throw new CompileRefusal('INLINE_AGENT_ESCALATION_QUICKFORM_WITH_APP', `Inline agent step "${step}"'s quick-form escalation also names an app. The form lives in the flow — `
648
+ throw new CompileRefusal('FLOW_AGENT_ESCALATION_QUICKFORM_WITH_APP', `${who} step "${step}"'s quick-form escalation also names an app. The form lives in the flow — `
620
649
  + `drop \`app\`, or drop the variant for the app-backed escalation.`);
621
650
  }
622
651
  return;
623
652
  }
624
653
  if (esc.fields !== undefined) {
625
- throw new CompileRefusal('INLINE_AGENT_ESCALATION_APP_WITH_FIELDS', `Inline agent step "${step}"'s escalation declares inline \`fields\`, but its form belongs to the deployed `
654
+ throw new CompileRefusal('FLOW_AGENT_ESCALATION_APP_WITH_FIELDS', `${who} step "${step}"'s escalation declares inline \`fields\`, but its form belongs to the deployed `
626
655
  + `app. Use variant: 'quick-form' for an inline form.`);
627
656
  }
628
657
  }
@@ -13,9 +13,9 @@
13
13
  import { agentInputPlan, agentSidecarInputs, conversationalAgentJson, voiceAgentJson } from '../../../core/agent-sidecar.js';
14
14
  import { Expr, toExpr } from '../../../core/expr.js';
15
15
  import { wireExprBody } from '../../../core/wire-expr.js';
16
- import { checkConversationalAgent, checkInlineAgent, checkInlineAgentRead, checkVoice } from './check.js';
17
- import { INLINE_AGENT_DEFAULT_VERSION, INLINE_AGENT_VERSIONS, serializeInlineAgent } from './inline-agent.js';
18
- import { liftInlineAgent, printInlineAgent } from './inline-agent-lift.js';
16
+ import { checkAgentResources, checkConversationalAgent, checkInlineAgent, checkInlineAgentRead, checkVoice } from './check.js';
17
+ import { INLINE_AGENT_DEFAULT_VERSION, INLINE_AGENT_VERSIONS, attachAgentResources, serializeInlineAgent, } from './inline-agent.js';
18
+ import { liftAgentResources, liftInlineAgent, printInlineAgent } from './inline-agent-lift.js';
19
19
  import { INLINE_AGENT } from './resources.js';
20
20
  const CREATE_OUTGOING_CALL = 'uipath.conversational.voice.create-outgoing-call';
21
21
  const END_CALL = 'uipath.conversational.voice.end-call';
@@ -119,7 +119,17 @@ function serializeVoiceAgent(s, ctx) {
119
119
  ctx.typeAgentInputs(json.inputSchema, plan.refs);
120
120
  // The resource model lives on the definition (its `model.source: true` is
121
121
  // what makes `source` an input), as on the inline agent.
122
- return { model: 'omit', port: SHELL_FORWARD_PORT, inputs };
122
+ return { model: 'omit', port: SHELL_FORWARD_PORT, inputs, attach: shellResources(s, ctx, source, 'Voice agent') };
123
+ }
124
+ /**
125
+ * A shell agent's tools, context indexes and escalations: the inline agent's
126
+ * resource nodes and `resource.json` files, under this agent's `source` (#1670).
127
+ */
128
+ function shellResources(s, ctx, source, who) {
129
+ const { attach, libraryRequired } = attachAgentResources(s, ctx, source, who);
130
+ if (libraryRequired)
131
+ throw libraryRequired;
132
+ return attach;
123
133
  }
124
134
  /**
125
135
  * The text CONVERSATIONAL agent: the inline agent's cluster shape (a minted
@@ -176,7 +186,15 @@ function serializeConversationalAgent(s, ctx) {
176
186
  // family flag). `endExchange` is written nowhere: the platform retired it (the
177
187
  // node's v1.7 migration drops it, and the converter always sends
178
188
  // `conversationalService.endExchange = ''`).
179
- return { model: 'omit', port: SHELL_FORWARD_PORT, inputs: { source, conversationalAgentSettings: settings } };
189
+ return {
190
+ model: 'omit', port: SHELL_FORWARD_PORT, inputs: { source, conversationalAgentSettings: settings },
191
+ attach: shellResources(s, ctx, source, 'Conversational agent'),
192
+ };
193
+ }
194
+ /** The resources on a shell agent's artifact handles. A shell agent has no memory, so a memory edge stays reported. */
195
+ function liftShellResources(node, ctx) {
196
+ const { context, tools, escalation } = liftAgentResources(node, ctx, false);
197
+ return { context, tools, escalation };
180
198
  }
181
199
  /**
182
200
  * The node's inputs over its sidecar's (a key on the node wins), the prompt
@@ -241,6 +259,7 @@ function liftVoiceAgent(node, ctx) {
241
259
  },
242
260
  maxIterations: num(i.maxIterations),
243
261
  source: plain(i.source),
262
+ resources: liftShellResources(node, ctx),
244
263
  },
245
264
  };
246
265
  }
@@ -270,6 +289,7 @@ function liftConversationalAgent(node, ctx) {
270
289
  maxIterations: num(i.maxIterations),
271
290
  guardrails: Array.isArray(i.guardrails) && i.guardrails.length > 0 ? i.guardrails : undefined,
272
291
  source: plain(i.source),
292
+ resources: liftShellResources(node, ctx),
273
293
  },
274
294
  };
275
295
  }
@@ -295,6 +315,9 @@ function printShellAgent(spec, ctx) {
295
315
  ['callContext', a.callContext.js.startsWith('$vars.') ? ctx.value(new Expr(a.callContext.js)) : ctx.string(a.callContext.raw)],
296
316
  ['voice', voiceSrc],
297
317
  ['maxIterations', num(a.maxIterations)],
318
+ ['context', a.resources.context],
319
+ ['tools', a.resources.tools],
320
+ ['escalation', a.resources.escalation],
298
321
  ['source', ctx.string(a.source ?? '')],
299
322
  ],
300
323
  };
@@ -329,6 +352,9 @@ function printShellAgent(spec, ctx) {
329
352
  ['maxTokenPerResponse', num(a.maxTokenPerResponse)],
330
353
  ['maxIterations', num(a.maxIterations)],
331
354
  ['guardrails', a.guardrails === undefined ? undefined : ctx.json(a.guardrails)],
355
+ ['context', a.resources.context],
356
+ ['tools', a.resources.tools],
357
+ ['escalation', a.resources.escalation],
332
358
  ['source', ctx.string(a.source ?? '')],
333
359
  ],
334
360
  };
@@ -362,7 +388,10 @@ function voiceAgentAt(version) {
362
388
  serialize: (spec, ctx) => serializeVoiceAgent(spec.inputs, ctx),
363
389
  deserialize: (node, ctx) => liftVoiceAgent(node, ctx),
364
390
  print: (spec, ctx) => printShellAgent(spec, ctx),
365
- check: (spec, ctx) => checkVoice('voiceAgent', spec.inputs, ctx),
391
+ check: (spec, ctx) => {
392
+ checkVoice('voiceAgent', spec.inputs, ctx);
393
+ checkAgentResources(spec.inputs, ctx, 'Voice agent');
394
+ },
366
395
  expressions: () => [],
367
396
  output: opaque,
368
397
  };
@@ -374,7 +403,10 @@ function conversationalAgentAt(version) {
374
403
  serialize: (spec, ctx) => serializeConversationalAgent(spec.inputs, ctx),
375
404
  deserialize: (node, ctx) => liftConversationalAgent(node, ctx),
376
405
  print: (spec, ctx) => printShellAgent(spec, ctx),
377
- check: (spec, ctx) => checkConversationalAgent(spec.inputs, ctx),
406
+ check: (spec, ctx) => {
407
+ checkConversationalAgent(spec.inputs, ctx);
408
+ checkAgentResources(spec.inputs, ctx, 'Conversational agent');
409
+ },
378
410
  expressions: () => [],
379
411
  output: opaque,
380
412
  };
@@ -220,12 +220,25 @@ export declare function escalationResourceJson(esc: EscalationRef, spec: {
220
220
  }): Record<string, unknown>;
221
221
  /**
222
222
  * The one TARGET handle every tool resource declares: `input`, artifact-typed,
223
- * fed by the two agent types' `tool` handles. Transcribed from `registry get`
223
+ * fed by the agent types' `tool` handles. Transcribed from `registry get`
224
224
  * (identical across `tool.builtin.*`, `tool.connector.*` and every
225
225
  * per-instance kind, 2026-07-31) — the mirror of the agent's own
226
226
  * `allowedTargets: [{ nodeType: 'uipath.agent.resource.tool.*' }]`.
227
+ *
228
+ * `withVoice` adds the voice agent as a source, which the designer writes on
229
+ * every tool it places today (#1670). The bundled built-in tools at 1.1 are
230
+ * the exception: flow-core froze that version's handle without it, and 1.2 is
231
+ * the same definition with it (`voiceAgentRevision`).
232
+ */
233
+ export declare function toolInputHandle(withVoice?: boolean): any;
234
+ /**
235
+ * A bundled resource definition one revision on, for a voice agent: flow-core
236
+ * froze the built-in tools' and the app escalation's 1.1 handles without the
237
+ * voice agent as a source, and its 1.2 of each is that definition with the
238
+ * voice agent added (`addVoiceAgentToInputHandleSources`, flow-core's
239
+ * migration-helpers.ts). For instance `builtin.analyzefiles` 1.1 becomes 1.2.
227
240
  */
228
- export declare function toolInputHandle(): any;
241
+ export declare function voiceAgentRevision(def: any): any;
229
242
  /** A `{ name: type }` field map as the JSON-schema object the platform stores. */
230
243
  export declare function fieldSchema(fields: Record<string, string> | undefined): any;
231
244
  /**
@@ -62,6 +62,7 @@ export function contextIndexDef(spec) {
62
62
  allowedSources: [
63
63
  { nodeType: 'uipath.agent.autonomous', handleId: 'context' },
64
64
  { nodeType: 'uipath.agent.conversational', handleId: 'context' },
65
+ { nodeType: 'uipath.agent.voice', handleId: 'context' },
65
66
  ],
66
67
  validationMessage: "Only Agent's context handle can connect here",
67
68
  },
@@ -565,12 +566,17 @@ export function escalationResourceJson(esc, spec) {
565
566
  }
566
567
  /**
567
568
  * The one TARGET handle every tool resource declares: `input`, artifact-typed,
568
- * fed by the two agent types' `tool` handles. Transcribed from `registry get`
569
+ * fed by the agent types' `tool` handles. Transcribed from `registry get`
569
570
  * (identical across `tool.builtin.*`, `tool.connector.*` and every
570
571
  * per-instance kind, 2026-07-31) — the mirror of the agent's own
571
572
  * `allowedTargets: [{ nodeType: 'uipath.agent.resource.tool.*' }]`.
573
+ *
574
+ * `withVoice` adds the voice agent as a source, which the designer writes on
575
+ * every tool it places today (#1670). The bundled built-in tools at 1.1 are
576
+ * the exception: flow-core froze that version's handle without it, and 1.2 is
577
+ * the same definition with it (`voiceAgentRevision`).
572
578
  */
573
- export function toolInputHandle() {
579
+ export function toolInputHandle(withVoice = true) {
574
580
  return {
575
581
  position: 'top',
576
582
  handles: [{
@@ -580,12 +586,37 @@ export function toolInputHandle() {
580
586
  allowedSources: [
581
587
  { nodeType: 'uipath.agent.autonomous', handleId: 'tool' },
582
588
  { nodeType: 'uipath.agent.conversational', handleId: 'tool' },
589
+ ...(withVoice ? [{ nodeType: 'uipath.agent.voice', handleId: 'tool' }] : []),
583
590
  ],
584
591
  validationMessage: "Only Agent's tool handle can connect here",
585
592
  },
586
593
  }],
587
594
  };
588
595
  }
596
+ /**
597
+ * A bundled resource definition one revision on, for a voice agent: flow-core
598
+ * froze the built-in tools' and the app escalation's 1.1 handles without the
599
+ * voice agent as a source, and its 1.2 of each is that definition with the
600
+ * voice agent added (`addVoiceAgentToInputHandleSources`, flow-core's
601
+ * migration-helpers.ts). For instance `builtin.analyzefiles` 1.1 becomes 1.2.
602
+ */
603
+ export function voiceAgentRevision(def) {
604
+ if (def.version !== '1.1')
605
+ throw new Error(`internal SDK error: no voice revision of ${def.nodeType}@${def.version}.`);
606
+ const next = jsonClone(def);
607
+ next.version = '1.2';
608
+ for (const group of next.handleConfiguration ?? []) {
609
+ for (const handle of group.handles ?? []) {
610
+ const allowed = handle.id === 'input' ? handle.constraints?.allowedSources : undefined;
611
+ if (!Array.isArray(allowed) || allowed.some((x) => x.nodeType === 'uipath.agent.voice'))
612
+ continue;
613
+ const conversational = allowed.find((x) => x.nodeType === 'uipath.agent.conversational');
614
+ if (conversational)
615
+ allowed.push({ nodeType: 'uipath.agent.voice', handleId: conversational.handleId });
616
+ }
617
+ }
618
+ return next;
619
+ }
589
620
  /** A `{ name: type }` field map as the JSON-schema object the platform stores. */
590
621
  export function fieldSchema(fields) {
591
622
  return {
@@ -620,7 +651,7 @@ export const BUILTIN_TOOL_DEFS = {
620
651
  description: 'Analyze one or more files with an LLM to extract, synthesize, or answer queries about their content.',
621
652
  icon: 'paperclip', shape: 'circle',
622
653
  },
623
- handleConfiguration: [toolInputHandle()],
654
+ handleConfiguration: [toolInputHandle(false)],
624
655
  model: { source: true },
625
656
  inputDefinition: {
626
657
  type: 'object',
@@ -655,7 +686,7 @@ export const BUILTIN_TOOL_DEFS = {
655
686
  description: 'Get comprehensive synthesis across up to 1,000 pages with citations.',
656
687
  icon: 'database', shape: 'circle',
657
688
  },
658
- handleConfiguration: [toolInputHandle()],
689
+ handleConfiguration: [toolInputHandle(false)],
659
690
  inputDefinition: {
660
691
  type: 'object',
661
692
  properties: {
@@ -686,7 +717,7 @@ export const BUILTIN_TOOL_DEFS = {
686
717
  description: 'Process and transform CSV files.',
687
718
  icon: 'table', shape: 'circle',
688
719
  },
689
- handleConfiguration: [toolInputHandle()],
720
+ handleConfiguration: [toolInputHandle(false)],
690
721
  inputDefinition: {
691
722
  type: 'object',
692
723
  properties: {
@@ -35,8 +35,25 @@ export interface ConversationalAgentSettings {
35
35
  /** `'custom'` mode: the caller's per-user settings object. */
36
36
  userSettings?: Expr | string;
37
37
  }
38
- /** What `conversationalAgent()` takes: the agent's instructions and model, and how it gets its turn. */
39
- export interface ConversationalAgentInputs {
38
+ /**
39
+ * The resources an agent attaches on its artifact handles — `context`, `tools`
40
+ * and `escalation`, written exactly as {@link InlineAgentInputs} documents them.
41
+ * The voice and conversational agents take them too (#1670): their definitions
42
+ * declare the same three handles, and the canvas wires the same resource nodes.
43
+ */
44
+ export type AgentResources = Pick<InlineAgentInputs, 'context' | 'tools' | 'escalation'>;
45
+ /**
46
+ * What `conversationalAgent()` takes: the agent's instructions and model, how it
47
+ * gets its turn, and the resources it attaches ({@link AgentResources}).
48
+ *
49
+ * ```ts
50
+ * conversationalAgent({
51
+ * model: 'gpt-5.4', systemPrompt: 'Help the customer.', settings: { context: out('wait', 'conversationContext') },
52
+ * tools: [{ kind: 'clientside', name: 'showOrder', inputs: { orderId: 'string' } }],
53
+ * })
54
+ * ```
55
+ */
56
+ export interface ConversationalAgentInputs extends AgentResources {
40
57
  /**
41
58
  * The agent's standing instructions for the conversation. Plain text — a
42
59
  * conversational agent's turn comes from the transcript, not from flow
@@ -125,8 +142,12 @@ export interface VoiceSettings {
125
142
  /** The model's own context ceiling — informational. */
126
143
  modelMaxTokens?: number;
127
144
  }
128
- /** What `voiceAgent()` takes: the agent's instructions, the call it joins, and how it sounds. */
129
- export interface VoiceAgentInputs {
145
+ /**
146
+ * What `voiceAgent()` takes: the agent's instructions, the call it joins, how it
147
+ * sounds, and the resources it attaches ({@link AgentResources}), e.g.
148
+ * `tools: [{ kind: 'api', key: '<uuid>', name: 'LookupCustomer', folderPath: 'Shared' }]`.
149
+ */
150
+ export interface VoiceAgentInputs extends AgentResources {
130
151
  /**
131
152
  * The agent's standing instructions — who it is on the call and what it must
132
153
  * do. Use `{{input.<name>}}` placeholders for values declared in `inputs`;
package/dist/serialize.js CHANGED
@@ -1413,7 +1413,7 @@ function serializeFlow(built, opts) {
1413
1413
  * Add one sidecar file. An agent or a resource whose explicit `source` names
1414
1414
  * a directory another one also writes would have the second file silently
1415
1415
  * replace the first: index A's node would read B's settings, or agent B would
1416
- * run with A's configuration. That is refused (INLINE_AGENT_RESOURCE_SOURCE_DUP),
1416
+ * run with A's configuration. That is refused (FLOW_AGENT_RESOURCE_SOURCE_DUP),
1417
1417
  * naming both; `owner` is the one whose `source` is explicit, as the refusal
1418
1418
  * names it (`inline agent step "answer"'s context index "SOP"`). The same file
1419
1419
  * twice (a subflow body emitted for two callers) is not a clash.
@@ -1431,7 +1431,7 @@ function serializeFlow(built, opts) {
1431
1431
  const names = [earlierOwner ?? 'another agent or resource', owner ?? 'another agent or resource'];
1432
1432
  const where = earlier.path === file.path ? `"${file.path}"`
1433
1433
  : `"${earlier.path}" and "${file.path}" (one file on macOS and Windows, which ignore case)`;
1434
- throw new CompileRefusal('INLINE_AGENT_RESOURCE_SOURCE_DUP', `${names[0].charAt(0).toUpperCase()}${names[0].slice(1)} and ${names[1]} would both write ${where} with `
1434
+ throw new CompileRefusal('FLOW_AGENT_RESOURCE_SOURCE_DUP', `${names[0].charAt(0).toUpperCase()}${names[0].slice(1)} and ${names[1]} would both write ${where} with `
1435
1435
  + 'different content, so the second file would replace the first. Give each its own `source`, or omit '
1436
1436
  + '`source` to derive one.');
1437
1437
  }
@@ -1634,7 +1634,7 @@ function serializeFlow(built, opts) {
1634
1634
  * dropped node plus an added one to merge), else `uid`'s derived one. A
1635
1635
  * `nodeId` another node already holds, or an entry point's id (claimed after
1636
1636
  * the body), is refused rather than renamed, for the same reason
1637
- * (INLINE_AGENT_RESOURCE_NODE_ID). So is a derived id an explicit `nodeId`
1637
+ * (FLOW_AGENT_RESOURCE_NODE_ID). So is a derived id an explicit `nodeId`
1638
1638
  * already took: deriving `<id>2` instead would move a node the author's file
1639
1639
  * names by that id.
1640
1640
  */
@@ -1642,14 +1642,14 @@ function serializeFlow(built, opts) {
1642
1642
  if (nodeId === undefined) {
1643
1643
  const owner = explicitResourceIds.get(derivedBase.replace(/[^A-Za-z0-9_]/g, '_') || 'node');
1644
1644
  if (owner !== undefined) {
1645
- throw new CompileRefusal('INLINE_AGENT_RESOURCE_NODE_ID', `${owner} takes the \`nodeId\` ${JSON.stringify(derivedBase)}, which is the id compile derives for ${where}, `
1645
+ throw new CompileRefusal('FLOW_AGENT_RESOURCE_NODE_ID', `${owner} takes the \`nodeId\` ${JSON.stringify(derivedBase)}, which is the id compile derives for ${where}, `
1646
1646
  + 'and compile will not rename either one. Give that resource another `nodeId`, or omit it to derive one.');
1647
1647
  }
1648
1648
  return uid(scope, derivedBase);
1649
1649
  }
1650
1650
  const entryPoint = (built.entryPoints ?? []).some((ep) => ep.id === nodeId);
1651
1651
  if (nodeId.trim() === '' || takenIds.has(nodeId) || entryPoint) {
1652
- throw new CompileRefusal('INLINE_AGENT_RESOURCE_NODE_ID', `${where}: \`nodeId\` ${JSON.stringify(nodeId)} `
1652
+ throw new CompileRefusal('FLOW_AGENT_RESOURCE_NODE_ID', `${where}: \`nodeId\` ${JSON.stringify(nodeId)} `
1653
1653
  + (nodeId.trim() === '' ? 'is blank.'
1654
1654
  : entryPoint ? `is already the id of entry point "${nodeId}".`
1655
1655
  : 'is already the id of another node in this flow.')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.88.1",
3
+ "version": "6.88.3",
4
4
  "description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://docs.uipath.com/maestro",
@@ -110,5 +110,5 @@
110
110
  "@types/node": "^22.7.0",
111
111
  "esbuild": "^0.28.1"
112
112
  },
113
- "gitref": "e607cf4e8792ff6639ffd7130a2c2c9f0a777197"
113
+ "gitref": "411e0bec879c17401cff0185fd3d1bdb93686b60"
114
114
  }