@uipath/maestro-builder-sdk 6.16.4 → 6.16.5

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.
package/dist/check.js CHANGED
@@ -3206,14 +3206,14 @@ function checkInlineAgent(step, inputs, diags, opts = {}) {
3206
3206
  : `inputs: { ${undeclared[0]}: input('${undeclared[0]}') }`);
3207
3207
  }
3208
3208
  // Direction 3: an input bound to a COMPUTED EXPRESSION rather than to one
3209
- // reference. The platform names an agent's arguments by flat-mangling the
3210
- // references it finds in the node's prompts, so an expression spanning zero or
3211
- // several references has no single argument — and therefore no name a
3212
- // `{{input.<x>}}` token could address. Its data still reaches the agent (the
3213
- // platform derives one argument per reference inside the expression), but not
3214
- // under a name the prompt can use, so the placeholder would reach the model as
3215
- // literal text. An error rather than a warning, and for the same reason
3216
- // `INLINE_AGENT_UNDECLARED_PLACEHOLDER` is one: the value never arrives.
3209
+ // reference. The platform names each of an agent's arguments after the
3210
+ // reference path it is bound to (the shell node's `agentInputVariables`), so
3211
+ // an expression spanning zero or several references has no single argument —
3212
+ // and therefore no name a `{{input.<x>}}` token could address. The compiler
3213
+ // declares no argument for it, so its value does not reach the agent, and the
3214
+ // placeholder reaches the model as literal text. An error rather than a
3215
+ // warning, and for the same reason `INLINE_AGENT_UNDECLARED_PLACEHOLDER` is
3216
+ // one: the value never arrives.
3217
3217
  for (const [name, val] of Object.entries(inputs?.inputs ?? {})) {
3218
3218
  if (!(val instanceof Expr) || val.literal)
3219
3219
  continue;
@@ -3223,11 +3223,10 @@ function checkInlineAgent(step, inputs, diags, opts = {}) {
3223
3223
  continue;
3224
3224
  at('INLINE_AGENT_COMPOSITE_INPUT', `Inline agent step "${step}"'s input \`${name}\` is bound to a computed expression `
3225
3225
  + `(\`${val.js.length > 60 ? `${val.js.slice(0, 60)}…` : val.js}\`), and a prompt references it as `
3226
- + `\`{{input.${name}}}\`. The platform does not send the agent the names you declared: it scans the `
3227
- + `node's prompts for variable references and names each argument after the REFERENCE PATH `
3228
- + `(\`$vars.a.output.b\` → \`a__output__b\`). A computed expression is not one reference, so it has no `
3229
- + `single argument to name and the placeholder cannot be substituted — it would reach the model as `
3230
- + `that literal text.`, `compute it in a script step first, then bind the step's output: `
3226
+ + `\`{{input.${name}}}\`. The platform does not send the agent the names you declared: it names each `
3227
+ + `argument after the REFERENCE PATH the input is bound to (\`$vars.a.output.b\` → \`a__output__b\`). `
3228
+ + `A computed expression is not one reference, so it gets no argument: its value does not reach the `
3229
+ + `agent, and the placeholder reaches the model as that literal text.`, `compute it in a script step first, then bind the step's output: `
3231
3230
  + `.step('${name}Value', script({ code: 'return …;' })) … inputs: { ${name}: out('${name}Value') }`);
3232
3231
  }
3233
3232
  // A step id containing `__` makes the flat name AMBIGUOUS on the platform: the
@@ -699,15 +699,24 @@ export interface ConversationalAgentInputs {
699
699
  */
700
700
  settings: ConversationalAgentSettings;
701
701
  /**
702
- * Whether the agent's reply CLOSES the exchange. The platform's legacy
703
- * default is to end it; pass `false` to keep it open for another turn.
702
+ * Whether the agent's reply CLOSES the exchange.
703
+ *
704
+ * @deprecated Has no effect and is not emitted. The platform retired the input:
705
+ * the conversational agent's v1.7 node migration removes it, and the converter
706
+ * always sends `conversationalService.endExchange = ''`. Wait-for-message and
707
+ * the end of the conversation close open exchanges.
704
708
  */
705
709
  endExchange?: boolean;
706
710
  /** Sampling temperature, 0–1. */
707
711
  temperature?: number;
708
712
  /** Max tokens in one response. */
709
713
  maxTokenPerResponse?: number;
710
- /** The model's own context ceiling — informational. */
714
+ /**
715
+ * The model's own context ceiling.
716
+ *
717
+ * @deprecated Has no effect and is not emitted. Studio Web derives it from the
718
+ * selected model.
719
+ */
711
720
  modelMaxTokens?: number;
712
721
  /** How many tool-calling rounds one turn may take, 1–100. */
713
722
  maxIterations?: number;
@@ -1505,7 +1514,13 @@ export interface InlineAgentInputs {
1505
1514
  temperature?: number;
1506
1515
  /** Max tokens in one response, 0–16384. */
1507
1516
  maxTokenPerResponse?: number;
1508
- /** The model's own context ceiling — informational, e.g. `128000`. */
1517
+ /**
1518
+ * The model's own context ceiling, e.g. `128000`.
1519
+ *
1520
+ * @deprecated Has no effect and is not emitted. Studio Web derives it from the
1521
+ * selected model each time the agent is opened, and the sidecar has no field
1522
+ * for it.
1523
+ */
1509
1524
  modelMaxTokens?: number;
1510
1525
  /** How many tool-calling rounds the agent may take, 1–100. */
1511
1526
  maxIterations?: number;
package/dist/decompile.js CHANGED
@@ -1023,28 +1023,24 @@ function connectorObjectName(configuration) {
1023
1023
  * Returns `undefined` when the node is not one of them, so the caller can fall
1024
1024
  * through to the next arm.
1025
1025
  */
1026
+ /** The `maxIterations` Studio Web writes into every inline agent's `agent.json` (flow-workbench `getDefaultAgentContent()`). */
1027
+ const STUDIO_WEB_DEFAULT_MAX_ITERATIONS = 25;
1026
1028
  /**
1027
- * An AGENT and its attached resources — the inline autonomous agent, the
1028
- * conversational agent, and the voice agent.
1029
- *
1030
- * The cluster is a node plus artifact nodes on its `tool` / `context` /
1031
- * `escalation` / `memory` handles, so this walks those edges and recovers each
1032
- * resource as an argument rather than as a step (see {@link ARTIFACT_PORTS}).
1029
+ * The agent configuration a SHELL agent node keeps in its sidecar, read from
1030
+ * `<source>/agent.json` in the node's own input names: the prompts, the model,
1031
+ * the run settings (`temperature`, `maxTokenPerResponse`, `maxIterations`,
1032
+ * `mode`), the `guardrails` and (voice) the `voice` settings. Empty when the
1033
+ * node carries prompts itself (an embedded node, e.g. a `.flow` saved by Studio
1034
+ * Web with the self-contained flag on), or when no sidecar can be read.
1033
1035
  *
1034
- * **The author's input NAMES are not recoverable, and that is by design.** The
1035
- * platform does not send an agent the names you declared: it keys each argument
1036
- * by the reference PATH, `__`-joined (`$vars.prep.output` → `prep__output`), and
1037
- * only those flat names survive in the emitted file. Recovery therefore uses
1038
- * them for both the `inputs` keys and the `{{input.…}}` placeholders — the same
1039
- * arguments reach the model, spelled the platform's way. (Node ids are
1040
- * preserved exactly; only these logical names change.)
1041
- */
1042
- /**
1043
- * The agent configuration a SHELL agent node keeps in its sidecar: the prompts,
1044
- * the model and (voice) the `voice` settings, read from `<source>/agent.json`
1045
- * in the node's own input names. Empty when the node carries prompts itself (an
1046
- * embedded node, e.g. a `.flow` saved by Studio Web with the self-contained
1047
- * flag on), or when no sidecar can be read.
1036
+ * A run setting equal to the default a sidecar writer fills in (`temperature`
1037
+ * 0, `maxTokens` 16384, `mode` `'standard'`) is not recovered: recompiling
1038
+ * without it writes the same sidecar, and recovering it would add an argument
1039
+ * the author never wrote to every agent. `mode: 'standard'` is the exception on
1040
+ * a 1.3 node, where naming it is what selected that definition. The same goes
1041
+ * for the inline agent's `maxIterations` 25: the SDK omits it when unset, but
1042
+ * Studio Web always writes it (its `getDefaultAgentContent()` default), so
1043
+ * every Studio Web-saved agent would otherwise decompile with `maxIterations: 25`.
1048
1044
  */
1049
1045
  function sidecarAgentInputs(node) {
1050
1046
  const inputs = (node.inputs ?? {});
@@ -1057,7 +1053,8 @@ function sidecarAgentInputs(node) {
1057
1053
  const raw = runReadSidecar?.(path);
1058
1054
  if (raw === undefined) {
1059
1055
  warnOnce(`agent step "${node.id}" carries no prompts and ${path} was not found beside the .flow, `
1060
- + 'so its prompts and model decompile empty. Decompile the .flow from inside its project directory.');
1056
+ + 'so its prompts, model and run settings decompile empty. Keep <source>/agent.json beside the .flow '
1057
+ + '(download the whole project, not just the .flow).');
1061
1058
  return {};
1062
1059
  }
1063
1060
  let agent;
@@ -1065,7 +1062,7 @@ function sidecarAgentInputs(node) {
1065
1062
  agent = JSON.parse(raw);
1066
1063
  }
1067
1064
  catch {
1068
- warnOnce(`agent step "${node.id}": ${path} is not valid JSON, so its prompts and model decompile empty.`);
1065
+ warnOnce(`agent step "${node.id}": ${path} is not valid JSON, so its prompts, model and run settings decompile empty.`);
1069
1066
  return {};
1070
1067
  }
1071
1068
  const messages = (Array.isArray(agent?.messages) ? agent.messages : []);
@@ -1076,13 +1073,50 @@ function sidecarAgentInputs(node) {
1076
1073
  const settings = (agent?.settings ?? {});
1077
1074
  const system = content('system');
1078
1075
  const user = content('user');
1076
+ const isVoice = node.type === T.voiceAgent;
1077
+ const numberUnless = (v, dflt) => typeof v === 'number' && v !== dflt ? v : undefined;
1078
+ // The voice agent's temperature and token cap live in `settings.voice`, not here.
1079
+ const temperature = isVoice ? undefined : numberUnless(settings.temperature, 0);
1080
+ const maxTokenPerResponse = isVoice ? undefined : numberUnless(settings.maxTokens, 16384);
1081
+ // Studio Web's default for the inline agent; the other families keep any value.
1082
+ const maxIterations = node.type === T.inlineAgent
1083
+ ? numberUnless(settings.maxIterations, STUDIO_WEB_DEFAULT_MAX_ITERATIONS)
1084
+ : typeof settings.maxIterations === 'number' ? settings.maxIterations : undefined;
1085
+ // `mode` is a harness choice on the inline agent only; the conversational and
1086
+ // voice sidecars always carry their family's fixed value. Naming it is also
1087
+ // what selects the 1.3 definition, so on a 1.3 node even `'standard'` was the
1088
+ // author's.
1089
+ const mode = node.type === T.inlineAgent && typeof settings.mode === 'string'
1090
+ && (settings.mode !== 'standard' || node.typeVersion === '1.3')
1091
+ ? settings.mode : undefined;
1079
1092
  return {
1080
1093
  ...(system === undefined ? {} : { systemPrompt: system }),
1081
1094
  ...(user === undefined ? {} : { userPrompt: user }),
1082
1095
  ...(typeof settings.model === 'string' ? { model: settings.model } : {}),
1083
- ...(node.type === T.voiceAgent && settings.voice && typeof settings.voice === 'object' ? { voice: settings.voice } : {}),
1096
+ ...(temperature === undefined ? {} : { temperature }),
1097
+ ...(maxTokenPerResponse === undefined ? {} : { maxTokenPerResponse }),
1098
+ ...(maxIterations === undefined ? {} : { maxIterations }),
1099
+ ...(mode === undefined ? {} : { mode }),
1100
+ ...(Array.isArray(agent?.guardrails) && agent.guardrails.length > 0 ? { guardrails: agent.guardrails } : {}),
1101
+ ...(isVoice && settings.voice && typeof settings.voice === 'object' ? { voice: settings.voice } : {}),
1084
1102
  };
1085
1103
  }
1104
+ /**
1105
+ * An AGENT and its attached resources — the inline autonomous agent, the
1106
+ * conversational agent, and the voice agent.
1107
+ *
1108
+ * The cluster is a node plus artifact nodes on its `tool` / `context` /
1109
+ * `escalation` / `memory` handles, so this walks those edges and recovers each
1110
+ * resource as an argument rather than as a step (see {@link ARTIFACT_PORTS}).
1111
+ *
1112
+ * **The author's input NAMES are not recoverable, and that is by design.** The
1113
+ * platform does not send an agent the names you declared: it keys each argument
1114
+ * by the reference PATH, `__`-joined (`$vars.prep.output` → `prep__output`), and
1115
+ * only those flat names survive in the emitted file. Recovery therefore uses
1116
+ * them for both the `inputs` keys and the `{{input.…}}` placeholders — the same
1117
+ * arguments reach the model, spelled the platform's way. (Node ids are
1118
+ * preserved exactly; only these logical names change.)
1119
+ */
1086
1120
  function emitAgentCluster(node, imp, inputNames, graph) {
1087
1121
  // A key on the node wins over the sidecar's copy of it.
1088
1122
  const i = { ...sidecarAgentInputs(node), ...(node.inputs ?? {}) };
@@ -1094,10 +1128,12 @@ function emitAgentCluster(node, imp, inputNames, graph) {
1094
1128
  const raw = unwrapPlain(v);
1095
1129
  return typeof raw === 'number' ? String(raw) : undefined;
1096
1130
  };
1097
- // Prompts: invert `renderInlineAgentPrompt`. It replaced each
1098
- // `{{input.<name>}}` with that input's rendered binding, so the bindings in
1099
- // `agentInputVariables` are exactly what to put back — longest first, so a
1100
- // shorter binding cannot eat a longer one's prefix.
1131
+ // Prompts. A sidecar prompt already speaks `{{input.<flatName>}}`, so this
1132
+ // leaves it alone. An EMBEDDED node's prompt (Studio Web with the
1133
+ // self-contained flag on, or an SDK before #927) carries each input as its
1134
+ // rendered binding instead; the bindings in `agentInputVariables` are exactly
1135
+ // what to put back — longest first, so a shorter binding cannot eat a longer
1136
+ // one's prefix.
1101
1137
  const vars = (Array.isArray(i.agentInputVariables) ? i.agentInputVariables : []);
1102
1138
  const refs = vars
1103
1139
  .filter((v) => typeof v.id === 'string' && typeof v.binding === 'string')
@@ -1359,10 +1395,8 @@ function emitAgentCluster(node, imp, inputNames, graph) {
1359
1395
  // `settings` is required on ConversationalAgentInputs, so an empty one
1360
1396
  // stays as `{}`, which check then reports as CONV_AGENT_NO_TURN.
1361
1397
  ['settings', settingsSrc || '{}'],
1362
- ['endExchange', unwrapPlain(i.endExchange) === false ? 'false' : undefined],
1363
1398
  ['temperature', num(i.temperature)],
1364
1399
  ['maxTokenPerResponse', num(i.maxTokenPerResponse)],
1365
- ['modelMaxTokens', num(i.modelMaxTokens)],
1366
1400
  ['maxIterations', num(i.maxIterations)],
1367
1401
  ['guardrails', guardrails],
1368
1402
  ['source', str(plain(i.source) ?? '')],
@@ -1376,7 +1410,6 @@ function emitAgentCluster(node, imp, inputNames, graph) {
1376
1410
  ['returns', returns],
1377
1411
  ['temperature', num(i.temperature)],
1378
1412
  ['maxTokenPerResponse', num(i.maxTokenPerResponse)],
1379
- ['modelMaxTokens', num(i.modelMaxTokens)],
1380
1413
  ['maxIterations', num(i.maxIterations)],
1381
1414
  ['mode', plain(i.mode) !== undefined ? str(plain(i.mode)) : undefined],
1382
1415
  ['guardrails', guardrails],
package/dist/serialize.js CHANGED
@@ -5110,15 +5110,18 @@ export function serialize(built, opts = {}) {
5110
5110
  // on the first save. With no prompt strings the converter also keeps the
5111
5111
  // `agentInputVariables` below as written (`canPruneAgentInputs` is false),
5112
5112
  // and `uip maestro flow debug` reconciles them against the sidecar's
5113
- // `inputSchema` — the shape the v1 skill and `uip agent refresh` write.
5113
+ // `inputSchema`.
5114
+ //
5115
+ // The run settings (`mode`, `temperature`, `maxTokenPerResponse`,
5116
+ // `maxIterations`, `guardrails`) live in the sidecar too. The node keeps
5117
+ // exactly the keys Studio Web's own strip keeps (`toAgentShellInputs`,
5118
+ // @uipath/flow-schema): anything else is discarded on hydrate, and while
5119
+ // present it makes Studio Web "trust the .flow" when the sidecar folder is
5120
+ // missing (`flowNodeHasRealInputs`), flushing a prompt-less agent.json.
5121
+ // `modelMaxTokens` is written nowhere: the designer derives it from the
5122
+ // selected model.
5114
5123
  node.inputs = {
5115
5124
  source,
5116
- ...(s.mode === undefined ? {} : { mode: s.mode }),
5117
- ...(s.temperature === undefined ? {} : { temperature: s.temperature }),
5118
- ...(s.maxTokenPerResponse === undefined ? {} : { maxTokenPerResponse: s.maxTokenPerResponse }),
5119
- ...(s.modelMaxTokens === undefined ? {} : { modelMaxTokens: s.modelMaxTokens }),
5120
- ...(s.maxIterations === undefined ? {} : { maxIterations: s.maxIterations }),
5121
- ...(s.guardrails === undefined ? {} : { guardrails: s.guardrails }),
5122
5125
  // The two DESCRIPTOR ARRAYS. `agentInputVariables` entries carry the
5123
5126
  // binding expression; `agentOutputVariables` entries are name + type only,
5124
5127
  // and the runtime's structured final call fills exactly these keys.
@@ -5695,20 +5698,15 @@ export function serialize(built, opts = {}) {
5695
5698
  if (v !== undefined)
5696
5699
  settings[key] = v;
5697
5700
  }
5698
- // A SHELL node, like the inline agent's (#927): the system prompt and the
5699
- // model live only in the sidecar, so Studio Web reads the sidecar instead
5700
- // of letting a node copy shadow it.
5701
+ // A SHELL node, like the inline agent's (#927): exactly the keys
5702
+ // `toAgentShellInputs` keeps. The system prompt, the model and the run
5703
+ // settings live only in the sidecar (`metadata.isConversational` there is
5704
+ // the family flag). `endExchange` is written nowhere: the platform retired
5705
+ // it (the node's v1.7 migration drops it, and the converter always sends
5706
+ // `conversationalService.endExchange = ''`).
5701
5707
  node.inputs = {
5702
5708
  source,
5703
- // The family's own flag — every instance of this node IS conversational.
5704
- isConversational: true,
5705
5709
  conversationalAgentSettings: settings,
5706
- ...(s.endExchange === undefined ? {} : { endExchange: s.endExchange }),
5707
- ...(s.temperature === undefined ? {} : { temperature: s.temperature }),
5708
- ...(s.maxTokenPerResponse === undefined ? {} : { maxTokenPerResponse: s.maxTokenPerResponse }),
5709
- ...(s.modelMaxTokens === undefined ? {} : { modelMaxTokens: s.modelMaxTokens }),
5710
- ...(s.maxIterations === undefined ? {} : { maxIterations: s.maxIterations }),
5711
- ...(s.guardrails === undefined ? {} : { guardrails: s.guardrails }),
5712
5710
  };
5713
5711
  scope.nodes.push(node);
5714
5712
  sidecars.push({
@@ -5771,13 +5769,11 @@ export function serialize(built, opts = {}) {
5771
5769
  // one makes Studio Web treat the `.flow` as authoritative and skip the
5772
5770
  // sidecar (`hasEmbeddedAgentContent`). `uip maestro flow debug` builds the
5773
5771
  // voice agent from the sidecar (`packageInlineAgents`).
5772
+ // The node keeps exactly the keys `toAgentShellInputs` keeps;
5773
+ // `maxIterations` and `metadata.isConversational` are in the sidecar.
5774
5774
  node.inputs = {
5775
5775
  source,
5776
5776
  callContext: renderValue(toExpr(s.callContext), scope.rename),
5777
- // The platform's own flag for this family — every voice agent IS
5778
- // conversational, and the definition declares the field.
5779
- isConversational: true,
5780
- ...(s.maxIterations === undefined ? {} : { maxIterations: s.maxIterations }),
5781
5777
  ...(plan.refs.length === 0 ? {} : {
5782
5778
  agentInputVariables: plan.refs.map((r) => ({
5783
5779
  id: r.flatName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.16.4",
3
+ "version": "6.16.5",
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",
@@ -92,5 +92,5 @@
92
92
  "@types/node": "^22.7.0",
93
93
  "esbuild": "^0.28.1"
94
94
  },
95
- "gitref": "eac0393e29eed1fe0992c8923b88964e50483eaf"
95
+ "gitref": "b6731e22dc81fb2ca34f4463bc1785aaae16d174"
96
96
  }