@powerhousedao/workflow 6.2.3-dev.45 → 6.2.3-dev.47

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 (87) hide show
  1. package/dist/browser/{BlockSelector-B41mSc0W.js → BlockSelector-Do2fNhEF.js} +2 -2
  2. package/dist/browser/BlockSelector-Do2fNhEF.js.map +1 -0
  3. package/dist/browser/{connection-form-CkRzKggD.js → connection-form-BfIxO-uq.js} +2 -2
  4. package/dist/browser/{connection-form-CkRzKggD.js.map → connection-form-BfIxO-uq.js.map} +1 -1
  5. package/dist/browser/{data-tree-BugZMgLk.js → data-tree-CEBkvtSf.js} +2 -2
  6. package/dist/browser/{data-tree-BugZMgLk.js.map → data-tree-CEBkvtSf.js.map} +1 -1
  7. package/dist/browser/{editor-ldDYxtLV.js → editor-C6NhkZ3S.js} +3 -3
  8. package/dist/browser/{editor-ldDYxtLV.js.map → editor-C6NhkZ3S.js.map} +1 -1
  9. package/dist/browser/{editor-DvK4LPwF.js → editor-YRMQ2K-6.js} +724 -136
  10. package/dist/browser/editor-YRMQ2K-6.js.map +1 -0
  11. package/dist/browser/{editor-9eSmoDTm.js → editor-h6Fo7DOI.js} +52 -10
  12. package/dist/browser/editor-h6Fo7DOI.js.map +1 -0
  13. package/dist/browser/editors/connection-editor/module.js +1 -1
  14. package/dist/browser/editors/workflow-editor/module.js +1 -1
  15. package/dist/browser/editors/workflow-studio/module.js +1 -1
  16. package/dist/browser/{trigger-text-C37YRggR.js → trigger-text-CmtISlSW.js} +3 -3
  17. package/dist/browser/trigger-text-CmtISlSW.js.map +1 -0
  18. package/dist/node/{BlockSelector-BMnBzXcA.mjs → BlockSelector-CrPnitOU.mjs} +2 -2
  19. package/dist/node/BlockSelector-CrPnitOU.mjs.map +1 -0
  20. package/dist/node/{connection-form-DZFudcoD.mjs → connection-form-MHDKPohk.mjs} +2 -2
  21. package/dist/node/{connection-form-DZFudcoD.mjs.map → connection-form-MHDKPohk.mjs.map} +1 -1
  22. package/dist/node/{data-tree-CR8IOshA.mjs → data-tree-Ccyc8y8I.mjs} +2 -2
  23. package/dist/node/{data-tree-CR8IOshA.mjs.map → data-tree-Ccyc8y8I.mjs.map} +1 -1
  24. package/dist/node/{editor-NUaiiO4B.mjs → editor-C8kHYBz1.mjs} +52 -10
  25. package/dist/node/editor-C8kHYBz1.mjs.map +1 -0
  26. package/dist/node/{editor-BV5CYmUI.mjs → editor-CFYv3eBu.mjs} +724 -136
  27. package/dist/node/editor-CFYv3eBu.mjs.map +1 -0
  28. package/dist/node/{editor-D_P9-st9.mjs → editor-J42uGqnf.mjs} +3 -3
  29. package/dist/node/{editor-D_P9-st9.mjs.map → editor-J42uGqnf.mjs.map} +1 -1
  30. package/dist/node/editors/connection-editor/module.mjs +1 -1
  31. package/dist/node/editors/workflow-editor/module.mjs +1 -1
  32. package/dist/node/editors/workflow-studio/module.mjs +1 -1
  33. package/dist/node/pieces/reactor/descriptor.json +1 -1
  34. package/dist/node/pieces/reactor/package.json +1 -1
  35. package/dist/node/{trigger-text-78ZhfT-b.mjs → trigger-text-CaAEQV69.mjs} +3 -3
  36. package/dist/node/trigger-text-CaAEQV69.mjs.map +1 -0
  37. package/dist/powerhouse.manifest.json +1 -1
  38. package/dist/style.css +158 -10
  39. package/dist/types/editors/shared/controls.d.ts +1 -0
  40. package/dist/types/editors/shared/controls.d.ts.map +1 -1
  41. package/dist/types/editors/workflow-editor/document/useWorkflowModel.d.ts.map +1 -1
  42. package/dist/types/editors/workflow-editor/runtime-contract.test.d.ts +2 -0
  43. package/dist/types/editors/workflow-editor/runtime-contract.test.d.ts.map +1 -0
  44. package/dist/types/editors/workflow-editor/ui/ConnectionField.d.ts.map +1 -1
  45. package/dist/types/editors/workflow-editor/ui/ConnectionName.d.ts +8 -0
  46. package/dist/types/editors/workflow-editor/ui/ConnectionName.d.ts.map +1 -0
  47. package/dist/types/editors/workflow-editor/ui/ReactorConnectionField.d.ts.map +1 -1
  48. package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts.map +1 -1
  49. package/dist/types/editors/workflow-editor/ui/model.d.ts +2 -0
  50. package/dist/types/editors/workflow-editor/ui/model.d.ts.map +1 -1
  51. package/dist/types/editors/workflow-studio/components/Sidebar.d.ts +1 -0
  52. package/dist/types/editors/workflow-studio/components/Sidebar.d.ts.map +1 -1
  53. package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts +1 -0
  54. package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts.map +1 -1
  55. package/dist/types/editors/workflow-studio/components/WorkflowGraph.d.ts +10 -0
  56. package/dist/types/editors/workflow-studio/components/WorkflowGraph.d.ts.map +1 -0
  57. package/dist/types/editors/workflow-studio/components/WorkflowMenu.d.ts +2 -0
  58. package/dist/types/editors/workflow-studio/components/WorkflowMenu.d.ts.map +1 -1
  59. package/dist/types/editors/workflow-studio/components/WorkflowSteps.d.ts.map +1 -1
  60. package/dist/types/editors/workflow-studio/components/WorkflowStudio.d.ts.map +1 -1
  61. package/dist/types/editors/workflow-studio/components/chain.d.ts +1 -0
  62. package/dist/types/editors/workflow-studio/components/chain.d.ts.map +1 -1
  63. package/dist/types/editors/workflow-studio/components/graph-layout.d.ts +29 -0
  64. package/dist/types/editors/workflow-studio/components/graph-layout.d.ts.map +1 -0
  65. package/dist/types/editors/workflow-studio/components/graph-layout.test.d.ts +2 -0
  66. package/dist/types/editors/workflow-studio/components/graph-layout.test.d.ts.map +1 -0
  67. package/dist/types/editors/workflow-studio/components/use-hash-selection.d.ts +4 -4
  68. package/dist/types/editors/workflow-studio/components/use-hash-selection.d.ts.map +1 -1
  69. package/dist/types/editors/workflow-studio/components/workflow-order.d.ts +19 -0
  70. package/dist/types/editors/workflow-studio/components/workflow-order.d.ts.map +1 -0
  71. package/dist/types/editors/workflow-studio/components/workflow-order.test.d.ts +2 -0
  72. package/dist/types/editors/workflow-studio/components/workflow-order.test.d.ts.map +1 -0
  73. package/dist/types/scripts/ui-stack.d.ts +8 -2
  74. package/dist/types/scripts/ui-stack.d.ts.map +1 -1
  75. package/dist/types/test/drive-window.d.ts +6 -0
  76. package/dist/types/test/drive-window.d.ts.map +1 -0
  77. package/dist/types/test/runtime-schema.d.ts +17 -0
  78. package/dist/types/test/runtime-schema.d.ts.map +1 -0
  79. package/package.json +8 -8
  80. package/dist/browser/BlockSelector-B41mSc0W.js.map +0 -1
  81. package/dist/browser/editor-9eSmoDTm.js.map +0 -1
  82. package/dist/browser/editor-DvK4LPwF.js.map +0 -1
  83. package/dist/browser/trigger-text-C37YRggR.js.map +0 -1
  84. package/dist/node/BlockSelector-BMnBzXcA.mjs.map +0 -1
  85. package/dist/node/editor-BV5CYmUI.mjs.map +0 -1
  86. package/dist/node/editor-NUaiiO4B.mjs.map +0 -1
  87. package/dist/node/trigger-text-78ZhfT-b.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor-YRMQ2K-6.js","names":["RING","RAIL","addFolder","workflowActions","WORKFLOW_TYPE","RING","workflowActions","WORKFLOW_TYPE","workflowActions"],"sources":["../../editors/workflow-studio/components/chain.tsx","../../editors/workflow-studio/components/ui.tsx","../../editors/workflow-studio/components/RunsTable.tsx","../../editors/workflow-studio/components/RunsView.tsx","../../editors/workflow-studio/components/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/step-outline.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":["// 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 type BlockIdentity,\n} from \"../../workflow-editor/ui/blocks.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 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 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 {run.status === \"FAILED\" ? (\n <Button\n className=\"ml-auto\"\n disabled={rerunning}\n onClick={() => {\n setRerunning(true);\n setRerunError(null);\n rerunRun(run.id)\n .then((result) => setRerunError(result.error))\n .catch((error: unknown) =>\n setRerunError(\n error instanceof Error ? error.message : String(error),\n ),\n )\n .finally(() => {\n setRerunning(false);\n props.onChanged();\n });\n }}\n >\n <Icon name=\"retry\" className=\"h-3.5 w-3.5\" />\n {rerunning ? \"Rerunning…\" : \"Rerun from failed step\"}\n </Button>\n ) : null}\n {rerunError ? <span className=\"text-wf-fail\">{rerunError}</span> : null}\n </div>\n <div\n role=\"list\"\n aria-label=\"Steps of this run\"\n className=\"overflow-hidden rounded-md border border-solid border-border bg-card\"\n >\n <TriggerRow run={run} />\n {run.steps.map((step) => (\n <StepRow\n key={step.stepId + step.stepKey}\n step={step}\n name={names.get(step.stepKey)}\n span={timeline.get(step.stepId)}\n 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","// 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","// 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 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\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) =>\n placed.get(nodeId(edge.from))!.lane +\n (SIDE_PORTS.has(edge.port) ? 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 type { HTMLAttributes, ReactNode, Ref } 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.\ninterface 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 // Port pill text size.\n portText: string;\n}\n\nconst GEOMETRY: Record<\"sm\" | \"md\", Geometry> = {\n sm: {\n r: 12,\n col: 120,\n lane: 72,\n lead: 20,\n top: 14,\n dip: 50,\n label: 18,\n subtitle: false,\n nameText: \"text-xs\",\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 portText: \"text-[10px]\",\n },\n md: {\n r: 18,\n col: 136,\n lane: 100,\n lead: 28,\n top: 18,\n dip: 72,\n label: 36,\n subtitle: true,\n nameText: \"text-[13px]\",\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 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-wf-fail/10 text-wf-fail ring-wf-fail/30\",\n error: \"bg-wf-warn/10 text-wf-warn ring-wf-warn/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\ntype 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\n// Turns happen in the gutter between columns, onto and off the edge's track:\n// a lane's line, or the gutter under it.\nfunction edgeRoute(\n g: Geometry,\n source: { x: number; y: number } | null,\n target: { x: number; y: number },\n trackY: number,\n): {\n points: Point[];\n // Centre of the horizontal stretch a port pill sits on.\n label: { x: number; y: number };\n} {\n const x1 = source ? source.x + g.r : 0;\n const y1 = source ? source.y : g.top;\n const x2 = target.x - g.r;\n const y2 = target.y;\n const after = source ? source.x + g.col / 2 : g.lead / 2;\n const before = target.x - g.col / 2;\n const route: Point[] = [\n [x1, y1],\n [after, y1],\n [after, trackY],\n [before, trackY],\n [before, y2],\n [x2, y2],\n ];\n // Drops zero-length and straight-through points, which would round oddly.\n const points = route.filter((point, index) => {\n const prev = route[index - 1] as Point | undefined;\n const next = route[index + 1] as Point | undefined;\n if (!prev || !next) return true;\n return !(\n (prev[0] === point[0] && point[0] === next[0]) ||\n (prev[1] === point[1] && point[1] === next[1])\n );\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// 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}) {\n const { state, latest } = props;\n const g = GEOMETRY[props.size ?? \"sm\"];\n const centerX = (col: number) => g.lead + (col - 1) * g.col + g.r;\n const centerY = (lane: number) => g.top + lane * g.lane;\n const layout = graphLayout({\n triggerId: state.trigger?.id,\n steps: state.steps,\n edges: state.edges,\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 // Labels may run past the last circle by half a column.\n const width =\n layout.cols > 0 ? centerX(layout.cols) + (g.label ? g.col / 2 : g.r) : 0;\n const trackY = (edge: GraphEdge) =>\n centerY(edge.track.lane) + (edge.track.under ? g.dip : 0);\n const dips = layout.edges\n .filter((edge) => edge.track.under)\n .map((edge) => trackY(edge) + (PORT_PILL[edge.port] ? 10 : 4));\n const height = Math.max(\n centerY(layout.lanes - 1) + (g.label ? g.r + 6 + g.label : g.top),\n ...dips,\n );\n const routes = layout.edges.map((edge) => {\n const source = edge.from === TRIGGER_NODE ? null : at.get(edge.from);\n const target = at.get(edge.to)!;\n return {\n key: `${edge.from}-${edge.port}-${edge.to}`,\n edge,\n tone: toneOfStep(target.step.key),\n route: edgeRoute(\n g,\n source ? { x: centerX(source.col), y: centerY(source.lane) } : null,\n { x: centerX(target.col), y: centerY(target.lane) },\n trackY(edge),\n ),\n };\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 className=\"flex items-start\">\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 {layout.nodes.length > 0 ? (\n <ol\n className=\"relative -ml-px shrink-0\"\n style={{ width, height }}\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 = centerX(node.col);\n const y = centerY(node.lane);\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\n content={\n <StepTip\n node={node}\n record={record}\n ran={Boolean(latest)}\n />\n }\n >\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 left: x - (g.col - 16) / 2,\n top: y + g.r + 6,\n width: g.col - 16,\n }}\n >\n <span\n className={`max-w-full truncate font-medium text-foreground ${g.nameText}`}\n >\n {name}\n </span>\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 { describeTrigger } from \"../../workflow-editor/ui/trigger-text.js\";\nimport { RunStrip } from \"./chain.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// 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 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 return (\n <li\n key={row.id}\n className=\"flex items-start border-b border-solid border-foreground/10 transition-colors first:rounded-t-xl last:rounded-b-xl last:border-b-0 hover:bg-accent/50 has-[>button:focus-visible]:bg-accent/50\"\n >\n <button\n type=\"button\"\n className=\"flex min-w-0 flex-1 flex-col gap-3 px-5 py-4 text-left focus-visible:outline-none\"\n onClick={() => props.onOpen(row.id)}\n >\n {/* One 24px line, shared with the toggle and menu beside it. */}\n <span className=\"grid h-6 w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-x-6 md:grid-cols-[minmax(0,1fr)_minmax(0,10rem)_auto]\">\n <span className=\"flex min-w-0 items-center gap-2\">\n <span title={health.label} className=\"flex\">\n <StatusDot tone={health.tone} hollow={health.hollow} />\n </span>\n <span className=\"max-w-[60%] shrink-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 {row.description ? (\n <span\n title={row.description}\n className=\"ml-1 min-w-0 truncate text-[13px] text-muted-foreground\"\n >\n {row.description}\n </span>\n ) : null}\n </span>\n <span\n className=\"hidden text-[13px] md:block\"\n title={\n latest ? formatAbsolute(latest.startedAt) : undefined\n }\n >\n {latest ? (\n <>\n <span\n className={`font-medium ${latestTone === \"fail\" ? \"text-wf-fail\" : latestTone === \"ok\" ? \"text-wf-ok\" : \"text-foreground\"}`}\n >\n {statusLabel(latest.status)}\n </span>\n <span className=\"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 <RunStrip centered runs={row.runs} />\n </span>\n {/* Scrolls rather than squeezing a wide workflow. */}\n <span className=\"block max-w-full overflow-x-auto py-1 pl-4 pr-1\">\n <WorkflowGraph\n state={row.document.state.global}\n triggerText={row.trigger}\n latest={latest}\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 </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 { 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 <div className=\"-mx-1 overflow-x-auto 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 />\n </div>\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":";;;;;;;;;;;;AAyBA,MAAMA,SAA6B;CACjC,IAAI;CACJ,MAAM;CACN,MAAM;CACN,KAAK;CACL,MAAM;AACR;AAEA,MAAMC,SAA6B;CACjC,IAAI;CACJ,MAAM;CACN,MAAM;CACN,KAAK;CACL,MAAM;AACR;AAIA,MAAM,YAAY;AAElB,SAAgB,UAAU,OAAmD;CAC3E,MAAM,KAAK,MAAM,SAAS;CAC1B,MAAM,WAAW,MAAM,MAAM,SAAS;CACtC,MAAM,QAAQ,WAAW,MAAM,MAAM,MAAM,GAAG,CAAa,IAAI,MAAM;CACrE,MAAM,SAAS,MAAM,MAAM,SAAS,MAAM;CAC1C,MAAM,QAAQ,MAAM,KAAK,SACvB,KAAK,SAAS,OAAO,WAAW,KAAK,MAAM,IAAI,MACjD;CACA,OACE,qBAAC,MAAD;EACE,WAAU;EACV,cAAY,MAAM,MACf,KACE,SACC,GAAG,KAAK,QAAQ,KAAK,SAAS,KAAK,KAAK,OAAO,YAAY,MAAM,IACrE,CAAC,CACA,KAAK,IAAI;EAPd,UAAA,CASG,MAAM,KAAK,MAAM,UAChB,qBAAC,MAAD;GAAkB,WAAU;GAA5B,UAAA,CACG,QAAQ,IACP,oBAAC,QAAD;IACE,eAAA;IACA,WAAW,SAAS,KAAK,QAAQ,MAAM,GAAGA,OAAK,MAAM;GACtD,CAAA,IACC,MACJ,o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./rolldown-runtime-DC62tzP2.js
