@swirls/looms 0.0.2 → 0.2.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 (375) hide show
  1. package/CHANGELOG.md +24 -2
  2. package/dist/actor/cell.d.ts +9 -4
  3. package/dist/actor/cell.js +7 -11
  4. package/dist/actor/host.d.ts +7 -3
  5. package/dist/actor/host.js +57 -33
  6. package/dist/actor/index.d.ts +1 -1
  7. package/dist/actor/index.js +1 -1
  8. package/dist/actor/routing.d.ts +12 -1
  9. package/dist/actor/routing.js +57 -51
  10. package/dist/agent/agent-session.d.ts +5 -0
  11. package/dist/agent/agent-session.js +270 -0
  12. package/dist/agent/debugger/agent-chat.d.ts +2 -0
  13. package/dist/agent/debugger/agent-chat.js +176 -0
  14. package/dist/agent/debugger/index.d.ts +5 -0
  15. package/dist/agent/debugger/index.js +19 -0
  16. package/dist/agent/debugger/summarize.d.ts +2 -0
  17. package/dist/agent/debugger/summarize.js +51 -0
  18. package/dist/agent/debugger/token-usage.d.ts +3 -0
  19. package/dist/agent/debugger/token-usage.js +11 -0
  20. package/dist/agent/definitions-store.d.ts +2 -3
  21. package/dist/agent/definitions-store.js +2 -4
  22. package/dist/agent/definitions.d.ts +47 -29
  23. package/dist/agent/definitions.js +39 -12
  24. package/dist/agent/effects.d.ts +359 -2
  25. package/dist/agent/effects.js +60 -34
  26. package/dist/agent/events.d.ts +175 -19
  27. package/dist/agent/events.js +45 -10
  28. package/dist/agent/index.d.ts +1 -0
  29. package/dist/agent/index.js +1 -0
  30. package/dist/agent/llm.d.ts +11 -2
  31. package/dist/agent/llm.js +13 -3
  32. package/dist/agent/module.d.ts +812 -78
  33. package/dist/agent/module.js +16 -4
  34. package/dist/agent/scope.d.ts +174 -18
  35. package/dist/agent/signals.d.ts +26 -1
  36. package/dist/agent/signals.js +79 -0
  37. package/dist/agent/threads.d.ts +3 -33
  38. package/dist/agent/threads.js +20 -25
  39. package/dist/agent/tool-schema.d.ts +1 -17
  40. package/dist/agent/tool-schema.js +3 -43
  41. package/dist/agent/types.d.ts +49 -4
  42. package/dist/agent/types.js +5 -5
  43. package/dist/ai-vercel/index.d.ts +1 -0
  44. package/dist/ai-vercel/index.js +1 -0
  45. package/dist/ai-vercel/messages.js +22 -7
  46. package/dist/ai-vercel/vercel-evaluator.d.ts +36 -0
  47. package/dist/ai-vercel/vercel-evaluator.js +73 -0
  48. package/dist/ai-vercel/vercel-llm.js +64 -44
  49. package/dist/approval/debugger/approvals-view.d.ts +3 -0
  50. package/dist/approval/debugger/approvals-view.js +16 -0
  51. package/dist/approval/debugger/index.d.ts +4 -0
  52. package/dist/approval/debugger/index.js +11 -0
  53. package/dist/approval/debugger/summarize.d.ts +2 -0
  54. package/dist/approval/debugger/summarize.js +17 -0
  55. package/dist/approval/effects.d.ts +89 -0
  56. package/dist/approval/module.d.ts +179 -29
  57. package/dist/approval/projections.d.ts +0 -14
  58. package/dist/approval/projections.js +20 -3
  59. package/dist/approval/signals.d.ts +2 -0
  60. package/dist/approval/signals.js +18 -2
  61. package/dist/cli/cli.js +2 -0
  62. package/dist/cli/commands.js +12 -16
  63. package/dist/client/client.d.ts +1213 -18
  64. package/dist/client/client.js +120 -120
  65. package/dist/client/index.d.ts +1 -1
  66. package/dist/client/index.js +1 -1
  67. package/dist/client/sse.d.ts +13 -0
  68. package/dist/client/sse.js +38 -44
  69. package/dist/cloudflare/alarm-scheduler.d.ts +12 -2
  70. package/dist/cloudflare/alarm-scheduler.js +34 -7
  71. package/dist/cloudflare/durable-object.d.ts +10 -2
  72. package/dist/cloudflare/durable-object.js +59 -28
  73. package/dist/cloudflare/event-store.d.ts +7 -2
  74. package/dist/cloudflare/event-store.js +8 -7
  75. package/dist/cloudflare/index.d.ts +2 -2
  76. package/dist/cloudflare/index.js +2 -2
  77. package/dist/cloudflare/router.d.ts +1 -1
  78. package/dist/cloudflare/router.js +15 -16
  79. package/dist/core/catalog.d.ts +3 -3
  80. package/dist/core/catalog.js +2 -5
  81. package/dist/core/coalesce.js +5 -3
  82. package/dist/core/compose.d.ts +2 -1
  83. package/dist/core/compose.js +19 -2
  84. package/dist/core/debugger-host.d.ts +16 -0
  85. package/dist/core/debugger-host.js +1 -0
  86. package/dist/core/definition-store.d.ts +11 -0
  87. package/dist/core/definition-store.js +6 -0
  88. package/dist/core/effects.d.ts +127 -15
  89. package/dist/core/effects.js +89 -17
  90. package/dist/core/envelope.d.ts +27 -7
  91. package/dist/core/envelope.js +20 -6
  92. package/dist/core/event-codec.d.ts +4 -2
  93. package/dist/core/event-codec.js +10 -5
  94. package/dist/core/event-index.js +1 -3
  95. package/dist/core/fold.d.ts +3 -0
  96. package/dist/core/fold.js +171 -24
  97. package/dist/core/ids.d.ts +5 -0
  98. package/dist/core/ids.js +35 -2
  99. package/dist/core/index.d.ts +7 -1
  100. package/dist/core/index.js +6 -1
  101. package/dist/core/kind.d.ts +22 -0
  102. package/dist/core/kind.js +17 -0
  103. package/dist/core/limits.d.ts +34 -0
  104. package/dist/core/limits.js +46 -0
  105. package/dist/core/match.d.ts +1 -0
  106. package/dist/core/match.js +10 -1
  107. package/dist/core/module-scope.d.ts +22 -20
  108. package/dist/core/module-scope.js +38 -28
  109. package/dist/core/module.d.ts +18 -5
  110. package/dist/core/module.js +4 -0
  111. package/dist/core/projection.d.ts +13 -13
  112. package/dist/core/projection.js +9 -5
  113. package/dist/core/protocol.d.ts +68 -11
  114. package/dist/core/protocol.js +82 -11
  115. package/dist/core/published.d.ts +43 -0
  116. package/dist/core/published.js +44 -0
  117. package/dist/core/replay.d.ts +312 -3
  118. package/dist/core/replay.js +11 -1
  119. package/dist/core/schema.d.ts +11 -20
  120. package/dist/core/schema.js +63 -80
  121. package/dist/core/serialize.js +2 -4
  122. package/dist/core/snapshot-store.d.ts +6 -1
  123. package/dist/core/snapshot-store.js +15 -2
  124. package/dist/core/snapshots.d.ts +5 -1
  125. package/dist/core/snapshots.js +10 -15
  126. package/dist/core/sqlite-store.js +95 -11
  127. package/dist/core/state.d.ts +142 -4
  128. package/dist/core/state.js +78 -0
  129. package/dist/core/store.d.ts +38 -3
  130. package/dist/core/store.js +77 -22
  131. package/dist/core/thread.d.ts +10 -9
  132. package/dist/core/types.d.ts +5 -8
  133. package/dist/core/types.js +28 -24
  134. package/dist/core/validate-event.js +14 -4
  135. package/dist/core/worker-callback.d.ts +17 -0
  136. package/dist/core/worker-callback.js +1 -0
  137. package/dist/debugger/app/assets/index-B3Ah8WAE.css +2 -0
  138. package/dist/debugger/app/assets/index-Qb371t_O.js +22 -0
  139. package/dist/debugger/app/assets/rolldown-runtime-CbXtAM7H.js +1 -0
  140. package/dist/debugger/app/assets/routes-CjtEHgPQ.js +47 -0
  141. package/dist/debugger/app/index.html +14 -0
  142. package/dist/debugger/components/composer.d.ts +17 -0
  143. package/dist/debugger/components/composer.js +25 -0
  144. package/dist/debugger/components/debugger-split.d.ts +2 -1
  145. package/dist/debugger/components/debugger-split.js +2 -2
  146. package/dist/debugger/components/event-inspector.d.ts +2 -1
  147. package/dist/debugger/components/event-inspector.js +25 -16
  148. package/dist/debugger/components/event-stream.d.ts +2 -1
  149. package/dist/debugger/components/event-stream.js +14 -74
  150. package/dist/debugger/components/follow-list.d.ts +19 -0
  151. package/dist/debugger/components/follow-list.js +96 -0
  152. package/dist/debugger/components/json-tree.d.ts +11 -0
  153. package/dist/debugger/components/json-tree.js +120 -0
  154. package/dist/debugger/components/json-view.js +2 -2
  155. package/dist/debugger/components/run-tree.js +53 -20
  156. package/dist/debugger/components/status-dot.d.ts +4 -0
  157. package/dist/debugger/components/status-dot.js +6 -2
  158. package/dist/debugger/context.d.ts +14 -0
  159. package/dist/debugger/context.js +17 -0
  160. package/dist/debugger/contracts.d.ts +7 -4
  161. package/dist/debugger/events/builtin-families.d.ts +3 -0
  162. package/dist/debugger/events/builtin-families.js +9 -0
  163. package/dist/debugger/events/catalog.d.ts +3 -4
  164. package/dist/debugger/events/catalog.js +27 -17
  165. package/dist/debugger/events/protocol-summarize.d.ts +1 -2
  166. package/dist/debugger/events/protocol-summarize.js +42 -24
  167. package/dist/debugger/index.d.ts +20 -6
  168. package/dist/debugger/index.js +19 -5
  169. package/dist/debugger/lib/cn.d.ts +1 -0
  170. package/dist/debugger/lib/cn.js +3 -0
  171. package/dist/debugger/lib/event-meta.d.ts +2 -3
  172. package/dist/debugger/lib/event-meta.js +6 -12
  173. package/dist/debugger/lib/json.d.ts +25 -0
  174. package/dist/debugger/lib/json.js +87 -0
  175. package/dist/debugger/lib/payload.d.ts +7 -0
  176. package/dist/debugger/lib/payload.js +11 -0
  177. package/dist/debugger/lib/time.d.ts +3 -0
  178. package/dist/debugger/lib/time.js +24 -0
  179. package/dist/debugger/plugin.d.ts +36 -0
  180. package/dist/debugger/plugin.js +14 -0
  181. package/dist/debugger/server/index.d.ts +14 -0
  182. package/dist/debugger/server/index.js +114 -0
  183. package/dist/debugger/shell/debugger-shell.d.ts +15 -0
  184. package/dist/debugger/shell/debugger-shell.js +43 -0
  185. package/dist/debugger/shell/definition-key.d.ts +3 -0
  186. package/dist/debugger/shell/definition-key.js +4 -0
  187. package/dist/debugger/shell/events-pane.d.ts +12 -0
  188. package/dist/debugger/shell/events-pane.js +25 -0
  189. package/dist/debugger/shell/projections-panel.d.ts +4 -0
  190. package/dist/debugger/shell/projections-panel.js +59 -0
  191. package/dist/debugger/shell/run-controls.d.ts +4 -0
  192. package/dist/debugger/shell/run-controls.js +72 -0
  193. package/dist/debugger/shell/run-search.d.ts +6 -0
  194. package/dist/debugger/shell/run-search.js +102 -0
  195. package/dist/debugger/shell/run-type-menu.d.ts +6 -0
  196. package/dist/debugger/shell/run-type-menu.js +11 -0
  197. package/dist/debugger/shell/schema-form.d.ts +31 -0
  198. package/dist/debugger/shell/schema-form.js +117 -0
  199. package/dist/debugger/shell/start-form.d.ts +3 -0
  200. package/dist/debugger/shell/start-form.js +75 -0
  201. package/dist/debugger/shell/use-start-run.d.ts +14 -0
  202. package/dist/debugger/shell/use-start-run.js +32 -0
  203. package/dist/debugger/shell/workspace.d.ts +6 -0
  204. package/dist/debugger/shell/workspace.js +15 -0
  205. package/dist/debugger/styles.css +111 -27
  206. package/dist/debugger/ui/button.d.ts +24 -0
  207. package/dist/debugger/ui/button.js +24 -0
  208. package/dist/debugger/ui/command.d.ts +9 -0
  209. package/dist/debugger/ui/command.js +24 -0
  210. package/dist/debugger/ui/dropdown-menu.d.ts +13 -0
  211. package/dist/debugger/ui/dropdown-menu.js +37 -0
  212. package/dist/debugger/ui/panel.d.ts +14 -0
  213. package/dist/debugger/ui/panel.js +16 -0
  214. package/dist/debugger/ui/popover.d.ts +7 -0
  215. package/dist/debugger/ui/popover.js +17 -0
  216. package/dist/debugger/ui/resizable.d.ts +7 -0
  217. package/dist/debugger/ui/resizable.js +14 -0
  218. package/dist/debugger/ui/scroll-area.d.ts +2 -1
  219. package/dist/debugger/ui/scroll-area.js +5 -3
  220. package/dist/debugger/ui/select.d.ts +10 -0
  221. package/dist/debugger/ui/select.js +21 -0
  222. package/dist/debugger/ui/tabs.js +2 -2
  223. package/dist/debugger/ui/textarea.d.ts +3 -0
  224. package/dist/debugger/ui/textarea.js +7 -0
  225. package/dist/evaluator/definitions-store.d.ts +11 -0
  226. package/dist/evaluator/definitions-store.js +8 -0
  227. package/dist/evaluator/definitions.d.ts +18 -0
  228. package/dist/evaluator/definitions.js +4 -0
  229. package/dist/evaluator/effects.d.ts +226 -0
  230. package/dist/evaluator/effects.js +132 -0
  231. package/dist/evaluator/evaluator.d.ts +24 -0
  232. package/dist/evaluator/evaluator.js +67 -0
  233. package/dist/evaluator/events.d.ts +59 -0
  234. package/dist/evaluator/events.js +21 -0
  235. package/dist/evaluator/index.d.ts +11 -0
  236. package/dist/evaluator/index.js +11 -0
  237. package/dist/evaluator/module.d.ts +606 -0
  238. package/dist/evaluator/module.js +25 -0
  239. package/dist/evaluator/projections.d.ts +50 -0
  240. package/dist/evaluator/projections.js +20 -0
  241. package/dist/evaluator/scope.d.ts +59 -0
  242. package/dist/evaluator/scope.js +7 -0
  243. package/dist/evaluator/signals.d.ts +3 -0
  244. package/dist/evaluator/signals.js +17 -0
  245. package/dist/evaluator/threads.d.ts +62 -0
  246. package/dist/evaluator/threads.js +117 -0
  247. package/dist/evaluator/types.d.ts +125 -0
  248. package/dist/evaluator/types.js +51 -0
  249. package/dist/projectors/delivery.d.ts +83 -0
  250. package/dist/projectors/delivery.js +182 -0
  251. package/dist/projectors/index-model.d.ts +1 -1
  252. package/dist/projectors/index-model.js +4 -6
  253. package/dist/projectors/index.d.ts +2 -0
  254. package/dist/projectors/index.js +2 -0
  255. package/dist/projectors/memory.d.ts +1 -1
  256. package/dist/projectors/memory.js +10 -8
  257. package/dist/projectors/postgres.js +44 -58
  258. package/dist/projectors/projector.d.ts +17 -0
  259. package/dist/projectors/projector.js +26 -1
  260. package/dist/projectors/sqlite-delivery.d.ts +4 -0
  261. package/dist/projectors/sqlite-delivery.js +147 -0
  262. package/dist/projectors/sqlite.js +23 -23
  263. package/dist/projectors/with-projectors.d.ts +7 -2
  264. package/dist/projectors/with-projectors.js +27 -28
  265. package/dist/react/notify.js +11 -8
  266. package/dist/react/react.d.ts +2 -3
  267. package/dist/react/react.js +14 -30
  268. package/dist/react/sse.d.ts +1 -1
  269. package/dist/react/sse.js +1 -1
  270. package/dist/react/store.d.ts +3 -3
  271. package/dist/react/store.js +109 -119
  272. package/dist/runtime/cancellation.d.ts +16 -0
  273. package/dist/runtime/cancellation.js +129 -0
  274. package/dist/runtime/deadline-transition-planner.d.ts +31 -0
  275. package/dist/runtime/deadline-transition-planner.js +139 -0
  276. package/dist/runtime/dispatch-effect.d.ts +3 -2
  277. package/dist/runtime/dispatch-effect.js +7 -13
  278. package/dist/runtime/errors.d.ts +51 -0
  279. package/dist/runtime/errors.js +39 -0
  280. package/dist/runtime/{runtime-helpers.d.ts → helpers.d.ts} +24 -4
  281. package/dist/runtime/{runtime-helpers.js → helpers.js} +56 -19
  282. package/dist/runtime/index.d.ts +3 -3
  283. package/dist/runtime/index.js +3 -3
  284. package/dist/runtime/ingress.d.ts +15 -0
  285. package/dist/runtime/ingress.js +42 -0
  286. package/dist/runtime/local-effect-executor.d.ts +21 -0
  287. package/dist/runtime/local-effect-executor.js +137 -0
  288. package/dist/runtime/looms.d.ts +30 -4
  289. package/dist/runtime/looms.js +57 -37
  290. package/dist/runtime/observer.d.ts +45 -0
  291. package/dist/runtime/observer.js +11 -0
  292. package/dist/runtime/repository.d.ts +55 -0
  293. package/dist/runtime/repository.js +293 -0
  294. package/dist/runtime/retry-policy.d.ts +16 -0
  295. package/dist/runtime/retry-policy.js +29 -0
  296. package/dist/runtime/run-execution-context.d.ts +30 -0
  297. package/dist/runtime/run-execution-context.js +56 -0
  298. package/dist/runtime/run-start.d.ts +4 -0
  299. package/dist/runtime/run-start.js +44 -0
  300. package/dist/runtime/runtime.d.ts +6 -87
  301. package/dist/runtime/runtime.js +248 -470
  302. package/dist/runtime/server/auth.d.ts +41 -0
  303. package/dist/runtime/server/auth.js +45 -0
  304. package/dist/runtime/server/debugger-host.d.ts +11 -0
  305. package/dist/runtime/server/debugger-host.js +32 -0
  306. package/dist/runtime/server/fetch-handler.d.ts +18 -0
  307. package/dist/runtime/server/fetch-handler.js +62 -0
  308. package/dist/runtime/server/http.d.ts +38 -0
  309. package/dist/runtime/server/http.js +66 -0
  310. package/dist/runtime/server/route-table.d.ts +55 -0
  311. package/dist/runtime/server/route-table.js +74 -0
  312. package/dist/runtime/server/routes/definitions.d.ts +3 -0
  313. package/dist/runtime/server/routes/definitions.js +20 -0
  314. package/dist/runtime/server/routes/effects.d.ts +3 -0
  315. package/dist/runtime/server/routes/effects.js +59 -0
  316. package/dist/runtime/server/routes/operations.d.ts +3 -0
  317. package/dist/runtime/server/routes/operations.js +14 -0
  318. package/dist/runtime/server/routes/runs.d.ts +3 -0
  319. package/dist/runtime/server/routes/runs.js +199 -0
  320. package/dist/runtime/server.d.ts +4 -8
  321. package/dist/runtime/server.js +6 -211
  322. package/dist/runtime/sse.d.ts +2 -1
  323. package/dist/runtime/sse.js +24 -17
  324. package/dist/runtime/types.d.ts +117 -0
  325. package/dist/runtime/types.js +1 -0
  326. package/dist/runtime/wake-engine.d.ts +20 -0
  327. package/dist/runtime/wake-engine.js +311 -0
  328. package/dist/runtime/wake-scheduler.d.ts +3 -4
  329. package/dist/runtime/wake-scheduler.js +25 -31
  330. package/dist/runtime/worker-callbacks.d.ts +16 -0
  331. package/dist/runtime/worker-callbacks.js +167 -0
  332. package/dist/runtime/worker-effect-dispatch.d.ts +36 -0
  333. package/dist/runtime/worker-effect-dispatch.js +126 -0
  334. package/dist/s2/config.d.ts +1 -1
  335. package/dist/s2/config.js +1 -1
  336. package/dist/s2/lite.js +70 -82
  337. package/dist/s2/pagination.d.ts +15 -0
  338. package/dist/s2/pagination.js +36 -0
  339. package/dist/s2/projector.js +6 -5
  340. package/dist/s2/snapshot-store.js +188 -161
  341. package/dist/s2/store.d.ts +3 -21
  342. package/dist/s2/store.js +71 -165
  343. package/dist/testing/index.d.ts +15 -0
  344. package/dist/testing/index.js +53 -16
  345. package/dist/workflow/debugger/index.d.ts +4 -0
  346. package/dist/workflow/debugger/index.js +11 -0
  347. package/dist/workflow/debugger/nodes-view.d.ts +3 -0
  348. package/dist/workflow/debugger/nodes-view.js +13 -0
  349. package/dist/workflow/debugger/summarize.d.ts +2 -0
  350. package/dist/workflow/debugger/summarize.js +30 -0
  351. package/dist/workflow/definitions-store.d.ts +2 -3
  352. package/dist/workflow/definitions-store.js +2 -2
  353. package/dist/workflow/definitions.d.ts +78 -22
  354. package/dist/workflow/definitions.js +80 -14
  355. package/dist/workflow/effects.d.ts +453 -107
  356. package/dist/workflow/effects.js +214 -115
  357. package/dist/workflow/events.d.ts +149 -5
  358. package/dist/workflow/events.js +27 -5
  359. package/dist/workflow/graph.d.ts +56 -0
  360. package/dist/workflow/graph.js +207 -0
  361. package/dist/workflow/index.d.ts +1 -0
  362. package/dist/workflow/index.js +1 -0
  363. package/dist/workflow/module.d.ts +1047 -266
  364. package/dist/workflow/projections.d.ts +14 -12
  365. package/dist/workflow/projections.js +30 -8
  366. package/dist/workflow/scope.d.ts +146 -4
  367. package/dist/workflow/threads.d.ts +383 -155
  368. package/dist/workflow/threads.js +308 -110
  369. package/package.json +26 -2
  370. package/dist/debugger/events/domain-summarize.d.ts +0 -3
  371. package/dist/debugger/events/domain-summarize.js +0 -107
  372. package/dist/debugger/events/family.d.ts +0 -8
  373. package/dist/debugger/events/family.js +0 -44
  374. package/dist/runtime/events-api.d.ts +0 -4
  375. package/dist/runtime/events-api.js +0 -84
