@xyne/workflow-sdk 3.2.46 → 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 (186) 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/map.step.d.ts +15 -4
  4. package/dist/connectors/builtin/steps/map.step.d.ts.map +1 -1
  5. package/dist/connectors/builtin/steps/map.step.js +51 -18
  6. package/dist/connectors/builtin/steps/map.step.js.map +1 -1
  7. package/dist/connectors/builtin/steps/parallel.step.d.ts +4 -4
  8. package/dist/connectors/builtin/steps/wait.step.d.ts +28 -0
  9. package/dist/connectors/builtin/steps/wait.step.d.ts.map +1 -1
  10. package/dist/connectors/builtin/steps/wait.step.js +26 -1
  11. package/dist/connectors/builtin/steps/wait.step.js.map +1 -1
  12. package/dist/conversational-flow/calls.d.ts +20 -0
  13. package/dist/conversational-flow/calls.d.ts.map +1 -0
  14. package/dist/conversational-flow/calls.js +59 -0
  15. package/dist/conversational-flow/calls.js.map +1 -0
  16. package/dist/conversational-flow/conditions.d.ts +24 -0
  17. package/dist/conversational-flow/conditions.d.ts.map +1 -0
  18. package/dist/conversational-flow/conditions.js +69 -0
  19. package/dist/conversational-flow/conditions.js.map +1 -0
  20. package/dist/conversational-flow/create.d.ts +23 -18
  21. package/dist/conversational-flow/create.d.ts.map +1 -1
  22. package/dist/conversational-flow/create.js +73 -96
  23. package/dist/conversational-flow/create.js.map +1 -1
  24. package/dist/conversational-flow/edit/build.d.ts +112 -0
  25. package/dist/conversational-flow/edit/build.d.ts.map +1 -0
  26. package/dist/conversational-flow/edit/build.js +249 -0
  27. package/dist/conversational-flow/edit/build.js.map +1 -0
  28. package/dist/conversational-flow/edit/calls.d.ts +61 -0
  29. package/dist/conversational-flow/edit/calls.d.ts.map +1 -0
  30. package/dist/conversational-flow/edit/calls.js +296 -0
  31. package/dist/conversational-flow/edit/calls.js.map +1 -0
  32. package/dist/conversational-flow/edit/cases.d.ts +29 -0
  33. package/dist/conversational-flow/edit/cases.d.ts.map +1 -0
  34. package/dist/conversational-flow/edit/cases.js +83 -0
  35. package/dist/conversational-flow/edit/cases.js.map +1 -0
  36. package/dist/conversational-flow/edit/endings.d.ts +16 -0
  37. package/dist/conversational-flow/edit/endings.d.ts.map +1 -0
  38. package/dist/conversational-flow/edit/endings.js +53 -0
  39. package/dist/conversational-flow/edit/endings.js.map +1 -0
  40. package/dist/conversational-flow/edit/followups.d.ts +28 -0
  41. package/dist/conversational-flow/edit/followups.d.ts.map +1 -0
  42. package/dist/conversational-flow/edit/followups.js +103 -0
  43. package/dist/conversational-flow/edit/followups.js.map +1 -0
  44. package/dist/conversational-flow/edit/inputs.d.ts +24 -0
  45. package/dist/conversational-flow/edit/inputs.d.ts.map +1 -0
  46. package/dist/conversational-flow/edit/inputs.js +53 -0
  47. package/dist/conversational-flow/edit/inputs.js.map +1 -0
  48. package/dist/conversational-flow/edit/kinds.d.ts +29 -0
  49. package/dist/conversational-flow/edit/kinds.d.ts.map +1 -0
  50. package/dist/conversational-flow/edit/kinds.js +142 -0
  51. package/dist/conversational-flow/edit/kinds.js.map +1 -0
  52. package/dist/conversational-flow/edit/options.d.ts +68 -0
  53. package/dist/conversational-flow/edit/options.d.ts.map +1 -0
  54. package/dist/conversational-flow/edit/options.js +209 -0
  55. package/dist/conversational-flow/edit/options.js.map +1 -0
  56. package/dist/conversational-flow/edit/picklist.d.ts +28 -0
  57. package/dist/conversational-flow/edit/picklist.d.ts.map +1 -0
  58. package/dist/conversational-flow/edit/picklist.js +58 -0
  59. package/dist/conversational-flow/edit/picklist.js.map +1 -0
  60. package/dist/conversational-flow/edit/prompts.d.ts +24 -0
  61. package/dist/conversational-flow/edit/prompts.d.ts.map +1 -0
  62. package/dist/conversational-flow/edit/prompts.js +180 -0
  63. package/dist/conversational-flow/edit/prompts.js.map +1 -0
  64. package/dist/conversational-flow/edit/routers.d.ts +65 -0
  65. package/dist/conversational-flow/edit/routers.d.ts.map +1 -0
  66. package/dist/conversational-flow/edit/routers.js +208 -0
  67. package/dist/conversational-flow/edit/routers.js.map +1 -0
  68. package/dist/conversational-flow/edit/screens.d.ts +44 -0
  69. package/dist/conversational-flow/edit/screens.d.ts.map +1 -0
  70. package/dist/conversational-flow/edit/screens.js +137 -0
  71. package/dist/conversational-flow/edit/screens.js.map +1 -0
  72. package/dist/conversational-flow/edit/versions.d.ts +43 -0
  73. package/dist/conversational-flow/edit/versions.d.ts.map +1 -0
  74. package/dist/conversational-flow/edit/versions.js +189 -0
  75. package/dist/conversational-flow/edit/versions.js.map +1 -0
  76. package/dist/conversational-flow/index.d.ts +33 -16
  77. package/dist/conversational-flow/index.d.ts.map +1 -1
  78. package/dist/conversational-flow/index.js +42 -9
  79. package/dist/conversational-flow/index.js.map +1 -1
  80. package/dist/conversational-flow/json.d.ts +15 -0
  81. package/dist/conversational-flow/json.d.ts.map +1 -0
  82. package/dist/conversational-flow/json.js +14 -0
  83. package/dist/conversational-flow/json.js.map +1 -0
  84. package/dist/conversational-flow/jumps.d.ts +22 -0
  85. package/dist/conversational-flow/jumps.d.ts.map +1 -0
  86. package/dist/conversational-flow/jumps.js +160 -0
  87. package/dist/conversational-flow/jumps.js.map +1 -0
  88. package/dist/conversational-flow/locate.d.ts +30 -0
  89. package/dist/conversational-flow/locate.d.ts.map +1 -0
  90. package/dist/conversational-flow/locate.js +73 -0
  91. package/dist/conversational-flow/locate.js.map +1 -0
  92. package/dist/conversational-flow/paths.d.ts +31 -0
  93. package/dist/conversational-flow/paths.d.ts.map +1 -0
  94. package/dist/conversational-flow/paths.js +50 -0
  95. package/dist/conversational-flow/paths.js.map +1 -0
  96. package/dist/conversational-flow/prompt.d.ts +48 -0
  97. package/dist/conversational-flow/prompt.d.ts.map +1 -0
  98. package/dist/conversational-flow/prompt.js +161 -0
  99. package/dist/conversational-flow/prompt.js.map +1 -0
  100. package/dist/conversational-flow/read.d.ts +9 -17
  101. package/dist/conversational-flow/read.d.ts.map +1 -1
  102. package/dist/conversational-flow/read.js +217 -384
  103. package/dist/conversational-flow/read.js.map +1 -1
  104. package/dist/conversational-flow/rounds.d.ts +29 -0
  105. package/dist/conversational-flow/rounds.d.ts.map +1 -0
  106. package/dist/conversational-flow/rounds.js +41 -0
  107. package/dist/conversational-flow/rounds.js.map +1 -0
  108. package/dist/conversational-flow/routers.d.ts +24 -80
  109. package/dist/conversational-flow/routers.d.ts.map +1 -1
  110. package/dist/conversational-flow/routers.js +76 -262
  111. package/dist/conversational-flow/routers.js.map +1 -1
  112. package/dist/conversational-flow/settle.d.ts +21 -15
  113. package/dist/conversational-flow/settle.d.ts.map +1 -1
  114. package/dist/conversational-flow/settle.js +240 -38
  115. package/dist/conversational-flow/settle.js.map +1 -1
  116. package/dist/conversational-flow/shape.d.ts +114 -0
  117. package/dist/conversational-flow/shape.d.ts.map +1 -0
  118. package/dist/conversational-flow/shape.js +209 -0
  119. package/dist/conversational-flow/shape.js.map +1 -0
  120. package/dist/conversational-flow/testing.d.ts +54 -0
  121. package/dist/conversational-flow/testing.d.ts.map +1 -0
  122. package/dist/conversational-flow/testing.js +119 -0
  123. package/dist/conversational-flow/testing.js.map +1 -0
  124. package/dist/conversational-flow/tree.d.ts +28 -17
  125. package/dist/conversational-flow/tree.d.ts.map +1 -1
  126. package/dist/conversational-flow/tree.js +60 -47
  127. package/dist/conversational-flow/tree.js.map +1 -1
  128. package/dist/conversational-flow/turn.d.ts +20 -22
  129. package/dist/conversational-flow/turn.d.ts.map +1 -1
  130. package/dist/conversational-flow/turn.js +69 -48
  131. package/dist/conversational-flow/turn.js.map +1 -1
  132. package/dist/conversational-flow/types.d.ts +154 -118
  133. package/dist/conversational-flow/types.d.ts.map +1 -1
  134. package/dist/conversational-flow/types.js +27 -51
  135. package/dist/conversational-flow/types.js.map +1 -1
  136. package/dist/conversational-flow/typing.d.ts +31 -0
  137. package/dist/conversational-flow/typing.d.ts.map +1 -0
  138. package/dist/conversational-flow/typing.js +53 -0
  139. package/dist/conversational-flow/typing.js.map +1 -0
  140. package/dist/engine/config-validator.js +2 -2
  141. package/dist/engine/config-validator.js.map +1 -1
  142. package/dist/engine/variable-resolver.d.ts +16 -0
  143. package/dist/engine/variable-resolver.d.ts.map +1 -1
  144. package/dist/engine/variable-resolver.js +46 -2
  145. package/dist/engine/variable-resolver.js.map +1 -1
  146. package/dist/engine/workflow-executor.d.ts.map +1 -1
  147. package/dist/engine/workflow-executor.js +10 -0
  148. package/dist/engine/workflow-executor.js.map +1 -1
  149. package/dist/runtime/workflow-runtime.d.ts.map +1 -1
  150. package/dist/runtime/workflow-runtime.js +3 -0
  151. package/dist/runtime/workflow-runtime.js.map +1 -1
  152. package/dist/steps/base-step.d.ts.map +1 -1
  153. package/dist/steps/base-step.js +1 -0
  154. package/dist/steps/base-step.js.map +1 -1
  155. package/dist/testing/mock-context.d.ts.map +1 -1
  156. package/dist/testing/mock-context.js +1 -0
  157. package/dist/testing/mock-context.js.map +1 -1
  158. package/dist/types/context.d.ts +15 -0
  159. package/dist/types/context.d.ts.map +1 -1
  160. package/dist/types/pause-state.d.ts +9 -0
  161. package/dist/types/pause-state.d.ts.map +1 -1
  162. package/dist/util/variable-ref.d.ts +1 -1
  163. package/dist/util/variable-ref.d.ts.map +1 -1
  164. package/dist/util/variable-ref.js +1 -1
  165. package/dist/util/variable-ref.js.map +1 -1
  166. package/package.json +1 -1
  167. package/dist/conversational-flow/edit.d.ts +0 -101
  168. package/dist/conversational-flow/edit.d.ts.map +0 -1
  169. package/dist/conversational-flow/edit.js +0 -785
  170. package/dist/conversational-flow/edit.js.map +0 -1
  171. package/dist/conversational-flow/internals.d.ts +0 -51
  172. package/dist/conversational-flow/internals.d.ts.map +0 -1
  173. package/dist/conversational-flow/internals.js +0 -163
  174. package/dist/conversational-flow/internals.js.map +0 -1
  175. package/dist/conversational-flow/lookup-edit.d.ts +0 -96
  176. package/dist/conversational-flow/lookup-edit.d.ts.map +0 -1
  177. package/dist/conversational-flow/lookup-edit.js +0 -266
  178. package/dist/conversational-flow/lookup-edit.js.map +0 -1
  179. package/dist/conversational-flow/lookups.d.ts +0 -46
  180. package/dist/conversational-flow/lookups.d.ts.map +0 -1
  181. package/dist/conversational-flow/lookups.js +0 -145
  182. package/dist/conversational-flow/lookups.js.map +0 -1
  183. package/dist/conversational-flow/router-edit.d.ts +0 -53
  184. package/dist/conversational-flow/router-edit.d.ts.map +0 -1
  185. package/dist/conversational-flow/router-edit.js +0 -191
  186. package/dist/conversational-flow/router-edit.js.map +0 -1