2
2
  import { c as planFromAuth, o as packageFromConnectorId, r as connectorIdForPiece } from "./piece-auth-BS5CtQOG.js";
3
3
  import { $ as isCoreBlock, X as STEP_PRESETS, Z as TRIGGER_PRESETS, at as triggerFields, dt as expandDocumentRefs, f as stepOutputTreeQuery, ft as flowPorts, gt as scheduleConfigIssue, h as blockRefKey, ht as parseScheduleConfig, i as outputTreeQuery, it as triggerBlock, mt as knownPorts, n as catalogQuery, nt as stepBlock, rt as stepFields, tt as sameBlock, u as runsQuery, ut as documentRefsIn, v as TEST_TRIGGER_KIND, y as realRuns } from "./runtime-queries-IZG_nonR.js";
4
4
  import { y as actions } from "./module-D4UiG9ii.js";
5
- import { $ as blockMissing, B as useCachedBlockForm, C as formatDuration, Ct as Hint, Dt as Switch, E as formatWhen, Et as Select, F as useBlockForm, Ft as isIconName, G as useDynamicPrefetch, H as useDesignTime, I as useBlockFormLoader, It as DocumentErrorBoundary, J as useResolvedProp, K as useLatestRun, L as useBlockForms, M as toneOf, Mt as textAreaClass, Nt as textInputClass, Ot as Tabs, P as DesignTimeProvider, Pt as Icon, Q as useWebhookEndpoint, R as useBlockPorts, S as formatAbsolute, St as FieldLabel, Tt as Segmented, U as useDynamicCache, V as useConnectionList, W as useDynamicLookup, X as useTestStepRunner, Y as useRunById, Z as useTestTrigger, _ as RUN_TONE, _t as useRuntime, a as resolutionText, at as storedSchema, b as TONE_TEXT, bt as Button, c as useResolution, ct as withSetting, d as pieceDisplayName, et as isEmptyValue, f as pieceLogo, gt as useRunsQuery, i as VersionSummary, it as settingFor, jt as invalidClass, l as versionBadge, lt as workflowReadiness, m as usePieceLogos, n as BlockSelector, nt as parsePropList, o as runsDifferentVersion, ot as stripOptions, p as useBlockMeta, q as useOptionSearch, r as BlockResolutionsProvider, rt as resolverInputFor, s as updateVersion, st as undeclaredPortIssues, t as BlockLogo, tt as isPropVisible, u as blockMeta, ut as WorkflowRuntimeProvider, vt as useRuntimeActions, wt as IconButton, xt as FieldError, y as TONE_DOT, z as useBlockResolutions } from "./BlockSelector-B41mSc0W.js";
5
+ import { $ as blockMissing, B as useCachedBlockForm, C as formatDuration, Ct as Hint, Dt as Switch, E as formatWhen, Et as Select, F as useBlockForm, Ft as isIconName, G as useDynamicPrefetch, H as useDesignTime, I as useBlockFormLoader, It as DocumentErrorBoundary, J as useResolvedProp, K as useLatestRun, L as useBlockForms, M as toneOf, Mt as textAreaClass, Nt as textInputClass, Ot as Tabs, P as DesignTimeProvider, Pt as Icon, Q as useWebhookEndpoint, R as useBlockPorts, S as formatAbsolute, St as FieldLabel, Tt as Segmented, U as useDynamicCache, V as useConnectionList, W as useDynamicLookup, X as useTestStepRunner, Y as useRunById, Z as useTestTrigger, _ as RUN_TONE, _t as useRuntime, a as resolutionText, at as storedSchema, b as TONE_TEXT, bt as Button, c as useResolution, ct as withSetting, d as pieceDisplayName, et as isEmptyValue, f as pieceLogo, gt as useRunsQuery, i as VersionSummary, it as settingFor, jt as invalidClass, l as versionBadge, lt as workflowReadiness, m as usePieceLogos, n as BlockSelector, nt as parsePropList, o as runsDifferentVersion, ot as stripOptions, p as useBlockMeta, q as useOptionSearch, r as BlockResolutionsProvider, rt as resolverInputFor, s as updateVersion, st as undeclaredPortIssues, t as BlockLogo, tt as isPropVisible, u as blockMeta, ut as WorkflowRuntimeProvider, vt as useRuntimeActions, wt as IconButton, xt as FieldError, y as TONE_DOT, z as useBlockResolutions } from "./BlockSelector-Do2fNhEF.js";
6
6
  import { A as REACTOR_CONNECTOR_ID, y as actions$1 } from "./module-B2BMwu5E.js";
