@agimon-ai/po-workflow 0.0.0-alpha.21 → 0.0.0-alpha.210
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.
- package/LICENSE +110 -149
- package/README.md +155 -53
- package/dist/apiContracts.cjs +205 -36
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.d.mts +2 -2
- package/dist/apiContracts.d.mts.map +1 -1
- package/dist/apiContracts.mjs +205 -36
- package/dist/apiContracts.mjs.map +1 -1
- package/dist/contract-BpzJeyjh.mjs +33 -0
- package/dist/contract-BpzJeyjh.mjs.map +1 -0
- package/dist/contract-D80yV2d-.cjs +68 -0
- package/dist/contract-D80yV2d-.cjs.map +1 -0
- package/dist/extensions/native.mjs +4643 -1020
- package/dist/extensions/native.mjs.map +1 -1
- package/dist/extensions/server.cjs +21507 -3593
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +21495 -3558
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +5224 -2610
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/index-CxS__mkJ.d.mts +5210 -0
- package/dist/index-CxS__mkJ.d.mts.map +1 -0
- package/dist/index.cjs +41 -3
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +104 -4
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +38 -1
- package/dist/index.mjs.map +1 -0
- package/dist/po-runtime-identity.json +1 -0
- package/dist/workflowHost-B8ludUOG.cjs +4190 -0
- package/dist/workflowHost-B8ludUOG.cjs.map +1 -0
- package/dist/workflowHost-DB4GtWpM.mjs +3974 -0
- package/dist/workflowHost-DB4GtWpM.mjs.map +1 -0
- package/dist/workflowHost.cjs +7 -0
- package/dist/workflowHost.d.mts +29 -0
- package/dist/workflowHost.d.mts.map +1 -0
- package/dist/workflowHost.mjs +3 -0
- package/dist/workflowServices-CSHleLJo.mjs +273 -0
- package/dist/workflowServices-CSHleLJo.mjs.map +1 -0
- package/dist/workflowServices-DYXhIDVE.cjs +350 -0
- package/dist/workflowServices-DYXhIDVE.cjs.map +1 -0
- package/llms.txt +10 -8
- package/locales/vi.json +492 -0
- package/locales/zh-CN.json +492 -0
- package/package.json +150 -26
- package/src/prompts/codemode-how-to-workflow/SKILL.md +226 -0
- package/src/prompts/help-how-to-workflow/SKILL.md +185 -0
- package/src/prompts/help-how-to-workflow-settings/SKILL.md +33 -0
- package/src/types/webWorkflowTerminal.ts +21 -0
- package/src/types/webWorkflows.ts +52 -2
- package/dist/workflowLaunchCommand-C69Nn3k5.cjs +0 -139
- package/dist/workflowLaunchCommand-C69Nn3k5.cjs.map +0 -1
- package/dist/workflowLaunchCommand-GGqimmTC.mjs +0 -122
- package/dist/workflowLaunchCommand-GGqimmTC.mjs.map +0 -1
- package/skills/workflow-recovery/SKILL.md +0 -85
- package/src/prompts/po-author-workflow/SKILL.md +0 -64
- package/src/prompts/po-use-workflow/SKILL.md +0 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.mjs","names":["isRecord","isRecord","TICK_MS","legacy","legacy","legacy","legacy","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 /** Opaque owner-qualified API/cache key. The displayed engine runKey stays unchanged. */\n routeKey?: string;\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' | 'routeKey'>): string {\n return `${run.workspace}/${run.routeKey ?? 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-po-dim',\n paused: 'text-po-yellow',\n failed: 'text-po-red',\n done: 'text-po-dim',\n skipped: 'text-po-dim',\n};\n\nconst GROUP_LABEL: Readonly<Record<WorkflowActivityGroupName, string>> = {\n running: 'text-po-yellow',\n failed: 'text-po-red',\n successful: 'text-po-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-po-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-po-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-po-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-po-hi' : 'text-po-dim'\n }`}\n >\n {row.name}\n </span>\n <span className=\"shrink-0 text-sm text-po-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-po-panel\"\n >\n {open ? (\n <ChevronDownIcon className=\"h-2.5 w-2.5 text-po-faint\" />\n ) : (\n <ChevronRightIcon className=\"h-2.5 w-2.5 text-po-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-po-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-po-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-po-hi\">{summary.action}</span>\n {summary.target ? <span className=\"min-w-0 truncate text-po-dim\">{summary.target}</span> : null}\n {summary.metadata.map((value) => (\n <span key={value} className=\"shrink-0 text-po-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: 'po-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: 'po-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 type { ApiResponseOf, ApiRoutes } 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 WorkflowScreenEvent,\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\nconst routes = {\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 snapshot: {\n method: 'GET',\n path: `${RUN}/screen`,\n query: [STEP_TARGET_PARAM],\n response: undefined as unknown as ApiResponseOf<WorkflowScreenEvent>,\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: undefined as unknown as ApiResponseOf<WorkflowControlResponse>,\n },\n keys: {\n method: 'POST',\n path: `${RUN}/keys`,\n },\n resize: {\n method: 'POST',\n path: `${RUN}/resize`,\n response: undefined as unknown as ApiResponseOf<{ resized: boolean }>,\n },\n remove: {\n method: 'DELETE',\n path: RUN,\n response: undefined as unknown as ApiResponseOf<WorkflowDeleteResponse>,\n },\n stop: {\n method: 'POST',\n path: `${RUN}/stop`,\n response: undefined as unknown as ApiResponseOf<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: undefined as unknown as ApiResponseOf<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: undefined as unknown as ApiResponseOf<WorkflowLaunchResponse>,\n },\n openRunDirectory: {\n method: 'POST',\n path: `${RUN}/open-directory`,\n response: undefined as unknown as ApiResponseOf<WorkflowOpenRunDirectoryResponse>,\n },\n artifacts: {\n method: 'GET',\n path: `${RUN}/artifacts`,\n query: ['directory'],\n response: undefined as unknown as ApiResponseOf<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: undefined as unknown as ApiResponseOf<WorkflowArtifactContentResponse>,\n },\n} as const satisfies ApiRoutes;\n\nexport default routes;\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 /** The finite snapshot was clipped to its response budget. */\n truncated?: 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-po-green' },\n empty: { glyph: '○', className: 'text-po-yellow' },\n pending: { glyph: '○', className: 'text-po-faint' },\n unreadable: { glyph: '!', className: 'text-po-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-po-panel text-po-hi\">\n <tr>\n {head.map((cell, index) => (\n <th key={index} className=\"border border-po-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-po-border px-2 py-1 align-top text-po-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-po-text\"\n >\n {text}\n </pre>\n ) : (\n <div data-testid=\"artifact-markdown\" className=\"max-w-5xl text-base text-po-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-po-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-po-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.routeKey ?? run.runKey}-${path}`.replace(/[^\\w-]+/g, '-'),\n label: path.split('/').pop() ?? path,\n panel: (props: WebPluginSlotProps) => (\n <ArtifactViewerPanel {...props} workspace={run.workspace} runKey={run.routeKey ?? 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-po-hi\">{path}</span>\n <Badge size=\"xs\">{mimeType ?? 'artifact'}</Badge>\n <span className=\"text-sm text-po-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-po-border bg-po-deep p-4\">\n {error !== undefined ? (\n <span data-testid=\"artifact-error\" className=\"text-base text-po-yellow\">\n {error}\n </span>\n ) : content === undefined ? (\n <span className=\"text-sm text-po-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-po-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.routeKey ?? 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.routeKey, run.stage, sessionId]);\n\n return (\n <ArtifactList\n listing={listing}\n error={error}\n onLoadDirectory={(directory) => fetchArtifacts(run.workspace, run.routeKey ?? run.runKey, sessionId, directory)}\n onOpen={onOpen}\n onOpenDirectory={() => openRunDirectory(run.workspace, run.routeKey ?? 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-po-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-po-dim' : 'text-po-hi'}`}\n >\n {entry.path.split('/').pop()}\n {entry.kind === 'directory' ? '/' : ''}\n </span>\n <span className=\"shrink-0 text-sm text-po-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-po-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-po-border pl-1\">\n {loading.has(entry.path) ? <span className=\"px-3 text-sm text-po-dim\">loading…</span> : null}\n {folderErrors[entry.path] ? (\n <span role=\"alert\" className=\"px-3 text-base text-po-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-po-dim\">{listing.description}</span> : null}\n {renderChildren('')}\n {openError === undefined ? null : (\n <span role=\"alert\" className=\"px-3 text-base text-po-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-po-dim hover:text-po-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.routeKey ?? 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-po-border-soft bg-po-rail px-3 pt-3 pb-2.5\"\n onSubmit={(event) => void submit(event)}\n >\n <div className=\"rounded-lg border border-po-border bg-po-deep transition-colors focus-within:border-po-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-po-green\">></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-po-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-po-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.routeKey ?? run.runKey,\n job,\n ...(step === undefined ? {} : { step }),\n };\n const label = step ?? job;\n return {\n id: `${TAB_ID_PREFIX}${run.workspace}-${run.routeKey ?? 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-po-hi\">{run?.displayName ?? target.runKey}</span>\n <span className=\"text-xs text-po-faint\">›</span>\n <span className=\"shrink-0 truncate text-base font-semibold text-po-hi\">{target.job}</span>\n {target.step === undefined ? null : (\n <>\n <span className=\"text-xs text-po-faint\">›</span>\n <span className=\"min-w-0 truncate text-base text-po-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(\n (candidate) =>\n candidate.workspace === target.workspace && (candidate.routeKey ?? candidate.runKey) === target.runKey,\n );\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-po-blue/60 bg-po-tint-blue text-po-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 role=\"textbox\"\n aria-label=\"Workflow terminal\"\n aria-multiline=\"true\"\n aria-readonly={token === undefined}\n tabIndex={0}\n onKeyDown={onKeyDown}\n className={`min-h-0 flex-1 overflow-y-auto rounded-md border bg-po-deep px-4 py-3 font-mono text-sm leading-tight text-po-text outline-none ${\n held ? 'border-po-blue/60' : 'border-po-border'\n }`}\n >\n {lines.length === 0 ? (\n <span className=\"text-sm text-po-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-po-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-po-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-po-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-po-faint' },\n running: { glyph: '●', className: 'text-po-blue' },\n resumed: { glyph: '●', className: 'text-po-blue' },\n completed: { glyph: '✓', className: 'text-po-green' },\n failed: { glyph: '✕', className: 'text-po-red' },\n skipped: { glyph: '↷', className: 'text-po-faint' },\n pause_requested: { glyph: '!', className: 'text-po-yellow' },\n paused: { glyph: '!', className: 'text-po-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-po-border bg-po-deep px-2.5', className)}\n >\n <SearchIcon className=\"h-3 w-3 shrink-0 text-po-faint\" />\n <span className=\"min-w-0 flex-1 truncate text-left text-base font-semibold text-po-hi\">\n {selected.displayName}\n </span>\n <span className=\"shrink-0 text-sm font-normal text-po-dim\">{runs.length} workflows</span>\n <ChevronDownIcon className=\"h-3 w-3 shrink-0 text-po-dim\" />\n </Button>\n </PopoverTrigger>\n <PopoverContent\n side=\"bottom\"\n align=\"start\"\n data-testid=\"workflow-picker-popover\"\n className=\"w-[440px] border-po-edge-blue\"\n >\n <PopoverHeader>\n <SectionLabel className=\"text-po-blue\">workflow</SectionLabel>\n <span className=\"truncate text-sm text-po-dim\">{selected.displayName}</span>\n </PopoverHeader>\n <div className=\"border-b border-po-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-po-deep focus-visible:bg-po-deep',\n active && 'bg-po-tint-blue hover:brightness-125',\n )}\n >\n <span className=\"w-14 shrink-0 truncate text-sm text-po-dim\">{runState(run)}</span>\n <OptionLabel density=\"compact\" className={active ? 'text-po-blue' : 'text-po-hi'}>\n {run.displayName}\n </OptionLabel>\n <span className=\"max-w-[40%] truncate text-sm text-po-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-po-blue/25 font-semibold text-po-blue hover:bg-po-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-po-deep')}\n >\n <span className={`w-3 shrink-0 text-xs ${icon.className}`}>{icon.glyph}</span>\n <OptionLabel density=\"compact\" className={cn(selected ? 'text-po-hi' : 'text-po-text')}>\n {job.name}\n </OptionLabel>\n <span className=\"shrink-0 text-sm text-po-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-po-deep disabled:cursor-default',\n selected && 'bg-po-tint-blue ring-1 ring-inset ring-po-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-po-red' : 'text-po-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-po-dim\">\n ∥ {step.group}\n </span>\n )}\n <span className=\"shrink-0 text-sm text-po-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-po-red' : 'text-po-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.routeKey ?? 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-po-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-po-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.routeKey ?? 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-po-border-soft p-1.5\">\n {error === undefined ? null : (\n <span data-testid=\"stop-workflow-error\" className=\"px-1 text-base text-po-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-po-hi\">{label}</span>\n <span className=\"min-w-0 flex-1\" />\n {meta === undefined ? null : <span className=\"text-sm text-po-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 data-testid=\"workflow-dock-run\" className=\"flex shrink-0 flex-col gap-1.5 border-b border-po-border px-4 py-3\">\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-po-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-po-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-po-edge-yellow bg-po-tint-yellow/40' : 'border-po-edge-red bg-po-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-po-dim\">{paused ? 'waiting to be resumed' : 'needs a look'}</span>\n </div>\n <span className=\"break-words text-base text-po-text\">{attention.text}</span>\n <span className=\"text-sm text-po-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-po-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-po-hi\">{step.name}</span>\n <span className=\"truncate text-sm text-po-dim\">\n {job}\n {step.group === undefined ? '' : ` · ∥ ${step.group}`}\n </span>\n </span>\n <span className=\"shrink-0 text-sm text-po-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-po-panel\"\n >\n {open ? (\n <ChevronDownIcon className=\"h-2.5 w-2.5 shrink-0 text-po-faint\" />\n ) : (\n <ChevronRightIcon className=\"h-2.5 w-2.5 shrink-0 text-po-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-po-red' : 'text-po-hi',\n )}\n >\n {job.name}\n </span>\n <span className=\"shrink-0 text-sm text-po-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-po-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-po-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-po-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-po-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-po-text sm:w-28 sm:shrink-0\">\n {input.name}\n {input.required === true ? <span className=\"text-po-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-po-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-po-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-po-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-po-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-po-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-po-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-po-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-po-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-po-dim\">\n {workflow.jobs.map((job) => job.name).join(' → ') || 'none declared'}\n </span>\n <span className=\"text-sm text-po-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-po-dim\">{cwd}</span>\n <span className=\"text-sm text-po-dim\">the session's directory</span>\n </div>\n </div>\n <div className=\"flex flex-col gap-1 rounded-md border border-po-border bg-po-deep px-3 py-2\">\n <FieldLabel>Sent to the session</FieldLabel>\n <pre data-testid=\"launch-line\" className=\"whitespace-pre-wrap break-words font-mono text-sm text-po-green\">\n {line}\n </pre>\n </div>\n {problems.length === 0 ? null : (\n <p data-testid=\"launch-problems\" className=\"text-base text-po-yellow\">\n {problems.join(' ')}\n </p>\n )}\n <DialogFooter className=\"flex-wrap sm:flex-nowrap\">\n <span className=\"w-full text-sm text-po-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-po-dim\">{label}</dt>\n <dd className=\"min-w-0 break-words text-po-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-po-blue bg-po-panel' : 'border-transparent hover:bg-po-panel/60'\n }`}\n >\n <div className=\"flex min-w-0 items-center gap-2\">\n <span className=\"truncate text-base font-semibold text-po-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-po-cyan' : 'text-po-red'}`}>\n {workflow.error === undefined ? `${jobs} job${jobs === 1 ? '' : 's'}` : 'needs fixing'}\n </span>\n </div>\n <span className=\"truncate text-sm text-po-dim\">{workflow.description || workflow.relativePath}</span>\n {workflow.error === undefined ? (\n <span className=\"truncate text-sm text-po-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-po-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-po-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-po-border bg-po-rail outline-none\"\n >\n <div className=\"flex h-11 shrink-0 items-center gap-2.5 border-b border-po-border px-4\">\n <span className=\"text-lg font-semibold text-po-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-po-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-po-border-soft bg-po-deep px-4\">\n <span className=\"shrink-0 text-sm text-po-dim\">↑↓ choose · enter launch · i inspect · esc close</span>\n <span className=\"min-w-0 truncate font-mono text-sm text-po-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' }, modeWorkflow)]; },\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['workflow'] }, toolWorkflow)]; },\n },\n});\n"],"mappings":";;;;;;AAuHA,MAAa,qBAAqB;AA2DlC,MAAa,wBAAwB;;;ACxJrC,MAAa,UAAU,mBAAmC;CACxD,KAAK;CACL,WAAW,CAAC;CACZ,SAAS,KAAA;CACT,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,UAAU,KAAA;CACV,WAAW,KAAA;CACX,QAAQ,KAAA;AACV,CAAC;AAED,SAASA,WAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,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KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,YAAY,gBAAgB;CACvC,IAAI;CACJ,SAAS;EACP,IAAI,iBAA2D;GAAE,OAAO,CAAC,IAAI,EAAE,MAAM,YAAY,GAAGC,qBAAsB,CAAC;EAAG;EAC9H,IAAI,WAA+C;GAAE,OAAO,CAAC,IAAI,EAAE,SAAS,mBAAmB,GAAGC,4BAAsB,GAAG,IAAI,EAAE,SAAS,gBAAgB,GAAGC,yBAAmB,CAAC;EAAG;EACpL,IAAI,iBAA2D;GAAE,OAAO,CAAC,IAAI,EAAE,IAAI,kBAAkB,GAAGC,2BAAoB,CAAC;EAAG;EAChI,IAAI,YAAiD;GAAE,OAAO,CAAC,IAAI,EAAE,IAAI,WAAW,GAAGC,sBAAY,CAAC;EAAG;EACvG,IAAI,QAAyC;GAAE,OAAO,CAAC,IAAI;IAAE,MAAM;IAAW,IAAI;GAAoB,GAAGC,oCAAoB,GAAG,IAAI;IAAE,MAAM;IAAsB,IAAI;GAAY,GAAGC,wCAAa,CAAC;EAAG;EACtM,IAAI,iBAA2D;GAAE,OAAO,CAAC,IAAI,EAAE,IAAI,oBAAoB,GAAGC,mBAAa,GAAG,IAAI,EAAE,IAAI,mBAAmB,GAAGC,kBAAY,CAAC;EAAG;EAC1K,IAAI,aAAmD;GAAE,OAAO,CAAC,IAAI,EAAE,MAAM,WAAW,GAAGC,gBAAY,CAAC;EAAG;EAC3G,IAAI,gBAAyD;GAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,GAAGC,oBAAY,CAAC;EAAG;CACtH;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"web.mjs","names":["isRecord","isRecord","TAB_ID_PREFIX","STATE_GLYPH","asRecord","readString","readNumber","legacy","legacy","legacy","legacy","legacy","legacy","legacy","dockWorkflow","fillStepParent","fillWorkflows","activityGroupWorkflows","channelDynamicWorkflowRuns","channelWorkflowCatalog","channelWorkflowRuns","actionLaunchWorkflow","fillWorkflowLauncher","fillWorkflows2","fillWorkflows3","fillWorkflows4","leaderCatalog","toolWorkflowChild","toolWorkflow"],"sources":["../../src/types/webWorkflows.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/stepPlace.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/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/constants/dynamicWorkflow.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/dynamicWorkflowState.ts","../../src/extensions/workspaces/sessions/(frontend)/_lib/dynamicWorkflowStore.ts","../../src/extensions/workspaces/sessions/(frontend)/_components/dynamicWorkflowPresentation.ts","../../src/extensions/workspaces/sessions/(frontend)/_components/WorkflowDuration.tsx","../../src/extensions/workspaces/sessions/(frontend)/_components/DynamicWorkflowView.tsx","../../src/extensions/workspaces/sessions/(frontend)/_components/StepDynamicRuns.tsx","../../src/extensions/workspaces/sessions/(frontend)/_lib/keySender.ts","../../src/extensions/workspaces/sessions/(frontend)/_components/StepTerminalPanel.tsx","../../src/extensions/workspaces/sessions/(frontend)/_lib/workflowRunPresentation.ts","../../src/extensions/workspaces/sessions/(frontend)/_components/WorkflowRunParts.tsx","../../src/extensions/workspaces/sessions/(frontend)/_lib/catalogStore.ts","../../src/extensions/workspaces/sessions/(frontend)/dock/_components/WorkflowDockPanel.tsx","../../src/extensions/workspaces/(frontend)/dock/workflow.web.tsx","../../src/extensions/workspaces/sessions/(frontend)/_components/StepParentStrip.tsx","../../src/extensions/workspaces/sessions/(frontend)/fill/_components/StepParentFill.tsx","../../src/extensions/workspaces/(frontend)/fill/StepParent.conversation-strip.web.tsx","../../src/extensions/workspaces/(frontend)/fill/Workflows.home.web.ts","../../src/extensions/workspaces/sessions/(frontend)/_components/WorkflowsPanel.tsx","../../src/extensions/workspaces/sessions/(frontend)/_components/DynamicWorkflowPanel.tsx","../../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/dynamic-workflow-runs.web.ts","../../src/extensions/workspaces/sessions/(frontend)/channel/workflow-catalog.web.ts","../../src/extensions/workspaces/sessions/(frontend)/channel/workflow-runs.web.ts","../../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)/_lib/workflowArtifactSource.ts","../../src/extensions/workspaces/sessions/(frontend)/fill/_components/WorkflowsArtifactSource.tsx","../../src/extensions/workspaces/sessions/(frontend)/fill/Workflows.artifacts.source.web.tsx","../../src/extensions/workspaces/sessions/(frontend)/fill/_lib/helpGuides.ts","../../src/extensions/workspaces/sessions/(frontend)/fill/Workflows.help.guides.web.ts","../../src/extensions/workspaces/sessions/(frontend)/leader/catalog.web.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/workflowChildToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/WorkflowChildToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/workflow-child.web.tsx","../../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\nimport type { PoHubSessionUsage } from '@agimon-ai/po-core/hubChannel';\nimport type { PoWorkflowChildrenStatus } from '@agimon-ai/po-core/workflow';\n\n/** Usage coverage is explicit: an absent total is not a measured zero. */\nexport interface WorkflowChildUsageSummary {\n /** False when a journal or any invocation metric is unavailable. */\n complete: boolean;\n invocationCount: number;\n tokensKnown: number;\n costKnown: number;\n toolCountKnown: number;\n tokens?: PoHubSessionUsage['tokens'];\n costUsd?: number;\n toolCount?: number;\n}\n\nexport interface WorkflowChildStatusError {\n lead?: string;\n message: string;\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/** The activity panel's scope line while a step tab is open. */\nexport const STEP_ACTIVITY_SCOPE = 'diagnose step';\n/**\n * The provenance a step's child session carries. The browser cannot read po-core's server-side\n * `WORKFLOW_STEP_SESSION_PROVENANCE`, so it is repeated here; a test keeps the two equal.\n */\nexport const STEP_SESSION_PROVENANCE = 'workflow';\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 /** Run-directory files the job's steps declare, from the workflow definition; absent when none. */\n artifacts?: string[];\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 record plus its folded progress job tree.\n */\nexport interface WorkflowRunView {\n /** Opaque owner-qualified API/cache key. The displayed engine runKey stays unchanged. */\n routeKey?: string;\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 /** The run is parked on the person's approval and resumes once they answer; its error stage is not a failure. */\n waiting?: true;\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 PO_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 /** Latest durable child state, including readable agent-session references. */\n children?: readonly PoWorkflowChildrenStatus[];\n childUsage?: WorkflowChildUsageSummary;\n /** Missing or corrupt child evidence is visible, never represented as successful empty work. */\n childStatusErrors?: WorkflowChildStatusError[];\n}\n\n/** What the workflow runs channel publishes for one session. */\nexport interface WorkflowRunsPayload {\n runs: WorkflowRunView[];\n /**\n * Runs this session ran a step of, as their owners last reported them. Absent when there are none.\n * The session views them and never owns them, so they grant no run actions.\n */\n parentRuns?: WorkflowRunView[];\n}\n\n/**\n * The runs a session ran a step of, read from the durable registry. A stopped step session gets no\n * channel, so its strip and Workflow tab ask for these instead.\n */\nexport interface WorkflowStepRunsResponse {\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 { STEP_SESSION_REF_KIND, type WorkflowRunView } from '../../../../../types/webWorkflows';\n\n/** Where a step session sits: the run, job and step whose session reference names it. */\nexport interface StepPlace {\n run: WorkflowRunView;\n job: string;\n /** The job as a person reads it: a child job's invocation id is left out. */\n jobLabel: string;\n step: string;\n}\n\n/**\n * The step this session ran as, found by the exact session reference its owner recorded. A session\n * is one step's agent, so more than one match is a stale record; the latest run started wins.\n */\nexport function stepPlace(parentRuns: readonly WorkflowRunView[], sessionId: string | null): StepPlace | undefined {\n if (sessionId === null) return undefined;\n let found: StepPlace | undefined;\n for (const run of parentRuns) {\n for (const job of run.jobs) {\n const step = job.steps.find((entry) => entry.ref?.kind === STEP_SESSION_REF_KIND && entry.ref.id === sessionId);\n if (step === undefined) continue;\n if (found === undefined || Date.parse(run.startedAt) > Date.parse(found.run.startedAt))\n found = { run, job: job.name, jobLabel: jobLabel(run, job.name), step: step.name };\n }\n }\n return found;\n}\n\n/** A child job's progress is recorded as `<job>:<invocationId>`; its invocation names the plain job. */\nfunction jobLabel(run: WorkflowRunView, job: string): string {\n for (const { invocations } of run.children ?? [])\n for (const child of invocations) if (`${child.job}:${child.invocationId}` === job) return child.job;\n return job;\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(\n elapsedMs: number,\n t?: (key: string, english: string, vars?: Readonly<Record<string, string | number>>) => string,\n): string {\n if (elapsedMs < MINUTE_MS) return t?.('workflow.duration.lessThanMinute', '<1m') ?? '<1m';\n if (elapsedMs < HOUR_MS)\n return (\n t?.('workflow.duration.minutes', '{minutes}m', { minutes: Math.floor(elapsedMs / MINUTE_MS) }) ??\n `${Math.floor(elapsedMs / MINUTE_MS)}m`\n );\n const hours = Math.floor(elapsedMs / HOUR_MS);\n const minutes = Math.floor((elapsedMs % HOUR_MS) / MINUTE_MS);\n return (\n t?.('workflow.duration.hoursMinutes', '{hours}h {minutes}m', {\n hours,\n minutes: String(minutes).padStart(2, '0'),\n }) ?? `${hours}h ${String(minutes).padStart(2, '0')}m`\n );\n}\n","import type { WorkflowRunView } from '../../../../../types/webWorkflows';\nimport { formatRunDuration } from './runDuration';\n\nexport type WorkflowActivityTone = 'running' | 'paused' | 'waiting' | '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 startedAt: string;\n finishedAt?: 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' | 'routeKey'>): string {\n return `${run.workspace}/${run.routeKey ?? 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.waiting) return 'waiting';\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 === 'waiting') return 'waiting for your approval';\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 startedAt: run.startedAt,\n finishedAt: run.finishedAt,\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 waiting: '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 /** Runs this session ran a step of: viewed for context, never owned. */\n parentRuns: 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 parentRuns: [],\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 parentRuns?: 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 const parentRuns = Array.isArray(input.parentRuns) ? input.parentRuns.filter(isRecord) : [];\n return {\n runs: input.runs.filter(isRecord) as unknown as WorkflowRunView[],\n parentRuns: parentRuns as unknown as WorkflowRunView[],\n };\n },\n reduce: (previous, { runs, parentRuns = [] }) => {\n const current = { ...previous, parentRuns };\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 { ApiResponseOf, ApiRoutes } from '@agimon-ai/po-core/web';\n\nimport type { WorkflowCatalogPayload, WorkflowStepRunsResponse } from './webWorkflows';\nimport type {\n WorkflowArtifactContentResponse,\n WorkflowArtifactsResponse,\n WorkflowArtifactVersionsResponse,\n WorkflowControlResponse,\n WorkflowDeleteResponse,\n WorkflowLaunchResponse,\n WorkflowOpenRunDirectoryResponse,\n WorkflowSteerResponse,\n WorkflowStopResponse,\n WorkflowScreenEvent,\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 const routes = {\n /** Refresh the catalog from the mounting runtime, including files written outside agent tools. */\n catalog: {\n method: 'GET',\n path: '/catalog',\n response: undefined as unknown as ApiResponseOf<WorkflowCatalogPayload>,\n },\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 snapshot: {\n method: 'GET',\n path: `${RUN}/screen`,\n query: [STEP_TARGET_PARAM],\n response: undefined as unknown as ApiResponseOf<WorkflowScreenEvent>,\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: undefined as unknown as ApiResponseOf<WorkflowControlResponse>,\n },\n keys: {\n method: 'POST',\n path: `${RUN}/keys`,\n },\n resize: {\n method: 'POST',\n path: `${RUN}/resize`,\n response: undefined as unknown as ApiResponseOf<{ resized: boolean }>,\n },\n remove: {\n method: 'DELETE',\n path: RUN,\n response: undefined as unknown as ApiResponseOf<WorkflowDeleteResponse>,\n },\n stop: {\n method: 'POST',\n path: `${RUN}/stop`,\n response: undefined as unknown as ApiResponseOf<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: undefined as unknown as ApiResponseOf<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: undefined as unknown as ApiResponseOf<WorkflowLaunchResponse>,\n },\n openRunDirectory: {\n method: 'POST',\n path: `${RUN}/open-directory`,\n response: undefined as unknown as ApiResponseOf<WorkflowOpenRunDirectoryResponse>,\n },\n artifacts: {\n method: 'GET',\n path: `${RUN}/artifacts`,\n query: ['directory'],\n response: undefined as unknown as ApiResponseOf<WorkflowArtifactsResponse>,\n },\n /**\n * The runs a session ran a step of, finished ones included. A session mount answers only for\n * its own session; the host mount answers for any, as it already serves any run.\n */\n stepRuns: {\n method: 'GET',\n path: '/step-runs/:sessionId',\n response: undefined as unknown as ApiResponseOf<WorkflowStepRunsResponse>,\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: undefined as unknown as ApiResponseOf<WorkflowArtifactContentResponse>,\n },\n /** Every sealed, immutable version of one run-directory entry, oldest first. */\n artifactVersions: {\n method: 'GET',\n path: `${RUN}/versions/${ARTIFACT_NAME_PARAM}`,\n response: undefined as unknown as ApiResponseOf<WorkflowArtifactVersionsResponse>,\n },\n /** One sealed version's metadata and text, read from its immutable bytes rather than the working copy. */\n artifactVersion: {\n method: 'GET',\n path: `${RUN}/version/:versionId`,\n response: undefined as unknown as ApiResponseOf<WorkflowArtifactContentResponse>,\n },\n} as const satisfies ApiRoutes;\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { createApiClient, sessionApiAddress } from '@agimon-ai/po-core/web';\nimport { browserTransport } 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 = ['host', 'workspace', 'session'] as const;\n\nexport const api = createApiClient(routes, {\n scopes: apiScopes,\n basePath: 'workflow',\n transport: (input, init) => browserTransport.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 /** The finite snapshot was clipped to its response budget. */\n truncated?: 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/** One sealed, immutable version of a run-directory entry. */\nexport interface WorkflowArtifactVersionView {\n versionId: string;\n seq: number;\n /** SHA-256 of the bytes, `missing` for a removal, or a listing hash for a directory. */\n sha: string;\n size: number;\n /** The job and step that wrote it; absent for a change made outside any step. */\n job?: string;\n step?: string;\n /** ISO 8601 of when it was sealed. */\n sealedAt: string;\n /** True once its bytes were removed by the retention sweep. */\n swept: boolean;\n}\n\n/** Every sealed version of one path, oldest first. */\nexport interface WorkflowArtifactVersionsResponse {\n path: string;\n versions: WorkflowArtifactVersionView[];\n}\n/** Acknowledges opening the registered run folder in Finder. */\nexport interface WorkflowOpenRunDirectoryResponse {\n opened: true;\n}\n","import { browserTransport } 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 type { WorkflowRunView } from '../../../../../types/webWorkflows';\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.host;\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.host : 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. A stream the server refuses outright does not\n * reconnect, so `onClosed` tells the reader instead of leaving it waiting.\n */\nexport function followScreen(\n workspace: string,\n runKey: string,\n onEvent: (event: WorkflowScreenEvent) => void,\n sessionId?: string | null,\n step?: string,\n onClosed?: (message: string) => void,\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.removeEventListener('error', failed);\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 // A dropped stream is still CONNECTING while EventSource retries; CLOSED means it gave up.\n const failed = (): void => {\n if (source.readyState !== EventSource.CLOSED) return;\n stop();\n onClosed?.(\"The run's screen could not be opened. Close this tab and open it again to retry.\");\n };\n source.addEventListener(WORKFLOW_SCREEN_EVENT, handler as EventListener);\n source.addEventListener('error', failed);\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\n/**\n * The runs a step session was a step of, read from the host's registry. A stopped step session gets no\n * channel, so this is how its strip and Workflow tab learn their run; undefined when the host refuses.\n */\nexport async function fetchStepRuns(sessionId: string): Promise<WorkflowRunView[] | undefined> {\n const result = await api.host.stepRuns({ params: { sessionId } });\n return result.ok ? result.data.runs : undefined;\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 signal?: AbortSignal,\n): Promise<ArtifactsResult> {\n const result = await scoped(sessionId).artifacts({\n params: runParams(workspace, runKey),\n query: { directory },\n signal,\n });\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 browserTransport.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 { useT } from '@agimon-ai/po-core/web';\nimport type { TransientTab, WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport { Badge, Button, EmptyState, Markdown } from '@agimon-ai/po-web-components';\nimport { useStore } from '@tanstack/react-store';\nimport { useEffect, useRef, 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';\nimport { workflows } from '../_lib/workflowsStore';\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-po-green' },\n empty: { glyph: '○', className: 'text-po-yellow' },\n pending: { glyph: '○', className: 'text-po-faint' },\n unreadable: { glyph: '!', className: 'text-po-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-po-panel text-po-hi\">\n <tr>\n {head.map((cell, index) => (\n <th key={index} className=\"border border-po-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-po-border px-2 py-1 align-top text-po-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 t = useT();\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={t('workflow.ui.thisArtifactIsEmpty.lowercase', 'this artifact is empty')}\n description={t(\n 'workflow.ui.theWorkflowCreatedTheFileButDidNotWriteAnyContent',\n 'The workflow created the file but did not write any content.',\n )}\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-po-text\"\n >\n {text}\n </pre>\n ) : (\n <div data-testid=\"artifact-markdown\" className=\"max-w-5xl text-base text-po-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-po-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={t('workflow.ui.pdfArtifact', '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-po-text\">{text}</pre>;\n }\n return (\n <EmptyState\n title={t('workflow.ui.previewUnavailable.lowercase', 'preview unavailable')}\n description={t(\n 'workflow.ui.downloadThisArtifactToOpenItWithALocalApplication',\n 'Download this artifact to open it with a local application.',\n )}\n />\n );\n}\n\n/** One artifact, read-only, in its own tab; `readFrom` names the server to read it from, the tab's session by default. */\nexport function artifactTab(run: WorkflowRunView, path: string, readFrom?: string | null): TransientTab {\n return {\n id: `${TAB_ID_PREFIX}${run.workspace}-${run.routeKey ?? run.runKey}-${path}`.replace(/[^\\w-]+/g, '-'),\n label: path.split('/').pop() ?? path,\n panel: (props: WebPluginSlotProps) => (\n <ArtifactViewerPanel\n {...props}\n sessionId={readFrom === undefined ? props.sessionId : readFrom}\n workspace={run.workspace}\n runKey={run.routeKey ?? run.runKey}\n path={path}\n />\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 t = useT();\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-po-hi\">{path}</span>\n <Badge size=\"xs\">{mimeType ?? t('workflow.ui.artifactLower', 'artifact')}</Badge>\n <span className=\"text-sm text-po-dim\">\n {content === undefined\n ? ''\n : t('workflow.ui.artifactWritten', '{size} · written {time}', {\n size: formatSize(content.size),\n time: formatWhen(content.modifiedAt),\n })}\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 {t('workflow.ui.renderedLower', '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 {t('workflow.ui.rawLower', 'raw')}\n </Button>\n </div>\n ) : null}\n <Button asChild variant=\"ghost\" size=\"xs\">\n <a data-testid=\"artifact-download\" href={downloadUrl} download>\n {' '}\n {t('workflow.ui.download.lowercase', '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 {' '}\n {t('workflow.ui.reload.lowercase', 'reload')}{' '}\n </Button>\n </div>\n <div className=\"min-h-0 flex-1 overflow-auto rounded-md border border-po-border bg-po-deep p-4\">\n {error !== undefined ? (\n <span data-testid=\"artifact-error\" className=\"text-base text-po-yellow\">\n {error}\n </span>\n ) : content === undefined ? (\n <span className=\"text-sm text-po-dim\">{t('workflow.ui.loadingPreview.lowercase', '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-po-dim\">\n {t(\n 'workflow.ui.previewTruncated',\n 'this preview shows the first {size}; download the artifact for the complete file',\n { size: formatSize(content.text?.length) },\n )}\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 // Every workflow_runs push (including reconnect replay) supplies a fresh run list.\n const runs = useStore(workflows.store, (state) => workflows.select(state, sessionId).runs);\n const [listing, setListing] = useState<WorkflowArtifactsResponse>();\n const [error, setError] = useState<string>();\n\n const refresh = useRef<(() => void) | undefined>(undefined);\n useEffect(() => {\n const controller = new AbortController();\n let active = false;\n let queued = false;\n const load = async (): Promise<void> => {\n if (active) {\n queued = true;\n return;\n }\n active = true;\n try {\n do {\n queued = false;\n const result = await fetchArtifacts(\n run.workspace,\n run.routeKey ?? run.runKey,\n sessionId,\n undefined,\n controller.signal,\n );\n if (controller.signal.aborted) return;\n if ('error' in result) setError(result.error);\n else {\n setError(undefined);\n setListing(result.artifacts);\n }\n } while (queued);\n } catch (error) {\n if (!controller.signal.aborted) setError(String(error));\n } finally {\n active = false;\n }\n };\n refresh.current = () => {\n void load();\n };\n return () => {\n refresh.current = undefined;\n controller.abort();\n };\n }, [run.workspace, run.runKey, run.routeKey, sessionId]);\n\n useEffect(() => {\n refresh.current?.();\n }, [run.workspace, run.runKey, run.routeKey, sessionId, runs]);\n\n return (\n <ArtifactList\n listing={listing}\n error={error}\n onLoadDirectory={(directory) => fetchArtifacts(run.workspace, run.routeKey ?? run.runKey, sessionId, directory)}\n onOpen={onOpen}\n onOpenDirectory={() => openRunDirectory(run.workspace, run.routeKey ?? 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 t = useT();\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(t('workflow.ui.openFolderFailed', '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) => ({\n ...current,\n [entry.path]: t('workflow.ui.readFolderFailed', 'The folder cannot be read.'),\n }));\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-po-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-po-dim' : 'text-po-hi'}`}\n >\n {entry.path.split('/').pop()}\n {entry.kind === 'directory' ? '/' : ''}\n </span>\n <span className=\"shrink-0 text-sm text-po-dim\">\n {entry.state === 'pending'\n ? t('workflow.ui.pendingLower', '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-po-dim\">\n {entry.declared ? (\n <Badge size=\"xs\" tone=\"violet\" className=\"shrink-0\">\n {t('workflow.ui.declaredLower', '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-po-border pl-1\">\n {loading.has(entry.path) ? (\n <span className=\"px-3 text-sm text-po-dim\">{t('workflow.ui.loading.lowercase', 'loading…')}</span>\n ) : null}\n {folderErrors[entry.path] ? (\n <span role=\"alert\" className=\"px-3 text-base text-po-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\n className=\"py-4\"\n title={t('workflow.ui.theRunDirectoryCannotBeRead.lowercase', 'the run directory cannot be read')}\n description={error}\n />\n ) : null}\n {entries.size === 0 && error === undefined ? (\n <EmptyState\n className=\"py-4\"\n title={t('workflow.ui.nothingInTheRunDirectoryYet.lowercase', 'nothing in the run directory yet')}\n />\n ) : null}\n {listing?.description ? <span className=\"px-3 py-2 text-sm text-po-dim\">{listing.description}</span> : null}\n {renderChildren('')}\n {openError === undefined ? null : (\n <span role=\"alert\" className=\"px-3 text-base text-po-yellow\">\n {openError}\n </span>\n )}\n {listing === undefined ? null : (\n <button\n type=\"button\"\n data-testid=\"workflow-open-directory\"\n aria-label={t('workflow.ui.openWorkflowFolderInFinder', 'Open workflow folder in Finder')}\n title={t('workflow.ui.openPathInFinder', '{path} (open in Finder)', { path: listing.runDir })}\n disabled={opening || onOpenDirectory === undefined}\n onClick={() => void openDirectory()}\n className=\"truncate px-3 py-2 text-left text-base text-po-dim hover:text-po-hi disabled:cursor-default\"\n >\n {listing.runDir}\n </button>\n )}\n </div>\n );\n}\n","export const DYNAMIC_WORKFLOW_CHANNEL = 'dynamic_workflow_runs';\n","import type { DynamicWorkflowSnapshot, DynamicWorkflowStatus } from '../../../../../types/dynamicWorkflow';\n\nconst STATUSES: readonly string[] = ['pending', 'running', 'completed', 'failed', 'stopped', 'skipped'];\nconst SHAPE_KINDS = ['step', 'sequence', 'parallel', 'branch', 'foreach'];\n\nfunction record(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\nfunction finite(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value);\n}\nfunction count(value: unknown): boolean {\n return finite(value) && Number.isSafeInteger(value) && value >= 0;\n}\nfunction status(value: unknown): value is DynamicWorkflowStatus {\n return typeof value === 'string' && STATUSES.includes(value);\n}\nfunction named(value: unknown): value is Record<string, unknown> {\n return record(value) && typeof value.key === 'string' && typeof value.label === 'string';\n}\nfunction timing(value: Record<string, unknown>): boolean {\n return (\n (value.startedAt === undefined || finite(value.startedAt)) &&\n (value.finishedAt === undefined || finite(value.finishedAt)) &&\n (value.error === undefined || typeof value.error === 'string')\n );\n}\nfunction shape(value: unknown, depth = 0): boolean {\n return (\n depth < 128 &&\n named(value) &&\n typeof value.kind === 'string' &&\n SHAPE_KINDS.includes(value.kind) &&\n Array.isArray(value.children) &&\n value.children.every((child: unknown) => shape(child, depth + 1))\n );\n}\nfunction agent(value: unknown): boolean {\n return (\n record(value) &&\n typeof value.runId === 'string' &&\n value.runId.length > 0 &&\n status(value.status) &&\n value.status !== 'pending' &&\n value.status !== 'skipped'\n );\n}\nfunction phase(value: unknown): boolean {\n return (\n named(value) &&\n status(value.status) &&\n status(value.executionStatus) &&\n timing(value) &&\n Array.isArray(value.agents) &&\n value.agents.every(agent)\n );\n}\nfunction item(value: unknown): boolean {\n return (\n named(value) &&\n count(value.index) &&\n status(value.status) &&\n Array.isArray(value.phases) &&\n value.phases.every(phase)\n );\n}\nfunction group(value: unknown): boolean {\n return (\n named(value) &&\n count(value.total) &&\n typeof value.truncated === 'boolean' &&\n (value.concurrency === undefined || (count(value.concurrency) && value.concurrency !== 0)) &&\n record(value.counts) &&\n STATUSES.every((key) => count((value.counts as Record<string, unknown>)[key])) &&\n Array.isArray(value.items) &&\n value.items.every(item)\n );\n}\nfunction run(value: unknown): boolean {\n return (\n named(value) &&\n typeof value.workflowId === 'string' &&\n status(value.status) &&\n status(value.executionStatus) &&\n finite(value.startedAt) &&\n timing(value) &&\n shape(value.shape) &&\n Array.isArray(value.groups) &&\n value.groups.every(group)\n );\n}\n\n/** Validate every field the two presentations read before admitting a transport frame. */\nexport function parseWorkflowSnapshot(value: unknown): DynamicWorkflowSnapshot | null {\n if (\n !record(value) ||\n value.version !== 1 ||\n !count(value.revision) ||\n typeof value.sessionId !== 'string' ||\n !Array.isArray(value.runs) ||\n !value.runs.every(run) ||\n (value.unlinkedAgents !== undefined &&\n (!Array.isArray(value.unlinkedAgents) ||\n value.unlinkedAgents.length > 1000 ||\n !value.unlinkedAgents.every(agent)))\n )\n return null;\n return value as unknown as DynamicWorkflowSnapshot;\n}\n\n/** Session identity is checked by the channel before this monotonic fold. */\nexport function nextWorkflowSnapshot(\n current: DynamicWorkflowSnapshot | null,\n next: DynamicWorkflowSnapshot,\n): DynamicWorkflowSnapshot {\n return current !== null && next.revision <= current.revision ? current : next;\n}\n","import { defineSessionChannel, defineSessionStore } from '@agimon-ai/po-core/web';\n\nimport { DYNAMIC_WORKFLOW_CHANNEL } from '../../../../../constants/dynamicWorkflow';\nimport type { DynamicWorkflowSnapshot } from '../../../../../types/dynamicWorkflow';\nimport { nextWorkflowSnapshot, parseWorkflowSnapshot } from './dynamicWorkflowState';\n\nexport const dynamicWorkflows = defineSessionStore<DynamicWorkflowSnapshot | null>(null);\n\nexport const dynamicWorkflowRunsChannel = defineSessionChannel<DynamicWorkflowSnapshot>({\n channel: DYNAMIC_WORKFLOW_CHANNEL,\n parse: parseWorkflowSnapshot,\n apply(sessionId, snapshot) {\n if (snapshot.sessionId !== sessionId) return;\n dynamicWorkflows.update(sessionId, (current) => nextWorkflowSnapshot(current, snapshot));\n },\n drop(sessionId) {\n dynamicWorkflows.drop(sessionId);\n },\n});\n","import type {\n DynamicWorkflowGroup,\n DynamicWorkflowItem,\n DynamicWorkflowPhase,\n DynamicWorkflowShape,\n DynamicWorkflowRun,\n DynamicWorkflowStatus,\n} from '../../../../../types/dynamicWorkflow';\n\ntype Translate = (key: string, english: string, vars?: Readonly<Record<string, string | number>>) => string;\n\nexport const WORKFLOW_STATUS = {\n pending: { label: 'Pending', tone: 'neutral' },\n running: { label: 'Running', tone: 'running' },\n completed: { label: 'Done', tone: 'ok' },\n failed: { label: 'Failed', tone: 'error' },\n stopped: { label: 'Stopped', tone: 'neutral' },\n skipped: { label: 'Skipped', tone: 'neutral' },\n} as const satisfies Record<DynamicWorkflowStatus, { label: string; tone: string }>;\n\nexport function workflowStatusLabel(t: Translate, status: DynamicWorkflowStatus): string {\n switch (status) {\n case 'pending':\n return t('workflow.dynamic.state.pending', 'Pending');\n case 'running':\n return t('workflow.dynamic.state.running', 'Running');\n case 'completed':\n return t('workflow.dynamic.state.completed', 'Done');\n case 'failed':\n return t('workflow.dynamic.state.failed', 'Failed');\n case 'stopped':\n return t('workflow.dynamic.state.stopped', 'Stopped');\n case 'skipped':\n return t('workflow.dynamic.state.skipped', 'Skipped');\n }\n}\n\nexport function groupSummary(group: DynamicWorkflowGroup, t: Translate): string {\n const count = (status: DynamicWorkflowStatus) => group.counts[status];\n const parts = [\n t('workflow.dynamic.runningOf', '{count} of {total} running', { count: count('running'), total: group.total }),\n t('workflow.dynamic.completed', '{count} done', { count: count('completed') }),\n ];\n if (count('failed')) parts.push(t('workflow.dynamic.failed', '{count} failed', { count: count('failed') }));\n if (count('stopped')) parts.push(t('workflow.dynamic.stopped', '{count} stopped', { count: count('stopped') }));\n if (count('skipped')) parts.push(t('workflow.dynamic.skipped', '{count} skipped', { count: count('skipped') }));\n return parts.join(' · ');\n}\n\nexport function activitySummary(runs: DynamicWorkflowRun[], t: Translate): string {\n if (!runs.length) return t('workflow.dynamic.appears', 'Workflows appear here when Po starts them.');\n return t('workflow.dynamic.summary', '{running} running · {finished} finished', {\n running: runs.filter((run) => run.status === 'running').length,\n finished: runs.filter((run) => run.status !== 'running' && run.status !== 'pending').length,\n });\n}\n\n/** One line for the dynamic workflows a workflow step's agent started, e.g. `2 dynamic runs · 1 failed`. */\nexport function stepRunsSummary(runs: readonly DynamicWorkflowRun[], t: Translate): { text: string; failed: number } {\n const running = runs.filter((run) => run.status === 'running').length;\n const failed = runs.filter((run) => run.status === 'failed').length;\n const parts = [\n runs.length === 1\n ? t('workflow.dynamic.runs.one', '{count} dynamic run', { count: runs.length })\n : t('workflow.dynamic.runs.many', '{count} dynamic runs', { count: runs.length }),\n ];\n if (running) parts.push(t('workflow.dynamic.running', '{count} running', { count: running }));\n return { text: parts.join(' · '), failed };\n}\n\nexport function workflowDuration(startedAt?: number, finishedAt?: number, now = 0, t?: Translate): string {\n if (startedAt === undefined) return t?.('workflow.artifacts.pending', 'Not started') ?? 'Not started';\n const seconds = Math.max(0, Math.floor(((finishedAt ?? now) - startedAt) / 1000));\n if (seconds < 60) return t?.('workflow.duration.seconds', '{seconds}s', { seconds }) ?? `${seconds}s`;\n return (\n t?.('workflow.duration.minutesSeconds', '{minutes}m {seconds}s', {\n minutes: Math.floor(seconds / 60),\n seconds: seconds % 60,\n }) ?? `${Math.floor(seconds / 60)}m ${seconds % 60}s`\n );\n}\n\nexport interface DynamicWorkflowViewProps {\n runs: DynamicWorkflowRun[];\n now?: number;\n connected?: boolean;\n defaultExpandedKeys?: string[];\n onOpenAgent: (runId: string, session?: true) => void;\n}\n\nexport interface DynamicWorkflowActivityProps {\n runs: DynamicWorkflowRun[];\n connected?: boolean;\n onOpen: () => void;\n}\n\nexport const MAX_GRAPH_ITEM_CELLS = 24;\n\nexport const statusDot = (status: DynamicWorkflowStatus) =>\n status === 'completed' ? 'green' : status === 'running' ? 'yellow' : status === 'failed' ? 'red' : 'neutral';\n\nexport function activityCounts(run: DynamicWorkflowRun) {\n // Root rows describe direct steps, not foreach items.\n const groups = run.groups.filter((group) => group.concurrency !== undefined);\n const total = groups.reduce((sum, group) => sum + group.total, 0);\n const count = (status: DynamicWorkflowStatus) => groups.reduce((sum, group) => sum + group.counts[status], 0);\n return { total, running: count('running'), done: count('completed'), failed: count('failed') };\n}\n\nexport interface WorkflowGraphNode {\n id: string;\n parentId?: string;\n position: { x: number; y: number };\n width: number;\n height: number;\n data: {\n label: string;\n kind: DynamicWorkflowShape['kind'];\n status: DynamicWorkflowStatus;\n phase?: DynamicWorkflowPhase;\n group?: DynamicWorkflowGroup;\n };\n}\nexport interface WorkflowGraphEdge {\n id: string;\n source: string;\n target: string;\n status: DynamicWorkflowStatus;\n}\n\n/** DOM-free series-parallel layout. All child coordinates are relative to their foreach parent. */\nexport function workflowGraph(run: DynamicWorkflowRun, t?: Translate) {\n type Box = {\n nodes: WorkflowGraphNode[];\n edges: WorkflowGraphEdge[];\n width: number;\n height: number;\n entry: string[];\n exit: string[];\n };\n const edge = (source: string, target: string, nodes: WorkflowGraphNode[]): WorkflowGraphEdge => ({\n id: `${source}->${target}`,\n source,\n target,\n status: nodes.find((node) => node.id === target)?.data.status ?? 'pending',\n });\n const aggregate = (statuses: DynamicWorkflowStatus[]): DynamicWorkflowStatus =>\n statuses.includes('running')\n ? 'running'\n : statuses.includes('failed')\n ? 'failed'\n : statuses.length &&\n statuses.some((status) => status === 'completed') &&\n statuses.every((status) => status === 'completed' || status === 'skipped')\n ? 'completed'\n : statuses.includes('stopped')\n ? 'stopped'\n : statuses.length && statuses.every((status) => status === 'skipped')\n ? 'skipped'\n : 'pending';\n const layout = (shape: DynamicWorkflowShape, item?: DynamicWorkflowItem, parentId?: string): Box => {\n const id = `${parentId ?? run.key}:${shape.key}`;\n if (shape.kind === 'step') {\n const phase = item?.phases.find((phase) => phase.key === shape.key);\n return {\n nodes: [\n {\n id,\n parentId,\n position: { x: 0, y: 0 },\n width: 200,\n height: phase?.error ? 88 : 64,\n data: { label: shape.label, kind: shape.kind, status: phase?.status ?? 'pending', phase },\n },\n ],\n edges: [],\n width: 200,\n height: phase?.error ? 88 : 64,\n entry: [id],\n exit: [id],\n };\n }\n if (shape.kind === 'foreach') {\n const group = run.groups.find((group) =>\n item ? group.key === `${item.key}/${shape.key}` : group.key.endsWith(`/${shape.key}`),\n );\n const representative = group?.items.find((row) => row.status === 'running') ?? group?.items[0];\n const inner = combine(\n shape.children.map((child) => layout(child, representative, id)),\n false,\n );\n const width = Math.max(360, inner.width + 48);\n const cellRows = Math.ceil(Math.min(group?.items.length ?? 0, MAX_GRAPH_ITEM_CELLS) / 8);\n const height = inner.height + 112 + cellRows * 40 + (group && group.total > MAX_GRAPH_ITEM_CELLS ? 32 : 0);\n const status = group\n ? aggregate(\n Object.entries(group.counts)\n .filter(([, count]) => count > 0)\n .map(([status]) => status as DynamicWorkflowStatus),\n )\n : 'pending';\n const node: WorkflowGraphNode = {\n id,\n parentId,\n position: { x: 0, y: 0 },\n width,\n height,\n data: { label: shape.label, kind: shape.kind, status, group },\n };\n inner.nodes.forEach((node) => {\n if (node.parentId === id) {\n node.position.x += (width - inner.width) / 2;\n node.position.y += 72;\n }\n });\n return { nodes: [node, ...inner.nodes], edges: inner.edges, width, height, entry: [id], exit: [id] };\n }\n const children = shape.children.map((child) => layout(child, item, parentId));\n const box = combine(children, shape.kind !== 'sequence');\n if (shape.kind !== 'branch') return box;\n box.nodes.forEach((node) => {\n if (node.parentId === parentId) node.position.y += 144;\n });\n const status = aggregate(\n children.flatMap((child) =>\n child.nodes.filter((node) => node.parentId === parentId).map((node) => node.data.status),\n ),\n );\n const node: WorkflowGraphNode = {\n id,\n parentId,\n position: { x: (box.width - 160) / 2, y: 0 },\n width: 160,\n height: 96,\n data: { label: t?.('workflow.extra.branch', 'Branch') ?? 'Branch', kind: 'branch', status },\n };\n box.edges.push(...box.entry.map((target) => edge(id, target, box.nodes)));\n return { ...box, nodes: [node, ...box.nodes], height: box.height + 144, entry: [id] };\n };\n function combine(boxes: Box[], horizontal: boolean): Box {\n const width = horizontal\n ? boxes.reduce((sum, box) => sum + box.width, 0) + Math.max(0, boxes.length - 1) * 48\n : Math.max(200, ...boxes.map((box) => box.width));\n const nodes: WorkflowGraphNode[] = [],\n edges: WorkflowGraphEdge[] = [];\n let offset = 0;\n boxes.forEach((box, index) => {\n const roots = new Set(box.nodes.map((node) => node.id));\n box.nodes.forEach((node) => {\n if (!node.parentId || !roots.has(node.parentId)) {\n node.position.x += horizontal ? offset : (width - box.width) / 2;\n node.position.y += horizontal ? 0 : offset;\n }\n });\n nodes.push(...box.nodes);\n edges.push(...box.edges);\n if (!horizontal && index)\n for (const source of boxes[index - 1].exit)\n for (const target of box.entry) edges.push(edge(source, target, box.nodes));\n offset += (horizontal ? box.width : box.height) + 48;\n });\n return {\n nodes,\n edges,\n width,\n height: horizontal ? Math.max(0, ...boxes.map((box) => box.height)) : Math.max(0, offset - 48),\n entry: horizontal ? boxes.flatMap((box) => box.entry) : (boxes[0]?.entry ?? []),\n exit: horizontal ? boxes.flatMap((box) => box.exit) : (boxes.at(-1)?.exit ?? []),\n };\n }\n const root = run.groups\n .flatMap((group) => group.items)\n .find((item) =>\n item.phases.some((phase) => {\n const direct = (shape: DynamicWorkflowShape): boolean =>\n shape.kind === 'foreach' ? false : shape.key === phase.key || shape.children.some(direct);\n return direct(run.shape);\n }),\n );\n return layout(run.shape, root);\n}\n","import { useT } from '@agimon-ai/po-core/web';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { formatRunDuration } from '../_lib/runDuration';\nimport { workflowDuration } from './dynamicWorkflowPresentation';\n\n/** Bare elapsed text, including the workflow graph's seconds format. Fixed now is for stories. */\nexport function WorkflowDuration({\n startedAt,\n endedAt,\n now,\n seconds = false,\n running = true,\n}: {\n startedAt?: string | number;\n endedAt?: string | number;\n now?: number;\n seconds?: boolean;\n running?: boolean;\n}) {\n const ref = useRef<HTMLSpanElement>(null);\n const [mountedAt] = useState(Date.now);\n const t = useT();\n const start = typeof startedAt === 'string' ? Date.parse(startedAt) : startedAt;\n const end = typeof endedAt === 'string' ? Date.parse(endedAt) : endedAt;\n const textAt = useCallback(\n (clock: number) => {\n if (start === undefined || !Number.isFinite(start))\n return seconds ? t('workflow.artifacts.pending', 'Not started') : '';\n if (end !== undefined && !Number.isFinite(end)) return '';\n return seconds\n ? workflowDuration(start, end, clock, t)\n : formatRunDuration(Math.max(0, (end ?? clock) - start), t);\n },\n [start, end, seconds, t],\n );\n useEffect(() => {\n if (now !== undefined || !running || start === undefined || !Number.isFinite(start) || end !== undefined) return;\n const tick = () => {\n const node = ref.current?.firstChild;\n if (node) node.nodeValue = textAt(Date.now());\n };\n tick();\n const timer = setInterval(tick, seconds ? 1000 : 10_000);\n return () => clearInterval(timer);\n }, [start, end, now, seconds, running, textAt]);\n return <span ref={ref}>{textAt(now ?? mountedAt)}</span>;\n}\n","import { useT } from '@agimon-ai/po-core/web';\nimport {\n Button,\n Dot,\n EmptyState,\n FlowGraph,\n type FlowGraphNode,\n Popover,\n PopoverContent,\n PopoverTrigger,\n StatusBadge,\n WorkflowIcon,\n} from '@agimon-ai/po-web-components';\n\nimport type { DynamicWorkflowRun, DynamicWorkflowStatus } from '../../../../../types/dynamicWorkflow';\nimport {\n type DynamicWorkflowActivityProps,\n type DynamicWorkflowViewProps,\n type WorkflowGraphNode,\n MAX_GRAPH_ITEM_CELLS,\n activityCounts,\n activitySummary,\n statusDot,\n WORKFLOW_STATUS,\n workflowStatusLabel,\n workflowGraph,\n} from './dynamicWorkflowPresentation';\nimport { WorkflowDuration } from './WorkflowDuration';\n\nconst statusColor = (status: DynamicWorkflowStatus) =>\n `var(--po-${statusDot(status) === 'neutral' ? 'dim' : statusDot(status)})`;\n\nexport function DynamicWorkflowActivity({ runs, connected = true, onOpen }: DynamicWorkflowActivityProps) {\n const t = useT();\n return (\n <div className=\"space-y-2\">\n <p className=\"px-3 text-sm text-po-dim\">\n {connected\n ? activitySummary(runs, t)\n : t('workflow.extra.connectionPausedShowingLastUpdate', 'Connection paused. Showing last update.')}\n </p>\n {!runs.length && (\n <Button\n variant=\"ghost\"\n size=\"card\"\n onClick={onOpen}\n aria-label={t('workflow.ui.openDynamicWorkflows', 'Open dynamic workflows')}\n >\n <span className=\"text-base font-semibold text-po-hi\">\n {t('workflow.ui.noWorkflowsYet', 'No workflows yet')}\n </span>\n <span className=\"text-sm text-po-dim\">{t('workflow.ui.idle', 'Idle')}</span>\n <span className=\"text-sm text-po-blue\">{t('workflow.ui.viewWorkflows', 'View workflows →')}</span>\n </Button>\n )}\n {runs.map((run) => {\n const counts = activityCounts(run);\n return (\n <Button\n key={run.key}\n variant=\"ghost\"\n size=\"card\"\n onClick={onOpen}\n aria-label={t('workflow.ui.openRun', 'Open {name}', { name: run.label })}\n >\n <span className=\"flex w-full items-center gap-3\">\n <Dot tone={statusDot(run.status)} size=\"md\" />\n <span className=\"min-w-0 flex-1 break-words text-base font-semibold text-po-hi\">{run.label}</span>\n <span className=\"shrink-0 text-sm text-po-dim\">{workflowStatusLabel(t, run.status)} ›</span>\n </span>\n {counts.total > 0 && (\n <>\n <span className=\"pl-5 text-sm text-po-dim\">\n {run.status === 'running'\n ? t('workflow.dynamic.runningOf', '{count} of {total} running', {\n count: counts.running,\n total: counts.total,\n })\n : t('workflow.ui.itemCount', '{count} items', { count: counts.total })}{' '}\n · {counts.done} {t('workflow.ui.done.lowercase', 'done')}{' '}\n {counts.failed > 0 && (\n <span className=\"text-po-red\">\n {' '}\n · {counts.failed} {t('workflow.ui.failed.lowercase', 'failed')}\n </span>\n )}\n </span>\n <span\n className=\"ml-5 flex h-1.5 overflow-hidden rounded-full bg-po-deep\"\n role=\"img\"\n aria-label={t('workflow.ui.progressCounts', '{done} done, {running} running, {total} total', {\n done: counts.done,\n running: counts.running,\n total: counts.total,\n })}\n >\n <span className=\"bg-po-green\" style={{ width: `${(counts.done / counts.total) * 100}%` }} />\n <span className=\"bg-po-yellow\" style={{ width: `${(counts.running / counts.total) * 100}%` }} />\n </span>\n </>\n )}\n </Button>\n );\n })}\n </div>\n );\n}\n\ntype NodeContext = Pick<DynamicWorkflowViewProps, 'now' | 'onOpenAgent'> & { expanded: string[] };\nfunction WorkflowNode({ data, now, expanded, onOpenAgent }: Pick<WorkflowGraphNode, 'data'> & NodeContext) {\n const t = useT();\n const group = data.group;\n const cells = group?.items.slice(0, MAX_GRAPH_ITEM_CELLS) ?? [];\n return (\n <div\n className={\n data.kind === 'branch'\n ? 'relative flex h-full items-center justify-center text-base text-po-text'\n : 'h-full rounded-lg border bg-po-panel p-3 text-base text-po-text'\n }\n style={{\n borderColor:\n data.kind === 'foreach' && data.status === 'running' ? statusColor(data.status) : 'var(--po-border)',\n }}\n >\n {data.kind === 'branch' && (\n <svg viewBox=\"0 0 160 96\" className=\"absolute inset-0 h-full w-full\" aria-hidden=\"true\">\n <polygon points=\"80,1 159,48 80,95 1,48\" fill=\"var(--po-panel)\" stroke=\"var(--po-border)\" />\n </svg>\n )}\n <div className=\"relative flex items-center gap-3\">\n <span aria-hidden=\"true\" style={{ color: statusColor(data.status) }}>\n {data.kind === 'branch'\n ? '◇'\n : data.status === 'completed'\n ? '✓'\n : data.status === 'running'\n ? '●'\n : data.status === 'failed'\n ? '×'\n : '○'}\n </span>\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate font-semibold text-po-hi\" title={data.label}>\n {data.kind === 'foreach' ? t('workflow.ui.foreachCaption', 'foreach · ') : ''}\n {data.label}\n </p>\n <p className=\"text-sm text-po-dim\">\n {group ? (\n t('workflow.ui.itemCount', '{count} items', { count: group.total }) +\n (group.concurrency\n ? t('workflow.ui.concurrencyLowerCaption', ' · up to {count} at once', { count: group.concurrency })\n : '')\n ) : (\n <>\n {workflowStatusLabel(t, data.status)}\n {data.phase?.startedAt === undefined ? null : (\n <>\n {' '}\n ·{' '}\n <WorkflowDuration\n seconds\n startedAt={data.phase.startedAt}\n endedAt={data.phase.finishedAt}\n now={now}\n running={data.status === 'running'}\n />\n </>\n )}\n </>\n )}\n </p>\n </div>\n {data.phase?.agents.map((agent, index) => (\n <Button\n key={agent.runId}\n variant=\"link\"\n size=\"sm\"\n className=\"shrink-0 px-1\"\n aria-label={t('workflow.ui.openAgentTranscript', 'Open {name} agent {number} transcript', {\n name: data.label,\n number: index + 1,\n })}\n onClick={() => onOpenAgent(agent.runId, agent.session)}\n >\n ↗\n </Button>\n ))}\n </div>\n {data.phase?.error && (\n <p\n className={data.phase.status === 'failed' ? 'truncate text-sm text-po-red' : 'truncate text-sm text-po-dim'}\n title={data.phase.error}\n role={data.phase.status === 'failed' ? 'alert' : undefined}\n >\n {data.phase.error}\n </p>\n )}\n {data.kind === 'foreach' && (\n <div className=\"absolute inset-x-3 bottom-3 flex flex-wrap gap-1.5\">\n {cells.map((item) => (\n <Popover key={item.key} defaultOpen={expanded.includes(item.key)}>\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n aria-label={`${item.label}, ${workflowStatusLabel(t, item.status)}`}\n className=\"h-8 min-w-8 rounded-md border bg-po-bg px-2 text-sm font-semibold outline-none focus-visible:ring-2 focus-visible:ring-po-green\"\n style={{ color: statusColor(item.status), borderColor: statusColor(item.status) }}\n >\n {item.index + 1}\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"max-w-sm gap-3 p-3\">\n <h3 className=\"text-base font-semibold text-po-hi\">{item.label}</h3>\n {item.phases.map((phase) => (\n <div key={phase.key} className=\"space-y-1 text-sm\">\n <p className=\"flex items-center gap-2 text-po-text\">\n <Dot tone={statusDot(phase.status)} />\n {phase.label} · {workflowStatusLabel(t, phase.status)}\n {phase.startedAt !== undefined && (\n <>\n {' '}\n ·{' '}\n <WorkflowDuration\n seconds\n startedAt={phase.startedAt}\n endedAt={phase.finishedAt}\n now={now}\n running={phase.status === 'running'}\n />\n </>\n )}\n </p>\n {phase.error && (\n <p className={phase.status === 'failed' ? 'text-po-red' : 'text-po-dim'}>{phase.error}</p>\n )}\n {phase.agents.map((agent, index) => (\n <Button\n key={agent.runId}\n variant=\"link\"\n size=\"sm\"\n onClick={() => onOpenAgent(agent.runId, agent.session)}\n aria-label={t('workflow.ui.openAgentTranscript', 'Open {name} agent {number} transcript', {\n name: phase.label,\n number: index + 1,\n })}\n >\n {' '}\n {t('workflow.ui.openTranscript', 'Open transcript ↗')}{' '}\n </Button>\n ))}\n {!phase.agents.length && (\n <p className=\"text-po-dim\">{t('workflow.ui.noAgentTranscript', 'No agent transcript')}</p>\n )}\n </div>\n ))}\n </PopoverContent>\n </Popover>\n ))}\n {group && group.total > cells.length && (\n <span className=\"self-center text-sm text-po-dim\">\n {t('workflow.ui.moreCount', '+{count} more', { count: group.total - cells.length })}\n </span>\n )}\n </div>\n )}\n </div>\n );\n}\n\nfunction RunGraph({\n run,\n now,\n defaultExpandedKeys = [],\n onOpenAgent,\n}: { run: DynamicWorkflowRun } & Omit<DynamicWorkflowViewProps, 'runs'>) {\n const t = useT();\n const graph = workflowGraph(run, t);\n return (\n <FlowGraph\n nodes={graph.nodes}\n edges={graph.edges.map(({ status, ...edge }) => ({\n ...edge,\n tone: status === 'running' ? 'active' : status === 'pending' ? 'pending' : 'idle',\n }))}\n renderNode={(node: FlowGraphNode<WorkflowGraphNode['data']>) => (\n <WorkflowNode data={node.data} now={now} expanded={defaultExpandedKeys} onOpenAgent={onOpenAgent} />\n )}\n />\n );\n}\n\nexport function DynamicWorkflowView({ runs, connected = true, ...props }: DynamicWorkflowViewProps) {\n const t = useT();\n return (\n <section\n className=\"min-w-0 space-y-4 bg-po-bg p-4 text-po-text\"\n aria-label={t('workflow.ui.dynamicWorkflows', 'Dynamic workflows')}\n >\n {!connected && (\n <p role=\"status\" className=\"text-sm text-po-dim\">\n {' '}\n {t(\n 'workflow.ui.connectionPausedTheseAreTheLastReportedWorkflowStates',\n 'Connection paused. These are the last reported workflow states.',\n )}{' '}\n </p>\n )}\n {!runs.length && (\n <EmptyState\n surface=\"plain\"\n icon={<WorkflowIcon />}\n title={t('workflow.ui.noWorkflowsYet', 'No workflows yet')}\n description={t(\n 'workflow.ui.workflowsAppearHereWhenPoStartsThemYouCanCarryOnWithYourConversation',\n 'Workflows appear here when Po starts them. You can carry on with your conversation.',\n )}\n />\n )}\n {runs.map((run) => (\n <article key={run.key} className=\"overflow-hidden rounded-lg border border-po-border\">\n <header className=\"space-y-1 p-4\">\n <div className=\"flex flex-wrap items-center gap-3\">\n <h2 className=\"break-words text-lg font-semibold text-po-hi\">{run.label}</h2>\n <StatusBadge tone={WORKFLOW_STATUS[run.status].tone}>{workflowStatusLabel(t, run.status)}</StatusBadge>\n </div>\n <p className=\"text-sm text-po-dim\">\n {' '}\n {t('workflow.ui.started', 'Started')}{' '}\n <WorkflowDuration seconds startedAt={run.startedAt} now={props.now} /> {t('workflow.ui.ago', 'ago')}\n </p>\n {run.executionStatus !== run.status && (\n <p className=\"text-sm text-po-dim\">\n {t('workflow.ui.executionState', 'Workflow execution: {state}', {\n state: workflowStatusLabel(t, run.executionStatus),\n })}\n </p>\n )}\n {run.error && (\n <p\n className={run.status === 'failed' ? 'text-sm text-po-red' : 'text-sm text-po-dim'}\n role={run.status === 'failed' ? 'alert' : undefined}\n >\n {run.error}\n </p>\n )}\n </header>\n <RunGraph run={run} {...props} />\n </article>\n ))}\n </section>\n );\n}\n","import { useT } from '@agimon-ai/po-core/web';\nimport type { WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport { ChevronDownIcon, ChevronRightIcon } from '@agimon-ai/po-web-components';\nimport { useStore } from '@tanstack/react-store';\nimport { useEffect, useState } from 'react';\n\nimport { dynamicWorkflowRunsChannel, dynamicWorkflows } from '../_lib/dynamicWorkflowStore';\nimport { stepRunsSummary } from './dynamicWorkflowPresentation';\nimport { DynamicWorkflowView } from './DynamicWorkflowView';\n\n/**\n * Keeps the dynamic workflow runs of workflow step sessions current. Each step session publishes\n * them on its own channel, so the caller holds those sessions' channels while it shows them.\n */\nexport function useHeldDynamicRuns(\n holdSessionChannels: WebPluginSlotProps['holdSessionChannels'],\n stepSessionIds: readonly string[],\n): void {\n const key = stepSessionIds.join('\\n');\n useEffect(() => {\n if (holdSessionChannels === undefined || key === '') return;\n const releases = key.split('\\n').map((stepSessionId) =>\n holdSessionChannels(stepSessionId, (frame) => {\n if (frame.type !== dynamicWorkflowRunsChannel.channel) return;\n const snapshot = dynamicWorkflowRunsChannel.parse(frame.payload);\n if (snapshot !== null) dynamicWorkflowRunsChannel.apply(stepSessionId, snapshot);\n }),\n );\n return () => {\n for (const release of releases) release();\n };\n }, [holdSessionChannels, key]);\n}\n\nfunction useStepRuns(stepSessionId: string) {\n return useStore(dynamicWorkflows.store, (state) => dynamicWorkflows.select(state, stepSessionId)?.runs);\n}\n\n/** The step row's second line in the Workflows tree; nothing when the step's agent never fanned out. */\nexport function StepDynamicRunsNote({ stepSessionId }: { stepSessionId: string }) {\n const t = useT();\n const runs = useStepRuns(stepSessionId);\n if (runs === undefined || runs.length === 0) return null;\n const summary = stepRunsSummary(runs, t);\n return (\n <span data-testid={`step-dynamic-note-${stepSessionId}`} className=\"truncate pl-5 text-sm text-po-dim\">\n {summary.text}\n {summary.failed > 0 && (\n <span className=\"text-po-red\">\n {' '}\n · {summary.failed} {t('workflow.ui.failed.lowercase', 'failed')}\n </span>\n )}\n </span>\n );\n}\n\n/**\n * The dynamic workflows a customRun step's agent started, under that step's transcript. It folds\n * to one summary row so the conversation keeps the room; open, the runs share the panel with it.\n */\nexport function StepDynamicRuns({\n stepSessionId,\n holdSessionChannels,\n openSession,\n}: Pick<WebPluginSlotProps, 'holdSessionChannels' | 'openSession'> & { stepSessionId: string }) {\n const t = useT();\n const runs = useStepRuns(stepSessionId);\n const [open, setOpen] = useState(false);\n useHeldDynamicRuns(holdSessionChannels, [stepSessionId]);\n if (runs === undefined || runs.length === 0) return null;\n const summary = stepRunsSummary(runs, t);\n return (\n <section\n data-testid=\"step-dynamic-runs\"\n aria-label={t('workflow.ui.dynamicWorkflows.lowercase', 'dynamic workflows')}\n className={`flex flex-col border-t border-po-border ${open ? 'min-h-0 flex-1' : 'shrink-0'}`}\n >\n <button\n type=\"button\"\n data-testid=\"step-dynamic-runs-toggle\"\n aria-expanded={open}\n onClick={() => setOpen(!open)}\n className=\"flex w-full shrink-0 cursor-pointer items-center gap-2 rounded px-2 py-2 text-left hover:bg-po-panel\"\n >\n {open ? (\n <ChevronDownIcon className=\"h-2.5 w-2.5 shrink-0 text-po-faint\" />\n ) : (\n <ChevronRightIcon className=\"h-2.5 w-2.5 shrink-0 text-po-faint\" />\n )}\n <span className=\"text-base font-semibold text-po-hi\">\n {t('workflow.ui.dynamicWorkflows', 'Dynamic workflows')}\n </span>\n <span className=\"min-w-0 flex-1 truncate text-sm text-po-dim\">\n {summary.text}\n {summary.failed > 0 && (\n <span className=\"text-po-red\">\n {' '}\n · {summary.failed} {t('workflow.ui.failed.lowercase', 'failed')}\n </span>\n )}\n </span>\n </button>\n {open && (\n <div className=\"min-h-0 flex-1 overflow-y-auto\">\n <DynamicWorkflowView\n runs={runs}\n // ponytail: plugins can only render threads of the tab owner, and the agents live in the\n // step session, so this opens that session; add a cross-session thread view to open one agent.\n onOpenAgent={() => openSession?.(stepSessionId)}\n />\n </div>\n )}\n </section>\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 { useT } from '@agimon-ai/po-core/web';\nimport 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_ACTIVITY_SCOPE,\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 { StepDynamicRuns } from './StepDynamicRuns';\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\nfunction stepTabId(target: StepTabTarget): string {\n return `${TAB_ID_PREFIX}${target.workspace}-${target.runKey}-${target.job}${target.step === undefined ? '' : `-${target.step}`}`.replace(\n /[^\\w-]+/g,\n '-',\n );\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.routeKey ?? run.runKey,\n job,\n ...(step === undefined ? {} : { step }),\n };\n const label = step ?? job;\n const ref = stepSessionRef(run, target);\n return {\n id: stepTabId(target),\n targetSessionId: ref?.id,\n activityScope: STEP_ACTIVITY_SCOPE,\n retainComposer: ref !== undefined && run.stage === 'running' && targetStep(run, target)?.status === 'running',\n label: `${run.displayName} › ${label}`,\n panel: (props: WebPluginSlotProps) => <StepTerminalPanel {...props} target={target} />,\n };\n}\n\n/**\n * A step that ran as its own agent session opens that session, with its own conversation, Activity\n * and Context. A command step has no session, so its terminal opens in a tab here as before.\n */\nexport function openStep(\n run: WorkflowRunView,\n job: string,\n step: string | undefined,\n { openSession, openTransientTab }: Pick<WebPluginSlotProps, 'openSession' | 'openTransientTab'>,\n): void {\n const ref = stepSessionRef(run, {\n workspace: run.workspace,\n runKey: run.routeKey ?? run.runKey,\n job,\n ...(step === undefined ? {} : { step }),\n });\n if (ref !== undefined && openSession !== undefined) openSession(ref.id);\n else openTransientTab(stepTerminalTab(run, job, step));\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-po-hi\">{run?.displayName ?? target.runKey}</span>\n <span className=\"text-xs text-po-faint\">›</span>\n <span className=\"shrink-0 truncate text-base font-semibold text-po-hi\">{target.job}</span>\n {target.step === undefined ? null : (\n <>\n <span className=\"text-xs text-po-faint\">›</span>\n <span className=\"min-w-0 truncate text-base text-po-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 t = useT();\n const { sessionId, target, renderSessionTranscript, setTransientTabSession, holdSessionChannels, openSession } =\n props;\n const runs = useStore(workflows.store, (state) => workflows.select(state, sessionId).runs);\n const run = runs.find(\n (candidate) =>\n candidate.workspace === target.workspace && (candidate.routeKey ?? candidate.runKey) === target.runKey,\n );\n const sessionRef = stepSessionRef(run, target);\n const sessionTarget = sessionRef?.id;\n const running = run?.stage === 'running' && targetStep(run, target)?.status === 'running';\n useEffect(() => {\n setTransientTabSession?.(stepTabId(target), sessionTarget, sessionTarget !== undefined && running);\n }, [setTransientTabSession, target, sessionTarget, running]);\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 {' '}\n {t('workflow.ui.agentSession.lowercase', '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 <StepDynamicRuns\n stepSessionId={sessionRef.id}\n holdSessionChannels={holdSessionChannels}\n openSession={openSession}\n />\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 t = useT();\n const [lines, setLines] = useState<string[]>([]);\n const [capabilities, setCapabilities] = useState<WorkflowTerminalCapabilitiesView>();\n const [ended, setEnded] = useState(false);\n const [closed, setClosed] = useState<string>();\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 // oxlint-disable-next-line react/set-state-in-effect\n setClosed(undefined);\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 setClosed,\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-po-blue/60 bg-po-tint-blue text-po-hi' : ''}\n >\n {held\n ? t('workflow.extra.lower.keyboardYours', 'keyboard yours')\n : t('workflow.extra.lower.watching', '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\n ? t('workflow.extra.lower.releaseKeyboard', 'release keyboard')\n : t('workflow.extra.lower.takeControl', 'take control')}\n </Button>\n ) : null}\n </StepHeader>\n <div\n ref={screenRef}\n data-testid=\"step-terminal-screen\"\n role=\"textbox\"\n aria-label={t('workflow.ui.workflowTerminal', 'Workflow terminal')}\n aria-multiline=\"true\"\n aria-readonly={token === undefined}\n tabIndex={0}\n onKeyDown={onKeyDown}\n className={`min-h-0 flex-1 overflow-y-auto rounded-md border bg-po-deep px-4 py-3 font-mono text-sm leading-tight text-po-text outline-none ${\n held ? 'border-po-blue/60' : 'border-po-border'\n }`}\n >\n {lines.length === 0 ? (\n <span data-testid=\"step-terminal-waiting\" className={`text-sm ${closed ? 'text-po-red' : 'text-po-dim'}`}>\n {closed ??\n (capabilities?.readable === false\n ? (capabilities.reason ?? t('workflow.ui.noTerminalToRead', 'This run has no terminal to read.'))\n : t('workflow.extra.lower.waitingForTheRunToPaint.progress', '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-po-dim\">\n {held\n ? t(\n 'workflow.extra.lower.keysGoToTheRunCtrlCAndCtrlDPassThroughEscReleasesTheKeyboard',\n 'keys go to the run · ctrl-c and ctrl-d pass through · esc releases the keyboard',\n )\n : capabilities?.writable === false\n ? (capabilities.reason ?? t('workflow.ui.cannotTypeIntoRun', 'this run cannot be typed into'))\n : t(\n 'workflow.extra.lower.readOnlyUntilYouTakeControlTheRunKeepsGoingEitherWay',\n 'read-only until you take control · the run keeps going either way',\n )}\n </span>\n <span className=\"min-w-0 flex-1\" />\n {ended ? (\n <span data-testid=\"step-terminal-ended\" className=\"text-sm text-po-dim\">\n {' '}\n {t(\n 'workflow.ui.theRunHasSettledThisIsItsLastScreen.lowercase',\n 'the run has settled; this is its last screen',\n )}{' '}\n </span>\n ) : null}\n {notice === undefined ? null : (\n <span data-testid=\"step-terminal-notice\" className=\"text-sm text-po-yellow\">\n {notice}\n </span>\n )}\n </div>\n </div>\n );\n}\n","import type { WorkflowJobView, WorkflowProgressState, WorkflowRunView } from '../../../../../types/webWorkflows';\n\nexport const STATE_GLYPH: Readonly<Record<WorkflowProgressState, string>> = {\n pending: '○',\n running: '●',\n resumed: '●',\n completed: '✓',\n failed: '✕',\n skipped: '↷',\n pause_requested: '!',\n paused: '!',\n};\n\nexport const ACTIVE_STATES: ReadonlySet<WorkflowProgressState> = new Set([\n 'running',\n 'resumed',\n 'pause_requested',\n 'paused',\n]);\n\nexport interface RunAttention {\n kind: 'error' | 'paused' | 'stale' | 'waiting';\n text: string;\n}\n\nexport function attentionFor(\n run: WorkflowRunView,\n t: (key: string, english: string, vars?: Readonly<Record<string, string | number>>) => string = (\n _key,\n english,\n vars,\n ) => english.replace(/\\{(\\w+)\\}/g, (match, key: string) => String(vars?.[key] ?? match)),\n): RunAttention | undefined {\n // A run parked on the person's approval is a gentle ask: it carries on by itself once they answer.\n if (run.waiting) {\n const step = activeSteps(run)[0]?.step.name ?? run.position?.step;\n return {\n kind: 'waiting',\n text:\n step === undefined\n ? t('workflow.ui.attention.waiting', 'the run is waiting for your approval')\n : t('workflow.ui.attention.stepWaiting', 'step \"{step}\" is waiting for your approval', { step }),\n };\n }\n if (run.stage === 'error') {\n const cause = run.errorMessage ?? t('workflow.ui.attention.error', 'the run ended in the error stage');\n return {\n kind: 'error',\n text:\n run.failedJob === undefined\n ? cause\n : t('workflow.ui.attention.jobFailed', \"job '{job}' failed: {cause}\", { job: run.failedJob, cause }),\n };\n }\n if (run.stale === true) {\n return {\n kind: 'stale',\n text: run.staleReason ?? t('workflow.ui.attention.stale', 'the process that ran this workflow is gone'),\n };\n }\n if (run.executionState === 'paused' || run.executionState === 'pause_requested') {\n return {\n kind: 'paused',\n text: t('workflow.ui.attention.paused', 'the run is paused and will not move until it is resumed'),\n };\n }\n return undefined;\n}\n\nexport function runState(run: WorkflowRunView): string {\n if (run.waiting) return 'waiting';\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 steps moving right now, across every job, so a parallel group reads as one list. */\nexport function 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\n/** The statuses the picker filters by, in the order its status row lists them. */\nexport const RUN_FILTERS = ['all', 'running', 'paused', 'failed', 'done'] as const;\nexport type RunFilter = (typeof RUN_FILTERS)[number];\n\nexport function runFilterOf(run: WorkflowRunView): Exclude<RunFilter, 'all'> {\n if (run.waiting) return 'running';\n if (run.stage === 'error' || run.outcome === 'failed') 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\nexport function runPriority(run: WorkflowRunView): number {\n if (attentionFor(run) !== undefined) return 0;\n if (run.stage === 'running') return 1;\n return 2;\n}\n\nexport function 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\n/** A run worth recovering: it failed, was interrupted, or its process is gone; a parked run resumes by itself. */\nexport function canRecover(run: WorkflowRunView): boolean {\n if (run.waiting) return false;\n return run.stage === 'error' || run.stale === true || run.outcome === 'failed' || run.outcome === 'interrupted';\n}\n\n/**\n * What the cockpit asks the agent when the person picks recover. Recovery takes\n * judgement (a transient cause recovers, a broken workflow does not), so it goes\n * through the agent rather than straight to the engine.\n */\nexport function recoverPrompt(run: WorkflowRunView): string {\n const call = JSON.stringify({ action: 'recover', runKey: run.runKey, workspace: run.workspace });\n return `Recover the workflow run \"${run.displayName}\" (${run.runKey}). Check why it stopped first; if the cause is transient or fixed, call workflow_run ${call}, otherwise tell me what needs fixing.`;\n}\n\n/** Person-facing labels only. Keep raw states for filtering and protocol data. */\nexport function workflowStateLabel(t: (key: string, english: string) => string, state: string): string {\n switch (state) {\n case 'pending':\n return t('workflow.ui.state.pending', 'Pending');\n case 'running':\n return t('workflow.ui.state.running', 'Running');\n case 'resumed':\n return t('workflow.ui.state.resumed', 'Resumed');\n case 'completed':\n return t('workflow.ui.state.completed', 'Completed');\n case 'failed':\n return t('workflow.ui.state.failed', 'Failed');\n case 'skipped':\n return t('workflow.ui.state.skipped', 'Skipped');\n case 'pause_requested':\n return t('workflow.ui.state.pause_requested', 'Pause requested');\n case 'paused':\n return t('workflow.ui.state.paused', 'Paused');\n case 'waiting':\n return t('workflow.ui.state.waiting', 'Waiting');\n case 'success':\n return t('workflow.ui.state.success', 'Success');\n case 'error':\n return t('workflow.ui.state.error', 'Error');\n case 'interrupted':\n return t('workflow.ui.state.interrupted', 'Interrupted');\n case 'stopped':\n return t('workflow.ui.state.stopped', 'Stopped');\n case 'done':\n return t('workflow.ui.state.done', 'Done');\n case 'all':\n return t('workflow.ui.state.all', 'All');\n case 'starting':\n return t('workflow.ui.state.starting', 'Starting');\n case 'stale':\n return t('workflow.ui.state.stale', 'Stale');\n case 'finished':\n return t('workflow.ui.state.finished', 'Finished');\n default:\n return state;\n }\n}\n","import { useT } from '@agimon-ai/po-core/web';\nimport {\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 { type ReactNode, 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';\nimport { workflowStateLabel } from '../_lib/workflowRunPresentation';\nimport {\n RUN_FILTERS,\n type RunFilter,\n runFilterOf,\n runPriority,\n runSearchText,\n runState,\n STATE_GLYPH,\n} from '../_lib/workflowRunPresentation';\nimport { WorkflowDuration } from './WorkflowDuration';\n\nexport const STATE_ICON: Readonly<Record<WorkflowProgressState, { glyph: string; className: string }>> = {\n pending: { glyph: STATE_GLYPH.pending, className: 'text-po-faint' },\n running: { glyph: STATE_GLYPH.running, className: 'text-po-blue' },\n resumed: { glyph: STATE_GLYPH.resumed, className: 'text-po-blue' },\n completed: { glyph: STATE_GLYPH.completed, className: 'text-po-green' },\n failed: { glyph: STATE_GLYPH.failed, className: 'text-po-red' },\n skipped: { glyph: STATE_GLYPH.skipped, className: 'text-po-faint' },\n pause_requested: { glyph: STATE_GLYPH.pause_requested, className: 'text-po-yellow' },\n paused: { glyph: STATE_GLYPH.paused, className: 'text-po-yellow' },\n};\n\nexport function spanDuration(\n startedAt: string | undefined,\n endedAt: string | undefined,\n now: number = Date.now(),\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 function runDot(run: WorkflowRunView): DotTone {\n if (run.waiting) return 'magenta';\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 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 t = useT();\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-po-border bg-po-deep px-2.5', className)}\n >\n <SearchIcon className=\"h-3 w-3 shrink-0 text-po-faint\" />\n <span className=\"min-w-0 flex-1 truncate text-left text-base font-semibold text-po-hi\">\n {selected.displayName}\n </span>\n <span className=\"shrink-0 text-sm font-normal text-po-dim\">\n {runs.length} {t('workflow.ui.workflows.lowercase', 'workflows')}\n </span>\n <ChevronDownIcon className=\"h-3 w-3 shrink-0 text-po-dim\" />\n </Button>\n </PopoverTrigger>\n <PopoverContent\n side=\"bottom\"\n align=\"start\"\n data-testid=\"workflow-picker-popover\"\n className=\"w-[440px] border-po-edge-blue\"\n >\n <PopoverHeader>\n <SectionLabel className=\"text-po-blue\">{t('workflow.ui.workflow', 'Workflow')}</SectionLabel>\n <span className=\"truncate text-sm text-po-dim\">{selected.displayName}</span>\n </PopoverHeader>\n <div className=\"border-b border-po-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={t('workflow.ui.filterWorkflows.lowercase', 'filter workflows…')}\n className=\"w-full px-2 py-1 text-sm\"\n />\n </div>\n <div\n role=\"listbox\"\n aria-label={t('workflow.ui.workflows.lowercase', 'workflows')}\n className=\"flex max-h-[300px] flex-col gap-0.5 overflow-y-auto p-1.5\"\n >\n {shown.length === 0 ? (\n <EmptyState\n size=\"compact\"\n surface=\"plain\"\n icon={<SearchIcon />}\n title={t('workflow.ui.noWorkflowMatches', 'No workflow matches')}\n secondaryAction={{ label: t('workflow.extra.clearFilter', 'Clear filter'), onAction: () => setQuery('') }}\n />\n ) : 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-po-deep focus-visible:bg-po-deep',\n active && 'bg-po-tint-blue hover:brightness-125',\n )}\n >\n <span className=\"w-14 shrink-0 truncate text-sm text-po-dim\">\n {workflowStateLabel(t, runState(run))}\n </span>\n <OptionLabel density=\"compact\" className={active ? 'text-po-blue' : 'text-po-hi'}>\n {run.displayName}\n </OptionLabel>\n <span className=\"max-w-[40%] truncate text-sm text-po-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\">{t('workflow.ui.status.lowercase', '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-po-blue/25 font-semibold text-po-blue hover:bg-po-blue/25')}\n >\n {workflowStateLabel(t, 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-po-deep')}\n >\n <span className={`w-3 shrink-0 text-xs ${icon.className}`}>{icon.glyph}</span>\n <OptionLabel density=\"compact\" className={cn(selected ? 'text-po-hi' : 'text-po-text')}>\n {job.name}\n </OptionLabel>\n <span className=\"shrink-0 text-sm text-po-dim\">\n <WorkflowDuration startedAt={job.startedAt} endedAt={job.endedAt} now={now} />\n </span>\n </OptionRow>\n );\n}\n\nexport function StepRow({\n step,\n now,\n selected,\n onSelect,\n note,\n here = false,\n}: {\n step: WorkflowStepView;\n now?: number;\n selected: boolean;\n onSelect: () => void;\n /** An extra line under the step, such as the dynamic workflows its agent started. */\n note?: ReactNode;\n /** The step session being viewed is this step. */\n here?: boolean;\n}) {\n const t = useT();\n const icon = STATE_ICON[step.status];\n return (\n <button\n type=\"button\"\n disabled={step.status === 'pending'}\n title={`${step.name}: ${workflowStateLabel(t, step.status)}`}\n data-testid={`step-row-${step.name}`}\n data-step-status={step.status}\n data-active={selected}\n data-here={here || undefined}\n aria-current={here ? 'step' : undefined}\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-po-deep disabled:cursor-default',\n selected && 'bg-po-tint-blue ring-1 ring-inset ring-po-blue/40',\n here && 'bg-po-tint-green ring-1 ring-inset ring-po-edge-green',\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-po-red' : 'text-po-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-po-dim\">\n ∥ {step.group}\n </span>\n )}\n {here ? (\n <span className=\"shrink-0 rounded-full bg-po-panel px-2 text-sm font-medium text-po-green\">\n {t('workflow.ui.youAreHere', 'You are here')}\n </span>\n ) : (\n <span className=\"shrink-0 text-sm text-po-dim\">\n {step.status === 'pending' ? (\n workflowStateLabel(t, step.status)\n ) : (\n <WorkflowDuration startedAt={step.startedAt} endedAt={step.endedAt} now={now} />\n )}\n </span>\n )}\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-po-red' : 'text-po-dim')}\n >\n {step.reason}\n </span>\n )}\n {note}\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 t = useT();\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.routeKey ?? 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>\n {t('workflow.ui.delete', 'Delete')} {run.displayName}?\n </DialogTitle>\n </DialogHeader>\n <DialogBody>\n <p className=\"text-sm leading-relaxed text-po-dim\">\n {' '}\n {t(\n 'workflow.ui.thisPermanentlyRemovesTheWorkflowRunIncludingItsLogsAndArtifactsThisActionCannotBeUndone',\n 'This permanently removes the workflow run, including its logs and artifacts. This action cannot be undone.',\n )}{' '}\n </p>\n {error === undefined ? null : (\n <p data-testid=\"delete-workflow-error\" className=\"text-base text-po-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 {' '}\n {t('workflow.ui.cancel.lowercase', '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 {' '}\n {t('workflow.ui.deletePermanently.lowercase', '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 t = useT();\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.routeKey ?? 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-po-border-soft p-1.5\">\n {error === undefined ? null : (\n <span data-testid=\"stop-workflow-error\" className=\"px-1 text-base text-po-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 {' '}\n {t('workflow.ui.stopWorkflow.lowercase', 'stop workflow')}{' '}\n </Button>\n </div>\n );\n}\n","import { t, defineSessionStore, type ContextActionRunContext } from '@agimon-ai/po-core/web';\n\nimport { api } from '../../../../../../generated/client';\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 /** False until the first catalog lands, so an empty list is not shown before it is known. */\n loaded: boolean;\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 loaded: false,\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 void Promise.resolve()\n .then(() => api.session(sessionId).catalog())\n .then(\n (result) => {\n if (result.ok) workflowCatalogChannel.apply(sessionId, result.data);\n else\n catalog.update(sessionId, (current) => ({\n ...current,\n warning:\n result.error || t('workflow.ui.catalogRefreshFailed', 'The workflow catalog could not be refreshed.'),\n }));\n },\n () =>\n catalog.update(sessionId, (current) => ({\n ...current,\n warning: t('workflow.ui.catalogRefreshFailed', 'The workflow catalog could not be refreshed.'),\n })),\n );\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 loaded: true,\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","import { useT } from '@agimon-ai/po-core/web';\nimport type { WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport {\n Button,\n ChevronDownIcon,\n ChevronRightIcon,\n cn,\n Dot,\n EmptyState,\n StatusBadge,\n WorkflowIcon,\n} from '@agimon-ai/po-web-components';\nimport { useStore } from '@tanstack/react-store';\nimport { type ReactNode, useMemo, useState } from 'react';\n\nimport type { WorkflowJobView, WorkflowRunView } from '../../../../../../types/webWorkflows';\nimport { ArtifactsPane, artifactTab } from '../../_components/ArtifactsPane';\nimport { StepDynamicRunsNote, useHeldDynamicRuns } from '../../_components/StepDynamicRuns';\nimport { openStep } from '../../_components/StepTerminalPanel';\nimport { WorkflowDuration } from '../../_components/WorkflowDuration';\nimport {\n DeleteWorkflowDialog,\n runDot,\n STATE_ICON,\n StepRow,\n StopWorkflowButton,\n WorkflowPicker,\n} from '../../_components/WorkflowRunParts';\nimport { openCatalog } from '../../_lib/catalogStore';\nimport { stepPlace } from '../../_lib/stepPlace';\nimport { ownsRun, workflowRunIdentity } from '../../_lib/workflowActivity';\nimport { workflowStateLabel } from '../../_lib/workflowRunPresentation';\nimport { activeSteps, attentionFor, type RunAttention, runState } from '../../_lib/workflowRunPresentation';\nimport { focusRun, removeRun, workflows } from '../../_lib/workflowsStore';\n\nconst STATE_TONE = {\n running: 'info',\n paused: 'running',\n waiting: 'accent',\n failed: 'error',\n success: 'ok',\n} as const;\n\nfunction stateTone(state: string): 'info' | 'running' | 'accent' | 'error' | 'ok' | 'neutral' {\n return state in STATE_TONE ? STATE_TONE[state as keyof typeof STATE_TONE] : 'neutral';\n}\n\n/** How each attention reads: a parked run is the person's gentle ask, rose; only a real failure is red. */\nconst ATTENTION = {\n error: {\n frame: 'border-po-edge-red bg-po-tint-red/40',\n tone: 'error',\n },\n stale: {\n frame: 'border-po-edge-red bg-po-tint-red/40',\n tone: 'error',\n },\n paused: {\n frame: 'border-po-edge-yellow bg-po-tint-yellow/40',\n tone: 'running',\n },\n waiting: {\n frame: 'border-po-edge-magenta bg-po-tint-magenta/40',\n tone: 'accent',\n },\n} as const satisfies Record<RunAttention['kind'], { frame: string; tone: string }>;\n\n/** The workflow step sessions of a run: customRun steps, whose agents can start dynamic workflows. */\nfunction stepSessionIds(run: WorkflowRunView): string[] {\n return run.jobs.flatMap((job) => job.steps.flatMap((step) => (step.ref?.kind === 'session' ? [step.ref.id] : [])));\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-po-hi\">{label}</span>\n <span className=\"min-w-0 flex-1\" />\n {meta === undefined ? null : <span className=\"text-sm text-po-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 t = useT();\n const state = runState(run);\n const where = [run.position?.job, run.position?.step].filter(Boolean).join(' › ');\n return (\n <div data-testid=\"workflow-dock-run\" className=\"flex shrink-0 flex-col gap-1.5 border-b border-po-border px-4 py-3\">\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-po-hi\">\n {run.displayName}\n </span>\n <StatusBadge size=\"xs\" tone={stateTone(state)} data-testid=\"workflow-dock-state\" data-run-state={state}>\n {workflowStateLabel(t, state)}\n </StatusBadge>\n </div>\n <div className=\"flex min-w-0 items-center gap-1.5 text-sm text-po-dim\">\n <span title={where} className=\"min-w-0 flex-1 truncate\">\n {where || (run.stage === 'running' ? t('workflow.extra.lower.starting', 'starting') : run.workflowPath)}\n </span>\n <span className=\"shrink-0\">\n <WorkflowDuration startedAt={run.startedAt} endedAt={run.finishedAt} now={now} />\n </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 t = useT();\n const attention = attentionFor(run, t);\n if (attention === undefined) return null;\n const look = ATTENTION[attention.kind];\n return (\n <div\n data-testid=\"workflow-dock-attention\"\n data-attention={attention.kind}\n className={cn('mx-3 mt-3 flex flex-col gap-1 rounded-md border px-3 py-2', look.frame)}\n >\n <div className=\"flex items-center gap-2\">\n <StatusBadge size=\"xs\" tone={look.tone}>\n {workflowStateLabel(t, attention.kind)}\n </StatusBadge>\n <span className=\"min-w-0 flex-1 text-sm text-po-dim\">\n {attention.kind === 'waiting'\n ? t('workflow.ui.attention.approvalLead', 'for your approval')\n : attention.kind === 'paused'\n ? t('workflow.ui.attention.resumeLead', 'waiting to be resumed')\n : t('workflow.ui.attention.inspectLead', 'needs a look')}\n </span>\n </div>\n <span className=\"break-words text-base text-po-text\">{attention.text}</span>\n <span className=\"text-sm text-po-dim\">\n {attention.kind === 'waiting'\n ? t('workflow.ui.attention.approvalNext', 'it carries on once you answer')\n : attention.kind === 'paused'\n ? t('workflow.ui.attention.resumeNext', 'ask the agent in this conversation to resume it')\n : t('workflow.ui.attention.inspectNext', '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 t = useT();\n const active = activeSteps(run);\n if (active.length === 0) return null;\n return (\n <section data-testid=\"workflow-dock-active\" aria-label={t('workflow.ui.activeSteps.lowercase', 'active steps')}>\n <SectionHeading label={t('workflow.ui.activeNow', '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 // The step a parked run asked from holds still: it waits on the person, it is not moving.\n const tone = run.waiting ? 'magenta' : paused ? 'yellow' : 'blue';\n return (\n <button\n key={`${job}/${step.name}`}\n type=\"button\"\n data-testid={`workflow-dock-active-${step.name}`}\n title={t('workflow.ui.openStepLower', 'open {name}', { name: 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-po-panel\"\n >\n <Dot tone={tone} pulse={tone === 'blue'} />\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"truncate text-base font-semibold text-po-hi\">{step.name}</span>\n <span className=\"truncate text-sm text-po-dim\">\n {job}\n {step.group === undefined ? '' : ` · ∥ ${step.group}`}\n </span>\n </span>\n <span className=\"shrink-0 text-sm text-po-dim\">\n <WorkflowDuration startedAt={step.startedAt} endedAt={step.endedAt} now={now} />\n </span>\n </button>\n );\n })}\n </div>\n </section>\n );\n}\n\nexport function WorkflowJobTree({\n run,\n now,\n onOpenStep,\n initiallyCollapsed = [],\n current,\n}: {\n run: WorkflowRunView;\n now?: number;\n onOpenStep: (job: string, step: string) => void;\n initiallyCollapsed?: readonly string[];\n /** The step a step session is viewing the run from: marked \"You are here\" and never folded away. */\n current?: { job: string; step: string };\n}) {\n const t = useT();\n const [toggled, setToggled] = useState<Readonly<Record<string, boolean>>>({});\n const invocations = (run.children ?? []).flatMap(({ lead, invocations }) =>\n invocations.map((child) => ({ lead, child, name: `${child.job}:${child.invocationId}` })),\n );\n const childNames = new Set(invocations.map(({ name }) => name));\n const roots = run.jobs.filter((job) => !childNames.has(job.name));\n const done = roots.filter((job) => job.status === 'completed' || job.status === 'skipped').length;\n // Reachability is independent of expansion so folding a parent never creates orphan rows.\n const reachable = new Set<string>();\n const visit = (name: string): void => {\n if (reachable.has(name)) return;\n reachable.add(name);\n if (!run.jobs.some((job) => job.name === name)) return;\n invocations.filter(({ lead }) => lead === name).forEach((child) => visit(child.name));\n };\n roots.forEach((job) => visit(job.name));\n const renderJob = (job: WorkflowJobView, path: readonly string[] = [], label = job.name): ReactNode => {\n if (path.includes(job.name))\n return (\n <p key={job.name} className=\"px-2 text-sm text-po-red\">\n {t('workflow.ui.cyclicChildOwnership', 'Cyclic child ownership: {name}', { name: job.name })}\n </p>\n );\n const children = invocations.filter(({ lead }) => lead === job.name);\n const open = toggled[job.name] ?? (current?.job === job.name || !initiallyCollapsed.includes(job.name));\n const icon = STATE_ICON[job.status];\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}: ${workflowStateLabel(t, 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-2 text-left hover:bg-po-panel focus-visible:outline focus-visible:outline-2 focus-visible:outline-po-green\"\n >\n {open ? (\n <ChevronDownIcon className=\"h-3 w-3 shrink-0 text-po-dim\" />\n ) : (\n <ChevronRightIcon className=\"h-3 w-3 shrink-0 text-po-dim\" />\n )}\n <span aria-hidden=\"true\" className={`w-3 shrink-0 ${icon.className}`}>\n {icon.glyph}\n </span>\n <span className=\"min-w-0 flex-1 truncate text-base font-semibold text-po-hi\">{label}</span>\n <span className={job.status === 'failed' ? 'shrink-0 text-sm text-po-red' : 'shrink-0 text-sm text-po-dim'}>\n {workflowStateLabel(t, job.status)}\n </span>\n </button>\n {open ? (\n <div className=\"ml-4 border-l border-po-border-soft pl-1\">\n {job.reason === undefined ? null : (\n <p className={cn('px-2 text-sm', job.status === 'failed' ? 'text-po-red' : 'text-po-dim')}>\n {job.reason}\n </p>\n )}\n {job.steps.map((step) => (\n <StepRow\n key={step.name}\n step={step}\n now={now}\n selected={false}\n here={current?.job === job.name && current.step === step.name}\n onSelect={() => onOpenStep(job.name, step.name)}\n note={step.ref?.kind === 'session' ? <StepDynamicRunsNote stepSessionId={step.ref.id} /> : undefined}\n />\n ))}\n {children.length === 0 ? null : (\n <section aria-label={t('workflow.ui.child.jobsOf', 'Child jobs of {name}', { name: job.name })}>\n <h3 className=\"flex items-center justify-between px-2 pb-1 pt-3 text-sm font-medium text-po-dim\">\n <span>{t('workflow.ui.childJobs', 'Child jobs')}</span>\n <span>{children.length}</span>\n </h3>\n {children.map(({ child, name }, index) => (\n <div key={`${name}/${index}`} data-child-invocation={child.invocationId} title={name}>\n {invocations.filter((record) => record.name === name).length > 1 ? (\n <p className=\"px-2 text-sm text-po-red\">\n {t(\n 'workflow.ui.child.duplicate',\n 'Duplicate child identity: {name}. Recorded parent: {parent}.',\n { name, parent: job.name },\n )}\n </p>\n ) : null}\n {run.jobs\n .filter((candidate) => candidate.name === name)\n .map((recorded) => renderJob(recorded, [...path, job.name], child.job))}\n {!run.jobs.some((candidate) => candidate.name === name) ? (\n <p className=\"px-2 text-sm text-po-dim\">\n {t('workflow.ui.child.noProgress', '{name}: {state}. No progress recorded.', {\n name,\n state: workflowStateLabel(t, child.state),\n })}\n </p>\n ) : null}\n {(child.state === 'failed' || child.state === 'interrupted') &&\n run.jobs.some((recorded) => recorded.name === name && recorded.status !== child.state) ? (\n <p className=\"px-2 text-sm text-po-red\">\n {' '}\n {t('workflow.ui.child.invocation', 'Invocation {name}: {state}.', {\n name,\n state: workflowStateLabel(t, child.state),\n })}\n </p>\n ) : null}\n {child.error === undefined ? null : <p className=\"px-2 text-sm text-po-red\">{child.error}</p>}\n </div>\n ))}\n </section>\n )}\n </div>\n ) : null}\n </div>\n );\n };\n return (\n <section data-testid=\"workflow-dock-jobs\" aria-label={t('workflow.ui.jobs.lowercase', 'jobs')} className=\"py-3\">\n <div className=\"mb-2 flex items-center justify-between px-4\">\n <h2 className=\"text-lg font-semibold text-po-hi\">{t('workflow.ui.jobs', 'Jobs')}</h2>\n <span className=\"text-sm text-po-dim\">\n {done}/{roots.length}\n </span>\n </div>\n {run.jobs.length === 0 && invocations.length === 0 ? (\n <EmptyState\n size=\"compact\"\n surface=\"plain\"\n title={t('workflow.ui.noProgressRecordedYet', 'No progress recorded yet')}\n />\n ) : null}\n <div className=\"px-2\">\n {roots.map((job) => renderJob(job))}\n\n {invocations\n .filter(({ name }) => !reachable.has(name))\n .map(({ child, lead, name }, index) => (\n <div key={`${name}/${index}`}>\n <p className=\"px-2 text-sm text-po-red\">\n {t(\n 'workflow.ui.child.unattached',\n 'Unattached child {name}: parent {parent} is missing or cyclic. State: {state}.',\n { name, parent: lead, state: workflowStateLabel(t, child.state) },\n )}\n </p>\n {run.jobs.filter((job) => job.name === name).map((job) => renderJob(job))}\n {child.error === undefined ? null : <p className=\"px-2 text-sm text-po-red\">{child.error}</p>}\n </div>\n ))}\n {run.childStatusErrors?.length ? (\n <p className=\"px-2 text-sm text-po-dim\">\n {' '}\n {t(\n 'workflow.ui.incompleteChildHierarchyJournalEvidenceIsUnavailableUnmatchedProgressIsRetainedInJobs',\n 'Incomplete child hierarchy: journal evidence is unavailable. Unmatched progress is retained in Jobs.',\n )}{' '}\n </p>\n ) : null}\n {run.childStatusErrors?.map((error, index) => (\n <p key={index} className=\"px-2 text-sm text-po-red\">\n {' '}\n {t('workflow.ui.childJournal', 'Child journal')}\n {error.lead === undefined ? '' : ` (${error.lead})`}: {error.message}\n </p>\n ))}\n </div>\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 * Set when a step session views the run it is a step of: the step is marked \"You are here\" and\n * the run's stop and delete stay with the session that owns it.\n */\n current?: { job: string; step: string };\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 current,\n}: WorkflowDockViewProps) {\n const t = useT();\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 <WorkflowJobTree key={workflowRunIdentity(run)} run={run} now={now} onOpenStep={onOpenStep} current={current} />\n <section data-testid=\"workflow-dock-artifacts\" aria-label={t('workflow.ui.artifacts.lowercase', 'artifacts')}>\n <SectionHeading label={t('workflow.ui.artifacts', 'Artifacts')} />\n <div className=\"px-1\">{artifacts}</div>\n </section>\n </div>\n {current !== undefined ? (\n <p\n data-testid=\"workflow-dock-viewer-note\"\n className=\"shrink-0 border-t border-po-border-soft px-3 py-2 text-sm text-po-dim\"\n >\n {' '}\n {t(\n 'workflow.ui.theWorkflowSessionRunsThisWorkflowSoStoppingOrDeletingItHappensThere',\n 'The workflow session runs this workflow, so stopping or deleting it happens there.',\n )}{' '}\n </p>\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-po-dim\">\n {' '}\n {t(\n 'workflow.ui.thisSessionRunsTheWorkflowRemovingOrRestartingItStopsTheRun.lowercase',\n 'this session runs the workflow; removing or restarting it stops the run',\n )}{' '}\n </p>\n </div>\n ) : (\n <div className=\"flex shrink-0 border-t border-po-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 {' '}\n {t('workflow.ui.deleteRun.lowercase', '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/**\n * The `workflow` dock face: the run this workflow session owns, live from the runs channel. A step's\n * own session owns no run, so it views the run it is a step of, read-only, from where it sits.\n */\nexport function WorkflowDockPanel({\n sessionId,\n openSession,\n openTransientTab,\n holdSessionChannels,\n}: WebPluginSlotProps) {\n const t = useT();\n const reported = useStore(workflows.store, (state) => workflows.select(state, sessionId).runs);\n const parentRuns = useStore(workflows.store, (state) => workflows.select(state, sessionId).parentRuns);\n const focused = useStore(workflows.store, (state) => workflows.select(state, sessionId).focusedRun);\n const owned = useMemo(() => reported.filter((candidate) => ownsRun(candidate, sessionId)), [reported, sessionId]);\n const place = owned.length === 0 ? stepPlace(parentRuns, sessionId) : undefined;\n const runs = place === undefined ? owned : [place.run];\n\n const run = runs.find((candidate) => workflowRunIdentity(candidate) === focused) ?? runs[0];\n // ponytail: holds one channel set per customRun step of the shown run so their rows can say they\n // fanned out; a run with very many agent steps would want a server-side count on the step instead.\n useHeldDynamicRuns(holdSessionChannels, run === undefined ? [] : stepSessionIds(run));\n if (run === undefined) {\n return (\n <EmptyState\n data-testid=\"workflow-dock-empty\"\n icon={<WorkflowIcon />}\n title={t('workflow.ui.thisSessionHasNoWorkflowRun', 'This session has no workflow run')}\n description={t(\n 'workflow.ui.aRunLaunchedFromHereShowsItsJobsStepsAndArtifactsInThisDock',\n 'A run launched from here shows its jobs, steps and artifacts in this dock.',\n )}\n action={{\n label: t('workflow.extra.launchWorkflow', 'Launch workflow'),\n testId: 'workflow-dock-launch',\n onAction: () => {\n if (sessionId !== null) openCatalog(sessionId);\n },\n }}\n />\n );\n }\n // A step views its parent run through the host, which serves any run; the owner's own server is\n // gone once that workflow session stops, and the step's own server never served the run.\n const artifactsSessionId = place === undefined ? sessionId : null;\n\n return (\n <WorkflowDockView\n runs={runs}\n run={run}\n sessionId={sessionId}\n current={place === undefined ? undefined : { job: place.job, step: place.step }}\n onSelectRun={(candidate) => {\n if (sessionId !== null) focusRun(sessionId, workflowRunIdentity(candidate));\n }}\n onOpenStep={(job, step) => openStep(run, job, step, { openSession, openTransientTab })}\n onDeleted={() => {\n if (sessionId !== null) removeRun(sessionId, workflowRunIdentity(run));\n }}\n artifacts={\n <ArtifactsPane\n key={`${workflowRunIdentity(run)}/${artifactsSessionId}`}\n run={run}\n sessionId={artifactsSessionId}\n onOpen={(path) => openTransientTab(artifactTab(run, path, artifactsSessionId))}\n />\n }\n />\n );\n}\n","import { t, defineDockFace } from '@agimon-ai/po-core/web';\nimport { WorkflowIcon } from '@agimon-ai/po-web-components';\n\nimport { stepPlace } from '../../sessions/(frontend)/_lib/stepPlace';\nimport { ownsRun } from '../../sessions/(frontend)/_lib/workflowActivity';\nimport { workflows } from '../../sessions/(frontend)/_lib/workflowsStore';\nimport { WorkflowDockPanel } from '../../sessions/(frontend)/dock/_components/WorkflowDockPanel';\n\nexport default defineDockFace({\n id: 'workflow',\n get label() {\n return t('workflow.ui.workflow', 'Workflow');\n },\n icon: WorkflowIcon,\n order: 20,\n panel: WorkflowDockPanel,\n // Shown in a session that owns a run (a workflow session, or one that ran a workflow itself\n // before), and in a step's own session, which views the run it is a step of.\n visibility: {\n subscribe(listener: () => void) {\n const subscription = workflows.store.subscribe(listener);\n return () => subscription.unsubscribe();\n },\n isVisible(sessionId: string | null) {\n const state = workflows.select(workflows.store.state, sessionId);\n return state.runs.some((run) => ownsRun(run, sessionId)) || stepPlace(state.parentRuns, sessionId) !== undefined;\n },\n },\n});\n","import { useT } from '@agimon-ai/po-core/web';\nimport { Button, WorkflowIcon } from '@agimon-ai/po-web-components';\n\n/**\n * The line above a step session's conversation: which workflow and job it is a step of, and the\n * way back to that run. Without a run to go back to it says so plainly and offers no link.\n */\nexport function StepParentStrip({\n workflow,\n job,\n onBack,\n}: {\n /** Absent when the run this step belonged to is no longer available. */\n workflow?: string;\n job?: string;\n onBack?: () => void;\n}) {\n const t = useT();\n return (\n <div\n data-testid=\"step-parent-strip\"\n className=\"flex min-w-0 items-center gap-2 rounded-lg border border-po-border-soft bg-po-panel/60 px-3 py-1.5\"\n >\n <WorkflowIcon aria-hidden className=\"size-4 shrink-0 text-po-dim\" />\n {workflow === undefined ? (\n <span className=\"min-w-0 flex-1 truncate text-sm text-po-dim\">\n {' '}\n {t(\n 'workflow.ui.stepOfAWorkflowRunThatIsNoLongerAvailable',\n 'Step of a workflow run that is no longer available',\n )}{' '}\n </span>\n ) : (\n <span className=\"min-w-0 flex-1 truncate text-sm text-po-dim\">\n {t('workflow.ui.stepOf', 'Step of')} <span className=\"font-semibold text-po-hi\">{workflow}</span>\n {job === undefined ? null : <> · {job}</>}\n </span>\n )}\n {workflow === undefined || onBack === undefined ? null : (\n <Button\n variant=\"link\"\n size=\"sm\"\n data-testid=\"step-parent-back\"\n onClick={onBack}\n className=\"h-auto shrink-0 px-0 text-po-text\"\n >\n {' '}\n {t('workflow.ui.backToRun', 'Back to run')}{' '}\n </Button>\n )}\n </div>\n );\n}\n","import type { WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport { useStore } from '@tanstack/react-store';\nimport { useEffect } from 'react';\n\nimport { STEP_SESSION_PROVENANCE } from '../../../../../../types/webWorkflows';\nimport { StepParentStrip } from '../../_components/StepParentStrip';\nimport { stepPlace } from '../../_lib/stepPlace';\nimport { fetchStepRuns } from '../../_lib/terminalApi';\nimport { workflowRunIdentity } from '../../_lib/workflowActivity';\nimport { focusRun, workflowRunsChannel, workflows } from '../../_lib/workflowsStore';\n\n/**\n * The conversation strip on a workflow step's own session: the run it is a step of and the way\n * back to that run. Every other session renders nothing.\n *\n * The hub feeds channels only to running sessions, and a step session stops when its step ends.\n * So the strip also holds the workflow session's channel and takes the run from there, storing it\n * as this step's parent run so the Workflow tab can show it too.\n */\nexport function StepParentFill({ sessionId, sessionContext, openSession, holdSessionChannels }: WebPluginSlotProps) {\n const step = sessionId !== null && sessionContext?.provenance === STEP_SESSION_PROVENANCE;\n const parent = step ? sessionContext.parentSessionId : undefined;\n // A read-only window's session is not focused, so its channels are held here while it shows.\n useEffect(() => {\n if (holdSessionChannels === undefined) return;\n const releases = [sessionId, parent].flatMap((id) =>\n !step || id === null || id === undefined\n ? []\n : [\n holdSessionChannels(id, (frame) => {\n if (frame.type !== workflowRunsChannel.channel) return;\n const payload = workflowRunsChannel.parse(frame.payload);\n if (payload !== null) workflowRunsChannel.apply(id, payload);\n }),\n ],\n );\n return () => releases.forEach((release) => release());\n }, [step, sessionId, parent, holdSessionChannels]);\n const parentRuns = useStore(workflows.store, (state) => workflows.select(state, sessionId).parentRuns);\n const ownerRuns = useStore(workflows.store, (state) => workflows.select(state, parent ?? null).runs);\n const fromOwner = step ? stepPlace(ownerRuns, sessionId)?.run : undefined;\n const fromHub = stepPlace(parentRuns, sessionId);\n useEffect(() => {\n if (sessionId === null || fromOwner === undefined || fromHub !== undefined) return;\n workflows.update(sessionId, (current) => ({ ...current, parentRuns: [fromOwner] }));\n }, [sessionId, fromOwner, fromHub]);\n // After a reload neither the step nor its workflow session may be running, so no channel reports.\n // The registry still records the run, so it is asked once while nothing live has a place.\n const missing = step && fromHub === undefined && fromOwner === undefined;\n useEffect(() => {\n if (!missing || sessionId === null) return;\n let current = true;\n fetchStepRuns(sessionId)\n .then((runs) => {\n if (!current || runs === undefined) return;\n // Live data that arrived meanwhile wins: only an empty slot takes the registry's runs.\n workflows.update(sessionId, (state) => (state.parentRuns?.length ? state : { ...state, parentRuns: runs }));\n })\n // An unreachable host leaves the strip waiting for a channel, as it did before this read.\n .catch(() => undefined);\n return () => {\n current = false;\n };\n }, [missing, sessionId]);\n // Until a runs channel first reports, an empty list means \"not yet\", not \"gone\".\n const reported = useStore(\n workflows.store,\n (state) => (sessionId !== null && sessionId in state) || (parent !== undefined && parent in state),\n );\n if (!step) return null;\n const place = fromHub ?? stepPlace(fromOwner === undefined ? [] : [fromOwner], sessionId);\n if (place === undefined) return reported ? <StepParentStrip /> : null;\n const owner = place.run.ownerSessionId ?? sessionContext.parentSessionId;\n return (\n <StepParentStrip\n workflow={place.run.displayName}\n job={place.jobLabel}\n onBack={\n owner === undefined || openSession === undefined\n ? undefined\n : () => {\n // The owner's Workflow tab opens on this run, not whichever it showed last.\n focusRun(owner, workflowRunIdentity(place.run));\n openSession(owner);\n }\n }\n />\n );\n}\n","import { defineFill } from '@agimon-ai/po-core/web';\n\nimport { StepParentFill } from '../../sessions/(frontend)/fill/_components/StepParentFill';\n\nexport default defineFill({ component: StepParentFill });\n","import { t, defineFill } from '@agimon-ai/po-core/web';\nimport { WorkflowIcon } from '@agimon-ai/po-web-components';\n\nexport default defineFill({\n data: {\n version: 1,\n get label() {\n return t('workflow.ui.workflows', 'Workflows');\n },\n source: 'workflow_runs',\n destination: 'workflows',\n icon: WorkflowIcon,\n },\n});\n","import { t } from '@agimon-ai/po-core/web';\nimport { useT } from '@agimon-ai/po-core/web';\nimport type { TransientTab, WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport {\n Button,\n cn,\n Dot,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n EmptyState,\n Input,\n KebabIcon,\n Panel,\n STATUS_EDGE,\n StatusBadge,\n SearchIcon,\n type StatusTone,\n WorkflowIcon,\n} from '@agimon-ai/po-web-components';\nimport { useStore } from '@tanstack/react-store';\nimport { type KeyboardEvent as ReactKeyboardEvent, useMemo, useState } from 'react';\n\nimport type { WorkflowRunView } from '../../../../../types/webWorkflows';\nimport { openCatalog } from '../_lib/catalogStore';\nimport { openRunDirectory, stopWorkflowRun } from '../_lib/terminalApi';\nimport { ownsRun, workflowRunIdentity } from '../_lib/workflowActivity';\nimport { workflowStateLabel } from '../_lib/workflowRunPresentation';\nimport {\n attentionFor,\n RUN_FILTERS,\n type RunFilter,\n runFilterOf,\n runPriority,\n runSearchText,\n runState,\n canRecover,\n recoverPrompt,\n} from '../_lib/workflowRunPresentation';\nimport { focusRun, removeRun, workflows } from '../_lib/workflowsStore';\nimport { openStep } from './StepTerminalPanel';\nimport { WorkflowDuration } from './WorkflowDuration';\nimport { DeleteWorkflowDialog, runDot } from './WorkflowRunParts';\n\n/** One workflows tab per session. */\nexport const WORKFLOWS_TAB_ID = 'workflows-runs';\n\nconst FILTER_TONE: Readonly<Record<Exclude<RunFilter, 'all'>, StatusTone>> = {\n running: 'info',\n paused: 'running',\n failed: 'error',\n done: 'ok',\n};\n\n/** Where a card goes: the run's own workflow session, else the step it is on. */\nfunction primaryOpen(\n run: WorkflowRunView,\n sessionId: string,\n props: Pick<WebPluginSlotProps, 'openSession' | 'openTransientTab'>,\n): void {\n if (!ownsRun(run, sessionId) && run.ownerSessionId !== undefined && props.openSession) {\n props.openSession(run.ownerSessionId);\n return;\n }\n focusRun(sessionId, workflowRunIdentity(run));\n if (run.position !== undefined) openStep(run, run.position.job, run.position.step, props);\n}\n\nfunction RunMenu({\n run,\n sessionId,\n delegated,\n onOpen,\n onDelete,\n onOpenOwner,\n onRecover,\n}: {\n run: WorkflowRunView;\n sessionId: string;\n delegated: boolean;\n onOpen: () => void;\n onDelete: () => void;\n /** Opens the run's own workflow session, where it is paused and resumed; absent when that session is this one. */\n onOpenOwner?: () => void;\n onRecover: () => void;\n}) {\n const t = useT();\n const paused = run.executionState === 'paused' || run.executionState === 'pause_requested';\n const [stopping, setStopping] = useState(false);\n const [error, setError] = useState<string>();\n const runKey = run.routeKey ?? run.runKey;\n const report = (result: { error?: string }): void => {\n if (result.error !== undefined) setError(result.error);\n };\n return (\n <>\n {error ? (\n <span\n role=\"alert\"\n data-testid={`workflow-menu-error-${run.runKey}`}\n title={error}\n className=\"min-w-0 truncate text-sm text-po-red\"\n >\n {error}\n </span>\n ) : null}\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n data-testid={`workflow-menu-${run.runKey}`}\n title={t('workflow.ui.whatThisRunCanDo.lowercase', 'what this run can do')}\n aria-label={t('workflow.ui.workflowActions.lowercase', 'workflow actions')}\n onClick={(event) => event.stopPropagation()}\n >\n <KebabIcon className=\"h-3 w-3\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent data-testid={`workflow-menu-content-${run.runKey}`}>\n <DropdownMenuItem data-testid={`workflow-open-${run.runKey}`} onSelect={onOpen}>\n {delegated\n ? t('workflow.extra.lower.openWorkflowSession', 'open workflow session')\n : run.position\n ? t('workflow.extra.lower.openCurrentStep', 'open current step')\n : t('workflow.extra.lower.showInWorkflowDock', 'show in workflow dock')}\n </DropdownMenuItem>\n <DropdownMenuItem\n data-testid={`workflow-folder-${run.runKey}`}\n onSelect={() => {\n setError(undefined);\n void openRunDirectory(run.workspace, runKey, sessionId).then(report);\n }}\n >\n {' '}\n {t('workflow.ui.openRunFolder.lowercase', 'open run folder')}{' '}\n </DropdownMenuItem>\n {onOpenOwner && run.stage === 'running' ? (\n <DropdownMenuItem data-testid={`workflow-pause-resume-${run.runKey}`} onSelect={onOpenOwner}>\n {paused\n ? t('workflow.extra.lower.resumeInItsSession', 'resume in its session')\n : t('workflow.extra.lower.pauseInItsSession', 'pause in its session')}\n </DropdownMenuItem>\n ) : null}\n {canRecover(run) ? (\n <DropdownMenuItem data-testid={`workflow-recover-${run.runKey}`} onSelect={onRecover}>\n {' '}\n {t('workflow.ui.recoverWithTheAgent.lowercase', 'recover with the agent')}{' '}\n </DropdownMenuItem>\n ) : null}\n <DropdownMenuSeparator />\n {run.stage === 'running' ? (\n <DropdownMenuItem\n variant=\"destructive\"\n data-testid={`workflow-stop-${run.runKey}`}\n disabled={stopping}\n onSelect={() => {\n setStopping(true);\n setError(undefined);\n void stopWorkflowRun(run.workspace, runKey, sessionId).then((result) => {\n if (!('error' in result)) return;\n setStopping(false);\n setError(result.error);\n });\n }}\n >\n {stopping\n ? t('workflow.extra.lower.stopping.progress', 'stopping…')\n : t('workflow.extra.lower.stop', 'stop')}\n </DropdownMenuItem>\n ) : (\n <DropdownMenuItem variant=\"destructive\" data-testid={`workflow-delete-${run.runKey}`} onSelect={onDelete}>\n {' '}\n {t('workflow.ui.delete.lowercase', 'delete')}{' '}\n </DropdownMenuItem>\n )}\n </DropdownMenuContent>\n </DropdownMenu>\n </>\n );\n}\n\nfunction RunCard({\n run,\n sessionId,\n now,\n onOpen,\n onDelete,\n onOpenOwner,\n onRecover,\n}: {\n run: WorkflowRunView;\n sessionId: string;\n now?: number;\n onOpen: () => void;\n onDelete: () => void;\n onOpenOwner?: () => void;\n onRecover: () => void;\n}) {\n const t = useT();\n const filter = runFilterOf(run);\n // A parked run is live but holds still on the person's answer: rose, never pulsing.\n const tone = run.waiting ? 'accent' : FILTER_TONE[filter];\n const state = runState(run);\n const attention = attentionFor(run, t);\n const delegated = !ownsRun(run, sessionId);\n const where = [run.position?.job, run.position?.step].filter(Boolean).join(' › ');\n const onKeyDown = (event: ReactKeyboardEvent<HTMLDivElement>): void => {\n if (event.target !== event.currentTarget) return;\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n onOpen();\n }\n };\n // A div rather than a button: the card carries its own menu, and a button cannot contain another.\n return (\n <Panel\n asChild\n className={cn(\n 'flex min-w-0 flex-col text-left transition-colors outline-none hover:border-po-blue/50 focus-within:border-po-blue',\n STATUS_EDGE[tone],\n )}\n >\n <div data-testid={`workflow-card-${run.runKey}`} data-run-filter={filter}>\n <div\n role=\"button\"\n tabIndex={0}\n data-testid={`workflow-open-card-${run.runKey}`}\n className=\"flex min-w-0 cursor-pointer flex-col gap-1 px-3 pt-2.5 pb-2 outline-none\"\n onClick={onOpen}\n onKeyDown={onKeyDown}\n >\n <div className=\"flex min-w-0 items-center gap-2\">\n <Dot tone={runDot(run)} pulse={filter === 'running' && !run.waiting} />\n <span title={run.displayName} className=\"min-w-0 flex-1 truncate text-base font-semibold text-po-hi\">\n {run.displayName}\n </span>\n <StatusBadge size=\"xs\" tone={tone} data-testid=\"workflow-card-state\">\n {workflowStateLabel(t, state)}\n </StatusBadge>\n </div>\n <div className=\"flex min-w-0 items-center gap-2 text-sm text-po-dim\">\n <span title={where || run.workflowPath} className=\"min-w-0 flex-1 truncate\">\n {where || (run.stage === 'running' ? t('workflow.extra.lower.starting', 'starting') : run.workflowPath)}\n </span>\n <span className=\"shrink-0\">\n <WorkflowDuration startedAt={run.startedAt} endedAt={run.finishedAt} now={now} />\n </span>\n </div>\n {run.prompt ? <span className=\"truncate text-sm text-po-text\">{run.prompt}</span> : null}\n {attention ? (\n <span\n data-testid=\"workflow-card-attention\"\n title={attention.text}\n className={cn(\n 'truncate text-sm',\n attention.kind === 'error'\n ? 'text-po-red'\n : attention.kind === 'waiting'\n ? 'text-po-magenta'\n : 'text-po-yellow',\n )}\n >\n {attention.text}\n </span>\n ) : null}\n </div>\n <div className=\"flex shrink-0 items-center gap-3 border-t border-po-border-soft px-3 py-1.5\">\n <span className=\"truncate text-sm text-po-dim\">\n {run.jobs.length === 0\n ? t('workflow.extra.lower.noProgressYet', 'no progress yet')\n : t('workflow.ui.jobCount', '{done}/{total} jobs', {\n done: run.jobs.filter((job) => job.status === 'completed' || job.status === 'skipped').length,\n total: run.jobs.length,\n })}\n {delegated ? t('workflow.extra.lower.ownSession', ' · own session') : ''}\n {run.worktreeBranch ? ` · ${run.worktreeBranch}` : ''}\n </span>\n <span className=\"min-w-0 flex-1\" />\n <RunMenu\n run={run}\n sessionId={sessionId}\n delegated={delegated}\n onOpen={onOpen}\n onDelete={onDelete}\n onOpenOwner={onOpenOwner}\n onRecover={onRecover}\n />\n </div>\n </div>\n </Panel>\n );\n}\n\n/**\n * The workflows tab: every YAML run this session knows, filterable by status\n * and searchable. Each card's menu opens, stops and deletes through the\n * workflow API; pausing and resuming happen in the run's own session, and\n * recovery is handed to that session's agent.\n */\nexport function WorkflowsPanel({\n sessionId,\n openSession,\n openTransientTab,\n sendSessionFrame,\n now,\n}: WebPluginSlotProps & { now?: number }) {\n const t = useT();\n const runs = useStore(workflows.store, (state) => workflows.select(state, sessionId).runs);\n const [filter, setFilter] = useState<RunFilter>('all');\n const [query, setQuery] = useState('');\n const [deleting, setDeleting] = useState<WorkflowRunView>();\n\n const ordered = useMemo(() => [...runs].sort((left, right) => runPriority(left) - runPriority(right)), [runs]);\n const counts = useMemo(() => {\n const tally: Record<RunFilter, number> = { all: runs.length, running: 0, paused: 0, failed: 0, done: 0 };\n for (const run of runs) tally[runFilterOf(run)] += 1;\n return tally;\n }, [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 const launch = (): void => {\n if (sessionId !== null) openCatalog(sessionId);\n };\n\n return (\n <div data-testid=\"workflows-panel\" className=\"flex min-h-0 min-w-0 flex-1 overflow-hidden\">\n <div className=\"@container flex min-w-0 flex-1 flex-col overflow-y-auto px-3 py-3 sm:px-[26px] sm:py-[18px]\">\n <div className=\"flex flex-wrap items-center gap-x-3 gap-y-2 pb-3\">\n <span className=\"text-lg font-semibold text-po-hi\">\n {t('workflow.ui.workflowsThisSession', 'Workflows · this session')}\n </span>\n <span className=\"min-w-0 flex-1\" />\n {/* With no runs the empty card offers the launch, so the header keeps one primary. */}\n {runs.length === 0 ? null : (\n <Button\n variant=\"primary\"\n data-testid=\"workflows-launch\"\n title={t(\n 'workflow.ui.pickAWorkflowFromTheCatalogAndLaunchIt.lowercase',\n 'pick a workflow from the catalog and launch it',\n )}\n onClick={launch}\n >\n {' '}\n {t('workflow.ui.launchWorkflow', 'Launch workflow')}{' '}\n </Button>\n )}\n </div>\n <div className=\"flex flex-wrap items-center gap-2 pb-3\">\n <div\n role=\"group\"\n aria-label={t('workflow.ui.filterByStatus.lowercase', 'filter by status')}\n className=\"flex flex-wrap gap-1\"\n >\n {RUN_FILTERS.map((candidate) => {\n const current = filter === candidate;\n return (\n <Button\n key={candidate}\n variant=\"ghost\"\n size=\"xs\"\n aria-pressed={current}\n data-testid={`workflows-filter-${candidate}`}\n onClick={() => setFilter(candidate)}\n className={cn(current && 'bg-po-blue/25 font-semibold text-po-blue hover:bg-po-blue/25')}\n >\n {workflowStateLabel(t, candidate)} {counts[candidate]}\n </Button>\n );\n })}\n </div>\n <Input\n aria-label={t('workflow.ui.searchWorkflows.lowercase', 'search workflows')}\n data-testid=\"workflows-search\"\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n placeholder={t('workflow.ui.searchWorkflows.placeholder', 'search workflows…')}\n className=\"ml-auto w-full px-2 py-1 text-sm sm:w-56\"\n />\n </div>\n {runs.length === 0 ? (\n <EmptyState\n data-testid=\"workflows-empty\"\n icon={<WorkflowIcon />}\n title={t('workflow.ui.noWorkflowRunsYet', 'No workflow runs yet')}\n description={t('workflow.ui.runsThisSessionLaunchesAppearHere', 'Runs this session launches appear here.')}\n action={{\n label: t('workflow.ui.launchWorkflow', 'Launch workflow'),\n onAction: launch,\n testId: 'workflows-launch',\n }}\n />\n ) : shown.length === 0 ? (\n <EmptyState\n data-testid=\"workflows-no-match\"\n icon={<SearchIcon />}\n title={t('workflow.ui.noWorkflowMatches', 'No workflow matches')}\n description={t('workflow.ui.tryAnotherNameOrStatus', 'Try another name or status.')}\n secondaryAction={{\n label: t('workflow.ui.clearFilters', 'Clear filters'),\n testId: 'workflows-clear-filters',\n onAction: () => {\n setFilter('all');\n setQuery('');\n },\n }}\n />\n ) : (\n <div data-testid=\"workflows-grid\" className=\"grid grid-cols-1 gap-3 @2xl:grid-cols-2\">\n {sessionId === null\n ? null\n : shown.map((run) => (\n <RunCard\n key={workflowRunIdentity(run)}\n run={run}\n sessionId={sessionId}\n now={now}\n onOpen={() => primaryOpen(run, sessionId, { openSession, openTransientTab })}\n onDelete={() => setDeleting(run)}\n onOpenOwner={\n openSession && run.ownerSessionId !== undefined && !ownsRun(run, sessionId)\n ? () => openSession(run.ownerSessionId!)\n : undefined\n }\n onRecover={() => {\n // The run's own session holds its context, so its agent recovers it.\n const target = run.ownerSessionId ?? sessionId;\n if (target !== sessionId) openSession?.(target);\n sendSessionFrame(target, { type: 'prompt', message: recoverPrompt(run) });\n }}\n />\n ))}\n </div>\n )}\n </div>\n {sessionId !== null && deleting ? (\n <DeleteWorkflowDialog\n run={deleting}\n sessionId={sessionId}\n onClose={() => setDeleting(undefined)}\n onDeleted={() => {\n removeRun(sessionId, workflowRunIdentity(deleting));\n setDeleting(undefined);\n }}\n />\n ) : null}\n </div>\n );\n}\n\n/** The temporary tab the Workflows activity card opens; opening it again only focuses it. */\nexport function workflowsTab(): TransientTab {\n return { id: WORKFLOWS_TAB_ID, label: t('workflow.ui.workflows', 'Workflows'), panel: WorkflowsPanel };\n}\n","import { t } from '@agimon-ai/po-core/web';\nimport type { WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport { useStore } from '@tanstack/react-store';\n\nimport type { DynamicWorkflowRun } from '../../../../../types/dynamicWorkflow';\nimport { dynamicWorkflows } from '../_lib/dynamicWorkflowStore';\nimport { DynamicWorkflowView } from './DynamicWorkflowView';\n\nconst EMPTY_RUNS: DynamicWorkflowRun[] = [];\ntype WorkflowTab = Parameters<WebPluginSlotProps['openTransientTab']>[0];\n\nexport function dynamicWorkflowTab(): WorkflowTab {\n return {\n id: 'dynamic-workflow-runs',\n label: t('workflow.ui.dynamicWorkflows', 'Dynamic workflows'),\n panel: DynamicWorkflowPanel,\n retainComposer: true,\n };\n}\n\nexport function workflowAgentTab(runId: string, session?: true): WorkflowTab {\n return {\n id: `dynamic-workflow-agent-${encodeURIComponent(runId)}`,\n label: t('workflow.ui.agentTranscript', 'Agent transcript'),\n // A dynamicWorkflow.agent child is its own session; a Team run is a thread of this one.\n panel: ({ renderThread, renderSessionTranscript }) => (\n <>{session ? renderSessionTranscript?.(runId) : renderThread(runId)}</>\n ),\n retainComposer: true,\n };\n}\n\nexport function DynamicWorkflowPanel({ sessionId, openTransientTab }: WebPluginSlotProps) {\n const snapshot = useStore(dynamicWorkflows.store, (state) => dynamicWorkflows.select(state, sessionId));\n\n return (\n <DynamicWorkflowView\n runs={snapshot?.runs ?? EMPTY_RUNS}\n onOpenAgent={(runId, session) => {\n if (sessionId !== null) openTransientTab(workflowAgentTab(runId, session));\n }}\n />\n );\n}\n","import { useT } from '@agimon-ai/po-core/web';\nimport 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 { useState } from 'react';\n\nimport { dynamicWorkflowTab } from '../../_components/DynamicWorkflowPanel';\nimport { DynamicWorkflowActivity } from '../../_components/DynamicWorkflowView';\nimport { WorkflowDuration } from '../../_components/WorkflowDuration';\nimport { openCatalog } from '../../_lib/catalogStore';\nimport { dynamicWorkflows } from '../../_lib/dynamicWorkflowStore';\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 TONE_DOT: Readonly<Record<WorkflowActivityTone, DotTone>> = {\n running: 'yellow',\n paused: 'yellow',\n waiting: 'magenta',\n failed: 'red',\n done: 'green',\n skipped: 'muted',\n};\n\nconst TONE_DETAIL: Readonly<Record<WorkflowActivityTone, string>> = {\n running: 'text-po-dim',\n paused: 'text-po-yellow',\n waiting: 'text-po-magenta',\n failed: 'text-po-red',\n done: 'text-po-dim',\n skipped: 'text-po-dim',\n};\n\nconst GROUP_LABEL: Readonly<Record<WorkflowActivityGroupName, string>> = {\n running: 'text-po-yellow',\n failed: 'text-po-red',\n successful: 'text-po-green',\n};\n\n/**\n * The workflows group's body in the activity dock: every YAML run this session\n * started, split into running, failed and successful, then the dynamic\n * workflows its agent started from code mode.\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. The catalog link stays under the runs, so a session with\n * history can still start another.\n */\nexport function WorkflowsActivitySection({ sessionId, openSession, openTransientTab }: WebPluginSlotProps) {\n const t = useT();\n const runs = useStore(workflows.store, (state) => workflows.select(state, sessionId).runs);\n const dynamicRuns = useStore(dynamicWorkflows.store, (state) => dynamicWorkflows.select(state, sessionId)?.runs);\n const [openedAt] = useState(Date.now);\n const [folded, setFolded] = useState<Partial<Record<WorkflowActivityGroupName, boolean>>>({});\n\n const groups = workflowActivityGroups(workflowActivityRows(runs, openedAt, sessionId));\n const launch = (\n <Button\n variant=\"link\"\n size=\"sm\"\n data-testid=\"activity-workflow-launch\"\n className=\"h-auto gap-1 self-start px-0 text-po-green\"\n onClick={() => {\n if (sessionId === null) return;\n openCatalog(sessionId);\n }}\n >\n {' '}\n {t('workflow.ui.launchAWorkflow', 'Launch a workflow')} <ArrowRightIcon aria-hidden className=\"size-3.5\" />\n </Button>\n );\n // Runs the agent started with the dynamicWorkflow namespace; the tab shows their graphs.\n const dynamic =\n dynamicRuns === undefined || dynamicRuns.length === 0 ? null : (\n <div data-testid=\"activity-dynamic-workflows\" className=\"flex flex-col gap-0.5\">\n <span className=\"px-1 py-0.5 text-sm font-semibold text-po-hi\">{t('workflow.ui.dynamic', 'Dynamic')}</span>\n <DynamicWorkflowActivity runs={dynamicRuns} onOpen={() => openTransientTab(dynamicWorkflowTab())} />\n </div>\n );\n if (groups.length === 0 && dynamic === null) {\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-po-dim\">\n {' '}\n {t('workflow.ui.idle', 'Idle')}{' '}\n </p>\n {launch}\n </div>\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={\n delegated\n ? t('workflow.extra.lower.openItsWorkflowSession', 'open its workflow session')\n : t('workflow.extra.lower.showThisRunInTheWorkflowDock', 'show this run in the workflow dock')\n }\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-po-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' || row.tone === 'waiting' ? 'text-po-hi' : 'text-po-dim'\n }`}\n >\n {row.name}\n </span>\n <span className=\"shrink-0 text-sm text-po-dim\">\n <WorkflowDuration startedAt={row.startedAt} endedAt={row.finishedAt} />\n </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-po-panel\"\n >\n {open ? (\n <ChevronDownIcon className=\"h-2.5 w-2.5 text-po-faint\" />\n ) : (\n <ChevronRightIcon className=\"h-2.5 w-2.5 text-po-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-po-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-po-dim\">\n {group.rows\n .slice(0, 2)\n .map((row) => row.name)\n .join(', ')}\n {group.rows.length > 2\n ? t('workflow.ui.andMore', ', and {count} more', { count: group.rows.length - 2 })\n : ''}\n </span>\n )}\n </div>\n );\n })}\n {dynamic}\n <div className=\"pt-1.5 pl-1\">{launch}</div>\n </div>\n );\n}\n","import type { t as Translate, ToolMessageRenderProps, 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 =\n | 'launch_workflow'\n | 'list_workflows'\n | 'workflow_requirements'\n | 'workflow_run'\n | 'workflow_tools'\n | 'scaffold_workflow'\n | 'workflow_delete_definition';\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 'workflow_requirements',\n 'launch_workflow',\n 'workflow_run',\n 'workflow_tools',\n 'workflow_delete_definition',\n 'scaffold_workflow',\n];\n\n/** The card's tool, with any other name read as workflow_run, as the web card always has. */\nexport function workflowToolName(name: string): WorkflowToolName {\n return WORKFLOW_TOOL_NAMES.includes(name as WorkflowToolName) ? (name as WorkflowToolName) : 'workflow_run';\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 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(t: typeof Translate, count: number): ToolLine {\n return line(t('workflow.result.more', '… {count} more', { count }), '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 === 'workflow_requirements') return 'requirements';\n if (toolName === 'launch_workflow') return 'launch';\n if (toolName === 'scaffold_workflow') return 'scaffold';\n if (toolName === 'workflow_delete_definition') return 'delete';\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' || toolName === 'workflow_requirements') return readString(args, 'workflowPath');\n if (toolName === 'scaffold_workflow') return readString(args, 'path');\n if (toolName === 'workflow_delete_definition') {\n const key = readString(args, 'key');\n const source = readString(args, 'source');\n return key && source ? `${source}:${key}` : key;\n }\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 callActionLabel(t: typeof Translate, action: string): string {\n switch (action) {\n case 'list':\n return t('workflow.call.list', 'list');\n case 'requirements':\n return t('workflow.call.requirements', 'requirements');\n case 'launch':\n return t('workflow.call.launch', 'launch');\n case 'scaffold':\n return t('workflow.call.scaffold', 'scaffold');\n case 'delete':\n return t('workflow.ui.delete.lowercase', 'delete');\n case 'run':\n return t('workflow.call.run', 'run');\n case 'status':\n return t('workflow.call.status', 'status');\n case 'tail':\n return t('workflow.call.tail', 'tail');\n case 'follow':\n return t('workflow.call.follow', 'follow');\n case 'open':\n return t('workflow.call.open', 'open');\n case 'pause':\n return t('workflow.call.pause', 'pause');\n case 'resume':\n return t('workflow.call.resume', 'resume');\n case 'stop':\n return t('workflow.call.stop', 'stop');\n case 'recover':\n return t('workflow.call.recover', 'recover');\n case 'recovery-evidence':\n return t('workflow.call.recoveryEvidence', 'recovery-evidence');\n case 'list-failed':\n return t('workflow.call.listFailed', 'list-failed');\n case 'validate':\n return t('workflow.call.validate', 'validate');\n case 'abandon':\n return t('workflow.call.abandon', 'abandon');\n case 'inspect-run':\n return t('workflow.call.inspectRun', 'inspect-run');\n case 'repair-run':\n return t('workflow.call.repairRun', 'repair-run');\n case 'help-repair':\n return t('workflow.call.helpRepair', 'help-repair');\n case 'list-runs':\n return t('workflow.call.listRuns', 'list-runs');\n case 'inspect-definition':\n return t('workflow.call.inspectDefinition', 'inspect-definition');\n default:\n return action;\n }\n}\n\nfunction callMetadata(t: typeof Translate, 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(t('workflow.call.page', 'page {page}', { page }));\n if (pageSize !== undefined) values.push(t('workflow.call.pageSize', '{count}/page', { count: pageSize }));\n if (readString(args, 'filter')) values.push(t('workflow.call.filtered', 'filtered'));\n const count = readStringArray(args, 'tags').length;\n if (count > 0)\n values.push(\n count === 1\n ? t('workflow.call.tags.one', '{count} tag', { count })\n : t('workflow.call.tags.many', '{count} tags', { count }),\n );\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(t('workflow.call.workspace', 'workspace {workspace}', { workspace }));\n if (job) values.push(t('workflow.result.job', 'job {job}', { job }));\n if (runner) values.push(t('workflow.call.runner', 'runner {runner}', { runner }));\n if (readBoolean(args, 'dryRun')) values.push(t('workflow.call.dryRun', 'dry run'));\n if (readString(args, 'prompt')) values.push(t('workflow.call.withPrompt', 'with prompt'));\n if (inputCount > 0)\n values.push(\n inputCount === 1\n ? t('workflow.child.input.one', '{count} input', { count: inputCount })\n : t('workflow.child.input.many', '{count} inputs', { count: inputCount }),\n );\n if (environmentCount > 0) values.push(t('workflow.call.envCount', '{count} env', { count: environmentCount }));\n } else if (toolName === 'scaffold_workflow') {\n if (readBoolean(args, 'force')) values.push(t('workflow.call.overwriteAllowed', 'overwrite allowed'));\n } else {\n if (readString(args, 'expectedRunId')) values.push(t('workflow.call.generationChecked', 'generation checked'));\n if (readString(args, 'reason')) values.push(t('workflow.call.withReason', 'with reason'));\n if (readBoolean(args, 'dryRun')) values.push(t('workflow.call.dryRun', 'dry run'));\n if (readString(args, 'job')) values.push(t('workflow.call.jobOverride', 'job override'));\n if (readString(args, 'runner')) values.push(t('workflow.call.runnerOverride', '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(\n t: typeof Translate,\n toolName: WorkflowToolName,\n args: JsonRecord,\n): WorkflowCallSummary {\n const target = toolTarget(toolName, args);\n return {\n action: callActionLabel(t, toolAction(toolName, args)),\n ...(target === undefined ? {} : { target }),\n metadata: callMetadata(t, 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(t: typeof Translate, 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)\n lines.push(\n line(t('workflow.catalog.tags', 'tags {tags}', { tags: item.tags.join(', ') }), 'dim', { indent: true }),\n );\n return lines;\n}\n\nfunction catalogLines(\n t: typeof Translate,\n result: ToolResultView | null,\n options: WorkflowRenderOptions,\n): ToolLine[] | undefined {\n const catalog = parseCatalog(firstPayload(result));\n if (!catalog) return undefined;\n\n const glyph = catalog.total > 0 ? '✓' : '○';\n const vars = { glyph, count: catalog.total, page: catalog.page, pages: catalog.totalPages };\n const summary = line(\n catalog.total === 1\n ? t('workflow.catalog.summary.one', '{glyph} {count} workflow · page {page}/{pages}', vars)\n : t('workflow.catalog.summary.many', '{glyph} {count} workflows · page {page}/{pages}', vars),\n '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(t, item, options.expanded))];\n const hidden = catalog.workflows.length - shown.length;\n if (hidden > 0) lines.push(hiddenLine(t, 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(line(t('workflow.catalog.availableTags', 'available tags {tags}', { tags }), 'text'));\n }\n if (catalog.directory)\n lines.push(\n line(t('workflow.catalog.directory', 'directory {directory}', { directory: catalog.directory }), 'text'),\n );\n lines.push(line(t('workflow.catalog.pageSize', 'page size {count}', { count: catalog.pageSize }), 'text'));\n }\n return lines;\n}\n\nfunction readWorkflowState(t: typeof Translate, 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')\n return { tone: 'warning', glyph: '!', label: t('workflow.result.interrupted', 'interrupted') };\n if (stage === 'error' || outcome === 'failed')\n return { tone: 'error', glyph: '✗', label: t('workflow.result.failed', 'failed') };\n if (stage === 'completed' && outcome === 'skipped')\n return { tone: 'muted', glyph: '○', label: t('workflow.launch.skipped', 'skipped') };\n if (stage === 'completed')\n return { tone: 'success', glyph: '✓', label: t('workflow.child.state.completed', 'completed') };\n if (executionState === 'paused') return { tone: 'warning', glyph: 'Ⅱ', label: t('workflow.status.paused', 'paused') };\n if (executionState === 'pause_requested')\n return { tone: 'warning', glyph: '◐', label: t('workflow.status.pauseRequested', 'pause requested') };\n if (executionState === 'resume_requested')\n return { tone: 'warning', glyph: '◐', label: t('workflow.status.resumeRequested', 'resume requested') };\n if (stage === 'running') return { tone: 'accent', glyph: '◐', label: t('workflow.child.state.running', 'running') };\n return { tone: 'muted', glyph: '○', label: stage === 'unknown' ? t('workflow.status.unknown', 'unknown') : stage };\n}\n\nfunction currentActivity(t: typeof Translate, 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 ?? t('workflow.launch.fallbackName', 'workflow');\n return line(`[${context}] ${step ?? phase ?? t('workflow.status.currentJob', 'current job')}`, 'text', {\n indent: true,\n });\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(t: typeof Translate, 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(t, record);\n const displayName = readString(record, 'displayName') ?? runKey;\n const workspace = readString(record, 'workspace') ?? t('workflow.status.unknown', 'unknown');\n const lines = [\n line(\n t('workflow.status.retrieved', 'Status retrieved · {name} · workflow: {status}', {\n name: displayName,\n status: state.label,\n }),\n state.tone,\n { bold: true },\n ),\n line(t('workflow.call.workspace', 'workspace {workspace}', { workspace }), 'text'),\n line(t('workflow.status.runKey', 'runKey {runKey}', { runKey }), 'text'),\n ];\n const activity = currentActivity(t, record);\n if (activity) lines.push(activity);\n\n const failure = readString(record, 'errorMessage') ?? readString(record, 'failureReason');\n if (failure) lines.push(line(t('workflow.status.error', 'error {reason}', { reason: failure }), 'error'));\n const staleReason = readString(record, 'staleReason');\n if (staleReason) lines.push(line(t('workflow.status.stale', 'stale {reason}', { reason: staleReason }), 'warning'));\n\n const startedAt = readString(record, 'startedAt');\n const exitCode = readNumber(record, 'exitCode');\n const runner = readString(record, 'runner');\n const conciseMetadata = [\n runner ? t('workflow.call.runner', 'runner {runner}', { runner }) : undefined,\n readBoolean(record, 'dryRun') ? t('workflow.call.dryRun', 'dry run') : undefined,\n exitCode !== undefined ? t('workflow.status.exit', 'exit {code}', { code: exitCode }) : undefined,\n startedAt ? t('workflow.status.startedAt', 'started {time}', { time: 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 [t('workflow.launch.fallbackName', 'workflow'), readString(record, 'workflowPath')],\n [t('workflow.status.workflowId', 'workflow id'), readString(record, 'workflowId')],\n [t('workflow.status.runId', 'run id'), readString(record, 'runId')],\n [t('workflow.status.launcher', 'launcher'), launcherLabel(record)],\n [t('workflow.status.job', 'job'), readString(record, 'job')],\n [t('workflow.status.outcome', 'outcome'), readString(record, 'effectiveOutcome') ?? readString(record, 'outcome')],\n [t('workflow.status.finished', 'finished'), finishedAt ? statusTimestamp(finishedAt) : undefined],\n ['pid', readNumber(record, 'pid')?.toString()],\n [t('workflow.status.repair', 'repair'), repairId ? `#${repairId}` : undefined],\n [\n t('workflow.status.worktree', 'worktree'),\n readString(record, 'worktreeBranch') ?? readString(record, 'worktreePath'),\n ],\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(line(t('workflow.status.jobLine', 'job {name} · {status}', { name, status }), 'text'));\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)\n lines.push(\n line(\n t('workflow.status.stepLine', 'step {name} · {status}', { name: stepName, status: stepStatus }),\n 'text',\n { indent: true },\n ),\n );\n }\n }\n }\n return lines;\n}\n\nfunction statusLines(\n t: typeof Translate,\n result: ToolResultView | null,\n options: WorkflowRenderOptions,\n): ToolLine[] | undefined {\n const payload = firstPayload(result);\n if (!payload) return undefined;\n return workflowRecordLines(t, 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 t: typeof Translate,\n action: 'pause' | 'resume' | 'stop',\n args: JsonRecord,\n result: ToolResultView | null,\n options: WorkflowRenderOptions,\n): ToolLine[] {\n const payload = firstPayload(result);\n const runKey = targetScope(args) ?? readString(payload, 'runKey');\n const payloadWorkspace = readString(payload, 'workspace');\n const fallback = t('workflow.launch.fallbackName', 'workflow');\n const scope =\n payloadWorkspace && !runKey?.includes('/') ? `${payloadWorkspace}/${runKey ?? fallback}` : (runKey ?? fallback);\n const lines = [\n line(\n t('workflow.control.requested', '◐ {action} requested · {scope}', { action: callActionLabel(t, action), scope }),\n 'warning',\n { bold: true },\n ),\n ];\n const requestedAt = nestedRequestedAt(payload);\n if (requestedAt)\n lines.push(\n line(t('workflow.control.requestedAt', 'requested {time}', { time: statusTimestamp(requestedAt) }), 'text'),\n );\n if (options.expanded)\n lines.push(line(t('workflow.control.verify', '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(\n t: typeof Translate,\n text: string,\n args: JsonRecord,\n): { 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 ?? (path ? workflowNameFromPath(path) : t('workflow.launch.fallbackName', 'workflow'));\n const scope = runKey\n ? workspace\n ? `${workspace}/${runKey}`\n : runKey\n : (workspace ?? path ?? t('workflow.launch.fallbackName', 'workflow'));\n\n if (/Workflow completed successfully/iu.test(text)) {\n return {\n name,\n scope,\n state: { tone: 'success', glyph: '✓', label: t('workflow.child.state.completed', 'completed') },\n };\n }\n if (/Workflow skipped/iu.test(text)) {\n return { name, scope, state: { tone: 'muted', glyph: '○', label: t('workflow.launch.skipped', 'skipped') } };\n }\n if (/no run was registered/iu.test(text)) {\n return {\n name,\n scope,\n state: { tone: 'warning', glyph: '◐', label: t('workflow.launch.runKeyPending', 'starting · run key pending') },\n };\n }\n return {\n name,\n scope,\n state: {\n tone: 'accent',\n glyph: '◐',\n label: runKey ? t('workflow.launch.started', 'started') : t('workflow.launch.accepted', 'launch accepted'),\n },\n };\n}\n\nfunction launchLines(\n t: typeof Translate,\n args: JsonRecord,\n result: ToolResultView | null,\n options: WorkflowRenderOptions,\n): ToolLine[] {\n const summary = launchSummary(t, textBlocks(result).join('\\n'), 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 job = readString(args, 'job');\n const runner = readString(args, 'runner');\n const metadata = [\n job ? t('workflow.result.job', 'job {job}', { job }) : undefined,\n runner ? t('workflow.call.runner', 'runner {runner}', { runner }) : undefined,\n readBoolean(args, 'dryRun') ? t('workflow.call.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 t: typeof Translate,\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(t, record, options.expanded) : undefined;\n const evidenceSections = sections.filter((section) => section.name !== 'run.json');\n const scope = targetScope(args) ?? t('workflow.launch.fallbackName', 'workflow');\n const lines = recordLines ?? [\n line(t('workflow.control.evidence', '✓ recovery evidence · {scope}', { scope }), 'success', { bold: true }),\n ];\n const names = evidenceSections.map((section) => section.name);\n lines.push(\n names.length > 0\n ? line(t('workflow.control.evidenceFiles', 'evidence {files}', { files: names.join(', ') }), 'text')\n : line(t('workflow.control.noEvidenceFiles', '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 t: typeof Translate,\n action: 'follow' | 'open' | 'recover' | 'tail',\n args: JsonRecord,\n result: ToolResultView | null,\n options: WorkflowRenderOptions,\n): ToolLine[] {\n const scope = targetScope(args) ?? t('workflow.launch.fallbackName', 'workflow');\n const label = {\n follow: t('workflow.control.following', 'following output'),\n open: t('workflow.control.opened', 'launcher opened'),\n recover: readBoolean(args, 'dryRun')\n ? t('workflow.control.dryRunFinished', 'recovery dry run finished')\n : t('workflow.control.recoveryAccepted', 'recovery accepted'),\n tail: t('workflow.control.tailChecked', 'launcher output checked'),\n }[action];\n const lines = [\n line(`${action === 'recover' ? '◐' : '✓'} ${label} · ${scope}`, action === 'recover' ? 'accent' : 'success', {\n bold: true,\n }),\n ];\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 t: typeof Translate,\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 label =\n toolName === 'workflow_run' && action === 'status'\n ? t('workflow.result.statusLookupFailed', 'Status lookup failed')\n : t('workflow.result.actionFailed', '{action} failed', { action: callActionLabel(t, action) });\n const lines = [\n line(`✗ ${label}${target ? ` · ${target}` : ''}`, 'error', { bold: true }),\n ...(shown.length > 0\n ? shown.map((entry) => line(entry, 'text'))\n : [line(t('workflow.result.unknownError', 'Unknown workflow error'), 'error')]),\n ];\n const hidden = details.length - shown.length;\n if (hidden > 0) lines.push(hiddenLine(t, hidden));\n return lines;\n}\n\nfunction partialLines(\n t: typeof Translate,\n toolName: WorkflowToolName,\n args: JsonRecord,\n result: ToolResultView | null,\n): 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(`◐ ${callActionLabel(t, action)}${target ? ` · ${target}` : ''}`, 'accent', { bold: true })];\n if (hidden > 0) lines.push(line(t('workflow.result.earlier', '… {count} earlier', { count: hidden }), 'dim'));\n lines.push(...shown.map((entry) => line(entry, 'text')));\n return lines;\n}\n\nfunction fallbackLines(t: typeof Translate, result: ToolResultView | null, options: WorkflowRenderOptions): ToolLine[] {\n const details = detailLines(result);\n if (details.length === 0) return [line(t('workflow.result.noOutput', '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(t, 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 t: typeof Translate,\n toolName: WorkflowToolName,\n args: JsonRecord,\n result: ToolResultView | null,\n options: WorkflowRenderOptions,\n): ToolLine[] {\n if (options.isPartial) return partialLines(t, toolName, args, result);\n if (options.isError) return failureLines(t, toolName, args, result, options);\n\n if (toolName === 'list_workflows') return catalogLines(t, result, options) ?? fallbackLines(t, result, options);\n if (toolName === 'launch_workflow') return launchLines(t, args, result, options);\n\n const action = readString(args, 'action');\n if (action === 'status') return statusLines(t, result, options) ?? fallbackLines(t, result, options);\n if (action === 'pause' || action === 'resume' || action === 'stop')\n return controlLines(t, action, args, result, options);\n if (action === 'recovery-evidence') return recoveryEvidenceLines(t, args, result, options);\n if (action === 'follow' || action === 'open' || action === 'recover' || action === 'tail') {\n return simpleActionLines(t, action, args, result, options);\n }\n return fallbackLines(t, result, options);\n}\n\n/**\n * The reason a failed call gives, for a card that shows only the reason: the\n * `{ error }` payload the runtime answers a failed operation with, or the plain\n * text a launch failure carries.\n */\nexport function workflowFailureReason(t: typeof Translate, result: ToolResultView | null, output = ''): string {\n const text = (textBlocks(result).join('\\n') || output).trim();\n const error = readString(parseJsonRecord(text), 'error');\n if (error) return error;\n return text || t('workflow.result.unknownError', 'Unknown workflow error');\n}\n\n/** One labelled figure of a structured result. */\nexport interface WorkflowFact {\n label: string;\n value: string;\n}\n\n/** One row of a compact list: a title, a quiet detail, and an optional status chip. */\nexport interface WorkflowRow {\n key: string;\n title: string;\n detail?: string;\n chip?: { label: string; tone: 'blue' | 'green' | 'yellow' | 'red' | 'neutral' };\n}\n\n/**\n * A JSON result the toned lines have no dedicated shape for, laid out instead\n * of printed: the failed-run summaries `workflow_tools list-failed` answers\n * with, or any other record as its scalar figures and list counts.\n */\nexport interface WorkflowStructuredView {\n headline: string;\n facts: WorkflowFact[];\n rows: WorkflowRow[];\n note?: string;\n}\n\nfunction parseJsonValue(text: string): unknown {\n try {\n return JSON.parse(text);\n } catch {\n // Plain text is not a structured result; the lines draw it.\n return undefined;\n }\n}\n\nfunction failedRunsView(t: typeof Translate, payload: unknown): WorkflowStructuredView | undefined {\n if (!Array.isArray(payload)) return undefined;\n const rows = payload.flatMap((value): WorkflowRow[] => {\n const record = asRecord(value);\n const runKey = readString(record, 'runKey');\n if (!runKey) return [];\n const workspace = readString(record, 'workspace');\n const failedJob = readString(record, 'failedJob');\n const updatedAt = readString(record, 'updatedAt');\n const outcome = readString(record, 'outcome') ?? 'failed';\n const detail = [\n workspace ? `${workspace}/${runKey}` : runKey,\n failedJob ? t('workflow.result.job', 'job {job}', { job: failedJob }) : undefined,\n updatedAt ? statusTimestamp(updatedAt) : undefined,\n ].filter((entry): entry is string => !!entry);\n return [\n {\n key: `${workspace ?? ''}/${runKey}`,\n title: readString(record, 'displayName') ?? runKey,\n detail: detail.join(' · '),\n chip: {\n label:\n outcome === 'interrupted'\n ? t('workflow.result.interrupted', 'interrupted')\n : outcome === 'failed'\n ? t('workflow.result.failed', 'failed')\n : outcome,\n tone: outcome === 'interrupted' ? 'yellow' : 'red',\n },\n },\n ];\n });\n if (rows.length !== payload.length) return undefined;\n return {\n headline:\n rows.length === 0\n ? t('workflow.result.noFailedRuns', 'No failed runs')\n : rows.length === 1\n ? t('workflow.result.failedRuns.one', '{count} failed run', { count: rows.length })\n : t('workflow.result.failedRuns.many', '{count} failed runs', { count: rows.length }),\n facts: [],\n rows,\n ...(rows.length > 0 ? { note: t('workflow.result.recoveryAdvice', 'Read recovery-evidence before recover.') } : {}),\n };\n}\n\nfunction scalarText(t: typeof Translate, value: unknown): string | undefined {\n if (typeof value === 'string') return inlineText(value) || undefined;\n if (typeof value === 'number' && Number.isFinite(value)) return String(value);\n if (typeof value === 'boolean') return value ? t('workflow.result.yes', 'yes') : t('workflow.result.no', 'no');\n return undefined;\n}\n\n/** Any JSON result as its scalar figures and list counts, or a list of rows for an array. */\nexport function workflowGenericView(t: typeof Translate, payload: unknown): WorkflowStructuredView {\n if (Array.isArray(payload)) {\n const rows = payload.map((value, index): WorkflowRow => {\n const record = asRecord(value);\n const scalars = Object.values(record ?? {}).flatMap((entry) => scalarText(t, entry) ?? []);\n const title =\n scalarText(t, value) ?? scalars[0] ?? t('workflow.result.itemIndex', 'item {index}', { index: index + 1 });\n const rest = scalars.slice(1).join(' · ');\n return { key: String(index), title, ...(rest ? { detail: rest } : {}) };\n });\n return { headline: itemCount(t, rows.length), facts: [], rows };\n }\n const record = asRecord(payload) ?? {};\n const facts = Object.entries(record).flatMap(([label, value]): WorkflowFact[] => {\n const scalar = scalarText(t, value);\n if (scalar !== undefined) return [{ label, value: scalar }];\n if (Array.isArray(value)) return [{ label, value: itemCount(t, value.length) }];\n const nested = asRecord(value);\n if (nested) {\n const count = Object.keys(nested).length;\n return [\n {\n label,\n value:\n count === 1\n ? t('workflow.result.fields.one', '{count} field', { count })\n : t('workflow.result.fields.many', '{count} fields', { count }),\n },\n ];\n }\n return [];\n });\n return {\n headline:\n facts.length === 0 ? t('workflow.result.noDetails', 'No details returned') : t('workflow.result.title', 'Result'),\n facts,\n rows: [],\n };\n}\n\nfunction itemCount(t: typeof Translate, count: number): string {\n return count === 1\n ? t('workflow.result.items.one', '{count} item', { count })\n : t('workflow.result.items.many', '{count} items', { count });\n}\n/**\n * The laid-out form of a JSON result the toned lines would otherwise print\n * as raw text, or undefined when the lines already parse it (the catalog, a\n * run record, a control request) or the result is plain text.\n */\nexport function workflowStructuredView(\n t: typeof Translate,\n toolName: WorkflowToolName,\n args: JsonRecord,\n result: ToolResultView | null,\n): WorkflowStructuredView | undefined {\n const text = textBlocks(result).join('\\n').trim();\n if (!text.startsWith('{') && !text.startsWith('[')) return undefined;\n const payload = parseJsonValue(text);\n if (payload === undefined) return undefined;\n const action = readString(args, 'action');\n if (toolName === 'workflow_tools' && action === 'list-failed')\n return failedRunsView(t, payload) ?? workflowGenericView(t, payload);\n const record = asRecord(payload);\n if (toolName === 'list_workflows' && parseCatalog(record)) return undefined;\n if (toolName === 'launch_workflow') return undefined;\n if (action === 'status' && readString(record, 'runKey') && readString(record, 'stage')) return undefined;\n if (action === 'pause' || action === 'resume' || action === 'stop') return undefined;\n return workflowGenericView(t, payload);\n}\n\n/** A launched workflow is the one workflow call that reads as news; lookups and run controls stay compact. */\nexport function workflowActivity(\n t: typeof Translate,\n {\n toolName,\n args,\n result,\n running,\n isError,\n }: Pick<ToolMessageRenderProps, 'toolName' | 'args' | 'result' | 'running' | 'isError'>,\n): string[] {\n if (isError || toolName !== 'launch_workflow') return [];\n const summary = launchSummary(t, textBlocks(result).join('\\n'), args);\n return [\n running\n ? t('workflow.launch.activityRunning', 'Launching workflow {name}', { name: summary.name })\n : t('workflow.launch.activitySettled', 'Workflow {name}: {status}', {\n name: summary.name,\n status: summary.state.label,\n }),\n ];\n}\n","import { useT, type ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport {\n Badge,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageLines,\n SectionLabel,\n toolTone,\n} from '@agimon-ai/po-web-components';\n\nimport {\n type WorkflowStructuredView,\n workflowCallSummary,\n workflowFailureReason,\n workflowResultLines,\n workflowStructuredView,\n workflowToolName,\n} from '../_lib/workflowToolRender';\n\n/** The tools whose failure answers with an `{ error }` payload, shown as the reason alone. */\nconst REASON_ONLY_FAILURES = new Set(['list_workflows', 'workflow_run', 'workflow_tools']);\n\n/** A structured result laid out: the key figure, then (expanded) labelled figures, rows with chips, and a quiet note. */\nfunction WorkflowStructured({ view, expanded }: { view: WorkflowStructuredView; expanded: boolean }) {\n return (\n <div className=\"flex flex-col gap-3\">\n <span className=\"font-semibold text-po-hi\">{view.headline}</span>\n {expanded && view.facts.length > 0 ? (\n <dl className=\"flex flex-wrap gap-x-6 gap-y-2\">\n {view.facts.map((fact) => (\n <div key={fact.label} className=\"flex min-w-0 flex-col gap-0.5\">\n <dt>\n <SectionLabel>{fact.label}</SectionLabel>\n </dt>\n <dd className=\"truncate font-mono text-sm text-po-text\">{fact.value}</dd>\n </div>\n ))}\n </dl>\n ) : null}\n {expanded && view.rows.length > 0 ? (\n <ul className=\"flex flex-col gap-2\">\n {view.rows.map((row) => (\n <li key={row.key} className=\"flex min-w-0 items-center gap-3\">\n <span className=\"shrink-0 text-po-text\">{row.title}</span>\n {row.detail !== undefined ? (\n <span className=\"min-w-0 flex-1 truncate text-sm text-po-faint\">{row.detail}</span>\n ) : (\n <span className=\"flex-1\" />\n )}\n {row.chip !== undefined ? (\n <Badge tone={row.chip.tone} size=\"xs\" className=\"shrink-0\">\n {row.chip.label}\n </Badge>\n ) : null}\n </li>\n ))}\n </ul>\n ) : null}\n {expanded && view.note !== undefined ? <span className=\"text-sm text-po-faint\">{view.note}</span> : null}\n </div>\n );\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. A JSON result with no layout\n * of its own (the failed-run list, any other structured payload) is laid out\n * from the same view model the native card uses rather than printed, and a\n * failed call answering with an `{ error }` payload shows only its reason.\n */\nexport function WorkflowToolMessage({ toolName, args, result, output, running, isError }: ToolMessageRenderProps) {\n const t = useT();\n const name = workflowToolName(toolName);\n const summary = workflowCallSummary(t, name, args);\n const deleting = name === 'workflow_delete_definition';\n // One line: the action stays whole, the target and flags truncate together after it.\n const detail = [summary.target, ...summary.metadata].filter((value): value is string => value !== undefined);\n const reasonOnly = isError && !running && REASON_ONLY_FAILURES.has(name);\n // The view model decides, as on native: shapes with their own lines return undefined.\n const structured = running || isError ? undefined : workflowStructuredView(t, name, args, result);\n const collapsed = workflowResultLines(t, name, args, result, { expanded: false, isError, isPartial: running });\n const full = workflowResultLines(t, name, args, result, { expanded: true, isError, isPartial: running });\n const expandable = reasonOnly\n ? false\n : structured !== undefined\n ? structured.facts.length + structured.rows.length > 0 || structured.note !== undefined\n : full.length > collapsed.length;\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable={expandable}>\n {({ expanded }) => (\n <>\n <MessageItemHeader title={deleting ? t('workflow.ui.delete', 'Delete') : toolName}>\n <span data-testid={`tool-call-${toolName}`} className=\"flex min-w-0 flex-1 items-center gap-2\">\n {!deleting && <span className=\"shrink-0 font-semibold text-po-hi\">{summary.action}</span>}\n {detail.length > 0 ? <span className=\"min-w-0 truncate text-po-dim\">{detail.join(' · ')}</span> : null}\n </span>\n </MessageItemHeader>\n {reasonOnly ? (\n <MessageItemBody data-testid={`tool-result-${toolName}`}>\n <p className=\"whitespace-pre-wrap break-words text-po-red\">{workflowFailureReason(t, result, output)}</p>\n </MessageItemBody>\n ) : structured !== undefined ? (\n <MessageItemBody data-testid={`tool-result-${toolName}`}>\n <WorkflowStructured view={structured} expanded={expanded} />\n </MessageItemBody>\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 { t, type WebPluginDefinition } from '@agimon-ai/po-core/web';\nimport { WorkflowIcon } from '@agimon-ai/po-web-components';\n\nimport { workflowsTab } from '../_components/WorkflowsPanel';\nimport { WorkflowsActivitySection } from '../fill/_components/WorkflowsActivitySection';\nimport { WorkflowToolMessage } from '../tool/_components/WorkflowToolMessage';\nimport { workflowActivity } from '../tool/_lib/workflowToolRender';\nimport { openCatalog, openWorkflowCatalogForContext, workflowCatalogChannel } from './catalogStore';\nimport { dynamicWorkflows } from './dynamicWorkflowStore';\nimport { workflowRunsChannel, workflows } from './workflowsStore';\nconst WORKFLOWS_GROUP = {\n key: 'w',\n get label() {\n return t('workflow.ui.workflows.lowercase', 'workflows');\n },\n get detail() {\n return t('workflow.ui.multiStepRuns', 'multi-step agent runs');\n },\n};\n/** The group lights up while a YAML run or a dynamic workflow of this session is running. */\nconst workflowActivitySource = {\n subscribe(listener: () => void) {\n const runs = workflows.store.subscribe(listener);\n const dynamic = dynamicWorkflows.store.subscribe(listener);\n return () => {\n runs.unsubscribe();\n dynamic.unsubscribe();\n };\n },\n isActive(sessionId: string | null) {\n return (\n workflows.select(workflows.store.state, sessionId).runs.some((run) => run.stage === 'running') ||\n (dynamicWorkflows.select(dynamicWorkflows.store.state, sessionId)?.runs.some((run) => run.status === 'running') ??\n false)\n );\n },\n};\n\nexport default {\n // No permanent tab: the group's heading opens the temporary Workflows tab, a\n // delegated run lives in its own workflow session, and the catalog opens over\n // whatever the session shows.\n channels: [workflowRunsChannel, workflowCatalogChannel],\n contextActions: [\n {\n id: 'launch-workflow',\n get label() {\n return t('workflow.ui.launchWorkflow', 'Launch workflow');\n },\n get detail() {\n return t('workflow.ui.launchDetail', 'Choose a workflow, review its inputs, then launch it.');\n },\n kinds: ['work-item'],\n order: 20,\n run: (context) => openWorkflowCatalogForContext(context),\n },\n ],\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 transientTab: workflowsTab,\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 {\n tools: [\n 'list_workflows',\n 'workflow_requirements',\n 'launch_workflow',\n 'workflow_run',\n 'workflow_tools',\n 'workflow_delete_definition',\n 'scaffold_workflow',\n ],\n message: WorkflowToolMessage,\n activity: (props) => workflowActivity(t, props),\n },\n ],\n // SPC w l opens the catalog. 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: 'po-workflow.catalog',\n path: [\n WORKFLOWS_GROUP,\n {\n key: 'l',\n get label() {\n return t('workflow.ui.launch.lowercase', 'launch');\n },\n get detail() {\n return t('workflow.ui.pickAndLaunch', 'pick a workflow and launch it');\n },\n },\n ],\n run: (context) => {\n if (context.sessionId !== null) openCatalog(context.sessionId);\n },\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({\n ...legacy.activityGroups![0]!,\n label: (t) => t('workflow.activityGroup.label', 'Workflows'),\n});\n","import { defineChannelFile } from '@agimon-ai/po-core/web';\n\nimport { dynamicWorkflowRunsChannel } from '../_lib/dynamicWorkflowStore';\n\nexport default defineChannelFile(dynamicWorkflowRunsChannel);\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 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';\nexport const PROFILE_KEY = 'profile';\n/** Reserved key prefix: `assign.<role>=<stable profile ref>`. */\nexport const ASSIGN_PREFIX = 'assign.';\n\nexport interface WorkflowLaunchRequest {\n workflow: string;\n runner?: string;\n command?: string;\n choice?: string;\n profile?: string;\n /** Exact role to stable profile reference pairs. */\n assignments?: Record<string, 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 ...reservedPair(PROFILE_KEY, request.profile),\n ...Object.entries(request.assignments ?? {}).flatMap(([role, ref]) => reservedPair(`${ASSIGN_PREFIX}${role}`, ref)),\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 { useT } from '@agimon-ai/po-core/web';\nimport type { SessionFrameSender } from '@agimon-ai/po-core/web';\nimport {\n Button,\n Dialog,\n DialogBody,\n DialogContent,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n Textarea,\n} from '@agimon-ai/po-web-components';\nimport { useId, useState } from 'react';\n\nimport type { WorkflowCatalogEntryView } from '../../../../../types/webWorkflows';\nimport { initialInputs, initialRunner, workflowLaunchLine } from '../_lib/launchLine';\nimport { requestLaunch } from '../_lib/workflowsStore';\n\n/** The workflow session collects any missing workflow-specific inputs before execution. */\nexport function LaunchWorkflowDialog({\n sessionId,\n workflow,\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 t = useT();\n const [prompt, setPrompt] = useState(initialPrompt);\n const [runner, setRunner] = useState(() => initialRunner(workflow));\n const promptId = useId();\n const runnerId = useId();\n const descriptionId = useId();\n const problem =\n workflow.error ??\n (workflow.runners?.length === 0\n ? t('workflow.extra.thisWorkflowHasNoCompatibleRunner', 'This workflow has no compatible runner.')\n : undefined);\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={descriptionId}>\n <DialogHeader>\n <DialogTitle data-testid=\"launch-workflow-name\">\n {t('workflow.ui.startNamedWorkflow', 'Start {name}', { name: workflow.name })}\n </DialogTitle>\n </DialogHeader>\n <form\n onSubmit={(event) => {\n event.preventDefault();\n if (!prompt.trim() || problem !== undefined) return;\n requestLaunch(\n send,\n sessionId,\n workflowLaunchLine({\n workflow: workflow.relativePath,\n ...(runner === undefined ? {} : { runner }),\n inputs: initialInputs(workflow),\n prompt: prompt.trim(),\n }),\n workflow.path,\n );\n onLaunched();\n }}\n >\n <DialogBody>\n <p id={descriptionId} className=\"text-base text-po-dim\">\n {workflow.description ||\n t('workflow.extra.tellPoWhatYouWantThisWorkflowToDo', 'Tell Po what you want this workflow to do.')}\n </p>\n <div className=\"flex flex-col gap-2\">\n <label htmlFor={runnerId} className=\"text-base font-medium text-po-hi\">\n {' '}\n {t('workflow.ui.runner', 'Runner')}{' '}\n </label>\n <select\n id={runnerId}\n data-testid=\"launch-runner\"\n value={runner ?? ''}\n onChange={(event) => setRunner(event.target.value)}\n disabled={workflow.runners === undefined || workflow.runners.length === 0}\n className=\"h-11 w-full rounded-md border border-po-border bg-po-deep px-3 text-base text-po-text focus-visible:outline focus-visible:outline-2 focus-visible:outline-po-green\"\n >\n {workflow.runners === undefined ? (\n <option value=\"\">{t('workflow.ui.workflowDefault', 'Workflow default')}</option>\n ) : (\n workflow.runners.map((value) => (\n <option key={value} value={value}>\n {value}\n </option>\n ))\n )}\n </select>\n </div>\n <div className=\"flex flex-col gap-2\">\n <label htmlFor={promptId} className=\"text-base font-medium text-po-hi\">\n {' '}\n {t('workflow.ui.prompt', 'Prompt')}{' '}\n </label>\n <Textarea\n id={promptId}\n data-testid=\"launch-prompt\"\n rows={5}\n required\n value={prompt}\n onChange={(event) => setPrompt(event.target.value)}\n placeholder={t(\n 'workflow.ui.whatWouldYouLikeThisWorkflowToDo',\n 'What would you like this workflow to do?',\n )}\n className=\"text-lg\"\n />\n </div>\n {problem === undefined ? null : (\n <p role=\"alert\" className=\"text-base text-po-red\">\n {problem}\n </p>\n )}\n </DialogBody>\n <DialogFooter className=\"px-4 pb-4\">\n <Button type=\"button\" variant=\"outline\" className=\"h-11 px-4\" data-testid=\"launch-cancel\" onClick={onClose}>\n {' '}\n {t('workflow.ui.cancel', 'Cancel')}{' '}\n </Button>\n <Button\n type=\"submit\"\n variant=\"primary\"\n className=\"h-11 px-4\"\n data-testid=\"launch-submit\"\n disabled={!prompt.trim() || problem !== undefined}\n >\n {' '}\n {t('workflow.ui.startWorkflow', 'Start workflow')}{' '}\n </Button>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n","import { useT } from '@agimon-ai/po-core/web';\nimport {\n Badge,\n Button,\n CloseIcon,\n EmptyState,\n Input,\n Kbd,\n LoadingState,\n SearchIcon,\n WorkflowIcon,\n} 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 {\n catalog,\n filterCatalog,\n openCatalog,\n selectWorkflow,\n setCatalogFilter,\n toggleInspect,\n} 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 t = useT();\n const rows: Array<[string, string]> = [\n [\n t('workflow.ui.triggersLower', 'triggers'),\n workflow.triggers.length > 0 ? workflow.triggers.join(', ') : t('workflow.ui.noneDeclared', 'none declared'),\n ],\n [\n t('workflow.ui.inputsLower', 'inputs'),\n workflow.inputs.length > 0\n ? workflow.inputs\n .map((input) => `${input.name}${input.required ? '*' : ''}${input.default ? ` = ${input.default}` : ''}`)\n .join(', ')\n : t('workflow.ui.noneDeclared', 'none declared'),\n ],\n [\n t('workflow.ui.jobs.lowercase', 'jobs'),\n workflow.jobs.length > 0\n ? workflow.jobs.map((job) => job.name).join(' → ')\n : t('workflow.ui.noneDeclared', 'none declared'),\n ],\n [\n t('workflow.ui.artifacts.lowercase', 'artifacts'),\n workflow.artifacts.length > 0\n ? workflow.artifacts.map((entry) => entry.path).join(', ')\n : t('workflow.ui.noneDeclared', 'none declared'),\n ],\n [\n t('workflow.ui.runnersLower', 'runners'),\n workflow.runners === undefined\n ? t('workflow.extra.lower.anyRunner', 'any runner')\n : workflow.runners.join(', ') || t('workflow.ui.noneInCommon', 'none in common'),\n ],\n [t('workflow.ui.fileLower', '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-po-dim\">{label}</dt>\n <dd className=\"min-w-0 break-words text-po-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 t = useT();\n const jobs = workflow.jobs.length;\n // Literal keyboard binding, not translated prose.\n const inspectShortcut = 'i';\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-po-blue bg-po-panel' : 'border-transparent hover:bg-po-panel/60'\n }`}\n >\n <div className=\"flex min-w-0 items-center gap-2\">\n <span className=\"truncate text-base font-semibold text-po-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-po-cyan' : 'text-po-red'}`}>\n {workflow.error === undefined\n ? jobs === 1\n ? t('workflow.ui.jobCountOne', '{count} job', { count: jobs })\n : t('workflow.ui.jobCountMany', '{count} jobs', { count: jobs })\n : t('workflow.extra.lower.needsFixing', 'needs fixing')}\n </span>\n </div>\n <span className=\"truncate text-sm text-po-dim\">{workflow.description || workflow.relativePath}</span>\n {workflow.error === undefined ? (\n <span className=\"truncate text-sm text-po-dim\">\n {workflow.inputs.length === 1\n ? t('workflow.ui.inputCountOne', '{count} input', { count: workflow.inputs.length })\n : t('workflow.ui.inputCountMany', '{count} inputs', { count: workflow.inputs.length })}{' '}\n ·{' '}\n {workflow.runners === undefined\n ? t('workflow.extra.lower.anyRunner', 'any runner')\n : workflow.runners.join(', ') || t('workflow.ui.noRunnerInCommon', 'no runner in common')}\n {workflow.artifacts.length > 0\n ? t('workflow.ui.artifactsCountCaption', ' · {count} artifacts', { count: workflow.artifacts.length })\n : ''}\n </span>\n ) : (\n <span className=\"truncate text-base text-po-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 {' '}\n {t('workflow.ui.launch.lowercase', '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-po-dim\"\n onClick={(event) => {\n event.stopPropagation();\n onInspect();\n }}\n >\n {' '}\n {t('workflow.ui.inspect.lowercase', 'inspect')} <Kbd>{inspectShortcut}</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 t = useT();\n // Literal keyboard binding, not translated prose.\n const launcherShortcut = 'SPC w l';\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-po-border bg-po-rail outline-none\"\n >\n <div className=\"flex h-11 shrink-0 items-center gap-2.5 border-b border-po-border px-4\">\n <span className=\"text-lg font-semibold text-po-hi\">\n {t('workflow.ui.workflowCatalog.lowercase', 'workflow catalog')}\n </span>\n <Badge size=\"xs\" data-testid=\"catalog-count\">\n {state.workflows.length === 1\n ? t('workflow.ui.workflowCountOne', '{count} workflow', { count: state.workflows.length })\n : t('workflow.ui.workflowCountMany', '{count} workflows', { count: state.workflows.length })}\n </Badge>\n <span className=\"min-w-0 flex-1\" />\n <Kbd>{launcherShortcut}</Kbd>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n data-testid=\"catalog-close\"\n title={t('workflow.ui.closeTheCatalog.lowercase', 'close the catalog')}\n onClick={onClose}\n >\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={t('workflow.ui.filterByNameTagOrJob.lowercase', '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 && state.workflows.length > 0 ? (\n <EmptyState\n data-testid=\"catalog-empty\"\n size=\"compact\"\n surface=\"plain\"\n icon={<SearchIcon />}\n title={t('workflow.ui.noMatchingWorkflows', 'No matching workflows')}\n description={state.warning ?? t('workflow.ui.tryAnotherNameTagOrJob', 'Try another name, tag, or job.')}\n secondaryAction={{\n label: t('workflow.extra.clearFilter', 'Clear filter'),\n onAction: () => setCatalogFilter(sessionId, ''),\n }}\n />\n ) : null}\n {state.workflows.length === 0 && state.warning !== undefined ? (\n <EmptyState\n data-testid=\"catalog-empty\"\n size=\"compact\"\n surface=\"plain\"\n tone=\"error\"\n title={t('workflow.ui.workflowsCouldNotLoad', 'Workflows could not load')}\n description={state.warning}\n action={{ label: t('workflow.extra.retry', 'Retry'), onAction: () => openCatalog(sessionId, state.prompt) }}\n />\n ) : null}\n {state.workflows.length === 0 && state.warning === undefined && !state.loaded ? (\n <LoadingState size=\"compact\" label={t('workflow.ui.loadingWorkflows', 'Loading workflows')} />\n ) : null}\n {state.workflows.length === 0 && state.warning === undefined && state.loaded ? (\n <EmptyState\n data-testid=\"catalog-empty\"\n size=\"compact\"\n surface=\"plain\"\n icon={<WorkflowIcon />}\n title={t('workflow.ui.noWorkflowsFound', 'No workflows found')}\n description={t(\n 'workflow.ui.addAWorkflowFileUnderAutomationsWorkflowsToLaunchItFromHere',\n 'Add a workflow file under automations/workflows to launch it from here.',\n )}\n />\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-po-border-soft bg-po-deep px-4\">\n <span className=\"shrink-0 text-sm text-po-dim\">\n {t('workflow.ui.chooseEnterLaunchIInspectEscClose', '↑↓ choose · enter launch · i inspect · esc close')}\n </span>\n <span className=\"min-w-0 truncate font-mono text-sm text-po-dim\">{state.cwd}</span>\n </div>\n </aside>\n );\n}\n","import { useT } from '@agimon-ai/po-core/web';\nimport 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 t = useT();\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\">{t('workflow.ui.workflowCatalog.lowercase', '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 type { FileItem } from '@agimon-ai/po-web-components';\n\nimport type { WorkflowJobView, WorkflowRunView } from '../../../../../types/webWorkflows';\n\n/** The folder of the session artifact folder every run's directory sits under. */\nexport const WORKFLOW_ARTIFACT_FOLDER = 'workflows';\n/** Files the engine keeps beside a run's output; the person reads the jobs' declared files instead. */\nconst BOOKKEEPING_FILES: ReadonlySet<string> = new Set(['run.json', 'context.md', 'changelog.md', 'fix.md']);\nconst ACTIVE_JOB_STATES: ReadonlySet<WorkflowJobView['status']> = new Set([\n 'running',\n 'resumed',\n 'pause_requested',\n 'paused',\n]);\n\nexport type ArtifactRunState = 'failed' | 'waiting' | 'running' | 'done';\nexport type ArtifactJobState = 'done' | 'running' | 'waiting' | 'failed' | 'pending';\n/** Failures first, then gentle asks, then work in progress, then finished runs. */\nexport const RUN_STATE_ORDER: readonly ArtifactRunState[] = ['failed', 'waiting', 'running', 'done'];\n\nexport interface ArtifactRunJob {\n key: string;\n label: string;\n state: ArtifactJobState;\n /** The declared file, once the run has written it. */\n item?: FileItem;\n}\n\nexport interface ArtifactRun {\n folder: string;\n title: string;\n workflow: string;\n state: ArtifactRunState;\n jobs: ArtifactRunJob[];\n}\n\n/** Files in a run folder no reported run claims, listed under the run key. */\nexport interface ArtifactRunFolder {\n /** `<workspace>/<runKey>`, unique. */\n folder: string;\n /** The run key, with its workspace when another listed folder shares the key. */\n label: string;\n items: FileItem[];\n}\n\nexport function artifactRunState(run: WorkflowRunView): ArtifactRunState {\n if (run.waiting) return 'waiting';\n if (run.stage === 'error' || run.outcome === 'failed') return 'failed';\n if (run.stage === 'running') return 'running';\n return 'done';\n}\n\nfunction jobState(run: WorkflowRunView, job: WorkflowJobView): ArtifactJobState {\n if (job.status === 'pending') return 'pending';\n // A parked run's current job is the one asking for the person's review.\n if (run.waiting && (ACTIVE_JOB_STATES.has(job.status) || job.status === 'failed')) return 'waiting';\n if (ACTIVE_JOB_STATES.has(job.status)) return 'running';\n if (job.status === 'failed') return 'failed';\n return 'done';\n}\n\nconst sentenceCase = (text: string) => text.charAt(0).toUpperCase() + text.slice(1);\n\nconst folderOf = (workspace: string, runKey: string) => `${workspace}/${runKey}`;\n\n/** `workflows/<workspace>/<runKey>/<rest>` split into its run folder and the path inside it. */\nfunction runPathOf(item: FileItem): { folder: string; runKey: string; inner: string } | undefined {\n const [root, workspace, runKey, ...rest] = item.path.split('/');\n return root === WORKFLOW_ARTIFACT_FOLDER && workspace && runKey && rest.length > 0\n ? { folder: folderOf(workspace, runKey), runKey, inner: rest.join('/') }\n : undefined;\n}\n\n/**\n * The session's runs as the Workflows section shows them: each job's declared files matched to\n * `workflows/<workspace>/<runKey>/<artifact>`, and the files of folders no run reports. A finished run with\n * nothing written here (one from before runs lived in the artifact folder) is left out.\n */\nexport function workflowArtifactRuns(\n runs: readonly WorkflowRunView[],\n items: readonly FileItem[],\n sessionId: string,\n): { runs: ArtifactRun[]; folders: ArtifactRunFolder[] } {\n const byFolder = new Map<string, Map<string, FileItem>>();\n const runKeyOf = new Map<string, string>();\n for (const item of items) {\n const place = runPathOf(item);\n if (!place) continue;\n const files = byFolder.get(place.folder) ?? new Map<string, FileItem>();\n files.set(place.inner, item);\n byFolder.set(place.folder, files);\n runKeyOf.set(place.folder, place.runKey);\n }\n const shown: ArtifactRun[] = [];\n const claimed = new Set<string>();\n for (const run of runs) {\n // A run another session owns writes into that session's artifact folder, not this one.\n const folder = folderOf(run.workspace, run.runKey);\n if (claimed.has(folder) || (run.ownerSessionId !== undefined && run.ownerSessionId !== sessionId)) continue;\n const files = byFolder.get(folder);\n const state = artifactRunState(run);\n if (files === undefined && state === 'done') continue;\n claimed.add(folder);\n shown.push({\n folder,\n title: run.displayName,\n workflow: run.workflowName ?? run.workflowPath.split('/').at(-1) ?? run.workflowPath,\n state,\n jobs: run.jobs.flatMap((job) =>\n (job.artifacts ?? []).map((artifact) => {\n const item = files?.get(artifact);\n return {\n key: `${job.name}\\0${artifact}`,\n label: job.artifacts!.length === 1 ? sentenceCase(job.name) : `${sentenceCase(job.name)}: ${artifact}`,\n state: jobState(run, job),\n ...(item === undefined ? {} : { item }),\n };\n }),\n ),\n });\n }\n shown.sort((a, b) => RUN_STATE_ORDER.indexOf(a.state) - RUN_STATE_ORDER.indexOf(b.state));\n const folders = [...byFolder]\n .filter(([folder]) => !claimed.has(folder))\n .map(([folder, files]) => ({\n folder,\n label: runKeyOf.get(folder)!,\n items: [...files]\n // Sealed versions under `.workflow/` are engine state, never output.\n .filter(([inner]) => !BOOKKEEPING_FILES.has(inner) && !inner.startsWith('.'))\n .map(([, item]) => item)\n .sort((a, b) => b.modifiedAt - a.modifiedAt),\n }))\n .filter((folder) => folder.items.length > 0);\n const keyCounts = new Map<string, number>();\n for (const { label } of folders) keyCounts.set(label, (keyCounts.get(label) ?? 0) + 1);\n for (const entry of folders) if (keyCounts.get(entry.label)! > 1) entry.label = entry.folder;\n return { runs: shown, folders };\n}\n","import { useT } from '@agimon-ai/po-core/web';\nimport { LoaderIcon } from '@agimon-ai/po-web-components';\nimport { useStore } from '@tanstack/react-store';\nimport type { ReactNode } from 'react';\n\nimport type { ArtifactSourcePanelProps } from '../../../../../../types/artifactSource';\nimport { type ArtifactJobState, type ArtifactRunState, workflowArtifactRuns } from '../../_lib/workflowArtifactSource';\nimport { workflows } from '../../_lib/workflowsStore';\n\n/** The Artifacts face's Workflows section: one group per run, failures first, every job with what it wrote. */\nexport function WorkflowsBody({ sessionId, items, Group, Row }: ArtifactSourcePanelProps) {\n const t = useT();\n const RUN_STATE: Record<ArtifactRunState, { label: string; className: string }> = {\n running: { label: t('workflow.artifacts.running', 'Running'), className: 'text-po-green' },\n waiting: { label: t('workflow.artifacts.waiting', 'Waiting for you'), className: 'text-po-magenta' },\n failed: { label: t('workflow.artifacts.failed', 'Failed'), className: 'text-po-red' },\n done: { label: t('workflow.artifacts.done', 'Done'), className: 'text-po-dim' },\n };\n\n /** A job that wrote nothing still says where it stands. */\n const EMPTY_JOB: Record<ArtifactJobState, { label: string; className: string }> = {\n pending: { label: t('workflow.artifacts.pending', 'Not started'), className: 'text-po-dim' },\n running: { label: t('workflow.artifacts.running', 'Running'), className: 'text-po-green' },\n waiting: { label: t('workflow.artifacts.waiting', 'Waiting for you'), className: 'text-po-magenta' },\n failed: { label: t('workflow.artifacts.failed', 'Failed'), className: 'text-po-red' },\n done: { label: t('workflow.artifacts.noFiles', 'No files'), className: 'text-po-dim' },\n };\n\n const JOB_BADGE: Partial<Record<ArtifactJobState, ReactNode>> = {\n running: <span className=\"text-sm text-po-green\">{t('workflow.ui.writing', 'Writing')}</span>,\n waiting: (\n <span className=\"rounded-md border border-po-edge-magenta bg-po-tint-magenta px-1.5 text-sm font-semibold text-po-magenta\">\n {' '}\n {t('workflow.ui.review', 'Review')}{' '}\n </span>\n ),\n failed: <span className=\"text-sm font-semibold text-po-red\">{t('workflow.ui.failed', 'Failed')}</span>,\n };\n\n const runs = useStore(workflows.store, (state) => workflows.select(state, sessionId).runs);\n const view = workflowArtifactRuns(runs, items, sessionId);\n if (view.runs.length === 0 && view.folders.length === 0) return null;\n return (\n <div className=\"flex flex-col gap-5\">\n {view.runs.map((run) => {\n const state = RUN_STATE[run.state];\n return (\n <section key={run.folder} className=\"flex flex-col gap-1\">\n <h3 className=\"flex items-baseline gap-2 text-base font-semibold text-po-hi\">\n <span className=\"min-w-0 flex-1 truncate\">{run.title}</span>\n <span className={`text-sm font-semibold ${state.className}`}>{state.label}</span>\n </h3>\n <span className=\"text-sm text-po-dim\">{run.workflow}</span>\n <div className=\"flex flex-col\">\n {run.jobs.map((job) => {\n if (!job.item || job.state === 'pending') {\n const empty = EMPTY_JOB[job.state];\n return (\n <div key={job.key} className=\"flex h-11 items-center gap-3 pr-9\">\n <span aria-hidden className=\"flex size-4 items-center justify-center\">\n <span className=\"size-1.5 rounded-full bg-po-border\" />\n </span>\n <span className=\"min-w-0 flex-1 truncate text-base text-po-dim\">{job.label}</span>\n <span className={`text-sm ${empty.className}`}>{empty.label}</span>\n </div>\n );\n }\n return (\n <Row\n key={job.key}\n item={job.item}\n label={job.label}\n icon={job.state === 'running' ? RunningIcon : undefined}\n badge={JOB_BADGE[job.state]}\n />\n );\n })}\n </div>\n </section>\n );\n })}\n {view.folders.map((folder) => (\n <Group key={folder.folder} title={folder.label}>\n <div className=\"flex flex-col\">\n {folder.items.map((item) => (\n <Row key={item.path} item={item} label={item.path.split('/').slice(3).join('/')} />\n ))}\n </div>\n </Group>\n ))}\n </div>\n );\n}\n\nfunction RunningIcon({ className }: { className?: string }) {\n return (\n <LoaderIcon aria-hidden className={`${className ?? ''} animate-spin !text-po-green motion-reduce:animate-none`} />\n );\n}\n","import { defineFill } from '@agimon-ai/po-core/web';\nimport { WorkflowIcon } from '@agimon-ai/po-web-components';\n\nimport type { ArtifactSourceContribution } from '../../../../../types/artifactSource';\nimport { WORKFLOW_ARTIFACT_FOLDER } from '../_lib/workflowArtifactSource';\nimport { WorkflowsBody } from './_components/WorkflowsArtifactSource';\n\n/** Fills slot `artifacts.source`: the session's workflow runs and the files their jobs write. */\nexport default defineFill({\n slot: 'artifacts.source',\n id: 'workflows',\n data: {\n version: 1,\n label: 'Workflows',\n icon: WorkflowIcon,\n folders: [WORKFLOW_ARTIFACT_FOLDER],\n panel: WorkflowsBody,\n } satisfies ArtifactSourceContribution,\n});\n","/** README-grounded starter guidance shared by the web and native fills. */\nexport const helpGuides = {\n version: 1,\n category: 'work',\n labelKey: 'workflow.guides.workflows',\n label: 'Workflows',\n guides: [\n {\n id: 'about',\n questionKey: 'workflow.guides.whatCanWorkflowsDoForMe',\n question: 'What can workflows do for me?',\n order: 0,\n answerKey:\n 'workflow.guides.workflowsRunDependentJobsAndAgentStepsInTheBackgroundPoShowsProgressAndNotifiesTheSessionWhenARunEnds',\n answer:\n 'Workflows run dependent jobs and agent steps in the background. Po shows progress and notifies the session when a run ends.',\n keywords: ['automation', 'jobs'],\n },\n {\n id: 'launch',\n questionKey: 'workflow.guides.howDoILaunchAndFollowAWorkflow',\n question: 'How do I launch and follow a workflow?',\n order: 1,\n answerKey:\n 'workflow.guides.askPoToListWorkflowsAndLaunchOneWithYourInputsOpenTheWorkflowsActivityHeadingToFollowProgressWorkflowCommandsRunOnTheHostSoOnlyLaunchTrustedDefinitions',\n answer:\n 'Ask Po to list workflows and launch one with your inputs. Open the Workflows activity heading to follow progress. Workflow commands run on the host, so only launch trusted definitions.',\n keywords: ['launch', 'runs'],\n },\n ],\n} as const;\n","import { defineFill } from '@agimon-ai/po-core/web';\n\nimport { helpGuides } from './_lib/helpGuides';\n\nexport default defineFill({\n slot: 'help.guides',\n id: 'Workflows',\n order: 340,\n data: helpGuides,\n});\n","import { defineLeaderBinding } from '@agimon-ai/po-core/web';\n\nimport legacy from '../_lib';\n\nexport default defineLeaderBinding(legacy.leaderBindings![0]!);\n","import type { ToolResultView } from '@agimon-ai/po-core/web';\n\nimport { type WorkflowFact, type WorkflowRow, workflowGenericView } from './workflowToolRender';\n\n/**\n * The view model of the workflow child tools, the lead's spawnChild,\n * childStatus and children and the child's reportCriteria and\n * reviewArtifacts, registered under the names in\n * src/services/workflowNamespace (CHILD_TOOL_NAMES). The runtime picks which\n * of them a session gets by its role, so the renderers claim them by name\n * through `matches`. Results arrive as JSON text; they are parsed and\n * validated here into figures, chips, and compact lists, and only text that\n * does not parse falls back to plain lines. As the namespace's call cards do,\n * the view leaves out the assignment prompt, input values, criteria\n * feedback, and reviewed artifact bodies.\n */\n\nexport const WORKFLOW_CHILD_TOOL_NAMES = [\n 'workflow_spawn_child',\n 'workflow_child_status',\n 'workflow_children',\n 'workflow_report_criteria',\n 'workflow_review_artifacts',\n] as const;\n\nexport type WorkflowChildToolName = (typeof WORKFLOW_CHILD_TOOL_NAMES)[number];\n\nexport type WorkflowChipTone = NonNullable<WorkflowRow['chip']>['tone'];\n\nexport interface WorkflowChildChip {\n label: string;\n tone: WorkflowChipTone;\n}\n\nexport interface WorkflowChildSection {\n title: string;\n rows: WorkflowRow[];\n}\n\n/** A parsed child-tool result: one key figure, its facts, compact lists, and a quiet note. */\nexport interface WorkflowChildView {\n headline: string;\n chip?: WorkflowChildChip;\n facts: WorkflowFact[];\n sections: WorkflowChildSection[];\n /** A failure the result itself reports, such as a child that ended failed. */\n error?: string;\n note?: string;\n /** Plain text that did not parse, shown as it came. */\n text?: string[];\n}\n\n/** The header beside the tool name: the one piece that stays whole and the detail that may truncate. */\nexport interface WorkflowChildSummary {\n primary?: string;\n detail: string[];\n}\n\ntype JsonRecord = Record<string, unknown>;\n\nexport type WorkflowTranslate = (\n key: string,\n english: string,\n vars?: Readonly<Record<string, string | number>>,\n) => string;\n\nexport function matchesWorkflowChildTool(toolName: string): boolean {\n return (WORKFLOW_CHILD_TOOL_NAMES as readonly string[]).includes(toolName);\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 readString(record: JsonRecord | undefined, key: string): string | undefined {\n const value = record?.[key];\n if (typeof value !== 'string') return undefined;\n return value.replace(/\\s+/gu, ' ').trim() || 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 timestamp(value: string): string {\n return value.replace('T', ' ').replace(/\\.\\d{3}Z$/u, 'Z');\n}\n\nfunction resultText(result: ToolResultView | null): string {\n if (!result) return '';\n return result.content\n .flatMap((item) => {\n const record = asRecord(item);\n return record?.type === 'text' && typeof record.text === 'string' ? [record.text] : [];\n })\n .join('\\n')\n .trim();\n}\n\ntype Parsed = { ok: true; value: unknown } | { ok: false };\n\nfunction parseResult(result: ToolResultView | null): Parsed {\n const text = resultText(result);\n if (text) {\n try {\n return { ok: true, value: JSON.parse(text) };\n } catch {\n // Not JSON: the caller shows the text as it came.\n return { ok: false };\n }\n }\n return result && result.details !== undefined ? { ok: true, value: result.details } : { ok: false };\n}\n\nfunction criteriaResults(args: JsonRecord): Array<{ key: string; status: string }> {\n const results = asRecord(args.results);\n if (!results) return [];\n return Object.entries(results).flatMap(([key, value]) => {\n const status = readString(asRecord(value), 'status');\n return status ? [{ key, status }] : [];\n });\n}\n\nexport function workflowChildSummary(t: WorkflowTranslate, toolName: string, args: JsonRecord): WorkflowChildSummary {\n if (toolName === 'workflow_spawn_child') {\n const inputs = Object.keys(asRecord(args.inputs) ?? {}).length;\n const job = readString(args, 'job');\n return {\n ...(job === undefined ? {} : { primary: job }),\n detail:\n inputs > 0\n ? [\n inputs === 1\n ? t('workflow.child.input.one', '{count} input', { count: inputs })\n : t('workflow.child.input.many', '{count} inputs', { count: inputs }),\n ]\n : [],\n };\n }\n if (toolName === 'workflow_child_status') {\n const id = readString(args, 'invocationId');\n return { ...(id === undefined ? {} : { primary: id }), detail: [] };\n }\n if (toolName === 'workflow_report_criteria') {\n const results = criteriaResults(args);\n if (results.length === 0) return { detail: [] };\n const notMet = results.filter((entry) => entry.status === 'not-met').length;\n return {\n primary:\n results.length === 1\n ? t('workflow.child.criterion.one', '{count} criterion', { count: results.length })\n : t('workflow.child.criterion.many', '{count} criteria', { count: results.length }),\n detail: notMet > 0 ? [t('workflow.child.notMetCount', '{count} not met', { count: notMet })] : [],\n };\n }\n return { detail: [] };\n}\n\n/** What the card says while the call runs. */\nexport function workflowChildRunningLabel(t: WorkflowTranslate, toolName: string): string {\n if (toolName === 'workflow_spawn_child') return t('workflow.child.starting', 'Starting the child');\n if (toolName === 'workflow_child_status') return t('workflow.child.readingChild', 'Reading the child');\n if (toolName === 'workflow_children') return t('workflow.child.readingChildren', 'Reading the children');\n if (toolName === 'workflow_report_criteria') return t('workflow.child.reporting', 'Reporting criteria');\n if (toolName === 'workflow_review_artifacts') return t('workflow.child.readingArtifacts', 'Reading the artifacts');\n return t('workflow.child.running', 'Running');\n}\n\nconst INVOCATION_CHIPS: Readonly<Record<string, WorkflowChildChip>> = {\n running: { label: 'running', tone: 'blue' },\n completed: { label: 'completed', tone: 'green' },\n failed: { label: 'failed', tone: 'red' },\n interrupted: { label: 'interrupted', tone: 'yellow' },\n};\n\nconst CRITERION_CHIPS: Readonly<Record<string, WorkflowChildChip>> = {\n checked: { label: 'checked', tone: 'green' },\n 'not-met': { label: 'not met', tone: 'yellow' },\n unchecked: { label: 'unchecked', tone: 'neutral' },\n};\n\nfunction translatedChip(t: WorkflowTranslate, chip: WorkflowChildChip): WorkflowChildChip {\n switch (chip.label) {\n case 'running':\n return { ...chip, label: t('workflow.child.state.running', 'running') };\n case 'completed':\n return { ...chip, label: t('workflow.child.state.completed', 'completed') };\n case 'failed':\n return { ...chip, label: t('workflow.child.state.failed', 'failed') };\n case 'interrupted':\n return { ...chip, label: t('workflow.child.state.interrupted', 'interrupted') };\n case 'checked':\n return { ...chip, label: t('workflow.child.state.checked', 'checked') };\n case 'not met':\n return { ...chip, label: t('workflow.child.state.not-met', 'not met') };\n case 'unchecked':\n return { ...chip, label: t('workflow.child.state.unchecked', 'unchecked') };\n default:\n return chip;\n }\n}\n\nfunction invocationChip(t: WorkflowTranslate, state: string): WorkflowChildChip {\n return translatedChip(t, INVOCATION_CHIPS[state] ?? { label: state, tone: 'neutral' });\n}\n\nfunction invocationView(t: WorkflowTranslate, value: unknown): WorkflowChildView | undefined {\n const record = asRecord(value);\n const invocationId = readString(record, 'invocationId');\n const job = readString(record, 'job');\n const state = readString(record, 'state');\n if (!record || !invocationId || !job || !state) return undefined;\n const sessions = Array.isArray(record.sessionIds) ? record.sessionIds.filter((id) => typeof id === 'string') : [];\n const startedAt = readString(record, 'startedAt');\n const endedAt = readString(record, 'endedAt');\n const facts: WorkflowFact[] = [{ label: t('workflow.child.invocation', 'invocation'), value: invocationId }];\n if (startedAt) facts.push({ label: t('workflow.child.started', 'started'), value: timestamp(startedAt) });\n if (endedAt) facts.push({ label: t('workflow.child.ended', 'ended'), value: timestamp(endedAt) });\n if (sessions.length > 0)\n facts.push({ label: t('workflow.child.sessions', 'sessions'), value: String(sessions.length) });\n const error = readString(record, 'error');\n return {\n headline: job,\n chip: invocationChip(t, state),\n facts,\n sections: [],\n ...(error === undefined ? {} : { error }),\n ...(state === 'running'\n ? { note: t('workflow.child.checkBack', 'Check back with childStatus; a started child is not a finished one.') }\n : {}),\n };\n}\n\nfunction criterionRow(t: WorkflowTranslate, value: unknown): WorkflowRow | undefined {\n const record = asRecord(value);\n const key = readString(record, 'key');\n const status = readString(record, 'status');\n if (!key || !status) return undefined;\n const verifiedBy = readString(record, 'verifiedBy');\n return {\n key,\n title: key,\n ...(verifiedBy === undefined\n ? {}\n : { detail: t('workflow.child.verifiedBy', 'verified by {name}', { name: verifiedBy }) }),\n chip: translatedChip(t, CRITERION_CHIPS[status] ?? { label: status, tone: 'neutral' }),\n };\n}\n\nfunction invocationRow(t: WorkflowTranslate, value: unknown): WorkflowRow | undefined {\n const record = asRecord(value);\n const id = readString(record, 'invocationId');\n const job = readString(record, 'job');\n const state = readString(record, 'state');\n if (!id || !job || !state) return undefined;\n return { key: id, title: job, detail: id, chip: invocationChip(t, state) };\n}\n\nfunction childrenView(t: WorkflowTranslate, value: unknown): WorkflowChildView | undefined {\n const record = asRecord(value);\n const lead = readString(record, 'lead');\n if (!record || !lead || !Array.isArray(record.criteria) || !Array.isArray(record.invocations)) return undefined;\n let checked = 0;\n const criteria = record.criteria.flatMap((entry) => {\n const row = criterionRow(t, entry);\n if (!row) return [];\n if (readString(asRecord(entry), 'status') === 'checked') checked++;\n return [row];\n });\n const invocations = record.invocations.flatMap((entry) => invocationRow(t, entry) ?? []);\n const continuations = readNumber(record, 'continuations');\n const maxContinuations = readNumber(record, 'maxContinuations');\n const facts: WorkflowFact[] = [{ label: t('workflow.child.lead', 'lead'), value: lead }];\n if (continuations !== undefined && maxContinuations !== undefined) {\n facts.push({\n label: t('workflow.child.continuations', 'continuations'),\n value: `${continuations}/${maxContinuations}`,\n });\n }\n const sections: WorkflowChildSection[] = [];\n if (criteria.length > 0) sections.push({ title: t('workflow.child.criteria', 'Criteria'), rows: criteria });\n if (invocations.length > 0) sections.push({ title: t('workflow.child.children', 'Children'), rows: invocations });\n return {\n headline:\n criteria.length > 0\n ? criteria.length === 1\n ? t('workflow.child.checked.one', '{checked}/{count} criterion checked', { checked, count: criteria.length })\n : t('workflow.child.checked.many', '{checked}/{count} criteria checked', { checked, count: criteria.length })\n : invocations.length === 1\n ? t('workflow.child.children.one', '{count} child', { count: invocations.length })\n : t('workflow.child.children.many', '{count} children', { count: invocations.length }),\n facts,\n sections,\n ...(sections.length === 0 ? { note: t('workflow.child.emptyChildren', 'No children spawned yet.') } : {}),\n };\n}\n\nfunction reportView(t: WorkflowTranslate, args: JsonRecord): WorkflowChildView {\n const results = criteriaResults(args);\n const rows = results.map((entry): WorkflowRow => ({\n key: entry.key,\n title: entry.key,\n chip: translatedChip(t, CRITERION_CHIPS[entry.status] ?? { label: entry.status, tone: 'neutral' }),\n }));\n return {\n headline:\n rows.length === 1\n ? t('workflow.child.reported.one', '{count} criterion reported', { count: rows.length })\n : t('workflow.child.reported.many', '{count} criteria reported', { count: rows.length }),\n facts: [],\n sections: rows.length > 0 ? [{ title: t('workflow.child.criteria', 'Criteria'), rows }] : [],\n note: t('workflow.child.leadReads', 'The lead reads these on its next look at the children.'),\n };\n}\n\nfunction artifactsView(t: WorkflowTranslate, value: unknown): WorkflowChildView | undefined {\n const record = asRecord(value);\n const revision = readString(record, 'revision');\n const artifacts = asRecord(record?.artifacts);\n if (!revision || !artifacts) return undefined;\n const rows = Object.entries(artifacts).map(([name, body]): WorkflowRow => {\n const lines = typeof body === 'string' && body.length > 0 ? body.split('\\n').length : 0;\n return {\n key: name,\n title: name,\n detail:\n lines === 1\n ? t('workflow.child.lines.one', '{count} line', { count: lines })\n : t('workflow.child.lines.many', '{count} lines', { count: lines }),\n };\n });\n return {\n headline:\n rows.length === 1\n ? t('workflow.child.artifacts.one', '{count} artifact', { count: rows.length })\n : t('workflow.child.artifacts.many', '{count} artifacts', { count: rows.length }),\n facts: [{ label: t('workflow.child.revision', 'revision'), value: revision }],\n sections: rows.length > 0 ? [{ title: t('workflow.child.artifacts', 'Artifacts'), rows }] : [],\n ...(rows.length === 0 ? { note: t('workflow.child.emptyArtifacts', 'No artifacts recorded for review.') } : {}),\n };\n}\n\nfunction textView(t: WorkflowTranslate, result: ToolResultView | null): WorkflowChildView {\n const lines = resultText(result)\n .split('\\n')\n .map((entry) => entry.trimEnd())\n .filter((entry) => entry.length > 0);\n return {\n headline: '',\n facts: [],\n sections: [],\n text: lines.length > 0 ? lines : [t('workflow.child.emptyOutput', 'No output.')],\n };\n}\n\n/** The settled result of a child tool, parsed by tool; raw text only when it does not parse. */\nexport function workflowChildView(\n t: WorkflowTranslate,\n toolName: string,\n args: JsonRecord,\n result: ToolResultView | null,\n): WorkflowChildView {\n if (toolName === 'workflow_report_criteria') return reportView(t, args);\n const parsed = parseResult(result);\n if (!parsed.ok) return textView(t, result);\n const view =\n toolName === 'workflow_spawn_child' || toolName === 'workflow_child_status'\n ? invocationView(t, parsed.value)\n : toolName === 'workflow_children'\n ? childrenView(t, parsed.value)\n : toolName === 'workflow_review_artifacts'\n ? artifactsView(t, parsed.value)\n : undefined;\n if (view) return view;\n // JSON of a shape this card does not know is still laid out, never printed.\n const generic = workflowGenericView(t, parsed.value);\n return {\n headline: generic.headline,\n facts: generic.facts,\n sections: generic.rows.length > 0 ? [{ title: t('workflow.child.items', 'Items'), rows: generic.rows }] : [],\n };\n}\n","import { useT } from '@agimon-ai/po-core/web';\nimport type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport {\n Badge,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n toolTone,\n} from '@agimon-ai/po-web-components';\n\nimport {\n type WorkflowChildChip,\n workflowChildRunningLabel,\n workflowChildSummary,\n workflowChildView,\n} from '../_lib/workflowChildToolView';\nimport { type WorkflowFact, type WorkflowRow, workflowFailureReason } from '../_lib/workflowToolRender';\n\nfunction Headline({ text, chip }: { text: string; chip?: WorkflowChildChip | undefined }) {\n return (\n <div className=\"flex min-w-0 items-center gap-2\">\n {text ? <span className=\"min-w-0 truncate font-semibold text-po-hi\">{text}</span> : null}\n {chip ? (\n <Badge tone={chip.tone} size=\"xs\">\n {chip.label}\n </Badge>\n ) : null}\n </div>\n );\n}\n\nfunction Facts({ facts }: { facts: readonly WorkflowFact[] }) {\n if (facts.length === 0) return null;\n return (\n <dl className=\"flex flex-wrap gap-x-5 gap-y-2\">\n {facts.map((fact) => (\n <div key={fact.label} className=\"flex min-w-0 flex-col gap-0.5\">\n <dt className=\"font-semibold text-po-dim text-xs uppercase\">{fact.label}</dt>\n <dd className=\"truncate font-mono text-po-text text-sm\">{fact.value}</dd>\n </div>\n ))}\n </dl>\n );\n}\n\nfunction Rows({ title, rows }: { title: string; rows: readonly WorkflowRow[] }) {\n return (\n <div className=\"flex flex-col gap-2\">\n <span className=\"font-semibold text-po-dim text-xs uppercase\">{title}</span>\n <ul className=\"flex flex-col gap-1.5\">\n {rows.map((row) => (\n <li key={row.key} className=\"flex min-w-0 items-center gap-2\">\n <span className=\"min-w-0 truncate text-po-text\">{row.title}</span>\n {row.chip ? (\n <Badge tone={row.chip.tone} size=\"xs\">\n {row.chip.label}\n </Badge>\n ) : null}\n {row.detail ? <span className=\"min-w-0 truncate text-po-faint text-sm\">{row.detail}</span> : null}\n </li>\n ))}\n </ul>\n </div>\n );\n}\n\n/**\n * The workflow child tools' timeline item: the job, invocation or criteria\n * count in the header, the key figure and its chip as the collapsed\n * preview, and the facts and compact lists once expanded. Results are parsed\n * in workflowChildToolView, so JSON is laid out, never printed.\n */\nexport function WorkflowChildToolMessage({ toolName, args, result, output, running, isError }: ToolMessageRenderProps) {\n const t = useT();\n const summary = workflowChildSummary(t, toolName, args);\n const view = running || isError ? undefined : workflowChildView(t, toolName, args, result);\n const expandable =\n view !== undefined &&\n (view.facts.length > 0 ||\n view.sections.length > 0 ||\n view.error !== undefined ||\n view.note !== undefined ||\n (view.text?.length ?? 0) > 1);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable={expandable}>\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 {summary.primary ? <span className=\"shrink-0 font-semibold text-po-hi\">{summary.primary}</span> : null}\n {summary.detail.map((value) => (\n <span key={value} className=\"min-w-0 truncate text-po-dim\">\n {summary.primary ? `· ${value}` : value}\n </span>\n ))}\n </span>\n </MessageItemHeader>\n {isError ? (\n <MessageItemBody data-testid={`tool-result-${toolName}`}>\n <div className=\"whitespace-pre-wrap break-words text-po-red\">\n {workflowFailureReason(t, result, output)}\n </div>\n </MessageItemBody>\n ) : running ? (\n <MessageItemBody data-testid={`tool-result-${toolName}`}>\n <MessageItemStatus tone=\"running\">{workflowChildRunningLabel(t, toolName)}</MessageItemStatus>\n </MessageItemBody>\n ) : view === undefined ? null : view.text ? (\n <MessageItemBody data-testid={`tool-result-${toolName}`}>\n <div className=\"flex flex-col gap-0.5 text-po-text\">\n {(expanded ? view.text : view.text.slice(0, 1)).map((text, index) => (\n <div key={`${String(index)}-${text}`} className=\"whitespace-pre-wrap break-words\">\n {text}\n </div>\n ))}\n </div>\n </MessageItemBody>\n ) : (\n <MessageItemBody data-testid={`tool-result-${toolName}`}>\n <div className=\"flex flex-col gap-3\">\n <Headline text={view.headline} chip={view.chip} />\n {expanded ? (\n <>\n {view.error ? (\n <div className=\"whitespace-pre-wrap break-words text-po-red\">{view.error}</div>\n ) : null}\n <Facts facts={view.facts} />\n {view.sections.map((section) => (\n <Rows key={section.title} title={section.title} rows={section.rows} />\n ))}\n {view.note ? <p className=\"text-po-faint text-sm\">{view.note}</p> : null}\n </>\n ) : null}\n </div>\n </MessageItemBody>\n )}\n </>\n )}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { WorkflowChildToolMessage } from './_components/WorkflowChildToolMessage';\nimport { matchesWorkflowChildTool, WORKFLOW_CHILD_TOOL_NAMES } from './_lib/workflowChildToolView';\n\n/** The runtime registers only the child tools a session's role allows, so the names are matched, not just listed. */\nexport default defineToolRenderer({\n tools: [...WORKFLOW_CHILD_TOOL_NAMES],\n matches: matchesWorkflowChildTool,\n message: WorkflowChildToolMessage,\n});\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 dockWorkflow from '../src/extensions/workspaces/(frontend)/dock/workflow.web';\nimport fillStepParent from '../src/extensions/workspaces/(frontend)/fill/StepParent.conversation-strip.web';\nimport fillWorkflows from '../src/extensions/workspaces/(frontend)/fill/Workflows.home.web';\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 channelDynamicWorkflowRuns from '../src/extensions/workspaces/sessions/(frontend)/channel/dynamic-workflow-runs.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 fillWorkflowLauncher from '../src/extensions/workspaces/sessions/(frontend)/fill/WorkflowLauncher.overlay.web';\nimport fillWorkflows2 from '../src/extensions/workspaces/sessions/(frontend)/fill/Workflows.activity.workflows.web';\nimport fillWorkflows3 from '../src/extensions/workspaces/sessions/(frontend)/fill/Workflows.artifacts.source.web';\nimport fillWorkflows4 from '../src/extensions/workspaces/sessions/(frontend)/fill/Workflows.help.guides.web';\nimport leaderCatalog from '../src/extensions/workspaces/sessions/(frontend)/leader/catalog.web';\nimport toolWorkflowChild from '../src/extensions/workspaces/sessions/(frontend)/tool/workflow-child.web';\nimport toolWorkflow from '../src/extensions/workspaces/sessions/(frontend)/tool/workflow.web';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T => {\n if (value === undefined) return undefined as T;\n const declaration = value as { relations?: readonly Record<string, unknown>[] };\n return { ...identity, ...declaration, ...(declaration.relations === undefined ? {} : {\n relations: declaration.relations.map((relation) => ({ evidence: 'declared', ...relation })),\n }) } as T;\n};\n\nexport const webPlugin = defineWebPlugin({\n id: 'workflows',\n packageName: '@agimon-ai/po-workflow',\n workspace: {\n get dockFaces(): WebPluginContributions['dockFaces'] { return [via({ id: 'workflow' }, dockWorkflow)]; },\n get fills(): WebPluginContributions['fills'] { return [via({ slot: 'conversation-strip', id: 'step-parent' }, fillStepParent), via({ slot: 'home', id: 'workflows' }, fillWorkflows)]; },\n },\n session: {\n get activityGroups(): WebPluginContributions['activityGroups'] { return [via({ name: 'workflows' }, activityGroupWorkflows)]; },\n get channels(): WebPluginContributions['channels'] { return [via({ channel: 'dynamic_workflow_runs' }, channelDynamicWorkflowRuns), via({ channel: 'workflow_catalog' }, channelWorkflowCatalog), via({ channel: 'workflow_runs' }, channelWorkflowRuns)]; },\n get contextActions(): WebPluginContributions['contextActions'] { return [via({ id: 'launch-workflow' }, actionLaunchWorkflow)]; },\n get fills(): WebPluginContributions['fills'] { return [via({ slot: 'overlay', id: 'workflow-launcher' }, fillWorkflowLauncher), via({ slot: 'activity.workflows', id: 'workflows' }, fillWorkflows2), via({ slot: 'artifacts.source', id: 'workflows' }, fillWorkflows3), via({ slot: 'help.guides', id: 'workflows' }, fillWorkflows4)]; },\n get leaderBindings(): WebPluginContributions['leaderBindings'] { return [via({ id: 'workflows.catalog' }, leaderCatalog)]; },\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['workflow_child'] }, toolWorkflowChild), via({ tools: ['workflow'] }, toolWorkflow)]; },\n },\n});\n"],"mappings":";;;;;;;AAiDA,MAAa,sBAAsB;AAwHnC,MAAa,qBAAqB;AA2DlC,MAAa,wBAAwB;;;;;;;ACrNrC,SAAgB,UAAU,YAAwC,WAAiD;CACjH,IAAI,cAAc,MAAM,OAAO,KAAA;CAC/B,IAAI;CACJ,KAAK,MAAM,OAAO,YAChB,KAAK,MAAM,OAAO,IAAI,MAAM;EAC1B,MAAM,OAAO,IAAI,MAAM,MAAM,UAAU,MAAM,KAAK,SAAA,aAAkC,MAAM,IAAI,OAAO,SAAS;EAC9G,IAAI,SAAS,KAAA,GAAW;EACxB,IAAI,UAAU,KAAA,KAAa,KAAK,MAAM,IAAI,SAAS,IAAI,KAAK,MAAM,MAAM,IAAI,SAAS,GACnF,QAAQ;GAAE;GAAK,KAAK,IAAI;GAAM,UAAU,SAAS,KAAK,IAAI,IAAI;GAAG,MAAM,KAAK;EAAK;CACrF;CAEF,OAAO;AACT;;AAGA,SAAS,SAAS,KAAsB,KAAqB;CAC3D,KAAK,MAAM,EAAE,iBAAiB,IAAI,YAAY,CAAC,GAC7C,KAAK,MAAM,SAAS,aAAa,IAAI,GAAG,MAAM,IAAI,GAAG,MAAM,mBAAmB,KAAK,OAAO,MAAM;CAClG,OAAO;AACT;;;;;;;;AC7BA,MAAM,YAAY;AAClB,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