@uipath/maestro-builder-sdk 6.87.3 → 6.88.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.
- package/dist/api-index.md +6 -4
- package/dist/api-members.md +11 -4
- package/dist/case/case-expr-check.d.ts +35 -28
- package/dist/case/case-expr-check.js +38 -20
- package/dist/case/case-sdk.js +8 -5
- package/dist/case/check.js +82 -19
- package/dist/case/compile-cli.js +15 -3
- package/dist/case/decompile.d.ts +1 -1
- package/dist/case/decompile.js +0 -87
- package/dist/core/refusals.d.ts +2 -0
- package/dist/core/refusals.js +2 -0
- package/dist/core-definitions.json +154 -0
- package/dist/flow-node-type.d.ts +2 -0
- package/dist/nodes/trigger/flow/check.d.ts +10 -4
- package/dist/nodes/trigger/flow/check.js +15 -0
- package/dist/nodes/trigger/flow/factories.d.ts +22 -6
- package/dist/nodes/trigger/flow/factories.js +22 -6
- package/dist/nodes/trigger/flow/node-type.d.ts +2 -1
- package/dist/nodes/trigger/flow/node-type.js +95 -5
- package/dist/nodes/trigger/flow/spec.d.ts +30 -0
- package/dist/serialize.js +1 -0
- package/package.json +2 -2
package/dist/api-index.md
CHANGED
|
@@ -41,7 +41,7 @@ could hand you spans for a version you do not have.
|
|
|
41
41
|
|
|
42
42
|
## `@uipath/maestro-builder-sdk`
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
256 symbol(s). Import from `@uipath/maestro-builder-sdk`.
|
|
45
45
|
|
|
46
46
|
| Symbol | Kind | Declaration | Area | Summary |
|
|
47
47
|
| --- | --- | --- | --- | --- |
|
|
@@ -100,9 +100,10 @@ could hand you spans for a version you do not have.
|
|
|
100
100
|
| `conversationalAgent` | function | `dist/nodes/agent/flow/factories.d.ts:59-83` | Actions | A CONVERSATIONAL agent (`uipath.agent.conversational`) — it answers one turn of a live chat, reading the transcript… |
|
|
101
101
|
| `ConversationalAgentInputs` | interface | `dist/nodes/agent/flow/spec.d.ts:38-85` | Option shapes | What `conversationalAgent()` takes: the agent's instructions and model, and how it gets its turn. |
|
|
102
102
|
| `ConversationalAgentSettings` | interface | `dist/nodes/agent/flow/spec.d.ts:13-37` | Supporting types | How a conversational agent gets its turn — the node's own `conversationalAgentSettings` sub-object. |
|
|
103
|
+
| `ConversationAppearance` | interface | `dist/nodes/trigger/flow/spec.d.ts:55-71` | Supporting types | How the chat that starts a conversation-triggered flow looks: the conversation trigger's `appearance` (1.3), the same… |
|
|
103
104
|
| `conversationContext` | function | `dist/nodes/conversation/flow/factories.d.ts:44-58` | Actions | READ a conversation's transcript so far without waiting (`uipath.conversational.get-conversation-context`) — the shape a… |
|
|
104
105
|
| `ConversationContextInputs` | interface | `dist/nodes/conversation/flow/spec.d.ts:37-44` | Option shapes | 2 field(s) |
|
|
105
|
-
| `conversationTrigger` | function | `dist/nodes/trigger/flow/factories.d.ts:61-
|
|
106
|
+
| `conversationTrigger` | function | `dist/nodes/trigger/flow/factories.d.ts:61-103` | Actions | Start the flow when a new CONVERSATION is created (`core.trigger.conversation`) — the entry point for a chat-driven… |
|
|
106
107
|
| `createOutgoingCall` | function | `dist/nodes/agent/flow/factories.d.ts:9-25` | Actions | Place an outgoing phone call (`uipath.conversational.voice.create-outgoing-call`) and get back the `callContext` every… |
|
|
107
108
|
| `CreateOutgoingCallInputs` | interface | `dist/nodes/agent/flow/spec.d.ts:86-95` | Option shapes | What `createOutgoingCall()` takes: the two numbers, in E.164. |
|
|
108
109
|
| `CustomGuardrail` | interface | `dist/core/actions.d.ts:340-352` | Supporting types | A rule-based guardrail you author in place. |
|
|
@@ -260,6 +261,7 @@ could hand you spans for a version you do not have.
|
|
|
260
261
|
| `sendMessage` | function | `dist/nodes/conversation/flow/factories.d.ts:8-26` | Actions | Post an assistant message into a live conversation (`uipath.conversational.send-message`). |
|
|
261
262
|
| `SendMessageInputs` | interface | `dist/nodes/conversation/flow/spec.d.ts:8-27` | Option shapes | 4 field(s) |
|
|
262
263
|
| `ShownField` | interface | `dist/core/actions.d.ts:207-222` | Supporting types | A value the reviewer READS: shown on the form, filled in from the flow. |
|
|
264
|
+
| `StartingPrompt` | interface | `dist/nodes/trigger/flow/spec.d.ts:43-54` | Supporting types | One suggestion the chat shows before the user types: a chip labelled `displayPrompt` that sends `actualPrompt` to the… |
|
|
263
265
|
| `Step` | type | `dist/flow-sdk.d.ts:445-565` | Supporting types | |
|
|
264
266
|
| `StepList` | class | `dist/flow-sdk.d.ts:770-1254` | Builders | Collects a sequence of steps. |
|
|
265
267
|
| `StepOptions` | interface | `dist/flow-sdk.d.ts:297-317` | Option shapes | The options of `.step()`: the NodeOptions, plus `draft` for a node the canvas saved unfinished. |
|
|
@@ -283,7 +285,7 @@ could hand you spans for a version you do not have.
|
|
|
283
285
|
| `TriggerDescriptor` | type | `dist/core/connectors.d.ts:143-151` | Generated descriptors | A generated, typed connector-trigger descriptor: TriggerMeta branded with phantom `where`/output types. |
|
|
284
286
|
| `TriggerMeta` | interface | `dist/core/connectors.d.ts:133-142` | Generated descriptors | Runtime metadata a generated trigger descriptor carries. |
|
|
285
287
|
| `TriggerOptions` | interface | `dist/core/actions.d.ts:1004-1051` | Option shapes | The typed `onEvent`/`waitForEvent` options — everything an EventSubscription carries except `connector`/`event`, which… |
|
|
286
|
-
| `TriggerSpec` | type | `dist/nodes/trigger/flow/spec.d.ts:
|
|
288
|
+
| `TriggerSpec` | type | `dist/nodes/trigger/flow/spec.d.ts:72-91` | Supporting types | What starts the flow. |
|
|
287
289
|
| `TypeDesc` | type | `dist/core/expr.d.ts:385` | Supporting types | |
|
|
288
290
|
| `types` | const | `dist/core/expr.d.ts:369-384` | Expressions and types | Variable type descriptors (map to Flow variable `type` values). |
|
|
289
291
|
| `unresolvedLookupMessage` | function | `dist/core/lookups.d.ts:202-211` | Generated descriptors | The message for a lookup nothing has resolved — the command that fixes it. |
|
|
@@ -294,7 +296,7 @@ could hand you spans for a version you do not have.
|
|
|
294
296
|
| `voiceAgent` | function | `dist/nodes/agent/flow/factories.d.ts:34-58` | Actions | Put a VOICE agent on a live call (`uipath.agent.voice`) — it speaks and listens for one turn, then the flow continues. |
|
|
295
297
|
| `VoiceAgentInputs` | interface | `dist/nodes/agent/flow/spec.d.ts:128-162` | Option shapes | What `voiceAgent()` takes: the agent's instructions, the call it joins, and how it sounds. |
|
|
296
298
|
| `VoiceSettings` | interface | `dist/nodes/agent/flow/spec.d.ts:105-127` | Supporting types | The audio settings a voice agent speaks with. |
|
|
297
|
-
| `voiceTrigger` | function | `dist/nodes/trigger/flow/factories.d.ts:
|
|
299
|
+
| `voiceTrigger` | function | `dist/nodes/trigger/flow/factories.d.ts:104-128` | Actions | Start the flow when a phone call comes IN (`core.trigger.voice`). |
|
|
298
300
|
| `waitForEvent` | function | `dist/core/actions.d.ts:1103-1138` | Actions | Wait mid-flow until a connector event fires, then continue with its payload — the typed form, where a generated trigger… |
|
|
299
301
|
| `waitForEvent` | function | `dist/core/actions.d.ts:1139-1146` | Actions | Stringly form, for an event with no prepared module. |
|
|
300
302
|
| `waitForMessage` | function | `dist/nodes/conversation/flow/factories.d.ts:27-43` | Actions | PAUSE until the person sends their next message (`uipath.conversational.wait-for-message`) — a catch event, like… |
|
package/dist/api-members.md
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
# Maestro Builder SDK — member index
|
|
7
7
|
|
|
8
|
-
**A lookup table of
|
|
8
|
+
**A lookup table of 1316 rows — match one name in it, do not read it.**
|
|
9
9
|
Grep or search for the member you have; the row it lands on is the whole
|
|
10
10
|
answer. Reading top to bottom costs ~20x what the one row does and tells you
|
|
11
11
|
nothing you asked for.
|
|
12
12
|
|
|
13
|
-
Every field and method of every exported shape —
|
|
14
|
-
|
|
13
|
+
Every field and method of every exported shape — 1316 across
|
|
14
|
+
246 interfaces and classes — keyed by the MEMBER's own name.
|
|
15
15
|
|
|
16
16
|
**Use this when the name you have is a field or a method**, which is usually
|
|
17
17
|
the case: the reference pages are "one line per field", so you arrive holding
|
|
@@ -32,7 +32,7 @@ truncated summary would, for less. Read the span.
|
|
|
32
32
|
Member names repeat across shapes (`name` is declared on 69 of them), so the
|
|
33
33
|
`Declared on` column is what makes a match actionable. For the whole shape
|
|
34
34
|
rather than the one field, look that name up in [`api-index.md`](api-index.md) —
|
|
35
|
-
which is why its span is not repeated on all
|
|
35
|
+
which is why its span is not repeated on all 1316 rows here.
|
|
36
36
|
|
|
37
37
|
**A name that misses both indexes is probably not part of the API.** The one
|
|
38
38
|
that comes up is a RUNTIME output key — a human task's `Action`, a step's
|
|
@@ -59,6 +59,7 @@ not find it either.
|
|
|
59
59
|
| `actions` | property | `HumanTaskAppOpts` | `dist/bpmn/bpmn-sdk.d.ts:1442-1451` |
|
|
60
60
|
| `actionSchema` | property | `AppRef` | `dist/nodes/hitl/flow/spec.d.ts:220-244` |
|
|
61
61
|
| `activity` | method | `ScopeBuilder` | `dist/bpmn/bpmn-sdk.d.ts:3048-3081` |
|
|
62
|
+
| `actualPrompt` | property | `StartingPrompt` | `dist/nodes/trigger/flow/spec.d.ts:50-51` |
|
|
62
63
|
| `additionalOutputs` | property | `RegistryTypeSpec` | `dist/bpmn/typed-node.d.ts:98-102` |
|
|
63
64
|
| `agent` | property | `FlowActionSpecs` | `dist/nodes/process/flow/spec.d.ts:407-410` |
|
|
64
65
|
| `agent` | method | `TaskBuilder` | `dist/case/case-sdk.d.ts:1269-1278` |
|
|
@@ -309,6 +310,7 @@ not find it either.
|
|
|
309
310
|
| `displayName` | property | `RegistryInputField` | `dist/bpmn/typed-node.d.ts:65` |
|
|
310
311
|
| `displayName` | property | `SlaOpts` | `dist/case/case-sdk.d.ts:255-260` |
|
|
311
312
|
| `displayName` | property | `TriggerMeta` | `dist/core/connectors.d.ts:140-141` |
|
|
313
|
+
| `displayPrompt` | property | `StartingPrompt` | `dist/nodes/trigger/flow/spec.d.ts:48-49` |
|
|
312
314
|
| `document` | property | `HitlInputs` | `dist/nodes/hitl/flow/spec.d.ts:419-423` |
|
|
313
315
|
| `documentClassify` | property | `FlowActionSpecs` | `dist/nodes/document/flow/spec.d.ts:187-190` |
|
|
314
316
|
| `documentExtraction` | property | `BuiltTask` | `dist/case/case-sdk.d.ts:950-951` |
|
|
@@ -539,6 +541,7 @@ not find it either.
|
|
|
539
541
|
| `id` | property | `PinnedFlowId` | `dist/bpmn/bpmn-sdk.d.ts:1765-1766` |
|
|
540
542
|
| `id` | property | `SchemaEntry` | `dist/bpmn/bpmn-sdk.d.ts:1064-1065` |
|
|
541
543
|
| `id` | property | `ShownField` | `dist/core/actions.d.ts:209-210` |
|
|
544
|
+
| `id` | property | `StartingPrompt` | `dist/nodes/trigger/flow/spec.d.ts:52-53` |
|
|
542
545
|
| `id` | property | `StickyNote` | `dist/flow-sdk.d.ts:672-681` |
|
|
543
546
|
| `id` | property | `SwitchArm` | `dist/flow-sdk.d.ts:212-218` |
|
|
544
547
|
| `id` | property | `VarEntry` | `dist/bpmn/bpmn-sdk.d.ts:1055-1056` |
|
|
@@ -925,6 +928,7 @@ not find it either.
|
|
|
925
928
|
| `payload` | property | `SubProcessOpts` | `dist/bpmn/bpmn-sdk.d.ts:1041-1048` |
|
|
926
929
|
| `payload` | property | `ThrowOpts` | `dist/bpmn/bpmn-sdk.d.ts:783-784` |
|
|
927
930
|
| `persona` | property | `VoiceSettings` | `dist/nodes/agent/flow/spec.d.ts:119-120` |
|
|
931
|
+
| `personalWorkspaceConnectionsOnly` | property | `ConversationAppearance` | `dist/nodes/trigger/flow/spec.d.ts:66-70` |
|
|
928
932
|
| `pinnedFlowIds` | property | `SugarRegistry` | `dist/bpmn/bpmn-sdk.d.ts:2090-2097` |
|
|
929
933
|
| `placements` | property | `RegistryTypeSpec` | `dist/bpmn/typed-node.d.ts:116-129` |
|
|
930
934
|
| `plainTask` | method | `ScopeBuilder` | `dist/bpmn/bpmn-sdk.d.ts:2449-2478` |
|
|
@@ -1150,6 +1154,7 @@ not find it either.
|
|
|
1150
1154
|
| `startEntryPointId` | property | `EventSubProcessOpts` | `dist/bpmn/bpmn-sdk.d.ts:2028-2029` |
|
|
1151
1155
|
| `startEvent` | method | `ScopeBuilder` | `dist/bpmn/bpmn-sdk.d.ts:2345-2361` |
|
|
1152
1156
|
| `startId` | property | `EventSubProcessOpts` | `dist/bpmn/bpmn-sdk.d.ts:2022-2023` |
|
|
1157
|
+
| `startingPrompts` | property | `ConversationAppearance` | `dist/nodes/trigger/flow/spec.d.ts:64-65` |
|
|
1153
1158
|
| `startName` | property | `EventSubProcessOpts` | `dist/bpmn/bpmn-sdk.d.ts:2024-2025` |
|
|
1154
1159
|
| `startPayload` | property | `EventSubProcessOpts` | `dist/bpmn/bpmn-sdk.d.ts:2026-2027` |
|
|
1155
1160
|
| `startProcess` | method | `ScopeBuilder` | `dist/bpmn/bpmn-sdk.d.ts:2647-2666` |
|
|
@@ -1343,6 +1348,8 @@ not find it either.
|
|
|
1343
1348
|
| `waitForMessage` | property | `FlowActionSpecs` | `dist/nodes/conversation/flow/spec.d.ts:51-54` |
|
|
1344
1349
|
| `waitForTimer` | method | `TaskBuilder` | `dist/case/case-sdk.d.ts:1457-1463` |
|
|
1345
1350
|
| `waypoints` | property | `EdgeRoute` | `dist/flow-sdk.d.ts:635-640` |
|
|
1351
|
+
| `welcomeDescription` | property | `ConversationAppearance` | `dist/nodes/trigger/flow/spec.d.ts:62-63` |
|
|
1352
|
+
| `welcomeTitle` | property | `ConversationAppearance` | `dist/nodes/trigger/flow/spec.d.ts:60-61` |
|
|
1346
1353
|
| `when` | property | `FormFieldCondition` | `dist/core/actions.d.ts:121-122` |
|
|
1347
1354
|
| `when` | property | `SlaOpts` | `dist/case/case-sdk.d.ts:261-267` |
|
|
1348
1355
|
| `when` | property | `SwitchArm` | `dist/flow-sdk.d.ts:205-210` |
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* case-expr-check — the CASE adapter over the shared `core/expr-check
|
|
3
|
-
* `
|
|
2
|
+
* case-expr-check — the CASE adapter over the shared `core/expr-check`. Its
|
|
3
|
+
* `lint` findings go to `check` (`caseExprLints`); the rest stop
|
|
4
|
+
* `CaseBuilder.build()` before it hands back the model (`caseExprRefusals`).
|
|
4
5
|
*
|
|
5
6
|
* A case `=js:` gate reads a declared variable as `=js:vars.<name>` — the `vars.`
|
|
6
7
|
* namespace, NOT `case.` (a `case.` reference resolves to nothing; the platform's
|
|
@@ -8,7 +9,9 @@
|
|
|
8
9
|
* `vars.` is a CLOSED namespace: a reference to a name no variable declares is a
|
|
9
10
|
* definite mistake, and `validate` says so (`vars.<name> does not exist`). So this
|
|
10
11
|
* flags every undeclared `vars.<root>`, exactly as the flow check flags `$vars`,
|
|
11
|
-
* and `
|
|
12
|
+
* and `check` is the fast pre-`validate` gate. It is `lint`, not a refusal:
|
|
13
|
+
* the serializer writes the read as authored, so a plan that has one still
|
|
14
|
+
* compiles (decided on builder-sdk#1712).
|
|
12
15
|
*
|
|
13
16
|
* The surfaces that carry a `=js:` gate: every rule's `expression`, a task's
|
|
14
17
|
* `skipWhen`, and each SLA's `when`. Stage/task STRUCTURAL references
|
|
@@ -23,42 +26,46 @@ export interface CaseLocatedDiagnostic extends ExprDiagnostic {
|
|
|
23
26
|
where: string;
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* compile refuses.
|
|
29
|
+
* An EXPR_UNDECLARED_REF finding with the read it is about: the expression as
|
|
30
|
+
* authored and the undeclared root. `check` uses it to drop plan-check's
|
|
31
|
+
* CASE_MGMT_REFERENCE_UNBOUND on the same read (one mistake, one finding).
|
|
30
32
|
*/
|
|
31
|
-
export
|
|
33
|
+
export interface CaseExprFinding extends CaseLocatedDiagnostic {
|
|
34
|
+
read?: {
|
|
35
|
+
expr: string;
|
|
36
|
+
root: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
32
39
|
/**
|
|
33
40
|
* The platform variable that says whether the stage labelled `label` has run
|
|
34
41
|
* (case-schema `baseLocalStageHasRunVariableInfoForStage`): `Stage 1` ->
|
|
35
42
|
* `stageHasRun_Stage_1`. Exported for the Case fuzzer's stage renames.
|
|
36
43
|
*/
|
|
37
44
|
export declare function stageHasRunVariable(label: string): string;
|
|
38
|
-
/**
|
|
39
|
-
* Variables the platform declares for every case, which a plan's gates may read
|
|
40
|
-
* though no row of the plan declares them. `uip maestro case validate` adds the
|
|
41
|
-
* same set to the variables it checks against (case-schema
|
|
42
|
-
* `validateCaseManagementVariables`), and the BPMN converter writes each one:
|
|
43
|
-
*
|
|
44
|
-
* - `stageHasRun_<stage label>` per stage (`getCaseStateVariables`), set in the
|
|
45
|
-
* initial variables setup and updated when the stage exits or completes. The
|
|
46
|
-
* platform's own V11->V12 migration writes gates on it:
|
|
47
|
-
* `=js:(vars.stageHasRun_Review != true)` for "first time this stage runs";
|
|
48
|
-
* - the hidden event-subprocess rows `tasksEventSubprocessResponse`,
|
|
49
|
-
* `mainEventSubprocessResponse`, `connectorResponse` and `eventMetadata`.
|
|
50
|
-
*
|
|
51
|
-
* Not here: the per-SLA `stageSla_<stage>_<sla id>` rows, whose ids compile
|
|
52
|
-
* mints after this check runs.
|
|
53
|
-
*/
|
|
54
|
-
export declare function platformVariables(stageLabels: readonly string[]): string[];
|
|
55
45
|
/** Every first-level expression problem in a built case, each stamped with its location. */
|
|
56
46
|
export declare function checkCaseExpressions(built: BuiltCase): CaseLocatedDiagnostic[];
|
|
47
|
+
/**
|
|
48
|
+
* The expression findings `CaseBuilder.build()` refuses: every error whose code
|
|
49
|
+
* is not `lint`. Today that is TASK_OUTPUT_REF_UNRESOLVED, a task-output
|
|
50
|
+
* reference naming no stage, task or output, which the serializer has no id to
|
|
51
|
+
* lower to.
|
|
52
|
+
*/
|
|
53
|
+
export declare function caseExprRefusals(built: BuiltCase): CaseLocatedDiagnostic[];
|
|
54
|
+
/**
|
|
55
|
+
* The expression findings only `check` reports: every `lint` code, such as
|
|
56
|
+
* EXPR_UNDECLARED_REF (`=js:vars.missing` where no variable is named
|
|
57
|
+
* `missing`). The serializer writes such a read exactly as authored, so it
|
|
58
|
+
* never stops `build()` or `compile` (decided on builder-sdk#1712): a
|
|
59
|
+
* brownfield plan that already carries one still loads, compiles and merges.
|
|
60
|
+
*/
|
|
61
|
+
export declare function caseExprLints(built: BuiltCase): CaseExprFinding[];
|
|
57
62
|
/**
|
|
58
63
|
* Thrown by `CaseBuilder.build()` when the first-level expression check finds a
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
64
|
+
* reference the serializer cannot lower: a task-output reference that names no
|
|
65
|
+
* stage, task or output (TASK_OUTPUT_REF_UNRESOLVED). An undeclared
|
|
66
|
+
* `vars.<name>` read (EXPR_UNDECLARED_REF) no longer throws it; `check`
|
|
67
|
+
* reports that one. Same shape as the flow's `FlowBuildError`: `message` lists
|
|
68
|
+
* every problem; `diagnostics` carries them structured.
|
|
62
69
|
*/
|
|
63
70
|
export declare class CaseBuildError extends CompileRefusal {
|
|
64
71
|
readonly diagnostics: CaseLocatedDiagnostic[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* case-expr-check — the CASE adapter over the shared `core/expr-check
|
|
3
|
-
* `
|
|
2
|
+
* case-expr-check — the CASE adapter over the shared `core/expr-check`. Its
|
|
3
|
+
* `lint` findings go to `check` (`caseExprLints`); the rest stop
|
|
4
|
+
* `CaseBuilder.build()` before it hands back the model (`caseExprRefusals`).
|
|
4
5
|
*
|
|
5
6
|
* A case `=js:` gate reads a declared variable as `=js:vars.<name>` — the `vars.`
|
|
6
7
|
* namespace, NOT `case.` (a `case.` reference resolves to nothing; the platform's
|
|
@@ -8,7 +9,9 @@
|
|
|
8
9
|
* `vars.` is a CLOSED namespace: a reference to a name no variable declares is a
|
|
9
10
|
* definite mistake, and `validate` says so (`vars.<name> does not exist`). So this
|
|
10
11
|
* flags every undeclared `vars.<root>`, exactly as the flow check flags `$vars`,
|
|
11
|
-
* and `
|
|
12
|
+
* and `check` is the fast pre-`validate` gate. It is `lint`, not a refusal:
|
|
13
|
+
* the serializer writes the read as authored, so a plan that has one still
|
|
14
|
+
* compiles (decided on builder-sdk#1712).
|
|
12
15
|
*
|
|
13
16
|
* The surfaces that carry a `=js:` gate: every rule's `expression`, a task's
|
|
14
17
|
* `skipWhen`, and each SLA's `when`. Stage/task STRUCTURAL references
|
|
@@ -17,6 +20,7 @@
|
|
|
17
20
|
*/
|
|
18
21
|
import { checkExpression, extractRefs } from '../core/expr-check.js';
|
|
19
22
|
import { CompileRefusal } from '../core/compile-refusal.js';
|
|
23
|
+
import { refusalClass } from '../core/refusals.js';
|
|
20
24
|
import { readEventFilter } from '../core/event-filters.js';
|
|
21
25
|
import { defaultActionOutputVar } from './action-output-var.js';
|
|
22
26
|
import { lowerTaskOutputRefs, pickByName, pickOutputRow, taskOutputRefs, unresolvedTaskOutputRef } from './task-output-ref.js';
|
|
@@ -77,25 +81,18 @@ function checkTaskOutputRefs(built, value, where, out) {
|
|
|
77
81
|
out.push({ level: 'error', code: 'TASK_OUTPUT_REF_UNRESOLVED', message: unresolvedTaskOutputRef(ref, why), where });
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
|
-
/**
|
|
81
|
-
* The undeclared `vars.<root>` names `expr` reads, as `build()` reports them
|
|
82
|
-
* (`EXPR_UNDECLARED_REF`). A task-output reference stands in as a declared root.
|
|
83
|
-
* For decompile, which refuses such a gate by name rather than writing source
|
|
84
|
-
* compile refuses.
|
|
85
|
-
*/
|
|
86
|
-
export function undeclaredVarReads(expr, roots) {
|
|
87
|
-
const lowered = lowerTaskOutputRefs(expr, () => TASK_OUTPUT_ROOT);
|
|
88
|
-
const scope = new Set([...roots, TASK_OUTPUT_ROOT]);
|
|
89
|
-
return [...new Set(extractRefs(lowered, NAMESPACE).map((ref) => ref.root).filter((root) => !scope.has(root)))];
|
|
90
|
-
}
|
|
91
84
|
function checkExpr(built, expr, where, roots, out) {
|
|
92
85
|
if (!expr)
|
|
93
86
|
return;
|
|
94
87
|
checkTaskOutputRefs(built, expr, where, out);
|
|
95
88
|
const lowered = lowerTaskOutputRefs(expr, () => TASK_OUTPUT_ROOT);
|
|
96
89
|
const scope = lowered === expr ? roots : new Set([...roots, TASK_OUTPUT_ROOT]);
|
|
90
|
+
// The undeclared roots, in the order checkExpression reports them (one each).
|
|
91
|
+
const undeclared = [...new Set(extractRefs(lowered, NAMESPACE).map((r) => r.root).filter((r) => !scope.has(r)))];
|
|
92
|
+
let next = 0;
|
|
97
93
|
for (const d of checkExpression(lowered, { roots: scope, noun: NOUN, namespace: NAMESPACE })) {
|
|
98
|
-
|
|
94
|
+
const root = d.code === 'EXPR_UNDECLARED_REF' ? undeclared[next++] : undefined;
|
|
95
|
+
out.push({ ...d, where, ...(root !== undefined ? { read: { expr, root } } : {}) });
|
|
99
96
|
}
|
|
100
97
|
}
|
|
101
98
|
/**
|
|
@@ -158,7 +155,7 @@ export function stageHasRunVariable(label) {
|
|
|
158
155
|
* Not here: the per-SLA `stageSla_<stage>_<sla id>` rows, whose ids compile
|
|
159
156
|
* mints after this check runs.
|
|
160
157
|
*/
|
|
161
|
-
|
|
158
|
+
function platformVariables(stageLabels) {
|
|
162
159
|
return [
|
|
163
160
|
...stageLabels.map((label) => stageHasRunVariable(label)),
|
|
164
161
|
'tasksEventSubprocessResponse',
|
|
@@ -226,11 +223,32 @@ export function checkCaseExpressions(built) {
|
|
|
226
223
|
}
|
|
227
224
|
return out;
|
|
228
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* The expression findings `CaseBuilder.build()` refuses: every error whose code
|
|
228
|
+
* is not `lint`. Today that is TASK_OUTPUT_REF_UNRESOLVED, a task-output
|
|
229
|
+
* reference naming no stage, task or output, which the serializer has no id to
|
|
230
|
+
* lower to.
|
|
231
|
+
*/
|
|
232
|
+
export function caseExprRefusals(built) {
|
|
233
|
+
return checkCaseExpressions(built).filter((d) => d.level === 'error' && refusalClass(d.code) !== 'lint');
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* The expression findings only `check` reports: every `lint` code, such as
|
|
237
|
+
* EXPR_UNDECLARED_REF (`=js:vars.missing` where no variable is named
|
|
238
|
+
* `missing`). The serializer writes such a read exactly as authored, so it
|
|
239
|
+
* never stops `build()` or `compile` (decided on builder-sdk#1712): a
|
|
240
|
+
* brownfield plan that already carries one still loads, compiles and merges.
|
|
241
|
+
*/
|
|
242
|
+
export function caseExprLints(built) {
|
|
243
|
+
return checkCaseExpressions(built).filter((d) => refusalClass(d.code) === 'lint');
|
|
244
|
+
}
|
|
229
245
|
/**
|
|
230
246
|
* Thrown by `CaseBuilder.build()` when the first-level expression check finds a
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
247
|
+
* reference the serializer cannot lower: a task-output reference that names no
|
|
248
|
+
* stage, task or output (TASK_OUTPUT_REF_UNRESOLVED). An undeclared
|
|
249
|
+
* `vars.<name>` read (EXPR_UNDECLARED_REF) no longer throws it; `check`
|
|
250
|
+
* reports that one. Same shape as the flow's `FlowBuildError`: `message` lists
|
|
251
|
+
* every problem; `diagnostics` carries them structured.
|
|
234
252
|
*/
|
|
235
253
|
export class CaseBuildError extends CompileRefusal {
|
|
236
254
|
diagnostics;
|
|
@@ -238,7 +256,7 @@ export class CaseBuildError extends CompileRefusal {
|
|
|
238
256
|
const label = built.name || built.id || 'case';
|
|
239
257
|
const lines = diagnostics.map((d) => ` ✗ [${d.code}] in ${d.where}: ${d.message}${d.suggestion ? ` (did you mean "${d.suggestion}"?)` : ''}`);
|
|
240
258
|
// The first problem's code; `diagnostics` carries every one.
|
|
241
|
-
super(diagnostics[0]?.code ?? '
|
|
259
|
+
super(diagnostics[0]?.code ?? 'TASK_OUTPUT_REF_UNRESOLVED', `Cannot build case "${label}" — ${diagnostics.length} expression problem(s):\n${lines.join('\n')}`);
|
|
242
260
|
this.name = 'CaseBuildError';
|
|
243
261
|
this.diagnostics = diagnostics;
|
|
244
262
|
}
|
package/dist/case/case-sdk.js
CHANGED
|
@@ -22,7 +22,7 @@ import { CASE_SCRIPT_RUNTIME } from './script.js';
|
|
|
22
22
|
import { ACTION_PASSTHROUGH_SETTINGS } from './action-settings.js';
|
|
23
23
|
import { connector as makeConnector, subscriptionFrom, } from '../core/actions.js';
|
|
24
24
|
import { isTriggerDescriptor } from '../core/connectors.js';
|
|
25
|
-
import {
|
|
25
|
+
import { caseExprRefusals, CaseBuildError } from './case-expr-check.js';
|
|
26
26
|
import { taskOutputMarker } from './task-output-ref.js';
|
|
27
27
|
import { CASE_FORMAT_PROFILE, CASE_SCHEMA_VERSIONS, recordAuthoredCaseVersion } from './format-profile.js';
|
|
28
28
|
import { schemaVersionRefusal } from '../schema-version.js';
|
|
@@ -1445,10 +1445,13 @@ class CaseBuilder {
|
|
|
1445
1445
|
};
|
|
1446
1446
|
if (this._authoredVersion !== undefined)
|
|
1447
1447
|
recordAuthoredCaseVersion(built, this._authoredVersion);
|
|
1448
|
-
//
|
|
1449
|
-
//
|
|
1450
|
-
//
|
|
1451
|
-
|
|
1448
|
+
// A task-output reference that names no stage, task or output is refused
|
|
1449
|
+
// here (TASK_OUTPUT_REF_UNRESOLVED, `lowering`). A `lint` finding (a read of
|
|
1450
|
+
// a `vars.<name>` nothing declares, EXPR_UNDECLARED_REF) is not: the
|
|
1451
|
+
// serializer writes that read as authored, so `check` reports it and a
|
|
1452
|
+
// brownfield plan that already has one still builds, compiles and merges
|
|
1453
|
+
// (decided on builder-sdk#1712). See case-expr-check.
|
|
1454
|
+
const errors = caseExprRefusals(built);
|
|
1452
1455
|
if (errors.length)
|
|
1453
1456
|
throw new CaseBuildError(built, errors);
|
|
1454
1457
|
return built;
|
package/dist/case/check.js
CHANGED
|
@@ -10,6 +10,7 @@ import { httpRequestLint } from './http-request.js';
|
|
|
10
10
|
import { checkRuleSemantics } from './check-rule-semantics.js';
|
|
11
11
|
import { serialize } from './serialize.js';
|
|
12
12
|
import { lintPlanFindings, planReport } from './plan-check/index.js';
|
|
13
|
+
import { caseExprLints } from './case-expr-check.js';
|
|
13
14
|
const TYPE_NAMES = new Set(Object.values(types));
|
|
14
15
|
// audit-case-coverage: rule-slot table start
|
|
15
16
|
// This runtime table must equal the committed matrix's rejected cells. The audit
|
|
@@ -183,23 +184,25 @@ export function check(built, opts = {}) {
|
|
|
183
184
|
};
|
|
184
185
|
// An In-arg with no `{ from }` and no primary trigger to bind to is the
|
|
185
186
|
// serializer's CASE_IN_ARG_UNBOUND (in-arg-binding.ts), reported per arg.
|
|
186
|
-
// ── `=js:vars.<name>` resolvability
|
|
187
|
-
//
|
|
188
|
-
//
|
|
189
|
-
// and
|
|
190
|
-
//
|
|
191
|
-
//
|
|
192
|
-
//
|
|
193
|
-
//
|
|
194
|
-
//
|
|
195
|
-
//
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
187
|
+
// ── `=js:vars.<name>` resolvability ─────────────────────────────────────────
|
|
188
|
+
// A read of a `vars.<name>` no variable declares (EXPR_UNDECLARED_REF) is
|
|
189
|
+
// `lint`: the serializer writes it as authored, so it is reported here, on
|
|
190
|
+
// the gate it is in, and never stops `build()` or `compile` (decided on
|
|
191
|
+
// builder-sdk#1712; it was a CaseBuildError from build() since #257). The
|
|
192
|
+
// declared set is the serializer's (`inputOutputs` companions: `.var()`s, task
|
|
193
|
+
// and action outputs, trigger extractions), so a declared `.var()` is not
|
|
194
|
+
// flagged. The refusing findings stay in build() (`caseExprRefusals`).
|
|
195
|
+
// The location and the near-miss hint go into the message too: `case check`
|
|
196
|
+
// prints `[code] message`, and its JSON carries no `where`.
|
|
197
|
+
const exprLints = caseExprLints(built);
|
|
198
|
+
for (const d of exprLints)
|
|
199
|
+
diags.push({
|
|
200
|
+
level: d.level, code: d.code,
|
|
201
|
+
message: `in ${d.where}: ${d.message}${d.suggestion ? ` (did you mean "${d.suggestion}"?)` : ''}`,
|
|
202
|
+
where: d.where,
|
|
203
|
+
...(d.suggestion ? { suggestion: d.suggestion } : {}),
|
|
204
|
+
});
|
|
205
|
+
const reportedReads = exprLints.flatMap((d) => (d.read ? [d.read] : []));
|
|
203
206
|
for (const stage of built.stages) {
|
|
204
207
|
checkStage(stage, diags, refStage, refPlacement);
|
|
205
208
|
stage.slaRules.forEach((s, i) => checkSla(s, `stage "${stage.label}" SLA #${i + 1}`, diags));
|
|
@@ -240,7 +243,7 @@ export function check(built, opts = {}) {
|
|
|
240
243
|
diags.push({ level: 'error', code: f.code, message: f.message, ...(f.suggestion ? { suggestion: f.suggestion } : {}), where: t.name });
|
|
241
244
|
checkRuleSemantics(built, diags);
|
|
242
245
|
checkLibraryConnectors(built, opts, diags);
|
|
243
|
-
diags.push(...serializerRefusals(built, opts, diags));
|
|
246
|
+
diags.push(...serializerRefusals(built, opts, diags, reportedReads));
|
|
244
247
|
return diags;
|
|
245
248
|
}
|
|
246
249
|
/**
|
|
@@ -256,7 +259,7 @@ export function check(built, opts = {}) {
|
|
|
256
259
|
* `internal SDK error:` is passed on, unless `check` or the serializer already
|
|
257
260
|
* found an error, which the author has to fix first.
|
|
258
261
|
*/
|
|
259
|
-
function serializerRefusals(built, opts, found) {
|
|
262
|
+
function serializerRefusals(built, opts, found, reportedReads = []) {
|
|
260
263
|
const collected = [];
|
|
261
264
|
const warned = [];
|
|
262
265
|
let plan;
|
|
@@ -299,6 +302,8 @@ function serializerRefusals(built, opts, found) {
|
|
|
299
302
|
// one place they are heard.
|
|
300
303
|
if (plan)
|
|
301
304
|
for (const f of lintPlanFindings(plan)) {
|
|
305
|
+
if (sameReadAsExprLint(plan, f, reportedReads))
|
|
306
|
+
continue;
|
|
302
307
|
const r = planReport(f);
|
|
303
308
|
out.push({
|
|
304
309
|
level: f.level, code: r.code, message: r.message,
|
|
@@ -317,6 +322,64 @@ function serializerRefusals(built, opts, found) {
|
|
|
317
322
|
}
|
|
318
323
|
return out;
|
|
319
324
|
}
|
|
325
|
+
/** The value at a plan-check path (`nodes[1].data.tasks[0][0].skipCondition`). */
|
|
326
|
+
function valueAtPlanPath(plan, path) {
|
|
327
|
+
let at = plan;
|
|
328
|
+
for (const m of path.matchAll(/([^.[\]]+)|\[(\d+)\]/g)) {
|
|
329
|
+
if (at === null || typeof at !== 'object')
|
|
330
|
+
return undefined;
|
|
331
|
+
at = at[m[2] ?? m[1]];
|
|
332
|
+
}
|
|
333
|
+
return at;
|
|
334
|
+
}
|
|
335
|
+
/** An expression without its `=js:` / `=` prefix, outer parentheses and spacing, so an authored gate and the text the plan carries compare. */
|
|
336
|
+
function exprBody(text) {
|
|
337
|
+
let body = text.trim().replace(/^=(?:js:)?/, '').trim();
|
|
338
|
+
while (/^\(.*\)$/s.test(body))
|
|
339
|
+
body = body.slice(1, -1).trim();
|
|
340
|
+
return body;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* The plan fields the expression check reads, where plan-check's
|
|
344
|
+
* REFERENCE_UNBOUND can be about the same read: a rule's
|
|
345
|
+
* `conditionExpression`, a task's `skipCondition` and an SLA's `expression`
|
|
346
|
+
* hold the gate as authored, so the read must equal it.
|
|
347
|
+
*/
|
|
348
|
+
const GATE_PATH = /(?:\.conditionExpression|\.skipCondition|slaRules\[\d+\]\.expression)$/;
|
|
349
|
+
/**
|
|
350
|
+
* A wait filter's expression sits inside a larger encoded value, so the read
|
|
351
|
+
* is found by containment: the filter body
|
|
352
|
+
* (`…inputs[0].body.filters.variables.var_0`) and the encoded configuration
|
|
353
|
+
* (`…context[8].body.activityPropertyConfiguration.configuration`).
|
|
354
|
+
*/
|
|
355
|
+
const WAIT_FILTER_PATH = /\.body\.(?:filters\b|activityPropertyConfiguration\.configuration$)/;
|
|
356
|
+
/**
|
|
357
|
+
* True when `f` is plan-check's CASE_MGMT_REFERENCE_UNBOUND on a read the
|
|
358
|
+
* expression check already reported as EXPR_UNDECLARED_REF: the same root, in
|
|
359
|
+
* plan text written from that expression (the gate verbatim, or a wait
|
|
360
|
+
* filter's expression inside its encoded configuration). One mistake, one
|
|
361
|
+
* finding. A REFERENCE_UNBOUND anywhere else, such as a task input
|
|
362
|
+
* `=vars.x` or a connector body field, which the expression check does not
|
|
363
|
+
* read, is still reported, even when its text equals the gate's.
|
|
364
|
+
*/
|
|
365
|
+
function sameReadAsExprLint(plan, f, reads) {
|
|
366
|
+
if (f.code !== 'CASE_MGMT_REFERENCE_UNBOUND' || !reads.length)
|
|
367
|
+
return false;
|
|
368
|
+
const gate = GATE_PATH.test(f.path);
|
|
369
|
+
const contained = !gate && WAIT_FILTER_PATH.test(f.path);
|
|
370
|
+
if (!gate && !contained)
|
|
371
|
+
return false;
|
|
372
|
+
const value = valueAtPlanPath(plan, f.path);
|
|
373
|
+
if (typeof value !== 'string')
|
|
374
|
+
return false;
|
|
375
|
+
const body = exprBody(value);
|
|
376
|
+
return reads.some((r) => {
|
|
377
|
+
if (!f.message.startsWith(`"vars.${r.root}"`))
|
|
378
|
+
return false;
|
|
379
|
+
const read = exprBody(r.expr);
|
|
380
|
+
return gate ? read === body : value.includes(read);
|
|
381
|
+
});
|
|
382
|
+
}
|
|
320
383
|
/**
|
|
321
384
|
* The connector-library warnings only `check` gives (#1014): a connector task's
|
|
322
385
|
* schema-readiness warnings, because the `connectors-local` overlay `registry
|
package/dist/case/compile-cli.js
CHANGED
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Only serializes, to a V32 caseplan.json (docs/CHECK_COMPILE_CONTRACT_DESIGN.md
|
|
9
9
|
* D1, phase 8). It does not run `check()`'s lint rules: run `case check` first
|
|
10
|
-
* for those.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* for those. One exception, as a warning that does not stop the write: a gate
|
|
11
|
+
* reading an undeclared case variable (EXPR_UNDECLARED_REF). It stops only
|
|
12
|
+
* when it cannot write a correct plan, a refusal the serializer throws,
|
|
13
|
+
* printed in `check`'s `✗ [CODE]` shape (and `case check` reports the same
|
|
14
|
+
* refusal, from the same code). The authoritative deploy gate
|
|
13
15
|
* is `uip maestro case validate`.
|
|
14
16
|
* Output defaults to the plan file the project in the working directory ships
|
|
15
17
|
* (`caseplan.case` for a project `uip maestro case init` scaffolded), else
|
|
@@ -34,6 +36,7 @@ import { ensureTypeScriptRuntime } from '../node-runtime.js';
|
|
|
34
36
|
import { CASE_FORMAT_PROFILE } from './format-profile.js';
|
|
35
37
|
import { deriveCaseBindingsV2 } from './bindings-v2.js';
|
|
36
38
|
import { orphanWarnings } from './orphaned-resources.js';
|
|
39
|
+
import { caseExprLints } from './case-expr-check.js';
|
|
37
40
|
import { BINDINGS_V2_DOCUMENT_VERSION } from '../core/bindings-v2-resource.js';
|
|
38
41
|
import { sha256Uuid } from '../core/stable-id.js';
|
|
39
42
|
export async function run(argv) {
|
|
@@ -91,6 +94,15 @@ export async function run(argv) {
|
|
|
91
94
|
}
|
|
92
95
|
// Solution declarations no project binds once this derivation lands.
|
|
93
96
|
warnings.push(...orphanWarnings(caseplan, out));
|
|
97
|
+
// A gate that reads a case variable nothing declares (`=js:vars.missing`):
|
|
98
|
+
// `lint`, so compile writes it as authored (#1712), but it is a definite
|
|
99
|
+
// mistake the gate will evaluate as `undefined`, so compile says so for an
|
|
100
|
+
// agent that skipped `case check`, which reports it as an error.
|
|
101
|
+
for (const d of caseExprLints(built))
|
|
102
|
+
warnings.push({
|
|
103
|
+
level: 'warning', code: d.code, message: `in ${d.where}: ${d.message}`, where: d.where,
|
|
104
|
+
...(d.suggestion ? { suggestion: d.suggestion } : {}),
|
|
105
|
+
});
|
|
94
106
|
for (const w of warnings)
|
|
95
107
|
console.error(` ${diagnosticLine(w)}`);
|
|
96
108
|
// Reported before the first write, so a write that throws still carries it.
|
package/dist/case/decompile.d.ts
CHANGED
|
@@ -191,7 +191,7 @@ export interface DecompileOptions {
|
|
|
191
191
|
bestEffort?: boolean;
|
|
192
192
|
}
|
|
193
193
|
export interface CaseDecompileDiagnostic {
|
|
194
|
-
code: 'UNSUPPORTED_TASK_KIND' | 'UNKNOWN_STAGE_REFERENCE' | 'UNKNOWN_TASK_REFERENCE' | 'UNKNOWN_EXIT_TARGET'
|
|
194
|
+
code: 'UNSUPPORTED_TASK_KIND' | 'UNKNOWN_STAGE_REFERENCE' | 'UNKNOWN_TASK_REFERENCE' | 'UNKNOWN_EXIT_TARGET';
|
|
195
195
|
message: string;
|
|
196
196
|
location: string;
|
|
197
197
|
}
|
package/dist/case/decompile.js
CHANGED
|
@@ -25,8 +25,6 @@ import { bindingIdCandidates, offlineBindingLabel } from './ids.js';
|
|
|
25
25
|
import { bindingRefId, isLiftFailure, isMintedWire, liftResourceFolder, liftResourceName, readBindingIds, resourceBindingOf, typedFolder, wireRows, } from './resource-wire.js';
|
|
26
26
|
import { connectorPlaceholderKindOf } from './connector-placeholder.js';
|
|
27
27
|
import { raiseTaskOutputReads, referableOutputIds } from './task-output-ref.js';
|
|
28
|
-
import { defaultActionOutputVar } from './action-output-var.js';
|
|
29
|
-
import { platformVariables, undeclaredVarReads } from './case-expr-check.js';
|
|
30
28
|
const TASK_KIND_METHOD = {
|
|
31
29
|
process: 'process',
|
|
32
30
|
agent: 'agent',
|
|
@@ -2828,7 +2826,6 @@ export function decompileWithDiagnostics(plan, options = {}) {
|
|
|
2828
2826
|
const diagnostics = [];
|
|
2829
2827
|
refuseUnsupportedAuthoring(plan);
|
|
2830
2828
|
plan = raiseTaskOutputRefs(plan);
|
|
2831
|
-
refuseUndeclaredGateReads(plan, options.bestEffort ? diagnostics : undefined);
|
|
2832
2829
|
const preservation = collectPreservation(plan);
|
|
2833
2830
|
const refs = buildRefs(plan, options.library, options.bestEffort ? diagnostics : undefined);
|
|
2834
2831
|
const selectNextStage = selectNextStageByExit(plan, refs);
|
|
@@ -2917,90 +2914,6 @@ export function decompileWithDiagnostics(plan, options = {}) {
|
|
|
2917
2914
|
const source = `import { ${imports.join(', ')} } from ${tsLiteral(options.importSpecifier ?? './case-sdk.js')};\n\n${diagnosticHeader}${out.toString()}\n`;
|
|
2918
2915
|
return { source, diagnostics };
|
|
2919
2916
|
}
|
|
2920
|
-
/**
|
|
2921
|
-
* Every name a `vars.<name>` gate of `plan` may read without `build()` calling
|
|
2922
|
-
* it undeclared: what the plan's rows declare (each `id` / `var` / `name`, a
|
|
2923
|
-
* literal `value` / `target`), an action form field's default variable, and the
|
|
2924
|
-
* variables the platform declares for every case. It is a superset of the roots
|
|
2925
|
-
* `build()` checks the decompiled source against, so decompile never refuses a
|
|
2926
|
-
* gate compile accepts.
|
|
2927
|
-
*/
|
|
2928
|
-
function gateRoots(plan) {
|
|
2929
|
-
const roots = new Set(platformVariables((plan.nodes ?? []).filter(isStage).map((s) => String(s.data?.label ?? ''))));
|
|
2930
|
-
const walk = (value, inAction) => {
|
|
2931
|
-
if (Array.isArray(value)) {
|
|
2932
|
-
for (const item of value)
|
|
2933
|
-
walk(item, inAction);
|
|
2934
|
-
return;
|
|
2935
|
-
}
|
|
2936
|
-
if (!value || typeof value !== 'object')
|
|
2937
|
-
return;
|
|
2938
|
-
const row = value;
|
|
2939
|
-
const action = inAction || row.type === 'action';
|
|
2940
|
-
for (const [key, field] of Object.entries(row)) {
|
|
2941
|
-
if (typeof field === 'string') {
|
|
2942
|
-
if (key === 'id' || key === 'var' || key === 'name')
|
|
2943
|
-
roots.add(field);
|
|
2944
|
-
if ((key === 'value' || key === 'target') && !field.startsWith('='))
|
|
2945
|
-
roots.add(field);
|
|
2946
|
-
if ((key === 'value' || key === 'target') && /^=[\w$]+$/.test(field))
|
|
2947
|
-
roots.add(field.slice(1));
|
|
2948
|
-
if (key === 'name' && action)
|
|
2949
|
-
roots.add(defaultActionOutputVar(field));
|
|
2950
|
-
}
|
|
2951
|
-
else
|
|
2952
|
-
walk(field, action);
|
|
2953
|
-
}
|
|
2954
|
-
};
|
|
2955
|
-
walk({ ...plan, metadata: undefined }, false);
|
|
2956
|
-
walk(plan.metadata, false);
|
|
2957
|
-
return roots;
|
|
2958
|
-
}
|
|
2959
|
-
/**
|
|
2960
|
-
* Refuse a gate that reads a variable the plan does not declare. `build()`
|
|
2961
|
-
* rejects such a reference (`EXPR_UNDECLARED_REF`: `vars.` is a closed
|
|
2962
|
-
* namespace, and the runtime reads the name as `undefined`), so writing the
|
|
2963
|
-
* gate into the source would only hand the author source compile refuses.
|
|
2964
|
-
* Names the platform declares for every case (`stageHasRun_<stage>`, ...) are
|
|
2965
|
-
* not refused; see `platformVariables`.
|
|
2966
|
-
*/
|
|
2967
|
-
function refuseUndeclaredGateReads(plan, diagnostics) {
|
|
2968
|
-
const roots = gateRoots(plan);
|
|
2969
|
-
const check = (expr, where) => {
|
|
2970
|
-
if (typeof expr !== 'string' || !expr)
|
|
2971
|
-
return;
|
|
2972
|
-
const missing = undeclaredVarReads(expr, roots);
|
|
2973
|
-
if (!missing.length)
|
|
2974
|
-
return;
|
|
2975
|
-
const reads = `reads ${missing.map((name) => `\`vars.${name}\``).join(', ')}, which no variable of the plan declares `
|
|
2976
|
-
+ '(compile refuses it: EXPR_UNDECLARED_REF; at runtime it reads as undefined)';
|
|
2977
|
-
// Best effort keeps the gate and marks the source as needing this repair.
|
|
2978
|
-
if (diagnostics) {
|
|
2979
|
-
diagnostics.push({ code: 'UNDECLARED_VARIABLE_REFERENCE', location: where, message: `${reads}. Declare the variable, or fix the expression.` });
|
|
2980
|
-
return;
|
|
2981
|
-
}
|
|
2982
|
-
throw new Error(`${where} ${reads}. Declare the variable, or fix the expression to read one the case declares, then decompile again.`);
|
|
2983
|
-
};
|
|
2984
|
-
const rules = (conditions, where) => {
|
|
2985
|
-
for (const condition of conditions ?? [])
|
|
2986
|
-
for (const group of condition.rules ?? [])
|
|
2987
|
-
for (const r of group ?? [])
|
|
2988
|
-
check(r?.conditionExpression, where);
|
|
2989
|
-
};
|
|
2990
|
-
(plan.metadata?.slaRules ?? []).forEach((sla, i) => check(sla?.expression, `case SLA #${i + 1}`));
|
|
2991
|
-
rules(plan.metadata?.caseExitRules, 'case completion rule');
|
|
2992
|
-
for (const stage of (plan.nodes ?? []).filter(isStage)) {
|
|
2993
|
-
const at = `stage "${stage.data?.label ?? stage.id ?? '?'}"`;
|
|
2994
|
-
rules(stage.data?.entryConditions, `${at} entry rule`);
|
|
2995
|
-
rules(stage.data?.exitConditions, `${at} exit rule`);
|
|
2996
|
-
(stage.data?.slaRules ?? []).forEach((sla, i) => check(sla?.expression, `${at} SLA #${i + 1}`));
|
|
2997
|
-
for (const task of (stage.data?.tasks ?? []).flat()) {
|
|
2998
|
-
const tat = `task "${task?.displayName ?? task?.id ?? '?'}" in ${at}`;
|
|
2999
|
-
check(task?.skipCondition, `${tat} skip condition`);
|
|
3000
|
-
rules(task?.entryConditions, `${tat} entry rule`);
|
|
3001
|
-
}
|
|
3002
|
-
}
|
|
3003
|
-
}
|
|
3004
2917
|
/**
|
|
3005
2918
|
* The plan with each read of a task output that recompiling could not keep,
|
|
3006
2919
|
* `vars.<output id>`, written as the task-output reference that names the same
|
package/dist/core/refusals.d.ts
CHANGED
|
@@ -240,6 +240,8 @@ export declare const REFUSALS: {
|
|
|
240
240
|
readonly CONTRIBUTION_INVALID: "lowering";
|
|
241
241
|
readonly CONVERSATION_NO_ID: "lint";
|
|
242
242
|
readonly CONVERSATION_RANGE: "lint";
|
|
243
|
+
readonly CONVERSATION_TRIGGER_APPEARANCE_VERSION: "lowering";
|
|
244
|
+
readonly CONVERSATION_TRIGGER_DISPLAY_PROMPT_REQUIRED: "lint";
|
|
243
245
|
readonly CONV_AGENT_CUSTOM_NO_ID: "lint";
|
|
244
246
|
readonly CONV_AGENT_NO_MODEL: "lint";
|
|
245
247
|
readonly CONV_AGENT_NO_PROMPT: "lint";
|
package/dist/core/refusals.js
CHANGED
|
@@ -313,6 +313,8 @@ export const REFUSALS = {
|
|
|
313
313
|
CONTRIBUTION_INVALID: 'lowering',
|
|
314
314
|
CONVERSATION_NO_ID: 'lint',
|
|
315
315
|
CONVERSATION_RANGE: 'lint',
|
|
316
|
+
CONVERSATION_TRIGGER_APPEARANCE_VERSION: 'lowering',
|
|
317
|
+
CONVERSATION_TRIGGER_DISPLAY_PROMPT_REQUIRED: 'lint',
|
|
316
318
|
CONV_AGENT_CUSTOM_NO_ID: 'lint',
|
|
317
319
|
CONV_AGENT_NO_MODEL: 'lint',
|
|
318
320
|
CONV_AGENT_NO_PROMPT: 'lint',
|
|
@@ -11361,6 +11361,160 @@
|
|
|
11361
11361
|
}
|
|
11362
11362
|
}
|
|
11363
11363
|
},
|
|
11364
|
+
"core.trigger.conversation@1.3": {
|
|
11365
|
+
"nodeType": "core.trigger.conversation",
|
|
11366
|
+
"version": "1.3",
|
|
11367
|
+
"category": "trigger",
|
|
11368
|
+
"description": "Start this process when a new conversation is created",
|
|
11369
|
+
"tags": [
|
|
11370
|
+
"trigger",
|
|
11371
|
+
"conversation",
|
|
11372
|
+
"start"
|
|
11373
|
+
],
|
|
11374
|
+
"sortOrder": 88,
|
|
11375
|
+
"display": {
|
|
11376
|
+
"label": "Conversation trigger",
|
|
11377
|
+
"icon": "messagesSquare",
|
|
11378
|
+
"shape": "circle"
|
|
11379
|
+
},
|
|
11380
|
+
"handleConfiguration": [
|
|
11381
|
+
{
|
|
11382
|
+
"position": "right",
|
|
11383
|
+
"handles": [
|
|
11384
|
+
{
|
|
11385
|
+
"id": "output",
|
|
11386
|
+
"type": "source",
|
|
11387
|
+
"handleType": "output",
|
|
11388
|
+
"showButton": true,
|
|
11389
|
+
"constraints": {
|
|
11390
|
+
"forbiddenTargetCategories": [
|
|
11391
|
+
"trigger"
|
|
11392
|
+
]
|
|
11393
|
+
}
|
|
11394
|
+
}
|
|
11395
|
+
],
|
|
11396
|
+
"visible": true
|
|
11397
|
+
}
|
|
11398
|
+
],
|
|
11399
|
+
"model": {
|
|
11400
|
+
"type": "bpmn:StartEvent",
|
|
11401
|
+
"entryPointId": true
|
|
11402
|
+
},
|
|
11403
|
+
"inputDefinition": {
|
|
11404
|
+
"type": "object",
|
|
11405
|
+
"properties": {
|
|
11406
|
+
"appearance": {
|
|
11407
|
+
"type": "object",
|
|
11408
|
+
"properties": {
|
|
11409
|
+
"welcomeTitle": {
|
|
11410
|
+
"type": "string"
|
|
11411
|
+
},
|
|
11412
|
+
"welcomeDescription": {
|
|
11413
|
+
"type": "string"
|
|
11414
|
+
},
|
|
11415
|
+
"startingPrompts": {
|
|
11416
|
+
"type": "array",
|
|
11417
|
+
"items": {
|
|
11418
|
+
"type": "object",
|
|
11419
|
+
"properties": {
|
|
11420
|
+
"id": {
|
|
11421
|
+
"type": "string"
|
|
11422
|
+
},
|
|
11423
|
+
"displayPrompt": {
|
|
11424
|
+
"type": "string"
|
|
11425
|
+
},
|
|
11426
|
+
"actualPrompt": {
|
|
11427
|
+
"type": "string"
|
|
11428
|
+
}
|
|
11429
|
+
},
|
|
11430
|
+
"required": [
|
|
11431
|
+
"id",
|
|
11432
|
+
"displayPrompt",
|
|
11433
|
+
"actualPrompt"
|
|
11434
|
+
]
|
|
11435
|
+
}
|
|
11436
|
+
},
|
|
11437
|
+
"personalWorkspaceConnectionsOnly": {
|
|
11438
|
+
"type": "boolean"
|
|
11439
|
+
}
|
|
11440
|
+
}
|
|
11441
|
+
}
|
|
11442
|
+
}
|
|
11443
|
+
},
|
|
11444
|
+
"inputDefaults": {
|
|
11445
|
+
"appearance": {
|
|
11446
|
+
"personalWorkspaceConnectionsOnly": true
|
|
11447
|
+
}
|
|
11448
|
+
},
|
|
11449
|
+
"outputDefinition": {
|
|
11450
|
+
"output": {
|
|
11451
|
+
"type": "object",
|
|
11452
|
+
"description": "Data passed when this conversation trigger starts the process.",
|
|
11453
|
+
"source": "null",
|
|
11454
|
+
"var": "output",
|
|
11455
|
+
"schema": {
|
|
11456
|
+
"type": "object",
|
|
11457
|
+
"properties": {
|
|
11458
|
+
"conversationId": {
|
|
11459
|
+
"type": "string",
|
|
11460
|
+
"format": "uuid",
|
|
11461
|
+
"description": "Identifier of the conversation that started this flow"
|
|
11462
|
+
}
|
|
11463
|
+
},
|
|
11464
|
+
"required": [
|
|
11465
|
+
"conversationId"
|
|
11466
|
+
]
|
|
11467
|
+
}
|
|
11468
|
+
}
|
|
11469
|
+
},
|
|
11470
|
+
"form": {
|
|
11471
|
+
"id": "conversation-trigger-properties",
|
|
11472
|
+
"title": "Conversation trigger",
|
|
11473
|
+
"sections": [
|
|
11474
|
+
{
|
|
11475
|
+
"id": "appearance",
|
|
11476
|
+
"title": "Appearance",
|
|
11477
|
+
"collapsible": true,
|
|
11478
|
+
"defaultExpanded": true,
|
|
11479
|
+
"fields": [
|
|
11480
|
+
{
|
|
11481
|
+
"name": "inputs.appearance.welcomeTitle",
|
|
11482
|
+
"type": "text",
|
|
11483
|
+
"label": "Welcome title"
|
|
11484
|
+
},
|
|
11485
|
+
{
|
|
11486
|
+
"name": "inputs.appearance.welcomeDescription",
|
|
11487
|
+
"type": "text",
|
|
11488
|
+
"label": "Welcome description"
|
|
11489
|
+
},
|
|
11490
|
+
{
|
|
11491
|
+
"name": "inputs.appearance.startingPrompts",
|
|
11492
|
+
"type": "custom",
|
|
11493
|
+
"component": "starting-prompts-editor",
|
|
11494
|
+
"label": "Starting prompts"
|
|
11495
|
+
},
|
|
11496
|
+
{
|
|
11497
|
+
"name": "inputs.appearance.personalWorkspaceConnectionsOnly",
|
|
11498
|
+
"type": "switch",
|
|
11499
|
+
"label": "Display personal workspace connections only",
|
|
11500
|
+
"description": "Displays only personal workspace connections in the chat's connection settings menu"
|
|
11501
|
+
}
|
|
11502
|
+
]
|
|
11503
|
+
}
|
|
11504
|
+
]
|
|
11505
|
+
},
|
|
11506
|
+
"toolbarExtensions": {
|
|
11507
|
+
"design": {
|
|
11508
|
+
"actions": [
|
|
11509
|
+
{
|
|
11510
|
+
"id": "change-trigger-type",
|
|
11511
|
+
"icon": "square-mouse-pointer",
|
|
11512
|
+
"label": "Change trigger type"
|
|
11513
|
+
}
|
|
11514
|
+
]
|
|
11515
|
+
}
|
|
11516
|
+
}
|
|
11517
|
+
},
|
|
11364
11518
|
"uipath.agent.conversational@1.6": {
|
|
11365
11519
|
"nodeType": "uipath.agent.conversational",
|
|
11366
11520
|
"version": "1.6",
|
package/dist/flow-node-type.d.ts
CHANGED
|
@@ -654,6 +654,8 @@ export interface FlowTriggerSerializeContext {
|
|
|
654
654
|
* wrote none.
|
|
655
655
|
*/
|
|
656
656
|
entryPointId(seed?: string): string;
|
|
657
|
+
/** A GUID minted from the flow's id, the root's id and `key`: stable across compiles, unlike the designer's random ones. */
|
|
658
|
+
stableId(key: string): string;
|
|
657
659
|
/** The connector library serialize was given, for a trigger that resolves a connector event. */
|
|
658
660
|
readonly library: SerializeOpts['library'];
|
|
659
661
|
/** What an event subscription's shared emission needs, as `FlowSerializeContext.events`. */
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The trigger family's rules: a schedule's interval,
|
|
3
|
-
* inputs decide (a form with no fields, a
|
|
4
|
-
* none). Moved from check.ts in Phase 4 of docs/NODE_TYPE_ARCHITECTURE_DESIGN.md;
|
|
2
|
+
* The trigger family's rules: a schedule's interval, a conversation's starting
|
|
3
|
+
* prompts, and the rules a root's inputs decide (a form with no fields, a
|
|
4
|
+
* conversation or call that is passed none). Moved from check.ts in Phase 4 of docs/NODE_TYPE_ARCHITECTURE_DESIGN.md;
|
|
5
5
|
* codes and messages unchanged.
|
|
6
6
|
*/
|
|
7
7
|
import type { DiagnosticCatalog } from '../../../core/nodes/family.js';
|
|
8
8
|
import type { FlowTriggerCheckContext } from '../../../flow-node-type.js';
|
|
9
|
-
import { type ScheduledInputs } from './spec.js';
|
|
9
|
+
import { type ScheduledInputs, type StartingPrompt } from './spec.js';
|
|
10
10
|
export declare const TRIGGER_DIAGNOSTICS: DiagnosticCatalog;
|
|
11
11
|
/**
|
|
12
12
|
* The ISO-8601 repeating-interval pattern, copied VERBATIM from the
|
|
@@ -57,3 +57,9 @@ export declare function fitsScheduleV12(every: string): boolean;
|
|
|
57
57
|
export declare function checkSchedule(spec: {
|
|
58
58
|
inputs?: ScheduledInputs;
|
|
59
59
|
} | undefined, ctx: FlowTriggerCheckContext): void;
|
|
60
|
+
/**
|
|
61
|
+
* A starting prompt the chat would drop: one with no display prompt has no chip
|
|
62
|
+
* label. The code is the designer's own validation rule's, so `check` and
|
|
63
|
+
* `validate` name the problem the same way.
|
|
64
|
+
*/
|
|
65
|
+
export declare function checkStartingPrompts(prompts: ReadonlyArray<string | StartingPrompt> | undefined, ctx: FlowTriggerCheckContext): void;
|
|
@@ -6,6 +6,7 @@ export const TRIGGER_DIAGNOSTICS = {
|
|
|
6
6
|
FORM_TRIGGER_NO_INPUTS: { severity: 'error', summary: 'a form trigger on a root with no inputs, so the form has no fields' },
|
|
7
7
|
TRIGGER_INPUTS_IGNORED: { severity: 'warning', summary: 'an entry point declares inputs its trigger never passes' },
|
|
8
8
|
SINGLE_CONVERSATION_TRIGGER: { severity: 'error', summary: 'a second root started by a conversation' },
|
|
9
|
+
CONVERSATION_TRIGGER_DISPLAY_PROMPT_REQUIRED: { severity: 'error', summary: 'a starting prompt with no display prompt, which the chat drops' },
|
|
9
10
|
};
|
|
10
11
|
/**
|
|
11
12
|
* The ISO-8601 repeating-interval pattern, copied VERBATIM from the
|
|
@@ -119,3 +120,17 @@ function nearestInterval(every) {
|
|
|
119
120
|
const word = INTERVAL_WORDS.find(([w]) => lower.includes(w));
|
|
120
121
|
return word ? `every: '${word[1]}'` : undefined;
|
|
121
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* A starting prompt the chat would drop: one with no display prompt has no chip
|
|
125
|
+
* label. The code is the designer's own validation rule's, so `check` and
|
|
126
|
+
* `validate` name the problem the same way.
|
|
127
|
+
*/
|
|
128
|
+
export function checkStartingPrompts(prompts, ctx) {
|
|
129
|
+
(prompts ?? []).forEach((prompt, index) => {
|
|
130
|
+
const display = typeof prompt === 'string' ? prompt : prompt?.displayPrompt;
|
|
131
|
+
if (typeof display === 'string' && display.trim() !== '')
|
|
132
|
+
return;
|
|
133
|
+
ctx.report('CONVERSATION_TRIGGER_DISPLAY_PROMPT_REQUIRED', `conversationTrigger(): starting prompt ${index + 1} has no display prompt, the label the chat shows on it, `
|
|
134
|
+
+ 'so the chat drops it. Give it a displayPrompt.', "startingPrompts: [{ displayPrompt: 'Renew my loans', actualPrompt: 'Renew every loan due this week.' }]");
|
|
135
|
+
});
|
|
136
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ScheduledInputs, TriggerSpec } from './spec.js';
|
|
1
|
+
import type { ConversationAppearance, ScheduledInputs, TriggerSpec } from './spec.js';
|
|
2
2
|
/**
|
|
3
3
|
* The manual trigger, explicitly. Omitting `.trigger(...)` means exactly this —
|
|
4
4
|
* the factory exists so decompiled source can carry the trigger's exact
|
|
@@ -76,15 +76,31 @@ export declare function formTrigger(): TriggerSpec;
|
|
|
76
76
|
*
|
|
77
77
|
* The trigger publishes the conversation it started —
|
|
78
78
|
* `out('start', 'conversationId')` — which is what every conversational step
|
|
79
|
-
* is keyed by.
|
|
79
|
+
* is keyed by.
|
|
80
80
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
81
|
+
* What the chat looks like before the user types is the trigger's appearance:
|
|
82
|
+
*
|
|
83
|
+
* ```ts
|
|
84
|
+
* .trigger(conversationTrigger({
|
|
85
|
+
* welcomeTitle: 'Library desk',
|
|
86
|
+
* welcomeDescription: 'Ask about loans, renewals and holds.',
|
|
87
|
+
* startingPrompts: ['Renew my loans', { displayPrompt: 'Place a hold', actualPrompt: 'I want to place a hold on a book.' }],
|
|
88
|
+
* }))
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* The trigger is written at 1.3, the platform's current version, which also
|
|
92
|
+
* writes `personalWorkspaceConnectionsOnly: true` as the designer does on a new
|
|
93
|
+
* trigger. A trigger pinned to 1.0 (`{ version: '1.0' }`, what decompile keeps
|
|
94
|
+
* for an older flow) has no appearance, and compile refuses one there
|
|
95
|
+
* (`CONVERSATION_TRIGGER_APPEARANCE_VERSION`). SDK releases before this one wrote
|
|
96
|
+
* 1.0 for an unpinned `conversationTrigger()`, so a source written against them
|
|
97
|
+
* now compiles to 1.3 with the switch on; pin `{ version: '1.0' }` to keep the
|
|
98
|
+
* old node.
|
|
84
99
|
*
|
|
100
|
+
* @param appearance - How the chat that starts the flow looks. Optional.
|
|
85
101
|
* @returns A trigger spec to pass to `.trigger(...)`.
|
|
86
102
|
*/
|
|
87
|
-
export declare function conversationTrigger(): TriggerSpec;
|
|
103
|
+
export declare function conversationTrigger(appearance?: ConversationAppearance): TriggerSpec;
|
|
88
104
|
/**
|
|
89
105
|
* Start the flow when a phone call comes IN (`core.trigger.voice`).
|
|
90
106
|
*
|
|
@@ -87,16 +87,32 @@ export function formTrigger() {
|
|
|
87
87
|
*
|
|
88
88
|
* The trigger publishes the conversation it started —
|
|
89
89
|
* `out('start', 'conversationId')` — which is what every conversational step
|
|
90
|
-
* is keyed by.
|
|
90
|
+
* is keyed by.
|
|
91
91
|
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
92
|
+
* What the chat looks like before the user types is the trigger's appearance:
|
|
93
|
+
*
|
|
94
|
+
* ```ts
|
|
95
|
+
* .trigger(conversationTrigger({
|
|
96
|
+
* welcomeTitle: 'Library desk',
|
|
97
|
+
* welcomeDescription: 'Ask about loans, renewals and holds.',
|
|
98
|
+
* startingPrompts: ['Renew my loans', { displayPrompt: 'Place a hold', actualPrompt: 'I want to place a hold on a book.' }],
|
|
99
|
+
* }))
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* The trigger is written at 1.3, the platform's current version, which also
|
|
103
|
+
* writes `personalWorkspaceConnectionsOnly: true` as the designer does on a new
|
|
104
|
+
* trigger. A trigger pinned to 1.0 (`{ version: '1.0' }`, what decompile keeps
|
|
105
|
+
* for an older flow) has no appearance, and compile refuses one there
|
|
106
|
+
* (`CONVERSATION_TRIGGER_APPEARANCE_VERSION`). SDK releases before this one wrote
|
|
107
|
+
* 1.0 for an unpinned `conversationTrigger()`, so a source written against them
|
|
108
|
+
* now compiles to 1.3 with the switch on; pin `{ version: '1.0' }` to keep the
|
|
109
|
+
* old node.
|
|
95
110
|
*
|
|
111
|
+
* @param appearance - How the chat that starts the flow looks. Optional.
|
|
96
112
|
* @returns A trigger spec to pass to `.trigger(...)`.
|
|
97
113
|
*/
|
|
98
|
-
export function conversationTrigger() {
|
|
99
|
-
return builtinTriggerSpec({ kind: 'conversation' });
|
|
114
|
+
export function conversationTrigger(appearance) {
|
|
115
|
+
return builtinTriggerSpec(appearance === undefined ? { kind: 'conversation' } : { kind: 'conversation', appearance });
|
|
100
116
|
}
|
|
101
117
|
/**
|
|
102
118
|
* Start the flow when a phone call comes IN (`core.trigger.voice`).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FlowTriggerType } from '../../../flow-node-type.js';
|
|
2
|
-
import { type ScheduledInputs } from './spec.js';
|
|
2
|
+
import { type ConversationAppearance, type ScheduledInputs } from './spec.js';
|
|
3
3
|
export type ManualTriggerSpec = {
|
|
4
4
|
kind: 'manual';
|
|
5
5
|
};
|
|
@@ -12,6 +12,7 @@ export type FormTriggerSpec = {
|
|
|
12
12
|
};
|
|
13
13
|
export type ConversationTriggerSpec = {
|
|
14
14
|
kind: 'conversation';
|
|
15
|
+
appearance?: ConversationAppearance;
|
|
15
16
|
};
|
|
16
17
|
export type VoiceTriggerSpec = {
|
|
17
18
|
kind: 'voice';
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* The five built-in start triggers, one node type each: `manual()`
|
|
3
3
|
* (`core.trigger.manual`, the default), `scheduled()`, `formTrigger()`,
|
|
4
4
|
* `conversationTrigger()` and `voiceTrigger()`. All are bundled.
|
|
5
|
+
* A schedule and a conversation pick their version when the author pinned none.
|
|
5
6
|
*
|
|
6
7
|
* A trigger type owns its node's `inputs` and how it reads back. The pipeline
|
|
7
8
|
* owns the root: the node's id and label, the version it resolves, the edge to
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
* docs/NODE_TYPE_ARCHITECTURE_DESIGN.md.
|
|
16
17
|
*/
|
|
17
18
|
import { CompileRefusal } from '../../../core/compile-refusal.js';
|
|
18
|
-
import { checkSchedule, fitsScheduleV12, isIsoInterval } from './check.js';
|
|
19
|
+
import { checkSchedule, checkStartingPrompts, fitsScheduleV12, isIsoInterval } from './check.js';
|
|
19
20
|
import { SCHEDULE_PRESETS } from './spec.js';
|
|
20
21
|
/** A Quartz cron expression: 6–7 whitespace-separated fields, none of them an ISO `R/` interval. */
|
|
21
22
|
function isQuartz(every) {
|
|
@@ -223,13 +224,102 @@ export const formTriggerType = {
|
|
|
223
224
|
function platformStartedInputs(ctx) {
|
|
224
225
|
return { inputs: { entryPointId: ctx.root.isDefault ? ctx.root.id : ctx.entryPointId() } };
|
|
225
226
|
}
|
|
227
|
+
/** The conversation-trigger version an unpinned `conversationTrigger()` writes: the platform's current one, which has an appearance. */
|
|
228
|
+
const CONVERSATION_DEFAULT_VERSION = '1.3';
|
|
229
|
+
/** The only bundled conversation-trigger version with no `appearance` input. */
|
|
230
|
+
const CONVERSATION_NO_APPEARANCE_VERSION = '1.0';
|
|
231
|
+
/**
|
|
232
|
+
* The prompts as the designer stores them; a string is one whose label and text
|
|
233
|
+
* are the same. A minted id is keyed by the label, so reordering the prompts
|
|
234
|
+
* keeps each one's id; a repeated label is told apart by its occurrence.
|
|
235
|
+
*/
|
|
236
|
+
function startingPrompts(prompts, ctx) {
|
|
237
|
+
const seen = new Map();
|
|
238
|
+
return prompts.map((prompt) => {
|
|
239
|
+
const p = typeof prompt === 'string' ? { displayPrompt: prompt } : prompt;
|
|
240
|
+
const n = seen.get(p.displayPrompt) ?? 0;
|
|
241
|
+
seen.set(p.displayPrompt, n + 1);
|
|
242
|
+
return {
|
|
243
|
+
id: p.id ?? ctx.stableId(`startingPrompt:${JSON.stringify(p.displayPrompt)}:${n}`),
|
|
244
|
+
displayPrompt: p.displayPrompt,
|
|
245
|
+
actualPrompt: p.actualPrompt ?? p.displayPrompt,
|
|
246
|
+
};
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* The `appearance` input, in the definition's field order. The switch is always
|
|
251
|
+
* written: the designer seeds a new 1.3 trigger with its `inputDefaults`
|
|
252
|
+
* (`personalWorkspaceConnectionsOnly: true`).
|
|
253
|
+
*/
|
|
254
|
+
function appearanceInput(a, ctx) {
|
|
255
|
+
return {
|
|
256
|
+
...(a.welcomeTitle !== undefined ? { welcomeTitle: a.welcomeTitle } : {}),
|
|
257
|
+
...(a.welcomeDescription !== undefined ? { welcomeDescription: a.welcomeDescription } : {}),
|
|
258
|
+
...(a.startingPrompts !== undefined ? { startingPrompts: startingPrompts(a.startingPrompts, ctx) } : {}),
|
|
259
|
+
personalWorkspaceConnectionsOnly: a.personalWorkspaceConnectionsOnly ?? true,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* The appearance a node carries, as the spec spells it. A 1.0 node has none. A
|
|
264
|
+
* switch the node does not carry lifts as `false`, and so does a later node
|
|
265
|
+
* with no appearance at all: the designer adds the switch to new triggers only,
|
|
266
|
+
* so an older trigger moved to 1.3 still shows every connection, and leaving
|
|
267
|
+
* the switch out would recompile as `true`.
|
|
268
|
+
*/
|
|
269
|
+
function liftAppearance(node) {
|
|
270
|
+
const n = node;
|
|
271
|
+
const a = n.inputs?.appearance;
|
|
272
|
+
if (a === null || typeof a !== 'object') {
|
|
273
|
+
return n.typeVersion === CONVERSATION_NO_APPEARANCE_VERSION ? undefined : { personalWorkspaceConnectionsOnly: false };
|
|
274
|
+
}
|
|
275
|
+
const { welcomeTitle, welcomeDescription, startingPrompts, personalWorkspaceConnectionsOnly } = a;
|
|
276
|
+
const prompts = Array.isArray(startingPrompts)
|
|
277
|
+
? startingPrompts.filter((p) => p !== null && typeof p === 'object').map((p) => ({
|
|
278
|
+
...(typeof p.id === 'string' ? { id: p.id } : {}),
|
|
279
|
+
displayPrompt: typeof p.displayPrompt === 'string' ? p.displayPrompt : '',
|
|
280
|
+
...(typeof p.actualPrompt === 'string' && p.actualPrompt !== p.displayPrompt ? { actualPrompt: p.actualPrompt } : {}),
|
|
281
|
+
}))
|
|
282
|
+
: undefined;
|
|
283
|
+
return {
|
|
284
|
+
...(typeof welcomeTitle === 'string' ? { welcomeTitle } : {}),
|
|
285
|
+
...(typeof welcomeDescription === 'string' ? { welcomeDescription } : {}),
|
|
286
|
+
...(prompts !== undefined ? { startingPrompts: prompts } : {}),
|
|
287
|
+
personalWorkspaceConnectionsOnly: personalWorkspaceConnectionsOnly === true,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
226
290
|
export const conversationTriggerType = {
|
|
227
291
|
kind: 'conversation', typeName: 'core.trigger.conversation', factory: 'conversationTrigger',
|
|
228
292
|
onePerFlow: 'SINGLE_CONVERSATION_TRIGGER',
|
|
229
|
-
serialize: (
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
293
|
+
serialize: (spec, ctx) => {
|
|
294
|
+
const version = ctx.version ?? CONVERSATION_DEFAULT_VERSION;
|
|
295
|
+
if (version === CONVERSATION_NO_APPEARANCE_VERSION) {
|
|
296
|
+
if (spec.appearance !== undefined) {
|
|
297
|
+
throw new CompileRefusal('CONVERSATION_TRIGGER_APPEARANCE_VERSION', "conversationTrigger(): an appearance needs the trigger's 1.3 definition, but { version: '1.0' } was "
|
|
298
|
+
+ 'requested, and 1.0 has no appearance. Drop the version to write 1.3, or drop the appearance.');
|
|
299
|
+
}
|
|
300
|
+
return { version, ...platformStartedInputs(ctx) };
|
|
301
|
+
}
|
|
302
|
+
const { inputs } = platformStartedInputs(ctx);
|
|
303
|
+
return { version, inputs: { ...inputs, appearance: appearanceInput(spec.appearance ?? {}, ctx) } };
|
|
304
|
+
},
|
|
305
|
+
deserialize: (node) => {
|
|
306
|
+
const appearance = liftAppearance(node);
|
|
307
|
+
return appearance === undefined ? { kind: 'conversation' } : { kind: 'conversation', appearance };
|
|
308
|
+
},
|
|
309
|
+
// The switch's default is left out, so a trigger the designer just made prints as `conversationTrigger()`.
|
|
310
|
+
print: (spec, ctx) => {
|
|
311
|
+
const a = spec.appearance;
|
|
312
|
+
if (a === undefined)
|
|
313
|
+
return { factory: 'conversationTrigger' };
|
|
314
|
+
const options = Object.entries(a)
|
|
315
|
+
.filter(([k, v]) => v !== undefined && !(k === 'personalWorkspaceConnectionsOnly' && v === true))
|
|
316
|
+
.map(([k, v]) => [k, ctx.value(v)]);
|
|
317
|
+
return options.length === 0 ? { factory: 'conversationTrigger' } : { factory: 'conversationTrigger', options };
|
|
318
|
+
},
|
|
319
|
+
check: (spec, ctx) => {
|
|
320
|
+
inputsIgnored('conversation', 'conversationId', ctx);
|
|
321
|
+
checkStartingPrompts(spec.appearance?.startingPrompts, ctx);
|
|
322
|
+
},
|
|
233
323
|
};
|
|
234
324
|
export const voiceTriggerType = {
|
|
235
325
|
kind: 'voice', typeName: 'core.trigger.voice', factory: 'voiceTrigger',
|
|
@@ -40,6 +40,35 @@ export interface ScheduledInputs {
|
|
|
40
40
|
*/
|
|
41
41
|
every: ScheduleEvery;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* One suggestion the chat shows before the user types: a chip labelled
|
|
45
|
+
* `displayPrompt` that sends `actualPrompt` to the agent.
|
|
46
|
+
*/
|
|
47
|
+
export interface StartingPrompt {
|
|
48
|
+
/** The chip's label, what the user sees. Required: the chat drops a prompt without one. */
|
|
49
|
+
displayPrompt: string;
|
|
50
|
+
/** What the agent receives when the chip is clicked. Defaults to `displayPrompt`, as the designer does. */
|
|
51
|
+
actualPrompt?: string;
|
|
52
|
+
/** The prompt's identity in the designer. Minted from the flow and root when omitted; decompile spells it out. */
|
|
53
|
+
id?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* How the chat that starts a conversation-triggered flow looks: the
|
|
57
|
+
* conversation trigger's `appearance` (1.3), the same shape as an agent's.
|
|
58
|
+
*/
|
|
59
|
+
export interface ConversationAppearance {
|
|
60
|
+
/** The heading shown in an empty chat. */
|
|
61
|
+
welcomeTitle?: string;
|
|
62
|
+
/** The text under the heading. */
|
|
63
|
+
welcomeDescription?: string;
|
|
64
|
+
/** Suggestions shown before the user types. A string is a prompt whose label and text are the same. */
|
|
65
|
+
startingPrompts?: Array<string | StartingPrompt>;
|
|
66
|
+
/**
|
|
67
|
+
* Show only personal workspace connections in the chat's connection settings
|
|
68
|
+
* menu. Defaults to `true`, what the designer writes on a new trigger.
|
|
69
|
+
*/
|
|
70
|
+
personalWorkspaceConnectionsOnly?: boolean;
|
|
71
|
+
}
|
|
43
72
|
/**
|
|
44
73
|
* What starts the flow. Three options: the manual trigger (the default — omit
|
|
45
74
|
* `.trigger()`), a schedule, or a CONNECTOR EVENT.
|
|
@@ -56,6 +85,7 @@ export type TriggerSpec = {
|
|
|
56
85
|
kind: 'form';
|
|
57
86
|
} | {
|
|
58
87
|
kind: 'conversation';
|
|
88
|
+
appearance?: ConversationAppearance;
|
|
59
89
|
} | {
|
|
60
90
|
kind: 'voice';
|
|
61
91
|
};
|
package/dist/serialize.js
CHANGED
|
@@ -2608,6 +2608,7 @@ function serializeFlow(built, opts) {
|
|
|
2608
2608
|
root: at,
|
|
2609
2609
|
version: pin,
|
|
2610
2610
|
entryPointId: (seed = at.id) => stableId(`${built.id}:${seed}:entryPoint`),
|
|
2611
|
+
stableId: (key) => stableId(`${built.id}:${at.id}:${key}`),
|
|
2611
2612
|
library: opts.library,
|
|
2612
2613
|
events: eventEnv(opts),
|
|
2613
2614
|
resolveBinding: (name, attribute, where, target) => resolveBinding(opts, name, attribute, where, target),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.88.0",
|
|
4
4
|
"description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://docs.uipath.com/maestro",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"@types/node": "^22.7.0",
|
|
111
111
|
"esbuild": "^0.28.1"
|
|
112
112
|
},
|
|
113
|
-
"gitref": "
|
|
113
|
+
"gitref": "f668e93dcb5e0f72abf84b33f015b014b854bd5d"
|
|
114
114
|
}
|