@uipath/maestro-builder-sdk 6.103.0 → 6.104.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,165 @@
1
+ /**
2
+ * core/lookup-connection — a recorded lookup id used on a different connection
3
+ * than the one it was resolved on (#1982).
4
+ *
5
+ * A lookup id belongs to one connection. Slack user `U123` exists on the
6
+ * workspace it was looked up in and nowhere else; a Jira issue-type id is valid
7
+ * in one site. `prepare --resolve` records the connection each id came from
8
+ * (`connectionId` on the row in `connectors-local/resolutions.json`), and this
9
+ * module compares it with the connection the step is bound to. Before the
10
+ * field existed, an id resolved on connection A and bound to connection B
11
+ * compiled cleanly and failed at run time, and the skill told the agent to
12
+ * compare the two by hand.
13
+ *
14
+ * `lint`, not `lowering`: the serializer writes exactly the id that was
15
+ * recorded, and some lookups are the same on every connection (Slack's
16
+ * `send_as` sends the word `bot`), so the id is probably wrong, not certainly.
17
+ * The remedy is cheap either way: resolve again on the bound connection.
18
+ *
19
+ * One row cannot serve two connections yet (#2042): rows are keyed
20
+ * `[nodeType, field, by, value]`, not by connection. When two steps use the
21
+ * same row on two different bound connections, re-running `prepare` on one
22
+ * only moves the error to the other, so the message says so and prints no
23
+ * command ({@link lookupConnectionIndex}).
24
+ *
25
+ * Silent when there is nothing to compare: a row without `connectionId` (an
26
+ * older ledger), or a step whose connection does not resolve to a real id (no
27
+ * bindings.json, an undeclared label, a placeholder GUID). The binding rules
28
+ * already report the last two.
29
+ *
30
+ * No `node:` imports: `check` imports this module (FB015).
31
+ */
32
+ import { GUID_RE, STUB_GUID_RE } from './binding-messages.js';
33
+ import { prepareCommand, resolveFlagArg } from './cli-spelling.js';
34
+ import { isLookupToken, recordedEventResolution, recordedResolution, } from './lookups.js';
35
+ /** The diagnostic code. */
36
+ export const LOOKUP_CONNECTION_MISMATCH = 'LOOKUP_CONNECTION_MISMATCH';
37
+ /**
38
+ * The connection id a step is bound to, or `undefined` when it does not
39
+ * resolve to a real one. Same reading as `byoaUnverified`: the label through
40
+ * bindings.json, else the label itself when it is already an id.
41
+ */
42
+ export function boundConnectionId(connection, bindings) {
43
+ if (typeof connection !== 'string' || connection === '')
44
+ return undefined;
45
+ const id = bindings?.resolve(connection) ?? connection;
46
+ return GUID_RE.test(id) && !STUB_GUID_RE.test(id) ? id : undefined;
47
+ }
48
+ /**
49
+ * Build the {@link LookupConnectionIndex} for one built artifact.
50
+ *
51
+ * Family-agnostic, like the rules it feeds: it walks the built object and
52
+ * reads every object that carries a string `connection` beside `inputs` (a
53
+ * connector activity) or `where` (an event subscription) — the same
54
+ * `{ inputs, connection }` and `{ where, connection }` shapes
55
+ * `checkConnectorLookups` and `checkEventResolution` read. Connections are
56
+ * read through bindings.json as {@link boundConnectionId} reads them, and
57
+ * stored lower-cased.
58
+ *
59
+ * @param root - The built flow, case or process.
60
+ * @param resolutions - Everything `prepare --resolve` has recorded.
61
+ * @param bindings - Resolves a `connection:` label to an id.
62
+ */
63
+ export function lookupConnectionIndex(root, resolutions, bindings) {
64
+ const index = new Map();
65
+ if (!resolutions || Object.keys(resolutions).length === 0)
66
+ return index;
67
+ const seen = new WeakSet();
68
+ const add = (row, bound) => {
69
+ if (row?.value === undefined)
70
+ return;
71
+ let ids = index.get(row);
72
+ if (!ids)
73
+ index.set(row, (ids = new Set()));
74
+ ids.add(bound.toLowerCase());
75
+ };
76
+ const tokensIn = (value, found, depth = 0) => {
77
+ if (depth > 16 || value === null || typeof value !== 'object')
78
+ return;
79
+ if (isLookupToken(value)) {
80
+ found.push(value);
81
+ return;
82
+ }
83
+ for (const v of Array.isArray(value) ? value : Object.values(value))
84
+ tokensIn(v, found, depth + 1);
85
+ };
86
+ const visit = (value) => {
87
+ if (value === null || typeof value !== 'object' || seen.has(value))
88
+ return;
89
+ seen.add(value);
90
+ if (isLookupToken(value))
91
+ return;
92
+ const o = value;
93
+ const bound = typeof o.connection === 'string' ? boundConnectionId(o.connection, bindings) : undefined;
94
+ if (bound !== undefined) {
95
+ if (o.inputs && typeof o.inputs === 'object') {
96
+ const found = [];
97
+ tokensIn(o.inputs, found);
98
+ for (const token of found)
99
+ add(recordedResolution(token, resolutions), bound);
100
+ }
101
+ if (o.where && typeof o.where === 'object' && !Array.isArray(o.where)) {
102
+ for (const v of Object.values(o.where)) {
103
+ if (isLookupToken(v))
104
+ add(recordedEventResolution(v, resolutions), bound);
105
+ }
106
+ }
107
+ }
108
+ for (const v of Array.isArray(value) ? value : Object.values(o))
109
+ visit(v);
110
+ };
111
+ visit(root);
112
+ return index;
113
+ }
114
+ /**
115
+ * The LOOKUP_CONNECTION_MISMATCH message for one step, or `undefined` when no
116
+ * recorded lookup on it came from another connection. One message per step,
117
+ * like LOOKUP_UNRESOLVED: the remedy is one `prepare` with every `--resolve`.
118
+ * A row another step uses on a different connection gets no command (see the
119
+ * module header): one row cannot serve two connections yet.
120
+ *
121
+ * @param where - How the message opens (`Connector step "post"`, `trigger`).
122
+ * @param uses - Every resolved lookup on the step.
123
+ * @param connection - The step's `connection:` as authored.
124
+ * @param bindings - Resolves the label to an id.
125
+ * @param command - The `<key> <action-or-event>` the prepare command takes, plus any extra flags (`--object x`).
126
+ * @param index - Which bound connections use each row, file-wide; without it every row reads as used by this step alone.
127
+ */
128
+ export function lookupConnectionMismatch(where, uses, connection, bindings, command, index) {
129
+ const bound = boundConnectionId(connection, bindings);
130
+ if (bound === undefined)
131
+ return undefined;
132
+ const wrong = uses.filter(({ row }) => typeof row.connectionId === 'string' && row.connectionId !== ''
133
+ && row.connectionId.toLowerCase() !== bound.toLowerCase());
134
+ if (wrong.length === 0)
135
+ return undefined;
136
+ const label = connection;
137
+ const named = label.toLowerCase() === bound.toLowerCase() ? `connection ${bound}` : `connection \`${label}\` (${bound})`;
138
+ const sharedBy = (row) => {
139
+ const ids = index?.get(row);
140
+ return ids && ids.size > 1 ? ids : undefined;
141
+ };
142
+ const shared = wrong.filter(({ row }) => sharedBy(row) !== undefined);
143
+ const fixable = wrong.filter(({ row }) => sharedBy(row) === undefined);
144
+ const describe = ({ token, row, name }) => `\`${name}\` (${token.__lookup.by}=${JSON.stringify(token.__lookup.value)}) was resolved on connection ${row.connectionId}`;
145
+ const parts = [];
146
+ if (fixable.length > 0) {
147
+ const args = fixable.map(({ token }) => resolveFlagArg(token.__lookup.field, token.__lookup.by, String(token.__lookup.value)));
148
+ const head = ` ${prepareCommand(command.key, command.action, ...(command.extra ?? []), '--connection-id', bound)}`;
149
+ const block = [head + ' \\', ...args.map((a, i) => ` --resolve ${a}${i < args.length - 1 ? ' \\' : ''}`)].join('\n');
150
+ parts.push(`${where}: lookup ${fixable.map(describe).join('; ')}, but this step uses ${named}. `
151
+ + `A lookup id belongs to the connection it was found on, so the recorded `
152
+ + `${fixable.length === 1 ? 'id' : 'ids'} will likely fail at run time. Resolve again on the bound connection:\n`
153
+ + block);
154
+ }
155
+ if (shared.length > 0) {
156
+ const all = [...new Set(shared.flatMap(({ row }) => [...sharedBy(row)]))].sort();
157
+ parts.push(`${where}: lookup ${shared.map(describe).join('; ')}, but this step uses ${named}, `
158
+ + `and steps in this file use the same recorded ${shared.length === 1 ? 'lookup' : 'lookups'} on `
159
+ + `${all.length} connections (${all.join(', ')}). `
160
+ + `One resolutions.json row cannot serve two connections yet (#2042), so re-running \`prepare\` on one `
161
+ + `connection only moves this error to the other step. Bind these steps to one connection, or write `
162
+ + `the id for one of them by hand.`);
163
+ }
164
+ return parts.join('\n');
165
+ }
@@ -171,6 +171,14 @@ export interface LookupResolution {
171
171
  match: string;
172
172
  /** The opaque id the connector wants. */
173
173
  value: string;
174
+ /**
175
+ * The Integration Service connection id the lookup was resolved on. A lookup
176
+ * id belongs to one connection: Slack user `U123` on one workspace is nobody
177
+ * on another. `check` compares it with the connection the step is bound to
178
+ * (LOOKUP_CONNECTION_MISMATCH). Absent on a row written before `prepare`
179
+ * recorded it; such a row is not compared.
180
+ */
181
+ connectionId?: string;
174
182
  }
