@uipath/maestro-builder-sdk 6.93.9 → 6.94.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.
@@ -9,19 +9,21 @@
9
9
  * id, a setting, a form row; an expression query is printed as the text compile
10
10
  * reads it from — so the lift writes each resource's options as source once,
11
11
  * through the core literal writers, while the warnings and refusals that
12
- * reading them raises still go through the context. The agent's own inputs and
13
- * a process tool argument's Variable are the only expressions, kept as `Expr`s
14
- * for the printer.
12
+ * reading them raises still go through the context. The agent's own inputs, a
13
+ * process tool argument's Variable and a built-in tool's task Variable are the
14
+ * only expressions, kept as `Expr`s for the printer.
15
15
  */
16
- import { agentInputRef, agentSidecarInputs } from '../../../core/agent-sidecar.js';
16
+ import { agentInputRef, agentSidecarInputs, promptPlaceholders } from '../../../core/agent-sidecar.js';
17
17
  import { derivedContextSource, derivedEscalationSource, derivedResourceNodeId, derivedToolSource, } from '../../../core/agent-resource-identity.js';
18
18
  import { CONTEXT_INDEX_DEFAULTS, CONTEXT_INDEX_DEFAULT_FILE_EXTENSION, contextIndexSlug, parseContextIndexType, } from '../../../core/context-index.js';
19
- import { Expr, flatNameReference } from '../../../core/expr.js';
19
+ import { Expr, flatNameOf, flatNameReference } from '../../../core/expr.js';
20
20
  import { formFieldRowLoss, formFieldRowLossMessage, formFieldSettingsSource, liftFormFieldSettings, sourceFormFieldType, } from '../../../core/form-field-type.js';
21
21
  import { ownEntry } from '../../../core/own-entry.js';
22
- import { isInlineAgentFieldType, jsonPathSegments } from '../../../core/tool-argument.js';
22
+ import { isInlineAgentFieldType, jsonPathKey, jsonPathSegments } from '../../../core/tool-argument.js';
23
23
  import { tsKey as key, tsLiteral, tsNumber, tsObject as objLit, tsOptions as opts, tsText } from '../../../core/ts-literal.js';
24
24
  import { wireExprBody } from '../../../core/wire-expr.js';
25
+ import { liftBatchTransformTool, reportUnreadBuiltinTask } from './builtin-tool-lift.js';
26
+ import { resourceSidecar } from './resource-sidecar.js';
25
27
  import { BUILTIN_TOOL_DEFS, escalationDef, voiceAgentRevision } from './resources.js';
26
28
  /** Where the agent's own `inputs` go in the option list: the printer writes them, as expressions. */
27
29
  const INPUT_ROWS = Symbol('inputs');
@@ -40,8 +42,8 @@ const PROCESS_NS = [
40
42
  * `tools` entry. Only tools compile writes back to the same node, at the same
41
43
  * version, are claimed; any other edge stays reported as dropped. Compile
42
44
  * writes the HTTP request tool at 1.0 and a bundled built-in at its
43
- * definition's version (1.1, or 1.2 on a voice agent); `BuiltinToolRef` has no
44
- * version to carry another.
45
+ * definition's version (1.1, or 1.2 on a voice agent; `batchtransform` 1.2 on
46
+ * every agent); `BuiltinToolRef` has no version to carry another.
45
47
  */
