@powerhousedao/workflow 6.2.3-dev.30 → 6.2.3-dev.32

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 (374) hide show
  1. package/README.md +8 -8
  2. package/dist/browser/BlockSelector-BHJQOhie.js +3051 -0
  3. package/dist/browser/BlockSelector-BHJQOhie.js.map +1 -0
  4. package/dist/browser/{connection-form-D-NETdDQ.js → connection-form-CaduwBiu.js} +349 -50
  5. package/dist/browser/connection-form-CaduwBiu.js.map +1 -0
  6. package/dist/browser/{data-tree-DA4sc7B7.js → data-tree-8219PVfh.js} +2 -2
  7. package/dist/browser/{data-tree-DA4sc7B7.js.map → data-tree-8219PVfh.js.map} +1 -1
  8. package/dist/browser/document-models/index.js +2 -2
  9. package/dist/browser/document-models/workflow/index.js +3 -3
  10. package/dist/browser/{document-models-BohsduV4.js → document-models-C1ZgIZyV.js} +7 -2
  11. package/dist/browser/{document-models-BohsduV4.js.map → document-models-C1ZgIZyV.js.map} +1 -1
  12. package/dist/browser/{editor-B6N0PCuZ.js → editor-BHV1MZS8.js} +2437 -6283
  13. package/dist/browser/editor-BHV1MZS8.js.map +1 -0
  14. package/dist/{node/editor-StBssjcQ.mjs → browser/editor-C0C1eB0R.js} +385 -119
  15. package/dist/browser/editor-C0C1eB0R.js.map +1 -0
  16. package/dist/browser/{editor-BkdwuOC-.js → editor-CFcXlZY2.js} +14 -24
  17. package/dist/browser/editor-CFcXlZY2.js.map +1 -0
  18. package/dist/browser/editors/connection-editor/module.js +1 -1
  19. package/dist/browser/editors/workflow-editor/module.js +1 -1
  20. package/dist/browser/editors/workflow-studio/module.js +1 -1
  21. package/dist/browser/index.js +97 -43
  22. package/dist/browser/index.js.map +1 -1
  23. package/dist/browser/{module-Bkms70LV.js → module-DU2vb3FH.js} +574 -94
  24. package/dist/browser/module-DU2vb3FH.js.map +1 -0
  25. package/dist/browser/{piece-auth-Z4mZEOtL.js → piece-auth-BS5CtQOG.js} +45 -12
  26. package/dist/browser/piece-auth-BS5CtQOG.js.map +1 -0
  27. package/dist/browser/reactor/index.js +2 -2
  28. package/dist/browser/runtime-queries-Ds2kk-Ow.js +2535 -0
  29. package/dist/browser/runtime-queries-Ds2kk-Ow.js.map +1 -0
  30. package/dist/browser/trigger-text-BkcklsMX.js +5569 -0
  31. package/dist/browser/trigger-text-BkcklsMX.js.map +1 -0
  32. package/dist/browser/{upgrade-manifests-BLrv3cf2.js → upgrade-manifests-BpakVE9l.js} +2 -2
  33. package/dist/browser/{upgrade-manifests-BLrv3cf2.js.map → upgrade-manifests-BpakVE9l.js.map} +1 -1
  34. package/dist/browser/{workflow-CGtVlhr8.js → workflow-BxShRhVy.js} +3 -2
  35. package/dist/browser/workflow-BxShRhVy.js.map +1 -0
  36. package/dist/node/BlockSelector-lOcIiaqt.mjs +3055 -0
  37. package/dist/node/BlockSelector-lOcIiaqt.mjs.map +1 -0
  38. package/dist/node/{connection-form-C9vbfSnA.mjs → connection-form-DWt29kft.mjs} +349 -50
  39. package/dist/node/connection-form-DWt29kft.mjs.map +1 -0
  40. package/dist/node/{data-tree-CbqpF3lC.mjs → data-tree-Cdx85Y19.mjs} +2 -2
  41. package/dist/node/{data-tree-CbqpF3lC.mjs.map → data-tree-Cdx85Y19.mjs.map} +1 -1
  42. package/dist/node/document-models/index.mjs +2 -2
  43. package/dist/node/document-models/workflow/index.mjs +3 -3
  44. package/dist/{browser/editor-CZ5NvCyv.js → node/editor-CR823u-y.mjs} +385 -119
  45. package/dist/node/editor-CR823u-y.mjs.map +1 -0
  46. package/dist/node/{editor-DP36YDk5.mjs → editor-CwX-G2Jv.mjs} +2437 -7479
  47. package/dist/node/editor-CwX-G2Jv.mjs.map +1 -0
  48. package/dist/node/{editor-By9BHI8e.mjs → editor-D_t8OtZn.mjs} +14 -24
  49. package/dist/node/editor-D_t8OtZn.mjs.map +1 -0
  50. package/dist/node/editors/connection-editor/module.mjs +1 -1
  51. package/dist/node/editors/workflow-editor/module.mjs +1 -1
  52. package/dist/node/editors/workflow-studio/module.mjs +1 -1
  53. package/dist/node/index.mjs +102 -43
  54. package/dist/node/index.mjs.map +1 -1
  55. package/dist/node/{module-DuxxhgKs.mjs → module-Dhe5E-VA.mjs} +574 -94
  56. package/dist/node/module-Dhe5E-VA.mjs.map +1 -0
  57. package/dist/node/{piece-auth-Z4mZEOtL.mjs → piece-auth-BS5CtQOG.mjs} +45 -12
  58. package/dist/node/piece-auth-BS5CtQOG.mjs.map +1 -0
  59. package/dist/node/pieces/index.mjs +0 -1
  60. package/dist/node/pieces/index.mjs.map +1 -1
  61. package/dist/node/pieces/reactor/descriptor.json +85 -3
  62. package/dist/node/pieces/reactor/index.mjs +14843 -163
  63. package/dist/node/pieces/reactor/index.mjs.map +1 -1
  64. package/dist/node/pieces/reactor/package.json +1 -1
  65. package/dist/node/runtime-queries-D5EGaCrH.mjs +2544 -0
  66. package/dist/node/runtime-queries-D5EGaCrH.mjs.map +1 -0
  67. package/dist/node/trigger-text-DJIAQBWg.mjs +6765 -0
  68. package/dist/node/trigger-text-DJIAQBWg.mjs.map +1 -0
  69. package/dist/node/{upgrade-manifests-C1sl_M-H.mjs → upgrade-manifests-CmNd742Y.mjs} +2 -2
  70. package/dist/node/{upgrade-manifests-C1sl_M-H.mjs.map → upgrade-manifests-CmNd742Y.mjs.map} +1 -1
  71. package/dist/node/{workflow-C-uuQPnf.mjs → workflow-CGzYGZnr.mjs} +3 -2
  72. package/dist/node/workflow-CGzYGZnr.mjs.map +1 -0
  73. package/dist/powerhouse.manifest.json +6 -1
  74. package/dist/style.css +151 -19
  75. package/dist/types/ai/tools.d.ts +3 -1
  76. package/dist/types/ai/tools.d.ts.map +1 -1
  77. package/dist/types/ai/workflow-tools.d.ts.map +1 -1
  78. package/dist/types/document-models/document-models.d.ts +3 -0
  79. package/dist/types/document-models/document-models.d.ts.map +1 -1
  80. package/dist/types/document-models/workflow/v1/actions.d.ts +3 -0
  81. package/dist/types/document-models/workflow/v1/actions.d.ts.map +1 -1
  82. package/dist/types/document-models/workflow/v1/gen/actions.d.ts +3 -1
  83. package/dist/types/document-models/workflow/v1/gen/actions.d.ts.map +1 -1
  84. package/dist/types/document-models/workflow/v1/gen/creators.d.ts +2 -0
  85. package/dist/types/document-models/workflow/v1/gen/creators.d.ts.map +1 -1
  86. package/dist/types/document-models/workflow/v1/gen/document-model.d.ts.map +1 -1
  87. package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts +3 -0
  88. package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts.map +1 -1
  89. package/dist/types/document-models/workflow/v1/gen/index.d.ts +1 -0
  90. package/dist/types/document-models/workflow/v1/gen/index.d.ts.map +1 -1
  91. package/dist/types/document-models/workflow/v1/gen/ph-factories.d.ts.map +1 -1
  92. package/dist/types/document-models/workflow/v1/gen/publishing/actions.d.ts +16 -0
  93. package/dist/types/document-models/workflow/v1/gen/publishing/actions.d.ts.map +1 -0
  94. package/dist/types/document-models/workflow/v1/gen/publishing/creators.d.ts +5 -0
  95. package/dist/types/document-models/workflow/v1/gen/publishing/creators.d.ts.map +1 -0
  96. package/dist/types/document-models/workflow/v1/gen/publishing/error.d.ts +14 -0
  97. package/dist/types/document-models/workflow/v1/gen/publishing/error.d.ts.map +1 -0
  98. package/dist/types/document-models/workflow/v1/gen/publishing/operations.d.ts +12 -0
  99. package/dist/types/document-models/workflow/v1/gen/publishing/operations.d.ts.map +1 -0
  100. package/dist/types/document-models/workflow/v1/gen/reducer.d.ts.map +1 -1
  101. package/dist/types/document-models/workflow/v1/gen/runtime/actions.d.ts +6 -2
  102. package/dist/types/document-models/workflow/v1/gen/runtime/actions.d.ts.map +1 -1
  103. package/dist/types/document-models/workflow/v1/gen/runtime/creators.d.ts +3 -2
  104. package/dist/types/document-models/workflow/v1/gen/runtime/creators.d.ts.map +1 -1
  105. package/dist/types/document-models/workflow/v1/gen/runtime/error.d.ts +13 -1
  106. package/dist/types/document-models/workflow/v1/gen/runtime/error.d.ts.map +1 -1
  107. package/dist/types/document-models/workflow/v1/gen/runtime/operations.d.ts +2 -1
  108. package/dist/types/document-models/workflow/v1/gen/runtime/operations.d.ts.map +1 -1
  109. package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts +102 -12
  110. package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts.map +1 -1
  111. package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts +21 -1
  112. package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts.map +1 -1
  113. package/dist/types/document-models/workflow/v1/gen/steps/error.d.ts +26 -1
  114. package/dist/types/document-models/workflow/v1/gen/steps/error.d.ts.map +1 -1
  115. package/dist/types/document-models/workflow/v1/gen/trigger/error.d.ts +13 -1
  116. package/dist/types/document-models/workflow/v1/gen/trigger/error.d.ts.map +1 -1
  117. package/dist/types/document-models/workflow/v1/gen/utils.d.ts.map +1 -1
  118. package/dist/types/document-models/workflow/v1/gen/variables/error.d.ts +13 -1
  119. package/dist/types/document-models/workflow/v1/gen/variables/error.d.ts.map +1 -1
  120. package/dist/types/document-models/workflow/v1/gen/workflow/error.d.ts +13 -1
  121. package/dist/types/document-models/workflow/v1/gen/workflow/error.d.ts.map +1 -1
  122. package/dist/types/document-models/workflow/v1/module.d.ts +3 -0
  123. package/dist/types/document-models/workflow/v1/module.d.ts.map +1 -1
  124. package/dist/types/document-models/workflow/v1/src/helpers.d.ts +15 -0
  125. package/dist/types/document-models/workflow/v1/src/helpers.d.ts.map +1 -0
  126. package/dist/types/document-models/workflow/v1/src/reducers/edges.d.ts.map +1 -1
  127. package/dist/types/document-models/workflow/v1/src/reducers/publishing.d.ts +3 -0
  128. package/dist/types/document-models/workflow/v1/src/reducers/publishing.d.ts.map +1 -0
  129. package/dist/types/document-models/workflow/v1/src/reducers/runtime.d.ts.map +1 -1
  130. package/dist/types/document-models/workflow/v1/src/reducers/steps.d.ts.map +1 -1
  131. package/dist/types/document-models/workflow/v1/src/reducers/trigger.d.ts.map +1 -1
  132. package/dist/types/document-models/workflow/v1/src/reducers/variables.d.ts.map +1 -1
  133. package/dist/types/document-models/workflow/v1/src/reducers/workflow.d.ts.map +1 -1
  134. package/dist/types/document-models/workflow/v1/tests/block-validation-and-enable.test.d.ts +2 -0
  135. package/dist/types/document-models/workflow/v1/tests/block-validation-and-enable.test.d.ts.map +1 -0
  136. package/dist/types/document-models/workflow/v1/tests/config-and-variables.test.d.ts +2 -0
  137. package/dist/types/document-models/workflow/v1/tests/config-and-variables.test.d.ts.map +1 -0
  138. package/dist/types/document-models/workflow/v1/tests/draft-and-publish.test.d.ts +2 -0
  139. package/dist/types/document-models/workflow/v1/tests/draft-and-publish.test.d.ts.map +1 -0
  140. package/dist/types/document-models/workflow/v1/tests/updated-at.test.d.ts +2 -0
  141. package/dist/types/document-models/workflow/v1/tests/updated-at.test.d.ts.map +1 -0
  142. package/dist/types/editors/connection-editor/ConnectionToolbar.d.ts.map +1 -1
  143. package/dist/types/editors/connection-editor/UsedBy.d.ts.map +1 -1
  144. package/dist/types/editors/connection-editor/connection-callbacks.d.ts.map +1 -1
  145. package/dist/types/editors/connection-editor/connection-form.d.ts +2 -1
  146. package/dist/types/editors/connection-editor/connection-form.d.ts.map +1 -1
  147. package/dist/types/editors/connection-editor/connection-usage.d.ts +3 -2
  148. package/dist/types/editors/connection-editor/connection-usage.d.ts.map +1 -1
  149. package/dist/types/editors/connection-editor/editor.d.ts.map +1 -1
  150. package/dist/types/editors/connection-editor/piece-auth.d.ts +7 -1
  151. package/dist/types/editors/connection-editor/piece-auth.d.ts.map +1 -1
  152. package/dist/types/editors/connection-editor/status.d.ts +2 -1
  153. package/dist/types/editors/connection-editor/status.d.ts.map +1 -1
  154. package/dist/types/editors/shared/controls.d.ts +17 -1
  155. package/dist/types/editors/shared/controls.d.ts.map +1 -1
  156. package/dist/types/editors/shared/editor-chrome.d.ts +2 -0
  157. package/dist/types/editors/shared/editor-chrome.d.ts.map +1 -1
  158. package/dist/types/editors/shared/icons.d.ts +2 -0
  159. package/dist/types/editors/shared/icons.d.ts.map +1 -1
  160. package/dist/types/editors/shared/undo-plan.d.ts +20 -0
  161. package/dist/types/editors/shared/undo-plan.d.ts.map +1 -0
  162. package/dist/types/editors/shared/undo-plan.test.d.ts +2 -0
  163. package/dist/types/editors/shared/undo-plan.test.d.ts.map +1 -0
  164. package/dist/types/editors/workflow-editor/document/useWorkflowModel.d.ts.map +1 -1
  165. package/dist/types/editors/workflow-editor/editor.d.ts +0 -1
  166. package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -1
  167. package/dist/types/editors/workflow-editor/run-kinds.d.ts +5 -0
  168. package/dist/types/editors/workflow-editor/run-kinds.d.ts.map +1 -0
  169. package/dist/types/editors/workflow-editor/runtime-api.d.ts +12 -139
  170. package/dist/types/editors/workflow-editor/runtime-api.d.ts.map +1 -1
  171. package/dist/types/editors/workflow-editor/runtime-client.d.ts +260 -0
  172. package/dist/types/editors/workflow-editor/runtime-client.d.ts.map +1 -0
  173. package/dist/types/editors/workflow-editor/runtime-client.test.d.ts +2 -0
  174. package/dist/types/editors/workflow-editor/runtime-client.test.d.ts.map +1 -0
  175. package/dist/types/editors/workflow-editor/runtime-context.d.ts +45 -0
  176. package/dist/types/editors/workflow-editor/runtime-context.d.ts.map +1 -0
  177. package/dist/types/editors/workflow-editor/runtime-persist.d.ts +23 -0
  178. package/dist/types/editors/workflow-editor/runtime-persist.d.ts.map +1 -0
  179. package/dist/types/editors/workflow-editor/runtime-persist.test.d.ts +2 -0
  180. package/dist/types/editors/workflow-editor/runtime-persist.test.d.ts.map +1 -0
  181. package/dist/types/editors/workflow-editor/runtime-queries.d.ts +128 -0
  182. package/dist/types/editors/workflow-editor/runtime-queries.d.ts.map +1 -0
  183. package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts +3 -3
  184. package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts.map +1 -1
  185. package/dist/types/editors/workflow-editor/ui/CanvasContextMenu.d.ts +4 -3
  186. package/dist/types/editors/workflow-editor/ui/CanvasContextMenu.d.ts.map +1 -1
  187. package/dist/types/editors/workflow-editor/ui/ConnectionField.d.ts +2 -3
  188. package/dist/types/editors/workflow-editor/ui/ConnectionField.d.ts.map +1 -1
  189. package/dist/types/editors/workflow-editor/ui/CreateConnectionModal.d.ts.map +1 -1
  190. package/dist/types/editors/workflow-editor/ui/ExpressionPicker.d.ts +6 -5
  191. package/dist/types/editors/workflow-editor/ui/ExpressionPicker.d.ts.map +1 -1
  192. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +7 -1
  193. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
  194. package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts +34 -0
  195. package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts.map +1 -0
  196. package/dist/types/editors/workflow-editor/ui/ScheduleBuilder.d.ts.map +1 -1
  197. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts +2 -3
  198. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
  199. package/dist/types/editors/workflow-editor/ui/StepTest.d.ts +11 -0
  200. package/dist/types/editors/workflow-editor/ui/StepTest.d.ts.map +1 -0
  201. package/dist/types/editors/workflow-editor/ui/VariablesEditor.d.ts +0 -1
  202. package/dist/types/editors/workflow-editor/ui/VariablesEditor.d.ts.map +1 -1
  203. package/dist/types/editors/workflow-editor/ui/WorkflowCanvas.d.ts +1 -3
  204. package/dist/types/editors/workflow-editor/ui/WorkflowCanvas.d.ts.map +1 -1
  205. package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts +1 -3
  206. package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts.map +1 -1
  207. package/dist/types/editors/workflow-editor/ui/add-follow-up.d.ts +31 -0
  208. package/dist/types/editors/workflow-editor/ui/add-follow-up.d.ts.map +1 -0
  209. package/dist/types/editors/workflow-editor/ui/add-follow-up.test.d.ts +2 -0
  210. package/dist/types/editors/workflow-editor/ui/add-follow-up.test.d.ts.map +1 -0
  211. package/dist/types/editors/workflow-editor/ui/ap-edge.d.ts.map +1 -1
  212. package/dist/types/editors/workflow-editor/ui/ap-layout.d.ts +2 -1
  213. package/dist/types/editors/workflow-editor/ui/ap-layout.d.ts.map +1 -1
  214. package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts +7 -9
  215. package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts.map +1 -1
  216. package/dist/types/editors/workflow-editor/ui/block-meta.d.ts +10 -5
  217. package/dist/types/editors/workflow-editor/ui/block-meta.d.ts.map +1 -1
  218. package/dist/types/editors/workflow-editor/ui/blocks.d.ts +43 -2
  219. package/dist/types/editors/workflow-editor/ui/blocks.d.ts.map +1 -1
  220. package/dist/types/editors/workflow-editor/ui/blocks.test.d.ts +2 -0
  221. package/dist/types/editors/workflow-editor/ui/blocks.test.d.ts.map +1 -0
  222. package/dist/types/editors/workflow-editor/ui/canvas-menu.d.ts +4 -2
  223. package/dist/types/editors/workflow-editor/ui/canvas-menu.d.ts.map +1 -1
  224. package/dist/types/editors/workflow-editor/ui/connection-create.d.ts +3 -3
  225. package/dist/types/editors/workflow-editor/ui/connection-create.d.ts.map +1 -1
  226. package/dist/types/editors/workflow-editor/ui/design-time.d.ts +92 -0
  227. package/dist/types/editors/workflow-editor/ui/design-time.d.ts.map +1 -0
  228. package/dist/types/editors/workflow-editor/ui/design-time.test.d.ts +2 -0
  229. package/dist/types/editors/workflow-editor/ui/design-time.test.d.ts.map +1 -0
  230. package/dist/types/editors/workflow-editor/ui/expression-scope.d.ts +10 -2
  231. package/dist/types/editors/workflow-editor/ui/expression-scope.d.ts.map +1 -1
  232. package/dist/types/editors/workflow-editor/ui/forms.d.ts +35 -6
  233. package/dist/types/editors/workflow-editor/ui/forms.d.ts.map +1 -1
  234. package/dist/types/editors/workflow-editor/ui/model.d.ts +58 -13
  235. package/dist/types/editors/workflow-editor/ui/model.d.ts.map +1 -1
  236. package/dist/types/editors/workflow-editor/ui/piece-source.d.ts +11 -6
  237. package/dist/types/editors/workflow-editor/ui/piece-source.d.ts.map +1 -1
  238. package/dist/types/editors/workflow-editor/ui/prop-controls.d.ts +5 -0
  239. package/dist/types/editors/workflow-editor/ui/prop-controls.d.ts.map +1 -1
  240. package/dist/types/editors/workflow-editor/ui/prop-controls.test.d.ts +2 -0
  241. package/dist/types/editors/workflow-editor/ui/prop-controls.test.d.ts.map +1 -0
  242. package/dist/types/editors/workflow-editor/ui/prop-defaults.d.ts +4 -0
  243. package/dist/types/editors/workflow-editor/ui/prop-defaults.d.ts.map +1 -0
  244. package/dist/types/editors/workflow-editor/ui/prop-defaults.test.d.ts +2 -0
  245. package/dist/types/editors/workflow-editor/ui/prop-defaults.test.d.ts.map +1 -0
  246. package/dist/types/editors/workflow-editor/ui/query-keys.d.ts +54 -0
  247. package/dist/types/editors/workflow-editor/ui/query-keys.d.ts.map +1 -0
  248. package/dist/types/editors/workflow-editor/ui/schedule-draft.d.ts +3 -8
  249. package/dist/types/editors/workflow-editor/ui/schedule-draft.d.ts.map +1 -1
  250. package/dist/types/editors/workflow-editor/ui/secret-ref.d.ts +18 -0
  251. package/dist/types/editors/workflow-editor/ui/secret-ref.d.ts.map +1 -0
  252. package/dist/types/editors/workflow-editor/ui/step-test.d.ts +14 -0
  253. package/dist/types/editors/workflow-editor/ui/step-test.d.ts.map +1 -0
  254. package/dist/types/editors/workflow-editor/ui/step-test.test.d.ts +2 -0
  255. package/dist/types/editors/workflow-editor/ui/step-test.test.d.ts.map +1 -0
  256. package/dist/types/editors/workflow-editor/ui/test-state.d.ts +7 -0
  257. package/dist/types/editors/workflow-editor/ui/test-state.d.ts.map +1 -0
  258. package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts +2 -1
  259. package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts.map +1 -1
  260. package/dist/types/editors/workflow-editor/ui/use-validity.d.ts +28 -0
  261. package/dist/types/editors/workflow-editor/ui/use-validity.d.ts.map +1 -0
  262. package/dist/types/editors/workflow-editor/ui/validation.d.ts +33 -1
  263. package/dist/types/editors/workflow-editor/ui/validation.d.ts.map +1 -1
  264. package/dist/types/editors/workflow-editor/ui/variable-types.d.ts +14 -0
  265. package/dist/types/editors/workflow-editor/ui/variable-types.d.ts.map +1 -0
  266. package/dist/types/editors/workflow-editor/ui/variable-types.test.d.ts +2 -0
  267. package/dist/types/editors/workflow-editor/ui/variable-types.test.d.ts.map +1 -0
  268. package/dist/types/editors/workflow-editor/ui/version-badge.d.ts +33 -0
  269. package/dist/types/editors/workflow-editor/ui/version-badge.d.ts.map +1 -0
  270. package/dist/types/editors/workflow-editor/ui/version-badge.test.d.ts +2 -0
  271. package/dist/types/editors/workflow-editor/ui/version-badge.test.d.ts.map +1 -0
  272. package/dist/types/editors/workflow-editor/use-runtime-url.d.ts +0 -1
  273. package/dist/types/editors/workflow-editor/use-runtime-url.d.ts.map +1 -1
  274. package/dist/types/editors/workflow-studio/components/RunsTable.d.ts +1 -1
  275. package/dist/types/editors/workflow-studio/components/RunsTable.d.ts.map +1 -1
  276. package/dist/types/editors/workflow-studio/components/RunsView.d.ts +4 -1
  277. package/dist/types/editors/workflow-studio/components/RunsView.d.ts.map +1 -1
  278. package/dist/types/editors/workflow-studio/components/Sidebar.d.ts.map +1 -1
  279. package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts +1 -1
  280. package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts.map +1 -1
  281. package/dist/types/editors/workflow-studio/components/WorkflowHeader.d.ts +2 -1
  282. package/dist/types/editors/workflow-studio/components/WorkflowHeader.d.ts.map +1 -1
  283. package/dist/types/editors/workflow-studio/components/WorkflowMenu.d.ts +13 -0
  284. package/dist/types/editors/workflow-studio/components/WorkflowMenu.d.ts.map +1 -0
  285. package/dist/types/editors/workflow-studio/components/WorkflowSteps.d.ts +1 -1
  286. package/dist/types/editors/workflow-studio/components/WorkflowSteps.d.ts.map +1 -1
  287. package/dist/types/editors/workflow-studio/components/WorkflowStudio.d.ts +0 -1
  288. package/dist/types/editors/workflow-studio/components/WorkflowStudio.d.ts.map +1 -1
  289. package/dist/types/editors/workflow-studio/components/chain.d.ts +5 -3
  290. package/dist/types/editors/workflow-studio/components/chain.d.ts.map +1 -1
  291. package/dist/types/editors/workflow-studio/components/run-format.d.ts +11 -2
  292. package/dist/types/editors/workflow-studio/components/run-format.d.ts.map +1 -1
  293. package/dist/types/editors/workflow-studio/components/step-outline.d.ts +3 -1
  294. package/dist/types/editors/workflow-studio/components/step-outline.d.ts.map +1 -1
  295. package/dist/types/editors/workflow-studio/components/ui.d.ts +2 -0
  296. package/dist/types/editors/workflow-studio/components/ui.d.ts.map +1 -1
  297. package/dist/types/editors/workflow-studio/components/useRuns.d.ts +4 -1
  298. package/dist/types/editors/workflow-studio/components/useRuns.d.ts.map +1 -1
  299. package/dist/types/editors/workflow-studio/editor.d.ts.map +1 -1
  300. package/dist/types/pieces/index.d.ts.map +1 -1
  301. package/dist/types/pieces/reactor/lib/actions/action-list-prop.test.d.ts +2 -0
  302. package/dist/types/pieces/reactor/lib/actions/action-list-prop.test.d.ts.map +1 -0
  303. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts +14 -1
  304. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts.map +1 -1
  305. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts +14 -1
  306. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts.map +1 -1
  307. package/dist/types/pieces/reactor/lib/actions/document-get.d.ts +1 -0
  308. package/dist/types/pieces/reactor/lib/actions/document-get.d.ts.map +1 -1
  309. package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts +1 -0
  310. package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts.map +1 -1
  311. package/dist/types/pieces/reactor/lib/input-props.d.ts.map +1 -1
  312. package/dist/types/pieces/reactor/lib/input-schema.d.ts +11 -2
  313. package/dist/types/pieces/reactor/lib/input-schema.d.ts.map +1 -1
  314. package/dist/types/pieces/reactor/lib/parse.d.ts +22 -4
  315. package/dist/types/pieces/reactor/lib/parse.d.ts.map +1 -1
  316. package/dist/types/pieces/reactor/lib/reactor.d.ts +15 -1
  317. package/dist/types/pieces/reactor/lib/reactor.d.ts.map +1 -1
  318. package/dist/types/scripts/ui-stack.d.ts +53 -11
  319. package/dist/types/scripts/ui-stack.d.ts.map +1 -1
  320. package/dist/types/test/ui/block-picker.spec.d.ts +2 -0
  321. package/dist/types/test/ui/block-picker.spec.d.ts.map +1 -0
  322. package/dist/types/test/ui/branch.spec.d.ts +2 -0
  323. package/dist/types/test/ui/branch.spec.d.ts.map +1 -0
  324. package/dist/types/test/ui/canvas-logos.spec.d.ts +2 -0
  325. package/dist/types/test/ui/canvas-logos.spec.d.ts.map +1 -0
  326. package/dist/types/test/ui/fixtures.d.ts +1 -0
  327. package/dist/types/test/ui/fixtures.d.ts.map +1 -1
  328. package/dist/types/test/ui/global-setup.d.ts.map +1 -1
  329. package/dist/types/test/ui/harness/prop-controls.d.ts.map +1 -1
  330. package/dist/types/test/ui/piece-version.spec.d.ts +2 -0
  331. package/dist/types/test/ui/piece-version.spec.d.ts.map +1 -0
  332. package/dist/types/test/ui/ports.spec.d.ts +2 -0
  333. package/dist/types/test/ui/ports.spec.d.ts.map +1 -0
  334. package/dist/types/test/ui/publish.spec.d.ts +2 -0
  335. package/dist/types/test/ui/publish.spec.d.ts.map +1 -0
  336. package/dist/types/test/ui/step-test.spec.d.ts +2 -0
  337. package/dist/types/test/ui/step-test.spec.d.ts.map +1 -0
  338. package/dist/types/test/ui/variables.spec.d.ts +2 -0
  339. package/dist/types/test/ui/variables.spec.d.ts.map +1 -0
  340. package/dist/types/test/ui/webhook.spec.d.ts +2 -0
  341. package/dist/types/test/ui/webhook.spec.d.ts.map +1 -0
  342. package/dist/types/test/ui/workflow-menu.spec.d.ts +2 -0
  343. package/dist/types/test/ui/workflow-menu.spec.d.ts.map +1 -0
  344. package/package.json +11 -10
  345. package/dist/browser/BlockSelector-D24DIiSX.js +0 -1388
  346. package/dist/browser/BlockSelector-D24DIiSX.js.map +0 -1
  347. package/dist/browser/connection-form-D-NETdDQ.js.map +0 -1
  348. package/dist/browser/editor-B6N0PCuZ.js.map +0 -1
  349. package/dist/browser/editor-BkdwuOC-.js.map +0 -1
  350. package/dist/browser/editor-CZ5NvCyv.js.map +0 -1
  351. package/dist/browser/module-Bkms70LV.js.map +0 -1
  352. package/dist/browser/piece-auth-Z4mZEOtL.js.map +0 -1
  353. package/dist/browser/runtime-api-DDMQc4PB.js +0 -558
  354. package/dist/browser/runtime-api-DDMQc4PB.js.map +0 -1
  355. package/dist/browser/trigger-text-CUv5Z2Uk.js +0 -551
  356. package/dist/browser/trigger-text-CUv5Z2Uk.js.map +0 -1
  357. package/dist/browser/workflow-CGtVlhr8.js.map +0 -1
  358. package/dist/node/BlockSelector-CTmmpYxu.mjs +0 -1388
  359. package/dist/node/BlockSelector-CTmmpYxu.mjs.map +0 -1
  360. package/dist/node/connection-form-C9vbfSnA.mjs.map +0 -1
  361. package/dist/node/editor-By9BHI8e.mjs.map +0 -1
  362. package/dist/node/editor-DP36YDk5.mjs.map +0 -1
  363. package/dist/node/editor-StBssjcQ.mjs.map +0 -1
  364. package/dist/node/module-DuxxhgKs.mjs.map +0 -1
  365. package/dist/node/piece-auth-Z4mZEOtL.mjs.map +0 -1
  366. package/dist/node/runtime-api-DDMQc4PB.mjs +0 -558
  367. package/dist/node/runtime-api-DDMQc4PB.mjs.map +0 -1
  368. package/dist/node/trigger-text-Bzq6VfOQ.mjs +0 -551
  369. package/dist/node/trigger-text-Bzq6VfOQ.mjs.map +0 -1
  370. package/dist/node/workflow-C-uuQPnf.mjs.map +0 -1
  371. package/dist/types/editors/workflow-editor/runtime-api.test.d.ts +0 -2
  372. package/dist/types/editors/workflow-editor/runtime-api.test.d.ts.map +0 -1
  373. package/dist/types/editors/workflow-editor/runtime-piece-source.d.ts +0 -2
  374. package/dist/types/editors/workflow-editor/runtime-piece-source.d.ts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"editor-StBssjcQ.mjs","names":["RING","RAIL","WORKFLOW_TYPE","WORKFLOW_TYPE","workflow","workflowActions"],"sources":["../../editors/workflow-studio/components/chain.tsx","../../editors/workflow-studio/components/ui.tsx","../../editors/workflow-studio/components/RunsTable.tsx","../../editors/workflow-studio/components/RunsView.tsx","../../editors/workflow-studio/components/Sidebar.tsx","../../editors/workflow-studio/components/use-hash-selection.ts","../../editors/workflow-studio/components/useRuns.ts","../../editors/workflow-studio/components/step-outline.ts","../../editors/workflow-studio/components/WorkflowBoard.tsx","../../editors/workflow-studio/components/WorkflowSteps.tsx","../../editors/workflow-studio/components/WorkflowHeader.tsx","../../editors/workflow-studio/components/WorkflowStudio.tsx","../../editors/workflow-studio/config.ts","../../editors/workflow-studio/editor.tsx"],"sourcesContent":["// A workflow drawn as its chain of piece logos joined by a rail coloured by a\n// run: the studio's signature, used by the overview, the header and each run.\nimport type { RunRecord } from \"../../workflow-editor/runtime-api.js\";\nimport { BlockLogo } from \"../../workflow-editor/ui/BlockSelector.js\";\nimport {\n formatAbsolute,\n RUN_TONE,\n STEP_TONE,\n statusLabel,\n toneOf,\n type Tone,\n} from \"./run-format.js\";\n\nexport interface ChainLink {\n id: string;\n blockType: string;\n label: string;\n // How the run fared here; undefined when it never got this far.\n status?: string;\n}\n\nconst RING: Record<Tone, string> = {\n ok: \"ring-wf-ok\",\n fail: \"ring-wf-fail\",\n warn: \"ring-wf-warn\",\n run: \"ring-wf-run\",\n idle: \"ring-foreground/15\",\n};\n\nconst RAIL: Record<Tone, string> = {\n ok: \"bg-wf-ok\",\n fail: \"bg-wf-fail\",\n warn: \"bg-wf-warn\",\n run: \"bg-wf-run\",\n idle: \"bg-foreground/15\",\n};\n\n// Past this many stops the chain ends in \"+N\", so a long workflow can't spill\n// into the next column; the label still names every step.\nconst MAX_STOPS = 6;\n\nexport function MiniChain(props: { links: ChainLink[]; size?: \"sm\" | \"md\" }) {\n const md = props.size === \"md\";\n const overflow = props.links.length > MAX_STOPS;\n const shown = overflow ? props.links.slice(0, MAX_STOPS - 1) : props.links;\n const hidden = props.links.length - shown.length;\n const tones = shown.map((link) =>\n link.status ? toneOf(STEP_TONE, link.status) : \"idle\",\n );\n return (\n <ol\n className=\"flex items-center\"\n aria-label={props.links\n .map(\n (link) =>\n `${link.label}${link.status ? `: ${link.status.toLowerCase()}` : \"\"}`,\n )\n .join(\", \")}\n >\n {shown.map((link, index) => (\n <li key={link.id} className=\"flex items-center\">\n {index > 0 ? (\n <span\n aria-hidden\n className={`h-0.5 ${md ? \"w-5\" : \"w-3\"} ${RAIL[tones[index]]}`}\n />\n ) : null}\n <span\n title={\n link.status\n ? `${link.label}: ${link.status.toLowerCase()}`\n : link.label\n }\n className={`flex shrink-0 items-center justify-center rounded-full bg-card ring-[1.5px] dark:bg-white ${\n md ? \"h-8 w-8\" : \"h-6 w-6\"\n } ${RING[tones[index]]} ${link.status === \"SKIPPED\" ? \"opacity-50\" : \"\"}`}\n >\n <BlockLogo bare blockType={link.blockType} size={md ? 16 : 14} />\n </span>\n </li>\n ))}\n {overflow ? (\n <li aria-hidden className=\"flex items-center\">\n <span className={`h-0.5 ${md ? \"w-5\" : \"w-3\"} bg-foreground/15`} />\n <span\n title={props.links\n .slice(shown.length)\n .map((link) => link.label)\n .join(\", \")}\n className={`flex shrink-0 items-center justify-center rounded-full bg-muted px-1.5 text-[11px] font-medium tabular-nums text-muted-foreground ${\n md ? \"h-8\" : \"h-6\"\n }`}\n >\n +{hidden}\n </span>\n </li>\n ) : null}\n </ol>\n );\n}\n\n/** A run's own chain: the trigger, then every step it recorded. */\nexport function runLinks(\n run: RunRecord,\n triggerBlockType?: string,\n): ChainLink[] {\n return [\n {\n id: \"trigger\",\n blockType: triggerBlockType ?? `core#${run.triggerKind}`,\n label: \"Trigger\",\n status: \"SUCCEEDED\",\n },\n ...run.steps.map((step) => ({\n id: step.stepId + step.stepKey,\n blockType: step.blockType,\n label: step.stepKey,\n status: step.status,\n })),\n ];\n}\n\nconst STRIP_LENGTH = 14;\n\nconst TICK: Record<Tone, string> = {\n ok: \"bg-wf-ok\",\n fail: \"bg-wf-fail\",\n warn: \"bg-wf-warn\",\n run: \"bg-wf-run animate-pulse\",\n idle: \"bg-foreground/25\",\n};\n\n/** Recent runs as ticks, oldest to newest, padded so strips line up. */\nexport function RunStrip(props: { runs: RunRecord[] }) {\n // Runs arrive newest first.\n const recent = props.runs.slice(0, STRIP_LENGTH).reverse();\n const padding = STRIP_LENGTH - recent.length;\n return (\n <span\n className=\"flex h-5 items-end gap-[3px]\"\n aria-label={\n recent.length === 0\n ? \"No runs yet\"\n : `Last ${recent.length} runs: ${recent.map((run) => run.status.toLowerCase()).join(\", \")}`\n }\n >\n {Array.from({ length: padding }, (_, index) => (\n <span\n key={`pad-${index}`}\n aria-hidden\n className=\"h-1.5 w-1.5 rounded-full bg-foreground/10\"\n />\n ))}\n {recent.map((run) => (\n <span\n key={run.id}\n aria-hidden\n title={`${statusLabel(run.status)}, ${formatAbsolute(run.startedAt)}`}\n className={`h-5 w-1.5 rounded-full ${TICK[toneOf(RUN_TONE, run.status)]}`}\n />\n ))}\n </span>\n );\n}\n","// Studio building blocks, drawn from Connect's theme tokens so both themes work.\nimport type { ReactNode } from \"react\";\nexport { Button } from \"../../shared/controls.js\";\nexport { Icon } from \"../../shared/icons.js\";\nimport { statusLabel, TONE_DOT, TONE_TEXT, type Tone } from \"./run-format.js\";\n\n// A draft or unknown state is hollow, so it never reads as healthy.\nexport function StatusDot(props: { tone: Tone; className?: string }) {\n const hollow = props.tone === \"idle\";\n return (\n <span\n aria-hidden\n className={`inline-block h-2 w-2 shrink-0 rounded-full ${\n hollow\n ? \"border border-solid border-muted-foreground/60\"\n : TONE_DOT[props.tone]\n } ${props.className ?? \"\"}`}\n />\n );\n}\n\nexport function StatusText(props: {\n tone: Tone;\n status: string;\n className?: string;\n}) {\n return (\n <span\n className={`inline-flex items-center gap-1.5 font-medium ${TONE_TEXT[props.tone]} ${props.className ?? \"\"}`}\n >\n <StatusDot tone={props.tone} />\n {statusLabel(props.status)}\n </span>\n );\n}\n\n/** A label/value pair for a header's facts line. */\nexport function Fact(props: {\n label: string;\n children: ReactNode;\n title?: string;\n}) {\n return (\n <div className=\"flex min-w-0 flex-col gap-0.5\" title={props.title}>\n <dt className=\"text-xs text-muted-foreground\">{props.label}</dt>\n <dd className=\"truncate text-[13px] tabular-nums text-foreground\">\n {props.children}\n </dd>\n </div>\n );\n}\n","// The run journal as a filterable table. Rows expand in place to their step\n// executions, so drilling into a failure never leaves the list.\nimport { Fragment, useMemo, useState } from \"react\";\nimport {\n rerunRun,\n type RunRecord,\n type RunStepRecord,\n} from \"../../workflow-editor/runtime-api.js\";\nimport {\n blockMeta,\n usePieceLogos,\n} from \"../../workflow-editor/ui/block-meta.js\";\nimport { describeTrigger } from \"../../workflow-editor/ui/trigger-text.js\";\nimport {\n formatAbsolute,\n formatDuration,\n formatMs,\n formatTrigger,\n formatWhen,\n durationMs,\n RUN_STATUSES,\n RUN_TONE,\n runTimeline,\n STEP_TONE,\n statusLabel,\n toneOf,\n TONE_DOT,\n type TimelineSpan,\n type Tone,\n} from \"./run-format.js\";\nimport { useWorkflowDocumentsInSelectedDrive } from \"document-models/workflow\";\nimport { MiniChain, runLinks } from \"./chain.js\";\nimport { Select } from \"../../shared/controls.js\";\nimport { DataViewer } from \"../../shared/data-viewer.js\";\nimport { Button, Icon, StatusText } from \"./ui.js\";\n\ntype StatusFilter = \"ALL\" | (typeof RUN_STATUSES)[number];\ntype SortKey = \"startedAt\" | \"duration\";\n\nconst CONTROL =\n \"h-8 rounded-md border border-solid border-border bg-card px-2.5 text-[13px] text-foreground placeholder:text-muted-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring\";\n\nfunction stringify(value: unknown): string {\n if (value === undefined) return \"\";\n try {\n return JSON.stringify(value, null, 2);\n } catch {\n return String(value as string);\n }\n}\n\n// The step's slice of the run, drawn on a track shared by every row.\nfunction TimelineBar(props: { span?: TimelineSpan; tone: Tone }) {\n return (\n <span className=\"ml-auto flex shrink-0 items-center gap-2\">\n <span\n aria-hidden\n className=\"relative hidden h-1.5 w-40 overflow-hidden rounded-full bg-muted sm:block\"\n >\n {props.span ? (\n <span\n className={`absolute inset-y-0 rounded-full ${TONE_DOT[props.tone]}`}\n style={{\n left: `${props.span.offset * 100}%`,\n width: `max(${props.span.width * 100}%, 4px)`,\n }}\n />\n ) : null}\n </span>\n <span className=\"w-14 text-right text-[11px] tabular-nums text-muted-foreground\">\n {props.span ? formatMs(props.span.ms) : \"–\"}\n </span>\n </span>\n );\n}\n\nfunction StepRow(props: {\n step: RunStepRecord;\n name?: string;\n span?: TimelineSpan;\n}) {\n const { step } = props;\n const meta = blockMeta(step.blockType);\n const [open, setOpen] = useState(false);\n return (\n <div role=\"listitem\" className=\"border-t border-solid border-border\">\n <button\n type=\"button\"\n aria-expanded={open}\n className=\"flex w-full items-center gap-3 px-3 py-2 text-left text-[13px] hover:bg-accent/60 focus-visible:bg-accent/60 focus-visible:outline-none\"\n onClick={() => setOpen((value) => !value)}\n >\n <Icon\n name=\"chevron\"\n className={`h-3.5 w-3.5 text-muted-foreground transition-transform ${open ? \"rotate-90\" : \"\"}`}\n />\n <StatusText\n tone={toneOf(STEP_TONE, step.status)}\n status={step.status}\n className=\"w-24 shrink-0 text-xs\"\n />\n <span\n className=\"shrink-0 font-medium text-foreground\"\n title={`Key: ${step.stepKey}`}\n >\n {props.name ?? step.stepKey}\n </span>\n <span className=\"flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground\">\n {meta.logoUrl ? (\n <img\n src={meta.logoUrl}\n alt=\"\"\n title={meta.subtitle}\n className=\"h-3.5 w-3.5\"\n />\n ) : null}\n <span className=\"truncate\">\n {meta.logoUrl\n ? meta.displayName\n : `${meta.subtitle}: ${meta.displayName}`}\n </span>\n </span>\n {step.port && step.port !== \"next\" ? (\n <span className=\"shrink-0 rounded bg-muted px-1.5 text-[11px] text-muted-foreground\">\n took {step.port}\n </span>\n ) : null}\n <TimelineBar span={props.span} tone={toneOf(STEP_TONE, step.status)} />\n </button>\n {open ? (\n <div className=\"space-y-2 pb-3 pl-10 pr-3\">\n {step.error ? (\n <pre className=\"overflow-x-auto whitespace-pre-wrap rounded-md bg-wf-fail/10 p-2 text-xs text-wf-fail\">\n {step.error}\n </pre>\n ) : null}\n {step.status === \"SKIPPED\" ? (\n <p className=\"text-xs text-muted-foreground\">\n The run never reached this step.\n </p>\n ) : (\n <div className=\"grid items-start gap-2 md:grid-cols-2\">\n <DataViewer label=\"Received\" value={step.input} />\n <DataViewer\n label=\"Produced\"\n value={step.output}\n root={`steps.${step.stepKey}.output`}\n emptyText={\n step.status === \"FAILED\"\n ? \"Nothing, the step failed\"\n : undefined\n }\n />\n </div>\n )}\n </div>\n ) : null}\n </div>\n );\n}\n\nexport const TRIGGER_LABEL: Record<string, string> = {\n manual: \"Manual\",\n schedule: \"Schedule\",\n webhook: \"Webhook\",\n \"document-event\": \"Document change\",\n piece: \"Piece trigger\",\n rerun: \"Rerun\",\n};\n\nexport function triggerLabel(kind: string): string {\n // A piece run records \"piece:<blockType>\"; name it as the workflow list does.\n if (kind.startsWith(\"piece:\")) {\n return describeTrigger({ blockType: kind.slice(6), config: null });\n }\n return TRIGGER_LABEL[kind] ?? formatTrigger(kind);\n}\n\n// \"Step \\\"ping\\\" failed: …\" reads better with the step's own name.\nfunction describeRunError(error: string, names: Map<string, string>): string {\n return error.replace(/^Step \"([^\"]+)\" failed: /, (whole, key: string) => {\n const name = names.get(key);\n return name ? `${name} failed: ` : whole;\n });\n}\n\n// What started the run, drawn as the first row of its step list.\nfunction TriggerRow(props: { run: RunRecord }) {\n const { run } = props;\n const [open, setOpen] = useState(false);\n const payload = stringify(run.triggerPayload);\n const hasPayload = payload !== \"\" && payload !== \"null\" && payload !== \"{}\";\n return (\n <div role=\"listitem\">\n <button\n type=\"button\"\n aria-expanded={hasPayload ? open : undefined}\n disabled={!hasPayload}\n className=\"flex w-full items-center gap-3 px-3 py-2 text-left text-[13px] enabled:hover:bg-accent/60 focus-visible:bg-accent/60 focus-visible:outline-none\"\n onClick={() => setOpen((value) => !value)}\n >\n <Icon\n name=\"chevron\"\n className={`h-3.5 w-3.5 text-muted-foreground transition-transform ${open ? \"rotate-90\" : \"\"} ${hasPayload ? \"\" : \"invisible\"}`}\n />\n <StatusText\n tone=\"ok\"\n status=\"FIRED\"\n className=\"w-24 shrink-0 text-xs\"\n />\n <span className=\"shrink-0 font-medium text-foreground\">Trigger</span>\n <span className=\"truncate text-xs text-muted-foreground\">\n {triggerLabel(run.triggerKind)}\n </span>\n {!hasPayload ? (\n <span className=\"shrink-0 text-[11px] text-muted-foreground\">\n No payload\n </span>\n ) : null}\n <span className=\"ml-auto flex shrink-0 items-center gap-2\">\n <span aria-hidden className=\"relative hidden h-1.5 w-40 sm:block\">\n <span className=\"absolute inset-y-0 left-0 w-1 rounded-full bg-wf-ok\" />\n </span>\n <span className=\"w-14 text-right text-[11px] tabular-nums text-muted-foreground\">\n {new Date(run.startedAt).toLocaleTimeString([], {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: false,\n })}\n </span>\n </span>\n </button>\n {open ? (\n <div className=\"pb-3 pl-10 pr-3\">\n <DataViewer\n label=\"Payload\"\n value={run.triggerPayload}\n root=\"trigger.payload\"\n />\n </div>\n ) : null}\n </div>\n );\n}\n\nfunction RunDetail(props: {\n run: RunRecord;\n names: Map<string, string>;\n onChanged: () => void;\n}) {\n const { run, names } = props;\n const timeline = runTimeline(run);\n const [rerunning, setRerunning] = useState(false);\n const [rerunError, setRerunError] = useState<string | null>(null);\n return (\n <div className=\"space-y-3 bg-muted/40 px-4 py-4\">\n {run.error ? (\n <p className=\"rounded-md bg-wf-fail/10 px-3 py-2 text-[13px] text-wf-fail\">\n {describeRunError(run.error, names)}\n </p>\n ) : null}\n <div className=\"flex flex-wrap items-center gap-x-5 gap-y-1 text-xs text-muted-foreground\">\n <span>\n Run <span className=\"font-mono\">{run.id.slice(0, 8)}</span>\n </span>\n <span>Started {formatAbsolute(run.startedAt)}</span>\n {run.rerunOf ? (\n <span>\n Resumes <span className=\"font-mono\">{run.rerunOf.slice(0, 8)}</span>\n </span>\n ) : null}\n {run.status === \"FAILED\" ? (\n <Button\n className=\"ml-auto\"\n disabled={rerunning}\n onClick={() => {\n setRerunning(true);\n setRerunError(null);\n rerunRun(run.id)\n .then((result) => setRerunError(result.error))\n .catch((error: unknown) =>\n setRerunError(\n error instanceof Error ? error.message : String(error),\n ),\n )\n .finally(() => {\n setRerunning(false);\n props.onChanged();\n });\n }}\n >\n <Icon name=\"retry\" className=\"h-3.5 w-3.5\" />\n {rerunning ? \"Rerunning…\" : \"Rerun from failed step\"}\n </Button>\n ) : null}\n {rerunError ? <span className=\"text-wf-fail\">{rerunError}</span> : null}\n </div>\n <div\n role=\"list\"\n aria-label=\"Steps of this run\"\n className=\"overflow-hidden rounded-md border border-solid border-border bg-card\"\n >\n <TriggerRow run={run} />\n {run.steps.map((step) => (\n <StepRow\n key={step.stepId + step.stepKey}\n step={step}\n name={names.get(step.stepKey)}\n span={timeline.get(step.stepId)}\n />\n ))}\n {run.steps.length === 0 ? (\n <p className=\"border-t border-solid border-border px-3 py-2 pl-10 text-xs text-muted-foreground\">\n No steps ran.\n </p>\n ) : null}\n </div>\n </div>\n );\n}\n\nfunction SortHeader(props: {\n label: string;\n active: boolean;\n descending: boolean;\n onClick: () => void;\n className?: string;\n}) {\n return (\n <th scope=\"col\" className={props.className}>\n <button\n type=\"button\"\n className={`flex items-center gap-1 hover:text-foreground ${props.active ? \"text-foreground\" : \"\"}`}\n onClick={props.onClick}\n >\n {props.label}\n <span aria-hidden className={props.active ? \"\" : \"opacity-0\"}>\n {props.descending ? \"↓\" : \"↑\"}\n </span>\n </button>\n </th>\n );\n}\n\nexport function RunsTable(props: {\n runs: RunRecord[];\n showWorkflow: boolean;\n onChanged: () => void;\n}) {\n const [query, setQuery] = useState(\"\");\n const [status, setStatus] = useState<StatusFilter>(\"ALL\");\n const [workflow, setWorkflow] = useState(\"ALL\");\n const [trigger, setTrigger] = useState(\"ALL\");\n const [sort, setSort] = useState<SortKey>(\"startedAt\");\n const [descending, setDescending] = useState(true);\n const [expanded, setExpanded] = useState<string | null>(null);\n // Each run's chain starts at its workflow's trigger block.\n const documents = useWorkflowDocumentsInSelectedDrive() ?? [];\n const triggerBlock = new Map(\n documents.map((document) => [\n document.header.id,\n document.state.global.trigger?.blockType,\n ]),\n );\n // Step names by key, per workflow; a run of an older version falls back\n // to the keys it recorded.\n const stepNames = new Map(\n documents.map((document) => [\n document.header.id,\n new Map(\n document.state.global.steps.map((step) => [\n step.key,\n step.name || step.key,\n ]),\n ),\n ]),\n );\n // Piece logos and names arrive with the catalog.\n usePieceLogos();\n\n const workflowOptions = useMemo(\n () =>\n [...new Map(props.runs.map((run) => [run.workflowId, run.workflowName]))]\n .map(([id, name]) => ({ id, name }))\n .sort((a, b) => a.name.localeCompare(b.name)),\n [props.runs],\n );\n const triggerOptions = useMemo(\n () => [...new Set(props.runs.map((run) => run.triggerKind))].sort(),\n [props.runs],\n );\n\n // Everything except the status filter, so the status counts describe what\n // picking each one would actually show.\n const scoped = useMemo(() => {\n const needle = query.trim().toLowerCase();\n return props.runs.filter((run) => {\n if (workflow !== \"ALL\" && run.workflowId !== workflow) return false;\n if (trigger !== \"ALL\" && run.triggerKind !== trigger) return false;\n if (!needle) return true;\n return (\n run.workflowName.toLowerCase().includes(needle) ||\n run.id.toLowerCase().includes(needle) ||\n (run.error?.toLowerCase().includes(needle) ?? false) ||\n run.steps.some((step) => step.stepKey.toLowerCase().includes(needle))\n );\n });\n }, [props.runs, query, workflow, trigger]);\n\n const counts = useMemo(\n () => ({\n ALL: scoped.length,\n RUNNING: scoped.filter((run) => run.status === \"RUNNING\").length,\n SUCCEEDED: scoped.filter((run) => run.status === \"SUCCEEDED\").length,\n FAILED: scoped.filter((run) => run.status === \"FAILED\").length,\n }),\n [scoped],\n );\n\n const visible = useMemo(() => {\n const rows = scoped.filter(\n (run) => status === \"ALL\" || run.status === status,\n );\n const direction = descending ? -1 : 1;\n return [...rows].sort((a, b) => {\n if (sort === \"duration\") {\n // An unfinished run has no duration yet; keep those together.\n const left = durationMs(a.startedAt, a.endedAt) ?? Infinity;\n const right = durationMs(b.startedAt, b.endedAt) ?? Infinity;\n return (left - right) * direction;\n }\n return (\n (new Date(a.startedAt).getTime() - new Date(b.startedAt).getTime()) *\n direction\n );\n });\n }, [scoped, status, sort, descending]);\n\n const filtered = query.trim() || workflow !== \"ALL\" || trigger !== \"ALL\";\n const sortBy = (key: SortKey) => {\n if (key === sort) {\n setDescending((value) => !value);\n return;\n }\n setSort(key);\n setDescending(true);\n };\n\n return (\n <div>\n <div className=\"mb-3 flex flex-wrap items-center gap-2\">\n <div className=\"flex h-8 items-center gap-0.5 rounded-md bg-muted p-0.5\">\n {([\"ALL\", ...RUN_STATUSES] as StatusFilter[]).map((option) => (\n <button\n key={option}\n type=\"button\"\n aria-pressed={status === option}\n className={`h-7 rounded px-2.5 text-[13px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${\n status === option\n ? \"bg-card font-medium text-foreground shadow-sm\"\n : \"text-muted-foreground hover:text-foreground\"\n }`}\n onClick={() => setStatus(option)}\n >\n {option === \"ALL\" ? \"All\" : statusLabel(option)}\n <span className=\"ml-1.5 tabular-nums text-muted-foreground\">\n {counts[option]}\n </span>\n </button>\n ))}\n </div>\n <input\n type=\"search\"\n className={`${CONTROL} w-48`}\n placeholder=\"Search runs\"\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n />\n {props.showWorkflow && workflowOptions.length > 1 ? (\n <div className=\"w-44\">\n <Select\n value={workflow}\n options={[\n { value: \"ALL\", label: \"Every workflow\" },\n ...workflowOptions.map((option) => ({\n value: option.id,\n label: option.name,\n })),\n ]}\n onChange={setWorkflow}\n />\n </div>\n ) : null}\n {triggerOptions.length > 1 ? (\n <div className=\"w-40\">\n <Select\n value={trigger}\n options={[\n { value: \"ALL\", label: \"Every trigger\" },\n ...triggerOptions.map((option) => ({\n value: option,\n label: triggerLabel(option),\n })),\n ]}\n onChange={setTrigger}\n />\n </div>\n ) : null}\n {filtered ? (\n <button\n type=\"button\"\n className=\"text-[13px] text-muted-foreground underline underline-offset-2 hover:text-foreground\"\n onClick={() => {\n setQuery(\"\");\n setWorkflow(\"ALL\");\n setTrigger(\"ALL\");\n }}\n >\n Clear filters\n </button>\n ) : null}\n <span className=\"ml-auto text-xs tabular-nums text-muted-foreground\">\n {visible.length} of {props.runs.length} runs\n </span>\n </div>\n\n <div className=\"overflow-x-auto rounded-lg border border-solid border-border bg-card\">\n <table className=\"w-full border-collapse text-left\">\n <thead>\n <tr className=\"border-b border-solid border-border text-xs font-medium text-muted-foreground\">\n <th scope=\"col\" className=\"px-3 py-2.5 font-medium\">\n Status\n </th>\n {props.showWorkflow ? (\n <th scope=\"col\" className=\"px-3 py-2.5 font-medium\">\n Workflow\n </th>\n ) : null}\n <th scope=\"col\" className=\"px-3 py-2.5 font-medium\">\n Trigger\n </th>\n <SortHeader\n label=\"Started\"\n className=\"px-3 py-2.5 font-medium\"\n active={sort === \"startedAt\"}\n descending={descending}\n onClick={() => sortBy(\"startedAt\")}\n />\n <SortHeader\n label=\"Duration\"\n className=\"px-3 py-2.5 font-medium\"\n active={sort === \"duration\"}\n descending={descending}\n onClick={() => sortBy(\"duration\")}\n />\n <th scope=\"col\" className=\"px-3 py-2.5 font-medium\">\n Steps\n </th>\n <th scope=\"col\" className=\"w-8 px-3 py-2\">\n <span className=\"sr-only\">Details</span>\n </th>\n </tr>\n </thead>\n <tbody>\n {visible.length === 0 ? (\n <tr>\n <td\n colSpan={props.showWorkflow ? 7 : 6}\n className=\"px-3 py-8 text-center text-[13px] text-muted-foreground\"\n >\n No runs match these filters.\n </td>\n </tr>\n ) : (\n visible.map((run) => {\n const open = expanded === run.id;\n return (\n <Fragment key={run.id}>\n <tr\n className={`cursor-pointer border-b border-solid border-border text-[13px] last:border-b-0 ${\n open ? \"bg-muted/40\" : \"hover:bg-accent/60\"\n }`}\n onClick={() => setExpanded(open ? null : run.id)}\n >\n <td className=\"px-3 py-2.5\">\n <StatusText\n tone={toneOf(RUN_TONE, run.status)}\n status={run.status}\n />\n </td>\n {props.showWorkflow ? (\n <td className=\"max-w-48 truncate px-3 py-2.5 font-medium text-foreground\">\n {run.workflowName}\n </td>\n ) : null}\n <td className=\"px-3 py-2.5 text-muted-foreground\">\n {triggerLabel(run.triggerKind)}\n <span className=\"ml-1.5 text-xs text-muted-foreground/70\">\n v{run.workflowVersion}\n </span>\n </td>\n <td\n className=\"whitespace-nowrap px-3 py-2.5 tabular-nums text-muted-foreground\"\n title={formatAbsolute(run.startedAt)}\n >\n {formatWhen(run.startedAt)}\n </td>\n <td className=\"whitespace-nowrap px-3 py-2.5 tabular-nums text-muted-foreground\">\n {formatDuration(run.startedAt, run.endedAt)}\n </td>\n <td className=\"px-3 py-2\">\n <MiniChain\n links={runLinks(\n run,\n triggerBlock.get(run.workflowId),\n )}\n />\n </td>\n <td className=\"px-3 py-2.5\">\n <button\n type=\"button\"\n aria-expanded={open}\n aria-label={`${open ? \"Hide\" : \"Show\"} steps of the run started ${formatAbsolute(run.startedAt)}`}\n className=\"flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n onClick={(event) => {\n event.stopPropagation();\n setExpanded(open ? null : run.id);\n }}\n >\n <Icon\n name=\"chevron\"\n className={`h-3.5 w-3.5 transition-transform ${open ? \"rotate-90\" : \"\"}`}\n />\n </button>\n </td>\n </tr>\n {open ? (\n <tr>\n <td\n colSpan={props.showWorkflow ? 7 : 6}\n className=\"border-b border-solid border-border p-0\"\n >\n <RunDetail\n run={run}\n names={stepNames.get(run.workflowId) ?? new Map()}\n onChanged={props.onChanged}\n />\n </td>\n </tr>\n ) : null}\n </Fragment>\n );\n })\n )}\n </tbody>\n </table>\n </div>\n </div>\n );\n}\n","// The runs pane: what scope is being shown, how to fire it, and the journal.\n// The run feed is owned by the studio so the header shares these rows.\nimport { useState } from \"react\";\nimport type { RunRecord } from \"../../workflow-editor/runtime-api.js\";\nimport { RunsTable } from \"./RunsTable.js\";\nimport { Button, Icon } from \"./ui.js\";\n\nexport function RunsView(props: {\n title: string;\n runs: RunRecord[] | null;\n error: string | null;\n reload: () => void;\n showWorkflow: boolean;\n // Present only for manual-trigger workflows.\n onFire?: () => Promise<string | null>;\n}) {\n const [firing, setFiring] = useState(false);\n const [fireError, setFireError] = useState<string | null>(null);\n const { runs } = props;\n\n return (\n <div className=\"w-full\">\n <div className=\"mb-4 flex items-center gap-3\">\n <h2 className=\"text-[15px] font-semibold text-foreground\">\n {props.title}\n </h2>\n <span className=\"grow\" />\n {props.onFire ? (\n <Button\n variant=\"primary\"\n disabled={firing}\n onClick={() => {\n setFiring(true);\n setFireError(null);\n props.onFire!()\n .then((fireResultError) => setFireError(fireResultError))\n .catch((fireCallError: unknown) =>\n setFireError(\n fireCallError instanceof Error\n ? fireCallError.message\n : String(fireCallError),\n ),\n )\n .finally(() => {\n setFiring(false);\n props.reload();\n });\n }}\n >\n <Icon name=\"play\" className=\"h-3.5 w-3.5\" />\n {firing ? \"Running…\" : \"Run now\"}\n </Button>\n ) : null}\n </div>\n {fireError ? (\n <p className=\"mb-3 rounded-md bg-wf-fail/10 px-3 py-2 text-[13px] text-wf-fail\">\n {fireError}\n </p>\n ) : null}\n {props.error ? (\n <p className=\"rounded-md bg-wf-warn/10 px-3 py-2 text-[13px] text-wf-warn\">\n Runs can't be listed because the workflow runtime is unreachable.\n <span className=\"mt-0.5 block text-xs opacity-80\">{props.error}</span>\n </p>\n ) : runs === null ? (\n <p className=\"text-[13px] text-muted-foreground\">Loading runs…</p>\n ) : runs.length === 0 ? (\n <div className=\"rounded-lg border border-dashed border-border px-4 py-10 text-center\">\n <p className=\"text-[13px] font-medium text-foreground\">No runs yet</p>\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {props.onFire\n ? \"Use Run now to record the first one.\"\n : \"Runs appear here once the trigger fires.\"}\n </p>\n </div>\n ) : (\n <RunsTable\n runs={runs}\n showWorkflow={props.showWorkflow}\n onChanged={props.reload}\n />\n )}\n </div>\n );\n}\n","// Studio navigation: the drive-wide journal, then the drive's workflows and\n// connections. Each row carries its document's status as a dot.\nimport {\n showDeleteNodeModal,\n useDocumentSafe,\n} from \"@powerhousedao/reactor-browser\";\nimport type { FileNode } from \"@powerhousedao/shared/document-drive\";\nimport { useEffect, type ReactNode } from \"react\";\nimport { errorMessage } from \"../../shared/DocumentErrorBoundary.js\";\nimport { CONNECTION_TONE, toneOf, workflowHealth } from \"./run-format.js\";\nimport { Icon, StatusDot } from \"./ui.js\";\n\nconst WORKFLOW_TYPE = \"powerhouse/workflow\";\n\n// The drive node name goes stale after renames; the document state is the\n// source of truth for both workflow and connection names.\nfunction documentName(document: unknown, fallback: string): string {\n const state = (document as { state?: { global?: { name?: string } } } | null)\n ?.state?.global;\n return state?.name || fallback || \"(unnamed)\";\n}\n\nfunction documentStatus(document: unknown): string | undefined {\n const state = (\n document as { state?: { global?: { status?: string } } } | null\n )?.state?.global;\n return state?.status;\n}\n\nfunction Row(props: {\n active: boolean;\n onClick: () => void;\n children: ReactNode;\n trailing?: ReactNode;\n}) {\n return (\n <div\n className={`group mx-2 flex items-center rounded-md ${\n props.active ? \"bg-accent\" : \"hover:bg-accent/60\"\n }`}\n >\n <button\n type=\"button\"\n aria-current={props.active ? \"true\" : undefined}\n className={`flex min-w-0 grow items-center gap-2.5 rounded-md px-2 py-1.5 text-left text-[13px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${\n props.active ? \"font-medium text-foreground\" : \"text-foreground/80\"\n }`}\n onClick={props.onClick}\n >\n {props.children}\n </button>\n {props.trailing}\n </div>\n );\n}\n\nconst ROW_ACTION =\n \"flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground opacity-0 hover:bg-background hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100\";\n\nconst DELETE_ACTION = `${ROW_ACTION} hover:text-wf-fail`;\n\nfunction DeleteButton(props: { node: FileNode; label: string }) {\n return (\n <button\n type=\"button\"\n title=\"Delete\"\n aria-label={`Delete ${props.label}`}\n className={DELETE_ACTION}\n onClick={() => showDeleteNodeModal(props.node)}\n >\n <Icon name=\"trash\" className=\"h-3.5 w-3.5\" />\n </button>\n );\n}\n\n// A node can outlive its document (deleted, or unreadable history), so one\n// broken node degrades to its drive name plus a warning marker.\nfunction NodeRow(props: {\n node: FileNode;\n lastRunStatus?: string;\n active: boolean;\n onOpen: () => void;\n onEdit?: () => void;\n}) {\n const { node } = props;\n const { data: document, error } = useDocumentSafe(node.id);\n useEffect(() => {\n if (error !== undefined) {\n console.error(`Failed to load document ${node.id}:`, error);\n }\n }, [error, node.id]);\n\n if (error !== undefined) {\n return (\n <Row\n active={props.active}\n onClick={props.onOpen}\n trailing={\n <span className=\"mr-1.5 flex shrink-0 items-center\">\n <DeleteButton node={node} label={node.name || node.id} />\n </span>\n }\n >\n <span\n className=\"shrink-0 text-xs text-wf-fail\"\n title={`Could not load ${node.id}: ${errorMessage(error)}`}\n aria-hidden\n >\n ⚠\n </span>\n <span className=\"min-w-0 truncate text-wf-fail\">\n {node.name || \"(unnamed)\"}\n </span>\n </Row>\n );\n }\n\n const status = documentStatus(document);\n const { tone, label } =\n node.documentType === WORKFLOW_TYPE\n ? workflowHealth(status, props.lastRunStatus)\n : { tone: toneOf(CONNECTION_TONE, status), label: status };\n return (\n <Row\n active={props.active}\n onClick={props.onOpen}\n trailing={\n <span className=\"mr-1.5 flex shrink-0 items-center\">\n {props.onEdit ? (\n <button\n type=\"button\"\n title=\"Open in editor\"\n aria-label={`Open ${documentName(document, node.name)} in the editor`}\n className={ROW_ACTION}\n onClick={props.onEdit}\n >\n <Icon name=\"pencil\" className=\"h-3.5 w-3.5\" />\n </button>\n ) : null}\n <DeleteButton node={node} label={documentName(document, node.name)} />\n </span>\n }\n >\n <span title={label} className=\"flex\">\n <StatusDot tone={tone} />\n </span>\n <span className=\"min-w-0 truncate\">\n {documentName(document, node.name)}\n </span>\n </Row>\n );\n}\n\nfunction Section(props: {\n title: string;\n addLabel: string;\n empty: string;\n nodes: FileNode[];\n lastRuns?: Map<string, string>;\n activeId?: string | null;\n onOpen: (node: FileNode) => void;\n onEdit?: (node: FileNode) => void;\n onCreate: () => void;\n creating: boolean;\n}) {\n return (\n <div className=\"mt-5\">\n <div className=\"mb-1 flex items-center justify-between pl-4 pr-3\">\n <h3 className=\"text-xs font-medium text-muted-foreground\">\n {props.title}\n </h3>\n <button\n type=\"button\"\n disabled={props.creating}\n className=\"flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50\"\n title={props.addLabel}\n aria-label={props.addLabel}\n onClick={props.onCreate}\n >\n <Icon name=\"plus\" className=\"h-3.5 w-3.5\" />\n </button>\n </div>\n {props.nodes.length === 0 ? (\n <p className=\"px-4 py-1 text-xs text-muted-foreground\">{props.empty}</p>\n ) : (\n <div className=\"flex flex-col gap-0.5\">\n {props.nodes.map((node) => (\n <NodeRow\n key={node.id}\n node={node}\n lastRunStatus={props.lastRuns?.get(node.id)}\n active={props.activeId === node.id}\n onOpen={() => props.onOpen(node)}\n onEdit={props.onEdit ? () => props.onEdit!(node) : undefined}\n />\n ))}\n </div>\n )}\n </div>\n );\n}\n\nexport function Sidebar(props: {\n workflows: FileNode[];\n connections: FileNode[];\n // Each workflow's latest run status, by workflow id.\n lastRuns: Map<string, string>;\n activeId?: string | null;\n allRunsActive: boolean;\n creating: boolean;\n onShowAllRuns: () => void;\n onOpenWorkflow: (node: FileNode) => void;\n onEditWorkflow: (node: FileNode) => void;\n onOpenConnection: (node: FileNode) => void;\n onCreateWorkflow: () => void;\n onCreateConnection: () => void;\n}) {\n return (\n <aside className=\"w-60 shrink-0 overflow-y-auto border-r border-solid border-border bg-muted/50 py-3\">\n <Row active={props.allRunsActive} onClick={props.onShowAllRuns}>\n <Icon name=\"list\" className=\"text-muted-foreground\" />\n <span>Overview</span>\n </Row>\n <Section\n title=\"Workflows\"\n addLabel=\"New workflow\"\n empty=\"No workflows yet.\"\n nodes={props.workflows}\n lastRuns={props.lastRuns}\n activeId={props.activeId}\n onOpen={props.onOpenWorkflow}\n onEdit={props.onEditWorkflow}\n onCreate={props.onCreateWorkflow}\n creating={props.creating}\n />\n <Section\n title=\"Connections\"\n addLabel=\"New connection\"\n empty=\"No connections yet.\"\n nodes={props.connections}\n activeId={props.activeId}\n onOpen={props.onOpenConnection}\n onCreate={props.onCreateConnection}\n creating={props.creating}\n />\n </aside>\n );\n}\n","// Connect owns the path (`/d/<drive>/<node>`) for an open editor; the studio's\n// sidebar selection lives in the hash, so it survives a refresh.\nimport { useCallback, useEffect, useState } from \"react\";\n\nfunction readHash(): string | undefined {\n return window.location.hash.replace(/^#/, \"\") || undefined;\n}\n\nexport function useHashSelection(): [\n string | undefined,\n (id?: string) => void,\n] {\n const [selected, setSelected] = useState<string | undefined>(readHash);\n\n useEffect(() => {\n // Covers back/forward and a hand-edited URL.\n const sync = () => setSelected(readHash());\n window.addEventListener(\"hashchange\", sync);\n window.addEventListener(\"popstate\", sync);\n return () => {\n window.removeEventListener(\"hashchange\", sync);\n window.removeEventListener(\"popstate\", sync);\n };\n }, []);\n\n const select = useCallback((id?: string) => {\n setSelected(id);\n // Replaced, not pushed: Connect pushes a path entry on the same click, and\n // two history entries per click breaks the back button.\n const url = new URL(window.location.href);\n url.hash = id ?? \"\";\n window.history.replaceState(null, \"\", url);\n }, []);\n\n return [selected, select];\n}\n","// One polling subscription to the run journal per studio pane. The header,\n// the table and the editor toolbar all read from it, so they stay in step.\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport {\n fetchRuns,\n type RunRecord,\n type RunsScope,\n} from \"../../workflow-editor/runtime-api.js\";\n\nconst POLL_MS = 5000;\n\nexport interface RunsFeed {\n runs: RunRecord[] | null;\n error: string | null;\n reload: () => void;\n}\n\n// Inactive feeds hold no subscription, so a pane can borrow another's rows.\nexport function useRuns(scope: RunsScope, active = true): RunsFeed {\n const { workflowId, driveId, limit } = scope;\n const [runs, setRuns] = useState<RunRecord[] | null>(null);\n const [error, setError] = useState<string | null>(null);\n // Lets reload() run against the current scope without re-subscribing.\n const load = useRef<() => void>(() => undefined);\n\n useEffect(() => {\n if (!active) return;\n let cancelled = false;\n const run = () => {\n fetchRuns({ workflowId, driveId, limit }).then(\n (result) => {\n if (cancelled) return;\n setRuns(result);\n setError(null);\n },\n (loadError: unknown) => {\n if (cancelled) return;\n setError(\n loadError instanceof Error ? loadError.message : String(loadError),\n );\n },\n );\n };\n load.current = run;\n // A scope change makes the previous rows the wrong rows.\n setRuns(null);\n run();\n const timer = setInterval(run, POLL_MS);\n return () => {\n cancelled = true;\n clearInterval(timer);\n };\n }, [workflowId, driveId, limit, active]);\n\n const reload = useCallback(() => load.current(), []);\n return { runs, error, reload };\n}\n","// Flattens a workflow's graph into the order a run walks it, so the studio\n// can show the shape of a workflow without drawing the canvas.\nimport { portRank } from \"../../workflow-editor/ui/ap-layout.js\";\n\nexport interface OutlineStep {\n id: string;\n key: string;\n name: string;\n blockType: string;\n}\n\nexport interface OutlineEdge {\n from: string;\n to: string;\n port: string;\n}\n\nexport interface OutlineRow {\n step: OutlineStep;\n // The port that led here; null on the entry step and on \"next\".\n port: string | null;\n}\n\nexport interface StepOutline {\n rows: OutlineRow[];\n // Authored but unreachable from the trigger, so no run ever executes them.\n orphans: OutlineStep[];\n}\n\nexport function stepOutline(args: {\n triggerId?: string | null;\n steps: readonly OutlineStep[];\n edges: readonly OutlineEdge[];\n}): StepOutline {\n const stepById = new Map(args.steps.map((step) => [step.id, step]));\n const outgoing = new Map<string, OutlineEdge[]>();\n for (const edge of args.edges) {\n if (!stepById.has(edge.to)) continue;\n const list = outgoing.get(edge.from) ?? [];\n list.push(edge);\n outgoing.set(edge.from, list);\n }\n for (const list of outgoing.values()) {\n list.sort((a, b) => portRank(a.port) - portRank(b.port));\n }\n\n const rows: OutlineRow[] = [];\n const seen = new Set<string>();\n // Depth-first so a branch reads as a continuous path, as it runs.\n const walk = (fromId: string, port: string | null) => {\n const step = stepById.get(fromId);\n if (step) {\n if (seen.has(fromId)) return;\n seen.add(fromId);\n rows.push({ step, port: port === \"next\" ? null : port });\n }\n for (const edge of outgoing.get(fromId) ?? []) {\n walk(edge.to, edge.port);\n }\n };\n if (args.triggerId) walk(args.triggerId, null);\n\n return {\n rows,\n orphans: args.steps.filter((step) => !seen.has(step.id)),\n };\n}\n","// The drive's workflows at a glance: when each starts, its chain coloured by\n// the latest run, and its recent runs. The studio's landing view.\nimport { useWorkflowDocumentsInSelectedDrive } from \"document-models/workflow\";\nimport type { RunRecord } from \"../../workflow-editor/runtime-api.js\";\nimport { usePieceLogos } from \"../../workflow-editor/ui/block-meta.js\";\nimport { describeTrigger } from \"../../workflow-editor/ui/trigger-text.js\";\nimport { MiniChain, RunStrip, type ChainLink } from \"./chain.js\";\nimport {\n formatAbsolute,\n formatWhen,\n RUN_TONE,\n statusLabel,\n toneOf,\n workflowHealth,\n} from \"./run-format.js\";\nimport { stepOutline } from \"./step-outline.js\";\nimport { Button, Icon, StatusDot } from \"./ui.js\";\n\ninterface BoardRow {\n id: string;\n name: string;\n status: string;\n trigger: string;\n links: ChainLink[];\n runs: RunRecord[];\n}\n\nfunction summary(rows: BoardRow[]): string {\n const count = `${rows.length} ${rows.length === 1 ? \"workflow\" : \"workflows\"}`;\n const failing = rows.filter((row) => row.runs[0]?.status === \"FAILED\").length;\n const enabled = rows.filter((row) => row.status === \"ENABLED\").length;\n const parts = [count, `${enabled} enabled`];\n if (failing > 0) parts.push(`${failing} failed on the last run`);\n return parts.join(\", \");\n}\n\nexport function WorkflowBoard(props: {\n runs: RunRecord[] | null;\n creating: boolean;\n onOpen: (workflowId: string) => void;\n onCreate: () => void;\n}) {\n usePieceLogos();\n const documents = useWorkflowDocumentsInSelectedDrive() ?? [];\n const runs = props.runs ?? [];\n\n const rows: BoardRow[] = documents\n .map((document) => {\n const state = document.state.global;\n const workflowRuns = runs.filter(\n (run) => run.workflowId === document.header.id,\n );\n const latest = workflowRuns.at(0);\n const statusByKey = new Map(\n (latest?.steps ?? []).map((step) => [step.stepKey, step.status]),\n );\n const outline = stepOutline({\n triggerId: state.trigger?.id,\n steps: state.steps,\n edges: state.edges,\n });\n const links: ChainLink[] = [\n ...(state.trigger\n ? [\n {\n id: state.trigger.id,\n blockType: state.trigger.blockType,\n label: \"Trigger\",\n status: latest ? \"SUCCEEDED\" : undefined,\n },\n ]\n : []),\n ...outline.rows.map((row) => ({\n id: row.step.id,\n blockType: row.step.blockType,\n label: row.step.name || row.step.key,\n status: statusByKey.get(row.step.key),\n })),\n ];\n return {\n id: document.header.id,\n name: state.name || document.header.name || \"Untitled workflow\",\n status: state.status,\n trigger: describeTrigger(state.trigger),\n links,\n runs: workflowRuns,\n };\n })\n // Most recently run first, then by name, so the board doesn't reshuffle.\n .sort((a, b) => {\n const at = a.runs[0]?.startedAt ?? \"\";\n const bt = b.runs[0]?.startedAt ?? \"\";\n if (at !== bt) return bt.localeCompare(at);\n return a.name.localeCompare(b.name);\n });\n\n return (\n <section className=\"mb-10\">\n <div className=\"mb-4 flex flex-wrap items-end justify-between gap-3\">\n <div>\n <h2 className=\"text-2xl font-semibold tracking-tight text-foreground\">\n Workflows\n </h2>\n <p className=\"mt-1 text-[13px] text-muted-foreground\">\n {rows.length === 0 ? \"Automations in this drive\" : summary(rows)}\n </p>\n </div>\n <Button\n variant=\"primary\"\n disabled={props.creating}\n onClick={props.onCreate}\n >\n <Icon name=\"plus\" className=\"h-3.5 w-3.5\" />\n New workflow\n </Button>\n </div>\n {rows.length === 0 ? (\n <div className=\"rounded-xl border border-dashed border-foreground/15 px-6 py-12 text-center\">\n <p className=\"text-[15px] font-medium text-foreground\">\n No workflows yet\n </p>\n <p className=\"mx-auto mt-1 max-w-sm text-[13px] text-muted-foreground\">\n A workflow starts on a trigger, like a schedule or a webhook, and\n runs a chain of steps across your services.\n </p>\n </div>\n ) : (\n <ul\n aria-label=\"Workflows\"\n className=\"overflow-hidden rounded-xl border border-solid border-foreground/10 bg-card\"\n >\n {rows.map((row) => {\n const latest = row.runs.at(0);\n const latestTone = toneOf(RUN_TONE, latest?.status);\n const health = workflowHealth(row.status, latest?.status);\n return (\n <li\n key={row.id}\n className=\"border-b border-solid border-foreground/10 last:border-b-0\"\n >\n <button\n type=\"button\"\n className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-x-6 gap-y-3 px-5 py-4 text-left transition-colors hover:bg-accent/50 focus-visible:bg-accent/50 focus-visible:outline-none md:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)_minmax(0,0.8fr)_auto]\"\n onClick={() => props.onOpen(row.id)}\n >\n <span className=\"min-w-0\">\n <span className=\"flex items-center gap-2\">\n <span title={health.label} className=\"flex\">\n <StatusDot tone={health.tone} />\n </span>\n <span className=\"truncate text-[15px] font-semibold text-foreground\">\n {row.name}\n </span>\n {row.status !== \"ENABLED\" ? (\n <span className=\"shrink-0 rounded-full bg-muted px-2 py-0.5 text-[11px] text-muted-foreground\">\n {statusLabel(row.status)}\n </span>\n ) : null}\n </span>\n <span className=\"mt-0.5 block truncate pl-4 text-[13px] text-muted-foreground\">\n {row.trigger}\n </span>\n </span>\n <span className=\"hidden md:block\">\n <MiniChain links={row.links} />\n </span>\n <span\n className=\"hidden text-[13px] md:block\"\n title={\n latest ? formatAbsolute(latest.startedAt) : undefined\n }\n >\n {latest ? (\n <>\n <span\n className={`font-medium ${latestTone === \"fail\" ? \"text-wf-fail\" : latestTone === \"ok\" ? \"text-wf-ok\" : \"text-foreground\"}`}\n >\n {statusLabel(latest.status)}\n </span>\n <span className=\"block text-xs text-muted-foreground\">\n {formatWhen(latest.startedAt)}\n </span>\n </>\n ) : (\n <span className=\"text-muted-foreground\">Not run yet</span>\n )}\n </span>\n <RunStrip runs={row.runs} />\n </button>\n </li>\n );\n })}\n </ul>\n )}\n </section>\n );\n}\n","// The workflow's shape as a pipeline: trigger, then each step in the order a\n// run walks it, annotated with how that step fared in the latest run.\nimport type { WorkflowState } from \"document-models/workflow\";\nimport type { RunRecord } from \"../../workflow-editor/runtime-api.js\";\nimport {\n blockMeta,\n usePieceLogos,\n} from \"../../workflow-editor/ui/block-meta.js\";\nimport { BlockLogo } from \"../../workflow-editor/ui/BlockSelector.js\";\nimport { STEP_TONE, toneOf, type Tone } from \"./run-format.js\";\nimport { stepOutline, type OutlineStep } from \"./step-outline.js\";\n\nconst RAIL: Record<Tone, string> = {\n ok: \"bg-wf-ok\",\n fail: \"bg-wf-fail\",\n warn: \"bg-wf-warn\",\n run: \"bg-wf-run\",\n idle: \"bg-border\",\n};\n\nconst RING: Record<Tone, string> = {\n ok: \"ring-wf-ok\",\n fail: \"ring-wf-fail\",\n warn: \"ring-wf-warn\",\n run: \"ring-wf-run\",\n idle: \"ring-border\",\n};\n\ninterface Stop {\n id: string;\n title: string;\n subtitle: string;\n blockType: string;\n // How the latest run fared here; undefined when it never reached this stop.\n status?: string;\n // The port the run takes to arrive here, shown on the rail.\n port?: string | null;\n}\n\n// One stop on the rail. The rail segment into a stop is coloured by whether\n// the latest run reached it, so the track shows how far a run got.\nfunction TrackStop(props: {\n stop: Stop;\n first: boolean;\n last: boolean;\n inbound: Tone;\n outbound: Tone;\n onClick: () => void;\n}) {\n const { stop } = props;\n const tone = stop.status ? toneOf(STEP_TONE, stop.status) : \"idle\";\n return (\n <li className=\"relative flex w-40 shrink-0 flex-col items-center\">\n <span\n aria-hidden\n className={`absolute left-0 top-[19px] h-0.5 w-1/2 ${props.first ? \"invisible\" : RAIL[props.inbound]}`}\n />\n <span\n aria-hidden\n className={`absolute right-0 top-[19px] h-0.5 w-1/2 ${props.last ? \"invisible\" : RAIL[props.outbound]}`}\n />\n {stop.port ? (\n <span className=\"absolute -left-4 top-0 rounded bg-background px-1 text-[11px] text-muted-foreground\">\n {stop.port}\n </span>\n ) : null}\n <button\n type=\"button\"\n title={\n stop.status\n ? `${stop.title}: ${stop.status.toLowerCase()}`\n : stop.title\n }\n aria-label={`${stop.title}: ${stop.status ? stop.status.toLowerCase() : \"not run\"}`}\n className={`relative z-10 flex h-10 w-10 items-center justify-center rounded-full bg-card ring-2 transition-shadow dark:bg-white hover:ring-4 focus-visible:outline-none focus-visible:ring-4 ${RING[tone]}`}\n onClick={props.onClick}\n >\n <BlockLogo bare blockType={stop.blockType} size={20} />\n </button>\n <span className=\"mt-2 max-w-full truncate px-2 text-[13px] font-medium text-foreground\">\n {stop.title}\n </span>\n <span\n className=\"max-w-full truncate px-2 text-xs text-muted-foreground\"\n title={stop.subtitle}\n >\n {stop.subtitle}\n </span>\n </li>\n );\n}\n\nfunction Track(props: { stops: Stop[]; onOpenEditor: () => void }) {\n const tones = props.stops.map((stop) =>\n stop.status ? toneOf(STEP_TONE, stop.status) : \"idle\",\n );\n return (\n // Scrolling clips both axes, so the padding leaves room for the rings.\n <ol className=\"-mx-6 flex overflow-x-auto px-6 py-1.5\">\n {props.stops.map((stop, index) => (\n <TrackStop\n key={stop.id}\n stop={stop}\n first={index === 0}\n last={index === props.stops.length - 1}\n inbound={tones[index]}\n outbound={tones[index + 1] ?? \"idle\"}\n onClick={props.onOpenEditor}\n />\n ))}\n </ol>\n );\n}\n\nexport function WorkflowSteps(props: {\n state: WorkflowState;\n latestRun?: RunRecord;\n onOpenEditor: () => void;\n}) {\n const { state } = props;\n // Piece logos arrive with the catalog; re-renders this pipeline once known.\n usePieceLogos();\n const outline = stepOutline({\n triggerId: state.trigger?.id,\n steps: state.steps,\n edges: state.edges,\n });\n // Latest-run outcome per step, so the pipeline shows where a run stopped.\n const statusByKey = new Map(\n (props.latestRun?.steps ?? []).map((step) => [step.stepKey, step.status]),\n );\n\n const stopFor = (step: OutlineStep, port: string | null): Stop => {\n const meta = blockMeta(step.blockType);\n return {\n id: step.id,\n title: step.name || step.key,\n subtitle: meta.displayName,\n blockType: step.blockType,\n status: statusByKey.get(step.key),\n port,\n };\n };\n\n if (!state.trigger && state.steps.length === 0) {\n return (\n <section className=\"mt-8 border-t border-solid border-border pt-6\">\n <p className=\"text-[13px] text-muted-foreground\">\n This workflow has no trigger or steps yet.{\" \"}\n <button\n type=\"button\"\n className=\"font-medium text-foreground underline underline-offset-2\"\n onClick={props.onOpenEditor}\n >\n Open the editor\n </button>{\" \"}\n to build it.\n </p>\n </section>\n );\n }\n\n const triggerMeta = state.trigger ? blockMeta(state.trigger.blockType) : null;\n const stops: Stop[] = [\n ...(state.trigger && triggerMeta\n ? [\n {\n id: state.trigger.id,\n title: triggerMeta.displayName,\n subtitle: \"Trigger\",\n blockType: state.trigger.blockType,\n // Any recorded run means the trigger fired.\n status: props.latestRun ? \"SUCCEEDED\" : undefined,\n },\n ]\n : []),\n ...outline.rows.map((row) => stopFor(row.step, row.port)),\n ];\n\n return (\n <section className=\"mt-8 border-t border-solid border-border pt-6\">\n <div className=\"mb-4 flex items-baseline gap-2\">\n <h3 className=\"text-[13px] font-medium text-foreground\">Steps</h3>\n <span className=\"text-xs text-muted-foreground\">\n {props.latestRun ? \"Coloured by the latest run\" : \"Not run yet\"}\n </span>\n </div>\n {!state.trigger ? (\n <p className=\"mb-3 text-xs text-wf-warn\">\n No trigger set, so this workflow never starts on its own.\n </p>\n ) : null}\n <Track stops={stops} onOpenEditor={props.onOpenEditor} />\n {outline.orphans.length > 0 ? (\n <div className=\"mt-5\">\n <p className=\"mb-3 text-xs text-muted-foreground\">\n Not connected to the trigger, so runs never reach these:\n </p>\n <ol className=\"-mx-6 flex overflow-x-auto px-6 py-1.5 opacity-60\">\n {outline.orphans.map((step) => (\n <TrackStop\n key={step.id}\n stop={stopFor(step, null)}\n first\n last\n inbound=\"idle\"\n outbound=\"idle\"\n onClick={props.onOpenEditor}\n />\n ))}\n </ol>\n </div>\n ) : null}\n </section>\n );\n}\n","// Identity, state and the actions for the workflow whose runs are shown:\n// enable/disable, open the editor, delete. Stats come from the shared feed.\nimport {\n showDeleteNodeModal,\n useDispatch,\n useDocumentSafe,\n} from \"@powerhousedao/reactor-browser\";\nimport type { FileNode } from \"@powerhousedao/shared/document-drive\";\nimport {\n actions as workflowActions,\n type WorkflowDocument,\n} from \"document-models/workflow\";\nimport type { RunRecord } from \"../../workflow-editor/runtime-api.js\";\nimport { DocumentLoadError } from \"../../shared/DocumentErrorBoundary.js\";\nimport {\n formatAbsolute,\n formatWhen,\n RUN_TONE,\n runStats,\n toneOf,\n TONE_BADGE,\n TONE_TEXT,\n statusLabel,\n WORKFLOW_TONE,\n} from \"./run-format.js\";\nimport { Button, Fact, StatusDot } from \"./ui.js\";\nimport { describeTrigger } from \"../../workflow-editor/ui/trigger-text.js\";\nimport { RunStrip } from \"./chain.js\";\nimport { WorkflowSteps } from \"./WorkflowSteps.js\";\n\nconst WORKFLOW_TYPE = \"powerhouse/workflow\";\n\nexport function WorkflowHeader(props: {\n node: FileNode;\n runs: RunRecord[] | null;\n onEdit: () => void;\n}) {\n const workflowId = props.node.id;\n const { data: document, error, reload } = useDocumentSafe(workflowId);\n const [, dispatch] = useDispatch(document);\n\n if (error !== undefined) {\n return (\n <DocumentLoadError\n title=\"This workflow could not be loaded\"\n documentId={workflowId}\n error={error}\n onRetry={() => {\n void reload();\n }}\n />\n );\n }\n if (document?.header.documentType !== WORKFLOW_TYPE) return null;\n\n const workflow = document as WorkflowDocument;\n const state = workflow.state.global;\n const enabled = state.status === \"ENABLED\";\n const stats = runStats(props.runs ?? []);\n\n const lastTone = toneOf(RUN_TONE, stats.lastRun?.status);\n const statusTone = toneOf(WORKFLOW_TONE, state.status);\n\n return (\n <header className=\"mb-8\">\n <div className=\"flex flex-wrap items-start gap-3\">\n <div className=\"min-w-0 grow\">\n <div className=\"flex items-center gap-2.5\">\n <h2 className=\"min-w-0 truncate text-xl font-semibold tracking-tight text-foreground\">\n {state.name || props.node.name || \"Untitled workflow\"}\n </h2>\n <span\n className={`rounded-full px-2 py-0.5 text-xs font-medium ${TONE_BADGE[statusTone]}`}\n >\n {statusLabel(state.status)}\n </span>\n </div>\n {state.description ? (\n <p className=\"mt-1 max-w-prose text-[13px] text-muted-foreground\">\n {state.description}\n </p>\n ) : null}\n </div>\n <div className=\"flex items-center gap-2\">\n <Button\n variant=\"danger\"\n onClick={() => showDeleteNodeModal(props.node)}\n >\n Delete\n </Button>\n <Button\n onClick={() =>\n dispatch(\n workflowActions.setWorkflowStatus({\n status: enabled ? \"DISABLED\" : \"ENABLED\",\n }),\n )\n }\n >\n {enabled ? \"Disable\" : \"Enable\"}\n </Button>\n <Button variant=\"primary\" onClick={props.onEdit}>\n Edit workflow\n </Button>\n </div>\n </div>\n <dl className=\"mt-5 flex flex-wrap gap-x-10 gap-y-3\">\n <Fact label=\"Starts\">\n {state.trigger ? (\n describeTrigger(state.trigger)\n ) : (\n <span className=\"text-wf-warn\">Never: no trigger</span>\n )}\n </Fact>\n <Fact\n label=\"Last run\"\n title={\n stats.lastRun ? formatAbsolute(stats.lastRun.startedAt) : undefined\n }\n >\n {stats.lastRun ? (\n <span\n className={`inline-flex items-center gap-1.5 ${TONE_TEXT[lastTone]}`}\n >\n <StatusDot tone={lastTone} />\n {formatWhen(stats.lastRun.startedAt)}\n </span>\n ) : (\n <span className=\"text-muted-foreground\">Never</span>\n )}\n </Fact>\n <Fact label=\"Recent runs\">\n {stats.total > 0 ? (\n <RunStrip runs={props.runs ?? []} />\n ) : (\n <span className=\"text-muted-foreground\">None yet</span>\n )}\n </Fact>\n <Fact label=\"Success rate\">\n {stats.successRate === null ? (\n <span className=\"text-muted-foreground\">No finished runs</span>\n ) : (\n `${stats.successRate}%`\n )}\n </Fact>\n <Fact label=\"Version\">v{state.version}</Fact>\n </dl>\n <WorkflowSteps\n state={state}\n latestRun={stats.lastRun}\n onOpenEditor={props.onEdit}\n />\n </header>\n );\n}\n","// Workflow Studio: drive app listing workflows and connections with a\n// GitHub-Actions-style run journal; opens the per-document editors inline.\nimport {\n addDocument,\n setSelectedNode,\n useDocumentSafe,\n useFileNodesInSelectedDrive,\n usePHToast,\n useSelectedDrive,\n useSelectedNode,\n} from \"@powerhousedao/reactor-browser\";\nimport type { FileNode } from \"@powerhousedao/shared/document-drive\";\nimport { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { type WorkflowDocument } from \"document-models/workflow\";\nimport { fireWorkflow } from \"../../workflow-editor/runtime-api.js\";\nimport \"../../workflow-editor/runtime-piece-source.js\";\nimport { DocumentErrorBoundary } from \"../../shared/DocumentErrorBoundary.js\";\nimport { RunsView } from \"./RunsView.js\";\nimport { Sidebar } from \"./Sidebar.js\";\nimport { useHashSelection } from \"./use-hash-selection.js\";\nimport { useRuns } from \"./useRuns.js\";\nimport { WorkflowBoard } from \"./WorkflowBoard.js\";\nimport { WorkflowHeader } from \"./WorkflowHeader.js\";\n\nconst WORKFLOW_TYPE = \"powerhouse/workflow\";\nconst CONNECTION_TYPE = \"powerhouse/connection\";\n\nexport function WorkflowStudio(props: { children?: ReactNode }) {\n const [drive] = useSelectedDrive();\n const fileNodes = useFileNodesInSelectedDrive() ?? [];\n const selectedNode = useSelectedNode();\n const selectedNodeId = selectedNode?.id;\n const toast = usePHToast();\n // The sidebar selection, kept in the URL hash; undefined = all runs.\n const [selectedId, select] = useHashSelection();\n const [creating, setCreating] = useState(false);\n\n const driveId = drive.header.id;\n const workflows = fileNodes.filter(\n (node) => node.documentType === WORKFLOW_TYPE,\n );\n const connections = fileNodes.filter(\n (node) => node.documentType === CONNECTION_TYPE,\n );\n const editorOpen = Boolean(props.children && selectedNodeId);\n\n const create = (documentType: string, baseName: string, count: number) => {\n if (creating) return;\n setCreating(true);\n addDocument(driveId, `${baseName} ${count + 1}`, documentType)\n .then((node) => {\n select(node.id);\n setSelectedNode(node.id);\n })\n .catch((error: unknown) => {\n toast?.(\n error instanceof Error\n ? error.message\n : `Failed to create ${baseName}`,\n { type: \"error\" },\n );\n })\n .finally(() => setCreating(false));\n };\n\n const showRuns = (node: FileNode | null) => {\n setSelectedNode(undefined);\n select(node?.id);\n };\n\n // Resolved from the drive each render, so a deleted node drops out on its own.\n const liveTarget = workflows.find((node) => node.id === selectedId) ?? null;\n // Connections have no page of their own; closing the editor lands on the\n // overview rather than on a selection nothing shows.\n const connectionSelected = connections.some((node) => node.id === selectedId);\n const wasEditing = useRef(editorOpen);\n useEffect(() => {\n if (wasEditing.current && !editorOpen && connectionSelected)\n select(undefined);\n wasEditing.current = editorOpen;\n }, [editorOpen, connectionSelected, select]);\n // A deleted node must not keep the hash pointing at nothing.\n const selectionExists = fileNodes.some((node) => node.id === selectedId);\n useEffect(() => {\n if (selectedId && fileNodes.length > 0 && !selectionExists)\n select(undefined);\n }, [fileNodes.length, select, selectedId, selectionExists]);\n // One feed per pane, shared by the header and the table: the focused\n // workflow's runs, or every run in this drive.\n const focusedWorkflow = liveTarget;\n // The drive feed colours the sidebar and is the overview's own feed; a\n // focused workflow gets its own, so older runs of it aren't cut off.\n const driveFeed = useRuns({ driveId });\n const workflowFeed = useRuns(\n { workflowId: focusedWorkflow?.id },\n Boolean(focusedWorkflow),\n );\n const {\n runs,\n error: runsError,\n reload: reloadRuns,\n } = focusedWorkflow ? workflowFeed : driveFeed;\n const lastRuns = new Map<string, string>();\n for (const run of driveFeed.runs ?? []) {\n if (!lastRuns.has(run.workflowId)) lastRuns.set(run.workflowId, run.status);\n }\n\n // Manual fire only makes sense for core#manual triggers.\n const { data: targetDocument } = useDocumentSafe(liveTarget?.id ?? null);\n const manualTrigger =\n targetDocument?.header.documentType === WORKFLOW_TYPE &&\n (targetDocument as WorkflowDocument).state.global.trigger?.blockType ===\n \"core#manual\";\n\n return (\n <div className=\"flex h-full min-h-0\">\n <Sidebar\n workflows={workflows}\n connections={connections}\n lastRuns={lastRuns}\n activeId={selectedId}\n allRunsActive={!selectedId}\n creating={creating}\n onShowAllRuns={() => showRuns(null)}\n onOpenWorkflow={(node) => showRuns(node)}\n onEditWorkflow={(node) => {\n select(node.id);\n setSelectedNode(node.id);\n }}\n onOpenConnection={(node) => {\n select(node.id);\n setSelectedNode(node.id);\n }}\n onCreateWorkflow={() =>\n create(WORKFLOW_TYPE, \"Workflow\", workflows.length)\n }\n onCreateConnection={() =>\n create(CONNECTION_TYPE, \"Connection\", connections.length)\n }\n />\n <main className=\"min-w-0 flex-1 overflow-y-auto\">\n {editorOpen ? (\n <div className=\"flex h-full min-h-0 flex-col\">\n <div className=\"flex min-h-0 flex-1 flex-col [&>#document-editor-container]:min-h-0\">\n <DocumentErrorBoundary\n key={selectedNodeId}\n documentId={selectedNodeId}\n label={selectedNode?.name}\n onDismiss={() => setSelectedNode(undefined)}\n >\n {props.children}\n </DocumentErrorBoundary>\n </div>\n </div>\n ) : (\n <div className=\"mx-auto w-full max-w-6xl px-8 py-10\">\n {liveTarget ? (\n <WorkflowHeader\n key={liveTarget.id}\n node={liveTarget}\n runs={runs}\n onEdit={() => setSelectedNode(liveTarget.id)}\n />\n ) : (\n <WorkflowBoard\n runs={runs}\n creating={creating}\n onOpen={(workflowId) => select(workflowId)}\n onCreate={() =>\n create(WORKFLOW_TYPE, \"Workflow\", workflows.length)\n }\n />\n )}\n <RunsView\n // The header already names the workflow; don't say it twice.\n title={liveTarget ? \"Runs\" : \"Recent runs\"}\n runs={runs}\n error={runsError}\n reload={reloadRuns}\n showWorkflow={liveTarget === null}\n onFire={\n liveTarget && manualTrigger\n ? () =>\n fireWorkflow(liveTarget.id).then((result) => result.error)\n : undefined\n }\n />\n </div>\n )}\n </main>\n </div>\n );\n}\n","import type { PHAppConfig } from \"@powerhousedao/reactor-browser\";\n\nexport const editorConfig: PHAppConfig = {\n isDragAndDropEnabled: true,\n allowedDocumentTypes: [\"powerhouse/workflow\", \"powerhouse/connection\"],\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { useSetPHAppConfig } from \"@powerhousedao/reactor-browser\";\nimport type { EditorProps } from \"document-model\";\nimport { useSyncWorkflowRuntimeUrl } from \"../workflow-editor/use-runtime-url.js\";\nimport { WorkflowStudio } from \"./components/WorkflowStudio.js\";\nimport { editorConfig } from \"./config.js\";\n\n/** Editor component for the app */\nexport default function Editor(props: EditorProps) {\n useSetPHAppConfig(editorConfig);\n useSyncWorkflowRuntimeUrl();\n return (\n <div className=\"h-full min-h-0 bg-background\">\n <WorkflowStudio>{props.children}</WorkflowStudio>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAqBA,MAAMA,SAA6B;CACjC,IAAI;CACJ,MAAM;CACN,MAAM;CACN,KAAK;CACL,MAAM;AACR;AAEA,MAAMC,SAA6B;CACjC,IAAI;CACJ,MAAM;CACN,MAAM;CACN,KAAK;CACL,MAAM;AACR;AAIA,MAAM,YAAY;AAElB,SAAgB,UAAU,OAAmD;CAC3E,MAAM,KAAK,MAAM,SAAS;CAC1B,MAAM,WAAW,MAAM,MAAM,SAAS;CACtC,MAAM,QAAQ,WAAW,MAAM,MAAM,MAAM,GAAG,CAAa,IAAI,MAAM;CACrE,MAAM,SAAS,MAAM,MAAM,SAAS,MAAM;CAC1C,MAAM,QAAQ,MAAM,KAAK,SACvB,KAAK,SAAS,OAAO,WAAW,KAAK,MAAM,IAAI,MACjD;CACA,OACE,qBAAC,MAAD;EACE,WAAU;EACV,cAAY,MAAM,MACf,KACE,SACC,GAAG,KAAK,QAAQ,KAAK,SAAS,KAAK,KAAK,OAAO,YAAY,MAAM,IACrE,CAAC,CACA,KAAK,IAAI;EAPd,UAAA,CASG,MAAM,KAAK,MAAM,UAChB,qBAAC,MAAD;GAAkB,WAAU;GAA5B,UAAA,CACG,QAAQ,IACP,oBAAC,QAAD;IACE,eAAA;IACA,WAAW,SAAS,KAAK,QAAQ,MAAM,GAAGA,OAAK,MAAM;GACtD,CAAA,IACC,MACJ,oBAAC,QAAD;IACE,OACE,KAAK,SACD,GAAG,KAAK,MAAM,IAAI,KAAK,OAAO,YAAY,MAC1C,KAAK;IAEX,WAAW,6FACT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AAgB,KAAA,CAAS;MAEzC,UAAA,MAAM;KACc,GANhB,cAMgB;IACpB,CAAA;GACF,CAAA,IAEL,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,aACC,oBAAC,gBAAD;KAEE,MAAM;KACA;KACN,cAAc,gBAAgB,WAAW,EAAE;IAC5C,GAJM,WAAW,EAIjB,IAED,oBAAC,eAAD;KACQ;KACI;KACV,SAAS,eAAe,OAAO,UAAU;KACzC,gBACE,OAAO,eAAe,YAAY,UAAU,MAAM;IAErD,CAAA,GAEH,oBAAC,UAAD;KAEE,OAAO,aAAa,SAAS;KACvB;KACN,OAAO;KACP,QAAQ;KACR,cAAc,eAAe;KAC7B,QACE,cAAc,sBAER,aAAa,WAAW,EAAE,CAAC,CAAC,MAAM,WAAW,OAAO,KAAK,IAC3D,KAAA;IAEP,CAAA,CACE;;EAEH,CAAA,CACH;;AAET;;;AC9LA,MAAa,eAA4B;CACvC,sBAAsB;CACtB,sBAAsB,CAAC,uBAAuB,uBAAuB;AACvE;;;;;;;;ACMA,SAAwB,OAAO,OAAoB;CACjD,kBAAkB,YAAY;CAC9B,0BAA0B;CAC1B,OACE,oBAAC,OAAD;EAAK,WAAU;EACb,UAAA,oBAAC,gBAAD,EAAA,UAAiB,MAAM,SAAyB,CAAA;CAC7C,CAAA;AAET"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"module-DuxxhgKs.mjs","names":["z","workflowWorkflowActions","workflowTriggerActions","workflowStepsActions","workflowEdgesActions","workflowVariablesActions","workflowPolicyActions","workflowRuntimeActions","utils","genUtils","customUtils"],"sources":["../../document-models/workflow/v1/gen/schema/zod.ts","../../document-models/workflow/v1/gen/edges/creators.ts","../../document-models/workflow/v1/gen/policy/creators.ts","../../document-models/workflow/v1/gen/runtime/creators.ts","../../document-models/workflow/v1/gen/steps/creators.ts","../../document-models/workflow/v1/gen/trigger/creators.ts","../../document-models/workflow/v1/gen/variables/creators.ts","../../document-models/workflow/v1/gen/workflow/creators.ts","../../document-models/workflow/v1/actions.ts","../../document-models/workflow/v1/gen/document-model.ts","../../document-models/workflow/v1/gen/edges/error.ts","../../document-models/workflow/v1/src/reducers/edges.ts","../../document-models/workflow/v1/src/reducers/policy.ts","../../document-models/workflow/v1/src/reducers/runtime.ts","../../document-models/workflow/v1/gen/steps/error.ts","../../document-models/workflow/v1/src/reducers/steps.ts","../../document-models/workflow/v1/gen/trigger/error.ts","../../document-models/workflow/v1/src/reducers/trigger.ts","../../document-models/workflow/v1/gen/variables/error.ts","../../document-models/workflow/v1/src/reducers/variables.ts","../../document-models/workflow/v1/src/reducers/workflow.ts","../../document-models/workflow/v1/gen/reducer.ts","../../document-models/workflow/upgrades/versions.ts","../../document-models/workflow/upgrades/upgrade-manifest.ts","../../document-models/workflow/v1/gen/document-type.ts","../../document-models/workflow/v1/gen/document-schema.ts","../../document-models/workflow/v1/gen/utils.ts","../../document-models/workflow/v1/src/utils.ts","../../document-models/workflow/v1/utils.ts","../../document-models/workflow/v1/module.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-object-type */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport * as z from \"zod\";\nimport type {\n AddEdgeInput,\n AddStepInput,\n AddStepPositionInput,\n AddStepRetryPolicyInput,\n BackoffKind,\n ClearTriggerInput,\n ConcurrencyMode,\n FailureMode,\n Point,\n RemoveEdgeInput,\n RemoveStepInput,\n RemoveVariableInput,\n RetryPolicy,\n RunStatus,\n SetLastRunInput,\n SetPolicyInput,\n SetPolicyRetryPolicyInput,\n SetStepConfigInput,\n SetTriggerInput,\n SetVariableInput,\n SetWorkflowDescriptionInput,\n SetWorkflowNameInput,\n SetWorkflowStatusInput,\n TriggerBinding,\n UpdateStepInput,\n UpdateStepPositionInput,\n UpdateStepRetryPolicyInput,\n WorkflowEdge,\n WorkflowPolicy,\n WorkflowState,\n WorkflowStatus,\n WorkflowStep,\n WorkflowVariable,\n} from \"./types.js\";\n\ntype Properties<T> = Required<{\n [K in keyof T]: z.ZodType<T[K]>;\n}>;\n\ntype definedNonNullAny = {};\n\nexport const isDefinedNonNullAny = (v: any): v is definedNonNullAny =>\n v !== undefined && v !== null;\n\nexport const definedNonNullAnySchema = z\n .any()\n .refine((v) => isDefinedNonNullAny(v));\n\nexport const BackoffKindSchema = z.enum([\"EXPONENTIAL\", \"FIXED\"]);\n\nexport const ConcurrencyModeSchema = z.enum([\"PARALLEL\", \"QUEUE\", \"SINGLETON\"]);\n\nexport const FailureModeSchema = z.enum([\"IGNORE\", \"NOTIFY\", \"PARK\"]);\n\nexport const RunStatusSchema = z.enum([\n \"CANCELLED\",\n \"FAILED\",\n \"PARKED\",\n \"PENDING\",\n \"RUNNING\",\n \"SUCCEEDED\",\n \"WAITING\",\n]);\n\nexport const WorkflowStatusSchema = z.enum([\n \"ARCHIVED\",\n \"DISABLED\",\n \"DRAFT\",\n \"ENABLED\",\n]);\n\nexport function AddEdgeInputSchema(): z.ZodObject<Properties<AddEdgeInput>> {\n return z.object({\n condition: z.string().nullish(),\n from: z.string(),\n id: z.string(),\n port: z.string(),\n to: z.string(),\n });\n}\n\nexport function AddStepInputSchema(): z.ZodObject<Properties<AddStepInput>> {\n return z.object({\n blockType: z.string(),\n config: z.unknown(),\n connectionId: z.string().nullish(),\n id: z.string(),\n idempotencyKeyExpression: z.string().nullish(),\n key: z.string(),\n name: z.string(),\n position: z.lazy(() => AddStepPositionInputSchema().nullish()),\n retry: z.lazy(() => AddStepRetryPolicyInputSchema().nullish()),\n timeoutSeconds: z.number().nullish(),\n });\n}\n\nexport function AddStepPositionInputSchema(): z.ZodObject<\n Properties<AddStepPositionInput>\n> {\n return z.object({\n x: z.number(),\n y: z.number(),\n });\n}\n\nexport function AddStepRetryPolicyInputSchema(): z.ZodObject<\n Properties<AddStepRetryPolicyInput>\n> {\n return z.object({\n backoff: BackoffKindSchema,\n initialDelaySeconds: z.number(),\n maxAttempts: z.number(),\n maxDelaySeconds: z.number(),\n retryOn: z.array(z.string()),\n });\n}\n\nexport function ClearTriggerInputSchema(): z.ZodObject<\n Properties<ClearTriggerInput>\n> {\n return z.object({\n _: z.boolean().nullish(),\n });\n}\n\nexport function PointSchema(): z.ZodObject<Properties<Point>> {\n return z.object({\n __typename: z.literal(\"Point\").optional(),\n x: z.number(),\n y: z.number(),\n });\n}\n\nexport function RemoveEdgeInputSchema(): z.ZodObject<\n Properties<RemoveEdgeInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function RemoveStepInputSchema(): z.ZodObject<\n Properties<RemoveStepInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function RemoveVariableInputSchema(): z.ZodObject<\n Properties<RemoveVariableInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function RetryPolicySchema(): z.ZodObject<Properties<RetryPolicy>> {\n return z.object({\n __typename: z.literal(\"RetryPolicy\").optional(),\n backoff: BackoffKindSchema,\n initialDelaySeconds: z.number(),\n maxAttempts: z.number(),\n maxDelaySeconds: z.number(),\n retryOn: z.array(z.string()),\n });\n}\n\nexport function SetLastRunInputSchema(): z.ZodObject<\n Properties<SetLastRunInput>\n> {\n return z.object({\n lastRunAt: z.iso.datetime(),\n lastRunStatus: RunStatusSchema,\n });\n}\n\nexport function SetPolicyInputSchema(): z.ZodObject<\n Properties<SetPolicyInput>\n> {\n return z.object({\n concurrency: ConcurrencyModeSchema.nullish(),\n defaultRetry: z.lazy(() => SetPolicyRetryPolicyInputSchema().nullish()),\n journalAsDocument: z.boolean().nullish(),\n maxParallelRuns: z.number().nullish(),\n maxSuspensionDays: z.number().nullish(),\n onFailure: FailureModeSchema.nullish(),\n retainRunsDays: z.number().nullish(),\n runTimeoutSeconds: z.number().nullish(),\n });\n}\n\nexport function SetPolicyRetryPolicyInputSchema(): z.ZodObject<\n Properties<SetPolicyRetryPolicyInput>\n> {\n return z.object({\n backoff: BackoffKindSchema,\n initialDelaySeconds: z.number(),\n maxAttempts: z.number(),\n maxDelaySeconds: z.number(),\n retryOn: z.array(z.string()),\n });\n}\n\nexport function SetStepConfigInputSchema(): z.ZodObject<\n Properties<SetStepConfigInput>\n> {\n return z.object({\n config: z.unknown(),\n id: z.string(),\n });\n}\n\nexport function SetTriggerInputSchema(): z.ZodObject<\n Properties<SetTriggerInput>\n> {\n return z.object({\n blockType: z.string(),\n config: z.unknown(),\n connectionId: z.string().nullish(),\n filter: z.unknown().nullish(),\n id: z.string(),\n });\n}\n\nexport function SetVariableInputSchema(): z.ZodObject<\n Properties<SetVariableInput>\n> {\n return z.object({\n description: z.string().nullish(),\n id: z.string(),\n key: z.string(),\n value: z.unknown().nullish(),\n });\n}\n\nexport function SetWorkflowDescriptionInputSchema(): z.ZodObject<\n Properties<SetWorkflowDescriptionInput>\n> {\n return z.object({\n description: z.string().nullish(),\n });\n}\n\nexport function SetWorkflowNameInputSchema(): z.ZodObject<\n Properties<SetWorkflowNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetWorkflowStatusInputSchema(): z.ZodObject<\n Properties<SetWorkflowStatusInput>\n> {\n return z.object({\n status: WorkflowStatusSchema,\n });\n}\n\nexport function TriggerBindingSchema(): z.ZodObject<\n Properties<TriggerBinding>\n> {\n return z.object({\n __typename: z.literal(\"TriggerBinding\").optional(),\n blockType: z.string(),\n config: z.unknown(),\n connectionId: z.string().nullish(),\n filter: z.unknown().nullish(),\n id: z.string(),\n });\n}\n\nexport function UpdateStepInputSchema(): z.ZodObject<\n Properties<UpdateStepInput>\n> {\n return z.object({\n blockType: z.string().nullish(),\n config: z.unknown().nullish(),\n connectionId: z.string().nullish(),\n id: z.string(),\n idempotencyKeyExpression: z.string().nullish(),\n key: z.string().nullish(),\n name: z.string().nullish(),\n position: z.lazy(() => UpdateStepPositionInputSchema().nullish()),\n retry: z.lazy(() => UpdateStepRetryPolicyInputSchema().nullish()),\n timeoutSeconds: z.number().nullish(),\n });\n}\n\nexport function UpdateStepPositionInputSchema(): z.ZodObject<\n Properties<UpdateStepPositionInput>\n> {\n return z.object({\n x: z.number(),\n y: z.number(),\n });\n}\n\nexport function UpdateStepRetryPolicyInputSchema(): z.ZodObject<\n Properties<UpdateStepRetryPolicyInput>\n> {\n return z.object({\n backoff: BackoffKindSchema,\n initialDelaySeconds: z.number(),\n maxAttempts: z.number(),\n maxDelaySeconds: z.number(),\n retryOn: z.array(z.string()),\n });\n}\n\nexport function WorkflowEdgeSchema(): z.ZodObject<Properties<WorkflowEdge>> {\n return z.object({\n __typename: z.literal(\"WorkflowEdge\").optional(),\n condition: z.string().nullish(),\n from: z.string(),\n id: z.string(),\n port: z.string(),\n to: z.string(),\n });\n}\n\nexport function WorkflowPolicySchema(): z.ZodObject<\n Properties<WorkflowPolicy>\n> {\n return z.object({\n __typename: z.literal(\"WorkflowPolicy\").optional(),\n concurrency: ConcurrencyModeSchema,\n defaultRetry: z.lazy(() => RetryPolicySchema()),\n journalAsDocument: z.boolean(),\n maxParallelRuns: z.number().nullish(),\n maxSuspensionDays: z.number(),\n onFailure: FailureModeSchema,\n retainRunsDays: z.number(),\n runTimeoutSeconds: z.number(),\n });\n}\n\nexport function WorkflowStateSchema(): z.ZodObject<Properties<WorkflowState>> {\n return z.object({\n __typename: z.literal(\"WorkflowState\").optional(),\n description: z.string().nullish(),\n edges: z.array(z.lazy(() => WorkflowEdgeSchema())),\n lastRunAt: z.iso.datetime().nullish(),\n lastRunStatus: RunStatusSchema.nullish(),\n name: z.string(),\n policy: z.lazy(() => WorkflowPolicySchema()),\n status: WorkflowStatusSchema,\n steps: z.array(z.lazy(() => WorkflowStepSchema())),\n trigger: z.lazy(() => TriggerBindingSchema().nullish()),\n variables: z.array(z.lazy(() => WorkflowVariableSchema())),\n version: z.number(),\n });\n}\n\nexport function WorkflowStepSchema(): z.ZodObject<Properties<WorkflowStep>> {\n return z.object({\n __typename: z.literal(\"WorkflowStep\").optional(),\n blockType: z.string(),\n config: z.unknown(),\n connectionId: z.string().nullish(),\n id: z.string(),\n idempotencyKeyExpression: z.string().nullish(),\n key: z.string(),\n name: z.string(),\n position: z.lazy(() => PointSchema().nullish()),\n retry: z.lazy(() => RetryPolicySchema().nullish()),\n timeoutSeconds: z.number().nullish(),\n });\n}\n\nexport function WorkflowVariableSchema(): z.ZodObject<\n Properties<WorkflowVariable>\n> {\n return z.object({\n __typename: z.literal(\"WorkflowVariable\").optional(),\n description: z.string().nullish(),\n id: z.string(),\n key: z.string(),\n value: z.unknown().nullish(),\n });\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport { AddEdgeInputSchema, RemoveEdgeInputSchema } from \"../schema/zod.js\";\nimport type { AddEdgeInput, RemoveEdgeInput } from \"../types.js\";\nimport type { AddEdgeAction, RemoveEdgeAction } from \"./actions.js\";\n\nexport const addEdge = (input: AddEdgeInput) =>\n createAction<AddEdgeAction>(\n \"ADD_EDGE\",\n { ...input },\n undefined,\n AddEdgeInputSchema,\n \"global\",\n );\n\nexport const removeEdge = (input: RemoveEdgeInput) =>\n createAction<RemoveEdgeAction>(\n \"REMOVE_EDGE\",\n { ...input },\n undefined,\n RemoveEdgeInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport { SetPolicyInputSchema } from \"../schema/zod.js\";\nimport type { SetPolicyInput } from \"../types.js\";\nimport type { SetPolicyAction } from \"./actions.js\";\n\nexport const setPolicy = (input: SetPolicyInput) =>\n createAction<SetPolicyAction>(\n \"SET_POLICY\",\n { ...input },\n undefined,\n SetPolicyInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport { SetLastRunInputSchema } from \"../schema/zod.js\";\nimport type { SetLastRunInput } from \"../types.js\";\nimport type { SetLastRunAction } from \"./actions.js\";\n\nexport const setLastRun = (input: SetLastRunInput) =>\n createAction<SetLastRunAction>(\n \"SET_LAST_RUN\",\n { ...input },\n undefined,\n SetLastRunInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n AddStepInputSchema,\n RemoveStepInputSchema,\n SetStepConfigInputSchema,\n UpdateStepInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n AddStepInput,\n RemoveStepInput,\n SetStepConfigInput,\n UpdateStepInput,\n} from \"../types.js\";\nimport type {\n AddStepAction,\n RemoveStepAction,\n SetStepConfigAction,\n UpdateStepAction,\n} from \"./actions.js\";\n\nexport const addStep = (input: AddStepInput) =>\n createAction<AddStepAction>(\n \"ADD_STEP\",\n { ...input },\n undefined,\n AddStepInputSchema,\n \"global\",\n );\n\nexport const updateStep = (input: UpdateStepInput) =>\n createAction<UpdateStepAction>(\n \"UPDATE_STEP\",\n { ...input },\n undefined,\n UpdateStepInputSchema,\n \"global\",\n );\n\nexport const removeStep = (input: RemoveStepInput) =>\n createAction<RemoveStepAction>(\n \"REMOVE_STEP\",\n { ...input },\n undefined,\n RemoveStepInputSchema,\n \"global\",\n );\n\nexport const setStepConfig = (input: SetStepConfigInput) =>\n createAction<SetStepConfigAction>(\n \"SET_STEP_CONFIG\",\n { ...input },\n undefined,\n SetStepConfigInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n ClearTriggerInputSchema,\n SetTriggerInputSchema,\n} from \"../schema/zod.js\";\nimport type { ClearTriggerInput, SetTriggerInput } from \"../types.js\";\nimport type { ClearTriggerAction, SetTriggerAction } from \"./actions.js\";\n\nexport const setTrigger = (input: SetTriggerInput) =>\n createAction<SetTriggerAction>(\n \"SET_TRIGGER\",\n { ...input },\n undefined,\n SetTriggerInputSchema,\n \"global\",\n );\n\nexport const clearTrigger = (input: ClearTriggerInput) =>\n createAction<ClearTriggerAction>(\n \"CLEAR_TRIGGER\",\n { ...input },\n undefined,\n ClearTriggerInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n RemoveVariableInputSchema,\n SetVariableInputSchema,\n} from \"../schema/zod.js\";\nimport type { RemoveVariableInput, SetVariableInput } from \"../types.js\";\nimport type { RemoveVariableAction, SetVariableAction } from \"./actions.js\";\n\nexport const setVariable = (input: SetVariableInput) =>\n createAction<SetVariableAction>(\n \"SET_VARIABLE\",\n { ...input },\n undefined,\n SetVariableInputSchema,\n \"global\",\n );\n\nexport const removeVariable = (input: RemoveVariableInput) =>\n createAction<RemoveVariableAction>(\n \"REMOVE_VARIABLE\",\n { ...input },\n undefined,\n RemoveVariableInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n SetWorkflowDescriptionInputSchema,\n SetWorkflowNameInputSchema,\n SetWorkflowStatusInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n SetWorkflowDescriptionInput,\n SetWorkflowNameInput,\n SetWorkflowStatusInput,\n} from \"../types.js\";\nimport type {\n SetWorkflowDescriptionAction,\n SetWorkflowNameAction,\n SetWorkflowStatusAction,\n} from \"./actions.js\";\n\nexport const setWorkflowName = (input: SetWorkflowNameInput) =>\n createAction<SetWorkflowNameAction>(\n \"SET_WORKFLOW_NAME\",\n { ...input },\n undefined,\n SetWorkflowNameInputSchema,\n \"global\",\n );\n\nexport const setWorkflowDescription = (input: SetWorkflowDescriptionInput) =>\n createAction<SetWorkflowDescriptionAction>(\n \"SET_WORKFLOW_DESCRIPTION\",\n { ...input },\n undefined,\n SetWorkflowDescriptionInputSchema,\n \"global\",\n );\n\nexport const setWorkflowStatus = (input: SetWorkflowStatusInput) =>\n createAction<SetWorkflowStatusAction>(\n \"SET_WORKFLOW_STATUS\",\n { ...input },\n undefined,\n SetWorkflowStatusInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { baseActions } from \"document-model\";\nimport {\n workflowEdgesActions,\n workflowPolicyActions,\n workflowRuntimeActions,\n workflowStepsActions,\n workflowTriggerActions,\n workflowVariablesActions,\n workflowWorkflowActions,\n} from \"./gen/creators.js\";\n\n/** Actions for the Workflow document model */\n\nexport const actions = {\n ...baseActions,\n ...workflowWorkflowActions,\n ...workflowTriggerActions,\n ...workflowStepsActions,\n ...workflowEdgesActions,\n ...workflowVariablesActions,\n ...workflowPolicyActions,\n ...workflowRuntimeActions,\n};\n","import type { DocumentModelGlobalState } from \"document-model\";\n\nexport const documentModel: DocumentModelGlobalState = {\n id: \"powerhouse/workflow\",\n name: \"Workflow\",\n author: {\n name: \"Powerhouse\",\n website: \"https://www.powerhouse.inc\",\n },\n extension: \".flow\",\n description:\n \"Workflow definition: trigger, steps, edges, variables and execution policy for the Powerhouse workflow automation runtime.\",\n specifications: [\n {\n state: {\n local: {\n schema: \"\",\n examples: [],\n initialValue: \"\",\n },\n global: {\n schema:\n 'enum WorkflowStatus {\\n DRAFT\\n ENABLED\\n DISABLED\\n ARCHIVED\\n}\\n\\nenum RunStatus {\\n PENDING\\n RUNNING\\n WAITING\\n SUCCEEDED\\n FAILED\\n CANCELLED\\n PARKED\\n}\\n\\nenum ConcurrencyMode {\\n SINGLETON\\n QUEUE\\n PARALLEL\\n}\\n\\nenum FailureMode {\\n PARK\\n NOTIFY\\n IGNORE\\n}\\n\\nenum BackoffKind {\\n FIXED\\n EXPONENTIAL\\n}\\n\\ntype RetryPolicy {\\n maxAttempts: Int!\\n backoff: BackoffKind!\\n initialDelaySeconds: Int!\\n maxDelaySeconds: Int!\\n \"Error classes that are retryable. Everything else fails terminally on attempt 1.\"\\n retryOn: [String!]!\\n}\\n\\n\"Layout only. The runtime ignores it.\"\\ntype Point {\\n x: Float!\\n y: Float!\\n}\\n\\ntype TriggerBinding {\\n id: OID!\\n \"Fully-qualified block type, e.g. \\'core#schedule\\' or \\'@acme/connector-imap#imap.newMessage\\'.\"\\n blockType: String!\\n \"Connection document id, when the trigger\\'s connector requires one.\"\\n connectionId: PHID\\n \"Validated against the trigger\\'s configSchema.\"\\n config: Unknown!\\n \"Optional server-side filter applied before a run is started.\"\\n filter: Unknown\\n}\\n\\ntype WorkflowStep {\\n id: OID!\\n \"Author-visible label; unique within the workflow; used in expressions.\"\\n key: String!\\n name: String!\\n blockType: String!\\n connectionId: PHID\\n config: Unknown!\\n \"Per-step override of the workflow default retry policy.\"\\n retry: RetryPolicy\\n timeoutSeconds: Int\\n \"Expression yielding a stable key; two executions with the same key are one side effect.\"\\n idempotencyKeyExpression: String\\n position: Point\\n}\\n\\ntype WorkflowEdge {\\n id: OID!\\n \"Source step id, or the trigger id for the entry edge.\"\\n from: OID!\\n to: OID!\\n \"Named output port of the source step: \\'next\\', \\'true\\', \\'false\\', \\'error\\', or a case label.\"\\n port: String!\\n \"Optional guard expression; the edge is taken only when it evaluates truthy.\"\\n condition: String\\n}\\n\\ntype WorkflowVariable {\\n id: OID!\\n \"Name used in expressions.\"\\n key: String!\\n \"Default value; the trigger payload can be mapped onto it.\"\\n value: Unknown\\n description: String\\n}\\n\\ntype WorkflowPolicy {\\n \"SINGLETON drops a firing while a run is active; QUEUE serialises; PARALLEL runs concurrently.\"\\n concurrency: ConcurrencyMode!\\n maxParallelRuns: Int\\n runTimeoutSeconds: Int!\\n \"Bounds how long a run may stay suspended on a waitpoint.\"\\n maxSuspensionDays: Int!\\n defaultRetry: RetryPolicy!\\n \"What happens to a run whose steps have all failed terminally.\"\\n onFailure: FailureMode!\\n retainRunsDays: Int!\\n journalAsDocument: Boolean!\\n}\\n\\ntype WorkflowState {\\n name: String!\\n description: String\\n \"Only ENABLED workflows get trigger instances.\"\\n status: WorkflowStatus!\\n \"Monotonic; bumped on every structural edit. A run records the version it executed.\"\\n version: Int!\\n trigger: TriggerBinding\\n steps: [WorkflowStep!]!\\n edges: [WorkflowEdge!]!\\n variables: [WorkflowVariable!]!\\n policy: WorkflowPolicy!\\n \"Denormalised for inspectors; written by the runtime.\"\\n lastRunAt: DateTime\\n lastRunStatus: RunStatus\\n}',\n examples: [],\n initialValue:\n '{\\n \"name\": \"\",\\n \"description\": null,\\n \"status\": \"DRAFT\",\\n \"version\": 0,\\n \"trigger\": null,\\n \"steps\": [],\\n \"edges\": [],\\n \"variables\": [],\\n \"policy\": {\\n \"concurrency\": \"QUEUE\",\\n \"maxParallelRuns\": null,\\n \"runTimeoutSeconds\": 3600,\\n \"maxSuspensionDays\": 30,\\n \"defaultRetry\": {\\n \"maxAttempts\": 1,\\n \"backoff\": \"FIXED\",\\n \"initialDelaySeconds\": 5,\\n \"maxDelaySeconds\": 300,\\n \"retryOn\": []\\n },\\n \"onFailure\": \"PARK\",\\n \"retainRunsDays\": 30,\\n \"journalAsDocument\": false\\n },\\n \"lastRunAt\": null,\\n \"lastRunStatus\": null\\n}',\n },\n },\n modules: [\n {\n id: \"2bcbeac5-6a42-4dd7-ad9a-a11401acfa67\",\n name: \"workflow\",\n description: \"Workflow identity and lifecycle status.\",\n operations: [\n {\n id: \"63c4df18-df11-4f17-8afa-69da90129dd9\",\n name: \"SET_WORKFLOW_NAME\",\n description: \"Sets the workflow name.\",\n schema: \"input SetWorkflowNameInput {\\n name: String!\\n}\",\n template: \"Sets the workflow name.\",\n reducer: \"state.name = action.input.name;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"2875c3ae-6fc6-4ebb-9274-6f8318227945\",\n name: \"SET_WORKFLOW_DESCRIPTION\",\n description: \"Sets or clears the workflow description.\",\n schema:\n \"input SetWorkflowDescriptionInput {\\n description: String\\n}\",\n template: \"Sets or clears the workflow description.\",\n reducer: \"state.description = action.input.description || null;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"6b4f8fb2-db70-4707-985d-47cff171dbec\",\n name: \"SET_WORKFLOW_STATUS\",\n description:\n \"Sets the lifecycle status. The trigger supervisor watches this to create or tear down trigger instances.\",\n schema:\n \"input SetWorkflowStatusInput {\\n status: WorkflowStatus!\\n}\",\n template:\n \"Sets the lifecycle status. The trigger supervisor watches this to create or tear down trigger instances.\",\n reducer: \"state.status = action.input.status;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"e1dc35a8-a050-4773-a6a2-6b41f0a6210c\",\n name: \"trigger\",\n description: \"Binding of the workflow's single trigger.\",\n operations: [\n {\n id: \"f1f2ac35-7d6f-4b2c-b1a4-f220f290fdad\",\n name: \"SET_TRIGGER\",\n description: \"Sets or replaces the trigger binding.\",\n schema:\n \"input SetTriggerInput {\\n id: OID!\\n blockType: String!\\n connectionId: PHID\\n config: Unknown!\\n filter: Unknown\\n}\",\n template: \"Sets or replaces the trigger binding.\",\n reducer:\n \"state.trigger = {\\n id: action.input.id,\\n blockType: action.input.blockType,\\n connectionId: action.input.connectionId || null,\\n config: action.input.config,\\n filter: action.input.filter ?? null,\\n};\\nstate.version += 1;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"351e16a9-78c3-4466-a25f-e8b09eb0b956\",\n name: \"CLEAR_TRIGGER\",\n description: \"Removes the trigger binding.\",\n schema: \"input ClearTriggerInput {\\n _: Boolean\\n}\",\n template: \"Removes the trigger binding.\",\n reducer:\n 'if (!state.trigger) {\\n throw new TriggerNotSetError(\"Workflow has no trigger to clear\");\\n}\\nstate.trigger = null;\\nstate.version += 1;',\n errors: [\n {\n id: \"fe485734-5e01-4af9-aaa9-adcc45e3160a\",\n name: \"TriggerNotSetError\",\n code: \"TRIGGER_NOT_SET\",\n description: \"The workflow has no trigger binding to clear.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"e3c8b542-657d-44b9-ad8c-472f8e01dbbf\",\n name: \"steps\",\n description: \"Step instances of blocks in the workflow graph.\",\n operations: [\n {\n id: \"d71c412f-9c48-4c1d-9d5b-f7c3cd18cecc\",\n name: \"ADD_STEP\",\n description: \"Adds a step to the workflow graph.\",\n schema:\n \"input AddStepRetryPolicyInput {\\n maxAttempts: Int!\\n backoff: BackoffKind!\\n initialDelaySeconds: Int!\\n maxDelaySeconds: Int!\\n retryOn: [String!]!\\n}\\n\\ninput AddStepPositionInput {\\n x: Float!\\n y: Float!\\n}\\n\\ninput AddStepInput {\\n id: OID!\\n key: String!\\n name: String!\\n blockType: String!\\n connectionId: PHID\\n config: Unknown!\\n retry: AddStepRetryPolicyInput\\n timeoutSeconds: Int\\n idempotencyKeyExpression: String\\n position: AddStepPositionInput\\n}\",\n template: \"Adds a step to the workflow graph.\",\n reducer:\n 'if (state.steps.some((step) => step.id === action.input.id)) {\\n throw new DuplicateStepIdError(\"A step with this id already exists\");\\n}\\nif (state.steps.some((step) => step.key === action.input.key)) {\\n throw new DuplicateStepKeyError(\"A step with this key already exists\");\\n}\\nstate.steps.push({\\n id: action.input.id,\\n key: action.input.key,\\n name: action.input.name,\\n blockType: action.input.blockType,\\n connectionId: action.input.connectionId || null,\\n config: action.input.config,\\n retry: action.input.retry ?? null,\\n timeoutSeconds: action.input.timeoutSeconds ?? null,\\n idempotencyKeyExpression: action.input.idempotencyKeyExpression || null,\\n position: action.input.position ?? null,\\n});\\nstate.version += 1;',\n errors: [\n {\n id: \"9f42bbac-54a9-42bc-b6e6-86f158d1a474\",\n name: \"DuplicateStepIdError\",\n code: \"DUPLICATE_STEP_ID\",\n description: \"A step with the given id already exists.\",\n template: \"\",\n },\n {\n id: \"e9ef62ad-2b63-43f7-ac25-b0ab81f833c5\",\n name: \"DuplicateStepKeyError\",\n code: \"DUPLICATE_STEP_KEY\",\n description: \"A step with the given key already exists.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"12b4dad9-4a89-4a94-b2ff-fadbf492f555\",\n name: \"UPDATE_STEP\",\n description: \"Updates the provided fields of an existing step.\",\n schema:\n \"input UpdateStepRetryPolicyInput {\\n maxAttempts: Int!\\n backoff: BackoffKind!\\n initialDelaySeconds: Int!\\n maxDelaySeconds: Int!\\n retryOn: [String!]!\\n}\\n\\ninput UpdateStepPositionInput {\\n x: Float!\\n y: Float!\\n}\\n\\ninput UpdateStepInput {\\n id: OID!\\n key: String\\n name: String\\n blockType: String\\n connectionId: PHID\\n config: Unknown\\n retry: UpdateStepRetryPolicyInput\\n timeoutSeconds: Int\\n idempotencyKeyExpression: String\\n position: UpdateStepPositionInput\\n}\",\n template: \"Updates the provided fields of an existing step.\",\n reducer:\n 'const step = state.steps.find((step) => step.id === action.input.id);\\nif (!step) {\\n throw new StepNotFoundError(\"Step not found\");\\n}\\nif (action.input.key) {\\n const conflict = state.steps.some(\\n (other) => other.key === action.input.key && other.id !== action.input.id,\\n );\\n if (conflict) {\\n throw new StepKeyConflictError(\"Another step already uses this key\");\\n }\\n step.key = action.input.key;\\n}\\nif (action.input.name) step.name = action.input.name;\\nif (action.input.blockType) step.blockType = action.input.blockType;\\nif (action.input.connectionId) step.connectionId = action.input.connectionId;\\nif (action.input.config !== undefined && action.input.config !== null) {\\n step.config = action.input.config;\\n}\\nif (action.input.retry) step.retry = action.input.retry;\\nif (action.input.timeoutSeconds !== undefined && action.input.timeoutSeconds !== null) {\\n step.timeoutSeconds = action.input.timeoutSeconds;\\n}\\nif (action.input.idempotencyKeyExpression) {\\n step.idempotencyKeyExpression = action.input.idempotencyKeyExpression;\\n}\\nif (action.input.position) step.position = action.input.position;\\nstate.version += 1;',\n errors: [\n {\n id: \"2f3f0a0b-555a-4350-86b4-5e7e86de8b8a\",\n name: \"StepNotFoundError\",\n code: \"STEP_NOT_FOUND\",\n description: \"No step exists with the given id.\",\n template: \"\",\n },\n {\n id: \"74f45aaf-68ae-49a9-bd3c-d1e5a50b0ea3\",\n name: \"StepKeyConflictError\",\n code: \"STEP_KEY_CONFLICT\",\n description: \"Another step already uses the given key.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"d01c89ca-3934-43b5-9540-9e45b415c772\",\n name: \"REMOVE_STEP\",\n description: \"Removes a step and every edge attached to it.\",\n schema: \"input RemoveStepInput {\\n id: OID!\\n}\",\n template: \"Removes a step and every edge attached to it.\",\n reducer:\n 'const index = state.steps.findIndex((step) => step.id === action.input.id);\\nif (index === -1) {\\n throw new RemoveStepNotFoundError(\"Step not found\");\\n}\\nstate.steps.splice(index, 1);\\nstate.edges = state.edges.filter(\\n (edge) => edge.from !== action.input.id && edge.to !== action.input.id,\\n);\\nstate.version += 1;',\n errors: [\n {\n id: \"2bc5f26f-975b-46a0-9df9-1dbac5bbd6eb\",\n name: \"RemoveStepNotFoundError\",\n code: \"REMOVE_STEP_NOT_FOUND\",\n description: \"No step exists with the given id.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"c83eb80e-8086-40e5-b8ed-fe3f72b664a6\",\n name: \"SET_STEP_CONFIG\",\n description: \"Replaces a step's block configuration.\",\n schema:\n \"input SetStepConfigInput {\\n id: OID!\\n config: Unknown!\\n}\",\n template: \"Replaces a step's block configuration.\",\n reducer:\n 'const step = state.steps.find((step) => step.id === action.input.id);\\nif (!step) {\\n throw new ConfigStepNotFoundError(\"Step not found\");\\n}\\nstep.config = action.input.config;\\nstate.version += 1;',\n errors: [\n {\n id: \"8ba30ce9-510e-4765-9955-23b4d76595ab\",\n name: \"ConfigStepNotFoundError\",\n code: \"CONFIG_STEP_NOT_FOUND\",\n description: \"No step exists with the given id.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"5f6223ad-23d1-4e2c-9680-8fd91234d785\",\n name: \"edges\",\n description: \"Directed edges between steps (and from the trigger).\",\n operations: [\n {\n id: \"293bcd32-7c85-42c9-846a-8c4ecde33154\",\n name: \"ADD_EDGE\",\n description:\n \"Adds an edge. The source may be a step or the trigger; the target must be a step.\",\n schema:\n \"input AddEdgeInput {\\n id: OID!\\n from: OID!\\n to: OID!\\n port: String!\\n condition: String\\n}\",\n template:\n \"Adds an edge. The source may be a step or the trigger; the target must be a step.\",\n reducer:\n 'if (state.edges.some((edge) => edge.id === action.input.id)) {\\n throw new DuplicateEdgeIdError(\"An edge with this id already exists\");\\n}\\nconst fromExists =\\n state.steps.some((step) => step.id === action.input.from) ||\\n state.trigger?.id === action.input.from;\\nif (!fromExists) {\\n throw new EdgeSourceNotFoundError(\"Edge source step or trigger not found\");\\n}\\nif (!state.steps.some((step) => step.id === action.input.to)) {\\n throw new EdgeTargetNotFoundError(\"Edge target step not found\");\\n}\\nif (wouldCycle(state.edges, action.input.from, action.input.to)) {\\n throw new EdgeCycleError(\"Edge would create a cycle in the workflow graph\");\\n}\\nstate.edges.push({\\n id: action.input.id,\\n from: action.input.from,\\n to: action.input.to,\\n port: action.input.port,\\n condition: action.input.condition || null,\\n});\\nstate.version += 1;',\n errors: [\n {\n id: \"aa22b9b5-bbd7-4d80-b6b6-573c5f761ed7\",\n name: \"DuplicateEdgeIdError\",\n code: \"DUPLICATE_EDGE_ID\",\n description: \"An edge with the given id already exists.\",\n template: \"\",\n },\n {\n id: \"5207d810-062d-4b83-82e3-e3f89d905a83\",\n name: \"EdgeSourceNotFoundError\",\n code: \"EDGE_SOURCE_NOT_FOUND\",\n description:\n \"The edge source references no existing step or trigger.\",\n template: \"\",\n },\n {\n id: \"39149b92-84b9-4429-a631-4d7e1981270c\",\n name: \"EdgeTargetNotFoundError\",\n code: \"EDGE_TARGET_NOT_FOUND\",\n description: \"The edge target references no existing step.\",\n template: \"\",\n },\n {\n id: \"6e4a5f2b-3c7d-4e19-9a2b-8d0c1f5e7a6b\",\n name: \"EdgeCycleError\",\n code: \"EDGE_CYCLE\",\n description:\n \"The edge would create a cycle in the workflow graph.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"ba545d3b-796d-4af3-b4c6-016401a691ff\",\n name: \"REMOVE_EDGE\",\n description: \"Removes an edge.\",\n schema: \"input RemoveEdgeInput {\\n id: OID!\\n}\",\n template: \"Removes an edge.\",\n reducer:\n 'const index = state.edges.findIndex((edge) => edge.id === action.input.id);\\nif (index === -1) {\\n throw new EdgeNotFoundError(\"Edge not found\");\\n}\\nstate.edges.splice(index, 1);\\nstate.version += 1;',\n errors: [\n {\n id: \"b7e2ffa4-7775-460d-aae8-0d82dce5ffcf\",\n name: \"EdgeNotFoundError\",\n code: \"EDGE_NOT_FOUND\",\n description: \"No edge exists with the given id.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"c003c578-94fd-40d1-8964-ea151ee56486\",\n name: \"variables\",\n description: \"Workflow-level inputs and defaults.\",\n operations: [\n {\n id: \"50745ece-569a-4d49-b649-8ec2de3dd2d9\",\n name: \"SET_VARIABLE\",\n description: \"Creates or updates a variable, keyed by its key.\",\n schema:\n \"input SetVariableInput {\\n id: OID!\\n key: String!\\n value: Unknown\\n description: String\\n}\",\n template: \"Creates or updates a variable, keyed by its key.\",\n reducer:\n \"const existing = state.variables.find(\\n (variable) => variable.key === action.input.key,\\n);\\nif (existing) {\\n existing.value = action.input.value ?? null;\\n if (action.input.description) existing.description = action.input.description;\\n} else {\\n state.variables.push({\\n id: action.input.id,\\n key: action.input.key,\\n value: action.input.value ?? null,\\n description: action.input.description || null,\\n });\\n}\\nstate.version += 1;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"d85b2b0a-085b-482e-a4be-401fa7e5faa2\",\n name: \"REMOVE_VARIABLE\",\n description: \"Removes a variable.\",\n schema: \"input RemoveVariableInput {\\n id: OID!\\n}\",\n template: \"Removes a variable.\",\n reducer:\n 'const index = state.variables.findIndex(\\n (variable) => variable.id === action.input.id,\\n);\\nif (index === -1) {\\n throw new VariableNotFoundError(\"Variable not found\");\\n}\\nstate.variables.splice(index, 1);\\nstate.version += 1;',\n errors: [\n {\n id: \"2b1913d2-6490-48f5-8bdb-5ec8e062c855\",\n name: \"VariableNotFoundError\",\n code: \"VARIABLE_NOT_FOUND\",\n description: \"No variable exists with the given id.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"956e2432-13b1-417a-b932-4286082ef7d4\",\n name: \"policy\",\n description: \"Execution policy for runs of this workflow.\",\n operations: [\n {\n id: \"e0a331e7-a4b0-4b93-8af7-d25e602932b8\",\n name: \"SET_POLICY\",\n description:\n \"Updates the provided fields of the execution policy.\",\n schema:\n \"input SetPolicyRetryPolicyInput {\\n maxAttempts: Int!\\n backoff: BackoffKind!\\n initialDelaySeconds: Int!\\n maxDelaySeconds: Int!\\n retryOn: [String!]!\\n}\\n\\ninput SetPolicyInput {\\n concurrency: ConcurrencyMode\\n maxParallelRuns: Int\\n runTimeoutSeconds: Int\\n maxSuspensionDays: Int\\n defaultRetry: SetPolicyRetryPolicyInput\\n onFailure: FailureMode\\n retainRunsDays: Int\\n journalAsDocument: Boolean\\n}\",\n template: \"Updates the provided fields of the execution policy.\",\n reducer:\n \"if (action.input.concurrency) state.policy.concurrency = action.input.concurrency;\\nif (action.input.maxParallelRuns !== undefined && action.input.maxParallelRuns !== null) {\\n state.policy.maxParallelRuns = action.input.maxParallelRuns;\\n}\\nif (action.input.runTimeoutSeconds !== undefined && action.input.runTimeoutSeconds !== null) {\\n state.policy.runTimeoutSeconds = action.input.runTimeoutSeconds;\\n}\\nif (action.input.maxSuspensionDays !== undefined && action.input.maxSuspensionDays !== null) {\\n state.policy.maxSuspensionDays = action.input.maxSuspensionDays;\\n}\\nif (action.input.defaultRetry) state.policy.defaultRetry = action.input.defaultRetry;\\nif (action.input.onFailure) state.policy.onFailure = action.input.onFailure;\\nif (action.input.retainRunsDays !== undefined && action.input.retainRunsDays !== null) {\\n state.policy.retainRunsDays = action.input.retainRunsDays;\\n}\\nif (action.input.journalAsDocument !== undefined && action.input.journalAsDocument !== null) {\\n state.policy.journalAsDocument = action.input.journalAsDocument;\\n}\\nstate.version += 1;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"4c4656ac-62bb-498a-9a64-567a8e09ac09\",\n name: \"runtime\",\n description: \"Denormalised run info written by the workflow runtime.\",\n operations: [\n {\n id: \"cdaf7978-b846-4c3e-ae30-c5d87eac66a4\",\n name: \"SET_LAST_RUN\",\n description: \"Records the outcome of the most recent run.\",\n schema:\n \"input SetLastRunInput {\\n lastRunAt: DateTime!\\n lastRunStatus: RunStatus!\\n}\",\n template: \"Records the outcome of the most recent run.\",\n reducer:\n \"state.lastRunAt = action.input.lastRunAt;\\nstate.lastRunStatus = action.input.lastRunStatus;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n ],\n version: 1,\n changeLog: [],\n },\n ],\n};\n","export type ErrorCode =\n | \"DuplicateEdgeIdError\"\n | \"EdgeSourceNotFoundError\"\n | \"EdgeTargetNotFoundError\"\n | \"EdgeCycleError\"\n | \"EdgeNotFoundError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class DuplicateEdgeIdError extends Error implements ReducerError {\n errorCode = \"DuplicateEdgeIdError\" as ErrorCode;\n constructor(message = \"DuplicateEdgeIdError\") {\n super(message);\n }\n}\n\nexport class EdgeSourceNotFoundError extends Error implements ReducerError {\n errorCode = \"EdgeSourceNotFoundError\" as ErrorCode;\n constructor(message = \"EdgeSourceNotFoundError\") {\n super(message);\n }\n}\n\nexport class EdgeTargetNotFoundError extends Error implements ReducerError {\n errorCode = \"EdgeTargetNotFoundError\" as ErrorCode;\n constructor(message = \"EdgeTargetNotFoundError\") {\n super(message);\n }\n}\n\nexport class EdgeCycleError extends Error implements ReducerError {\n errorCode = \"EdgeCycleError\" as ErrorCode;\n constructor(message = \"EdgeCycleError\") {\n super(message);\n }\n}\n\nexport class EdgeNotFoundError extends Error implements ReducerError {\n errorCode = \"EdgeNotFoundError\" as ErrorCode;\n constructor(message = \"EdgeNotFoundError\") {\n super(message);\n }\n}\n\nexport const errors = {\n AddEdge: {\n DuplicateEdgeIdError,\n EdgeSourceNotFoundError,\n EdgeTargetNotFoundError,\n EdgeCycleError,\n },\n\n RemoveEdge: { EdgeNotFoundError },\n};\n","import type {\n WorkflowEdge,\n WorkflowEdgesOperations,\n} from \"document-models/workflow/v1\";\nimport {\n DuplicateEdgeIdError,\n EdgeCycleError,\n EdgeNotFoundError,\n EdgeSourceNotFoundError,\n EdgeTargetNotFoundError,\n} from \"../../gen/edges/error.js\";\n\n// True when `to` already reaches `from` via existing edges, i.e. the new\n// from->to edge would close a cycle (mirrors the editor's acyclicTargets).\nfunction wouldCycle(edges: WorkflowEdge[], from: string, to: string): boolean {\n const seen = new Set<string>([to]);\n const queue = [to];\n while (queue.length > 0) {\n const current = queue.pop()!;\n if (current === from) return true;\n for (const edge of edges) {\n if (edge.from === current && !seen.has(edge.to)) {\n seen.add(edge.to);\n queue.push(edge.to);\n }\n }\n }\n return false;\n}\n\nexport const workflowEdgesOperations: WorkflowEdgesOperations = {\n addEdgeOperation(state, action) {\n if (state.edges.some((edge) => edge.id === action.input.id)) {\n throw new DuplicateEdgeIdError(\"An edge with this id already exists\");\n }\n const fromExists =\n state.steps.some((step) => step.id === action.input.from) ||\n state.trigger?.id === action.input.from;\n if (!fromExists) {\n throw new EdgeSourceNotFoundError(\n \"Edge source step or trigger not found\",\n );\n }\n if (!state.steps.some((step) => step.id === action.input.to)) {\n throw new EdgeTargetNotFoundError(\"Edge target step not found\");\n }\n if (wouldCycle(state.edges, action.input.from, action.input.to)) {\n throw new EdgeCycleError(\n \"Edge would create a cycle in the workflow graph\",\n );\n }\n state.edges.push({\n id: action.input.id,\n from: action.input.from,\n to: action.input.to,\n port: action.input.port,\n condition: action.input.condition || null,\n });\n state.version += 1;\n },\n removeEdgeOperation(state, action) {\n const index = state.edges.findIndex((edge) => edge.id === action.input.id);\n if (index === -1) {\n throw new EdgeNotFoundError(\"Edge not found\");\n }\n state.edges.splice(index, 1);\n state.version += 1;\n },\n};\n","import type { WorkflowPolicyOperations } from \"document-models/workflow/v1\";\n\nexport const workflowPolicyOperations: WorkflowPolicyOperations = {\n setPolicyOperation(state, action) {\n if (action.input.concurrency)\n state.policy.concurrency = action.input.concurrency;\n if (\n action.input.maxParallelRuns !== undefined &&\n action.input.maxParallelRuns !== null\n ) {\n state.policy.maxParallelRuns = action.input.maxParallelRuns;\n }\n if (\n action.input.runTimeoutSeconds !== undefined &&\n action.input.runTimeoutSeconds !== null\n ) {\n state.policy.runTimeoutSeconds = action.input.runTimeoutSeconds;\n }\n if (\n action.input.maxSuspensionDays !== undefined &&\n action.input.maxSuspensionDays !== null\n ) {\n state.policy.maxSuspensionDays = action.input.maxSuspensionDays;\n }\n if (action.input.defaultRetry)\n state.policy.defaultRetry = action.input.defaultRetry;\n if (action.input.onFailure) state.policy.onFailure = action.input.onFailure;\n if (\n action.input.retainRunsDays !== undefined &&\n action.input.retainRunsDays !== null\n ) {\n state.policy.retainRunsDays = action.input.retainRunsDays;\n }\n if (\n action.input.journalAsDocument !== undefined &&\n action.input.journalAsDocument !== null\n ) {\n state.policy.journalAsDocument = action.input.journalAsDocument;\n }\n state.version += 1;\n },\n};\n","import type { WorkflowRuntimeOperations } from \"document-models/workflow/v1\";\n\nexport const workflowRuntimeOperations: WorkflowRuntimeOperations = {\n setLastRunOperation(state, action) {\n state.lastRunAt = action.input.lastRunAt;\n state.lastRunStatus = action.input.lastRunStatus;\n },\n};\n","export type ErrorCode =\n | \"DuplicateStepIdError\"\n | \"DuplicateStepKeyError\"\n | \"StepNotFoundError\"\n | \"StepKeyConflictError\"\n | \"RemoveStepNotFoundError\"\n | \"ConfigStepNotFoundError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class DuplicateStepIdError extends Error implements ReducerError {\n errorCode = \"DuplicateStepIdError\" as ErrorCode;\n constructor(message = \"DuplicateStepIdError\") {\n super(message);\n }\n}\n\nexport class DuplicateStepKeyError extends Error implements ReducerError {\n errorCode = \"DuplicateStepKeyError\" as ErrorCode;\n constructor(message = \"DuplicateStepKeyError\") {\n super(message);\n }\n}\n\nexport class StepNotFoundError extends Error implements ReducerError {\n errorCode = \"StepNotFoundError\" as ErrorCode;\n constructor(message = \"StepNotFoundError\") {\n super(message);\n }\n}\n\nexport class StepKeyConflictError extends Error implements ReducerError {\n errorCode = \"StepKeyConflictError\" as ErrorCode;\n constructor(message = \"StepKeyConflictError\") {\n super(message);\n }\n}\n\nexport class RemoveStepNotFoundError extends Error implements ReducerError {\n errorCode = \"RemoveStepNotFoundError\" as ErrorCode;\n constructor(message = \"RemoveStepNotFoundError\") {\n super(message);\n }\n}\n\nexport class ConfigStepNotFoundError extends Error implements ReducerError {\n errorCode = \"ConfigStepNotFoundError\" as ErrorCode;\n constructor(message = \"ConfigStepNotFoundError\") {\n super(message);\n }\n}\n\nexport const errors = {\n AddStep: { DuplicateStepIdError, DuplicateStepKeyError },\n\n UpdateStep: { StepNotFoundError, StepKeyConflictError },\n\n RemoveStep: { RemoveStepNotFoundError },\n\n SetStepConfig: { ConfigStepNotFoundError },\n};\n","import type { WorkflowStepsOperations } from \"document-models/workflow/v1\";\nimport {\n ConfigStepNotFoundError,\n DuplicateStepIdError,\n DuplicateStepKeyError,\n RemoveStepNotFoundError,\n StepKeyConflictError,\n StepNotFoundError,\n} from \"../../gen/steps/error.js\";\n\nexport const workflowStepsOperations: WorkflowStepsOperations = {\n addStepOperation(state, action) {\n if (state.steps.some((step) => step.id === action.input.id)) {\n throw new DuplicateStepIdError(\"A step with this id already exists\");\n }\n if (state.steps.some((step) => step.key === action.input.key)) {\n throw new DuplicateStepKeyError(\"A step with this key already exists\");\n }\n state.steps.push({\n id: action.input.id,\n key: action.input.key,\n name: action.input.name,\n blockType: action.input.blockType,\n connectionId: action.input.connectionId || null,\n config: action.input.config,\n retry: action.input.retry ?? null,\n timeoutSeconds: action.input.timeoutSeconds ?? null,\n idempotencyKeyExpression: action.input.idempotencyKeyExpression || null,\n position: action.input.position ?? null,\n });\n state.version += 1;\n },\n updateStepOperation(state, action) {\n const step = state.steps.find((step) => step.id === action.input.id);\n if (!step) {\n throw new StepNotFoundError(\"Step not found\");\n }\n if (action.input.key) {\n const conflict = state.steps.some(\n (other) =>\n other.key === action.input.key && other.id !== action.input.id,\n );\n if (conflict) {\n throw new StepKeyConflictError(\"Another step already uses this key\");\n }\n step.key = action.input.key;\n }\n if (action.input.name) step.name = action.input.name;\n if (action.input.blockType) step.blockType = action.input.blockType;\n // null clears the connection; undefined leaves it unchanged.\n if (action.input.connectionId !== undefined)\n step.connectionId = action.input.connectionId || null;\n if (action.input.config !== undefined && action.input.config !== null) {\n step.config = action.input.config;\n }\n // For the optional runtime fields null clears; undefined leaves as is.\n if (action.input.retry !== undefined) {\n step.retry = action.input.retry ?? null;\n }\n if (action.input.timeoutSeconds !== undefined) {\n step.timeoutSeconds = action.input.timeoutSeconds ?? null;\n }\n if (action.input.idempotencyKeyExpression !== undefined) {\n step.idempotencyKeyExpression =\n action.input.idempotencyKeyExpression || null;\n }\n if (action.input.position !== undefined) {\n step.position = action.input.position ?? null;\n }\n state.version += 1;\n },\n removeStepOperation(state, action) {\n const index = state.steps.findIndex((step) => step.id === action.input.id);\n if (index === -1) {\n throw new RemoveStepNotFoundError(\"Step not found\");\n }\n state.steps.splice(index, 1);\n state.edges = state.edges.filter(\n (edge) => edge.from !== action.input.id && edge.to !== action.input.id,\n );\n state.version += 1;\n },\n setStepConfigOperation(state, action) {\n const step = state.steps.find((step) => step.id === action.input.id);\n if (!step) {\n throw new ConfigStepNotFoundError(\"Step not found\");\n }\n step.config = action.input.config;\n state.version += 1;\n },\n};\n","export type ErrorCode = \"TriggerNotSetError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class TriggerNotSetError extends Error implements ReducerError {\n errorCode = \"TriggerNotSetError\" as ErrorCode;\n constructor(message = \"TriggerNotSetError\") {\n super(message);\n }\n}\n\nexport const errors = {\n ClearTrigger: { TriggerNotSetError },\n};\n","import type { WorkflowTriggerOperations } from \"document-models/workflow/v1\";\nimport { TriggerNotSetError } from \"../../gen/trigger/error.js\";\n\nexport const workflowTriggerOperations: WorkflowTriggerOperations = {\n setTriggerOperation(state, action) {\n state.trigger = {\n id: action.input.id,\n blockType: action.input.blockType,\n connectionId: action.input.connectionId || null,\n config: action.input.config,\n filter: action.input.filter ?? null,\n };\n state.version += 1;\n },\n clearTriggerOperation(state, _action) {\n if (!state.trigger) {\n throw new TriggerNotSetError(\"Workflow has no trigger to clear\");\n }\n const triggerId = state.trigger.id;\n state.trigger = null;\n state.edges = state.edges.filter((edge) => edge.from !== triggerId);\n state.version += 1;\n },\n};\n","export type ErrorCode = \"VariableNotFoundError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class VariableNotFoundError extends Error implements ReducerError {\n errorCode = \"VariableNotFoundError\" as ErrorCode;\n constructor(message = \"VariableNotFoundError\") {\n super(message);\n }\n}\n\nexport const errors = {\n RemoveVariable: { VariableNotFoundError },\n};\n","import type { WorkflowVariablesOperations } from \"document-models/workflow/v1\";\nimport { VariableNotFoundError } from \"../../gen/variables/error.js\";\n\nexport const workflowVariablesOperations: WorkflowVariablesOperations = {\n setVariableOperation(state, action) {\n const existing = state.variables.find(\n (variable) => variable.key === action.input.key,\n );\n if (existing) {\n existing.value = action.input.value ?? null;\n // Undefined leaves it unchanged; an explicit null or \"\" clears it.\n if (action.input.description !== undefined) {\n existing.description = action.input.description || null;\n }\n } else {\n state.variables.push({\n id: action.input.id,\n key: action.input.key,\n value: action.input.value ?? null,\n description: action.input.description || null,\n });\n }\n state.version += 1;\n },\n removeVariableOperation(state, action) {\n const index = state.variables.findIndex(\n (variable) => variable.id === action.input.id,\n );\n if (index === -1) {\n throw new VariableNotFoundError(\"Variable not found\");\n }\n state.variables.splice(index, 1);\n state.version += 1;\n },\n};\n","import type { WorkflowWorkflowOperations } from \"document-models/workflow/v1\";\n\nexport const workflowWorkflowOperations: WorkflowWorkflowOperations = {\n setWorkflowNameOperation(state, action) {\n state.name = action.input.name;\n },\n setWorkflowDescriptionOperation(state, action) {\n state.description = action.input.description || null;\n },\n setWorkflowStatusOperation(state, action) {\n state.status = action.input.status;\n },\n};\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\nimport type { Reducer, StateReducer } from \"document-model\";\nimport { createReducer, isDocumentAction } from \"document-model\";\nimport type { WorkflowPHState } from \"document-models/workflow/v1\";\n\nimport { workflowEdgesOperations } from \"../src/reducers/edges.js\";\nimport { workflowPolicyOperations } from \"../src/reducers/policy.js\";\nimport { workflowRuntimeOperations } from \"../src/reducers/runtime.js\";\nimport { workflowStepsOperations } from \"../src/reducers/steps.js\";\nimport { workflowTriggerOperations } from \"../src/reducers/trigger.js\";\nimport { workflowVariablesOperations } from \"../src/reducers/variables.js\";\nimport { workflowWorkflowOperations } from \"../src/reducers/workflow.js\";\n\nimport {\n AddEdgeInputSchema,\n AddStepInputSchema,\n ClearTriggerInputSchema,\n RemoveEdgeInputSchema,\n RemoveStepInputSchema,\n RemoveVariableInputSchema,\n SetLastRunInputSchema,\n SetPolicyInputSchema,\n SetStepConfigInputSchema,\n SetTriggerInputSchema,\n SetVariableInputSchema,\n SetWorkflowDescriptionInputSchema,\n SetWorkflowNameInputSchema,\n SetWorkflowStatusInputSchema,\n UpdateStepInputSchema,\n} from \"./schema/zod.js\";\n\nconst stateReducer: StateReducer<WorkflowPHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_WORKFLOW_NAME\": {\n SetWorkflowNameInputSchema().parse(action.input);\n\n workflowWorkflowOperations.setWorkflowNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_WORKFLOW_DESCRIPTION\": {\n SetWorkflowDescriptionInputSchema().parse(action.input);\n\n workflowWorkflowOperations.setWorkflowDescriptionOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_WORKFLOW_STATUS\": {\n SetWorkflowStatusInputSchema().parse(action.input);\n\n workflowWorkflowOperations.setWorkflowStatusOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_TRIGGER\": {\n SetTriggerInputSchema().parse(action.input);\n\n workflowTriggerOperations.setTriggerOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"CLEAR_TRIGGER\": {\n ClearTriggerInputSchema().parse(action.input);\n\n workflowTriggerOperations.clearTriggerOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_STEP\": {\n AddStepInputSchema().parse(action.input);\n\n workflowStepsOperations.addStepOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"UPDATE_STEP\": {\n UpdateStepInputSchema().parse(action.input);\n\n workflowStepsOperations.updateStepOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_STEP\": {\n RemoveStepInputSchema().parse(action.input);\n\n workflowStepsOperations.removeStepOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_STEP_CONFIG\": {\n SetStepConfigInputSchema().parse(action.input);\n\n workflowStepsOperations.setStepConfigOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_EDGE\": {\n AddEdgeInputSchema().parse(action.input);\n\n workflowEdgesOperations.addEdgeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_EDGE\": {\n RemoveEdgeInputSchema().parse(action.input);\n\n workflowEdgesOperations.removeEdgeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_VARIABLE\": {\n SetVariableInputSchema().parse(action.input);\n\n workflowVariablesOperations.setVariableOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_VARIABLE\": {\n RemoveVariableInputSchema().parse(action.input);\n\n workflowVariablesOperations.removeVariableOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_POLICY\": {\n SetPolicyInputSchema().parse(action.input);\n\n workflowPolicyOperations.setPolicyOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_LAST_RUN\": {\n SetLastRunInputSchema().parse(action.input);\n\n workflowRuntimeOperations.setLastRunOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n default:\n return state;\n }\n};\n\nexport const reducer: Reducer<WorkflowPHState> = createReducer(stateReducer);\n","export const supportedVersions = [1] as const;\n\nexport const latestVersion = supportedVersions[0];\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { UpgradeManifest } from \"document-model\";\nimport { latestVersion, supportedVersions } from \"./versions.js\";\n\nexport const workflowUpgradeManifest: UpgradeManifest<\n typeof supportedVersions\n> = {\n documentType: \"powerhouse/workflow\",\n latestVersion,\n supportedVersions,\n upgrades: {},\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const workflowDocumentType = \"powerhouse/workflow\";\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport {\n BaseDocumentHeaderSchema,\n BaseDocumentStateSchema,\n} from \"document-model\";\nimport { z } from \"zod\";\nimport { workflowDocumentType } from \"./document-type.js\";\nimport { WorkflowStateSchema } from \"./schema/zod.js\";\nimport type { WorkflowDocument, WorkflowPHState } from \"./types.js\";\n\n/** Schema for validating the header object of a Workflow document */\nexport const WorkflowDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({\n documentType: z.literal(workflowDocumentType),\n});\n\n/** Schema for validating the state object of a Workflow document */\nexport const WorkflowPHStateSchema = BaseDocumentStateSchema.extend({\n global: WorkflowStateSchema(),\n});\n\nexport const WorkflowDocumentSchema = z.object({\n header: WorkflowDocumentHeaderSchema,\n state: WorkflowPHStateSchema,\n initialState: WorkflowPHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a Workflow document state object */\nexport function isWorkflowState(state: unknown): state is WorkflowPHState {\n return WorkflowPHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a Workflow document state object */\nexport function assertIsWorkflowState(\n state: unknown,\n): asserts state is WorkflowPHState {\n WorkflowPHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a Workflow document */\nexport function isWorkflowDocument(\n document: unknown,\n): document is WorkflowDocument {\n return WorkflowDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a Workflow document */\nexport function assertIsWorkflowDocument(\n document: unknown,\n): asserts document is WorkflowDocument {\n WorkflowDocumentSchema.parse(document);\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils, PHBaseState, Reducer } from \"document-model\";\nimport {\n baseCreateDocument,\n baseLoadFromInputVersioned,\n baseSaveToFileHandle,\n createBaseState,\n} from \"document-model\";\nimport { workflowUpgradeManifest } from \"../../upgrades/upgrade-manifest.js\";\nimport {\n assertIsWorkflowDocument,\n assertIsWorkflowState,\n isWorkflowDocument,\n isWorkflowState,\n} from \"./document-schema.js\";\nimport { workflowDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n WorkflowGlobalState,\n WorkflowLocalState,\n WorkflowPHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: WorkflowGlobalState = {\n name: \"\",\n description: null,\n status: \"DRAFT\",\n version: 0,\n trigger: null,\n steps: [],\n edges: [],\n variables: [],\n policy: {\n concurrency: \"QUEUE\",\n maxParallelRuns: null,\n runTimeoutSeconds: 3600,\n maxSuspensionDays: 30,\n defaultRetry: {\n maxAttempts: 1,\n backoff: \"FIXED\",\n initialDelaySeconds: 5,\n maxDelaySeconds: 300,\n retryOn: [],\n },\n onFailure: \"PARK\",\n retainRunsDays: 30,\n journalAsDocument: false,\n },\n lastRunAt: null,\n lastRunStatus: null,\n};\nexport const initialLocalState: WorkflowLocalState = {};\n\nexport const utils: DocumentModelUtils<WorkflowPHState> = {\n fileExtension: \".flow\",\n createState(state) {\n return {\n ...createBaseState(state?.auth, { version: 1, ...state?.document }),\n global: { ...initialGlobalState, ...state?.global },\n local: { ...initialLocalState, ...state?.local },\n };\n },\n createDocument(state) {\n return baseCreateDocument(utils.createState, state, workflowDocumentType);\n },\n saveToFileHandle(document, input) {\n return baseSaveToFileHandle(document, input);\n },\n loadFromInput(input) {\n return baseLoadFromInputVersioned(input, {\n reducers: { 1: reducer as unknown as Reducer<PHBaseState> },\n upgradeManifest: workflowUpgradeManifest,\n });\n },\n isStateOfType(state) {\n return isWorkflowState(state);\n },\n assertIsStateOfType(state) {\n return assertIsWorkflowState(state);\n },\n isDocumentOfType(document) {\n return isWorkflowDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsWorkflowDocument(document);\n },\n};\n","export {};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from \"document-model\";\nimport type { WorkflowPHState } from \"./gen/types.js\";\nimport { utils as genUtils } from \"./gen/utils.js\";\nimport * as customUtils from \"./src/utils.js\";\n\n/** Utils for the Workflow document model */\nexport const utils: DocumentModelUtils<WorkflowPHState> = {\n ...genUtils,\n ...customUtils,\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelModule } from \"document-model\";\nimport { createState, defaultBaseState } from \"document-model\";\nimport { actions } from \"./actions.js\";\nimport { documentModel } from \"./gen/document-model.js\";\nimport { reducer } from \"./gen/reducer.js\";\nimport type { WorkflowPHState } from \"./gen/types.js\";\nimport { utils } from \"./utils.js\";\n\n/** Document model module for the Workflow document type */\nexport const Workflow = {\n version: 1,\n reducer,\n actions,\n utils,\n documentModel: createState(defaultBaseState(), documentModel),\n} as const satisfies DocumentModelModule<WorkflowPHState>;\n"],"mappings":";;;;;AA6CA,MAAa,uBAAuB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UAAU;MACV,SAAS;MACT,QAAQ,CAAC;MACT,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aACE;MACF,QACE;MACF,UACE;MACF,SAAS;MACT,QAAQ,CAAC;MACT,UAAU,CAAC;MACX,OAAO;KACT;IACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY,CACV;KACE,IAAI;KACJ,MAAM;KACN,aAAa;KACb,QACE;KACF,UAAU;KACV,SACE;KACF,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT,GACA;KACE,IAAI;KACJ,MAAM;KACN,aAAa;KACb,QAAQ;KACR,UAAU;KACV,SACE;KACF,QAAQ,CACN;MACE,IAAI;MACJ,MAAM;MACN,MAAM;MACN,aAAa;MACb,UAAU;KACZ,CACF;KACA,UAAU,CAAC;KACX,OAAO;IACT,CACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY;KACV;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QACE;MACF,UAAU;MACV,SACE;MACF,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,GACA;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QACE;MACF,UAAU;MACV,SACE;MACF,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,GACA;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QAAQ;MACR,UAAU;MACV,SACE;MACF,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QACE;MACF,UAAU;MACV,SACE;MACF,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;IACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY,CACV;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UACE;KACF,SACE;KACF,QAAQ;MACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ;MACA;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aACE;OACF,UAAU;MACZ;MACA;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ;MACA;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aACE;OACF,UAAU;MACZ;KACF;KACA,UAAU,CAAC;KACX,OAAO;IACT,GACA;KACE,IAAI;KACJ,MAAM;KACN,aAAa;KACb,QAAQ;KACR,UAAU;KACV,SACE;KACF,QAAQ,CACN;MACE,IAAI;MACJ,MAAM;MACN,MAAM;MACN,aAAa;MACb,UAAU;KACZ,CACF;KACA,UAAU,CAAC;KACX,OAAO;IACT,CACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY,CACV;KACE,IAAI;KACJ,MAAM;KACN,aAAa;KACb,QACE;KACF,UAAU;KACV,SACE;KACF,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT,GACA;KACE,IAAI;KACJ,MAAM;KACN,aAAa;KACb,QAAQ;KACR,UAAU;KACV,SACE;KACF,QAAQ,CACN;MACE,IAAI;MACJ,MAAM;MACN,MAAM;MACN,aAAa;MACb,UAAU;KACZ,CACF;KACA,UAAU,CAAC;KACX,OAAO;I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;CACA;CACA,eAAe,YAAY,iBAAiB,GAAG,aAAa;AAC9D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"piece-auth-Z4mZEOtL.mjs","names":[],"sources":["../../editors/connection-editor/piece-auth.ts"],"sourcesContent":["// Turns a piece's PieceAuth descriptor into a concrete field plan that maps\n// onto powerhouse/connection state: config fields vs secret refs.\nimport type { ConnectionAuthType } from \"document-models/connection\";\n\nexport interface AuthField {\n name: string;\n displayName: string;\n required: boolean;\n description?: string;\n // Non-secret fields only: SHORT_TEXT | NUMBER | CHECKBOX | STATIC_DROPDOWN.\n inputType?: string;\n options?: { label: string; value: unknown }[];\n}\n\nexport interface AuthPlan {\n authType: ConnectionAuthType;\n displayName?: string;\n description?: string;\n configFields: AuthField[];\n secretFields: AuthField[];\n // OAUTH2 / OIDC are declared but not executable by the runtime yet.\n supported: boolean;\n}\n\n// Missing means unset, explicitly null, or emptied to \"\" - not `false`/`0`.\nexport function isConfigValueMissing(value: unknown): boolean {\n return value === undefined || value === null || value === \"\";\n}\n\n// Whether every required config/secret field of the plan is filled; pure so\n// it can drive a live re-check as the user edits, not just a one-time mark.\nexport function isAuthComplete(\n plan: AuthPlan,\n config: Record<string, unknown>,\n refs: Map<string, string>,\n): boolean {\n const configOk = plan.configFields.every(\n (field) => !field.required || !isConfigValueMissing(config[field.name]),\n );\n const secretsOk = plan.secretFields.every(\n (field) => !field.required || Boolean(refs.get(field.name)),\n );\n return configOk && secretsOk;\n}\n\ninterface AuthPropDescriptor {\n displayName?: string;\n description?: string;\n required?: boolean;\n type?: string;\n options?: { options?: { label?: string; value?: unknown }[] };\n}\n\ninterface PieceAuthDescriptor {\n type?: string;\n unsupported?: string;\n displayName?: string;\n description?: string;\n required?: boolean;\n props?: Partial<Record<string, AuthPropDescriptor>>;\n}\n\nfunction toField(name: string, prop: AuthPropDescriptor): AuthField {\n return {\n name,\n displayName: prop.displayName ?? name,\n required: prop.required ?? false,\n description: prop.description,\n inputType: prop.type,\n options: prop.options?.options\n ?.filter((option) => option.value !== undefined)\n .map((option) => ({\n label: option.label ?? String(option.value as string),\n value: option.value,\n })),\n };\n}\n\n// Every sign-in method a piece offers, in its order, one per auth type.\nexport function plansFromAuth(auth: unknown): AuthPlan[] {\n const plans = (Array.isArray(auth) ? auth : [auth]).map(planFromAuth);\n return plans.filter(\n (plan, index) =>\n plans.findIndex((other) => other.authType === plan.authType) === index,\n );\n}\n\n// The method a connection signs in with: the one of its auth type when the\n// runtime can run it, otherwise the piece's default.\nexport function planForConnection(\n auth: unknown,\n authType: ConnectionAuthType,\n): AuthPlan {\n return (\n plansFromAuth(auth).find(\n (plan) => plan.authType === authType && plan.supported,\n ) ?? planFromAuth(auth)\n );\n}\n\nexport function planFromAuth(auth: unknown): AuthPlan {\n // Some pieces declare multiple auth methods; prefer one the runtime supports.\n if (Array.isArray(auth)) {\n const plans = auth.map(planFromAuth);\n return (\n plans.find((plan) => plan.supported && plan.authType !== \"NONE\") ??\n plans.at(0) ??\n planFromAuth(null)\n );\n }\n const descriptor = (auth ?? null) as PieceAuthDescriptor | null;\n const plan = planForDescriptor(descriptor);\n // The runtime's own verdict, e.g. a CUSTOM_AUTH that needs token refresh.\n return descriptor?.unsupported ? { ...plan, supported: false } : plan;\n}\n\nfunction planForDescriptor(descriptor: PieceAuthDescriptor | null): AuthPlan {\n const base = {\n displayName: descriptor?.displayName,\n description: descriptor?.description,\n };\n switch (descriptor?.type) {\n case \"SECRET_TEXT\":\n return {\n ...base,\n authType: \"SECRET_TEXT\",\n configFields: [],\n secretFields: [\n {\n name: \"value\",\n displayName: descriptor.displayName ?? \"Secret\",\n required: descriptor.required ?? true,\n description: descriptor.description,\n },\n ],\n supported: true,\n };\n case \"BASIC_AUTH\": {\n const props = descriptor.props ?? {};\n return {\n ...base,\n authType: \"BASIC_AUTH\",\n configFields: [\n toField(\"username\", props.username ?? { displayName: \"Username\" }),\n ],\n secretFields: [\n toField(\"password\", props.password ?? { displayName: \"Password\" }),\n ],\n supported: true,\n };\n }\n case \"CUSTOM_AUTH\": {\n const entries = Object.entries(descriptor.props ?? {}).filter(\n (entry): entry is [string, AuthPropDescriptor] =>\n entry[1] !== undefined,\n );\n return {\n ...base,\n authType: \"CUSTOM_AUTH\",\n configFields: entries\n .filter(([, prop]) => prop.type !== \"SECRET_TEXT\")\n .map(([name, prop]) => toField(name, prop)),\n secretFields: entries\n .filter(([, prop]) => prop.type === \"SECRET_TEXT\")\n .map(([name, prop]) => toField(name, prop)),\n supported: true,\n };\n }\n case \"OAUTH2\":\n return {\n ...base,\n authType: \"OAUTH2\",\n configFields: [],\n secretFields: [],\n supported: false,\n };\n case \"OIDC\":\n return {\n ...base,\n authType: \"OIDC\",\n configFields: [],\n secretFields: [],\n supported: false,\n };\n default:\n return {\n ...base,\n authType: \"NONE\",\n configFields: [],\n secretFields: [],\n supported: true,\n };\n }\n}\n\n// \"@activepieces/piece-gotify\" -> \"@activepieces/piece-gotify#gotify\"\nexport function connectorIdForPiece(packageName: string): string {\n const short =\n packageName\n .split(\"/\")\n .pop()\n ?.replace(/^piece-/, \"\") ?? packageName;\n return `${packageName}#${short}`;\n}\n\nexport function packageFromConnectorId(connectorId: string): string {\n const separator = connectorId.lastIndexOf(\"#\");\n return separator > 0 ? connectorId.slice(0, separator) : connectorId;\n}\n"],"mappings":";AAyBA,SAAgB,qBAAqB,OAAyB;CAC5D,OAAO,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU;AAC5D;AAIA,SAAgB,eACd,MACA,QACA,MACS;CACT,MAAM,WAAW,KAAK,aAAa,OAChC,UAAU,CAAC,MAAM,YAAY,CAAC,qBAAqB,OAAO,MAAM,KAAK,CACxE;CACA,MAAM,YAAY,KAAK,aAAa,OACjC,UAAU,CAAC,MAAM,YAAY,QAAQ,KAAK,IAAI,MAAM,IAAI,CAAC,CAC5D;CACA,OAAO,YAAY;AACrB;AAmBA,SAAS,QAAQ,MAAc,MAAqC;CAClE,OAAO;EACL;EACA,aAAa,KAAK,eAAe;EACjC,UA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