175
183
  /** Every recorded resolution, keyed by {@link lookupKey}. */
176
184
  export type LookupResolutions = Readonly<Record<string, LookupResolution>>;
@@ -182,6 +190,15 @@ export type LookupResolutions = Readonly<Record<string, LookupResolution>>;
182
190
  * @returns The connector-facing id, when this exact `(nodeType, field, by, value)` was resolved.
183
191
  */
184
192
  export declare function resolvedValue(token: LookupToken, resolutions: LookupResolutions): string | undefined;
193
+ /**
194
+ * The recorded row for a token, or `undefined` — {@link resolvedValue} with the
195
+ * rest of the row (the connection it was resolved on).
196
+ *
197
+ * @param token - The lookup.
198
+ * @param resolutions - Everything `prepare --resolve` has recorded.
199
+ * @returns The row for this exact `(nodeType, field, by, value)`.
200
+ */
201
+ export declare function recordedResolution(token: LookupToken, resolutions: LookupResolutions): LookupResolution | undefined;
185
202
  /**
186
203
  * {@link resolvedValue} for a token on an event's `where`.
187
204
  *
@@ -199,6 +216,15 @@ export declare function resolvedValue(token: LookupToken, resolutions: LookupRes
199
216
  * @returns The connector-facing id, when either key was resolved.
200
217
  */