@@ -10,44 +10,204 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
10
10
  readonly nodeId: import("effect/Schema").String;
11
11
  readonly result: import("effect/Schema").NullOr<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
12
12
  readonly error: import("effect/Schema").NullOr<import("effect/Schema").String>;
13
+ readonly branch: import("effect/Schema").optional<import("effect/Schema").String>;
13
14
  }>;
14
15
  'node.skipped': import("effect/Schema").Struct<{
15
16
  readonly nodeId: import("effect/Schema").String;
16
17
  readonly reason: import("effect/Schema").String;
18
+ readonly cause: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"inactive">, import("effect/Schema").Literal<"policy">]>, never>;
17
19
  }>;
18
20
  'spawn.requested': import("effect/Schema").Struct<{
19
21
  readonly nodeId: import("effect/Schema").String;
22
+ readonly attempt: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").Finite, never>;
20
23
  readonly childThreadId: import("effect/Schema").String;
21
24
  readonly kind: import("effect/Schema").String;
22
25
  readonly definitionName: import("effect/Schema").String;
26
+ readonly definitionVersion: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").String, never>;
23
27
  readonly input: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
28
+ readonly loopIndex: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").NullOr<import("effect/Schema").Finite>, never>;
29
+ }>;
30
+ 'map.requested': import("effect/Schema").Struct<{
31
+ readonly nodeId: import("effect/Schema").String;
32
+ readonly attempt: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").Finite, never>;
33
+ readonly kind: import("effect/Schema").String;
34
+ readonly definitionName: import("effect/Schema").String;
35
+ readonly definitionVersion: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").String, never>;
36
+ readonly items: import("effect/Schema").$Array<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
37
+ readonly concurrency: import("effect/Schema").Finite;
38
+ readonly limitBytes: import("effect/Schema").Finite;
24
39
  }>;