@@ -0,0 +1,189 @@
1
+ import { asArray, asRec, asSteps } from '../json.js';
2
+ import { caseFor } from '../locate.js';
3
+ import { ConversationalFlowEditError, requireFlow, settle } from '../settle.js';
4
+ import { partsOf } from '../shape.js';
5
+ import { labelFor, leavesOf } from '../conditions.js';
6
+ /**
7
+ * Ask this screen a second way when `when` holds.
8
+ *
9
+ * The new version starts as a copy of the one asked otherwise — same wording,
10
+ * same options — because an author changes what differs, and everything that
11
+ * doesn't should already be right.
12
+ */
13
+ export function addVersion(config, screenId, when) {
14
+ requireAsking(requireFlow(config), screenId);
15
+ requireCondition(when);
16
+ let added = '';
17
+ const next = settle(config, (draft) => {
18
+ const live = requireFlow(draft);
19
+ const entry = caseFor(draft, live, requireAsking(live, screenId));
20
+ if (!entry)
21
+ return;
22
+ const steps = asArray(entry['steps']);
23
+ const { rest } = partsOf(entry, live.routeKey);
24
+ const lead = steps.slice(0, steps.length - rest.length);
25
+ const versions = rest[0]?.type === 'SWITCH' ? rest[0] : undefined;
26
+ const ordinary = versions ? asSteps(asRec(versions.config)['default']) : rest;
27
+ const taken = new Set(idsIn(draft));
28
+ const copy = rename(ordinary, unique(`${screenId}__${asArray(asRec(versions?.config)['cases']).length + 1}`, taken));
29
+ added = copy[0]?.id ?? '';
30
+ if (versions) {
31
+ asArray(versions.config['cases']).push({ label: labelFor(when), condition: { ...when }, steps: copy });
32
+ return;
33
+ }
34
+ entry['steps'] = [
35
+ ...lead,
36
+ {
37
+ id: unique(`versions_${screenId}`, taken),
38
+ type: 'SWITCH',
39
+ config: { cases: [{ label: labelFor(when), condition: { ...when }, steps: copy }], default: ordinary },
40
+ },
41
+ ];
42
+ });
43
+ return { config: next, promptId: added };
44
+ }
45
+ /** Change when a version is asked. */
46
+ export function setVersionWhen(config, promptId, when) {
47
+ requireCondition(when);
48
+ const flow = requireFlow(config);
49
+ requireVersion(flow, promptId);
50
+ return settle(config, (draft) => {
51
+ const live = requireFlow(draft);
52
+ const found = versionCase(draft, live, promptId);
53
+ if (found) {
54
+ found.entry['condition'] = { ...when };
55
+ found.entry['label'] = labelFor(when);
56
+ }
57
+ });
58
+ }
59
+ /**
60
+ * Take a version away. The one asked when nothing else holds cannot go — it is
61
+ * what the screen does — and removing the last conditional one unwraps the
62
+ * switch, leaving the case as it was before any version was added.
63
+ */
64
+ export function removeVersion(config, promptId) {
65
+ const flow = requireFlow(config);
66
+ requireVersion(flow, promptId);
67
+ return settle(config, (draft) => {
68
+ const live = requireFlow(draft);
69
+ const found = versionCase(draft, live, promptId);
70
+ if (!found)
71
+ return;
72
+ const cases = asArray(found.versions.config['cases']);
73
+ const at = cases.indexOf(found.entry);
74
+ if (at >= 0)
75
+ cases.splice(at, 1);
76
+ if (cases.length > 0)
77
+ return;
78
+ // The last one: unwrap, and the case is what it was.
79
+ const entry = caseFor(draft, live, found.screen);
80
+ if (!entry)
81
+ return;
82
+ const steps = asArray(entry['steps']);
83
+ const where = steps.indexOf(found.versions);
84
+ if (where >= 0)
85
+ steps.splice(where, 1, ...asSteps(asRec(found.versions.config)['default']));
86
+ });
87
+ }
88
+ // ─── Plumbing ───
89
+ /** The switch, the case and the screen a version's question belongs to. */
90
+ function versionCase(draft, flow, promptId) {
91
+ for (const screen of flow.screens) {
92
+ if (!screen.prompts.some((p) => p.id === promptId))
93
+ continue;
94
+ const entry = caseFor(draft, flow, screen);
95
+ const versions = entry ? partsOf(entry, flow.routeKey).rest[0] : undefined;
96
+ if (versions?.type !== 'SWITCH')
97
+ continue;
98
+ for (const raw of asArray(versions.config['cases'])) {
99
+ const test = asRec(raw);
100
+ if (asSteps(test['steps'])[0]?.id === promptId)
101
+ return { screen, versions, entry: test };
102
+ }
103
+ }
104
+ return undefined;
105
+ }
106
+ /** Every id in the config, so a copy never collides with one. */
107
+ function idsIn(config) {
108
+ const out = [];
109
+ const walk = (value) => {
110
+ if (Array.isArray(value))
111
+ return value.forEach(walk);
112
+ if (!value || typeof value !== 'object')
113
+ return;
114
+ const rec = value;
115
+ if (typeof rec['id'] === 'string')
116
+ out.push(rec['id']);
117
+ Object.values(rec).forEach(walk);
118
+ };
119
+ walk(config.steps);
120
+ return out;
121
+ }
122
+ /**
123
+ * A copy of a way of asking, renamed so it stands beside the original: every
124
+ * step takes a suffix, and every reference between them follows.
125
+ */
126
+ function rename(steps, suffix) {
127
+ const copy = JSON.parse(JSON.stringify(steps));
128
+ const renamed = new Map();
129
+ const walk = (value, visit) => {
130
+ if (Array.isArray(value))
131
+ return value.forEach((v) => walk(v, visit));
132
+ if (!value || typeof value !== 'object')
133
+ return;
134
+ const rec = value;
135
+ if (typeof rec['id'] === 'string' && typeof rec['type'] === 'string')
136
+ visit(rec);
137
+ Object.values(rec).forEach((v) => walk(v, visit));
138
+ };
139
+ walk(copy, (step) => {
140
+ const was = String(step['id']);
141
+ const now = `${was}__${suffix}`;
142
+ renamed.set(was, now);
143
+ step['id'] = now;
144
+ });
145
+ // The gate and the jumps name the question they read; they must follow it.
146
+ let text = JSON.stringify(copy);
147
+ for (const [was, now] of renamed)
148
+ text = text.split(`steps.${was}.`).join(`steps.${now}.`);
149
+ return JSON.parse(text);
150
+ }
151
+ function requireCondition(when) {
152
+ const leaves = leavesOf(when);
153
+ if (leaves.length === 0)
154
+ throw new ConversationalFlowEditError('A condition needs something to test.');
155
+ for (const leaf of leaves) {
156
+ if (!leaf.variable.trim())
157
+ throw new ConversationalFlowEditError('Say which value decides.');
158
+ if (!leaf.operator.trim())
159
+ throw new ConversationalFlowEditError('Say how to compare it.');
160
+ }
161
+ }
162
+ function requireAsking(flow, id) {
163
+ const screen = flow.screens.find((s) => s.id === id);
164
+ if (!screen)
165
+ throw new ConversationalFlowEditError(`There is no screen “${id}”.`);
166
+ if (screen.prompts.length === 0) {
167
+ throw new ConversationalFlowEditError(`“${screen.title}” doesn’t ask anything, so there is nothing to ask differently.`);
168
+ }
169
+ return screen;
170
+ }
171
+ function requireVersion(flow, promptId) {
172
+ for (const screen of flow.screens) {
173
+ const prompt = screen.prompts.find((p) => p.id === promptId);
174
+ if (!prompt)
175
+ continue;
176
+ if (!prompt.when) {
177
+ throw new ConversationalFlowEditError('This is what the screen asks when nothing else holds; it has no condition.');
178
+ }
179
+ return prompt;
180
+ }
181
+ throw new ConversationalFlowEditError(`There is no question “${promptId}”.`);
182
+ }
183
+ function unique(base, taken) {
184
+ let name = base;
185
+ for (let n = 2; taken.has(name); n += 1)
186
+ name = `${base}_${n}`;
187
+ return name;
188
+ }
189
+ //# sourceMappingURL=versions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../src/conversational-flow/edit/versions.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAuB,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,2BAA2B,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGtD;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,MAAsB,EACtB,QAAgB,EAChB,IAAe;IAEf,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC7C,gBAAgB,C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AC;IAC/D,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,23 +1,40 @@
1
1
  /**
2
2
  * Conversational flows: a workflow that talks someone through a process —
3
- * screens, options, typed text routed by an agent, and a finish with an outcome
4
- * or a hand off to a person.
3
+ * screens, options, typed text routed by a model, things fetched on the way, and
4
+ * an ending that reports what happened or hands over to a person.
5
5
  *
6
- * Nothing here is a new engine construct. A conversational flow is a CYCLE whose
7
- * SWITCH has one case per screen, built from WAIT, CONDITIONAL, GO_TO, FINISH and
8
- * RUN_AGENT. This section reads that shape into screens (`readConversationalFlow`),
9
- * edits it as pure `config → config` functions, and creates new ones.
6
+ * Nothing here is a new engine construct. **The config is the tree**: the
7
+ * conversation is a CYCLE, its SWITCH has one case per screen, and a screen with
8
+ * screens inside it is a case holding a CYCLE of its own. So where a case sits is
9
+ * where the screen is, what a section fetched stays in scope for everything
10
+ * inside it, and a jump names the innermost frame holding both its ends.
11
+ *
12
+ * This section reads that shape into screens (`readConversationalFlow`), edits it
13
+ * as pure `config → config` functions, creates new ones, and turns a run of one
14
+ * into what a caller sees (`readTurn`). Everything derived — the subtrees, the
15
+ * frames, the headings, what each router may choose — is written by `settle`
16
+ * after every edit, so an edit only ever says what the author meant.
10
17
  */
