agent-relay-server 0.52.0 → 0.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/docs/openapi.json +1 -1
  2. package/package.json +1 -1
  3. package/public/assets/PlanGraphPanel-CQ0CH7e9.js +2 -0
  4. package/public/assets/PlanGraphPanel-CQ0CH7e9.js.map +1 -0
  5. package/public/assets/{activity-BNLuP717.js → activity-CxnH-3Zt.js} +2 -2
  6. package/public/assets/{activity-BNLuP717.js.map → activity-CxnH-3Zt.js.map} +1 -1
  7. package/public/assets/{agent-profiles-BhVEehP8.js → agent-profiles-JhWQY-pg.js} +2 -2
  8. package/public/assets/{agent-profiles-BhVEehP8.js.map → agent-profiles-JhWQY-pg.js.map} +1 -1
  9. package/public/assets/agents-Bn7CXOMZ.js +2 -0
  10. package/public/assets/{agents-CqQhC2aN.js.map → agents-Bn7CXOMZ.js.map} +1 -1
  11. package/public/assets/{analytics-44eqtAsx.js → analytics-BCVgYihk.js} +3 -3
  12. package/public/assets/{analytics-44eqtAsx.js.map → analytics-BCVgYihk.js.map} +1 -1
  13. package/public/assets/{automation-x65cxlk4.js → automation-Cu5J1Yh4.js} +2 -2
  14. package/public/assets/{automation-x65cxlk4.js.map → automation-Cu5J1Yh4.js.map} +1 -1
  15. package/public/assets/{badge-BR4bvEsy.js → badge-D6yb-Kia.js} +2 -2
  16. package/public/assets/{badge-BR4bvEsy.js.map → badge-D6yb-Kia.js.map} +1 -1
  17. package/public/assets/branch-state-badge-fOM74RDq.js +2 -0
  18. package/public/assets/{branch-state-badge-Dp6Jk4LH.js.map → branch-state-badge-fOM74RDq.js.map} +1 -1
  19. package/public/assets/{button-BwqJZS4O.js → button-B-w6a1Ng.js} +2 -2
  20. package/public/assets/{button-BwqJZS4O.js.map → button-B-w6a1Ng.js.map} +1 -1
  21. package/public/assets/card-j6bjYxys.js +2 -0
  22. package/public/assets/{card-C7JtSyuM.js.map → card-j6bjYxys.js.map} +1 -1
  23. package/public/assets/{channels-CmfUfiV0.js → channels-D4q8I1q-.js} +2 -2
  24. package/public/assets/{channels-CmfUfiV0.js.map → channels-D4q8I1q-.js.map} +1 -1
  25. package/public/assets/chat-6QaNdZGN.js +2 -0
  26. package/public/assets/{chat-nugo0m55.js.map → chat-6QaNdZGN.js.map} +1 -1
  27. package/public/assets/{connectors-Bf74bw_9.js → connectors-DuWMf8KT.js} +2 -2
  28. package/public/assets/{connectors-Bf74bw_9.js.map → connectors-DuWMf8KT.js.map} +1 -1
  29. package/public/assets/{copy-button-nbDhTE0M.js → copy-button-CJDmQ9UB.js} +2 -2
  30. package/public/assets/{copy-button-nbDhTE0M.js.map → copy-button-CJDmQ9UB.js.map} +1 -1
  31. package/public/assets/{dist-BIAvrITs.js → dist-1iqvQR2q.js} +2 -2
  32. package/public/assets/{dist-BIAvrITs.js.map → dist-1iqvQR2q.js.map} +1 -1
  33. package/public/assets/{dist-MdPDPcyo.js → dist-BNF6RqQf.js} +2 -2
  34. package/public/assets/{dist-MdPDPcyo.js.map → dist-BNF6RqQf.js.map} +1 -1
  35. package/public/assets/{dist-Dvspm7RE.js → dist-Bg5mAaEO.js} +2 -2
  36. package/public/assets/{dist-Dvspm7RE.js.map → dist-Bg5mAaEO.js.map} +1 -1
  37. package/public/assets/{dist-C7UYAwBf.js → dist-BtFzbpiK.js} +2 -2
  38. package/public/assets/{dist-C7UYAwBf.js.map → dist-BtFzbpiK.js.map} +1 -1
  39. package/public/assets/{dist-svixSeDF.js → dist-CLUvHFPE.js} +2 -2
  40. package/public/assets/{dist-svixSeDF.js.map → dist-CLUvHFPE.js.map} +1 -1
  41. package/public/assets/{dist-BiVJ8IWp.js → dist-Cl4PfJEy.js} +2 -2
  42. package/public/assets/{dist-BiVJ8IWp.js.map → dist-Cl4PfJEy.js.map} +1 -1
  43. package/public/assets/dist-D1g0W-kO.js +2 -0
  44. package/public/assets/{dist-BkDVLgYg.js.map → dist-D1g0W-kO.js.map} +1 -1
  45. package/public/assets/{dist-DvLO--_O.js → dist-DLc4vQoq.js} +2 -2
  46. package/public/assets/{dist-DvLO--_O.js.map → dist-DLc4vQoq.js.map} +1 -1
  47. package/public/assets/{dist-CSISzAHD.js → dist-HMkrkMzb.js} +2 -2
  48. package/public/assets/{dist-CSISzAHD.js.map → dist-HMkrkMzb.js.map} +1 -1
  49. package/public/assets/dist-MX7mVzej.js +2 -0
  50. package/public/assets/{dist-D5y1HX8f.js.map → dist-MX7mVzej.js.map} +1 -1
  51. package/public/assets/dist-fe-f7EIl.js +2 -0
  52. package/public/assets/{dist-tX4uIBFU.js.map → dist-fe-f7EIl.js.map} +1 -1
  53. package/public/assets/{es2015-Cu7l1536.js → es2015-4dO99MHc.js} +2 -2
  54. package/public/assets/{es2015-Cu7l1536.js.map → es2015-4dO99MHc.js.map} +1 -1
  55. package/public/assets/{formatted-body-impl-UeUBqdRz.js → formatted-body-impl-CTv-ZFNo.js} +2 -2
  56. package/public/assets/{formatted-body-impl-UeUBqdRz.js.map → formatted-body-impl-CTv-ZFNo.js.map} +1 -1
  57. package/public/assets/index-Cobj8Cqd.js +21 -0
  58. package/public/assets/index-Cobj8Cqd.js.map +1 -0
  59. package/public/assets/index-D7FDcoef.css +2 -0
  60. package/public/assets/{input-YoPXrp72.js → input-EazHb1Bc.js} +2 -2
  61. package/public/assets/{input-YoPXrp72.js.map → input-EazHb1Bc.js.map} +1 -1
  62. package/public/assets/{insights-C9k7mCoJ.js → insights-Ucwp3dHJ.js} +2 -2
  63. package/public/assets/{insights-C9k7mCoJ.js.map → insights-Ucwp3dHJ.js.map} +1 -1
  64. package/public/assets/{integrations-By3hMfqC.js → integrations-eRsF4CjO.js} +2 -2
  65. package/public/assets/{integrations-By3hMfqC.js.map → integrations-eRsF4CjO.js.map} +1 -1
  66. package/public/assets/{lib-D8ccisdr.js → lib-C7poqE0I.js} +3 -3
  67. package/public/assets/{lib-D8ccisdr.js.map → lib-C7poqE0I.js.map} +1 -1
  68. package/public/assets/{lucide-react-ChOGD4vc.js → lucide-react-Dr0-sUx6.js} +2 -2
  69. package/public/assets/{lucide-react-ChOGD4vc.js.map → lucide-react-Dr0-sUx6.js.map} +1 -1
  70. package/public/assets/{maintenance-tgb7AMTv.js → maintenance-BW56fE-T.js} +2 -2
  71. package/public/assets/{maintenance-tgb7AMTv.js.map → maintenance-BW56fE-T.js.map} +1 -1
  72. package/public/assets/{managed-agents-DJ3TfBJ5.js → managed-agents-BkFAu1Ub.js} +2 -2
  73. package/public/assets/{managed-agents-DJ3TfBJ5.js.map → managed-agents-BkFAu1Ub.js.map} +1 -1
  74. package/public/assets/{markdown-preview-impl-DcHq1Hto.js → markdown-preview-impl-BT43MQ7E.js} +2 -2
  75. package/public/assets/{markdown-preview-impl-DcHq1Hto.js.map → markdown-preview-impl-BT43MQ7E.js.map} +1 -1
  76. package/public/assets/memory-Cw279dr5.js +2 -0
  77. package/public/assets/{memory-CMdemdtb.js.map → memory-Cw279dr5.js.map} +1 -1
  78. package/public/assets/{messages-CLuLC9wC.js → messages-5InjjgUv.js} +2 -2
  79. package/public/assets/{messages-CLuLC9wC.js.map → messages-5InjjgUv.js.map} +1 -1
  80. package/public/assets/{orchestrators-d27zYyT9.js → orchestrators-B78CQxLl.js} +2 -2
  81. package/public/assets/{orchestrators-d27zYyT9.js.map → orchestrators-B78CQxLl.js.map} +1 -1
  82. package/public/assets/{overview-BY-cs5SI.js → overview-C9V2X2oo.js} +2 -2
  83. package/public/assets/{overview-BY-cs5SI.js.map → overview-C9V2X2oo.js.map} +1 -1
  84. package/public/assets/{pairs-CmyQx_4F.js → pairs-Cc3tOjXB.js} +2 -2
  85. package/public/assets/{pairs-CmyQx_4F.js.map → pairs-Cc3tOjXB.js.map} +1 -1
  86. package/public/assets/{react-dom-DgWuIw1o.js → react-dom-CQSYEHV9.js} +2 -2
  87. package/public/assets/{react-dom-DgWuIw1o.js.map → react-dom-CQSYEHV9.js.map} +1 -1
  88. package/public/assets/{security-CxCnWTlk.js → security-CpBET4KN.js} +2 -2
  89. package/public/assets/{security-CxCnWTlk.js.map → security-CpBET4KN.js.map} +1 -1
  90. package/public/assets/{select-B6iG4oYX.js → select-FNVeUxFZ.js} +2 -2
  91. package/public/assets/{select-B6iG4oYX.js.map → select-FNVeUxFZ.js.map} +1 -1
  92. package/public/assets/settings-CPto3TdF.js +10 -0
  93. package/public/assets/settings-CPto3TdF.js.map +1 -0
  94. package/public/assets/{store-BLZA3u7Y.js → store-h-egULYA.js} +4 -4
  95. package/public/assets/store-h-egULYA.js.map +1 -0
  96. package/public/assets/{tasks-BYUAWEL-.js → tasks-BPplMcnM.js} +2 -2
  97. package/public/assets/{tasks-BYUAWEL-.js.map → tasks-BPplMcnM.js.map} +1 -1
  98. package/public/assets/teams-CCeuRt7v.js +2 -0
  99. package/public/assets/{teams-gWvyw7ET.js.map → teams-CCeuRt7v.js.map} +1 -1
  100. package/public/assets/{terminal-viewer-impl-CHP0w79T.js → terminal-viewer-impl-DRlbl8Yv.js} +3 -3
  101. package/public/assets/{terminal-viewer-impl-CHP0w79T.js.map → terminal-viewer-impl-DRlbl8Yv.js.map} +1 -1
  102. package/public/assets/{use-keyboard-viewport-BY99X7eI.js → use-keyboard-viewport-Iaz6IT4p.js} +2 -2
  103. package/public/assets/{use-keyboard-viewport-BY99X7eI.js.map → use-keyboard-viewport-Iaz6IT4p.js.map} +1 -1
  104. package/public/assets/{work-queue-CBjXlNuG.js → work-queue-qtjloIIF.js} +2 -2
  105. package/public/assets/{work-queue-CBjXlNuG.js.map → work-queue-qtjloIIF.js.map} +1 -1
  106. package/public/assets/workspaces-BcnSfMmi.js +3 -0
  107. package/public/assets/{workspaces-PdCwiSQx.js.map → workspaces-BcnSfMmi.js.map} +1 -1
  108. package/public/index.html +21 -21
  109. package/src/db/message-reads.ts +60 -0
  110. package/src/mcp.ts +7 -5
  111. package/src/routes/workspaces.ts +2 -2
  112. package/src/services/register-agent.ts +4 -1
  113. package/src/services/shutdown-agent.ts +24 -7
  114. package/src/services/spawn-agent.ts +15 -0
  115. package/src/spawn-command.ts +8 -0
  116. package/src/workspace-actions.ts +2 -2
  117. package/src/workspace-merge.ts +4 -1
  118. package/public/assets/PlanGraphPanel-BnYmYHnY.js +0 -2
  119. package/public/assets/PlanGraphPanel-BnYmYHnY.js.map +0 -1
  120. package/public/assets/agents-CqQhC2aN.js +0 -2
  121. package/public/assets/branch-state-badge-Dp6Jk4LH.js +0 -2
  122. package/public/assets/card-C7JtSyuM.js +0 -2
  123. package/public/assets/chat-nugo0m55.js +0 -2
  124. package/public/assets/dist-BkDVLgYg.js +0 -2
  125. package/public/assets/dist-D5y1HX8f.js +0 -2
  126. package/public/assets/dist-tX4uIBFU.js +0 -2
  127. package/public/assets/index-C0aWKi0g.css +0 -2
  128. package/public/assets/index-D--CyG66.js +0 -21
  129. package/public/assets/index-D--CyG66.js.map +0 -1
  130. package/public/assets/memory-CMdemdtb.js +0 -2
  131. package/public/assets/settings-vSYPv8kE.js +0 -10
  132. package/public/assets/settings-vSYPv8kE.js.map +0 -1
  133. package/public/assets/store-BLZA3u7Y.js.map +0 -1
  134. package/public/assets/teams-gWvyw7ET.js +0 -2
  135. package/public/assets/workspaces-PdCwiSQx.js +0 -3
