@uipath/flow-tool 1.201.0-preview.131 → 1.201.0-preview.133

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.
Files changed (140) hide show
  1. package/dist/{authoring-rezk32bm.js → authoring-7r6g06c7.js} +2 -2
  2. package/dist/{conversion-W6HMHBWW-6qbqgqks.js → conversion-H2VEEYLB-ng48mbf7.js} +536 -161
  3. package/dist/{de-K6MLR24N-5N5XGLH6-gbwpvdz4.js → de-5HU6GFWV-4EZK6G7N-yrh21f52.js} +273 -13
  4. package/dist/{de-K6MLR24N-00fjz82b.js → de-5HU6GFWV-zheyw6d2.js} +271 -10
  5. package/dist/de-5KVP66U6-f7knj511.js +161 -0
  6. package/dist/de-5KVP66U6-t37qr521.js +161 -0
  7. package/dist/{de-B2KIY5TC-81f703v3.js → de-HKTOVV4H-d5yw5j21.js} +3 -3
  8. package/dist/{de-WMKOGI7B-r1821wpe.js → de-WMKOGI7B-6dc1zdnp.js} +3 -3
  9. package/dist/en-4KXU7N7B-24v330b5.js +118 -0
  10. package/dist/en-4KXU7N7B-66fntxa2.js +118 -0
  11. package/dist/{en-ILA4HPE5-ALHGESZE-zrv4qss8.js → en-MABQK6C4-REWE2WG2-8dp4cqdg.js} +109 -6
  12. package/dist/{en-ILA4HPE5-fhwvq92r.js → en-MABQK6C4-nkzq2j8t.js} +106 -2
  13. package/dist/{en-P6PNWNTO-g1f6cjh5.js → en-P4AS26D7-szrzfxz1.js} +3 -5
  14. package/dist/{en-X4DLPKLJ-dt1wtdm7.js → en-X4DLPKLJ-1h9gj5c1.js} +3 -3
  15. package/dist/{es-BVPGJUWA-9gk2g9yb.js → es-BVPGJUWA-0k59eqfv.js} +3 -3
  16. package/dist/{es-HTQSD352-YTAEDCE5-nhsbg581.js → es-LUTYN7U7-IY5QWOUF-k2aefzc0.js} +273 -13
  17. package/dist/{es-HTQSD352-m9rr3f0g.js → es-LUTYN7U7-ye5zn4sn.js} +271 -10
  18. package/dist/{es-MX-3SP2SSV6-f20qspbr.js → es-MX-H2EAXLYI-qwnqt48x.js} +3 -3
  19. package/dist/{es-MX-FOX525CG-87g500gr.js → es-MX-POESXYP2-9538722k.js} +272 -11
  20. package/dist/{es-MX-FOX525CG-HLM27OEL-whr0t9v3.js → es-MX-POESXYP2-UW6VP5QI-cd3a79g9.js} +274 -14
  21. package/dist/{es-MX-U6YL5KQX-ynwxdjr8.js → es-MX-U6YL5KQX-k4qvpgd4.js} +3 -3
  22. package/dist/es-MX-XAVLOQW3-47a405kf.js +161 -0
  23. package/dist/es-MX-XAVLOQW3-9b3cp9n8.js +161 -0
  24. package/dist/{es-BBX4AUJX-h99fcr53.js → es-O4PAV2CR-jwfaawwk.js} +3 -3
  25. package/dist/es-VFPNVMP5-6sftsdxe.js +161 -0
  26. package/dist/es-VFPNVMP5-thm0z9sr.js +161 -0
  27. package/dist/{fr-FSTBVVGK-t3y57xrb.js → fr-5YRGHXF5-q6b63yg0.js} +3 -3
  28. package/dist/fr-E5MDO4EG-exvrs7ge.js +161 -0
  29. package/dist/fr-E5MDO4EG-f3x1jeqw.js +161 -0
  30. package/dist/{fr-EKTTDR7Z-bmpwp31r.js → fr-EKTTDR7Z-m2t68j0m.js} +3 -3
  31. package/dist/{fr-54THJ4QH-IGABNGU6-fpzw2mba.js → fr-LJIK56LW-STG6QR3T-cextvv8q.js} +274 -14
  32. package/dist/{fr-54THJ4QH-d6ezjbhw.js → fr-LJIK56LW-xf3xf2kh.js} +272 -11
  33. package/dist/{index-6hp3p3eq.js → index-dhcd9b82.js} +2 -2
  34. package/dist/{index-zvxfkpkr.js → index-er6vy3jk.js} +71 -5
  35. package/dist/index.js +22 -16
  36. package/dist/init.js +19 -13
  37. package/dist/ja-DPO5PPLO-fmbg7zt2.js +161 -0
  38. package/dist/ja-DPO5PPLO-s2a7j3nj.js +161 -0
  39. package/dist/{ja-MHUPLSWO-CS3KE4Y3-mbtkzwd7.js → ja-FGEGLBJ3-MG3BSWXD-vq19zt2p.js} +273 -13
  40. package/dist/{ja-MHUPLSWO-3qwy4jc0.js → ja-FGEGLBJ3-w9byjhze.js} +271 -10
  41. package/dist/{ja-FW33BJBW-htfk4d8t.js → ja-SDAPAVCR-943p5gx7.js} +3 -3
  42. package/dist/{ja-Y2YBTXNN-96cvy5av.js → ja-Y2YBTXNN-5sszk2zv.js} +3 -3
  43. package/dist/ko-ITOPNIYI-aqy82jk8.js +161 -0
  44. package/dist/ko-ITOPNIYI-qz39kamf.js +161 -0
  45. package/dist/{ko-PDO5AXNW-d653t4pc.js → ko-NAGOZLC3-wb3y9yhh.js} +3 -3
  46. package/dist/{ko-S33XAV26-cxf4dn2t.js → ko-S33XAV26-rfsv9myd.js} +3 -3
  47. package/dist/{ko-XPJTXIKK-DNSW4KYQ-956vp61f.js → ko-TUAK3G3A-TBEBKOTM-ns78t2rv.js} +277 -17
  48. package/dist/{ko-XPJTXIKK-w1hs4px7.js → ko-TUAK3G3A-s25w0ckg.js} +275 -14
  49. package/dist/{node-rnmmv28d.js → node-qyxvhbw6.js} +2 -2
  50. package/dist/{packager-tool-cqrsre00.js → packager-tool-0567pxpm.js} +121 -12
  51. package/dist/{packager-tool-3wf3tkrc.js → packager-tool-09xysehb.js} +3 -5
  52. package/dist/{packager-tool-b0s5d4ek.js → packager-tool-0sz8se22.js} +1 -1
  53. package/dist/{packager-tool-s5y06ny4.js → packager-tool-2xgc101h.js} +544 -45
  54. package/dist/{packager-tool-03knb0er.js → packager-tool-3wygxefb.js} +116 -17
  55. package/dist/packager-tool-6ejqwbw9.js +26 -0
  56. package/dist/{packager-tool-952kqpax.js → packager-tool-78a3szsp.js} +890 -339
  57. package/dist/{packager-tool-xzcywm2b.js → packager-tool-c42dp002.js} +1 -1
  58. package/dist/{packager-tool-v61wap3v.js → packager-tool-djagtpkt.js} +12111 -6271
  59. package/dist/{packager-tool-1gjx8w7m.js → packager-tool-fgdsmd8k.js} +258 -486
  60. package/dist/packager-tool-gasyxww9.js +23964 -0
  61. package/dist/packager-tool-gmrwvnyh.js +1171 -0
  62. package/dist/packager-tool-jysvpt8p.js +11 -0
  63. package/dist/packager-tool-m6x5sczh.js +899 -0
  64. package/dist/packager-tool-mcaf4ewf.js +46 -0
  65. package/dist/packager-tool-p9j43p8h.js +115 -0
  66. package/dist/{packager-tool-v2p6g3fd.js → packager-tool-pkq70dec.js} +1 -1
  67. package/dist/{packager-tool-zh6g3h65.js → packager-tool-sf18719z.js} +5 -5
  68. package/dist/packager-tool-tq9q9m77.js +115 -0
  69. package/dist/{packager-tool-1yy9x4vk.js → packager-tool-v74yk918.js} +2 -2
  70. package/dist/packager-tool-vdd02vns.js +55924 -0
  71. package/dist/packager-tool-xj0agqpk.js +11 -0
  72. package/dist/packager-tool.js +15 -9
  73. package/dist/{pt-JLZYSSXX-7jth254x.js → pt-7TR74ZMB-1g8my56g.js} +3 -3
  74. package/dist/{pt-BR-TV7NR3ID-PDSSHRHU-nddwzj29.js → pt-BR-7XGDXRDJ-TR5D7JYL-533wvy7p.js} +274 -14
  75. package/dist/{pt-BR-TV7NR3ID-vgd26pj1.js → pt-BR-7XGDXRDJ-espnkgrj.js} +272 -11
  76. package/dist/pt-BR-BXURWX4W-dqr4dnf9.js +161 -0
  77. package/dist/pt-BR-BXURWX4W-xzyndmrx.js +161 -0
  78. package/dist/{pt-BR-LQH3RSBB-kyb4jmcw.js → pt-BR-DXXSYJDO-bn84ewp7.js} +3 -3
  79. package/dist/{pt-BR-JO45SCNI-4kbfnzc4.js → pt-BR-JO45SCNI-mt93s33c.js} +3 -3
  80. package/dist/{pt-4JEPEAST-JO5WN33S-ccdbdab2.js → pt-TMVOOITK-H2ADYHSD-ezpggv33.js} +273 -13
  81. package/dist/{pt-4JEPEAST-40npwxyw.js → pt-TMVOOITK-myha14p9.js} +271 -10
  82. package/dist/{pt-W3NA4LIZ-f02gapvs.js → pt-W3NA4LIZ-fwd1q4j0.js} +3 -3
  83. package/dist/pt-YI4VE4YQ-521681zf.js +161 -0
  84. package/dist/pt-YI4VE4YQ-v7gjeg82.js +161 -0
  85. package/dist/{ro-RKJ74FV3-QS3I6XKJ-kb31d85k.js → ro-2VALF3S5-NXBJUEZN-nqw1zs33.js} +277 -17
  86. package/dist/{ro-RKJ74FV3-qn0ey39v.js → ro-2VALF3S5-cdz5afkr.js} +275 -14
  87. package/dist/{ro-E2EBPQGT-vn573vcr.js → ro-BJFER5OI-334n28rj.js} +3 -3
  88. package/dist/ro-RKXZUG7Z-cm3xn3fj.js +161 -0
  89. package/dist/ro-RKXZUG7Z-pdztdafr.js +161 -0
  90. package/dist/{ro-WLKX6HF5-fcbe2zz8.js → ro-WLKX6HF5-b9tj8q67.js} +3 -3
  91. package/dist/ru-GSCT4ARZ-FTVCGQTL-5nh4jf2e.js +14 -0
  92. package/dist/ru-T73OPRTC-mp5gn7gs.js +10 -0
  93. package/dist/ru-WBLQ5B2U-8xd4gpv2.js +10 -0
  94. package/dist/ru-WBLQ5B2U-mswqs9wc.js +10 -0
  95. package/dist/serialization-GAW7UFOK-9hkdmmd2.js +36541 -0
  96. package/dist/services/flow-eval-schema/deterministic-evaluators.d.ts +110 -0
  97. package/dist/services/flow-eval-schema/evaluator-fields.d.ts +66 -0
  98. package/dist/services/flow-eval-schema/helpers.d.ts +9 -0
  99. package/dist/services/flow-eval-schema/index.d.ts +4 -0
  100. package/dist/services/flow-eval-schema/llm-judge-evaluators.d.ts +174 -0
  101. package/dist/services/flow-eval-schema/prompts.d.ts +2 -0
  102. package/dist/services/flow-eval-schema/registry.d.ts +375 -0
  103. package/dist/services/flow-eval-schema/tool-call-evaluators.d.ts +93 -0
  104. package/dist/services/flow-eval-schema/types.d.ts +78 -0
  105. package/dist/services/flow-eval-types.d.ts +6 -0
  106. package/dist/services/flow-eval-utils.d.ts +14 -0
  107. package/dist/services/flow-validate-service.d.ts +11 -0
  108. package/dist/services/packaging-utils.d.ts +3 -29
  109. package/dist/tool.js +22 -16
  110. package/dist/{tr-3U2W2XCA-zg3zcmq3.js → tr-3U2W2XCA-43ptfc0m.js} +3 -3
  111. package/dist/tr-AA6O2WSR-bj9n80k8.js +161 -0
  112. package/dist/tr-AA6O2WSR-ga1xnymp.js +161 -0
  113. package/dist/{tr-X7R6GQNB-VMEZAWRJ-vdbjqw23.js → tr-RIFCEXFH-BZS7S7QK-q465b62g.js} +279 -19
  114. package/dist/{tr-X7R6GQNB-shwv16dz.js → tr-RIFCEXFH-hgkb4g8y.js} +277 -16
  115. package/dist/{tr-ZUUSMHER-pfn5dq1r.js → tr-RQTZ2DMS-bpgd4kma.js} +3 -3
  116. package/dist/utils/flow-io.d.ts +8 -0
  117. package/dist/validation.js +19 -13
  118. package/dist/{zh-CN-FEZ24J4A-q5b5x20w.js → zh-CN-IP3FMXWM-1cfarhcp.js} +271 -10
  119. package/dist/{zh-CN-FEZ24J4A-LSEMG63K-db8kf6rm.js → zh-CN-IP3FMXWM-H3JI2XUM-ta4yac7h.js} +273 -13
  120. package/dist/{zh-CN-IPZYQR3P-1h76csc4.js → zh-CN-IPZYQR3P-egjmvyjf.js} +3 -3
  121. package/dist/zh-CN-R2KLHXQV-wttmznep.js +161 -0
  122. package/dist/zh-CN-R2KLHXQV-x6gnk2n0.js +161 -0
  123. package/dist/{zh-CN-YFKQ7HBX-w98q5zqf.js → zh-CN-ZC6LT4IN-vty9mvv8.js} +3 -3
  124. package/dist/{zh-TW-GKSCT6NW-JLMWTDAF-g2smq1gm.js → zh-TW-AGIDXIPF-R4XZRDJZ-cgxxz5k4.js} +274 -14
  125. package/dist/{zh-TW-GKSCT6NW-4n1yfre0.js → zh-TW-AGIDXIPF-n6r6w7vy.js} +272 -11
  126. package/dist/{zh-TW-CP5PCVEJ-wvbxf7c7.js → zh-TW-R7Y5KVMU-q81f4z2p.js} +3 -3
  127. package/dist/zh-TW-RJGCQANM-gqn0aca0.js +161 -0
  128. package/dist/zh-TW-RJGCQANM-tt8j5wv2.js +161 -0
  129. package/dist/{zh-TW-YPVSQVGT-wbybwpwt.js → zh-TW-YPVSQVGT-b378ztph.js} +3 -3
  130. package/package.json +2 -2
  131. package/dist/packager-tool-1169tjst.js +0 -87554
  132. package/dist/packager-tool-c19w8vg9.js +0 -26
  133. package/dist/packager-tool-gbgfwx8f.js +0 -2
  134. package/dist/packager-tool-jpcm3xas.js +0 -12
  135. package/dist/packager-tool-mt2g0zjx.js +0 -36187
  136. package/dist/packager-tool-pvgqbm48.js +0 -21
  137. package/dist/ru-D6DDND7Z-e4en56d2.js +0 -10
  138. package/dist/ru-GSCT4ARZ-3TVTUGWP-bbg6360z.js +0 -15
  139. package/dist/serialization-GTFWODSH-p7wmsmj7.js +0 -148
  140. /package/dist/{packager-tool-ny53xmsd.js → packager-tool-cvwr40ax.js} +0 -0
