@powerhousedao/workflow 6.2.3-dev.24 → 6.2.3-dev.25

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 (306) hide show
  1. package/README.md +37 -0
  2. package/dist/browser/BlockSelector-QQgOCVH3.js +1355 -0
  3. package/dist/browser/BlockSelector-QQgOCVH3.js.map +1 -0
  4. package/dist/browser/{PieceMarkdown-CZYNY1qQ.js → PieceMarkdown-BY_aQD0M.js} +120 -86
  5. package/dist/browser/PieceMarkdown-BY_aQD0M.js.map +1 -0
  6. package/dist/browser/assets/{entry-CSJBrcX5.js → entry-GDzXcBs1.js} +2 -3
  7. package/dist/browser/assets/{projection-entry-D67cdPsg.js → projection-entry-BJpyPvov.js} +7 -13
  8. package/dist/browser/{connection-DEe5aDuU.js → connection-BUum0hJI.js} +2 -2
  9. package/dist/browser/{connection-DEe5aDuU.js.map → connection-BUum0hJI.js.map} +1 -1
  10. package/dist/browser/connection-form-XKR4zQgQ.js +533 -0
  11. package/dist/browser/connection-form-XKR4zQgQ.js.map +1 -0
  12. package/dist/browser/data-tree-DKrDFeQg.js +1896 -0
  13. package/dist/browser/data-tree-DKrDFeQg.js.map +1 -0
  14. package/dist/browser/document-models/connection/index.js +2 -2
  15. package/dist/browser/document-models/index.js +3 -3
  16. package/dist/browser/document-models/workflow/index.js +2 -2
  17. package/dist/browser/{document-models-BYheX-te.js → document-models-C6ebrsd9.js} +3 -3
  18. package/dist/browser/{document-models-BYheX-te.js.map → document-models-C6ebrsd9.js.map} +1 -1
  19. package/dist/browser/{editor-D0sdUxJa.js → editor-BxtfhdPP.js} +3348 -1610
  20. package/dist/browser/editor-BxtfhdPP.js.map +1 -0
  21. package/dist/browser/editor-C_E_JTp6.js +257 -0
  22. package/dist/browser/editor-C_E_JTp6.js.map +1 -0
  23. package/dist/browser/editor-kbIdHU7F.js +1511 -0
  24. package/dist/browser/editor-kbIdHU7F.js.map +1 -0
  25. package/dist/browser/editors/connection-editor/module.js +1 -1
  26. package/dist/browser/editors/connection-editor/module.js.map +1 -1
  27. package/dist/browser/editors/workflow-editor/module.js +1 -1
  28. package/dist/browser/editors/workflow-editor/module.js.map +1 -1
  29. package/dist/browser/editors/workflow-studio/module.js +1 -1
  30. package/dist/browser/editors/workflow-studio/module.js.map +1 -1
  31. package/dist/browser/index.js +7 -5
  32. package/dist/browser/index.js.map +1 -1
  33. package/dist/browser/{module-CYQnNZWl.js → module-Bkms70LV.js} +3 -3
  34. package/dist/browser/{module-CYQnNZWl.js.map → module-Bkms70LV.js.map} +1 -1
  35. package/dist/{node/module-IA-Ay7ig.mjs → browser/module-jDZ4pq3W.js} +2 -2
  36. package/dist/browser/{module-12vI18HY.js.map → module-jDZ4pq3W.js.map} +1 -1
  37. package/dist/browser/piece-auth-Z4mZEOtL.js +113 -0
  38. package/dist/browser/piece-auth-Z4mZEOtL.js.map +1 -0
  39. package/dist/browser/reactor/index.js +2 -2
  40. package/dist/browser/{chunk-BoAXSpZd.js → rolldown-runtime-DC62tzP2.js} +2 -2
  41. package/dist/browser/{runtime-api-DKlnn45K.js → runtime-api-xwvg5PzA.js} +40 -123
  42. package/dist/browser/runtime-api-xwvg5PzA.js.map +1 -0
  43. package/dist/browser/style.css +26 -0
  44. package/dist/browser/trigger-text-CdNxQOHw.js +551 -0
  45. package/dist/browser/trigger-text-CdNxQOHw.js.map +1 -0
  46. package/dist/browser/upgrade-manifests-BLrv3cf2.js +8 -0
  47. package/dist/browser/{upgrade-manifests-Cnpfo6kC.js.map → upgrade-manifests-BLrv3cf2.js.map} +1 -1
  48. package/dist/browser/{workflow-CFZUezoY.js → workflow-CGtVlhr8.js} +2 -2
  49. package/dist/browser/{workflow-CFZUezoY.js.map → workflow-CGtVlhr8.js.map} +1 -1
  50. package/dist/node/BlockSelector-COZm6-ev.mjs +1355 -0
  51. package/dist/node/BlockSelector-COZm6-ev.mjs.map +1 -0
  52. package/dist/node/{PieceMarkdown-D9nI2gI2.mjs → PieceMarkdown-Ejo9UTqJ.mjs} +113 -81
  53. package/dist/node/PieceMarkdown-Ejo9UTqJ.mjs.map +1 -0
  54. package/dist/node/{connection-DGsS2Db3.mjs → connection-D544oqVW.mjs} +2 -2
  55. package/dist/node/{connection-DGsS2Db3.mjs.map → connection-D544oqVW.mjs.map} +1 -1
  56. package/dist/node/connection-form-BLduFusc.mjs +533 -0
  57. package/dist/node/connection-form-BLduFusc.mjs.map +1 -0
  58. package/dist/node/data-tree-CmiGqG7C.mjs +1903 -0
  59. package/dist/node/data-tree-CmiGqG7C.mjs.map +1 -0
  60. package/dist/node/document-models/connection/index.mjs +2 -2
  61. package/dist/node/document-models/index.mjs +3 -3
  62. package/dist/node/document-models/workflow/index.mjs +2 -2
  63. package/dist/node/editor-BNgGzvAL.mjs +1511 -0
  64. package/dist/node/editor-BNgGzvAL.mjs.map +1 -0
  65. package/dist/node/{editor-sVzt1o51.mjs → editor-CLDjPgdl.mjs} +3200 -1508
  66. package/dist/node/editor-CLDjPgdl.mjs.map +1 -0
  67. package/dist/node/editor-CN4PEGrW.mjs +257 -0
  68. package/dist/node/editor-CN4PEGrW.mjs.map +1 -0
  69. package/dist/node/editors/connection-editor/module.mjs +1 -1
  70. package/dist/node/editors/connection-editor/module.mjs.map +1 -1
  71. package/dist/node/editors/workflow-editor/module.mjs +1 -1
  72. package/dist/node/editors/workflow-editor/module.mjs.map +1 -1
  73. package/dist/node/editors/workflow-studio/module.mjs +1 -1
  74. package/dist/node/editors/workflow-studio/module.mjs.map +1 -1
  75. package/dist/node/index.mjs +8 -6
  76. package/dist/node/index.mjs.map +1 -1
  77. package/dist/{browser/module-12vI18HY.js → node/module-BMwJQh65.mjs} +2 -2
  78. package/dist/node/{module-IA-Ay7ig.mjs.map → module-BMwJQh65.mjs.map} +1 -1
  79. package/dist/node/{module-IRMgzJC1.mjs → module-DuxxhgKs.mjs} +3 -3
  80. package/dist/node/{module-IRMgzJC1.mjs.map → module-DuxxhgKs.mjs.map} +1 -1
  81. package/dist/node/piece-auth-Z4mZEOtL.mjs +113 -0
  82. package/dist/node/piece-auth-Z4mZEOtL.mjs.map +1 -0
  83. package/dist/node/pieces/index.mjs.map +1 -1
  84. package/dist/node/pieces/reactor/index.mjs +226 -488
  85. package/dist/node/pieces/reactor/index.mjs.map +1 -1
  86. package/dist/node/{chunk-BSw8zbkd.mjs → rolldown-runtime-BMI-E3GI.mjs} +11 -4
  87. package/dist/node/{runtime-api-CtvvFHut.mjs → runtime-api-xwvg5PzA.mjs} +40 -123
  88. package/dist/node/runtime-api-xwvg5PzA.mjs.map +1 -0
  89. package/dist/node/style.css +26 -0
  90. package/dist/node/trigger-text-qj_U3Qzd.mjs +551 -0
  91. package/dist/node/trigger-text-qj_U3Qzd.mjs.map +1 -0
  92. package/dist/node/upgrade-manifests-C1sl_M-H.mjs +8 -0
  93. package/dist/node/{upgrade-manifests-3VN0Bfcf.mjs.map → upgrade-manifests-C1sl_M-H.mjs.map} +1 -1
  94. package/dist/node/{workflow-fFvyypuu.mjs → workflow-C-uuQPnf.mjs} +2 -2
  95. package/dist/node/{workflow-fFvyypuu.mjs.map → workflow-C-uuQPnf.mjs.map} +1 -1
  96. package/dist/style.css +927 -252
  97. package/dist/types/document-models/connection/upgrades/versions.d.ts.map +1 -1
  98. package/dist/types/document-models/connection/v1/actions.d.ts +6 -10
  99. package/dist/types/document-models/connection/v1/actions.d.ts.map +1 -1
  100. package/dist/types/document-models/connection/v1/gen/config/creators.d.ts.map +1 -1
  101. package/dist/types/document-models/connection/v1/gen/config/error.d.ts.map +1 -1
  102. package/dist/types/document-models/connection/v1/gen/connection/creators.d.ts.map +1 -1
  103. package/dist/types/document-models/connection/v1/gen/health/creators.d.ts.map +1 -1
  104. package/dist/types/document-models/connection/v1/gen/schema/zod.d.ts.map +1 -1
  105. package/dist/types/document-models/connection/v1/module.d.ts +6 -10
  106. package/dist/types/document-models/connection/v1/module.d.ts.map +1 -1
  107. package/dist/types/document-models/connection/v1/tests/document-model.test.d.ts +0 -8
  108. package/dist/types/document-models/connection/v1/tests/document-model.test.d.ts.map +1 -1
  109. package/dist/types/document-models/document-models.d.ts +15 -23
  110. package/dist/types/document-models/document-models.d.ts.map +1 -1
  111. package/dist/types/document-models/workflow/upgrades/versions.d.ts.map +1 -1
  112. package/dist/types/document-models/workflow/v1/actions.d.ts +9 -13
  113. package/dist/types/document-models/workflow/v1/actions.d.ts.map +1 -1
  114. package/dist/types/document-models/workflow/v1/gen/edges/creators.d.ts.map +1 -1
  115. package/dist/types/document-models/workflow/v1/gen/edges/error.d.ts.map +1 -1
  116. package/dist/types/document-models/workflow/v1/gen/policy/creators.d.ts.map +1 -1
  117. package/dist/types/document-models/workflow/v1/gen/runtime/creators.d.ts.map +1 -1
  118. package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts.map +1 -1
  119. package/dist/types/document-models/workflow/v1/gen/steps/creators.d.ts.map +1 -1
  120. package/dist/types/document-models/workflow/v1/gen/steps/error.d.ts.map +1 -1
  121. package/dist/types/document-models/workflow/v1/gen/trigger/creators.d.ts.map +1 -1
  122. package/dist/types/document-models/workflow/v1/gen/trigger/error.d.ts.map +1 -1
  123. package/dist/types/document-models/workflow/v1/gen/variables/creators.d.ts.map +1 -1
  124. package/dist/types/document-models/workflow/v1/gen/variables/error.d.ts.map +1 -1
  125. package/dist/types/document-models/workflow/v1/gen/workflow/creators.d.ts.map +1 -1
  126. package/dist/types/document-models/workflow/v1/module.d.ts +9 -13
  127. package/dist/types/document-models/workflow/v1/module.d.ts.map +1 -1
  128. package/dist/types/document-models/workflow/v1/tests/document-model.test.d.ts +0 -8
  129. package/dist/types/document-models/workflow/v1/tests/document-model.test.d.ts.map +1 -1
  130. package/dist/types/editors/connection-editor/ConnectionToolbar.d.ts +2 -0
  131. package/dist/types/editors/connection-editor/ConnectionToolbar.d.ts.map +1 -1
  132. package/dist/types/editors/connection-editor/UsedBy.d.ts +6 -0
  133. package/dist/types/editors/connection-editor/UsedBy.d.ts.map +1 -0
  134. package/dist/types/editors/connection-editor/connection-callbacks.d.ts.map +1 -1
  135. package/dist/types/editors/connection-editor/connection-callbacks.test.d.ts +2 -0
  136. package/dist/types/editors/connection-editor/connection-callbacks.test.d.ts.map +1 -0
  137. package/dist/types/editors/connection-editor/connection-form.d.ts +5 -1
  138. package/dist/types/editors/connection-editor/connection-form.d.ts.map +1 -1
  139. package/dist/types/editors/connection-editor/connection-usage.d.ts.map +1 -0
  140. package/dist/types/editors/connection-editor/connection-usage.test.d.ts.map +1 -0
  141. package/dist/types/editors/connection-editor/editor.d.ts.map +1 -1
  142. package/dist/types/editors/connection-editor/piece-auth.d.ts +2 -0
  143. package/dist/types/editors/connection-editor/piece-auth.d.ts.map +1 -1
  144. package/dist/types/editors/connection-editor/status.d.ts +3 -1
  145. package/dist/types/editors/connection-editor/status.d.ts.map +1 -1
  146. package/dist/types/editors/shared/DocumentErrorBoundary.d.ts.map +1 -1
  147. package/dist/types/editors/shared/controls.d.ts +98 -0
  148. package/dist/types/editors/shared/controls.d.ts.map +1 -0
  149. package/dist/types/editors/shared/data-tree.d.ts +5 -0
  150. package/dist/types/editors/shared/data-tree.d.ts.map +1 -0
  151. package/dist/types/editors/shared/data-viewer.d.ts +7 -0
  152. package/dist/types/editors/shared/data-viewer.d.ts.map +1 -0
  153. package/dist/types/editors/shared/editor-chrome.d.ts +7 -0
  154. package/dist/types/editors/shared/editor-chrome.d.ts.map +1 -0
  155. package/dist/types/editors/shared/icons.d.ts +36 -0
  156. package/dist/types/editors/shared/icons.d.ts.map +1 -0
  157. package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -1
  158. package/dist/types/editors/workflow-editor/runtime-api.d.ts +2 -0
  159. package/dist/types/editors/workflow-editor/runtime-api.d.ts.map +1 -1
  160. package/dist/types/editors/workflow-editor/ui/ActionListEditor.d.ts.map +1 -1
  161. package/dist/types/editors/workflow-editor/ui/Autocomplete.d.ts +1 -0
  162. package/dist/types/editors/workflow-editor/ui/Autocomplete.d.ts.map +1 -1
  163. package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts +1 -0
  164. package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts.map +1 -1
  165. package/dist/types/editors/workflow-editor/ui/ConnectionField.d.ts.map +1 -1
  166. package/dist/types/editors/workflow-editor/ui/CreateConnectionModal.d.ts +1 -1
  167. package/dist/types/editors/workflow-editor/ui/CreateConnectionModal.d.ts.map +1 -1
  168. package/dist/types/editors/workflow-editor/ui/ExpressionPicker.d.ts.map +1 -1
  169. package/dist/types/editors/workflow-editor/ui/PieceMarkdown.d.ts.map +1 -1
  170. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
  171. package/dist/types/editors/workflow-editor/ui/ScheduleBuilder.d.ts +5 -0
  172. package/dist/types/editors/workflow-editor/ui/ScheduleBuilder.d.ts.map +1 -0
  173. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts +1 -0
  174. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
  175. package/dist/types/editors/workflow-editor/ui/WorkflowCanvas.d.ts.map +1 -1
  176. package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts +3 -0
  177. package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts.map +1 -1
  178. package/dist/types/editors/workflow-editor/ui/ap-edge.d.ts.map +1 -1
  179. package/dist/types/editors/workflow-editor/ui/ap-layout.d.ts +1 -0
  180. package/dist/types/editors/workflow-editor/ui/ap-layout.d.ts.map +1 -1
  181. package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts.map +1 -1
  182. package/dist/types/editors/workflow-editor/ui/block-meta.d.ts +6 -0
  183. package/dist/types/editors/workflow-editor/ui/block-meta.d.ts.map +1 -1
  184. package/dist/types/editors/workflow-editor/ui/connection-create.d.ts +1 -1
  185. package/dist/types/editors/workflow-editor/ui/connection-create.d.ts.map +1 -1
  186. package/dist/types/editors/workflow-editor/ui/forms.d.ts +14 -0
  187. package/dist/types/editors/workflow-editor/ui/forms.d.ts.map +1 -1
  188. package/dist/types/editors/workflow-editor/ui/model.test.d.ts +2 -0
  189. package/dist/types/editors/workflow-editor/ui/model.test.d.ts.map +1 -0
  190. package/dist/types/editors/workflow-editor/ui/schedule-draft.d.ts +35 -0
  191. package/dist/types/editors/workflow-editor/ui/schedule-draft.d.ts.map +1 -0
  192. package/dist/types/editors/workflow-editor/ui/schedule-draft.test.d.ts +2 -0
  193. package/dist/types/editors/workflow-editor/ui/schedule-draft.test.d.ts.map +1 -0
  194. package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts +9 -0
  195. package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts.map +1 -0
  196. package/dist/types/editors/workflow-editor/ui/trigger-text.test.d.ts +2 -0
  197. package/dist/types/editors/workflow-editor/ui/trigger-text.test.d.ts.map +1 -0
  198. package/dist/types/editors/workflow-editor/ui/validation.d.ts.map +1 -1
  199. package/dist/types/editors/workflow-studio/components/RunsTable.d.ts +2 -0
  200. package/dist/types/editors/workflow-studio/components/RunsTable.d.ts.map +1 -1
  201. package/dist/types/editors/workflow-studio/components/RunsView.d.ts.map +1 -1
  202. package/dist/types/editors/workflow-studio/components/Sidebar.d.ts +1 -1
  203. package/dist/types/editors/workflow-studio/components/Sidebar.d.ts.map +1 -1
  204. package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts +8 -0
  205. package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts.map +1 -0
  206. package/dist/types/editors/workflow-studio/components/WorkflowHeader.d.ts.map +1 -1
  207. package/dist/types/editors/workflow-studio/components/WorkflowSteps.d.ts.map +1 -1
  208. package/dist/types/editors/workflow-studio/components/WorkflowStudio.d.ts.map +1 -1
  209. package/dist/types/editors/workflow-studio/components/chain.d.ts +18 -0
  210. package/dist/types/editors/workflow-studio/components/chain.d.ts.map +1 -0
  211. package/dist/types/editors/workflow-studio/components/run-format.d.ts +29 -6
  212. package/dist/types/editors/workflow-studio/components/run-format.d.ts.map +1 -1
  213. package/dist/types/editors/workflow-studio/components/run-format.test.d.ts +2 -0
  214. package/dist/types/editors/workflow-studio/components/run-format.test.d.ts.map +1 -0
  215. package/dist/types/editors/workflow-studio/components/run-timeline.test.d.ts +2 -0
  216. package/dist/types/editors/workflow-studio/components/run-timeline.test.d.ts.map +1 -0
  217. package/dist/types/editors/workflow-studio/components/ui.d.ts +20 -0
  218. package/dist/types/editors/workflow-studio/components/ui.d.ts.map +1 -0
  219. package/dist/types/editors/workflow-studio/components/useRuns.d.ts +1 -1
  220. package/dist/types/editors/workflow-studio/components/useRuns.d.ts.map +1 -1
  221. package/dist/types/pieces/index.d.ts.map +1 -1
  222. package/dist/types/pieces/reactor/index.d.ts.map +1 -1
  223. package/dist/types/pieces/reactor/lib/reactor.d.ts.map +1 -1
  224. package/dist/types/pieces/reactor/lib/triggers/document-event.d.ts +12 -12
  225. package/dist/types/playwright.config.d.ts +3 -0
  226. package/dist/types/playwright.config.d.ts.map +1 -0
  227. package/dist/types/scripts/ui-shots.d.ts +2 -0
  228. package/dist/types/scripts/ui-shots.d.ts.map +1 -0
  229. package/dist/types/scripts/ui-stack.d.ts +77 -0
  230. package/dist/types/scripts/ui-stack.d.ts.map +1 -0
  231. package/dist/types/test/ui/connection-editor.spec.d.ts +2 -0
  232. package/dist/types/test/ui/connection-editor.spec.d.ts.map +1 -0
  233. package/dist/types/test/ui/data-viewer.spec.d.ts +2 -0
  234. package/dist/types/test/ui/data-viewer.spec.d.ts.map +1 -0
  235. package/dist/types/test/ui/fixtures.d.ts +9 -0
  236. package/dist/types/test/ui/fixtures.d.ts.map +1 -0
  237. package/dist/types/test/ui/global-setup.d.ts +2 -0
  238. package/dist/types/test/ui/global-setup.d.ts.map +1 -0
  239. package/dist/types/test/ui/pieces.spec.d.ts +2 -0
  240. package/dist/types/test/ui/pieces.spec.d.ts.map +1 -0
  241. package/dist/types/test/ui/step-panel.spec.d.ts +2 -0
  242. package/dist/types/test/ui/step-panel.spec.d.ts.map +1 -0
  243. package/dist/types/test/ui/studio.spec.d.ts +2 -0
  244. package/dist/types/test/ui/studio.spec.d.ts.map +1 -0
  245. package/dist/types/vitest.config.d.ts.map +1 -1
  246. package/package.json +17 -11
  247. package/dist/browser/PieceMarkdown-CZYNY1qQ.js.map +0 -1
  248. package/dist/browser/ap-layout-BpKqIHQt.js +0 -337
  249. package/dist/browser/ap-layout-BpKqIHQt.js.map +0 -1
  250. package/dist/browser/connection-form-B1SkwNgY.js +0 -453
  251. package/dist/browser/connection-form-B1SkwNgY.js.map +0 -1
  252. package/dist/browser/editor-CCKpl-Gd.js +0 -1550
  253. package/dist/browser/editor-CCKpl-Gd.js.map +0 -1
  254. package/dist/browser/editor-CIZRPdKM.js +0 -134
  255. package/dist/browser/editor-CIZRPdKM.js.map +0 -1
  256. package/dist/browser/editor-D0sdUxJa.js.map +0 -1
  257. package/dist/browser/runtime-api-DKlnn45K.js.map +0 -1
  258. package/dist/browser/status-kpDX5CIA.js +0 -11
  259. package/dist/browser/status-kpDX5CIA.js.map +0 -1
  260. package/dist/browser/upgrade-manifests-Cnpfo6kC.js +0 -8
  261. package/dist/browser/use-runtime-url-By5q3sa_.js +0 -174
  262. package/dist/browser/use-runtime-url-By5q3sa_.js.map +0 -1
  263. package/dist/node/PieceMarkdown-D9nI2gI2.mjs.map +0 -1
  264. package/dist/node/ap-layout-Dzhi9JFC.mjs +0 -337
  265. package/dist/node/ap-layout-Dzhi9JFC.mjs.map +0 -1
  266. package/dist/node/connection-form-DejaNF09.mjs +0 -453
  267. package/dist/node/connection-form-DejaNF09.mjs.map +0 -1
  268. package/dist/node/editor-DfFRZS9L.mjs +0 -134
  269. package/dist/node/editor-DfFRZS9L.mjs.map +0 -1
  270. package/dist/node/editor-NbAB78He.mjs +0 -1550
  271. package/dist/node/editor-NbAB78He.mjs.map +0 -1
  272. package/dist/node/editor-sVzt1o51.mjs.map +0 -1
  273. package/dist/node/runtime-api-CtvvFHut.mjs.map +0 -1
  274. package/dist/node/status-CDRcDUMS.mjs +0 -11
  275. package/dist/node/status-CDRcDUMS.mjs.map +0 -1
  276. package/dist/node/upgrade-manifests-3VN0Bfcf.mjs +0 -8
  277. package/dist/node/use-runtime-url-BbFEkaZy.mjs +0 -174
  278. package/dist/node/use-runtime-url-BbFEkaZy.mjs.map +0 -1
  279. package/dist/types/document-models/connection/v1/tests/config.test.d.ts +0 -2
  280. package/dist/types/document-models/connection/v1/tests/config.test.d.ts.map +0 -1
  281. package/dist/types/document-models/connection/v1/tests/connection.test.d.ts +0 -2
  282. package/dist/types/document-models/connection/v1/tests/connection.test.d.ts.map +0 -1
  283. package/dist/types/document-models/connection/v1/tests/health.test.d.ts +0 -2
  284. package/dist/types/document-models/connection/v1/tests/health.test.d.ts.map +0 -1
  285. package/dist/types/document-models/workflow/v1/tests/edges.test.d.ts +0 -2
  286. package/dist/types/document-models/workflow/v1/tests/edges.test.d.ts.map +0 -1
  287. package/dist/types/document-models/workflow/v1/tests/policy.test.d.ts +0 -2
  288. package/dist/types/document-models/workflow/v1/tests/policy.test.d.ts.map +0 -1
  289. package/dist/types/document-models/workflow/v1/tests/runtime.test.d.ts +0 -2
  290. package/dist/types/document-models/workflow/v1/tests/runtime.test.d.ts.map +0 -1
  291. package/dist/types/document-models/workflow/v1/tests/steps.test.d.ts +0 -2
  292. package/dist/types/document-models/workflow/v1/tests/steps.test.d.ts.map +0 -1
  293. package/dist/types/document-models/workflow/v1/tests/trigger.test.d.ts +0 -2
  294. package/dist/types/document-models/workflow/v1/tests/trigger.test.d.ts.map +0 -1
  295. package/dist/types/document-models/workflow/v1/tests/variables.test.d.ts +0 -2
  296. package/dist/types/document-models/workflow/v1/tests/variables.test.d.ts.map +0 -1
  297. package/dist/types/document-models/workflow/v1/tests/workflow.test.d.ts +0 -2
  298. package/dist/types/document-models/workflow/v1/tests/workflow.test.d.ts.map +0 -1
  299. package/dist/types/editors/workflow-studio/components/ConnectionView.d.ts +0 -7
  300. package/dist/types/editors/workflow-studio/components/ConnectionView.d.ts.map +0 -1
  301. package/dist/types/editors/workflow-studio/components/EditorToolbar.d.ts +0 -8
  302. package/dist/types/editors/workflow-studio/components/EditorToolbar.d.ts.map +0 -1
  303. package/dist/types/editors/workflow-studio/components/connection-usage.d.ts.map +0 -1
  304. package/dist/types/editors/workflow-studio/components/connection-usage.test.d.ts.map +0 -1
  305. /package/dist/types/editors/{workflow-studio/components → connection-editor}/connection-usage.d.ts +0 -0
  306. /package/dist/types/editors/{workflow-studio/components → connection-editor}/connection-usage.test.d.ts +0 -0
