@uipath/maestro-builder-sdk 6.24.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.
@@ -0,0 +1,265 @@
1
+ /**
2
+ * The HITL family's authoring types (`uipath.human-in-the-loop` and its
3
+ * `.quick-form`, `.coded-action-app` and `.document-validation` variants), and
4
+ * the kind's entry in `FlowActionSpecs`. Moved from core/actions.ts in Phase 4
5
+ * of docs/NODE_TYPE_ARCHITECTURE_DESIGN.md. The form fields stay in
6
+ * `core/actions.ts`: an agent's quick-form escalation shares them.
7
+ */
8
+ import type { Expr } from '../../../core/expr.js';
9
+ import type { FormField } from '../../../core/actions.js';
10
+ /**
11
+ * Where the task is delivered. The four ids are the platform's own — including
12
+ * the lowercase `'teams'`, which is how every deployed recipient spells
13
+ * Microsoft Teams (the canvas's channel list, `hitl-types.ts`).
14
+ */
15
+ export type HitlChannel = 'Slack' | 'teams' | 'Email' | 'ActionCenter';
16
+ /**
17
+ * How the task is assigned, the platform's own vocabulary (canvas
18
+ * `HITL_ASSIGNEE_TYPE`): `'user'` a single user, `'group'` all users of a
19
+ * group, `'staticEmail'`/`'staticGroupName'` literal values instead of
20
+ * directory picks, `'workload'`/`'roundRobin'` distribution over a group, and
21
+ * `'custom'` an expression the engine evaluates (`value` holds it).
22
+ */
23
+ export type HitlAssigneeType = 'user' | 'group' | 'staticEmail' | 'staticGroupName' | 'workload' | 'roundRobin' | 'custom';
24
+ /** A per-channel Integration Service connection (Slack / Teams delivery). */
25
+ export interface HitlConnection {
26
+ /** The connection's display name. */
27
+ name?: string | null;
28
+ /** The connection key the engine resolves, e.g. `'Slack'` for the default. */
29
+ key: string;
30
+ /** Folder the connection lives in; `null` for tenant-level defaults. */
31
+ folderPath?: string | null;
32
+ }
33
+ /**
34
+ * Who gets the task and over which channels. Omit the whole object for the
35
+ * definition's default (Email + Action Center, assigned to a group) — which is
36
+ * what 203 of 233 deployed v1 human tasks carry, and what this SDK has always
37
+ * emitted.
38
+ *
39
+ * ```ts
40
+ * hitl({
41
+ * recipient: {
42
+ * channels: ['Email', 'ActionCenter'],
43
+ * assignee: { type: 'user', value: 'reviewer@acme.test' },
44
+ * },
45
+ * …
46
+ * })
47
+ * ```
48
+ */
49
+ export interface HitlRecipient {
50
+ /** Delivery channels. Defaults to the emitted definition's own default set. */
51
+ channels?: HitlChannel[];
52
+ /** Who the task is assigned to. */
53
+ assignee: {
54
+ type: HitlAssigneeType;
55
+ /**
56
+ * The user email / group name / expression, per `type`. The engine lowers
57
+ * this to its `{ Value, Type }` recipient contract; without one the task
58
+ * falls back to the tenant's assignment default.
59
+ */
60
+ value?: string;
61
+ /** Display name the designer shows next to the pick. Cosmetic. */
62
+ displayName?: string;
63
+ };
64
+ /**
65
+ * Per-channel connections, keyed by channel id (`Slack` / `teams`). Only the
66
+ * connector-backed channels take one; Email and Action Center do not.
67
+ */
68
+ connections?: Partial<Record<'Slack' | 'teams', HitlConnection>>;
69
+ }
70
+ /**
71
+ * The Document Validation task's subject — `variant: 'document-validation'`
72
+ * only. The reviewer gets the platform's validation station (or a custom app
73
+ * with a Validation Control) over a document and its extraction result.
74
+ */
75
+ export interface DocValidationInputs {
76
+ /**
77
+ * The extraction result to validate — bind the `ExtractionResult` output of
78
+ * an upstream Extract step, e.g. `out('extract', 'ExtractionResult')`.
79
+ * Required: the station has nothing to validate without it.
80
+ */
81
+ extractionResult: Expr | string;
82
+ /** Storage bucket id holding the document. */
83
+ storageBucket?: string;
84
+ /** The document's id within the bucket. */
85
+ documentId?: string;
86
+ /**
87
+ * `'standard'` (default) for the native validation station, `'custom'` for a
88
+ * custom app with a Validation Control — which then requires `taxonomy`.
89
+ */
90
+ render?: 'standard' | 'custom';
91
+ /** The taxonomy the custom app validates against. Required when `render: 'custom'`. */
92
+ taxonomy?: Expr | string;
93
+ }
94
+ /**
95
+ * One completion button. `action: 'End'` marks an outcome that ENDS the process
96
+ * rather than continuing (the platform's own two-value vocabulary — anything
97
+ * that is not exactly `'End'` reads as continue).
98
+ *
99
+ * `id` is the outcome's wire id — `schema.outcomes[].id`, and the `outcome-<id>`
100
+ * port its edge leaves from. Leave it out and the id is a slug of `name`
101
+ * (`'Needs info'` → `needs-info`). Set it only to keep an id a flow already
102
+ * has, as decompile does for a task the designer drew
103
+ * (`{ name: 'Reject', id: 'outcome-1778015958049' }`): merge keeps the
104
+ * original node, so its edges must use that node's ids.
105
+ *
106
+ * @remarks
107
+ * A bare string is shorthand for `{ name }`.
108
+ */
109
+ export type Outcome = string | {
110
+ name: string;
111
+ action?: 'Continue' | 'End';
112
+ id?: string;
113
+ };
114
+ /**
115
+ * WHICH human-task node type to emit. The platform ships three spellings of the
116
+ * same node; two of them resolve on this tenant and are what this option picks.
117
+ *
118
+ * @remarks
119
+ * - **omitted** — `uipath.human-in-the-loop`, the original node, which chooses
120
+ * the form kind with `inputs.type: 'quick'`. This is the default and it does
121
+ * not change: it is where the platform's own versioning continues, and 319 of
122
+ * the corpus's human tasks are on it.
123
+ * - **`'quick-form'`** — `uipath.human-in-the-loop.quick-form`. Same inline form,
124
+ * but the node TYPE is the "quick" choice, so no `inputs.type` is written
125
+ * (165 of its 175 deployed instances omit it). Everything you author is
126
+ * identical; pick it when something downstream keys on the literal type
127
+ * string, which flow-v1's own task checkers do.
128
+ * - **`'action-app'`** — `uipath.human-in-the-loop.coded-action-app`. The form is
129
+ * NOT in the flow: it belongs to a deployed Action App, named by `app`. You
130
+ * still declare `outcomes` (the flow routes on them); you must NOT declare
131
+ * `fields` (the app owns them) — `check` says so.
132
+ *
133
+ * - **`'document-validation'`** — `uipath.human-in-the-loop.document-validation`.
134
+ * A validation station over a document + extraction result, named by
135
+ * `document`. No `fields` (the station is the form); `outcomes` still route.
136
+ * The definition is BUNDLED from the workbench manifest — the tenant registry
137
+ * does not serve the family (same availability note as do-while).
138
+ */
139
+ export type HitlVariant = 'quick-form' | 'action-app' | 'document-validation';
140
+ /**
141
+ * A deployed Action App that supplies a human task's form — the `'action-app'`
142
+ * variant's subject.
143
+ *
144
+ * @remarks
145
+ * The names are the platform's own, from flow-v1's app picker: an app is closed
146
+ * by `key` (its GUID) plus the `folderPath` it is deployed in, with `name` the
147
+ * human-readable title. This SDK is offline and never calls the Apps API, so
148
+ * what you write here is what you already know about the app.
149
+ *
150
+ * ```ts
151
+ * hitl({
152
+ * variant: 'action-app',
153
+ * app: {
154
+ * name: 'Expense Review',
155
+ * key: 'c0ba97df-8a30-4fe0-b4b4-4611a631d77b',
156
+ * folderPath: 'Shared',
157
+ * inputs: { 'Expense Amount': out('fetchExpense', 'total') },
158
+ * },
159
+ * outcomes: ['Approve', 'Reject'],
160
+ * })
161
+ * ```
162
+ */
163
+ export interface AppRef {
164
+ /** The app's display title, e.g. `'Expense Review'`. */
165
+ name: string;
166
+ /** The app's key (a GUID) — how the platform resolves which app this is. */
167
+ key: string;
168
+ /** Fully-qualified folder the app is deployed in, e.g. `'Shared'`. */
169
+ folderPath: string;
170
+ /**
171
+ * The app's stable system name. `null` until the app's first deployment
172
+ * assigns one, which is why it is optional and why `null` is a legal value
173
+ * rather than something to omit.
174
+ */
175
+ appSystemName?: string | null;
176
+ /**
177
+ * What to send the app, keyed by the app's OWN input parameter names — so the
178
+ * keys are the app author's, spaces and all (`'Invoice Amount'`), not
179
+ * identifiers of ours. Values are references, e.g. `out('step', 'field')`.
180
+ *
181
+ * Emitted as `inputs.appInputBindings`, the map flow-v1's serializer turns
182
+ * into the task's `HitlTaskArguments`.
183
+ */
184
+ inputs?: Record<string, Expr | string>;
185
+ }
186
+ export interface HitlInputs {
187
+ /**
188
+ * Which human-task node type to emit. Omit it for today's default — see
189
+ * {@link HitlVariant}. Omitting it emits exactly what it always has.
190
+ */
191
+ variant?: HitlVariant;
192
+ /**
193
+ * The deployed Action App that owns this task's form. Required by — and only
194
+ * legal with — `variant: 'action-app'`.
195
+ */
196
+ app?: AppRef;
197
+ /** Task title the reviewer sees. Defaults to the step's label. */
198
+ title?: string;
199
+ /** Action Center priority. Defaults to `'Low'`. */
200
+ priority?: 'Low' | 'Medium' | 'High';
201
+ /**
202
+ * The form, as an array of field descriptors — `direction: 'input'` for a value
203
+ * the reviewer reads, `'output'` for one they fill in. An array (not a map)
204
+ * because the ids are yours and order is the order on the form.
205
+ *
206
+ * Required for the inline-form variants (the default and `'quick-form'`).
207
+ * FORBIDDEN with `variant: 'action-app'`, where the form belongs to the
208
+ * deployed app rather than to the flow — `check` says so both ways.
209
+ */
210
+ fields?: FormField[];
211
+ /**
212
+ * The completion buttons, e.g. `['Approve', 'Reject']`. At least one, or the
213
+ * reviewer has no way to complete the task and the flow waits forever. The
214
+ * first is the primary (default) one. Each outcome is its own exit,
215
+ * `outcome-<slug>`: the default node and `'quick-form'` never leave on
216
+ * `completed` once they have outcomes. On the default node MORE THAN ONE
217
+ * outcome routes per outcome: the first continues the main path and the rest
218
+ * are routed with `.stepToList('outcome-<slug>', …)`. With `'quick-form'`,
219
+ * {@link HitlInputs.outcomePorts | outcomePorts}`: false`, an explicit
220
+ * `{ version }` or one outcome, `.step()` continues EVERY outcome instead.
221
+ *
222
+ * Which one they pressed is also `out('<step>', 'Action')` — that is what the
223
+ * platform's own routing conditions compare against.
224
+ */
225
+ outcomes: Outcome[];
226
+ /** Who gets the task and how. Omit for the definition's default delivery. */
227
+ recipient?: HitlRecipient;
228
+ /** Action Center labels, comma-separated (the platform stores one string). */
229
+ labels?: string;
230
+ /**
231
+ * Whether the task ROUTES per outcome. Each outcome has its own exit either
232
+ * way (`outcome-<id>`, the name slugified: `'Approve'` → `outcome-approve`).
233
+ *
234
+ * `true`: the FIRST outcome continues the main path and the others are routed
235
+ * with `.stepToList('outcome-<id>', …)`, or the run stalls when the reviewer
236
+ * picks one. The default node with more than one outcome already does this,
237
+ * on its **1.1** definition unless a `{ version }` pins another; `'quick-form'`
238
+ * supports it on its one definition. `false`: EVERY outcome continues to the
239
+ * next step on its own edge — a task that routes the decision as DATA by
240
+ * reading `out('<step>', 'Action')`; `'quick-form'` does this by default.
241
+ * `'action-app'` and `'document-validation'` read their outcomes from the app
242
+ * and leave on their one `completed` exit, so `true` is refused there.
243
+ */
244
+ outcomePorts?: boolean;
245
+ /**
246
+ * Expose the task's runtime error as a bindable `out('<step>', 'error')`
247
+ * object (`{ code, message, detail, category, status }`). Selects the node's
248
+ * **1.2** definition — which also routes per outcome, so this implies
249
+ * {@link HitlInputs.outcomePorts | outcomePorts}. Default node only.
250
+ */
251
+ exposeError?: boolean;
252
+ /**
253
+ * The document to validate. Required by — and only legal with —
254
+ * `variant: 'document-validation'`.
255
+ */
256
+ document?: DocValidationInputs;
257
+ }
258
+ declare module '../../../core/actions.js' {
259
+ interface FlowActionSpecs {
260
+ /** The spec {@link hitl} builds. */
261
+ hitl: {
262
+ inputs: HitlInputs;
263
+ };
264
+ }
265
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -126,10 +126,8 @@ export declare function perCallDefinition(spec: {
126
126
  * The definition version serialize emits for a typed action step that is not
127
127
  * yet on the node-type registry: the author's `{ version }` when given,
128
128
  * otherwise the version the step's inputs select, otherwise `undefined` (the
129
- * pinned default). Two such families pick a version themselves:
130
- *
131
- * - `hitl`: `exposeError` selects `@1.2`, per-outcome routing selects `@1.1`;
132
- * - `inlineAgent`: the newest bundled version, not the first bundled entry.
129
+ * pinned default). One such family picks a version itself: `inlineAgent`
130
+ * takes the newest bundled version, not the first bundled entry.
133
131
  *
134
132
  * The emit paths read their version here, and `check` resolves the definition
135
133
  * it asks about with this same version (#1041), so the two cannot pick