@uipath/maestro-builder-sdk 6.23.0 → 6.25.0

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 (46) hide show
  1. package/dist/api-index.md +121 -121
  2. package/dist/api-members.md +362 -362
  3. package/dist/check.js +1 -444
  4. package/dist/core/actions.d.ts +0 -404
  5. package/dist/core/actions.js +0 -111
  6. package/dist/core/form-field-type.d.ts +16 -0
  7. package/dist/core/form-field-type.js +33 -0
  8. package/dist/core/hitl-routing.d.ts +17 -3
  9. package/dist/core/stable-id.d.ts +9 -0
  10. package/dist/core/stable-id.js +16 -0
  11. package/dist/core/step-ports.d.ts +25 -1
  12. package/dist/core/step-ports.js +6 -47
  13. package/dist/core/typed-raw-node.js +0 -11
  14. package/dist/decompile.js +7 -235
  15. package/dist/flow-node-registry.js +3 -1
  16. package/dist/flow-node-type.d.ts +45 -1
  17. package/dist/flow-sdk.d.ts +2 -0
  18. package/dist/flow-sdk.js +2 -0
  19. package/dist/flow-step-exits.js +1 -1
  20. package/dist/nodes/conversation/flow/check.d.ts +17 -0
  21. package/dist/nodes/conversation/flow/check.js +54 -0
  22. package/dist/nodes/conversation/flow/factories.d.ts +58 -0
  23. package/dist/nodes/conversation/flow/factories.js +63 -0
  24. package/dist/nodes/conversation/flow/family.d.ts +3 -0
  25. package/dist/nodes/conversation/flow/family.js +8 -0
  26. package/dist/nodes/conversation/flow/index.d.ts +3 -0
  27. package/dist/nodes/conversation/flow/index.js +3 -0
  28. package/dist/nodes/conversation/flow/node-type.d.ts +14 -0
  29. package/dist/nodes/conversation/flow/node-type.js +117 -0
  30. package/dist/nodes/conversation/flow/spec.d.ts +60 -0
  31. package/dist/nodes/conversation/flow/spec.js +1 -0
  32. package/dist/nodes/hitl/flow/check.d.ts +38 -0
  33. package/dist/nodes/hitl/flow/check.js +357 -0
  34. package/dist/nodes/hitl/flow/factories.d.ts +58 -0
  35. package/dist/nodes/hitl/flow/factories.js +59 -0
  36. package/dist/nodes/hitl/flow/family.d.ts +3 -0
  37. package/dist/nodes/hitl/flow/family.js +8 -0
  38. package/dist/nodes/hitl/flow/index.d.ts +3 -0
  39. package/dist/nodes/hitl/flow/index.js +3 -0
  40. package/dist/nodes/hitl/flow/node-type.d.ts +7 -0
  41. package/dist/nodes/hitl/flow/node-type.js +601 -0
  42. package/dist/nodes/hitl/flow/spec.d.ts +265 -0
  43. package/dist/nodes/hitl/flow/spec.js +1 -0
  44. package/dist/serialize.d.ts +2 -4
  45. package/dist/serialize.js +35 -392
  46. package/package.json +2 -2
@@ -106,291 +106,6 @@ export interface InOutField {
106
106
  required?: boolean;
107
107
  }
108
108
  export type FormField = ShownField | AskedField | InOutField;
