@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.
Files changed (162) hide show
  1. package/dist/agents/host-agent-step.d.ts +2 -2
  2. package/dist/connectors/builtin/steps/classifier-agent.step.d.ts +2 -2
  3. package/dist/connectors/builtin/steps/parallel.step.d.ts +4 -4
  4. package/dist/connectors/builtin/steps/wait.step.d.ts +28 -0
  5. package/dist/connectors/builtin/steps/wait.step.d.ts.map +1 -1
  6. package/dist/connectors/builtin/steps/wait.step.js +26 -1
  7. package/dist/connectors/builtin/steps/wait.step.js.map +1 -1
  8. package/dist/conversational-flow/calls.d.ts +20 -0
  9. package/dist/conversational-flow/calls.d.ts.map +1 -0
  10. package/dist/conversational-flow/calls.js +59 -0
  11. package/dist/conversational-flow/calls.js.map +1 -0
  12. package/dist/conversational-flow/conditions.d.ts +24 -0
  13. package/dist/conversational-flow/conditions.d.ts.map +1 -0
  14. package/dist/conversational-flow/conditions.js +69 -0
  15. package/dist/conversational-flow/conditions.js.map +1 -0
  16. package/dist/conversational-flow/create.d.ts +23 -18
  17. package/dist/conversational-flow/create.d.ts.map +1 -1
  18. package/dist/conversational-flow/create.js +73 -96
  19. package/dist/conversational-flow/create.js.map +1 -1
  20. package/dist/conversational-flow/edit/build.d.ts +112 -0
  21. package/dist/conversational-flow/edit/build.d.ts.map +1 -0
  22. package/dist/conversational-flow/edit/build.js +249 -0
  23. package/dist/conversational-flow/edit/build.js.map +1 -0
  24. package/dist/conversational-flow/edit/calls.d.ts +61 -0
  25. package/dist/conversational-flow/edit/calls.d.ts.map +1 -0
  26. package/dist/conversational-flow/edit/calls.js +296 -0
  27. package/dist/conversational-flow/edit/calls.js.map +1 -0
  28. package/dist/conversational-flow/edit/cases.d.ts +29 -0
  29. package/dist/conversational-flow/edit/cases.d.ts.map +1 -0
  30. package/dist/conversational-flow/edit/cases.js +83 -0
  31. package/dist/conversational-flow/edit/cases.js.map +1 -0
  32. package/dist/conversational-flow/edit/endings.d.ts +16 -0
  33. package/dist/conversational-flow/edit/endings.d.ts.map +1 -0
  34. package/dist/conversational-flow/edit/endings.js +53 -0
  35. package/dist/conversational-flow/edit/endings.js.map +1 -0
  36. package/dist/conversational-flow/edit/followups.d.ts +28 -0
  37. package/dist/conversational-flow/edit/followups.d.ts.map +1 -0
  38. package/dist/conversational-flow/edit/followups.js +103 -0
  39. package/dist/conversational-flow/edit/followups.js.map +1 -0
  40. package/dist/conversational-flow/edit/inputs.d.ts +24 -0
  41. package/dist/conversational-flow/edit/inputs.d.ts.map +1 -0
  42. package/dist/conversational-flow/edit/inputs.js +53 -0
  43. package/dist/conversational-flow/edit/inputs.js.map +1 -0
  44. package/dist/conversational-flow/edit/kinds.d.ts +29 -0
  45. package/dist/conversational-flow/edit/kinds.d.ts.map +1 -0
  46. package/dist/conversational-flow/edit/kinds.js +142 -0
  47. package/dist/conversational-flow/edit/kinds.js.map +1 -0
  48. package/dist/conversational-flow/edit/options.d.ts +68 -0
  49. package/dist/conversational-flow/edit/options.d.ts.map +1 -0
  50. package/dist/conversational-flow/edit/options.js +209 -0
  51. package/dist/conversational-flow/edit/options.js.map +1 -0
  52. package/dist/conversational-flow/edit/picklist.d.ts +28 -0
  53. package/dist/conversational-flow/edit/picklist.d.ts.map +1 -0
  54. package/dist/conversational-flow/edit/picklist.js +58 -0
  55. package/dist/conversational-flow/edit/picklist.js.map +1 -0
  56. package/dist/conversational-flow/edit/prompts.d.ts +24 -0
  57. package/dist/conversational-flow/edit/prompts.d.ts.map +1 -0
  58. package/dist/conversational-flow/edit/prompts.js +180 -0
  59. package/dist/conversational-flow/edit/prompts.js.map +1 -0
  60. package/dist/conversational-flow/edit/routers.d.ts +65 -0
  61. package/dist/conversational-flow/edit/routers.d.ts.map +1 -0
  62. package/dist/conversational-flow/edit/routers.js +208 -0
  63. package/dist/conversational-flow/edit/routers.js.map +1 -0
  64. package/dist/conversational-flow/edit/screens.d.ts +44 -0
  65. package/dist/conversational-flow/edit/screens.d.ts.map +1 -0
  66. package/dist/conversational-flow/edit/screens.js +137 -0
  67. package/dist/conversational-flow/edit/screens.js.map +1 -0
  68. package/dist/conversational-flow/edit/versions.d.ts +43 -0
  69. package/dist/conversational-flow/edit/versions.d.ts.map +1 -0
  70. package/dist/conversational-flow/edit/versions.js +189 -0
  71. package/dist/conversational-flow/edit/versions.js.map +1 -0
  72. package/dist/conversational-flow/index.d.ts +33 -16
  73. package/dist/conversational-flow/index.d.ts.map +1 -1
  74. package/dist/conversational-flow/index.js +42 -9
  75. package/dist/conversational-flow/index.js.map +1 -1
  76. package/dist/conversational-flow/json.d.ts +15 -0
  77. package/dist/conversational-flow/json.d.ts.map +1 -0
  78. package/dist/conversational-flow/json.js +14 -0
  79. package/dist/conversational-flow/json.js.map +1 -0
  80. package/dist/conversational-flow/jumps.d.ts +22 -0
  81. package/dist/conversational-flow/jumps.d.ts.map +1 -0
  82. package/dist/conversational-flow/jumps.js +160 -0
  83. package/dist/conversational-flow/jumps.js.map +1 -0
  84. package/dist/conversational-flow/locate.d.ts +30 -0
  85. package/dist/conversational-flow/locate.d.ts.map +1 -0
  86. package/dist/conversational-flow/locate.js +73 -0
  87. package/dist/conversational-flow/locate.js.map +1 -0
  88. package/dist/conversational-flow/paths.d.ts +31 -0
  89. package/dist/conversational-flow/paths.d.ts.map +1 -0
  90. package/dist/conversational-flow/paths.js +50 -0
  91. package/dist/conversational-flow/paths.js.map +1 -0
  92. package/dist/conversational-flow/prompt.d.ts +48 -0
  93. package/dist/conversational-flow/prompt.d.ts.map +1 -0
  94. package/dist/conversational-flow/prompt.js +161 -0
  95. package/dist/conversational-flow/prompt.js.map +1 -0
  96. package/dist/conversational-flow/read.d.ts +9 -17
  97. package/dist/conversational-flow/read.d.ts.map +1 -1
  98. package/dist/conversational-flow/read.js +217 -384
  99. package/dist/conversational-flow/read.js.map +1 -1
  100. package/dist/conversational-flow/rounds.d.ts +29 -0
  101. package/dist/conversational-flow/rounds.d.ts.map +1 -0
  102. package/dist/conversational-flow/rounds.js +41 -0
  103. package/dist/conversational-flow/rounds.js.map +1 -0
  104. package/dist/conversational-flow/routers.d.ts +24 -80
  105. package/dist/conversational-flow/routers.d.ts.map +1 -1
  106. package/dist/conversational-flow/routers.js +76 -262
  107. package/dist/conversational-flow/routers.js.map +1 -1
  108. package/dist/conversational-flow/settle.d.ts +21 -15
  109. package/dist/conversational-flow/settle.d.ts.map +1 -1
  110. package/dist/conversational-flow/settle.js +240 -38
  111. package/dist/conversational-flow/settle.js.map +1 -1
  112. package/dist/conversational-flow/shape.d.ts +114 -0
  113. package/dist/conversational-flow/shape.d.ts.map +1 -0
  114. package/dist/conversational-flow/shape.js +209 -0
  115. package/dist/conversational-flow/shape.js.map +1 -0
  116. package/dist/conversational-flow/testing.d.ts +54 -0
  117. package/dist/conversational-flow/testing.d.ts.map +1 -0
  118. package/dist/conversational-flow/testing.js +119 -0
  119. package/dist/conversational-flow/testing.js.map +1 -0
  120. package/dist/conversational-flow/tree.d.ts +28 -17
  121. package/dist/conversational-flow/tree.d.ts.map +1 -1
  122. package/dist/conversational-flow/tree.js +60 -47
  123. package/dist/conversational-flow/tree.js.map +1 -1
  124. package/dist/conversational-flow/turn.d.ts +20 -22
  125. package/dist/conversational-flow/turn.d.ts.map +1 -1
  126. package/dist/conversational-flow/turn.js +69 -48
  127. package/dist/conversational-flow/turn.js.map +1 -1
  128. package/dist/conversational-flow/types.d.ts +154 -118
  129. package/dist/conversational-flow/types.d.ts.map +1 -1
  130. package/dist/conversational-flow/types.js +27 -51
  131. package/dist/conversational-flow/types.js.map +1 -1
  132. package/dist/conversational-flow/typing.d.ts +31 -0
  133. package/dist/conversational-flow/typing.d.ts.map +1 -0
  134. package/dist/conversational-flow/typing.js +53 -0
  135. package/dist/conversational-flow/typing.js.map +1 -0
  136. package/dist/engine/variable-resolver.d.ts +16 -0
  137. package/dist/engine/variable-resolver.d.ts.map +1 -1
  138. package/dist/engine/variable-resolver.js +45 -1
  139. package/dist/engine/variable-resolver.js.map +1 -1
  140. package/dist/types/pause-state.d.ts +9 -0
  141. package/dist/types/pause-state.d.ts.map +1 -1
  142. package/package.json +1 -1
  143. package/dist/conversational-flow/edit.d.ts +0 -101
  144. package/dist/conversational-flow/edit.d.ts.map +0 -1
  145. package/dist/conversational-flow/edit.js +0 -785
  146. package/dist/conversational-flow/edit.js.map +0 -1
  147. package/dist/conversational-flow/internals.d.ts +0 -51
  148. package/dist/conversational-flow/internals.d.ts.map +0 -1
  149. package/dist/conversational-flow/internals.js +0 -163
  150. package/dist/conversational-flow/internals.js.map +0 -1
  151. package/dist/conversational-flow/lookup-edit.d.ts +0 -96
  152. package/dist/conversational-flow/lookup-edit.d.ts.map +0 -1
  153. package/dist/conversational-flow/lookup-edit.js +0 -266
  154. package/dist/conversational-flow/lookup-edit.js.map +0 -1
  155. package/dist/conversational-flow/lookups.d.ts +0 -46
  156. package/dist/conversational-flow/lookups.d.ts.map +0 -1
  157. package/dist/conversational-flow/lookups.js +0 -145
  158. package/dist/conversational-flow/lookups.js.map +0 -1
  159. package/dist/conversational-flow/router-edit.d.ts +0 -53
  160. package/dist/conversational-flow/router-edit.d.ts.map +0 -1
  161. package/dist/conversational-flow/router-edit.js +0 -191
  162. package/dist/conversational-flow/router-edit.js.map +0 -1
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Reading what a screen asks.
3
+ *
4
+ * A question is a WAIT with a select field (the options) and, when typing is
5
+ * allowed, a text field. What follows it says where each answer goes:
6
+ *
7
+ * WAIT ask_x
8
+ * CONDITIONAL they typed something → GO_TO the router carrying the text
9
+ * otherwise → GO_TO carrying their pick, or a SWITCH
10
+ * that opens a follow-up question
11
+ *
12
+ * Everything here is recognised by the WAIT's own output contract — never by an
13
+ * id or a naming convention.
14
+ */
15
+ import { type Step } from './json.js';
16
+ import type { Destination, Prompt } from './types.js';
17
+ export interface PromptContext {
18
+ routeKey: string;
19
+ /** Step id → its type, for saying what decides a dynamic destination. */
20
+ typeOf: Map<string, string>;
21
+ }
22
+ /** A pick forwarded as the next screen, before it is expanded per option. */
23
+ type Resolved = Destination | {
24
+ kind: 'choice';
25
+ wait: string;
26
+ field: string;
27
+ };
28
+ /**
29
+ * Read a WAIT-led run of steps into `out`, following any follow-up questions.
30
+ * Returns the id of the question read, so a parent option can point at it.
31
+ */
32
+ export declare function readPrompt(steps: Step[], ctx: PromptContext, out: Prompt[]): string;
33
+ /**
34
+ * One destination written as several jumps: the same answer carried on, tested
35
+ * by which frame it lands in. They all say the same thing, so reading one is
36
+ * reading the destination.
37
+ */
38
+ export declare function splitDestination(steps: Step[], ctx: PromptContext): Resolved | undefined;
39
+ /**
40
+ * A GO_TO carries the screen it opens; a FINISH carries what the conversation
41
+ * reports. Which cycle catches the jump is not the view's business — that is
42
+ * settled from where the two screens sit.
43
+ */
44
+ export declare function jumpDestination(step: Step, ctx: PromptContext): Resolved;
45
+ /** A pick forwarded outside an option list has no single screen to name. */
46
+ export declare function finalise(resolved: Resolved): Destination;
47
+ export {};
48
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/conversational-flow/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAgC,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAgB,MAAM,YAAY,CAAC;AAMpE,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B;AAED,6EAA6E;AAC7E,KAAK,QAAQ,GAAG,WAAW,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9E;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,CA+CnF;AA0DD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,aAAa,GAAG,QAAQ,GAAG,SAAS,CAMxF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,aAAa,GAAG,QAAQ,CAexE;AAED,4EAA4E;AAC5E,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAExD"}
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Reading what a screen asks.
3
+ *
4
+ * A question is a WAIT with a select field (the options) and, when typing is
5
+ * allowed, a text field. What follows it says where each answer goes:
6
+ *
7
+ * WAIT ask_x
8
+ * CONDITIONAL they typed something → GO_TO the router carrying the text
9
+ * otherwise → GO_TO carrying their pick, or a SWITCH
10
+ * that opens a follow-up question
11
+ *
12
+ * Everything here is recognised by the WAIT's own output contract — never by an
13
+ * id or a naming convention.
14
+ */
15
+ import { asArray, asRec, asSteps, str } from './json.js';
16
+ import { jumpsIn } from './shape.js';
17
+ /** `{{steps.<wait>.output.resumeData.data.<field>}}` — a WAIT's own answer. */
18
+ const WAIT_FIELD = /^\{\{\s*steps\.([^.\s}]+)\.output\.resumeData\.data\.([A-Za-z0-9_]+)\s*\}\}$/;
19
+ const STEP_OUTPUT = /^\{\{\s*steps\.([^.\s}]+)\.output\b/;
20
+ /**
21
+ * Read a WAIT-led run of steps into `out`, following any follow-up questions.
22
+ * Returns the id of the question read, so a parent option can point at it.
23
+ */
24
+ export function readPrompt(steps, ctx, out) {
25
+ const wait = steps[0];
26
+ const config = asRec(wait.config);
27
+ const fields = asArray(asRec(config['form'])['fields']).map(asRec);
28
+ const select = fields.find((f) => f['type'] === 'select');
29
+ const text = fields.find((f) => f['type'] === 'text' || f['type'] === 'textarea');
30
+ const prompt = {
31
+ id: wait.id,
32
+ text: str(config['prompt']) ?? '',
33
+ header: str(config['reason']),
34
+ choiceField: str(select?.['name']),
35
+ textField: str(text?.['name']),
36
+ options: [],
37
+ freeText: undefined,
38
+ pickSwitchId: undefined,
39
+ ...(typeof select?.['options'] === 'string' ? { optionsFrom: String(select['options']) } : {}),
40
+ };
41
+ out.push(prompt);
42
+ // Typed text is split off by a CONDITIONAL testing this WAIT's own text field;
43
+ // its other branch is what happens when an option was picked.
44
+ let picked = steps.slice(1);
45
+ const [gate] = picked;
46
+ if (gate?.type === 'CONDITIONAL' && prompt.textField && tests(asRec(gate.config)['condition'], wait.id, prompt.textField)) {
47
+ const config = asRec(gate.config);
48
+ prompt.freeText = finalise(destinationOf(asSteps(config['if_true']), ctx, out));
49
+ picked = asSteps(config['if_false']);
50
+ }
51
+ const { byValue, switchId } = pickedDestinations(picked, wait.id, prompt.choiceField, ctx, out);
52
+ prompt.pickSwitchId = switchId;
53
+ prompt.options = asArray(select?.['options']).map(asRec).map((option) => {
54
+ const value = String(option['value'] ?? '');
55
+ const to = byValue(value);
56
+ const when = option['when'];
57
+ return {
58
+ label: str(option['label']) ?? value,
59
+ value,
60
+ // A pick forwarded whole opens the screen the option names.
61
+ to: to.kind === 'choice' ? { kind: 'screen', screen: value } : to,
62
+ back: false,
63
+ // Kept as written: the engine reads it, and the editor edits it in place.
64
+ ...(when !== undefined && when !== null ? { when: when } : {}),
65
+ };
66
+ });
67
+ return wait.id;
68
+ }
69
+ /**
70
+ * Where each answer leads. A pick may be forwarded whole — every option opens
71
+ * the screen it names — or branched by a SWITCH on this question's own answer,
72
+ * one case per option, with the rest falling to its default.
73
+ */
74
+ function pickedDestinations(picked, waitId, choiceField, ctx, out) {
75
+ const [only] = picked;
76
+ if (only?.type === 'SWITCH' && picked.length === 1) {
77
+ const config = asRec(only.config);
78
+ const cases = asArray(config['cases']).map(asRec);
79
+ const onThisAnswer = cases.every((entry) => {
80
+ const condition = asRec(entry['condition']);
81
+ return condition['operator'] === 'eq' && refersTo(condition['variable'], waitId, choiceField);
82
+ });
83
+ if (onThisAnswer) {
84
+ const branches = new Map();
85
+ for (const entry of cases) {
86
+ branches.set(String(asRec(entry['condition'])['value']), destinationOf(asSteps(entry['steps']), ctx, out));
87
+ }
88
+ const fallback = destinationOf(asSteps(config['default']), ctx, out);
89
+ return { byValue: (value) => branches.get(value) ?? fallback, switchId: only.id };
90
+ }
91
+ }
92
+ const whole = destinationOf(picked, ctx, out);
93
+ return { byValue: () => whole, switchId: undefined };
94
+ }
95
+ /** Does this reference read `field` off `waitId`'s answer? */
96
+ function refersTo(variable, waitId, field) {
97
+ if (typeof variable !== 'string' || !field)
98
+ return false;
99
+ const match = WAIT_FIELD.exec(variable);
100
+ return match?.[1] === waitId && match[2] === field;
101
+ }
102
+ /** A condition that tests whether this question's text field was filled in. */
103
+ function tests(condition, waitId, field) {
104
+ const rec = asRec(condition);
105
+ const parts = [rec, ...asArray(rec['all']).map(asRec), ...asArray(rec['any']).map(asRec)];
106
+ return parts.some((part) => refersTo(part['variable'], waitId, field));
107
+ }
108
+ /** What a run of steps leads to: another question, a jump, or an end. */
109
+ function destinationOf(steps, ctx, out) {
110
+ const [first] = steps;
111
+ if (!first)
112
+ return { kind: 'none' };
113
+ if (first.type === 'WAIT')
114
+ return { kind: 'prompt', prompt: readPrompt(steps, ctx, out) };
115
+ if (steps.length === 1 && (first.type === 'GO_TO' || first.type === 'FINISH'))
116
+ return jumpDestination(first, ctx);
117
+ return splitDestination(steps, ctx) ?? { kind: 'none' };
118
+ }
119
+ /**
120
+ * One destination written as several jumps: the same answer carried on, tested
121
+ * by which frame it lands in. They all say the same thing, so reading one is
122
+ * reading the destination.
123
+ */
124
+ export function splitDestination(steps, ctx) {
125
+ const jumps = jumpsIn(steps);
126
+ if (jumps.length === 0)
127
+ return undefined;
128
+ const carried = new Set(jumps.map((jump) => String(asRec(asRec(jump.config)['with'])[ctx.routeKey])));
129
+ if (carried.size !== 1)
130
+ return undefined;
131
+ return jumpDestination(jumps[0], ctx);
132
+ }
133
+ /**
134
+ * A GO_TO carries the screen it opens; a FINISH carries what the conversation
135
+ * reports. Which cycle catches the jump is not the view's business — that is
136
+ * settled from where the two screens sit.
137
+ */
138
+ export function jumpDestination(step, ctx) {
139
+ const carried = asRec(asRec(step.config)['with']);
140
+ if (step.type === 'FINISH')
141
+ return { kind: 'end', value: carried };
142
+ if (step.type !== 'GO_TO')
143
+ return { kind: 'none' };
144
+ const next = carried[ctx.routeKey];
145
+ if (typeof next !== 'string' || next === '')
146
+ return { kind: 'none' };
147
+ if (!next.includes('{{'))
148
+ return { kind: 'screen', screen: next };
149
+ const pick = WAIT_FIELD.exec(next);
150
+ if (pick && ctx.typeOf.get(pick[1]) === 'WAIT')
151
+ return { kind: 'choice', wait: pick[1], field: pick[2] };
152
+ const source = STEP_OUTPUT.exec(next);
153
+ if (source)
154
+ return { kind: 'dynamic', from: source[1], fromType: ctx.typeOf.get(source[1]) };
155
+ return { kind: 'none' };
156
+ }
157
+ /** A pick forwarded outside an option list has no single screen to name. */
158
+ export function finalise(resolved) {
159
+ return resolved.kind === 'choice' ? { kind: 'none' } : resolved;
160
+ }
161
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/conversational-flow/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAa,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC,+EAA+E;AAC/E,MAAM,UAAU,GAAG,8EAA8E,CAAC;AAClG,MAAM,WAAW,GAAG,qCAAqC,CAAC;AAW1D;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,GAAkB,EAAE,GAAa;IACzE,MAAM,IAAI,GA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,KAAK,EAAE,IAAI,CAAC,CAAC,CAAE,EAAE,CAAC;IAE5G,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,MAAM;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAE,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,EAAE,CAAC;IAC/F,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1B,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,QAAQ,CAAC,QAAkB;IACzC,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;AAClE,CAAC"}
@@ -1,24 +1,16 @@
1
1
  /**
2
- * config → conversational-flow view. Pure; no DOM, no network.
2
+ * config → the conversational-flow view.
3
3
  *
4
- * Everything is recognised by node type and by the step output contracts the
5
- * SDK defines — never by id or naming convention:
4
+ * The walk is the tree: each CYCLE is a section, each case inside it is a screen
5
+ * or a section of its own, and a screen's place is where its case sits. Nothing
6
+ * is inferred from where options point, so nothing the reader says can disagree
7
+ * with what the engine will do.
6
8
  *
7
- * - the router is a SWITCH whose cases all test `{{steps.__loop.output.input.<key>}}`
8
- * for equality, directly inside a CYCLE — `<key>` is whatever the author chose;
9
- * - an option's choice is `{{steps.<wait>.output.resumeData.data.<field>}}`, the
10
- * WAIT step's own output shape;
11
- * - a destination is a GO_TO / FINISH aimed at that CYCLE.
12
- *
13
- * Returns `null` when the config does not have that shape, which is how the
14
- * caller knows to fall back to the general builder.
9
+ * Returns `null` when the config is not this shape, which is how a caller knows
10
+ * to fall back to the general builder.
15
11
  */
16
12
  import type { WorkflowConfig } from '../types/workflow-config.js';
17
- import type { ConversationalFlow, ScreenKind } from './types.js';
13
+ import { type ConversationalFlow, type Prompt } from './types.js';
18
14
  export declare function readConversationalFlow(config: WorkflowConfig): ConversationalFlow | null;
19
- /** The display section that marks a WAIT as a hand off. */
20
- export declare const HANDOFF_SECTION = "handoff";
21
- /** An Ask AI task is the author's instructions, then the question the person typed. */
22
- export declare const QUESTION_SEPARATOR = "\n\nTheir question: ";
23
- export type { ScreenKind };
15
+ export type { Prompt };
24
16
  //# sourceMappingURL=read.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/conversational-flow/read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAGV,kBAAkB,EAKlB,UAAU,EACX,MAAM,YAAY,CAAC;AA0BpB,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,cAAc,GAAG,kBAAkB,GAAG,IAAI,CAmCxF;AA+SD,2DAA2D;AAC3D,eAAO,MAAM,eAAe,YAAY,CAAC;AAkBzC,uFAAuF;AACvF,eAAO,MAAM,kBAAkB,yBAAyB,CAAC;AAiJzD,YAAY,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/conversational-flow/read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAKlE,OAAO,EASL,KAAK,kBAAkB,EAEvB,KAAK,MAAM,EAIZ,MAAM,YAAY,CAAC;AAgBpB,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,cAAc,GAAG,kBAAkB,GAAG,IAAI,CAkBxF;AAiRD,YAAY,EAAE,MAAM,EAAE,CAAC"}