201
218
  export declare function resolvedEventValue(token: LookupToken, resolutions: LookupResolutions): string | undefined;
219
+ /**
220
+ * The recorded row for a token on an event's `where`, under either key
221
+ * {@link resolvedEventValue} tries, or `undefined`.
222
+ *
223
+ * @param token - The lookup, from either `lookup()` form.
224
+ * @param resolutions - Everything `prepare --resolve` has recorded.
225
+ * @returns The row, own key first, then the event form.
226
+ */
227
+ export declare function recordedEventResolution(token: LookupToken, resolutions: LookupResolutions): LookupResolution | undefined;
202
228
  /**
203
229
  * The message for a lookup nothing has resolved — the command that fixes it.
204
230
  *
@@ -164,8 +164,20 @@ export function lookup(a, b, c) {
164
164
  * @returns The connector-facing id, when this exact `(nodeType, field, by, value)` was resolved.
165
165
  */
166
166
  export function resolvedValue(token, resolutions) {
167
+ return recordedResolution(token, resolutions)?.value;
168
+ }
169
+ /**
170
+ * The recorded row for a token, or `undefined` — {@link resolvedValue} with the
171
+ * rest of the row (the connection it was resolved on).
172
+ *
173
+ * @param token - The lookup.
174
+ * @param resolutions - Everything `prepare --resolve` has recorded.
175
+ * @returns The row for this exact `(nodeType, field, by, value)`.
176
+ */
177
+ export function recordedResolution(token, resolutions) {
167
178
  const { nodeType, field, by, value } = token.__lookup;
168
- return resolutions[lookupKey(nodeType, field, by, value)]?.value;
179
+ const key = lookupKey(nodeType, field, by, value);
180
+ return Object.prototype.hasOwnProperty.call(resolutions, key) ? resolutions[key] : undefined;
169
181
  }
170
182
  /**
171
183
  * The event form of a node type — `uipath.connector.event.<key>.<op>` — for one
@@ -193,12 +205,26 @@ function eventFormOf(nodeType) {
193
205
  * @returns The connector-facing id, when either key was resolved.
194
206
  */