@@ -1,2 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{J as t,M as n,Mn as r,Un as i,jn as a,kn as o,l as s,m as c,sn as l}from"./lucide-react-ChOGD4vc.js";import{r as u,t as d}from"./store-BLZA3u7Y.js";import{H as f,J as p,V as ee,d as m,h}from"./display-CXhnBwGf.js";import{a as te,i as ne,n as re,r as ie,t as ae}from"./select-B6iG4oYX.js";import{t as g}from"./badge-BR4bvEsy.js";import{t as _}from"./button-BwqJZS4O.js";import{t as v}from"./input-YoPXrp72.js";import{s as y}from"./index-D--CyG66.js";import{i as b,n as x,r as S,t as C}from"./card-C7JtSyuM.js";import{t as oe}from"./PlanGraphPanel-BnYmYHnY.js";var w=e(i(),1),T=a();function E(e){if(e==null)return`-`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.round(n/60);return r<48?`${r}h`:`${Math.round(r/24)}d`}function D(e){return`${Math.round(e*100)}%`}function O(e){return e===`success`?`bg-emerald-500/10 text-emerald-400 border-emerald-500/20`:e===`partial`?`bg-yellow-500/10 text-yellow-400 border-yellow-500/20`:e===`failed`?`bg-red-500/10 text-red-400 border-red-500/20`:`bg-zinc-500/10 text-zinc-400 border-zinc-500/20`}function se({data:e,loading:t,error:n}){let r=e?.totals.byOutcomeStatus,i=e?.compositionShapes.slice(0,6)??[],a=e?.recent.slice(0,8)??[];return(0,T.jsxs)(C,{children:[(0,T.jsx)(S,{children:(0,T.jsxs)(b,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,T.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(l,{className:`size-4 text-primary`}),` Outcomes`]}),(0,T.jsxs)(g,{variant:`secondary`,children:[e?.totals.total??0,` dissolved`]})]})}),(0,T.jsxs)(x,{className:`space-y-5`,children:[n?(0,T.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:n}):null,t&&!e?(0,T.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:`Loading outcomes…`}):!e||e.totals.total===0?(0,T.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:`No dissolved teams yet`}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`div`,{className:`flex flex-wrap gap-2 text-xs`,children:[`success`,`partial`,`failed`,`unknown`].map(e=>{let t=r?.[e]??0;return(0,T.jsxs)(g,{variant:`outline`,className:t===0?`text-muted-foreground`:O(e===`unknown`?null:e),children:[t,` `,e]},e)})}),(0,T.jsxs)(`section`,{className:`space-y-2`,children:[(0,T.jsx)(`div`,{className:`text-sm font-medium`,children:`Composition win-rate`}),(0,T.jsx)(`div`,{className:`divide-y divide-border rounded-md border border-border`,children:i.map(e=>(0,T.jsxs)(`div`,{className:`grid gap-2 px-3 py-2 text-sm md:grid-cols-[1fr_auto_auto] md:items-center`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`div`,{className:`break-words font-medium`,title:e.shape,children:e.shape}),(0,T.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[e.count,` team`,e.count===1?``:`s`,` · avg `,E(e.avgWallClockMs)]})]}),(0,T.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.successCount,`/`,e.count]}),(0,T.jsx)(g,{variant:`outline`,className:O(e.successRate>=.5?`success`:e.successRate>0?`partial`:`failed`),children:D(e.successRate)})]},e.shape))})]}),(0,T.jsxs)(`section`,{className:`space-y-2`,children:[(0,T.jsx)(`div`,{className:`text-sm font-medium`,children:`Recent outcomes`}),(0,T.jsx)(`div`,{className:`overflow-hidden rounded-md border border-border`,children:(0,T.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,T.jsx)(`thead`,{className:`bg-muted/40 text-xs text-muted-foreground`,children:(0,T.jsxs)(`tr`,{children:[(0,T.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Team`}),(0,T.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Outcome`}),(0,T.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:`Members`}),(0,T.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:`Duration`})]})}),(0,T.jsx)(`tbody`,{className:`divide-y divide-border`,children:a.map(e=>(0,T.jsxs)(`tr`,{children:[(0,T.jsxs)(`td`,{className:`max-w-[220px] px-3 py-2`,children:[(0,T.jsx)(`div`,{className:`truncate font-medium`,children:e.title||e.id.slice(0,12)}),(0,T.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.id})]}),(0,T.jsx)(`td`,{className:`px-3 py-2`,children:(0,T.jsx)(g,{variant:`outline`,className:O(e.outcome),children:e.outcome??`unknown`})}),(0,T.jsx)(`td`,{className:`px-3 py-2 text-right`,children:e.memberCount}),(0,T.jsx)(`td`,{className:`px-3 py-2 text-right text-muted-foreground`,children:E(e.durationMs)})]},e.id))})]})})]})]})]})]})}var ce=[{value:`all`,label:`All kinds`},{value:`decision`,label:`Decisions`},{value:`fact`,label:`Facts`},{value:`ruled_out`,label:`Ruled out`}],le={decision:`decision`,fact:`fact`,ruled_out:`ruled out`};function ue(e){return e.status===`dissolved`?`dissolved`:e.zeroMembersSince==null?`active`:`orphaned`}var de={active:`bg-emerald-500/10 text-emerald-400 border-emerald-500/20`,orphaned:`bg-amber-500/10 text-amber-400 border-amber-500/20`,dissolved:`bg-zinc-500/10 text-zinc-400 border-zinc-500/20`},fe={success:`bg-emerald-500/10 text-emerald-400 border-emerald-500/20`,partial:`bg-yellow-500/10 text-yellow-400 border-yellow-500/20`,failed:`bg-red-500/10 text-red-400 border-red-500/20`},k={active:`bg-emerald-500/10 text-emerald-400 border-emerald-500/20`,superseded:`bg-yellow-500/10 text-yellow-400 border-yellow-500/20`,retracted:`bg-red-500/10 text-red-400 border-red-500/20`};function A(e){return e?e.slice(0,12):`-`}function pe(e){if(e===void 0)return`-`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.round(n/60);return r<48?`${r}h`:`${Math.round(r/24)}d`}function me(e){if(!e.composition)return null;try{let t=JSON.parse(e.composition);return Array.isArray(t)?t.length:null}catch{return null}}function he(e,t){let n=t.trim().toLowerCase();return n?[e.title,e.id,e.coordinatorId,e.rootCoordinatorId,e.outcomeStatus,e.outcomeSummary].some(e=>String(e??``).toLowerCase().includes(n)):!0}function ge(e){return e.status===`offline`?`bg-zinc-500/10 text-zinc-400 border-zinc-500/20`:e.status===`busy`?`bg-yellow-500/10 text-yellow-400 border-yellow-500/20`:e.status===`stale`?`bg-red-500/10 text-red-400 border-red-500/20`:`bg-emerald-500/10 text-emerald-400 border-emerald-500/20`}function j(){let[e,i]=(0,w.useState)(null),[a,l]=(0,w.useState)([]),[E,D]=(0,w.useState)(null),[O,j]=(0,w.useState)(`all`),[M,N]=(0,w.useState)(``),[P,F]=(0,w.useState)(!1),[I,L]=(0,w.useState)(!1),[R,z]=(0,w.useState)(null),[B,V]=(0,w.useState)(()=>Date.now()),H=d(e=>e.teams),U=d(e=>e.teamsLoading),W=d(e=>e.teamsError),_e=d(e=>e.fetchTeams),ve=d(e=>e.teamOutcomeAggregates),ye=d(e=>e.teamOutcomeAggregatesLoading),be=d(e=>e.teamOutcomeAggregatesError),xe=d(e=>e.fetchTeamOutcomeAggregates),G=d(e=>e.fetchPlan),Se=d(e=>e.dissolveTeam),Ce=d(e=>e.openConfirm),K=d(e=>e.agentsById),we=d(e=>e.switchView),Te=d(e=>e.openInboxThread),Ee=d(t=>{let n=e??t.teams[0]?.id;return n?t.plansByTeam[u(n)]??null:null}),De=e=>{let t=K[e];return t?m(t):e.slice(-8)};async function q(e,t=O){L(!0),z(null);try{let n=new URLSearchParams({team:e});t!==`all`&&n.set(`kind`,t),l((await r(`GET`,`/blackboard?${n.toString()}`)).entries),D(e)}catch(t){z(p(t)),l([]),D(e)}finally{L(!1)}}async function J(){F(!0),z(null);try{let[t]=await Promise.all([_e(),xe()]);V(Date.now());let n=e??t[0]?.id;n?(G({teamId:n}),await q(n,O)):(l([]),D(null))}catch(e){z(p(e))}finally{F(!1)}}(0,w.useEffect)(()=>{J()},[]),(0,w.useEffect)(()=>{E&&q(E,O)},[O]);let Y=(0,w.useMemo)(()=>H.filter(e=>he(e,M)),[H,M]),X=e??H[0]?.id??null,Z=H.find(e=>e.id===X)??null,Q=E===X?a:[],$=(0,w.useMemo)(()=>X?Object.values(K).filter(e=>e.teamId===X).sort((e,t)=>m(e).localeCompare(m(t))||e.id.localeCompare(t.id)):[],[K,X]),Oe=(0,w.useMemo)(()=>{let e={decision:[],fact:[],ruled_out:[]};for(let t of Q)e[t.kind].push(t);return e},[Q]),ke=O===`all`?[`decision`,`fact`,`ruled_out`]:[O];return(0,T.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(s,{className:`size-5 text-primary`}),(0,T.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Teams`}),(0,T.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`active and dissolved team working sets`})]}),(0,T.jsxs)(_,{variant:`outline`,size:`sm`,onClick:()=>void J(),disabled:P||U,children:[(0,T.jsx)(n,{className:o(`size-4`,(P||U)&&`animate-spin`)}),` Refresh`]})]}),(R||W)&&(0,T.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:R||W}),(0,T.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(320px,420px)_1fr]`,children:[(0,T.jsxs)(`div`,{className:`min-h-[520px] min-w-0 space-y-3`,children:[(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,T.jsx)(`span`,{children:`Team list`}),(0,T.jsx)(g,{variant:`secondary`,children:H.length})]}),(0,T.jsx)(v,{value:M,onChange:e=>N(e.target.value),placeholder:`Filter teams`,className:`h-8`})]}),(0,T.jsx)(`div`,{children:(P||U)&&H.length===0?(0,T.jsx)(`div`,{className:`py-16 text-center text-sm text-muted-foreground`,children:`Loading teams…`}):Y.length===0?(0,T.jsx)(`div`,{className:`py-16 text-center text-sm text-muted-foreground`,children:H.length===0?`No teams`:`No teams match`}):(0,T.jsx)(y,{className:`h-[610px] pr-3`,children:(0,T.jsx)(`div`,{className:`space-y-2`,children:Y.map(e=>{let n=e.id===X,r=me(e),a=ue(e),s=e.coordinatorId,c=()=>{i(e.id),G({teamId:e.id}),q(e.id,O)};return(0,T.jsx)(`div`,{role:`button`,tabIndex:0,onClick:c,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},className:`block w-full cursor-pointer text-left`,children:(0,T.jsx)(C,{className:o(`transition-colors hover:border-primary/50`,n&&`border-primary/60 bg-primary/5`),children:(0,T.jsxs)(x,{className:`space-y-3 p-3`,children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.title||A(e.id)}),(0,T.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.id})]}),(0,T.jsx)(g,{variant:`outline`,className:de[a],children:a})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[(0,T.jsx)(`span`,{children:`Coordinator`}),s?(0,T.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),Te(s),we(`chat`)},className:`flex min-w-0 items-center justify-end gap-1 text-right text-primary hover:underline`,title:`Chat with ${s}`,children:[(0,T.jsx)(t,{className:`size-3 shrink-0`}),(0,T.jsx)(`span`,{className:`truncate`,children:De(s)})]}):(0,T.jsx)(`span`,{className:`text-right text-muted-foreground`,children:`—`}),(0,T.jsx)(`span`,{children:`Members`}),(0,T.jsx)(`span`,{className:`text-right text-foreground`,children:r??`-`}),(0,T.jsx)(`span`,{children:`Created`}),(0,T.jsx)(`span`,{className:`text-right text-foreground`,title:h(e.createdAt),children:f(B,e.createdAt)}),e.dissolvedAt?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`span`,{children:`Dissolved`}),(0,T.jsx)(`span`,{className:`text-right text-foreground`,title:h(e.dissolvedAt),children:f(B,e.dissolvedAt)})]}):null]}),a===`orphaned`&&e.zeroMembersSince!=null?(0,T.jsx)(`div`,{className:`flex items-center gap-1.5 border-t border-border pt-2 text-xs text-amber-400`,title:h(e.zeroMembersSince),children:(0,T.jsxs)(`span`,{children:[`No live members since `,f(B,e.zeroMembersSince),` — auto-dissolving`]})}):null,e.status===`dissolved`?(0,T.jsxs)(`div`,{className:`space-y-1 border-t border-border pt-2`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e.outcomeStatus?(0,T.jsx)(g,{variant:`outline`,className:fe[e.outcomeStatus],children:e.outcomeStatus}):(0,T.jsx)(g,{variant:`outline`,children:`no outcome`}),(0,T.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:pe(e.wallClockMs)})]}),e.outcomeSummary?(0,T.jsx)(`p`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:e.outcomeSummary}):null]}):null]})})},e.id)})})})})]}),(0,T.jsxs)(`div`,{className:`min-h-[520px] min-w-0 space-y-4`,children:[(0,T.jsx)(se,{data:ve,loading:ye,error:be}),Z&&Ee?(0,T.jsx)(C,{className:`p-0`,children:(0,T.jsx)(oe,{teamId:Z.id})}):null,(0,T.jsxs)(C,{children:[(0,T.jsx)(S,{children:(0,T.jsxs)(b,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`span`,{children:`Roster`}),(0,T.jsxs)(`span`,{className:`ml-2 text-xs font-normal text-muted-foreground`,children:[$.length,` member`,$.length===1?``:`s`]})]}),Z&&Z.status!==`dissolved`?(0,T.jsxs)(_,{variant:`destructive`,size:`sm`,onClick:()=>Ce(`Dissolve Team`,`Dissolve "${Z.title||Z.id}"? This closes the team working set but keeps its records visible.`,()=>void Se(Z.id)),children:[(0,T.jsx)(c,{className:`size-4`}),` Dissolve`]}):null]})}),(0,T.jsx)(x,{children:Z?$.length===0?(0,T.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:`No members`}):(0,T.jsx)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:$.map(e=>(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3 rounded-md border border-border bg-background px-3 py-2`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,T.jsx)(`span`,{className:o(`h-2 w-2 shrink-0 rounded-full`,ee(e,B))}),(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`div`,{className:`truncate text-sm font-medium`,children:m(e)}),(0,T.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.id})]})]}),(0,T.jsx)(g,{variant:`outline`,className:ge(e),children:e.status})]},e.id))}):(0,T.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:`No team selected`})})]}),(0,T.jsxs)(C,{children:[(0,T.jsx)(S,{children:(0,T.jsxs)(b,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`span`,{children:`Blackboard`}),Z?(0,T.jsx)(`span`,{className:`ml-2 text-xs font-normal text-muted-foreground`,children:Z.title||Z.id}):null]}),(0,T.jsxs)(ae,{value:O,onValueChange:e=>j(e),children:[(0,T.jsx)(ne,{size:`sm`,className:`w-36`,children:(0,T.jsx)(te,{})}),(0,T.jsx)(re,{children:ce.map(e=>(0,T.jsx)(ie,{value:e.value,children:e.label},e.value))})]})]})}),(0,T.jsx)(x,{children:Z?I&&Q.length===0?(0,T.jsx)(`div`,{className:`py-16 text-center text-sm text-muted-foreground`,children:`Loading blackboard…`}):Q.length===0?(0,T.jsx)(`div`,{className:`py-16 text-center text-sm text-muted-foreground`,children:`No blackboard entries`}):(0,T.jsx)(y,{className:`h-[640px] pr-3`,children:(0,T.jsx)(`div`,{className:`space-y-5`,children:ke.map(e=>{let t=Oe[e];return t.length===0?null:(0,T.jsxs)(`section`,{className:`space-y-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(g,{variant:`secondary`,children:le[e]}),(0,T.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.length})]}),(0,T.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>(0,T.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border bg-background p-3`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`div`,{className:`text-sm font-medium`,children:e.title}),(0,T.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`by `,A(e.authorId),` · `,f(B,e.updatedAt||e.createdAt)]})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-1`,children:[(0,T.jsx)(g,{variant:`outline`,className:k[e.status],children:e.status}),e.supersedes?(0,T.jsxs)(g,{variant:`outline`,children:[`supersedes `,A(e.supersedes)]}):null]})]}),e.body?(0,T.jsx)(`p`,{className:`whitespace-pre-wrap text-sm text-muted-foreground`,children:e.body}):null]},e.id))})]},e)})})}):(0,T.jsx)(`div`,{className:`py-16 text-center text-sm text-muted-foreground`,children:`No team selected`})})]})]})]})]})}export{j as TeamsView};
2
- //# sourceMappingURL=teams-gWvyw7ET.js.map
@@ -1,3 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{At as t,Dn as n,Dt as r,Et as i,Gt as a,M as o,Mt as s,Nt as c,Un as l,W as u,an as d,bt as f,i as p,in as m,jn as h,m as g,nn as _,p as v,vt as y,wn as b,xt as x,yn as S}from"./lucide-react-ChOGD4vc.js";import{o as C,t as w}from"./store-BLZA3u7Y.js";import{H as T,d as E,q as D}from"./display-CXhnBwGf.js";import{t as O}from"./badge-BR4bvEsy.js";import{t as k}from"./button-BwqJZS4O.js";import{t as ee}from"./copy-button-nbDhTE0M.js";import{i as A,n as j,r as M,t as N}from"./card-C7JtSyuM.js";var P=e(l(),1),F=h(),I=new Set([`active`,`ready`,`conflict`,`review_requested`,`merge_planned`,`cleanup_requested`]),L=new Set([`active`,`ready`,`conflict`,`review_requested`,`merge_planned`]),R=new Set([`active`,`ready`,`review_requested`,`merge_planned`,`conflict`]),z={active:`bg-blue-500/10 text-blue-400 border-blue-500/20`,ready:`bg-emerald-500/10 text-emerald-400 border-emerald-500/20`,conflict:`bg-red-500/10 text-red-400 border-red-500/20`,review_requested:`bg-yellow-500/10 text-yellow-400 border-yellow-500/20`,merge_planned:`bg-indigo-500/10 text-indigo-400 border-indigo-500/20`,merged:`bg-violet-500/10 text-violet-400 border-violet-500/20`,abandoned:`bg-zinc-500/10 text-zinc-400 border-zinc-500/20`,cleanup_requested:`bg-orange-500/10 text-orange-400 border-orange-500/20`,cleaned:`bg-zinc-500/10 text-zinc-400 border-zinc-500/20`},B={active:`active`,ready:`ready`,conflict:`conflict`,review_requested:`review`,merge_planned:`merge planned`,merged:`merged`,abandoned:`abandoned`,cleanup_requested:`cleanup`,cleaned:`cleaned`},V={conflict:0,ready:1,review_requested:2,merge_planned:3,active:4,cleanup_requested:5,merged:6,abandoned:7,cleaned:8},H=new Set(D);function U(e){let t=e.split(`/`).filter(Boolean);return t.length<=3?e||`-`:`/${t.slice(-3).join(`/`)}`}function W(e,t){return e?E(e):t||`-`}function G(e){return z[e]||`bg-zinc-500/10 text-zinc-400 border-zinc-500/20`}function K(e,t){let n=(V[e.status]??99)-(V[t.status]??99);return n===0?Number(t.updatedAt||0)-Number(e.updatedAt||0):n}function q(e){let t=new Map;for(let n of e){let e=n.repoRoot||n.sourceCwd||`unknown repo`;t.set(e,[...t.get(e)||[],n])}return[...t.entries()].map(([e,t])=>({repoRoot:e,workspaces:t.sort(K)})).sort((e,t)=>{let n=e.workspaces.some(e=>I.has(e.status));return n===t.workspaces.some(e=>I.has(e.status))?e.repoRoot.localeCompare(t.repoRoot):n?-1:1})}function J(e,t){return t===`all`?e:t===`cleaned`?e.filter(e=>H.has(e.status)):e.filter(e=>!H.has(e.status))}function Y({workspace:e,expanded:t,onToggleDetails:n}){let a=w(e=>e.workspaceAction),o=w(e=>e.purgeWorkspace),s=w(e=>e.fetchWorkspaceMergePreview),l=w(e=>e.openFilesAt),u=e.status===`cleaned`||e.status===`merged`||e.status===`abandoned`,f=u||e.status===`cleanup_requested`,h=e.worktreePath||e.sourceCwd||e.repoRoot,v=w(t=>t.workspaceGitState[e.id]),b=!!v&&v.available!==!1&&v.landed===!0,x=e.mode===`isolated`&&!!e.worktreePath&&R.has(e.status)&&!b;async function S(){await s(e.id),await a(e.id,`merge`)}return(0,F.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-1.5`,children:[(0,F.jsx)(k,{size:`icon-sm`,variant:`ghost`,title:t?`Hide details`:`Show diff & timeline`,onClick:n,children:t?(0,F.jsx)(m,{className:`h-3.5 w-3.5`}):(0,F.jsx)(_,{className:`h-3.5 w-3.5`})}),(0,F.jsx)(k,{size:`icon-sm`,variant:`ghost`,title:`Open workspace`,disabled:!h||e.status===`cleaned`,onClick:()=>void l({path:h}),children:(0,F.jsx)(i,{className:`h-3.5 w-3.5`})}),(0,F.jsx)(ee,{value:h,label:`Copy path`,copiedLabel:`Copied path`,size:`icon-sm`,variant:`ghost`,disabled:!h}),(0,F.jsx)(k,{size:`icon-sm`,variant:`outline`,title:`Mark ready`,disabled:f||e.status===`ready`,onClick:()=>void a(e.id,`ready`),children:(0,F.jsx)(d,{className:`h-3.5 w-3.5`})}),(0,F.jsx)(k,{size:`icon-sm`,variant:`outline`,title:`Request review`,disabled:f||e.status===`review_requested`,onClick:()=>void a(e.id,`request-review`),children:(0,F.jsx)(c,{className:`h-3.5 w-3.5`})}),(0,F.jsx)(k,{size:`icon-sm`,variant:`outline`,title:`Mark merge planned`,disabled:f||e.status===`merge_planned`,onClick:()=>void a(e.id,`merge-plan`),children:(0,F.jsx)(r,{className:`h-3.5 w-3.5`})}),(0,F.jsx)(k,{size:`icon-sm`,variant:`default`,title:b?`Already merged into base — nothing to land`:`Merge & land work`,disabled:!x,onClick:()=>void S(),children:(0,F.jsx)(y,{className:`h-3.5 w-3.5`})}),(0,F.jsx)(k,{size:`icon-sm`,variant:`outline`,title:`Request cleanup (removes the worktree on the host)`,disabled:e.status===`cleaned`||e.status===`cleanup_requested`,onClick:()=>void a(e.id,`cleanup`),children:(0,F.jsx)(g,{className:`h-3.5 w-3.5`})}),u&&(0,F.jsx)(k,{size:`icon-sm`,variant:`ghost`,title:`Purge record (clears the row, does not touch disk)`,onClick:()=>void o(e.id),children:(0,F.jsx)(p,{className:`h-3.5 w-3.5`})})]})}function X({workspace:e,unmerged:t}){let n=w(t=>t.workspaceMergePreview[e.id]),r=w(e=>e.fetchWorkspaceMergePreview),i=t>0&&R.has(e.status);return(0,P.useEffect)(()=>{i&&n===void 0&&r(e.id)},[i,n,e.id,r]),!i||n===void 0||n.available===!1?null:n.conflict?(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5 text-amber-400`,title:`Merging into ${n.baseRef||`base`} would conflict — resolve before merging`,children:[(0,F.jsx)(v,{className:`h-3 w-3`}),`conflict`]}):n.conflict===!1?(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5 text-emerald-400`,title:`Clean to merge via ${n.strategy===`pr`?`PR`:`rebase + fast-forward`} into ${n.baseRef||`base`}`,children:[(0,F.jsx)(d,{className:`h-3 w-3`}),n.strategy===`pr`?`PR ready`:`clean`]}):null}function Z({workspace:e}){let n=C(),r=w(t=>t.workspaceGitState[e.id]),i=w(e=>e.fetchWorkspaceGitState),a=e.mode===`isolated`&&!!e.worktreePath&&L.has(e.status);if((0,P.useEffect)(()=>{a&&r===void 0&&i(e.id)},[a,r,e.id,i]),!a)return null;let s=(0,F.jsx)(k,{size:`icon-sm`,variant:`ghost`,className:`h-5 w-5`,title:`Refresh git state`,onClick:()=>void i(e.id),children:(0,F.jsx)(o,{className:`h-3 w-3`})});if(r===void 0)return(0,F.jsx)(`div`,{className:`flex items-center gap-1 text-[11px] text-muted-foreground`,children:`Loading git state…`});if(r.available===!1)return(0,F.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] text-muted-foreground`,title:r.reason,children:[(0,F.jsx)(`span`,{children:`git state unavailable`}),s]});if(r.missing)return(0,F.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] text-muted-foreground`,children:[`worktree gone `,s]});if(r.error)return(0,F.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] text-red-400`,title:r.error,children:[(0,F.jsx)(`span`,{children:`git error`}),s]});let c=r.ahead??0,l=r.landed===!0,u=l?0:r.unmergedAhead??c,p=r.behind??0,m=r.dirtyCount??0,h=u===0&&m===0&&!l,g=r.lastCommit;return(0,F.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11px]`,children:[h?(0,F.jsx)(`span`,{className:`text-muted-foreground`,children:`no unmerged work`}):(0,F.jsxs)(F.Fragment,{children:[l?(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5 text-emerald-400`,title:`Work already landed in ${r.baseRef||`base`} via squash/cherry-pick — safe to clean up`,children:[(0,F.jsx)(d,{className:`h-3 w-3`}),`landed`]}):(0,F.jsxs)(`span`,{className:u>0?`flex items-center text-emerald-400`:`flex items-center text-muted-foreground`,title:c===u?`${u} commit(s) ahead of base`:`${u} unmerged commit(s) (${c} ahead of base)`,children:[(0,F.jsx)(S,{className:`h-3 w-3`}),u]}),(0,F.jsxs)(`span`,{className:p>0?`flex items-center text-amber-400`:`flex items-center text-muted-foreground`,title:`${p} commit(s) behind base`,children:[(0,F.jsx)(b,{className:`h-3 w-3`}),p]}),m>0&&(0,F.jsxs)(`span`,{className:`flex items-center text-orange-400`,title:`${m} uncommitted change(s)`,children:[(0,F.jsx)(t,{className:`h-3 w-3`}),m]}),!l&&(0,F.jsx)(X,{workspace:e,unmerged:u})]}),s]}),g&&(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 text-[11px] text-muted-foreground`,title:`${g.sha.slice(0,8)} — ${g.message}`,children:[(0,F.jsx)(f,{className:`h-3 w-3 shrink-0`}),(0,F.jsx)(`span`,{className:`truncate`,children:g.message||g.sha.slice(0,8)}),g.at?(0,F.jsxs)(`span`,{className:`shrink-0 opacity-70`,children:[`· `,T(n,g.at)]}):null]})]})}function Q({workspace:e}){let t=C(),n=typeof e.metadata?.mergedAt==`number`?e.metadata.mergedAt:void 0,r=[{label:`created`,at:e.createdAt},{label:`ready`,at:e.readyAt},{label:`merged`,at:n},{label:`cleaned`,at:e.cleanedAt}].filter(e=>typeof e.at==`number`&&e.at>0);return(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1 font-medium text-foreground`,children:[(0,F.jsx)(a,{className:`h-3 w-3`}),`Timeline`]}),r.map((e,n)=>(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[n>0&&(0,F.jsx)(`span`,{className:`opacity-40`,children:`→`}),(0,F.jsx)(`span`,{className:`text-foreground`,children:e.label}),(0,F.jsx)(`span`,{title:new Date(e.at).toLocaleString(),children:T(t,e.at)})]},e.label))]})}function te(e){return e.startsWith(`+`)&&!e.startsWith(`+++`)?`text-emerald-400`:e.startsWith(`-`)&&!e.startsWith(`---`)?`text-red-400`:e.startsWith(`@@`)?`text-cyan-400`:e.startsWith(`diff `)||e.startsWith(`index `)||e.startsWith(`+++`)||e.startsWith(`---`)?`text-muted-foreground`:``}function ne({workspace:e}){let t=w(t=>t.workspaceDiff[e.id]),n=w(e=>e.fetchWorkspaceDiff),r=e.mode===`isolated`&&!!e.worktreePath;if((0,P.useEffect)(()=>{r&&t===void 0&&n(e.id)},[r,t,e.id,n]),!r)return null;if(t===void 0)return(0,F.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:`Loading diff…`});if(t.available===!1)return(0,F.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[`Diff unavailable`,t.reason?`: ${t.reason}`:``]});if(t.missing)return(0,F.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:`Worktree no longer on disk`});if(t.error)return(0,F.jsxs)(`div`,{className:`text-[11px] text-red-400`,children:[`Diff error: `,t.error]});if(!t.files.length)return(0,F.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[`No committed changes against `,t.baseRef||`base`]});let i=(0,F.jsx)(k,{size:`icon-sm`,variant:`ghost`,className:`h-5 w-5`,title:`Refresh diff`,onClick:()=>void n(e.id),children:(0,F.jsx)(o,{className:`h-3 w-3`})});return(0,F.jsxs)(`div`,{className:`space-y-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium`,children:[(0,F.jsx)(s,{className:`h-3 w-3`}),(0,F.jsxs)(`span`,{children:[t.files.length,` file`,t.files.length===1?``:`s`,` vs `,t.baseRef||`base`]}),i]}),(0,F.jsx)(`ul`,{className:`space-y-0.5 text-[11px]`,children:t.files.map(e=>(0,F.jsxs)(`li`,{className:`flex items-center gap-2 font-mono`,children:[(0,F.jsx)(`span`,{className:`truncate`,title:e.path,children:e.path}),e.binary?(0,F.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`binary`}):(0,F.jsxs)(`span`,{className:`shrink-0`,children:[(0,F.jsxs)(`span`,{className:`text-emerald-400`,children:[`+`,e.additions??0]}),` `,(0,F.jsxs)(`span`,{className:`text-red-400`,children:[`−`,e.deletions??0]})]})]},e.path))}),t.patch&&(0,F.jsxs)(`pre`,{className:`max-h-80 overflow-auto rounded border border-border bg-muted/30 p-2 text-[10.5px] leading-relaxed`,children:[t.patch.split(`
2
- `).map((e,t)=>(0,F.jsx)(`div`,{className:te(e),children:e||` `},t)),t.truncated&&(0,F.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:`… patch truncated`})]})]})}function $({workspace:e}){return(0,F.jsxs)(`div`,{className:`space-y-3 border-t border-dashed border-border bg-muted/20 px-3 py-3`,children:[(0,F.jsx)(Q,{workspace:e}),(0,F.jsx)(ne,{workspace:e})]})}function re(){let e=w(e=>e.workspaceOrphans),t=w(e=>e.fetchWorkspaceOrphans),r=w(e=>e.reclaimWorkspaceOrphan);return(0,P.useEffect)(()=>{t()},[t]),e.length?(0,F.jsxs)(N,{className:`border-amber-500/30`,children:[(0,F.jsxs)(M,{className:`px-4 py-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(u,{className:`h-4 w-4 text-amber-400`}),(0,F.jsx)(A,{className:`text-sm font-medium`,children:`Orphaned worktrees`}),(0,F.jsx)(O,{variant:`outline`,className:`border-amber-500/30 text-amber-400 text-[10px]`,children:e.length}),(0,F.jsx)(k,{size:`icon-sm`,variant:`ghost`,className:`ml-auto h-6 w-6`,title:`Rescan`,onClick:()=>void t(),children:(0,F.jsx)(o,{className:`h-3.5 w-3.5`})})]}),(0,F.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Agent worktrees on disk with no live workspace. Reclaim removes them from the host.`})]}),(0,F.jsx)(j,{className:`p-0`,children:e.map(e=>(0,F.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-border px-4 py-2 text-xs`,children:[(0,F.jsx)(x,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,F.jsx)(`span`,{className:`truncate font-medium`,title:e.branch,children:e.branch||`(detached)`}),(0,F.jsx)(`span`,{className:`truncate font-mono text-muted-foreground`,title:e.worktreePath,children:U(e.worktreePath)}),e.hadTerminalRow&&(0,F.jsx)(O,{variant:`outline`,className:`text-[10px]`,children:`cleanup failed`}),(0,F.jsxs)(k,{size:`sm`,variant:`outline`,className:`ml-auto h-7 text-xs`,onClick:()=>void r(e),children:[(0,F.jsx)(n,{className:`mr-1 h-3.5 w-3.5`}),`Reclaim`]})]},e.worktreePath))})]}):null}function ie(e){let t=e.match(/\/pull\/(\d+)/);return t?`PR #${t[1]}`:`View PR`}function ae({workspace:e}){let t=e.metadata?.mergeResult,n=t?.prUrl,r=t?.error||e.metadata?.mergeError;return!n&&!r?null:(0,F.jsxs)(F.Fragment,{children:[n&&(0,F.jsxs)(`a`,{href:n,target:`_blank`,rel:`noreferrer`,title:n,className:`inline-flex items-center gap-0.5 rounded border border-violet-500/30 px-1.5 py-0 text-[10px] text-violet-400 hover:text-violet-300`,children:[(0,F.jsx)(y,{className:`h-2.5 w-2.5`}),ie(n)]}),r&&(0,F.jsxs)(O,{variant:`outline`,className:`max-w-[16rem] border-amber-500/30 text-amber-400 text-[10px]`,title:r,children:[(0,F.jsx)(v,{className:`mr-0.5 h-2.5 w-2.5 shrink-0`}),(0,F.jsxs)(`span`,{className:`truncate`,children:[`merge: `,r]})]})]})}function oe({workspace:e}){let t=C(),[n,r]=(0,P.useState)(!1),i=w(e=>e.agentsById),a=w(t=>t.workspaceFocusId===e.id),o=e.ownerAgentId?i[e.ownerAgentId]:void 0,s=e.stewardAgentId?i[e.stewardAgentId]:void 0,c=e.worktreePath||e.sourceCwd||e.repoRoot,l=(0,P.useRef)(null);return(0,P.useEffect)(()=>{a&&l.current?.scrollIntoView({behavior:`smooth`,block:`center`})},[a]),(0,F.jsxs)(`div`,{ref:l,className:`border-t border-border ${a?`bg-primary/5 ring-1 ring-inset ring-primary/40`:``}`,children:[(0,F.jsxs)(`div`,{className:`grid gap-3 px-3 py-3 text-sm lg:grid-cols-[minmax(180px,1.2fr)_minmax(220px,1.5fr)_minmax(160px,1fr)_minmax(170px,auto)]`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,F.jsx)(x,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,F.jsx)(`span`,{className:`truncate font-medium`,title:e.branch||e.id,children:e.branch||e.id})]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,F.jsx)(O,{variant:`outline`,className:`text-[10px] ${e.mode===`isolated`?`border-sky-500/30 text-sky-400`:`border-zinc-500/30 text-zinc-400`}`,children:e.mode}),e.requestedMode&&e.requestedMode!==e.mode&&(0,F.jsxs)(O,{variant:`outline`,className:`text-[10px]`,children:[`requested `,e.requestedMode]}),(0,F.jsx)(O,{variant:`outline`,className:`text-[10px] ${G(e.status)}`,children:B[e.status]||e.status}),(0,F.jsx)(ae,{workspace:e})]})]}),(0,F.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,F.jsx)(`div`,{className:`truncate font-mono text-xs`,title:c,children:U(c)}),(0,F.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,title:e.sourceCwd,children:e.sourceCwd}),(0,F.jsx)(Z,{workspace:e})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-[4.5rem_minmax(0,1fr)] gap-x-2 gap-y-1 text-xs`,children:[(0,F.jsx)(`span`,{className:`text-muted-foreground`,children:`Owner`}),(0,F.jsx)(`span`,{className:`truncate`,title:e.ownerAgentId,children:W(o,e.ownerPolicyName||e.ownerAgentId)}),(0,F.jsx)(`span`,{className:`text-muted-foreground`,children:`Steward`}),(0,F.jsx)(`span`,{className:`truncate`,title:e.stewardAgentId,children:W(s,e.stewardAgentId)}),(0,F.jsx)(`span`,{className:`text-muted-foreground`,children:`Updated`}),(0,F.jsx)(`span`,{children:T(t,e.updatedAt)}),e.baseRef&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`text-muted-foreground`,children:`Base`}),(0,F.jsx)(`span`,{className:`truncate`,title:e.baseSha,children:e.baseRef})]})]}),(0,F.jsx)(Y,{workspace:e,expanded:n,onToggleDetails:()=>r(e=>!e)})]}),n&&(0,F.jsx)($,{workspace:e})]})}function se({repoRoot:e,workspaces:t}){let n=t.filter(e=>I.has(e.status)).length,r=t.filter(e=>e.status===`ready`||e.status===`review_requested`||e.status===`merge_planned`).length,i=t.filter(e=>e.status===`conflict`).length;return(0,F.jsxs)(N,{children:[(0,F.jsx)(M,{className:`px-4 py-3`,children:(0,F.jsx)(`div`,{className:`flex min-w-0 items-start gap-3`,children:(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(A,{className:`truncate text-sm font-medium`,title:e,children:e}),(0,F.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:[(0,F.jsxs)(O,{variant:`outline`,className:`text-[10px]`,children:[t.length,` total`]}),(0,F.jsxs)(O,{variant:`outline`,className:`text-[10px]`,children:[n,` live`]}),r>0&&(0,F.jsxs)(O,{variant:`outline`,className:`border-emerald-500/20 text-emerald-400 text-[10px]`,children:[r,` merge signal`]}),i>0&&(0,F.jsxs)(O,{variant:`outline`,className:`border-red-500/20 text-red-400 text-[10px]`,children:[i,` conflict`]})]})]})})}),(0,F.jsx)(j,{className:`p-0`,children:t.map(e=>(0,F.jsx)(oe,{workspace:e},e.id))})]})}function ce(){let[e,t]=(0,P.useState)(`active`),n=w(e=>e.workspaces),r=w(e=>e.set),i=w(e=>e.workspaceFocusId);(0,P.useEffect)(()=>{i&&t(`all`)},[i]),(0,P.useEffect)(()=>()=>{r({workspaceFocusId:null})},[r]);let a=(0,P.useMemo)(()=>J(n,e),[n,e]),o=(0,P.useMemo)(()=>q(a),[a]),s=n.filter(e=>I.has(e.status)).length,c=n.filter(e=>e.mode===`isolated`).length,l=n.filter(e=>e.status===`ready`||e.status===`review_requested`||e.status===`merge_planned`).length,u=n.filter(e=>e.status===`conflict`).length,d=n.filter(e=>H.has(e.status)).length,f=[{key:`active`,label:`Active`,count:n.length-d},{key:`cleaned`,label:`Done`,count:d},{key:`all`,label:`All`,count:n.length}];return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Workspaces`}),(0,F.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Agent worktrees, ownership, and merge readiness.`})]}),(0,F.jsxs)(`div`,{className:`ml-auto flex flex-wrap gap-1.5`,children:[(0,F.jsxs)(O,{variant:`outline`,children:[c,` isolated`]}),(0,F.jsxs)(O,{variant:`outline`,children:[s,` live`]}),(0,F.jsxs)(O,{variant:`outline`,children:[l,` ready`]}),u>0&&(0,F.jsxs)(O,{variant:`outline`,className:`border-red-500/20 text-red-400`,children:[u,` conflict`]})]})]}),(0,F.jsx)(re,{}),(0,F.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,F.jsx)(`div`,{className:`flex rounded-md border border-border bg-card p-1`,children:f.map(n=>(0,F.jsxs)(k,{size:`sm`,variant:e===n.key?`secondary`:`ghost`,className:`h-7 text-xs`,onClick:()=>t(n.key),children:[n.label,(0,F.jsx)(`span`,{className:`ml-1 text-muted-foreground`,children:n.count})]},n.key))})}),o.length===0?(0,F.jsxs)(`div`,{className:`rounded-md border border-border px-3 py-12 text-center text-sm text-muted-foreground`,children:[`No `,e===`all`?``:e,` workspaces`]}):(0,F.jsx)(`div`,{className:`space-y-3`,children:o.map(e=>(0,F.jsx)(se,{repoRoot:e.repoRoot,workspaces:e.workspaces},e.repoRoot))})]})}export{ce as WorkspacesView};
3
- //# sourceMappingURL=workspaces-PdCwiSQx.js.map