25
40
  'sleep.requested': import("effect/Schema").Struct<{
26
41
  readonly nodeId: import("effect/Schema").String;
27
42
  readonly waitId: import("effect/Schema").String;
28
- readonly wakeAt: import("effect/Schema").Number;
43
+ readonly wakeAt: import("effect/Schema").Finite;
29
44
  }>;
30
45
  'effects.requested': import("effect/Schema").Struct<{
31
46
  readonly nodeId: import("effect/Schema").String;
32
- readonly effects: import("effect/Schema").$Array<import("effect/Schema").Schema<import("@swirls/looms/core").RuntimeEffect>>;
47
+ readonly effects: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
48
+ readonly type: import("effect/Schema").Literal<"runtime.spawn">;
49
+ readonly childThreadId: import("effect/Schema").String;
50
+ readonly kind: import("effect/Schema").String;
51
+ readonly definitionName: import("effect/Schema").String;
52
+ readonly definitionVersion: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").String, never>;
53
+ readonly input: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
54
+ }>, import("effect/Schema").Struct<{
55
+ readonly type: import("effect/Schema").Literal<"runtime.wait">;
56
+ readonly waitId: import("effect/Schema").String;
57
+ readonly on: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
58
+ readonly type: import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>]>;
59
+ readonly match: import("effect/Schema").optional<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
60
+ }>, import("effect/Schema").Struct<{
61
+ readonly timerAt: import("effect/Schema").Finite;
62
+ }>]>;
63
+ readonly tag: import("effect/Schema").optional<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
64
+ }>, import("effect/Schema").Struct<{
65
+ readonly type: import("effect/Schema").Literal<"runtime.emit">;
66
+ readonly event: import("effect/Schema").Struct<{
67
+ readonly type: import("effect/Schema").String;
68
+ readonly payload: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
69
+ readonly threadId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
70
+ readonly parentThreadId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
71
+ readonly causationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
72
+ readonly correlationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
73
+ readonly effectId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
74
+ readonly origin: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
75
+ readonly type: import("effect/Schema").Literal<"thread">;
76
+ readonly threadId: import("effect/Schema").String;
77
+ }>, import("effect/Schema").Struct<{
78
+ readonly type: import("effect/Schema").Literal<"external">;
79
+ readonly actorId: import("effect/Schema").optional<import("effect/Schema").String>;
80
+ }>, import("effect/Schema").Struct<{
81
+ readonly type: import("effect/Schema").Literal<"system">;
82
+ }>]>>;
83
+ readonly ephemeral: import("effect/Schema").optional<import("effect/Schema").Boolean>;
84
+ readonly id: import("effect/Schema").optional<import("effect/Schema").String>;
85
+ readonly ts: import("effect/Schema").optional<import("effect/Schema").Finite>;
86
+ readonly idempotencyKey: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
87
+ }>;
88
+ readonly tag: import("effect/Schema").optional<import("effect/Schema").String>;
89
+ }>, import("effect/Schema").Struct<{
90
+ readonly type: import("effect/Schema").Literal<"runtime.complete">;
91
+ readonly output: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
92
+ }>, import("effect/Schema").Struct<{
93
+ readonly type: import("effect/Schema").Literal<"runtime.fail">;
94
+ readonly error: import("effect/Schema").String;
95
+ }>, import("effect/Schema").Struct<{
96
+ readonly type: import("effect/Schema").Literal<"runtime.cancel">;
97
+ readonly threadId: import("effect/Schema").String;
98
+ readonly tag: import("effect/Schema").optional<import("effect/Schema").String>;
99
+ }>, import("effect/Schema").Struct<{
100
+ readonly type: import("effect/Schema").String;
101
+ readonly input: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
102
+ readonly tag: import("effect/Schema").optional<import("effect/Schema").String>;
103
+ }>]>>;
33
104
  }>;
34
105
  }>, {
35
106
  schedule: import("@swirls/looms/core").EffectDefinition<{
36
107
  readonly definitionName?: string | undefined;
108
+ readonly definitionVersion: string;
37
109
  readonly nodes?: {
38
110
  readonly [x: string]: {
39
111
  readonly status: "completed" | "failed" | "pending" | "running" | "skipped";
40
112
  readonly result: import("effect/Schema").Json;
41
113
  readonly error: string | null;
114
+ readonly attempts?: number | undefined;
115
+ readonly branch?: string | undefined;
116
+ readonly skipCause?: "inactive" | "policy" | undefined;
117
+ readonly iteration?: {
118
+ readonly index: number;
119
+ readonly previous: import("effect/Schema").Json;
120
+ } | undefined;
42
121
  };
43
122
  } | undefined;
44
123
  readonly input?: import("effect/Schema").Json | undefined;
45
124
  }, import("./definitions-store").WorkflowDefinitionsTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
125
+ readonly type: "runtime.effect.ambiguous";
126
+ readonly payload: {
127
+ readonly effectId: string;
128
+ readonly attempt: number;
129
+ readonly error: string;
130
+ };
131
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
132
+ readonly type: "runtime.effect.attempt.started";
133
+ readonly payload: {
134
+ readonly effectId: string;
135
+ readonly attempt: number;
136
+ };
137
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
138
+ readonly type: "runtime.effect.cancel.requested";
139
+ readonly payload: {
140
+ readonly effectId: string;
141
+ readonly attempt: number;
142
+ readonly deadlineAt: number | null;
143
+ };
144
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
145
+ readonly type: "runtime.effect.cancelled";
146
+ readonly payload: {
147
+ readonly effectId: string;
148
+ readonly attempt: number;
149
+ };
150
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
151
+ readonly type: "runtime.effect.completed";
152
+ readonly payload: {
153
+ readonly effectId: string;
154
+ readonly attempt: number;
155
+ };
156
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
157
+ readonly type: "runtime.effect.dispatched";
158
+ readonly payload: {
159
+ readonly effectId: string;
160
+ readonly attempt: number;
161
+ readonly deadlineAt: number | null;
162
+ };
163
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
46
164
  readonly type: "runtime.effect.failed";
47
165
  readonly payload: {
48
166
  readonly effectId: string;
49
167
  readonly error: string;
50
168
  };
169
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
170
+ readonly type: "runtime.effect.heartbeat";
171
+ readonly payload: {
172
+ readonly effectId: string;
173
+ readonly attempt: number;
174
+ readonly heartbeatAt: number;
175
+ readonly deadlineAt: number | null;
176
+ };
177
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
178
+ readonly type: "runtime.effect.queued";
179
+ readonly payload: {
180
+ readonly effectId: string;
181
+ readonly attempt: number;
182
+ readonly deadlineAt: number | null;
183
+ };
184
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
185
+ readonly type: "runtime.effect.retry.scheduled";
186
+ readonly payload: {
187
+ readonly effectId: string;
188
+ readonly attempt: number;
189
+ readonly nextAttemptAt: number;
190
+ readonly error: string;
191
+ };
192
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
193
+ readonly type: "runtime.effect.timed_out";
194
+ readonly payload: {
195
+ readonly effectId: string;
196
+ readonly attempt: number;
197
+ readonly timeout: string;
198
+ };
199
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
200
+ readonly type: "runtime.effect.worker.started";
201
+ readonly payload: {
202
+ readonly effectId: string;
203
+ readonly attempt: number;
204
+ readonly deadlineAt: number | null;
205
+ };
206
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
207
+ readonly type: "runtime.run.cancelled";
208
+ readonly payload: {
209
+ readonly reason?: string | undefined;
210
+ };
51
211
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
52
212
  readonly type: "runtime.run.completed";
53
213
  readonly payload: {
@@ -60,7 +220,9 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
60
220
  readonly rootThreadId?: string | undefined;
61
221
  readonly kind: string;
62
222
  readonly definitionName: string;
223
+ readonly definitionVersion: string;
63
224
  readonly input: import("effect/Schema").Json;
225
+ readonly requestedThreadId?: string | null | undefined;
64
226
  };
65
227
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
66
228
  readonly type: "runtime.signal.received";
@@ -74,6 +236,11 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
74
236
  readonly stateHash: string;
75
237
  readonly state?: import("effect/Schema").Json | undefined;
76
238
  };
