@agimon-ai/po-workflow 0.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.mjs","names":["isRecord","isRecord","TICK_MS","legacy","legacy","legacy","legacy","routes","TAB_ID_PREFIX","legacy","legacy","legacy","legacy","legacy","activityGroupWorkflows","channelWorkflowCatalog","channelWorkflowRuns","actionLaunchWorkflow","dockWorkflow","fillWorkflowLauncher","fillWorkflows","leaderCatalog","leaderToggle","modeWorkflow","toolWorkflow"],"sources":["../../src/types/webWorkflows.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/catalogStore.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/runDuration.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/workflowActivity.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/workflowsStore.ts","../../src/extensions/workspaces/sessions/(frontend)/fill/_components/WorkflowsActivitySection.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/workflowToolRender.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/WorkflowToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/_lib/index.ts","../../src/extensions/workspaces/sessions/(frontend)/action/launch-workflow.web.ts","../../src/extensions/workspaces/sessions/(frontend)/activity-group/workflows.web.ts","../../src/extensions/workspaces/sessions/(frontend)/channel/workflow-catalog.web.ts","../../src/extensions/workspaces/sessions/(frontend)/channel/workflow-runs.web.ts","../../src/types/apiRoutes.ts","../../generated/client.ts","../../src/types/webWorkflowTerminal.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/terminalApi.ts","../../src/extensions/workspaces/sessions/(frontend)/_components/ArtifactsPane.tsx","../../src/extensions/workspaces/sessions/(frontend)/_lib/keySender.ts","../../src/extensions/workspaces/sessions/(frontend)/_components/StepSteerComposer.tsx","../../src/extensions/workspaces/sessions/(frontend)/_components/StepTerminalPanel.tsx","../../src/extensions/workspaces/sessions/(frontend)/_components/WorkflowRunParts.tsx","../../src/extensions/workspaces/sessions/(frontend)/dock/_components/WorkflowDockPanel.tsx","../../src/extensions/workspaces/sessions/(frontend)/dock/workflow.web.tsx","../../src/extensions/workspaces/sessions/(frontend)/_lib/launchLine.ts","../../src/extensions/workspaces/sessions/(frontend)/_components/LaunchWorkflowDialog.tsx","../../src/extensions/workspaces/sessions/(frontend)/_components/WorkflowCatalogDrawer.tsx","../../src/extensions/workspaces/sessions/(frontend)/fill/_components/WorkflowLauncherOverlay.tsx","../../src/extensions/workspaces/sessions/(frontend)/fill/WorkflowLauncher.overlay.web.tsx","../../src/extensions/workspaces/sessions/(frontend)/fill/Workflows.activity.workflows.web.tsx","../../src/extensions/workspaces/sessions/(frontend)/leader/catalog.web.ts","../../src/extensions/workspaces/sessions/(frontend)/leader/toggle.web.ts","../../src/extensions/workspaces/sessions/(frontend)/mode/workflow/mode.web.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/workflow.web.tsx","../../generated/web.ts"],"sourcesContent":["/**\n * Workflow run view types shared by this package's hub channel and its web\n * plugin. The shapes mirror what the embedded workflow-mcp engine records;\n * the cockpit renders them as 'workflow_runs' channel payloads.\n */\n\n/** workflow-mcp's own stage vocabulary; the registry bucket a run record sits in. */\nexport type WorkflowStage = 'running' | 'completed' | 'error';\n\n/** workflow-mcp's terminal outcome for a finished run. */\nexport type WorkflowOutcome = 'success' | 'skipped' | 'failed' | 'interrupted';\n\n/** Recorded job/step states, plus pending entries from the workflow definition. */\nexport type WorkflowProgressState =\n | 'pending'\n | 'running'\n | 'completed'\n | 'skipped'\n | 'failed'\n | 'pause_requested'\n | 'paused'\n | 'resumed';\n\n/** A customRun step ran as this child session. */\nexport const STEP_SESSION_REF_KIND = 'session';\n/** A command step ran in this terminal pane. */\nexport const STEP_PANE_REF_KIND = 'pane';\n\n/** Where a host executor ran a step: `session` for a customRun agent, `pane` for a command. */\nexport interface WorkflowStepRefView {\n kind: string;\n id: string;\n label?: string;\n}\n\nexport interface WorkflowStepView {\n name: string;\n status: WorkflowProgressState;\n /** Kept after the step ends, so a finished agent step still opens its conversation. */\n ref?: WorkflowStepRefView;\n /** Why the step is in its state, when the engine recorded one (e.g. a skip condition). */\n reason?: string;\n /** The parallel group the step ran in, beside the group's other steps. */\n group?: string;\n /** ISO 8601 of the step's first running event. */\n startedAt?: string;\n /** ISO 8601 of the step's terminal event. */\n endedAt?: string;\n}\n\n/** 'pre' and 'post' are the engine's pseudo-jobs for its pre:/post: blocks. */\nexport type WorkflowJobPhase = 'pre' | 'job' | 'post';\n\nexport interface WorkflowJobView {\n name: string;\n phase: WorkflowJobPhase;\n status: WorkflowProgressState;\n reason?: string;\n /** Position among the run's jobs, when the engine recorded one. */\n index?: number;\n total?: number;\n startedAt?: string;\n endedAt?: string;\n steps: WorkflowStepView[];\n}\n\n/** The job and step a run is on right now; drives the NOW breadcrumb. */\nexport interface WorkflowPosition {\n job: string;\n step?: string;\n index?: number;\n total?: number;\n}\n\n/**\n * One workflow run of a session, read from workflow-mcp's registry: the\n * run.json record plus the folded progress.ndjson job tree.\n */\nexport interface WorkflowRunView {\n /** Engine generation identity, distinct from a reused run key. */\n runId?: string;\n /** Registry identity within its workspace; unique per workspace+stage. */\n runKey: string;\n workspace: string;\n displayName: string;\n workflowName?: string;\n workflowPath: string;\n stage: WorkflowStage;\n outcome?: WorkflowOutcome;\n /** Present while the engine is pausing or paused; absent for plain running. */\n executionState?: 'running' | 'pause_requested' | 'paused' | 'resume_requested';\n /** The prompt the run was launched with, when one was recorded. */\n prompt?: string;\n /** ISO 8601, from the run record. */\n startedAt: string;\n finishedAt?: string;\n /** Failure cause with ANSI escapes stripped, present when the run errored. */\n errorMessage?: string;\n /** The job the engine blamed for the failure, when it recorded one. */\n failedJob?: string;\n /** True when reconciliation decided the recorded pid is no longer alive. */\n stale?: boolean;\n staleReason?: string;\n worktreeBranch?: string;\n /** The session that owns the run (its PI_SESSION_ID); absent on records that carry none. */\n ownerSessionId?: string;\n /** The session that launched the run into its own workflow session, when it was handed off. */\n launcherSessionId?: string;\n position?: WorkflowPosition;\n jobs: WorkflowJobView[];\n}\n\n/** What the workflow runs channel publishes for one session. */\nexport interface WorkflowRunsPayload {\n runs: WorkflowRunView[];\n}\n\nexport const WORKFLOW_RUNS_TYPE = 'workflow_runs';\n\n/**\n * One workflow the session's directory can launch, as the catalog drawer\n * lists it: the engine's own catalog entry plus the parsed detail the drawer\n * unfolds and the launch dialog turns into fields.\n */\nexport interface WorkflowCatalogEntryView {\n /** Absolute path, the row's stable identity. */\n path: string;\n relativePath: string;\n name: string;\n description: string;\n tags: string[];\n /** The trigger names the file declares, such as workflow_dispatch. */\n triggers: string[];\n inputs: WorkflowCatalogInputView[];\n jobs: WorkflowCatalogJobView[];\n artifacts: WorkflowCatalogArtifactView[];\n /** Absent when the workflow names no runner map, which means any runner will do. */\n runners?: string[];\n /** Commands every templated step offers; absent when no step is templated. */\n commands?: string[];\n /** Declared model choices; `default` is used when a launch names none. */\n choices?: string[];\n /** Set when the file could not be parsed; the row shows this instead of guessing. */\n error?: string;\n}\n\nexport interface WorkflowCatalogInputView {\n name: string;\n description?: string;\n required?: boolean;\n default?: string;\n type?: string;\n options?: string[];\n}\n\nexport interface WorkflowCatalogJobView {\n name: string;\n steps: string[];\n}\n\nexport interface WorkflowCatalogArtifactView {\n path: string;\n kind: 'file' | 'directory';\n description: string;\n producedBy: string[];\n}\n\n/** What the catalog channel publishes for one session. */\nexport interface WorkflowCatalogPayload {\n /** The directory the catalog was read from, which is the session's own. */\n cwd: string;\n workflows: WorkflowCatalogEntryView[];\n /** Present when the directory could not be read at all. */\n warning?: string;\n}\n\nexport const WORKFLOW_CATALOG_TYPE = 'workflow_catalog';\n\nexport interface WorkflowInputSummary {\n name: string;\n description?: string;\n required?: boolean;\n default?: string;\n options?: readonly string[];\n}\n\nexport interface WorkflowJobSummary {\n name: string;\n steps: readonly string[];\n}\n\n/**\n * What the detail pane shows for one workflow. `runners` is undefined when the\n * workflow names no runner map at all, which is not the same as naming an empty\n * one - see `compatibleRunners`.\n */\nexport interface WorkflowCatalogDetail {\n triggers: readonly string[];\n inputs: readonly WorkflowInputSummary[];\n jobs: readonly WorkflowJobSummary[];\n runners?: readonly string[];\n /** Commands every templated step offers; absent when no step is templated. */\n commands?: readonly string[];\n /** Declared model choices. */\n choices?: readonly string[];\n /** Set when the file could not be parsed; the pane shows this instead of guessing. */\n error?: string;\n}\n","import { defineSessionStore, type ContextActionRunContext } from '@agimon-ai/po-core/web';\n\nimport {\n WORKFLOW_CATALOG_TYPE,\n type WorkflowCatalogEntryView,\n type WorkflowCatalogPayload,\n} from '../../../../../types/webWorkflows';\n\n/** One session's catalog: what the hub last reported plus what the drawer is doing with it. */\nexport interface CatalogSession {\n cwd: string;\n workflows: WorkflowCatalogEntryView[];\n warning: string | undefined;\n /** True while the catalog drawer is shown in the workflows tab. */\n open: boolean;\n filter: string;\n /** Prompt carried from the surface that opened the catalog. */\n prompt: string;\n /** The highlighted row, by workflow path. */\n selected: string | undefined;\n /** The row whose parsed detail is unfolded. */\n inspected: string | undefined;\n /** The workflow the launch dialog is open for. */\n launch: string | undefined;\n}\n\nexport const catalog = defineSessionStore<CatalogSession>({\n cwd: '',\n workflows: [],\n warning: undefined,\n open: false,\n filter: '',\n prompt: '',\n selected: undefined,\n inspected: undefined,\n launch: undefined,\n});\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport function openCatalog(sessionId: string, prompt = ''): void {\n catalog.update(sessionId, (current) => ({ ...current, open: true, prompt }));\n}\n\n/** Opens the Workflow picker with context supplied by another installed plugin. */\nexport function openWorkflowCatalogForContext(context: ContextActionRunContext): void {\n if (context.sessionId === null) return;\n openCatalog(context.sessionId, context.item.content);\n}\n\nexport function closeCatalog(sessionId: string): void {\n catalog.update(sessionId, (current) => ({ ...current, open: false, prompt: '', launch: undefined }));\n}\n\nexport function setCatalogFilter(sessionId: string, filter: string): void {\n catalog.update(sessionId, (current) => ({ ...current, filter }));\n}\n\nexport function selectWorkflow(sessionId: string, path: string | undefined): void {\n catalog.update(sessionId, (current) => ({ ...current, selected: path }));\n}\n\nexport function toggleInspect(sessionId: string, path: string): void {\n catalog.update(sessionId, (current) => ({ ...current, inspected: current.inspected === path ? undefined : path }));\n}\n\nexport function openLaunch(sessionId: string, path: string): void {\n catalog.update(sessionId, (current) => ({ ...current, selected: path, launch: path }));\n}\n\nexport function closeLaunch(sessionId: string): void {\n catalog.update(sessionId, (current) => ({ ...current, launch: undefined }));\n}\n\n/** Rows whose name, path, tag or job matches the filter, case-insensitively. */\nexport function filterCatalog(\n workflows: readonly WorkflowCatalogEntryView[],\n filter: string,\n): WorkflowCatalogEntryView[] {\n const needle = filter.trim().toLowerCase();\n if (needle === '') return [...workflows];\n return workflows.filter((workflow) =>\n [\n workflow.name,\n workflow.relativePath,\n workflow.description,\n ...workflow.tags,\n ...workflow.jobs.map((job) => job.name),\n ]\n .join('\\n')\n .toLowerCase()\n .includes(needle),\n );\n}\n\n/** The plugin's catalog channel: 'workflow_catalog' payloads into the store. */\nexport const workflowCatalogChannel = catalog.channel<WorkflowCatalogPayload>({\n channel: WORKFLOW_CATALOG_TYPE,\n parse(input) {\n if (!isRecord(input) || typeof input.cwd !== 'string' || !Array.isArray(input.workflows)) return null;\n return {\n cwd: input.cwd,\n workflows: input.workflows.filter(isRecord) as unknown as WorkflowCatalogEntryView[],\n ...(typeof input.warning === 'string' ? { warning: input.warning } : {}),\n };\n },\n reduce(current, payload) {\n const paths = new Set(payload.workflows.map((workflow) => workflow.path));\n return {\n ...current,\n cwd: payload.cwd,\n workflows: payload.workflows,\n warning: payload.warning,\n // A row that is gone cannot stay selected, inspected, or half-launched.\n selected: current.selected !== undefined && paths.has(current.selected) ? current.selected : undefined,\n inspected: current.inspected !== undefined && paths.has(current.inspected) ? current.inspected : undefined,\n launch: current.launch !== undefined && paths.has(current.launch) ? current.launch : undefined,\n };\n },\n});\n","/**\n * Local copy of the host's formatRunDuration (src/web/lib/sessionSummary.ts):\n * this plugin keeps zero host-lib imports so its later move into the owning\n * package is a file relocation.\n */\nconst MINUTE_MS = 60 * 1000;\nconst HOUR_MS = 60 * MINUTE_MS;\n\nexport function formatRunDuration(elapsedMs: number): string {\n if (elapsedMs < MINUTE_MS) return '<1m';\n if (elapsedMs < HOUR_MS) return `${Math.floor(elapsedMs / MINUTE_MS)}m`;\n const hours = Math.floor(elapsedMs / HOUR_MS);\n const minutes = Math.floor((elapsedMs % HOUR_MS) / MINUTE_MS);\n return `${hours}h ${String(minutes).padStart(2, '0')}m`;\n}\n","import type { WorkflowRunView } from '../../../../../types/webWorkflows';\nimport { formatRunDuration } from './runDuration';\n\nexport type WorkflowActivityTone = 'running' | 'paused' | 'failed' | 'done' | 'skipped';\n\n/** One run as the activity dock lists it: identity, a tone, and a one-liner. */\nexport interface WorkflowActivityRow {\n /** Registry identity: workspace/runKey, unique across the session's runs. */\n identity: string;\n runKey: string;\n name: string;\n tone: WorkflowActivityTone;\n elapsed: string;\n /** Where the run is right now, or how it ended. */\n detail: string;\n /** The workflow session that owns the run, when it is not the session listing it. */\n ownerSessionId?: string;\n}\n\nconst PAUSED_STATES: ReadonlySet<NonNullable<WorkflowRunView['executionState']>> = new Set([\n 'paused',\n 'pause_requested',\n]);\n\nexport function workflowRunIdentity(run: Pick<WorkflowRunView, 'workspace' | 'runKey'>): string {\n return `${run.workspace}/${run.runKey}`;\n}\n\n/** Whether the session runs this workflow itself; a record from an older hub names no owner and means the viewer. */\nexport function ownsRun(run: Pick<WorkflowRunView, 'ownerSessionId'>, sessionId: string | null): boolean {\n return sessionId !== null && (run.ownerSessionId ?? sessionId) === sessionId;\n}\n\nfunction toneOf(run: WorkflowRunView): WorkflowActivityTone {\n if (run.stage === 'running') {\n return run.executionState !== undefined && PAUSED_STATES.has(run.executionState) ? 'paused' : 'running';\n }\n if (run.stage === 'error') return 'failed';\n if (run.outcome !== undefined && run.outcome !== 'success') return run.outcome === 'failed' ? 'failed' : 'skipped';\n return 'done';\n}\n\nfunction detailOf(run: WorkflowRunView, tone: WorkflowActivityTone): string {\n if (tone === 'paused') return 'paused; resume it from the owning session';\n if (tone === 'failed')\n return run.errorMessage ?? (run.failedJob === undefined ? 'failed' : `job '${run.failedJob}' failed`);\n if (tone === 'running') {\n if (run.position === undefined) return 'starting';\n return run.position.step === undefined ? run.position.job : `${run.position.job} · ${run.position.step}`;\n }\n return run.outcome ?? 'done';\n}\n\nfunction elapsedOf(run: WorkflowRunView, now: number): string {\n const start = Date.parse(run.startedAt);\n if (!Number.isFinite(start)) return '';\n const end = run.finishedAt === undefined ? now : Date.parse(run.finishedAt);\n return formatRunDuration(Math.max(0, (Number.isFinite(end) ? end : now) - start));\n}\n\n/** The hub's presented order is kept: it already puts live runs first. */\nexport function workflowActivityRows(\n runs: readonly WorkflowRunView[],\n now: number,\n sessionId: string | null = null,\n): WorkflowActivityRow[] {\n return runs.map((run) => {\n const tone = toneOf(run);\n return {\n identity: workflowRunIdentity(run),\n runKey: run.runKey,\n name: run.displayName,\n tone,\n elapsed: elapsedOf(run, now),\n detail: detailOf(run, tone),\n ...(run.ownerSessionId === undefined || run.ownerSessionId === sessionId\n ? {}\n : { ownerSessionId: run.ownerSessionId }),\n };\n });\n}\n\n/** The three answers a reader wants from the dock: what is live, what broke, what is done. */\nexport type WorkflowActivityGroupName = 'running' | 'failed' | 'successful';\n\nexport interface WorkflowActivityGroup {\n name: WorkflowActivityGroupName;\n rows: WorkflowActivityRow[];\n /**\n * Whether the group is open when the dock first draws it.\n *\n * Failures open because they are the only ones that need an answer, and a\n * folded failure is one nobody sees. Everything else stays folded so a\n * session's whole history does not push the other groups off the dock.\n */\n openByDefault: boolean;\n}\n\nconst GROUP_OF: Readonly<Record<WorkflowActivityTone, WorkflowActivityGroupName>> = {\n running: 'running',\n paused: 'running',\n failed: 'failed',\n done: 'successful',\n skipped: 'successful',\n};\n\nconst GROUP_ORDER: readonly WorkflowActivityGroupName[] = ['running', 'failed', 'successful'];\n\n/** Rows split by outcome, in the order the dock shows them; empty groups are dropped. */\nexport function workflowActivityGroups(rows: readonly WorkflowActivityRow[]): WorkflowActivityGroup[] {\n return GROUP_ORDER.map((name) => ({\n name,\n rows: rows.filter((row) => GROUP_OF[row.tone] === name),\n openByDefault: name !== 'successful',\n })).filter((group) => group.rows.length > 0);\n}\n","import type { SessionFrameSender } from '@agimon-ai/po-core/web';\nimport { defineSessionStore } from '@agimon-ai/po-core/web';\n\nimport { WORKFLOW_RUNS_TYPE, type WorkflowRunView } from '../../../../../types/webWorkflows';\nimport { workflowRunIdentity } from './workflowActivity';\n\n/** One session's record: the hub's last report plus the run this page is looking at. */\nexport interface WorkflowsSession {\n /** The workflow runs the hub last reported; presented order preserved. */\n runs: WorkflowRunView[];\n /** The run (workspace/runKey) the workflows tab shows; the first run until someone picks. */\n focusedRun: string | undefined;\n /**\n * A launch that was sent and has not shown up yet.\n *\n * The line goes to the session, the run appears on the registry channel some\n * seconds later, and nothing connects the two but timing: the first run this\n * session did not already have is the one that was just asked for.\n */\n pendingLaunch: { workflowPath: string; knownRuns: string[] } | undefined;\n}\n\nexport const workflows = defineSessionStore<WorkflowsSession>({\n runs: [],\n focusedRun: undefined,\n pendingLaunch: undefined,\n});\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** Points the workflows tab at one run; the activity dock uses this before opening the tab. */\nexport function focusRun(sessionId: string, identity: string | undefined): void {\n workflows.update(sessionId, (current) => ({ ...current, focusedRun: identity }));\n}\n\n/** Removes a deleted run immediately while the registry channel catches up. */\nexport function removeRun(sessionId: string, identity: string): void {\n workflows.update(sessionId, (current) => {\n const runs = current.runs.filter((run) => workflowRunIdentity(run) !== identity);\n return {\n ...current,\n runs,\n focusedRun:\n current.focusedRun === identity\n ? runs[0] === undefined\n ? undefined\n : workflowRunIdentity(runs[0])\n : current.focusedRun,\n };\n });\n}\n\n/**\n * Sends a launch line to the session and remembers what was already running.\n *\n * The cockpit's only channel to a session is a prompt frame, so a launch is\n * the verb the extension registers for exactly this; see web/launchLine.ts.\n */\nexport function requestLaunch(send: SessionFrameSender, sessionId: string, line: string, workflowPath: string): void {\n send(sessionId, { type: 'prompt', message: line });\n workflows.update(sessionId, (current) => ({\n ...current,\n pendingLaunch: { workflowPath, knownRuns: current.runs.map(workflowRunIdentity) },\n }));\n}\n\nexport interface WorkflowRunsPayload {\n runs: WorkflowRunView[];\n}\n\n/** The plugin's session data channel: 'workflow_runs' payloads into the store. */\nexport const workflowRunsChannel = workflows.channel<WorkflowRunsPayload>({\n channel: WORKFLOW_RUNS_TYPE,\n parse(input) {\n if (!isRecord(input) || !Array.isArray(input.runs)) return null;\n return { runs: input.runs.filter(isRecord) as unknown as WorkflowRunView[] };\n },\n reduce: (current, { runs }) => {\n const pending = current.pendingLaunch;\n if (pending === undefined) return { ...current, runs };\n const known = new Set(pending.knownRuns);\n const arrived = runs.find((run) => !known.has(workflowRunIdentity(run)));\n // Until one arrives the launch stays pending: a workflow can take a while\n // to reach the registry, and forgetting it would leave the board wherever\n // the reader last was.\n if (arrived === undefined) return { ...current, runs };\n return { ...current, runs, focusedRun: workflowRunIdentity(arrived), pendingLaunch: undefined };\n },\n});\n","import type { WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport {\n ArrowRightIcon,\n Button,\n ChevronDownIcon,\n ChevronRightIcon,\n Dot,\n type DotTone,\n} from '@agimon-ai/po-web-components';\nimport { useStore } from '@tanstack/react-store';\nimport { useEffect, useState } from 'react';\n\nimport { openCatalog } from '../../_lib/catalogStore';\nimport {\n type WorkflowActivityGroupName,\n type WorkflowActivityRow,\n type WorkflowActivityTone,\n workflowActivityGroups,\n workflowActivityRows,\n} from '../../_lib/workflowActivity';\nimport { focusRun, workflows } from '../../_lib/workflowsStore';\n\nconst TICK_MS = 10_000;\n\nconst TONE_DOT: Readonly<Record<WorkflowActivityTone, DotTone>> = {\n running: 'yellow',\n paused: 'yellow',\n failed: 'red',\n done: 'green',\n skipped: 'muted',\n};\n\nconst TONE_DETAIL: Readonly<Record<WorkflowActivityTone, string>> = {\n running: 'text-doom-dim',\n paused: 'text-doom-yellow',\n failed: 'text-doom-red',\n done: 'text-doom-dim',\n skipped: 'text-doom-dim',\n};\n\nconst GROUP_LABEL: Readonly<Record<WorkflowActivityGroupName, string>> = {\n running: 'text-doom-yellow',\n failed: 'text-doom-red',\n successful: 'text-doom-green',\n};\n\n/**\n * The workflows group's body in the activity dock: every run this session\n * started, split into running, failed and successful.\n *\n * A session keeps its whole history, so the groups fold: failures open because\n * they are the only ones that need an answer, and the rest stay out of the way\n * until somebody asks. Idle offers the catalog instead of saying nothing.\n */\nexport function WorkflowsActivitySection({ sessionId, openSession }: WebPluginSlotProps) {\n const runs = useStore(workflows.store, (state) => workflows.select(state, sessionId).runs);\n const [now, setNow] = useState(() => Date.now());\n const [folded, setFolded] = useState<Partial<Record<WorkflowActivityGroupName, boolean>>>({});\n\n useEffect(() => {\n const timer = setInterval(() => setNow(Date.now()), TICK_MS);\n return () => clearInterval(timer);\n }, []);\n\n const groups = workflowActivityGroups(workflowActivityRows(runs, now, sessionId));\n if (groups.length === 0) {\n return (\n <div className=\"flex flex-wrap items-center gap-x-4 gap-y-1\">\n <p data-testid=\"activity-summary-workflows\" className=\"text-sm text-doom-dim\">\n Idle\n </p>\n <Button\n variant=\"link\"\n size=\"sm\"\n data-testid=\"activity-workflow-launch\"\n className=\"h-auto gap-1 px-0 text-doom-green\"\n onClick={() => {\n if (sessionId === null) return;\n openCatalog(sessionId);\n }}\n >\n Launch a workflow\n <ArrowRightIcon aria-hidden className=\"size-3.5\" />\n </Button>\n </div>\n );\n }\n\n const RunRow = ({ row }: { row: WorkflowActivityRow }) => {\n // A run handed to its own workflow session opens that session; one this\n // session runs itself opens here.\n const delegated = row.ownerSessionId !== undefined && openSession !== undefined;\n return (\n <Button\n variant=\"ghost\"\n size=\"card\"\n data-testid={`activity-workflow-${row.runKey}`}\n data-run-tone={row.tone}\n data-delegated={delegated}\n title={delegated ? 'open its workflow session' : 'show this run in the workflow dock'}\n onClick={() => {\n if (row.ownerSessionId !== undefined && openSession !== undefined) {\n openSession(row.ownerSessionId);\n return;\n }\n if (sessionId !== null) focusRun(sessionId, row.identity);\n }}\n className=\"min-w-0 gap-0.5 rounded-md px-1 py-1 hover:bg-doom-panel\"\n >\n <span className=\"flex min-w-0 items-center gap-1.5\">\n <Dot tone={TONE_DOT[row.tone]} pulse={row.tone === 'running'} />\n <span\n className={`min-w-0 flex-1 truncate text-base font-semibold ${\n row.tone === 'running' || row.tone === 'paused' ? 'text-doom-hi' : 'text-doom-dim'\n }`}\n >\n {row.name}\n </span>\n <span className=\"shrink-0 text-sm text-doom-dim\">{row.elapsed}</span>\n </span>\n <span className={`truncate pl-3 text-sm ${TONE_DETAIL[row.tone]}`}>{row.detail}</span>\n </Button>\n );\n };\n\n return (\n <div data-testid=\"activity-workflow-runs\" className=\"flex flex-col gap-0.5\">\n {groups.map((group) => {\n const open = folded[group.name] ?? group.openByDefault;\n return (\n <div key={group.name} className=\"flex flex-col gap-0.5\">\n <Button\n variant=\"ghost\"\n size=\"xs\"\n data-testid={`activity-workflow-group-${group.name}`}\n data-open={open}\n aria-expanded={open}\n onClick={() => setFolded((current) => ({ ...current, [group.name]: !open }))}\n className=\"justify-start gap-1.5 rounded-md px-1 py-0.5 hover:bg-doom-panel\"\n >\n {open ? (\n <ChevronDownIcon className=\"h-2.5 w-2.5 text-doom-faint\" />\n ) : (\n <ChevronRightIcon className=\"h-2.5 w-2.5 text-doom-faint\" />\n )}\n <span className={`inline-block text-sm font-semibold first-letter:uppercase ${GROUP_LABEL[group.name]}`}>\n {group.name}\n </span>\n <span className=\"text-2xs text-doom-faint\">{group.rows.length}</span>\n </Button>\n {open ? (\n <div className=\"flex flex-col gap-0.5 pl-2\">\n {group.rows.map((row) => (\n <RunRow key={row.identity} row={row} />\n ))}\n </div>\n ) : (\n <span className=\"truncate pl-5 text-sm text-doom-dim\">\n {group.rows\n .slice(0, 2)\n .map((row) => row.name)\n .join(', ')}\n {group.rows.length > 2 ? `, and ${group.rows.length - 2} more` : ''}\n </span>\n )}\n </div>\n );\n })}\n </div>\n );\n}\n","import type { ToolResultView } from '@agimon-ai/po-core/web';\nimport type { MessageLine, MessageLineTone } from '@agimon-ai/po-web-components';\n\n/**\n * The cockpit half of src/tui/workflow/workflowToolRender.ts: the same\n * result shapes reduced to a list of toned lines, so the React cards stay a\n * thin mapping and the parsing is testable without a DOM. Kept in step with\n * the TUI by hand; the two share no code because web/ may not import src/tui.\n */\n\nexport type WorkflowToolName = 'launch_workflow' | 'list_workflows' | 'workflow_run' | 'workflow_tools';\n\n/** The toned lines the shared MessageLines draws; the vocabulary is the components package's. */\nexport type LineTone = MessageLineTone;\nexport type ToolLine = MessageLine;\n\nexport interface WorkflowCallSummary {\n action: string;\n target?: string;\n metadata: string[];\n}\n\nexport interface WorkflowRenderOptions {\n expanded: boolean;\n isError: boolean;\n isPartial: boolean;\n}\n\ntype JsonRecord = Record<string, unknown>;\n\ninterface WorkflowState {\n tone: LineTone;\n glyph: string;\n label: string;\n}\n\ninterface WorkflowCatalogItem {\n description: string;\n name: string;\n path: string;\n tags: string[];\n}\n\ninterface WorkflowCatalog {\n directory?: string;\n page: number;\n pageSize: number;\n tags: Array<{ count: number; tag: string }>;\n total: number;\n totalPages: number;\n workflows: WorkflowCatalogItem[];\n}\n\ninterface EvidenceSection {\n body: string[];\n name: string;\n}\n\nconst COLLAPSED_CATALOG_ROWS = 6;\nconst COLLAPSED_DETAIL_LINES = 8;\nconst PARTIAL_DETAIL_LINES = 4;\n\nexport const WORKFLOW_TOOL_NAMES: readonly WorkflowToolName[] = [\n 'list_workflows',\n 'launch_workflow',\n 'workflow_run',\n 'workflow_tools',\n];\n\nfunction asRecord(value: unknown): JsonRecord | undefined {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return undefined;\n return value as JsonRecord;\n}\n\nfunction inlineText(value: string): string {\n let normalized = '';\n for (const character of value) {\n const code = character.codePointAt(0) ?? 0;\n normalized += code <= 31 || code === 127 ? ' ' : character;\n }\n return normalized.replace(/\\s+/gu, ' ').trim();\n}\n\nfunction readString(record: JsonRecord | undefined, key: string): string | undefined {\n const value = record?.[key];\n if (typeof value !== 'string') return undefined;\n return inlineText(value) || undefined;\n}\n\nfunction readNumber(record: JsonRecord | undefined, key: string): number | undefined {\n const value = record?.[key];\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n\nfunction readBoolean(record: JsonRecord | undefined, key: string): boolean | undefined {\n const value = record?.[key];\n return typeof value === 'boolean' ? value : undefined;\n}\n\nfunction readStringArray(record: JsonRecord | undefined, key: string): string[] {\n const value = record?.[key];\n if (!Array.isArray(value)) return [];\n return value.filter((item): item is string => typeof item === 'string');\n}\n\nfunction parseJsonRecord(text: string | undefined): JsonRecord | undefined {\n if (!text) return undefined;\n try {\n return asRecord(JSON.parse(text));\n } catch {\n // Not every workflow result is JSON; the plain-text shapes fall through.\n return undefined;\n }\n}\n\nfunction textBlocks(result: ToolResultView | null): string[] {\n if (!result) return [];\n return result.content.flatMap((item) => {\n const record = asRecord(item);\n return record?.type === 'text' && typeof record.text === 'string' ? [record.text] : [];\n });\n}\n\nfunction detailLines(result: ToolResultView | null): string[] {\n return textBlocks(result)\n .flatMap((block) => block.split('\\n'))\n .map((entry) => entry.trimEnd())\n .filter((entry) => entry.length > 0);\n}\n\nfunction firstPayload(result: ToolResultView | null): JsonRecord | undefined {\n return parseJsonRecord(textBlocks(result)[0]);\n}\n\nfunction plural(count: number, singular: string, pluralForm = `${singular}s`): string {\n return count === 1 ? singular : pluralForm;\n}\n\nfunction line(text: string, tone: LineTone, extra: Omit<ToolLine, 'text' | 'tone'> = {}): ToolLine {\n return { text, tone, ...extra };\n}\n\nfunction labelValue(label: string, value: string): ToolLine {\n return line(`${label} ${value}`, 'text');\n}\n\nfunction hiddenLine(hidden: number): ToolLine {\n return line(`… ${hidden} more`, 'dim');\n}\n\nfunction targetScope(args: JsonRecord): string | undefined {\n const runKey = readString(args, 'runKey');\n if (!runKey) return undefined;\n const workspace = readString(args, 'workspace');\n return workspace ? `${workspace}/${runKey}` : runKey;\n}\n\nfunction toolAction(toolName: WorkflowToolName, args: JsonRecord): string {\n if (toolName === 'list_workflows') return 'list';\n if (toolName === 'launch_workflow') return 'launch';\n return readString(args, 'action') ?? 'run';\n}\n\nfunction toolTarget(toolName: WorkflowToolName, args: JsonRecord): string | undefined {\n if (toolName === 'list_workflows') return readString(args, 'directory');\n if (toolName === 'launch_workflow') return readString(args, 'workflowPath');\n return targetScope(args);\n}\n\nfunction statusTimestamp(value: string): string {\n return value.replace('T', ' ').replace(/\\.\\d{3}Z$/, 'Z');\n}\n\nfunction workflowNameFromPath(path: string | undefined): string {\n if (!path) return 'workflow';\n const filename = path.split('/').at(-1) ?? path;\n return filename.replace(/\\.workflow\\.ya?ml$/u, '') || filename;\n}\n\nfunction callMetadata(toolName: WorkflowToolName, args: JsonRecord): string[] {\n const values: string[] = [];\n\n if (toolName === 'list_workflows') {\n const page = readNumber(args, 'page');\n const pageSize = readNumber(args, 'pageSize');\n if (page !== undefined) values.push(`page ${page}`);\n if (pageSize !== undefined) values.push(`${pageSize}/page`);\n if (readString(args, 'filter')) values.push('filtered');\n const tags = readStringArray(args, 'tags');\n if (tags.length > 0) values.push(`${tags.length} ${plural(tags.length, 'tag')}`);\n } else if (toolName === 'launch_workflow') {\n const job = readString(args, 'job');\n const runner = readString(args, 'runner');\n const workspace = readString(args, 'workspace');\n const inputCount = Object.keys(asRecord(args.inputs) ?? {}).length;\n const environmentCount = Object.keys(asRecord(args.env) ?? {}).length;\n if (workspace) values.push(`workspace ${workspace}`);\n if (job) values.push(`job ${job}`);\n if (runner) values.push(`runner ${runner}`);\n if (readBoolean(args, 'dryRun')) values.push('dry run');\n if (readString(args, 'prompt')) values.push('with prompt');\n if (inputCount > 0) values.push(`${inputCount} ${plural(inputCount, 'input')}`);\n if (environmentCount > 0) values.push(`${environmentCount} env`);\n } else {\n if (readString(args, 'expectedRunId')) values.push('generation checked');\n if (readString(args, 'reason')) values.push('with reason');\n if (readBoolean(args, 'dryRun')) values.push('dry run');\n if (readString(args, 'job')) values.push('job override');\n if (readString(args, 'runner')) values.push('runner override');\n }\n\n return values;\n}\n\n/** The header beside the tool name: action, target, and the call's flags. */\nexport function workflowCallSummary(toolName: WorkflowToolName, args: JsonRecord): WorkflowCallSummary {\n const target = toolTarget(toolName, args);\n return {\n action: toolAction(toolName, args),\n ...(target === undefined ? {} : { target }),\n metadata: callMetadata(toolName, args),\n };\n}\n\nfunction parseCatalog(payload: JsonRecord | undefined): WorkflowCatalog | undefined {\n if (!Array.isArray(payload?.workflows)) return undefined;\n\n const workflows = payload.workflows.flatMap((value) => {\n const record = asRecord(value);\n const path = readString(record, 'path');\n if (!record || !path) return [];\n return [\n {\n description: readString(record, 'description') ?? '',\n name: readString(record, 'name') ?? '',\n path,\n tags: readStringArray(record, 'tags'),\n },\n ];\n });\n const tags = Array.isArray(payload.tags)\n ? payload.tags.flatMap((value) => {\n const record = asRecord(value);\n const tag = readString(record, 'tag');\n const count = readNumber(record, 'count');\n return tag && count !== undefined ? [{ count, tag }] : [];\n })\n : [];\n\n const directory = readString(payload, 'directory');\n return {\n ...(directory === undefined ? {} : { directory }),\n page: readNumber(payload, 'page') ?? 1,\n pageSize: readNumber(payload, 'pageSize') ?? workflows.length,\n tags,\n total: readNumber(payload, 'total') ?? workflows.length,\n totalPages: readNumber(payload, 'totalPages') ?? (workflows.length > 0 ? 1 : 0),\n workflows,\n };\n}\n\nfunction catalogItemLines(item: WorkflowCatalogItem, expanded: boolean): ToolLine[] {\n const name = item.name || workflowNameFromPath(item.path);\n const lines = [line(`› ${name} · ${item.path}`, 'text')];\n if (!expanded) return lines;\n if (item.description) lines.push(line(item.description, 'muted', { indent: true }));\n if (item.tags.length > 0) lines.push(line(`tags ${item.tags.join(', ')}`, 'dim', { indent: true }));\n return lines;\n}\n\nfunction catalogLines(result: ToolResultView | null, options: WorkflowRenderOptions): ToolLine[] | undefined {\n const catalog = parseCatalog(firstPayload(result));\n if (!catalog) return undefined;\n\n const pageLabel = `page ${catalog.page}/${catalog.totalPages}`;\n const glyph = catalog.total > 0 ? '✓' : '○';\n const summary = line(`${glyph} ${catalog.total} ${plural(catalog.total, 'workflow')} · ${pageLabel}`, 'hi', {\n bold: true,\n });\n const shown = options.expanded ? catalog.workflows : catalog.workflows.slice(0, COLLAPSED_CATALOG_ROWS);\n const lines = [summary, ...shown.flatMap((item) => catalogItemLines(item, options.expanded))];\n const hidden = catalog.workflows.length - shown.length;\n if (hidden > 0) lines.push(hiddenLine(hidden));\n\n if (options.expanded) {\n if (catalog.tags.length > 0) {\n const tags = catalog.tags.map(({ count, tag }) => `${tag} (${count})`).join(', ');\n lines.push(labelValue('available tags', tags));\n }\n if (catalog.directory) lines.push(labelValue('directory', catalog.directory));\n lines.push(labelValue('page size', String(catalog.pageSize)));\n }\n return lines;\n}\n\nfunction readWorkflowState(record: JsonRecord): WorkflowState {\n const stage = readString(record, 'effectiveStage') ?? readString(record, 'stage') ?? 'unknown';\n const outcome = readString(record, 'effectiveOutcome') ?? readString(record, 'outcome');\n const executionState = readString(record, 'executionState');\n\n if (outcome === 'interrupted') return { tone: 'warning', glyph: '!', label: 'interrupted' };\n if (stage === 'error' || outcome === 'failed') return { tone: 'error', glyph: '✗', label: 'failed' };\n if (stage === 'completed' && outcome === 'skipped') return { tone: 'muted', glyph: '○', label: 'skipped' };\n if (stage === 'completed') return { tone: 'success', glyph: '✓', label: 'completed' };\n if (executionState === 'paused') return { tone: 'warning', glyph: 'Ⅱ', label: 'paused' };\n if (executionState === 'pause_requested') return { tone: 'warning', glyph: '◐', label: 'pause requested' };\n if (executionState === 'resume_requested') return { tone: 'warning', glyph: '◐', label: 'resume requested' };\n if (stage === 'running') return { tone: 'accent', glyph: '◐', label: 'running' };\n return { tone: 'muted', glyph: '○', label: stage };\n}\n\nfunction currentActivity(record: JsonRecord): ToolLine | undefined {\n const position = asRecord(record.position);\n const cursor = asRecord(record.executionCursor);\n const job = readString(position, 'job') ?? readString(cursor, 'job') ?? readString(record, 'job');\n const step = readString(position, 'step') ?? readString(cursor, 'stepName');\n const phase = readString(cursor, 'phase');\n if (!job && !step && !phase) return undefined;\n const context = job ?? phase ?? 'workflow';\n return line(`[${context}] ${step ?? phase ?? 'current job'}`, 'text', { indent: true });\n}\n\nfunction launcherLabel(record: JsonRecord): string | undefined {\n const launcher = asRecord(record.launcher);\n const type = readString(launcher, 'type');\n if (!type) return undefined;\n const identity = readString(launcher, 'sessionName') ?? readString(launcher, 'workspaceId');\n return identity ? `${type} ${identity}` : type;\n}\n\nfunction workflowRecordLines(record: JsonRecord, expanded: boolean): ToolLine[] | undefined {\n const runKey = readString(record, 'runKey');\n const stage = readString(record, 'stage');\n if (!runKey || !stage) return undefined;\n\n const state = readWorkflowState(record);\n const displayName = readString(record, 'displayName') ?? runKey;\n const lines = [\n line(`Status retrieved · ${displayName} · workflow: ${state.label}`, state.tone, { bold: true }),\n labelValue('workspace', readString(record, 'workspace') ?? 'unknown'),\n labelValue('runKey', runKey),\n ];\n const activity = currentActivity(record);\n if (activity) lines.push(activity);\n\n const failure = readString(record, 'errorMessage') ?? readString(record, 'failureReason');\n if (failure) lines.push(line(`error ${failure}`, 'error'));\n const staleReason = readString(record, 'staleReason');\n if (staleReason) lines.push(line(`stale ${staleReason}`, 'warning'));\n\n const startedAt = readString(record, 'startedAt');\n const exitCode = readNumber(record, 'exitCode');\n const conciseMetadata = [\n readString(record, 'runner') ? `runner ${readString(record, 'runner')}` : undefined,\n readBoolean(record, 'dryRun') ? 'dry run' : undefined,\n exitCode !== undefined ? `exit ${exitCode}` : undefined,\n startedAt ? `started ${statusTimestamp(startedAt)}` : undefined,\n ].filter((value): value is string => !!value);\n if (conciseMetadata.length > 0) lines.push(line(conciseMetadata.join(' · '), 'dim'));\n\n if (!expanded) return lines;\n\n const finishedAt = readString(record, 'finishedAt');\n const repairId = readString(record, 'activeRepairId');\n const detailedValues: Array<[string, string | undefined]> = [\n ['workflow', readString(record, 'workflowPath')],\n ['workflow id', readString(record, 'workflowId')],\n ['run id', readString(record, 'runId')],\n ['launcher', launcherLabel(record)],\n ['job', readString(record, 'job')],\n ['outcome', readString(record, 'effectiveOutcome') ?? readString(record, 'outcome')],\n ['finished', finishedAt ? statusTimestamp(finishedAt) : undefined],\n ['pid', readNumber(record, 'pid')?.toString()],\n ['repair', repairId ? `#${repairId}` : undefined],\n ['worktree', readString(record, 'worktreeBranch') ?? readString(record, 'worktreePath')],\n ];\n for (const [label, value] of detailedValues) {\n if (value) lines.push(labelValue(label, value));\n }\n const jobs = record.jobs;\n if (Array.isArray(jobs)) {\n for (const value of jobs) {\n const job = asRecord(value);\n const name = readString(job, 'name');\n const status = readString(job, 'status');\n if (!name || !status) continue;\n lines.push(labelValue('job', `${name} · ${status}`));\n if (!Array.isArray(job?.steps)) continue;\n for (const value of job.steps) {\n const step = asRecord(value);\n const stepName = readString(step, 'name');\n const stepStatus = readString(step, 'status');\n if (stepName && stepStatus) lines.push(line(`step ${stepName} · ${stepStatus}`, 'text', { indent: true }));\n }\n }\n }\n return lines;\n}\n\nfunction statusLines(result: ToolResultView | null, options: WorkflowRenderOptions): ToolLine[] | undefined {\n const payload = firstPayload(result);\n if (!payload) return undefined;\n return workflowRecordLines(payload, options.expanded);\n}\n\nfunction nestedRequestedAt(payload: JsonRecord | undefined): string | undefined {\n return readString(asRecord(payload?.request), 'requestedAt') ?? readString(payload, 'requestedAt');\n}\n\nfunction controlLines(\n action: string,\n args: JsonRecord,\n result: ToolResultView | null,\n options: WorkflowRenderOptions,\n): ToolLine[] {\n const payload = firstPayload(result);\n const scope = targetScope(args) ?? readString(payload, 'runKey') ?? 'workflow';\n const payloadWorkspace = readString(payload, 'workspace');\n const resolvedScope = payloadWorkspace && !scope.includes('/') ? `${payloadWorkspace}/${scope}` : scope;\n const lines = [line(`◐ ${action} requested · ${resolvedScope}`, 'warning', { bold: true })];\n const requestedAt = nestedRequestedAt(payload);\n if (requestedAt) lines.push(labelValue('requested', statusTimestamp(requestedAt)));\n if (options.expanded) lines.push(line('verify the transition with workflow_run status', 'dim'));\n return lines;\n}\n\nfunction matchLine(text: string, pattern: RegExp): string | undefined {\n return text.match(pattern)?.[1]?.trim();\n}\n\nfunction launchSummary(text: string, args: JsonRecord): { name: string; scope: string; state: WorkflowState } {\n const startedName = matchLine(text, /^Started (.+) in workspace .+\\.$/mu);\n const workspace = matchLine(text, /^Started .+ in workspace (.+)\\.$/mu) ?? readString(args, 'workspace');\n const runKey = matchLine(text, /^Run key:\\s*(.+)$/mu);\n const path = readString(args, 'workflowPath');\n const name = startedName ?? workflowNameFromPath(path);\n const scope = runKey ? (workspace ? `${workspace}/${runKey}` : runKey) : (workspace ?? path ?? 'workflow');\n\n if (/Workflow completed successfully/iu.test(text)) {\n return { name, scope, state: { tone: 'success', glyph: '✓', label: 'completed' } };\n }\n if (/Workflow skipped/iu.test(text)) {\n return { name, scope, state: { tone: 'muted', glyph: '○', label: 'skipped' } };\n }\n if (/no run was registered/iu.test(text)) {\n return { name, scope, state: { tone: 'warning', glyph: '◐', label: 'starting · run key pending' } };\n }\n return { name, scope, state: { tone: 'accent', glyph: '◐', label: runKey ? 'started' : 'launch accepted' } };\n}\n\nfunction launchLines(args: JsonRecord, result: ToolResultView | null, options: WorkflowRenderOptions): ToolLine[] {\n const text = textBlocks(result).join('\\n');\n const summary = launchSummary(text, args);\n const lines = [\n line(`${summary.state.glyph} ${summary.name} · ${summary.scope} · ${summary.state.label}`, summary.state.tone, {\n bold: true,\n }),\n ];\n const metadata = [\n readString(args, 'job') ? `job ${readString(args, 'job')}` : undefined,\n readString(args, 'runner') ? `runner ${readString(args, 'runner')}` : undefined,\n readBoolean(args, 'dryRun') ? 'dry run' : undefined,\n ].filter((value): value is string => !!value);\n if (metadata.length > 0) lines.push(line(metadata.join(' · '), 'dim'));\n if (options.expanded) {\n const details = detailLines(result).filter((entry) => !entry.startsWith('Next steps for the agent:'));\n lines.push(...details.map((entry) => line(entry, 'text')));\n }\n return lines;\n}\n\nfunction splitEvidence(text: string): EvidenceSection[] {\n const sections: EvidenceSection[] = [];\n let current: EvidenceSection | undefined;\n for (const entry of text.split('\\n')) {\n const match = entry.match(/^--- (.+) ---$/u);\n if (match?.[1]) {\n current = { body: [], name: match[1] };\n sections.push(current);\n continue;\n }\n current?.body.push(entry);\n }\n return sections;\n}\n\nfunction recoveryEvidenceLines(\n args: JsonRecord,\n result: ToolResultView | null,\n options: WorkflowRenderOptions,\n): ToolLine[] {\n const sections = splitEvidence(textBlocks(result).join('\\n'));\n const runSection = sections.find((section) => section.name === 'run.json');\n const record = parseJsonRecord(runSection?.body.join('\\n'));\n const recordLines = record ? workflowRecordLines(record, options.expanded) : undefined;\n const evidenceSections = sections.filter((section) => section.name !== 'run.json');\n const scope = targetScope(args) ?? 'workflow';\n const lines = recordLines ?? [line(`✓ recovery evidence · ${scope}`, 'success', { bold: true })];\n const names = evidenceSections.map((section) => section.name);\n lines.push(\n names.length > 0 ? labelValue('evidence', names.join(', ')) : line('no durable evidence files recorded', 'muted'),\n );\n if (options.expanded) {\n for (const section of evidenceSections) {\n lines.push(line(section.name, 'hi', { bold: true }));\n lines.push(...section.body.filter((entry) => entry.length > 0).map((entry) => line(entry, 'text')));\n }\n }\n return lines;\n}\n\nfunction simpleActionLines(\n action: string,\n args: JsonRecord,\n result: ToolResultView | null,\n options: WorkflowRenderOptions,\n): ToolLine[] {\n const scope = targetScope(args) ?? 'workflow';\n const actionLabel: Record<string, string> = {\n follow: 'following output',\n open: 'launcher opened',\n recover: readBoolean(args, 'dryRun') ? 'recovery dry run finished' : 'recovery accepted',\n tail: 'launcher output checked',\n };\n const state: WorkflowState =\n action === 'recover'\n ? { tone: 'accent', glyph: '◐', label: actionLabel[action] ?? action }\n : { tone: 'success', glyph: '✓', label: actionLabel[action] ?? action };\n const lines = [line(`${state.glyph} ${state.label} · ${scope}`, state.tone, { bold: true })];\n const details = detailLines(result);\n if (action === 'tail') {\n const workflowLine = details.find((entry) => entry.startsWith('Workflow:'));\n const stageLine = details.find((entry) => entry.startsWith('Stage:'));\n if (workflowLine) lines.push(line(workflowLine, 'text'));\n if (stageLine) lines.push(line(stageLine, 'text'));\n }\n if (options.expanded) lines.push(...details.map((entry) => line(entry, 'text')));\n return lines;\n}\n\nfunction failureLines(\n toolName: WorkflowToolName,\n args: JsonRecord,\n result: ToolResultView | null,\n options: WorkflowRenderOptions,\n): ToolLine[] {\n const action = toolAction(toolName, args);\n const target = toolTarget(toolName, args);\n const details = detailLines(result);\n const shown = options.expanded ? details : details.slice(0, COLLAPSED_DETAIL_LINES);\n const lines = [\n line(\n toolName === 'workflow_run' && action === 'status'\n ? `✗ Status lookup failed${target ? ` · ${target}` : ''}`\n : `✗ ${action} failed${target ? ` · ${target}` : ''}`,\n 'error',\n { bold: true },\n ),\n ...(shown.length > 0 ? shown.map((entry) => line(entry, 'text')) : [line('Unknown workflow error', 'error')]),\n ];\n const hidden = details.length - shown.length;\n if (hidden > 0) lines.push(hiddenLine(hidden));\n return lines;\n}\n\nfunction partialLines(toolName: WorkflowToolName, args: JsonRecord, result: ToolResultView | null): ToolLine[] {\n const details = detailLines(result);\n const shown = details.slice(-PARTIAL_DETAIL_LINES);\n const action = toolAction(toolName, args);\n const target = toolTarget(toolName, args);\n const hidden = details.length - shown.length;\n const lines = [line(`◐ ${action}${target ? ` · ${target}` : ''}`, 'accent', { bold: true })];\n if (hidden > 0) lines.push(line(`… ${hidden} earlier`, 'dim'));\n lines.push(...shown.map((entry) => line(entry, 'text')));\n return lines;\n}\n\nfunction fallbackLines(result: ToolResultView | null, options: WorkflowRenderOptions): ToolLine[] {\n const details = detailLines(result);\n if (details.length === 0) return [line('No workflow output.', 'muted')];\n const shown = options.expanded ? details : details.slice(0, COLLAPSED_DETAIL_LINES);\n const lines = shown.map((entry) => line(entry, 'text'));\n const hidden = details.length - shown.length;\n if (hidden > 0) lines.push(hiddenLine(hidden));\n return lines;\n}\n\n/** The body of a workflow tool card, chosen by tool, action, and result shape. */\nexport function workflowResultLines(\n toolName: WorkflowToolName,\n args: JsonRecord,\n result: ToolResultView | null,\n options: WorkflowRenderOptions,\n): ToolLine[] {\n if (options.isPartial) return partialLines(toolName, args, result);\n if (options.isError) return failureLines(toolName, args, result, options);\n\n if (toolName === 'list_workflows') return catalogLines(result, options) ?? fallbackLines(result, options);\n if (toolName === 'launch_workflow') return launchLines(args, result, options);\n\n const action = readString(args, 'action');\n if (action === 'status') return statusLines(result, options) ?? fallbackLines(result, options);\n if (action === 'pause' || action === 'resume' || action === 'stop')\n return controlLines(action, args, result, options);\n if (action === 'recovery-evidence') return recoveryEvidenceLines(args, result, options);\n if (action === 'follow' || action === 'open' || action === 'recover' || action === 'tail') {\n return simpleActionLines(action, args, result, options);\n }\n return fallbackLines(result, options);\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport { MessageItem, MessageItemBody, MessageItemHeader, MessageLines, toolTone } from '@agimon-ai/po-web-components';\n\nimport {\n type WorkflowToolName,\n WORKFLOW_TOOL_NAMES,\n workflowCallSummary,\n workflowResultLines,\n} from '../_lib/workflowToolRender';\n\nfunction workflowToolName(name: string): WorkflowToolName {\n return WORKFLOW_TOOL_NAMES.includes(name as WorkflowToolName) ? (name as WorkflowToolName) : 'workflow_run';\n}\n\n/**\n * The workflow tools' timeline item, the web analog of renderWorkflowToolCall\n * and renderWorkflowToolResult: `action · target · flags` in the header and\n * the shape-specific summary lines in the body.\n */\nexport function WorkflowToolMessage({ toolName, args, result, running, isError }: ToolMessageRenderProps) {\n const name = workflowToolName(toolName);\n const summary = workflowCallSummary(name, args);\n const collapsed = workflowResultLines(name, args, result, { expanded: false, isError, isPartial: running });\n const full = workflowResultLines(name, args, result, { expanded: true, isError, isPartial: running });\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable={full.length > collapsed.length}>\n {({ expanded }) => (\n <>\n <MessageItemHeader title={toolName}>\n <span data-testid={`tool-call-${toolName}`} className=\"flex min-w-0 flex-1 items-center gap-2\">\n <span className=\"font-semibold text-doom-hi\">{summary.action}</span>\n {summary.target ? <span className=\"min-w-0 truncate text-doom-dim\">{summary.target}</span> : null}\n {summary.metadata.map((value) => (\n <span key={value} className=\"shrink-0 text-doom-dim\">\n · {value}\n </span>\n ))}\n </span>\n </MessageItemHeader>\n {(expanded ? full : collapsed).length > 0 ? (\n <MessageItemBody data-testid={`tool-result-${toolName}`}>\n <MessageLines lines={expanded ? full : collapsed} />\n </MessageItemBody>\n ) : null}\n </>\n )}\n </MessageItem>\n );\n}\n","import type { WebPluginDefinition } from '@agimon-ai/po-core/web';\nimport { WorkflowIcon } from '@agimon-ai/po-web-components';\n\nimport { WorkflowsActivitySection } from '../fill/_components/WorkflowsActivitySection';\nimport { WorkflowToolMessage } from '../tool/_components/WorkflowToolMessage';\nimport { openCatalog, openWorkflowCatalogForContext, workflowCatalogChannel } from './catalogStore';\nimport { workflowRunsChannel, workflows } from './workflowsStore';\nconst WORKFLOWS_GROUP = { key: 'w', label: 'workflows', detail: 'multi-step agent runs' };\nconst workflowActivitySource = {\n subscribe(listener: () => void) {\n const subscription = workflows.store.subscribe(listener);\n return () => subscription.unsubscribe();\n },\n isActive(sessionId: string | null) {\n return workflows.select(workflows.store.state, sessionId).runs.some((run) => run.stage === 'running');\n },\n};\n\nexport default {\n // No tab: a run lives in its own workflow session, whose dock shows it, and\n // the catalog opens over whatever the session shows.\n channels: [workflowRunsChannel, workflowCatalogChannel],\n contextActions: [\n {\n id: 'launch-workflow',\n label: 'Launch Workflow',\n detail: 'Choose a workflow, review its inputs, then launch it.',\n kinds: ['work-item'],\n order: 20,\n run: (context) => openWorkflowCatalogForContext(context),\n },\n ],\n minorModes: [{ name: 'workflow', keys: 'w e', widgetKey: 'workflow-mcp-progress', order: 50 }],\n activityGroups: [\n {\n name: 'workflows',\n keys: 'w r',\n icon: WorkflowIcon,\n widgetKeys: ['workflow-mcp-progress', 'workflow-mcp-follow'],\n activeSource: workflowActivitySource,\n order: 30,\n },\n ],\n // Same name as the group: the dock renders this inside it, in place of the\n // widget's bare presence signal.\n activitySections: [{ id: 'workflows', component: WorkflowsActivitySection }],\n // The workflow tools' timeline cards, the web half of src/tui/workflow/workflowToolRender.ts.\n toolRenderers: [\n { tools: ['list_workflows', 'launch_workflow', 'workflow_run', 'workflow_tools'], message: WorkflowToolMessage },\n ],\n // The TUI's SPC w l and w e. SPC w r opened the old runs tab, which a run's\n // workflow session and its dock face replace; recovery (w c) is TUI-only.\n leaderBindings: [\n {\n id: 'doom-workflow.catalog',\n path: [WORKFLOWS_GROUP, { key: 'l', label: 'launch', detail: 'pick a workflow and launch it' }],\n run: (context) => {\n if (context.sessionId !== null) openCatalog(context.sessionId);\n },\n },\n {\n id: 'doom-workflow.toggle',\n path: [WORKFLOWS_GROUP, { key: 'e', label: 'toggle', detail: 'give the agent workflow tools or take them back' }],\n command: 'minor workflow',\n },\n ],\n} satisfies NonNullable<WebPluginDefinition['session']>;\n","import { defineContextAction } from '@agimon-ai/po-core/web';\n\nimport legacy from '../_lib';\n\nexport default defineContextAction(legacy.contextActions![0]!);\n","import { defineActivityGroup } from '@agimon-ai/po-core/web';\n\nimport legacy from '../_lib';\n\nexport default defineActivityGroup(legacy.activityGroups![0]!);\n","import { defineChannelFile } from '@agimon-ai/po-core/web';\n\nimport legacy from '../_lib';\n\nexport default defineChannelFile(legacy.channels![1]!);\n","import { defineChannelFile } from '@agimon-ai/po-core/web';\n\nimport legacy from '../_lib';\n\nexport default defineChannelFile(legacy.channels![0]!);\n","import { apiResponse, defineApiRoutes } from '@agimon-ai/po-core/web';\n\nimport type {\n WorkflowArtifactContentResponse,\n WorkflowArtifactsResponse,\n WorkflowControlResponse,\n WorkflowDeleteResponse,\n WorkflowLaunchResponse,\n WorkflowOpenRunDirectoryResponse,\n WorkflowSteerResponse,\n WorkflowStopResponse,\n} from './webWorkflowTerminal';\n\n/**\n * This package's routes, as data.\n *\n * No scope and no base path. The build reads both off\n * `src/extensions/(backend)/api/workflow/`, so the mount is stated once, by the\n * folder that creates it. The same API answers at all three scopes, because a\n * global contribution cascades into workspace and session; the folder under\n * `workspaces/sessions/` only re-mounts it for a session's own server.\n *\n * This is the one file the routes, the Hono app and the browser all read, so a\n * path cannot move on one side alone. The page used to build the hub's own\n * absolute URL and then rewrite its plugin prefix with String.replace to reach\n * a session, which is exactly the kind of copy that can move by one character\n * without anything noticing.\n *\n * `:workspace` and `:runKey` are Hono's own parameter syntax, because the app\n * registers `path` verbatim.\n */\n\n/** One run, which every route below addresses. */\nconst RUN = '/runs/:workspace/:runKey';\n\n/**\n * The artifact route's parameter, as Hono spells a multi-segment match.\n *\n * An artifact is named by its path inside the run directory, so `reports/a.md`\n * is one parameter across two segments. The client's `params` substitution\n * fills a single segment and percent-encodes the slash with it, so the page\n * substitutes this one itself; see the page's `_lib/terminalApi.ts`.\n */\nexport const ARTIFACT_NAME_PARAM = ':name{.+}';\n\n/**\n * The step whose pane a terminal route reads: a step ref's id. Absent, the\n * route follows the run's current step, which is one of a parallel group's.\n */\nexport const STEP_TARGET_PARAM = 'step';\n\n/** Query parameters the artifact route reads, spelled once for both halves. */\nexport const ARTIFACT_RAW_PARAM = 'raw';\nexport const ARTIFACT_DOWNLOAD_PARAM = 'download';\n\nexport default defineApiRoutes({\n /**\n * The terminal, as server-sent events.\n *\n * `stream: true` gets a URL and no call method: the consumer is the browser's\n * own `EventSource`, and a relayed call would buffer a stream that never ends.\n */\n screen: {\n method: 'GET',\n path: `${RUN}/screen/stream`,\n query: [STEP_TARGET_PARAM],\n stream: true,\n },\n control: {\n method: 'POST',\n path: `${RUN}/control`,\n response: apiResponse<WorkflowControlResponse>(),\n },\n keys: {\n method: 'POST',\n path: `${RUN}/keys`,\n },\n resize: {\n method: 'POST',\n path: `${RUN}/resize`,\n response: apiResponse<{ resized: boolean }>(),\n },\n remove: {\n method: 'DELETE',\n path: RUN,\n response: apiResponse<WorkflowDeleteResponse>(),\n },\n stop: {\n method: 'POST',\n path: `${RUN}/stop`,\n response: apiResponse<WorkflowStopResponse>(),\n },\n /** Guidance for the agent session the running step is in, like steering a Team sub-agent. */\n steer: {\n method: 'POST',\n path: `${RUN}/steer`,\n response: apiResponse<WorkflowSteerResponse>(),\n },\n /**\n * Launch a workflow into the mounting session's own runtime, which then owns\n * the run. A dispatcher session reaches its root's session mount through this.\n */\n launch: {\n method: 'POST',\n path: '/launch',\n response: apiResponse<WorkflowLaunchResponse>(),\n },\n openRunDirectory: {\n method: 'POST',\n path: `${RUN}/open-directory`,\n response: apiResponse<WorkflowOpenRunDirectoryResponse>(),\n },\n artifacts: {\n method: 'GET',\n path: `${RUN}/artifacts`,\n query: ['directory'],\n response: apiResponse<WorkflowArtifactsResponse>(),\n },\n /** One artifact: its metadata and text, or its raw bytes under `raw=1`. */\n artifact: {\n method: 'GET',\n path: `${RUN}/artifacts/${ARTIFACT_NAME_PARAM}`,\n query: [ARTIFACT_RAW_PARAM, ARTIFACT_DOWNLOAD_PARAM],\n response: apiResponse<WorkflowArtifactContentResponse>(),\n },\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { createApiClient, sessionApiAddress } from '@agimon-ai/po-core/web';\nimport { sealedTransport } from '@agimon-ai/po-web-security/browser';\n\nimport routes from '../src/types/apiRoutes';\n\n/** Scopes the tree mounts 'workflow' at. */\nexport const apiScopes = ['global', 'workspace', 'session'] as const;\n\nexport const api = createApiClient(routes, {\n scopes: apiScopes,\n basePath: 'workflow',\n transport: (input, init) => sealedTransport.fetch(input, init),\n sessionAddress: sessionApiAddress,\n});\n","/**\n * The wire contract between this package's hub API and its cockpit client:\n * one run's terminal, and the files its run directory holds.\n *\n * Both halves of the cockpit import these names, so the route strings and the\n * event names live here rather than being spelled twice.\n */\n\n/**\n * Segment this package's API is mounted under, below /api/plugins/.\n *\n * The same word names `src/extensions/(backend)/api/workflow/`, which is where\n * the build reads the mount for the browser's client, so the two cannot drift.\n * The routes themselves are declared in `apiRoutes.ts`.\n */\nexport const WORKFLOW_API_BASE_PATH = 'workflow';\n\n/** The SSE event name the screen stream writes. */\nexport const WORKFLOW_SCREEN_EVENT = 'screen';\n\n/** What a surface may do with one run's terminal, and why anything is missing. */\nexport interface WorkflowTerminalCapabilitiesView {\n readable: boolean;\n writable: boolean;\n resizable: boolean;\n reason?: string;\n}\n\n/** One frame of a run's terminal, as the stream pushes it. */\nexport interface WorkflowScreenEvent {\n /** The visible screen, newest line last, carrying the colour the run printed. */\n lines: string[];\n capabilities: WorkflowTerminalCapabilitiesView;\n /** True once the run has settled, after which the stream ends. */\n ended?: boolean;\n}\n\n/** Answer to taking or releasing the keyboard for one run. */\nexport interface WorkflowControlResponse {\n /** True when this caller now holds the keyboard. */\n held: boolean;\n /** The token later writes must carry; absent when control was refused or released. */\n token?: string;\n /** Why control was refused, worded for a reader. */\n reason?: string;\n}\n\n/** Answer after a settled run and its directory have been permanently removed. */\nexport interface WorkflowDeleteResponse {\n deleted: true;\n}\n\n/** Answer once a stop request is recorded; the engine ends the run at its next check. */\nexport interface WorkflowStopResponse {\n requested: true;\n}\n\n/** Answer once guidance reached the running step's agent session. */\nexport interface WorkflowSteerResponse {\n delivered: true;\n}\n\n/** What launching a workflow into a session answered, as the launch tool reports it. */\nexport interface WorkflowLaunchResponse {\n text: string;\n isError?: boolean;\n}\n\n/** How a declared run-directory entry compares with what is on disk. */\nexport type WorkflowArtifactState = 'written' | 'empty' | 'pending' | 'unreadable';\n\n/** One file or directory in a run's own folder. */\nexport interface WorkflowArtifactView {\n /** Path relative to the run directory, which is also the read route's parameter. */\n path: string;\n kind: 'file' | 'directory';\n /** What the workflow says this file is for; empty for a file it never declared. */\n description: string;\n /** The jobs the workflow says write it. */\n producedBy: string[];\n /** True when the workflow's run-directory block names this entry. */\n declared: boolean;\n state: WorkflowArtifactState;\n /** Bytes on disk, absent until the file exists. */\n size?: number;\n /** ISO 8601 of the last write, absent until the file exists. */\n modifiedAt?: string;\n}\n\nexport interface WorkflowArtifactsResponse {\n /** Absolute path of the run's own directory, which the reader may want to open. */\n runDir: string;\n /** What the workflow says the directory is for. */\n description: string;\n artifacts: WorkflowArtifactView[];\n}\n\n/** One artifact's metadata and optional text, as the viewer tab reads it. */\nexport interface WorkflowArtifactContentResponse {\n path: string;\n size: number;\n modifiedAt: string;\n /** Media type inferred from the file extension by the trusted hub. Absent on older hubs. */\n mimeType?: string;\n /** Present for text formats; binary files are streamed from the raw route instead. */\n text?: string;\n /** True when textual content was longer than the reader's byte budget. */\n truncated: boolean;\n}\n\n/** Acknowledges opening the registered run folder in Finder. */\nexport interface WorkflowOpenRunDirectoryResponse {\n opened: true;\n}\n","import { sealedTransport } from '@agimon-ai/po-web-security/browser';\n\nimport { api } from '../../../../../../generated/client';\nimport {\n ARTIFACT_DOWNLOAD_PARAM,\n ARTIFACT_NAME_PARAM,\n ARTIFACT_RAW_PARAM,\n STEP_TARGET_PARAM,\n} from '../../../../../types/apiRoutes';\nimport {\n WORKFLOW_SCREEN_EVENT,\n type WorkflowArtifactContentResponse,\n type WorkflowArtifactsResponse,\n type WorkflowControlResponse,\n type WorkflowDeleteResponse,\n type WorkflowScreenEvent,\n type WorkflowSteerResponse,\n type WorkflowStopResponse,\n} from '../../../../../types/webWorkflowTerminal';\n\n/**\n * The page's half of this package's hub API: one run's terminal and the files\n * its run directory holds.\n *\n * These are adapters now, not a transport. The generated client owns the URL\n * and the sealed transport with it, so nothing here spells a mount. What stays\n * is this package's own vocabulary: which refusals the reader is shown, and the\n * shapes the terminal expects back.\n *\n * A run belongs to its multiplexer rather than to a session, so the same API\n * answers at the hub and inside a session's own server. Passing a session id\n * addresses that session's copy and passing none addresses the hub. The deleted\n * builder made that branch the other way round: it always built the hub's\n * absolute URL, then rewrote the plugin prefix into the session's with\n * String.replace, so a session's URL was a hub URL with its head swapped.\n */\n\nconst UNREACHABLE = 'The cockpit hub is unreachable.';\n\n/** One of the scopes this API mounts at; every route is the same on all of them. */\ntype WorkflowScope = typeof api.global;\n\n/** The hub, or one session's own copy of it; a null session id is the hub. */\nfunction scoped(sessionId?: string | null): WorkflowScope {\n return sessionId == null ? api.global : api.session(sessionId);\n}\n\n/** The run every route addresses, as the route table's two path parameters. */\nfunction runParams(workspace: string, runKey: string): { workspace: string; runKey: string } {\n return { workspace, runKey };\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * The message a reader is shown: the route's own words, or why there were none.\n *\n * `error` is optional because an answered call that simply carried the wrong\n * shape reaches here too, and that result has no error field at all.\n */\nfunction messageOf(result: { status: number; error?: string }, fallback: string): string {\n if (result.status === 0) return UNREACHABLE;\n return result.error === undefined || result.error === '' ? fallback : result.error;\n}\n\n/**\n * One artifact's URL, with its path filled in.\n *\n * An artifact is named by its path inside the run directory, which Hono matches\n * as the one multi-segment parameter `:name{.+}`. The client's own `params`\n * substitution fills a single segment and percent-encodes the separating slash\n * with it, which would move every nested artifact's URL, so that one segment is\n * substituted here instead: each segment encoded, the slashes between them\n * kept. Everything left of it still comes from the client.\n */\nfunction artifactUrl(\n scope: WorkflowScope,\n workspace: string,\n runKey: string,\n artifactPath: string,\n query?: Record<string, number>,\n): string {\n return scope.artifact\n .url({ params: runParams(workspace, runKey), ...(query === undefined ? {} : { query }) })\n .replace(ARTIFACT_NAME_PARAM, artifactPath.split('/').map(encodeURIComponent).join('/'));\n}\n\n/** The pane a terminal call names, when it reads one step's rather than the run's current one. */\nfunction stepBody(step: string | undefined): { step?: string } {\n return step === undefined ? {} : { step };\n}\n\n/**\n * Follows one run's screen until the run settles or the caller stops.\n *\n * Returns the stop function. The stream is server-sent events, so a hub that\n * restarts reconnects on its own and the page keeps painting. The route is\n * declared `stream: true`, which is why the client hands out its address and no\n * call: an `EventSource` opens it directly, and a relayed call would buffer a\n * response that never ends.\n */\nexport function followScreen(\n workspace: string,\n runKey: string,\n onEvent: (event: WorkflowScreenEvent) => void,\n sessionId?: string | null,\n step?: string,\n): () => void {\n const source = new EventSource(\n scoped(sessionId).screen.url({\n params: runParams(workspace, runKey),\n ...(step === undefined ? {} : { query: { [STEP_TARGET_PARAM]: step } }),\n }),\n );\n const stop = (): void => {\n source.removeEventListener(WORKFLOW_SCREEN_EVENT, handler as EventListener);\n source.close();\n };\n const handler = (message: MessageEvent<string>): void => {\n let parsed: unknown;\n try {\n parsed = JSON.parse(message.data);\n } catch {\n return; // A torn frame; the next one repaints the whole screen anyway.\n }\n if (!isRecord(parsed) || !Array.isArray(parsed.lines)) return;\n const event = parsed as unknown as WorkflowScreenEvent;\n onEvent(event);\n // The server ends the stream once the run settles. Left open, EventSource would reconnect\n // and replay a finished run for as long as the tab stays open.\n if (event.ended === true) stop();\n };\n source.addEventListener(WORKFLOW_SCREEN_EVENT, handler as EventListener);\n return stop;\n}\n\n/** Takes the keyboard for one run, renewing when this page already holds it. */\nexport async function takeControl(\n workspace: string,\n runKey: string,\n token?: string,\n sessionId?: string | null,\n step?: string,\n): Promise<WorkflowControlResponse> {\n const result = await scoped(sessionId).control({\n params: runParams(workspace, runKey),\n body: { token, ...stepBody(step) },\n });\n if (result.status === 0) return { held: false, reason: UNREACHABLE };\n // A refusal carries the same shape as a grant, so the body is read before the\n // status: a 409 says who holds the keyboard and why, which is the answer.\n if (isRecord(result.data) && typeof result.data.held === 'boolean') {\n return result.data as unknown as WorkflowControlResponse;\n }\n return { held: false, reason: messageOf(result, 'The run refused the keyboard.') };\n}\n\nexport async function releaseControl(\n workspace: string,\n runKey: string,\n token: string,\n sessionId?: string | null,\n step?: string,\n): Promise<void> {\n await scoped(sessionId).control({\n params: runParams(workspace, runKey),\n body: { token, release: true, ...stepBody(step) },\n });\n}\n\n/** Sends literal keystrokes; the reason comes back when the lease has moved on. */\nexport async function sendKeys(\n workspace: string,\n runKey: string,\n token: string,\n data: string,\n sessionId?: string | null,\n step?: string,\n): Promise<{ error?: string }> {\n const result = await scoped(sessionId).keys({\n params: runParams(workspace, runKey),\n body: { token, data, ...stepBody(step) },\n });\n if (result.ok) return {};\n return { error: messageOf(result, 'The run would not take those keys.') };\n}\n\n/** Matches the run's terminal to the viewport of whoever holds the keyboard. */\nexport async function resizeRun(\n workspace: string,\n runKey: string,\n token: string,\n columns: number,\n rows: number,\n sessionId?: string | null,\n step?: string,\n): Promise<void> {\n await scoped(sessionId).resize({\n params: runParams(workspace, runKey),\n body: { token, columns, rows, ...stepBody(step) },\n });\n}\n\nexport type DeleteWorkflowResult = { result: WorkflowDeleteResponse } | { error: string };\n\n/** Permanently removes one settled run and its run directory. */\nexport async function deleteWorkflowRun(\n workspace: string,\n runKey: string,\n sessionId?: string | null,\n): Promise<DeleteWorkflowResult> {\n const result = await scoped(sessionId).remove({ params: runParams(workspace, runKey) });\n if (!result.ok) return { error: messageOf(result, 'The workflow could not be deleted.') };\n if (result.data.deleted === true) return { result: { deleted: true } };\n return { error: 'The workflow hub returned an invalid deletion response.' };\n}\n\nexport type StopWorkflowResult = { result: WorkflowStopResponse } | { error: string };\n\n/** Asks the engine running a workflow to stop it; the run settles on its own shortly after. */\nexport async function stopWorkflowRun(\n workspace: string,\n runKey: string,\n sessionId?: string | null,\n): Promise<StopWorkflowResult> {\n const result = await scoped(sessionId).stop({ params: runParams(workspace, runKey) });\n if (!result.ok) return { error: messageOf(result, 'The workflow could not be stopped.') };\n if (result.data.requested === true) return { result: { requested: true } };\n return { error: 'The workflow hub returned an invalid stop response.' };\n}\n\nexport type SteerStepResult = { result: WorkflowSteerResponse } | { error: string };\n\n/**\n * Sends guidance to the agent session a running step is in: the run's current\n * step, or `step`, the session of one step of a parallel group.\n */\nexport async function steerStep(\n workspace: string,\n runKey: string,\n message: string,\n sessionId?: string | null,\n step?: string,\n): Promise<SteerStepResult> {\n const result = await scoped(sessionId).steer({\n params: runParams(workspace, runKey),\n body: step === undefined ? { message } : { message, step },\n });\n if (!result.ok) return { error: messageOf(result, 'The step would not take that guidance.') };\n if (result.data.delivered === true) return { result: { delivered: true } };\n return { error: 'The workflow hub returned an invalid steer response.' };\n}\n\n/** Opens the current registry folder, never a browser-supplied path. */\nexport async function openRunDirectory(\n workspace: string,\n runKey: string,\n sessionId?: string | null,\n): Promise<{ error?: string }> {\n const result = await scoped(sessionId).openRunDirectory({ params: runParams(workspace, runKey) });\n if (!result.ok) return { error: messageOf(result, 'The run folder could not be opened in Finder.') };\n return result.data.opened === true ? {} : { error: 'The workflow hub returned an invalid folder response.' };\n}\n\nexport type ArtifactsResult = { artifacts: WorkflowArtifactsResponse } | { error: string };\n\nexport async function fetchArtifacts(\n workspace: string,\n runKey: string,\n sessionId?: string | null,\n directory?: string,\n): Promise<ArtifactsResult> {\n const result = await scoped(sessionId).artifacts({ params: runParams(workspace, runKey), query: { directory } });\n if (!result.ok) return { error: messageOf(result, 'This run has no directory to read.') };\n return { artifacts: result.data };\n}\n\nexport type ArtifactResult = { artifact: WorkflowArtifactContentResponse } | { error: string };\n\n/** Trusted same-origin URL for browser-native media previews and downloads. */\nexport function artifactContentUrl(\n workspace: string,\n runKey: string,\n path: string,\n download = false,\n sessionId?: string | null,\n): string {\n return artifactUrl(scoped(sessionId), workspace, runKey, path, {\n [ARTIFACT_RAW_PARAM]: 1,\n ...(download ? { [ARTIFACT_DOWNLOAD_PARAM]: 1 } : {}),\n });\n}\n\n/**\n * One artifact's metadata and text.\n *\n * The only route here that addresses itself rather than being called: its path\n * parameter spans segments, so the URL comes from `artifactUrl` and the request\n * goes over the same sealed transport the client is built on.\n */\nexport async function fetchArtifact(\n workspace: string,\n runKey: string,\n path: string,\n sessionId?: string | null,\n): Promise<ArtifactResult> {\n try {\n const response = await sealedTransport.fetch(artifactUrl(scoped(sessionId), workspace, runKey, path));\n const body = (await response.json()) as unknown;\n if (!response.ok) {\n const error = isRecord(body) && typeof body.error === 'string' && body.error !== '' ? body.error : '';\n return { error: error === '' ? 'That file has not been written.' : error };\n }\n return { artifact: body as WorkflowArtifactContentResponse };\n } catch {\n return { error: UNREACHABLE };\n }\n}\n","import type { TransientTab, WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport { Badge, Button, EmptyState, Markdown } from '@agimon-ai/po-web-components';\nimport { useEffect, useState, type ReactNode } from 'react';\n\nimport type { WorkflowRunView } from '../../../../../types/webWorkflows';\nimport type {\n WorkflowArtifactContentResponse,\n WorkflowArtifactsResponse,\n WorkflowArtifactView,\n} from '../../../../../types/webWorkflowTerminal';\nimport { artifactContentUrl, fetchArtifact, fetchArtifacts, openRunDirectory } from '../_lib/terminalApi';\n\nconst TAB_ID_PREFIX = 'workflows-artifact-';\nconst BYTES_PER_UNIT = 1024;\nconst UNITS = ['B', 'KB', 'MB'] as const;\n\nfunction formatSize(bytes: number | undefined): string {\n if (bytes === undefined) return '';\n let value = bytes;\n let unit = 0;\n while (value >= BYTES_PER_UNIT && unit < UNITS.length - 1) {\n value /= BYTES_PER_UNIT;\n unit += 1;\n }\n return `${unit === 0 ? value : value.toFixed(1)} ${UNITS[unit]}`;\n}\n\nfunction formatWhen(iso: string | undefined): string {\n if (iso === undefined) return '';\n const parsed = Date.parse(iso);\n if (!Number.isFinite(parsed)) return '';\n return new Date(parsed).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });\n}\n\nconst STATE_GLYPH: Readonly<Record<WorkflowArtifactView['state'], { glyph: string; className: string }>> = {\n written: { glyph: '✓', className: 'text-doom-green' },\n empty: { glyph: '○', className: 'text-doom-yellow' },\n pending: { glyph: '○', className: 'text-doom-faint' },\n unreadable: { glyph: '!', className: 'text-doom-red' },\n};\n\nfunction parseDelimited(text: string, delimiter: ',' | '\\t'): string[][] {\n const rows: string[][] = [];\n let row: string[] = [];\n let cell = '';\n let quoted = false;\n for (let index = 0; index <= text.length && rows.length < 500; index += 1) {\n const character = text[index] ?? '\\n';\n if (quoted) {\n if (character === '\"' && text[index + 1] === '\"') {\n cell += '\"';\n index += 1;\n } else if (character === '\"') {\n quoted = false;\n } else {\n cell += character;\n }\n } else if (character === '\"' && cell === '') {\n quoted = true;\n } else if (character === delimiter) {\n row.push(cell);\n cell = '';\n } else if (character === '\\n') {\n row.push(cell.replace(/\\r$/, ''));\n rows.push(row);\n row = [];\n cell = '';\n } else {\n cell += character;\n }\n }\n return rows;\n}\n\nfunction DelimitedPreview({ text, delimiter }: { text: string; delimiter: ',' | '\\t' }) {\n const rows = parseDelimited(text, delimiter);\n const [head = [], ...body] = rows;\n return (\n <div className=\"overflow-auto\">\n <table data-testid=\"artifact-table\" className=\"min-w-full border-collapse font-mono text-sm\">\n <thead className=\"sticky top-0 bg-doom-panel text-doom-hi\">\n <tr>\n {head.map((cell, index) => (\n <th key={index} className=\"border border-doom-border px-2 py-1.5 text-left font-semibold\">\n {cell}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {body.map((cells, rowIndex) => (\n <tr key={rowIndex}>\n {cells.map((cell, cellIndex) => (\n <td key={cellIndex} className=\"border border-doom-border px-2 py-1 align-top text-doom-text\">\n {cell}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\n/** Keeps a newly built viewer compatible while an older hub process is restarting. */\nfunction previewMimeType(content: WorkflowArtifactContentResponse): string {\n if (content.mimeType !== undefined) return content.mimeType;\n const extension = content.path.split('.').pop()?.toLowerCase();\n if (extension === 'md' || extension === 'markdown') return 'text/markdown';\n if (extension === 'json') return 'application/json';\n if (extension === 'csv') return 'text/csv';\n if (extension === 'tsv') return 'text/tab-separated-values';\n if (extension === 'html' || extension === 'htm') return 'text/html';\n if (extension === 'pdf') return 'application/pdf';\n if (['bmp', 'gif', 'ico', 'jpeg', 'jpg', 'png', 'svg', 'webp'].includes(extension ?? '')) return 'image/unknown';\n if (['aac', 'm4a', 'mp3', 'oga', 'ogg', 'wav'].includes(extension ?? '')) return 'audio/unknown';\n if (['mov', 'mp4', 'ogv', 'webm'].includes(extension ?? '')) return 'video/unknown';\n return content.text === undefined ? 'application/octet-stream' : 'text/plain';\n}\n\nfunction ArtifactPreview({\n content,\n rawUrl,\n raw,\n}: {\n content: WorkflowArtifactContentResponse;\n rawUrl: string;\n raw: boolean;\n}) {\n const text = content.text ?? '';\n const mimeType = previewMimeType(content);\n if (content.size === 0) {\n return (\n <EmptyState\n data-testid=\"artifact-empty\"\n title=\"this artifact is empty\"\n description=\"The workflow created the file but did not write any content.\"\n />\n );\n }\n if (mimeType === 'text/markdown') {\n return raw ? (\n <pre\n data-testid=\"artifact-raw\"\n className=\"whitespace-pre-wrap break-words font-mono text-sm leading-snug text-doom-text\"\n >\n {text}\n </pre>\n ) : (\n <div data-testid=\"artifact-markdown\" className=\"max-w-5xl text-base text-doom-text\">\n <Markdown text={text} />\n </div>\n );\n }\n if (mimeType === 'application/json') {\n let formatted = text;\n try {\n formatted = JSON.stringify(JSON.parse(text) as unknown, null, 2);\n } catch {\n // An incomplete file remains useful as literal text while a workflow writes it.\n }\n return (\n <pre className=\"whitespace-pre-wrap break-words font-mono text-sm leading-snug text-doom-text\">{formatted}</pre>\n );\n }\n if (mimeType === 'text/csv' || mimeType === 'text/tab-separated-values') {\n return <DelimitedPreview text={text} delimiter={mimeType === 'text/csv' ? ',' : '\\t'} />;\n }\n if (mimeType === 'text/html') {\n return (\n <iframe\n data-testid=\"artifact-html\"\n title={content.path}\n sandbox=\"\"\n referrerPolicy=\"no-referrer\"\n srcDoc={text}\n className=\"min-h-[520px] w-full rounded bg-white\"\n />\n );\n }\n if (mimeType.startsWith('image/')) {\n return (\n <img\n data-testid=\"artifact-image\"\n src={rawUrl}\n alt={content.path}\n className=\"max-h-full max-w-full object-contain\"\n />\n );\n }\n if (mimeType === 'application/pdf') {\n return (\n <object\n data-testid=\"artifact-pdf\"\n data={rawUrl}\n type=\"application/pdf\"\n aria-label=\"PDF artifact\"\n className=\"min-h-[600px] w-full\"\n />\n );\n }\n if (mimeType.startsWith('audio/')) {\n return (\n <audio data-testid=\"artifact-audio\" src={rawUrl} controls preload=\"metadata\" className=\"w-full\">\n <track kind=\"captions\" />\n </audio>\n );\n }\n if (mimeType.startsWith('video/')) {\n return (\n <video data-testid=\"artifact-video\" src={rawUrl} controls preload=\"metadata\" className=\"max-h-full max-w-full\">\n <track kind=\"captions\" />\n </video>\n );\n }\n if (content.text !== undefined) {\n return <pre className=\"whitespace-pre-wrap break-words font-mono text-sm leading-snug text-doom-text\">{text}</pre>;\n }\n return (\n <EmptyState title=\"preview unavailable\" description=\"Download this artifact to open it with a local application.\" />\n );\n}\n\n/** One artifact, read-only, in its own tab. */\nexport function artifactTab(run: WorkflowRunView, path: string): TransientTab {\n return {\n id: `${TAB_ID_PREFIX}${run.workspace}-${run.runKey}-${path}`.replace(/[^\\w-]+/g, '-'),\n label: path.split('/').pop() ?? path,\n panel: (props: WebPluginSlotProps) => (\n <ArtifactViewerPanel {...props} workspace={run.workspace} runKey={run.runKey} path={path} />\n ),\n };\n}\n\n/**\n * One artifact's text.\n *\n * Read-only and reloadable: a run keeps writing while somebody is reading, and\n * the file on the next read is the one that matters.\n */\nexport function ArtifactViewerPanel({\n workspace,\n runKey,\n path,\n sessionId,\n}: WebPluginSlotProps & { workspace: string; runKey: string; path: string }) {\n const [content, setContent] = useState<WorkflowArtifactContentResponse>();\n const [error, setError] = useState<string>();\n const [reloads, setReloads] = useState(0);\n const [raw, setRaw] = useState(false);\n\n useEffect(() => {\n let live = true;\n void fetchArtifact(workspace, runKey, path, sessionId).then((result) => {\n if (!live) return;\n if ('error' in result) {\n setError(result.error);\n setContent(undefined);\n return;\n }\n setError(undefined);\n setContent(result.artifact);\n });\n return () => {\n live = false;\n };\n }, [workspace, runKey, path, reloads, sessionId]);\n\n const rawUrl = artifactContentUrl(workspace, runKey, path, false, sessionId);\n const downloadUrl = artifactContentUrl(workspace, runKey, path, true, sessionId);\n const mimeType = content === undefined ? undefined : previewMimeType(content);\n const isMarkdown = mimeType === 'text/markdown';\n\n return (\n <div data-testid=\"artifact-viewer\" className=\"flex min-h-0 flex-1 flex-col px-[26px] py-[18px]\">\n <div className=\"flex items-center gap-2.5 pb-3\">\n <span className=\"truncate text-base font-semibold text-doom-hi\">{path}</span>\n <Badge size=\"xs\">{mimeType ?? 'artifact'}</Badge>\n <span className=\"text-sm text-doom-dim\">\n {content === undefined ? '' : `${formatSize(content.size)} · written ${formatWhen(content.modifiedAt)}`}\n </span>\n <span className=\"min-w-0 flex-1\" />\n {isMarkdown ? (\n <div className=\"flex items-center\">\n <Button\n variant={raw ? 'outline' : 'primary'}\n size=\"xs\"\n data-testid=\"artifact-rendered-toggle\"\n onClick={() => setRaw(false)}\n >\n rendered\n </Button>\n <Button\n variant={raw ? 'primary' : 'outline'}\n size=\"xs\"\n data-testid=\"artifact-raw-toggle\"\n onClick={() => setRaw(true)}\n >\n raw\n </Button>\n </div>\n ) : null}\n <Button asChild variant=\"ghost\" size=\"xs\">\n <a data-testid=\"artifact-download\" href={downloadUrl} download>\n download\n </a>\n </Button>\n <Button\n variant=\"ghost\"\n size=\"xs\"\n data-testid=\"artifact-reload\"\n onClick={() => setReloads((count) => count + 1)}\n >\n reload\n </Button>\n </div>\n <div className=\"min-h-0 flex-1 overflow-auto rounded-md border border-doom-border bg-doom-deep p-4\">\n {error !== undefined ? (\n <span data-testid=\"artifact-error\" className=\"text-base text-doom-yellow\">\n {error}\n </span>\n ) : content === undefined ? (\n <span className=\"text-sm text-doom-dim\">loading preview</span>\n ) : (\n <ArtifactPreview content={content} rawUrl={rawUrl} raw={raw} />\n )}\n </div>\n {content?.truncated === true ? (\n <span className=\"pt-2 text-sm text-doom-dim\">\n this preview shows the first {formatSize(content.text?.length)}; download the artifact for the complete file\n </span>\n ) : null}\n </div>\n );\n}\n\n/** The run's file tree, including declared outputs that have not been written yet. */\nexport function ArtifactsPane({\n run,\n sessionId,\n onOpen,\n}: {\n run: WorkflowRunView;\n sessionId: string | null;\n onOpen: (path: string) => void;\n}) {\n const [listing, setListing] = useState<WorkflowArtifactsResponse>();\n const [error, setError] = useState<string>();\n\n useEffect(() => {\n // Cleared on every change, settled runs included, so a slow answer for the previous run or\n // session never overwrites this one. One read at a time keeps a slow hub from piling up polls.\n let live = true;\n let reading = false;\n const read = (): void => {\n if (reading) return;\n reading = true;\n void fetchArtifacts(run.workspace, run.runKey, sessionId)\n .then((result) => {\n if (!live) return;\n if ('error' in result) {\n setError(result.error);\n return;\n }\n setError(undefined);\n setListing(result.artifacts);\n })\n .finally(() => {\n reading = false;\n });\n };\n read();\n // A running workflow writes while the pane is open; a settled one cannot,\n // so it is read once and left alone.\n const timer = run.stage === 'running' ? setInterval(read, 5_000) : undefined;\n return () => {\n live = false;\n if (timer !== undefined) clearInterval(timer);\n };\n }, [run.workspace, run.runKey, run.stage, sessionId]);\n\n return (\n <ArtifactList\n listing={listing}\n error={error}\n onLoadDirectory={(directory) => fetchArtifacts(run.workspace, run.runKey, sessionId, directory)}\n onOpen={onOpen}\n onOpenDirectory={() => openRunDirectory(run.workspace, run.runKey, sessionId)}\n />\n );\n}\n\n/** Directory-first file tree with declared output metadata and lazy folder reads. */\nexport function ArtifactList({\n listing,\n error,\n onOpen,\n onOpenDirectory,\n onLoadDirectory,\n}: {\n listing: WorkflowArtifactsResponse | undefined;\n error: string | undefined;\n onOpen: (path: string) => void;\n onOpenDirectory?: () => Promise<{ error?: string }>;\n onLoadDirectory?: (path: string) => Promise<{ artifacts: WorkflowArtifactsResponse } | { error: string }>;\n}) {\n const [opening, setOpening] = useState(false);\n const [openError, setOpenError] = useState<string>();\n const openDirectory = async (): Promise<void> => {\n if (onOpenDirectory === undefined || opening) return;\n setOpening(true);\n setOpenError(undefined);\n try {\n const result = await onOpenDirectory();\n setOpenError(result.error);\n } catch {\n setOpenError('The run folder could not be opened in Finder.');\n } finally {\n setOpening(false);\n }\n };\n const [expanded, setExpanded] = useState<Set<string>>(new Set());\n const [loaded, setLoaded] = useState<Record<string, WorkflowArtifactView[]>>({});\n const [folderErrors, setFolderErrors] = useState<Record<string, string>>({});\n const [loading, setLoading] = useState<Set<string>>(new Set());\n const entries = new Map<string, WorkflowArtifactView>();\n for (const entry of [...Object.values(loaded).flat(), ...(listing?.artifacts ?? [])]) entries.set(entry.path, entry);\n for (const entry of entries.values()) {\n const parts = entry.path.split('/');\n parts.pop();\n while (parts.length > 0) {\n const parent = parts.join('/');\n if (!entries.has(parent))\n entries.set(parent, {\n path: parent,\n kind: 'directory',\n description: '',\n producedBy: [],\n declared: false,\n state: entry.state === 'pending' ? 'pending' : 'written',\n });\n parts.pop();\n }\n }\n const toggle = async (entry: WorkflowArtifactView): Promise<void> => {\n const closing = expanded.has(entry.path);\n setExpanded((current) => {\n const next = new Set(current);\n if (closing) next.delete(entry.path);\n else next.add(entry.path);\n return next;\n });\n if (closing || loading.has(entry.path) || onLoadDirectory === undefined || entry.state === 'pending') return;\n setLoading((current) => new Set(current).add(entry.path));\n try {\n const result = await onLoadDirectory(entry.path);\n if ('error' in result) setFolderErrors((current) => ({ ...current, [entry.path]: result.error }));\n else {\n setLoaded((current) => ({ ...current, [entry.path]: result.artifacts.artifacts }));\n setFolderErrors((current) => ({ ...current, [entry.path]: '' }));\n }\n } catch {\n setFolderErrors((current) => ({ ...current, [entry.path]: 'The folder cannot be read.' }));\n } finally {\n setLoading((current) => {\n const next = new Set(current);\n next.delete(entry.path);\n return next;\n });\n }\n };\n\n const renderRow = (entry: WorkflowArtifactView) => {\n const glyph = STATE_GLYPH[entry.state];\n const openable = entry.kind === 'directory' || entry.state !== 'pending';\n return (\n <button\n type=\"button\"\n data-testid={`artifact-row-${entry.path}`}\n data-artifact-state={entry.state}\n disabled={!openable}\n aria-expanded={entry.kind === 'directory' ? expanded.has(entry.path) : undefined}\n onClick={() => (entry.kind === 'directory' ? void toggle(entry) : onOpen(entry.path))}\n className={`flex flex-col gap-0.5 px-3 py-1.5 text-left ${openable ? 'cursor-pointer hover:bg-doom-panel' : 'cursor-default'}`}\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n <span className={`w-3 shrink-0 text-xs ${glyph.className}`}>\n {entry.kind === 'directory' ? (expanded.has(entry.path) ? '▾' : '▸') : glyph.glyph}\n </span>\n <span\n title={entry.path}\n className={`min-w-0 flex-1 truncate text-base font-semibold ${entry.state === 'pending' ? 'text-doom-dim' : 'text-doom-hi'}`}\n >\n {entry.path.split('/').pop()}\n {entry.kind === 'directory' ? '/' : ''}\n </span>\n <span className=\"shrink-0 text-sm text-doom-dim\">\n {entry.state === 'pending'\n ? 'pending'\n : entry.kind === 'directory'\n ? ''\n : [formatSize(entry.size), formatWhen(entry.modifiedAt)].filter(Boolean).join(' · ')}\n </span>\n </span>\n {entry.declared || entry.producedBy.length > 0 || entry.description !== '' ? (\n <span className=\"flex min-w-0 items-center gap-1 pl-5 text-sm text-doom-dim\">\n {entry.declared ? (\n <Badge size=\"xs\" tone=\"violet\" className=\"shrink-0\">\n declared\n </Badge>\n ) : null}\n {entry.producedBy.length === 0 ? null : (\n <span title={entry.producedBy.join(', ')} className=\"truncate\">\n {entry.producedBy.join(', ')}\n </span>\n )}\n {entry.description === '' ? null : (\n <span title={entry.description} className=\"truncate\">\n {entry.description}\n </span>\n )}\n </span>\n ) : null}\n </button>\n );\n };\n\n const renderChildren = (parent: string): ReactNode => {\n const children = [...entries.values()]\n .filter((entry) => {\n const cut = entry.path.lastIndexOf('/');\n return (cut === -1 ? '' : entry.path.slice(0, cut)) === parent;\n })\n .sort(\n (left, right) =>\n Number(right.kind === 'directory') - Number(left.kind === 'directory') || left.path.localeCompare(right.path),\n );\n return children.map((entry) => (\n <div key={entry.path} className=\"flex flex-col\">\n {renderRow(entry)}\n {entry.kind === 'directory' && expanded.has(entry.path) ? (\n <div className=\"ml-3 border-l border-doom-border pl-1\">\n {loading.has(entry.path) ? <span className=\"px-3 text-sm text-doom-dim\">loading…</span> : null}\n {folderErrors[entry.path] ? (\n <span role=\"alert\" className=\"px-3 text-base text-doom-yellow\">\n {folderErrors[entry.path]}\n </span>\n ) : null}\n {renderChildren(entry.path)}\n </div>\n ) : null}\n </div>\n ));\n };\n\n return (\n <div data-testid=\"artifacts-pane\" className=\"flex min-h-0 flex-1 flex-col\">\n {error !== undefined ? (\n <EmptyState className=\"py-4\" title=\"the run directory cannot be read\" description={error} />\n ) : null}\n {entries.size === 0 && error === undefined ? (\n <EmptyState className=\"py-4\" title=\"nothing in the run directory yet\" />\n ) : null}\n {listing?.description ? <span className=\"px-3 py-2 text-sm text-doom-dim\">{listing.description}</span> : null}\n {renderChildren('')}\n {openError === undefined ? null : (\n <span role=\"alert\" className=\"px-3 text-base text-doom-yellow\">\n {openError}\n </span>\n )}\n {listing === undefined ? null : (\n <button\n type=\"button\"\n data-testid=\"workflow-open-directory\"\n aria-label=\"Open workflow folder in Finder\"\n title={`${listing.runDir} (open in Finder)`}\n disabled={opening || onOpenDirectory === undefined}\n onClick={() => void openDirectory()}\n className=\"truncate px-3 py-2 text-left text-base text-doom-dim hover:text-doom-hi disabled:cursor-default\"\n >\n {listing.runDir}\n </button>\n )}\n </div>\n );\n}\n","/**\n * Sends keystrokes to a run one request at a time, in the order they were typed.\n *\n * One request per keystroke, all in flight together, can land out of order: a\n * quickly typed word reaches the pane as an anagram. Keys typed while a request\n * is in flight are batched into the next one. `send` answers false when the run\n * refused the keys; whatever is still queued is then dropped rather than sent\n * after a refusal.\n */\nexport function createKeySender(send: (data: string) => Promise<boolean>): (data: string) => void {\n let pending = '';\n let sending = false;\n\n const drain = async (): Promise<void> => {\n sending = true;\n while (pending !== '') {\n const batch = pending;\n pending = '';\n if (!(await send(batch))) pending = '';\n }\n sending = false;\n };\n\n return (data: string): void => {\n pending += data;\n if (!sending) void drain();\n };\n}\n","import { Button, Textarea } from '@agimon-ai/po-web-components';\nimport { type FormEvent, useState } from 'react';\n\nimport type { WorkflowRunView } from '../../../../../types/webWorkflows';\nimport { steerStep } from '../_lib/terminalApi';\n\n/**\n * Guidance for the agent a running customRun step is in, the way a Team\n * sub-agent tab steers its run: the text lands in the turn the agent is\n * working on. The caller shows it only while the step runs, since guidance\n * after the step settles would no longer shape the workflow.\n */\nexport function StepSteerComposer({\n run,\n sessionId,\n step,\n}: {\n run: WorkflowRunView;\n sessionId: string | null;\n /** The step's own session, so guidance reaches it even beside other running steps. */\n step?: string;\n}) {\n const [guidance, setGuidance] = useState('');\n const [sending, setSending] = useState(false);\n const [error, setError] = useState<string>();\n\n const submit = async (event: FormEvent<HTMLFormElement>): Promise<void> => {\n event.preventDefault();\n const message = guidance.trim();\n if (message === '' || sending) return;\n setSending(true);\n setError(undefined);\n try {\n const result = await steerStep(run.workspace, run.runKey, message, sessionId, step);\n if ('error' in result) {\n setError(result.error);\n return;\n }\n setGuidance('');\n } catch (cause) {\n setError(cause instanceof Error ? cause.message : String(cause));\n } finally {\n setSending(false);\n }\n };\n\n return (\n <form\n data-testid=\"step-steer-composer\"\n className=\"shrink-0 border-t border-doom-border-soft bg-doom-rail px-3 pt-3 pb-2.5\"\n onSubmit={(event) => void submit(event)}\n >\n <div className=\"rounded-lg border border-doom-border bg-doom-deep transition-colors focus-within:border-doom-blue/60\">\n <div className=\"flex min-w-0 items-start gap-2.5 px-3.5 pt-3\">\n <span className=\"mt-[3px] shrink-0 select-none text-base leading-none text-doom-green\">&gt;</span>\n <Textarea\n variant=\"bare\"\n data-testid=\"step-steer-input\"\n aria-label=\"Steering guidance\"\n rows={2}\n value={guidance}\n readOnly={sending}\n placeholder=\"Guide this agent…\"\n className=\"min-w-0 flex-1 text-base leading-relaxed\"\n onChange={(event) => setGuidance(event.target.value)}\n />\n </div>\n {error === undefined ? null : (\n <p role=\"alert\" data-testid=\"step-steer-error\" className=\"px-3.5 pt-2 text-base text-doom-red\">\n {error}\n </p>\n )}\n <div className=\"flex items-center gap-2 px-3.5 pt-2 pb-2.5\">\n <span role=\"status\" data-testid=\"step-steer-hint\" className=\"min-w-0 truncate text-sm text-doom-dim\">\n guidance reaches this step while it is still working\n </span>\n <span className=\"min-w-0 flex-1\" />\n <Button\n data-testid=\"step-steer-submit\"\n type=\"submit\"\n variant=\"primary\"\n size=\"md\"\n className=\"px-3.5\"\n disabled={sending || guidance.trim() === ''}\n >\n {sending ? 'sending…' : 'send'}\n </Button>\n </div>\n </div>\n </form>\n );\n}\n","import type { TransientTab, WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport { AnsiLine, Badge, Button, StatusBadge, StreamCursor } from '@agimon-ai/po-web-components';\nimport { useStore } from '@tanstack/react-store';\nimport {\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n useMemo,\n} from 'react';\n\nimport {\n STEP_PANE_REF_KIND,\n STEP_SESSION_REF_KIND,\n type WorkflowRunView,\n type WorkflowStepRefView,\n type WorkflowStepView,\n} from '../../../../../types/webWorkflows';\nimport type { WorkflowTerminalCapabilitiesView } from '../../../../../types/webWorkflowTerminal';\nimport { createKeySender } from '../_lib/keySender';\nimport { followScreen, releaseControl, sendKeys, takeControl } from '../_lib/terminalApi';\nimport { workflows } from '../_lib/workflowsStore';\nimport { StepSteerComposer } from './StepSteerComposer';\n\n/** The tab id doubles as the URL segment, so it stays plain and unique across plugins. */\nconst TAB_ID_PREFIX = 'workflows-step-';\n/** Keys that mean something to a terminal but nothing to a text field. */\nconst CONTROL_KEYS: Readonly<Record<string, string>> = {\n Enter: '\\r',\n Backspace: '\\x7f',\n Tab: '\\t',\n Escape: '\\x1b',\n ArrowUp: '\\x1b[A',\n ArrowDown: '\\x1b[B',\n ArrowRight: '\\x1b[C',\n ArrowLeft: '\\x1b[D',\n};\nconst CTRL_C = '\\x03';\nconst CTRL_D = '\\x04';\nconst CTRL_A_CODE = 64;\n\nexport interface StepTabTarget {\n workspace: string;\n runKey: string;\n /** The job and step the reader clicked, which the header names. */\n job: string;\n step?: string;\n}\n\n/** The temporary tab for one step; the host keeps this panel while the tab is open. */\nexport function stepTerminalTab(run: WorkflowRunView, job: string, step?: string): TransientTab {\n const target: StepTabTarget = {\n workspace: run.workspace,\n runKey: run.runKey,\n job,\n ...(step === undefined ? {} : { step }),\n };\n const label = step ?? job;\n return {\n id: `${TAB_ID_PREFIX}${run.workspace}-${run.runKey}-${job}${step === undefined ? '' : `-${step}`}`.replace(\n /[^\\w-]+/g,\n '-',\n ),\n label: `${run.displayName} › ${label}`,\n panel: (props: WebPluginSlotProps) => <StepTerminalPanel {...props} target={target} />,\n };\n}\n\n/**\n * The child session a customRun step ran as, when the tab shows one.\n *\n * A step tab follows that step. A job tab follows the job's latest step only,\n * so a job that moved on to a command step shows its terminal again.\n */\n/** The step a tab points at: the named one, or the job's last step when it names none. */\nfunction targetStep(run: WorkflowRunView | undefined, target: StepTabTarget): WorkflowStepView | undefined {\n const steps = run?.jobs.find((job) => job.name === target.job)?.steps ?? [];\n return target.step === undefined ? steps.at(-1) : steps.find((candidate) => candidate.name === target.step);\n}\n\n/** The pane of the step a tab points at, so a parallel group's steps each read their own. */\nexport function stepPaneId(run: WorkflowRunView | undefined, target: StepTabTarget): string | undefined {\n const ref = targetStep(run, target)?.ref;\n return ref?.kind === STEP_PANE_REF_KIND ? ref.id : undefined;\n}\n\nexport function stepSessionRef(\n run: WorkflowRunView | undefined,\n target: StepTabTarget,\n): WorkflowStepRefView | undefined {\n const step = targetStep(run, target);\n return step?.ref?.kind === STEP_SESSION_REF_KIND ? step.ref : undefined;\n}\n\nfunction ScreenLine({ line }: { line: string }) {\n // A blank row still has to hold the grid open, so an empty line keeps its\n // height rather than collapsing the screen by one row.\n if (line.length === 0) return <span className=\"block h-[15px]\" />;\n return <AnsiLine line={line} className=\"block whitespace-pre\" />;\n}\n\n/** The run, job and step the tab was opened from, with the run's stage and any controls. */\nfunction StepHeader({\n run,\n target,\n children,\n}: {\n run: WorkflowRunView | undefined;\n target: StepTabTarget;\n children?: ReactNode;\n}) {\n return (\n <div data-testid=\"step-terminal-head\" className=\"flex items-center gap-2.5 pb-3\">\n <span className=\"shrink-0 truncate text-base font-semibold text-doom-hi\">\n {run?.displayName ?? target.runKey}\n </span>\n <span className=\"text-xs text-doom-faint\">›</span>\n <span className=\"shrink-0 truncate text-base font-semibold text-doom-hi\">{target.job}</span>\n {target.step === undefined ? null : (\n <>\n <span className=\"text-xs text-doom-faint\">›</span>\n <span className=\"min-w-0 truncate text-base text-doom-text\">{target.step}</span>\n </>\n )}\n {run === undefined ? null : (\n <StatusBadge\n tone={run.stage === 'running' ? 'running' : run.stage === 'error' ? 'error' : 'ok'}\n data-testid=\"step-terminal-stage\"\n >\n {run.stage}\n </StatusBadge>\n )}\n <span className=\"min-w-0 flex-1\" />\n {children}\n </div>\n );\n}\n\n/**\n * One step of a run: the agent conversation for a customRun step, else the run's terminal.\n *\n * A customRun step runs as a child session, so its real messages replace the\n * screen a shell step would paint. The session outlives the step, so a\n * finished step still reads back.\n */\nexport function StepTerminalPanel(props: WebPluginSlotProps & { target: StepTabTarget }) {\n const { sessionId, target, renderSessionTranscript } = props;\n const runs = useStore(workflows.store, (state) => workflows.select(state, sessionId).runs);\n const run = runs.find((candidate) => candidate.workspace === target.workspace && candidate.runKey === target.runKey);\n const sessionRef = stepSessionRef(run, target);\n if (sessionRef !== undefined && renderSessionTranscript !== undefined) {\n return (\n <div data-testid=\"step-conversation-panel\" className=\"flex min-h-0 flex-1 flex-col px-[26px] py-[18px]\">\n <StepHeader run={run} target={target}>\n <Badge size=\"xs\" tone=\"blue\" data-testid=\"step-conversation-session\">\n agent session\n </Badge>\n </StepHeader>\n <div data-testid=\"step-conversation\" className=\"flex min-h-0 flex-1 flex-col\">\n {renderSessionTranscript(sessionRef.id)}\n </div>\n {run?.stage === 'running' && targetStep(run, target)?.status === 'running' ? (\n <StepSteerComposer key={sessionRef.id} run={run} sessionId={sessionId} step={sessionRef.id} />\n ) : null}\n </div>\n );\n }\n return <StepTerminal sessionId={sessionId} target={target} run={run} />;\n}\n\n/**\n * One run's terminal, under a header naming the step the reader opened it from.\n *\n * A run has one terminal, shared by its steps in sequence, so this is the run's\n * screen and the header says which step is on it. Watching is free; typing\n * takes the keyboard first, because the pane belongs to whoever is answering\n * whatever the nested agent asked.\n */\nfunction StepTerminal({\n sessionId,\n target,\n run,\n}: {\n sessionId: string | null;\n target: StepTabTarget;\n run: WorkflowRunView | undefined;\n}) {\n const [lines, setLines] = useState<string[]>([]);\n const [capabilities, setCapabilities] = useState<WorkflowTerminalCapabilitiesView>();\n const [ended, setEnded] = useState(false);\n const [token, setToken] = useState<string>();\n const [notice, setNotice] = useState<string>();\n const screenRef = useRef<HTMLDivElement>(null);\n // The step's own pane, so each step of a parallel group has its own screen and keyboard.\n const pane = stepPaneId(run, target);\n // The run the panel shows right now, cleared on unmount. A keyboard grant that comes back for\n // any other run is released at once instead of being held for a panel that moved on.\n const targetKey = `${sessionId ?? ''}\\0${target.workspace}\\0${target.runKey}\\0${pane ?? ''}`;\n const currentTarget = useRef<string | undefined>(targetKey);\n useEffect(() => {\n currentTarget.current = targetKey;\n return () => {\n currentTarget.current = undefined;\n };\n }, [targetKey]);\n\n useEffect(() => {\n // A new run's screen has not ended yet; the subscription below is the external system.\n // oxlint-disable-next-line react/set-state-in-effect\n setEnded(false);\n return followScreen(\n target.workspace,\n target.runKey,\n (event) => {\n setLines(event.lines);\n setCapabilities(event.capabilities);\n if (event.ended === true) setEnded(true);\n },\n sessionId,\n pane,\n );\n }, [sessionId, target.workspace, target.runKey, pane]);\n\n // The keyboard is a lease on the hub, so a tab that goes away must hand it\n // back rather than leaving the next reader locked out until it expires.\n useEffect(() => {\n if (token === undefined) return;\n return () => {\n void releaseControl(target.workspace, target.runKey, token, sessionId, pane);\n };\n }, [sessionId, token, target.workspace, target.runKey, pane]);\n\n useEffect(() => {\n screenRef.current?.scrollTo({ top: screenRef.current.scrollHeight });\n }, [lines]);\n\n const arm = useCallback(async () => {\n const requested = targetKey;\n const result = await takeControl(target.workspace, target.runKey, undefined, sessionId, pane);\n if (currentTarget.current !== requested) {\n if (result.held && result.token !== undefined)\n void releaseControl(target.workspace, target.runKey, result.token, sessionId, pane);\n return;\n }\n if (result.held && result.token !== undefined) {\n setToken(result.token);\n setNotice(undefined);\n return;\n }\n setNotice(result.reason ?? 'The keyboard is not available for this run.');\n }, [sessionId, target.workspace, target.runKey, targetKey, pane]);\n\n // Dropping the token is the release: the lease effect's cleanup hands it back exactly once.\n const disarm = useCallback(() => {\n setToken(undefined);\n }, []);\n\n const typeKeys = useMemo(\n () =>\n token === undefined\n ? undefined\n : createKeySender(async (data) => {\n const { error } = await sendKeys(target.workspace, target.runKey, token, data, sessionId, pane);\n if (error === undefined) return true;\n setNotice(error);\n setToken(undefined);\n return false;\n }),\n [token, target.workspace, target.runKey, sessionId, pane],\n );\n const type = (data: string): void => typeKeys?.(data);\n\n const onKeyDown = (event: ReactKeyboardEvent<HTMLDivElement>): void => {\n if (token === undefined) return;\n if (event.key === 'Escape' && !event.ctrlKey) {\n event.preventDefault();\n disarm();\n return;\n }\n const control = CONTROL_KEYS[event.key];\n if (control !== undefined) {\n event.preventDefault();\n type(control);\n return;\n }\n if (event.ctrlKey && event.key.length === 1) {\n event.preventDefault();\n const letter = event.key.toUpperCase().charCodeAt(0);\n type(event.key === 'c' ? CTRL_C : event.key === 'd' ? CTRL_D : String.fromCharCode(letter - CTRL_A_CODE));\n return;\n }\n if (event.key.length === 1 && !event.metaKey && !event.altKey) {\n event.preventDefault();\n type(event.key);\n }\n };\n\n const held = token !== undefined;\n const writable = capabilities?.writable === true;\n\n return (\n <div data-testid=\"step-terminal-panel\" className=\"flex min-h-0 flex-1 flex-col px-[26px] py-[18px]\">\n <StepHeader run={run} target={target}>\n <Badge\n size=\"xs\"\n tone={held ? 'blue' : 'neutral'}\n data-testid=\"step-terminal-control\"\n className={held ? 'border-doom-blue/60 bg-doom-tint-blue text-doom-hi' : ''}\n >\n {held ? 'keyboard yours' : 'watching'}\n </Badge>\n {writable ? (\n <Button\n variant={held ? 'outline' : 'primary'}\n size=\"xs\"\n data-testid=\"step-terminal-arm\"\n onClick={() => (held ? disarm() : void arm())}\n >\n {held ? 'release keyboard' : 'take control'}\n </Button>\n ) : null}\n </StepHeader>\n <div\n ref={screenRef}\n data-testid=\"step-terminal-screen\"\n tabIndex={0}\n onKeyDown={onKeyDown}\n className={`min-h-0 flex-1 overflow-y-auto rounded-md border bg-doom-deep px-4 py-3 font-mono text-sm leading-tight text-doom-text outline-none ${\n held ? 'border-doom-blue/60' : 'border-doom-border'\n }`}\n >\n {lines.length === 0 ? (\n <span className=\"text-sm text-doom-dim\">\n {capabilities?.readable === false\n ? (capabilities.reason ?? 'This run has no terminal to read.')\n : 'waiting for the run to paint…'}\n </span>\n ) : (\n lines.map((line, index) => <ScreenLine key={index} line={line} />)\n )}\n {held && !ended ? <StreamCursor className=\"mt-0.5 h-[12px] w-1.5\" /> : null}\n </div>\n <div className=\"flex items-center gap-3 pt-2.5\">\n <span data-testid=\"step-terminal-hint\" className=\"text-sm text-doom-dim\">\n {held\n ? 'keys go to the run · ctrl-c and ctrl-d pass through · esc releases the keyboard'\n : capabilities?.writable === false\n ? (capabilities.reason ?? 'this run cannot be typed into')\n : 'read-only until you take control · the run keeps going either way'}\n </span>\n <span className=\"min-w-0 flex-1\" />\n {ended ? (\n <span data-testid=\"step-terminal-ended\" className=\"text-sm text-doom-dim\">\n the run has settled; this is its last screen\n </span>\n ) : null}\n {notice === undefined ? null : (\n <span data-testid=\"step-terminal-notice\" className=\"text-sm text-doom-yellow\">\n {notice}\n </span>\n )}\n </div>\n </div>\n );\n}\n","import {\n Button,\n ChevronDownIcon,\n cn,\n Dialog,\n DialogBody,\n DialogContent,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n Dot,\n type DotTone,\n EmptyState,\n Input,\n OptionLabel,\n OptionRow,\n Popover,\n PopoverContent,\n PopoverFooter,\n PopoverHeader,\n PopoverTrigger,\n SearchIcon,\n SectionLabel,\n} from '@agimon-ai/po-web-components';\nimport { useMemo, useState } from 'react';\n\nimport type {\n WorkflowJobView,\n WorkflowProgressState,\n WorkflowRunView,\n WorkflowStepView,\n} from '../../../../../types/webWorkflows';\nimport { formatRunDuration } from '../_lib/runDuration';\nimport { deleteWorkflowRun, stopWorkflowRun } from '../_lib/terminalApi';\nimport { workflowRunIdentity } from '../_lib/workflowActivity';\n\nexport const STATE_ICON: Readonly<Record<WorkflowProgressState, { glyph: string; className: string }>> = {\n pending: { glyph: '○', className: 'text-doom-faint' },\n running: { glyph: '●', className: 'text-doom-blue' },\n resumed: { glyph: '●', className: 'text-doom-blue' },\n completed: { glyph: '✓', className: 'text-doom-green' },\n failed: { glyph: '✕', className: 'text-doom-red' },\n skipped: { glyph: '↷', className: 'text-doom-faint' },\n pause_requested: { glyph: '!', className: 'text-doom-yellow' },\n paused: { glyph: '!', className: 'text-doom-yellow' },\n};\n\nexport const ACTIVE_STATES: ReadonlySet<WorkflowProgressState> = new Set([\n 'running',\n 'resumed',\n 'pause_requested',\n 'paused',\n]);\n\nexport function spanDuration(\n startedAt: string | undefined,\n endedAt: string | undefined,\n now: number,\n): string | undefined {\n if (startedAt === undefined) return undefined;\n const start = Date.parse(startedAt);\n if (!Number.isFinite(start)) return undefined;\n const end = endedAt === undefined ? now : Date.parse(endedAt);\n if (!Number.isFinite(end)) return undefined;\n return formatRunDuration(Math.max(0, end - start));\n}\n\nexport interface RunAttention {\n kind: 'error' | 'paused' | 'stale';\n text: string;\n}\n\nexport function attentionFor(run: WorkflowRunView): RunAttention | undefined {\n if (run.stage === 'error') {\n const cause = run.errorMessage ?? 'the run ended in the error stage';\n return { kind: 'error', text: run.failedJob === undefined ? cause : `job '${run.failedJob}' failed: ${cause}` };\n }\n if (run.stale === true) {\n return { kind: 'stale', text: run.staleReason ?? 'the process that ran this workflow is gone' };\n }\n if (run.executionState === 'paused' || run.executionState === 'pause_requested') {\n return { kind: 'paused', text: 'the run is paused and will not move until it is resumed' };\n }\n return undefined;\n}\n\nexport function runDot(run: WorkflowRunView): DotTone {\n if (run.stage === 'error') return 'red';\n if (run.executionState === 'paused' || run.executionState === 'pause_requested') return 'yellow';\n if (run.stage === 'running') return 'blue';\n if (run.outcome === 'success') return 'green';\n return 'neutral';\n}\n\nexport function runState(run: WorkflowRunView): string {\n if (run.stage === 'error') return 'failed';\n if (run.executionState === 'paused' || run.executionState === 'pause_requested') return 'paused';\n if (run.stage === 'running') return 'running';\n return run.outcome ?? run.stage;\n}\n\n/** The statuses the picker filters by, in the order its status row lists them. */\nconst RUN_FILTERS = ['all', 'running', 'paused', 'failed', 'done'] as const;\ntype RunFilter = (typeof RUN_FILTERS)[number];\n\nfunction runFilterOf(run: WorkflowRunView): Exclude<RunFilter, 'all'> {\n if (run.stage === 'error') return 'failed';\n if (run.executionState === 'paused' || run.executionState === 'pause_requested') return 'paused';\n if (run.stage === 'running') return 'running';\n return 'done';\n}\n\nfunction runPriority(run: WorkflowRunView): number {\n if (attentionFor(run) !== undefined) return 0;\n if (run.stage === 'running') return 1;\n return 2;\n}\n\nfunction runSearchText(run: WorkflowRunView): string {\n return [\n run.displayName,\n run.workflowName,\n run.stage,\n run.outcome,\n run.executionState,\n run.position?.job,\n run.position?.step,\n ]\n .filter((part): part is string => typeof part === 'string')\n .join(' ')\n .toLowerCase();\n}\n\nexport function WorkflowPicker({\n runs,\n selected,\n onSelect,\n className,\n}: {\n runs: WorkflowRunView[];\n selected: WorkflowRunView;\n onSelect: (run: WorkflowRunView) => void;\n className?: string;\n}) {\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState('');\n const [filter, setFilter] = useState<RunFilter>('all');\n const ordered = useMemo(() => [...runs].sort((left, right) => runPriority(left) - runPriority(right)), [runs]);\n const needle = query.trim().toLowerCase();\n const shown = ordered.filter(\n (run) => (filter === 'all' || runFilterOf(run) === filter) && runSearchText(run).includes(needle),\n );\n\n return (\n <Popover\n open={open}\n onOpenChange={(next) => {\n setOpen(next);\n if (!next) setQuery('');\n }}\n >\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n size=\"sm\"\n data-testid=\"workflow-picker\"\n className={cn('h-8 w-full max-w-[360px] justify-start border-doom-border bg-doom-deep px-2.5', className)}\n >\n <SearchIcon className=\"h-3 w-3 shrink-0 text-doom-faint\" />\n <span className=\"min-w-0 flex-1 truncate text-left text-base font-semibold text-doom-hi\">\n {selected.displayName}\n </span>\n <span className=\"shrink-0 text-sm font-normal text-doom-dim\">{runs.length} workflows</span>\n <ChevronDownIcon className=\"h-3 w-3 shrink-0 text-doom-dim\" />\n </Button>\n </PopoverTrigger>\n <PopoverContent\n side=\"bottom\"\n align=\"start\"\n data-testid=\"workflow-picker-popover\"\n className=\"w-[440px] border-doom-edge-blue\"\n >\n <PopoverHeader>\n <SectionLabel className=\"text-doom-blue\">workflow</SectionLabel>\n <span className=\"truncate text-sm text-doom-dim\">{selected.displayName}</span>\n </PopoverHeader>\n <div className=\"border-b border-doom-border-soft p-1.5\">\n <Input\n autoFocus\n data-testid=\"workflow-picker-search\"\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n placeholder=\"filter workflows…\"\n className=\"w-full px-2 py-1 text-sm\"\n />\n </div>\n <div\n role=\"listbox\"\n aria-label=\"workflows\"\n className=\"flex max-h-[300px] flex-col gap-0.5 overflow-y-auto p-1.5\"\n >\n {shown.length === 0 ? <EmptyState className=\"py-4\" title=\"no workflow matches\" /> : null}\n {shown.map((run) => {\n const active = workflowRunIdentity(run) === workflowRunIdentity(selected);\n return (\n <OptionRow\n key={workflowRunIdentity(run)}\n density=\"compact\"\n active={active}\n data-testid={`workflow-option-${run.runKey}`}\n data-run-stage={run.stage}\n data-active={active}\n onClick={() => {\n onSelect(run);\n setOpen(false);\n }}\n className={cn(\n 'w-full gap-2.5 py-1.5 transition-colors hover:bg-doom-deep focus-visible:bg-doom-deep',\n active && 'bg-doom-tint-blue hover:brightness-125',\n )}\n >\n <span className=\"w-14 shrink-0 truncate text-sm text-doom-dim\">{runState(run)}</span>\n <OptionLabel density=\"compact\" className={active ? 'text-doom-blue' : 'text-doom-hi'}>\n {run.displayName}\n </OptionLabel>\n <span className=\"max-w-[40%] truncate text-sm text-doom-dim\">\n {[run.position?.job, run.position?.step].filter(Boolean).join(' · ')}\n </span>\n <Dot tone={runDot(run)} pulse={run.stage === 'running'} />\n </OptionRow>\n );\n })}\n </div>\n <PopoverFooter className=\"flex-wrap justify-start gap-1 py-1.5\">\n <SectionLabel className=\"mr-1\">status</SectionLabel>\n {RUN_FILTERS.map((candidate) => {\n const current = filter === candidate;\n return (\n <Button\n key={candidate}\n variant=\"ghost\"\n size=\"xs\"\n data-testid={`workflow-filter-${candidate}`}\n data-current={current}\n onClick={() => setFilter(candidate)}\n className={cn(current && 'bg-doom-blue/25 font-semibold text-doom-blue hover:bg-doom-blue/25')}\n >\n {candidate}\n </Button>\n );\n })}\n </PopoverFooter>\n </PopoverContent>\n </Popover>\n );\n}\n\nexport function JobRow({\n job,\n now,\n selected,\n onSelect,\n}: {\n job: WorkflowJobView;\n now: number;\n selected: boolean;\n onSelect: () => void;\n}) {\n const icon = STATE_ICON[job.status];\n return (\n <OptionRow\n density=\"compact\"\n active={selected}\n data-testid={`job-row-${job.name}`}\n data-job-status={job.status}\n onClick={onSelect}\n className={cn('gap-2 rounded px-2 py-1.5', !selected && 'hover:bg-doom-deep')}\n >\n <span className={`w-3 shrink-0 text-xs ${icon.className}`}>{icon.glyph}</span>\n <OptionLabel density=\"compact\" className={cn(selected ? 'text-doom-hi' : 'text-doom-text')}>\n {job.name}\n </OptionLabel>\n <span className=\"shrink-0 text-sm text-doom-dim\">{spanDuration(job.startedAt, job.endedAt, now) ?? ''}</span>\n </OptionRow>\n );\n}\n\nexport function StepRow({\n step,\n now,\n selected,\n onSelect,\n}: {\n step: WorkflowStepView;\n now: number;\n selected: boolean;\n onSelect: () => void;\n}) {\n const icon = STATE_ICON[step.status];\n return (\n <button\n type=\"button\"\n disabled={step.status === 'pending'}\n title={`${step.name}: ${step.status}`}\n data-testid={`step-row-${step.name}`}\n data-step-status={step.status}\n data-active={selected}\n onClick={onSelect}\n className={cn(\n 'flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left enabled:hover:bg-doom-deep disabled:cursor-default',\n selected && 'bg-doom-tint-blue ring-1 ring-inset ring-doom-blue/40',\n )}\n >\n <span className=\"flex items-center gap-2\">\n <span className={`w-3 shrink-0 text-xs ${icon.className}`}>{icon.glyph}</span>\n <span\n className={cn(\n 'min-w-0 flex-1 truncate text-base font-medium',\n step.status === 'failed' ? 'text-doom-red' : 'text-doom-text',\n )}\n >\n {step.name}\n </span>\n {step.group === undefined ? null : (\n // Steps of one group run side by side; the group names them together.\n <span data-testid={`step-group-${step.name}`} className=\"max-w-24 shrink-0 truncate text-sm text-doom-dim\">\n ∥ {step.group}\n </span>\n )}\n <span className=\"shrink-0 text-sm text-doom-dim\">\n {step.status === 'pending' ? 'pending' : (spanDuration(step.startedAt, step.endedAt, now) ?? '')}\n </span>\n </span>\n {step.reason === undefined ? null : (\n <span\n data-testid={`step-reason-${step.name}`}\n title={step.reason}\n className={cn('truncate pl-5 text-sm', step.status === 'failed' ? 'text-doom-red' : 'text-doom-dim')}\n >\n {step.reason}\n </span>\n )}\n </button>\n );\n}\n\nexport function DeleteWorkflowDialog({\n run,\n sessionId,\n onClose,\n onDeleted,\n}: {\n run: WorkflowRunView;\n sessionId: string;\n onClose: () => void;\n onDeleted: () => void;\n}) {\n const [deleting, setDeleting] = useState(false);\n const [error, setError] = useState<string>();\n\n const confirm = (): void => {\n setDeleting(true);\n setError(undefined);\n void deleteWorkflowRun(run.workspace, run.runKey, sessionId).then((result) => {\n if ('error' in result) {\n setDeleting(false);\n setError(result.error);\n return;\n }\n onDeleted();\n });\n };\n\n return (\n <Dialog\n open\n onOpenChange={(open) => {\n if (!open && !deleting) onClose();\n }}\n >\n <DialogContent width=\"md\" data-testid=\"delete-workflow-dialog\" aria-describedby={undefined}>\n <DialogHeader>\n <DialogTitle>Delete {run.displayName}?</DialogTitle>\n </DialogHeader>\n <DialogBody>\n <p className=\"text-sm leading-relaxed text-doom-dim\">\n This permanently removes the workflow run, including its logs and artifacts. This action cannot be undone.\n </p>\n {error === undefined ? null : (\n <p data-testid=\"delete-workflow-error\" className=\"text-base text-doom-red\">\n {error}\n </p>\n )}\n <DialogFooter>\n <span className=\"min-w-0 flex-1\" />\n <Button\n variant=\"outline\"\n size=\"xs\"\n data-testid=\"delete-workflow-cancel\"\n disabled={deleting}\n onClick={onClose}\n >\n cancel\n </Button>\n <Button\n variant=\"danger\"\n size=\"xs\"\n data-testid=\"delete-workflow-confirm\"\n loading={deleting}\n loadingLabel=\"deleting workflow\"\n onClick={confirm}\n >\n delete permanently\n </Button>\n </DialogFooter>\n </DialogBody>\n </DialogContent>\n </Dialog>\n );\n}\n\n/** Ends a running workflow; the button holds its busy state until the run settles and it unmounts. */\nexport function StopWorkflowButton({ run, sessionId }: { run: WorkflowRunView; sessionId: string | null }) {\n const [stopping, setStopping] = useState(false);\n const [error, setError] = useState<string>();\n\n const stop = (): void => {\n setStopping(true);\n setError(undefined);\n void stopWorkflowRun(run.workspace, run.runKey, sessionId).then((result) => {\n if (!('error' in result)) return;\n setStopping(false);\n setError(result.error);\n });\n };\n\n return (\n <div className=\"flex shrink-0 flex-col gap-1 border-t border-doom-border-soft p-1.5\">\n {error === undefined ? null : (\n <span data-testid=\"stop-workflow-error\" className=\"px-1 text-base text-doom-red\">\n {error}\n </span>\n )}\n <Button\n variant=\"danger-outline\"\n size=\"xs\"\n data-testid=\"stop-workflow\"\n loading={stopping}\n loadingLabel=\"stopping workflow\"\n onClick={stop}\n className=\"w-full\"\n >\n stop workflow\n </Button>\n </div>\n );\n}\n","import type { WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport {\n Button,\n ChevronDownIcon,\n ChevronRightIcon,\n cn,\n Dot,\n EmptyState,\n StatusBadge,\n} from '@agimon-ai/po-web-components';\nimport { useStore } from '@tanstack/react-store';\nimport { type ReactNode, useEffect, useMemo, useState } from 'react';\n\nimport type { WorkflowJobView, WorkflowRunView } from '../../../../../../types/webWorkflows';\nimport { ArtifactsPane, artifactTab } from '../../_components/ArtifactsPane';\nimport { stepTerminalTab } from '../../_components/StepTerminalPanel';\nimport {\n ACTIVE_STATES,\n attentionFor,\n DeleteWorkflowDialog,\n runDot,\n runState,\n spanDuration,\n STATE_ICON,\n StepRow,\n StopWorkflowButton,\n WorkflowPicker,\n} from '../../_components/WorkflowRunParts';\nimport { openCatalog } from '../../_lib/catalogStore';\nimport { ownsRun, workflowRunIdentity } from '../../_lib/workflowActivity';\nimport { focusRun, removeRun, workflows } from '../../_lib/workflowsStore';\n\nconst TICK_MS = 10_000;\n\nconst STATE_TONE = {\n running: 'info',\n paused: 'running',\n failed: 'error',\n success: 'ok',\n} as const;\n\nfunction stateTone(state: string): 'info' | 'running' | 'error' | 'ok' | 'neutral' {\n return state in STATE_TONE ? STATE_TONE[state as keyof typeof STATE_TONE] : 'neutral';\n}\n\n/** The steps moving right now, across every job, so a parallel group reads as one list. */\nfunction activeSteps(run: WorkflowRunView): { job: string; step: WorkflowJobView['steps'][number] }[] {\n return run.jobs.flatMap((job) =>\n job.steps.filter((step) => ACTIVE_STATES.has(step.status)).map((step) => ({ job: job.name, step })),\n );\n}\n\nfunction SectionHeading({ label, meta }: { label: string; meta?: string }) {\n return (\n <div className=\"flex items-center px-4 pb-1 pt-3\">\n <span className=\"text-lg font-semibold text-doom-hi\">{label}</span>\n <span className=\"min-w-0 flex-1\" />\n {meta === undefined ? null : <span className=\"text-sm text-doom-dim\">{meta}</span>}\n </div>\n );\n}\n\nfunction RunHeader({\n run,\n runs,\n now,\n onSelectRun,\n}: {\n run: WorkflowRunView;\n runs: WorkflowRunView[];\n now: number;\n onSelectRun: (run: WorkflowRunView) => void;\n}) {\n const state = runState(run);\n const where = [run.position?.job, run.position?.step].filter(Boolean).join(' › ');\n const elapsed = spanDuration(run.startedAt, run.finishedAt, now);\n return (\n <div\n data-testid=\"workflow-dock-run\"\n className=\"flex shrink-0 flex-col gap-1.5 border-b border-doom-border px-4 py-3\"\n >\n <div className=\"flex min-w-0 items-center gap-2\">\n <Dot tone={runDot(run)} pulse={run.stage === 'running' && state === 'running'} />\n <span title={run.displayName} className=\"min-w-0 flex-1 truncate text-base font-semibold text-doom-hi\">\n {run.displayName}\n </span>\n <StatusBadge size=\"xs\" tone={stateTone(state)} data-testid=\"workflow-dock-state\" data-run-state={state}>\n {state}\n </StatusBadge>\n </div>\n <div className=\"flex min-w-0 items-center gap-1.5 text-sm text-doom-dim\">\n <span title={where} className=\"min-w-0 flex-1 truncate\">\n {where || (run.stage === 'running' ? 'starting' : run.workflowPath)}\n </span>\n {elapsed === undefined ? null : <span className=\"shrink-0\">{elapsed}</span>}\n </div>\n {runs.length > 1 ? (\n <WorkflowPicker runs={runs} selected={run} onSelect={onSelectRun} className=\"max-w-none\" />\n ) : null}\n </div>\n );\n}\n\nfunction AttentionBanner({ run }: { run: WorkflowRunView }) {\n const attention = attentionFor(run);\n if (attention === undefined) return null;\n const paused = attention.kind === 'paused';\n return (\n <div\n data-testid=\"workflow-dock-attention\"\n data-attention={attention.kind}\n className={cn(\n 'mx-3 mt-3 flex flex-col gap-1 rounded-md border px-3 py-2',\n paused ? 'border-doom-edge-yellow bg-doom-tint-yellow/40' : 'border-doom-edge-red bg-doom-tint-red/40',\n )}\n >\n <div className=\"flex items-center gap-2\">\n <StatusBadge size=\"xs\" tone={paused ? 'running' : 'error'}>\n {attention.kind}\n </StatusBadge>\n <span className=\"min-w-0 flex-1 text-sm text-doom-dim\">\n {paused ? 'waiting to be resumed' : 'needs a look'}\n </span>\n </div>\n <span className=\"break-words text-base text-doom-text\">{attention.text}</span>\n <span className=\"text-sm text-doom-dim\">\n {paused\n ? 'ask the agent in this conversation to resume it'\n : 'ask the agent in this conversation to diagnose or recover it'}\n </span>\n </div>\n );\n}\n\nfunction ActiveNow({\n run,\n now,\n onOpenStep,\n}: {\n run: WorkflowRunView;\n now: number;\n onOpenStep: (job: string, step: string) => void;\n}) {\n const active = activeSteps(run);\n if (active.length === 0) return null;\n return (\n <section data-testid=\"workflow-dock-active\" aria-label=\"active steps\">\n <SectionHeading label=\"Active now\" meta={String(active.length)} />\n <div className=\"flex flex-col gap-0.5 px-2\">\n {active.map(({ job, step }) => {\n const paused = step.status === 'paused' || step.status === 'pause_requested';\n return (\n <button\n key={`${job}/${step.name}`}\n type=\"button\"\n data-testid={`workflow-dock-active-${step.name}`}\n title={`open ${step.name}`}\n onClick={() => onOpenStep(job, step.name)}\n className=\"flex w-full cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-left hover:bg-doom-panel\"\n >\n <Dot tone={paused ? 'yellow' : 'blue'} pulse={!paused} />\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"truncate text-base font-semibold text-doom-hi\">{step.name}</span>\n <span className=\"truncate text-sm text-doom-dim\">\n {job}\n {step.group === undefined ? '' : ` · ∥ ${step.group}`}\n </span>\n </span>\n <span className=\"shrink-0 text-sm text-doom-dim\">\n {spanDuration(step.startedAt, step.endedAt, now) ?? ''}\n </span>\n </button>\n );\n })}\n </div>\n </section>\n );\n}\n\nfunction JobTree({\n run,\n now,\n onOpenStep,\n}: {\n run: WorkflowRunView;\n now: number;\n onOpenStep: (job: string, step: string) => void;\n}) {\n const [toggled, setToggled] = useState<Readonly<Record<string, boolean>>>({});\n const done = run.jobs.filter((job) => job.status === 'completed' || job.status === 'skipped').length;\n return (\n <section data-testid=\"workflow-dock-jobs\" aria-label=\"jobs\">\n <SectionHeading label=\"Jobs\" meta={`${done}/${run.jobs.length}`} />\n {run.jobs.length === 0 ? (\n <EmptyState className=\"py-3\" title=\"no progress recorded yet\" />\n ) : (\n <div className=\"flex flex-col gap-0.5 px-2\">\n {run.jobs.map((job) => {\n const open = toggled[job.name] ?? true;\n const icon = STATE_ICON[job.status];\n const finished = job.steps.filter(\n (step) => step.status === 'completed' || step.status === 'skipped',\n ).length;\n return (\n <div key={job.name} className=\"flex flex-col\">\n <button\n type=\"button\"\n data-testid={`job-row-${job.name}`}\n data-job-status={job.status}\n aria-expanded={open}\n title={`${job.name}: ${job.status}`}\n onClick={() => setToggled((current) => ({ ...current, [job.name]: !open }))}\n className=\"flex w-full cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-left hover:bg-doom-panel\"\n >\n {open ? (\n <ChevronDownIcon className=\"h-2.5 w-2.5 shrink-0 text-doom-faint\" />\n ) : (\n <ChevronRightIcon className=\"h-2.5 w-2.5 shrink-0 text-doom-faint\" />\n )}\n <span className={`w-3 shrink-0 text-xs ${icon.className}`}>{icon.glyph}</span>\n <span\n className={cn(\n 'min-w-0 flex-1 truncate text-base font-semibold',\n job.status === 'failed' ? 'text-doom-red' : 'text-doom-hi',\n )}\n >\n {job.name}\n </span>\n <span className=\"shrink-0 text-sm text-doom-dim\">\n {job.status === 'pending'\n ? 'pending'\n : open || job.steps.length === 0\n ? (spanDuration(job.startedAt, job.endedAt, now) ?? '')\n : `${finished}/${job.steps.length} steps`}\n </span>\n </button>\n {open && job.steps.length > 0 ? (\n <div className=\"ml-4 flex flex-col gap-0.5 border-l border-doom-border-soft pl-1\">\n {job.steps.map((step) => (\n <StepRow\n key={step.name}\n step={step}\n now={now}\n selected={ACTIVE_STATES.has(step.status)}\n onSelect={() => onOpenStep(job.name, step.name)}\n />\n ))}\n </div>\n ) : null}\n </div>\n );\n })}\n </div>\n )}\n </section>\n );\n}\n\nexport interface WorkflowDockViewProps {\n /** The runs this session owns; the picker shows when there is more than one. */\n runs: WorkflowRunView[];\n run: WorkflowRunView;\n now: number;\n sessionId: string | null;\n onSelectRun: (run: WorkflowRunView) => void;\n onOpenStep: (job: string, step: string) => void;\n onDeleted: () => void;\n /** The run directory listing; the panel passes the live pane, a story a fixed list. */\n artifacts: ReactNode;\n}\n\n/** One workflow run as the dock shows it: where it is, what is moving, what it produced. */\nexport function WorkflowDockView({\n runs,\n run,\n now,\n sessionId,\n onSelectRun,\n onOpenStep,\n onDeleted,\n artifacts,\n}: WorkflowDockViewProps) {\n const [deleting, setDeleting] = useState(false);\n return (\n <div data-testid=\"workflow-dock\" className=\"flex h-full min-h-0 flex-1 flex-col\">\n <RunHeader run={run} runs={runs} now={now} onSelectRun={onSelectRun} />\n <div data-testid=\"workflow-dock-scroll\" className=\"min-h-0 flex-1 overflow-y-auto pb-3\">\n <AttentionBanner run={run} />\n <ActiveNow run={run} now={now} onOpenStep={onOpenStep} />\n <JobTree key={workflowRunIdentity(run)} run={run} now={now} onOpenStep={onOpenStep} />\n <section data-testid=\"workflow-dock-artifacts\" aria-label=\"artifacts\">\n <SectionHeading label=\"Artifacts\" />\n <div className=\"px-1\">{artifacts}</div>\n </section>\n </div>\n {run.stage === 'running' ? (\n <div className=\"shrink-0\">\n <StopWorkflowButton key={workflowRunIdentity(run)} run={run} sessionId={sessionId} />\n <p className=\"px-3 pb-2 text-sm text-doom-dim\">\n this session runs the workflow; removing or restarting it stops the run\n </p>\n </div>\n ) : (\n <div className=\"flex shrink-0 border-t border-doom-border-soft p-1.5\">\n <Button\n variant=\"danger-outline\"\n size=\"xs\"\n data-testid=\"delete-workflow\"\n disabled={sessionId === null}\n onClick={() => setDeleting(true)}\n className=\"w-full\"\n >\n delete run\n </Button>\n </div>\n )}\n {sessionId !== null && deleting ? (\n <DeleteWorkflowDialog\n run={run}\n sessionId={sessionId}\n onClose={() => setDeleting(false)}\n onDeleted={() => {\n setDeleting(false);\n onDeleted();\n }}\n />\n ) : null}\n </div>\n );\n}\n\n/** The `workflow` dock face: the run this workflow session owns, live from the runs channel. */\nexport function WorkflowDockPanel({ sessionId, openTransientTab }: WebPluginSlotProps) {\n const reported = useStore(workflows.store, (state) => workflows.select(state, sessionId).runs);\n const focused = useStore(workflows.store, (state) => workflows.select(state, sessionId).focusedRun);\n const runs = useMemo(() => reported.filter((candidate) => ownsRun(candidate, sessionId)), [reported, sessionId]);\n const [now, setNow] = useState(() => Date.now());\n\n useEffect(() => {\n const timer = setInterval(() => setNow(Date.now()), TICK_MS);\n return () => clearInterval(timer);\n }, []);\n\n const run = runs.find((candidate) => workflowRunIdentity(candidate) === focused) ?? runs[0];\n if (run === undefined) {\n return (\n <EmptyState\n data-testid=\"workflow-dock-empty\"\n className=\"px-4 py-5\"\n title=\"this session has no workflow run\"\n description=\"a run launched from here shows its jobs, steps and artifacts in this face.\"\n >\n <Button\n variant=\"outline\"\n size=\"sm\"\n data-testid=\"workflow-dock-launch\"\n onClick={() => {\n if (sessionId !== null) openCatalog(sessionId);\n }}\n >\n launch workflow\n </Button>\n </EmptyState>\n );\n }\n\n return (\n <WorkflowDockView\n runs={runs}\n run={run}\n now={now}\n sessionId={sessionId}\n onSelectRun={(candidate) => {\n if (sessionId !== null) focusRun(sessionId, workflowRunIdentity(candidate));\n }}\n onOpenStep={(job, step) => openTransientTab(stepTerminalTab(run, job, step))}\n onDeleted={() => {\n if (sessionId !== null) removeRun(sessionId, workflowRunIdentity(run));\n }}\n artifacts={\n <ArtifactsPane\n key={`${workflowRunIdentity(run)}/${sessionId}`}\n run={run}\n sessionId={sessionId}\n onOpen={(path) => openTransientTab(artifactTab(run, path))}\n />\n }\n />\n );\n}\n","import { defineDockFace } from '@agimon-ai/po-core/web';\n\nimport { ownsRun } from '../_lib/workflowActivity';\nimport { workflows } from '../_lib/workflowsStore';\nimport { WorkflowDockPanel } from './_components/WorkflowDockPanel';\n\nexport default defineDockFace({\n id: 'workflow',\n label: 'workflow',\n order: 20,\n autoSelect: true,\n panel: WorkflowDockPanel,\n // Shown in a session that owns a run: a workflow session, or one that ran a workflow itself before.\n visibility: {\n subscribe(listener: () => void) {\n const subscription = workflows.store.subscribe(listener);\n return () => subscription.unsubscribe();\n },\n isVisible(sessionId: string | null) {\n return workflows.select(workflows.store.state, sessionId).runs.some((run) => ownsRun(run, sessionId));\n },\n },\n});\n","import type { WorkflowCatalogEntryView } from '../../../../../types/webWorkflows';\n\n/**\n * The `/workflow-launch` line the dialog sends.\n *\n * WHY THE BUILDER LIVES HERE AND THE PARSER DOES NOT:\n * Cockpit code is compiled into the host bundle and may import only this\n * package's own web and type modules, so it cannot share the session's parser.\n * The two are pinned together by a test that parses what this writes, which is\n * the only guarantee that matters: the line has to survive the trip.\n */\n\nexport const WORKFLOW_LAUNCH_VERB = '/workflow-launch';\n/** Reserved keys; every other pair is one of the workflow's own inputs. */\nexport const RUNNER_KEY = 'runner';\nexport const COMMAND_KEY = 'command';\nexport const CHOICE_KEY = 'choice';\n\nexport interface WorkflowLaunchRequest {\n workflow: string;\n runner?: string;\n command?: string;\n choice?: string;\n inputs: Record<string, string>;\n prompt?: string;\n}\n\n/** Quotes a value that carries whitespace, which is how a value survives tokenizing. */\nfunction quote(value: string): string {\n return /\\s/.test(value) ? `\"${value}\"` : value;\n}\n\nfunction reservedPair(key: string, value: string | undefined): string[] {\n return value === undefined || value === '' ? [] : [`${key}=${quote(value)}`];\n}\n\nexport function workflowLaunchLine(request: WorkflowLaunchRequest): string {\n const pairs = [\n ...reservedPair(RUNNER_KEY, request.runner),\n ...reservedPair(COMMAND_KEY, request.command),\n ...reservedPair(CHOICE_KEY, request.choice),\n ...Object.entries(request.inputs)\n .filter(([, value]) => value !== '')\n .map(([key, value]) => `${key}=${quote(value)}`),\n ];\n const prompt = request.prompt?.trim();\n return [WORKFLOW_LAUNCH_VERB, quote(request.workflow), ...pairs, ...(prompt ? [prompt] : [])].join(' ');\n}\n\n/** The trigger that makes a prompt mandatory. */\nconst USER_PROMPT_TRIGGER = 'user_prompt';\n\n/** What the dialog will not let a reader send, worded the way the session would answer. */\nexport function launchProblems(workflow: WorkflowCatalogEntryView, request: WorkflowLaunchRequest): string[] {\n const problems: string[] = [];\n if (workflow.triggers.includes(USER_PROMPT_TRIGGER) && (request.prompt ?? '').trim() === '') {\n problems.push('This workflow is triggered by a prompt, so it needs one.');\n }\n const missing = workflow.inputs\n .filter((input) => input.required === true && (request.inputs[input.name] ?? '') === '')\n .map((input) => input.name);\n if (missing.length > 0) {\n problems.push(`Missing required input${missing.length > 1 ? 's' : ''}: ${missing.join(', ')}.`);\n }\n return problems;\n}\n\n/** The default a field starts with: what the workflow declared, or empty. */\nexport function initialInputs(workflow: WorkflowCatalogEntryView): Record<string, string> {\n return Object.fromEntries(workflow.inputs.map((input) => [input.name, input.default ?? '']));\n}\n\n/** The runner a launch starts on: the workflow's first declared one, when it declares any. */\nexport function initialRunner(workflow: WorkflowCatalogEntryView): string | undefined {\n return workflow.runners?.[0];\n}\n\n/** The command templated steps start on: the one their steps list first. */\nexport function initialCommand(workflow: WorkflowCatalogEntryView): string | undefined {\n return workflow.commands?.[0];\n}\n\n/** The choice a launch starts on: `default` when declared, else the first. */\nexport function initialChoice(workflow: WorkflowCatalogEntryView): string | undefined {\n const choices = workflow.choices ?? [];\n return choices.includes('default') ? 'default' : choices[0];\n}\n","import type { SessionFrameSender } from '@agimon-ai/po-core/web';\nimport {\n Badge,\n Button,\n Dialog,\n DialogBody,\n DialogContent,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n Input,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n Textarea,\n} from '@agimon-ai/po-web-components';\nimport { type KeyboardEvent as ReactKeyboardEvent, useState } from 'react';\n\nimport type { WorkflowCatalogEntryView, WorkflowCatalogInputView } from '../../../../../types/webWorkflows';\nimport {\n initialChoice,\n initialCommand,\n initialInputs,\n initialRunner,\n launchProblems,\n workflowLaunchLine,\n type WorkflowLaunchRequest,\n} from '../_lib/launchLine';\nimport { requestLaunch } from '../_lib/workflowsStore';\n\nconst PROMPT_ROWS = 3;\nconst BOOLEAN_TYPE = 'boolean';\nconst BOOLEAN_VALUES = ['true', 'false'] as const;\n\nfunction FieldLabel({ children }: { children: string }) {\n return <span className=\"text-base font-medium text-doom-text\">{children}</span>;\n}\n\n/** One `workflow_dispatch` input: a picker when the workflow constrains it, a field otherwise. */\nfunction InputField({\n input,\n value,\n onChange,\n}: {\n input: WorkflowCatalogInputView;\n value: string;\n onChange: (next: string) => void;\n}) {\n const options = input.options ?? (input.type === BOOLEAN_TYPE ? [...BOOLEAN_VALUES] : undefined);\n const hint = [\n input.required === true ? 'required' : undefined,\n input.default === undefined ? undefined : `default: ${input.default}`,\n input.description,\n ]\n .filter((part): part is string => part !== undefined && part !== '')\n .join(' · ');\n return (\n <div\n className=\"flex flex-col gap-1.5 sm:flex-row sm:items-center sm:gap-2.5\"\n data-testid={`launch-input-${input.name}`}\n >\n <span className=\"min-w-0 truncate text-base font-medium text-doom-text sm:w-28 sm:shrink-0\">\n {input.name}\n {input.required === true ? <span className=\"text-doom-yellow\"> *</span> : null}\n </span>\n {options === undefined ? (\n <Input\n className=\"min-w-0 flex-1\"\n value={value}\n placeholder={input.default ?? ''}\n onChange={(event) => onChange(event.target.value)}\n />\n ) : (\n <Select value={value === '' ? undefined : value} onValueChange={onChange}>\n <SelectTrigger className=\"h-7 w-full min-w-0 sm:min-w-[160px]\">\n <SelectValue placeholder=\"choose…\" />\n </SelectTrigger>\n <SelectContent>\n {options.map((option) => (\n <SelectItem key={option} value={option}>\n {option}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )}\n <span className=\"min-w-0 truncate text-sm text-doom-dim sm:w-40 sm:shrink-0\">{hint}</span>\n </div>\n );\n}\n\n/** A reserved launch value the workflow declares options for, such as its command or model choice. */\nfunction PickField({\n label,\n testId,\n options,\n value,\n hint,\n onChange,\n}: {\n label: string;\n testId: string;\n options: readonly string[];\n value: string | undefined;\n hint: string;\n onChange: (next: string) => void;\n}) {\n return (\n <div className=\"flex flex-col gap-1.5\">\n <FieldLabel>{label}</FieldLabel>\n <Select value={value} onValueChange={onChange}>\n <SelectTrigger data-testid={testId} className=\"h-7 w-full min-w-0 sm:min-w-[160px]\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {options.map((option) => (\n <SelectItem key={option} value={option}>\n {option}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n <span className=\"text-sm text-doom-dim\">{hint}</span>\n </div>\n );\n}\n\n/**\n * Launches one workflow from the catalog: the prompt, every input the file\n * declares, the runner when it declares a runner map, then the exact line the\n * session will parse. Enter launches, since the composer sends the same way.\n */\nexport function LaunchWorkflowDialog({\n sessionId,\n workflow,\n cwd,\n initialPrompt,\n send,\n onClose,\n onLaunched,\n}: {\n sessionId: string;\n workflow: WorkflowCatalogEntryView;\n cwd: string;\n initialPrompt: string;\n send: SessionFrameSender;\n onClose: () => void;\n onLaunched: () => void;\n}) {\n const [prompt, setPrompt] = useState(initialPrompt);\n const [inputs, setInputs] = useState<Record<string, string>>(() => initialInputs(workflow));\n const [runner, setRunner] = useState<string | undefined>(() => initialRunner(workflow));\n const [command, setCommand] = useState<string | undefined>(() => initialCommand(workflow));\n const [choice, setChoice] = useState<string | undefined>(() => initialChoice(workflow));\n const request: WorkflowLaunchRequest = {\n workflow: workflow.name === '' ? workflow.relativePath : workflow.name,\n ...(runner === undefined ? {} : { runner }),\n ...(command === undefined ? {} : { command }),\n ...(choice === undefined ? {} : { choice }),\n inputs,\n ...(prompt.trim() === '' ? {} : { prompt: prompt.trim() }),\n };\n const problems = launchProblems(workflow, request);\n const line = workflowLaunchLine(request);\n\n const launch = (): void => {\n if (problems.length > 0) return;\n requestLaunch(send, sessionId, line, workflow.path);\n onLaunched();\n };\n const onPromptKeyDown = (event: ReactKeyboardEvent<HTMLTextAreaElement>): void => {\n if (event.key === 'Enter' && !event.shiftKey) {\n event.preventDefault();\n launch();\n }\n };\n\n return (\n <Dialog\n open\n onOpenChange={(open) => {\n if (!open) onClose();\n }}\n >\n <DialogContent width=\"lg\" data-testid=\"launch-workflow-dialog\" aria-describedby={undefined}>\n <DialogHeader>\n <div className=\"flex min-w-0 flex-col items-start gap-1 sm:flex-row sm:items-center sm:gap-2.5\">\n <span className=\"text-sm text-doom-dim\">launch workflow</span>\n <DialogTitle data-testid=\"launch-workflow-name\" className=\"max-w-full break-words\">\n {workflow.name}\n </DialogTitle>\n <Badge size=\"xs\" className=\"max-w-full truncate\">\n {workflow.relativePath}\n </Badge>\n </div>\n </DialogHeader>\n <DialogBody>\n <p className=\"text-sm leading-relaxed text-doom-dim\">\n {workflow.description || 'This workflow declares no description.'}\n </p>\n <div className=\"flex flex-col gap-1.5\">\n <FieldLabel>Prompt</FieldLabel>\n <Textarea\n data-testid=\"launch-prompt\"\n autoFocus\n rows={PROMPT_ROWS}\n value={prompt}\n placeholder=\"what should this run do? it becomes WORKFLOW_CONTEXT for every job\"\n onChange={(event) => setPrompt(event.target.value)}\n onKeyDown={onPromptKeyDown}\n />\n <span className=\"text-sm text-doom-dim\">enter launches · shift+enter for a new line</span>\n </div>\n {workflow.inputs.length === 0 ? null : (\n <div className=\"flex flex-col gap-2\">\n <div className=\"flex items-center gap-2\">\n <FieldLabel>Inputs</FieldLabel>\n <span className=\"text-sm text-doom-dim\">workflow_dispatch · {workflow.inputs.length} declared</span>\n </div>\n {workflow.inputs.map((input) => (\n <InputField\n key={input.name}\n input={input}\n value={inputs[input.name] ?? ''}\n onChange={(next) => setInputs((current) => ({ ...current, [input.name]: next }))}\n />\n ))}\n </div>\n )}\n <div className=\"flex flex-wrap gap-5\">\n <div className=\"flex flex-col gap-1.5\">\n <FieldLabel>Runner</FieldLabel>\n {workflow.runners === undefined || workflow.runners.length === 0 ? (\n <span className=\"flex h-7 items-center text-base text-doom-dim\">whatever the workflow resolves</span>\n ) : (\n <Select value={runner} onValueChange={setRunner}>\n <SelectTrigger data-testid=\"launch-runner\" className=\"h-7 w-full min-w-0 sm:min-w-[160px]\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {workflow.runners.map((choice) => (\n <SelectItem key={choice} value={choice}>\n {choice}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )}\n <span className=\"text-sm text-doom-dim\">\n {workflow.runners === undefined ? 'no runner map declared' : 'the runners every step agrees on'}\n </span>\n </div>\n {workflow.commands === undefined || workflow.commands.length === 0 ? null : (\n <PickField\n label=\"Command\"\n testId=\"launch-command\"\n options={workflow.commands}\n value={command}\n hint=\"what agent steps run through\"\n onChange={setCommand}\n />\n )}\n {workflow.choices === undefined || workflow.choices.length === 0 ? null : (\n <PickField\n label=\"Choice\"\n testId=\"launch-choice\"\n options={workflow.choices}\n value={choice}\n hint=\"model and thinking, unless a step pins one\"\n onChange={setChoice}\n />\n )}\n <div className=\"flex flex-col gap-1.5\">\n <FieldLabel>Jobs</FieldLabel>\n <span className=\"flex h-7 items-center text-base text-doom-dim\">\n {workflow.jobs.map((job) => job.name).join(' → ') || 'none declared'}\n </span>\n <span className=\"text-sm text-doom-dim\">in the order the file declares them</span>\n </div>\n <div className=\"flex flex-col gap-1.5\">\n <FieldLabel>Cwd</FieldLabel>\n <span className=\"flex h-7 items-center font-mono text-sm text-doom-dim\">{cwd}</span>\n <span className=\"text-sm text-doom-dim\">the session's directory</span>\n </div>\n </div>\n <div className=\"flex flex-col gap-1 rounded-md border border-doom-border bg-doom-deep px-3 py-2\">\n <FieldLabel>Sent to the session</FieldLabel>\n <pre\n data-testid=\"launch-line\"\n className=\"whitespace-pre-wrap break-words font-mono text-sm text-doom-green\"\n >\n {line}\n </pre>\n </div>\n {problems.length === 0 ? null : (\n <p data-testid=\"launch-problems\" className=\"text-base text-doom-yellow\">\n {problems.join(' ')}\n </p>\n )}\n <DialogFooter className=\"flex-wrap sm:flex-nowrap\">\n <span className=\"w-full text-sm text-doom-dim sm:w-auto\">\n the run appears on the board as soon as it starts\n </span>\n <span className=\"min-w-0 flex-1\" />\n <Button variant=\"outline\" size=\"xs\" data-testid=\"launch-cancel\" onClick={onClose}>\n cancel\n </Button>\n <Button\n variant=\"primary\"\n size=\"xs\"\n data-testid=\"launch-submit\"\n disabled={problems.length > 0}\n onClick={launch}\n >\n launch\n </Button>\n </DialogFooter>\n </DialogBody>\n </DialogContent>\n </Dialog>\n );\n}\n","import { Badge, Button, CloseIcon, Input, Kbd } from '@agimon-ai/po-web-components';\nimport { useStore } from '@tanstack/react-store';\nimport type { KeyboardEvent as ReactKeyboardEvent } from 'react';\n\nimport type { WorkflowCatalogEntryView } from '../../../../../types/webWorkflows';\nimport { catalog, filterCatalog, selectWorkflow, setCatalogFilter, toggleInspect } from '../_lib/catalogStore';\n\nconst INPUT_TAG = 'INPUT';\n\n/** The unfolded row: what the file declares, read-only, as the TUI catalog's tabs show it. */\nfunction Detail({ workflow }: { workflow: WorkflowCatalogEntryView }) {\n const rows: Array<[string, string]> = [\n ['triggers', workflow.triggers.length > 0 ? workflow.triggers.join(', ') : 'none declared'],\n [\n 'inputs',\n workflow.inputs.length > 0\n ? workflow.inputs\n .map((input) => `${input.name}${input.required ? '*' : ''}${input.default ? ` = ${input.default}` : ''}`)\n .join(', ')\n : 'none declared',\n ],\n ['jobs', workflow.jobs.length > 0 ? workflow.jobs.map((job) => job.name).join(' → ') : 'none declared'],\n [\n 'artifacts',\n workflow.artifacts.length > 0 ? workflow.artifacts.map((entry) => entry.path).join(', ') : 'none declared',\n ],\n ['runners', workflow.runners === undefined ? 'any runner' : workflow.runners.join(', ') || 'none in common'],\n ['file', workflow.relativePath],\n ];\n return (\n <dl data-testid={`catalog-detail-${workflow.name}`} className=\"flex flex-col gap-1 pt-1 text-sm\">\n {rows.map(([label, value]) => (\n <div key={label} className=\"flex gap-2\">\n <dt className=\"w-16 shrink-0 text-doom-dim\">{label}</dt>\n <dd className=\"min-w-0 break-words text-doom-dim\">{value}</dd>\n </div>\n ))}\n </dl>\n );\n}\n\nfunction WorkflowRow({\n workflow,\n selected,\n inspected,\n onSelect,\n onLaunch,\n onInspect,\n}: {\n workflow: WorkflowCatalogEntryView;\n selected: boolean;\n inspected: boolean;\n onSelect: () => void;\n onLaunch: () => void;\n onInspect: () => void;\n}) {\n const jobs = workflow.jobs.length;\n // A div rather than a button: the selected row carries buttons of its own.\n return (\n <div\n role=\"option\"\n aria-selected={selected}\n tabIndex={-1}\n data-testid={`catalog-workflow-${workflow.name}`}\n data-selected={selected}\n onClick={onSelect}\n onDoubleClick={onLaunch}\n className={`flex cursor-pointer flex-col gap-1 border-l-2 px-4 py-2 ${\n selected ? 'border-doom-blue bg-doom-panel' : 'border-transparent hover:bg-doom-panel/60'\n }`}\n >\n <div className=\"flex min-w-0 items-center gap-2\">\n <span className=\"truncate text-base font-semibold text-doom-hi\">{workflow.name}</span>\n {workflow.tags.map((tag) => (\n <Badge key={tag} size=\"xs\" className=\"shrink-0\">\n {tag}\n </Badge>\n ))}\n <span className=\"min-w-0 flex-1\" />\n <span className={`shrink-0 text-sm ${workflow.error === undefined ? 'text-doom-cyan' : 'text-doom-red'}`}>\n {workflow.error === undefined ? `${jobs} job${jobs === 1 ? '' : 's'}` : 'needs fixing'}\n </span>\n </div>\n <span className=\"truncate text-sm text-doom-dim\">{workflow.description || workflow.relativePath}</span>\n {workflow.error === undefined ? (\n <span className=\"truncate text-sm text-doom-dim\">\n {workflow.inputs.length} input{workflow.inputs.length === 1 ? '' : 's'} ·{' '}\n {workflow.runners === undefined ? 'any runner' : workflow.runners.join(', ') || 'no runner in common'}\n {workflow.artifacts.length > 0 ? ` · ${workflow.artifacts.length} artifacts` : ''}\n </span>\n ) : (\n <span className=\"truncate text-base text-doom-red\">{workflow.error}</span>\n )}\n {selected ? (\n <div className=\"flex items-center gap-3 pt-0.5\">\n <Button\n variant=\"link\"\n size=\"xs\"\n data-testid={`catalog-launch-${workflow.name}`}\n className=\"px-0\"\n disabled={workflow.error !== undefined}\n onClick={(event) => {\n event.stopPropagation();\n onLaunch();\n }}\n >\n launch <Kbd>↵</Kbd>\n </Button>\n <Button\n variant=\"link\"\n size=\"xs\"\n data-testid={`catalog-inspect-${workflow.name}`}\n className=\"px-0 text-doom-dim\"\n onClick={(event) => {\n event.stopPropagation();\n onInspect();\n }}\n >\n inspect <Kbd>i</Kbd>\n </Button>\n </div>\n ) : null}\n {selected && inspected ? <Detail workflow={workflow} /> : null}\n </div>\n );\n}\n\n/**\n * The workflow catalog, in the workflows tab's drawer: every workflow the\n * session's directory declares, with a filter and the keys the TUI catalog\n * also answers to. Launching hands the chosen workflow to the dialog.\n */\nexport function WorkflowCatalogDrawer({\n sessionId,\n onClose,\n onLaunch,\n}: {\n sessionId: string;\n onClose: () => void;\n onLaunch: (workflow: WorkflowCatalogEntryView) => void;\n}) {\n const state = useStore(catalog.store, (current) => catalog.select(current, sessionId));\n const shown = filterCatalog(state.workflows, state.filter);\n const selected = shown.find((workflow) => workflow.path === state.selected) ?? shown[0];\n\n const move = (delta: number): void => {\n if (shown.length === 0) return;\n const index = selected === undefined ? -1 : shown.findIndex((workflow) => workflow.path === selected.path);\n const next = shown[(index + delta + shown.length) % shown.length];\n if (next) selectWorkflow(sessionId, next.path);\n };\n\n const onKeyDown = (event: ReactKeyboardEvent<HTMLElement>): void => {\n const typing = (event.target as HTMLElement).tagName === INPUT_TAG;\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n move(event.key === 'ArrowDown' ? 1 : -1);\n return;\n }\n if (event.key === 'Escape') {\n event.preventDefault();\n onClose();\n return;\n }\n if (selected === undefined) return;\n if (event.key === 'Enter') {\n event.preventDefault();\n if (selected.error === undefined) onLaunch(selected);\n return;\n }\n if (typing) return;\n if (event.key === 'i') toggleInspect(sessionId, selected.path);\n };\n\n return (\n <aside\n data-testid=\"workflow-catalog-drawer\"\n tabIndex={0}\n onKeyDown={onKeyDown}\n className=\"flex w-[min(440px,calc(100vw-24px))] max-w-full shrink-0 flex-col overflow-hidden border-l border-doom-border bg-doom-rail outline-none\"\n >\n <div className=\"flex h-11 shrink-0 items-center gap-2.5 border-b border-doom-border px-4\">\n <span className=\"text-lg font-semibold text-doom-hi\">workflow catalog</span>\n <Badge size=\"xs\" data-testid=\"catalog-count\">\n {state.workflows.length} workflow{state.workflows.length === 1 ? '' : 's'}\n </Badge>\n <span className=\"min-w-0 flex-1\" />\n <Kbd>SPC w l</Kbd>\n <Button variant=\"ghost\" size=\"icon\" data-testid=\"catalog-close\" title=\"close the catalog\" onClick={onClose}>\n <CloseIcon className=\"h-3 w-3\" />\n </Button>\n </div>\n <div className=\"px-4 pt-2.5 pb-1.5\">\n <Input\n data-testid=\"catalog-filter\"\n value={state.filter}\n placeholder=\"filter by name, tag, or job…\"\n autoFocus\n onChange={(event) => setCatalogFilter(sessionId, event.target.value)}\n />\n </div>\n <div role=\"listbox\" className=\"flex min-h-0 flex-1 flex-col overflow-y-auto pb-2\">\n {shown.length === 0 ? (\n <p data-testid=\"catalog-empty\" className=\"px-4 py-3 text-sm text-doom-dim\">\n {state.warning ??\n (state.workflows.length === 0\n ? 'no workflows found for this session; add one under automations/workflows'\n : 'nothing matches the filter')}\n </p>\n ) : null}\n {shown.map((workflow) => (\n <WorkflowRow\n key={workflow.path}\n workflow={workflow}\n selected={selected?.path === workflow.path}\n inspected={state.inspected === workflow.path}\n onSelect={() => selectWorkflow(sessionId, workflow.path)}\n onLaunch={() => onLaunch(workflow)}\n onInspect={() => toggleInspect(sessionId, workflow.path)}\n />\n ))}\n </div>\n <div className=\"flex h-8 shrink-0 items-center justify-between border-t border-doom-border-soft bg-doom-deep px-4\">\n <span className=\"shrink-0 text-sm text-doom-dim\">↑↓ choose · enter launch · i inspect · esc close</span>\n <span className=\"min-w-0 truncate font-mono text-sm text-doom-dim\">{state.cwd}</span>\n </div>\n </aside>\n );\n}\n","import type { WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport { Sheet, SheetContent, SheetTitle } from '@agimon-ai/po-web-components';\nimport { useStore } from '@tanstack/react-store';\n\nimport { LaunchWorkflowDialog } from '../../_components/LaunchWorkflowDialog';\nimport { WorkflowCatalogDrawer } from '../../_components/WorkflowCatalogDrawer';\nimport { catalog, closeCatalog, closeLaunch, openLaunch } from '../../_lib/catalogStore';\n\n/**\n * The workflow catalog and its launch dialog, over whatever the session shows.\n *\n * Every way in (SPC w l, the Activity launcher, a work item's context action)\n * only flips the catalog store, so the surface lives in the host's overlay\n * slot rather than in a tab the reader would have to open first.\n */\nexport function WorkflowLauncherOverlay({ sessionId, sendSessionFrame }: WebPluginSlotProps) {\n const state = useStore(catalog.store, (current) => catalog.select(current, sessionId));\n if (sessionId === null) return null;\n const launching = state.workflows.find((workflow) => workflow.path === state.launch);\n\n return (\n <>\n <Sheet\n open={state.open}\n onOpenChange={(open) => {\n if (!open) closeCatalog(sessionId);\n }}\n >\n <SheetContent side=\"right\" width=\"md\" aria-describedby={undefined} className=\"border-l-0\">\n <SheetTitle className=\"sr-only\">workflow catalog</SheetTitle>\n <div data-testid=\"workflow-launcher-sheet\" className=\"flex min-h-0 flex-1\">\n <WorkflowCatalogDrawer\n sessionId={sessionId}\n onClose={() => closeCatalog(sessionId)}\n onLaunch={(workflow) => openLaunch(sessionId, workflow.path)}\n />\n </div>\n </SheetContent>\n </Sheet>\n {launching === undefined ? null : (\n <LaunchWorkflowDialog\n sessionId={sessionId}\n workflow={launching}\n cwd={state.cwd}\n initialPrompt={state.prompt}\n send={sendSessionFrame}\n onClose={() => closeLaunch(sessionId)}\n onLaunched={() => {\n closeLaunch(sessionId);\n closeCatalog(sessionId);\n }}\n />\n )}\n </>\n );\n}\n","import { defineFill } from '@agimon-ai/po-core/web';\n\nimport { WorkflowLauncherOverlay } from './_components/WorkflowLauncherOverlay';\n\nexport default defineFill({ component: WorkflowLauncherOverlay });\n","import { defineFill } from '@agimon-ai/po-core/web';\n\nimport legacy from '../_lib';\n\nexport default defineFill({ slot: 'activity.workflows', ...legacy.activitySections![0]! });\n","import { defineLeaderBinding } from '@agimon-ai/po-core/web';\n\nimport legacy from '../_lib';\n\nexport default defineLeaderBinding(legacy.leaderBindings![0]!);\n","import { defineLeaderBinding } from '@agimon-ai/po-core/web';\n\nimport legacy from '../_lib';\n\nexport default defineLeaderBinding(legacy.leaderBindings![1]!);\n","import { defineMinorModeFile } from '@agimon-ai/po-core/web';\n\nimport legacy from '../../_lib';\n\nexport default defineMinorModeFile(legacy.minorModes![0]!);\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport legacy from '../_lib';\n\nexport default defineToolRenderer(legacy.toolRenderers![0]!);\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/po-core/web';\n\nimport actionLaunchWorkflow from '../src/extensions/workspaces/sessions/(frontend)/action/launch-workflow.web';\nimport activityGroupWorkflows from '../src/extensions/workspaces/sessions/(frontend)/activity-group/workflows.web';\nimport channelWorkflowCatalog from '../src/extensions/workspaces/sessions/(frontend)/channel/workflow-catalog.web';\nimport channelWorkflowRuns from '../src/extensions/workspaces/sessions/(frontend)/channel/workflow-runs.web';\nimport dockWorkflow from '../src/extensions/workspaces/sessions/(frontend)/dock/workflow.web';\nimport fillWorkflowLauncher from '../src/extensions/workspaces/sessions/(frontend)/fill/WorkflowLauncher.overlay.web';\nimport fillWorkflows from '../src/extensions/workspaces/sessions/(frontend)/fill/Workflows.activity.workflows.web';\nimport leaderCatalog from '../src/extensions/workspaces/sessions/(frontend)/leader/catalog.web';\nimport leaderToggle from '../src/extensions/workspaces/sessions/(frontend)/leader/toggle.web';\nimport modeWorkflow from '../src/extensions/workspaces/sessions/(frontend)/mode/workflow/mode.web';\nimport toolWorkflow from '../src/extensions/workspaces/sessions/(frontend)/tool/workflow.web';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const webPlugin = defineWebPlugin({\n id: 'workflows',\n session: {\n get activityGroups(): WebPluginContributions['activityGroups'] { return [via({ name: 'workflows' }, activityGroupWorkflows)]; },\n get channels(): WebPluginContributions['channels'] { return [via({ channel: 'workflow_catalog' }, channelWorkflowCatalog), via({ channel: 'workflow_runs' }, channelWorkflowRuns)]; },\n get contextActions(): WebPluginContributions['contextActions'] { return [via({ id: 'launch-workflow' }, actionLaunchWorkflow)]; },\n get dockFaces(): WebPluginContributions['dockFaces'] { return [via({ id: 'workflow' }, dockWorkflow)]; },\n get fills(): WebPluginContributions['fills'] { return [via({ slot: 'overlay', id: 'workflow-launcher' }, fillWorkflowLauncher), via({ slot: 'activity.workflows', id: 'workflows' }, fillWorkflows)]; },\n get leaderBindings(): WebPluginContributions['leaderBindings'] { return [via({ id: 'workflows.catalog' }, leaderCatalog), via({ id: 'workflows.toggle' }, leaderToggle)]; },\n get minorModes(): WebPluginContributions['minorModes'] { return [via({ name: 'workflow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