agent-relay-server 0.94.6 → 0.95.1
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/docs/openapi.json +1 -1
- package/package.json +2 -2
- package/public/assets/MessageBubble-CkPnAwxJ.js +3 -0
- package/public/assets/{MessageBubble-g4NKZBDI.js.map → MessageBubble-CkPnAwxJ.js.map} +1 -1
- package/public/assets/{PlanGraphPanel-Chydc7yG.js → PlanGraphPanel-DPgW_Ohe.js} +2 -2
- package/public/assets/{PlanGraphPanel-Chydc7yG.js.map → PlanGraphPanel-DPgW_Ohe.js.map} +1 -1
- package/public/assets/{activity-BXLw6f9y.js → activity-CRebaL8O.js} +2 -2
- package/public/assets/{activity-BXLw6f9y.js.map → activity-CRebaL8O.js.map} +1 -1
- package/public/assets/{agent-profiles-B6PsZZmM.js → agent-profiles-BFpEQHKo.js} +2 -2
- package/public/assets/{agent-profiles-B6PsZZmM.js.map → agent-profiles-BFpEQHKo.js.map} +1 -1
- package/public/assets/{agents-B0POygaD.js → agents-7WtV1Pf3.js} +2 -2
- package/public/assets/{agents-B0POygaD.js.map → agents-7WtV1Pf3.js.map} +1 -1
- package/public/assets/{analytics-B50LtRMU.js → analytics-DpnJh9UQ.js} +3 -3
- package/public/assets/{analytics-B50LtRMU.js.map → analytics-DpnJh9UQ.js.map} +1 -1
- package/public/assets/{automation-CeYilS-s.js → automation-CjQNCXlO.js} +2 -2
- package/public/assets/{automation-CeYilS-s.js.map → automation-CjQNCXlO.js.map} +1 -1
- package/public/assets/{badge-CcTIPkUa.js → badge-BbfOskRI.js} +2 -2
- package/public/assets/{badge-CcTIPkUa.js.map → badge-BbfOskRI.js.map} +1 -1
- package/public/assets/branch-state-badge-BcObk0ca.js +2 -0
- package/public/assets/{branch-state-badge-T6t16OU5.js.map → branch-state-badge-BcObk0ca.js.map} +1 -1
- package/public/assets/{button-Dvz6HZ1j.js → button-DWiw--lT.js} +2 -2
- package/public/assets/{button-Dvz6HZ1j.js.map → button-DWiw--lT.js.map} +1 -1
- package/public/assets/{card-xVEUTFuh.js → card-BeqvuYTT.js} +2 -2
- package/public/assets/{card-xVEUTFuh.js.map → card-BeqvuYTT.js.map} +1 -1
- package/public/assets/channels-B2bftzgH.js +2 -0
- package/public/assets/{channels-C0J-VHEa.js.map → channels-B2bftzgH.js.map} +1 -1
- package/public/assets/chat-Dcwua_5V.js +2 -0
- package/public/assets/chat-Dcwua_5V.js.map +1 -0
- package/public/assets/{connectors-P5V_DlvA.js → connectors-CJOJirYT.js} +2 -2
- package/public/assets/{connectors-P5V_DlvA.js.map → connectors-CJOJirYT.js.map} +1 -1
- package/public/assets/copy-button-CIXy8ks6.js +2 -0
- package/public/assets/{copy-button-gB8Wc3dh.js.map → copy-button-CIXy8ks6.js.map} +1 -1
- package/public/assets/display-DRiGi1zj.js.map +1 -1
- package/public/assets/{dist-DbJ0cYxd.js → dist-BQXmO19g.js} +2 -2
- package/public/assets/{dist-DbJ0cYxd.js.map → dist-BQXmO19g.js.map} +1 -1
- package/public/assets/{dist-CE9yg7LH.js → dist-BufB2Xy_.js} +2 -2
- package/public/assets/{dist-CE9yg7LH.js.map → dist-BufB2Xy_.js.map} +1 -1
- package/public/assets/dist-CXkmW1Od.js +2 -0
- package/public/assets/{dist-4Joy6mhT.js.map → dist-CXkmW1Od.js.map} +1 -1
- package/public/assets/{dist-DoHTwsqW.js → dist-CbxR2pzD.js} +2 -2
- package/public/assets/{dist-DoHTwsqW.js.map → dist-CbxR2pzD.js.map} +1 -1
- package/public/assets/{dist-Cu5eOAWz.js → dist-CtuS_3Jl.js} +2 -2
- package/public/assets/{dist-Cu5eOAWz.js.map → dist-CtuS_3Jl.js.map} +1 -1
- package/public/assets/{dist-CVWxY_y8.js → dist-Du_bcq-z.js} +2 -2
- package/public/assets/{dist-CVWxY_y8.js.map → dist-Du_bcq-z.js.map} +1 -1
- package/public/assets/{dist-BkHh9GoG.js → dist-KxiSP9h9.js} +2 -2
- package/public/assets/{dist-BkHh9GoG.js.map → dist-KxiSP9h9.js.map} +1 -1
- package/public/assets/dist-LFuRypZd.js +2 -0
- package/public/assets/{dist-4O7O9HEE.js.map → dist-LFuRypZd.js.map} +1 -1
- package/public/assets/dist-Q6OOS84U.js +2 -0
- package/public/assets/{dist-B2WymQRX.js.map → dist-Q6OOS84U.js.map} +1 -1
- package/public/assets/{dist-B5OjWLDL.js → dist-eG_93I3z.js} +2 -2
- package/public/assets/{dist-B5OjWLDL.js.map → dist-eG_93I3z.js.map} +1 -1
- package/public/assets/{dist-XUy-xPl6.js → dist-zTw85jD8.js} +2 -2
- package/public/assets/{dist-XUy-xPl6.js.map → dist-zTw85jD8.js.map} +1 -1
- package/public/assets/{es2015-Dv7v8EgR.js → es2015-ibwCE_JR.js} +2 -2
- package/public/assets/{es2015-Dv7v8EgR.js.map → es2015-ibwCE_JR.js.map} +1 -1
- package/public/assets/{formatted-body-impl-B8xoPLk0.js → formatted-body-impl-CGACmUqI.js} +2 -2
- package/public/assets/{formatted-body-impl-B8xoPLk0.js.map → formatted-body-impl-CGACmUqI.js.map} +1 -1
- package/public/assets/index-CKPsJqiW.css +2 -0
- package/public/assets/index-CwhhpGgX.js +23 -0
- package/public/assets/index-CwhhpGgX.js.map +1 -0
- package/public/assets/{input-CWYjJ4Bn.js → input-DUdtS3nG.js} +2 -2
- package/public/assets/{input-CWYjJ4Bn.js.map → input-DUdtS3nG.js.map} +1 -1
- package/public/assets/{insights-O02aG6Fa.js → insights-DqXjTYai.js} +2 -2
- package/public/assets/{insights-O02aG6Fa.js.map → insights-DqXjTYai.js.map} +1 -1
- package/public/assets/{integrations-COYT1FSR.js → integrations-DEgLatDv.js} +2 -2
- package/public/assets/{integrations-COYT1FSR.js.map → integrations-DEgLatDv.js.map} +1 -1
- package/public/assets/{lib-C6ShgLFg.js → lib-Gp69YB9e.js} +3 -3
- package/public/assets/{lib-C6ShgLFg.js.map → lib-Gp69YB9e.js.map} +1 -1
- package/public/assets/lucide-react-uFIMC7W7.js +9 -0
- package/public/assets/{lucide-react-BMjjWU36.js.map → lucide-react-uFIMC7W7.js.map} +1 -1
- package/public/assets/{maintenance-CsaxFb2K.js → maintenance-CcFJlNxt.js} +2 -2
- package/public/assets/{maintenance-CsaxFb2K.js.map → maintenance-CcFJlNxt.js.map} +1 -1
- package/public/assets/{managed-agents-BkMSa35M.js → managed-agents-CHR4Hx1O.js} +4 -4
- package/public/assets/{managed-agents-BkMSa35M.js.map → managed-agents-CHR4Hx1O.js.map} +1 -1
- package/public/assets/{markdown-preview-impl-CPUObdGL.js → markdown-preview-impl-BHaUcnfn.js} +2 -2
- package/public/assets/{markdown-preview-impl-CPUObdGL.js.map → markdown-preview-impl-BHaUcnfn.js.map} +1 -1
- package/public/assets/{memory-Bc9b5aFW.js → memory-Uk0VfqnC.js} +2 -2
- package/public/assets/{memory-Bc9b5aFW.js.map → memory-Uk0VfqnC.js.map} +1 -1
- package/public/assets/{messages-DDUpkDDo.js → messages-D_juCBfr.js} +2 -2
- package/public/assets/{messages-DDUpkDDo.js.map → messages-D_juCBfr.js.map} +1 -1
- package/public/assets/{orchestrators-CTiypI_B.js → orchestrators-8IrmgeHV.js} +2 -2
- package/public/assets/{orchestrators-CTiypI_B.js.map → orchestrators-8IrmgeHV.js.map} +1 -1
- package/public/assets/{overview-DT05JmLC.js → overview-D_DM0QHJ.js} +2 -2
- package/public/assets/{overview-DT05JmLC.js.map → overview-D_DM0QHJ.js.map} +1 -1
- package/public/assets/{pairs-VlxzegP3.js → pairs-jciDuPLn.js} +2 -2
- package/public/assets/{pairs-VlxzegP3.js.map → pairs-jciDuPLn.js.map} +1 -1
- package/public/assets/{projects-5xutbu4r.js → projects-C-QHyuMD.js} +2 -2
- package/public/assets/{projects-5xutbu4r.js.map → projects-C-QHyuMD.js.map} +1 -1
- package/public/assets/{react-dom-D1K8FBqJ.js → react-dom-DF2cuNaf.js} +2 -2
- package/public/assets/{react-dom-D1K8FBqJ.js.map → react-dom-DF2cuNaf.js.map} +1 -1
- package/public/assets/{registry-dClAc8d-.js → registry-D1EIvc8U.js} +2 -2
- package/public/assets/{registry-dClAc8d-.js.map → registry-D1EIvc8U.js.map} +1 -1
- package/public/assets/{security-sGs_RWhJ.js → security-C0_Df9yI.js} +2 -2
- package/public/assets/{security-sGs_RWhJ.js.map → security-C0_Df9yI.js.map} +1 -1
- package/public/assets/{select-AzzgLRfk.js → select-CXFXPZ7Z.js} +2 -2
- package/public/assets/{select-AzzgLRfk.js.map → select-CXFXPZ7Z.js.map} +1 -1
- package/public/assets/settings-DGPpdFoq.js +6 -0
- package/public/assets/{settings-A0LUC7z3.js.map → settings-DGPpdFoq.js.map} +1 -1
- package/public/assets/store-d-IbqTaD.js +9 -0
- package/public/assets/store-d-IbqTaD.js.map +1 -0
- package/public/assets/{tasks-QfihaEd7.js → tasks-B_epVa5b.js} +2 -2
- package/public/assets/{tasks-QfihaEd7.js.map → tasks-B_epVa5b.js.map} +1 -1
- package/public/assets/teams-D2hATpCD.js +2 -0
- package/public/assets/{teams-yi_-_mib.js.map → teams-D2hATpCD.js.map} +1 -1
- package/public/assets/{terminal-viewer-impl-BuXn1PG3.js → terminal-viewer-impl-CefeetWa.js} +3 -3
- package/public/assets/{terminal-viewer-impl-BuXn1PG3.js.map → terminal-viewer-impl-CefeetWa.js.map} +1 -1
- package/public/assets/types-Tv67voFu.js.map +1 -1
- package/public/assets/{use-keyboard-viewport-BAtKHKT6.js → use-keyboard-viewport-CeLM-PeW.js} +2 -2
- package/public/assets/{use-keyboard-viewport-BAtKHKT6.js.map → use-keyboard-viewport-CeLM-PeW.js.map} +1 -1
- package/public/assets/{user-avatar-D5hoY3pJ.js → user-avatar-BOGZ21O8.js} +2 -2
- package/public/assets/{user-avatar-D5hoY3pJ.js.map → user-avatar-BOGZ21O8.js.map} +1 -1
- package/public/assets/{work-queue-pZe5uRpJ.js → work-queue-C9wBOivX.js} +2 -2
- package/public/assets/{work-queue-pZe5uRpJ.js.map → work-queue-C9wBOivX.js.map} +1 -1
- package/public/assets/{workspaces-DVh1TmHX.js → workspaces-DKFmnOF8.js} +3 -3
- package/public/assets/{workspaces-DVh1TmHX.js.map → workspaces-DKFmnOF8.js.map} +1 -1
- package/public/index.html +21 -21
- package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/src/agent-busy-health.ts +45 -3
- package/src/codex-wham-quota.ts +4 -1
- package/src/config-store.ts +16 -5
- package/src/config.ts +7 -0
- package/src/db/provider-quotas.ts +60 -15
- package/src/mcp/index.ts +22 -0
- package/src/runtime-tokens.ts +3 -1
- package/public/assets/MessageBubble-g4NKZBDI.js +0 -3
- package/public/assets/branch-state-badge-T6t16OU5.js +0 -2
- package/public/assets/channels-C0J-VHEa.js +0 -2
- package/public/assets/chat-KKQrWEE_.js +0 -2
- package/public/assets/chat-KKQrWEE_.js.map +0 -1
- package/public/assets/copy-button-gB8Wc3dh.js +0 -2
- package/public/assets/dist-4Joy6mhT.js +0 -2
- package/public/assets/dist-4O7O9HEE.js +0 -2
- package/public/assets/dist-B2WymQRX.js +0 -2
- package/public/assets/index-D9oZL47o.js +0 -23
- package/public/assets/index-D9oZL47o.js.map +0 -1
- package/public/assets/index-DcyinRQU.css +0 -2
- package/public/assets/lucide-react-BMjjWU36.js +0 -9
- package/public/assets/settings-A0LUC7z3.js +0 -6
- package/public/assets/store-Bfl3XVmS.js +0 -9
- package/public/assets/store-Bfl3XVmS.js.map +0 -1
- package/public/assets/teams-yi_-_mib.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspaces-DVh1TmHX.js","names":[],"sources":["../../dashboard/src/components/views/workspaces.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from 'react'\nimport { ArchiveRestore, ArrowDown, ArrowUp, Check, ChevronDown, ChevronRight, Clock, Eye, FileDiff, FilePen, Flag, FolderOpen, GitBranch, GitCommitHorizontal, GitMerge, PackageOpen, RefreshCw, TriangleAlert, Trash2, X } from 'lucide-react'\nimport { TERMINAL_WORKSPACE_STATUS_VALUES } from 'agent-relay-sdk/types'\nimport { useRelayStore, useNow } from '@/store'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { CopyButton } from '@/components/shared/copy-button'\nimport { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'\nimport { displayName, timeAgo } from '@/lib/display'\nimport type { Agent, WorkspaceOrphan, WorkspaceRecord, WorkspaceStatus } from '@/types'\n\nconst LIVE_STATUSES = new Set<WorkspaceStatus>(['active', 'ready', 'conflict', 'review_requested', 'merge_planned', 'cleanup_requested'])\nconst GIT_STATE_STATUSES = new Set<WorkspaceStatus>(['active', 'ready', 'conflict', 'review_requested', 'merge_planned'])\nconst MERGEABLE_STATUSES = new Set<WorkspaceStatus>(['active', 'ready', 'review_requested', 'merge_planned', 'conflict'])\n\ntype WorkspaceFilter = 'active' | 'cleaned' | 'all'\n\nconst STATUS_CLASS: Record<WorkspaceStatus, string> = {\n active: 'bg-blue-500/10 text-blue-400 border-blue-500/20',\n ready: 'bg-emerald-500/10 text-emerald-400 border-emerald-500/20',\n conflict: 'bg-red-500/10 text-red-400 border-red-500/20',\n review_requested: 'bg-yellow-500/10 text-yellow-400 border-yellow-500/20',\n merge_planned: 'bg-indigo-500/10 text-indigo-400 border-indigo-500/20',\n merged: 'bg-violet-500/10 text-violet-400 border-violet-500/20',\n abandoned: 'bg-zinc-500/10 text-zinc-400 border-zinc-500/20',\n cleanup_requested: 'bg-orange-500/10 text-orange-400 border-orange-500/20',\n cleaned: 'bg-zinc-500/10 text-zinc-400 border-zinc-500/20',\n}\n\nconst STATUS_LABEL: Record<WorkspaceStatus, string> = {\n active: 'active',\n ready: 'ready',\n conflict: 'conflict',\n review_requested: 'review',\n merge_planned: 'merge planned',\n merged: 'merged',\n abandoned: 'abandoned',\n cleanup_requested: 'cleanup',\n cleaned: 'cleaned',\n}\n\nconst STATUS_ORDER: Record<WorkspaceStatus, number> = {\n conflict: 0,\n ready: 1,\n review_requested: 2,\n merge_planned: 3,\n active: 4,\n cleanup_requested: 5,\n merged: 6,\n abandoned: 7,\n cleaned: 8,\n}\n\nconst TERMINAL_STATUSES = new Set<WorkspaceStatus>(TERMINAL_WORKSPACE_STATUS_VALUES)\n\nfunction shortPath(path: string): string {\n const parts = path.split('/').filter(Boolean)\n if (parts.length <= 3) return path || '-'\n return `/${parts.slice(-3).join('/')}`\n}\n\nfunction agentLabel(agent: Agent | undefined, fallback: string | undefined): string {\n if (agent) return displayName(agent)\n return fallback || '-'\n}\n\nfunction statusTone(status: WorkspaceStatus): string {\n return STATUS_CLASS[status] || 'bg-zinc-500/10 text-zinc-400 border-zinc-500/20'\n}\n\nfunction workspaceSort(a: WorkspaceRecord, b: WorkspaceRecord): number {\n const status = (STATUS_ORDER[a.status] ?? 99) - (STATUS_ORDER[b.status] ?? 99)\n if (status !== 0) return status\n return Number(b.updatedAt || 0) - Number(a.updatedAt || 0)\n}\n\nfunction groupWorkspaces(workspaces: WorkspaceRecord[]): Array<{ repoRoot: string; workspaces: WorkspaceRecord[] }> {\n const grouped = new Map<string, WorkspaceRecord[]>()\n for (const workspace of workspaces) {\n const key = workspace.repoRoot || workspace.sourceCwd || 'unknown repo'\n grouped.set(key, [...(grouped.get(key) || []), workspace])\n }\n return [...grouped.entries()]\n .map(([repoRoot, items]) => ({ repoRoot, workspaces: items.sort(workspaceSort) }))\n .sort((a, b) => {\n const liveA = a.workspaces.some((item) => LIVE_STATUSES.has(item.status))\n const liveB = b.workspaces.some((item) => LIVE_STATUSES.has(item.status))\n if (liveA !== liveB) return liveA ? -1 : 1\n return a.repoRoot.localeCompare(b.repoRoot)\n })\n}\n\nfunction filterWorkspaces(workspaces: WorkspaceRecord[], filter: WorkspaceFilter): WorkspaceRecord[] {\n if (filter === 'all') return workspaces\n if (filter === 'cleaned') return workspaces.filter((workspace) => TERMINAL_STATUSES.has(workspace.status))\n return workspaces.filter((workspace) => !TERMINAL_STATUSES.has(workspace.status))\n}\n\nfunction WorkspaceActions({ workspace, expanded, onToggleDetails }: { workspace: WorkspaceRecord; expanded: boolean; onToggleDetails: () => void }) {\n const workspaceAction = useRelayStore((s) => s.workspaceAction)\n const purgeWorkspace = useRelayStore((s) => s.purgeWorkspace)\n const fetchWorkspaceMergePreview = useRelayStore((s) => s.fetchWorkspaceMergePreview)\n const openFilesAt = useRelayStore((s) => s.openFilesAt)\n const terminal = workspace.status === 'cleaned' || workspace.status === 'merged' || workspace.status === 'abandoned'\n const disabled = terminal || workspace.status === 'cleanup_requested'\n const openPath = workspace.worktreePath || workspace.sourceCwd || workspace.repoRoot\n // Already-landed work (squash/cherry-pick) has nothing left to merge — a merge\n // would open a duplicate/no-op PR, so disable the button.\n const gitState = useRelayStore((s) => s.workspaceGitState[workspace.id])\n const landed = !!gitState && gitState.available !== false && gitState.landed === true\n const mergeable = workspace.mode === 'isolated' && Boolean(workspace.worktreePath) && MERGEABLE_STATUSES.has(workspace.status) && !landed\n\n // Refresh the preview so the confirm dialog states the strategy/outcome, then\n // dispatch the real merge command.\n async function merge() {\n await fetchWorkspaceMergePreview(workspace.id)\n await workspaceAction(workspace.id, 'merge')\n }\n\n return (\n <div className=\"flex flex-wrap justify-end gap-1.5\">\n <Button size=\"icon-sm\" variant=\"ghost\" title={expanded ? 'Hide details' : 'Show diff & timeline'} onClick={onToggleDetails}>\n {expanded ? <ChevronDown className=\"h-3.5 w-3.5\" /> : <ChevronRight className=\"h-3.5 w-3.5\" />}\n </Button>\n <Button\n size=\"icon-sm\"\n variant=\"ghost\"\n title=\"Open workspace\"\n disabled={!openPath || workspace.status === 'cleaned'}\n onClick={() => void openFilesAt({ path: openPath })}\n >\n <FolderOpen className=\"h-3.5 w-3.5\" />\n </Button>\n <CopyButton value={openPath} label=\"Copy path\" copiedLabel=\"Copied path\" size=\"icon-sm\" variant=\"ghost\" disabled={!openPath} />\n <Button size=\"icon-sm\" variant=\"outline\" title=\"Mark ready\" disabled={disabled || workspace.status === 'ready'} onClick={() => void workspaceAction(workspace.id, 'ready')}>\n <Check className=\"h-3.5 w-3.5\" />\n </Button>\n <Button size=\"icon-sm\" variant=\"outline\" title=\"Request review\" disabled={disabled || workspace.status === 'review_requested'} onClick={() => void workspaceAction(workspace.id, 'request-review')}>\n <Eye className=\"h-3.5 w-3.5\" />\n </Button>\n <Button size=\"icon-sm\" variant=\"outline\" title=\"Mark merge planned\" disabled={disabled || workspace.status === 'merge_planned'} onClick={() => void workspaceAction(workspace.id, 'merge-plan')}>\n <Flag className=\"h-3.5 w-3.5\" />\n </Button>\n <Button size=\"icon-sm\" variant=\"default\" title={landed ? 'Already merged into base — nothing to land' : 'Merge & land work'} disabled={!mergeable} onClick={() => void merge()}>\n <GitMerge className=\"h-3.5 w-3.5\" />\n </Button>\n <Button size=\"icon-sm\" variant=\"outline\" title=\"Request cleanup (removes the worktree on the host)\" disabled={workspace.status === 'cleaned' || workspace.status === 'cleanup_requested'} onClick={() => void workspaceAction(workspace.id, 'cleanup')}>\n <Trash2 className=\"h-3.5 w-3.5\" />\n </Button>\n {terminal && (\n <Button size=\"icon-sm\" variant=\"ghost\" title=\"Purge record (clears the row, does not touch disk)\" onClick={() => void purgeWorkspace(workspace.id)}>\n <X className=\"h-3.5 w-3.5\" />\n </Button>\n )}\n </div>\n )\n}\n\n// Pre-merge conflict hint, shown next to git state when the worktree has work to\n// land. Lazily fetched from the owning host (an external sync), so an effect is\n// the right tool. Reports clean-ff vs would-conflict before the user merges.\nfunction MergePreviewHint({ workspace, unmerged }: { workspace: WorkspaceRecord; unmerged: number }) {\n const preview = useRelayStore((s) => s.workspaceMergePreview[workspace.id])\n const fetchWorkspaceMergePreview = useRelayStore((s) => s.fetchWorkspaceMergePreview)\n const eligible = unmerged > 0 && MERGEABLE_STATUSES.has(workspace.status)\n\n useEffect(() => {\n if (eligible && preview === undefined) void fetchWorkspaceMergePreview(workspace.id)\n }, [eligible, preview, workspace.id, fetchWorkspaceMergePreview])\n\n if (!eligible || preview === undefined || preview.available === false) return null\n if (preview.conflict) {\n return (\n <span className=\"flex items-center gap-0.5 text-amber-400\" title={`Merging into ${preview.baseRef || 'base'} would conflict — resolve before merging`}>\n <TriangleAlert className=\"h-3 w-3\" />conflict\n </span>\n )\n }\n if (preview.conflict === false) {\n return (\n <span className=\"flex items-center gap-0.5 text-emerald-400\" title={`Clean to merge via ${preview.strategy === 'pr' ? 'PR' : 'rebase + fast-forward'} into ${preview.baseRef || 'base'}`}>\n <Check className=\"h-3 w-3\" />{preview.strategy === 'pr' ? 'PR ready' : 'clean'}\n </span>\n )\n }\n return null\n}\n\n// Live git state of the worktree, fetched lazily from the owning host. This is\n// an external-system sync (host git over the orchestrator proxy), so an effect\n// is the right tool — it does not derive state from props.\nfunction GitState({ workspace }: { workspace: WorkspaceRecord }) {\n const now = useNow()\n const gitState = useRelayStore((s) => s.workspaceGitState[workspace.id])\n const fetchWorkspaceGitState = useRelayStore((s) => s.fetchWorkspaceGitState)\n const eligible = workspace.mode === 'isolated' && Boolean(workspace.worktreePath) && GIT_STATE_STATUSES.has(workspace.status)\n\n useEffect(() => {\n if (eligible && gitState === undefined) void fetchWorkspaceGitState(workspace.id)\n }, [eligible, gitState, workspace.id, fetchWorkspaceGitState])\n\n if (!eligible) return null\n\n const refresh = (\n <Button\n size=\"icon-sm\"\n variant=\"ghost\"\n className=\"h-5 w-5\"\n title=\"Refresh git state\"\n onClick={() => void fetchWorkspaceGitState(workspace.id)}\n >\n <RefreshCw className=\"h-3 w-3\" />\n </Button>\n )\n\n if (gitState === undefined) {\n return <div className=\"flex items-center gap-1 text-[11px] text-muted-foreground\">Loading git state…</div>\n }\n if (gitState.available === false) {\n return (\n <div className=\"flex items-center gap-1 text-[11px] text-muted-foreground\" title={gitState.reason}>\n <span>git state unavailable</span>\n {refresh}\n </div>\n )\n }\n if (gitState.missing) {\n return <div className=\"flex items-center gap-1 text-[11px] text-muted-foreground\">worktree gone {refresh}</div>\n }\n if (gitState.error) {\n return (\n <div className=\"flex items-center gap-1 text-[11px] text-red-400\" title={gitState.error}>\n <span>git error</span>\n {refresh}\n </div>\n )\n }\n\n const ahead = gitState.ahead ?? 0\n // Work squash/cherry-pick-merged into base leaves `ahead` positive but is\n // effectively landed — surface the unmerged count, not the raw ahead.\n const landed = gitState.landed === true\n const unmerged = landed ? 0 : (gitState.unmergedAhead ?? ahead)\n const behind = gitState.behind ?? 0\n const dirty = gitState.dirtyCount ?? 0\n const clean = unmerged === 0 && dirty === 0 && !landed\n const commit = gitState.lastCommit\n\n return (\n <div className=\"space-y-0.5\">\n <div className=\"flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11px]\">\n {clean ? (\n <span className=\"text-muted-foreground\">no unmerged work</span>\n ) : (\n <>\n {landed ? (\n <span className=\"flex items-center gap-0.5 text-emerald-400\" title={`Work already landed in ${gitState.baseRef || 'base'} via squash/cherry-pick — safe to clean up`}>\n <Check className=\"h-3 w-3\" />landed\n </span>\n ) : (\n <span className={unmerged > 0 ? 'flex items-center text-emerald-400' : 'flex items-center text-muted-foreground'} title={ahead !== unmerged ? `${unmerged} unmerged commit(s) (${ahead} ahead of base)` : `${unmerged} commit(s) ahead of base`}>\n <ArrowUp className=\"h-3 w-3\" />{unmerged}\n </span>\n )}\n <span className={behind > 0 ? 'flex items-center text-amber-400' : 'flex items-center text-muted-foreground'} title={`${behind} commit(s) behind base`}>\n <ArrowDown className=\"h-3 w-3\" />{behind}\n </span>\n {dirty > 0 && (\n <span className=\"flex items-center text-orange-400\" title={`${dirty} uncommitted change(s)`}>\n <FilePen className=\"h-3 w-3\" />{dirty}\n </span>\n )}\n {!landed && <MergePreviewHint workspace={workspace} unmerged={unmerged} />}\n </>\n )}\n {refresh}\n </div>\n {commit && (\n <div className=\"flex min-w-0 items-center gap-1 text-[11px] text-muted-foreground\" title={`${commit.sha.slice(0, 8)} — ${commit.message}`}>\n <GitCommitHorizontal className=\"h-3 w-3 shrink-0\" />\n <span className=\"truncate\">{commit.message || commit.sha.slice(0, 8)}</span>\n {commit.at ? <span className=\"shrink-0 opacity-70\">· {timeAgo(now, commit.at)}</span> : null}\n </div>\n )}\n </div>\n )\n}\n\n// Lifecycle timeline from the timestamps the relay already records:\n// created → ready → merged → cleaned. Surfaces history without a drawer.\nfunction WorkspaceTimeline({ workspace }: { workspace: WorkspaceRecord }) {\n const now = useNow()\n const mergedAt = typeof workspace.metadata?.mergedAt === 'number' ? (workspace.metadata.mergedAt as number) : undefined\n const steps = [\n { label: 'created', at: workspace.createdAt },\n { label: 'ready', at: workspace.readyAt },\n { label: 'merged', at: mergedAt },\n { label: 'cleaned', at: workspace.cleanedAt },\n ].filter((step): step is { label: string; at: number } => typeof step.at === 'number' && step.at > 0)\n\n return (\n <div className=\"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground\">\n <span className=\"flex items-center gap-1 font-medium text-foreground\"><Clock className=\"h-3 w-3\" />Timeline</span>\n {steps.map((step, i) => (\n <span key={step.label} className=\"flex items-center gap-1\">\n {i > 0 && <span className=\"opacity-40\">→</span>}\n <span className=\"text-foreground\">{step.label}</span>\n <span title={new Date(step.at).toLocaleString()}>{timeAgo(now, step.at)}</span>\n </span>\n ))}\n </div>\n )\n}\n\nfunction diffLineClass(line: string): string {\n if (line.startsWith('+') && !line.startsWith('+++')) return 'text-emerald-400'\n if (line.startsWith('-') && !line.startsWith('---')) return 'text-red-400'\n if (line.startsWith('@@')) return 'text-cyan-400'\n if (line.startsWith('diff ') || line.startsWith('index ') || line.startsWith('+++') || line.startsWith('---')) return 'text-muted-foreground'\n return ''\n}\n\n// Diff of committed work against base, lazily fetched from the owning host.\nfunction WorkspaceDiffView({ workspace }: { workspace: WorkspaceRecord }) {\n const diff = useRelayStore((s) => s.workspaceDiff[workspace.id])\n const fetchWorkspaceDiff = useRelayStore((s) => s.fetchWorkspaceDiff)\n const eligible = workspace.mode === 'isolated' && Boolean(workspace.worktreePath)\n\n useEffect(() => {\n if (eligible && diff === undefined) void fetchWorkspaceDiff(workspace.id)\n }, [eligible, diff, workspace.id, fetchWorkspaceDiff])\n\n if (!eligible) return null\n if (diff === undefined) return <div className=\"text-[11px] text-muted-foreground\">Loading diff…</div>\n if (diff.available === false) return <div className=\"text-[11px] text-muted-foreground\">Diff unavailable{diff.reason ? `: ${diff.reason}` : ''}</div>\n if (diff.missing) return <div className=\"text-[11px] text-muted-foreground\">Worktree no longer on disk</div>\n if (diff.error) return <div className=\"text-[11px] text-red-400\">Diff error: {diff.error}</div>\n if (!diff.files.length) return <div className=\"text-[11px] text-muted-foreground\">No committed changes against {diff.baseRef || 'base'}</div>\n\n const refresh = (\n <Button size=\"icon-sm\" variant=\"ghost\" className=\"h-5 w-5\" title=\"Refresh diff\" onClick={() => void fetchWorkspaceDiff(workspace.id)}>\n <RefreshCw className=\"h-3 w-3\" />\n </Button>\n )\n\n return (\n <div className=\"space-y-1\">\n <div className=\"flex items-center gap-2 text-[11px] font-medium\">\n <FileDiff className=\"h-3 w-3\" />\n <span>{diff.files.length} file{diff.files.length === 1 ? '' : 's'} vs {diff.baseRef || 'base'}</span>\n {refresh}\n </div>\n <ul className=\"space-y-0.5 text-[11px]\">\n {diff.files.map((file) => (\n <li key={file.path} className=\"flex items-center gap-2 font-mono\">\n <span className=\"truncate\" title={file.path}>{file.path}</span>\n {file.binary ? (\n <span className=\"shrink-0 text-muted-foreground\">binary</span>\n ) : (\n <span className=\"shrink-0\">\n <span className=\"text-emerald-400\">+{file.additions ?? 0}</span>{' '}\n <span className=\"text-red-400\">−{file.deletions ?? 0}</span>\n </span>\n )}\n </li>\n ))}\n </ul>\n {diff.patch && (\n <pre className=\"max-h-80 overflow-auto rounded border border-border bg-muted/30 p-2 text-[10.5px] leading-relaxed\">\n {diff.patch.split('\\n').map((line, i) => (\n <div key={i} className={diffLineClass(line)}>{line || ' '}</div>\n ))}\n {diff.truncated && <div className=\"mt-1 text-muted-foreground\">… patch truncated</div>}\n </pre>\n )}\n </div>\n )\n}\n\nfunction WorkspaceDetails({ workspace }: { workspace: WorkspaceRecord }) {\n return (\n <div className=\"space-y-3 border-t border-dashed border-border bg-muted/20 px-3 py-3\">\n <WorkspaceTimeline workspace={workspace} />\n <WorkspaceDiffView workspace={workspace} />\n </div>\n )\n}\n\n// Worktrees on disk with no live workspace row — reclaimable in one click.\nfunction OrphanPanel() {\n const orphans = useRelayStore((s) => s.workspaceOrphans)\n const fetchWorkspaceOrphans = useRelayStore((s) => s.fetchWorkspaceOrphans)\n const reclaimWorkspaceOrphan = useRelayStore((s) => s.reclaimWorkspaceOrphan)\n\n useEffect(() => {\n void fetchWorkspaceOrphans()\n }, [fetchWorkspaceOrphans])\n\n if (!orphans.length) return null\n\n return (\n <Card className=\"border-amber-500/30\">\n <CardHeader className=\"px-4 py-3\">\n <div className=\"flex items-center gap-2\">\n <PackageOpen className=\"h-4 w-4 text-amber-400\" />\n <CardTitle className=\"text-sm font-medium\">Orphaned worktrees</CardTitle>\n <Badge variant=\"outline\" className=\"border-amber-500/30 text-amber-400 text-[10px]\">{orphans.length}</Badge>\n <Button size=\"icon-sm\" variant=\"ghost\" className=\"ml-auto h-6 w-6\" title=\"Rescan\" onClick={() => void fetchWorkspaceOrphans()}>\n <RefreshCw className=\"h-3.5 w-3.5\" />\n </Button>\n </div>\n <p className=\"mt-1 text-xs text-muted-foreground\">Agent worktrees on disk with no live workspace. Reclaim removes them from the host.</p>\n </CardHeader>\n <CardContent className=\"p-0\">\n {orphans.map((orphan) => (\n <div key={orphan.worktreePath} className=\"flex items-center gap-3 border-t border-border px-4 py-2 text-xs\">\n <GitBranch className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"truncate font-medium\" title={orphan.branch}>{orphan.branch || '(detached)'}</span>\n <span className=\"truncate font-mono text-muted-foreground\" title={orphan.worktreePath}>{shortPath(orphan.worktreePath)}</span>\n {orphan.hadTerminalRow && <Badge variant=\"outline\" className=\"text-[10px]\">cleanup failed</Badge>}\n <Button size=\"sm\" variant=\"outline\" className=\"ml-auto h-7 text-xs\" onClick={() => void reclaimWorkspaceOrphan(orphan)}>\n <ArchiveRestore className=\"mr-1 h-3.5 w-3.5\" />Reclaim\n </Button>\n </div>\n ))}\n </CardContent>\n </Card>\n )\n}\n\n// A `pr`-strategy merge lands as an opened PR, not a local fast-forward, so the\n// outcome only shows up here — surface the PR link and any error the orchestrator\n// returned (which the command layer keeps in result even when status=succeeded).\nfunction prLabel(url: string): string {\n const match = url.match(/\\/pull\\/(\\d+)/)\n return match ? `PR #${match[1]}` : 'View PR'\n}\n\nfunction MergeOutcome({ workspace }: { workspace: WorkspaceRecord }) {\n const result = workspace.metadata?.mergeResult as { prUrl?: string; error?: string } | undefined\n const prUrl = result?.prUrl\n const error = result?.error || (workspace.metadata?.mergeError as string | undefined)\n if (!prUrl && !error) return null\n return (\n <>\n {prUrl && (\n <a\n href={prUrl}\n target=\"_blank\"\n rel=\"noreferrer\"\n title={prUrl}\n className=\"inline-flex items-center gap-0.5 rounded border border-violet-500/30 px-1.5 py-0 text-[10px] text-violet-400 hover:text-violet-300\"\n >\n <GitMerge className=\"h-2.5 w-2.5\" />{prLabel(prUrl)}\n </a>\n )}\n {error && (\n <Badge variant=\"outline\" className=\"max-w-[16rem] border-amber-500/30 text-amber-400 text-[10px]\" title={error}>\n <TriangleAlert className=\"mr-0.5 h-2.5 w-2.5 shrink-0\" /><span className=\"truncate\">merge: {error}</span>\n </Badge>\n )}\n </>\n )\n}\n\nfunction WorkspaceRow({ workspace }: { workspace: WorkspaceRecord }) {\n const now = useNow()\n const [expanded, setExpanded] = useState(false)\n const agentsById = useRelayStore((s) => s.agentsById)\n const focused = useRelayStore((s) => s.workspaceFocusId === workspace.id)\n const owner = workspace.ownerAgentId ? agentsById[workspace.ownerAgentId] : undefined\n const steward = workspace.stewardAgentId ? agentsById[workspace.stewardAgentId] : undefined\n const path = workspace.worktreePath || workspace.sourceCwd || workspace.repoRoot\n const rowRef = useRef<HTMLDivElement>(null)\n\n // Click-through landing (#236): scroll the targeted row into view once it mounts.\n useEffect(() => {\n if (focused) rowRef.current?.scrollIntoView({ behavior: 'smooth', block: 'center' })\n }, [focused])\n\n return (\n <div ref={rowRef} className={`border-t border-border ${focused ? 'bg-primary/5 ring-1 ring-inset ring-primary/40' : ''}`}>\n <div className=\"grid gap-3 px-3 py-3 text-sm lg:grid-cols-[minmax(180px,1.2fr)_minmax(220px,1.5fr)_minmax(160px,1fr)_minmax(170px,auto)]\">\n <div className=\"min-w-0 space-y-1\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <GitBranch className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"truncate font-medium\" title={workspace.branch || workspace.id}>{workspace.branch || workspace.id}</span>\n </div>\n <div className=\"flex flex-wrap gap-1\">\n <Badge variant=\"outline\" className={`text-[10px] ${workspace.mode === 'isolated' ? 'border-sky-500/30 text-sky-400' : 'border-zinc-500/30 text-zinc-400'}`}>\n {workspace.mode}\n </Badge>\n {workspace.requestedMode && workspace.requestedMode !== workspace.mode && (\n <Badge variant=\"outline\" className=\"text-[10px]\">requested {workspace.requestedMode}</Badge>\n )}\n <Badge variant=\"outline\" className={`text-[10px] ${statusTone(workspace.status)}`}>{STATUS_LABEL[workspace.status] || workspace.status}</Badge>\n <MergeOutcome workspace={workspace} />\n </div>\n </div>\n\n <div className=\"min-w-0 space-y-1\">\n <div className=\"truncate font-mono text-xs\" title={path}>{shortPath(path)}</div>\n <div className=\"truncate text-xs text-muted-foreground\" title={workspace.sourceCwd}>{workspace.sourceCwd}</div>\n <GitState workspace={workspace} />\n </div>\n\n <div className=\"grid grid-cols-[4.5rem_minmax(0,1fr)] gap-x-2 gap-y-1 text-xs\">\n <span className=\"text-muted-foreground\">Owner</span>\n <span className=\"truncate\" title={workspace.ownerAgentId}>{agentLabel(owner, workspace.ownerPolicyName || workspace.ownerAgentId)}</span>\n <span className=\"text-muted-foreground\">Steward</span>\n <span className=\"truncate\" title={workspace.stewardAgentId}>{agentLabel(steward, workspace.stewardAgentId)}</span>\n <span className=\"text-muted-foreground\">Updated</span>\n <span>{timeAgo(now, workspace.updatedAt)}</span>\n {workspace.baseRef && (\n <>\n <span className=\"text-muted-foreground\">Base</span>\n <span className=\"truncate\" title={workspace.baseSha}>{workspace.baseRef}</span>\n </>\n )}\n </div>\n\n <WorkspaceActions workspace={workspace} expanded={expanded} onToggleDetails={() => setExpanded((value) => !value)} />\n </div>\n {expanded && <WorkspaceDetails workspace={workspace} />}\n </div>\n )\n}\n\nfunction RepoGroup({ repoRoot, workspaces }: { repoRoot: string; workspaces: WorkspaceRecord[] }) {\n const liveCount = workspaces.filter((item) => LIVE_STATUSES.has(item.status)).length\n const readyCount = workspaces.filter((item) => item.status === 'ready' || item.status === 'review_requested' || item.status === 'merge_planned').length\n const conflictCount = workspaces.filter((item) => item.status === 'conflict').length\n\n return (\n <Card>\n <CardHeader className=\"px-4 py-3\">\n <div className=\"flex min-w-0 items-start gap-3\">\n <div className=\"min-w-0 flex-1\">\n <CardTitle className=\"truncate text-sm font-medium\" title={repoRoot}>{repoRoot}</CardTitle>\n <div className=\"mt-1 flex flex-wrap gap-1.5\">\n <Badge variant=\"outline\" className=\"text-[10px]\">{workspaces.length} total</Badge>\n <Badge variant=\"outline\" className=\"text-[10px]\">{liveCount} live</Badge>\n {readyCount > 0 && <Badge variant=\"outline\" className=\"border-emerald-500/20 text-emerald-400 text-[10px]\">{readyCount} merge signal</Badge>}\n {conflictCount > 0 && <Badge variant=\"outline\" className=\"border-red-500/20 text-red-400 text-[10px]\">{conflictCount} conflict</Badge>}\n </div>\n </div>\n </div>\n </CardHeader>\n <CardContent className=\"p-0\">\n {workspaces.map((workspace) => (\n <WorkspaceRow key={workspace.id} workspace={workspace} />\n ))}\n </CardContent>\n </Card>\n )\n}\n\nexport function WorkspacesView() {\n const [filter, setFilter] = useState<WorkspaceFilter>('active')\n const workspaces = useRelayStore((s) => s.workspaces)\n const set = useRelayStore((s) => s.set)\n const workspaceFocusId = useRelayStore((s) => s.workspaceFocusId)\n\n // Badge click-through (#236): a focused workspace may be in any state, so widen\n // the filter to 'all' to guarantee its row renders. Clear the focus when leaving\n // the panel so the highlight doesn't linger on the next visit.\n useEffect(() => {\n if (workspaceFocusId) setFilter('all')\n }, [workspaceFocusId])\n useEffect(() => () => { set({ workspaceFocusId: null }) }, [set])\n\n const visibleWorkspaces = useMemo(() => filterWorkspaces(workspaces, filter), [workspaces, filter])\n const grouped = useMemo(() => groupWorkspaces(visibleWorkspaces), [visibleWorkspaces])\n const liveCount = workspaces.filter((item) => LIVE_STATUSES.has(item.status)).length\n const isolatedCount = workspaces.filter((item) => item.mode === 'isolated').length\n const readyCount = workspaces.filter((item) => item.status === 'ready' || item.status === 'review_requested' || item.status === 'merge_planned').length\n const conflictCount = workspaces.filter((item) => item.status === 'conflict').length\n const doneCount = workspaces.filter((item) => TERMINAL_STATUSES.has(item.status)).length\n const activeCount = workspaces.length - doneCount\n const filters: Array<{ key: WorkspaceFilter; label: string; count: number }> = [\n { key: 'active', label: 'Active', count: activeCount },\n { key: 'cleaned', label: 'Done', count: doneCount },\n { key: 'all', label: 'All', count: workspaces.length },\n ]\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex flex-wrap items-center gap-3\">\n <div>\n <h1 className=\"text-2xl font-semibold\">Workspaces</h1>\n <p className=\"text-sm text-muted-foreground\">Agent worktrees, ownership, and merge readiness.</p>\n </div>\n <div className=\"ml-auto flex flex-wrap gap-1.5\">\n <Badge variant=\"outline\">{isolatedCount} isolated</Badge>\n <Badge variant=\"outline\">{liveCount} live</Badge>\n <Badge variant=\"outline\">{readyCount} ready</Badge>\n {conflictCount > 0 && <Badge variant=\"outline\" className=\"border-red-500/20 text-red-400\">{conflictCount} conflict</Badge>}\n </div>\n </div>\n\n <OrphanPanel />\n\n <div className=\"flex flex-wrap items-center gap-2\">\n <div className=\"flex rounded-md border border-border bg-card p-1\">\n {filters.map((item) => (\n <Button\n key={item.key}\n size=\"sm\"\n variant={filter === item.key ? 'secondary' : 'ghost'}\n className=\"h-7 text-xs\"\n onClick={() => setFilter(item.key)}\n >\n {item.label}\n <span className=\"ml-1 text-muted-foreground\">{item.count}</span>\n </Button>\n ))}\n </div>\n </div>\n\n {grouped.length === 0 ? (\n <div className=\"rounded-md border border-border px-3 py-12 text-center text-sm text-muted-foreground\">\n No {filter === 'all' ? '' : filter} workspaces\n </div>\n ) : (\n <div className=\"space-y-3\">\n {grouped.map((group) => (\n <RepoGroup key={group.repoRoot} repoRoot={group.repoRoot} workspaces={group.workspaces} />\n ))}\n </div>\n )}\n </div>\n )\n}\n"],"mappings":"mlBAWM,EAAgB,IAAI,IAAqB,CAAC,SAAU,QAAS,WAAY,mBAAoB,gBAAiB,oBAAoB,CAAC,CACnI,EAAqB,IAAI,IAAqB,CAAC,SAAU,QAAS,WAAY,mBAAoB,gBAAgB,CAAC,CACnH,EAAqB,IAAI,IAAqB,CAAC,SAAU,QAAS,mBAAoB,gBAAiB,WAAW,CAAC,CAInH,EAAgD,CACpD,OAAQ,kDACR,MAAO,2DACP,SAAU,+CACV,iBAAkB,wDAClB,cAAe,wDACf,OAAQ,wDACR,UAAW,kDACX,kBAAmB,wDACnB,QAAS,kDACV,CAEK,EAAgD,CACpD,OAAQ,SACR,MAAO,QACP,SAAU,WACV,iBAAkB,SAClB,cAAe,gBACf,OAAQ,SACR,UAAW,YACX,kBAAmB,UACnB,QAAS,UACV,CAEK,EAAgD,CACpD,SAAU,EACV,MAAO,EACP,iBAAkB,EAClB,cAAe,EACf,OAAQ,EACR,kBAAmB,EACnB,OAAQ,EACR,UAAW,EACX,QAAS,EACV,CAEK,EAAoB,IAAI,IAAqB,EAAiC,CAEpF,SAAS,EAAU,EAAsB,CACvC,IAAM,EAAQ,EAAK,MAAM,IAAI,CAAC,OAAO,QAAQ,CAE7C,OADI,EAAM,QAAU,EAAU,GAAQ,IAC/B,IAAI,EAAM,MAAM,GAAG,CAAC,KAAK,IAAI,GAGtC,SAAS,EAAW,EAA0B,EAAsC,CAElF,OADI,EAAc,EAAY,EAAM,CAC7B,GAAY,IAGrB,SA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7C,UAAU,cACV,YAAe,EAAU,EAAK,IAAI,UALpC,CAOG,EAAK,OACN,EAAA,EAAA,KAAC,OAAD,CAAM,UAAU,sCAA8B,EAAK,MAAa,CAAA,CACzD,EARF,EAAK,IAQH,CACT,CACE,CAAA,CACF,CAAA,CAEL,EAAQ,SAAW,GAClB,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,gGAAf,CAAsG,MAChG,IAAW,MAAQ,GAAK,EAAO,cAC/B,IAEN,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,qBACZ,EAAQ,IAAK,IACZ,EAAA,EAAA,KAAC,GAAD,CAAgC,SAAU,EAAM,SAAU,WAAY,EAAM,WAAc,CAA1E,EAAM,SAAoE,CAC1F,CACE,CAAA,CAEJ"}
|
|
1
|
+
{"version":3,"file":"workspaces-DKFmnOF8.js","names":[],"sources":["../../dashboard/src/components/views/workspaces.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from 'react'\nimport { ArchiveRestore, ArrowDown, ArrowUp, Check, ChevronDown, ChevronRight, Clock, Eye, FileDiff, FilePen, Flag, FolderOpen, GitBranch, GitCommitHorizontal, GitMerge, PackageOpen, RefreshCw, TriangleAlert, Trash2, X } from 'lucide-react'\nimport { TERMINAL_WORKSPACE_STATUS_VALUES } from 'agent-relay-sdk/types'\nimport { useRelayStore, useNow } from '@/store'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { CopyButton } from '@/components/shared/copy-button'\nimport { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'\nimport { displayName, timeAgo } from '@/lib/display'\nimport type { Agent, WorkspaceOrphan, WorkspaceRecord, WorkspaceStatus } from '@/types'\n\nconst LIVE_STATUSES = new Set<WorkspaceStatus>(['active', 'ready', 'conflict', 'review_requested', 'merge_planned', 'cleanup_requested'])\nconst GIT_STATE_STATUSES = new Set<WorkspaceStatus>(['active', 'ready', 'conflict', 'review_requested', 'merge_planned'])\nconst MERGEABLE_STATUSES = new Set<WorkspaceStatus>(['active', 'ready', 'review_requested', 'merge_planned', 'conflict'])\n\ntype WorkspaceFilter = 'active' | 'cleaned' | 'all'\n\nconst STATUS_CLASS: Record<WorkspaceStatus, string> = {\n active: 'bg-blue-500/10 text-blue-400 border-blue-500/20',\n ready: 'bg-emerald-500/10 text-emerald-400 border-emerald-500/20',\n conflict: 'bg-red-500/10 text-red-400 border-red-500/20',\n review_requested: 'bg-yellow-500/10 text-yellow-400 border-yellow-500/20',\n merge_planned: 'bg-indigo-500/10 text-indigo-400 border-indigo-500/20',\n merged: 'bg-violet-500/10 text-violet-400 border-violet-500/20',\n abandoned: 'bg-zinc-500/10 text-zinc-400 border-zinc-500/20',\n cleanup_requested: 'bg-orange-500/10 text-orange-400 border-orange-500/20',\n cleaned: 'bg-zinc-500/10 text-zinc-400 border-zinc-500/20',\n}\n\nconst STATUS_LABEL: Record<WorkspaceStatus, string> = {\n active: 'active',\n ready: 'ready',\n conflict: 'conflict',\n review_requested: 'review',\n merge_planned: 'merge planned',\n merged: 'merged',\n abandoned: 'abandoned',\n cleanup_requested: 'cleanup',\n cleaned: 'cleaned',\n}\n\nconst STATUS_ORDER: Record<WorkspaceStatus, number> = {\n conflict: 0,\n ready: 1,\n review_requested: 2,\n merge_planned: 3,\n active: 4,\n cleanup_requested: 5,\n merged: 6,\n abandoned: 7,\n cleaned: 8,\n}\n\nconst TERMINAL_STATUSES = new Set<WorkspaceStatus>(TERMINAL_WORKSPACE_STATUS_VALUES)\n\nfunction shortPath(path: string): string {\n const parts = path.split('/').filter(Boolean)\n if (parts.length <= 3) return path || '-'\n return `/${parts.slice(-3).join('/')}`\n}\n\nfunction agentLabel(agent: Agent | undefined, fallback: string | undefined): string {\n if (agent) return displayName(agent)\n return fallback || '-'\n}\n\nfunction statusTone(status: WorkspaceStatus): string {\n return STATUS_CLASS[status] || 'bg-zinc-500/10 text-zinc-400 border-zinc-500/20'\n}\n\nfunction workspaceSort(a: WorkspaceRecord, b: WorkspaceRecord): number {\n const status = (STATUS_ORDER[a.status] ?? 99) - (STATUS_ORDER[b.status] ?? 99)\n if (status !== 0) return status\n return Number(b.updatedAt || 0) - Number(a.updatedAt || 0)\n}\n\nfunction groupWorkspaces(workspaces: WorkspaceRecord[]): Array<{ repoRoot: string; workspaces: WorkspaceRecord[] }> {\n const grouped = new Map<string, WorkspaceRecord[]>()\n for (const workspace of workspaces) {\n const key = workspace.repoRoot || workspace.sourceCwd || 'unknown repo'\n grouped.set(key, [...(grouped.get(key) || []), workspace])\n }\n return [...grouped.entries()]\n .map(([repoRoot, items]) => ({ repoRoot, workspaces: items.sort(workspaceSort) }))\n .sort((a, b) => {\n const liveA = a.workspaces.some((item) => LIVE_STATUSES.has(item.status))\n const liveB = b.workspaces.some((item) => LIVE_STATUSES.has(item.status))\n if (liveA !== liveB) return liveA ? -1 : 1\n return a.repoRoot.localeCompare(b.repoRoot)\n })\n}\n\nfunction filterWorkspaces(workspaces: WorkspaceRecord[], filter: WorkspaceFilter): WorkspaceRecord[] {\n if (filter === 'all') return workspaces\n if (filter === 'cleaned') return workspaces.filter((workspace) => TERMINAL_STATUSES.has(workspace.status))\n return workspaces.filter((workspace) => !TERMINAL_STATUSES.has(workspace.status))\n}\n\nfunction WorkspaceActions({ workspace, expanded, onToggleDetails }: { workspace: WorkspaceRecord; expanded: boolean; onToggleDetails: () => void }) {\n const workspaceAction = useRelayStore((s) => s.workspaceAction)\n const purgeWorkspace = useRelayStore((s) => s.purgeWorkspace)\n const fetchWorkspaceMergePreview = useRelayStore((s) => s.fetchWorkspaceMergePreview)\n const openFilesAt = useRelayStore((s) => s.openFilesAt)\n const terminal = workspace.status === 'cleaned' || workspace.status === 'merged' || workspace.status === 'abandoned'\n const disabled = terminal || workspace.status === 'cleanup_requested'\n const openPath = workspace.worktreePath || workspace.sourceCwd || workspace.repoRoot\n // Already-landed work (squash/cherry-pick) has nothing left to merge — a merge\n // would open a duplicate/no-op PR, so disable the button.\n const gitState = useRelayStore((s) => s.workspaceGitState[workspace.id])\n const landed = !!gitState && gitState.available !== false && gitState.landed === true\n const mergeable = workspace.mode === 'isolated' && Boolean(workspace.worktreePath) && MERGEABLE_STATUSES.has(workspace.status) && !landed\n\n // Refresh the preview so the confirm dialog states the strategy/outcome, then\n // dispatch the real merge command.\n async function merge() {\n await fetchWorkspaceMergePreview(workspace.id)\n await workspaceAction(workspace.id, 'merge')\n }\n\n return (\n <div className=\"flex flex-wrap justify-end gap-1.5\">\n <Button size=\"icon-sm\" variant=\"ghost\" title={expanded ? 'Hide details' : 'Show diff & timeline'} onClick={onToggleDetails}>\n {expanded ? <ChevronDown className=\"h-3.5 w-3.5\" /> : <ChevronRight className=\"h-3.5 w-3.5\" />}\n </Button>\n <Button\n size=\"icon-sm\"\n variant=\"ghost\"\n title=\"Open workspace\"\n disabled={!openPath || workspace.status === 'cleaned'}\n onClick={() => void openFilesAt({ path: openPath })}\n >\n <FolderOpen className=\"h-3.5 w-3.5\" />\n </Button>\n <CopyButton value={openPath} label=\"Copy path\" copiedLabel=\"Copied path\" size=\"icon-sm\" variant=\"ghost\" disabled={!openPath} />\n <Button size=\"icon-sm\" variant=\"outline\" title=\"Mark ready\" disabled={disabled || workspace.status === 'ready'} onClick={() => void workspaceAction(workspace.id, 'ready')}>\n <Check className=\"h-3.5 w-3.5\" />\n </Button>\n <Button size=\"icon-sm\" variant=\"outline\" title=\"Request review\" disabled={disabled || workspace.status === 'review_requested'} onClick={() => void workspaceAction(workspace.id, 'request-review')}>\n <Eye className=\"h-3.5 w-3.5\" />\n </Button>\n <Button size=\"icon-sm\" variant=\"outline\" title=\"Mark merge planned\" disabled={disabled || workspace.status === 'merge_planned'} onClick={() => void workspaceAction(workspace.id, 'merge-plan')}>\n <Flag className=\"h-3.5 w-3.5\" />\n </Button>\n <Button size=\"icon-sm\" variant=\"default\" title={landed ? 'Already merged into base — nothing to land' : 'Merge & land work'} disabled={!mergeable} onClick={() => void merge()}>\n <GitMerge className=\"h-3.5 w-3.5\" />\n </Button>\n <Button size=\"icon-sm\" variant=\"outline\" title=\"Request cleanup (removes the worktree on the host)\" disabled={workspace.status === 'cleaned' || workspace.status === 'cleanup_requested'} onClick={() => void workspaceAction(workspace.id, 'cleanup')}>\n <Trash2 className=\"h-3.5 w-3.5\" />\n </Button>\n {terminal && (\n <Button size=\"icon-sm\" variant=\"ghost\" title=\"Purge record (clears the row, does not touch disk)\" onClick={() => void purgeWorkspace(workspace.id)}>\n <X className=\"h-3.5 w-3.5\" />\n </Button>\n )}\n </div>\n )\n}\n\n// Pre-merge conflict hint, shown next to git state when the worktree has work to\n// land. Lazily fetched from the owning host (an external sync), so an effect is\n// the right tool. Reports clean-ff vs would-conflict before the user merges.\nfunction MergePreviewHint({ workspace, unmerged }: { workspace: WorkspaceRecord; unmerged: number }) {\n const preview = useRelayStore((s) => s.workspaceMergePreview[workspace.id])\n const fetchWorkspaceMergePreview = useRelayStore((s) => s.fetchWorkspaceMergePreview)\n const eligible = unmerged > 0 && MERGEABLE_STATUSES.has(workspace.status)\n\n useEffect(() => {\n if (eligible && preview === undefined) void fetchWorkspaceMergePreview(workspace.id)\n }, [eligible, preview, workspace.id, fetchWorkspaceMergePreview])\n\n if (!eligible || preview === undefined || preview.available === false) return null\n if (preview.conflict) {\n return (\n <span className=\"flex items-center gap-0.5 text-amber-400\" title={`Merging into ${preview.baseRef || 'base'} would conflict — resolve before merging`}>\n <TriangleAlert className=\"h-3 w-3\" />conflict\n </span>\n )\n }\n if (preview.conflict === false) {\n return (\n <span className=\"flex items-center gap-0.5 text-emerald-400\" title={`Clean to merge via ${preview.strategy === 'pr' ? 'PR' : 'rebase + fast-forward'} into ${preview.baseRef || 'base'}`}>\n <Check className=\"h-3 w-3\" />{preview.strategy === 'pr' ? 'PR ready' : 'clean'}\n </span>\n )\n }\n return null\n}\n\n// Live git state of the worktree, fetched lazily from the owning host. This is\n// an external-system sync (host git over the orchestrator proxy), so an effect\n// is the right tool — it does not derive state from props.\nfunction GitState({ workspace }: { workspace: WorkspaceRecord }) {\n const now = useNow()\n const gitState = useRelayStore((s) => s.workspaceGitState[workspace.id])\n const fetchWorkspaceGitState = useRelayStore((s) => s.fetchWorkspaceGitState)\n const eligible = workspace.mode === 'isolated' && Boolean(workspace.worktreePath) && GIT_STATE_STATUSES.has(workspace.status)\n\n useEffect(() => {\n if (eligible && gitState === undefined) void fetchWorkspaceGitState(workspace.id)\n }, [eligible, gitState, workspace.id, fetchWorkspaceGitState])\n\n if (!eligible) return null\n\n const refresh = (\n <Button\n size=\"icon-sm\"\n variant=\"ghost\"\n className=\"h-5 w-5\"\n title=\"Refresh git state\"\n onClick={() => void fetchWorkspaceGitState(workspace.id)}\n >\n <RefreshCw className=\"h-3 w-3\" />\n </Button>\n )\n\n if (gitState === undefined) {\n return <div className=\"flex items-center gap-1 text-[11px] text-muted-foreground\">Loading git state…</div>\n }\n if (gitState.available === false) {\n return (\n <div className=\"flex items-center gap-1 text-[11px] text-muted-foreground\" title={gitState.reason}>\n <span>git state unavailable</span>\n {refresh}\n </div>\n )\n }\n if (gitState.missing) {\n return <div className=\"flex items-center gap-1 text-[11px] text-muted-foreground\">worktree gone {refresh}</div>\n }\n if (gitState.error) {\n return (\n <div className=\"flex items-center gap-1 text-[11px] text-red-400\" title={gitState.error}>\n <span>git error</span>\n {refresh}\n </div>\n )\n }\n\n const ahead = gitState.ahead ?? 0\n // Work squash/cherry-pick-merged into base leaves `ahead` positive but is\n // effectively landed — surface the unmerged count, not the raw ahead.\n const landed = gitState.landed === true\n const unmerged = landed ? 0 : (gitState.unmergedAhead ?? ahead)\n const behind = gitState.behind ?? 0\n const dirty = gitState.dirtyCount ?? 0\n const clean = unmerged === 0 && dirty === 0 && !landed\n const commit = gitState.lastCommit\n\n return (\n <div className=\"space-y-0.5\">\n <div className=\"flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11px]\">\n {clean ? (\n <span className=\"text-muted-foreground\">no unmerged work</span>\n ) : (\n <>\n {landed ? (\n <span className=\"flex items-center gap-0.5 text-emerald-400\" title={`Work already landed in ${gitState.baseRef || 'base'} via squash/cherry-pick — safe to clean up`}>\n <Check className=\"h-3 w-3\" />landed\n </span>\n ) : (\n <span className={unmerged > 0 ? 'flex items-center text-emerald-400' : 'flex items-center text-muted-foreground'} title={ahead !== unmerged ? `${unmerged} unmerged commit(s) (${ahead} ahead of base)` : `${unmerged} commit(s) ahead of base`}>\n <ArrowUp className=\"h-3 w-3\" />{unmerged}\n </span>\n )}\n <span className={behind > 0 ? 'flex items-center text-amber-400' : 'flex items-center text-muted-foreground'} title={`${behind} commit(s) behind base`}>\n <ArrowDown className=\"h-3 w-3\" />{behind}\n </span>\n {dirty > 0 && (\n <span className=\"flex items-center text-orange-400\" title={`${dirty} uncommitted change(s)`}>\n <FilePen className=\"h-3 w-3\" />{dirty}\n </span>\n )}\n {!landed && <MergePreviewHint workspace={workspace} unmerged={unmerged} />}\n </>\n )}\n {refresh}\n </div>\n {commit && (\n <div className=\"flex min-w-0 items-center gap-1 text-[11px] text-muted-foreground\" title={`${commit.sha.slice(0, 8)} — ${commit.message}`}>\n <GitCommitHorizontal className=\"h-3 w-3 shrink-0\" />\n <span className=\"truncate\">{commit.message || commit.sha.slice(0, 8)}</span>\n {commit.at ? <span className=\"shrink-0 opacity-70\">· {timeAgo(now, commit.at)}</span> : null}\n </div>\n )}\n </div>\n )\n}\n\n// Lifecycle timeline from the timestamps the relay already records:\n// created → ready → merged → cleaned. Surfaces history without a drawer.\nfunction WorkspaceTimeline({ workspace }: { workspace: WorkspaceRecord }) {\n const now = useNow()\n const mergedAt = typeof workspace.metadata?.mergedAt === 'number' ? (workspace.metadata.mergedAt as number) : undefined\n const steps = [\n { label: 'created', at: workspace.createdAt },\n { label: 'ready', at: workspace.readyAt },\n { label: 'merged', at: mergedAt },\n { label: 'cleaned', at: workspace.cleanedAt },\n ].filter((step): step is { label: string; at: number } => typeof step.at === 'number' && step.at > 0)\n\n return (\n <div className=\"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground\">\n <span className=\"flex items-center gap-1 font-medium text-foreground\"><Clock className=\"h-3 w-3\" />Timeline</span>\n {steps.map((step, i) => (\n <span key={step.label} className=\"flex items-center gap-1\">\n {i > 0 && <span className=\"opacity-40\">→</span>}\n <span className=\"text-foreground\">{step.label}</span>\n <span title={new Date(step.at).toLocaleString()}>{timeAgo(now, step.at)}</span>\n </span>\n ))}\n </div>\n )\n}\n\nfunction diffLineClass(line: string): string {\n if (line.startsWith('+') && !line.startsWith('+++')) return 'text-emerald-400'\n if (line.startsWith('-') && !line.startsWith('---')) return 'text-red-400'\n if (line.startsWith('@@')) return 'text-cyan-400'\n if (line.startsWith('diff ') || line.startsWith('index ') || line.startsWith('+++') || line.startsWith('---')) return 'text-muted-foreground'\n return ''\n}\n\n// Diff of committed work against base, lazily fetched from the owning host.\nfunction WorkspaceDiffView({ workspace }: { workspace: WorkspaceRecord }) {\n const diff = useRelayStore((s) => s.workspaceDiff[workspace.id])\n const fetchWorkspaceDiff = useRelayStore((s) => s.fetchWorkspaceDiff)\n const eligible = workspace.mode === 'isolated' && Boolean(workspace.worktreePath)\n\n useEffect(() => {\n if (eligible && diff === undefined) void fetchWorkspaceDiff(workspace.id)\n }, [eligible, diff, workspace.id, fetchWorkspaceDiff])\n\n if (!eligible) return null\n if (diff === undefined) return <div className=\"text-[11px] text-muted-foreground\">Loading diff…</div>\n if (diff.available === false) return <div className=\"text-[11px] text-muted-foreground\">Diff unavailable{diff.reason ? `: ${diff.reason}` : ''}</div>\n if (diff.missing) return <div className=\"text-[11px] text-muted-foreground\">Worktree no longer on disk</div>\n if (diff.error) return <div className=\"text-[11px] text-red-400\">Diff error: {diff.error}</div>\n if (!diff.files.length) return <div className=\"text-[11px] text-muted-foreground\">No committed changes against {diff.baseRef || 'base'}</div>\n\n const refresh = (\n <Button size=\"icon-sm\" variant=\"ghost\" className=\"h-5 w-5\" title=\"Refresh diff\" onClick={() => void fetchWorkspaceDiff(workspace.id)}>\n <RefreshCw className=\"h-3 w-3\" />\n </Button>\n )\n\n return (\n <div className=\"space-y-1\">\n <div className=\"flex items-center gap-2 text-[11px] font-medium\">\n <FileDiff className=\"h-3 w-3\" />\n <span>{diff.files.length} file{diff.files.length === 1 ? '' : 's'} vs {diff.baseRef || 'base'}</span>\n {refresh}\n </div>\n <ul className=\"space-y-0.5 text-[11px]\">\n {diff.files.map((file) => (\n <li key={file.path} className=\"flex items-center gap-2 font-mono\">\n <span className=\"truncate\" title={file.path}>{file.path}</span>\n {file.binary ? (\n <span className=\"shrink-0 text-muted-foreground\">binary</span>\n ) : (\n <span className=\"shrink-0\">\n <span className=\"text-emerald-400\">+{file.additions ?? 0}</span>{' '}\n <span className=\"text-red-400\">−{file.deletions ?? 0}</span>\n </span>\n )}\n </li>\n ))}\n </ul>\n {diff.patch && (\n <pre className=\"max-h-80 overflow-auto rounded border border-border bg-muted/30 p-2 text-[10.5px] leading-relaxed\">\n {diff.patch.split('\\n').map((line, i) => (\n <div key={i} className={diffLineClass(line)}>{line || ' '}</div>\n ))}\n {diff.truncated && <div className=\"mt-1 text-muted-foreground\">… patch truncated</div>}\n </pre>\n )}\n </div>\n )\n}\n\nfunction WorkspaceDetails({ workspace }: { workspace: WorkspaceRecord }) {\n return (\n <div className=\"space-y-3 border-t border-dashed border-border bg-muted/20 px-3 py-3\">\n <WorkspaceTimeline workspace={workspace} />\n <WorkspaceDiffView workspace={workspace} />\n </div>\n )\n}\n\n// Worktrees on disk with no live workspace row — reclaimable in one click.\nfunction OrphanPanel() {\n const orphans = useRelayStore((s) => s.workspaceOrphans)\n const fetchWorkspaceOrphans = useRelayStore((s) => s.fetchWorkspaceOrphans)\n const reclaimWorkspaceOrphan = useRelayStore((s) => s.reclaimWorkspaceOrphan)\n\n useEffect(() => {\n void fetchWorkspaceOrphans()\n }, [fetchWorkspaceOrphans])\n\n if (!orphans.length) return null\n\n return (\n <Card className=\"border-amber-500/30\">\n <CardHeader className=\"px-4 py-3\">\n <div className=\"flex items-center gap-2\">\n <PackageOpen className=\"h-4 w-4 text-amber-400\" />\n <CardTitle className=\"text-sm font-medium\">Orphaned worktrees</CardTitle>\n <Badge variant=\"outline\" className=\"border-amber-500/30 text-amber-400 text-[10px]\">{orphans.length}</Badge>\n <Button size=\"icon-sm\" variant=\"ghost\" className=\"ml-auto h-6 w-6\" title=\"Rescan\" onClick={() => void fetchWorkspaceOrphans()}>\n <RefreshCw className=\"h-3.5 w-3.5\" />\n </Button>\n </div>\n <p className=\"mt-1 text-xs text-muted-foreground\">Agent worktrees on disk with no live workspace. Reclaim removes them from the host.</p>\n </CardHeader>\n <CardContent className=\"p-0\">\n {orphans.map((orphan) => (\n <div key={orphan.worktreePath} className=\"flex items-center gap-3 border-t border-border px-4 py-2 text-xs\">\n <GitBranch className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"truncate font-medium\" title={orphan.branch}>{orphan.branch || '(detached)'}</span>\n <span className=\"truncate font-mono text-muted-foreground\" title={orphan.worktreePath}>{shortPath(orphan.worktreePath)}</span>\n {orphan.hadTerminalRow && <Badge variant=\"outline\" className=\"text-[10px]\">cleanup failed</Badge>}\n <Button size=\"sm\" variant=\"outline\" className=\"ml-auto h-7 text-xs\" onClick={() => void reclaimWorkspaceOrphan(orphan)}>\n <ArchiveRestore className=\"mr-1 h-3.5 w-3.5\" />Reclaim\n </Button>\n </div>\n ))}\n </CardContent>\n </Card>\n )\n}\n\n// A `pr`-strategy merge lands as an opened PR, not a local fast-forward, so the\n// outcome only shows up here — surface the PR link and any error the orchestrator\n// returned (which the command layer keeps in result even when status=succeeded).\nfunction prLabel(url: string): string {\n const match = url.match(/\\/pull\\/(\\d+)/)\n return match ? `PR #${match[1]}` : 'View PR'\n}\n\nfunction MergeOutcome({ workspace }: { workspace: WorkspaceRecord }) {\n const result = workspace.metadata?.mergeResult as { prUrl?: string; error?: string } | undefined\n const prUrl = result?.prUrl\n const error = result?.error || (workspace.metadata?.mergeError as string | undefined)\n if (!prUrl && !error) return null\n return (\n <>\n {prUrl && (\n <a\n href={prUrl}\n target=\"_blank\"\n rel=\"noreferrer\"\n title={prUrl}\n className=\"inline-flex items-center gap-0.5 rounded border border-violet-500/30 px-1.5 py-0 text-[10px] text-violet-400 hover:text-violet-300\"\n >\n <GitMerge className=\"h-2.5 w-2.5\" />{prLabel(prUrl)}\n </a>\n )}\n {error && (\n <Badge variant=\"outline\" className=\"max-w-[16rem] border-amber-500/30 text-amber-400 text-[10px]\" title={error}>\n <TriangleAlert className=\"mr-0.5 h-2.5 w-2.5 shrink-0\" /><span className=\"truncate\">merge: {error}</span>\n </Badge>\n )}\n </>\n )\n}\n\nfunction WorkspaceRow({ workspace }: { workspace: WorkspaceRecord }) {\n const now = useNow()\n const [expanded, setExpanded] = useState(false)\n const agentsById = useRelayStore((s) => s.agentsById)\n const focused = useRelayStore((s) => s.workspaceFocusId === workspace.id)\n const owner = workspace.ownerAgentId ? agentsById[workspace.ownerAgentId] : undefined\n const steward = workspace.stewardAgentId ? agentsById[workspace.stewardAgentId] : undefined\n const path = workspace.worktreePath || workspace.sourceCwd || workspace.repoRoot\n const rowRef = useRef<HTMLDivElement>(null)\n\n // Click-through landing (#236): scroll the targeted row into view once it mounts.\n useEffect(() => {\n if (focused) rowRef.current?.scrollIntoView({ behavior: 'smooth', block: 'center' })\n }, [focused])\n\n return (\n <div ref={rowRef} className={`border-t border-border ${focused ? 'bg-primary/5 ring-1 ring-inset ring-primary/40' : ''}`}>\n <div className=\"grid gap-3 px-3 py-3 text-sm lg:grid-cols-[minmax(180px,1.2fr)_minmax(220px,1.5fr)_minmax(160px,1fr)_minmax(170px,auto)]\">\n <div className=\"min-w-0 space-y-1\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <GitBranch className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"truncate font-medium\" title={workspace.branch || workspace.id}>{workspace.branch || workspace.id}</span>\n </div>\n <div className=\"flex flex-wrap gap-1\">\n <Badge variant=\"outline\" className={`text-[10px] ${workspace.mode === 'isolated' ? 'border-sky-500/30 text-sky-400' : 'border-zinc-500/30 text-zinc-400'}`}>\n {workspace.mode}\n </Badge>\n {workspace.requestedMode && workspace.requestedMode !== workspace.mode && (\n <Badge variant=\"outline\" className=\"text-[10px]\">requested {workspace.requestedMode}</Badge>\n )}\n <Badge variant=\"outline\" className={`text-[10px] ${statusTone(workspace.status)}`}>{STATUS_LABEL[workspace.status] || workspace.status}</Badge>\n <MergeOutcome workspace={workspace} />\n </div>\n </div>\n\n <div className=\"min-w-0 space-y-1\">\n <div className=\"truncate font-mono text-xs\" title={path}>{shortPath(path)}</div>\n <div className=\"truncate text-xs text-muted-foreground\" title={workspace.sourceCwd}>{workspace.sourceCwd}</div>\n <GitState workspace={workspace} />\n </div>\n\n <div className=\"grid grid-cols-[4.5rem_minmax(0,1fr)] gap-x-2 gap-y-1 text-xs\">\n <span className=\"text-muted-foreground\">Owner</span>\n <span className=\"truncate\" title={workspace.ownerAgentId}>{agentLabel(owner, workspace.ownerPolicyName || workspace.ownerAgentId)}</span>\n <span className=\"text-muted-foreground\">Steward</span>\n <span className=\"truncate\" title={workspace.stewardAgentId}>{agentLabel(steward, workspace.stewardAgentId)}</span>\n <span className=\"text-muted-foreground\">Updated</span>\n <span>{timeAgo(now, workspace.updatedAt)}</span>\n {workspace.baseRef && (\n <>\n <span className=\"text-muted-foreground\">Base</span>\n <span className=\"truncate\" title={workspace.baseSha}>{workspace.baseRef}</span>\n </>\n )}\n </div>\n\n <WorkspaceActions workspace={workspace} expanded={expanded} onToggleDetails={() => setExpanded((value) => !value)} />\n </div>\n {expanded && <WorkspaceDetails workspace={workspace} />}\n </div>\n )\n}\n\nfunction RepoGroup({ repoRoot, workspaces }: { repoRoot: string; workspaces: WorkspaceRecord[] }) {\n const liveCount = workspaces.filter((item) => LIVE_STATUSES.has(item.status)).length\n const readyCount = workspaces.filter((item) => item.status === 'ready' || item.status === 'review_requested' || item.status === 'merge_planned').length\n const conflictCount = workspaces.filter((item) => item.status === 'conflict').length\n\n return (\n <Card>\n <CardHeader className=\"px-4 py-3\">\n <div className=\"flex min-w-0 items-start gap-3\">\n <div className=\"min-w-0 flex-1\">\n <CardTitle className=\"truncate text-sm font-medium\" title={repoRoot}>{repoRoot}</CardTitle>\n <div className=\"mt-1 flex flex-wrap gap-1.5\">\n <Badge variant=\"outline\" className=\"text-[10px]\">{workspaces.length} total</Badge>\n <Badge variant=\"outline\" className=\"text-[10px]\">{liveCount} live</Badge>\n {readyCount > 0 && <Badge variant=\"outline\" className=\"border-emerald-500/20 text-emerald-400 text-[10px]\">{readyCount} merge signal</Badge>}\n {conflictCount > 0 && <Badge variant=\"outline\" className=\"border-red-500/20 text-red-400 text-[10px]\">{conflictCount} conflict</Badge>}\n </div>\n </div>\n </div>\n </CardHeader>\n <CardContent className=\"p-0\">\n {workspaces.map((workspace) => (\n <WorkspaceRow key={workspace.id} workspace={workspace} />\n ))}\n </CardContent>\n </Card>\n )\n}\n\nexport function WorkspacesView() {\n const [filter, setFilter] = useState<WorkspaceFilter>('active')\n const workspaces = useRelayStore((s) => s.workspaces)\n const set = useRelayStore((s) => s.set)\n const workspaceFocusId = useRelayStore((s) => s.workspaceFocusId)\n\n // Badge click-through (#236): a focused workspace may be in any state, so widen\n // the filter to 'all' to guarantee its row renders. Clear the focus when leaving\n // the panel so the highlight doesn't linger on the next visit.\n useEffect(() => {\n if (workspaceFocusId) setFilter('all')\n }, [workspaceFocusId])\n useEffect(() => () => { set({ workspaceFocusId: null }) }, [set])\n\n const visibleWorkspaces = useMemo(() => filterWorkspaces(workspaces, filter), [workspaces, filter])\n const grouped = useMemo(() => groupWorkspaces(visibleWorkspaces), [visibleWorkspaces])\n const liveCount = workspaces.filter((item) => LIVE_STATUSES.has(item.status)).length\n const isolatedCount = workspaces.filter((item) => item.mode === 'isolated').length\n const readyCount = workspaces.filter((item) => item.status === 'ready' || item.status === 'review_requested' || item.status === 'merge_planned').length\n const conflictCount = workspaces.filter((item) => item.status === 'conflict').length\n const doneCount = workspaces.filter((item) => TERMINAL_STATUSES.has(item.status)).length\n const activeCount = workspaces.length - doneCount\n const filters: Array<{ key: WorkspaceFilter; label: string; count: number }> = [\n { key: 'active', label: 'Active', count: activeCount },\n { key: 'cleaned', label: 'Done', count: doneCount },\n { key: 'all', label: 'All', count: workspaces.length },\n ]\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex flex-wrap items-center gap-3\">\n <div>\n <h1 className=\"text-2xl font-semibold\">Workspaces</h1>\n <p className=\"text-sm text-muted-foreground\">Agent worktrees, ownership, and merge readiness.</p>\n </div>\n <div className=\"ml-auto flex flex-wrap gap-1.5\">\n <Badge variant=\"outline\">{isolatedCount} isolated</Badge>\n <Badge variant=\"outline\">{liveCount} live</Badge>\n <Badge variant=\"outline\">{readyCount} ready</Badge>\n {conflictCount > 0 && <Badge variant=\"outline\" className=\"border-red-500/20 text-red-400\">{conflictCount} conflict</Badge>}\n </div>\n </div>\n\n <OrphanPanel />\n\n <div className=\"flex flex-wrap items-center gap-2\">\n <div className=\"flex rounded-md border border-border bg-card p-1\">\n {filters.map((item) => (\n <Button\n key={item.key}\n size=\"sm\"\n variant={filter === item.key ? 'secondary' : 'ghost'}\n className=\"h-7 text-xs\"\n onClick={() => setFilter(item.key)}\n >\n {item.label}\n <span className=\"ml-1 text-muted-foreground\">{item.count}</span>\n </Button>\n ))}\n </div>\n </div>\n\n {grouped.length === 0 ? (\n <div className=\"rounded-md border border-border px-3 py-12 text-center text-sm text-muted-foreground\">\n No {filter === 'all' ? '' : filter} workspaces\n </div>\n ) : (\n <div className=\"space-y-3\">\n {grouped.map((group) => (\n <RepoGroup key={group.repoRoot} repoRoot={group.repoRoot} workspaces={group.workspaces} />\n ))}\n </div>\n )}\n </div>\n )\n}\n"],"mappings":"mlBAWM,EAAgB,IAAI,IAAqB,CAAC,SAAU,QAAS,WAAY,mBAAoB,gBAAiB,oBAAoB,CAAC,CACnI,EAAqB,IAAI,IAAqB,CAAC,SAAU,QAAS,WAAY,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CAAA,CAEJ"}
|
package/public/index.html
CHANGED
|
@@ -12,33 +12,33 @@
|
|
|
12
12
|
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='6' fill='%2309090b'/%3E%3Ccircle cx='16' cy='16' r='4.5' fill='%2358a6ff'/%3E%3Ccircle cx='6' cy='8' r='2.5' fill='%233fb950'/%3E%3Ccircle cx='26' cy='8' r='2.5' fill='%233fb950'/%3E%3Ccircle cx='6' cy='24' r='2.5' fill='%233fb950'/%3E%3Ccircle cx='26' cy='24' r='2.5' fill='%233fb950'/%3E%3Cline x1='8' y1='9.5' x2='13' y2='14' stroke='%2330363d' stroke-width='1.5'/%3E%3Cline x1='24' y1='9.5' x2='19' y2='14' stroke='%2330363d' stroke-width='1.5'/%3E%3Cline x1='8' y1='22.5' x2='13' y2='18' stroke='%2330363d' stroke-width='1.5'/%3E%3Cline x1='24' y1='22.5' x2='19' y2='18' stroke='%2330363d' stroke-width='1.5'/%3E%3C/svg%3E">
|
|
13
13
|
<link rel="manifest" href="manifest.webmanifest">
|
|
14
14
|
<link rel="apple-touch-icon" href="icons/agent-relay-192.png">
|
|
15
|
-
<script type="module" crossorigin src="./assets/index-
|
|
15
|
+
<script type="module" crossorigin src="./assets/index-CwhhpGgX.js"></script>
|
|
16
16
|
<link rel="modulepreload" crossorigin href="./assets/chunk-CilyBKbf.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-C_JMBXql.js">
|
|
18
|
-
<link rel="modulepreload" crossorigin href="./assets/lucide-react-
|
|
19
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
20
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
21
|
-
<link rel="modulepreload" crossorigin href="./assets/react-dom-
|
|
22
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
23
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
24
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
25
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
18
|
+
<link rel="modulepreload" crossorigin href="./assets/lucide-react-uFIMC7W7.js">
|
|
19
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-KxiSP9h9.js">
|
|
20
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-zTw85jD8.js">
|
|
21
|
+
<link rel="modulepreload" crossorigin href="./assets/react-dom-DF2cuNaf.js">
|
|
22
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-Du_bcq-z.js">
|
|
23
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-CXkmW1Od.js">
|
|
24
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-BufB2Xy_.js">
|
|
25
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-BQXmO19g.js">
|
|
26
26
|
<link rel="modulepreload" crossorigin href="./assets/dist-BiLuYU6G.js">
|
|
27
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
28
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
29
|
-
<link rel="modulepreload" crossorigin href="./assets/es2015-
|
|
30
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
31
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
32
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
27
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-CbxR2pzD.js">
|
|
28
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-Q6OOS84U.js">
|
|
29
|
+
<link rel="modulepreload" crossorigin href="./assets/es2015-ibwCE_JR.js">
|
|
30
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-CtuS_3Jl.js">
|
|
31
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-eG_93I3z.js">
|
|
32
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-LFuRypZd.js">
|
|
33
33
|
<link rel="modulepreload" crossorigin href="./assets/types-Tv67voFu.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="./assets/display-DRiGi1zj.js">
|
|
35
|
-
<link rel="modulepreload" crossorigin href="./assets/store-
|
|
36
|
-
<link rel="modulepreload" crossorigin href="./assets/button-
|
|
37
|
-
<link rel="modulepreload" crossorigin href="./assets/copy-button-
|
|
38
|
-
<link rel="modulepreload" crossorigin href="./assets/badge-
|
|
39
|
-
<link rel="modulepreload" crossorigin href="./assets/input-
|
|
35
|
+
<link rel="modulepreload" crossorigin href="./assets/store-d-IbqTaD.js">
|
|
36
|
+
<link rel="modulepreload" crossorigin href="./assets/button-DWiw--lT.js">
|
|
37
|
+
<link rel="modulepreload" crossorigin href="./assets/copy-button-CIXy8ks6.js">
|
|
38
|
+
<link rel="modulepreload" crossorigin href="./assets/badge-BbfOskRI.js">
|
|
39
|
+
<link rel="modulepreload" crossorigin href="./assets/input-DUdtS3nG.js">
|
|
40
40
|
<link rel="modulepreload" crossorigin href="./assets/themes-DjSwmAZN.js">
|
|
41
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
41
|
+
<link rel="stylesheet" crossorigin href="./assets/index-CKPsJqiW.css">
|
|
42
42
|
</head>
|
|
43
43
|
<body class="bg-background text-foreground antialiased">
|
|
44
44
|
<div id="root"></div>
|
package/src/agent-busy-health.ts
CHANGED
|
@@ -3,8 +3,9 @@ import {
|
|
|
3
3
|
STUCK_BUSY_RECONNECT_MS,
|
|
4
4
|
STUCK_BUSY_SHUTDOWN_MS,
|
|
5
5
|
STUCK_BUSY_STARTUP_MS,
|
|
6
|
+
STUCK_BUSY_TRANSPORT_STALE_MS,
|
|
6
7
|
} from "./config";
|
|
7
|
-
import { stringValue } from "agent-relay-sdk";
|
|
8
|
+
import { isRecord, stringValue } from "agent-relay-sdk";
|
|
8
9
|
import type { AgentCard } from "./types";
|
|
9
10
|
|
|
10
11
|
type BusyHealthKind = "provider-turn" | "startup" | "reconnect" | "shutdown";
|
|
@@ -27,6 +28,12 @@ export interface AgentBusyHealth {
|
|
|
27
28
|
activeWorkAgeMs: number;
|
|
28
29
|
lastProviderEventAt?: number;
|
|
29
30
|
lastProviderEventAgeMs?: number;
|
|
31
|
+
/** Most recent of lastProviderEventAt and any fresh lifecycle/timeline transition (e.g. `compacting`). */
|
|
32
|
+
lastProgressAt: number;
|
|
33
|
+
/** Most recent transport liveness signal (server frame / heartbeat ack); undefined when the runner reports no transport. */
|
|
34
|
+
transportLiveAt?: number;
|
|
35
|
+
/** Age of the transport liveness signal; +Infinity when transport is unknown (treated as dead). */
|
|
36
|
+
transportStaleForMs: number;
|
|
30
37
|
staleForMs: number;
|
|
31
38
|
}
|
|
32
39
|
|
|
@@ -45,6 +52,29 @@ function hasLiveToolOrSubprocessWork(works: ActiveWorkLike[]): boolean {
|
|
|
45
52
|
});
|
|
46
53
|
}
|
|
47
54
|
|
|
55
|
+
// #713 — most recent transport-liveness timestamp the runner reported on meta.transport
|
|
56
|
+
// (`lastServerFrameAt` / `lastHeartbeatAckAt`). A current value proves the runner→server link is
|
|
57
|
+
// alive, which means the agent is NOT wedged regardless of provider-token silence. Returns undefined
|
|
58
|
+
// when no transport block is present (older runners / pre-transport meta) — the caller treats that as
|
|
59
|
+
// "can't prove alive" so a genuine wedge with no transport still fires.
|
|
60
|
+
function transportLiveAt(agent: AgentCard): number | undefined {
|
|
61
|
+
const transport = isRecord(agent.meta?.transport) ? agent.meta.transport : undefined;
|
|
62
|
+
if (!transport) return undefined;
|
|
63
|
+
const frame = numberValue(transport.lastServerFrameAt);
|
|
64
|
+
const ack = numberValue(transport.lastHeartbeatAckAt);
|
|
65
|
+
if (frame === undefined && ack === undefined) return undefined;
|
|
66
|
+
return Math.max(frame ?? 0, ack ?? 0);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// #713 — timestamp of the latest lifecycle/timeline transition (e.g. Claude `compacting`/`compacted`)
|
|
70
|
+
// the runner published on meta.timelineEvent. These mark active progress through a lifecycle even when
|
|
71
|
+
// no provider tokens flow, so they count as progress against the no-progress threshold.
|
|
72
|
+
function timelineProgressAt(agent: AgentCard): number | undefined {
|
|
73
|
+
const event = isRecord(agent.meta?.timelineEvent) ? agent.meta.timelineEvent : undefined;
|
|
74
|
+
if (!event) return undefined;
|
|
75
|
+
return numberValue(event.timestamp);
|
|
76
|
+
}
|
|
77
|
+
|
|
48
78
|
function thresholdFor(kind: BusyHealthKind): number {
|
|
49
79
|
if (kind === "startup") return STUCK_BUSY_STARTUP_MS;
|
|
50
80
|
if (kind === "reconnect") return STUCK_BUSY_RECONNECT_MS;
|
|
@@ -82,12 +112,21 @@ export function deriveAgentBusyHealth(agent: AgentCard, now: number = Date.now()
|
|
|
82
112
|
const activeWorkStartedAt = Math.max(0, classified.startedAt);
|
|
83
113
|
const activeWorkAgeMs = Math.max(0, now - activeWorkStartedAt);
|
|
84
114
|
const lastProviderEventAt = numberValue(agent.meta?.lastProviderEventAt);
|
|
85
|
-
|
|
115
|
+
// Progress = provider tokens OR any lifecycle/timeline transition (e.g. native compaction). #713: a
|
|
116
|
+
// fresh `compacting` event means the worker is actively progressing even with zero provider tokens.
|
|
117
|
+
const lastProgressAt = Math.max(lastProviderEventAt ?? activeWorkStartedAt, timelineProgressAt(agent) ?? 0);
|
|
86
118
|
const staleForMs = Math.max(0, now - lastProgressAt);
|
|
119
|
+
// #713: transport heartbeat liveness. A current server-frame/heartbeat-ack proves the runner→server
|
|
120
|
+
// link is alive ⇒ the agent is NOT wedged, no matter how long provider tokens have been silent
|
|
121
|
+
// (long turns, extended thinking, native compaction). Unknown transport ⇒ +Infinity (can't prove
|
|
122
|
+
// alive), so a genuine wedge whose runner has stopped reporting still trips.
|
|
123
|
+
const liveAt = transportLiveAt(agent);
|
|
124
|
+
const transportStaleForMs = liveAt === undefined ? Number.POSITIVE_INFINITY : Math.max(0, now - liveAt);
|
|
87
125
|
const stuck =
|
|
88
126
|
!hasLiveToolOrSubprocessWork(works) &&
|
|
89
127
|
activeWorkAgeMs >= thresholdMs &&
|
|
90
|
-
staleForMs >= thresholdMs
|
|
128
|
+
staleForMs >= thresholdMs &&
|
|
129
|
+
transportStaleForMs >= STUCK_BUSY_TRANSPORT_STALE_MS;
|
|
91
130
|
const work = classified.work;
|
|
92
131
|
return {
|
|
93
132
|
status: stuck ? "stuck-busy" : "ok",
|
|
@@ -99,6 +138,9 @@ export function deriveAgentBusyHealth(agent: AgentCard, now: number = Date.now()
|
|
|
99
138
|
activeWorkStartedAt,
|
|
100
139
|
activeWorkAgeMs,
|
|
101
140
|
...(lastProviderEventAt !== undefined ? { lastProviderEventAt, lastProviderEventAgeMs: Math.max(0, now - lastProviderEventAt) } : {}),
|
|
141
|
+
lastProgressAt,
|
|
142
|
+
...(liveAt !== undefined ? { transportLiveAt: liveAt } : {}),
|
|
143
|
+
transportStaleForMs,
|
|
102
144
|
staleForMs,
|
|
103
145
|
};
|
|
104
146
|
}
|
package/src/codex-wham-quota.ts
CHANGED
|
@@ -82,7 +82,7 @@ export function codexWhamUsageQuotaState(payload: unknown, now = Date.now()): Qu
|
|
|
82
82
|
codexWhamWindow("secondary", payload.rate_limit.secondary_window, now),
|
|
83
83
|
].filter((window): window is NonNullable<ContextProbeMetrics["quotaWindows"]>[number] => Boolean(window));
|
|
84
84
|
if (windows.length !== 2) return undefined;
|
|
85
|
-
|
|
85
|
+
const quota = quotaStateFromProbeMetrics({
|
|
86
86
|
agentId: "codex-wham-quota",
|
|
87
87
|
contextPercent: 0,
|
|
88
88
|
quotaWindows: windows,
|
|
@@ -90,6 +90,9 @@ export function codexWhamUsageQuotaState(payload: unknown, now = Date.now()): Qu
|
|
|
90
90
|
confidence: "reported",
|
|
91
91
|
timestamp: now,
|
|
92
92
|
});
|
|
93
|
+
// quotaStateFromProbeMetrics always maps source to "probe"; override to "ingest" so the
|
|
94
|
+
// per-window source precedence in mergeQuotaWindows knows WHAM is authoritative over probe.
|
|
95
|
+
return quota ? { ...quota, source: "ingest" as const } : undefined;
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
export function codexWhamResetCredits(usagePayload: unknown, creditEventsPayload: unknown, now = Date.now()): CodexResetCredits | undefined {
|
package/src/config-store.ts
CHANGED
|
@@ -67,17 +67,19 @@ const OPS_ASSISTANT_BRIEF = [
|
|
|
67
67
|
"Do not make strategy, design, scope, or release-timing calls. Escalate those decisions to your spawn-parent. Report operational results to your spawn-parent by default and keep their context clean.",
|
|
68
68
|
].join("\n");
|
|
69
69
|
const BUILT_IN_AGENT_PROFILE_NAMES = new Set([DEFAULT_SPAWN_PROFILE_NAME, "minimal", "isolated-research", "vanilla", "lean-worker", "coordinator", "ops-assistant", "worker", "reviewer"]);
|
|
70
|
+
// Tool group set for worker-style profiles (#551): excludes spawn/coordinator-only surface.
|
|
71
|
+
const WORKER_TOOL_GROUPS = ["core", "workspace", "memory", "artifacts", "blackboard", "subscriptions"];
|
|
70
72
|
|
|
71
73
|
const BUILT_IN_AGENT_PROFILES: AgentProfile[] = [
|
|
72
|
-
agentProfileDefaults({ name: DEFAULT_SPAWN_PROFILE_NAME, description: "Relay-aware spawned agent with bundled Relay context, skills, plugins, and status integration.", base: "host" }),
|
|
74
|
+
agentProfileDefaults({ name: DEFAULT_SPAWN_PROFILE_NAME, description: "Relay-aware spawned agent with bundled Relay context, skills, plugins, and status integration.", base: "host", mcp: { mode: "none" }, relay: { tools: { groups: WORKER_TOOL_GROUPS } } }),
|
|
73
75
|
agentProfileDefaults({ name: "minimal", description: "Repo-focused spawned agent with Relay affordances disabled and host/global extras avoided where supported.", base: "minimal" }),
|
|
74
76
|
agentProfileDefaults({ name: "isolated-research", description: "Strict profile for autonomous research runs: repo context only, no Relay prompt surface, no global extras where supported.", base: "isolated" }),
|
|
75
77
|
agentProfileDefaults({ name: "vanilla", description: "Zero host bleed (#552): isolated provider home with host plugins, skills, hooks, MCP, and the CLAUDE.md/AGENTS.md cascade (repo + global) all suppressed at launch. Relay provisions any surface explicitly per profile.", base: "vanilla" }),
|
|
76
|
-
agentProfileDefaults({ name: "lean-worker", description: "Lean worker profile (#570): vanilla host-dependency drop with only Relay context/MCP restored and Project knowledge injected from the spawn cwd.", base: "vanilla", relay: { context: true, skills: false, plugins: false, statusLine: false, mcp: true }, projectInstructions: { policy: "all" } }),
|
|
78
|
+
agentProfileDefaults({ name: "lean-worker", description: "Lean worker profile (#570): vanilla host-dependency drop with only Relay context/MCP restored and Project knowledge injected from the spawn cwd.", base: "vanilla", relay: { context: true, skills: false, plugins: false, statusLine: false, mcp: true, tools: { groups: WORKER_TOOL_GROUPS } }, projectInstructions: { policy: "all" } }),
|
|
77
79
|
agentProfileDefaults({ name: "coordinator", description: "Relay-aware coordination lead for spawning worker teams, maintaining shared state, and driving review and release.", base: "host", instructions: { append: [COORDINATION_CHARTER], repoInstructions: "allow", globalInstructions: "allow" }, maxSpawnedAgents: 8 }),
|
|
78
80
|
agentProfileDefaults({ name: "ops-assistant", description: "Relay-aware ops lieutenant for a coordinator: runs tests, releases, smoke probes, gates, and host checks, then reports crisp outcomes back up.", provider: "codex", base: "host", instructions: { append: [OPS_ASSISTANT_BRIEF], repoInstructions: "allow", globalInstructions: "allow" }, permissions: { mode: "open", filesystem: "host" } }),
|
|
79
|
-
agentProfileDefaults({ name: "worker", description: "Relay-aware focused implementer with open approval posture and no delegated spawn capability.", base: "host", permissions: { mode: "open", filesystem: "host" } }),
|
|
80
|
-
agentProfileDefaults({ name: "reviewer", description: "Relay-aware read-only reviewer for audit and review passes without file writes.", base: "host", permissions: { mode: "read-only", filesystem: "host" } }),
|
|
81
|
+
agentProfileDefaults({ name: "worker", description: "Relay-aware focused implementer with open approval posture and no delegated spawn capability.", base: "host", mcp: { mode: "none" }, permissions: { mode: "open", filesystem: "host" }, relay: { tools: { groups: WORKER_TOOL_GROUPS } } }),
|
|
82
|
+
agentProfileDefaults({ name: "reviewer", description: "Relay-aware read-only reviewer for audit and review passes without file writes.", base: "host", mcp: { mode: "none" }, permissions: { mode: "read-only", filesystem: "host" }, relay: { tools: { groups: WORKER_TOOL_GROUPS } } }),
|
|
81
83
|
].map((profile) => ({ ...profile, builtIn: true }));
|
|
82
84
|
|
|
83
85
|
interface ConfigRow {
|
|
@@ -273,7 +275,7 @@ function cleanAgentProfileSharedMcp(value: unknown): AgentProfile["sharedMcp"] {
|
|
|
273
275
|
return { policy: cleanEnum(policy, "sharedMcp.policy", SHARED_MCP_POLICY_NAMES) as NonNullable<AgentProfile["sharedMcp"]>["policy"] };
|
|
274
276
|
}
|
|
275
277
|
|
|
276
|
-
function agentProfileDefaults(input: Pick<AgentProfile, "name" | "base"> & Partial<AgentProfile>): AgentProfile {
|
|
278
|
+
function agentProfileDefaults(input: Pick<AgentProfile, "name" | "base"> & Omit<Partial<AgentProfile>, "relay"> & { relay?: Partial<AgentProfile["relay"]> }): AgentProfile {
|
|
277
279
|
const isolated = input.base !== "host";
|
|
278
280
|
// "vanilla" (#552) additionally suppresses the REPO instruction cascade
|
|
279
281
|
// (cwd CLAUDE.md/AGENTS.md). Isolation alone only drops the GLOBAL cascade
|
|
@@ -303,6 +305,7 @@ function agentProfileDefaults(input: Pick<AgentProfile, "name" | "base"> & Parti
|
|
|
303
305
|
plugins: input.relay?.plugins ?? !isolated,
|
|
304
306
|
statusLine: input.relay?.statusLine ?? !isolated,
|
|
305
307
|
mcp: input.relay?.mcp ?? !isolated,
|
|
308
|
+
...(input.relay?.tools ? { tools: input.relay.tools } : {}),
|
|
306
309
|
},
|
|
307
310
|
skills: input.skills ?? [],
|
|
308
311
|
plugins: input.plugins ?? [],
|
|
@@ -381,6 +384,7 @@ function validateAgentProfile(key: string, value: unknown): AgentProfile {
|
|
|
381
384
|
plugins: relay.plugins === undefined ? defaults.relay.plugins : cleanBoolean(relay.plugins, "relay.plugins"),
|
|
382
385
|
statusLine: relay.statusLine === undefined ? defaults.relay.statusLine : cleanBoolean(relay.statusLine, "relay.statusLine"),
|
|
383
386
|
mcp: relay.mcp === undefined ? defaults.relay.mcp : cleanBoolean(relay.mcp, "relay.mcp"),
|
|
387
|
+
...(isRecord(relay.tools) && Array.isArray(relay.tools.groups) ? { tools: { groups: cleanStringArray(relay.tools.groups, "relay.tools.groups", { maxItems: 20 }) ?? [] } } : {}),
|
|
384
388
|
},
|
|
385
389
|
skills: cleanAgentProfileAssetArray(value.skills, "skills"),
|
|
386
390
|
plugins: cleanAgentProfileAssetArray(value.plugins, "plugins"),
|
|
@@ -845,6 +849,13 @@ export function spawnGrantForProfile(
|
|
|
845
849
|
return { canSpawn: n > 0, maxSpawnedAgents: n };
|
|
846
850
|
}
|
|
847
851
|
|
|
852
|
+
/** Relay tool groups enabled for a profile (#551). Absent profile or no groups → undefined (full surface). */
|
|
853
|
+
export function toolGroupsForProfile(profileName: string | undefined): string[] | undefined {
|
|
854
|
+
if (!profileName) return undefined;
|
|
855
|
+
const groups = getAgentProfile(profileName)?.value.relay.tools?.groups;
|
|
856
|
+
return groups && groups.length > 0 ? groups : undefined;
|
|
857
|
+
}
|
|
858
|
+
|
|
848
859
|
export function listAgentProfiles(): ConfigEntry<AgentProfile>[] {
|
|
849
860
|
const custom = listConfig<AgentProfile>(AGENT_PROFILE_NAMESPACE);
|
|
850
861
|
return [
|
package/src/config.ts
CHANGED
|
@@ -64,6 +64,13 @@ export const STUCK_BUSY_PROVIDER_TURN_MS = envPositiveInt("AGENT_RELAY_STUCK_BUS
|
|
|
64
64
|
export const STUCK_BUSY_STARTUP_MS = envPositiveInt("AGENT_RELAY_STUCK_BUSY_STARTUP_MS", STUCK_BUSY_THRESHOLD_MS);
|
|
65
65
|
export const STUCK_BUSY_RECONNECT_MS = envPositiveInt("AGENT_RELAY_STUCK_BUSY_RECONNECT_MS", STUCK_BUSY_THRESHOLD_MS);
|
|
66
66
|
export const STUCK_BUSY_SHUTDOWN_MS = envPositiveInt("AGENT_RELAY_STUCK_BUSY_SHUTDOWN_MS", STUCK_BUSY_THRESHOLD_MS);
|
|
67
|
+
// #713 — provider-token silence ALONE is not a wedge signal for Claude (long turns, extended
|
|
68
|
+
// thinking, and native compaction all go token-silent while healthy). Before declaring stuck we
|
|
69
|
+
// ALSO require the transport heartbeat to be genuinely dead: no server frame / heartbeat-ack within
|
|
70
|
+
// this window. The runner heartbeats every 30s, so 2min (4 missed beats) is a clear "transport gone"
|
|
71
|
+
// signal, well above jitter and far below the 15min provider threshold — a real wedge (transport dead
|
|
72
|
+
// AND provider silent AND no lifecycle progress) still fires. A live heartbeat ⇒ not wedged.
|
|
73
|
+
export const STUCK_BUSY_TRANSPORT_STALE_MS = envPositiveInt("AGENT_RELAY_STUCK_BUSY_TRANSPORT_STALE_MS", 2 * 60_000);
|
|
67
74
|
export const CLAIM_LEASE_MS = envPositiveInt("AGENT_RELAY_CLAIM_LEASE_MS", 1_800_000); // 30min claim lease
|
|
68
75
|
export const POOL_CLAIM_LEASE_MS = envPositiveInt("AGENT_RELAY_POOL_CLAIM_LEASE_MS", STALE_TTL_MS * 3); // pool binding lease
|
|
69
76
|
// Per-repo merge serialization lease — only one base merge may run at a time per
|