@xyne/workflow-sdk 3.2.53 → 3.2.55

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 (275) hide show
  1. package/dist/agents/host-agent-step.d.ts.map +1 -1
  2. package/dist/agents/host-agent-step.js +3 -0
  3. package/dist/agents/host-agent-step.js.map +1 -1
  4. package/dist/builder/index.d.ts +19 -2
  5. package/dist/builder/index.d.ts.map +1 -1
  6. package/dist/builder/index.js +17 -1
  7. package/dist/builder/index.js.map +1 -1
  8. package/dist/common/attachment.d.ts +9 -0
  9. package/dist/common/attachment.d.ts.map +1 -1
  10. package/dist/common/attachment.js +20 -0
  11. package/dist/common/attachment.js.map +1 -1
  12. package/dist/common/citation-ref.d.ts +4 -4
  13. package/dist/completion/address.d.ts +27 -0
  14. package/dist/completion/address.d.ts.map +1 -0
  15. package/dist/completion/address.js +62 -0
  16. package/dist/completion/address.js.map +1 -0
  17. package/dist/completion/attach.d.ts +32 -0
  18. package/dist/completion/attach.d.ts.map +1 -0
  19. package/dist/completion/attach.js +92 -0
  20. package/dist/completion/attach.js.map +1 -0
  21. package/dist/completion/index.d.ts +6 -0
  22. package/dist/completion/index.d.ts.map +1 -0
  23. package/dist/completion/index.js +4 -0
  24. package/dist/completion/index.js.map +1 -0
  25. package/dist/completion/types.d.ts +107 -0
  26. package/dist/completion/types.d.ts.map +1 -0
  27. package/dist/completion/types.js +35 -0
  28. package/dist/completion/types.js.map +1 -0
  29. package/dist/connectors/builtin/builtin-connector.d.ts.map +1 -1
  30. package/dist/connectors/builtin/builtin-connector.js +6 -2
  31. package/dist/connectors/builtin/builtin-connector.js.map +1 -1
  32. package/dist/connectors/builtin/steps/compute.step.d.ts +56 -0
  33. package/dist/connectors/builtin/steps/compute.step.d.ts.map +1 -0
  34. package/dist/connectors/builtin/steps/compute.step.js +48 -0
  35. package/dist/connectors/builtin/steps/compute.step.js.map +1 -0
  36. package/dist/connectors/builtin/steps/conditional.step.d.ts +2 -2
  37. package/dist/connectors/builtin/steps/conditional.step.js +1 -1
  38. package/dist/connectors/builtin/steps/conditional.step.js.map +1 -1
  39. package/dist/connectors/builtin/steps/cycle.step.d.ts +36 -7
  40. package/dist/connectors/builtin/steps/cycle.step.d.ts.map +1 -1
  41. package/dist/connectors/builtin/steps/cycle.step.js +89 -8
  42. package/dist/connectors/builtin/steps/cycle.step.js.map +1 -1
  43. package/dist/connectors/builtin/steps/dedup.step.js +2 -2
  44. package/dist/connectors/builtin/steps/dedup.step.js.map +1 -1
  45. package/dist/connectors/builtin/steps/delay.step.d.ts +49 -0
  46. package/dist/connectors/builtin/steps/delay.step.d.ts.map +1 -0
  47. package/dist/connectors/builtin/steps/delay.step.js +40 -0
  48. package/dist/connectors/builtin/steps/delay.step.js.map +1 -0
  49. package/dist/connectors/builtin/steps/loop.step.d.ts +6 -6
  50. package/dist/connectors/builtin/steps/loop.step.d.ts.map +1 -1
  51. package/dist/connectors/builtin/steps/loop.step.js +4 -2
  52. package/dist/connectors/builtin/steps/loop.step.js.map +1 -1
  53. package/dist/connectors/builtin/steps/map.step.d.ts +4 -4
  54. package/dist/connectors/builtin/steps/map.step.d.ts.map +1 -1
  55. package/dist/connectors/builtin/steps/map.step.js +13 -4
  56. package/dist/connectors/builtin/steps/map.step.js.map +1 -1
  57. package/dist/connectors/builtin/steps/parallel.step.d.ts +2 -2
  58. package/dist/connectors/builtin/steps/parallel.step.d.ts.map +1 -1
  59. package/dist/connectors/builtin/steps/parallel.step.js +9 -2
  60. package/dist/connectors/builtin/steps/parallel.step.js.map +1 -1
  61. package/dist/connectors/builtin/steps/switch.step.js +1 -1
  62. package/dist/connectors/builtin/steps/switch.step.js.map +1 -1
  63. package/dist/connectors/builtin/steps/wait-for-api-call.step.d.ts +80 -0
  64. package/dist/connectors/builtin/steps/wait-for-api-call.step.d.ts.map +1 -0
  65. package/dist/connectors/builtin/steps/wait-for-api-call.step.js +104 -0
  66. package/dist/connectors/builtin/steps/wait-for-api-call.step.js.map +1 -0
  67. package/dist/connectors/builtin/steps/wait-for-human.step.d.ts +1057 -0
  68. package/dist/connectors/builtin/steps/wait-for-human.step.d.ts.map +1 -0
  69. package/dist/connectors/builtin/steps/wait-for-human.step.js +222 -0
  70. package/dist/connectors/builtin/steps/wait-for-human.step.js.map +1 -0
  71. package/dist/connectors/builtin/steps/wait-for-webhook.step.d.ts +80 -0
  72. package/dist/connectors/builtin/steps/wait-for-webhook.step.d.ts.map +1 -0
  73. package/dist/connectors/builtin/steps/wait-for-webhook.step.js +104 -0
  74. package/dist/connectors/builtin/steps/wait-for-webhook.step.js.map +1 -0
  75. package/dist/connectors/builtin/steps/wait.step.d.ts +40 -59
  76. package/dist/connectors/builtin/steps/wait.step.d.ts.map +1 -1
  77. package/dist/connectors/builtin/steps/wait.step.js +29 -63
  78. package/dist/connectors/builtin/steps/wait.step.js.map +1 -1
  79. package/dist/conversational-flow/calls.d.ts +2 -2
  80. package/dist/conversational-flow/calls.d.ts.map +1 -1
  81. package/dist/conversational-flow/calls.js +40 -5
  82. package/dist/conversational-flow/calls.js.map +1 -1
  83. package/dist/conversational-flow/create.d.ts +2 -1
  84. package/dist/conversational-flow/create.d.ts.map +1 -1
  85. package/dist/conversational-flow/create.js +2 -2
  86. package/dist/conversational-flow/create.js.map +1 -1
  87. package/dist/conversational-flow/edit/build.js +1 -1
  88. package/dist/conversational-flow/edit/build.js.map +1 -1
  89. package/dist/conversational-flow/edit/calls.d.ts.map +1 -1
  90. package/dist/conversational-flow/edit/calls.js +8 -5
  91. package/dist/conversational-flow/edit/calls.js.map +1 -1
  92. package/dist/conversational-flow/edit/endings.d.ts +8 -3
  93. package/dist/conversational-flow/edit/endings.d.ts.map +1 -1
  94. package/dist/conversational-flow/edit/endings.js +17 -9
  95. package/dist/conversational-flow/edit/endings.js.map +1 -1
  96. package/dist/conversational-flow/edit/questions.d.ts +35 -0
  97. package/dist/conversational-flow/edit/questions.d.ts.map +1 -0
  98. package/dist/conversational-flow/edit/questions.js +188 -0
  99. package/dist/conversational-flow/edit/questions.js.map +1 -0
  100. package/dist/conversational-flow/edit/versions.d.ts.map +1 -1
  101. package/dist/conversational-flow/edit/versions.js +6 -7
  102. package/dist/conversational-flow/edit/versions.js.map +1 -1
  103. package/dist/conversational-flow/index.d.ts +2 -1
  104. package/dist/conversational-flow/index.d.ts.map +1 -1
  105. package/dist/conversational-flow/index.js +4 -0
  106. package/dist/conversational-flow/index.js.map +1 -1
  107. package/dist/conversational-flow/questions.d.ts +32 -0
  108. package/dist/conversational-flow/questions.d.ts.map +1 -0
  109. package/dist/conversational-flow/questions.js +122 -0
  110. package/dist/conversational-flow/questions.js.map +1 -0
  111. package/dist/conversational-flow/read.d.ts.map +1 -1
  112. package/dist/conversational-flow/read.js +20 -4
  113. package/dist/conversational-flow/read.js.map +1 -1
  114. package/dist/conversational-flow/settle.js +4 -7
  115. package/dist/conversational-flow/settle.js.map +1 -1
  116. package/dist/conversational-flow/types.d.ts +31 -8
  117. package/dist/conversational-flow/types.d.ts.map +1 -1
  118. package/dist/conversational-flow/types.js.map +1 -1
  119. package/dist/engine/condition-evaluator.d.ts +10 -2
  120. package/dist/engine/condition-evaluator.d.ts.map +1 -1
  121. package/dist/engine/condition-evaluator.js +36 -14
  122. package/dist/engine/condition-evaluator.js.map +1 -1
  123. package/dist/engine/config-validator.d.ts +64 -0
  124. package/dist/engine/config-validator.d.ts.map +1 -1
  125. package/dist/engine/config-validator.js +400 -30
  126. package/dist/engine/config-validator.js.map +1 -1
  127. package/dist/engine/pause-step.d.ts +21 -4
  128. package/dist/engine/pause-step.d.ts.map +1 -1
  129. package/dist/engine/pause-step.js +11 -2
  130. package/dist/engine/pause-step.js.map +1 -1
  131. package/dist/engine/read-config.d.ts +12 -0
  132. package/dist/engine/read-config.d.ts.map +1 -0
  133. package/dist/engine/read-config.js +50 -0
  134. package/dist/engine/read-config.js.map +1 -0
  135. package/dist/engine/resolve-expressions.d.ts +40 -0
  136. package/dist/engine/resolve-expressions.d.ts.map +1 -0
  137. package/dist/engine/resolve-expressions.js +186 -0
  138. package/dist/engine/resolve-expressions.js.map +1 -0
  139. package/dist/engine/variable-resolver.d.ts +27 -0
  140. package/dist/engine/variable-resolver.d.ts.map +1 -1
  141. package/dist/engine/variable-resolver.js +20 -3
  142. package/dist/engine/variable-resolver.js.map +1 -1
  143. package/dist/engine/workflow-executor.d.ts.map +1 -1
  144. package/dist/engine/workflow-executor.js +66 -56
  145. package/dist/engine/workflow-executor.js.map +1 -1
  146. package/dist/expression/catalogue.d.ts +36 -0
  147. package/dist/expression/catalogue.d.ts.map +1 -0
  148. package/dist/expression/catalogue.js +82 -0
  149. package/dist/expression/catalogue.js.map +1 -0
  150. package/dist/expression/form/model.d.ts +115 -0
  151. package/dist/expression/form/model.d.ts.map +1 -0
  152. package/dist/expression/form/model.js +61 -0
  153. package/dist/expression/form/model.js.map +1 -0
  154. package/dist/expression/form/read.d.ts +4 -0
  155. package/dist/expression/form/read.d.ts.map +1 -0
  156. package/dist/expression/form/read.js +283 -0
  157. package/dist/expression/form/read.js.map +1 -0
  158. package/dist/expression/form/write.d.ts +8 -0
  159. package/dist/expression/form/write.d.ts.map +1 -0
  160. package/dist/expression/form/write.js +124 -0
  161. package/dist/expression/form/write.js.map +1 -0
  162. package/dist/expression/format.d.ts +41 -0
  163. package/dist/expression/format.d.ts.map +1 -0
  164. package/dist/expression/format.js +84 -0
  165. package/dist/expression/format.js.map +1 -0
  166. package/dist/expression/index.d.ts +40 -0
  167. package/dist/expression/index.d.ts.map +1 -0
  168. package/dist/expression/index.js +35 -0
  169. package/dist/expression/index.js.map +1 -0
  170. package/dist/expression/infer.d.ts +40 -0
  171. package/dist/expression/infer.d.ts.map +1 -0
  172. package/dist/expression/infer.js +195 -0
  173. package/dist/expression/infer.js.map +1 -0
  174. package/dist/expression/parse.d.ts +60 -0
  175. package/dist/expression/parse.d.ts.map +1 -0
  176. package/dist/expression/parse.js +201 -0
  177. package/dist/expression/parse.js.map +1 -0
  178. package/dist/expression/signature.d.ts +41 -0
  179. package/dist/expression/signature.d.ts.map +1 -0
  180. package/dist/expression/signature.js +124 -0
  181. package/dist/expression/signature.js.map +1 -0
  182. package/dist/expression/signatures.d.ts +45 -0
  183. package/dist/expression/signatures.d.ts.map +1 -0
  184. package/dist/expression/signatures.js +113 -0
  185. package/dist/expression/signatures.js.map +1 -0
  186. package/dist/expression/types.d.ts +71 -0
  187. package/dist/expression/types.d.ts.map +1 -0
  188. package/dist/expression/types.js +139 -0
  189. package/dist/expression/types.js.map +1 -0
  190. package/dist/index.d.ts +32 -7
  191. package/dist/index.d.ts.map +1 -1
  192. package/dist/index.js +27 -3
  193. package/dist/index.js.map +1 -1
  194. package/dist/ingest/filter.d.ts +8 -2
  195. package/dist/ingest/filter.d.ts.map +1 -1
  196. package/dist/ingest/filter.js +8 -2
  197. package/dist/ingest/filter.js.map +1 -1
  198. package/dist/ingest/start-policy.d.ts +1 -1
  199. package/dist/ingest/start-policy.d.ts.map +1 -1
  200. package/dist/ingest/start-policy.js +12 -5
  201. package/dist/ingest/start-policy.js.map +1 -1
  202. package/dist/persistence/in-memory-adapter.d.ts +3 -18
  203. package/dist/persistence/in-memory-adapter.d.ts.map +1 -1
  204. package/dist/persistence/in-memory-adapter.js +9 -61
  205. package/dist/persistence/in-memory-adapter.js.map +1 -1
  206. package/dist/persistence/types.d.ts +29 -58
  207. package/dist/persistence/types.d.ts.map +1 -1
  208. package/dist/router/workflow-router.d.ts.map +1 -1
  209. package/dist/router/workflow-router.js +70 -28
  210. package/dist/router/workflow-router.js.map +1 -1
  211. package/dist/runtime/workflow-runtime.d.ts +22 -45
  212. package/dist/runtime/workflow-runtime.d.ts.map +1 -1
  213. package/dist/runtime/workflow-runtime.js +157 -125
  214. package/dist/runtime/workflow-runtime.js.map +1 -1
  215. package/dist/steps/base-step.d.ts +2 -4
  216. package/dist/steps/base-step.d.ts.map +1 -1
  217. package/dist/steps/base-step.js.map +1 -1
  218. package/dist/testing/test-connector.d.ts +1 -1
  219. package/dist/testing/test-connector.js +1 -1
  220. package/dist/types/index.d.ts +2 -2
  221. package/dist/types/index.d.ts.map +1 -1
  222. package/dist/types/index.js +1 -1
  223. package/dist/types/index.js.map +1 -1
  224. package/dist/types/known-types.d.ts +51 -1
  225. package/dist/types/known-types.d.ts.map +1 -1
  226. package/dist/types/known-types.js +54 -1
  227. package/dist/types/known-types.js.map +1 -1
  228. package/dist/types/operators.d.ts +22 -0
  229. package/dist/types/operators.d.ts.map +1 -1
  230. package/dist/types/operators.js +6 -6
  231. package/dist/types/operators.js.map +1 -1
  232. package/dist/types/pause-state.d.ts +0 -8
  233. package/dist/types/pause-state.d.ts.map +1 -1
  234. package/dist/types/pause-state.js.map +1 -1
  235. package/dist/types/validation.d.ts +10 -1
  236. package/dist/types/validation.d.ts.map +1 -1
  237. package/dist/types/validation.js +9 -0
  238. package/dist/types/validation.js.map +1 -1
  239. package/dist/types/workflow-config.d.ts +4 -3
  240. package/dist/types/workflow-config.d.ts.map +1 -1
  241. package/dist/types/workflow-config.js +23 -8
  242. package/dist/types/workflow-config.js.map +1 -1
  243. package/dist/util/computed-value.d.ts +103 -0
  244. package/dist/util/computed-value.d.ts.map +1 -0
  245. package/dist/util/computed-value.js +453 -0
  246. package/dist/util/computed-value.js.map +1 -0
  247. package/dist/util/expression-format.d.ts +41 -0
  248. package/dist/util/expression-format.d.ts.map +1 -0
  249. package/dist/util/expression-format.js +84 -0
  250. package/dist/util/expression-format.js.map +1 -0
  251. package/dist/util/expression-functions.d.ts +35 -0
  252. package/dist/util/expression-functions.d.ts.map +1 -0
  253. package/dist/util/expression-functions.js +82 -0
  254. package/dist/util/expression-functions.js.map +1 -0
  255. package/dist/util/expression.d.ts +98 -0
  256. package/dist/util/expression.d.ts.map +1 -0
  257. package/dist/util/expression.js +395 -0
  258. package/dist/util/expression.js.map +1 -0
  259. package/dist/util/jsonata-signatures.d.ts +45 -0
  260. package/dist/util/jsonata-signatures.d.ts.map +1 -0
  261. package/dist/util/jsonata-signatures.js +113 -0
  262. package/dist/util/jsonata-signatures.js.map +1 -0
  263. package/dist/util/signature.d.ts +41 -0
  264. package/dist/util/signature.d.ts.map +1 -0
  265. package/dist/util/signature.js +124 -0
  266. package/dist/util/signature.js.map +1 -0
  267. package/dist/util/type-compat.d.ts +8 -28
  268. package/dist/util/type-compat.d.ts.map +1 -1
  269. package/dist/util/type-compat.js +22 -29
  270. package/dist/util/type-compat.js.map +1 -1
  271. package/dist/util/variable-ref.d.ts +24 -0
  272. package/dist/util/variable-ref.d.ts.map +1 -1
  273. package/dist/util/variable-ref.js +34 -9
  274. package/dist/util/variable-ref.js.map +1 -1
  275. package/package.json +6 -1
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Continuing a run from outside — the inbound half of what `ingest/` does for
3
+ * starting one.
4
+ *
5
+ * The SDK names no URL and authenticates nobody: a host authenticates the
6
+ * caller with its own middleware, then calls `runtime.deliver`. What arrives is
7
+ * a {@link Delivery}; what the engine did with it is a {@link DeliveryOutcome},
8
+ * which the host maps to a status code. The outcomes are data rather than
9
+ * thrown messages because a machine caller has to decide from the answer
10
+ * whether to retry, stop, or fix its body.
11
+ */
12
+ import type { PayloadError } from '../common/validate-payload.js';
13
+ /** Which parked node a delivery is for. */
14
+ export interface Address {
15
+ readonly executionId: string;
16
+ /**
17
+ * The author's own step id, as written in the config — unique across a
18
+ * workflow, and stable across runs, which is why it can go in a URL at
19
+ * authoring time when no execution exists yet.
20
+ */
21
+ readonly stepId: string;
22
+ /**
23
+ * The exact node, for a step id with more than one parked instance. The
24
+ * engine resolves it from `stepId` whenever that is unambiguous, so a caller
25
+ * only needs it for a fan-out.
26
+ */
27
+ readonly nodePath?: string;
28
+ /**
29
+ * Which attempt of the gate this answers. A gate that re-parks — an agent
30
+ * re-dispatch, another round of a cycle — carries one, and a stale answer to
31
+ * the attempt before is superseded rather than applied.
32
+ */
33
+ readonly fence?: number;
34
+ }
35
+ /**
36
+ * One file part of a multipart delivery, as the host's parser produced it.
37
+ *
38
+ * Raw bytes rather than an {@link Address}-style reference: the engine stores
39
+ * them, because only it knows the run's storage scope and the gate's contract —
40
+ * and only after it has decided the delivery is worth keeping, so a sender's
41
+ * retry cannot leave orphaned blobs behind.
42
+ */
43
+ export interface DeliveryFile {
44
+ /** The multipart field name — which key of the payload this file belongs to. */
45
+ readonly fieldName: string;
46
+ readonly name: string;
47
+ readonly mimeType: string;
48
+ readonly bytes: Uint8Array;
49
+ }
50
+ /** What the outside world reported. */
51
+ export interface Delivery {
52
+ /**
53
+ * The body, or a multipart request's text fields. File parts come separately
54
+ * in {@link files}, because they are not payload until they are stored.
55
+ */
56
+ readonly payload: unknown;
57
+ /**
58
+ * Uploaded files, merged into the payload under their field names once
59
+ * stored. Needs a StorageAdapter on the runtime.
60
+ */
61
+ readonly files?: readonly DeliveryFile[];
62
+ /**
63
+ * How {@link payload} was encoded. `multipart` means every field arrived as
64
+ * text whatever it represents, so the engine re-reads each against the gate's
65
+ * contract; `json` (the default) means it is already typed and is left alone.
66
+ *
67
+ * The distinction matters because one URL takes both: without it the same
68
+ * contract would hand a step `"7003"` from one sender and `7003` from the
69
+ * other, and nothing downstream would catch it.
70
+ */
71
+ readonly encoding?: 'json' | 'multipart';
72
+ /**
73
+ * The sender's id for this delivery. A repeat of one already applied is a
74
+ * duplicate rather than an error, which is what makes `curl --retry` safe.
75
+ */
76
+ readonly deliveryId?: string;
77
+ }
78
+ /**
79
+ * What the engine did. `ignored` means the delivery was understood and
80
+ * deliberately dropped — the sender should stop, not retry.
81
+ */
82
+ export type DeliveryOutcome = {
83
+ readonly kind: 'applied';
84
+ readonly nodePath: string;
85
+ } | {
86
+ readonly kind: 'ignored';
87
+ readonly reason: 'duplicate' | 'already_answered' | 'superseded' | 'run_ended';
88
+ } | {
89
+ readonly kind: 'unknown';
90
+ } | {
91
+ readonly kind: 'not_ready';
92
+ } | {
93
+ readonly kind: 'ambiguous';
94
+ readonly nodePaths: readonly string[];
95
+ } | {
96
+ readonly kind: 'invalid';
97
+ readonly issues: readonly PayloadError[];
98
+ };
99
+ /**
100
+ * The status a host should answer with. A recommendation, not a rule — the host
101
+ * owns its API.
102
+ *
103
+ * `ignored` answers 2xx on purpose: a non-2xx makes a sender's recovery worker
104
+ * redeliver a payload we dropped deliberately.
105
+ */
106
+ export declare function httpStatusFor(outcome: DeliveryOutcome): number;
107
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/completion/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,2CAA2C;AAC3C,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,gFAAgF;IAChF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;CAC5B;AAED,uCAAuC;AACvC,MAAM,WAAW,QAAQ;IACvB;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IACzC;;;;;;;;OAQG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACvD;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,kBAAkB,GAAG,YAAY,GAAG,WAAW,CAAC;CAChF,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GAC9B;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GACrE;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;CAAE,CAAC;AAE3E;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAe9D"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Continuing a run from outside — the inbound half of what `ingest/` does for
3
+ * starting one.
4
+ *
5
+ * The SDK names no URL and authenticates nobody: a host authenticates the
6
+ * caller with its own middleware, then calls `runtime.deliver`. What arrives is
7
+ * a {@link Delivery}; what the engine did with it is a {@link DeliveryOutcome},
8
+ * which the host maps to a status code. The outcomes are data rather than
9
+ * thrown messages because a machine caller has to decide from the answer
10
+ * whether to retry, stop, or fix its body.
11
+ */
12
+ /**
13
+ * The status a host should answer with. A recommendation, not a rule — the host
14
+ * owns its API.
15
+ *
16
+ * `ignored` answers 2xx on purpose: a non-2xx makes a sender's recovery worker
17
+ * redeliver a payload we dropped deliberately.
18
+ */
19
+ export function httpStatusFor(outcome) {
20
+ switch (outcome.kind) {
21
+ case 'applied':
22
+ return 202;
23
+ case 'ignored':
24
+ return 200;
25
+ case 'not_ready':
26
+ return 409;
27
+ case 'ambiguous':
28
+ return 400;
29
+ case 'invalid':
30
+ return 422;
31
+ case 'unknown':
32
+ return 404;
33
+ }
34
+ }
35
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/completion/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAuFH;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,OAAwB;IACpD,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC;QACb,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC;QACb,KAAK,WAAW;YACd,OAAO,GAAG,CAAC;QACb,KAAK,WAAW;YACd,OAAO,GAAG,CAAC;QACb,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC;QACb,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"builtin-connector.d.ts","sourceRoot":"","sources":["../../../src/connectors/builtin/builtin-connector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAsBnE,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,SAAkB,EAAE,aAAa;IACjC,SAAkB,OAAO,WAAW;IACpC,SAAkB,IAAI,cAAc;IACpC,SAAkB,WAAW,mGACgE;IAC7F,SAAkB,IAAI,YAAY;IAIlC,iGAAiG;IACjG,SAAkB,WAAW,EAAE,SAAS,oBAAoB,EAAE,CAE5D;IAEF;;;;OAIG;IACH,SAAkB,KAAK,EAAE,SAAS,OAAO,EAAE,CAcxC;IAEH,SAAkB,QAAQ,EAAE,SAAS,UAAU,EAAE,CAK/C;CACH"}
1
+ {"version":3,"file":"builtin-connector.d.ts","sourceRoot":"","sources":["../../../src/connectors/builtin/builtin-connector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAwBnE,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,SAAkB,EAAE,aAAa;IACjC,SAAkB,OAAO,WAAW;IACpC,SAAkB,IAAI,cAAc;IACpC,SAAkB,WAAW,mGACgE;IAC7F,SAAkB,IAAI,YAAY;IAIlC,iGAAiG;IACjG,SAAkB,WAAW,EAAE,SAAS,oBAAoB,EAAE,CAE5D;IAEF;;;;OAIG;IACH,SAAkB,KAAK,EAAE,SAAS,OAAO,EAAE,CAgBxC;IAEH,SAAkB,QAAQ,EAAE,SAAS,UAAU,EAAE,CAK/C;CACH"}
@@ -25,7 +25,9 @@ import { MapStep } from './steps/map.step.js';
25
25
  import { ParallelStep } from './steps/parallel.step.js';
26
26
  import { CycleStep } from './steps/cycle.step.js';
27
27
  import { SwitchStep } from './steps/switch.step.js';
28
- import { WaitStep } from './steps/wait.step.js';
28
+ import { DelayStep } from './steps/delay.step.js';
29
+ import { WaitForWebhookStep } from './steps/wait-for-webhook.step.js';
30
+ import { WaitForHumanStep } from './steps/wait-for-human.step.js';
29
31
  import { DefaultManualTrigger } from './triggers/default-manual-trigger.js';
30
32
  import { DefaultEventTrigger } from './triggers/default-event-trigger.js';
31
33
  import { DefaultCronTrigger } from './triggers/default-cron-trigger.js';
@@ -58,7 +60,9 @@ export class BuiltinConnector extends BaseConnector {
58
60
  new ParallelStep(),
59
61
  new CycleStep(),
60
62
  new SwitchStep(),
61
- new WaitStep(),
63
+ new WaitForHumanStep(),
64
+ new WaitForWebhookStep(),
65
+ new DelayStep(),
62
66
  ]);