239
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
240
+ readonly type: "runtime.thread.cancel.requested";
241
+ readonly payload: {
242
+ readonly threadId: string;
243
+ };
77
244
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
78
245
  readonly type: "runtime.thread.cancelled";
79
246
  readonly payload: {
@@ -98,6 +265,7 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
98
265
  readonly threadId: string;
99
266
  readonly kind: string;
100
267
  readonly definitionName: string;
268
+ readonly definitionVersion: string;
101
269
  readonly input: import("effect/Schema").Json;
102
270
  readonly parentThreadId: string | null;
103
271
  };
@@ -142,7 +310,75 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
142
310
  readonly type: "workflow.effects.requested";
143
311
  readonly payload: {
144
312
  readonly nodeId: string;
145
- readonly effects: readonly import("@swirls/looms/core").RuntimeEffect[];
313
+ readonly effects: readonly ({
314
+ readonly type: "runtime.spawn";
315
+ readonly childThreadId: string;
316
+ readonly kind: string;
317
+ readonly definitionName: string;
318
+ readonly definitionVersion: string;
319
+ readonly input: import("effect/Schema").Json;
320
+ } | {
321
+ readonly type: "runtime.wait";
322
+ readonly waitId: string;
323
+ readonly on: {
324
+ readonly type: string | readonly string[];
325
+ readonly match?: import("effect/Schema").Json | undefined;
326
+ } | {
327
+ readonly timerAt: number;
328
+ };
329
+ readonly tag?: import("effect/Schema").Json | undefined;
330
+ } | {
331
+ readonly type: "runtime.emit";
332
+ readonly event: {
333
+ readonly type: string;
334
+ readonly payload: import("effect/Schema").Json;
335
+ readonly threadId?: string | null | undefined;
336
+ readonly parentThreadId?: string | null | undefined;
337
+ readonly causationId?: string | null | undefined;
338
+ readonly correlationId?: string | null | undefined;
339
+ readonly effectId?: string | null | undefined;
340
+ readonly origin?: {
341
+ readonly type: "thread";
342
+ readonly threadId: string;
343
+ } | {
344
+ readonly type: "external";
345
+ readonly actorId?: string | undefined;
346
+ } | {
347
+ readonly type: "system";
348
+ } | undefined;
349
+ readonly ephemeral?: boolean | undefined;
350
+ readonly id?: string | undefined;
351
+ readonly ts?: number | undefined;
352
+ readonly idempotencyKey?: string | null | undefined;
353
+ };
354
+ readonly tag?: string | undefined;
355
+ } | {
356
+ readonly type: "runtime.complete";
357
+ readonly output: import("effect/Schema").Json;
358
+ } | {
359
+ readonly type: "runtime.fail";
360
+ readonly error: string;
361
+ } | {
362
+ readonly type: "runtime.cancel";
363
+ readonly threadId: string;
364
+ readonly tag?: string | undefined;
365
+ } | {
366
+ readonly type: string;
367
+ readonly input: import("effect/Schema").Json;
368
+ readonly tag?: string | undefined;
369
+ })[];
370
+ };
371
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
372
+ readonly type: "workflow.map.requested";
373
+ readonly payload: {
374
+ readonly nodeId: string;
375
+ readonly attempt: number;
376
+ readonly kind: string;
377
+ readonly definitionName: string;
378
+ readonly definitionVersion: string;
379
+ readonly items: readonly import("effect/Schema").Json[];
380
+ readonly concurrency: number;
381
+ readonly limitBytes: number;
146
382
  };
147
383
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
148
384
  readonly type: "workflow.node.finished";
@@ -150,12 +386,14 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
150
386
  readonly nodeId: string;
151
387
  readonly result: import("effect/Schema").Json;
152
388
  readonly error: string | null;
389
+ readonly branch?: string | undefined;
153
390
  };
154
391
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
155
392
  readonly type: "workflow.node.skipped";
156
393
  readonly payload: {
157
394
  readonly nodeId: string;
158
395
  readonly reason: string;
396
+ readonly cause: "inactive" | "policy";
159
397
  };
160
398
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
161
399
  readonly type: "workflow.node.started";
@@ -173,25 +411,126 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
173
411
  readonly type: "workflow.spawn.requested";
174
412
  readonly payload: {
175
413
  readonly nodeId: string;
414
+ readonly attempt: number;
176
415
  readonly childThreadId: string;
177
416
  readonly kind: string;
178
417
  readonly definitionName: string;
418
+ readonly definitionVersion: string;
179
419
  readonly input: import("effect/Schema").Json;
420
+ readonly loopIndex: number | null;
180
421
  };
181
422
  })>;
182
423
  runNode: import("@swirls/looms/core").EffectDefinition<{
183
424
  readonly definitionName?: string | undefined;
425
+ readonly definitionVersion: string;
184
426
  readonly nodeId: string;
427
+ readonly attempt: number;
428
+ readonly iteration?: {
429
+ readonly index: number;
430
+ readonly previous: import("effect/Schema").Json;
431
+ } | undefined;
185
432
  readonly input?: import("effect/Schema").Json | undefined;
186
- readonly results?: {
187
- readonly [x: string]: import("effect/Schema").Json;
433
+ readonly nodes?: {
434
+ readonly [x: string]: {
435
+ readonly status: "completed" | "failed" | "pending" | "running" | "skipped";
436
+ readonly result: import("effect/Schema").Json;
437
+ readonly error: string | null;
438
+ readonly attempts?: number | undefined;
439
+ readonly branch?: string | undefined;
440
+ readonly skipCause?: "inactive" | "policy" | undefined;
441
+ readonly iteration?: {
442
+ readonly index: number;
443
+ readonly previous: import("effect/Schema").Json;
444
+ } | undefined;
445
+ };
188
446
  } | undefined;
189
447
  }, import("./definitions-store").WorkflowDefinitionsTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
448
+ readonly type: "runtime.effect.ambiguous";
449
+ readonly payload: {
450
+ readonly effectId: string;
451
+ readonly attempt: number;
452
+ readonly error: string;
453
+ };
454
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
455
+ readonly type: "runtime.effect.attempt.started";
456
+ readonly payload: {
457
+ readonly effectId: string;
458
+ readonly attempt: number;
459
+ };
460
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
461
+ readonly type: "runtime.effect.cancel.requested";
462
+ readonly payload: {
463
+ readonly effectId: string;
464
+ readonly attempt: number;
465
+ readonly deadlineAt: number | null;
466
+ };
467
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
468
+ readonly type: "runtime.effect.cancelled";
469
+ readonly payload: {
470
+ readonly effectId: string;
471
+ readonly attempt: number;
472
+ };
473
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
474
+ readonly type: "runtime.effect.completed";
475
+ readonly payload: {
476
+ readonly effectId: string;
477
+ readonly attempt: number;
478
+ };
479
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
480
+ readonly type: "runtime.effect.dispatched";
481
+ readonly payload: {
482
+ readonly effectId: string;
483
+ readonly attempt: number;
484
+ readonly deadlineAt: number | null;
485
+ };
486
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
190
487
  readonly type: "runtime.effect.failed";
191
488
  readonly payload: {
192
489
  readonly effectId: string;
193
490
  readonly error: string;
194
491
  };
492
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
493
+ readonly type: "runtime.effect.heartbeat";
494
+ readonly payload: {
495
+ readonly effectId: string;
496
+ readonly attempt: number;
497
+ readonly heartbeatAt: number;
498
+ readonly deadlineAt: number | null;
499
+ };
500
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
501
+ readonly type: "runtime.effect.queued";
502
+ readonly payload: {
503
+ readonly effectId: string;
504
+ readonly attempt: number;
505
+ readonly deadlineAt: number | null;
506
+ };
507
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
508
+ readonly type: "runtime.effect.retry.scheduled";
509
+ readonly payload: {
510
+ readonly effectId: string;
511
+ readonly attempt: number;
512
+ readonly nextAttemptAt: number;
513
+ readonly error: string;
514
+ };
515
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
516
+ readonly type: "runtime.effect.timed_out";
517
+ readonly payload: {
518
+ readonly effectId: string;
519
+ readonly attempt: number;
520
+ readonly timeout: string;
521
+ };
522
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
523
+ readonly type: "runtime.effect.worker.started";
524
+ readonly payload: {
525
+ readonly effectId: string;
526
+ readonly attempt: number;
527
+ readonly deadlineAt: number | null;
528
+ };
529
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
530
+ readonly type: "runtime.run.cancelled";
531
+ readonly payload: {
532
+ readonly reason?: string | undefined;
533
+ };
195
534
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
196
535
  readonly type: "runtime.run.completed";
197
536
  readonly payload: {
@@ -204,7 +543,9 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
204
543
  readonly rootThreadId?: string | undefined;
205
544
  readonly kind: string;
206
545
  readonly definitionName: string;
546
+ readonly definitionVersion: string;
207
547
  readonly input: import("effect/Schema").Json;
548
+ readonly requestedThreadId?: string | null | undefined;
208
549
  };
209
550
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
210
551
  readonly type: "runtime.signal.received";
@@ -218,6 +559,11 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
218
559
  readonly stateHash: string;
219
560
  readonly state?: import("effect/Schema").Json | undefined;
220
561
  };
562
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
563
+ readonly type: "runtime.thread.cancel.requested";
564
+ readonly payload: {
565
+ readonly threadId: string;
566
+ };
221
567
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
222
568
  readonly type: "runtime.thread.cancelled";
223
569
  readonly payload: {
@@ -242,6 +588,7 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
242
588
  readonly threadId: string;
243
589
  readonly kind: string;
244
590
  readonly definitionName: string;
591
+ readonly definitionVersion: string;
245
592
  readonly input: import("effect/Schema").Json;
246
593
  readonly parentThreadId: string | null;
247
594
  };
@@ -286,7 +633,75 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
286
633
  readonly type: "workflow.effects.requested";