195
207
  export function resolvedEventValue(token, resolutions) {
196
- const own = resolvedValue(token, resolutions);
197
- if (own !== undefined)
208
+ return recordedEventResolution(token, resolutions)?.value;
209
+ }
210
+ /**
211
+ * The recorded row for a token on an event's `where`, under either key
212
+ * {@link resolvedEventValue} tries, or `undefined`.
213
+ *
214
+ * @param token - The lookup, from either `lookup()` form.
215
+ * @param resolutions - Everything `prepare --resolve` has recorded.
216
+ * @returns The row, own key first, then the event form.
217
+ */
218
+ export function recordedEventResolution(token, resolutions) {
219
+ const own = recordedResolution(token, resolutions);
220
+ if (own?.value !== undefined)
198
221
  return own;
199
222
  const { nodeType, field, by, value } = token.__lookup;
200
223
  const eventForm = eventFormOf(nodeType);
201
- return eventForm === undefined ? undefined : resolutions[lookupKey(eventForm, field, by, value)]?.value;
224
+ if (eventForm === undefined)
225
+ return undefined;
226
+ const key = lookupKey(eventForm, field, by, value);
227
+ return Object.prototype.hasOwnProperty.call(resolutions, key) ? resolutions[key] : undefined;
202
228
  }
203
229
  /**
204
230
  * The message for a lookup nothing has resolved — the command that fixes it.
@@ -412,6 +412,7 @@ export declare const REFUSALS: {
412
412
  readonly HITL_EXPOSE_ERROR_VERSION: "lowering";
413
413
  readonly HITL_FAN_OUT_INTO_JOIN: "lowering";
414
414
  readonly HITL_FIELD_DIRECTION: "lint";
415
+ readonly HITL_FIELD_EXTRA_CONFLICT: "lowering";
415
416
  readonly HITL_FIELD_NO_ID: "lowering";
416
417
  readonly HITL_FIELD_NO_VALUE: "lint";
417
418
  readonly HITL_FIELD_OPTIONS: "lint";
@@ -481,6 +482,7 @@ export declare const REFUSALS: {
481
482
  readonly INLINE_AGENT_EMPTY_RETURNS: "lint";
482
483
  readonly FLOW_AGENT_ESCALATION_APP_KEY_NOT_GUID: "lint";
483
484
  readonly FLOW_AGENT_ESCALATION_APP_WITH_FIELDS: "lowering";
485
+ readonly FLOW_AGENT_ESCALATION_FIELD_EXTRA_CONFLICT: "lowering";
484
486
  readonly FLOW_AGENT_ESCALATION_FIELD_OPTIONS: "lint";
485
487
  readonly FLOW_AGENT_ESCALATION_FIELD_OPTIONS_IGNORED: "lint";
486
488
  readonly FLOW_AGENT_ESCALATION_FIELD_SETTING_INVALID: "lint";
@@ -564,6 +566,7 @@ export declare const REFUSALS: {
564
566
  readonly LIBRARY_REQUIRED: "lowering";
565
567
  readonly LIST_OUTPUT_WRAPPER: "lint";
566
568
  readonly LOOKUP_ARGS: "lowering";
569
+ readonly LOOKUP_CONNECTION_MISMATCH: "lint";
567
570
  readonly LOOKUP_LITERAL_ID: "lint";
568
571
  readonly LOOKUP_MISPLACED: "lowering";
569
572
  readonly LOOKUP_RUNTIME_VALUE: "lint";
@@ -488,6 +488,7 @@ export const REFUSALS = {
488
488
  HITL_EXPOSE_ERROR_VERSION: 'lowering',
489
489
  HITL_FAN_OUT_INTO_JOIN: 'lowering',
490
490
  HITL_FIELD_DIRECTION: 'lint',
491
+ HITL_FIELD_EXTRA_CONFLICT: 'lowering',
491
492
  HITL_FIELD_NO_ID: 'lowering',
492
493
  HITL_FIELD_NO_VALUE: 'lint',
493
494
  HITL_FIELD_OPTIONS: 'lint',
@@ -557,6 +558,7 @@ export const REFUSALS = {
557
558
  INLINE_AGENT_EMPTY_RETURNS: 'lint',
558
559
  FLOW_AGENT_ESCALATION_APP_KEY_NOT_GUID: 'lint',
559
560
  FLOW_AGENT_ESCALATION_APP_WITH_FIELDS: 'lowering',
561
+ FLOW_AGENT_ESCALATION_FIELD_EXTRA_CONFLICT: 'lowering',
560
562
  FLOW_AGENT_ESCALATION_FIELD_OPTIONS: 'lint',
561
563
  FLOW_AGENT_ESCALATION_FIELD_OPTIONS_IGNORED: 'lint',
562
564
  FLOW_AGENT_ESCALATION_FIELD_SETTING_INVALID: 'lint',
@@ -640,6 +642,7 @@ export const REFUSALS = {
640
642
  LIBRARY_REQUIRED: 'lowering',
641
643
  LIST_OUTPUT_WRAPPER: 'lint',
642
644
  LOOKUP_ARGS: 'lowering',
645
+ LOOKUP_CONNECTION_MISMATCH: 'lint',
643
646
  LOOKUP_LITERAL_ID: 'lint',
644
647
  LOOKUP_MISPLACED: 'lowering',
645
648
  LOOKUP_RUNTIME_VALUE: 'lint',
@@ -36,6 +36,7 @@ export const AGENT_DIAGNOSTICS = {
36
36
  INLINE_AGENT_EMPTY_RETURNS: { severity: 'warning', summary: 'an inline agent with returns: {}' },
37
37
  FLOW_AGENT_ESCALATION_APP_KEY_NOT_GUID: { severity: 'error', summary: 'an app escalation whose app key is not a GUID' },
38
38
  FLOW_AGENT_ESCALATION_APP_WITH_FIELDS: { severity: 'error', summary: 'an app escalation that also lists quick-form fields' },
39
+ FLOW_AGENT_ESCALATION_FIELD_EXTRA_CONFLICT: { severity: 'error', summary: "a quick-form escalation field's extra that sets a key the SDK writes from a typed option" },
39
40
  FLOW_AGENT_ESCALATION_FIELD_OPTIONS: { severity: 'error', summary: 'a quick-form escalation field whose options are invalid' },
40
41
  FLOW_AGENT_ESCALATION_FIELD_OPTIONS_IGNORED: { severity: 'warning', summary: 'a quick-form escalation field with options its type ignores' },
41
42
  FLOW_AGENT_ESCALATION_FIELD_SETTING_INVALID: { severity: 'error', summary: 'a quick-form escalation field with an invalid setting' },
@@ -17,7 +17,7 @@ import { agentInputRef, agentSidecarInputs, promptPlaceholders } from '../../../
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
19
  import { Expr, flatNameOf, flatNameReference } from '../../../core/expr.js';
20
- import { formFieldRowLoss, formFieldRowLossMessage, formFieldSettingsSource, liftFormFieldSettings, sourceFormFieldType, } from '../../../core/form-field-type.js';
20
+ import { formFieldRowExtra, formFieldRowLoss, formFieldRowLossMessage, formFieldSettingsSource, liftFormFieldSettings, sourceFormFieldType, } from '../../../core/form-field-type.js';
21
21
  import { ownEntry } from '../../../core/own-entry.js';
22
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';
@@ -920,6 +920,7 @@ export function liftAgentResources(node, ctx, withMemory, agentInputs = []) {
920
920
  const message = formFieldRowLossMessage(`quick-form escalation ${JSON.stringify(rPlain(e, 'name') ?? e.id)} on agent ${JSON.stringify(node.id)}`, id, loss);
921
921
  ctx.lossy(message);
922
922
  }
923
+ const extra = formFieldRowExtra(f, 'escalation');
923
924
  return opts([
924
925
  ['id', tsText(f.id)],
925
926
  // serialize defaults a row's label to its id.
@@ -928,6 +929,8 @@ export function liftAgentResources(node, ctx, withMemory, agentInputs = []) {
928
929
  ['direction', tsLiteral(direction)],
929
930
  ['required', typeof f.required === 'boolean' && direction !== 'input' ? String(f.required) : undefined],
930
931
  ...formFieldSettingsSource(liftFormFieldSettings(f), dataSource),
932
+ // The row keys the SDK has no option for, written back as they are (#1989).
933
+ ['extra', Object.keys(extra).length > 0 ? dataSource(extra) : undefined],
931
934
  ]);
932
935
  }).join(', ')}]` : undefined],
933
936
  ['app', app === undefined ? undefined : opts([
@@ -2,7 +2,7 @@ import { agentInputPlan, inlineAgentJson, promptPlaceholders } from '../../../co
2
2
  import { Expr } from '../../../core/expr.js';
3
3
  import { derivedContextSource, derivedEscalationSource, derivedToolSource } from '../../../core/agent-resource-identity.js';
4
4
  import { GUID_RE } from '../../../core/binding-messages.js';
5
- import { formFieldSettingsWire, wireFormFieldType } from '../../../core/form-field-type.js';
5
+ import { formFieldExtraConflicts, formFieldExtraWire, formFieldSettingsWire, wireFormFieldType } from '../../../core/form-field-type.js';
6
6
  import { outcomeSlug } from '../../../core/hitl-routing.js';
7
7
  import { jsonClone } from '../../../core/json-clone.js';
8
8
  import { subNodeId } from '../../../core/node-id-placeholder.js';
@@ -613,6 +613,8 @@ export function attachAgentResources(s, ctx, source, who, toolVariables = new Ma
613
613
  // `defaultValue`, `colSpan`, …), as the human task's rows carry them
614
614
  // (#1235, #1250).
615
615
  ...formFieldSettingsWire(f),
616
+ // The row keys the SDK has no option for, as decompile found them (#1989).
617
+ ...formFieldExtraWire(f),
616
618
  };
617
619
  });
618
620
  const qsource = esc.source ?? derivedEscalationSource(ctx.flowId, step, esc.name);
@@ -750,6 +752,15 @@ function refuseLossyEscalation(e, step, who) {
750
752
  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 — `
751
753
  + `drop \`app\`, or drop the variant for the app-backed escalation.`);
752
754
  }
755
+ // An `extra` key may not replace a key the SDK writes from a typed option (#1989).
756
+ for (const f of Array.isArray(esc.fields) ? esc.fields : []) {
757
+ const conflicts = formFieldExtraConflicts(f, 'escalation');
758
+ if (conflicts.length === 0)
759
+ continue;
760
+ throw new CompileRefusal('FLOW_AGENT_ESCALATION_FIELD_EXTRA_CONFLICT', `${who} step "${step}"'s quick-form escalation field ${JSON.stringify(f.id)} sets `
761
+ + `${conflicts.map((k) => `\`${k}\``).join(', ')} in \`extra\`, which the SDK writes from the field's own options. `
762
+ + `\`extra\` carries only the row keys the SDK has no option for: set ${conflicts.length === 1 ? 'it' : 'them'} with the typed option and drop ${conflicts.length === 1 ? 'it' : 'them'} from \`extra\`.`);
763
+ }
753
764
  return;
754
765
  }
755
766
  if (esc.fields !== undefined) {
@@ -38,6 +38,7 @@ export const HITL_DIAGNOSTICS = {
38
38
  HITL_FIELD_VALUE_NOT_PATH: { severity: 'error', summary: 'a shown field filled from a lit(...) literal' },
39
39
  HITL_FIELD_DIRECTION: { severity: 'error', summary: 'a field direction that is not input, output or inOut' },
40
40
  HITL_FIELD_VARIABLE: { severity: 'error', summary: "an asked field's variable that is not one identifier, or sits on a shown field" },
41
+ HITL_FIELD_EXTRA_CONFLICT: { severity: 'error', summary: "a form field's extra that sets a key the SDK writes from a typed option" },
41
42
  HITL_NO_OUTCOMES: { severity: 'error', summary: 'no outcomes, so the task never completes' },
42
43
  HITL_OUTCOME_BAD_ID: { severity: 'error', summary: 'an outcome id that is not a non-empty string' },
43
44
  HITL_DUP_OUTCOME_ID: { severity: 'error', summary: 'two outcomes on one id' },
@@ -90,7 +91,7 @@ export function checkHitl(inputs, ctx) {
90
91
  // HITL_DOCUMENT_WITHOUT_VARIANT, DOCVAL_NO_EXTRACTION, DOCVAL_TAXONOMY_REQUIRED,
91
92
  // DOCVAL_RENDER_UNKNOWN, HITL_APP_WITHOUT_VARIANT, HITL_APP_INCOMPLETE,
92
93
  // HITL_APP_SCHEMA_INVALID, HITL_APP_OUTCOME_UNKNOWN, HITL_APP_LOCAL_HAS_FOLDER,
93
- // HITL_FIELD_NO_ID, HITL_FIELD_VARIABLE, HITL_FIELD_VALUE_NOT_REF,
94
+ // HITL_FIELD_NO_ID, HITL_FIELD_VARIABLE, HITL_FIELD_EXTRA_CONFLICT, HITL_FIELD_VALUE_NOT_REF,
94
95
  // HITL_FIELD_VALUE_NOT_PATH and HITL_OUTCOME_BAD_ID. The rules below still stop
95
96
  // where those used to, so a task they refuse gets no follow-on findings.
96
97
  const variant = inputs?.variant;
@@ -13,7 +13,7 @@
13
13
  * every edge out of an outcome-handle node to.
14
14
  */
