@xyne/workflow-sdk 3.2.47 → 3.2.48
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/agents/host-agent-step.d.ts +2 -2
- package/dist/connectors/builtin/steps/classifier-agent.step.d.ts +2 -2
- package/dist/connectors/builtin/steps/parallel.step.d.ts +4 -4
- package/dist/connectors/builtin/steps/wait.step.d.ts +28 -0
- package/dist/connectors/builtin/steps/wait.step.d.ts.map +1 -1
- package/dist/connectors/builtin/steps/wait.step.js +26 -1
- package/dist/connectors/builtin/steps/wait.step.js.map +1 -1
- package/dist/conversational-flow/calls.d.ts +20 -0
- package/dist/conversational-flow/calls.d.ts.map +1 -0
- package/dist/conversational-flow/calls.js +59 -0
- package/dist/conversational-flow/calls.js.map +1 -0
- package/dist/conversational-flow/conditions.d.ts +24 -0
- package/dist/conversational-flow/conditions.d.ts.map +1 -0
- package/dist/conversational-flow/conditions.js +69 -0
- package/dist/conversational-flow/conditions.js.map +1 -0
- package/dist/conversational-flow/create.d.ts +23 -18
- package/dist/conversational-flow/create.d.ts.map +1 -1
- package/dist/conversational-flow/create.js +73 -96
- package/dist/conversational-flow/create.js.map +1 -1
- package/dist/conversational-flow/edit/build.d.ts +112 -0
- package/dist/conversational-flow/edit/build.d.ts.map +1 -0
- package/dist/conversational-flow/edit/build.js +249 -0
- package/dist/conversational-flow/edit/build.js.map +1 -0
- package/dist/conversational-flow/edit/calls.d.ts +61 -0
- package/dist/conversational-flow/edit/calls.d.ts.map +1 -0
- package/dist/conversational-flow/edit/calls.js +296 -0
- package/dist/conversational-flow/edit/calls.js.map +1 -0
- package/dist/conversational-flow/edit/cases.d.ts +29 -0
- package/dist/conversational-flow/edit/cases.d.ts.map +1 -0
- package/dist/conversational-flow/edit/cases.js +83 -0
- package/dist/conversational-flow/edit/cases.js.map +1 -0
- package/dist/conversational-flow/edit/endings.d.ts +16 -0
- package/dist/conversational-flow/edit/endings.d.ts.map +1 -0
- package/dist/conversational-flow/edit/endings.js +53 -0
- package/dist/conversational-flow/edit/endings.js.map +1 -0
- package/dist/conversational-flow/edit/followups.d.ts +28 -0
- package/dist/conversational-flow/edit/followups.d.ts.map +1 -0
- package/dist/conversational-flow/edit/followups.js +103 -0
- package/dist/conversational-flow/edit/followups.js.map +1 -0
- package/dist/conversational-flow/edit/inputs.d.ts +24 -0
- package/dist/conversational-flow/edit/inputs.d.ts.map +1 -0
- package/dist/conversational-flow/edit/inputs.js +53 -0
- package/dist/conversational-flow/edit/inputs.js.map +1 -0
- package/dist/conversational-flow/edit/kinds.d.ts +29 -0
- package/dist/conversational-flow/edit/kinds.d.ts.map +1 -0
- package/dist/conversational-flow/edit/kinds.js +142 -0
- package/dist/conversational-flow/edit/kinds.js.map +1 -0
- package/dist/conversational-flow/edit/options.d.ts +68 -0
- package/dist/conversational-flow/edit/options.d.ts.map +1 -0
- package/dist/conversational-flow/edit/options.js +209 -0
- package/dist/conversational-flow/edit/options.js.map +1 -0
- package/dist/conversational-flow/edit/picklist.d.ts +28 -0
- package/dist/conversational-flow/edit/picklist.d.ts.map +1 -0
- package/dist/conversational-flow/edit/picklist.js +58 -0
- package/dist/conversational-flow/edit/picklist.js.map +1 -0
- package/dist/conversational-flow/edit/prompts.d.ts +24 -0
- package/dist/conversational-flow/edit/prompts.d.ts.map +1 -0
- package/dist/conversational-flow/edit/prompts.js +180 -0
- package/dist/conversational-flow/edit/prompts.js.map +1 -0
- package/dist/conversational-flow/edit/routers.d.ts +65 -0
- package/dist/conversational-flow/edit/routers.d.ts.map +1 -0
- package/dist/conversational-flow/edit/routers.js +208 -0
- package/dist/conversational-flow/edit/routers.js.map +1 -0
- package/dist/conversational-flow/edit/screens.d.ts +44 -0
- package/dist/conversational-flow/edit/screens.d.ts.map +1 -0
- package/dist/conversational-flow/edit/screens.js +137 -0
- package/dist/conversational-flow/edit/screens.js.map +1 -0
- package/dist/conversational-flow/edit/versions.d.ts +43 -0
- package/dist/conversational-flow/edit/versions.d.ts.map +1 -0
- package/dist/conversational-flow/edit/versions.js +189 -0
- package/dist/conversational-flow/edit/versions.js.map +1 -0
- package/dist/conversational-flow/index.d.ts +33 -16
- package/dist/conversational-flow/index.d.ts.map +1 -1
- package/dist/conversational-flow/index.js +42 -9
- package/dist/conversational-flow/index.js.map +1 -1
- package/dist/conversational-flow/json.d.ts +15 -0
- package/dist/conversational-flow/json.d.ts.map +1 -0
- package/dist/conversational-flow/json.js +14 -0
- package/dist/conversational-flow/json.js.map +1 -0
- package/dist/conversational-flow/jumps.d.ts +22 -0
- package/dist/conversational-flow/jumps.d.ts.map +1 -0
- package/dist/conversational-flow/jumps.js +160 -0
- package/dist/conversational-flow/jumps.js.map +1 -0
- package/dist/conversational-flow/locate.d.ts +30 -0
- package/dist/conversational-flow/locate.d.ts.map +1 -0
- package/dist/conversational-flow/locate.js +73 -0
- package/dist/conversational-flow/locate.js.map +1 -0
- package/dist/conversational-flow/paths.d.ts +31 -0
- package/dist/conversational-flow/paths.d.ts.map +1 -0
- package/dist/conversational-flow/paths.js +50 -0
- package/dist/conversational-flow/paths.js.map +1 -0
- package/dist/conversational-flow/prompt.d.ts +48 -0
- package/dist/conversational-flow/prompt.d.ts.map +1 -0
- package/dist/conversational-flow/prompt.js +161 -0
- package/dist/conversational-flow/prompt.js.map +1 -0
- package/dist/conversational-flow/read.d.ts +9 -17
- package/dist/conversational-flow/read.d.ts.map +1 -1
- package/dist/conversational-flow/read.js +217 -384
- package/dist/conversational-flow/read.js.map +1 -1
- package/dist/conversational-flow/rounds.d.ts +29 -0
- package/dist/conversational-flow/rounds.d.ts.map +1 -0
- package/dist/conversational-flow/rounds.js +41 -0
- package/dist/conversational-flow/rounds.js.map +1 -0
- package/dist/conversational-flow/routers.d.ts +24 -80
- package/dist/conversational-flow/routers.d.ts.map +1 -1
- package/dist/conversational-flow/routers.js +76 -262
- package/dist/conversational-flow/routers.js.map +1 -1
- package/dist/conversational-flow/settle.d.ts +21 -15
- package/dist/conversational-flow/settle.d.ts.map +1 -1
- package/dist/conversational-flow/settle.js +240 -38
- package/dist/conversational-flow/settle.js.map +1 -1
- package/dist/conversational-flow/shape.d.ts +114 -0
- package/dist/conversational-flow/shape.d.ts.map +1 -0
- package/dist/conversational-flow/shape.js +209 -0
- package/dist/conversational-flow/shape.js.map +1 -0
- package/dist/conversational-flow/testing.d.ts +54 -0
- package/dist/conversational-flow/testing.d.ts.map +1 -0
- package/dist/conversational-flow/testing.js +119 -0
- package/dist/conversational-flow/testing.js.map +1 -0
- package/dist/conversational-flow/tree.d.ts +28 -17
- package/dist/conversational-flow/tree.d.ts.map +1 -1
- package/dist/conversational-flow/tree.js +60 -47
- package/dist/conversational-flow/tree.js.map +1 -1
- package/dist/conversational-flow/turn.d.ts +20 -22
- package/dist/conversational-flow/turn.d.ts.map +1 -1
- package/dist/conversational-flow/turn.js +69 -48
- package/dist/conversational-flow/turn.js.map +1 -1
- package/dist/conversational-flow/types.d.ts +154 -118
- package/dist/conversational-flow/types.d.ts.map +1 -1
- package/dist/conversational-flow/types.js +27 -51
- package/dist/conversational-flow/types.js.map +1 -1
- package/dist/conversational-flow/typing.d.ts +31 -0
- package/dist/conversational-flow/typing.d.ts.map +1 -0
- package/dist/conversational-flow/typing.js +53 -0
- package/dist/conversational-flow/typing.js.map +1 -0
- package/dist/engine/variable-resolver.d.ts +16 -0
- package/dist/engine/variable-resolver.d.ts.map +1 -1
- package/dist/engine/variable-resolver.js +45 -1
- package/dist/engine/variable-resolver.js.map +1 -1
- package/dist/types/pause-state.d.ts +9 -0
- package/dist/types/pause-state.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/conversational-flow/edit.d.ts +0 -101
- package/dist/conversational-flow/edit.d.ts.map +0 -1
- package/dist/conversational-flow/edit.js +0 -785
- package/dist/conversational-flow/edit.js.map +0 -1
- package/dist/conversational-flow/internals.d.ts +0 -51
- package/dist/conversational-flow/internals.d.ts.map +0 -1
- package/dist/conversational-flow/internals.js +0 -163
- package/dist/conversational-flow/internals.js.map +0 -1
- package/dist/conversational-flow/lookup-edit.d.ts +0 -96
- package/dist/conversational-flow/lookup-edit.d.ts.map +0 -1
- package/dist/conversational-flow/lookup-edit.js +0 -266
- package/dist/conversational-flow/lookup-edit.js.map +0 -1
- package/dist/conversational-flow/lookups.d.ts +0 -46
- package/dist/conversational-flow/lookups.d.ts.map +0 -1
- package/dist/conversational-flow/lookups.js +0 -145
- package/dist/conversational-flow/lookups.js.map +0 -1
- package/dist/conversational-flow/router-edit.d.ts +0 -53
- package/dist/conversational-flow/router-edit.d.ts.map +0 -1
- package/dist/conversational-flow/router-edit.js +0 -191
- package/dist/conversational-flow/router-edit.js.map +0 -1
|
@@ -65,8 +65,8 @@ declare const HostAgentBaseSchema: z.ZodObject<{
|
|
|
65
65
|
mode: z.ZodDefault<z.ZodEnum<["sync", "async"]>>;
|
|
66
66
|
waitForReply: z.ZodDefault<z.ZodBoolean>;
|
|
67
67
|
}, "strip", z.ZodTypeAny, {
|
|
68
|
-
mode: "sync" | "async";
|
|
69
68
|
timeoutMs: number;
|
|
69
|
+
mode: "sync" | "async";
|
|
70
70
|
task: string;
|
|
71
71
|
waitForReply: boolean;
|
|
72
72
|
outputType: "string" | "json";
|
|
@@ -82,8 +82,8 @@ declare const HostAgentBaseSchema: z.ZodObject<{
|
|
|
82
82
|
}, {
|
|
83
83
|
task: string;
|
|
84
84
|
outputSchema?: string | Record<string, unknown> | undefined;
|
|
85
|
-
mode?: "sync" | "async" | undefined;
|
|
86
85
|
timeoutMs?: number | undefined;
|
|
86
|
+
mode?: "sync" | "async" | undefined;
|
|
87
87
|
attachments?: string | {
|
|
88
88
|
name: string;
|
|
89
89
|
mimeType: string;
|
|
@@ -65,8 +65,8 @@ export declare const ClassifierAgentStepConfigSchema: z.ZodObject<{
|
|
|
65
65
|
instructions: string;
|
|
66
66
|
classes: Record<string, string>;
|
|
67
67
|
maxAttempts?: number | undefined;
|
|
68
|
-
credentialName?: string | undefined;
|
|
69
68
|
model?: string | undefined;
|
|
69
|
+
credentialName?: string | undefined;
|
|
70
70
|
minConfidence?: number | undefined;
|
|
71
71
|
fallbackClass?: string | undefined;
|
|
72
72
|
timeoutMs?: number | undefined;
|
|
@@ -115,8 +115,8 @@ export declare class ClassifierAgentStep extends BaseActionStep<typeof Classifie
|
|
|
115
115
|
instructions: string;
|
|
116
116
|
classes: Record<string, string>;
|
|
117
117
|
maxAttempts?: number | undefined;
|
|
118
|
-
credentialName?: string | undefined;
|
|
119
118
|
model?: string | undefined;
|
|
119
|
+
credentialName?: string | undefined;
|
|
120
120
|
minConfidence?: number | undefined;
|
|
121
121
|
fallbackClass?: string | undefined;
|
|
122
122
|
timeoutMs?: number | undefined;
|
|
@@ -151,7 +151,6 @@ export declare class ParallelStep extends BaseControlFlowStep<typeof ParallelSte
|
|
|
151
151
|
reason: string;
|
|
152
152
|
}>]>>;
|
|
153
153
|
}, "strip", z.ZodTypeAny, {
|
|
154
|
-
mode: "allSettled";
|
|
155
154
|
branches: Record<string, {
|
|
156
155
|
status: "fulfilled";
|
|
157
156
|
steps: Record<string, {
|
|
@@ -161,8 +160,8 @@ export declare class ParallelStep extends BaseControlFlowStep<typeof ParallelSte
|
|
|
161
160
|
status: "rejected";
|
|
162
161
|
reason: string;
|
|
163
162
|
}>;
|
|
164
|
-
}, {
|
|
165
163
|
mode: "allSettled";
|
|
164
|
+
}, {
|
|
166
165
|
branches: Record<string, {
|
|
167
166
|
status: "fulfilled";
|
|
168
167
|
steps: Record<string, {
|
|
@@ -172,6 +171,7 @@ export declare class ParallelStep extends BaseControlFlowStep<typeof ParallelSte
|
|
|
172
171
|
status: "rejected";
|
|
173
172
|
reason: string;
|
|
174
173
|
}>;
|
|
174
|
+
mode: "allSettled";
|
|
175
175
|
}>, z.ZodObject<{
|
|
176
176
|
mode: z.ZodLiteral<"race">;
|
|
177
177
|
branch: z.ZodString;
|
|
@@ -205,7 +205,6 @@ export declare class ParallelStep extends BaseControlFlowStep<typeof ParallelSte
|
|
|
205
205
|
reason: string;
|
|
206
206
|
}>]>>;
|
|
207
207
|
}, "strip", z.ZodTypeAny, {
|
|
208
|
-
mode: "race";
|
|
209
208
|
branch: string;
|
|
210
209
|
branches: Record<string, {
|
|
211
210
|
status: "fulfilled";
|
|
@@ -216,8 +215,8 @@ export declare class ParallelStep extends BaseControlFlowStep<typeof ParallelSte
|
|
|
216
215
|
status: "rejected";
|
|
217
216
|
reason: string;
|
|
218
217
|
}>;
|
|
219
|
-
}, {
|
|
220
218
|
mode: "race";
|
|
219
|
+
}, {
|
|
221
220
|
branch: string;
|
|
222
221
|
branches: Record<string, {
|
|
223
222
|
status: "fulfilled";
|
|
@@ -228,6 +227,7 @@ export declare class ParallelStep extends BaseControlFlowStep<typeof ParallelSte
|
|
|
228
227
|
status: "rejected";
|
|
229
228
|
reason: string;
|
|
230
229
|
}>;
|
|
230
|
+
mode: "race";
|
|
231
231
|
}>]>;
|
|
232
232
|
readonly category: "control";
|
|
233
233
|
readonly icon = "columns";
|
|
@@ -150,18 +150,22 @@ export declare const WaitStepConfigSchema: z.ZodDiscriminatedUnion<"mode", [z.Zo
|
|
|
150
150
|
options: z.ZodUnion<[z.ZodArray<z.ZodObject<{
|
|
151
151
|
label: z.ZodString;
|
|
152
152
|
value: z.ZodString;
|
|
153
|
+
when: z.ZodOptional<z.ZodType<import("../../../types/workflow-config.js").Condition, z.ZodTypeDef, import("../../../types/workflow-config.js").Condition>>;
|
|
153
154
|
}, "strip", z.ZodTypeAny, {
|
|
154
155
|
value: string;
|
|
155
156
|
label: string;
|
|
157
|
+
when?: import("../../../types/workflow-config.js").Condition | undefined;
|
|
156
158
|
}, {
|
|
157
159
|
value: string;
|
|
158
160
|
label: string;
|
|
161
|
+
when?: import("../../../types/workflow-config.js").Condition | undefined;
|
|
159
162
|
}>, "many">, z.ZodString]>;
|
|
160
163
|
allowCustomValue: z.ZodOptional<z.ZodBoolean>;
|
|
161
164
|
}, "strip", z.ZodTypeAny, {
|
|
162
165
|
options: string | {
|
|
163
166
|
value: string;
|
|
164
167
|
label: string;
|
|
168
|
+
when?: import("../../../types/workflow-config.js").Condition | undefined;
|
|
165
169
|
}[];
|
|
166
170
|
type: "select";
|
|
167
171
|
name: string;
|
|
@@ -175,6 +179,7 @@ export declare const WaitStepConfigSchema: z.ZodDiscriminatedUnion<"mode", [z.Zo
|
|
|
175
179
|
options: string | {
|
|
176
180
|
value: string;
|
|
177
181
|
label: string;
|
|
182
|
+
when?: import("../../../types/workflow-config.js").Condition | undefined;
|
|
178
183
|
}[];
|
|
179
184
|
type: "select";
|
|
180
185
|
name: string;
|
|
@@ -269,6 +274,7 @@ export declare const WaitStepConfigSchema: z.ZodDiscriminatedUnion<"mode", [z.Zo
|
|
|
269
274
|
options: string | {
|
|
270
275
|
value: string;
|
|
271
276
|
label: string;
|
|
277
|
+
when?: import("../../../types/workflow-config.js").Condition | undefined;
|
|
272
278
|
}[];
|
|
273
279
|
type: "select";
|
|
274
280
|
name: string;
|
|
@@ -329,6 +335,7 @@ export declare const WaitStepConfigSchema: z.ZodDiscriminatedUnion<"mode", [z.Zo
|
|
|
329
335
|
options: string | {
|
|
330
336
|
value: string;
|
|
331
337
|
label: string;
|
|
338
|
+
when?: import("../../../types/workflow-config.js").Condition | undefined;
|
|
332
339
|
}[];
|
|
333
340
|
type: "select";
|
|
334
341
|
name: string;
|
|
@@ -418,6 +425,7 @@ export declare const WaitStepConfigSchema: z.ZodDiscriminatedUnion<"mode", [z.Zo
|
|
|
418
425
|
options: string | {
|
|
419
426
|
value: string;
|
|
420
427
|
label: string;
|
|
428
|
+
when?: import("../../../types/workflow-config.js").Condition | undefined;
|
|
421
429
|
}[];
|
|
422
430
|
type: "select";
|
|
423
431
|
name: string;
|
|
@@ -495,6 +503,7 @@ export declare const WaitStepConfigSchema: z.ZodDiscriminatedUnion<"mode", [z.Zo
|
|
|
495
503
|
options: string | {
|
|
496
504
|
value: string;
|
|
497
505
|
label: string;
|
|
506
|
+
when?: import("../../../types/workflow-config.js").Condition | undefined;
|
|
498
507
|
}[];
|
|
499
508
|
type: "select";
|
|
500
509
|
name: string;
|
|
@@ -668,18 +677,22 @@ export declare class WaitStep extends BaseActionStep<typeof WaitStepConfigSchema
|
|
|
668
677
|
options: z.ZodUnion<[z.ZodArray<z.ZodObject<{
|
|
669
678
|
label: z.ZodString;
|
|
670
679
|
value: z.ZodString;
|
|
680
|
+
when: z.ZodOptional<z.ZodType<import("../../../types/workflow-config.js").Condition, z.ZodTypeDef, import("../../../types/workflow-config.js").Condition>>;
|
|
671
681
|
}, "strip", z.ZodTypeAny, {
|
|
672
682
|
value: string;
|
|
673
683
|
label: string;
|
|
684
|
+
when?: import("../../../types/workflow-config.js").Condition | undefined;
|
|
674
685
|
}, {
|
|
675
686
|
value: string;
|
|
676
687
|
label: string;
|
|
688
|
+
when?: import("../../../types/workflow-config.js").Condition | undefined;
|
|
677
689
|
}>, "many">, z.ZodString]>;
|
|
678
690
|
allowCustomValue: z.ZodOptional<z.ZodBoolean>;
|
|
679
691
|
}, "strip", z.ZodTypeAny, {
|
|
680
692
|
options: string | {
|
|
681
693
|
value: string;
|
|
682
694
|
label: string;
|
|
695
|
+
when?: import("../../../types/workflow-config.js").Condition | undefined;
|
|
683
696
|
}[];
|
|
684
697
|
type: "select";
|
|
685
698
|
name: string;
|
|
@@ -693,6 +706,7 @@ export declare class WaitStep extends BaseActionStep<typeof WaitStepConfigSchema
|
|
|
693
706
|
options: string | {
|
|
694
707
|
value: string;
|
|
695
708
|
label: string;
|
|
709
|
+
when?: import("../../../types/workflow-config.js").Condition | undefined;
|
|
696
710
|
}[];
|
|
697
711
|
type: "select";
|
|
698
712
|
name: string;
|
|
@@ -787,6 +801,7 @@ export declare class WaitStep extends BaseActionStep<typeof WaitStepConfigSchema
|
|
|
787
801
|
options: string | {
|
|
788
802
|
value: string;
|
|
789
803
|
label: string;
|
|
804
|
+
when?: import("../../../types/workflow-config.js").Condition | undefined;
|
|
790
805
|
}[];
|
|
791
806
|
type: "select";
|
|
792
807
|
name: string;
|
|
@@ -847,6 +862,7 @@ export declare class WaitStep extends BaseActionStep<typeof WaitStepConfigSchema
|
|
|
847
862
|
options: string | {
|
|
848
863
|
value: string;
|
|
849
864
|
label: string;
|
|
865
|
+
when?: import("../../../types/workflow-config.js").Condition | undefined;
|
|
850
866
|
}[];
|
|
851
867
|
type: "select";
|
|
852
868
|
name: string;
|
|
@@ -936,6 +952,7 @@ export declare class WaitStep extends BaseActionStep<typeof WaitStepConfigSchema
|
|
|
936
952
|
options: string | {
|
|
937
953
|
value: string;
|
|
938
954
|
label: string;
|
|
955
|
+
when?: import("../../../types/workflow-config.js").Condition | undefined;
|
|
939
956
|
}[];
|
|
940
957
|
type: "select";
|
|
941
958
|
name: string;
|
|
@@ -1013,6 +1030,7 @@ export declare class WaitStep extends BaseActionStep<typeof WaitStepConfigSchema
|
|
|
1013
1030
|
options: string | {
|
|
1014
1031
|
value: string;
|
|
1015
1032
|
label: string;
|
|
1033
|
+
when?: import("../../../types/workflow-config.js").Condition | undefined;
|
|
1016
1034
|
}[];
|
|
1017
1035
|
type: "select";
|
|
1018
1036
|
name: string;
|
|
@@ -1068,5 +1086,15 @@ export declare class WaitStep extends BaseActionStep<typeof WaitStepConfigSchema
|
|
|
1068
1086
|
private executeDelay;
|
|
1069
1087
|
private executeWebhook;
|
|
1070
1088
|
private executeApproval;
|
|
1089
|
+
/**
|
|
1090
|
+
* The form as this person sees it: a choice carrying a `when` is kept only
|
|
1091
|
+
* when the condition holds against the run so far.
|
|
1092
|
+
*
|
|
1093
|
+
* What is filtered is the *offer*, not the answer — so nothing downstream has
|
|
1094
|
+
* to know a choice existed. A field left with no choices still renders; that
|
|
1095
|
+
* is the author's flow saying "under this data, there is nothing to pick here",
|
|
1096
|
+
* and hiding the question instead would be this step inventing a rule.
|
|
1097
|
+
*/
|
|
1098
|
+
private offered;
|
|
1071
1099
|
}
|
|
1072
1100
|
//# sourceMappingURL=wait.step.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wait.step.d.ts","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/wait.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"wait.step.d.ts","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/wait.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AA8HjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAAwB;IACtD,SAAkB,YAAY;;;;;;;;;OAAwB;IACtD,SAAkB,QAAQ,EAAE,YAAY,CAAU;IAClD,SAAkB,IAAI,WAAW;IAExB,uBAAuB,CAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IA6BX,OAAO,CACpB,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,oBAAoB,GACxB,OAAO,CAAC,cAAc,CAAC;IAWX,QAAQ,CACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,oBAAoB,GACzB,OAAO,CAAC,cAAc,CAAC;IAU1B,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,cAAc;IAgCtB,OAAO,CAAC,eAAe;IAsBvB;;;;;;;;OAQG;IACH,OAAO,CAAC,OAAO;CAchB"}
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
import { z } from 'zod';
|
|
24
24
|
import { BaseActionStep } from '../../../steps/base-step.js';
|
|
25
25
|
import { BuiltinStepType } from '../../../types/known-types.js';
|
|
26
|
+
import { ConditionSchema } from '../../../types/workflow-config.js';
|
|
27
|
+
import { ConditionEvaluator } from '../../../engine/condition-evaluator.js';
|
|
26
28
|
import { ATTACHMENT_ARRAY_JSON_SCHEMA } from '../../../common/attachment.js';
|
|
27
29
|
import { pauseFormToJsonSchema } from '../../../util/pause-form-schema.js';
|
|
28
30
|
// ─── Pause UI Schemas (shared with PauseState types) ───
|
|
@@ -37,6 +39,7 @@ const PauseDisplaySectionSchema = z.object({
|
|
|
37
39
|
const PauseFormFieldOptionSchema = z.object({
|
|
38
40
|
label: z.string(),
|
|
39
41
|
value: z.string(),
|
|
42
|
+
when: ConditionSchema.optional().describe('Offer this choice only when the condition holds. Omit to always offer it.'),
|
|
40
43
|
});
|
|
41
44
|
const PauseFormFieldSchema = z.discriminatedUnion('type', [
|
|
42
45
|
z.object({
|
|
@@ -239,7 +242,7 @@ export class WaitStep extends BaseActionStep {
|
|
|
239
242
|
if (config.display)
|
|
240
243
|
pauseState.display = config.display;
|
|
241
244
|
if (config.form)
|
|
242
|
-
pauseState.form = config.form;
|
|
245
|
+
pauseState.form = this.offered(config.form, ctx);
|
|
243
246
|
if (config.actions)
|
|
244
247
|
pauseState.actions = config.actions;
|
|
245
248
|
ctx.pause(config.reason, {
|
|
@@ -250,5 +253,27 @@ export class WaitStep extends BaseActionStep {
|
|
|
250
253
|
},
|
|
251
254
|
});
|
|
252
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* The form as this person sees it: a choice carrying a `when` is kept only
|
|
258
|
+
* when the condition holds against the run so far.
|
|
259
|
+
*
|
|
260
|
+
* What is filtered is the *offer*, not the answer — so nothing downstream has
|
|
261
|
+
* to know a choice existed. A field left with no choices still renders; that
|
|
262
|
+
* is the author's flow saying "under this data, there is nothing to pick here",
|
|
263
|
+
* and hiding the question instead would be this step inventing a rule.
|
|
264
|
+
*/
|
|
265
|
+
offered(form, ctx) {
|
|
266
|
+
const anyConditioned = form.fields.some((field) => field.type === 'select' && Array.isArray(field.options) && field.options.some((o) => o.when !== undefined));
|
|
267
|
+
if (!anyConditioned)
|
|
268
|
+
return form;
|
|
269
|
+
const evaluator = new ConditionEvaluator();
|
|
270
|
+
const fields = form.fields.map((field) => {
|
|
271
|
+
if (field.type !== 'select' || !Array.isArray(field.options))
|
|
272
|
+
return field;
|
|
273
|
+
const options = field.options.filter((option) => option.when === undefined || evaluator.evaluate(option.when, ctx.workflow));
|
|
274
|
+
return options.length === field.options.length ? field : { ...field, options };
|
|
275
|
+
});
|
|
276
|
+
return { ...form, fields };
|
|
277
|
+
}
|
|
253
278
|
}
|
|
254
279
|
//# sourceMappingURL=wait.step.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wait.step.js","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/wait.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,0DAA0D;AAE1D,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,8EAA8E;IAC9E,8EAA8E;IAC9E,gFAAgF;IAChF,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE;CACnB,CAAC,CAAC;AAEH,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"wait.step.js","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/wait.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAA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MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAkB,EAAE;YACvD,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;gBAAE,OAAO,KAAK,CAAC;YAC3E,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC7H,OAAO,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,CAAC;QACjF,CAAC,CAAC,CAAC;QACH,OAAO,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading a call — the step a frame makes on the way in, whose answer everything
|
|
3
|
+
* inside that frame can quote.
|
|
4
|
+
*/
|
|
5
|
+
import { type Step } from './json.js';
|
|
6
|
+
import type { Call, CallScope } from './types.js';
|
|
7
|
+
export declare function readCall(step: Step, scope: CallScope, onFail: string | undefined): Call;
|
|
8
|
+
/**
|
|
9
|
+
* The answer's fields, from the JSON Schema its author declared — written the
|
|
10
|
+
* way they are quoted, relative to the body.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The leaves of a declared shape, as dotted paths — what a JSON Schema says you
|
|
14
|
+
* can quote. The same walk serves a lookup's answer and what the conversation is
|
|
15
|
+
* started with, because they are the same promise: these names will be there.
|
|
16
|
+
*/
|
|
17
|
+
export declare function declaredFields(schema: unknown): Call['fields'];
|
|
18
|
+
/** Whatever `steps` quote of a call's answer, so nothing is removed silently. */
|
|
19
|
+
export declare function quotedBy(steps: unknown, callId: string): boolean;
|
|
20
|
+
//# sourceMappingURL=calls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calls.d.ts","sourceRoot":"","sources":["../../src/conversational-flow/calls.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAuB,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAMlD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAavF;AAED;;;GAGG;AACH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,CAc9D;AAQD,iFAAiF;AACjF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhE"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading a call — the step a frame makes on the way in, whose answer everything
|
|
3
|
+
* inside that frame can quote.
|
|
4
|
+
*/
|
|
5
|
+
import { asArray, asRec, str } from './json.js';
|
|
6
|
+
/** How deep and how wide a declared answer is described. */
|
|
7
|
+
const MAX_DEPTH = 3;
|
|
8
|
+
const MAX_FIELDS = 60;
|
|
9
|
+
export function readCall(step, scope, onFail) {
|
|
10
|
+
const config = asRec(step.config);
|
|
11
|
+
return {
|
|
12
|
+
id: step.id,
|
|
13
|
+
scope,
|
|
14
|
+
title: str(step.title) ?? humanise(step.id),
|
|
15
|
+
method: str(config['method']) ?? 'GET',
|
|
16
|
+
url: str(config['url']) ?? '',
|
|
17
|
+
request: config,
|
|
18
|
+
credentialName: str(config['credentialName']),
|
|
19
|
+
fields: declaredFields(asRec(config['response'])['bodySchema']),
|
|
20
|
+
onFail,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The answer's fields, from the JSON Schema its author declared — written the
|
|
25
|
+
* way they are quoted, relative to the body.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* The leaves of a declared shape, as dotted paths — what a JSON Schema says you
|
|
29
|
+
* can quote. The same walk serves a lookup's answer and what the conversation is
|
|
30
|
+
* started with, because they are the same promise: these names will be there.
|
|
31
|
+
*/
|
|
32
|
+
export function declaredFields(schema) {
|
|
33
|
+
const out = [];
|
|
34
|
+
const descend = (node, path, depth) => {
|
|
35
|
+
if (out.length >= MAX_FIELDS)
|
|
36
|
+
return;
|
|
37
|
+
const properties = asRec(asRec(node)['properties']);
|
|
38
|
+
const keys = Object.keys(properties);
|
|
39
|
+
if (keys.length === 0 || depth >= MAX_DEPTH) {
|
|
40
|
+
if (path)
|
|
41
|
+
out.push({ path, type: str(asRec(node)['type']) });
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
for (const key of keys)
|
|
45
|
+
descend(properties[key], path ? `${path}.${key}` : key, depth + 1);
|
|
46
|
+
};
|
|
47
|
+
descend(schema, '', 0);
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
/** `fetch_refund` → `Fetch refund`, for a call whose author never named it. */
|
|
51
|
+
function humanise(id) {
|
|
52
|
+
const words = id.replace(/[_-]+/g, ' ').trim();
|
|
53
|
+
return words ? words.charAt(0).toUpperCase() + words.slice(1) : id;
|
|
54
|
+
}
|
|
55
|
+
/** Whatever `steps` quote of a call's answer, so nothing is removed silently. */
|
|
56
|
+
export function quotedBy(steps, callId) {
|
|
57
|
+
return JSON.stringify(asArray(steps)).includes(`steps.${callId}.`);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=calls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calls.js","sourceRoot":"","sources":["../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AU,CAAC,CAAC;QACrC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC;YAC5C,IAAI,IAAI;gBAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;YAC7D,OAAO;QACT,CAAC;QACD,KAAK,MAAM,GAAG,IAAI,IAAI;YAAE,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IAC7F,CAAC,CAAC;IACF,OAAO,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACvB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,+EAA+E;AAC/E,SAAS,QAAQ,CAAC,EAAU;IAC1B,MAAM,KAAK,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/C,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrE,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,QAAQ,CAAC,KAAc,EAAE,MAAc;IACrD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,MAAM,GAAG,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Condition, LeafCondition } from '../types/workflow-config.js';
|
|
2
|
+
/** A group's join, or `undefined` when it is a single test. */
|
|
3
|
+
export declare function joinOf(condition: Condition): 'all' | 'any' | undefined;
|
|
4
|
+
/** The conditions directly inside a group; a leaf is its own only part. */
|
|
5
|
+
export declare function partsIn(condition: Condition): Condition[];
|
|
6
|
+
/** Every test a condition makes, however it is grouped. */
|
|
7
|
+
export declare function leavesOf(condition: Condition): LeafCondition[];
|
|
8
|
+
/** Whether every part is a test — what the editor can lay out as rows. */
|
|
9
|
+
export declare function isFlat(condition: Condition): boolean;
|
|
10
|
+
/** A group of tests, or the test itself when there is one. */
|
|
11
|
+
export declare function group(join: 'all' | 'any', parts: readonly Condition[]): Condition;
|
|
12
|
+
/** Whether this operator reads a value at all — `is there` compares with nothing. */
|
|
13
|
+
export declare function takesValue(operator: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* A short name for a condition, for a place that needs one word about it — a
|
|
16
|
+
* switch case's label in the config, a chip in a list.
|
|
17
|
+
*
|
|
18
|
+
* The field name, not the whole reference: `{{steps.account.output.body.plan}}`
|
|
19
|
+
* is `plan`, which is what the author called it and what they will recognise.
|
|
20
|
+
*/
|
|
21
|
+
export declare function labelFor(condition: Condition): string;
|
|
22
|
+
/** The last segment of a reference — what the author named the field. */
|
|
23
|
+
export declare function fieldName(variable: string): string;
|
|
24
|
+
//# sourceMappingURL=conditions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["../../src/conversational-flow/conditions.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5E,+DAA+D;AAC/D,wBAAgB,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,CAItE;AAED,2EAA2E;AAC3E,wBAAgB,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,EAAE,CAGzD;AAED,2DAA2D;AAC3D,wBAAgB,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,aAAa,EAAE,CAI9D;AAED,0EAA0E;AAC1E,wBAAgB,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAEpD;AAMD,8DAA8D;AAC9D,wBAAgB,KAAK,CAAC,IAAI,EAAE,KAAK,GAAG,KAAK,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,CAEjF;AAED,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAOrD;AAED,yEAAyE;AACzE,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading a condition — the same shape wherever one appears.
|
|
3
|
+
*
|
|
4
|
+
* A condition is a leaf (`read this, compare it that way, against that`) or a
|
|
5
|
+
* group of conditions joined by `all` or `any`. Two places in a conversation
|
|
6
|
+
* carry one: a screen asked differently depending on the data, and an option
|
|
7
|
+
* offered only under it. Both mean the same thing and are edited by the same
|
|
8
|
+
* editor, so what a condition *is* is answered once, here.
|
|
9
|
+
*
|
|
10
|
+
* Nesting deeper than one group is legal in the engine and read faithfully by
|
|
11
|
+
* everything below — it just isn't something this layer writes.
|
|
12
|
+
*/
|
|
13
|
+
import { VALUE_LESS_OPERATORS } from '../types/operators.js';
|
|
14
|
+
/** A group's join, or `undefined` when it is a single test. */
|
|
15
|
+
export function joinOf(condition) {
|
|
16
|
+
if ('all' in condition)
|
|
17
|
+
return 'all';
|
|
18
|
+
if ('any' in condition)
|
|
19
|
+
return 'any';
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
/** The conditions directly inside a group; a leaf is its own only part. */
|
|
23
|
+
export function partsIn(condition) {
|
|
24
|
+
const join = joinOf(condition);
|
|
25
|
+
return join ? condition[join] : [condition];
|
|
26
|
+
}
|
|
27
|
+
/** Every test a condition makes, however it is grouped. */
|
|
28
|
+
export function leavesOf(condition) {
|
|
29
|
+
const join = joinOf(condition);
|
|
30
|
+
if (!join)
|
|
31
|
+
return isLeaf(condition) ? [condition] : [];
|
|
32
|
+
return condition[join].flatMap(leavesOf);
|
|
33
|
+
}
|
|
34
|
+
/** Whether every part is a test — what the editor can lay out as rows. */
|
|
35
|
+
export function isFlat(condition) {
|
|
36
|
+
return partsIn(condition).every(isLeaf);
|
|
37
|
+
}
|
|
38
|
+
function isLeaf(condition) {
|
|
39
|
+
return 'variable' in condition && 'operator' in condition;
|
|
40
|
+
}
|
|
41
|
+
/** A group of tests, or the test itself when there is one. */
|
|
42
|
+
export function group(join, parts) {
|
|
43
|
+
return parts.length === 1 ? parts[0] : { [join]: [...parts] };
|
|
44
|
+
}
|
|
45
|
+
/** Whether this operator reads a value at all — `is there` compares with nothing. */
|
|
46
|
+
export function takesValue(operator) {
|
|
47
|
+
return !VALUE_LESS_OPERATORS.has(operator);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A short name for a condition, for a place that needs one word about it — a
|
|
51
|
+
* switch case's label in the config, a chip in a list.
|
|
52
|
+
*
|
|
53
|
+
* The field name, not the whole reference: `{{steps.account.output.body.plan}}`
|
|
54
|
+
* is `plan`, which is what the author called it and what they will recognise.
|
|
55
|
+
*/
|
|
56
|
+
export function labelFor(condition) {
|
|
57
|
+
const leaves = leavesOf(condition);
|
|
58
|
+
const first = leaves[0];
|
|
59
|
+
if (!first)
|
|
60
|
+
return 'when';
|
|
61
|
+
const name = fieldName(first.variable);
|
|
62
|
+
const said = first.value === undefined ? `${name} ${first.operator}` : `${name} ${first.operator} ${String(first.value)}`;
|
|
63
|
+
return leaves.length === 1 ? said : `${said} +${String(leaves.length - 1)}`;
|
|
64
|
+
}
|
|
65
|
+
/** The last segment of a reference — what the author named the field. */
|
|
66
|
+
export function fieldName(variable) {
|
|
67
|
+
return /\.([^.\s}]+)\s*\}\}$/.exec(variable)?.[1] ?? /\{\{\s*([^.}\s]+)\s*\}\}/.exec(variable)?.[1] ?? 'data';
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=conditions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditions.js","sourceRoot":"","sources":["../../src/conversational-flow/conditions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,oBAAoB,EAA0B,MAAM,uBAAuB,CAAC;AAGrF,+DAA+D;AAC/D,MAAM,UAAU,MAAM,CAAC,SAAoB;IACzC,IAAI,KAAK,IAAI,SAAS;QAAE,OAAO,KAAK,CAAC;IACrC,IAAI,KAAK,IAAI,SAAS;QAAE,OAAO,KAAK,CAAC;IACrC,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,OAAO,CAAC,SAAoB;IAC1C,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAC/B,OAAO,IAAI,CAAC,CAAC,CAAE,SAAgD,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AACtF,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,QAAQ,CAAC,SAAoB;IAC3C,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAC/B,IAAI,CAAC,IAAI;QAAE,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACvD,OAAQ,SAAgD,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AACnF,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,MAAM,CAAC,SAAoB;IACzC,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,MAAM,CAAC,SAAoB;IAClC,OAAO,UAAU,IAAI,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IAAI,0BAA0B,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC;AAChH,CAAC"}
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A new
|
|
2
|
+
* A new conversation: the smallest one that runs, and grows.
|
|
3
3
|
*
|
|
4
|
-
* CYCLE
|
|
5
|
-
* └ SWITCH
|
|
4
|
+
* CYCLE start input { screen: 'start', text: '' }
|
|
5
|
+
* └ SWITCH start_route
|
|
6
6
|
* ├ start — the first screen: a greeting, no options yet
|
|
7
|
-
* ├ ai_router — typed text → a classifier (or an agent)
|
|
7
|
+
* ├ ai_router — typed text → a classifier (or an agent) names the screen
|
|
8
8
|
* ├ done — Finish
|
|
9
9
|
* └ default → start
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* The conversation's own cycle is named after its first screen, because a
|
|
12
|
+
* section and its screen are one thing; every section added later is a cycle
|
|
13
|
+
* inside this one. This is the one place that names the round's keys (`screen`,
|
|
14
|
+
* `text`) and the fields (`choice`, `message`) — every later edit copies
|
|
15
|
+
* whatever shape the flow already has.
|
|
16
|
+
*
|
|
17
|
+
* Everything derived — what the router may open and how it is asked, the
|
|
18
|
+
* headings, where each jump is aimed — is left to `settle`.
|
|
14
19
|
*/
|
|
15
20
|
import type { WorkflowConfig } from '../types/workflow-config.js';
|
|
16
21
|
export declare const CONVERSATIONAL_FLOW_KIND = "conversational_flow";
|
|
17
|
-
|
|
18
|
-
config: WorkflowConfig;
|
|
19
|
-
/** Stored on the workflow so it opens in the conversational-flow editor. */
|
|
20
|
-
metadata: {
|
|
21
|
-
kind: typeof CONVERSATIONAL_FLOW_KIND;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
/** How typed messages are routed. A classifier model, or an agent asked for JSON. */
|
|
22
|
+
/** How typed messages are routed: a classifier model, or an agent asked for JSON. */
|
|
25
23
|
export type NewRouter = {
|
|
26
24
|
kind: 'classifier';
|
|
27
25
|
model?: string;
|
|
@@ -32,13 +30,20 @@ export type NewRouter = {
|
|
|
32
30
|
kind: 'agent';
|
|
33
31
|
agentSlug?: string;
|
|
34
32
|
};
|
|
33
|
+
export interface NewConversationalFlow {
|
|
34
|
+
config: WorkflowConfig;
|
|
35
|
+
/** Stored on the workflow so it opens in the conversational-flow editor. */
|
|
36
|
+
metadata: {
|
|
37
|
+
kind: typeof CONVERSATIONAL_FLOW_KIND;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
35
40
|
export declare function createConversationalFlow(options?: {
|
|
36
|
-
/** How typed text is routed. A classifier
|
|
41
|
+
/** How typed text is routed. A classifier unless an agent is asked for. */
|
|
37
42
|
router?: NewRouter;
|
|
38
|
-
/**
|
|
43
|
+
/** Shorthand for `router: { kind: 'agent', agentSlug }`. */
|
|
39
44
|
agentSlug?: string;
|
|
40
45
|
greeting?: string;
|
|
41
|
-
/**
|
|
46
|
+
/** The first screen's name, and the heading on it. */
|
|
42
47
|
title?: string;
|
|
43
48
|
}): NewConversationalFlow;
|
|
44
49
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/conversational-flow/create.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/conversational-flow/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAMlE,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAE9D,qFAAqF;AACrF,MAAM,MAAM,SAAS,GACjB;IACE,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0EAA0E;IAC1E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GACD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,cAAc,CAAC;IACvB,4EAA4E;IAC5E,QAAQ,EAAE;QAAE,IAAI,EAAE,OAAO,wBAAwB,CAAA;KAAE,CAAC;CACrD;AAED,wBAAgB,wBAAwB,CACtC,OAAO,GAAE;IACP,2EAA2E;IAC3E,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;CACX,GACL,qBAAqB,CA0DvB"}
|