@uipath/maestro-builder-sdk 6.96.5 → 6.96.7

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.
@@ -17,6 +17,7 @@
17
17
  *
18
18
  * `casePlan` (not `case`) is the entry point: `case` is a reserved word.
19
19
  */
20
+ import { REFERENCE_MODE_TASK_KINDS } from './reference-mode.js';
20
21
  import { lowerScriptFunction } from '../core/script-function.js';
21
22
  import { CASE_SCRIPT_RUNTIME } from './script.js';
22
23
  import { ACTION_PASSTHROUGH_SETTINGS } from './action-settings.js';
@@ -870,7 +871,7 @@ class TaskBuilder {
870
871
  // `response` and `Error` rows, and each extract (`=response.<field>`) is one
871
872
  // more row after them, as `uip maestro case sdd convert` and `case splice`
872
873
  // write an SDD row `app_id -> postAppId`.
873
- const REF_IO = new Set(['process', 'agent', 'rpa', 'api-workflow', 'case-management', 'flow-process', 'function', 'business-rule']);
874
+ const REF_IO = REFERENCE_MODE_TASK_KINDS;
874
875
  // A document extraction and a script task write their two outputs, an
875
876
  // http-request task the activity's four; an extract maps one to a variable.
876
877
  const CONNECTOR_OUTPUTS = new Set(['connector', 'wait-for-connector', 'document-extraction', 'script', 'http-request']);
@@ -1,3 +1,4 @@
1
+ import { REFERENCE_MODE_TASK_KINDS } from './reference-mode.js';
1
2
  import { types } from '../core/expr.js';
2
3
  import { CASE_FORMAT_PROFILE, CASE_SCHEMA_VERSIONS, authoredCaseVersion } from './format-profile.js';
3
4
  import { schemaVersionRefusal } from '../schema-version.js';
@@ -689,6 +690,31 @@ function checkStage(stage, diags, refStage, refPlacement) {
689
690
  message: `${t.kind === 'connector' ? 'Connector' : 'Wait-for-connector'} task "${t.name}" output "${o.var}" reads "${o.source}". A connector task's result is its response: write "=response.${o.source.replace(/^=\s*/, '')}" (or "=Error.<field>" for the error).`,
690
691
  where: t.name,
691
692
  });