15
15
  import { Expr, toExpr } from '../../../core/expr.js';
16
- import { formFieldJsonSchema, formFieldRowLoss, formFieldRowLossMessage, formFieldSettingsSource, formFieldSettingsWire, formFieldVariableName, liftFormFieldSettings, sourceFormFieldType, wireFormFieldType, } from '../../../core/form-field-type.js';
16
+ import { formFieldExtraConflicts, formFieldExtraWire, formFieldJsonSchema, formFieldRowExtra, formFieldRowLoss, formFieldRowLossMessage, formFieldSettingsSource, formFieldSettingsWire, formFieldVariableName, liftFormFieldSettings, sourceFormFieldType, wireFormFieldType, } from '../../../core/form-field-type.js';
17
17
  import { isAnswerField } from '../../../core/hitl-answers.js';
18
18
  import { OUTCOME_HANDLE_NODE_TYPES, hitlDerivesOutcomeHandles, hitlExitModel, outcomeIdOf, outcomeSlug } from '../../../core/hitl-routing.js';
19
19
  import { jsonClone } from '../../../core/json-clone.js';
@@ -97,7 +97,8 @@ function hitlInputs(inputs, nodeType, ctx) {
97
97
  // The field's settings — `controlType`, a picker's `options`,
98
98
  // `defaultValue`, `colSpan`, `rules`, … — as the canvas stores them on the
99
99
  // row, in the platform's key order (#1235, #1250).
100
- return { ...base, ...formFieldSettingsWire(f) };
100
+ // Then the row keys the SDK has no option for, as decompile found them (#1989).
101
+ return { ...base, ...formFieldSettingsWire(f), ...formFieldExtraWire(f) };
101
102
  });