@@ -0,0 +1,1511 @@
1
+ import { f as fireWorkflow, g as rerunRun, l as fetchRuns } from "./runtime-api-xwvg5PzA.js";
2
+ import { y as actions } from "./module-Bkms70LV.js";
3
+ import { r as useWorkflowDocumentsInSelectedDrive } from "./workflow-CGtVlhr8.js";
4
+ import { C as runStats, D as workflowHealth, E as toneOf, F as Select, H as DocumentErrorBoundary, O as useSyncWorkflowRuntimeUrl, S as formatWhen, T as statusLabel, U as DocumentLoadError, V as Icon, W as errorMessage, _ as durationMs, b as formatMs, d as RUN_TONE, f as STEP_TONE, g as WORKFLOW_TONE, h as TONE_TEXT, k as Button, l as CONNECTION_TONE, m as TONE_DOT, p as TONE_BADGE, r as blockMeta, s as usePieceLogos, t as BlockLogo, u as RUN_STATUSES, v as formatAbsolute, w as runTimeline, x as formatTrigger, y as formatDuration } from "./BlockSelector-QQgOCVH3.js";
5
+ import { c as DataViewer, p as portRank, r as describeTrigger } from "./trigger-text-CdNxQOHw.js";
6
+ import { addDocument, setSelectedNode, showDeleteNodeModal, useDispatch, useDocumentSafe, useFileNodesInSelectedDrive, usePHToast, useSelectedDrive, useSelectedNode, useSetPHAppConfig } from "@powerhousedao/reactor-browser";
7
+ import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from "react";
8
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
+ //#region editors/workflow-studio/components/chain.tsx
10
+ const RING$1 = {
11
+ ok: "ring-wf-ok",
12
+ fail: "ring-wf-fail",
13
+ warn: "ring-wf-warn",
14
+ run: "ring-wf-run",
15
+ idle: "ring-foreground/15"
16
+ };
17
+ const RAIL$1 = {
18
+ ok: "bg-wf-ok",
19
+ fail: "bg-wf-fail",
20
+ warn: "bg-wf-warn",
21
+ run: "bg-wf-run",
22
+ idle: "bg-foreground/15"
23
+ };
24
+ function MiniChain(props) {
25
+ const md = props.size === "md";
26
+ const tones = props.links.map((link) => link.status ? toneOf(STEP_TONE, link.status) : "idle");
27
+ return /* @__PURE__ */ jsx("ol", {
28
+ className: "flex items-center",
29
+ "aria-label": props.links.map((link) => `${link.label}${link.status ? `: ${link.status.toLowerCase()}` : ""}`).join(", "),
30
+ children: props.links.map((link, index) => /* @__PURE__ */ jsxs("li", {
31
+ className: "flex items-center",
32
+ children: [index > 0 ? /* @__PURE__ */ jsx("span", {
33
+ "aria-hidden": true,
34
+ className: `h-0.5 ${md ? "w-5" : "w-3"} ${RAIL$1[tones[index]]}`
35
+ }) : null, /* @__PURE__ */ jsx("span", {
36
+ title: link.status ? `${link.label}: ${link.status.toLowerCase()}` : link.label,
37
+ className: `flex shrink-0 items-center justify-center rounded-full bg-card ring-[1.5px] dark:bg-white ${md ? "h-8 w-8" : "h-6 w-6"} ${RING$1[tones[index]]} ${link.status === "SKIPPED" ? "opacity-50" : ""}`,
38
+ children: /* @__PURE__ */ jsx(BlockLogo, {
39
+ bare: true,
40
+ blockType: link.blockType,
41
+ size: md ? 16 : 14
42
+ })
43
+ })]
44
+ }, link.id))
45
+ });
46
+ }
47
+ /** A run's own chain: the trigger, then every step it recorded. */
48
+ function runLinks(run, triggerBlockType) {
49
+ return [{
50
+ id: "trigger",
51
+ blockType: triggerBlockType ?? `core#${run.triggerKind}`,
52
+ label: "Trigger",
53
+ status: "SUCCEEDED"
54
+ }, ...run.steps.map((step) => ({
55
+ id: step.stepId + step.stepKey,
56
+ blockType: step.blockType,
57
+ label: step.stepKey,
58
+ status: step.status
59
+ }))];
60
+ }
61
+ const STRIP_LENGTH = 14;
62
+ const TICK = {
63
+ ok: "bg-wf-ok",
64
+ fail: "bg-wf-fail",
65
+ warn: "bg-wf-warn",
66
+ run: "bg-wf-run animate-pulse",
67
+ idle: "bg-foreground/25"
68
+ };
69
+ /** Recent runs as ticks, oldest to newest, padded so strips line up. */
70
+ function RunStrip(props) {
71
+ const recent = props.runs.slice(0, STRIP_LENGTH).reverse();
72
+ const padding = STRIP_LENGTH - recent.length;
73
+ return /* @__PURE__ */ jsxs("span", {
74
+ className: "flex h-5 items-end gap-[3px]",
75
+ "aria-label": recent.length === 0 ? "No runs yet" : `Last ${recent.length} runs: ${recent.map((run) => run.status.toLowerCase()).join(", ")}`,
76
+ children: [Array.from({ length: padding }, (_, index) => /* @__PURE__ */ jsx("span", {
77
+ "aria-hidden": true,
78
+ className: "h-1.5 w-1.5 rounded-full bg-foreground/10"
79
+ }, `pad-${index}`)), recent.map((run) => /* @__PURE__ */ jsx("span", {
80
+ "aria-hidden": true,
81
+ title: `${statusLabel(run.status)}, ${formatAbsolute(run.startedAt)}`,
82
+ className: `h-5 w-1.5 rounded-full ${TICK[toneOf(RUN_TONE, run.status)]}`
83
+ }, run.id))]
84
+ });
85
+ }
86
+ //#endregion
87
+ //#region editors/workflow-studio/components/ui.tsx
88
+ function StatusDot(props) {
89
+ const hollow = props.tone === "idle";
90
+ return /* @__PURE__ */ jsx("span", {
91
+ "aria-hidden": true,
92
+ className: `inline-block h-2 w-2 shrink-0 rounded-full ${hollow ? "border border-solid border-muted-foreground/60" : TONE_DOT[props.tone]} ${props.className ?? ""}`
93
+ });
94
+ }
95
+ function StatusText(props) {
96
+ return /* @__PURE__ */ jsxs("span", {
97
+ className: `inline-flex items-center gap-1.5 font-medium ${TONE_TEXT[props.tone]} ${props.className ?? ""}`,
98
+ children: [/* @__PURE__ */ jsx(StatusDot, { tone: props.tone }), statusLabel(props.status)]
99
+ });
100
+ }
101
+ /** A label/value pair for a header's facts line. */
102
+ function Fact(props) {
103
+ return /* @__PURE__ */ jsxs("div", {
104
+ className: "flex min-w-0 flex-col gap-0.5",
105
+ title: props.title,
106
+ children: [/* @__PURE__ */ jsx("dt", {
107
+ className: "text-xs text-muted-foreground",
108
+ children: props.label
109
+ }), /* @__PURE__ */ jsx("dd", {
110
+ className: "truncate text-[13px] tabular-nums text-foreground",
111
+ children: props.children
112
+ })]
113
+ });
114
+ }
115
+ //#endregion
116
+ //#region editors/workflow-studio/components/RunsTable.tsx
117
+ const CONTROL = "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";
118
+ function stringify(value) {
119
+ if (value === void 0) return "";
120
+ try {
121
+ return JSON.stringify(value, null, 2);
122
+ } catch {
123
+ return String(value);
124
+ }
125
+ }
126
+ function TimelineBar(props) {
127
+ return /* @__PURE__ */ jsxs("span", {
128
+ className: "ml-auto flex shrink-0 items-center gap-2",
129
+ children: [/* @__PURE__ */ jsx("span", {
130
+ "aria-hidden": true,
131
+ className: "relative hidden h-1.5 w-40 overflow-hidden rounded-full bg-muted sm:block",
132
+ children: props.span ? /* @__PURE__ */ jsx("span", {
133
+ className: `absolute inset-y-0 rounded-full ${TONE_DOT[props.tone]}`,
134
+ style: {
135
+ left: `${props.span.offset * 100}%`,
136
+ width: `max(${props.span.width * 100}%, 4px)`
137
+ }
138
+ }) : null
139
+ }), /* @__PURE__ */ jsx("span", {
140
+ className: "w-14 text-right text-[11px] tabular-nums text-muted-foreground",
141
+ children: props.span ? formatMs(props.span.ms) : "–"
142
+ })]
143
+ });
144
+ }
145
+ function StepRow(props) {
146
+ const { step } = props;
147
+ const meta = blockMeta(step.blockType);
148
+ const [open, setOpen] = useState(false);
149
+ return /* @__PURE__ */ jsxs("div", {
150
+ role: "listitem",
151
+ className: "border-t border-solid border-border",
152
+ children: [/* @__PURE__ */ jsxs("button", {
153
+ type: "button",
154
+ "aria-expanded": open,
155
+ 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",
156
+ onClick: () => setOpen((value) => !value),
157
+ children: [
158
+ /* @__PURE__ */ jsx(Icon, {
159
+ name: "chevron",
160
+ className: `h-3.5 w-3.5 text-muted-foreground transition-transform ${open ? "rotate-90" : ""}`
161
+ }),
162
+ /* @__PURE__ */ jsx(StatusText, {
163
+ tone: toneOf(STEP_TONE, step.status),
164
+ status: step.status,
165
+ className: "w-24 shrink-0 text-xs"
166
+ }),
167
+ /* @__PURE__ */ jsx("span", {
168
+ className: "shrink-0 font-medium text-foreground",
169
+ title: `Key: ${step.stepKey}`,
170
+ children: props.name ?? step.stepKey
171
+ }),
172
+ /* @__PURE__ */ jsxs("span", {
173
+ className: "flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",
174
+ children: [meta.logoUrl ? /* @__PURE__ */ jsx("img", {
175
+ src: meta.logoUrl,
176
+ alt: "",
177
+ title: meta.subtitle,
178
+ className: "h-3.5 w-3.5"
179
+ }) : null, /* @__PURE__ */ jsx("span", {
180
+ className: "truncate",
181
+ children: meta.logoUrl ? meta.displayName : `${meta.subtitle}: ${meta.displayName}`
182
+ })]
183
+ }),
184
+ step.port && step.port !== "next" ? /* @__PURE__ */ jsxs("span", {
185
+ className: "shrink-0 rounded bg-muted px-1.5 text-[11px] text-muted-foreground",
186
+ children: ["took ", step.port]
187
+ }) : null,
188
+ /* @__PURE__ */ jsx(TimelineBar, {
189
+ span: props.span,
190
+ tone: toneOf(STEP_TONE, step.status)
191
+ })
192
+ ]
193
+ }), open ? /* @__PURE__ */ jsxs("div", {
194
+ className: "space-y-2 pb-3 pl-10 pr-3",
195
+ children: [step.error ? /* @__PURE__ */ jsx("pre", {
196
+ className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-wf-fail/10 p-2 text-xs text-wf-fail",
197
+ children: step.error
198
+ }) : null, step.status === "SKIPPED" ? /* @__PURE__ */ jsx("p", {
199
+ className: "text-xs text-muted-foreground",
200
+ children: "The run never reached this step."
201
+ }) : /* @__PURE__ */ jsxs("div", {
202
+ className: "grid items-start gap-2 md:grid-cols-2",
203
+ children: [/* @__PURE__ */ jsx(DataViewer, {
204
+ label: "Received",
205
+ value: step.input
206
+ }), /* @__PURE__ */ jsx(DataViewer, {
207
+ label: "Produced",
208
+ value: step.output,
209
+ root: `steps.${step.stepKey}.output`,
210
+ emptyText: step.status === "FAILED" ? "Nothing, the step failed" : void 0
211
+ })]
212
+ })]
213
+ }) : null]
214
+ });
215
+ }
216
+ const TRIGGER_LABEL = {
217
+ manual: "Manual",
218
+ schedule: "Schedule",
219
+ webhook: "Webhook",
220
+ "document-event": "Document change",
221
+ piece: "Piece trigger",
222
+ rerun: "Rerun"
223
+ };
224
+ function triggerLabel(kind) {
225
+ return TRIGGER_LABEL[kind] ?? formatTrigger(kind);
226
+ }
227
+ function describeRunError(error, names) {
228
+ return error.replace(/^Step "([^"]+)" failed: /, (whole, key) => {
229
+ const name = names.get(key);
230
+ return name ? `${name} failed: ` : whole;
231
+ });
232
+ }
233
+ function TriggerRow(props) {
234
+ const { run } = props;
235
+ const [open, setOpen] = useState(false);
236
+ const payload = stringify(run.triggerPayload);
237
+ const hasPayload = payload !== "" && payload !== "null" && payload !== "{}";
238
+ return /* @__PURE__ */ jsxs("div", {
239
+ role: "listitem",
240
+ children: [/* @__PURE__ */ jsxs("button", {
241
+ type: "button",
242
+ "aria-expanded": hasPayload ? open : void 0,
243
+ disabled: !hasPayload,
244
+ 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",
245
+ onClick: () => setOpen((value) => !value),
246
+ children: [
247
+ /* @__PURE__ */ jsx(Icon, {
248
+ name: "chevron",
249
+ className: `h-3.5 w-3.5 text-muted-foreground transition-transform ${open ? "rotate-90" : ""} ${hasPayload ? "" : "invisible"}`
250
+ }),
251
+ /* @__PURE__ */ jsx(StatusText, {
252
+ tone: "ok",
253
+ status: "FIRED",
254
+ className: "w-24 shrink-0 text-xs"
255
+ }),
256
+ /* @__PURE__ */ jsx("span", {
257
+ className: "shrink-0 font-medium text-foreground",
258
+ children: "Trigger"
259
+ }),
260
+ /* @__PURE__ */ jsx("span", {
261
+ className: "truncate text-xs text-muted-foreground",
262
+ children: triggerLabel(run.triggerKind)
263
+ }),
264
+ !hasPayload ? /* @__PURE__ */ jsx("span", {
265
+ className: "shrink-0 text-[11px] text-muted-foreground",
266
+ children: "No payload"
267
+ }) : null,
268
+ /* @__PURE__ */ jsxs("span", {
269
+ className: "ml-auto flex shrink-0 items-center gap-2",
270
+ children: [/* @__PURE__ */ jsx("span", {
271
+ "aria-hidden": true,
272
+ className: "relative hidden h-1.5 w-40 sm:block",
273
+ children: /* @__PURE__ */ jsx("span", { className: "absolute inset-y-0 left-0 w-1 rounded-full bg-wf-ok" })
274
+ }), /* @__PURE__ */ jsx("span", {
275
+ className: "w-14 text-right text-[11px] tabular-nums text-muted-foreground",
276
+ children: new Date(run.startedAt).toLocaleTimeString([], {
277
+ hour: "2-digit",
278
+ minute: "2-digit",
279
+ second: "2-digit",
280
+ hour12: false
281
+ })
282
+ })]
283
+ })
284
+ ]
285
+ }), open ? /* @__PURE__ */ jsx("div", {
286
+ className: "pb-3 pl-10 pr-3",
287
+ children: /* @__PURE__ */ jsx(DataViewer, {
288
+ label: "Payload",
289
+ value: run.triggerPayload,
290
+ root: "trigger.payload"
291
+ })
292
+ }) : null]
293
+ });
294
+ }
295
+ function RunDetail(props) {
296
+ const { run, names } = props;
297
+ const timeline = runTimeline(run);
298
+ const [rerunning, setRerunning] = useState(false);
299
+ const [rerunError, setRerunError] = useState(null);
300
+ return /* @__PURE__ */ jsxs("div", {
301
+ className: "space-y-3 bg-muted/40 px-4 py-4",
302
+ children: [
303
+ run.error ? /* @__PURE__ */ jsx("p", {
304
+ className: "rounded-md bg-wf-fail/10 px-3 py-2 text-[13px] text-wf-fail",
305
+ children: describeRunError(run.error, names)
306
+ }) : null,
307
+ /* @__PURE__ */ jsxs("div", {
308
+ className: "flex flex-wrap items-center gap-x-5 gap-y-1 text-xs text-muted-foreground",
309
+ children: [
310
+ /* @__PURE__ */ jsxs("span", { children: ["Run ", /* @__PURE__ */ jsx("span", {
311
+ className: "font-mono",
312
+ children: run.id.slice(0, 8)
313
+ })] }),
314
+ /* @__PURE__ */ jsxs("span", { children: ["Started ", formatAbsolute(run.startedAt)] }),
315
+ run.rerunOf ? /* @__PURE__ */ jsxs("span", { children: ["Resumes ", /* @__PURE__ */ jsx("span", {
316
+ className: "font-mono",
317
+ children: run.rerunOf.slice(0, 8)
318
+ })] }) : null,
319
+ run.status === "FAILED" ? /* @__PURE__ */ jsxs(Button, {
320
+ className: "ml-auto",
321
+ disabled: rerunning,
322
+ onClick: () => {
323
+ setRerunning(true);
324
+ setRerunError(null);
325
+ rerunRun(run.id).then((result) => setRerunError(result.error)).catch((error) => setRerunError(error instanceof Error ? error.message : String(error))).finally(() => {
326
+ setRerunning(false);
327
+ props.onChanged();
328
+ });
329
+ },
330
+ children: [/* @__PURE__ */ jsx(Icon, {
331
+ name: "retry",
332
+ className: "h-3.5 w-3.5"
333
+ }), rerunning ? "Rerunning…" : "Rerun from failed step"]
334
+ }) : null,
335
+ rerunError ? /* @__PURE__ */ jsx("span", {
336
+ className: "text-wf-fail",
337
+ children: rerunError
338
+ }) : null
339
+ ]
340
+ }),
341
+ /* @__PURE__ */ jsxs("div", {
342
+ role: "list",
343
+ "aria-label": "Steps of this run",
344
+ className: "overflow-hidden rounded-md border border-solid border-border bg-card",
345
+ children: [
346
+ /* @__PURE__ */ jsx(TriggerRow, { run }),
347
+ run.steps.map((step) => /* @__PURE__ */ jsx(StepRow, {
348
+ step,
349
+ name: names.get(step.stepKey),
350
+ span: timeline.get(step.stepId)
351
+ }, step.stepId + step.stepKey)),
352
+ run.steps.length === 0 ? /* @__PURE__ */ jsx("p", {
353
+ className: "border-t border-solid border-border px-3 py-2 pl-10 text-xs text-muted-foreground",
354
+ children: "No steps ran."
355
+ }) : null
356
+ ]
357
+ })
358
+ ]
359
+ });
360
+ }
361
+ function SortHeader(props) {
362
+ return /* @__PURE__ */ jsx("th", {
363
+ scope: "col",
364
+ className: props.className,
365
+ children: /* @__PURE__ */ jsxs("button", {
366
+ type: "button",
367
+ className: `flex items-center gap-1 hover:text-foreground ${props.active ? "text-foreground" : ""}`,
368
+ onClick: props.onClick,
369
+ children: [props.label, /* @__PURE__ */ jsx("span", {
370
+ "aria-hidden": true,
371
+ className: props.active ? "" : "opacity-0",
372
+ children: props.descending ? "↓" : "↑"
373
+ })]
374
+ })
375
+ });
376
+ }
377
+ function RunsTable(props) {
378
+ const [query, setQuery] = useState("");
379
+ const [status, setStatus] = useState("ALL");
380
+ const [workflow, setWorkflow] = useState("ALL");
381
+ const [trigger, setTrigger] = useState("ALL");
382
+ const [sort, setSort] = useState("startedAt");
383
+ const [descending, setDescending] = useState(true);
384
+ const [expanded, setExpanded] = useState(null);
385
+ const documents = useWorkflowDocumentsInSelectedDrive() ?? [];
386
+ const triggerBlock = new Map(documents.map((document) => [document.header.id, document.state.global.trigger?.blockType]));
387
+ const stepNames = new Map(documents.map((document) => [document.header.id, new Map(document.state.global.steps.map((step) => [step.key, step.name || step.key]))]));
388
+ usePieceLogos();
389
+ const workflowOptions = useMemo(() => [...new Map(props.runs.map((run) => [run.workflowId, run.workflowName]))].map(([id, name]) => ({
390
+ id,
391
+ name
392
+ })).sort((a, b) => a.name.localeCompare(b.name)), [props.runs]);
393
+ const triggerOptions = useMemo(() => [...new Set(props.runs.map((run) => run.triggerKind))].sort(), [props.runs]);
394
+ const scoped = useMemo(() => {
395
+ const needle = query.trim().toLowerCase();
396
+ return props.runs.filter((run) => {
397
+ if (workflow !== "ALL" && run.workflowId !== workflow) return false;
398
+ if (trigger !== "ALL" && run.triggerKind !== trigger) return false;
399
+ if (!needle) return true;
400
+ return run.workflowName.toLowerCase().includes(needle) || run.id.toLowerCase().includes(needle) || (run.error?.toLowerCase().includes(needle) ?? false) || run.steps.some((step) => step.stepKey.toLowerCase().includes(needle));
401
+ });
402
+ }, [
403
+ props.runs,
404
+ query,
405
+ workflow,
406
+ trigger
407
+ ]);
408
+ const counts = useMemo(() => ({
409
+ ALL: scoped.length,
410
+ RUNNING: scoped.filter((run) => run.status === "RUNNING").length,
411
+ SUCCEEDED: scoped.filter((run) => run.status === "SUCCEEDED").length,
412
+ FAILED: scoped.filter((run) => run.status === "FAILED").length
413
+ }), [scoped]);
414
+ const visible = useMemo(() => {
415
+ const rows = scoped.filter((run) => status === "ALL" || run.status === status);
416
+ const direction = descending ? -1 : 1;
417
+ return [...rows].sort((a, b) => {
418
+ if (sort === "duration") return ((durationMs(a.startedAt, a.endedAt) ?? Infinity) - (durationMs(b.startedAt, b.endedAt) ?? Infinity)) * direction;
419
+ return (new Date(a.startedAt).getTime() - new Date(b.startedAt).getTime()) * direction;
420
+ });
421
+ }, [
422
+ scoped,
423
+ status,
424
+ sort,
425
+ descending
426
+ ]);
427
+ const filtered = query.trim() || workflow !== "ALL" || trigger !== "ALL";
428
+ const sortBy = (key) => {
429
+ if (key === sort) {
430
+ setDescending((value) => !value);
431
+ return;
432
+ }
433
+ setSort(key);
434
+ setDescending(true);
435
+ };
436
+ return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
437
+ className: "mb-3 flex flex-wrap items-center gap-2",
438
+ children: [
439
+ /* @__PURE__ */ jsx("div", {
440
+ className: "flex h-8 items-center gap-0.5 rounded-md bg-muted p-0.5",
441
+ children: ["ALL", ...RUN_STATUSES].map((option) => /* @__PURE__ */ jsxs("button", {
442
+ type: "button",
443
+ "aria-pressed": status === option,
444
+ className: `h-7 rounded px-2.5 text-[13px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${status === option ? "bg-card font-medium text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
445
+ onClick: () => setStatus(option),
446
+ children: [option === "ALL" ? "All" : statusLabel(option), /* @__PURE__ */ jsx("span", {
447
+ className: "ml-1.5 tabular-nums text-muted-foreground",
448
+ children: counts[option]
449
+ })]
450
+ }, option))
451
+ }),
452
+ /* @__PURE__ */ jsx("input", {
453
+ type: "search",
454
+ className: `${CONTROL} w-48`,
455
+ placeholder: "Search runs",
456
+ value: query,
457
+ onChange: (event) => setQuery(event.target.value)
458
+ }),
459
+ props.showWorkflow && workflowOptions.length > 1 ? /* @__PURE__ */ jsx("div", {
460
+ className: "w-44",
461
+ children: /* @__PURE__ */ jsx(Select, {
462
+ value: workflow,
463
+ options: [{
464
+ value: "ALL",
465
+ label: "Every workflow"
466
+ }, ...workflowOptions.map((option) => ({
467
+ value: option.id,
468
+ label: option.name
469
+ }))],
470
+ onChange: setWorkflow
471
+ })
472
+ }) : null,
473
+ triggerOptions.length > 1 ? /* @__PURE__ */ jsx("div", {
474
+ className: "w-40",
475
+ children: /* @__PURE__ */ jsx(Select, {
476
+ value: trigger,
477
+ options: [{
478
+ value: "ALL",
479
+ label: "Every trigger"
480
+ }, ...triggerOptions.map((option) => ({
481
+ value: option,
482
+ label: triggerLabel(option)
483
+ }))],
484
+ onChange: setTrigger
485
+ })
486
+ }) : null,
487
+ filtered ? /* @__PURE__ */ jsx("button", {
488
+ type: "button",
489
+ className: "text-[13px] text-muted-foreground underline underline-offset-2 hover:text-foreground",
490
+ onClick: () => {
491
+ setQuery("");
492
+ setWorkflow("ALL");
493
+ setTrigger("ALL");
494
+ },
495
+ children: "Clear filters"
496
+ }) : null,
497
+ /* @__PURE__ */ jsxs("span", {
498
+ className: "ml-auto text-xs tabular-nums text-muted-foreground",
499
+ children: [
500
+ visible.length,
501
+ " of ",
502
+ props.runs.length,
503
+ " runs"
504
+ ]
505
+ })
506
+ ]
507
+ }), /* @__PURE__ */ jsx("div", {
508
+ className: "overflow-x-auto rounded-lg border border-solid border-border bg-card",
509
+ children: /* @__PURE__ */ jsxs("table", {
510
+ className: "w-full border-collapse text-left",
511
+ children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", {
512
+ className: "border-b border-solid border-border text-xs font-medium text-muted-foreground",
513
+ children: [
514
+ /* @__PURE__ */ jsx("th", {
515
+ scope: "col",
516
+ className: "px-3 py-2.5 font-medium",
517
+ children: "Status"
518
+ }),
519
+ props.showWorkflow ? /* @__PURE__ */ jsx("th", {
520
+ scope: "col",
521
+ className: "px-3 py-2.5 font-medium",
522
+ children: "Workflow"
523
+ }) : null,
524
+ /* @__PURE__ */ jsx("th", {
525
+ scope: "col",
526
+ className: "px-3 py-2.5 font-medium",
527
+ children: "Trigger"
528
+ }),
529
+ /* @__PURE__ */ jsx(SortHeader, {
530
+ label: "Started",
531
+ className: "px-3 py-2.5 font-medium",
532
+ active: sort === "startedAt",
533
+ descending,
534
+ onClick: () => sortBy("startedAt")
535
+ }),
536
+ /* @__PURE__ */ jsx(SortHeader, {
537
+ label: "Duration",
538
+ className: "px-3 py-2.5 font-medium",
539
+ active: sort === "duration",
540
+ descending,
541
+ onClick: () => sortBy("duration")
542
+ }),
543
+ /* @__PURE__ */ jsx("th", {
544
+ scope: "col",
545
+ className: "px-3 py-2.5 font-medium",
546
+ children: "Steps"
547
+ }),
548
+ /* @__PURE__ */ jsx("th", {
549
+ scope: "col",
550
+ className: "w-8 px-3 py-2",
551
+ children: /* @__PURE__ */ jsx("span", {
552
+ className: "sr-only",
553
+ children: "Details"
554
+ })
555
+ })
556
+ ]
557
+ }) }), /* @__PURE__ */ jsx("tbody", { children: visible.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
558
+ colSpan: props.showWorkflow ? 7 : 6,
559
+ className: "px-3 py-8 text-center text-[13px] text-muted-foreground",
560
+ children: "No runs match these filters."
561
+ }) }) : visible.map((run) => {
562
+ const open = expanded === run.id;
563
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("tr", {
564
+ className: `cursor-pointer border-b border-solid border-border text-[13px] last:border-b-0 ${open ? "bg-muted/40" : "hover:bg-accent/60"}`,
565
+ onClick: () => setExpanded(open ? null : run.id),
566
+ children: [
567
+ /* @__PURE__ */ jsx("td", {
568
+ className: "px-3 py-2.5",
569
+ children: /* @__PURE__ */ jsx(StatusText, {
570
+ tone: toneOf(RUN_TONE, run.status),
571
+ status: run.status
572
+ })
573
+ }),
574
+ props.showWorkflow ? /* @__PURE__ */ jsx("td", {
575
+ className: "max-w-48 truncate px-3 py-2.5 font-medium text-foreground",
576
+ children: run.workflowName
577
+ }) : null,
578
+ /* @__PURE__ */ jsxs("td", {
579
+ className: "px-3 py-2.5 text-muted-foreground",
580
+ children: [triggerLabel(run.triggerKind), /* @__PURE__ */ jsxs("span", {
581
+ className: "ml-1.5 text-xs text-muted-foreground/70",
582
+ children: ["v", run.workflowVersion]
583
+ })]
584
+ }),
585
+ /* @__PURE__ */ jsx("td", {
586
+ className: "whitespace-nowrap px-3 py-2.5 tabular-nums text-muted-foreground",
587
+ title: formatAbsolute(run.startedAt),
588
+ children: formatWhen(run.startedAt)
589
+ }),
590
+ /* @__PURE__ */ jsx("td", {
591
+ className: "whitespace-nowrap px-3 py-2.5 tabular-nums text-muted-foreground",
592
+ children: formatDuration(run.startedAt, run.endedAt)
593
+ }),
594
+ /* @__PURE__ */ jsx("td", {
595
+ className: "px-3 py-2",
596
+ children: /* @__PURE__ */ jsx(MiniChain, { links: runLinks(run, triggerBlock.get(run.workflowId)) })
597
+ }),
598
+ /* @__PURE__ */ jsx("td", {
599
+ className: "px-3 py-2.5",
600
+ children: /* @__PURE__ */ jsx("button", {
601
+ type: "button",
602
+ "aria-expanded": open,
603
+ "aria-label": `${open ? "Hide" : "Show"} steps of the run started ${formatAbsolute(run.startedAt)}`,
604
+ 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",
605
+ onClick: (event) => {
606
+ event.stopPropagation();
607
+ setExpanded(open ? null : run.id);
608
+ },
609
+ children: /* @__PURE__ */ jsx(Icon, {
610
+ name: "chevron",
611
+ className: `h-3.5 w-3.5 transition-transform ${open ? "rotate-90" : ""}`
612
+ })
613
+ })
614
+ })
615
+ ]
616
+ }), open ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
617
+ colSpan: props.showWorkflow ? 7 : 6,
618
+ className: "border-b border-solid border-border p-0",
619
+ children: /* @__PURE__ */ jsx(RunDetail, {
620
+ run,
621
+ names: stepNames.get(run.workflowId) ?? /* @__PURE__ */ new Map(),
622
+ onChanged: props.onChanged
623
+ })
624
+ }) }) : null] }, run.id);
625
+ }) })]
626
+ })
627
+ })] });
628
+ }
629
+ //#endregion
630
+ //#region editors/workflow-studio/components/RunsView.tsx
631
+ function RunsView(props) {
632
+ const [firing, setFiring] = useState(false);
633
+ const [fireError, setFireError] = useState(null);
634
+ const { runs } = props;
635
+ return /* @__PURE__ */ jsxs("div", {
636
+ className: "w-full",
637
+ children: [
638
+ /* @__PURE__ */ jsxs("div", {
639
+ className: "mb-4 flex items-center gap-3",
640
+ children: [
641
+ /* @__PURE__ */ jsx("h2", {
642
+ className: "text-[15px] font-semibold text-foreground",
643
+ children: props.title
644
+ }),
645
+ /* @__PURE__ */ jsx("span", { className: "grow" }),
646
+ props.onFire ? /* @__PURE__ */ jsxs(Button, {
647
+ variant: "primary",
648
+ disabled: firing,
649
+ onClick: () => {
650
+ setFiring(true);
651
+ setFireError(null);
652
+ props.onFire().then((fireResultError) => setFireError(fireResultError)).catch((fireCallError) => setFireError(fireCallError instanceof Error ? fireCallError.message : String(fireCallError))).finally(() => {
653
+ setFiring(false);
654
+ props.reload();
655
+ });
656
+ },
657
+ children: [/* @__PURE__ */ jsx(Icon, {
658
+ name: "play",
659
+ className: "h-3.5 w-3.5"
660
+ }), firing ? "Running…" : "Run now"]
661
+ }) : null
662
+ ]
663
+ }),
664
+ fireError ? /* @__PURE__ */ jsx("p", {
665
+ className: "mb-3 rounded-md bg-wf-fail/10 px-3 py-2 text-[13px] text-wf-fail",
666
+ children: fireError
667
+ }) : null,
668
+ props.error ? /* @__PURE__ */ jsxs("p", {
669
+ className: "rounded-md bg-wf-warn/10 px-3 py-2 text-[13px] text-wf-warn",
670
+ children: ["Runs can't be listed because the workflow runtime is unreachable.", /* @__PURE__ */ jsx("span", {
671
+ className: "mt-0.5 block text-xs opacity-80",
672
+ children: props.error
673
+ })]
674
+ }) : runs === null ? /* @__PURE__ */ jsx("p", {
675
+ className: "text-[13px] text-muted-foreground",
676
+ children: "Loading runs…"
677
+ }) : runs.length === 0 ? /* @__PURE__ */ jsxs("div", {
678
+ className: "rounded-lg border border-dashed border-border px-4 py-10 text-center",
679
+ children: [/* @__PURE__ */ jsx("p", {
680
+ className: "text-[13px] font-medium text-foreground",
681
+ children: "No runs yet"
682
+ }), /* @__PURE__ */ jsx("p", {
683
+ className: "mt-1 text-xs text-muted-foreground",
684
+ children: props.onFire ? "Use Run now to record the first one." : "Runs appear here once the trigger fires."
685
+ })]
686
+ }) : /* @__PURE__ */ jsx(RunsTable, {
687
+ runs,
688
+ showWorkflow: props.showWorkflow,
689
+ onChanged: props.reload
690
+ })
691
+ ]
692
+ });
693
+ }
694
+ //#endregion
695
+ //#region editors/workflow-studio/components/Sidebar.tsx
696
+ const WORKFLOW_TYPE$2 = "powerhouse/workflow";
697
+ function documentName(document, fallback) {
698
+ return (document?.state?.global)?.name || fallback || "(unnamed)";
699
+ }
700
+ function documentStatus(document) {
701
+ return (document?.state?.global)?.status;
702
+ }
703
+ function Row(props) {
704
+ return /* @__PURE__ */ jsxs("div", {
705
+ className: `group mx-2 flex items-center rounded-md ${props.active ? "bg-accent" : "hover:bg-accent/60"}`,
706
+ children: [/* @__PURE__ */ jsx("button", {
707
+ type: "button",
708
+ "aria-current": props.active ? "true" : void 0,
709
+ 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 ${props.active ? "font-medium text-foreground" : "text-foreground/80"}`,
710
+ onClick: props.onClick,
711
+ children: props.children
712
+ }), props.trailing]
713
+ });
714
+ }
715
+ const ROW_ACTION = "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";
716
+ const DELETE_ACTION = `${ROW_ACTION} hover:text-wf-fail`;
717
+ function DeleteButton(props) {
718
+ return /* @__PURE__ */ jsx("button", {
719
+ type: "button",
720
+ title: "Delete",
721
+ "aria-label": `Delete ${props.label}`,
722
+ className: DELETE_ACTION,
723
+ onClick: () => showDeleteNodeModal(props.node),
724
+ children: /* @__PURE__ */ jsx(Icon, {
725
+ name: "trash",
726
+ className: "h-3.5 w-3.5"
727
+ })
728
+ });
729
+ }
730
+ function NodeRow(props) {
731
+ const { node } = props;
732
+ const { data: document, error } = useDocumentSafe(node.id);
733
+ useEffect(() => {
734
+ if (error !== void 0) console.error(`Failed to load document ${node.id}:`, error);
735
+ }, [error, node.id]);
736
+ if (error !== void 0) return /* @__PURE__ */ jsxs(Row, {
737
+ active: props.active,
738
+ onClick: props.onOpen,
739
+ trailing: /* @__PURE__ */ jsx("span", {
740
+ className: "mr-1.5 flex shrink-0 items-center",
741
+ children: /* @__PURE__ */ jsx(DeleteButton, {
742
+ node,
743
+ label: node.name || node.id
744
+ })
745
+ }),
746
+ children: [/* @__PURE__ */ jsx("span", {
747
+ className: "shrink-0 text-xs text-wf-fail",
748
+ title: `Could not load ${node.id}: ${errorMessage(error)}`,
749
+ "aria-hidden": true,
750
+ children: "⚠"
751
+ }), /* @__PURE__ */ jsx("span", {
752
+ className: "min-w-0 truncate text-wf-fail",
753
+ children: node.name || "(unnamed)"
754
+ })]
755
+ });
756
+ const status = documentStatus(document);
757
+ const { tone, label } = node.documentType === WORKFLOW_TYPE$2 ? workflowHealth(status, props.lastRunStatus) : {
758
+ tone: toneOf(CONNECTION_TONE, status),
759
+ label: status
760
+ };
761
+ return /* @__PURE__ */ jsxs(Row, {
762
+ active: props.active,
763
+ onClick: props.onOpen,
764
+ trailing: /* @__PURE__ */ jsxs("span", {
765
+ className: "mr-1.5 flex shrink-0 items-center",
766
+ children: [props.onEdit ? /* @__PURE__ */ jsx("button", {
767
+ type: "button",
768
+ title: "Open in editor",
769
+ "aria-label": `Open ${documentName(document, node.name)} in the editor`,
770
+ className: ROW_ACTION,
771
+ onClick: props.onEdit,
772
+ children: /* @__PURE__ */ jsx(Icon, {
773
+ name: "pencil",
774
+ className: "h-3.5 w-3.5"
775
+ })
776
+ }) : null, /* @__PURE__ */ jsx(DeleteButton, {
777
+ node,
778
+ label: documentName(document, node.name)
779
+ })]
780
+ }),
781
+ children: [/* @__PURE__ */ jsx("span", {
782
+ title: label,
783
+ className: "flex",
784
+ children: /* @__PURE__ */ jsx(StatusDot, { tone })
785
+ }), /* @__PURE__ */ jsx("span", {
786
+ className: "min-w-0 truncate",
787
+ children: documentName(document, node.name)
788
+ })]
789
+ });
790
+ }
791
+ function Section(props) {
792
+ return /* @__PURE__ */ jsxs("div", {
793
+ className: "mt-5",
794
+ children: [/* @__PURE__ */ jsxs("div", {
795
+ className: "mb-1 flex items-center justify-between pl-4 pr-3",
796
+ children: [/* @__PURE__ */ jsx("h3", {
797
+ className: "text-xs font-medium text-muted-foreground",
798
+ children: props.title
799
+ }), /* @__PURE__ */ jsx("button", {
800
+ type: "button",
801
+ disabled: props.creating,
802
+ 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",
803
+ title: props.addLabel,
804
+ "aria-label": props.addLabel,
805
+ onClick: props.onCreate,
806
+ children: /* @__PURE__ */ jsx(Icon, {
807
+ name: "plus",
808
+ className: "h-3.5 w-3.5"
809
+ })
810
+ })]
811
+ }), props.nodes.length === 0 ? /* @__PURE__ */ jsx("p", {
812
+ className: "px-4 py-1 text-xs text-muted-foreground",
813
+ children: props.empty
814
+ }) : /* @__PURE__ */ jsx("div", {
815
+ className: "flex flex-col gap-0.5",
816
+ children: props.nodes.map((node) => /* @__PURE__ */ jsx(NodeRow, {
817
+ node,
818
+ lastRunStatus: props.lastRuns?.get(node.id),
819
+ active: props.activeId === node.id,
820
+ onOpen: () => props.onOpen(node),
821
+ onEdit: props.onEdit ? () => props.onEdit(node) : void 0
822
+ }, node.id))
823
+ })]
824
+ });
825
+ }
826
+ function Sidebar(props) {
827
+ return /* @__PURE__ */ jsxs("aside", {
828
+ className: "w-60 shrink-0 overflow-y-auto border-r border-solid border-border bg-muted/50 py-3",
829
+ children: [
830
+ /* @__PURE__ */ jsxs(Row, {
831
+ active: props.allRunsActive,
832
+ onClick: props.onShowAllRuns,
833
+ children: [/* @__PURE__ */ jsx(Icon, {
834
+ name: "list",
835
+ className: "text-muted-foreground"
836
+ }), /* @__PURE__ */ jsx("span", { children: "Overview" })]
837
+ }),
838
+ /* @__PURE__ */ jsx(Section, {
839
+ title: "Workflows",
840
+ addLabel: "New workflow",
841
+ empty: "No workflows yet.",
842
+ nodes: props.workflows,
843
+ lastRuns: props.lastRuns,
844
+ activeId: props.activeId,
845
+ onOpen: props.onOpenWorkflow,
846
+ onEdit: props.onEditWorkflow,
847
+ onCreate: props.onCreateWorkflow,
848
+ creating: props.creating
849
+ }),
850
+ /* @__PURE__ */ jsx(Section, {
851
+ title: "Connections",
852
+ addLabel: "New connection",
853
+ empty: "No connections yet.",
854
+ nodes: props.connections,
855
+ activeId: props.activeId,
856
+ onOpen: props.onOpenConnection,
857
+ onCreate: props.onCreateConnection,
858
+ creating: props.creating
859
+ })
860
+ ]
861
+ });
862
+ }
863
+ //#endregion
864
+ //#region editors/workflow-studio/components/use-hash-selection.ts
865
+ function readHash() {
866
+ return window.location.hash.replace(/^#/, "") || void 0;
867
+ }
868
+ function useHashSelection() {
869
+ const [selected, setSelected] = useState(readHash);
870
+ useEffect(() => {
871
+ const sync = () => setSelected(readHash());
872
+ window.addEventListener("hashchange", sync);
873
+ window.addEventListener("popstate", sync);
874
+ return () => {
875
+ window.removeEventListener("hashchange", sync);
876
+ window.removeEventListener("popstate", sync);
877
+ };
878
+ }, []);
879
+ return [selected, useCallback((id) => {
880
+ setSelected(id);
881
+ const url = new URL(window.location.href);
882
+ url.hash = id ?? "";
883
+ window.history.replaceState(null, "", url);
884
+ }, [])];
885
+ }
886
+ //#endregion
887
+ //#region editors/workflow-studio/components/useRuns.ts
888
+ const POLL_MS = 5e3;
889
+ function useRuns(scope, active = true) {
890
+ const { workflowId, driveId, limit } = scope;
891
+ const [runs, setRuns] = useState(null);
892
+ const [error, setError] = useState(null);
893
+ const load = useRef(() => void 0);
894
+ useEffect(() => {
895
+ if (!active) return;
896
+ let cancelled = false;
897
+ const run = () => {
898
+ fetchRuns({
899
+ workflowId,
900
+ driveId,
901
+ limit
902
+ }).then((result) => {
903
+ if (cancelled) return;
904
+ setRuns(result);
905
+ setError(null);
906
+ }, (loadError) => {
907
+ if (cancelled) return;
908
+ setError(loadError instanceof Error ? loadError.message : String(loadError));
909
+ });
910
+ };
911
+ load.current = run;
912
+ setRuns(null);
913
+ run();
914
+ const timer = setInterval(run, POLL_MS);
915
+ return () => {
916
+ cancelled = true;
917
+ clearInterval(timer);
918
+ };
919
+ }, [
920
+ workflowId,
921
+ driveId,
922
+ limit,
923
+ active
924
+ ]);
925
+ return {
926
+ runs,
927
+ error,
928
+ reload: useCallback(() => load.current(), [])
929
+ };
930
+ }
931
+ //#endregion
932
+ //#region editors/workflow-studio/components/step-outline.ts
933
+ function stepOutline(args) {
934
+ const stepById = new Map(args.steps.map((step) => [step.id, step]));
935
+ const outgoing = /* @__PURE__ */ new Map();
936
+ for (const edge of args.edges) {
937
+ if (!stepById.has(edge.to)) continue;
938
+ const list = outgoing.get(edge.from) ?? [];
939
+ list.push(edge);
940
+ outgoing.set(edge.from, list);
941
+ }
942
+ for (const list of outgoing.values()) list.sort((a, b) => portRank(a.port) - portRank(b.port));
943
+ const rows = [];
944
+ const seen = /* @__PURE__ */ new Set();
945
+ const walk = (fromId, port) => {
946
+ const step = stepById.get(fromId);
947
+ if (step) {
948
+ if (seen.has(fromId)) return;
949
+ seen.add(fromId);
950
+ rows.push({
951
+ step,
952
+ port: port === "next" ? null : port
953
+ });
954
+ }
955
+ for (const edge of outgoing.get(fromId) ?? []) walk(edge.to, edge.port);
956
+ };
957
+ if (args.triggerId) walk(args.triggerId, null);
958
+ return {
959
+ rows,
960
+ orphans: args.steps.filter((step) => !seen.has(step.id))
961
+ };
962
+ }
963
+ //#endregion
964
+ //#region editors/workflow-studio/components/WorkflowBoard.tsx
965
+ function summary(rows) {
966
+ const count = `${rows.length} ${rows.length === 1 ? "workflow" : "workflows"}`;
967
+ const failing = rows.filter((row) => row.runs[0]?.status === "FAILED").length;
968
+ const parts = [count, `${rows.filter((row) => row.status === "ENABLED").length} enabled`];
969
+ if (failing > 0) parts.push(`${failing} failed on the last run`);
970
+ return parts.join(", ");
971
+ }
972
+ function WorkflowBoard(props) {
973
+ usePieceLogos();
974
+ const documents = useWorkflowDocumentsInSelectedDrive() ?? [];
975
+ const runs = props.runs ?? [];
976
+ const rows = documents.map((document) => {
977
+ const state = document.state.global;
978
+ const workflowRuns = runs.filter((run) => run.workflowId === document.header.id);
979
+ const latest = workflowRuns.at(0);
980
+ const statusByKey = new Map((latest?.steps ?? []).map((step) => [step.stepKey, step.status]));
981
+ const outline = stepOutline({
982
+ triggerId: state.trigger?.id,
983
+ steps: state.steps,
984
+ edges: state.edges
985
+ });
986
+ const links = [...state.trigger ? [{
987
+ id: state.trigger.id,
988
+ blockType: state.trigger.blockType,
989
+ label: "Trigger",
990
+ status: latest ? "SUCCEEDED" : void 0
991
+ }] : [], ...outline.rows.map((row) => ({
992
+ id: row.step.id,
993
+ blockType: row.step.blockType,
994
+ label: row.step.name || row.step.key,
995
+ status: statusByKey.get(row.step.key)
996
+ }))];
997
+ return {
998
+ id: document.header.id,
999
+ name: state.name || document.header.name || "Untitled workflow",
1000
+ status: state.status,
1001
+ trigger: describeTrigger(state.trigger),
1002
+ links,
1003
+ runs: workflowRuns
1004
+ };
1005
+ }).sort((a, b) => {
1006
+ const at = a.runs[0]?.startedAt ?? "";
1007
+ const bt = b.runs[0]?.startedAt ?? "";
1008
+ if (at !== bt) return bt.localeCompare(at);
1009
+ return a.name.localeCompare(b.name);
1010
+ });
1011
+ return /* @__PURE__ */ jsxs("section", {
1012
+ className: "mb-10",
1013
+ children: [/* @__PURE__ */ jsxs("div", {
1014
+ className: "mb-4 flex flex-wrap items-end justify-between gap-3",
1015
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
1016
+ className: "text-2xl font-semibold tracking-tight text-foreground",
1017
+ children: "Workflows"
1018
+ }), /* @__PURE__ */ jsx("p", {
1019
+ className: "mt-1 text-[13px] text-muted-foreground",
1020
+ children: rows.length === 0 ? "Automations in this drive" : summary(rows)
1021
+ })] }), /* @__PURE__ */ jsxs(Button, {
1022
+ variant: "primary",
1023
+ disabled: props.creating,
1024
+ onClick: props.onCreate,
1025
+ children: [/* @__PURE__ */ jsx(Icon, {
1026
+ name: "plus",
1027
+ className: "h-3.5 w-3.5"
1028
+ }), "New workflow"]
1029
+ })]
1030
+ }), rows.length === 0 ? /* @__PURE__ */ jsxs("div", {
1031
+ className: "rounded-xl border border-dashed border-foreground/15 px-6 py-12 text-center",
1032
+ children: [/* @__PURE__ */ jsx("p", {
1033
+ className: "text-[15px] font-medium text-foreground",
1034
+ children: "No workflows yet"
1035
+ }), /* @__PURE__ */ jsx("p", {
1036
+ className: "mx-auto mt-1 max-w-sm text-[13px] text-muted-foreground",
1037
+ children: "A workflow starts on a trigger, like a schedule or a webhook, and runs a chain of steps across your services."
1038
+ })]
1039
+ }) : /* @__PURE__ */ jsx("ul", {
1040
+ "aria-label": "Workflows",
1041
+ className: "overflow-hidden rounded-xl border border-solid border-foreground/10 bg-card",
1042
+ children: rows.map((row) => {
1043
+ const latest = row.runs.at(0);
1044
+ const latestTone = toneOf(RUN_TONE, latest?.status);
1045
+ const health = workflowHealth(row.status, latest?.status);
1046
+ return /* @__PURE__ */ jsx("li", {
1047
+ className: "border-b border-solid border-foreground/10 last:border-b-0",
1048
+ children: /* @__PURE__ */ jsxs("button", {
1049
+ type: "button",
1050
+ 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]",
1051
+ onClick: () => props.onOpen(row.id),
1052
+ children: [
1053
+ /* @__PURE__ */ jsxs("span", {
1054
+ className: "min-w-0",
1055
+ children: [/* @__PURE__ */ jsxs("span", {
1056
+ className: "flex items-center gap-2",
1057
+ children: [
1058
+ /* @__PURE__ */ jsx("span", {
1059
+ title: health.label,
1060
+ className: "flex",
1061
+ children: /* @__PURE__ */ jsx(StatusDot, { tone: health.tone })
1062
+ }),
1063
+ /* @__PURE__ */ jsx("span", {
1064
+ className: "truncate text-[15px] font-semibold text-foreground",
1065
+ children: row.name
1066
+ }),
1067
+ row.status !== "ENABLED" ? /* @__PURE__ */ jsx("span", {
1068
+ className: "shrink-0 rounded-full bg-muted px-2 py-0.5 text-[11px] text-muted-foreground",
1069
+ children: statusLabel(row.status)
1070
+ }) : null
1071
+ ]
1072
+ }), /* @__PURE__ */ jsx("span", {
1073
+ className: "mt-0.5 block truncate pl-4 text-[13px] text-muted-foreground",
1074
+ children: row.trigger
1075
+ })]
1076
+ }),
1077
+ /* @__PURE__ */ jsx("span", {
1078
+ className: "hidden md:block",
1079
+ children: /* @__PURE__ */ jsx(MiniChain, { links: row.links })
1080
+ }),
1081
+ /* @__PURE__ */ jsx("span", {
1082
+ className: "hidden text-[13px] md:block",
1083
+ title: latest ? formatAbsolute(latest.startedAt) : void 0,
1084
+ children: latest ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
1085
+ className: `font-medium ${latestTone === "fail" ? "text-wf-fail" : latestTone === "ok" ? "text-wf-ok" : "text-foreground"}`,
1086
+ children: statusLabel(latest.status)
1087
+ }), /* @__PURE__ */ jsx("span", {
1088
+ className: "block text-xs text-muted-foreground",
1089
+ children: formatWhen(latest.startedAt)
1090
+ })] }) : /* @__PURE__ */ jsx("span", {
1091
+ className: "text-muted-foreground",
1092
+ children: "Not run yet"
1093
+ })
1094
+ }),
1095
+ /* @__PURE__ */ jsx(RunStrip, { runs: row.runs })
1096
+ ]
1097
+ })
1098
+ }, row.id);
1099
+ })
1100
+ })]
1101
+ });
1102
+ }
1103
+ //#endregion
1104
+ //#region editors/workflow-studio/components/WorkflowSteps.tsx
1105
+ const RAIL = {
1106
+ ok: "bg-wf-ok",
1107
+ fail: "bg-wf-fail",
1108
+ warn: "bg-wf-warn",
1109
+ run: "bg-wf-run",
1110
+ idle: "bg-border"
1111
+ };
1112
+ const RING = {
1113
+ ok: "ring-wf-ok",
1114
+ fail: "ring-wf-fail",
1115
+ warn: "ring-wf-warn",
1116
+ run: "ring-wf-run",
1117
+ idle: "ring-border"
1118
+ };
1119
+ function TrackStop(props) {
1120
+ const { stop } = props;
1121
+ const tone = stop.status ? toneOf(STEP_TONE, stop.status) : "idle";
1122
+ return /* @__PURE__ */ jsxs("li", {
1123
+ className: "relative flex w-40 shrink-0 flex-col items-center",
1124
+ children: [
1125
+ /* @__PURE__ */ jsx("span", {
1126
+ "aria-hidden": true,
1127
+ className: `absolute left-0 top-[19px] h-0.5 w-1/2 ${props.first ? "invisible" : RAIL[props.inbound]}`
1128
+ }),
1129
+ /* @__PURE__ */ jsx("span", {
1130
+ "aria-hidden": true,
1131
+ className: `absolute right-0 top-[19px] h-0.5 w-1/2 ${props.last ? "invisible" : RAIL[props.outbound]}`
1132
+ }),
1133
+ stop.port ? /* @__PURE__ */ jsx("span", {
1134
+ className: "absolute -left-4 top-0 rounded bg-background px-1 text-[11px] text-muted-foreground",
1135
+ children: stop.port
1136
+ }) : null,
1137
+ /* @__PURE__ */ jsx("button", {
1138
+ type: "button",
1139
+ title: stop.status ? `${stop.title}: ${stop.status.toLowerCase()}` : stop.title,
1140
+ "aria-label": `${stop.title}: ${stop.status ? stop.status.toLowerCase() : "not run"}`,
1141
+ 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]}`,
1142
+ onClick: props.onClick,
1143
+ children: /* @__PURE__ */ jsx(BlockLogo, {
1144
+ bare: true,
1145
+ blockType: stop.blockType,
1146
+ size: 20
1147
+ })
1148
+ }),
1149
+ /* @__PURE__ */ jsx("span", {
1150
+ className: "mt-2 max-w-full truncate px-2 text-[13px] font-medium text-foreground",
1151
+ children: stop.title
1152
+ }),
1153
+ /* @__PURE__ */ jsx("span", {
1154
+ className: "max-w-full truncate px-2 text-xs text-muted-foreground",
1155
+ title: stop.subtitle,
1156
+ children: stop.subtitle
1157
+ })
1158
+ ]
1159
+ });
1160
+ }
1161
+ function Track(props) {
1162
+ const tones = props.stops.map((stop) => stop.status ? toneOf(STEP_TONE, stop.status) : "idle");
1163
+ return /* @__PURE__ */ jsx("ol", {
1164
+ className: "-mx-6 flex overflow-x-auto px-6 py-1.5",
1165
+ children: props.stops.map((stop, index) => /* @__PURE__ */ jsx(TrackStop, {
1166
+ stop,
1167
+ first: index === 0,
1168
+ last: index === props.stops.length - 1,
1169
+ inbound: tones[index],
1170
+ outbound: tones[index + 1] ?? "idle",
1171
+ onClick: props.onOpenEditor
1172
+ }, stop.id))
1173
+ });
1174
+ }
1175
+ function WorkflowSteps(props) {
1176
+ const { state } = props;
1177
+ usePieceLogos();
1178
+ const outline = stepOutline({
1179
+ triggerId: state.trigger?.id,
1180
+ steps: state.steps,
1181
+ edges: state.edges
1182
+ });
1183
+ const statusByKey = new Map((props.latestRun?.steps ?? []).map((step) => [step.stepKey, step.status]));
1184
+ const stopFor = (step, port) => {
1185
+ const meta = blockMeta(step.blockType);
1186
+ return {
1187
+ id: step.id,
1188
+ title: step.name || step.key,
1189
+ subtitle: meta.displayName,
1190
+ blockType: step.blockType,
1191
+ status: statusByKey.get(step.key),
1192
+ port
1193
+ };
1194
+ };
1195
+ if (!state.trigger && state.steps.length === 0) return /* @__PURE__ */ jsx("section", {
1196
+ className: "mt-8 border-t border-solid border-border pt-6",
1197
+ children: /* @__PURE__ */ jsxs("p", {
1198
+ className: "text-[13px] text-muted-foreground",
1199
+ children: [
1200
+ "This workflow has no trigger or steps yet.",
1201
+ " ",
1202
+ /* @__PURE__ */ jsx("button", {
1203
+ type: "button",
1204
+ className: "font-medium text-foreground underline underline-offset-2",
1205
+ onClick: props.onOpenEditor,
1206
+ children: "Open the editor"
1207
+ }),
1208
+ " ",
1209
+ "to build it."
1210
+ ]
1211
+ })
1212
+ });
1213
+ const triggerMeta = state.trigger ? blockMeta(state.trigger.blockType) : null;
1214
+ const stops = [...state.trigger && triggerMeta ? [{
1215
+ id: state.trigger.id,
1216
+ title: triggerMeta.displayName,
1217
+ subtitle: "Trigger",
1218
+ blockType: state.trigger.blockType,
1219
+ status: props.latestRun ? "SUCCEEDED" : void 0
1220
+ }] : [], ...outline.rows.map((row) => stopFor(row.step, row.port))];
1221
+ return /* @__PURE__ */ jsxs("section", {
1222
+ className: "mt-8 border-t border-solid border-border pt-6",
1223
+ children: [
1224
+ /* @__PURE__ */ jsxs("div", {
1225
+ className: "mb-4 flex items-baseline gap-2",
1226
+ children: [/* @__PURE__ */ jsx("h3", {
1227
+ className: "text-[13px] font-medium text-foreground",
1228
+ children: "Steps"
1229
+ }), /* @__PURE__ */ jsx("span", {
1230
+ className: "text-xs text-muted-foreground",
1231
+ children: props.latestRun ? "Coloured by the latest run" : "Not run yet"
1232
+ })]
1233
+ }),
1234
+ !state.trigger ? /* @__PURE__ */ jsx("p", {
1235
+ className: "mb-3 text-xs text-wf-warn",
1236
+ children: "No trigger set, so this workflow never starts on its own."
1237
+ }) : null,
1238
+ /* @__PURE__ */ jsx(Track, {
1239
+ stops,
1240
+ onOpenEditor: props.onOpenEditor
1241
+ }),
1242
+ outline.orphans.length > 0 ? /* @__PURE__ */ jsxs("div", {
1243
+ className: "mt-5",
1244
+ children: [/* @__PURE__ */ jsx("p", {
1245
+ className: "mb-3 text-xs text-muted-foreground",
1246
+ children: "Not connected to the trigger, so runs never reach these:"
1247
+ }), /* @__PURE__ */ jsx("ol", {
1248
+ className: "-mx-6 flex overflow-x-auto px-6 py-1.5 opacity-60",
1249
+ children: outline.orphans.map((step) => /* @__PURE__ */ jsx(TrackStop, {
1250
+ stop: stopFor(step, null),
1251
+ first: true,
1252
+ last: true,
1253
+ inbound: "idle",
1254
+ outbound: "idle",
1255
+ onClick: props.onOpenEditor
1256
+ }, step.id))
1257
+ })]
1258
+ }) : null
1259
+ ]
1260
+ });
1261
+ }
1262
+ //#endregion
1263
+ //#region editors/workflow-studio/components/WorkflowHeader.tsx
1264
+ const WORKFLOW_TYPE$1 = "powerhouse/workflow";
1265
+ function WorkflowHeader(props) {
1266
+ const workflowId = props.node.id;
1267
+ const { data: document, error, reload } = useDocumentSafe(workflowId);
1268
+ const [, dispatch] = useDispatch(document);
1269
+ if (error !== void 0) return /* @__PURE__ */ jsx(DocumentLoadError, {
1270
+ title: "This workflow could not be loaded",
1271
+ documentId: workflowId,
1272
+ error,
1273
+ onRetry: () => {
1274
+ reload();
1275
+ }
1276
+ });
1277
+ if (document?.header.documentType !== WORKFLOW_TYPE$1) return null;
1278
+ const state = document.state.global;
1279
+ const enabled = state.status === "ENABLED";
1280
+ const stats = runStats(props.runs ?? []);
1281
+ const lastTone = toneOf(RUN_TONE, stats.lastRun?.status);
1282
+ const statusTone = toneOf(WORKFLOW_TONE, state.status);
1283
+ return /* @__PURE__ */ jsxs("header", {
1284
+ className: "mb-8",
1285
+ children: [
1286
+ /* @__PURE__ */ jsxs("div", {
1287
+ className: "flex flex-wrap items-start gap-3",
1288
+ children: [/* @__PURE__ */ jsxs("div", {
1289
+ className: "min-w-0 grow",
1290
+ children: [/* @__PURE__ */ jsxs("div", {
1291
+ className: "flex items-center gap-2.5",
1292
+ children: [/* @__PURE__ */ jsx("h2", {
1293
+ className: "min-w-0 truncate text-xl font-semibold tracking-tight text-foreground",
1294
+ children: state.name || props.node.name || "Untitled workflow"
1295
+ }), /* @__PURE__ */ jsx("span", {
1296
+ className: `rounded-full px-2 py-0.5 text-xs font-medium ${TONE_BADGE[statusTone]}`,
1297
+ children: statusLabel(state.status)
1298
+ })]
1299
+ }), state.description ? /* @__PURE__ */ jsx("p", {
1300
+ className: "mt-1 max-w-prose text-[13px] text-muted-foreground",
1301
+ children: state.description
1302
+ }) : null]
1303
+ }), /* @__PURE__ */ jsxs("div", {
1304
+ className: "flex items-center gap-2",
1305
+ children: [
1306
+ /* @__PURE__ */ jsx(Button, {
1307
+ variant: "danger",
1308
+ onClick: () => showDeleteNodeModal(props.node),
1309
+ children: "Delete"
1310
+ }),
1311
+ /* @__PURE__ */ jsx(Button, {
1312
+ onClick: () => dispatch(actions.setWorkflowStatus({ status: enabled ? "DISABLED" : "ENABLED" })),
1313
+ children: enabled ? "Disable" : "Enable"
1314
+ }),
1315
+ /* @__PURE__ */ jsx(Button, {
1316
+ variant: "primary",
1317
+ onClick: props.onEdit,
1318
+ children: "Edit workflow"
1319
+ })
1320
+ ]
1321
+ })]
1322
+ }),
1323
+ /* @__PURE__ */ jsxs("dl", {
1324
+ className: "mt-5 flex flex-wrap gap-x-10 gap-y-3",
1325
+ children: [
1326
+ /* @__PURE__ */ jsx(Fact, {
1327
+ label: "Starts",
1328
+ children: state.trigger ? describeTrigger(state.trigger) : /* @__PURE__ */ jsx("span", {
1329
+ className: "text-wf-warn",
1330
+ children: "Never: no trigger"
1331
+ })
1332
+ }),
1333
+ /* @__PURE__ */ jsx(Fact, {
1334
+ label: "Last run",
1335
+ title: stats.lastRun ? formatAbsolute(stats.lastRun.startedAt) : void 0,
1336
+ children: stats.lastRun ? /* @__PURE__ */ jsxs("span", {
1337
+ className: `inline-flex items-center gap-1.5 ${TONE_TEXT[lastTone]}`,
1338
+ children: [/* @__PURE__ */ jsx(StatusDot, { tone: lastTone }), formatWhen(stats.lastRun.startedAt)]
1339
+ }) : /* @__PURE__ */ jsx("span", {
1340
+ className: "text-muted-foreground",
1341
+ children: "Never"
1342
+ })
1343
+ }),
1344
+ /* @__PURE__ */ jsx(Fact, {
1345
+ label: "Recent runs",
1346
+ children: stats.total > 0 ? /* @__PURE__ */ jsx(RunStrip, { runs: props.runs ?? [] }) : /* @__PURE__ */ jsx("span", {
1347
+ className: "text-muted-foreground",
1348
+ children: "None yet"
1349
+ })
1350
+ }),
1351
+ /* @__PURE__ */ jsx(Fact, {
1352
+ label: "Success rate",
1353
+ children: stats.successRate === null ? /* @__PURE__ */ jsx("span", {
1354
+ className: "text-muted-foreground",
1355
+ children: "No finished runs"
1356
+ }) : `${stats.successRate}%`
1357
+ }),
1358
+ /* @__PURE__ */ jsxs(Fact, {
1359
+ label: "Version",
1360
+ children: ["v", state.version]
1361
+ })
1362
+ ]
1363
+ }),
1364
+ /* @__PURE__ */ jsx(WorkflowSteps, {
1365
+ state,
1366
+ latestRun: stats.lastRun,
1367
+ onOpenEditor: props.onEdit
1368
+ })
1369
+ ]
1370
+ });
1371
+ }
1372
+ //#endregion
1373
+ //#region editors/workflow-studio/components/WorkflowStudio.tsx
1374
+ const WORKFLOW_TYPE = "powerhouse/workflow";
1375
+ const CONNECTION_TYPE = "powerhouse/connection";
1376
+ function WorkflowStudio(props) {
1377
+ const [drive] = useSelectedDrive();
1378
+ const fileNodes = useFileNodesInSelectedDrive() ?? [];
1379
+ const selectedNode = useSelectedNode();
1380
+ const selectedNodeId = selectedNode?.id;
1381
+ const toast = usePHToast();
1382
+ const [selectedId, select] = useHashSelection();
1383
+ const [creating, setCreating] = useState(false);
1384
+ const driveId = drive.header.id;
1385
+ const workflows = fileNodes.filter((node) => node.documentType === WORKFLOW_TYPE);
1386
+ const connections = fileNodes.filter((node) => node.documentType === CONNECTION_TYPE);
1387
+ const editorOpen = Boolean(props.children && selectedNodeId);
1388
+ const create = (documentType, baseName, count) => {
1389
+ if (creating) return;
1390
+ setCreating(true);
1391
+ addDocument(driveId, `${baseName} ${count + 1}`, documentType).then((node) => {
1392
+ select(node.id);
1393
+ setSelectedNode(node.id);
1394
+ }).catch((error) => {
1395
+ toast?.(error instanceof Error ? error.message : `Failed to create ${baseName}`, { type: "error" });
1396
+ }).finally(() => setCreating(false));
1397
+ };
1398
+ const showRuns = (node) => {
1399
+ setSelectedNode(void 0);
1400
+ select(node?.id);
1401
+ };
1402
+ const liveTarget = workflows.find((node) => node.id === selectedId) ?? null;
1403
+ const connectionSelected = connections.some((node) => node.id === selectedId);
1404
+ const wasEditing = useRef(editorOpen);
1405
+ useEffect(() => {
1406
+ if (wasEditing.current && !editorOpen && connectionSelected) select(void 0);
1407
+ wasEditing.current = editorOpen;
1408
+ }, [
1409
+ editorOpen,
1410
+ connectionSelected,
1411
+ select
1412
+ ]);
1413
+ const selectionExists = fileNodes.some((node) => node.id === selectedId);
1414
+ useEffect(() => {
1415
+ if (selectedId && fileNodes.length > 0 && !selectionExists) select(void 0);
1416
+ }, [
1417
+ fileNodes.length,
1418
+ select,
1419
+ selectedId,
1420
+ selectionExists
1421
+ ]);
1422
+ const focusedWorkflow = liveTarget;
1423
+ const driveFeed = useRuns({ driveId });
1424
+ const workflowFeed = useRuns({ workflowId: focusedWorkflow?.id }, Boolean(focusedWorkflow));
1425
+ const { runs, error: runsError, reload: reloadRuns } = focusedWorkflow ? workflowFeed : driveFeed;
1426
+ const lastRuns = /* @__PURE__ */ new Map();
1427
+ for (const run of driveFeed.runs ?? []) if (!lastRuns.has(run.workflowId)) lastRuns.set(run.workflowId, run.status);
1428
+ const { data: targetDocument } = useDocumentSafe(liveTarget?.id ?? null);
1429
+ const manualTrigger = targetDocument?.header.documentType === WORKFLOW_TYPE && targetDocument.state.global.trigger?.blockType === "core#manual";
1430
+ return /* @__PURE__ */ jsxs("div", {
1431
+ className: "flex h-full min-h-0",
1432
+ children: [/* @__PURE__ */ jsx(Sidebar, {
1433
+ workflows,
1434
+ connections,
1435
+ lastRuns,
1436
+ activeId: selectedId,
1437
+ allRunsActive: !selectedId,
1438
+ creating,
1439
+ onShowAllRuns: () => showRuns(null),
1440
+ onOpenWorkflow: (node) => showRuns(node),
1441
+ onEditWorkflow: (node) => {
1442
+ select(node.id);
1443
+ setSelectedNode(node.id);
1444
+ },
1445
+ onOpenConnection: (node) => {
1446
+ select(node.id);
1447
+ setSelectedNode(node.id);
1448
+ },
1449
+ onCreateWorkflow: () => create(WORKFLOW_TYPE, "Workflow", workflows.length),
1450
+ onCreateConnection: () => create(CONNECTION_TYPE, "Connection", connections.length)
1451
+ }), /* @__PURE__ */ jsx("main", {
1452
+ className: "min-w-0 flex-1 overflow-y-auto",
1453
+ children: editorOpen ? /* @__PURE__ */ jsx("div", {
1454
+ className: "flex h-full min-h-0 flex-col",
1455
+ children: /* @__PURE__ */ jsx("div", {
1456
+ className: "flex min-h-0 flex-1 flex-col [&>#document-editor-container]:min-h-0",
1457
+ children: /* @__PURE__ */ jsx(DocumentErrorBoundary, {
1458
+ documentId: selectedNodeId,
1459
+ label: selectedNode?.name,
1460
+ onDismiss: () => setSelectedNode(void 0),
1461
+ children: props.children
1462
+ }, selectedNodeId)
1463
+ })
1464
+ }) : /* @__PURE__ */ jsxs("div", {
1465
+ className: "mx-auto w-full max-w-6xl px-8 py-10",
1466
+ children: [liveTarget ? /* @__PURE__ */ jsx(WorkflowHeader, {
1467
+ node: liveTarget,
1468
+ runs,
1469
+ onEdit: () => setSelectedNode(liveTarget.id)
1470
+ }, liveTarget.id) : /* @__PURE__ */ jsx(WorkflowBoard, {
1471
+ runs,
1472
+ creating,
1473
+ onOpen: (workflowId) => select(workflowId),
1474
+ onCreate: () => create(WORKFLOW_TYPE, "Workflow", workflows.length)
1475
+ }), /* @__PURE__ */ jsx(RunsView, {
1476
+ title: liveTarget ? "Runs" : "Recent runs",
1477
+ runs,
1478
+ error: runsError,
1479
+ reload: reloadRuns,
1480
+ showWorkflow: liveTarget === null,
1481
+ onFire: liveTarget && manualTrigger ? () => fireWorkflow(liveTarget.id).then((result) => result.error) : void 0
1482
+ })]
1483
+ })
1484
+ })]
1485
+ });
1486
+ }
1487
+ //#endregion
1488
+ //#region editors/workflow-studio/config.ts
1489
+ const editorConfig = {
1490
+ isDragAndDropEnabled: true,
1491
+ allowedDocumentTypes: ["powerhouse/workflow", "powerhouse/connection"]
1492
+ };
1493
+ //#endregion
1494
+ //#region editors/workflow-studio/editor.tsx
1495
+ /**
1496
+ * WARNING: DO NOT EDIT
1497
+ * This file is auto-generated and updated by codegen
1498
+ */
1499
+ /** Editor component for the app */
1500
+ function Editor(props) {
1501
+ useSetPHAppConfig(editorConfig);
1502
+ useSyncWorkflowRuntimeUrl();
1503
+ return /* @__PURE__ */ jsx("div", {
1504
+ className: "h-full min-h-0 bg-background",
1505
+ children: /* @__PURE__ */ jsx(WorkflowStudio, { children: props.children })
1506
+ });
1507
+ }
1508
+ //#endregion
1509
+ export { Editor as default };
1510
+
1511
+ //# sourceMappingURL=editor-kbIdHU7F.js.map