@mrpatronz/nexusflow 2.10.0 → 2.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/desktop/assets/icon.png +0 -0
- package/dist/agent/ClaudeCliAdapter.d.ts +2 -2
- package/dist/agent/ClaudeCliAdapter.d.ts.map +1 -1
- package/dist/agent/ClaudeCliAdapter.js +6 -4
- package/dist/agent/ClaudeCliAdapter.js.map +1 -1
- package/dist/agent/CliAdapterBase.d.ts.map +1 -1
- package/dist/agent/CliAdapterBase.js +8 -1
- package/dist/agent/CliAdapterBase.js.map +1 -1
- package/dist/agent/cliAvailability.d.ts +2 -5
- package/dist/agent/cliAvailability.d.ts.map +1 -1
- package/dist/agent/cliAvailability.js +6 -41
- package/dist/agent/cliAvailability.js.map +1 -1
- package/dist/agent/session.d.ts +5 -0
- package/dist/agent/session.d.ts.map +1 -1
- package/dist/agent/session.js +8 -0
- package/dist/agent/session.js.map +1 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +40 -0
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/desktop.d.ts +2 -0
- package/dist/commands/desktop.d.ts.map +1 -1
- package/dist/commands/desktop.js +102 -31
- package/dist/commands/desktop.js.map +1 -1
- package/dist/core/workspace.d.ts +10 -1
- package/dist/core/workspace.d.ts.map +1 -1
- package/dist/core/workspace.js +21 -4
- package/dist/core/workspace.js.map +1 -1
- package/dist/core/worktree.d.ts +10 -4
- package/dist/core/worktree.d.ts.map +1 -1
- package/dist/core/worktree.js +34 -47
- package/dist/core/worktree.js.map +1 -1
- package/dist/generators/base.d.ts.map +1 -1
- package/dist/generators/base.js +0 -1
- package/dist/generators/base.js.map +1 -1
- package/dist/gui/assets/AgentsPage-DbivhmK0.js +3 -0
- package/dist/gui/assets/DashboardPage-D50Qrm3e.js +1 -0
- package/dist/gui/assets/{GettingStartedPage-BKeuSHZQ.js → GettingStartedPage-1MOTng3B.js} +1 -1
- package/dist/gui/assets/{NullStore-DuSDhGOe.js → NullStore-tdPen1kp.js} +1 -1
- package/dist/gui/assets/ProjectsPage-srKgf7VN.js +1 -0
- package/dist/gui/assets/ScaffoldRepoInline-CP0yn5mw.js +1 -0
- package/dist/gui/assets/SettingsPage-DWmrLV8o.js +1 -0
- package/dist/gui/assets/SkillsPage-CKjTXdrd.js +6 -0
- package/dist/gui/assets/StartWorkPage-BCUnJ9k8.js +1 -0
- package/dist/gui/assets/{StrategiesPage-BRQMly_d.js → StrategiesPage-CdCbbIu-.js} +2 -2
- package/dist/gui/assets/WorkroomsPage-BcT-mGtT.js +4 -0
- package/dist/gui/assets/WorkspacesPage-CYFCm-7_.js +2 -0
- package/dist/gui/assets/{alert-dialog-BHEUQVyS.js → alert-dialog-u7qgb9Hq.js} +1 -1
- package/dist/gui/assets/badge-DwXvB44H.js +1 -0
- package/dist/gui/assets/chunk-BV7QT456-DfUBKG-z.js +3 -0
- package/dist/gui/assets/index-3tD_IeyQ.js +55 -0
- package/dist/gui/assets/index-CK5YRfPV.css +2 -0
- package/dist/gui/assets/tabs-BrHKp5bD.js +1 -0
- package/dist/gui/assets/{useAriaLabelledBy-BmJErI5a.js → useAriaLabelledBy-C4zV-1Ra.js} +1 -1
- package/dist/gui/assets/{vsc-eMRaEwN3.js → vsc-D80c4gBT.js} +1 -1
- package/dist/gui/index.html +5 -8
- package/dist/orchestration/runner.d.ts.map +1 -1
- package/dist/orchestration/runner.js +28 -10
- package/dist/orchestration/runner.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +116 -10
- package/dist/server.js.map +1 -1
- package/dist/utils/repo-freshness.d.ts +106 -0
- package/dist/utils/repo-freshness.d.ts.map +1 -0
- package/dist/utils/repo-freshness.js +405 -0
- package/dist/utils/repo-freshness.js.map +1 -0
- package/dist/utils/session-finder.d.ts.map +1 -1
- package/dist/utils/session-finder.js +23 -8
- package/dist/utils/session-finder.js.map +1 -1
- package/dist/utils/terminal-launch.d.ts +4 -2
- package/dist/utils/terminal-launch.d.ts.map +1 -1
- package/dist/utils/terminal-launch.js +26 -16
- package/dist/utils/terminal-launch.js.map +1 -1
- package/dist/utils/user-paths.d.ts +23 -0
- package/dist/utils/user-paths.d.ts.map +1 -0
- package/dist/utils/user-paths.js +126 -0
- package/dist/utils/user-paths.js.map +1 -0
- package/package.json +6 -2
- package/dist/gui/assets/AgentsPage-CnXzZFo1.js +0 -3
- package/dist/gui/assets/DashboardPage-rm3hKgsw.js +0 -1
- package/dist/gui/assets/ProjectsPage-CioaA4uf.js +0 -1
- package/dist/gui/assets/ScaffoldRepoInline-DKZ1rPmE.js +0 -1
- package/dist/gui/assets/Separator-BgWyHDtg.js +0 -1
- package/dist/gui/assets/SettingsPage-BevO8oge.js +0 -1
- package/dist/gui/assets/SkillsPage-D2stJRWy.js +0 -6
- package/dist/gui/assets/StartWorkPage-C8a6eN90.js +0 -1
- package/dist/gui/assets/WorkroomsPage-KqBkRD-x.js +0 -4
- package/dist/gui/assets/WorkspacesPage-DcA2i5HN.js +0 -2
- package/dist/gui/assets/badge-DTBzXOWn.js +0 -1
- package/dist/gui/assets/index-BB4BuHBQ.css +0 -2
- package/dist/gui/assets/index-BTe-_1Mu.js +0 -57
- package/dist/gui/assets/isElementDisabled-BrwmCB1d.js +0 -1
- package/dist/gui/assets/menu-d_G9km1-.js +0 -1
- package/dist/gui/assets/tabs-BHwTt4t1.js +0 -1
- package/dist/gui/assets/useValueChanged-WS99hTmm.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{_ as e,g as t,h as n,m as r,t as i}from"./button-CREn1mup.js";import{n as a,t as o}from"./badge-
|
|
1
|
+
import{_ as e,g as t,h as n,m as r,t as i}from"./button-CREn1mup.js";import{n as a,t as o}from"./badge-DwXvB44H.js";import{t as s}from"./circle-plus--zM3-3r3.js";import{t as c}from"./trash-2-CMdv3eD3.js";import{C as l,S as u,a as d,b as f,d as p,i as m,n as h,o as g,r as _,t as v,ut as y,w as b,wn as x,x as S}from"./index-3tD_IeyQ.js";import{t as C}from"./card-yrg6ov8B.js";import{t as w}from"./label-DC730X8s.js";var T=n(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),E=n(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]);e();var D=t();function O(e){let{workflowTemplates:t,isEditingTemplate:n,setIsEditingTemplate:O,mgtTemplateName:k,setMgtTemplateName:A,mgtTemplateContent:j,setMgtTemplateContent:M,selectedMgtTemplateId:N,setSelectedMgtTemplateId:P,analysisResult:F,setAnalysisResult:I,showToast:L,handleAnalyzeTemplate:R,handleSaveTemplate:z,handleDeleteTemplate:B,aiAssistants:V,analyzingTemplate:H,mgtAnalysisComment:U,setMgtAnalysisComment:W,suggestedImprovement:G,setSuggestedImprovement:K,savingTemplate:q,deletingTemplate:J,selectedInspectAssistant:Y,setSelectedInspectAssistant:X}=e,Z=t.find(e=>e.id===N),Q=V.filter(e=>e.detected&&e.command),$=Q.find(e=>e.name===Y)?.displayName??`No Harness Found`;return(0,D.jsxs)(`div`,{className:`mx-auto max-w-6xl animate-fade-in`,children:[(0,D.jsxs)(`header`,{className:`mb-6 border-b border-border/70 pb-4`,children:[(0,D.jsx)(`h1`,{className:`text-xl font-bold tracking-tight text-foreground`,children:`Team Collaboration Strategies`}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Predefine and review custom teamwork orchestration templates injected into workspaces' AGENTS.md files.`})]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 text-left lg:grid-cols-12`,children:[(0,D.jsx)(`div`,{className:`flex flex-col gap-4 lg:col-span-4`,children:(0,D.jsxs)(C,{className:`rounded-xl border border-border/80 bg-card/70 backdrop-blur-md p-5 shadow-xs`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Strategies`}),(0,D.jsxs)(i,{size:`sm`,onClick:()=>{O(!0),A(`New Strategy`),M(`# New Strategy
|
|
2
2
|
|
|
3
|
-
Write custom teamwork rules here for subagent orchestration...`),P(null),I(null)},children:[(0,D.jsx)(s,{size:12}),` Add New`]})]}),(0,D.jsx)(
|
|
3
|
+
Write custom teamwork rules here for subagent orchestration...`),P(null),I(null)},children:[(0,D.jsx)(s,{size:12}),` Add New`]})]}),(0,D.jsx)(y,{className:`mt-4 max-h-[480px]`,children:(0,D.jsx)(`div`,{className:`flex flex-col gap-2 pr-1`,children:t.map(e=>{let t=N===e.id;return(0,D.jsxs)(`div`,{className:r(`flex cursor-pointer flex-col gap-1.5 rounded-lg border p-3 text-left transition-colors`,t?`border-primary bg-primary/5 ring-1 ring-primary/40`:`border-border bg-card hover:border-foreground/15 hover:bg-muted/40`),onClick:()=>{P(e.id),O(!1),A(e.name),M(e.content),I(null)},children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,D.jsx)(`span`,{className:r(`text-xs font-semibold`,t?`text-primary`:`text-foreground`),children:e.name}),(0,D.jsx)(o,{variant:e.custom?`info`:`secondary`,size:`sm`,className:`font-mono uppercase`,children:e.custom?`Custom`:`Built-in`})]}),(0,D.jsx)(`p`,{className:`line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:e.description})]},e.id)})})})]})}),(0,D.jsx)(`div`,{className:`flex flex-col gap-6 lg:col-span-8`,children:N||n?(0,D.jsxs)(C,{className:`flex flex-col gap-5 rounded-xl p-6 shadow-sm`,children:[(0,D.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,D.jsx)(`div`,{className:`flex-1`,children:n?(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,D.jsx)(w,{className:`text-sm`,children:`Strategy Name`}),(0,D.jsx)(a,{type:`text`,value:k,onChange:e=>A(e.target.value),placeholder:`e.g. Test-Driven Development`})]}):(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold text-foreground`,children:[k,Z?.custom&&(0,D.jsx)(o,{variant:`info`,className:`font-mono uppercase`,children:`Custom Template`})]}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:Z?.description||`Custom strategy template.`})]})}),(0,D.jsx)(`div`,{className:`flex gap-2`,children:n?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>{if(N){let e=t.find(e=>e.id===N);e&&(A(e.name),M(e.content)),O(!1)}else if(O(!1),t.length>0){let e=t[0];P(e.id),A(e.name),M(e.content)}},children:`Cancel`}),(0,D.jsx)(i,{size:`sm`,onClick:z,disabled:q,children:q?`Saving...`:`Save Strategy`})]}):(0,D.jsxs)(D.Fragment,{children:[Z?.custom&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>O(!0),children:`Edit`}),(0,D.jsxs)(i,{variant:`destructive`,size:`sm`,onClick:()=>B(N),disabled:J,children:[(0,D.jsx)(c,{size:12}),` Delete`]})]}),!Z?.custom&&(0,D.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>{O(!0),A(`${k} Copy`),M(j),P(null),I(null)},children:`Duplicate & Customize`})]})})]}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,D.jsx)(w,{className:`text-sm`,children:`Guidelines Markdown`}),(0,D.jsx)(g,{className:`min-h-[250px] font-mono text-xs leading-relaxed`,value:j,onChange:e=>M(e.target.value),disabled:!n,placeholder:`Write cooperation guidelines in Markdown...`})]}),!n&&N&&(0,D.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-border pt-5`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col items-start justify-between gap-4 sm:flex-row sm:items-center`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col`,children:[(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold text-foreground`,children:[(0,D.jsx)(x,{size:14,className:`text-muted-foreground`}),` AI Strategy Analysis`]}),(0,D.jsx)(`span`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`Select an AI assistant harness installed on your system to inspect these guidelines.`})]}),(0,D.jsxs)(`div`,{className:`flex w-full items-center justify-end gap-3 sm:w-auto`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Harness:`}),(0,D.jsxs)(f,{value:Y,disabled:Q.length===0,onValueChange:e=>typeof e==`string`&&X(e),children:[(0,D.jsx)(l,{size:`sm`,className:`w-44`,"aria-label":`Harness`,children:(0,D.jsx)(b,{children:$})}),(0,D.jsx)(u,{alignItemWithTrigger:!1,children:Q.length>0?Q.map(e=>(0,D.jsx)(S,{value:e.name,children:e.displayName},e.name)):(0,D.jsx)(S,{value:``,children:`No Harness Found`})})]})]}),(0,D.jsx)(i,{size:`sm`,onClick:()=>R(N,j,Y),disabled:H||Q.length===0,children:H?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(p,{className:`size-3`}),` Inspecting...`]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(x,{size:12}),` Inspect Strategy`]})})]})]}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,D.jsx)(w,{className:`text-left text-xs uppercase tracking-wider text-muted-foreground`,children:`Evaluation Focus / Instructions (Optional)`}),(0,D.jsx)(g,{className:`min-h-[60px] text-xs leading-relaxed`,value:U,onChange:e=>W(e.target.value),placeholder:`e.g. Focus on checking if timeouts are handled well, check subagent roles coordination...`,disabled:H})]})]}),F&&(0,D.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,D.jsx)(y,{className:`max-h-[300px] rounded-xl border border-border bg-muted/40 p-5`,children:(0,D.jsx)(`div`,{className:`select-text whitespace-pre-wrap text-left text-xs leading-relaxed text-foreground`,children:F})}),G&&(0,D.jsx)(`div`,{className:`flex justify-end`,children:(0,D.jsxs)(i,{size:`sm`,onClick:()=>{M(G),O(!0),K(null),I(null),L(`Suggested improvements applied! Click Save to persist changes.`,`success`)},children:[(0,D.jsx)(T,{size:14}),` Apply Suggested Improvements`]})})]})]})]}):(0,D.jsx)(`div`,{className:`flex min-h-[400px] flex-col items-center justify-center`,children:(0,D.jsx)(v,{className:`w-full max-w-md border border-dashed border-border`,children:(0,D.jsxs)(_,{children:[(0,D.jsx)(m,{variant:`icon`,children:(0,D.jsx)(E,{})}),(0,D.jsx)(d,{children:`No strategy template selected`}),(0,D.jsx)(h,{children:`Select a template from the list to view, edit, or analyze it, or add a new custom teamwork workflow template.`})]})})})})]})]})}export{O as StrategiesPage};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{_ as e,b as t,g as n,h as r,t as i}from"./button-CREn1mup.js";import{n as a,t as o}from"./badge-DwXvB44H.js";import{n as ee,r as te,t as ne}from"./shield-check-Dd1Yv3l2.js";import{t as s}from"./git-branch-Ce0I2663.js";import{i as c,n as l,o as re,r as u,t as ie}from"./tabs-BrHKp5bD.js";import{t as ae}from"./trash-2-CMdv3eD3.js";import{C as d,S as oe,d as se,i as f,t as p,x as m}from"./brand-hHByyyzq.js";import{C as h,Ct as ce,Dn as le,Mn as g,Nn as ue,S as _,St as de,_n as v,b as y,bt as b,ct as x,d as S,hn as fe,o as C,pn as pe,s as me,sn as he,st as w,un as ge,w as T,wt as E,x as D,xt as O}from"./index-3tD_IeyQ.js";import{a as k,i as A,n as j,r as M,t as N}from"./card-yrg6ov8B.js";import{t as P}from"./label-DC730X8s.js";import{n as _e,r as ve,t as ye}from"./alert-QnMXzwpU.js";var be=r(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),F=r(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),xe=r(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Se=r(`clipboard`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]),Ce=r(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),we=r(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),I=r(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Te=r(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Ee=r(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),De=r(`lock-keyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),Oe=r(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),ke=r(`package-check`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16 17 2 2 4-4`,key:`uh5qu3`}],[`path`,{d:`M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753`,key:`kpkbpo`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),Ae=r(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),je=r(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Me=r(`user-check`,[[`path`,{d:`m16 11 2 2 4-4`,key:`9rsbq5`}],[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Ne=r(`user-minus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),L=r(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),R=t(e(),1),z=n(),Pe=[{pattern:/plan|decision|context|document|handoff/i,label:`Shared context`,tool:`context`},{pattern:/resource|package|skill|agent/i,label:`Resource evidence`,tool:`resources`},{pattern:/workflow|step|completion|evidence/i,label:`Workflow evidence`,tool:`workflow`},{pattern:/member|join|participant|invite/i,label:`People`,tool:`members`},{pattern:/password|credential|security|certificate|tls/i,label:`Security record`,tool:`security`}],Fe=[{tool:`overview`,label:`Project & privacy`,icon:ne},{tool:`context`,label:`Shared context`,icon:ee},{tool:`resources`,label:`Resources`,icon:ke},{tool:`workflow`,label:`Workflow`,icon:s},{tool:`members`,label:`People`,icon:he},{tool:`activity`,label:`Full activity log`,icon:ue},{tool:`security`,label:`Security & export`,icon:De}];function Ie(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t)}function Le(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t)}function B(e){return e.role===`host`?`host`:e.role===`publisher`?`publisher`:`member`}function V(e){switch(e){case`in_progress`:return`In progress`;case`completion_proposed`:return`Review requested`;case`completed`:return`Complete`;case`skipped`:return`Skipped`;default:return`Pending`}}function Re({status:e}){return e===`completed`?(0,z.jsx)(le,{"aria-hidden":`true`,className:`text-success`,size:14}):e===`in_progress`?(0,z.jsx)(F,{"aria-hidden":`true`,className:`text-primary`,size:14}):e===`completion_proposed`?(0,z.jsx)(Ce,{"aria-hidden":`true`,className:`text-warning`,size:14}):(0,z.jsx)(xe,{"aria-hidden":`true`,className:`text-muted-foreground`,size:14})}function H({participant:e,emphasized:t=!1}){return(0,z.jsx)(`span`,{"aria-hidden":`true`,"data-role":e?.role??`system`,className:`grid shrink-0 place-items-center rounded-full border ${t?`size-9 border-primary/60 bg-primary/15 text-primary`:`size-8 border-border bg-muted text-muted-foreground`}`,children:(0,z.jsx)(L,{"aria-hidden":`true`,size:t?17:15})})}function ze({snapshot:e,roomUrl:t,isHost:n,me:r,busy:a,message:c,hasUnsavedHandoffDraft:l,headingRef:re,onCreateInvite:u,onRefresh:ie,onStopOrLeave:ae,onOpenTool:d,onMessageChange:oe,onPostUpdate:se}){let f=(0,R.useMemo)(()=>e.participants.filter(e=>!e.revokedAt),[e.participants]),p=(0,R.useMemo)(()=>new Map(e.participants.map(e=>[e.id,e])),[e.participants]),m=e.workflowProgress,h=m?.steps.findIndex(e=>e.status===`completion_proposed`)??-1,le=m?.steps.findIndex(e=>e.status===`in_progress`)??-1,_=h>=0?h:le,v=m?.steps.findIndex(e=>e.status===`pending`)??-1,y=_>=0?m?.steps[_]:void 0,x=v>=0?m?.steps[v]:void 0,S=m?.package.steps.find(e=>e.id===y?.stepId),me=m?.package.steps.find(e=>e.id===x?.stepId),he=_>=0?m?.steps.slice(_+1).find(e=>e.status===`pending`):void 0,w=m?.package.steps.find(e=>e.id===he?.stepId),T=y?p.get(y.updatedBy):void 0,D=!!(m?.steps.length&&m.steps.every(e=>e.status===`completed`||e.status===`skipped`)),k=e.activity.slice(-20);return(0,z.jsxs)(`section`,{"aria-labelledby":`handoff-stream-title`,className:`animate-fade-in`,"data-testid":`handoff-stream`,children:[(0,z.jsx)(`header`,{className:`border-b border-border pb-4`,children:(0,z.jsxs)(`div`,{className:`flex flex-col gap-4 xl:flex-row xl:items-center xl:justify-between`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 xl:flex-1`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(ue,{"aria-hidden":`true`,className:`text-muted-foreground`,size:17}),(0,z.jsx)(`h1`,{ref:re,id:`handoff-stream-title`,tabIndex:-1,className:`text-lg font-semibold tracking-tight outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:`Handoff Stream`}),(0,z.jsxs)(o,{variant:`success`,children:[(0,z.jsx)(`span`,{className:`mr-1 inline-block size-1.5 rounded-full bg-success`}),`Live`]})]}),(0,z.jsx)(`p`,{className:`mt-1 truncate text-sm text-muted-foreground`,children:e.bundle.feature.goal})]}),(0,z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 sm:gap-3`,children:[(0,z.jsxs)(`div`,{"aria-label":`${f.length} participants`,className:`flex items-center gap-1`,children:[f.slice(0,4).map(e=>(0,z.jsxs)(`span`,{className:`flex items-center gap-2 rounded-md px-1 py-0.5`,title:`${e.displayName} · ${B(e)}`,children:[(0,z.jsx)(H,{participant:e,emphasized:e.id===r?.id}),(0,z.jsxs)(`span`,{className:`hidden max-w-24 leading-tight 2xl:block`,children:[(0,z.jsx)(`span`,{className:`block truncate text-xs font-semibold`,children:e.displayName}),(0,z.jsx)(`span`,{className:`block text-[10px] text-muted-foreground`,children:B(e)})]})]},e.id)),f.length>4&&(0,z.jsxs)(`span`,{className:`grid size-8 place-items-center rounded-full border border-border bg-muted text-[10px] font-semibold text-muted-foreground`,children:[`+`,f.length-4]})]}),n&&(0,z.jsxs)(i,{variant:`outline`,onClick:u,disabled:a!==null,children:[(0,z.jsx)(Ee,{"aria-hidden":`true`}),` Invite`,e.pendingJoins.length>0&&(0,z.jsx)(`span`,{className:`ml-0.5 rounded bg-warning/15 px-1 text-[10px] text-warning-foreground`,children:e.pendingJoins.length})]}),(0,z.jsxs)(b,{children:[(0,z.jsx)(E,{"aria-label":`Open room tools`,className:`grid size-8 cursor-pointer place-items-center rounded-md border border-border bg-card text-muted-foreground shadow-2xs transition-colors hover:bg-accent hover:text-foreground`,children:(0,z.jsx)(I,{"aria-hidden":`true`,size:16})}),(0,z.jsxs)(de,{align:`end`,className:`w-56`,children:[Fe.map(({tool:t,label:n,icon:r})=>(0,z.jsxs)(O,{onClick:()=>d(t),children:[(0,z.jsx)(r,{"aria-hidden":`true`}),` `,n,t===`members`&&e.pendingJoins.length>0&&(0,z.jsx)(`span`,{className:`ml-auto text-[10px] text-warning-foreground`,children:e.pendingJoins.length})]},t)),(0,z.jsx)(ce,{}),(0,z.jsxs)(O,{onClick:ie,children:[(0,z.jsx)(fe,{"aria-hidden":`true`}),` Refresh room`]}),(0,z.jsxs)(O,{variant:`destructive`,disabled:a!==null,onClick:()=>{let e=n?`stop hosting this Workroom`:`leave this Workroom`;window.confirm(`Are you sure you want to ${e}?`)&&ae()},children:[(0,z.jsx)(ge,{"aria-hidden":`true`}),` `,n?`Stop room`:`Leave room`]})]})]})]})]})}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-4 xl:grid-cols-[minmax(0,1fr)_17rem]`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[(0,z.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border border-primary/35 bg-primary/10 px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,z.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-full border border-primary/50 bg-primary/12 text-primary`,children:(0,z.jsx)(s,{"aria-hidden":`true`,size:17})}),(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`text-sm font-semibold`,children:m?D?`Workflow complete`:y?.status===`completion_proposed`?`A review is ready`:y?`Work is moving`:`Workflow ready`:`No shared workflow yet`}),(0,z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:D?`Every shared step has been completed.`:m&&y?`${T?.displayName||`A participant`} updated ${S?.title||y.stepId} · step ${_+1} of ${m.steps.length}${w?` · next: ${w.title}`:``}`:m&&x?`Next: ${me?.title||x.stepId} · step ${v+1} of ${m.steps.length}`:m?`The shared workflow is ready to start.`:n?`Choose a reviewed workflow to make the next handoff explicit.`:`The host has not selected a shared workflow yet.`})]})]}),(m||n)&&(0,z.jsxs)(i,{size:`sm`,onClick:()=>d(`workflow`),children:[y?.status===`completion_proposed`?`Review proposal`:m?`Open workflow`:`Set workflow`,(0,z.jsx)(te,{"aria-hidden":`true`})]})]}),(0,z.jsxs)(`div`,{className:`rounded-lg border border-border bg-card`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-3`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Room activity`}),(0,z.jsx)(`p`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:`Decisions, evidence, and handoffs shared with this room.`})]}),(0,z.jsxs)(i,{variant:`ghost`,size:`xs`,onClick:()=>d(`activity`),children:[`View log `,(0,z.jsx)(g,{"aria-hidden":`true`})]})]}),k.length>0?(0,z.jsx)(`ol`,{"aria-label":`Workroom activity`,className:`relative divide-y divide-border/70 before:absolute before:bottom-8 before:left-[2.05rem] before:top-8 before:w-px before:bg-border`,children:k.map(e=>{let t=p.get(e.actorId),n=Pe.find(({pattern:t})=>t.test(e.type));return(0,z.jsxs)(`li`,{className:`relative flex gap-3 px-4 py-4 sm:gap-4`,children:[(0,z.jsx)(`span`,{className:`relative z-10 rounded-full bg-card p-0.5`,children:(0,z.jsx)(H,{participant:t,emphasized:t?.id===r?.id})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,z.jsx)(`span`,{className:`min-w-0 break-words text-xs font-semibold [overflow-wrap:anywhere]`,children:t?.displayName||`Historical participant`}),t&&(0,z.jsx)(o,{variant:t.role===`host`?`info`:`secondary`,children:B(t)}),(0,z.jsx)(`time`,{className:`text-[10px] text-muted-foreground`,dateTime:e.createdAt,children:Ie(e.createdAt)})]}),(0,z.jsx)(`p`,{className:`mt-1.5 break-words text-sm font-medium text-foreground [overflow-wrap:anywhere]`,children:e.summary}),(0,z.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:[e.type,` · event #`,e.sequence]}),n&&(0,z.jsxs)(`button`,{type:`button`,className:`mt-2 inline-flex cursor-pointer items-center gap-1.5 rounded-md border border-border bg-muted/35 px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,onClick:()=>d(n.tool),children:[(0,z.jsx)(ee,{"aria-hidden":`true`,size:12}),` `,n.label]})]})]},e.sequence)})}):(0,z.jsxs)(`div`,{className:`px-4 py-10 text-center`,children:[(0,z.jsx)(ue,{"aria-hidden":`true`,className:`mx-auto text-muted-foreground`,size:20}),(0,z.jsx)(`p`,{className:`mt-2 text-sm font-medium`,children:`No shared activity yet`}),(0,z.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Post an update below to begin the handoff stream.`})]}),(0,z.jsxs)(`form`,{className:`border-t border-border p-3`,onSubmit:async e=>{e.preventDefault();let t=c.trim();!t||a!==null||l||await se(t)},children:[(0,z.jsx)(`label`,{className:`sr-only`,htmlFor:`handoff-stream-message`,children:`Share a handoff update`}),(0,z.jsx)(C,{id:`handoff-stream-message`,className:`min-h-20 resize-y border-0 bg-transparent px-1 py-1 shadow-none focus-visible:ring-0`,maxLength:4e3,placeholder:`Share a decision, result, blocker, or next step…`,value:c,onChange:e=>oe(e.target.value),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&e.currentTarget.form?.requestSubmit()}}),(0,z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Only the text you enter is shared from this composer. No files, diffs, paths, credentials, or transcripts are collected automatically.`}),l&&(0,z.jsx)(`p`,{className:`text-[10px] text-warning-foreground`,children:`Resolve your unsaved Handoff draft in Shared context before posting another update.`})]}),(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2`,children:[l&&(0,z.jsx)(i,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>d(`context`),children:`Review draft`}),(0,z.jsxs)(i,{type:`submit`,size:`sm`,disabled:!c.trim()||a!==null||l,children:[(0,z.jsx)(pe,{"aria-hidden":`true`}),` `,a===`stream-post`?`Posting…`:`Post update`]})]})]})]})]})]}),(0,z.jsxs)(`aside`,{"aria-label":`Workroom details`,className:`h-fit divide-y divide-border rounded-lg border border-border bg-card xl:sticky xl:top-4`,children:[(0,z.jsxs)(`section`,{className:`p-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsxs)(`h2`,{className:`text-xs font-semibold`,children:[`Steps `,m?`(${m.steps.length})`:``]}),(m||n)&&(0,z.jsx)(`button`,{type:`button`,onClick:()=>d(`workflow`),className:`cursor-pointer text-muted-foreground hover:text-foreground`,"aria-label":`Open workflow tools`,children:(0,z.jsx)(Ae,{"aria-hidden":`true`,size:14})})]}),m?(0,z.jsx)(`ol`,{className:`mt-3 space-y-1`,children:m.steps.map((e,t)=>{let n=m.package.steps.find(t=>t.id===e.stepId),r=p.get(e.updatedBy),i=V(e.status);return(0,z.jsx)(`li`,{children:(0,z.jsxs)(`button`,{type:`button`,onClick:()=>d(`workflow`),className:`group flex w-full cursor-pointer items-start gap-2 rounded-md px-1 py-2 text-left hover:bg-accent/60`,children:[(0,z.jsx)(`span`,{className:`mt-0.5 grid size-5 shrink-0 place-items-center rounded-full border border-border bg-background text-[10px]`,children:t+1}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block truncate text-xs ${e.status===`in_progress`||e.status===`completion_proposed`?`font-semibold text-foreground`:`text-muted-foreground`}`,children:n?.title||e.stepId}),(0,z.jsx)(`span`,{className:`mt-0.5 block truncate text-[10px] text-muted-foreground`,children:e.status===`pending`||!r?i:`${i} · updated by ${r.displayName}`})]}),(0,z.jsx)(`span`,{className:`mt-1`,children:(0,z.jsx)(Re,{status:e.status})})]})},e.stepId)})}):n?(0,z.jsxs)(`button`,{type:`button`,onClick:()=>d(`workflow`),className:`mt-3 w-full cursor-pointer rounded-md border border-dashed border-border px-3 py-4 text-left hover:bg-accent/50`,children:[(0,z.jsx)(`span`,{className:`text-xs font-medium`,children:`Make turns explicit`}),(0,z.jsx)(`span`,{className:`mt-1 block text-[10px] text-muted-foreground`,children:`Select a shared workflow and require evidence for completion.`})]}):(0,z.jsxs)(`div`,{className:`mt-3 rounded-md border border-dashed border-border px-3 py-4`,children:[(0,z.jsx)(`span`,{className:`text-xs font-medium`,children:`Waiting for a workflow`}),(0,z.jsx)(`span`,{className:`mt-1 block text-[10px] text-muted-foreground`,children:`The host can select a shared workflow for this room.`})]})]}),(0,z.jsxs)(`section`,{className:`p-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsxs)(`h2`,{className:`text-xs font-semibold`,children:[`Participants (`,f.length,`)`]}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>d(`members`),className:`cursor-pointer text-[10px] text-muted-foreground hover:text-foreground`,children:`Manage`})]}),(0,z.jsx)(`ul`,{className:`mt-3 space-y-2.5`,children:f.slice(0,6).map(e=>(0,z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(H,{participant:e,emphasized:e.id===r?.id}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.displayName}),(0,z.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:B(e)})]},e.id))})]}),(0,z.jsxs)(`section`,{className:`space-y-2.5 p-4`,children:[(0,z.jsx)(`h2`,{className:`text-xs font-semibold`,children:`Room details`}),(0,z.jsxs)(`dl`,{className:`space-y-2 text-[11px]`,children:[(0,z.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Created by`}),(0,z.jsx)(`dd`,{className:`truncate text-right`,children:e.participants.find(e=>e.role===`host`)?.displayName||`Host`})]}),(0,z.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Created`}),(0,z.jsx)(`dd`,{className:`text-right`,children:Le(e.createdAt)})]}),(0,z.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Workspace`}),(0,z.jsx)(`dd`,{className:`truncate text-right`,children:e.bundle.feature.id})]}),(0,z.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Status`}),(0,z.jsxs)(`dd`,{className:`inline-flex items-center gap-1.5`,children:[`Live `,(0,z.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`})]})]})]}),(0,z.jsx)(`p`,{className:`truncate border-t border-border pt-2 font-mono text-[9px] text-muted-foreground`,title:t,children:t})]}),(0,z.jsx)(`section`,{className:`p-3`,children:(0,z.jsxs)(i,{variant:`ghost`,className:`w-full justify-start`,onClick:()=>d(`security`),children:[(0,z.jsx)(ne,{"aria-hidden":`true`}),` Security & encrypted export`]})})]})]})]})}var U={plan:`Plan`,decisions:`Decisions & knowledge`,handoff:`Handoff`},Be={overview:`Project & privacy`,context:`Shared context`,resources:`Resources`,workflow:`Workflow`,members:`People`,activity:`Full activity log`,security:`Security & encrypted export`};function Ve(){let e=new Uint8Array(18);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/[+/=]/g,``).slice(0,24)}function He(e){return e instanceof Error?e.message:String(e)}function W(e){return e.mode===`host`||e.mode===`guest`?e.snapshot:void 0}function Ue(e,t){return e.mode===`host`||e.mode===`guest`?{...e,snapshot:t}:e}function We(e,t){let n=W(e),r=W(t);if(!n||!r||n.roomId!==r.roomId)return t;let i=r.revision>=n.revision?r:n,a={plan:r.documents.plan.revision>=n.documents.plan.revision?r.documents.plan:n.documents.plan,decisions:r.documents.decisions.revision>=n.documents.decisions.revision?r.documents.decisions:n.documents.decisions,handoff:r.documents.handoff.revision>=n.documents.handoff.revision?r.documents.handoff:n.documents.handoff};return Ue(t,{...i,documents:a})}function Ge(e,t,n){let r=W(e);return!r||r.roomId!==t||n.revision<r.documents.handoff.revision?e:Ue(e,{...r,documents:{...r.documents,handoff:n}})}async function Ke(e,t){let n=JSON.stringify({bundle:e,documents:{plan:t.plan,decisions:t.decisions,handoff:t.handoff}}),r=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(n));return[...new Uint8Array(r)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function qe({workspaces:e,showToast:t}){let[n,r]=(0,R.useState)({mode:`idle`}),[ee,te]=(0,R.useState)([]),[s,ce]=(0,R.useState)(null),[g,de]=(0,R.useState)(``),[b,pe]=(0,R.useState)(null),[E,O]=(0,R.useState)({plan:``,decisions:``,handoff:``}),[F,xe]=(0,R.useState)({plan:!1,decisions:!1,handoff:!1}),[Ce,I]=(0,R.useState)(!1),[De,Ae]=(0,R.useState)(``),[L,Pe]=(0,R.useState)(``),[Fe,Ie]=(0,R.useState)(`4242`),[Le,B]=(0,R.useState)(``),[V,Re]=(0,R.useState)(()=>Ve()),[H,W]=(0,R.useState)(``),[Ue,qe]=(0,R.useState)(``),[Je,Ye]=(0,R.useState)(``),[Xe,Ze]=(0,R.useState)(``),[Qe,$e]=(0,R.useState)(``),[et,tt]=(0,R.useState)(``),[nt,rt]=(0,R.useState)({plan:``,decisions:``,handoff:``}),[G,it]=(0,R.useState)({plan:!1,decisions:!1,handoff:!1}),[K,at]=(0,R.useState)([]),[ot,st]=(0,R.useState)(``),[ct,lt]=(0,R.useState)(`0.1.0`),[ut,dt]=(0,R.useState)({}),[ft,pt]=(0,R.useState)(``),[mt,ht]=(0,R.useState)(`0.1.0`),[gt,_t]=(0,R.useState)(`Plan
|
|
2
|
+
Implement
|
|
3
|
+
Verify
|
|
4
|
+
Review`),[vt,yt]=(0,R.useState)({}),[bt,xt]=(0,R.useState)(()=>Ve()),[q,St]=(0,R.useState)(()=>Ve()),[Ct,wt]=(0,R.useState)(null),[J,Y]=(0,R.useState)(`stream`),[Tt,Et]=(0,R.useState)(``),[Dt,Ot]=(0,R.useState)([]),[kt,At]=(0,R.useState)([]),jt=(0,R.useRef)(null),Mt=(0,R.useRef)(null),Nt=(0,R.useRef)(null),Pt=(0,R.useRef)(!1),X=n.mode===`host`||n.mode===`guest`?n.snapshot:void 0,Z=n.mode===`host`,Ft=n.mode===`guest`&&n.status===`pending`,It=n.mode===`host`?X?.participants.find(e=>e.role===`host`):n.mode===`guest`?X?.participants.find(e=>e.id===n.memberId):void 0,Lt=It?.role===`host`||It?.role===`publisher`,Rt=!!X,Q=(0,R.useCallback)(async(e=!1)=>{try{let e=await x(`/api/workrooms/status`);r(t=>We(t,e.status))}catch(n){if(n instanceof w&&n.status===401)try{let e=await x(`/api/workrooms/session`);r(e.active&&e.locked&&e.roomType?{mode:`locked`,roomType:e.roomType}:{mode:`idle`});return}catch(n){e&&t(He(n),`error`);return}e&&t(He(n),`error`)}},[t]),zt=(0,R.useCallback)(async()=>{let[e,t]=await Promise.all([x(`/api/workrooms/paused`),x(`/api/workrooms/quarantined`)]);Ot(e.rooms),At(t.rooms)},[]);(0,R.useEffect)(()=>{Promise.all([Q(),x(`/api/workrooms/interfaces`).then(e=>{te(e.interfaces),Pe(t=>t||e.interfaces.find(e=>!e.internal&&e.family===`IPv4`)?.address||e.interfaces[0]?.address||``)}),zt()]);let e=window.setInterval(()=>void Q(),3e3);return()=>window.clearInterval(e)},[Q,zt]),(0,R.useEffect)(()=>{if(!g){pe(null);return}x(`/api/workrooms/preview/${encodeURIComponent(g)}`).then(({preview:e})=>{pe(e),O(e.documents),xe({plan:!1,decisions:!1,handoff:!1}),I(!1),Ae(t=>t||`${e.bundle.feature.id} workroom`)}).catch(e=>t(He(e),`error`))},[g,t]),(0,R.useEffect)(()=>{X&&rt(e=>({plan:G.plan?e.plan:X.documents.plan.content,decisions:G.decisions?e.decisions:X.documents.decisions.content,handoff:G.handoff?e.handoff:X.documents.handoff.content}))},[X,G]),(0,R.useEffect)(()=>{X?.workflowProgress&&yt(e=>Object.fromEntries(X.workflowProgress.steps.map(t=>[t.stepId,e[t.stepId]??t.evidence??``])))},[X?.workflowProgress]),(0,R.useEffect)(()=>{Rt&&x(`/api/workrooms/local-resources`).then(({resources:e})=>{at(e),st(t=>t||(e[0]?`${e[0].kind}:${e[0].id}`:``)),pt(t=>t||e.find(e=>e.kind===`workflow`)?.id||``)}).catch(()=>{})},[Rt]),(0,R.useEffect)(()=>{n.mode===`idle`&&(Et(``),Y(`stream`))},[n.mode]),(0,R.useEffect)(()=>{if(!Rt){Pt.current=!1;return}if(!Pt.current){Pt.current=!0;return}let e=window.requestAnimationFrame(()=>{J===`stream`?Mt.current?.focus():Nt.current?.focus()});return()=>window.cancelAnimationFrame(e)},[J,Rt]);let $=async(e,n,r)=>{if(jt.current!==null)return!1;jt.current=e,ce(e);try{return await n(),await Q(),await zt().catch(()=>{}),r&&t(r,`success`),!0}catch(e){return t(He(e),`error`,8e3),!1}finally{jt.current=null,ce(null)}},Bt=()=>$(`start`,async()=>{if(!b)throw Error(`Select and preview a workspace first.`);let e={plan:F.plan?E.plan:``,decisions:F.decisions?E.decisions:``,handoff:F.handoff?E.handoff:``},t=await x(`/api/workrooms/start`,{method:`POST`,body:JSON.stringify({workspaceId:g,name:De,address:L,port:Number(Fe),password:V,hostDisplayName:Le,contextConfirmed:Ce,contextDigest:await Ke(b.bundle,e),documents:e})});r(t.status)},`Workroom started.`),Vt=e=>$(`resume-${e}`,async()=>{let t=await x(`/api/workrooms/${encodeURIComponent(e)}/resume`,{method:`POST`,body:JSON.stringify({password:V})});r(t.status)},`Workroom resumed with its existing identity and memberships.`),Ht=e=>{window.confirm(`Discard failed import ${e}? This removes only its quarantined local files so you can retry the original encrypted export.`)&&$(`discard-${e}`,async()=>{await x(`/api/workrooms/quarantined/${encodeURIComponent(e)}/discard`,{method:`POST`,body:JSON.stringify({confirmRoomId:e})})},`Failed import discarded. You can retry the encrypted export.`)},Ut=()=>$(`join`,async()=>{let e=await x(`/api/workrooms/join`,{method:`POST`,body:JSON.stringify({invite:Je,password:Xe,displayName:Qe,workspaceId:g||void 0})});r(e.status)},`Join request sent to the host.`),Wt=()=>$(`poll`,async()=>{let e=await x(`/api/workrooms/join/poll`,{method:`POST`});r(e.status)}),Gt=()=>$(`stop`,async()=>{await x(`/api/workrooms/stop`,{method:`POST`}),r({mode:`idle`}),Y(`stream`),Et(``),W(``)},Z?`Workroom stopped.`:`Left the Workroom.`),Kt=()=>$(`invite`,async()=>{let e=await x(`/api/workrooms/invites`,{method:`POST`});W(e.invite),qe(e.expiresAt),await me(e.invite)},`One-use invitation copied. Share the password separately.`),qt=e=>$(`doc-${e}`,async()=>{if(X)try{await x(`/api/workrooms/documents/${e}`,{method:`PUT`,body:JSON.stringify({content:nt[e],expectedRevision:X.documents[e].revision})}),it(t=>({...t,[e]:!1}))}catch(e){throw e instanceof w&&e.status===409?(await Q(),Error(`Someone updated this document first. Your draft is preserved; compare it with the latest revision and save again.`,{cause:e})):e}},`${U[e]} shared.`),Jt=()=>$(`publish-resource`,async()=>{let[e,t]=ot.split(`:`);await x(`/api/workrooms/resources/publish`,{method:`POST`,body:JSON.stringify({kind:e,id:t,version:ct})})},`Immutable resource version published.`),Yt=e=>$(`download-${e}`,async()=>{let t=await x(`/api/workrooms/resources/${e}/download`,{method:`POST`});dt(n=>({...n,[e]:t.preview}))},`Resource downloaded to the local quarantine cache. Review it before applying.`),Xt=e=>$(`apply-${e}`,async()=>{let t=ut[e];if(!t)throw Error(`Download and review this resource again before applying it.`);await x(`/api/workrooms/resources/${e}/apply`,{method:`POST`,body:JSON.stringify({approvedDigest:e,approvedLocalDigest:t.localDigest})})},`Resource applied to your local ${p} catalog.`),Zt=e=>$(`quarantine-${e}`,async()=>{await x(`/api/workrooms/resources/${e}/quarantine`,{method:`POST`})},`Resource version quarantined and removed from future exports and downloads.`),Qt=e=>{window.confirm(`Permanently purge quarantined resource ${e}? Its package bytes and catalog entry will be removed so the room quota can be reused.`)&&$(`purge-${e}`,async()=>{await x(`/api/workrooms/resources/${e}/purge`,{method:`POST`,body:JSON.stringify({confirmDigest:e})})},`Quarantined resource permanently purged and its room quota released.`)},$t=()=>$(`select-workflow`,async()=>{let e=K.find(e=>e.kind===`workflow`&&e.id===ft);if(!e)throw Error(`Select a local workflow.`);let t=gt.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map((e,t)=>({id:`${t+1}-${e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`step`}`,title:e,requiresEvidence:!0}));await x(`/api/workrooms/workflow/select`,{method:`POST`,body:JSON.stringify({workflowId:e.id,version:mt,steps:t,expectedRevision:X?.workflowProgress?.revision??0})})},`Shared workflow selected.`),en=(e,t)=>$(`step-${e.stepId}`,async()=>{let n=X?.workflowProgress?.package.steps.find(t=>t.id===e.stepId),r=(vt[e.stepId]??e.evidence??``).trim();if(t===`completed`&&n?.requiresEvidence&&!r)throw Error(`Add evidence before completing this workflow step.`);await x(`/api/workrooms/workflow/steps/${encodeURIComponent(e.stepId)}/transition`,{method:`POST`,body:JSON.stringify({status:t,expectedRevision:e.revision,...t===`completed`&&r?{evidence:r}:{}})})}),tn=async e=>{let t=e.trim(),n=await $(`stream-post`,async()=>{if(!X)throw Error(`The Workroom snapshot is not available.`);if(G.handoff)throw Error(`Resolve the unsaved Handoff draft in Shared context before posting another update.`);let e=X.documents.handoff.content.trimEnd(),n=e?`${e}\n\n${t}\n`:`${t}\n`;try{let e=await x(`/api/workrooms/documents/handoff`,{method:`PUT`,body:JSON.stringify({content:n,expectedRevision:X.documents.handoff.revision})});r(t=>Ge(t,X.roomId,e.document))}catch(e){throw e instanceof w&&e.status===409?(await Q(),Error(`Someone updated the handoff first. Your update is preserved; review the latest shared context and post again.`,{cause:e})):e}},`Handoff update shared.`);return n&&Et(e=>e.trim()===t?``:e),n},nn=()=>$(`export`,async()=>{let e=await x(`/api/workrooms/export`,{method:`POST`,body:JSON.stringify({passphrase:q})}),t=new Blob([JSON.stringify(e.export,null,2)],{type:`application/json`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`${X?.roomId??`${f}-workroom`}${d}`,n.click(),URL.revokeObjectURL(n.href)},`Encrypted Workroom export created.`),rn=()=>$(`import`,async()=>{if(!Ct)throw Error(`Choose a ${d} or ${oe} export first.`);let e=await x(`/api/workrooms/import`,{method:`POST`,body:JSON.stringify({export:Ct,exportPassphrase:q,name:De||void 0,address:L,port:Number(Fe),password:V,hostDisplayName:Le})});r(e.status)},`Encrypted export imported as a new Workroom with new credentials.`);if(n.mode===`locked`)return(0,z.jsxs)(`div`,{className:`mx-auto flex max-w-xl flex-col gap-5 py-16 text-center`,children:[(0,z.jsx)(`div`,{className:`mx-auto grid size-14 place-items-center rounded-full bg-amber-500/10 text-amber-700`,children:(0,z.jsx)(Te,{})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Active Workroom is locked`}),(0,z.jsxs)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:[`This browser lost its local human-session cookie. `,n.roomType===`host`?`Enter the room password to regain host dashboard controls.`:`For safety, leave this local guest connection and join again with the invitation and room password.`]})]}),n.roomType===`host`?(0,z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-sm flex-col gap-3`,children:[(0,z.jsx)(P,{htmlFor:`workroom-recovery-password`,children:`Room password`}),(0,z.jsx)(a,{id:`workroom-recovery-password`,type:`password`,value:et,onChange:e=>tt(e.target.value)}),(0,z.jsxs)(i,{onClick:()=>$(`reclaim`,async()=>{await x(`/api/workrooms/session/reclaim`,{method:`POST`,body:JSON.stringify({password:et})}),tt(``)},`Local Workroom dashboard reconnected.`),disabled:s!==null||!et,children:[s===`reclaim`?(0,z.jsx)(S,{}):(0,z.jsx)(Te,{}),` Unlock host dashboard`]})]}):(0,z.jsx)(`div`,{children:(0,z.jsxs)(i,{variant:`destructive-outline`,onClick:()=>$(`abandon-locked-guest`,async()=>{await x(`/api/workrooms/session/abandon`,{method:`POST`,body:JSON.stringify({confirm:!0})}),r({mode:`idle`})},`Locked guest connection left. Join the Workroom again.`),disabled:s!==null,children:[s===`abandon-locked-guest`?(0,z.jsx)(S,{}):(0,z.jsx)(Oe,{}),` Leave and rejoin`]})})]});if(n.mode===`idle`)return(0,z.jsxs)(`div`,{className:`mx-auto max-w-6xl animate-fade-in space-y-6`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(he,{className:`text-primary`,size:20}),(0,z.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:`Workrooms`}),(0,z.jsx)(o,{variant:`info`,children:`Experimental`})]}),(0,z.jsxs)(`p`,{className:`mt-1 max-w-3xl text-sm text-muted-foreground`,children:[`Share only the project context and reusable agent resources you explicitly review over a private LAN or VPN. `,p,` never adds code, diffs, credentials, terminals, or AI sessions automatically.`]})]}),(0,z.jsxs)(ye,{variant:`info`,children:[(0,z.jsx)(ne,{}),(0,z.jsx)(ve,{children:`No listener runs by default`}),(0,z.jsxs)(_e,{children:[`A Workroom binds only to the network address you select and stops with `,p,`.`]})]}),Dt.length>0&&(0,z.jsxs)(N,{children:[(0,z.jsxs)(M,{children:[(0,z.jsx)(k,{children:`Paused Workrooms`}),(0,z.jsx)(j,{children:`Enter the room password in the host form below, then resume on the same saved address and port. The password unlocks human authority; agent credentials remain read-and-propose-only.`})]}),(0,z.jsx)(A,{className:`grid gap-2 sm:grid-cols-2`,children:Dt.map(e=>(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border p-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,z.jsxs)(`p`,{className:`truncate font-mono text-[10px] text-muted-foreground`,children:[e.address,`:`,e.port,` · `,e.workspaceId]})]}),(0,z.jsxs)(i,{size:`sm`,variant:`outline`,onClick:()=>Vt(e.roomId),disabled:s!==null||V.length<12,children:[s===`resume-${e.roomId}`?(0,z.jsx)(S,{}):(0,z.jsx)(v,{}),` Resume`]})]},e.roomId))})]}),kt.length>0&&(0,z.jsxs)(N,{children:[(0,z.jsxs)(M,{children:[(0,z.jsx)(k,{children:`Failed imports`}),(0,z.jsx)(j,{children:`These rooms never completed import and cannot be resumed. Inspect the identity below, discard its quarantined local files, then retry the original encrypted export.`})]}),(0,z.jsx)(A,{className:`grid gap-2 sm:grid-cols-2`,children:kt.map(e=>(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-amber-500/40 p-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-semibold`,children:e.name||e.roomId}),(0,z.jsxs)(`p`,{className:`truncate font-mono text-[10px] text-muted-foreground`,children:[e.status===`failed`?`Import failed`:`Import interrupted`,e.workspaceId?` · ${e.workspaceId}`:``]})]}),(0,z.jsxs)(i,{size:`sm`,variant:`destructive-outline`,onClick:()=>Ht(e.roomId),disabled:s!==null,children:[s===`discard-${e.roomId}`?(0,z.jsx)(S,{}):(0,z.jsx)(ae,{}),` Discard`]})]},e.roomId))})]}),(0,z.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,z.jsxs)(N,{children:[(0,z.jsxs)(M,{children:[(0,z.jsxs)(k,{className:`flex items-center gap-2`,children:[(0,z.jsx)(re,{size:15}),` Start a Workroom`]}),(0,z.jsx)(j,{children:`Host collaboration from this computer. Your existing dashboard remains localhost-only.`})]}),(0,z.jsxs)(A,{className:`space-y-4`,children:[(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(P,{children:`Workspace`}),(0,z.jsxs)(y,{value:g,onValueChange:e=>typeof e==`string`&&de(e),children:[(0,z.jsx)(h,{children:(0,z.jsx)(T,{children:e.find(e=>e.branchName===g)?.branchName||`Select a workspace`})}),(0,z.jsx)(_,{children:e.map(e=>(0,z.jsx)(D,{value:e.branchName,children:e.branchName},e.id))})]})]}),(0,z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(P,{children:`Room name`}),(0,z.jsx)(a,{value:De,onChange:e=>Ae(e.target.value)})]}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(P,{children:`Your display name`}),(0,z.jsx)(a,{value:Le,onChange:e=>B(e.target.value),placeholder:`Defaults to OS user`})]})]}),(0,z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[1fr_100px]`,children:[(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(P,{children:`Network interface`}),(0,z.jsxs)(y,{value:L,onValueChange:e=>typeof e==`string`&&Pe(e),children:[(0,z.jsx)(h,{children:(0,z.jsx)(T,{children:L||`Select an address`})}),(0,z.jsx)(_,{children:ee.map(e=>(0,z.jsxs)(D,{value:e.address,children:[e.name,` · `,e.address,e.internal?` (local only)`:``]},`${e.name}-${e.address}`))})]})]}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(P,{children:`Port`}),(0,z.jsx)(a,{type:`number`,value:Fe,onChange:e=>Ie(e.target.value)})]})]}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(P,{children:`Room password`}),(0,z.jsx)(i,{size:`xs`,variant:`ghost`,onClick:()=>Re(Ve()),children:`Generate`})]}),(0,z.jsx)(a,{type:`password`,value:V,onChange:e=>Re(e.target.value)}),(0,z.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Share this separately from the invitation. Minimum 12 characters.`})]}),b&&(0,z.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-border bg-muted/30 p-3 text-xs`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`font-semibold text-foreground`,children:`Exact sharing review`}),(0,z.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Repository identities below are always included. Local context files are excluded until you explicitly include each one.`})]}),b.bundleWarnings.map(e=>(0,z.jsxs)(`p`,{className:`text-amber-700 dark:text-amber-300`,children:[`Bundle warning: `,e]},e)),(0,z.jsx)(`div`,{className:`space-y-1 font-mono text-[10px] text-muted-foreground`,children:b.bundle.repos.map(e=>(0,z.jsxs)(`div`,{className:`break-all`,children:[e.name,`: `,e.remoteUrl]},e.id))}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{className:`cursor-pointer font-semibold text-foreground`,children:`Complete shared feature metadata`}),(0,z.jsx)(`pre`,{className:`mt-2 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 font-mono text-[10px]`,children:JSON.stringify(b.bundle,null,2)})]}),Object.keys(U).map(e=>(0,z.jsxs)(`div`,{className:`space-y-1.5 rounded border border-border bg-background p-2`,children:[(0,z.jsxs)(`label`,{className:`flex items-center gap-2 font-semibold text-foreground`,children:[(0,z.jsx)(`input`,{type:`checkbox`,checked:F[e],onChange:t=>{xe(n=>({...n,[e]:t.target.checked})),I(!1)}}),` Include `,U[e]]}),b.warnings[e].map(e=>(0,z.jsxs)(`p`,{className:`text-amber-700 dark:text-amber-300`,children:[`Warning: `,e]},e)),(0,z.jsx)(C,{"aria-label":`${U[e]} exact outbound content`,className:`min-h-28 font-mono text-[10px]`,value:E[e],onChange:t=>{O(n=>({...n,[e]:t.target.value})),I(!1)}}),(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:F[e]?`${E[e].length.toLocaleString()} characters will be shared.`:`Excluded from the Workroom.`})]},e)),(0,z.jsxs)(`label`,{className:`flex items-start gap-2 rounded border border-border bg-background p-2 text-[11px]`,children:[(0,z.jsx)(`input`,{className:`mt-0.5`,type:`checkbox`,checked:Ce,onChange:e=>I(e.target.checked)}),(0,z.jsx)(`span`,{children:`I reviewed the exact included text and repository identities, including any credential, path, diff, or transcript warnings.`})]})]}),(0,z.jsxs)(i,{className:`w-full`,onClick:Bt,disabled:!b||!Ce||!L||V.length<12||s!==null,children:[s===`start`?(0,z.jsx)(S,{}):(0,z.jsx)(v,{}),` Start private Workroom`]})]})]}),(0,z.jsxs)(`div`,{className:`space-y-6`,children:[(0,z.jsxs)(N,{children:[(0,z.jsxs)(M,{children:[(0,z.jsxs)(k,{className:`flex items-center gap-2`,children:[(0,z.jsx)(Ee,{size:15}),` Join a Workroom`]}),(0,z.jsx)(j,{children:`Paste the invitation and enter the separately shared password. The host must approve this device.`})]}),(0,z.jsxs)(A,{className:`space-y-4`,children:[(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(P,{children:`Invitation`}),(0,z.jsx)(C,{className:`min-h-24 font-mono text-xs`,value:Je,onChange:e=>Ye(e.target.value),placeholder:`${m}//workroom/join?...`})]}),(0,z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(P,{children:`Password`}),(0,z.jsx)(a,{type:`password`,value:Xe,onChange:e=>Ze(e.target.value)})]}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(P,{children:`Your display name`}),(0,z.jsx)(a,{value:Qe,onChange:e=>$e(e.target.value)})]})]}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(P,{children:`Local workspace mapping`}),(0,z.jsxs)(y,{value:g,onValueChange:e=>typeof e==`string`&&de(e),children:[(0,z.jsx)(h,{children:(0,z.jsx)(T,{children:e.find(e=>e.branchName===g)?.branchName||`Select your checkout (recommended)`})}),(0,z.jsx)(_,{children:e.map(e=>(0,z.jsx)(D,{value:e.branchName,children:e.branchName},e.id))})]}),(0,z.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Used for local agent proposals and handoff snapshots; code remains in this checkout.`})]}),(0,z.jsxs)(i,{className:`w-full`,onClick:Ut,disabled:!Je||!Xe||s!==null,children:[s===`join`?(0,z.jsx)(S,{}):(0,z.jsx)(Me,{}),` Request to join`]})]})]}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(M,{children:[(0,z.jsxs)(k,{className:`flex items-center gap-2`,children:[(0,z.jsx)(je,{size:15}),` Import an encrypted room`]}),(0,z.jsx)(j,{children:`Creates a new room identity, certificate, password, and membership set.`})]}),(0,z.jsxs)(A,{className:`space-y-3`,children:[(0,z.jsx)(a,{type:`file`,accept:`.json,${d},${oe}`,onChange:e=>{let n=e.target.files?.[0];if(n){if(n.size>157286400){t(`Workroom export files are limited to 150 MiB.`,`error`);return}n.text().then(e=>wt(JSON.parse(e))).catch(()=>t(`Invalid Workroom export file.`,`error`))}}}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(P,{children:`Export passphrase`}),(0,z.jsx)(a,{type:`password`,value:q,onChange:e=>St(e.target.value)})]}),(0,z.jsxs)(i,{variant:`outline`,className:`w-full`,onClick:rn,disabled:!Ct||!L||V.length<12||s!==null,children:[s===`import`?(0,z.jsx)(S,{}):(0,z.jsx)(je,{}),` Import and host`]})]})]})]})]})]});if(Ft||n.mode===`guest`&&n.status===`rejected`)return(0,z.jsxs)(`div`,{className:`mx-auto flex max-w-xl flex-col gap-5 py-16 text-center`,children:[(0,z.jsx)(`div`,{className:`mx-auto grid size-14 place-items-center rounded-full bg-primary/10 text-primary`,children:Ft?(0,z.jsx)(fe,{className:`animate-spin`}):(0,z.jsx)(Ne,{})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:`text-xl font-semibold`,children:Ft?`Waiting for host approval`:`Join request rejected`}),(0,z.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:Ft?`Your device credential is ready, but no room context is available until the host accepts you.`:`Ask the host for a new one-use invitation if this was unexpected.`})]}),(0,z.jsxs)(`div`,{className:`flex justify-center gap-2`,children:[Ft&&(0,z.jsxs)(i,{onClick:Wt,disabled:s!==null,children:[s===`poll`?(0,z.jsx)(S,{}):(0,z.jsx)(fe,{}),` Check approval`]}),(0,z.jsx)(i,{variant:`outline`,onClick:Gt,children:`Cancel`})]})]});if(n.mode===`guest`&&n.status===`accepted`&&!X){let e=n.connection===`revoked`;return(0,z.jsxs)(`div`,{className:`mx-auto flex max-w-xl flex-col gap-5 py-16 text-center`,children:[(0,z.jsx)(`div`,{className:`mx-auto grid size-14 place-items-center rounded-full bg-amber-500/10 text-amber-700`,children:e?(0,z.jsx)(Ne,{}):(0,z.jsx)(re,{})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:`text-xl font-semibold`,children:e?`Workroom access was revoked`:`Workroom connection is unavailable`}),(0,z.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e?`Leave this local connection, then ask the host for a new one-use invitation if you should rejoin.`:`The host or VPN may be offline. You can retry without losing the local connection, or leave immediately.`})]}),(0,z.jsxs)(`div`,{className:`flex justify-center gap-2`,children:[!e&&(0,z.jsxs)(i,{onClick:()=>Q(!0),disabled:s!==null,children:[(0,z.jsx)(fe,{}),` Retry connection`]}),(0,z.jsxs)(i,{variant:`outline`,onClick:Gt,disabled:s!==null,children:[s===`stop`?(0,z.jsx)(S,{}):(0,z.jsx)(ge,{}),` Leave local connection`]})]})]})}return X?(0,z.jsxs)(`div`,{className:`mx-auto max-w-[1500px] animate-fade-in space-y-4`,children:[J!==`stream`&&(0,z.jsxs)(`header`,{className:`flex flex-col gap-3 border-b border-border pb-4 sm:flex-row sm:items-center`,children:[(0,z.jsxs)(i,{ref:Nt,variant:`ghost`,onClick:()=>Y(`stream`),children:[(0,z.jsx)(be,{}),` Back to Handoff Stream`]}),(0,z.jsxs)(`div`,{className:`min-w-0 sm:border-l sm:border-border sm:pl-4`,children:[(0,z.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground`,children:X.name}),(0,z.jsx)(`h1`,{className:`truncate text-lg font-semibold`,children:Be[J]})]})]}),H&&(0,z.jsxs)(ye,{variant:`success`,children:[(0,z.jsx)(Te,{}),(0,z.jsx)(ve,{children:`One-use invitation ready`}),(0,z.jsxs)(_e,{children:[(0,z.jsx)(`span`,{className:`break-all font-mono text-[10px]`,children:H}),(0,z.jsxs)(`span`,{children:[`Expires `,new Date(Ue).toLocaleString(),`. Share the password separately.`]})]}),(0,z.jsxs)(i,{size:`sm`,variant:`outline`,onClick:()=>void me(H),children:[(0,z.jsx)(Se,{}),` Copy`]})]}),(0,z.jsxs)(ie,{value:J,onValueChange:e=>Y(e),children:[(0,z.jsxs)(l,{className:`hidden`,children:[(0,z.jsx)(c,{value:`stream`,children:`Handoff Stream`}),Object.keys(Be).map(e=>(0,z.jsx)(c,{value:e,children:Be[e]},e))]}),(0,z.jsx)(u,{value:`stream`,className:`mt-0`,children:(0,z.jsx)(ze,{snapshot:X,roomUrl:n.url,isHost:Z,me:It,busy:s,message:Tt,hasUnsavedHandoffDraft:G.handoff,headingRef:Mt,onCreateInvite:Kt,onRefresh:()=>Q(!0),onStopOrLeave:Gt,onOpenTool:Y,onMessageChange:Et,onPostUpdate:tn})}),(0,z.jsxs)(u,{value:`overview`,className:`space-y-5`,children:[(0,z.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[(0,z.jsx)(N,{children:(0,z.jsxs)(M,{children:[(0,z.jsx)(j,{children:`Members`}),(0,z.jsx)(k,{className:`text-2xl`,children:X.participants.filter(e=>!e.revokedAt).length})]})}),(0,z.jsx)(N,{children:(0,z.jsxs)(M,{children:[(0,z.jsx)(j,{children:`Shared resources`}),(0,z.jsx)(k,{className:`text-2xl`,children:X.resources.filter(e=>!e.quarantinedAt).length})]})}),(0,z.jsx)(N,{children:(0,z.jsxs)(M,{children:[(0,z.jsx)(j,{children:`Repository identities`}),(0,z.jsx)(k,{className:`text-2xl`,children:X.bundle.repos.length})]})})]}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(M,{children:[(0,z.jsx)(k,{children:X.bundle.feature.goal}),(0,z.jsxs)(j,{children:[X.bundle.project.name,` · portable feature `,X.bundle.feature.id]})]}),(0,z.jsx)(A,{className:`space-y-2`,children:X.bundle.repos.map(e=>(0,z.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,z.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,z.jsx)(`span`,{className:`text-sm font-medium`,children:e.name}),(0,z.jsx)(o,{variant:`secondary`,children:e.defaultBranch})]}),(0,z.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-muted-foreground`,children:e.remoteUrl}),e.handoff&&(0,z.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.handoff.branch,` @ `,e.handoff.commit.slice(0,12),` · `,e.handoff.dirty?`dirty`:`clean`,` · ↑`,e.handoff.ahead,` ↓`,e.handoff.behind]})]},e.id))})]}),(0,z.jsxs)(ye,{variant:`info`,children:[(0,z.jsx)(ne,{}),(0,z.jsx)(ve,{children:`Never collected automatically`}),(0,z.jsxs)(_e,{children:[p,` does not add source archives, filenames, diffs, local paths, credentials, terminals, editor state, or AI transcripts. A developer can still include sensitive text in a reviewed shared document.`]})]})]}),(0,z.jsx)(u,{value:`context`,className:`space-y-4`,children:Object.keys(U).map(e=>(0,z.jsxs)(N,{children:[(0,z.jsx)(M,{children:(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(k,{children:U[e]}),(0,z.jsxs)(j,{children:[`Revision `,X.documents[e].revision,` · updated `,new Date(X.documents[e].updatedAt).toLocaleString()]})]}),G[e]&&(0,z.jsx)(o,{variant:`warning`,children:`Local draft`})]})}),(0,z.jsxs)(A,{className:`space-y-3`,children:[(0,z.jsx)(C,{className:`min-h-64 font-mono text-xs`,value:nt[e],disabled:s!==null,onChange:t=>{rt(n=>({...n,[e]:t.target.value})),it(t=>({...t,[e]:!0}))}}),(0,z.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[e===`handoff`&&(0,z.jsxs)(i,{variant:`outline`,onClick:()=>$(`handoff`,()=>x(`/api/workrooms/handoff`,{method:`POST`,body:JSON.stringify({workspaceId:n.localWorkspaceId})}).then(()=>void 0),`Git metadata handoff published.`),disabled:!n.localWorkspaceId||s!==null,children:[(0,z.jsx)(fe,{}),` Publish Git snapshot`]}),(0,z.jsxs)(i,{onClick:()=>qt(e),disabled:!G[e]||s!==null,children:[s===`doc-${e}`?(0,z.jsx)(S,{}):(0,z.jsx)(je,{}),` Share revision`]})]})]})]},e))}),(0,z.jsxs)(u,{value:`resources`,className:`space-y-4`,children:[Lt&&(0,z.jsxs)(N,{children:[(0,z.jsxs)(M,{children:[(0,z.jsx)(k,{children:`Publish a local resource`}),(0,z.jsx)(j,{children:`Published versions are immutable. Connected developers are notified and choose whether to download and apply them.`})]}),(0,z.jsxs)(A,{className:`flex flex-col gap-3 sm:flex-row sm:items-end`,children:[(0,z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,z.jsx)(P,{children:`Resource`}),(0,z.jsxs)(y,{value:ot,onValueChange:e=>typeof e==`string`&&st(e),children:[(0,z.jsx)(h,{children:(0,z.jsx)(T,{children:K.find(e=>`${e.kind}:${e.id}`===ot)?.name||`Select resource`})}),(0,z.jsx)(_,{children:K.map(e=>(0,z.jsxs)(D,{value:`${e.kind}:${e.id}`,children:[e.kind,` · `,e.name]},`${e.kind}:${e.id}`))})]})]}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(P,{children:`Version`}),(0,z.jsx)(a,{className:`w-32 font-mono`,value:ct,onChange:e=>lt(e.target.value)})]}),(0,z.jsxs)(i,{onClick:Jt,disabled:!ot||s!==null,children:[(0,z.jsx)(je,{}),` Publish`]})]})]}),(0,z.jsx)(`div`,{className:`grid gap-3`,children:X.resources.length===0?(0,z.jsx)(N,{className:`p-8 text-center text-sm text-muted-foreground`,children:`No resources have been published.`}):X.resources.map(e=>{let t=ut[e.digest],n=[e.compatibility?.platforms?.length?`platforms: ${e.compatibility.platforms.join(`, `)}`:void 0,e.compatibility?.contextspace?`${p} ${e.compatibility.contextspace}`:e.compatibility?.nexusflow?`${se} ${e.compatibility.nexusflow}`:void 0].filter(Boolean).join(` · `);return(0,z.jsx)(N,{className:e.quarantinedAt?`opacity-60`:``,children:(0,z.jsxs)(A,{className:`space-y-3 p-4`,children:[(0,z.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(o,{variant:`secondary`,children:e.kind}),(0,z.jsxs)(`span`,{className:`text-sm font-semibold`,children:[e.id,`@`,e.version]}),e.quarantinedAt&&(0,z.jsx)(o,{variant:`error`,children:`Quarantined`})]}),(0,z.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:[`SHA-256 `,e.digest]}),n&&(0,z.jsxs)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:[`Compatibility · `,n]})]}),e.quarantinedAt?Z&&(0,z.jsxs)(i,{variant:`destructive-outline`,onClick:()=>Qt(e.digest),disabled:s!==null,children:[s===`purge-${e.digest}`?(0,z.jsx)(S,{}):(0,z.jsx)(ae,{}),` Purge permanently`]}):(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t?(0,z.jsxs)(i,{onClick:()=>Xt(e.digest),disabled:s!==null,children:[(0,z.jsx)(ke,{}),` Approve exact digest & apply`]}):(0,z.jsxs)(i,{variant:`outline`,onClick:()=>Yt(e.digest),disabled:s!==null,children:[(0,z.jsx)(we,{}),` Download for review`]}),Z&&(0,z.jsx)(i,{variant:`ghost`,onClick:()=>Zt(e.digest),disabled:s!==null,children:`Quarantine`})]})]}),t&&(0,z.jsxs)(`div`,{className:`space-y-3 rounded border border-border bg-muted/30 p-3`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`p`,{className:`text-xs font-semibold`,children:[`Exact package review · `,t.action===`update`?`updates an existing local resource`:`creates a new local resource`]}),(0,z.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[`Applying installs the incoming definition shown below and is bound to SHA-256 `,e.digest,`.`]})]}),t.existingDefinition&&(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-xs font-semibold`,children:`Current local definition`}),(0,z.jsx)(`pre`,{className:`mt-2 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-[10px]`,children:t.existingDefinition})]}),(0,z.jsxs)(`details`,{open:!0,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-xs font-semibold`,children:`Incoming applied definition`}),(0,z.jsx)(`pre`,{className:`mt-2 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-[10px]`,children:t.incomingDefinition})]}),(0,z.jsx)(`div`,{className:`space-y-2`,children:t.files.map(e=>(0,z.jsxs)(`details`,{children:[(0,z.jsxs)(`summary`,{className:`cursor-pointer font-mono text-[10px]`,children:[e.path,` · `,e.bytes.toLocaleString(),` bytes · `,e.encoding,e.executable?` · executable`:``]}),(0,z.jsx)(`pre`,{className:`mt-1 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-[10px]`,children:e.content})]},e.path))})]})]})},e.digest)})})]}),(0,z.jsxs)(u,{value:`workflow`,className:`space-y-4`,children:[Z&&!X.workflowProgress&&(0,z.jsxs)(N,{children:[(0,z.jsxs)(M,{children:[(0,z.jsx)(k,{children:`Start shared workflow tracking`}),(0,z.jsx)(j,{children:`Convert a local strategy into explicit ordered steps. Agents may propose completion; a developer confirms it.`})]}),(0,z.jsxs)(A,{className:`space-y-3`,children:[(0,z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[1fr_130px]`,children:[(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(P,{children:`Workflow`}),(0,z.jsxs)(y,{value:ft,onValueChange:e=>typeof e==`string`&&pt(e),children:[(0,z.jsx)(h,{children:(0,z.jsx)(T,{children:K.find(e=>e.id===ft&&e.kind===`workflow`)?.name||`Select workflow`})}),(0,z.jsx)(_,{children:K.filter(e=>e.kind===`workflow`).map(e=>(0,z.jsx)(D,{value:e.id,children:e.name},e.id))})]})]}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(P,{children:`Version`}),(0,z.jsx)(a,{value:mt,onChange:e=>ht(e.target.value)})]})]}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(P,{children:`Ordered steps, one per line`}),(0,z.jsx)(C,{className:`min-h-32`,value:gt,onChange:e=>_t(e.target.value)})]}),(0,z.jsxs)(i,{onClick:$t,disabled:!ft||s!==null,children:[(0,z.jsx)(v,{}),` Start workflow`]})]})]}),!Z&&!X.workflowProgress&&(0,z.jsx)(N,{children:(0,z.jsxs)(M,{children:[(0,z.jsx)(k,{children:`No shared workflow yet`}),(0,z.jsx)(j,{children:`The host can select a reviewed workflow for this room. You can continue sharing context and handoff updates while you wait.`})]})}),X.workflowProgress&&(0,z.jsxs)(N,{children:[(0,z.jsxs)(M,{children:[(0,z.jsxs)(k,{children:[X.workflowProgress.package.name,`@`,X.workflowProgress.workflow.version]}),(0,z.jsxs)(j,{children:[`Exact strategy retained at digest `,X.workflowProgress.workflow.digest.slice(0,12),`… · shared progress revision `,X.workflowProgress.revision]})]}),(0,z.jsx)(A,{className:`space-y-3`,children:X.workflowProgress.steps.map((e,t)=>{let n=X.workflowProgress.package.steps.find(t=>t.id===e.stepId);return(0,z.jsx)(`div`,{className:`rounded-lg border border-border p-3`,children:(0,z.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`grid size-5 place-items-center rounded-full bg-muted text-[10px]`,children:t+1}),(0,z.jsx)(`span`,{className:`text-xs font-semibold`,children:n?.title||e.stepId}),(0,z.jsx)(o,{variant:e.status===`completed`?`success`:e.status===`completion_proposed`?`warning`:`secondary`,children:e.status.replace(`_`,` `)})]}),(0,z.jsx)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:e.stepId}),e.evidence&&(0,z.jsxs)(`p`,{className:`mt-2 whitespace-pre-wrap text-xs text-muted-foreground`,children:[`Evidence: `,e.evidence]}),n?.requiresEvidence&&(0,z.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,z.jsx)(P,{htmlFor:`workflow-evidence-${e.stepId}`,children:`Completion evidence`}),(0,z.jsx)(C,{id:`workflow-evidence-${e.stepId}`,className:`min-h-20 text-xs`,value:vt[e.stepId]??e.evidence??``,onChange:t=>yt(n=>({...n,[e.stepId]:t.target.value})),placeholder:`Tests, review result, or other verification`})]})]}),(0,z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.status===`completion_proposed`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(i,{size:`sm`,onClick:()=>en(e,`completed`),children:[(0,z.jsx)(le,{}),` Confirm`]}),(0,z.jsx)(i,{size:`sm`,variant:`outline`,onClick:()=>en(e,`in_progress`),children:`Reject`})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(i,{size:`sm`,variant:`outline`,onClick:()=>en(e,`in_progress`),children:`In progress`}),(0,z.jsx)(i,{size:`sm`,variant:`outline`,onClick:()=>en(e,`completed`),children:`Complete`}),(0,z.jsx)(i,{size:`sm`,variant:`ghost`,onClick:()=>en(e,`pending`),children:`Reopen`})]})})]})},e.stepId)})})]})]}),(0,z.jsxs)(u,{value:`members`,className:`space-y-4`,children:[Z&&X.pendingJoins.map(e=>(0,z.jsxs)(ye,{variant:`warning`,children:[(0,z.jsx)(Me,{}),(0,z.jsxs)(ve,{children:[e.displayName,` wants to join`]}),(0,z.jsxs)(_e,{children:[`Requested `,new Date(e.requestedAt).toLocaleString()]}),(0,z.jsxs)(`div`,{className:`flex gap-1`,children:[(0,z.jsx)(i,{size:`sm`,onClick:()=>$(`accept-${e.id}`,()=>x(`/api/workrooms/members/${e.id}/decision`,{method:`POST`,body:JSON.stringify({accept:!0})}).then(()=>void 0)),children:`Accept`}),(0,z.jsx)(i,{size:`sm`,variant:`outline`,onClick:()=>$(`reject-${e.id}`,()=>x(`/api/workrooms/members/${e.id}/decision`,{method:`POST`,body:JSON.stringify({accept:!1})}).then(()=>void 0)),children:`Reject`})]})]},e.id)),(0,z.jsx)(N,{children:(0,z.jsx)(A,{className:`divide-y divide-border p-0`,children:X.participants.map(e=>(0,z.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`size-2 rounded-full ${e.revokedAt?`bg-muted-foreground`:`bg-emerald-500`}`}),(0,z.jsx)(`span`,{className:`text-sm font-semibold`,children:e.displayName}),(0,z.jsx)(o,{variant:e.role===`host`?`info`:`secondary`,children:e.role}),e.id===It?.id&&(0,z.jsx)(o,{variant:`success`,children:`You`})]}),(0,z.jsxs)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:[`Joined `,new Date(e.joinedAt).toLocaleString()]})]}),Z&&e.role!==`host`&&!e.revokedAt&&(0,z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,z.jsx)(i,{size:`sm`,variant:`outline`,onClick:()=>$(`role-${e.id}`,()=>x(`/api/workrooms/members/${e.id}/role`,{method:`PUT`,body:JSON.stringify({role:e.role===`publisher`?`member`:`publisher`})}).then(()=>void 0)),children:e.role===`publisher`?`Make member`:`Make publisher`}),(0,z.jsxs)(i,{size:`sm`,variant:`destructive-outline`,onClick:()=>$(`revoke-${e.id}`,()=>x(`/api/workrooms/members/${e.id}`,{method:`DELETE`}).then(()=>void 0)),children:[(0,z.jsx)(Ne,{}),` Revoke`]})]})]},e.id))})})]}),(0,z.jsx)(u,{value:`activity`,children:(0,z.jsx)(N,{children:(0,z.jsx)(A,{className:`divide-y divide-border p-0`,children:[...X.activity].reverse().map(e=>(0,z.jsxs)(`div`,{className:`flex gap-3 p-4`,children:[(0,z.jsx)(ue,{className:`mt-0.5 shrink-0 text-muted-foreground`,size:14}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`text-sm`,children:e.summary}),(0,z.jsxs)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:[`#`,e.sequence,` · `,e.type,` · `,new Date(e.createdAt).toLocaleString()]})]})]},e.sequence))})})}),(0,z.jsxs)(u,{value:`security`,className:`space-y-4`,children:[(0,z.jsxs)(N,{children:[(0,z.jsxs)(M,{children:[(0,z.jsx)(k,{children:`TLS identity`}),(0,z.jsx)(j,{children:`Guests pin this SHA-256 fingerprint from the invitation. Mismatches stop before any password or device credential is sent.`})]}),(0,z.jsx)(A,{children:(0,z.jsx)(`code`,{className:`break-all text-xs`,children:X.certificateFingerprint})})]}),Z&&(0,z.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,z.jsxs)(N,{children:[(0,z.jsxs)(M,{children:[(0,z.jsx)(k,{children:`Rotate room password`}),(0,z.jsx)(j,{children:`Outstanding invitations are revoked. Existing device credentials are revoked by default.`})]}),(0,z.jsxs)(A,{className:`space-y-3`,children:[(0,z.jsx)(a,{type:`password`,value:bt,onChange:e=>xt(e.target.value)}),(0,z.jsxs)(i,{variant:`destructive-outline`,onClick:()=>$(`rotate`,()=>x(`/api/workrooms/password/rotate`,{method:`POST`,body:JSON.stringify({password:bt,revokeDevices:!0})}).then(()=>void 0),`Password rotated and guest devices revoked.`),children:[(0,z.jsx)(Te,{}),` Rotate and revoke`]})]})]}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(M,{children:[(0,z.jsx)(k,{children:`Encrypted portable export`}),(0,z.jsx)(j,{children:`Excludes certificates, password hashes, invitations, and device credentials.`})]}),(0,z.jsxs)(A,{className:`space-y-3`,children:[(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(P,{children:`Export passphrase`}),(0,z.jsx)(a,{type:`password`,value:q,onChange:e=>St(e.target.value)})]}),(0,z.jsxs)(i,{variant:`outline`,onClick:nn,disabled:q.length<12||s!==null,children:[(0,z.jsx)(we,{}),` Export room`]})]})]})]})]})]})]}):(0,z.jsx)(`div`,{className:`flex justify-center py-24`,children:(0,z.jsx)(S,{className:`size-6`})})}export{qe as WorkroomsPage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as e,b as t,c as n,g as r,h as i,i as a,l as o,m as s,p as c,t as l}from"./button-CREn1mup.js";import{A as u,Bt as d,D as f,E as p,F as m,G as h,Gn as g,Gt as _,Hn as v,K as y,Kt as b,Ln as x,M as S,N as C,O as w,On as T,P as E,Q as D,Qt as O,R as k,Rt as A,T as j,U as M,Un as N,Ut as P,Vn as F,Vt as I,W as L,Z as R,en as z,f as ee,gn as te,ht as ne,in as B,j as re,k as ie,m as ae,n as V,p as oe,pn as se,q as ce,rn as H,t as U,tt as le,w as ue,y as de}from"./badge-DwXvB44H.js";import{t as fe}from"./chevron-down-B_Mwbim8.js";import{n as pe,r as me,t as he}from"./shield-check-Dd1Yv3l2.js";import{t as ge}from"./code-xml-DH-38Tt7.js";import{a as _e,i as ve,n as ye,r as be,t as xe}from"./square-check-big-BSIiYXPI.js";import{t as Se}from"./git-branch-Ce0I2663.js";import{t as Ce}from"./layers-j_brOuoa.js";import{a as we,i as Te,n as Ee,o as De,r as Oe,t as ke}from"./tabs-BrHKp5bD.js";import{t as Ae}from"./trash-2-CMdv3eD3.js";import{d as je,n as Me}from"./chunk-BV7QT456-DfUBKG-z.js";import{i as Ne,n as Pe,r as Fe}from"./NullStore-tdPen1kp.js";import{d as Ie,o as Le,t as Re}from"./brand-hHByyyzq.js";import{An as ze,At as Be,B as Ve,Bt as He,Cn as Ue,D as We,Dn as W,Dt as Ge,E as Ke,Ft as qe,Ht as Je,It as Ye,Jt as Xe,Lt as Ze,Mn as Qe,Mt as $e,Nn as et,Nt as tt,O as nt,On as rt,Ot as it,Q as at,R as ot,Rt as st,Sn as ct,St as lt,T as ut,Tn as G,U as dt,Ut as ft,Vt as pt,Wt as mt,X as ht,Yt as gt,Z as _t,Zt as vt,_n as yt,a as bt,at as xt,bn as St,bt as Ct,c as wt,cn as K,ct as Tt,d as q,dn as Et,gn as Dt,hn as J,i as Ot,in as kt,it as At,jn as jt,kn as Mt,l as Nt,ln as Y,lt as Pt,mn as Ft,n as It,o as Lt,on as Rt,pn as zt,r as Bt,rt as Vt,s as Ht,t as Ut,tt as Wt,u as Gt,un as Kt,vn as qt,wn as Jt,wt as Yt,xn as Xt,xt as X,y as Zt,yn as Qt,z as $t,zt as en}from"./index-3tD_IeyQ.js";import{t as Z}from"./card-yrg6ov8B.js";import{n as tn,t as nn}from"./vsc-D80c4gBT.js";var rn=i(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),an=i(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),on=i(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),sn=i(`circle-arrow-up`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),cn=i(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]]),ln=i(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),un=i(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),dn=i(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),fn=i(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),pn=i(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),mn=i(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),hn=i(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),gn=i(`milestone`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M12 3v3`,key:`1n5kay`}],[`path`,{d:`M18.172 6a2 2 0 0 1 1.414.586l2.06 2.06a1.207 1.207 0 0 1 0 1.708l-2.06 2.06a2 2 0 0 1-1.414.586H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z`,key:`8gz4t4`}]]),_n=i(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),vn=i(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),yn=i(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),bn=i(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),xn=i(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Sn=i(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Q=t(e(),1);function Cn(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,onMeasureLayout:a,onMeasureLayoutComplete:s,side:c,direction:l}=e,u=I(t,!0),d=P(),f=Q.useRef(null),p=Q.useRef(!0),m=Q.useRef(o),h=B(a),g=B(s),_=Q.useMemo(()=>wn(c,l),[c,l]);H(()=>{if(!i){m.current=o,p.current=!0,f.current=null;return}if(!t||!n)return;m.current=En(t,_),Dn(t,`auto`);let e=Tn(t,`position`,`static`),r=Tn(t,`transform`,`none`),a=Tn(t,`scale`,`1`),s=En(n,{"--available-width":`max-content`,"--available-height":`max-content`});function c(){e(),r(),s()}function l(){c(),a()}if(h?.(),p.current||f.current===null){On(n,`max-content`);let e=we(t);return f.current=e,On(n,e),l(),g?.(null,e),p.current=!1,()=>{m.current(),m.current=o}}On(n,`max-content`);let v=f.current,y=we(t);f.current=y,Dn(t,v),l(),g?.(v,y),On(n,y);let b=new AbortController;return d.request(()=>{Dn(t,y),u(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},b.signal)}),()=>{b.abort(),d.cancel(),m.current(),m.current=o}},[r,t,n,u,d,i,h,g,_])}function wn(e,t){let r=e===`top`,i=e===`left`||e===(t===`rtl`?`inline-end`:`inline-start`);return!r&&!i?n:{position:`absolute`,[r?`bottom`:`top`]:`0`,[i?`right`:`left`]:`0`}}function Tn(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function En(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(Tn(e,r,i));return n.length?()=>{n.forEach(e=>e())}:o}function Dn(e,t){let n=t===`auto`?`auto`:`${t.width}px`,r=t===`auto`?`auto`:`${t.height}px`;e.style.setProperty(`--popup-width`,n),e.style.setProperty(`--popup-height`,r)}function On(e,t){let n=t===`max-content`?`max-content`:`${t.width}px`,r=t===`max-content`?`max-content`:`${t.height}px`;e.style.setProperty(`--positioner-width`,n),e.style.setProperty(`--positioner-height`,r)}var kn={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=se(i),l=c.getComputedStyle(i);if(l.transitionDuration===`0s`||l.transitionDuration===``)return{x:t,y:n,data:Ye};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=z(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=mt(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:Ye.sideX,g=f===`top`?`bottom`:Ye.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}},An=t(g(),1),$=r(),jn={activationDirection:e=>e?{"data-activation-direction":e}:null};function Mn(e){let{store:t,side:n,children:r}=e,i=oe(),a=t.useState(`activeTriggerElement`),o=t.useState(`activeTriggerId`),s=t.useState(`open`),c=t.useState(`payload`),l=t.useState(`mounted`),u=t.useState(`popupElement`),d=t.useState(`positionerElement`),f=Ge(s?a:null),p=In(o,c),m=Q.useRef(null),[h,g]=Q.useState(null),[_,v]=Q.useState(null),y=Q.useRef(null),b=Q.useRef(null),x=I(y,!0),S=P(),C=Q.useRef(null),[w,T]=Q.useState(null),[E,D]=Q.useState(!1);H(()=>(t.set(`adaptiveOrigin`,kn),()=>{t.set(`adaptiveOrigin`,void 0)}),[t]);let O=B(()=>{y.current?.style.setProperty(`animation`,`none`),y.current?.style.setProperty(`transition`,`none`),b.current?.style.setProperty(`display`,`none`)}),k=B(e=>{y.current?.style.removeProperty(`animation`),y.current?.style.removeProperty(`transition`),b.current?.style.removeProperty(`display`),e&&T(e)}),A=B(()=>{C.current?.abort();let e=new AbortController;C.current=e,x(()=>{g(null),T(null),m.current=null},e.signal)}),j=Q.useRef(null);H(()=>{(!s||!l)&&(j.current=null)},[s,l]),H(()=>{if(a&&f&&a!==f&&j.current!==a&&m.current){g(m.current),D(!0);let e=Fn(f,a);v(e),j.current=a}},[a,f]),H(()=>{h!=null&&(C.current?.abort(),D(!0),S.request(()=>{An.flushSync(()=>{D(!1)}),A()}))},[p,h,A,S]),H(()=>{let e=y.current;if(!e)return;let t=z(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));m.current=t});let M=h!=null,N;N=M?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(`div`,{"data-previous":!0,inert:ae(!0),ref:b,style:{...w?{"--popup-width":`${w.width}px`,"--popup-height":`${w.height}px`}:null,position:`absolute`},"data-ending-style":E?void 0:``},`previous`),(0,$.jsx)(`div`,{"data-current":!0,ref:y,"data-starting-style":E?``:void 0,children:r},p)]}):(0,$.jsx)(`div`,{"data-current":!0,ref:y,children:r},p),H(()=>{let e=b.current;!e||!h||e.replaceChildren(...Array.from(h.childNodes))},[h]),Cn({popupElement:u,positionerElement:d,mounted:l,content:c,onMeasureLayout:O,onMeasureLayoutComplete:k,side:n,direction:i});let F={activationDirection:Nn(_),transitioning:M};return{children:N,state:F}}function Nn(e){if(e)return`${Pn(e.horizontal,5,`right`,`left`)} ${Pn(e.vertical,5,`down`,`up`)}`}function Pn(e,t,n,r){return e>t?n:e<-t?r:``}function Fn(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:a.x-i.x,vertical:a.y-i.y}}function In(e,t){let[n,r]=Q.useState(0),i=Q.useRef(e),a=Q.useRef(t),o=Q.useRef(!1);return H(()=>{let n=i.current,s=a.current,c=e!==n,l=t!==s;c?(r(e=>e+1),o.current=!l):o.current&&l&&(r(e=>e+1),o.current=!1),i.current=e,a.current=t},[e,t]),`${e??`current`}-${n}`}var Ln=Q.createContext(void 0);function Rn(e){let t=Q.useContext(Ln);if(t===void 0&&!e)throw Error(c(47));return t}var zn={...Ne,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},Bn=class extends k{constructor(e,t,n){let r=new ue;super(Vn(e,r,t,n),Hn(r),zn)}setOpen=(e,t)=>{let n=t.reason===x,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=f(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n={open:e,openChangeReason:t.reason};ie(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),An.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function Vn(e,t,n,r=!1){let i={...Pe(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=Fe(t,n,r),i}function Hn(e){return{popupRef:Q.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Q.createRef(),beforeContentFocusGuardRef:Q.createRef(),stickIfOpenTimeout:new A,triggerElements:e}}function Un({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,d=Gn(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});d.useControlledProp(`openProp`,n),d.useControlledProp(`triggerIdProp`,c);let f=d.useState(`open`),m=d.useState(`mounted`),h=d.useState(`payload`);d.useContextCallback(`onOpenChange`,i),d.useContextCallback(`onOpenChangeComplete`,a),E(d,f),u(d);let{forceUnmount:g}=re(f,d,()=>{d.update({stickIfOpen:!0,openChangeReason:null})});d.useSyncedValues({modal:o}),Q.useEffect(()=>{f||d.context.stickIfOpenTimeout.clear()},[d,f]),Q.useImperativeHandle(e.actionsRef,()=>({unmount:g,close:()=>d.setOpen(!1,_(T))}),[g,d]);let v=f||m;return(0,$.jsxs)(Ln.Provider,{value:d,children:[s&&(0,$.jsx)(p,{handle:s,store:d}),v&&(0,$.jsx)(Kn,{store:d,modal:o}),typeof t==`function`?t({payload:h}):t]})}function Wn(e){return Rn(!0)?(0,$.jsx)(Un,{props:e}):(0,$.jsx)(y,{children:(0,$.jsx)(Un,{props:e})})}function Gn(e,t){let n=C((e,n)=>new Bn(t,e,n));return Q.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function Kn({store:e,modal:t}){let n=e.useState(`floatingRootContext`),r=M(n,{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),i=r.reference,a=r.floating;return S(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:a}),null}var qn=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:o=!1,nativeButton:s=!0,handle:l,payload:u,openOnHover:d=!1,delay:f=300,closeDelay:p=0,id:h,...g}=e,_=Rn(!0),y=Je(l)??_;if(!y)throw Error(c(74));let x=b(h),S=y.useState(`isTriggerActive`,x),C=y.useState(`floatingRootContext`),w=y.useState(`isOpenedByTrigger`,x),T=y.useState(`triggerPopupId`,x),E=Q.useRef(null),{registerTrigger:k,isMountedByThisTrigger:A}=m(x,E,y,{payload:u,disabled:o,openOnHover:d,closeDelay:p}),j=y.useState(`openChangeReason`),M=y.useState(`stickIfOpen`),P=y.useState(`openMethod`),F=y.useState(`focusManagerModal`),I=He(C,{enabled:!o&&d&&(P!==`touch`||j!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:en(),restMs:f,delay:{close:p},triggerElementRef:E,isActiveTrigger:S,isClosing:()=>y.select(`transitionStatus`)===`ending`}),L=ft(C,{stickIfOpen:M}),R=Be(()=>y.select(`open`),e=>{y.set(`openMethod`,e)}),z=y.useState(`triggerProps`,A),{getButtonProps:ee,buttonRef:te}=O({disabled:o,native:s}),B={open(e){return e&&j===`trigger-press`?v.open(e):N.open(e)}},{preFocusGuardRef:re,handlePreFocusGuardFocus:ie,handleFocusTargetFocus:ae}=it(y,E),V=a(`button`,e,{state:{disabled:o,open:w},ref:[te,t,k,E],props:[L.reference,I,z,R,{[D]:``,id:x,"aria-haspopup":`dialog`,"aria-expanded":w,"aria-controls":T},g,ee],stateAttributesMapping:B}),oe=(0,$.jsx)(Q.Fragment,{children:V},x);return A&&!F?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(ne,{ref:re,onFocus:ie}),oe,(0,$.jsx)(ne,{ref:y.context.triggerFocusTargetRef,onFocus:ae})]}):oe}),Jn=Q.createContext(void 0);function Yn(){let e=Q.useContext(Jn);if(e===void 0)throw Error(c(45));return e}var Xn=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Rn().useState(`mounted`)||n?(0,$.jsx)(Jn.Provider,{value:n,children:(0,$.jsx)(R,{ref:t,...r})}):null}),Zn=Q.createContext(void 0);function Qn(){let e=Q.useContext(Zn);if(!e)throw Error(c(46));return e}var $n=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:g=!1,collisionAvoidance:_=le,...v}=e,y=Rn(),b=Yn(),x=ce(),S=y.useState(`floatingRootContext`),C=y.useState(`mounted`),w=y.useState(`open`),T=y.useState(`openChangeReason`),E=y.useState(`activeTriggerElement`),D=y.useState(`modal`),O=y.useState(`openMethod`),k=y.useState(`positionerElement`),A=y.useState(`instantType`),j=y.useState(`transitionStatus`),M=y.useState(`adaptiveOrigin`),N=Q.useRef(null),P=I(k),F=qe({anchor:a,floatingRootContext:S,positionMethod:o,mounted:C,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:g,keepMounted:b,nodeId:x,collisionAvoidance:_,adaptiveOrigin:M}),L=S.useState(`domReferenceElement`);H(()=>{let e=L,t=N.current;if(e&&(N.current=e),t&&e&&e!==t){y.set(`instantType`,void 0);let e=new AbortController;return P(()=>{y.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[L,P,y]);let R=D===!0&&T!==`trigger-hover`;$e(w&&R,O===`touch`,k,E);let z=y.useStateSetter(`positionerElement`),te={open:w,side:F.side,align:F.align,anchorHidden:F.anchorHidden,instant:A},ne=tt(e,te,{styles:F.positionerStyles,transitionStatus:j,props:v,refs:[t,z],hidden:!C,inert:!w});return(0,$.jsxs)(Zn.Provider,{value:F,children:[C&&R&&(0,$.jsx)(ee,{inert:ae(!w),cutout:E}),(0,$.jsx)(h,{id:x,children:ne})]})}),er=Q.createContext(void 0);function tr(){let[e,t]=Q.useState(0),n=B(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Q.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var nr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:o,finalFocus:s,...c}=e,l=Rn(),u=Qn(),f=st(!0)!=null,{context:p,hasClosePart:m}=tr(),h=l.useState(`open`),g=l.useState(`openMethod`),_=l.useState(`instantType`),v=l.useState(`transitionStatus`),y=l.useState(`popupProps`),b=l.useState(`titleElementId`),x=l.useState(`descriptionElementId`),S=l.useState(`modal`),C=l.useState(`mounted`),T=l.useState(`openChangeReason`),E=l.useState(`activeTriggerElement`),D=l.useState(`floatingRootContext`),O=D.useState(`floatingId`),k=l.useState(`disabled`),A=l.useState(`openOnHover`),M=l.useState(`closeDelay`);d({open:h,ref:l.context.popupRef,onComplete(){h&&l.context.onOpenChangeComplete?.(!0)}}),pt(D,{enabled:A&&!k,closeDelay:M});let N=o===void 0?w(l.context.popupRef):o,P=S!==!1&&m;l.useSyncedValue(`focusManagerModal`,P);let I=l.useStateSetter(`popupElement`),R={open:h,side:u.side,align:u.align,instant:_,transitionStatus:v},z=a(`div`,e,{state:R,ref:[t,l.context.popupRef,I],props:[y,{id:O,role:`dialog`,...j,"aria-labelledby":b,"aria-describedby":x,onKeyDown(e){f&&de.has(e.key)&&e.stopPropagation()}},Ze(v),c],stateAttributesMapping:F});return(0,$.jsx)(L,{context:D,openInteractionType:g,modal:P,disabled:!C||T===`trigger-hover`,initialFocus:N,returnFocus:s,restoreFocus:`popup`,previousFocusableElement:te(E)?E:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:(0,$.jsx)(er.Provider,{value:p,children:z})})}),rr=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,children:o,...s}=e,c=Rn(),{side:l}=Qn(),u=c.useState(`instantType`),{children:d,state:f}=Mn({store:c,side:l,children:o}),p={activationDirection:f.activationDirection,transitioning:f.transitioning,instant:u};return a(`div`,e,{state:p,ref:t,props:[s,{children:d}],stateAttributesMapping:jn})}),ir=Wn;function ar({className:e,children:t,...n}){return(0,$.jsx)(qn,{className:e,"data-slot":`popover-trigger`,...n,children:t})}function or({children:e,className:t,viewportClassName:n,side:r=`bottom`,align:i=`center`,sideOffset:a=4,alignOffset:o=0,tooltipStyle:c=!1,anchor:l,...u}){return(0,$.jsx)(Xn,{children:(0,$.jsx)($n,{align:i,alignOffset:o,anchor:l,className:`z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none`,"data-slot":`popover-positioner`,side:r,sideOffset:a,children:(0,$.jsx)(nr,{className:s(`relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-xl has-data-[slot=calendar]:before:rounded-[calc(var(--radius-xl)-1px)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,c&&`w-fit text-balance rounded-md text-xs shadow-md/5 before:rounded-[calc(var(--radius-md)-1px)]`,t),"data-slot":`popover-popup`,...u,children:(0,$.jsx)(rr,{className:s(`relative size-full max-h-(--available-height) overflow-clip px-(--viewport-inline-padding) py-4 [--viewport-inline-padding:--spacing(4)] has-data-[slot=calendar]:p-2 data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity`,c?`py-1 [--viewport-inline-padding:--spacing(2)]`:`not-data-transitioning:overflow-y-auto`,n),"data-slot":`popover-viewport`,children:e})})})})}function sr({repos:e,disabled:t,onAdd:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(``),s=(0,Q.useMemo)(()=>{let t=a.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,a]);return(0,$.jsxs)(ir,{open:r,onOpenChange:e=>{e&&o(``),i(e)},children:[(0,$.jsx)(ar,{render:(0,$.jsxs)(l,{variant:`outline`,size:`sm`,disabled:t,className:`h-8 text-xs text-muted-foreground`,children:[(0,$.jsx)(Dt,{size:14}),` Add repository`]})}),(0,$.jsxs)(or,{align:`end`,className:`w-[320px]`,viewportClassName:`p-0`,children:[(0,$.jsx)(`div`,{className:`border-b border-border p-2`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Ft,{className:`absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(V,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),placeholder:`Search repositories`,className:`pl-8`,"aria-label":`Search repositories`})]})}),(0,$.jsx)(`div`,{role:`listbox`,className:`max-h-64 overflow-y-auto py-1`,children:s.length===0?(0,$.jsx)(`div`,{className:`px-3 py-4 text-center text-sm text-muted-foreground`,children:`No repositories found.`}):s.map(e=>(0,$.jsxs)(`button`,{role:`option`,"aria-selected":!1,onClick:()=>{i(!1),n(e.path)},className:`flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-accent`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.path})]}),(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:e.defaultBranch})]},e.path))})]})]})}var cr=(e,t)=>{switch(e){case`antigravity`:return`agy --conversation ${t}`;case`claude`:return`claude --resume ${t}`;case`codex`:return`codex resume ${t}`;case`copilot`:return`copilot --resume ${t}`;case`cursor`:return`cursor-agent --resume ${t}`;default:return`agy --conversation ${t}`}},lr=e=>{switch(e){case`antigravity`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-card border border-border/80 shadow-2xs p-0.5 shrink-0`,title:`Google Antigravity`,children:(0,$.jsx)(Xe,{className:`size-3.5`})});case`claude`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-[#D97757] text-white font-bold text-[9px] shadow-2xs shrink-0`,title:`Claude Code`,children:(0,$.jsx)(gt,{className:`size-2.5`})});case`codex`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-foreground text-background font-bold text-[9px] shadow-2xs shrink-0`,title:`OpenAI Codex`,children:(0,$.jsx)(kt,{className:`size-2.5`})});case`copilot`:return(0,$.jsx)(`span`,{className:`grid size-5.5 place-items-center rounded-md bg-gradient-to-tr from-purple-600 via-indigo-500 to-blue-600 text-white font-bold text-[9px] shadow-2xs shrink-0`,title:`GitHub Copilot`,children:(0,$.jsx)(vt,{className:`size-2.5`})});default:return null}},ur=e=>{if(!e)return``;let t=new Date(e);return isNaN(t.getTime())?``:new Date().toDateString()===t.toDateString()?`Today ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`:`${t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})} ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`},dr=({ws:e,sessions:t,sessionsLoading:n,setActiveSession:r,setTranscript:i,fetchSessionTranscript:a,handleOpenDesktopSession:o,showToast:c})=>{let u=Wt(),d=ot(),f=We(),p=f.data?.find(e=>e.name===`antigravity`)?.detected??!0,m=!!f.data?.find(e=>e.name===`claude`)?.detected,h=!!f.data?.find(e=>e.name===`codex`)?.detected,g=!!f.data?.find(e=>e.name===`copilot`)?.command,_=!!u.data?.some(e=>e.id===`antigravity`&&e.available),v=!!u.data?.some(e=>e.id===`codex-desktop`&&e.available),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(`created-desc`),[k,A]=(0,Q.useState)(`harness`),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(`all`),[F,I]=(0,Q.useState)({antigravity:!1,claude:!1,codex:!1,copilot:!1}),L=e=>{I(t=>({...t,[e]:!t[e]}))},R=(0,Q.useRef)(!1),z=(0,Q.useRef)(null),ee=async t=>{try{await Tt(`/api/workspace/${encodeURIComponent(e.branchName)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t})}),c?.(`Launched ${t===`claude-desktop`?`Claude Desktop`:t===`codex-desktop`?`Codex Desktop`:t} for workspace ${e.branchName}`,`success`)}catch(e){let t=e instanceof Error?e.message:`Failed to launch desktop application`;c?.(t,`error`)}},te=async t=>{if(!C){w(t);try{await d.mutateAsync({workspaceId:e.branchName,assistant:t}),E({assistant:t,cmd:t===`antigravity`?`agy`:t===`claude`?`claude`:t===`codex`?`codex`:`copilot`,timestamp:new Date}),c?.(`Started new ${t} session in terminal`,`success`)}catch(e){let t=e instanceof Error?e.message:`Failed to launch terminal`;c?.(t,`error`)}finally{w(null)}}},ne=async(t,n,r)=>{if(!R.current){R.current=!0,S(t);try{await d.mutateAsync({workspaceId:e.branchName,sessionId:t,assistant:n,cwd:r});let i=cr(n,t);E({assistant:n,cmd:i,timestamp:new Date}),c?.(`Resumed ${n} session in terminal`,`success`)}catch{let e=cr(n,t);await Ht(e),c?.(`Copied resume command to clipboard: ${e}`,`info`)}finally{S(null),R.current=!1}}},B=async t=>{if(!(!v||z.current)){z.current=t,b(t);try{await o(e,t,`codex`)}finally{z.current=null,b(null)}}},re=(e,t)=>[...e].sort((e,n)=>{switch(t){case`created-desc`:{let t=new Date(e.createdAt||e.updatedAt||0).getTime();return new Date(n.createdAt||n.updatedAt||0).getTime()-t}case`created-asc`:return new Date(e.createdAt||e.updatedAt||0).getTime()-new Date(n.createdAt||n.updatedAt||0).getTime();case`updated-desc`:{let t=new Date(e.updatedAt||e.createdAt||0).getTime();return new Date(n.updatedAt||n.createdAt||0).getTime()-t}case`messages-desc`:return(n.messageCount||0)-(e.messageCount||0);case`title-asc`:return(e.title||``).localeCompare(n.title||``);default:return 0}}),ie=(0,Q.useMemo)(()=>{let e=t;if(N!==`all`&&(e=e.filter(e=>e.assistant===N)),j.trim()){let t=j.toLowerCase();e=e.filter(e=>`${e.title} ${e.id} ${e.assistant}`.toLowerCase().includes(t))}return re(e,D)},[t,N,j,D]),ae=(0,Q.useMemo)(()=>re(t.filter(e=>e.assistant===`antigravity`),D),[t,D]),V=(0,Q.useMemo)(()=>re(t.filter(e=>e.assistant===`claude`),D),[t,D]),oe=(0,Q.useMemo)(()=>re(t.filter(e=>e.assistant===`codex`),D),[t,D]),se=(0,Q.useMemo)(()=>re(t.filter(e=>e.assistant===`copilot`),D),[t,D]),ce=(0,Q.useCallback)(t=>e.assistants?.includes(t)??!1,[e.assistants]),H=(0,Q.useMemo)(()=>[{id:`antigravity`,name:`Google Antigravity`,cliCommand:`agy`,isDetected:p,isConfigured:ce(`antigravity`),hasApp:_,appName:`IDE`,appTargetId:`antigravity`,sessions:ae,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-card border border-border/80 shadow-2xs p-0.5`,children:(0,$.jsx)(Xe,{className:`size-4`})})},{id:`claude`,name:`Claude Code`,cliCommand:`claude`,isDetected:m,isConfigured:ce(`claude`),hasApp:!1,appName:`App`,appTargetId:`claude`,sessions:V,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-[#D97757] text-white font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(gt,{className:`size-3`})})},{id:`codex`,name:`OpenAI Codex`,cliCommand:`codex`,isDetected:h,isConfigured:ce(`codex`),hasApp:v,appName:`Desktop`,appTargetId:`codex-desktop`,sessions:oe,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-foreground text-background font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(kt,{className:`size-3`})})},{id:`copilot`,name:`GitHub Copilot`,cliCommand:`copilot`,isDetected:g,isConfigured:ce(`copilot`),hasApp:!1,appName:`App`,appTargetId:`copilot`,sessions:se,icon:(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-gradient-to-tr from-purple-600 via-indigo-500 to-blue-600 text-white font-bold text-[10px] shadow-2xs`,children:(0,$.jsx)(vt,{className:`size-3`})})}],[p,m,h,g,_,v,ce,ae,V,oe,se]),U=(0,Q.useMemo)(()=>H.filter(e=>e.isDetected||e.sessions.length>0),[H]);return(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between bg-card/60 p-2 rounded-md border border-border/80`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`relative flex-1 min-w-0 max-w-xs`,children:[(0,$.jsx)(Ft,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 size-3 text-muted-foreground`}),(0,$.jsx)(`input`,{type:`text`,value:j,onChange:e=>M(e.target.value),placeholder:`Search chat sessions...`,className:`w-full pl-7 pr-6 py-1 text-xs rounded border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary`}),j&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>M(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground text-[10px] cursor-pointer`,children:`✕`})]}),(0,$.jsxs)(`div`,{className:`hidden md:flex items-center gap-1`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>P(`all`),className:s(`px-2 py-0.5 text-[11px] rounded font-medium transition-colors cursor-pointer`,N===`all`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`bg-muted/60 text-muted-foreground hover:text-foreground hover:bg-muted`),children:[`All (`,t.length,`)`]}),U.map(e=>{let t=e.sessions.length;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>P(N===e.id?`all`:e.id),className:s(`px-2 py-0.5 text-[11px] rounded font-medium capitalize transition-colors cursor-pointer`,N===e.id?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`bg-muted/60 text-muted-foreground hover:text-foreground hover:bg-muted`),children:[e.name.replace(`Google `,``).replace(`OpenAI `,``).replace(`GitHub `,``),` (`,t,`)`]},e.id)})]}),n&&(0,$.jsx)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground shrink-0 pl-1`,children:(0,$.jsx)(q,{className:`size-3`})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,$.jsxs)(Ct,{children:[(0,$.jsxs)(Yt,{className:`flex items-center gap-1.5 px-2 py-1 text-xs font-medium rounded border border-border bg-card text-foreground hover:bg-accent cursor-pointer shadow-2xs transition-colors`,children:[(0,$.jsx)(jt,{size:11,className:`text-muted-foreground`}),(0,$.jsx)(`span`,{children:{"created-desc":`Newest`,"created-asc":`Oldest`,"updated-desc":`Recently active`,"messages-desc":`Most turns`,"title-asc":`A–Z`}[D]}),(0,$.jsx)(fe,{size:10,className:`text-muted-foreground opacity-70`})]}),(0,$.jsxs)(lt,{align:`end`,className:`w-48`,children:[(0,$.jsx)(`div`,{className:`px-2 py-1 text-[10px] font-semibold text-muted-foreground uppercase tracking-wider`,children:`Order Chats By`}),(0,$.jsxs)(X,{onClick:()=>O(`created-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Newest created`}),D===`created-desc`&&(0,$.jsx)(W,{size:12,className:`text-primary`})]}),(0,$.jsxs)(X,{onClick:()=>O(`created-asc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Oldest created`}),D===`created-asc`&&(0,$.jsx)(W,{size:12,className:`text-primary`})]}),(0,$.jsxs)(X,{onClick:()=>O(`updated-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Recently active`}),D===`updated-desc`&&(0,$.jsx)(W,{size:12,className:`text-primary`})]}),(0,$.jsxs)(X,{onClick:()=>O(`messages-desc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Most turns`}),D===`messages-desc`&&(0,$.jsx)(W,{size:12,className:`text-primary`})]}),(0,$.jsxs)(X,{onClick:()=>O(`title-asc`),className:`flex items-center justify-between text-xs`,children:[(0,$.jsx)(`span`,{children:`Title (A–Z)`}),D===`title-asc`&&(0,$.jsx)(W,{size:12,className:`text-primary`})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center rounded border border-border bg-card p-0.5 shadow-2xs`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>A(`harness`),title:`Group chats by AI Harness`,className:s(`px-2 py-0.5 text-xs rounded font-medium transition-colors cursor-pointer`,k===`harness`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`text-muted-foreground hover:text-foreground`),children:`Grouped`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>A(`timeline`),title:`Unified Chronological Timeline`,className:s(`px-2 py-0.5 text-xs rounded font-medium transition-colors cursor-pointer`,k===`timeline`?`bg-primary text-primary-foreground font-semibold shadow-2xs`:`text-muted-foreground hover:text-foreground`),children:`Timeline`})]})]})]}),T&&(0,$.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 p-2.5 rounded-md bg-emerald-500/10 border border-emerald-500/30 text-xs animate-fade-in`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-foreground min-w-0`,children:[(0,$.jsx)(`span`,{className:`size-2 rounded-full bg-emerald-500 animate-pulse shrink-0`}),(0,$.jsxs)(`span`,{className:`truncate`,children:[(0,$.jsx)(`strong`,{children:`Active in terminal:`}),` `,(0,$.jsx)(`code`,{className:`font-mono bg-background/80 px-1.5 py-0.5 rounded text-emerald-400`,children:T.cmd})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:async()=>{await Ht(T.cmd),c?.(`Command copied to clipboard!`,`success`)},className:`inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium rounded border border-emerald-500/40 bg-emerald-500/15 text-emerald-400 hover:bg-emerald-500/25 transition-colors cursor-pointer`,children:[(0,$.jsx)(G,{size:11}),` Copy`]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>E(null),className:`text-muted-foreground hover:text-foreground cursor-pointer text-xs px-1`,title:`Dismiss banner`,children:`✕`})]})]}),k===`timeline`?(0,$.jsx)(Z,{className:`divide-y divide-border overflow-hidden surface-card`,children:ie.length===0?(0,$.jsx)(`div`,{className:`py-8 text-center text-xs text-muted-foreground`,children:j?`No chat sessions match your search filter.`:`No chat sessions recorded yet.`}):ie.map(e=>(0,$.jsxs)(`div`,{className:`group flex flex-col gap-2 p-3 hover:bg-accent/40 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[lr(e.assistant),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground mb-0.5`,children:[(0,$.jsx)(`span`,{className:`font-semibold capitalize text-foreground`,children:e.assistant===`antigravity`?`Antigravity`:e.assistant===`claude`?`Claude`:e.assistant===`codex`?`Codex`:`Copilot`}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{className:`font-mono text-muted-foreground/80`,children:e.id.slice(0,8)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{children:ur(e.createdAt||e.updatedAt)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`font-mono`,children:[e.messageCount,` `,e.messageCount===1?`turn`:`turns`]})]}),(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground truncate`,title:e.title,children:e.title})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pl-8 sm:pl-0`,children:[(0,$.jsxs)(l,{size:`xs`,variant:`default`,disabled:x===e.id,onClick:()=>void ne(e.id,e.assistant,e.workspacePath),title:`Resume session in terminal (${e.id})`,children:[x===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Y,{size:12}),(0,$.jsx)(`span`,{children:`Resume`})]}),(0,$.jsxs)(l,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(Qt,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&v&&(0,$.jsxs)(l,{size:`xs`,variant:`outline`,disabled:y===e.id,onClick:()=>void B(e.id),title:`Open in Codex Desktop`,children:[y===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Ue,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(l,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=cr(e.assistant,e.id);await Ht(t),c?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(G,{size:12})})]})]},e.id))}):(0,$.jsx)(`div`,{className:`space-y-2.5`,children:U.map(e=>{let t=F[e.id]??!1,n=e.sessions.filter(e=>{if(!j.trim())return!0;let t=j.toLowerCase();return`${e.title} ${e.id}`.toLowerCase().includes(t)});return(0,$.jsxs)(Z,{className:`overflow-hidden surface-card`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 p-3 sm:flex-row sm:items-center sm:justify-between bg-muted/20 hover:bg-muted/35 transition-colors cursor-pointer select-none`,onClick:()=>L(e.id),children:[(0,$.jsxs)(`div`,{className:`flex flex-1 items-center gap-2.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground transition-transform`,children:t?(0,$.jsx)(fe,{size:14}):(0,$.jsx)(me,{size:14})}),e.icon,(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:`font-bold text-xs text-foreground`,children:e.name}),(0,$.jsxs)(Gt,{tone:e.isDetected?`success`:`neutral`,dot:e.isDetected,children:[`CLI: `,e.cliCommand]}),e.hasApp&&(0,$.jsx)(Gt,{tone:`running`,children:e.appName}),(0,$.jsxs)(`span`,{className:`text-[11px] text-muted-foreground font-mono`,children:[`(`,n.length,`)`]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 pl-6 sm:pl-0`,onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(l,{size:`xs`,variant:`default`,disabled:C===e.id,onClick:()=>void te(e.id),title:`Launch new ${e.cliCommand} session in terminal`,children:[C===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Dt,{size:12}),(0,$.jsx)(`span`,{children:`New Session`})]}),e.hasApp&&(0,$.jsxs)(l,{size:`xs`,variant:`outline`,onClick:()=>void ee(e.appTargetId),title:`Open in ${e.appName}`,children:[(0,$.jsx)(Ue,{size:12}),(0,$.jsx)(`span`,{children:e.appName})]})]})]}),t&&(0,$.jsx)(`div`,{className:`divide-y divide-border/60 border-t border-border`,children:n.length===0?(0,$.jsxs)(`div`,{className:`p-4 text-center text-xs text-muted-foreground flex items-center justify-center gap-2`,children:[(0,$.jsx)(`span`,{children:j?`No sessions match your search query.`:`No previous sessions recorded for ${e.name}.`}),!j&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void te(e.id),className:`text-primary font-semibold hover:underline cursor-pointer inline-flex items-center gap-1 text-xs`,children:[(0,$.jsx)(Dt,{size:11}),` Start session`]})]}):n.map(e=>(0,$.jsxs)(`div`,{className:`group flex flex-col gap-1.5 px-3.5 py-2.5 hover:bg-accent/40 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mb-0.5 text-[11px] text-muted-foreground font-mono`,children:[(0,$.jsx)(`span`,{children:e.id.slice(0,8)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsx)(`span`,{children:ur(e.createdAt||e.updatedAt)}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{children:[e.messageCount,` `,e.messageCount===1?`turn`:`turns`]})]}),(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground truncate`,title:e.title,children:e.title})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,$.jsxs)(l,{size:`xs`,variant:`default`,disabled:x===e.id,onClick:()=>void ne(e.id,e.assistant,e.workspacePath),title:`Resume session in terminal (${e.id})`,children:[x===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Y,{size:12}),(0,$.jsx)(`span`,{children:`Resume`})]}),(0,$.jsxs)(l,{size:`xs`,variant:`outline`,onClick:()=>{r(e),i([]),a(e.assistant,e.id)},title:`Inspect transcript log`,children:[(0,$.jsx)(Qt,{size:12}),(0,$.jsx)(`span`,{children:`Logs`})]}),e.assistant===`codex`&&v&&(0,$.jsxs)(l,{size:`xs`,variant:`outline`,disabled:y===e.id,onClick:()=>void B(e.id),title:`Open in Codex Desktop`,children:[y===e.id?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(Ue,{size:12}),(0,$.jsx)(`span`,{children:`Desktop`})]}),(0,$.jsx)(l,{size:`icon-xs`,variant:`ghost`,onClick:async()=>{let t=cr(e.assistant,e.id);await Ht(t),c?.(`Copied: ${t}`,`success`)},title:`Copy CLI resume command`,children:(0,$.jsx)(G,{size:12})})]})]},e.id))})]},e.id)})})]})},fr=({ws:e,gitChanges:t,gitChangesLoading:n,syncLoading:r,syncResults:i,commitMessage:a,showCommitModal:o,commitLoading:c,commitResults:u,setSyncResults:d,setCommitResults:f,setCommitMessage:p,setShowCommitModal:m,fetchGitChanges:h,handleSyncAll:g,handleCommitAll:_})=>{let[v,y]=(0,Q.useState)({}),[b,x]=(0,Q.useState)({}),[S,C]=(0,Q.useState)({}),[w,T]=(0,Q.useState)({}),[E,D]=(0,Q.useState)({}),[O,k]=(0,Q.useState)(``),A=e=>v[e]??!0,j=e=>{y(t=>({...t,[e]:!A(e)}))},M=()=>{let e={};t.forEach(t=>{e[t.repoName]=!1}),y(e)},N=()=>{let e={};t.forEach(t=>{e[t.repoName]=!0}),y(e),x({})},P=async(t,n)=>{let r=`${t}/${n}`,i=!b[r];if(x(e=>({...e,[r]:i})),i&&!S[r]){T(e=>({...e,[r]:!0})),D(e=>({...e,[r]:``}));try{let i=encodeURIComponent(e.branchName),a=await fetch(`/api/workspace/${i}/changes/diff?repo=${encodeURIComponent(t)}&file=${encodeURIComponent(n)}`);if(!a.ok)throw Error(`Failed to load diff: ${a.statusText}`);let o=await a.json();C(e=>({...e,[r]:o.diff||``}))}catch(e){D(t=>({...t,[r]:e.message||`Unknown error`}))}finally{T(e=>({...e,[r]:!1}))}}},F=e=>{if(!e||!e.trim())return(0,$.jsx)(`div`,{className:`p-3 font-mono text-[11px] italic text-muted-foreground`,children:`No diff details available.`});let t=e.split(`
|
|
2
|
+
`);return(0,$.jsx)(`pre`,{className:`custom-scrollbar max-h-[450px] overflow-x-auto overflow-y-auto rounded-xl border border-border bg-muted/40 p-4 font-mono text-[11px] leading-relaxed text-muted-foreground select-text`,children:t.map((e,t)=>{let n;return n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`block w-full rounded-sm bg-success/10 px-1 text-success-foreground`:e.startsWith(`-`)&&!e.startsWith(`---`)?`block w-full rounded-sm bg-destructive/10 px-1 text-destructive-foreground`:e.startsWith(`@@`)?`block w-full bg-info/10 px-1 font-semibold italic text-info-foreground`:e.startsWith(`diff`)||e.startsWith(`index`)||e.startsWith(`---`)||e.startsWith(`+++`)?`block w-full font-bold text-muted-foreground`:`block w-full px-1 text-foreground`,(0,$.jsx)(`code`,{className:n,children:e},t)})})},I=t.filter(e=>e.files&&e.files.length>0),L=I.reduce((e,t)=>e+t.files.length,0);return(0,$.jsxs)(`div`,{className:`animate-fade-in`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-6 flex-wrap gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(Xt,{size:16,className:`text-primary`}),` Active Workspace Git Diffs`]}),I.length>0&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 pl-2 border-l border-border/80`,children:[(0,$.jsxs)(l,{variant:`ghost`,size:`xs`,onClick:N,title:`Collapse all repositories and file diffs`,className:`text-xs text-muted-foreground hover:text-foreground h-7 px-2 gap-1 font-semibold`,children:[(0,$.jsx)(an,{size:12}),(0,$.jsx)(`span`,{children:`Collapse All`})]}),(0,$.jsxs)(l,{variant:`ghost`,size:`xs`,onClick:M,title:`Expand all repositories`,className:`text-xs text-muted-foreground hover:text-foreground h-7 px-2 gap-1 font-semibold`,children:[(0,$.jsx)(on,{size:12}),(0,$.jsx)(`span`,{children:`Expand All`})]})]})]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>h(e.branchName),disabled:n,children:[(0,$.jsx)(J,{size:11,className:n?`animate-spin text-primary`:``}),` Refresh Changes`]}),e.mode!==`in-place`&&(0,$.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>g(e.branchName),disabled:r,children:[r?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(J,{size:11}),` Sync All`]}),(0,$.jsx)(l,{size:`sm`,onClick:()=>m(!0),disabled:L===0||c,children:`Commit & Push All`})]})]}),i&&e.mode!==`in-place`&&(0,$.jsxs)(`div`,{className:`relative mb-5 rounded-xl border border-info/25 bg-info/10 p-5 text-info-foreground shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between border-b border-info/20 pb-2`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-xs font-bold text-foreground`,children:`Rebase / Sync Action Logs`}),(0,$.jsx)(`button`,{className:`cursor-pointer text-[10px] font-bold text-info-foreground hover:text-foreground`,onClick:()=>d(null),children:`Dismiss`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:i.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-card p-2 font-mono text-[10px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.repoName}),(0,$.jsx)(`span`,{className:e.success?`font-bold text-success-foreground`:`font-bold text-destructive-foreground`,children:e.success?`✓ Synced (${e.message})`:`✗ Conflict: ${e.message}`})]},e.repoName))})]}),u&&(0,$.jsxs)(`div`,{className:`relative mb-5 rounded-xl border border-success/25 bg-success/10 p-5 text-success-foreground shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between border-b border-success/20 pb-2`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-xs font-bold text-foreground`,children:`Commit & Push Results`}),(0,$.jsx)(`button`,{className:`cursor-pointer text-[10px] font-bold text-success-foreground hover:text-foreground`,onClick:()=>f(null),children:`Dismiss`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:u.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-card p-2 font-mono text-[10px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.repoName}),(0,$.jsx)(`span`,{className:e.success?`font-bold text-success-foreground`:`font-bold text-destructive-foreground`,children:e.success?`✓ Committed ${e.filesChanged} file(s) (${e.commitHash?e.commitHash.slice(0,7):`no hash`})`:`✗ Error: ${e.message}`})]},e.repoName))})]}),o&&(0,$.jsxs)(`div`,{className:`relative mb-6 rounded-xl border border-border bg-card p-6 shadow-sm animate-rise`,children:[(0,$.jsxs)(`h5`,{className:`mb-3 flex items-center gap-1.5 text-xs font-bold text-foreground`,children:[(0,$.jsx)(bn,{size:13,className:`text-primary`}),` Enter Commit Message`]}),(0,$.jsx)(V,{type:`text`,className:`mb-4 font-mono text-xs`,placeholder:`feat: implement multi-repo logic...`,value:a,onChange:e=>p(e.target.value),onKeyDown:t=>{t.key===`Enter`&&a.trim()&&_(e.branchName)}}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2.5`,children:[(0,$.jsx)(l,{variant:`outline`,size:`sm`,onClick:()=>{m(!1),p(``)},disabled:c,children:`Cancel`}),(0,$.jsxs)(l,{size:`sm`,onClick:()=>_(e.branchName),disabled:c||!a.trim(),children:[c?(0,$.jsx)(q,{className:`size-3`}):null,c?`Committing...`:`Commit & Push All`]})]})]}),n?(0,$.jsx)(`div`,{className:`flex justify-center py-20`,children:(0,$.jsx)(q,{className:`size-6 text-primary`})}):(0,$.jsx)(`div`,{className:`space-y-4`,children:I.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-xl border border-border bg-card py-16 text-center shadow-xs`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-full border border-success/25 bg-success/10 text-success-foreground shadow-sm`,children:(0,$.jsx)(W,{size:20})}),(0,$.jsx)(`h5`,{className:`text-sm font-bold text-foreground`,children:`No Uncommitted Changes`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Workspace repositories are completely in sync with Git feature branches.`})]}):I.map(e=>{let t=e.files.length,n=e.files.reduce((e,t)=>e+(t.additions||0),0),r=e.files.reduce((e,t)=>e+(t.deletions||0),0),i=A(e.repoName);return(0,$.jsxs)(`div`,{className:`relative rounded-xl border border-border/80 bg-card/80 backdrop-blur-md transition-all shadow-xs overflow-hidden`,children:[(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>j(e.repoName),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),j(e.repoName))},className:s(`flex justify-between items-center px-5 py-4 cursor-pointer select-none transition-colors`,i?`hover:bg-accent/40`:`bg-muted/20 border-b border-border/60 hover:bg-muted/30`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap min-w-0`,children:[(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-md bg-primary/10 text-primary border border-primary/20 shrink-0`,children:i?(0,$.jsx)(me,{size:14,className:`shrink-0 text-muted-foreground`}):(0,$.jsx)(fe,{size:14,className:`shrink-0 text-primary`})}),(0,$.jsx)(`h5`,{className:`font-mono text-sm font-bold text-foreground truncate`,children:e.repoName}),(0,$.jsxs)(Gt,{tone:`warning`,dot:!1,children:[t,` file`,t===1?``:`s`,` changed`]}),(n>0||r>0)&&(0,$.jsxs)(`span`,{className:`rounded-md border border-border bg-muted/60 px-2 py-0.5 font-mono text-[10px] font-bold`,children:[(0,$.jsxs)(`span`,{className:`font-bold text-success-foreground`,children:[`+`,n]}),` `,(0,$.jsxs)(`span`,{className:`font-bold text-destructive-foreground`,children:[`-`,r]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,$.jsx)(`span`,{className:`max-w-[280px] truncate font-mono text-[10px] text-muted-foreground hidden md:inline`,title:e.repoPath,children:e.repoPath}),(0,$.jsx)(`span`,{className:`text-[11px] font-bold text-primary hover:underline`,children:i?`Expand Files`:`Collapse`})]})]}),!i&&(0,$.jsx)(`div`,{className:`p-5 flex flex-col gap-3 bg-card/40`,children:e.files.map(t=>{let n=`${e.repoName}/${t.file}`,r=!!b[n],i=!!w[n],a=S[n]||``,o=E[n]||``;return(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/80 bg-muted/20 transition-colors hover:border-primary/30 shadow-2xs`,children:[(0,$.jsxs)(`div`,{className:`flex cursor-pointer select-none items-center justify-between px-4 py-3 transition-colors hover:bg-accent/50`,onClick:()=>P(e.repoName,t.file),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[r?(0,$.jsx)(fe,{size:14,className:`shrink-0 text-primary`}):(0,$.jsx)(me,{size:14,className:`shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`max-w-[240px] truncate font-mono text-[11px] text-foreground sm:max-w-[480px] font-semibold`,title:t.file,children:t.file}),(t.additions>0||t.deletions>0)&&(0,$.jsxs)(`span`,{className:`ml-1 shrink-0 font-mono text-[9px] font-bold text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`text-success-foreground`,children:[`+`,t.additions]}),` /`,` `,(0,$.jsxs)(`span`,{className:`text-destructive-foreground`,children:[`-`,t.deletions]})]})]}),(0,$.jsx)(`div`,{className:`flex items-center gap-2.5 shrink-0`,children:(0,$.jsx)(`span`,{className:`rounded border px-2 py-0.5 text-[8px] font-bold uppercase tracking-wider ${t.type===`added`?`border-success/25 bg-success/10 text-success-foreground`:t.type===`deleted`?`border-destructive/25 bg-destructive/10 text-destructive-foreground`:`border-warning/25 bg-warning/10 text-warning-foreground`}`,children:t.type})})]}),r&&(0,$.jsx)(`div`,{className:`border-t border-border bg-background p-3`,children:i?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 p-2 font-mono text-[10px] text-primary`,children:[(0,$.jsx)(q,{className:`size-3`}),` Loading diff...`]}):o?(0,$.jsxs)(`div`,{className:`p-2 font-mono text-[10px] text-destructive-foreground`,children:[`Error: `,o]}):(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(a),k(n),setTimeout(()=>k(``),2e3)},className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground shadow-sm transition-colors hover:bg-accent hover:text-foreground`,title:`Copy Diff`,children:O===n?(0,$.jsx)(W,{size:12,className:`text-success-foreground`}):(0,$.jsx)(G,{size:12})})}),F(a)]})})]},t.file)})})]},e.repoName)})})]})},pr=({ws:e,knowledgeContent:t,knowledgeLoading:n,knowledgeError:r,isEditingKnowledge:i,editedKnowledge:a,saveKnowledgeLoading:o,saveKnowledgeError:s,setEditedKnowledge:c,setIsEditingKnowledge:u,handleSaveKnowledge:d,handleRetryKnowledge:f})=>{let[p,m]=(0,Q.useState)(`preview`);return(0,$.jsxs)(`div`,{className:`rounded-xl border border-border/80 bg-card/70 backdrop-blur-md p-5 shadow-xs`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-4`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(ze,{size:16,className:`text-primary`}),` Persistent Knowledge Memory (contextspace-knowledge.md)`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!i&&t&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/50 p-0.5 rounded-md border border-border/60`,children:[(0,$.jsxs)(l,{size:`xs`,variant:p===`preview`?`secondary`:`ghost`,onClick:()=>m(`preview`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(pe,{size:11}),` Preview`]}),(0,$.jsxs)(l,{size:`xs`,variant:p===`raw`?`secondary`:`ghost`,onClick:()=>m(`raw`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(un,{size:11}),` Raw`]})]}),i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{variant:`outline`,size:`xs`,onClick:()=>{c(t),u(!1)},disabled:o,children:`Cancel`}),(0,$.jsxs)(l,{size:`xs`,onClick:()=>d(e.branchName),disabled:o,children:[o?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(bn,{size:10}),` `,s?`Retry save`:`Save`]})]}):(0,$.jsxs)(l,{variant:`outline`,size:`xs`,onClick:()=>u(!0),disabled:n,children:[(0,$.jsx)(xn,{size:10}),` Edit Knowledge`]})]})]}),r&&(0,$.jsxs)(`div`,{role:`alert`,className:`mb-4 flex flex-wrap items-center justify-between gap-3 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(K,{size:14,className:`shrink-0`}),(0,$.jsx)(`span`,{children:r})]}),(0,$.jsxs)(l,{variant:`outline`,size:`xs`,onClick:()=>void f(e.branchName),disabled:n,children:[(0,$.jsx)(J,{size:11,className:n?`animate-spin`:``}),` Retry load`]})]}),s&&(0,$.jsxs)(`div`,{role:`alert`,className:`mb-4 flex items-center gap-2 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:[(0,$.jsx)(K,{size:14,className:`shrink-0`}),(0,$.jsx)(`span`,{children:s})]}),i?(0,$.jsx)(Lt,{"aria-label":`Knowledge editor`,className:`[&_[data-slot=textarea]]:h-96 [&_[data-slot=textarea]]:resize-y [&_[data-slot=textarea]]:font-mono [&_[data-slot=textarea]]:text-xs`,value:a,onChange:e=>c(e.target.value)}):n&&!t?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(J,{className:`animate-spin text-primary`,size:20})}):t?p===`preview`?(0,$.jsx)(`div`,{className:`max-h-[550px] overflow-auto rounded-xl border border-border/70 bg-card/40 backdrop-blur-xs p-4`,children:(0,$.jsx)(Zt,{content:t})}):(0,$.jsx)(`div`,{className:`max-h-[550px] overflow-auto whitespace-pre-wrap rounded-xl border border-border/70 bg-card/40 backdrop-blur-xs p-4 font-mono text-xs leading-relaxed text-muted-foreground`,children:t}):(0,$.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/20 p-6 text-center text-xs text-muted-foreground`,children:`No knowledge file generated yet.`})]})},mr=({planContent:e,planLoading:t,planError:n,handleRetryPlan:r,workspaceId:i})=>{let[a,o]=(0,Q.useState)(`preview`);return(0,$.jsxs)(`div`,{className:`rounded-xl border border-border/80 bg-card/70 backdrop-blur-md p-5 shadow-xs`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-4`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(mn,{size:16,className:`text-primary`}),` Inter-Repo Implementation Plan (contextspace-plan.md)`]}),e&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/50 p-0.5 rounded-md border border-border/60`,children:[(0,$.jsxs)(l,{size:`xs`,variant:a===`preview`?`secondary`:`ghost`,onClick:()=>o(`preview`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(pe,{size:11}),` Preview`]}),(0,$.jsxs)(l,{size:`xs`,variant:a===`raw`?`secondary`:`ghost`,onClick:()=>o(`raw`),className:`text-[11px] gap-1 px-2`,children:[(0,$.jsx)(un,{size:11}),` Raw`]})]})]}),n&&(0,$.jsxs)(`div`,{role:`alert`,className:`mb-4 flex flex-wrap items-center justify-between gap-3 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(K,{size:14,className:`shrink-0`}),(0,$.jsx)(`span`,{children:n})]}),i&&(0,$.jsxs)(l,{variant:`outline`,size:`xs`,onClick:()=>void r(i),disabled:t,children:[(0,$.jsx)(J,{size:11,className:t?`animate-spin`:``}),` Retry load`]})]}),t&&!e?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(J,{className:`animate-spin text-primary`,size:20})}):e?a===`preview`?(0,$.jsx)(`div`,{className:`max-h-[550px] overflow-auto rounded-xl border border-border/70 bg-card/40 backdrop-blur-xs p-4`,children:(0,$.jsx)(Zt,{content:e})}):(0,$.jsx)(`div`,{className:`max-h-[550px] overflow-auto whitespace-pre-wrap rounded-xl border border-border/70 bg-card/40 backdrop-blur-xs p-4 font-mono text-xs leading-relaxed text-muted-foreground`,children:e}):(0,$.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/20 p-6 text-center text-xs text-muted-foreground`,children:`No implementation plan generated yet.`})]})},hr={"git-pull-request":be,"flask-conical":ve,package:ye,database:_e,"shield-check":he,terminal:Y,zap:Rt,cpu:Jt,layers:Ce,boxes:rt};function gr({ws:e,showToast:t}){let[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)({}),[o,c]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!1),{data:m=[],isLoading:h}=_t(),{data:g=[],isLoading:_}=at(e.branchName),{data:v=[],isLoading:y}=Ke(),{data:b,isLoading:x,isError:S}=At(e.branchName),C=nt(),w=dt(),T=(0,Q.useMemo)(()=>new Set(o??b?.enabledSkills??[]),[o,b?.enabledSkills]),E=(0,Q.useMemo)(()=>new Set(u??b?.enabledAgents??[]),[u,b?.enabledAgents]);(0,Q.useEffect)(()=>{b&&(c([...b.enabledSkills??[]]),d([...b.enabledAgents??[]]))},[b]);let D=(0,Q.useMemo)(()=>{if(!b||o===null||u===null)return!1;let e=new Set(b.enabledSkills??[]),t=new Set(b.enabledAgents??[]);return!!(o.length!==e.size||o.some(t=>!e.has(t))||u.length!==t.size||u.some(e=>!t.has(e)))},[b,o,u]),O=e=>{a(t=>({...t,[e]:!t[e]}))},k=e=>{if(o===null)return;let t=new Set(o);t.has(e)?t.delete(e):t.add(e),c(Array.from(t))},A=e=>{if(u===null)return;let t=new Set(u);t.has(e)?t.delete(e):t.add(e),d(Array.from(t))},j=(e,t,n)=>{if(o===null)return;let r=new Set(o);for(let e of n)t?r.add(e.id):r.delete(e.id);c(Array.from(r))},M=async()=>{if(!(!b||o===null||u===null)){p(!0);try{await C.mutateAsync({workspaceId:e.branchName,expectedRevision:b.revision??0,enabledSkills:o,enabledAgents:u,enabledCategories:m.map(e=>e.id)}),await w.mutateAsync({workspaceId:e.branchName}),t?.(`Skills & agents deployed successfully to workspace context!`,`success`)}catch(e){t?.(e instanceof Error?e.message:`Failed to deploy skills`,`error`)}finally{p(!1)}}},N=(0,Q.useMemo)(()=>{if(!n.trim())return g;let e=n.toLowerCase();return g.filter(t=>t.title?.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.tags?.some(t=>t.toLowerCase().includes(e)))},[g,n]),P=(0,Q.useMemo)(()=>{if(!n.trim())return v;let e=n.toLowerCase();return v.filter(t=>t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.category.toLowerCase().includes(e))},[v,n]),F=(0,Q.useMemo)(()=>{let e={};for(let t of m)e[t.id]=N.filter(e=>e.category===t.id);return e},[m,N]);return h||_||y||x?(0,$.jsxs)(`div`,{className:`flex items-center justify-center p-12 gap-3 text-muted-foreground`,children:[(0,$.jsx)(q,{}),(0,$.jsx)(`span`,{className:`text-sm`,children:`Loading workspace skills...`})]}):S?(0,$.jsx)(Ut,{className:`py-12 border border-dashed rounded-xl`,children:(0,$.jsxs)(Bt,{children:[(0,$.jsx)(bt,{children:`Could not load workspace skills config`}),(0,$.jsx)(It,{children:`Unable to read .contextspace/skills.json for this workspace.`})]})}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(Z,{className:`p-5 rounded-xl border border-border/80 bg-card/70 backdrop-blur-md shadow-xs flex flex-col sm:flex-row sm:items-center justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`p-2 rounded-lg bg-primary/10 text-primary`,children:(0,$.jsx)(rt,{className:`h-5 w-5`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-bold text-foreground`,children:`Workspace Skills & Agents`}),(0,$.jsxs)(U,{variant:`secondary`,className:`text-[10px] font-mono`,children:[T.size,` Skills Active`]}),E.size>0&&(0,$.jsxs)(U,{variant:`secondary`,className:`text-[10px] font-mono`,children:[E.size,` Agents Active`]})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:`Choose which reusable Agent Skills and Codex Agents to deploy into this workspace.`})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(l,{size:`sm`,onClick:M,disabled:f||!D&&T.size===0&&E.size===0,className:`flex items-center gap-1.5 shadow-sm`,children:[f?(0,$.jsx)(q,{className:`size-3.5`}):(0,$.jsx)(Et,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:f?`Deploying…`:D?`Save & Deploy Changes`:`Re-Deploy to Workspace`})]}),(0,$.jsxs)(l,{render:(0,$.jsx)(Me,{to:`/skills`}),variant:`outline`,size:`sm`,className:`flex items-center gap-1.5`,children:[(0,$.jsx)(Ue,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`Resource Library`})]})]})]}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Ft,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,$.jsx)(V,{value:n,onChange:e=>r(e.target.value),placeholder:`Filter skills & agents by keyword...`,className:`pl-9 pr-8 h-8 text-xs bg-card`}),n&&(0,$.jsx)(`button`,{onClick:()=>r(``),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(je,{className:`h-3.5 w-3.5`})})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[m.map(e=>{let t=hr[e.icon||`boxes`]||rt,r=F[e.id]||[];if(n&&r.length===0)return null;let a=!!i[e.id],o=r.length>0&&r.every(e=>T.has(e.id));return(0,$.jsxs)(`div`,{className:`border border-border rounded-xl overflow-hidden bg-card/60 transition-colors`,children:[(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":!a,onClick:()=>O(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),O(e.id))},className:`p-3 flex items-center justify-between cursor-pointer hover:bg-muted/40 transition-colors select-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`div`,{className:`p-1.5 rounded-md text-white shadow-xs flex items-center justify-center`,style:{backgroundColor:e.color||`#3b82f6`},children:(0,$.jsx)(t,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h4`,{className:`font-semibold text-xs text-foreground`,children:e.name}),(0,$.jsxs)(U,{variant:`outline`,className:`text-[9px] px-1 py-0`,children:[r.filter(e=>T.has(e.id)).length,`/`,r.length,` active`]})]})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,onClick:e=>e.stopPropagation(),children:[r.length>0&&(0,$.jsxs)(l,{variant:`ghost`,size:`xs`,onClick:()=>j(e.id,!o,r),className:`h-6 text-[11px] px-2 text-muted-foreground hover:text-foreground`,children:[o?(0,$.jsx)(xe,{className:`h-3 w-3 mr-1 text-primary`}):(0,$.jsx)(Kt,{className:`h-3 w-3 mr-1`}),(0,$.jsx)(`span`,{children:o?`Deselect All`:`Select All`})]}),(0,$.jsx)(`div`,{className:`p-0.5 text-muted-foreground`,children:a?(0,$.jsx)(me,{className:`h-4 w-4`}):(0,$.jsx)(fe,{className:`h-4 w-4`})})]})]}),!a&&(0,$.jsx)(`div`,{className:`p-3 border-t border-border/40 bg-background/50`,children:r.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground py-2 text-center`,children:`No skills in this category.`}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2.5`,children:r.map(e=>{let t=T.has(e.id);return(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>k(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),k(e.id))},className:s(`p-3 rounded-lg border text-left cursor-pointer transition-all flex flex-col justify-between select-none shadow-2xs`,t?`border-primary/60 bg-primary/5 text-foreground`:`border-border bg-card/70 text-muted-foreground hover:border-foreground/20 hover:text-foreground`),children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:s(`grid size-4 shrink-0 place-items-center rounded border transition-colors`,t?`border-primary bg-primary text-primary-foreground`:`border-muted-foreground/40 bg-transparent`),children:t&&(0,$.jsx)(W,{className:`size-3 stroke-[3]`})}),(0,$.jsx)(`span`,{className:`font-mono text-xs font-semibold truncate`,children:e.title||e.name})]}),(0,$.jsx)(U,{variant:`outline`,className:`text-[9px] px-1 py-0 shrink-0`,children:e.custom?`Custom`:`Template`})]}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground line-clamp-2 leading-relaxed pl-6`,children:e.description||`No description provided.`}),e.tags&&e.tags.length>0&&(0,$.jsx)(`div`,{className:`mt-2 pl-6 flex items-center gap-1 flex-wrap`,children:e.tags.slice(0,3).map(e=>(0,$.jsxs)(`span`,{className:`text-[9px] font-mono text-muted-foreground bg-muted/60 px-1 py-0.2 rounded`,children:[`#`,e]},e))})]},e.id)})})})]},e.id)}),P.length>0&&(0,$.jsxs)(`div`,{className:`border border-border rounded-xl overflow-hidden bg-card/60 transition-colors`,children:[(0,$.jsx)(`div`,{className:`p-3 flex items-center justify-between border-b border-border/40 select-none`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`div`,{className:`p-1.5 rounded-md bg-purple-600 text-white shadow-xs flex items-center justify-center`,children:(0,$.jsx)(Mt,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`div`,{children:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`h4`,{className:`font-semibold text-xs text-foreground`,children:`Codex Native Agents`}),(0,$.jsxs)(U,{variant:`outline`,className:`text-[9px] px-1 py-0`,children:[P.filter(e=>E.has(e.id)).length,`/`,P.length,` active`]})]})})]})}),(0,$.jsx)(`div`,{className:`p-3 bg-background/50`,children:(0,$.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2.5`,children:P.map(e=>{let t=E.has(e.id);return(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>A(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),A(e.id))},className:s(`p-3 rounded-lg border text-left cursor-pointer transition-all flex flex-col justify-between select-none shadow-2xs`,t?`border-purple-500/60 bg-purple-500/5 text-foreground`:`border-border bg-card/70 text-muted-foreground hover:border-foreground/20 hover:text-foreground`),children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:s(`grid size-4 shrink-0 place-items-center rounded border transition-colors`,t?`border-purple-600 bg-purple-600 text-white`:`border-muted-foreground/40 bg-transparent`),children:t&&(0,$.jsx)(W,{className:`size-3 stroke-[3]`})}),(0,$.jsx)(`span`,{className:`font-mono text-xs font-semibold truncate`,children:e.name})]}),(0,$.jsx)(U,{variant:`secondary`,className:`text-[9px] px-1 py-0 shrink-0`,children:`.codex/agents`})]}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground line-clamp-2 leading-relaxed pl-6`,children:e.description||`No description provided.`})]},e.id)})})})]})]}),(0,$.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`Saving & deploying will write to `,(0,$.jsxs)(`code`,{className:`font-mono text-xs text-foreground`,children:[Le,`/skills.json`]}),` and materialize files into `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.agents/skills/`}),`, `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.claude/skills/`}),`, `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.codex/skills/`}),`, `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.github/skills/`}),`, `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.cursor/skills/`}),`, and `,(0,$.jsx)(`code`,{className:`font-mono text-xs text-foreground`,children:`.codex/agents/`}),`.`]})]})}function _r(e){return e?/\b(fail|failed|failing|error|errors|unverified|not verified|rejected|timeout|timed out)\b/i.test(e):!1}function vr(e){if(e.confirmedBy&&String(e.confirmedBy).trim().length>0)return!0;let t=(e.author??``).trim().toLowerCase();if(t===`human`||t===`user`)return!0;if(t===`agent`)return!1;let n=(e.harness??``).trim().toLowerCase();return n===`human`||n===`developer`||n===`user`}function yr(e){let t=`${e.message??``} ${e.content??``}`,n=e.evidence??``;if(_r(t)||_r(n)||e.status===`failed`||e.status===`rejected`||e.stepProposal?.status===`failed`||e.stepProposal?.status===`rejected`||e.syncError)return`failed`;if(e.status===`in_progress`||e.stepProposal?.status===`in_progress`)return`in_progress`;let r=e.stepProposal?.evidence&&String(e.stepProposal.evidence).trim().length>0;if(!(n.trim()||r))return`proposed`;if(e.stepProposal){if(e.stepProposal.status===`completion_proposed`||e.stepProposal.status===`pending`)return`proposed`;if(e.stepProposal.status===`completed`)return`completed`}return vr(e)&&(e.status===`completed`||e.status===`verified`||e.confirmedBy)?`completed`:`proposed`}function br(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`,month:`short`,day:`numeric`}).format(t)}function xr({harness:e,author:t}){let n=(e||t||``).toLowerCase();return n.includes(`claude`)?(0,$.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg border border-[#D97757]/40 bg-[#D97757]/15 text-[#D97757] shadow-2xs`,children:(0,$.jsx)(gt,{size:15})}):n.includes(`codex`)||n.includes(`openai`)?(0,$.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg border border-emerald-500/40 bg-emerald-500/15 text-emerald-400 shadow-2xs`,children:(0,$.jsx)(kt,{size:14})}):n.includes(`copilot`)?(0,$.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg border border-blue-500/40 bg-blue-500/15 text-blue-400 shadow-2xs`,children:(0,$.jsx)(vt,{size:14})}):n.includes(`antigravity`)||n.includes(`agy`)?(0,$.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg border border-primary/40 bg-primary/15 text-primary shadow-2xs`,children:(0,$.jsx)(Xe,{className:`size-4`})}):n.includes(`dev`)||n.includes(`human`)||n.includes(`user`)?(0,$.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg border border-border bg-card text-foreground shadow-2xs`,children:(0,$.jsx)(Sn,{size:15})}):(0,$.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg border border-border bg-muted text-muted-foreground shadow-2xs`,children:(0,$.jsx)(et,{size:15})})}function Sr({harness:e,author:t}){let n=(e||t||``).toLowerCase();return n.includes(`claude`)?(0,$.jsx)(U,{variant:`outline`,className:`border-[#D97757]/50 text-[#D97757] bg-[#D97757]/10 font-mono text-[10px]`,children:`Claude Code`}):n.includes(`codex`)||n.includes(`openai`)?(0,$.jsx)(U,{variant:`outline`,className:`border-emerald-500/50 text-emerald-400 bg-emerald-500/10 font-mono text-[10px]`,children:`OpenAI Codex`}):n.includes(`copilot`)?(0,$.jsx)(U,{variant:`outline`,className:`border-blue-500/50 text-blue-400 bg-blue-500/10 font-mono text-[10px]`,children:`GitHub Copilot`}):n.includes(`antigravity`)||n.includes(`agy`)?(0,$.jsx)(U,{variant:`outline`,className:`border-primary/50 text-primary bg-primary/10 font-mono text-[10px]`,children:`Antigravity`}):n.includes(`dev`)||n.includes(`human`)||n.includes(`user`)?(0,$.jsx)(U,{variant:`secondary`,className:`font-mono text-[10px]`,children:`Developer`}):(0,$.jsx)(U,{variant:`outline`,className:`font-mono text-[10px]`,children:e||`Assistant`})}function Cr({ws:e,showToast:t}){let{data:n,isLoading:r,refetch:i,isFetching:a}=xt(e.branchName,{refetchInterval:3e3}),o=Ve(e.branchName),[s,c]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(`developer`),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(`proposed`),[v,y]=(0,Q.useState)(!1),b=(0,Q.useMemo)(()=>n?.messages??[],[n?.messages]),x=(0,Q.useMemo)(()=>new Map(n?.workflowProgress?.steps?.map(e=>[e.stepId,e])??[]),[n?.workflowProgress?.steps]),S=(0,Q.useMemo)(()=>{let e=new Map;for(let t of b)if(t.stepId){let n=x.get(t.stepId)??t.stepProposal,r=yr({status:t.status,author:t.author,harness:t.harness,confirmedBy:t.confirmedBy,confirmedAt:t.confirmedAt,stepProposal:n,syncError:t.syncError,message:t.message,content:t.content,evidence:n?.evidence||t.evidence});e.set(t.stepId,{stepId:t.stepId,status:r,lastMessage:t.message||t.content||``,harness:t.harness||`unknown`})}return Array.from(e.values())},[b,x]),C=async e=>{e&&e.preventDefault();let n=s.trim();if(!(!n||o.isPending))try{let e=u===`developer`;await o.mutateAsync({message:n,harness:u,author:e?`human`:`agent`,...f.trim()?{stepId:f.trim(),status:g}:{},...m.trim()?{evidence:m.trim()}:{}}),c(``),h(``),p(``),_(`proposed`),t?.(`Handoff update posted to workspace stream.`,`success`)}catch(e){t?.(`Failed to post update: ${e instanceof Error?e.message:String(e)}`,`error`)}};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 animate-fade-in pb-12`,"data-testid":`workspace-workroom-tab`,children:[(0,$.jsxs)(Z,{className:`p-4 bg-card/60 surface-card border-border/80`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`grid size-7 place-items-center rounded-md bg-primary/10 text-primary border border-primary/20`,children:(0,$.jsx)(vn,{size:14,className:`animate-pulse`})}),(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-foreground tracking-tight`,children:`Workspace Workroom`}),(0,$.jsxs)(U,{variant:`success`,className:`gap-1`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`}),`Live updates`]}),n?.isRemoteActive&&n.remoteStatus&&(0,$.jsxs)(U,{variant:`info`,className:`gap-1`,children:[(0,$.jsx)(De,{size:11}),`LAN Room Active (`,n.remoteStatus.roomId.slice(0,8),`)`]})]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Share updates and handoffs with the people and assistants working in this workspace.`})]}),(0,$.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:(0,$.jsxs)(l,{variant:`outline`,size:`xs`,onClick:()=>void i(),disabled:a,className:`gap-1.5 text-xs`,children:[(0,$.jsx)(J,{size:12,className:a?`animate-spin`:``}),(0,$.jsx)(`span`,{children:`Refresh`})]})})]}),S.length>0&&(0,$.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-border/60`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,$.jsx)(gn,{size:13,className:`text-primary`}),(0,$.jsxs)(`span`,{className:`text-[11px] font-semibold text-muted-foreground uppercase tracking-wider`,children:[`Tracked Milestones (`,S.length,`)`]})]}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:S.map(e=>{let t=e.status===`completed`,n=e.status===`failed`||e.status===`rejected`,r=e.status===`proposed`;return(0,$.jsxs)(`div`,{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md border text-xs font-mono ${t?`border-emerald-500/30 bg-emerald-500/10 text-emerald-400`:n?`border-destructive/40 bg-destructive/10 text-destructive`:r?`border-amber-500/30 bg-amber-500/10 text-amber-400`:`border-blue-500/30 bg-blue-500/10 text-blue-400`}`,title:`${e.stepId} · ${e.status}: ${e.lastMessage}`,children:[t?(0,$.jsx)(cn,{size:12,className:`text-emerald-400`}):n?(0,$.jsx)(K,{size:12,className:`text-destructive`}):r?(0,$.jsx)(ln,{size:12,className:`text-amber-400`}):(0,$.jsx)(vn,{size:12,className:`text-blue-400`}),(0,$.jsx)(`span`,{className:`font-semibold`,children:e.stepId}),(0,$.jsxs)(`span`,{className:`text-[10px] opacity-80 capitalize`,children:[`(`,t?`Completed`:r?`Review Requested`:n?`Failed`:`In Progress`,`)`]})]},e.stepId)})})]})]}),(0,$.jsxs)(Z,{className:`divide-y divide-border/60 overflow-hidden surface-card border-border/80`,children:[(0,$.jsxs)(`div`,{className:`p-3.5 bg-muted/20 flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Ce,{size:14,className:`text-muted-foreground`}),(0,$.jsxs)(`h4`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[`Timeline Activity (`,b.length,`)`]})]}),(0,$.jsxs)(`span`,{className:`text-[11px] font-mono text-muted-foreground`,children:[`Isolated to `,e.branchName]})]}),r?(0,$.jsxs)(`div`,{className:`flex items-center justify-center p-12 text-muted-foreground`,children:[(0,$.jsx)(q,{className:`size-5 mr-2`}),(0,$.jsx)(`span`,{className:`text-xs`,children:`Loading workroom stream…`})]}):b.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-12 text-center text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`grid size-10 place-items-center rounded-full bg-muted/50 text-muted-foreground mb-3`,children:(0,$.jsx)(vn,{size:20})}),(0,$.jsx)(`p`,{className:`text-xs font-semibold text-foreground`,children:`No handoff events recorded yet`}),(0,$.jsxs)(`p`,{className:`text-[11px] text-muted-foreground max-w-sm mt-1`,children:[`AI assistants using the `,(0,$.jsx)(`code`,{className:`font-mono text-[10px]`,children:`post_workroom_handoff`}),` tool will post updates here automatically. You can also write an update below.`]})]}):(0,$.jsx)(`div`,{className:`divide-y divide-border/40 max-h-[38rem] overflow-y-auto`,children:b.map((e,t)=>{let n=e.message||e.content||``,r=e.author||e.harness||`Assistant`,i=(e.stepId?x.get(e.stepId):void 0)??e.stepProposal,a=yr({...e,stepProposal:i}),o=i?.evidence||e.evidence,s=_r(o);return(0,$.jsx)(`div`,{className:`p-4 transition-colors hover:bg-muted/10`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(xr,{harness:e.harness,author:e.author}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-1.5`,children:[(0,$.jsx)(`span`,{className:`text-xs font-semibold text-foreground`,children:r}),(0,$.jsx)(Sr,{harness:e.harness,author:e.author}),e.stepId&&(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded border font-mono text-[10px] ${a===`completed`?`border-emerald-500/30 bg-emerald-500/10 text-emerald-400`:a===`failed`?`border-destructive/40 bg-destructive/10 text-destructive`:`border-amber-500/30 bg-amber-500/10 text-amber-400`}`,children:[(0,$.jsx)(gn,{size:10}),e.stepId,` (`,a===`completed`?`completed`:a===`failed`?`failed`:`proposal`,`)`]}),(0,$.jsx)(`time`,{className:`text-[10px] font-mono text-muted-foreground ml-auto`,children:br(e.timestamp)})]}),(0,$.jsx)(`div`,{className:`text-xs text-foreground/90 leading-relaxed break-words`,children:(0,$.jsx)(Zt,{content:n})}),o&&(s||a===`failed`?(0,$.jsxs)(`div`,{className:`mt-2.5 p-2.5 rounded-md border border-destructive/40 bg-destructive/10`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold text-destructive mb-1`,children:[(0,$.jsx)(K,{size:13}),(0,$.jsx)(`span`,{children:`Test Failure / Negative Evidence`})]}),(0,$.jsx)(`pre`,{className:`font-mono text-[11px] text-destructive whitespace-pre-wrap break-all`,children:o})]}):a===`completed`?(0,$.jsxs)(`div`,{className:`mt-2.5 p-2.5 rounded-md border border-emerald-500/30 bg-emerald-500/5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold text-emerald-400 mb-1`,children:[(0,$.jsx)(he,{size:13}),(0,$.jsx)(`span`,{children:`Verified Evidence (Confirmed)`})]}),(0,$.jsx)(`pre`,{className:`font-mono text-[11px] text-emerald-300/90 whitespace-pre-wrap break-all`,children:o})]}):(0,$.jsxs)(`div`,{className:`mt-2.5 p-2.5 rounded-md border border-amber-500/30 bg-amber-500/5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold text-amber-400 mb-1`,children:[(0,$.jsx)(ln,{size:13}),(0,$.jsx)(`span`,{children:`Proposal Evidence (Review Requested)`})]}),(0,$.jsx)(`pre`,{className:`font-mono text-[11px] text-amber-300/90 whitespace-pre-wrap break-all`,children:o})]})),Array.isArray(e.artifacts)&&e.artifacts.length>0&&(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.artifacts.map((e,t)=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded bg-muted/60 border border-border/80 text-[11px] font-mono text-muted-foreground`,title:e.summary||e.path,children:[(0,$.jsx)(ct,{size:11,className:`text-primary`}),(0,$.jsx)(`span`,{children:e.title||e.path})]},t))})]})]})},e.id||t)})}),(0,$.jsx)(`form`,{onSubmit:C,className:`p-4 bg-muted/20 border-t border-border/80`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Post as:`}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 bg-card rounded-md border border-border/80 p-0.5 text-xs`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>d(`developer`),className:`px-2 py-0.5 rounded text-[11px] font-medium transition-colors ${u===`developer`?`bg-primary text-primary-foreground font-semibold shadow-xs`:`text-muted-foreground hover:text-foreground`}`,children:`Developer`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>d(`antigravity`),className:`px-2 py-0.5 rounded text-[11px] font-medium transition-colors ${u===`antigravity`?`bg-primary text-primary-foreground font-semibold shadow-xs`:`text-muted-foreground hover:text-foreground`}`,children:`Antigravity`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>d(`claude`),className:`px-2 py-0.5 rounded text-[11px] font-medium transition-colors ${u===`claude`?`bg-[#D97757] text-white font-semibold shadow-xs`:`text-muted-foreground hover:text-foreground`}`,children:`Claude`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>d(`codex`),className:`px-2 py-0.5 rounded text-[11px] font-medium transition-colors ${u===`codex`?`bg-emerald-600 text-white font-semibold shadow-xs`:`text-muted-foreground hover:text-foreground`}`,children:`Codex`})]})]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>y(e=>!e),className:`text-[11px] text-muted-foreground hover:text-foreground underline underline-offset-2 transition-colors cursor-pointer`,children:v?`Hide Milestone Fields`:`+ Milestone & Evidence`})]}),v&&(0,$.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-2 p-2.5 rounded-md border border-border/70 bg-card/50 text-xs`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{htmlFor:`handoff-step`,className:`text-[10px] font-mono text-muted-foreground uppercase`,children:`Milestone ID`}),(0,$.jsx)(V,{id:`handoff-step`,placeholder:`e.g. step-1-api-routes`,value:f,onChange:e=>p(e.target.value),className:`h-7 text-xs font-mono mt-1`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{htmlFor:`handoff-status`,className:`text-[10px] font-mono text-muted-foreground uppercase`,children:`Milestone Status`}),(0,$.jsxs)(`select`,{id:`handoff-status`,value:g,onChange:e=>_(e.target.value),className:`h-7 w-full text-xs font-mono mt-1 rounded-md border border-border bg-card px-2 text-foreground`,children:[(0,$.jsx)(`option`,{value:`proposed`,children:`Proposed (Review Requested)`}),(0,$.jsx)(`option`,{value:`completed`,children:`Completed (Confirmed)`}),(0,$.jsx)(`option`,{value:`in_progress`,children:`In Progress`}),(0,$.jsx)(`option`,{value:`failed`,children:`Failed / Blocker`})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{htmlFor:`handoff-evidence`,className:`text-[10px] font-mono text-muted-foreground uppercase`,children:`Evidence / Test Output`}),(0,$.jsx)(V,{id:`handoff-evidence`,placeholder:`e.g. 12/12 unit tests passing`,value:m,onChange:e=>h(e.target.value),className:`h-7 text-xs font-mono mt-1`})]})]}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Lt,{"aria-label":`Handoff message`,placeholder:`Share a decision, result, blocker, or next step…`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),C())},className:`min-h-[4.5rem] text-xs leading-relaxed resize-y pr-24 bg-card`}),(0,$.jsx)(`div`,{className:`absolute right-2 bottom-2`,children:(0,$.jsxs)(l,{type:`submit`,size:`sm`,disabled:!s.trim()||o.isPending,className:`gap-1.5 text-xs font-medium`,children:[o.isPending?(0,$.jsx)(q,{className:`size-3`}):(0,$.jsx)(zt,{size:12}),(0,$.jsx)(`span`,{children:`Post`})]})})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] text-muted-foreground px-1`,children:[(0,$.jsxs)(`span`,{children:[`Press `,(0,$.jsx)(`kbd`,{className:`px-1 py-0.5 rounded border border-border bg-muted text-[9px] font-mono`,children:`Ctrl`}),` + `,(0,$.jsx)(`kbd`,{className:`px-1 py-0.5 rounded border border-border bg-muted text-[9px] font-mono`,children:`Enter`}),` to send`]}),(0,$.jsx)(`span`,{children:`Saved in this workspace`})]})]})})]})]})}function wr({ws:e}){let t=e.branchName,n=Vt(t),r=ht(t),i=$t(t),a=n.data,o=(0,Q.useMemo)(()=>a?.services??[],[a]),c=(0,Q.useMemo)(()=>a?.runningState??[],[a]),u=a?.orchestrationTools??[],d=(0,Q.useMemo)(()=>a?.runningOrchestrators??[],[a]),f=(0,Q.useMemo)(()=>d.filter(e=>e.mode===`pm2`&&e.logName),[d]),[p,m]=(0,Q.useState)(`classic`),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e=[...o.map(e=>e.name),...f.map(e=>e.logName)];e.length===0?_!==null&&v(null):(!_||!e.includes(_))&&v(e[0])},[o,f]);let{logs:y,connected:b,clear:x}=ut(t,_,!0),S=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{S.current?.scrollIntoView({behavior:`smooth`})},[y]);let C=(0,Q.useMemo)(()=>new Set(c.filter(e=>e.pid>0).map(e=>e.name)),[c]),w=(0,Q.useMemo)(()=>new Set(d.map(e=>e.id)),[d]),T=C.size>0,E=p===`matrix`?`term-matrix`:p===`dracula`?`term-dracula`:`term-classic`,D=r.isPending||i.isPending;return(0,$.jsxs)(`div`,{className:`animate-fade-in`,children:[n.isLoading&&(0,$.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-[10px] text-primary`,children:[(0,$.jsx)(q,{className:`size-3`}),(0,$.jsx)(`span`,{className:`font-semibold tracking-wider uppercase`,children:`Scanning service configurations...`})]}),n.isError&&(0,$.jsxs)(`div`,{className:`mb-4 flex items-center justify-between rounded-md border border-destructive/30 bg-destructive/10 p-3 text-xs text-destructive`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(K,{size:14}),(0,$.jsxs)(`span`,{children:[`Failed to load services: `,n.error?.message||`Unknown error`]})]}),(0,$.jsx)(l,{size:`xs`,variant:`outline`,onClick:()=>n.refetch(),children:`Retry`})]}),(r.isError||i.isError)&&(0,$.jsxs)(`div`,{className:`mb-4 flex items-center justify-between rounded-md border border-destructive/30 bg-destructive/10 p-3 text-xs text-destructive`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(K,{size:14}),(0,$.jsxs)(`span`,{children:[`Action failed: `,r.error?.message||i.error?.message||`Operation failed`]})]}),(0,$.jsx)(l,{size:`xs`,variant:`ghost`,onClick:()=>{r.reset(),i.reset()},children:`Dismiss`})]}),!n.isLoading&&!n.isError&&o.length===0&&u.length===0&&(0,$.jsxs)(`div`,{className:`rounded-md border border-border/80 bg-card p-6 text-center surface-card`,children:[(0,$.jsx)(Y,{size:24,className:`mx-auto mb-2 text-muted-foreground/60`}),(0,$.jsx)(`h4`,{className:`text-xs font-bold text-foreground`,children:`No Services Detected`}),(0,$.jsxs)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:[`ContextSpace scans for runnable background services in `,(0,$.jsx)(`code`,{className:`font-mono text-[10px]`,children:`package.json`}),` scripts (such as `,(0,$.jsx)(`code`,{className:`font-mono text-[10px]`,children:`start`}),`, `,(0,$.jsx)(`code`,{className:`font-mono text-[10px]`,children:`dev`}),`), `,(0,$.jsx)(`code`,{className:`font-mono text-[10px]`,children:`docker-compose.yml`}),`, or `,(0,$.jsx)(`code`,{className:`font-mono text-[10px]`,children:`Procfile`}),`.`]})]}),u.length>0&&(0,$.jsxs)(`div`,{className:`mb-4 rounded-md border border-border/80 bg-card p-4 surface-card`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(K,{size:12,className:`text-info`}),` Orchestration tools`]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:u.map(e=>{let t=w.has(e.id);return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border/60 bg-muted/20 p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 rounded-full ${t?`bg-success`:`bg-muted-foreground/40`}`}),(0,$.jsx)(`span`,{className:`text-xs font-bold text-foreground`,children:e.tool}),(0,$.jsx)(Gt,{tone:`idle`,dot:!1,children:e.mode})]}),(0,$.jsx)(`code`,{className:`mt-1 block truncate font-mono text-[9px] text-muted-foreground`,children:e.configPath})]}),(0,$.jsx)(`div`,{className:`shrink-0`,children:t?(0,$.jsxs)(l,{size:`xs`,variant:`destructive`,"aria-label":`Stop ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`stop`,id:e.id}),children:[(0,$.jsx)(Kt,{size:12}),` Stop`]}):(0,$.jsxs)(l,{size:`xs`,"aria-label":`Start ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`start`,id:e.id}),children:[(0,$.jsx)(yt,{size:12}),` Start`]})})]},e.id)})})]}),(0,$.jsxs)(`div`,{className:`mb-4 rounded-md border border-border/80 bg-card p-4 surface-card`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between text-xs font-semibold text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Workspace Status`}),(0,$.jsx)(Gt,{tone:T?`running`:`idle`,children:T?`Active`:`Standby`})]}),(0,$.jsx)(`div`,{className:`mb-3 text-xs font-semibold text-foreground`,children:T?`${C.size} process${C.size===1?``:`es`} active`:`All processes offline`}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(l,{size:`sm`,disabled:T||D,onClick:()=>r.mutate({action:`start`}),children:[(0,$.jsx)(yt,{size:13}),` Start All Services`]}),(0,$.jsxs)(l,{size:`sm`,variant:`destructive`,disabled:!T||D,onClick:()=>r.mutate({action:`stop`}),children:[(0,$.jsx)(Kt,{size:13}),` Stop All`]})]})]}),(o.length>0||f.length>0)&&(0,$.jsxs)(`div`,{className:`grid grid-cols-1 overflow-hidden rounded-md border border-border/80 bg-card shadow-xs lg:grid-cols-12 surface-card`,children:[(0,$.jsxs)(`div`,{className:`border-b border-border/80 bg-muted/20 p-4 lg:col-span-4 lg:border-b-0 lg:border-r`,children:[(0,$.jsxs)(`h4`,{className:`mb-4 flex items-center gap-1.5 border-b border-border pb-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(Y,{size:12,className:`text-primary`}),` Background Services`]}),(0,$.jsxs)(`div`,{className:`flex max-h-[400px] flex-col gap-2 overflow-y-auto pr-1`,children:[o.map(e=>{let t=_===e.name,n=C.has(e.name);return(0,$.jsxs)(`div`,{className:s(`flex cursor-pointer flex-col rounded-xl border p-3 transition-colors`,t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>v(e.name),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${n?`bg-success`:`bg-destructive`}`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.name})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,onClick:e=>e.stopPropagation(),children:n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{size:`icon-xs`,variant:`ghost`,"aria-label":`Restart ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`restart`,service:e.name}),children:(0,$.jsx)(yn,{})}),(0,$.jsx)(l,{size:`icon-xs`,variant:`ghost`,"aria-label":`Stop ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`stop`,service:e.name}),children:(0,$.jsx)(Kt,{})})]}):(0,$.jsx)(l,{size:`icon-xs`,variant:`ghost`,"aria-label":`Start ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`start`,service:e.name}),children:(0,$.jsx)(yt,{})})})]}),e.port?(0,$.jsxs)(`span`,{className:`mt-2 w-fit rounded border border-border bg-background px-2 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`Port: `,e.port]}):null,(0,$.jsxs)(`code`,{className:`mt-2 block truncate rounded border border-border bg-muted/40 p-1.5 font-mono text-[9px] text-muted-foreground`,children:[e.command,` `,e.args.join(` `)]})]},e.name)}),f.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`mt-2 border-t border-border pt-3 text-[9px] font-bold uppercase tracking-wider text-muted-foreground`,children:`Orchestrators`}),f.map(e=>{let t=e.logName;return(0,$.jsxs)(`div`,{className:s(`flex cursor-pointer items-center gap-2 rounded-xl border p-3 transition-colors`,_===t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>v(t),children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-success`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.tool}),(0,$.jsx)(Gt,{tone:`idle`,dot:!1,children:e.mode})]},e.id)})]})]})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col bg-background lg:col-span-8`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border bg-muted/40 px-5 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-xs font-bold text-primary`,children:_||`no-service`}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`|`}),(0,$.jsx)(Gt,{tone:b?`running`:`idle`,children:b?`streaming`:`idle`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 self-end sm:self-auto`,children:[(0,$.jsx)(`div`,{className:`flex rounded-lg border border-border bg-card p-0.5 text-[9px] font-semibold text-muted-foreground`,children:[`classic`,`matrix`,`dracula`].map(e=>(0,$.jsx)(`button`,{className:s(`cursor-pointer rounded-md px-2 py-1 capitalize transition-colors`,p===e?`bg-primary/10 font-bold text-primary`:`hover:text-foreground`),onClick:()=>m(e),children:e},e))}),(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(`button`,{onClick:x,className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:`Clear Console`,children:(0,$.jsx)(Ae,{size:13})}),(0,$.jsx)(`button`,{onClick:()=>g(!h),className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:h?`Minimize Console`:`Expand Console`,children:h?(0,$.jsx)(qt,{size:13}):(0,$.jsx)(St,{size:13})})]})]})]}),(0,$.jsxs)(`div`,{className:s(`relative overflow-y-auto whitespace-pre-wrap p-5 font-mono text-[10.5px] leading-relaxed selection:bg-primary/20`,E,h?`h-[520px]`:`h-80`),children:[y.trim()?y:(0,$.jsx)(`span`,{className:`font-mono italic text-muted-foreground`,children:`(no log content yet)`}),(0,$.jsx)(`div`,{ref:S})]})]})]})]})}var Tr=(e,t)=>{let n=`${e} ${t}`.toLowerCase();return n.includes(`insiders`)?(0,$.jsx)(tn,{size:15,className:`text-[#24C05A] shrink-0`}):n.includes(`code`)||n.includes(`vscode`)?(0,$.jsx)(nn,{size:15,className:`text-[#007ACC] shrink-0`}):n.includes(`antigravity`)?(0,$.jsx)(Xe,{className:`size-3.5 shrink-0`}):n.includes(`cursor`)?(0,$.jsx)(Et,{size:14,className:`text-purple-400 shrink-0`}):n.includes(`powershell`)||n.includes(`pwsh`)?(0,$.jsx)(Y,{size:14,className:`text-sky-400 shrink-0`}):n.includes(`cmd`)||n.includes(`command prompt`)?(0,$.jsx)(Y,{size:14,className:`text-amber-400 shrink-0`}):(0,$.jsx)(ge,{size:14,className:`shrink-0`})},Er=[{value:`overview`,label:`Overview`,icon:pn},{value:`workroom`,label:`Workroom`,icon:vn},{value:`changes`,label:`Changes`,icon:fn},{value:`services`,label:`Services`,icon:Rt},{value:`sessions`,label:`AI & Sessions`,icon:Mt},{value:`knowledge`,label:`Knowledge`,icon:rn},{value:`plan`,label:`Plan`,icon:hn},{value:`skills`,label:`Skills`,icon:_n}];function Dr(e){let{workspaces:t,workspaceStatuses:n,selectedId:r,subTab:i,onSelectTab:a,handleCopyPrompt:o,handleDeleteWorkspace:c,deleteWsLoading:u,repos:d,addRepoLoading:f,handleAddRepo:p,showToast:m,sessionProps:h,changesProps:g,knowledgeProps:_,planProps:v}=e,y=t.find(e=>e.branchName===r)??null,b=y?.mode??`worktree`,{open:x}=Pt(),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{if(!y?.branchName){C(!1);return}let e=!0;return fetch(`/api/workspace/${encodeURIComponent(y.branchName)}/migration-status`).then(e=>e.ok?e.json():{isLegacy:!1}).then(t=>{e&&C(!!t?.isLegacy)}).catch(()=>{e&&C(!1)}),()=>{e=!1}},[y?.branchName]);let E=async()=>{if(!(!y?.branchName||w)){T(!0);try{if(!(await fetch(`/api/workspace/${encodeURIComponent(y.branchName)}/migrate`,{method:`POST`})).ok)throw Error(`Migration failed`);m?.(`Workspace successfully upgraded to native ${Re}!`,`success`),C(!1),e.fetchWorkspaces?.()}catch(e){m?.(e.message||`Failed to migrate workspace`,`error`)}finally{T(!1)}}},D=At(y?.branchName??null).data,{data:O=[],isLoading:k}=at(y?.branchName),A=O.filter(e=>D?.enabledSkills?.includes(e.id)),j=y?y.repos.map(e=>{let t=wt(e),n=g.gitChanges?.find(e=>e.repoName===t);return{name:t,path:e,changedCount:n?n.files?.length??0:null}}):[],M=y?d.filter(e=>!y.repos.includes(e.path)):[],N=Wt(),[P,F]=(0,Q.useState)(null),I=N.data?.filter(e=>e.kind===`editor`&&e.available)??[],L=I.find(e=>e.id===`vscode-insiders`)||I.find(e=>e.id===`vscode`)||I[0],R=async e=>{if(!(P||!y)){F(e);try{await Tt(`/api/workspace/${encodeURIComponent(y.branchName)}/launch`,{method:`POST`,body:JSON.stringify({targetId:e})}),m?.(`Opened workspace in ${e}.`,`success`)}catch(t){m?.(`Failed to open ${e}: ${t instanceof Error?t.message:String(t)}`,`error`)}finally{F(null)}}};return(0,$.jsx)(`div`,{className:`flex flex-col h-full animate-fade-in w-full min-w-0 bg-transparent`,children:y?(0,$.jsx)(`div`,{className:`flex-1 min-w-0 h-full overflow-y-auto`,children:(0,$.jsx)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col`,children:(()=>{if(!y)return null;let e=n[y.branchName],t=b===`in-place`?null:e?Nt(e.syncStatus):null,r=e?.changedFiles??0;return(0,$.jsxs)(`div`,{className:`flex flex-col min-w-0 pb-12`,children:[(0,$.jsx)(`div`,{className:`border-b border-border/80 bg-card/75 backdrop-blur-md px-6 py-5 shadow-xs`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-center md:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,$.jsx)(`div`,{className:`grid size-7 place-items-center rounded-md bg-primary/15 text-primary border border-primary/25 shrink-0`,children:(0,$.jsx)(Se,{size:15})}),(0,$.jsx)(`h1`,{className:`truncate font-mono text-base sm:text-lg font-extrabold text-foreground tracking-tight`,title:y.branchName,children:y.branchName}),(0,$.jsx)(`button`,{type:`button`,onClick:async()=>{await Ht(y.branchName)&&m?.(`Copied branch name to clipboard.`,`success`)},className:`text-muted-foreground hover:text-primary transition-colors p-1 rounded-md hover:bg-accent cursor-pointer`,title:`Copy branch name`,children:(0,$.jsx)(G,{size:13})}),(0,$.jsx)(`span`,{className:`inline-flex items-center rounded-md border border-primary/20 bg-primary/10 px-2 py-0.5 font-mono text-[10px] font-bold text-primary uppercase tracking-wider`,children:b===`in-place`?`In-Place Mode`:`Worktree Mode`})]}),(0,$.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-3 font-mono text-[11px] text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-foreground/80 font-medium`,children:[(0,$.jsx)(Xt,{size:13,className:`text-muted-foreground`}),y.repos.length,` `,y.repos.length===1?`repo`:`repos`]}),(0,$.jsx)(`span`,{children:`•`}),r>0?(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a(y.branchName,`changes`),className:`flex items-center gap-1.5 text-amber-400 font-semibold hover:underline cursor-pointer`,children:[(0,$.jsx)(`span`,{className:`size-2 rounded-full bg-amber-400 animate-pulse`}),r,` modified files`]}):(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-emerald-400 font-medium`,children:[(0,$.jsx)(`span`,{className:`size-2 rounded-full bg-emerald-400`}),`Clean worktrees`]}),(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`text-muted-foreground/80`,children:[`Created `,new Date(y.createdAt).toLocaleDateString()]}),t&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`•`}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-primary font-medium`,children:[(0,$.jsx)(J,{size:11,className:`animate-spin-slow`}),` `,t.label]})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[L&&(I.length>1?(0,$.jsxs)(`div`,{className:`inline-flex h-9 items-center rounded-lg border border-border bg-card shadow-xs hover:border-primary/40 transition-colors`,children:[(0,$.jsxs)(`button`,{type:`button`,disabled:!!P,onClick:()=>void R(L.id),title:`Open workspace in ${L.name}`,className:`inline-flex h-full items-center gap-2 px-3.5 text-xs font-bold text-foreground hover:bg-accent transition-colors cursor-pointer rounded-l-lg`,children:[P===L.id?(0,$.jsx)(q,{className:`size-3.5`}):Tr(L.id,L.name),(0,$.jsx)(`span`,{children:L.name})]}),(0,$.jsxs)(Ct,{children:[(0,$.jsx)(Yt,{"aria-label":`Choose editor`,className:`inline-flex h-full w-7 items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent border-l border-border transition-colors cursor-pointer rounded-r-lg`,children:(0,$.jsx)(fe,{size:13})}),(0,$.jsxs)(lt,{align:`end`,className:`w-56`,children:[(0,$.jsx)(`div`,{className:`px-2.5 py-1 text-[10px] font-bold text-muted-foreground uppercase tracking-wider`,children:`Open Workspace In`}),I.map(e=>(0,$.jsxs)(X,{onClick:()=>void R(e.id),className:s(`flex items-center justify-between text-xs py-2`,e.id===L.id&&`font-bold text-primary bg-primary/5`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[Tr(e.id,e.name),(0,$.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.id===L.id&&(0,$.jsx)(`span`,{className:`text-[10px] text-primary font-mono font-bold`,children:`(default)`})]},e.id))]})]})]}):(0,$.jsxs)(l,{variant:`outline`,size:`sm`,disabled:!!P,onClick:()=>void R(L.id),title:`Open workspace in ${L.name}`,className:`font-bold h-9 gap-2`,children:[P===L.id?(0,$.jsx)(q,{className:`size-3.5`}):Tr(L.id,L.name),(0,$.jsx)(`span`,{children:L.name})]})),(0,$.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>o(y),"aria-label":`Copy Context`,title:`Copy AI Context prompt for external LLM`,className:`h-9 gap-1.5 text-xs font-semibold`,children:[(0,$.jsx)(G,{size:13}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:`Copy Context`})]}),(0,$.jsxs)(Ct,{children:[(0,$.jsx)(Yt,{"aria-label":`Workspace actions`,className:`grid size-9 place-items-center rounded-lg border border-border bg-card text-muted-foreground hover:text-foreground hover:bg-accent transition-colors cursor-pointer shadow-xs`,children:(0,$.jsx)(dn,{size:15})}),(0,$.jsxs)(lt,{align:`end`,className:`w-52`,children:[(0,$.jsxs)(X,{onClick:()=>o(y),className:`flex items-center gap-2 text-xs py-2`,children:[(0,$.jsx)(G,{size:13}),` `,(0,$.jsx)(`span`,{children:`Copy AI Context`})]}),(0,$.jsxs)(X,{onClick:()=>void c(y.branchName),disabled:u===y.branchName,className:`flex items-center gap-2 text-xs py-2 text-destructive hover:bg-destructive/10`,children:[(0,$.jsx)(Ae,{size:13}),(0,$.jsx)(`span`,{children:u===y.branchName?`Deleting…`:`Delete Workspace`})]})]})]})]})]})}),(0,$.jsxs)(`div`,{className:`px-6 pt-5`,children:[S&&(0,$.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-amber-500/30 bg-gradient-to-r from-amber-500/15 via-orange-500/10 to-transparent p-3 backdrop-blur-md shadow-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 text-xs text-amber-200`,children:[(0,$.jsx)(Et,{size:16,className:`text-amber-400 shrink-0 animate-pulse`}),(0,$.jsxs)(`span`,{children:[(0,$.jsxs)(`strong`,{className:`font-semibold text-amber-300`,children:[`Legacy `,Ie,` Workspace:`]}),` Upgrade to native `,Re,` manifest and synchronized artifacts.`]})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:E,disabled:w,className:`inline-flex items-center gap-1.5 rounded-lg bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-400 hover:to-orange-400 px-3 py-1.5 text-xs font-bold text-white shadow-sm transition-all active:scale-95 disabled:opacity-50 cursor-pointer`,children:[(0,$.jsx)(sn,{size:14,className:w?`animate-spin`:``}),w?`Upgrading...`:`Migrate to ${Re}`]})]}),(0,$.jsxs)(ke,{value:i,onValueChange:e=>typeof e==`string`&&a(y.branchName,e),className:`mb-6`,children:[(0,$.jsx)(Ee,{className:`w-full flex-nowrap overflow-x-auto justify-start gap-1.5 p-1.5 rounded-xl border border-border/70 bg-card/60 backdrop-blur-md shadow-xs`,children:Er.map(e=>{let t=e.icon,n=i===e.value,a=null;return e.value===`changes`&&r>0?a=(0,$.jsx)(`span`,{className:`ml-1.5 inline-flex items-center justify-center rounded-full bg-amber-500/20 px-1.5 py-0.2 text-[10px] font-mono font-bold text-amber-400`,children:r}):e.value===`skills`&&A.length>0&&(a=(0,$.jsx)(`span`,{className:`ml-1.5 inline-flex items-center justify-center rounded-full bg-primary/20 px-1.5 py-0.2 text-[10px] font-mono font-bold text-primary`,children:A.length})),(0,$.jsxs)(Te,{value:e.value,className:s(`flex shrink-0 items-center gap-2 px-3.5 py-2 text-xs font-bold rounded-lg transition-all cursor-pointer`,n?`bg-card text-foreground shadow-xs border border-primary/30 text-primary ring-1 ring-primary/20`:`text-muted-foreground hover:text-foreground hover:bg-accent/70`),children:[(0,$.jsx)(t,{size:14,className:s(`shrink-0`,n?`text-primary`:`text-muted-foreground`)}),(0,$.jsx)(`span`,{children:e.label}),a]},e.value)})}),(0,$.jsxs)(Oe,{value:i,className:`animate-fade-in pt-4`,children:[i===`overview`&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[(0,$.jsxs)(`div`,{onClick:()=>a(y.branchName,`changes`),className:`group p-4 rounded-xl border border-border/80 bg-card/70 hover:bg-card hover:border-primary/40 transition-all cursor-pointer shadow-xs flex flex-col justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`grid size-8 place-items-center rounded-lg bg-primary/10 text-primary border border-primary/20`,children:(0,$.jsx)(fn,{size:15})}),(0,$.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground uppercase tracking-wider`,children:`Git Changes`})]}),(0,$.jsx)(Qe,{size:13,className:`text-muted-foreground group-hover:text-primary transition-transform group-hover:translate-x-1`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-2xl font-black font-mono text-foreground`,children:r>0?(0,$.jsxs)(`span`,{className:`text-amber-400`,children:[r,` Modified`]}):(0,$.jsx)(`span`,{className:`text-emerald-400`,children:`Clean`})}),(0,$.jsxs)(`div`,{className:`text-[11px] text-muted-foreground mt-1`,children:[y.repos.length,` mapped `,y.repos.length===1?`repository`:`repositories`]})]})]}),(0,$.jsxs)(`div`,{onClick:()=>a(y.branchName,`sessions`),className:`group p-4 rounded-xl border border-border/80 bg-card/70 hover:bg-card hover:border-primary/40 transition-all cursor-pointer shadow-xs flex flex-col justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`grid size-8 place-items-center rounded-lg bg-primary/10 text-primary border border-primary/20`,children:(0,$.jsx)(Mt,{size:15})}),(0,$.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground uppercase tracking-wider`,children:`AI Assistant`})]}),(0,$.jsx)(Qe,{size:13,className:`text-muted-foreground group-hover:text-primary transition-transform group-hover:translate-x-1`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xl font-black text-foreground capitalize`,children:y.assistants[0]||`Antigravity`}),(0,$.jsx)(`div`,{className:`text-[11px] text-muted-foreground mt-1`,children:`Context rules & templates ready`})]})]}),(0,$.jsxs)(`div`,{onClick:()=>a(y.branchName,`skills`),className:`group p-4 rounded-xl border border-border/80 bg-card/70 hover:bg-card hover:border-primary/40 transition-all cursor-pointer shadow-xs flex flex-col justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`grid size-8 place-items-center rounded-lg bg-primary/10 text-primary border border-primary/20`,children:(0,$.jsx)(_n,{size:15})}),(0,$.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground uppercase tracking-wider`,children:`Skills & Toolkits`})]}),(0,$.jsx)(Qe,{size:13,className:`text-muted-foreground group-hover:text-primary transition-transform group-hover:translate-x-1`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`text-2xl font-black font-mono text-foreground`,children:[A.length,` `,(0,$.jsx)(`span`,{className:`text-sm font-semibold text-muted-foreground`,children:`Active`})]}),(0,$.jsx)(`div`,{className:`text-[11px] text-muted-foreground mt-1`,children:A.length===0?`Click to attach capabilities`:`Reviewers, linters & test suites`})]})]})]}),y.description&&(0,$.jsxs)(Z,{className:`p-5 border-border/80 bg-card/60 backdrop-blur-md rounded-xl`,children:[(0,$.jsxs)(`h4`,{className:`text-xs font-bold uppercase tracking-wider text-muted-foreground mb-2 flex items-center gap-2`,children:[(0,$.jsx)(Rt,{size:13,className:`text-primary`}),` Feature Intent & Description`]}),(0,$.jsx)(`div`,{className:`text-xs sm:text-sm leading-relaxed text-foreground/90`,children:(0,$.jsx)(Zt,{content:y.description})})]}),(0,$.jsxs)(Z,{className:`border-border/80 bg-card/70 backdrop-blur-md rounded-xl overflow-hidden shadow-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between p-4 border-b border-border/60 bg-muted/20`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(Xt,{size:16,className:`text-primary`}),(0,$.jsxs)(`h3`,{className:`text-xs font-extrabold uppercase tracking-wider text-foreground`,children:[`Mapped Repositories & Worktrees (`,y.repos.length,`)`]})]}),M.length>0&&(0,$.jsx)(sr,{repos:M,disabled:f,onAdd:e=>{window.confirm(`Add repository "${wt(e)}" to this workspace?\nThis creates a new git worktree and re-runs analysis.`)&&p(y.branchName,e)}})]}),(0,$.jsx)(`div`,{className:`divide-y divide-border/60`,children:j.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between p-4 hover:bg-accent/40 transition-colors text-xs`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,$.jsx)(`span`,{className:s(`size-2.5 rounded-full shrink-0 shadow-xs`,e.changedCount===null?`bg-muted-foreground`:e.changedCount>0?`bg-amber-400 animate-pulse`:`bg-emerald-400`),title:e.changedCount===null?`Status unknown`:e.changedCount>0?`${e.changedCount} uncommitted changes`:`Clean`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`font-mono font-bold text-foreground text-xs sm:text-sm truncate`,children:e.name}),(0,$.jsx)(`div`,{className:`font-mono text-[10px] text-muted-foreground/80 truncate max-w-md`,children:e.path})]})]}),(0,$.jsx)(`div`,{className:`flex items-center gap-3 shrink-0`,children:(0,$.jsx)(`span`,{className:s(`font-mono text-[11px] font-semibold px-2 py-0.5 rounded-md border`,e.changedCount===null?`border-border bg-muted/60 text-muted-foreground`:e.changedCount>0?`border-amber-500/30 bg-amber-500/10 text-amber-400`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-400`),children:e.changedCount===null?`—`:e.changedCount>0?`${e.changedCount} modified`:`Clean`})})]},e.name))})]}),(0,$.jsxs)(Z,{className:`border-border/80 bg-card/70 backdrop-blur-md rounded-xl p-5 shadow-xs`,children:[(0,$.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(_n,{size:16,className:`text-primary`}),(0,$.jsx)(`h3`,{className:`text-xs font-extrabold uppercase tracking-wider text-foreground`,children:`Attached Skills & Capabilities`}),(0,$.jsxs)(`span`,{className:s(`inline-flex items-center px-2 py-0.5 rounded-md text-[10px] font-bold font-mono border`,A.length>0?`border-primary/30 bg-primary/10 text-primary`:`border-border/70 bg-muted/60 text-muted-foreground`),children:[A.length,` active`]})]}),(0,$.jsxs)(l,{size:`sm`,variant:`outline`,onClick:()=>a(y.branchName,`skills`),className:`text-xs font-semibold gap-1.5 h-8`,children:[(0,$.jsx)(_n,{size:13}),(0,$.jsx)(`span`,{children:`Configure Skills`})]})]}),k?(0,$.jsx)(`div`,{className:`h-16 rounded-xl bg-muted/40 animate-pulse`}):A.length===0?(0,$.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/80 bg-muted/20 p-4 sm:flex sm:items-center sm:justify-between gap-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-xs font-bold text-foreground`,children:`No skills attached to this workspace`}),(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground mt-0.5`,children:`Equip the AI assistant with specialized toolkits (PR reviewers, linters, test harnesses).`})]}),(0,$.jsx)(l,{size:`sm`,variant:`default`,onClick:()=>a(y.branchName,`skills`),className:`shrink-0 font-bold mt-2 sm:mt-0 h-8 text-xs`,children:`Attach Skills →`})]}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:A.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-col justify-between p-3.5 rounded-xl border border-border/80 bg-card/60 hover:bg-card hover:border-primary/30 transition-all shadow-xs gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(`span`,{className:`grid size-6 place-items-center rounded-lg bg-primary/15 text-primary shrink-0`,children:(0,$.jsx)(_n,{size:12})}),(0,$.jsx)(`span`,{className:`text-xs font-bold text-foreground truncate`,title:e.title||e.name,children:e.title||e.name})]}),(0,$.jsx)(`span`,{className:s(`text-[9px] font-mono font-bold uppercase px-1.5 py-0.5 rounded-md border shrink-0`,e.custom?`border-purple-500/30 bg-purple-500/10 text-purple-400`:`border-border/70 bg-muted text-muted-foreground`),children:e.custom?`Custom`:`Template`})]}),e.description&&(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground line-clamp-2 leading-relaxed`,children:e.description})]},e.id))})]})]}),i===`sessions`&&(0,$.jsxs)(`section`,{"aria-labelledby":`session-history-heading`,className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3 p-4 rounded-xl border border-border bg-card shadow-xs`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{id:`session-history-heading`,className:`text-sm font-semibold text-foreground`,children:`AI Sessions & History`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:`Inspect recorded session logs, turns, and token usage, or open active conversations in the floating chat.`})]}),(0,$.jsxs)(l,{variant:`default`,size:`sm`,onClick:()=>x(y.branchName),className:`text-xs h-8 gap-1.5 shrink-0 cursor-pointer self-start sm:self-auto`,title:`Open floating multi-workspace chat`,children:[(0,$.jsx)(Mt,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`Open Floating Chat`})]})]}),(0,$.jsx)(dr,{ws:y,showToast:m,...h})]}),i===`workroom`&&(0,$.jsx)(Cr,{ws:y,showToast:m}),i===`changes`&&(0,$.jsx)(fr,{ws:y,...g}),i===`knowledge`&&(0,$.jsx)(pr,{ws:y,..._}),i===`plan`&&(0,$.jsx)(mr,{workspaceId:y.branchName,...v}),i===`skills`&&(0,$.jsx)(gr,{ws:y,showToast:m}),i===`services`&&(0,$.jsx)(wr,{ws:y})]})]})]})]})})()})}):(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,$.jsx)(`div`,{className:`max-w-md w-full`,children:(0,$.jsx)(Ut,{children:(0,$.jsxs)(Bt,{children:[(0,$.jsx)(Ot,{variant:`icon`,children:(0,$.jsx)(Xt,{})}),(0,$.jsx)(bt,{children:`No workspace selected`}),(0,$.jsx)(It,{children:`Select a workspace from the sidebar to inspect git changes, context, or launch AI assistants.`})]})})})})})}export{Dr as WorkspacesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,h as t,m as n}from"./button-CREn1mup.js";import{_t as r,
|
|
1
|
+
import{g as e,h as t,m as n}from"./button-CREn1mup.js";import{_t as r,ft as i,gt as a,ht as o,mt as s,pt as c,vt as l,yt as u}from"./index-3tD_IeyQ.js";var d=t(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]);function f(e){return s(`alert-dialog`,e)}var p=e(),m=f,h=o;function g({className:e,...t}){return(0,p.jsx)(u,{forceRender:!0,className:n(`fixed inset-0 z-50 bg-background/60 backdrop-blur-xs transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0`,e),"data-slot":`alert-dialog-backdrop`,...t})}function _({className:e,...t}){return(0,p.jsx)(c,{className:n(`fixed inset-0 z-50 grid grid-rows-[1fr_auto_1fr] justify-items-center p-4`,e),"data-slot":`alert-dialog-viewport`,...t})}function v({className:e,bottomStickOnMobile:t=!0,...r}){return(0,p.jsxs)(h,{children:[(0,p.jsx)(g,{}),(0,p.jsx)(_,{className:n(t&&`max-sm:grid-rows-[1fr_auto] max-sm:p-0 max-sm:pt-12`),children:(0,p.jsx)(a,{className:n(`-translate-y-[calc(1.25rem*var(--nested-dialogs))] relative row-start-2 flex max-h-full min-h-0 w-full min-w-0 max-w-lg scale-[calc(1-0.1*var(--nested-dialogs))] flex-col rounded-2xl border bg-popover not-dark:bg-clip-padding text-popover-foreground opacity-[calc(1-0.1*var(--nested-dialogs))] shadow-lg/5 transition-[scale,opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-nested:data-ending-style:translate-y-8 data-nested:data-starting-style:translate-y-8 data-nested-dialog-open:origin-top data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,t&&`max-sm:max-w-none max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4 max-sm:before:hidden max-sm:before:rounded-none`,e),"data-slot":`alert-dialog-popup`,...r})})]})}function y({className:e,...t}){return(0,p.jsx)(`div`,{className:n(`flex flex-col gap-2 p-6 text-center max-sm:pb-4 sm:text-left`,e),"data-slot":`alert-dialog-header`,...t})}function b({className:e,variant:t=`default`,...r}){return(0,p.jsx)(`div`,{className:n(`flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]`,t==="default"&&`border-t bg-muted/72 py-4`,t===`bare`&&`pb-6`,e),"data-slot":`alert-dialog-footer`,...r})}function x({className:e,...t}){return(0,p.jsx)(i,{className:n(`font-heading font-semibold text-xl leading-none`,e),"data-slot":`alert-dialog-title`,...t})}function S({className:e,...t}){return(0,p.jsx)(r,{className:n(`text-muted-foreground text-sm`,e),"data-slot":`alert-dialog-description`,...t})}function C(e){return(0,p.jsx)(l,{"data-slot":`alert-dialog-close`,...e})}export{y as a,d as c,b as i,C as n,v as o,S as r,x as s,m as t};
|