693
+ // The reverse holds for a reference-mode task (agent, process, RPA, API
694
+ // workflow, ...): its result fields are at the top of its result, so the
695
+ // Designer and `uip maestro case sdd convert` (`outputSourceFor`) write
696
+ // `=AgentExpenseRequest`. `=response.AgentExpenseRequest` names a
697
+ // `response` the result does not have, and the variable is left empty
698
+ // (builder-sdk#1565).
699
+ if (REFERENCE_MODE_TASK_KINDS.has(t.kind))
700
+ for (const o of t.outputs ?? []) {
701
+ if (o.custom)
702
+ continue; // an assigned value, not a result field
703
+ // `=response.X` and `=response[...]`. `check` does not see the
704
+ // artifact's argument list, so an artifact whose own output argument is
705
+ // named `response` is flagged too (the trade-off BUSINESS_RULE_OUTPUT_SOURCE
706
+ // makes for `=result.`). A bare `=response` is left alone: it names
707
+ // such an argument whole, and has no field to suggest.
708
+ if (!/^=\s*response\s*[.[]/.test(o.source))
709
+ continue;
710
+ const fix = /^=\s*response\s*\.\s*(.+)$/.exec(o.source)?.[1];
711
+ diags.push({
712
+ level: 'error',
713
+ code: 'REFERENCE_OUTPUT_SOURCE',
714
+ message: `Task "${t.name}" (${t.kind}) output "${o.var}" reads "${o.source}". This ${t.kind} task's result fields are read directly; \`=response.<field>\` is the connector form and reads nothing here. Write ${fix !== undefined ? `"=${fix}"` : 'the field without the `response` prefix'} (the source the Designer and \`uip maestro case sdd convert\` write).`,
715
+ where: t.name,
716
+ });
717
+ }
692
718
  if (t.kind === 'flow-process' && (!t.ref || !t.ref.name.trim()))
693
719
  diags.push({
694
720
  level: 'error',
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Reference-mode task kinds: a task that runs a separately published artifact
3
+ * (a process, agent, RPA or API workflow, ...) and binds its arguments with
4
+ * `.inputs()` / `.outputs()`. The artifact's result fields are at the top of
5
+ * its result, so an extract reads `=<Field>`, not the connector form
6
+ * `=response.<field>` (builder-sdk#1565). Shared by the builder (which kinds
7
+ * take `.inputs()`) and `check` (REFERENCE_OUTPUT_SOURCE).
8
+ */
9
+ import type { TaskKind } from './case-sdk.js';
10
+ export declare const REFERENCE_MODE_TASK_KINDS: ReadonlySet<TaskKind>;
@@ -0,0 +1,3 @@
1
+ export const REFERENCE_MODE_TASK_KINDS = new Set([
2
+ 'process', 'agent', 'rpa', 'api-workflow', 'case-management', 'flow-process', 'function', 'business-rule',
3
+ ]);
@@ -168,12 +168,24 @@ export declare function promptPlaceholders(s: {
168
168
  /** Which writer produced an `agent.json`: the inline, conversational or voice agent's. */
169
169
  export type AgentSidecarDialect = 'inline' | 'conversational' | 'voice';
170
170
  /**
171
- * The agent configuration a SHELL agent node keeps in its sidecar, read from
171
+ * The agent configuration an agent node keeps in its sidecar, read from
172
172
  * `<source>/agent.json` in the node's own input names: the prompts, the model,
173
173
  * the run settings (`temperature`, `maxTokenPerResponse`, `maxIterations`,
174
- * `mode`), the `guardrails` and (voice) the `voice` settings. Empty when the
175
- * node carries prompts itself (an embedded node, e.g. a `.flow` saved by Studio
176
- * Web with the self-contained flag on), or when no sidecar can be read.
174
+ * `mode`), the `guardrails` and (voice) the `voice` settings. Empty when no
175
+ * sidecar can be read. The caller spreads the node's own inputs over this, so
176
+ * a key on the node wins.
177
+ *
178
+ * The sidecar is read for an EMBEDDED node too (one that carries prompts
179
+ * itself, e.g. a `.flow` saved by Studio Web with the self-contained flag on,
180
+ * or a hand-built one): such a node often carries its prompts and no `model`,
181
+ * and the model is then only in `settings.model`. That is how the platform
182
+ * reads it as well: `uip maestro flow validate` and `flow pack` copy each
183
+ * sidecar value onto the node unless the node already has that key
184
+ * (`hydrateAgentNodeInputs`, uipath-cli `packager-tool-flow/src/flow-validation.ts`),
185
+ * and the packaged agent is built from `agent.json`. Skipping the sidecar for
186
+ * such a node decompiled `model: ""`, and compile then wrote `"model": ""`
187
+ * over the sidecar's real model. For an embedded node a missing sidecar is
188
+ * normal (a self-contained `.flow` needs none), so it is not warned about.
177
189
  *
178
190
  * A run setting equal to the default a sidecar writer fills in (`temperature`
179
191
  * 0, `maxTokens` 16384, `mode` `'standard'`) is not recovered: recompiling
@@ -324,12 +324,24 @@ function promptTokens(content) {
324
324
  /** The `maxIterations` Studio Web writes into every inline agent's `agent.json` (flow-workbench `getDefaultAgentContent()`). */
325
325
  const STUDIO_WEB_DEFAULT_MAX_ITERATIONS = 25;
326
326
  /**
327
- * The agent configuration a SHELL agent node keeps in its sidecar, read from
327
+ * The agent configuration an agent node keeps in its sidecar, read from
328
328
  * `<source>/agent.json` in the node's own input names: the prompts, the model,
329
329
  * the run settings (`temperature`, `maxTokenPerResponse`, `maxIterations`,
330
- * `mode`), the `guardrails` and (voice) the `voice` settings. Empty when the
331
- * node carries prompts itself (an embedded node, e.g. a `.flow` saved by Studio
332
- * Web with the self-contained flag on), or when no sidecar can be read.
330
+ * `mode`), the `guardrails` and (voice) the `voice` settings. Empty when no
331
+ * sidecar can be read. The caller spreads the node's own inputs over this, so
332
+ * a key on the node wins.
333
+ *
334
+ * The sidecar is read for an EMBEDDED node too (one that carries prompts
335
+ * itself, e.g. a `.flow` saved by Studio Web with the self-contained flag on,
336
+ * or a hand-built one): such a node often carries its prompts and no `model`,
337
+ * and the model is then only in `settings.model`. That is how the platform
338
+ * reads it as well: `uip maestro flow validate` and `flow pack` copy each
339
+ * sidecar value onto the node unless the node already has that key
340
+ * (`hydrateAgentNodeInputs`, uipath-cli `packager-tool-flow/src/flow-validation.ts`),
341
+ * and the packaged agent is built from `agent.json`. Skipping the sidecar for
342
+ * such a node decompiled `model: ""`, and compile then wrote `"model": ""`
343
+ * over the sidecar's real model. For an embedded node a missing sidecar is
344
+ * normal (a self-contained `.flow` needs none), so it is not warned about.
333
345
  *
334
346
  * A run setting equal to the default a sidecar writer fills in (`temperature`
335
347
  * 0, `maxTokens` 16384, `mode` `'standard'`) is not recovered: recompiling
@@ -342,13 +354,14 @@ const STUDIO_WEB_DEFAULT_MAX_ITERATIONS = 25;
342
354
  */
343
355
  export function agentSidecarInputs(o) {
344
356
  const { inputs, source, dialect } = o;
345
- if (typeof inputs.systemPrompt === 'string' || typeof inputs.userPrompt === 'string')
346
- return {};
357
+ const embedded = typeof inputs.systemPrompt === 'string' || typeof inputs.userPrompt === 'string';
347
358
  if (!source)
348
359
  return {};
349
360
  const path = `${source}/agent.json`;
350
361
  const raw = o.read?.(path);
351
362
  if (raw === undefined) {
363
+ if (embedded)
364
+ return {};
352
365
  o.warn(`agent step "${o.nodeId}" carries no prompts and ${path} was not found beside the .flow, `
353
366
  + 'so its prompts, model and run settings decompile empty. Keep <source>/agent.json beside the .flow '
354
367
  + '(download the whole project, not just the .flow).');
@@ -359,7 +372,7 @@ export function agentSidecarInputs(o) {
359
372
  agent = JSON.parse(raw);
360
373
  }
361
374
  catch {
362
- o.warn(`agent step "${o.nodeId}": ${path} is not valid JSON, so its prompts, model and run settings decompile empty.`);
375
+ o.warn(`agent step "${o.nodeId}": ${path} is not valid JSON, so its ${embedded ? '' : 'prompts, '}model and run settings decompile empty.`);
363
376
  return {};
364
377
  }
365
378
  const messages = (Array.isArray(agent?.messages) ? agent.messages : []);
@@ -630,6 +630,7 @@ export declare const REFUSALS: {
630
630
  readonly RAW_NODE_UNKNOWN_INPUT: "lowering";
631
631
  readonly RAW_NODE_VERSION_MISMATCH: "lowering";
632
632
  readonly READ_TEXT_UNAVAILABLE: "lowering";
633
+ readonly REFERENCE_OUTPUT_SOURCE: "lint";
633
634
  readonly REF_INTO_LOOP: "lint";
634
635
  readonly REF_INTO_PARALLEL_ARM: "lint";
635
636
  readonly REF_INTO_PORT_LIST: "lint";
@@ -704,6 +704,7 @@ export const REFUSALS = {
704
704
  RAW_NODE_UNKNOWN_INPUT: 'lowering',
705
705
  RAW_NODE_VERSION_MISMATCH: 'lowering',
706
706
  READ_TEXT_UNAVAILABLE: 'lowering',
707
+ REFERENCE_OUTPUT_SOURCE: 'lint',
707
708
  REF_INTO_LOOP: 'lint',
708
709
  REF_INTO_PARALLEL_ARM: 'lint',
709
710
  REF_INTO_PORT_LIST: 'lint',
@@ -540,9 +540,20 @@ export function checkInlineAgent(inputs, ctx) {
540
540
  }
541
541
  // The definition's own `required`: systemPrompt, userPrompt, model — each with
542
542
  // `minLength: 1`, so a blank string is as invalid as a missing key.
543
+ //
544
+ // `model` is the whole truth here, not only the node's copy: compile writes it
545
+ // into the agent's `<source>/agent.json` (`settings.model`), and decompile
546
+ // fills it from that file when the node carries none (`agentSidecarInputs`).
547
+ // So a blank one means no model anywhere: compile would write
548
+ // `"model": ""`. `uip maestro flow validate` accepts that (uip 1.205.0, with
549
+ // and without the sidecar beside the .flow), so this check is the only place
550
+ // it is said.
543
551
  if (blank(inputs?.model)) {
544
- at('INLINE_AGENT_NO_MODEL', `Inline agent step "${step}" has no \`model\`. The node's definition requires one (\`minLength: 1\`), so `
545
- + `a flow without it does not validate. \`uip agent model list\` shows what the tenant offers.`, `model: 'gpt-5.4'`);
552
+ at('INLINE_AGENT_NO_MODEL', `Inline agent step "${step}" has no \`model\`. The node's definition requires one (\`minLength: 1\`), and `
553
+ + `compile writes it as the agent's \`settings.model\` in \`<source>/agent.json\`, so the agent would be `
554
+ + `saved with \`"model": ""\`. \`uip maestro flow validate\` does not catch this. If the flow came from `
555
+ + `decompile, its agent project (\`<source>/agent.json\`) was not beside the .flow: decompile reads the `
556
+ + `model from there. \`uip agent model list\` shows what the tenant offers.`, `model: 'gpt-5.4'`);
546
557
  }
547
558
  if (blank(inputs?.systemPrompt)) {
548
559
  at('INLINE_AGENT_NO_SYSTEM_PROMPT', `Inline agent step "${step}" has no \`systemPrompt\`. The node's definition requires one `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.96.5",
3
+ "version": "6.96.7",
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",
@@ -113,5 +113,5 @@
113
113
  "@types/node": "^22.7.0",
114
114
  "esbuild": "^0.28.1"
115
115
  },
116
- "gitref": "84f00bcf8f2a3adc95f7eb70b55234d80023c0f9"
116
+ "gitref": "0f0cc58b2213886cb7060dda81ed3193235c9d10"
117
117
  }