11
- export type { AskAiInfo, ConversationalFlow, Destination, Prompt, PromptOption, RouterInfo, Screen, ScreenKind, } from './types.js';
12
- export { AGENT_STEP_TYPE, CLASSIFIER_STEP_TYPE, DEFAULT_CLASSIFIER_ENDPOINT, optionsOf, routerName } from './types.js';
13
18
  export { readConversationalFlow } from './read.js';
14
- export { ConversationalFlowEditError } from './internals.js';
15
- export { breadcrumb } from './tree.js';
16
- export { refreshDerived } from './settle.js';
17
- export { candidatesOf, endsByTyping, flowRouter, routableScreens, routerFor, routersOf, routingIsValid } from './routers.js';
18
- export { setRouterAgent, setRouterGuidance, setRouterMode, setRouterModel, setScopedRouter, setTypedRouter, } from './router-edit.js';
19
- export { type NewScreenType, addFollowUp, addOption, addScreen, moveOption, moveScreen, relabelOption, removeOption, removeScreen, renameScreen, retargetOption, setAbout, setAskAi, setEndMessage, setEndResult, setPromptText, setScreenType, setTypingAllowed, setWayBack, } from './edit.js';
19
+ export { refreshDerived, ConversationalFlowEditError } from './settle.js';
20
+ export type { AskAiInfo, Condition, LeafCondition, Call, CallScope, ConversationalFlow, Destination, Prompt, PromptOption, RouterInfo, Screen, ScreenKind, } from './types.js';
21
+ export { AGENT_STEP_TYPE, CLASSIFIER_STEP_TYPE, DEFAULT_CLASSIFIER_ENDPOINT, END_MESSAGE_KEY, HTTP_STEP_TYPE, optionsOf, } from './types.js';
22
+ export { fieldName, group, isFlat, joinOf, labelFor, leavesOf, partsIn, takesValue } from './conditions.js';
23
+ export { OPERATOR_DESCRIPTORS, ConditionOperator, type OperatorDescriptor } from '../types/operators.js';
24
+ export { ancestorsOf, breadcrumb, childrenOf, mainMenuLabel, outsideMenu, subtreeOf, treeOrder } from './tree.js';
25
+ export { screenAtPath } from './paths.js';
26
+ export { candidatesOf, endsByTyping, flowRouter, frameOf, routableScreens, routerFor, routerName, routersFor, routersOf, routingIsValid, scopeOf, } from './routers.js';
20
27
  export { CONVERSATIONAL_FLOW_KIND, createConversationalFlow, type NewConversationalFlow, type NewRouter } from './create.js';