102
103
  const outcomes = (inputs?.outcomes ?? []).map((o, i) => {
103
104
  const name = typeof o === 'string' ? o : o?.name;
@@ -434,6 +435,13 @@ function refuseUnwritable(inputs, typeName, step) {
434
435
  throw new CompileRefusal('HITL_FIELD_NO_ID', `Human task "${step}" has a form field with no id (fields[${i}]). The id is the key the `
435
436
  + `reviewer's answer comes back under, so a field without one is dropped.`, `id: 'amount'`);
436
437
  }
438
+ // An `extra` key may not replace a key the SDK writes from a typed option (#1989).
439
+ const conflicts = formFieldExtraConflicts(f, 'human task');
440
+ if (conflicts.length > 0) {
441
+ throw new CompileRefusal('HITL_FIELD_EXTRA_CONFLICT', `Human task "${step}"'s form field "${id}" sets ${conflicts.map((k) => `\`${k}\``).join(', ')} in \`extra\`, `
442
+ + `which the SDK writes from the field's own options. \`extra\` carries only the row keys the SDK has no option for.`, `Set ${conflicts.length === 1 ? 'it' : 'them'} with the field's own option${conflicts.length === 1 ? '' : 's'} and drop ${conflicts.length === 1 ? 'it' : 'them'} from \`extra\`, `
443
+ + `or, for a key decompile put in \`extra\`, change it there and drop the typed one.`);
444
+ }
437
445
  // Only an asked row is written with a `variable`, as `vars.<variable>`.
