@powerhousedao/workflow 6.2.3-dev.53 → 6.2.3-dev.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/dist/browser/{BlockSelector-CzJnQWsh.js → BlockSelector-DnBab95a.js} +3 -3
  2. package/dist/browser/{BlockSelector-CzJnQWsh.js.map → BlockSelector-DnBab95a.js.map} +1 -1
  3. package/dist/browser/block-type-kX-27vVt.js +44 -0
  4. package/dist/browser/block-type-kX-27vVt.js.map +1 -0
  5. package/dist/browser/{connection-BP17lpt3.js → connection-BXV8I017.js} +2 -2
  6. package/dist/browser/{connection-BP17lpt3.js.map → connection-BXV8I017.js.map} +1 -1
  7. package/dist/browser/{connection-form-cCgfAa1A.js → connection-form-Cy2fyFUR.js} +24 -28
  8. package/dist/browser/connection-form-Cy2fyFUR.js.map +1 -0
  9. package/dist/browser/{data-tree-S_SwaRve.js → data-tree-BvFLAMyE.js} +2 -2
  10. package/dist/browser/{data-tree-S_SwaRve.js.map → data-tree-BvFLAMyE.js.map} +1 -1
  11. package/dist/browser/document-models/connection/index.js +3 -3
  12. package/dist/browser/document-models/index.js +3 -3
  13. package/dist/browser/document-models/workflow/index.js +3 -3
  14. package/dist/browser/{document-models-B08jDa_s.js → document-models-CncHyXAk.js} +3 -3
  15. package/dist/browser/{document-models-B08jDa_s.js.map → document-models-CncHyXAk.js.map} +1 -1
  16. package/dist/browser/{editor-CQyfDOIN.js → editor-CEJO-2Ue.js} +138 -127
  17. package/dist/browser/editor-CEJO-2Ue.js.map +1 -0
  18. package/dist/{node/editor-EeTeVS3A.mjs → browser/editor-DVBnS8YM.js} +360 -319
  19. package/dist/browser/editor-DVBnS8YM.js.map +1 -0
  20. package/dist/browser/{editor-CVXRNht0.js → editor-Dc9Q55q1.js} +7 -7
  21. package/dist/browser/{editor-CVXRNht0.js.map → editor-Dc9Q55q1.js.map} +1 -1
  22. package/dist/browser/editors/connection-editor/module.js +1 -1
  23. package/dist/browser/editors/runtime/index.js +2 -0
  24. package/dist/browser/editors/workflow-editor/module.js +1 -1
  25. package/dist/browser/editors/workflow-studio/module.js +1 -1
  26. package/dist/browser/index.js +4 -4
  27. package/dist/browser/{module-B2BMwu5E.js → module-DIQ3tQ2M.js} +97 -2
  28. package/dist/browser/module-DIQ3tQ2M.js.map +1 -0
  29. package/dist/browser/{module-ozS5EVRx.js → module-DxQBeqBh.js} +211 -83
  30. package/dist/browser/module-DxQBeqBh.js.map +1 -0
  31. package/dist/browser/reactor/index.js +2 -2
  32. package/dist/browser/{runtime-queries-2hn7fcKn.js → runtime-queries-DehIdatq.js} +3 -3
  33. package/dist/browser/{runtime-queries-2hn7fcKn.js.map → runtime-queries-DehIdatq.js.map} +1 -1
  34. package/dist/browser/{trigger-text-Cfyx8tMq.js → trigger-text-CfRbN-DV.js} +5 -5
  35. package/dist/browser/trigger-text-CfRbN-DV.js.map +1 -0
  36. package/dist/browser/upgrade-manifests-CAE3ivDp.js +8 -0
  37. package/dist/browser/{upgrade-manifests-DHGmgHKW.js.map → upgrade-manifests-CAE3ivDp.js.map} +1 -1
  38. package/dist/browser/{workflow-DoewHe4K.js → workflow-C003Wutu.js} +2 -2
  39. package/dist/browser/{workflow-DoewHe4K.js.map → workflow-C003Wutu.js.map} +1 -1
  40. package/dist/node/{BlockSelector-g9m3yaJj.mjs → BlockSelector-B77i85CO.mjs} +3 -3
  41. package/dist/node/{BlockSelector-g9m3yaJj.mjs.map → BlockSelector-B77i85CO.mjs.map} +1 -1
  42. package/dist/node/block-type-kX-27vVt.mjs +44 -0
  43. package/dist/node/block-type-kX-27vVt.mjs.map +1 -0
  44. package/dist/node/{connection-BxJoL8js.mjs → connection-BzW9OpKx.mjs} +2 -2
  45. package/dist/node/{connection-BxJoL8js.mjs.map → connection-BzW9OpKx.mjs.map} +1 -1
  46. package/dist/node/{connection-form-h0PidbTI.mjs → connection-form-BCwEO3ll.mjs} +24 -28
  47. package/dist/node/connection-form-BCwEO3ll.mjs.map +1 -0
  48. package/dist/node/{data-tree-CKKeR7qj.mjs → data-tree-CH8KnNSz.mjs} +2 -2
  49. package/dist/node/{data-tree-CKKeR7qj.mjs.map → data-tree-CH8KnNSz.mjs.map} +1 -1
  50. package/dist/node/document-models/connection/index.mjs +3 -3
  51. package/dist/node/document-models/index.mjs +3 -3
  52. package/dist/node/document-models/workflow/index.mjs +3 -3
  53. package/dist/node/{editor-BAbYXi7T.mjs → editor-BYzFMCB8.mjs} +7 -7
  54. package/dist/node/{editor-BAbYXi7T.mjs.map → editor-BYzFMCB8.mjs.map} +1 -1
  55. package/dist/{browser/editor-CbpyTAEC.js → node/editor-CsMRho-A.mjs} +360 -319
  56. package/dist/node/editor-CsMRho-A.mjs.map +1 -0
  57. package/dist/node/{editor-DCsT8WsQ.mjs → editor-DtLyolUn.mjs} +138 -127
  58. package/dist/node/editor-DtLyolUn.mjs.map +1 -0
  59. package/dist/node/editors/connection-editor/module.mjs +1 -1
  60. package/dist/node/editors/runtime/index.mjs +2 -0
  61. package/dist/node/editors/workflow-editor/module.mjs +1 -1
  62. package/dist/node/editors/workflow-studio/module.mjs +1 -1
  63. package/dist/node/index.mjs +4 -4
  64. package/dist/node/{module-BlT-atBQ.mjs → module-Bl_4mnxR.mjs} +97 -2
  65. package/dist/node/module-Bl_4mnxR.mjs.map +1 -0
  66. package/dist/node/{module-uKdoLIga.mjs → module-DPg8IYIn.mjs} +211 -83
  67. package/dist/node/module-DPg8IYIn.mjs.map +1 -0
  68. package/dist/node/pieces/reactor/descriptor.json +1 -1
  69. package/dist/node/pieces/reactor/package.json +1 -1
  70. package/dist/node/{runtime-queries-BtTx8FU3.mjs → runtime-queries-CJSpbsBq.mjs} +3 -3
  71. package/dist/node/{runtime-queries-BtTx8FU3.mjs.map → runtime-queries-CJSpbsBq.mjs.map} +1 -1
  72. package/dist/node/{trigger-text-CtSXg0KB.mjs → trigger-text-C6BlOwck.mjs} +5 -5
  73. package/dist/node/trigger-text-C6BlOwck.mjs.map +1 -0
  74. package/dist/node/upgrade-manifests-7SFwDrhd.mjs +8 -0
  75. package/dist/node/{upgrade-manifests-D-pLniUG.mjs.map → upgrade-manifests-7SFwDrhd.mjs.map} +1 -1
  76. package/dist/node/{workflow-Dy-309pE.mjs → workflow-7pmOvHmg.mjs} +2 -2
  77. package/dist/node/{workflow-Dy-309pE.mjs.map → workflow-7pmOvHmg.mjs.map} +1 -1
  78. package/dist/powerhouse.manifest.json +1 -1
  79. package/dist/style.css +29 -14
  80. package/dist/types/document-models/connection/v1/actions.d.ts +2 -0
  81. package/dist/types/document-models/connection/v1/actions.d.ts.map +1 -1
  82. package/dist/types/document-models/connection/v1/gen/config/actions.d.ts +10 -2
  83. package/dist/types/document-models/connection/v1/gen/config/actions.d.ts.map +1 -1
  84. package/dist/types/document-models/connection/v1/gen/config/creators.d.ts +4 -2
  85. package/dist/types/document-models/connection/v1/gen/config/creators.d.ts.map +1 -1
  86. package/dist/types/document-models/connection/v1/gen/config/error.d.ts +15 -1
  87. package/dist/types/document-models/connection/v1/gen/config/error.d.ts.map +1 -1
  88. package/dist/types/document-models/connection/v1/gen/config/operations.d.ts +3 -1
  89. package/dist/types/document-models/connection/v1/gen/config/operations.d.ts.map +1 -1
  90. package/dist/types/document-models/connection/v1/gen/document-model.d.ts.map +1 -1
  91. package/dist/types/document-models/connection/v1/gen/reducer.d.ts.map +1 -1
  92. package/dist/types/document-models/connection/v1/gen/schema/types.d.ts +7 -0
  93. package/dist/types/document-models/connection/v1/gen/schema/types.d.ts.map +1 -1
  94. package/dist/types/document-models/connection/v1/gen/schema/zod.d.ts +3 -1
  95. package/dist/types/document-models/connection/v1/gen/schema/zod.d.ts.map +1 -1
  96. package/dist/types/document-models/connection/v1/module.d.ts +2 -0
  97. package/dist/types/document-models/connection/v1/module.d.ts.map +1 -1
  98. package/dist/types/document-models/connection/v1/src/reducers/config.d.ts.map +1 -1
  99. package/dist/types/document-models/connection/v1/tests/config-values.test.d.ts +2 -0
  100. package/dist/types/document-models/connection/v1/tests/config-values.test.d.ts.map +1 -0
  101. package/dist/types/document-models/document-models.d.ts +5 -0
  102. package/dist/types/document-models/document-models.d.ts.map +1 -1
  103. package/dist/types/document-models/workflow/v1/actions.d.ts +3 -0
  104. package/dist/types/document-models/workflow/v1/actions.d.ts.map +1 -1
  105. package/dist/types/document-models/workflow/v1/gen/document-model.d.ts.map +1 -1
  106. package/dist/types/document-models/workflow/v1/gen/reducer.d.ts.map +1 -1
  107. package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts +16 -0
  108. package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts.map +1 -1
  109. package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts +5 -1
  110. package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts.map +1 -1
  111. package/dist/types/document-models/workflow/v1/gen/trigger/actions.d.ts +14 -2
  112. package/dist/types/document-models/workflow/v1/gen/trigger/actions.d.ts.map +1 -1
  113. package/dist/types/document-models/workflow/v1/gen/trigger/creators.d.ts +5 -2
  114. package/dist/types/document-models/workflow/v1/gen/trigger/creators.d.ts.map +1 -1
  115. package/dist/types/document-models/workflow/v1/gen/trigger/error.d.ts +32 -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/trigger/operations.d.ts +4 -1
  118. package/dist/types/document-models/workflow/v1/gen/trigger/operations.d.ts.map +1 -1
  119. package/dist/types/document-models/workflow/v1/module.d.ts +3 -0
  120. package/dist/types/document-models/workflow/v1/module.d.ts.map +1 -1
  121. package/dist/types/document-models/workflow/v1/src/reducers/trigger.d.ts.map +1 -1
  122. package/dist/types/document-models/workflow/v1/tests/trigger-fields.test.d.ts +2 -0
  123. package/dist/types/document-models/workflow/v1/tests/trigger-fields.test.d.ts.map +1 -0
  124. package/dist/types/editors/connection-editor/ReactorConnectionSettings.d.ts.map +1 -1
  125. package/dist/types/editors/connection-editor/connection-callbacks.d.ts.map +1 -1
  126. package/dist/types/editors/connection-editor/connection-form.d.ts +2 -2
  127. package/dist/types/editors/connection-editor/connection-form.d.ts.map +1 -1
  128. package/dist/types/editors/runtime/index.d.ts +21 -0
  129. package/dist/types/editors/runtime/index.d.ts.map +1 -0
  130. package/dist/types/editors/runtime/runtime-export.test.d.ts +2 -0
  131. package/dist/types/editors/runtime/runtime-export.test.d.ts.map +1 -0
  132. package/dist/types/editors/shared/pending-echo.d.ts +9 -0
  133. package/dist/types/editors/shared/pending-echo.d.ts.map +1 -0
  134. package/dist/types/editors/workflow-editor/document/useWorkflowModel.d.ts.map +1 -1
  135. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
  136. package/dist/types/editors/workflow-editor/ui/ScheduleBuilder.d.ts.map +1 -1
  137. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
  138. package/dist/types/editors/workflow-editor/ui/model.d.ts +6 -0
  139. package/dist/types/editors/workflow-editor/ui/model.d.ts.map +1 -1
  140. package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts.map +1 -1
  141. package/dist/types/editors/workflow-studio/components/WorkflowGraph.d.ts.map +1 -1
  142. package/dist/types/editors/workflow-studio/components/chain.d.ts +3 -1
  143. package/dist/types/editors/workflow-studio/components/chain.d.ts.map +1 -1
  144. package/dist/types/editors/workflow-studio/components/tips.d.ts +23 -0
  145. package/dist/types/editors/workflow-studio/components/tips.d.ts.map +1 -0
  146. package/dist/types/scripts/ui-stack.d.ts.map +1 -1
  147. package/dist/types/test/ui/harness/property-form-echo.d.ts +12 -0
  148. package/dist/types/test/ui/harness/property-form-echo.d.ts.map +1 -0
  149. package/dist/types/test/ui/harness/schedule-builder.d.ts +8 -0
  150. package/dist/types/test/ui/harness/schedule-builder.d.ts.map +1 -0
  151. package/dist/types/test/ui/property-form-echo.spec.d.ts +2 -0
  152. package/dist/types/test/ui/property-form-echo.spec.d.ts.map +1 -0
  153. package/dist/types/test/ui/schedule-builder.spec.d.ts +2 -0
  154. package/dist/types/test/ui/schedule-builder.spec.d.ts.map +1 -0
  155. package/package.json +14 -8
  156. package/dist/browser/connection-form-cCgfAa1A.js.map +0 -1
  157. package/dist/browser/editor-CQyfDOIN.js.map +0 -1
  158. package/dist/browser/editor-CbpyTAEC.js.map +0 -1
  159. package/dist/browser/module-B2BMwu5E.js.map +0 -1
  160. package/dist/browser/module-ozS5EVRx.js.map +0 -1
  161. package/dist/browser/trigger-text-Cfyx8tMq.js.map +0 -1
  162. package/dist/browser/upgrade-manifests-DHGmgHKW.js +0 -8
  163. package/dist/node/connection-form-h0PidbTI.mjs.map +0 -1
  164. package/dist/node/editor-DCsT8WsQ.mjs.map +0 -1
  165. package/dist/node/editor-EeTeVS3A.mjs.map +0 -1
  166. package/dist/node/module-BlT-atBQ.mjs.map +0 -1
  167. package/dist/node/module-uKdoLIga.mjs.map +0 -1
  168. package/dist/node/trigger-text-CtSXg0KB.mjs.map +0 -1
  169. package/dist/node/upgrade-manifests-D-pLniUG.mjs +0 -8