7
7
  import { t as useConnectionDocumentById } from "./connection-BP17lpt3.js";
8
8
  import { t as useSelectedWorkflowDocument } from "./workflow-DFLQ2cFr.js";
9
- import { a as useSignInGate, f as connectionCallbacks, g as newUndoGroup, h as groupedAction, i as useReactorAccessDenial, l as reactorConnections, m as UndoRedo, n as SignInPrompt, o as missingInPublished, p as BackButton, r as usePublisher, s as runsAsText, t as ConnectionForm } from "./connection-form-CkRzKggD.js";
10
- import { a as StepError, c as PublishButton, d as ReactorDenialNote, f as StatusToggle, g as uniqueStepKey, h as hasDraftChanges, i as DataViewer, l as PublishState, m as VARIABLES_VIEW, n as describeSchedule, o as Modal, p as usePublish, r as describeTrigger, s as DraftBanner, t as describeCron, u as PublishedMissingNote } from "./trigger-text-C37YRggR.js";
9
+ import { a as useSignInGate, f as connectionCallbacks, g as newUndoGroup, h as groupedAction, i as useReactorAccessDenial, l as reactorConnections, m as UndoRedo, n as SignInPrompt, o as missingInPublished, p as BackButton, r as usePublisher, s as runsAsText, t as ConnectionForm } from "./connection-form-BfIxO-uq.js";
10
+ import { a as StepError, c as PublishButton, d as ReactorDenialNote, f as StatusToggle, g as uniqueStepKey, h as hasDraftChanges, i as DataViewer, l as PublishState, m as VARIABLES_VIEW, n as describeSchedule, o as Modal, p as usePublish, r as describeTrigger, s as DraftBanner, t as describeCron, u as PublishedMissingNote } from "./trigger-text-CmtISlSW.js";
11
11
  import * as m from "react";