287
634
  readonly payload: {
288
635
  readonly nodeId: string;
289
- readonly effects: readonly import("@swirls/looms/core").RuntimeEffect[];
636
+ readonly effects: readonly ({
637
+ readonly type: "runtime.spawn";
638
+ readonly childThreadId: string;
639
+ readonly kind: string;
640
+ readonly definitionName: string;
641
+ readonly definitionVersion: string;
642
+ readonly input: import("effect/Schema").Json;
643
+ } | {
644
+ readonly type: "runtime.wait";
645
+ readonly waitId: string;
646
+ readonly on: {
647
+ readonly type: string | readonly string[];
648
+ readonly match?: import("effect/Schema").Json | undefined;
649
+ } | {
650
+ readonly timerAt: number;
651
+ };
652
+ readonly tag?: import("effect/Schema").Json | undefined;
653
+ } | {
654
+ readonly type: "runtime.emit";
655
+ readonly event: {
656
+ readonly type: string;
657
+ readonly payload: import("effect/Schema").Json;
658
+ readonly threadId?: string | null | undefined;
659
+ readonly parentThreadId?: string | null | undefined;
660
+ readonly causationId?: string | null | undefined;
661
+ readonly correlationId?: string | null | undefined;
662
+ readonly effectId?: string | null | undefined;
663
+ readonly origin?: {
664
+ readonly type: "thread";
665
+ readonly threadId: string;
666
+ } | {
667
+ readonly type: "external";
668
+ readonly actorId?: string | undefined;
669
+ } | {
670
+ readonly type: "system";
671
+ } | undefined;
672
+ readonly ephemeral?: boolean | undefined;
673
+ readonly id?: string | undefined;
674
+ readonly ts?: number | undefined;
675
+ readonly idempotencyKey?: string | null | undefined;
676
+ };
677
+ readonly tag?: string | undefined;
678
+ } | {
679
+ readonly type: "runtime.complete";
680
+ readonly output: import("effect/Schema").Json;
681
+ } | {
682
+ readonly type: "runtime.fail";
683
+ readonly error: string;
684
+ } | {
685
+ readonly type: "runtime.cancel";
686
+ readonly threadId: string;
687
+ readonly tag?: string | undefined;
688
+ } | {
689
+ readonly type: string;
690
+ readonly input: import("effect/Schema").Json;
691
+ readonly tag?: string | undefined;
692
+ })[];
693
+ };
694
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
695
+ readonly type: "workflow.map.requested";
696
+ readonly payload: {
697
+ readonly nodeId: string;
698
+ readonly attempt: number;
699
+ readonly kind: string;
700
+ readonly definitionName: string;
701
+ readonly definitionVersion: string;
702
+ readonly items: readonly import("effect/Schema").Json[];
703
+ readonly concurrency: number;
704
+ readonly limitBytes: number;
290
705
  };
291
706
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
292
707
  readonly type: "workflow.node.finished";
@@ -294,12 +709,14 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
294
709
  readonly nodeId: string;
295
710
  readonly result: import("effect/Schema").Json;
296
711
  readonly error: string | null;
712
+ readonly branch?: string | undefined;
297
713
  };
298
714
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
299
715
  readonly type: "workflow.node.skipped";
300
716
  readonly payload: {
301
717
  readonly nodeId: string;
302
718
  readonly reason: string;
719
+ readonly cause: "inactive" | "policy";
303
720
  };
304
721
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
305
722
  readonly type: "workflow.node.started";
@@ -317,141 +734,155 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
317
734
  readonly type: "workflow.spawn.requested";
318
735
  readonly payload: {
319
736
  readonly nodeId: string;
737
+ readonly attempt: number;
320
738
  readonly childThreadId: string;
321
739
  readonly kind: string;
322
740
  readonly definitionName: string;
741
+ readonly definitionVersion: string;
323
742
  readonly input: import("effect/Schema").Json;
743
+ readonly loopIndex: number | null;
324
744
  };
325
745
  })>;