438
446
  const variable = f.variable;
439
447
  if (variable !== undefined) {
@@ -644,11 +652,13 @@ function liftHitl(node, typeName, ctx) {
644
652
  // reports any other spelling.
645
653
  const landing = direction === 'output' ? formFieldVariableName(f.variable) : undefined;
646
654
  const variable = landing !== undefined && landing !== id ? landing : undefined;
647
- // Every row key the source cannot carry is reported, never dropped
648
- // silently: a warning, an error under --strict (#1250).
655
+ // A row key the SDK has no option for rides in `extra` (#1989); one it
656
+ // cannot write back at all is reported, never dropped silently: a
657
+ // warning, an error under --strict (#1250).
649
658
  const loss = formFieldRowLoss(f, 'human task');
650
659
  if (loss.length > 0)
651
660
  ctx.lossy(formFieldRowLossMessage(`human task ${JSON.stringify(n.id)}`, id, loss));
661
+ const extra = formFieldRowExtra(f, 'human task');
652
662
  return {
653
663
  id,
654
664
  // serialize defaults a row's label to its id.
@@ -661,6 +671,7 @@ function liftHitl(node, typeName, ctx) {
661
671
  ...(typeof f.required === 'boolean' && direction !== 'input' ? { required: f.required } : {}),
662
672
  ...(variable !== undefined ? { variable } : {}),
663
673
  ...liftFormFieldSettings(f),
674
+ ...(Object.keys(extra).length > 0 ? { extra } : {}),
664
675
  };
665
676
  });
666
677
  const outcomeRows = (Array.isArray(schema.outcomes) ? schema.outcomes : []);
@@ -837,6 +848,7 @@ function printHitl({ inputs }, ctx) {
837
848
  ['required', f.required !== undefined ? String(f.required) : undefined],
838
849
  ['variable', f.variable !== undefined ? ctx.string(f.variable) : undefined],
839
850
  ...formFieldSettingsSource(f, ctx.value),
851
+ ['extra', f.extra !== undefined ? ctx.value(f.extra) : undefined],
840
852
  ], ctx));