12
12
  import React, { Fragment, Suspense, createContext, forwardRef, lazy, memo, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
13
13
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
14
14
  import { generateId } from "document-model";
15
- import { addDocument, dispatchActions, useDocumentModelModules, useFileNodesInSelectedDrive, useSelectedDocumentId, useSelectedDriveId } from "@powerhousedao/reactor-browser";
15
+ import { addDocument, dispatchActions, useDocumentModelModules, useDocumentSafe, useFileNodesInSelectedDrive, useSelectedDocumentId, useSelectedDriveId } from "@powerhousedao/reactor-browser";
16
16
  import { createPortal } from "react-dom";
17
17
  //#region editors/workflow-editor/undo-policy.ts
18
18
  function placesBlock(edit, id) {
@@ -94,6 +94,7 @@ function settingsInput(settings) {
94
94
  function toModel(state) {
95
95
  return {
96
96
  name: state.name,
97
+ description: state.description ?? null,
97
98
  status: state.status,
98
99
  version: state.version,
99
100
  published: state.published ? {
@@ -182,6 +183,7 @@ function useWorkflowModel() {
182
183
  dispatch(actions.setWorkflowName({ name }));
183
184
  dispatch(actions.setName(name));
184
185
  },
186
+ setDescription: (description) => dispatch(actions.setWorkflowDescription({ description })),
185
187
  setStatus: (status) => dispatch(actions.setWorkflowStatus({ status })),
186
188
  setTrigger: (input) => {
187
189
  const id = state.trigger?.id ?? generateId();
@@ -1434,6 +1436,28 @@ function connectionDraftFor(input) {
1434
1436
  };
1435
1437
  }
1436
1438
  //#endregion
1439
+ //#region editors/workflow-editor/ui/ConnectionName.tsx
1440
+ function useConnectionName(id) {
1441
+ const { status, data } = useDocumentSafe(id || null);
1442
+ if (!id || status === "pending") return { invalid: false };
1443
+ const document = data;
1444
+ if (!document) return {
1445
+ name: id,
1446
+ invalid: true
1447
+ };
1448
+ return {
1449
+ name: document.state.global.name || document.header.name || id,
1450
+ invalid: document.header.documentType !== CONNECTION_TYPE
1451
+ };
1452
+ }
1453
+ function ConnectionName(props) {
1454
+ if (props.name === void 0) return /* @__PURE__ */ jsx("span", {
1455
+ "aria-label": "Loading connection",
1456
+ className: "inline-block h-3.5 w-28 animate-pulse rounded bg-foreground/10 align-middle"
1457
+ });
1458
+ return /* @__PURE__ */ jsx(Fragment$1, { children: props.name });
1459
+ }
1460
+ //#endregion
1437
1461
  //#region editors/workflow-editor/ui/CreateConnectionModal.tsx
1438
1462
  function CreateConnectionModal(props) {
1439
1463
  const [document, dispatch] = useConnectionDocumentById(props.connectionId);
@@ -1610,6 +1634,7 @@ function ConnectionField(props) {
1610
1634
  return () => window.removeEventListener("mousedown", handler);
1611
1635
  }, [open]);
1612
1636
  const selected = connections.find((connection) => connection.id === props.value);
1637
+ const bound = useConnectionName(selected ? null : props.value);
1613
1638
  const authMode = form === "loading" ? "loading" : form?.auth ?? "optional";
1614
1639
  if ((authMode === "none" || authMode === "loading") && !props.value) return null;
1615
1640
  const compatible = compatibleConnections(connections, props.block);
@@ -1703,13 +1728,13 @@ function ConnectionField(props) {
1703
1728
  })
1704
1729
  ] }) : /* @__PURE__ */ jsx("span", {
1705
1730
  className: "flex-1 truncate text-muted-foreground/70",
1706
- children: props.value ? props.value : "Choose a connection"
1731
+ children: props.value ? /* @__PURE__ */ jsx(ConnectionName, { name: bound.name }) : "Choose a connection"
1707
1732
  }), /* @__PURE__ */ jsx(Icon, {
1708
1733
  name: "chevronDown",
1709
1734
  className: "h-3.5 w-3.5 text-muted-foreground"
1710
1735
  })]
1711
1736
  }),