@@ -0,0 +1,899 @@
1
+ import {
2
+ METADATA_IDENTIFIER,
3
+ METADATA_PREFIX,
4
+ VARIABLE_PATH_IDENTIFIER_PATTERN,
5
+ VARIABLE_PATH_PATTERN,
6
+ VARIABLE_PATH_SELECTOR_PATTERN,
7
+ VARS_PREFIX
8
+ } from "./packager-tool-vdd02vns.js";
9
+ import {
10
+ FLAT_SEP,
11
+ JobAttachmentSchema,
12
+ isAgentNodeType,
13
+ isExpressionValue,
14
+ isJobAttachmentRef,
15
+ stripAutoDerivedFieldBindings
16
+ } from "./packager-tool-78a3szsp.js";
17
+ import {
18
+ init_esm_shims
19
+ } from "./packager-tool-6ejqwbw9.js";
20
+
21
+ // ../../node_modules/@uipath/flow-converter/dist/chunk-WBQ4J5MN.js
22
+ init_esm_shims();
23
+ var DEFAULT_AGENT_INPUT_ENCODING = "flat";
24
+ init_esm_shims();
25
+ var SCHEMA_CONTAINER_MARKER = "x-uipath-container";
26
+ function getContainerChildProps(prop) {
27
+ if (prop?.type !== "object")
28
+ return;
29
+ if (prop[SCHEMA_CONTAINER_MARKER] !== true)
30
+ return;
31
+ const childProps = prop.properties;
32
+ if (!childProps || Object.keys(childProps).length === 0)
33
+ return;
34
+ return childProps;
35
+ }
36
+ init_esm_shims();
37
+ var CONNECTOR_PARAM_BUCKET_KEYS = ["pathParameters", "queryParameters", "multipartParameters", "bodyParameters"];
38
+ var extractAgentInputName = (source) => {
39
+ if (!source)
40
+ return;
41
+ const trimmed = source.trim();
42
+ const patterns = [
43
+ /^\{\{\s*\$agent\.([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)\s*\}\}$/,
44
+ /^=js:\s*\$agent\.([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)\s*$/,
45
+ /^=js:\(\s*\$agent\.([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)\s*\)$/,
46
+ /^=js:`\$\{\s*\$agent\.([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)\s*\}`$/,
47
+ /^=\$agent\.([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)$/,
48
+ /^\$agent\.([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)$/
49
+ ];
50
+ for (const pattern of patterns) {
51
+ const match = pattern.exec(trimmed);
52
+ if (match)
53
+ return match[1];
54
+ }
55
+ return;
56
+ };
57
+ var SINGLE_REF = String.raw`\$(?:vars|metadata|agent)\.[a-zA-Z_][\w.]*`;
58
+ var SINGLE_BINDING_PATTERNS = [
59
+ new RegExp(String.raw`^\{\{\s*${SINGLE_REF}\s*\}\}$`),
60
+ new RegExp(String.raw`^=js:\s*${SINGLE_REF}\s*$`),
61
+ new RegExp(String.raw`^=js:\(\s*${SINGLE_REF}\s*\)$`),
62
+ new RegExp(String.raw`^=js:\`\$\{\s*${SINGLE_REF}\s*\}\`$`),
63
+ new RegExp(`^=${SINGLE_REF}$`),
64
+ new RegExp(`^${SINGLE_REF}$`)
65
+ ];
66
+ var SOURCE_TOKEN = /(?<!\w)\$(?:vars|metadata)\./;
67
+ var isCompositeConnectorValue = (value) => {
68
+ if (typeof value !== "string")
69
+ return false;
70
+ const referencesSource = SOURCE_TOKEN.test(value) || value.includes("$agent.");
71
+ if (!referencesSource)
72
+ return false;
73
+ const trimmed = value.trim();
74
+ return !SINGLE_BINDING_PATTERNS.some((pattern) => pattern.test(trimmed));
75
+ };
76
+ var COMPOSITE_CONNECTOR_INFIX = "__connectorArg__";
77
+ var sanitizeSyntheticSegment = (s) => s.replace(/\W+/g, "_");
78
+ var FILES_INPUT_PREFIX = "files_";
79
+ var filesInputKey = (nodeId) => `${FILES_INPUT_PREFIX}${nodeId}`;
80
+ var compositeConnectorInputKey = (nodeId, fieldName) => {
81
+ const key = `${sanitizeSyntheticSegment(nodeId)}${COMPOSITE_CONNECTOR_INFIX}${sanitizeSyntheticSegment(fieldName)}`;
82
+ return /^[a-zA-Z_]/.test(key) ? key : `_${key}`;
83
+ };
84
+ var isSyntheticAgentInputId = (id) => id.includes(COMPOSITE_CONNECTOR_INFIX) || id.startsWith(FILES_INPUT_PREFIX);
85
+ var collectCompositeConnectorInputs = (node) => {
86
+ const inputs = node.data?.inputs ?? node.inputs;
87
+ const detail = inputs?.detail;
88
+ if (!detail)
89
+ return [];
90
+ const out = [];
91
+ for (const bucketKey of CONNECTOR_PARAM_BUCKET_KEYS) {
92
+ const bucket = detail[bucketKey];
93
+ if (!bucket || typeof bucket !== "object")
94
+ continue;
95
+ for (const [fieldName, value] of Object.entries(bucket)) {
96
+ if (!isCompositeConnectorValue(value))
97
+ continue;
98
+ out.push({
99
+ id: compositeConnectorInputKey(node.id, fieldName),
100
+ type: "string",
101
+ binding: value,
102
+ description: `Composite connector binding for ${fieldName}`
103
+ });
104
+ }
105
+ }
106
+ return out;
107
+ };
108
+ init_esm_shims();
109
+ init_esm_shims();
110
+ init_esm_shims();
111
+ init_esm_shims();
112
+ init_esm_shims();
113
+ init_esm_shims();
114
+ init_esm_shims();
115
+ var UNSAFE_PROPERTY_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
116
+ var isUnsafeKey = (key) => UNSAFE_PROPERTY_KEYS.has(key);
117
+ init_esm_shims();
118
+ function isLabeledWrapper(val) {
119
+ return val != null && typeof val === "object" && !Array.isArray(val) && !isExpressionValue(val) && "value" in val;
120
+ }
121
+ function unwrapFlowExpression(val) {
122
+ if (isLabeledWrapper(val))
123
+ return unwrapFlowExpression(val.value);
124
+ if (isExpressionValue(val))
125
+ return val.expression;
126
+ if (typeof val === "string")
127
+ return val;
128
+ return "";
129
+ }
130
+ init_esm_shims();
131
+ init_esm_shims();
132
+ init_esm_shims();
133
+ init_esm_shims();
134
+ init_esm_shims();
135
+ var MUSTACHE_SOURCE_TOKEN_REGEX = new RegExp(String.raw`\{\{\s*\$(vars|metadata)\.(${VARIABLE_PATH_PATTERN})\s*\}\}`, "g");
136
+ var RAW_SOURCE_TOKEN_REGEX = new RegExp(String.raw`(?<!\w)\$(vars|metadata)\.(${VARIABLE_PATH_PATTERN})`, "g");
137
+ var MUSTACHE_INPUT_TOKEN_REGEX = new RegExp(String.raw`\{\{\s*\$agent\.(${VARIABLE_PATH_IDENTIFIER_PATTERN})(${VARIABLE_PATH_SELECTOR_PATTERN})\s*\}\}`, "g");
138
+ var RAW_INPUT_TOKEN_REGEX = new RegExp(String.raw`(?<!\w)\$agent\.(${VARIABLE_PATH_IDENTIFIER_PATTERN})(${VARIABLE_PATH_SELECTOR_PATTERN})(?!\w)`, "g");
139
+ var MUSTACHE_RUNTIME_INPUT_TOKEN_REGEX = new RegExp(String.raw`\{\{\s*input\.(${VARIABLE_PATH_IDENTIFIER_PATTERN})(${VARIABLE_PATH_SELECTOR_PATTERN})\s*\}\}`, "g");
140
+ var SOURCE_BINDING_REGEX = new RegExp(String.raw`^\$?(vars|metadata)\.(${VARIABLE_PATH_PATTERN})$`);
141
+ function encodeFlatName(prefix, path, encoding = DEFAULT_AGENT_INPUT_ENCODING) {
142
+ if (encoding === "flat" || /\[\d+\]/.test(path)) {
143
+ const segments2 = Array.from(path.matchAll(new RegExp(String.raw`${VARIABLE_PATH_IDENTIFIER_PATTERN}|\[(\d+)\]`, "g")), (match) => match[1] ?? match[0]);
144
+ const parts2 = prefix === VARS_PREFIX ? segments2 : [METADATA_IDENTIFIER, ...segments2];
145
+ return parts2.join(FLAT_SEP);
146
+ }
147
+ const segments = path.split(".").filter(Boolean);
148
+ const parts = prefix === VARS_PREFIX ? segments : [METADATA_IDENTIFIER, ...segments];
149
+ return parts.join(".");
150
+ }
151
+ function decodeFlatName(flatName) {
152
+ if (flatName.includes(".")) {
153
+ const dotIndex = flatName.indexOf(".");
154
+ if (flatName.slice(0, dotIndex) === METADATA_IDENTIFIER) {
155
+ return { prefix: METADATA_PREFIX, path: flatName.slice(dotIndex + 1) };
156
+ }
157
+ return { prefix: VARS_PREFIX, path: flatName };
158
+ }
159
+ const decodePath = (encoded) => encoded.split(FLAT_SEP).filter(Boolean).reduce((path, segment) => {
160
+ if (/^\d+$/.test(segment))
161
+ return `${path}[${segment}]`;
162
+ if (!path)
163
+ return segment;
164
+ return `${path}.${segment}`;
165
+ }, "");
166
+ const metadataPrefix = `${METADATA_IDENTIFIER}${FLAT_SEP}`;
167
+ if (flatName === METADATA_IDENTIFIER) {
168
+ return { prefix: METADATA_PREFIX, path: "" };
169
+ }
170
+ if (flatName.startsWith(metadataPrefix)) {
171
+ return { prefix: METADATA_PREFIX, path: decodePath(flatName.slice(metadataPrefix.length)) };
172
+ }
173
+ return { prefix: VARS_PREFIX, path: decodePath(flatName) };
174
+ }
175
+ function extractSourceRefs(text, encoding = DEFAULT_AGENT_INPUT_ENCODING) {
176
+ if (!text || typeof text !== "string")
177
+ return [];
178
+ const refs = [];
179
+ const seen = /* @__PURE__ */ new Set;
180
+ const emit = (prefixId, path) => {
181
+ const prefix = `$${prefixId}`;
182
+ const flatName = encodeFlatName(prefix, path, encoding);
183
+ if (seen.has(flatName))
184
+ return;
185
+ seen.add(flatName);
186
+ refs.push({ prefix, path, flatName, binding: `=${prefix}.${path}` });
187
+ };
188
+ let match;
189
+ MUSTACHE_SOURCE_TOKEN_REGEX.lastIndex = 0;
190
+ while ((match = MUSTACHE_SOURCE_TOKEN_REGEX.exec(text)) !== null) {
191
+ emit(match[1], match[2]);
192
+ }
193
+ RAW_SOURCE_TOKEN_REGEX.lastIndex = 0;
194
+ while ((match = RAW_SOURCE_TOKEN_REGEX.exec(text)) !== null) {
195
+ emit(match[1], match[2]);
196
+ }
197
+ return refs;
198
+ }
199
+ function rewriteInputTokensToSource(text, bindingsByFlatName) {
200
+ if (!text || typeof text !== "string")
201
+ return text;
202
+ const resolveSource = (flatName) => {
203
+ const explicit = bindingsByFlatName?.get(flatName);
204
+ if (explicit) {
205
+ const raw = explicit.startsWith("=") ? explicit.slice(1) : explicit;
206
+ const prefixMatch = SOURCE_BINDING_REGEX.exec(raw);
207
+ if (prefixMatch) {
208
+ return { prefix: `$${prefixMatch[1]}`, path: prefixMatch[2] };
209
+ }
210
+ }
211
+ return decodeFlatName(flatName);
212
+ };
213
+ let out = text.replace(MUSTACHE_INPUT_TOKEN_REGEX, (_full, flatName, selector) => {
214
+ const decoded = resolveSource(flatName);
215
+ if (!decoded.path)
216
+ return `{{ ${decoded.prefix}${selector} }}`;
217
+ return `{{ ${decoded.prefix}.${decoded.path}${selector} }}`;
218
+ });
219
+ out = out.replace(RAW_INPUT_TOKEN_REGEX, (_full, flatName, selector) => {
220
+ const decoded = resolveSource(flatName);
221
+ if (!decoded.path)
222
+ return `${decoded.prefix}${selector}`;
223
+ return `${decoded.prefix}.${decoded.path}${selector}`;
224
+ });
225
+ return out;
226
+ }
227
+ function rewriteRuntimeInputTokensToSource(text, bindings) {
228
+ if (!text || typeof text !== "string")
229
+ return text;
230
+ const canvasForm = text.replace(MUSTACHE_RUNTIME_INPUT_TOKEN_REGEX, "{{ $$agent.$1$2 }}");
231
+ return rewriteInputTokensToSource(canvasForm, bindings);
232
+ }
233
+ function buildBindingMap(inputVariables) {
234
+ const map = /* @__PURE__ */ new Map;
235
+ if (!inputVariables)
236
+ return map;
237
+ for (const v of inputVariables) {
238
+ if (v.id && v.binding)
239
+ map.set(v.id, v.binding);
240
+ }
241
+ return map;
242
+ }
243
+ var UnresolvedAgentInputTypeError = class extends Error {
244
+ constructor(ref) {
245
+ super(`Cannot resolve type for inline-agent input '${ref.flatName}' (from ${ref.prefix}.${ref.path}): no matching variable in workflow.variables.globals or workflow.variables.nodes. Declare the variable so the agent.json inputSchema can be typed.`);
246
+ this.name = "UnresolvedAgentInputTypeError";
247
+ this.ref = ref;
248
+ }
249
+ };
250
+ var AmbiguousAgentInputRootError = class extends Error {
251
+ constructor(ref, reason) {
252
+ const stripIndex = (s) => s.replace(/\[\d+\]/g, "");
253
+ const segments = ref.path.split(".");
254
+ const offending = reason === "underscore" ? segments.map(stripIndex).find((s) => s.includes(FLAT_SEP)) ?? stripIndex(segments[0]) : stripIndex(segments[0]);
255
+ super(reason === "metadata" ? `Inline-agent input references "$vars.${ref.path}", but a variable or node named "metadata" collides with the "$metadata" namespace once serialized and cannot round-trip. Rename it to something other than "metadata".` : `Inline-agent input references "$vars.${ref.path}", but the name "${offending}" contains "__", reserved as the agent-input encoding separator, so it cannot round-trip. Rename it to remove the double underscore.`);
256
+ this.name = "AmbiguousAgentInputRootError";
257
+ this.ref = ref;
258
+ this.i18n = reason === "metadata" ? { key: "agentInputRefs_reservedMetadataRoot_message", params: { ref: ref.path }, ns: "validation" } : { key: "agentInputRefs_ambiguousUnderscoreRoot_message", params: { ref: ref.path, rootSegment: offending }, ns: "validation" };
259
+ }
260
+ };
261
+ function detectAmbiguousAgentInputRoot(ref, encoding = DEFAULT_AGENT_INPUT_ENCODING) {
262
+ if (ref.prefix !== VARS_PREFIX)
263
+ return;
264
+ const stripIndex = (s) => s.replace(/\[\d+\]/g, "");
265
+ const segments = ref.path.split(".");
266
+ if (stripIndex(segments[0]) === METADATA_IDENTIFIER)
267
+ return "metadata";
268
+ const flatEncoded = encoding === "flat" || /\[\d+\]/.test(ref.path);
269
+ const segmentsToCheck = flatEncoded ? segments : [segments[0]];
270
+ if (segmentsToCheck.some((s) => stripIndex(s).includes(FLAT_SEP)))
271
+ return "underscore";
272
+ return;
273
+ }
274
+ function assertNoAmbiguousAgentInputRoot(refs, encoding) {
275
+ for (const ref of refs) {
276
+ const reason = detectAmbiguousAgentInputRoot(ref, encoding);
277
+ if (reason)
278
+ throw new AmbiguousAgentInputRootError(ref, reason);
279
+ }
280
+ }
281
+ function buildVariableLookup(globals, nodeVars, scoped = []) {
282
+ const map = /* @__PURE__ */ new Map;
283
+ for (const s of scoped)
284
+ map.set(s.path, { type: s.type, schema: s.schema });
285
+ for (const n of nodeVars)
286
+ map.set(n.id, { type: n.type, schema: n.schema });
287
+ for (const g of globals) {
288
+ const key = g.direction === "in" && g.triggerNodeId ? `${g.triggerNodeId}.output.${g.id}` : g.id;
289
+ map.set(key, { type: g.type, schema: g.schema });
290
+ }
291
+ return map;
292
+ }
293
+ var TRAILING_VARIABLE_PATH_SELECTOR_REGEX = new RegExp(String.raw`(?:\.(${VARIABLE_PATH_IDENTIFIER_PATTERN})|\[(\d+)\])$`);
294
+ function removeTrailingPathSelector(path) {
295
+ const selector = TRAILING_VARIABLE_PATH_SELECTOR_REGEX.exec(path);
296
+ if (selector?.index === undefined)
297
+ return;
298
+ return {
299
+ path: path.slice(0, selector.index),
300
+ segment: selector[1] ?? Number(selector[2])
301
+ };
302
+ }
303
+ function findLongestPrefixMatch(path, map) {
304
+ let candidate = path;
305
+ const reversedTail = [];
306
+ while (candidate) {
307
+ const entry = map.get(candidate);
308
+ if (entry) {
309
+ reversedTail.reverse();
310
+ return { entry, tail: reversedTail };
311
+ }
312
+ const trailingSelector = removeTrailingPathSelector(candidate);
313
+ if (!trailingSelector)
314
+ return;
315
+ reversedTail.push(trailingSelector.segment);
316
+ candidate = trailingSelector.path;
317
+ }
318
+ return;
319
+ }
320
+ function asSchemaNode(value) {
321
+ return value && typeof value === "object" ? value : undefined;
322
+ }
323
+ function getSchemaChild(node, segment) {
324
+ if (typeof segment === "number")
325
+ return node.items;
326
+ const properties = asSchemaNode(node.properties);
327
+ if (properties && segment in properties)
328
+ return properties[segment];
329
+ return node.additionalProperties;
330
+ }
331
+ function walkSchemaForLeaf(schema, segments) {
332
+ let current = asSchemaNode(schema);
333
+ for (const segment of segments) {
334
+ if (!current)
335
+ return;
336
+ current = asSchemaNode(getSchemaChild(current, segment));
337
+ }
338
+ return current;
339
+ }
340
+ function buildAgentInputTypeResolver(workflowVariables, options) {
341
+ const globals = workflowVariables?.globals ?? [];
342
+ const nodeVars = workflowVariables?.nodes ?? [];
343
+ const lookup = buildVariableLookup(globals, nodeVars, options?.scopedVariables);
344
+ const warnedRefs = /* @__PURE__ */ new Set;
345
+ return (ref) => {
346
+ if (ref.prefix !== VARS_PREFIX)
347
+ return "string";
348
+ const result = findLongestPrefixMatch(ref.path, lookup);
349
+ if (!result) {
350
+ if (options?.onUnresolved === "fallback") {
351
+ const refName = `${ref.prefix}.${ref.path}`;
352
+ if (!warnedRefs.has(refName)) {
353
+ warnedRefs.add(refName);
354
+ console.warn(`[agent-cluster-rewrite] '${refName}' matches no workflow variable — emitting a typeless agent input`);
355
+ }
356
+ return normalizeJsonSchemaType("any");
357
+ }
358
+ throw new UnresolvedAgentInputTypeError(ref);
359
+ }
360
+ const { entry, tail } = result;
361
+ if (tail.length === 0)
362
+ return normalizeJsonSchemaType(entry.type);
363
+ const schema = walkSchemaForLeaf(entry.schema, tail);
364
+ const schemaType = typeof schema?.type === "string" ? schema.type : undefined;
365
+ return normalizeJsonSchemaType(schemaType ?? "any");
366
+ };
367
+ }
368
+ function normalizeJsonSchemaType(type) {
369
+ if (type === "octet-stream")
370
+ return "object";
371
+ if (type === "any")
372
+ return "any";
373
+ return type;
374
+ }
375
+ function canPruneAgentInputs(inputs) {
376
+ return typeof inputs?.systemPrompt === "string" || typeof inputs?.userPrompt === "string";
377
+ }
378
+ function canonicalLegacyId(entry, encoding) {
379
+ const raw = entry.binding?.startsWith("=") ? entry.binding.slice(1) : entry.binding;
380
+ if (!raw || !SOURCE_BINDING_REGEX.test(raw))
381
+ return entry.id;
382
+ const { prefix, path } = decodeFlatName(entry.id);
383
+ return encodeFlatName(prefix, path, encoding);
384
+ }
385
+ function deriveLegacyEntry(entry, refByFlatName, resolveSourceType, pruneUnreferenced, encoding) {
386
+ const id = canonicalLegacyId(entry, encoding);
387
+ const ref = refByFlatName.get(id);
388
+ if (!ref && pruneUnreferenced)
389
+ return null;
390
+ let resolvedType;
391
+ if (ref && resolveSourceType) {
392
+ try {
393
+ resolvedType = resolveSourceType(ref);
394
+ } catch (error) {
395
+ if (!(error instanceof UnresolvedAgentInputTypeError))
396
+ throw error;
397
+ resolvedType = undefined;
398
+ }
399
+ }
400
+ return {
401
+ id,
402
+ type: (resolvedType && resolvedType !== "any" ? resolvedType : entry.type) || "string",
403
+ binding: entry.binding ?? "",
404
+ description: entry.description ?? "",
405
+ ...entry.schema ? { schema: entry.schema } : {}
406
+ };
407
+ }
408
+ function deriveAgentInputVariables(refs, legacy, resolveSourceType, pruneUnreferenced, encoding = DEFAULT_AGENT_INPUT_ENCODING) {
409
+ const result = [];
410
+ const seen = /* @__PURE__ */ new Set;
411
+ const refByFlatName = new Map(refs.map((r) => [r.flatName, r]));
412
+ for (const entry of legacy ?? []) {
413
+ if (!entry.id)
414
+ continue;
415
+ const derived = deriveLegacyEntry(entry, refByFlatName, resolveSourceType, pruneUnreferenced, encoding);
416
+ if (!derived || seen.has(derived.id))
417
+ continue;
418
+ result.push(derived);
419
+ seen.add(derived.id);
420
+ }
421
+ for (const ref of refs) {
422
+ if (seen.has(ref.flatName))
423
+ continue;
424
+ result.push({
425
+ id: ref.flatName,
426
+ type: resolveSourceType?.(ref) ?? "string",
427
+ binding: ref.binding,
428
+ description: `Bound from ${ref.prefix}.${ref.path}`
429
+ });
430
+ seen.add(ref.flatName);
431
+ }
432
+ return result;
433
+ }
434
+ function scanSourceRefsDeep(values, encoding = DEFAULT_AGENT_INPUT_ENCODING) {
435
+ const seen = /* @__PURE__ */ new Map;
436
+ const visit = (v) => {
437
+ if (v == null)
438
+ return;
439
+ if (typeof v === "string") {
440
+ for (const ref of extractSourceRefs(v, encoding)) {
441
+ if (!seen.has(ref.flatName))
442
+ seen.set(ref.flatName, ref);
443
+ }
444
+ return;
445
+ }
446
+ if (Array.isArray(v)) {
447
+ for (const item of v)
448
+ visit(item);
449
+ return;
450
+ }
451
+ if (typeof v === "object") {
452
+ for (const item of Object.values(v))
453
+ visit(item);
454
+ }
455
+ };
456
+ for (const value of values)
457
+ visit(value);
458
+ return Array.from(seen.values());
459
+ }
460
+ var LOOP_MEMBER_TO_ITERATOR_FIELD = {
461
+ currentItem: { field: "item", type: "any" },
462
+ currentIteration: { field: "loopCounter", type: "number" }
463
+ };
464
+ function tryBuildLoopBinding(ref, ancestorLoopInfo) {
465
+ if (ref.prefix !== VARS_PREFIX)
466
+ return;
467
+ const segments = ref.path.split(".");
468
+ if (segments.length < 2)
469
+ return;
470
+ const loopId = segments[0];
471
+ const member = segments[1];
472
+ const info = ancestorLoopInfo.get(loopId);
473
+ if (!info)
474
+ return;
475
+ const tail = segments.slice(2).join(".");
476
+ const suffix = tail ? `.${tail}` : "";
477
+ let binding;
478
+ let type;
479
+ if (member === "collection") {
480
+ if (!info.collectionExpr)
481
+ return;
482
+ binding = `${info.collectionExpr}${suffix}`;
483
+ type = "array";
484
+ } else {
485
+ const mapping = LOOP_MEMBER_TO_ITERATOR_FIELD[member];
486
+ if (!mapping)
487
+ return;
488
+ binding = `=iterator[${info.index}].${mapping.field}${suffix}`;
489
+ type = mapping.type;
490
+ }
491
+ return {
492
+ id: ref.flatName,
493
+ type,
494
+ binding,
495
+ description: `Bound from ${ref.prefix}.${ref.path}`
496
+ };
497
+ }
498
+ function partitionRefsByLoopBinding(refs, ancestorLoopInfo) {
499
+ const loopVariables = [];
500
+ const nonLoopRefs = [];
501
+ if (!ancestorLoopInfo || ancestorLoopInfo.size === 0) {
502
+ return { loopVariables, nonLoopRefs: [...refs] };
503
+ }
504
+ for (const ref of refs) {
505
+ const loopEntry = tryBuildLoopBinding(ref, ancestorLoopInfo);
506
+ if (loopEntry)
507
+ loopVariables.push(loopEntry);
508
+ else
509
+ nonLoopRefs.push(ref);
510
+ }
511
+ return { loopVariables, nonLoopRefs };
512
+ }
513
+ function scanInputsWithoutAutoDerivedBindings(inputs) {
514
+ const schema = inputs.schema;
515
+ if (!schema || !Array.isArray(schema.fields))
516
+ return inputs;
517
+ const stripped = stripAutoDerivedFieldBindings(schema);
518
+ return stripped === schema ? inputs : { ...inputs, schema: stripped };
519
+ }
520
+ function scanAgentClusterRefs(agent, nodesById, edges, resolveSourceType, ancestorLoopInfo, pruneUnreferenced, encoding = DEFAULT_AGENT_INPUT_ENCODING) {
521
+ const inputs = agent.data?.inputs ?? {};
522
+ const rawSystemPrompt = typeof inputs.systemPrompt === "string" ? inputs.systemPrompt : "";
523
+ const rawUserPrompt = typeof inputs.userPrompt === "string" ? inputs.userPrompt : "";
524
+ const canPrune = canPruneAgentInputs(inputs);
525
+ const bindingMap = buildBindingMap(Array.isArray(inputs.agentInputVariables) ? inputs.agentInputVariables : undefined);
526
+ const systemPrompt = rewriteRuntimeInputTokensToSource(rawSystemPrompt, bindingMap);
527
+ const userPrompt = rewriteRuntimeInputTokensToSource(rawUserPrompt, bindingMap);
528
+ const descendantInputs = [];
529
+ for (const descId of collectArtifactDescendants(agent.id, edges)) {
530
+ const descNode = nodesById.get(descId);
531
+ if (descNode?.data?.inputs)
532
+ descendantInputs.push(rewriteStringsDeep(scanInputsWithoutAutoDerivedBindings(descNode.data.inputs), (s) => rewriteRuntimeInputTokensToSource(s, bindingMap)));
533
+ }
534
+ const refs = scanSourceRefsDeep([systemPrompt, userPrompt, ...descendantInputs], encoding);
535
+ assertNoAmbiguousAgentInputRoot(refs, encoding);
536
+ const legacy = Array.isArray(inputs.agentInputVariables) ? inputs.agentInputVariables.filter((v) => !!v.id) : [];
537
+ const { loopVariables, nonLoopRefs } = partitionRefsByLoopBinding(refs, ancestorLoopInfo);
538
+ const standardVariables = deriveAgentInputVariables(nonLoopRefs, legacy, resolveSourceType, pruneUnreferenced && canPrune, encoding);
539
+ const seen = new Set(standardVariables.map((v) => v.id));
540
+ const variables = [...standardVariables];
541
+ for (const v of loopVariables) {
542
+ if (seen.has(v.id))
543
+ continue;
544
+ variables.push(v);
545
+ seen.add(v.id);
546
+ }
547
+ return { refs, variables };
548
+ }
549
+ function collectInlineAgentClusterInputs(agentNodeId, nodes, edges, workflowVariables, encoding = DEFAULT_AGENT_INPUT_ENCODING) {
550
+ const empty = { refs: [], variables: [] };
551
+ const agent = nodes.find((n) => n.id === agentNodeId);
552
+ if (!agent)
553
+ return empty;
554
+ const type = agent.data?.type ?? agent.type;
555
+ if (!isAgentNodeType(type))
556
+ return empty;
557
+ const nodesById = new Map(nodes.map((n) => [n.id, n]));
558
+ return scanAgentClusterRefs(agent, nodesById, edges, buildAgentInputTypeResolver(workflowVariables), undefined, undefined, encoding);
559
+ }
560
+ function collectInlineAgentInputsFromAgent(agent) {
561
+ const refs = [];
562
+ const variables = [];
563
+ const properties = agent?.inputSchema?.properties;
564
+ if (!properties)
565
+ return { refs, variables };
566
+ const emitLeaf = (flatName, prop) => {
567
+ const type = isJobAttachmentRef(prop) ? "file" : prop?.type || "string";
568
+ if (isSyntheticAgentInputId(flatName)) {
569
+ variables.push({ id: flatName, type, binding: "", description: prop?.description ?? "" });
570
+ return;
571
+ }
572
+ const { prefix, path } = decodeFlatName(flatName);
573
+ const sourceForm = path ? `${prefix}.${path}` : prefix;
574
+ const binding = `=${sourceForm}`;
575
+ const description = prop?.description ?? `Bound from ${sourceForm}`;
576
+ refs.push({ prefix, path, flatName, binding });
577
+ variables.push({ id: flatName, type, binding, description });
578
+ };
579
+ const visit = (key, prop, pathPrefix) => {
580
+ const flatName = pathPrefix ? `${pathPrefix}.${key}` : key;
581
+ const childProps = getContainerChildProps(prop);
582
+ if (childProps) {
583
+ for (const [childKey, childProp] of Object.entries(childProps))
584
+ visit(childKey, childProp, flatName);
585
+ return;
586
+ }
587
+ emitLeaf(flatName, prop);
588
+ };
589
+ for (const [key, prop] of Object.entries(properties))
590
+ visit(key, prop, "");
591
+ return { refs, variables };
592
+ }
593
+ function collectArtifactDescendants(rootId, edges) {
594
+ const artifactChildrenByParent = /* @__PURE__ */ new Map;
595
+ for (const edge of edges) {
596
+ if (edge.type !== "artifact")
597
+ continue;
598
+ const list = artifactChildrenByParent.get(edge.source) ?? [];
599
+ list.push(edge.target);
600
+ artifactChildrenByParent.set(edge.source, list);
601
+ }
602
+ const out = /* @__PURE__ */ new Set;
603
+ const queue = [rootId];
604
+ while (queue.length > 0) {
605
+ const id = queue.shift();
606
+ if (!id)
607
+ break;
608
+ const children = artifactChildrenByParent.get(id);
609
+ if (!children)
610
+ continue;
611
+ for (const child of children) {
612
+ if (out.has(child))
613
+ continue;
614
+ out.add(child);
615
+ queue.push(child);
616
+ }
617
+ }
618
+ return out;
619
+ }
620
+ var ANALYZEFILES_NODE_TYPE = "uipath.agent.resource.tool.builtin.analyzefiles";
621
+ function isArrayTypedRef(ref, resolveSourceType, ancestorLoopInfo) {
622
+ const loopEntry = ancestorLoopInfo ? tryBuildLoopBinding(ref, ancestorLoopInfo) : undefined;
623
+ if (loopEntry)
624
+ return loopEntry.type === "array";
625
+ return resolveSourceType?.(ref) === "array";
626
+ }
627
+ function mergeAnalyzeFilesInputs(variables, agentId, nodesById, edges, encoding = DEFAULT_AGENT_INPUT_ENCODING, resolveSourceType, ancestorLoopInfo) {
628
+ let descendants = collectArtifactDescendants(agentId, edges);
629
+ if (descendants.size === 0) {
630
+ descendants = new Set(edges.filter((e) => e.source === agentId).map((e) => e.target));
631
+ }
632
+ const supersededVarIds = /* @__PURE__ */ new Set;
633
+ const syntheticVars = [];
634
+ for (const descId of descendants) {
635
+ const node = nodesById.get(descId);
636
+ if (!node)
637
+ continue;
638
+ const nodeType = node.data?.type ?? node.type;
639
+ if (nodeType !== ANALYZEFILES_NODE_TYPE)
640
+ continue;
641
+ const nodeInputs = node.data?.inputs ?? node.inputs;
642
+ const rawItems = nodeInputs?.itemsDescription;
643
+ if (!Array.isArray(rawItems) || rawItems.length < 1)
644
+ continue;
645
+ const fileBindings = [];
646
+ for (const item of rawItems) {
647
+ const text = unwrapFlowExpression(item);
648
+ if (!text.trim())
649
+ continue;
650
+ const refs = extractSourceRefs(text, encoding);
651
+ for (const ref of refs) {
652
+ supersededVarIds.add(ref.flatName);
653
+ fileBindings.push(isArrayTypedRef(ref, resolveSourceType, ancestorLoopInfo) ? `...$vars.${ref.path}` : `$vars.${ref.path}`);
654
+ }
655
+ }
656
+ if (fileBindings.length === 0)
657
+ continue;
658
+ const existingIds = new Set(variables.map((v) => v.id));
659
+ let syntheticId = filesInputKey(descId);
660
+ while (existingIds.has(syntheticId)) {
661
+ syntheticId = `_${syntheticId}`;
662
+ }
663
+ syntheticVars.push({
664
+ id: syntheticId,
665
+ type: "array",
666
+ binding: `=[${fileBindings.join(", ")}]`,
667
+ description: "Combined file attachments for Analyze Files tool",
668
+ schema: {
669
+ type: "array",
670
+ items: { $ref: "#/definitions/job-attachment" },
671
+ definitions: { "job-attachment": JobAttachmentSchema }
672
+ }
673
+ });
674
+ }
675
+ if (syntheticVars.length === 0)
676
+ return variables;
677
+ const filtered = variables.filter((v) => !supersededVarIds.has(v.id));
678
+ return [...filtered, ...syntheticVars];
679
+ }
680
+ function mergeCompositeConnectorInputs(variables, agentId, nodesById, edges) {
681
+ let descendants = collectArtifactDescendants(agentId, edges);
682
+ if (descendants.size === 0) {
683
+ descendants = new Set(edges.filter((e) => e.source === agentId).map((e) => e.target));
684
+ }
685
+ const existingIds = new Set(variables.map((v) => v.id));
686
+ const synthetic = [];
687
+ for (const descId of descendants) {
688
+ const node = nodesById.get(descId);
689
+ const nodeType = node?.data?.type ?? node?.type;
690
+ if (!node || !nodeType?.startsWith("uipath.agent.resource.tool.connector"))
691
+ continue;
692
+ for (const input of collectCompositeConnectorInputs(node)) {
693
+ if (existingIds.has(input.id))
694
+ continue;
695
+ existingIds.add(input.id);
696
+ synthetic.push(input);
697
+ }
698
+ }
699
+ return synthetic.length === 0 ? variables : [...variables, ...synthetic];
700
+ }
701
+ function deriveMergedAgentInputVariables(rawVariables, agentId, nodes, edges, encoding = DEFAULT_AGENT_INPUT_ENCODING, resolveSourceType) {
702
+ const nodesById = new Map(nodes.map((n) => [n.id, n]));
703
+ const withFiles = mergeAnalyzeFilesInputs(rawVariables, agentId, nodesById, edges, encoding, resolveSourceType);
704
+ return mergeCompositeConnectorInputs(withFiles, agentId, nodesById, edges);
705
+ }
706
+ function preDeriveAgentInputDefinitions(nodes, edges, options = {}) {
707
+ const { resolveSourceType, pruneUnreferenced, processedAgentIds, getAncestorLoops, encoding = DEFAULT_AGENT_INPUT_ENCODING } = options;
708
+ const nodesById = /* @__PURE__ */ new Map;
709
+ for (const n of nodes)
710
+ nodesById.set(n.id, n);
711
+ for (const agent of nodes) {
712
+ const type = agent.data?.type ?? agent.type;
713
+ if (!isAgentNodeType(type))
714
+ continue;
715
+ if (!agent.data)
716
+ continue;
717
+ if (processedAgentIds?.has(agent.id))
718
+ continue;
719
+ const ancestorLoops = getAncestorLoops?.(agent.id) ?? [];
720
+ let ancestorLoopInfo;
721
+ if (ancestorLoops.length > 0) {
722
+ ancestorLoopInfo = /* @__PURE__ */ new Map;
723
+ ancestorLoops.forEach((loop, idx) => ancestorLoopInfo.set(loop.id, { index: idx, collectionExpr: loop.collectionExpr }));
724
+ }
725
+ const { variables } = scanAgentClusterRefs(agent, nodesById, edges, resolveSourceType, ancestorLoopInfo, pruneUnreferenced, encoding);
726
+ const withFiles = mergeAnalyzeFilesInputs(variables, agent.id, nodesById, edges, encoding, resolveSourceType, ancestorLoopInfo);
727
+ const mergedVariables = mergeCompositeConnectorInputs(withFiles, agent.id, nodesById, edges);
728
+ if (!agent.data.inputs)
729
+ agent.data.inputs = {};
730
+ agent.data.inputs.derivedInputDefinition = buildDerivedInputDefinition(mergedVariables, encoding);
731
+ processedAgentIds?.add(agent.id);
732
+ }
733
+ }
734
+ function toJsExpression(binding) {
735
+ if (!binding)
736
+ return binding;
737
+ if (binding.startsWith("=js:"))
738
+ return binding;
739
+ if (binding.startsWith("="))
740
+ return `=js:${binding.slice(1)}`;
741
+ return `=js:${binding}`;
742
+ }
743
+ function bindingExprBody(binding) {
744
+ if (!binding)
745
+ return binding;
746
+ if (binding.startsWith("=js:"))
747
+ return binding.slice(4);
748
+ if (binding.startsWith("="))
749
+ return binding.slice(1);
750
+ return binding;
751
+ }
752
+ function objectLiteralKey(key) {
753
+ const isSafeIdent = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key);
754
+ if (isSafeIdent && key !== "__proto__")
755
+ return key;
756
+ return `[${JSON.stringify(key)}]`;
757
+ }
758
+ var ExprLeaf = class {
759
+ constructor(body) {
760
+ this.body = body;
761
+ }
762
+ };
763
+ function insertValueLeaf(root, path, exprBody) {
764
+ let node = root;
765
+ for (let i = 0;i < path.length - 1; i++) {
766
+ const existing = node.get(path[i]);
767
+ if (existing instanceof ExprLeaf)
768
+ return;
769
+ if (existing) {
770
+ node = existing;
771
+ } else {
772
+ const child = /* @__PURE__ */ new Map;
773
+ node.set(path[i], child);
774
+ node = child;
775
+ }
776
+ }
777
+ const last = path.at(-1);
778
+ if (node.get(last) instanceof Map)
779
+ return;
780
+ node.set(last, new ExprLeaf(exprBody));
781
+ }
782
+ function emitValueTree(node) {
783
+ if (node instanceof ExprLeaf)
784
+ return node.body;
785
+ const parts = [];
786
+ for (const [key, child] of node)
787
+ parts.push(`${objectLiteralKey(key)}: ${emitValueTree(child)}`);
788
+ return `{${parts.join(", ")}}`;
789
+ }
790
+ function buildRootObjectLiteral(entries) {
791
+ const root = /* @__PURE__ */ new Map;
792
+ for (const { path, exprBody } of [...entries].sort((a, b) => a.path.length - b.path.length)) {
793
+ if (path.length > 0)
794
+ insertValueLeaf(root, path, exprBody);
795
+ }
796
+ return emitValueTree(root);
797
+ }
798
+ function warnIfArrayRootDrop(rootType, id, root, segs) {
799
+ if (rootType !== "array")
800
+ return;
801
+ console.warn(`[agent-cluster-rewrite] dropping agent input "${id}": root "${root}" is an array, so the runtime cannot navigate ".${segs.slice(1).join(".")}" off it. Bind "$vars.${id}" to a workflow variable instead.`);
802
+ }
803
+ function flatInputEntry(d) {
804
+ if (!d.binding)
805
+ return null;
806
+ const entry = { name: d.id, value: toJsExpression(d.binding) };
807
+ if (d.type && d.type !== "string")
808
+ entry.type = d.type;
809
+ return entry;
810
+ }
811
+ function buildDerivedInputDefinition(variables, encoding = DEFAULT_AGENT_INPUT_ENCODING) {
812
+ return encoding === "flat" ? buildFlatInputDefinition(variables) : buildNestedInputDefinition(variables);
813
+ }
814
+ function buildFlatInputDefinition(variables) {
815
+ const flat = [];
816
+ const seen = /* @__PURE__ */ new Set;
817
+ for (const d of variables) {
818
+ let name = d.id;
819
+ if (!isSyntheticAgentInputId(d.id)) {
820
+ const { prefix, path } = decodeFlatName(d.id);
821
+ name = encodeFlatName(prefix, path, "flat");
822
+ }
823
+ const entry = flatInputEntry({ ...d, id: name });
824
+ if (!entry || seen.has(entry.name))
825
+ continue;
826
+ seen.add(entry.name);
827
+ flat.push(entry);
828
+ }
829
+ return flat;
830
+ }
831
+ function buildNestedInputDefinition(variables) {
832
+ const rootOrder = [];
833
+ const rootGroups = /* @__PURE__ */ new Map;
834
+ const flat = [];
835
+ const wholeRoots = new Set(variables.filter((d) => !d.id.includes(".") && d.binding).map((d) => d.id));
836
+ const typeById = new Map(variables.map((d) => [d.id, d.type]));
837
+ for (const d of variables) {
838
+ const segs = d.id.split(".");
839
+ const root = segs[0];
840
+ if (segs.length === 1) {
841
+ const entry = flatInputEntry(d);
842
+ if (entry)
843
+ flat.push(entry);
844
+ continue;
845
+ }
846
+ if (wholeRoots.has(root)) {
847
+ warnIfArrayRootDrop(typeById.get(root), d.id, root, segs);
848
+ continue;
849
+ }
850
+ if (!d.binding)
851
+ continue;
852
+ let group = rootGroups.get(root);
853
+ if (!group) {
854
+ group = [];
855
+ rootGroups.set(root, group);
856
+ rootOrder.push(root);
857
+ }
858
+ group.push({ path: segs.slice(1), exprBody: bindingExprBody(d.binding) });
859
+ }
860
+ const nested = rootOrder.map((root) => ({
861
+ name: root,
862
+ type: "object",
863
+ value: `=js:(${buildRootObjectLiteral(rootGroups.get(root) ?? [])})`
864
+ }));
865
+ return [...nested, ...flat];
866
+ }
867
+ function rewriteStringsDeep(value, fn) {
868
+ if (value == null)
869
+ return value;
870
+ if (typeof value === "string")
871
+ return fn(value);
872
+ if (Array.isArray(value)) {
873
+ let changed = false;
874
+ const next = value.map((v) => {
875
+ const nv = rewriteStringsDeep(v, fn);
876
+ if (nv !== v)
877
+ changed = true;
878
+ return nv;
879
+ });
880
+ return changed ? next : value;
881
+ }
882
+ if (typeof value === "object") {
883
+ const entries = Object.entries(value);
884
+ let changed = false;
885
+ const next = {};
886
+ for (const [k, v] of entries) {
887
+ const nv = rewriteStringsDeep(v, fn);
888
+ if (nv !== v)
889
+ changed = true;
890
+ next[k] = nv;
891
+ }
892
+ return changed ? next : value;
893
+ }
894
+ return value;
895
+ }
896
+
897
+ export { DEFAULT_AGENT_INPUT_ENCODING, SCHEMA_CONTAINER_MARKER, getContainerChildProps, extractAgentInputName, isCompositeConnectorValue, compositeConnectorInputKey, collectCompositeConnectorInputs, isUnsafeKey, rewriteInputTokensToSource, UnresolvedAgentInputTypeError, AmbiguousAgentInputRootError, detectAmbiguousAgentInputRoot, buildAgentInputTypeResolver, canPruneAgentInputs, deriveAgentInputVariables, scanSourceRefsDeep, collectInlineAgentClusterInputs, collectInlineAgentInputsFromAgent, collectArtifactDescendants, mergeCompositeConnectorInputs, deriveMergedAgentInputVariables, preDeriveAgentInputDefinitions, buildDerivedInputDefinition, rewriteStringsDeep };
898
+
899
+ //# debugId=F0A5A094082DBDFB64756E2164756E21