21
- export { ancestorsOf, childrenOf, outsideTree, treeOrder } from './tree.js';
22
- export { RETRY_AFTER_MS, TurnAnswerError, streamEventOf, type ConversationStreamEvent, answerFor, answeredWith, readTranscript, readTurn, type RunStepView, type RunView, type Transcript, type TranscriptEntry, type Turn, type TurnAnswer, type TurnEvent, type TurnField, type TurnHandoff, type TurnMessage, type TurnOption, type TurnReply, type TurnScreen, type TurnStatus, } from './turn.js';
28
+ export { addScreen, moveScreen, removeScreen, renameScreen, type NewScreen } from './edit/screens.js';
29
+ export { setScreenType, setAskAi, type NewScreenType } from './edit/kinds.js';
30
+ export { addOption, moveOption, relabelOption, removeOption, retargetOption, setOptionCondition, setWayBack, type NewOption, } from './edit/options.js';
31
+ export { setAbout, setPromptText, setTypingAllowed } from './edit/prompts.js';
32
+ export { addFollowUp, removeFollowUp } from './edit/followups.js';
33
+ export { optionsFrom, setOptionsFromLookup, setOptionsWritten } from './edit/picklist.js';
34
+ export { addVersion, removeVersion, setVersionWhen } from './edit/versions.js';
35
+ export { setEndMessage, setEndResult } from './edit/endings.js';
36
+ export { setConversationInputs, type ConversationInput } from './edit/inputs.js';
37
+ export { scopeRouter, setRouterGuidance, setRouterMode, setRouterService, setTypedRouter, type RouterMode, type RouterService, } from './edit/routers.js';
38
+ export { addCall, callRef, moveCall, quotedIn, removeCall, setCall, setCallFallback, type CallDraft, } from './edit/calls.js';
39
+ export { RETRY_AFTER_MS, TurnAnswerError, answerFor, answeredWith, readTranscript, readTurn, streamEventOf, type ConversationStreamEvent, type RunStepView, type RunView, type Transcript, type TranscriptEntry, type Turn, type TurnAnswer, type TurnEvent, type TurnField, type TurnHandoff, type TurnMessage, type TurnOption, type TurnReply, type TurnScreen, type TurnStatus, } from './turn.js';
23
40
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conversational-flow/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,YAAY,EACV,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,MAAM,EACN,YAAY,EACZ,UAAU,EACV,MAAM,EACN,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACvH,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7H,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,aAAa,EAClB,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,UAAU,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,UAAU,GACX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,KAAK,qBAAqB,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7H,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC5E,OAAO,EACL,cAAc,EACd,eAAe,EACf,aAAa,EACb,KAAK,uBAAuB,EAC5B,SAAS,EACT,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,UAAU,GAChB,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conversational-flow/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC1E,Y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 * Conversational flows: a workflow that talks someone through a process —
3
+ * screens, options, typed text routed by a model, things fetched on the way, and
4
+ * an ending that reports what happened or hands over to a person.
5
+ *
6
+ * Nothing here is a new engine construct. **The config is the tree**: the
7
+ * conversation is a CYCLE, its SWITCH has one case per screen, and a screen with
8
+ * screens inside it is a case holding a CYCLE of its own. So where a case sits is
9
+ * where the screen is, what a section fetched stays in scope for everything
10
+ * inside it, and a jump names the innermost frame holding both its ends.
11
+ *
12
+ * This section reads that shape into screens (`readConversationalFlow`), edits it
13
+ * as pure `config → config` functions, creates new ones, and turns a run of one
14
+ * into what a caller sees (`readTurn`). Everything derived — the subtrees, the
15
+ * frames, the headings, what each router may choose — is written by `settle`
16
+ * after every edit, so an edit only ever says what the author meant.
17
+ */
18
+ // ─── Reading a flow ───
2
19
  export { readConversationalFlow } from './read.js';