841
853
  const outcomes = h.outcomes.map((o) => (typeof o === 'string' ? ctx.string(o) : obj([
842
854
  ['name', ctx.string(o.name)],
@@ -8,7 +8,9 @@
8
8
  * entries STAND rather than being re-resolved: a resolved id is a snapshot
9
9
  * either way, and re-resolving on every call would make an unrelated `prepare`
10
10
  * silently change an artifact. Re-resolving is `--refresh-lookups`, a
11
- * deliberate act with a visible diff.
11
+ * deliberate act with a visible diff. The one exception is a row recorded on
12
+ * another connection (`connectionId`, #1982): its id belongs to that
13
+ * connection, so it is resolved again.
12
14
  *
13
15
  * The object half of the ledger (`objects[nodeType][requested]`) lives in
14
16
  * `objects.ts`; this module reads and rewrites the WHOLE file so neither
@@ -137,7 +139,15 @@ export async function writeResolutions(run, specs) {
137
139
  }
138
140
  const key = resolutionKey(run.nodeType, field, by, value);
139
141
  const found = findResolution(existing, run.nodeType, field, by, value);
140
- if (found && !run.refreshLookups) {
142
+ // A row resolved on ANOTHER connection does not stand: its id belongs to
143
+ // that connection (#1982). This is the re-run `check`'s
144
+ // LOOKUP_CONNECTION_MISMATCH names, so it must replace the row without
145
+ // `--refresh-lookups`. A row with no `connectionId` predates the field and
146
+ // stands as before: nothing says where it came from.
147
+ const recordedOn = found ? pyGet(found.row, "connectionId", null) : null;
148
+ const otherConnection = typeof recordedOn === "string" && recordedOn !== ""
149
+ && recordedOn.toLowerCase() !== run.connectionId.toLowerCase();
150
+ if (found && !run.refreshLookups && !otherConnection) {
141
151
  const kept = pyStrAny(pyGet(found.row, "value", null));
142
152
  resolved.set(field, kept);
143
153
  run.reporter.info(resolutionLine(field, by, value, kept, true));
@@ -199,18 +209,18 @@ export async function writeResolutions(run, specs) {
199
209
  // it under the raw one, so the tuple does not end up recorded twice.
200
210
  if (found && found.key !== key)
201
211
  delete existing[found.key];
202
- existing[key] = { nodeType: run.nodeType, field, by, match: value, value: got };
212
+ existing[key] = { nodeType: run.nodeType, field, by, match: value, value: got, connectionId: run.connectionId };
203
213
  run.reporter.info(resolutionLine(field, by, value, got));
204
214
  answered.push(resolutionLine(field, by, value, got));
205
215
  }
206
216
  // ALL-OR-NOTHING, deliberately, even though the rows that DID resolve are
207
- // correct for this connection. A ledger row carries no connection: it is
208
- // keyed `[nodeType, field, by, value]`, and a later run REUSES a recorded row
209
- // without asking again unless `--refresh-lookups` is passed (above). So a
210
- // partial write from connection A would hand A's workspace ids to the next
211
- // run bound to connection B — the 2026-09-23 run resolved one recipient on
212
- // one Slack workspace and then re-pinned to another. Until rows are keyed by
213
- // connection, a run that misses records nothing and says what it found.
217
+ // correct for this connection. A ledger row is keyed `[nodeType, field, by,
218
+ // value]`, not by connection, so a partial write from connection A would
219
+ // leave A's workspace ids in the one slot the next run bound to connection B
220
+ // reads — the 2026-09-23 run resolved one recipient on one Slack workspace
221
+ // and then re-pinned to another. A row now records its `connectionId`, so
222
+ // that run re-resolves it and `check` reports it (LOOKUP_CONNECTION_MISMATCH),
223
+ // but a run that misses still records nothing and says what it found.
214
224
  if (misses.length > 0) {
215
225
  const message = misses.length === 1 && notTried.length === 0 && answered.length === 0
216
226
  ? misses[0].message
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.103.0",
3
+ "version": "6.104.1",
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",
@@ -121,5 +121,5 @@
121
121
  "@types/node": "^22.7.0",
122
122
  "esbuild": "^0.28.1"
123
123
  },
124
- "gitref": "a2b0c3e4c8d5532116ba89a1761d07300bd4c4bd"
124
+ "gitref": "f09831fd9c245f1fc9615d848e9ca87eb7a3dca5"
125
125
  }