@uipath/maestro-builder-sdk 6.117.2 → 6.117.4

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.
@@ -254,7 +254,7 @@ type Preservation = {
254
254
  name: string;
255
255
  trigger: string;
256
256
  }>;
257
- omitMetadata?: Array<'caseAppEnabled' | 'caseIdentifierType' | 'publishVersion'>;
257
+ omitMetadata?: Array<'caseAppEnabled' | 'caseIdentifierType' | 'publishVersion' | 'intsvcActivityConfig'>;
258
258
  publishVersion?: number;
259
259
  nodeFields?: Record<string, Record<string, unknown>>;
260
260
  variableFields?: Partial<Record<'inputs' | 'outputs' | 'inputOutputs', Record<string, Record<string, unknown>>>>;
@@ -281,6 +281,7 @@ type Preservation = {
281
281
  metadata: Record<string, unknown>;
282
282
  }>;
283
283
  connectorContexts?: PreservedConnectorContext[];
284
+ connectorConfigV2?: string[];
284
285
  connectorRows?: PreservedConnectorRows[];
285
286
  subscriptionFilters?: Array<{
286
287
  owner: string;
@@ -9,6 +9,7 @@ import { isScriptOwnOutput, liftScript } from './decompile-script.js';
9
9
  import { isHttpRequestOwnOutput, liftHttpRequest } from './decompile-http-request.js';
10
10
  import { savedHttpRequestMetadata } from './http-request.js';
11
11
  import { caseConnectorOwners, savedConnectorContext } from './connector-saved-context.js';
12
+ import { elementConfigV2Owners } from './intsvc-activity-config.js';
12
13
  import { caseConnectorRowOwners, savedConnectorRows } from './connector-saved-rows.js';
13
14
  import { builtChainSource, chainStatements } from '../core/builder-chain.js';
14
15
  import { literalSource } from './literal.js';
@@ -2656,10 +2657,11 @@ export function collectPreservation(plan) {
2656
2657
  const metadata = Object.fromEntries(Object.entries(plan.metadata ?? {}).filter(([name]) => !metadataKnown.has(name)));
2657
2658
  if (Object.keys(metadata).length)
2658
2659
  preservation.metadata = metadata;
2659
- // The serializer always writes these three; a source that left one out keeps
2660
+ // The serializer always writes these four; a source that left one out keeps
2660
2661
  // it out (see `omitMetadata` in preserve.ts). `publishVersion` is a platform
2661
2662
  // stamp the builder does not author, so a different source value is carried.
2662
- const omitMetadata = ['caseAppEnabled', 'caseIdentifierType', 'publishVersion']
2663
+ // `intsvcActivityConfig` absent is a V1 plan, which must stay V1.
2664
+ const omitMetadata = ['caseAppEnabled', 'caseIdentifierType', 'publishVersion', 'intsvcActivityConfig']
2663
2665
  .filter((name) => !Object.prototype.hasOwnProperty.call(plan.metadata ?? {}, name));
2664
2666
  if (omitMetadata.length)
2665
2667
  preservation.omitMetadata = [...omitMetadata];
@@ -2915,6 +2917,9 @@ export function collectPreservation(plan) {
2915
2917
  .filter((entry) => entry !== undefined);
2916
2918
  if (connectorContexts.length)
2917
2919
  preservation.connectorContexts = connectorContexts;
2920
+ const connectorConfigV2 = elementConfigV2Owners(plan);
2921
+ if (connectorConfigV2.length)
2922
+ preservation.connectorConfigV2 = connectorConfigV2;
2918
2923
  const connectorRows = caseConnectorRowOwners(plan)
2919
2924
  .map(({ key, bag }) => savedConnectorRows(key, bag))
2920
2925
  .filter((entry) => entry !== undefined);
@@ -0,0 +1,33 @@
1
+ import type { CaseJsonPreservation } from './preserve.js';
2
+ /** The marker's name in `metadata`. */
3
+ export declare const INTSVC_ACTIVITY_CONFIG = "intsvcActivityConfig";
4
+ /** The warning {@link defaultIntsvcActivityConfig} gives. */
5
+ export interface IntsvcConfigWarning {
6
+ code: 'CONNECTOR_CONFIG_V2_DEFAULT';
7
+ message: string;
8
+ }
9
+ /**
10
+ * Write `metadata.intsvcActivityConfig: "v2"` when the source does not say
11
+ * otherwise (see the module comment). Runs after preservation, which carries a
12
+ * saved value or the saved absence.
13
+ */
14
+ export declare function defaultIntsvcActivityConfig(result: Record<string, unknown>, preservation: CaseJsonPreservation | undefined, warn?: (warning: IntsvcConfigWarning) => void): void;
15
+ /**
16
+ * V2 plans: mark each connector task's and event trigger's context that is
17
+ * bound to a connection `activityConfigurationVersion: v2`, as the Designer and
18
+ * CLI do. A context that already carries the row keeps it.
19
+ */
20
+ export declare function stampConnectorConfigVersion(result: Record<string, unknown>): Record<string, unknown>;
21
+ /**
22
+ * The connector elements of a plan with no `"v2"` marker whose own context
23
+ * carries the V2 row, by {@link elementKey}: the Designer reads that row
24
+ * before the marker, so decompile records them (`connectorConfigV2`).
25
+ */
26
+ export declare function elementConfigV2Owners(plan: Record<string, any>): string[];
27
+ /**
28
+ * For a plan whose settled marker is not `"v2"` (see `applyPreservation`):
29
+ * each connector element keeps the V2 row only when the saved plan had it on
30
+ * that element (`keep`, the `connectorConfigV2` element keys). The others lose
31
+ * it, and a kept one that lacks it gets it back, last in its context.
32
+ */
33
+ export declare function unstampConnectorConfigVersion(result: Record<string, unknown>, keep?: readonly string[]): void;
@@ -0,0 +1,137 @@
1
+ /**
2
+ * `metadata.intsvcActivityConfig`: which Integration Service activity
3
+ * configuration a case's connector elements use. The Case Designer and
4
+ * `uip maestro case init` write `"v2"` on a new case. With no marker, the CLI's
5
+ * BPMN rule (`isIntsvcActivityExecutionV1`) reads an absent version as V1, and
6
+ * the Designer still opens a connector element in its V2 panel when that
7
+ * element's own context says `activityConfigurationVersion: v2`. How the Case
8
+ * runtime reads a plan with no marker is not verified, so compile keeps a
9
+ * decompiled plan's marker, or its absence, as it was.
10
+ *
11
+ * Compile writes `"v2"` on a case whose source does not say otherwise:
12
+ * - a value `preserveCaseJson` carries (`metadata.intsvcActivityConfig`) stays;
13
+ * - a decompiled plan that had no marker records that
14
+ * (`omitMetadata: ['intsvcActivityConfig']`) and stays without one, so a V1
15
+ * plan stays V1;
16
+ * - else compile writes `"v2"`. When the source is a decompiled plan from an SDK
17
+ * that did not yet record the absence, and the plan has a connector element,
18
+ * compile cannot tell a V1 plan from a new one, so it warns
19
+ * (`CONNECTOR_CONFIG_V2_DEFAULT`).
20
+ *
21
+ * Then each connector element of a `"v2"` plan gets its
22
+ * `activityConfigurationVersion: v2` context row, as the Designer and CLI write.
23
+ */
24
+ import { CASE_FORMAT_PROFILE } from './format-profile.js';
25
+ import { caseConnectorOwners } from './connector-saved-context.js';
26
+ /** The marker's name in `metadata`. */
27
+ export const INTSVC_ACTIVITY_CONFIG = 'intsvcActivityConfig';
28
+ /** The task types whose `data.context[]` carries an Integration Service activity configuration. */
29
+ const CONNECTOR_CONFIG_TASK_TYPES = new Set([
30
+ 'execute-connector-activity',
31
+ 'wait-for-connector',
32
+ 'external-agent',
33
+ 'external-workflow',
34
+ ]);
35
+ const V2_CONFIG_ROW = { name: 'activityConfigurationVersion', value: 'v2', type: 'string' };
36
+ /**
37
+ * Each connector task's and event trigger's context that is bound to a
38
+ * connection. A placeholder bag (`connectorKey` + `operation`, or a trigger's
39
+ * lone `objectName`) has no configuration panel to pick, so it is left out.
40
+ */
41
+ function boundConnectorContexts(result) {
42
+ const contexts = [];
43
+ const take = (context) => {
44
+ if (Array.isArray(context) && context.some((row) => row?.name === 'connection'))
45
+ contexts.push(context);
46
+ };
47
+ for (const node of result.nodes ?? []) {
48
+ if (node?.type === 'case-management:Trigger' || node?.type === 'uipath.case.trigger')
49
+ take(node.data?.[CASE_FORMAT_PROFILE.triggerBagField]?.context);
50
+ for (const lane of node?.data?.tasks ?? []) {
51
+ for (const task of Array.isArray(lane) ? lane : []) {
52
+ if (CONNECTOR_CONFIG_TASK_TYPES.has(task?.type))
53
+ take(task.data?.context);
54
+ }
55
+ }
56
+ }
57
+ return contexts;
58
+ }
59
+ /**
60
+ * Write `metadata.intsvcActivityConfig: "v2"` when the source does not say
61
+ * otherwise (see the module comment). Runs after preservation, which carries a
62
+ * saved value or the saved absence.
63
+ */
64
+ export function defaultIntsvcActivityConfig(result, preservation, warn) {
65
+ const metadata = result.metadata;
66
+ if (!metadata || Object.prototype.hasOwnProperty.call(metadata, INTSVC_ACTIVITY_CONFIG))
67
+ return;
68
+ if (preservation?.omitMetadata?.includes(INTSVC_ACTIVITY_CONFIG))
69
+ return;
70
+ metadata[INTSVC_ACTIVITY_CONFIG] = 'v2';
71
+ if (preservation && boundConnectorContexts(result).length) {
72
+ warn?.({
73
+ code: 'CONNECTOR_CONFIG_V2_DEFAULT',
74
+ message: 'compile wrote metadata.intsvcActivityConfig "v2", the Integration Service configuration the Case Designer writes on a new case. '
75
+ + 'This source has a preserveCaseJson(...) payload, as a decompiled plan does, but the payload does not say whether the plan had the marker, and the plan has connector elements. '
76
+ + 'If the plan had no marker, add "intsvcActivityConfig" to omitMetadata in the payload to keep it that way, or decompile the plan again with this SDK, which records it. '
77
+ + 'If the case is meant to be V2, add metadata: { intsvcActivityConfig: "v2" } to the payload, and this warning stops.',
78
+ });
79
+ }
80
+ }
81
+ /**
82
+ * V2 plans: mark each connector task's and event trigger's context that is
83
+ * bound to a connection `activityConfigurationVersion: v2`, as the Designer and
84
+ * CLI do. A context that already carries the row keeps it.
85
+ */
86
+ export function stampConnectorConfigVersion(result) {
87
+ const metadata = result.metadata;
88
+ if (metadata?.[INTSVC_ACTIVITY_CONFIG] !== 'v2')
89
+ return result;
90
+ for (const context of boundConnectorContexts(result))
91
+ if (!context.some((row) => row?.name === V2_CONFIG_ROW.name))
92
+ context.push({ ...V2_CONFIG_ROW });
93
+ return result;
94
+ }
95
+ /** Whether `context` holds the `activityConfigurationVersion: v2` row. */
96
+ const hasV2Row = (context) => Array.isArray(context) && context.some((row) => row?.name === V2_CONFIG_ROW.name && row?.value === V2_CONFIG_ROW.value);
97
+ /**
98
+ * An element's key without its stage: `task:<task id>`, `rule:<rule id>` or
99
+ * `trigger:<node id>`. A task moved to another stage keeps its id, so this key
100
+ * finds it where the owner key (`task:<stage id>:<task id>`) does not.
101
+ */
102
+ function elementKey(owner) {
103
+ const parts = owner.split(':');
104
+ return `${parts[0]}:${parts[parts.length - 1]}`;
105
+ }
106
+ /**
107
+ * The connector elements of a plan with no `"v2"` marker whose own context
108
+ * carries the V2 row, by {@link elementKey}: the Designer reads that row
109
+ * before the marker, so decompile records them (`connectorConfigV2`).
110
+ */
111
+ export function elementConfigV2Owners(plan) {
112
+ if (plan?.metadata?.[INTSVC_ACTIVITY_CONFIG] === 'v2')
113
+ return [];
114
+ return caseConnectorOwners(plan).filter(({ bag }) => hasV2Row(bag?.context)).map(({ key }) => elementKey(key));
115
+ }
116
+ /**
117
+ * For a plan whose settled marker is not `"v2"` (see `applyPreservation`):
118
+ * each connector element keeps the V2 row only when the saved plan had it on
119
+ * that element (`keep`, the `connectorConfigV2` element keys). The others lose
120
+ * it, and a kept one that lacks it gets it back, last in its context.
121
+ */
122
+ export function unstampConnectorConfigVersion(result, keep = []) {
123
+ const kept = new Set(keep);
124
+ for (const { key, bag } of caseConnectorOwners(result)) {
125
+ const context = bag?.context;
126
+ if (!Array.isArray(context))
127
+ continue;
128
+ if (kept.has(elementKey(key))) {
129
+ if (!hasV2Row(context))
130
+ context.push({ ...V2_CONFIG_ROW });
131
+ continue;
132
+ }
133
+ const at = context.findIndex((row) => row?.name === V2_CONFIG_ROW.name && row?.value === V2_CONFIG_ROW.value);
134
+ if (at >= 0)
135
+ context.splice(at, 1);
136
+ }
137
+ }
@@ -385,7 +385,8 @@ export interface CaseJsonPreservation {
385
385
  omitInputDefaults?: string[];
386
386
  /**
387
387
  * Metadata keys the serializer always writes that the source document did not
388
- * carry (only `caseAppEnabled`, `caseIdentifierType`, `publishVersion`).
388
+ * carry (only `caseAppEnabled`, `caseIdentifierType`, `publishVersion`,
389
+ * `intsvcActivityConfig`).
389
390
  * Compile drops such a key while it still holds what the platform reads for
390
391
  * an absent one: the Case Designer's in-memory to canvas converter fills
391
392
  * `caseAppEnabled ?? true` and `caseIdentifierType ?? "constant"`, and
@@ -437,6 +438,14 @@ export interface CaseJsonPreservation {
437
438
  * (`case/connector-saved-context.ts`).
438
439
  */
439
440
  connectorContexts?: PreservedConnectorContext[];
441
+ /**
442
+ * The connector elements (`task:<task id>`, `rule:<rule id>` or
443
+ * `trigger:<node id>`, with no stage, so a task moved to another stage still
444
+ * matches) whose own context said `activityConfigurationVersion: v2` in a plan with no
445
+ * `intsvcActivityConfig: "v2"` marker. The Designer reads that row before the
446
+ * marker, so compile writes it back on them (`case/intsvc-activity-config.ts`).
447
+ */
448
+ connectorConfigV2?: string[];
440
449
  /**
441
450
  * Each Designer-saved connector element's own io rows (an event trigger, a
442
451
  * wait-for-connector task or rule, a connector activity task): its request
@@ -645,7 +654,7 @@ export declare function caseJsonPreservation(built: BuiltCase): CaseJsonPreserva
645
654
  export declare function preservedBindings(bindings: Bindings | undefined, payload: CaseJsonPreservation | undefined): Bindings | undefined;
646
655
  export declare function preservedBindings(bindings: BindingsView | undefined, payload: CaseJsonPreservation | undefined): BindingsView | undefined;
647
656
  /** A metadata key whose absence {@link CaseJsonPreservation.omitMetadata} records. */
648
- export type PreservedMetadataKey = 'caseAppEnabled' | 'caseIdentifierType' | 'publishVersion';
657
+ export type PreservedMetadataKey = 'caseAppEnabled' | 'caseIdentifierType' | 'publishVersion' | 'intsvcActivityConfig';
649
658
  /**
650
659
  * @internal
651
660
  * What the platform reads for each {@link PreservedMetadataKey} the document
@@ -184,6 +184,10 @@ export const METADATA_ABSENT_READING = {
184
184
  caseAppEnabled: true,
185
185
  caseIdentifierType: 'constant',
186
186
  publishVersion: undefined,
187
+ // Absent reads as the older V1 Integration Service configuration, and compile
188
+ // writes "v2" on a new case (intsvc-activity-config.ts): a plan saved with
189
+ // none keeps none.
190
+ intsvcActivityConfig: undefined,
187
191
  };
188
192
  const TOP_LEVEL_KEYS = new Set([
189
193
  'id', 'name', 'description', 'version', 'bindings', 'variables', 'metadata', 'nodes', 'edges', 'layout',
@@ -272,6 +276,9 @@ export function caseJsonPreservationErrors(payload) {
272
276
  errors.push('preserved publishVersion must be a number');
273
277
  if (payload.publishVersion !== undefined && payload.omitMetadata?.includes('publishVersion'))
274
278
  errors.push('preserved publishVersion cannot also be recorded as omitted');
279
+ if (payload.metadata !== undefined && Object.prototype.hasOwnProperty.call(payload.metadata, 'intsvcActivityConfig')
280
+ && payload.omitMetadata?.includes('intsvcActivityConfig'))
281
+ errors.push('preserved metadata.intsvcActivityConfig cannot also be recorded as omitted: keep the value, or the omitMetadata entry, not both');
275
282
  for (const name of Object.keys(payload.caseAppConfigFields?.fields ?? {}))
276
283
  if (!PRESERVED_CASE_APP_CONFIG_KEYS.has(name))
277
284
  errors.push(`caseAppConfig field "${name}" is not an allowed preserved platform field`);
@@ -474,6 +481,9 @@ export function caseJsonPreservationErrors(payload) {
474
481
  errors.push(`preserved http-request metadata of task "${entry?.task}" must be an object`);
475
482
  }
476
483
  errors.push(...connectorContextErrors(payload.connectorContexts));
484
+ if (payload.connectorConfigV2 !== undefined
485
+ && (!Array.isArray(payload.connectorConfigV2) || payload.connectorConfigV2.some((key) => typeof key !== 'string' || !key)))
486
+ errors.push('preserved connectorConfigV2 must be a list of connector element keys (task:<id>, rule:<id> or trigger:<id>)');
477
487
  errors.push(...connectorRowErrors(payload.connectorRows));
478
488
  for (const index of payload.manualTriggerServiceTypeNone ?? [])
479
489
  if (!Number.isInteger(index) || index < 0)
@@ -62,7 +62,7 @@ export interface CaseSerializeOpts {
62
62
  }
63
63
  /** A warning `serialize` reports through {@link CaseSerializeOpts.warn}. */
64
64
  export interface CaseSerializeWarning {
65
- code: 'CONNECTION_STUB' | 'SLA_PIN_DROPPED';
65
+ code: 'CONNECTION_STUB' | 'SLA_PIN_DROPPED' | 'CONNECTOR_CONFIG_V2_DEFAULT';
66
66
  message: string;
67
67
  }
68
68
  /**
@@ -26,6 +26,7 @@ import { CASE_FILTER_SPELLING, caseSubscriptionBody, caseSubscriptionOwners, res
26
26
  import { dedupeConditionNames } from './rule-names.js';
27
27
  import { EXTERNAL_TASK_DESCRIPTOR_CONTRACT, externalDescriptorRefusal, externalExecution, externalServiceType, } from './external.js';
28
28
  import { CASE_FORMAT_PROFILE, CASE_SCHEMA_VERSIONS, caseVersionMismatch } from './format-profile.js';
29
+ import { defaultIntsvcActivityConfig, INTSVC_ACTIVITY_CONFIG, stampConnectorConfigVersion, unstampConnectorConfigVersion } from './intsvc-activity-config.js';
29
30
  import { isInSolutionKey, isResourceLabelRefusal, resolveResourceRef, resourceIdentity, SOLUTION_FOLDER } from './resource-identity.js';
30
31
  import { bindingRefId, readBindingIds, resourceBindingOf, resourceBindingRow, resourceBindingSeed, savedResourceWire, typedFolder, } from './resource-wire.js';
31
32
  import { ownEntry } from '../core/own-entry.js';
@@ -430,7 +431,11 @@ function serializeCase(built, opts) {
430
431
  };
431
432
  ELEMENT_SEEDED_IDS.set(result, resolver.elementSeededIds);
432
433
  WRITTEN_SUBSCRIPTIONS.set(result, resolver.subscriptions);
433
- const plan = stampConnectorConfigVersion(applyAuthorLayout(applyPreservation(result, caseJsonPreservation(built), opts.warn ? { warn: opts.warn } : {}), built.layout));
434
+ const preservation = caseJsonPreservation(built);
435
+ const plan = applyAuthorLayout(applyPreservation(result, preservation, opts.warn ? { warn: opts.warn } : {}), built.layout);
436
+ // After preservation, which carries a saved marker or its saved absence.
437
+ defaultIntsvcActivityConfig(plan, preservation, opts.warn);
438
+ stampConnectorConfigVersion(plan);
434
439
  // Last, over the finished document: V32 requires case-unique condition names,
435
440
  // and an author (or a decompiled pre-V32 plan) can repeat one. Rename the
436
441
  // repeats the way the platform's V31/V32.0.1 migrations would, so the file is
@@ -476,48 +481,6 @@ function lowerPlanTaskOutputRefs(plan) {
476
481
  };
477
482
  walk(plan);
478
483
  }
479
- /** The task types whose `data.context[]` carries an Integration Service activity configuration. */
480
- const CONNECTOR_CONFIG_TASK_TYPES = new Set([
481
- 'execute-connector-activity',
482
- 'wait-for-connector',
483
- 'external-agent',
484
- 'external-workflow',
485
- ]);
486
- const V2_CONFIG_ROW = { name: 'activityConfigurationVersion', value: 'v2', type: 'string' };
487
- /**
488
- * Flagged-V2 plans: mark each connector task's and event trigger's context
489
- * `activityConfigurationVersion: v2`, as the Designer and CLI do. Runs
490
- * post-preservation because the flag is preserved metadata.
491
- *
492
- * Only a context bound to a connection is marked. A placeholder bag
493
- * (`connectorKey` + `operation`, or a trigger's lone `objectName`) has no
494
- * configuration panel to pick. A context that already carries the row keeps it.
495
- */
496
- function stampConnectorConfigVersion(result) {
497
- const metadata = result.metadata;
498
- if (metadata?.intsvcActivityConfig !== 'v2')
499
- return result;
500
- const stamp = (context) => {
501
- if (!Array.isArray(context))
502
- return;
503
- if (!context.some((row) => row?.name === 'connection'))
504
- return;
505
- if (context.some((row) => row?.name === V2_CONFIG_ROW.name))
506
- return;
507
- context.push({ ...V2_CONFIG_ROW });
508
- };
509
- for (const node of result.nodes ?? []) {
510
- if (node?.type === 'case-management:Trigger' || node?.type === 'uipath.case.trigger')
511
- stamp(node.data?.[CASE_FORMAT_PROFILE.triggerBagField]?.context);
512
- for (const lane of node?.data?.tasks ?? []) {
513
- for (const task of Array.isArray(lane) ? lane : []) {
514
- if (CONNECTOR_CONFIG_TASK_TYPES.has(task?.type))
515
- stamp(task.data?.context);
516
- }
517
- }
518
- }
519
- return result;
520
- }
521
484
  export { CASE_NODE_LAYOUT_FIELDS };
522
485
  /**
523
486
  * Resolve author-level layout names only after preservation has restored foreign
@@ -602,6 +565,11 @@ export function applyPreservation(result, preservation, options = {}) {
602
565
  if (absent === undefined || metadata[name] === absent)
603
566
  delete metadata[name];
604
567
  }
568
+ // The V2 context rows follow the settled marker. `mergeCase` lays this over
569
+ // a plan compile already stamped, so when the original has no marker the rows
570
+ // go too, except on the elements that carried their own (`connectorConfigV2`).
571
+ if (metadata[INTSVC_ACTIVITY_CONFIG] !== 'v2')
572
+ unstampConnectorConfigVersion(result, preservation.connectorConfigV2);
605
573
  const caseAppConfig = result.metadata.caseAppConfig;
606
574
  if (caseAppConfig && preservation.caseAppConfigFields) {
607
575
  for (const [field, value] of Object.entries(preservation.caseAppConfigFields.fields ?? {})) {
@@ -71,6 +71,20 @@ export declare function agentInputPlan(inputs: Record<string, unknown>, render:
71
71
  flatName: string;
72
72
  binding: string;
73
73
  }>): AgentInputPlan;
74
+ /**
75
+ * Render an agent prompt for the SIDECAR — the author's placeholders rewritten to
76
+ * the names the runtime will actually have.
77
+ *
78
+ * The three cases mirror {@link AgentInputBinding}; the fourth (a placeholder
79
+ * naming nothing `inputs` declares) is left ALONE rather than deleted, exactly as
80
+ * the node's renderer leaves it, so it reaches the model as visible literal text
81
+ * and `check`'s `INLINE_AGENT_UNDECLARED_PLACEHOLDER` can name it.
82
+ *
83
+ * `contentTokens` is NOT rewritten separately — {@link promptTokens} runs over the
84
+ * rewritten string, so the designer's chips and the runtime's template can't
85
+ * disagree about a name.
86
+ */
87
+ export declare function renderAgentSidecarPrompt(template: string, plan: Map<string, AgentInputBinding>): string;
74
88
  /**
75
89
  * The `agent.json` sidecar for a text CONVERSATIONAL agent.
76
90
  *
@@ -155,16 +169,36 @@ export declare function inlineAgentJson(spec: {
155
169
  /** The agent's display name (the step's label). */
156
170
  name: string;
157
171
  }): any;
172
+ /**
173
+ * The text of a query compile reads `{{input.<name>}}` tokens in: a string that
174
+ * is not an expression, or the `prompt` of a `{ prompt }` task. Undefined for
175
+ * every other query.
176
+ */
177
+ export declare function queryPromptText(query: unknown): string | undefined;
158
178
  /**
159
179
  * The input names an agent's prompts reference as `{{input.<name>}}`, system
160
- * prompt first, in order (repeats kept). Both prompts are searched, because
161
- * flow-v1's pre-pass scans both. For instance `{ systemPrompt: 'Use {{input.a}}',
180
+ * prompt first, in order (repeats kept), then its context queries and its
181
+ * built-in tools' task prompts. Both prompts are searched, because flow-v1's
182
+ * pre-pass scans both. For instance `{ systemPrompt: 'Use {{input.a}}',
162
183
  * userPrompt: '{{input.b}} and {{input.a}}' }` gives `['a', 'b', 'a']`.
163
184
  */
164
185
  export declare function promptPlaceholders(s: {
165
186
  systemPrompt?: unknown;
166
187
  userPrompt?: unknown;
188
+ context?: unknown;
189
+ tools?: unknown;
167
190
  }): string[];
191
+ /**
192
+ * The nested `{{input.<a>.<b>}}` tokens in the same texts `promptPlaceholders` reads, repeats dropped.
193
+ * A token whose head `isFlatName` accepts is left out: the head is already an input's flat name,
194
+ * which conversion resolves.
195
+ */
196
+ export declare function nestedPlaceholders(s: {
197
+ systemPrompt?: unknown;
198
+ userPrompt?: unknown;
199
+ context?: unknown;
200
+ tools?: unknown;
201
+ }, isFlatName?: (head: string) => boolean): string[];
168
202
  /** Which writer produced an `agent.json`: the inline, conversational or voice agent's. */
169
203
  export type AgentSidecarDialect = 'inline' | 'conversational' | 'voice';
170
204
  /**
@@ -83,7 +83,7 @@ export function agentInputPlan(inputs, render, toolRefs = []) {
83
83
  * rewritten string, so the designer's chips and the runtime's template can't
84
84
  * disagree about a name.
85
85
  */
86
- function renderAgentSidecarPrompt(template, plan) {
86
+ export function renderAgentSidecarPrompt(template, plan) {
87
87
  return template.replace(INPUT_PLACEHOLDER, (whole, name) => {
88
88
  const b = plan.get(name);
89
89
  if (!b)
@@ -284,15 +284,45 @@ export function inlineAgentJson(spec) {
284
284
  }
285
285
  /** `{{input.<name>}}` — the agent-template placeholder, in both prompt directions. */
286
286
  const INPUT_PLACEHOLDER = /\{\{\s*input\.([A-Za-z_$][A-Za-z0-9_$]*)\s*\}\}/g;
287
+ /**
288
+ * The text of a query compile reads `{{input.<name>}}` tokens in: a string that
289
+ * is not an expression, or the `prompt` of a `{ prompt }` task. Undefined for
290
+ * every other query.
291
+ */
292
+ export function queryPromptText(query) {
293
+ const text = typeof query === 'object' && query !== null && Object.keys(query).join() === 'prompt'
294
+ && Object.getPrototypeOf(query) === Object.prototype ? query.prompt : query;
295
+ return typeof text === 'string' && !text.startsWith('=js:') ? text : undefined;
296
+ }
287
297
  /**
288
298
  * The input names an agent's prompts reference as `{{input.<name>}}`, system
289
- * prompt first, in order (repeats kept). Both prompts are searched, because
290
- * flow-v1's pre-pass scans both. For instance `{ systemPrompt: 'Use {{input.a}}',
299
+ * prompt first, in order (repeats kept), then its context queries and its
300
+ * built-in tools' task prompts. Both prompts are searched, because flow-v1's
301
+ * pre-pass scans both. For instance `{ systemPrompt: 'Use {{input.a}}',
291
302
  * userPrompt: '{{input.b}} and {{input.a}}' }` gives `['a', 'b', 'a']`.
292
303
  */
293
304
  export function promptPlaceholders(s) {
294
- const prompts = `${String(s.systemPrompt ?? '')}\n${String(s.userPrompt ?? '')}`;
295
- return [...prompts.matchAll(INPUT_PLACEHOLDER)].map((m) => m[1]);
305
+ return [...placeholderText(s).matchAll(INPUT_PLACEHOLDER)].map((m) => m[1]);
306
+ }
307
+ /** `{{input.<a>.<b>}}`: a token with a selector tail, which neither compile nor lowering resolves. */
308
+ const NESTED_INPUT_PLACEHOLDER = /\{\{\s*input\.([A-Za-z_$][A-Za-z0-9_$]*)(?:\.[A-Za-z_$][A-Za-z0-9_$]*)+\s*\}\}/g;
309
+ /**
310
+ * The nested `{{input.<a>.<b>}}` tokens in the same texts `promptPlaceholders` reads, repeats dropped.
311
+ * A token whose head `isFlatName` accepts is left out: the head is already an input's flat name,
312
+ * which conversion resolves.
313
+ */
314
+ export function nestedPlaceholders(s, isFlatName = () => false) {
315
+ const tokens = [...placeholderText(s).matchAll(NESTED_INPUT_PLACEHOLDER)]
316
+ .filter((m) => !isFlatName(m[1])).map((m) => m[0]);
317
+ return [...new Set(tokens)];
318
+ }
319
+ function placeholderText(s) {
320
+ const list = (v) => (v === undefined ? [] : Array.isArray(v) ? v : [v]).filter((x) => typeof x === 'object' && x !== null);
321
+ const queries = [
322
+ ...list(s.context).map((c) => (typeof c.query === 'string' ? queryPromptText(c.query) : undefined)),
323
+ ...list(s.tools).filter((t) => t.kind === 'builtin').map((t) => queryPromptText(t.query)),
324
+ ];
325
+ return [String(s.systemPrompt ?? ''), String(s.userPrompt ?? ''), ...queries].join('\n');
296
326
  }
297
327
  /**
298
328
  * Split an agent prompt into the `contentTokens` the designer renders it from.
@@ -226,6 +226,7 @@ export declare const REFUSALS: {
226
226
  readonly CONNECTION_BINDING_NOT_GUID: "lint";
227
227
  readonly CONNECTION_CONNECTOR_CONFLICT: "draft";
228
228
  readonly CONNECTION_STUB: "lint";
229
+ readonly CONNECTOR_CONFIG_V2_DEFAULT: "lint";
229
230
  readonly CONNECTOR_IMPORT_NOT_A_FILE: "lowering";
230
231
  readonly CONNECTOR_INPUT: "lowering";
231
232
  readonly CONNECTOR_INPUTS_SHADOWED: "lowering";
@@ -532,6 +533,7 @@ export declare const REFUSALS: {
532
533
  readonly FLOW_AGENT_TOOL_NO_RESOURCE_ID: "lint";
533
534
  readonly FLOW_AGENT_TOOL_UNKNOWN_BUILTIN: "lowering";
534
535
  readonly FLOW_AGENT_TOOL_UNKNOWN_KIND: "lowering";
536
+ readonly INLINE_AGENT_NESTED_PLACEHOLDER: "lint";
535
537
  readonly INLINE_AGENT_UNDECLARED_PLACEHOLDER: "lint";
536
538
  readonly INLINE_AGENT_UNREFERENCED_INPUT: "lint";
537
539
  readonly IN_SOLUTION_KEY_MISMATCH: "lowering";
@@ -300,6 +300,7 @@ export const REFUSALS = {
300
300
  CONNECTION_BINDING_NOT_GUID: 'lint',
301
301
  CONNECTION_CONNECTOR_CONFLICT: 'draft',
302
302
  CONNECTION_STUB: 'lint',
303
+ CONNECTOR_CONFIG_V2_DEFAULT: 'lint',
303
304
  CONNECTOR_IMPORT_NOT_A_FILE: 'lowering',
304
305
  CONNECTOR_INPUT: 'lowering',
305
306
  CONNECTOR_INPUTS_SHADOWED: 'lowering',
@@ -608,6 +609,7 @@ export const REFUSALS = {
608
609
  FLOW_AGENT_TOOL_NO_RESOURCE_ID: 'lint',
609
610
  FLOW_AGENT_TOOL_UNKNOWN_BUILTIN: 'lowering',
610
611
  FLOW_AGENT_TOOL_UNKNOWN_KIND: 'lowering',
612
+ INLINE_AGENT_NESTED_PLACEHOLDER: 'lint',
611
613
  INLINE_AGENT_UNDECLARED_PLACEHOLDER: 'lint',
612
614
  INLINE_AGENT_UNREFERENCED_INPUT: 'lint',
613
615
  IN_SOLUTION_KEY_MISMATCH: 'lowering',
@@ -13,6 +13,8 @@ export interface LiftedBatchTransform {
13
13
  entries: Array<[string, string | Printed | undefined]>;
14
14
  /** The resource directory the node names (`inputs.source`, else `inputs.id`), to keep as the tool's `source`. */
15
15
  dir: string | undefined;
16
+ /** The task's Prompt text as lifted, which a `{{input.<name>}}` token in it reads an agent input from. */
17
+ prompt: string | undefined;
16
18
  }
17
19
  /**
18
20
  * The Batch Transform tool node `t` on agent `agent`, as its `tools` entry's
@@ -102,6 +102,7 @@ export function liftBatchTransformTool(agent, t, ctx, variable) {
102
102
  ? tsLiteral(description) : undefined;
103
103
  // The task.
104
104
  let querySrc;
105
+ let promptText;
105
106
  const query = pick('query');
106
107
  if (query !== undefined) {
107
108
  const read = query.from === 'node' ? nodeQuery(query.value) : sidecarQuery(query.value);
@@ -110,6 +111,7 @@ export function liftBatchTransformTool(agent, t, ctx, variable) {
110
111
  else if (read.kind === 'prompt') {
111
112
  // A bare `=js:` string compiles as a static query (D3), so a Prompt with
112
113
  // that prefix keeps its `{ prompt }` tag.
114
+ promptText = read.text;
113
115
  querySrc = read.text === '' ? undefined
114
116
  : read.text.startsWith('=js:') ? objLit([['prompt', tsLiteral(read.text)]]) : tsLiteral(read.text);
115
117
  }
@@ -188,6 +190,7 @@ export function liftBatchTransformTool(agent, t, ctx, variable) {
188
190
  ['webSearchGrounding', groundingSrc],
189
191
  ],
190
192
  dir,
193
+ prompt: promptText,
191
194
  };
192
195
  }
193
196
  /** The node's mode-tagged `query` (or a pre-1.2 bare string); undefined when it is neither. */
@@ -69,6 +69,15 @@ export declare function jsonTextDirective(text: string, returnKeys?: readonly st
69
69
  * one string field. See {@link jsonTextDirective}.
70
70
  */
71
71
  export declare function checkInlineAgent(inputs: InlineAgentInputs | undefined, ctx: FlowCheckContext): void;
72
+ /**
73
+ * `{{input.<a>.<b>}}` is not rewritten, so conversion reads `<a>` as a global that
74
+ * does not exist and throws. A head that is already an input's flat name resolves.
75
+ */
76
+ export declare function checkNestedPlaceholders(inputs: (AgentResources & {
77
+ inputs?: Record<string, unknown>;
78
+ systemPrompt?: unknown;
79
+ userPrompt?: unknown;
80
+ }) | undefined, ctx: FlowCheckContext, who: AgentKindLabel): void;
72
81
  /**
73
82
  * The resource rules an agent's `context`, `tools` and `escalation` share,
74
83
  * whichever agent attaches them: the inline agent, and the voice and
@@ -1,7 +1,7 @@
1
1
  import { agentInputRef } from '../../../core/agent-sidecar.js';
2
2
  import { Expr } from '../../../core/expr.js';
3
3
  import { GUID_RE } from '../../../core/binding-messages.js';
4
- import { promptPlaceholders } from '../../../core/agent-sidecar.js';
4
+ import { nestedPlaceholders, promptPlaceholders } from '../../../core/agent-sidecar.js';
5
5
  import { prepareCommand } from '../../../core/cli-spelling.js';
6
6
  import { nearestName } from '../../../core/edit-distance.js';
7
7
  import { FLAT_SEP, flatNameSegmentsOf } from '../../../core/expr.js';
@@ -75,6 +75,7 @@ export const AGENT_DIAGNOSTICS = {
75
75
  FLOW_AGENT_TOOL_NO_RESOURCE_ID: { severity: 'error', summary: 'a process tool with no name or folderPath' },
76
76
  FLOW_AGENT_TOOL_UNKNOWN_BUILTIN: { severity: 'error', summary: 'a builtin tool that is not one of the three' },
77
77
  FLOW_AGENT_TOOL_UNKNOWN_KIND: { severity: 'error', summary: 'a tool of an unknown kind' },
78
+ INLINE_AGENT_NESTED_PLACEHOLDER: { severity: 'error', summary: 'a prompt placeholder with a selector tail, like {{input.a.b}}' },
78
79
  INLINE_AGENT_UNDECLARED_PLACEHOLDER: { severity: 'error', summary: 'a prompt placeholder naming no declared input' },
79
80
  INLINE_AGENT_UNREFERENCED_INPUT: { severity: 'warning', summary: 'an inline agent input no prompt references' },
80
81
  VOICE_AGENT_ITERATIONS: { severity: 'error', summary: 'a voice agent whose maxIterations is outside 1 to 8' },
@@ -634,21 +635,21 @@ export function checkInlineAgent(inputs, ctx) {
634
635
  const unreferenced = declaredInputs.filter((k) => !placeholders.includes(k) && !boundForTool(k));
635
636
  if (declaredInputs.length && unreferenced.length === declaredInputs.length) {
636
637
  warn('INLINE_AGENT_UNREFERENCED_INPUT', `Inline agent step "${step}" declares input(s) ${unreferenced.map((u) => `\`${u}\``).join(', ')} that `
637
- + `neither prompt references as \`{{input.<name>}}\` and no tool argument or tool's task binds as its \`variable\` — so `
638
+ + `no prompt, context query or built-in task references as \`{{input.<name>}}\` and no tool argument or tool's task binds as its \`variable\` — so `
638
639
  + `NONE of them is referenced. Deployed, the `
639
640
  + `authored list is not necessarily what the platform sends: flow-v1's `
640
641
  + `\`preDeriveAgentInputDefinitions\` pre-pass builds the input list by scanning the node's prompts for `
641
642
  + `variable references, merges what it finds with the authored list, and DROPS an entry no reference `
642
643
  + `points at when its caller asks for pruning. A referenced input survives every path; an unreferenced `
643
644
  + `one survives only some, and the failure mode is an agent that arrives with no arguments at all. `
644
- + `Write \`{{input.${declaredInputs[0]}}}\` in a prompt — which is also how the agent gets told what it `
645
+ + `Write \`{{input.${declaredInputs[0]}}}\` in a prompt, context query or built-in task — which is also how the agent gets told what it `
645
646
  + `is looking at.`);
646
647
  }
647
648
  else if (unreferenced.length) {
648
649
  warn('INLINE_AGENT_UNREFERENCED_INPUT', `Inline agent step "${step}" declares input(s) ${unreferenced.map((u) => `\`${u}\``).join(', ')} that `
649
- + `neither prompt references as \`{{input.<name>}}\` and no tool argument or tool's task binds as its \`variable\`. `
650
+ + `no prompt, context query or built-in task references as \`{{input.<name>}}\` and no tool argument or tool's task binds as its \`variable\`. `
650
651
  + `The platform may prune an unreferenced input, so `
651
- + `it is not reliably sent — and an input the prompts never mention is one the agent cannot use anyway.`);
652
+ + `it is not reliably sent — and an input none of them mentions is one the agent cannot use anyway.`);
652
653
  }
653
654
  // Direction 2: a placeholder naming an input that does not exist. The compiler
654
655
  // leaves it alone rather than deleting it, so it reaches the model as the literal
@@ -656,12 +657,13 @@ export function checkInlineAgent(inputs, ctx) {
656
657
  const undeclared = [...new Set(placeholders.filter((p) => !declaredInputs.includes(p)))];
657
658
  if (undeclared.length) {
658
659
  at('INLINE_AGENT_UNDECLARED_PLACEHOLDER', `Inline agent step "${step}" references ${undeclared.map((u) => `\`{{input.${u}}}\``).join(', ')} in a `
659
- + `prompt, but \`inputs\` declares ${declaredInputs.length ? declaredInputs.map((d) => `\`${d}\``).join(', ') : 'nothing'}. `
660
+ + `prompt, context query or built-in task, but \`inputs\` declares ${declaredInputs.length ? declaredInputs.map((d) => `\`${d}\``).join(', ') : 'nothing'}. `
660
661
  + `An unmatched placeholder is not substituted — it reaches the model as that literal text, and the `
661
662
  + `value it was meant to carry never arrives.`, declaredInputs.length
662
663
  ? `inputs: { ${undeclared[0]}: input('${undeclared[0]}'), … }`
663
664
  : `inputs: { ${undeclared[0]}: input('${undeclared[0]}') }`);
664
665
  }
666
+ checkNestedPlaceholders(inputs, ctx, 'Inline agent');
665
667
  // Direction 3, an input bound to a COMPUTED EXPRESSION that a prompt
666
668
  // references, is the serializer's INLINE_AGENT_COMPOSITE_INPUT
667
669
  // (`compositeInputRefusal`, inline-agent.ts): the binding has no argument
@@ -744,6 +746,20 @@ export function checkInlineAgent(inputs, ctx) {
744
746
  }
745
747
  checkAgentResources(inputs, ctx, 'Inline agent');
746
748
  }
749
+ /**
750
+ * `{{input.<a>.<b>}}` is not rewritten, so conversion reads `<a>` as a global that
751
+ * does not exist and throws. A head that is already an input's flat name resolves.
752
+ */
753
+ export function checkNestedPlaceholders(inputs, ctx, who) {
754
+ const declared = inputs?.inputs ?? {};
755
+ const isFlatName = (head) => agentInputRef(rendered(declared[head]))?.flatName === head;
756
+ const nested = nestedPlaceholders(inputs ?? {}, isFlatName);
757
+ if (nested.length === 0)
758
+ return;
759
+ ctx.report('INLINE_AGENT_NESTED_PLACEHOLDER', `${who} step "${ctx.step}" references ${nested.map((n) => `\`${n}\``).join(', ')} in a `
760
+ + `prompt, context query or built-in task. A placeholder takes an input name only, so a selector tail `
761
+ + `is not rewritten, and converting the flow to BPMN throws on it.`, `declare the field as its own input and write \`{{input.<name>}}\``);
762
+ }
747
763
  /**
748
764
  * The resource rules an agent's `context`, `tools` and `escalation` share,
749
765
  * whichever agent attaches them: the inline agent, and the voice and
@@ -68,6 +68,7 @@ export declare function liftAgentResources(node: FlowNode, ctx: FlowDeserializeC
68
68
  escalation: string | undefined;
69
69
  memory: string | undefined;
70
70
  toolVariables: ToolVariable[];
71
+ queryTexts: string[];
71
72
  };
72
73
  export declare function printInlineAgent(spec: LiftedInlineAgent, ctx: FlowPrintContext): {
73
74
  factory: string;
@@ -185,7 +185,7 @@ const CONTEXT_SETTINGS_KEYS = new Set([
185
185
  * a warning, or an error under `--strict`. Compile would write the SDK's
186
186
  * value instead, so it is never dropped silently.
187
187
  */
188
- function contextIndexSettings(agent, c, sidecar, ctx) {
188
+ function contextIndexSettings(agent, c, sidecar, ctx, queryTexts) {
189
189
  const settings = sidecar?.settings && typeof sidecar.settings === 'object' && !Array.isArray(sidecar.settings)
190
190
  ? sidecar.settings : undefined;
191
191
  const ni = (c.inputs ?? {});
@@ -238,8 +238,10 @@ function contextIndexSettings(agent, c, sidecar, ctx) {
238
238
  })();
239
239
  const query = sidecarQuery ?? nodeQuery;
240
240
  let querySrc;
241
- if (query?.kind === 'prompt' && query.text !== '')
241
+ if (query?.kind === 'prompt' && query.text !== '') {
242
242
  querySrc = tsLiteral(query.text);
243
+ queryTexts.push(query.text);
244
+ }
243
245
  else if (query?.kind === 'text' && query.text.startsWith('=js:'))
244
246
  querySrc = tsLiteral(query.text);
245
247
  else if (query?.kind === 'text' && query.text !== '')
@@ -636,7 +638,9 @@ export function liftInlineAgent(node, ctx) {
636
638
  // would; otherwise every input is printed, and a tool reference one of them
637
639
  // binds is still one input, `refs` being deduped by flat name.
638
640
  const prompt = (p) => (plain(p) === undefined ? undefined : unrender(plain(p)));
639
- const placeholders = new Set(promptPlaceholders({ systemPrompt: prompt(i.systemPrompt), userPrompt: prompt(i.userPrompt) }));
641
+ const placeholders = new Set(promptPlaceholders({
642
+ systemPrompt: prompt(i.systemPrompt), userPrompt: prompt(i.userPrompt), context: resources.queryTexts.map((query) => ({ query })),
643
+ }));
640
644
  const toolOnly = new Set(toolVariables.map((v) => v.id).filter((id) => !placeholders.has(id)));
641
645
  /** The flat names compile plans from `declared` and the tools' references, deduped as `agentInputPlan` does. */
642
646
  const planned = (declared) => JSON.stringify([...new Set([
@@ -742,6 +746,8 @@ export function liftAgentResources(node, ctx, withMemory, agentInputs = []) {
742
746
  };
743
747
  /** The agent inputs the tools' Variables bind (a process tool's arguments, a built-in's task), in tool and argument order. */
744
748
  const toolVariables = [];
749
+ /** The query texts the agent's context indexes and batch transform tools lift, which can hold `{{input.<name>}}` tokens. */
750
+ const queryTexts = [];
745
751
  /**
746
752
  * A built-in tool's task Variable, as the reference of the agent input it
747
753
  * names: by its `{{<flatName>}}` in the sidecar, by `$agent.<flatName>`, or by
@@ -815,7 +821,9 @@ export function liftAgentResources(node, ctx, withMemory, agentInputs = []) {
815
821
  // docs/INLINE_AGENT_BATCH_TRANSFORM_DESIGN.md). The directory is the node's
816
822
  // `source`, or the canvas's `inputs.id` when `source` is empty or a file
817
823
  // binding: kept as the tool's `source`, so a recompile writes back into it.
818
- const { entries, dir } = liftBatchTransformTool(node, t, ctx, taskVariable);
824
+ const { entries, dir, prompt } = liftBatchTransformTool(node, t, ctx, taskVariable);
825
+ if (prompt !== undefined)
826
+ queryTexts.push(prompt);
819
827
  const derived = derivedToolSource(ctx.flowId, node.id, { kind: 'builtin', tool: 'batchtransform' });
820
828
  const all = [
821
829
  ...entries,
@@ -889,7 +897,7 @@ export function liftAgentResources(node, ctx, withMemory, agentInputs = []) {
889
897
  ['folderPath', folderPath !== undefined ? tsLiteral(folderPath) : undefined],
890
898
  ['folderKey', rPlain(c, 'folderKey') !== undefined ? tsLiteral(rPlain(c, 'folderKey')) : undefined],
891
899
  // `query` and the retrieval settings, from resource.json or the node (#1183).
892
- ...contextIndexSettings(node, c, sidecar, ctx),
900
+ ...contextIndexSettings(node, c, sidecar, ctx, queryTexts),
893
901
  ['label', label !== undefined ? tsLiteral(label) : undefined],
894
902
  ...placement(c, derivedContextSource(ctx.flowId, node.id, id)),
895
903
  ]);
@@ -968,7 +976,7 @@ export function liftAgentResources(node, ctx, withMemory, agentInputs = []) {
968
976
  const tools = !toolSrc.length ? undefined
969
977
  : toolSrc.every((x) => typeof x === 'string') ? list(toolSrc)
970
978
  : (print) => `[${toolSrc.map((x) => (typeof x === 'function' ? x(print) : x)).join(', ')}]`;
971
- return { context: list(contextSrc), tools, escalation: list(escalationSrc), memory: memorySrc, toolVariables };
979
+ return { context: list(contextSrc), tools, escalation: list(escalationSrc), memory: memorySrc, toolVariables, queryTexts };
972
980
  }
973
981
  export function printInlineAgent(spec, ctx) {
974
982
  const { inputRows, options } = spec.inputs;
@@ -7,6 +7,7 @@
7
7
  * definitions, bindings and files unchanged.
8
8
  */
9
9
  import type { AgentResources, InlineAgentInputs } from './spec.js';
10
+ import { type AgentInputBinding } from '../../../core/agent-sidecar.js';
10
11
  import { toolVariableRefs } from '../../../core/tool-argument.js';
11
12
  import type { FlowNodeContribution, FlowSerializeContext } from '../../../flow-node-type.js';
12
13
  import { CompileRefusal } from '../../../core/compile-refusal.js';
@@ -55,7 +56,7 @@ export declare function toolArguments(s: AgentResources, step: string, who: Agen
55
56
  */
56
57
  export declare function attachAgentResources(s: AgentResources, ctx: FlowSerializeContext, source: string, who: AgentKindLabel, toolVariables?: ReadonlyMap<object, Record<string, {
57
58
  flatName: string;
58
- }>>): {
59
+ }>>, inputs?: Map<string, AgentInputBinding>): {
59
60
  attach: Attached[];
60
61
  libraryRequired?: CompileRefusal;
61
62
  };
@@ -135,7 +135,7 @@ export function serializeInlineAgent(s, ctx) {
135
135
  // not exist yet: the `properties` object is filled in place when the scope
136
136
  // closes.
137
137
  ctx.typeAgentInputs(agentJson.inputSchema, plan.refs);
138
- const { attach, libraryRequired } = attachAgentResources(s, ctx, source, 'Inline agent', toolVariables);
138
+ const { attach, libraryRequired } = attachAgentResources(s, ctx, source, 'Inline agent', toolVariables, plan.byName);
139
139
  // MEMORY — one episodic-memory resource on the agent's `memory` handle (the
140
140
  // 1.4 definition selected above). Same artifact shape as context.
141
141
  if (s.memory !== undefined) {
@@ -275,7 +275,7 @@ function taskVariableRefusal(who, where, query, render) {
275
275
  * `toolVariables` holds each process tool's Variable arguments, already bound
276
276
  * to agent inputs by the caller's input plan (`toolVariableRefs`).
277
277
  */
278
- export function attachAgentResources(s, ctx, source, who, toolVariables = new Map()) {
278
+ export function attachAgentResources(s, ctx, source, who, toolVariables = new Map(), inputs) {
279
279
  const step = ctx.step;
280
280
  const render = (v) => ctx.render(v);
281
281
  const attach = [];
@@ -313,7 +313,7 @@ export function attachAgentResources(s, ctx, source, who, toolVariables = new Ma
313
313
  // platform validator says so in its own refusal text — *"the resource id
314
314
  // from the parent inline agent's `resources[]`"*.
315
315
  const contextResourceId = cx.source ?? derivedContextSource(ctx.flowId, step, cx.id);
316
- const contextQuery = renderContextQuery(cx.query, render);
316
+ const contextQuery = renderContextQuery(cx.query, render, inputs);
317
317
  // The index's own configuration; the platform's `inputDefaults` are the
318
318
  // shape a designer-placed node has, so an omitted option emits the
319
319
  // designer's value rather than nothing.
@@ -398,7 +398,7 @@ export function attachAgentResources(s, ctx, source, who, toolVariables = new Ma
398
398
  if (tr.description !== undefined)
399
399
  extraInputs.description = tr.description;
400
400
  if ('query' in extraInputs && tr.query !== undefined) {
401
- extraInputs.query = renderBuiltinToolQuery(tr.query, render);
401
+ extraInputs.query = renderBuiltinToolQuery(tr.query, render, inputs);
402
402
  }
403
403
  // batchtransform's columns and grounding, as the canvas's form writes them:
404
404
  // the rows as given, and the select's lowercase value (the resource
@@ -707,7 +707,7 @@ function unknownToolKind(step, kind, who) {
707
707
  + "'clientside', 'httpRequest'.");
708
708
  }
709
709
  /**
710
- * The refusal for an input bound to a COMPUTED EXPRESSION that a prompt references as
710
+ * The refusal for an input bound to a COMPUTED EXPRESSION that a prompt, context query or built-in task references as
711
711
  * `{{input.<name>}}` (#1518). The platform names each agent argument after the
712
712
  * reference path it is bound to (`agentInputPlan`), so an expression spanning
713
713
  * zero or several references gets no argument: writing the flow anyway would
@@ -725,7 +725,7 @@ function compositeInputRefusal(s, byName, step) {
725
725
  continue;
726
726
  const js = val instanceof Expr ? val.js : String(val).replace(/^=js:/, '');
727
727
  return new CompileRefusal('INLINE_AGENT_COMPOSITE_INPUT', `Inline agent step "${step}"'s input \`${name}\` is bound to a computed expression `
728
- + `(\`${js.length > 60 ? `${js.slice(0, 60)}…` : js}\`), and a prompt references it as `
728
+ + `(\`${js.length > 60 ? `${js.slice(0, 60)}…` : js}\`), and a prompt, context query or built-in task references it as `
729
729
  + `\`{{input.${name}}}\`. The platform does not send the agent the names you declared: it names each `
730
730
  + `argument after the REFERENCE PATH the input is bound to (\`$vars.a.output.b\` → \`a__output__b\`). `
731
731
  + `A computed expression is not one reference, so it gets no argument: its value does not reach the `
@@ -14,7 +14,7 @@
14
14
  import { agentInputPlan, agentSidecarInputs, conversationalAgentJson, voiceAgentJson } from '../../../core/agent-sidecar.js';
15
15
  import { Expr, toExpr } from '../../../core/expr.js';
16
16
  import { wireExprBody } from '../../../core/wire-expr.js';
17
- import { checkAgentResources, checkConversationalAgent, checkInlineAgent, checkInlineAgentRead, checkVoice } from './check.js';
17
+ import { checkAgentResources, checkConversationalAgent, checkNestedPlaceholders, checkInlineAgent, checkInlineAgentRead, checkVoice } from './check.js';
18
18
  import { INLINE_AGENT_DEFAULT_VERSION, INLINE_AGENT_VERSIONS, attachAgentResources, toolArguments, serializeInlineAgent, } from './inline-agent.js';
19
19
  import { liftAgentResources, liftInlineAgent, printInlineAgent } from './inline-agent-lift.js';
20
20
  import { INLINE_AGENT } from './resources.js';
@@ -121,18 +121,18 @@ function serializeVoiceAgent(s, ctx) {
121
121
  ctx.typeAgentInputs(json.inputSchema, plan.refs);
122
122
  // The resource model lives on the definition (its `model.source: true` is
123
123
  // what makes `source` an input), as on the inline agent.
124
- return { model: 'omit', port: SHELL_FORWARD_PORT, inputs, attach: shellResources(s, ctx, source, 'Voice agent') };
124
+ return { model: 'omit', port: SHELL_FORWARD_PORT, inputs, attach: shellResources(s, ctx, source, 'Voice agent', plan.byName) };
125
125
  }
126
126
  /**
127
127
  * A shell agent's tools, context indexes and escalations: the inline agent's
128
128
  * resource nodes and `resource.json` files, under this agent's `source` (#1670).
129
129
  */
130
- function shellResources(s, ctx, source, who) {
130
+ function shellResources(s, ctx, source, who, inputs) {
131
131
  // A process tool argument compile cannot write, a Variable included, or a
132
132
  // built-in task it cannot write, is held until the resources are judged, and
133
133
  // thrown before LIBRARY_REQUIRED, which `check` drops, as on the inline agent.
134
134
  const { toolArgument } = toolArguments(s, ctx.step, who, (v) => ctx.render(v), false);
135
- const { attach, libraryRequired } = attachAgentResources(s, ctx, source, who);
135
+ const { attach, libraryRequired } = attachAgentResources(s, ctx, source, who, undefined, inputs);
136
136
  if (toolArgument)
137
137
  throw toolArgument;
138
138
  if (libraryRequired)
@@ -418,6 +418,7 @@ function voiceAgentAt(version) {
418
418
  check: (spec, ctx) => {
419
419
  checkVoice('voiceAgent', spec.inputs, ctx);
420
420
  checkAgentResources(spec.inputs, ctx, 'Voice agent');
421
+ checkNestedPlaceholders(spec.inputs, ctx, 'Voice agent');
421
422
  },
422
423
  expressions: () => [],
423
424
  output: opaque,
@@ -1,4 +1,5 @@
1
1
  import type { ContextIndexRef, EscalationRef, ProcessToolKind, ToolArgument } from '../../../core/actions.js';
2
+ import { type AgentInputBinding } from '../../../core/agent-sidecar.js';
2
3
  import { CompileRefusal } from '../../../core/compile-refusal.js';
3
4
  import type { ResolvedConnector } from '../../../core/library.js';
4
5
  import type { ProcessResourceSubType } from '../../../core/process-resource.js';
@@ -55,7 +56,7 @@ export declare function contextIndexDef(spec: {
55
56
  * `folderPathPrefix` field uses, and the reason that field ships with
56
57
  * `mode: 'text-builder'` by default.
57
58
  */
58
- export declare function renderContextQuery(query: unknown, render: (value: unknown) => unknown): Record<string, unknown>;
59
+ export declare function renderContextQuery(query: unknown, render: (value: unknown) => unknown, inputs?: Map<string, AgentInputBinding>): Record<string, unknown>;
59
60
  /**
60
61
  * Render a built-in tool's task (`summarize`, `batchtransform`) into the node's
61
62
  * MODE-TAGGED `query`, from the canvas's sources (`BuiltinToolQuery`):
@@ -80,7 +81,7 @@ export declare function renderContextQuery(query: unknown, render: (value: unkno
80
81
  * throws before anything is written; they render here as Empty, so the tool
81
82
  * is attached like any other while the rest of the agent is judged.
82
83
  */
83
- export declare function renderBuiltinToolQuery(query: unknown, render: (value: unknown) => unknown): Record<string, unknown>;
84
+ export declare function renderBuiltinToolQuery(query: unknown, render: (value: unknown) => unknown, inputs?: Map<string, AgentInputBinding>): Record<string, unknown>;
84
85
  /**
85
86
  * The agent input a built-in tool's task Variable binds: the single reference in
86
87
  * `{ variable }`, under its flat name, as `agentInputPlan` takes a tool's
@@ -7,7 +7,7 @@
7
7
  * definition and file is unchanged.
8
8
  */
9
9
  import ixpDefinition from '../../../core/ixp-definition.json' with { type: 'json' };
10
- import { JOB_ATTACHMENT_REF, agentInputRef, jobAttachmentDefinition } from '../../../core/agent-sidecar.js';
10
+ import { JOB_ATTACHMENT_REF, agentInputRef, jobAttachmentDefinition, renderAgentSidecarPrompt, } from '../../../core/agent-sidecar.js';
11
11
  import { BUILTIN_TOOL_TYPE, CONNECTOR_TOOL_RESOURCE_TYPE, HTTP_REQUEST_TOOL_TYPE, INTERNAL_TOOL_RESOURCE_TYPE, TOOL_RESOURCE_TYPE, } from '../../../core/agent-tool-resources.js';
12
12
  import { CompileRefusal } from '../../../core/compile-refusal.js';
13
13
  import { buildConfiguration } from '../../../core/connector-configuration.js';
@@ -127,11 +127,14 @@ export function contextIndexDef(spec) {
127
127
  * `folderPathPrefix` field uses, and the reason that field ships with
128
128
  * `mode: 'text-builder'` by default.
129
129
  */
130
- export function renderContextQuery(query, render) {
130
+ export function renderContextQuery(query, render, inputs) {
131
131
  const base = { mode: 'prompt', textValue: '', promptValue: '', argumentPath: '' };
132
132
  if (query === undefined || query === null)
133
133
  return base;
134
134
  const rendered = render(query);
135
+ if (inputs && typeof rendered === 'string' && !rendered.startsWith('=js:')) {
136
+ return { ...base, promptValue: renderAgentSidecarPrompt(rendered, inputs) };
137
+ }
135
138
  const asText = typeof rendered === 'string' ? rendered : JSON.stringify(rendered);
136
139
  if (typeof rendered === 'string' && rendered.startsWith('=js:')) {
137
140
  return { ...base, mode: 'text-builder', textValue: asText };
@@ -162,10 +165,10 @@ export function renderContextQuery(query, render) {
162
165
  * throws before anything is written; they render here as Empty, so the tool
163
166
  * is attached like any other while the rest of the agent is judged.
164
167
  */
165
- export function renderBuiltinToolQuery(query, render) {
168
+ export function renderBuiltinToolQuery(query, render, inputs) {
166
169
  const named = namedQuerySource(query);
167
170
  if (named === undefined)
168
- return renderContextQuery(isPlainObject(query) ? undefined : query, render);
171
+ return renderContextQuery(isPlainObject(query) ? undefined : query, render, inputs);
169
172
  const base = { mode: 'prompt', textValue: '', promptValue: '', argumentPath: '' };
170
173
  if (named.source === 'variable') {
171
174
  const ref = agentInputRef(render(named.text));
@@ -175,6 +178,9 @@ export function renderBuiltinToolQuery(query, render) {
175
178
  }
176
179
  const rendered = render(named.text);
177
180
  const text = typeof rendered === 'string' ? rendered : JSON.stringify(rendered);
181
+ if (named.source === 'prompt' && inputs && typeof rendered === 'string' && !rendered.startsWith('=js:')) {
182
+ return { ...base, promptValue: renderAgentSidecarPrompt(rendered, inputs) };
183
+ }
178
184
  return named.source === 'value'
179
185
  ? { ...base, mode: 'text-builder', textValue: text }
180
186
  : { ...base, promptValue: text };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.117.2",
3
+ "version": "6.117.4",
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",
@@ -124,5 +124,5 @@
124
124
  "@types/node": "^22.7.0",
125
125
  "esbuild": "^0.28.1"
126
126
  },
127
- "gitref": "f07017fda4361782d6c91a42e2d4c64d945d4442"
127
+ "gitref": "1ad604ec9dcc3d513d4a32560f4fb268ba42bb09"
128
128
  }