@xyne/workflow-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/README.md +36 -0
  2. package/dist/agents/agent-step.d.ts +152 -0
  3. package/dist/agents/agent-step.d.ts.map +1 -0
  4. package/dist/agents/agent-step.js +403 -0
  5. package/dist/agents/agent-step.js.map +1 -0
  6. package/dist/agents/base-runtime.d.ts +38 -0
  7. package/dist/agents/base-runtime.d.ts.map +1 -0
  8. package/dist/agents/base-runtime.js +21 -0
  9. package/dist/agents/base-runtime.js.map +1 -0
  10. package/dist/agents/index.d.ts +12 -0
  11. package/dist/agents/index.d.ts.map +1 -0
  12. package/dist/agents/index.js +17 -0
  13. package/dist/agents/index.js.map +1 -0
  14. package/dist/agents/interceptor.d.ts +19 -0
  15. package/dist/agents/interceptor.d.ts.map +1 -0
  16. package/dist/agents/interceptor.js +21 -0
  17. package/dist/agents/interceptor.js.map +1 -0
  18. package/dist/agents/interceptors/approval-gate.d.ts +14 -0
  19. package/dist/agents/interceptors/approval-gate.d.ts.map +1 -0
  20. package/dist/agents/interceptors/approval-gate.js +19 -0
  21. package/dist/agents/interceptors/approval-gate.js.map +1 -0
  22. package/dist/agents/interceptors/tool-logger.d.ts +15 -0
  23. package/dist/agents/interceptors/tool-logger.d.ts.map +1 -0
  24. package/dist/agents/interceptors/tool-logger.js +23 -0
  25. package/dist/agents/interceptors/tool-logger.js.map +1 -0
  26. package/dist/agents/pi-mono-runtime.d.ts +88 -0
  27. package/dist/agents/pi-mono-runtime.d.ts.map +1 -0
  28. package/dist/agents/pi-mono-runtime.js +129 -0
  29. package/dist/agents/pi-mono-runtime.js.map +1 -0
  30. package/dist/agents/tool-registry.d.ts +25 -0
  31. package/dist/agents/tool-registry.d.ts.map +1 -0
  32. package/dist/agents/tool-registry.js +47 -0
  33. package/dist/agents/tool-registry.js.map +1 -0
  34. package/dist/agents/tool-types.d.ts +25 -0
  35. package/dist/agents/tool-types.d.ts.map +1 -0
  36. package/dist/agents/tool-types.js +9 -0
  37. package/dist/agents/tool-types.js.map +1 -0
  38. package/dist/agents/types.d.ts +91 -0
  39. package/dist/agents/types.d.ts.map +1 -0
  40. package/dist/agents/types.js +12 -0
  41. package/dist/agents/types.js.map +1 -0
  42. package/dist/builder/index.d.ts +30 -0
  43. package/dist/builder/index.d.ts.map +1 -0
  44. package/dist/builder/index.js +32 -0
  45. package/dist/builder/index.js.map +1 -0
  46. package/dist/client/index.d.ts +19 -0
  47. package/dist/client/index.d.ts.map +1 -0
  48. package/dist/client/index.js +18 -0
  49. package/dist/client/index.js.map +1 -0
  50. package/dist/client/types.d.ts +128 -0
  51. package/dist/client/types.d.ts.map +1 -0
  52. package/dist/client/types.js +10 -0
  53. package/dist/client/types.js.map +1 -0
  54. package/dist/client/workflow-client.d.ts +15 -0
  55. package/dist/client/workflow-client.d.ts.map +1 -0
  56. package/dist/client/workflow-client.js +293 -0
  57. package/dist/client/workflow-client.js.map +1 -0
  58. package/dist/common/attachment.d.ts +31 -0
  59. package/dist/common/attachment.d.ts.map +1 -0
  60. package/dist/common/attachment.js +21 -0
  61. package/dist/common/attachment.js.map +1 -0
  62. package/dist/common/executable-check.d.ts +42 -0
  63. package/dist/common/executable-check.d.ts.map +1 -0
  64. package/dist/common/executable-check.js +115 -0
  65. package/dist/common/executable-check.js.map +1 -0
  66. package/dist/common/index.d.ts +21 -0
  67. package/dist/common/index.d.ts.map +1 -0
  68. package/dist/common/index.js +19 -0
  69. package/dist/common/index.js.map +1 -0
  70. package/dist/common/resume-payload.d.ts +34 -0
  71. package/dist/common/resume-payload.d.ts.map +1 -0
  72. package/dist/common/resume-payload.js +12 -0
  73. package/dist/common/resume-payload.js.map +1 -0
  74. package/dist/engine/available-context.d.ts +29 -0
  75. package/dist/engine/available-context.d.ts.map +1 -0
  76. package/dist/engine/available-context.js +66 -0
  77. package/dist/engine/available-context.js.map +1 -0
  78. package/dist/engine/condition-evaluator.d.ts +13 -0
  79. package/dist/engine/condition-evaluator.d.ts.map +1 -0
  80. package/dist/engine/condition-evaluator.js +92 -0
  81. package/dist/engine/condition-evaluator.js.map +1 -0
  82. package/dist/engine/config-validator.d.ts +25 -0
  83. package/dist/engine/config-validator.d.ts.map +1 -0
  84. package/dist/engine/config-validator.js +316 -0
  85. package/dist/engine/config-validator.js.map +1 -0
  86. package/dist/engine/pause-step.d.ts +20 -0
  87. package/dist/engine/pause-step.d.ts.map +1 -0
  88. package/dist/engine/pause-step.js +24 -0
  89. package/dist/engine/pause-step.js.map +1 -0
  90. package/dist/engine/service-registry.d.ts +49 -0
  91. package/dist/engine/service-registry.d.ts.map +1 -0
  92. package/dist/engine/service-registry.js +76 -0
  93. package/dist/engine/service-registry.js.map +1 -0
  94. package/dist/engine/variable-resolver.d.ts +29 -0
  95. package/dist/engine/variable-resolver.d.ts.map +1 -0
  96. package/dist/engine/variable-resolver.js +130 -0
  97. package/dist/engine/variable-resolver.js.map +1 -0
  98. package/dist/engine/workflow-executor.d.ts +96 -0
  99. package/dist/engine/workflow-executor.d.ts.map +1 -0
  100. package/dist/engine/workflow-executor.js +837 -0
  101. package/dist/engine/workflow-executor.js.map +1 -0
  102. package/dist/index.d.ts +57 -0
  103. package/dist/index.d.ts.map +1 -0
  104. package/dist/index.js +56 -0
  105. package/dist/index.js.map +1 -0
  106. package/dist/persistence/in-memory-adapter.d.ts +138 -0
  107. package/dist/persistence/in-memory-adapter.d.ts.map +1 -0
  108. package/dist/persistence/in-memory-adapter.js +315 -0
  109. package/dist/persistence/in-memory-adapter.js.map +1 -0
  110. package/dist/persistence/types.d.ts +214 -0
  111. package/dist/persistence/types.d.ts.map +1 -0
  112. package/dist/persistence/types.js +8 -0
  113. package/dist/persistence/types.js.map +1 -0
  114. package/dist/router/types.d.ts +57 -0
  115. package/dist/router/types.d.ts.map +1 -0
  116. package/dist/router/types.js +8 -0
  117. package/dist/router/types.js.map +1 -0
  118. package/dist/router/workflow-router.d.ts +26 -0
  119. package/dist/router/workflow-router.d.ts.map +1 -0
  120. package/dist/router/workflow-router.js +611 -0
  121. package/dist/router/workflow-router.js.map +1 -0
  122. package/dist/runtime/execution-event-bus.d.ts +38 -0
  123. package/dist/runtime/execution-event-bus.d.ts.map +1 -0
  124. package/dist/runtime/execution-event-bus.js +87 -0
  125. package/dist/runtime/execution-event-bus.js.map +1 -0
  126. package/dist/runtime/types.d.ts +129 -0
  127. package/dist/runtime/types.d.ts.map +1 -0
  128. package/dist/runtime/types.js +5 -0
  129. package/dist/runtime/types.js.map +1 -0
  130. package/dist/runtime/workflow-runtime.d.ts +256 -0
  131. package/dist/runtime/workflow-runtime.d.ts.map +1 -0
  132. package/dist/runtime/workflow-runtime.js +699 -0
  133. package/dist/runtime/workflow-runtime.js.map +1 -0
  134. package/dist/steps/base-step.d.ts +204 -0
  135. package/dist/steps/base-step.d.ts.map +1 -0
  136. package/dist/steps/base-step.js +69 -0
  137. package/dist/steps/base-step.js.map +1 -0
  138. package/dist/steps/builtin/code.step.d.ts +95 -0
  139. package/dist/steps/builtin/code.step.d.ts.map +1 -0
  140. package/dist/steps/builtin/code.step.js +122 -0
  141. package/dist/steps/builtin/code.step.js.map +1 -0
  142. package/dist/steps/builtin/conditional.step.d.ts +146 -0
  143. package/dist/steps/builtin/conditional.step.d.ts.map +1 -0
  144. package/dist/steps/builtin/conditional.step.js +71 -0
  145. package/dist/steps/builtin/conditional.step.js.map +1 -0
  146. package/dist/steps/builtin/dedup.step.d.ts +65 -0
  147. package/dist/steps/builtin/dedup.step.d.ts.map +1 -0
  148. package/dist/steps/builtin/dedup.step.js +61 -0
  149. package/dist/steps/builtin/dedup.step.js.map +1 -0
  150. package/dist/steps/builtin/http-request.step.d.ts +928 -0
  151. package/dist/steps/builtin/http-request.step.d.ts.map +1 -0
  152. package/dist/steps/builtin/http-request.step.js +570 -0
  153. package/dist/steps/builtin/http-request.step.js.map +1 -0
  154. package/dist/steps/builtin/loop.step.d.ts +100 -0
  155. package/dist/steps/builtin/loop.step.d.ts.map +1 -0
  156. package/dist/steps/builtin/loop.step.js +79 -0
  157. package/dist/steps/builtin/loop.step.js.map +1 -0
  158. package/dist/steps/builtin/parallel.step.d.ts +208 -0
  159. package/dist/steps/builtin/parallel.step.d.ts.map +1 -0
  160. package/dist/steps/builtin/parallel.step.js +249 -0
  161. package/dist/steps/builtin/parallel.step.js.map +1 -0
  162. package/dist/steps/builtin/switch.step.d.ts +200 -0
  163. package/dist/steps/builtin/switch.step.d.ts.map +1 -0
  164. package/dist/steps/builtin/switch.step.js +92 -0
  165. package/dist/steps/builtin/switch.step.js.map +1 -0
  166. package/dist/steps/builtin/transform.step.d.ts +247 -0
  167. package/dist/steps/builtin/transform.step.d.ts.map +1 -0
  168. package/dist/steps/builtin/transform.step.js +135 -0
  169. package/dist/steps/builtin/transform.step.js.map +1 -0
  170. package/dist/steps/builtin/wait.step.d.ts +921 -0
  171. package/dist/steps/builtin/wait.step.d.ts.map +1 -0
  172. package/dist/steps/builtin/wait.step.js +211 -0
  173. package/dist/steps/builtin/wait.step.js.map +1 -0
  174. package/dist/steps/step-registry.d.ts +64 -0
  175. package/dist/steps/step-registry.d.ts.map +1 -0
  176. package/dist/steps/step-registry.js +102 -0
  177. package/dist/steps/step-registry.js.map +1 -0
  178. package/dist/storage/in-memory-adapter.d.ts +25 -0
  179. package/dist/storage/in-memory-adapter.d.ts.map +1 -0
  180. package/dist/storage/in-memory-adapter.js +41 -0
  181. package/dist/storage/in-memory-adapter.js.map +1 -0
  182. package/dist/storage/types.d.ts +53 -0
  183. package/dist/storage/types.d.ts.map +1 -0
  184. package/dist/storage/types.js +13 -0
  185. package/dist/storage/types.js.map +1 -0
  186. package/dist/testing/index.d.ts +10 -0
  187. package/dist/testing/index.d.ts.map +1 -0
  188. package/dist/testing/index.js +10 -0
  189. package/dist/testing/index.js.map +1 -0
  190. package/dist/testing/mock-context.d.ts +13 -0
  191. package/dist/testing/mock-context.d.ts.map +1 -0
  192. package/dist/testing/mock-context.js +21 -0
  193. package/dist/testing/mock-context.js.map +1 -0
  194. package/dist/testing/mock-step-context.d.ts +47 -0
  195. package/dist/testing/mock-step-context.d.ts.map +1 -0
  196. package/dist/testing/mock-step-context.js +59 -0
  197. package/dist/testing/mock-step-context.js.map +1 -0
  198. package/dist/triggers/base-trigger.d.ts +58 -0
  199. package/dist/triggers/base-trigger.d.ts.map +1 -0
  200. package/dist/triggers/base-trigger.js +37 -0
  201. package/dist/triggers/base-trigger.js.map +1 -0
  202. package/dist/triggers/builtin/default-cron-trigger.d.ts +44 -0
  203. package/dist/triggers/builtin/default-cron-trigger.d.ts.map +1 -0
  204. package/dist/triggers/builtin/default-cron-trigger.js +31 -0
  205. package/dist/triggers/builtin/default-cron-trigger.js.map +1 -0
  206. package/dist/triggers/builtin/default-event-trigger.d.ts +32 -0
  207. package/dist/triggers/builtin/default-event-trigger.d.ts.map +1 -0
  208. package/dist/triggers/builtin/default-event-trigger.js +21 -0
  209. package/dist/triggers/builtin/default-event-trigger.js.map +1 -0
  210. package/dist/triggers/builtin/default-manual-trigger.d.ts +119 -0
  211. package/dist/triggers/builtin/default-manual-trigger.d.ts.map +1 -0
  212. package/dist/triggers/builtin/default-manual-trigger.js +64 -0
  213. package/dist/triggers/builtin/default-manual-trigger.js.map +1 -0
  214. package/dist/triggers/builtin/default-webhook-trigger.d.ts +72 -0
  215. package/dist/triggers/builtin/default-webhook-trigger.d.ts.map +1 -0
  216. package/dist/triggers/builtin/default-webhook-trigger.js +91 -0
  217. package/dist/triggers/builtin/default-webhook-trigger.js.map +1 -0
  218. package/dist/triggers/cron-trigger.d.ts +52 -0
  219. package/dist/triggers/cron-trigger.d.ts.map +1 -0
  220. package/dist/triggers/cron-trigger.js +15 -0
  221. package/dist/triggers/cron-trigger.js.map +1 -0
  222. package/dist/triggers/event-trigger.d.ts +14 -0
  223. package/dist/triggers/event-trigger.d.ts.map +1 -0
  224. package/dist/triggers/event-trigger.js +13 -0
  225. package/dist/triggers/event-trigger.js.map +1 -0
  226. package/dist/triggers/manual-trigger.d.ts +11 -0
  227. package/dist/triggers/manual-trigger.d.ts.map +1 -0
  228. package/dist/triggers/manual-trigger.js +10 -0
  229. package/dist/triggers/manual-trigger.js.map +1 -0
  230. package/dist/triggers/trigger-registry.d.ts +48 -0
  231. package/dist/triggers/trigger-registry.d.ts.map +1 -0
  232. package/dist/triggers/trigger-registry.js +81 -0
  233. package/dist/triggers/trigger-registry.js.map +1 -0
  234. package/dist/triggers/webhook-trigger.d.ts +54 -0
  235. package/dist/triggers/webhook-trigger.d.ts.map +1 -0
  236. package/dist/triggers/webhook-trigger.js +13 -0
  237. package/dist/triggers/webhook-trigger.js.map +1 -0
  238. package/dist/types/attachment.d.ts +23 -0
  239. package/dist/types/attachment.d.ts.map +1 -0
  240. package/dist/types/attachment.js +2 -0
  241. package/dist/types/attachment.js.map +1 -0
  242. package/dist/types/categories.d.ts +14 -0
  243. package/dist/types/categories.d.ts.map +1 -0
  244. package/dist/types/categories.js +10 -0
  245. package/dist/types/categories.js.map +1 -0
  246. package/dist/types/context.d.ts +61 -0
  247. package/dist/types/context.d.ts.map +1 -0
  248. package/dist/types/context.js +2 -0
  249. package/dist/types/context.js.map +1 -0
  250. package/dist/types/index.d.ts +18 -0
  251. package/dist/types/index.d.ts.map +1 -0
  252. package/dist/types/index.js +12 -0
  253. package/dist/types/index.js.map +1 -0
  254. package/dist/types/known-types.d.ts +34 -0
  255. package/dist/types/known-types.d.ts.map +1 -0
  256. package/dist/types/known-types.js +49 -0
  257. package/dist/types/known-types.js.map +1 -0
  258. package/dist/types/operators.d.ts +20 -0
  259. package/dist/types/operators.d.ts.map +1 -0
  260. package/dist/types/operators.js +27 -0
  261. package/dist/types/operators.js.map +1 -0
  262. package/dist/types/pause-path.d.ts +23 -0
  263. package/dist/types/pause-path.d.ts.map +1 -0
  264. package/dist/types/pause-path.js +2 -0
  265. package/dist/types/pause-path.js.map +1 -0
  266. package/dist/types/pause-state.d.ts +100 -0
  267. package/dist/types/pause-state.d.ts.map +1 -0
  268. package/dist/types/pause-state.js +15 -0
  269. package/dist/types/pause-state.js.map +1 -0
  270. package/dist/types/resume-payload.d.ts +34 -0
  271. package/dist/types/resume-payload.d.ts.map +1 -0
  272. package/dist/types/resume-payload.js +12 -0
  273. package/dist/types/resume-payload.js.map +1 -0
  274. package/dist/types/status.d.ts +27 -0
  275. package/dist/types/status.d.ts.map +1 -0
  276. package/dist/types/status.js +41 -0
  277. package/dist/types/status.js.map +1 -0
  278. package/dist/types/step-events.d.ts +22 -0
  279. package/dist/types/step-events.d.ts.map +1 -0
  280. package/dist/types/step-events.js +8 -0
  281. package/dist/types/step-events.js.map +1 -0
  282. package/dist/types/step-types.d.ts +12 -0
  283. package/dist/types/step-types.d.ts.map +1 -0
  284. package/dist/types/step-types.js +2 -0
  285. package/dist/types/step-types.js.map +1 -0
  286. package/dist/types/trigger-types.d.ts +12 -0
  287. package/dist/types/trigger-types.d.ts.map +1 -0
  288. package/dist/types/trigger-types.js +2 -0
  289. package/dist/types/trigger-types.js.map +1 -0
  290. package/dist/types/validation.d.ts +19 -0
  291. package/dist/types/validation.d.ts.map +1 -0
  292. package/dist/types/validation.js +11 -0
  293. package/dist/types/validation.js.map +1 -0
  294. package/dist/types/workflow-config.d.ts +122 -0
  295. package/dist/types/workflow-config.d.ts.map +1 -0
  296. package/dist/types/workflow-config.js +71 -0
  297. package/dist/types/workflow-config.js.map +1 -0
  298. package/dist/util/executable-check.d.ts +42 -0
  299. package/dist/util/executable-check.d.ts.map +1 -0
  300. package/dist/util/executable-check.js +115 -0
  301. package/dist/util/executable-check.js.map +1 -0
  302. package/dist/util/schema-convert.d.ts +14 -0
  303. package/dist/util/schema-convert.d.ts.map +1 -0
  304. package/dist/util/schema-convert.js +16 -0
  305. package/dist/util/schema-convert.js.map +1 -0
  306. package/dist/util/variable-ref.d.ts +52 -0
  307. package/dist/util/variable-ref.d.ts.map +1 -0
  308. package/dist/util/variable-ref.js +89 -0
  309. package/dist/util/variable-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ume on a trigger.