1712
- props.value && !selected ? /* @__PURE__ */ jsx(Hint, { children: "Not a known connection document." }) : null,
1737
+ props.value && !selected && bound.invalid ? /* @__PURE__ */ jsx(Hint, { children: "Not a known connection document." }) : null,
1713
1738
  selected && packageFromConnectorId(selected.connectorId) !== props.block.pieceName ? /* @__PURE__ */ jsxs("p", {
1714
1739
  className: "mt-1.5 text-xs text-wf-warn",
1715
1740
  children: [
@@ -1811,7 +1836,9 @@ function ReactorConnectionField(props) {
1811
1836
  });
1812
1837
  const [error, setError] = useState(null);
1813
1838
  const linking = props.value || null;
1814
- const listed = connections.some((connection) => connection.id === linking);
1839
+ const listing = connections.find((connection) => connection.id === linking);
1840
+ const listed = Boolean(listing);
1841
+ const bound = useConnectionName(listed ? null : props.value);
1815
1842
  useEffect(() => {
1816
1843
  if (!linking || listed) return;
1817
1844
  let attempts = 0;
@@ -1867,6 +1894,7 @@ function ReactorConnectionField(props) {
1867
1894
  ariaLabel: "Reactor connection",
1868
1895
  value: props.value,
1869
1896
  options,
1897
+ valueLabel: props.value ? /* @__PURE__ */ jsx(ConnectionName, { name: listing ? listing.name || listing.id : bound.name }) : void 0,
1870
1898
  invalid: Boolean(declared) && !props.value,
1871
1899
  placeholder: creating ? "Creating connection…" : "Choose a reactor connection",
1872
1900
  emptyText: "No reactor connection in this drive yet.",
@@ -1888,7 +1916,7 @@ function ReactorConnectionField(props) {
1888
1916
  children: runsAs
1889
1917
  }) : null
1890
1918
  ] }) : /* @__PURE__ */ jsx(Hint, { children: "This block takes no reactor connection." }),
1891
- props.value && connections.length > 0 && !known ? /* @__PURE__ */ jsx("p", {
1919
+ props.value && !known && (listed || bound.invalid) ? /* @__PURE__ */ jsx("p", {
1892
1920
  className: "mt-1.5 text-xs text-wf-warn",
1893
1921
  children: "Not a reactor connection in this drive."
1894
1922
  }) : null,
@@ -17242,7 +17270,7 @@ function WorkflowEditorApp(props) {
17242
17270
  })] }) : null,