63
67
  triggers = [
64
68
  new DefaultManualTrigger(),
@@ -1 +1 @@
1
- {"version":3,"file":"builtin-connector.js","sourceRoot":"","sources":["../../../src/connectors/builtin/builtin-connector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA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ACrB,IAAI,QAAQ,EAAE;QACd,IAAI,SAAS,EAAE;QACf,IAAI,eAAe,EAAE;QACrB,IAAI,QAAQ,EAAE;QACd,IAAI,OAAO,EAAE;QACb,IAAI,YAAY,EAAE;QAClB,IAAI,SAAS,EAAE;QACf,IAAI,UAAU,EAAE;QAChB,IAAI,gBAAgB,EAAE;QACtB,IAAI,kBAAkB,EAAE;QACxB,IAAI,SAAS,EAAE;KAChB,CAAC,CAAC;IAEe,QAAQ,GAA0B;QAClD,IAAI,oBAAoB,EAAgB;QACxC,IAAI,mBAAmB,EAAgB;QACvC,IAAI,kBAAkB,EAAgB;QACtC,IAAI,uBAAuB,EAAgB;KAC5C,CAAC;CACH"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * COMPUTE — work a value out and give it a name.
3
+ *
4
+ * A screen fetches what it needs on the way in and then says something. Some of
5
+ * what it says is not in any answer: the sum of a fare breakdown, a count, a
6
+ * list written out line by line. This is where that lands, named, so the text
7
+ * can quote `{{steps.<id>.output.value}}` the same way it quotes a lookup's
8
+ * answer.
9
+ *
10
+ * ## Why it does almost nothing
11
+ *
12
+ * `value` is an ordinary bindable field, so by the time `execute` runs the
13
+ * engine has already resolved whatever was in it — a `{{ref}}`, a `{% … %}`
14
+ * expression, or plain text. There is nothing left to do but hand it back under
15
+ * a name. The step exists for the *name* and the *place in the sequence*, not
16
+ * for a computation of its own, and putting the evaluation here instead would
17
+ * mean a second expression engine beside the one every other field already uses.
18
+ */
19
+ import { z } from 'zod';
20
+ import { BaseActionStep } from '../../../steps/base-step.js';
21
+ import type { StepCategory } from '../../../types/categories.js';
22
+ import { BuiltinStepType } from '../../../types/known-types.js';
23
+ export declare const ComputeStepConfigSchema: z.ZodObject<{
24
+ value: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ value: string | number | boolean;
27
+ }, {
28
+ value: string | number | boolean;
29
+ }>;
30
+ export type ComputeStepConfig = z.infer<typeof ComputeStepConfigSchema>;
31
+ export declare class ComputeStep extends BaseActionStep<typeof ComputeStepConfigSchema, {
32
+ value: unknown;
33
+ }> {
34
+ readonly type = BuiltinStepType.COMPUTE;
35
+ readonly name = "Work out a value";
36
+ readonly description = "Works out one value and gives it a name, so later steps and anything a screen says can quote it as {{steps.<id>.output.value}}. Use it for a total, a count, or a list written out as text \u2014 anything that is not in an answer as it stands";
37
+ readonly configSchema: z.ZodObject<{
38
+ value: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ value: string | number | boolean;
41
+ }, {
42
+ value: string | number | boolean;
43
+ }>;
44
+ readonly outputSchema: z.ZodObject<{
45
+ value: z.ZodUnknown;
46
+ }, "strip", z.ZodTypeAny, {
47
+ value?: unknown;
48
+ }, {
49
+ value?: unknown;
50
+ }>;
51
+ readonly category: StepCategory;
52
+ execute(config: ComputeStepConfig): Promise<{
53
+ value: unknown;
54
+ }>;
55
+ }
56
+ //# sourceMappingURL=compute.step.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute.step.d.ts","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/compute.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAIhE,eAAO,MAAM,uBAAuB;;;;;;EAWlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAMxE,qBAAa,WAAY,SAAQ,cAAc,CAC7C,OAAO,uBAAuB,EAC9B;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,CACnB;IACC,SAAkB,IAAI,2BAA2B;IACjD,SAAkB,IAAI,sBAAsB;IAC5C,SAAkB,WAAW,sPACmN;IAChP,SAAkB,YAAY;;;;;;OAA2B;IACzD,SAAkB,YAAY;;;;;;OAA2B;IACzD,SAAkB,QAAQ,EAAE,YAAY,CAAU;IAEzC,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;CAIzE"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * COMPUTE — work a value out and give it a name.
3
+ *
4
+ * A screen fetches what it needs on the way in and then says something. Some of
5
+ * what it says is not in any answer: the sum of a fare breakdown, a count, a
6
+ * list written out line by line. This is where that lands, named, so the text
7
+ * can quote `{{steps.<id>.output.value}}` the same way it quotes a lookup's
8
+ * answer.
9
+ *
10
+ * ## Why it does almost nothing
11
+ *
12
+ * `value` is an ordinary bindable field, so by the time `execute` runs the
13
+ * engine has already resolved whatever was in it — a `{{ref}}`, a `{% … %}`
14
+ * expression, or plain text. There is nothing left to do but hand it back under
15
+ * a name. The step exists for the *name* and the *place in the sequence*, not
16
+ * for a computation of its own, and putting the evaluation here instead would
17
+ * mean a second expression engine beside the one every other field already uses.
18
+ */
19
+ import { z } from 'zod';
20
+ import { BaseActionStep } from '../../../steps/base-step.js';
21
+ import { BuiltinStepType } from '../../../types/known-types.js';
22
+ // ─── Config ───
23
+ export const ComputeStepConfigSchema = z.object({
24
+ // Any text, not only a lone reference: `"Total: {% $sum(x) %}"` is a
25
+ // legitimate thing to name, and the engine interpolates it the same way it
26
+ // interpolates any other field. What is *inside* the delimiters is still
27
+ // checked — the validator walks every string in a step's config looking for
28
+ // expressions, whatever its schema says the field is.
29
+ value: z
30
+ .union([z.string(), z.number(), z.boolean()])
31
+ .describe('What to work out — a {% expression %} over earlier values, a {{variable}} reference, or text with either in it'),
32
+ });
33
+ const ComputeStepOutputSchema = z.object({
34
+ value: z.unknown().describe('What it worked out'),
35
+ });
36
+ export class ComputeStep extends BaseActionStep {
37
+ type = BuiltinStepType.COMPUTE;
38
+ name = 'Work out a value';
39
+ description = 'Works out one value and gives it a name, so later steps and anything a screen says can quote it as {{steps.<id>.output.value}}. Use it for a total, a count, or a list written out as text — anything that is not in an answer as it stands';
40
+ configSchema = ComputeStepConfigSchema;
41
+ outputSchema = ComputeStepOutputSchema;
42
+ category = 'data';
43
+ execute(config) {
44
+ // Already resolved by the engine — see the note above.
45
+ return Promise.resolve({ value: config.value });
46
+ }
47
+ }
48
+ //# sourceMappingURL=compute.step.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute.step.js","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/compute.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;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;AAEhE,iBAAiB;AAEjB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,qEAAqE;IACrE,2EAA2E;IAC3E,yEAAyE;IACzE,4EAA4E;IAC5E,sDAAsD;IACtD,KAAK,EAAE,CAAC;SACL,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;SAC5C,QAAQ,CACP,gHAAgH,CACjH;CACJ,CAAC,CAAC;AAIH,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;CAClD,CAAC,CAAC;AAEH,MAAM,OAAO,WAAY,SAAQ,cAGhC;IACmB,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC;IAC/B,IAAI,GAAG,kBAAkB,CAAC;IAC1B,WAAW,GAC3B,6OAA6O,CAAC;IAC9N,YAAY,GAAG,uBAAuB,CAAC;IACvC,YAAY,GAAG,uBAAuB,CAAC;IACvC,QAAQ,GAAiB,MAAM,CAAC;IAEzC,OAAO,CAAC,MAAyB;QACxC,uDAAuD;QACvD,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IAClD,CAAC;CACF"}
@@ -150,16 +150,16 @@ export declare class ConditionalStep extends BaseControlFlowStep<typeof Conditio
150
150
  }>;
151
151
  }>>;
152
152
  }, "strip", z.ZodTypeAny, {
153
- branch: "none" | "if_true" | "if_false";
154
153
  evaluated: boolean;
154
+ branch: "none" | "if_true" | "if_false";
155
155
  branches: Record<string, {
156
156
  steps: Record<string, {
157
157
  output: Record<string, unknown>;
158
158
  }>;
159
159
  }>;
160
160
  }, {
161
- branch: "none" | "if_true" | "if_false";
162
161
  evaluated: boolean;
162
+ branch: "none" | "if_true" | "if_false";
163
163
  branches: Record<string, {
164
164
  steps: Record<string, {
165
165
  output: Record<string, unknown>;
@@ -57,7 +57,7 @@ export class ConditionalStep extends BaseControlFlowStep {
57
57
  }
58
58
  async execute(config, ctx) {
59
59
  const evaluator = new ConditionEvaluator();
60
- const evaluated = evaluator.evaluate(config.condition, ctx.workflow);
60
+ const evaluated = await evaluator.evaluate(config.condition, ctx.workflow);
61
61
  if (evaluated) {
62
62
  const branchSteps = config.if_true;
63
63
  await ctx.walkBranch(branchSteps, ctx.workflow, 'if_true');
@@ -1 +1 @@
1
- {"version":3,"file":"conditional.step.js","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/conditional.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtF,OAAO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AAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC5D,CAAC;CACF"}
@@ -16,7 +16,11 @@
16
16
  * round before, and the executor saves that jump on its step records — so a
17
17
  * resumed execution replays into the same round with the same input.
18
18
  *
19
- * Output: `{ rounds, exit, result }`
19
+ * Output: `{ rounds, exit, result?, state }`. `result` is a FINISH's value and
20
+ * nothing else's, so later steps can be typed against the `result` schema the
21
+ * author declares; `state` is the last round's input whatever ended the cycle,
22
+ * which on a give-up is the only diagnostic there is. One field meaning both
23
+ * would make the declared schema false on two of the three exits.
20
24
  */
21
25
  import { z } from 'zod';
22
26
  import { BaseControlFlowStep } from '../../../steps/base-step.js';
@@ -37,6 +41,7 @@ export declare const CycleStepConfigSchema: z.ZodObject<{
37
41
  type: z.ZodString;
38
42
  }, z.ZodTypeAny, "passthrough">>, "many">;
39
43
  maxIterations: z.ZodDefault<z.ZodNumber>;
44
+ result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
40
45
  }, "strip", z.ZodTypeAny, {
41
46
  input: Record<string, unknown>;
42
47
  body: z.objectOutputType<{
@@ -44,12 +49,14 @@ export declare const CycleStepConfigSchema: z.ZodObject<{
44
49
  type: z.ZodString;
45
50
  }, z.ZodTypeAny, "passthrough">[];
46
51
  maxIterations: number;
52
+ result?: Record<string, unknown> | undefined;
47
53
  }, {
48
54
  body: z.objectInputType<{
49
55
  id: z.ZodString;
50
56
  type: z.ZodString;
51
57
  }, z.ZodTypeAny, "passthrough">[];
52
58
  input?: Record<string, unknown> | undefined;
59
+ result?: Record<string, unknown> | undefined;
53
60
  maxIterations?: number | undefined;
54
61
  }>;
55
62
  export type CycleStepConfig = z.infer<typeof CycleStepConfigSchema>;
@@ -58,8 +65,10 @@ export interface CycleStepOutput extends Record<string, unknown> {
58
65
  rounds: number;
59
66
  /** Why the CYCLE ended. */
60
67
  exit: 'completed' | 'finish' | 'max_iterations';
61
- /** A FINISH's value; otherwise the last round's input. */
62
- result: Record<string, unknown>;
68
+ /** What a FINISH handed back. Absent on every other exit — read `exit` first. */
69
+ result?: Record<string, unknown>;
70
+ /** The last round's input, whatever ended the cycle. */
71
+ state: Record<string, unknown>;
63
72
  }
64
73
  export declare class CycleStep extends BaseControlFlowStep<typeof CycleStepConfigSchema, CycleStepOutput> {
65
74
  readonly type = BuiltinStepType.CYCLE;
@@ -78,6 +87,7 @@ export declare class CycleStep extends BaseControlFlowStep<typeof CycleStepConfi
78
87
  type: z.ZodString;
79
88
  }, z.ZodTypeAny, "passthrough">>, "many">;
80
89
  maxIterations: z.ZodDefault<z.ZodNumber>;
90
+ result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
81
91
  }, "strip", z.ZodTypeAny, {
82
92
  input: Record<string, unknown>;
83
93
  body: z.objectOutputType<{
@@ -85,26 +95,31 @@ export declare class CycleStep extends BaseControlFlowStep<typeof CycleStepConfi
85
95
  type: z.ZodString;
86
96
  }, z.ZodTypeAny, "passthrough">[];
87
97
  maxIterations: number;
98
+ result?: Record<string, unknown> | undefined;
88
99
  }, {
89
100
  body: z.objectInputType<{
90
101
  id: z.ZodString;
91
102
  type: z.ZodString;
92
103
  }, z.ZodTypeAny, "passthrough">[];
93
104
  input?: Record<string, unknown> | undefined;
105
+ result?: Record<string, unknown> | undefined;
94
106
  maxIterations?: number | undefined;
95
107
  }>;
96
108
  readonly outputSchema: z.ZodObject<{
97
109
  rounds: z.ZodNumber;
98
110
  exit: z.ZodEnum<["completed", "finish", "max_iterations"]>;
99
- result: z.ZodRecord<z.ZodString, z.ZodUnknown>;
111
+ result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
112
+ state: z.ZodRecord<z.ZodString, z.ZodUnknown>;
100
113
  }, "strip", z.ZodTypeAny, {
101
- result: Record<string, unknown>;
102
114
  rounds: number;
103
115
  exit: "finish" | "completed" | "max_iterations";
116
+ state: Record<string, unknown>;
117
+ result?: Record<string, unknown> | undefined;
104
118
  }, {
105
- result: Record<string, unknown>;
106
119
  rounds: number;
107
120
  exit: "finish" | "completed" | "max_iterations";
121
+ state: Record<string, unknown>;
122
+ result?: Record<string, unknown> | undefined;
108
123
  }>;
109
124
  readonly category: "control";
110
125
  readonly branchModel: "iterate";
@@ -115,8 +130,22 @@ export declare class CycleStep extends BaseControlFlowStep<typeof CycleStepConfi
115
130
  readonly label: "Each round";
116
131
  }];
117
132
  getBranches(config: Record<string, unknown>): Record<string, WorkflowStepConfig[]>;
133
+ /** The result field holds a JSON Schema, which the editor edits as one. */
134
+ decorateConfigSchema(jsonSchema: Record<string, unknown>): Record<string, unknown>;
135
+ /**
136
+ * `result` is whatever the author declared, `state` is shaped by `input` —
137
+ * the same trick the HTTP step does with its response.
138
+ *
139
+ * `result` is deliberately out of `required`: only a FINISH produces one.
140
+ * Nothing reads `required` during ref resolution today, so this documents the
141
+ * exit the author has to check rather than enforcing it.
142
+ */
143
+ resolveOutputJsonSchema(config: Record<string, unknown>): Record<string, unknown>;
118
144
  branchScopeSchemas(config: Record<string, unknown>): Record<string, Record<string, unknown>>;
119
- /** A GO_TO starts a round, so it must carry exactly the keys `input` declares. */
145
+ /**
146
+ * A GO_TO starts a round, so it must carry exactly the keys `input` declares;
147
+ * a FINISH ends the cycle, so it answers to `result` instead.
148
+ */
120
149
  checkJump(config: Record<string, unknown>, jump: {
121
150
  kind: JumpKind;
122
151
  value: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"cycle.step.d.ts","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/cycle.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAc,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,eAAe,EAA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B,GAAG,EAAE,2BAA2B,GAC/B,OAAO,CAAC,eAAe,CAAC;CAoC5B"}
@@ -16,12 +16,17 @@
16
16
  * round before, and the executor saves that jump on its step records — so a
17
17
  * resumed execution replays into the same round with the same input.
18
18
  *
19
- * Output: `{ rounds, exit, result }`
19
+ * Output: `{ rounds, exit, result?, state }`. `result` is a FINISH's value and
20
+ * nothing else's, so later steps can be typed against the `result` schema the
21
+ * author declares; `state` is the last round's input whatever ended the cycle,
22
+ * which on a give-up is the only diagnostic there is. One field meaning both
23
+ * would make the declared schema false on two of the three exits.
20
24
  */
21
25
  import { z } from 'zod';
22
26
  import { BaseControlFlowStep, cloneScope } from '../../../steps/base-step.js';
23
27
  import { BuiltinStepType } from '../../../types/known-types.js';
24
28
  import { VariableResolver } from '../../../engine/variable-resolver.js';
29
+ import { resolveExpressions } from '../../../engine/resolve-expressions.js';
25
30
  import { BranchSignal } from '../../../engine/branch-signal.js';
26
31
  import { isPureRef } from '../../../util/variable-ref.js';
27
32
  // ─── Config ───
@@ -29,11 +34,16 @@ export const CycleStepConfigSchema = z.object({
29
34
  input: z.record(z.unknown()).default({}).describe('The state each round starts with — the first round gets this, and every Go to replaces it for the next one. Read it in the body as steps.__loop.output.input.<key>; the keys you put here are the keys a Go to must carry. Supports {{variable}} refs'),
30
35
  body: z.array(z.object({ id: z.string(), type: z.string() }).passthrough()).describe('Steps to run each round. They start again from the first one on every round'),
31
36
  maxIterations: z.number().int().positive().default(100).describe('Safety limit: how many rounds before the cycle stops on its own (exit: max_iterations)'),
37
+ result: z
38
+ .record(z.unknown())
39
+ .optional()
40
+ .describe('JSON Schema of what a Finish hands back. Types the variable picker for the steps after this one, and a Finish that misses a required key is refused. Leave it empty if nothing after the cycle reads its result'),
32
41
  });
33
42
  const CycleStepOutputSchema = z.object({
34
43
  rounds: z.number(),
35
44
  exit: z.enum(['completed', 'finish', 'max_iterations']),
36
- result: z.record(z.unknown()),
45
+ result: z.record(z.unknown()).optional(),
46
+ state: z.record(z.unknown()),
37
47
  });
38
48
  // ─── Step ───
39
49
  export class CycleStep extends BaseControlFlowStep {
@@ -54,6 +64,38 @@ export class CycleStep extends BaseControlFlowStep {
54
64
  body: (config['body'] ?? []),
55
65
  };
56
66
  }
67
+ /** The result field holds a JSON Schema, which the editor edits as one. */
68
+ decorateConfigSchema(jsonSchema) {
69
+ const props = jsonSchema['properties'];
70
+ if (props?.['result']) {
71
+ props['result'] = { ...props['result'], format: 'json-schema' };
72
+ }
73
+ return jsonSchema;
74
+ }
75
+ /**
76
+ * `result` is whatever the author declared, `state` is shaped by `input` —
77
+ * the same trick the HTTP step does with its response.
78
+ *
79
+ * `result` is deliberately out of `required`: only a FINISH produces one.
80
+ * Nothing reads `required` during ref resolution today, so this documents the
81
+ * exit the author has to check rather than enforcing it.
82
+ */
83
+ resolveOutputJsonSchema(config) {
84
+ const declared = config['result'];
85
+ const result = declared !== null && typeof declared === 'object' && !Array.isArray(declared)
86
+ ? declared
87
+ : { type: 'object', additionalProperties: true };
88
+ return {
89
+ type: 'object',
90
+ properties: {
91
+ rounds: { type: 'number' },
92
+ exit: { type: 'string', enum: ['completed', 'finish', 'max_iterations'] },
93
+ result,
94
+ state: inputJsonSchema(config['input']),
95
+ },
96
+ required: ['rounds', 'exit', 'state'],
97
+ };
98
+ }
57
99
  branchScopeSchemas(config) {
58
100
  return {
59
101
  '__loop.output': {
@@ -65,8 +107,13 @@ export class CycleStep extends BaseControlFlowStep {
65
107
  },
66
108
  };
67
109
  }
68
- /** A GO_TO starts a round, so it must carry exactly the keys `input` declares. */
110
+ /**
111
+ * A GO_TO starts a round, so it must carry exactly the keys `input` declares;
112
+ * a FINISH ends the cycle, so it answers to `result` instead.
113
+ */
69
114
  checkJump(config, jump) {
115
+ if (jump.kind === 'finish')
116
+ return checkAgainstResult(config['result'], jump.value);
70
117
  if (jump.kind !== 'goto')
71
118
  return null;
72
119
  const expected = Object.keys(asRecord(config['input']));
@@ -83,8 +130,10 @@ export class CycleStep extends BaseControlFlowStep {
83
130
  }
84
131
  async execute(config, ctx) {
85
132
  const self = ctx.runtime.stepId;
86
- // Control-step configs reach execute() unresolved, so resolve refs here.
87
- let input = asRecord(new VariableResolver().resolve(config.input, ctx.workflow));
133
+ // Control-step configs reach execute() unresolved, so resolve refs here —
134
+ // expressions first, in the same order the executor uses for action steps.
135
+ const prepared = (await resolveExpressions(config.input, ctx.workflow)).value;
136
+ let input = asRecord(new VariableResolver().resolve(prepared, ctx.workflow));
88
137
  for (let round = 0; round < config.maxIterations; round++) {
89
138
  // Each round runs in its own scope, keyed by node-path frame
90
139
  // `repeat_x:body#<round>`, so a WAIT in round N resumes round N.
@@ -95,22 +144,54 @@ export class CycleStep extends BaseControlFlowStep {
95
144
  };
96
145
  try {
97
146
  await ctx.walkBranch(config.body, roundScope, 'body', round);
98
- return { rounds: round + 1, exit: 'completed', result: input };
147
+ return { rounds: round + 1, exit: 'completed', state: input };
99
148
  }
100
149
  catch (err) {
101
150
  // Pauses, failures and jumps aimed at a loop further out keep unwinding.
102
151
  if (!BranchSignal.is(err) || err.signal.target !== self)
103
152
  throw err;
104
153
  if (err.signal.kind === 'finish') {
105
- return { rounds: round + 1, exit: 'finish', result: err.signal.value };
154
+ return { rounds: round + 1, exit: 'finish', result: err.signal.value, state: input };
106
155
  }
107
156
  input = err.signal.value;
108
157
  }
109
158
  }
110
- return { rounds: config.maxIterations, exit: 'max_iterations', result: input };
159
+ return { rounds: config.maxIterations, exit: 'max_iterations', state: input };
111
160
  }
112
161
  }
113
162
  // ─── Helpers ───
163
+ /**
164
+ * A FINISH against the declared result schema.
165
+ *
166
+ * JSON Schema's own `required` semantics are honoured rather than "every key",
167
+ * because this schema is written in the schema editor, which has a per-field
168
+ * required toggle. An undeclared key is still refused: it would not be in the
169
+ * typed output, so no later step could read it — dead data worth naming.
170
+ *
171
+ * No declared schema means the cycle makes no claim about its result, so there
172
+ * is nothing to check. That is what leaves every flow written before this
173
+ * field — every conversation — exactly as it was.
174
+ */
175
+ function checkAgainstResult(declared, value) {
176
+ const schema = asRecord(declared);
177
+ const properties = asRecord(schema['properties']);
178
+ const declaredKeys = Object.keys(properties);
179
+ if (declaredKeys.length === 0)
180
+ return null;
181
+ const given = Object.keys(asRecord(value));
182
+ const required = Array.isArray(schema['required'])
183
+ ? schema['required'].filter((key) => typeof key === 'string')
184
+ : [];
185
+ const missing = required.filter((key) => !given.includes(key));
186
+ if (missing.length > 0) {
187
+ return `FINISH must set ${quoteList(missing)}: the CYCLE's result says what it hands back.`;
188
+ }
189
+ const undeclared = given.filter((key) => !declaredKeys.includes(key));
190
+ if (undeclared.length > 0) {
191
+ return `${quoteList(undeclared)} ${undeclared.length === 1 ? 'is' : 'are'} not in the CYCLE's result. Add ${undeclared.length === 1 ? 'it' : 'them'} there first.`;
192
+ }
193
+ return null;
194
+ }
114
195
  function asRecord(value) {
115
196
  return value !== null && typeof value === 'object' && !Array.isArray(value)
116
197
  ? value