326
746
  }, {
327
747
  workflow: import("@swirls/looms/core").ThreadDefinition<{
328
- definitionName?: string;
329
- concurrency: number;
330
- input: import("@swirls/looms/core").JsonValue;
331
- nodeIds: string[];
332
- nodes: {
333
- [x: string]: {
748
+ readonly definitionName?: string | undefined;
749
+ readonly definitionVersion?: string | undefined;
750
+ readonly nodes: {
751
+ readonly [x: string]: {
334
752
  readonly status: "completed" | "failed" | "pending" | "running" | "skipped";
335
753
  readonly result: import("effect/Schema").Json;
336
754
  readonly error: string | null;
755
+ readonly attempts?: number | undefined;
756
+ readonly branch?: string | undefined;
757
+ readonly skipCause?: "inactive" | "policy" | undefined;
758
+ readonly iteration?: {
759
+ readonly index: number;
760
+ readonly previous: import("effect/Schema").Json;
761
+ } | undefined;
762
+ };
763
+ };
764
+ readonly concurrency: number;
765
+ readonly input: import("effect/Schema").Json;
766
+ readonly nodeIds: string[];
767
+ readonly needsSchedule: boolean;
768
+ readonly runningNodes: string[];
769
+ readonly pendingSpawns: {
770
+ readonly childThreadId: string;
771
+ readonly kind: string;
772
+ readonly definitionName: string;
773
+ readonly definitionVersion: string;
774
+ readonly nodeId: string;
775
+ readonly attempt: number;
776
+ readonly input: import("effect/Schema").Json;
777
+ readonly loopIndex: number | null;
778
+ }[];
779
+ readonly pendingMaps: {
780
+ readonly nodeId: string;
781
+ readonly attempt: number;
782
+ readonly kind: string;
783
+ readonly definitionName: string;
784
+ readonly definitionVersion: string;
785
+ readonly items: readonly import("effect/Schema").Json[];
786
+ readonly concurrency: number;
787
+ readonly limitBytes: number;
788
+ readonly nextIndex: number;
789
+ readonly outputs: {
790
+ readonly [x: string]: import("effect/Schema").Json;
791
+ };
792
+ }[];
793
+ readonly pendingSleeps: {
794
+ readonly waitId: string;
795
+ readonly wakeAt: number;
796
+ readonly nodeId: string;
797
+ }[];
798
+ readonly pendingEffects: {
799
+ readonly nodeId: string;
800
+ readonly effects: ({
801
+ readonly type: "runtime.spawn";
802
+ readonly childThreadId: string;
803
+ readonly kind: string;
804
+ readonly definitionName: string;
805
+ readonly definitionVersion: string;
806
+ readonly input: import("effect/Schema").Json;
337
807
  } | {
338
- status: string;
339
- result: string | number | boolean | import("effect/Schema").JsonArray | import("effect/Schema").JsonObject | null;
340
- error: string | null;
341
- };
342
- };
343
- runningNodes: string[];
344
- pendingSpawns: import("./threads").WorkflowPendingSpawn[];
345
- pendingSleeps: import("./threads").WorkflowPendingSleep[];
346
- pendingEffects: import("./threads").WorkflowPendingEffects[];
347
- pendingEmits: import("./threads").WorkflowPendingEmit[];
348
- status: "completed" | "failed" | "running";
349
- error: string | null;
350
- needsSchedule: boolean;
351
- } | {
352
- definitionName?: string;
353
- nodes: {
354
- [nodeId: string]: import("./definitions").NodeState;
355
- };
356
- concurrency: number;
357
- input: import("@swirls/looms/core").JsonValue;
358
- nodeIds: string[];
359
- needsSchedule: boolean;
360
- runningNodes: string[];
361
- pendingSpawns: import("./threads").WorkflowPendingSpawn[];
362
- pendingSleeps: import("./threads").WorkflowPendingSleep[];
363
- pendingEmits: import("./threads").WorkflowPendingEmit[];
364
- status: 'running' | 'completed' | 'failed';
365
- error: string | null;
366
- pendingEffects: (import("./threads").WorkflowPendingEffects | {
367
- nodeId: string;
368
- effects: (import("@swirls/looms/core").InvokeEffect | import("@swirls/looms/core").WaitEffect | {
369
- type: 'runtime.wait';
370
- waitId: string;
371
- on: import("@swirls/looms/core").WaitCondition;
372
- tag: {
373
- nodeId: string;
808
+ readonly type: "runtime.wait";
809
+ readonly waitId: string;
810
+ readonly on: {
811
+ readonly type: string | readonly string[];
812
+ readonly match?: import("effect/Schema").Json | undefined;
813
+ } | {
814
+ readonly timerAt: number;
374
815
  };
816
+ readonly tag?: import("effect/Schema").Json | undefined;
375
817
  } | {
376
- type: 'runtime.cancel';
377
- threadId: string;
378
- tag: string;
818
+ readonly type: "runtime.emit";
819
+ readonly event: {
820
+ readonly type: string;
821
+ readonly payload: import("effect/Schema").Json;
822
+ readonly threadId?: string | null | undefined;
823
+ readonly parentThreadId?: string | null | undefined;
824
+ readonly causationId?: string | null | undefined;
825
+ readonly correlationId?: string | null | undefined;
826
+ readonly effectId?: string | null | undefined;
827
+ readonly origin?: {
828
+ readonly type: "thread";
829
+ readonly threadId: string;
830
+ } | {
831
+ readonly type: "external";
832
+ readonly actorId?: string | undefined;
833
+ } | {
834
+ readonly type: "system";
835
+ } | undefined;
836
+ readonly ephemeral?: boolean | undefined;
837
+ readonly id?: string | undefined;
838
+ readonly ts?: number | undefined;
839
+ readonly idempotencyKey?: string | null | undefined;
840
+ };
841
+ readonly tag?: string | undefined;
379
842
  } | {
380
- type: 'runtime.complete';
381
- output: import("@swirls/looms/core").JsonValue;
382
- tag: string;
843
+ readonly type: "runtime.complete";
844
+ readonly output: import("effect/Schema").Json;
383
845
  } | {
384
- type: 'runtime.emit';
385
- event: import("@swirls/looms/core").EventInput;
386
- tag: string;
846
+ readonly type: "runtime.fail";
847
+ readonly error: string;
387
848
  } | {
388
- type: 'runtime.fail';
389
- error: string;
390
- tag: string;
391
- })[];
392
- })[];
393
- } | {
394
- definitionName?: string;
395
- concurrency: number;
396
- input: import("@swirls/looms/core").JsonValue;
397
- nodeIds: string[];
398
- needsSchedule: boolean;
399
- status: 'running' | 'completed' | 'failed';
400
- error: string | null;
401
- nodes: {
402
- [x: string]: {
403
- readonly status: "completed" | "failed" | "pending" | "running" | "skipped";
404
- readonly result: import("effect/Schema").Json;
405
- readonly error: string | null;
849
+ readonly type: "runtime.cancel";
850
+ readonly threadId: string;
851
+ readonly tag?: string | undefined;
406
852
  } | {
407
- status: string;
408
- result: null;
409
- error: string;
410
- };
411
- };
412
- runningNodes: string[];
413
- pendingSpawns: import("./threads").WorkflowPendingSpawn[];
414
- pendingSleeps: import("./threads").WorkflowPendingSleep[];
415
- pendingEffects: import("./threads").WorkflowPendingEffects[];
416
- pendingEmits: (import("./threads").WorkflowPendingEmit | {
417
- id: string;
418
- event: {
419
- type: string;
420
- payload: {
421
- nodeId: string;
422
- result: null;
423
- error: string;
424
- };
425
- threadId: string;
426
- };
427
- })[];
428
- } | {
429
- definitionName?: string;
430
- nodes: {
431
- [nodeId: string]: import("./definitions").NodeState;
432
- };
433
- concurrency: number;
434
- input: import("@swirls/looms/core").JsonValue;
435
- nodeIds: string[];
436
- needsSchedule: boolean;
437
- runningNodes: string[];
438
- status: 'running' | 'completed' | 'failed';
439
- error: string | null;
440
- pendingSpawns: import("./threads").WorkflowPendingSpawn[];
441
- pendingSleeps: import("./threads").WorkflowPendingSleep[];
442
- pendingEffects: import("./threads").WorkflowPendingEffects[];
443
- pendingEmits: (import("./threads").WorkflowPendingEmit | {
444
- id: string;
445
- event: {
446
- type: string;
447
- payload: {
448
- nodeId: string;
449
- result: string | number | boolean | import("@swirls/looms/core").JsonObject | readonly import("@swirls/looms/core").JsonValue[] | null;
450
- error: string | null;
451
- };
452
- threadId: string;
853
+ readonly type: string;
854
+ readonly input: import("effect/Schema").Json;
855
+ readonly tag?: string | undefined;
856
+ })[];
857
+ }[];
858
+ readonly pendingEmits: {
859
+ readonly id: string;
860
+ readonly event: {
861
+ readonly type: string;
862
+ readonly payload: import("effect/Schema").Json;
863
+ readonly threadId?: string | null | undefined;
864
+ readonly parentThreadId?: string | null | undefined;
865
+ readonly causationId?: string | null | undefined;
866
+ readonly correlationId?: string | null | undefined;
867
+ readonly effectId?: string | null | undefined;
868
+ readonly origin?: {
869
+ readonly type: "thread";
870
+ readonly threadId: string;
871
+ } | {
872
+ readonly type: "external";
873
+ readonly actorId?: string | undefined;
874
+ } | {
875
+ readonly type: "system";
876
+ } | undefined;
877
+ readonly ephemeral?: boolean | undefined;
878
+ readonly id?: string | undefined;
879
+ readonly ts?: number | undefined;
880
+ readonly idempotencyKey?: string | null | undefined;
453
881
  };
454
- })[];
882
+ }[];
883
+ readonly pendingCancels: string[];
884
+ readonly status: "completed" | "failed" | "running";
885
+ readonly error: string | null;
455
886
  }>;
456
887
  }, {
457
888
  nodes: import("@swirls/looms/core").ProjectionDefinition<{
@@ -460,39 +891,123 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
460
891
  readonly status: "completed" | "failed" | "pending" | "running" | "skipped";
461
892
  readonly result: import("effect/Schema").Json;
462
893
  readonly error: string | null;
463
- };
464
- };
465
- } | {
466
- nodes: {
467
- [x: string]: {
468
- readonly status: "completed" | "failed" | "pending" | "running" | "skipped";
469
- readonly result: import("effect/Schema").Json;
470
- readonly error: string | null;
471
- } | {
472
- status: string;
473
- result: string | number | boolean | import("effect/Schema").JsonArray | import("effect/Schema").JsonObject | null;
474
- error: string | null;
894
+ readonly attempts?: number | undefined;
895
+ readonly branch?: string | undefined;
896
+ readonly skipCause?: "inactive" | "policy" | undefined;
897
+ readonly iteration?: {
898
+ readonly index: number;
899
+ readonly previous: import("effect/Schema").Json;
900
+ } | undefined;
475
901
  };
476
902
  };
477
903
  }>;
478
- }, any> & {
904
+ }, import("effect/Context").Service.Any> & {
479
905
  readonly effects: {
480
906
  schedule: import("@swirls/looms/core").EffectDefinition<{
481
907
  readonly definitionName?: string | undefined;
908
+ readonly definitionVersion: string;
482
909
  readonly nodes?: {
483
910
  readonly [x: string]: {
484
911
  readonly status: "completed" | "failed" | "pending" | "running" | "skipped";
485
912
  readonly result: import("effect/Schema").Json;
486
913
  readonly error: string | null;
914
+ readonly attempts?: number | undefined;
915
+ readonly branch?: string | undefined;
916
+ readonly skipCause?: "inactive" | "policy" | undefined;
917
+ readonly iteration?: {
918
+ readonly index: number;
919
+ readonly previous: import("effect/Schema").Json;
920
+ } | undefined;
487
921
  };
488
922
  } | undefined;
489
923
  readonly input?: import("effect/Schema").Json | undefined;
490
924
  }, import("./definitions-store").WorkflowDefinitionsTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
925
+ readonly type: "runtime.effect.ambiguous";
926
+ readonly payload: {
927
+ readonly effectId: string;
928
+ readonly attempt: number;
929
+ readonly error: string;
930
+ };
931
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
932
+ readonly type: "runtime.effect.attempt.started";
933
+ readonly payload: {
934
+ readonly effectId: string;
935
+ readonly attempt: number;
936
+ };
937
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
938
+ readonly type: "runtime.effect.cancel.requested";
939
+ readonly payload: {
940
+ readonly effectId: string;
941
+ readonly attempt: number;
942
+ readonly deadlineAt: number | null;
943
+ };
944
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
945
+ readonly type: "runtime.effect.cancelled";
946
+ readonly payload: {
947
+ readonly effectId: string;
948
+ readonly attempt: number;
949
+ };
950
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
951
+ readonly type: "runtime.effect.completed";
952
+ readonly payload: {
953
+ readonly effectId: string;
954
+ readonly attempt: number;
955
+ };
956
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
957
+ readonly type: "runtime.effect.dispatched";
958
+ readonly payload: {
959
+ readonly effectId: string;
960
+ readonly attempt: number;
961
+ readonly deadlineAt: number | null;
962
+ };
963
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
491
964
  readonly type: "runtime.effect.failed";
492
965
  readonly payload: {
493
966
  readonly effectId: string;
494
967
  readonly error: string;
495
968
  };
969
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
970
+ readonly type: "runtime.effect.heartbeat";
971
+ readonly payload: {
972
+ readonly effectId: string;
973
+ readonly attempt: number;
974
+ readonly heartbeatAt: number;
975
+ readonly deadlineAt: number | null;
976
+ };
977
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
978
+ readonly type: "runtime.effect.queued";
979
+ readonly payload: {
980
+ readonly effectId: string;
981
+ readonly attempt: number;
982
+ readonly deadlineAt: number | null;
983
+ };
984
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
985
+ readonly type: "runtime.effect.retry.scheduled";
986
+ readonly payload: {
987
+ readonly effectId: string;
988
+ readonly attempt: number;
989
+ readonly nextAttemptAt: number;
990
+ readonly error: string;
991
+ };
992
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
993
+ readonly type: "runtime.effect.timed_out";
994
+ readonly payload: {
995
+ readonly effectId: string;
996
+ readonly attempt: number;
997
+ readonly timeout: string;
998
+ };
999
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1000
+ readonly type: "runtime.effect.worker.started";
1001
+ readonly payload: {
1002
+ readonly effectId: string;
1003
+ readonly attempt: number;
1004
+ readonly deadlineAt: number | null;
1005
+ };
1006
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1007
+ readonly type: "runtime.run.cancelled";
1008
+ readonly payload: {
1009
+ readonly reason?: string | undefined;
1010
+ };
496
1011
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
497
1012
  readonly type: "runtime.run.completed";
498
1013
  readonly payload: {
@@ -505,7 +1020,9 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
505
1020
  readonly rootThreadId?: string | undefined;
506
1021
  readonly kind: string;
507
1022
  readonly definitionName: string;
1023
+ readonly definitionVersion: string;
508
1024
  readonly input: import("effect/Schema").Json;
1025
+ readonly requestedThreadId?: string | null | undefined;
509
1026
  };
510
1027
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
511
1028
  readonly type: "runtime.signal.received";
@@ -519,6 +1036,11 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
519
1036
  readonly stateHash: string;
520
1037
  readonly state?: import("effect/Schema").Json | undefined;
521
1038
  };
1039
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1040
+ readonly type: "runtime.thread.cancel.requested";
1041
+ readonly payload: {
1042
+ readonly threadId: string;
1043
+ };
522
1044
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
523
1045
  readonly type: "runtime.thread.cancelled";
524
1046
  readonly payload: {
@@ -543,6 +1065,7 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
543
1065
  readonly threadId: string;
544
1066
  readonly kind: string;
545
1067
  readonly definitionName: string;
1068
+ readonly definitionVersion: string;
546
1069
  readonly input: import("effect/Schema").Json;
547
1070
  readonly parentThreadId: string | null;
548
1071
  };
@@ -587,7 +1110,75 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
587
1110
  readonly type: "workflow.effects.requested";
588
1111
  readonly payload: {
589
1112
  readonly nodeId: string;
590
- readonly effects: readonly import("@swirls/looms/core").RuntimeEffect[];
1113
+ readonly effects: readonly ({
1114
+ readonly type: "runtime.spawn";
1115
+ readonly childThreadId: string;
1116
+ readonly kind: string;
1117
+ readonly definitionName: string;
1118
+ readonly definitionVersion: string;
1119
+ readonly input: import("effect/Schema").Json;
1120
+ } | {
1121
+ readonly type: "runtime.wait";
1122
+ readonly waitId: string;
1123
+ readonly on: {
1124
+ readonly type: string | readonly string[];
1125
+ readonly match?: import("effect/Schema").Json | undefined;
1126
+ } | {
1127
+ readonly timerAt: number;
1128
+ };
1129
+ readonly tag?: import("effect/Schema").Json | undefined;
1130
+ } | {
1131
+ readonly type: "runtime.emit";
1132
+ readonly event: {
1133
+ readonly type: string;
1134
+ readonly payload: import("effect/Schema").Json;
1135
+ readonly threadId?: string | null | undefined;
1136
+ readonly parentThreadId?: string | null | undefined;
1137
+ readonly causationId?: string | null | undefined;
1138
+ readonly correlationId?: string | null | undefined;
1139
+ readonly effectId?: string | null | undefined;
1140
+ readonly origin?: {
1141
+ readonly type: "thread";
1142
+ readonly threadId: string;
1143
+ } | {
1144
+ readonly type: "external";
1145
+ readonly actorId?: string | undefined;
1146
+ } | {
1147
+ readonly type: "system";
1148
+ } | undefined;
1149
+ readonly ephemeral?: boolean | undefined;
1150
+ readonly id?: string | undefined;
1151
+ readonly ts?: number | undefined;
1152
+ readonly idempotencyKey?: string | null | undefined;
1153
+ };
1154
+ readonly tag?: string | undefined;
1155
+ } | {
1156
+ readonly type: "runtime.complete";
1157
+ readonly output: import("effect/Schema").Json;
1158
+ } | {
1159
+ readonly type: "runtime.fail";
1160
+ readonly error: string;
1161
+ } | {
1162
+ readonly type: "runtime.cancel";
1163
+ readonly threadId: string;
1164
+ readonly tag?: string | undefined;
1165
+ } | {
1166
+ readonly type: string;
1167
+ readonly input: import("effect/Schema").Json;
1168
+ readonly tag?: string | undefined;
1169
+ })[];
1170
+ };
1171
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1172
+ readonly type: "workflow.map.requested";
1173
+ readonly payload: {
1174
+ readonly nodeId: string;
1175
+ readonly attempt: number;
1176
+ readonly kind: string;
1177
+ readonly definitionName: string;
1178
+ readonly definitionVersion: string;
1179
+ readonly items: readonly import("effect/Schema").Json[];
1180
+ readonly concurrency: number;
1181
+ readonly limitBytes: number;
591
1182
  };
592
1183
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
593
1184
  readonly type: "workflow.node.finished";
@@ -595,12 +1186,14 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
595
1186
  readonly nodeId: string;
596
1187
  readonly result: import("effect/Schema").Json;
597
1188
  readonly error: string | null;
1189
+ readonly branch?: string | undefined;
598
1190
  };