3
- export { ConversationalFlowEditError } from './internals.js';
4
- export { breadcrumb } from './tree.js';
5
- export { refreshDerived } from './settle.js';
6
- export { candidatesOf, endsByTyping, flowRouter, routableScreens, routerFor, routersOf, routingIsValid } from './routers.js';
7
- export { setRouterAgent, setRouterGuidance, setRouterMode, setRouterModel, setScopedRouter, setTypedRouter, } from './router-edit.js';
8
- export { addFollowUp, addOption, addScreen, moveOption, moveScreen, relabelOption, removeOption, removeScreen, renameScreen, retargetOption, setAbout, setAskAi, setEndMessage, setEndResult, setPromptText, setScreenType, setTypingAllowed, setWayBack, } from './edit.js';
20
+ export { refreshDerived, ConversationalFlowEditError } from './settle.js';
21
+ export { AGENT_STEP_TYPE, CLASSIFIER_STEP_TYPE, DEFAULT_CLASSIFIER_ENDPOINT, END_MESSAGE_KEY, HTTP_STEP_TYPE, optionsOf, } from './types.js';
22
+ // ─── What a condition says ───
23
+ export { fieldName, group, isFlat, joinOf, labelFor, leavesOf, partsIn, takesValue } from './conditions.js';
24
+ export { OPERATOR_DESCRIPTORS, ConditionOperator } from '../types/operators.js';
25
+ // ─── Where things sit ───
26
+ export { ancestorsOf, breadcrumb, childrenOf, mainMenuLabel, outsideMenu, subtreeOf, treeOrder } from './tree.js';
27
+ export { screenAtPath } from './paths.js';
28
+ export { candidatesOf, endsByTyping, flowRouter, frameOf, routableScreens, routerFor, routerName, routersFor, routersOf, routingIsValid, scopeOf, } from './routers.js';
29
+ // ─── Making one ───
9
30
  export { CONVERSATIONAL_FLOW_KIND, createConversationalFlow } from './create.js';