3
+ *
4
+ * Three modes:
5
+ *
6
+ * - `delay`: Resume automatically after a specified duration.
7
+ * The step pauses with `statePatch.resumeAfter` so the host/runtime
8
+ * can schedule a delayed re-enqueue.
9
+ *
10
+ * - `webhook`: Resume when an external system calls a callback URL.
11
+ * The step pauses with an `externalRef` that the host uses to
12
+ * route inbound callbacks to the correct execution.
13
+ *
14
+ * - `approval`: Resume when a user explicitly approves/rejects via the API.
15
+ * Supports compositional interactions: display data, editable form,
16
+ * and custom action buttons.
17
+ *
18
+ * All modes use `ctx.pause()`. The host runtime is responsible for
19
+ * scheduling delayed resumes (delay mode) or routing callbacks
20
+ * (webhook mode). The step itself is stateless — it pauses and
21
+ * trusts `onResume()` to receive whatever data the caller provides.
22
+ */
23
+ import { z } from 'zod';
24
+ import { BaseActionStep } from '../base-step.js';
25
+ import { BuiltinStepType } from '../../types/known-types.js';
26
+ // ─── Pause UI Schemas (shared with PauseState types) ───
27
+ const PauseDisplaySectionSchema = z.object({
28
+ label: z.string(),
29
+ value: z.unknown(),
30
+ });
31
+ const PauseFormFieldOptionSchema = z.object({
32
+ label: z.string(),
33
+ value: z.string(),
34
+ });
35
+ const PauseFormFieldSchema = z.discriminatedUnion('type', [
36
+ z.object({
37
+ type: z.literal('text'),
38
+ name: z.string(),
39
+ label: z.string(),
40
+ required: z.boolean().optional(),
41
+ description: z.string().optional(),
42
+ placeholder: z.string().optional(),
43
+ defaultValue: z.string().optional(),
44
+ }),
45
+ z.object({
46
+ type: z.literal('textarea'),
47
+ name: z.string(),
48
+ label: z.string(),
49
+ required: z.boolean().optional(),
50
+ description: z.string().optional(),
51
+ placeholder: z.string().optional(),
52
+ defaultValue: z.string().optional(),
53
+ rows: z.number().optional(),
54
+ }),
55
+ z.object({
56
+ type: z.literal('number'),
57
+ name: z.string(),
58
+ label: z.string(),
59
+ required: z.boolean().optional(),
60
+ description: z.string().optional(),
61
+ placeholder: z.string().optional(),
62
+ defaultValue: z.number().optional(),
63
+ min: z.number().optional(),
64
+ max: z.number().optional(),
65
+ }),
66
+ z.object({
67
+ type: z.literal('select'),
68
+ name: z.string(),
69
+ label: z.string(),
70
+ required: z.boolean().optional(),
71
+ description: z.string().optional(),
72
+ placeholder: z.string().optional(),
73
+ defaultValue: z.string().optional(),
74
+ // Accepts array of options or a {{variable}} ref string (resolved at runtime)
75
+ options: z.union([z.array(PauseFormFieldOptionSchema), z.string()]),
76
+ allowCustomValue: z.boolean().optional(),
77
+ }),
78
+ z.object({
79
+ type: z.literal('checkbox'),
80
+ name: z.string(),
81
+ label: z.string(),
82
+ required: z.boolean().optional(),
83
+ description: z.string().optional(),
84
+ defaultValue: z.boolean().optional(),
85
+ }),
86
+ ]);
87
+ const PauseFormSchema = z.object({
88
+ fields: z.array(PauseFormFieldSchema),
89
+ description: z.string().optional(),
90
+ });
91
+ const PauseActionSchema = z.object({
92
+ key: z.string(),
93
+ label: z.string(),
94
+ style: z.enum(['primary', 'danger', 'default']).optional(),
95
+ abort: z.boolean().optional(),
96
+ submitsForm: z.boolean().optional(),
97
+ });
98
+ // ─── Config ───
99
+ const WaitDelayConfigSchema = z.object({
100
+ mode: z.literal('delay'),
101
+ delayMs: z.number().int().positive().describe('Duration to wait in milliseconds before auto-resuming'),
102
+ });
103
+ const WaitWebhookConfigSchema = z.object({
104
+ mode: z.literal('webhook'),
105
+ // No per-step config needed. The workflow's stable callback secret +
106
+ // this execution's ID together form the callback URL.
107
+ });
108
+ const WaitApprovalConfigSchema = z.object({
109
+ mode: z.literal('approval'),
110
+ reason: z.string().min(1).describe('Human-readable reason shown to the approver'),
111
+ prompt: z.string().optional().describe('Prompt text shown above the interaction panel'),
112
+ display: z.array(PauseDisplaySectionSchema).optional().describe('Read-only data sections to display. Values support {{variable}} refs'),
113
+ form: PauseFormSchema.optional().describe('Editable form with typed fields for the approver'),
114
+ actions: z.array(PauseActionSchema).optional().describe('Action buttons. Defaults to Approve + Reject when omitted'),
115
+ });
116
+ export const WaitStepConfigSchema = z.discriminatedUnion('mode', [
117
+ WaitDelayConfigSchema,
118
+ WaitWebhookConfigSchema,
119
+ WaitApprovalConfigSchema,
120
+ ]);
121
+ const WaitStepOutputSchema = z.object({
122
+ mode: z.enum(['delay', 'webhook', 'approval']),
123
+ resumeData: z.record(z.unknown()),
124
+ });
125
+ // ─── Step ───
126
+ export class WaitStep extends BaseActionStep {
127
+ type = BuiltinStepType.WAIT;
128
+ name = 'Wait';
129
+ description = 'Pause execution and resume after a delay, webhook callback, or manual approval';
130
+ configSchema = WaitStepConfigSchema;
131
+ outputSchema = WaitStepOutputSchema;
132
+ category = 'flow';
133
+ icon = 'clock';
134
+ async execute(config, ctx) {
135
+ switch (config.mode) {
136
+ case 'delay':
137
+ return this.executeDelay(config, ctx);
138
+ case 'webhook':
139
+ return this.executeWebhook(config, ctx);
140
+ case 'approval':
141
+ return this.executeApproval(config, ctx);
142
+ }
143
+ }
144
+ async onResume(rowData, _config, _ctx) {
145
+ const waitMode = rowData['waitMode'] ?? 'delay';
146
+ const resumePayload = rowData['resumePayload'] ?? {};
147
+ return {
148
+ mode: waitMode,
149
+ resumeData: resumePayload,
150
+ };
151
+ }
152
+ executeDelay(config, ctx) {
153
+ ctx.pause(`Waiting for ${String(config.delayMs)}ms`, {
154
+ statePatch: {
155
+ waitMode: 'delay',
156
+ delayMs: config.delayMs,
157
+ resumeAfter: new Date(Date.now() + config.delayMs).toISOString(),
158
+ },
159
+ });
160
+ }
161
+ executeWebhook(_config, ctx) {
162
+ // No per-step secret needed — the workflow has a stable callback secret
163
+ // generated at save time. The HTTP step that runs before this one
164
+ // interpolated `{{ runtime.executionId }}` into the URL it sent the
165
+ // external system. The runtime resolves the callback via the workflow
166
+ // secret + executionId pair (see `runtime.handleWaitCallback`).
167
+ //
168
+ // The UI surfaces the full URL by joining the workflow's stored secret
169
+ // with this execution's ID — the wait step itself only needs to
170
+ // identify which execution is paused.
171
+ ctx.pause('Waiting for webhook callback', {
172
+ statePatch: {
173
+ waitMode: 'webhook',
174
+ executionId: ctx.runtime.executionId,
175
+ pauseState: {
176
+ reason: 'Waiting for webhook callback',
177
+ category: 'input_required',
178
+ display: [
179
+ { label: 'Execution ID', value: ctx.runtime.executionId },
180
+ {
181
+ label: 'Callback URL template',
182
+ value: `${ctx.runtime.baseUrl}/wait/callback/<workflow-secret>/${ctx.runtime.executionId}`,
183
+ },
184
+ ],
185
+ },
186
+ },
187
+ });
188
+ }
189
+ executeApproval(config, ctx) {
190
+ // Build compositional PauseState from resolved config
191
+ const pauseState = {
192
+ reason: config.reason,
193
+ };
194
+ if (config.prompt)
195
+ pauseState.prompt = config.prompt;
196
+ if (config.display)
197
+ pauseState.display = config.display;
198
+ if (config.form)
199
+ pauseState.form = config.form;
200
+ if (config.actions)
201
+ pauseState.actions = config.actions;
202
+ ctx.pause(config.reason, {
203
+ statePatch: {
204
+ waitMode: 'approval',
205
+ reason: config.reason,
206
+ pauseState,
207
+ },
208
+ });
209
+ }
210
+ }
211
+ //# sourceMappingURL=wait.step.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait.step.js","sourceRoot":"","sources":["../../../src/steps/builtin/wait.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAI7D,0DAA0D;AAE1D,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE;CACnB,CAAC,CAAC;AAEH,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,CAAC,CAAC;AAEH,M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C,QAAQ,EAAE,gBAAgB;oBAC1B,OAAO,EAAE;wBACP,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE;wBACzD;4BACE,KAAK,EAAE,uBAAuB;4BAC9B,KAAK,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,oCAAoC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE;yBAC3F;qBACF;iBACmB;aACvB;SACF,CAAC,CAAC;IACL,CAAC;IAEO,eAAe,CACrB,MAAgD,EAChD,GAAyB;QAEzB,sDAAsD;QACtD,MAAM,UAAU,GAAe;YAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAC;QACF,IAAI,MAAM,CAAC,MAAM;YAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QACrD,IAAI,MAAM,CAAC,OAAO;YAAE,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC,OAAgC,CAAC;QACjF,IAAI,MAAM,CAAC,IAAI;YAAE,UAAU,CAAC,IAAI,GAAG,MAAM,CAAC,IAA0B,CAAC;QACrE,IAAI,MAAM,CAAC,OAAO;YAAE,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC,OAAgC,CAAC;QAEjF,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE;YACvB,UAAU,EAAE;gBACV,QAAQ,EAAE,UAAU;gBACpB,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,UAAU;aACX;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,64 @@
1
+ import type { z } from 'zod';
2
+ import type { StepType } from '../types/step-types.js';
3
+ import type { StepCategory } from '../types/categories.js';
4
+ import type { ServiceRegistry } from '../engine/service-registry.js';
5
+ import type { BranchModel, CredentialSlot, CredentialTypeSchema, DeclaredOutput } from './base-step.js';
6
+ import { BaseStep, StepKind } from './base-step.js';
7
+ export interface StepSummary {
8
+ type: StepType;
9
+ name: string;
10
+ description: string;
11
+ category: StepCategory;
12
+ kind: StepKind;
13
+ icon?: string;
14
+ /** Control-flow steps only: 'iterate' for LOOP, 'fanout' for everything else. Absent for action steps. */
15
+ branchModel?: BranchModel;
16
+ }
17
+ export interface StepDescriptor extends StepSummary {
18
+ /** JSON Schema for the step's config — generated from the Zod schema. */
19
+ configSchema: Record<string, unknown>;
20
+ /** JSON Schema for the step's output — generated from the Zod schema. */
21
+ outputSchema: Record<string, unknown>;
22
+ /** Credential slots this step declares. Empty array if none. */
23
+ credentialSlots: readonly CredentialSlot[];
24
+ /** Output branches (for control-flow steps). Empty array for action steps. */
25
+ declaredOutputs: readonly DeclaredOutput[];
26
+ /** Service names this step requires at runtime. Empty array if none. */
27
+ requiredServices: readonly string[];
28
+ /** Event types this step may emit (action steps only). Empty array if none. */
29
+ mayEmit: readonly string[];
30
+ /** Credential type schemas — defines what fields each credential type needs for UI forms. */
31
+ credentialTypeSchemas: readonly CredentialTypeSchema[];
32
+ }
33
+ export declare class UnknownStepError extends Error {
34
+ readonly stepType: StepType;
35
+ constructor(stepType: StepType);
36
+ }
37
+ type AnyStep = BaseStep<z.ZodTypeAny, Record<string, unknown>>;
38
+ export declare class StepRegistry {
39
+ private readonly map;
40
+ constructor();
41
+ /**
42
+ * Register a step implementation. Throws on duplicate type.
43
+ *
44
+ * If a `ServiceRegistry` is provided, validates that all
45
+ * `requiredServices` declared by the step are present.
46
+ */
47
+ register(instance: AnyStep, services?: ServiceRegistry): void;
48
+ /** Look up a step by type. Throws `UnknownStepError` if not found. */
49
+ get(type: StepType): AnyStep;
50
+ /** All registered step instances. */
51
+ list(): AnyStep[];
52
+ /** Lightweight summaries — type, name, description, category, kind, icon. */
53
+ listSummaries(): StepSummary[];
54
+ /** Full descriptor for a single step type — includes JSON Schemas and all metadata. */
55
+ getDescriptor(type: StepType): StepDescriptor;
56
+ /** Check if a step type is registered. */
57
+ has(type: StepType): boolean;
58
+ /** Number of registered steps. */
59
+ get size(): number;
60
+ private buildSummary;
61
+ private buildDescriptor;
62
+ }
63
+ export {};
64
+ //# sourceMappingURL=step-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-registry.d.ts","sourceRoot":"","sources":["../../src/steps/step-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACxG,OAAO,EAAE,QAAQ,EAAuC,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAazF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,YAAY,CAAC;IACvB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0GAA0G;IAC1G,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAID,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,yEAAyE;IACzE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,yEAAyE;IACzE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,gEAAgE;IAChE,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3C,8EAA8E;IAC9E,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3C,wEAAwE;IACxE,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,+EAA+E;IAC/E,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,6FAA6F;IAC7F,qBAAqB,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACxD;AAID,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;gBAEhB,QAAQ,EAAE,QAAQ;CAO/B;AAKD,KAAK,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE/D,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgC;;IAcpD;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,eAAe,GAAG,IAAI;IAY7D,sEAAsE;IACtE,GAAG,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO;IAQ5B,qCAAqC;IACrC,IAAI,IAAI,OAAO,EAAE;IAIjB,6EAA6E;IAC7E,aAAa,IAAI,WAAW,EAAE;IAI9B,uFAAuF;IACvF,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,cAAc;IAK7C,0CAA0C;IAC1C,GAAG,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO;IAI5B,kCAAkC;IAClC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAID,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,eAAe;CAaxB"}
@@ -0,0 +1,102 @@
1
+ import { BaseStep, BaseActionStep, BaseControlFlowStep, StepKind } from './base-step.js';
2
+ import { zodToJsonSchemaRecord } from '../util/schema-convert.js';
3
+ import { CodeStep } from './builtin/code.step.js';
4
+ import { ConditionalStep } from './builtin/conditional.step.js';
5
+ import { HttpRequestStep } from './builtin/http-request.step.js';
6
+ import { LoopStep } from './builtin/loop.step.js';
7
+ import { ParallelStep } from './builtin/parallel.step.js';
8
+ import { SwitchStep } from './builtin/switch.step.js';
9
+ import { WaitStep } from './builtin/wait.step.js';
10
+ import { DedupStep } from './builtin/dedup.step.js';
11
+ // ─── Error ───
12
+ export class UnknownStepError extends Error {
13
+ stepType;
14
+ constructor(stepType) {
15
+ super(`StepRegistry: unknown step type "${stepType}". Is it registered at boot?`);
16
+ this.name = 'UnknownStepError';
17
+ this.stepType = stepType;
18
+ }
19
+ }
20
+ export class StepRegistry {
21
+ map = new Map();
22
+ constructor() {
23
+ // Auto-register all built-in steps
24
+ this.map.set('CODE', new CodeStep());
25
+ this.map.set('CONDITIONAL', new ConditionalStep());
26
+ this.map.set('HTTP_REQUEST', new HttpRequestStep());
27
+ this.map.set('LOOP', new LoopStep());
28
+ this.map.set('PARALLEL', new ParallelStep());
29
+ this.map.set('SWITCH', new SwitchStep());
30
+ this.map.set('WAIT', new WaitStep());
31
+ this.map.set('DEDUP', new DedupStep());
32
+ }
33
+ /**
34
+ * Register a step implementation. Throws on duplicate type.
35
+ *
36
+ * If a `ServiceRegistry` is provided, validates that all
37
+ * `requiredServices` declared by the step are present.
38
+ */
39
+ register(instance, services) {
40
+ if (this.map.has(instance.type)) {
41
+ throw new Error(`StepRegistry: step type "${instance.type}" is already registered.`);
42
+ }
43
+ if (services && instance.requiredServices) {
44
+ services.assertRegistered(instance.requiredServices);
45
+ }
46
+ this.map.set(instance.type, instance);
47
+ }
48
+ /** Look up a step by type. Throws `UnknownStepError` if not found. */
49
+ get(type) {
50
+ const impl = this.map.get(type);
51
+ if (!impl) {
52
+ throw new UnknownStepError(type);
53
+ }
54
+ return impl;
55
+ }
56
+ /** All registered step instances. */
57
+ list() {
58
+ return Array.from(this.map.values());
59
+ }
60
+ /** Lightweight summaries — type, name, description, category, kind, icon. */
61
+ listSummaries() {
62
+ return this.list().map((s) => this.buildSummary(s));
63
+ }
64
+ /** Full descriptor for a single step type — includes JSON Schemas and all metadata. */
65
+ getDescriptor(type) {
66
+ const impl = this.get(type);
67
+ return this.buildDescriptor(impl);
68
+ }
69
+ /** Check if a step type is registered. */
70
+ has(type) {
71
+ return this.map.has(type);
72
+ }
73
+ /** Number of registered steps. */
74
+ get size() {
75
+ return this.map.size;
76
+ }
77
+ // ─── Internal builders ───
78
+ buildSummary(s) {
79
+ return {
80
+ type: s.type,
81
+ name: s.name,
82
+ description: s.description,
83
+ category: s.category,
84
+ kind: s.kind,
85
+ ...(s.icon !== undefined ? { icon: s.icon } : {}),
86
+ ...(s instanceof BaseControlFlowStep ? { branchModel: s.branchModel } : {}),
87
+ };
88
+ }
89
+ buildDescriptor(s) {
90
+ return {
91
+ ...this.buildSummary(s),
92
+ configSchema: s.decorateConfigSchema(zodToJsonSchemaRecord(s.configSchema)),
93
+ outputSchema: zodToJsonSchemaRecord(s.outputSchema),
94
+ credentialSlots: s.credentialSlots ?? [],
95
+ declaredOutputs: s.declaredOutputs ?? [],
96
+ requiredServices: s.requiredServices ?? [],
97
+ mayEmit: s instanceof BaseActionStep ? (s.mayEmit ?? []) : [],
98
+ credentialTypeSchemas: s.credentialTypeSchemas ?? [],
99
+ };
100
+ }
101
+ }
102
+ //# sourceMappingURL=step-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-registry.js","sourceRoot":"","sources":["../../src/steps/step-registry.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;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itable for production — bytes live in process memory and disappear
6
+ * on restart.
7
+ */
8
+ import type { Attachment } from '../common/attachment.js';
9
+ import type { StorageAdapter, StorageFile, StorageScope } from './types.js';
10
+ interface StoredBlob {
11
+ bytes: Uint8Array;
12
+ attachment: Attachment;
13
+ }
14
+ export declare class InMemoryStorageAdapter implements StorageAdapter {
15
+ /** Exposed for test inspection — count, clear, etc. */
16
+ readonly blobs: Map<string, StoredBlob>;
17
+ private nextId;
18
+ private genRef;
19
+ store(_scope: StorageScope, file: StorageFile): Promise<Attachment>;
20
+ read(ref: Attachment): Promise<Uint8Array>;
21
+ signUrl(ref: Attachment, _ttlSeconds: number): Promise<string>;
22
+ delete(ref: Attachment): Promise<void>;
23
+ }
24
+ export {};
25
+ //# sourceMappingURL=in-memory-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-memory-adapter.d.ts","sourceRoot":"","sources":["../../src/storage/in-memory-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5E,UAAU,UAAU;IAClB,KAAK,EAAE,UAAU,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,qBAAa,sBAAuB,YAAW,cAAc;IAC3D,uDAAuD;IACvD,QAAQ,CAAC,KAAK,0BAAiC;IAE/C,OAAO,CAAC,MAAM,CAAK;IAEnB,OAAO,CAAC,MAAM;IAIR,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAYnE,IAAI,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAQ1C,OAAO,CAAC,GAAG,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAK9D,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7C"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * In-memory StorageAdapter for tests and local development.
3
+ *
4
+ * Stores blobs in a Map keyed by a generated `mem://<id>` reference.
5
+ * Not suitable for production — bytes live in process memory and disappear
6
+ * on restart.
7
+ */
8
+ export class InMemoryStorageAdapter {
9
+ /** Exposed for test inspection — count, clear, etc. */
10
+ blobs = new Map();
11
+ nextId = 1;
12
+ genRef() {
13
+ return `mem://${String(this.nextId++)}_${Math.random().toString(36).slice(2, 10)}`;
14
+ }
15
+ async store(_scope, file) {
16
+ const ref = this.genRef();
17
+ const attachment = {
18
+ name: file.name,
19
+ mimeType: file.mimeType,
20
+ data: ref,
21
+ size: file.bytes.byteLength,
22
+ };
23
+ this.blobs.set(ref, { bytes: file.bytes, attachment });
24
+ return attachment;
25
+ }
26
+ async read(ref) {
27
+ const stored = this.blobs.get(ref.data);
28
+ if (!stored) {
29
+ throw new Error(`InMemoryStorageAdapter: unknown reference "${ref.data}"`);
30
+ }
31
+ return stored.bytes;
32
+ }
33
+ async signUrl(ref, _ttlSeconds) {
34
+ // For tests / dev — return the opaque ref as a URL.
35
+ return ref.data;
36
+ }
37
+ async delete(ref) {
38
+ this.blobs.delete(ref.data);
39
+ }
40
+ }
41
+ //# sourceMappingURL=in-memory-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-memory-adapter.js","sourceRoot":"","sources":["../../src/storage/in-memory-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,MAAM,OAAO,sBAAsB;IACjC,uDAAuD;IAC9C,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;IAEvC,MAAM,GAAG,CAAC,CAAC;IAEX,MAAM;QACZ,OAAO,SAAS,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;IACrF,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,MAAoB,EAAE,IAAiB;QACjD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,UAAU,GAAe;YAC7B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,GAAG;YACT,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU;SAC5B,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;QACvD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAe;QACxB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,8CAA8C,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,MAAM,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAe,EAAE,WAAmB;QAChD,oDAAoD;QACpD,OAAO,GAAG,CAAC,IAAI,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAe;QAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;CACF"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * StorageAdapter — host plug-in for blob storage.
3
+ *
4
+ * The runtime calls `store()` when files arrive at `POST /uploads`, and
5
+ * steps call `read()` (via a host-registered service) when they need the
6
+ * bytes. The framework never opens an attachment's `data` field — that's
7
+ * the host's reference and the host's adapter must understand it.
8
+ *
9
+ * Adapters live next to {@link PersistenceAdapter} / {@link QueueAdapter} /
10
+ * {@link SchedulerAdapter} in `RuntimeOptions`.
11
+ */
12
+ import type { Attachment } from '../common/attachment.js';
13
+ /**
14
+ * Per-upload scope, propagated from the router. Typically the host's
15
+ * `AuthContext.metadata` — workspaceId, tenantId, userId — so the adapter
16
+ * can route writes into the right bucket / prefix / tenant.
17
+ */
18
+ export type StorageScope = Record<string, unknown>;
19
+ export interface StorageFile {
20
+ /** Original filename — e.g. "contract.pdf". */
21
+ name: string;
22
+ /** MIME type from the multipart part headers. */
23
+ mimeType: string;
24
+ /** Raw bytes parsed by the host's multipart middleware. */
25
+ bytes: Uint8Array;
26
+ }
27
+ export interface StorageAdapter {
28
+ /**
29
+ * Persist a file and return its {@link Attachment} reference. The framework
30
+ * passes this reference through workflow context and steps without ever
31
+ * opening `data`.
32
+ */
33
+ store(scope: StorageScope, file: StorageFile): Promise<Attachment>;
34
+ /**
35
+ * Resolve an attachment back to raw bytes. Steps that need the file
36
+ * contents call this through a host-registered service (e.g. an agent
37
+ * step loading an image to send to the LLM).
38
+ */
39
+ read(ref: Attachment): Promise<Uint8Array>;
40
+ /**
41
+ * Optional: short-lived presigned URL for the UI to render a preview
42
+ * (image thumbnail, download link). When omitted, the UI may not be able
43
+ * to display the attachment inline.
44
+ */
45
+ signUrl?(ref: Attachment, ttlSeconds: number): Promise<string>;
46
+ /**
47
+ * Optional: delete the underlying blob. The framework does NOT call this
48
+ * automatically — hosts wire cleanup into their own lifecycle hooks
49
+ * (execution completion, TTL job, manual purge).
50
+ */
51
+ delete?(ref: Attachment): Promise<void>;
52
+ }
53
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/storage/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEnD,MAAM,WAAW,WAAW;IAC1B,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,2DAA2D;IAC3D,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,KAAK,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAEnE;;;;OAIG;IACH,IAAI,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAE3C;;;;OAIG;IACH,OAAO,CAAC,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE/D;;;;OAIG;IACH,MAAM,CAAC,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * StorageAdapter — host plug-in for blob storage.
3
+ *
4
+ * The runtime calls `store()` when files arrive at `POST /uploads`, and
5
+ * steps call `read()` (via a host-registered service) when they need the
6
+ * bytes. The framework never opens an attachment's `data` field — that's
7
+ * the host's reference and the host's adapter must understand it.
8
+ *
9
+ * Adapters live next to {@link PersistenceAdapter} / {@link QueueAdapter} /
10
+ * {@link SchedulerAdapter} in `RuntimeOptions`.
11
+ */
12
+ export {};
13
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/storage/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @xyne/workflow-sdk/testing — Test utilities for host consumers.
3
+ *
4
+ * Provides mock factories for WorkflowContext, StepExecutionContext,
5
+ * and ControlFlowExecutionContext. Intended for use in unit tests
6
+ * when writing custom steps and triggers.
7
+ */
8
+ export { createMockContext } from './mock-context.js';
9
+ export { createMockStepContext, createMockControlFlowContext, } from './mock-step-context.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @xyne/workflow-sdk/testing — Test utilities for host consumers.
3
+ *
4
+ * Provides mock factories for WorkflowContext, StepExecutionContext,
5
+ * and ControlFlowExecutionContext. Intended for use in unit tests
6
+ * when writing custom steps and triggers.
7
+ */
8
+ export { createMockContext } from './mock-context.js';
9
+ export { createMockStepContext, createMockControlFlowContext, } from './mock-step-context.js';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { WorkflowContext } from '../types/context.js';
2
+ /**
3
+ * Create a mock WorkflowContext for testing.
4
+ *
5
+ * Provides sensible defaults — override any field via the `overrides` param.
6
+ */
7
+ export declare function createMockContext(overrides?: Partial<WorkflowContext> & {
8
+ workflowId?: string;
9
+ metadata?: Record<string, unknown>;
10
+ triggerType?: string;
11
+ triggerData?: Record<string, unknown>;
12
+ }): WorkflowContext;
13
+ //# sourceMappingURL=mock-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-context.d.ts","sourceRoot":"","sources":["../../src/testing/mock-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC,GACA,eAAe,CAqBjB"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Create a mock WorkflowContext for testing.
3
+ *
4
+ * Provides sensible defaults — override any field via the `overrides` param.
5
+ */
6
+ export function createMockContext(overrides) {
7
+ const { workflowId, metadata, triggerType, triggerData, ...rest } = overrides ?? {};
8
+ return {
9
+ workflow: {
10
+ id: workflowId ?? 'wf_test',
11
+ metadata: metadata ?? {},
12
+ },
13
+ trigger: {
14
+ type: triggerType ?? 'TEST',
15
+ ...triggerData,
16
+ },
17
+ steps: {},
18
+ ...rest,
19
+ };
20
+ }
21
+ //# sourceMappingURL=mock-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-context.js","sourceRoot":"","sources":["../../src/testing/mock-context.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAKC;IAED,MAAM,EACJ,UAAU,EACV,QAAQ,EACR,WAAW,EACX,WAAW,EACX,GAAG,IAAI,EACR,GAAG,SAAS,IAAI,EAAE,CAAC;IAEpB,OAAO;QACL,QAAQ,EAAE;YACR,EAAE,EAAE,UAAU,IAAI,SAAS;YAC3B,QAAQ,EAAE,QAAQ,IAAI,EAAE;SACzB;QACD,OAAO,EAAE;YACP,IAAI,EAAE,WAAW,IAAI,MAAM;YAC3B,GAAG,WAAW;SACf;QACD,KAAK,EAAE,EAAE;QACT,GAAG,IAAI;KACR,CAAC;AACJ,CAAC"}