599
1191
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
600
1192
  readonly type: "workflow.node.skipped";
601
1193
  readonly payload: {
602
1194
  readonly nodeId: string;
603
1195
  readonly reason: string;
1196
+ readonly cause: "inactive" | "policy";
604
1197
  };
605
1198
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
606
1199
  readonly type: "workflow.node.started";
@@ -618,25 +1211,126 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
618
1211
  readonly type: "workflow.spawn.requested";
619
1212
  readonly payload: {
620
1213
  readonly nodeId: string;
1214
+ readonly attempt: number;
621
1215
  readonly childThreadId: string;
622
1216
  readonly kind: string;
623
1217
  readonly definitionName: string;
1218
+ readonly definitionVersion: string;
624
1219
  readonly input: import("effect/Schema").Json;
1220
+ readonly loopIndex: number | null;
625
1221
  };
626
1222
  })>;
627
1223
  runNode: import("@swirls/looms/core").EffectDefinition<{
628
1224
  readonly definitionName?: string | undefined;
1225
+ readonly definitionVersion: string;
629
1226
  readonly nodeId: string;
1227
+ readonly attempt: number;
1228
+ readonly iteration?: {
1229
+ readonly index: number;
1230
+ readonly previous: import("effect/Schema").Json;
1231
+ } | undefined;
630
1232
  readonly input?: import("effect/Schema").Json | undefined;
631
- readonly results?: {
632
- readonly [x: string]: import("effect/Schema").Json;
1233
+ readonly nodes?: {
1234
+ readonly [x: string]: {
1235
+ readonly status: "completed" | "failed" | "pending" | "running" | "skipped";
1236
+ readonly result: import("effect/Schema").Json;
1237
+ readonly error: string | null;
1238
+ readonly attempts?: number | undefined;
1239
+ readonly branch?: string | undefined;
1240
+ readonly skipCause?: "inactive" | "policy" | undefined;
1241
+ readonly iteration?: {
1242
+ readonly index: number;
1243
+ readonly previous: import("effect/Schema").Json;
1244
+ } | undefined;
1245
+ };
633
1246
  } | undefined;
634
1247
  }, import("./definitions-store").WorkflowDefinitionsTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1248
+ readonly type: "runtime.effect.ambiguous";
1249
+ readonly payload: {
1250
+ readonly effectId: string;
1251
+ readonly attempt: number;
1252
+ readonly error: string;
1253
+ };
1254
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1255
+ readonly type: "runtime.effect.attempt.started";
1256
+ readonly payload: {
1257
+ readonly effectId: string;
1258
+ readonly attempt: number;
1259
+ };
1260
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1261
+ readonly type: "runtime.effect.cancel.requested";
1262
+ readonly payload: {
1263
+ readonly effectId: string;
1264
+ readonly attempt: number;
1265
+ readonly deadlineAt: number | null;
1266
+ };
1267
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1268
+ readonly type: "runtime.effect.cancelled";
1269
+ readonly payload: {
1270
+ readonly effectId: string;
1271
+ readonly attempt: number;
1272
+ };
1273
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1274
+ readonly type: "runtime.effect.completed";
1275
+ readonly payload: {
1276
+ readonly effectId: string;
1277
+ readonly attempt: number;
1278
+ };
1279
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1280
+ readonly type: "runtime.effect.dispatched";
1281
+ readonly payload: {
1282
+ readonly effectId: string;
1283
+ readonly attempt: number;
1284
+ readonly deadlineAt: number | null;
1285
+ };
1286
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
635
1287
  readonly type: "runtime.effect.failed";
636
1288
  readonly payload: {
637
1289
  readonly effectId: string;
638
1290
  readonly error: string;
639
1291
  };
1292
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1293
+ readonly type: "runtime.effect.heartbeat";
1294
+ readonly payload: {
1295
+ readonly effectId: string;
1296
+ readonly attempt: number;
1297
+ readonly heartbeatAt: number;
1298
+ readonly deadlineAt: number | null;
1299
+ };
1300
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1301
+ readonly type: "runtime.effect.queued";
1302
+ readonly payload: {
1303
+ readonly effectId: string;
1304
+ readonly attempt: number;
1305
+ readonly deadlineAt: number | null;
1306
+ };
1307
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1308
+ readonly type: "runtime.effect.retry.scheduled";
1309
+ readonly payload: {
1310
+ readonly effectId: string;
1311
+ readonly attempt: number;
1312
+ readonly nextAttemptAt: number;
1313
+ readonly error: string;
1314
+ };
1315
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1316
+ readonly type: "runtime.effect.timed_out";
1317
+ readonly payload: {
1318
+ readonly effectId: string;
1319
+ readonly attempt: number;
1320
+ readonly timeout: string;
1321
+ };
1322
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1323
+ readonly type: "runtime.effect.worker.started";
1324
+ readonly payload: {
1325
+ readonly effectId: string;
1326
+ readonly attempt: number;
1327
+ readonly deadlineAt: number | null;
1328
+ };
1329
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1330
+ readonly type: "runtime.run.cancelled";
1331
+ readonly payload: {
1332
+ readonly reason?: string | undefined;
1333
+ };
640
1334
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
641
1335
  readonly type: "runtime.run.completed";
642
1336
  readonly payload: {
@@ -649,7 +1343,9 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
649
1343
  readonly rootThreadId?: string | undefined;
650
1344
  readonly kind: string;
651
1345
  readonly definitionName: string;
1346
+ readonly definitionVersion: string;
652
1347
  readonly input: import("effect/Schema").Json;
1348
+ readonly requestedThreadId?: string | null | undefined;
653
1349
  };
654
1350
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
655
1351
  readonly type: "runtime.signal.received";
@@ -663,6 +1359,11 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
663
1359
  readonly stateHash: string;
664
1360
  readonly state?: import("effect/Schema").Json | undefined;
665
1361
  };
1362
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1363
+ readonly type: "runtime.thread.cancel.requested";
1364
+ readonly payload: {
1365
+ readonly threadId: string;
1366
+ };
666
1367
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
667
1368
  readonly type: "runtime.thread.cancelled";
668
1369
  readonly payload: {
@@ -687,6 +1388,7 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
687
1388
  readonly threadId: string;
688
1389
  readonly kind: string;
689
1390
  readonly definitionName: string;
1391
+ readonly definitionVersion: string;
690
1392
  readonly input: import("effect/Schema").Json;
691
1393
  readonly parentThreadId: string | null;
692
1394
  };
@@ -731,7 +1433,75 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
731
1433
  readonly type: "workflow.effects.requested";
732
1434
  readonly payload: {
733
1435
  readonly nodeId: string;
734
- readonly effects: readonly import("@swirls/looms/core").RuntimeEffect[];
1436
+ readonly effects: readonly ({
1437
+ readonly type: "runtime.spawn";
1438
+ readonly childThreadId: string;
1439
+ readonly kind: string;
1440
+ readonly definitionName: string;
1441
+ readonly definitionVersion: string;
1442
+ readonly input: import("effect/Schema").Json;
1443
+ } | {
1444
+ readonly type: "runtime.wait";
1445
+ readonly waitId: string;
1446
+ readonly on: {
1447
+ readonly type: string | readonly string[];
1448
+ readonly match?: import("effect/Schema").Json | undefined;
1449
+ } | {
1450
+ readonly timerAt: number;
1451
+ };
1452
+ readonly tag?: import("effect/Schema").Json | undefined;
1453
+ } | {
1454
+ readonly type: "runtime.emit";
1455
+ readonly event: {
1456
+ readonly type: string;
1457
+ readonly payload: import("effect/Schema").Json;
1458
+ readonly threadId?: string | null | undefined;
1459
+ readonly parentThreadId?: string | null | undefined;
1460
+ readonly causationId?: string | null | undefined;
1461
+ readonly correlationId?: string | null | undefined;
1462
+ readonly effectId?: string | null | undefined;
1463
+ readonly origin?: {
1464
+ readonly type: "thread";
1465
+ readonly threadId: string;
1466
+ } | {
1467
+ readonly type: "external";
1468
+ readonly actorId?: string | undefined;
1469
+ } | {
1470
+ readonly type: "system";
1471
+ } | undefined;
1472
+ readonly ephemeral?: boolean | undefined;
1473
+ readonly id?: string | undefined;
1474
+ readonly ts?: number | undefined;
1475
+ readonly idempotencyKey?: string | null | undefined;
1476
+ };
1477
+ readonly tag?: string | undefined;
1478
+ } | {
1479
+ readonly type: "runtime.complete";
1480
+ readonly output: import("effect/Schema").Json;
1481
+ } | {
1482
+ readonly type: "runtime.fail";
1483
+ readonly error: string;
1484
+ } | {
1485
+ readonly type: "runtime.cancel";
1486
+ readonly threadId: string;
1487
+ readonly tag?: string | undefined;
1488
+ } | {
1489
+ readonly type: string;
1490
+ readonly input: import("effect/Schema").Json;
1491
+ readonly tag?: string | undefined;
1492
+ })[];
1493
+ };
1494
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1495
+ readonly type: "workflow.map.requested";
1496
+ readonly payload: {
1497
+ readonly nodeId: string;
1498
+ readonly attempt: number;
1499
+ readonly kind: string;
1500
+ readonly definitionName: string;
1501
+ readonly definitionVersion: string;
1502
+ readonly items: readonly import("effect/Schema").Json[];
1503
+ readonly concurrency: number;
1504
+ readonly limitBytes: number;
735
1505
  };
736
1506
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
737
1507
  readonly type: "workflow.node.finished";
@@ -739,12 +1509,14 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
739
1509
  readonly nodeId: string;
740
1510
  readonly result: import("effect/Schema").Json;
741
1511
  readonly error: string | null;
1512
+ readonly branch?: string | undefined;
742
1513
  };
743
1514
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
744
1515
  readonly type: "workflow.node.skipped";
745
1516
  readonly payload: {
746
1517
  readonly nodeId: string;
747
1518
  readonly reason: string;
1519
+ readonly cause: "inactive" | "policy";
748
1520
  };
749
1521
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
750
1522
  readonly type: "workflow.node.started";
@@ -762,142 +1534,156 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
762
1534
  readonly type: "workflow.spawn.requested";
763
1535
  readonly payload: {
764
1536
  readonly nodeId: string;
1537
+ readonly attempt: number;
765
1538
  readonly childThreadId: string;
766
1539
  readonly kind: string;
767
1540
  readonly definitionName: string;
1541
+ readonly definitionVersion: string;
768
1542
  readonly input: import("effect/Schema").Json;
1543
+ readonly loopIndex: number | null;
769
1544
  };
770
1545
  })>;
771
1546
  };