10
- export { ancestorsOf, childrenOf, outsideTree, treeOrder } from './tree.js';
11
- export { RETRY_AFTER_MS, TurnAnswerError, streamEventOf, answerFor, answeredWith, readTranscript, readTurn, } from './turn.js';
31
+ // ─── Editing one ───
32
+ export { addScreen, moveScreen, removeScreen, renameScreen } from './edit/screens.js';
33
+ export { setScreenType, setAskAi } from './edit/kinds.js';
34
+ export { addOption, moveOption, relabelOption, removeOption, retargetOption, setOptionCondition, setWayBack, } from './edit/options.js';
35
+ export { setAbout, setPromptText, setTypingAllowed } from './edit/prompts.js';
36
+ export { addFollowUp, removeFollowUp } from './edit/followups.js';
37
+ export { optionsFrom, setOptionsFromLookup, setOptionsWritten } from './edit/picklist.js';
38
+ export { addVersion, removeVersion, setVersionWhen } from './edit/versions.js';
39
+ export { setEndMessage, setEndResult } from './edit/endings.js';
40
+ export { setConversationInputs } from './edit/inputs.js';
41
+ export { scopeRouter, setRouterGuidance, setRouterMode, setRouterService, setTypedRouter, } from './edit/routers.js';
42
+ export { addCall, callRef, moveCall, quotedIn, removeCall, setCall, setCallFallback, } from './edit/calls.js';
43
+ // ─── Running one ───
44
+ export { RETRY_AFTER_MS, TurnAnswerError, answerFor, answeredWith, readTranscript, readTurn, streamEventOf, } from './turn.js';
12
45
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/conversational-flow/index.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACvH,OAAO,E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,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAA0B,MAAM,kBAAkB,CAAC;AACjF,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,cAAc,GAGf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,OAAO,EACP,eAAe,GAEhB,MAAM,iBAAiB,CAAC;AAEzB,sBAAsB;AACtB,OAAO,EACL,cAAc,EACd,eAAe,EACf,SAAS,EACT,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,aAAa,GAgBd,MAAM,WAAW,CAAC"}
@@ -0,0 +1,15 @@
1
+ /** Reading unknown JSON without pretending it is typed. Nothing here knows what a flow is. */
2
+ export type Rec = Record<string, unknown>;
3
+ export interface Step {
4
+ id: string;
5
+ type: string;
6
+ title?: string;
7
+ description?: string;
8
+ settings?: Rec;
9
+ config: Rec;
10
+ }
11
+ export declare function asRec(value: unknown): Rec;
12
+ export declare function asArray(value: unknown): unknown[];
13
+ export declare function asSteps(value: unknown): Step[];
14
+ export declare function str(value: unknown): string | undefined;
15
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/conversational-flow/json.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAE9F,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,MAAM,EAAE,GAAG,CAAC;CACb;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,GAAG,CAEzC;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE,CAEjD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,EAAE,CAI9C;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAEtD"}
@@ -0,0 +1,14 @@
1
+ /** Reading unknown JSON without pretending it is typed. Nothing here knows what a flow is. */
2
+ export function asRec(value) {
3
+ return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
4
+ }
5
+ export function asArray(value) {
6
+ return Array.isArray(value) ? value : [];
7
+ }
8
+ export function asSteps(value) {
9
+ return asArray(value).filter((s) => !!s && typeof s === 'object' && typeof s['id'] === 'string' && typeof s['type'] === 'string');
10
+ }
11
+ export function str(value) {
12
+ return typeof value === 'string' && value !== '' ? value : undefined;
13
+ }
14
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/conversational-flow/json.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAa9F,MAAM,UAAU,KAAK,CAAC,KAAc;IAClC,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,KAAa,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3F,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,KAAc;IACpC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,KAAc;IACpC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAC1B,CAAC,CAAC,EAAa,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAQ,CAAS,CAAC,IAAI,CAAC,KAAK,QAAQ,IAAI,OAAQ,CAAS,CAAC,MAAM,CAAC,KAAK,QAAQ,CACjI,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,KAAc;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvE,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Aiming every jump at the frame it belongs to.
3
+ *
4
+ * A jump names the cycle that catches it, and the engine unwinds everything
5
+ * inside that cycle on the way. So the frame a jump names decides what survives
6
+ * the move: name the section and its call is still in scope on the other side;
7
+ * name the conversation and the section is left behind, to be entered again —
8
+ * and fetched again — next time.
9
+ *
10
+ * The rule is one line: **the innermost frame that holds both ends**. Moving to
11
+ * a sibling stays in the section; moving across the tree goes out to the
12
+ * conversation; a Finish always ends the conversation.
13
+ *
14
+ * An answer that is carried on rather than named — a pick, a router's class —
15
+ * can land in several frames, so it is split: one test per frame, deepest
16
+ * first, all carrying the same answer. That is still one destination, written
17
+ * as several jumps, and `prompt.ts` reads it back as one.
18
+ */
19
+ import type { WorkflowConfig } from '../types/workflow-config.js';
20
+ import type { ConversationalFlow } from './types.js';
21
+ export declare function writeJumps(config: WorkflowConfig, flow: ConversationalFlow): void;
22
+ //# sourceMappingURL=jumps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jumps.d.ts","sourceRoot":"","sources":["../../src/conversational-flow/jumps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAIlE,OAAO,KAAK,EAAE,kBAAkB,EAAU,MAAM,YAAY,CAAC;AAK7D,wBAAgB,UAAU,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,kBAAkB,GAAG,IAAI,CAiBjF"}
@@ -0,0 +1,160 @@
1
+ import { asArray, asRec, asSteps, str } from './json.js';
2
+ import { caseFor, commonFrame, sectionCaseFor } from './locate.js';
3
+ import { isCycle, jumpsIn } from './shape.js';
4
+ /** `{{steps.<id>.output…}}` — an answer carried on rather than named. */
5
+ const FROM_STEP = /^\{\{\s*steps\.([^.\s}]+)\.output\b/;
6
+ export function writeJumps(config, flow) {
7
+ const byId = new Map(flow.screens.map((s) => [s.id, s]));
8
+ for (const screen of flow.screens) {
9
+ const entry = caseFor(config, flow, screen);
10
+ if (entry)
11
+ entry['steps'] = aimAll(asArray(entry['steps']), { from: screen, frames: screen.frames, flow, byId });
12
+ // What a section fetches sits outside its own cycle, so a jump from there —
13
+ // a failed call's way out — is enclosed by one frame fewer.
14
+ if (screen.children.length === 0)
15
+ continue;
16
+ const section = sectionCaseFor(config, flow, screen);
17
+ if (!section)
18
+ continue;
19
+ const steps = asArray(section['steps']);
20
+ const at = steps.findIndex((step) => isCycle(asStep(step)));
21
+ if (at < 0)
22
+ continue;
23
+ const outside = { from: screen, frames: screen.frames.slice(0, -1), flow, byId };
24
+ section['steps'] = [...aimAll(steps.slice(0, at), outside), ...steps.slice(at)];
25
+ }
26
+ }
27
+ /** Every jump in a run of steps, however deeply branched, aimed. */
28
+ function aimAll(steps, at) {
29
+ return steps.flatMap((raw) => {
30
+ const step = asStep(raw);
31
+ if (!step)
32
+ return [raw];
33
+ if (step.type === 'GO_TO')
34
+ return aim(step, at);
35
+ // A split is derived, so it is taken apart and rebuilt rather than added to
36
+ // — otherwise settling twice would split what was already split.
37
+ const whole = collapse(step, at.flow.routeKey);
38
+ if (whole)
39
+ return aim(whole, at);
40
+ if (step.type === 'FINISH') {
41
+ // A Finish ends the conversation, so it names the conversation's own cycle.
42
+ step.config['target'] = at.flow.rootScreen;
43
+ return [step];
44
+ }
45
+ for (const [key, value] of Object.entries(step.config)) {
46
+ if (!Array.isArray(value))
47
+ continue;
48
+ // A switch's cases hold steps of their own; everything else is a branch.
49
+ if (value.some((item) => asRec(item)['steps'] !== undefined)) {
50
+ step.config[key] = value.map((item) => {
51
+ const entry = asRec(item);
52
+ return entry['steps'] === undefined ? item : { ...entry, steps: aimAll(asArray(entry['steps']), at) };
53
+ });
54
+ }
55
+ else {
56
+ step.config[key] = aimAll(value, at);
57
+ }
58
+ }
59
+ return [step];
60
+ });
61
+ }
62
+ /** One jump: named destination, or an answer that could land in several frames. */
63
+ function aim(step, at) {
64
+ const carried = asRec(step.config['with']);
65
+ const going = carried[at.flow.routeKey];
66
+ if (typeof going !== 'string' || going === '')
67
+ return [step];
68
+ if (!going.includes('{{')) {
69
+ step.config['target'] = frameFor(going, at);
70
+ return [step];
71
+ }
72
+ const groups = new Map();
73
+ for (const screen of candidates(going, at)) {
74
+ const frame = frameFor(screen, at);
75
+ groups.set(frame, [...(groups.get(frame) ?? []), screen]);
76
+ }
77
+ if (groups.size <= 1) {
78
+ step.config['target'] = [...groups.keys()][0] ?? at.flow.rootScreen;
79
+ return [step];
80
+ }
81
+ return [split(step, going, groups, at)];
82
+ }
83
+ /**
84
+ * A split read back as the one jump it was: every branch carries the same
85
+ * answer, and the fall-through is the jump the author's edit produced, id and
86
+ * all.
87
+ */
88
+ function collapse(step, routeKey) {
89
+ if (step.type !== 'CONDITIONAL')
90
+ return undefined;
91
+ const jumps = jumpsIn([step]);
92
+ if (jumps.length < 2)
93
+ return undefined;
94
+ const carried = new Set(jumps.map((jump) => String(asRec(jump.config['with'])[routeKey])));
95
+ if (carried.size !== 1)
96
+ return undefined;
97
+ let node = step;
98
+ while (node.type === 'CONDITIONAL') {
99
+ const next = asSteps(asRec(node.config)['if_false'])[0];
100
+ if (!next)
101
+ return undefined;
102
+ node = next;
103
+ }
104
+ return node.type === 'GO_TO' ? node : undefined;
105
+ }
106
+ /**
107
+ * The same jump, tested by where the answer goes: the deepest frame first, so a
108
+ * move that can stay inside a section does, and the outermost is the fall
109
+ * through.
110
+ */
111
+ function split(step, going, groups, at) {
112
+ const depth = (frame) => at.byId.get(frame)?.frames.length ?? 0;
113
+ const ordered = [...groups].sort((a, b) => depth(b[0]) - depth(a[0]));
114
+ const [outermost, ...inner] = [...ordered].reverse();
115
+ let node = { ...step, config: { ...step.config, target: outermost[0] } };
116
+ for (const [frame, screens] of inner) {
117
+ node = {
118
+ id: `${step.id}__at_${frame}`,
119
+ type: 'CONDITIONAL',
120
+ config: {
121
+ condition: { any: screens.map((screen) => ({ variable: going, operator: 'eq', value: screen })) },
122
+ if_true: [{ ...step, id: `${step.id}__in_${frame}`, config: { ...step.config, target: frame } }],
123
+ if_false: [node],
124
+ },
125
+ };
126
+ }
127
+ return node;
128
+ }
129
+ /** The frame a jump from `from` to `screen` belongs in. */
130
+ function frameFor(screen, at) {
131
+ const to = at.byId.get(screen);
132
+ return to ? commonFrame(at.frames, to.frames) : at.flow.rootScreen;
133
+ }
134
+ /**
135
+ * Where a carried answer could land: the options of the question it came from,
136
+ * or the screens the router that produced it may choose. Anything else could go
137
+ * anywhere, so it goes to the conversation.
138
+ */
139
+ function candidates(going, at) {
140
+ const source = FROM_STEP.exec(going)?.[1];
141
+ if (!source)
142
+ return [];
143
+ const known = (ids) => ids.filter((id) => at.byId.has(id));
144
+ for (const screen of at.flow.screens) {
145
+ for (const prompt of screen.prompts) {
146
+ if (prompt.id === source)
147
+ return known(prompt.options.map((o) => o.value));
148
+ }
149
+ if (screen.router?.stepId === source)
150
+ return known(screen.router.candidates);
151
+ if (screen.askAi?.stepId === source)
152
+ return known(screen.askAi.exits.map((o) => o.value));
153
+ }
154
+ return [];
155
+ }
156
+ function asStep(value) {
157
+ const rec = asRec(value);
158
+ return str(rec['id']) && str(rec['type']) ? rec : undefined;
159
+ }
160
+ //# sourceMappingURL=jumps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jumps.js","sourceRoot":"","sources":["../../src/conversational-flow/jumps.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,OAAO,EAAE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AAG,CAAC,GAAa,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAErE,KAAK,MAAM,MAAM,IAAI,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACrC,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACpC,IAAI,MAAM,CAAC,EAAE,KAAK,MAAM;gBAAE,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7E,CAAC;QACD,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM;YAAE,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC7E,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM;YAAE,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5F,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,MAAM,CAAC,KAAc;IAC5B,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IACzB,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAE,GAAuB,CAAC,CAAC,CAAC,SAAS,CAAC;AACnF,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Finding a screen's case in the config, by the frames it sits inside.
3
+ *
4
+ * `screen.frames` is the path of cycles around it, so walking those cycles is
5
+ * the whole of it — no searching, and no id conventions.
6
+ */
7
+ import type { WorkflowConfig } from '../types/workflow-config.js';
8
+ import { type Rec, type Step } from './json.js';
9
+ import type { ConversationalFlow, Screen } from './types.js';
10
+ /** The cycle the conversation itself is. */
11
+ export declare function rootCycle(config: WorkflowConfig): Step | undefined;
12
+ /** The cycle named by the last of `frames`, walking down from the conversation. */
13
+ export declare function cycleAt(config: WorkflowConfig, frames: readonly string[], routeKey: string): Step | undefined;
14
+ /** The case that holds one screen: its steps are what that screen is. */
15
+ export declare function caseFor(config: WorkflowConfig, flow: ConversationalFlow, screen: Screen): Rec | undefined;
16
+ /**
17
+ * The case that holds a section: its condition is the section's subtree, and
18
+ * its steps are the section's calls and its cycle. It sits in the switch of the
19
+ * frame above, which is where a section is reached from.
20
+ */
21
+ export declare function sectionCaseFor(config: WorkflowConfig, flow: ConversationalFlow, screen: Screen): Rec | undefined;
22
+ /**
23
+ * The innermost frame that holds both ends — where a jump between them
24
+ * belongs, so that leaving one does not unwind more than it has to.
25
+ *
26
+ * Takes frame paths rather than screens, because a call on a section sits
27
+ * outside that section's own cycle and so is enclosed by one frame fewer.
28
+ */
29
+ export declare function commonFrame(from: readonly string[], to: readonly string[]): string;
30
+ //# sourceMappingURL=locate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locate.d.ts","sourceRoot":"","sources":["../../src/conversational-flow/locate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAW,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAE7D,4CAA4C;AAC5C,wBAAgB,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,CAElE;AAED,mFAAmF;AACnF,wBAAgB,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAc7G;AAED,yEAAyE;AACzE,wBAAgB,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CASzG;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAUhH;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAOlF"}