diff --git a/docs/theme.md b/docs/theme.md
index cd98e975..3290748b 100644
--- a/docs/theme.md
+++ b/docs/theme.md
@@ -73,6 +73,27 @@ delimiter-free pills on `SurfaceMuted`.
| **Danger** | Orange destructive actions — **distinct from Error** |
| **Highlight** | Selected / active item foreground (distinct from Accent) |
+### Information colors (TUI + web)
+
+Same *role* on both surfaces — never one purple for working, needs-you, and
+error. Hexes stay in the token file; this table is the meaning contract.
+
+| Role | Meaning | TUI | Web CSS |
+|---|---|---|---|
+| Ready / idle | Awaiting input | `AgentStateReady` → `Success` | `.ui-status-idle`, `.pulse.idle`, `.root-idle`, `.session-idle` → `--success` |
+| Working | Turn or tool in flight | `AgentStateWorking` → `AccentAlt` | `.ui-status-busy`, `.pulse.busy`, `.root-busy`, `.tool-state-running`, `.child-state.running`, `.session-busy` → `--accent-alt` |
+| Needs you | Permission, question, or gate | `AgentStateAttention` → `Warning` | `.ui-status-needs-you`, `.pulse.needs-you`, `.root-attention`, `.needs-you`, `.tool-state-denied` → `--warning` |
+| Error | Failed turn, tool, or provider | `AgentStateError` → `Error` | `.ui-status-failed`, `.pulse.failed`, `.tool-state-error` → `--signal` |
+| Success | Complete / ok | `Success` | `.ui-status-complete`, `.tool-state-done`, `.child-state.completed` → `--success` |
+| Danger | Destructive action | `Danger` | `.ui-btn-danger`, `.pane-meter-fill.tone-danger` → `--danger` (never `--signal`) |
+| User | "You" transcript label | `UserLabel` | `.message.user` / `.message-label` → `--user` |
+| Tool | Tool-call transcript label | `ToolLabel` | `.message.tool`, `.tool-card summary` → `--tool` |
+| Selected | Cursor / active item | `Highlight` foreground | `--raised` fill + inset 2px `--acid` rule + `--highlight` text (no glow) |
+| Focus | Focused pane / control | `BorderFocus` + title-edge `SurfaceFocus` | `--focus-ring` / `--border-focus` |
+
+Permission/question wins over busy (TUI `agentState`, web `liveStatusKind`).
+Canceled / unknown stay muted (`TextMuted` / `--muted`).
+
### Surface ladder
`background` < `surfaceMuted` < `surface` < `surfaceFocus` — enough step that
@@ -183,6 +204,8 @@ Semantic roles map as `--ink`←Text, `--muted`←TextMuted, `--ground`←Backgr
`--surface`/`--raised`/`--surface-muted`←Surface*, `--rule`←Border,
`--acid`←Accent, `--accent-alt`←AccentAlt, `--signal`←Error, `--danger`←Danger,
`--user`/`--tool`← transcript labels, `--diff-add`/`--diff-del`←diff roles.
+Information-color usage (working / needs-you / error / selected) is the table
+in [Information colors](#information-colors-tui--web).
`--radius` is the 2px chrome token; stock role hexes are injected from the
token file (`/* strike-stock:dark|light */`). Parity is guarded by
`web/src/theme.test.ts`. The web settings dialog loads the
diff --git a/internal/frontend/server/static/assets/ArtifactsReview-B65rCcbV.js b/internal/frontend/server/static/assets/ArtifactsReview-D1C39jZN.js
similarity index 99%
rename from internal/frontend/server/static/assets/ArtifactsReview-B65rCcbV.js
rename to internal/frontend/server/static/assets/ArtifactsReview-D1C39jZN.js
index d66ba781..e7cac053 100644
--- a/internal/frontend/server/static/assets/ArtifactsReview-B65rCcbV.js
+++ b/internal/frontend/server/static/assets/ArtifactsReview-D1C39jZN.js
@@ -1 +1 @@
-import{r as d,b as w,j as e,S,s as $}from"./index-BK8GKzWA.js";function k(a){const l=new URLSearchParams;for(const[j,c]of Object.entries(a))c!==void 0&&c!==""&&l.set(j,c);const r=l.toString();return r?`?${r}`:""}function A(a){return a?a.verified===!0||a.passed===!0?{kind:"complete",label:"verified"}:a.passed===!1?{kind:"failed",label:"failed"}:a.claimed&&!a.verified?{kind:"needs-you",label:"claimed (unverified)"}:{kind:"unknown",label:"unknown"}:{kind:"unknown",label:"unknown"}}function T({available:a,rootID:l,entity:r,onOpenFile:j}){var R;const[c,v]=d.useState([]),[s,o]=d.useState(""),[x,f]=d.useState(""),[i,n]=d.useState(null),[h,g]=d.useState(),[p,y]=d.useState(!1),b=d.useCallback(async()=>{if(a){y(!0),o("");try{const t=await w(`/v1/artifacts${k({root:l,actorRoot:l,actorSession:l,type:x||void 0,limit:"100"})}`);v(t.artifacts||[])}catch(t){o(t instanceof Error?t.message:String(t)),v([])}finally{y(!1)}}},[a,l,x]);d.useEffect(()=>{b()},[b]),d.useEffect(()=>{if(!r||!a)return;const[t,u]=r.split("@"),m=u?Number(u):void 0;w(`/v1/artifacts/${encodeURIComponent(t)}${k({root:l,actorRoot:l,actorSession:l,version:m&&Number.isFinite(m)?String(m):void 0})}`).then(N=>{n(N),g(N.version)}).catch(N=>o(N instanceof Error?N.message:String(N)))},[r,a,l]);const C=async(t,u)=>{o("");try{const m=await w(`/v1/artifacts/${encodeURIComponent(t)}${k({root:l,actorRoot:l,actorSession:l,version:u!==void 0?String(u):void 0})}`);n(m),g(m.version)}catch(m){o(m instanceof Error?m.message:String(m)),n(null)}};if(!a)return e.jsxs("section",{"aria-label":"Artifacts",children:[e.jsx("h2",{children:"Artifacts"}),e.jsx("p",{className:"muted",role:"status",children:"Artifacts capability unavailable."})]});const E=d.useMemo(()=>{const t=new Set;for(const u of c)u.type&&t.add(u.type);return[...t].sort()},[c]);return e.jsxs("section",{className:"review-panel","aria-label":"Artifacts",children:[e.jsxs("header",{className:"review-head",children:[e.jsx("h2",{children:"Artifacts"}),e.jsx("button",{type:"button",onClick:()=>void b(),disabled:p,children:"Refresh"})]}),e.jsxs("label",{className:"review-filter",children:["Type",e.jsxs("select",{value:x,onChange:t=>f(t.target.value),children:[e.jsx("option",{value:"",children:"All"}),E.map(t=>e.jsx("option",{value:t,children:t},t))]})]}),s?e.jsx("p",{className:"muted",role:"alert",children:s}):null,p&&!c.length?e.jsx("p",{className:"muted",children:"Loading…"}):null,!p&&!c.length&&!s?e.jsx("p",{className:"muted",children:"No artifacts visible for this actor/root."}):null,e.jsx("ul",{className:"review-list","aria-label":"Artifact list",children:c.map(t=>{var u;return e.jsx("li",{children:e.jsxs("button",{type:"button",className:(i==null?void 0:i.id)===t.id?"active":"",onClick:()=>void C(t.id),children:[e.jsx("strong",{children:t.title||t.id}),e.jsx("span",{className:"muted",children:[t.type,t.scope,t.version!==void 0?`v${t.version}`:"",(u=t.ownerSession)==null?void 0:u.slice(0,8)].filter(Boolean).join(" · ")})]})},t.id)})}),i?e.jsxs("article",{className:"review-detail","aria-label":"Artifact detail",children:[e.jsxs("header",{children:[e.jsx("h3",{children:i.title||i.id}),e.jsx("button",{type:"button",className:"icon-btn","aria-label":"Close artifact detail",onClick:()=>n(null),children:"×"})]}),e.jsxs("dl",{children:[e.jsx("dt",{children:"ID"}),e.jsx("dd",{children:e.jsx("code",{children:i.id})}),e.jsx("dt",{children:"Type"}),e.jsx("dd",{children:i.type||"—"}),e.jsx("dt",{children:"Version"}),e.jsxs("dd",{children:[e.jsx("input",{type:"number",min:1,value:h??i.version??1,onChange:t=>g(Number(t.target.value)),"aria-label":"Artifact version"}),e.jsx("button",{type:"button",onClick:()=>void C(i.id,h),children:"Load version"})]}),e.jsx("dt",{children:"Scope"}),e.jsx("dd",{children:i.scope||"—"}),e.jsx("dt",{children:"Owner"}),e.jsx("dd",{children:e.jsx("code",{children:i.ownerSession||"—"})}),e.jsx("dt",{children:"Access"}),e.jsx("dd",{children:i.access||"—"}),i.expiresAt?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Expires"}),e.jsx("dd",{children:i.expiresAt})]}):null]}),i.content!==void 0?e.jsx("pre",{className:"review-content",children:i.content||"(empty)"}):e.jsx("p",{className:"muted",children:"Content unavailable or redacted."}),j&&((R=i.content)!=null&&R.includes("/"))?e.jsx("p",{className:"muted",children:"Open paths from content via Code mode file links in the transcript."}):null]}):null]})}function B({available:a,rootID:l}){const[r,j]=d.useState("active"),[c,v]=d.useState([]),[s,o]=d.useState(""),[x,f]=d.useState(!1),i=d.useCallback(async()=>{if(a){f(!0),o("");try{const h=await w(`${r==="active"?"/v1/ledger":"/v1/ledger/history"}${k({root:l,actorRoot:l,actorSession:l,limit:"100"})}`);v(h.entries||[])}catch(n){o(n instanceof Error?n.message:String(n)),v([])}finally{f(!1)}}},[a,l,r]);return d.useEffect(()=>{i()},[i]),a?e.jsxs("section",{className:"review-panel","aria-label":"Decision ledger",children:[e.jsxs("header",{className:"review-head",children:[e.jsx("h2",{children:"Decisions"}),e.jsxs("div",{className:"review-tabs",role:"tablist",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":r==="active",className:r==="active"?"active":"",onClick:()=>j("active"),children:"Active"}),e.jsx("button",{type:"button",role:"tab","aria-selected":r==="history",className:r==="history"?"active":"",onClick:()=>j("history"),children:"History"})]})]}),s?e.jsx("p",{className:"muted",role:"alert",children:s}):null,x&&!c.length?e.jsx("p",{className:"muted",children:"Loading…"}):null,!x&&!c.length&&!s?e.jsx("p",{className:"muted",children:"No ledger entries."}):null,e.jsx("ul",{className:"review-list","aria-label":"Ledger entries",children:c.map(n=>{var p,y;const h=(n.status||"active").toLowerCase(),g=h==="invalidated"||h==="superseded"?"failed":h==="active"?"complete":"unknown";return e.jsxs("li",{className:`ledger-row status-${h}`,children:[e.jsxs("div",{className:"ledger-row-head",children:[e.jsx(S,{kind:g,label:h}),e.jsx("strong",{children:n.kind||"entry"}),e.jsx("code",{className:"muted",children:n.id})]}),e.jsx("p",{children:n.statement||"(no statement)"}),e.jsx("div",{className:"muted ledger-meta",children:[n.authorAgent||((p=n.authorSession)==null?void 0:p.slice(0,8)),n.confidence,n.supersededBy?`→ ${n.supersededBy}`:"",n.supersedes?`← ${n.supersedes}`:""].filter(Boolean).join(" · ")}),(y=n.scopePaths)!=null&&y.length?e.jsx("ul",{className:"review-paths",children:n.scopePaths.map(b=>e.jsx("li",{children:e.jsx("code",{children:b})},b))}):null,n.invalidateReason?e.jsxs("p",{className:"muted",children:["Invalidated: ",n.invalidateReason]}):null]},n.id)})})]}):e.jsxs("section",{"aria-label":"Decision ledger",children:[e.jsx("h2",{children:"Decisions"}),e.jsx("p",{className:"muted",role:"status",children:"Ledger capability unavailable."})]})}function P({team:a,onSelectAgent:l,onOpenFile:r}){if(!a.available)return e.jsxs("section",{"aria-label":"Team review",children:[e.jsx("h2",{children:"Review"}),e.jsx("p",{className:"muted",children:a.unavailableReason||"Team observation unavailable"})]});const j=Object.values(a.members).filter(s=>s.terminal||s.terminalSummary),c=a.pathOverlaps||[],v=a.verifications||[];return e.jsxs("section",{className:"review-panel","aria-label":"Team review",children:[e.jsx("h2",{children:"Review"}),e.jsx("p",{className:"muted",children:"Handoffs, verification, and path conflicts from live observation (read-only)."}),e.jsx("h3",{children:"Handoffs"}),j.length?null:e.jsx("p",{className:"muted",children:"No terminal handoffs yet."}),e.jsx("ul",{className:"review-list",children:j.map(s=>{var f;const o=[...v].reverse().find(i=>i.sessionId===s.sessionId),x=A(o);return e.jsxs("li",{children:[e.jsxs("button",{type:"button",onClick:()=>l==null?void 0:l(s.sessionId),children:[e.jsx("strong",{children:s.name||s.agent||s.sessionId.slice(0,8)}),e.jsx(S,{kind:$(s.state),label:s.state||"done"}),e.jsx(S,{kind:x.kind,label:x.label})]}),s.terminalSummary?e.jsx("p",{children:s.terminalSummary}):null,s.blockReason?e.jsxs("p",{className:"muted",children:["Blocked: ",s.blockReason]}):null,e.jsxs("div",{className:"muted",children:["Budget: ",s.budget?JSON.stringify(s.budget).slice(0,120):"unknown"]}),o!=null&&o.summary?e.jsxs("p",{className:"muted",children:["Verification: ",o.summary]}):null,(f=s.filesTouched)!=null&&f.length?e.jsx("ul",{className:"review-paths",children:s.filesTouched.map(i=>e.jsx("li",{children:e.jsx("button",{type:"button",className:"linkish",onClick:()=>r==null?void 0:r(i),children:e.jsx("code",{children:i})})},i))}):null]},s.sessionId)})}),e.jsx("h3",{children:"Path overlaps"}),c.length?null:e.jsx("p",{className:"muted",children:"No path conflicts observed."}),e.jsx("ul",{className:"review-list",children:c.map(s=>e.jsxs("li",{children:[e.jsx("button",{type:"button",className:"linkish",onClick:()=>r==null?void 0:r(s.path),children:e.jsx("code",{children:s.path})}),e.jsx("span",{className:"muted",children:(s.sessions||[]).join(", ")||"unknown agents"})]},s.path))})]})}export{T as ArtifactsPanel,B as LedgerPanel,P as TeamReviewPanel,A as verificationLabel};
+import{r as d,b as w,j as e,S,s as $}from"./index-BIBviZkd.js";function k(a){const l=new URLSearchParams;for(const[j,c]of Object.entries(a))c!==void 0&&c!==""&&l.set(j,c);const r=l.toString();return r?`?${r}`:""}function A(a){return a?a.verified===!0||a.passed===!0?{kind:"complete",label:"verified"}:a.passed===!1?{kind:"failed",label:"failed"}:a.claimed&&!a.verified?{kind:"needs-you",label:"claimed (unverified)"}:{kind:"unknown",label:"unknown"}:{kind:"unknown",label:"unknown"}}function T({available:a,rootID:l,entity:r,onOpenFile:j}){var R;const[c,v]=d.useState([]),[s,o]=d.useState(""),[x,f]=d.useState(""),[i,n]=d.useState(null),[h,g]=d.useState(),[p,y]=d.useState(!1),b=d.useCallback(async()=>{if(a){y(!0),o("");try{const t=await w(`/v1/artifacts${k({root:l,actorRoot:l,actorSession:l,type:x||void 0,limit:"100"})}`);v(t.artifacts||[])}catch(t){o(t instanceof Error?t.message:String(t)),v([])}finally{y(!1)}}},[a,l,x]);d.useEffect(()=>{b()},[b]),d.useEffect(()=>{if(!r||!a)return;const[t,u]=r.split("@"),m=u?Number(u):void 0;w(`/v1/artifacts/${encodeURIComponent(t)}${k({root:l,actorRoot:l,actorSession:l,version:m&&Number.isFinite(m)?String(m):void 0})}`).then(N=>{n(N),g(N.version)}).catch(N=>o(N instanceof Error?N.message:String(N)))},[r,a,l]);const C=async(t,u)=>{o("");try{const m=await w(`/v1/artifacts/${encodeURIComponent(t)}${k({root:l,actorRoot:l,actorSession:l,version:u!==void 0?String(u):void 0})}`);n(m),g(m.version)}catch(m){o(m instanceof Error?m.message:String(m)),n(null)}};if(!a)return e.jsxs("section",{"aria-label":"Artifacts",children:[e.jsx("h2",{children:"Artifacts"}),e.jsx("p",{className:"muted",role:"status",children:"Artifacts capability unavailable."})]});const E=d.useMemo(()=>{const t=new Set;for(const u of c)u.type&&t.add(u.type);return[...t].sort()},[c]);return e.jsxs("section",{className:"review-panel","aria-label":"Artifacts",children:[e.jsxs("header",{className:"review-head",children:[e.jsx("h2",{children:"Artifacts"}),e.jsx("button",{type:"button",onClick:()=>void b(),disabled:p,children:"Refresh"})]}),e.jsxs("label",{className:"review-filter",children:["Type",e.jsxs("select",{value:x,onChange:t=>f(t.target.value),children:[e.jsx("option",{value:"",children:"All"}),E.map(t=>e.jsx("option",{value:t,children:t},t))]})]}),s?e.jsx("p",{className:"muted",role:"alert",children:s}):null,p&&!c.length?e.jsx("p",{className:"muted",children:"Loading…"}):null,!p&&!c.length&&!s?e.jsx("p",{className:"muted",children:"No artifacts visible for this actor/root."}):null,e.jsx("ul",{className:"review-list","aria-label":"Artifact list",children:c.map(t=>{var u;return e.jsx("li",{children:e.jsxs("button",{type:"button",className:(i==null?void 0:i.id)===t.id?"active":"",onClick:()=>void C(t.id),children:[e.jsx("strong",{children:t.title||t.id}),e.jsx("span",{className:"muted",children:[t.type,t.scope,t.version!==void 0?`v${t.version}`:"",(u=t.ownerSession)==null?void 0:u.slice(0,8)].filter(Boolean).join(" · ")})]})},t.id)})}),i?e.jsxs("article",{className:"review-detail","aria-label":"Artifact detail",children:[e.jsxs("header",{children:[e.jsx("h3",{children:i.title||i.id}),e.jsx("button",{type:"button",className:"icon-btn","aria-label":"Close artifact detail",onClick:()=>n(null),children:"×"})]}),e.jsxs("dl",{children:[e.jsx("dt",{children:"ID"}),e.jsx("dd",{children:e.jsx("code",{children:i.id})}),e.jsx("dt",{children:"Type"}),e.jsx("dd",{children:i.type||"—"}),e.jsx("dt",{children:"Version"}),e.jsxs("dd",{children:[e.jsx("input",{type:"number",min:1,value:h??i.version??1,onChange:t=>g(Number(t.target.value)),"aria-label":"Artifact version"}),e.jsx("button",{type:"button",onClick:()=>void C(i.id,h),children:"Load version"})]}),e.jsx("dt",{children:"Scope"}),e.jsx("dd",{children:i.scope||"—"}),e.jsx("dt",{children:"Owner"}),e.jsx("dd",{children:e.jsx("code",{children:i.ownerSession||"—"})}),e.jsx("dt",{children:"Access"}),e.jsx("dd",{children:i.access||"—"}),i.expiresAt?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Expires"}),e.jsx("dd",{children:i.expiresAt})]}):null]}),i.content!==void 0?e.jsx("pre",{className:"review-content",children:i.content||"(empty)"}):e.jsx("p",{className:"muted",children:"Content unavailable or redacted."}),j&&((R=i.content)!=null&&R.includes("/"))?e.jsx("p",{className:"muted",children:"Open paths from content via Code mode file links in the transcript."}):null]}):null]})}function B({available:a,rootID:l}){const[r,j]=d.useState("active"),[c,v]=d.useState([]),[s,o]=d.useState(""),[x,f]=d.useState(!1),i=d.useCallback(async()=>{if(a){f(!0),o("");try{const h=await w(`${r==="active"?"/v1/ledger":"/v1/ledger/history"}${k({root:l,actorRoot:l,actorSession:l,limit:"100"})}`);v(h.entries||[])}catch(n){o(n instanceof Error?n.message:String(n)),v([])}finally{f(!1)}}},[a,l,r]);return d.useEffect(()=>{i()},[i]),a?e.jsxs("section",{className:"review-panel","aria-label":"Decision ledger",children:[e.jsxs("header",{className:"review-head",children:[e.jsx("h2",{children:"Decisions"}),e.jsxs("div",{className:"review-tabs",role:"tablist",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":r==="active",className:r==="active"?"active":"",onClick:()=>j("active"),children:"Active"}),e.jsx("button",{type:"button",role:"tab","aria-selected":r==="history",className:r==="history"?"active":"",onClick:()=>j("history"),children:"History"})]})]}),s?e.jsx("p",{className:"muted",role:"alert",children:s}):null,x&&!c.length?e.jsx("p",{className:"muted",children:"Loading…"}):null,!x&&!c.length&&!s?e.jsx("p",{className:"muted",children:"No ledger entries."}):null,e.jsx("ul",{className:"review-list","aria-label":"Ledger entries",children:c.map(n=>{var p,y;const h=(n.status||"active").toLowerCase(),g=h==="invalidated"||h==="superseded"?"failed":h==="active"?"complete":"unknown";return e.jsxs("li",{className:`ledger-row status-${h}`,children:[e.jsxs("div",{className:"ledger-row-head",children:[e.jsx(S,{kind:g,label:h}),e.jsx("strong",{children:n.kind||"entry"}),e.jsx("code",{className:"muted",children:n.id})]}),e.jsx("p",{children:n.statement||"(no statement)"}),e.jsx("div",{className:"muted ledger-meta",children:[n.authorAgent||((p=n.authorSession)==null?void 0:p.slice(0,8)),n.confidence,n.supersededBy?`→ ${n.supersededBy}`:"",n.supersedes?`← ${n.supersedes}`:""].filter(Boolean).join(" · ")}),(y=n.scopePaths)!=null&&y.length?e.jsx("ul",{className:"review-paths",children:n.scopePaths.map(b=>e.jsx("li",{children:e.jsx("code",{children:b})},b))}):null,n.invalidateReason?e.jsxs("p",{className:"muted",children:["Invalidated: ",n.invalidateReason]}):null]},n.id)})})]}):e.jsxs("section",{"aria-label":"Decision ledger",children:[e.jsx("h2",{children:"Decisions"}),e.jsx("p",{className:"muted",role:"status",children:"Ledger capability unavailable."})]})}function P({team:a,onSelectAgent:l,onOpenFile:r}){if(!a.available)return e.jsxs("section",{"aria-label":"Team review",children:[e.jsx("h2",{children:"Review"}),e.jsx("p",{className:"muted",children:a.unavailableReason||"Team observation unavailable"})]});const j=Object.values(a.members).filter(s=>s.terminal||s.terminalSummary),c=a.pathOverlaps||[],v=a.verifications||[];return e.jsxs("section",{className:"review-panel","aria-label":"Team review",children:[e.jsx("h2",{children:"Review"}),e.jsx("p",{className:"muted",children:"Handoffs, verification, and path conflicts from live observation (read-only)."}),e.jsx("h3",{children:"Handoffs"}),j.length?null:e.jsx("p",{className:"muted",children:"No terminal handoffs yet."}),e.jsx("ul",{className:"review-list",children:j.map(s=>{var f;const o=[...v].reverse().find(i=>i.sessionId===s.sessionId),x=A(o);return e.jsxs("li",{children:[e.jsxs("button",{type:"button",onClick:()=>l==null?void 0:l(s.sessionId),children:[e.jsx("strong",{children:s.name||s.agent||s.sessionId.slice(0,8)}),e.jsx(S,{kind:$(s.state),label:s.state||"done"}),e.jsx(S,{kind:x.kind,label:x.label})]}),s.terminalSummary?e.jsx("p",{children:s.terminalSummary}):null,s.blockReason?e.jsxs("p",{className:"muted",children:["Blocked: ",s.blockReason]}):null,e.jsxs("div",{className:"muted",children:["Budget: ",s.budget?JSON.stringify(s.budget).slice(0,120):"unknown"]}),o!=null&&o.summary?e.jsxs("p",{className:"muted",children:["Verification: ",o.summary]}):null,(f=s.filesTouched)!=null&&f.length?e.jsx("ul",{className:"review-paths",children:s.filesTouched.map(i=>e.jsx("li",{children:e.jsx("button",{type:"button",className:"linkish",onClick:()=>r==null?void 0:r(i),children:e.jsx("code",{children:i})})},i))}):null]},s.sessionId)})}),e.jsx("h3",{children:"Path overlaps"}),c.length?null:e.jsx("p",{className:"muted",children:"No path conflicts observed."}),e.jsx("ul",{className:"review-list",children:c.map(s=>e.jsxs("li",{children:[e.jsx("button",{type:"button",className:"linkish",onClick:()=>r==null?void 0:r(s.path),children:e.jsx("code",{children:s.path})}),e.jsx("span",{className:"muted",children:(s.sessions||[]).join(", ")||"unknown agents"})]},s.path))})]})}export{T as ArtifactsPanel,B as LedgerPanel,P as TeamReviewPanel,A as verificationLabel};
diff --git a/internal/frontend/server/static/assets/CodeExplorer-CTkRy4Rl.js b/internal/frontend/server/static/assets/CodeExplorer-B2jXBi3h.js
similarity index 99%
rename from internal/frontend/server/static/assets/CodeExplorer-CTkRy4Rl.js
rename to internal/frontend/server/static/assets/CodeExplorer-B2jXBi3h.js
index 2c9bc8a9..b9c3922c 100644
--- a/internal/frontend/server/static/assets/CodeExplorer-CTkRy4Rl.js
+++ b/internal/frontend/server/static/assets/CodeExplorer-B2jXBi3h.js
@@ -1,4 +1,4 @@
-import{r,b as E,j as e}from"./index-BK8GKzWA.js";function xe(t){return t.Name||t.name||""}function je(t){return!!(t.IsDir??t.isDir)}function ce(t){return t.Path||t.path||""}function be(t){return t.Content||t.content||""}function ge(t){return t.Notice||t.notice||""}function we(t){return!!(t.Skip??t.skip)}function Ne(t,l){const n=t.replace(/\\/g,"/").replace(/\/+$/,""),a=l.replace(/\\/g,"/").replace(/^\/+/,"");return!n||n==="."?a:`${n}/${a}`}function oe(t){const l=t.replace(/\\/g,"/").replace(/\/+$/,"");if(!l||l===".")return"";const n=l.lastIndexOf("/");return n<0?"":l.slice(0,n)}function ve(t){const l=t.replace(/\\/g,"/").replace(/^\/+|\/+$/g,""),n=[{label:"root",path:""}];if(!l)return n;let a="";for(const u of l.split("/"))u&&(a=a?`${a}/${u}`:u,n.push({label:u,path:a}));return n}function de(t){return/\.(md|mdx|markdown)$/i.test(t)}function ye(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Se(t){const n=ye(t).split(`
+import{r,b as E,j as e}from"./index-BIBviZkd.js";function xe(t){return t.Name||t.name||""}function je(t){return!!(t.IsDir??t.isDir)}function ce(t){return t.Path||t.path||""}function be(t){return t.Content||t.content||""}function ge(t){return t.Notice||t.notice||""}function we(t){return!!(t.Skip??t.skip)}function Ne(t,l){const n=t.replace(/\\/g,"/").replace(/\/+$/,""),a=l.replace(/\\/g,"/").replace(/^\/+/,"");return!n||n==="."?a:`${n}/${a}`}function oe(t){const l=t.replace(/\\/g,"/").replace(/\/+$/,"");if(!l||l===".")return"";const n=l.lastIndexOf("/");return n<0?"":l.slice(0,n)}function ve(t){const l=t.replace(/\\/g,"/").replace(/^\/+|\/+$/g,""),n=[{label:"root",path:""}];if(!l)return n;let a="";for(const u of l.split("/"))u&&(a=a?`${a}/${u}`:u,n.push({label:u,path:a}));return n}function de(t){return/\.(md|mdx|markdown)$/i.test(t)}function ye(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Se(t){const n=ye(t).split(`
`),a=[];let u=!1;for(const c of n){if(c.startsWith("```")){u?(a.push(""),u=!1):(a.push('
'),u=!0);continue}if(u){a.push(c+`
`);continue}/^### /.test(c)?a.push(`${C(c.slice(4))}
`):/^## /.test(c)?a.push(`${C(c.slice(3))}
`):/^# /.test(c)?a.push(`${C(c.slice(2))}
`):/^[-*] /.test(c)?a.push(`${C(c.slice(2))}`):c.trim()===""?a.push("
"):a.push(`${C(c)}
`)}return u&&a.push("
"),a.join("")}function C(t){return t.replace(/`([^`]+)`/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1")}function Ce(t){if(!t)return{path:""};const l=/^(.+):(\d+)$/.exec(t);if(l){const n=Number(l[2]);return{path:l[1],line:Number.isFinite(n)&&n>0?n:void 0}}return{path:t}}function A(t,l={}){const n=new URLSearchParams(l);t&&n.set("root",t);const a=n.toString();return a?`?${a}`:""}function ke({available:t,rootID:l,entity:n,onOpenPath:a,changedFiles:u=[],expandedDiffs:c,toggleDiff:K,readOnly:O,canApply:ue}){const[m,M]=r.useState(""),[pe,F]=r.useState([]),[X,L]=r.useState(""),[he,Y]=r.useState(!1),[b,Z]=r.useState(""),[P,$]=r.useState([]),[R,k]=r.useState(""),[I,q]=r.useState(!1),D=r.useRef(null),[d,B]=r.useState(""),[f,T]=r.useState(),[p,H]=r.useState(null),[ee,V]=r.useState(""),[me,se]=r.useState(!1),[g,W]=r.useState("preview"),[w,N]=r.useState("changed"),[x,te]=r.useState(""),[v,re]=r.useState(""),[_,le]=r.useState(!1),[ae,J]=r.useState(""),fe=r.useMemo(()=>ve(m),[m]),Q=r.useRef(null);r.useEffect(()=>{M(""),F([]),B(""),H(null),Z(""),$([]),T(void 0),L(""),V(""),k("")},[l]),r.useEffect(()=>{const{path:s,line:i}=Ce(n);s&&(B(s),T(i),M(oe(s)),N("browse"))},[n,l]);const y=r.useCallback(async s=>{if(t){Y(!0),L("");try{const i=await E(`/v1/files${A(l,s?{path:s}:{})}`);F(i.entries||[]),M(s)}catch(i){L(i instanceof Error?i.message:String(i)),F([])}finally{Y(!1)}}},[t,l]);r.useEffect(()=>{y(m)},[t,l]);const j=r.useCallback(async(s,i)=>{if(!(!t||!s)){B(s),T(i),se(!0),V(""),H(null),a==null||a(s,i);try{const o=await E(`/v1/file${A(l,{path:s})}`);H(o),de(s)&&W("preview")}catch(o){V(o instanceof Error?o.message:String(o))}finally{se(!1)}}},[t,l,a]);r.useEffect(()=>{d&&j(d,f)},[d,l]),r.useEffect(()=>{if(f&&Q.current){const s=Q.current.querySelector(`[data-line="${f}"]`);s==null||s.scrollIntoView({block:"center"})}},[f,p]);const ne=r.useCallback(async s=>{var h;(h=D.current)==null||h.abort();const i=new AbortController;D.current=i;const o=s.trim();if(!o){$([]),k(""),q(!1);return}q(!0),k("");try{const S=await E(`/v1/files/search${A(l,{q:o,limit:"40"})}`);if(i.signal.aborted)return;$(S.paths||[])}catch(S){if(i.signal.aborted)return;$([]),k(S instanceof Error?S.message:String(S))}finally{i.signal.aborted||q(!1)}},[l]);if(r.useEffect(()=>{const s=window.setTimeout(()=>void ne(b),200);return()=>window.clearTimeout(s)},[b,ne]),!t)return e.jsxs("section",{className:"code-explorer","aria-label":"Code explorer",children:[e.jsx("h2",{children:"Code"}),e.jsx("p",{className:"muted",role:"status",children:"Files capability unavailable."})]});const U=p?be(p):"",z=p?we(p):!1,G=p?ge(p):"",ie=d&&de(d)&&!z&&U;return e.jsxs("section",{className:"code-explorer","aria-label":"Code explorer",children:[e.jsxs("header",{className:"code-explorer-head",children:[e.jsx("h2",{children:"Code"}),O?e.jsx("span",{className:"muted",children:"read-only"}):null,e.jsxs("div",{className:"code-view-tabs",role:"tablist","aria-label":"Code views",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":w==="browse",className:w==="browse"?"active":"",onClick:()=>N("browse"),children:"Browse"}),e.jsxs("button",{type:"button",role:"tab","aria-selected":w==="changed",className:w==="changed"?"active":"",onClick:()=>N("changed"),children:["Changed",u.length?` · ${u.length}`:""]})]})]}),w==="changed"?e.jsxs("div",{className:"changed-files","aria-label":"Changed files",children:[u.length?null:e.jsx("p",{className:"muted",children:"No changed files reported."}),u.map(s=>e.jsxs("article",{className:"changed-file",children:[e.jsxs("button",{type:"button","aria-expanded":c==null?void 0:c.has(s.path),onClick:()=>{K?K(s.path):(j(s.path),N("browse"))},children:[e.jsx("code",{children:s.path}),e.jsxs("span",{className:"diff-stat",children:[e.jsxs("b",{children:["+",s.added]}),e.jsxs("b",{children:["-",s.deleted]})]})]}),e.jsx("button",{type:"button",className:"code-open-file",onClick:()=>{j(s.path),N("browse")},children:"Open"}),c!=null&&c.has(s.path)?e.jsx("pre",{className:"diff-view",children:s.diff||"No textual diff available."}):null]},s.path))]}):e.jsxs("div",{className:"code-explorer-body",children:[e.jsxs("div",{className:"code-sidebar",children:[e.jsxs("label",{className:"code-search",children:[e.jsx("span",{className:"sr-only",children:"Search files"}),e.jsx("input",{value:b,onChange:s=>Z(s.target.value),placeholder:"Search files…","aria-label":"Search files"}),I?e.jsx("span",{className:"muted",children:"…"}):null]}),R?e.jsx("p",{className:"muted",role:"status",children:R}):null,b.trim()&&P.length>0?e.jsx("ul",{className:"code-search-hits","aria-label":"Search results",children:P.map(s=>e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>{s.endsWith("/")?y(s.replace(/\/$/,"")):j(s)},children:e.jsx("code",{children:s})})},s))}):null,b.trim()&&!I&&!P.length&&!R?e.jsx("p",{className:"muted",children:"No matches."}):null,e.jsx("nav",{className:"code-breadcrumbs","aria-label":"Path breadcrumbs",children:fe.map((s,i)=>e.jsxs("span",{children:[i>0?" / ":null,e.jsx("button",{type:"button",onClick:()=>void y(s.path),children:s.label})]},s.path||"root"))}),he?e.jsx("p",{className:"muted",children:"Loading…"}):null,X?e.jsx("p",{className:"muted",role:"alert",children:X}):null,e.jsxs("ul",{className:"code-tree",role:"tree","aria-label":"Directory",children:[m?e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>void y(oe(m)),children:".."})}):null,pe.map(s=>{const i=xe(s),o=je(s),h=Ne(m,i);return e.jsx("li",{role:"treeitem",children:e.jsxs("button",{type:"button",className:d===h?"active":"",onClick:()=>{o?y(h):j(h)},children:[o?"[dir] ":"",i,o?"/":""]})},h)})]})]}),e.jsx("div",{className:"code-viewer","aria-label":"File viewer",children:d?me?e.jsxs("p",{className:"muted",children:["Loading ",d,"…"]}):ee?e.jsx("p",{className:"muted",role:"alert",children:ee}):z?e.jsxs("div",{children:[e.jsx("h3",{children:e.jsx("code",{children:ce(p)||d})}),e.jsx("p",{className:"muted",role:"status",children:G||"Skipped"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"code-viewer-head",children:[e.jsx("h3",{children:e.jsx("code",{children:ce(p)||d})}),ie?e.jsxs("div",{className:"code-md-toggle",role:"group","aria-label":"Markdown view",children:[e.jsx("button",{type:"button","aria-pressed":g==="preview",className:g==="preview"?"active":"",onClick:()=>W("preview"),children:"Preview"}),e.jsx("button",{type:"button","aria-pressed":g==="raw",className:g==="raw"?"active":"",onClick:()=>W("raw"),children:"Raw"})]}):null,G?e.jsx("p",{className:"muted",children:G}):null]}),ie&&g==="preview"?e.jsx("div",{className:"code-md-preview",dangerouslySetInnerHTML:{__html:Se(U)}}):e.jsx("pre",{className:"code-raw",ref:Q,tabIndex:0,children:U.split(`
`).map((s,i)=>{const o=i+1;return e.jsxs("div",{"data-line":o,className:f===o?"code-line focus":"code-line",children:[e.jsx("span",{className:"code-gutter","aria-hidden":!0,children:o}),e.jsx("span",{className:"code-text",children:s||" "})]},o)})}),ue&&!O&&d&&!z?e.jsxs("fieldset",{className:"code-apply","aria-label":"Reviewed apply edit",children:[e.jsx("legend",{children:"Apply edit (reviewed)"}),e.jsxs("p",{className:"muted",children:["Target ",e.jsx("code",{children:d}),". Preview the replacement, then confirm. No free-form write API."]}),e.jsxs("label",{children:["Find (oldString)",e.jsx("textarea",{value:x,onChange:s=>te(s.target.value),rows:3,disabled:_})]}),e.jsxs("label",{children:["Replace (newString)",e.jsx("textarea",{value:v,onChange:s=>re(s.target.value),rows:3,disabled:_})]}),x||v?e.jsx("pre",{className:"diff-view code-apply-preview","aria-label":"Apply preview",children:`- ${x.split(`
diff --git a/internal/frontend/server/static/assets/Diagnostics-C72nldsD.js b/internal/frontend/server/static/assets/Diagnostics-gzTBvoN8.js
similarity index 98%
rename from internal/frontend/server/static/assets/Diagnostics-C72nldsD.js
rename to internal/frontend/server/static/assets/Diagnostics-gzTBvoN8.js
index 419d9736..9d6247a1 100644
--- a/internal/frontend/server/static/assets/Diagnostics-C72nldsD.js
+++ b/internal/frontend/server/static/assets/Diagnostics-gzTBvoN8.js
@@ -1 +1 @@
-import{r as a,b as o,j as e}from"./index-BK8GKzWA.js";function w({available:c}){const[r,j]=a.useState([]),[d,p]=a.useState([]),[h,b]=a.useState(""),[y,u]=a.useState(!1),[g,m]=a.useState(""),[n,l]=a.useState(""),i=a.useCallback(async()=>{if(c){u(!0),m("");try{const[s,t]=await Promise.all([o("/v1/lsp"),o("/v1/diagnostics")]);j(s.servers||[]),p(t.diagnostics||[]),b(t.note||s.note||"")}catch(s){m(s.message)}finally{u(!1)}}},[c]);a.useEffect(()=>{i()},[i]);const x=async s=>{l(s?`retry:${s}`:"retry:all");try{await o("/v1/lsp/retry",{method:"POST",body:JSON.stringify(s?{name:s}:{})}),await i()}catch(t){window.alert(t.message)}finally{l("")}},f=async s=>{if(window.confirm(`Disable language server “${s}”?`)){l(`disable:${s}`);try{await o(`/v1/lsp/${encodeURIComponent(s)}/disable`,{method:"POST"}),await i()}catch(t){window.alert(t.message)}finally{l("")}}};return c?y&&!r.length&&!d.length&&!h&&!g?e.jsx("section",{className:"unavailable",role:"status",children:e.jsx("strong",{children:"Loading diagnostics"})}):g?e.jsxs("section",{className:"unavailable",role:"status",children:[e.jsx("strong",{children:"Unable to load"}),e.jsx("p",{children:g})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"diagnostics-heading",children:[e.jsx("h2",{children:"Diagnostics"}),e.jsxs("div",{className:"diagnostics-actions",children:[e.jsx("button",{type:"button",disabled:!!n,onClick:()=>void i(),children:"Refresh"}),e.jsx("button",{type:"button",disabled:!!n,onClick:()=>void x(),children:n==="retry:all"?"Retrying…":"Retry all"})]})]}),e.jsx("h3",{className:"diagnostics-subhead",children:"Language servers"}),r.length===0?e.jsx("p",{className:"muted",role:"status",children:h||"no language servers configured (add lsp.servers in config)"}):e.jsx("div",{className:"project-list lsp-servers",children:r.map(s=>e.jsxs("article",{className:"lsp-server",children:[e.jsxs("header",{children:[e.jsx("h3",{children:s.name}),e.jsx("span",{className:`lsp-state state-${(s.state||"down").toLowerCase()}`,children:s.state})]}),e.jsxs("p",{children:[e.jsx("code",{children:s.command||"—"}),s.extensions&&s.extensions.length>0&&e.jsxs("small",{children:[" ",s.extensions.join(", ")]}),typeof s.openDocs=="number"&&s.openDocs>0&&e.jsxs("small",{children:[" docs=",s.openDocs]})]}),s.error&&s.state!=="disabled"&&e.jsx("p",{className:"lsp-error",children:s.error}),e.jsxs("div",{className:"diagnostics-actions",children:[e.jsx("button",{type:"button",disabled:!!n||s.state==="disabled",onClick:()=>void x(s.name),children:n===`retry:${s.name}`?"Retrying…":"Retry"}),e.jsx("button",{type:"button",disabled:!!n||s.state==="disabled",onClick:()=>void f(s.name),children:n===`disable:${s.name}`?"Disabling…":"Disable"})]})]},s.name))}),e.jsx("h3",{className:"diagnostics-subhead",children:"Findings"}),d.length===0?e.jsx("p",{className:"muted",role:"status",children:h||"no diagnostics"}):e.jsx("div",{className:"project-list diagnostics-list",children:d.map((s,t)=>e.jsxs("article",{className:"diagnostic-item",children:[e.jsxs("header",{children:[e.jsx("span",{className:`diag-severity sev-${(s.severity||"error").toLowerCase()}`,children:s.severity||"error"}),e.jsxs("code",{children:[s.path,":",s.line,":",s.character]})]}),e.jsx("p",{children:s.message||"(no message)"}),(s.source||s.code)&&e.jsxs("small",{children:[s.source||"",s.source&&s.code?" · ":"",s.code||""]})]},`${s.path}:${s.line}:${s.character}:${s.message}:${t}`))})]}):e.jsxs("section",{className:"unavailable",role:"status",children:[e.jsx("strong",{children:"Diagnostics unavailable"}),e.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})]})}export{w as DiagnosticsPanel};
+import{r as a,b as o,j as e}from"./index-BIBviZkd.js";function w({available:c}){const[r,j]=a.useState([]),[d,p]=a.useState([]),[h,b]=a.useState(""),[y,u]=a.useState(!1),[g,m]=a.useState(""),[n,l]=a.useState(""),i=a.useCallback(async()=>{if(c){u(!0),m("");try{const[s,t]=await Promise.all([o("/v1/lsp"),o("/v1/diagnostics")]);j(s.servers||[]),p(t.diagnostics||[]),b(t.note||s.note||"")}catch(s){m(s.message)}finally{u(!1)}}},[c]);a.useEffect(()=>{i()},[i]);const x=async s=>{l(s?`retry:${s}`:"retry:all");try{await o("/v1/lsp/retry",{method:"POST",body:JSON.stringify(s?{name:s}:{})}),await i()}catch(t){window.alert(t.message)}finally{l("")}},f=async s=>{if(window.confirm(`Disable language server “${s}”?`)){l(`disable:${s}`);try{await o(`/v1/lsp/${encodeURIComponent(s)}/disable`,{method:"POST"}),await i()}catch(t){window.alert(t.message)}finally{l("")}}};return c?y&&!r.length&&!d.length&&!h&&!g?e.jsx("section",{className:"unavailable",role:"status",children:e.jsx("strong",{children:"Loading diagnostics"})}):g?e.jsxs("section",{className:"unavailable",role:"status",children:[e.jsx("strong",{children:"Unable to load"}),e.jsx("p",{children:g})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"diagnostics-heading",children:[e.jsx("h2",{children:"Diagnostics"}),e.jsxs("div",{className:"diagnostics-actions",children:[e.jsx("button",{type:"button",disabled:!!n,onClick:()=>void i(),children:"Refresh"}),e.jsx("button",{type:"button",disabled:!!n,onClick:()=>void x(),children:n==="retry:all"?"Retrying…":"Retry all"})]})]}),e.jsx("h3",{className:"diagnostics-subhead",children:"Language servers"}),r.length===0?e.jsx("p",{className:"muted",role:"status",children:h||"no language servers configured (add lsp.servers in config)"}):e.jsx("div",{className:"project-list lsp-servers",children:r.map(s=>e.jsxs("article",{className:"lsp-server",children:[e.jsxs("header",{children:[e.jsx("h3",{children:s.name}),e.jsx("span",{className:`lsp-state state-${(s.state||"down").toLowerCase()}`,children:s.state})]}),e.jsxs("p",{children:[e.jsx("code",{children:s.command||"—"}),s.extensions&&s.extensions.length>0&&e.jsxs("small",{children:[" ",s.extensions.join(", ")]}),typeof s.openDocs=="number"&&s.openDocs>0&&e.jsxs("small",{children:[" docs=",s.openDocs]})]}),s.error&&s.state!=="disabled"&&e.jsx("p",{className:"lsp-error",children:s.error}),e.jsxs("div",{className:"diagnostics-actions",children:[e.jsx("button",{type:"button",disabled:!!n||s.state==="disabled",onClick:()=>void x(s.name),children:n===`retry:${s.name}`?"Retrying…":"Retry"}),e.jsx("button",{type:"button",disabled:!!n||s.state==="disabled",onClick:()=>void f(s.name),children:n===`disable:${s.name}`?"Disabling…":"Disable"})]})]},s.name))}),e.jsx("h3",{className:"diagnostics-subhead",children:"Findings"}),d.length===0?e.jsx("p",{className:"muted",role:"status",children:h||"no diagnostics"}):e.jsx("div",{className:"project-list diagnostics-list",children:d.map((s,t)=>e.jsxs("article",{className:"diagnostic-item",children:[e.jsxs("header",{children:[e.jsx("span",{className:`diag-severity sev-${(s.severity||"error").toLowerCase()}`,children:s.severity||"error"}),e.jsxs("code",{children:[s.path,":",s.line,":",s.character]})]}),e.jsx("p",{children:s.message||"(no message)"}),(s.source||s.code)&&e.jsxs("small",{children:[s.source||"",s.source&&s.code?" · ":"",s.code||""]})]},`${s.path}:${s.line}:${s.character}:${s.message}:${t}`))})]}):e.jsxs("section",{className:"unavailable",role:"status",children:[e.jsx("strong",{children:"Diagnostics unavailable"}),e.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})]})}export{w as DiagnosticsPanel};
diff --git a/internal/frontend/server/static/assets/Goals-0kpFGULK.js b/internal/frontend/server/static/assets/Goals-B2nPEdT8.js
similarity index 99%
rename from internal/frontend/server/static/assets/Goals-0kpFGULK.js
rename to internal/frontend/server/static/assets/Goals-B2nPEdT8.js
index 86051a6c..62476bc8 100644
--- a/internal/frontend/server/static/assets/Goals-0kpFGULK.js
+++ b/internal/frontend/server/static/assets/Goals-B2nPEdT8.js
@@ -1,3 +1,3 @@
-import{b as m,r as i,j as e}from"./index-BK8GKzWA.js";const T=()=>m("/v1/goals"),P=s=>m(`/v1/goals/${encodeURIComponent(s)}`),F=s=>m("/v1/goals",{method:"POST",body:JSON.stringify(s)}),O=s=>m(`/v1/goals/${encodeURIComponent(s)}/run`,{method:"POST",body:"{}"}),q=s=>m(`/v1/goals/${encodeURIComponent(s)}/pause`,{method:"POST",body:"{}"}),E=s=>m(`/v1/goals/${encodeURIComponent(s)}/resume`,{method:"POST",body:"{}"}),A=s=>m(`/v1/goals/${encodeURIComponent(s)}/abort`,{method:"POST",body:"{}"}),I=(s,d)=>m(`/v1/goals/${encodeURIComponent(s)}/log`);function L(s){return s==="pending"||s==="active"||s==="paused"}function $(s){return s==="pending"||s==="paused"||s==="active"}function D(s){return s==="active"}function G(s){return s==="pending"||s==="paused"}function U(s){return L(s)}function J({available:s,live:d}){const[h,p]=i.useState([]),[c,x]=i.useState(!1),[j,a]=i.useState(""),[o,b]=i.useState(null),[C,f]=i.useState([]),[g,r]=i.useState(""),[v,u]=i.useState(!1),[N,k]=i.useState(""),S=async()=>{if(s){x(!0),a("");try{const l=(await T()).goals||[];if(p(l),o){const n=l.find(w=>w.id===o.id);n&&b(n)}}catch(t){a(t.message)}finally{x(!1)}}};if(i.useEffect(()=>{S()},[s]),!s)return e.jsxs("section",{className:"unavailable",role:"status",children:[e.jsx("strong",{children:"Goals unavailable"}),e.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})]});const R=async t=>{a(""),k("");try{const[l,n]=await Promise.all([P(t),I(t)]);b(l),f(n.iterations||[])}catch(l){a(l.message)}},y=async(t,l)=>{if(d){r(t),a(""),k("");try{let n;if(l==="run"?n=await O(t):l==="pause"?n=await q(t):l==="resume"?n=await E(t):n=await A(t),k(`${l}: ${n.status}${n.failReason?` — ${n.failReason}`:""}`),(o==null?void 0:o.id)===t){b(n);const w=await I(t).catch(()=>({iterations:[]}));f(w.iterations||[])}await S()}catch(n){a(n.message)}finally{r("")}}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"workflow-head",children:[e.jsx("h2",{children:"Goals"}),e.jsxs("div",{className:"workflow-actions",children:[e.jsx("button",{type:"button",onClick:()=>void S(),disabled:c,children:"Refresh"}),e.jsx("button",{type:"button",onClick:()=>u(!0),children:"New"})]})]}),!d&&e.jsx("p",{className:"muted",role:"status",children:"Attach-only: list and inspect only. Run/pause/resume/abort require a live session."}),N&&e.jsx("p",{className:"muted",role:"status",children:N}),j&&e.jsxs("section",{className:"unavailable",role:"alert",children:[e.jsx("strong",{children:"Unable to load"}),e.jsx("p",{children:j})]}),c&&!h.length?e.jsx("p",{className:"muted",children:"Loading goals…"}):null,!c&&!h.length&&!j?e.jsx("p",{className:"muted",children:"No goals yet. Create one to drive the loop harness."}):null,e.jsx("div",{className:"workflow-list",children:h.map(t=>{var l;return e.jsxs("article",{className:"workflow-card",children:[e.jsxs("header",{children:[e.jsx("h3",{children:t.description||t.id}),e.jsxs("small",{children:[t.status," · iter ",t.lastIteration,"/",t.maxIterations," · $",t.costUsd.toFixed(4)]})]}),(l=t.criteria)!=null&&l.length?e.jsxs("p",{className:"workflow-grants",children:[e.jsx("span",{children:"Criteria"}),t.criteria.map((n,w)=>e.jsxs("code",{children:[n.satisfied?"OK":"…"," ",n.check||n.description]},w))]}):null,t.failReason&&e.jsx("p",{className:"workflow-error",role:"status",children:t.failReason}),e.jsxs("div",{className:"workflow-card-actions",children:[e.jsx("button",{type:"button",onClick:()=>void R(t.id),children:"Details"}),e.jsx("button",{type:"button",disabled:!d||g===t.id||!$(t.status),onClick:()=>void y(t.id,"run"),children:"Run"}),e.jsx("button",{type:"button",disabled:!d||g===t.id||!D(t.status),onClick:()=>void y(t.id,"pause"),children:"Pause"}),e.jsx("button",{type:"button",disabled:!d||g===t.id||!G(t.status),onClick:()=>void y(t.id,"resume"),children:"Resume"}),e.jsx("button",{type:"button",disabled:!d||g===t.id||!U(t.status),onClick:()=>void y(t.id,"abort"),children:"Abort"})]})]},t.id)})}),o&&e.jsx(B,{goal:o,log:C,onClose:()=>{b(null),f([])},live:d,busy:g===o.id,onControl:t=>void y(o.id,t)}),v&&e.jsx(K,{onClose:()=>u(!1),onCreated:async t=>{u(!1),k(`Created ${t.id}`),await S(),await R(t.id)}})]})}function B({goal:s,log:d,onClose:h,live:p,busy:c,onControl:x}){var j;return e.jsxs("dialog",{className:"workflow-dialog",open:!0,"aria-labelledby":"goal-detail-title",children:[e.jsx("div",{className:"dialog-rule"}),e.jsx("h2",{id:"goal-detail-title",children:s.description}),e.jsxs("dl",{className:"goal-meta",children:[e.jsx("dt",{children:"ID"}),e.jsx("dd",{children:e.jsx("code",{children:s.id})}),e.jsx("dt",{children:"Status"}),e.jsx("dd",{children:s.status}),e.jsx("dt",{children:"Iteration"}),e.jsxs("dd",{children:[s.lastIteration," / ",s.maxIterations]}),e.jsx("dt",{children:"Cost"}),e.jsxs("dd",{children:["$",s.costUsd.toFixed(4),s.maxCostUsd>0?` / $${s.maxCostUsd.toFixed(2)}`:""]}),(j=s.allowedTools)!=null&&j.length?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Tools"}),e.jsx("dd",{children:s.allowedTools.join(", ")})]}):null,s.failReason?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Reason"}),e.jsx("dd",{className:"workflow-error",children:s.failReason})]}):null]}),e.jsx("h3",{children:"Criteria"}),e.jsx("ul",{className:"goal-criteria",children:(s.criteria||[]).map((a,o)=>e.jsxs("li",{children:[e.jsx("strong",{children:a.satisfied?"OK":"FAIL"})," ",a.check||a.description]},o))}),e.jsx("h3",{children:"Iteration log"}),d.length?e.jsx("ol",{className:"goal-log",children:d.map(a=>e.jsxs("li",{children:[e.jsxs("strong",{children:["#",a.n]}),e.jsxs("span",{children:["$",a.costUsd.toFixed(4)]}),e.jsx("p",{children:a.summary||a.plan||"(empty)"})]},a.n))}):e.jsx("p",{className:"muted",children:"No iterations committed yet."}),e.jsxs("div",{className:"dialog-actions",children:[e.jsx("button",{type:"button",onClick:h,children:"Close"}),e.jsx("button",{type:"button",disabled:!p||c||!$(s.status),onClick:()=>x("run"),children:"Run"}),e.jsx("button",{type:"button",disabled:!p||c||!D(s.status),onClick:()=>x("pause"),children:"Pause"}),e.jsx("button",{type:"button",disabled:!p||c||!G(s.status),onClick:()=>x("resume"),children:"Resume"}),e.jsx("button",{type:"button",disabled:!p||c||!U(s.status),onClick:()=>x("abort"),children:"Abort"})]})]})}function K({onClose:s,onCreated:d}){const[h,p]=i.useState(""),[c,x]=i.useState("cmd: true"),[j,a]=i.useState("5"),[o,b]=i.useState(!1),[C,f]=i.useState(""),g=async r=>{r.preventDefault();const v=c.split(`
+import{b as m,r as i,j as e}from"./index-BIBviZkd.js";const T=()=>m("/v1/goals"),P=s=>m(`/v1/goals/${encodeURIComponent(s)}`),F=s=>m("/v1/goals",{method:"POST",body:JSON.stringify(s)}),O=s=>m(`/v1/goals/${encodeURIComponent(s)}/run`,{method:"POST",body:"{}"}),q=s=>m(`/v1/goals/${encodeURIComponent(s)}/pause`,{method:"POST",body:"{}"}),E=s=>m(`/v1/goals/${encodeURIComponent(s)}/resume`,{method:"POST",body:"{}"}),A=s=>m(`/v1/goals/${encodeURIComponent(s)}/abort`,{method:"POST",body:"{}"}),I=(s,d)=>m(`/v1/goals/${encodeURIComponent(s)}/log`);function L(s){return s==="pending"||s==="active"||s==="paused"}function $(s){return s==="pending"||s==="paused"||s==="active"}function D(s){return s==="active"}function G(s){return s==="pending"||s==="paused"}function U(s){return L(s)}function J({available:s,live:d}){const[h,p]=i.useState([]),[c,x]=i.useState(!1),[j,a]=i.useState(""),[o,b]=i.useState(null),[C,f]=i.useState([]),[g,r]=i.useState(""),[v,u]=i.useState(!1),[N,k]=i.useState(""),S=async()=>{if(s){x(!0),a("");try{const l=(await T()).goals||[];if(p(l),o){const n=l.find(w=>w.id===o.id);n&&b(n)}}catch(t){a(t.message)}finally{x(!1)}}};if(i.useEffect(()=>{S()},[s]),!s)return e.jsxs("section",{className:"unavailable",role:"status",children:[e.jsx("strong",{children:"Goals unavailable"}),e.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})]});const R=async t=>{a(""),k("");try{const[l,n]=await Promise.all([P(t),I(t)]);b(l),f(n.iterations||[])}catch(l){a(l.message)}},y=async(t,l)=>{if(d){r(t),a(""),k("");try{let n;if(l==="run"?n=await O(t):l==="pause"?n=await q(t):l==="resume"?n=await E(t):n=await A(t),k(`${l}: ${n.status}${n.failReason?` — ${n.failReason}`:""}`),(o==null?void 0:o.id)===t){b(n);const w=await I(t).catch(()=>({iterations:[]}));f(w.iterations||[])}await S()}catch(n){a(n.message)}finally{r("")}}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"workflow-head",children:[e.jsx("h2",{children:"Goals"}),e.jsxs("div",{className:"workflow-actions",children:[e.jsx("button",{type:"button",onClick:()=>void S(),disabled:c,children:"Refresh"}),e.jsx("button",{type:"button",onClick:()=>u(!0),children:"New"})]})]}),!d&&e.jsx("p",{className:"muted",role:"status",children:"Attach-only: list and inspect only. Run/pause/resume/abort require a live session."}),N&&e.jsx("p",{className:"muted",role:"status",children:N}),j&&e.jsxs("section",{className:"unavailable",role:"alert",children:[e.jsx("strong",{children:"Unable to load"}),e.jsx("p",{children:j})]}),c&&!h.length?e.jsx("p",{className:"muted",children:"Loading goals…"}):null,!c&&!h.length&&!j?e.jsx("p",{className:"muted",children:"No goals yet. Create one to drive the loop harness."}):null,e.jsx("div",{className:"workflow-list",children:h.map(t=>{var l;return e.jsxs("article",{className:"workflow-card",children:[e.jsxs("header",{children:[e.jsx("h3",{children:t.description||t.id}),e.jsxs("small",{children:[t.status," · iter ",t.lastIteration,"/",t.maxIterations," · $",t.costUsd.toFixed(4)]})]}),(l=t.criteria)!=null&&l.length?e.jsxs("p",{className:"workflow-grants",children:[e.jsx("span",{children:"Criteria"}),t.criteria.map((n,w)=>e.jsxs("code",{children:[n.satisfied?"OK":"…"," ",n.check||n.description]},w))]}):null,t.failReason&&e.jsx("p",{className:"workflow-error",role:"status",children:t.failReason}),e.jsxs("div",{className:"workflow-card-actions",children:[e.jsx("button",{type:"button",onClick:()=>void R(t.id),children:"Details"}),e.jsx("button",{type:"button",disabled:!d||g===t.id||!$(t.status),onClick:()=>void y(t.id,"run"),children:"Run"}),e.jsx("button",{type:"button",disabled:!d||g===t.id||!D(t.status),onClick:()=>void y(t.id,"pause"),children:"Pause"}),e.jsx("button",{type:"button",disabled:!d||g===t.id||!G(t.status),onClick:()=>void y(t.id,"resume"),children:"Resume"}),e.jsx("button",{type:"button",disabled:!d||g===t.id||!U(t.status),onClick:()=>void y(t.id,"abort"),children:"Abort"})]})]},t.id)})}),o&&e.jsx(B,{goal:o,log:C,onClose:()=>{b(null),f([])},live:d,busy:g===o.id,onControl:t=>void y(o.id,t)}),v&&e.jsx(K,{onClose:()=>u(!1),onCreated:async t=>{u(!1),k(`Created ${t.id}`),await S(),await R(t.id)}})]})}function B({goal:s,log:d,onClose:h,live:p,busy:c,onControl:x}){var j;return e.jsxs("dialog",{className:"workflow-dialog",open:!0,"aria-labelledby":"goal-detail-title",children:[e.jsx("div",{className:"dialog-rule"}),e.jsx("h2",{id:"goal-detail-title",children:s.description}),e.jsxs("dl",{className:"goal-meta",children:[e.jsx("dt",{children:"ID"}),e.jsx("dd",{children:e.jsx("code",{children:s.id})}),e.jsx("dt",{children:"Status"}),e.jsx("dd",{children:s.status}),e.jsx("dt",{children:"Iteration"}),e.jsxs("dd",{children:[s.lastIteration," / ",s.maxIterations]}),e.jsx("dt",{children:"Cost"}),e.jsxs("dd",{children:["$",s.costUsd.toFixed(4),s.maxCostUsd>0?` / $${s.maxCostUsd.toFixed(2)}`:""]}),(j=s.allowedTools)!=null&&j.length?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Tools"}),e.jsx("dd",{children:s.allowedTools.join(", ")})]}):null,s.failReason?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Reason"}),e.jsx("dd",{className:"workflow-error",children:s.failReason})]}):null]}),e.jsx("h3",{children:"Criteria"}),e.jsx("ul",{className:"goal-criteria",children:(s.criteria||[]).map((a,o)=>e.jsxs("li",{children:[e.jsx("strong",{children:a.satisfied?"OK":"FAIL"})," ",a.check||a.description]},o))}),e.jsx("h3",{children:"Iteration log"}),d.length?e.jsx("ol",{className:"goal-log",children:d.map(a=>e.jsxs("li",{children:[e.jsxs("strong",{children:["#",a.n]}),e.jsxs("span",{children:["$",a.costUsd.toFixed(4)]}),e.jsx("p",{children:a.summary||a.plan||"(empty)"})]},a.n))}):e.jsx("p",{className:"muted",children:"No iterations committed yet."}),e.jsxs("div",{className:"dialog-actions",children:[e.jsx("button",{type:"button",onClick:h,children:"Close"}),e.jsx("button",{type:"button",disabled:!p||c||!$(s.status),onClick:()=>x("run"),children:"Run"}),e.jsx("button",{type:"button",disabled:!p||c||!D(s.status),onClick:()=>x("pause"),children:"Pause"}),e.jsx("button",{type:"button",disabled:!p||c||!G(s.status),onClick:()=>x("resume"),children:"Resume"}),e.jsx("button",{type:"button",disabled:!p||c||!U(s.status),onClick:()=>x("abort"),children:"Abort"})]})]})}function K({onClose:s,onCreated:d}){const[h,p]=i.useState(""),[c,x]=i.useState("cmd: true"),[j,a]=i.useState("5"),[o,b]=i.useState(!1),[C,f]=i.useState(""),g=async r=>{r.preventDefault();const v=c.split(`
`).map(u=>u.trim()).filter(Boolean);if(!h.trim()||!v.length){f("Description and at least one criterion are required.");return}b(!0),f("");try{const u=Number(j),N=await F({description:h.trim(),criteria:v,maxIterations:Number.isFinite(u)&&u>0?u:void 0});await d(N)}catch(u){f(u.message)}finally{b(!1)}};return e.jsxs("dialog",{className:"workflow-dialog",open:!0,"aria-labelledby":"goal-create-title",onCancel:r=>{r.preventDefault(),s()},children:[e.jsx("div",{className:"dialog-rule"}),e.jsx("h2",{id:"goal-create-title",children:"New goal"}),e.jsxs("form",{className:"workflow-builder",onSubmit:r=>void g(r),children:[e.jsxs("fieldset",{children:[e.jsx("legend",{children:"Definition"}),e.jsxs("label",{children:["Description",e.jsx("input",{value:h,onChange:r=>p(r.target.value),placeholder:"What should succeed?",required:!0})]}),e.jsxs("label",{children:["Criteria",e.jsx("textarea",{value:c,onChange:r=>x(r.target.value),rows:4,placeholder:`cmd: pytest -q
cmd: go test ./...`,"aria-label":"Criteria (one CheckSpec per line)"})]}),e.jsxs("label",{children:["Max iterations",e.jsx("input",{type:"number",min:1,max:1e4,value:j,onChange:r=>a(r.target.value)})]})]}),e.jsxs("p",{className:"muted",children:["Criteria use CheckSpec form: ",e.jsx("code",{children:"cmd:"}),", ",e.jsx("code",{children:"predicate:"}),", or ",e.jsx("code",{children:"judge:"}),". Empty tool allowlist = evaluate-only (no side effects)."]}),C&&e.jsx("p",{className:"workflow-error",role:"alert",children:C}),e.jsxs("div",{className:"dialog-actions",children:[e.jsx("button",{type:"button",onClick:s,children:"Cancel"}),e.jsx("button",{type:"submit",disabled:o,children:o?"Saving…":"Create"})]})]})]})}export{J as GoalsPanel};
diff --git a/internal/frontend/server/static/assets/MCP-CoXRwoSS.js b/internal/frontend/server/static/assets/MCP-DIJaaFpI.js
similarity index 97%
rename from internal/frontend/server/static/assets/MCP-CoXRwoSS.js
rename to internal/frontend/server/static/assets/MCP-DIJaaFpI.js
index c36691a4..cabd03de 100644
--- a/internal/frontend/server/static/assets/MCP-CoXRwoSS.js
+++ b/internal/frontend/server/static/assets/MCP-DIJaaFpI.js
@@ -1 +1 @@
-import{b as p,r as a,j as s,C as N,c as S,S as P,s as m}from"./index-BK8GKzWA.js";const w=()=>p("/v1/mcp"),M=e=>p("/v1/mcp/retry",{method:"POST",body:JSON.stringify(e?{name:e}:{})}),k=e=>p("/v1/mcp/disable",{method:"POST",body:JSON.stringify({name:e})});function R(e){switch(e){case"up":return m("complete");case"disabled":return m("canceled");case"error":return m("failed");default:return m("blocked")}}function B({available:e}){const[n,g]=a.useState([]),[l,b]=a.useState(!1),[h,x]=a.useState(""),[i,c]=a.useState(""),[j,o]=a.useState(""),r=async()=>{if(e){b(!0),x("");try{const t=await w();g(t.servers||[])}catch(t){x(t.message)}finally{b(!1)}}};if(a.useEffect(()=>{r()},[e]),!e)return s.jsx(N,{name:"MCP"});const y=async t=>{c(t||"*"),o("");try{await M(t),o(t?`Retried ${t}.`:"Retry complete for non-up servers."),await r()}catch(u){window.alert(u.message)}finally{c("")}},C=async t=>{if(window.confirm(`Disable MCP server “${t}” and unregister its tools?`)){c(t),o("");try{await k(t),o(`Disabled ${t}.`),await r()}catch(d){window.alert(d.message)}finally{c("")}}};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mcp-head",children:[s.jsx("h2",{children:"MCP servers"}),s.jsxs("div",{className:"mcp-actions",children:[s.jsx("button",{type:"button",onClick:()=>void r(),disabled:l||!!i,children:"Refresh"}),s.jsx("button",{type:"button",onClick:()=>void y(),disabled:l||!!i||!n.length,children:"Retry all"})]})]}),j&&s.jsx("p",{className:"muted",role:"status",children:j}),h&&s.jsxs("section",{className:"unavailable",role:"alert",children:[s.jsx("strong",{children:"Unable to load"}),s.jsx("p",{children:h})]}),l&&!n.length?s.jsx(S,{label:"Loading MCP status…"}):null,!l&&!n.length&&!h?s.jsx("p",{className:"muted",children:"No MCP servers configured. Add servers in ~/.strike/mcp.jsonc."}):null,s.jsx("div",{className:"mcp-list",role:"list","aria-label":"MCP servers",children:n.map(t=>{const d=t.transport||"stdio",u=i===t.name||i==="*";return s.jsxs("article",{className:"mcp-card",role:"listitem",children:[s.jsxs("header",{children:[s.jsx("h3",{children:t.name}),s.jsx(P,{kind:R(t.state),label:t.state,className:`mcp-state ${t.state}`})]}),s.jsxs("p",{children:[s.jsx("span",{children:d}),t.command?s.jsxs(s.Fragment,{children:[" · ",s.jsx("code",{children:t.command})]}):null," · ","tools=",t.toolCount??0]}),t.error&&t.state!=="disabled"?s.jsx("p",{className:"mcp-error",children:t.error}):null,t.tools&&t.tools.length>0?s.jsx("div",{className:"mcp-tools","aria-label":`${t.name} tools`,children:t.tools.map(f=>s.jsx("code",{children:f},f))}):null,s.jsxs("div",{className:"mcp-card-actions",children:[s.jsx("button",{type:"button",disabled:u||t.state==="up",onClick:()=>void y(t.name),title:t.state==="up"?"Server is already up":"Reconnect (also re-enables disabled)",children:"Retry"}),s.jsx("button",{type:"button",disabled:u||t.state==="disabled",onClick:()=>void C(t.name),children:"Disable"})]})]},t.name)})})]})}export{B as MCPPanel};
+import{b as p,r as a,j as s,C as N,c as S,S as P,s as m}from"./index-BIBviZkd.js";const w=()=>p("/v1/mcp"),M=e=>p("/v1/mcp/retry",{method:"POST",body:JSON.stringify(e?{name:e}:{})}),k=e=>p("/v1/mcp/disable",{method:"POST",body:JSON.stringify({name:e})});function R(e){switch(e){case"up":return m("complete");case"disabled":return m("canceled");case"error":return m("failed");default:return m("blocked")}}function B({available:e}){const[n,g]=a.useState([]),[l,b]=a.useState(!1),[h,x]=a.useState(""),[i,c]=a.useState(""),[j,o]=a.useState(""),r=async()=>{if(e){b(!0),x("");try{const t=await w();g(t.servers||[])}catch(t){x(t.message)}finally{b(!1)}}};if(a.useEffect(()=>{r()},[e]),!e)return s.jsx(N,{name:"MCP"});const y=async t=>{c(t||"*"),o("");try{await M(t),o(t?`Retried ${t}.`:"Retry complete for non-up servers."),await r()}catch(u){window.alert(u.message)}finally{c("")}},C=async t=>{if(window.confirm(`Disable MCP server “${t}” and unregister its tools?`)){c(t),o("");try{await k(t),o(`Disabled ${t}.`),await r()}catch(d){window.alert(d.message)}finally{c("")}}};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mcp-head",children:[s.jsx("h2",{children:"MCP servers"}),s.jsxs("div",{className:"mcp-actions",children:[s.jsx("button",{type:"button",onClick:()=>void r(),disabled:l||!!i,children:"Refresh"}),s.jsx("button",{type:"button",onClick:()=>void y(),disabled:l||!!i||!n.length,children:"Retry all"})]})]}),j&&s.jsx("p",{className:"muted",role:"status",children:j}),h&&s.jsxs("section",{className:"unavailable",role:"alert",children:[s.jsx("strong",{children:"Unable to load"}),s.jsx("p",{children:h})]}),l&&!n.length?s.jsx(S,{label:"Loading MCP status…"}):null,!l&&!n.length&&!h?s.jsx("p",{className:"muted",children:"No MCP servers configured. Add servers in ~/.strike/mcp.jsonc."}):null,s.jsx("div",{className:"mcp-list",role:"list","aria-label":"MCP servers",children:n.map(t=>{const d=t.transport||"stdio",u=i===t.name||i==="*";return s.jsxs("article",{className:"mcp-card",role:"listitem",children:[s.jsxs("header",{children:[s.jsx("h3",{children:t.name}),s.jsx(P,{kind:R(t.state),label:t.state,className:`mcp-state ${t.state}`})]}),s.jsxs("p",{children:[s.jsx("span",{children:d}),t.command?s.jsxs(s.Fragment,{children:[" · ",s.jsx("code",{children:t.command})]}):null," · ","tools=",t.toolCount??0]}),t.error&&t.state!=="disabled"?s.jsx("p",{className:"mcp-error",children:t.error}):null,t.tools&&t.tools.length>0?s.jsx("div",{className:"mcp-tools","aria-label":`${t.name} tools`,children:t.tools.map(f=>s.jsx("code",{children:f},f))}):null,s.jsxs("div",{className:"mcp-card-actions",children:[s.jsx("button",{type:"button",disabled:u||t.state==="up",onClick:()=>void y(t.name),title:t.state==="up"?"Server is already up":"Reconnect (also re-enables disabled)",children:"Retry"}),s.jsx("button",{type:"button",disabled:u||t.state==="disabled",onClick:()=>void C(t.name),children:"Disable"})]})]},t.name)})})]})}export{B as MCPPanel};
diff --git a/internal/frontend/server/static/assets/PaneView-CmrtsIj-.js b/internal/frontend/server/static/assets/PaneView-CsX17cLJ.js
similarity index 97%
rename from internal/frontend/server/static/assets/PaneView-CmrtsIj-.js
rename to internal/frontend/server/static/assets/PaneView-CsX17cLJ.js
index f387f3e0..5f2aa106 100644
--- a/internal/frontend/server/static/assets/PaneView-CmrtsIj-.js
+++ b/internal/frontend/server/static/assets/PaneView-CsX17cLJ.js
@@ -1 +1 @@
-import{j as a}from"./index-BK8GKzWA.js";import{resolveFrom as u}from"./panesApi-Gdyy8rqS.js";const w=80;function N(e){switch((e||"body").toLowerCase()){case"title":return"pane-role title";case"muted":return"pane-role muted";case"accent":return"pane-role accent";case"success":return"pane-role success";case"warning":return"pane-role warning";case"error":case"danger":return"pane-role error";default:return"pane-role body"}}function x(e,s){if(e.textFrom){const c=u(s,e.textFrom);if(c)return c}return e.text||""}function b(e){if(e)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0}}function f(e){switch((e||"").trim().toLowerCase()){case"check":case"ok":return"✓";case"warn":case"warning":return"◦";case"error":case"err":return"✗";case"agent":return"◆";case"folder":case"file":return"·";default:return""}}function g(e){const s={};return e.flex!=null&&e.flex>0&&(s.flexGrow=e.flex),e.min!=null&&e.min>0&&(s.minWidth=`${e.min}ch`),s}function h(e){const s=f(e.icon);return a.jsxs(a.Fragment,{children:[a.jsxs("span",{children:[s?a.jsxs("span",{"aria-hidden":"true",children:[s," "]}):null,a.jsx("strong",{children:e.label||e.id})]}),e.detail?a.jsxs("span",{className:"muted",children:[" ",e.detail]}):null]})}function j({node:e,feeds:s,depth:c=0,onSelect:i}){if(!e||c>16)return a.jsx("p",{className:"muted",children:"view truncated"});const p=(e.type||"").toLowerCase();switch(p){case"column":return a.jsx("div",{className:"pane-column",style:{gap:e.gap?`${e.gap*4}px`:void 0},children:(e.children||[]).map((r,t)=>a.jsx(j,{node:r,feeds:s,depth:c+1,onSelect:i},t))});case"row":{const r=e.children||[],t=r.length,l=e.gap?e.gap*4:0,n=!!e.wrap,m=t>1?l*(t-1):0,o={gap:l||void 0};return!n&&t>0&&(o["--stack-at"]=`${t*w+m}px`),a.jsx("div",{className:n?"pane-row wrap":"pane-row",style:o,children:r.map((d,v)=>a.jsx("div",{className:"pane-row-cell",style:g(d),children:a.jsx(j,{node:d,feeds:s,depth:c+1,onSelect:i})},v))})}case"text":case"markdown":return a.jsx("p",{className:N(e.style),style:b(e.truncate),children:x(e,s)});case"kv":return a.jsx("dl",{className:"pane-kv",children:(e.entries||[]).map((r,t)=>a.jsxs("div",{className:"pane-kv-row",children:[a.jsx("dt",{children:r.key||""}),a.jsx("dd",{children:r.valueFrom?u(s,r.valueFrom)||r.value||"—":r.value||"—"})]},t))});case"list":return a.jsx("ul",{className:"pane-list",role:e.selectable?"listbox":"list",children:(e.items||[]).map((r,t)=>{const l=e.selectedId&&r.id===e.selectedId;return a.jsx("li",{className:l?"selected":void 0,role:e.selectable?"option":void 0,"aria-selected":e.selectable?!!l:void 0,children:e.selectable&&r.id?a.jsx("button",{type:"button",className:"pane-list-btn",onClick:()=>i==null?void 0:i(r.id),children:h(r)}):h(r)},r.id||t)})});case"table":return a.jsxs("table",{className:"pane-table",children:[a.jsx("thead",{children:a.jsx("tr",{children:(e.columns||[]).map(r=>a.jsx("th",{children:r.header||r.id},r.id||r.header))})}),a.jsx("tbody",{children:(e.rows||[]).map((r,t)=>a.jsx("tr",{children:(e.columns||[]).map(l=>{var n;return a.jsx("td",{children:((n=r.cells)==null?void 0:n[l.id||""])||""},l.id||l.header)})},t))})]});case"meter":{const r=e.valueFrom?u(s,e.valueFrom):String(e.value??""),t=e.maxFrom?u(s,e.maxFrom):String(e.max??""),l=Number(r)||0,n=Number(t)||0,m=n>0?Math.min(100,Math.round(l/n*100)):0;return a.jsxs("div",{className:"pane-meter",role:"meter","aria-valuenow":l,"aria-valuemin":0,"aria-valuemax":n||void 0,children:[e.label?a.jsx("span",{className:"muted",children:e.label}):null,a.jsx("div",{className:"pane-meter-track",children:a.jsx("div",{className:`pane-meter-fill tone-${e.tone||"accent"}`,style:{width:`${m}%`}})}),a.jsx("span",{className:"muted",children:n>0?`${l} / ${n}`:String(l)})]})}case"badge":return a.jsx("span",{className:`pane-badge tone-${e.tone||"accent"}`,children:e.label||x(e,s)});case"spacer":return a.jsx("div",{className:"pane-spacer",style:{height:`${Math.min(8,Math.max(1,e.min||1))*8}px`}});case"divider":return a.jsx("hr",{className:"pane-divider"});case"empty":return a.jsxs("div",{className:"pane-empty",children:[a.jsx("p",{className:"muted",children:e.text||"Empty"}),e.hint?a.jsx("p",{className:"muted",children:e.hint}):null]});default:return a.jsxs("p",{className:"muted",children:["unsupported node: ",p||"?"]})}}export{j as P};
+import{j as a}from"./index-BIBviZkd.js";import{resolveFrom as u}from"./panesApi-1q1G3asp.js";const w=80;function N(e){switch((e||"body").toLowerCase()){case"title":return"pane-role title";case"muted":return"pane-role muted";case"accent":return"pane-role accent";case"success":return"pane-role success";case"warning":return"pane-role warning";case"error":case"danger":return"pane-role error";default:return"pane-role body"}}function x(e,s){if(e.textFrom){const c=u(s,e.textFrom);if(c)return c}return e.text||""}function b(e){if(e)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0}}function f(e){switch((e||"").trim().toLowerCase()){case"check":case"ok":return"✓";case"warn":case"warning":return"◦";case"error":case"err":return"✗";case"agent":return"◆";case"folder":case"file":return"·";default:return""}}function g(e){const s={};return e.flex!=null&&e.flex>0&&(s.flexGrow=e.flex),e.min!=null&&e.min>0&&(s.minWidth=`${e.min}ch`),s}function h(e){const s=f(e.icon);return a.jsxs(a.Fragment,{children:[a.jsxs("span",{children:[s?a.jsxs("span",{"aria-hidden":"true",children:[s," "]}):null,a.jsx("strong",{children:e.label||e.id})]}),e.detail?a.jsxs("span",{className:"muted",children:[" ",e.detail]}):null]})}function j({node:e,feeds:s,depth:c=0,onSelect:i}){if(!e||c>16)return a.jsx("p",{className:"muted",children:"view truncated"});const p=(e.type||"").toLowerCase();switch(p){case"column":return a.jsx("div",{className:"pane-column",style:{gap:e.gap?`${e.gap*4}px`:void 0},children:(e.children||[]).map((r,t)=>a.jsx(j,{node:r,feeds:s,depth:c+1,onSelect:i},t))});case"row":{const r=e.children||[],t=r.length,l=e.gap?e.gap*4:0,n=!!e.wrap,m=t>1?l*(t-1):0,o={gap:l||void 0};return!n&&t>0&&(o["--stack-at"]=`${t*w+m}px`),a.jsx("div",{className:n?"pane-row wrap":"pane-row",style:o,children:r.map((d,v)=>a.jsx("div",{className:"pane-row-cell",style:g(d),children:a.jsx(j,{node:d,feeds:s,depth:c+1,onSelect:i})},v))})}case"text":case"markdown":return a.jsx("p",{className:N(e.style),style:b(e.truncate),children:x(e,s)});case"kv":return a.jsx("dl",{className:"pane-kv",children:(e.entries||[]).map((r,t)=>a.jsxs("div",{className:"pane-kv-row",children:[a.jsx("dt",{children:r.key||""}),a.jsx("dd",{children:r.valueFrom?u(s,r.valueFrom)||r.value||"—":r.value||"—"})]},t))});case"list":return a.jsx("ul",{className:"pane-list",role:e.selectable?"listbox":"list",children:(e.items||[]).map((r,t)=>{const l=e.selectedId&&r.id===e.selectedId;return a.jsx("li",{className:l?"selected":void 0,role:e.selectable?"option":void 0,"aria-selected":e.selectable?!!l:void 0,children:e.selectable&&r.id?a.jsx("button",{type:"button",className:"pane-list-btn",onClick:()=>i==null?void 0:i(r.id),children:h(r)}):h(r)},r.id||t)})});case"table":return a.jsxs("table",{className:"pane-table",children:[a.jsx("thead",{children:a.jsx("tr",{children:(e.columns||[]).map(r=>a.jsx("th",{children:r.header||r.id},r.id||r.header))})}),a.jsx("tbody",{children:(e.rows||[]).map((r,t)=>a.jsx("tr",{children:(e.columns||[]).map(l=>{var n;return a.jsx("td",{children:((n=r.cells)==null?void 0:n[l.id||""])||""},l.id||l.header)})},t))})]});case"meter":{const r=e.valueFrom?u(s,e.valueFrom):String(e.value??""),t=e.maxFrom?u(s,e.maxFrom):String(e.max??""),l=Number(r)||0,n=Number(t)||0,m=n>0?Math.min(100,Math.round(l/n*100)):0;return a.jsxs("div",{className:"pane-meter",role:"meter","aria-valuenow":l,"aria-valuemin":0,"aria-valuemax":n||void 0,children:[e.label?a.jsx("span",{className:"muted",children:e.label}):null,a.jsx("div",{className:"pane-meter-track",children:a.jsx("div",{className:`pane-meter-fill tone-${e.tone||"accent"}`,style:{width:`${m}%`}})}),a.jsx("span",{className:"muted",children:n>0?`${l} / ${n}`:String(l)})]})}case"badge":return a.jsx("span",{className:`pane-badge tone-${e.tone||"accent"}`,children:e.label||x(e,s)});case"spacer":return a.jsx("div",{className:"pane-spacer",style:{height:`${Math.min(8,Math.max(1,e.min||1))*8}px`}});case"divider":return a.jsx("hr",{className:"pane-divider"});case"empty":return a.jsxs("div",{className:"pane-empty",children:[a.jsx("p",{className:"muted",children:e.text||"Empty"}),e.hint?a.jsx("p",{className:"muted",children:e.hint}):null]});default:return a.jsxs("p",{className:"muted",children:["unsupported node: ",p||"?"]})}}export{j as P};
diff --git a/internal/frontend/server/static/assets/Panes-CWuiX4Ys.js b/internal/frontend/server/static/assets/Panes-cnXdgOPa.js
similarity index 94%
rename from internal/frontend/server/static/assets/Panes-CWuiX4Ys.js
rename to internal/frontend/server/static/assets/Panes-cnXdgOPa.js
index 41e777ee..8b9a01f3 100644
--- a/internal/frontend/server/static/assets/Panes-CWuiX4Ys.js
+++ b/internal/frontend/server/static/assets/Panes-cnXdgOPa.js
@@ -1 +1 @@
-import{r,j as s}from"./index-BK8GKzWA.js";import{P}from"./PaneView-CmrtsIj-.js";import{listPanes as S,paneSnapshot as N,mountPane as D,unmountPane as C,paneInput as A}from"./panesApi-Gdyy8rqS.js";function K({available:h,focusId:d,readOnly:u}){const[i,b]=r.useState([]),[x,j]=r.useState(!1),[v,c]=r.useState(""),[a,p]=r.useState(""),[t,l]=r.useState(null),[f,m]=r.useState(!1),g=async()=>{if(h){j(!0),c("");try{const e=await S();b(e.panes||[])}catch(e){c(e.message)}finally{j(!1)}}};if(r.useEffect(()=>{g()},[h]),r.useEffect(()=>{if(!a){l(null);return}let e=!1;const n=async()=>{try{const k=await N(a);e||l(k)}catch{}};n();const E=window.setInterval(()=>void n(),500);return()=>{e=!0,window.clearInterval(E)}},[a]),!h)return s.jsxs("section",{className:"unavailable",role:"status",children:[s.jsx("strong",{children:"Plugin panes unavailable"}),s.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})]});const y=async e=>{m(!0),c("");try{const n=await D(e.id);p(e.id),l(n)}catch(n){c(n.message),p(e.id),l({id:e.id,mode:e.mode,title:e.title,error:e.loadError||n.message})}finally{m(!1)}};r.useEffect(()=>{if(!d||!i.length)return;const e=i.find(n=>n.id===d);e&&a!==d&&y(e)},[d,i]);const w=async()=>{if(a){m(!0);try{await C(a)}catch{}finally{p(""),l(null),m(!1)}}},o=async e=>{if(!(u||!a||!t||t.mode!=="process"))try{await A(a,{kind:"key",key:e,mods:[]});const n=await N(a);l(n)}catch(n){c(n.message)}};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mcp-head",children:[s.jsx("h2",{children:"Plugin panes"}),s.jsxs("div",{className:"mcp-actions",children:[s.jsx("button",{type:"button",onClick:()=>void g(),disabled:x||f,children:"Refresh"}),a&&s.jsx("button",{type:"button",onClick:()=>void w(),disabled:f,children:"Close pane"})]})]}),v&&s.jsxs("section",{className:"unavailable",role:"alert",children:[s.jsx("strong",{children:"Error"}),s.jsx("p",{children:v})]}),!a&&s.jsx(s.Fragment,{children:x&&!i.length?s.jsx("p",{className:"muted",children:"Loading…"}):i.length===0?s.jsx("p",{className:"muted",children:"No enabled plugin panes. Install/enable a pane plugin via the plugins tab."}):s.jsx("div",{className:"mcp-list",children:i.map(e=>s.jsxs("article",{className:"mcp-card",children:[s.jsxs("header",{children:[s.jsx("h3",{children:e.title||e.id}),s.jsx("span",{className:"mcp-state",children:e.mode})]}),s.jsx("p",{className:"muted",children:e.provenance}),e.loadError&&s.jsx("p",{className:"mcp-error",children:e.loadError}),s.jsx("div",{className:"mcp-card-actions",children:s.jsx("button",{type:"button",disabled:f||!!(e.loadError&&e.mode==="process"&&!e.trusted),onClick:()=>void y(e),children:"Open"})})]},e.id))})}),a&&t&&s.jsxs("section",{className:"plugin-pane-surface",tabIndex:u?void 0:0,"aria-label":t.title||t.id,onKeyDown:u?void 0:e=>{e.key==="Enter"?(e.preventDefault(),o("enter")):e.key==="Escape"?(e.preventDefault(),o("esc")):e.key==="ArrowUp"?(e.preventDefault(),o("up")):e.key==="ArrowDown"?(e.preventDefault(),o("down")):e.key.length===1&&o(e.key)},children:[s.jsxs("header",{className:"plugin-pane-chrome",children:[s.jsx("strong",{children:t.title||t.id}),t.status&&s.jsx("span",{className:"muted",children:t.status}),s.jsx("span",{className:"muted",children:t.mode}),u&&s.jsx("span",{className:"muted",children:"read-only"})]}),t.error?s.jsxs("div",{className:"pane-error",role:"alert",children:[s.jsx("strong",{children:"pane error"}),s.jsx("p",{children:t.error}),s.jsx("p",{className:"muted",children:"disable via plugins tab · trust process panes before mount"})]}):s.jsx("div",{className:"plugin-pane-body",children:s.jsx(P,{node:t.view,feeds:t.feeds})})]})]})}export{K as PanesPanel};
+import{r,j as s}from"./index-BIBviZkd.js";import{P}from"./PaneView-CsX17cLJ.js";import{listPanes as S,paneSnapshot as N,mountPane as D,unmountPane as C,paneInput as A}from"./panesApi-1q1G3asp.js";function K({available:h,focusId:d,readOnly:u}){const[i,b]=r.useState([]),[x,j]=r.useState(!1),[v,c]=r.useState(""),[a,p]=r.useState(""),[t,l]=r.useState(null),[f,m]=r.useState(!1),g=async()=>{if(h){j(!0),c("");try{const e=await S();b(e.panes||[])}catch(e){c(e.message)}finally{j(!1)}}};if(r.useEffect(()=>{g()},[h]),r.useEffect(()=>{if(!a){l(null);return}let e=!1;const n=async()=>{try{const k=await N(a);e||l(k)}catch{}};n();const E=window.setInterval(()=>void n(),500);return()=>{e=!0,window.clearInterval(E)}},[a]),!h)return s.jsxs("section",{className:"unavailable",role:"status",children:[s.jsx("strong",{children:"Plugin panes unavailable"}),s.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})]});const y=async e=>{m(!0),c("");try{const n=await D(e.id);p(e.id),l(n)}catch(n){c(n.message),p(e.id),l({id:e.id,mode:e.mode,title:e.title,error:e.loadError||n.message})}finally{m(!1)}};r.useEffect(()=>{if(!d||!i.length)return;const e=i.find(n=>n.id===d);e&&a!==d&&y(e)},[d,i]);const w=async()=>{if(a){m(!0);try{await C(a)}catch{}finally{p(""),l(null),m(!1)}}},o=async e=>{if(!(u||!a||!t||t.mode!=="process"))try{await A(a,{kind:"key",key:e,mods:[]});const n=await N(a);l(n)}catch(n){c(n.message)}};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mcp-head",children:[s.jsx("h2",{children:"Plugin panes"}),s.jsxs("div",{className:"mcp-actions",children:[s.jsx("button",{type:"button",onClick:()=>void g(),disabled:x||f,children:"Refresh"}),a&&s.jsx("button",{type:"button",onClick:()=>void w(),disabled:f,children:"Close pane"})]})]}),v&&s.jsxs("section",{className:"unavailable",role:"alert",children:[s.jsx("strong",{children:"Error"}),s.jsx("p",{children:v})]}),!a&&s.jsx(s.Fragment,{children:x&&!i.length?s.jsx("p",{className:"muted",children:"Loading…"}):i.length===0?s.jsx("p",{className:"muted",children:"No enabled plugin panes. Install/enable a pane plugin via the plugins tab."}):s.jsx("div",{className:"mcp-list",children:i.map(e=>s.jsxs("article",{className:"mcp-card",children:[s.jsxs("header",{children:[s.jsx("h3",{children:e.title||e.id}),s.jsx("span",{className:"mcp-state",children:e.mode})]}),s.jsx("p",{className:"muted",children:e.provenance}),e.loadError&&s.jsx("p",{className:"mcp-error",children:e.loadError}),s.jsx("div",{className:"mcp-card-actions",children:s.jsx("button",{type:"button",disabled:f||!!(e.loadError&&e.mode==="process"&&!e.trusted),onClick:()=>void y(e),children:"Open"})})]},e.id))})}),a&&t&&s.jsxs("section",{className:"plugin-pane-surface",tabIndex:u?void 0:0,"aria-label":t.title||t.id,onKeyDown:u?void 0:e=>{e.key==="Enter"?(e.preventDefault(),o("enter")):e.key==="Escape"?(e.preventDefault(),o("esc")):e.key==="ArrowUp"?(e.preventDefault(),o("up")):e.key==="ArrowDown"?(e.preventDefault(),o("down")):e.key.length===1&&o(e.key)},children:[s.jsxs("header",{className:"plugin-pane-chrome",children:[s.jsx("strong",{children:t.title||t.id}),t.status&&s.jsx("span",{className:"muted",children:t.status}),s.jsx("span",{className:"muted",children:t.mode}),u&&s.jsx("span",{className:"muted",children:"read-only"})]}),t.error?s.jsxs("div",{className:"pane-error",role:"alert",children:[s.jsx("strong",{children:"pane error"}),s.jsx("p",{children:t.error}),s.jsx("p",{className:"muted",children:"disable via plugins tab · trust process panes before mount"})]}):s.jsx("div",{className:"plugin-pane-body",children:s.jsx(P,{node:t.view,feeds:t.feeds})})]})]})}export{K as PanesPanel};
diff --git a/internal/frontend/server/static/assets/Plans-CQoFK1S6.js b/internal/frontend/server/static/assets/Plans-4LP_uynK.js
similarity index 99%
rename from internal/frontend/server/static/assets/Plans-CQoFK1S6.js
rename to internal/frontend/server/static/assets/Plans-4LP_uynK.js
index 3dfd39cb..31328dd8 100644
--- a/internal/frontend/server/static/assets/Plans-CQoFK1S6.js
+++ b/internal/frontend/server/static/assets/Plans-4LP_uynK.js
@@ -1 +1 @@
-import{b as p,r as u,j as e}from"./index-BK8GKzWA.js";const h=t=>t.ID||t.id||"",k=t=>t.Title||t.title||"Untitled plan",m=t=>t.Status||t.status||"draft",x=t=>t.Version??t.version??0,P=t=>t.OwnerRoot||t.ownerRoot||"",G=t=>t.Sections||t.sections||[],H=t=>t.ID||t.id||"",R=t=>t.Title||t.title||"",$=t=>t.Body||t.body||"",K=()=>p("/v1/plans"),Q=t=>p(`/v1/plans/${encodeURIComponent(t)}`),W=(t,l,o)=>p("/v1/plans",{method:"POST",body:JSON.stringify({ownerRoot:t,title:l,sections:o})}),X=(t,l,o,c)=>p(`/v1/plans/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({ownerRoot:l,title:o,expectedVersion:c})}),Y=(t,l,o,c,w)=>p(`/v1/plans/${encodeURIComponent(t)}/sections/${encodeURIComponent(l)}`,{method:"PATCH",body:JSON.stringify({ownerRoot:o,...c,expectedVersion:w})}),Z=(t,l,o,c,w)=>p(`/v1/plans/${encodeURIComponent(t)}/sections`,{method:"POST",body:JSON.stringify({ownerRoot:l,title:o,body:c,expectedVersion:w})}),_=(t,l,o,c)=>p(`/v1/plans/${encodeURIComponent(t)}/status`,{method:"POST",body:JSON.stringify({ownerRoot:l,status:o,expectedVersion:c})}),ee=(t,l,o)=>p(`/v1/plans/${encodeURIComponent(t)}/reopen`,{method:"POST",body:JSON.stringify({ownerRoot:l,expectedVersion:o})});function ne({available:t,live:l,rootID:o}){const[c,w]=u.useState([]),[T,E]=u.useState(!1),[j,S]=u.useState(""),[a,y]=u.useState(null),[D,J]=u.useState(!1),[g,N]=u.useState(""),[V,A]=u.useState(!1),[O,B]=u.useState(""),v=async()=>{if(t){E(!0),S("");try{const n=await K();w(n.plans||[])}catch(n){S(n.message)}finally{E(!1)}}};if(u.useEffect(()=>{v()},[t]),!t)return e.jsxs("section",{className:"unavailable",role:"status",children:[e.jsx("strong",{children:"Plans unavailable"}),e.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})]});const L=async n=>{J(!0),S(""),N("");try{const s=await Q(n);y(s)}catch(s){S(s.message),y(null)}finally{J(!1)}},d=l&&!!o&&a&&P(a)===o&&m(a)!=="closed",f=!!(a&&o&&P(a)===o),C=a?m(a)==="closed":!1,q=async n=>{if(n.preventDefault(),!l||!o){window.alert("Select a live workspace root to create a plan.");return}const s=O.trim();if(s)try{const i=await W(o,s);B(""),A(!1),N(`Created ${k(i)}`),await v(),y(i)}catch(i){window.alert(i.message)}},b=async(n,s)=>{y(n),N(s),await v()},F=async()=>{if(!a||!d)return;const n=window.prompt("Plan title",k(a));if(n===null)return;const s=n.trim();if(s)try{const i=await X(h(a),o,s,x(a));await b(i,"Title updated")}catch(i){window.alert(i.message)}},U=async n=>{if(!(!a||!f||C))try{const s=await _(h(a),o,n,x(a));await b(s,`Status → ${n}`)}catch(s){window.alert(s.message)}},I=async()=>{if(!(!a||!f||!C))try{const n=await ee(h(a),o,x(a));await b(n,"Reopened as draft")}catch(n){window.alert(n.message)}},M=async()=>{if(!a||!d)return;const n=window.prompt("Section title");if(n===null)return;const s=n.trim();if(!s)return;const i=window.prompt("Section body (optional)","")??"";try{const r=await Z(h(a),o,s,i,x(a));await b(r,"Section added")}catch(r){window.alert(r.message)}},z=async n=>{if(!a||!d)return;const s=window.prompt("Section title",R(n));if(s===null)return;const i=window.prompt("Section body",$(n));if(i!==null)try{const r=await Y(h(a),H(n),o,{title:s.trim()||R(n),body:i},x(a));await b(r,"Section updated")}catch(r){window.alert(r.message)}};if(a){const n=G(a);return e.jsxs("div",{className:"plans-panel",children:[e.jsxs("div",{className:"workflow-head",children:[e.jsx("h2",{children:k(a)}),e.jsxs("div",{className:"workflow-actions",children:[e.jsx("button",{type:"button",onClick:()=>{y(null),N("")},children:"Back"}),e.jsx("button",{type:"button",onClick:()=>void L(h(a)),disabled:D,children:"Refresh"})]})]}),e.jsxs("p",{className:"plans-meta",children:[e.jsx("small",{children:m(a)}),e.jsxs("span",{children:["v",x(a)]}),e.jsxs("span",{title:P(a),children:["owner ",P(a).slice(0,12)||"—"]})]}),!f&&l&&e.jsx("p",{className:"muted",role:"status",children:"Read-only: this plan is owned by another root."}),C&&f&&e.jsx("p",{className:"muted",role:"status",children:"Closed — reopen to edit content."}),!l&&e.jsx("p",{className:"muted",role:"status",children:"Historical session — read only."}),g&&e.jsx("p",{className:"muted",role:"status",children:g}),j&&e.jsxs("section",{className:"unavailable",role:"alert",children:[e.jsx("strong",{children:"Unable to load"}),e.jsx("p",{children:j})]}),e.jsxs("div",{className:"workflow-card-actions plans-actions",children:[d&&e.jsx("button",{type:"button",onClick:()=>void F(),children:"Edit title"}),d&&m(a)==="draft"&&e.jsx("button",{type:"button",onClick:()=>void U("approved"),children:"Approve"}),d&&m(a)==="approved"&&e.jsx("button",{type:"button",onClick:()=>void U("closed"),children:"Close"}),d&&m(a)==="draft"&&e.jsx("button",{type:"button",onClick:()=>void U("closed"),children:"Close"}),f&&C&&l&&e.jsx("button",{type:"button",onClick:()=>void I(),children:"Reopen"}),d&&e.jsx("button",{type:"button",onClick:()=>void M(),children:"Add section"})]}),e.jsx("div",{className:"project-list plans-sections",children:n.length?n.map(s=>{const i=H(s),r=s.DelegateStatus||s.delegateStatus;return e.jsxs("article",{children:[e.jsxs("header",{className:"plans-section-head",children:[e.jsx("h3",{children:R(s)||i||"Section"}),d&&e.jsx("button",{type:"button",onClick:()=>void z(s),children:"Edit"})]}),r&&e.jsxs("small",{children:["delegate: ",r,s.DelegateDetail||s.delegateDetail?` — ${s.DelegateDetail||s.delegateDetail}`:""]}),$(s)?e.jsx("p",{children:$(s)}):e.jsx("p",{className:"muted",children:"Empty section body."})]},i||R(s))}):e.jsx("p",{className:"muted",children:"No sections yet."})})]})}return e.jsxs("div",{className:"plans-panel",children:[e.jsxs("div",{className:"workflow-head",children:[e.jsx("h2",{children:"Plans"}),e.jsxs("div",{className:"workflow-actions",children:[e.jsx("button",{type:"button",onClick:()=>void v(),disabled:T,children:"Refresh"}),l&&e.jsx("button",{type:"button",onClick:()=>A(n=>!n),disabled:!o,children:"New"})]})]}),g&&e.jsx("p",{className:"muted",role:"status",children:g}),j&&e.jsxs("section",{className:"unavailable",role:"alert",children:[e.jsx("strong",{children:"Unable to load"}),e.jsx("p",{children:j})]}),V&&e.jsxs("form",{className:"plans-create",onSubmit:n=>void q(n),children:[e.jsxs("label",{children:["Title",e.jsx("input",{"aria-label":"New plan title",value:O,onChange:n=>B(n.target.value),placeholder:"Plan title",autoFocus:!0})]}),e.jsx("button",{type:"submit",disabled:!O.trim(),children:"Create"})]}),T&&!c.length?e.jsx("p",{className:"muted",children:"Loading plans…"}):null,!T&&!c.length&&!j?e.jsx("p",{className:"muted",children:"No project plans."}):null,e.jsx("div",{className:"workflow-list",children:c.map(n=>{const s=h(n);return e.jsxs("article",{className:"workflow-card",children:[e.jsxs("header",{children:[e.jsx("h3",{children:k(n)}),e.jsx("small",{children:m(n)})]}),e.jsxs("p",{children:[n.SectionCount??n.sectionCount??0," sections · v",x(n)]}),e.jsx("div",{className:"workflow-card-actions",children:e.jsx("button",{type:"button",onClick:()=>void L(s),children:"Open"})})]},s)})})]})}export{ne as PlansPanel};
+import{b as p,r as u,j as e}from"./index-BIBviZkd.js";const h=t=>t.ID||t.id||"",k=t=>t.Title||t.title||"Untitled plan",m=t=>t.Status||t.status||"draft",x=t=>t.Version??t.version??0,P=t=>t.OwnerRoot||t.ownerRoot||"",G=t=>t.Sections||t.sections||[],H=t=>t.ID||t.id||"",R=t=>t.Title||t.title||"",$=t=>t.Body||t.body||"",K=()=>p("/v1/plans"),Q=t=>p(`/v1/plans/${encodeURIComponent(t)}`),W=(t,l,o)=>p("/v1/plans",{method:"POST",body:JSON.stringify({ownerRoot:t,title:l,sections:o})}),X=(t,l,o,c)=>p(`/v1/plans/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({ownerRoot:l,title:o,expectedVersion:c})}),Y=(t,l,o,c,w)=>p(`/v1/plans/${encodeURIComponent(t)}/sections/${encodeURIComponent(l)}`,{method:"PATCH",body:JSON.stringify({ownerRoot:o,...c,expectedVersion:w})}),Z=(t,l,o,c,w)=>p(`/v1/plans/${encodeURIComponent(t)}/sections`,{method:"POST",body:JSON.stringify({ownerRoot:l,title:o,body:c,expectedVersion:w})}),_=(t,l,o,c)=>p(`/v1/plans/${encodeURIComponent(t)}/status`,{method:"POST",body:JSON.stringify({ownerRoot:l,status:o,expectedVersion:c})}),ee=(t,l,o)=>p(`/v1/plans/${encodeURIComponent(t)}/reopen`,{method:"POST",body:JSON.stringify({ownerRoot:l,expectedVersion:o})});function ne({available:t,live:l,rootID:o}){const[c,w]=u.useState([]),[T,E]=u.useState(!1),[j,S]=u.useState(""),[a,y]=u.useState(null),[D,J]=u.useState(!1),[g,N]=u.useState(""),[V,A]=u.useState(!1),[O,B]=u.useState(""),v=async()=>{if(t){E(!0),S("");try{const n=await K();w(n.plans||[])}catch(n){S(n.message)}finally{E(!1)}}};if(u.useEffect(()=>{v()},[t]),!t)return e.jsxs("section",{className:"unavailable",role:"status",children:[e.jsx("strong",{children:"Plans unavailable"}),e.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})]});const L=async n=>{J(!0),S(""),N("");try{const s=await Q(n);y(s)}catch(s){S(s.message),y(null)}finally{J(!1)}},d=l&&!!o&&a&&P(a)===o&&m(a)!=="closed",f=!!(a&&o&&P(a)===o),C=a?m(a)==="closed":!1,q=async n=>{if(n.preventDefault(),!l||!o){window.alert("Select a live workspace root to create a plan.");return}const s=O.trim();if(s)try{const i=await W(o,s);B(""),A(!1),N(`Created ${k(i)}`),await v(),y(i)}catch(i){window.alert(i.message)}},b=async(n,s)=>{y(n),N(s),await v()},F=async()=>{if(!a||!d)return;const n=window.prompt("Plan title",k(a));if(n===null)return;const s=n.trim();if(s)try{const i=await X(h(a),o,s,x(a));await b(i,"Title updated")}catch(i){window.alert(i.message)}},U=async n=>{if(!(!a||!f||C))try{const s=await _(h(a),o,n,x(a));await b(s,`Status → ${n}`)}catch(s){window.alert(s.message)}},I=async()=>{if(!(!a||!f||!C))try{const n=await ee(h(a),o,x(a));await b(n,"Reopened as draft")}catch(n){window.alert(n.message)}},M=async()=>{if(!a||!d)return;const n=window.prompt("Section title");if(n===null)return;const s=n.trim();if(!s)return;const i=window.prompt("Section body (optional)","")??"";try{const r=await Z(h(a),o,s,i,x(a));await b(r,"Section added")}catch(r){window.alert(r.message)}},z=async n=>{if(!a||!d)return;const s=window.prompt("Section title",R(n));if(s===null)return;const i=window.prompt("Section body",$(n));if(i!==null)try{const r=await Y(h(a),H(n),o,{title:s.trim()||R(n),body:i},x(a));await b(r,"Section updated")}catch(r){window.alert(r.message)}};if(a){const n=G(a);return e.jsxs("div",{className:"plans-panel",children:[e.jsxs("div",{className:"workflow-head",children:[e.jsx("h2",{children:k(a)}),e.jsxs("div",{className:"workflow-actions",children:[e.jsx("button",{type:"button",onClick:()=>{y(null),N("")},children:"Back"}),e.jsx("button",{type:"button",onClick:()=>void L(h(a)),disabled:D,children:"Refresh"})]})]}),e.jsxs("p",{className:"plans-meta",children:[e.jsx("small",{children:m(a)}),e.jsxs("span",{children:["v",x(a)]}),e.jsxs("span",{title:P(a),children:["owner ",P(a).slice(0,12)||"—"]})]}),!f&&l&&e.jsx("p",{className:"muted",role:"status",children:"Read-only: this plan is owned by another root."}),C&&f&&e.jsx("p",{className:"muted",role:"status",children:"Closed — reopen to edit content."}),!l&&e.jsx("p",{className:"muted",role:"status",children:"Historical session — read only."}),g&&e.jsx("p",{className:"muted",role:"status",children:g}),j&&e.jsxs("section",{className:"unavailable",role:"alert",children:[e.jsx("strong",{children:"Unable to load"}),e.jsx("p",{children:j})]}),e.jsxs("div",{className:"workflow-card-actions plans-actions",children:[d&&e.jsx("button",{type:"button",onClick:()=>void F(),children:"Edit title"}),d&&m(a)==="draft"&&e.jsx("button",{type:"button",onClick:()=>void U("approved"),children:"Approve"}),d&&m(a)==="approved"&&e.jsx("button",{type:"button",onClick:()=>void U("closed"),children:"Close"}),d&&m(a)==="draft"&&e.jsx("button",{type:"button",onClick:()=>void U("closed"),children:"Close"}),f&&C&&l&&e.jsx("button",{type:"button",onClick:()=>void I(),children:"Reopen"}),d&&e.jsx("button",{type:"button",onClick:()=>void M(),children:"Add section"})]}),e.jsx("div",{className:"project-list plans-sections",children:n.length?n.map(s=>{const i=H(s),r=s.DelegateStatus||s.delegateStatus;return e.jsxs("article",{children:[e.jsxs("header",{className:"plans-section-head",children:[e.jsx("h3",{children:R(s)||i||"Section"}),d&&e.jsx("button",{type:"button",onClick:()=>void z(s),children:"Edit"})]}),r&&e.jsxs("small",{children:["delegate: ",r,s.DelegateDetail||s.delegateDetail?` — ${s.DelegateDetail||s.delegateDetail}`:""]}),$(s)?e.jsx("p",{children:$(s)}):e.jsx("p",{className:"muted",children:"Empty section body."})]},i||R(s))}):e.jsx("p",{className:"muted",children:"No sections yet."})})]})}return e.jsxs("div",{className:"plans-panel",children:[e.jsxs("div",{className:"workflow-head",children:[e.jsx("h2",{children:"Plans"}),e.jsxs("div",{className:"workflow-actions",children:[e.jsx("button",{type:"button",onClick:()=>void v(),disabled:T,children:"Refresh"}),l&&e.jsx("button",{type:"button",onClick:()=>A(n=>!n),disabled:!o,children:"New"})]})]}),g&&e.jsx("p",{className:"muted",role:"status",children:g}),j&&e.jsxs("section",{className:"unavailable",role:"alert",children:[e.jsx("strong",{children:"Unable to load"}),e.jsx("p",{children:j})]}),V&&e.jsxs("form",{className:"plans-create",onSubmit:n=>void q(n),children:[e.jsxs("label",{children:["Title",e.jsx("input",{"aria-label":"New plan title",value:O,onChange:n=>B(n.target.value),placeholder:"Plan title",autoFocus:!0})]}),e.jsx("button",{type:"submit",disabled:!O.trim(),children:"Create"})]}),T&&!c.length?e.jsx("p",{className:"muted",children:"Loading plans…"}):null,!T&&!c.length&&!j?e.jsx("p",{className:"muted",children:"No project plans."}):null,e.jsx("div",{className:"workflow-list",children:c.map(n=>{const s=h(n);return e.jsxs("article",{className:"workflow-card",children:[e.jsxs("header",{children:[e.jsx("h3",{children:k(n)}),e.jsx("small",{children:m(n)})]}),e.jsxs("p",{children:[n.SectionCount??n.sectionCount??0," sections · v",x(n)]}),e.jsx("div",{className:"workflow-card-actions",children:e.jsx("button",{type:"button",onClick:()=>void L(s),children:"Open"})})]},s)})})]})}export{ne as PlansPanel};
diff --git a/internal/frontend/server/static/assets/Plugins-CJ0dCX91.js b/internal/frontend/server/static/assets/Plugins-CzG6Imkp.js
similarity index 98%
rename from internal/frontend/server/static/assets/Plugins-CJ0dCX91.js
rename to internal/frontend/server/static/assets/Plugins-CzG6Imkp.js
index 2b037d4d..27e20577 100644
--- a/internal/frontend/server/static/assets/Plugins-CJ0dCX91.js
+++ b/internal/frontend/server/static/assets/Plugins-CzG6Imkp.js
@@ -1 +1 @@
-import{b as c,r as l,j as s}from"./index-BK8GKzWA.js";import{unmountPane as L,listPanes as W,mountPane as X}from"./panesApi-Gdyy8rqS.js";import{P as Y}from"./PaneView-CmrtsIj-.js";const Z=()=>c("/v1/plugins"),ee=(n,i)=>c("/v1/plugins/enable",{method:"POST",body:JSON.stringify({id:n,scope:i||void 0})}),se=(n,i)=>c("/v1/plugins/disable",{method:"POST",body:JSON.stringify({id:n,scope:i||void 0})}),te=(n,i,a)=>c("/v1/plugins/remove",{method:"POST",body:JSON.stringify({id:n,scope:i||void 0,confirm:a})}),ne=(n,i)=>{const a=i?`?scope=${encodeURIComponent(i)}`:"";return c(`/v1/plugins/${encodeURIComponent(n)}/trust-preview${a}`)},ie=(n,i)=>c("/v1/plugins/trust",{method:"POST",body:JSON.stringify({id:n,scope:i||void 0})}),le=(n,i)=>c("/v1/plugins/untrust",{method:"POST",body:JSON.stringify({id:n,scope:i||void 0})}),ae=(n,i)=>c("/v1/plugins/search",{method:"POST",body:JSON.stringify({registry:n,query:i})}),V=(n,i,a)=>c("/v1/plugins/install",{method:"POST",body:JSON.stringify({source:n,scope:i,registry:a||void 0})}),re=(n,i,a)=>c("/v1/plugins/preview-update",{method:"POST",body:JSON.stringify({id:n,scope:i||void 0,registry:a||void 0})}),de=(n,i,a,b)=>c("/v1/plugins/update",{method:"POST",body:JSON.stringify({id:n,scope:i||void 0,registry:a||void 0,confirm:b})});function oe(n){switch(n){case"trusted":return"plugin-trust trusted";case"stale":return"plugin-trust stale";case"none":return"plugin-trust none";default:return"plugin-trust passive"}}function ce(n){switch(n){case"enabled":return"plugin-status enabled";case"disabled":return"plugin-status disabled";case"invalid":return"plugin-status invalid";default:return"plugin-status"}}function me({available:n,live:i=!0,panesAvailable:a=!0,rootID:b}){const[j,q]=l.useState([]),[A,K]=l.useState([]),[$,C]=l.useState(!1),[k,T]=l.useState(""),[r,m]=l.useState(""),[O,d]=l.useState(""),[o,U]=l.useState(null),[v,y]=l.useState(null),[h,w]=l.useState(null),[f,B]=l.useState(""),[p,D]=l.useState(""),[E,Q]=l.useState(""),[I,F]=l.useState([]),[u,N]=l.useState(null),[x,R]=l.useState(""),S=async()=>{if(n){C(!0),T("");try{const e=await Z();if(q(e.plugins||[]),a){const t=await W().catch(()=>({panes:[]}));K(t.panes||[])}}catch(e){T(e.message)}finally{C(!1)}}};if(l.useEffect(()=>{S()},[n,a]),!n)return s.jsxs("section",{className:"unavailable",role:"status",children:[s.jsx("strong",{children:"Plugins unavailable"}),s.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})]});const g=async(e,t)=>{m(e),d("");try{await t(),await S()}catch(P){window.alert(P.message)}finally{m("")}},G=async e=>{m(`trust:${e.id}`),d("");try{const t=await ne(e.id,e.scope);y(t),U(e)}catch(t){window.alert(t.message)}finally{m("")}},H=async()=>{!o||!v||await g(`trust:${o.id}`,async()=>{await ie(o.id,o.scope),d(`Trusted ${o.id}.`),y(null)})},M=async e=>{m(`update:${e.id}`);try{const t=await re(e.id,e.scope,p||void 0);w(t),U(e)}catch(t){window.alert(t.message)}finally{m("")}},_=async()=>{!o||!h||window.confirm(`Apply update ${h.oldVersion} → ${h.newVersion} for ${o.id}?`)&&await g(`update:${o.id}`,async()=>{await de(o.id,o.scope,p||void 0,!0),d(`Updated ${o.id}.`),w(null)})},z=async e=>{m(`pane:${e.id}`),d("");try{x&&x!==e.id&&await L(x).catch(()=>{});const t=await X(e.id,40,14,b);N(t),R(e.id)}catch(t){window.alert(t.message),N(null)}finally{m("")}},J=e=>A.filter(t=>t.pluginId===e);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"plugin-head",children:[s.jsx("h2",{children:"Plugins"}),s.jsx("div",{className:"plugin-actions",children:s.jsx("button",{type:"button",onClick:()=>void S(),disabled:$||!!r,children:"Refresh"})})]}),O&&s.jsx("p",{className:"muted",role:"status",children:O}),k&&s.jsxs("section",{className:"unavailable",role:"alert",children:[s.jsx("strong",{children:"Error"}),s.jsx("p",{children:k})]}),s.jsxs("details",{className:"plugin-install",children:[s.jsx("summary",{children:"Install / catalog"}),s.jsxs("label",{children:["Source (path, git URL, or catalog:pkg)",s.jsx("input",{value:f,onChange:e=>B(e.target.value),placeholder:"./my-plugin or catalog:acme.pack"})]}),s.jsxs("label",{children:["Registry (catalog installs)",s.jsx("input",{value:p,onChange:e=>D(e.target.value),placeholder:"https://…"})]}),s.jsx("div",{className:"plugin-actions",children:s.jsx("button",{type:"button",disabled:!f.trim()||!!r,onClick:()=>void g("install",async()=>{const e=await V(f.trim(),"global",p||void 0);d(`Installed ${e.id}@${e.version||"?"}.`),B("")}),children:"Install"})}),s.jsxs("label",{children:["Search catalog",s.jsx("input",{value:E,onChange:e=>Q(e.target.value),placeholder:"query"})]}),s.jsx("button",{type:"button",disabled:!p.trim()||!!r,onClick:()=>void g("search",async()=>{const e=await ae(p.trim(),E);F(e.hits||[])}),children:"Search"}),I.length>0&&s.jsx("ul",{className:"plugin-hits",children:I.map(e=>s.jsxs("li",{children:[s.jsx("strong",{children:e.id})," ",e.version&&s.jsxs("span",{className:"muted",children:["v",e.version]}),e.description&&s.jsx("p",{className:"muted",children:e.description}),s.jsx("button",{type:"button",onClick:()=>void g(`install:${e.id}`,async()=>{const t=await V(`catalog:${e.id}`,"global",p||e.registry);d(`Installed ${t.id}.`)}),children:"Install"})]},e.id))})]}),v&&s.jsxs("section",{className:"plugin-review",role:"dialog","aria-label":"Trust review",children:[s.jsxs("h3",{children:["Trust review — ",v.id]}),v.digest&&s.jsxs("p",{className:"muted",children:["digest: ",v.digest]}),s.jsx("ul",{children:(v.reviewLines||[]).map((e,t)=>s.jsx("li",{children:s.jsx("code",{children:e})},t))}),s.jsxs("div",{className:"plugin-actions",children:[s.jsx("button",{type:"button",onClick:()=>void H(),disabled:!!r,children:"Grant trust"}),s.jsx("button",{type:"button",onClick:()=>y(null),children:"Cancel"})]})]}),h&&s.jsxs("section",{className:"plugin-review",role:"dialog","aria-label":"Update review",children:[s.jsxs("h3",{children:["Update ",h.id,": ",h.oldVersion," → ",h.newVersion]}),s.jsx("pre",{className:"plugin-summary",children:h.summary||"(no summary)"}),h.trustInvalidated&&s.jsx("p",{className:"warning-text",children:"Trust will be invalidated."}),s.jsxs("div",{className:"plugin-actions",children:[s.jsx("button",{type:"button",onClick:()=>void _(),disabled:!!r,children:"Apply update"}),s.jsx("button",{type:"button",onClick:()=>w(null),children:"Cancel"})]})]}),$&&!j.length?s.jsx("p",{className:"muted",children:"Loading plugins…"}):j.length?s.jsx("div",{className:"plugin-list","aria-label":"Installed plugins",children:j.map(e=>s.jsxs("article",{className:"plugin-card",children:[s.jsxs("header",{children:[s.jsx("h3",{children:e.name||e.id}),s.jsx("span",{className:ce(e.status),children:e.status||(e.enabled?"enabled":"disabled")}),s.jsx("span",{className:oe(e.trustState),children:e.trustState||"—"})]}),s.jsxs("p",{className:"muted",children:[s.jsx("code",{children:e.id}),e.version?` @ ${e.version}`:"",e.scope?` · ${e.scope}`:""]}),e.sourceLabel&&s.jsx("p",{className:"muted",children:e.sourceLabel}),e.loadError&&s.jsx("p",{className:"error-text",children:e.loadError}),s.jsxs("p",{className:"plugin-counts muted",children:["agents ",e.agents||0," · skills ",e.skills||0," · workflows ",e.workflows||0," · themes ",e.themes||0," · panes ",e.panes||0," · hooks ",e.hooks||0]}),e.capabilities&&e.capabilities.length>0&&s.jsxs("p",{className:"muted",children:["caps: ",e.capabilities.join(", ")]}),e.mcp&&e.mcp.length>0&&s.jsx("ul",{className:"plugin-mcp",children:e.mcp.map(t=>s.jsxs("li",{children:["MCP ",s.jsx("code",{children:t.name}),t.command?` ${t.command}`:"",t.envKeys&&t.envKeys.length?` (env: ${t.envKeys.join(", ")})`:""]},t.name))}),e.findings&&e.findings.length>0&&s.jsx("ul",{className:"plugin-findings",children:e.findings.map((t,P)=>s.jsx("li",{children:t},P))}),s.jsxs("div",{className:"plugin-card-actions",children:[e.enabled?s.jsx("button",{type:"button",disabled:!!r,onClick:()=>void g(`dis:${e.id}`,async()=>{await se(e.id,e.scope),d(`Disabled ${e.id}.`)}),children:"Disable"}):s.jsx("button",{type:"button",disabled:!!r,onClick:()=>void g(`en:${e.id}`,async()=>{await ee(e.id,e.scope),d(`Enabled ${e.id}.`)}),children:"Enable"}),e.hasExecutable&&e.trustState!=="trusted"&&s.jsx("button",{type:"button",disabled:!!r,onClick:()=>void G(e),children:"Trust…"}),e.hasExecutable&&e.trustState==="trusted"&&s.jsx("button",{type:"button",disabled:!!r,onClick:()=>void g(`untrust:${e.id}`,async()=>{await le(e.id,e.scope),d(`Untrusted ${e.id}.`)}),children:"Untrust"}),e.updateAvailable&&s.jsxs("button",{type:"button",disabled:!!r,onClick:()=>void M(e),children:["Update ",e.updateAvailable]}),s.jsx("button",{type:"button",className:"danger",disabled:!!r,onClick:()=>{window.confirm(`Remove plugin “${e.id}”? This deletes the install.`)&&g(`rm:${e.id}`,async()=>{await te(e.id,e.scope,!0),d(`Removed ${e.id}.`)})},children:"Remove"})]}),a&&J(e.id).length>0&&s.jsxs("div",{className:"plugin-panes",children:[s.jsx("strong",{children:"Panes"}),s.jsx("ul",{children:J(e.id).map(t=>s.jsxs("li",{children:[s.jsx("button",{type:"button",disabled:!!r,onClick:()=>void z(t),children:t.title||t.id}),s.jsxs("span",{className:"muted",children:[" ",t.mode,t.trusted?"":" · blocked",t.loadError?` · ${t.loadError}`:""]}),s.jsxs("span",{className:"muted",children:[" · ",t.provenance]})]},t.id))})]})]},`${e.scope||""}:${e.id}`))}):s.jsxs("p",{className:"muted",children:["No plugins installed. Use Install above or ",s.jsx("code",{children:"strike plugin install"}),"."]}),u&&s.jsxs("section",{className:"plugin-pane-host","aria-label":`Plugin pane ${u.id}`,children:[s.jsxs("header",{className:"plugin-pane-head",children:[s.jsxs("h3",{children:[u.title||u.id,u.status?` · ${u.status}`:""]}),s.jsx("button",{type:"button",onClick:()=>{x&&L(x).catch(()=>{}),N(null),R("")},children:"Close pane"})]}),u.error?s.jsxs("section",{className:"unavailable",role:"alert",children:[s.jsx("strong",{children:"Pane error"}),s.jsx("p",{children:u.error})]}):s.jsx("div",{className:"plugin-pane-body",children:s.jsx(Y,{node:u.view||null,feeds:u.feeds})})]})]})}export{me as PluginsPanel};
+import{b as c,r as l,j as s}from"./index-BIBviZkd.js";import{unmountPane as L,listPanes as W,mountPane as X}from"./panesApi-1q1G3asp.js";import{P as Y}from"./PaneView-CsX17cLJ.js";const Z=()=>c("/v1/plugins"),ee=(n,i)=>c("/v1/plugins/enable",{method:"POST",body:JSON.stringify({id:n,scope:i||void 0})}),se=(n,i)=>c("/v1/plugins/disable",{method:"POST",body:JSON.stringify({id:n,scope:i||void 0})}),te=(n,i,a)=>c("/v1/plugins/remove",{method:"POST",body:JSON.stringify({id:n,scope:i||void 0,confirm:a})}),ne=(n,i)=>{const a=i?`?scope=${encodeURIComponent(i)}`:"";return c(`/v1/plugins/${encodeURIComponent(n)}/trust-preview${a}`)},ie=(n,i)=>c("/v1/plugins/trust",{method:"POST",body:JSON.stringify({id:n,scope:i||void 0})}),le=(n,i)=>c("/v1/plugins/untrust",{method:"POST",body:JSON.stringify({id:n,scope:i||void 0})}),ae=(n,i)=>c("/v1/plugins/search",{method:"POST",body:JSON.stringify({registry:n,query:i})}),V=(n,i,a)=>c("/v1/plugins/install",{method:"POST",body:JSON.stringify({source:n,scope:i,registry:a||void 0})}),re=(n,i,a)=>c("/v1/plugins/preview-update",{method:"POST",body:JSON.stringify({id:n,scope:i||void 0,registry:a||void 0})}),de=(n,i,a,b)=>c("/v1/plugins/update",{method:"POST",body:JSON.stringify({id:n,scope:i||void 0,registry:a||void 0,confirm:b})});function oe(n){switch(n){case"trusted":return"plugin-trust trusted";case"stale":return"plugin-trust stale";case"none":return"plugin-trust none";default:return"plugin-trust passive"}}function ce(n){switch(n){case"enabled":return"plugin-status enabled";case"disabled":return"plugin-status disabled";case"invalid":return"plugin-status invalid";default:return"plugin-status"}}function me({available:n,live:i=!0,panesAvailable:a=!0,rootID:b}){const[j,q]=l.useState([]),[A,K]=l.useState([]),[$,C]=l.useState(!1),[k,T]=l.useState(""),[r,m]=l.useState(""),[O,d]=l.useState(""),[o,U]=l.useState(null),[v,y]=l.useState(null),[h,w]=l.useState(null),[f,B]=l.useState(""),[p,D]=l.useState(""),[E,Q]=l.useState(""),[I,F]=l.useState([]),[u,N]=l.useState(null),[x,R]=l.useState(""),S=async()=>{if(n){C(!0),T("");try{const e=await Z();if(q(e.plugins||[]),a){const t=await W().catch(()=>({panes:[]}));K(t.panes||[])}}catch(e){T(e.message)}finally{C(!1)}}};if(l.useEffect(()=>{S()},[n,a]),!n)return s.jsxs("section",{className:"unavailable",role:"status",children:[s.jsx("strong",{children:"Plugins unavailable"}),s.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})]});const g=async(e,t)=>{m(e),d("");try{await t(),await S()}catch(P){window.alert(P.message)}finally{m("")}},G=async e=>{m(`trust:${e.id}`),d("");try{const t=await ne(e.id,e.scope);y(t),U(e)}catch(t){window.alert(t.message)}finally{m("")}},H=async()=>{!o||!v||await g(`trust:${o.id}`,async()=>{await ie(o.id,o.scope),d(`Trusted ${o.id}.`),y(null)})},M=async e=>{m(`update:${e.id}`);try{const t=await re(e.id,e.scope,p||void 0);w(t),U(e)}catch(t){window.alert(t.message)}finally{m("")}},_=async()=>{!o||!h||window.confirm(`Apply update ${h.oldVersion} → ${h.newVersion} for ${o.id}?`)&&await g(`update:${o.id}`,async()=>{await de(o.id,o.scope,p||void 0,!0),d(`Updated ${o.id}.`),w(null)})},z=async e=>{m(`pane:${e.id}`),d("");try{x&&x!==e.id&&await L(x).catch(()=>{});const t=await X(e.id,40,14,b);N(t),R(e.id)}catch(t){window.alert(t.message),N(null)}finally{m("")}},J=e=>A.filter(t=>t.pluginId===e);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"plugin-head",children:[s.jsx("h2",{children:"Plugins"}),s.jsx("div",{className:"plugin-actions",children:s.jsx("button",{type:"button",onClick:()=>void S(),disabled:$||!!r,children:"Refresh"})})]}),O&&s.jsx("p",{className:"muted",role:"status",children:O}),k&&s.jsxs("section",{className:"unavailable",role:"alert",children:[s.jsx("strong",{children:"Error"}),s.jsx("p",{children:k})]}),s.jsxs("details",{className:"plugin-install",children:[s.jsx("summary",{children:"Install / catalog"}),s.jsxs("label",{children:["Source (path, git URL, or catalog:pkg)",s.jsx("input",{value:f,onChange:e=>B(e.target.value),placeholder:"./my-plugin or catalog:acme.pack"})]}),s.jsxs("label",{children:["Registry (catalog installs)",s.jsx("input",{value:p,onChange:e=>D(e.target.value),placeholder:"https://…"})]}),s.jsx("div",{className:"plugin-actions",children:s.jsx("button",{type:"button",disabled:!f.trim()||!!r,onClick:()=>void g("install",async()=>{const e=await V(f.trim(),"global",p||void 0);d(`Installed ${e.id}@${e.version||"?"}.`),B("")}),children:"Install"})}),s.jsxs("label",{children:["Search catalog",s.jsx("input",{value:E,onChange:e=>Q(e.target.value),placeholder:"query"})]}),s.jsx("button",{type:"button",disabled:!p.trim()||!!r,onClick:()=>void g("search",async()=>{const e=await ae(p.trim(),E);F(e.hits||[])}),children:"Search"}),I.length>0&&s.jsx("ul",{className:"plugin-hits",children:I.map(e=>s.jsxs("li",{children:[s.jsx("strong",{children:e.id})," ",e.version&&s.jsxs("span",{className:"muted",children:["v",e.version]}),e.description&&s.jsx("p",{className:"muted",children:e.description}),s.jsx("button",{type:"button",onClick:()=>void g(`install:${e.id}`,async()=>{const t=await V(`catalog:${e.id}`,"global",p||e.registry);d(`Installed ${t.id}.`)}),children:"Install"})]},e.id))})]}),v&&s.jsxs("section",{className:"plugin-review",role:"dialog","aria-label":"Trust review",children:[s.jsxs("h3",{children:["Trust review — ",v.id]}),v.digest&&s.jsxs("p",{className:"muted",children:["digest: ",v.digest]}),s.jsx("ul",{children:(v.reviewLines||[]).map((e,t)=>s.jsx("li",{children:s.jsx("code",{children:e})},t))}),s.jsxs("div",{className:"plugin-actions",children:[s.jsx("button",{type:"button",onClick:()=>void H(),disabled:!!r,children:"Grant trust"}),s.jsx("button",{type:"button",onClick:()=>y(null),children:"Cancel"})]})]}),h&&s.jsxs("section",{className:"plugin-review",role:"dialog","aria-label":"Update review",children:[s.jsxs("h3",{children:["Update ",h.id,": ",h.oldVersion," → ",h.newVersion]}),s.jsx("pre",{className:"plugin-summary",children:h.summary||"(no summary)"}),h.trustInvalidated&&s.jsx("p",{className:"warning-text",children:"Trust will be invalidated."}),s.jsxs("div",{className:"plugin-actions",children:[s.jsx("button",{type:"button",onClick:()=>void _(),disabled:!!r,children:"Apply update"}),s.jsx("button",{type:"button",onClick:()=>w(null),children:"Cancel"})]})]}),$&&!j.length?s.jsx("p",{className:"muted",children:"Loading plugins…"}):j.length?s.jsx("div",{className:"plugin-list","aria-label":"Installed plugins",children:j.map(e=>s.jsxs("article",{className:"plugin-card",children:[s.jsxs("header",{children:[s.jsx("h3",{children:e.name||e.id}),s.jsx("span",{className:ce(e.status),children:e.status||(e.enabled?"enabled":"disabled")}),s.jsx("span",{className:oe(e.trustState),children:e.trustState||"—"})]}),s.jsxs("p",{className:"muted",children:[s.jsx("code",{children:e.id}),e.version?` @ ${e.version}`:"",e.scope?` · ${e.scope}`:""]}),e.sourceLabel&&s.jsx("p",{className:"muted",children:e.sourceLabel}),e.loadError&&s.jsx("p",{className:"error-text",children:e.loadError}),s.jsxs("p",{className:"plugin-counts muted",children:["agents ",e.agents||0," · skills ",e.skills||0," · workflows ",e.workflows||0," · themes ",e.themes||0," · panes ",e.panes||0," · hooks ",e.hooks||0]}),e.capabilities&&e.capabilities.length>0&&s.jsxs("p",{className:"muted",children:["caps: ",e.capabilities.join(", ")]}),e.mcp&&e.mcp.length>0&&s.jsx("ul",{className:"plugin-mcp",children:e.mcp.map(t=>s.jsxs("li",{children:["MCP ",s.jsx("code",{children:t.name}),t.command?` ${t.command}`:"",t.envKeys&&t.envKeys.length?` (env: ${t.envKeys.join(", ")})`:""]},t.name))}),e.findings&&e.findings.length>0&&s.jsx("ul",{className:"plugin-findings",children:e.findings.map((t,P)=>s.jsx("li",{children:t},P))}),s.jsxs("div",{className:"plugin-card-actions",children:[e.enabled?s.jsx("button",{type:"button",disabled:!!r,onClick:()=>void g(`dis:${e.id}`,async()=>{await se(e.id,e.scope),d(`Disabled ${e.id}.`)}),children:"Disable"}):s.jsx("button",{type:"button",disabled:!!r,onClick:()=>void g(`en:${e.id}`,async()=>{await ee(e.id,e.scope),d(`Enabled ${e.id}.`)}),children:"Enable"}),e.hasExecutable&&e.trustState!=="trusted"&&s.jsx("button",{type:"button",disabled:!!r,onClick:()=>void G(e),children:"Trust…"}),e.hasExecutable&&e.trustState==="trusted"&&s.jsx("button",{type:"button",disabled:!!r,onClick:()=>void g(`untrust:${e.id}`,async()=>{await le(e.id,e.scope),d(`Untrusted ${e.id}.`)}),children:"Untrust"}),e.updateAvailable&&s.jsxs("button",{type:"button",disabled:!!r,onClick:()=>void M(e),children:["Update ",e.updateAvailable]}),s.jsx("button",{type:"button",className:"danger",disabled:!!r,onClick:()=>{window.confirm(`Remove plugin “${e.id}”? This deletes the install.`)&&g(`rm:${e.id}`,async()=>{await te(e.id,e.scope,!0),d(`Removed ${e.id}.`)})},children:"Remove"})]}),a&&J(e.id).length>0&&s.jsxs("div",{className:"plugin-panes",children:[s.jsx("strong",{children:"Panes"}),s.jsx("ul",{children:J(e.id).map(t=>s.jsxs("li",{children:[s.jsx("button",{type:"button",disabled:!!r,onClick:()=>void z(t),children:t.title||t.id}),s.jsxs("span",{className:"muted",children:[" ",t.mode,t.trusted?"":" · blocked",t.loadError?` · ${t.loadError}`:""]}),s.jsxs("span",{className:"muted",children:[" · ",t.provenance]})]},t.id))})]})]},`${e.scope||""}:${e.id}`))}):s.jsxs("p",{className:"muted",children:["No plugins installed. Use Install above or ",s.jsx("code",{children:"strike plugin install"}),"."]}),u&&s.jsxs("section",{className:"plugin-pane-host","aria-label":`Plugin pane ${u.id}`,children:[s.jsxs("header",{className:"plugin-pane-head",children:[s.jsxs("h3",{children:[u.title||u.id,u.status?` · ${u.status}`:""]}),s.jsx("button",{type:"button",onClick:()=>{x&&L(x).catch(()=>{}),N(null),R("")},children:"Close pane"})]}),u.error?s.jsxs("section",{className:"unavailable",role:"alert",children:[s.jsx("strong",{children:"Pane error"}),s.jsx("p",{children:u.error})]}):s.jsx("div",{className:"plugin-pane-body",children:s.jsx(Y,{node:u.view||null,feeds:u.feeds})})]})]})}export{me as PluginsPanel};
diff --git a/internal/frontend/server/static/assets/Team-DUnnZtWp.js b/internal/frontend/server/static/assets/Team-CbhxE7GH.js
similarity index 99%
rename from internal/frontend/server/static/assets/Team-DUnnZtWp.js
rename to internal/frontend/server/static/assets/Team-CbhxE7GH.js
index d37f7c81..bb95ea8b 100644
--- a/internal/frontend/server/static/assets/Team-DUnnZtWp.js
+++ b/internal/frontend/server/static/assets/Team-CbhxE7GH.js
@@ -1 +1 @@
-import{r as u,j as e,S as _,a as ne,s as le,L as ge,O as ve}from"./index-BK8GKzWA.js";const ke=["team.spawn","team.message","team.broadcast","team.child_interrupt","team.task_transition","team.board_create","team.board_claim","team.board_complete"];function ye(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`tc-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function ie(n,a){return!!(n!=null&&n.includes(a))}function we(n){if(n.attachOnly)return"attach-only";if(n.teamControl===!1)return"no-capability";if(!ke.some(a=>ie(n.protocolOps,a)))return"no-ops"}function te(n){switch(n){case"attach-only":return"Attach-only / historical session — team controls are disabled.";case"no-capability":return"This server does not advertise teamControl.";case"no-ops":return"No team-control Ops are available on this connection.";default:return""}}function Ce(n,a,i,t=1){return n.some(o=>o.id===a)?n:[...n,{id:a,title:i,version:t,status:"pending"}]}function Ne(n,a,i){return n.map(t=>t.id===a?{...t,version:i||t.version+1,status:"claimed"}:t)}function Ie(n,a,i){return n.map(t=>t.id===a?{...t,version:i||t.version+1,status:"completed"}:t)}const Se=[{id:"all",label:"All"},{id:"working",label:"Working"},{id:"needs-you",label:"Needs you"},{id:"blocked",label:"Blocked"},{id:"completed",label:"Completed"},{id:"failed",label:"Failed"},{id:"hidden",label:"Terminal"}],ae=["queued","starting","working","blocked","needs_attention","completed","failed","canceled"];function k(n){return n.name||n.agent||n.sessionId.slice(0,8)}function M(n){return(n||"unknown").toLowerCase().replace(/-/g,"_")}function $e(n,a,i){const t=M(n.state),o=!!n.terminal||["completed","failed","canceled","cancelled"].includes(t);switch(a){case"all":return!o;case"working":return["running","working","starting","finalizing"].includes(t);case"needs-you":return t==="needs_attention"||t==="escalating"||!!(n.blockReason&&t.includes("need"));case"blocked":return t==="blocked"||!!n.blockReason;case"completed":return t==="completed";case"failed":return t==="failed"||t==="interrupted";case"hidden":return o;default:return!0}}function Be(n){const a=Object.values(n.members),i=n.leadId;return a.sort((t,o)=>{if(i&&t.sessionId===i)return-1;if(i&&o.sessionId===i)return 1;const p=!!t.terminal,v=!!o.terminal;return p!==v?p?1:-1:k(t).localeCompare(k(o))})}function Te(n){var i;const a=[];for(const t of Object.values(n.members)){const o=M(t.state);(o==="escalating"||o==="needs_attention")&&a.push({id:`esc-${t.sessionId}`,kind:"escalation",label:`${k(t)} needs attention`,detail:t.blockReason||t.lastAction,sessionId:t.sessionId}),(o==="blocked"||t.blockReason)&&a.push({id:`blk-${t.sessionId}`,kind:"blocked",label:`${k(t)} blocked`,detail:t.blockReason,sessionId:t.sessionId})}for(const t of n.verifications)t.passed===!1&&a.push({id:`ver-${t.sessionId||a.length}`,kind:"verification",label:"Verification failed",detail:t.summary,sessionId:t.sessionId});for(const t of n.pathOverlaps)a.push({id:`ov-${t.path}`,kind:"conflict",label:`Path overlap: ${t.path}`,detail:(i=t.sessions)==null?void 0:i.join(", ")});for(const t of n.messages)(t.urgency==="high"||t.urgency==="blocker"||t.kind==="escalation")&&a.push({id:`msg-${t.messageId||t.time||a.length}`,kind:"message",label:t.summary||t.body||"Urgent team message",detail:t.from?`from ${t.from}`:void 0,sessionId:t.to});return a.slice(0,40)}function Ae(n){const a=n.budget;if(!a||typeof a!="object")return"unknown";const i=[];for(const t of["costUSD","tokens","turns","maxCostUSD","maxTokens","stopReason"])a[t]!==void 0&&a[t]!==null&&a[t]!==""&&i.push(`${t}=${String(a[t])}`);return i.length?i.join(" · "):"unknown"}function _e({member:n,isLead:a,onOpenTranscript:i,onClose:t,verification:o,controls:p}){var w;const v=le(n.state);return e.jsxs("section",{className:"team-detail","aria-label":"Agent detail",children:[e.jsxs("header",{children:[e.jsxs("h3",{children:[k(n),a?" (lead)":""]}),e.jsx("button",{type:"button",className:"icon-btn","aria-label":"Close agent detail",onClick:t,children:"×"})]}),e.jsxs("dl",{children:[e.jsx("dt",{children:"Status"}),e.jsx("dd",{children:e.jsx(_,{kind:v,label:n.state||v})}),n.agent?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Agent"}),e.jsx("dd",{children:n.agent})]}):null,n.objective?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Objective"}),e.jsx("dd",{children:n.objective})]}):null,n.lastAction?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Latest action"}),e.jsx("dd",{children:n.lastAction})]}):null,n.queueLabel?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Queue"}),e.jsx("dd",{children:n.queueLabel})]}):null,n.blockReason?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Blocked"}),e.jsx("dd",{children:n.blockReason})]}):null,n.terminalSummary?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Summary"}),e.jsx("dd",{children:n.terminalSummary})]}):null,e.jsx("dt",{children:"Budget / stop"}),e.jsx("dd",{children:Ae(n)}),o?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Verification"}),e.jsxs("dd",{children:[o.passed===!0?"passed":o.passed===!1?"failed":"unknown",o.summary?` — ${o.summary}`:""]})]}):e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Verification"}),e.jsx("dd",{children:"unknown"})]}),(w=n.filesTouched)!=null&&w.length?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Files"}),e.jsx("dd",{children:e.jsx("ul",{className:"team-files",children:n.filesTouched.map(c=>e.jsx("li",{children:e.jsx("code",{children:c})},c))})})]}):null,e.jsx("dt",{children:"Session"}),e.jsx("dd",{children:e.jsx("code",{children:n.sessionId})})]}),i&&e.jsx("div",{className:"team-detail-actions",children:e.jsx("button",{type:"button",onClick:()=>i(n.sessionId),children:"Open transcript (RO)"})}),p]})}function Me({delegations:n,members:a,onSelectOwner:i,onTransition:t,canTransition:o,busy:p}){const w=[...u.useMemo(()=>{const c=new Map;for(const j of ae)c.set(j,[]);c.set("other",[]);for(const j of Object.values(n)){const r=M(j.state),h=ae.includes(r)?r:"other";c.get(h).push(j)}return c},[n]).entries()].filter(([,c])=>c.length>0);return w.length?e.jsx("div",{className:"team-board","aria-label":"Task board",children:w.map(([c,j])=>e.jsxs("section",{className:"team-board-col","aria-label":`${c} column`,children:[e.jsxs("h4",{children:[c.replace(/_/g," ")," ",e.jsx("span",{className:"muted",children:j.length})]}),e.jsx("ul",{children:j.map(r=>{const h=r.ownerSessionId||r.sessionId,R=h&&a[h]?k(a[h]):h==null?void 0:h.slice(0,8);return e.jsx("li",{children:e.jsxs("div",{className:"team-board-card",children:[e.jsxs("button",{type:"button",className:"team-board-card-main",onClick:()=>h&&(i==null?void 0:i(h)),children:[e.jsx("strong",{children:r.name||r.id.slice(0,10)}),e.jsx("span",{className:"muted",children:R||"unassigned"}),r.reason?e.jsx("span",{className:"team-board-reason",children:r.reason}):null,r.version!==void 0?e.jsxs("small",{children:["v",r.version]}):null]}),o&&t&&!["done","completed","failed","canceled","cancelled"].includes(M(r.state))?e.jsxs("div",{className:"team-board-actions",children:[e.jsx("button",{type:"button",disabled:p,onClick:()=>t(r,"blocked"),children:"Block"}),e.jsx("button",{type:"button",disabled:p,onClick:()=>{window.confirm(`Mark ${r.name||r.id} completed?`)&&t(r,"completed")},children:"Complete"}),e.jsx("button",{type:"button",disabled:p,onClick:()=>{window.confirm(`Cancel ${r.name||r.id}?`)&&t(r,"canceled")},children:"Cancel"})]}):null]})},r.id)})})]},c))}):e.jsx("p",{className:"muted",children:"No delegation / team-task rows yet."})}function Re({messages:n}){return n.length?e.jsx("ul",{className:"team-messages","aria-label":"Recent team messages",children:[...n].reverse().slice(0,20).map((a,i)=>e.jsxs("li",{children:[e.jsxs("strong",{children:[a.from||"?"," → ",a.to||"*"]}),a.urgency&&a.urgency!=="normal"?e.jsx(_,{kind:"needs-you",label:a.urgency}):null,e.jsx("span",{children:a.summary||a.body||"(empty)"})]},a.messageId||`${a.time}-${i}`))}):e.jsx("p",{className:"muted",children:"No team messages yet."})}function Fe(n){return n instanceof ve?n.code==="conflict"&&n.currentVersion!==void 0?`Conflict (current v${n.currentVersion}). Refresh and retry.`:n.code==="idempotency_conflict"?"Duplicate action with different payload.":n.code==="attach_only"?"Attach-only — mutations disabled.":n.code==="permission_denied"?"Permission denied.":n.message||n.code||"Operation failed":n instanceof Error?n.message:String(n)}function Oe({team:n,selectedId:a,onSelect:i,onOpenTranscript:t,readOnly:o,compact:p,protocolOps:v,teamControl:w,agents:c,rootSessionId:j,sendOp:r}){const[h,R]=u.useState("all"),[C,S]=u.useState("roster"),[F,x]=u.useState(""),[m,W]=u.useState(!1),[L,z]=u.useState(""),[K,oe]=u.useState((c==null?void 0:c[0])||"build"),[O,H]=u.useState(""),[D,re]=u.useState(!1),[U,de]=u.useState(""),[$,Q]=u.useState(""),[G,J]=u.useState(""),[V,X]=u.useState(""),[Y,q]=u.useState([]),E=u.useRef(new Set),B=u.useMemo(()=>Be(n),[n]),Z=u.useMemo(()=>B.filter(s=>$e(s,h,n.leadId)),[B,h,n.leadId]),P=u.useMemo(()=>Te(n),[n]),f=a?n.members[a]:void 0,ce=f?[...n.verifications].reverse().find(s=>s.sessionId===f.sessionId):void 0,N=we({attachOnly:o,teamControl:w,protocolOps:v}),T=!!(r&&!N&&!o),b=u.useCallback(s=>T&&ie(v,s),[T,v]),y=u.useCallback(async(s,l,d)=>{if(!r||!b(l))return x(te(N)||"Control unavailable"),null;if(E.current.has(s))return x("Already in flight — wait for the previous request."),null;E.current.add(s),W(!0),x("");const g=ye(),A={...d,idempotencyKey:g,...j?{rootSessionId:j}:{}};try{const I=await r(l,A);return x(I.ok?"OK":I.error||"done"),I}catch(I){return x(Fe(I)),null}finally{E.current.delete(s),W(!1)}},[r,b,N,j]),ue=async()=>{const s=L.trim();if(!s){x("Objective is required");return}const l={objective:s,agent:K||void 0};if(O.trim()&&(l.name=O.trim()),D&&U.trim()){const g=Number(U);Number.isFinite(g)&&g>0&&(l.budget={maxTurns:g})}const d=await y("spawn","team.spawn",l);d!=null&&d.ok&&(z(""),H(""),x(d.childSessionId?`Spawned ${d.childSessionId.slice(0,8)}`:"Spawned"))},ee=async s=>{const l=$.trim();if(!l){x("Message body is required");return}if(s)await y("broadcast","team.broadcast",{body:l});else{const d=(G||a||"").trim();if(!d){x("Select a target agent");return}await y(`msg-${d}`,"team.message",{to:d,body:l,kind:"message"})}Q("")},me=async s=>{const l=n.members[s],d=l?k(l):s.slice(0,8);window.confirm(`Interrupt ${d}? Active work will be canceled.`)&&await y(`intr-${s}`,"team.child_interrupt",{childSessionId:s,reason:"human interrupt"})},he=async(s,l)=>{!await y(`tr-${s.id}-${l}`,"team.task_transition",{delegationId:s.id,expectedVersion:s.version??0,toState:l})&&F.includes("Conflict")&&x(g=>`${g} — reload team snapshot.`)},be=async()=>{const s=V.trim();if(!s){x("Board title is required");return}const l=await y("board-create","team.board_create",{title:s});l!=null&&l.ok&&l.taskId&&(q(d=>Ce(d,l.taskId,s,l.version||1)),X(""))},je=async s=>{const l=await y(`claim-${s.id}`,"team.board_claim",{taskId:s.id,expectedVersion:s.version});l!=null&&l.ok&&q(d=>Ne(d,s.id,l.version||s.version+1))},pe=async s=>{if(!window.confirm(`Complete board task ${s.title}?`))return;const l=await y(`complete-${s.id}`,"team.board_complete",{taskId:s.id,expectedVersion:s.version});l!=null&&l.ok&&q(d=>Ie(d,s.id,l.version||s.version+1))};if(!n.available)return e.jsxs("section",{className:"team-workspace","aria-label":"Team workspace",children:[e.jsx("h2",{children:"Team"}),e.jsx("p",{className:"muted",role:"status",children:n.unavailableReason||"Team observation unavailable"}),o?e.jsx("p",{className:"muted",children:"Read-only — historical / attach-only best replayable state when present."}):null]});const se=B.length>0||Object.keys(n.delegations).length>0,xe=["roster","board","messages",...T||N?["controls"]:[]],fe=f&&!f.terminal&&f.sessionId!==n.leadId&&b("team.child_interrupt")?e.jsxs("div",{className:"team-detail-actions team-controls-inline","aria-label":"Agent controls",children:[e.jsx("button",{type:"button",disabled:m,onClick:()=>void me(f.sessionId),children:"Interrupt"}),b("team.message")?e.jsx("button",{type:"button",disabled:m,onClick:()=>{J(f.sessionId),S("controls")},children:"Message"}):null]}):null;return e.jsxs("section",{className:`team-workspace ${p?"compact":""}`,"aria-label":"Team workspace",children:[e.jsxs("header",{className:"team-workspace-head",children:[e.jsx("h2",{children:"Team"}),o?e.jsx(_,{kind:"idle",label:"read-only"}):null,T?e.jsx(_,{kind:"busy",label:"controls"}):null]}),F?e.jsx("p",{className:"team-control-status",role:"status",children:F}):null,P.length>0&&e.jsxs("div",{className:"team-attention","aria-label":"Team attention",children:[e.jsxs("button",{type:"button",className:"team-attention-entry",onClick:()=>S("attention"),children:["Attention · ",P.length]}),C==="attention"&&e.jsx("ul",{children:P.map(s=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>{s.sessionId&&i(s.sessionId)},children:[e.jsx(ne,{kind:s.kind==="verification"||s.kind==="conflict"?"failed":"needs-you",label:s.kind}),e.jsxs("span",{children:[e.jsx("strong",{children:s.label}),s.detail?e.jsx("small",{children:s.detail}):null]})]})},s.id))})]}),e.jsx("div",{className:"team-view-tabs",role:"toolbar","aria-label":"Team views",children:xe.map(s=>e.jsx("button",{type:"button","aria-pressed":C===s,className:C===s?"active":"",onClick:()=>S(s),children:s},s))}),se?null:e.jsx("p",{className:"muted",children:"No child or team activity yet. Team stays available for explicit navigation."}),C==="roster"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"team-filters",role:"toolbar","aria-label":"Roster filters",children:Se.map(s=>e.jsx("button",{type:"button","aria-pressed":h===s.id,className:h===s.id?"active":"",onClick:()=>R(s.id),children:s.label},s.id))}),e.jsx("ul",{className:"team-roster",role:"list","aria-label":"Agent roster",children:Z.map(s=>{var A;const l=s.sessionId===a,d=s.sessionId===n.leadId||s.role==="lead",g=le(s.state);return e.jsx("li",{children:e.jsx(ge,{active:l,onClick:()=>i(l?void 0:s.sessionId),leading:e.jsx(ne,{kind:g,label:s.state||g}),title:`${k(s)}${d?" · lead":""}`,meta:[s.state,s.lastAction||s.queueLabel||s.blockReason,(A=s.filesTouched)!=null&&A.length?`${s.filesTouched.length} files`:""].filter(Boolean).join(" · ")})},s.sessionId)})}),!Z.length&&se?e.jsx("p",{className:"muted",children:"No agents match this filter."}):null]}),C==="board"&&e.jsx(Me,{delegations:n.delegations,members:n.members,canTransition:b("team.task_transition"),busy:m,onTransition:(s,l)=>void he(s,l),onSelectOwner:s=>{i(s),S("roster")}}),C==="messages"&&e.jsx(Re,{messages:n.messages}),C==="controls"&&e.jsx("section",{className:"team-controls","aria-label":"Team controls",children:N?e.jsx("p",{className:"muted",role:"status",children:te(N)}):e.jsxs(e.Fragment,{children:[b("team.spawn")&&e.jsxs("fieldset",{className:"team-control-block",children:[e.jsx("legend",{children:"Spawn agent"}),e.jsxs("label",{children:["Objective",e.jsx("textarea",{value:L,onChange:s=>z(s.target.value),rows:p?2:3,placeholder:"What should the child do?",disabled:m})]}),e.jsxs("label",{children:["Agent",e.jsx("select",{value:K,onChange:s=>oe(s.target.value),disabled:m,children:(c!=null&&c.length?c:["build","explore","general"]).map(s=>e.jsx("option",{value:s,children:s},s))})]}),e.jsx("button",{type:"button",className:"linkish",onClick:()=>re(s=>!s),children:D?"Hide advanced":"Advanced…"}),D&&e.jsxs("div",{className:"team-control-advanced",children:[e.jsxs("label",{children:["Alias",e.jsx("input",{value:O,onChange:s=>H(s.target.value),disabled:m})]}),e.jsxs("label",{children:["Max turns",e.jsx("input",{value:U,onChange:s=>de(s.target.value),inputMode:"numeric",disabled:m})]})]}),e.jsx("button",{type:"button",className:"primary",disabled:m||!L.trim(),onClick:()=>void ue(),children:"Spawn"})]}),(b("team.message")||b("team.broadcast"))&&e.jsxs("fieldset",{className:"team-control-block",children:[e.jsx("legend",{children:"Message"}),e.jsxs("label",{children:["To (session id)",e.jsx("input",{value:G,onChange:s=>J(s.target.value),placeholder:a||"child session id",disabled:m,list:"team-member-ids"}),e.jsx("datalist",{id:"team-member-ids",children:B.map(s=>e.jsx("option",{value:s.sessionId,children:k(s)},s.sessionId))})]}),e.jsxs("label",{children:["Body",e.jsx("textarea",{value:$,onChange:s=>Q(s.target.value),rows:2,disabled:m})]}),e.jsxs("div",{className:"team-control-row",children:[b("team.message")?e.jsx("button",{type:"button",disabled:m||!$.trim(),onClick:()=>void ee(!1),children:"Send"}):null,b("team.broadcast")?e.jsx("button",{type:"button",disabled:m||!$.trim(),onClick:()=>void ee(!0),children:"Broadcast"}):null]})]}),b("team.board_create")&&e.jsxs("fieldset",{className:"team-control-block",children:[e.jsx("legend",{children:"Board task"}),e.jsxs("label",{children:["Title",e.jsx("input",{value:V,onChange:s=>X(s.target.value),disabled:m})]}),e.jsx("button",{type:"button",disabled:m||!V.trim(),onClick:()=>void be(),children:"Create"}),Y.length>0&&e.jsx("ul",{className:"team-local-board","aria-label":"Local board tasks",children:Y.map(s=>e.jsxs("li",{children:[e.jsx("strong",{children:s.title}),e.jsxs("span",{className:"muted",children:[s.status," · v",s.version," · ",s.id]}),e.jsxs("div",{className:"team-control-row",children:[b("team.board_claim")&&s.status==="pending"?e.jsx("button",{type:"button",disabled:m,onClick:()=>void je(s),children:"Claim"}):null,b("team.board_complete")&&s.status!=="completed"?e.jsx("button",{type:"button",disabled:m,onClick:()=>void pe(s),children:"Complete"}):null]})]},s.id))})]}),e.jsxs("p",{className:"muted",children:["Root ",e.jsx("code",{children:j||n.leadId||"—"}),". Outcomes apply via live events; no second client store."]})]})}),f&&e.jsx(_e,{member:f,isLead:f.sessionId===n.leadId,onClose:()=>i(void 0),onOpenTranscript:t,verification:ce,controls:fe})]})}export{Oe as TeamWorkspace,Be as orderedMembers,Te as teamAttentionItems};
+import{r as u,j as e,S as _,a as ne,s as le,L as ge,O as ve}from"./index-BIBviZkd.js";const ke=["team.spawn","team.message","team.broadcast","team.child_interrupt","team.task_transition","team.board_create","team.board_claim","team.board_complete"];function ye(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`tc-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function ie(n,a){return!!(n!=null&&n.includes(a))}function we(n){if(n.attachOnly)return"attach-only";if(n.teamControl===!1)return"no-capability";if(!ke.some(a=>ie(n.protocolOps,a)))return"no-ops"}function te(n){switch(n){case"attach-only":return"Attach-only / historical session — team controls are disabled.";case"no-capability":return"This server does not advertise teamControl.";case"no-ops":return"No team-control Ops are available on this connection.";default:return""}}function Ce(n,a,i,t=1){return n.some(o=>o.id===a)?n:[...n,{id:a,title:i,version:t,status:"pending"}]}function Ne(n,a,i){return n.map(t=>t.id===a?{...t,version:i||t.version+1,status:"claimed"}:t)}function Ie(n,a,i){return n.map(t=>t.id===a?{...t,version:i||t.version+1,status:"completed"}:t)}const Se=[{id:"all",label:"All"},{id:"working",label:"Working"},{id:"needs-you",label:"Needs you"},{id:"blocked",label:"Blocked"},{id:"completed",label:"Completed"},{id:"failed",label:"Failed"},{id:"hidden",label:"Terminal"}],ae=["queued","starting","working","blocked","needs_attention","completed","failed","canceled"];function k(n){return n.name||n.agent||n.sessionId.slice(0,8)}function M(n){return(n||"unknown").toLowerCase().replace(/-/g,"_")}function $e(n,a,i){const t=M(n.state),o=!!n.terminal||["completed","failed","canceled","cancelled"].includes(t);switch(a){case"all":return!o;case"working":return["running","working","starting","finalizing"].includes(t);case"needs-you":return t==="needs_attention"||t==="escalating"||!!(n.blockReason&&t.includes("need"));case"blocked":return t==="blocked"||!!n.blockReason;case"completed":return t==="completed";case"failed":return t==="failed"||t==="interrupted";case"hidden":return o;default:return!0}}function Be(n){const a=Object.values(n.members),i=n.leadId;return a.sort((t,o)=>{if(i&&t.sessionId===i)return-1;if(i&&o.sessionId===i)return 1;const p=!!t.terminal,v=!!o.terminal;return p!==v?p?1:-1:k(t).localeCompare(k(o))})}function Te(n){var i;const a=[];for(const t of Object.values(n.members)){const o=M(t.state);(o==="escalating"||o==="needs_attention")&&a.push({id:`esc-${t.sessionId}`,kind:"escalation",label:`${k(t)} needs attention`,detail:t.blockReason||t.lastAction,sessionId:t.sessionId}),(o==="blocked"||t.blockReason)&&a.push({id:`blk-${t.sessionId}`,kind:"blocked",label:`${k(t)} blocked`,detail:t.blockReason,sessionId:t.sessionId})}for(const t of n.verifications)t.passed===!1&&a.push({id:`ver-${t.sessionId||a.length}`,kind:"verification",label:"Verification failed",detail:t.summary,sessionId:t.sessionId});for(const t of n.pathOverlaps)a.push({id:`ov-${t.path}`,kind:"conflict",label:`Path overlap: ${t.path}`,detail:(i=t.sessions)==null?void 0:i.join(", ")});for(const t of n.messages)(t.urgency==="high"||t.urgency==="blocker"||t.kind==="escalation")&&a.push({id:`msg-${t.messageId||t.time||a.length}`,kind:"message",label:t.summary||t.body||"Urgent team message",detail:t.from?`from ${t.from}`:void 0,sessionId:t.to});return a.slice(0,40)}function Ae(n){const a=n.budget;if(!a||typeof a!="object")return"unknown";const i=[];for(const t of["costUSD","tokens","turns","maxCostUSD","maxTokens","stopReason"])a[t]!==void 0&&a[t]!==null&&a[t]!==""&&i.push(`${t}=${String(a[t])}`);return i.length?i.join(" · "):"unknown"}function _e({member:n,isLead:a,onOpenTranscript:i,onClose:t,verification:o,controls:p}){var w;const v=le(n.state);return e.jsxs("section",{className:"team-detail","aria-label":"Agent detail",children:[e.jsxs("header",{children:[e.jsxs("h3",{children:[k(n),a?" (lead)":""]}),e.jsx("button",{type:"button",className:"icon-btn","aria-label":"Close agent detail",onClick:t,children:"×"})]}),e.jsxs("dl",{children:[e.jsx("dt",{children:"Status"}),e.jsx("dd",{children:e.jsx(_,{kind:v,label:n.state||v})}),n.agent?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Agent"}),e.jsx("dd",{children:n.agent})]}):null,n.objective?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Objective"}),e.jsx("dd",{children:n.objective})]}):null,n.lastAction?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Latest action"}),e.jsx("dd",{children:n.lastAction})]}):null,n.queueLabel?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Queue"}),e.jsx("dd",{children:n.queueLabel})]}):null,n.blockReason?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Blocked"}),e.jsx("dd",{children:n.blockReason})]}):null,n.terminalSummary?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Summary"}),e.jsx("dd",{children:n.terminalSummary})]}):null,e.jsx("dt",{children:"Budget / stop"}),e.jsx("dd",{children:Ae(n)}),o?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Verification"}),e.jsxs("dd",{children:[o.passed===!0?"passed":o.passed===!1?"failed":"unknown",o.summary?` — ${o.summary}`:""]})]}):e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Verification"}),e.jsx("dd",{children:"unknown"})]}),(w=n.filesTouched)!=null&&w.length?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Files"}),e.jsx("dd",{children:e.jsx("ul",{className:"team-files",children:n.filesTouched.map(c=>e.jsx("li",{children:e.jsx("code",{children:c})},c))})})]}):null,e.jsx("dt",{children:"Session"}),e.jsx("dd",{children:e.jsx("code",{children:n.sessionId})})]}),i&&e.jsx("div",{className:"team-detail-actions",children:e.jsx("button",{type:"button",onClick:()=>i(n.sessionId),children:"Open transcript (RO)"})}),p]})}function Me({delegations:n,members:a,onSelectOwner:i,onTransition:t,canTransition:o,busy:p}){const w=[...u.useMemo(()=>{const c=new Map;for(const j of ae)c.set(j,[]);c.set("other",[]);for(const j of Object.values(n)){const r=M(j.state),h=ae.includes(r)?r:"other";c.get(h).push(j)}return c},[n]).entries()].filter(([,c])=>c.length>0);return w.length?e.jsx("div",{className:"team-board","aria-label":"Task board",children:w.map(([c,j])=>e.jsxs("section",{className:"team-board-col","aria-label":`${c} column`,children:[e.jsxs("h4",{children:[c.replace(/_/g," ")," ",e.jsx("span",{className:"muted",children:j.length})]}),e.jsx("ul",{children:j.map(r=>{const h=r.ownerSessionId||r.sessionId,R=h&&a[h]?k(a[h]):h==null?void 0:h.slice(0,8);return e.jsx("li",{children:e.jsxs("div",{className:"team-board-card",children:[e.jsxs("button",{type:"button",className:"team-board-card-main",onClick:()=>h&&(i==null?void 0:i(h)),children:[e.jsx("strong",{children:r.name||r.id.slice(0,10)}),e.jsx("span",{className:"muted",children:R||"unassigned"}),r.reason?e.jsx("span",{className:"team-board-reason",children:r.reason}):null,r.version!==void 0?e.jsxs("small",{children:["v",r.version]}):null]}),o&&t&&!["done","completed","failed","canceled","cancelled"].includes(M(r.state))?e.jsxs("div",{className:"team-board-actions",children:[e.jsx("button",{type:"button",disabled:p,onClick:()=>t(r,"blocked"),children:"Block"}),e.jsx("button",{type:"button",disabled:p,onClick:()=>{window.confirm(`Mark ${r.name||r.id} completed?`)&&t(r,"completed")},children:"Complete"}),e.jsx("button",{type:"button",disabled:p,onClick:()=>{window.confirm(`Cancel ${r.name||r.id}?`)&&t(r,"canceled")},children:"Cancel"})]}):null]})},r.id)})})]},c))}):e.jsx("p",{className:"muted",children:"No delegation / team-task rows yet."})}function Re({messages:n}){return n.length?e.jsx("ul",{className:"team-messages","aria-label":"Recent team messages",children:[...n].reverse().slice(0,20).map((a,i)=>e.jsxs("li",{children:[e.jsxs("strong",{children:[a.from||"?"," → ",a.to||"*"]}),a.urgency&&a.urgency!=="normal"?e.jsx(_,{kind:"needs-you",label:a.urgency}):null,e.jsx("span",{children:a.summary||a.body||"(empty)"})]},a.messageId||`${a.time}-${i}`))}):e.jsx("p",{className:"muted",children:"No team messages yet."})}function Fe(n){return n instanceof ve?n.code==="conflict"&&n.currentVersion!==void 0?`Conflict (current v${n.currentVersion}). Refresh and retry.`:n.code==="idempotency_conflict"?"Duplicate action with different payload.":n.code==="attach_only"?"Attach-only — mutations disabled.":n.code==="permission_denied"?"Permission denied.":n.message||n.code||"Operation failed":n instanceof Error?n.message:String(n)}function Oe({team:n,selectedId:a,onSelect:i,onOpenTranscript:t,readOnly:o,compact:p,protocolOps:v,teamControl:w,agents:c,rootSessionId:j,sendOp:r}){const[h,R]=u.useState("all"),[C,S]=u.useState("roster"),[F,x]=u.useState(""),[m,W]=u.useState(!1),[L,z]=u.useState(""),[K,oe]=u.useState((c==null?void 0:c[0])||"build"),[O,H]=u.useState(""),[D,re]=u.useState(!1),[U,de]=u.useState(""),[$,Q]=u.useState(""),[G,J]=u.useState(""),[V,X]=u.useState(""),[Y,q]=u.useState([]),E=u.useRef(new Set),B=u.useMemo(()=>Be(n),[n]),Z=u.useMemo(()=>B.filter(s=>$e(s,h,n.leadId)),[B,h,n.leadId]),P=u.useMemo(()=>Te(n),[n]),f=a?n.members[a]:void 0,ce=f?[...n.verifications].reverse().find(s=>s.sessionId===f.sessionId):void 0,N=we({attachOnly:o,teamControl:w,protocolOps:v}),T=!!(r&&!N&&!o),b=u.useCallback(s=>T&&ie(v,s),[T,v]),y=u.useCallback(async(s,l,d)=>{if(!r||!b(l))return x(te(N)||"Control unavailable"),null;if(E.current.has(s))return x("Already in flight — wait for the previous request."),null;E.current.add(s),W(!0),x("");const g=ye(),A={...d,idempotencyKey:g,...j?{rootSessionId:j}:{}};try{const I=await r(l,A);return x(I.ok?"OK":I.error||"done"),I}catch(I){return x(Fe(I)),null}finally{E.current.delete(s),W(!1)}},[r,b,N,j]),ue=async()=>{const s=L.trim();if(!s){x("Objective is required");return}const l={objective:s,agent:K||void 0};if(O.trim()&&(l.name=O.trim()),D&&U.trim()){const g=Number(U);Number.isFinite(g)&&g>0&&(l.budget={maxTurns:g})}const d=await y("spawn","team.spawn",l);d!=null&&d.ok&&(z(""),H(""),x(d.childSessionId?`Spawned ${d.childSessionId.slice(0,8)}`:"Spawned"))},ee=async s=>{const l=$.trim();if(!l){x("Message body is required");return}if(s)await y("broadcast","team.broadcast",{body:l});else{const d=(G||a||"").trim();if(!d){x("Select a target agent");return}await y(`msg-${d}`,"team.message",{to:d,body:l,kind:"message"})}Q("")},me=async s=>{const l=n.members[s],d=l?k(l):s.slice(0,8);window.confirm(`Interrupt ${d}? Active work will be canceled.`)&&await y(`intr-${s}`,"team.child_interrupt",{childSessionId:s,reason:"human interrupt"})},he=async(s,l)=>{!await y(`tr-${s.id}-${l}`,"team.task_transition",{delegationId:s.id,expectedVersion:s.version??0,toState:l})&&F.includes("Conflict")&&x(g=>`${g} — reload team snapshot.`)},be=async()=>{const s=V.trim();if(!s){x("Board title is required");return}const l=await y("board-create","team.board_create",{title:s});l!=null&&l.ok&&l.taskId&&(q(d=>Ce(d,l.taskId,s,l.version||1)),X(""))},je=async s=>{const l=await y(`claim-${s.id}`,"team.board_claim",{taskId:s.id,expectedVersion:s.version});l!=null&&l.ok&&q(d=>Ne(d,s.id,l.version||s.version+1))},pe=async s=>{if(!window.confirm(`Complete board task ${s.title}?`))return;const l=await y(`complete-${s.id}`,"team.board_complete",{taskId:s.id,expectedVersion:s.version});l!=null&&l.ok&&q(d=>Ie(d,s.id,l.version||s.version+1))};if(!n.available)return e.jsxs("section",{className:"team-workspace","aria-label":"Team workspace",children:[e.jsx("h2",{children:"Team"}),e.jsx("p",{className:"muted",role:"status",children:n.unavailableReason||"Team observation unavailable"}),o?e.jsx("p",{className:"muted",children:"Read-only — historical / attach-only best replayable state when present."}):null]});const se=B.length>0||Object.keys(n.delegations).length>0,xe=["roster","board","messages",...T||N?["controls"]:[]],fe=f&&!f.terminal&&f.sessionId!==n.leadId&&b("team.child_interrupt")?e.jsxs("div",{className:"team-detail-actions team-controls-inline","aria-label":"Agent controls",children:[e.jsx("button",{type:"button",disabled:m,onClick:()=>void me(f.sessionId),children:"Interrupt"}),b("team.message")?e.jsx("button",{type:"button",disabled:m,onClick:()=>{J(f.sessionId),S("controls")},children:"Message"}):null]}):null;return e.jsxs("section",{className:`team-workspace ${p?"compact":""}`,"aria-label":"Team workspace",children:[e.jsxs("header",{className:"team-workspace-head",children:[e.jsx("h2",{children:"Team"}),o?e.jsx(_,{kind:"idle",label:"read-only"}):null,T?e.jsx(_,{kind:"busy",label:"controls"}):null]}),F?e.jsx("p",{className:"team-control-status",role:"status",children:F}):null,P.length>0&&e.jsxs("div",{className:"team-attention","aria-label":"Team attention",children:[e.jsxs("button",{type:"button",className:"team-attention-entry",onClick:()=>S("attention"),children:["Attention · ",P.length]}),C==="attention"&&e.jsx("ul",{children:P.map(s=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>{s.sessionId&&i(s.sessionId)},children:[e.jsx(ne,{kind:s.kind==="verification"||s.kind==="conflict"?"failed":"needs-you",label:s.kind}),e.jsxs("span",{children:[e.jsx("strong",{children:s.label}),s.detail?e.jsx("small",{children:s.detail}):null]})]})},s.id))})]}),e.jsx("div",{className:"team-view-tabs",role:"toolbar","aria-label":"Team views",children:xe.map(s=>e.jsx("button",{type:"button","aria-pressed":C===s,className:C===s?"active":"",onClick:()=>S(s),children:s},s))}),se?null:e.jsx("p",{className:"muted",children:"No child or team activity yet. Team stays available for explicit navigation."}),C==="roster"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"team-filters",role:"toolbar","aria-label":"Roster filters",children:Se.map(s=>e.jsx("button",{type:"button","aria-pressed":h===s.id,className:h===s.id?"active":"",onClick:()=>R(s.id),children:s.label},s.id))}),e.jsx("ul",{className:"team-roster",role:"list","aria-label":"Agent roster",children:Z.map(s=>{var A;const l=s.sessionId===a,d=s.sessionId===n.leadId||s.role==="lead",g=le(s.state);return e.jsx("li",{children:e.jsx(ge,{active:l,onClick:()=>i(l?void 0:s.sessionId),leading:e.jsx(ne,{kind:g,label:s.state||g}),title:`${k(s)}${d?" · lead":""}`,meta:[s.state,s.lastAction||s.queueLabel||s.blockReason,(A=s.filesTouched)!=null&&A.length?`${s.filesTouched.length} files`:""].filter(Boolean).join(" · ")})},s.sessionId)})}),!Z.length&&se?e.jsx("p",{className:"muted",children:"No agents match this filter."}):null]}),C==="board"&&e.jsx(Me,{delegations:n.delegations,members:n.members,canTransition:b("team.task_transition"),busy:m,onTransition:(s,l)=>void he(s,l),onSelectOwner:s=>{i(s),S("roster")}}),C==="messages"&&e.jsx(Re,{messages:n.messages}),C==="controls"&&e.jsx("section",{className:"team-controls","aria-label":"Team controls",children:N?e.jsx("p",{className:"muted",role:"status",children:te(N)}):e.jsxs(e.Fragment,{children:[b("team.spawn")&&e.jsxs("fieldset",{className:"team-control-block",children:[e.jsx("legend",{children:"Spawn agent"}),e.jsxs("label",{children:["Objective",e.jsx("textarea",{value:L,onChange:s=>z(s.target.value),rows:p?2:3,placeholder:"What should the child do?",disabled:m})]}),e.jsxs("label",{children:["Agent",e.jsx("select",{value:K,onChange:s=>oe(s.target.value),disabled:m,children:(c!=null&&c.length?c:["build","explore","general"]).map(s=>e.jsx("option",{value:s,children:s},s))})]}),e.jsx("button",{type:"button",className:"linkish",onClick:()=>re(s=>!s),children:D?"Hide advanced":"Advanced…"}),D&&e.jsxs("div",{className:"team-control-advanced",children:[e.jsxs("label",{children:["Alias",e.jsx("input",{value:O,onChange:s=>H(s.target.value),disabled:m})]}),e.jsxs("label",{children:["Max turns",e.jsx("input",{value:U,onChange:s=>de(s.target.value),inputMode:"numeric",disabled:m})]})]}),e.jsx("button",{type:"button",className:"primary",disabled:m||!L.trim(),onClick:()=>void ue(),children:"Spawn"})]}),(b("team.message")||b("team.broadcast"))&&e.jsxs("fieldset",{className:"team-control-block",children:[e.jsx("legend",{children:"Message"}),e.jsxs("label",{children:["To (session id)",e.jsx("input",{value:G,onChange:s=>J(s.target.value),placeholder:a||"child session id",disabled:m,list:"team-member-ids"}),e.jsx("datalist",{id:"team-member-ids",children:B.map(s=>e.jsx("option",{value:s.sessionId,children:k(s)},s.sessionId))})]}),e.jsxs("label",{children:["Body",e.jsx("textarea",{value:$,onChange:s=>Q(s.target.value),rows:2,disabled:m})]}),e.jsxs("div",{className:"team-control-row",children:[b("team.message")?e.jsx("button",{type:"button",disabled:m||!$.trim(),onClick:()=>void ee(!1),children:"Send"}):null,b("team.broadcast")?e.jsx("button",{type:"button",disabled:m||!$.trim(),onClick:()=>void ee(!0),children:"Broadcast"}):null]})]}),b("team.board_create")&&e.jsxs("fieldset",{className:"team-control-block",children:[e.jsx("legend",{children:"Board task"}),e.jsxs("label",{children:["Title",e.jsx("input",{value:V,onChange:s=>X(s.target.value),disabled:m})]}),e.jsx("button",{type:"button",disabled:m||!V.trim(),onClick:()=>void be(),children:"Create"}),Y.length>0&&e.jsx("ul",{className:"team-local-board","aria-label":"Local board tasks",children:Y.map(s=>e.jsxs("li",{children:[e.jsx("strong",{children:s.title}),e.jsxs("span",{className:"muted",children:[s.status," · v",s.version," · ",s.id]}),e.jsxs("div",{className:"team-control-row",children:[b("team.board_claim")&&s.status==="pending"?e.jsx("button",{type:"button",disabled:m,onClick:()=>void je(s),children:"Claim"}):null,b("team.board_complete")&&s.status!=="completed"?e.jsx("button",{type:"button",disabled:m,onClick:()=>void pe(s),children:"Complete"}):null]})]},s.id))})]}),e.jsxs("p",{className:"muted",children:["Root ",e.jsx("code",{children:j||n.leadId||"—"}),". Outcomes apply via live events; no second client store."]})]})}),f&&e.jsx(_e,{member:f,isLead:f.sessionId===n.leadId,onClose:()=>i(void 0),onOpenTranscript:t,verification:ce,controls:fe})]})}export{Oe as TeamWorkspace,Be as orderedMembers,Te as teamAttentionItems};
diff --git a/internal/frontend/server/static/assets/Timeline-BA5GlsNC.js b/internal/frontend/server/static/assets/Timeline-eRMBJ9AN.js
similarity index 98%
rename from internal/frontend/server/static/assets/Timeline-BA5GlsNC.js
rename to internal/frontend/server/static/assets/Timeline-eRMBJ9AN.js
index 4bd6215e..55028aa7 100644
--- a/internal/frontend/server/static/assets/Timeline-BA5GlsNC.js
+++ b/internal/frontend/server/static/assets/Timeline-eRMBJ9AN.js
@@ -1 +1 @@
-import{b as y,r as h,j as e}from"./index-BK8GKzWA.js";const g=n=>y(`/v1/sessions/${encodeURIComponent(n)}/timeline`);async function k(n,t="json"){const r=`/v1/sessions/${encodeURIComponent(n)}/timeline/export?format=${t}`,a=await fetch(r,{credentials:"same-origin"});if(!a.ok){const i=await a.json().catch(()=>null);throw new Error((i==null?void 0:i.error)||`${a.status} ${a.statusText}`)}const m=await a.blob(),x=a.headers.get("Content-Disposition")||"",d=/filename="([^"]+)"/.exec(x),o=(d==null?void 0:d[1])||`strike-timeline.${t==="jsonl"?"jsonl":"json"}`,c=URL.createObjectURL(m);try{const i=document.createElement("a");i.href=c,i.download=o,i.rel="noopener",document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(c)}}function b(n){return n==null||Number.isNaN(n)?"":n<1e3?`${n}ms`:n<6e4?`${(n/1e3).toFixed(1)}s`:`${(n/6e4).toFixed(1)}m`}function u(n){const t=(n||"").trim();return t?t.length<=10?t:t.slice(0,10):"—"}function N(n){return n.name?`${n.kind}:${n.name}`:n.kind}function w(n){switch(n.kind){case"turn":return u(n.turnId);case"tool":return u(n.callId);case"provider":return u(n.providerRequestId);case"child":return u(n.childSessionId);case"permission":return u(n.callId);case"verify":return u(n.turnId||n.id);default:return u(n.id)}}function C({available:n,sessionID:t}){const[r,a]=h.useState(),[m,x]=h.useState(!1),[d,o]=h.useState(""),[c,i]=h.useState(""),j=h.useCallback(async()=>{if(!(!n||!t)){x(!0),o("");try{a(await g(t))}catch(s){a(void 0),o(s.message||"timeline unavailable")}finally{x(!1)}}},[n,t]);h.useEffect(()=>{a(void 0),o(""),!(!n||!t)&&j()},[n,t,j]);const p=async s=>{if(t){i(s),o("");try{await k(t,s)}catch(v){o(v.message||"export failed")}finally{i("")}}};if(!n)return e.jsxs("section",{className:"unavailable",role:"status",children:[e.jsx("strong",{children:"Timeline unavailable"}),e.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})]});if(!t)return e.jsx("p",{className:"muted",children:"Select a session to inspect its run timeline."});const l=r==null?void 0:r.summary,f=(r==null?void 0:r.entries)||[];return e.jsxs("div",{className:"timeline-panel",children:[e.jsxs("div",{className:"timeline-head",children:[e.jsx("h2",{children:"Run timeline"}),e.jsxs("div",{className:"timeline-actions",children:[e.jsx("button",{type:"button",onClick:()=>void j(),disabled:m,children:m?"Loading…":r?"Refresh":"Load"}),e.jsx("button",{type:"button",onClick:()=>void p("json"),disabled:!t||c!=="",children:c==="json"?"…":"Export JSON"}),e.jsx("button",{type:"button",onClick:()=>void p("jsonl"),disabled:!t||c!=="",children:c==="jsonl"?"…":"Export JSONL"})]})]}),e.jsx("p",{className:"muted",children:"Collapsed harness spans (turns/tools/provider/children). Complements the transcript; exports are secret-redacted."}),d&&e.jsxs("section",{className:"unavailable",role:"status",children:[e.jsx("strong",{children:"Unable to load"}),e.jsx("p",{children:d})]}),r&&e.jsxs(e.Fragment,{children:[e.jsxs("dl",{className:"timeline-summary","aria-label":"Timeline summary",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Turns"}),e.jsx("dd",{children:(l==null?void 0:l.turns)??0})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Tools"}),e.jsx("dd",{children:(l==null?void 0:l.tools)??0})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Failed"}),e.jsx("dd",{children:(l==null?void 0:l.failed)??0})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Duration"}),e.jsx("dd",{children:b(l==null?void 0:l.durationMs)||"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Redacted"}),e.jsx("dd",{children:r.redacted?"yes":"no"})]})]}),f.length===0?e.jsx("p",{className:"muted",children:"No timeline entries yet — run a turn first."}):e.jsx("ol",{className:"timeline-list","aria-label":"Timeline entries",children:f.map(s=>e.jsxs("li",{className:`timeline-entry state-${s.state||"unknown"}`,children:[e.jsx("span",{className:`timeline-state state-${s.state||"unknown"}`,children:s.state||"?"}),e.jsx("span",{className:"timeline-label",title:N(s),children:N(s)}),e.jsx("code",{className:"timeline-id",children:w(s)}),e.jsx("span",{className:"timeline-dur",children:b(s.durationMs)}),s.errorCode&&e.jsx("span",{className:"timeline-code",children:s.errorCode}),s.error&&e.jsx("span",{className:"timeline-err",title:s.error,children:s.error})]},s.id))})]}),!r&&!m&&!d&&e.jsx("p",{className:"muted",children:"Load the collapsed run timeline for the selected session."})]})}export{C as TimelinePanel};
+import{b as y,r as h,j as e}from"./index-BIBviZkd.js";const g=n=>y(`/v1/sessions/${encodeURIComponent(n)}/timeline`);async function k(n,t="json"){const r=`/v1/sessions/${encodeURIComponent(n)}/timeline/export?format=${t}`,a=await fetch(r,{credentials:"same-origin"});if(!a.ok){const i=await a.json().catch(()=>null);throw new Error((i==null?void 0:i.error)||`${a.status} ${a.statusText}`)}const m=await a.blob(),x=a.headers.get("Content-Disposition")||"",d=/filename="([^"]+)"/.exec(x),o=(d==null?void 0:d[1])||`strike-timeline.${t==="jsonl"?"jsonl":"json"}`,c=URL.createObjectURL(m);try{const i=document.createElement("a");i.href=c,i.download=o,i.rel="noopener",document.body.appendChild(i),i.click(),i.remove()}finally{URL.revokeObjectURL(c)}}function b(n){return n==null||Number.isNaN(n)?"":n<1e3?`${n}ms`:n<6e4?`${(n/1e3).toFixed(1)}s`:`${(n/6e4).toFixed(1)}m`}function u(n){const t=(n||"").trim();return t?t.length<=10?t:t.slice(0,10):"—"}function N(n){return n.name?`${n.kind}:${n.name}`:n.kind}function w(n){switch(n.kind){case"turn":return u(n.turnId);case"tool":return u(n.callId);case"provider":return u(n.providerRequestId);case"child":return u(n.childSessionId);case"permission":return u(n.callId);case"verify":return u(n.turnId||n.id);default:return u(n.id)}}function C({available:n,sessionID:t}){const[r,a]=h.useState(),[m,x]=h.useState(!1),[d,o]=h.useState(""),[c,i]=h.useState(""),j=h.useCallback(async()=>{if(!(!n||!t)){x(!0),o("");try{a(await g(t))}catch(s){a(void 0),o(s.message||"timeline unavailable")}finally{x(!1)}}},[n,t]);h.useEffect(()=>{a(void 0),o(""),!(!n||!t)&&j()},[n,t,j]);const p=async s=>{if(t){i(s),o("");try{await k(t,s)}catch(v){o(v.message||"export failed")}finally{i("")}}};if(!n)return e.jsxs("section",{className:"unavailable",role:"status",children:[e.jsx("strong",{children:"Timeline unavailable"}),e.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})]});if(!t)return e.jsx("p",{className:"muted",children:"Select a session to inspect its run timeline."});const l=r==null?void 0:r.summary,f=(r==null?void 0:r.entries)||[];return e.jsxs("div",{className:"timeline-panel",children:[e.jsxs("div",{className:"timeline-head",children:[e.jsx("h2",{children:"Run timeline"}),e.jsxs("div",{className:"timeline-actions",children:[e.jsx("button",{type:"button",onClick:()=>void j(),disabled:m,children:m?"Loading…":r?"Refresh":"Load"}),e.jsx("button",{type:"button",onClick:()=>void p("json"),disabled:!t||c!=="",children:c==="json"?"…":"Export JSON"}),e.jsx("button",{type:"button",onClick:()=>void p("jsonl"),disabled:!t||c!=="",children:c==="jsonl"?"…":"Export JSONL"})]})]}),e.jsx("p",{className:"muted",children:"Collapsed harness spans (turns/tools/provider/children). Complements the transcript; exports are secret-redacted."}),d&&e.jsxs("section",{className:"unavailable",role:"status",children:[e.jsx("strong",{children:"Unable to load"}),e.jsx("p",{children:d})]}),r&&e.jsxs(e.Fragment,{children:[e.jsxs("dl",{className:"timeline-summary","aria-label":"Timeline summary",children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Turns"}),e.jsx("dd",{children:(l==null?void 0:l.turns)??0})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Tools"}),e.jsx("dd",{children:(l==null?void 0:l.tools)??0})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Failed"}),e.jsx("dd",{children:(l==null?void 0:l.failed)??0})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Duration"}),e.jsx("dd",{children:b(l==null?void 0:l.durationMs)||"—"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Redacted"}),e.jsx("dd",{children:r.redacted?"yes":"no"})]})]}),f.length===0?e.jsx("p",{className:"muted",children:"No timeline entries yet — run a turn first."}):e.jsx("ol",{className:"timeline-list","aria-label":"Timeline entries",children:f.map(s=>e.jsxs("li",{className:`timeline-entry state-${s.state||"unknown"}`,children:[e.jsx("span",{className:`timeline-state state-${s.state||"unknown"}`,children:s.state||"?"}),e.jsx("span",{className:"timeline-label",title:N(s),children:N(s)}),e.jsx("code",{className:"timeline-id",children:w(s)}),e.jsx("span",{className:"timeline-dur",children:b(s.durationMs)}),s.errorCode&&e.jsx("span",{className:"timeline-code",children:s.errorCode}),s.error&&e.jsx("span",{className:"timeline-err",title:s.error,children:s.error})]},s.id))})]}),!r&&!m&&!d&&e.jsx("p",{className:"muted",children:"Load the collapsed run timeline for the selected session."})]})}export{C as TimelinePanel};
diff --git a/internal/frontend/server/static/assets/Workflows-BFSMWcFc.js b/internal/frontend/server/static/assets/Workflows-BHp6vnHZ.js
similarity index 99%
rename from internal/frontend/server/static/assets/Workflows-BFSMWcFc.js
rename to internal/frontend/server/static/assets/Workflows-BHp6vnHZ.js
index a508380e..1ca0d939 100644
--- a/internal/frontend/server/static/assets/Workflows-BFSMWcFc.js
+++ b/internal/frontend/server/static/assets/Workflows-BHp6vnHZ.js
@@ -1,3 +1,3 @@
-import{b as k,r as c,j as e}from"./index-BK8GKzWA.js";const Z=()=>k("/v1/workflows"),ee=a=>k(`/v1/workflows/${encodeURIComponent(a)}/document`),se=a=>k("/v1/workflows/scaffold",{method:"POST",body:JSON.stringify({name:a})}),_=a=>k("/v1/workflows/validate",{method:"POST",body:JSON.stringify({document:a})}),A=a=>k("/v1/workflows/format",{method:"POST",body:JSON.stringify({document:a})}),ae=(a,u)=>k("/v1/workflows/phase-grants",{method:"POST",body:JSON.stringify({document:a,phaseIndex:u})}),te=(a,u,p)=>k("/v1/workflows/save",{method:"POST",body:JSON.stringify({document:a,scope:u,force:p})}),ne=(a,u)=>{const p=u?`?root=${encodeURIComponent(u)}`:"";return k(`/v1/workflows/${encodeURIComponent(a)}/start${p}`,{method:"POST",body:JSON.stringify({confirm:!0})})},oe=a=>{const u=a?`?root=${encodeURIComponent(a)}`:"";return k(`/v1/workflows/stop${u}`,{method:"POST",body:JSON.stringify({})})},H=a=>k("/v1/workflow-drafts/review",{method:"POST",body:JSON.stringify({json:a})}),z=()=>({name:"phase-1",gate:"agent",permissions:[]}),K=a=>JSON.parse(JSON.stringify(a)),le=["agent","user","check"],re=["allow","ask","deny"],ie=["project","global"];function U(a){return`${a.action} ${a.permission}${a.pattern?` ${a.pattern}`:""}`}function ue({available:a,draftsAvailable:u,live:p,rootID:O,activeWorkflow:y,agents:W,busy:N}){const[d,l]=c.useState([]),[m,S]=c.useState(!1),[C,r]=c.useState(""),[x,P]=c.useState(null),[h,D]=c.useState(null),[w,$]=c.useState(""),E=async()=>{if(a){S(!0),r("");try{const n=await Z();l(n.workflows||[])}catch(n){r(n.message)}finally{S(!1)}}};if(c.useEffect(()=>{E()},[a]),!a)return e.jsxs("section",{className:"unavailable",role:"status",children:[e.jsx("strong",{children:"Workflows unavailable"}),e.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})]});const T=async()=>{try{const n=await se("my-workflow");P({doc:n,scope:"project",creating:!0})}catch(n){window.alert(n.message)}},q=async n=>{try{const j=await ee(n),v=d.find(J=>J.name===n),R=(v==null?void 0:v.source)==="global"?"global":"project";P({doc:K(j),scope:R,creating:!1})}catch(j){window.alert(j.message)}},g=async()=>{if(!(!p||N))try{await oe(O),$("Workflow stopped (session history kept).")}catch(n){window.alert(n.message)}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"workflow-head",children:[e.jsx("h2",{children:"Workflows"}),e.jsxs("div",{className:"workflow-actions",children:[e.jsx("button",{type:"button",onClick:()=>void E(),disabled:m,children:"Refresh"}),e.jsx("button",{type:"button",onClick:()=>void T(),children:"New"}),p&&e.jsx("button",{type:"button",onClick:()=>void g(),disabled:N||!y,children:"Stop"})]})]}),y&&e.jsxs("p",{className:"workflow-active",role:"status",children:["Active: ",e.jsx("strong",{children:y})]}),w&&e.jsx("p",{className:"muted",role:"status",children:w}),C&&e.jsxs("section",{className:"unavailable",role:"alert",children:[e.jsx("strong",{children:"Unable to load"}),e.jsx("p",{children:C})]}),m&&!d.length?e.jsx("p",{className:"muted",children:"Loading catalog…"}):null,!m&&!d.length&&!C?e.jsx("p",{className:"muted",children:"No workflows loaded."}):null,e.jsx("div",{className:"workflow-list",children:d.map(n=>{var j,v,R,J,i;return e.jsxs("article",{className:`workflow-card ${n.valid?"":"invalid"}`,children:[e.jsxs("header",{children:[e.jsx("h3",{children:n.name}),e.jsxs("small",{children:[n.source||"unknown"," · ",((j=n.phases)==null?void 0:j.length)||0," phase(s)",n.valid?"":" · invalid"]})]}),n.description&&e.jsx("p",{children:n.description}),!n.valid&&n.validationError&&e.jsx("p",{className:"workflow-error",role:"status",children:n.validationError}),(J=(R=(v=n.phases)==null?void 0:v[0])==null?void 0:R.permissions)!=null&&J.length?e.jsxs("p",{className:"workflow-grants",children:[e.jsx("span",{children:"Phase 0 grants"}),n.phases[0].permissions.map((b,G)=>e.jsx("code",{children:U(b)},G))]}):null,e.jsxs("div",{className:"workflow-card-actions",children:[e.jsx("button",{type:"button",onClick:()=>void q(n.name),children:"Edit"}),e.jsx("button",{type:"button",disabled:!p||N||!n.valid||!((i=n.phases)!=null&&i.length),title:n.valid?void 0:"Invalid workflows cannot be activated",onClick:()=>D(n),children:"Start"})]})]},n.name)})}),x&&e.jsx(de,{initial:x.doc,scope:x.scope,creating:x.creating,agents:W,draftsAvailable:u,onClose:()=>P(null),onSaved:async n=>{P(null),$(`Saved ${n} (not activated).`),await E()}}),h&&e.jsx(ce,{summary:h,rootID:O,onClose:()=>D(null),onStarted:()=>{$(`Starting ${h.name}…`),D(null)}})]})}function ce({summary:a,rootID:u,onClose:p,onStarted:O}){var S,C;const y=c.useRef(null),[W,N]=c.useState(!1);c.useEffect(()=>{var r;(r=y.current)==null||r.showModal()},[]);const d=(S=a.phases)==null?void 0:S[0],l=(d==null?void 0:d.permissions)||[],m=async()=>{N(!0);try{await ne(a.name,u),O()}catch(r){window.alert(r.message),N(!1)}};return e.jsxs("dialog",{ref:y,className:"workflow-dialog","aria-labelledby":"wf-start-title",onClose:p,onCancel:r=>{r.preventDefault(),p()},children:[e.jsx("div",{className:"dialog-rule"}),e.jsxs("h2",{id:"wf-start-title",children:["Start ",a.name]}),e.jsxs("p",{className:"muted",children:["source ",a.source||"unknown"," · ",((C=a.phases)==null?void 0:C.length)||0," phase(s)"]}),a.description&&e.jsx("p",{children:a.description}),e.jsxs("section",{className:"workflow-review","aria-label":"Phase 0 grant review",children:[e.jsx("h3",{children:"Phase 0 grant review"}),e.jsx("p",{children:d?e.jsxs(e.Fragment,{children:[d.name,d.agent?` @${d.agent}`:""," · gate ",d.gate||"agent",d.gateCommand?` \`${d.gateCommand}\``:""]}):"No phases"}),l.length?e.jsx("ul",{children:l.map((r,x)=>e.jsx("li",{children:e.jsx("code",{children:U(r)})},x))}):e.jsx("p",{className:"muted",children:"No phase permission overrides."}),e.jsx("p",{className:"workflow-warn",children:"Starting applies phase permissions and may pin the phase agent. Session history is kept. Confirm only after reviewing grants."})]}),e.jsxs("div",{className:"dialog-actions",children:[e.jsx("button",{type:"button",onClick:p,disabled:W,children:"Cancel"}),e.jsx("button",{type:"button",autoFocus:!0,disabled:W||!a.valid,onClick:()=>void m(),children:"Confirm start"})]})]})}function de({initial:a,scope:u,creating:p,agents:O,draftsAvailable:y,onClose:W,onSaved:N}){var L;const d=c.useRef(null),[l,m]=c.useState(()=>K(a)),[S,C]=c.useState(u),[r,x]=c.useState(0),[P,h]=c.useState(""),[D,w]=c.useState(!1),[$,E]=c.useState(""),[T,q]=c.useState([]),[g,n]=c.useState(null),[j,v]=c.useState(!1),R=c.useMemo(()=>JSON.stringify(a),[a]),J=JSON.stringify(l)!==R;c.useEffect(()=>{var s;(s=d.current)==null||s.showModal()},[]);const i=l.phases[r]||z(),b=s=>{m(t=>{const o=t.phases.slice();return o[r]=s,{...t,phases:o}})},G=async()=>{try{const s=await _(l);s.ok?(h("Valid"),w(!1)):(h(s.error||"Invalid"),w(!0))}catch(s){h(s.message),w(!0)}},Q=async()=>{try{const[s,t]=await Promise.all([A(l),ae(l,r)]);if(E(s.json),q(t.grants||[]),y){const o=await H(s.json);n(o),o.valid?o.hasWidening||o.hasChecks?(h(o.hasWidening?"Review widening grants before save":"Review executable checks before save"),w(!1)):(h("Preview ready"),w(!1)):(h(o.validationError||"Draft invalid"),w(!0))}else n(null),h("Preview ready"),w(!1)}catch(s){h(s.message),w(!0)}},B=async s=>{v(!0);try{const t=await _(l);if(!t.ok){h(t.error||"Cannot save invalid workflow"),w(!0),v(!1);return}if(y){const f=await A(l),I=await H(f.json);if(n(I),E(f.json),!I.valid){h(I.validationError||"Cannot save invalid draft"),w(!0),v(!1);return}}(await te(l,S,s)).activated&&window.alert("Unexpected: save reported activation. Workflow was not started by the client."),await N(l.name)}catch(t){const o=t.message;if(!s&&/already exists/i.test(o)&&window.confirm(`${o}
+import{b as k,r as c,j as e}from"./index-BIBviZkd.js";const Z=()=>k("/v1/workflows"),ee=a=>k(`/v1/workflows/${encodeURIComponent(a)}/document`),se=a=>k("/v1/workflows/scaffold",{method:"POST",body:JSON.stringify({name:a})}),_=a=>k("/v1/workflows/validate",{method:"POST",body:JSON.stringify({document:a})}),A=a=>k("/v1/workflows/format",{method:"POST",body:JSON.stringify({document:a})}),ae=(a,u)=>k("/v1/workflows/phase-grants",{method:"POST",body:JSON.stringify({document:a,phaseIndex:u})}),te=(a,u,p)=>k("/v1/workflows/save",{method:"POST",body:JSON.stringify({document:a,scope:u,force:p})}),ne=(a,u)=>{const p=u?`?root=${encodeURIComponent(u)}`:"";return k(`/v1/workflows/${encodeURIComponent(a)}/start${p}`,{method:"POST",body:JSON.stringify({confirm:!0})})},oe=a=>{const u=a?`?root=${encodeURIComponent(a)}`:"";return k(`/v1/workflows/stop${u}`,{method:"POST",body:JSON.stringify({})})},H=a=>k("/v1/workflow-drafts/review",{method:"POST",body:JSON.stringify({json:a})}),z=()=>({name:"phase-1",gate:"agent",permissions:[]}),K=a=>JSON.parse(JSON.stringify(a)),le=["agent","user","check"],re=["allow","ask","deny"],ie=["project","global"];function U(a){return`${a.action} ${a.permission}${a.pattern?` ${a.pattern}`:""}`}function ue({available:a,draftsAvailable:u,live:p,rootID:O,activeWorkflow:y,agents:W,busy:N}){const[d,l]=c.useState([]),[m,S]=c.useState(!1),[C,r]=c.useState(""),[x,P]=c.useState(null),[h,D]=c.useState(null),[w,$]=c.useState(""),E=async()=>{if(a){S(!0),r("");try{const n=await Z();l(n.workflows||[])}catch(n){r(n.message)}finally{S(!1)}}};if(c.useEffect(()=>{E()},[a]),!a)return e.jsxs("section",{className:"unavailable",role:"status",children:[e.jsx("strong",{children:"Workflows unavailable"}),e.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})]});const T=async()=>{try{const n=await se("my-workflow");P({doc:n,scope:"project",creating:!0})}catch(n){window.alert(n.message)}},q=async n=>{try{const j=await ee(n),v=d.find(J=>J.name===n),R=(v==null?void 0:v.source)==="global"?"global":"project";P({doc:K(j),scope:R,creating:!1})}catch(j){window.alert(j.message)}},g=async()=>{if(!(!p||N))try{await oe(O),$("Workflow stopped (session history kept).")}catch(n){window.alert(n.message)}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"workflow-head",children:[e.jsx("h2",{children:"Workflows"}),e.jsxs("div",{className:"workflow-actions",children:[e.jsx("button",{type:"button",onClick:()=>void E(),disabled:m,children:"Refresh"}),e.jsx("button",{type:"button",onClick:()=>void T(),children:"New"}),p&&e.jsx("button",{type:"button",onClick:()=>void g(),disabled:N||!y,children:"Stop"})]})]}),y&&e.jsxs("p",{className:"workflow-active",role:"status",children:["Active: ",e.jsx("strong",{children:y})]}),w&&e.jsx("p",{className:"muted",role:"status",children:w}),C&&e.jsxs("section",{className:"unavailable",role:"alert",children:[e.jsx("strong",{children:"Unable to load"}),e.jsx("p",{children:C})]}),m&&!d.length?e.jsx("p",{className:"muted",children:"Loading catalog…"}):null,!m&&!d.length&&!C?e.jsx("p",{className:"muted",children:"No workflows loaded."}):null,e.jsx("div",{className:"workflow-list",children:d.map(n=>{var j,v,R,J,i;return e.jsxs("article",{className:`workflow-card ${n.valid?"":"invalid"}`,children:[e.jsxs("header",{children:[e.jsx("h3",{children:n.name}),e.jsxs("small",{children:[n.source||"unknown"," · ",((j=n.phases)==null?void 0:j.length)||0," phase(s)",n.valid?"":" · invalid"]})]}),n.description&&e.jsx("p",{children:n.description}),!n.valid&&n.validationError&&e.jsx("p",{className:"workflow-error",role:"status",children:n.validationError}),(J=(R=(v=n.phases)==null?void 0:v[0])==null?void 0:R.permissions)!=null&&J.length?e.jsxs("p",{className:"workflow-grants",children:[e.jsx("span",{children:"Phase 0 grants"}),n.phases[0].permissions.map((b,G)=>e.jsx("code",{children:U(b)},G))]}):null,e.jsxs("div",{className:"workflow-card-actions",children:[e.jsx("button",{type:"button",onClick:()=>void q(n.name),children:"Edit"}),e.jsx("button",{type:"button",disabled:!p||N||!n.valid||!((i=n.phases)!=null&&i.length),title:n.valid?void 0:"Invalid workflows cannot be activated",onClick:()=>D(n),children:"Start"})]})]},n.name)})}),x&&e.jsx(de,{initial:x.doc,scope:x.scope,creating:x.creating,agents:W,draftsAvailable:u,onClose:()=>P(null),onSaved:async n=>{P(null),$(`Saved ${n} (not activated).`),await E()}}),h&&e.jsx(ce,{summary:h,rootID:O,onClose:()=>D(null),onStarted:()=>{$(`Starting ${h.name}…`),D(null)}})]})}function ce({summary:a,rootID:u,onClose:p,onStarted:O}){var S,C;const y=c.useRef(null),[W,N]=c.useState(!1);c.useEffect(()=>{var r;(r=y.current)==null||r.showModal()},[]);const d=(S=a.phases)==null?void 0:S[0],l=(d==null?void 0:d.permissions)||[],m=async()=>{N(!0);try{await ne(a.name,u),O()}catch(r){window.alert(r.message),N(!1)}};return e.jsxs("dialog",{ref:y,className:"workflow-dialog","aria-labelledby":"wf-start-title",onClose:p,onCancel:r=>{r.preventDefault(),p()},children:[e.jsx("div",{className:"dialog-rule"}),e.jsxs("h2",{id:"wf-start-title",children:["Start ",a.name]}),e.jsxs("p",{className:"muted",children:["source ",a.source||"unknown"," · ",((C=a.phases)==null?void 0:C.length)||0," phase(s)"]}),a.description&&e.jsx("p",{children:a.description}),e.jsxs("section",{className:"workflow-review","aria-label":"Phase 0 grant review",children:[e.jsx("h3",{children:"Phase 0 grant review"}),e.jsx("p",{children:d?e.jsxs(e.Fragment,{children:[d.name,d.agent?` @${d.agent}`:""," · gate ",d.gate||"agent",d.gateCommand?` \`${d.gateCommand}\``:""]}):"No phases"}),l.length?e.jsx("ul",{children:l.map((r,x)=>e.jsx("li",{children:e.jsx("code",{children:U(r)})},x))}):e.jsx("p",{className:"muted",children:"No phase permission overrides."}),e.jsx("p",{className:"workflow-warn",children:"Starting applies phase permissions and may pin the phase agent. Session history is kept. Confirm only after reviewing grants."})]}),e.jsxs("div",{className:"dialog-actions",children:[e.jsx("button",{type:"button",onClick:p,disabled:W,children:"Cancel"}),e.jsx("button",{type:"button",autoFocus:!0,disabled:W||!a.valid,onClick:()=>void m(),children:"Confirm start"})]})]})}function de({initial:a,scope:u,creating:p,agents:O,draftsAvailable:y,onClose:W,onSaved:N}){var L;const d=c.useRef(null),[l,m]=c.useState(()=>K(a)),[S,C]=c.useState(u),[r,x]=c.useState(0),[P,h]=c.useState(""),[D,w]=c.useState(!1),[$,E]=c.useState(""),[T,q]=c.useState([]),[g,n]=c.useState(null),[j,v]=c.useState(!1),R=c.useMemo(()=>JSON.stringify(a),[a]),J=JSON.stringify(l)!==R;c.useEffect(()=>{var s;(s=d.current)==null||s.showModal()},[]);const i=l.phases[r]||z(),b=s=>{m(t=>{const o=t.phases.slice();return o[r]=s,{...t,phases:o}})},G=async()=>{try{const s=await _(l);s.ok?(h("Valid"),w(!1)):(h(s.error||"Invalid"),w(!0))}catch(s){h(s.message),w(!0)}},Q=async()=>{try{const[s,t]=await Promise.all([A(l),ae(l,r)]);if(E(s.json),q(t.grants||[]),y){const o=await H(s.json);n(o),o.valid?o.hasWidening||o.hasChecks?(h(o.hasWidening?"Review widening grants before save":"Review executable checks before save"),w(!1)):(h("Preview ready"),w(!1)):(h(o.validationError||"Draft invalid"),w(!0))}else n(null),h("Preview ready"),w(!1)}catch(s){h(s.message),w(!0)}},B=async s=>{v(!0);try{const t=await _(l);if(!t.ok){h(t.error||"Cannot save invalid workflow"),w(!0),v(!1);return}if(y){const f=await A(l),I=await H(f.json);if(n(I),E(f.json),!I.valid){h(I.validationError||"Cannot save invalid draft"),w(!0),v(!1);return}}(await te(l,S,s)).activated&&window.alert("Unexpected: save reported activation. Workflow was not started by the client."),await N(l.name)}catch(t){const o=t.message;if(!s&&/already exists/i.test(o)&&window.confirm(`${o}
Overwrite existing file?`)){v(!1),await B(!0);return}h(o),w(!0)}finally{v(!1)}},M=()=>{J&&!window.confirm("Discard unsaved workflow edits?")||W()},X=()=>{m(s=>({...s,phases:[...s.phases,{...z(),name:`phase-${s.phases.length+1}`}]})),x(l.phases.length)},Y=()=>{l.phases.length<=1||(m(s=>{const t=s.phases.filter((o,f)=>f!==r);return{...s,phases:t}}),x(s=>Math.max(0,Math.min(s,l.phases.length-2))))},F=s=>{const t=r+s;t<0||t>=l.phases.length||(m(o=>{const f=o.phases.slice();return[f[r],f[t]]=[f[t],f[r]],{...o,phases:f}}),x(t))},V=(s,t)=>{const o=(i.permissions||[]).slice();o[s]={...o[s],...t},b({...i,permissions:o})};return e.jsxs("dialog",{ref:d,className:"workflow-dialog wide","aria-labelledby":"wf-builder-title",onClose:M,onCancel:s=>{s.preventDefault(),M()},children:[e.jsx("div",{className:"dialog-rule"}),e.jsx("h2",{id:"wf-builder-title",children:p?"New workflow":`Edit ${a.name}`}),e.jsxs("form",{className:"workflow-builder",onSubmit:s=>{s.preventDefault(),B(!1)},children:[e.jsxs("fieldset",{className:"workflow-meta",children:[e.jsx("legend",{children:"Document"}),e.jsxs("label",{children:["Name",e.jsx("input",{"aria-label":"Workflow name",value:l.name,disabled:!p,onChange:s=>m({...l,name:s.target.value})})]}),e.jsxs("label",{children:["Description",e.jsx("input",{"aria-label":"Workflow description",value:l.description||"",onChange:s=>m({...l,description:s.target.value})})]}),e.jsxs("label",{children:["Scope",e.jsx("select",{"aria-label":"Save scope",value:S,onChange:s=>C(s.target.value),children:ie.map(s=>e.jsx("option",{value:s,children:s},s))})]})]}),e.jsxs("div",{className:"workflow-phases",role:"list","aria-label":"Phases",children:[l.phases.map((s,t)=>e.jsxs("button",{type:"button",role:"listitem",className:t===r?"active":"",onClick:()=>x(t),children:[t,". ",s.name||"(unnamed)"]},`${s.name}-${t}`)),e.jsxs("div",{className:"workflow-phase-tools",children:[e.jsx("button",{type:"button",onClick:X,children:"+ Phase"}),e.jsx("button",{type:"button",onClick:Y,disabled:l.phases.length<=1,children:"Remove"}),e.jsx("button",{type:"button",onClick:()=>F(-1),disabled:r===0,children:"↑"}),e.jsx("button",{type:"button",onClick:()=>F(1),disabled:r>=l.phases.length-1,children:"↓"})]})]}),e.jsxs("fieldset",{className:"workflow-phase-fields",children:[e.jsxs("legend",{children:["Phase ",r]}),e.jsxs("label",{children:["Name",e.jsx("input",{"aria-label":"Phase name",value:i.name,onChange:s=>b({...i,name:s.target.value})})]}),e.jsxs("label",{children:["Description",e.jsx("input",{"aria-label":"Phase description",value:i.description||"",onChange:s=>b({...i,description:s.target.value})})]}),e.jsxs("label",{children:["Agent",e.jsxs("select",{"aria-label":"Phase agent",value:i.agent||"",onChange:s=>b({...i,agent:s.target.value}),children:[e.jsx("option",{value:"",children:"(default)"}),O.map(s=>e.jsx("option",{value:s,children:s},s))]})]}),e.jsxs("label",{children:["Gate",e.jsx("select",{"aria-label":"Phase gate",value:i.gate||"agent",onChange:s=>b({...i,gate:s.target.value}),children:le.map(s=>e.jsx("option",{value:s,children:s},s))})]}),(i.gate||"agent")==="check"&&e.jsxs("label",{children:["Check command",e.jsx("input",{"aria-label":"Gate check command",value:i.gateCommand||"",onChange:s=>b({...i,gateCommand:s.target.value}),placeholder:"make test"})]}),e.jsxs("label",{children:["Context",e.jsx("textarea",{"aria-label":"Phase context",value:i.context||"",onChange:s=>b({...i,context:s.target.value}),rows:3})]})]}),e.jsxs("fieldset",{className:"workflow-perms",children:[e.jsx("legend",{children:"Permissions (phase grants)"}),(i.permissions||[]).map((s,t)=>e.jsxs("div",{className:"perm-row",children:[e.jsx("input",{"aria-label":`Permission name ${t+1}`,value:s.permission,onChange:o=>V(t,{permission:o.target.value}),placeholder:"bash"}),e.jsx("input",{"aria-label":`Permission pattern ${t+1}`,value:s.pattern||"",onChange:o=>V(t,{pattern:o.target.value}),placeholder:"*"}),e.jsx("select",{"aria-label":`Permission action ${t+1}`,value:s.action,onChange:o=>V(t,{action:o.target.value}),children:re.map(o=>e.jsx("option",{value:o,children:o},o))}),e.jsx("button",{type:"button","aria-label":`Remove permission ${t+1}`,onClick:()=>b({...i,permissions:(i.permissions||[]).filter((o,f)=>f!==t)}),children:"×"})]},t)),e.jsx("button",{type:"button",onClick:()=>b({...i,permissions:[...i.permissions||[],{permission:"bash",pattern:"*",action:"ask"}]}),children:"+ Grant"})]}),($||g||T.length>0)&&e.jsxs("section",{className:"workflow-review","aria-label":"Validation and grant preview",children:[e.jsx("h3",{children:"Review"}),T.length>0&&e.jsxs("p",{className:"workflow-grants",children:[e.jsxs("span",{children:["Phase ",r," grants"]}),T.map((s,t)=>e.jsx("code",{children:U(s)},t))]}),(g==null?void 0:g.hasChecks)&&e.jsx("p",{className:"workflow-warn",children:"Executable check gates require review before save."}),(g==null?void 0:g.hasWidening)&&e.jsx("p",{className:"workflow-warn",children:"Permission widening vs baseline — review carefully."}),(L=g==null?void 0:g.phases)==null?void 0:L.map((s,t)=>{var o;return e.jsxs("div",{className:"workflow-review-phase",children:[e.jsx("strong",{children:s.name}),s.checkHighlighted&&s.gateCommand&&e.jsx("code",{className:"check-cmd",children:s.gateCommand}),(o=s.widening)!=null&&o.length?e.jsx("ul",{children:s.widening.map((f,I)=>e.jsxs("li",{children:[e.jsx("code",{children:U(f)})," (widening)"]},I))}):null]},t)}),$&&e.jsx("pre",{className:"workflow-json","aria-label":"Canonical JSON preview",children:$})]}),P&&e.jsx("p",{className:D?"workflow-error":"muted",role:"status",children:P}),e.jsx("p",{className:"muted",children:"Save writes the workflow file only — it never starts the workflow."}),e.jsxs("div",{className:"dialog-actions",children:[e.jsx("button",{type:"button",onClick:M,disabled:j,children:"Cancel"}),e.jsx("button",{type:"button",onClick:()=>void G(),disabled:j,children:"Validate"}),e.jsx("button",{type:"button",onClick:()=>void Q(),disabled:j,children:"Preview / review"}),e.jsx("button",{type:"submit",disabled:j,children:"Save"})]})]})]})}export{ue as WorkflowsPanel};
diff --git a/internal/frontend/server/static/assets/index-BIBviZkd.js b/internal/frontend/server/static/assets/index-BIBviZkd.js
new file mode 100644
index 00000000..80e26b21
--- /dev/null
+++ b/internal/frontend/server/static/assets/index-BIBviZkd.js
@@ -0,0 +1,95 @@
+const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Plugins-CzG6Imkp.js","assets/panesApi-1q1G3asp.js","assets/PaneView-CsX17cLJ.js","assets/Panes-cnXdgOPa.js"])))=>i.map(i=>d[i]);
+var pg=Object.defineProperty;var yg=(a,u,r)=>u in a?pg(a,u,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[u]=r;var uo=(a,u,r)=>yg(a,typeof u!="symbol"?u+"":u,r);(function(){const u=document.createElement("link").relList;if(u&&u.supports&&u.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))o(d);new MutationObserver(d=>{for(const h of d)if(h.type==="childList")for(const y of h.addedNodes)y.tagName==="LINK"&&y.rel==="modulepreload"&&o(y)}).observe(document,{childList:!0,subtree:!0});function r(d){const h={};return d.integrity&&(h.integrity=d.integrity),d.referrerPolicy&&(h.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?h.credentials="include":d.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function o(d){if(d.ep)return;d.ep=!0;const h=r(d);fetch(d.href,h)}})();function ep(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var co={exports:{}},As={};/**
+ * @license React
+ * react-jsx-runtime.production.js
+ *
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var fm;function gg(){if(fm)return As;fm=1;var a=Symbol.for("react.transitional.element"),u=Symbol.for("react.fragment");function r(o,d,h){var y=null;if(h!==void 0&&(y=""+h),d.key!==void 0&&(y=""+d.key),"key"in d){h={};for(var b in d)b!=="key"&&(h[b]=d[b])}else h=d;return d=h.ref,{$$typeof:a,type:o,key:y,ref:d!==void 0?d:null,props:h}}return As.Fragment=u,As.jsx=r,As.jsxs=r,As}var dm;function vg(){return dm||(dm=1,co.exports=gg()),co.exports}var c=vg(),ro={exports:{}},ve={};/**
+ * @license React
+ * react.production.js
+ *
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var hm;function bg(){if(hm)return ve;hm=1;var a=Symbol.for("react.transitional.element"),u=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),y=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),C=Symbol.for("react.activity"),O=Symbol.iterator;function $(S){return S===null||typeof S!="object"?null:(S=O&&S[O]||S["@@iterator"],typeof S=="function"?S:null)}var Q={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},le=Object.assign,ye={};function ee(S,R,X){this.props=S,this.context=R,this.refs=ye,this.updater=X||Q}ee.prototype.isReactComponent={},ee.prototype.setState=function(S,R){if(typeof S!="object"&&typeof S!="function"&&S!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,S,R,"setState")},ee.prototype.forceUpdate=function(S){this.updater.enqueueForceUpdate(this,S,"forceUpdate")};function B(){}B.prototype=ee.prototype;function _(S,R,X){this.props=S,this.context=R,this.refs=ye,this.updater=X||Q}var pe=_.prototype=new B;pe.constructor=_,le(pe,ee.prototype),pe.isPureReactComponent=!0;var W=Array.isArray;function me(){}var P={H:null,A:null,T:null,S:null},J=Object.prototype.hasOwnProperty;function se(S,R,X){var V=X.ref;return{$$typeof:a,type:S,key:R,ref:V!==void 0?V:null,props:X}}function ue(S,R){return se(S.type,R,S.props)}function ie(S){return typeof S=="object"&&S!==null&&S.$$typeof===a}function Se(S){var R={"=":"=0",":":"=2"};return"$"+S.replace(/[=:]/g,function(X){return R[X]})}var Ge=/\/+/g;function St(S,R){return typeof S=="object"&&S!==null&&S.key!=null?Se(""+S.key):R.toString(36)}function st(S){switch(S.status){case"fulfilled":return S.value;case"rejected":throw S.reason;default:switch(typeof S.status=="string"?S.then(me,me):(S.status="pending",S.then(function(R){S.status==="pending"&&(S.status="fulfilled",S.value=R)},function(R){S.status==="pending"&&(S.status="rejected",S.reason=R)})),S.status){case"fulfilled":return S.value;case"rejected":throw S.reason}}throw S}function U(S,R,X,V,de){var ge=typeof S;(ge==="undefined"||ge==="boolean")&&(S=null);var Ee=!1;if(S===null)Ee=!0;else switch(ge){case"bigint":case"string":case"number":Ee=!0;break;case"object":switch(S.$$typeof){case a:case u:Ee=!0;break;case z:return Ee=S._init,U(Ee(S._payload),R,X,V,de)}}if(Ee)return de=de(S),Ee=V===""?"."+St(S,0):V,W(de)?(X="",Ee!=null&&(X=Ee.replace(Ge,"$&/")+"/"),U(de,R,X,"",function(sl){return sl})):de!=null&&(ie(de)&&(de=ue(de,X+(de.key==null||S&&S.key===de.key?"":(""+de.key).replace(Ge,"$&/")+"/")+Ee)),R.push(de)),1;Ee=0;var ut=V===""?".":V+":";if(W(S))for(var ze=0;ze>>1,fe=U[te];if(0>>1;ted(X,I))Vd(de,X)?(U[te]=de,U[V]=I,te=V):(U[te]=X,U[R]=I,te=R);else if(Vd(de,I))U[te]=de,U[V]=I,te=V;else break e}}return K}function d(U,K){var I=U.sortIndex-K.sortIndex;return I!==0?I:U.id-K.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;a.unstable_now=function(){return h.now()}}else{var y=Date,b=y.now();a.unstable_now=function(){return y.now()-b}}var v=[],g=[],z=1,C=null,O=3,$=!1,Q=!1,le=!1,ye=!1,ee=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function pe(U){for(var K=r(g);K!==null;){if(K.callback===null)o(g);else if(K.startTime<=U)o(g),K.sortIndex=K.expirationTime,u(v,K);else break;K=r(g)}}function W(U){if(le=!1,pe(U),!Q)if(r(v)!==null)Q=!0,me||(me=!0,Se());else{var K=r(g);K!==null&&st(W,K.startTime-U)}}var me=!1,P=-1,J=5,se=-1;function ue(){return ye?!0:!(a.unstable_now()-seU&&ue());){var te=C.callback;if(typeof te=="function"){C.callback=null,O=C.priorityLevel;var fe=te(C.expirationTime<=U);if(U=a.unstable_now(),typeof fe=="function"){C.callback=fe,pe(U),K=!0;break t}C===r(v)&&o(v),pe(U)}else o(v);C=r(v)}if(C!==null)K=!0;else{var S=r(g);S!==null&&st(W,S.startTime-U),K=!1}}break e}finally{C=null,O=I,$=!1}K=void 0}}finally{K?Se():me=!1}}}var Se;if(typeof _=="function")Se=function(){_(ie)};else if(typeof MessageChannel<"u"){var Ge=new MessageChannel,St=Ge.port2;Ge.port1.onmessage=ie,Se=function(){St.postMessage(null)}}else Se=function(){ee(ie,0)};function st(U,K){P=ee(function(){U(a.unstable_now())},K)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(U){U.callback=null},a.unstable_forceFrameRate=function(U){0>U||125te?(U.sortIndex=I,u(g,U),r(v)===null&&U===r(g)&&(le?(B(P),P=-1):le=!0,st(W,I-te))):(U.sortIndex=fe,u(v,U),Q||$||(Q=!0,me||(me=!0,Se()))),U},a.unstable_shouldYield=ue,a.unstable_wrapCallback=function(U){var K=O;return function(){var I=O;O=K;try{return U.apply(this,arguments)}finally{O=I}}}})(ho)),ho}var ym;function jg(){return ym||(ym=1,fo.exports=Sg()),fo.exports}var mo={exports:{}},Ut={};/**
+ * @license React
+ * react-dom.production.js
+ *
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var gm;function Tg(){if(gm)return Ut;gm=1;var a=Uo();function u(v){var g="https://react.dev/errors/"+v;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(u){console.error(u)}}return a(),mo.exports=Tg(),mo.exports}/**
+ * @license React
+ * react-dom-client.production.js
+ *
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var bm;function Ag(){if(bm)return Cs;bm=1;var a=jg(),u=Uo(),r=Eg();function o(e){var t="https://react.dev/errors/"+e;if(1fe||(e.current=te[fe],te[fe]=null,fe--)}function X(e,t){fe++,te[fe]=e.current,e.current=t}var V=S(null),de=S(null),ge=S(null),Ee=S(null);function ut(e,t){switch(X(ge,t),X(de,e),X(V,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?kh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=kh(t),e=Uh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}R(V),X(V,e)}function ze(){R(V),R(de),R(ge)}function sl(e){e.memoizedState!==null&&X(Ee,e);var t=V.current,n=Uh(t,e.type);t!==n&&(X(de,e),X(V,n))}function en(e){de.current===e&&(R(V),R(de)),Ee.current===e&&(R(Ee),Ss._currentValue=I)}var Rt,Hn;function Mn(e){if(Rt===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Rt=t&&t[1]||"",Hn=-1)":-1i||x[l]!==M[i]){var q=`
+`+x[l].replace(" at new "," at ");return e.displayName&&q.includes("")&&(q=q.replace("",e.displayName)),q}while(1<=l&&0<=i);break}}}finally{Yn=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Mn(n):""}function Li(e,t){switch(e.tag){case 26:case 27:case 5:return Mn(e.type);case 16:return Mn("Lazy");case 13:return e.child!==t&&t!==null?Mn("Suspense Fallback"):Mn("Suspense");case 19:return Mn("SuspenseList");case 0:case 15:return pn(e.type,!1);case 11:return pn(e.type.render,!1);case 1:return pn(e.type,!0);case 31:return Mn("Activity");default:return""}}function Gn(e){try{var t="",n=null;do t+=Li(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
+Error generating stack: `+l.message+`
+`+l.stack}}var Ul=Object.prototype.hasOwnProperty,Lt=a.unstable_scheduleCallback,ul=a.unstable_cancelCallback,qt=a.unstable_shouldYield,wn=a.unstable_requestPaint,gt=a.unstable_now,Rl=a.unstable_getCurrentPriorityLevel,$n=a.unstable_ImmediatePriority,Bt=a.unstable_UserBlockingPriority,_n=a.unstable_NormalPriority,vt=a.unstable_LowPriority,tn=a.unstable_IdlePriority,cl=a.log,Xn=a.unstable_setDisableYieldValue,yn=null,Je=null;function Ht(e){if(typeof cl=="function"&&Xn(e),Je&&typeof Je.setStrictMode=="function")try{Je.setStrictMode(yn,e)}catch{}}var We=Math.clz32?Math.clz32:Ja,gn=Math.log,kn=Math.LN2;function Ja(e){return e>>>=0,e===0?32:31-(gn(e)/kn|0)|0}var $t=256,Kn=262144,vn=4194304;function bn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Qn(e,t,n){var l=e.pendingLanes;if(l===0)return 0;var i=0,s=e.suspendedLanes,f=e.pingedLanes;e=e.warmLanes;var m=l&134217727;return m!==0?(l=m&~s,l!==0?i=bn(l):(f&=m,f!==0?i=bn(f):n||(n=m&~e,n!==0&&(i=bn(n))))):(m=l&~s,m!==0?i=bn(m):f!==0?i=bn(f):n||(n=l&~e,n!==0&&(i=bn(n)))),i===0?0:t!==0&&t!==i&&(t&s)===0&&(s=i&-i,n=t&-t,s>=n||s===32&&(n&4194048)!==0)?t:i}function xn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Wa(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ja(){var e=vn;return vn<<=1,(vn&62914560)===0&&(vn=4194304),e}function Vn(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function nn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Zn(e,t,n,l,i,s){var f=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var m=e.entanglements,x=e.expirationTimes,M=e.hiddenUpdates;for(n=f&~n;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Vt=/[\n"\\]/g;function wt(e){return e.replace(Vt,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Yl(e,t,n,l,i,s,f,m){e.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.type=f:e.removeAttribute("type"),t!=null?f==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Pe(t)):e.value!==""+Pe(t)&&(e.value=""+Pe(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?Aa(e,f,Pe(t)):n!=null?Aa(e,f,Pe(n)):l!=null&&e.removeAttribute("value"),i==null&&s!=null&&(e.defaultChecked=!!s),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"?e.name=""+Pe(m):e.removeAttribute("name")}function Rs(e,t,n,l,i,s,f,m){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.type=s),t!=null||n!=null){if(!(s!=="submit"&&s!=="reset"||t!=null)){G(e);return}n=n!=null?""+Pe(n):"",t=t!=null?""+Pe(t):n,m||t===e.value||(e.value=t),e.defaultValue=t}l=l??i,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=m?e.checked:!!l,e.defaultChecked=!!l,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),G(e)}function Aa(e,t,n){t==="number"&&pt(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Gl(e,t,n,l){if(e=e.options,t){t={};for(var i=0;i"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Bi=!1;if(an)try{var ml={};Object.defineProperty(ml,"passive",{get:function(){Bi=!0}}),window.addEventListener("test",ml,ml),window.removeEventListener("test",ml,ml)}catch{Bi=!1}var Pn=null,el=null,Zl=null;function Jl(){if(Zl)return Zl;var e,t=el,n=t.length,l,i="value"in Pn?Pn.value:Pn.textContent,s=i.length;for(e=0;e=Gi),Ho=" ",Yo=!1;function Go(e,t){switch(e){case"keyup":return Lp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $o(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ai=!1;function Bp(e,t){switch(e){case"compositionend":return $o(t);case"keypress":return t.which!==32?null:(Yo=!0,Ho);case"textInput":return e=t.data,e===Ho&&Yo?null:e;default:return null}}function Hp(e,t){if(ai)return e==="compositionend"||!hc&&Go(e,t)?(e=Jl(),Zl=el=Pn=null,ai=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=l}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Fo(n)}}function Po(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Po(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ef(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=pt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=pt(e.document)}return t}function yc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Zp=an&&"documentMode"in document&&11>=document.documentMode,ii=null,gc=null,Qi=null,vc=!1;function tf(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;vc||ii==null||ii!==pt(l)||(l=ii,"selectionStart"in l&&yc(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Qi&&Ki(Qi,l)||(Qi=l,l=Lu(gc,"onSelect"),0>=f,i-=f,nl=1<<32-We(t)+i|n<xe?(Ne=ae,ae=null):Ne=ae.sibling;var we=w(N,ae,D[xe],H);if(we===null){ae===null&&(ae=Ne);break}e&&ae&&we.alternate===null&&t(N,ae),A=s(we,A,xe),Me===null?ce=we:Me.sibling=we,Me=we,ae=Ne}if(xe===D.length)return n(N,ae),Oe&&xl(N,xe),ce;if(ae===null){for(;xexe?(Ne=ae,ae=null):Ne=ae.sibling;var ba=w(N,ae,we.value,H);if(ba===null){ae===null&&(ae=Ne);break}e&&ae&&ba.alternate===null&&t(N,ae),A=s(ba,A,xe),Me===null?ce=ba:Me.sibling=ba,Me=ba,ae=Ne}if(we.done)return n(N,ae),Oe&&xl(N,xe),ce;if(ae===null){for(;!we.done;xe++,we=D.next())we=Y(N,we.value,H),we!==null&&(A=s(we,A,xe),Me===null?ce=we:Me.sibling=we,Me=we);return Oe&&xl(N,xe),ce}for(ae=l(ae);!we.done;xe++,we=D.next())we=k(ae,N,xe,we.value,H),we!==null&&(e&&we.alternate!==null&&ae.delete(we.key===null?xe:we.key),A=s(we,A,xe),Me===null?ce=we:Me.sibling=we,Me=we);return e&&ae.forEach(function(mg){return t(N,mg)}),Oe&&xl(N,xe),ce}function He(N,A,D,H){if(typeof D=="object"&&D!==null&&D.type===le&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case $:e:{for(var ce=D.key;A!==null;){if(A.key===ce){if(ce=D.type,ce===le){if(A.tag===7){n(N,A.sibling),H=i(A,D.props.children),H.return=N,N=H;break e}}else if(A.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===J&&qa(ce)===A.type){n(N,A.sibling),H=i(A,D.props),Ii(H,D),H.return=N,N=H;break e}n(N,A);break}else t(N,A);A=A.sibling}D.type===le?(H=_a(D.props.children,N.mode,H,D.key),H.return=N,N=H):(H=eu(D.type,D.key,D.props,null,N.mode,H),Ii(H,D),H.return=N,N=H)}return f(N);case Q:e:{for(ce=D.key;A!==null;){if(A.key===ce)if(A.tag===4&&A.stateNode.containerInfo===D.containerInfo&&A.stateNode.implementation===D.implementation){n(N,A.sibling),H=i(A,D.children||[]),H.return=N,N=H;break e}else{n(N,A);break}else t(N,A);A=A.sibling}H=Ac(D,N.mode,H),H.return=N,N=H}return f(N);case J:return D=qa(D),He(N,A,D,H)}if(st(D))return ne(N,A,D,H);if(Se(D)){if(ce=Se(D),typeof ce!="function")throw Error(o(150));return D=ce.call(D),he(N,A,D,H)}if(typeof D.then=="function")return He(N,A,uu(D),H);if(D.$$typeof===_)return He(N,A,lu(N,D),H);cu(N,D)}return typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint"?(D=""+D,A!==null&&A.tag===6?(n(N,A.sibling),H=i(A,D),H.return=N,N=H):(n(N,A),H=Ec(D,N.mode,H),H.return=N,N=H),f(N)):n(N,A)}return function(N,A,D,H){try{Fi=0;var ce=He(N,A,D,H);return yi=null,ce}catch(ae){if(ae===pi||ae===iu)throw ae;var Me=cn(29,ae,null,N.mode);return Me.lanes=H,Me.return=N,Me}finally{}}}var Ha=Af(!0),Cf=Af(!1),na=!1;function Lc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function la(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function aa(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(ke&2)!==0){var i=l.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),l.pending=t,t=Ps(e),rf(e,null,n),t}return Is(e,l,t,n),Ps(e)}function Pi(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,ol(e,n)}}function Bc(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var f={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};s===null?i=s=f:s=s.next=f,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:l.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:l.shared,callbacks:l.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Hc=!1;function es(){if(Hc){var e=mi;if(e!==null)throw e}}function ts(e,t,n,l){Hc=!1;var i=e.updateQueue;na=!1;var s=i.firstBaseUpdate,f=i.lastBaseUpdate,m=i.shared.pending;if(m!==null){i.shared.pending=null;var x=m,M=x.next;x.next=null,f===null?s=M:f.next=M,f=x;var q=e.alternate;q!==null&&(q=q.updateQueue,m=q.lastBaseUpdate,m!==f&&(m===null?q.firstBaseUpdate=M:m.next=M,q.lastBaseUpdate=x))}if(s!==null){var Y=i.baseState;f=0,q=M=x=null,m=s;do{var w=m.lane&-536870913,k=w!==m.lane;if(k?(Ce&w)===w:(l&w)===w){w!==0&&w===hi&&(Hc=!0),q!==null&&(q=q.next={lane:0,tag:m.tag,payload:m.payload,callback:null,next:null});e:{var ne=e,he=m;w=t;var He=n;switch(he.tag){case 1:if(ne=he.payload,typeof ne=="function"){Y=ne.call(He,Y,w);break e}Y=ne;break e;case 3:ne.flags=ne.flags&-65537|128;case 0:if(ne=he.payload,w=typeof ne=="function"?ne.call(He,Y,w):ne,w==null)break e;Y=C({},Y,w);break e;case 2:na=!0}}w=m.callback,w!==null&&(e.flags|=64,k&&(e.flags|=8192),k=i.callbacks,k===null?i.callbacks=[w]:k.push(w))}else k={lane:w,tag:m.tag,payload:m.payload,callback:m.callback,next:null},q===null?(M=q=k,x=Y):q=q.next=k,f|=w;if(m=m.next,m===null){if(m=i.shared.pending,m===null)break;k=m,m=k.next,k.next=null,i.lastBaseUpdate=k,i.shared.pending=null}}while(!0);q===null&&(x=Y),i.baseState=x,i.firstBaseUpdate=M,i.lastBaseUpdate=q,s===null&&(i.shared.lanes=0),ra|=f,e.lanes=f,e.memoizedState=Y}}function Nf(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Of(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;es?s:8;var f=U.T,m={};U.T=m,ir(e,!1,t,n);try{var x=i(),M=U.S;if(M!==null&&M(m,x),x!==null&&typeof x=="object"&&typeof x.then=="function"){var q=ly(x,l);as(e,t,q,hn(e))}else as(e,t,l,hn(e))}catch(Y){as(e,t,{then:function(){},status:"rejected",reason:Y},hn())}finally{K.p=s,f!==null&&m.types!==null&&(f.types=m.types),U.T=f}}function ry(){}function lr(e,t,n,l){if(e.tag!==5)throw Error(o(476));var i=sd(e).queue;id(e,i,t,I,n===null?ry:function(){return ud(e),n(l)})}function sd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:El,lastRenderedState:I},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:El,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ud(e){var t=sd(e);t.next===null&&(t=e.alternate.memoizedState),as(e,t.next.queue,{},hn())}function ar(){return Ct(Ss)}function cd(){return rt().memoizedState}function rd(){return rt().memoizedState}function oy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=hn();e=la(n);var l=aa(t,e,n);l!==null&&(It(l,t,n),Pi(l,t,n)),t={cache:_c()},e.payload=t;return}t=t.return}}function fy(e,t,n){var l=hn();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},vu(e)?fd(t,n):(n=jc(e,t,n,l),n!==null&&(It(n,e,l),dd(n,t,l)))}function od(e,t,n){var l=hn();as(e,t,n,l)}function as(e,t,n,l){var i={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(vu(e))fd(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var f=t.lastRenderedState,m=s(f,n);if(i.hasEagerState=!0,i.eagerState=m,un(m,f))return Is(e,t,i,0),Ye===null&&Fs(),!1}catch{}finally{}if(n=jc(e,t,i,l),n!==null)return It(n,e,l),dd(n,t,l),!0}return!1}function ir(e,t,n,l){if(l={lane:2,revertLane:Lr(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},vu(e)){if(t)throw Error(o(479))}else t=jc(e,n,l,2),t!==null&&It(t,e,2)}function vu(e){var t=e.alternate;return e===be||t!==null&&t===be}function fd(e,t){vi=fu=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function dd(e,t,n){if((n&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,ol(e,n)}}var is={readContext:Ct,use:mu,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt};is.useEffectEvent=lt;var hd={readContext:Ct,use:mu,useCallback:function(e,t){return Gt().memoizedState=[e,t===void 0?null:t],e},useContext:Ct,useEffect:Wf,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,yu(4194308,4,ed.bind(null,t,e),n)},useLayoutEffect:function(e,t){return yu(4194308,4,e,t)},useInsertionEffect:function(e,t){yu(4,2,e,t)},useMemo:function(e,t){var n=Gt();t=t===void 0?null:t;var l=e();if(Ya){Ht(!0);try{e()}finally{Ht(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=Gt();if(n!==void 0){var i=n(t);if(Ya){Ht(!0);try{n(t)}finally{Ht(!1)}}}else i=t;return l.memoizedState=l.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},l.queue=e,e=e.dispatch=fy.bind(null,be,e),[l.memoizedState,e]},useRef:function(e){var t=Gt();return e={current:e},t.memoizedState=e},useState:function(e){e=Ic(e);var t=e.queue,n=od.bind(null,be,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:tr,useDeferredValue:function(e,t){var n=Gt();return nr(n,e,t)},useTransition:function(){var e=Ic(!1);return e=id.bind(null,be,e.queue,!0,!1),Gt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=be,i=Gt();if(Oe){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),Ye===null)throw Error(o(349));(Ce&127)!==0||kf(l,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,Wf(Rf.bind(null,l,s,e),[e]),l.flags|=2048,xi(9,{destroy:void 0},Uf.bind(null,l,s,n,t),null),n},useId:function(){var e=Gt(),t=Ye.identifierPrefix;if(Oe){var n=ll,l=nl;n=(l&~(1<<32-We(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=du++,0<\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof l.is=="string"?f.createElement("select",{is:l.is}):f.createElement("select"),l.multiple?s.multiple=!0:l.size&&(s.size=l.size);break;default:s=typeof l.is=="string"?f.createElement(i,{is:l.is}):f.createElement(i)}}s[Fe]=t,s[tt]=l;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)s.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=s;e:switch(Ot(s,i,l),i){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Cl(t)}}return Ke(t),br(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Cl(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(o(166));if(e=ge.current,fi(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,i=At,i!==null)switch(i.tag){case 27:case 5:l=i.memoizedProps}e[Fe]=t,e=!!(e.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||wh(e.nodeValue,n)),e||ea(t,!0)}else e=qu(e).createTextNode(l),e[Fe]=t,t.stateNode=e}return Ke(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(l=fi(t),n!==null){if(e===null){if(!l)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Fe]=t}else ka(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ke(t),e=!1}else n=zc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(on(t),t):(on(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Ke(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=fi(t),l!==null&&l.dehydrated!==null){if(e===null){if(!i)throw Error(o(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(o(317));i[Fe]=t}else ka(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ke(t),i=!1}else i=zc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(on(t),t):(on(t),null)}return on(t),(t.flags&128)!==0?(t.lanes=n,t):(n=l!==null,e=e!==null&&e.memoizedState!==null,n&&(l=t.child,i=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(i=l.alternate.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==i&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Tu(t,t.updateQueue),Ke(t),null);case 4:return ze(),e===null&&Yr(t.stateNode.containerInfo),Ke(t),null;case 10:return jl(t.type),Ke(t),null;case 19:if(R(ct),l=t.memoizedState,l===null)return Ke(t),null;if(i=(t.flags&128)!==0,s=l.rendering,s===null)if(i)us(l,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(s=ou(e),s!==null){for(t.flags|=128,us(l,!1),e=s.updateQueue,t.updateQueue=e,Tu(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)of(n,e),n=n.sibling;return X(ct,ct.current&1|2),Oe&&xl(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&>()>Ou&&(t.flags|=128,i=!0,us(l,!1),t.lanes=4194304)}else{if(!i)if(e=ou(s),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Tu(t,e),us(l,!0),l.tail===null&&l.tailMode==="hidden"&&!s.alternate&&!Oe)return Ke(t),null}else 2*gt()-l.renderingStartTime>Ou&&n!==536870912&&(t.flags|=128,i=!0,us(l,!1),t.lanes=4194304);l.isBackwards?(s.sibling=t.child,t.child=s):(e=l.last,e!==null?e.sibling=s:t.child=s,l.last=s)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=gt(),e.sibling=null,n=ct.current,X(ct,i?n&1|2:n&1),Oe&&xl(t,l.treeForkCount),e):(Ke(t),null);case 22:case 23:return on(t),Gc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(n&536870912)!==0&&(t.flags&128)===0&&(Ke(t),t.subtreeFlags&6&&(t.flags|=8192)):Ke(t),n=t.updateQueue,n!==null&&Tu(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==n&&(t.flags|=2048),e!==null&&R(La),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),jl(ot),Ke(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function yy(e,t){switch(Nc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return jl(ot),ze(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return en(t),null;case 31:if(t.memoizedState!==null){if(on(t),t.alternate===null)throw Error(o(340));ka()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(on(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));ka()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return R(ct),null;case 4:return ze(),null;case 10:return jl(t.type),null;case 22:case 23:return on(t),Gc(),e!==null&&R(La),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return jl(ot),null;case 25:return null;default:return null}}function Ld(e,t){switch(Nc(t),t.tag){case 3:jl(ot),ze();break;case 26:case 27:case 5:en(t);break;case 4:ze();break;case 31:t.memoizedState!==null&&on(t);break;case 13:on(t);break;case 19:R(ct);break;case 10:jl(t.type);break;case 22:case 23:on(t),Gc(),e!==null&&R(La);break;case 24:jl(ot)}}function cs(e,t){try{var n=t.updateQueue,l=n!==null?n.lastEffect:null;if(l!==null){var i=l.next;n=i;do{if((n.tag&e)===e){l=void 0;var s=n.create,f=n.inst;l=s(),f.destroy=l}n=n.next}while(n!==i)}}catch(m){Le(t,t.return,m)}}function ua(e,t,n){try{var l=t.updateQueue,i=l!==null?l.lastEffect:null;if(i!==null){var s=i.next;l=s;do{if((l.tag&e)===e){var f=l.inst,m=f.destroy;if(m!==void 0){f.destroy=void 0,i=t;var x=n,M=m;try{M()}catch(q){Le(i,x,q)}}}l=l.next}while(l!==s)}}catch(q){Le(t,t.return,q)}}function qd(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Of(t,n)}catch(l){Le(e,e.return,l)}}}function Bd(e,t,n){n.props=Ga(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){Le(e,t,l)}}function rs(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof n=="function"?e.refCleanup=n(l):n.current=l}}catch(i){Le(e,t,i)}}function al(e,t){var n=e.ref,l=e.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(i){Le(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(i){Le(e,t,i)}else n.current=null}function Hd(e){var t=e.type,n=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&l.focus();break e;case"img":n.src?l.src=n.src:n.srcSet&&(l.srcset=n.srcSet)}}catch(i){Le(e,e.return,i)}}function xr(e,t,n){try{var l=e.stateNode;qy(l,e.type,n,t),l[tt]=t}catch(i){Le(e,e.return,i)}}function Yd(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ma(e.type)||e.tag===4}function Sr(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Yd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ma(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function jr(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ve));else if(l!==4&&(l===27&&ma(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(jr(e,t,n),e=e.sibling;e!==null;)jr(e,t,n),e=e.sibling}function Eu(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(l!==4&&(l===27&&ma(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Eu(e,t,n),e=e.sibling;e!==null;)Eu(e,t,n),e=e.sibling}function Gd(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Ot(t,l,n),t[Fe]=e,t[tt]=n}catch(s){Le(e,e.return,s)}}var Nl=!1,ht=!1,Tr=!1,$d=typeof WeakSet=="function"?WeakSet:Set,bt=null;function gy(e,t){if(e=e.containerInfo,Xr=Ku,e=ef(e),yc(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var l=n.getSelection&&n.getSelection();if(l&&l.rangeCount!==0){n=l.anchorNode;var i=l.anchorOffset,s=l.focusNode;l=l.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var f=0,m=-1,x=-1,M=0,q=0,Y=e,w=null;t:for(;;){for(var k;Y!==n||i!==0&&Y.nodeType!==3||(m=f+i),Y!==s||l!==0&&Y.nodeType!==3||(x=f+l),Y.nodeType===3&&(f+=Y.nodeValue.length),(k=Y.firstChild)!==null;)w=Y,Y=k;for(;;){if(Y===e)break t;if(w===n&&++M===i&&(m=f),w===s&&++q===l&&(x=f),(k=Y.nextSibling)!==null)break;Y=w,w=Y.parentNode}Y=k}n=m===-1||x===-1?null:{start:m,end:x}}else n=null}n=n||{start:0,end:0}}else n=null;for(Kr={focusedElem:e,selectionRange:n},Ku=!1,bt=t;bt!==null;)if(t=bt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,bt=e;else for(;bt!==null;){switch(t=bt,s=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n title"))),Ot(s,l,n),s[Fe]=e,Ie(s),l=s;break e;case"link":var f=Jh("link","href",i).get(l+(n.href||""));if(f){for(var m=0;mHe&&(f=He,He=he,he=f);var N=Io(m,he),A=Io(m,He);if(N&&A&&(k.rangeCount!==1||k.anchorNode!==N.node||k.anchorOffset!==N.offset||k.focusNode!==A.node||k.focusOffset!==A.offset)){var D=Y.createRange();D.setStart(N.node,N.offset),k.removeAllRanges(),he>He?(k.addRange(D),k.extend(A.node,A.offset)):(D.setEnd(A.node,A.offset),k.addRange(D))}}}}for(Y=[],k=m;k=k.parentNode;)k.nodeType===1&&Y.push({element:k,left:k.scrollLeft,top:k.scrollTop});for(typeof m.focus=="function"&&m.focus(),m=0;mn?32:n,U.T=null,n=Dr,Dr=null;var s=fa,f=wl;if(yt=0,Ai=fa=null,wl=0,(ke&6)!==0)throw Error(o(331));var m=ke;if(ke|=4,eh(s.current),Fd(s,s.current,f,n),ke=m,ps(0,!1),Je&&typeof Je.onPostCommitFiberRoot=="function")try{Je.onPostCommitFiberRoot(yn,s)}catch{}return!0}finally{K.p=i,U.T=l,vh(e,t)}}function xh(e,t,n){t=En(n,t),t=rr(e.stateNode,t,2),e=aa(e,t,2),e!==null&&(nn(e,2),il(e))}function Le(e,t,n){if(e.tag===3)xh(e,e,n);else for(;t!==null;){if(t.tag===3){xh(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(oa===null||!oa.has(l))){e=En(n,e),n=Sd(2),l=aa(t,n,2),l!==null&&(jd(n,l,t,e),nn(l,2),il(l));break}}t=t.return}}function kr(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new xy;var i=new Set;l.set(t,i)}else i=l.get(t),i===void 0&&(i=new Set,l.set(t,i));i.has(n)||(Cr=!0,i.add(n),e=Ay.bind(null,e,t,n),t.then(e,e))}function Ay(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ye===e&&(Ce&n)===n&&(at===4||at===3&&(Ce&62914560)===Ce&&300>gt()-Nu?(ke&2)===0&&Ci(e,0):Nr|=n,Ei===Ce&&(Ei=0)),il(e)}function Sh(e,t){t===0&&(t=ja()),e=wa(e,t),e!==null&&(nn(e,t),il(e))}function Cy(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Sh(e,n)}function Ny(e,t){var n=0;switch(e.tag){case 31:case 13:var l=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(o(314))}l!==null&&l.delete(t),Sh(e,n)}function Oy(e,t){return Lt(e,t)}var ku=null,Oi=null,Ur=!1,Uu=!1,Rr=!1,ha=0;function il(e){e!==Oi&&e.next===null&&(Oi===null?ku=Oi=e:Oi=Oi.next=e),Uu=!0,Ur||(Ur=!0,Dy())}function ps(e,t){if(!Rr&&Uu){Rr=!0;do for(var n=!1,l=ku;l!==null;){if(e!==0){var i=l.pendingLanes;if(i===0)var s=0;else{var f=l.suspendedLanes,m=l.pingedLanes;s=(1<<31-We(42|e)+1)-1,s&=i&~(f&~m),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,Ah(l,s))}else s=Ce,s=Qn(l,l===Ye?s:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(s&3)===0||xn(l,s)||(n=!0,Ah(l,s));l=l.next}while(n);Rr=!1}}function zy(){jh()}function jh(){Uu=Ur=!1;var e=0;ha!==0&&Hy()&&(e=ha);for(var t=gt(),n=null,l=ku;l!==null;){var i=l.next,s=Th(l,t);s===0?(l.next=null,n===null?ku=i:n.next=i,i===null&&(Oi=n)):(n=l,(e!==0||(s&3)!==0)&&(Uu=!0)),l=i}yt!==0&&yt!==5||ps(e),ha!==0&&(ha=0)}function Th(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes&-62914561;0m)break;var q=x.transferSize,Y=x.initiatorType;q&&_h(Y)&&(x=x.responseEnd,f+=q*(x"u"?null:document;function Kh(e,t,n){var l=zi;if(l&&typeof t=="string"&&t){var i=wt(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),Xh.has(i)||(Xh.add(i),e={rel:e,crossOrigin:n,href:t},l.querySelector(i)===null&&(t=l.createElement("link"),Ot(t,"link",e),Ie(t),l.head.appendChild(t)))}}function Jy(e){_l.D(e),Kh("dns-prefetch",e,null)}function Wy(e,t){_l.C(e,t),Kh("preconnect",e,t)}function Fy(e,t,n){_l.L(e,t,n);var l=zi;if(l&&e&&t){var i='link[rel="preload"][as="'+wt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+wt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+wt(n.imageSizes)+'"]')):i+='[href="'+wt(e)+'"]';var s=i;switch(t){case"style":s=Di(e);break;case"script":s=Mi(e)}Dn.has(s)||(e=C({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Dn.set(s,e),l.querySelector(i)!==null||t==="style"&&l.querySelector(bs(s))||t==="script"&&l.querySelector(xs(s))||(t=l.createElement("link"),Ot(t,"link",e),Ie(t),l.head.appendChild(t)))}}function Iy(e,t){_l.m(e,t);var n=zi;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+wt(l)+'"][href="'+wt(e)+'"]',s=i;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=Mi(e)}if(!Dn.has(s)&&(e=C({rel:"modulepreload",href:e},t),Dn.set(s,e),n.querySelector(i)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(xs(s)))return}l=n.createElement("link"),Ot(l,"link",e),Ie(l),n.head.appendChild(l)}}}function Py(e,t,n){_l.S(e,t,n);var l=zi;if(l&&e){var i=Tt(l).hoistableStyles,s=Di(e);t=t||"default";var f=i.get(s);if(!f){var m={loading:0,preload:null};if(f=l.querySelector(bs(s)))m.loading=5;else{e=C({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Dn.get(s))&&Ir(e,n);var x=f=l.createElement("link");Ie(x),Ot(x,"link",e),x._p=new Promise(function(M,q){x.onload=M,x.onerror=q}),x.addEventListener("load",function(){m.loading|=1}),x.addEventListener("error",function(){m.loading|=2}),m.loading|=4,Hu(f,t,l)}f={type:"stylesheet",instance:f,count:1,state:m},i.set(s,f)}}}function eg(e,t){_l.X(e,t);var n=zi;if(n&&e){var l=Tt(n).hoistableScripts,i=Mi(e),s=l.get(i);s||(s=n.querySelector(xs(i)),s||(e=C({src:e,async:!0},t),(t=Dn.get(i))&&Pr(e,t),s=n.createElement("script"),Ie(s),Ot(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(i,s))}}function tg(e,t){_l.M(e,t);var n=zi;if(n&&e){var l=Tt(n).hoistableScripts,i=Mi(e),s=l.get(i);s||(s=n.querySelector(xs(i)),s||(e=C({src:e,async:!0,type:"module"},t),(t=Dn.get(i))&&Pr(e,t),s=n.createElement("script"),Ie(s),Ot(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(i,s))}}function Qh(e,t,n,l){var i=(i=ge.current)?Bu(i):null;if(!i)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Di(n.href),n=Tt(i).hoistableStyles,l=n.get(t),l||(l={type:"style",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Di(n.href);var s=Tt(i).hoistableStyles,f=s.get(e);if(f||(i=i.ownerDocument||i,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,f),(s=i.querySelector(bs(e)))&&!s._p&&(f.instance=s,f.state.loading=5),Dn.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Dn.set(e,n),s||ng(i,e,n,f.state))),t&&l===null)throw Error(o(528,""));return f}if(t&&l!==null)throw Error(o(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Mi(n),n=Tt(i).hoistableScripts,l=n.get(t),l||(l={type:"script",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Di(e){return'href="'+wt(e)+'"'}function bs(e){return'link[rel="stylesheet"]['+e+"]"}function Vh(e){return C({},e,{"data-precedence":e.precedence,precedence:null})}function ng(e,t,n,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),Ot(t,"link",n),Ie(t),e.head.appendChild(t))}function Mi(e){return'[src="'+wt(e)+'"]'}function xs(e){return"script[async]"+e}function Zh(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+wt(n.href)+'"]');if(l)return t.instance=l,Ie(l),l;var i=C({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Ie(l),Ot(l,"style",i),Hu(l,n.precedence,e),t.instance=l;case"stylesheet":i=Di(n.href);var s=e.querySelector(bs(i));if(s)return t.state.loading|=4,t.instance=s,Ie(s),s;l=Vh(n),(i=Dn.get(i))&&Ir(l,i),s=(e.ownerDocument||e).createElement("link"),Ie(s);var f=s;return f._p=new Promise(function(m,x){f.onload=m,f.onerror=x}),Ot(s,"link",l),t.state.loading|=4,Hu(s,n.precedence,e),t.instance=s;case"script":return s=Mi(n.src),(i=e.querySelector(xs(s)))?(t.instance=i,Ie(i),i):(l=n,(i=Dn.get(s))&&(l=C({},n),Pr(l,i)),e=e.ownerDocument||e,i=e.createElement("script"),Ie(i),Ot(i,"link",l),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Hu(l,n.precedence,e));return t.instance}function Hu(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=l.length?l[l.length-1]:null,s=i,f=0;f title"):null)}function lg(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Fh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ag(e,t,n,l){if(n.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var i=Di(l.href),s=t.querySelector(bs(i));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Gu.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=s,Ie(s);return}s=t.ownerDocument||t,l=Vh(l),(i=Dn.get(i))&&Ir(l,i),s=s.createElement("link"),Ie(s);var f=s;f._p=new Promise(function(m,x){f.onload=m,f.onerror=x}),Ot(s,"link",l),n.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Gu.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var eo=0;function ig(e,t){return e.stylesheets&&e.count===0&&Xu(e,e.stylesheets),0eo?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(i)}}:null}function Gu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xu(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var $u=null;function Xu(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,$u=new Map,t.forEach(sg,e),$u=null,Gu.call(e))}function sg(e,t){if(!(t.state.loading&4)){var n=$u.get(e);if(n)var l=n.get(null);else{n=new Map,$u.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(u){console.error(u)}}return a(),oo.exports=Ag(),oo.exports}var Ng=Cg();const Og=ep(Ng),zg="modulepreload",Dg=function(a){return"/"+a},Sm={},Pt=function(u,r,o){let d=Promise.resolve();if(r&&r.length>0){let y=function(g){return Promise.all(g.map(z=>Promise.resolve(z).then(C=>({status:"fulfilled",value:C}),C=>({status:"rejected",reason:C}))))};document.getElementsByTagName("link");const b=document.querySelector("meta[property=csp-nonce]"),v=(b==null?void 0:b.nonce)||(b==null?void 0:b.getAttribute("nonce"));d=y(r.map(g=>{if(g=Dg(g),g in Sm)return;Sm[g]=!0;const z=g.endsWith(".css"),C=z?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${C}`))return;const O=document.createElement("link");if(O.rel=z?"stylesheet":zg,z||(O.as="script"),O.crossOrigin="",O.href=g,v&&O.setAttribute("nonce",v),document.head.appendChild(O),z)return new Promise(($,Q)=>{O.addEventListener("load",$),O.addEventListener("error",()=>Q(new Error(`Unable to preload CSS for ${g}`)))})}))}function h(y){const b=new Event("vite:preloadError",{cancelable:!0});if(b.payload=y,window.dispatchEvent(b),!b.defaultPrevented)throw y}return d.then(y=>{for(const b of y||[])b.status==="rejected"&&h(b.reason);return u().catch(h)})};async function oe(a,u={}){var d;const r=new Headers(u.headers);r.set("Content-Type","application/json");const o=await fetch(a,{credentials:"same-origin",...u,headers:r});if(!o.ok)throw new Error(((d=await o.json().catch(()=>null))==null?void 0:d.error)||`${o.status} ${o.statusText}`);if(o.status!==204)return o.json()}const Mg=()=>oe("/v1/bootstrap"),jm=()=>oe("/v1/sessions"),wg=a=>{const u=a?`?root=${encodeURIComponent(a)}`:"";return oe(`/v1/team${u}`)},Tm=a=>{const u=a?`?root=${encodeURIComponent(a)}`:"";return oe(`/v1/sandbox${u}`)},_g=(a,u=!1,r)=>{const o=r?`?root=${encodeURIComponent(r)}`:"";return oe(`/v1/sandbox${o}`,{method:"PATCH",body:JSON.stringify({mode:a,iKnow:u})})};class kg extends Error{constructor(r,o,d){super(r);uo(this,"code");uo(this,"currentVersion");this.name="OpError",this.code=o,this.currentVersion=d}}const tp=async(a,u,r)=>{const o=r?`?root=${encodeURIComponent(r)}`:"",d=await fetch(`/v1/ops${o}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:a,...u===void 0?{}:{data:u}})}),h=await d.json().catch(()=>null);if(!d.ok)throw new kg((h==null?void 0:h.error)||`${d.status} ${d.statusText}`,h==null?void 0:h.code,h==null?void 0:h.currentVersion);return h||{ok:!0}};async function np(a){const u=a?`?root=${encodeURIComponent(a)}`:"",r=await fetch(`/v1/diag${u}`,{credentials:"same-origin"});if(!r.ok){const v=await r.json().catch(()=>null);throw new Error((v==null?void 0:v.error)||`${r.status} ${r.statusText}`)}const o=await r.blob(),d=r.headers.get("Content-Disposition")||"",h=/filename="?([^";]+)"?/i.exec(d),y=(h==null?void 0:h[1])||`strike-diag-${Date.now()}.json`,b=URL.createObjectURL(o);try{const v=document.createElement("a");v.href=b,v.download=y,v.rel="noopener",document.body.appendChild(v),v.click(),v.remove()}finally{URL.revokeObjectURL(b)}}const Em=()=>oe("/v1/roots"),Ug=()=>oe("/v1/roots",{method:"POST"}),Am=a=>oe(`/v1/roots/${encodeURIComponent(a)}/activate`,{method:"POST"}),Rg=a=>oe(`/v1/roots/${encodeURIComponent(a)}/resume`,{method:"POST"}),Lg=a=>oe(`/v1/roots/${encodeURIComponent(a)}`,{method:"DELETE"}),qg=(a,u,r=[])=>oe(`/v1/memory/${encodeURIComponent(a)}`,{method:"PUT",body:JSON.stringify({value:u,tags:r})}),Bg=a=>oe(`/v1/memory/${encodeURIComponent(a)}`,{method:"DELETE"}),Hg=(a,u="")=>oe("/v1/issues",{method:"POST",body:JSON.stringify({title:a,body:u})}),Yg=a=>oe(`/v1/issues/${a}/close`,{method:"POST",body:JSON.stringify({})});async function lp(a,u){const r=await fetch(a,{credentials:"same-origin"});if(!r.ok){const y=await r.json().catch(()=>null);throw new Error((y==null?void 0:y.error)||`${r.status} ${r.statusText}`)}const o=await r.blob(),d=URL.createObjectURL(o),h=document.createElement("a");h.href=d,h.download=u,h.click(),URL.revokeObjectURL(d)}const ap=()=>lp("/v1/memory/export","strike-memory.json"),ip=()=>lp("/v1/issues/export","strike-issues.json");function Gg(a,u,r){let o,d=0,h=!1;const y=()=>{const b=location.protocol==="https:"?"wss:":"ws:",v=a?`?root=${encodeURIComponent(a)}`:"";o=new WebSocket(`${b}//${location.host}/v1/ws${v}`),o.onopen=()=>{d=0,r("connected")},o.onmessage=g=>{try{u(JSON.parse(g.data))}catch{r("invalid event")}},o.onerror=()=>r("transport error"),o.onclose=()=>{h||(r("reconnecting"),setTimeout(y,Math.min(500*2**d++,8e3)))}};return y(),{send:(b,v)=>(o==null?void 0:o.readyState)===WebSocket.OPEN&&o.send(JSON.stringify({type:b,...v===void 0?{}:{data:v}})),close:()=>{h=!0,o&&(o.onmessage=null,o.onerror=null,o.onclose=null,o.close())}}}function $g(a,u,r=()=>{}){const o=new EventSource(`/v1/sessions/${encodeURIComponent(a)}/events`);return o.onmessage=d=>{try{u(JSON.parse(d.data))}catch{r("invalid historical event")}},o.onerror=()=>r("history reconnecting"),()=>o.close()}const Xg=a=>oe(`/v1/sessions/${encodeURIComponent(a)}/children`),Kg='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';function sp(a){return Array.from(a.querySelectorAll(Kg)).filter(u=>!u.hasAttribute("disabled")&&u.tabIndex!==-1&&u.offsetParent!==null)}function Qg(a,u){if(u.key!=="Tab")return!1;const r=sp(a);if(!r.length)return u.preventDefault(),a.focus(),!0;const o=r[0],d=r[r.length-1],h=document.activeElement;if(u.shiftKey){if(!h||h===o||!a.contains(h))return u.preventDefault(),d.focus(),!0}else if(!h||h===d||!a.contains(h))return u.preventDefault(),o.focus(),!0;return!1}function Vg(a,u){if(u){const d=a.querySelector(u);if(d){d.focus();return}}const r=a.querySelector("[autofocus]");if(r){r.focus();return}(sp(a)[0]||a).focus()}function up({title:a,children:u,onClose:r,mode:o="modal",className:d="",wide:h=!1,initialFocus:y,actions:b,...v}){const g=T.useRef(null),z=T.useRef(null),C=T.useId(),O=o==="blocking";T.useEffect(()=>{z.current=document.activeElement;const Q=g.current;if(Q){if(typeof Q.showModal=="function"&&!Q.open)try{Q.showModal()}catch{Q.setAttribute("open","")}else Q.setAttribute("open","");return requestAnimationFrame(()=>Vg(Q,y)),()=>{const le=z.current;if(le instanceof HTMLElement&&document.contains(le))try{le.focus()}catch{}}}},[y]),T.useEffect(()=>{const Q=g.current;if(!Q)return;const le=ye=>{if(ye.key==="Escape"&&O){ye.preventDefault(),ye.stopPropagation();return}Qg(Q,ye)};return Q.addEventListener("keydown",le),()=>Q.removeEventListener("keydown",le)},[O]);const $=["ui-dialog",h?"ui-dialog-wide":"",O?"ui-dialog-blocking":"",d].filter(Boolean).join(" ");return c.jsxs("dialog",{ref:g,className:$,"aria-labelledby":C,"aria-modal":"true","data-mode":o,onClose:()=>r==null?void 0:r(),onCancel:Q=>{if(O){Q.preventDefault();return}Q.preventDefault(),r==null||r()},...v,children:[c.jsx("div",{className:"dialog-rule","aria-hidden":!0}),c.jsx("h2",{id:C,children:a}),c.jsx("div",{className:"ui-dialog-body",children:u}),b?c.jsx("div",{className:"dialog-actions",children:b}):null]})}function Zg({items:a,value:u,onChange:r,label:o,className:d="",panelIdPrefix:h}){const y=T.useId(),b=T.useRef(null),v=a.filter(C=>!C.disabled);T.useEffect(()=>{var $,Q;const C=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(u):u.replace(/["\\]/g,""),O=($=b.current)==null?void 0:$.querySelector(`[data-tab-id="${C}"]`);(Q=O==null?void 0:O.scrollIntoView)==null||Q.call(O,{inline:"nearest",block:"nearest"})},[u]);const g=(C,O)=>{if(!v.length)return;const $=Math.max(0,v.findIndex(le=>le.id===C)),Q=v[($+O+v.length)%v.length];r(Q.id),requestAnimationFrame(()=>{var ye;const le=(ye=b.current)==null?void 0:ye.querySelectorAll("[data-tab-id]");le==null||le.forEach(ee=>{ee.dataset.tabId===Q.id&&ee.focus()})})},z=(C,O)=>{switch(C.key){case"ArrowRight":case"ArrowDown":C.preventDefault(),g(O,1);break;case"ArrowLeft":case"ArrowUp":C.preventDefault(),g(O,-1);break;case"Home":C.preventDefault(),v[0]&&r(v[0].id);break;case"End":C.preventDefault(),v.length&&r(v[v.length-1].id);break}};return c.jsx("div",{ref:b,className:`ui-tabs ${d}`.trim(),role:"tablist","aria-label":o,children:a.map(C=>{const O=C.id===u,$=`${y}-tab-${C.id}`,Q=h?`${h}-${C.id}`:`${y}-panel-${C.id}`;return c.jsx("button",{type:"button",role:"tab",id:$,"data-tab-id":C.id,className:"ui-tab","aria-selected":O,"aria-controls":Q,tabIndex:O?0:-1,disabled:C.disabled,onClick:()=>r(C.id),onKeyDown:le=>z(le,C.id),children:C.label},C.id)})})}const cp={idle:"Idle",busy:"Busy",blocked:"Blocked","needs-you":"Needs you",failed:"Failed",complete:"Complete",canceled:"Canceled",unknown:"Unknown"};function rp(a){const u=(a||"").toLowerCase();return!u||u==="idle"||u==="ready"?"idle":u==="running"||u==="busy"||u==="streaming"||u==="working"?"busy":u==="blocked"||u==="finalizing"||u==="escalating"||u==="waiting"?"blocked":u==="needs-you"||u==="needs_you"||u==="permission"||u==="question"?"needs-you":u==="failed"||u==="error"||u==="interrupted"?"failed":u==="completed"||u==="complete"||u==="done"||u==="success"?"complete":u==="canceled"||u==="cancelled"?"canceled":"unknown"}function Jg(a){return a.needsYou?"needs-you":a.failed?"failed":a.busy?"busy":"idle"}function Wg({kind:a,label:u,className:r=""}){const o=u??cp[a];return c.jsxs("span",{className:`ui-status ui-status-${a} ${r}`.trim(),"data-status":a,children:[c.jsx("span",{className:"ui-status-dot","aria-hidden":!0}),c.jsx("span",{className:"ui-status-label",children:o})]})}function Fg({kind:a,label:u,className:r=""}){const o=u??cp[a];return c.jsx("span",{className:`ui-status-dot ui-status-dot-alone ui-status-${a} ${r}`.trim(),"data-status":a,role:"img","aria-label":o,title:o})}function mt({variant:a="default",size:u="md",className:r="",type:o="button",children:d,...h}){const y=["ui-btn",`ui-btn-${a}`,u!=="md"?`ui-btn-${u}`:"",r].filter(Boolean).join(" ");return c.jsx("button",{type:o,className:y,...h,children:d})}function Ig({label:a,className:u="",children:r,...o}){return c.jsx(mt,{variant:"icon","aria-label":a,title:o.title??a,className:`icon-button ${u}`.trim(),...o,children:r})}function op({tone:a="info",title:u,children:r,className:o=""}){const d=a==="error"?"alert":"status";return c.jsxs("section",{className:`ui-notice ui-notice-${a} ${a==="unavailable"?"unavailable":""} ${o}`.trim(),role:d,"data-tone":a,children:[u?c.jsx("strong",{className:"ui-notice-title",children:u}):null,r?c.jsx("div",{className:"ui-notice-body",children:r}):null]})}function po({name:a}){return c.jsx(op,{tone:"unavailable",title:`${a} unavailable`,children:c.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})})}function Cm({label:a="Loading…"}){return c.jsx(op,{tone:"info",title:a,className:"ui-loading",children:c.jsx("span",{className:"ui-loading-indicator","aria-hidden":!0})})}function Pg({active:a,leading:u,title:r,meta:o,trailing:d,className:h="",role:y,...b}){const v=y==="option";return c.jsxs("button",{type:"button",role:y,className:`ui-list-row ${a?"active":""} ${h}`.trim(),"aria-pressed":v?void 0:a,"aria-selected":v?!!a:void 0,...b,children:[u,c.jsxs("span",{className:"ui-list-row-main",children:[c.jsx("span",{className:"ui-list-row-title",children:r}),o?c.jsx("span",{className:"ui-list-row-meta",children:o}):null]}),d?c.jsx("span",{className:"ui-list-row-trailing",children:d}):null]})}function Co(a,u){return u.name||u.agent||a.slice(0,8)}function fp(a){switch(a){case"complete":return"quality complete";case"partial":return"quality partial";case"unavailable":return"quality unavailable";default:return"quality"}}function dp({children:a,selectedId:u,onSelect:r,onOpenTranscript:o}){const d=u?a.find(([h])=>h===u):void 0;return a.length?c.jsxs("div",{className:"child-agents","aria-label":"Child agents",children:[c.jsx("div",{className:"aside-heading",children:"CHILD AGENTS"}),c.jsx("div",{className:"children",role:"list",children:a.map(([h,y])=>{const b=h===u,v=rp(y.status);return c.jsxs("button",{type:"button",role:"listitem",className:b?"child-row active":"child-row","aria-pressed":b,"aria-label":`Child ${Co(h,y)}`,onClick:()=>r(b?void 0:h),children:[c.jsx(Fg,{kind:v,label:y.status||v,className:`child-state ${y.status||""}`}),c.jsx("span",{className:"child-label",children:Co(h,y)}),c.jsxs("span",{className:"child-meta",children:[c.jsx("small",{children:y.status}),y.quality?c.jsx("small",{className:fp(y.quality),children:y.quality}):null]})]},h)})}),d&&c.jsx(ev,{id:d[0],child:d[1],onClose:()=>r(void 0),onOpenTranscript:o})]}):null}function ev({id:a,child:u,onClose:r,onOpenTranscript:o}){const d=u.budgetKind?[u.budgetKind,u.finalization&&u.finalization!=="none"?`finalization ${u.finalization}`:""].filter(Boolean).join(" · "):u.escalateReason||void 0,h=rp(u.status);return c.jsxs("section",{className:"child-detail","aria-label":"Child handoff detail",children:[c.jsxs("header",{children:[c.jsx("h3",{children:Co(a,u)}),c.jsx(Ig,{label:"Close child detail",onClick:r,children:"×"})]}),c.jsxs("dl",{children:[c.jsx("dt",{children:"Status"}),c.jsx("dd",{children:c.jsx(Wg,{kind:h,label:u.status||h})}),u.quality?c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"Handoff quality"}),c.jsx("dd",{children:c.jsx("span",{className:fp(u.quality),children:u.quality})})]}):null,u.summary?c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"Summary"}),c.jsx("dd",{children:u.summary})]}):null,d?c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"Budget / stop"}),c.jsx("dd",{children:d})]}):null,u.escalateAction&&!u.budgetKind?c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"Escalation"}),c.jsxs("dd",{children:[u.escalateAction,u.escalateKind?` (${u.escalateKind})`:""]})]}):null,u.prompt?c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"Prompt"}),c.jsx("dd",{className:"child-prompt",children:u.prompt})]}):null,c.jsx("dt",{children:"Session"}),c.jsx("dd",{children:c.jsx("code",{children:a})})]}),o&&c.jsx("div",{className:"child-detail-actions",children:c.jsx("button",{type:"button",onClick:()=>o(a),children:"Open transcript (RO)"})}),c.jsx("p",{className:"muted child-detail-note",children:"List/detail only — full agent visualizer is tracked in #523."})]})}const Nm=40,Om=8192;function tv(a,u={}){var h,y,b;const r=["# Strike session export",""];(h=u.sessionId)!=null&&h.trim()&&r.push(`- **Session:** \`${u.sessionId.trim()}\``),(y=u.title)!=null&&y.trim()&&r.push(`- **Title:** ${cc(u.title)}`);const o=[u.provider,u.model].filter(Boolean).join(" / ");o&&r.push(`- **Model:** ${cc(o)}`),(b=u.agent)!=null&&b.trim()&&r.push(`- **Agent:** ${cc(u.agent)}`);const d=u.exported??new Date;if(r.push(`- **Exported:** ${d.toISOString()}`),r.push("","---",""),!a.length)return r.push("_Empty transcript._",""),r.join(`
+`);for(const v of a){const g=av(v);g&&r.push(g.endsWith(`
+`)?g.trimEnd():g,"")}return r.join(`
+`).replace(/\n{3,}/g,`
+
+`)}function nv(a,u=new Date){const r=u.toISOString().replace(/[-:]/g,"").replace("T","-").replace(/\.\d{3}Z$/,"");return`strike-${(a||"session").replace(/[^a-zA-Z0-9_-]/g,"").replace(/^-+|-+$/g,"").slice(0,12).replace(/-+$/g,"")||"session"}-${r}.md`}function lv(a,u,r="text/markdown;charset=utf-8"){const o=new Blob([u],{type:r}),d=URL.createObjectURL(o),h=document.createElement("a");h.href=d,h.download=a,h.rel="noopener",document.body.appendChild(h),h.click(),h.remove(),URL.revokeObjectURL(d)}function av(a){var r;const u=(a.text||"").replace(/\s+$/u,"");switch(a.kind){case"user":return u?`## You
+
+${u}`:`## You
+
+_Empty message._`;case"assistant":return u?`## Strike
+
+${u}`:`## Strike
+
+_Empty response._`;case"reasoning":return u?`### Thinking
+
+${zm(u)}`:"";case"tool":{const o=uv(a.title||String(((r=a.data)==null?void 0:r.name)||"tool")),d=iv(a.data),h=[`### Tool: \`${o}\` (${d})`];return u&&h.push("",zm(sv(u))),h.join(`
+`)}case"error":return u?`### Error
+
+${u}`:"";case"system":return u?`### ${cc(a.title||"Info")}
+
+${u}`:"";default:return""}}function iv(a){return a?a.isError||a.error?"error":a.done===!1?"running":"ok":"ok"}function sv(a){let u=a.replace(/\s+$/u,"");u.length>Om&&(u=`${u.slice(0,Om)}
+... (truncated)`);const r=u.split(`
+`);return r.length>Nm&&(u=`${r.slice(0,Nm).join(`
+`)}
+... (truncated)`),u}function zm(a){const u=a.replace(/\s+$/u,"");let r="```";for(;u.includes(r);)r+="`";return`${r}
+${u}
+${r}`}function cc(a){return a.replace(/[\r\n]+/g," ").trim()}function uv(a){return a.trim().replace(/`/g,"'").replace(/[\r\n]+/g," ")||"tool"}function cv(a,u){return u<0||u>=a.length?a:a.filter((r,o)=>o!==u)}function Dm(a,u,r){const o=u+r;if(u<0||u>=a.length||o<0||o>=a.length)return a;const d=a.slice(),h=d[u];return d[u]=d[o],d[o]=h,d}function Mm(a,u,r){return u<0||u>=a.length?a:a.map((o,d)=>d===u?{...o,text:r}:o)}function rv(){return[]}function hp({queue:a,queueEdit:u,setQueueEdit:r,queueEditCancel:o,queueRef:d,setQueue:h,empty:y=!1,className:b="prompt-queue-wrap"}){return!a.length&&!y?null:a.length?c.jsxs("div",{className:b,children:[c.jsx("ol",{ref:d,className:"prompt-queue","aria-label":"Queued prompts",children:a.map((v,g)=>c.jsxs("li",{children:[(u==null?void 0:u.index)===g?c.jsx("input",{className:"queue-edit","aria-label":`Queued prompt text ${g+1}`,value:u.text,autoFocus:!0,onChange:z=>r({index:g,text:z.target.value}),onKeyDown:z=>{z.key==="Enter"&&(z.preventDefault(),o.current=!1,h(C=>Mm(C,g,u.text)),r(null)),z.key==="Escape"&&(z.preventDefault(),o.current=!0,r(null))},onBlur:()=>{o.current||h(z=>Mm(z,g,u.text)),o.current=!1,r(null)}}):c.jsxs("span",{children:[v.text,v.images.length>0?` (${v.images.length} img)`:""]}),c.jsxs("span",{className:"queue-actions",children:[c.jsx("button",{type:"button","aria-label":`Move queued prompt ${g+1} up`,disabled:g===0,onClick:()=>h(z=>Dm(z,g,-1)),children:"↑"}),c.jsx("button",{type:"button","aria-label":`Move queued prompt ${g+1} down`,disabled:g===a.length-1,onClick:()=>h(z=>Dm(z,g,1)),children:"↓"}),c.jsx("button",{type:"button","aria-label":`Edit queued prompt ${g+1}`,onClick:()=>{o.current=!1,r({index:g,text:v.text})},children:"✎"}),c.jsx("button",{type:"button","aria-label":`Remove queued prompt ${g+1}`,onClick:()=>{h(z=>cv(z,g)),r(z=>(z==null?void 0:z.index)===g?null:z)},children:"×"})]})]},g))}),c.jsx("div",{className:"queue-toolbar",children:c.jsx("button",{type:"button",onClick:()=>{h(rv()),r(null)},children:"Clear queue"})})]}):c.jsx("div",{className:b,children:c.jsx("p",{className:"muted",children:"Queue is empty. Prompts sent while the agent is busy land here."})})}function ov({contextLabel:a,provider:u,model:r,phase:o,fitWarning:d,childrenEntries:h,selectedChildId:y,onSelectChild:b,onOpenChildTranscript:v,queue:g,queueEdit:z,setQueueEdit:C,queueEditCancel:O,queueRef:$,setQueue:Q}){return c.jsxs("div",{className:"session-group","aria-label":"Session group",children:[c.jsxs("section",{className:"session-group-pane","aria-label":"Context summary",children:[c.jsx("div",{className:"aside-heading",children:"CONTEXT"}),c.jsxs("dl",{className:"session-group-facts",children:[c.jsx("dt",{children:"Context"}),c.jsx("dd",{children:a}),c.jsx("dt",{children:"Provider"}),c.jsx("dd",{children:u||"unknown"}),c.jsx("dt",{children:"Model"}),c.jsx("dd",{children:r||"unknown"}),c.jsx("dt",{children:"Phase"}),c.jsx("dd",{children:o||"idle"})]}),d&&c.jsx("p",{className:`session-group-fit ${d.level==="critical"?"critical":"warn"}`,role:"status",children:d.message})]}),c.jsxs("section",{className:"session-group-pane","aria-label":"Activity",children:[c.jsx("div",{className:"aside-heading",children:"ACTIVITY"}),h.length?c.jsx(dp,{children:h,selectedId:y,onSelect:b,onOpenTranscript:v}):c.jsx("p",{className:"muted",children:"No child agents"})]}),c.jsxs("section",{className:"session-group-pane","aria-label":"Queue",children:[c.jsx("div",{className:"aside-heading",children:"QUEUE"}),c.jsx(hp,{queue:g,queueEdit:z,setQueueEdit:C,queueEditCancel:O,queueRef:$,setQueue:Q,empty:!0,className:"session-group-queue"})]})]})}const fv=()=>({files:[],skipped:0,uncovered:[]});function No(a){return a.files.length>0||a.skipped>0}function _s(a){return a.uncovered.length>0}function wm(a){return a?a.parentSessionId?!1:!(Number(a.depth??0)>0):!0}function dv(a){const u=Array.isArray(a==null?void 0:a.files)?a.files:[],r=[];for(const h of u){if(!h||typeof h!="object")continue;const y=h,b=String(y.path??"").trim();if(!b)continue;const v=String(y.kind??"").trim();r.push(v?{path:b,kind:v}:{path:b})}const o=Number((a==null?void 0:a.checkpointSkipped)??0)||0,d=Array.isArray(a==null?void 0:a.uncovered)?a.uncovered.map(h=>String(h)).filter(Boolean):[];return{files:r,skipped:o,uncovered:d}}function hv(a,u=12){if(!No(a)&&!_s(a))return[];const r=[];if(a.files.length>0){r.push({text:`Paths to restore (${a.files.length}):`});for(let o=0;o=u){r.push({text:` … and ${a.files.length-u} more`});break}const d=a.files[o];r.push({text:d.kind?` ${d.kind} ${d.path}`:` ${d.path}`})}}else a.skipped>0&&r.push({text:"No restorable harness paths in the last turn."});return a.skipped>0&&r.push({text:`Checkpoint skipped: ${a.skipped} path(s) (oversized/unreadable).`}),_s(a)&&r.push({text:`Warning: uncovered mutations (${a.uncovered.join(", ")}) — shell/other changes are NOT restored.`,tone:"warn"}),r}function mv(a){return a.files.length>0?`drop the last turn and restore ${a.files.length} path(s)`:a.skipped>0?"drop the last turn; checkpointed paths were not capturable":_s(a)?"drop the last turn; no harness file snapshots (uncovered mutations)":"drop the last turn and restore files edited in that turn"}function pv(a,u){return u?!0:!No(a)&&!_s(a)?!1:No(a)||_s(a)}const Ri=()=>({members:{},delegations:{},messages:[],pathOverlaps:[],artifacts:{},ledger:{},verifications:[],available:!0}),yv=new Set(["completed","failed","canceled","cancelled","blocked"]),Iu=a=>a&&typeof a=="object"&&!Array.isArray(a)?a:void 0,re=(a,u)=>{const r=a==null?void 0:a[u];return r==null?void 0:String(r).trim()||void 0},yo=a=>yv.has((a||"").toLowerCase());function ws(a,u){const r=!!(a!=null&&a.terminal||yo(a==null?void 0:a.state));let o=u.state||(a==null?void 0:a.state)||"unknown",d=r||yo(o);return r&&u.state&&!yo(u.state)&&(o=(a==null?void 0:a.state)||o,d=!0),{sessionId:u.sessionId,name:u.name??(a==null?void 0:a.name),agent:u.agent??(a==null?void 0:a.agent),state:o,role:u.role??(a==null?void 0:a.role),parentSessionId:u.parentSessionId??(a==null?void 0:a.parentSessionId),depth:u.depth??(a==null?void 0:a.depth),objective:u.objective??(a==null?void 0:a.objective),lastAction:u.lastAction??(a==null?void 0:a.lastAction),blockReason:u.blockReason??(a==null?void 0:a.blockReason),terminalSummary:u.terminalSummary??(a==null?void 0:a.terminalSummary),queueLabel:u.queueLabel??(a==null?void 0:a.queueLabel),filesTouched:u.filesTouched??(a==null?void 0:a.filesTouched),budget:u.budget??(a==null?void 0:a.budget),terminal:d}}function Pu(a,u,r={},o){switch(u){case"team.roster":{const d=re(r,"leadId")||a.leadId,h={...a.members},y=Array.isArray(r.members)?r.members:[];for(const b of y){const v=Iu(b);if(!v)continue;const g=re(v,"sessionId");if(!g)continue;const z=Iu(v.budget);h[g]=ws(h[g],{sessionId:g,name:re(v,"name"),agent:re(v,"agent"),state:re(v,"state")||"unknown",role:re(v,"role"),parentSessionId:re(v,"parentSessionId"),depth:typeof v.depth=="number"?v.depth:void 0,objective:re(v,"objective"),lastAction:re(v,"lastAction"),blockReason:re(v,"blockReason"),terminalSummary:re(v,"terminalSummary"),queueLabel:re(v,"queueLabel"),filesTouched:Array.isArray(v.filesTouched)?v.filesTouched.map(String):void 0,budget:z})}return{...a,leadId:d,members:h,available:!0,unavailableReason:void 0}}case"child.started":{const d=re(r,"sessionId");if(!d)return a;const h={...a.members};return h[d]=ws(h[d],{sessionId:d,name:re(r,"name"),agent:re(r,"agent"),state:"running",objective:re(r,"prompt")}),{...a,members:h,available:!0}}case"child.completed":{const d=re(r,"sessionId");if(!d)return a;const h={...a.members},y=re(r,"status")||"completed",b=Iu(r.handoff);h[d]=ws(h[d],{sessionId:d,name:re(r,"name"),state:y,terminalSummary:re(r,"summary")||re(b,"summary")});let v=a.verifications;const g=Iu(r.verification);return g&&(v=[...a.verifications,{sessionId:d,passed:!!g.passed,claimed:!!g.claimed,verified:!!g.verified,summary:re(g,"summary")}].slice(-40)),{...a,members:h,verifications:v,available:!0}}case"child.escalated":{const d=re(r,"sessionId");if(!d)return a;const h={...a.members},y=re(r,"action"),b=y==="finalizing"?"finalizing":y==="interrupted"?"interrupted":"escalating";return h[d]=ws(h[d],{sessionId:d,name:re(r,"name"),state:b,blockReason:re(r,"reason")}),{...a,members:h}}case"delegation.changed":{const d=re(r,"id");if(!d)return a;const h={...a.delegations};return h[d]={id:d,state:re(r,"state")||"unknown",prev:re(r,"prev"),version:typeof r.version=="number"?r.version:void 0,sessionId:re(r,"sessionId"),name:re(r,"name"),reason:re(r,"reason"),ownerSessionId:re(r,"ownerSessionId")},{...a,delegations:h,available:!0}}case"agent.message":{const d={messageId:re(r,"messageId"),from:re(r,"from"),to:re(r,"to"),body:re(r,"body"),summary:re(r,"summary"),teamId:re(r,"teamId"),taskId:re(r,"taskId"),urgency:re(r,"urgency"),kind:re(r,"kind"),time:o},h=[...a.messages,d].slice(-100);return{...a,messages:h}}case"path.overlap":{const d=re(r,"path");if(!d)return a;const h=Array.isArray(r.sessions)?r.sessions.map(String):Array.isArray(r.sessionIds)?r.sessionIds.map(String):void 0,y=[...a.pathOverlaps,{path:d,sessions:h,time:o}].slice(-50);return{...a,pathOverlaps:y}}case"artifact.updated":{const d=re(r,"id");if(!d)return a;const h={...a.artifacts};return h[d]={id:d,type:re(r,"type"),version:typeof r.version=="number"?r.version:void 0,title:re(r,"title"),op:re(r,"op"),scope:re(r,"scope")},{...a,artifacts:h}}case"ledger.updated":{const d=re(r,"id");if(!d)return a;const h={...a.ledger};return h[d]={id:d,kind:re(r,"kind"),status:re(r,"status"),op:re(r,"op"),statement:re(r,"statement")},{...a,ledger:h}}case"team.unavailable":return{...a,available:!1,unavailableReason:re(r,"reason")||"Team observation unavailable"};case"workspace.reset":return Ri();default:return a}}function gv(a,u){if(!u)return{...a,available:!1,unavailableReason:a.unavailableReason||"Team snapshot unavailable"};if(u.available===!1)return{...Ri(),available:!1,unavailableReason:u.unavailableReason||"Team dissolved or unavailable"};const r=Ri(),o={};for(const[d,h]of Object.entries(u.members||{}))h!=null&&h.sessionId&&(o[d]=ws(void 0,h));return{...r,leadId:u.leadId||a.leadId,members:Object.keys(o).length?o:a.members,delegations:u.delegations||a.delegations,messages:Array.isArray(u.messages)?u.messages.slice(-100):a.messages,pathOverlaps:Array.isArray(u.pathOverlaps)?u.pathOverlaps.slice(-50):a.pathOverlaps,artifacts:u.artifacts||a.artifacts,ledger:u.ledger||a.ledger,verifications:Array.isArray(u.verifications)?u.verifications.slice(-40):a.verifications,available:!0,unavailableReason:void 0}}const mp=()=>({items:[],seen:new Set,status:{},children:{},team:Ri(),changedFiles:[],undoStack:[],layers:[],pinnedKinds:[],excludedKinds:[],shedKinds:[]}),vv=a=>JSON.stringify([a.type,a.time,a.data]),it=(a,u)=>String((a==null?void 0:a[u])??""),bv=a=>String((a==null?void 0:a.turnId)??(a==null?void 0:a.sessionId)??"root");function Ns(a){if(typeof a=="number"&&Number.isFinite(a))return{n:a,known:!0};if(a&&typeof a=="object"){const u=a;if(u.known===!0&&typeof u.n=="number"&&Number.isFinite(u.n))return{n:u.n,known:!0}}return{n:0,known:!1}}function ec(a,u){return u.known?(a??0)+u.n:a}function xv(a,u){const r=u.trim();return r?!a||a===r?r:a==="mixed (actual + estimated)"?a:a==="actual"&&r==="estimated"||a==="estimated"&&r==="actual"?"mixed (actual + estimated)":r:a||""}function Sv(a,u){const r=Ns(u.input),o=Ns(u.output),d=Ns(u.cacheRead),h=Ns(u.cacheCreation),y=Ns(u.used),b={...a,usageReports:(a.usageReports??0)+1,inputTokens:ec(a.inputTokens,r),outputTokens:ec(a.outputTokens,o),cacheReadTokens:ec(a.cacheReadTokens,d),cacheCreationTokens:ec(a.cacheCreationTokens,h),usageSource:xv(a.usageSource,it(u,"source"))||a.usageSource};return y.known&&(b.contextUsed=y.n),b}function xa(a,u,r=!1){if(r){const o=a.at(-1);if((o==null?void 0:o.kind)===u.kind&&o.id===u.id)return[...a.slice(0,-1),{...o,text:o.text+u.text}]}return[...a,u]}function jv(a,u){return[...a,u]}function Tv(a){return a.length?a.slice(0,-1):a}function _i(a){if(!a||typeof a!="object")return;const u=a,r=!!u.known;return{n:typeof u.n=="number"?u.n:0,known:r}}function Os(a){return Array.isArray(a)?a.map(u=>String(u)).filter(Boolean):[]}function Ev(a){return Array.isArray(a)?a.map(u=>{const r=u&&typeof u=="object"?u:{};return{kind:String(r.kind||""),source:r.source!==void 0?String(r.source):void 0,mode:r.mode!==void 0?String(r.mode):void 0,chars:typeof r.chars=="number"?r.chars:void 0,estTokens:typeof r.estTokens=="number"?r.estTokens:void 0,pinned:!!r.pinned,preview:r.preview!==void 0?String(r.preview):void 0}}).filter(u=>u.kind):[]}function Av(a){var d,h,y,b,v;if(!a||typeof a!="object")return;const u=a,r={system:_i(u.system),tools:_i(u.tools),messages:_i(u.messages),toolResults:_i(u.toolResults),total:_i(u.total),source:u.source!==void 0?String(u.source):void 0};return r.source||((d=r.system)==null?void 0:d.known)||((h=r.tools)==null?void 0:h.known)||((y=r.messages)==null?void 0:y.known)||((b=r.toolResults)==null?void 0:b.known)||((v=r.total)==null?void 0:v.known)?r:void 0}function Cv(a){const u=_i(a);return u!=null&&u.known?u.n:void 0}function _m(a,u){return a.includes(u)?a:[...a,u]}function tc(a,u){return a.filter(r=>r!==u)}const zt=(a,u)=>String((a==null?void 0:a[u])??"").trim()||void 0,Nv=a=>a&&typeof a=="object"&&!Array.isArray(a)?a:void 0,go=a=>String(a.sessionId??"").trim();function vo(a,u){return{agent:u.agent||(a==null?void 0:a.agent),name:u.name||(a==null?void 0:a.name),status:u.status||(a==null?void 0:a.status)||"unknown",summary:u.summary??(a==null?void 0:a.summary),quality:u.quality??(a==null?void 0:a.quality),budgetKind:u.budgetKind??(a==null?void 0:a.budgetKind),finalization:u.finalization??(a==null?void 0:a.finalization),prompt:u.prompt??(a==null?void 0:a.prompt),escalateKind:u.escalateKind??(a==null?void 0:a.escalateKind),escalateReason:u.escalateReason??(a==null?void 0:a.escalateReason),escalateAction:u.escalateAction??(a==null?void 0:a.escalateAction)}}function km(a,u){var P,J;if(u.type==="workspace.reset")return{...mp(),status:{sessionId:String(((P=u.data)==null?void 0:P.sessionId)||"")}};if(u.type==="local.system"){const se=u.data||{};return{...a,items:xa(a.items,{id:`system:${a.items.length}:${u.time||Date.now()}`,kind:"system",title:it(se,"title")||"Notice",text:it(se,"text")})}}const r=vv(u);if(a.seen.has(r))return a;const o=new Set(a.seen).add(r),d=u.data||{};let h=a.items,y=a.status,b=a.permission,v=a.question;const g={...a.children};let z=a.team||Ri(),C=a.changedFiles,O=a.undoStack,$=a.attribution,Q=a.layers,le=a.pinnedKinds,ye=a.excludedKinds,ee=a.shedKinds,B=a.fitWarning,_=a.promptScope,pe=a.systemChars,W=a.messageCount;const me=bv(d);switch(u.type){case"status":y={...y,...d};break;case"user.message":h=xa(h,{id:`${me}:user:${h.length}`,kind:"user",text:it(d,"text"),data:d});break;case"text.delta":h=xa(h,{id:`${me}:assistant`,kind:"assistant",text:it(d,"text")},!0);break;case"reasoning.delta":h=xa(h,{id:`${me}:reasoning`,kind:"reasoning",title:"Reasoning",text:it(d,"text")},!0);break;case"tool.begin":h=xa(h,{id:String(d.callId),kind:"tool",title:it(d,"name"),text:JSON.stringify(d.args??{},null,2),data:d});break;case"tool.output":{const se=String(d.callId),ue=h.findIndex(ie=>ie.id===se);ue>=0&&(h=h.map((ie,Se)=>Se===ue?{...ie,text:ie.text+it(d,"data")}:ie));break}case"tool.end":{const se=String(d.callId),ue=h.findIndex(Se=>Se.id===se),ie={id:se,kind:"tool",title:it(d,"title"),text:it(d,"output"),data:d};h=ue>=0?h.map((Se,Ge)=>Ge===ue?ie:Se):xa(h,ie);break}case"permission.asked":b=d;break;case"permission.resolved":(!d.requestId||d.requestId===(b==null?void 0:b.requestId))&&(b=void 0);break;case"question.asked":v=d;break;case"question.resolved":(!d.requestId||d.requestId===(v==null?void 0:v.requestId))&&(v=void 0);break;case"turn.started":y={...y,busy:!0},B=void 0;break;case"turn.completed":y={...y,busy:!1},wm(d)&&(O=jv(O,dv(d)));break;case"session.rewound":wm(d)&&(O=Tv(O));break;case"model.selected":y={...y,provider:it(d,"provider"),model:it(d,"model")};break;case"agent.selected":y={...y,agent:it(d,"name")};break;case"effort.selected":y={...y,effort:it(d,"level")};break;case"autonomy.selected":y={...y,autonomy:it(d,"mode")};break;case"usage.reported":y=Sv(y,d);break;case"permission.mode":y={...y,permissionMode:it(d,"mode")};break;case"phase.changed":y={...y,phase:it(d,"phase"),workflow:it(d,"workflow")};break;case"files.invalidated":C=Array.from(new Set([...C,...d.paths||[]]));break;case"child.started":{const se=go(d);se&&(g[se]=vo(g[se],{agent:zt(d,"agent"),name:zt(d,"name"),status:"running",prompt:zt(d,"prompt")})),z=Pu(z,u.type,d,u.time);break}case"child.completed":{const se=go(d);if(se){const ue=Nv(d.handoff),ie=zt(d,"summary")||zt(ue,"summary");g[se]=vo(g[se],{name:zt(d,"name"),status:zt(d,"status")||"completed",summary:ie,quality:zt(ue,"quality"),budgetKind:zt(d,"budgetKind"),finalization:zt(d,"finalization")})}z=Pu(z,u.type,d,u.time);break}case"child.escalated":{const se=go(d);if(se){const ue=zt(d,"action"),ie=g[se],Se=!ie||ie.status==="running"||ie.status==="finalizing"||ie.status==="escalating";g[se]=vo(ie,{name:zt(d,"name"),status:Se?ue==="finalizing"?"finalizing":ue==="interrupted"?"interrupted":"escalating":ie==null?void 0:ie.status,escalateKind:zt(d,"kind"),escalateReason:zt(d,"reason"),escalateAction:ue,budgetKind:zt(d,"kind")||(ie==null?void 0:ie.budgetKind)})}z=Pu(z,u.type,d,u.time);break}case"children.seed":{const se=Array.isArray(d.sessions)?d.sessions:[];for(const ue of se){const ie=String(ue.id??ue.ID??"").trim();if(!ie||g[ie])continue;const Se=zt(ue,"title")||zt(ue,"Title"),Ge=!!(ue.open??ue.Open);g[ie]={agent:Se,status:Ge?"running":"unknown"}}break}case"team.roster":case"delegation.changed":case"agent.message":case"path.overlap":case"artifact.updated":case"ledger.updated":case"team.unavailable":z=Pu(z,u.type,d,u.time);break;case"team.snapshot":z=gv(z,d);break;case"engine.error":h=xa(h,{id:`error:${h.length}`,kind:"error",text:it(d,"message")});break;case"provider.retrying":h=xa(h,{id:`retry:${h.length}`,kind:"system",title:"Retrying provider",text:it(d,"error")});break;case"prompt.effective":{Q=Ev(d.layers),$=Av(d.attribution)??$,le=Os(d.pinnedKinds),ye=Os(d.excludedKinds),ee=Os(d.shedKinds),_=d.fromLastStream?"last":"current",typeof d.systemChars=="number"&&(pe=d.systemChars),typeof d.messageCount=="number"&&(W=d.messageCount);const se=Cv((J=d.attribution)==null?void 0:J.total);se!==void 0&&(y={...y,contextUsed:y.contextUsed??se});break}case"context.controls":{le=Os(d.pinnedKinds),ye=Os(d.excludedKinds),Q=Q.map(se=>({...se,pinned:le.includes(se.kind)}));break}case"context.fit_warning":{const se=it(d,"level")||"warn",ue=it(d,"message")||`context fit ${se}`;B={level:se,message:ue,estimatedTokens:typeof d.estimatedTokens=="number"?d.estimatedTokens:void 0,contextLimit:typeof d.contextLimit=="number"?d.contextLimit:void 0,source:d.source!==void 0?String(d.source):void 0},typeof d.contextLimit=="number"&&d.contextLimit>0&&(y={...y,contextLimit:d.contextLimit}),typeof d.estimatedTokens=="number"&&d.estimatedTokens>0&&(y={...y,contextUsed:y.contextUsed??d.estimatedTokens});break}}return{...a,seen:o,items:h,status:y,permission:b,question:v,children:g,team:z,changedFiles:C,undoStack:O,attribution:$,layers:Q,pinnedKinds:le,excludedKinds:ye,shedKinds:ee,fitWarning:B,promptScope:_,systemChars:pe,messageCount:W}}const Ov=()=>({draft:"",queue:[],images:[],fast:!1}),kl=(a="")=>({...mp(),status:a?{sessionId:a}:{},...Ov()}),zv=()=>({selectedID:"",byID:{}});function bo(a){return{items:a.items,seen:a.seen,status:a.status,permission:a.permission,question:a.question,children:a.children,team:a.team||Ri(),changedFiles:a.changedFiles,undoStack:a.undoStack,attribution:a.attribution,layers:a.layers,pinnedKinds:a.pinnedKinds,excludedKinds:a.excludedKinds,shedKinds:a.shedKinds,fitWarning:a.fitWarning,promptScope:a.promptScope,systemChars:a.systemChars,messageCount:a.messageCount}}function Dv(a,u){switch(u.type){case"client.select":return{...a,selectedID:u.id};case"client.ensure":return a.byID[u.id]?a.selectedID===u.id?a:{...a,selectedID:u.id}:{...a,selectedID:u.id,byID:{...a.byID,[u.id]:kl(u.id)}};case"client.reset":{const r=a.byID[u.id],o=kl(u.id);return r&&(o.draft=r.draft,o.queue=r.queue,o.images=r.images,o.fast=r.fast),{...a,byID:{...a.byID,[u.id]:o}}}case"client.event":{const r=a.byID[u.id]||kl(u.id);if(u.envelope.type==="workspace.reset"){const d=kl(u.id);return d.draft=r.draft,d.queue=r.queue,d.images=r.images,d.fast=r.fast,{...a,byID:{...a.byID,[u.id]:d}}}const o=km(bo(r),u.envelope);return{...a,byID:{...a.byID,[u.id]:{...r,...o}}}}case"client.events":{const r=a.byID[u.id]||kl(u.id);let o=r,d=bo(r);for(const h of u.envelopes){if(h.type==="workspace.reset"){const y=kl(u.id);y.draft=o.draft,y.queue=o.queue,y.images=o.images,y.fast=o.fast,o=y,d=bo(y);continue}d=km(d,h),o={...o,...d}}return{...a,byID:{...a.byID,[u.id]:o}}}case"client.composer":{const r=a.byID[u.id]||kl(u.id);return{...a,byID:{...a.byID,[u.id]:{...r,...u.patch}}}}case"client.drop":{const{[u.id]:r,...o}=a.byID;return{selectedID:a.selectedID===u.id?"":a.selectedID,byID:o}}}}function Mv(a){return a.selectedID?a.byID[a.selectedID]||kl(a.selectedID):kl()}function Um(a,u){var h;const r=a.contextUsed!==void 0&&a.contextLimit!==void 0?`${a.contextUsed.toLocaleString()} / ${a.contextLimit.toLocaleString()}`:a.contextUsed!==void 0?`${a.contextUsed.toLocaleString()} used`:"not reported",o=[];a.inputTokens!==void 0&&o.push(`in ${a.inputTokens.toLocaleString()}`),a.outputTokens!==void 0&&o.push(`out ${a.outputTokens.toLocaleString()}`),a.cacheReadTokens!==void 0&&o.push(`cache ${a.cacheReadTokens.toLocaleString()}`);let d="Cost: unknown (no pricing catalog for this model)";if(u!=null&&u.hasCost&&(a.inputTokens!==void 0||a.outputTokens!==void 0)){let y=0,b=!1;if(a.inputTokens!==void 0&&(y+=a.inputTokens*u.inputPerM/1e6,b=!0),a.outputTokens!==void 0&&(y+=a.outputTokens*u.outputPerM/1e6,b=!0),b){let v;if(y>0&&y<.01)v="<$0.01";else{let g=y.toFixed(4).replace(/0+$/,"").replace(/\.$/,"");(!g||g==="-")&&(g="0"),v=`$${g}`}(a.inputTokens===void 0||a.outputTokens===void 0)&&(v+=" (partial)"),(a.usageSource==="estimated"||(h=a.usageSource)!=null&&h.startsWith("mixed"))&&(v+=" est."),d=`Cost: ${v}`}}else!(u!=null&&u.hasCost)&&o.length?d="Cost: unknown (pricing not in catalog)":o.length||(d="Cost: not reported");return[`Provider: ${a.provider||"—"}`,`Model: ${a.model||"—"}`,`Context: ${r}`,`Tokens: ${o.length?o.join(" · "):"not reported"}`,d].join(`
+`)}function wv(a,u){var d;const r=[];if(a.inputTokens!==void 0&&r.push(`in ${a.inputTokens.toLocaleString()}`),a.outputTokens!==void 0&&r.push(`out ${a.outputTokens.toLocaleString()}`),a.cacheReadTokens!==void 0&&r.push(`cache ${a.cacheReadTokens.toLocaleString()}`),!r.length)return"not reported";let o="";if(u!=null&&u.hasCost){let h=0,y=!1;if(a.inputTokens!==void 0&&(h+=a.inputTokens*u.inputPerM/1e6,y=!0),a.outputTokens!==void 0&&(h+=a.outputTokens*u.outputPerM/1e6,y=!0),y){if(h>0&&h<.01)o="<$0.01";else{let b=h.toFixed(4).replace(/0+$/,"").replace(/\.$/,"");(!b||b==="-")&&(b="0"),o=`$${b}`}(a.inputTokens===void 0||a.outputTokens===void 0)&&(o+=" partial"),(a.usageSource==="estimated"||(d=a.usageSource)!=null&&d.startsWith("mixed"))&&(o+=" est.")}}return o?`${o} · ${r.join(" · ")}`:r.join(" · ")}const fc=[{label:"/help",detail:"List available web commands",insert:"/help"},{label:"/export",detail:"Download conversation as markdown",insert:"/export"},{label:"/compact",detail:"Compact model history",insert:"/compact"},{label:"/prompt",detail:"Inspect effective prompt",insert:"/prompt"},{label:"/context",detail:"Refresh context doctor",insert:"/context"},{label:"/rewind",detail:"Undo last turn — chat only or chat and files",insert:"/rewind"},{label:"/rewind-files",detail:"Undo last turn with file restore preview",insert:"/rewind-files"},{label:"/interrupt",detail:"Stop the running turn",insert:"/interrupt"},{label:"/queue",detail:"Focus the prompt queue browser",insert:"/queue"},{label:"/rename",detail:"Rename the current session",insert:"/rename "},{label:"/fork",detail:"Fork the current session",insert:"/fork"},{label:"/cost",detail:"Show session cost / context usage",insert:"/cost"},{label:"/copy",detail:"Copy last assistant reply",insert:"/copy"},{label:"/fast",detail:"Toggle fast mode (on|off)",insert:"/fast"},{label:"/agent",detail:"Select agent by name",insert:"/agent "},{label:"/effort",detail:"Set effort (low|medium|high|xhigh)",insert:"/effort "},{label:"/autonomy",detail:"Set autonomy (supervised|agent|checks)",insert:"/autonomy "},{label:"/mode",detail:"Set permission mode",insert:"/mode "},{label:"/model",detail:"Select model [provider/model]",insert:"/model "},{label:"/provider",detail:"Select provider",insert:"/provider "}],_v=new Set(fc.map(a=>a.label.slice(1)));function kv(a,u){if(!u)return!0;const r=[...u];let o=0;for(const d of a)if(d===r[o]&&(o++,o===r.length))return!0;return!1}function Uv(a,u){const r=u.toLowerCase().replace(/^\//,""),o=[[],[],[]];for(const d of a){const h=d.label.toLowerCase().replace(/^\//,"");let y=-1;h===r?y=0:h.startsWith(r)?y=1:kv(h,r)&&(y=2),y>=0&&o[y].push(d)}return o.flat()}function Rm(a,u){if(u<=0)return null;const r=a.indexOf(`
+`),o=r<0?a.length:r;if(u>o||!a.startsWith("/"))return null;let d=0;for(;dd?null:{query:a.slice(1,Math.min(u,d)),start:0,end:d}}function Rv(a,u=[]){const r=a.trim();if(!r.startsWith("/"))return{kind:"pass"};const o=r.search(/\s/),d=(o<0?r:r.slice(0,o)).toLowerCase(),h=o<0?"":r.slice(o+1).trim();if(!d.startsWith("/")||d==="/")return{kind:"unknown",command:d||"/"};const y=d.slice(1);if(u.some(v=>v.toLowerCase()===y))return{kind:"pass"};if(!_v.has(y))return{kind:"unknown",command:d};switch(y){case"help":return{kind:"help"};case"export":return{kind:"export"};case"queue":return{kind:"queue"};case"cost":return{kind:"cost"};case"copy":return{kind:"copy"};case"fork":return{kind:"fork"};case"compact":return{kind:"op",type:"compact",data:{strategy:"summarize"}};case"prompt":case"context":return{kind:"op",type:"inspect.prompt"};case"rewind":return{kind:"op",type:"rewind",data:{}};case"rewind-files":return{kind:"op",type:"rewind",data:{restoreFiles:!0}};case"interrupt":return{kind:"op",type:"interrupt"};case"rename":return{kind:"rename",title:h};case"fast":return h?h==="on"||h==="true"||h==="1"?{kind:"fast",enabled:!0}:h==="off"||h==="false"||h==="0"?{kind:"fast",enabled:!1}:{kind:"usage",message:"usage: /fast [on|off]"}:{kind:"fast"};case"agent":return h?{kind:"op",type:"select.agent",data:{name:h}}:{kind:"usage",message:"usage: /agent "};case"effort":return h?{kind:"op",type:"set.effort",data:{level:h}}:{kind:"usage",message:"usage: /effort "};case"autonomy":return h?{kind:"op",type:"set.autonomy",data:{mode:h}}:{kind:"usage",message:"usage: /autonomy "};case"mode":return h?{kind:"op",type:"set.permission_mode",data:{mode:h}}:{kind:"usage",message:"usage: /mode "};case"provider":return h?{kind:"op",type:"select.model",data:{provider:h}}:{kind:"usage",message:"usage: /provider "};case"model":{if(!h)return{kind:"usage",message:"usage: /model "};const v=h.indexOf("/");return v>0?{kind:"op",type:"select.model",data:{provider:h.slice(0,v),model:h.slice(v+1)}}:{kind:"op",type:"select.model",data:{model:h}}}default:return{kind:"unknown",command:d}}}function Lm(a=[]){const u=["Web slash commands:",...fc.map(r=>` ${r.label.padEnd(16)} ${r.detail}`)];if(a.length){u.push("","Skills:");for(const r of a)u.push(` /${r.name.padEnd(15)} ${r.description||"Skill"}`)}return u.push("","Unknown /commands are rejected with feedback (not sent as prompts)."),u.join(`
+`)}const Ro=["chat","code","team","project","ops"],ki={chat:{id:"chat",label:"Chat",description:"Transcript and composer",primarySurface:"transcript"},code:{id:"code",label:"Code",description:"Files, diffs, and diagnostics",primarySurface:"files",defaultSurface:"files"},team:{id:"team",label:"Team",description:"Agents, roster, and handoffs",primarySurface:"roster",defaultSurface:"roster"},project:{id:"project",label:"Project",description:"Plans, goals, issues, memory, workflows",primarySurface:"plans",defaultSurface:"plans"},ops:{id:"ops",label:"Ops",description:"Providers, settings, MCP, plugins, panes, diagnostics",primarySurface:"settings",defaultSurface:"settings"}},Oo=[{id:"transcript",label:"Transcript",modes:["chat"],capability:"always",attention:"none",lazyMount:!1,attach:"read",placement:{desktop:"canvas",tablet:"canvas",phone:"canvas"}},{id:"composer",label:"Composer",modes:["chat"],capability:"live",attention:"none",lazyMount:!1,attach:"mutate-blocked",placement:{desktop:"canvas",tablet:"canvas",phone:"canvas"}},{id:"sessions-rail",label:"Sessions",modes:"any",capability:"sessions",attention:"badge",lazyMount:!1,attach:"read",placement:{desktop:"rail",tablet:"sheet",phone:"sheet"}},{id:"runtime",label:"Runtime",modes:["chat"],capability:"live",attention:"none",lazyMount:!1,attach:"mutate-blocked",placement:{desktop:"chrome",tablet:"chrome",phone:"sheet"}},{id:"asks",label:"Asks",modes:["chat"],capability:"live",attention:"needs-you",lazyMount:!1,attach:"mutate-blocked",placement:{desktop:"dialog",tablet:"dialog",phone:"dialog"}},{id:"context",label:"context",modes:["chat","ops"],capability:"always",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:10,modeOrder:{ops:280}},{id:"files",label:"files",modes:["code"],capability:"files",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:20},{id:"diagnostics",label:"diagnostics",modes:["code","ops"],capability:"lsp",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:30,modeOrder:{ops:270}},{id:"roster",label:"agents",modes:["team"],capability:"team",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:40},{id:"artifacts",label:"artifacts",modes:["team","project"],capability:"artifacts",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:42,modeOrder:{team:42,project:45}},{id:"ledger",label:"decisions",modes:["team","project"],capability:"ledger",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:44,modeOrder:{team:44,project:46}},{id:"review",label:"review",modes:["team"],capability:"team",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:46,modeOrder:{team:46}},{id:"timeline",label:"timeline",modes:["ops","team"],capability:"timeline",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:50,modeOrder:{ops:290,team:50}},{id:"plans",label:"plans",modes:["project"],capability:"plans",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:60},{id:"goals",label:"goals",modes:["project"],capability:"goals",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:70},{id:"issues",label:"issues",modes:["project"],capability:"issues",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:80},{id:"memory",label:"memory",modes:["project"],capability:"memory",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:90},{id:"workflows",label:"workflows",modes:["project"],capability:"workflows",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:100},{id:"project-export",label:"exports",modes:["project"],capability:"project-export",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:105},{id:"settings",label:"settings",modes:["ops"],capability:"settings",attention:"none",lazyMount:!0,attach:"mutate-blocked",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:200},{id:"providers",label:"providers",modes:["ops"],capability:"auth",attention:"none",lazyMount:!0,attach:"mutate-blocked",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:210},{id:"auth",label:"auth",modes:["ops"],capability:"auth",attention:"none",lazyMount:!0,attach:"mutate-blocked",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:215},{id:"permissions",label:"permissions",modes:["ops"],capability:"permissions",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:220},{id:"sandbox",label:"sandbox",modes:["ops"],capability:"sandbox",attention:"none",lazyMount:!0,attach:"mutate-blocked",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:225},{id:"theme",label:"theme",modes:["ops"],capability:"settings",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:230},{id:"mcp",label:"mcp",modes:["ops"],capability:"mcp",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:240},{id:"plugins",label:"plugins",modes:["ops"],capability:"plugins",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:250},{id:"panes",label:"panes",modes:["ops"],capability:"panes",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:260},{id:"diag-export",label:"diagnostics export",modes:["ops"],capability:"diag",attention:"none",lazyMount:!0,attach:"mutate-blocked",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:300}],rc=new Map;function Lv(a){!a.id||Oo.some(u=>u.id===a.id)||rc.set(a.id,a)}function xo(){rc.clear()}function qv(a){const u=String(a.id||"").trim();if(!u)return;const r=u.replace(/[^\w.:@+-]+/g,"-").slice(0,96);if(!r)return;const o=r.startsWith("pane:")?r:`pane:${r}`,d=String(a.title||u).replace(/[\u0000-\u001f\u007f]/g,"").slice(0,64);return{id:o,label:d||o,modes:["chat","ops"],capability:"panes",attention:a.loadError?"badge":"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:265}}function pp(){return rc.size===0?[...Oo]:[...Oo,...rc.values()]}const Bv=()=>new Map(pp().map(a=>[a.id,a]));function ks(a){return Bv().get(a)}function Lo(a){return Ro.includes(a)}function yp(a,u){return a.modes==="any"?!0:a.modes.includes(u)}function gp(a,u,r){const o=a.capability;return o==="always"?!0:o==="live"?!!((r==null?void 0:r.isLive)??(u==null?void 0:u.live)):o==="team"?!0:o==="sessions"?!!(u!=null&&u.sessions||u!=null&&u.roots):o==="project-export"?!!(u!=null&&u.memory||u!=null&&u.issues||u!=null&&u.plans||u!=null&&u.goals||u!=null&&u.workflows):u?!!u[o]:!1}function vp(a,u){return u?a.attach!=="hidden":!0}function bp(a={}){const u=new Set(a.forceIds||[]);return pp().filter(r=>!(a.inspectorOnly&&!r.inspector||a.mode&&!yp(r,a.mode)&&!u.has(r.id)||!vp(r,a.attachOnly)&&!u.has(r.id)||!gp(r,a.caps,{isLive:a.isLive})&&!u.has(r.id))).sort((r,o)=>qm(r,a.mode)-qm(o,a.mode))}function qm(a,u){return u&&a.modeOrder&&a.modeOrder[u]!==void 0?a.modeOrder[u]:a.order??500}function Hv(a,u,r){return bp({mode:a,caps:u,attachOnly:r==null?void 0:r.attachOnly,isLive:r==null?void 0:r.isLive,forceIds:r==null?void 0:r.forceIds,inspectorOnly:!0})}function zo(a,u,r){return a!=="chat"?Hv(a,u,r):bp({caps:u,attachOnly:r==null?void 0:r.attachOnly,isLive:r==null?void 0:r.isLive,forceIds:r==null?void 0:r.forceIds,inspectorOnly:!0})}function Yv(a,u={}){switch(a){case"code":return(u.changedFiles??0)>0?"badge":"none";case"team":return u.permissionPending||u.questionPending?"needs-you":(u.teamMembers??0)>0?"badge":"none";case"chat":return u.permissionPending||u.questionPending?"needs-you":u.fitWarning||u.contextWarning?"badge":"none";default:return"none"}}function Do(a,u,r){var h;const o=ki[a],d=zo(a,u,r);if(r!=null&&r.preferred){const y=d.find(b=>b.id===r.preferred);if(y)return y.id;if(ks(r.preferred))return r.preferred}if(o.defaultSurface){const y=d.find(b=>b.id===o.defaultSurface);if(y)return y.id}return(h=d[0])==null?void 0:h.id}function Gv(a){const u=!!(a.mode&&Lo(a.mode));let r=u?a.mode:"chat";u||(a.path?r="code":a.agent?r="team":a.pane?r="ops":r="chat");let o=(a.surface||"").trim();if(a.pane&&!o&&(o="panes"),a.path&&!o&&(o="files"),a.agent&&!o&&(o="roster"),o){const h=ks(o);if(!h)return o=Do(r,a.caps,{attachOnly:a.attachOnly,isLive:a.isLive})||"",{mode:r,surface:o||void 0,openDrawer:!!o&&r!=="chat"};if(!yp(h,r)&&h.modes!=="any"){const v=Array.isArray(h.modes)?h.modes[0]:"chat";u||(r=v)}const y=gp(h,a.caps,{isLive:a.isLive}),b=vp(h,a.attachOnly);return!y||!b?{mode:r,surface:h.id,openDrawer:!!h.inspector,unavailable:{id:h.id,reason:b?`capability ${String(h.capability)} unavailable`:"hidden in attach-only"}}:{mode:r,surface:h.id,openDrawer:!!h.inspector||h.placement.desktop==="drawer"}}if(r==="chat")return{mode:"chat",openDrawer:!1};const d=Do(r,a.caps,{attachOnly:a.attachOnly,isLive:a.isLive});return r==="ops"&&!d?{mode:r,surface:"settings",openDrawer:!1}:{mode:r,surface:d,openDrawer:!!d}}const $v="The TUI /loop shortcut is superseded here by Goals and Workflows. Use Project → goals or workflows for durable automation.";function Xv(a){const u=[];for(const o of Ro){const d=ki[o];u.push({id:`mode:${o}`,label:`Mode: ${d.label}`,detail:d.description,keywords:`mode ${o} ${d.label}`,action:{type:"mode",mode:o}})}const r=[{mode:"code",surface:"files",label:"Files"},{mode:"team",surface:"roster",label:"Team roster"},{mode:"project",surface:"plans",label:"Plans"},{mode:"project",surface:"goals",label:"Goals"},{mode:"project",surface:"issues",label:"Issues"},{mode:"project",surface:"memory",label:"Memory"},{mode:"ops",surface:"mcp",label:"MCP"},{mode:"ops",surface:"plugins",label:"Plugins"},{mode:"ops",surface:"settings",label:"Settings surface"},{mode:"ops",surface:"timeline",label:"Timeline"},{mode:"chat",surface:"context",label:"Context doctor"}];for(const o of r)u.push({id:`surface:${o.surface}`,label:`Open ${o.label}`,detail:`${ki[o.mode].label} · ${o.surface}`,keywords:`${o.label} ${o.surface} ${o.mode}`,action:{type:"surface",mode:o.mode,surface:o.surface},requiresCapability:o.surface==="settings"?"settings":void 0});for(const o of fc)u.push({id:`slash:${o.label}`,label:o.label,detail:o.detail,keywords:`slash command ${o.label} ${o.detail}`,action:{type:"slash",insert:o.insert,run:o.insert==="/help"||o.insert==="/cost"||o.insert==="/export"},requiresLive:!["/help","/export","/cost","/copy"].includes(o.label)});for(const o of a.skills||[])u.push({id:`skill:${o.name}`,label:`/${o.name}`,detail:o.description||"Skill",keywords:`skill ${o.name}`,action:{type:"slash",insert:`/${o.name} `},requiresLive:!0});return u.push({id:"session:settings",label:"Settings",detail:"Open settings dialog",keywords:"settings preferences config",action:{type:"session",action:"settings"},requiresCapability:"settings"},{id:"session:export",label:"Export transcript",detail:"Download markdown export",action:{type:"session",action:"export"}},{id:"session:help",label:"Help",detail:"Show web slash commands",action:{type:"session",action:"help"}}),a.attachOnly&&u.push({id:"notice:attach",label:"Attach-only mode",detail:"Mutations are disabled in this session",action:{type:"notice",title:"Attach-only",body:"This cockpit is attach-only. Observation works; prompts and settings mutations are blocked server-side."}}),u}function Kv(a){return a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function So(a,u){return new RegExp(`(?:^|\\s)${Kv(u)}(?:\\s|$)`).test(a)}function Bm(a,u){const r=a.label.toLowerCase(),o=(a.detail||"").toLowerCase(),d=(a.keywords||"").toLowerCase();return r===u||r===`open ${u}`?400:a.action.type==="surface"&&a.action.surface.toLowerCase()===u?360:a.action.type==="mode"&&a.action.mode.toLowerCase()===u?350:r.startsWith(`${u} `)||r.startsWith(`open ${u}`)?300:So(r,u)?250:r.includes(u)?200:So(d,u)?80:d.includes(u)?60:So(o,u)?30:o.includes(u)?10:1}function Qv(a,u){const r=u.trim().toLowerCase();if(!r)return a.slice(0,50);const o=r.split(/\s+/).filter(Boolean);return a.filter(d=>{const h=`${d.label} ${d.detail} ${d.keywords||""}`.toLowerCase();return h.includes(r)||o.every(y=>h.includes(y))}).sort((d,h)=>Bm(h,r)-Bm(d,r)).slice(0,50)}function Mo(a){return a.length!==1?!1:"/\\.-_+~".includes(a)?!0:new RegExp("\\p{L}|\\p{N}","u").test(a)}const Ka={active:!1,query:"",start:-1};function Vv(a,u){if(u<0||u>a.length)return Ka;let r=u;for(;r>0;){const d=a[r-1];if(d===`
+`)return Ka;if(Mo(d)){r--;continue}if(d==="@"){r--;break}return Ka}if(r>=u||a[r]!=="@"||r>0&&!/\s/.test(a[r-1])||u<=r)return Ka;const o=a.slice(r+1,u);for(const d of o)if(!Mo(d))return Ka;return{active:!0,query:o,start:r}}function Hm(a,u=!1){return u?"file search unavailable":a===""?"no project files indexed (empty workdir or all ignored)":"no files match — try a fuller path; .plan/node_modules/… are hidden unless queried"}function Zv(a,u){let r=u+1;for(;rQv(u,d),[u,d]);if(T.useEffect(()=>{a&&(h(""),b(0),window.setTimeout(()=>{var C;return(C=v.current)==null?void 0:C.focus()},0))},[a]),T.useEffect(()=>{b(0)},[d]),!a)return null;const z=C=>{o(C),r()};return c.jsxs(up,{title:"Command palette",onClose:r,initialFocus:'input[aria-label="Filter commands"]',children:[c.jsx("input",{ref:v,className:"palette-input",type:"search",placeholder:"Search modes, surfaces, commands…","aria-label":"Filter commands",value:d,onChange:C=>h(C.target.value),onKeyDown:C=>{if(C.key==="ArrowDown")C.preventDefault(),b(O=>Math.min(g.length-1,O+1));else if(C.key==="ArrowUp")C.preventDefault(),b(O=>Math.max(0,O-1));else if(C.key==="Enter"){C.preventDefault();const O=g[y];O&&z(O)}else C.key==="Escape"&&(C.preventDefault(),r())}}),c.jsxs("ul",{className:"palette-list",role:"listbox","aria-label":"Commands",children:[g.map((C,O)=>c.jsx("li",{children:c.jsx(Pg,{role:"option",active:O===y,title:C.label,meta:C.detail,onMouseEnter:()=>b(O),onClick:()=>z(C)})},C.id)),!g.length&&c.jsx("li",{className:"muted",children:"No matching commands"})]}),c.jsx("p",{className:"muted palette-hint",children:"↑↓ navigate · ↵ run · esc close"})]})}const Iv=()=>oe("/v1/providers"),Pv=(a,u)=>oe("/v1/auth/key",{method:"POST",body:JSON.stringify({provider:a,key:u})}),e0=a=>oe(`/v1/auth/${encodeURIComponent(a)}`,{method:"DELETE"}),t0=a=>oe("/v1/auth/device",{method:"POST",body:JSON.stringify({provider:a})}),n0=a=>oe(`/v1/auth/device/${encodeURIComponent(a)}`),l0=a=>oe(`/v1/auth/device/${encodeURIComponent(a)}`,{method:"DELETE"}),a0=a=>oe("/v1/auth/oauth",{method:"POST",body:JSON.stringify({provider:a})}),Ym=a=>oe(`/v1/auth/oauth/${encodeURIComponent(a)}`),i0=(a,u)=>oe(`/v1/auth/oauth/${encodeURIComponent(a)}/complete`,{method:"POST",body:JSON.stringify({paste:u})}),s0=a=>oe(`/v1/auth/oauth/${encodeURIComponent(a)}`,{method:"DELETE"}),u0=a=>{const u=a?`?provider=${encodeURIComponent(a)}`:"";return oe(`/v1/models${u}`)},jo=()=>oe("/v1/custom-providers"),c0=a=>oe("/v1/custom-providers",{method:"POST",body:JSON.stringify(a)}),r0=a=>oe(`/v1/custom-providers/${encodeURIComponent(a)}`,{method:"DELETE"}),o0=()=>oe("/v1/permissions/presets"),f0=(a,u="*",r="")=>{const o=new URLSearchParams({permission:a,pattern:u});return r&&o.set("preset",r),oe(`/v1/permissions/explain?${o}`)},Gm=()=>oe("/v1/scheduler/presets"),d0=a=>oe("/v1/scheduler/presets",{method:"POST",body:JSON.stringify({ids:a})}),h0=a=>{const u=a?`?root=${encodeURIComponent(a)}`:"";return oe(`/v1/config-sources${u}`)};function $m(a){return String(a.id||a.ID||"").trim()}function m0(a){const u=[],r=a.context??a.Context,o=a.output??a.Output;if(r&&u.push(`ctx ${r.toLocaleString()}`),o&&u.push(`out ${o.toLocaleString()}`),(a.toolCall||a.ToolCall)&&u.push("tools"),(a.reasoning||a.Reasoning)&&u.push("reasoning"),(a.attachment||a.Attachment)&&u.push("attachments"),a.hasCost??a.HasCost){const y=a.inputCost??a.InputCost??0,b=a.outputCost??a.OutputCost??0;u.push(`$${y}/$${b} per M`)}const h=a.source||a.Source;return h&&u.push(h),u.length?u.join(" · "):"limits unknown"}const p0={text:"--ink",textMuted:"--muted",accent:"--acid",accentAlt:"--accent-alt",highlight:"--highlight",success:"--success",warning:"--warning",error:"--signal",danger:"--danger",background:"--ground",surface:"--surface",surfaceFocus:"--raised",surfaceMuted:"--surface-muted",border:"--rule",borderFocus:"--border-focus",borderMuted:"--border-muted",userLabel:"--user",toolLabel:"--tool",diffAdded:"--diff-add",diffRemoved:"--diff-del",overlayScrim:"--overlay"},wo="strike-theme-override",y0="strike.web.theme.preview";function Va(a){return String(a.id||a.ID||"").trim()}function g0(a){return String(a.name||a.Name||Va(a)||"theme").trim()}function v0(a){return String(a.provenance||a.Provenance||"builtin").trim()}function zs(a){return a.colors||a.Colors||{}}function Xm(a){if(!a)return;const u=a.trim().toLowerCase();if(/^#[0-9a-f]{3}([0-9a-f]{3})?([0-9a-f]{2})?$/.test(u))return u}function b0(a,u=!0){if(a==="light")return"light";if(a==="dark")return"dark";if(typeof window<"u"&&window.matchMedia)try{if(window.matchMedia("(prefers-color-scheme: light)").matches)return"light";if(window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark"}catch{}return u?"dark":"light"}function x0(a,u){const r={};for(const[o,d]of Object.entries(p0)){const h=a[o];if(!h)continue;const y=u==="light"?h.light:h.dark,b=Xm(y)||Xm(u==="light"?h.dark:h.light);b&&(r[d]=b)}return r["--surface-muted"]&&(r["--code-bg"]=r["--surface-muted"]),r["--ground"]&&(r["--mark-ink"]=u==="light"?"#ffffff":r["--ground"],r["--header-bg"]=u==="light"?`${r["--ground"]}f0`:`${r["--ground"]}e8`),r["--acid"]&&(r["--glow"]=`${r["--acid"]}66`),r["--rule"]&&(r["--idle"]=r["--rule"]),r["--rule"]&&(r["--cap-border"]=r["--rule"]),r}function S0(){if(typeof document>"u")return null;let a=document.getElementById(wo);return a||(a=document.createElement("style"),a.id=wo,document.head.appendChild(a)),a}function Ds(a,u){const r=S0();if(!r)return;const o=b0(u),d=x0(a,o);if(Object.keys(d).length===0){r.textContent="";return}const h=Object.entries(d).map(([y,b])=>` ${y}: ${b};`).join(`
+`);r.textContent=`:root {
+${h}
+}`}function Km(){const a=typeof document<"u"?document.getElementById(wo):null;a&&(a.textContent="");try{sessionStorage.removeItem(y0)}catch{}}const j0=a=>{const u=a?`?root=${encodeURIComponent(a)}`:"";return oe(`/v1/themes${u}`)},T0=a=>oe("/v1/settings",{method:"PATCH",body:JSON.stringify({theme:a})}),E0=["","off","low","medium","high","xhigh"],A0=["","default","plan","soft-approve","accept-edits","yolo"],C0=["","workspace-write","read-only","off"],N0=["","unfocused-only","on","off"],O0=["","lite","full","off"],z0=["","off","5","10","15","30","45","60"],D0=["","default","1","2","3","4","5","6","7","8"],M0=["","trim","summarize"],w0=["","default","0.60","0.70","0.80","0.85","1"],_0=["","default","1024","2048","4096","8192"],k0=["","default","1","2","3","4"],U0=["bash","write","edit","webfetch","task","skill"],R0=["auto","dark","light"],xp="strike.web.appearance";function _o(){try{const a=localStorage.getItem(xp);if(a==="dark"||a==="light"||a==="auto")return a}catch{}return"auto"}function Sp(a){const u=document.documentElement;a==="auto"?u.removeAttribute("data-appearance"):u.setAttribute("data-appearance",a);try{localStorage.setItem(xp,a)}catch{}}function mn({label:a,value:u,values:r,disabled:o,onChange:d}){return c.jsxs("label",{children:[a,c.jsx("select",{"aria-label":a,value:u,disabled:o,onChange:h=>d(h.target.value),children:r.map(h=>c.jsx("option",{value:h,children:h||"— leave unchanged"},h||"(unset)"))})]})}function nc({label:a,value:u,disabled:r,placeholder:o,onChange:d}){return c.jsxs("label",{children:[a,c.jsx("input",{"aria-label":a,value:u,disabled:r,placeholder:o,onChange:h=>d(h.target.value)})]})}function lc(a,u="off"){return a==null?"":a===0?u:String(a)}function L0(a){return a==null||a===0?"":String(a)}function q0({boot:a,status:u,providers:r,onClose:o,rootID:d,isLive:h}){var hl,nt,Pe,Hl;const[y,b]=T.useState(!1),[v,g]=T.useState(!1),[z,C]=T.useState(""),[O,$]=T.useState(()=>_o()),[Q,le]=T.useState([]),[ye,ee]=T.useState(""),[B,_]=T.useState(String(u.provider||r[0]||"")),[pe,W]=T.useState(""),[me,P]=T.useState(!1),[J,se]=T.useState(null),[ue,ie]=T.useState(null),[Se,Ge]=T.useState(""),[St,st]=T.useState([]),[U,K]=T.useState([]),[I,te]=T.useState({name:"",baseURL:"",api:"openai",models:""}),[fe,S]=T.useState([]),[R,X]=T.useState(""),[V,de]=T.useState("bash"),[ge,Ee]=T.useState("*"),[ut,ze]=T.useState(""),[sl,en]=T.useState([]),[Rt,Hn]=T.useState([]),[Mn,Yn]=T.useState([]),[pn,Li]=T.useState([]),[Gn,Ul]=T.useState(!1),[Lt,ul]=T.useState(""),[qt,wn]=T.useState(""),[gt,Rl]=T.useState(""),[$n,Bt]=T.useState(!1),[_n,vt]=T.useState(""),[tn,cl]=T.useState(""),[Xn,yn]=T.useState(""),[Je,Ht]=T.useState(""),[We,gn]=T.useState(""),[kn,Ja]=T.useState(""),[$t,Kn]=T.useState(""),[vn,bn]=T.useState(""),[Qn,xn]=T.useState(""),[Wa,ja]=T.useState([]),[Vn,nn]=T.useState(!1),[Zn,rl]=T.useState(""),[ol,Ta]=T.useState(""),[Jn,Sn]=T.useState(""),[$e,fl]=T.useState(""),[Xt,Fe]=T.useState(""),[tt,jt]=T.useState(""),[Un,Ll]=T.useState(""),Dt=!!(a!=null&&a.capabilities.settings),Wn=!!(a!=null&&a.capabilities.auth),Kt=!!(a!=null&&a.capabilities.providers),Fn=!!(a!=null&&a.capabilities.permissions),Yt=!!(a!=null&&a.capabilities.scheduler),Mt=!!(a!=null&&a.capabilities.configFiles),Qe=!!(a&&!a.attachOnly),Tt=async()=>{var E;if(Wn)try{const G=await Iv();le(G.providers||[]),ee(G.oauthNote||""),!B&&((E=G.providers)!=null&&E.length)&&_(G.providers[0].name)}catch(G){C(G.message)}};T.useEffect(()=>{Tt()},[Wn]),T.useEffect(()=>{!Wn||!B||u0(B).then(E=>st(E.models||[])).catch(()=>st([]))},[Wn,B]),T.useEffect(()=>{Kt&&jo().then(E=>K(E.providers||[])).catch(()=>K([]))},[Kt]),T.useEffect(()=>{Fn&&o0().then(E=>S(E.presets||[])).catch(()=>S([]))},[Fn]),T.useEffect(()=>{Yt&&Gm().then(E=>{var G;en(E.presets||[]),Hn([...((G=E.global)==null?void 0:G.presets)||[]])}).catch(()=>{})},[Yt]),T.useEffect(()=>{Mt&&h0(d).then(E=>Yn(E.sources||[])).catch(()=>Yn([]))},[Mt,d]),T.useEffect(()=>{if(!J||J.status!=="pending")return;const E=window.setInterval(()=>{n0(J.id).then(G=>{se(G),G.status==="completed"&&Tt()}).catch(()=>{})},1500);return()=>window.clearInterval(E)},[J==null?void 0:J.id,J==null?void 0:J.status]),T.useEffect(()=>{if(!ue||ue.status!=="pending")return;const E=window.setInterval(()=>{Ym(ue.id).then(G=>{ie(G),G.status==="completed"&&Tt()}).catch(()=>{})},1500);return()=>window.clearInterval(E)},[ue==null?void 0:ue.id,ue==null?void 0:ue.status]);const Ie=((hl=a==null?void 0:a.agents)==null?void 0:hl.map(E=>E.name))||[],Et=!!(a!=null&&a.capabilities.themes||a!=null&&a.capabilities.settings);T.useEffect(()=>{Et&&(Ul(!0),j0(d).then(E=>{Li(E.themes||[]);const G=(E.active||"").trim();ul(G),Rl(G),wn(G);const De=(E.themes||[]).find(pt=>Va(pt)===G);De&&Ds(zs(De),_o())}).catch(()=>{}).finally(()=>Ul(!1)))},[Et,d]),T.useEffect(()=>{Dt&&(b(!0),C(""),oe("/v1/settings").then(E=>{vt(E.provider||""),cl(E.model||""),yn(E.agent||""),Ht(E.effort||""),gn(E.mode||""),Ja(E.sandbox||""),Kn(E.notify||""),bn(E.leanCode||""),xn(lc(E.permissionAutoApproveSeconds,"off")),ja([...E.permissionAutoApproveExclude||[]]),nn(!1),rl(lc(E.maxChildDepth,"default")),Ta(E.compactionStrategy||""),Sn(E.compactionModel||""),fl(L0(E.compactionThreshold)),Fe(lc(E.compactionBuffer,"default")),jt(lc(E.keepUserTurns,"default")),Ll((E.pruneProtectTools||[]).join(", ")),E.theme&&(ul(E.theme),Rl(E.theme),wn(G=>G||E.theme||""))}).catch(E=>C(E.message)).finally(()=>b(!1)))},[Dt]);const ql=E=>{$(E),Sp(E);const G=qt||Lt,De=pn.find(pt=>Va(pt)===G);De&&Ds(zs(De),E)},ln=E=>{wn(E);const G=pn.find(De=>Va(De)===E);G?Ds(zs(G),O):E||Km()},jn=()=>{const E=gt||Lt||"";wn(E);const G=pn.find(De=>Va(De)===E);G?Ds(zs(G),O):Km()},dl=async()=>{const E=(qt||"").trim();if(!(!E||!Dt)){Bt(!0),C("");try{const De=(await T0(E)).theme||E;ul(De),Rl(De),wn(De);const pt=pn.find(Vt=>Va(Vt)===De);pt&&Ds(zs(pt),O)}catch(G){C(G.message),jn()}finally{Bt(!1)}}},Qt=E=>{nn(!0),ja(G=>G.includes(E)?G.filter(De=>De!==E):[...G,E])},Ea=async E=>{if(E==null||E.preventDefault(),!Dt){o();return}g(!0),C("");const G={};_n&&(G.provider=_n),tn&&(G.model=tn),Xn&&(G.agent=Xn),Je&&(G.effort=Je),We&&(G.mode=We),kn&&(G.sandbox=kn),$t&&(G.notify=$t),vn&&(G.leanCode=vn),Qn&&(G.permissionAutoApproveSeconds=Qn),Vn&&(G.permissionAutoApproveExclude=Wa),Zn&&(G.maxChildDepth=Zn),ol&&(G.compactionStrategy=ol),Jn.trim()&&(G.compactionModel=Jn.trim()),$e&&(G.compactionThreshold=$e),Xt&&(G.compactionBuffer=Xt),tt&&(G.keepUserTurns=tt),Un.trim()&&(G.pruneProtectTools=Un.trim()),!G.provider&&!G.model&&!G.agent&&!G.effort&&!G.mode&&u.provider&&Object.keys(G).length===0&&(G.provider=String(u.provider||""),G.model=String(u.model||""),G.agent=String(u.agent||""),G.effort=String(u.effort||""),G.mode=String(u.permissionMode||""));try{Object.keys(G).length>0&&await oe("/v1/settings",{method:"PATCH",body:JSON.stringify(G)}),o()}catch(De){C(De.message)}finally{g(!1)}},Fa=async()=>{if(Dt){g(!0),C("");try{await oe("/v1/settings",{method:"PATCH",body:JSON.stringify({provider:String(u.provider||""),model:String(u.model||""),agent:String(u.agent||""),effort:String(u.effort||""),mode:String(u.permissionMode||"")})}),vt(String(u.provider||"")),cl(String(u.model||"")),yn(String(u.agent||"")),Ht(String(u.effort||"")),gn(String(u.permissionMode||""))}catch(E){C(E.message)}finally{g(!1)}}},Bl=!Dt||y?c.jsx(mt,{type:"button",onClick:o,children:"Close"}):void 0;return c.jsxs(up,{title:"Workspace settings",className:"settings-dialog",wide:!0,mode:"modal",onClose:o,actions:Bl,children:[Wn?c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Provider authentication"}),c.jsx("p",{className:"muted",children:"Credential values are never shown. Methods reflect host capabilities."}),c.jsxs("div",{className:"provider-rows",role:"list","aria-label":"Providers",children:[Q.map(E=>c.jsxs("article",{className:"provider-row",role:"listitem",children:[c.jsxs("header",{children:[c.jsx("strong",{children:E.name}),c.jsx("span",{className:E.authed?"badge ok":"badge",children:E.authed?"authenticated":E.detail||"none"})]}),c.jsxs("p",{className:"muted",children:["methods: ",(E.methods||[]).join(", ")||"—",E.expiresAt?` · expires ${E.expiresAt}`:"",E.custom?" · custom":"",E.baseURL?` · ${E.baseURL}`:""]}),c.jsxs("div",{className:"panel-actions",children:[c.jsx(mt,{type:"button",disabled:!Qe||me,onClick:()=>_(E.name),children:"Select"}),E.authed&&!E.builtin&&c.jsx(mt,{type:"button",disabled:!Qe||me,onClick:()=>{P(!0),e0(E.name).then(()=>Tt()).catch(G=>C(G.message)).finally(()=>P(!1))},children:"Log out"})]})]},E.name)),!Q.length&&c.jsx("p",{className:"muted",children:"No providers reported."})]}),c.jsxs("label",{children:["Selected provider",c.jsxs("select",{value:B,onChange:E=>_(E.target.value),"aria-label":"Auth provider",disabled:!Qe,children:[Q.map(E=>c.jsx("option",{value:E.name,children:E.name},E.name)),!Q.length&&r.map(E=>c.jsx("option",{value:E,children:E},E))]})]}),((nt=Q.find(E=>E.name===B))==null?void 0:nt.apiKey)!==!1&&c.jsxs(c.Fragment,{children:[c.jsxs("label",{children:["API key",c.jsx("input",{value:pe,onChange:E=>W(E.target.value),placeholder:"Stored locally by strike — never echoed back","aria-label":"API key",disabled:!Qe||me,autoComplete:"off"})]}),c.jsx(mt,{type:"button",disabled:!Qe||!B||!pe||me,onClick:()=>{P(!0),C(""),Pv(B,pe).then(()=>(W(""),Tt())).catch(E=>C(E.message)).finally(()=>P(!1))},children:"Save key"})]}),((Pe=Q.find(E=>E.name===B))==null?void 0:Pe.device)&&c.jsxs("div",{className:"auth-device",children:[c.jsx(mt,{type:"button",disabled:!Qe||me||!!(J&&J.status==="pending"),onClick:()=>{P(!0),C(""),t0(B).then(E=>se(E)).catch(E=>C(E.message)).finally(()=>P(!1))},children:"Start device login"}),J&&c.jsxs("div",{className:"device-flow",role:"status","aria-live":"polite",children:[c.jsxs("p",{children:["Status: ",c.jsx("strong",{children:J.status})]}),J.userCode&&c.jsxs("p",{children:["Code: ",c.jsx("code",{children:J.userCode})]}),J.verificationUri&&c.jsxs("p",{children:["Open"," ",c.jsx("a",{href:J.verificationUri,target:"_blank",rel:"noopener noreferrer",children:J.verificationUri})]}),J.expiresAt&&c.jsxs("p",{className:"muted",children:["Expires ",J.expiresAt]}),J.message&&c.jsx("p",{className:"settings-error",children:J.message}),J.status==="pending"&&c.jsx(mt,{type:"button",onClick:()=>{l0(J.id).then(()=>se({...J,status:"canceled"}))},children:"Cancel"})]})]}),((Hl=Q.find(E=>E.name===B))==null?void 0:Hl.oauth)&&c.jsxs("div",{className:"auth-oauth",children:[c.jsx("p",{className:"muted",children:ye||"OAuth uses authorize URL + optional paste; no invented browser callback."}),c.jsx(mt,{type:"button",disabled:!Qe||me,onClick:()=>{P(!0),C(""),a0(B).then(E=>ie(E)).catch(E=>C(E.message)).finally(()=>P(!1))},children:"Start OAuth"}),ue&&c.jsxs("div",{className:"oauth-flow",role:"status",children:[c.jsxs("p",{children:["Status: ",c.jsx("strong",{children:ue.status})]}),ue.authorizeUrl&&c.jsx("p",{children:c.jsx("a",{href:ue.authorizeUrl,target:"_blank",rel:"noopener noreferrer",children:"Open authorize URL"})}),ue.status==="pending"&&c.jsxs(c.Fragment,{children:[c.jsxs("label",{children:["Paste redirect URL or code",c.jsx("input",{value:Se,onChange:E=>Ge(E.target.value),"aria-label":"OAuth paste",autoComplete:"off"})]}),c.jsx(mt,{type:"button",disabled:!Se.trim(),onClick:()=>{i0(ue.id,Se).then(()=>(Ge(""),Ym(ue.id))).then(E=>(ie(E),Tt())).catch(E=>C(E.message))},children:"Complete with paste"}),c.jsx(mt,{type:"button",onClick:()=>void s0(ue.id).then(()=>ie({...ue,status:"canceled"})),children:"Cancel"})]}),ue.message&&c.jsx("p",{className:"muted",children:ue.message})]})]}),!Qe&&c.jsx("p",{className:"muted",children:"Attach-only is read-only — status is visible; credential mutations are disabled."}),St.length>0&&c.jsxs("div",{className:"model-meta","aria-label":"Model metadata",children:[c.jsxs("h3",{children:["Models (",B,")"]}),c.jsx("ul",{children:St.slice(0,24).map(E=>c.jsxs("li",{children:[c.jsx("code",{children:$m(E)}),c.jsxs("span",{className:"muted",children:[" ",m0(E)]})]},$m(E)))})]})]}):c.jsx(po,{name:"Provider authentication"}),Kt&&c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Custom providers"}),c.jsx("p",{className:"muted",children:"Config only — set API keys via the auth section using the provider name. Credentials are never listed."}),c.jsx("ul",{className:"custom-provider-list",children:U.map(E=>c.jsxs("li",{children:[c.jsx("code",{children:E.name})," · ",E.api," · ",E.baseURL,c.jsx(mt,{type:"button",disabled:!Qe,onClick:()=>{r0(E.name).then(()=>jo()).then(G=>K(G.providers||[])).then(()=>Tt()).catch(G=>C(G.message))},children:"Remove"})]},E.name))}),c.jsxs("label",{children:["Name",c.jsx("input",{"aria-label":"Custom provider name",value:I.name,disabled:!Qe,onChange:E=>te({...I,name:E.target.value})})]}),c.jsxs("label",{children:["Base URL",c.jsx("input",{"aria-label":"Custom provider base URL",value:I.baseURL,disabled:!Qe,onChange:E=>te({...I,baseURL:E.target.value})})]}),c.jsxs("label",{children:["API",c.jsxs("select",{"aria-label":"Custom provider API",value:I.api,disabled:!Qe,onChange:E=>te({...I,api:E.target.value}),children:[c.jsx("option",{value:"openai",children:"openai"}),c.jsx("option",{value:"anthropic",children:"anthropic"})]})]}),c.jsxs("label",{children:["Models (comma-separated)",c.jsx("input",{"aria-label":"Custom provider models",value:I.models,disabled:!Qe,onChange:E=>te({...I,models:E.target.value})})]}),c.jsx(mt,{type:"button",disabled:!Qe||!I.name.trim()||!I.baseURL.trim(),onClick:()=>{const E=I.models.split(",").map(G=>G.trim()).filter(Boolean);c0({name:I.name.trim(),baseURL:I.baseURL.trim(),api:I.api,models:E}).then(()=>jo()).then(G=>{K(G.providers||[]),te({name:"",baseURL:"",api:"openai",models:""})}).then(()=>Tt()).catch(G=>C(G.message))},children:"Save custom provider"})]}),Fn&&c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Permission presets"}),c.jsx("ul",{children:fe.map(E=>{const G=String(E.id||E.ID||""),De=String(E.name||E.Name||G),pt=String(E.description||E.Description||"");return c.jsxs("li",{children:[c.jsx("strong",{children:De}),pt?` — ${pt}`:""]},G)})}),c.jsxs("label",{children:["Tool / permission",c.jsx("input",{"aria-label":"Permission name",value:V,onChange:E=>de(E.target.value)})]}),c.jsxs("label",{children:["Pattern",c.jsx("input",{"aria-label":"Permission pattern",value:ge,onChange:E=>Ee(E.target.value)})]}),c.jsxs("label",{children:["Dry-run preset",c.jsxs("select",{"aria-label":"Permission preset",value:ut,onChange:E=>ze(E.target.value),children:[c.jsx("option",{value:"",children:"(effective)"}),fe.map(E=>{const G=String(E.id||E.ID||"");return c.jsx("option",{value:G,children:String(E.name||E.Name||G)},G)})]})]}),c.jsx(mt,{type:"button",onClick:()=>{f0(V,ge||"*",ut).then(E=>X(String(E.Summary||E.summary||JSON.stringify(E,null,2)))).catch(E=>C(E.message))},children:"Explain"}),R&&c.jsx("pre",{className:"permission-explain-body","aria-label":"Permission explanation",children:R})]}),Yt&&c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Scheduler presets"}),c.jsx("p",{className:"muted",children:"Shipped build-system presets with effective global selection provenance."}),sl.map(E=>{const G=String(E.id||E.ID||""),De=String(E.name||E.Name||G),pt=Rt.includes(G);return c.jsxs("label",{className:"exclude-item",children:[c.jsx("input",{type:"checkbox",checked:pt,disabled:!Qe,"aria-label":`Scheduler preset ${De}`,onChange:()=>{Hn(Vt=>pt?Vt.filter(wt=>wt!==G):[...Vt,G])}}),De,c.jsx("span",{className:"muted",children:String(E.rationale||E.Rationale||"")})]},G)}),c.jsx(mt,{type:"button",disabled:!Qe,onClick:()=>{d0(Rt).then(()=>Gm()).then(E=>{var G;return Hn([...((G=E.global)==null?void 0:G.presets)||[]])}).catch(E=>C(E.message))},children:"Apply scheduler presets"}),c.jsxs("p",{className:"muted",children:["Enabled: ",Rt.length?Rt.join(", "):"(none)"]})]}),Mt&&c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Config sources"}),c.jsx("p",{className:"muted",children:"Typed inspection of global/project config surfaces (not a raw file editor)."}),c.jsx("ul",{children:Mn.map((E,G)=>c.jsxs("li",{children:[c.jsx("strong",{children:E.label||E.slot||E.kind})," · ",c.jsx("span",{className:"muted",children:E.scope})," · ",c.jsx("code",{children:E.display}),E.exists?" · exists":" · missing"]},`${E.scope}-${E.slot||E.kind}-${E.display}-${G}`))})]}),c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Appearance"}),c.jsx(mn,{label:"Color scheme",value:O,values:[...R0],onChange:E=>ql(E)}),c.jsx("p",{className:"muted",children:"Local to this browser. Auto follows the system preference. Independent of the theme catalog below."})]}),Et?c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Theme catalog"}),c.jsx("p",{className:"muted",children:"Bundled, user, and project themes with portable color roles. Preview paints immediately; Apply saves the default via settings."}),Gn?c.jsx(Cm,{label:"Loading themes…"}):pn.length===0?c.jsx("p",{className:"muted",children:"No themes reported by this host."}):c.jsxs(c.Fragment,{children:[c.jsxs("label",{children:["Theme",c.jsxs("select",{"aria-label":"Theme catalog",value:qt,onChange:E=>ln(E.target.value),children:[c.jsx("option",{value:"",children:"— stock CSS (no catalog override) —"}),pn.map(E=>{const G=Va(E),De=`${g0(E)} (${v0(E)})`;return c.jsx("option",{value:G,children:De},G)})]})]}),qt&&c.jsxs("p",{className:"muted","aria-live":"polite",children:["Previewing ",c.jsx("code",{children:qt}),Lt&&qt!==Lt?` · saved default is ${Lt}`:"",Lt&&qt===Lt?" · saved default":""]}),c.jsxs("div",{className:"dialog-actions",style:{justifyContent:"flex-start",gap:"0.5rem"},children:[c.jsx(mt,{type:"button",disabled:!qt||qt===gt||$n,onClick:()=>jn(),children:"Revert preview"}),c.jsx(mt,{type:"button",variant:"primary",disabled:!qt||!Dt||!!(a!=null&&a.attachOnly)||$n||qt===Lt,onClick:()=>void dl(),children:$n?"Applying…":"Apply theme"})]}),(a==null?void 0:a.attachOnly)&&c.jsx("p",{className:"muted",children:"Attach-only is read-only — preview works; Apply is disabled."})]})]}):c.jsx(po,{name:"Theme catalog"}),Dt?y?c.jsx(Cm,{label:"Loading settings…"}):c.jsxs("form",{className:"settings-form",onSubmit:E=>void Ea(E),children:[c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Runtime defaults"}),c.jsx("p",{className:"muted",children:"Persisted to ~/.strike/config. Empty leaves the stored value unchanged on save."}),c.jsx(nc,{label:"Provider",value:_n,onChange:vt,placeholder:u.provider||"provider id"}),c.jsx(nc,{label:"Model",value:tn,onChange:cl,placeholder:u.model||"model id"}),c.jsx(mn,{label:"Agent",value:Xn,values:["",...Ie],onChange:yn}),c.jsx(mn,{label:"Effort",value:Je,values:E0,onChange:Ht}),c.jsx(mn,{label:"Permission mode",value:We,values:A0,onChange:gn}),c.jsx(mt,{type:"button",disabled:v||!u.provider,onClick:()=>void Fa(),children:"Use current runtime"})]}),c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Sandbox default"}),c.jsx(mn,{label:"Sandbox",value:kn,values:C0,onChange:Ja}),c.jsx("p",{className:"muted",children:"OS process isolation for bash (off | read-only | workspace-write)."})]}),c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Behavior dials"}),c.jsx(mn,{label:"Notify",value:$t,values:N0,onChange:Kn}),c.jsx(mn,{label:"Lean code",value:vn,values:O0,onChange:bn})]}),c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Permission auto-approve"}),c.jsx(mn,{label:"Countdown seconds",value:Qn,values:z0,onChange:xn}),c.jsx(mn,{label:"Max child depth",value:Zn,values:D0,onChange:rl}),c.jsxs("div",{className:"exclude-list",role:"group","aria-label":"Auto-approve exclude",children:[c.jsx("span",{className:"exclude-label",children:"Never auto-approve"}),U0.map(E=>c.jsxs("label",{className:"exclude-item",children:[c.jsx("input",{type:"checkbox",checked:Wa.includes(E),onChange:()=>Qt(E),"aria-label":`Exclude ${E}`}),E]},E))]})]}),c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Compaction"}),c.jsx(mn,{label:"Strategy",value:ol,values:M0,onChange:Ta}),c.jsx(nc,{label:"Compaction model",value:Jn,onChange:Sn,placeholder:"model id (− clears)"}),c.jsx(mn,{label:"Threshold",value:$e,values:w0,onChange:fl}),c.jsx(mn,{label:"Buffer",value:Xt,values:_0,onChange:Fe}),c.jsx(mn,{label:"Keep user turns",value:tt,values:k0,onChange:jt}),c.jsx(nc,{label:"Prune protect tools",value:Un,onChange:Ll,placeholder:"comma-separated (− clears)"})]}),z&&c.jsx("p",{className:"settings-error",role:"alert",children:z}),c.jsxs("div",{className:"dialog-actions",children:[c.jsx(mt,{type:"button",onClick:o,children:"Close"}),c.jsx(mt,{type:"submit",variant:"primary",disabled:v,children:v?"Saving…":"Save settings"})]})]}):c.jsx(po,{name:"Saved defaults"}),c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Support"}),c.jsxs("p",{className:"muted",children:["Export a redacted prompt/config diagnostic bundle (same scrubbing as TUI ",c.jsx("code",{children:"/diag"}),")."]}),c.jsx(mt,{type:"button",disabled:!(a!=null&&a.capabilities.diag&&h),"aria-label":"Download diagnostics",onClick:()=>void np(d||"").catch(E=>window.alert(E.message)),children:"Download diagnostics"}),!(a!=null&&a.capabilities.diag)&&c.jsx("p",{className:"muted",children:"Unavailable on this host (no live engine)."})]}),z&&!Dt&&c.jsx("p",{className:"settings-error",role:"alert",children:z})]})}const B0=96,H0=6,Y0=120;function Ms(a,u,r){return Math.max(u,Math.min(r,a))}function Qm(a,u,r,o,d,h,y){if(r<=0)return{start:0,end:0};if(r<=y)return{start:0,end:r};let b=0,v=0,g=r-1;for(;v<=g;){const O=v+g>>1,$=o(O),Q=d(O);$+Qy){const O=b+C>>1;b=Ms(O-Math.floor(y/2),0,r),C=Ms(b+y,0,r),b=Ms(C-y,0,r)}return{start:b,end:C}}function G0(a){const u=new Array(a.length+1);u[0]=0;for(let r=0;r(h==null?void 0:h.current)??O.current,[h]),J=T.useMemo(()=>a.map((te,fe)=>{const S=u(te,fe);return $.current.get(S)??o}),[a,u,o,B]),se=T.useMemo(()=>G0(J),[J]),ue=se[a.length]||0,ie=T.useCallback(te=>se[te]??0,[se]),Se=T.useCallback(te=>J[te]??o,[J,o]),Ge=T.useMemo(()=>Qm(Q,ye,a.length,ie,Se,d,C),[Q,ye,a.length,ie,Se,d,C]);T.useLayoutEffect(()=>{const te=P();if(!te)return;const fe=a[0]?u(a[0],0):"";if(a.length>pe.current&&fe&&fe!==W.current&&me.current&&me.current){const R=me.current.key,X=a.findIndex((V,de)=>u(V,de)===R);if(X>=0){const V=ie(X)-me.current.offset;te.scrollTop=Math.max(0,V),le(te.scrollTop)}}else z&&a.length>=pe.current&&(te.scrollTop=te.scrollHeight,le(te.scrollTop));pe.current=a.length,W.current=fe},[a,u,ie,P,z]),T.useEffect(()=>{const te=P();if(!te)return;const fe=()=>{const R=te.scrollTop;le(R),ee(te.clientHeight||600),v&&R{ee(te.clientHeight||600)}):void 0;return S==null||S.observe(te),te.addEventListener("scroll",fe,{passive:!0}),fe(),()=>{te.removeEventListener("scroll",fe),S==null||S.disconnect()}},[P,v,g,a,u,ie,Se,C]);const St=T.useCallback((te,fe)=>{if(!fe)return;const S=fe.getBoundingClientRect().height;if(S<=0)return;const R=$.current.get(te);R!==void 0&&Math.abs(R-S)<1||($.current.set(te,S),_(X=>X+1))},[]),st=a.slice(Ge.start,Ge.end),U=ie(Ge.start),K=Math.max(0,ue-ie(Ge.end)),I=h?{position:"relative"}:{position:"relative",overflow:"auto",height:"100%",minHeight:0};return c.jsx("div",{ref:h?void 0:O,className:y?`virtual-list ${y}`:"virtual-list",style:I,role:"log","aria-label":b,"aria-relevant":"additions","aria-busy":!1,"data-virtual-start":Ge.start,"data-virtual-end":Ge.end,"data-virtual-total":a.length,"data-virtual-mounted":st.length,children:c.jsxs("div",{className:"virtual-list-spacer",style:{height:ue,position:"relative"},"aria-hidden":!1,children:[c.jsx("div",{style:{height:U},"aria-hidden":"true","data-pad":"top"}),st.map((te,fe)=>{const S=Ge.start+fe,R=u(te,S);return c.jsx("div",{"data-virtual-index":S,ref:X=>St(R,X),children:r(te,S)},R)}),c.jsx("div",{style:{height:K},"aria-hidden":"true","data-pad":"bottom"})]})})}const Vm=/(?:^|[\s(`])([\w./-]+\.[a-zA-Z0-9]+)(?::(\d+))?(?=[:\s)`]|$)/g,Zm=new Set(["read","glob","grep","toolsearch","definition","references","symbols"]),X0=new Set(["edit","write","apply_patch","apply-patch","notebook_edit"]),To=40,K0=4e3,Q0=12e3,ac=400,ic=800;function sc({text:a,onFileRef:u}){const r=a.split(/(`[^`\n]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)]+\))/g);return c.jsx(c.Fragment,{children:r.map((o,d)=>{if(o.startsWith("`")&&o.endsWith("`"))return c.jsx("code",{children:o.slice(1,-1)},d);if(o.startsWith("**")&&o.endsWith("**"))return c.jsx("strong",{children:o.slice(2,-2)},d);const h=o.match(/^\[([^\]]+)\]\(([^)]+)\)$/);if(h&&/^(https?:|\/|#)/.test(h[2]))return c.jsx("a",{href:h[2],rel:"noreferrer",children:h[1]},d);const y=[];let b=0;const v=new RegExp(Vm.source,Vm.flags);for(const g of o.matchAll(v)){const z=g.index||0,C=g[0],O=g[1],$=g[2]?Number(g[2]):void 0,Q=C.slice(0,C.indexOf(O));y.push(o.slice(b,z),Q),u?y.push(c.jsxs("button",{type:"button",className:"file-ref",onClick:()=>u(O,$),children:[O,$?`:${$}`:""]},`${d}-${z}`)):y.push(c.jsxs("span",{className:"file-ref",children:[O,$?`:${$}`:""]},`${d}-${z}`)),b=z+C.length}return y.push(o.slice(b)),c.jsx("span",{children:y},d)})})}function jp({text:a,label:u="Copy"}){const[r,o]=T.useState(!1);return c.jsx("button",{type:"button",className:"copy-btn",onClick:()=>{var d;(d=navigator.clipboard)==null||d.writeText(a).then(()=>{o(!0),window.setTimeout(()=>o(!1),1200)})},children:r?"Copied":u})}function V0({text:a,onFileRef:u}){const{text:r,truncated:o}=Tp(a,Q0),d=r.split(/(```[\s\S]*?```)/g);return c.jsxs("div",{className:"markdown",children:[d.map((h,y)=>{if(h.startsWith("```")){const b=h.slice(3,-3).replace(/^\n/,"").split(`
+`),v=b[0].match(/^[\w+-]+$/)?b.shift():"text";let g=b,z=!1;g.length>ac&&(z=!0,g=[...g.slice(0,Math.floor(ac/2)),`… ${b.length-ac} lines omitted …`,...g.slice(-Math.floor(ac/2))]);const C=g.join(`
+`),O=b.join(`
+`);return c.jsxs("figure",{className:"code-block",children:[c.jsxs("figcaption",{children:[c.jsxs("span",{children:[v,z?" · bounded":""]}),c.jsx(jp,{text:O})]}),c.jsx("pre",{children:c.jsx("code",{children:C})})]},y)}return h.split(`
+`).map((b,v)=>{var g;if(/^#{1,3} /.test(b)){const z=((g=b.match(/^#+/))==null?void 0:g[0].length)||1,C=b.replace(/^#+\s/,"");return z===1?c.jsx("h2",{children:c.jsx(sc,{text:C,onFileRef:u})},v):c.jsx("h3",{children:c.jsx(sc,{text:C,onFileRef:u})},v)}return/^[-*] /.test(b)?c.jsxs("div",{className:"list-line",children:["— ",c.jsx(sc,{text:b.slice(2),onFileRef:u})]},v):b?c.jsx("p",{children:c.jsx(sc,{text:b,onFileRef:u})},v):c.jsx("br",{},v)})}),o&&c.jsx("p",{className:"muted",children:"Message truncated for display; full text remains in session memory."})]})}function Z0({text:a,path:u,onFileRef:r}){const[o,d]=T.useState(!1),h=a.split(`
+`),y=h.length>ic?[...h.slice(0,Math.floor(ic/2)),`… ${h.length-ic} lines omitted …`,...h.slice(-Math.floor(ic/2))]:h;return c.jsxs("div",{className:"diff-viewer",children:[c.jsxs("div",{className:"diff-toolbar",children:[u?r?c.jsx("button",{type:"button",className:"file-ref",onClick:()=>r(u),children:u}):c.jsx("span",{className:"file-ref",children:u}):c.jsx("span",{children:"diff"}),c.jsxs("label",{className:"diff-wrap",children:[c.jsx("input",{type:"checkbox",checked:o,onChange:b=>d(b.target.checked)}),"Wrap"]}),c.jsx(jp,{text:a})]}),c.jsx("pre",{className:o?"diff wrap":"diff",children:y.map((b,v)=>{const g=b.startsWith("+")&&!b.startsWith("+++")?"add":b.startsWith("-")&&!b.startsWith("---")?"del":b.startsWith("@@")?"hunk":"";return c.jsxs("span",{className:g,children:[b,`
+`]},v)})})]})}function Us(a){const u=(a.title||"").replace(/^tool\s*[·:.-]\s*/i,"").trim();if(u)return u.split(/\s+/)[0].toLowerCase();const r=a.data||{},o=r.name||r.tool||r.toolName;return typeof o=="string"?o.toLowerCase():"tool"}function J0(a){const u=a.data||{},r=String(u.status||u.state||"").toLowerCase();return r==="denied"||r==="permission_denied"?{label:"denied",kind:"denied"}:r==="error"||r==="failed"||a.kind==="error"?{label:"error",kind:"error"}:r==="running"||r==="in_progress"||u.running===!0?{label:"running",kind:"running"}:a.text.trim()?{label:"done",kind:"done"}:{label:r||"done",kind:r==="running"?"running":"done"}}function W0(a){const u=a.data||{},r=typeof u.durationMs=="number"?u.durationMs:typeof u.duration_ms=="number"?u.duration_ms:typeof u.elapsedMs=="number"?u.elapsedMs:void 0;if(!(r===void 0||r<0))return r<1e3?`${Math.round(r)}ms`:`${(r/1e3).toFixed(r>=1e4?0:1)}s`}function F0(a){var r;const u=a.match(/^\+\+\+\s+(?:b\/)?(.+)$/m)||a.match(/^---\s+(?:a\/)?(.+)$/m);return((r=u==null?void 0:u[1])==null?void 0:r.trim())||void 0}function I0(a){return a.includes("@@")&&(/^\+\+\+/m.test(a)||/^---/m.test(a))}function Tp(a,u=K0){return a.length<=u?{text:a,truncated:!1}:{text:`${a.slice(0,u)}
+… truncated (${a.length.toLocaleString()} chars; full text retained in session memory)`,truncated:!0}}function P0(a){const u=a.split(`
+`);return u.length<=To?a:`… ${u.length-To} earlier lines …
+${u.slice(-To).join(`
+`)}`}function eb({item:a,onFileRef:u}){var d;const r=a.data||{},o=String(r.eventKind||r.kind||a.title||"").toLowerCase();if(o.includes("verification")||(d=a.title)!=null&&d.toLowerCase().includes("verification")){const h=r.passed===!0||r.verified===!0;return c.jsxs("article",{className:"message system semantic-event",children:[c.jsx("div",{className:"message-label",children:"Verification"}),c.jsxs("p",{children:[h?"Passed":r.passed===!1?"Failed":"Completed",r.summary?` — ${String(r.summary)}`:a.text?` — ${a.text}`:""]})]})}if(o.includes("overlap")||o.includes("path.overlap")){const h=String(r.path||"");return c.jsxs("article",{className:"message system semantic-event",children:[c.jsx("div",{className:"message-label",children:"Path overlap"}),c.jsxs("p",{children:[u&&h?c.jsx("button",{type:"button",className:"file-ref",onClick:()=>u(h),children:h}):h||"paths",Array.isArray(r.sessions)?` · ${r.sessions.length} sessions`:""]})]})}return o.includes("denied")||o.includes("permission")?c.jsxs("article",{className:"message system semantic-event",children:[c.jsx("div",{className:"message-label",children:"Permission denied"}),c.jsx("p",{children:a.text||String(r.message||r.permission||"Permission denied")})]}):o.includes("handoff")||o.includes("agent.message")?c.jsxs("article",{className:"message system semantic-event",children:[c.jsx("div",{className:"message-label",children:o.includes("handoff")?"Handoff":"Agent message"}),c.jsxs("p",{children:[r.from?`${String(r.from)} → `:"",r.to?String(r.to):"",r.summary||r.body||a.text?` — ${String(r.summary||r.body||a.text)}`:""]})]}):null}function Ep({item:a,onFileRef:u}){const r=Us(a),o=J0(a),d=W0(a),h=a.text.trim(),{text:y,truncated:b}=Tp(h);let v;try{v=JSON.parse(h)}catch{v=void 0}const g=X0.has(r)||I0(h),z=typeof(a.data||{}).path=="string"?String((a.data||{}).path):F0(h),C=(a.data||{}).args??(a.data||{}).input,O=o.kind==="running"?P0(y):y;return c.jsxs("details",{className:`tool-card state-${o.kind}`,children:[c.jsxs("summary",{children:[c.jsx("span",{className:"tool-name",children:r}),c.jsx("span",{className:`tool-state tool-state-${o.kind}`,children:o.label}),d&&c.jsx("small",{className:"tool-duration",children:d}),c.jsx("small",{children:g?"diff":v?"structured":b?"bounded":"output"})]}),C!==void 0&&c.jsxs("div",{className:"tool-args",children:[c.jsx("strong",{children:"Arguments"}),c.jsx("pre",{children:typeof C=="string"?C:JSON.stringify(C,null,2)})]}),g?c.jsx(Z0,{text:O,path:z,onFileRef:u}):c.jsx("pre",{className:"tool-output",children:v?JSON.stringify(v,null,2):O})]})}function tb(a){const u=[];let r=0;for(;r=2?u.push({kind:"exploration",items:d,id:`explore-${d[0].id}`}):u.push({kind:"single",item:d[0]});continue}u.push({kind:"single",item:o}),r+=1}return u}function nb({items:a,onFileRef:u}){const r=T.useMemo(()=>{const o=new Map;for(const d of a){const h=Us(d);o.set(h,(o.get(h)||0)+1)}return[...o.entries()].map(([d,h])=>h>1?`${d}×${h}`:d).join(", ")},[a]);return c.jsxs("details",{className:"exploration-group",children:[c.jsxs("summary",{children:[c.jsx("span",{children:"Exploration"}),c.jsxs("small",{children:[a.length," steps · ",r]})]}),c.jsx("div",{className:"exploration-body",children:a.map(o=>c.jsx(Ep,{item:o,onFileRef:u},o.id))})]})}function lb(a){if(a.kind!=="system"&&a.kind!=="tool")return!1;const u=`${a.title||""} ${JSON.stringify(a.data||{})}`.toLowerCase();return/verification|path\.overlap|overlap|permission|denied|handoff|agent\.message/.test(u)}function ab({item:a,showThinking:u=!0,onFileRef:r}){if(a.kind==="reasoning"&&!u)return null;if(lb(a)){const o=c.jsx(eb,{item:a,onFileRef:r});if(o)return o}return a.kind==="tool"?c.jsxs("article",{className:"message tool",children:[c.jsx("div",{className:"message-label",children:a.title||Us(a)}),c.jsx(Ep,{item:a,onFileRef:r})]}):c.jsxs("article",{className:`message ${a.kind}`,children:[c.jsx("div",{className:"message-label",children:a.title||a.kind}),c.jsx(V0,{text:a.text,onFileRef:r})]})}function Jm(a,u,r){return a.kind==="exploration"?c.jsxs("article",{className:"message tool exploration","aria-label":`Exploration ${a.items.length} steps`,children:[c.jsx("div",{className:"message-label",children:"Exploration"}),c.jsx(nb,{items:a.items,onFileRef:r})]}):c.jsx(ab,{item:a.item,showThinking:u,onFileRef:r})}function ib({items:a,showThinking:u=!0,onFileRef:r,scrollRef:o,stickToBottom:d=!1,virtualize:h}){const y=T.useMemo(()=>tb(a),[a]),b=h??y.length>40,v=T.useCallback(z=>z.kind==="exploration"?z.id:z.item.id,[]),g=T.useCallback(z=>Jm(z,u,r),[u,r]);return b?c.jsx($0,{className:"transcript-list",items:y,itemKey:v,renderItem:g,scrollRef:o,stickToBottom:d,estimateHeight:120,overscan:8,maxMounted:80,"aria-label":"Conversation messages"}):c.jsx("div",{className:"transcript-list",role:"log","aria-label":"Conversation messages","data-virtual-mounted":y.length,"data-virtual-total":y.length,children:y.map(z=>c.jsx("div",{children:Jm(z,u,r)},v(z)))})}const sb=T.memo(ib);var Eo={};function ub(a,u={}){const r=typeof process<"u"&&!!(Eo!=null&&Eo.VITEST),o=u.schedule??(O=>r?(O(),-1):typeof requestAnimationFrame=="function"?requestAnimationFrame(O):setTimeout(O,16)),d=u.cancel??(O=>{O<0||(typeof cancelAnimationFrame=="function"?cancelAnimationFrame(O):clearTimeout(O))});let h=[],y,b=!1;const v=()=>{if(b=!1,y=void 0,!h.length)return;const O=h;h=[],a(O)};return{push:O=>{h.push(O),!b&&(b=!0,y=o(v))},flush:()=>{if(y!==void 0&&(d(y),y=void 0),b=!1,!h.length)return;const O=h;h=[],a(O)},clear:()=>{y!==void 0&&(d(y),y=void 0),b=!1,h=[]},pending:()=>h.length}}const cb=["shared","tools","provider","config_system","persona","phase","plan","lean_code","environment","instruction","project_memory","decision_ledger"];function rb({modeLabel:a,surfaces:u,activeId:r,profile:o,onChange:d,panelIdPrefix:h="inspector-panel"}){return u.length?o==="phone"?c.jsx("nav",{className:"surface-nav-sheet","aria-label":`${a} surfaces`,children:c.jsx("ul",{className:"surface-nav-list",role:"listbox","aria-label":`${a} surfaces`,children:u.map(y=>{const b=y.id===r;return c.jsx("li",{role:"option","aria-selected":b,children:c.jsx("button",{type:"button",className:b?"surface-nav-item active":"surface-nav-item","aria-current":b?"page":void 0,onClick:()=>d(y.id),children:c.jsx("span",{className:"surface-nav-label",children:y.label})})},y.id)})})}):c.jsx(Zg,{className:"inspector-tabs",label:`${a} surfaces`,value:r,items:u.map(y=>({id:y.id,label:y.label})),onChange:d,panelIdPrefix:h}):null}function Sa(a){return(a||"").trim()}function Ap(a){const u=a.startsWith("?")||a.startsWith("#")?a.slice(1):a;return new URLSearchParams(u)}function qo(a){const u=Ap(a),r=Sa(u.get("root")),o=Sa(u.get("session")),d=Sa(u.get("mode")).toLowerCase(),h=d!=="",y=Lo(d)?d:"chat";return{raw:{root:r,session:o,mode:y,surface:Sa(u.get("surface")),entity:Sa(u.get("entity")),path:Sa(u.get("path")),pane:Sa(u.get("pane")),agent:Sa(u.get("agent"))},modePresent:h,modeRaw:d,workspaceID:r||o}}function ob(a,u=""){const r=Ap(u);r.delete("token");const o=(d,h,y)=>{y||!h?r.delete(d):r.set(d,h)};if("root"in a&&o("root",a.root||""),"session"in a&&o("session",a.session||""),"mode"in a){const d=a.mode||"";o("mode",d,!d||d==="chat")}return"surface"in a&&o("surface",a.surface||""),"entity"in a&&o("entity",a.entity||""),"path"in a&&o("path",a.path||""),"pane"in a&&o("pane",a.pane||""),"agent"in a&&o("agent",a.agent||""),r.toString()}function Za(a){try{const u=ob(a,location.search),r=`${location.pathname}${u?`?${u}`:""}${location.hash||""}`,o=`${location.pathname}${location.search}${location.hash||""}`;r!==o&&history.replaceState(null,"",r)}catch{}}function fb(a,u,r){const o=qo(a),{raw:d,modePresent:h,modeRaw:y}=o;let b;h&&(b=Lo(y)?y:"chat");const v=Gv({mode:b,surface:d.surface,path:d.path,pane:d.pane,agent:d.agent,caps:u,attachOnly:r==null?void 0:r.attachOnly,isLive:r==null?void 0:r.isLive});return{workspaceID:o.workspaceID,mode:v.mode,surface:v.surface,entity:d.entity,path:d.path,pane:d.pane,agent:d.agent,openDrawer:v.openDrawer,unavailable:v.unavailable}}function db(a=typeof location<"u"?location.search:""){return qo(a).workspaceID}const Wm={phoneMax:599,tabletMax:1023};function Ao(a){return!Number.isFinite(a)||a<=0?"desktop":a<=Wm.phoneMax?"phone":a<=Wm.tabletMax?"tablet":"desktop"}function hb(a){return a==="phone"}const mb=T.lazy(()=>Pt(()=>import("./Team-CbhxE7GH.js"),[]).then(a=>({default:a.TeamWorkspace}))),pb=T.lazy(()=>Pt(()=>import("./CodeExplorer-B2jXBi3h.js"),[]).then(a=>({default:a.CodeExplorer}))),yb=T.lazy(()=>Pt(()=>import("./ArtifactsReview-D1C39jZN.js"),[]).then(a=>({default:a.ArtifactsPanel}))),gb=T.lazy(()=>Pt(()=>import("./ArtifactsReview-D1C39jZN.js"),[]).then(a=>({default:a.LedgerPanel}))),vb=T.lazy(()=>Pt(()=>import("./ArtifactsReview-D1C39jZN.js"),[]).then(a=>({default:a.TeamReviewPanel}))),bb=T.lazy(()=>Pt(()=>import("./MCP-DIJaaFpI.js"),[]).then(a=>({default:a.MCPPanel}))),xb=T.lazy(()=>Pt(()=>import("./Plugins-CzG6Imkp.js"),__vite__mapDeps([0,1,2])).then(a=>({default:a.PluginsPanel}))),Fm=T.lazy(()=>Pt(()=>import("./Panes-cnXdgOPa.js"),__vite__mapDeps([3,2,1])).then(a=>({default:a.PanesPanel}))),Sb=T.lazy(()=>Pt(()=>import("./Timeline-eRMBJ9AN.js"),[]).then(a=>({default:a.TimelinePanel}))),jb=T.lazy(()=>Pt(()=>import("./Diagnostics-gzTBvoN8.js"),[]).then(a=>({default:a.DiagnosticsPanel}))),Tb=T.lazy(()=>Pt(()=>import("./Plans-4LP_uynK.js"),[]).then(a=>({default:a.PlansPanel}))),Eb=T.lazy(()=>Pt(()=>import("./Goals-B2nPEdT8.js"),[]).then(a=>({default:a.GoalsPanel}))),Ab=T.lazy(()=>Pt(()=>import("./Workflows-BHp6vnHZ.js"),[]).then(a=>({default:a.WorkflowsPanel})));function Cb({label:a}){return c.jsx("section",{className:"unavailable",role:"status",children:c.jsxs("strong",{children:["Loading ",a,"…"]})})}const uc={effort:["low","medium","high","xhigh"],autonomy:["supervised","agent","checks","skip-all"],permission:["default","plan","soft-approve","accept-edits","yolo"],sandbox:["off","read-only","workspace-write"]},Cp="strike.web.showThinking",Nb=()=>{try{const a=sessionStorage.getItem(Cp);return a===null?!0:a==="1"||a==="true"}catch{return!0}},Ob=a=>{try{sessionStorage.setItem(Cp,a?"1":"0")}catch{}};function Np(a){return a.contextUsed!==void 0&&a.contextLimit!==void 0?`${a.contextUsed.toLocaleString()} / ${a.contextLimit.toLocaleString()}`:a.contextUsed!==void 0?`${a.contextUsed.toLocaleString()} used`:"not reported"}const zb=fc,xt=(a,u,r)=>tp(a,u,r).catch(o=>window.alert(o.message)),Ui=a=>a.slice(0,12),Db=2e3,Im=a=>!!(a.permissionPending||a.questionPending),Mb=(a,u)=>{var r;return a.title||((r=u.find(o=>o.id===a.id))==null?void 0:r.title)||Ui(a.id)},ko=a=>{if(!a)return"";const u=a<1e12?a*1e3:a,r=Math.max(0,Math.floor((Date.now()-u)/1e3));return r<60?"just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:`${Math.floor(r/86400)}d ago`},wb=()=>{try{return db(location.search)}catch{return""}};function Qa({label:a,value:u,values:r,disabled:o,onChange:d}){return c.jsxs("label",{className:"runtime-field",children:[c.jsx("span",{children:a}),c.jsxs("select",{"aria-label":a,value:u||"",disabled:o,onChange:h=>d(h.target.value),children:[c.jsx("option",{value:"",children:"—"}),r.map(h=>c.jsx("option",{children:h},h))]})]})}function Op({title:a,children:u}){const r=T.useRef(null);return T.useEffect(()=>{var o;(o=r.current)==null||o.showModal()},[]),c.jsxs("dialog",{ref:r,"aria-labelledby":"blocking-title",onCancel:o=>o.preventDefault(),children:[c.jsx("div",{className:"dialog-rule"}),c.jsx("h2",{id:"blocking-title",children:a}),u]})}const _b=a=>new Promise((u,r)=>{if(!a.type.startsWith("image/"))return r(new Error(`${a.name}: only image attachments are supported by the engine`));const o=new FileReader;o.onerror=()=>r(new Error(`${a.name}: read failed`)),o.onload=()=>u({name:a.name,mime:a.type,data:String(o.result).split(",")[1]||""}),o.readAsDataURL(a)});function kb(){const[a,u]=T.useState(),[r,o]=T.useState([]),[d,h]=T.useState([]),[y,b]=T.useState(""),[v,g]=T.useState(""),[z,C]=T.useState(!1),[O,$]=T.useState("active"),[Q,le]=T.useState(""),[ye,ee]=T.useReducer(Dv,void 0,zv),B=ye.selectedID,_=Mv(ye),pe=_.draft,W=_.queue,me=_.images,P=_.fast,[J,se]=T.useState("connecting"),[ue,ie]=T.useState(null),Se=T.useRef(null),Ge=T.useRef(!1),[St,st]=T.useState(null),[U,K]=T.useState("chat"),[I,te]=T.useState("context"),[fe,S]=T.useState(!1),[R,X]=T.useState(""),[V,de]=T.useState(),[ge,Ee]=T.useState(0),ut=T.useRef(!1),[ze,sl]=T.useState(()=>typeof window<"u"?Ao(window.innerWidth):"desktop"),[en,Rt]=T.useState(()=>typeof window<"u"?Ao(window.innerWidth)==="desktop":!0),[Hn,Mn]=T.useState(240),[Yn,pn]=T.useState(340),[Li,Gn]=T.useState(),[Ul,Lt]=T.useState(!1),[ul,qt]=T.useState(new Set),[wn,gt]=T.useState([]),[Rl,$n]=T.useState([]),[Bt,_n]=T.useState([]),[vt,tn]=T.useState(null),[cl,Xn]=T.useState(!1),[yn,Je]=T.useState([]),[Ht,We]=T.useState(""),[gn,kn]=T.useState(0),[Ja,$t]=T.useState(0),[Kn,vn]=T.useState(!1),[bn,Qn]=T.useState(()=>{try{return localStorage.getItem("strike.web.onboard.v1")!=="1"}catch{return!1}}),[xn,Wa]=T.useState(!1),[ja,Vn]=T.useState(!1),nn=T.useRef(null),Zn=T.useRef(null),rl=T.useRef(null),[ol,Ta]=T.useState(Nb),[Jn,Sn]=T.useState(),[$e,fl]=T.useState(),[Xt,Fe]=T.useState(!1),[tt,jt]=T.useState(),Un=T.useRef(null),Ll=T.useRef(null),Dt=T.useRef(!0),[Wn,Kt]=T.useState(!1),[Fn,Yt]=T.useState(0),Mt=T.useRef(0),[Qe,Tt]=T.useState(""),Ie=T.useRef(null),Et=p=>{if(!B)return;const j=typeof p=="function"?p(pe):p;ee({type:"client.composer",id:B,patch:{draft:j}})},ql=p=>{if(!B)return;const j=typeof p=="function"?p(me):p;ee({type:"client.composer",id:B,patch:{images:j}})},ln=p=>{if(!B)return;const j=typeof p=="function"?p(W):p;ee({type:"client.composer",id:B,patch:{queue:j}})},jn=p=>{if(!B)return;const j=typeof p=="function"?p(P):p;ee({type:"client.composer",id:B,patch:{fast:j}})},dl=()=>jm().then(p=>(o(p.sessions||[]),b(p.liveId||""),p)),Qt=()=>Em().then(p=>(h(p.roots||[]),g(p.activeId||""),p)).catch(()=>{});T.useEffect(()=>{Sp(_o())},[]),T.useEffect(()=>{const p=()=>{const j=Ao(window.innerWidth);sl(L=>(L!==j&&(Rt(j==="desktop"),j!=="desktop"&&S(!1)),j))};return p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[]),T.useEffect(()=>{const p=j=>{if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="k"){j.preventDefault(),rl.current=document.activeElement instanceof HTMLElement?document.activeElement:null,Xn(!0);return}if(j.key==="Escape"&&!document.querySelector("dialog[open]")){if(cl){j.preventDefault(),Xn(!1);return}if(fe){j.preventDefault(),S(!1);return}en&&ze!=="desktop"&&(j.preventDefault(),Rt(!1))}};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[fe,en,ze,cl]),T.useEffect(()=>{Promise.all([Mg(),jm(),Em().catch(()=>({roots:[],activeId:""}))]).then(([p,j,L])=>{var gl,Ks,Qs,Vs,Yi;u(p),se("connected"),o(j.sessions||[]);const Z=!!(p.capabilities.roots&&((gl=L.roots)!=null&&gl.length));b(j.liveId||((Ks=p.status)==null?void 0:Ks.sessionId)||"");const F=Z?L.roots||[]:[];h(F),g(L.activeId||j.liveId||((Qs=p.status)==null?void 0:Qs.sessionId)||"");const Ue=j.sessions||[],Ae=wb(),_e=new Set(F.map(vl=>vl.id));let et=((Vs=F[0])==null?void 0:Vs.id)||(p.capabilities.roots?"":j.liveId)||"",sn=et||((Yi=Ue[0])==null?void 0:Yi.id)||"",Rn=!!(et&&sn===et);Ae&&(_e.has(Ae)||!p.capabilities.roots&&Ae===(j.liveId||"")?(sn=Ae,et=Ae,Rn=!0):Ue.some(vl=>vl.id===Ae)&&(sn=Ae,Rn=!1)),sn&&(ee({type:"client.ensure",id:sn}),p.status&&Rn&&ee({type:"client.event",id:sn,envelope:{type:"status",data:p.status}})),C(Rn),$(Rn?"active":"history"),Rn&&Ae&&p.capabilities.roots&&!p.attachOnly&&Am(Ae).then(()=>Qt()).catch(()=>{}),p.capabilities.auth&&oe("/v1/providers").then(vl=>gt(vl.providers.map(Zs=>Zs.Name||Zs.name||"").filter(Boolean))).catch(()=>{}),p.capabilities.history&&oe("/v1/history").then(vl=>_n(vl.entries||[])).catch(()=>{}),p.capabilities.sandbox&&Tm().then(fl).catch(()=>{})}).catch(p=>se(p.message))},[]),T.useEffect(()=>{if(!(a!=null&&a.capabilities.roots)||a.attachOnly)return;const p=()=>{Qt()},j=window.setInterval(p,Db);return()=>window.clearInterval(j)},[a==null?void 0:a.capabilities.roots,a==null?void 0:a.attachOnly]),T.useEffect(()=>{if(!B)return;ee({type:"client.ensure",id:B}),jt(void 0);const p=B,j=ub(F=>{ee({type:"client.events",id:p,envelopes:F})}),L=F=>j.push(F);if(!z){const F=$g(p,L,Ue=>se(Ue));return()=>{j.flush(),j.clear(),F()}}const Z=Gg(p,L,se);return()=>{j.flush(),j.clear(),Z.close()}},[B,z]),T.useEffect(()=>{if(!B||!(a!=null&&a.capabilities.sessions))return;let p=!1;return Xg(B).then(j=>{p||ee({type:"client.event",id:B,envelope:{type:"children.seed",time:`seed:${B}`,data:{sessions:j.sessions||[]}}})}).catch(()=>{}),()=>{p=!0}},[B,a==null?void 0:a.capabilities.sessions]),T.useEffect(()=>{const p=Ll.current;if(!p)return;const j=()=>{const Z=p.scrollHeight-p.scrollTop-p.clientHeight<80;Dt.current=Z,Z&&(Yt(0),Mt.current=_.items.length),Kt(!Z&&_.items.length>0)};return p.addEventListener("scroll",j,{passive:!0}),()=>p.removeEventListener("scroll",j)},[_.items.length]),T.useEffect(()=>{var p;if(!Dt.current){const j=_.items.length-Mt.current;j>0&&Yt(L=>L+j),Kt(_.items.length>0),Mt.current=_.items.length;return}Yt(0),Mt.current=_.items.length,(p=Un.current)==null||p.scrollIntoView({block:"end"}),Kt(!1)},[_.items]),T.useEffect(()=>{const p=[];_.status.busy?p.push("Agent working"):_.items.length&&p.push("Agent idle"),_.permission&&p.push("Permission required"),_.question&&p.push("Question pending");const j=p.join(". "),L=window.setTimeout(()=>Tt(j),400);return()=>window.clearTimeout(L)},[_.status.busy,_.permission,_.question,_.items.length]);const Ea=(p,j)=>{de(void 0),X(p),Za({mode:"code",surface:"files",entity:p}),K("code"),te("files"),S(!0),el("files")},Fa=T.useRef(Ea);Fa.current=Ea;const Bl=T.useCallback((p,j)=>{Fa.current(p,j)},[]),hl=()=>{var p;Dt.current=!0,Kt(!1),Yt(0),Mt.current=_.items.length,(p=Un.current)==null||p.scrollIntoView({block:"end",behavior:"smooth"})};T.useEffect(()=>{if(!B||_.status.busy||!W.length||!z)return;const[p,...j]=W;ee({type:"client.composer",id:B,patch:{queue:j}}),xt("user.input",{text:p.text,images:p.images.map(({mime:L,data:Z})=>({mime:L,data:Z}))},B)},[_.status.busy,W,z,B]);const nt=!!(z&&B&&!(a!=null&&a.attachOnly)),Pe=!nt||_.status.busy,Hl=[_.status.effort,_.status.autonomy,_.status.permissionMode,P?"fast":""].filter(Boolean).join(" · "),E=T.useMemo(()=>Object.entries(_.children),[_.children]),G=T.useMemo(()=>zo(U,a==null?void 0:a.capabilities,{attachOnly:a==null?void 0:a.attachOnly,isLive:z,forceIds:V?[V.id]:[]}),[a,U,z,V,ge]),De=T.useMemo(()=>G.map(p=>p.id),[G]),pt=T.useMemo(()=>{var p,j;return{changedFiles:((p=_.changedFiles)==null?void 0:p.length)||0,teamMembers:Math.max(Object.keys(_.children||{}).length,Object.keys(((j=_.team)==null?void 0:j.members)||{}).length),permissionPending:!!_.permission||d.some(L=>L.permissionPending),questionPending:!!_.question||d.some(L=>L.questionPending),fitWarning:!!_.fitWarning}},[_.changedFiles,_.children,_.permission,_.question,_.fitWarning,d]),Vt=De.includes(I)?I:De[0]||"",wt={"--nav-width":ze==="desktop"?en?`${Hn}px`:"0px":`${Hn}px`,"--inspector-width":ze==="desktop"?fe?`${Yn}px`:"0px":`${Yn}px`},Yl=hb(ze),Rs=ze!=="desktop"&&(en||fe),Aa=fe&&U==="chat";T.useLayoutEffect(()=>{var j;const p=Zn.current;p!=null&&(Zn.current=null,(j=nn.current)==null||j.setSelectionRange(p,p))});const Gl=T.useMemo(()=>Xv({skills:a==null?void 0:a.skills,attachOnly:a==null?void 0:a.attachOnly,capabilities:a==null?void 0:a.capabilities}),[a]),In=T.useMemo(()=>{const p=Vv(pe,gn);return p.active?{start:p.start,query:p.query}:null},[pe,gn]),Ia=!!(In&&(a!=null&&a.capabilities.files)),$l=T.useMemo(()=>{if(Ia)return yn.map(L=>({label:L,detail:"workspace file",insert:L}));const p=Rm(pe,gn);if(!p)return[];const j=[...zb,...((a==null?void 0:a.skills)||[]).map(L=>({label:`/${L.name}`,detail:L.description||"Skill",insert:`/${L.name}`}))];return Uv(j,p.query)},[pe,a,Ia,yn,gn]),_t=Kn||vt?[]:$l,qi=Ia&&!Kn&&!vt&&_t.length===0&&Ht!=="",Ls=_t.length>0||qi,Xl=Math.min(Ja,Math.max(0,_t.length-1)),qs=T.useRef(!1),Bs=T.useRef(null);T.useEffect(()=>{const p=_t.length>0;p&&!qs.current?$t(0):$t(j=>Math.min(j,Math.max(0,_t.length-1))),qs.current=p},[_t.length]),T.useEffect(()=>{var p,j;(j=(p=Bs.current)==null?void 0:p.querySelector('[aria-selected="true"]'))==null||j.scrollIntoView({block:"nearest"})},[Xl,_t.length]),T.useEffect(()=>{if(!In||!(a!=null&&a.capabilities.files)){Je([]),We("");return}const p=In.query,j=window.setTimeout(()=>{oe(`/v1/files/search?q=${encodeURIComponent(p)}&limit=12`).then(L=>{const Z=L.paths||[];Je(Z),We(Z.length?"":Hm(p))}).catch(()=>{Je([]),We(Hm(p,!0))})},120);return()=>window.clearTimeout(j)},[In,a==null?void 0:a.capabilities.files]);const Ca=p=>{!(a!=null&&a.capabilities.history)||!p.trim()||oe("/v1/history",{method:"POST",body:JSON.stringify({prompt:p})}).then(()=>oe("/v1/history")).then(j=>_n(j.entries||[])).catch(()=>{})},Ve=(p,j)=>{B&&ee({type:"client.event",id:B,envelope:{type:"local.system",time:String(Date.now()),data:{title:p,text:j}}})},Kl=()=>{var j;const p=tv(_.items,{sessionId:B||_.status.sessionId,title:(j=r.find(L=>L.id===B))==null?void 0:j.title,provider:_.status.provider,model:_.status.model,agent:_.status.agent});lv(nv(B||_.status.sessionId),p)},Pa=(p,j)=>{var Ue,Ae;const L=p.trim(),Z=((a==null?void 0:a.skills)||[]).map(_e=>_e.name),F=Rv(L,Z);switch(F.kind){case"pass":Ca(L),xt("user.input",{text:L,images:j.map(({mime:_e,data:et})=>({mime:_e,data:et}))},B);return;case"unknown":Ve("Unknown command",`${F.command} is not available in the web cockpit. Type /help for the list.`);return;case"usage":Ve("Usage",F.message);return;case"help":Ve("Help",Lm((a==null?void 0:a.skills)||[]));return;case"export":Kl();return;case"queue":(Ue=Se.current)==null||Ue.scrollIntoView({block:"nearest",behavior:"smooth"}),Ve("Queue",W.length?`${W.length} prompt(s) queued — reorder, edit, or clear.`:"Queue is empty. Prompts sent while the agent is busy land here.");return;case"cost":Ve("Cost",Um(_.status,Jn));return;case"copy":{const _e=[..._.items].reverse().find(et=>et.kind==="assistant"&&et.text.trim());if(!_e){Ve("Copy","No assistant reply to copy.");return}(Ae=navigator.clipboard)==null||Ae.writeText(_e.text).then(()=>Ve("Copy","Last assistant reply copied to clipboard."),()=>Ve("Copy","Clipboard unavailable in this browser."));return}case"fork":Jl("fork");return;case"rename":{if(F.title){if(!(a!=null&&a.capabilities.sessions)){Ve("Rename","Sessions capability unavailable.");return}oe(`/v1/sessions/${encodeURIComponent(B)}`,{method:"PATCH",body:JSON.stringify({title:F.title})}).then(()=>dl()).catch(_e=>window.alert(_e.message));return}Jl("rename");return}case"fast":{const _e=F.enabled===void 0?!P:F.enabled;jn(_e),xt("set.fast",{enabled:_e},B);return}case"op":{let _e=F.data;if(F.type==="select.model"&&_e&&typeof _e=="object"){const et={..._e};et.provider||(et.provider=_.status.provider),_e=et}if(F.type==="rewind"){const et=!!(_e&&typeof _e=="object"&&_e.restoreFiles);st({preferFiles:et});return}xt(F.type,_e,B);return}}},Ql=_.undoStack.at(-1)||fv(),Vl=p=>{st(null),xt("rewind",p?{restoreFiles:!0}:{},B)},Hs=p=>{p.preventDefault();const j=pe.trim();!j||!nt||(_.status.busy?(Ca(j),ln(L=>[...L,{text:j,images:me}])):Pa(j,me),tn(null),Et(""),ql([]),Je([]),We(""),kn(0))},ei=p=>{var et;if(vn(!0),In){const sn=((et=nn.current)==null?void 0:et.selectionStart)??gn,Rn=Jv(pe,In.start,sn,p.insert),gl=Wv(In.start,p.insert,Rn);Zn.current=gl,Et(Rn),kn(gl),Je([]),We("");return}const j=Rm(pe,gn),L=(j==null?void 0:j.start)??0,Z=j?pe.slice(j.end):"",F=p.insert.replace(/\s+$/,""),Ue=/^\s/.test(Z)?"":" ",Ae=`${pe.slice(0,L)}${F}${Ue}${Z}`,_e=L+F.length+Ue.length;Zn.current=_e,Et(Ae),kn(_e)},Ys=p=>{var L;const j=p.action;if(p.requiresLive&&(!nt||a!=null&&a.attachOnly)){Ve("Unavailable",a!=null&&a.attachOnly?"Attach-only: this action requires a live workspace.":"Not available without a live session.");return}if(p.requiresCapability&&a&&!a.capabilities[p.requiresCapability]){Ve("Unavailable",`${p.requiresCapability} capability is not available on this host.`);return}switch(j.type){case"mode":Zl(j.mode,{openDrawer:j.mode!=="chat"});return;case"surface":Zl(j.mode,{openDrawer:!0,surface:j.surface});return;case"slash":j.run?Pa(j.insert.trim(),[]):(Et(j.insert),(L=nn.current)==null||L.focus());return;case"session":j.action==="export"?Kl():j.action==="help"?Ve("Help",Lm((a==null?void 0:a.skills)||[])):j.action==="settings"?Vn(!0):j.action==="cost"?Ve("Cost",Um(_.status)):j.action==="fork"?Jl("fork"):j.action==="interrupt"&&xt("interrupt");return;case"notice":Ve(j.title,j.body);return}},Na=p=>{var Z;const j=p.currentTarget;if(Ls){const F=p.key==="ArrowDown"||p.ctrlKey&&!p.metaKey&&!p.altKey&&p.key.toLowerCase()==="n",Ue=p.key==="ArrowUp";if(F||Ue){p.preventDefault(),_t.length>0&&$t(Ae=>F?Math.min(_t.length-1,Ae+1):Math.max(0,Ae-1));return}if(p.key==="Enter"&&!p.shiftKey||p.key==="Tab"&&!p.shiftKey){p.preventDefault();const Ae=_t[Xl]||_t[0];Ae&&ei(Ae);return}if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),vn(!0);return}}if(p.key==="Enter"&&!p.shiftKey){p.preventDefault(),(Z=j.form)==null||Z.requestSubmit();return}const L=j.selectionStart===0&&j.selectionEnd===0;if((p.key==="ArrowUp"||p.key==="ArrowDown")&&Bt.length&&(vt||pe===""&&L)){if(p.preventDefault(),p.key==="ArrowUp")if(!vt)tn({index:Bt.length-1,draft:pe}),Et(Bt[Bt.length-1]||"");else{const F=Math.max(0,vt.index-1);tn({...vt,index:F}),Et(Bt[F]||"")}else if(vt)if(vt.index>=Bt.length-1)Et(vt.draft),tn(null);else{const F=vt.index+1;tn({...vt,index:F}),Et(Bt[F]||"")}return}},an=p=>{kn(p.selectionStart??p.value.length)},Bi=(p,j)=>{vt&&tn(null),vn(!1),$t(0),Et(p),kn(j)},ml=async p=>{if(p)try{const j=await Promise.all([...p].map(_b));ql(L=>[...L,...j])}catch(j){window.alert(j.message)}},Pn=async p=>{xt("select.model",{provider:p},B),a!=null&&a.capabilities.catalog&&oe(`/v1/models?provider=${encodeURIComponent(p)}`).then(j=>{const L=j.models||[];$n(L.map(Ue=>String(Ue.ID||Ue.id||"")).filter(Boolean));const Z=_.status.model,F=L.find(Ue=>String(Ue.ID||Ue.id||"")===Z)||L[0];Sn(F?{inputPerM:Number(F.InputCost??F.inputCost??0),outputPerM:Number(F.OutputCost??F.outputCost??0),hasCost:!!(F.HasCost??F.hasCost),context:Number(F.Context??F.context??0)||void 0}:void 0)}).catch(()=>{$n([]),Sn(void 0)})};T.useEffect(()=>{!(a!=null&&a.capabilities.catalog)||!_.status.provider||oe(`/v1/models?provider=${encodeURIComponent(_.status.provider)}`).then(p=>{const j=p.models||[];$n(j.map(Z=>String(Z.ID||Z.id||"")).filter(Boolean));const L=j.find(Z=>String(Z.ID||Z.id||"")===_.status.model);L&&Sn({inputPerM:Number(L.InputCost??L.inputCost??0),outputPerM:Number(L.OutputCost??L.outputCost??0),hasCost:!!(L.HasCost??L.hasCost),context:Number(L.Context??L.context??0)||void 0})}).catch(()=>{})},[a==null?void 0:a.capabilities.catalog,_.status.provider,_.status.model]);const el=async(p,j)=>{te(p);const L=ks(p),Z=(()=>{if(!(!L||!a)&&!(L.capability==="always"||L.capability==="team"||L.capability==="live"||L.capability==="sessions")){if(L.capability==="lsp"&&!a.capabilities.lsp)return{id:p,reason:"capability lsp unavailable"};if(typeof L.capability=="string"&&L.capability!=="lsp"&&!a.capabilities[L.capability])return{id:p,reason:`capability ${L.capability} unavailable`}}})();de(Z),(j==null?void 0:j.open)!==!1&&S(!0),Lt(!0),Gn(void 0);try{if(Z)return;Gn(p==="files"?a!=null&&a.capabilities.files?await oe(`/v1/changed-files${B?`?root=${encodeURIComponent(B)}`:""}`).catch(F=>({error:F.message})):void 0:p==="memory"?a!=null&&a.capabilities.memory?await oe("/v1/memory").catch(F=>({error:F.message})):void 0:p==="issues"&&a!=null&&a.capabilities.issues?await oe("/v1/issues").catch(F=>({error:F.message})):void 0)}finally{Lt(!1)}},Zl=(p,j)=>{if(K(p),(j==null?void 0:j.entity)!==void 0&&X(j.entity),p==="chat"&&!(j!=null&&j.surface)){(j==null?void 0:j.openDrawer)===!1||(j==null||j.openDrawer),Za({mode:"chat",surface:"",entity:(j==null?void 0:j.entity)||""});return}const L=(j==null?void 0:j.surface)||Do(p,a==null?void 0:a.capabilities,{attachOnly:a==null?void 0:a.attachOnly,isLive:z});L&&el(L,{open:(j==null?void 0:j.openDrawer)!==!1}),Za({mode:p,surface:L||"",entity:(j==null?void 0:j.entity)||R})};T.useEffect(()=>{if(!a)return;if(!a.capabilities.panes){xo(),Ee(j=>j+1);return}let p=!1;return Pt(async()=>{const{listPanes:j}=await import("./panesApi-1q1G3asp.js");return{listPanes:j}},[]).then(({listPanes:j})=>j()).then(j=>{if(!p){xo();for(const L of j.panes||[]){const Z=qv(L);Z&&Lv(Z)}Ee(L=>L+1)}}).catch(()=>{p||Ee(j=>j+1)}),()=>{p=!0,xo()}},[a]),T.useEffect(()=>{var L;if(!a||ut.current||qo(location.search).raw.surface.startsWith("pane:")&&ge===0)return;ut.current=!0;const j=fb(location.search,a.capabilities,{attachOnly:a.attachOnly,isLive:z||!!a.capabilities.live});if(K(j.mode),j.entity&&X(j.entity),j.agent&&jt(j.agent),j.unavailable&&de(j.unavailable),j.surface)el(j.surface,{open:j.openDrawer});else{const Z=zo("chat",a.capabilities,{attachOnly:a.attachOnly});if(Z.length){const F=((L=Z.find(Ue=>Ue.id==="files"))==null?void 0:L.id)||Z[0].id;el(F,{open:!1})}}},[a,ge]);const Jl=async p=>{var L;if(!(a!=null&&a.capabilities.sessions)||!B)return;const j=B;try{if(p==="fork"){await oe(`/v1/sessions/${encodeURIComponent(j)}/fork`,{method:"POST"}),await Promise.all([dl(),Qt()]);return}if(p==="rename"){const Z=window.prompt("Session title");if(Z===null)return;await oe(`/v1/sessions/${encodeURIComponent(j)}`,{method:"PATCH",body:JSON.stringify({title:Z})})}if(p==="delete"){if(!window.confirm("Delete this durable session?"))return;await oe(`/v1/sessions/${encodeURIComponent(j)}`,{method:"DELETE"}),ee({type:"client.drop",id:j});const Z=await dl();await Qt();const F=((L=((Z==null?void 0:Z.sessions)||[]).find(Ue=>Ue.id!==j))==null?void 0:L.id)||"";if(F){ee({type:"client.ensure",id:F});const Ue=!!(Z!=null&&Z.liveId&&F===Z.liveId||d.some(Ae=>Ae.id===F));C(Ue),$(Ue?"active":"history")}return}await Promise.all([dl(),Qt()])}catch(Z){window.alert(Z.message)}},ti=async()=>{if(!(!(a!=null&&a.capabilities.roots)||a.attachOnly))try{const p=await Ug();await Qt(),ee({type:"client.ensure",id:p.id}),C(!0),$("active")}catch(p){window.alert(p.message)}},ni=async p=>{if(!(!(a!=null&&a.capabilities.roots)||a.attachOnly))try{const j=await Rg(p);await Qt(),ee({type:"client.ensure",id:j.id}),C(!0),$("active")}catch(j){window.alert(j.message)}},pl=async(p,j)=>{if(ee({type:"client.ensure",id:p}),C(j),Sn(void 0),X(""),jt(void 0),!(!j||!(a!=null&&a.capabilities.roots)||a.attachOnly))try{if(await Am(p),await Qt(),a!=null&&a.capabilities.team){const L=await wg(p).catch(()=>null);L&&ee({type:"client.event",id:p,envelope:{type:"team.snapshot",time:`snap:${p}`,data:L}})}}catch(L){window.alert(L.message)}},kt=async()=>{var L,Z,F,Ue;if(!(a!=null&&a.capabilities.roots)||a.attachOnly||!z||!B)return;const p=d.find(Ae=>Ae.id===B),j=p!=null&&p.busy?"This workspace is busy. Close/stop it anyway?":"Close this workspace?";if(window.confirm(j))try{await Lg(B);const[Ae,_e]=await Promise.all([Qt(),dl()]),et=(Ae==null?void 0:Ae.activeId)||((Z=(L=Ae==null?void 0:Ae.roots)==null?void 0:L[0])==null?void 0:Z.id)||"";if(et)ee({type:"client.ensure",id:et}),C(!0),$("active");else{const sn=((Ue=(F=_e==null?void 0:_e.sessions)==null?void 0:F[0])==null?void 0:Ue.id)||"";sn&&ee({type:"client.ensure",id:sn}),C(!1),$("history")}}catch(Ae){window.alert(Ae.message)}},tl=p=>{if(!(a!=null&&a.capabilities.roots)){if(!r.length)return;const j=Math.max(0,r.findIndex(Z=>Z.id===B)),L=r[(j+p+r.length)%r.length];L&&(ee({type:"client.ensure",id:L.id}),C(L.id===y&&!(a!=null&&a.attachOnly)));return}if(O==="active"&&d.length){const j=Math.max(0,d.findIndex(Z=>Z.id===B&&z)),L=d[(j+p+d.length)%d.length];L&&pl(L.id,!0);return}if(r.length){const j=Math.max(0,r.findIndex(Z=>Z.id===B)),L=r[(j+p+r.length)%r.length];if(L){const Z=d.some(F=>F.id===L.id);pl(L.id,Z)}}},Wl=p=>{jt(void 0),pl(p,!1),$("history")},Oa=async p=>{if(!(a!=null&&a.capabilities.sandbox)||!($e!=null&&$e.canChangeDefault))return;const j=String(_.status.permissionMode||$e.permissionMode||"");let L=!1;if(p==="off"&&j==="yolo"){if(L=window.confirm("permissionMode is yolo and sandbox off disables OS isolation. Continue only if you understand the risk (equivalent to --i-know)."),!L)return}else if(p!==($e.defaultMode||_.status.sandbox)&&!window.confirm(`Save sandbox default "${p}" for new sessions? Active session stays "${_.status.sandbox||$e.mode||"workspace-write"}".`))return;try{const Z=await _g(p,L,B||void 0);fl(Z),window.alert(`Sandbox default saved as ${Z.defaultMode||p}. Active session mode is unchanged until a new session starts.`)}catch(Z){window.alert(Z.message)}},Gs=async()=>{if(a!=null&&a.capabilities.sandbox)try{const p=await Tm(B||void 0);fl(p),Fe(!0)}catch(p){window.alert(p.message)}},Hi=p=>qt(j=>{const L=new Set(j);return L.has(p)?L.delete(p):L.add(p),L}),li=d.filter(p=>Im(p)&&!(p.id===B&&z)),yl=li.length,Fl=yl>0?`${yl} need${yl===1?"s":""} you`:"",$s=!!(_.permission||_.question),za=Jg({busy:!!_.status.busy,needsYou:$s}),dc=za==="needs-you"?"needs you":za==="busy"?"agent working":J,Xs=p=>c.jsx("nav",{className:p,"aria-label":"Workspace mode",children:Ro.map(j=>{const L=ki[j],Z=Yv(j,pt),F=U===j;return c.jsxs("button",{type:"button",className:F?"mode-btn active":"mode-btn","aria-pressed":F,"aria-current":F?"page":void 0,"aria-label":`${L.label}: ${L.description}${Z==="needs-you"?", needs attention":Z==="badge"?", activity":""}`,onClick:()=>{Yl&&Rt(!1),Zl(j,{openDrawer:j!=="chat"})},children:[c.jsx("span",{children:L.label}),Z!=="none"&&c.jsx("span",{className:Z==="needs-you"?"mode-attn needs-you":"mode-attn","aria-hidden":!0})]},j)})});return c.jsxs("div",{className:"app-shell",style:wt,"data-shell":ze,children:[c.jsxs("header",{children:[c.jsx("button",{className:"icon-button","aria-label":"Toggle agents panel","aria-pressed":en,onClick:()=>{S(!1),Rt(p=>!p)},children:"☰"}),c.jsxs("div",{className:"wordmark",children:[c.jsx("span",{className:"mark",children:"S"}),c.jsx("strong",{children:"STRIKE"}),c.jsx("small",{children:"workspace"})]}),c.jsxs("button",{type:"button",className:"palette-trigger","aria-label":"Open command palette",onClick:()=>{rl.current=document.activeElement instanceof HTMLElement?document.activeElement:null,Xn(!0)},children:["Commands ",c.jsx("kbd",{children:"⌘K"})]}),!Yl&&Xs("mode-switch header-mode-switch"),c.jsxs("div",{className:`session-line session-line-${za}`,"aria-live":"polite",children:[c.jsx("span",{className:`pulse ${za}`,"data-status":za}),!Yl&&dc,Fl&&c.jsx("button",{type:"button",className:"attention-summary","aria-label":Fl,onClick:()=>{const p=li[0];p&&pl(p.id,!0)},children:Fl})]}),c.jsx("button",{className:"icon-button","aria-label":"Export markdown",title:"Export markdown",onClick:()=>Kl(),children:"↓"}),c.jsx("button",{className:"icon-button","aria-label":"Open settings",onClick:()=>Vn(!0),children:"⚙"}),c.jsx("button",{className:"icon-button","aria-label":"Toggle inspector","aria-pressed":fe,onClick:()=>{ze!=="desktop"&&Rt(!1),S(p=>!p)},children:"◫"})]}),Rs&&c.jsx("button",{type:"button",className:"shell-backdrop visible","aria-label":"Close panel",onClick:()=>{Rt(!1),S(!1)}}),c.jsxs("aside",{className:`navigation ${en?"open":"collapsed"}`,"aria-label":"Agents panel",tabIndex:0,onKeyDown:p=>{p.target instanceof HTMLInputElement||p.target instanceof HTMLTextAreaElement||((p.key==="ArrowDown"||p.key==="j")&&(p.preventDefault(),tl(1)),(p.key==="ArrowUp"||p.key==="k")&&(p.preventDefault(),tl(-1)))},children:[c.jsx(Pm,{label:"Resize agents panel",value:Hn,min:180,max:420,onChange:Mn,side:"nav"}),a!=null&&a.capabilities.roots?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"aside-heading",children:[c.jsx("button",{className:`nav-tab ${O==="active"?"active":""}`,onClick:()=>$("active"),children:"ACTIVE"}),c.jsx("button",{className:`nav-tab ${O==="history"?"active":""}`,onClick:()=>$("history"),children:"HISTORY"})]}),O==="active"&&c.jsxs(c.Fragment,{children:[c.jsx("nav",{children:d.map(p=>{const j=Mb(p,r),L=ko(p.activeAt),Z=Im(p);return c.jsxs("button",{type:"button",className:p.id===B&&z?"session active":"session",onClick:()=>void pl(p.id,!0),title:p.id,"aria-label":`${j}${Z?", needs attention":""}`,children:[c.jsx("span",{className:Z?"root-attention":p.busy?"root-busy":"root-idle","aria-hidden":!0}),c.jsxs("span",{className:"session-main",children:[c.jsx("span",{className:"session-title",children:j}),c.jsxs("span",{className:"session-meta",children:[p.agent||"—",L?` · ${L}`:"",p.hasRecentEvent&&!p.busy&&!Z?" · recent":""]})]}),c.jsxs("span",{className:"session-flags",children:[p.id===v&&c.jsx("small",{children:"ACTIVE"}),Z?c.jsx("small",{className:"needs-you",children:"NEEDS YOU"}):c.jsx("small",{className:p.busy?"session-busy":"session-idle",children:p.busy?"BUSY":"IDLE"})]})]},p.id)})}),!(a!=null&&a.attachOnly)&&c.jsxs("div",{className:"session-actions",children:[c.jsx("button",{type:"button",onClick:()=>void ti(),children:"+ New workspace"}),c.jsx("button",{type:"button",disabled:!z||!B,onClick:()=>void kt(),children:"Close workspace"})]})]}),O==="history"&&c.jsx(Bb,{sessions:r,activeRoots:d,selectedID:B,selectedIsLive:z,historySearch:Q,setHistorySearch:le,selectWorkspace:pl,handleResume:ni,boot:a,sessionAction:Jl})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"aside-heading",children:c.jsx("span",{children:"SESSIONS"})}),c.jsx("nav",{children:r.map(p=>{const j=p.id===y&&!(a!=null&&a.attachOnly),L=ko(p.mtime);return c.jsxs("button",{type:"button",className:p.id===B?"session active history-row":"session history-row",onClick:()=>{ee({type:"client.ensure",id:p.id}),C(j)},title:p.id,children:[c.jsxs("span",{className:"session-main",children:[c.jsx("span",{className:"session-title",children:p.title||Ui(p.id)}),c.jsx("span",{className:"session-meta",children:[Ui(p.id),L].filter(Boolean).join(" · ")})]}),c.jsx("span",{className:"session-flags",children:j&&c.jsx("small",{className:"live-badge",children:"LIVE"})})]},p.id)})}),(a==null?void 0:a.capabilities.sessions)&&B&&c.jsx("div",{className:"session-actions","aria-label":"Session actions",children:c.jsx(zp,{onAction:p=>void Jl(p)})})]}),!Aa&&c.jsx(dp,{children:E,selectedId:tt,onSelect:jt,onOpenTranscript:Wl}),c.jsxs("details",{className:"workspace-meta",children:[c.jsx("summary",{children:"Workspace"}),c.jsx("span",{children:"ROOT"}),c.jsx("code",{children:_.status.cwd||"unavailable"}),c.jsx("span",{children:"BUILD"}),c.jsx("code",{children:(a==null?void 0:a.version)||"…"})]})]}),c.jsxs("main",{children:[c.jsxs("div",{className:"runtime-stack",children:[c.jsxs("section",{className:"runtime","aria-label":"Runtime controls",children:[c.jsx(Qa,{label:"Provider",value:_.status.provider,values:wn.length?wn:_.status.provider?[_.status.provider]:[],disabled:Pe||!(a!=null&&a.capabilities.auth),onChange:p=>void Pn(p)}),c.jsx(Qa,{label:"Model",value:_.status.model,values:Rl.length?Rl:_.status.model?[_.status.model]:[],disabled:Pe||!(a!=null&&a.capabilities.catalog),onChange:p=>void xt("select.model",{provider:_.status.provider,model:p},B)}),c.jsx(Qa,{label:"Agent",value:_.status.agent,values:((a==null?void 0:a.agents)||[]).map(p=>p.name),disabled:Pe,onChange:p=>void xt("select.agent",{name:p},B)}),c.jsxs("div",{className:"runtime-more",children:[c.jsxs("button",{type:"button",className:"runtime-disclosure","aria-expanded":xn,"aria-controls":"runtime-secondary",onClick:()=>Wa(p=>!p),children:[c.jsx("span",{children:"Runtime…"}),!xn&&Hl&&c.jsx("span",{className:"runtime-summary",children:Hl})]}),xn&&c.jsxs("div",{id:"runtime-secondary",className:"runtime-secondary",role:"group","aria-label":"Secondary runtime controls",children:[c.jsx(Qa,{label:"Effort",value:_.status.effort,values:uc.effort,disabled:Pe,onChange:p=>void xt("set.effort",{level:p},B)}),c.jsx(Qa,{label:"Autonomy",value:_.status.autonomy,values:uc.autonomy,disabled:Pe,onChange:p=>void xt("set.autonomy",{mode:p},B)}),c.jsx(Qa,{label:"Permission",value:_.status.permissionMode,values:uc.permission,disabled:Pe,onChange:p=>void xt("set.permission_mode",{mode:p},B)}),(a==null?void 0:a.capabilities.sandbox)&&c.jsx(Qa,{label:"Sandbox",value:_.status.sandbox||($e==null?void 0:$e.mode),values:($e==null?void 0:$e.modes)||uc.sandbox,disabled:!nt||_.status.busy||!($e!=null&&$e.canChangeDefault),onChange:p=>void Oa(p)}),(a==null?void 0:a.capabilities.sandbox)&&c.jsx("button",{type:"button",className:"runtime-explain",onClick:()=>void Gs(),children:"Explain"}),c.jsxs("label",{className:"fast-toggle",children:[c.jsx("input",{type:"checkbox",checked:P,disabled:Pe,onChange:p=>{jn(p.target.checked),xt("set.fast",{enabled:p.target.checked},B)}}),"FAST"]}),c.jsxs("label",{className:"fast-toggle",children:[c.jsx("input",{type:"checkbox","aria-label":"Show thinking",checked:ol,onChange:p=>{const j=p.target.checked;Ta(j),Ob(j)}}),"THINK"]})]})]})]}),c.jsx(Hb,{status:_.status,modelRates:Jn})]}),c.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:Qe}),c.jsxs("section",{ref:Ll,className:"transcript","aria-label":"Conversation transcript",children:[!a&&J!=="connecting"?c.jsxs("div",{className:"empty-state",role:"alert",children:[c.jsx("span",{children:"ERROR"}),c.jsx("h1",{children:J}),c.jsxs("p",{children:["Failed to load cockpit. Open the URL printed by ",c.jsx("code",{children:"strike serve"})," (one-time ",c.jsx("code",{children:"?token="})," handoff sets a cookie), or send ",c.jsx("code",{children:"Authorization: Bearer"}),"."]})]}):!_.items.length&&c.jsxs("div",{className:"empty-state",children:[c.jsx("span",{children:"01 / READY"}),c.jsx("h1",{children:a!=null&&a.attachOnly?"Inspect the record.":"Direct the work."}),c.jsx("p",{children:a!=null&&a.attachOnly?"Select a durable session from the rail.":"Describe an outcome. Strike will plan, act, and report through the live engine seam."})]}),c.jsx(sb,{items:_.items,showThinking:ol,onFileRef:Bl,scrollRef:Ll,stickToBottom:Dt.current}),c.jsx("div",{ref:Un}),Wn&&c.jsx("button",{type:"button",className:"jump-latest",onClick:hl,children:Fn>0?`${Fn} new — jump to latest`:"New activity — jump to latest"})]}),bn&&c.jsxs("div",{className:"onboard-hint",role:"status",children:[c.jsxs("p",{children:["Tip: ",c.jsx("kbd",{children:"⌘K"})," command palette · ",c.jsx("code",{children:"/"})," slash commands · ",c.jsx("code",{children:"@"})," mention files"]}),c.jsx("button",{type:"button",onClick:()=>{try{localStorage.setItem("strike.web.onboard.v1","1")}catch{}Qn(!1)},children:"Dismiss"})]}),c.jsxs("form",{className:"composer",onSubmit:Hs,children:[c.jsxs("label",{htmlFor:"prompt",children:["Instruction ",_.status.busy&&"— send to queue"]}),c.jsxs("div",{className:"composer-field",children:[(_t.length>0||qi)&&c.jsx("div",{ref:Bs,className:"completion",role:"listbox","aria-label":"Composer completions",children:_t.length===0?c.jsx("div",{children:Ht}):_t.map((p,j)=>c.jsxs("button",{type:"button",role:"option","aria-selected":j===Xl,className:j===Xl?"active":"",onMouseEnter:()=>$t(j),onClick:()=>ei(p),children:[c.jsx("strong",{children:p.label}),c.jsx("span",{children:p.detail})]},p.label))}),c.jsx("textarea",{ref:nn,"aria-label":"Instruction",id:"prompt",value:pe,disabled:!nt,placeholder:nt?"Describe the next outcome… / command · @file":"Historical session — read only",onPaste:p=>void ml(p.clipboardData.files),onDrop:p=>{p.preventDefault(),ml(p.dataTransfer.files)},onDragOver:p=>p.preventDefault(),onChange:p=>Bi(p.currentTarget.value,p.currentTarget.selectionStart??p.currentTarget.value.length),onSelect:p=>an(p.currentTarget),onKeyUp:p=>an(p.currentTarget),onClick:p=>an(p.currentTarget),onKeyDown:Na})]}),me.length>0&&c.jsx("div",{className:"attachments",children:me.map((p,j)=>c.jsxs("button",{type:"button",onClick:()=>ql(L=>L.filter((Z,F)=>F!==j)),children:[p.name," ×"]},`${p.name}-${j}`))}),!Aa&&c.jsx(hp,{queue:W,queueEdit:ue,setQueueEdit:ie,queueEditCancel:Ge,queueRef:Se,setQueue:ln}),c.jsxs("div",{className:"composer-bar",children:[c.jsxs("span",{children:[c.jsx("kbd",{children:"↵"})," send · ",c.jsx("kbd",{children:"⇧↵"})," newline · ",c.jsx("kbd",{children:"↑"})," history"]}),c.jsxs("span",{children:[c.jsx("input",{ref:Ie,hidden:!0,type:"file",accept:"image/*",multiple:!0,onChange:p=>void ml(p.target.files)}),c.jsx("button",{type:"button",className:"composer-secondary",onClick:()=>{var p;return(p=Ie.current)==null?void 0:p.click()},children:"Attach"}),Bt.length>0&&c.jsx("button",{type:"button",className:"composer-secondary",onClick:()=>Et(Bt.at(-1)||""),children:"History"}),c.jsx("button",{type:"button",className:"composer-secondary",onClick:()=>Kl(),disabled:!_.items.length,children:"Export"}),_.status.busy&&c.jsx("button",{type:"button",className:"stop",onClick:()=>void xt("interrupt"),children:"Interrupt"}),c.jsx("button",{type:"submit",className:"composer-send",disabled:!pe.trim()||!nt,children:_.status.busy?"Queue":"Send"})]})]})]}),c.jsx(Fv,{open:cl,commands:Gl,onClose:()=>{Xn(!1);const p=rl.current;if(p&&document.contains(p))try{p.focus()}catch{}},onRun:Ys})]}),c.jsxs("aside",{className:`inspector ${fe?"open":"collapsed"}`,"aria-label":"Inspector",children:[c.jsx(Pm,{label:"Resize inspector panel",value:Yn,min:240,max:520,onChange:pn,side:"inspector"}),Aa&&c.jsx(ov,{contextLabel:Np(_.status),provider:_.status.provider,model:_.status.model,phase:_.status.phase,fitWarning:_.fitWarning,childrenEntries:E,selectedChildId:tt,onSelectChild:jt,onOpenChildTranscript:Wl,queue:W,queueEdit:ue,setQueueEdit:ie,queueEditCancel:Ge,queueRef:Se,setQueue:ln}),c.jsx(rb,{modeLabel:ki[U].label,surfaces:G,activeId:Vt,profile:ze,onChange:p=>{de(void 0),Za({mode:U,surface:p,entity:R}),el(p)}}),c.jsx("div",{className:"inspector-body",id:Vt?`inspector-panel-${Vt}`:void 0,role:"tabpanel",children:De.length?c.jsx(T.Suspense,{fallback:c.jsx(Cb,{label:Vt||"surface"}),children:c.jsx(Qb,{tab:Vt,boot:a,workspace:_,data:Li,loading:Ul,expandedDiffs:ul,toggleDiff:Hi,isLive:nt,selectedID:B,onRefresh:()=>void el(Vt),sandbox:$e,onExplainSandbox:()=>void Gs(),unavailable:(V==null?void 0:V.id)===Vt?V:void 0,childrenEntries:E,selectedChildId:tt,onSelectChild:jt,onOpenChildTranscript:Wl,entity:R,onOpenSettings:()=>Vn(!0)})}):c.jsxs("p",{className:"muted",children:["No surfaces available for ",ki[U].label," on this host."]})})]}),ja&&c.jsx(q0,{boot:a,status:_.status,providers:wn,rootID:B,isLive:nt,onClose:()=>Vn(!1)}),Xt&&$e&&c.jsx(Lb,{info:$e,status:_.status,onClose:()=>Fe(!1)}),St&&c.jsx(Wb,{preview:Ql,preferFiles:St.preferFiles,onCancel:()=>st(null),onConfirm:Vl}),_.permission&&c.jsx(qb,{permission:_.permission,rootID:B,canExplain:!!(a!=null&&a.capabilities.permissions)}),_.question&&c.jsx(Jb,{question:_.question,rootID:B}),Yl&&Xs("mode-bottom-bar")]})}function Ub(a){return String(a.permission||a.tool||a.name||"tool")}function Rb(a){const u=a.patterns;return Array.isArray(u)?u.map(r=>String(r)).filter(Boolean):typeof u=="string"&&u.trim()?[u]:[]}function Lb({info:a,status:u,onClose:r}){const o=T.useRef(null);T.useEffect(()=>{var h;(h=o.current)==null||h.showModal()},[]);const d=u.networkAllow||a.networkAllow||[];return c.jsxs("dialog",{ref:o,className:"sandbox-explain-dialog","aria-labelledby":"sandbox-explain-title",onClose:r,children:[c.jsx("div",{className:"dialog-rule"}),c.jsx("h2",{id:"sandbox-explain-title",children:"Sandbox explain"}),c.jsxs("dl",{className:"sandbox-summary",children:[c.jsx("dt",{children:"Active mode"}),c.jsx("dd",{children:u.sandbox||a.mode}),c.jsx("dt",{children:"Default mode"}),c.jsx("dd",{children:a.defaultMode||"—"}),c.jsx("dt",{children:"Backend"}),c.jsx("dd",{children:u.sandboxBackend||a.backend||(a.available?"available":"unavailable")}),c.jsx("dt",{children:"Network allow"}),c.jsx("dd",{children:d.length?d.join(", "):"(none — unrestricted public)"}),c.jsx("dt",{children:"Permission mode"}),c.jsx("dd",{children:u.permissionMode||a.permissionMode||"—"})]}),c.jsx("pre",{className:"sandbox-explain",children:a.explain||"No profile text."}),a.note&&c.jsx("p",{className:"muted",children:a.note}),c.jsx("div",{className:"dialog-actions",children:c.jsx("button",{autoFocus:!0,onClick:r,children:"Close"})})]})}function qb({permission:a,rootID:u,canExplain:r}){const o=Ub(a),d=Rb(a),h=d[0]||"*",[y,b]=T.useState(null),[v,g]=T.useState(""),[z,C]=T.useState(!1),O=ee=>void xt("permission.reply",{requestId:a.requestId,decision:ee},u),$=async()=>{if(!(!r||z)){C(!0),g("");try{const ee=new URLSearchParams({permission:o,pattern:h});b(await oe(`/v1/permissions/explain?${ee}`))}catch(ee){g(ee.message),b(null)}finally{C(!1)}}},Q=(y==null?void 0:y.Summary)||(y==null?void 0:y.summary)||"",le=(y==null?void 0:y.Action)||(y==null?void 0:y.action)||"",ye=(y==null?void 0:y.Layer)||(y==null?void 0:y.layer)||"";return c.jsxs(Op,{title:"Permission required",children:[c.jsx("p",{className:"permission-tool",children:c.jsx("strong",{children:o})}),d.length>0?c.jsx("ul",{className:"permission-patterns","aria-label":"Permission patterns",children:d.map(ee=>c.jsx("li",{children:c.jsx("code",{children:ee})},ee))}):c.jsx("p",{className:"muted",children:"No pattern detail provided for this request."}),r&&c.jsxs("div",{className:"permission-explain",children:[c.jsx("button",{type:"button",onClick:()=>void $(),disabled:z,children:z?"Explaining…":"Why is this asked?"}),v&&c.jsx("p",{className:"permission-explain-error",role:"status",children:v}),Q&&c.jsxs("pre",{className:"permission-explain-body","aria-label":"Permission explanation",children:[Q,(le||ye)&&`
+
+Effective: ${le||"unknown"}${ye?` (${ye})`:""}`]})]}),c.jsxs("div",{className:"dialog-actions",children:[c.jsx("button",{type:"button",onClick:()=>O("reject"),children:"Reject"}),c.jsx("button",{type:"button",onClick:()=>O("project"),children:"Allow for project"}),c.jsx("button",{type:"button",onClick:()=>O("always"),children:"Allow session"}),c.jsx("button",{type:"button",autoFocus:!0,onClick:()=>O("once"),children:"Allow once"})]})]})}function Pm({label:a,value:u,min:r,max:o,onChange:d,side:h}){const y=T.useRef(null),b=O=>Math.min(o,Math.max(r,Math.round(O))),v=O=>{O.preventDefault(),y.current={x:O.clientX,width:u},O.currentTarget.setPointerCapture(O.pointerId)},g=O=>{if(!y.current)return;const $=O.clientX-y.current.x;d(b(h==="nav"?y.current.width+$:y.current.width-$))},z=O=>{y.current=null,O.currentTarget.hasPointerCapture(O.pointerId)&&O.currentTarget.releasePointerCapture(O.pointerId)},C=O=>{const $=O.shiftKey?20:10;O.key==="ArrowLeft"&&(O.preventDefault(),d(b(u-$))),O.key==="ArrowRight"&&(O.preventDefault(),d(b(u+$))),O.key==="Home"&&(O.preventDefault(),d(r)),O.key==="End"&&(O.preventDefault(),d(o))};return c.jsx("div",{className:`panel-resize panel-resize-${h}`,children:c.jsx("div",{className:"panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":a,"aria-valuenow":u,"aria-valuemin":r,"aria-valuemax":o,tabIndex:0,onPointerDown:v,onPointerMove:g,onPointerUp:z,onPointerCancel:z,onKeyDown:C})})}function zp({onAction:a}){return c.jsxs("details",{className:"session-overflow",children:[c.jsx("summary",{children:"Session…"}),c.jsxs("div",{className:"session-overflow-menu",role:"menu",children:[c.jsx("button",{type:"button",role:"menuitem",onClick:()=>a("fork"),children:"Fork"}),c.jsx("button",{type:"button",role:"menuitem",onClick:()=>a("rename"),children:"Rename"}),c.jsx("button",{type:"button",role:"menuitem",onClick:()=>a("delete"),children:"Delete"})]})]})}function Bb({sessions:a,activeRoots:u,selectedID:r,selectedIsLive:o,historySearch:d,setHistorySearch:h,selectWorkspace:y,handleResume:b,boot:v,sessionAction:g}){const z=!!(v!=null&&v.capabilities.sessions),C=!!r,O=a.filter($=>{var Q;return!d||((Q=$.title)==null?void 0:Q.toLowerCase().includes(d.toLowerCase()))||$.id.toLowerCase().includes(d.toLowerCase())});return c.jsxs(c.Fragment,{children:[c.jsx("input",{className:"history-search",type:"search",placeholder:"Search sessions…","aria-label":"Search sessions",value:d,onChange:$=>h($.target.value)}),c.jsx("nav",{"aria-label":"Session history",children:O.map($=>{const Q=u.some(B=>B.id===$.id),le=ko($.mtime),ye=$.forkedFrom?`fork of ${Ui($.forkedFrom)}`:"",ee=[Ui($.id),le,ye].filter(Boolean).join(" · ");return c.jsxs("button",{type:"button",className:$.id===r?"session active history-row":"session history-row",onClick:()=>void y($.id,Q),title:$.id,children:[c.jsxs("span",{className:"session-main",children:[c.jsx("span",{className:"session-title",children:$.title||Ui($.id)}),c.jsx("span",{className:"session-meta",children:ee})]}),c.jsx("span",{className:"session-flags",children:Q&&c.jsx("small",{className:"live-badge",children:"LIVE"})})]},$.id)})}),c.jsxs("div",{className:"session-actions",children:[!o&&!(v!=null&&v.attachOnly)&&c.jsx("button",{type:"button",disabled:!C||!(v!=null&&v.capabilities.roots),onClick:()=>void b(r),children:"Resume as workspace"}),z&&C&&c.jsx(zp,{onAction:$=>void g($)})]})]})}function Hb({status:a,modelRates:u}){const r=a.contextLimit===void 0&&(u!=null&&u.context)?{...a,contextLimit:u.context}:a,o=[];a.agent&&o.push(`Agent ${a.agent}`),a.effort&&o.push(`Effort ${a.effort}`),a.autonomy&&o.push(`Autonomy ${a.autonomy}`),a.permissionMode&&o.push(`Permission ${a.permissionMode}`),a.phase&&o.push(`Phase ${a.phase}`),a.workflow&&o.push(`Workflow ${a.workflow}`),a.cwd&&o.push(`CWD ${a.cwd}`);const d=Np(r);d!=="not reported"&&o.push(`Context ${d}`);const h=wv(a,u);return h!=="not reported"&&o.push(`Cost ${h}`),o.length?c.jsx("div",{className:"runtime-status","aria-label":"Session status",children:o.map(y=>c.jsx("span",{children:y},y))}):null}function Yb(a){return a!=null&&a.known?`~${(a.n??0).toLocaleString()}`:"—"}function Gb(a){return a.contextUsed!==void 0&&a.contextLimit!==void 0?`${a.contextUsed.toLocaleString()} / ${a.contextLimit.toLocaleString()}`:a.contextUsed!==void 0?`${a.contextUsed.toLocaleString()} / —`:a.contextLimit!==void 0?`— / ${a.contextLimit.toLocaleString()}`:"not reported"}function $b({workspace:a,isLive:u,selectedID:r}){const{status:o,attribution:d,layers:h,pinnedKinds:y,excludedKinds:b,shedKinds:v,fitWarning:g,promptScope:z,systemChars:C,messageCount:O}=a,$=(W,me)=>{u&&xt("context.controls",{pinKinds:W,setPin:!0,excludeKinds:me,setExclude:!0},r)},Q=W=>$(_m(y,W),tc(b,W)),le=W=>$(tc(y,W),b),ye=W=>$(tc(y,W),_m(b,W)),ee=W=>$(y,tc(b,W)),B=()=>$([],[]),_=()=>{u&&xt("inspect.prompt",void 0,r)},pe=Array.from(new Set([...cb,...y,...b,...h.map(W=>W.kind)])).filter(Boolean);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"context-doctor-head",children:[c.jsx("h2",{children:"Context doctor"}),c.jsxs("div",{className:"context-doctor-actions",children:[c.jsx("button",{type:"button",disabled:!u,onClick:_,children:"Refresh"}),c.jsx("button",{type:"button",disabled:!u||!y.length&&!b.length,onClick:B,children:"Clear pin/exclude"})]})]}),g&&c.jsx(Xb,{warning:g}),c.jsxs("dl",{children:[c.jsx("dt",{children:"Provider"}),c.jsx("dd",{children:o.provider||"unknown"}),c.jsx("dt",{children:"Model"}),c.jsx("dd",{children:o.model||"unknown"}),c.jsx("dt",{children:"Phase"}),c.jsx("dd",{children:o.phase||"idle"}),c.jsx("dt",{children:"Workflow"}),c.jsx("dd",{children:o.workflow||"none"}),c.jsx("dt",{children:"Context"}),c.jsx("dd",{children:Gb(o)}),o.usageSource&&c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"Usage source"}),c.jsx("dd",{children:o.usageSource})]}),z&&c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"Prompt scope"}),c.jsx("dd",{children:z==="last"?"last request":"current composition"})]}),C!==void 0&&c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"System chars"}),c.jsx("dd",{children:C.toLocaleString()})]}),O!==void 0&&c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"History"}),c.jsxs("dd",{children:[O.toLocaleString()," msgs"]})]})]}),c.jsx(Kb,{attribution:d}),(y.length>0||b.length>0||v.length>0)&&c.jsxs("section",{className:"context-sets","aria-label":"Context control sets",children:[c.jsx("h3",{children:"Controls"}),y.length>0&&c.jsxs("p",{children:[c.jsx("strong",{children:"Pinned"})," ",y.join(", ")]}),b.length>0&&c.jsxs("p",{children:[c.jsx("strong",{children:"Excluded"})," ",b.join(", ")]}),v.length>0&&c.jsxs("p",{children:[c.jsx("strong",{children:"Shed"})," ",v.join(", ")]})]}),c.jsxs("section",{className:"context-layers","aria-label":"Prompt layers",children:[c.jsx("h3",{children:"Layers"}),h.length===0?c.jsx("p",{className:"muted",children:u?"No layer breakdown yet. Refresh to inspect the effective prompt.":"No layer breakdown in this session log."}):c.jsxs("table",{className:"context-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:"Kind"}),c.jsx("th",{children:"~tok"}),c.jsx("th",{children:"Chars"}),c.jsx("th",{children:"Source"}),c.jsx("th",{children:"Actions"})]})}),c.jsx("tbody",{children:h.map(W=>{const me=W.pinned||y.includes(W.kind),P=b.includes(W.kind),J=W.estTokens??(W.chars?Math.ceil(W.chars/4):void 0);return c.jsxs("tr",{children:[c.jsxs("td",{children:[c.jsx("code",{children:W.kind}),me?" · pin":"",P?" · excl":""]}),c.jsx("td",{children:J!==void 0?`~${J.toLocaleString()}`:"—"}),c.jsx("td",{children:W.chars!==void 0?W.chars.toLocaleString():"—"}),c.jsx("td",{className:"muted",children:W.source||"—"}),c.jsxs("td",{className:"context-layer-actions",children:[me?c.jsx("button",{type:"button",disabled:!u,onClick:()=>le(W.kind),children:"Unpin"}):c.jsx("button",{type:"button",disabled:!u||P,onClick:()=>Q(W.kind),children:"Pin"}),P?c.jsx("button",{type:"button",disabled:!u,onClick:()=>ee(W.kind),children:"Include"}):c.jsx("button",{type:"button",disabled:!u,onClick:()=>ye(W.kind),children:"Exclude"})]})]},`${W.kind}:${W.source||""}`)})})]})]}),u&&c.jsxs("section",{className:"context-kind-picker","aria-label":"Pin or exclude layer kinds",children:[c.jsx("h3",{children:"Layer kinds"}),c.jsx("p",{className:"muted",children:"Pin retains a kind under fit pressure; exclude omits it from composition."}),c.jsx("div",{className:"context-kind-list",children:pe.map(W=>{const me=y.includes(W),P=b.includes(W);return c.jsxs("div",{className:"context-kind-row",children:[c.jsx("code",{children:W}),c.jsxs("span",{children:[me?c.jsx("button",{type:"button",onClick:()=>le(W),children:"Unpin"}):c.jsx("button",{type:"button",disabled:P,onClick:()=>Q(W),children:"Pin"}),P?c.jsx("button",{type:"button",onClick:()=>ee(W),children:"Include"}):c.jsx("button",{type:"button",onClick:()=>ye(W),children:"Exclude"})]})]},W)})})]})]})}function Xb({warning:a}){const u=a.level==="critical"?"critical":"warn";return c.jsxs("div",{className:`context-fit-warning ${u}`,role:"alert","aria-label":"Context fit warning",children:[c.jsx("strong",{children:a.level==="critical"?"Critical fit":"Fit warning"}),c.jsx("p",{children:a.message}),(a.estimatedTokens!==void 0||a.contextLimit!==void 0)&&c.jsxs("small",{children:[a.estimatedTokens!==void 0?`~${a.estimatedTokens.toLocaleString()} tok`:"—"," / ",a.contextLimit!==void 0?a.contextLimit.toLocaleString():"—",a.source?` (${a.source})`:""]})]})}function Kb({attribution:a}){if(!a)return null;const u=[["system",a.system],["tools",a.tools],["messages",a.messages],["tool_results",a.toolResults],["total",a.total]];return c.jsxs("section",{className:"context-attribution","aria-label":"Token breakdown by source",children:[c.jsx("h3",{children:"Tokens by source"}),c.jsxs("table",{className:"context-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:"Source"}),c.jsx("th",{children:"~Tokens"})]})}),c.jsx("tbody",{children:u.map(([r,o])=>c.jsxs("tr",{children:[c.jsx("td",{children:r}),c.jsx("td",{children:Yb(o)})]},r))})]}),c.jsxs("p",{className:"muted",children:["Local ~4 chars/token estimates",a.source?` · source ${a.source}`:"",". Not provider-measured billing."]})]})}function Qb({tab:a,boot:u,workspace:r,data:o,loading:d,expandedDiffs:h,toggleDiff:y,isLive:b,selectedID:v,onRefresh:g,sandbox:z,onExplainSandbox:C,unavailable:O,childrenEntries:$,selectedChildId:Q,onSelectChild:le,onOpenChildTranscript:ye,entity:ee,onOpenSettings:B}){var W,me,P;const _=r.status;if(O){const J=((W=ks(a))==null?void 0:W.label)||a;return c.jsxs("section",{className:"unavailable",role:"status",children:[c.jsxs("strong",{children:[J," unavailable"]}),c.jsxs("p",{children:[O.reason,". The surface was opened from a deep link or explicit navigation; no action was attempted."]})]})}if(a==="roster")return c.jsx(mb,{team:r.team,selectedId:Q||ee,onSelect:le||(()=>{}),onOpenTranscript:ye,readOnly:!b||!!(u!=null&&u.attachOnly),compact:typeof window<"u"&&window.innerWidth<720,protocolOps:u==null?void 0:u.protocolOps,teamControl:(me=u==null?void 0:u.capabilities)==null?void 0:me.teamControl,agents:((u==null?void 0:u.agents)||[]).map(J=>J.name),rootSessionId:v,sendOp:b&&!(u!=null&&u.attachOnly)?(J,se)=>tp(J,se,v):void 0});if(a==="artifacts")return c.jsx(yb,{available:!!(u!=null&&u.capabilities.artifacts),rootID:v,entity:ee,onOpenFile:J=>{Za({mode:"code",surface:"files",entity:J,root:v||void 0})}});if(a==="ledger")return c.jsx(gb,{available:!!(u!=null&&u.capabilities.ledger),rootID:v});if(a==="review")return c.jsx(vb,{team:r.team,onSelectAgent:le,onOpenFile:J=>{Za({mode:"code",surface:"files",entity:J,root:v||void 0})}});if(a==="context")return c.jsx($b,{workspace:r,isLive:b,selectedID:v});if(a==="workflows")return c.jsx(Ab,{available:!!(u!=null&&u.capabilities.workflows),draftsAvailable:!!(u!=null&&u.capabilities.workflowDrafts),live:b,rootID:v,activeWorkflow:_.workflow,agents:((u==null?void 0:u.agents)||[]).map(J=>J.name),busy:!!_.busy});if(a==="goals")return c.jsx(Eb,{available:!!(u!=null&&u.capabilities.goals),live:b});if(a==="plans")return c.jsx(Tb,{available:!!(u!=null&&u.capabilities.plans),live:b,rootID:v});if(a==="mcp")return c.jsx(bb,{available:!!(u!=null&&u.capabilities.mcp)});if(a==="plugins")return c.jsx(xb,{available:!!(u!=null&&u.capabilities.plugins),live:b&&!(u!=null&&u.attachOnly),panesAvailable:!!(u!=null&&u.capabilities.panes),rootID:v});if(a==="panes")return c.jsx(Fm,{available:!!(u!=null&&u.capabilities.panes),readOnly:!b||!!(u!=null&&u.attachOnly)});if(a==="timeline")return c.jsx(Sb,{available:!!(u!=null&&u.capabilities.timeline),sessionID:v});if(a==="diagnostics")return c.jsx(jb,{available:!!(u!=null&&u.capabilities.lsp)});if(a==="settings"||a==="theme"||a==="providers"||a==="auth")return c.jsxs("section",{className:"ops-settings-hint","aria-label":"Settings",children:[c.jsx("h2",{children:a==="theme"?"Theme":a==="providers"||a==="auth"?"Providers & auth":"Settings"}),c.jsx("p",{className:"muted",children:a==="theme"?"Theme catalog and appearance live in the settings dialog.":a==="providers"||a==="auth"?"Provider authentication and API keys live in the settings dialog.":"Workspace defaults, sandbox, and support tools live in the settings dialog."}),c.jsx("p",{className:"muted",children:"Use the header gear or open the dialog from this surface. Inspector tabs stay in the drawer."}),B&&c.jsx("button",{type:"button",onClick:B,children:"Open settings dialog"})]});if(a==="permissions")return c.jsxs("section",{"aria-label":"Permissions",children:[c.jsx("h2",{children:"Permissions"}),c.jsx("p",{className:"muted",children:"Explain and presets are available from permission asks and host APIs. Browse presets via the live permission dialog when the engine requests approval."}),!(u!=null&&u.capabilities.permissions)&&c.jsx(oc,{name:"Permissions"})]});if(a==="sandbox")return c.jsxs("section",{"aria-label":"Sandbox",children:[c.jsx("h2",{children:"Sandbox"}),z?c.jsxs("dl",{className:"sandbox-summary",children:[c.jsx("dt",{children:"Active"}),c.jsx("dd",{children:z.mode}),c.jsx("dt",{children:"Default"}),c.jsx("dd",{children:z.defaultMode||"—"}),c.jsx("dt",{children:"Backend"}),c.jsx("dd",{children:z.backend||(z.available?"available":"unavailable")})]}):c.jsx("p",{className:"muted",children:"No sandbox snapshot loaded."}),C&&c.jsx("button",{type:"button",onClick:()=>C(),children:"Explain sandbox"}),!(u!=null&&u.capabilities.sandbox)&&c.jsx(oc,{name:"Sandbox"})]});if(a==="diag-export")return c.jsxs("section",{"aria-label":"Diagnostics export",children:[c.jsx("h2",{children:"Diagnostics export"}),c.jsxs("p",{className:"muted",children:["Redacted prompt/config bundle (same scrubbing as TUI ",c.jsx("code",{children:"/diag"}),")."]}),c.jsx("button",{type:"button",disabled:!(u!=null&&u.capabilities.diag&&b),onClick:()=>void np(v).catch(J=>window.alert(J.message)),children:"Download diagnostics"}),!(u!=null&&u.capabilities.diag)&&c.jsx("p",{className:"muted",children:"Unavailable without a live engine."})]});if(a==="project-export")return c.jsxs("section",{"aria-label":"Project exports",children:[c.jsx("h2",{children:"Project exports"}),c.jsx("p",{className:"muted",children:"Portable memory and issues exports (TUI parity)."}),c.jsxs("div",{className:"panel-actions",children:[c.jsx("button",{type:"button",disabled:!(u!=null&&u.capabilities.memory),onClick:()=>void ap().catch(J=>window.alert(J.message)),children:"Export memory"}),c.jsx("button",{type:"button",disabled:!(u!=null&&u.capabilities.issues),onClick:()=>void ip().catch(J=>window.alert(J.message)),children:"Export issues"})]}),c.jsx("p",{className:"muted",children:$v})]});if(a.startsWith("pane:")){const J=a.slice(5);return c.jsx(Fm,{available:!!(u!=null&&u.capabilities.panes),focusId:J,readOnly:!b||!!(u!=null&&u.attachOnly)})}if(d)return c.jsx("section",{className:"unavailable",role:"status",children:c.jsxs("strong",{children:["Loading ",a]})});if(a==="files"){const J=(o==null?void 0:o.files)||[],se=o==null?void 0:o.error;return c.jsx(pb,{available:!!(u!=null&&u.capabilities.files),rootID:v,entity:ee,readOnly:!!(u!=null&&u.attachOnly)||!b,canApply:!!(u!=null&&u.capabilities.fileApply)&&b&&!(u!=null&&u.attachOnly),changedFiles:se?[]:J,expandedDiffs:h,toggleDiff:y,onOpenPath:(ue,ie)=>{Za({mode:"code",surface:"files",entity:ie?`${ue}:${ie}`:ue,root:v||void 0})}})}if(a==="memory")return c.jsx(Vb,{boot:u,data:o,onRefresh:g||(()=>{})});if(a==="issues")return c.jsx(Zb,{boot:u,data:o,onRefresh:g||(()=>{})});const pe=((P=ks(a))==null?void 0:P.label)||a||"surface";return c.jsxs("section",{className:"unavailable",role:"status",children:[c.jsx("strong",{children:pe}),c.jsx("p",{children:"This surface is registered but has no mount in this build yet."})]})}function Vb({boot:a,data:u,onRefresh:r}){const o=!!(a!=null&&a.capabilities.memory&&!a.attachOnly),[d,h]=T.useState(""),[y,b]=T.useState(""),[v,g]=T.useState(""),[z,C]=T.useState(!1),[O,$]=T.useState(null);if(!(a!=null&&a.capabilities.memory))return c.jsx(oc,{name:"Memory"});if(u!=null&&u.error)return c.jsx(Dp,{error:u.error});const Q=(u==null?void 0:u.entries)||[],le=async B=>{C(!0);try{await B(),r()}catch(_){window.alert(_.message)}finally{C(!1)}},ye=B=>{const _=B.Key||B.key||"";$(_),h(_),b(B.Value||B.value||""),g((B.Tags||B.tags||[]).join(", "))},ee=()=>{const B=d.trim();if(!B)return window.alert("Key is required");const _=v.split(",").map(pe=>pe.trim()).filter(Boolean);le(async()=>{await qg(B,y,_),h(""),b(""),g(""),$(null)})};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"panel-heading",children:[c.jsx("h2",{children:"Memory"}),c.jsx("div",{className:"panel-actions",children:c.jsx("button",{type:"button",disabled:z,"aria-label":"Export memory",onClick:()=>void le(()=>ap()),children:"Export"})})]}),o&&c.jsxs("form",{className:"project-form","aria-label":O?"Edit memory entry":"Add memory entry",onSubmit:B=>{B.preventDefault(),ee()},children:[c.jsxs("label",{children:["Key",c.jsx("input",{"aria-label":"Memory key",value:d,disabled:z||!!O,onChange:B=>h(B.target.value),placeholder:"convention"})]}),c.jsxs("label",{children:["Value",c.jsx("textarea",{"aria-label":"Memory value",value:y,disabled:z,onChange:B=>b(B.target.value),placeholder:"Prefer table-driven tests",rows:3})]}),c.jsxs("label",{children:["Tags",c.jsx("input",{"aria-label":"Memory tags",value:v,disabled:z,onChange:B=>g(B.target.value),placeholder:"project, style"})]}),c.jsxs("div",{className:"panel-actions",children:[O&&c.jsx("button",{type:"button",disabled:z,onClick:()=>{$(null),h(""),b(""),g("")},children:"Cancel"}),c.jsx("button",{type:"submit",disabled:z,children:O?"Save":"Add"})]})]}),!o&&c.jsx("p",{className:"muted",children:"Attach-only mode is read-only. Export remains available."}),Q.length?c.jsx("div",{className:"project-list",children:Q.map(B=>{const _=B.Key||B.key||"",pe=B.Value||B.value||"",W=B.Tags||B.tags||[];return c.jsxs("article",{children:[c.jsx("h3",{children:_}),c.jsx("p",{children:pe}),W.length>0&&c.jsx("small",{children:W.join(", ")}),o&&c.jsxs("div",{className:"panel-actions",children:[c.jsx("button",{type:"button",disabled:z,onClick:()=>ye(B),children:"Edit"}),c.jsx("button",{type:"button",disabled:z,onClick:()=>{window.confirm(`Delete memory key “${_}”?`)&&le(()=>Bg(_))},children:"Delete"})]})]},_)})}):c.jsx("p",{className:"muted",children:"No project memory entries."})]})}function Zb({boot:a,data:u,onRefresh:r}){const o=!!(a!=null&&a.capabilities.issues&&!a.attachOnly),[d,h]=T.useState(""),[y,b]=T.useState(""),[v,g]=T.useState(!1);if(!(a!=null&&a.capabilities.issues))return c.jsx(oc,{name:"Issues"});if(u!=null&&u.error)return c.jsx(Dp,{error:u.error});const z=(u==null?void 0:u.issues)||[],C=async O=>{g(!0);try{await O(),r()}catch($){window.alert($.message)}finally{g(!1)}};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"panel-heading",children:[c.jsx("h2",{children:"Issues"}),c.jsx("div",{className:"panel-actions",children:c.jsx("button",{type:"button",disabled:v,"aria-label":"Export issues",onClick:()=>void C(()=>ip()),children:"Export"})})]}),o&&c.jsxs("form",{className:"project-form","aria-label":"Add issue",onSubmit:O=>{O.preventDefault();const $=d.trim();if(!$)return window.alert("Title is required");C(async()=>{await Hg($,y),h(""),b("")})},children:[c.jsxs("label",{children:["Title",c.jsx("input",{"aria-label":"Issue title",value:d,disabled:v,onChange:O=>h(O.target.value),placeholder:"Fix inspector resize"})]}),c.jsxs("label",{children:["Body",c.jsx("textarea",{"aria-label":"Issue body",value:y,disabled:v,onChange:O=>b(O.target.value),placeholder:"Optional details",rows:3})]}),c.jsx("div",{className:"panel-actions",children:c.jsx("button",{type:"submit",disabled:v,children:"Add"})})]}),!o&&c.jsx("p",{className:"muted",children:"Attach-only mode is read-only. Export remains available."}),z.length?c.jsx("div",{className:"project-list",children:z.map(O=>{const $=O.ID??O.id??0,Q=O.Title||O.title||"Untitled issue",le=O.Body||O.body||"",ye=O.Status||O.status||"open";return c.jsxs("article",{children:[c.jsxs("h3",{children:["#",$," ",Q]}),c.jsx("small",{children:ye}),le&&c.jsx("p",{children:le}),o&&ye==="open"&&c.jsx("div",{className:"panel-actions",children:c.jsx("button",{type:"button",disabled:v,onClick:()=>void C(()=>Yg($)),children:"Close"})})]},$)})}):c.jsx("p",{className:"muted",children:"No project issues."})]})}function oc({name:a}){return c.jsxs("section",{className:"unavailable",role:"status",children:[c.jsxs("strong",{children:[a," unavailable"]}),c.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})]})}function Dp({error:a}){return c.jsxs("section",{className:"unavailable",role:"status",children:[c.jsx("strong",{children:"Unable to load"}),c.jsx("p",{children:a})]})}function Jb({question:a,rootID:u}){const[r,o]=T.useState([]),d=Array.isArray(a.questions)?a.questions:[{question:a.question}],h=(y,b)=>o(v=>{const g=[...v];return g[y]=b,g});return c.jsxs(Op,{title:String(a.title||"Agent question"),children:[d.map((y,b)=>{const v=Array.isArray(y.options)?y.options:[];return c.jsxs("fieldset",{children:[c.jsx("legend",{children:String(y.question||"A response is required to continue.")}),v.length?v.map(g=>c.jsxs("label",{children:[c.jsx("input",{type:"radio",name:`question-${b}`,value:String(g.label),checked:r[b]===String(g.label),onChange:z=>h(b,z.target.value)}),String(g.label),c.jsx("span",{children:String(g.description||"")})]},String(g.label))):c.jsx("textarea",{"aria-label":`Answer ${b+1}`,value:r[b]||"",onChange:g=>h(b,g.target.value)})]},b)}),c.jsx("div",{className:"dialog-actions",children:c.jsx("button",{autoFocus:!0,onClick:()=>void xt("question.reply",{requestId:a.requestId,answers:r},u),children:"Continue"})})]})}function Wb({preview:a,preferFiles:u,onCancel:r,onConfirm:o}){const d=T.useRef(null),[h,y]=T.useState(()=>pv(a,u));T.useEffect(()=>{const g=d.current;if(g)if(typeof g.showModal=="function"&&!g.open)try{g.showModal()}catch{g.setAttribute("open","")}else g.open||g.setAttribute("open","")},[]);const b=hv(a),v=[{id:"chat",label:"chat only",detail:"drop the last turn from history; keep disk changes",value:!1},{id:"files",label:"chat and files",detail:mv(a),value:!0}];return c.jsxs("dialog",{ref:d,className:"undo-dialog","aria-labelledby":"undo-title",onClose:r,onCancel:g=>{g.preventDefault(),r()},children:[c.jsx("div",{className:"dialog-rule"}),c.jsx("h2",{id:"undo-title",children:"Undo last turn"}),b.length>0&&c.jsx("div",{className:"undo-preview",role:"region","aria-label":"Undo preview",children:b.map((g,z)=>c.jsx("p",{className:g.tone==="warn"?"undo-warn":void 0,children:g.text},z))}),c.jsx("div",{className:"undo-choices",role:"radiogroup","aria-label":"Undo mode",children:v.map(g=>c.jsxs("label",{className:h===g.value?"undo-choice active":"undo-choice",children:[c.jsx("input",{type:"radio",name:"undo-mode",value:g.id,checked:h===g.value,onChange:()=>y(g.value)}),c.jsxs("span",{children:[c.jsx("strong",{children:g.label}),c.jsx("small",{children:g.detail})]})]},g.id))}),c.jsxs("div",{className:"dialog-actions",children:[c.jsx("button",{type:"button",onClick:r,children:"Cancel"}),c.jsx("button",{type:"button",autoFocus:!0,onClick:()=>o(h),children:"Confirm undo"})]})]})}Og.createRoot(document.getElementById("root")).render(c.jsx(xg.StrictMode,{children:c.jsx(kb,{})}));export{po as C,Pg as L,kg as O,Wg as S,Fg as a,oe as b,Cm as c,c as j,T as r,rp as s};
diff --git a/internal/frontend/server/static/assets/index-BK8GKzWA.js b/internal/frontend/server/static/assets/index-BK8GKzWA.js
deleted file mode 100644
index 13708898..00000000
--- a/internal/frontend/server/static/assets/index-BK8GKzWA.js
+++ /dev/null
@@ -1,95 +0,0 @@
-const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Plugins-CJ0dCX91.js","assets/panesApi-Gdyy8rqS.js","assets/PaneView-CmrtsIj-.js","assets/Panes-CWuiX4Ys.js"])))=>i.map(i=>d[i]);
-var pg=Object.defineProperty;var yg=(a,u,r)=>u in a?pg(a,u,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[u]=r;var ao=(a,u,r)=>yg(a,typeof u!="symbol"?u+"":u,r);(function(){const u=document.createElement("link").relList;if(u&&u.supports&&u.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))o(d);new MutationObserver(d=>{for(const h of d)if(h.type==="childList")for(const y of h.addedNodes)y.tagName==="LINK"&&y.rel==="modulepreload"&&o(y)}).observe(document,{childList:!0,subtree:!0});function r(d){const h={};return d.integrity&&(h.integrity=d.integrity),d.referrerPolicy&&(h.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?h.credentials="include":d.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function o(d){if(d.ep)return;d.ep=!0;const h=r(d);fetch(d.href,h)}})();function Im(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var io={exports:{}},As={};/**
- * @license React
- * react-jsx-runtime.production.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var rm;function gg(){if(rm)return As;rm=1;var a=Symbol.for("react.transitional.element"),u=Symbol.for("react.fragment");function r(o,d,h){var y=null;if(h!==void 0&&(y=""+h),d.key!==void 0&&(y=""+d.key),"key"in d){h={};for(var b in d)b!=="key"&&(h[b]=d[b])}else h=d;return d=h.ref,{$$typeof:a,type:o,key:y,ref:d!==void 0?d:null,props:h}}return As.Fragment=u,As.jsx=r,As.jsxs=r,As}var om;function vg(){return om||(om=1,io.exports=gg()),io.exports}var c=vg(),so={exports:{}},ve={};/**
- * @license React
- * react.production.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var fm;function bg(){if(fm)return ve;fm=1;var a=Symbol.for("react.transitional.element"),u=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),y=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),C=Symbol.for("react.activity"),O=Symbol.iterator;function $(S){return S===null||typeof S!="object"?null:(S=O&&S[O]||S["@@iterator"],typeof S=="function"?S:null)}var Q={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},le=Object.assign,ye={};function ee(S,R,X){this.props=S,this.context=R,this.refs=ye,this.updater=X||Q}ee.prototype.isReactComponent={},ee.prototype.setState=function(S,R){if(typeof S!="object"&&typeof S!="function"&&S!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,S,R,"setState")},ee.prototype.forceUpdate=function(S){this.updater.enqueueForceUpdate(this,S,"forceUpdate")};function B(){}B.prototype=ee.prototype;function k(S,R,X){this.props=S,this.context=R,this.refs=ye,this.updater=X||Q}var pe=k.prototype=new B;pe.constructor=k,le(pe,ee.prototype),pe.isPureReactComponent=!0;var W=Array.isArray;function me(){}var P={H:null,A:null,T:null,S:null},J=Object.prototype.hasOwnProperty;function se(S,R,X){var V=X.ref;return{$$typeof:a,type:S,key:R,ref:V!==void 0?V:null,props:X}}function ue(S,R){return se(S.type,R,S.props)}function ie(S){return typeof S=="object"&&S!==null&&S.$$typeof===a}function Se(S){var R={"=":"=0",":":"=2"};return"$"+S.replace(/[=:]/g,function(X){return R[X]})}var Ge=/\/+/g;function St(S,R){return typeof S=="object"&&S!==null&&S.key!=null?Se(""+S.key):R.toString(36)}function st(S){switch(S.status){case"fulfilled":return S.value;case"rejected":throw S.reason;default:switch(typeof S.status=="string"?S.then(me,me):(S.status="pending",S.then(function(R){S.status==="pending"&&(S.status="fulfilled",S.value=R)},function(R){S.status==="pending"&&(S.status="rejected",S.reason=R)})),S.status){case"fulfilled":return S.value;case"rejected":throw S.reason}}throw S}function U(S,R,X,V,de){var ge=typeof S;(ge==="undefined"||ge==="boolean")&&(S=null);var Ee=!1;if(S===null)Ee=!0;else switch(ge){case"bigint":case"string":case"number":Ee=!0;break;case"object":switch(S.$$typeof){case a:case u:Ee=!0;break;case z:return Ee=S._init,U(Ee(S._payload),R,X,V,de)}}if(Ee)return de=de(S),Ee=V===""?"."+St(S,0):V,W(de)?(X="",Ee!=null&&(X=Ee.replace(Ge,"$&/")+"/"),U(de,R,X,"",function(sl){return sl})):de!=null&&(ie(de)&&(de=ue(de,X+(de.key==null||S&&S.key===de.key?"":(""+de.key).replace(Ge,"$&/")+"/")+Ee)),R.push(de)),1;Ee=0;var ut=V===""?".":V+":";if(W(S))for(var ze=0;ze>>1,fe=U[te];if(0>>1;ted(X,I))Vd(de,X)?(U[te]=de,U[V]=I,te=V):(U[te]=X,U[R]=I,te=R);else if(Vd(de,I))U[te]=de,U[V]=I,te=V;else break e}}return K}function d(U,K){var I=U.sortIndex-K.sortIndex;return I!==0?I:U.id-K.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;a.unstable_now=function(){return h.now()}}else{var y=Date,b=y.now();a.unstable_now=function(){return y.now()-b}}var v=[],g=[],z=1,C=null,O=3,$=!1,Q=!1,le=!1,ye=!1,ee=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function pe(U){for(var K=r(g);K!==null;){if(K.callback===null)o(g);else if(K.startTime<=U)o(g),K.sortIndex=K.expirationTime,u(v,K);else break;K=r(g)}}function W(U){if(le=!1,pe(U),!Q)if(r(v)!==null)Q=!0,me||(me=!0,Se());else{var K=r(g);K!==null&&st(W,K.startTime-U)}}var me=!1,P=-1,J=5,se=-1;function ue(){return ye?!0:!(a.unstable_now()-seU&&ue());){var te=C.callback;if(typeof te=="function"){C.callback=null,O=C.priorityLevel;var fe=te(C.expirationTime<=U);if(U=a.unstable_now(),typeof fe=="function"){C.callback=fe,pe(U),K=!0;break t}C===r(v)&&o(v),pe(U)}else o(v);C=r(v)}if(C!==null)K=!0;else{var S=r(g);S!==null&&st(W,S.startTime-U),K=!1}}break e}finally{C=null,O=I,$=!1}K=void 0}}finally{K?Se():me=!1}}}var Se;if(typeof k=="function")Se=function(){k(ie)};else if(typeof MessageChannel<"u"){var Ge=new MessageChannel,St=Ge.port2;Ge.port1.onmessage=ie,Se=function(){St.postMessage(null)}}else Se=function(){ee(ie,0)};function st(U,K){P=ee(function(){U(a.unstable_now())},K)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(U){U.callback=null},a.unstable_forceFrameRate=function(U){0>U||125te?(U.sortIndex=I,u(g,U),r(v)===null&&U===r(g)&&(le?(B(P),P=-1):le=!0,st(W,I-te))):(U.sortIndex=fe,u(v,U),Q||$||(Q=!0,me||(me=!0,Se()))),U},a.unstable_shouldYield=ue,a.unstable_wrapCallback=function(U){var K=O;return function(){var I=O;O=K;try{return U.apply(this,arguments)}finally{O=I}}}})(ro)),ro}var mm;function jg(){return mm||(mm=1,co.exports=Sg()),co.exports}var oo={exports:{}},Ut={};/**
- * @license React
- * react-dom.production.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var pm;function Tg(){if(pm)return Ut;pm=1;var a=wo();function u(v){var g="https://react.dev/errors/"+v;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(u){console.error(u)}}return a(),oo.exports=Tg(),oo.exports}/**
- * @license React
- * react-dom-client.production.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var gm;function Ag(){if(gm)return Cs;gm=1;var a=jg(),u=wo(),r=Eg();function o(e){var t="https://react.dev/errors/"+e;if(1fe||(e.current=te[fe],te[fe]=null,fe--)}function X(e,t){fe++,te[fe]=e.current,e.current=t}var V=S(null),de=S(null),ge=S(null),Ee=S(null);function ut(e,t){switch(X(ge,t),X(de,e),X(V,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?wh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=wh(t),e=_h(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}R(V),X(V,e)}function ze(){R(V),R(de),R(ge)}function sl(e){e.memoizedState!==null&&X(Ee,e);var t=V.current,n=_h(t,e.type);t!==n&&(X(de,e),X(V,n))}function tn(e){de.current===e&&(R(V),R(de)),Ee.current===e&&(R(Ee),Ss._currentValue=I)}var Rt,Hn;function Mn(e){if(Rt===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Rt=t&&t[1]||"",Hn=-1)":-1i||x[l]!==M[i]){var q=`
-`+x[l].replace(" at new "," at ");return e.displayName&&q.includes("")&&(q=q.replace("",e.displayName)),q}while(1<=l&&0<=i);break}}}finally{Yn=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Mn(n):""}function Li(e,t){switch(e.tag){case 26:case 27:case 5:return Mn(e.type);case 16:return Mn("Lazy");case 13:return e.child!==t&&t!==null?Mn("Suspense Fallback"):Mn("Suspense");case 19:return Mn("SuspenseList");case 0:case 15:return pn(e.type,!1);case 11:return pn(e.type.render,!1);case 1:return pn(e.type,!0);case 31:return Mn("Activity");default:return""}}function Gn(e){try{var t="",n=null;do t+=Li(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
-Error generating stack: `+l.message+`
-`+l.stack}}var kl=Object.prototype.hasOwnProperty,Lt=a.unstable_scheduleCallback,ul=a.unstable_cancelCallback,qt=a.unstable_shouldYield,wn=a.unstable_requestPaint,gt=a.unstable_now,Ul=a.unstable_getCurrentPriorityLevel,$n=a.unstable_ImmediatePriority,Bt=a.unstable_UserBlockingPriority,_n=a.unstable_NormalPriority,vt=a.unstable_LowPriority,nn=a.unstable_IdlePriority,cl=a.log,Xn=a.unstable_setDisableYieldValue,yn=null,Je=null;function Ht(e){if(typeof cl=="function"&&Xn(e),Je&&typeof Je.setStrictMode=="function")try{Je.setStrictMode(yn,e)}catch{}}var We=Math.clz32?Math.clz32:Za,gn=Math.log,kn=Math.LN2;function Za(e){return e>>>=0,e===0?32:31-(gn(e)/kn|0)|0}var $t=256,Kn=262144,vn=4194304;function bn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Qn(e,t,n){var l=e.pendingLanes;if(l===0)return 0;var i=0,s=e.suspendedLanes,f=e.pingedLanes;e=e.warmLanes;var m=l&134217727;return m!==0?(l=m&~s,l!==0?i=bn(l):(f&=m,f!==0?i=bn(f):n||(n=m&~e,n!==0&&(i=bn(n))))):(m=l&~s,m!==0?i=bn(m):f!==0?i=bn(f):n||(n=l&~e,n!==0&&(i=bn(n)))),i===0?0:t!==0&&t!==i&&(t&s)===0&&(s=i&-i,n=t&-t,s>=n||s===32&&(n&4194048)!==0)?t:i}function xn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ja(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Sa(){var e=vn;return vn<<=1,(vn&62914560)===0&&(vn=4194304),e}function Vn(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ln(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Zn(e,t,n,l,i,s){var f=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var m=e.entanglements,x=e.expirationTimes,M=e.hiddenUpdates;for(n=f&~n;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Vt=/[\n"\\]/g;function wt(e){return e.replace(Vt,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Hl(e,t,n,l,i,s,f,m){e.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.type=f:e.removeAttribute("type"),t!=null?f==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Pe(t)):e.value!==""+Pe(t)&&(e.value=""+Pe(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?Ea(e,f,Pe(t)):n!=null?Ea(e,f,Pe(n)):l!=null&&e.removeAttribute("value"),i==null&&s!=null&&(e.defaultChecked=!!s),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"?e.name=""+Pe(m):e.removeAttribute("name")}function Rs(e,t,n,l,i,s,f,m){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.type=s),t!=null||n!=null){if(!(s!=="submit"&&s!=="reset"||t!=null)){G(e);return}n=n!=null?""+Pe(n):"",t=t!=null?""+Pe(t):n,m||t===e.value||(e.value=t),e.defaultValue=t}l=l??i,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=m?e.checked:!!l,e.defaultChecked=!!l,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),G(e)}function Ea(e,t,n){t==="number"&&pt(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Yl(e,t,n,l){if(e=e.options,t){t={};for(var i=0;i"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Bi=!1;if(sn)try{var ml={};Object.defineProperty(ml,"passive",{get:function(){Bi=!0}}),window.addEventListener("test",ml,ml),window.removeEventListener("test",ml,ml)}catch{Bi=!1}var Pn=null,el=null,Vl=null;function Zl(){if(Vl)return Vl;var e,t=el,n=t.length,l,i="value"in Pn?Pn.value:Pn.textContent,s=i.length;for(e=0;e=Gi),qo=" ",Bo=!1;function Ho(e,t){switch(e){case"keyup":return Lp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yo(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ai=!1;function Bp(e,t){switch(e){case"compositionend":return Yo(t);case"keypress":return t.which!==32?null:(Bo=!0,qo);case"textInput":return e=t.data,e===qo&&Bo?null:e;default:return null}}function Hp(e,t){if(ai)return e==="compositionend"||!oc&&Ho(e,t)?(e=Zl(),Vl=el=Pn=null,ai=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=l}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Jo(n)}}function Fo(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Fo(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Io(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=pt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=pt(e.document)}return t}function hc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Zp=sn&&"documentMode"in document&&11>=document.documentMode,ii=null,mc=null,Qi=null,pc=!1;function Po(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;pc||ii==null||ii!==pt(l)||(l=ii,"selectionStart"in l&&hc(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Qi&&Ki(Qi,l)||(Qi=l,l=Uu(mc,"onSelect"),0>=f,i-=f,nl=1<<32-We(t)+i|n<xe?(Ce=ae,ae=null):Ce=ae.sibling;var we=w(N,ae,D[xe],H);if(we===null){ae===null&&(ae=Ce);break}e&&ae&&we.alternate===null&&t(N,ae),A=s(we,A,xe),Me===null?ce=we:Me.sibling=we,Me=we,ae=Ce}if(xe===D.length)return n(N,ae),Oe&&bl(N,xe),ce;if(ae===null){for(;xexe?(Ce=ae,ae=null):Ce=ae.sibling;var va=w(N,ae,we.value,H);if(va===null){ae===null&&(ae=Ce);break}e&&ae&&va.alternate===null&&t(N,ae),A=s(va,A,xe),Me===null?ce=va:Me.sibling=va,Me=va,ae=Ce}if(we.done)return n(N,ae),Oe&&bl(N,xe),ce;if(ae===null){for(;!we.done;xe++,we=D.next())we=Y(N,we.value,H),we!==null&&(A=s(we,A,xe),Me===null?ce=we:Me.sibling=we,Me=we);return Oe&&bl(N,xe),ce}for(ae=l(ae);!we.done;xe++,we=D.next())we=_(ae,N,xe,we.value,H),we!==null&&(e&&we.alternate!==null&&ae.delete(we.key===null?xe:we.key),A=s(we,A,xe),Me===null?ce=we:Me.sibling=we,Me=we);return e&&ae.forEach(function(mg){return t(N,mg)}),Oe&&bl(N,xe),ce}function He(N,A,D,H){if(typeof D=="object"&&D!==null&&D.type===le&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case $:e:{for(var ce=D.key;A!==null;){if(A.key===ce){if(ce=D.type,ce===le){if(A.tag===7){n(N,A.sibling),H=i(A,D.props.children),H.return=N,N=H;break e}}else if(A.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===J&&La(ce)===A.type){n(N,A.sibling),H=i(A,D.props),Ii(H,D),H.return=N,N=H;break e}n(N,A);break}else t(N,A);A=A.sibling}D.type===le?(H=wa(D.props.children,N.mode,H,D.key),H.return=N,N=H):(H=Is(D.type,D.key,D.props,null,N.mode,H),Ii(H,D),H.return=N,N=H)}return f(N);case Q:e:{for(ce=D.key;A!==null;){if(A.key===ce)if(A.tag===4&&A.stateNode.containerInfo===D.containerInfo&&A.stateNode.implementation===D.implementation){n(N,A.sibling),H=i(A,D.children||[]),H.return=N,N=H;break e}else{n(N,A);break}else t(N,A);A=A.sibling}H=jc(D,N.mode,H),H.return=N,N=H}return f(N);case J:return D=La(D),He(N,A,D,H)}if(st(D))return ne(N,A,D,H);if(Se(D)){if(ce=Se(D),typeof ce!="function")throw Error(o(150));return D=ce.call(D),he(N,A,D,H)}if(typeof D.then=="function")return He(N,A,iu(D),H);if(D.$$typeof===k)return He(N,A,tu(N,D),H);su(N,D)}return typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint"?(D=""+D,A!==null&&A.tag===6?(n(N,A.sibling),H=i(A,D),H.return=N,N=H):(n(N,A),H=Sc(D,N.mode,H),H.return=N,N=H),f(N)):n(N,A)}return function(N,A,D,H){try{Fi=0;var ce=He(N,A,D,H);return yi=null,ce}catch(ae){if(ae===pi||ae===lu)throw ae;var Me=cn(29,ae,null,N.mode);return Me.lanes=H,Me.return=N,Me}finally{}}}var Ba=Tf(!0),Ef=Tf(!1),ta=!1;function kc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Uc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function na(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function la(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(ke&2)!==0){var i=l.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),l.pending=t,t=Fs(e),uf(e,null,n),t}return Ws(e,l,t,n),Fs(e)}function Pi(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,ol(e,n)}}function Rc(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var f={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};s===null?i=s=f:s=s.next=f,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:l.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:l.shared,callbacks:l.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Lc=!1;function es(){if(Lc){var e=mi;if(e!==null)throw e}}function ts(e,t,n,l){Lc=!1;var i=e.updateQueue;ta=!1;var s=i.firstBaseUpdate,f=i.lastBaseUpdate,m=i.shared.pending;if(m!==null){i.shared.pending=null;var x=m,M=x.next;x.next=null,f===null?s=M:f.next=M,f=x;var q=e.alternate;q!==null&&(q=q.updateQueue,m=q.lastBaseUpdate,m!==f&&(m===null?q.firstBaseUpdate=M:m.next=M,q.lastBaseUpdate=x))}if(s!==null){var Y=i.baseState;f=0,q=M=x=null,m=s;do{var w=m.lane&-536870913,_=w!==m.lane;if(_?(Ae&w)===w:(l&w)===w){w!==0&&w===hi&&(Lc=!0),q!==null&&(q=q.next={lane:0,tag:m.tag,payload:m.payload,callback:null,next:null});e:{var ne=e,he=m;w=t;var He=n;switch(he.tag){case 1:if(ne=he.payload,typeof ne=="function"){Y=ne.call(He,Y,w);break e}Y=ne;break e;case 3:ne.flags=ne.flags&-65537|128;case 0:if(ne=he.payload,w=typeof ne=="function"?ne.call(He,Y,w):ne,w==null)break e;Y=C({},Y,w);break e;case 2:ta=!0}}w=m.callback,w!==null&&(e.flags|=64,_&&(e.flags|=8192),_=i.callbacks,_===null?i.callbacks=[w]:_.push(w))}else _={lane:w,tag:m.tag,payload:m.payload,callback:m.callback,next:null},q===null?(M=q=_,x=Y):q=q.next=_,f|=w;if(m=m.next,m===null){if(m=i.shared.pending,m===null)break;_=m,m=_.next,_.next=null,i.lastBaseUpdate=_,i.shared.pending=null}}while(!0);q===null&&(x=Y),i.baseState=x,i.firstBaseUpdate=M,i.lastBaseUpdate=q,s===null&&(i.shared.lanes=0),ca|=f,e.lanes=f,e.memoizedState=Y}}function Af(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Cf(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;es?s:8;var f=U.T,m={};U.T=m,nr(e,!1,t,n);try{var x=i(),M=U.S;if(M!==null&&M(m,x),x!==null&&typeof x=="object"&&typeof x.then=="function"){var q=ly(x,l);as(e,t,q,hn(e))}else as(e,t,l,hn(e))}catch(Y){as(e,t,{then:function(){},status:"rejected",reason:Y},hn())}finally{K.p=s,f!==null&&m.types!==null&&(f.types=m.types),U.T=f}}function ry(){}function er(e,t,n,l){if(e.tag!==5)throw Error(o(476));var i=ad(e).queue;ld(e,i,t,I,n===null?ry:function(){return id(e),n(l)})}function ad(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Tl,lastRenderedState:I},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Tl,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function id(e){var t=ad(e);t.next===null&&(t=e.alternate.memoizedState),as(e,t.next.queue,{},hn())}function tr(){return Ct(Ss)}function sd(){return rt().memoizedState}function ud(){return rt().memoizedState}function oy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=hn();e=na(n);var l=la(t,e,n);l!==null&&(Pt(l,t,n),Pi(l,t,n)),t={cache:Dc()},e.payload=t;return}t=t.return}}function fy(e,t,n){var l=hn();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},yu(e)?rd(t,n):(n=bc(e,t,n,l),n!==null&&(Pt(n,e,l),od(n,t,l)))}function cd(e,t,n){var l=hn();as(e,t,n,l)}function as(e,t,n,l){var i={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(yu(e))rd(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var f=t.lastRenderedState,m=s(f,n);if(i.hasEagerState=!0,i.eagerState=m,un(m,f))return Ws(e,t,i,0),Ye===null&&Js(),!1}catch{}finally{}if(n=bc(e,t,i,l),n!==null)return Pt(n,e,l),od(n,t,l),!0}return!1}function nr(e,t,n,l){if(l={lane:2,revertLane:kr(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},yu(e)){if(t)throw Error(o(479))}else t=bc(e,n,l,2),t!==null&&Pt(t,e,2)}function yu(e){var t=e.alternate;return e===be||t!==null&&t===be}function rd(e,t){vi=ru=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function od(e,t,n){if((n&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,ol(e,n)}}var is={readContext:Ct,use:du,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt};is.useEffectEvent=lt;var fd={readContext:Ct,use:du,useCallback:function(e,t){return Gt().memoizedState=[e,t===void 0?null:t],e},useContext:Ct,useEffect:Zf,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,mu(4194308,4,If.bind(null,t,e),n)},useLayoutEffect:function(e,t){return mu(4194308,4,e,t)},useInsertionEffect:function(e,t){mu(4,2,e,t)},useMemo:function(e,t){var n=Gt();t=t===void 0?null:t;var l=e();if(Ha){Ht(!0);try{e()}finally{Ht(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=Gt();if(n!==void 0){var i=n(t);if(Ha){Ht(!0);try{n(t)}finally{Ht(!1)}}}else i=t;return l.memoizedState=l.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},l.queue=e,e=e.dispatch=fy.bind(null,be,e),[l.memoizedState,e]},useRef:function(e){var t=Gt();return e={current:e},t.memoizedState=e},useState:function(e){e=Jc(e);var t=e.queue,n=cd.bind(null,be,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ic,useDeferredValue:function(e,t){var n=Gt();return Pc(n,e,t)},useTransition:function(){var e=Jc(!1);return e=ld.bind(null,be,e.queue,!0,!1),Gt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=be,i=Gt();if(Oe){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),Ye===null)throw Error(o(349));(Ae&127)!==0||wf(l,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,Zf(kf.bind(null,l,s,e),[e]),l.flags|=2048,xi(9,{destroy:void 0},_f.bind(null,l,s,n,t),null),n},useId:function(){var e=Gt(),t=Ye.identifierPrefix;if(Oe){var n=ll,l=nl;n=(l&~(1<<32-We(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=ou++,0<\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof l.is=="string"?f.createElement("select",{is:l.is}):f.createElement("select"),l.multiple?s.multiple=!0:l.size&&(s.size=l.size);break;default:s=typeof l.is=="string"?f.createElement(i,{is:l.is}):f.createElement(i)}}s[Fe]=t,s[tt]=l;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)s.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=s;e:switch(Ot(s,i,l),i){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Al(t)}}return Ke(t),yr(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Al(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(o(166));if(e=ge.current,fi(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,i=At,i!==null)switch(i.tag){case 27:case 5:l=i.memoizedProps}e[Fe]=t,e=!!(e.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||Dh(e.nodeValue,n)),e||Pl(t,!0)}else e=Ru(e).createTextNode(l),e[Fe]=t,t.stateNode=e}return Ke(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(l=fi(t),n!==null){if(e===null){if(!l)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Fe]=t}else _a(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ke(t),e=!1}else n=Cc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(on(t),t):(on(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Ke(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=fi(t),l!==null&&l.dehydrated!==null){if(e===null){if(!i)throw Error(o(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(o(317));i[Fe]=t}else _a(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ke(t),i=!1}else i=Cc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(on(t),t):(on(t),null)}return on(t),(t.flags&128)!==0?(t.lanes=n,t):(n=l!==null,e=e!==null&&e.memoizedState!==null,n&&(l=t.child,i=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(i=l.alternate.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==i&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Su(t,t.updateQueue),Ke(t),null);case 4:return ze(),e===null&&qr(t.stateNode.containerInfo),Ke(t),null;case 10:return Sl(t.type),Ke(t),null;case 19:if(R(ct),l=t.memoizedState,l===null)return Ke(t),null;if(i=(t.flags&128)!==0,s=l.rendering,s===null)if(i)us(l,!1);else{if(at!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(s=cu(e),s!==null){for(t.flags|=128,us(l,!1),e=s.updateQueue,t.updateQueue=e,Su(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)cf(n,e),n=n.sibling;return X(ct,ct.current&1|2),Oe&&bl(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&>()>Cu&&(t.flags|=128,i=!0,us(l,!1),t.lanes=4194304)}else{if(!i)if(e=cu(s),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Su(t,e),us(l,!0),l.tail===null&&l.tailMode==="hidden"&&!s.alternate&&!Oe)return Ke(t),null}else 2*gt()-l.renderingStartTime>Cu&&n!==536870912&&(t.flags|=128,i=!0,us(l,!1),t.lanes=4194304);l.isBackwards?(s.sibling=t.child,t.child=s):(e=l.last,e!==null?e.sibling=s:t.child=s,l.last=s)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=gt(),e.sibling=null,n=ct.current,X(ct,i?n&1|2:n&1),Oe&&bl(t,l.treeForkCount),e):(Ke(t),null);case 22:case 23:return on(t),Bc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(n&536870912)!==0&&(t.flags&128)===0&&(Ke(t),t.subtreeFlags&6&&(t.flags|=8192)):Ke(t),n=t.updateQueue,n!==null&&Su(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==n&&(t.flags|=2048),e!==null&&R(Ra),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Sl(ot),Ke(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function yy(e,t){switch(Ec(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Sl(ot),ze(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return tn(t),null;case 31:if(t.memoizedState!==null){if(on(t),t.alternate===null)throw Error(o(340));_a()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(on(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));_a()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return R(ct),null;case 4:return ze(),null;case 10:return Sl(t.type),null;case 22:case 23:return on(t),Bc(),e!==null&&R(Ra),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Sl(ot),null;case 25:return null;default:return null}}function Ud(e,t){switch(Ec(t),t.tag){case 3:Sl(ot),ze();break;case 26:case 27:case 5:tn(t);break;case 4:ze();break;case 31:t.memoizedState!==null&&on(t);break;case 13:on(t);break;case 19:R(ct);break;case 10:Sl(t.type);break;case 22:case 23:on(t),Bc(),e!==null&&R(Ra);break;case 24:Sl(ot)}}function cs(e,t){try{var n=t.updateQueue,l=n!==null?n.lastEffect:null;if(l!==null){var i=l.next;n=i;do{if((n.tag&e)===e){l=void 0;var s=n.create,f=n.inst;l=s(),f.destroy=l}n=n.next}while(n!==i)}}catch(m){Le(t,t.return,m)}}function sa(e,t,n){try{var l=t.updateQueue,i=l!==null?l.lastEffect:null;if(i!==null){var s=i.next;l=s;do{if((l.tag&e)===e){var f=l.inst,m=f.destroy;if(m!==void 0){f.destroy=void 0,i=t;var x=n,M=m;try{M()}catch(q){Le(i,x,q)}}}l=l.next}while(l!==s)}}catch(q){Le(t,t.return,q)}}function Rd(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Cf(t,n)}catch(l){Le(e,e.return,l)}}}function Ld(e,t,n){n.props=Ya(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){Le(e,t,l)}}function rs(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof n=="function"?e.refCleanup=n(l):n.current=l}}catch(i){Le(e,t,i)}}function al(e,t){var n=e.ref,l=e.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(i){Le(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(i){Le(e,t,i)}else n.current=null}function qd(e){var t=e.type,n=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&l.focus();break e;case"img":n.src?l.src=n.src:n.srcSet&&(l.srcset=n.srcSet)}}catch(i){Le(e,e.return,i)}}function gr(e,t,n){try{var l=e.stateNode;qy(l,e.type,n,t),l[tt]=t}catch(i){Le(e,e.return,i)}}function Bd(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ha(e.type)||e.tag===4}function vr(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Bd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ha(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function br(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ve));else if(l!==4&&(l===27&&ha(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(br(e,t,n),e=e.sibling;e!==null;)br(e,t,n),e=e.sibling}function ju(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(l!==4&&(l===27&&ha(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(ju(e,t,n),e=e.sibling;e!==null;)ju(e,t,n),e=e.sibling}function Hd(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Ot(t,l,n),t[Fe]=e,t[tt]=n}catch(s){Le(e,e.return,s)}}var Cl=!1,ht=!1,xr=!1,Yd=typeof WeakSet=="function"?WeakSet:Set,bt=null;function gy(e,t){if(e=e.containerInfo,Yr=$u,e=Io(e),hc(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var l=n.getSelection&&n.getSelection();if(l&&l.rangeCount!==0){n=l.anchorNode;var i=l.anchorOffset,s=l.focusNode;l=l.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var f=0,m=-1,x=-1,M=0,q=0,Y=e,w=null;t:for(;;){for(var _;Y!==n||i!==0&&Y.nodeType!==3||(m=f+i),Y!==s||l!==0&&Y.nodeType!==3||(x=f+l),Y.nodeType===3&&(f+=Y.nodeValue.length),(_=Y.firstChild)!==null;)w=Y,Y=_;for(;;){if(Y===e)break t;if(w===n&&++M===i&&(m=f),w===s&&++q===l&&(x=f),(_=Y.nextSibling)!==null)break;Y=w,w=Y.parentNode}Y=_}n=m===-1||x===-1?null:{start:m,end:x}}else n=null}n=n||{start:0,end:0}}else n=null;for(Gr={focusedElem:e,selectionRange:n},$u=!1,bt=t;bt!==null;)if(t=bt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,bt=e;else for(;bt!==null;){switch(t=bt,s=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n title"))),Ot(s,l,n),s[Fe]=e,Ie(s),l=s;break e;case"link":var f=Vh("link","href",i).get(l+(n.href||""));if(f){for(var m=0;mHe&&(f=He,He=he,he=f);var N=Wo(m,he),A=Wo(m,He);if(N&&A&&(_.rangeCount!==1||_.anchorNode!==N.node||_.anchorOffset!==N.offset||_.focusNode!==A.node||_.focusOffset!==A.offset)){var D=Y.createRange();D.setStart(N.node,N.offset),_.removeAllRanges(),he>He?(_.addRange(D),_.extend(A.node,A.offset)):(D.setEnd(A.node,A.offset),_.addRange(D))}}}}for(Y=[],_=m;_=_.parentNode;)_.nodeType===1&&Y.push({element:_,left:_.scrollLeft,top:_.scrollTop});for(typeof m.focus=="function"&&m.focus(),m=0;mn?32:n,U.T=null,n=Nr,Nr=null;var s=oa,f=Ml;if(yt=0,Ai=oa=null,Ml=0,(ke&6)!==0)throw Error(o(331));var m=ke;if(ke|=4,Id(s.current),Jd(s,s.current,f,n),ke=m,ps(0,!1),Je&&typeof Je.onPostCommitFiberRoot=="function")try{Je.onPostCommitFiberRoot(yn,s)}catch{}return!0}finally{K.p=i,U.T=l,yh(e,t)}}function vh(e,t,n){t=En(n,t),t=sr(e.stateNode,t,2),e=la(e,t,2),e!==null&&(ln(e,2),il(e))}function Le(e,t,n){if(e.tag===3)vh(e,e,n);else for(;t!==null;){if(t.tag===3){vh(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(ra===null||!ra.has(l))){e=En(n,e),n=bd(2),l=la(t,n,2),l!==null&&(xd(n,l,t,e),ln(l,2),il(l));break}}t=t.return}}function Mr(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new xy;var i=new Set;l.set(t,i)}else i=l.get(t),i===void 0&&(i=new Set,l.set(t,i));i.has(n)||(Tr=!0,i.add(n),e=Ay.bind(null,e,t,n),t.then(e,e))}function Ay(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ye===e&&(Ae&n)===n&&(at===4||at===3&&(Ae&62914560)===Ae&&300>gt()-Au?(ke&2)===0&&Ci(e,0):Er|=n,Ei===Ae&&(Ei=0)),il(e)}function bh(e,t){t===0&&(t=Sa()),e=Ma(e,t),e!==null&&(ln(e,t),il(e))}function Cy(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),bh(e,n)}function Ny(e,t){var n=0;switch(e.tag){case 31:case 13:var l=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(o(314))}l!==null&&l.delete(t),bh(e,n)}function Oy(e,t){return Lt(e,t)}var wu=null,Oi=null,wr=!1,_u=!1,_r=!1,da=0;function il(e){e!==Oi&&e.next===null&&(Oi===null?wu=Oi=e:Oi=Oi.next=e),_u=!0,wr||(wr=!0,Dy())}function ps(e,t){if(!_r&&_u){_r=!0;do for(var n=!1,l=wu;l!==null;){if(e!==0){var i=l.pendingLanes;if(i===0)var s=0;else{var f=l.suspendedLanes,m=l.pingedLanes;s=(1<<31-We(42|e)+1)-1,s&=i&~(f&~m),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,Th(l,s))}else s=Ae,s=Qn(l,l===Ye?s:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(s&3)===0||xn(l,s)||(n=!0,Th(l,s));l=l.next}while(n);_r=!1}}function zy(){xh()}function xh(){_u=wr=!1;var e=0;da!==0&&Hy()&&(e=da);for(var t=gt(),n=null,l=wu;l!==null;){var i=l.next,s=Sh(l,t);s===0?(l.next=null,n===null?wu=i:n.next=i,i===null&&(Oi=n)):(n=l,(e!==0||(s&3)!==0)&&(_u=!0)),l=i}yt!==0&&yt!==5||ps(e),da!==0&&(da=0)}function Sh(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes&-62914561;0m)break;var q=x.transferSize,Y=x.initiatorType;q&&Mh(Y)&&(x=x.responseEnd,f+=q*(x"u"?null:document;function $h(e,t,n){var l=zi;if(l&&typeof t=="string"&&t){var i=wt(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),Gh.has(i)||(Gh.add(i),e={rel:e,crossOrigin:n,href:t},l.querySelector(i)===null&&(t=l.createElement("link"),Ot(t,"link",e),Ie(t),l.head.appendChild(t)))}}function Jy(e){wl.D(e),$h("dns-prefetch",e,null)}function Wy(e,t){wl.C(e,t),$h("preconnect",e,t)}function Fy(e,t,n){wl.L(e,t,n);var l=zi;if(l&&e&&t){var i='link[rel="preload"][as="'+wt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+wt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+wt(n.imageSizes)+'"]')):i+='[href="'+wt(e)+'"]';var s=i;switch(t){case"style":s=Di(e);break;case"script":s=Mi(e)}Dn.has(s)||(e=C({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Dn.set(s,e),l.querySelector(i)!==null||t==="style"&&l.querySelector(bs(s))||t==="script"&&l.querySelector(xs(s))||(t=l.createElement("link"),Ot(t,"link",e),Ie(t),l.head.appendChild(t)))}}function Iy(e,t){wl.m(e,t);var n=zi;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+wt(l)+'"][href="'+wt(e)+'"]',s=i;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=Mi(e)}if(!Dn.has(s)&&(e=C({rel:"modulepreload",href:e},t),Dn.set(s,e),n.querySelector(i)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(xs(s)))return}l=n.createElement("link"),Ot(l,"link",e),Ie(l),n.head.appendChild(l)}}}function Py(e,t,n){wl.S(e,t,n);var l=zi;if(l&&e){var i=Tt(l).hoistableStyles,s=Di(e);t=t||"default";var f=i.get(s);if(!f){var m={loading:0,preload:null};if(f=l.querySelector(bs(s)))m.loading=5;else{e=C({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Dn.get(s))&&Jr(e,n);var x=f=l.createElement("link");Ie(x),Ot(x,"link",e),x._p=new Promise(function(M,q){x.onload=M,x.onerror=q}),x.addEventListener("load",function(){m.loading|=1}),x.addEventListener("error",function(){m.loading|=2}),m.loading|=4,qu(f,t,l)}f={type:"stylesheet",instance:f,count:1,state:m},i.set(s,f)}}}function eg(e,t){wl.X(e,t);var n=zi;if(n&&e){var l=Tt(n).hoistableScripts,i=Mi(e),s=l.get(i);s||(s=n.querySelector(xs(i)),s||(e=C({src:e,async:!0},t),(t=Dn.get(i))&&Wr(e,t),s=n.createElement("script"),Ie(s),Ot(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(i,s))}}function tg(e,t){wl.M(e,t);var n=zi;if(n&&e){var l=Tt(n).hoistableScripts,i=Mi(e),s=l.get(i);s||(s=n.querySelector(xs(i)),s||(e=C({src:e,async:!0,type:"module"},t),(t=Dn.get(i))&&Wr(e,t),s=n.createElement("script"),Ie(s),Ot(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(i,s))}}function Xh(e,t,n,l){var i=(i=ge.current)?Lu(i):null;if(!i)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Di(n.href),n=Tt(i).hoistableStyles,l=n.get(t),l||(l={type:"style",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Di(n.href);var s=Tt(i).hoistableStyles,f=s.get(e);if(f||(i=i.ownerDocument||i,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,f),(s=i.querySelector(bs(e)))&&!s._p&&(f.instance=s,f.state.loading=5),Dn.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Dn.set(e,n),s||ng(i,e,n,f.state))),t&&l===null)throw Error(o(528,""));return f}if(t&&l!==null)throw Error(o(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Mi(n),n=Tt(i).hoistableScripts,l=n.get(t),l||(l={type:"script",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Di(e){return'href="'+wt(e)+'"'}function bs(e){return'link[rel="stylesheet"]['+e+"]"}function Kh(e){return C({},e,{"data-precedence":e.precedence,precedence:null})}function ng(e,t,n,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),Ot(t,"link",n),Ie(t),e.head.appendChild(t))}function Mi(e){return'[src="'+wt(e)+'"]'}function xs(e){return"script[async]"+e}function Qh(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+wt(n.href)+'"]');if(l)return t.instance=l,Ie(l),l;var i=C({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Ie(l),Ot(l,"style",i),qu(l,n.precedence,e),t.instance=l;case"stylesheet":i=Di(n.href);var s=e.querySelector(bs(i));if(s)return t.state.loading|=4,t.instance=s,Ie(s),s;l=Kh(n),(i=Dn.get(i))&&Jr(l,i),s=(e.ownerDocument||e).createElement("link"),Ie(s);var f=s;return f._p=new Promise(function(m,x){f.onload=m,f.onerror=x}),Ot(s,"link",l),t.state.loading|=4,qu(s,n.precedence,e),t.instance=s;case"script":return s=Mi(n.src),(i=e.querySelector(xs(s)))?(t.instance=i,Ie(i),i):(l=n,(i=Dn.get(s))&&(l=C({},n),Wr(l,i)),e=e.ownerDocument||e,i=e.createElement("script"),Ie(i),Ot(i,"link",l),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,qu(l,n.precedence,e));return t.instance}function qu(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=l.length?l[l.length-1]:null,s=i,f=0;f title"):null)}function lg(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Jh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ag(e,t,n,l){if(n.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var i=Di(l.href),s=t.querySelector(bs(i));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Hu.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=s,Ie(s);return}s=t.ownerDocument||t,l=Kh(l),(i=Dn.get(i))&&Jr(l,i),s=s.createElement("link"),Ie(s);var f=s;f._p=new Promise(function(m,x){f.onload=m,f.onerror=x}),Ot(s,"link",l),n.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Hu.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Fr=0;function ig(e,t){return e.stylesheets&&e.count===0&&Gu(e,e.stylesheets),0Fr?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(i)}}:null}function Hu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Gu(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yu=null;function Gu(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yu=new Map,t.forEach(sg,e),Yu=null,Hu.call(e))}function sg(e,t){if(!(t.state.loading&4)){var n=Yu.get(e);if(n)var l=n.get(null);else{n=new Map,Yu.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(u){console.error(u)}}return a(),uo.exports=Ag(),uo.exports}var Ng=Cg();const Og=Im(Ng),zg="modulepreload",Dg=function(a){return"/"+a},bm={},en=function(u,r,o){let d=Promise.resolve();if(r&&r.length>0){let y=function(g){return Promise.all(g.map(z=>Promise.resolve(z).then(C=>({status:"fulfilled",value:C}),C=>({status:"rejected",reason:C}))))};document.getElementsByTagName("link");const b=document.querySelector("meta[property=csp-nonce]"),v=(b==null?void 0:b.nonce)||(b==null?void 0:b.getAttribute("nonce"));d=y(r.map(g=>{if(g=Dg(g),g in bm)return;bm[g]=!0;const z=g.endsWith(".css"),C=z?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${C}`))return;const O=document.createElement("link");if(O.rel=z?"stylesheet":zg,z||(O.as="script"),O.crossOrigin="",O.href=g,v&&O.setAttribute("nonce",v),document.head.appendChild(O),z)return new Promise(($,Q)=>{O.addEventListener("load",$),O.addEventListener("error",()=>Q(new Error(`Unable to preload CSS for ${g}`)))})}))}function h(y){const b=new Event("vite:preloadError",{cancelable:!0});if(b.payload=y,window.dispatchEvent(b),!b.defaultPrevented)throw y}return d.then(y=>{for(const b of y||[])b.status==="rejected"&&h(b.reason);return u().catch(h)})};async function oe(a,u={}){var d;const r=new Headers(u.headers);r.set("Content-Type","application/json");const o=await fetch(a,{credentials:"same-origin",...u,headers:r});if(!o.ok)throw new Error(((d=await o.json().catch(()=>null))==null?void 0:d.error)||`${o.status} ${o.statusText}`);if(o.status!==204)return o.json()}const Mg=()=>oe("/v1/bootstrap"),xm=()=>oe("/v1/sessions"),wg=a=>{const u=a?`?root=${encodeURIComponent(a)}`:"";return oe(`/v1/team${u}`)},Sm=a=>{const u=a?`?root=${encodeURIComponent(a)}`:"";return oe(`/v1/sandbox${u}`)},_g=(a,u=!1,r)=>{const o=r?`?root=${encodeURIComponent(r)}`:"";return oe(`/v1/sandbox${o}`,{method:"PATCH",body:JSON.stringify({mode:a,iKnow:u})})};class kg extends Error{constructor(r,o,d){super(r);ao(this,"code");ao(this,"currentVersion");this.name="OpError",this.code=o,this.currentVersion=d}}const Pm=async(a,u,r)=>{const o=r?`?root=${encodeURIComponent(r)}`:"",d=await fetch(`/v1/ops${o}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:a,...u===void 0?{}:{data:u}})}),h=await d.json().catch(()=>null);if(!d.ok)throw new kg((h==null?void 0:h.error)||`${d.status} ${d.statusText}`,h==null?void 0:h.code,h==null?void 0:h.currentVersion);return h||{ok:!0}};async function ep(a){const u=a?`?root=${encodeURIComponent(a)}`:"",r=await fetch(`/v1/diag${u}`,{credentials:"same-origin"});if(!r.ok){const v=await r.json().catch(()=>null);throw new Error((v==null?void 0:v.error)||`${r.status} ${r.statusText}`)}const o=await r.blob(),d=r.headers.get("Content-Disposition")||"",h=/filename="?([^";]+)"?/i.exec(d),y=(h==null?void 0:h[1])||`strike-diag-${Date.now()}.json`,b=URL.createObjectURL(o);try{const v=document.createElement("a");v.href=b,v.download=y,v.rel="noopener",document.body.appendChild(v),v.click(),v.remove()}finally{URL.revokeObjectURL(b)}}const jm=()=>oe("/v1/roots"),Ug=()=>oe("/v1/roots",{method:"POST"}),Tm=a=>oe(`/v1/roots/${encodeURIComponent(a)}/activate`,{method:"POST"}),Rg=a=>oe(`/v1/roots/${encodeURIComponent(a)}/resume`,{method:"POST"}),Lg=a=>oe(`/v1/roots/${encodeURIComponent(a)}`,{method:"DELETE"}),qg=(a,u,r=[])=>oe(`/v1/memory/${encodeURIComponent(a)}`,{method:"PUT",body:JSON.stringify({value:u,tags:r})}),Bg=a=>oe(`/v1/memory/${encodeURIComponent(a)}`,{method:"DELETE"}),Hg=(a,u="")=>oe("/v1/issues",{method:"POST",body:JSON.stringify({title:a,body:u})}),Yg=a=>oe(`/v1/issues/${a}/close`,{method:"POST",body:JSON.stringify({})});async function tp(a,u){const r=await fetch(a,{credentials:"same-origin"});if(!r.ok){const y=await r.json().catch(()=>null);throw new Error((y==null?void 0:y.error)||`${r.status} ${r.statusText}`)}const o=await r.blob(),d=URL.createObjectURL(o),h=document.createElement("a");h.href=d,h.download=u,h.click(),URL.revokeObjectURL(d)}const np=()=>tp("/v1/memory/export","strike-memory.json"),lp=()=>tp("/v1/issues/export","strike-issues.json");function Gg(a,u,r){let o,d=0,h=!1;const y=()=>{const b=location.protocol==="https:"?"wss:":"ws:",v=a?`?root=${encodeURIComponent(a)}`:"";o=new WebSocket(`${b}//${location.host}/v1/ws${v}`),o.onopen=()=>{d=0,r("connected")},o.onmessage=g=>{try{u(JSON.parse(g.data))}catch{r("invalid event")}},o.onerror=()=>r("transport error"),o.onclose=()=>{h||(r("reconnecting"),setTimeout(y,Math.min(500*2**d++,8e3)))}};return y(),{send:(b,v)=>(o==null?void 0:o.readyState)===WebSocket.OPEN&&o.send(JSON.stringify({type:b,...v===void 0?{}:{data:v}})),close:()=>{h=!0,o&&(o.onmessage=null,o.onerror=null,o.onclose=null,o.close())}}}function $g(a,u,r=()=>{}){const o=new EventSource(`/v1/sessions/${encodeURIComponent(a)}/events`);return o.onmessage=d=>{try{u(JSON.parse(d.data))}catch{r("invalid historical event")}},o.onerror=()=>r("history reconnecting"),()=>o.close()}const Xg=a=>oe(`/v1/sessions/${encodeURIComponent(a)}/children`),Kg='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';function ap(a){return Array.from(a.querySelectorAll(Kg)).filter(u=>!u.hasAttribute("disabled")&&u.tabIndex!==-1&&u.offsetParent!==null)}function Qg(a,u){if(u.key!=="Tab")return!1;const r=ap(a);if(!r.length)return u.preventDefault(),a.focus(),!0;const o=r[0],d=r[r.length-1],h=document.activeElement;if(u.shiftKey){if(!h||h===o||!a.contains(h))return u.preventDefault(),d.focus(),!0}else if(!h||h===d||!a.contains(h))return u.preventDefault(),o.focus(),!0;return!1}function Vg(a,u){if(u){const d=a.querySelector(u);if(d){d.focus();return}}const r=a.querySelector("[autofocus]");if(r){r.focus();return}(ap(a)[0]||a).focus()}function ip({title:a,children:u,onClose:r,mode:o="modal",className:d="",wide:h=!1,initialFocus:y,actions:b,...v}){const g=T.useRef(null),z=T.useRef(null),C=T.useId(),O=o==="blocking";T.useEffect(()=>{z.current=document.activeElement;const Q=g.current;if(Q){if(typeof Q.showModal=="function"&&!Q.open)try{Q.showModal()}catch{Q.setAttribute("open","")}else Q.setAttribute("open","");return requestAnimationFrame(()=>Vg(Q,y)),()=>{const le=z.current;if(le instanceof HTMLElement&&document.contains(le))try{le.focus()}catch{}}}},[y]),T.useEffect(()=>{const Q=g.current;if(!Q)return;const le=ye=>{if(ye.key==="Escape"&&O){ye.preventDefault(),ye.stopPropagation();return}Qg(Q,ye)};return Q.addEventListener("keydown",le),()=>Q.removeEventListener("keydown",le)},[O]);const $=["ui-dialog",h?"ui-dialog-wide":"",O?"ui-dialog-blocking":"",d].filter(Boolean).join(" ");return c.jsxs("dialog",{ref:g,className:$,"aria-labelledby":C,"aria-modal":"true","data-mode":o,onClose:()=>r==null?void 0:r(),onCancel:Q=>{if(O){Q.preventDefault();return}Q.preventDefault(),r==null||r()},...v,children:[c.jsx("div",{className:"dialog-rule","aria-hidden":!0}),c.jsx("h2",{id:C,children:a}),c.jsx("div",{className:"ui-dialog-body",children:u}),b?c.jsx("div",{className:"dialog-actions",children:b}):null]})}function Zg({items:a,value:u,onChange:r,label:o,className:d="",panelIdPrefix:h}){const y=T.useId(),b=T.useRef(null),v=a.filter(C=>!C.disabled);T.useEffect(()=>{var $,Q;const C=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(u):u.replace(/["\\]/g,""),O=($=b.current)==null?void 0:$.querySelector(`[data-tab-id="${C}"]`);(Q=O==null?void 0:O.scrollIntoView)==null||Q.call(O,{inline:"nearest",block:"nearest"})},[u]);const g=(C,O)=>{if(!v.length)return;const $=Math.max(0,v.findIndex(le=>le.id===C)),Q=v[($+O+v.length)%v.length];r(Q.id),requestAnimationFrame(()=>{var ye;const le=(ye=b.current)==null?void 0:ye.querySelectorAll("[data-tab-id]");le==null||le.forEach(ee=>{ee.dataset.tabId===Q.id&&ee.focus()})})},z=(C,O)=>{switch(C.key){case"ArrowRight":case"ArrowDown":C.preventDefault(),g(O,1);break;case"ArrowLeft":case"ArrowUp":C.preventDefault(),g(O,-1);break;case"Home":C.preventDefault(),v[0]&&r(v[0].id);break;case"End":C.preventDefault(),v.length&&r(v[v.length-1].id);break}};return c.jsx("div",{ref:b,className:`ui-tabs ${d}`.trim(),role:"tablist","aria-label":o,children:a.map(C=>{const O=C.id===u,$=`${y}-tab-${C.id}`,Q=h?`${h}-${C.id}`:`${y}-panel-${C.id}`;return c.jsx("button",{type:"button",role:"tab",id:$,"data-tab-id":C.id,className:"ui-tab","aria-selected":O,"aria-controls":Q,tabIndex:O?0:-1,disabled:C.disabled,onClick:()=>r(C.id),onKeyDown:le=>z(le,C.id),children:C.label},C.id)})})}const sp={idle:"Idle",busy:"Busy",blocked:"Blocked","needs-you":"Needs you",failed:"Failed",complete:"Complete",canceled:"Canceled",unknown:"Unknown"};function up(a){const u=(a||"").toLowerCase();return!u||u==="idle"||u==="ready"?"idle":u==="running"||u==="busy"||u==="streaming"||u==="working"?"busy":u==="blocked"||u==="finalizing"||u==="escalating"||u==="waiting"?"blocked":u==="needs-you"||u==="needs_you"||u==="permission"||u==="question"?"needs-you":u==="failed"||u==="error"||u==="interrupted"?"failed":u==="completed"||u==="complete"||u==="done"||u==="success"?"complete":u==="canceled"||u==="cancelled"?"canceled":"unknown"}function Jg({kind:a,label:u,className:r=""}){const o=u??sp[a];return c.jsxs("span",{className:`ui-status ui-status-${a} ${r}`.trim(),"data-status":a,children:[c.jsx("span",{className:"ui-status-dot","aria-hidden":!0}),c.jsx("span",{className:"ui-status-label",children:o})]})}function Wg({kind:a,label:u,className:r=""}){const o=u??sp[a];return c.jsx("span",{className:`ui-status-dot ui-status-dot-alone ui-status-${a} ${r}`.trim(),"data-status":a,role:"img","aria-label":o,title:o})}function mt({variant:a="default",size:u="md",className:r="",type:o="button",children:d,...h}){const y=["ui-btn",`ui-btn-${a}`,u!=="md"?`ui-btn-${u}`:"",r].filter(Boolean).join(" ");return c.jsx("button",{type:o,className:y,...h,children:d})}function Fg({label:a,className:u="",children:r,...o}){return c.jsx(mt,{variant:"icon","aria-label":a,title:o.title??a,className:`icon-button ${u}`.trim(),...o,children:r})}function cp({tone:a="info",title:u,children:r,className:o=""}){const d=a==="error"?"alert":"status";return c.jsxs("section",{className:`ui-notice ui-notice-${a} ${a==="unavailable"?"unavailable":""} ${o}`.trim(),role:d,"data-tone":a,children:[u?c.jsx("strong",{className:"ui-notice-title",children:u}):null,r?c.jsx("div",{className:"ui-notice-body",children:r}):null]})}function fo({name:a}){return c.jsx(cp,{tone:"unavailable",title:`${a} unavailable`,children:c.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})})}function Em({label:a="Loading…"}){return c.jsx(cp,{tone:"info",title:a,className:"ui-loading",children:c.jsx("span",{className:"ui-loading-indicator","aria-hidden":!0})})}function Ig({active:a,leading:u,title:r,meta:o,trailing:d,className:h="",role:y,...b}){const v=y==="option";return c.jsxs("button",{type:"button",role:y,className:`ui-list-row ${a?"active":""} ${h}`.trim(),"aria-pressed":v?void 0:a,"aria-selected":v?!!a:void 0,...b,children:[u,c.jsxs("span",{className:"ui-list-row-main",children:[c.jsx("span",{className:"ui-list-row-title",children:r}),o?c.jsx("span",{className:"ui-list-row-meta",children:o}):null]}),d?c.jsx("span",{className:"ui-list-row-trailing",children:d}):null]})}function To(a,u){return u.name||u.agent||a.slice(0,8)}function rp(a){switch(a){case"complete":return"quality complete";case"partial":return"quality partial";case"unavailable":return"quality unavailable";default:return"quality"}}function op({children:a,selectedId:u,onSelect:r,onOpenTranscript:o}){const d=u?a.find(([h])=>h===u):void 0;return a.length?c.jsxs("div",{className:"child-agents","aria-label":"Child agents",children:[c.jsx("div",{className:"aside-heading",children:"CHILD AGENTS"}),c.jsx("div",{className:"children",role:"list",children:a.map(([h,y])=>{const b=h===u,v=up(y.status);return c.jsxs("button",{type:"button",role:"listitem",className:b?"child-row active":"child-row","aria-pressed":b,"aria-label":`Child ${To(h,y)}`,onClick:()=>r(b?void 0:h),children:[c.jsx(Wg,{kind:v,label:y.status||v,className:`child-state ${y.status||""}`}),c.jsx("span",{className:"child-label",children:To(h,y)}),c.jsxs("span",{className:"child-meta",children:[c.jsx("small",{children:y.status}),y.quality?c.jsx("small",{className:rp(y.quality),children:y.quality}):null]})]},h)})}),d&&c.jsx(Pg,{id:d[0],child:d[1],onClose:()=>r(void 0),onOpenTranscript:o})]}):null}function Pg({id:a,child:u,onClose:r,onOpenTranscript:o}){const d=u.budgetKind?[u.budgetKind,u.finalization&&u.finalization!=="none"?`finalization ${u.finalization}`:""].filter(Boolean).join(" · "):u.escalateReason||void 0,h=up(u.status);return c.jsxs("section",{className:"child-detail","aria-label":"Child handoff detail",children:[c.jsxs("header",{children:[c.jsx("h3",{children:To(a,u)}),c.jsx(Fg,{label:"Close child detail",onClick:r,children:"×"})]}),c.jsxs("dl",{children:[c.jsx("dt",{children:"Status"}),c.jsx("dd",{children:c.jsx(Jg,{kind:h,label:u.status||h})}),u.quality?c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"Handoff quality"}),c.jsx("dd",{children:c.jsx("span",{className:rp(u.quality),children:u.quality})})]}):null,u.summary?c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"Summary"}),c.jsx("dd",{children:u.summary})]}):null,d?c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"Budget / stop"}),c.jsx("dd",{children:d})]}):null,u.escalateAction&&!u.budgetKind?c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"Escalation"}),c.jsxs("dd",{children:[u.escalateAction,u.escalateKind?` (${u.escalateKind})`:""]})]}):null,u.prompt?c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"Prompt"}),c.jsx("dd",{className:"child-prompt",children:u.prompt})]}):null,c.jsx("dt",{children:"Session"}),c.jsx("dd",{children:c.jsx("code",{children:a})})]}),o&&c.jsx("div",{className:"child-detail-actions",children:c.jsx("button",{type:"button",onClick:()=>o(a),children:"Open transcript (RO)"})}),c.jsx("p",{className:"muted child-detail-note",children:"List/detail only — full agent visualizer is tracked in #523."})]})}const Am=40,Cm=8192;function ev(a,u={}){var h,y,b;const r=["# Strike session export",""];(h=u.sessionId)!=null&&h.trim()&&r.push(`- **Session:** \`${u.sessionId.trim()}\``),(y=u.title)!=null&&y.trim()&&r.push(`- **Title:** ${sc(u.title)}`);const o=[u.provider,u.model].filter(Boolean).join(" / ");o&&r.push(`- **Model:** ${sc(o)}`),(b=u.agent)!=null&&b.trim()&&r.push(`- **Agent:** ${sc(u.agent)}`);const d=u.exported??new Date;if(r.push(`- **Exported:** ${d.toISOString()}`),r.push("","---",""),!a.length)return r.push("_Empty transcript._",""),r.join(`
-`);for(const v of a){const g=lv(v);g&&r.push(g.endsWith(`
-`)?g.trimEnd():g,"")}return r.join(`
-`).replace(/\n{3,}/g,`
-
-`)}function tv(a,u=new Date){const r=u.toISOString().replace(/[-:]/g,"").replace("T","-").replace(/\.\d{3}Z$/,"");return`strike-${(a||"session").replace(/[^a-zA-Z0-9_-]/g,"").replace(/^-+|-+$/g,"").slice(0,12).replace(/-+$/g,"")||"session"}-${r}.md`}function nv(a,u,r="text/markdown;charset=utf-8"){const o=new Blob([u],{type:r}),d=URL.createObjectURL(o),h=document.createElement("a");h.href=d,h.download=a,h.rel="noopener",document.body.appendChild(h),h.click(),h.remove(),URL.revokeObjectURL(d)}function lv(a){var r;const u=(a.text||"").replace(/\s+$/u,"");switch(a.kind){case"user":return u?`## You
-
-${u}`:`## You
-
-_Empty message._`;case"assistant":return u?`## Strike
-
-${u}`:`## Strike
-
-_Empty response._`;case"reasoning":return u?`### Thinking
-
-${Nm(u)}`:"";case"tool":{const o=sv(a.title||String(((r=a.data)==null?void 0:r.name)||"tool")),d=av(a.data),h=[`### Tool: \`${o}\` (${d})`];return u&&h.push("",Nm(iv(u))),h.join(`
-`)}case"error":return u?`### Error
-
-${u}`:"";case"system":return u?`### ${sc(a.title||"Info")}
-
-${u}`:"";default:return""}}function av(a){return a?a.isError||a.error?"error":a.done===!1?"running":"ok":"ok"}function iv(a){let u=a.replace(/\s+$/u,"");u.length>Cm&&(u=`${u.slice(0,Cm)}
-... (truncated)`);const r=u.split(`
-`);return r.length>Am&&(u=`${r.slice(0,Am).join(`
-`)}
-... (truncated)`),u}function Nm(a){const u=a.replace(/\s+$/u,"");let r="```";for(;u.includes(r);)r+="`";return`${r}
-${u}
-${r}`}function sc(a){return a.replace(/[\r\n]+/g," ").trim()}function sv(a){return a.trim().replace(/`/g,"'").replace(/[\r\n]+/g," ")||"tool"}function uv(a,u){return u<0||u>=a.length?a:a.filter((r,o)=>o!==u)}function Om(a,u,r){const o=u+r;if(u<0||u>=a.length||o<0||o>=a.length)return a;const d=a.slice(),h=d[u];return d[u]=d[o],d[o]=h,d}function zm(a,u,r){return u<0||u>=a.length?a:a.map((o,d)=>d===u?{...o,text:r}:o)}function cv(){return[]}function fp({queue:a,queueEdit:u,setQueueEdit:r,queueEditCancel:o,queueRef:d,setQueue:h,empty:y=!1,className:b="prompt-queue-wrap"}){return!a.length&&!y?null:a.length?c.jsxs("div",{className:b,children:[c.jsx("ol",{ref:d,className:"prompt-queue","aria-label":"Queued prompts",children:a.map((v,g)=>c.jsxs("li",{children:[(u==null?void 0:u.index)===g?c.jsx("input",{className:"queue-edit","aria-label":`Queued prompt text ${g+1}`,value:u.text,autoFocus:!0,onChange:z=>r({index:g,text:z.target.value}),onKeyDown:z=>{z.key==="Enter"&&(z.preventDefault(),o.current=!1,h(C=>zm(C,g,u.text)),r(null)),z.key==="Escape"&&(z.preventDefault(),o.current=!0,r(null))},onBlur:()=>{o.current||h(z=>zm(z,g,u.text)),o.current=!1,r(null)}}):c.jsxs("span",{children:[v.text,v.images.length>0?` (${v.images.length} img)`:""]}),c.jsxs("span",{className:"queue-actions",children:[c.jsx("button",{type:"button","aria-label":`Move queued prompt ${g+1} up`,disabled:g===0,onClick:()=>h(z=>Om(z,g,-1)),children:"↑"}),c.jsx("button",{type:"button","aria-label":`Move queued prompt ${g+1} down`,disabled:g===a.length-1,onClick:()=>h(z=>Om(z,g,1)),children:"↓"}),c.jsx("button",{type:"button","aria-label":`Edit queued prompt ${g+1}`,onClick:()=>{o.current=!1,r({index:g,text:v.text})},children:"✎"}),c.jsx("button",{type:"button","aria-label":`Remove queued prompt ${g+1}`,onClick:()=>{h(z=>uv(z,g)),r(z=>(z==null?void 0:z.index)===g?null:z)},children:"×"})]})]},g))}),c.jsx("div",{className:"queue-toolbar",children:c.jsx("button",{type:"button",onClick:()=>{h(cv()),r(null)},children:"Clear queue"})})]}):c.jsx("div",{className:b,children:c.jsx("p",{className:"muted",children:"Queue is empty. Prompts sent while the agent is busy land here."})})}function rv({contextLabel:a,provider:u,model:r,phase:o,fitWarning:d,childrenEntries:h,selectedChildId:y,onSelectChild:b,onOpenChildTranscript:v,queue:g,queueEdit:z,setQueueEdit:C,queueEditCancel:O,queueRef:$,setQueue:Q}){return c.jsxs("div",{className:"session-group","aria-label":"Session group",children:[c.jsxs("section",{className:"session-group-pane","aria-label":"Context summary",children:[c.jsx("div",{className:"aside-heading",children:"CONTEXT"}),c.jsxs("dl",{className:"session-group-facts",children:[c.jsx("dt",{children:"Context"}),c.jsx("dd",{children:a}),c.jsx("dt",{children:"Provider"}),c.jsx("dd",{children:u||"unknown"}),c.jsx("dt",{children:"Model"}),c.jsx("dd",{children:r||"unknown"}),c.jsx("dt",{children:"Phase"}),c.jsx("dd",{children:o||"idle"})]}),d&&c.jsx("p",{className:`session-group-fit ${d.level==="critical"?"critical":"warn"}`,role:"status",children:d.message})]}),c.jsxs("section",{className:"session-group-pane","aria-label":"Activity",children:[c.jsx("div",{className:"aside-heading",children:"ACTIVITY"}),h.length?c.jsx(op,{children:h,selectedId:y,onSelect:b,onOpenTranscript:v}):c.jsx("p",{className:"muted",children:"No child agents"})]}),c.jsxs("section",{className:"session-group-pane","aria-label":"Queue",children:[c.jsx("div",{className:"aside-heading",children:"QUEUE"}),c.jsx(fp,{queue:g,queueEdit:z,setQueueEdit:C,queueEditCancel:O,queueRef:$,setQueue:Q,empty:!0,className:"session-group-queue"})]})]})}const ov=()=>({files:[],skipped:0,uncovered:[]});function Eo(a){return a.files.length>0||a.skipped>0}function _s(a){return a.uncovered.length>0}function Dm(a){return a?a.parentSessionId?!1:!(Number(a.depth??0)>0):!0}function fv(a){const u=Array.isArray(a==null?void 0:a.files)?a.files:[],r=[];for(const h of u){if(!h||typeof h!="object")continue;const y=h,b=String(y.path??"").trim();if(!b)continue;const v=String(y.kind??"").trim();r.push(v?{path:b,kind:v}:{path:b})}const o=Number((a==null?void 0:a.checkpointSkipped)??0)||0,d=Array.isArray(a==null?void 0:a.uncovered)?a.uncovered.map(h=>String(h)).filter(Boolean):[];return{files:r,skipped:o,uncovered:d}}function dv(a,u=12){if(!Eo(a)&&!_s(a))return[];const r=[];if(a.files.length>0){r.push({text:`Paths to restore (${a.files.length}):`});for(let o=0;o=u){r.push({text:` … and ${a.files.length-u} more`});break}const d=a.files[o];r.push({text:d.kind?` ${d.kind} ${d.path}`:` ${d.path}`})}}else a.skipped>0&&r.push({text:"No restorable harness paths in the last turn."});return a.skipped>0&&r.push({text:`Checkpoint skipped: ${a.skipped} path(s) (oversized/unreadable).`}),_s(a)&&r.push({text:`Warning: uncovered mutations (${a.uncovered.join(", ")}) — shell/other changes are NOT restored.`,tone:"warn"}),r}function hv(a){return a.files.length>0?`drop the last turn and restore ${a.files.length} path(s)`:a.skipped>0?"drop the last turn; checkpointed paths were not capturable":_s(a)?"drop the last turn; no harness file snapshots (uncovered mutations)":"drop the last turn and restore files edited in that turn"}function mv(a,u){return u?!0:!Eo(a)&&!_s(a)?!1:Eo(a)||_s(a)}const Ri=()=>({members:{},delegations:{},messages:[],pathOverlaps:[],artifacts:{},ledger:{},verifications:[],available:!0}),pv=new Set(["completed","failed","canceled","cancelled","blocked"]),Wu=a=>a&&typeof a=="object"&&!Array.isArray(a)?a:void 0,re=(a,u)=>{const r=a==null?void 0:a[u];return r==null?void 0:String(r).trim()||void 0},ho=a=>pv.has((a||"").toLowerCase());function ws(a,u){const r=!!(a!=null&&a.terminal||ho(a==null?void 0:a.state));let o=u.state||(a==null?void 0:a.state)||"unknown",d=r||ho(o);return r&&u.state&&!ho(u.state)&&(o=(a==null?void 0:a.state)||o,d=!0),{sessionId:u.sessionId,name:u.name??(a==null?void 0:a.name),agent:u.agent??(a==null?void 0:a.agent),state:o,role:u.role??(a==null?void 0:a.role),parentSessionId:u.parentSessionId??(a==null?void 0:a.parentSessionId),depth:u.depth??(a==null?void 0:a.depth),objective:u.objective??(a==null?void 0:a.objective),lastAction:u.lastAction??(a==null?void 0:a.lastAction),blockReason:u.blockReason??(a==null?void 0:a.blockReason),terminalSummary:u.terminalSummary??(a==null?void 0:a.terminalSummary),queueLabel:u.queueLabel??(a==null?void 0:a.queueLabel),filesTouched:u.filesTouched??(a==null?void 0:a.filesTouched),budget:u.budget??(a==null?void 0:a.budget),terminal:d}}function Fu(a,u,r={},o){switch(u){case"team.roster":{const d=re(r,"leadId")||a.leadId,h={...a.members},y=Array.isArray(r.members)?r.members:[];for(const b of y){const v=Wu(b);if(!v)continue;const g=re(v,"sessionId");if(!g)continue;const z=Wu(v.budget);h[g]=ws(h[g],{sessionId:g,name:re(v,"name"),agent:re(v,"agent"),state:re(v,"state")||"unknown",role:re(v,"role"),parentSessionId:re(v,"parentSessionId"),depth:typeof v.depth=="number"?v.depth:void 0,objective:re(v,"objective"),lastAction:re(v,"lastAction"),blockReason:re(v,"blockReason"),terminalSummary:re(v,"terminalSummary"),queueLabel:re(v,"queueLabel"),filesTouched:Array.isArray(v.filesTouched)?v.filesTouched.map(String):void 0,budget:z})}return{...a,leadId:d,members:h,available:!0,unavailableReason:void 0}}case"child.started":{const d=re(r,"sessionId");if(!d)return a;const h={...a.members};return h[d]=ws(h[d],{sessionId:d,name:re(r,"name"),agent:re(r,"agent"),state:"running",objective:re(r,"prompt")}),{...a,members:h,available:!0}}case"child.completed":{const d=re(r,"sessionId");if(!d)return a;const h={...a.members},y=re(r,"status")||"completed",b=Wu(r.handoff);h[d]=ws(h[d],{sessionId:d,name:re(r,"name"),state:y,terminalSummary:re(r,"summary")||re(b,"summary")});let v=a.verifications;const g=Wu(r.verification);return g&&(v=[...a.verifications,{sessionId:d,passed:!!g.passed,claimed:!!g.claimed,verified:!!g.verified,summary:re(g,"summary")}].slice(-40)),{...a,members:h,verifications:v,available:!0}}case"child.escalated":{const d=re(r,"sessionId");if(!d)return a;const h={...a.members},y=re(r,"action"),b=y==="finalizing"?"finalizing":y==="interrupted"?"interrupted":"escalating";return h[d]=ws(h[d],{sessionId:d,name:re(r,"name"),state:b,blockReason:re(r,"reason")}),{...a,members:h}}case"delegation.changed":{const d=re(r,"id");if(!d)return a;const h={...a.delegations};return h[d]={id:d,state:re(r,"state")||"unknown",prev:re(r,"prev"),version:typeof r.version=="number"?r.version:void 0,sessionId:re(r,"sessionId"),name:re(r,"name"),reason:re(r,"reason"),ownerSessionId:re(r,"ownerSessionId")},{...a,delegations:h,available:!0}}case"agent.message":{const d={messageId:re(r,"messageId"),from:re(r,"from"),to:re(r,"to"),body:re(r,"body"),summary:re(r,"summary"),teamId:re(r,"teamId"),taskId:re(r,"taskId"),urgency:re(r,"urgency"),kind:re(r,"kind"),time:o},h=[...a.messages,d].slice(-100);return{...a,messages:h}}case"path.overlap":{const d=re(r,"path");if(!d)return a;const h=Array.isArray(r.sessions)?r.sessions.map(String):Array.isArray(r.sessionIds)?r.sessionIds.map(String):void 0,y=[...a.pathOverlaps,{path:d,sessions:h,time:o}].slice(-50);return{...a,pathOverlaps:y}}case"artifact.updated":{const d=re(r,"id");if(!d)return a;const h={...a.artifacts};return h[d]={id:d,type:re(r,"type"),version:typeof r.version=="number"?r.version:void 0,title:re(r,"title"),op:re(r,"op"),scope:re(r,"scope")},{...a,artifacts:h}}case"ledger.updated":{const d=re(r,"id");if(!d)return a;const h={...a.ledger};return h[d]={id:d,kind:re(r,"kind"),status:re(r,"status"),op:re(r,"op"),statement:re(r,"statement")},{...a,ledger:h}}case"team.unavailable":return{...a,available:!1,unavailableReason:re(r,"reason")||"Team observation unavailable"};case"workspace.reset":return Ri();default:return a}}function yv(a,u){if(!u)return{...a,available:!1,unavailableReason:a.unavailableReason||"Team snapshot unavailable"};if(u.available===!1)return{...Ri(),available:!1,unavailableReason:u.unavailableReason||"Team dissolved or unavailable"};const r=Ri(),o={};for(const[d,h]of Object.entries(u.members||{}))h!=null&&h.sessionId&&(o[d]=ws(void 0,h));return{...r,leadId:u.leadId||a.leadId,members:Object.keys(o).length?o:a.members,delegations:u.delegations||a.delegations,messages:Array.isArray(u.messages)?u.messages.slice(-100):a.messages,pathOverlaps:Array.isArray(u.pathOverlaps)?u.pathOverlaps.slice(-50):a.pathOverlaps,artifacts:u.artifacts||a.artifacts,ledger:u.ledger||a.ledger,verifications:Array.isArray(u.verifications)?u.verifications.slice(-40):a.verifications,available:!0,unavailableReason:void 0}}const dp=()=>({items:[],seen:new Set,status:{},children:{},team:Ri(),changedFiles:[],undoStack:[],layers:[],pinnedKinds:[],excludedKinds:[],shedKinds:[]}),gv=a=>JSON.stringify([a.type,a.time,a.data]),it=(a,u)=>String((a==null?void 0:a[u])??""),vv=a=>String((a==null?void 0:a.turnId)??(a==null?void 0:a.sessionId)??"root");function Ns(a){if(typeof a=="number"&&Number.isFinite(a))return{n:a,known:!0};if(a&&typeof a=="object"){const u=a;if(u.known===!0&&typeof u.n=="number"&&Number.isFinite(u.n))return{n:u.n,known:!0}}return{n:0,known:!1}}function Iu(a,u){return u.known?(a??0)+u.n:a}function bv(a,u){const r=u.trim();return r?!a||a===r?r:a==="mixed (actual + estimated)"?a:a==="actual"&&r==="estimated"||a==="estimated"&&r==="actual"?"mixed (actual + estimated)":r:a||""}function xv(a,u){const r=Ns(u.input),o=Ns(u.output),d=Ns(u.cacheRead),h=Ns(u.cacheCreation),y=Ns(u.used),b={...a,usageReports:(a.usageReports??0)+1,inputTokens:Iu(a.inputTokens,r),outputTokens:Iu(a.outputTokens,o),cacheReadTokens:Iu(a.cacheReadTokens,d),cacheCreationTokens:Iu(a.cacheCreationTokens,h),usageSource:bv(a.usageSource,it(u,"source"))||a.usageSource};return y.known&&(b.contextUsed=y.n),b}function ba(a,u,r=!1){if(r){const o=a.at(-1);if((o==null?void 0:o.kind)===u.kind&&o.id===u.id)return[...a.slice(0,-1),{...o,text:o.text+u.text}]}return[...a,u]}function Sv(a,u){return[...a,u]}function jv(a){return a.length?a.slice(0,-1):a}function _i(a){if(!a||typeof a!="object")return;const u=a,r=!!u.known;return{n:typeof u.n=="number"?u.n:0,known:r}}function Os(a){return Array.isArray(a)?a.map(u=>String(u)).filter(Boolean):[]}function Tv(a){return Array.isArray(a)?a.map(u=>{const r=u&&typeof u=="object"?u:{};return{kind:String(r.kind||""),source:r.source!==void 0?String(r.source):void 0,mode:r.mode!==void 0?String(r.mode):void 0,chars:typeof r.chars=="number"?r.chars:void 0,estTokens:typeof r.estTokens=="number"?r.estTokens:void 0,pinned:!!r.pinned,preview:r.preview!==void 0?String(r.preview):void 0}}).filter(u=>u.kind):[]}function Ev(a){var d,h,y,b,v;if(!a||typeof a!="object")return;const u=a,r={system:_i(u.system),tools:_i(u.tools),messages:_i(u.messages),toolResults:_i(u.toolResults),total:_i(u.total),source:u.source!==void 0?String(u.source):void 0};return r.source||((d=r.system)==null?void 0:d.known)||((h=r.tools)==null?void 0:h.known)||((y=r.messages)==null?void 0:y.known)||((b=r.toolResults)==null?void 0:b.known)||((v=r.total)==null?void 0:v.known)?r:void 0}function Av(a){const u=_i(a);return u!=null&&u.known?u.n:void 0}function Mm(a,u){return a.includes(u)?a:[...a,u]}function Pu(a,u){return a.filter(r=>r!==u)}const zt=(a,u)=>String((a==null?void 0:a[u])??"").trim()||void 0,Cv=a=>a&&typeof a=="object"&&!Array.isArray(a)?a:void 0,mo=a=>String(a.sessionId??"").trim();function po(a,u){return{agent:u.agent||(a==null?void 0:a.agent),name:u.name||(a==null?void 0:a.name),status:u.status||(a==null?void 0:a.status)||"unknown",summary:u.summary??(a==null?void 0:a.summary),quality:u.quality??(a==null?void 0:a.quality),budgetKind:u.budgetKind??(a==null?void 0:a.budgetKind),finalization:u.finalization??(a==null?void 0:a.finalization),prompt:u.prompt??(a==null?void 0:a.prompt),escalateKind:u.escalateKind??(a==null?void 0:a.escalateKind),escalateReason:u.escalateReason??(a==null?void 0:a.escalateReason),escalateAction:u.escalateAction??(a==null?void 0:a.escalateAction)}}function wm(a,u){var P,J;if(u.type==="workspace.reset")return{...dp(),status:{sessionId:String(((P=u.data)==null?void 0:P.sessionId)||"")}};if(u.type==="local.system"){const se=u.data||{};return{...a,items:ba(a.items,{id:`system:${a.items.length}:${u.time||Date.now()}`,kind:"system",title:it(se,"title")||"Notice",text:it(se,"text")})}}const r=gv(u);if(a.seen.has(r))return a;const o=new Set(a.seen).add(r),d=u.data||{};let h=a.items,y=a.status,b=a.permission,v=a.question;const g={...a.children};let z=a.team||Ri(),C=a.changedFiles,O=a.undoStack,$=a.attribution,Q=a.layers,le=a.pinnedKinds,ye=a.excludedKinds,ee=a.shedKinds,B=a.fitWarning,k=a.promptScope,pe=a.systemChars,W=a.messageCount;const me=vv(d);switch(u.type){case"status":y={...y,...d};break;case"user.message":h=ba(h,{id:`${me}:user:${h.length}`,kind:"user",text:it(d,"text"),data:d});break;case"text.delta":h=ba(h,{id:`${me}:assistant`,kind:"assistant",text:it(d,"text")},!0);break;case"reasoning.delta":h=ba(h,{id:`${me}:reasoning`,kind:"reasoning",title:"Reasoning",text:it(d,"text")},!0);break;case"tool.begin":h=ba(h,{id:String(d.callId),kind:"tool",title:it(d,"name"),text:JSON.stringify(d.args??{},null,2),data:d});break;case"tool.output":{const se=String(d.callId),ue=h.findIndex(ie=>ie.id===se);ue>=0&&(h=h.map((ie,Se)=>Se===ue?{...ie,text:ie.text+it(d,"data")}:ie));break}case"tool.end":{const se=String(d.callId),ue=h.findIndex(Se=>Se.id===se),ie={id:se,kind:"tool",title:it(d,"title"),text:it(d,"output"),data:d};h=ue>=0?h.map((Se,Ge)=>Ge===ue?ie:Se):ba(h,ie);break}case"permission.asked":b=d;break;case"permission.resolved":(!d.requestId||d.requestId===(b==null?void 0:b.requestId))&&(b=void 0);break;case"question.asked":v=d;break;case"question.resolved":(!d.requestId||d.requestId===(v==null?void 0:v.requestId))&&(v=void 0);break;case"turn.started":y={...y,busy:!0},B=void 0;break;case"turn.completed":y={...y,busy:!1},Dm(d)&&(O=Sv(O,fv(d)));break;case"session.rewound":Dm(d)&&(O=jv(O));break;case"model.selected":y={...y,provider:it(d,"provider"),model:it(d,"model")};break;case"agent.selected":y={...y,agent:it(d,"name")};break;case"effort.selected":y={...y,effort:it(d,"level")};break;case"autonomy.selected":y={...y,autonomy:it(d,"mode")};break;case"usage.reported":y=xv(y,d);break;case"permission.mode":y={...y,permissionMode:it(d,"mode")};break;case"phase.changed":y={...y,phase:it(d,"phase"),workflow:it(d,"workflow")};break;case"files.invalidated":C=Array.from(new Set([...C,...d.paths||[]]));break;case"child.started":{const se=mo(d);se&&(g[se]=po(g[se],{agent:zt(d,"agent"),name:zt(d,"name"),status:"running",prompt:zt(d,"prompt")})),z=Fu(z,u.type,d,u.time);break}case"child.completed":{const se=mo(d);if(se){const ue=Cv(d.handoff),ie=zt(d,"summary")||zt(ue,"summary");g[se]=po(g[se],{name:zt(d,"name"),status:zt(d,"status")||"completed",summary:ie,quality:zt(ue,"quality"),budgetKind:zt(d,"budgetKind"),finalization:zt(d,"finalization")})}z=Fu(z,u.type,d,u.time);break}case"child.escalated":{const se=mo(d);if(se){const ue=zt(d,"action"),ie=g[se],Se=!ie||ie.status==="running"||ie.status==="finalizing"||ie.status==="escalating";g[se]=po(ie,{name:zt(d,"name"),status:Se?ue==="finalizing"?"finalizing":ue==="interrupted"?"interrupted":"escalating":ie==null?void 0:ie.status,escalateKind:zt(d,"kind"),escalateReason:zt(d,"reason"),escalateAction:ue,budgetKind:zt(d,"kind")||(ie==null?void 0:ie.budgetKind)})}z=Fu(z,u.type,d,u.time);break}case"children.seed":{const se=Array.isArray(d.sessions)?d.sessions:[];for(const ue of se){const ie=String(ue.id??ue.ID??"").trim();if(!ie||g[ie])continue;const Se=zt(ue,"title")||zt(ue,"Title"),Ge=!!(ue.open??ue.Open);g[ie]={agent:Se,status:Ge?"running":"unknown"}}break}case"team.roster":case"delegation.changed":case"agent.message":case"path.overlap":case"artifact.updated":case"ledger.updated":case"team.unavailable":z=Fu(z,u.type,d,u.time);break;case"team.snapshot":z=yv(z,d);break;case"engine.error":h=ba(h,{id:`error:${h.length}`,kind:"error",text:it(d,"message")});break;case"provider.retrying":h=ba(h,{id:`retry:${h.length}`,kind:"system",title:"Retrying provider",text:it(d,"error")});break;case"prompt.effective":{Q=Tv(d.layers),$=Ev(d.attribution)??$,le=Os(d.pinnedKinds),ye=Os(d.excludedKinds),ee=Os(d.shedKinds),k=d.fromLastStream?"last":"current",typeof d.systemChars=="number"&&(pe=d.systemChars),typeof d.messageCount=="number"&&(W=d.messageCount);const se=Av((J=d.attribution)==null?void 0:J.total);se!==void 0&&(y={...y,contextUsed:y.contextUsed??se});break}case"context.controls":{le=Os(d.pinnedKinds),ye=Os(d.excludedKinds),Q=Q.map(se=>({...se,pinned:le.includes(se.kind)}));break}case"context.fit_warning":{const se=it(d,"level")||"warn",ue=it(d,"message")||`context fit ${se}`;B={level:se,message:ue,estimatedTokens:typeof d.estimatedTokens=="number"?d.estimatedTokens:void 0,contextLimit:typeof d.contextLimit=="number"?d.contextLimit:void 0,source:d.source!==void 0?String(d.source):void 0},typeof d.contextLimit=="number"&&d.contextLimit>0&&(y={...y,contextLimit:d.contextLimit}),typeof d.estimatedTokens=="number"&&d.estimatedTokens>0&&(y={...y,contextUsed:y.contextUsed??d.estimatedTokens});break}}return{...a,seen:o,items:h,status:y,permission:b,question:v,children:g,team:z,changedFiles:C,undoStack:O,attribution:$,layers:Q,pinnedKinds:le,excludedKinds:ye,shedKinds:ee,fitWarning:B,promptScope:k,systemChars:pe,messageCount:W}}const Nv=()=>({draft:"",queue:[],images:[],fast:!1}),_l=(a="")=>({...dp(),status:a?{sessionId:a}:{},...Nv()}),Ov=()=>({selectedID:"",byID:{}});function yo(a){return{items:a.items,seen:a.seen,status:a.status,permission:a.permission,question:a.question,children:a.children,team:a.team||Ri(),changedFiles:a.changedFiles,undoStack:a.undoStack,attribution:a.attribution,layers:a.layers,pinnedKinds:a.pinnedKinds,excludedKinds:a.excludedKinds,shedKinds:a.shedKinds,fitWarning:a.fitWarning,promptScope:a.promptScope,systemChars:a.systemChars,messageCount:a.messageCount}}function zv(a,u){switch(u.type){case"client.select":return{...a,selectedID:u.id};case"client.ensure":return a.byID[u.id]?a.selectedID===u.id?a:{...a,selectedID:u.id}:{...a,selectedID:u.id,byID:{...a.byID,[u.id]:_l(u.id)}};case"client.reset":{const r=a.byID[u.id],o=_l(u.id);return r&&(o.draft=r.draft,o.queue=r.queue,o.images=r.images,o.fast=r.fast),{...a,byID:{...a.byID,[u.id]:o}}}case"client.event":{const r=a.byID[u.id]||_l(u.id);if(u.envelope.type==="workspace.reset"){const d=_l(u.id);return d.draft=r.draft,d.queue=r.queue,d.images=r.images,d.fast=r.fast,{...a,byID:{...a.byID,[u.id]:d}}}const o=wm(yo(r),u.envelope);return{...a,byID:{...a.byID,[u.id]:{...r,...o}}}}case"client.events":{const r=a.byID[u.id]||_l(u.id);let o=r,d=yo(r);for(const h of u.envelopes){if(h.type==="workspace.reset"){const y=_l(u.id);y.draft=o.draft,y.queue=o.queue,y.images=o.images,y.fast=o.fast,o=y,d=yo(y);continue}d=wm(d,h),o={...o,...d}}return{...a,byID:{...a.byID,[u.id]:o}}}case"client.composer":{const r=a.byID[u.id]||_l(u.id);return{...a,byID:{...a.byID,[u.id]:{...r,...u.patch}}}}case"client.drop":{const{[u.id]:r,...o}=a.byID;return{selectedID:a.selectedID===u.id?"":a.selectedID,byID:o}}}}function Dv(a){return a.selectedID?a.byID[a.selectedID]||_l(a.selectedID):_l()}function _m(a,u){var h;const r=a.contextUsed!==void 0&&a.contextLimit!==void 0?`${a.contextUsed.toLocaleString()} / ${a.contextLimit.toLocaleString()}`:a.contextUsed!==void 0?`${a.contextUsed.toLocaleString()} used`:"not reported",o=[];a.inputTokens!==void 0&&o.push(`in ${a.inputTokens.toLocaleString()}`),a.outputTokens!==void 0&&o.push(`out ${a.outputTokens.toLocaleString()}`),a.cacheReadTokens!==void 0&&o.push(`cache ${a.cacheReadTokens.toLocaleString()}`);let d="Cost: unknown (no pricing catalog for this model)";if(u!=null&&u.hasCost&&(a.inputTokens!==void 0||a.outputTokens!==void 0)){let y=0,b=!1;if(a.inputTokens!==void 0&&(y+=a.inputTokens*u.inputPerM/1e6,b=!0),a.outputTokens!==void 0&&(y+=a.outputTokens*u.outputPerM/1e6,b=!0),b){let v;if(y>0&&y<.01)v="<$0.01";else{let g=y.toFixed(4).replace(/0+$/,"").replace(/\.$/,"");(!g||g==="-")&&(g="0"),v=`$${g}`}(a.inputTokens===void 0||a.outputTokens===void 0)&&(v+=" (partial)"),(a.usageSource==="estimated"||(h=a.usageSource)!=null&&h.startsWith("mixed"))&&(v+=" est."),d=`Cost: ${v}`}}else!(u!=null&&u.hasCost)&&o.length?d="Cost: unknown (pricing not in catalog)":o.length||(d="Cost: not reported");return[`Provider: ${a.provider||"—"}`,`Model: ${a.model||"—"}`,`Context: ${r}`,`Tokens: ${o.length?o.join(" · "):"not reported"}`,d].join(`
-`)}function Mv(a,u){var d;const r=[];if(a.inputTokens!==void 0&&r.push(`in ${a.inputTokens.toLocaleString()}`),a.outputTokens!==void 0&&r.push(`out ${a.outputTokens.toLocaleString()}`),a.cacheReadTokens!==void 0&&r.push(`cache ${a.cacheReadTokens.toLocaleString()}`),!r.length)return"not reported";let o="";if(u!=null&&u.hasCost){let h=0,y=!1;if(a.inputTokens!==void 0&&(h+=a.inputTokens*u.inputPerM/1e6,y=!0),a.outputTokens!==void 0&&(h+=a.outputTokens*u.outputPerM/1e6,y=!0),y){if(h>0&&h<.01)o="<$0.01";else{let b=h.toFixed(4).replace(/0+$/,"").replace(/\.$/,"");(!b||b==="-")&&(b="0"),o=`$${b}`}(a.inputTokens===void 0||a.outputTokens===void 0)&&(o+=" partial"),(a.usageSource==="estimated"||(d=a.usageSource)!=null&&d.startsWith("mixed"))&&(o+=" est.")}}return o?`${o} · ${r.join(" · ")}`:r.join(" · ")}const rc=[{label:"/help",detail:"List available web commands",insert:"/help"},{label:"/export",detail:"Download conversation as markdown",insert:"/export"},{label:"/compact",detail:"Compact model history",insert:"/compact"},{label:"/prompt",detail:"Inspect effective prompt",insert:"/prompt"},{label:"/context",detail:"Refresh context doctor",insert:"/context"},{label:"/rewind",detail:"Undo last turn — chat only or chat and files",insert:"/rewind"},{label:"/rewind-files",detail:"Undo last turn with file restore preview",insert:"/rewind-files"},{label:"/interrupt",detail:"Stop the running turn",insert:"/interrupt"},{label:"/queue",detail:"Focus the prompt queue browser",insert:"/queue"},{label:"/rename",detail:"Rename the current session",insert:"/rename "},{label:"/fork",detail:"Fork the current session",insert:"/fork"},{label:"/cost",detail:"Show session cost / context usage",insert:"/cost"},{label:"/copy",detail:"Copy last assistant reply",insert:"/copy"},{label:"/fast",detail:"Toggle fast mode (on|off)",insert:"/fast"},{label:"/agent",detail:"Select agent by name",insert:"/agent "},{label:"/effort",detail:"Set effort (low|medium|high|xhigh)",insert:"/effort "},{label:"/autonomy",detail:"Set autonomy (supervised|agent|checks)",insert:"/autonomy "},{label:"/mode",detail:"Set permission mode",insert:"/mode "},{label:"/model",detail:"Select model [provider/model]",insert:"/model "},{label:"/provider",detail:"Select provider",insert:"/provider "}],wv=new Set(rc.map(a=>a.label.slice(1)));function _v(a,u){if(!u)return!0;const r=[...u];let o=0;for(const d of a)if(d===r[o]&&(o++,o===r.length))return!0;return!1}function kv(a,u){const r=u.toLowerCase().replace(/^\//,""),o=[[],[],[]];for(const d of a){const h=d.label.toLowerCase().replace(/^\//,"");let y=-1;h===r?y=0:h.startsWith(r)?y=1:_v(h,r)&&(y=2),y>=0&&o[y].push(d)}return o.flat()}function km(a,u){if(u<=0)return null;const r=a.indexOf(`
-`),o=r<0?a.length:r;if(u>o||!a.startsWith("/"))return null;let d=0;for(;dd?null:{query:a.slice(1,Math.min(u,d)),start:0,end:d}}function Uv(a,u=[]){const r=a.trim();if(!r.startsWith("/"))return{kind:"pass"};const o=r.search(/\s/),d=(o<0?r:r.slice(0,o)).toLowerCase(),h=o<0?"":r.slice(o+1).trim();if(!d.startsWith("/")||d==="/")return{kind:"unknown",command:d||"/"};const y=d.slice(1);if(u.some(v=>v.toLowerCase()===y))return{kind:"pass"};if(!wv.has(y))return{kind:"unknown",command:d};switch(y){case"help":return{kind:"help"};case"export":return{kind:"export"};case"queue":return{kind:"queue"};case"cost":return{kind:"cost"};case"copy":return{kind:"copy"};case"fork":return{kind:"fork"};case"compact":return{kind:"op",type:"compact",data:{strategy:"summarize"}};case"prompt":case"context":return{kind:"op",type:"inspect.prompt"};case"rewind":return{kind:"op",type:"rewind",data:{}};case"rewind-files":return{kind:"op",type:"rewind",data:{restoreFiles:!0}};case"interrupt":return{kind:"op",type:"interrupt"};case"rename":return{kind:"rename",title:h};case"fast":return h?h==="on"||h==="true"||h==="1"?{kind:"fast",enabled:!0}:h==="off"||h==="false"||h==="0"?{kind:"fast",enabled:!1}:{kind:"usage",message:"usage: /fast [on|off]"}:{kind:"fast"};case"agent":return h?{kind:"op",type:"select.agent",data:{name:h}}:{kind:"usage",message:"usage: /agent "};case"effort":return h?{kind:"op",type:"set.effort",data:{level:h}}:{kind:"usage",message:"usage: /effort "};case"autonomy":return h?{kind:"op",type:"set.autonomy",data:{mode:h}}:{kind:"usage",message:"usage: /autonomy "};case"mode":return h?{kind:"op",type:"set.permission_mode",data:{mode:h}}:{kind:"usage",message:"usage: /mode "};case"provider":return h?{kind:"op",type:"select.model",data:{provider:h}}:{kind:"usage",message:"usage: /provider "};case"model":{if(!h)return{kind:"usage",message:"usage: /model "};const v=h.indexOf("/");return v>0?{kind:"op",type:"select.model",data:{provider:h.slice(0,v),model:h.slice(v+1)}}:{kind:"op",type:"select.model",data:{model:h}}}default:return{kind:"unknown",command:d}}}function Um(a=[]){const u=["Web slash commands:",...rc.map(r=>` ${r.label.padEnd(16)} ${r.detail}`)];if(a.length){u.push("","Skills:");for(const r of a)u.push(` /${r.name.padEnd(15)} ${r.description||"Skill"}`)}return u.push("","Unknown /commands are rejected with feedback (not sent as prompts)."),u.join(`
-`)}const _o=["chat","code","team","project","ops"],ki={chat:{id:"chat",label:"Chat",description:"Transcript and composer",primarySurface:"transcript"},code:{id:"code",label:"Code",description:"Files, diffs, and diagnostics",primarySurface:"files",defaultSurface:"files"},team:{id:"team",label:"Team",description:"Agents, roster, and handoffs",primarySurface:"roster",defaultSurface:"roster"},project:{id:"project",label:"Project",description:"Plans, goals, issues, memory, workflows",primarySurface:"plans",defaultSurface:"plans"},ops:{id:"ops",label:"Ops",description:"Providers, settings, MCP, plugins, panes, diagnostics",primarySurface:"settings",defaultSurface:"settings"}},Ao=[{id:"transcript",label:"Transcript",modes:["chat"],capability:"always",attention:"none",lazyMount:!1,attach:"read",placement:{desktop:"canvas",tablet:"canvas",phone:"canvas"}},{id:"composer",label:"Composer",modes:["chat"],capability:"live",attention:"none",lazyMount:!1,attach:"mutate-blocked",placement:{desktop:"canvas",tablet:"canvas",phone:"canvas"}},{id:"sessions-rail",label:"Sessions",modes:"any",capability:"sessions",attention:"badge",lazyMount:!1,attach:"read",placement:{desktop:"rail",tablet:"sheet",phone:"sheet"}},{id:"runtime",label:"Runtime",modes:["chat"],capability:"live",attention:"none",lazyMount:!1,attach:"mutate-blocked",placement:{desktop:"chrome",tablet:"chrome",phone:"sheet"}},{id:"asks",label:"Asks",modes:["chat"],capability:"live",attention:"needs-you",lazyMount:!1,attach:"mutate-blocked",placement:{desktop:"dialog",tablet:"dialog",phone:"dialog"}},{id:"context",label:"context",modes:["chat","ops"],capability:"always",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:10,modeOrder:{ops:280}},{id:"files",label:"files",modes:["code"],capability:"files",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:20},{id:"diagnostics",label:"diagnostics",modes:["code","ops"],capability:"lsp",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:30,modeOrder:{ops:270}},{id:"roster",label:"agents",modes:["team"],capability:"team",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:40},{id:"artifacts",label:"artifacts",modes:["team","project"],capability:"artifacts",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:42,modeOrder:{team:42,project:45}},{id:"ledger",label:"decisions",modes:["team","project"],capability:"ledger",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:44,modeOrder:{team:44,project:46}},{id:"review",label:"review",modes:["team"],capability:"team",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:46,modeOrder:{team:46}},{id:"timeline",label:"timeline",modes:["ops","team"],capability:"timeline",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:50,modeOrder:{ops:290,team:50}},{id:"plans",label:"plans",modes:["project"],capability:"plans",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:60},{id:"goals",label:"goals",modes:["project"],capability:"goals",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:70},{id:"issues",label:"issues",modes:["project"],capability:"issues",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:80},{id:"memory",label:"memory",modes:["project"],capability:"memory",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:90},{id:"workflows",label:"workflows",modes:["project"],capability:"workflows",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:100},{id:"project-export",label:"exports",modes:["project"],capability:"project-export",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:105},{id:"settings",label:"settings",modes:["ops"],capability:"settings",attention:"none",lazyMount:!0,attach:"mutate-blocked",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:200},{id:"providers",label:"providers",modes:["ops"],capability:"auth",attention:"none",lazyMount:!0,attach:"mutate-blocked",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:210},{id:"auth",label:"auth",modes:["ops"],capability:"auth",attention:"none",lazyMount:!0,attach:"mutate-blocked",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:215},{id:"permissions",label:"permissions",modes:["ops"],capability:"permissions",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:220},{id:"sandbox",label:"sandbox",modes:["ops"],capability:"sandbox",attention:"none",lazyMount:!0,attach:"mutate-blocked",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:225},{id:"theme",label:"theme",modes:["ops"],capability:"settings",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:230},{id:"mcp",label:"mcp",modes:["ops"],capability:"mcp",attention:"badge",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:240},{id:"plugins",label:"plugins",modes:["ops"],capability:"plugins",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:250},{id:"panes",label:"panes",modes:["ops"],capability:"panes",attention:"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:260},{id:"diag-export",label:"diagnostics export",modes:["ops"],capability:"diag",attention:"none",lazyMount:!0,attach:"mutate-blocked",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:300}],uc=new Map;function Rv(a){!a.id||Ao.some(u=>u.id===a.id)||uc.set(a.id,a)}function go(){uc.clear()}function Lv(a){const u=String(a.id||"").trim();if(!u)return;const r=u.replace(/[^\w.:@+-]+/g,"-").slice(0,96);if(!r)return;const o=r.startsWith("pane:")?r:`pane:${r}`,d=String(a.title||u).replace(/[\u0000-\u001f\u007f]/g,"").slice(0,64);return{id:o,label:d||o,modes:["chat","ops"],capability:"panes",attention:a.loadError?"badge":"none",lazyMount:!0,attach:"read",placement:{desktop:"drawer",tablet:"drawer",phone:"sheet"},inspector:!0,order:265}}function hp(){return uc.size===0?[...Ao]:[...Ao,...uc.values()]}const qv=()=>new Map(hp().map(a=>[a.id,a]));function ks(a){return qv().get(a)}function ko(a){return _o.includes(a)}function mp(a,u){return a.modes==="any"?!0:a.modes.includes(u)}function pp(a,u,r){const o=a.capability;return o==="always"?!0:o==="live"?!!((r==null?void 0:r.isLive)??(u==null?void 0:u.live)):o==="team"?!0:o==="sessions"?!!(u!=null&&u.sessions||u!=null&&u.roots):o==="project-export"?!!(u!=null&&u.memory||u!=null&&u.issues||u!=null&&u.plans||u!=null&&u.goals||u!=null&&u.workflows):u?!!u[o]:!1}function yp(a,u){return u?a.attach!=="hidden":!0}function gp(a={}){const u=new Set(a.forceIds||[]);return hp().filter(r=>!(a.inspectorOnly&&!r.inspector||a.mode&&!mp(r,a.mode)&&!u.has(r.id)||!yp(r,a.attachOnly)&&!u.has(r.id)||!pp(r,a.caps,{isLive:a.isLive})&&!u.has(r.id))).sort((r,o)=>Rm(r,a.mode)-Rm(o,a.mode))}function Rm(a,u){return u&&a.modeOrder&&a.modeOrder[u]!==void 0?a.modeOrder[u]:a.order??500}function Bv(a,u,r){return gp({mode:a,caps:u,attachOnly:r==null?void 0:r.attachOnly,isLive:r==null?void 0:r.isLive,forceIds:r==null?void 0:r.forceIds,inspectorOnly:!0})}function Co(a,u,r){return a!=="chat"?Bv(a,u,r):gp({caps:u,attachOnly:r==null?void 0:r.attachOnly,isLive:r==null?void 0:r.isLive,forceIds:r==null?void 0:r.forceIds,inspectorOnly:!0})}function Hv(a,u={}){switch(a){case"code":return(u.changedFiles??0)>0?"badge":"none";case"team":return u.permissionPending||u.questionPending?"needs-you":(u.teamMembers??0)>0?"badge":"none";case"chat":return u.permissionPending||u.questionPending?"needs-you":u.fitWarning||u.contextWarning?"badge":"none";default:return"none"}}function No(a,u,r){var h;const o=ki[a],d=Co(a,u,r);if(r!=null&&r.preferred){const y=d.find(b=>b.id===r.preferred);if(y)return y.id;if(ks(r.preferred))return r.preferred}if(o.defaultSurface){const y=d.find(b=>b.id===o.defaultSurface);if(y)return y.id}return(h=d[0])==null?void 0:h.id}function Yv(a){const u=!!(a.mode&&ko(a.mode));let r=u?a.mode:"chat";u||(a.path?r="code":a.agent?r="team":a.pane?r="ops":r="chat");let o=(a.surface||"").trim();if(a.pane&&!o&&(o="panes"),a.path&&!o&&(o="files"),a.agent&&!o&&(o="roster"),o){const h=ks(o);if(!h)return o=No(r,a.caps,{attachOnly:a.attachOnly,isLive:a.isLive})||"",{mode:r,surface:o||void 0,openDrawer:!!o&&r!=="chat"};if(!mp(h,r)&&h.modes!=="any"){const v=Array.isArray(h.modes)?h.modes[0]:"chat";u||(r=v)}const y=pp(h,a.caps,{isLive:a.isLive}),b=yp(h,a.attachOnly);return!y||!b?{mode:r,surface:h.id,openDrawer:!!h.inspector,unavailable:{id:h.id,reason:b?`capability ${String(h.capability)} unavailable`:"hidden in attach-only"}}:{mode:r,surface:h.id,openDrawer:!!h.inspector||h.placement.desktop==="drawer"}}if(r==="chat")return{mode:"chat",openDrawer:!1};const d=No(r,a.caps,{attachOnly:a.attachOnly,isLive:a.isLive});return r==="ops"&&!d?{mode:r,surface:"settings",openDrawer:!1}:{mode:r,surface:d,openDrawer:!!d}}const Gv="The TUI /loop shortcut is superseded here by Goals and Workflows. Use Project → goals or workflows for durable automation.";function $v(a){const u=[];for(const o of _o){const d=ki[o];u.push({id:`mode:${o}`,label:`Mode: ${d.label}`,detail:d.description,keywords:`mode ${o} ${d.label}`,action:{type:"mode",mode:o}})}const r=[{mode:"code",surface:"files",label:"Files"},{mode:"team",surface:"roster",label:"Team roster"},{mode:"project",surface:"plans",label:"Plans"},{mode:"project",surface:"goals",label:"Goals"},{mode:"project",surface:"issues",label:"Issues"},{mode:"project",surface:"memory",label:"Memory"},{mode:"ops",surface:"mcp",label:"MCP"},{mode:"ops",surface:"plugins",label:"Plugins"},{mode:"ops",surface:"settings",label:"Settings surface"},{mode:"ops",surface:"timeline",label:"Timeline"},{mode:"chat",surface:"context",label:"Context doctor"}];for(const o of r)u.push({id:`surface:${o.surface}`,label:`Open ${o.label}`,detail:`${ki[o.mode].label} · ${o.surface}`,keywords:`${o.label} ${o.surface} ${o.mode}`,action:{type:"surface",mode:o.mode,surface:o.surface},requiresCapability:o.surface==="settings"?"settings":void 0});for(const o of rc)u.push({id:`slash:${o.label}`,label:o.label,detail:o.detail,keywords:`slash command ${o.label} ${o.detail}`,action:{type:"slash",insert:o.insert,run:o.insert==="/help"||o.insert==="/cost"||o.insert==="/export"},requiresLive:!["/help","/export","/cost","/copy"].includes(o.label)});for(const o of a.skills||[])u.push({id:`skill:${o.name}`,label:`/${o.name}`,detail:o.description||"Skill",keywords:`skill ${o.name}`,action:{type:"slash",insert:`/${o.name} `},requiresLive:!0});return u.push({id:"session:settings",label:"Settings",detail:"Open settings dialog",keywords:"settings preferences config",action:{type:"session",action:"settings"},requiresCapability:"settings"},{id:"session:export",label:"Export transcript",detail:"Download markdown export",action:{type:"session",action:"export"}},{id:"session:help",label:"Help",detail:"Show web slash commands",action:{type:"session",action:"help"}}),a.attachOnly&&u.push({id:"notice:attach",label:"Attach-only mode",detail:"Mutations are disabled in this session",action:{type:"notice",title:"Attach-only",body:"This cockpit is attach-only. Observation works; prompts and settings mutations are blocked server-side."}}),u}function Xv(a){return a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function vo(a,u){return new RegExp(`(?:^|\\s)${Xv(u)}(?:\\s|$)`).test(a)}function Lm(a,u){const r=a.label.toLowerCase(),o=(a.detail||"").toLowerCase(),d=(a.keywords||"").toLowerCase();return r===u||r===`open ${u}`?400:a.action.type==="surface"&&a.action.surface.toLowerCase()===u?360:a.action.type==="mode"&&a.action.mode.toLowerCase()===u?350:r.startsWith(`${u} `)||r.startsWith(`open ${u}`)?300:vo(r,u)?250:r.includes(u)?200:vo(d,u)?80:d.includes(u)?60:vo(o,u)?30:o.includes(u)?10:1}function Kv(a,u){const r=u.trim().toLowerCase();if(!r)return a.slice(0,50);const o=r.split(/\s+/).filter(Boolean);return a.filter(d=>{const h=`${d.label} ${d.detail} ${d.keywords||""}`.toLowerCase();return h.includes(r)||o.every(y=>h.includes(y))}).sort((d,h)=>Lm(h,r)-Lm(d,r)).slice(0,50)}function Oo(a){return a.length!==1?!1:"/\\.-_+~".includes(a)?!0:new RegExp("\\p{L}|\\p{N}","u").test(a)}const Xa={active:!1,query:"",start:-1};function Qv(a,u){if(u<0||u>a.length)return Xa;let r=u;for(;r>0;){const d=a[r-1];if(d===`
-`)return Xa;if(Oo(d)){r--;continue}if(d==="@"){r--;break}return Xa}if(r>=u||a[r]!=="@"||r>0&&!/\s/.test(a[r-1])||u<=r)return Xa;const o=a.slice(r+1,u);for(const d of o)if(!Oo(d))return Xa;return{active:!0,query:o,start:r}}function qm(a,u=!1){return u?"file search unavailable":a===""?"no project files indexed (empty workdir or all ignored)":"no files match — try a fuller path; .plan/node_modules/… are hidden unless queried"}function Vv(a,u){let r=u+1;for(;rKv(u,d),[u,d]);if(T.useEffect(()=>{a&&(h(""),b(0),window.setTimeout(()=>{var C;return(C=v.current)==null?void 0:C.focus()},0))},[a]),T.useEffect(()=>{b(0)},[d]),!a)return null;const z=C=>{o(C),r()};return c.jsxs(ip,{title:"Command palette",onClose:r,initialFocus:'input[aria-label="Filter commands"]',children:[c.jsx("input",{ref:v,className:"palette-input",type:"search",placeholder:"Search modes, surfaces, commands…","aria-label":"Filter commands",value:d,onChange:C=>h(C.target.value),onKeyDown:C=>{if(C.key==="ArrowDown")C.preventDefault(),b(O=>Math.min(g.length-1,O+1));else if(C.key==="ArrowUp")C.preventDefault(),b(O=>Math.max(0,O-1));else if(C.key==="Enter"){C.preventDefault();const O=g[y];O&&z(O)}else C.key==="Escape"&&(C.preventDefault(),r())}}),c.jsxs("ul",{className:"palette-list",role:"listbox","aria-label":"Commands",children:[g.map((C,O)=>c.jsx("li",{children:c.jsx(Ig,{role:"option",active:O===y,title:C.label,meta:C.detail,onMouseEnter:()=>b(O),onClick:()=>z(C)})},C.id)),!g.length&&c.jsx("li",{className:"muted",children:"No matching commands"})]}),c.jsx("p",{className:"muted palette-hint",children:"↑↓ navigate · ↵ run · esc close"})]})}const Fv=()=>oe("/v1/providers"),Iv=(a,u)=>oe("/v1/auth/key",{method:"POST",body:JSON.stringify({provider:a,key:u})}),Pv=a=>oe(`/v1/auth/${encodeURIComponent(a)}`,{method:"DELETE"}),e0=a=>oe("/v1/auth/device",{method:"POST",body:JSON.stringify({provider:a})}),t0=a=>oe(`/v1/auth/device/${encodeURIComponent(a)}`),n0=a=>oe(`/v1/auth/device/${encodeURIComponent(a)}`,{method:"DELETE"}),l0=a=>oe("/v1/auth/oauth",{method:"POST",body:JSON.stringify({provider:a})}),Bm=a=>oe(`/v1/auth/oauth/${encodeURIComponent(a)}`),a0=(a,u)=>oe(`/v1/auth/oauth/${encodeURIComponent(a)}/complete`,{method:"POST",body:JSON.stringify({paste:u})}),i0=a=>oe(`/v1/auth/oauth/${encodeURIComponent(a)}`,{method:"DELETE"}),s0=a=>{const u=a?`?provider=${encodeURIComponent(a)}`:"";return oe(`/v1/models${u}`)},bo=()=>oe("/v1/custom-providers"),u0=a=>oe("/v1/custom-providers",{method:"POST",body:JSON.stringify(a)}),c0=a=>oe(`/v1/custom-providers/${encodeURIComponent(a)}`,{method:"DELETE"}),r0=()=>oe("/v1/permissions/presets"),o0=(a,u="*",r="")=>{const o=new URLSearchParams({permission:a,pattern:u});return r&&o.set("preset",r),oe(`/v1/permissions/explain?${o}`)},Hm=()=>oe("/v1/scheduler/presets"),f0=a=>oe("/v1/scheduler/presets",{method:"POST",body:JSON.stringify({ids:a})}),d0=a=>{const u=a?`?root=${encodeURIComponent(a)}`:"";return oe(`/v1/config-sources${u}`)};function Ym(a){return String(a.id||a.ID||"").trim()}function h0(a){const u=[],r=a.context??a.Context,o=a.output??a.Output;if(r&&u.push(`ctx ${r.toLocaleString()}`),o&&u.push(`out ${o.toLocaleString()}`),(a.toolCall||a.ToolCall)&&u.push("tools"),(a.reasoning||a.Reasoning)&&u.push("reasoning"),(a.attachment||a.Attachment)&&u.push("attachments"),a.hasCost??a.HasCost){const y=a.inputCost??a.InputCost??0,b=a.outputCost??a.OutputCost??0;u.push(`$${y}/$${b} per M`)}const h=a.source||a.Source;return h&&u.push(h),u.length?u.join(" · "):"limits unknown"}const m0={text:"--ink",textMuted:"--muted",accent:"--acid",accentAlt:"--accent-alt",highlight:"--highlight",success:"--success",warning:"--warning",error:"--signal",danger:"--danger",background:"--ground",surface:"--surface",surfaceFocus:"--raised",surfaceMuted:"--surface-muted",border:"--rule",borderFocus:"--border-focus",borderMuted:"--border-muted",userLabel:"--user",toolLabel:"--tool",diffAdded:"--diff-add",diffRemoved:"--diff-del",overlayScrim:"--overlay"},zo="strike-theme-override",p0="strike.web.theme.preview";function Qa(a){return String(a.id||a.ID||"").trim()}function y0(a){return String(a.name||a.Name||Qa(a)||"theme").trim()}function g0(a){return String(a.provenance||a.Provenance||"builtin").trim()}function zs(a){return a.colors||a.Colors||{}}function Gm(a){if(!a)return;const u=a.trim().toLowerCase();if(/^#[0-9a-f]{3}([0-9a-f]{3})?([0-9a-f]{2})?$/.test(u))return u}function v0(a,u=!0){if(a==="light")return"light";if(a==="dark")return"dark";if(typeof window<"u"&&window.matchMedia)try{if(window.matchMedia("(prefers-color-scheme: light)").matches)return"light";if(window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark"}catch{}return u?"dark":"light"}function b0(a,u){const r={};for(const[o,d]of Object.entries(m0)){const h=a[o];if(!h)continue;const y=u==="light"?h.light:h.dark,b=Gm(y)||Gm(u==="light"?h.dark:h.light);b&&(r[d]=b)}return r["--surface-muted"]&&(r["--code-bg"]=r["--surface-muted"]),r["--ground"]&&(r["--mark-ink"]=u==="light"?"#ffffff":r["--ground"],r["--header-bg"]=u==="light"?`${r["--ground"]}f0`:`${r["--ground"]}e8`),r["--acid"]&&(r["--glow"]=`${r["--acid"]}66`),r["--rule"]&&(r["--idle"]=r["--rule"]),r["--rule"]&&(r["--cap-border"]=r["--rule"]),r}function x0(){if(typeof document>"u")return null;let a=document.getElementById(zo);return a||(a=document.createElement("style"),a.id=zo,document.head.appendChild(a)),a}function Ds(a,u){const r=x0();if(!r)return;const o=v0(u),d=b0(a,o);if(Object.keys(d).length===0){r.textContent="";return}const h=Object.entries(d).map(([y,b])=>` ${y}: ${b};`).join(`
-`);r.textContent=`:root {
-${h}
-}`}function $m(){const a=typeof document<"u"?document.getElementById(zo):null;a&&(a.textContent="");try{sessionStorage.removeItem(p0)}catch{}}const S0=a=>{const u=a?`?root=${encodeURIComponent(a)}`:"";return oe(`/v1/themes${u}`)},j0=a=>oe("/v1/settings",{method:"PATCH",body:JSON.stringify({theme:a})}),T0=["","off","low","medium","high","xhigh"],E0=["","default","plan","soft-approve","accept-edits","yolo"],A0=["","workspace-write","read-only","off"],C0=["","unfocused-only","on","off"],N0=["","lite","full","off"],O0=["","off","5","10","15","30","45","60"],z0=["","default","1","2","3","4","5","6","7","8"],D0=["","trim","summarize"],M0=["","default","0.60","0.70","0.80","0.85","1"],w0=["","default","1024","2048","4096","8192"],_0=["","default","1","2","3","4"],k0=["bash","write","edit","webfetch","task","skill"],U0=["auto","dark","light"],vp="strike.web.appearance";function Do(){try{const a=localStorage.getItem(vp);if(a==="dark"||a==="light"||a==="auto")return a}catch{}return"auto"}function bp(a){const u=document.documentElement;a==="auto"?u.removeAttribute("data-appearance"):u.setAttribute("data-appearance",a);try{localStorage.setItem(vp,a)}catch{}}function mn({label:a,value:u,values:r,disabled:o,onChange:d}){return c.jsxs("label",{children:[a,c.jsx("select",{"aria-label":a,value:u,disabled:o,onChange:h=>d(h.target.value),children:r.map(h=>c.jsx("option",{value:h,children:h||"— leave unchanged"},h||"(unset)"))})]})}function ec({label:a,value:u,disabled:r,placeholder:o,onChange:d}){return c.jsxs("label",{children:[a,c.jsx("input",{"aria-label":a,value:u,disabled:r,placeholder:o,onChange:h=>d(h.target.value)})]})}function tc(a,u="off"){return a==null?"":a===0?u:String(a)}function R0(a){return a==null||a===0?"":String(a)}function L0({boot:a,status:u,providers:r,onClose:o,rootID:d,isLive:h}){var hl,nt,Pe,Bl;const[y,b]=T.useState(!1),[v,g]=T.useState(!1),[z,C]=T.useState(""),[O,$]=T.useState(()=>Do()),[Q,le]=T.useState([]),[ye,ee]=T.useState(""),[B,k]=T.useState(String(u.provider||r[0]||"")),[pe,W]=T.useState(""),[me,P]=T.useState(!1),[J,se]=T.useState(null),[ue,ie]=T.useState(null),[Se,Ge]=T.useState(""),[St,st]=T.useState([]),[U,K]=T.useState([]),[I,te]=T.useState({name:"",baseURL:"",api:"openai",models:""}),[fe,S]=T.useState([]),[R,X]=T.useState(""),[V,de]=T.useState("bash"),[ge,Ee]=T.useState("*"),[ut,ze]=T.useState(""),[sl,tn]=T.useState([]),[Rt,Hn]=T.useState([]),[Mn,Yn]=T.useState([]),[pn,Li]=T.useState([]),[Gn,kl]=T.useState(!1),[Lt,ul]=T.useState(""),[qt,wn]=T.useState(""),[gt,Ul]=T.useState(""),[$n,Bt]=T.useState(!1),[_n,vt]=T.useState(""),[nn,cl]=T.useState(""),[Xn,yn]=T.useState(""),[Je,Ht]=T.useState(""),[We,gn]=T.useState(""),[kn,Za]=T.useState(""),[$t,Kn]=T.useState(""),[vn,bn]=T.useState(""),[Qn,xn]=T.useState(""),[Ja,Sa]=T.useState([]),[Vn,ln]=T.useState(!1),[Zn,rl]=T.useState(""),[ol,ja]=T.useState(""),[Jn,Sn]=T.useState(""),[$e,fl]=T.useState(""),[Xt,Fe]=T.useState(""),[tt,jt]=T.useState(""),[Un,Rl]=T.useState(""),Dt=!!(a!=null&&a.capabilities.settings),Wn=!!(a!=null&&a.capabilities.auth),Kt=!!(a!=null&&a.capabilities.providers),Fn=!!(a!=null&&a.capabilities.permissions),Yt=!!(a!=null&&a.capabilities.scheduler),Mt=!!(a!=null&&a.capabilities.configFiles),Qe=!!(a&&!a.attachOnly),Tt=async()=>{var E;if(Wn)try{const G=await Fv();le(G.providers||[]),ee(G.oauthNote||""),!B&&((E=G.providers)!=null&&E.length)&&k(G.providers[0].name)}catch(G){C(G.message)}};T.useEffect(()=>{Tt()},[Wn]),T.useEffect(()=>{!Wn||!B||s0(B).then(E=>st(E.models||[])).catch(()=>st([]))},[Wn,B]),T.useEffect(()=>{Kt&&bo().then(E=>K(E.providers||[])).catch(()=>K([]))},[Kt]),T.useEffect(()=>{Fn&&r0().then(E=>S(E.presets||[])).catch(()=>S([]))},[Fn]),T.useEffect(()=>{Yt&&Hm().then(E=>{var G;tn(E.presets||[]),Hn([...((G=E.global)==null?void 0:G.presets)||[]])}).catch(()=>{})},[Yt]),T.useEffect(()=>{Mt&&d0(d).then(E=>Yn(E.sources||[])).catch(()=>Yn([]))},[Mt,d]),T.useEffect(()=>{if(!J||J.status!=="pending")return;const E=window.setInterval(()=>{t0(J.id).then(G=>{se(G),G.status==="completed"&&Tt()}).catch(()=>{})},1500);return()=>window.clearInterval(E)},[J==null?void 0:J.id,J==null?void 0:J.status]),T.useEffect(()=>{if(!ue||ue.status!=="pending")return;const E=window.setInterval(()=>{Bm(ue.id).then(G=>{ie(G),G.status==="completed"&&Tt()}).catch(()=>{})},1500);return()=>window.clearInterval(E)},[ue==null?void 0:ue.id,ue==null?void 0:ue.status]);const Ie=((hl=a==null?void 0:a.agents)==null?void 0:hl.map(E=>E.name))||[],Et=!!(a!=null&&a.capabilities.themes||a!=null&&a.capabilities.settings);T.useEffect(()=>{Et&&(kl(!0),S0(d).then(E=>{Li(E.themes||[]);const G=(E.active||"").trim();ul(G),Ul(G),wn(G);const De=(E.themes||[]).find(pt=>Qa(pt)===G);De&&Ds(zs(De),Do())}).catch(()=>{}).finally(()=>kl(!1)))},[Et,d]),T.useEffect(()=>{Dt&&(b(!0),C(""),oe("/v1/settings").then(E=>{vt(E.provider||""),cl(E.model||""),yn(E.agent||""),Ht(E.effort||""),gn(E.mode||""),Za(E.sandbox||""),Kn(E.notify||""),bn(E.leanCode||""),xn(tc(E.permissionAutoApproveSeconds,"off")),Sa([...E.permissionAutoApproveExclude||[]]),ln(!1),rl(tc(E.maxChildDepth,"default")),ja(E.compactionStrategy||""),Sn(E.compactionModel||""),fl(R0(E.compactionThreshold)),Fe(tc(E.compactionBuffer,"default")),jt(tc(E.keepUserTurns,"default")),Rl((E.pruneProtectTools||[]).join(", ")),E.theme&&(ul(E.theme),Ul(E.theme),wn(G=>G||E.theme||""))}).catch(E=>C(E.message)).finally(()=>b(!1)))},[Dt]);const Ll=E=>{$(E),bp(E);const G=qt||Lt,De=pn.find(pt=>Qa(pt)===G);De&&Ds(zs(De),E)},an=E=>{wn(E);const G=pn.find(De=>Qa(De)===E);G?Ds(zs(G),O):E||$m()},jn=()=>{const E=gt||Lt||"";wn(E);const G=pn.find(De=>Qa(De)===E);G?Ds(zs(G),O):$m()},dl=async()=>{const E=(qt||"").trim();if(!(!E||!Dt)){Bt(!0),C("");try{const De=(await j0(E)).theme||E;ul(De),Ul(De),wn(De);const pt=pn.find(Vt=>Qa(Vt)===De);pt&&Ds(zs(pt),O)}catch(G){C(G.message),jn()}finally{Bt(!1)}}},Qt=E=>{ln(!0),Sa(G=>G.includes(E)?G.filter(De=>De!==E):[...G,E])},Ta=async E=>{if(E==null||E.preventDefault(),!Dt){o();return}g(!0),C("");const G={};_n&&(G.provider=_n),nn&&(G.model=nn),Xn&&(G.agent=Xn),Je&&(G.effort=Je),We&&(G.mode=We),kn&&(G.sandbox=kn),$t&&(G.notify=$t),vn&&(G.leanCode=vn),Qn&&(G.permissionAutoApproveSeconds=Qn),Vn&&(G.permissionAutoApproveExclude=Ja),Zn&&(G.maxChildDepth=Zn),ol&&(G.compactionStrategy=ol),Jn.trim()&&(G.compactionModel=Jn.trim()),$e&&(G.compactionThreshold=$e),Xt&&(G.compactionBuffer=Xt),tt&&(G.keepUserTurns=tt),Un.trim()&&(G.pruneProtectTools=Un.trim()),!G.provider&&!G.model&&!G.agent&&!G.effort&&!G.mode&&u.provider&&Object.keys(G).length===0&&(G.provider=String(u.provider||""),G.model=String(u.model||""),G.agent=String(u.agent||""),G.effort=String(u.effort||""),G.mode=String(u.permissionMode||""));try{Object.keys(G).length>0&&await oe("/v1/settings",{method:"PATCH",body:JSON.stringify(G)}),o()}catch(De){C(De.message)}finally{g(!1)}},Wa=async()=>{if(Dt){g(!0),C("");try{await oe("/v1/settings",{method:"PATCH",body:JSON.stringify({provider:String(u.provider||""),model:String(u.model||""),agent:String(u.agent||""),effort:String(u.effort||""),mode:String(u.permissionMode||"")})}),vt(String(u.provider||"")),cl(String(u.model||"")),yn(String(u.agent||"")),Ht(String(u.effort||"")),gn(String(u.permissionMode||""))}catch(E){C(E.message)}finally{g(!1)}}},ql=!Dt||y?c.jsx(mt,{type:"button",onClick:o,children:"Close"}):void 0;return c.jsxs(ip,{title:"Workspace settings",className:"settings-dialog",wide:!0,mode:"modal",onClose:o,actions:ql,children:[Wn?c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Provider authentication"}),c.jsx("p",{className:"muted",children:"Credential values are never shown. Methods reflect host capabilities."}),c.jsxs("div",{className:"provider-rows",role:"list","aria-label":"Providers",children:[Q.map(E=>c.jsxs("article",{className:"provider-row",role:"listitem",children:[c.jsxs("header",{children:[c.jsx("strong",{children:E.name}),c.jsx("span",{className:E.authed?"badge ok":"badge",children:E.authed?"authenticated":E.detail||"none"})]}),c.jsxs("p",{className:"muted",children:["methods: ",(E.methods||[]).join(", ")||"—",E.expiresAt?` · expires ${E.expiresAt}`:"",E.custom?" · custom":"",E.baseURL?` · ${E.baseURL}`:""]}),c.jsxs("div",{className:"panel-actions",children:[c.jsx(mt,{type:"button",disabled:!Qe||me,onClick:()=>k(E.name),children:"Select"}),E.authed&&!E.builtin&&c.jsx(mt,{type:"button",disabled:!Qe||me,onClick:()=>{P(!0),Pv(E.name).then(()=>Tt()).catch(G=>C(G.message)).finally(()=>P(!1))},children:"Log out"})]})]},E.name)),!Q.length&&c.jsx("p",{className:"muted",children:"No providers reported."})]}),c.jsxs("label",{children:["Selected provider",c.jsxs("select",{value:B,onChange:E=>k(E.target.value),"aria-label":"Auth provider",disabled:!Qe,children:[Q.map(E=>c.jsx("option",{value:E.name,children:E.name},E.name)),!Q.length&&r.map(E=>c.jsx("option",{value:E,children:E},E))]})]}),((nt=Q.find(E=>E.name===B))==null?void 0:nt.apiKey)!==!1&&c.jsxs(c.Fragment,{children:[c.jsxs("label",{children:["API key",c.jsx("input",{value:pe,onChange:E=>W(E.target.value),placeholder:"Stored locally by strike — never echoed back","aria-label":"API key",disabled:!Qe||me,autoComplete:"off"})]}),c.jsx(mt,{type:"button",disabled:!Qe||!B||!pe||me,onClick:()=>{P(!0),C(""),Iv(B,pe).then(()=>(W(""),Tt())).catch(E=>C(E.message)).finally(()=>P(!1))},children:"Save key"})]}),((Pe=Q.find(E=>E.name===B))==null?void 0:Pe.device)&&c.jsxs("div",{className:"auth-device",children:[c.jsx(mt,{type:"button",disabled:!Qe||me||!!(J&&J.status==="pending"),onClick:()=>{P(!0),C(""),e0(B).then(E=>se(E)).catch(E=>C(E.message)).finally(()=>P(!1))},children:"Start device login"}),J&&c.jsxs("div",{className:"device-flow",role:"status","aria-live":"polite",children:[c.jsxs("p",{children:["Status: ",c.jsx("strong",{children:J.status})]}),J.userCode&&c.jsxs("p",{children:["Code: ",c.jsx("code",{children:J.userCode})]}),J.verificationUri&&c.jsxs("p",{children:["Open"," ",c.jsx("a",{href:J.verificationUri,target:"_blank",rel:"noopener noreferrer",children:J.verificationUri})]}),J.expiresAt&&c.jsxs("p",{className:"muted",children:["Expires ",J.expiresAt]}),J.message&&c.jsx("p",{className:"settings-error",children:J.message}),J.status==="pending"&&c.jsx(mt,{type:"button",onClick:()=>{n0(J.id).then(()=>se({...J,status:"canceled"}))},children:"Cancel"})]})]}),((Bl=Q.find(E=>E.name===B))==null?void 0:Bl.oauth)&&c.jsxs("div",{className:"auth-oauth",children:[c.jsx("p",{className:"muted",children:ye||"OAuth uses authorize URL + optional paste; no invented browser callback."}),c.jsx(mt,{type:"button",disabled:!Qe||me,onClick:()=>{P(!0),C(""),l0(B).then(E=>ie(E)).catch(E=>C(E.message)).finally(()=>P(!1))},children:"Start OAuth"}),ue&&c.jsxs("div",{className:"oauth-flow",role:"status",children:[c.jsxs("p",{children:["Status: ",c.jsx("strong",{children:ue.status})]}),ue.authorizeUrl&&c.jsx("p",{children:c.jsx("a",{href:ue.authorizeUrl,target:"_blank",rel:"noopener noreferrer",children:"Open authorize URL"})}),ue.status==="pending"&&c.jsxs(c.Fragment,{children:[c.jsxs("label",{children:["Paste redirect URL or code",c.jsx("input",{value:Se,onChange:E=>Ge(E.target.value),"aria-label":"OAuth paste",autoComplete:"off"})]}),c.jsx(mt,{type:"button",disabled:!Se.trim(),onClick:()=>{a0(ue.id,Se).then(()=>(Ge(""),Bm(ue.id))).then(E=>(ie(E),Tt())).catch(E=>C(E.message))},children:"Complete with paste"}),c.jsx(mt,{type:"button",onClick:()=>void i0(ue.id).then(()=>ie({...ue,status:"canceled"})),children:"Cancel"})]}),ue.message&&c.jsx("p",{className:"muted",children:ue.message})]})]}),!Qe&&c.jsx("p",{className:"muted",children:"Attach-only is read-only — status is visible; credential mutations are disabled."}),St.length>0&&c.jsxs("div",{className:"model-meta","aria-label":"Model metadata",children:[c.jsxs("h3",{children:["Models (",B,")"]}),c.jsx("ul",{children:St.slice(0,24).map(E=>c.jsxs("li",{children:[c.jsx("code",{children:Ym(E)}),c.jsxs("span",{className:"muted",children:[" ",h0(E)]})]},Ym(E)))})]})]}):c.jsx(fo,{name:"Provider authentication"}),Kt&&c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Custom providers"}),c.jsx("p",{className:"muted",children:"Config only — set API keys via the auth section using the provider name. Credentials are never listed."}),c.jsx("ul",{className:"custom-provider-list",children:U.map(E=>c.jsxs("li",{children:[c.jsx("code",{children:E.name})," · ",E.api," · ",E.baseURL,c.jsx(mt,{type:"button",disabled:!Qe,onClick:()=>{c0(E.name).then(()=>bo()).then(G=>K(G.providers||[])).then(()=>Tt()).catch(G=>C(G.message))},children:"Remove"})]},E.name))}),c.jsxs("label",{children:["Name",c.jsx("input",{"aria-label":"Custom provider name",value:I.name,disabled:!Qe,onChange:E=>te({...I,name:E.target.value})})]}),c.jsxs("label",{children:["Base URL",c.jsx("input",{"aria-label":"Custom provider base URL",value:I.baseURL,disabled:!Qe,onChange:E=>te({...I,baseURL:E.target.value})})]}),c.jsxs("label",{children:["API",c.jsxs("select",{"aria-label":"Custom provider API",value:I.api,disabled:!Qe,onChange:E=>te({...I,api:E.target.value}),children:[c.jsx("option",{value:"openai",children:"openai"}),c.jsx("option",{value:"anthropic",children:"anthropic"})]})]}),c.jsxs("label",{children:["Models (comma-separated)",c.jsx("input",{"aria-label":"Custom provider models",value:I.models,disabled:!Qe,onChange:E=>te({...I,models:E.target.value})})]}),c.jsx(mt,{type:"button",disabled:!Qe||!I.name.trim()||!I.baseURL.trim(),onClick:()=>{const E=I.models.split(",").map(G=>G.trim()).filter(Boolean);u0({name:I.name.trim(),baseURL:I.baseURL.trim(),api:I.api,models:E}).then(()=>bo()).then(G=>{K(G.providers||[]),te({name:"",baseURL:"",api:"openai",models:""})}).then(()=>Tt()).catch(G=>C(G.message))},children:"Save custom provider"})]}),Fn&&c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Permission presets"}),c.jsx("ul",{children:fe.map(E=>{const G=String(E.id||E.ID||""),De=String(E.name||E.Name||G),pt=String(E.description||E.Description||"");return c.jsxs("li",{children:[c.jsx("strong",{children:De}),pt?` — ${pt}`:""]},G)})}),c.jsxs("label",{children:["Tool / permission",c.jsx("input",{"aria-label":"Permission name",value:V,onChange:E=>de(E.target.value)})]}),c.jsxs("label",{children:["Pattern",c.jsx("input",{"aria-label":"Permission pattern",value:ge,onChange:E=>Ee(E.target.value)})]}),c.jsxs("label",{children:["Dry-run preset",c.jsxs("select",{"aria-label":"Permission preset",value:ut,onChange:E=>ze(E.target.value),children:[c.jsx("option",{value:"",children:"(effective)"}),fe.map(E=>{const G=String(E.id||E.ID||"");return c.jsx("option",{value:G,children:String(E.name||E.Name||G)},G)})]})]}),c.jsx(mt,{type:"button",onClick:()=>{o0(V,ge||"*",ut).then(E=>X(String(E.Summary||E.summary||JSON.stringify(E,null,2)))).catch(E=>C(E.message))},children:"Explain"}),R&&c.jsx("pre",{className:"permission-explain-body","aria-label":"Permission explanation",children:R})]}),Yt&&c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Scheduler presets"}),c.jsx("p",{className:"muted",children:"Shipped build-system presets with effective global selection provenance."}),sl.map(E=>{const G=String(E.id||E.ID||""),De=String(E.name||E.Name||G),pt=Rt.includes(G);return c.jsxs("label",{className:"exclude-item",children:[c.jsx("input",{type:"checkbox",checked:pt,disabled:!Qe,"aria-label":`Scheduler preset ${De}`,onChange:()=>{Hn(Vt=>pt?Vt.filter(wt=>wt!==G):[...Vt,G])}}),De,c.jsx("span",{className:"muted",children:String(E.rationale||E.Rationale||"")})]},G)}),c.jsx(mt,{type:"button",disabled:!Qe,onClick:()=>{f0(Rt).then(()=>Hm()).then(E=>{var G;return Hn([...((G=E.global)==null?void 0:G.presets)||[]])}).catch(E=>C(E.message))},children:"Apply scheduler presets"}),c.jsxs("p",{className:"muted",children:["Enabled: ",Rt.length?Rt.join(", "):"(none)"]})]}),Mt&&c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Config sources"}),c.jsx("p",{className:"muted",children:"Typed inspection of global/project config surfaces (not a raw file editor)."}),c.jsx("ul",{children:Mn.map((E,G)=>c.jsxs("li",{children:[c.jsx("strong",{children:E.label||E.slot||E.kind})," · ",c.jsx("span",{className:"muted",children:E.scope})," · ",c.jsx("code",{children:E.display}),E.exists?" · exists":" · missing"]},`${E.scope}-${E.slot||E.kind}-${E.display}-${G}`))})]}),c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Appearance"}),c.jsx(mn,{label:"Color scheme",value:O,values:[...U0],onChange:E=>Ll(E)}),c.jsx("p",{className:"muted",children:"Local to this browser. Auto follows the system preference. Independent of the theme catalog below."})]}),Et?c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Theme catalog"}),c.jsx("p",{className:"muted",children:"Bundled, user, and project themes with portable color roles. Preview paints immediately; Apply saves the default via settings."}),Gn?c.jsx(Em,{label:"Loading themes…"}):pn.length===0?c.jsx("p",{className:"muted",children:"No themes reported by this host."}):c.jsxs(c.Fragment,{children:[c.jsxs("label",{children:["Theme",c.jsxs("select",{"aria-label":"Theme catalog",value:qt,onChange:E=>an(E.target.value),children:[c.jsx("option",{value:"",children:"— stock CSS (no catalog override) —"}),pn.map(E=>{const G=Qa(E),De=`${y0(E)} (${g0(E)})`;return c.jsx("option",{value:G,children:De},G)})]})]}),qt&&c.jsxs("p",{className:"muted","aria-live":"polite",children:["Previewing ",c.jsx("code",{children:qt}),Lt&&qt!==Lt?` · saved default is ${Lt}`:"",Lt&&qt===Lt?" · saved default":""]}),c.jsxs("div",{className:"dialog-actions",style:{justifyContent:"flex-start",gap:"0.5rem"},children:[c.jsx(mt,{type:"button",disabled:!qt||qt===gt||$n,onClick:()=>jn(),children:"Revert preview"}),c.jsx(mt,{type:"button",variant:"primary",disabled:!qt||!Dt||!!(a!=null&&a.attachOnly)||$n||qt===Lt,onClick:()=>void dl(),children:$n?"Applying…":"Apply theme"})]}),(a==null?void 0:a.attachOnly)&&c.jsx("p",{className:"muted",children:"Attach-only is read-only — preview works; Apply is disabled."})]})]}):c.jsx(fo,{name:"Theme catalog"}),Dt?y?c.jsx(Em,{label:"Loading settings…"}):c.jsxs("form",{className:"settings-form",onSubmit:E=>void Ta(E),children:[c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Runtime defaults"}),c.jsx("p",{className:"muted",children:"Persisted to ~/.strike/config. Empty leaves the stored value unchanged on save."}),c.jsx(ec,{label:"Provider",value:_n,onChange:vt,placeholder:u.provider||"provider id"}),c.jsx(ec,{label:"Model",value:nn,onChange:cl,placeholder:u.model||"model id"}),c.jsx(mn,{label:"Agent",value:Xn,values:["",...Ie],onChange:yn}),c.jsx(mn,{label:"Effort",value:Je,values:T0,onChange:Ht}),c.jsx(mn,{label:"Permission mode",value:We,values:E0,onChange:gn}),c.jsx(mt,{type:"button",disabled:v||!u.provider,onClick:()=>void Wa(),children:"Use current runtime"})]}),c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Sandbox default"}),c.jsx(mn,{label:"Sandbox",value:kn,values:A0,onChange:Za}),c.jsx("p",{className:"muted",children:"OS process isolation for bash (off | read-only | workspace-write)."})]}),c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Behavior dials"}),c.jsx(mn,{label:"Notify",value:$t,values:C0,onChange:Kn}),c.jsx(mn,{label:"Lean code",value:vn,values:N0,onChange:bn})]}),c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Permission auto-approve"}),c.jsx(mn,{label:"Countdown seconds",value:Qn,values:O0,onChange:xn}),c.jsx(mn,{label:"Max child depth",value:Zn,values:z0,onChange:rl}),c.jsxs("div",{className:"exclude-list",role:"group","aria-label":"Auto-approve exclude",children:[c.jsx("span",{className:"exclude-label",children:"Never auto-approve"}),k0.map(E=>c.jsxs("label",{className:"exclude-item",children:[c.jsx("input",{type:"checkbox",checked:Ja.includes(E),onChange:()=>Qt(E),"aria-label":`Exclude ${E}`}),E]},E))]})]}),c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Compaction"}),c.jsx(mn,{label:"Strategy",value:ol,values:D0,onChange:ja}),c.jsx(ec,{label:"Compaction model",value:Jn,onChange:Sn,placeholder:"model id (− clears)"}),c.jsx(mn,{label:"Threshold",value:$e,values:M0,onChange:fl}),c.jsx(mn,{label:"Buffer",value:Xt,values:w0,onChange:Fe}),c.jsx(mn,{label:"Keep user turns",value:tt,values:_0,onChange:jt}),c.jsx(ec,{label:"Prune protect tools",value:Un,onChange:Rl,placeholder:"comma-separated (− clears)"})]}),z&&c.jsx("p",{className:"settings-error",role:"alert",children:z}),c.jsxs("div",{className:"dialog-actions",children:[c.jsx(mt,{type:"button",onClick:o,children:"Close"}),c.jsx(mt,{type:"submit",variant:"primary",disabled:v,children:v?"Saving…":"Save settings"})]})]}):c.jsx(fo,{name:"Saved defaults"}),c.jsxs("fieldset",{children:[c.jsx("legend",{children:"Support"}),c.jsxs("p",{className:"muted",children:["Export a redacted prompt/config diagnostic bundle (same scrubbing as TUI ",c.jsx("code",{children:"/diag"}),")."]}),c.jsx(mt,{type:"button",disabled:!(a!=null&&a.capabilities.diag&&h),"aria-label":"Download diagnostics",onClick:()=>void ep(d||"").catch(E=>window.alert(E.message)),children:"Download diagnostics"}),!(a!=null&&a.capabilities.diag)&&c.jsx("p",{className:"muted",children:"Unavailable on this host (no live engine)."})]}),z&&!Dt&&c.jsx("p",{className:"settings-error",role:"alert",children:z})]})}const q0=96,B0=6,H0=120;function Ms(a,u,r){return Math.max(u,Math.min(r,a))}function Xm(a,u,r,o,d,h,y){if(r<=0)return{start:0,end:0};if(r<=y)return{start:0,end:r};let b=0,v=0,g=r-1;for(;v<=g;){const O=v+g>>1,$=o(O),Q=d(O);$+Qy){const O=b+C>>1;b=Ms(O-Math.floor(y/2),0,r),C=Ms(b+y,0,r),b=Ms(C-y,0,r)}return{start:b,end:C}}function Y0(a){const u=new Array(a.length+1);u[0]=0;for(let r=0;r(h==null?void 0:h.current)??O.current,[h]),J=T.useMemo(()=>a.map((te,fe)=>{const S=u(te,fe);return $.current.get(S)??o}),[a,u,o,B]),se=T.useMemo(()=>Y0(J),[J]),ue=se[a.length]||0,ie=T.useCallback(te=>se[te]??0,[se]),Se=T.useCallback(te=>J[te]??o,[J,o]),Ge=T.useMemo(()=>Xm(Q,ye,a.length,ie,Se,d,C),[Q,ye,a.length,ie,Se,d,C]);T.useLayoutEffect(()=>{const te=P();if(!te)return;const fe=a[0]?u(a[0],0):"";if(a.length>pe.current&&fe&&fe!==W.current&&me.current&&me.current){const R=me.current.key,X=a.findIndex((V,de)=>u(V,de)===R);if(X>=0){const V=ie(X)-me.current.offset;te.scrollTop=Math.max(0,V),le(te.scrollTop)}}else z&&a.length>=pe.current&&(te.scrollTop=te.scrollHeight,le(te.scrollTop));pe.current=a.length,W.current=fe},[a,u,ie,P,z]),T.useEffect(()=>{const te=P();if(!te)return;const fe=()=>{const R=te.scrollTop;le(R),ee(te.clientHeight||600),v&&R{ee(te.clientHeight||600)}):void 0;return S==null||S.observe(te),te.addEventListener("scroll",fe,{passive:!0}),fe(),()=>{te.removeEventListener("scroll",fe),S==null||S.disconnect()}},[P,v,g,a,u,ie,Se,C]);const St=T.useCallback((te,fe)=>{if(!fe)return;const S=fe.getBoundingClientRect().height;if(S<=0)return;const R=$.current.get(te);R!==void 0&&Math.abs(R-S)<1||($.current.set(te,S),k(X=>X+1))},[]),st=a.slice(Ge.start,Ge.end),U=ie(Ge.start),K=Math.max(0,ue-ie(Ge.end)),I=h?{position:"relative"}:{position:"relative",overflow:"auto",height:"100%",minHeight:0};return c.jsx("div",{ref:h?void 0:O,className:y?`virtual-list ${y}`:"virtual-list",style:I,role:"log","aria-label":b,"aria-relevant":"additions","aria-busy":!1,"data-virtual-start":Ge.start,"data-virtual-end":Ge.end,"data-virtual-total":a.length,"data-virtual-mounted":st.length,children:c.jsxs("div",{className:"virtual-list-spacer",style:{height:ue,position:"relative"},"aria-hidden":!1,children:[c.jsx("div",{style:{height:U},"aria-hidden":"true","data-pad":"top"}),st.map((te,fe)=>{const S=Ge.start+fe,R=u(te,S);return c.jsx("div",{"data-virtual-index":S,ref:X=>St(R,X),children:r(te,S)},R)}),c.jsx("div",{style:{height:K},"aria-hidden":"true","data-pad":"bottom"})]})})}const Km=/(?:^|[\s(`])([\w./-]+\.[a-zA-Z0-9]+)(?::(\d+))?(?=[:\s)`]|$)/g,Qm=new Set(["read","glob","grep","toolsearch","definition","references","symbols"]),$0=new Set(["edit","write","apply_patch","apply-patch","notebook_edit"]),xo=40,X0=4e3,K0=12e3,nc=400,lc=800;function ac({text:a,onFileRef:u}){const r=a.split(/(`[^`\n]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)]+\))/g);return c.jsx(c.Fragment,{children:r.map((o,d)=>{if(o.startsWith("`")&&o.endsWith("`"))return c.jsx("code",{children:o.slice(1,-1)},d);if(o.startsWith("**")&&o.endsWith("**"))return c.jsx("strong",{children:o.slice(2,-2)},d);const h=o.match(/^\[([^\]]+)\]\(([^)]+)\)$/);if(h&&/^(https?:|\/|#)/.test(h[2]))return c.jsx("a",{href:h[2],rel:"noreferrer",children:h[1]},d);const y=[];let b=0;const v=new RegExp(Km.source,Km.flags);for(const g of o.matchAll(v)){const z=g.index||0,C=g[0],O=g[1],$=g[2]?Number(g[2]):void 0,Q=C.slice(0,C.indexOf(O));y.push(o.slice(b,z),Q),u?y.push(c.jsxs("button",{type:"button",className:"file-ref",onClick:()=>u(O,$),children:[O,$?`:${$}`:""]},`${d}-${z}`)):y.push(c.jsxs("span",{className:"file-ref",children:[O,$?`:${$}`:""]},`${d}-${z}`)),b=z+C.length}return y.push(o.slice(b)),c.jsx("span",{children:y},d)})})}function xp({text:a,label:u="Copy"}){const[r,o]=T.useState(!1);return c.jsx("button",{type:"button",className:"copy-btn",onClick:()=>{var d;(d=navigator.clipboard)==null||d.writeText(a).then(()=>{o(!0),window.setTimeout(()=>o(!1),1200)})},children:r?"Copied":u})}function Q0({text:a,onFileRef:u}){const{text:r,truncated:o}=Sp(a,K0),d=r.split(/(```[\s\S]*?```)/g);return c.jsxs("div",{className:"markdown",children:[d.map((h,y)=>{if(h.startsWith("```")){const b=h.slice(3,-3).replace(/^\n/,"").split(`
-`),v=b[0].match(/^[\w+-]+$/)?b.shift():"text";let g=b,z=!1;g.length>nc&&(z=!0,g=[...g.slice(0,Math.floor(nc/2)),`… ${b.length-nc} lines omitted …`,...g.slice(-Math.floor(nc/2))]);const C=g.join(`
-`),O=b.join(`
-`);return c.jsxs("figure",{className:"code-block",children:[c.jsxs("figcaption",{children:[c.jsxs("span",{children:[v,z?" · bounded":""]}),c.jsx(xp,{text:O})]}),c.jsx("pre",{children:c.jsx("code",{children:C})})]},y)}return h.split(`
-`).map((b,v)=>{var g;if(/^#{1,3} /.test(b)){const z=((g=b.match(/^#+/))==null?void 0:g[0].length)||1,C=b.replace(/^#+\s/,"");return z===1?c.jsx("h2",{children:c.jsx(ac,{text:C,onFileRef:u})},v):c.jsx("h3",{children:c.jsx(ac,{text:C,onFileRef:u})},v)}return/^[-*] /.test(b)?c.jsxs("div",{className:"list-line",children:["— ",c.jsx(ac,{text:b.slice(2),onFileRef:u})]},v):b?c.jsx("p",{children:c.jsx(ac,{text:b,onFileRef:u})},v):c.jsx("br",{},v)})}),o&&c.jsx("p",{className:"muted",children:"Message truncated for display; full text remains in session memory."})]})}function V0({text:a,path:u,onFileRef:r}){const[o,d]=T.useState(!1),h=a.split(`
-`),y=h.length>lc?[...h.slice(0,Math.floor(lc/2)),`… ${h.length-lc} lines omitted …`,...h.slice(-Math.floor(lc/2))]:h;return c.jsxs("div",{className:"diff-viewer",children:[c.jsxs("div",{className:"diff-toolbar",children:[u?r?c.jsx("button",{type:"button",className:"file-ref",onClick:()=>r(u),children:u}):c.jsx("span",{className:"file-ref",children:u}):c.jsx("span",{children:"diff"}),c.jsxs("label",{className:"diff-wrap",children:[c.jsx("input",{type:"checkbox",checked:o,onChange:b=>d(b.target.checked)}),"Wrap"]}),c.jsx(xp,{text:a})]}),c.jsx("pre",{className:o?"diff wrap":"diff",children:y.map((b,v)=>{const g=b.startsWith("+")&&!b.startsWith("+++")?"add":b.startsWith("-")&&!b.startsWith("---")?"del":b.startsWith("@@")?"hunk":"";return c.jsxs("span",{className:g,children:[b,`
-`]},v)})})]})}function Us(a){const u=(a.title||"").replace(/^tool\s*[·:.-]\s*/i,"").trim();if(u)return u.split(/\s+/)[0].toLowerCase();const r=a.data||{},o=r.name||r.tool||r.toolName;return typeof o=="string"?o.toLowerCase():"tool"}function Z0(a){const u=a.data||{},r=String(u.status||u.state||"").toLowerCase();return r==="denied"||r==="permission_denied"?{label:"denied",kind:"denied"}:r==="error"||r==="failed"||a.kind==="error"?{label:"error",kind:"error"}:r==="running"||r==="in_progress"||u.running===!0?{label:"running",kind:"running"}:a.text.trim()?{label:"done",kind:"done"}:{label:r||"done",kind:r==="running"?"running":"done"}}function J0(a){const u=a.data||{},r=typeof u.durationMs=="number"?u.durationMs:typeof u.duration_ms=="number"?u.duration_ms:typeof u.elapsedMs=="number"?u.elapsedMs:void 0;if(!(r===void 0||r<0))return r<1e3?`${Math.round(r)}ms`:`${(r/1e3).toFixed(r>=1e4?0:1)}s`}function W0(a){var r;const u=a.match(/^\+\+\+\s+(?:b\/)?(.+)$/m)||a.match(/^---\s+(?:a\/)?(.+)$/m);return((r=u==null?void 0:u[1])==null?void 0:r.trim())||void 0}function F0(a){return a.includes("@@")&&(/^\+\+\+/m.test(a)||/^---/m.test(a))}function Sp(a,u=X0){return a.length<=u?{text:a,truncated:!1}:{text:`${a.slice(0,u)}
-… truncated (${a.length.toLocaleString()} chars; full text retained in session memory)`,truncated:!0}}function I0(a){const u=a.split(`
-`);return u.length<=xo?a:`… ${u.length-xo} earlier lines …
-${u.slice(-xo).join(`
-`)}`}function P0({item:a,onFileRef:u}){var d;const r=a.data||{},o=String(r.eventKind||r.kind||a.title||"").toLowerCase();if(o.includes("verification")||(d=a.title)!=null&&d.toLowerCase().includes("verification")){const h=r.passed===!0||r.verified===!0;return c.jsxs("article",{className:"message system semantic-event",children:[c.jsx("div",{className:"message-label",children:"Verification"}),c.jsxs("p",{children:[h?"Passed":r.passed===!1?"Failed":"Completed",r.summary?` — ${String(r.summary)}`:a.text?` — ${a.text}`:""]})]})}if(o.includes("overlap")||o.includes("path.overlap")){const h=String(r.path||"");return c.jsxs("article",{className:"message system semantic-event",children:[c.jsx("div",{className:"message-label",children:"Path overlap"}),c.jsxs("p",{children:[u&&h?c.jsx("button",{type:"button",className:"file-ref",onClick:()=>u(h),children:h}):h||"paths",Array.isArray(r.sessions)?` · ${r.sessions.length} sessions`:""]})]})}return o.includes("denied")||o.includes("permission")?c.jsxs("article",{className:"message system semantic-event",children:[c.jsx("div",{className:"message-label",children:"Permission denied"}),c.jsx("p",{children:a.text||String(r.message||r.permission||"Permission denied")})]}):o.includes("handoff")||o.includes("agent.message")?c.jsxs("article",{className:"message system semantic-event",children:[c.jsx("div",{className:"message-label",children:o.includes("handoff")?"Handoff":"Agent message"}),c.jsxs("p",{children:[r.from?`${String(r.from)} → `:"",r.to?String(r.to):"",r.summary||r.body||a.text?` — ${String(r.summary||r.body||a.text)}`:""]})]}):null}function jp({item:a,onFileRef:u}){const r=Us(a),o=Z0(a),d=J0(a),h=a.text.trim(),{text:y,truncated:b}=Sp(h);let v;try{v=JSON.parse(h)}catch{v=void 0}const g=$0.has(r)||F0(h),z=typeof(a.data||{}).path=="string"?String((a.data||{}).path):W0(h),C=(a.data||{}).args??(a.data||{}).input,O=o.kind==="running"?I0(y):y;return c.jsxs("details",{className:`tool-card state-${o.kind}`,children:[c.jsxs("summary",{children:[c.jsx("span",{className:"tool-name",children:r}),c.jsx("span",{className:`tool-state tool-state-${o.kind}`,children:o.label}),d&&c.jsx("small",{className:"tool-duration",children:d}),c.jsx("small",{children:g?"diff":v?"structured":b?"bounded":"output"})]}),C!==void 0&&c.jsxs("div",{className:"tool-args",children:[c.jsx("strong",{children:"Arguments"}),c.jsx("pre",{children:typeof C=="string"?C:JSON.stringify(C,null,2)})]}),g?c.jsx(V0,{text:O,path:z,onFileRef:u}):c.jsx("pre",{className:"tool-output",children:v?JSON.stringify(v,null,2):O})]})}function eb(a){const u=[];let r=0;for(;r=2?u.push({kind:"exploration",items:d,id:`explore-${d[0].id}`}):u.push({kind:"single",item:d[0]});continue}u.push({kind:"single",item:o}),r+=1}return u}function tb({items:a,onFileRef:u}){const r=T.useMemo(()=>{const o=new Map;for(const d of a){const h=Us(d);o.set(h,(o.get(h)||0)+1)}return[...o.entries()].map(([d,h])=>h>1?`${d}×${h}`:d).join(", ")},[a]);return c.jsxs("details",{className:"exploration-group",children:[c.jsxs("summary",{children:[c.jsx("span",{children:"Exploration"}),c.jsxs("small",{children:[a.length," steps · ",r]})]}),c.jsx("div",{className:"exploration-body",children:a.map(o=>c.jsx(jp,{item:o,onFileRef:u},o.id))})]})}function nb(a){if(a.kind!=="system"&&a.kind!=="tool")return!1;const u=`${a.title||""} ${JSON.stringify(a.data||{})}`.toLowerCase();return/verification|path\.overlap|overlap|permission|denied|handoff|agent\.message/.test(u)}function lb({item:a,showThinking:u=!0,onFileRef:r}){if(a.kind==="reasoning"&&!u)return null;if(nb(a)){const o=c.jsx(P0,{item:a,onFileRef:r});if(o)return o}return a.kind==="tool"?c.jsxs("article",{className:"message tool",children:[c.jsx("div",{className:"message-label",children:a.title||Us(a)}),c.jsx(jp,{item:a,onFileRef:r})]}):c.jsxs("article",{className:`message ${a.kind}`,children:[c.jsx("div",{className:"message-label",children:a.title||a.kind}),c.jsx(Q0,{text:a.text,onFileRef:r})]})}function Vm(a,u,r){return a.kind==="exploration"?c.jsxs("article",{className:"message tool exploration","aria-label":`Exploration ${a.items.length} steps`,children:[c.jsx("div",{className:"message-label",children:"Exploration"}),c.jsx(tb,{items:a.items,onFileRef:r})]}):c.jsx(lb,{item:a.item,showThinking:u,onFileRef:r})}function ab({items:a,showThinking:u=!0,onFileRef:r,scrollRef:o,stickToBottom:d=!1,virtualize:h}){const y=T.useMemo(()=>eb(a),[a]),b=h??y.length>40,v=T.useCallback(z=>z.kind==="exploration"?z.id:z.item.id,[]),g=T.useCallback(z=>Vm(z,u,r),[u,r]);return b?c.jsx(G0,{className:"transcript-list",items:y,itemKey:v,renderItem:g,scrollRef:o,stickToBottom:d,estimateHeight:120,overscan:8,maxMounted:80,"aria-label":"Conversation messages"}):c.jsx("div",{className:"transcript-list",role:"log","aria-label":"Conversation messages","data-virtual-mounted":y.length,"data-virtual-total":y.length,children:y.map(z=>c.jsx("div",{children:Vm(z,u,r)},v(z)))})}const ib=T.memo(ab);var So={};function sb(a,u={}){const r=typeof process<"u"&&!!(So!=null&&So.VITEST),o=u.schedule??(O=>r?(O(),-1):typeof requestAnimationFrame=="function"?requestAnimationFrame(O):setTimeout(O,16)),d=u.cancel??(O=>{O<0||(typeof cancelAnimationFrame=="function"?cancelAnimationFrame(O):clearTimeout(O))});let h=[],y,b=!1;const v=()=>{if(b=!1,y=void 0,!h.length)return;const O=h;h=[],a(O)};return{push:O=>{h.push(O),!b&&(b=!0,y=o(v))},flush:()=>{if(y!==void 0&&(d(y),y=void 0),b=!1,!h.length)return;const O=h;h=[],a(O)},clear:()=>{y!==void 0&&(d(y),y=void 0),b=!1,h=[]},pending:()=>h.length}}const ub=["shared","tools","provider","config_system","persona","phase","plan","lean_code","environment","instruction","project_memory","decision_ledger"];function cb({modeLabel:a,surfaces:u,activeId:r,profile:o,onChange:d,panelIdPrefix:h="inspector-panel"}){return u.length?o==="phone"?c.jsx("nav",{className:"surface-nav-sheet","aria-label":`${a} surfaces`,children:c.jsx("ul",{className:"surface-nav-list",role:"listbox","aria-label":`${a} surfaces`,children:u.map(y=>{const b=y.id===r;return c.jsx("li",{role:"option","aria-selected":b,children:c.jsx("button",{type:"button",className:b?"surface-nav-item active":"surface-nav-item","aria-current":b?"page":void 0,onClick:()=>d(y.id),children:c.jsx("span",{className:"surface-nav-label",children:y.label})})},y.id)})})}):c.jsx(Zg,{className:"inspector-tabs",label:`${a} surfaces`,value:r,items:u.map(y=>({id:y.id,label:y.label})),onChange:d,panelIdPrefix:h}):null}function xa(a){return(a||"").trim()}function Tp(a){const u=a.startsWith("?")||a.startsWith("#")?a.slice(1):a;return new URLSearchParams(u)}function Uo(a){const u=Tp(a),r=xa(u.get("root")),o=xa(u.get("session")),d=xa(u.get("mode")).toLowerCase(),h=d!=="",y=ko(d)?d:"chat";return{raw:{root:r,session:o,mode:y,surface:xa(u.get("surface")),entity:xa(u.get("entity")),path:xa(u.get("path")),pane:xa(u.get("pane")),agent:xa(u.get("agent"))},modePresent:h,modeRaw:d,workspaceID:r||o}}function rb(a,u=""){const r=Tp(u);r.delete("token");const o=(d,h,y)=>{y||!h?r.delete(d):r.set(d,h)};if("root"in a&&o("root",a.root||""),"session"in a&&o("session",a.session||""),"mode"in a){const d=a.mode||"";o("mode",d,!d||d==="chat")}return"surface"in a&&o("surface",a.surface||""),"entity"in a&&o("entity",a.entity||""),"path"in a&&o("path",a.path||""),"pane"in a&&o("pane",a.pane||""),"agent"in a&&o("agent",a.agent||""),r.toString()}function Va(a){try{const u=rb(a,location.search),r=`${location.pathname}${u?`?${u}`:""}${location.hash||""}`,o=`${location.pathname}${location.search}${location.hash||""}`;r!==o&&history.replaceState(null,"",r)}catch{}}function ob(a,u,r){const o=Uo(a),{raw:d,modePresent:h,modeRaw:y}=o;let b;h&&(b=ko(y)?y:"chat");const v=Yv({mode:b,surface:d.surface,path:d.path,pane:d.pane,agent:d.agent,caps:u,attachOnly:r==null?void 0:r.attachOnly,isLive:r==null?void 0:r.isLive});return{workspaceID:o.workspaceID,mode:v.mode,surface:v.surface,entity:d.entity,path:d.path,pane:d.pane,agent:d.agent,openDrawer:v.openDrawer,unavailable:v.unavailable}}function fb(a=typeof location<"u"?location.search:""){return Uo(a).workspaceID}const Zm={phoneMax:599,tabletMax:1023};function jo(a){return!Number.isFinite(a)||a<=0?"desktop":a<=Zm.phoneMax?"phone":a<=Zm.tabletMax?"tablet":"desktop"}function db(a){return a==="phone"}const hb=T.lazy(()=>en(()=>import("./Team-DUnnZtWp.js"),[]).then(a=>({default:a.TeamWorkspace}))),mb=T.lazy(()=>en(()=>import("./CodeExplorer-CTkRy4Rl.js"),[]).then(a=>({default:a.CodeExplorer}))),pb=T.lazy(()=>en(()=>import("./ArtifactsReview-B65rCcbV.js"),[]).then(a=>({default:a.ArtifactsPanel}))),yb=T.lazy(()=>en(()=>import("./ArtifactsReview-B65rCcbV.js"),[]).then(a=>({default:a.LedgerPanel}))),gb=T.lazy(()=>en(()=>import("./ArtifactsReview-B65rCcbV.js"),[]).then(a=>({default:a.TeamReviewPanel}))),vb=T.lazy(()=>en(()=>import("./MCP-CoXRwoSS.js"),[]).then(a=>({default:a.MCPPanel}))),bb=T.lazy(()=>en(()=>import("./Plugins-CJ0dCX91.js"),__vite__mapDeps([0,1,2])).then(a=>({default:a.PluginsPanel}))),Jm=T.lazy(()=>en(()=>import("./Panes-CWuiX4Ys.js"),__vite__mapDeps([3,2,1])).then(a=>({default:a.PanesPanel}))),xb=T.lazy(()=>en(()=>import("./Timeline-BA5GlsNC.js"),[]).then(a=>({default:a.TimelinePanel}))),Sb=T.lazy(()=>en(()=>import("./Diagnostics-C72nldsD.js"),[]).then(a=>({default:a.DiagnosticsPanel}))),jb=T.lazy(()=>en(()=>import("./Plans-CQoFK1S6.js"),[]).then(a=>({default:a.PlansPanel}))),Tb=T.lazy(()=>en(()=>import("./Goals-0kpFGULK.js"),[]).then(a=>({default:a.GoalsPanel}))),Eb=T.lazy(()=>en(()=>import("./Workflows-BFSMWcFc.js"),[]).then(a=>({default:a.WorkflowsPanel})));function Ab({label:a}){return c.jsx("section",{className:"unavailable",role:"status",children:c.jsxs("strong",{children:["Loading ",a,"…"]})})}const ic={effort:["low","medium","high","xhigh"],autonomy:["supervised","agent","checks","skip-all"],permission:["default","plan","soft-approve","accept-edits","yolo"],sandbox:["off","read-only","workspace-write"]},Ep="strike.web.showThinking",Cb=()=>{try{const a=sessionStorage.getItem(Ep);return a===null?!0:a==="1"||a==="true"}catch{return!0}},Nb=a=>{try{sessionStorage.setItem(Ep,a?"1":"0")}catch{}};function Ap(a){return a.contextUsed!==void 0&&a.contextLimit!==void 0?`${a.contextUsed.toLocaleString()} / ${a.contextLimit.toLocaleString()}`:a.contextUsed!==void 0?`${a.contextUsed.toLocaleString()} used`:"not reported"}const Ob=rc,xt=(a,u,r)=>Pm(a,u,r).catch(o=>window.alert(o.message)),Ui=a=>a.slice(0,12),zb=2e3,Wm=a=>!!(a.permissionPending||a.questionPending),Db=(a,u)=>{var r;return a.title||((r=u.find(o=>o.id===a.id))==null?void 0:r.title)||Ui(a.id)},Mo=a=>{if(!a)return"";const u=a<1e12?a*1e3:a,r=Math.max(0,Math.floor((Date.now()-u)/1e3));return r<60?"just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:`${Math.floor(r/86400)}d ago`},Mb=()=>{try{return fb(location.search)}catch{return""}};function Ka({label:a,value:u,values:r,disabled:o,onChange:d}){return c.jsxs("label",{className:"runtime-field",children:[c.jsx("span",{children:a}),c.jsxs("select",{"aria-label":a,value:u||"",disabled:o,onChange:h=>d(h.target.value),children:[c.jsx("option",{value:"",children:"—"}),r.map(h=>c.jsx("option",{children:h},h))]})]})}function Cp({title:a,children:u}){const r=T.useRef(null);return T.useEffect(()=>{var o;(o=r.current)==null||o.showModal()},[]),c.jsxs("dialog",{ref:r,"aria-labelledby":"blocking-title",onCancel:o=>o.preventDefault(),children:[c.jsx("div",{className:"dialog-rule"}),c.jsx("h2",{id:"blocking-title",children:a}),u]})}const wb=a=>new Promise((u,r)=>{if(!a.type.startsWith("image/"))return r(new Error(`${a.name}: only image attachments are supported by the engine`));const o=new FileReader;o.onerror=()=>r(new Error(`${a.name}: read failed`)),o.onload=()=>u({name:a.name,mime:a.type,data:String(o.result).split(",")[1]||""}),o.readAsDataURL(a)});function _b(){const[a,u]=T.useState(),[r,o]=T.useState([]),[d,h]=T.useState([]),[y,b]=T.useState(""),[v,g]=T.useState(""),[z,C]=T.useState(!1),[O,$]=T.useState("active"),[Q,le]=T.useState(""),[ye,ee]=T.useReducer(zv,void 0,Ov),B=ye.selectedID,k=Dv(ye),pe=k.draft,W=k.queue,me=k.images,P=k.fast,[J,se]=T.useState("connecting"),[ue,ie]=T.useState(null),Se=T.useRef(null),Ge=T.useRef(!1),[St,st]=T.useState(null),[U,K]=T.useState("chat"),[I,te]=T.useState("context"),[fe,S]=T.useState(!1),[R,X]=T.useState(""),[V,de]=T.useState(),[ge,Ee]=T.useState(0),ut=T.useRef(!1),[ze,sl]=T.useState(()=>typeof window<"u"?jo(window.innerWidth):"desktop"),[tn,Rt]=T.useState(()=>typeof window<"u"?jo(window.innerWidth)==="desktop":!0),[Hn,Mn]=T.useState(240),[Yn,pn]=T.useState(340),[Li,Gn]=T.useState(),[kl,Lt]=T.useState(!1),[ul,qt]=T.useState(new Set),[wn,gt]=T.useState([]),[Ul,$n]=T.useState([]),[Bt,_n]=T.useState([]),[vt,nn]=T.useState(null),[cl,Xn]=T.useState(!1),[yn,Je]=T.useState([]),[Ht,We]=T.useState(""),[gn,kn]=T.useState(0),[Za,$t]=T.useState(0),[Kn,vn]=T.useState(!1),[bn,Qn]=T.useState(()=>{try{return localStorage.getItem("strike.web.onboard.v1")!=="1"}catch{return!1}}),[xn,Ja]=T.useState(!1),[Sa,Vn]=T.useState(!1),ln=T.useRef(null),Zn=T.useRef(null),rl=T.useRef(null),[ol,ja]=T.useState(Cb),[Jn,Sn]=T.useState(),[$e,fl]=T.useState(),[Xt,Fe]=T.useState(!1),[tt,jt]=T.useState(),Un=T.useRef(null),Rl=T.useRef(null),Dt=T.useRef(!0),[Wn,Kt]=T.useState(!1),[Fn,Yt]=T.useState(0),Mt=T.useRef(0),[Qe,Tt]=T.useState(""),Ie=T.useRef(null),Et=p=>{if(!B)return;const j=typeof p=="function"?p(pe):p;ee({type:"client.composer",id:B,patch:{draft:j}})},Ll=p=>{if(!B)return;const j=typeof p=="function"?p(me):p;ee({type:"client.composer",id:B,patch:{images:j}})},an=p=>{if(!B)return;const j=typeof p=="function"?p(W):p;ee({type:"client.composer",id:B,patch:{queue:j}})},jn=p=>{if(!B)return;const j=typeof p=="function"?p(P):p;ee({type:"client.composer",id:B,patch:{fast:j}})},dl=()=>xm().then(p=>(o(p.sessions||[]),b(p.liveId||""),p)),Qt=()=>jm().then(p=>(h(p.roots||[]),g(p.activeId||""),p)).catch(()=>{});T.useEffect(()=>{bp(Do())},[]),T.useEffect(()=>{const p=()=>{const j=jo(window.innerWidth);sl(L=>(L!==j&&(Rt(j==="desktop"),j!=="desktop"&&S(!1)),j))};return p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[]),T.useEffect(()=>{const p=j=>{if((j.metaKey||j.ctrlKey)&&j.key.toLowerCase()==="k"){j.preventDefault(),rl.current=document.activeElement instanceof HTMLElement?document.activeElement:null,Xn(!0);return}if(j.key==="Escape"&&!document.querySelector("dialog[open]")){if(cl){j.preventDefault(),Xn(!1);return}if(fe){j.preventDefault(),S(!1);return}tn&&ze!=="desktop"&&(j.preventDefault(),Rt(!1))}};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[fe,tn,ze,cl]),T.useEffect(()=>{Promise.all([Mg(),xm(),jm().catch(()=>({roots:[],activeId:""}))]).then(([p,j,L])=>{var Oa,$s,Xs,li,Ks;u(p),se("connected"),o(j.sessions||[]);const Z=!!(p.capabilities.roots&&((Oa=L.roots)!=null&&Oa.length));b(j.liveId||(($s=p.status)==null?void 0:$s.sessionId)||"");const F=Z?L.roots||[]:[];h(F),g(L.activeId||j.liveId||((Xs=p.status)==null?void 0:Xs.sessionId)||"");const Ue=j.sessions||[],Ne=Mb(),_e=new Set(F.map(gl=>gl.id));let et=((li=F[0])==null?void 0:li.id)||(p.capabilities.roots?"":j.liveId)||"",Zt=et||((Ks=Ue[0])==null?void 0:Ks.id)||"",Rn=!!(et&&Zt===et);Ne&&(_e.has(Ne)||!p.capabilities.roots&&Ne===(j.liveId||"")?(Zt=Ne,et=Ne,Rn=!0):Ue.some(gl=>gl.id===Ne)&&(Zt=Ne,Rn=!1)),Zt&&(ee({type:"client.ensure",id:Zt}),p.status&&Rn&&ee({type:"client.event",id:Zt,envelope:{type:"status",data:p.status}})),C(Rn),$(Rn?"active":"history"),Rn&&Ne&&p.capabilities.roots&&!p.attachOnly&&Tm(Ne).then(()=>Qt()).catch(()=>{}),p.capabilities.auth&&oe("/v1/providers").then(gl=>gt(gl.providers.map(Qs=>Qs.Name||Qs.name||"").filter(Boolean))).catch(()=>{}),p.capabilities.history&&oe("/v1/history").then(gl=>_n(gl.entries||[])).catch(()=>{}),p.capabilities.sandbox&&Sm().then(fl).catch(()=>{})}).catch(p=>se(p.message))},[]),T.useEffect(()=>{if(!(a!=null&&a.capabilities.roots)||a.attachOnly)return;const p=()=>{Qt()},j=window.setInterval(p,zb);return()=>window.clearInterval(j)},[a==null?void 0:a.capabilities.roots,a==null?void 0:a.attachOnly]),T.useEffect(()=>{if(!B)return;ee({type:"client.ensure",id:B}),jt(void 0);const p=B,j=sb(F=>{ee({type:"client.events",id:p,envelopes:F})}),L=F=>j.push(F);if(!z){const F=$g(p,L,Ue=>se(Ue));return()=>{j.flush(),j.clear(),F()}}const Z=Gg(p,L,se);return()=>{j.flush(),j.clear(),Z.close()}},[B,z]),T.useEffect(()=>{if(!B||!(a!=null&&a.capabilities.sessions))return;let p=!1;return Xg(B).then(j=>{p||ee({type:"client.event",id:B,envelope:{type:"children.seed",time:`seed:${B}`,data:{sessions:j.sessions||[]}}})}).catch(()=>{}),()=>{p=!0}},[B,a==null?void 0:a.capabilities.sessions]),T.useEffect(()=>{const p=Rl.current;if(!p)return;const j=()=>{const Z=p.scrollHeight-p.scrollTop-p.clientHeight<80;Dt.current=Z,Z&&(Yt(0),Mt.current=k.items.length),Kt(!Z&&k.items.length>0)};return p.addEventListener("scroll",j,{passive:!0}),()=>p.removeEventListener("scroll",j)},[k.items.length]),T.useEffect(()=>{var p;if(!Dt.current){const j=k.items.length-Mt.current;j>0&&Yt(L=>L+j),Kt(k.items.length>0),Mt.current=k.items.length;return}Yt(0),Mt.current=k.items.length,(p=Un.current)==null||p.scrollIntoView({block:"end"}),Kt(!1)},[k.items]),T.useEffect(()=>{const p=[];k.status.busy?p.push("Agent working"):k.items.length&&p.push("Agent idle"),k.permission&&p.push("Permission required"),k.question&&p.push("Question pending");const j=p.join(". "),L=window.setTimeout(()=>Tt(j),400);return()=>window.clearTimeout(L)},[k.status.busy,k.permission,k.question,k.items.length]);const Ta=(p,j)=>{de(void 0),X(p),Va({mode:"code",surface:"files",entity:p}),K("code"),te("files"),S(!0),el("files")},Wa=T.useRef(Ta);Wa.current=Ta;const ql=T.useCallback((p,j)=>{Wa.current(p,j)},[]),hl=()=>{var p;Dt.current=!0,Kt(!1),Yt(0),Mt.current=k.items.length,(p=Un.current)==null||p.scrollIntoView({block:"end",behavior:"smooth"})};T.useEffect(()=>{if(!B||k.status.busy||!W.length||!z)return;const[p,...j]=W;ee({type:"client.composer",id:B,patch:{queue:j}}),xt("user.input",{text:p.text,images:p.images.map(({mime:L,data:Z})=>({mime:L,data:Z}))},B)},[k.status.busy,W,z,B]);const nt=!!(z&&B&&!(a!=null&&a.attachOnly)),Pe=!nt||k.status.busy,Bl=[k.status.effort,k.status.autonomy,k.status.permissionMode,P?"fast":""].filter(Boolean).join(" · "),E=T.useMemo(()=>Object.entries(k.children),[k.children]),G=T.useMemo(()=>Co(U,a==null?void 0:a.capabilities,{attachOnly:a==null?void 0:a.attachOnly,isLive:z,forceIds:V?[V.id]:[]}),[a,U,z,V,ge]),De=T.useMemo(()=>G.map(p=>p.id),[G]),pt=T.useMemo(()=>{var p,j;return{changedFiles:((p=k.changedFiles)==null?void 0:p.length)||0,teamMembers:Math.max(Object.keys(k.children||{}).length,Object.keys(((j=k.team)==null?void 0:j.members)||{}).length),permissionPending:!!k.permission||d.some(L=>L.permissionPending),questionPending:!!k.question||d.some(L=>L.questionPending),fitWarning:!!k.fitWarning}},[k.changedFiles,k.children,k.permission,k.question,k.fitWarning,d]),Vt=De.includes(I)?I:De[0]||"",wt={"--nav-width":ze==="desktop"?tn?`${Hn}px`:"0px":`${Hn}px`,"--inspector-width":ze==="desktop"?fe?`${Yn}px`:"0px":`${Yn}px`},Hl=db(ze),Rs=ze!=="desktop"&&(tn||fe),Ea=fe&&U==="chat";T.useLayoutEffect(()=>{var j;const p=Zn.current;p!=null&&(Zn.current=null,(j=ln.current)==null||j.setSelectionRange(p,p))});const Yl=T.useMemo(()=>$v({skills:a==null?void 0:a.skills,attachOnly:a==null?void 0:a.attachOnly,capabilities:a==null?void 0:a.capabilities}),[a]),In=T.useMemo(()=>{const p=Qv(pe,gn);return p.active?{start:p.start,query:p.query}:null},[pe,gn]),Fa=!!(In&&(a!=null&&a.capabilities.files)),Gl=T.useMemo(()=>{if(Fa)return yn.map(L=>({label:L,detail:"workspace file",insert:L}));const p=km(pe,gn);if(!p)return[];const j=[...Ob,...((a==null?void 0:a.skills)||[]).map(L=>({label:`/${L.name}`,detail:L.description||"Skill",insert:`/${L.name}`}))];return kv(j,p.query)},[pe,a,Fa,yn,gn]),_t=Kn||vt?[]:Gl,qi=Fa&&!Kn&&!vt&&_t.length===0&&Ht!=="",Ls=_t.length>0||qi,$l=Math.min(Za,Math.max(0,_t.length-1)),qs=T.useRef(!1),Bs=T.useRef(null);T.useEffect(()=>{const p=_t.length>0;p&&!qs.current?$t(0):$t(j=>Math.min(j,Math.max(0,_t.length-1))),qs.current=p},[_t.length]),T.useEffect(()=>{var p,j;(j=(p=Bs.current)==null?void 0:p.querySelector('[aria-selected="true"]'))==null||j.scrollIntoView({block:"nearest"})},[$l,_t.length]),T.useEffect(()=>{if(!In||!(a!=null&&a.capabilities.files)){Je([]),We("");return}const p=In.query,j=window.setTimeout(()=>{oe(`/v1/files/search?q=${encodeURIComponent(p)}&limit=12`).then(L=>{const Z=L.paths||[];Je(Z),We(Z.length?"":qm(p))}).catch(()=>{Je([]),We(qm(p,!0))})},120);return()=>window.clearTimeout(j)},[In,a==null?void 0:a.capabilities.files]);const Aa=p=>{!(a!=null&&a.capabilities.history)||!p.trim()||oe("/v1/history",{method:"POST",body:JSON.stringify({prompt:p})}).then(()=>oe("/v1/history")).then(j=>_n(j.entries||[])).catch(()=>{})},Ve=(p,j)=>{B&&ee({type:"client.event",id:B,envelope:{type:"local.system",time:String(Date.now()),data:{title:p,text:j}}})},Xl=()=>{var j;const p=ev(k.items,{sessionId:B||k.status.sessionId,title:(j=r.find(L=>L.id===B))==null?void 0:j.title,provider:k.status.provider,model:k.status.model,agent:k.status.agent});nv(tv(B||k.status.sessionId),p)},Ia=(p,j)=>{var Ue,Ne;const L=p.trim(),Z=((a==null?void 0:a.skills)||[]).map(_e=>_e.name),F=Uv(L,Z);switch(F.kind){case"pass":Aa(L),xt("user.input",{text:L,images:j.map(({mime:_e,data:et})=>({mime:_e,data:et}))},B);return;case"unknown":Ve("Unknown command",`${F.command} is not available in the web cockpit. Type /help for the list.`);return;case"usage":Ve("Usage",F.message);return;case"help":Ve("Help",Um((a==null?void 0:a.skills)||[]));return;case"export":Xl();return;case"queue":(Ue=Se.current)==null||Ue.scrollIntoView({block:"nearest",behavior:"smooth"}),Ve("Queue",W.length?`${W.length} prompt(s) queued — reorder, edit, or clear.`:"Queue is empty. Prompts sent while the agent is busy land here.");return;case"cost":Ve("Cost",_m(k.status,Jn));return;case"copy":{const _e=[...k.items].reverse().find(et=>et.kind==="assistant"&&et.text.trim());if(!_e){Ve("Copy","No assistant reply to copy.");return}(Ne=navigator.clipboard)==null||Ne.writeText(_e.text).then(()=>Ve("Copy","Last assistant reply copied to clipboard."),()=>Ve("Copy","Clipboard unavailable in this browser."));return}case"fork":Zl("fork");return;case"rename":{if(F.title){if(!(a!=null&&a.capabilities.sessions)){Ve("Rename","Sessions capability unavailable.");return}oe(`/v1/sessions/${encodeURIComponent(B)}`,{method:"PATCH",body:JSON.stringify({title:F.title})}).then(()=>dl()).catch(_e=>window.alert(_e.message));return}Zl("rename");return}case"fast":{const _e=F.enabled===void 0?!P:F.enabled;jn(_e),xt("set.fast",{enabled:_e},B);return}case"op":{let _e=F.data;if(F.type==="select.model"&&_e&&typeof _e=="object"){const et={..._e};et.provider||(et.provider=k.status.provider),_e=et}if(F.type==="rewind"){const et=!!(_e&&typeof _e=="object"&&_e.restoreFiles);st({preferFiles:et});return}xt(F.type,_e,B);return}}},Kl=k.undoStack.at(-1)||ov(),Ql=p=>{st(null),xt("rewind",p?{restoreFiles:!0}:{},B)},Hs=p=>{p.preventDefault();const j=pe.trim();!j||!nt||(k.status.busy?(Aa(j),an(L=>[...L,{text:j,images:me}])):Ia(j,me),nn(null),Et(""),Ll([]),Je([]),We(""),kn(0))},Pa=p=>{var et;if(vn(!0),In){const Zt=((et=ln.current)==null?void 0:et.selectionStart)??gn,Rn=Zv(pe,In.start,Zt,p.insert),Oa=Jv(In.start,p.insert,Rn);Zn.current=Oa,Et(Rn),kn(Oa),Je([]),We("");return}const j=km(pe,gn),L=(j==null?void 0:j.start)??0,Z=j?pe.slice(j.end):"",F=p.insert.replace(/\s+$/,""),Ue=/^\s/.test(Z)?"":" ",Ne=`${pe.slice(0,L)}${F}${Ue}${Z}`,_e=L+F.length+Ue.length;Zn.current=_e,Et(Ne),kn(_e)},Ys=p=>{var L;const j=p.action;if(p.requiresLive&&(!nt||a!=null&&a.attachOnly)){Ve("Unavailable",a!=null&&a.attachOnly?"Attach-only: this action requires a live workspace.":"Not available without a live session.");return}if(p.requiresCapability&&a&&!a.capabilities[p.requiresCapability]){Ve("Unavailable",`${p.requiresCapability} capability is not available on this host.`);return}switch(j.type){case"mode":Vl(j.mode,{openDrawer:j.mode!=="chat"});return;case"surface":Vl(j.mode,{openDrawer:!0,surface:j.surface});return;case"slash":j.run?Ia(j.insert.trim(),[]):(Et(j.insert),(L=ln.current)==null||L.focus());return;case"session":j.action==="export"?Xl():j.action==="help"?Ve("Help",Um((a==null?void 0:a.skills)||[])):j.action==="settings"?Vn(!0):j.action==="cost"?Ve("Cost",_m(k.status)):j.action==="fork"?Zl("fork"):j.action==="interrupt"&&xt("interrupt");return;case"notice":Ve(j.title,j.body);return}},Ca=p=>{var Z;const j=p.currentTarget;if(Ls){const F=p.key==="ArrowDown"||p.ctrlKey&&!p.metaKey&&!p.altKey&&p.key.toLowerCase()==="n",Ue=p.key==="ArrowUp";if(F||Ue){p.preventDefault(),_t.length>0&&$t(Ne=>F?Math.min(_t.length-1,Ne+1):Math.max(0,Ne-1));return}if(p.key==="Enter"&&!p.shiftKey||p.key==="Tab"&&!p.shiftKey){p.preventDefault();const Ne=_t[$l]||_t[0];Ne&&Pa(Ne);return}if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),vn(!0);return}}if(p.key==="Enter"&&!p.shiftKey){p.preventDefault(),(Z=j.form)==null||Z.requestSubmit();return}const L=j.selectionStart===0&&j.selectionEnd===0;if((p.key==="ArrowUp"||p.key==="ArrowDown")&&Bt.length&&(vt||pe===""&&L)){if(p.preventDefault(),p.key==="ArrowUp")if(!vt)nn({index:Bt.length-1,draft:pe}),Et(Bt[Bt.length-1]||"");else{const F=Math.max(0,vt.index-1);nn({...vt,index:F}),Et(Bt[F]||"")}else if(vt)if(vt.index>=Bt.length-1)Et(vt.draft),nn(null);else{const F=vt.index+1;nn({...vt,index:F}),Et(Bt[F]||"")}return}},sn=p=>{kn(p.selectionStart??p.value.length)},Bi=(p,j)=>{vt&&nn(null),vn(!1),$t(0),Et(p),kn(j)},ml=async p=>{if(p)try{const j=await Promise.all([...p].map(wb));Ll(L=>[...L,...j])}catch(j){window.alert(j.message)}},Pn=async p=>{xt("select.model",{provider:p},B),a!=null&&a.capabilities.catalog&&oe(`/v1/models?provider=${encodeURIComponent(p)}`).then(j=>{const L=j.models||[];$n(L.map(Ue=>String(Ue.ID||Ue.id||"")).filter(Boolean));const Z=k.status.model,F=L.find(Ue=>String(Ue.ID||Ue.id||"")===Z)||L[0];Sn(F?{inputPerM:Number(F.InputCost??F.inputCost??0),outputPerM:Number(F.OutputCost??F.outputCost??0),hasCost:!!(F.HasCost??F.hasCost),context:Number(F.Context??F.context??0)||void 0}:void 0)}).catch(()=>{$n([]),Sn(void 0)})};T.useEffect(()=>{!(a!=null&&a.capabilities.catalog)||!k.status.provider||oe(`/v1/models?provider=${encodeURIComponent(k.status.provider)}`).then(p=>{const j=p.models||[];$n(j.map(Z=>String(Z.ID||Z.id||"")).filter(Boolean));const L=j.find(Z=>String(Z.ID||Z.id||"")===k.status.model);L&&Sn({inputPerM:Number(L.InputCost??L.inputCost??0),outputPerM:Number(L.OutputCost??L.outputCost??0),hasCost:!!(L.HasCost??L.hasCost),context:Number(L.Context??L.context??0)||void 0})}).catch(()=>{})},[a==null?void 0:a.capabilities.catalog,k.status.provider,k.status.model]);const el=async(p,j)=>{te(p);const L=ks(p),Z=(()=>{if(!(!L||!a)&&!(L.capability==="always"||L.capability==="team"||L.capability==="live"||L.capability==="sessions")){if(L.capability==="lsp"&&!a.capabilities.lsp)return{id:p,reason:"capability lsp unavailable"};if(typeof L.capability=="string"&&L.capability!=="lsp"&&!a.capabilities[L.capability])return{id:p,reason:`capability ${L.capability} unavailable`}}})();de(Z),(j==null?void 0:j.open)!==!1&&S(!0),Lt(!0),Gn(void 0);try{if(Z)return;Gn(p==="files"?a!=null&&a.capabilities.files?await oe(`/v1/changed-files${B?`?root=${encodeURIComponent(B)}`:""}`).catch(F=>({error:F.message})):void 0:p==="memory"?a!=null&&a.capabilities.memory?await oe("/v1/memory").catch(F=>({error:F.message})):void 0:p==="issues"&&a!=null&&a.capabilities.issues?await oe("/v1/issues").catch(F=>({error:F.message})):void 0)}finally{Lt(!1)}},Vl=(p,j)=>{if(K(p),(j==null?void 0:j.entity)!==void 0&&X(j.entity),p==="chat"&&!(j!=null&&j.surface)){(j==null?void 0:j.openDrawer)===!1||(j==null||j.openDrawer),Va({mode:"chat",surface:"",entity:(j==null?void 0:j.entity)||""});return}const L=(j==null?void 0:j.surface)||No(p,a==null?void 0:a.capabilities,{attachOnly:a==null?void 0:a.attachOnly,isLive:z});L&&el(L,{open:(j==null?void 0:j.openDrawer)!==!1}),Va({mode:p,surface:L||"",entity:(j==null?void 0:j.entity)||R})};T.useEffect(()=>{if(!a)return;if(!a.capabilities.panes){go(),Ee(j=>j+1);return}let p=!1;return en(async()=>{const{listPanes:j}=await import("./panesApi-Gdyy8rqS.js");return{listPanes:j}},[]).then(({listPanes:j})=>j()).then(j=>{if(!p){go();for(const L of j.panes||[]){const Z=Lv(L);Z&&Rv(Z)}Ee(L=>L+1)}}).catch(()=>{p||Ee(j=>j+1)}),()=>{p=!0,go()}},[a]),T.useEffect(()=>{var L;if(!a||ut.current||Uo(location.search).raw.surface.startsWith("pane:")&&ge===0)return;ut.current=!0;const j=ob(location.search,a.capabilities,{attachOnly:a.attachOnly,isLive:z||!!a.capabilities.live});if(K(j.mode),j.entity&&X(j.entity),j.agent&&jt(j.agent),j.unavailable&&de(j.unavailable),j.surface)el(j.surface,{open:j.openDrawer});else{const Z=Co("chat",a.capabilities,{attachOnly:a.attachOnly});if(Z.length){const F=((L=Z.find(Ue=>Ue.id==="files"))==null?void 0:L.id)||Z[0].id;el(F,{open:!1})}}},[a,ge]);const Zl=async p=>{var L;if(!(a!=null&&a.capabilities.sessions)||!B)return;const j=B;try{if(p==="fork"){await oe(`/v1/sessions/${encodeURIComponent(j)}/fork`,{method:"POST"}),await Promise.all([dl(),Qt()]);return}if(p==="rename"){const Z=window.prompt("Session title");if(Z===null)return;await oe(`/v1/sessions/${encodeURIComponent(j)}`,{method:"PATCH",body:JSON.stringify({title:Z})})}if(p==="delete"){if(!window.confirm("Delete this durable session?"))return;await oe(`/v1/sessions/${encodeURIComponent(j)}`,{method:"DELETE"}),ee({type:"client.drop",id:j});const Z=await dl();await Qt();const F=((L=((Z==null?void 0:Z.sessions)||[]).find(Ue=>Ue.id!==j))==null?void 0:L.id)||"";if(F){ee({type:"client.ensure",id:F});const Ue=!!(Z!=null&&Z.liveId&&F===Z.liveId||d.some(Ne=>Ne.id===F));C(Ue),$(Ue?"active":"history")}return}await Promise.all([dl(),Qt()])}catch(Z){window.alert(Z.message)}},ei=async()=>{if(!(!(a!=null&&a.capabilities.roots)||a.attachOnly))try{const p=await Ug();await Qt(),ee({type:"client.ensure",id:p.id}),C(!0),$("active")}catch(p){window.alert(p.message)}},ti=async p=>{if(!(!(a!=null&&a.capabilities.roots)||a.attachOnly))try{const j=await Rg(p);await Qt(),ee({type:"client.ensure",id:j.id}),C(!0),$("active")}catch(j){window.alert(j.message)}},pl=async(p,j)=>{if(ee({type:"client.ensure",id:p}),C(j),Sn(void 0),X(""),jt(void 0),!(!j||!(a!=null&&a.capabilities.roots)||a.attachOnly))try{if(await Tm(p),await Qt(),a!=null&&a.capabilities.team){const L=await wg(p).catch(()=>null);L&&ee({type:"client.event",id:p,envelope:{type:"team.snapshot",time:`snap:${p}`,data:L}})}}catch(L){window.alert(L.message)}},kt=async()=>{var L,Z,F,Ue;if(!(a!=null&&a.capabilities.roots)||a.attachOnly||!z||!B)return;const p=d.find(Ne=>Ne.id===B),j=p!=null&&p.busy?"This workspace is busy. Close/stop it anyway?":"Close this workspace?";if(window.confirm(j))try{await Lg(B);const[Ne,_e]=await Promise.all([Qt(),dl()]),et=(Ne==null?void 0:Ne.activeId)||((Z=(L=Ne==null?void 0:Ne.roots)==null?void 0:L[0])==null?void 0:Z.id)||"";if(et)ee({type:"client.ensure",id:et}),C(!0),$("active");else{const Zt=((Ue=(F=_e==null?void 0:_e.sessions)==null?void 0:F[0])==null?void 0:Ue.id)||"";Zt&&ee({type:"client.ensure",id:Zt}),C(!1),$("history")}}catch(Ne){window.alert(Ne.message)}},tl=p=>{if(!(a!=null&&a.capabilities.roots)){if(!r.length)return;const j=Math.max(0,r.findIndex(Z=>Z.id===B)),L=r[(j+p+r.length)%r.length];L&&(ee({type:"client.ensure",id:L.id}),C(L.id===y&&!(a!=null&&a.attachOnly)));return}if(O==="active"&&d.length){const j=Math.max(0,d.findIndex(Z=>Z.id===B&&z)),L=d[(j+p+d.length)%d.length];L&&pl(L.id,!0);return}if(r.length){const j=Math.max(0,r.findIndex(Z=>Z.id===B)),L=r[(j+p+r.length)%r.length];if(L){const Z=d.some(F=>F.id===L.id);pl(L.id,Z)}}},Jl=p=>{jt(void 0),pl(p,!1),$("history")},Na=async p=>{if(!(a!=null&&a.capabilities.sandbox)||!($e!=null&&$e.canChangeDefault))return;const j=String(k.status.permissionMode||$e.permissionMode||"");let L=!1;if(p==="off"&&j==="yolo"){if(L=window.confirm("permissionMode is yolo and sandbox off disables OS isolation. Continue only if you understand the risk (equivalent to --i-know)."),!L)return}else if(p!==($e.defaultMode||k.status.sandbox)&&!window.confirm(`Save sandbox default "${p}" for new sessions? Active session stays "${k.status.sandbox||$e.mode||"workspace-write"}".`))return;try{const Z=await _g(p,L,B||void 0);fl(Z),window.alert(`Sandbox default saved as ${Z.defaultMode||p}. Active session mode is unchanged until a new session starts.`)}catch(Z){window.alert(Z.message)}},Gs=async()=>{if(a!=null&&a.capabilities.sandbox)try{const p=await Sm(B||void 0);fl(p),Fe(!0)}catch(p){window.alert(p.message)}},Hi=p=>qt(j=>{const L=new Set(j);return L.has(p)?L.delete(p):L.add(p),L}),ni=d.filter(p=>Wm(p)&&!(p.id===B&&z)),yl=ni.length,Wl=yl>0?`${yl} need${yl===1?"s":""} you`:"",Yi=p=>c.jsx("nav",{className:p,"aria-label":"Workspace mode",children:_o.map(j=>{const L=ki[j],Z=Hv(j,pt),F=U===j;return c.jsxs("button",{type:"button",className:F?"mode-btn active":"mode-btn","aria-pressed":F,"aria-current":F?"page":void 0,"aria-label":`${L.label}: ${L.description}${Z==="needs-you"?", needs attention":Z==="badge"?", activity":""}`,onClick:()=>{Hl&&Rt(!1),Vl(j,{openDrawer:j!=="chat"})},children:[c.jsx("span",{children:L.label}),Z!=="none"&&c.jsx("span",{className:Z==="needs-you"?"mode-attn needs-you":"mode-attn","aria-hidden":!0})]},j)})});return c.jsxs("div",{className:"app-shell",style:wt,"data-shell":ze,children:[c.jsxs("header",{children:[c.jsx("button",{className:"icon-button","aria-label":"Toggle agents panel","aria-pressed":tn,onClick:()=>{S(!1),Rt(p=>!p)},children:"☰"}),c.jsxs("div",{className:"wordmark",children:[c.jsx("span",{className:"mark",children:"S"}),c.jsx("strong",{children:"STRIKE"}),c.jsx("small",{children:"workspace"})]}),c.jsxs("button",{type:"button",className:"palette-trigger","aria-label":"Open command palette",onClick:()=>{rl.current=document.activeElement instanceof HTMLElement?document.activeElement:null,Xn(!0)},children:["Commands ",c.jsx("kbd",{children:"⌘K"})]}),!Hl&&Yi("mode-switch header-mode-switch"),c.jsxs("div",{className:"session-line","aria-live":"polite",children:[c.jsx("span",{className:k.status.busy?"pulse busy":"pulse"}),!Hl&&(k.status.busy?"agent working":J),Wl&&c.jsx("button",{type:"button",className:"attention-summary","aria-label":Wl,onClick:()=>{const p=ni[0];p&&pl(p.id,!0)},children:Wl})]}),c.jsx("button",{className:"icon-button","aria-label":"Export markdown",title:"Export markdown",onClick:()=>Xl(),children:"↓"}),c.jsx("button",{className:"icon-button","aria-label":"Open settings",onClick:()=>Vn(!0),children:"⚙"}),c.jsx("button",{className:"icon-button","aria-label":"Toggle inspector","aria-pressed":fe,onClick:()=>{ze!=="desktop"&&Rt(!1),S(p=>!p)},children:"◫"})]}),Rs&&c.jsx("button",{type:"button",className:"shell-backdrop visible","aria-label":"Close panel",onClick:()=>{Rt(!1),S(!1)}}),c.jsxs("aside",{className:`navigation ${tn?"open":"collapsed"}`,"aria-label":"Agents panel",tabIndex:0,onKeyDown:p=>{p.target instanceof HTMLInputElement||p.target instanceof HTMLTextAreaElement||((p.key==="ArrowDown"||p.key==="j")&&(p.preventDefault(),tl(1)),(p.key==="ArrowUp"||p.key==="k")&&(p.preventDefault(),tl(-1)))},children:[c.jsx(Fm,{label:"Resize agents panel",value:Hn,min:180,max:420,onChange:Mn,side:"nav"}),a!=null&&a.capabilities.roots?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"aside-heading",children:[c.jsx("button",{className:`nav-tab ${O==="active"?"active":""}`,onClick:()=>$("active"),children:"ACTIVE"}),c.jsx("button",{className:`nav-tab ${O==="history"?"active":""}`,onClick:()=>$("history"),children:"HISTORY"})]}),O==="active"&&c.jsxs(c.Fragment,{children:[c.jsx("nav",{children:d.map(p=>{const j=Db(p,r),L=Mo(p.activeAt),Z=Wm(p);return c.jsxs("button",{type:"button",className:p.id===B&&z?"session active":"session",onClick:()=>void pl(p.id,!0),title:p.id,"aria-label":`${j}${Z?", needs attention":""}`,children:[c.jsx("span",{className:Z?"root-attention":p.busy?"root-busy":"root-idle","aria-hidden":!0}),c.jsxs("span",{className:"session-main",children:[c.jsx("span",{className:"session-title",children:j}),c.jsxs("span",{className:"session-meta",children:[p.agent||"—",L?` · ${L}`:"",p.hasRecentEvent&&!p.busy&&!Z?" · recent":""]})]}),c.jsxs("span",{className:"session-flags",children:[p.id===v&&c.jsx("small",{children:"ACTIVE"}),Z?c.jsx("small",{className:"needs-you",children:"NEEDS YOU"}):c.jsx("small",{children:p.busy?"BUSY":"IDLE"})]})]},p.id)})}),!(a!=null&&a.attachOnly)&&c.jsxs("div",{className:"session-actions",children:[c.jsx("button",{type:"button",onClick:()=>void ei(),children:"+ New workspace"}),c.jsx("button",{type:"button",disabled:!z||!B,onClick:()=>void kt(),children:"Close workspace"})]})]}),O==="history"&&c.jsx(qb,{sessions:r,activeRoots:d,selectedID:B,selectedIsLive:z,historySearch:Q,setHistorySearch:le,selectWorkspace:pl,handleResume:ti,boot:a,sessionAction:Zl})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"aside-heading",children:c.jsx("span",{children:"SESSIONS"})}),c.jsx("nav",{children:r.map(p=>{const j=p.id===y&&!(a!=null&&a.attachOnly),L=Mo(p.mtime);return c.jsxs("button",{type:"button",className:p.id===B?"session active history-row":"session history-row",onClick:()=>{ee({type:"client.ensure",id:p.id}),C(j)},title:p.id,children:[c.jsxs("span",{className:"session-main",children:[c.jsx("span",{className:"session-title",children:p.title||Ui(p.id)}),c.jsx("span",{className:"session-meta",children:[Ui(p.id),L].filter(Boolean).join(" · ")})]}),c.jsx("span",{className:"session-flags",children:j&&c.jsx("small",{className:"live-badge",children:"LIVE"})})]},p.id)})}),(a==null?void 0:a.capabilities.sessions)&&B&&c.jsx("div",{className:"session-actions","aria-label":"Session actions",children:c.jsx(Np,{onAction:p=>void Zl(p)})})]}),!Ea&&c.jsx(op,{children:E,selectedId:tt,onSelect:jt,onOpenTranscript:Jl}),c.jsxs("details",{className:"workspace-meta",children:[c.jsx("summary",{children:"Workspace"}),c.jsx("span",{children:"ROOT"}),c.jsx("code",{children:k.status.cwd||"unavailable"}),c.jsx("span",{children:"BUILD"}),c.jsx("code",{children:(a==null?void 0:a.version)||"…"})]})]}),c.jsxs("main",{children:[c.jsxs("div",{className:"runtime-stack",children:[c.jsxs("section",{className:"runtime","aria-label":"Runtime controls",children:[c.jsx(Ka,{label:"Provider",value:k.status.provider,values:wn.length?wn:k.status.provider?[k.status.provider]:[],disabled:Pe||!(a!=null&&a.capabilities.auth),onChange:p=>void Pn(p)}),c.jsx(Ka,{label:"Model",value:k.status.model,values:Ul.length?Ul:k.status.model?[k.status.model]:[],disabled:Pe||!(a!=null&&a.capabilities.catalog),onChange:p=>void xt("select.model",{provider:k.status.provider,model:p},B)}),c.jsx(Ka,{label:"Agent",value:k.status.agent,values:((a==null?void 0:a.agents)||[]).map(p=>p.name),disabled:Pe,onChange:p=>void xt("select.agent",{name:p},B)}),c.jsxs("div",{className:"runtime-more",children:[c.jsxs("button",{type:"button",className:"runtime-disclosure","aria-expanded":xn,"aria-controls":"runtime-secondary",onClick:()=>Ja(p=>!p),children:[c.jsx("span",{children:"Runtime…"}),!xn&&Bl&&c.jsx("span",{className:"runtime-summary",children:Bl})]}),xn&&c.jsxs("div",{id:"runtime-secondary",className:"runtime-secondary",role:"group","aria-label":"Secondary runtime controls",children:[c.jsx(Ka,{label:"Effort",value:k.status.effort,values:ic.effort,disabled:Pe,onChange:p=>void xt("set.effort",{level:p},B)}),c.jsx(Ka,{label:"Autonomy",value:k.status.autonomy,values:ic.autonomy,disabled:Pe,onChange:p=>void xt("set.autonomy",{mode:p},B)}),c.jsx(Ka,{label:"Permission",value:k.status.permissionMode,values:ic.permission,disabled:Pe,onChange:p=>void xt("set.permission_mode",{mode:p},B)}),(a==null?void 0:a.capabilities.sandbox)&&c.jsx(Ka,{label:"Sandbox",value:k.status.sandbox||($e==null?void 0:$e.mode),values:($e==null?void 0:$e.modes)||ic.sandbox,disabled:!nt||k.status.busy||!($e!=null&&$e.canChangeDefault),onChange:p=>void Na(p)}),(a==null?void 0:a.capabilities.sandbox)&&c.jsx("button",{type:"button",className:"runtime-explain",onClick:()=>void Gs(),children:"Explain"}),c.jsxs("label",{className:"fast-toggle",children:[c.jsx("input",{type:"checkbox",checked:P,disabled:Pe,onChange:p=>{jn(p.target.checked),xt("set.fast",{enabled:p.target.checked},B)}}),"FAST"]}),c.jsxs("label",{className:"fast-toggle",children:[c.jsx("input",{type:"checkbox","aria-label":"Show thinking",checked:ol,onChange:p=>{const j=p.target.checked;ja(j),Nb(j)}}),"THINK"]})]})]})]}),c.jsx(Bb,{status:k.status,modelRates:Jn})]}),c.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:Qe}),c.jsxs("section",{ref:Rl,className:"transcript","aria-label":"Conversation transcript",children:[!a&&J!=="connecting"?c.jsxs("div",{className:"empty-state",role:"alert",children:[c.jsx("span",{children:"ERROR"}),c.jsx("h1",{children:J}),c.jsxs("p",{children:["Failed to load cockpit. Open the URL printed by ",c.jsx("code",{children:"strike serve"})," (one-time ",c.jsx("code",{children:"?token="})," handoff sets a cookie), or send ",c.jsx("code",{children:"Authorization: Bearer"}),"."]})]}):!k.items.length&&c.jsxs("div",{className:"empty-state",children:[c.jsx("span",{children:"01 / READY"}),c.jsx("h1",{children:a!=null&&a.attachOnly?"Inspect the record.":"Direct the work."}),c.jsx("p",{children:a!=null&&a.attachOnly?"Select a durable session from the rail.":"Describe an outcome. Strike will plan, act, and report through the live engine seam."})]}),c.jsx(ib,{items:k.items,showThinking:ol,onFileRef:ql,scrollRef:Rl,stickToBottom:Dt.current}),c.jsx("div",{ref:Un}),Wn&&c.jsx("button",{type:"button",className:"jump-latest",onClick:hl,children:Fn>0?`${Fn} new — jump to latest`:"New activity — jump to latest"})]}),bn&&c.jsxs("div",{className:"onboard-hint",role:"status",children:[c.jsxs("p",{children:["Tip: ",c.jsx("kbd",{children:"⌘K"})," command palette · ",c.jsx("code",{children:"/"})," slash commands · ",c.jsx("code",{children:"@"})," mention files"]}),c.jsx("button",{type:"button",onClick:()=>{try{localStorage.setItem("strike.web.onboard.v1","1")}catch{}Qn(!1)},children:"Dismiss"})]}),c.jsxs("form",{className:"composer",onSubmit:Hs,children:[c.jsxs("label",{htmlFor:"prompt",children:["Instruction ",k.status.busy&&"— send to queue"]}),c.jsxs("div",{className:"composer-field",children:[(_t.length>0||qi)&&c.jsx("div",{ref:Bs,className:"completion",role:"listbox","aria-label":"Composer completions",children:_t.length===0?c.jsx("div",{children:Ht}):_t.map((p,j)=>c.jsxs("button",{type:"button",role:"option","aria-selected":j===$l,className:j===$l?"active":"",onMouseEnter:()=>$t(j),onClick:()=>Pa(p),children:[c.jsx("strong",{children:p.label}),c.jsx("span",{children:p.detail})]},p.label))}),c.jsx("textarea",{ref:ln,"aria-label":"Instruction",id:"prompt",value:pe,disabled:!nt,placeholder:nt?"Describe the next outcome… / command · @file":"Historical session — read only",onPaste:p=>void ml(p.clipboardData.files),onDrop:p=>{p.preventDefault(),ml(p.dataTransfer.files)},onDragOver:p=>p.preventDefault(),onChange:p=>Bi(p.currentTarget.value,p.currentTarget.selectionStart??p.currentTarget.value.length),onSelect:p=>sn(p.currentTarget),onKeyUp:p=>sn(p.currentTarget),onClick:p=>sn(p.currentTarget),onKeyDown:Ca})]}),me.length>0&&c.jsx("div",{className:"attachments",children:me.map((p,j)=>c.jsxs("button",{type:"button",onClick:()=>Ll(L=>L.filter((Z,F)=>F!==j)),children:[p.name," ×"]},`${p.name}-${j}`))}),!Ea&&c.jsx(fp,{queue:W,queueEdit:ue,setQueueEdit:ie,queueEditCancel:Ge,queueRef:Se,setQueue:an}),c.jsxs("div",{className:"composer-bar",children:[c.jsxs("span",{children:[c.jsx("kbd",{children:"↵"})," send · ",c.jsx("kbd",{children:"⇧↵"})," newline · ",c.jsx("kbd",{children:"↑"})," history"]}),c.jsxs("span",{children:[c.jsx("input",{ref:Ie,hidden:!0,type:"file",accept:"image/*",multiple:!0,onChange:p=>void ml(p.target.files)}),c.jsx("button",{type:"button",className:"composer-secondary",onClick:()=>{var p;return(p=Ie.current)==null?void 0:p.click()},children:"Attach"}),Bt.length>0&&c.jsx("button",{type:"button",className:"composer-secondary",onClick:()=>Et(Bt.at(-1)||""),children:"History"}),c.jsx("button",{type:"button",className:"composer-secondary",onClick:()=>Xl(),disabled:!k.items.length,children:"Export"}),k.status.busy&&c.jsx("button",{type:"button",className:"stop",onClick:()=>void xt("interrupt"),children:"Interrupt"}),c.jsx("button",{type:"submit",className:"composer-send",disabled:!pe.trim()||!nt,children:k.status.busy?"Queue":"Send"})]})]})]}),c.jsx(Wv,{open:cl,commands:Yl,onClose:()=>{Xn(!1);const p=rl.current;if(p&&document.contains(p))try{p.focus()}catch{}},onRun:Ys})]}),c.jsxs("aside",{className:`inspector ${fe?"open":"collapsed"}`,"aria-label":"Inspector",children:[c.jsx(Fm,{label:"Resize inspector panel",value:Yn,min:240,max:520,onChange:pn,side:"inspector"}),Ea&&c.jsx(rv,{contextLabel:Ap(k.status),provider:k.status.provider,model:k.status.model,phase:k.status.phase,fitWarning:k.fitWarning,childrenEntries:E,selectedChildId:tt,onSelectChild:jt,onOpenChildTranscript:Jl,queue:W,queueEdit:ue,setQueueEdit:ie,queueEditCancel:Ge,queueRef:Se,setQueue:an}),c.jsx(cb,{modeLabel:ki[U].label,surfaces:G,activeId:Vt,profile:ze,onChange:p=>{de(void 0),Va({mode:U,surface:p,entity:R}),el(p)}}),c.jsx("div",{className:"inspector-body",id:Vt?`inspector-panel-${Vt}`:void 0,role:"tabpanel",children:De.length?c.jsx(T.Suspense,{fallback:c.jsx(Ab,{label:Vt||"surface"}),children:c.jsx(Kb,{tab:Vt,boot:a,workspace:k,data:Li,loading:kl,expandedDiffs:ul,toggleDiff:Hi,isLive:nt,selectedID:B,onRefresh:()=>void el(Vt),sandbox:$e,onExplainSandbox:()=>void Gs(),unavailable:(V==null?void 0:V.id)===Vt?V:void 0,childrenEntries:E,selectedChildId:tt,onSelectChild:jt,onOpenChildTranscript:Jl,entity:R,onOpenSettings:()=>Vn(!0)})}):c.jsxs("p",{className:"muted",children:["No surfaces available for ",ki[U].label," on this host."]})})]}),Sa&&c.jsx(L0,{boot:a,status:k.status,providers:wn,rootID:B,isLive:nt,onClose:()=>Vn(!1)}),Xt&&$e&&c.jsx(Rb,{info:$e,status:k.status,onClose:()=>Fe(!1)}),St&&c.jsx(Jb,{preview:Kl,preferFiles:St.preferFiles,onCancel:()=>st(null),onConfirm:Ql}),k.permission&&c.jsx(Lb,{permission:k.permission,rootID:B,canExplain:!!(a!=null&&a.capabilities.permissions)}),k.question&&c.jsx(Zb,{question:k.question,rootID:B}),Hl&&Yi("mode-bottom-bar")]})}function kb(a){return String(a.permission||a.tool||a.name||"tool")}function Ub(a){const u=a.patterns;return Array.isArray(u)?u.map(r=>String(r)).filter(Boolean):typeof u=="string"&&u.trim()?[u]:[]}function Rb({info:a,status:u,onClose:r}){const o=T.useRef(null);T.useEffect(()=>{var h;(h=o.current)==null||h.showModal()},[]);const d=u.networkAllow||a.networkAllow||[];return c.jsxs("dialog",{ref:o,className:"sandbox-explain-dialog","aria-labelledby":"sandbox-explain-title",onClose:r,children:[c.jsx("div",{className:"dialog-rule"}),c.jsx("h2",{id:"sandbox-explain-title",children:"Sandbox explain"}),c.jsxs("dl",{className:"sandbox-summary",children:[c.jsx("dt",{children:"Active mode"}),c.jsx("dd",{children:u.sandbox||a.mode}),c.jsx("dt",{children:"Default mode"}),c.jsx("dd",{children:a.defaultMode||"—"}),c.jsx("dt",{children:"Backend"}),c.jsx("dd",{children:u.sandboxBackend||a.backend||(a.available?"available":"unavailable")}),c.jsx("dt",{children:"Network allow"}),c.jsx("dd",{children:d.length?d.join(", "):"(none — unrestricted public)"}),c.jsx("dt",{children:"Permission mode"}),c.jsx("dd",{children:u.permissionMode||a.permissionMode||"—"})]}),c.jsx("pre",{className:"sandbox-explain",children:a.explain||"No profile text."}),a.note&&c.jsx("p",{className:"muted",children:a.note}),c.jsx("div",{className:"dialog-actions",children:c.jsx("button",{autoFocus:!0,onClick:r,children:"Close"})})]})}function Lb({permission:a,rootID:u,canExplain:r}){const o=kb(a),d=Ub(a),h=d[0]||"*",[y,b]=T.useState(null),[v,g]=T.useState(""),[z,C]=T.useState(!1),O=ee=>void xt("permission.reply",{requestId:a.requestId,decision:ee},u),$=async()=>{if(!(!r||z)){C(!0),g("");try{const ee=new URLSearchParams({permission:o,pattern:h});b(await oe(`/v1/permissions/explain?${ee}`))}catch(ee){g(ee.message),b(null)}finally{C(!1)}}},Q=(y==null?void 0:y.Summary)||(y==null?void 0:y.summary)||"",le=(y==null?void 0:y.Action)||(y==null?void 0:y.action)||"",ye=(y==null?void 0:y.Layer)||(y==null?void 0:y.layer)||"";return c.jsxs(Cp,{title:"Permission required",children:[c.jsx("p",{className:"permission-tool",children:c.jsx("strong",{children:o})}),d.length>0?c.jsx("ul",{className:"permission-patterns","aria-label":"Permission patterns",children:d.map(ee=>c.jsx("li",{children:c.jsx("code",{children:ee})},ee))}):c.jsx("p",{className:"muted",children:"No pattern detail provided for this request."}),r&&c.jsxs("div",{className:"permission-explain",children:[c.jsx("button",{type:"button",onClick:()=>void $(),disabled:z,children:z?"Explaining…":"Why is this asked?"}),v&&c.jsx("p",{className:"permission-explain-error",role:"status",children:v}),Q&&c.jsxs("pre",{className:"permission-explain-body","aria-label":"Permission explanation",children:[Q,(le||ye)&&`
-
-Effective: ${le||"unknown"}${ye?` (${ye})`:""}`]})]}),c.jsxs("div",{className:"dialog-actions",children:[c.jsx("button",{type:"button",onClick:()=>O("reject"),children:"Reject"}),c.jsx("button",{type:"button",onClick:()=>O("project"),children:"Allow for project"}),c.jsx("button",{type:"button",onClick:()=>O("always"),children:"Allow session"}),c.jsx("button",{type:"button",autoFocus:!0,onClick:()=>O("once"),children:"Allow once"})]})]})}function Fm({label:a,value:u,min:r,max:o,onChange:d,side:h}){const y=T.useRef(null),b=O=>Math.min(o,Math.max(r,Math.round(O))),v=O=>{O.preventDefault(),y.current={x:O.clientX,width:u},O.currentTarget.setPointerCapture(O.pointerId)},g=O=>{if(!y.current)return;const $=O.clientX-y.current.x;d(b(h==="nav"?y.current.width+$:y.current.width-$))},z=O=>{y.current=null,O.currentTarget.hasPointerCapture(O.pointerId)&&O.currentTarget.releasePointerCapture(O.pointerId)},C=O=>{const $=O.shiftKey?20:10;O.key==="ArrowLeft"&&(O.preventDefault(),d(b(u-$))),O.key==="ArrowRight"&&(O.preventDefault(),d(b(u+$))),O.key==="Home"&&(O.preventDefault(),d(r)),O.key==="End"&&(O.preventDefault(),d(o))};return c.jsx("div",{className:`panel-resize panel-resize-${h}`,children:c.jsx("div",{className:"panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":a,"aria-valuenow":u,"aria-valuemin":r,"aria-valuemax":o,tabIndex:0,onPointerDown:v,onPointerMove:g,onPointerUp:z,onPointerCancel:z,onKeyDown:C})})}function Np({onAction:a}){return c.jsxs("details",{className:"session-overflow",children:[c.jsx("summary",{children:"Session…"}),c.jsxs("div",{className:"session-overflow-menu",role:"menu",children:[c.jsx("button",{type:"button",role:"menuitem",onClick:()=>a("fork"),children:"Fork"}),c.jsx("button",{type:"button",role:"menuitem",onClick:()=>a("rename"),children:"Rename"}),c.jsx("button",{type:"button",role:"menuitem",onClick:()=>a("delete"),children:"Delete"})]})]})}function qb({sessions:a,activeRoots:u,selectedID:r,selectedIsLive:o,historySearch:d,setHistorySearch:h,selectWorkspace:y,handleResume:b,boot:v,sessionAction:g}){const z=!!(v!=null&&v.capabilities.sessions),C=!!r,O=a.filter($=>{var Q;return!d||((Q=$.title)==null?void 0:Q.toLowerCase().includes(d.toLowerCase()))||$.id.toLowerCase().includes(d.toLowerCase())});return c.jsxs(c.Fragment,{children:[c.jsx("input",{className:"history-search",type:"search",placeholder:"Search sessions…","aria-label":"Search sessions",value:d,onChange:$=>h($.target.value)}),c.jsx("nav",{"aria-label":"Session history",children:O.map($=>{const Q=u.some(B=>B.id===$.id),le=Mo($.mtime),ye=$.forkedFrom?`fork of ${Ui($.forkedFrom)}`:"",ee=[Ui($.id),le,ye].filter(Boolean).join(" · ");return c.jsxs("button",{type:"button",className:$.id===r?"session active history-row":"session history-row",onClick:()=>void y($.id,Q),title:$.id,children:[c.jsxs("span",{className:"session-main",children:[c.jsx("span",{className:"session-title",children:$.title||Ui($.id)}),c.jsx("span",{className:"session-meta",children:ee})]}),c.jsx("span",{className:"session-flags",children:Q&&c.jsx("small",{className:"live-badge",children:"LIVE"})})]},$.id)})}),c.jsxs("div",{className:"session-actions",children:[!o&&!(v!=null&&v.attachOnly)&&c.jsx("button",{type:"button",disabled:!C||!(v!=null&&v.capabilities.roots),onClick:()=>void b(r),children:"Resume as workspace"}),z&&C&&c.jsx(Np,{onAction:$=>void g($)})]})]})}function Bb({status:a,modelRates:u}){const r=a.contextLimit===void 0&&(u!=null&&u.context)?{...a,contextLimit:u.context}:a,o=[];a.agent&&o.push(`Agent ${a.agent}`),a.effort&&o.push(`Effort ${a.effort}`),a.autonomy&&o.push(`Autonomy ${a.autonomy}`),a.permissionMode&&o.push(`Permission ${a.permissionMode}`),a.phase&&o.push(`Phase ${a.phase}`),a.workflow&&o.push(`Workflow ${a.workflow}`),a.cwd&&o.push(`CWD ${a.cwd}`);const d=Ap(r);d!=="not reported"&&o.push(`Context ${d}`);const h=Mv(a,u);return h!=="not reported"&&o.push(`Cost ${h}`),o.length?c.jsx("div",{className:"runtime-status","aria-label":"Session status",children:o.map(y=>c.jsx("span",{children:y},y))}):null}function Hb(a){return a!=null&&a.known?`~${(a.n??0).toLocaleString()}`:"—"}function Yb(a){return a.contextUsed!==void 0&&a.contextLimit!==void 0?`${a.contextUsed.toLocaleString()} / ${a.contextLimit.toLocaleString()}`:a.contextUsed!==void 0?`${a.contextUsed.toLocaleString()} / —`:a.contextLimit!==void 0?`— / ${a.contextLimit.toLocaleString()}`:"not reported"}function Gb({workspace:a,isLive:u,selectedID:r}){const{status:o,attribution:d,layers:h,pinnedKinds:y,excludedKinds:b,shedKinds:v,fitWarning:g,promptScope:z,systemChars:C,messageCount:O}=a,$=(W,me)=>{u&&xt("context.controls",{pinKinds:W,setPin:!0,excludeKinds:me,setExclude:!0},r)},Q=W=>$(Mm(y,W),Pu(b,W)),le=W=>$(Pu(y,W),b),ye=W=>$(Pu(y,W),Mm(b,W)),ee=W=>$(y,Pu(b,W)),B=()=>$([],[]),k=()=>{u&&xt("inspect.prompt",void 0,r)},pe=Array.from(new Set([...ub,...y,...b,...h.map(W=>W.kind)])).filter(Boolean);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"context-doctor-head",children:[c.jsx("h2",{children:"Context doctor"}),c.jsxs("div",{className:"context-doctor-actions",children:[c.jsx("button",{type:"button",disabled:!u,onClick:k,children:"Refresh"}),c.jsx("button",{type:"button",disabled:!u||!y.length&&!b.length,onClick:B,children:"Clear pin/exclude"})]})]}),g&&c.jsx($b,{warning:g}),c.jsxs("dl",{children:[c.jsx("dt",{children:"Provider"}),c.jsx("dd",{children:o.provider||"unknown"}),c.jsx("dt",{children:"Model"}),c.jsx("dd",{children:o.model||"unknown"}),c.jsx("dt",{children:"Phase"}),c.jsx("dd",{children:o.phase||"idle"}),c.jsx("dt",{children:"Workflow"}),c.jsx("dd",{children:o.workflow||"none"}),c.jsx("dt",{children:"Context"}),c.jsx("dd",{children:Yb(o)}),o.usageSource&&c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"Usage source"}),c.jsx("dd",{children:o.usageSource})]}),z&&c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"Prompt scope"}),c.jsx("dd",{children:z==="last"?"last request":"current composition"})]}),C!==void 0&&c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"System chars"}),c.jsx("dd",{children:C.toLocaleString()})]}),O!==void 0&&c.jsxs(c.Fragment,{children:[c.jsx("dt",{children:"History"}),c.jsxs("dd",{children:[O.toLocaleString()," msgs"]})]})]}),c.jsx(Xb,{attribution:d}),(y.length>0||b.length>0||v.length>0)&&c.jsxs("section",{className:"context-sets","aria-label":"Context control sets",children:[c.jsx("h3",{children:"Controls"}),y.length>0&&c.jsxs("p",{children:[c.jsx("strong",{children:"Pinned"})," ",y.join(", ")]}),b.length>0&&c.jsxs("p",{children:[c.jsx("strong",{children:"Excluded"})," ",b.join(", ")]}),v.length>0&&c.jsxs("p",{children:[c.jsx("strong",{children:"Shed"})," ",v.join(", ")]})]}),c.jsxs("section",{className:"context-layers","aria-label":"Prompt layers",children:[c.jsx("h3",{children:"Layers"}),h.length===0?c.jsx("p",{className:"muted",children:u?"No layer breakdown yet. Refresh to inspect the effective prompt.":"No layer breakdown in this session log."}):c.jsxs("table",{className:"context-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:"Kind"}),c.jsx("th",{children:"~tok"}),c.jsx("th",{children:"Chars"}),c.jsx("th",{children:"Source"}),c.jsx("th",{children:"Actions"})]})}),c.jsx("tbody",{children:h.map(W=>{const me=W.pinned||y.includes(W.kind),P=b.includes(W.kind),J=W.estTokens??(W.chars?Math.ceil(W.chars/4):void 0);return c.jsxs("tr",{children:[c.jsxs("td",{children:[c.jsx("code",{children:W.kind}),me?" · pin":"",P?" · excl":""]}),c.jsx("td",{children:J!==void 0?`~${J.toLocaleString()}`:"—"}),c.jsx("td",{children:W.chars!==void 0?W.chars.toLocaleString():"—"}),c.jsx("td",{className:"muted",children:W.source||"—"}),c.jsxs("td",{className:"context-layer-actions",children:[me?c.jsx("button",{type:"button",disabled:!u,onClick:()=>le(W.kind),children:"Unpin"}):c.jsx("button",{type:"button",disabled:!u||P,onClick:()=>Q(W.kind),children:"Pin"}),P?c.jsx("button",{type:"button",disabled:!u,onClick:()=>ee(W.kind),children:"Include"}):c.jsx("button",{type:"button",disabled:!u,onClick:()=>ye(W.kind),children:"Exclude"})]})]},`${W.kind}:${W.source||""}`)})})]})]}),u&&c.jsxs("section",{className:"context-kind-picker","aria-label":"Pin or exclude layer kinds",children:[c.jsx("h3",{children:"Layer kinds"}),c.jsx("p",{className:"muted",children:"Pin retains a kind under fit pressure; exclude omits it from composition."}),c.jsx("div",{className:"context-kind-list",children:pe.map(W=>{const me=y.includes(W),P=b.includes(W);return c.jsxs("div",{className:"context-kind-row",children:[c.jsx("code",{children:W}),c.jsxs("span",{children:[me?c.jsx("button",{type:"button",onClick:()=>le(W),children:"Unpin"}):c.jsx("button",{type:"button",disabled:P,onClick:()=>Q(W),children:"Pin"}),P?c.jsx("button",{type:"button",onClick:()=>ee(W),children:"Include"}):c.jsx("button",{type:"button",onClick:()=>ye(W),children:"Exclude"})]})]},W)})})]})]})}function $b({warning:a}){const u=a.level==="critical"?"critical":"warn";return c.jsxs("div",{className:`context-fit-warning ${u}`,role:"alert","aria-label":"Context fit warning",children:[c.jsx("strong",{children:a.level==="critical"?"Critical fit":"Fit warning"}),c.jsx("p",{children:a.message}),(a.estimatedTokens!==void 0||a.contextLimit!==void 0)&&c.jsxs("small",{children:[a.estimatedTokens!==void 0?`~${a.estimatedTokens.toLocaleString()} tok`:"—"," / ",a.contextLimit!==void 0?a.contextLimit.toLocaleString():"—",a.source?` (${a.source})`:""]})]})}function Xb({attribution:a}){if(!a)return null;const u=[["system",a.system],["tools",a.tools],["messages",a.messages],["tool_results",a.toolResults],["total",a.total]];return c.jsxs("section",{className:"context-attribution","aria-label":"Token breakdown by source",children:[c.jsx("h3",{children:"Tokens by source"}),c.jsxs("table",{className:"context-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:"Source"}),c.jsx("th",{children:"~Tokens"})]})}),c.jsx("tbody",{children:u.map(([r,o])=>c.jsxs("tr",{children:[c.jsx("td",{children:r}),c.jsx("td",{children:Hb(o)})]},r))})]}),c.jsxs("p",{className:"muted",children:["Local ~4 chars/token estimates",a.source?` · source ${a.source}`:"",". Not provider-measured billing."]})]})}function Kb({tab:a,boot:u,workspace:r,data:o,loading:d,expandedDiffs:h,toggleDiff:y,isLive:b,selectedID:v,onRefresh:g,sandbox:z,onExplainSandbox:C,unavailable:O,childrenEntries:$,selectedChildId:Q,onSelectChild:le,onOpenChildTranscript:ye,entity:ee,onOpenSettings:B}){var W,me,P;const k=r.status;if(O){const J=((W=ks(a))==null?void 0:W.label)||a;return c.jsxs("section",{className:"unavailable",role:"status",children:[c.jsxs("strong",{children:[J," unavailable"]}),c.jsxs("p",{children:[O.reason,". The surface was opened from a deep link or explicit navigation; no action was attempted."]})]})}if(a==="roster")return c.jsx(hb,{team:r.team,selectedId:Q||ee,onSelect:le||(()=>{}),onOpenTranscript:ye,readOnly:!b||!!(u!=null&&u.attachOnly),compact:typeof window<"u"&&window.innerWidth<720,protocolOps:u==null?void 0:u.protocolOps,teamControl:(me=u==null?void 0:u.capabilities)==null?void 0:me.teamControl,agents:((u==null?void 0:u.agents)||[]).map(J=>J.name),rootSessionId:v,sendOp:b&&!(u!=null&&u.attachOnly)?(J,se)=>Pm(J,se,v):void 0});if(a==="artifacts")return c.jsx(pb,{available:!!(u!=null&&u.capabilities.artifacts),rootID:v,entity:ee,onOpenFile:J=>{Va({mode:"code",surface:"files",entity:J,root:v||void 0})}});if(a==="ledger")return c.jsx(yb,{available:!!(u!=null&&u.capabilities.ledger),rootID:v});if(a==="review")return c.jsx(gb,{team:r.team,onSelectAgent:le,onOpenFile:J=>{Va({mode:"code",surface:"files",entity:J,root:v||void 0})}});if(a==="context")return c.jsx(Gb,{workspace:r,isLive:b,selectedID:v});if(a==="workflows")return c.jsx(Eb,{available:!!(u!=null&&u.capabilities.workflows),draftsAvailable:!!(u!=null&&u.capabilities.workflowDrafts),live:b,rootID:v,activeWorkflow:k.workflow,agents:((u==null?void 0:u.agents)||[]).map(J=>J.name),busy:!!k.busy});if(a==="goals")return c.jsx(Tb,{available:!!(u!=null&&u.capabilities.goals),live:b});if(a==="plans")return c.jsx(jb,{available:!!(u!=null&&u.capabilities.plans),live:b,rootID:v});if(a==="mcp")return c.jsx(vb,{available:!!(u!=null&&u.capabilities.mcp)});if(a==="plugins")return c.jsx(bb,{available:!!(u!=null&&u.capabilities.plugins),live:b&&!(u!=null&&u.attachOnly),panesAvailable:!!(u!=null&&u.capabilities.panes),rootID:v});if(a==="panes")return c.jsx(Jm,{available:!!(u!=null&&u.capabilities.panes),readOnly:!b||!!(u!=null&&u.attachOnly)});if(a==="timeline")return c.jsx(xb,{available:!!(u!=null&&u.capabilities.timeline),sessionID:v});if(a==="diagnostics")return c.jsx(Sb,{available:!!(u!=null&&u.capabilities.lsp)});if(a==="settings"||a==="theme"||a==="providers"||a==="auth")return c.jsxs("section",{className:"ops-settings-hint","aria-label":"Settings",children:[c.jsx("h2",{children:a==="theme"?"Theme":a==="providers"||a==="auth"?"Providers & auth":"Settings"}),c.jsx("p",{className:"muted",children:a==="theme"?"Theme catalog and appearance live in the settings dialog.":a==="providers"||a==="auth"?"Provider authentication and API keys live in the settings dialog.":"Workspace defaults, sandbox, and support tools live in the settings dialog."}),c.jsx("p",{className:"muted",children:"Use the header gear or open the dialog from this surface. Inspector tabs stay in the drawer."}),B&&c.jsx("button",{type:"button",onClick:B,children:"Open settings dialog"})]});if(a==="permissions")return c.jsxs("section",{"aria-label":"Permissions",children:[c.jsx("h2",{children:"Permissions"}),c.jsx("p",{className:"muted",children:"Explain and presets are available from permission asks and host APIs. Browse presets via the live permission dialog when the engine requests approval."}),!(u!=null&&u.capabilities.permissions)&&c.jsx(cc,{name:"Permissions"})]});if(a==="sandbox")return c.jsxs("section",{"aria-label":"Sandbox",children:[c.jsx("h2",{children:"Sandbox"}),z?c.jsxs("dl",{className:"sandbox-summary",children:[c.jsx("dt",{children:"Active"}),c.jsx("dd",{children:z.mode}),c.jsx("dt",{children:"Default"}),c.jsx("dd",{children:z.defaultMode||"—"}),c.jsx("dt",{children:"Backend"}),c.jsx("dd",{children:z.backend||(z.available?"available":"unavailable")})]}):c.jsx("p",{className:"muted",children:"No sandbox snapshot loaded."}),C&&c.jsx("button",{type:"button",onClick:()=>C(),children:"Explain sandbox"}),!(u!=null&&u.capabilities.sandbox)&&c.jsx(cc,{name:"Sandbox"})]});if(a==="diag-export")return c.jsxs("section",{"aria-label":"Diagnostics export",children:[c.jsx("h2",{children:"Diagnostics export"}),c.jsxs("p",{className:"muted",children:["Redacted prompt/config bundle (same scrubbing as TUI ",c.jsx("code",{children:"/diag"}),")."]}),c.jsx("button",{type:"button",disabled:!(u!=null&&u.capabilities.diag&&b),onClick:()=>void ep(v).catch(J=>window.alert(J.message)),children:"Download diagnostics"}),!(u!=null&&u.capabilities.diag)&&c.jsx("p",{className:"muted",children:"Unavailable without a live engine."})]});if(a==="project-export")return c.jsxs("section",{"aria-label":"Project exports",children:[c.jsx("h2",{children:"Project exports"}),c.jsx("p",{className:"muted",children:"Portable memory and issues exports (TUI parity)."}),c.jsxs("div",{className:"panel-actions",children:[c.jsx("button",{type:"button",disabled:!(u!=null&&u.capabilities.memory),onClick:()=>void np().catch(J=>window.alert(J.message)),children:"Export memory"}),c.jsx("button",{type:"button",disabled:!(u!=null&&u.capabilities.issues),onClick:()=>void lp().catch(J=>window.alert(J.message)),children:"Export issues"})]}),c.jsx("p",{className:"muted",children:Gv})]});if(a.startsWith("pane:")){const J=a.slice(5);return c.jsx(Jm,{available:!!(u!=null&&u.capabilities.panes),focusId:J,readOnly:!b||!!(u!=null&&u.attachOnly)})}if(d)return c.jsx("section",{className:"unavailable",role:"status",children:c.jsxs("strong",{children:["Loading ",a]})});if(a==="files"){const J=(o==null?void 0:o.files)||[],se=o==null?void 0:o.error;return c.jsx(mb,{available:!!(u!=null&&u.capabilities.files),rootID:v,entity:ee,readOnly:!!(u!=null&&u.attachOnly)||!b,canApply:!!(u!=null&&u.capabilities.fileApply)&&b&&!(u!=null&&u.attachOnly),changedFiles:se?[]:J,expandedDiffs:h,toggleDiff:y,onOpenPath:(ue,ie)=>{Va({mode:"code",surface:"files",entity:ie?`${ue}:${ie}`:ue,root:v||void 0})}})}if(a==="memory")return c.jsx(Qb,{boot:u,data:o,onRefresh:g||(()=>{})});if(a==="issues")return c.jsx(Vb,{boot:u,data:o,onRefresh:g||(()=>{})});const pe=((P=ks(a))==null?void 0:P.label)||a||"surface";return c.jsxs("section",{className:"unavailable",role:"status",children:[c.jsx("strong",{children:pe}),c.jsx("p",{children:"This surface is registered but has no mount in this build yet."})]})}function Qb({boot:a,data:u,onRefresh:r}){const o=!!(a!=null&&a.capabilities.memory&&!a.attachOnly),[d,h]=T.useState(""),[y,b]=T.useState(""),[v,g]=T.useState(""),[z,C]=T.useState(!1),[O,$]=T.useState(null);if(!(a!=null&&a.capabilities.memory))return c.jsx(cc,{name:"Memory"});if(u!=null&&u.error)return c.jsx(Op,{error:u.error});const Q=(u==null?void 0:u.entries)||[],le=async B=>{C(!0);try{await B(),r()}catch(k){window.alert(k.message)}finally{C(!1)}},ye=B=>{const k=B.Key||B.key||"";$(k),h(k),b(B.Value||B.value||""),g((B.Tags||B.tags||[]).join(", "))},ee=()=>{const B=d.trim();if(!B)return window.alert("Key is required");const k=v.split(",").map(pe=>pe.trim()).filter(Boolean);le(async()=>{await qg(B,y,k),h(""),b(""),g(""),$(null)})};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"panel-heading",children:[c.jsx("h2",{children:"Memory"}),c.jsx("div",{className:"panel-actions",children:c.jsx("button",{type:"button",disabled:z,"aria-label":"Export memory",onClick:()=>void le(()=>np()),children:"Export"})})]}),o&&c.jsxs("form",{className:"project-form","aria-label":O?"Edit memory entry":"Add memory entry",onSubmit:B=>{B.preventDefault(),ee()},children:[c.jsxs("label",{children:["Key",c.jsx("input",{"aria-label":"Memory key",value:d,disabled:z||!!O,onChange:B=>h(B.target.value),placeholder:"convention"})]}),c.jsxs("label",{children:["Value",c.jsx("textarea",{"aria-label":"Memory value",value:y,disabled:z,onChange:B=>b(B.target.value),placeholder:"Prefer table-driven tests",rows:3})]}),c.jsxs("label",{children:["Tags",c.jsx("input",{"aria-label":"Memory tags",value:v,disabled:z,onChange:B=>g(B.target.value),placeholder:"project, style"})]}),c.jsxs("div",{className:"panel-actions",children:[O&&c.jsx("button",{type:"button",disabled:z,onClick:()=>{$(null),h(""),b(""),g("")},children:"Cancel"}),c.jsx("button",{type:"submit",disabled:z,children:O?"Save":"Add"})]})]}),!o&&c.jsx("p",{className:"muted",children:"Attach-only mode is read-only. Export remains available."}),Q.length?c.jsx("div",{className:"project-list",children:Q.map(B=>{const k=B.Key||B.key||"",pe=B.Value||B.value||"",W=B.Tags||B.tags||[];return c.jsxs("article",{children:[c.jsx("h3",{children:k}),c.jsx("p",{children:pe}),W.length>0&&c.jsx("small",{children:W.join(", ")}),o&&c.jsxs("div",{className:"panel-actions",children:[c.jsx("button",{type:"button",disabled:z,onClick:()=>ye(B),children:"Edit"}),c.jsx("button",{type:"button",disabled:z,onClick:()=>{window.confirm(`Delete memory key “${k}”?`)&&le(()=>Bg(k))},children:"Delete"})]})]},k)})}):c.jsx("p",{className:"muted",children:"No project memory entries."})]})}function Vb({boot:a,data:u,onRefresh:r}){const o=!!(a!=null&&a.capabilities.issues&&!a.attachOnly),[d,h]=T.useState(""),[y,b]=T.useState(""),[v,g]=T.useState(!1);if(!(a!=null&&a.capabilities.issues))return c.jsx(cc,{name:"Issues"});if(u!=null&&u.error)return c.jsx(Op,{error:u.error});const z=(u==null?void 0:u.issues)||[],C=async O=>{g(!0);try{await O(),r()}catch($){window.alert($.message)}finally{g(!1)}};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"panel-heading",children:[c.jsx("h2",{children:"Issues"}),c.jsx("div",{className:"panel-actions",children:c.jsx("button",{type:"button",disabled:v,"aria-label":"Export issues",onClick:()=>void C(()=>lp()),children:"Export"})})]}),o&&c.jsxs("form",{className:"project-form","aria-label":"Add issue",onSubmit:O=>{O.preventDefault();const $=d.trim();if(!$)return window.alert("Title is required");C(async()=>{await Hg($,y),h(""),b("")})},children:[c.jsxs("label",{children:["Title",c.jsx("input",{"aria-label":"Issue title",value:d,disabled:v,onChange:O=>h(O.target.value),placeholder:"Fix inspector resize"})]}),c.jsxs("label",{children:["Body",c.jsx("textarea",{"aria-label":"Issue body",value:y,disabled:v,onChange:O=>b(O.target.value),placeholder:"Optional details",rows:3})]}),c.jsx("div",{className:"panel-actions",children:c.jsx("button",{type:"submit",disabled:v,children:"Add"})})]}),!o&&c.jsx("p",{className:"muted",children:"Attach-only mode is read-only. Export remains available."}),z.length?c.jsx("div",{className:"project-list",children:z.map(O=>{const $=O.ID??O.id??0,Q=O.Title||O.title||"Untitled issue",le=O.Body||O.body||"",ye=O.Status||O.status||"open";return c.jsxs("article",{children:[c.jsxs("h3",{children:["#",$," ",Q]}),c.jsx("small",{children:ye}),le&&c.jsx("p",{children:le}),o&&ye==="open"&&c.jsx("div",{className:"panel-actions",children:c.jsx("button",{type:"button",disabled:v,onClick:()=>void C(()=>Yg($)),children:"Close"})})]},$)})}):c.jsx("p",{className:"muted",children:"No project issues."})]})}function cc({name:a}){return c.jsxs("section",{className:"unavailable",role:"status",children:[c.jsxs("strong",{children:[a," unavailable"]}),c.jsx("p",{children:"The configured host did not provide this capability. No action was attempted."})]})}function Op({error:a}){return c.jsxs("section",{className:"unavailable",role:"status",children:[c.jsx("strong",{children:"Unable to load"}),c.jsx("p",{children:a})]})}function Zb({question:a,rootID:u}){const[r,o]=T.useState([]),d=Array.isArray(a.questions)?a.questions:[{question:a.question}],h=(y,b)=>o(v=>{const g=[...v];return g[y]=b,g});return c.jsxs(Cp,{title:String(a.title||"Agent question"),children:[d.map((y,b)=>{const v=Array.isArray(y.options)?y.options:[];return c.jsxs("fieldset",{children:[c.jsx("legend",{children:String(y.question||"A response is required to continue.")}),v.length?v.map(g=>c.jsxs("label",{children:[c.jsx("input",{type:"radio",name:`question-${b}`,value:String(g.label),checked:r[b]===String(g.label),onChange:z=>h(b,z.target.value)}),String(g.label),c.jsx("span",{children:String(g.description||"")})]},String(g.label))):c.jsx("textarea",{"aria-label":`Answer ${b+1}`,value:r[b]||"",onChange:g=>h(b,g.target.value)})]},b)}),c.jsx("div",{className:"dialog-actions",children:c.jsx("button",{autoFocus:!0,onClick:()=>void xt("question.reply",{requestId:a.requestId,answers:r},u),children:"Continue"})})]})}function Jb({preview:a,preferFiles:u,onCancel:r,onConfirm:o}){const d=T.useRef(null),[h,y]=T.useState(()=>mv(a,u));T.useEffect(()=>{const g=d.current;if(g)if(typeof g.showModal=="function"&&!g.open)try{g.showModal()}catch{g.setAttribute("open","")}else g.open||g.setAttribute("open","")},[]);const b=dv(a),v=[{id:"chat",label:"chat only",detail:"drop the last turn from history; keep disk changes",value:!1},{id:"files",label:"chat and files",detail:hv(a),value:!0}];return c.jsxs("dialog",{ref:d,className:"undo-dialog","aria-labelledby":"undo-title",onClose:r,onCancel:g=>{g.preventDefault(),r()},children:[c.jsx("div",{className:"dialog-rule"}),c.jsx("h2",{id:"undo-title",children:"Undo last turn"}),b.length>0&&c.jsx("div",{className:"undo-preview",role:"region","aria-label":"Undo preview",children:b.map((g,z)=>c.jsx("p",{className:g.tone==="warn"?"undo-warn":void 0,children:g.text},z))}),c.jsx("div",{className:"undo-choices",role:"radiogroup","aria-label":"Undo mode",children:v.map(g=>c.jsxs("label",{className:h===g.value?"undo-choice active":"undo-choice",children:[c.jsx("input",{type:"radio",name:"undo-mode",value:g.id,checked:h===g.value,onChange:()=>y(g.value)}),c.jsxs("span",{children:[c.jsx("strong",{children:g.label}),c.jsx("small",{children:g.detail})]})]},g.id))}),c.jsxs("div",{className:"dialog-actions",children:[c.jsx("button",{type:"button",onClick:r,children:"Cancel"}),c.jsx("button",{type:"button",autoFocus:!0,onClick:()=>o(h),children:"Confirm undo"})]})]})}Og.createRoot(document.getElementById("root")).render(c.jsx(xg.StrictMode,{children:c.jsx(_b,{})}));export{fo as C,Ig as L,kg as O,Jg as S,Wg as a,oe as b,Em as c,c as j,T as r,up as s};
diff --git a/internal/frontend/server/static/assets/index-BNtm5XHu.css b/internal/frontend/server/static/assets/index-BNtm5XHu.css
new file mode 100644
index 00000000..21053e0c
--- /dev/null
+++ b/internal/frontend/server/static/assets/index-BNtm5XHu.css
@@ -0,0 +1 @@
+:root{color-scheme:dark light;--ink: #f3f1fa;--muted: #9b99b0;--acid: #7c3aed;--accent-alt: #22d3ee;--highlight: #ddd6fe;--success: #4ade80;--warning: #fbbf24;--signal: #fb7185;--danger: #fb923c;--ground: #14131c;--surface: #232230;--raised: #2e2c3e;--surface-muted: #1a1924;--rule: #4f4d63;--border-focus: #7c3aed;--border-muted: #2c2a3a;--user: #22d3ee;--tool: #7dd3fc;--diff-add: #4ade80;--diff-del: #fb7185;--overlay: #7c7a90;--code-bg: #1a1924;--mark-ink: #14131c;--header-bg: #14131ce8;--glow: #7c3aed66;--idle: #4f4d63;--cap-border: #4f4d63;--shadow: #00000088;--diff-add-bg: #1a2a22;--diff-del-bg: #2a1a1c;--unavailable-bg: #2a1a1c;--text: var(--ink);--bg: var(--ground);--border: var(--rule);--panel: var(--surface);--accent: var(--acid);--warn: var(--warning);font-family:SFMono-Regular,Cascadia Code,Liberation Mono,monospace;background:var(--ground);color:var(--ink)}:root[data-appearance=dark]{color-scheme:dark;--ink: #f3f1fa;--muted: #9b99b0;--acid: #7c3aed;--accent-alt: #22d3ee;--highlight: #ddd6fe;--success: #4ade80;--warning: #fbbf24;--signal: #fb7185;--danger: #fb923c;--ground: #14131c;--surface: #232230;--raised: #2e2c3e;--surface-muted: #1a1924;--rule: #4f4d63;--border-focus: #7c3aed;--border-muted: #2c2a3a;--user: #22d3ee;--tool: #7dd3fc;--diff-add: #4ade80;--diff-del: #fb7185;--overlay: #7c7a90;--code-bg: #1a1924;--mark-ink: #14131c;--header-bg: #14131ce8;--glow: #7c3aed66;--idle: #4f4d63;--cap-border: #4f4d63;--shadow: #00000088;--diff-add-bg: #1a2a22;--diff-del-bg: #2a1a1c;--unavailable-bg: #2a1a1c}:root[data-appearance=light]{color-scheme:light;--ink: #1a1528;--muted: #5c586e;--acid: #5b21b6;--accent-alt: #0e7490;--highlight: #4c1d95;--success: #15803d;--warning: #b45309;--signal: #e11d48;--danger: #ea580c;--ground: #ffffff;--surface: #f3eef9;--raised: #e9e0f7;--surface-muted: #f8f5fc;--rule: #c4bfd4;--border-focus: #5b21b6;--border-muted: #ddd8ea;--user: #0e7490;--tool: #2563eb;--diff-add: #15803d;--diff-del: #e11d48;--overlay: #a8a3b8;--code-bg: #f8f5fc;--mark-ink: #ffffff;--header-bg: #fffffff0;--glow: #5b21b666;--idle: #c4bfd4;--cap-border: #c4bfd4;--shadow: #1a152833;--diff-add-bg: #e8f5ec;--diff-del-bg: #f8e8e8;--unavailable-bg: #f8e8e8}@media(prefers-color-scheme:light){:root{--ink: #1a1528;--muted: #5c586e;--acid: #5b21b6;--accent-alt: #0e7490;--highlight: #4c1d95;--success: #15803d;--warning: #b45309;--signal: #e11d48;--danger: #ea580c;--ground: #ffffff;--surface: #f3eef9;--raised: #e9e0f7;--surface-muted: #f8f5fc;--rule: #c4bfd4;--border-focus: #5b21b6;--border-muted: #ddd8ea;--user: #0e7490;--tool: #2563eb;--diff-add: #15803d;--diff-del: #e11d48;--overlay: #a8a3b8;--code-bg: #f8f5fc;--mark-ink: #ffffff;--header-bg: #fffffff0;--glow: #5b21b666;--idle: #c4bfd4;--cap-border: #c4bfd4;--shadow: #1a152833;--diff-add-bg: #e8f5ec;--diff-del-bg: #f8e8e8;--unavailable-bg: #f8e8e8}:root[data-appearance=dark]{color-scheme:dark;--ink: #f3f1fa;--muted: #9b99b0;--acid: #7c3aed;--accent-alt: #22d3ee;--highlight: #ddd6fe;--success: #4ade80;--warning: #fbbf24;--signal: #fb7185;--danger: #fb923c;--ground: #14131c;--surface: #232230;--raised: #2e2c3e;--surface-muted: #1a1924;--rule: #4f4d63;--border-focus: #7c3aed;--border-muted: #2c2a3a;--user: #22d3ee;--tool: #7dd3fc;--diff-add: #4ade80;--diff-del: #fb7185;--overlay: #7c7a90;--code-bg: #1a1924;--mark-ink: #14131c;--header-bg: #14131ce8;--glow: #7c3aed66;--idle: #4f4d63;--cap-border: #4f4d63;--shadow: #00000088;--diff-add-bg: #1a2a22;--diff-del-bg: #2a1a1c;--unavailable-bg: #2a1a1c}}:root{--control-pad-y: 7px;--control-pad-x: 12px;--control-min-h: 28px;--touch-min: 44px;--focus-ring: 2px solid var(--acid);--focus-offset: 2px;--radius: 2px;--header-height: 52px;--gutter: 12px;--pane-min: 180px;--mode-bar-height: 56px}*{box-sizing:border-box}body{margin:0;min-width:320px;min-height:100vh;background:var(--ground)}button,select,textarea,input{font:inherit;color:inherit}button,select,input,textarea{border:1px solid var(--rule);background:var(--surface);border-radius:var(--radius)}button{cursor:pointer;min-height:var(--control-min-h)}button:hover:not(:disabled),button:focus-visible{border-color:var(--acid);color:var(--acid)}button:disabled,select:disabled,input:disabled,textarea:disabled{opacity:.45;cursor:not-allowed}:focus-visible{outline:var(--focus-ring);outline-offset:var(--focus-offset)}.ui-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:var(--control-pad-y) var(--control-pad-x);border:1px solid var(--rule);background:var(--surface);color:var(--ink);font-size:11px;line-height:1.2;border-radius:var(--radius)}.ui-btn:hover:not(:disabled),.ui-btn:focus-visible{border-color:var(--border-focus);color:var(--acid)}.ui-btn-primary{background:var(--acid);border-color:var(--acid);color:var(--mark-ink);font-weight:600;text-transform:uppercase;letter-spacing:.04em;font-size:10px}.ui-btn-primary:hover:not(:disabled),.ui-btn-primary:focus-visible{color:var(--mark-ink);filter:brightness(1.05);border-color:var(--border-focus)}.ui-btn-danger{color:var(--danger);border-color:color-mix(in srgb,var(--danger) 45%,var(--rule))}.ui-btn-ghost,.ui-btn-icon{border-color:transparent;background:transparent}.ui-btn-icon,.icon-button{border:0;background:transparent;font-size:18px;padding:8px;min-width:var(--control-min-h);min-height:var(--control-min-h);line-height:1;flex-shrink:0}.ui-btn-sm{padding:4px 8px;font-size:10px;min-height:24px}.ui-btn-touch{min-height:var(--touch-min);min-width:var(--touch-min);padding:10px 14px}.ui-dialog{width:min(560px,calc(100vw - 32px));max-height:min(88vh,900px);overflow:auto;border:1px solid var(--rule);background:var(--surface);padding:28px;color:var(--ink);position:relative;border-radius:var(--radius)}.ui-dialog-wide{width:min(720px,calc(100vw - 24px))}.ui-dialog::backdrop{background:color-mix(in srgb,var(--overlay) 85%,#000)}.ui-dialog-blocking{border-color:var(--warning)}.ui-dialog h2{font-size:30px;margin:0 0 20px}.ui-dialog-body{min-width:0}.settings-dialog,.workflow-dialog,.sandbox-explain-dialog,.undo-dialog{position:relative}.ui-tabs{display:flex;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;border-bottom:1px solid var(--rule);gap:0;scrollbar-width:thin}.ui-tab{flex:0 0 auto;min-width:max-content;white-space:nowrap;border:0;border-bottom:2px solid transparent;background:transparent;padding:10px 12px;text-transform:uppercase;font-size:11px;letter-spacing:.04em;color:var(--muted);border-radius:0;min-height:var(--control-min-h)}.ui-tab[aria-selected=true]{border-bottom-color:var(--acid);color:var(--acid)}.ui-tab:disabled{opacity:.35}.ui-tabpanel{min-width:0}.inspector-tabs{display:flex;flex-wrap:wrap;align-content:flex-start;flex:0 0 auto;width:100%;min-width:0;overflow-x:hidden;overflow-y:auto;max-height:40vh;border-bottom:1px solid var(--rule);scrollbar-width:thin}.inspector-tabs .ui-tab,.inspector-tabs button{flex:0 0 auto;min-width:max-content;white-space:nowrap;border:0;border-bottom:2px solid transparent;background:transparent;padding:10px 12px;text-transform:uppercase;font-size:11px;color:var(--muted)}.inspector-tabs .ui-tab[aria-selected=true],.inspector-tabs button[aria-selected=true]{border-bottom-color:var(--acid);color:var(--acid)}.ui-status{display:inline-flex;align-items:center;gap:6px;font-size:10px;letter-spacing:.04em;text-transform:uppercase;color:var(--muted)}.ui-status-dot,.ui-status-dot-alone{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--idle);flex-shrink:0}.ui-status-idle .ui-status-dot,.ui-status-dot-alone.ui-status-idle{background:var(--success)}.ui-status-busy .ui-status-dot,.ui-status-dot-alone.ui-status-busy{background:var(--accent-alt)}.ui-status-blocked .ui-status-dot,.ui-status-dot-alone.ui-status-blocked,.ui-status-needs-you .ui-status-dot,.ui-status-dot-alone.ui-status-needs-you{background:var(--warning)}.ui-status-failed .ui-status-dot,.ui-status-dot-alone.ui-status-failed{background:var(--signal)}.ui-status-complete .ui-status-dot,.ui-status-dot-alone.ui-status-complete{background:var(--success)}.ui-status-canceled .ui-status-dot,.ui-status-unknown .ui-status-dot,.ui-status-dot-alone.ui-status-canceled,.ui-status-dot-alone.ui-status-unknown{background:var(--muted)}.ui-status-label{color:inherit}.ui-status-idle{color:var(--success)}.ui-status-busy{color:var(--accent-alt)}.ui-status-blocked,.ui-status-needs-you{color:var(--warning)}.ui-status-failed{color:var(--signal)}.ui-status-complete{color:var(--success)}.ui-notice{border-left:3px solid var(--acid);padding:12px;background:var(--surface-muted);display:grid;gap:6px}.ui-notice-title{font-size:12px}.ui-notice-body{color:var(--muted);font-size:11px;line-height:1.5}.ui-notice-body p{margin:0}.ui-notice-success{border-left-color:var(--success)}.ui-notice-warning{border-left-color:var(--warning)}.ui-notice-error{border-left-color:var(--signal);background:var(--unavailable-bg)}.ui-notice-unavailable,.unavailable{border-left:3px solid var(--signal);padding:12px;background:var(--unavailable-bg)}.ui-notice-unavailable strong,.unavailable strong{color:var(--signal)}.ui-loading-indicator{display:inline-block;width:10px;height:10px;border-radius:50%;background:var(--accent-alt);animation:pulse 1.2s infinite}.ui-list-row,.palette-list button,.completion button{width:100%;display:flex;align-items:baseline;gap:8px;text-align:left;border:0;padding:6px 10px;background:transparent;font-size:12px;font-weight:inherit;color:inherit;cursor:pointer;border-radius:0;text-transform:none}.ui-list-row:hover,.ui-list-row.active,.ui-list-row[aria-selected=true],.palette-list button:hover,.palette-list button.active,.palette-list button[aria-selected=true],.completion button:hover,.completion button.active,.completion button[aria-selected=true]{background:var(--raised);box-shadow:inset 2px 0 0 var(--acid);color:var(--highlight)}.ui-list-row-main{flex:1;min-width:0;display:flex;flex-direction:row;align-items:baseline;gap:8px;overflow:hidden}.ui-list-row-title,.completion button strong{flex:0 1 auto;min-width:0;font-weight:inherit;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-list-row-meta,.completion span{flex:1 1 auto;min-width:0;font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-list-row-trailing{display:flex;flex-direction:column;align-items:flex-end;gap:2px;flex-shrink:0}@media(max-width:720px){:root{--control-min-h: var(--touch-min);--control-pad-y: 10px;--control-pad-x: 14px}.ui-btn:not(.ui-btn-sm):not(.ui-btn-icon):not(.icon-button){min-height:var(--touch-min)}.ui-tab{min-height:40px;padding:12px;font-size:12px}}.app-shell{display:grid;grid-template:var(--header-height) minmax(0,1fr) / minmax(0,var(--nav-width, 240px)) minmax(0,1fr) minmax(0,var(--inspector-width, 340px));height:100vh;height:100dvh;max-width:100vw;overflow:hidden;padding-left:env(safe-area-inset-left,0px);padding-right:env(safe-area-inset-right,0px)}.app-shell[data-shell=phone]{grid-template:auto minmax(0,1fr) auto / minmax(0,1fr);padding-bottom:env(safe-area-inset-bottom,0px)}.app-shell[data-shell=tablet]{grid-template-columns:minmax(0,1fr);grid-template-rows:var(--header-height) minmax(0,1fr)}header{grid-column:1 / -1;z-index:10;display:flex;align-items:center;gap:var(--gutter);border-bottom:1px solid var(--rule);background:var(--header-bg);padding:0 var(--gutter);padding-top:env(safe-area-inset-top,0px);min-height:calc(var(--header-height) + env(safe-area-inset-top,0px));min-width:0;z-index:4;position:sticky;top:0}.app-shell>header{overflow:hidden}.wordmark{display:flex;align-items:baseline;gap:9px;flex:0 1 202px;min-width:0;overflow:hidden;letter-spacing:.1em}.wordmark strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wordmark .mark{display:grid;place-items:center;width:27px;height:27px;background:var(--acid);color:var(--mark-ink);font-weight:700;transform:skew(-7deg)}.wordmark small{color:var(--muted);font-size:9px}.session-line{margin-left:auto;text-transform:uppercase;font-size:10px;color:var(--muted);flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-line-busy{color:var(--accent-alt)}.session-line-needs-you{color:var(--warning)}.session-line-failed{color:var(--signal)}.mode-switch{display:flex;align-items:stretch;gap:0;margin-left:var(--gutter);padding:0;border:1px solid var(--rule);border-radius:var(--radius);background:var(--surface-muted);flex:0 1 auto;flex-shrink:1;min-width:0;overflow:auto}.mode-btn{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;border-right:1px solid var(--rule);background:transparent;color:var(--muted);font-size:10px;letter-spacing:.06em;text-transform:uppercase;padding:6px 10px;min-height:32px;border-radius:0;display:inline-flex;align-items:center;gap:6px;white-space:nowrap;cursor:pointer}.mode-btn:last-child{border-right:0}.mode-btn:hover,.mode-btn:focus-visible{color:var(--ink);outline:none;background:var(--surface)}.mode-btn.active{background:var(--acid);color:var(--mark-ink);font-weight:600}.mode-attn{width:6px;height:6px;border-radius:50%;background:var(--accent-alt);flex-shrink:0}.mode-attn.needs-you{background:var(--warning)}.surface-roster h2{font-size:12px;text-transform:uppercase;letter-spacing:.08em;margin:0 0 12px;color:var(--muted)}.pulse{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--success);margin-right:8px}.pulse.idle{background:var(--success)}.pulse.busy{background:var(--accent-alt);animation:pulse 1.2s infinite}.pulse.needs-you{background:var(--warning)}.pulse.failed{background:var(--signal)}.navigation,.inspector{min-height:0;min-width:0;background:var(--surface);transition:width .16s ease,opacity .16s ease}.navigation{border-right:1px solid var(--rule);min-width:0;overflow:hidden;padding:18px var(--gutter);display:flex;flex-direction:column;gap:var(--gutter)}.aside-heading{display:flex;justify-content:space-between;font-size:10px;letter-spacing:.16em;color:var(--muted);padding:7px 8px}.session{width:100%;display:flex;align-items:center;gap:6px;text-align:left;border:0;border-left:2px solid transparent;padding:10px 9px;background:transparent;font-size:12px}.session.active{border-left-color:var(--acid);background:var(--raised);color:var(--highlight)}.session small{font-size:8px;color:var(--acid)}.session-flags .session-busy{color:var(--accent-alt)}.session-flags .session-idle{color:var(--success)}.session-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.session-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-meta{font-size:9px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-flags{display:flex;flex-direction:column;align-items:flex-end;gap:2px;flex-shrink:0}.child-agents{display:grid;gap:0;min-height:0}.children{font-size:11px;padding:0 9px;display:grid;gap:2px}.child-row{display:flex;align-items:center;gap:6px;padding:4px 6px;border-radius:var(--radius);border:1px solid transparent;background:transparent;color:inherit;width:100%;text-align:left;cursor:pointer;font:inherit}.child-row:hover,.child-row.active{border-color:transparent;background:var(--raised);box-shadow:inset 2px 0 0 var(--acid);color:var(--highlight)}.child-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.child-meta{display:flex;gap:4px;align-items:center;flex-shrink:0}.children small,.children p{color:var(--muted)}.child-state{width:6px;height:6px;border-radius:50%;background:var(--muted);flex-shrink:0}.child-state.running{background:var(--accent-alt)}.child-state.completed{background:var(--success)}.child-state.failed,.child-state.interrupted{background:var(--signal)}.child-state.blocked,.child-state.finalizing,.child-state.escalating{background:var(--warning)}.child-state.canceled,.child-state.unknown{background:var(--muted)}.quality{font-size:9px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted)}.quality.complete{color:var(--success)}.quality.partial{color:var(--warning)}.quality.unavailable{color:var(--signal)}.child-detail{margin:6px 9px 10px;padding:8px;border:1px solid var(--rule);border-radius:var(--radius);display:grid;gap:6px;font-size:11px}.child-detail header{display:flex;justify-content:space-between;gap:8px;align-items:baseline}.child-detail h3{margin:0;font-size:12px;font-weight:600}.child-detail dl{display:grid;grid-template-columns:auto 1fr;gap:2px 8px;margin:0}.child-detail dt{color:var(--muted);font-size:9px;text-transform:uppercase}.child-detail dd{margin:0;overflow-wrap:anywhere}.child-detail code{font-size:10px}.child-prompt{margin:0;white-space:pre-wrap;font-size:10px}.child-detail-actions{display:flex;gap:6px}.child-detail-actions button{font:inherit;font-size:10px;padding:3px 8px;border-radius:var(--radius);border:1px solid var(--rule);background:transparent;color:inherit;cursor:pointer}.child-detail-actions button:hover{border-color:var(--border-focus);color:var(--acid)}.child-detail-note{margin:0;font-size:9px}.workspace-meta{margin-top:auto;border-top:1px solid var(--rule);padding:8px 8px 0;overflow:hidden;color:var(--muted);font-size:9px}.workspace-meta summary{cursor:pointer;list-style:none;letter-spacing:.14em;text-transform:uppercase;padding:6px 0;-webkit-user-select:none;user-select:none}.workspace-meta summary::-webkit-details-marker{display:none}.workspace-meta[open] summary{margin-bottom:6px}.workspace-meta span{display:block;color:var(--muted);font-size:9px;margin-top:6px}.workspace-meta code{display:block;font-size:10px;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}main{min-width:0;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto;overflow:hidden}.runtime{display:flex;gap:1px;border-bottom:1px solid var(--rule);background:var(--rule);overflow:auto;min-width:0}.runtime-explain{align-self:end;padding:6px 10px;font-size:10px;letter-spacing:.04em;text-transform:uppercase}.sandbox-explain-dialog{width:min(640px,calc(100vw - 24px))}.sandbox-summary{display:grid;grid-template-columns:auto 1fr;gap:6px 14px;margin:0 0 14px;font-size:12px}.sandbox-summary dt{color:var(--muted);margin:0}.sandbox-summary dd{margin:0;color:var(--ink)}.sandbox-explain{max-height:min(50vh,360px);overflow:auto;white-space:pre-wrap;word-break:break-word}.runtime-field{display:grid;gap:3px;min-width:130px;background:var(--surface);padding:7px 10px}.runtime-field span{color:var(--muted);text-transform:uppercase;font-size:8px;letter-spacing:.14em}.runtime-field select{border:0;padding:0;background:transparent;font-size:11px}.runtime-more{display:flex;align-items:stretch;flex:1 1 auto;min-width:0;background:var(--surface)}.runtime-disclosure{display:flex;flex-direction:column;justify-content:center;gap:2px;border:0;background:transparent;padding:7px 12px;min-width:110px;text-align:left;cursor:pointer;color:var(--ink);font:inherit}.runtime-disclosure>span:first-child{color:var(--muted);text-transform:uppercase;font-size:8px;letter-spacing:.14em}.runtime-summary{color:var(--ink);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:220px}.runtime-secondary{display:flex;gap:1px;flex:1 1 auto;min-width:0;background:var(--rule);border-left:1px solid var(--rule)}.runtime-status{display:flex;flex-wrap:wrap;gap:12px 18px;padding:6px 12px;background:var(--surface);border-top:1px solid var(--rule);color:var(--muted);font-size:10px;letter-spacing:.04em}.runtime-status span:before{content:"";display:inline-block;width:4px;height:4px;margin-right:8px;border-radius:50%;background:var(--acid);vertical-align:middle}.transcript{min-width:0;min-height:0;overflow:auto;padding:42px clamp(var(--gutter),6vw,80px);scrollbar-color:var(--rule) transparent}.empty-state{max-width:620px;margin:12vh auto 0}.empty-state span{color:var(--acid);font-size:10px;letter-spacing:.18em}.empty-state h1{font-size:clamp(42px,7vw,78px);line-height:.9;margin:18px 0;letter-spacing:-.04em}.empty-state p{color:var(--muted);max-width:530px;line-height:1.7;font-size:12px}.message{max-width:780px;margin:0 auto 28px;border-left:2px solid var(--rule);padding:0 0 0 18px}.message.user{border-color:var(--user)}.message.assistant{border-color:var(--acid)}.message.tool{border-color:var(--tool)}.message.reasoning{color:var(--muted)}.message.error{border-color:var(--signal)}.message-label{color:var(--muted);text-transform:uppercase;letter-spacing:.16em;font-size:9px;margin-bottom:8px}.message.user .message-label{color:var(--user)}.message.assistant .message-label{color:var(--acid)}.message.tool .message-label{color:var(--tool)}.message p{white-space:pre-wrap;line-height:1.7;margin:0;font-family:ui-monospace,monospace;font-size:13px}.message pre,.inspector pre,dialog pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:11px;line-height:1.55;background:var(--code-bg);padding:12px;border:1px solid var(--rule)}.composer{margin:0 clamp(var(--gutter),4vw,56px) 22px;border:1px solid var(--rule);background:var(--surface);position:relative;min-width:0}.composer label{display:block;padding:8px 12px;color:var(--muted);font-size:9px;text-transform:uppercase;letter-spacing:.16em;border-bottom:1px solid var(--rule)}.composer textarea{display:block;width:100%;min-height:88px;max-height:220px;resize:vertical;border:0;background:transparent;padding:14px;line-height:1.5}.composer-bar{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px;padding:8px;border-top:1px solid var(--rule);color:var(--muted);font-size:9px;min-width:0}.composer-bar>span{display:inline-flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0}.composer-send{background:var(--acid);color:var(--mark-ink);border-color:var(--acid);padding:7px 18px;text-transform:uppercase;font-size:10px;font-weight:600;flex-shrink:0}.composer-send:hover:not(:disabled),.composer-send:focus-visible{color:var(--mark-ink);border-color:var(--border-focus);filter:brightness(1.05)}.composer-bar .stop{background:var(--signal);border-color:var(--signal);color:var(--mark-ink)}.composer-send:disabled{opacity:.35;cursor:not-allowed}.composer-secondary{background:var(--surface);color:var(--ink);border-color:var(--rule);padding:7px 12px;text-transform:none;font-size:10px;font-weight:500}.composer-secondary:hover:not(:disabled),.composer-secondary:focus-visible{color:var(--acid);border-color:var(--acid);filter:none}.inspector{border-left:1px solid var(--rule);min-width:0;overflow:hidden;position:relative;display:flex;flex-direction:column}.session-group{flex:0 1 auto;max-height:55%;overflow:auto;padding:12px 16px 8px;border-bottom:1px solid var(--rule);display:flex;flex-direction:column;gap:12px;min-height:0}.session-group-pane{min-height:0}.session-group-facts{display:grid;grid-template-columns:auto 1fr;gap:2px 10px;margin:0;font-size:10px}.inspector .session-group-facts{margin:0;grid-template-columns:auto 1fr}.inspector .session-group-facts dt,.inspector .session-group-facts dd{margin:0;padding:2px 0;border:0}.session-group-facts dt{color:var(--muted);margin:0;padding:2px 0;border:0}.session-group-facts dd{margin:0;padding:2px 0;text-align:right;border:0;overflow-wrap:anywhere}.session-group-fit{font-size:10px;margin:8px 0 0;color:var(--warning)}.session-group-fit.critical{color:var(--signal)}.session-group-queue{margin:0}.session-group-queue .prompt-queue{padding-left:22px}.navigation.collapsed,.inspector.collapsed{opacity:0;pointer-events:none}.panel-resize{position:absolute;top:0;bottom:0;width:10px;z-index:2;display:flex;align-items:stretch;padding:0;margin:0;border:0;background:transparent}.panel-resize-nav{right:-5px;cursor:col-resize}.panel-resize-inspector{left:-5px;cursor:col-resize}.panel-resize-handle{flex:1;min-width:4px;background:transparent;transition:background .12s ease}.panel-resize:hover .panel-resize-handle,.panel-resize:focus-within .panel-resize-handle{background:color-mix(in srgb,var(--acid) 55%,transparent)}.inspector-body{flex:1;min-width:0;min-height:0;height:auto;overflow:auto;padding:20px var(--gutter)}.inspector h2{margin:8px 0 16px;font-family:Georgia,Times New Roman,serif;font-size:20px;font-weight:500}.inspector dl{display:grid;grid-template-columns:1fr 1fr;margin:0 0 30px;font-size:10px}.inspector dt,.inspector dd{margin:0;padding:8px 0;border-bottom:1px solid var(--rule)}.inspector dt{color:var(--muted)}.inspector dd{text-align:right;overflow-wrap:anywhere}.capabilities{display:flex;flex-wrap:wrap;gap:5px}.capabilities span{padding:4px 6px;border:1px solid var(--rule);color:var(--muted);font-size:8px;text-transform:uppercase}.capabilities span.enabled{color:var(--acid);border-color:var(--border-focus)}.muted{color:var(--muted);font-size:11px;line-height:1.5}.context-doctor-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}.context-doctor-head h2{margin:0}.context-doctor-actions{display:flex;gap:6px;flex-wrap:wrap}.context-doctor-actions button,.context-layer-actions button,.context-kind-row button{font-size:10px;padding:4px 8px;border:1px solid var(--rule);background:var(--surface-muted);color:var(--ink);cursor:pointer}.context-doctor-actions button:disabled,.context-layer-actions button:disabled,.context-kind-row button:disabled{opacity:.45;cursor:not-allowed}.context-fit-warning{border:1px solid var(--warning);background:color-mix(in srgb,var(--warning) 12%,var(--surface-muted));padding:10px;margin:0 0 12px;display:grid;gap:4px}.context-fit-warning.critical{border-color:var(--danger);background:color-mix(in srgb,var(--danger) 12%,var(--surface-muted))}.context-fit-warning strong{font-size:11px;text-transform:uppercase;letter-spacing:.08em}.context-fit-warning p{margin:0;font-size:12px;line-height:1.45}.context-fit-warning small{color:var(--muted);font-size:10px}.context-attribution,.context-layers,.context-sets,.context-kind-picker{margin-top:16px}.context-attribution h3,.context-layers h3,.context-sets h3,.context-kind-picker h3{margin:0 0 8px;font-size:11px;text-transform:uppercase;letter-spacing:.1em;color:var(--muted)}.context-table{width:100%;border-collapse:collapse;font-size:11px}.context-table th,.context-table td{text-align:left;padding:6px 4px;border-bottom:1px solid var(--rule);vertical-align:top}.context-table th{color:var(--muted);font-weight:500;font-size:10px;text-transform:uppercase;letter-spacing:.08em}.context-layer-actions{display:flex;flex-wrap:wrap;gap:4px}.context-sets p{margin:0 0 6px;font-size:11px;line-height:1.45}.context-kind-list{display:grid;gap:4px}.context-kind-row{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:6px 0;border-bottom:1px solid var(--rule);font-size:11px}.context-kind-row span{display:flex;gap:4px}.changed-files,.project-list{display:grid;gap:10px}.changed-file,.project-list article{border:1px solid var(--rule);background:var(--surface-muted);padding:10px}.changed-file>button{width:100%;display:flex;justify-content:space-between;align-items:center;gap:12px;border:0;background:transparent;padding:0;text-align:left}.diff-stat{display:flex;gap:8px;font-size:10px}.diff-stat b:first-child{color:var(--diff-add)}.diff-stat b:last-child{color:var(--diff-del)}.diff-view{margin:10px 0 0;max-height:360px;overflow:auto;background:var(--code-bg);border:1px solid var(--rule);padding:10px;font-size:10px;white-space:pre-wrap}.project-list h3{margin:0 0 8px;font-size:12px;overflow-wrap:anywhere}.project-list p{margin:0 0 8px;color:var(--muted);font-size:11px;line-height:1.5;white-space:pre-wrap}.project-list small{color:var(--acid);text-transform:uppercase;font-size:8px;letter-spacing:.12em}.diagnostics-heading{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:4px}.diagnostics-heading h2{margin:8px 0 16px}.diagnostics-subhead{margin:18px 0 10px;font-size:9px;letter-spacing:.14em;text-transform:uppercase;color:var(--muted)}.diagnostics-actions{display:flex;flex-wrap:wrap;gap:6px}.diagnostics-actions button{border:1px solid var(--rule);background:var(--surface-muted);color:var(--ink);padding:5px 8px;font-size:10px;text-transform:uppercase;letter-spacing:.08em}.diagnostics-actions button:disabled{opacity:.45}.lsp-server header,.diagnostic-item header{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}.lsp-server header h3,.diagnostic-item header code{margin:0}.lsp-state,.diag-severity{flex-shrink:0;padding:2px 6px;border:1px solid var(--rule);font-size:8px;letter-spacing:.12em;text-transform:uppercase}.lsp-state.state-up,.diag-severity.sev-info{color:var(--success);border-color:color-mix(in srgb,var(--success) 50%,var(--rule))}.lsp-state.state-error,.diag-severity.sev-error{color:var(--signal);border-color:color-mix(in srgb,var(--signal) 50%,var(--rule))}.lsp-state.state-down,.diag-severity.sev-warning{color:var(--warning);border-color:color-mix(in srgb,var(--warning) 50%,var(--rule))}.lsp-state.state-disabled,.diag-severity.sev-hint{color:var(--muted)}.lsp-error{color:var(--signal)!important}.diagnostic-item header code{font-size:11px;overflow-wrap:anywhere}.diagnostics-list .diagnostic-item p{margin-bottom:4px;color:var(--ink)}dialog{width:min(560px,calc(100vw - 32px));border:1px solid var(--rule);background:var(--surface);padding:28px;color:var(--ink)}.dialog-rule{position:absolute;left:0;top:0;width:7px;height:100%;background:var(--acid)}dialog::backdrop{background:color-mix(in srgb,var(--overlay) 85%,#000)}dialog h2{font-size:30px;margin:0 0 20px}dialog label{display:grid;gap:7px;color:var(--muted);font-size:10px}dialog input{padding:12px;color:var(--ink)}.dialog-actions{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px;margin-top:22px}.dialog-actions button{padding:9px 14px}.permission-tool{margin:0 0 10px;font-size:15px}.permission-patterns{margin:0 0 14px;padding-left:1.2em;display:grid;gap:6px}.permission-patterns code{display:inline-block;padding:2px 6px;border-radius:var(--radius);background:var(--code-bg);color:var(--tool);font-size:12px;word-break:break-all}.permission-explain{display:grid;gap:10px;margin:12px 0 4px}.permission-explain button{justify-self:start;padding:7px 12px;font-size:12px;color:var(--muted);border:1px solid var(--rule);background:var(--surface-muted)}.permission-explain-body{margin:0;padding:12px;border-radius:var(--radius);background:var(--code-bg);color:var(--ink);font-size:12px;white-space:pre-wrap;max-height:180px;overflow:auto}.permission-explain-error{margin:0;color:var(--signal);font-size:12px}.undo-dialog{width:min(560px,calc(100vw - 32px))}.undo-preview{display:grid;gap:6px;margin:0 0 18px;padding:12px 14px;border:1px solid var(--rule);background:color-mix(in srgb,var(--surface) 88%,var(--ink));font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;line-height:1.45;white-space:pre-wrap;overflow-wrap:anywhere}.undo-preview p{margin:0;color:var(--muted)}.undo-preview .undo-warn{color:var(--acid)}.undo-choices{display:grid;gap:8px}.undo-choice{display:grid;grid-template-columns:auto 1fr;gap:10px;align-items:start;margin:0;padding:12px 14px;border:1px solid var(--rule);cursor:pointer;color:var(--ink);font-size:12px}.undo-choice.active{border-color:var(--acid);background:color-mix(in srgb,var(--acid) 8%,transparent)}.undo-choice strong{display:block;text-transform:lowercase;letter-spacing:.02em}.undo-choice small{display:block;margin-top:4px;color:var(--muted);font-size:11px;line-height:1.4;font-weight:400}.undo-choice input{margin-top:3px}.mobile-only{display:none}@keyframes pulse{50%{opacity:.4}}@media(max-width:1023px){.app-shell{grid-template-columns:minmax(0,1fr);grid-template-rows:var(--header-height) minmax(0,1fr)}.app-shell main{min-width:0}.navigation{position:fixed;z-index:5;top:calc(var(--header-height) + env(safe-area-inset-top,0px));bottom:0;left:0;width:min(var(--nav-width, 280px),88vw);max-width:100vw;transform:translate(-100%);transition:transform .2s ease;box-shadow:none;padding-bottom:env(safe-area-inset-bottom,0px)}.navigation.open{transform:translate(0)}.inspector{position:fixed;right:0;top:calc(var(--header-height) + env(safe-area-inset-top,0px));bottom:0;width:min(var(--inspector-width, 360px),92vw);max-width:100vw;z-index:6;transform:translate(100%);transition:transform .2s ease;box-shadow:none;padding-bottom:env(safe-area-inset-bottom,0px)}.inspector.open{transform:translate(0)}.panel-resize{display:none}.shell-backdrop{display:none;position:fixed;top:0;right:0;bottom:0;left:0;top:calc(var(--header-height) + env(safe-area-inset-top,0px));background:color-mix(in srgb,var(--overlay) 55%,transparent);z-index:4;border:0;padding:0;cursor:pointer}.shell-backdrop.visible{display:block}}@media(max-width:599px){.app-shell{display:grid;grid-template:auto minmax(0,1fr) auto / minmax(0,1fr)}.mobile-only{display:block}.wordmark{flex-basis:auto;width:auto}.wordmark strong{font-size:12px}.wordmark small{display:none}header{flex-wrap:nowrap;gap:6px;padding:0 8px;padding-top:env(safe-area-inset-top,0px);overflow:hidden}.header-mode-switch{display:none!important}.palette-trigger{max-width:5.5rem}.palette-trigger kbd{display:none}header .icon-button[aria-label="Export markdown"]{display:none}.session-line{font-size:0;margin-left:auto;display:flex;align-items:center;gap:6px;min-width:0;flex:0 1 auto}.session-line .pulse{margin:0}.session-line .attention-summary{font-size:9px;max-width:9em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:4px 8px;min-height:32px}.runtime{max-width:100%}.runtime-stack{padding:0 4px}.transcript{padding:16px 12px 12px}.composer{margin:0;border-radius:0;border-left:0;border-right:0;padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px));position:sticky;bottom:0;background:var(--surface);z-index:2}.composer textarea{min-height:44px;font-size:16px}.composer-bar button,.composer .queue-toolbar button{min-height:44px;min-width:44px;padding:10px 12px}.empty-state{margin-top:4vh;padding:0 8px}.icon-button{min-width:44px;min-height:44px}.navigation,.inspector{top:auto;bottom:calc(var(--mode-bar-height) + env(safe-area-inset-bottom,0px));left:0;right:0;width:100%;max-height:min(78dvh,640px);border-top:1px solid var(--rule);border-radius:var(--radius) var(--radius) 0 0;transform:translateY(105%);box-shadow:none;padding-bottom:8px;z-index:8}.navigation.open,.inspector.open{transform:translateY(0)}.shell-backdrop{top:calc(var(--header-height) + env(safe-area-inset-top,0px));z-index:7}header{z-index:10}.mode-bottom-bar{display:flex;align-items:stretch;justify-content:space-around;gap:2px;border-top:1px solid var(--rule);background:var(--header-bg);padding:4px 4px calc(4px + env(safe-area-inset-bottom,0px));z-index:3}.mode-bottom-bar .mode-btn{flex:1;flex-direction:column;justify-content:center;gap:2px;min-height:48px;padding:6px 4px;font-size:9px;border-radius:var(--radius)}.mode-bottom-bar .mode-btn span:first-child{max-width:none}}.mode-bottom-bar{display:none}.app-shell[data-shell=phone] .mode-bottom-bar{display:flex;z-index:9}.surface-nav-sheet{flex:0 0 auto;border-bottom:1px solid var(--rule);max-height:40vh;overflow:auto;background:var(--surface-muted);min-width:0}.surface-nav-list{list-style:none;margin:0;padding:.35rem .5rem;display:flex;flex-direction:column;gap:.25rem}.surface-nav-item{display:flex;width:100%;min-height:44px;align-items:center;justify-content:flex-start;text-align:left;padding:.5rem .75rem;border:1px solid transparent;border-radius:var(--radius);background:transparent;color:var(--ink);font:inherit;cursor:pointer}.surface-nav-item:hover,.surface-nav-item:focus-visible{border-color:var(--border-focus);outline:none;background:var(--raised)}.surface-nav-item.active{background:var(--surface);border-color:var(--rule);font-weight:600}.surface-nav-label{text-transform:lowercase}.app-shell[data-shell=phone] main{min-width:0}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}.navigation,.inspector,.shell-backdrop{transition:none!important}}.fast-toggle{display:flex;align-items:center;gap:6px;padding:0 10px;background:var(--surface);font-size:9px;color:var(--muted)}.fast-toggle input{accent-color:var(--acid)}.session-actions{display:flex;flex-direction:column;gap:6px;padding:0 8px}.session-actions>button{padding:6px 8px;font-size:9px;text-transform:uppercase;width:100%}.session-actions button:disabled{opacity:.4}.session-overflow{position:relative;width:100%}.session-overflow>summary{list-style:none;cursor:pointer;padding:6px 8px;border:1px solid var(--rule);background:var(--surface);font-size:9px;text-transform:uppercase;letter-spacing:.08em;text-align:center;-webkit-user-select:none;user-select:none}.session-overflow>summary::-webkit-details-marker{display:none}.session-overflow>summary:hover,.session-overflow>summary:focus-visible{border-color:var(--acid);color:var(--acid)}.session-overflow-menu{display:grid;gap:2px;margin-top:4px;border:1px solid var(--rule);background:var(--raised);padding:4px}.session-overflow-menu button{width:100%;border:0;background:transparent;padding:7px 8px;font-size:9px;text-transform:uppercase;text-align:left}.session-overflow-menu button:hover,.session-overflow-menu button:focus-visible{background:var(--surface);color:var(--acid)}.nav-tab{border:0;border-bottom:2px solid transparent;background:transparent;padding:7px 12px;font-size:10px;letter-spacing:.16em;color:var(--muted)}.nav-tab.active{border-bottom-color:var(--acid);color:var(--acid)}.history-search{width:100%;margin:0 0 6px;padding:7px 10px;border:1px solid var(--rule);background:var(--ground);font-size:11px}.root-idle{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--success);margin-right:8px}.root-busy{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--accent-alt);animation:pulse 1.2s infinite;margin-right:8px}.live-badge{font-size:8px;color:var(--accent-alt)}.session.history-row{gap:6px}.session.history-row .live-badge{color:var(--accent-alt)}.markdown h2,.markdown h3{font-family:Georgia,Times New Roman,serif;margin:16px 0 8px}.markdown h2{font-size:22px}.markdown h3{font-size:17px}.markdown p{margin:5px 0}.markdown a,.file-ref{color:var(--acid)}.markdown code{background:var(--code-bg);border:1px solid var(--rule);padding:1px 4px}.list-line{padding:3px 0 3px 12px;line-height:1.6}.code-block{margin:12px 0;border:1px solid var(--rule);background:var(--code-bg)}.code-block figcaption{padding:6px 10px;border-bottom:1px solid var(--rule);color:var(--muted);font-size:9px;text-transform:uppercase}.code-block pre{border:0;margin:0}.tool-card{border:1px solid var(--rule);background:var(--code-bg)}.tool-card summary{display:flex;justify-content:space-between;padding:9px 12px;cursor:pointer;color:var(--tool)}.tool-card summary small{color:var(--muted)}.tool-card pre{margin:0;border-width:1px 0 0}.diff span{display:block}.diff .add{color:var(--diff-add);background:var(--diff-add-bg)}.diff .del{color:var(--diff-del);background:var(--diff-del-bg)}.composer-field{position:relative;display:flex;flex-direction:column;min-width:0}.completion{--completion-max-rows: 6;--completion-row-height: 28px;display:flex;flex-direction:column;background:var(--raised);border-bottom:1px solid var(--rule);max-height:calc(var(--completion-max-rows) * var(--completion-row-height));overflow:auto}.completion button{box-sizing:border-box;min-height:var(--completion-row-height);padding:4px 12px;line-height:1.35;white-space:nowrap;overflow:hidden}.ui-list-row-meta:before,.completion span:before{content:"— "}.attachments{display:flex;gap:6px;padding:7px 10px;border-top:1px solid var(--rule)}.attachments button{padding:5px 8px;font-size:9px}.prompt-queue-wrap{border-top:1px solid var(--rule)}.prompt-queue{margin:0;padding:8px 12px 8px 34px;font-size:10px;color:var(--muted);list-style:decimal}.prompt-queue li{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:start;padding:4px 0}.prompt-queue li span:first-child{overflow-wrap:anywhere}.queue-actions{display:inline-flex;gap:2px;flex-shrink:0}.queue-actions button{border:0;background:transparent;color:var(--muted);padding:0 4px;min-width:1.4em;cursor:pointer}.queue-actions button:disabled{opacity:.35;cursor:default}.queue-edit{width:100%;font:inherit;color:var(--ink);background:var(--raised);border:1px solid var(--rule);padding:4px 6px}.queue-toolbar{display:flex;justify-content:flex-end;padding:0 12px 8px}.queue-toolbar button{font-size:9px;padding:4px 8px}.unavailable p{color:var(--muted);font-size:10px;line-height:1.5}.capability-list{display:grid;gap:1px;background:var(--rule)}.capability-list div{display:flex;justify-content:space-between;gap:10px;padding:9px;background:var(--surface);font-size:9px}.capability-list strong{text-align:right}.available{color:var(--success)}.unavailable-label{color:var(--signal)}dialog fieldset{border:1px solid var(--rule);margin:10px 0;padding:12px}dialog legend{color:var(--ink);padding:0 5px;font-size:11px}dialog fieldset label{display:flex;grid-template-columns:auto 1fr auto;align-items:start;margin:8px 0}dialog fieldset small{color:var(--muted)}.mcp-head{display:flex;justify-content:space-between;gap:8px;align-items:baseline;margin-bottom:8px}.mcp-head h2{margin:0;font-size:13px}.mcp-actions,.mcp-card-actions{display:flex;gap:6px;flex-wrap:wrap}.mcp-list{display:grid;gap:8px}.mcp-card{border:1px solid var(--rule);background:var(--surface-muted);padding:10px;display:grid;gap:6px}.mcp-card header{display:flex;justify-content:space-between;gap:8px;align-items:baseline}.mcp-card h3{margin:0;font-size:12px}.mcp-card p{margin:0;color:var(--muted);font-size:10px}.mcp-card code{background:var(--code-bg);border:1px solid var(--border-muted);padding:1px 4px;font-size:9px}.mcp-state{text-transform:uppercase;font-size:8px;letter-spacing:.12em;color:var(--muted)}.mcp-state.up{color:var(--success)}.mcp-state.error{color:var(--signal)}.mcp-state.down{color:var(--warning)}.mcp-state.disabled{color:var(--overlay)}.mcp-error{color:var(--signal)!important;font-size:10px}.mcp-tools{display:flex;flex-wrap:wrap;gap:4px}.workflow-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}.workflow-head h2{margin:0;font-size:13px}.workflow-actions{display:flex;gap:6px;flex-wrap:wrap}.workflow-actions button,.workflow-card-actions button,.workflow-phase-tools button{font-size:10px;padding:4px 8px}.workflow-active{font-size:11px;color:var(--accent-alt);margin:0 0 8px}.workflow-list{display:grid;gap:8px}.workflow-card{border:1px solid var(--rule);background:var(--surface);padding:10px;display:grid;gap:6px}.workflow-card.invalid{border-color:var(--signal)}.workflow-card header{display:flex;justify-content:space-between;gap:8px;align-items:baseline}.workflow-card h3{margin:0;font-size:12px}.workflow-card small,.workflow-card p{margin:0;color:var(--muted);font-size:10px}.workflow-error{color:var(--signal)!important;font-size:10px}.workflow-warn{color:var(--warning);font-size:10px;margin:6px 0}.workflow-grants{display:flex;flex-wrap:wrap;gap:4px;align-items:center;font-size:10px}.workflow-grants span{color:var(--muted);margin-right:4px}.workflow-grants code,.check-cmd{background:var(--code-bg);border:1px solid var(--border-muted);padding:2px 5px;font-size:9px}.workflow-card-actions{display:flex;gap:6px}.workflow-dialog{width:min(520px,calc(100vw - 24px));max-height:calc(100vh - 48px);overflow:auto;border:1px solid var(--rule);background:var(--surface);color:var(--ink);padding:16px}.workflow-dialog.wide{width:min(720px,calc(100vw - 24px))}.workflow-dialog::backdrop{background:color-mix(in srgb,var(--overlay) 55%,transparent)}.workflow-builder{display:grid;gap:10px}.workflow-builder fieldset label{display:grid;grid-template-columns:110px 1fr;gap:8px;align-items:center;margin:6px 0}.workflow-builder input,.workflow-builder select,.workflow-builder textarea{width:100%;background:var(--ground);color:var(--ink);border:1px solid var(--rule);padding:6px 8px;font:inherit;font-size:11px}.workflow-phases{display:flex;flex-wrap:wrap;gap:4px;align-items:center}.workflow-phases>button{font-size:10px;padding:4px 8px;border:1px solid var(--rule);background:var(--surface-muted);color:var(--ink)}.workflow-phases>button.active{border-color:var(--border-focus);background:var(--raised);color:var(--highlight)}.workflow-phase-tools{display:flex;gap:4px;margin-left:auto}.perm-row{display:grid;grid-template-columns:1fr 1fr 90px auto;gap:6px;margin:4px 0}.workflow-review{border:1px solid var(--rule);background:var(--surface-muted);padding:10px;display:grid;gap:6px}.workflow-review h3{margin:0;font-size:11px}.workflow-review-phase{font-size:10px}.workflow-json{margin:0;max-height:180px;overflow:auto;background:var(--code-bg);border:1px solid var(--border-muted);padding:8px;font-size:10px;white-space:pre-wrap}@media(max-width:720px){.workflow-builder fieldset label,.perm-row{grid-template-columns:1fr}.workflow-dialog.wide{width:calc(100vw - 16px)}}.plans-panel{display:grid;gap:8px}.plans-meta{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:0;font-size:10px;color:var(--muted)}.plans-meta small{color:var(--acid);text-transform:uppercase;letter-spacing:.12em;font-size:8px}.plans-actions{flex-wrap:wrap;margin:4px 0 8px}.plans-section-head{display:flex;justify-content:space-between;gap:8px;align-items:baseline}.plans-section-head h3{margin:0}.plans-section-head button{font-size:10px;padding:2px 6px}.plans-create{display:grid;gap:6px;border:1px solid var(--rule);background:var(--surface-muted);padding:10px;margin-bottom:8px}.plans-create label{display:grid;gap:4px;font-size:10px;color:var(--muted)}.plans-create input{background:var(--ground);color:var(--ink);border:1px solid var(--rule);padding:6px 8px;font:inherit;font-size:11px}.plans-create button{justify-self:start;font-size:10px;padding:4px 8px}.plans-sections{margin-top:4px}.timeline-panel{display:grid;gap:10px}.timeline-head{display:flex;align-items:center;justify-content:space-between;gap:8px}.timeline-head h2{margin:0;font-size:13px}.timeline-actions{display:flex;gap:6px;flex-wrap:wrap}.timeline-actions button{font-size:10px;padding:4px 8px}.timeline-summary{display:grid;grid-template-columns:repeat(auto-fill,minmax(72px,1fr));gap:8px;margin:0}.timeline-summary div{border:1px solid var(--rule);background:var(--surface-muted);padding:8px}.timeline-summary dt{margin:0 0 4px;color:var(--muted);font-size:8px;letter-spacing:.1em;text-transform:uppercase}.timeline-summary dd{margin:0;font-size:12px}.timeline-list{list-style:none;margin:0;padding:0;display:grid;gap:4px;max-height:min(60vh,480px);overflow:auto}.timeline-entry{display:grid;grid-template-columns:72px minmax(0,1.4fr) 72px 48px;gap:6px 8px;align-items:baseline;border:1px solid var(--border-muted);background:var(--surface-muted);padding:6px 8px;font-size:10px}.timeline-state{font-size:9px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}.timeline-state.state-completed{color:var(--success)}.timeline-state.state-failed{color:var(--signal)}.timeline-state.state-canceled{color:var(--warning)}.timeline-state.state-running,.timeline-state.state-waiting,.timeline-state.state-queued{color:var(--accent-alt)}.timeline-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ink)}.timeline-id{color:var(--muted);font-size:9px;overflow:hidden;text-overflow:ellipsis}.timeline-dur{color:var(--muted);text-align:right}.timeline-code{grid-column:1 / -1;color:var(--warning);font-size:9px}.timeline-err{grid-column:1 / -1;color:var(--signal);font-size:9px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.root-attention{width:8px;height:8px;border-radius:50%;background:var(--warning);flex-shrink:0}.needs-you{color:var(--warning)!important;font-weight:700}.attention-summary{margin-left:8px;border:1px solid var(--warning);background:color-mix(in srgb,var(--warning) 12%,transparent);color:var(--warning);font-size:9px;text-transform:uppercase;letter-spacing:.04em;padding:2px 6px;border-radius:var(--radius);cursor:pointer}.attention-summary:hover{filter:brightness(1.1)}.settings-dialog{width:min(560px,calc(100vw - 24px));max-width:calc(100vw - 24px);min-width:0;max-height:min(88vh,900px);overflow:auto;border:1px solid var(--rule);background:var(--surface);color:var(--ink);padding:18px 20px 16px}.settings-dialog.wide{width:min(640px,calc(100vw - 24px))}.settings-dialog::backdrop{background:color-mix(in srgb,var(--overlay) 55%,transparent)}.settings-form fieldset label{display:grid;grid-template-columns:minmax(0,140px) minmax(0,1fr);gap:8px 12px;align-items:center;margin:6px 0;min-width:0}.settings-form fieldset label select,.settings-form fieldset label input{width:100%;min-width:0;padding:8px 10px;background:var(--ground);border:1px solid var(--rule);color:var(--ink)}.settings-form fieldset button[type=button]{margin-top:6px;font-size:10px;padding:6px 10px}.settings-form .muted,.settings-dialog .muted{color:var(--muted);font-size:10px;margin:4px 0 8px;line-height:1.45}.exclude-list{display:flex;flex-wrap:wrap;gap:8px 14px;margin-top:8px;align-items:center}.exclude-label{width:100%;color:var(--muted);font-size:10px;text-transform:uppercase;letter-spacing:.04em}.exclude-item{display:inline-flex!important;align-items:center;gap:6px;margin:0!important;color:var(--ink);font-size:11px;grid-template-columns:none!important}.settings-error{color:var(--signal);font-size:11px;margin:8px 0 0}.goal-meta{display:grid;grid-template-columns:100px 1fr;gap:4px 8px;margin:0 0 12px;font-size:11px}.goal-meta dt{color:var(--muted);margin:0}.goal-meta dd{margin:0;overflow-wrap:anywhere}.goal-criteria{margin:0 0 12px;padding-left:18px;font-size:11px;color:var(--muted)}.goal-criteria strong{color:var(--acid);margin-right:6px}.goal-log{margin:0 0 12px;padding-left:18px;display:grid;gap:8px;font-size:11px}.goal-log li{display:grid;gap:2px}.goal-log span{color:var(--muted);font-size:10px}.goal-log p{margin:0;color:var(--muted);white-space:pre-wrap}.project-form{display:grid;gap:10px;margin-bottom:16px;padding:12px;border:1px solid var(--rule);background:var(--surface-muted)}.project-form label{display:grid;gap:6px;color:var(--muted);font-size:10px;text-transform:uppercase;letter-spacing:.08em}.project-form input,.project-form textarea{width:100%;border:1px solid var(--rule);background:var(--surface);color:var(--ink);padding:8px 10px;font:inherit;font-size:12px;text-transform:none;letter-spacing:normal}.project-form textarea{resize:vertical;min-height:64px}.plugin-card .plugin-trust{font-size:10px;text-transform:uppercase;letter-spacing:.04em}.plugin-trust.trusted{color:var(--success)}.plugin-trust.stale{color:var(--warning)}.plugin-trust.none{color:var(--signal)}.plugin-trust.passive{color:var(--muted)}.plugin-findings{margin:4px 0 0;padding-left:16px;font-size:10px;color:var(--muted)}.plugin-install{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:end;margin:0 0 10px}.plugin-install label{display:grid;gap:4px;font-size:10px;color:var(--muted)}.plugin-install input{width:100%;background:var(--ground);color:var(--ink);border:1px solid var(--rule);padding:6px 8px;font:inherit;font-size:11px}.plugin-trust-preview{border:1px solid var(--border-focus);background:var(--surface-muted);padding:10px;margin:0 0 10px;display:grid;gap:6px}.plugin-trust-preview h3{margin:0;font-size:12px}.plugin-trust-preview ul{margin:0;padding-left:16px;font-size:10px}.plugin-pane-surface{border:1px solid var(--rule);background:var(--surface);outline:none;min-height:120px}.plugin-pane-surface:focus{border-color:var(--border-focus)}.plugin-pane-chrome{display:flex;gap:8px;align-items:baseline;padding:8px 10px;border-bottom:1px solid var(--rule);background:var(--surface-muted);font-size:11px}.plugin-pane-body{padding:10px;font-size:11px}.pane-column{display:grid}.pane-row{display:flex;flex-wrap:wrap;min-width:0}.pane-row.wrap{flex-direction:column;flex-wrap:nowrap}.pane-row-cell{flex-grow:1;flex-shrink:1;flex-basis:calc((var(--stack-at, 0px) - 100%) * 999);min-width:0;max-width:100%}.pane-row.wrap .pane-row-cell{flex:1 1 auto;width:100%}.pane-role{margin:0}.pane-role.title{font-weight:600;color:var(--ink)}.pane-role.muted{color:var(--muted)}.pane-role.accent{color:var(--acid)}.pane-role.success{color:var(--success)}.pane-role.warning{color:var(--warning)}.pane-role.error{color:var(--signal)}.pane-role.body{color:var(--ink)}.pane-kv{margin:0;display:grid;gap:2px}.pane-kv-row{display:grid;grid-template-columns:minmax(48px,30%) 1fr;gap:8px}.pane-kv dt,.pane-kv dd{margin:0}.pane-list{list-style:none;margin:0;padding:0;display:grid;gap:2px}.pane-list li{display:flex;justify-content:space-between;gap:8px;padding:2px 4px}.pane-list li.selected{background:var(--raised);box-shadow:inset 2px 0 0 var(--acid);color:var(--highlight)}.pane-table{width:100%;border-collapse:collapse;font-size:10px}.pane-table th,.pane-table td{text-align:left;padding:2px 4px;border-bottom:1px solid var(--border-muted)}.pane-table th{color:var(--muted);font-weight:500}.pane-meter{display:flex;align-items:center;gap:8px}.pane-badge{display:inline-block;padding:1px 6px;border-radius:var(--radius);background:var(--surface-muted);font-size:10px}.pane-badge.tone-success{color:var(--success)}.pane-badge.tone-warning{color:var(--warning)}.pane-badge.tone-error{color:var(--signal)}.pane-badge.tone-accent{color:var(--acid)}.pane-divider{border:0;border-top:1px solid var(--border-muted);margin:6px 0}.pane-error{padding:10px;background:var(--unavailable-bg);color:var(--signal);font-size:11px}.pane-error p{margin:4px 0 0;color:var(--muted)}.pane-empty{padding:8px 0}@media(max-width:720px){.plugin-install{grid-template-columns:1fr}.settings-form fieldset label{grid-template-columns:minmax(0,1fr)}}.plugin-head,.plugin-pane-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}.plugin-head h2,.plugin-pane-head h3{margin:0;font-size:13px}.plugin-actions,.plugin-card-actions{display:flex;gap:6px;flex-wrap:wrap}.plugin-list{display:grid;gap:8px}.plugin-card{border:1px solid var(--rule);background:var(--surface-muted);padding:10px;display:grid;gap:6px}.plugin-card header{display:flex;flex-wrap:wrap;gap:6px;align-items:center}.plugin-card h3{margin:0;font-size:12px;flex:1}.plugin-status,.plugin-trust{font-size:10px;text-transform:uppercase;letter-spacing:.04em}.plugin-status.enabled{color:var(--success)}.plugin-status.disabled{color:var(--muted)}.plugin-status.invalid{color:var(--signal)}.plugin-counts{font-size:10px}.plugin-mcp,.plugin-findings,.plugin-hits,.plugin-panes ul{margin:0;padding-left:16px;font-size:10px}.plugin-review{border:1px solid var(--border-focus);background:var(--surface);padding:10px;display:grid;gap:6px;margin-bottom:10px}.plugin-review h3{margin:0;font-size:12px}.plugin-summary{margin:0;max-height:160px;overflow:auto;background:var(--code-bg);border:1px solid var(--border-muted);padding:8px;font-size:10px;white-space:pre-wrap}.plugin-pane-host{margin-top:12px;border:1px solid var(--rule);background:var(--surface)}.plugin-pane-body{padding:10px}.plugin-card-actions .danger{color:var(--danger);border-color:color-mix(in srgb,var(--danger) 40%,var(--rule))}.error-text{color:var(--signal);margin:0;font-size:11px}.warning-text{color:var(--warning);margin:0;font-size:11px}.pane-list-btn{background:none;border:0;color:inherit;font:inherit;text-align:left;padding:0;cursor:pointer}.pane-meter-track{flex:1;height:6px;background:var(--ground);border-radius:var(--radius);overflow:hidden}.pane-meter-fill{height:100%;background:var(--acid)}.pane-meter-fill.tone-success{background:var(--success)}.pane-meter-fill.tone-warning{background:var(--warning)}.pane-meter-fill.tone-error{background:var(--signal)}.pane-meter-fill.tone-danger{background:var(--danger)}.pane-divider{border:0;border-top:1px solid var(--rule);margin:6px 0}.pane-spacer{width:100%}.palette-trigger{margin-left:auto;display:inline-flex;align-items:center;gap:6px;border:1px solid var(--rule);background:transparent;padding:4px 10px;border-radius:var(--radius);cursor:pointer;font-size:12px;color:var(--muted);flex:0 1 auto;min-width:0;overflow:hidden}.palette-trigger kbd{font-size:10px}.palette-input{width:100%;padding:10px 12px;border:1px solid var(--rule);background:var(--code-bg);color:var(--ink);border-radius:var(--radius);margin-bottom:10px}.palette-list{list-style:none;margin:0;padding:0;max-height:360px;overflow:auto;display:grid;gap:0}.palette-hint{margin:8px 0 0;font-size:11px}.onboard-hint{display:flex;flex-wrap:wrap;justify-content:space-between;gap:12px;align-items:center;padding:8px 12px;border:1px solid var(--rule);border-radius:var(--radius);background:color-mix(in srgb,var(--acid) 8%,transparent);margin:0 0 8px;font-size:12px;min-width:0}.onboard-hint p{margin:0}.team-workspace{display:grid;gap:var(--gutter);min-width:0}.team-workspace-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px;min-width:0}.team-workspace-head h2{margin:0;min-width:0}.team-attention-entry{width:100%;text-align:left;padding:8px 10px;border:1px solid var(--rule);background:color-mix(in srgb,var(--acid) 8%,transparent);cursor:pointer;border-radius:var(--radius);font-weight:600}.team-attention ul{list-style:none;margin:8px 0 0;padding:0;display:grid;gap:4px}.team-attention li button{width:100%;display:flex;gap:8px;align-items:flex-start;text-align:left;padding:8px;border:1px solid var(--rule);background:var(--code-bg);cursor:pointer;border-radius:var(--radius)}.team-attention li strong{display:block}.team-attention li small{display:block;color:var(--muted)}.team-view-tabs,.team-filters{display:inline-flex;flex-wrap:wrap;gap:0;max-width:100%;border:1px solid var(--rule);background:var(--surface-muted)}.team-view-tabs button,.team-filters button{border:0;border-right:1px solid var(--rule);background:transparent;padding:4px 10px;border-radius:0;cursor:pointer;font-size:12px;text-transform:capitalize}.team-view-tabs button:last-child,.team-filters button:last-child{border-right:0}.team-view-tabs button.active,.team-filters button.active,.team-view-tabs button[aria-selected=true],.team-filters button[aria-pressed=true]{background:var(--acid);color:var(--mark-ink);border-color:var(--ink)}.team-roster{list-style:none;margin:0;padding:0;display:grid;gap:4px}.team-detail{border:1px solid var(--rule);padding:10px;border-radius:var(--radius);background:var(--code-bg)}.team-detail header{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px;min-width:0}.team-detail h3{margin:0}.team-detail dl{display:grid;grid-template-columns:auto 1fr;gap:4px 10px;margin:8px 0;font-size:12px}.team-detail dt{color:var(--muted)}.team-detail dd{margin:0}.team-files{margin:0;padding-left:16px}.team-detail-actions{display:flex;gap:8px}.team-board{display:flex;gap:10px;overflow-x:auto;padding-bottom:8px;scroll-snap-type:x mandatory}.team-board-col{min-width:160px;max-width:220px;flex:0 0 auto;border:1px solid var(--rule);border-radius:var(--radius);padding:8px;scroll-snap-align:start;background:var(--code-bg)}.team-board-col h4{margin:0 0 8px;font-size:12px;text-transform:capitalize}.team-board-col ul{list-style:none;margin:0;padding:0;display:grid;gap:6px}.team-board-card{width:100%;text-align:left;display:grid;gap:4px;border:1px solid var(--rule);background:var(--ground);padding:8px;border-radius:var(--radius)}.team-board-card-main{width:100%;text-align:left;display:grid;gap:2px;border:0;background:transparent;padding:0;cursor:pointer;color:inherit}.team-board-actions,.team-control-row{display:flex;flex-wrap:wrap;gap:6px}.team-board-actions button,.team-control-row button,.team-controls-inline button{border:1px solid var(--rule);background:transparent;padding:4px 8px;border-radius:var(--radius);cursor:pointer;font-size:12px}.team-board-actions button:disabled,.team-control-row button:disabled{opacity:.5;cursor:not-allowed}.team-board-reason{font-size:11px;color:var(--muted)}.team-messages{list-style:none;margin:0;padding:0;display:grid;gap:8px}.team-messages li{display:grid;gap:2px;padding:8px;border:1px solid var(--rule);border-radius:var(--radius)}.team-control-status{margin:0;padding:8px 10px;border-radius:var(--radius);font-size:12px;border:1px solid var(--rule);background:color-mix(in srgb,var(--acid) 10%,transparent)}.team-controls{display:grid;gap:12px}.team-control-block{border:1px solid var(--rule);border-radius:var(--radius);padding:10px;display:grid;gap:8px;margin:0;background:var(--code-bg)}.team-control-block legend{padding:0 4px;font-weight:600}.team-control-block label{display:grid;gap:4px;font-size:12px;color:var(--muted)}.team-control-block input,.team-control-block textarea,.team-control-block select{width:100%;border:1px solid var(--rule);border-radius:var(--radius);background:var(--ground);color:var(--ink);padding:6px 8px;font:inherit}.team-control-block button.primary{justify-self:start;background:var(--acid);color:var(--mark-ink);border-color:var(--ink);padding:6px 12px;border-radius:var(--radius);cursor:pointer}.team-control-block button.linkish{justify-self:start;border:0;background:transparent;color:var(--acid);cursor:pointer;padding:0;text-align:left}.team-control-advanced{display:grid;gap:8px}.team-local-board{list-style:none;margin:0;padding:0;display:grid;gap:8px}.team-local-board li{display:grid;gap:4px;padding:8px;border:1px solid var(--rule);border-radius:var(--radius);background:var(--ground)}.team-controls-inline{margin-top:8px}@media(max-width:720px){.team-board{flex-direction:column;overflow-x:visible}.team-board-col{min-width:0;max-width:none;width:100%}.team-control-block{padding:8px}}.tool-card summary{display:flex;flex-wrap:wrap;gap:8px;align-items:center;cursor:pointer;padding:8px 10px}.tool-name{font-weight:600;font-family:var(--mono, ui-monospace, monospace)}.tool-state{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted)}.tool-state-running{color:var(--accent-alt)}.tool-state-done{color:var(--success)}.tool-state-error{color:var(--signal)}.tool-state-denied{color:var(--warning)}.tool-duration{color:var(--muted)}.tool-args{padding:8px 10px;border-top:1px solid var(--rule)}.tool-args pre,.tool-output{margin:0;max-height:280px;overflow:auto;font-size:11px}.diff-viewer{border-top:1px solid var(--rule)}.diff-toolbar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:6px 10px;font-size:11px}.diff-wrap{display:inline-flex;gap:4px;align-items:center;color:var(--muted)}.diff.wrap{white-space:pre-wrap;word-break:break-word}.diff .hunk{color:var(--muted)}.copy-btn{font-size:10px;padding:2px 6px}button.file-ref{background:none;border:0;padding:0;color:var(--acid);cursor:pointer;text-decoration:underline;font:inherit}.exploration-group summary{cursor:pointer;padding:8px 10px;display:flex;gap:8px;align-items:center}.exploration-body{display:grid;gap:6px;padding:0 8px 8px}.semantic-event p{margin:0;color:var(--text)}.jump-latest{position:sticky;bottom:12px;margin:0 auto;display:block;z-index:2;padding:8px 14px;border-radius:var(--radius);border:1px solid var(--rule);background:var(--panel, var(--bg));cursor:pointer}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.code-block figcaption{display:flex;justify-content:space-between;align-items:center;gap:8px}.provider-rows{display:flex;flex-direction:column;gap:.5rem;margin-bottom:.75rem}.provider-row{border:1px solid var(--rule);border-radius:var(--radius);padding:.5rem .75rem;background:var(--surface-muted)}.provider-row header{display:flex;justify-content:space-between;align-items:center;gap:.5rem}.provider-row .badge{font-size:.75rem;padding:.1rem .4rem;border-radius:var(--radius);background:var(--surface);border:1px solid var(--rule)}.provider-row .badge.ok{border-color:var(--success);color:var(--success)}.model-meta ul{margin:.25rem 0 0;padding-left:1.1rem}.device-flow,.oauth-flow{margin-top:.5rem;padding:.5rem;border:1px dashed var(--rule);border-radius:var(--radius)}.custom-provider-list{list-style:none;padding:0;margin:0 0 .5rem}.custom-provider-list li{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center;margin-bottom:.35rem}.code-explorer{display:grid;gap:10px;min-width:0}.code-explorer-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px;min-width:0}.code-explorer-head h2{margin:0;min-width:0}.code-view-tabs,.code-md-toggle{display:inline-flex;gap:0;border:1px solid var(--rule);background:var(--surface-muted)}.code-view-tabs{margin-left:auto}.code-view-tabs button,.code-md-toggle button{border:0;border-right:1px solid var(--rule);background:transparent;padding:4px 10px;border-radius:0;cursor:pointer;font-size:12px}.code-view-tabs button:last-child,.code-md-toggle button:last-child{border-right:0}.code-view-tabs button.active,.code-md-toggle button.active{background:var(--acid);color:var(--mark-ink);border-color:var(--ink)}.code-explorer-body{display:grid;grid-template-columns:minmax(0,240px) minmax(0,1fr);gap:var(--gutter);min-height:280px;min-width:0}.code-sidebar{display:grid;gap:8px;align-content:start;min-width:0}.code-search{display:flex;gap:6px;align-items:center;min-width:0}.code-search input{flex:1;min-width:0;border:1px solid var(--rule);border-radius:var(--radius);background:var(--ground);color:var(--ink);padding:6px 8px;font:inherit}.code-breadcrumbs{font-size:12px;color:var(--muted)}.code-breadcrumbs button{border:0;background:transparent;color:var(--acid);cursor:pointer;padding:0}.code-tree,.code-search-hits{list-style:none;margin:0;padding:0;display:grid;gap:2px;max-height:360px;overflow:auto}.code-tree button,.code-search-hits button{width:100%;text-align:left;border:1px solid transparent;background:transparent;padding:4px 6px;border-radius:var(--radius);cursor:pointer;color:inherit;font:inherit}.code-tree button:hover,.code-search-hits button:hover,.code-tree button.active{border-color:var(--rule);background:var(--code-bg)}.code-viewer{border:1px solid var(--rule);border-radius:var(--radius);padding:10px;background:var(--code-bg);min-width:0;overflow:auto}.code-viewer-head{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:8px}.code-viewer-head h3{margin:0;font-size:13px;word-break:break-all}.code-raw{margin:0;font-family:var(--mono, ui-monospace, monospace);font-size:12px;line-height:1.45}.code-line{display:grid;grid-template-columns:3em 1fr;gap:8px}.code-line.focus{background:color-mix(in srgb,var(--acid) 18%,transparent)}.code-gutter{color:var(--muted);text-align:right;-webkit-user-select:none;user-select:none}.code-text{white-space:pre-wrap;word-break:break-word}.code-md-preview{font-size:13px;line-height:1.5}.code-md-preview h2,.code-md-preview h3,.code-md-preview h4{margin:.8em 0 .3em}.code-md-preview p{margin:.4em 0}.code-md-preview pre.md-code{overflow:auto;padding:8px;border-radius:var(--radius);background:var(--ground);border:1px solid var(--rule)}@media(max-width:720px){.code-explorer-body{grid-template-columns:1fr}.code-tree,.code-search-hits{max-height:200px}}.code-apply{margin-top:12px;border:1px solid var(--rule);border-radius:var(--radius);padding:10px;display:grid;gap:8px;background:var(--ground)}.code-apply legend{font-weight:600;padding:0 4px}.code-apply label{display:grid;gap:4px;font-size:12px;color:var(--muted)}.code-apply textarea{width:100%;border:1px solid var(--rule);border-radius:var(--radius);background:var(--code-bg);color:var(--ink);padding:6px 8px;font:inherit}.code-apply button.primary{justify-self:start;background:var(--acid);color:var(--mark-ink);border:1px solid var(--ink);border-radius:var(--radius);padding:6px 12px;cursor:pointer}.code-apply button.primary:disabled{opacity:.5;cursor:not-allowed}.code-apply-preview{max-height:160px;overflow:auto}.review-panel{display:grid;gap:10px}.review-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.review-head h2{margin:0}.review-tabs{display:inline-flex;gap:0;margin-left:auto;border:1px solid var(--rule);background:var(--surface-muted)}.review-tabs button,.review-filter select,.review-head button{border:1px solid var(--rule);background:transparent;padding:4px 10px;border-radius:var(--radius);cursor:pointer;font-size:12px;color:inherit}.review-tabs button{border:0;border-right:1px solid var(--rule);border-radius:0}.review-tabs button:last-child{border-right:0}.review-tabs button.active{background:var(--acid);color:var(--mark-ink);border-color:var(--ink)}.review-filter{display:flex;gap:8px;align-items:center;font-size:12px;color:var(--muted)}.review-list{list-style:none;margin:0;padding:0;display:grid;gap:6px}.review-list>li>button{width:100%;text-align:left;display:grid;gap:2px;border:1px solid var(--rule);background:var(--code-bg);padding:8px;border-radius:var(--radius);cursor:pointer;color:inherit}.review-list>li>button.active{border-color:var(--acid)}.review-detail{border:1px solid var(--rule);border-radius:var(--radius);padding:10px;background:var(--code-bg)}.review-detail header{display:flex;justify-content:space-between;align-items:center}.review-detail h3{margin:0}.review-detail dl{display:grid;grid-template-columns:auto 1fr;gap:4px 10px;font-size:12px}.review-detail dt{color:var(--muted)}.review-detail dd{margin:0}.review-content{max-height:280px;overflow:auto;padding:8px;border-radius:var(--radius);background:var(--ground);border:1px solid var(--rule);font-size:12px;white-space:pre-wrap}.review-paths{margin:4px 0 0;padding-left:16px}.ledger-row{border:1px solid var(--rule);border-radius:var(--radius);padding:8px;background:var(--code-bg)}.ledger-row-head{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin-bottom:4px}.ledger-meta{font-size:11px}button.linkish{border:0;background:transparent;color:var(--acid);cursor:pointer;padding:0;font:inherit}@media(max-width:720px){.review-content{max-height:200px}}.virtual-list{position:relative;min-height:0}.virtual-list-spacer{width:100%}.transcript-list{min-height:0}.team-roster{max-height:min(60vh,520px);overflow:auto}
diff --git a/internal/frontend/server/static/assets/index-CGmIsvaq.css b/internal/frontend/server/static/assets/index-CGmIsvaq.css
deleted file mode 100644
index be144339..00000000
--- a/internal/frontend/server/static/assets/index-CGmIsvaq.css
+++ /dev/null
@@ -1 +0,0 @@
-:root{color-scheme:dark light;--ink: #f3f1fa;--muted: #9b99b0;--acid: #7c3aed;--accent-alt: #22d3ee;--highlight: #ddd6fe;--success: #4ade80;--warning: #fbbf24;--signal: #fb7185;--danger: #fb923c;--ground: #14131c;--surface: #232230;--raised: #2e2c3e;--surface-muted: #1a1924;--rule: #4f4d63;--border-focus: #7c3aed;--border-muted: #2c2a3a;--user: #22d3ee;--tool: #7dd3fc;--diff-add: #4ade80;--diff-del: #fb7185;--overlay: #7c7a90;--code-bg: #1a1924;--mark-ink: #14131c;--header-bg: #14131ce8;--glow: #7c3aed66;--idle: #4f4d63;--cap-border: #4f4d63;--shadow: #00000088;--diff-add-bg: #1a2a22;--diff-del-bg: #2a1a1c;--unavailable-bg: #2a1a1c;--text: var(--ink);--bg: var(--ground);--border: var(--rule);--panel: var(--surface);--accent: var(--acid);--warn: var(--warning);font-family:SFMono-Regular,Cascadia Code,Liberation Mono,monospace;background:var(--ground);color:var(--ink)}:root[data-appearance=dark]{color-scheme:dark;--ink: #f3f1fa;--muted: #9b99b0;--acid: #7c3aed;--accent-alt: #22d3ee;--highlight: #ddd6fe;--success: #4ade80;--warning: #fbbf24;--signal: #fb7185;--danger: #fb923c;--ground: #14131c;--surface: #232230;--raised: #2e2c3e;--surface-muted: #1a1924;--rule: #4f4d63;--border-focus: #7c3aed;--border-muted: #2c2a3a;--user: #22d3ee;--tool: #7dd3fc;--diff-add: #4ade80;--diff-del: #fb7185;--overlay: #7c7a90;--code-bg: #1a1924;--mark-ink: #14131c;--header-bg: #14131ce8;--glow: #7c3aed66;--idle: #4f4d63;--cap-border: #4f4d63;--shadow: #00000088;--diff-add-bg: #1a2a22;--diff-del-bg: #2a1a1c;--unavailable-bg: #2a1a1c}:root[data-appearance=light]{color-scheme:light;--ink: #1a1528;--muted: #5c586e;--acid: #5b21b6;--accent-alt: #0e7490;--highlight: #4c1d95;--success: #15803d;--warning: #b45309;--signal: #e11d48;--danger: #ea580c;--ground: #ffffff;--surface: #f3eef9;--raised: #e9e0f7;--surface-muted: #f8f5fc;--rule: #c4bfd4;--border-focus: #5b21b6;--border-muted: #ddd8ea;--user: #0e7490;--tool: #2563eb;--diff-add: #15803d;--diff-del: #e11d48;--overlay: #a8a3b8;--code-bg: #f8f5fc;--mark-ink: #ffffff;--header-bg: #fffffff0;--glow: #5b21b666;--idle: #c4bfd4;--cap-border: #c4bfd4;--shadow: #1a152833;--diff-add-bg: #e8f5ec;--diff-del-bg: #f8e8e8;--unavailable-bg: #f8e8e8}@media(prefers-color-scheme:light){:root{--ink: #1a1528;--muted: #5c586e;--acid: #5b21b6;--accent-alt: #0e7490;--highlight: #4c1d95;--success: #15803d;--warning: #b45309;--signal: #e11d48;--danger: #ea580c;--ground: #ffffff;--surface: #f3eef9;--raised: #e9e0f7;--surface-muted: #f8f5fc;--rule: #c4bfd4;--border-focus: #5b21b6;--border-muted: #ddd8ea;--user: #0e7490;--tool: #2563eb;--diff-add: #15803d;--diff-del: #e11d48;--overlay: #a8a3b8;--code-bg: #f8f5fc;--mark-ink: #ffffff;--header-bg: #fffffff0;--glow: #5b21b666;--idle: #c4bfd4;--cap-border: #c4bfd4;--shadow: #1a152833;--diff-add-bg: #e8f5ec;--diff-del-bg: #f8e8e8;--unavailable-bg: #f8e8e8}:root[data-appearance=dark]{color-scheme:dark;--ink: #f3f1fa;--muted: #9b99b0;--acid: #7c3aed;--accent-alt: #22d3ee;--highlight: #ddd6fe;--success: #4ade80;--warning: #fbbf24;--signal: #fb7185;--danger: #fb923c;--ground: #14131c;--surface: #232230;--raised: #2e2c3e;--surface-muted: #1a1924;--rule: #4f4d63;--border-focus: #7c3aed;--border-muted: #2c2a3a;--user: #22d3ee;--tool: #7dd3fc;--diff-add: #4ade80;--diff-del: #fb7185;--overlay: #7c7a90;--code-bg: #1a1924;--mark-ink: #14131c;--header-bg: #14131ce8;--glow: #7c3aed66;--idle: #4f4d63;--cap-border: #4f4d63;--shadow: #00000088;--diff-add-bg: #1a2a22;--diff-del-bg: #2a1a1c;--unavailable-bg: #2a1a1c}}:root{--control-pad-y: 7px;--control-pad-x: 12px;--control-min-h: 28px;--touch-min: 44px;--focus-ring: 2px solid var(--acid);--focus-offset: 2px;--radius: 2px;--header-height: 52px;--gutter: 12px;--pane-min: 180px;--mode-bar-height: 56px}*{box-sizing:border-box}body{margin:0;min-width:320px;min-height:100vh;background:var(--ground)}button,select,textarea,input{font:inherit;color:inherit}button,select,input,textarea{border:1px solid var(--rule);background:var(--surface);border-radius:var(--radius)}button{cursor:pointer;min-height:var(--control-min-h)}button:hover:not(:disabled),button:focus-visible{border-color:var(--acid);color:var(--acid)}button:disabled,select:disabled,input:disabled,textarea:disabled{opacity:.45;cursor:not-allowed}:focus-visible{outline:var(--focus-ring);outline-offset:var(--focus-offset)}.ui-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:var(--control-pad-y) var(--control-pad-x);border:1px solid var(--rule);background:var(--surface);color:var(--ink);font-size:11px;line-height:1.2;border-radius:var(--radius)}.ui-btn:hover:not(:disabled),.ui-btn:focus-visible{border-color:var(--border-focus);color:var(--acid)}.ui-btn-primary{background:var(--acid);border-color:var(--acid);color:var(--mark-ink);font-weight:600;text-transform:uppercase;letter-spacing:.04em;font-size:10px}.ui-btn-primary:hover:not(:disabled),.ui-btn-primary:focus-visible{color:var(--mark-ink);filter:brightness(1.05);border-color:var(--border-focus)}.ui-btn-danger{color:var(--danger);border-color:color-mix(in srgb,var(--danger) 45%,var(--rule))}.ui-btn-ghost,.ui-btn-icon{border-color:transparent;background:transparent}.ui-btn-icon,.icon-button{border:0;background:transparent;font-size:18px;padding:8px;min-width:var(--control-min-h);min-height:var(--control-min-h);line-height:1;flex-shrink:0}.ui-btn-sm{padding:4px 8px;font-size:10px;min-height:24px}.ui-btn-touch{min-height:var(--touch-min);min-width:var(--touch-min);padding:10px 14px}.ui-dialog{width:min(560px,calc(100vw - 32px));max-height:min(88vh,900px);overflow:auto;border:1px solid var(--rule);background:var(--surface);padding:28px;color:var(--ink);position:relative;border-radius:var(--radius)}.ui-dialog-wide{width:min(720px,calc(100vw - 24px))}.ui-dialog::backdrop{background:color-mix(in srgb,var(--overlay) 85%,#000)}.ui-dialog-blocking{border-color:var(--warning)}.ui-dialog h2{font-size:30px;margin:0 0 20px}.ui-dialog-body{min-width:0}.settings-dialog,.workflow-dialog,.sandbox-explain-dialog,.undo-dialog{position:relative}.ui-tabs{display:flex;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;border-bottom:1px solid var(--rule);gap:0;scrollbar-width:thin}.ui-tab{flex:0 0 auto;min-width:max-content;white-space:nowrap;border:0;border-bottom:2px solid transparent;background:transparent;padding:10px 12px;text-transform:uppercase;font-size:11px;letter-spacing:.04em;color:var(--muted);border-radius:0;min-height:var(--control-min-h)}.ui-tab[aria-selected=true]{border-bottom-color:var(--acid);color:var(--acid)}.ui-tab:disabled{opacity:.35}.ui-tabpanel{min-width:0}.inspector-tabs{display:flex;flex-wrap:wrap;align-content:flex-start;flex:0 0 auto;width:100%;min-width:0;overflow-x:hidden;overflow-y:auto;max-height:40vh;border-bottom:1px solid var(--rule);scrollbar-width:thin}.inspector-tabs .ui-tab,.inspector-tabs button{flex:0 0 auto;min-width:max-content;white-space:nowrap;border:0;border-bottom:2px solid transparent;background:transparent;padding:10px 12px;text-transform:uppercase;font-size:11px;color:var(--muted)}.inspector-tabs .ui-tab[aria-selected=true],.inspector-tabs button[aria-selected=true]{border-bottom-color:var(--acid);color:var(--acid)}.ui-status{display:inline-flex;align-items:center;gap:6px;font-size:10px;letter-spacing:.04em;text-transform:uppercase;color:var(--muted)}.ui-status-dot,.ui-status-dot-alone{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--idle);flex-shrink:0}.ui-status-busy .ui-status-dot,.ui-status-dot-alone.ui-status-busy{background:var(--accent-alt)}.ui-status-blocked .ui-status-dot,.ui-status-dot-alone.ui-status-blocked,.ui-status-needs-you .ui-status-dot,.ui-status-dot-alone.ui-status-needs-you{background:var(--warning)}.ui-status-failed .ui-status-dot,.ui-status-dot-alone.ui-status-failed{background:var(--signal)}.ui-status-complete .ui-status-dot,.ui-status-dot-alone.ui-status-complete{background:var(--success)}.ui-status-canceled .ui-status-dot,.ui-status-unknown .ui-status-dot,.ui-status-dot-alone.ui-status-canceled,.ui-status-dot-alone.ui-status-unknown{background:var(--muted)}.ui-status-label{color:inherit}.ui-status-busy{color:var(--accent-alt)}.ui-status-blocked,.ui-status-needs-you{color:var(--warning)}.ui-status-failed{color:var(--signal)}.ui-status-complete{color:var(--success)}.ui-notice{border-left:3px solid var(--acid);padding:12px;background:var(--surface-muted);display:grid;gap:6px}.ui-notice-title{font-size:12px}.ui-notice-body{color:var(--muted);font-size:11px;line-height:1.5}.ui-notice-body p{margin:0}.ui-notice-success{border-left-color:var(--success)}.ui-notice-warning{border-left-color:var(--warning)}.ui-notice-error{border-left-color:var(--signal);background:var(--unavailable-bg)}.ui-notice-unavailable,.unavailable{border-left:3px solid var(--signal);padding:12px;background:var(--unavailable-bg)}.ui-notice-unavailable strong,.unavailable strong{color:var(--signal)}.ui-loading-indicator{display:inline-block;width:10px;height:10px;border-radius:50%;background:var(--accent-alt);animation:pulse 1.2s infinite}.ui-list-row,.palette-list button,.completion button{width:100%;display:flex;align-items:baseline;gap:8px;text-align:left;border:0;padding:6px 10px;background:transparent;font-size:12px;font-weight:inherit;color:inherit;cursor:pointer;border-radius:0;text-transform:none}.ui-list-row:hover,.ui-list-row.active,.ui-list-row[aria-selected=true],.palette-list button:hover,.palette-list button.active,.palette-list button[aria-selected=true],.completion button:hover,.completion button.active,.completion button[aria-selected=true]{background:var(--raised);box-shadow:inset 2px 0 0 var(--acid)}.ui-list-row-main{flex:1;min-width:0;display:flex;flex-direction:row;align-items:baseline;gap:8px;overflow:hidden}.ui-list-row-title,.completion button strong{flex:0 1 auto;min-width:0;font-weight:inherit;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-list-row-meta,.completion span{flex:1 1 auto;min-width:0;font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-list-row-trailing{display:flex;flex-direction:column;align-items:flex-end;gap:2px;flex-shrink:0}@media(max-width:720px){:root{--control-min-h: var(--touch-min);--control-pad-y: 10px;--control-pad-x: 14px}.ui-btn:not(.ui-btn-sm):not(.ui-btn-icon):not(.icon-button){min-height:var(--touch-min)}.ui-tab{min-height:40px;padding:12px;font-size:12px}}.app-shell{display:grid;grid-template:var(--header-height) minmax(0,1fr) / minmax(0,var(--nav-width, 240px)) minmax(0,1fr) minmax(0,var(--inspector-width, 340px));height:100vh;height:100dvh;max-width:100vw;overflow:hidden;padding-left:env(safe-area-inset-left,0px);padding-right:env(safe-area-inset-right,0px)}.app-shell[data-shell=phone]{grid-template:auto minmax(0,1fr) auto / minmax(0,1fr);padding-bottom:env(safe-area-inset-bottom,0px)}.app-shell[data-shell=tablet]{grid-template-columns:minmax(0,1fr);grid-template-rows:var(--header-height) minmax(0,1fr)}header{grid-column:1 / -1;z-index:10;display:flex;align-items:center;gap:var(--gutter);border-bottom:1px solid var(--rule);background:var(--header-bg);padding:0 var(--gutter);padding-top:env(safe-area-inset-top,0px);min-height:calc(var(--header-height) + env(safe-area-inset-top,0px));min-width:0;z-index:4;position:sticky;top:0}.app-shell>header{overflow:hidden}.wordmark{display:flex;align-items:baseline;gap:9px;flex:0 1 202px;min-width:0;overflow:hidden;letter-spacing:.1em}.wordmark strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wordmark .mark{display:grid;place-items:center;width:27px;height:27px;background:var(--acid);color:var(--mark-ink);font-weight:700;transform:skew(-7deg)}.wordmark small{color:var(--muted);font-size:9px}.session-line{margin-left:auto;text-transform:uppercase;font-size:10px;color:var(--muted);flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mode-switch{display:flex;align-items:stretch;gap:0;margin-left:var(--gutter);padding:0;border:1px solid var(--rule);border-radius:var(--radius);background:var(--surface-muted);flex:0 1 auto;flex-shrink:1;min-width:0;overflow:auto}.mode-btn{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;border-right:1px solid var(--rule);background:transparent;color:var(--muted);font-size:10px;letter-spacing:.06em;text-transform:uppercase;padding:6px 10px;min-height:32px;border-radius:0;display:inline-flex;align-items:center;gap:6px;white-space:nowrap;cursor:pointer}.mode-btn:last-child{border-right:0}.mode-btn:hover,.mode-btn:focus-visible{color:var(--ink);outline:none;background:var(--surface)}.mode-btn.active{background:var(--acid);color:var(--mark-ink);font-weight:600}.mode-attn{width:6px;height:6px;border-radius:50%;background:var(--accent-alt);flex-shrink:0}.mode-attn.needs-you{background:var(--warning)}.surface-roster h2{font-size:12px;text-transform:uppercase;letter-spacing:.08em;margin:0 0 12px;color:var(--muted)}.pulse{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--idle);margin-right:8px}.pulse.busy{background:var(--accent-alt);animation:pulse 1.2s infinite}.navigation,.inspector{min-height:0;min-width:0;background:var(--surface);transition:width .16s ease,opacity .16s ease}.navigation{border-right:1px solid var(--rule);min-width:0;overflow:hidden;padding:18px var(--gutter);display:flex;flex-direction:column;gap:var(--gutter)}.aside-heading{display:flex;justify-content:space-between;font-size:10px;letter-spacing:.16em;color:var(--muted);padding:7px 8px}.session{width:100%;display:flex;align-items:center;gap:6px;text-align:left;border:0;border-left:2px solid transparent;padding:10px 9px;background:transparent;font-size:12px}.session.active{border-left-color:var(--acid);background:var(--raised);color:var(--acid)}.session small{font-size:8px;color:var(--acid)}.session-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.session-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-meta{font-size:9px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-flags{display:flex;flex-direction:column;align-items:flex-end;gap:2px;flex-shrink:0}.child-agents{display:grid;gap:0;min-height:0}.children{font-size:11px;padding:0 9px;display:grid;gap:2px}.child-row{display:flex;align-items:center;gap:6px;padding:4px 6px;border-radius:var(--radius);border:1px solid transparent;background:transparent;color:inherit;width:100%;text-align:left;cursor:pointer;font:inherit}.child-row:hover,.child-row.active{border-color:var(--rule);background:color-mix(in srgb,var(--surface) 80%,transparent)}.child-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.child-meta{display:flex;gap:4px;align-items:center;flex-shrink:0}.children small,.children p{color:var(--muted)}.child-state{width:6px;height:6px;border-radius:50%;background:var(--accent-alt);flex-shrink:0}.child-state.completed,.child-state.running{background:var(--success)}.child-state.failed,.child-state.interrupted{background:var(--signal)}.child-state.blocked,.child-state.finalizing,.child-state.escalating{background:var(--warning)}.child-state.canceled,.child-state.unknown{background:var(--muted)}.quality{font-size:9px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted)}.quality.complete{color:var(--success)}.quality.partial{color:var(--warning)}.quality.unavailable{color:var(--signal)}.child-detail{margin:6px 9px 10px;padding:8px;border:1px solid var(--rule);border-radius:var(--radius);display:grid;gap:6px;font-size:11px}.child-detail header{display:flex;justify-content:space-between;gap:8px;align-items:baseline}.child-detail h3{margin:0;font-size:12px;font-weight:600}.child-detail dl{display:grid;grid-template-columns:auto 1fr;gap:2px 8px;margin:0}.child-detail dt{color:var(--muted);font-size:9px;text-transform:uppercase}.child-detail dd{margin:0;overflow-wrap:anywhere}.child-detail code{font-size:10px}.child-prompt{margin:0;white-space:pre-wrap;font-size:10px}.child-detail-actions{display:flex;gap:6px}.child-detail-actions button{font:inherit;font-size:10px;padding:3px 8px;border-radius:var(--radius);border:1px solid var(--rule);background:transparent;color:inherit;cursor:pointer}.child-detail-actions button:hover{border-color:var(--border-focus);color:var(--acid)}.child-detail-note{margin:0;font-size:9px}.workspace-meta{margin-top:auto;border-top:1px solid var(--rule);padding:8px 8px 0;overflow:hidden;color:var(--muted);font-size:9px}.workspace-meta summary{cursor:pointer;list-style:none;letter-spacing:.14em;text-transform:uppercase;padding:6px 0;-webkit-user-select:none;user-select:none}.workspace-meta summary::-webkit-details-marker{display:none}.workspace-meta[open] summary{margin-bottom:6px}.workspace-meta span{display:block;color:var(--muted);font-size:9px;margin-top:6px}.workspace-meta code{display:block;font-size:10px;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}main{min-width:0;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto;overflow:hidden}.runtime{display:flex;gap:1px;border-bottom:1px solid var(--rule);background:var(--rule);overflow:auto;min-width:0}.runtime-explain{align-self:end;padding:6px 10px;font-size:10px;letter-spacing:.04em;text-transform:uppercase}.sandbox-explain-dialog{width:min(640px,calc(100vw - 24px))}.sandbox-summary{display:grid;grid-template-columns:auto 1fr;gap:6px 14px;margin:0 0 14px;font-size:12px}.sandbox-summary dt{color:var(--muted);margin:0}.sandbox-summary dd{margin:0;color:var(--ink)}.sandbox-explain{max-height:min(50vh,360px);overflow:auto;white-space:pre-wrap;word-break:break-word}.runtime-field{display:grid;gap:3px;min-width:130px;background:var(--surface);padding:7px 10px}.runtime-field span{color:var(--muted);text-transform:uppercase;font-size:8px;letter-spacing:.14em}.runtime-field select{border:0;padding:0;background:transparent;font-size:11px}.runtime-more{display:flex;align-items:stretch;flex:1 1 auto;min-width:0;background:var(--surface)}.runtime-disclosure{display:flex;flex-direction:column;justify-content:center;gap:2px;border:0;background:transparent;padding:7px 12px;min-width:110px;text-align:left;cursor:pointer;color:var(--ink);font:inherit}.runtime-disclosure>span:first-child{color:var(--muted);text-transform:uppercase;font-size:8px;letter-spacing:.14em}.runtime-summary{color:var(--ink);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:220px}.runtime-secondary{display:flex;gap:1px;flex:1 1 auto;min-width:0;background:var(--rule);border-left:1px solid var(--rule)}.runtime-status{display:flex;flex-wrap:wrap;gap:12px 18px;padding:6px 12px;background:var(--surface);border-top:1px solid var(--rule);color:var(--muted);font-size:10px;letter-spacing:.04em}.runtime-status span:before{content:"";display:inline-block;width:4px;height:4px;margin-right:8px;border-radius:50%;background:var(--acid);vertical-align:middle}.transcript{min-width:0;min-height:0;overflow:auto;padding:42px clamp(var(--gutter),6vw,80px);scrollbar-color:var(--rule) transparent}.empty-state{max-width:620px;margin:12vh auto 0}.empty-state span{color:var(--acid);font-size:10px;letter-spacing:.18em}.empty-state h1{font-size:clamp(42px,7vw,78px);line-height:.9;margin:18px 0;letter-spacing:-.04em}.empty-state p{color:var(--muted);max-width:530px;line-height:1.7;font-size:12px}.message{max-width:780px;margin:0 auto 28px;border-left:2px solid var(--rule);padding:0 0 0 18px}.message.user{border-color:var(--user)}.message.assistant{border-color:var(--acid)}.message.tool{border-color:var(--tool)}.message.reasoning{color:var(--muted)}.message.error{border-color:var(--signal)}.message-label{color:var(--muted);text-transform:uppercase;letter-spacing:.16em;font-size:9px;margin-bottom:8px}.message.user .message-label{color:var(--user)}.message.assistant .message-label{color:var(--acid)}.message.tool .message-label{color:var(--tool)}.message p{white-space:pre-wrap;line-height:1.7;margin:0;font-family:ui-monospace,monospace;font-size:13px}.message pre,.inspector pre,dialog pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:11px;line-height:1.55;background:var(--code-bg);padding:12px;border:1px solid var(--rule)}.composer{margin:0 clamp(var(--gutter),4vw,56px) 22px;border:1px solid var(--rule);background:var(--surface);position:relative;min-width:0}.composer label{display:block;padding:8px 12px;color:var(--muted);font-size:9px;text-transform:uppercase;letter-spacing:.16em;border-bottom:1px solid var(--rule)}.composer textarea{display:block;width:100%;min-height:88px;max-height:220px;resize:vertical;border:0;background:transparent;padding:14px;line-height:1.5}.composer-bar{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px;padding:8px;border-top:1px solid var(--rule);color:var(--muted);font-size:9px;min-width:0}.composer-bar>span{display:inline-flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0}.composer-send{background:var(--acid);color:var(--mark-ink);border-color:var(--acid);padding:7px 18px;text-transform:uppercase;font-size:10px;font-weight:600;flex-shrink:0}.composer-send:hover:not(:disabled),.composer-send:focus-visible{color:var(--mark-ink);border-color:var(--border-focus);filter:brightness(1.05)}.composer-bar .stop{background:var(--signal);border-color:var(--signal);color:var(--mark-ink)}.composer-send:disabled{opacity:.35;cursor:not-allowed}.composer-secondary{background:var(--surface);color:var(--ink);border-color:var(--rule);padding:7px 12px;text-transform:none;font-size:10px;font-weight:500}.composer-secondary:hover:not(:disabled),.composer-secondary:focus-visible{color:var(--acid);border-color:var(--acid);filter:none}.inspector{border-left:1px solid var(--rule);min-width:0;overflow:hidden;position:relative;display:flex;flex-direction:column}.session-group{flex:0 1 auto;max-height:55%;overflow:auto;padding:12px 16px 8px;border-bottom:1px solid var(--rule);display:flex;flex-direction:column;gap:12px;min-height:0}.session-group-pane{min-height:0}.session-group-facts{display:grid;grid-template-columns:auto 1fr;gap:2px 10px;margin:0;font-size:10px}.inspector .session-group-facts{margin:0;grid-template-columns:auto 1fr}.inspector .session-group-facts dt,.inspector .session-group-facts dd{margin:0;padding:2px 0;border:0}.session-group-facts dt{color:var(--muted);margin:0;padding:2px 0;border:0}.session-group-facts dd{margin:0;padding:2px 0;text-align:right;border:0;overflow-wrap:anywhere}.session-group-fit{font-size:10px;margin:8px 0 0;color:var(--warning)}.session-group-fit.critical{color:var(--signal)}.session-group-queue{margin:0}.session-group-queue .prompt-queue{padding-left:22px}.navigation.collapsed,.inspector.collapsed{opacity:0;pointer-events:none}.panel-resize{position:absolute;top:0;bottom:0;width:10px;z-index:2;display:flex;align-items:stretch;padding:0;margin:0;border:0;background:transparent}.panel-resize-nav{right:-5px;cursor:col-resize}.panel-resize-inspector{left:-5px;cursor:col-resize}.panel-resize-handle{flex:1;min-width:4px;background:transparent;transition:background .12s ease}.panel-resize:hover .panel-resize-handle,.panel-resize:focus-within .panel-resize-handle{background:color-mix(in srgb,var(--acid) 55%,transparent)}.inspector-body{flex:1;min-width:0;min-height:0;height:auto;overflow:auto;padding:20px var(--gutter)}.inspector h2{margin:8px 0 16px;font-family:Georgia,Times New Roman,serif;font-size:20px;font-weight:500}.inspector dl{display:grid;grid-template-columns:1fr 1fr;margin:0 0 30px;font-size:10px}.inspector dt,.inspector dd{margin:0;padding:8px 0;border-bottom:1px solid var(--rule)}.inspector dt{color:var(--muted)}.inspector dd{text-align:right;overflow-wrap:anywhere}.capabilities{display:flex;flex-wrap:wrap;gap:5px}.capabilities span{padding:4px 6px;border:1px solid var(--rule);color:var(--muted);font-size:8px;text-transform:uppercase}.capabilities span.enabled{color:var(--acid);border-color:var(--border-focus)}.muted{color:var(--muted);font-size:11px;line-height:1.5}.context-doctor-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}.context-doctor-head h2{margin:0}.context-doctor-actions{display:flex;gap:6px;flex-wrap:wrap}.context-doctor-actions button,.context-layer-actions button,.context-kind-row button{font-size:10px;padding:4px 8px;border:1px solid var(--rule);background:var(--surface-muted);color:var(--ink);cursor:pointer}.context-doctor-actions button:disabled,.context-layer-actions button:disabled,.context-kind-row button:disabled{opacity:.45;cursor:not-allowed}.context-fit-warning{border:1px solid var(--warning);background:color-mix(in srgb,var(--warning) 12%,var(--surface-muted));padding:10px;margin:0 0 12px;display:grid;gap:4px}.context-fit-warning.critical{border-color:var(--danger);background:color-mix(in srgb,var(--danger) 12%,var(--surface-muted))}.context-fit-warning strong{font-size:11px;text-transform:uppercase;letter-spacing:.08em}.context-fit-warning p{margin:0;font-size:12px;line-height:1.45}.context-fit-warning small{color:var(--muted);font-size:10px}.context-attribution,.context-layers,.context-sets,.context-kind-picker{margin-top:16px}.context-attribution h3,.context-layers h3,.context-sets h3,.context-kind-picker h3{margin:0 0 8px;font-size:11px;text-transform:uppercase;letter-spacing:.1em;color:var(--muted)}.context-table{width:100%;border-collapse:collapse;font-size:11px}.context-table th,.context-table td{text-align:left;padding:6px 4px;border-bottom:1px solid var(--rule);vertical-align:top}.context-table th{color:var(--muted);font-weight:500;font-size:10px;text-transform:uppercase;letter-spacing:.08em}.context-layer-actions{display:flex;flex-wrap:wrap;gap:4px}.context-sets p{margin:0 0 6px;font-size:11px;line-height:1.45}.context-kind-list{display:grid;gap:4px}.context-kind-row{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:6px 0;border-bottom:1px solid var(--rule);font-size:11px}.context-kind-row span{display:flex;gap:4px}.changed-files,.project-list{display:grid;gap:10px}.changed-file,.project-list article{border:1px solid var(--rule);background:var(--surface-muted);padding:10px}.changed-file>button{width:100%;display:flex;justify-content:space-between;align-items:center;gap:12px;border:0;background:transparent;padding:0;text-align:left}.diff-stat{display:flex;gap:8px;font-size:10px}.diff-stat b:first-child{color:var(--diff-add)}.diff-stat b:last-child{color:var(--diff-del)}.diff-view{margin:10px 0 0;max-height:360px;overflow:auto;background:var(--code-bg);border:1px solid var(--rule);padding:10px;font-size:10px;white-space:pre-wrap}.project-list h3{margin:0 0 8px;font-size:12px;overflow-wrap:anywhere}.project-list p{margin:0 0 8px;color:var(--muted);font-size:11px;line-height:1.5;white-space:pre-wrap}.project-list small{color:var(--acid);text-transform:uppercase;font-size:8px;letter-spacing:.12em}.diagnostics-heading{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:4px}.diagnostics-heading h2{margin:8px 0 16px}.diagnostics-subhead{margin:18px 0 10px;font-size:9px;letter-spacing:.14em;text-transform:uppercase;color:var(--muted)}.diagnostics-actions{display:flex;flex-wrap:wrap;gap:6px}.diagnostics-actions button{border:1px solid var(--rule);background:var(--surface-muted);color:var(--ink);padding:5px 8px;font-size:10px;text-transform:uppercase;letter-spacing:.08em}.diagnostics-actions button:disabled{opacity:.45}.lsp-server header,.diagnostic-item header{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}.lsp-server header h3,.diagnostic-item header code{margin:0}.lsp-state,.diag-severity{flex-shrink:0;padding:2px 6px;border:1px solid var(--rule);font-size:8px;letter-spacing:.12em;text-transform:uppercase}.lsp-state.state-up,.diag-severity.sev-info{color:var(--success);border-color:color-mix(in srgb,var(--success) 50%,var(--rule))}.lsp-state.state-error,.diag-severity.sev-error{color:var(--signal);border-color:color-mix(in srgb,var(--signal) 50%,var(--rule))}.lsp-state.state-down,.diag-severity.sev-warning{color:var(--warning);border-color:color-mix(in srgb,var(--warning) 50%,var(--rule))}.lsp-state.state-disabled,.diag-severity.sev-hint{color:var(--muted)}.lsp-error{color:var(--signal)!important}.diagnostic-item header code{font-size:11px;overflow-wrap:anywhere}.diagnostics-list .diagnostic-item p{margin-bottom:4px;color:var(--ink)}dialog{width:min(560px,calc(100vw - 32px));border:1px solid var(--rule);background:var(--surface);padding:28px;color:var(--ink)}.dialog-rule{position:absolute;left:0;top:0;width:7px;height:100%;background:var(--acid)}dialog::backdrop{background:color-mix(in srgb,var(--overlay) 85%,#000)}dialog h2{font-size:30px;margin:0 0 20px}dialog label{display:grid;gap:7px;color:var(--muted);font-size:10px}dialog input{padding:12px;color:var(--ink)}.dialog-actions{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px;margin-top:22px}.dialog-actions button{padding:9px 14px}.permission-tool{margin:0 0 10px;font-size:15px}.permission-patterns{margin:0 0 14px;padding-left:1.2em;display:grid;gap:6px}.permission-patterns code{display:inline-block;padding:2px 6px;border-radius:var(--radius);background:var(--code-bg);color:var(--tool);font-size:12px;word-break:break-all}.permission-explain{display:grid;gap:10px;margin:12px 0 4px}.permission-explain button{justify-self:start;padding:7px 12px;font-size:12px;color:var(--muted);border:1px solid var(--rule);background:var(--surface-muted)}.permission-explain-body{margin:0;padding:12px;border-radius:var(--radius);background:var(--code-bg);color:var(--ink);font-size:12px;white-space:pre-wrap;max-height:180px;overflow:auto}.permission-explain-error{margin:0;color:var(--signal);font-size:12px}.undo-dialog{width:min(560px,calc(100vw - 32px))}.undo-preview{display:grid;gap:6px;margin:0 0 18px;padding:12px 14px;border:1px solid var(--rule);background:color-mix(in srgb,var(--surface) 88%,var(--ink));font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;line-height:1.45;white-space:pre-wrap;overflow-wrap:anywhere}.undo-preview p{margin:0;color:var(--muted)}.undo-preview .undo-warn{color:var(--acid)}.undo-choices{display:grid;gap:8px}.undo-choice{display:grid;grid-template-columns:auto 1fr;gap:10px;align-items:start;margin:0;padding:12px 14px;border:1px solid var(--rule);cursor:pointer;color:var(--ink);font-size:12px}.undo-choice.active{border-color:var(--acid);background:color-mix(in srgb,var(--acid) 8%,transparent)}.undo-choice strong{display:block;text-transform:lowercase;letter-spacing:.02em}.undo-choice small{display:block;margin-top:4px;color:var(--muted);font-size:11px;line-height:1.4;font-weight:400}.undo-choice input{margin-top:3px}.mobile-only{display:none}@keyframes pulse{50%{opacity:.4}}@media(max-width:1023px){.app-shell{grid-template-columns:minmax(0,1fr);grid-template-rows:var(--header-height) minmax(0,1fr)}.app-shell main{min-width:0}.navigation{position:fixed;z-index:5;top:calc(var(--header-height) + env(safe-area-inset-top,0px));bottom:0;left:0;width:min(var(--nav-width, 280px),88vw);max-width:100vw;transform:translate(-100%);transition:transform .2s ease;box-shadow:none;padding-bottom:env(safe-area-inset-bottom,0px)}.navigation.open{transform:translate(0)}.inspector{position:fixed;right:0;top:calc(var(--header-height) + env(safe-area-inset-top,0px));bottom:0;width:min(var(--inspector-width, 360px),92vw);max-width:100vw;z-index:6;transform:translate(100%);transition:transform .2s ease;box-shadow:none;padding-bottom:env(safe-area-inset-bottom,0px)}.inspector.open{transform:translate(0)}.panel-resize{display:none}.shell-backdrop{display:none;position:fixed;top:0;right:0;bottom:0;left:0;top:calc(var(--header-height) + env(safe-area-inset-top,0px));background:color-mix(in srgb,var(--overlay) 55%,transparent);z-index:4;border:0;padding:0;cursor:pointer}.shell-backdrop.visible{display:block}}@media(max-width:599px){.app-shell{display:grid;grid-template:auto minmax(0,1fr) auto / minmax(0,1fr)}.mobile-only{display:block}.wordmark{flex-basis:auto;width:auto}.wordmark strong{font-size:12px}.wordmark small{display:none}header{flex-wrap:nowrap;gap:6px;padding:0 8px;padding-top:env(safe-area-inset-top,0px);overflow:hidden}.header-mode-switch{display:none!important}.palette-trigger{max-width:5.5rem}.palette-trigger kbd{display:none}header .icon-button[aria-label="Export markdown"]{display:none}.session-line{font-size:0;margin-left:auto;display:flex;align-items:center;gap:6px;min-width:0;flex:0 1 auto}.session-line .pulse{margin:0}.session-line .attention-summary{font-size:9px;max-width:9em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:4px 8px;min-height:32px}.runtime{max-width:100%}.runtime-stack{padding:0 4px}.transcript{padding:16px 12px 12px}.composer{margin:0;border-radius:0;border-left:0;border-right:0;padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px));position:sticky;bottom:0;background:var(--surface);z-index:2}.composer textarea{min-height:44px;font-size:16px}.composer-bar button,.composer .queue-toolbar button{min-height:44px;min-width:44px;padding:10px 12px}.empty-state{margin-top:4vh;padding:0 8px}.icon-button{min-width:44px;min-height:44px}.navigation,.inspector{top:auto;bottom:calc(var(--mode-bar-height) + env(safe-area-inset-bottom,0px));left:0;right:0;width:100%;max-height:min(78dvh,640px);border-top:1px solid var(--rule);border-radius:var(--radius) var(--radius) 0 0;transform:translateY(105%);box-shadow:none;padding-bottom:8px;z-index:8}.navigation.open,.inspector.open{transform:translateY(0)}.shell-backdrop{top:calc(var(--header-height) + env(safe-area-inset-top,0px));z-index:7}header{z-index:10}.mode-bottom-bar{display:flex;align-items:stretch;justify-content:space-around;gap:2px;border-top:1px solid var(--rule);background:var(--header-bg);padding:4px 4px calc(4px + env(safe-area-inset-bottom,0px));z-index:3}.mode-bottom-bar .mode-btn{flex:1;flex-direction:column;justify-content:center;gap:2px;min-height:48px;padding:6px 4px;font-size:9px;border-radius:var(--radius)}.mode-bottom-bar .mode-btn span:first-child{max-width:none}}.mode-bottom-bar{display:none}.app-shell[data-shell=phone] .mode-bottom-bar{display:flex;z-index:9}.surface-nav-sheet{flex:0 0 auto;border-bottom:1px solid var(--rule);max-height:40vh;overflow:auto;background:var(--surface-muted);min-width:0}.surface-nav-list{list-style:none;margin:0;padding:.35rem .5rem;display:flex;flex-direction:column;gap:.25rem}.surface-nav-item{display:flex;width:100%;min-height:44px;align-items:center;justify-content:flex-start;text-align:left;padding:.5rem .75rem;border:1px solid transparent;border-radius:var(--radius);background:transparent;color:var(--ink);font:inherit;cursor:pointer}.surface-nav-item:hover,.surface-nav-item:focus-visible{border-color:var(--border-focus);outline:none;background:var(--raised)}.surface-nav-item.active{background:var(--surface);border-color:var(--rule);font-weight:600}.surface-nav-label{text-transform:lowercase}.app-shell[data-shell=phone] main{min-width:0}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}.navigation,.inspector,.shell-backdrop{transition:none!important}}.fast-toggle{display:flex;align-items:center;gap:6px;padding:0 10px;background:var(--surface);font-size:9px;color:var(--muted)}.fast-toggle input{accent-color:var(--acid)}.session-actions{display:flex;flex-direction:column;gap:6px;padding:0 8px}.session-actions>button{padding:6px 8px;font-size:9px;text-transform:uppercase;width:100%}.session-actions button:disabled{opacity:.4}.session-overflow{position:relative;width:100%}.session-overflow>summary{list-style:none;cursor:pointer;padding:6px 8px;border:1px solid var(--rule);background:var(--surface);font-size:9px;text-transform:uppercase;letter-spacing:.08em;text-align:center;-webkit-user-select:none;user-select:none}.session-overflow>summary::-webkit-details-marker{display:none}.session-overflow>summary:hover,.session-overflow>summary:focus-visible{border-color:var(--acid);color:var(--acid)}.session-overflow-menu{display:grid;gap:2px;margin-top:4px;border:1px solid var(--rule);background:var(--raised);padding:4px}.session-overflow-menu button{width:100%;border:0;background:transparent;padding:7px 8px;font-size:9px;text-transform:uppercase;text-align:left}.session-overflow-menu button:hover,.session-overflow-menu button:focus-visible{background:var(--surface);color:var(--acid)}.nav-tab{border:0;border-bottom:2px solid transparent;background:transparent;padding:7px 12px;font-size:10px;letter-spacing:.16em;color:var(--muted)}.nav-tab.active{border-bottom-color:var(--acid);color:var(--acid)}.history-search{width:100%;margin:0 0 6px;padding:7px 10px;border:1px solid var(--rule);background:var(--ground);font-size:11px}.root-idle{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--idle);margin-right:8px}.root-busy{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--accent-alt);animation:pulse 1.2s infinite;margin-right:8px}.live-badge{font-size:8px;color:var(--accent-alt)}.session.history-row{gap:6px}.session.history-row .live-badge{color:var(--accent-alt)}.markdown h2,.markdown h3{font-family:Georgia,Times New Roman,serif;margin:16px 0 8px}.markdown h2{font-size:22px}.markdown h3{font-size:17px}.markdown p{margin:5px 0}.markdown a,.file-ref{color:var(--acid)}.markdown code{background:var(--code-bg);border:1px solid var(--rule);padding:1px 4px}.list-line{padding:3px 0 3px 12px;line-height:1.6}.code-block{margin:12px 0;border:1px solid var(--rule);background:var(--code-bg)}.code-block figcaption{padding:6px 10px;border-bottom:1px solid var(--rule);color:var(--muted);font-size:9px;text-transform:uppercase}.code-block pre{border:0;margin:0}.tool-card{border:1px solid var(--rule);background:var(--code-bg)}.tool-card summary{display:flex;justify-content:space-between;padding:9px 12px;cursor:pointer;color:var(--tool)}.tool-card summary small{color:var(--muted)}.tool-card pre{margin:0;border-width:1px 0 0}.diff span{display:block}.diff .add{color:var(--diff-add);background:var(--diff-add-bg)}.diff .del{color:var(--diff-del);background:var(--diff-del-bg)}.composer-field{position:relative;display:flex;flex-direction:column;min-width:0}.completion{--completion-max-rows: 6;--completion-row-height: 28px;display:flex;flex-direction:column;background:var(--raised);border-bottom:1px solid var(--rule);max-height:calc(var(--completion-max-rows) * var(--completion-row-height));overflow:auto}.completion button{box-sizing:border-box;min-height:var(--completion-row-height);padding:4px 12px;line-height:1.35;white-space:nowrap;overflow:hidden}.ui-list-row-meta:before,.completion span:before{content:"— "}.attachments{display:flex;gap:6px;padding:7px 10px;border-top:1px solid var(--rule)}.attachments button{padding:5px 8px;font-size:9px}.prompt-queue-wrap{border-top:1px solid var(--rule)}.prompt-queue{margin:0;padding:8px 12px 8px 34px;font-size:10px;color:var(--muted);list-style:decimal}.prompt-queue li{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:start;padding:4px 0}.prompt-queue li span:first-child{overflow-wrap:anywhere}.queue-actions{display:inline-flex;gap:2px;flex-shrink:0}.queue-actions button{border:0;background:transparent;color:var(--muted);padding:0 4px;min-width:1.4em;cursor:pointer}.queue-actions button:disabled{opacity:.35;cursor:default}.queue-edit{width:100%;font:inherit;color:var(--ink);background:var(--raised);border:1px solid var(--rule);padding:4px 6px}.queue-toolbar{display:flex;justify-content:flex-end;padding:0 12px 8px}.queue-toolbar button{font-size:9px;padding:4px 8px}.unavailable p{color:var(--muted);font-size:10px;line-height:1.5}.capability-list{display:grid;gap:1px;background:var(--rule)}.capability-list div{display:flex;justify-content:space-between;gap:10px;padding:9px;background:var(--surface);font-size:9px}.capability-list strong{text-align:right}.available{color:var(--success)}.unavailable-label{color:var(--signal)}dialog fieldset{border:1px solid var(--rule);margin:10px 0;padding:12px}dialog legend{color:var(--ink);padding:0 5px;font-size:11px}dialog fieldset label{display:flex;grid-template-columns:auto 1fr auto;align-items:start;margin:8px 0}dialog fieldset small{color:var(--muted)}.mcp-head{display:flex;justify-content:space-between;gap:8px;align-items:baseline;margin-bottom:8px}.mcp-head h2{margin:0;font-size:13px}.mcp-actions,.mcp-card-actions{display:flex;gap:6px;flex-wrap:wrap}.mcp-list{display:grid;gap:8px}.mcp-card{border:1px solid var(--rule);background:var(--surface-muted);padding:10px;display:grid;gap:6px}.mcp-card header{display:flex;justify-content:space-between;gap:8px;align-items:baseline}.mcp-card h3{margin:0;font-size:12px}.mcp-card p{margin:0;color:var(--muted);font-size:10px}.mcp-card code{background:var(--code-bg);border:1px solid var(--border-muted);padding:1px 4px;font-size:9px}.mcp-state{text-transform:uppercase;font-size:8px;letter-spacing:.12em;color:var(--muted)}.mcp-state.up{color:var(--success)}.mcp-state.error{color:var(--signal)}.mcp-state.down{color:var(--warning)}.mcp-state.disabled{color:var(--overlay)}.mcp-error{color:var(--signal)!important;font-size:10px}.mcp-tools{display:flex;flex-wrap:wrap;gap:4px}.workflow-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}.workflow-head h2{margin:0;font-size:13px}.workflow-actions{display:flex;gap:6px;flex-wrap:wrap}.workflow-actions button,.workflow-card-actions button,.workflow-phase-tools button{font-size:10px;padding:4px 8px}.workflow-active{font-size:11px;color:var(--accent-alt);margin:0 0 8px}.workflow-list{display:grid;gap:8px}.workflow-card{border:1px solid var(--rule);background:var(--surface);padding:10px;display:grid;gap:6px}.workflow-card.invalid{border-color:var(--signal)}.workflow-card header{display:flex;justify-content:space-between;gap:8px;align-items:baseline}.workflow-card h3{margin:0;font-size:12px}.workflow-card small,.workflow-card p{margin:0;color:var(--muted);font-size:10px}.workflow-error{color:var(--signal)!important;font-size:10px}.workflow-warn{color:var(--warning);font-size:10px;margin:6px 0}.workflow-grants{display:flex;flex-wrap:wrap;gap:4px;align-items:center;font-size:10px}.workflow-grants span{color:var(--muted);margin-right:4px}.workflow-grants code,.check-cmd{background:var(--code-bg);border:1px solid var(--border-muted);padding:2px 5px;font-size:9px}.workflow-card-actions{display:flex;gap:6px}.workflow-dialog{width:min(520px,calc(100vw - 24px));max-height:calc(100vh - 48px);overflow:auto;border:1px solid var(--rule);background:var(--surface);color:var(--ink);padding:16px}.workflow-dialog.wide{width:min(720px,calc(100vw - 24px))}.workflow-dialog::backdrop{background:color-mix(in srgb,var(--overlay) 55%,transparent)}.workflow-builder{display:grid;gap:10px}.workflow-builder fieldset label{display:grid;grid-template-columns:110px 1fr;gap:8px;align-items:center;margin:6px 0}.workflow-builder input,.workflow-builder select,.workflow-builder textarea{width:100%;background:var(--ground);color:var(--ink);border:1px solid var(--rule);padding:6px 8px;font:inherit;font-size:11px}.workflow-phases{display:flex;flex-wrap:wrap;gap:4px;align-items:center}.workflow-phases>button{font-size:10px;padding:4px 8px;border:1px solid var(--rule);background:var(--surface-muted);color:var(--ink)}.workflow-phases>button.active{border-color:var(--border-focus);background:var(--raised);color:var(--highlight)}.workflow-phase-tools{display:flex;gap:4px;margin-left:auto}.perm-row{display:grid;grid-template-columns:1fr 1fr 90px auto;gap:6px;margin:4px 0}.workflow-review{border:1px solid var(--rule);background:var(--surface-muted);padding:10px;display:grid;gap:6px}.workflow-review h3{margin:0;font-size:11px}.workflow-review-phase{font-size:10px}.workflow-json{margin:0;max-height:180px;overflow:auto;background:var(--code-bg);border:1px solid var(--border-muted);padding:8px;font-size:10px;white-space:pre-wrap}@media(max-width:720px){.workflow-builder fieldset label,.perm-row{grid-template-columns:1fr}.workflow-dialog.wide{width:calc(100vw - 16px)}}.plans-panel{display:grid;gap:8px}.plans-meta{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:0;font-size:10px;color:var(--muted)}.plans-meta small{color:var(--acid);text-transform:uppercase;letter-spacing:.12em;font-size:8px}.plans-actions{flex-wrap:wrap;margin:4px 0 8px}.plans-section-head{display:flex;justify-content:space-between;gap:8px;align-items:baseline}.plans-section-head h3{margin:0}.plans-section-head button{font-size:10px;padding:2px 6px}.plans-create{display:grid;gap:6px;border:1px solid var(--rule);background:var(--surface-muted);padding:10px;margin-bottom:8px}.plans-create label{display:grid;gap:4px;font-size:10px;color:var(--muted)}.plans-create input{background:var(--ground);color:var(--ink);border:1px solid var(--rule);padding:6px 8px;font:inherit;font-size:11px}.plans-create button{justify-self:start;font-size:10px;padding:4px 8px}.plans-sections{margin-top:4px}.timeline-panel{display:grid;gap:10px}.timeline-head{display:flex;align-items:center;justify-content:space-between;gap:8px}.timeline-head h2{margin:0;font-size:13px}.timeline-actions{display:flex;gap:6px;flex-wrap:wrap}.timeline-actions button{font-size:10px;padding:4px 8px}.timeline-summary{display:grid;grid-template-columns:repeat(auto-fill,minmax(72px,1fr));gap:8px;margin:0}.timeline-summary div{border:1px solid var(--rule);background:var(--surface-muted);padding:8px}.timeline-summary dt{margin:0 0 4px;color:var(--muted);font-size:8px;letter-spacing:.1em;text-transform:uppercase}.timeline-summary dd{margin:0;font-size:12px}.timeline-list{list-style:none;margin:0;padding:0;display:grid;gap:4px;max-height:min(60vh,480px);overflow:auto}.timeline-entry{display:grid;grid-template-columns:72px minmax(0,1.4fr) 72px 48px;gap:6px 8px;align-items:baseline;border:1px solid var(--border-muted);background:var(--surface-muted);padding:6px 8px;font-size:10px}.timeline-state{font-size:9px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}.timeline-state.state-completed{color:var(--success)}.timeline-state.state-failed{color:var(--signal)}.timeline-state.state-canceled{color:var(--warning)}.timeline-state.state-running,.timeline-state.state-waiting,.timeline-state.state-queued{color:var(--accent-alt)}.timeline-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ink)}.timeline-id{color:var(--muted);font-size:9px;overflow:hidden;text-overflow:ellipsis}.timeline-dur{color:var(--muted);text-align:right}.timeline-code{grid-column:1 / -1;color:var(--warning);font-size:9px}.timeline-err{grid-column:1 / -1;color:var(--signal);font-size:9px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.root-attention{width:8px;height:8px;border-radius:50%;background:var(--warning);flex-shrink:0}.needs-you{color:var(--warning)!important;font-weight:700}.attention-summary{margin-left:8px;border:1px solid var(--warning);background:color-mix(in srgb,var(--warning) 12%,transparent);color:var(--warning);font-size:9px;text-transform:uppercase;letter-spacing:.04em;padding:2px 6px;border-radius:var(--radius);cursor:pointer}.attention-summary:hover{filter:brightness(1.1)}.settings-dialog{width:min(560px,calc(100vw - 24px));max-width:calc(100vw - 24px);min-width:0;max-height:min(88vh,900px);overflow:auto;border:1px solid var(--rule);background:var(--surface);color:var(--ink);padding:18px 20px 16px}.settings-dialog.wide{width:min(640px,calc(100vw - 24px))}.settings-dialog::backdrop{background:color-mix(in srgb,var(--overlay) 55%,transparent)}.settings-form fieldset label{display:grid;grid-template-columns:minmax(0,140px) minmax(0,1fr);gap:8px 12px;align-items:center;margin:6px 0;min-width:0}.settings-form fieldset label select,.settings-form fieldset label input{width:100%;min-width:0;padding:8px 10px;background:var(--ground);border:1px solid var(--rule);color:var(--ink)}.settings-form fieldset button[type=button]{margin-top:6px;font-size:10px;padding:6px 10px}.settings-form .muted,.settings-dialog .muted{color:var(--muted);font-size:10px;margin:4px 0 8px;line-height:1.45}.exclude-list{display:flex;flex-wrap:wrap;gap:8px 14px;margin-top:8px;align-items:center}.exclude-label{width:100%;color:var(--muted);font-size:10px;text-transform:uppercase;letter-spacing:.04em}.exclude-item{display:inline-flex!important;align-items:center;gap:6px;margin:0!important;color:var(--ink);font-size:11px;grid-template-columns:none!important}.settings-error{color:var(--signal);font-size:11px;margin:8px 0 0}.goal-meta{display:grid;grid-template-columns:100px 1fr;gap:4px 8px;margin:0 0 12px;font-size:11px}.goal-meta dt{color:var(--muted);margin:0}.goal-meta dd{margin:0;overflow-wrap:anywhere}.goal-criteria{margin:0 0 12px;padding-left:18px;font-size:11px;color:var(--muted)}.goal-criteria strong{color:var(--acid);margin-right:6px}.goal-log{margin:0 0 12px;padding-left:18px;display:grid;gap:8px;font-size:11px}.goal-log li{display:grid;gap:2px}.goal-log span{color:var(--muted);font-size:10px}.goal-log p{margin:0;color:var(--muted);white-space:pre-wrap}.project-form{display:grid;gap:10px;margin-bottom:16px;padding:12px;border:1px solid var(--rule);background:var(--surface-muted)}.project-form label{display:grid;gap:6px;color:var(--muted);font-size:10px;text-transform:uppercase;letter-spacing:.08em}.project-form input,.project-form textarea{width:100%;border:1px solid var(--rule);background:var(--surface);color:var(--ink);padding:8px 10px;font:inherit;font-size:12px;text-transform:none;letter-spacing:normal}.project-form textarea{resize:vertical;min-height:64px}.plugin-card .plugin-trust{font-size:10px;text-transform:uppercase;letter-spacing:.04em}.plugin-trust.trusted{color:var(--success)}.plugin-trust.stale{color:var(--warning)}.plugin-trust.none{color:var(--signal)}.plugin-trust.passive{color:var(--muted)}.plugin-findings{margin:4px 0 0;padding-left:16px;font-size:10px;color:var(--muted)}.plugin-install{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:end;margin:0 0 10px}.plugin-install label{display:grid;gap:4px;font-size:10px;color:var(--muted)}.plugin-install input{width:100%;background:var(--ground);color:var(--ink);border:1px solid var(--rule);padding:6px 8px;font:inherit;font-size:11px}.plugin-trust-preview{border:1px solid var(--border-focus);background:var(--surface-muted);padding:10px;margin:0 0 10px;display:grid;gap:6px}.plugin-trust-preview h3{margin:0;font-size:12px}.plugin-trust-preview ul{margin:0;padding-left:16px;font-size:10px}.plugin-pane-surface{border:1px solid var(--rule);background:var(--surface);outline:none;min-height:120px}.plugin-pane-surface:focus{border-color:var(--border-focus)}.plugin-pane-chrome{display:flex;gap:8px;align-items:baseline;padding:8px 10px;border-bottom:1px solid var(--rule);background:var(--surface-muted);font-size:11px}.plugin-pane-body{padding:10px;font-size:11px}.pane-column{display:grid}.pane-row{display:flex;flex-wrap:wrap;min-width:0}.pane-row.wrap{flex-direction:column;flex-wrap:nowrap}.pane-row-cell{flex-grow:1;flex-shrink:1;flex-basis:calc((var(--stack-at, 0px) - 100%) * 999);min-width:0;max-width:100%}.pane-row.wrap .pane-row-cell{flex:1 1 auto;width:100%}.pane-role{margin:0}.pane-role.title{font-weight:600;color:var(--ink)}.pane-role.muted{color:var(--muted)}.pane-role.accent{color:var(--acid)}.pane-role.success{color:var(--success)}.pane-role.warning{color:var(--warning)}.pane-role.error{color:var(--signal)}.pane-role.body{color:var(--ink)}.pane-kv{margin:0;display:grid;gap:2px}.pane-kv-row{display:grid;grid-template-columns:minmax(48px,30%) 1fr;gap:8px}.pane-kv dt,.pane-kv dd{margin:0}.pane-list{list-style:none;margin:0;padding:0;display:grid;gap:2px}.pane-list li{display:flex;justify-content:space-between;gap:8px;padding:2px 4px}.pane-list li.selected{background:var(--surface-muted);color:var(--highlight)}.pane-table{width:100%;border-collapse:collapse;font-size:10px}.pane-table th,.pane-table td{text-align:left;padding:2px 4px;border-bottom:1px solid var(--border-muted)}.pane-table th{color:var(--muted);font-weight:500}.pane-meter{display:flex;align-items:center;gap:8px}.pane-badge{display:inline-block;padding:1px 6px;border-radius:var(--radius);background:var(--surface-muted);font-size:10px}.pane-badge.tone-success{color:var(--success)}.pane-badge.tone-warning{color:var(--warning)}.pane-badge.tone-error{color:var(--signal)}.pane-badge.tone-accent{color:var(--acid)}.pane-divider{border:0;border-top:1px solid var(--border-muted);margin:6px 0}.pane-error{padding:10px;background:var(--unavailable-bg);color:var(--signal);font-size:11px}.pane-error p{margin:4px 0 0;color:var(--muted)}.pane-empty{padding:8px 0}@media(max-width:720px){.plugin-install{grid-template-columns:1fr}.settings-form fieldset label{grid-template-columns:minmax(0,1fr)}}.plugin-head,.plugin-pane-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}.plugin-head h2,.plugin-pane-head h3{margin:0;font-size:13px}.plugin-actions,.plugin-card-actions{display:flex;gap:6px;flex-wrap:wrap}.plugin-list{display:grid;gap:8px}.plugin-card{border:1px solid var(--rule);background:var(--surface-muted);padding:10px;display:grid;gap:6px}.plugin-card header{display:flex;flex-wrap:wrap;gap:6px;align-items:center}.plugin-card h3{margin:0;font-size:12px;flex:1}.plugin-status,.plugin-trust{font-size:10px;text-transform:uppercase;letter-spacing:.04em}.plugin-status.enabled{color:var(--success)}.plugin-status.disabled{color:var(--muted)}.plugin-status.invalid{color:var(--signal)}.plugin-counts{font-size:10px}.plugin-mcp,.plugin-findings,.plugin-hits,.plugin-panes ul{margin:0;padding-left:16px;font-size:10px}.plugin-review{border:1px solid var(--border-focus);background:var(--surface);padding:10px;display:grid;gap:6px;margin-bottom:10px}.plugin-review h3{margin:0;font-size:12px}.plugin-summary{margin:0;max-height:160px;overflow:auto;background:var(--code-bg);border:1px solid var(--border-muted);padding:8px;font-size:10px;white-space:pre-wrap}.plugin-pane-host{margin-top:12px;border:1px solid var(--rule);background:var(--surface)}.plugin-pane-body{padding:10px}.plugin-card-actions .danger{color:var(--danger);border-color:color-mix(in srgb,var(--danger) 40%,var(--rule))}.error-text{color:var(--signal);margin:0;font-size:11px}.warning-text{color:var(--warning);margin:0;font-size:11px}.pane-list-btn{background:none;border:0;color:inherit;font:inherit;text-align:left;padding:0;cursor:pointer}.pane-meter-track{flex:1;height:6px;background:var(--ground);border-radius:var(--radius);overflow:hidden}.pane-meter-fill{height:100%;background:var(--acid)}.pane-meter-fill.tone-success{background:var(--success)}.pane-meter-fill.tone-warning{background:var(--warning)}.pane-meter-fill.tone-error,.pane-meter-fill.tone-danger{background:var(--signal)}.pane-divider{border:0;border-top:1px solid var(--rule);margin:6px 0}.pane-spacer{width:100%}.palette-trigger{margin-left:auto;display:inline-flex;align-items:center;gap:6px;border:1px solid var(--rule);background:transparent;padding:4px 10px;border-radius:var(--radius);cursor:pointer;font-size:12px;color:var(--muted);flex:0 1 auto;min-width:0;overflow:hidden}.palette-trigger kbd{font-size:10px}.palette-input{width:100%;padding:10px 12px;border:1px solid var(--rule);background:var(--code-bg);color:var(--ink);border-radius:var(--radius);margin-bottom:10px}.palette-list{list-style:none;margin:0;padding:0;max-height:360px;overflow:auto;display:grid;gap:0}.palette-hint{margin:8px 0 0;font-size:11px}.onboard-hint{display:flex;flex-wrap:wrap;justify-content:space-between;gap:12px;align-items:center;padding:8px 12px;border:1px solid var(--rule);border-radius:var(--radius);background:color-mix(in srgb,var(--acid) 8%,transparent);margin:0 0 8px;font-size:12px;min-width:0}.onboard-hint p{margin:0}.team-workspace{display:grid;gap:var(--gutter);min-width:0}.team-workspace-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px;min-width:0}.team-workspace-head h2{margin:0;min-width:0}.team-attention-entry{width:100%;text-align:left;padding:8px 10px;border:1px solid var(--rule);background:color-mix(in srgb,var(--acid) 8%,transparent);cursor:pointer;border-radius:var(--radius);font-weight:600}.team-attention ul{list-style:none;margin:8px 0 0;padding:0;display:grid;gap:4px}.team-attention li button{width:100%;display:flex;gap:8px;align-items:flex-start;text-align:left;padding:8px;border:1px solid var(--rule);background:var(--code-bg);cursor:pointer;border-radius:var(--radius)}.team-attention li strong{display:block}.team-attention li small{display:block;color:var(--muted)}.team-view-tabs,.team-filters{display:inline-flex;flex-wrap:wrap;gap:0;max-width:100%;border:1px solid var(--rule);background:var(--surface-muted)}.team-view-tabs button,.team-filters button{border:0;border-right:1px solid var(--rule);background:transparent;padding:4px 10px;border-radius:0;cursor:pointer;font-size:12px;text-transform:capitalize}.team-view-tabs button:last-child,.team-filters button:last-child{border-right:0}.team-view-tabs button.active,.team-filters button.active,.team-view-tabs button[aria-selected=true],.team-filters button[aria-pressed=true]{background:var(--acid);color:var(--mark-ink);border-color:var(--ink)}.team-roster{list-style:none;margin:0;padding:0;display:grid;gap:4px}.team-detail{border:1px solid var(--rule);padding:10px;border-radius:var(--radius);background:var(--code-bg)}.team-detail header{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px;min-width:0}.team-detail h3{margin:0}.team-detail dl{display:grid;grid-template-columns:auto 1fr;gap:4px 10px;margin:8px 0;font-size:12px}.team-detail dt{color:var(--muted)}.team-detail dd{margin:0}.team-files{margin:0;padding-left:16px}.team-detail-actions{display:flex;gap:8px}.team-board{display:flex;gap:10px;overflow-x:auto;padding-bottom:8px;scroll-snap-type:x mandatory}.team-board-col{min-width:160px;max-width:220px;flex:0 0 auto;border:1px solid var(--rule);border-radius:var(--radius);padding:8px;scroll-snap-align:start;background:var(--code-bg)}.team-board-col h4{margin:0 0 8px;font-size:12px;text-transform:capitalize}.team-board-col ul{list-style:none;margin:0;padding:0;display:grid;gap:6px}.team-board-card{width:100%;text-align:left;display:grid;gap:4px;border:1px solid var(--rule);background:var(--ground);padding:8px;border-radius:var(--radius)}.team-board-card-main{width:100%;text-align:left;display:grid;gap:2px;border:0;background:transparent;padding:0;cursor:pointer;color:inherit}.team-board-actions,.team-control-row{display:flex;flex-wrap:wrap;gap:6px}.team-board-actions button,.team-control-row button,.team-controls-inline button{border:1px solid var(--rule);background:transparent;padding:4px 8px;border-radius:var(--radius);cursor:pointer;font-size:12px}.team-board-actions button:disabled,.team-control-row button:disabled{opacity:.5;cursor:not-allowed}.team-board-reason{font-size:11px;color:var(--muted)}.team-messages{list-style:none;margin:0;padding:0;display:grid;gap:8px}.team-messages li{display:grid;gap:2px;padding:8px;border:1px solid var(--rule);border-radius:var(--radius)}.team-control-status{margin:0;padding:8px 10px;border-radius:var(--radius);font-size:12px;border:1px solid var(--rule);background:color-mix(in srgb,var(--acid) 10%,transparent)}.team-controls{display:grid;gap:12px}.team-control-block{border:1px solid var(--rule);border-radius:var(--radius);padding:10px;display:grid;gap:8px;margin:0;background:var(--code-bg)}.team-control-block legend{padding:0 4px;font-weight:600}.team-control-block label{display:grid;gap:4px;font-size:12px;color:var(--muted)}.team-control-block input,.team-control-block textarea,.team-control-block select{width:100%;border:1px solid var(--rule);border-radius:var(--radius);background:var(--ground);color:var(--ink);padding:6px 8px;font:inherit}.team-control-block button.primary{justify-self:start;background:var(--acid);color:var(--mark-ink);border-color:var(--ink);padding:6px 12px;border-radius:var(--radius);cursor:pointer}.team-control-block button.linkish{justify-self:start;border:0;background:transparent;color:var(--acid);cursor:pointer;padding:0;text-align:left}.team-control-advanced{display:grid;gap:8px}.team-local-board{list-style:none;margin:0;padding:0;display:grid;gap:8px}.team-local-board li{display:grid;gap:4px;padding:8px;border:1px solid var(--rule);border-radius:var(--radius);background:var(--ground)}.team-controls-inline{margin-top:8px}@media(max-width:720px){.team-board{flex-direction:column;overflow-x:visible}.team-board-col{min-width:0;max-width:none;width:100%}.team-control-block{padding:8px}}.tool-card summary{display:flex;flex-wrap:wrap;gap:8px;align-items:center;cursor:pointer;padding:8px 10px}.tool-name{font-weight:600;font-family:var(--mono, ui-monospace, monospace)}.tool-state{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted)}.tool-state-running{color:var(--acid)}.tool-state-error{color:var(--diff-del)}.tool-state-denied{color:var(--warning)}.tool-duration{color:var(--muted)}.tool-args{padding:8px 10px;border-top:1px solid var(--rule)}.tool-args pre,.tool-output{margin:0;max-height:280px;overflow:auto;font-size:11px}.diff-viewer{border-top:1px solid var(--rule)}.diff-toolbar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:6px 10px;font-size:11px}.diff-wrap{display:inline-flex;gap:4px;align-items:center;color:var(--muted)}.diff.wrap{white-space:pre-wrap;word-break:break-word}.diff .hunk{color:var(--muted)}.copy-btn{font-size:10px;padding:2px 6px}button.file-ref{background:none;border:0;padding:0;color:var(--acid);cursor:pointer;text-decoration:underline;font:inherit}.exploration-group summary{cursor:pointer;padding:8px 10px;display:flex;gap:8px;align-items:center}.exploration-body{display:grid;gap:6px;padding:0 8px 8px}.semantic-event p{margin:0;color:var(--text)}.jump-latest{position:sticky;bottom:12px;margin:0 auto;display:block;z-index:2;padding:8px 14px;border-radius:var(--radius);border:1px solid var(--rule);background:var(--panel, var(--bg));cursor:pointer}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.code-block figcaption{display:flex;justify-content:space-between;align-items:center;gap:8px}.provider-rows{display:flex;flex-direction:column;gap:.5rem;margin-bottom:.75rem}.provider-row{border:1px solid var(--rule);border-radius:var(--radius);padding:.5rem .75rem;background:var(--surface-muted)}.provider-row header{display:flex;justify-content:space-between;align-items:center;gap:.5rem}.provider-row .badge{font-size:.75rem;padding:.1rem .4rem;border-radius:var(--radius);background:var(--surface);border:1px solid var(--rule)}.provider-row .badge.ok{border-color:var(--success);color:var(--success)}.model-meta ul{margin:.25rem 0 0;padding-left:1.1rem}.device-flow,.oauth-flow{margin-top:.5rem;padding:.5rem;border:1px dashed var(--rule);border-radius:var(--radius)}.custom-provider-list{list-style:none;padding:0;margin:0 0 .5rem}.custom-provider-list li{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center;margin-bottom:.35rem}.code-explorer{display:grid;gap:10px;min-width:0}.code-explorer-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px;min-width:0}.code-explorer-head h2{margin:0;min-width:0}.code-view-tabs,.code-md-toggle{display:inline-flex;gap:0;border:1px solid var(--rule);background:var(--surface-muted)}.code-view-tabs{margin-left:auto}.code-view-tabs button,.code-md-toggle button{border:0;border-right:1px solid var(--rule);background:transparent;padding:4px 10px;border-radius:0;cursor:pointer;font-size:12px}.code-view-tabs button:last-child,.code-md-toggle button:last-child{border-right:0}.code-view-tabs button.active,.code-md-toggle button.active{background:var(--acid);color:var(--mark-ink);border-color:var(--ink)}.code-explorer-body{display:grid;grid-template-columns:minmax(0,240px) minmax(0,1fr);gap:var(--gutter);min-height:280px;min-width:0}.code-sidebar{display:grid;gap:8px;align-content:start;min-width:0}.code-search{display:flex;gap:6px;align-items:center;min-width:0}.code-search input{flex:1;min-width:0;border:1px solid var(--rule);border-radius:var(--radius);background:var(--ground);color:var(--ink);padding:6px 8px;font:inherit}.code-breadcrumbs{font-size:12px;color:var(--muted)}.code-breadcrumbs button{border:0;background:transparent;color:var(--acid);cursor:pointer;padding:0}.code-tree,.code-search-hits{list-style:none;margin:0;padding:0;display:grid;gap:2px;max-height:360px;overflow:auto}.code-tree button,.code-search-hits button{width:100%;text-align:left;border:1px solid transparent;background:transparent;padding:4px 6px;border-radius:var(--radius);cursor:pointer;color:inherit;font:inherit}.code-tree button:hover,.code-search-hits button:hover,.code-tree button.active{border-color:var(--rule);background:var(--code-bg)}.code-viewer{border:1px solid var(--rule);border-radius:var(--radius);padding:10px;background:var(--code-bg);min-width:0;overflow:auto}.code-viewer-head{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:8px}.code-viewer-head h3{margin:0;font-size:13px;word-break:break-all}.code-raw{margin:0;font-family:var(--mono, ui-monospace, monospace);font-size:12px;line-height:1.45}.code-line{display:grid;grid-template-columns:3em 1fr;gap:8px}.code-line.focus{background:color-mix(in srgb,var(--acid) 18%,transparent)}.code-gutter{color:var(--muted);text-align:right;-webkit-user-select:none;user-select:none}.code-text{white-space:pre-wrap;word-break:break-word}.code-md-preview{font-size:13px;line-height:1.5}.code-md-preview h2,.code-md-preview h3,.code-md-preview h4{margin:.8em 0 .3em}.code-md-preview p{margin:.4em 0}.code-md-preview pre.md-code{overflow:auto;padding:8px;border-radius:var(--radius);background:var(--ground);border:1px solid var(--rule)}@media(max-width:720px){.code-explorer-body{grid-template-columns:1fr}.code-tree,.code-search-hits{max-height:200px}}.code-apply{margin-top:12px;border:1px solid var(--rule);border-radius:var(--radius);padding:10px;display:grid;gap:8px;background:var(--ground)}.code-apply legend{font-weight:600;padding:0 4px}.code-apply label{display:grid;gap:4px;font-size:12px;color:var(--muted)}.code-apply textarea{width:100%;border:1px solid var(--rule);border-radius:var(--radius);background:var(--code-bg);color:var(--ink);padding:6px 8px;font:inherit}.code-apply button.primary{justify-self:start;background:var(--acid);color:var(--mark-ink);border:1px solid var(--ink);border-radius:var(--radius);padding:6px 12px;cursor:pointer}.code-apply button.primary:disabled{opacity:.5;cursor:not-allowed}.code-apply-preview{max-height:160px;overflow:auto}.review-panel{display:grid;gap:10px}.review-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.review-head h2{margin:0}.review-tabs{display:inline-flex;gap:0;margin-left:auto;border:1px solid var(--rule);background:var(--surface-muted)}.review-tabs button,.review-filter select,.review-head button{border:1px solid var(--rule);background:transparent;padding:4px 10px;border-radius:var(--radius);cursor:pointer;font-size:12px;color:inherit}.review-tabs button{border:0;border-right:1px solid var(--rule);border-radius:0}.review-tabs button:last-child{border-right:0}.review-tabs button.active{background:var(--acid);color:var(--mark-ink);border-color:var(--ink)}.review-filter{display:flex;gap:8px;align-items:center;font-size:12px;color:var(--muted)}.review-list{list-style:none;margin:0;padding:0;display:grid;gap:6px}.review-list>li>button{width:100%;text-align:left;display:grid;gap:2px;border:1px solid var(--rule);background:var(--code-bg);padding:8px;border-radius:var(--radius);cursor:pointer;color:inherit}.review-list>li>button.active{border-color:var(--acid)}.review-detail{border:1px solid var(--rule);border-radius:var(--radius);padding:10px;background:var(--code-bg)}.review-detail header{display:flex;justify-content:space-between;align-items:center}.review-detail h3{margin:0}.review-detail dl{display:grid;grid-template-columns:auto 1fr;gap:4px 10px;font-size:12px}.review-detail dt{color:var(--muted)}.review-detail dd{margin:0}.review-content{max-height:280px;overflow:auto;padding:8px;border-radius:var(--radius);background:var(--ground);border:1px solid var(--rule);font-size:12px;white-space:pre-wrap}.review-paths{margin:4px 0 0;padding-left:16px}.ledger-row{border:1px solid var(--rule);border-radius:var(--radius);padding:8px;background:var(--code-bg)}.ledger-row-head{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin-bottom:4px}.ledger-meta{font-size:11px}button.linkish{border:0;background:transparent;color:var(--acid);cursor:pointer;padding:0;font:inherit}@media(max-width:720px){.review-content{max-height:200px}}.virtual-list{position:relative;min-height:0}.virtual-list-spacer{width:100%}.transcript-list{min-height:0}.team-roster{max-height:min(60vh,520px);overflow:auto}
diff --git a/internal/frontend/server/static/assets/panesApi-Gdyy8rqS.js b/internal/frontend/server/static/assets/panesApi-1q1G3asp.js
similarity index 94%
rename from internal/frontend/server/static/assets/panesApi-Gdyy8rqS.js
rename to internal/frontend/server/static/assets/panesApi-1q1G3asp.js
index bb8b9c80..270cfd98 100644
--- a/internal/frontend/server/static/assets/panesApi-Gdyy8rqS.js
+++ b/internal/frontend/server/static/assets/panesApi-1q1G3asp.js
@@ -1 +1 @@
-import{b as i}from"./index-BK8GKzWA.js";const c=()=>i("/v1/panes"),l=(t,o)=>i(`/v1/panes/${encodeURIComponent(t)}/snapshot`),f=(t,o=40,n=14,r)=>{const s=r?`?root=${encodeURIComponent(r)}`:"";return i(`/v1/panes/${encodeURIComponent(t)}/mount${s}`,{method:"POST",body:JSON.stringify({width:o,height:n})})},a=t=>i(`/v1/panes/${encodeURIComponent(t)}/unmount`,{method:"POST",body:JSON.stringify({})}),m=(t,o)=>i(`/v1/panes/${encodeURIComponent(t)}/input`,{method:"POST",body:JSON.stringify({event:o})});function y(t,o){if(!o||!t)return"";const n=o.split(".").filter(Boolean);if(!n.length)return"";let r="",s=n;if(n.length>=2&&t[`${n[0]}.${n[1]}`]!==void 0)r=`${n[0]}.${n[1]}`,s=n.slice(2);else if(t[n[0]]!==void 0)r=n[0],s=n.slice(1);else return"";let e=t[r];for(const p of s){if(e==null||typeof e!="object")return"";e=e[p]}if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return""}}export{c as listPanes,f as mountPane,m as paneInput,l as paneSnapshot,y as resolveFrom,a as unmountPane};
+import{b as i}from"./index-BIBviZkd.js";const c=()=>i("/v1/panes"),l=(t,o)=>i(`/v1/panes/${encodeURIComponent(t)}/snapshot`),f=(t,o=40,n=14,r)=>{const s=r?`?root=${encodeURIComponent(r)}`:"";return i(`/v1/panes/${encodeURIComponent(t)}/mount${s}`,{method:"POST",body:JSON.stringify({width:o,height:n})})},a=t=>i(`/v1/panes/${encodeURIComponent(t)}/unmount`,{method:"POST",body:JSON.stringify({})}),m=(t,o)=>i(`/v1/panes/${encodeURIComponent(t)}/input`,{method:"POST",body:JSON.stringify({event:o})});function y(t,o){if(!o||!t)return"";const n=o.split(".").filter(Boolean);if(!n.length)return"";let r="",s=n;if(n.length>=2&&t[`${n[0]}.${n[1]}`]!==void 0)r=`${n[0]}.${n[1]}`,s=n.slice(2);else if(t[n[0]]!==void 0)r=n[0],s=n.slice(1);else return"";let e=t[r];for(const p of s){if(e==null||typeof e!="object")return"";e=e[p]}if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return""}}export{c as listPanes,f as mountPane,m as paneInput,l as paneSnapshot,y as resolveFrom,a as unmountPane};
diff --git a/internal/frontend/server/static/index.html b/internal/frontend/server/static/index.html
index 9492df17..f8b0730c 100644
--- a/internal/frontend/server/static/index.html
+++ b/internal/frontend/server/static/index.html
@@ -5,8 +5,8 @@
Strike Workspace
-
-
+
+
diff --git a/internal/frontend/tui/theme/agent_state_test.go b/internal/frontend/tui/theme/agent_state_test.go
index 5cf790eb..4ee70281 100644
--- a/internal/frontend/tui/theme/agent_state_test.go
+++ b/internal/frontend/tui/theme/agent_state_test.go
@@ -25,6 +25,47 @@ func TestAgentStateLabel(t *testing.T) {
}
}
+func TestInformationColorContract(t *testing.T) {
+ // Locks the TUI side of docs/theme.md "Information colors" so working /
+ // needs-you / error / success / danger / user / tool / selected stay on
+ // distinct roles (web Status CSS is the matching column).
+ th := theme.Default()
+ st := th.S()
+ if th.AgentStateColor(theme.AgentStateWorking) != th.AccentAlt {
+ t.Errorf("working = %#v, want AccentAlt", th.AgentStateColor(theme.AgentStateWorking))
+ }
+ if th.AgentStateColor(theme.AgentStateAttention) != th.Warning {
+ t.Errorf("needs-you = %#v, want Warning", th.AgentStateColor(theme.AgentStateAttention))
+ }
+ if th.AgentStateColor(theme.AgentStateError) != th.Error {
+ t.Errorf("error = %#v, want Error", th.AgentStateColor(theme.AgentStateError))
+ }
+ if th.AgentStateColor(theme.AgentStateReady) != th.Success {
+ t.Errorf("ready = %#v, want Success", th.AgentStateColor(theme.AgentStateReady))
+ }
+ if got := st.Danger.GetForeground(); got != color.Color(th.Danger) {
+ t.Errorf("Danger style = %v, want Danger token", got)
+ }
+ if th.Danger == th.Error {
+ t.Error("Danger collapsed onto Error")
+ }
+ if got := st.UserLabel.GetForeground(); got != color.Color(th.UserLabel) {
+ t.Errorf("UserLabel style = %v, want UserLabel token", got)
+ }
+ if got := st.ToolLabel.GetForeground(); got != color.Color(th.ToolLabel) {
+ t.Errorf("ToolLabel style = %v, want ToolLabel token", got)
+ }
+ if th.UserLabel == th.ToolLabel {
+ t.Error("UserLabel collapsed onto ToolLabel")
+ }
+ if got := st.Selected.GetForeground(); got != color.Color(th.Highlight) {
+ t.Errorf("Selected = %v, want Highlight", got)
+ }
+ if th.Highlight == th.Accent {
+ t.Error("Highlight collapsed onto Accent")
+ }
+}
+
func TestAgentStateColorTokens(t *testing.T) {
th := theme.Default()
cases := []struct {
diff --git a/web/src/App.test.tsx b/web/src/App.test.tsx
index b5551c4e..bbd2633e 100644
--- a/web/src/App.test.tsx
+++ b/web/src/App.test.tsx
@@ -103,6 +103,11 @@ describe("App", () => {
expect(screen.getByRole("button", { name: "Allow session" })).toBeInTheDocument();
expect(screen.getByRole("button", { name: "Allow once" })).toBeInTheDocument();
expect(screen.queryByRole("button", { name: /Why is this asked/ })).not.toBeInTheDocument();
+ const pulse = document.querySelector(".session-line .pulse");
+ expect(pulse?.getAttribute("data-status")).toBe("needs-you");
+ expect(pulse).toHaveClass("needs-you");
+ expect(document.querySelector(".session-line")).toHaveClass("session-line-needs-you");
+ expect(screen.getByText("needs you")).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Allow once" }));
await waitFor(() => expect(fetch).toHaveBeenLastCalledWith(expect.stringContaining("/v1/ops"), expect.objectContaining({ body: expect.stringContaining('"decision":"once"') })));
});
diff --git a/web/src/App.tsx b/web/src/App.tsx
index 6dc6750d..7b513971 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -43,6 +43,7 @@ import {
formatUndoPreviewLines,
type UndoPreview,
} from "./undoPreview";
+import { liveStatusKind } from "./ui";
import { SurfaceNav } from "./SurfaceNav";
import {
deepLinkWorkspaceID,
@@ -1077,6 +1078,16 @@ export default function App() {
const headerAttention = attentionCount > 0
? `${attentionCount} need${attentionCount === 1 ? "s" : ""} you`
: "";
+ const selectedNeedsYou = Boolean(state.permission || state.question);
+ const headerLiveKind = liveStatusKind({
+ busy: Boolean(state.status.busy),
+ needsYou: selectedNeedsYou,
+ });
+ const headerLiveLabel = headerLiveKind === "needs-you"
+ ? "needs you"
+ : headerLiveKind === "busy"
+ ? "agent working"
+ : transport;
const renderModeButtons = (className: string) => (