109
- /**
110
- * Where the task is delivered. The four ids are the platform's own — including
111
- * the lowercase `'teams'`, which is how every deployed recipient spells
112
- * Microsoft Teams (the canvas's channel list, `hitl-types.ts`).
113
- */
114
- export type HitlChannel = 'Slack' | 'teams' | 'Email' | 'ActionCenter';
115
- /**
116
- * How the task is assigned, the platform's own vocabulary (canvas
117
- * `HITL_ASSIGNEE_TYPE`): `'user'` a single user, `'group'` all users of a
118
- * group, `'staticEmail'`/`'staticGroupName'` literal values instead of
119
- * directory picks, `'workload'`/`'roundRobin'` distribution over a group, and
120
- * `'custom'` an expression the engine evaluates (`value` holds it).
121
- */
122
- export type HitlAssigneeType = 'user' | 'group' | 'staticEmail' | 'staticGroupName' | 'workload' | 'roundRobin' | 'custom';
123
- /** A per-channel Integration Service connection (Slack / Teams delivery). */
124
- export interface HitlConnection {
125
- /** The connection's display name. */
126
- name?: string | null;
127
- /** The connection key the engine resolves, e.g. `'Slack'` for the default. */
128
- key: string;
129
- /** Folder the connection lives in; `null` for tenant-level defaults. */
130
- folderPath?: string | null;
131
- }
132
- /**
133
- * Who gets the task and over which channels. Omit the whole object for the
134
- * definition's default (Email + Action Center, assigned to a group) — which is
135
- * what 203 of 233 deployed v1 human tasks carry, and what this SDK has always
136
- * emitted.
137
- *
138
- * ```ts
139
- * hitl({
140
- * recipient: {
141
- * channels: ['Email', 'ActionCenter'],
142
- * assignee: { type: 'user', value: 'reviewer@acme.test' },
143
- * },
144
- * …
145
- * })
146
- * ```
147
- */
148
- export interface HitlRecipient {
149
- /** Delivery channels. Defaults to the emitted definition's own default set. */
150
- channels?: HitlChannel[];
151
- /** Who the task is assigned to. */
152
- assignee: {
153
- type: HitlAssigneeType;
154
- /**
155
- * The user email / group name / expression, per `type`. The engine lowers
156
- * this to its `{ Value, Type }` recipient contract; without one the task
157
- * falls back to the tenant's assignment default.
158
- */
159
- value?: string;
160
- /** Display name the designer shows next to the pick. Cosmetic. */
161
- displayName?: string;
162
- };
163
- /**
164
- * Per-channel connections, keyed by channel id (`Slack` / `teams`). Only the
165
- * connector-backed channels take one; Email and Action Center do not.
166
- */
167
- connections?: Partial<Record<'Slack' | 'teams', HitlConnection>>;
168
- }
169
- /**
170
- * The Document Validation task's subject — `variant: 'document-validation'`
171
- * only. The reviewer gets the platform's validation station (or a custom app
172
- * with a Validation Control) over a document and its extraction result.
173
- */
174
- export interface DocValidationInputs {
175
- /**
176
- * The extraction result to validate — bind the `ExtractionResult` output of
177
- * an upstream Extract step, e.g. `out('extract', 'ExtractionResult')`.
178
- * Required: the station has nothing to validate without it.
179
- */
180
- extractionResult: Expr | string;
181
- /** Storage bucket id holding the document. */
182
- storageBucket?: string;
183
- /** The document's id within the bucket. */
184
- documentId?: string;
185
- /**
186
- * `'standard'` (default) for the native validation station, `'custom'` for a
187
- * custom app with a Validation Control — which then requires `taxonomy`.
188
- */
189
- render?: 'standard' | 'custom';
190
- /** The taxonomy the custom app validates against. Required when `render: 'custom'`. */
191
- taxonomy?: Expr | string;
192
- }
193
- /**
194
- * One completion button. `action: 'End'` marks an outcome that ENDS the process
195
- * rather than continuing (the platform's own two-value vocabulary — anything
196
- * that is not exactly `'End'` reads as continue).
197
- *
198
- * `id` is the outcome's wire id — `schema.outcomes[].id`, and the `outcome-<id>`
199
- * port its edge leaves from. Leave it out and the id is a slug of `name`
200
- * (`'Needs info'` → `needs-info`). Set it only to keep an id a flow already
201
- * has, as decompile does for a task the designer drew
202
- * (`{ name: 'Reject', id: 'outcome-1778015958049' }`): merge keeps the
203
- * original node, so its edges must use that node's ids.
204
- *
205
- * @remarks
206
- * A bare string is shorthand for `{ name }`.
207
- */
208
- export type Outcome = string | {
209
- name: string;
210
- action?: 'Continue' | 'End';
211
- id?: string;
212
- };
213
- /**
214
- * WHICH human-task node type to emit. The platform ships three spellings of the
215
- * same node; two of them resolve on this tenant and are what this option picks.
216
- *
217
- * @remarks
218
- * - **omitted** — `uipath.human-in-the-loop`, the original node, which chooses
219
- * the form kind with `inputs.type: 'quick'`. This is the default and it does
220
- * not change: it is where the platform's own versioning continues, and 319 of
221
- * the corpus's human tasks are on it.
222
- * - **`'quick-form'`** — `uipath.human-in-the-loop.quick-form`. Same inline form,
223
- * but the node TYPE is the "quick" choice, so no `inputs.type` is written
224
- * (165 of its 175 deployed instances omit it). Everything you author is
225
- * identical; pick it when something downstream keys on the literal type
226
- * string, which flow-v1's own task checkers do.
227
- * - **`'action-app'`** — `uipath.human-in-the-loop.coded-action-app`. The form is
228
- * NOT in the flow: it belongs to a deployed Action App, named by `app`. You
229
- * still declare `outcomes` (the flow routes on them); you must NOT declare
230
- * `fields` (the app owns them) — `check` says so.
231
- *
232
- * - **`'document-validation'`** — `uipath.human-in-the-loop.document-validation`.
233
- * A validation station over a document + extraction result, named by
234
- * `document`. No `fields` (the station is the form); `outcomes` still route.
235
- * The definition is BUNDLED from the workbench manifest — the tenant registry
236
- * does not serve the family (same availability note as do-while).
237
- */
238
- export type HitlVariant = 'quick-form' | 'action-app' | 'document-validation';
239
- /**
240
- * A deployed Action App that supplies a human task's form — the `'action-app'`
241
- * variant's subject.
242
- *
243
- * @remarks
244
- * The names are the platform's own, from flow-v1's app picker: an app is closed
245
- * by `key` (its GUID) plus the `folderPath` it is deployed in, with `name` the
246
- * human-readable title. This SDK is offline and never calls the Apps API, so
247
- * what you write here is what you already know about the app.
248
- *
249
- * ```ts
250
- * hitl({
251
- * variant: 'action-app',
252
- * app: {
253
- * name: 'Expense Review',
254
- * key: 'c0ba97df-8a30-4fe0-b4b4-4611a631d77b',
255
- * folderPath: 'Shared',
256
- * inputs: { 'Expense Amount': out('fetchExpense', 'total') },
257
- * },
258
- * outcomes: ['Approve', 'Reject'],
259
- * })
260
- * ```
261
- */
262
- export interface AppRef {
263
- /** The app's display title, e.g. `'Expense Review'`. */
264
- name: string;
265
- /** The app's key (a GUID) — how the platform resolves which app this is. */
266
- key: string;
267
- /** Fully-qualified folder the app is deployed in, e.g. `'Shared'`. */
268
- folderPath: string;
269
- /**
270
- * The app's stable system name. `null` until the app's first deployment
271
- * assigns one, which is why it is optional and why `null` is a legal value
272
- * rather than something to omit.
273
- */
274
- appSystemName?: string | null;
275
- /**
276
- * What to send the app, keyed by the app's OWN input parameter names — so the
277
- * keys are the app author's, spaces and all (`'Invoice Amount'`), not
278
- * identifiers of ours. Values are references, e.g. `out('step', 'field')`.
279
- *
280
- * Emitted as `inputs.appInputBindings`, the map flow-v1's serializer turns
281
- * into the task's `HitlTaskArguments`.
282
- */
283
- inputs?: Record<string, Expr | string>;
284
- }
285
- export interface HitlInputs {
286
- /**
287
- * Which human-task node type to emit. Omit it for today's default — see
288
- * {@link HitlVariant}. Omitting it emits exactly what it always has.
289
- */
290
- variant?: HitlVariant;
291
- /**
292
- * The deployed Action App that owns this task's form. Required by — and only
293
- * legal with — `variant: 'action-app'`.
294
- */
295
- app?: AppRef;
296
- /** Task title the reviewer sees. Defaults to the step's label. */
297
- title?: string;
298
- /** Action Center priority. Defaults to `'Low'`. */
299
- priority?: 'Low' | 'Medium' | 'High';
300
- /**
301
- * The form, as an array of field descriptors — `direction: 'input'` for a value
302
- * the reviewer reads, `'output'` for one they fill in. An array (not a map)
303
- * because the ids are yours and order is the order on the form.
304
- *
305
- * Required for the inline-form variants (the default and `'quick-form'`).
306
- * FORBIDDEN with `variant: 'action-app'`, where the form belongs to the
307
- * deployed app rather than to the flow — `check` says so both ways.
308
- */
309
- fields?: FormField[];
310
- /**
311
- * The completion buttons, e.g. `['Approve', 'Reject']`. At least one, or the
312
- * reviewer has no way to complete the task and the flow waits forever. The
313
- * first is the primary (default) one. Each outcome is its own exit,
314
- * `outcome-<slug>`: the default node and `'quick-form'` never leave on
315
- * `completed` once they have outcomes. On the default node MORE THAN ONE
316
- * outcome routes per outcome: the first continues the main path and the rest
317
- * are routed with `.stepToList('outcome-<slug>', …)`. With `'quick-form'`,
318
- * {@link HitlInputs.outcomePorts | outcomePorts}`: false`, an explicit
319
- * `{ version }` or one outcome, `.step()` continues EVERY outcome instead.
320
- *
321
- * Which one they pressed is also `out('<step>', 'Action')` — that is what the
322
- * platform's own routing conditions compare against.
323
- */
324
- outcomes: Outcome[];
325
- /** Who gets the task and how. Omit for the definition's default delivery. */
326
- recipient?: HitlRecipient;
327
- /** Action Center labels, comma-separated (the platform stores one string). */
328
- labels?: string;
329
- /**
330
- * Whether the task ROUTES per outcome. Each outcome has its own exit either
331
- * way (`outcome-<id>`, the name slugified: `'Approve'` → `outcome-approve`).
332
- *
333
- * `true`: the FIRST outcome continues the main path and the others are routed
334
- * with `.stepToList('outcome-<id>', …)`, or the run stalls when the reviewer
335
- * picks one. The default node with more than one outcome already does this,
336
- * on its **1.1** definition unless a `{ version }` pins another; `'quick-form'`
337
- * supports it on its one definition. `false`: EVERY outcome continues to the
338
- * next step on its own edge — a task that routes the decision as DATA by
339
- * reading `out('<step>', 'Action')`; `'quick-form'` does this by default.
340
- * `'action-app'` and `'document-validation'` read their outcomes from the app
341
- * and leave on their one `completed` exit, so `true` is refused there.
342
- */
343
- outcomePorts?: boolean;
344
- /**
345
- * Expose the task's runtime error as a bindable `out('<step>', 'error')`
346
- * object (`{ code, message, detail, category, status }`). Selects the node's
347
- * **1.2** definition — which also routes per outcome, so this implies
348
- * {@link HitlInputs.outcomePorts | outcomePorts}. Default node only.
349
- */
350
- exposeError?: boolean;
351
- /**
352
- * The document to validate. Required by — and only legal with —
353
- * `variant: 'document-validation'`.
354
- */
355
- document?: DocValidationInputs;
356
- }
357
- export interface SendMessageInputs {
358
- /**
359
- * The conversation to post into — from the conversation trigger
360
- * (`out('start', 'conversationId')`) or a context read. Required.
361
- */
362
- conversationId: string | Expr;
363
- /**
364
- * The exchange (one user turn plus its answers) the message belongs to —
365
- * `out('<waitStep>', 'conversationContext.latestExchangeId')`, or the
366
- * trigger's exchange for the first answer. Required by the node's schema.
367
- */
368
- exchangeId: string | Expr;
369
- /** What to say. Markdown — the node's only supported `mimeType`. Required. */
370
- content: string | Expr;
371
- /**
372
- * Whether this message CLOSES the exchange. The platform's legacy default is
373
- * to end it; pass `false` to keep the exchange open for another message.
374
- */
375
- endExchange?: boolean;
376
- }
377
- export interface WaitForMessageInputs {
378
- /** The conversation to wait on. Required. */
379
- conversationId: string | Expr;
380
- /**
381
- * How many past exchanges the returned context carries. 1–40 in the
382
- * designer; the platform default is 20.
383
- */
384
- numExchanges?: number;
385
- }
386
- export interface ConversationContextInputs {
387
- /** The conversation to read. Required. */
388
- conversationId: string | Expr;
389
- /**
390
- * How many exchanges to return, 1–40. The platform default is 20.
391
- */
392
- exchangeLimit?: number;
393
- }
394
109
  /**
395
110
  * How a conversational agent gets its turn — the node's own
396
111
  * `conversationalAgentSettings` sub-object.
@@ -1737,10 +1452,6 @@ export interface ContextIndexRef {
1737
1452
  * whole body rather than an inputs payload.
1738
1453
  */
