@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.
@@ -1495,6 +1495,7 @@ declare class TaskBuilder {
1495
1495
  * @returns This builder, so calls chain.
1496
1496
  * @enforcedBy DOCUMENT_EXTRACTION_OLDER_SHAPE `check` warns that the task is carried as saved and a re-save upgrades it.
1497
1497
  * @enforcedBy DOCUMENT_EXTRACTION_SAVED_DATA compile refuses it without its preserved data, or with `.outputs()`.
1498
+ * @enforcedBy DOCUMENT_EXTRACTION_SAVED_VAR_UNDECLARED `check` warns when a saved output row writes a variable no `.var()` declares.
1498
1499
  */
1499
1500
  savedDocumentExtraction(): this;
1500
1501
  /**
@@ -570,6 +570,7 @@ class TaskBuilder {
570
570
  * @returns This builder, so calls chain.
571
571
  * @enforcedBy DOCUMENT_EXTRACTION_OLDER_SHAPE `check` warns that the task is carried as saved and a re-save upgrades it.
572
572
  * @enforcedBy DOCUMENT_EXTRACTION_SAVED_DATA compile refuses it without its preserved data, or with `.outputs()`.
573
+ * @enforcedBy DOCUMENT_EXTRACTION_SAVED_VAR_UNDECLARED `check` warns when a saved output row writes a variable no `.var()` declares.
573
574
  */
574
575
  savedDocumentExtraction() {
575
576
  this.setKind('document-extraction');
@@ -4,7 +4,8 @@ import { schemaVersionRefusal } from '../schema-version.js';
4
4
  import { EQUALS_EXPR_DIALECT, checkConnectorLookups, checkConnectorResources, checkConnectorSchema, } from '../core/connector-checks.js';
5
5
  import { isConnectorPlaceholder } from './connector-placeholder.js';
6
6
  import { documentExtractionLint } from './document-extraction.js';
7
- import { savedDocumentExtractionLint } from './document-extraction-saved.js';
7
+ import { carriedDocumentExtractionTasks, savedDocumentExtractionLint, savedDocumentExtractionVarLint } from './document-extraction-saved.js';
8
+ import { caseJsonPreservation } from './preserve.js';
8
9
  import { scriptLint } from './script.js';
9
10
  import { httpRequestLint } from './http-request.js';
10
11
  import { checkRuleSemantics } from './check-rule-semantics.js';
@@ -226,6 +227,9 @@ export function check(built, opts = {}) {
226
227
  const f = savedDocumentExtractionLint(`Document extraction task "${t.name}"`);
227
228
  diags.push({ level: 'warning', code: f.code, message: f.message, suggestion: f.suggestion, where: t.name });
228
229
  }
230
+ // A carried task's saved row that writes an undeclared variable (lint).
231
+ for (const f of savedDocumentExtractionVarLint(carriedDocumentExtractionTasks(built), caseJsonPreservation(built)?.documentExtractionData, new Set(built.vars.map((v) => v.name))))
232
+ diags.push({ level: 'warning', code: f.code, message: f.message, suggestion: f.suggestion, where: f.where });
229
233
  // A script body compile writes as authored but a person should fix (lint).
230
234
  for (const stage of built.stages)
231
235
  for (const lane of stage.lanes)
@@ -446,13 +450,17 @@ function checkSla(sla, where, diags) {
446
450
  // escalation notifies nobody until the id is filled in. The test is the one
447
451
  // CASE_MGMT_ESCALATION_RECIPIENT_LITERAL skips on (plan-check/rules/sla.ts),
448
452
  // so the two split every non-GUID target with no gap: `<UNRESOLVED>`,
449
- // `<UNRESOLVED: …>` and a marker mid-string all land here.
453
+ // `<UNRESOLVED: …>` and a marker mid-string all land here. So does a blank
454
+ // target, which neither rule otherwise reports and `validate` accepts: it is
455
+ // the same gap, a recipient with nobody named yet.
450
456
  for (const r of e.notify)
451
- if (r.target.includes('<UNRESOLVED'))
457
+ if (r.target.includes('<UNRESOLVED') || r.target.trim() === '')
452
458
  diags.push({
453
459
  level: 'warning',
454
460
  code: 'ESCALATION_RECIPIENT_UNRESOLVED',
455
- message: `${where}: an escalation recipient is still the marker ${JSON.stringify(r.target)}, so it notifies no one until the tenant id is filled in.`,
461
+ message: r.target.trim() === ''
462
+ ? `${where}: an escalation recipient has a blank target, so it notifies no one.`
463
+ : `${where}: an escalation recipient is still the marker ${JSON.stringify(r.target)}, so it notifies no one until the tenant id is filled in.`,
456
464
  suggestion: r.scope === 'UserGroup'
457
465
  ? "Put the group's tenant id in target: toGroup('<group id>', '<name>'). 'uip admin groups list --output json' lists them."
458
466
  : "Put the user's tenant id or email in target: toUser('<user id or email>', '<email>').",
@@ -1,4 +1,5 @@
1
1
  import type { DocumentExtractionFinding } from './document-extraction.js';
2
+ import type { BuiltCase } from './case-sdk.js';
2
3
  /** Whether a document-extraction task's saved `data` is the older shape, which is carried rather than lifted. */
3
4
  export declare function isOlderDocumentExtractionData(data: unknown): data is Record<string, unknown>;
4
5
  /** One carried task's saved `data`, located the way the other per-task lanes are. */
@@ -19,6 +20,54 @@ export declare function savedDocumentExtractionLint(owner: string): DocumentExtr
19
20
  * refusal: the task names no saved data (the payload was dropped or the task
20
21
  * renamed), or it maps outputs, which the saved rows already are.
21
22
  */
22
- export declare function savedDocumentExtractionData(owner: string, entries: readonly PreservedDocumentExtractionData[] | undefined, stage: string, task: string, hasOutputs: boolean): Record<string, unknown>;
23
+ export declare function savedDocumentExtractionData(owner: string, pairing: SavedDocumentExtractionPairing, stage: string, task: string, hasOutputs: boolean): Record<string, unknown>;
24
+ /** A `.savedDocumentExtraction()` task, as compile meets it. */
25
+ export interface SavedDocumentExtractionTask {
26
+ stage: string;
27
+ task: string;
28
+ }
29
+ /** Each carried task's payload entry, keyed by {@link savedTaskKey}; `unpaired` is what could not be matched. */
30
+ export interface SavedDocumentExtractionPairing {
31
+ get(key: string): PreservedDocumentExtractionData | undefined;
32
+ readonly unpaired: readonly PreservedDocumentExtractionData[];
33
+ }
34
+ export declare const savedTaskKey: (stage: string, task: string) => string;
35
+ /**
36
+ * Pairs each carried task with its payload entry, following a rename. The
37
+ * payload names a task by its stage label and task name, as every per-task
38
+ * lane does; an edit that renames the stage or the task would otherwise lose
39
+ * the data, and compile would refuse a plan the author only relabelled.
40
+ *
41
+ * Exact (stage, task) pairs go first. Renames are followed only when as many
42
+ * entries are left as tasks: one entry more means a task was deleted too, and
43
+ * then a rename cannot be told apart from a deletion. A task left over then takes an entry
44
+ * that shares its stage (the task was renamed) or its name (the stage was
45
+ * renamed), but only when that entry is the one entry left sharing either with
46
+ * the task, and the task is the one task left sharing either with the entry.
47
+ * So a task whose stage points at one entry and whose name points at another
48
+ * (a carried task deleted, another moved into its stage) stays unpaired rather
49
+ * than taking the wrong task's data. Last, the only entry left goes to the
50
+ * only task left (both renamed). Anything ambiguous stays unpaired, and compile
51
+ * refuses it by name ({@link savedDocumentExtractionData}).
52
+ */
53
+ export declare function pairSavedDocumentExtractions(tasks: readonly SavedDocumentExtractionTask[], entries: readonly PreservedDocumentExtractionData[] | undefined): SavedDocumentExtractionPairing;
54
+ /** A carried task's saved output rows that write a variable other than their own id: row id → variable. */
55
+ export declare function savedRowMappings(data: Record<string, unknown>): Map<string, string>;
56
+ /** The plan's carried document-extraction tasks, by stage label and task name: what {@link pairSavedDocumentExtractions} pairs. */
57
+ export declare function carriedDocumentExtractionTasks(built: BuiltCase): SavedDocumentExtractionTask[];
58
+ /**
59
+ * What `check` says (`lint`, a warning) when a carried task's saved row writes
60
+ * a variable no `.var()` declares. The mapping sits in the payload, so the
61
+ * `.var()` looks unused in the source, and deleting it leaves the result with
62
+ * nowhere to go. Compile writes the plan as saved and adds no root variable:
63
+ * the saved plan did not have one either when it came that way.
64
+ *
65
+ * Only entries paired with a task in the source are judged, as compile pairs
66
+ * them: the entry of a deleted task is not written, so its variable is not
67
+ * needed. The finding names the task as the source names it now.
68
+ */
69
+ export declare function savedDocumentExtractionVarLint(tasks: readonly SavedDocumentExtractionTask[], entries: readonly PreservedDocumentExtractionData[] | undefined, declared: ReadonlySet<string>): (DocumentExtractionFinding & {
70
+ where: string;
71
+ })[];
23
72
  /** Why a payload's `documentExtractionData` entry cannot stand, or `undefined`. */
24
73
  export declare function preservedDocumentExtractionDataError(entry: PreservedDocumentExtractionData): string | undefined;
@@ -43,14 +43,116 @@ export function savedDocumentExtractionLint(owner) {
43
43
  * refusal: the task names no saved data (the payload was dropped or the task
44
44
  * renamed), or it maps outputs, which the saved rows already are.
45
45
  */
46
- export function savedDocumentExtractionData(owner, entries, stage, task, hasOutputs) {
46
+ export function savedDocumentExtractionData(owner, pairing, stage, task, hasOutputs) {
47
47
  if (hasOutputs)
48
48
  throw new CompileRefusal('DOCUMENT_EXTRACTION_SAVED_DATA', `${owner} is carried as saved, and its saved output rows are written as they are; .outputs() cannot add to them.`, 'Drop .outputs(), or re-author the task with .documentExtraction(model, spec) and map its outputs there.');
49
- const entry = (entries ?? []).find((e) => e.stage === stage && e.task === task);
50
- if (!entry)
51
- throw new CompileRefusal('DOCUMENT_EXTRACTION_SAVED_DATA', `${owner} is .savedDocumentExtraction(), but the preserveCaseJson(...) payload carries no documentExtractionData entry for stage "${stage}", task "${task}".`, 'Keep the payload decompile wrote (and the stage and task names it records), or re-author the task with .documentExtraction(model, spec).');
49
+ const entry = pairing.get(savedTaskKey(stage, task));
50
+ if (!entry) {
51
+ const unpaired = pairing.unpaired.map((e) => `{ stage: "${e.stage}", task: "${e.task}" }`).join(', ');
52
+ throw new CompileRefusal('DOCUMENT_EXTRACTION_SAVED_DATA', `${owner} is .savedDocumentExtraction(), but the preserveCaseJson(...) payload carries no documentExtractionData entry for stage "${stage}", task "${task}"`
53
+ + (unpaired ? `, and the entries left over (${unpaired}) cannot be told apart.` : '.'), unpaired
54
+ ? `Set that entry's stage to "${stage}" and its task to "${task}" in the payload's documentExtractionData, or re-author the task with .documentExtraction(model, spec).`
55
+ : 'Keep the payload decompile wrote, or re-author the task with .documentExtraction(model, spec).');
56
+ }
52
57
  return structuredClone(entry.data);
53
58
  }
59
+ export const savedTaskKey = (stage, task) => JSON.stringify([stage, task]);
60
+ /**
61
+ * Pairs each carried task with its payload entry, following a rename. The
62
+ * payload names a task by its stage label and task name, as every per-task
63
+ * lane does; an edit that renames the stage or the task would otherwise lose
64
+ * the data, and compile would refuse a plan the author only relabelled.
65
+ *
66
+ * Exact (stage, task) pairs go first. Renames are followed only when as many
67
+ * entries are left as tasks: one entry more means a task was deleted too, and
68
+ * then a rename cannot be told apart from a deletion. A task left over then takes an entry
69
+ * that shares its stage (the task was renamed) or its name (the stage was
70
+ * renamed), but only when that entry is the one entry left sharing either with
71
+ * the task, and the task is the one task left sharing either with the entry.
72
+ * So a task whose stage points at one entry and whose name points at another
73
+ * (a carried task deleted, another moved into its stage) stays unpaired rather
74
+ * than taking the wrong task's data. Last, the only entry left goes to the
75
+ * only task left (both renamed). Anything ambiguous stays unpaired, and compile
76
+ * refuses it by name ({@link savedDocumentExtractionData}).
77
+ */
78
+ export function pairSavedDocumentExtractions(tasks, entries) {
79
+ const paired = new Map();
80
+ let left = [...(entries ?? [])];
81
+ let waiting = tasks.filter((t) => {
82
+ const i = left.findIndex((e) => e.stage === t.stage && e.task === t.task);
83
+ if (i < 0)
84
+ return true;
85
+ paired.set(savedTaskKey(t.stage, t.task), left[i]);
86
+ left.splice(i, 1);
87
+ return false;
88
+ });
89
+ // A rename is followed only when the counts leave no room for a deletion:
90
+ // with more entries left than tasks waiting, "A renamed, B deleted" and "B
91
+ // renamed, A deleted" can fit the same source, so the waiting tasks stay
92
+ // unpaired and compile refuses them by name.
93
+ if (left.length !== waiting.length)
94
+ return { get: (key) => paired.get(key), unpaired: left };
95
+ // A rename keeps the stage or the name. Both rules are asked at once, so one
96
+ // cannot pair a task the other points elsewhere.
97
+ const shares = (t, e) => e.stage === t.stage || e.task === t.task;
98
+ for (let progressed = true; progressed;) {
99
+ progressed = false;
100
+ waiting = waiting.filter((t) => {
101
+ const candidates = left.filter((e) => shares(t, e));
102
+ if (candidates.length !== 1 || waiting.filter((other) => shares(other, candidates[0])).length !== 1)
103
+ return true;
104
+ paired.set(savedTaskKey(t.stage, t.task), candidates[0]);
105
+ left = left.filter((e) => e !== candidates[0]);
106
+ progressed = true;
107
+ return false;
108
+ });
109
+ }
110
+ if (waiting.length === 1 && left.length === 1) {
111
+ paired.set(savedTaskKey(waiting[0].stage, waiting[0].task), left[0]);
112
+ left = [];
113
+ }
114
+ return { get: (key) => paired.get(key), unpaired: left };
115
+ }
116
+ /** A carried task's saved output rows that write a variable other than their own id: row id → variable. */
117
+ export function savedRowMappings(data) {
118
+ const mappings = new Map();
119
+ for (const row of Array.isArray(data.outputs) ? data.outputs : []) {
120
+ const { id, var: variable } = (row ?? {});
121
+ if (typeof id === 'string' && typeof variable === 'string' && variable !== '' && variable !== id)
122
+ mappings.set(id, variable);
123
+ }
124
+ return mappings;
125
+ }
126
+ /** The plan's carried document-extraction tasks, by stage label and task name: what {@link pairSavedDocumentExtractions} pairs. */
127
+ export function carriedDocumentExtractionTasks(built) {
128
+ return built.stages.flatMap((stage) => stage.lanes.flat().filter((task) => task.documentExtractionSaved).map((task) => ({ stage: stage.label, task: task.name })));
129
+ }
130
+ /**
131
+ * What `check` says (`lint`, a warning) when a carried task's saved row writes
132
+ * a variable no `.var()` declares. The mapping sits in the payload, so the
133
+ * `.var()` looks unused in the source, and deleting it leaves the result with
134
+ * nowhere to go. Compile writes the plan as saved and adds no root variable:
135
+ * the saved plan did not have one either when it came that way.
136
+ *
137
+ * Only entries paired with a task in the source are judged, as compile pairs
138
+ * them: the entry of a deleted task is not written, so its variable is not
139
+ * needed. The finding names the task as the source names it now.
140
+ */
141
+ export function savedDocumentExtractionVarLint(tasks, entries, declared) {
142
+ const pairing = pairSavedDocumentExtractions(tasks, entries);
143
+ return tasks.flatMap((t) => {
144
+ const entry = pairing.get(savedTaskKey(t.stage, t.task));
145
+ return entry ? [{ t, entry }] : [];
146
+ }).flatMap(({ t, entry }) => [...savedRowMappings(entry.data)]
147
+ .filter(([, variable]) => !declared.has(variable))
148
+ .map(([row, variable]) => ({
149
+ where: t.task,
150
+ code: 'DOCUMENT_EXTRACTION_SAVED_VAR_UNDECLARED',
151
+ message: `Document extraction task "${t.task}" (stage "${t.stage}") is carried as saved, and its saved output row "${row}" `
152
+ + `writes case variable "${variable}", which no .var() declares. The plan has no root variable for it, so the result has nowhere to go.`,
153
+ suggestion: `Declare it: .var("${variable}", "object"). The mapping is in the preserveCaseJson(...) payload, so the .var() can look unused.`,
154
+ })));
155
+ }
54
156
  /** Why a payload's `documentExtractionData` entry cannot stand, or `undefined`. */
55
157
  export function preservedDocumentExtractionDataError(entry) {
56
158
  const where = `preserved document-extraction data of task "${entry?.stage}/${entry?.task}"`;
@@ -135,7 +135,8 @@ export function httpRequestRefusal(owner, spec) {
135
135
  return {
136
136
  code: 'HTTP_REQUEST_BODY_EXPRESSION',
137
137
  message: `${owner} body has the value ${JSON.stringify(leaf)}, an \`=\` expression compile cannot write as a JavaScript value inside the body: `
138
- + 'a body value must be a reference, or `=js:` followed by exactly one JavaScript expression (not a statement, nor code that does not parse).',
138
+ + 'a body value must be a reference, or `=js:` followed by exactly one JavaScript expression (not a statement, nor code that does not parse, '
139
+ + 'nor an HTML-like `<!--` / `-->` comment, which `uip maestro case validate --strict` refuses).',
139
140
  suggestion: "Write the value as `=js:<expression>` (for example '=js:vars.amount * 2'), as a reference (`=vars.amount`), "
140
141
  + "or as another task's output (`=${taskOutput('Stage', 'Task', 'body')}`).",
141
142
  };
@@ -179,12 +180,26 @@ function isTaskOutputReference(text) {
179
180
  function oneExpression(code) {
180
181
  const text = `(${code}\n)`;
181
182
  let program;
183
+ // Script mode accepts Annex B's HTML-like comments (`<!--`, and `-->` at a
184
+ // line start), which `validate --strict` refuses and the Case runtime's engine
185
+ // is not known to accept; module mode would refuse them but is strict, which
186
+ // changes more than that (legacy octal `010`, which the CLI accepts). So a
187
+ // comment acorn reports that opens with either marker refuses the value.
188
+ let htmlComment = false;
182
189
  try {
183
- program = parse(text, { ecmaVersion: 'latest', sourceType: 'script', preserveParens: true });
190
+ program = parse(text, {
191
+ ecmaVersion: 'latest', sourceType: 'script', preserveParens: true,
192
+ onComment: (_block, _body, start) => {
193
+ if (text.startsWith('<!--', start) || text.startsWith('-->', start))
194
+ htmlComment = true;
195
+ },
196
+ });
184
197
  }
185
198
  catch {
186
199
  return undefined;
187
200
  }
201
+ if (htmlComment)
202
+ return undefined;
188
203
  const [statement] = program.body;
189
204
  if (program.body.length !== 1 || statement.type !== 'ExpressionStatement')
190
205
  return undefined;
@@ -1,5 +1,4 @@
1
1
  import { asRecord, planTasks } from '../walk.js';
2
- import { WRITTEN_BY_COMPILE } from './common.js';
3
2
  /** The CLI's `RECIPIENT_PREFIXES`: a value still carrying one is `STRICT_RECIPIENT_PREFIX_LEFT`'s, not ported. */
4
3
  const RECIPIENT_PREFIXES = ['User:', 'UserGroup:', 'Role:', 'Email:', 'Expression:'];
5
4
  const recipientExpressionType = {
@@ -99,7 +98,13 @@ const taskMissingElementId = {
99
98
  found.push({
100
99
  path: `nodes[${t.stageId}].data.tasks[${t.taskId}]`,
101
100
  message: `Task "${t.taskLabel}" carries inputs or outputs but has no "elementId", so those variables do not resolve to it.`,
102
- fix: `The elementId is "${t.stageId}-${t.taskId}"; ${WRITTEN_BY_COMPILE}`,
101
+ // Compile stamps every task's elementId, so this fires only on a plan
102
+ // decompiled from a Designer save that omitted it (`omitTaskElementIds`):
103
+ // the shared "else it is an SDK bug" text would point the wrong way.
104
+ fix: `The source plan omitted this task's elementId ("${t.stageId}-${t.taskId}") and compile kept the omission, `
105
+ + 'so the plan stays as the Designer saved it. Remove this task from omitTaskElementIds in the preserveCaseJson(...) '
106
+ + 'payload, and compile writes the elementId. Or, in the Case Designer, select the task\'s resource again. '
107
+ + 'A plain re-save keeps the omission.',
103
108
  where: t.taskLabel,
104
109
  nodeId: t.taskId,
105
110
  });
@@ -38,7 +38,7 @@ import { CompileRefusal } from '../core/compile-refusal.js';
38
38
  import { expressionBindingId } from '../core/expression-binding-id.js';
39
39
  import { implicitInArgBuiltTrigger, unboundInArgMessage } from './in-arg-binding.js';
40
40
  import { jsonClone } from '../core/json-clone.js';
41
- import { savedDocumentExtractionData } from './document-extraction-saved.js';
41
+ import { carriedDocumentExtractionTasks, pairSavedDocumentExtractions, savedDocumentExtractionData, savedRowMappings } from './document-extraction-saved.js';
42
42
  import { taskShapeProblems } from './task-shape.js';
43
43
  import { SCRIPT_INPUTS, scriptOutputMappings, scriptOutputs, storedScript } from './script.js';
44
44
  import { DOCUMENT_EXTRACTION_NAME, DOCUMENT_EXTRACTION_RESOURCE, DOCUMENT_EXTRACTION_SERVICE_TYPE, DOCUMENT_EXTRACTION_VERSION, documentExtractionContext, documentExtractionInputs, documentExtractionOutputMappings, documentExtractionOutputs, documentExtractionRefusal, } from './document-extraction.js';
@@ -220,9 +220,14 @@ function serializeCase(built, opts) {
220
220
  ownNameRows: new Map(),
221
221
  // A carried task's saved output rows keep their ids: no other row takes one.
222
222
  outputIds: new Set(savedOutputIds(caseJsonPreservation(built)?.documentExtractionData)),
223
- savedDocumentExtractions: caseJsonPreservation(built)?.documentExtractionData ?? [],
223
+ savedDocumentExtractions: pairSavedDocumentExtractions(carriedDocumentExtractionTasks(built), caseJsonPreservation(built)?.documentExtractionData),
224
224
  ownOutputVars: ownOutputVars(built),
225
- caseVarNames: new Set([...built.vars.map((v) => v.name), ...mappedFixedOutputVars(built)]),
225
+ caseVarNames: new Set([
226
+ ...built.vars.map((v) => v.name),
227
+ ...mappedFixedOutputVars(built),
228
+ // A carried task's mapped rows write these, declared or not.
229
+ ...(caseJsonPreservation(built)?.documentExtractionData ?? []).flatMap((entry) => [...savedRowMappings(entry.data).values()]),
230
+ ]),
226
231
  slaId: new Map(),
227
232
  slaIdByName: new Map(),
228
233
  escalationId: new Map(),
package/dist/check.js CHANGED
@@ -35,7 +35,7 @@ export function check(built, opts = {}) {
35
35
  export function checkCompiled(built, opts = {}) {
36
36
  // A connection two connectors use, and an agent resource's `nodeId` another
37
37
  // node of the file has, are the serializer's CONNECTION_CONNECTOR_CONFLICT /
38
- // INLINE_AGENT_RESOURCE_NODE_ID: it claims ids and resolves connections file-wide.
38
+ // FLOW_AGENT_RESOURCE_NODE_ID: it claims ids and resolves connections file-wide.
39
39
  const diags = checkFlow(built, [], opts);
40
40
  // Once, from the top: the walk reaches child flows itself, so running it per
41
41
  // `checkFlow` would report a child's escape twice.
@@ -430,7 +430,7 @@ export interface AgentResourcePlacement {
430
430
  * The resource node's id. Defaults to `<agent step>Context`, `<agent step>Tool`
431
431
  * or `<agent step>Escalation`, numbered from 2 for a second resource of the
432
432
  * same kind (`<agent step>Context2`). Compile writes it as given and refuses an
433
- * id another node in the flow already has (`check`: `INLINE_AGENT_RESOURCE_NODE_ID`).
433
+ * id another node in the flow already has (`check`: `FLOW_AGENT_RESOURCE_NODE_ID`).
434
434
  */
435
435
  nodeId?: string;
436
436
  /**
@@ -506,6 +506,20 @@ export interface ClientSideToolRef {
506
506
  inputs?: Record<string, InlineAgentFieldType>;
507
507
  /** What the client returns, by name. */
508
508
  returns?: Record<string, InlineAgentFieldType>;
509
+ /**
510
+ * The arguments as a whole JSON schema, written as given, for what `inputs`
511
+ * cannot say: a property's `description` (which the model reads), `items`,
512
+ * `required`. Decompile writes it for a canvas tool whose schema is more than
513
+ * typed fields. Give `inputs` or this, not both
514
+ * (FLOW_AGENT_TOOL_CLIENTSIDE_SCHEMA_TWICE).
515
+ *
516
+ * ```ts
517
+ * inputSchema: { type: 'object', properties: { grid: { type: 'array', items: { type: 'string' }, description: 'Up to 32 rows' } }, required: ['grid'] }
518
+ * ```
519
+ */
520
+ inputSchema?: Record<string, unknown>;
521
+ /** What the client returns, as a whole JSON schema; the `returns` counterpart of {@link ClientSideToolRef.inputSchema}. */
522
+ outputSchema?: Record<string, unknown>;
509
523
  }
510
524
  /**
511
525
  * The built-in HTTP-request tool (`uipath.agent.resource.tool.builtin.httprequest`):
@@ -611,7 +625,7 @@ export interface ConnectorToolRef {
611
625
  * `connector()`'s `connection` option takes (e.g. `'genai'`), resolved to
612
626
  * the tenant connection id at compile. Required: a connector tool with no
613
627
  * connection has nothing to call Integration Service with, and `check`
614
- * reports `INLINE_AGENT_TOOL_CONNECTOR_NO_CONNECTION`.
628
+ * reports `FLOW_AGENT_TOOL_CONNECTOR_NO_CONNECTION`.
615
629
  */
616
630
  connection?: string;
617
631
  /**
@@ -46,7 +46,7 @@ export declare function refuseUnverifiedByoa(env: EventEmitEnv, where: string, s
46
46
  * Refuse a connector-bound node (connector step, event trigger, `.entryPoint`
47
47
  * onEvent, `waitForEvent`) that names no `connection` or no `folder` label.
48
48
  * (An inline agent's connector tool is #875's: `check` refuses it as
49
- * INLINE_AGENT_TOOL_CONNECTOR_NO_CONNECTION, and serialize leaves it unbound.)
49
+ * FLOW_AGENT_TOOL_CONNECTOR_NO_CONNECTION, and serialize leaves it unbound.)
50
50
  * `resolveBinding` returns `undefined` for an absent label, which used to reach
51
51
  * the node as `detail.connectionId: null` with no binding — valid to compile,
52
52
  * refused by `flow validate` (flow-builder-sdk#890): BINDING_MISSING.
@@ -33,7 +33,7 @@ export function refuseUnverifiedByoa(env, where, sub) {
33
33
  * Refuse a connector-bound node (connector step, event trigger, `.entryPoint`
34
34
  * onEvent, `waitForEvent`) that names no `connection` or no `folder` label.
35
35
  * (An inline agent's connector tool is #875's: `check` refuses it as
36
- * INLINE_AGENT_TOOL_CONNECTOR_NO_CONNECTION, and serialize leaves it unbound.)
36
+ * FLOW_AGENT_TOOL_CONNECTOR_NO_CONNECTION, and serialize leaves it unbound.)
37
37
  * `resolveBinding` returns `undefined` for an absent label, which used to reach
38
38
  * the node as `detail.connectionId: null` with no binding — valid to compile,
39
39
  * refused by `flow validate` (flow-builder-sdk#890): BINDING_MISSING.
@@ -23,9 +23,9 @@ export declare const REFUSALS: {
23
23
  readonly AGENTIC_READ_UNKNOWN_FIELD: "lint";
24
24
  readonly AGENTIC_READ_WITHOUT_RETURNS: "lint";
25
25
  readonly AGENTIC_RESERVED_INPUT: "lowering";
26
- readonly AGENT_CONTEXT_NO_FOLDER_PATH: "lint";
27
- readonly AGENT_CONTEXT_NO_ID: "lowering";
28
- readonly AGENT_CONTEXT_QUERY_NOT_EXPRESSION: "lint";
26
+ readonly FLOW_AGENT_CONTEXT_NO_FOLDER_PATH: "lint";
27
+ readonly FLOW_AGENT_CONTEXT_NO_ID: "lowering";
28
+ readonly FLOW_AGENT_CONTEXT_QUERY_NOT_EXPRESSION: "lint";
29
29
  readonly AGENT_EMPTY_INPUT_FLOOR: "lint";
30
30
  readonly AGENT_EMPTY_RETURNS: "lint";
31
31
  readonly AGENT_KEY_NOT_GUID: "lint";
@@ -170,6 +170,7 @@ export declare const REFUSALS: {
170
170
  readonly DOCUMENT_EXTRACTION_OUTPUT: "lowering";
171
171
  readonly DOCUMENT_EXTRACTION_OLDER_SHAPE: "lint";
172
172
  readonly DOCUMENT_EXTRACTION_SAVED_DATA: "lowering";
173
+ readonly DOCUMENT_EXTRACTION_SAVED_VAR_UNDECLARED: "lint";
173
174
  readonly SCRIPT_BODY_SYNTAX: "lint";
174
175
  readonly SCRIPT_OUTPUT: "lowering";
175
176
  readonly HTTP_REQUEST_CONNECTOR: "lowering";
@@ -454,17 +455,17 @@ export declare const REFUSALS: {
454
455
  readonly IMPLICIT_SPLIT: "lint";
455
456
  readonly INLINE_AGENT_COMPOSITE_INPUT: "lowering";
456
457
  readonly INLINE_AGENT_EMPTY_RETURNS: "lint";
457
- readonly INLINE_AGENT_ESCALATION_APP_KEY_NOT_GUID: "lint";
458
- readonly INLINE_AGENT_ESCALATION_APP_WITH_FIELDS: "lowering";
459
- readonly INLINE_AGENT_ESCALATION_FIELD_OPTIONS: "lint";
460
- readonly INLINE_AGENT_ESCALATION_FIELD_OPTIONS_IGNORED: "lint";
461
- readonly INLINE_AGENT_ESCALATION_FIELD_SETTING_INVALID: "lint";
462
- readonly INLINE_AGENT_ESCALATION_FIELD_TYPE_UNKNOWN: "lint";
463
- readonly INLINE_AGENT_ESCALATION_NO_APP: "lint";
464
- readonly INLINE_AGENT_ESCALATION_NO_FIELDS: "lint";
465
- readonly INLINE_AGENT_ESCALATION_NO_NAME: "lint";
466
- readonly INLINE_AGENT_ESCALATION_QUICKFORM_WITH_APP: "lowering";
467
- readonly INLINE_AGENT_ESCALATION_VARIANT: "lowering";
458
+ readonly FLOW_AGENT_ESCALATION_APP_KEY_NOT_GUID: "lint";
459
+ readonly FLOW_AGENT_ESCALATION_APP_WITH_FIELDS: "lowering";
460
+ readonly FLOW_AGENT_ESCALATION_FIELD_OPTIONS: "lint";
461
+ readonly FLOW_AGENT_ESCALATION_FIELD_OPTIONS_IGNORED: "lint";
462
+ readonly FLOW_AGENT_ESCALATION_FIELD_SETTING_INVALID: "lint";
463
+ readonly FLOW_AGENT_ESCALATION_FIELD_TYPE_UNKNOWN: "lint";
464
+ readonly FLOW_AGENT_ESCALATION_NO_APP: "lint";
465
+ readonly FLOW_AGENT_ESCALATION_NO_FIELDS: "lint";
466
+ readonly FLOW_AGENT_ESCALATION_NO_NAME: "lint";
467
+ readonly FLOW_AGENT_ESCALATION_QUICKFORM_WITH_APP: "lowering";
468
+ readonly FLOW_AGENT_ESCALATION_VARIANT: "lowering";
468
469
  readonly INLINE_AGENT_INPUT_NAME_AMBIGUOUS: "lint";
469
470
  readonly INLINE_AGENT_MEMORY_ID_NOT_GUID: "lint";
470
471
  readonly INLINE_AGENT_MEMORY_INCOMPLETE: "lint";
@@ -474,23 +475,24 @@ export declare const REFUSALS: {
474
475
  readonly INLINE_AGENT_PROMPT_JSON_TEXT: "lint";
475
476
  readonly INLINE_AGENT_READ_NOT_OUTPUT: "lint";
476
477
  readonly INLINE_AGENT_READ_UNKNOWN_FIELD: "lint";
477
- readonly INLINE_AGENT_RESOURCE_NODE_ID: "lowering";
478
- readonly INLINE_AGENT_RESOURCE_SOURCE_DUP: "lowering";
479
- readonly INLINE_AGENT_RESOURCE_SOURCE_NOT_GUID: "lint";
478
+ readonly FLOW_AGENT_RESOURCE_NODE_ID: "lowering";
479
+ readonly FLOW_AGENT_RESOURCE_SOURCE_DUP: "lowering";
480
+ readonly FLOW_AGENT_RESOURCE_SOURCE_NOT_GUID: "lint";
480
481
  readonly INLINE_AGENT_SCAFFOLD_MODEL: "lint";
481
482
  readonly INLINE_AGENT_SOURCE_NOT_GUID: "lint";
482
- readonly INLINE_AGENT_TOOL_A2A_INCOMPLETE: "lint";
483
- readonly INLINE_AGENT_TOOL_CLIENTSIDE_NO_NAME: "lint";
484
- readonly INLINE_AGENT_TOOL_CONNECTOR_NO_CONNECTION: "lint";
485
- readonly INLINE_AGENT_TOOL_HTTP_METHOD: "lint";
486
- readonly INLINE_AGENT_TOOL_IXP_NO_NAME: "lint";
487
- readonly INLINE_AGENT_TOOL_IXP_PROJECT_NOT_GUID: "lint";
488
- readonly INLINE_AGENT_TOOL_KEY_NOT_GUID: "lint";
489
- readonly INLINE_AGENT_TOOL_MCP_INCOMPLETE: "lint";
490
- readonly INLINE_AGENT_TOOL_NO_OPERATION: "lint";
491
- readonly INLINE_AGENT_TOOL_NO_RESOURCE_ID: "lint";
492
- readonly INLINE_AGENT_TOOL_UNKNOWN_BUILTIN: "lowering";
493
- readonly INLINE_AGENT_TOOL_UNKNOWN_KIND: "lowering";
483
+ readonly FLOW_AGENT_TOOL_A2A_INCOMPLETE: "lint";
484
+ readonly FLOW_AGENT_TOOL_CLIENTSIDE_NO_NAME: "lint";
485
+ readonly FLOW_AGENT_TOOL_CLIENTSIDE_SCHEMA_TWICE: "lowering";
486
+ readonly FLOW_AGENT_TOOL_CONNECTOR_NO_CONNECTION: "lint";
487
+ readonly FLOW_AGENT_TOOL_HTTP_METHOD: "lint";
488
+ readonly FLOW_AGENT_TOOL_IXP_NO_NAME: "lint";
489
+ readonly FLOW_AGENT_TOOL_IXP_PROJECT_NOT_GUID: "lint";
490
+ readonly FLOW_AGENT_TOOL_KEY_NOT_GUID: "lint";
491
+ readonly FLOW_AGENT_TOOL_MCP_INCOMPLETE: "lint";
492
+ readonly FLOW_AGENT_TOOL_NO_OPERATION: "lint";
493
+ readonly FLOW_AGENT_TOOL_NO_RESOURCE_ID: "lint";
494
+ readonly FLOW_AGENT_TOOL_UNKNOWN_BUILTIN: "lowering";
495
+ readonly FLOW_AGENT_TOOL_UNKNOWN_KIND: "lowering";
494
496
  readonly INLINE_AGENT_UNDECLARED_PLACEHOLDER: "lint";
495
497
  readonly INLINE_AGENT_UNREFERENCED_INPUT: "lint";
496
498
  readonly INPUT_READ_WITHOUT_TRIGGER: "lint";
@@ -72,9 +72,9 @@ export const REFUSALS = {
72
72
  AGENTIC_READ_UNKNOWN_FIELD: 'lint',
73
73
  AGENTIC_READ_WITHOUT_RETURNS: 'lint',
74
74
  AGENTIC_RESERVED_INPUT: 'lowering',
75
- AGENT_CONTEXT_NO_FOLDER_PATH: 'lint',
76
- AGENT_CONTEXT_NO_ID: 'lowering',
77
- AGENT_CONTEXT_QUERY_NOT_EXPRESSION: 'lint',
75
+ FLOW_AGENT_CONTEXT_NO_FOLDER_PATH: 'lint',
76
+ FLOW_AGENT_CONTEXT_NO_ID: 'lowering',
77
+ FLOW_AGENT_CONTEXT_QUERY_NOT_EXPRESSION: 'lint',
78
78
  AGENT_EMPTY_INPUT_FLOOR: 'lint',
79
79
  AGENT_EMPTY_RETURNS: 'lint',
80
80
  AGENT_KEY_NOT_GUID: 'lint',
@@ -224,9 +224,11 @@ export const REFUSALS = {
224
224
  DOCUMENT_EXTRACTION_OUTPUT: 'lowering',
225
225
  // The older, flat shape, carried as saved (case/document-extraction-saved.ts):
226
226
  // check warns it is not editable (`lint`); compile refuses a carried task with
227
- // no saved data, or with outputs it cannot add to the saved rows (`lowering`).
227
+ // no saved data, or with outputs it cannot add to the saved rows (`lowering`);
228
+ // check warns a saved row writes a variable no .var() declares (`lint`).
228
229
  DOCUMENT_EXTRACTION_OLDER_SHAPE: 'lint',
229
230
  DOCUMENT_EXTRACTION_SAVED_DATA: 'lowering',
231
+ DOCUMENT_EXTRACTION_SAVED_VAR_UNDECLARED: 'lint',
230
232
  // Case script task (case/script.ts). A string body that does not parse is
231
233
  // written as authored (`lint`); an output other than the two has no row to
232
234
  // write it to (`lowering`).
@@ -527,17 +529,17 @@ export const REFUSALS = {
527
529
  IMPLICIT_SPLIT: 'lint',
528
530
  INLINE_AGENT_COMPOSITE_INPUT: 'lowering',
529
531
  INLINE_AGENT_EMPTY_RETURNS: 'lint',
530
- INLINE_AGENT_ESCALATION_APP_KEY_NOT_GUID: 'lint',
531
- INLINE_AGENT_ESCALATION_APP_WITH_FIELDS: 'lowering',
532
- INLINE_AGENT_ESCALATION_FIELD_OPTIONS: 'lint',
533
- INLINE_AGENT_ESCALATION_FIELD_OPTIONS_IGNORED: 'lint',
534
- INLINE_AGENT_ESCALATION_FIELD_SETTING_INVALID: 'lint',
535
- INLINE_AGENT_ESCALATION_FIELD_TYPE_UNKNOWN: 'lint',
536
- INLINE_AGENT_ESCALATION_NO_APP: 'lint',
537
- INLINE_AGENT_ESCALATION_NO_FIELDS: 'lint',
538
- INLINE_AGENT_ESCALATION_NO_NAME: 'lint',
539
- INLINE_AGENT_ESCALATION_QUICKFORM_WITH_APP: 'lowering',
540
- INLINE_AGENT_ESCALATION_VARIANT: 'lowering',
532
+ FLOW_AGENT_ESCALATION_APP_KEY_NOT_GUID: 'lint',
533
+ FLOW_AGENT_ESCALATION_APP_WITH_FIELDS: 'lowering',
534
+ FLOW_AGENT_ESCALATION_FIELD_OPTIONS: 'lint',
535
+ FLOW_AGENT_ESCALATION_FIELD_OPTIONS_IGNORED: 'lint',
536
+ FLOW_AGENT_ESCALATION_FIELD_SETTING_INVALID: 'lint',
537
+ FLOW_AGENT_ESCALATION_FIELD_TYPE_UNKNOWN: 'lint',
538
+ FLOW_AGENT_ESCALATION_NO_APP: 'lint',
539
+ FLOW_AGENT_ESCALATION_NO_FIELDS: 'lint',
540
+ FLOW_AGENT_ESCALATION_NO_NAME: 'lint',
541
+ FLOW_AGENT_ESCALATION_QUICKFORM_WITH_APP: 'lowering',
542
+ FLOW_AGENT_ESCALATION_VARIANT: 'lowering',
541
543
  INLINE_AGENT_INPUT_NAME_AMBIGUOUS: 'lint',
542
544
  INLINE_AGENT_MEMORY_ID_NOT_GUID: 'lint',
543
545
  INLINE_AGENT_MEMORY_INCOMPLETE: 'lint',
@@ -547,23 +549,24 @@ export const REFUSALS = {
547
549
  INLINE_AGENT_PROMPT_JSON_TEXT: 'lint',
548
550
  INLINE_AGENT_READ_NOT_OUTPUT: 'lint',
549
551
  INLINE_AGENT_READ_UNKNOWN_FIELD: 'lint',
550
- INLINE_AGENT_RESOURCE_NODE_ID: 'lowering',
551
- INLINE_AGENT_RESOURCE_SOURCE_DUP: 'lowering',
552
- INLINE_AGENT_RESOURCE_SOURCE_NOT_GUID: 'lint',
552
+ FLOW_AGENT_RESOURCE_NODE_ID: 'lowering',
553
+ FLOW_AGENT_RESOURCE_SOURCE_DUP: 'lowering',
554
+ FLOW_AGENT_RESOURCE_SOURCE_NOT_GUID: 'lint',
553
555
  INLINE_AGENT_SCAFFOLD_MODEL: 'lint',
554
556
  INLINE_AGENT_SOURCE_NOT_GUID: 'lint',
555
- INLINE_AGENT_TOOL_A2A_INCOMPLETE: 'lint',
556
- INLINE_AGENT_TOOL_CLIENTSIDE_NO_NAME: 'lint',
557
- INLINE_AGENT_TOOL_CONNECTOR_NO_CONNECTION: 'lint',
558
- INLINE_AGENT_TOOL_HTTP_METHOD: 'lint',
559
- INLINE_AGENT_TOOL_IXP_NO_NAME: 'lint',
560
- INLINE_AGENT_TOOL_IXP_PROJECT_NOT_GUID: 'lint',
561
- INLINE_AGENT_TOOL_KEY_NOT_GUID: 'lint',
562
- INLINE_AGENT_TOOL_MCP_INCOMPLETE: 'lint',
563
- INLINE_AGENT_TOOL_NO_OPERATION: 'lint',
564
- INLINE_AGENT_TOOL_NO_RESOURCE_ID: 'lint',
565
- INLINE_AGENT_TOOL_UNKNOWN_BUILTIN: 'lowering',
566
- INLINE_AGENT_TOOL_UNKNOWN_KIND: 'lowering',
557
+ FLOW_AGENT_TOOL_A2A_INCOMPLETE: 'lint',
558
+ FLOW_AGENT_TOOL_CLIENTSIDE_NO_NAME: 'lint',
559
+ FLOW_AGENT_TOOL_CLIENTSIDE_SCHEMA_TWICE: 'lowering',
560
+ FLOW_AGENT_TOOL_CONNECTOR_NO_CONNECTION: 'lint',
561
+ FLOW_AGENT_TOOL_HTTP_METHOD: 'lint',
562
+ FLOW_AGENT_TOOL_IXP_NO_NAME: 'lint',
563
+ FLOW_AGENT_TOOL_IXP_PROJECT_NOT_GUID: 'lint',
564
+ FLOW_AGENT_TOOL_KEY_NOT_GUID: 'lint',
565
+ FLOW_AGENT_TOOL_MCP_INCOMPLETE: 'lint',
566
+ FLOW_AGENT_TOOL_NO_OPERATION: 'lint',
567
+ FLOW_AGENT_TOOL_NO_RESOURCE_ID: 'lint',
568
+ FLOW_AGENT_TOOL_UNKNOWN_BUILTIN: 'lowering',
569
+ FLOW_AGENT_TOOL_UNKNOWN_KIND: 'lowering',
567
570
  INLINE_AGENT_UNDECLARED_PLACEHOLDER: 'lint',
568
571
  INLINE_AGENT_UNREFERENCED_INPUT: 'lint',
569
572
  INPUT_READ_WITHOUT_TRIGGER: 'lint',
package/dist/decompile.js CHANGED
@@ -815,21 +815,26 @@ function liftRegistered(node, impl = registeredImpl(node), graph) {
815
815
  sidecar: (path) => runReadSidecar?.(path),
816
816
  flowId: runFlowId,
817
817
  definitionOf: (n) => runDefs.get(`${n.type}@${n.typeVersion}`) ?? runDefs.get(n.type),
818
- attached: (port, limit = Infinity) => {
818
+ attached: (port, limit = Infinity, accept = () => true) => {
819
819
  const found = [];
820
820
  for (const e of graph?.outEdges(node.id) ?? []) {
821
821
  if (e.sourcePort !== port || found.length >= limit)
822
822
  continue;
823
823
  const n = graph.byId.get(e.targetNodeId);
824
- if (n === undefined)
824
+ if (n === undefined || !accept(n))
825
825
  continue;
826
826
  graph.accounted.add(e);
827
827
  found.push(n);
828
828
  }
829
829
  return found;
830
830
  },
831
- attachedIds: (port) => (graph?.outEdges(node.id) ?? [])
832
- .filter((e) => e.sourcePort === port && graph.byId.has(e.targetNodeId))
831
+ attachedIds: (port, accept = () => true) => (graph?.outEdges(node.id) ?? [])
832
+ .filter((e) => {
833
+ if (e.sourcePort !== port)
834
+ return false;
835
+ const n = graph.byId.get(e.targetNodeId);
836
+ return n !== undefined && accept(n);
837
+ })
833
838
  .map((e) => e.targetNodeId),
834
839
  absorb: (id, compiledId) => { runAbsorbed.set(id, compiledId); },
835
840
  outPorts: () => (graph?.outEdges(node.id) ?? []).map((e) => e.sourcePort),