46
48
  function liftableToolFor(agentType) {
47
49
  const builtinVersion = (def) => (agentType === VOICE_AGENT_TYPE ? voiceAgentRevision(def).version : def.version);
@@ -131,7 +133,7 @@ function dataSource(v) {
131
133
  */
132
134
  function contextIndexIdentity(agent, c, rPlain, ctx) {
133
135
  const fromType = parseContextIndexType(c.type);
134
- const sidecar = resourceSidecar(agent, c, ctx, `context index "${c.id}"`, 'the resource decompiles from the node');
136
+ const sidecar = resourceSidecar(agent, ctx.sourceText(c.inputs?.source), ctx, `context index "${c.id}"`, 'the resource decompiles from the node');
135
137
  const sidecarText = (k) => typeof sidecar?.[k] === 'string' && sidecar[k] !== '' ? sidecar[k] : undefined;
136
138
  const label = typeof c.display?.label === 'string' && c.display.label !== '' ? c.display.label : undefined;
137
139
  // The canvas can set both sidecar `name` and `indexName`, and they can differ.
@@ -287,31 +289,6 @@ function contextIndexSettings(agent, c, sidecar, ctx) {
287
289
  ['fileExtension', extensionSrc],
288
290
  ];
289
291
  }
290
- /**
291
- * Resource node `r`'s `<agent source>/resources/<r's source>/resource.json`,
292
- * parsed; `undefined` when it is not beside the `.flow`, or (with a warning
293
- * that `fallback` completes) when it is not a JSON object.
294
- */
295
- function resourceSidecar(agent, r, ctx, what, fallback) {
296
- const agentSource = ctx.sourceText(agent.inputs?.source);
297
- const resourceSource = ctx.sourceText(r.inputs?.source);
298
- if (!agentSource || !resourceSource)
299
- return undefined;
300
- const path = `${agentSource}/resources/${resourceSource}/resource.json`;
301
- const raw = ctx.sidecar(path);
302
- if (raw === undefined)
303
- return undefined;
304
- try {
305
- const json = JSON.parse(raw);
306
- if (json && typeof json === 'object' && !Array.isArray(json))
307
- return json;
308
- }
309
- catch {
310
- // Reported below with the non-object case.
311
- }
312
- ctx.warn(`${what}: ${path} is not valid JSON, so ${fallback}.`);
313
- return undefined;
314
- }
315
292
  /**
316
293
  * The keys of a tool's schema property that its flat type may drop unreported:
317
294
  * the type it keeps, the title and the description (an argument's Prompt,
@@ -658,10 +635,8 @@ export function liftInlineAgent(node, ctx) {
658
635
  // that plans the same inputs, in the same order, as printing all of them
659
636
  // would; otherwise every input is printed, and a tool reference one of them
660
637
  // binds is still one input, `refs` being deduped by flat name.
661
- const placeholders = new Set([i.systemPrompt, i.userPrompt].flatMap((p) => {
662
- const raw = plain(p);
663
- return raw === undefined ? [] : [...unrender(raw).matchAll(/\{\{\s*input\.([A-Za-z_$][A-Za-z0-9_$]*)\s*\}\}/g)].map((m) => m[1]);
664
- }));
638
+ const prompt = (p) => (plain(p) === undefined ? undefined : unrender(plain(p)));
639
+ const placeholders = new Set(promptPlaceholders({ systemPrompt: prompt(i.systemPrompt), userPrompt: prompt(i.userPrompt) }));
665
640
  const toolOnly = new Set(toolVariables.map((v) => v.id).filter((id) => !placeholders.has(id)));
666
641
  /** The flat names compile plans from `declared` and the tools' references, deduped as `agentInputPlan` does. */
667
642
  const planned = (declared) => JSON.stringify([...new Set([
@@ -765,8 +740,27 @@ export function liftAgentResources(node, ctx, withMemory, agentInputs = []) {
765
740
  const raw = ctx.sourceText(rInputs(n)[k]);
766
741
  return raw === undefined || raw === '' ? undefined : raw;
767
742
  };
768
- /** The agent inputs the process tools' Variables bind, in tool and argument order. */
743
+ /** The agent inputs the tools' Variables bind (a process tool's arguments, a built-in's task), in tool and argument order. */
769
744
  const toolVariables = [];
745
+ /**
746
+ * A built-in tool's task Variable, as the reference of the agent input it
747
+ * names: by its `{{<flatName>}}` in the sidecar, by `$agent.<flatName>`, or by
748
+ * its `$vars.<path>` on a canvas node (the canvas's own form, which it derives
749
+ * the flat name from). Resolved as a process tool argument's path is
750
+ * ({@link argumentInput}), and recorded with the tools' Variables.
751
+ */
752
+ const taskVariable = (task) => {
753
+ const text = task.text.trim();
754
+ const braced = /^\{\{\s*(.*?)\s*\}\}$/.exec(text)?.[1];
755
+ const name = braced ?? (text.startsWith('$agent.') ? text.slice('$agent.'.length) : flatNameOf(text));
756
+ if (name === undefined || name === '')
757
+ return undefined;
758
+ const input = argumentInput(jsonPathKey(name), agentInputs, ctx);
759
+ if (input.kind !== 'variable')
760
+ return undefined;
761
+ toolVariables.push({ id: input.id, ref: input.ref });
762
+ return new Expr(input.body);
763
+ };
770
764
  const toolSrc = ctx.attached('tool', Infinity, liftable).map((t) => {
771
765
  const ti = rInputs(t);
772
766
  const type = t.type;
@@ -816,8 +810,26 @@ export function liftAgentResources(node, ctx, withMemory, agentInputs = []) {
816
810
  ['folderPath', rPlain(t, 'folderPath') !== undefined ? tsLiteral(rPlain(t, 'folderPath')) : undefined],
817
811
  ]);
818
812
  }
813
+ if (type === 'uipath.agent.resource.tool.builtin.batchtransform') {
814
+ // Every setting, node first, with the sidecar as the fallback (D8 of
815
+ // docs/INLINE_AGENT_BATCH_TRANSFORM_DESIGN.md). The directory is the node's
816
+ // `source`, or the canvas's `inputs.id` when `source` is empty or a file
817
+ // binding: kept as the tool's `source`, so a recompile writes back into it.
818
+ const { entries, dir } = liftBatchTransformTool(node, t, ctx, taskVariable);
819
+ const derived = derivedToolSource(ctx.flowId, node.id, { kind: 'builtin', tool: 'batchtransform' });
820
+ const all = [
821
+ ...entries,
822
+ ['nodeId', keepIds.has(t.id) ? tsLiteral(t.id) : undefined],
823
+ ['source', dir !== undefined && dir !== derived ? tsLiteral(dir) : undefined],
824
+ ];
825
+ return all.every(([, v]) => typeof v !== 'function') ? opts(all)
826
+ : (print) => opts(all.map(([k, v]) => [k, typeof v === 'function' ? v(print) : v]));
827
+ }
819
828
  if (type.startsWith('uipath.agent.resource.tool.builtin.')) {
820
829
  const tool = type.slice('uipath.agent.resource.tool.builtin.'.length);
830
+ // Only batchtransform's task is read back (above); any other built-in
831
+ // with a task (summarize) reports one it would drop.
832
+ reportUnreadBuiltinTask(node, t, tool, ctx);
821
833
  return toolOpts(t, { kind: 'builtin', tool }, [
822
834
  ['kind', tsLiteral('builtin')],
823
835
  ['tool', tsLiteral(tool)],
@@ -848,7 +860,7 @@ export function liftAgentResources(node, ctx, withMemory, agentInputs = []) {
848
860
  // definition's `inputDefaults.inputSchema` / `outputSchema` and the
849
861
  // resource.json's, and `description` only into the resource.json.
850
862
  const what = `${ns[1]} tool ${JSON.stringify(t.id)} on agent ${JSON.stringify(node.id)}`;
851
- const sidecar = resourceSidecar(node, t, ctx, what, 'its inputs and returns decompile from its definition');
863
+ const sidecar = resourceSidecar(node, ctx.sourceText(t.inputs?.source), ctx, what, 'its inputs and returns decompile from its definition');
852
864
  const description = typeof sidecar?.description === 'string' && sidecar.description !== '' ? sidecar.description : undefined;
853
865
  const { inputs, returns, variables } = processToolFields(t, what, sidecar, def?.inputDefaults, agentInputs, ctx);
854
866
  toolVariables.push(...variables);
@@ -19,18 +19,24 @@ export type AgentKindLabel = 'Inline agent' | 'Voice agent' | 'Conversational ag
19
19
  /** The inline agent's node, sidecar and resources. */
20
20
  export declare function serializeInlineAgent(s: InlineAgentInputs, ctx: FlowSerializeContext): FlowNodeContribution;
21
21
  /**
22
- * Each process tool's arguments, judged before the agent's resources are
23
- * attached: `toolArgument` is the first one compile cannot write
24
- * ({@link toolArgumentRefusal}), in tool then argument order, for the caller to
25
- * hold until it has judged the rest; `toolVariables` holds each tool's
26
- * Variables, for the caller to bind as agent inputs, a refused argument left out.
22
+ * Each process tool's arguments, and each built-in's task and settings, judged
23
+ * before the agent's resources are attached: `toolArgument` is the first one
24
+ * compile cannot write ({@link toolArgumentRefusal}, {@link builtinToolQueryRefusal},
25
+ * {@link builtinToolSettingRefusal}), in tool then argument order, for the
26
+ * caller to hold until it has judged the rest; `toolVariables` holds each
27
+ * tool's Variables in `tools` order (a process tool's by argument name,
28
+ * {@link toolVariableRefs}; a built-in's task as `query`,
29
+ * {@link builtinToolQueryRef}), for the caller to bind as agent inputs, a
30
+ * refused one left out. It is the only collector of the tools' references:
31
+ * decompile's tool-only `inputs` row rule relies on their order.
27
32
  *
28
33
  * `bindsVariables` is false for the voice and conversational agents: compile
29
34
  * extends only the inline agent's input plan with a tool's references, so a
30
35
  * Variable there would bind nothing and the model would fill the argument. It
31
- * is refused instead (`FLOW_AGENT_TOOL_ARGUMENT_VARIABLE`).
36
+ * is refused instead (`FLOW_AGENT_TOOL_ARGUMENT_VARIABLE`; for a built-in's
37
+ * task, `FLOW_AGENT_BUILTIN_TASK_VARIABLE`).
32
38
  */
33
- export declare function processToolArguments(s: AgentResources, step: string, who: AgentKindLabel, render: (v: unknown) => unknown, bindsVariables: boolean): {
39
+ export declare function toolArguments(s: AgentResources, step: string, who: AgentKindLabel, render: (v: unknown) => unknown, bindsVariables: boolean): {
34
40
  toolVariables: Map<object, ReturnType<typeof toolVariableRefs>>;
35
41
  toolArgument: CompileRefusal | undefined;
36
42
  };
@@ -11,7 +11,7 @@ import { processResourceBindings } from '../../../core/process-resource.js';
11
11
  import { toolArgumentRefusal, toolVariableRefs } from '../../../core/tool-argument.js';
12
12
  import { fnv1aX4Uuid, schemaId } from '../../../core/stable-id.js';
13
13
  import { synthesizedDefinitionRefusal } from '../../../core/synthesized-definition.js';
14
- 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
+ import { BUILTIN_TOOL_DEFS, builtinToolQueryRefusal, builtinToolSettingRefusal, INLINE_AGENT, PROCESS_TOOL_META, a2aToolDef, builtinToolResourceJson, connectorToolDef, connectorToolDescription, connectorToolDetail, connectorToolResourceJson, contextIndexDef, contextResourceJson, declaresMemoryHandle, escalationAppFolder, escalationDef, escalationResourceJson, fieldSchema, httpRequestToolResourceJson, inlineAgentDef, ixpToolDef, mcpToolDef, memoryResourceDef, processToolDef, builtinToolQueryRef, renderBuiltinToolQuery, renderContextQuery, toolResourceJson, voiceAgentRevision, } from './resources.js';
15
15
  import { CompileRefusal } from '../../../core/compile-refusal.js';
16
16
  /** Every bundled version of the inline agent, oldest first; the newest is the default (#956). */
17
17
  export const INLINE_AGENT_VERSIONS = ['1.2', '1.3', '1.4'];
@@ -67,11 +67,12 @@ export function serializeInlineAgent(s, ctx) {
67
67
  properties: Object.fromEntries(Object.entries(returns).map(([k, t]) => [k, { type: t }])),
68
68
  };
69
69
  }
70
- // A process tool's Variable arguments, by tool: each binds an agent input of
71
- // its own, as the canvas derives one from every reference a tool node holds
72
- // (`deriveAgentInputVariables`), so they are read before the plan is built.
73
- // An argument compile cannot write is held like a composite input (below).
74
- const { toolVariables, toolArgument } = processToolArguments(s, step, 'Inline agent', render, true);
70
+ // A tool's Variables, by tool (a process tool's arguments, a built-in's
71
+ // task): each binds an agent input of its own, as the canvas derives one from
72
+ // every reference a tool node holds (`deriveAgentInputVariables`), so they are
73
+ // read before the plan is built. An argument or task compile cannot write is
74
+ // held like a composite input (below).
75
+ const { toolVariables, toolArgument } = toolArguments(s, step, 'Inline agent', render, true);
75
76
  // What the PLATFORM will call each of these — computed once and shared by the
76
77
  // descriptor array below and the sidecar. See `agentInputPlan`.
77
78
  const plan = agentInputPlan(s.inputs ?? {}, render, [...toolVariables.values()].flatMap((v) => Object.values(v)));
@@ -156,9 +157,9 @@ export function serializeInlineAgent(s, ctx) {
156
157
  // (AGENT_MEMORY_NOT_AUTHORABLE); its shape maps cleanly off `AgentMemoryRef`
157
158
  // but cannot be exercised while the handle does not exist.
158
159
  }
159
- // The held refusals: the agent's own inputs, then its tools' arguments, and
160
- // LIBRARY_REQUIRED last, because `check` drops it (failing open), so it must
161
- // not hide either.
160
+ // The held refusals: the agent's own inputs, then its tools' arguments and
161
+ // built-in tasks, and LIBRARY_REQUIRED last, because `check` drops it
162
+ // (failing open), so it must not hide either.
162
163
  if (compositeInput)
163
164
  throw compositeInput;
164
165
  if (toolArgument)
@@ -182,22 +183,46 @@ export function serializeInlineAgent(s, ctx) {
182
183
  };
183
184
  }
184
185
  /**
185
- * Each process tool's arguments, judged before the agent's resources are
186
- * attached: `toolArgument` is the first one compile cannot write
187
- * ({@link toolArgumentRefusal}), in tool then argument order, for the caller to
188
- * hold until it has judged the rest; `toolVariables` holds each tool's
189
- * Variables, for the caller to bind as agent inputs, a refused argument left out.
186
+ * Each process tool's arguments, and each built-in's task and settings, judged
187
+ * before the agent's resources are attached: `toolArgument` is the first one
188
+ * compile cannot write ({@link toolArgumentRefusal}, {@link builtinToolQueryRefusal},
189
+ * {@link builtinToolSettingRefusal}), in tool then argument order, for the
190
+ * caller to hold until it has judged the rest; `toolVariables` holds each
191
+ * tool's Variables in `tools` order (a process tool's by argument name,
192
+ * {@link toolVariableRefs}; a built-in's task as `query`,
193
+ * {@link builtinToolQueryRef}), for the caller to bind as agent inputs, a
194
+ * refused one left out. It is the only collector of the tools' references:
195
+ * decompile's tool-only `inputs` row rule relies on their order.
190
196
  *
191
197
  * `bindsVariables` is false for the voice and conversational agents: compile
192
198
  * extends only the inline agent's input plan with a tool's references, so a
193
199
  * Variable there would bind nothing and the model would fill the argument. It
194
- * is refused instead (`FLOW_AGENT_TOOL_ARGUMENT_VARIABLE`).
200
+ * is refused instead (`FLOW_AGENT_TOOL_ARGUMENT_VARIABLE`; for a built-in's
201
+ * task, `FLOW_AGENT_BUILTIN_TASK_VARIABLE`).
195
202
  */
196
- export function processToolArguments(s, step, who, render, bindsVariables) {
203
+ export function toolArguments(s, step, who, render, bindsVariables) {
197
204
  const toolRefs = s.tools === undefined ? [] : Array.isArray(s.tools) ? s.tools : [s.tools];
198
205
  const toolVariables = new Map();
199
206
  let toolArgument;
200
207
  for (const tr of toolRefs) {
208
+ if (tr !== null && typeof tr === 'object' && tr.kind === 'builtin') {
209
+ // Its task, for the built-ins whose definition has one (`renderBuiltinToolQuery`
210
+ // reads `query` for those alone), then its Batch Transform settings. An
211
+ // unknown built-in is refused when the tool is attached.
212
+ const defaults = ownEntry(BUILTIN_TOOL_DEFS, tr.tool)?.inputDefaults;
213
+ if (defaults === undefined)
214
+ continue;
215
+ const where = `${who} step "${step}"'s ${tr.tool} tool`;
216
+ const taskRefusal = 'query' in defaults
217
+ ? builtinToolQueryRefusal(tr.query, where, render)
218
+ ?? (bindsVariables ? undefined : taskVariableRefusal(who, where, tr.query, render))
219
+ : undefined;
220
+ const ref = 'query' in defaults && taskRefusal === undefined ? builtinToolQueryRef(tr.query, render) : undefined;
221
+ if (ref !== undefined)
222
+ toolVariables.set(tr, { query: ref });
223
+ toolArgument ??= taskRefusal ?? builtinToolSettingRefusal(tr, defaults, where);
224
+ continue;
225
+ }
201
226
  if (tr === null || typeof tr !== 'object' || !ownEntry(PROCESS_TOOL_META, tr.kind))
202
227
  continue;
203
228
  const p = tr;
@@ -224,6 +249,19 @@ function variableRefusal(who, step, tool, name, arg) {
224
249
  + `nothing, and the model would fill the argument. Give it a fixed \`value\` or a \`prompt\`, or attach the `
225
250
  + `tool to an \`inlineAgent()\`.`, `${name}: { type: '${String(arg.type)}', value: … }`);
226
251
  }
252
+ /**
253
+ * FLOW_AGENT_BUILTIN_TASK_VARIABLE: a built-in's task Variable on an agent whose
254
+ * input plan compile does not extend, as {@link variableRefusal} is for a
255
+ * process tool argument's. Only a single reference reaches here: one that is
256
+ * not is FLOW_AGENT_BUILTIN_COMPOSITE_REF first.
257
+ */
258
+ function taskVariableRefusal(who, where, query, render) {
259
+ if (builtinToolQueryRef(query, render) === undefined)
260
+ return undefined;
261
+ return new CompileRefusal('FLOW_AGENT_BUILTIN_TASK_VARIABLE', `${where} takes its task from a \`variable\`. Compile binds a task's Variable as an agent input only on an `
262
+ + `inline agent; on a ${who.toLowerCase()} it would bind nothing, and the task would never reach the tool. `
263
+ + `Give it a fixed \`value\` or a \`prompt\`, or attach the tool to an \`inlineAgent()\`.`, `query: { value: … }`);
264
+ }
227
265
  /**
228
266
  * The resources an agent attaches — a node per context index, tool and
229
267
  * escalation on the agent's `context`, `tool` and `escalation` handles, and the
@@ -360,7 +398,17 @@ export function attachAgentResources(s, ctx, source, who, toolVariables = new Ma
360
398
  if (tr.description !== undefined)
361
399
  extraInputs.description = tr.description;
362
400
  if ('query' in extraInputs && tr.query !== undefined) {
363
- extraInputs.query = renderContextQuery(tr.query, render);
401
+ extraInputs.query = renderBuiltinToolQuery(tr.query, render);
402
+ }
403
+ // batchtransform's columns and grounding, as the canvas's form writes them:
404
+ // the rows as given, and the select's lowercase value (the resource
405
+ // capitalizes it). Their rules are `check`'s, as the canvas's are its form's,
406
+ // except the two `toolArguments` holds (`builtinToolSettingRefusal`).
407
+ if ('outputColumns' in extraInputs && tr.outputColumns !== undefined) {
408
+ extraInputs.outputColumns = jsonClone(tr.outputColumns);
409
+ }
410
+ if ('webSearchGrounding' in extraInputs && tr.webSearchGrounding !== undefined) {
411
+ extraInputs.webSearchGrounding = { value: tr.webSearchGrounding };
364
412
  }
365
413
  if ('fileExtension' in extraInputs && tr.fileExtension !== undefined) {
366
414
  extraInputs.fileExtension = { value: tr.fileExtension };
@@ -533,7 +581,7 @@ export function attachAgentResources(s, ctx, source, who, toolVariables = new Ma
533
581
  const toolResource = connectorTool
534
582
  ? connectorToolResourceJson(connectorTool, toolResourceId)
535
583
  : tr.kind === 'builtin'
536
- ? builtinToolResourceJson(tr.tool, label, toolInputs, { id: toolResourceId })
584
+ ? builtinToolResourceJson(tr.tool, label, toolInputs, { id: toolResourceId, canvasNodeId: tid })
537
585
  : tr.kind === 'httpRequest'
538
586
  ? httpRequestToolResourceJson(label, toolInputs, { id: toolResourceId, canvasNodeId: tid })
539
587
  : toolResourceJson(tr, { id: toolResourceId, variables: toolVariables.get(tr) });
@@ -15,7 +15,7 @@ import { agentInputPlan, agentSidecarInputs, conversationalAgentJson, voiceAgent
15
15
  import { Expr, toExpr } from '../../../core/expr.js';
16
16
  import { wireExprBody } from '../../../core/wire-expr.js';
17
17
  import { checkAgentResources, checkConversationalAgent, checkInlineAgent, checkInlineAgentRead, checkVoice } from './check.js';
18
- import { INLINE_AGENT_DEFAULT_VERSION, INLINE_AGENT_VERSIONS, attachAgentResources, processToolArguments, serializeInlineAgent, } from './inline-agent.js';
18
+ import { INLINE_AGENT_DEFAULT_VERSION, INLINE_AGENT_VERSIONS, attachAgentResources, toolArguments, serializeInlineAgent, } from './inline-agent.js';
19
19
  import { liftAgentResources, liftInlineAgent, printInlineAgent } from './inline-agent-lift.js';
20
20
  import { INLINE_AGENT } from './resources.js';
21
21
  const CREATE_OUTGOING_CALL = 'uipath.conversational.voice.create-outgoing-call';
@@ -127,10 +127,10 @@ function serializeVoiceAgent(s, ctx) {
127
127
  * resource nodes and `resource.json` files, under this agent's `source` (#1670).
128
128
  */
129
129
  function shellResources(s, ctx, source, who) {
130
- // A process tool argument compile cannot write, a Variable included, is held
131
- // until the resources are judged, and thrown before LIBRARY_REQUIRED, which
132
- // `check` drops, as on the inline agent.
133
- const { toolArgument } = processToolArguments(s, ctx.step, who, (v) => ctx.render(v), false);
130
+ // A process tool argument compile cannot write, a Variable included, or a
131
+ // built-in task it cannot write, is held until the resources are judged, and
132
+ // thrown before LIBRARY_REQUIRED, which `check` drops, as on the inline agent.
133
+ const { toolArgument } = toolArguments(s, ctx.step, who, (v) => ctx.render(v), false);
134
134
  const { attach, libraryRequired } = attachAgentResources(s, ctx, source, who);
135
135
  if (toolArgument)
136
136
  throw toolArgument;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * An agent resource's `resource.json`, as decompile reads it beside the `.flow`:
3
+ * `<agent source>/resources/<dir>/resource.json`. Shared by the context index
4
+ * and process tool lifts, which name the directory by the node's
5
+ * `inputs.source`, and the built-in tool lift, which falls back to `inputs.id`
6
+ * (`builtinResourceDirectory`, core/agent-resource-identity.ts, shared with
7
+ * merge's resource pairing).
8
+ */
9
+ import type { FlowDeserializeContext } from '../../../flow-node-type.js';
10
+ /** The part of a `.flow` node the sidecar lookup reads. */
11
+ interface ResourceNode {
12
+ id: string;
13
+ inputs?: Record<string, unknown>;
14
+ }
15
+ /**
16
+ * The sidecar `<agent source>/resources/<dir>/resource.json` of a resource on
17
+ * `agent`, parsed; `undefined` when the agent has no source, `dir` is undefined
18
+ * or empty, the file is not beside the `.flow`, or (with a warning that
19
+ * `fallback` completes) it is not a JSON object.
20
+ */
21
+ export declare function resourceSidecar(agent: ResourceNode, dir: string | undefined, ctx: FlowDeserializeContext, what: string, fallback: string): Record<string, unknown> | undefined;
22
+ export {};
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The sidecar `<agent source>/resources/<dir>/resource.json` of a resource on
3
+ * `agent`, parsed; `undefined` when the agent has no source, `dir` is undefined
4
+ * or empty, the file is not beside the `.flow`, or (with a warning that
5
+ * `fallback` completes) it is not a JSON object.
6
+ */
7
+ export function resourceSidecar(agent, dir, ctx, what, fallback) {
8
+ const agentSource = ctx.sourceText(agent.inputs?.source);
9
+ if (!agentSource || !dir)
10
+ return undefined;
11
+ const path = `${agentSource}/resources/${dir}/resource.json`;
12
+ const raw = ctx.sidecar(path);
13
+ if (raw === undefined)
14
+ return undefined;
15
+ try {
16
+ const json = JSON.parse(raw);
17
+ if (json && typeof json === 'object' && !Array.isArray(json))
18
+ return json;
19
+ }
20
+ catch {
21
+ // Reported below with the non-object case.
22
+ }
23
+ ctx.warn(`${what}: ${path} is not valid JSON, so ${fallback}.`);
24
+ return undefined;
25
+ }
@@ -1,4 +1,5 @@
1
1
  import type { ContextIndexRef, EscalationRef, ProcessToolKind, ToolArgument } from '../../../core/actions.js';
2
+ import { CompileRefusal } from '../../../core/compile-refusal.js';
2
3
  import type { ResolvedConnector } from '../../../core/library.js';
3
4
  import type { ProcessResourceSubType } from '../../../core/process-resource.js';
4
5
  /** The inline (autonomous) agent's node type — fixed, not per-instance. */
@@ -45,6 +46,68 @@ export declare function contextIndexDef(spec: {
45
46
  * `mode: 'text-builder'` by default.
46
47
  */
47
48
  export declare function renderContextQuery(query: unknown, render: (value: unknown) => unknown): Record<string, unknown>;
49
+ /**
50
+ * Render a built-in tool's task (`summarize`, `batchtransform`) into the node's
51
+ * MODE-TAGGED `query`, from the canvas's sources (`BuiltinToolQuery`):
52
+ * - omitted: Empty, `{ mode: 'prompt' }` with every value empty;
53
+ * - a string or `{ prompt }`: Prompt, its text the `promptValue`;
54
+ * - `{ value }`: Fixed value, `{ mode: 'text-builder' }` with the task as the
55
+ * `textValue`;
56
+ * - `{ variable }` holding a single reference: Variable, `{ mode: 'variable' }`
57
+ * with the reference as the `argumentPath`, in the canvas's own `$vars.<path>`
58
+ * form (what its variable picker stores, and what its load path rewrites a
59
+ * sidecar's `{{<flatName>}}` back to). Its agent input is
60
+ * {@link builtinToolQueryRef}'s.
61
+ *
62
+ * Only a plain object whose single key is `prompt`, `value` or `variable` is a
63
+ * named form. A string or a flow expression keeps the meaning
64
+ * {@link renderContextQuery} gives it, so a flow that compiled before compiles
65
+ * the same: a bare expression is still a `text-builder` query with the
66
+ * expression's text.
67
+ *
68
+ * A plain object compile cannot write, and a `{ variable }` that is not one
69
+ * reference, are {@link builtinToolQueryRefusal}'s, which the agent holds and
70
+ * throws before anything is written; they render here as Empty, so the tool
71
+ * is attached like any other while the rest of the agent is judged.
72
+ */
73
+ export declare function renderBuiltinToolQuery(query: unknown, render: (value: unknown) => unknown): Record<string, unknown>;
74
+ /**
75
+ * The agent input a built-in tool's task Variable binds: the single reference in
76
+ * `{ variable }`, under its flat name, as `agentInputPlan` takes a tool's
77
+ * references. Undefined for every other source, and for a `{ variable }` that is
78
+ * not one reference.
79
+ */
80
+ export declare function builtinToolQueryRef(query: unknown, render: (value: unknown) => unknown): {
81
+ flatName: string;
82
+ binding: string;
83
+ } | undefined;
84
+ /**
85
+ * The refusal for a built-in's task compile cannot write (a lowering refusal:
86
+ * `compile` runs no lint), or undefined for one it can:
87
+ * - FLOW_AGENT_BUILTIN_QUERY_SOURCE: a plain object that is not exactly
88
+ * `{ prompt }`, `{ value }` or `{ variable }` (no source key, more than one,
89
+ * or a key beside its source), which would otherwise reach the model as its
90
+ * JSON in a Prompt;
91
+ * - FLOW_AGENT_BUILTIN_COMPOSITE_REF: a `{ variable }` that is not one
92
+ * reference, a computed expression or a constant, which has no agent input
93
+ * to name, so the task would never reach the tool.
94
+ * A string or a flow expression is always writable. `where` names the tool.
95
+ */
96
+ export declare function builtinToolQueryRefusal(query: unknown, where: string, render: (value: unknown) => unknown): CompileRefusal | undefined;
97
+ /**
98
+ * The Batch Transform settings compile cannot write on a built-in, or
99
+ * undefined: FLOW_AGENT_BUILTIN_SETTING_NOT_APPLICABLE for `outputColumns` or
100
+ * `webSearchGrounding` on a built-in whose definition (`defaults`, its
101
+ * `inputDefaults`) does not declare them, which the .flow would drop; and
102
+ * FLOW_AGENT_BATCH_TRANSFORM_GROUNDING for a grounding the node's select does
103
+ * not offer, which `resource.json`'s capitalized `Enabled`/`Disabled` would
104
+ * rewrite. Both are lowering refusals. `where` names the tool.
105
+ */
106
+ export declare function builtinToolSettingRefusal(tool: {
107
+ tool: string;
108
+ outputColumns?: unknown;
109
+ webSearchGrounding?: unknown;
110
+ }, defaults: Record<string, unknown>, where: string): CompileRefusal | undefined;
48
111
  /**
49
112
  * The `resources/<id>/resource.json` an inline agent's context index needs.
50
113
  *
@@ -144,11 +207,13 @@ export declare const enumValue: (v: unknown) => string;
144
207
  * resource `query` is VARIANT-tagged where the node's is MODE-tagged, and its
145
208
  * enums are capitalized (`Inline`, `Enabled`). `analyze-attachments` declares
146
209
  * the model-facing call contract (`attachments` + `analysisTask` → `analysis`);
147
- * `deep-rag` and `batch-transform` declare empty schemas and carry their
148
- * configuration in `properties.settings`.
210
+ * `deep-rag` declares empty schemas and carries its configuration in
211
+ * `properties.settings`. `batch-transform` is written as the canvas writes it
212
+ * instead ({@link batchTransformResourceJson}).
149
213
  */
150
214
  export declare function builtinToolResourceJson(tool: string, label: string, inputs: Record<string, any>, spec: {
151
215
  id: string;
216
+ canvasNodeId: string;
152
217
  }): Record<string, unknown> | undefined;
153
218
  /**
154
219
  * The six request fields of the HTTP-request tool, in the node's (and the
@@ -232,9 +297,10 @@ export declare function escalationResourceJson(esc: EscalationRef, spec: {
232
297
  * `allowedTargets: [{ nodeType: 'uipath.agent.resource.tool.*' }]`.
233
298
  *
234
299
  * `withVoice` adds the voice agent as a source, which the designer writes on
235
- * every tool it places today (#1670). The bundled built-in tools at 1.1 are
236
- * the exception: flow-core froze that version's handle without it, and 1.2 is
237
- * the same definition with it (`voiceAgentRevision`).
300
+ * every tool it places today (#1670). The bundled built-in tools at 1.1
301
+ * (`analyzefiles`, `summarize`) are the exception: flow-core froze that
302
+ * version's handle without it, and 1.2 is the same definition with it
303
+ * (`voiceAgentRevision`). `batchtransform` is bundled at 1.2, with it.
238
304
  */
239
305
  export declare function toolInputHandle(withVoice?: boolean): any;
240
306
  /**
@@ -243,6 +309,8 @@ export declare function toolInputHandle(withVoice?: boolean): any;
243
309
  * voice agent as a source, and its 1.2 of each is that definition with the
244
310
  * voice agent added (`addVoiceAgentToInputHandleSources`, flow-core's
245
311
  * migration-helpers.ts). For instance `builtin.analyzefiles` 1.1 becomes 1.2.
312
+ * A definition whose input handle already lists the voice agent
313
+ * (`builtin.batchtransform`, bundled at 1.2) is its own revision.
246
314
  */
247
315
  export declare function voiceAgentRevision(def: any): any;
248
316
  /** A `{ name: type }` field map as the JSON-schema object the platform stores. */
@@ -250,9 +318,9 @@ export declare function fieldSchema(fields: Record<string, string> | undefined):
250
318
  /**
251
319
  * The definitions for the three platform BUILT-IN tools, transcribed from
252
320
  * `uip maestro flow registry get uipath.agent.resource.tool.builtin.<name>`
253
- * (2026-07-31, version 1.1 all three). These are fixed types — no tenant
254
- * resource behind them — so unlike every other tool kind the def CAN be
255
- * bundled.
321
+ * (2026-07-31, version 1.1; `batchtransform` 1.2 since 2026-11-02, see its
322
+ * entry). These are fixed types — no tenant resource behind them — so unlike
323
+ * every other tool kind the def CAN be bundled.
256
324
  *
257
325
  * One wrinkle carried faithfully rather than smoothed over: the three defs
258
326
  * disagree about where the node's `source` identity lives. `analyzefiles`