1739
1454
  export interface FlowActionSpecs {
1740
- /** The spec {@link hitl} builds. */
1741
- hitl: {
1742
- inputs: HitlInputs;
1743
- };
1744
1455
  /** The spec {@link rpaWorkflow} builds. */
1745
1456
  rpaWorkflow: {
1746
1457
  inputs: RpaWorkflowInputs;
@@ -1753,18 +1464,6 @@ export interface FlowActionSpecs {
1753
1464
  publishedFunction: {
1754
1465
  inputs: PublishedFunctionInputs;
1755
1466
  };
1756
- /** The spec {@link sendMessage} builds. */
1757
- sendMessage: {
1758
- inputs: SendMessageInputs;
1759
- };
1760
- /** The spec {@link waitForMessage} builds. */
1761
- waitForMessage: {
1762
- inputs: WaitForMessageInputs;
1763
- };
1764
- /** The spec {@link conversationContext} builds. */
1765
- conversationContext: {
1766
- inputs: ConversationContextInputs;
1767
- };
1768
1467
  /** The spec {@link createOutgoingCall} builds. */
1769
1468
  createOutgoingCall: {
1770
1469
  inputs: CreateOutgoingCallInputs;
@@ -1856,58 +1555,6 @@ export declare function builtinActionSpec<S extends object>(spec: S): S;
1856
1555
  * @returns The same spec, as a `FlowTrigger` instance.
1857
1556
  */
1858
1557
  export declare function builtinTriggerSpec<S extends object>(spec: S): S;
1859
- /**
1860
- * Declare a human task — a step that pauses for a person to read some values,
1861
- * fill others in, and press one of the outcome buttons.
1862
- *
1863
- * @remarks
1864
- * Read an answer with `out('review', '<fieldId>')`, and which button they pressed
1865
- * with `out('review', 'Action')` — branch on that for per-outcome routing.
1866
- *
1867
- * ### Picking a node type with `variant`
1868
- *
1869
- * The example above emits `uipath.human-in-the-loop`, the original node, and
1870
- * that stays the default. Two other spellings of the same human task exist
1871
- * ({@link HitlVariant}), and `variant` is how you say which:
1872
- *
1873
- * ```ts
1874
- * // Same inline form, the newer node type — no `inputs.type` is written.
1875
- * hitl({ variant: 'quick-form', fields: […], outcomes: ['Approve', 'Reject'] })
1876
- *
1877
- * // The form lives in a DEPLOYED APP: no `fields`, but still your outcomes.
1878
- * hitl({
1879
- * variant: 'action-app',
1880
- * app: { name: 'Expense Review', key: '<guid>', folderPath: 'Shared',
1881
- * inputs: { 'Expense Amount': out('fetchExpense', 'total') } },
1882
- * outcomes: ['Approve', 'Reject'],
1883
- * })
1884
- * ```
1885
- *
1886
- * What every variant shares: one `completed` port, and the same two outputs
1887
- * (`output`, carrying the answers, and `status`, carrying the outcome name) —
1888
- * all three definitions declare them identically, so downstream reads do not
1889
- * change when you switch.
1890
- *
1891
- * @example
1892
- * **Pause for a person to approve, then read their decision**
1893
- * ```ts
1894
- * .step('review', hitl({
1895
- * title: 'Review Expense',
1896
- * fields: [
1897
- * { id: 'amount', type: 'number', direction: 'input', value: input('amount') },
1898
- * { id: 'approved', type: 'boolean', direction: 'output' },
1899
- * { id: 'comments', type: 'text', direction: 'output' },
1900
- * ],
1901
- * outcomes: ['Approve', 'Reject'],
1902
- * }))
1903
- * .step('log', script({ code: 'return "Decision: " + $vars.review.output.approved;' }))
1904
- * ```
1905
- *
1906
- * @param inputs - The form's fields, outcomes and recipient.
1907
- * @returns An action spec for `.step(...)`.
1908
- * @example example-eval/GallerySubmission.flow.ts
1909
- */
1910
- export declare function hitl(inputs: HitlInputs): ActionSpec;
1911
1558
  /**
1912
1559
  * Extract fields from a document with a published IxP project — the platform's
1913
1560
  * **Extract** node (`uipath.ixp.*`, service contract `IXP.Extraction`).
@@ -2068,57 +1715,6 @@ export declare function apiWorkflow(inputs: ApiWorkflowInputs): ActionSpec;
2068
1715
  * @returns An action spec to pass to `.step(...)`.
2069
1716
  */
2070
1717
  export declare function publishedFunction(inputs: PublishedFunctionInputs): ActionSpec;
2071
- /**
2072
- * Post an assistant message into a live conversation
2073
- * (`uipath.conversational.send-message`).
2074
- *
2075
- * ```ts
2076
- * .step('answer', sendMessage({
2077
- * conversationId: out('start', 'conversationId'),
2078
- * exchangeId: out('listen', 'conversationContext.latestExchangeId'),
2079
- * content: 'Your order ships tomorrow.',
2080
- * }))
2081
- * ```
2082
- *
2083
- * The message is Markdown (`text/markdown` is the node's only supported type)
2084
- * and the role is always `assistant` — a flow speaks as the assistant.
2085
- *
2086
- * @param inputs - The conversation, the exchange, and what to say.
2087
- * @returns An action spec to pass to `.step(...)`.
2088
- */
2089
- export declare function sendMessage(inputs: SendMessageInputs): ActionSpec;
2090
- /**
2091
- * PAUSE until the person sends their next message
2092
- * (`uipath.conversational.wait-for-message`) — a catch event, like
2093
- * `waitForEvent`, so the flow suspends rather than polling.
2094
- *
2095
- * ```ts
2096
- * .step('listen', waitForMessage({ conversationId: out('start', 'conversationId') }))
2097
- * ```
2098
- *
2099
- * It resumes with the conversation context:
2100
- * `out('listen', 'conversationContext.messages')` is the transcript and
2101
- * `…conversationContext.latestExchangeId` is the turn to answer.
2102
- *
2103
- * @param inputs - The conversation to wait on, and how much history to return.
2104
- * @returns An action spec to pass to `.step(...)`.
2105
- */
2106
- export declare function waitForMessage(inputs: WaitForMessageInputs): ActionSpec;
2107
- /**
2108
- * READ a conversation's transcript so far without waiting
2109
- * (`uipath.conversational.get-conversation-context`) — the shape a
2110
- * conversational agent takes as its turn context.
2111
- *
2112
- * ```ts
2113
- * .step('history', conversationContext({
2114
- * conversationId: out('start', 'conversationId'), exchangeLimit: 10,
2115
- * }))
2116
- * ```
2117
- *
2118
- * @param inputs - The conversation to read, and how many exchanges to return.
2119
- * @returns An action spec to pass to `.step(...)`.
2120
- */
2121
- export declare function conversationContext(inputs: ConversationContextInputs): ActionSpec;
2122
1718
  /**
2123
1719
  * Place an outgoing phone call
2124
1720
  * (`uipath.conversational.voice.create-outgoing-call`) and get back the
@@ -88,60 +88,6 @@ export function builtinActionSpec(spec) {
88
88
  export function builtinTriggerSpec(spec) {
89
89
  return new BuiltinTrigger(spec);
90
90
  }
91
- /**
92
- * Declare a human task — a step that pauses for a person to read some values,
93
- * fill others in, and press one of the outcome buttons.
94
- *
95
- * @remarks
96
- * Read an answer with `out('review', '<fieldId>')`, and which button they pressed
97
- * with `out('review', 'Action')` — branch on that for per-outcome routing.
98
- *
99
- * ### Picking a node type with `variant`
100
- *
101
- * The example above emits `uipath.human-in-the-loop`, the original node, and
102
- * that stays the default. Two other spellings of the same human task exist
103
- * ({@link HitlVariant}), and `variant` is how you say which:
104
- *
105
- * ```ts
106
- * // Same inline form, the newer node type — no `inputs.type` is written.
107
- * hitl({ variant: 'quick-form', fields: […], outcomes: ['Approve', 'Reject'] })
108
- *
109
- * // The form lives in a DEPLOYED APP: no `fields`, but still your outcomes.
110
- * hitl({
111
- * variant: 'action-app',
112
- * app: { name: 'Expense Review', key: '<guid>', folderPath: 'Shared',
113
- * inputs: { 'Expense Amount': out('fetchExpense', 'total') } },
114
- * outcomes: ['Approve', 'Reject'],
115
- * })
116
- * ```
117
- *
118
- * What every variant shares: one `completed` port, and the same two outputs
119
- * (`output`, carrying the answers, and `status`, carrying the outcome name) —
120
- * all three definitions declare them identically, so downstream reads do not
121
- * change when you switch.
122
- *
123
- * @example
124
- * **Pause for a person to approve, then read their decision**
125
- * ```ts
126
- * .step('review', hitl({
127
- * title: 'Review Expense',
128
- * fields: [
129
- * { id: 'amount', type: 'number', direction: 'input', value: input('amount') },
130
- * { id: 'approved', type: 'boolean', direction: 'output' },
131
- * { id: 'comments', type: 'text', direction: 'output' },
132
- * ],
133
- * outcomes: ['Approve', 'Reject'],
134
- * }))
135
- * .step('log', script({ code: 'return "Decision: " + $vars.review.output.approved;' }))
136
- * ```
137
- *
138
- * @param inputs - The form's fields, outcomes and recipient.
139
- * @returns An action spec for `.step(...)`.
140
- * @example example-eval/GallerySubmission.flow.ts
141
- */
142
- export function hitl(inputs) {
143
- return builtinActionSpec({ kind: 'hitl', inputs });
144
- }
145
91
  /**
146
92
  * Extract fields from a document with a published IxP project — the platform's
147
93
  * **Extract** node (`uipath.ixp.*`, service contract `IXP.Extraction`).
@@ -310,63 +256,6 @@ export function apiWorkflow(inputs) {
310
256
  export function publishedFunction(inputs) {
311
257
  return builtinActionSpec({ kind: 'publishedFunction', inputs });
312
258
  }
313
- /**
314
- * Post an assistant message into a live conversation
315
- * (`uipath.conversational.send-message`).
316
- *
317
- * ```ts
318
- * .step('answer', sendMessage({
319
- * conversationId: out('start', 'conversationId'),
320
- * exchangeId: out('listen', 'conversationContext.latestExchangeId'),
321
- * content: 'Your order ships tomorrow.',
322
- * }))
323
- * ```
324
- *
325
- * The message is Markdown (`text/markdown` is the node's only supported type)
326
- * and the role is always `assistant` — a flow speaks as the assistant.
327
- *
328
- * @param inputs - The conversation, the exchange, and what to say.
329
- * @returns An action spec to pass to `.step(...)`.
330
- */
331
- export function sendMessage(inputs) {
332
- return builtinActionSpec({ kind: 'sendMessage', inputs });
333
- }
334
- /**
335
- * PAUSE until the person sends their next message
336
- * (`uipath.conversational.wait-for-message`) — a catch event, like
337
- * `waitForEvent`, so the flow suspends rather than polling.
338
- *
339
- * ```ts
340
- * .step('listen', waitForMessage({ conversationId: out('start', 'conversationId') }))
341
- * ```
342
- *
343
- * It resumes with the conversation context:
344
- * `out('listen', 'conversationContext.messages')` is the transcript and
345
- * `…conversationContext.latestExchangeId` is the turn to answer.
346
- *
347
- * @param inputs - The conversation to wait on, and how much history to return.
348
- * @returns An action spec to pass to `.step(...)`.
349
- */
350
- export function waitForMessage(inputs) {
351
- return builtinActionSpec({ kind: 'waitForMessage', inputs });
352
- }
353
- /**
354
- * READ a conversation's transcript so far without waiting
355
- * (`uipath.conversational.get-conversation-context`) — the shape a
356
- * conversational agent takes as its turn context.
357
- *
358
- * ```ts
359
- * .step('history', conversationContext({
360
- * conversationId: out('start', 'conversationId'), exchangeLimit: 10,
361
- * }))
362
- * ```
363
- *
364
- * @param inputs - The conversation to read, and how many exchanges to return.
365
- * @returns An action spec to pass to `.step(...)`.
366
- */
367
- export function conversationContext(inputs) {
368
- return builtinActionSpec({ kind: 'conversationContext', inputs });
369
- }
370
259
  /**
371
260
  * Place an outgoing phone call
372
261
  * (`uipath.conversational.voice.create-outgoing-call`) and get back the
@@ -31,3 +31,19 @@ import type { FormFieldType } from './actions.js';
31
31
  * sdkFormFieldType('integer') // undefined
32
32
  */
33
33
  export declare function sdkFormFieldType(wire: unknown): FormFieldType | undefined;
34
+ /**
35
+ * Why a form-field type is refused: a product spelling of a type the SDK
36
+ * models (`"string"` is the platform's own name for text), or a type
37
+ * the SDK does not model at all. `unknownWhy` is the caller's reason for the
38
+ * second case; the default is a human task's.
39
+ */
40
+ export declare function formFieldTypeWhy(type: unknown, unknownWhy?: string): string;
41
+ /** The form-field types the SDK models. */
42
+ export declare const FORM_FIELD_TYPES: string[];
43
+ /** The `suggestion` for an unknown form-field type: the nearest valid one, else `type: 'text'`. */
44
+ export declare function formFieldTypeHint(type: unknown): string;
45
+ /** JSON-Schema type per form-field type, as flow-v1's form serializer maps them (quick-form escalations and human tasks). */
46
+ export declare const FORM_FIELD_JSON_TYPE: Record<FormFieldType, {
47
+ type: string;
48
+ format?: string;
49
+ }>;
@@ -1,3 +1,4 @@
1
+ import { nearestName } from './edit-distance.js';
1
2
  const PRODUCT_SPELLINGS = {
2
3
  text: 'text',
3
4
  string: 'text',
@@ -28,3 +29,35 @@ const PRODUCT_SPELLINGS = {
28
29
  export function sdkFormFieldType(wire) {
29
30
  return typeof wire === 'string' && Object.hasOwn(PRODUCT_SPELLINGS, wire) ? PRODUCT_SPELLINGS[wire] : undefined;
30
31
  }
32
+ /**
33
+ * Why a form-field type is refused: a product spelling of a type the SDK
34
+ * models (`"string"` is the platform's own name for text), or a type
35
+ * the SDK does not model at all. `unknownWhy` is the caller's reason for the
36
+ * second case; the default is a human task's.
37
+ */
38
+ export function formFieldTypeWhy(type, unknownWhy = `which the platform does not recognize. Older runtimes read it as text, newer ones reject `
39
+ + `the form`) {
40
+ const alias = sdkFormFieldType(type);
41
+ return alias !== undefined
42
+ ? `which is the platform's spelling of the SDK's '${alias}' — the SDK writes '${alias}'`
43
+ : unknownWhy;
44
+ }
45
+ /** Every FormFieldType, once; `Record<FormFieldType, …>` makes tsc refuse a missing or extra one. */
46
+ const FORM_FIELD_TYPE_SET = { text: true, number: true, boolean: true, 'date-time': true };
47
+ /** The form-field types the SDK models. */
48
+ export const FORM_FIELD_TYPES = Object.keys(FORM_FIELD_TYPE_SET);
49
+ /** The `suggestion` for an unknown form-field type: the nearest valid one, else `type: 'text'`. */
50
+ export function formFieldTypeHint(type) {
51
+ const alias = sdkFormFieldType(type);
52
+ if (alias !== undefined)
53
+ return `type: '${alias}'`;
54
+ const nearest = nearestName(String(type), FORM_FIELD_TYPES);
55
+ return nearest !== undefined ? `type: '${nearest}'` : `type: 'text'`;
56
+ }
57
+ /** JSON-Schema type per form-field type, as flow-v1's form serializer maps them (quick-form escalations and human tasks). */
58
+ export const FORM_FIELD_JSON_TYPE = {
59
+ text: { type: 'string' },
60
+ number: { type: 'number' },
61
+ boolean: { type: 'boolean' },
62
+ 'date-time': { type: 'string', format: 'date-time' },
63
+ };
@@ -69,7 +69,21 @@
69
69
  * type, including the two app-backed variants, so that `serialize` and `check`
70
70
  * refuse them there with their own message rather than silently ignoring them.
71
71
  */
72
- import type { HitlInputs } from './actions.js';
72
+ /**
73
+ * The fields of a human task's inputs the routing model reads — structural, so
74
+ * this module stays in `core/` while the authoring type (`HitlInputs`) belongs
75
+ * to the HITL family (nodes/hitl/flow/).
76
+ */
77
+ export interface HitlRoutingInputs {
78
+ readonly variant?: unknown;
79
+ readonly outcomes?: ReadonlyArray<string | {
80
+ readonly name?: unknown;
81
+ readonly action?: unknown;
82
+ readonly id?: unknown;
83
+ }>;
84
+ readonly outcomePorts?: boolean;
85
+ readonly exposeError?: boolean;
86
+ }
73
87
  /**
74
88
  * An outcome's stable id — the slug that names its `outcome-<id>` port.
75
89
  *
@@ -117,9 +131,9 @@ export type HitlExitModel = {
117
131
  export declare const OUTCOME_HANDLE_NODE_TYPES: ReadonlySet<string>;
118
132
  /** The same test on the authored side: no variant (the base node), or quick-form. */
119
133
  export declare function hitlDerivesOutcomeHandles(variant: unknown): boolean;
120
- export declare function hitlExitModel(inputs: HitlInputs | undefined, pinnedVersion?: string): HitlExitModel;
134
+ export declare function hitlExitModel(inputs: HitlRoutingInputs | undefined, pinnedVersion?: string): HitlExitModel;
121
135
  /** Does this task route PER OUTCOME (primary continues, the rest are routed)? */
122
- export declare function hitlRoutesPerOutcome(inputs: HitlInputs | undefined, pinnedVersion?: string): boolean;
136
+ export declare function hitlRoutesPerOutcome(inputs: HitlRoutingInputs | undefined, pinnedVersion?: string): boolean;
123
137
  type NodeLike = {
124
138
  id?: unknown;
125
139
  type?: unknown;
@@ -59,3 +59,12 @@ export declare function fnv1aX4Uuid(seed: string): string;
59
59
  * Consumer: a Case entry point's `uniqueId` in `entry-points.json` (`case/compile-cli.ts`).
60
60
  */
61
61
  export declare function sha256Uuid(seed: string): string;
62
+ /**
63
+ * A deterministic UUID for the form schema, derived from the flow and node ids.
64
+ *
65
+ * The platform uses `schemaId` to identify and cache a form, so it has to be
66
+ * stable across builds of the same flow — a random one would make every rebuild a
67
+ * different form and every emitted `.flow` a different file. Shaped as a v5 UUID
68
+ * (SHA-1 based, version + variant bits set) because that is what the field holds.
69
+ */
70
+ export declare function schemaId(flowId: string, nodeId: string): string;