17243
17271
  /* @__PURE__ */ jsx("input", {
17244
17272
  "aria-label": "Workflow name",
17245
- className: "min-w-16 max-w-72 shrink rounded-md border border-solid border-transparent bg-transparent px-1.5 py-1 text-[15px] font-semibold text-foreground hover:border-foreground/15 focus:border-ring focus:outline-none focus:ring-2 focus:ring-ring/25",
17273
+ className: "min-w-16 max-w-72 shrink rounded-md border border-solid border-transparent bg-transparent px-1.5 py-1 text-[15px] font-semibold [field-sizing:content] text-foreground hover:border-foreground/15 focus:border-ring focus:outline-none focus:ring-2 focus:ring-ring/25",
17246
17274
  defaultValue: model.name,
17247
17275
  placeholder: "Untitled workflow",
17248
17276
  spellCheck: false,
@@ -17258,6 +17286,20 @@ function WorkflowEditorApp(props) {
17258
17286
  className: "text-xs tabular-nums text-muted-foreground",
17259
17287
  children: ["v", model.version]
17260
17288
  }),
17289
+ /* @__PURE__ */ jsx("input", {
17290
+ "aria-label": "Workflow description",
17291
+ className: "min-w-32 max-w-md flex-1 rounded-md border border-solid border-transparent bg-transparent px-1.5 py-1 text-[13px] text-muted-foreground placeholder:text-muted-foreground/60 hover:border-foreground/15 focus:border-ring focus:text-foreground focus:outline-none focus:ring-2 focus:ring-ring/25",
17292
+ defaultValue: model.description ?? "",
17293
+ placeholder: "Add a description",
17294
+ title: model.description ?? void 0,
17295
+ onKeyDown: (event) => {
17296
+ if (event.key === "Enter") event.currentTarget.blur();
17297
+ },
17298
+ onBlur: (event) => {
17299
+ const description = event.target.value.trim();
17300
+ if (description !== (model.description ?? "")) callbacks.setDescription(description);
17301
+ }
17302
+ }, model.description ?? ""),
17261
17303
  /* @__PURE__ */ jsx(PublishState, { model }),
17262
17304
  /* @__PURE__ */ jsx(PublishedMissingNote, { missing: publishedMissing }),
17263
17305
  /* @__PURE__ */ jsx(ReactorDenialNote, { denial }),
@@ -17523,4 +17565,4 @@ function Editor() {
17523
17565
  //#endregion
17524
17566
  export { Editor as default };
17525
17567
 
17526
- //# sourceMappingURL=editor-9eSmoDTm.js.map
17568
+ //# sourceMappingURL=editor-h6Fo7DOI.js.map