772
1547
  readonly threads: {
773
1548
  workflow: import("@swirls/looms/core").ThreadDefinition<{
774
- definitionName?: string;
775
- concurrency: number;
776
- input: import("@swirls/looms/core").JsonValue;
777
- nodeIds: string[];
778
- nodes: {
779
- [x: string]: {
1549
+ readonly definitionName?: string | undefined;
1550
+ readonly definitionVersion?: string | undefined;
1551
+ readonly nodes: {
1552
+ readonly [x: string]: {
780
1553
  readonly status: "completed" | "failed" | "pending" | "running" | "skipped";
781
1554
  readonly result: import("effect/Schema").Json;
782
1555
  readonly error: string | null;
783
- } | {
784
- status: string;
785
- result: string | number | boolean | import("effect/Schema").JsonArray | import("effect/Schema").JsonObject | null;
786
- error: string | null;
1556
+ readonly attempts?: number | undefined;
1557
+ readonly branch?: string | undefined;
1558
+ readonly skipCause?: "inactive" | "policy" | undefined;
1559
+ readonly iteration?: {
1560
+ readonly index: number;
1561
+ readonly previous: import("effect/Schema").Json;
1562
+ } | undefined;
787
1563
  };
788
1564
  };
789
- runningNodes: string[];
790
- pendingSpawns: import("./threads").WorkflowPendingSpawn[];
791
- pendingSleeps: import("./threads").WorkflowPendingSleep[];
792
- pendingEffects: import("./threads").WorkflowPendingEffects[];
793
- pendingEmits: import("./threads").WorkflowPendingEmit[];
794
- status: "completed" | "failed" | "running";
795
- error: string | null;
796
- needsSchedule: boolean;
797
- } | {
798
- definitionName?: string;
799
- nodes: {
800
- [nodeId: string]: import("./definitions").NodeState;
801
- };
802
- concurrency: number;
803
- input: import("@swirls/looms/core").JsonValue;
804
- nodeIds: string[];
805
- needsSchedule: boolean;
806
- runningNodes: string[];
807
- pendingSpawns: import("./threads").WorkflowPendingSpawn[];
808
- pendingSleeps: import("./threads").WorkflowPendingSleep[];
809
- pendingEmits: import("./threads").WorkflowPendingEmit[];
810
- status: 'running' | 'completed' | 'failed';
811
- error: string | null;
812
- pendingEffects: (import("./threads").WorkflowPendingEffects | {
813
- nodeId: string;
814
- effects: (import("@swirls/looms/core").InvokeEffect | import("@swirls/looms/core").WaitEffect | {
815
- type: 'runtime.wait';
816
- waitId: string;
817
- on: import("@swirls/looms/core").WaitCondition;
818
- tag: {
819
- nodeId: string;
1565
+ readonly concurrency: number;
1566
+ readonly input: import("effect/Schema").Json;
1567
+ readonly nodeIds: string[];
1568
+ readonly needsSchedule: boolean;
1569
+ readonly runningNodes: string[];
1570
+ readonly pendingSpawns: {
1571
+ readonly childThreadId: string;
1572
+ readonly kind: string;
1573
+ readonly definitionName: string;
1574
+ readonly definitionVersion: string;
1575
+ readonly nodeId: string;
1576
+ readonly attempt: number;
1577
+ readonly input: import("effect/Schema").Json;
1578
+ readonly loopIndex: number | null;
1579
+ }[];
1580
+ readonly pendingMaps: {
1581
+ readonly nodeId: string;
1582
+ readonly attempt: number;
1583
+ readonly kind: string;
1584
+ readonly definitionName: string;
1585
+ readonly definitionVersion: string;
1586
+ readonly items: readonly import("effect/Schema").Json[];
1587
+ readonly concurrency: number;
1588
+ readonly limitBytes: number;
1589
+ readonly nextIndex: number;
1590
+ readonly outputs: {
1591
+ readonly [x: string]: import("effect/Schema").Json;
1592
+ };
1593
+ }[];
1594
+ readonly pendingSleeps: {
1595
+ readonly waitId: string;
1596
+ readonly wakeAt: number;
1597
+ readonly nodeId: string;
1598
+ }[];
1599
+ readonly pendingEffects: {
1600
+ readonly nodeId: string;
1601
+ readonly effects: ({
1602
+ readonly type: "runtime.spawn";
1603
+ readonly childThreadId: string;
1604
+ readonly kind: string;
1605
+ readonly definitionName: string;
1606
+ readonly definitionVersion: string;
1607
+ readonly input: import("effect/Schema").Json;
1608
+ } | {
1609
+ readonly type: "runtime.wait";
1610
+ readonly waitId: string;
1611
+ readonly on: {
1612
+ readonly type: string | readonly string[];
1613
+ readonly match?: import("effect/Schema").Json | undefined;
1614
+ } | {
1615
+ readonly timerAt: number;
820
1616
  };
1617
+ readonly tag?: import("effect/Schema").Json | undefined;
821
1618
  } | {
822
- type: 'runtime.cancel';
823
- threadId: string;
824
- tag: string;
1619
+ readonly type: "runtime.emit";
1620
+ readonly event: {
1621
+ readonly type: string;
1622
+ readonly payload: import("effect/Schema").Json;
1623
+ readonly threadId?: string | null | undefined;
1624
+ readonly parentThreadId?: string | null | undefined;
1625
+ readonly causationId?: string | null | undefined;
1626
+ readonly correlationId?: string | null | undefined;
1627
+ readonly effectId?: string | null | undefined;
1628
+ readonly origin?: {
1629
+ readonly type: "thread";
1630
+ readonly threadId: string;
1631
+ } | {
1632
+ readonly type: "external";
1633
+ readonly actorId?: string | undefined;
1634
+ } | {
1635
+ readonly type: "system";
1636
+ } | undefined;
1637
+ readonly ephemeral?: boolean | undefined;
1638
+ readonly id?: string | undefined;
1639
+ readonly ts?: number | undefined;
1640
+ readonly idempotencyKey?: string | null | undefined;
1641
+ };
1642
+ readonly tag?: string | undefined;
825
1643
  } | {
826
- type: 'runtime.complete';
827
- output: import("@swirls/looms/core").JsonValue;
828
- tag: string;
1644
+ readonly type: "runtime.complete";
1645
+ readonly output: import("effect/Schema").Json;
829
1646
  } | {
830
- type: 'runtime.emit';
831
- event: import("@swirls/looms/core").EventInput;
832
- tag: string;
1647
+ readonly type: "runtime.fail";
1648
+ readonly error: string;
833
1649
  } | {
834
- type: 'runtime.fail';
835
- error: string;
836
- tag: string;
837
- })[];
838
- })[];
839
- } | {
840
- definitionName?: string;
841
- concurrency: number;
842
- input: import("@swirls/looms/core").JsonValue;
843
- nodeIds: string[];
844
- needsSchedule: boolean;
845
- status: 'running' | 'completed' | 'failed';
846
- error: string | null;
847
- nodes: {
848
- [x: string]: {
849
- readonly status: "completed" | "failed" | "pending" | "running" | "skipped";
850
- readonly result: import("effect/Schema").Json;
851
- readonly error: string | null;
1650
+ readonly type: "runtime.cancel";
1651
+ readonly threadId: string;
1652
+ readonly tag?: string | undefined;
852
1653
  } | {
853
- status: string;
854
- result: null;
855
- error: string;
856
- };
857
- };
858
- runningNodes: string[];
859
- pendingSpawns: import("./threads").WorkflowPendingSpawn[];
860
- pendingSleeps: import("./threads").WorkflowPendingSleep[];
861
- pendingEffects: import("./threads").WorkflowPendingEffects[];
862
- pendingEmits: (import("./threads").WorkflowPendingEmit | {
863
- id: string;
864
- event: {
865
- type: string;
866
- payload: {
867
- nodeId: string;
868
- result: null;
869
- error: string;
870
- };
871
- threadId: string;
872
- };
873
- })[];
874
- } | {
875
- definitionName?: string;
876
- nodes: {
877
- [nodeId: string]: import("./definitions").NodeState;
878
- };
879
- concurrency: number;
880
- input: import("@swirls/looms/core").JsonValue;
881
- nodeIds: string[];
882
- needsSchedule: boolean;
883
- runningNodes: string[];
884
- status: 'running' | 'completed' | 'failed';
885
- error: string | null;
886
- pendingSpawns: import("./threads").WorkflowPendingSpawn[];
887
- pendingSleeps: import("./threads").WorkflowPendingSleep[];
888
- pendingEffects: import("./threads").WorkflowPendingEffects[];
889
- pendingEmits: (import("./threads").WorkflowPendingEmit | {
890
- id: string;
891
- event: {
892
- type: string;
893
- payload: {
894
- nodeId: string;
895
- result: string | number | boolean | import("@swirls/looms/core").JsonObject | readonly import("@swirls/looms/core").JsonValue[] | null;
896
- error: string | null;
897
- };
898
- threadId: string;
1654
+ readonly type: string;
1655
+ readonly input: import("effect/Schema").Json;
1656
+ readonly tag?: string | undefined;
1657
+ })[];
1658
+ }[];
1659
+ readonly pendingEmits: {
1660
+ readonly id: string;
1661
+ readonly event: {
1662
+ readonly type: string;
1663
+ readonly payload: import("effect/Schema").Json;
1664
+ readonly threadId?: string | null | undefined;
1665
+ readonly parentThreadId?: string | null | undefined;
1666
+ readonly causationId?: string | null | undefined;
1667
+ readonly correlationId?: string | null | undefined;
1668
+ readonly effectId?: string | null | undefined;
1669
+ readonly origin?: {
1670
+ readonly type: "thread";
1671
+ readonly threadId: string;
1672
+ } | {
1673
+ readonly type: "external";
1674
+ readonly actorId?: string | undefined;
1675
+ } | {
1676
+ readonly type: "system";
1677
+ } | undefined;
1678
+ readonly ephemeral?: boolean | undefined;
1679
+ readonly id?: string | undefined;
1680
+ readonly ts?: number | undefined;
1681
+ readonly idempotencyKey?: string | null | undefined;
899
1682
  };
900
- })[];
1683
+ }[];
1684
+ readonly pendingCancels: string[];
1685
+ readonly status: "completed" | "failed" | "running";
1686
+ readonly error: string | null;
901
1687
  }>;
902
1688
  };
903
1689
  readonly projections: {
@@ -907,18 +1693,13 @@ export declare function workflow(options?: WorkflowModuleOptions): import("@swir
907
1693
  readonly status: "completed" | "failed" | "pending" | "running" | "skipped";
908
1694
  readonly result: import("effect/Schema").Json;
909
1695
  readonly error: string | null;
910
- };
911
- };
912
- } | {
913
- nodes: {
914
- [x: string]: {
915
- readonly status: "completed" | "failed" | "pending" | "running" | "skipped";
916
- readonly result: import("effect/Schema").Json;
917
- readonly error: string | null;
918
- } | {
919
- status: string;
920
- result: string | number | boolean | import("effect/Schema").JsonArray | import("effect/Schema").JsonObject | null;
921
- error: string | null;
1696
+ readonly attempts?: number | undefined;
1697
+ readonly branch?: string | undefined;
1698
+ readonly skipCause?: "inactive" | "policy" | undefined;
1699
+ readonly iteration?: {
1700
+ readonly index: number;
1701
+ readonly previous: import("effect/Schema").Json;
1702
+ } | undefined;
922
1703
  };
923
1704
  };
924
1705
  }>;