@@ -1 +0,0 @@
1
- {"version":3,"file":"editor-EeTeVS3A.mjs","names":["RING","RAIL","addFolder","workflowActions","WORKFLOW_TYPE","RING","workflowActions","WORKFLOW_TYPE","workflowActions"],"sources":["../../editors/workflow-studio/components/step-outline.ts","../../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/workflow-order.ts","../../editors/workflow-studio/components/WorkflowMenu.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/ScrollFade.tsx","../../editors/workflow-studio/components/use-collapsed.ts","../../editors/workflow-studio/components/graph-layout.ts","../../editors/workflow-studio/components/WorkflowGraph.tsx","../../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":["// Lists a workflow's steps in the order a run reaches them, so the studio\n// can show the shape of a workflow without drawing the canvas.\n\nexport interface OutlineStep {\n id: string;\n key: string;\n name: string;\n pieceName: string;\n pieceVersion: string;\n actionName: 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 of the first inbound edge decided; null on an entry and \"next\".\n port: string | null;\n}\n\nexport interface StepOutline {\n rows: OutlineRow[];\n // Steps a run never reaches: unreachable, cyclic or fed by a missing step.\n orphans: OutlineStep[];\n}\n\n// The coordinator's order (reactor-workflow runWorkflow): passes over the\n// steps array, each step once every inbound edge is decided (an OR join).\nexport function stepOutline(args: {\n triggerId?: string | null;\n steps: readonly OutlineStep[];\n edges: readonly OutlineEdge[];\n}): StepOutline {\n const inbound = new Map<string, OutlineEdge[]>();\n for (const edge of args.edges) {\n const list = inbound.get(edge.to) ?? [];\n list.push(edge);\n inbound.set(edge.to, list);\n }\n // A source's edges are all decided once it runs or is skipped; which port\n // it takes changes what runs, never the order steps are reached in.\n const decided: string[] = args.triggerId ? [args.triggerId] : [];\n const rows: OutlineRow[] = [];\n const seen = new Set<string>();\n const firstDecided = (edges: OutlineEdge[]) =>\n edges.reduce((first, edge) =>\n decided.indexOf(edge.from) < decided.indexOf(first.from) ? edge : first,\n );\n\n let progressed = true;\n while (progressed) {\n progressed = false;\n for (const step of args.steps) {\n if (seen.has(step.id)) continue;\n const edges = inbound.get(step.id) ?? [];\n const entry = !args.triggerId && edges.length === 0;\n if (!entry) {\n if (edges.length === 0) continue;\n if (!edges.every((edge) => decided.includes(edge.from))) continue;\n }\n seen.add(step.id);\n decided.push(step.id);\n const port = entry ? null : firstDecided(edges).port;\n rows.push({ step, port: port === \"next\" ? null : port });\n progressed = true;\n }\n }\n\n return {\n rows,\n orphans: args.steps.filter((step) => !seen.has(step.id)),\n };\n}\n","// 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-client.js\";\nimport { BlockLogo } from \"../../workflow-editor/ui/BlockSelector.js\";\nimport {\n CORE_PIECE,\n stepBlock,\n type BlockIdentity,\n} from \"../../workflow-editor/ui/blocks.js\";\nimport { stepOutline } from \"./step-outline.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 block: BlockIdentity;\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 dark:ring-foreground/30\",\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 dark:bg-foreground/30\",\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 ${\n md ? \"h-8 w-8\" : \"h-6 w-6\"\n } ${\n link.status === \"SKIPPED\"\n ? \"border-[1.5px] border-dashed border-foreground/40\"\n : `ring-[1.5px] dark:bg-white ${RING[tones[index]]}`\n }`}\n >\n <span\n className={link.status === \"SKIPPED\" ? \"flex opacity-40\" : \"flex\"}\n >\n <BlockLogo bare block={link.block} size={md ? 16 : 14} />\n </span>\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// The trigger a run's kind names: \"piece:<pieceName>:<triggerName>\" for a\n// piece trigger, else one of the core piece's.\nexport function triggerOfKind(kind: string): BlockIdentity {\n if (kind.startsWith(\"piece:\")) {\n const rest = kind.slice(\"piece:\".length);\n const colon = rest.indexOf(\":\");\n if (colon > 0) {\n return {\n pieceName: rest.slice(0, colon),\n kind: \"trigger\",\n name: rest.slice(colon + 1),\n };\n }\n }\n return { pieceName: CORE_PIECE, kind: \"trigger\", name: kind };\n}\n\n/** A workflow's steps in the order a run reaches them, coloured by a run. */\nexport function workflowLinks(\n workflow: Parameters<typeof stepOutline>[0],\n latest?: RunRecord,\n): ChainLink[] {\n const status = new Map(\n (latest?.steps ?? []).map((step) => [step.stepKey, step.status]),\n );\n return stepOutline(workflow).rows.map(({ step }) => ({\n id: step.id,\n block: stepBlock(step),\n label: step.name || step.key,\n status: status.get(step.key),\n }));\n}\n\n/** A run's own chain: the trigger, then every step it recorded. */\nexport function runLinks(run: RunRecord, trigger?: BlockIdentity): ChainLink[] {\n return [\n {\n id: \"trigger\",\n block: trigger ?? triggerOfKind(run.triggerKind),\n label: \"Trigger\",\n status: \"SUCCEEDED\",\n },\n ...run.steps.map((step) => ({\n id: step.stepId + step.stepKey,\n block: {\n pieceName: step.pieceName,\n kind: \"action\" as const,\n name: step.blockName,\n },\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: {\n runs: RunRecord[];\n // Dots on the strip's centre line rather than its foot, to sit on a text line.\n centered?: boolean;\n}) {\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 gap-[3px] ${props.centered ? \"items-center\" : \"items-end\"}`}\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: {\n tone: Tone;\n // Defaults to hollow for the idle tone.\n hollow?: boolean;\n className?: string;\n}) {\n const hollow = props.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 // Replaces the status's own label, e.g. \"Succeeded, 1 warning\".\n label?: 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 {props.label ?? 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 type {\n RunRecord,\n RunStepRecord,\n} from \"../../workflow-editor/runtime-client.js\";\nimport {\n useRunQuery,\n useRuntimeActions,\n} from \"../../workflow-editor/runtime-context.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 canRerun,\n formatMs,\n formatTrigger,\n formatWhen,\n durationMs,\n RUN_STATUSES,\n runStatusLabel,\n runTimeline,\n runTone,\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, triggerOfKind } from \"./chain.js\";\nimport { triggerBlock } from \"../../workflow-editor/ui/blocks.js\";\nimport { Select } from \"../../shared/controls.js\";\nimport { DataViewer } from \"../../shared/data-viewer.js\";\nimport { Button, Icon, StatusText } from \"./ui.js\";\nimport { StepError } from \"../../workflow-editor/ui/StepError.js\";\n\ntype StatusFilter = \"ALL\" | (typeof RUN_STATUSES)[number];\ntype SortKey = \"startedAt\" | \"duration\";\n\nconst DETAIL_POLL_MS = 5000;\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 // The listing row has no input or output; the run's own fetch brings them.\n dataPending?: boolean;\n dataError?: string | null;\n}) {\n const { step } = props;\n const meta = blockMeta({\n pieceName: step.pieceName,\n kind: \"action\",\n name: step.blockName,\n });\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 ? <StepError error={step.error} /> : null}\n {step.status === \"SKIPPED\" ? (\n <p className=\"text-xs text-muted-foreground\">\n The run never reached this step.\n </p>\n ) : props.dataError ? (\n <p className=\"text-xs text-wf-warn\">\n Couldn't load what this step received and produced.\n <span className=\"mt-0.5 block opacity-80\">{props.dataError}</span>\n </p>\n ) : props.dataPending ? (\n <p className=\"text-xs text-muted-foreground\">Loading step data…</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's kind names its trigger; name it as the workflow list does.\n if (kind.startsWith(\"piece:\")) {\n const trigger = triggerOfKind(kind);\n return describeTrigger({\n pieceName: trigger.pieceName,\n triggerName: trigger.name,\n config: null,\n });\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 { names } = props;\n const { rerunRun } = useRuntimeActions();\n // The listing leaves step input and output out; the open run reads them.\n const full = useRunQuery(props.run.id, { pollMs: DETAIL_POLL_MS });\n const run = full.data ?? props.run;\n const dataPending = full.data === undefined && full.status === \"pending\";\n const dataError =\n full.status === \"error\"\n ? full.error instanceof Error\n ? full.error.message\n : String(full.error)\n : null;\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 {run.warningNotes.length > 0 ? (\n <ul\n aria-label=\"Run warnings\"\n className=\"space-y-1 rounded-md bg-wf-warn/10 px-3 py-2 text-[13px] text-wf-warn\"\n >\n {run.warningNotes.map((note) => (\n <li key={note}>{note}</li>\n ))}\n </ul>\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 {canRerun(run) ? (\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 dataPending={dataPending}\n dataError={dataError}\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 triggerBlocks = new Map(\n documents.map((document) => {\n const trigger = document.state.global.trigger;\n return [document.header.id, trigger ? triggerBlock(trigger) : undefined];\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={runTone(run)}\n status={run.status}\n label={runStatusLabel(run)}\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 triggerBlocks.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-client.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 // Older runs past the loaded pages.\n hasMore?: boolean;\n loadingMore?: boolean;\n onLoadMore?: () => void;\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 <>\n <RunsTable\n runs={runs}\n showWorkflow={props.showWorkflow}\n onChanged={props.reload}\n />\n {props.hasMore && props.onLoadMore ? (\n <div className=\"mt-3 flex justify-center\">\n <Button\n disabled={props.loadingMore}\n onClick={() => props.onLoadMore!()}\n >\n {props.loadingMore ? \"Loading…\" : \"Load older runs\"}\n </Button>\n </div>\n ) : null}\n </>\n )}\n </div>\n );\n}\n","// Sidebar order of workflows. The drive sorts nodes by id, so each workflow\n// lives in a root \"home\" folder named \"<key> · <name>\" and sorts by that key.\nimport {\n addFolder,\n moveNode,\n updateNode,\n type DocumentDriveAction,\n type FileNode,\n type FolderNode,\n type Node,\n} from \"@powerhousedao/shared/document-drive\";\nimport { generateId } from \"document-model\";\n\n// Ascending in code-unit order, which is how keys compare.\nconst DIGITS = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";\nconst HOME_FOLDER = /^([0-9A-Za-z]+) · (.*)$/s;\n\nexport type OrderedWorkflow = {\n node: FileNode;\n /** The home folder, when the workflow has one. */\n folder?: FolderNode;\n key?: string;\n};\n\nfunction compareKeys(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\n// Fractional digits strictly between a and b (b null: unbounded). Requires\n// a < b and neither ending in \"0\".\nfunction midpoint(a: string, b: string | null): string {\n if (b !== null) {\n let n = 0;\n while ((a[n] ?? \"0\") === b[n]) n++;\n if (n > 0) return b.slice(0, n) + midpoint(a.slice(n), b.slice(n));\n }\n const digitA = a ? DIGITS.indexOf(a[0]) : 0;\n const digitB = b !== null ? DIGITS.indexOf(b[0]) : DIGITS.length;\n if (digitB - digitA > 1) return DIGITS[Math.round((digitA + digitB) / 2)];\n if (b !== null && b.length > 1) return b.slice(0, 1);\n return DIGITS[digitA] + midpoint(a.slice(1), null);\n}\n\n/** A key that sorts after `before` and before `after`. */\nexport function keyBetween(\n before: string | null | undefined,\n after: string | null | undefined,\n): string {\n return midpoint(before ?? \"\", after ?? null);\n}\n\n/** `count` ascending keys, evenly spread. */\nexport function spreadKeys(count: number): string[] {\n let width = 1;\n while (DIGITS.length ** width <= count) width++;\n const span = DIGITS.length ** width;\n return Array.from({ length: count }, (_, i) => {\n let value = Math.floor(((i + 1) * span) / (count + 1));\n let key = \"\";\n for (let d = 0; d < width; d++) {\n key = DIGITS[value % DIGITS.length] + key;\n value = Math.floor(value / DIGITS.length);\n }\n return key.replace(/0+$/, \"\");\n });\n}\n\nexport function homeFolderName(key: string, name: string): string {\n return `${key} · ${name || \"Workflow\"}`;\n}\n\n// Sidebar order: workflows without a home folder first by id, then by key.\n// A home folder is a keyed root folder holding only its workflow.\nexport function orderWorkflows(\n workflows: FileNode[],\n nodes: readonly Node[],\n): OrderedWorkflow[] {\n const byId = new Map(nodes.map((node) => [node.id, node]));\n const childCount = new Map<string, number>();\n for (const node of nodes) {\n if (node.parentFolder)\n childCount.set(\n node.parentFolder,\n (childCount.get(node.parentFolder) ?? 0) + 1,\n );\n }\n const ordered = workflows.map((node): OrderedWorkflow => {\n const parent = node.parentFolder ? byId.get(node.parentFolder) : undefined;\n if (\n parent?.kind !== \"folder\" ||\n parent.parentFolder ||\n childCount.get(parent.id) !== 1\n )\n return { node };\n const match = HOME_FOLDER.exec(parent.name);\n return match\n ? { node, folder: parent as FolderNode, key: match[1] }\n : { node };\n });\n return ordered.sort((a, b) => {\n if (a.key === undefined || b.key === undefined) {\n if (a.key !== b.key) return a.key === undefined ? -1 : 1;\n } else {\n const byKey = compareKeys(a.key, b.key);\n if (byKey !== 0) return byKey;\n }\n return compareKeys(a.node.id, b.node.id);\n });\n}\n\n/** The key for a new workflow, after every other one. */\nexport function nextKey(ordered: OrderedWorkflow[]): string {\n return keyBetween(ordered.at(-1)?.key, null);\n}\n\n/** The node to delete to remove a workflow: its home folder, if it has one. */\nexport function deletionTarget(\n workflowId: string,\n nodes: readonly Node[],\n): Node | undefined {\n const node = nodes.find((n) => n.id === workflowId);\n if (node?.kind !== \"file\") return node;\n return orderWorkflows([node as FileNode], nodes)[0].folder ?? node;\n}\n\n// Drive node names can be stale or ids, so callers pass document names.\nfunction folderTail(\n item: OrderedWorkflow,\n names: ReadonlyMap<string, string>,\n): string {\n const name = names.get(item.node.id) || item.node.name;\n return item.folder ? (HOME_FOLDER.exec(item.folder.name)?.[2] ?? name) : name;\n}\n\n// Moves the workflow at `from` to index `to` of the list without it: one\n// rename, or fresh keys and home folders for all when neighbours lack keys.\nexport function reorderActions(\n ordered: OrderedWorkflow[],\n from: number,\n to: number,\n names: ReadonlyMap<string, string> = new Map(),\n): DocumentDriveAction[] {\n if (from === to || !ordered[from]) return [];\n const next = [...ordered];\n const [moved] = next.splice(from, 1);\n next.splice(to, 0, moved);\n\n const before = to > 0 ? next[to - 1] : undefined;\n const after = to < next.length - 1 ? next[to + 1] : undefined;\n const canSplice =\n moved.folder &&\n (!before || before.key !== undefined) &&\n (!after || after.key !== undefined) &&\n (!before || !after || compareKeys(before.key!, after.key!) < 0);\n if (canSplice) {\n const key = keyBetween(before?.key, after?.key);\n return [\n updateNode({\n id: moved.folder!.id,\n name: homeFolderName(key, folderTail(moved, names)),\n }),\n ];\n }\n\n const keys = spreadKeys(next.length);\n return next.flatMap((item, i): DocumentDriveAction[] => {\n const name = homeFolderName(keys[i], folderTail(item, names));\n if (item.folder) {\n return item.folder.name === name\n ? []\n : [updateNode({ id: item.folder.id, name })];\n }\n const folderId = generateId();\n return [\n addFolder({ id: folderId, name, parentFolder: null }),\n moveNode({ srcFolder: item.node.id, targetParentFolder: folderId }),\n ];\n });\n}\n","// The \"…\" menu for one workflow: archive or restore it, and delete it behind\n// a confirmation that asks for its exact name.\nimport { Modal } from \"@powerhousedao/design-system\";\nimport { deleteNode, useDispatch } from \"@powerhousedao/reactor-browser\";\nimport {\n actions as workflowActions,\n type WorkflowDocument,\n} from \"document-models/workflow\";\nimport { useEffect, useId, useRef, useState } from \"react\";\nimport { Button, textInputClass } from \"../../shared/controls.js\";\nimport { Icon } from \"../../shared/icons.js\";\nimport { deletionTarget } from \"./workflow-order.js\";\n\n/** Deletes a workflow with its home folder, reading the drive's nodes now. */\nexport async function deleteWorkflow(workflowId: string): Promise<void> {\n const driveId = window.ph?.selectedDriveId;\n if (!driveId) throw new Error(\"No drive is selected\");\n const nodes =\n window.ph?.drives?.find((drive) => drive.header.id === driveId)?.state\n .global.nodes ?? [];\n await deleteNode(\n driveId,\n deletionTarget(workflowId, nodes)?.id ?? workflowId,\n );\n}\n\nexport function DeleteWorkflowDialog(props: {\n name: string;\n onCancel: () => void;\n onConfirm: () => Promise<void>;\n}) {\n const [typed, setTyped] = useState(\"\");\n const [error, setError] = useState<string | null>(null);\n const [deleting, setDeleting] = useState(false);\n const inputId = useId();\n const cancelRef = useRef<HTMLButtonElement>(null);\n const matches = typed === props.name;\n return (\n <Modal\n open\n title=\"Delete workflow\"\n onOpenChange={(open) => {\n if (!open) props.onCancel();\n }}\n contentProps={{\n className:\n \"w-[28rem] max-w-[92vw] rounded-xl border border-solid border-foreground/10\",\n role: \"alertdialog\",\n \"aria-label\": \"Delete workflow\",\n // Cancel takes the focus, so Enter never deletes by accident.\n onOpenAutoFocus: (event) => {\n event.preventDefault();\n cancelRef.current?.focus();\n },\n }}\n >\n <form\n className=\"flex flex-col gap-4 p-6\"\n onSubmit={(event) => {\n event.preventDefault();\n if (!matches || deleting) return;\n setDeleting(true);\n props.onConfirm().catch((cause: unknown) => {\n setDeleting(false);\n setError(cause instanceof Error ? cause.message : String(cause));\n });\n }}\n >\n <div>\n <h2 className=\"text-[15px] font-semibold text-foreground\">\n Delete workflow\n </h2>\n <p className=\"mt-1 text-[13px] text-muted-foreground\">\n This removes the workflow from the drive and can&apos;t be undone.\n To archive it instead, use Archive.\n </p>\n </div>\n <label htmlFor={inputId} className=\"flex flex-col gap-1.5\">\n <span className=\"text-[13px] text-foreground\">\n Type <strong className=\"font-semibold\">{props.name}</strong> to\n confirm\n </span>\n <input\n id={inputId}\n className={textInputClass}\n value={typed}\n spellCheck={false}\n autoComplete=\"off\"\n onChange={(event) => setTyped(event.target.value)}\n />\n </label>\n {error ? <p className=\"text-xs text-wf-fail\">{error}</p> : null}\n <div className=\"flex justify-end gap-2\">\n <Button ref={cancelRef} onClick={props.onCancel}>\n Cancel\n </Button>\n <Button\n type=\"submit\"\n variant=\"destructive\"\n disabled={!matches || deleting}\n >\n {deleting ? \"Deleting…\" : \"Delete workflow\"}\n </Button>\n </div>\n </form>\n </Modal>\n );\n}\n\nfunction MenuItem(props: {\n label: string;\n icon: \"archive\" | \"trash\" | \"retry\";\n danger?: boolean;\n onSelect: () => void;\n}) {\n return (\n <button\n type=\"button\"\n role=\"menuitem\"\n className={`flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-[13px] hover:bg-accent focus-visible:bg-accent focus-visible:outline-none ${\n props.danger ? \"text-wf-fail\" : \"text-foreground\"\n }`}\n onClick={props.onSelect}\n >\n <Icon name={props.icon} className=\"h-3.5 w-3.5\" />\n {props.label}\n </button>\n );\n}\n\nexport function WorkflowMenu(props: {\n document: WorkflowDocument;\n // Falls back to the drive node's name while the state has none.\n nodeName?: string;\n onDeleted?: () => void;\n // Revealed on row hover rather than always drawn.\n subtle?: boolean;\n}) {\n const [open, setOpen] = useState(false);\n const [confirming, setConfirming] = useState(false);\n const [, dispatch] = useDispatch(props.document);\n const ref = useRef<HTMLDivElement>(null);\n const state = props.document.state.global;\n const name = state.name || props.nodeName || \"Untitled workflow\";\n const archived = state.status === \"ARCHIVED\";\n\n useEffect(() => {\n if (!open) return;\n const close = (event: MouseEvent) => {\n if (!ref.current?.contains(event.target as globalThis.Node)) {\n setOpen(false);\n }\n };\n const escape = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") setOpen(false);\n };\n window.addEventListener(\"mousedown\", close);\n window.addEventListener(\"keydown\", escape);\n return () => {\n window.removeEventListener(\"mousedown\", close);\n window.removeEventListener(\"keydown\", escape);\n };\n }, [open]);\n\n return (\n <div ref={ref} className=\"relative\">\n <button\n type=\"button\"\n aria-label={`More actions for ${name}`}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n className={`flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${\n props.subtle && !open ? \"opacity-0 group-hover:opacity-100\" : \"\"\n }`}\n onClick={(event) => {\n event.stopPropagation();\n setOpen((value) => !value);\n }}\n >\n <Icon name=\"more\" className=\"h-4 w-4\" />\n </button>\n {open ? (\n <div\n role=\"menu\"\n className=\"absolute right-0 top-full z-50 mt-1 w-44 rounded-md border border-solid border-foreground/10 bg-card p-1 shadow-lg\"\n >\n <MenuItem\n label={archived ? \"Restore\" : \"Archive\"}\n icon={archived ? \"retry\" : \"archive\"}\n onSelect={() => {\n setOpen(false);\n // A restored workflow comes back off; a draft stays a draft.\n const status = archived\n ? state.published\n ? \"DISABLED\"\n : \"DRAFT\"\n : \"ARCHIVED\";\n dispatch(workflowActions.setWorkflowStatus({ status }));\n }}\n />\n <MenuItem\n label=\"Delete…\"\n icon=\"trash\"\n danger\n onSelect={() => {\n setOpen(false);\n setConfirming(true);\n }}\n />\n </div>\n ) : null}\n {confirming ? (\n <DeleteWorkflowDialog\n name={name}\n onCancel={() => setConfirming(false)}\n onConfirm={async () => {\n await deleteWorkflow(props.document.header.id);\n setConfirming(false);\n props.onDeleted?.();\n }}\n />\n ) : null}\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 {\n useEffect,\n useId,\n useState,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\nimport { errorMessage } from \"../../shared/DocumentErrorBoundary.js\";\nimport { CONNECTION_TONE, toneOf, workflowHealth } from \"./run-format.js\";\nimport type { WorkflowDocument } from \"document-models/workflow\";\nimport { Icon, StatusDot } from \"./ui.js\";\nimport {\n DeleteWorkflowDialog,\n deleteWorkflow,\n WorkflowMenu,\n} from \"./WorkflowMenu.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): {\n status?: string;\n published: boolean;\n} {\n const state = (\n document as {\n state?: { global?: { status?: string; published?: unknown } };\n } | null\n )?.state?.global;\n return { status: state?.status, published: Boolean(state?.published) };\n}\n\nfunction Row(props: {\n active: boolean;\n onClick: () => void;\n onKeyDown?: (event: KeyboardEvent) => void;\n keyShortcuts?: string;\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 onKeyDown={props.onKeyDown}\n aria-keyshortcuts={props.keyShortcuts}\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\n// Workflows confirm by their own name; their home folder goes with them.\nfunction DeleteButton(props: { node: FileNode; label: string }) {\n const [confirming, setConfirming] = useState(false);\n const isWorkflow = props.node.documentType === WORKFLOW_TYPE;\n return (\n <>\n <button\n type=\"button\"\n title=\"Delete\"\n aria-label={`Delete ${props.label}`}\n className={DELETE_ACTION}\n onClick={() =>\n isWorkflow ? setConfirming(true) : showDeleteNodeModal(props.node)\n }\n >\n <Icon name=\"trash\" className=\"h-3.5 w-3.5\" />\n </button>\n {confirming ? (\n <DeleteWorkflowDialog\n name={props.label}\n onCancel={() => setConfirming(false)}\n onConfirm={async () => {\n await deleteWorkflow(props.node.id);\n setConfirming(false);\n }}\n />\n ) : null}\n </>\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 onKeyDown?: (event: KeyboardEvent) => void;\n keyShortcuts?: string;\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 onKeyDown={props.onKeyDown}\n keyShortcuts={props.keyShortcuts}\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, published } = documentStatus(document);\n const isWorkflow = node.documentType === WORKFLOW_TYPE;\n const { tone, label, hollow } = isWorkflow\n ? workflowHealth(status, props.lastRunStatus, published)\n : {\n tone: toneOf(CONNECTION_TONE, status),\n label: status,\n hollow: undefined,\n };\n return (\n <Row\n active={props.active}\n onClick={props.onOpen}\n onKeyDown={props.onKeyDown}\n keyShortcuts={props.keyShortcuts}\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 {isWorkflow && document ? (\n <WorkflowMenu\n subtle\n document={document as WorkflowDocument}\n nodeName={node.name}\n />\n ) : (\n <DeleteButton\n node={node}\n label={documentName(document, node.name)}\n />\n )}\n </span>\n }\n >\n <span title={label} className=\"flex\">\n <StatusDot tone={tone} hollow={hollow} />\n </span>\n <span className=\"min-w-0 truncate\">\n {documentName(document, node.name)}\n </span>\n </Row>\n );\n}\n\nfunction DropLine(props: { edge: \"top\" | \"bottom\" }) {\n return (\n <span\n aria-hidden\n className={`pointer-events-none absolute inset-x-3 z-10 h-0.5 rounded-full bg-primary ${\n props.edge === \"top\" ? \"-top-px\" : \"-bottom-px\"\n }`}\n />\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 // Moves the node at `from` to index `to` of the list without it.\n onReorder?: (from: number, to: number) => void;\n}) {\n const { onReorder } = props;\n const headingId = useId();\n // `at` is the insertion index among all rows, before the dragged one leaves.\n const [drag, setDrag] = useState<{ from: number; at: number } | null>(null);\n const count = props.nodes.length;\n const drop = (from: number, at: number) => {\n const to = at > from ? at - 1 : at;\n if (to !== from) onReorder?.(from, to);\n };\n const showLine = (at: number) =>\n drag !== null && drag.at === at && at !== drag.from && at !== drag.from + 1;\n return (\n <div className=\"mt-5\" role=\"group\" aria-labelledby={headingId}>\n <div className=\"mb-1 flex items-center justify-between pl-4 pr-3\">\n <h3\n id={headingId}\n className=\"text-xs font-medium text-muted-foreground\"\n >\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, i) => (\n <div\n key={node.id}\n className={`relative ${drag?.from === i ? \"opacity-50\" : \"\"}`}\n draggable={Boolean(onReorder)}\n onDragStart={(event) => {\n event.dataTransfer.effectAllowed = \"move\";\n event.dataTransfer.setData(\"text/plain\", node.id);\n setDrag({ from: i, at: i });\n }}\n onDragOver={(event) => {\n if (!drag) return;\n event.preventDefault();\n event.dataTransfer.dropEffect = \"move\";\n const box = event.currentTarget.getBoundingClientRect();\n const at = event.clientY < box.top + box.height / 2 ? i : i + 1;\n if (at !== drag.at) setDrag({ ...drag, at });\n }}\n onDrop={(event) => {\n event.preventDefault();\n if (drag) drop(drag.from, drag.at);\n setDrag(null);\n }}\n onDragEnd={() => setDrag(null)}\n >\n {showLine(i) ? <DropLine edge=\"top\" /> : null}\n <NodeRow\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 keyShortcuts={\n onReorder ? \"Alt+ArrowUp Alt+ArrowDown\" : undefined\n }\n onKeyDown={\n onReorder\n ? (event) => {\n if (!event.altKey) return;\n if (event.key === \"ArrowUp\" && i > 0) {\n event.preventDefault();\n onReorder(i, i - 1);\n } else if (event.key === \"ArrowDown\" && i < count - 1) {\n event.preventDefault();\n onReorder(i, i + 1);\n }\n }\n : undefined\n }\n />\n {i === count - 1 && showLine(count) ? (\n <DropLine edge=\"bottom\" />\n ) : null}\n </div>\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 onReorderWorkflow: (from: number, to: number) => 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 onReorder={props.onReorderWorkflow}\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 type Select = (id?: string, options?: { replace?: boolean }) => void;\n\n// Each selection is a history entry, so back and forward walk the studio;\n// `replace` is for corrections and for riding on an entry Connect just pushed.\nexport function useHashSelection(): [string | undefined, Select] {\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<Select>((id, options) => {\n setSelected(id);\n const url = new URL(window.location.href);\n url.hash = id ?? \"\";\n if (url.href === window.location.href) return;\n if (options?.replace) window.history.replaceState(null, \"\", url);\n else window.history.pushState(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 type {\n RunRecord,\n RunsScope,\n} from \"../../workflow-editor/runtime-client.js\";\nimport { useRunPagesQuery } from \"../../workflow-editor/runtime-context.js\";\nimport { runsOfPages } from \"../../workflow-editor/runtime-queries.js\";\n\nconst POLL_MS = 5000;\n\nexport interface RunsFeed {\n // Every page loaded so far, newest first.\n runs: RunRecord[] | null;\n error: string | null;\n reload: () => void;\n hasMore: boolean;\n loadingMore: boolean;\n loadMore: () => 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 query = useRunPagesQuery(\n { workflowId, driveId, limit },\n { active, pollMs: POLL_MS },\n );\n const { refetch, fetchNextPage } = query;\n return {\n runs: query.data ? runsOfPages(query.data.pages) : null,\n error:\n query.status === \"error\"\n ? query.error instanceof Error\n ? query.error.message\n : String(query.error)\n : null,\n reload: () => void refetch(),\n hasMore: query.hasNextPage,\n loadingMore: query.isFetchingNextPage,\n loadMore: () => void fetchNextPage(),\n };\n}\n","// Scrolls its content sideways and fades whichever edge has more to show,\n// so a wide workflow reads as cut off rather than as ending there.\nimport { useEffect, useRef, useState, type ReactNode } from \"react\";\n\nconst FADE = 40;\n\nfunction fadeMask(start: boolean, end: boolean): string | undefined {\n if (!start && !end) return undefined;\n const from = start ? `transparent, black ${FADE}px` : \"black\";\n const to = end ? `black calc(100% - ${FADE}px), transparent` : \"black\";\n return `linear-gradient(to right, ${from}, ${to})`;\n}\n\nexport function ScrollFade(props: {\n className?: string;\n // Clips instead of scrolling, for content inside something clickable.\n clip?: boolean;\n children: ReactNode;\n}) {\n const ref = useRef<HTMLSpanElement>(null);\n const [edges, setEdges] = useState({ start: false, end: false });\n\n useEffect(() => {\n const element = ref.current;\n if (!element) return;\n const measure = () => {\n const start = element.scrollLeft > 1;\n const end =\n element.scrollLeft + element.clientWidth < element.scrollWidth - 1;\n setEdges((prev) =>\n prev.start === start && prev.end === end ? prev : { start, end },\n );\n };\n measure();\n const resize = new ResizeObserver(measure);\n resize.observe(element);\n if (element.firstElementChild) resize.observe(element.firstElementChild);\n element.addEventListener(\"scroll\", measure, { passive: true });\n return () => {\n resize.disconnect();\n element.removeEventListener(\"scroll\", measure);\n };\n }, []);\n\n const mask = fadeMask(edges.start, edges.end);\n return (\n <span\n ref={ref}\n className={`block ${props.clip ? \"overflow-hidden\" : \"overflow-x-auto\"} ${props.className ?? \"\"}`}\n style={{ maskImage: mask, WebkitMaskImage: mask }}\n >\n {props.children}\n </span>\n );\n}\n","// Which overview rows are folded to their title line, kept per browser.\n// Storage can be missing or throw (private windows), so it is best effort.\nimport { useCallback, useState } from \"react\";\n\nconst KEY = \"workflow-studio:collapsed\";\n\nfunction read(): Set<string> {\n try {\n const parsed: unknown = JSON.parse(localStorage.getItem(KEY) ?? \"[]\");\n return new Set(\n Array.isArray(parsed)\n ? parsed.filter((id): id is string => typeof id === \"string\")\n : [],\n );\n } catch {\n return new Set();\n }\n}\n\nfunction write(ids: Set<string>) {\n try {\n localStorage.setItem(KEY, JSON.stringify([...ids]));\n } catch {\n // Folding still works for this visit.\n }\n}\n\nexport function useCollapsed() {\n const [collapsed, setCollapsed] = useState(read);\n const toggle = useCallback((id: string) => {\n setCollapsed((previous) => {\n const next = new Set(previous);\n if (!next.delete(id)) next.add(id);\n write(next);\n return next;\n });\n }, []);\n return { isCollapsed: (id: string) => collapsed.has(id), toggle };\n}\n","// Places a workflow on a grid for the horizontal overview graph: columns by\n// depth from the trigger, lanes so branches fan out below their source.\nimport {\n stepOutline,\n type OutlineEdge,\n type OutlineStep,\n} from \"./step-outline.js\";\n\nexport const TRIGGER_NODE = \"trigger\";\n\nexport interface GraphNode {\n step: OutlineStep;\n // 1 is the first column after the trigger.\n col: number;\n lane: number;\n // The port it runs on; null for \"next\", entries and joins.\n port: string | null;\n}\n\nexport interface GraphEdge {\n // A step id, or TRIGGER_NODE.\n from: string;\n to: string;\n port: string;\n // The lane its horizontal run follows between columns; `under` runs it in\n // the gutter below that lane when steps sit on both ends' lanes.\n track: { lane: number; under: boolean };\n}\n\nexport interface GraphLayout {\n nodes: GraphNode[];\n edges: GraphEdge[];\n cols: number;\n lanes: number;\n}\n\n// Ports that leave the main line and drop to a lower lane.\nconst SIDE_PORTS = new Set([\"false\", \"error\"]);\n\nexport function graphLayout(args: {\n triggerId?: string | null;\n steps: readonly OutlineStep[];\n edges: readonly OutlineEdge[];\n}): GraphLayout {\n const { rows } = stepOutline(args);\n const nodeId = (id: string) => (id === args.triggerId ? TRIGGER_NODE : id);\n const placed = new Map<string, { col: number; lane: number }>([\n [TRIGGER_NODE, { col: 0, lane: 0 }],\n ]);\n const taken = new Set<string>();\n const inbound = new Map<string, OutlineEdge[]>();\n const outbound = new Map<string, number>();\n for (const edge of args.edges) {\n const list = inbound.get(edge.to) ?? [];\n list.push(edge);\n inbound.set(edge.to, list);\n outbound.set(edge.from, (outbound.get(edge.from) ?? 0) + 1);\n }\n // A side port drops a lane only to clear the way for its source's other\n // path; a step's only way out stays on its lane.\n const drops = (edge: OutlineEdge) =>\n SIDE_PORTS.has(edge.port) && (outbound.get(edge.from) ?? 0) > 1;\n\n const nodes: GraphNode[] = [];\n for (const { step } of rows) {\n const from = (inbound.get(step.id) ?? []).filter((edge) =>\n placed.has(nodeId(edge.from)),\n );\n const col = Math.max(\n 1,\n ...from.map((edge) => placed.get(nodeId(edge.from))!.col + 1),\n );\n // A join stays on the highest lane any of its sources leads to.\n let lane = Math.min(\n ...from.map(\n (edge) => placed.get(nodeId(edge.from))!.lane + (drops(edge) ? 1 : 0),\n ),\n from.length === 0 ? 0 : Infinity,\n );\n const port =\n from.length === 1 && from[0].port !== \"next\" ? from[0].port : null;\n while (taken.has(`${col}:${lane}`)) lane++;\n taken.add(`${col}:${lane}`);\n placed.set(step.id, { col, lane });\n nodes.push({ step, col, lane, port });\n }\n\n const edges = args.edges\n .map((edge) => ({ ...edge, from: nodeId(edge.from) }))\n .filter((edge) => placed.has(edge.from) && placed.has(edge.to))\n .map((edge): GraphEdge => {\n const a = placed.get(edge.from)!;\n const b = placed.get(edge.to)!;\n const clear = (lane: number) =>\n !nodes.some(\n (node) => node.lane === lane && node.col > a.col && node.col < b.col,\n );\n // The lower lane first: a branch drops early, a join rises late.\n const low = Math.max(a.lane, b.lane);\n const high = Math.min(a.lane, b.lane);\n const track = clear(low)\n ? { lane: low, under: false }\n : clear(high)\n ? { lane: high, under: false }\n : { lane: high, under: true };\n return { from: edge.from, to: edge.to, port: edge.port, track };\n });\n return {\n nodes,\n edges,\n cols: Math.max(0, ...nodes.map((node) => node.col)),\n lanes: Math.max(1, ...nodes.map((node) => node.lane + 1)),\n };\n}\n","// The whole workflow, left to right: the trigger as a labelled pill, then\n// every step it reaches, branches included, coloured by the latest run.\nimport {\n ConnectTooltip,\n ConnectTooltipProvider,\n} from \"@powerhousedao/design-system/connect\";\nimport type { WorkflowState } from \"document-models/workflow\";\nimport {\n useLayoutEffect,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport type {\n RunRecord,\n RunStepRecord,\n} from \"../../workflow-editor/runtime-client.js\";\nimport { blockMeta } from \"../../workflow-editor/ui/block-meta.js\";\nimport { BlockLogo } from \"../../workflow-editor/ui/BlockSelector.js\";\nimport { stepBlock, triggerBlock } from \"../../workflow-editor/ui/blocks.js\";\nimport {\n graphLayout,\n TRIGGER_NODE,\n type GraphEdge,\n type GraphNode,\n} from \"./graph-layout.js\";\nimport {\n formatDuration,\n formatWhen,\n statusLabel,\n STEP_TONE,\n toneOf,\n type Tone,\n} from \"./run-format.js\";\n\n// Sizes: compact for the overview, larger for a workflow's own page; both\n// name each step under its circle.\nexport interface Geometry {\n r: number;\n col: number;\n lane: number;\n // The rail out of the trigger pill.\n lead: number;\n // Lane 0 lines up with the pill's centre.\n top: number;\n // How far a gutter track sits below its lane.\n dip: number;\n // Height of the name block under each circle; 0 for none.\n label: number;\n // The action's name under the step's name.\n subtitle: boolean;\n nameText: string;\n logo: number;\n circle: string;\n pill: string;\n pillLogo: string;\n // Centre of the pill's logo from its left edge: where a stacked rail drops.\n pillLogoX: number;\n // Port pill text size.\n portText: string;\n}\n\n// Room between a stacked trigger pill and the steps' first lane.\nconst STACK_GAP = 16;\n\nexport interface Room {\n // The width the graph may take, and its trigger pill's.\n width: number;\n pill: number;\n}\n\nexport interface GraphFit {\n g: Geometry;\n // The trigger pill sits on its own line above the steps.\n stacked: boolean;\n // Columns per row; rows alternate direction, like a snake.\n perRow: number;\n}\n\n// Columns widen into spare room up to this much, so names fit on fewer lines.\nconst MAX_STRETCH = 1.5;\n\n// Beside the trigger if it fits; else the trigger above, and the steps\n// wrapping onto rows. Either way the columns then share out spare width.\nexport function fitGraph(\n base: Geometry,\n cols: number,\n room: Room | null,\n): GraphFit {\n if (!room || room.width <= 0 || cols === 0) {\n return { g: base, stacked: false, perRow: Math.max(cols, 1) };\n }\n // Names may run half a column past the last circle.\n const tailOf = (col: number) => (base.label ? col / 2 : base.r);\n const span = (n: number, lead: number) =>\n lead + (n - 1) * base.col + base.r + tailOf(base.col);\n const beside = room.width - room.pill;\n const stacked = span(cols, base.lead) > beside;\n const lead = stacked ? base.pillLogoX * 2 : base.lead;\n const space = stacked ? room.width : beside;\n const fits =\n Math.floor((space - lead - base.r - tailOf(base.col)) / base.col) + 1;\n const perRow = stacked ? Math.min(cols, Math.max(2, fits)) : cols;\n // The widest column that still lets a full row end within the space.\n const fill = base.label\n ? (space - lead - base.r) / (perRow - 0.5)\n : perRow > 1\n ? (space - lead - 2 * base.r) / (perRow - 1)\n : base.col;\n const col = Math.floor(\n Math.min(base.col * MAX_STRETCH, Math.max(base.col, fill)),\n );\n return { g: { ...base, col, lead }, stacked, perRow };\n}\n\nexport const GEOMETRY: Record<\"sm\" | \"md\", Geometry> = {\n sm: {\n r: 12,\n // Room for a name on two 16px lines before it is cut.\n col: 144,\n // A circle, its two-line name, and a gutter a track can run in.\n lane: 80,\n // The rail between the trigger pill and the first step.\n lead: 40,\n top: 14,\n dip: 60,\n label: 34,\n subtitle: false,\n nameText: \"text-xs leading-4\",\n logo: 14,\n circle: \"h-6 w-6\",\n pill: \"h-7 pl-1 pr-2.5 text-[12px]\",\n pillLogo: \"h-5 w-5\",\n pillLogoX: 14,\n portText: \"text-[10px]\",\n },\n md: {\n r: 18,\n col: 168,\n // Two lines of name and one of the action under each circle.\n lane: 112,\n lead: 48,\n top: 18,\n dip: 86,\n label: 54,\n subtitle: true,\n nameText: \"text-[13px] leading-[18px]\",\n logo: 20,\n circle: \"h-9 w-9\",\n pill: \"h-9 pl-1.5 pr-3 text-[13px]\",\n pillLogo: \"h-6 w-6\",\n pillLogoX: 18,\n portText: \"text-[11px]\",\n },\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 dark:ring-foreground/30\",\n};\n\nconst STROKE: Record<Tone, string> = {\n ok: \"text-wf-ok\",\n fail: \"text-wf-fail\",\n warn: \"text-wf-warn\",\n run: \"text-wf-run\",\n idle: \"text-foreground/15 dark:text-foreground/30\",\n};\n\n// The canvas's words and tints for a port, on an opaque base so the pill\n// masks the line it sits on.\nconst PORT_PILL: Record<string, string> = {\n true: \"bg-wf-ok/10 text-wf-ok ring-wf-ok/30\",\n false: \"bg-foreground/5 text-muted-foreground ring-foreground/15\",\n error: \"bg-wf-fail/10 text-wf-fail ring-wf-fail/30\",\n};\n\nconst PORT_TEXT: Record<string, string> = {\n true: \"Runs when the condition is true\",\n false: \"Runs when the condition is false\",\n error: \"Runs when the step before it fails\",\n};\n\nexport type Point = [number, number];\n\n// An orthogonal polyline with rounded corners.\nfunction roundedPath(points: Point[], radius = 6): string {\n let d = `M ${points[0][0]} ${points[0][1]}`;\n for (let i = 1; i < points.length - 1; i++) {\n const [px, py] = points[i - 1];\n const [x, y] = points[i];\n const [nx, ny] = points[i + 1];\n const r = Math.min(\n radius,\n Math.hypot(x - px, y - py) / 2,\n Math.hypot(nx - x, ny - y) / 2,\n );\n const inX = x - Math.sign(x - px) * r;\n const inY = y - Math.sign(y - py) * r;\n const outX = x + Math.sign(nx - x) * r;\n const outY = y + Math.sign(ny - y) * r;\n d += ` L ${inX} ${inY} Q ${x} ${y} ${outX} ${outY}`;\n }\n const [lx, ly] = points[points.length - 1];\n return `${d} L ${lx} ${ly}`;\n}\n\ninterface Spot {\n x: number;\n y: number;\n row: number;\n // 1 on a row running left to right, -1 on one running back.\n dir: number;\n}\n\n// Drops repeated and straight-through points, which would round oddly; each\n// against the points kept, so a run of repeats cannot take a corner with it.\nexport function simplify(route: Point[]): Point[] {\n const points: Point[] = [];\n for (const point of route) {\n const last = points.at(-1);\n if (last && last[0] === point[0] && last[1] === point[1]) continue;\n const prev = points.at(-2);\n if (\n prev &&\n last &&\n ((prev[0] === last[0] && last[0] === point[0]) ||\n (prev[1] === last[1] && last[1] === point[1]))\n ) {\n points.pop();\n }\n points.push(point);\n }\n return points;\n}\n\n// Within a row, turns happen in the gutter between columns, onto and off the\n// edge's track: a lane's line, or the gutter under it.\nfunction edgeRoute(\n g: Geometry,\n source: Spot | null,\n target: Spot,\n trackY: number,\n // The trigger pill sits above the steps, so its rail drops in from the top.\n stacked: boolean,\n): {\n points: Point[];\n // Centre of the horizontal stretch a port pill sits on.\n label: { x: number; y: number };\n} {\n const dir = target.dir;\n const after = source ? source.x + (dir * g.col) / 2 : g.lead / 2;\n const fromAbove = !source && stacked;\n const x1 = source ? source.x + dir * g.r : fromAbove ? after : 0;\n const y1 = source ? source.y : fromAbove ? -STACK_GAP : g.top;\n const x2 = target.x - dir * g.r;\n const y2 = target.y;\n const before = target.x - (dir * g.col) / 2;\n const points = simplify([\n [x1, y1],\n [after, y1],\n [after, trackY],\n [before, trackY],\n [before, y2],\n [x2, y2],\n ]);\n const start = trackY === y1 ? x1 : after;\n const end = trackY === y2 ? x2 : before;\n return { points, label: { x: (start + end) / 2, y: trackY } };\n}\n\n// Into a later row: out past the end of the source's row, down, and in from\n// the side that row starts on; a row further down is reached above its line.\nfunction wrapRoute(\n g: Geometry,\n source: Spot,\n target: Spot,\n ends: { left: number; right: number },\n): { points: Point[]; label: { x: number; y: number } } {\n const turn = source.dir > 0 ? ends.right : ends.left;\n const x1 = source.x + source.dir * g.r;\n const before = target.x - (target.dir * g.col) / 2;\n const enters = (target.row - source.row) % 2 === 1;\n const y = enters ? target.y : target.y - g.lane / 2;\n const points = simplify([\n [x1, source.y],\n [turn, source.y],\n [turn, y],\n [before, y],\n [before, target.y],\n [target.x - target.dir * g.r, target.y],\n ]);\n return { points, label: { x: (x1 + turn) / 2, y: source.y } };\n}\n\n// A button when the graph opens something, else a plain mark inside a row\n// that is itself the button. Passes through the tooltip's ref and handlers.\nfunction Mark({\n label,\n className,\n onOpen,\n children,\n ref,\n onClick,\n ...rest\n}: {\n label: string;\n className: string;\n onOpen?: () => void;\n children: ReactNode;\n} & Omit<HTMLAttributes<HTMLElement>, \"className\" | \"children\"> & {\n ref?: Ref<HTMLElement>;\n }) {\n return onOpen ? (\n <button\n {...rest}\n ref={ref as Ref<HTMLButtonElement>}\n type=\"button\"\n aria-label={label}\n className={`${className} focus-visible:outline-none focus-visible:ring-[3px]`}\n onClick={(event) => {\n onClick?.(event);\n onOpen();\n }}\n >\n {children}\n </button>\n ) : (\n <span\n {...rest}\n ref={ref as Ref<HTMLSpanElement>}\n onClick={onClick}\n className={className}\n >\n {children}\n </span>\n );\n}\n\nfunction Tip(props: { content: ReactNode; children: ReactNode }) {\n return (\n <ConnectTooltip\n content={props.content}\n side=\"bottom\"\n delayDuration={100}\n className=\"max-w-64 rounded-md border-solid border-foreground/10 bg-card px-2.5 py-1.5 text-foreground shadow-lg\"\n >\n {props.children}\n </ConnectTooltip>\n );\n}\n\nfunction stepSummary(record: RunStepRecord | undefined, ran: boolean): string {\n if (!ran) return \"Not run yet\";\n if (!record) return \"Not reached in the latest run\";\n const took =\n record.startedAt && record.endedAt\n ? ` · ${formatDuration(record.startedAt, record.endedAt)}`\n : \"\";\n return `${statusLabel(record.status)} in the latest run${took}`;\n}\n\nfunction StepTip(props: {\n node: GraphNode;\n record?: RunStepRecord;\n ran: boolean;\n}) {\n const { step } = props.node;\n const meta = blockMeta(stepBlock(step));\n return (\n <span className=\"flex flex-col gap-0.5\">\n <span className=\"font-medium\">{step.name || step.key}</span>\n <span className=\"text-muted-foreground\">\n {meta.displayName} · {meta.subtitle}\n </span>\n {props.node.port ? (\n <span className=\"text-muted-foreground\">\n {PORT_TEXT[props.node.port] ?? `Runs on \"${props.node.port}\"`}\n </span>\n ) : null}\n <span className=\"mt-1\">{stepSummary(props.record, props.ran)}</span>\n {props.record?.error ? (\n <span className=\"line-clamp-3 text-wf-fail\">{props.record.error}</span>\n ) : null}\n </span>\n );\n}\n\nexport function WorkflowGraph(props: {\n state: WorkflowState;\n // How the trigger reads, e.g. \"Manual\" or \"Every day at 08:00 UTC\".\n triggerText: string;\n latest?: RunRecord;\n // Makes the trigger and every step a button.\n onOpen?: () => void;\n // \"md\" is larger and names each step under its circle.\n size?: \"sm\" | \"md\";\n // Wraps the steps onto rows, like a snake, rather than overflowing.\n fit?: boolean;\n}) {\n const { state, latest } = props;\n const frame = useRef<HTMLDivElement>(null);\n const pill = useRef<HTMLSpanElement>(null);\n const [room, setRoom] = useState<Room | null>(null);\n useLayoutEffect(() => {\n const element = frame.current;\n if (!props.fit || !element) return;\n const measure = () => {\n const next = {\n width: element.clientWidth,\n pill: pill.current?.offsetWidth ?? 0,\n };\n setRoom((prev) =>\n prev?.width === next.width && prev.pill === next.pill ? prev : next,\n );\n };\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(element);\n if (pill.current) observer.observe(pill.current);\n return () => observer.disconnect();\n }, [props.fit]);\n const layout = graphLayout({\n triggerId: state.trigger?.id,\n steps: state.steps,\n edges: state.edges,\n });\n const { g, stacked, perRow } = fitGraph(\n GEOMETRY[props.size ?? \"sm\"],\n layout.cols,\n props.fit ? room : null,\n );\n const rowOf = (col: number) => Math.floor((col - 1) / perRow);\n const rows = Math.max(1, Math.ceil(layout.cols / perRow));\n // Each row is as tall as the lanes its own steps use.\n const rowLanes = Array.from({ length: rows }, () => 1);\n for (const node of layout.nodes) {\n const row = rowOf(node.col);\n rowLanes[row] = Math.max(rowLanes[row], node.lane + 1);\n }\n const rowTop: number[] = [];\n for (let row = 0, y = g.top; row < rows; y += rowLanes[row] * g.lane, row++) {\n rowTop.push(y);\n }\n const spot = (col: number, lane: number): Spot => {\n const row = rowOf(col);\n const slot = (col - 1) % perRow;\n const back = row % 2 === 1;\n return {\n x: g.lead + (back ? perRow - 1 - slot : slot) * g.col + g.r,\n y: rowTop[row] + lane * g.lane,\n row,\n dir: back ? -1 : 1,\n };\n };\n const records = new Map(\n (latest?.steps ?? []).map((record) => [record.stepKey, record]),\n );\n const toneOfStep = (key: string): Tone => {\n const status = records.get(key)?.status;\n return status ? toneOf(STEP_TONE, status) : \"idle\";\n };\n const at = new Map(layout.nodes.map((node) => [node.step.id, node]));\n const lastX = g.lead + (Math.min(perRow, layout.cols) - 1) * g.col + g.r;\n // Labels may run past the last circle by half a column.\n const width = layout.cols > 0 ? lastX + (g.label ? g.col / 2 : g.r) : 0;\n const ends = { left: g.lead / 2, right: lastX + g.col / 2 };\n const trackY = (edge: GraphEdge, row: number) =>\n rowTop[row] + edge.track.lane * g.lane + (edge.track.under ? g.dip : 0);\n const routes = layout.edges.map((edge) => {\n const from = edge.from === TRIGGER_NODE ? null : at.get(edge.from)!;\n const to = at.get(edge.to)!;\n const source = from ? spot(from.col, from.lane) : null;\n const target = spot(to.col, to.lane);\n const wraps = source !== null && source.row !== target.row;\n return {\n key: `${edge.from}-${edge.port}-${edge.to}`,\n edge,\n tone: toneOfStep(to.step.key),\n under: !wraps && edge.track.under,\n route: wraps\n ? wrapRoute(g, source, target, ends)\n : edgeRoute(g, source, target, trackY(edge, target.row), stacked),\n };\n });\n const dips = routes\n .filter((route) => route.under)\n .map(({ route, edge }) => route.label.y + (PORT_PILL[edge.port] ? 10 : 4));\n const height = Math.max(\n ...layout.nodes.map(\n (node) =>\n spot(node.col, node.lane).y + (g.label ? g.r + 6 + g.label : g.top),\n ),\n ...dips,\n );\n // A name centred on its circle, kept inside the graph at either end.\n const labelBox = (x: number) => {\n let w = Math.min(g.col - 16, 2 * (width - x));\n let left = x - w / 2;\n // Under a stacked trigger nothing sits left of the steps: a first name\n // slides into the 16px gap before the next one, and narrows past that.\n if (stacked && left < -12) {\n left += Math.min(-12 - left, 16);\n if (left < -12) {\n w -= -12 - left;\n left = -12;\n }\n }\n return { left, width: w };\n };\n const trigger = state.trigger ? triggerBlock(state.trigger) : null;\n const triggerMeta = trigger ? blockMeta(trigger) : null;\n\n return (\n // Read-only tips: close on leave, so the next step's tip can open.\n <ConnectTooltipProvider disableHoverableContent>\n <div\n ref={frame}\n className={stacked ? \"flex flex-col items-start\" : \"flex items-start\"}\n >\n <span ref={pill} className=\"flex shrink-0\">\n <Tip\n content={\n <span className=\"flex flex-col gap-0.5\">\n <span className=\"font-medium\">\n {triggerMeta?.displayName ?? \"No trigger\"}\n </span>\n {triggerMeta ? (\n <span className=\"text-muted-foreground\">\n {triggerMeta.subtitle}\n </span>\n ) : null}\n <span className=\"mt-1\">\n {latest\n ? `Last fired ${formatWhen(latest.startedAt)}`\n : \"Not fired yet\"}\n </span>\n </span>\n }\n >\n <Mark\n label={`Trigger: ${props.triggerText}`}\n onOpen={props.onOpen}\n className={`flex shrink-0 items-center gap-1.5 rounded-full bg-card font-medium text-foreground ring-[1.5px] ${g.pill} ${\n latest ? RING.ok : RING.idle\n }`}\n >\n <span\n className={`flex items-center justify-center rounded-full dark:bg-white ${g.pillLogo}`}\n >\n {trigger ? (\n <BlockLogo bare block={trigger} size={g.logo - 2} />\n ) : null}\n </span>\n {props.triggerText}\n </Mark>\n </Tip>\n </span>\n {layout.nodes.length > 0 ? (\n <ol\n className={`relative shrink-0 ${stacked ? \"\" : \"-ml-px\"}`}\n style={{ width, height, marginTop: stacked ? STACK_GAP : 0 }}\n aria-label={layout.nodes\n .map((node) => {\n const status = records.get(node.step.key)?.status;\n const label = node.step.name || node.step.key;\n return status ? `${label}: ${status.toLowerCase()}` : label;\n })\n .join(\", \")}\n >\n <svg\n aria-hidden\n className=\"absolute inset-0 overflow-visible\"\n width={width}\n height={height}\n >\n {routes.map(({ key, edge, route, tone }) => (\n <path\n key={key}\n d={roundedPath(route.points)}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeDasharray={edge.port === \"error\" ? \"3 3\" : undefined}\n className={STROKE[tone]}\n />\n ))}\n </svg>\n {routes.map(({ key, edge, route }) =>\n PORT_PILL[edge.port] ? (\n <span\n key={key}\n aria-hidden\n className=\"pointer-events-none absolute z-[1] -translate-x-1/2 -translate-y-1/2 rounded-full bg-card\"\n style={{ left: route.label.x, top: route.label.y }}\n >\n <span\n className={`block rounded-full px-1.5 font-medium leading-4 ring-1 ring-inset ${g.portText} ${PORT_PILL[edge.port]}`}\n >\n {edge.port}\n </span>\n </span>\n ) : null,\n )}\n {layout.nodes.map((node) => {\n const record = records.get(node.step.key);\n const skipped = record?.status === \"SKIPPED\";\n const name = node.step.name || node.step.key;\n const { x, y } = spot(node.col, node.lane);\n const tip = (\n <StepTip node={node} record={record} ran={Boolean(latest)} />\n );\n return (\n <li key={node.step.id}>\n <span\n className=\"absolute\"\n style={{ left: x - g.r, top: y - g.r }}\n >\n <Tip content={tip}>\n <Mark\n label={`${name}: ${\n record ? record.status.toLowerCase() : \"not run\"\n }`}\n onOpen={props.onOpen}\n className={`flex items-center justify-center rounded-full bg-card transition-shadow ${g.circle} ${\n skipped\n ? \"border-[1.5px] border-dashed border-foreground/40\"\n : `ring-[1.5px] hover:ring-[3px] dark:bg-white ${RING[toneOfStep(node.step.key)]}`\n }`}\n >\n <span className={skipped ? \"flex opacity-40\" : \"flex\"}>\n <BlockLogo\n bare\n block={stepBlock(node.step)}\n size={g.logo}\n />\n </span>\n </Mark>\n </Tip>\n </span>\n {g.label ? (\n <span\n aria-hidden\n className=\"pointer-events-none absolute flex flex-col items-center text-center\"\n style={{\n ...labelBox(x),\n top: y + g.r + 6,\n }}\n >\n {/* Two lines, then cut; the name opens the circle's tip too. */}\n <Tip content={tip}>\n <span\n className={`pointer-events-auto line-clamp-2 max-w-full font-medium text-foreground [overflow-wrap:anywhere] ${g.nameText}`}\n >\n {name}\n </span>\n </Tip>\n {g.subtitle ? (\n <span className=\"max-w-full truncate text-xs text-muted-foreground\">\n {blockMeta(stepBlock(node.step)).displayName}\n </span>\n ) : null}\n </span>\n ) : null}\n </li>\n );\n })}\n </ol>\n ) : null}\n </div>\n </ConnectTooltipProvider>\n );\n}\n","// The drive's workflows at a glance: each one's graph coloured by the latest\n// run, and its recent runs. The studio's landing view.\nimport { useDispatch } from \"@powerhousedao/reactor-browser\";\nimport {\n actions as workflowActions,\n useWorkflowDocumentsInSelectedDrive,\n type WorkflowDocument,\n} from \"document-models/workflow\";\nimport { StatusToggle } from \"../../workflow-editor/ui/PublishControls.js\";\nimport type { RunRecord } from \"../../workflow-editor/runtime-client.js\";\nimport { usePieceLogos } from \"../../workflow-editor/ui/block-meta.js\";\nimport { BlockLogo } from \"../../workflow-editor/ui/BlockSelector.js\";\nimport { triggerBlock } from \"../../workflow-editor/ui/blocks.js\";\nimport { describeTrigger } from \"../../workflow-editor/ui/trigger-text.js\";\nimport { MiniChain, RunStrip, workflowLinks } from \"./chain.js\";\nimport { ScrollFade } from \"./ScrollFade.js\";\nimport { useCollapsed } from \"./use-collapsed.js\";\nimport {\n formatAbsolute,\n formatWhen,\n RUN_TONE,\n statusLabel,\n toneOf,\n workflowHealth,\n} from \"./run-format.js\";\nimport { Button, Icon, StatusDot } from \"./ui.js\";\nimport { WorkflowGraph } from \"./WorkflowGraph.js\";\nimport { WorkflowMenu } from \"./WorkflowMenu.js\";\n\n// A folded row's workflow: the trigger as words, then its steps as logos.\nfunction CollapsedChain(props: {\n state: WorkflowDocument[\"state\"][\"global\"];\n triggerText: string;\n latest?: RunRecord;\n}) {\n const trigger = props.state.trigger\n ? triggerBlock(props.state.trigger)\n : null;\n const links = workflowLinks(\n {\n triggerId: props.state.trigger?.id,\n steps: props.state.steps,\n edges: props.state.edges,\n },\n props.latest,\n );\n return (\n // A column of the title line; the trigger's words give way before the name.\n <span className=\"flex min-w-0 items-center\">\n <span\n title={props.triggerText}\n className={`flex h-6 max-w-full shrink-0 items-center gap-1.5 rounded-full bg-card pl-0.5 pr-2.5 text-[12px] font-medium text-foreground ring-[1.5px] ${\n props.latest\n ? \"ring-wf-ok\"\n : \"ring-foreground/15 dark:ring-foreground/30\"\n }`}\n >\n <span className=\"flex h-5 w-5 shrink-0 items-center justify-center rounded-full dark:bg-white\">\n {trigger ? <BlockLogo bare block={trigger} size={12} /> : null}\n </span>\n <span className=\"truncate\">{props.triggerText}</span>\n </span>\n {links.length > 0 ? (\n // The steps give way before the trigger's words, fading where cut.\n <span className=\"flex min-w-0 shrink-[100] items-center\">\n <span\n aria-hidden\n className=\"h-0.5 w-3 shrink-0 bg-foreground/15 dark:bg-foreground/30\"\n />\n {/* Room for the circles' rings, which a clip would otherwise shave. */}\n <ScrollFade clip className=\"-my-1 min-w-0 py-1 pl-0.5\">\n <MiniChain links={links} />\n </ScrollFade>\n </span>\n ) : null}\n </span>\n );\n}\n\n// Its own component so each row holds its document's dispatch.\nfunction RowToggle(props: { document: WorkflowDocument }) {\n const [, dispatch] = useDispatch(props.document);\n const state = props.document.state.global;\n return (\n <StatusToggle\n tooltipSide=\"left\"\n published={Boolean(state.published)}\n status={state.status}\n onChange={(status) =>\n dispatch(workflowActions.setWorkflowStatus({ status }))\n }\n />\n );\n}\n\ninterface BoardRow {\n document: WorkflowDocument;\n id: string;\n name: string;\n description?: string | null;\n status: string;\n trigger: string;\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 // Workflow ids in sidebar order.\n order: string[];\n creating: boolean;\n onOpen: (workflowId: string) => void;\n onCreate: () => void;\n}) {\n usePieceLogos();\n const { isCollapsed, toggle } = useCollapsed();\n const documents = useWorkflowDocumentsInSelectedDrive() ?? [];\n const runs = props.runs ?? [];\n const positions = new Map(props.order.map((id, i) => [id, i]));\n const position = (id: string) => positions.get(id) ?? positions.size;\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 return {\n document,\n id: document.header.id,\n name: state.name || document.header.name || \"Untitled workflow\",\n description: state.description,\n status: state.status,\n trigger: describeTrigger(state.trigger),\n runs: workflowRuns,\n };\n })\n .sort((a, b) => position(a.id) - position(b.id));\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 // Not overflow-hidden: the row menus open past the card's edge.\n className=\"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(\n row.status,\n latest?.status,\n Boolean(row.document.state.global.published),\n );\n const collapsed = isCollapsed(row.id);\n return (\n <li\n key={row.id}\n className=\"group/row border-b border-solid border-foreground/10 first:rounded-t-xl last:rounded-b-xl last:border-b-0\"\n >\n {/* Each part lights up on its own, so folding and opening read apart. */}\n <div\n className={`flex items-start transition-colors group-first/row:rounded-t-xl has-[[data-row-header]:hover]:bg-accent/40 has-[[data-row-header]:focus-visible]:bg-accent/40 ${collapsed ? \"group-last/row:rounded-b-xl\" : \"\"}`}\n >\n {/* The header folds the row; the content below opens the workflow. */}\n <button\n type=\"button\"\n data-row-header\n aria-expanded={!collapsed}\n aria-label={`${collapsed ? \"Expand\" : \"Collapse\"} ${row.name}`}\n className=\"group/header @container flex min-w-0 flex-1 cursor-pointer items-start gap-1 py-4 pl-2 pr-5 text-left focus-visible:outline-none\"\n onClick={() => toggle(row.id)}\n >\n <span\n aria-hidden\n className=\"flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors group-hover/header:bg-accent group-hover/header:text-foreground group-focus-visible/header:bg-accent group-focus-visible/header:text-foreground\"\n >\n <Icon\n name=\"chevron\"\n className={`h-3.5 w-3.5 transition-transform ${collapsed ? \"\" : \"rotate-90\"}`}\n />\n </span>\n {/* A 24px line, shared with the toggle and menu beside it. */}\n <span\n className={`grid w-full grid-rows-[1.5rem] items-center gap-x-6 ${\n collapsed\n ? // Short of room, the last run goes first, then the run strip.\n \"grid-cols-[minmax(10rem,2fr)_minmax(0,3fr)] @[44rem]:grid-cols-[minmax(10rem,2fr)_minmax(0,3fr)_auto] @[60rem]:grid-cols-[minmax(10rem,2fr)_minmax(0,3fr)_minmax(0,10rem)_auto]\"\n : \"grid-cols-[minmax(0,1fr)_auto] md:grid-cols-[minmax(0,1fr)_minmax(0,10rem)_auto]\"\n }`}\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <span title={health.label} className=\"flex\">\n <StatusDot\n tone={health.tone}\n hollow={health.hollow}\n />\n </span>\n <span className=\"min-w-0 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 {collapsed ? (\n <CollapsedChain\n state={row.document.state.global}\n triggerText={row.trigger}\n latest={latest}\n />\n ) : null}\n <span\n className={`hidden text-[13px] ${collapsed ? \"@[60rem]:block\" : \"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=\"ml-1.5 text-xs text-muted-foreground\">\n {formatWhen(latest.startedAt)}\n </span>\n </>\n ) : (\n <span className=\"text-muted-foreground\">\n Not run yet\n </span>\n )}\n </span>\n {collapsed ? (\n <span className=\"hidden @[44rem]:block\">\n <RunStrip centered runs={row.runs} />\n </span>\n ) : (\n <RunStrip centered runs={row.runs} />\n )}\n </span>\n </button>\n <span className=\"mt-4 flex h-6 shrink-0 items-center gap-1 pr-3\">\n <RowToggle document={row.document} />\n <WorkflowMenu document={row.document} />\n </span>\n </div>\n {collapsed ? null : (\n <button\n type=\"button\"\n aria-label={`Open ${row.name}`}\n className=\"group/content relative flex w-full cursor-pointer flex-col gap-3 pb-4 pl-9 pr-5 pt-1 text-left transition-colors hover:bg-accent/50 focus-visible:bg-accent/50 focus-visible:outline-none group-last/row:rounded-b-xl\"\n onClick={() => props.onOpen(row.id)}\n >\n <span\n aria-hidden\n className=\"pointer-events-none absolute right-5 top-1 flex items-center gap-1 text-xs font-medium text-muted-foreground opacity-0 transition-opacity group-hover/content:opacity-100 group-focus-visible/content:opacity-100\"\n >\n Open workflow\n <Icon name=\"arrowRight\" className=\"h-3.5 w-3.5\" />\n </span>\n {/* A paragraph's width: the row's on a narrow screen, never a whole wide row. */}\n {row.description ? (\n <span className=\"max-w-prose pl-4 text-[13px] leading-5 text-muted-foreground\">\n {row.description}\n </span>\n ) : null}\n {/* Fits the row; scrolls only past the narrowest columns. */}\n <ScrollFade className=\"max-w-full py-1 pl-4 pr-1\">\n <WorkflowGraph\n fit\n state={row.document.state.global}\n triggerText={row.trigger}\n latest={latest}\n />\n </ScrollFade>\n </button>\n )}\n </li>\n );\n })}\n </ul>\n )}\n </section>\n );\n}\n","// The workflow's shape as a graph, coloured by the latest run, plus the steps\n// runs never reach.\nimport type { WorkflowState } from \"document-models/workflow\";\nimport type { RunRecord } from \"../../workflow-editor/runtime-client.js\";\nimport {\n blockMeta,\n usePieceLogos,\n} from \"../../workflow-editor/ui/block-meta.js\";\nimport { BlockLogo } from \"../../workflow-editor/ui/BlockSelector.js\";\nimport {\n stepBlock,\n type BlockIdentity,\n} from \"../../workflow-editor/ui/blocks.js\";\nimport { describeTrigger } from \"../../workflow-editor/ui/trigger-text.js\";\nimport { STEP_TONE, toneOf, type Tone } from \"./run-format.js\";\nimport { ScrollFade } from \"./ScrollFade.js\";\nimport { stepOutline, type OutlineStep } from \"./step-outline.js\";\nimport { WorkflowGraph } from \"./WorkflowGraph.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 block: BlockIdentity;\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 block={stop.block} 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\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 block = stepBlock(step);\n const meta = blockMeta(block);\n return {\n id: step.id,\n title: step.name || step.key,\n subtitle: meta.displayName,\n block,\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 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 <ScrollFade className=\"-mx-1 px-1 py-1.5\">\n <WorkflowGraph\n state={state}\n triggerText={describeTrigger(state.trigger)}\n latest={props.latestRun}\n onOpen={props.onOpenEditor}\n size=\"md\"\n fit\n />\n </ScrollFade>\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// on/off, open the editor, and archive or delete behind the \"…\" menu. Stats come from the shared feed.\nimport { useDispatch, useDocumentSafe } 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-client.js\";\nimport { DocumentLoadError } from \"../../shared/DocumentErrorBoundary.js\";\nimport {\n formatAbsolute,\n formatWhen,\n RUN_TONE,\n runStats,\n toneOf,\n TONE_TEXT,\n} from \"./run-format.js\";\nimport { Button, Fact, StatusDot } from \"./ui.js\";\nimport {\n PublishState,\n StatusToggle,\n} from \"../../workflow-editor/ui/PublishControls.js\";\nimport { WorkflowMenu } from \"./WorkflowMenu.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 onDeleted?: () => 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 stats = runStats(props.runs ?? []);\n\n const lastTone = toneOf(RUN_TONE, stats.lastRun?.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 <PublishState model={state} />\n {state.status === \"ARCHIVED\" ? (\n <span className=\"rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground\">\n Archived\n </span>\n ) : null}\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 <StatusToggle\n published={Boolean(state.published)}\n status={state.status}\n onChange={(status) =>\n dispatch(workflowActions.setWorkflowStatus({ status }))\n }\n />\n <Button variant=\"primary\" onClick={props.onEdit}>\n Edit workflow\n </Button>\n <WorkflowMenu\n document={workflow}\n nodeName={props.node.name}\n onDeleted={props.onDeleted}\n />\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 centered 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 addFolder,\n deleteNode,\n setSelectedNode,\n useDocumentSafe,\n useFileNodesInSelectedDrive,\n useNodesInSelectedDrive,\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 {\n useWorkflowDocumentsInSelectedDrive,\n type WorkflowDocument,\n} from \"document-models/workflow\";\nimport {\n MANUAL_TRIGGER,\n sameBlock,\n triggerBlock,\n} from \"../../workflow-editor/ui/blocks.js\";\nimport {\n useRuntimeActions,\n WorkflowRuntimeProvider,\n} from \"../../workflow-editor/runtime-context.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\";\nimport {\n homeFolderName,\n nextKey,\n orderWorkflows,\n reorderActions,\n} from \"./workflow-order.js\";\n\nconst WORKFLOW_TYPE = \"powerhouse/workflow\";\nconst CONNECTION_TYPE = \"powerhouse/connection\";\n\nexport function WorkflowStudio(props: { children?: ReactNode }) {\n return (\n <WorkflowRuntimeProvider>\n <Studio>{props.children}</Studio>\n </WorkflowRuntimeProvider>\n );\n}\n\nfunction Studio(props: { children?: ReactNode }) {\n const { fireWorkflow } = useRuntimeActions();\n const [drive, dispatchDrive] = useSelectedDrive();\n const nodes = useNodesInSelectedDrive() ?? [];\n const fileNodes = useFileNodesInSelectedDrive() ?? [];\n const workflowDocuments = useWorkflowDocumentsInSelectedDrive() ?? [];\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 orderedWorkflows = orderWorkflows(\n fileNodes.filter((node) => node.documentType === WORKFLOW_TYPE),\n nodes,\n );\n const workflows = orderedWorkflows.map((item) => item.node);\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 const name = `${baseName} ${count + 1}`;\n // A new workflow gets a home folder that sorts it last; a failed\n // document removes the folder again.\n const created =\n documentType === WORKFLOW_TYPE\n ? addFolder(\n driveId,\n homeFolderName(nextKey(orderedWorkflows), name),\n ).then((folder) =>\n addDocument(driveId, name, documentType, folder.id).catch(\n async (error: unknown) => {\n await deleteNode(driveId, folder.id).catch(() => undefined);\n throw error;\n },\n ),\n )\n : addDocument(driveId, name, documentType);\n created\n .then((node) => go(node.id, node.id))\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 reorder = (from: number, to: number) => {\n const names = new Map(\n workflowDocuments.map((doc) => [doc.header.id, doc.state.global.name]),\n );\n const actions = reorderActions(orderedWorkflows, from, to, names);\n if (actions.length === 0) return;\n dispatchDrive(actions, (errors) =>\n toast?.(errors[0]?.message ?? \"Failed to reorder workflows\", {\n type: \"error\",\n }),\n );\n };\n\n // One history entry per click: when the open editor changes, Connect pushes\n // its path and the selection rides on that entry.\n const go = (id: string | undefined, editor?: string) => {\n const before = window.location.pathname;\n if ((editor ?? null) !== (selectedNodeId ?? null)) setSelectedNode(editor);\n select(id, { replace: window.location.pathname !== before });\n };\n\n const showRuns = (node: FileNode | null) => go(node?.id);\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, { replace: true });\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, { replace: true });\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 feed = focusedWorkflow ? workflowFeed : driveFeed;\n const { runs, error: runsError, reload: reloadRuns } = feed;\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 the core manual trigger.\n const { data: targetDocument } = useDocumentSafe(liveTarget?.id ?? null);\n const targetTrigger =\n targetDocument?.header.documentType === WORKFLOW_TYPE\n ? (targetDocument as WorkflowDocument).state.global.trigger\n : null;\n const manualTrigger = Boolean(\n targetTrigger && sameBlock(triggerBlock(targetTrigger), MANUAL_TRIGGER),\n );\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 onReorderWorkflow={reorder}\n onShowAllRuns={() => showRuns(null)}\n onOpenWorkflow={(node) => showRuns(node)}\n onEditWorkflow={(node) => go(node.id, node.id)}\n onOpenConnection={(node) => go(node.id, node.id)}\n onCreateWorkflow={() =>\n create(WORKFLOW_TYPE, \"Workflow\", workflows.length)\n }\n onCreateConnection={() =>\n create(CONNECTION_TYPE, \"Connection\", connections.length)\n }\n />\n {/* Positioned, so absolute descendants (sr-only labels) overflow here,\n not into Connect's scroller around the studio. */}\n <main className=\"relative 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={() => go(liveTarget.id, liveTarget.id)}\n onDeleted={() => select(undefined, { replace: true })}\n />\n ) : (\n <WorkflowBoard\n runs={runs}\n order={workflows.map((node) => node.id)}\n creating={creating}\n onOpen={(workflowId) => go(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 hasMore={feed.hasMore}\n loadingMore={feed.loadingMore}\n onLoadMore={feed.loadMore}\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 { 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 return (\n <div className=\"h-full min-h-0 bg-background\">\n <WorkflowStudio>{props.children}</WorkflowStudio>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,SAAgB,YAAY,MAIZ;CACd,MAAM,0BAAU,IAAI,IAA2B;CAC/C,KAAK,MAAM,QAAQ,KAAK,OAAO;EAC7B,MAAM,OAAO,QAAQ,IAAI,KAAK,EAAE,KAAK,CAAC;EACtC,KAAK,KAAK,IAAI;EACd,QAAQ,IAAI,KAAK,IAAI,IAAI;CAC3B;CAGA,MAAM,UAAoB,KAAK,YAAY,CAAC,KAAK,SAAS,IAAI,CAAC;CAC/D,MAAM,OAAqB,CAAC;CAC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