agent-relay-server 0.75.0 → 0.77.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 (139) hide show
  1. package/docs/openapi.json +94 -1
  2. package/package.json +2 -2
  3. package/public/assets/MessageBubble-Ct4RjObq.js +3 -0
  4. package/public/assets/{MessageBubble-opNe8Lu2.js.map → MessageBubble-Ct4RjObq.js.map} +1 -1
  5. package/public/assets/{PlanGraphPanel-_mpO-kEh.js → PlanGraphPanel-BQcLye6d.js} +2 -2
  6. package/public/assets/{PlanGraphPanel-_mpO-kEh.js.map → PlanGraphPanel-BQcLye6d.js.map} +1 -1
  7. package/public/assets/{activity-B079s-aD.js → activity-DeQhQ17b.js} +2 -2
  8. package/public/assets/{activity-B079s-aD.js.map → activity-DeQhQ17b.js.map} +1 -1
  9. package/public/assets/{agent-profiles-D1X5BBW_.js → agent-profiles-DwR6zuEJ.js} +2 -2
  10. package/public/assets/{agent-profiles-D1X5BBW_.js.map → agent-profiles-DwR6zuEJ.js.map} +1 -1
  11. package/public/assets/{agents-kkvfOptR.js → agents-coulRN38.js} +2 -2
  12. package/public/assets/{agents-kkvfOptR.js.map → agents-coulRN38.js.map} +1 -1
  13. package/public/assets/{analytics-e_HOZBPx.js → analytics-BTq4XQiF.js} +3 -3
  14. package/public/assets/{analytics-e_HOZBPx.js.map → analytics-BTq4XQiF.js.map} +1 -1
  15. package/public/assets/{automation-B4CAzi64.js → automation-V97mnoZp.js} +2 -2
  16. package/public/assets/{automation-B4CAzi64.js.map → automation-V97mnoZp.js.map} +1 -1
  17. package/public/assets/{badge-YQhT30dy.js → badge-BxG6_yfp.js} +2 -2
  18. package/public/assets/{badge-YQhT30dy.js.map → badge-BxG6_yfp.js.map} +1 -1
  19. package/public/assets/branch-state-badge-DaCW_qGP.js +2 -0
  20. package/public/assets/{branch-state-badge-B7T81Oct.js.map → branch-state-badge-DaCW_qGP.js.map} +1 -1
  21. package/public/assets/{button-CaFI76Ja.js → button-D5k3GbF6.js} +2 -2
  22. package/public/assets/{button-CaFI76Ja.js.map → button-D5k3GbF6.js.map} +1 -1
  23. package/public/assets/{card-B_fQtKce.js → card-DKyFtrez.js} +2 -2
  24. package/public/assets/{card-B_fQtKce.js.map → card-DKyFtrez.js.map} +1 -1
  25. package/public/assets/{channels-BAD_kIo7.js → channels-EHZtUB_U.js} +2 -2
  26. package/public/assets/{channels-BAD_kIo7.js.map → channels-EHZtUB_U.js.map} +1 -1
  27. package/public/assets/chat-B8fs8r1x.js +2 -0
  28. package/public/assets/{chat-ZfR8BvTL.js.map → chat-B8fs8r1x.js.map} +1 -1
  29. package/public/assets/{connectors-Cdjtxly2.js → connectors-B3BbETXb.js} +2 -2
  30. package/public/assets/{connectors-Cdjtxly2.js.map → connectors-B3BbETXb.js.map} +1 -1
  31. package/public/assets/copy-button-D3XAkVC2.js +2 -0
  32. package/public/assets/{copy-button-m00JmflM.js.map → copy-button-D3XAkVC2.js.map} +1 -1
  33. package/public/assets/dist-B9_RgXN9.js +2 -0
  34. package/public/assets/{dist-DfQP9-VC.js.map → dist-B9_RgXN9.js.map} +1 -1
  35. package/public/assets/dist-BuYGwGZ-.js +2 -0
  36. package/public/assets/{dist-CydxJz3m.js.map → dist-BuYGwGZ-.js.map} +1 -1
  37. package/public/assets/{dist-ChP4KvKi.js → dist-CAu7-DrN.js} +2 -2
  38. package/public/assets/{dist-ChP4KvKi.js.map → dist-CAu7-DrN.js.map} +1 -1
  39. package/public/assets/{dist-DeAdFM5_.js → dist-CF2meFCY.js} +2 -2
  40. package/public/assets/{dist-DeAdFM5_.js.map → dist-CF2meFCY.js.map} +1 -1
  41. package/public/assets/{dist-B_yrHbsb.js → dist-CR7zKC1F.js} +2 -2
  42. package/public/assets/{dist-B_yrHbsb.js.map → dist-CR7zKC1F.js.map} +1 -1
  43. package/public/assets/{dist-C-viWls-.js → dist-CUxt3gHd.js} +2 -2
  44. package/public/assets/{dist-C-viWls-.js.map → dist-CUxt3gHd.js.map} +1 -1
  45. package/public/assets/{dist-D8Yr1AIJ.js → dist-D1Bwx4cc.js} +2 -2
  46. package/public/assets/{dist-D8Yr1AIJ.js.map → dist-D1Bwx4cc.js.map} +1 -1
  47. package/public/assets/{dist-Cnlh_NpI.js → dist-D32lF-j6.js} +2 -2
  48. package/public/assets/{dist-Cnlh_NpI.js.map → dist-D32lF-j6.js.map} +1 -1
  49. package/public/assets/{dist-DeM72J6a.js → dist-DDrB3y1I.js} +2 -2
  50. package/public/assets/{dist-DeM72J6a.js.map → dist-DDrB3y1I.js.map} +1 -1
  51. package/public/assets/dist-DPQKhU73.js +2 -0
  52. package/public/assets/{dist-CYS2puT9.js.map → dist-DPQKhU73.js.map} +1 -1
  53. package/public/assets/{dist-D7K3qgp7.js → dist-YjHj0NpU.js} +2 -2
  54. package/public/assets/{dist-D7K3qgp7.js.map → dist-YjHj0NpU.js.map} +1 -1
  55. package/public/assets/{es2015-C3DnXBqu.js → es2015-WF4MRcZQ.js} +2 -2
  56. package/public/assets/{es2015-C3DnXBqu.js.map → es2015-WF4MRcZQ.js.map} +1 -1
  57. package/public/assets/{formatted-body-impl-Bunmh796.js → formatted-body-impl-CQ-8HQ7u.js} +2 -2
  58. package/public/assets/{formatted-body-impl-Bunmh796.js.map → formatted-body-impl-CQ-8HQ7u.js.map} +1 -1
  59. package/public/assets/index-DJtda8l2.js +22 -0
  60. package/public/assets/index-DJtda8l2.js.map +1 -0
  61. package/public/assets/index-DvNy9IVg.css +2 -0
  62. package/public/assets/{input-Cqqq0OFl.js → input-DSJQbsdS.js} +2 -2
  63. package/public/assets/{input-Cqqq0OFl.js.map → input-DSJQbsdS.js.map} +1 -1
  64. package/public/assets/{insights-D9KEB80Q.js → insights-CtT5cEif.js} +2 -2
  65. package/public/assets/{insights-D9KEB80Q.js.map → insights-CtT5cEif.js.map} +1 -1
  66. package/public/assets/{integrations-DzRla8mj.js → integrations-BWBxWl3k.js} +2 -2
  67. package/public/assets/{integrations-DzRla8mj.js.map → integrations-BWBxWl3k.js.map} +1 -1
  68. package/public/assets/{lib-6L4m0E3M.js → lib-BxQSXiQ7.js} +3 -3
  69. package/public/assets/{lib-6L4m0E3M.js.map → lib-BxQSXiQ7.js.map} +1 -1
  70. package/public/assets/{lucide-react-DI8kTavp.js → lucide-react-BH2ROV8n.js} +2 -2
  71. package/public/assets/{lucide-react-DI8kTavp.js.map → lucide-react-BH2ROV8n.js.map} +1 -1
  72. package/public/assets/{maintenance-C0sGj_Na.js → maintenance-BWLMjX8h.js} +2 -2
  73. package/public/assets/{maintenance-C0sGj_Na.js.map → maintenance-BWLMjX8h.js.map} +1 -1
  74. package/public/assets/{managed-agents-BQq9EXOq.js → managed-agents-KxHV0VcQ.js} +2 -2
  75. package/public/assets/{managed-agents-BQq9EXOq.js.map → managed-agents-KxHV0VcQ.js.map} +1 -1
  76. package/public/assets/{markdown-preview-impl-B6xOjT1c.js → markdown-preview-impl-C5b5cBM0.js} +2 -2
  77. package/public/assets/{markdown-preview-impl-B6xOjT1c.js.map → markdown-preview-impl-C5b5cBM0.js.map} +1 -1
  78. package/public/assets/{memory-CB6zkEnm.js → memory-Bh3UgQCk.js} +2 -2
  79. package/public/assets/{memory-CB6zkEnm.js.map → memory-Bh3UgQCk.js.map} +1 -1
  80. package/public/assets/{messages-DhQjlDGk.js → messages-Dg7TSxpZ.js} +2 -2
  81. package/public/assets/{messages-DhQjlDGk.js.map → messages-Dg7TSxpZ.js.map} +1 -1
  82. package/public/assets/{orchestrators-Ze5VJVFK.js → orchestrators-BBKW7bO0.js} +2 -2
  83. package/public/assets/{orchestrators-Ze5VJVFK.js.map → orchestrators-BBKW7bO0.js.map} +1 -1
  84. package/public/assets/{overview-KxPTf_aQ.js → overview-a8lG62AZ.js} +2 -2
  85. package/public/assets/{overview-KxPTf_aQ.js.map → overview-a8lG62AZ.js.map} +1 -1
  86. package/public/assets/{pairs-CKAQN-Mp.js → pairs-ChSYXFwu.js} +2 -2
  87. package/public/assets/{pairs-CKAQN-Mp.js.map → pairs-ChSYXFwu.js.map} +1 -1
  88. package/public/assets/{projects-DluLrkwe.js → projects-DIN_O7AJ.js} +2 -2
  89. package/public/assets/{projects-DluLrkwe.js.map → projects-DIN_O7AJ.js.map} +1 -1
  90. package/public/assets/{react-dom-Ct8qXivQ.js → react-dom-B_tGtv3Y.js} +2 -2
  91. package/public/assets/{react-dom-Ct8qXivQ.js.map → react-dom-B_tGtv3Y.js.map} +1 -1
  92. package/public/assets/{security-BfN02cIU.js → security-D0obEjDT.js} +2 -2
  93. package/public/assets/{security-BfN02cIU.js.map → security-D0obEjDT.js.map} +1 -1
  94. package/public/assets/{select-2k89h2cU.js → select-DwCP2Jhh.js} +2 -2
  95. package/public/assets/{select-2k89h2cU.js.map → select-DwCP2Jhh.js.map} +1 -1
  96. package/public/assets/settings-f1l2R0e8.js +4 -0
  97. package/public/assets/{settings-CxHa6IHI.js.map → settings-f1l2R0e8.js.map} +1 -1
  98. package/public/assets/{store-D1K4_xId.js → store-m74m5eNF.js} +3 -3
  99. package/public/assets/{store-D1K4_xId.js.map → store-m74m5eNF.js.map} +1 -1
  100. package/public/assets/{tasks-B7S6eTJJ.js → tasks-DDVfmUst.js} +2 -2
  101. package/public/assets/{tasks-B7S6eTJJ.js.map → tasks-DDVfmUst.js.map} +1 -1
  102. package/public/assets/{teams-DPEBGRiy.js → teams-COZKriLe.js} +2 -2
  103. package/public/assets/{teams-DPEBGRiy.js.map → teams-COZKriLe.js.map} +1 -1
  104. package/public/assets/{terminal-viewer-impl-PeLYPKpp.js → terminal-viewer-impl-CjOZ__aw.js} +3 -3
  105. package/public/assets/{terminal-viewer-impl-PeLYPKpp.js.map → terminal-viewer-impl-CjOZ__aw.js.map} +1 -1
  106. package/public/assets/{use-keyboard-viewport-DxmCAbQi.js → use-keyboard-viewport-BVAU-Ud8.js} +2 -2
  107. package/public/assets/{use-keyboard-viewport-DxmCAbQi.js.map → use-keyboard-viewport-BVAU-Ud8.js.map} +1 -1
  108. package/public/assets/work-queue-BC7heUfD.js +2 -0
  109. package/public/assets/{work-queue-BI_d8G0U.js.map → work-queue-BC7heUfD.js.map} +1 -1
  110. package/public/assets/workspaces-CIGMb3ST.js +3 -0
  111. package/public/assets/{workspaces-B_nIm6Tw.js.map → workspaces-CIGMb3ST.js.map} +1 -1
  112. package/public/index.html +21 -21
  113. package/src/db/agents.ts +4 -46
  114. package/src/db/index.ts +1 -0
  115. package/src/db/migrations.ts +91 -1
  116. package/src/db/provider-quotas.ts +220 -0
  117. package/src/db/schema.ts +16 -1
  118. package/src/lifecycle-context-pressure.ts +98 -0
  119. package/src/lifecycle-manager.ts +21 -31
  120. package/src/quota.ts +14 -1
  121. package/src/routes/index.ts +3 -0
  122. package/src/routes/provider-quotas.ts +48 -0
  123. package/src/security.ts +1 -0
  124. package/src/token-db.ts +3 -3
  125. package/src/upgrade-local-id.ts +23 -0
  126. package/src/upgrade.ts +19 -27
  127. package/public/assets/MessageBubble-opNe8Lu2.js +0 -3
  128. package/public/assets/branch-state-badge-B7T81Oct.js +0 -2
  129. package/public/assets/chat-ZfR8BvTL.js +0 -2
  130. package/public/assets/copy-button-m00JmflM.js +0 -2
  131. package/public/assets/dist-CYS2puT9.js +0 -2
  132. package/public/assets/dist-CydxJz3m.js +0 -2
  133. package/public/assets/dist-DfQP9-VC.js +0 -2
  134. package/public/assets/index-CQQTCZxg.css +0 -2
  135. package/public/assets/index-DePqIpr0.js +0 -23
  136. package/public/assets/index-DePqIpr0.js.map +0 -1
  137. package/public/assets/settings-CxHa6IHI.js +0 -4
  138. package/public/assets/work-queue-BI_d8G0U.js +0 -2
  139. package/public/assets/workspaces-B_nIm6Tw.js +0 -3
@@ -1,4 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{B as t,Bn as n,Ht as r,K as i,L as a,Lt as o,N as s,O as c,Qn as l,Rn as u,Rt as d,T as f,Vn as p,an as m,b as h,c as g,m as _,sn as v,yn as y}from"./lucide-react-DI8kTavp.js";import{d as b,p as x,s as S,t as C}from"./store-D1K4_xId.js";import{J as ee,Z as w}from"./display-DHgdn4vN.js";import{t as T}from"./themes-mW9zZP4O.js";import{a as E,i as D,n as O,r as k,t as A}from"./select-2k89h2cU.js";import{t as j}from"./badge-YQhT30dy.js";import{t as M}from"./button-CaFI76Ja.js";import{t as N}from"./input-Cqqq0OFl.js";import{F as P,r as F}from"./index-DePqIpr0.js";import{a as I,i as L,n as R,o as z,r as B,t as V}from"./card-B_fQtKce.js";var H=e(l(),1);function U(e){return`${e.namespace}/${e.key}`}function te(e){return`/settings/${encodeURIComponent(e.namespace)}/${encodeURIComponent(e.key)}`}function ne(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`settings`}function re(e){let t=new Map;for(let n of e.filter(e=>e.readable)){let e=n.display?.group?.trim()||n.namespace;t.set(e,[...t.get(e)??[],n])}return[...t.entries()].map(([e,t])=>({group:e,slug:ne(e),settings:t.sort(ie)})).sort((e,t)=>ae(e.settings)-ae(t.settings)||e.group.localeCompare(t.group))}function ie(e,t){return(e.display?.order??2**53-1)-(t.display?.order??2**53-1)||e.display?.label?.localeCompare(t.display?.label??``)||U(e).localeCompare(U(t))}function ae(e){return Math.min(...e.map(e=>e.display?.order??2**53-1))}function W(e){return Array.isArray(e.type)?e.type.find(e=>e!==`null`):e.type}function G(e,t,n){if(!t.length)return n;let[r,...i]=t;if(r===void 0)return n;if(typeof r==`number`){let t=Array.isArray(e)?[...e]:[];return t[r]=G(t[r],i,n),t}let a=w(e)?{...e}:{},o=G(a[r],i,n);return o===void 0?delete a[r]:a[r]=o,a}function K(e){if(e.default!==void 0)return e.default;if(e.const!==void 0)return e.const;if(e.enum?.length)return e.enum[0];switch(W(e)){case`boolean`:return!1;case`integer`:case`number`:return 0;case`array`:return[];case`object`:return{};case`string`:return``;default:return}}function q(e){return e.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean)}function oe(e){return Array.isArray(e)?e.map(e=>String(e)).join(`
2
- `):``}function se(e){return w(e)?Object.entries(e).map(([e,t])=>`${e}=${String(t??``)}`).join(`
3
- `):``}function ce(e){return Object.fromEntries(e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.indexOf(`=`);return t>=0?[e.slice(0,t).trim(),e.slice(t+1)]:[e,``]}))}var J=n(),le=`__unset__`;function ue(e){return e===`server-runtime`?`Server runtime`:e===`bootstrap`?`Bootstrap`:`Browser`}function de(e){return e===`server-runtime`?`Stored by Relay and mutable while the server is running.`:e===`bootstrap`?`Read from startup configuration; restart or host config changes are required.`:`Stored only in this browser profile.`}function fe(e){return e===`browser`?(0,J.jsx)(i,{className:`size-3.5`}):(0,J.jsx)(f,{className:`size-3.5`})}function Y(e){return e.details??[]}function pe({group:e,settings:t,onSaved:n}){let r=[...new Set(t.map(e=>e.tier))];return(0,J.jsxs)(`section`,{className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold`,children:e}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:r.map(e=>(0,J.jsxs)(j,{variant:`outline`,className:`gap-1`,title:de(e),children:[fe(e),ue(e)]},e))})]}),t.length===0?(0,J.jsx)(V,{size:`sm`,children:(0,J.jsx)(B,{className:`text-sm text-muted-foreground`,children:`No settings in this group.`})}):(0,J.jsx)(`div`,{className:`space-y-3`,children:t.map(e=>(0,J.jsx)(me,{setting:e,onSaved:n},U(e)))})]})}function me({setting:e,onSaved:t}){let[n,r]=(0,H.useState)(()=>e.value??e.defaults??K(e.schema)),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(``),[l,u]=(0,H.useState)([]),d=e.writable&&e.tier===`server-runtime`;function f(e,t){r(n=>G(n,e,t)),u([]),s(``)}async function h(){if(d){a(!0),u([]),s(``);try{let i=await p(`PUT`,te(e),{value:n,updatedBy:`dashboard`});r(i.value),t(i),s(`Saved`)}catch(e){let t=Y(e);u(t.length?t:[e.message])}finally{a(!1)}}}return(0,J.jsxs)(V,{size:`sm`,children:[(0,J.jsxs)(I,{children:[(0,J.jsxs)(z,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[e.display.label,(0,J.jsxs)(j,{variant:`outline`,className:`gap-1`,title:de(e.tier),children:[fe(e.tier),ue(e.tier)]}),!e.writable&&(0,J.jsx)(j,{variant:`secondary`,children:`Read only`})]}),e.display.description&&(0,J.jsx)(L,{children:e.display.description}),(0,J.jsx)(R,{children:(0,J.jsxs)(M,{size:`sm`,onClick:h,disabled:!d||i,children:[(0,J.jsx)(c,{className:`size-4`}),i?`Saving`:`Save`]})})]}),(0,J.jsxs)(B,{className:`space-y-3`,children:[(0,J.jsx)(he,{schema:e.schema,value:n,path:[],label:e.display.label,required:!0,disabled:!d||i,onChange:f}),(0,J.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-[11px] text-muted-foreground`,children:[(0,J.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono`,children:[e.namespace,`/`,e.key]}),(0,J.jsxs)(`span`,{children:[`read `,(0,J.jsx)(`span`,{className:`text-foreground/70`,children:e.scope.read})]}),(0,J.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,J.jsxs)(`span`,{children:[`write `,(0,J.jsx)(`span`,{className:`text-foreground/70`,children:e.scope.write})]})]}),l.length>0&&(0,J.jsxs)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,J.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 font-medium`,children:[(0,J.jsx)(v,{className:`size-4`}),`Save failed`]}),(0,J.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:l.map(e=>(0,J.jsx)(`li`,{children:e},e))})]}),o&&(0,J.jsxs)(`p`,{className:`flex items-center gap-1 text-sm text-emerald-500`,children:[(0,J.jsx)(m,{className:`size-4`}),o]})]})]})}function he(e){let{schema:t,value:n,path:r,label:i,required:a,disabled:o,onChange:s}=e,c=W(t);if(t.enum?.length){let e=n==null||n===``?le:String(n);return(0,J.jsx)(X,{label:i,description:t.description,children:(0,J.jsxs)(A,{value:e,onValueChange:e=>s(r,e===`__unset__`?void 0:e),disabled:o,children:[(0,J.jsx)(D,{children:(0,J.jsx)(E,{})}),(0,J.jsxs)(O,{children:[!a&&(0,J.jsx)(k,{value:`__unset__`,children:`Not set`}),t.enum.map(e=>(0,J.jsx)(k,{value:String(e),children:String(e)},String(e)))]})]})})}if(c===`boolean`)return(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border bg-muted/20 p-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-medium`,children:i}),t.description&&(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.description})]}),(0,J.jsx)(P,{checked:!!n,onCheckedChange:e=>s(r,e),disabled:o})]});if(c===`integer`||c===`number`)return(0,J.jsx)(X,{label:i,description:t.description,children:(0,J.jsx)(N,{type:`number`,min:typeof t.minimum==`number`?t.minimum:void 0,max:typeof t.maximum==`number`?t.maximum:void 0,step:c===`integer`?1:`any`,value:typeof n==`number`?n:``,disabled:o,onChange:e=>s(r,e.target.value===``&&!a?void 0:Number(e.target.value))})});if(c===`array`)return(0,J.jsx)(X,{label:i,description:t.description??`One item per line.`,children:(0,J.jsx)(F,{rows:Math.min(8,Math.max(3,Array.isArray(n)?n.length+1:3)),value:oe(n),disabled:o,onChange:e=>s(r,q(e.target.value))})});if(c===`object`){let e=t.properties??{},a=new Set(t.required??[]);return Object.keys(e).length===0&&t.additionalProperties?(0,J.jsx)(X,{label:i,description:t.description??`KEY=value, one entry per line.`,children:(0,J.jsx)(F,{rows:5,value:se(n),disabled:o,onChange:e=>s(r,ce(e.target.value))})}):(0,J.jsxs)(`div`,{className:`space-y-3`,children:[r.length>0&&(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-medium`,children:i}),t.description&&(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.description})]}),(0,J.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:Object.entries(e).map(([e,t])=>{let i=w(n)?n[e]:void 0;return(0,J.jsx)(he,{schema:t,value:i===void 0&&a.has(e)?K(t):i,path:[...r,e],label:t.title||ge(e),required:a.has(e),disabled:o,onChange:s},e)})})]})}return(0,J.jsx)(X,{label:i,description:t.description,children:(0,J.jsx)(N,{value:typeof n==`string`?n:n==null?``:String(n),disabled:o,onChange:e=>s(r,e.target.value===``&&!a?void 0:e.target.value)})})}function X({label:e,description:t,children:n}){return(0,J.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:e}),n,t&&(0,J.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:t})]})}function ge(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).replace(/^\w/,e=>e.toUpperCase())}function _e(){let e=C(e=>e.theme),t=C(e=>e.showReasoning),n=C(e=>e.set);return(0,J.jsxs)(`section`,{className:`space-y-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold`,children:`Browser preferences`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`These are stored in local dashboard state, not in Relay server config.`})]}),(0,J.jsxs)(V,{size:`sm`,children:[(0,J.jsxs)(I,{children:[(0,J.jsx)(z,{className:`text-sm`,children:`Dashboard display`}),(0,J.jsx)(L,{className:`text-xs`,children:`Browser tier · persisted in this browser profile.`}),(0,J.jsx)(R,{children:(0,J.jsxs)(j,{variant:`outline`,className:`gap-1`,children:[(0,J.jsx)(i,{className:`size-3.5`}),`Browser`]})})]}),(0,J.jsxs)(B,{className:`grid gap-3 md:grid-cols-2`,children:[(0,J.jsx)(X,{label:`Theme`,children:(0,J.jsxs)(A,{value:e,onValueChange:e=>n({theme:e}),children:[(0,J.jsx)(D,{children:(0,J.jsx)(E,{})}),(0,J.jsx)(O,{children:T.map(e=>(0,J.jsx)(k,{value:e.id,children:e.label},e.id))})]})}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border bg-muted/20 p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(y,{className:`size-4`}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-medium`,children:`Show reasoning details`}),(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Display captured reasoning/tool steps in chat. Server capture is controlled separately by provider reasoningCapture.`})]})]}),(0,J.jsx)(P,{checked:t,onCheckedChange:e=>n({showReasoning:e})})]})]})]}),(0,J.jsx)(ve,{})]})}function ve(){let e=C(e=>e.voiceTtsEnabled),t=C(e=>e.setVoiceTtsEnabled),n=C(e=>e.voiceTtsMode),r=C(e=>e.setVoiceTtsMode),i=C(e=>e.voiceTtsKokoroVoice),a=C(e=>e.setVoiceTtsKokoroVoice),o=C(e=>e.voiceTtsBrowserVoice),s=C(e=>e.setVoiceTtsBrowserVoice),c=C(e=>e.voiceInputMode),l=C(e=>e.setVoiceInputMode),[u,d]=(0,H.useState)(()=>x());(0,H.useEffect)(()=>{if(typeof window>`u`||!(`speechSynthesis`in window))return;let e=()=>d(x());return e(),window.speechSynthesis.addEventListener?.(`voiceschanged`,e),()=>window.speechSynthesis.removeEventListener?.(`voiceschanged`,e)},[]);let f=b.some(e=>e.id===i)?b:[...b,{id:i,label:i}];return(0,J.jsxs)(V,{size:`sm`,children:[(0,J.jsxs)(I,{children:[(0,J.jsxs)(z,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(g,{className:`size-4`}),`Voice`]}),(0,J.jsx)(L,{className:`text-xs`,children:`Browser tier TTS and push-to-talk behavior.`}),(0,J.jsx)(R,{children:(0,J.jsx)(P,{checked:e,onCheckedChange:t})})]}),(0,J.jsxs)(B,{className:`grid gap-3 md:grid-cols-2`,children:[(0,J.jsx)(X,{label:`Speech engine`,children:(0,J.jsxs)(A,{value:n,onValueChange:e=>r(e),children:[(0,J.jsx)(D,{children:(0,J.jsx)(E,{})}),(0,J.jsxs)(O,{children:[(0,J.jsx)(k,{value:`kokoro`,children:`Kokoro (server, fallback to browser)`}),(0,J.jsx)(k,{value:`browser`,children:`Browser Web Speech API`})]})]})}),(0,J.jsx)(X,{label:`Kokoro voice`,children:(0,J.jsxs)(A,{value:i,onValueChange:a,children:[(0,J.jsx)(D,{children:(0,J.jsx)(E,{})}),(0,J.jsx)(O,{children:f.map(e=>(0,J.jsx)(k,{value:e.id,children:e.label},e.id))})]})}),(0,J.jsx)(X,{label:`Browser voice`,children:(0,J.jsxs)(A,{value:o||`__unset__`,onValueChange:e=>s(e===`__unset__`?``:e),children:[(0,J.jsx)(D,{children:(0,J.jsx)(E,{})}),(0,J.jsxs)(O,{children:[(0,J.jsx)(k,{value:le,children:`System default`}),u.map(e=>(0,J.jsx)(k,{value:e.uri,children:e.label},e.uri))]})]})}),(0,J.jsx)(X,{label:`Push-to-talk input`,children:(0,J.jsxs)(A,{value:c,onValueChange:e=>l(e),children:[(0,J.jsx)(D,{children:(0,J.jsx)(E,{})}),(0,J.jsxs)(O,{children:[(0,J.jsx)(k,{value:`compose`,children:`Fill message box`}),(0,J.jsx)(k,{value:`autosend`,children:`Send immediately`})]})]})})]})]})}function ye({catalog:e,error:n,canWrite:r,onCatalog:i}){let s=e[0]?.provider??`codex`,[c,l]=(0,H.useState)(s),[u,g]=(0,H.useState)(()=>Z(s)),[v,y]=(0,H.useState)(``),[b,x]=(0,H.useState)([]),S=e.some(e=>e.provider===c)?c:s,C=e.find(e=>e.provider===S)??e[0],ee=e.map(e=>e.provider);function w(e){g(t=>({...t,...e})),x([]),y(``)}function T(e){l(e),g(Z(e)),x([]),y(``)}async function E(){i((await p(`GET`,`/providers`)).catalog)}async function D(){if(r){x([]),y(``);try{await p(`PUT`,`/providers/${encodeURIComponent(u.provider)}/models/${encodeURIComponent(u.alias)}`,{label:u.label,providerModel:u.providerModel,efforts:q(u.efforts),defaultEffort:u.defaultEffort.trim()||void 0,limits:u.limits,capabilities:u.capabilities,contextThreshold:be(u),disabled:u.disabled,updatedBy:`dashboard`}),await E(),y(`${u.alias} saved`),g(Z(u.provider))}catch(e){let t=Y(e);x(t.length?t:[e.message])}}}async function O(e,t){if(r){x([]),y(``);try{await p(`PATCH`,`/providers/${encodeURIComponent(S)}/models/${encodeURIComponent(e.alias)}`,{disabled:t,updatedBy:`dashboard`}),await E(),y(`${e.alias} ${t?`disabled`:`enabled`}`)}catch(e){let t=Y(e);x(t.length?t:[e.message])}}}async function k(e){if(r){x([]),y(``);try{await p(`DELETE`,`/providers/${encodeURIComponent(S)}/models/${encodeURIComponent(e.alias)}`),await E(),y(`${e.alias} removed`)}catch(e){let t=Y(e);x(t.length?t:[e.message])}}}function A(e){g({provider:S,alias:e.alias,label:e.label,providerModel:e.providerModel,efforts:e.efforts.join(`, `),defaultEffort:e.defaultEffort??``,selfCompactUtilization:e.contextThreshold?.selfCompactUtilization?.toString()??``,warnUtilization:e.contextThreshold?.warnUtilization?.toString()??``,hardBackstopUtilization:e.contextThreshold?.hardBackstopUtilization?.toString()??``,disabled:!!e.disabled,limits:e.limits,capabilities:e.capabilities}),x([]),y(``)}return n?(0,J.jsx)(V,{size:`sm`,children:(0,J.jsxs)(B,{className:`text-sm text-muted-foreground`,children:[(0,J.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 font-medium text-foreground`,children:[(0,J.jsx)(h,{className:`size-4`}),`Model catalog`]}),n]})}):(0,J.jsxs)(`section`,{className:`space-y-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold`,children:`Model catalog`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Add override models, disable unavailable models, or remove custom entries from the provider catalog.`})]}),!r&&(0,J.jsx)(j,{variant:`secondary`,children:`Read only: needs settings:write:provider`})]}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ee.map(e=>(0,J.jsx)(M,{variant:e===S?`default`:`outline`,size:`sm`,onClick:()=>T(e),children:e},e))}),(0,J.jsxs)(V,{size:`sm`,children:[(0,J.jsxs)(I,{children:[(0,J.jsx)(z,{className:`text-sm`,children:`Add or edit model`}),(0,J.jsx)(R,{children:(0,J.jsxs)(j,{variant:`outline`,className:`gap-1`,children:[(0,J.jsx)(f,{className:`size-3.5`}),`Server runtime`]})})]}),(0,J.jsxs)(B,{className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,J.jsx)(X,{label:`Alias`,children:(0,J.jsx)(N,{value:u.alias,disabled:!r,placeholder:`nightly`,onChange:e=>w({alias:e.target.value.trim()})})}),(0,J.jsx)(X,{label:`Label`,children:(0,J.jsx)(N,{value:u.label,disabled:!r,placeholder:`Nightly Codex`,onChange:e=>w({label:e.target.value})})}),(0,J.jsx)(X,{label:`Provider model`,children:(0,J.jsx)(N,{value:u.providerModel,disabled:!r,placeholder:`codex-nightly`,onChange:e=>w({providerModel:e.target.value})})}),(0,J.jsx)(X,{label:`Efforts`,children:(0,J.jsx)(N,{value:u.efforts,disabled:!r,placeholder:`low, medium, high`,onChange:e=>w({efforts:e.target.value})})}),(0,J.jsx)(X,{label:`Default effort`,children:(0,J.jsx)(N,{value:u.defaultEffort,disabled:!r,placeholder:`medium`,onChange:e=>w({defaultEffort:e.target.value})})}),(0,J.jsx)(X,{label:`Self compact utilization`,children:(0,J.jsx)(N,{value:u.selfCompactUtilization,disabled:!r,placeholder:`0.80`,inputMode:`decimal`,onChange:e=>w({selfCompactUtilization:e.target.value})})}),(0,J.jsx)(X,{label:`Warn utilization`,children:(0,J.jsx)(N,{value:u.warnUtilization,disabled:!r,placeholder:`default: self - 0.10`,inputMode:`decimal`,onChange:e=>w({warnUtilization:e.target.value})})}),(0,J.jsx)(X,{label:`Hard backstop utilization`,children:(0,J.jsx)(N,{value:u.hardBackstopUtilization,disabled:!r,placeholder:`0.90`,inputMode:`decimal`,onChange:e=>w({hardBackstopUtilization:e.target.value})})}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border bg-muted/20 p-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-medium`,children:`Disabled`}),(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Keep visible but unavailable for new launches.`})]}),(0,J.jsx)(P,{checked:u.disabled,disabled:!r,onCheckedChange:e=>w({disabled:e})})]})]}),(0,J.jsxs)(M,{onClick:D,disabled:!r||!u.alias||!u.label||!u.providerModel,children:[(0,J.jsx)(a,{className:`size-4`}),`Save model`]})]})]}),(0,J.jsxs)(`div`,{className:`space-y-2`,children:[C&&C.models.length===0&&(0,J.jsx)(V,{size:`sm`,children:(0,J.jsx)(B,{className:`text-sm text-muted-foreground`,children:`No models in this provider catalog yet.`})}),C?.models.map(e=>(0,J.jsx)(V,{size:`sm`,children:(0,J.jsxs)(B,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,J.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs`,children:e.alias}),e.disabled&&(0,J.jsx)(j,{variant:`secondary`,children:`Disabled`})]}),(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.providerModel,e.efforts.length>0?` · efforts ${e.efforts.join(`, `)}`:` · no effort levels`,e.defaultEffort?` · default ${e.defaultEffort}`:``,` · context ${xe(e)}`]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,J.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>A(e),children:[(0,J.jsx)(t,{className:`size-4`}),`Edit`]}),(0,J.jsxs)(M,{variant:`outline`,size:`sm`,disabled:!r,onClick:()=>void O(e,!e.disabled),children:[e.disabled?(0,J.jsx)(o,{className:`size-4`}):(0,J.jsx)(d,{className:`size-4`}),e.disabled?`Enable`:`Disable`]}),(0,J.jsxs)(M,{variant:`outline`,size:`sm`,disabled:!r,onClick:()=>void k(e),children:[(0,J.jsx)(_,{className:`size-4`}),`Remove`]})]})]})},e.alias))]}),b.length>0&&(0,J.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:(0,J.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:b.map(e=>(0,J.jsx)(`li`,{children:e},e))})}),v&&(0,J.jsxs)(`p`,{className:`flex items-center gap-1 text-sm text-emerald-500`,children:[(0,J.jsx)(m,{className:`size-4`}),v]})]})}function Z(e){return{provider:e,alias:``,label:``,providerModel:``,efforts:``,defaultEffort:``,selfCompactUtilization:``,warnUtilization:``,hardBackstopUtilization:``,disabled:!1}}function be(e){let t=Q(e.selfCompactUtilization,`Self compact utilization`),n=Q(e.warnUtilization,`Warn utilization`),r=Q(e.hardBackstopUtilization,`Hard backstop utilization`);if(!(t===void 0&&n===void 0&&r===void 0)){if(t===void 0)throw Error(`Self compact utilization is required when setting context thresholds`);return{selfCompactUtilization:t,...n===void 0?{}:{warnUtilization:n},...r===void 0?{}:{hardBackstopUtilization:r}}}}function Q(e,t){let n=e.trim();if(!n)return;let r=Number(n);if(!Number.isFinite(r))throw Error(`${t} must be a number`);return r}function xe(e){if(e.contextThreshold)return`self ${$(e.contextThreshold.selfCompactUtilization)}, warn ${$(e.contextThreshold.warnUtilization??Math.max(0,e.contextThreshold.selfCompactUtilization-.1))}`;let t=S(e.limits?.contextWindowTokens?.value);return`derived self ${$(t.selfCompactUtilization)}, warn ${$(t.warnUtilization)}`}function $(e){return`${Math.round(e*100)}%`}var Se=`browser`,Ce=`models`;function we(){if(typeof window>`u`)return``;let e=window.location.hash.replace(/^#/,``);return e.startsWith(`settings/`)?decodeURIComponent(e.slice(9)):``}function Te(e){if(typeof window>`u`)return;let t=new URL(window.location.href);t.hash=`settings/${encodeURIComponent(e)}`,window.history.pushState({},``,t)}function Ee(){let[e,t]=(0,H.useState)([]),[n,i]=(0,H.useState)(null),[a,o]=(0,H.useState)([]),[c,l]=(0,H.useState)(()=>we()),[d,f]=(0,H.useState)(!0),[m,h]=(0,H.useState)(``),[g,_]=(0,H.useState)(``);async function y(){f(!0),h(``),_(``);try{let[e,n,r]=await Promise.all([p(`GET`,`/settings`),p(`GET`,`/tokens/me`),p(`GET`,`/providers`).catch(e=>(_(e.message),{catalog:[]}))]);t(e.settings),i(n),o(r.catalog)}catch(e){h(e.message)}finally{f(!1)}}(0,H.useEffect)(()=>{y()},[]),(0,H.useEffect)(()=>{let e=()=>l(we());return window.addEventListener(`hashchange`,e),window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`hashchange`,e),window.removeEventListener(`popstate`,e)}},[]);let b=(0,H.useMemo)(()=>re(e),[e]),x=(0,H.useMemo)(()=>[...b.map(e=>({slug:e.slug,label:e.group,description:`${e.settings.length} schema setting${e.settings.length===1?``:`s`}`,kind:`descriptors`,settings:e.settings})),{slug:Se,label:`Browser`,description:`Local dashboard preferences`,kind:`browser`,settings:[]},{slug:Ce,label:`Models`,description:`Provider model catalog`,kind:`models`,settings:[]}],[b]),S=x.find(e=>e.slug===c)??x[0];function C(e){l(e),Te(e)}function w(e){t(t=>t.map(t=>U(t)===U(e)?e:t))}return(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Settings`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Schema-driven Relay settings, browser preferences, and model catalog controls.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n&&(0,J.jsxs)(j,{variant:`outline`,className:`gap-1`,children:[(0,J.jsx)(r,{className:`size-3`}),n.kind,`:`,n.actor]}),(0,J.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:d,children:[(0,J.jsx)(s,{className:u(`size-4`,d&&`animate-spin`)}),`Refresh`]})]})]}),m&&(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,J.jsx)(v,{className:`mt-0.5 size-4`}),(0,J.jsx)(`span`,{children:m})]}),(0,J.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[230px_minmax(0,1fr)]`,children:[(0,J.jsx)(`nav`,{className:`space-y-1 lg:sticky lg:top-4 lg:self-start`,children:x.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:u(`w-full rounded-md border px-3 py-2 text-left text-sm transition-colors`,S?.slug===e.slug?`border-primary/50 bg-primary/10 text-foreground`:`border-transparent hover:border-border hover:bg-accent`),onClick:()=>C(e.slug),children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:e.label}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.description})]},e.slug))}),(0,J.jsx)(`div`,{className:`min-w-0 space-y-4`,children:d&&!e.length?(0,J.jsx)(V,{size:`sm`,children:(0,J.jsx)(B,{className:`text-sm text-muted-foreground`,children:`Loading settings…`})}):S?.kind===`descriptors`?(0,J.jsx)(pe,{group:S.label,settings:S.settings,onSaved:w}):S?.kind===`browser`?(0,J.jsx)(_e,{}):(0,J.jsx)(ye,{catalog:a,error:g,canWrite:ee(n?.scopes,`settings:write:provider`),onCatalog:o})})]})]})}export{Ee as SettingsView};
4
- //# sourceMappingURL=settings-CxHa6IHI.js.map
@@ -1,2 +0,0 @@
1
- import{Bn as e,an as t,ct as n,gn as r,i}from"./lucide-react-DI8kTavp.js";import{l as a,t as o}from"./store-D1K4_xId.js";import{U as s,d as c,ut as l}from"./display-DHgdn4vN.js";import{t as u}from"./badge-YQhT30dy.js";import{t as d}from"./button-CaFI76Ja.js";import{B as f,K as p,s as m}from"./index-DePqIpr0.js";import{r as h,t as g}from"./card-B_fQtKce.js";var _=e(),v={open:`bg-blue-500/10 text-blue-400 border-blue-500/20`,blocked:`bg-yellow-500/10 text-yellow-400 border-yellow-500/20`,claimed:`bg-emerald-500/10 text-emerald-400 border-emerald-500/20`,in_progress:`bg-purple-500/10 text-purple-400 border-purple-500/20`};function y(){let e=a(),t=o(e=>e.agentsById),r=o(e=>e.compose),i=o(e=>e.set),s=o(e=>e.doClaimTask),l=o(e=>e.doClaim),d=o(e=>e.openTaskEvents),h=o(e=>e.showError),g=o(e=>e.openConfirm),v=o(e=>e.doDeleteMessage),y=o(e=>e.doUpdateTaskStatus),x=f(),S=p(),C=S.filter(e=>e.claimable).length;function w(e){if(!r.from){h(`Validation`,`Select a "Claim as" agent first.`);return}e.sourceType===`task`&&e.task?s(e.task.id):e.sourceType===`message`&&e.message&&l(e.message.id)}function T(e){g(`Cancel Item`,`Cancel "${e.title||(e.sourceType===`task`?`Task #${e.id}`:`Message #${e.id}`)}"? This cannot be undone.`,()=>{e.sourceType===`task`&&e.task?y(e.task,`canceled`):e.sourceType===`message`&&e.message&&v(e.message.id)})}function E(e){e.task&&d(e.task)}return(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(n,{className:`w-5 h-5 text-muted-foreground`}),(0,_.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Work Queue`}),C>0&&(0,_.jsxs)(u,{className:`bg-orange-500/20 text-orange-400 border-orange-500/30 border`,children:[C,` claimable`]})]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`label`,{className:`text-xs text-muted-foreground shrink-0`,children:`Claim as`}),(0,_.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm`,value:r.from,onChange:e=>i({compose:{...r,from:e.target.value}}),children:[(0,_.jsx)(`option`,{value:``,children:`Select agent...`}),x.map(e=>(0,_.jsx)(`option`,{value:e.id,children:c(e)},e.id))]})]})]}),(0,_.jsx)(m,{className:`h-[calc(100dvh-11rem)]`,children:(0,_.jsxs)(`div`,{className:`space-y-2 pr-2`,children:[S.length===0&&(0,_.jsx)(`div`,{className:`text-center text-muted-foreground py-16 text-sm`,children:`Work queue is empty`}),S.map(n=>(0,_.jsx)(b,{item:n,now:e,agentName:e=>t[e]?c(t[e]):e.slice(-10),onClaim:()=>w(n),onCancel:()=>T(n),onEvents:n.task?()=>E(n):void 0},n.id))]})})]})}function b({item:e,now:n,agentName:a,onClaim:o,onCancel:c,onEvents:f}){let p=l[e.severity]||l.info,m=v[e.status]||`bg-zinc-500/10 text-zinc-400 border-zinc-500/20`;return(0,_.jsx)(g,{className:e.claimable?`ring-1 ring-orange-500/30`:``,children:(0,_.jsx)(h,{className:`p-3`,children:(0,_.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,_.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap mb-1`,children:[(0,_.jsx)(`span`,{className:`font-medium text-sm truncate`,children:e.title}),(0,_.jsx)(u,{variant:`outline`,className:`text-xs px-1.5 py-0 border ${p}`,children:e.severity}),(0,_.jsx)(u,{variant:`outline`,className:`text-xs px-1.5 py-0 border ${m}`,children:e.status}),e.sourceType===`message`&&(0,_.jsx)(u,{variant:`outline`,className:`text-xs px-1.5 py-0 border border-zinc-500/20 text-zinc-400`,children:`msg`})]}),e.body&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2 mb-2`,children:e.body}),(0,_.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground flex-wrap`,children:[e.owner&&(0,_.jsxs)(`span`,{title:`Owner`,children:[(0,_.jsx)(t,{className:`w-3 h-3 inline mr-1`}),a(e.owner)]}),e.source&&(0,_.jsx)(`span`,{className:`font-mono`,children:e.source}),(0,_.jsxs)(`span`,{title:String(e.updatedAt),children:[(0,_.jsx)(r,{className:`w-3 h-3 inline mr-1`}),s(n,e.updatedAt)]})]})]}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-1 shrink-0`,children:[e.claimable&&(0,_.jsxs)(d,{size:`sm`,className:`h-7 text-xs bg-orange-600 hover:bg-orange-700 text-white`,onClick:o,children:[(0,_.jsx)(t,{className:`w-3.5 h-3.5 mr-1`}),` Claim`]}),f&&(0,_.jsx)(d,{size:`sm`,variant:`outline`,className:`h-7 text-xs`,onClick:f,children:`Events`}),(0,_.jsxs)(d,{size:`sm`,variant:`outline`,className:`h-7 text-xs text-red-400 hover:text-red-300 hover:bg-red-500/10 border-red-500/20`,onClick:c,children:[(0,_.jsx)(i,{className:`w-3.5 h-3.5 mr-1`}),` Cancel`]})]})]})})})}export{y as WorkQueueView};
2
- //# sourceMappingURL=work-queue-BI_d8G0U.js.map
@@ -1,3 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{Bn as t,Ct as n,G as r,In as i,It as a,Lt as o,N as s,Nn as c,On as l,Ot as u,Pt as d,Qn as f,Zt as p,dn as m,fn as h,i as g,jt as _,ln as v,m as y,p as b,wt as x,xt as S}from"./lucide-react-DI8kTavp.js";import{l as C,t as w}from"./store-D1K4_xId.js";import{U as T,Y as E,d as D}from"./display-DHgdn4vN.js";import{t as O}from"./badge-YQhT30dy.js";import{t as k}from"./button-CaFI76Ja.js";import{t as A}from"./copy-button-m00JmflM.js";import{a as j,o as M,r as N,t as P}from"./card-B_fQtKce.js";var F=e(f(),1),I=t(),L=new Set([`active`,`ready`,`conflict`,`review_requested`,`merge_planned`,`cleanup_requested`]),R=new Set([`active`,`ready`,`conflict`,`review_requested`,`merge_planned`]),z=new Set([`active`,`ready`,`review_requested`,`merge_planned`,`conflict`]),B={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`},V={active:`active`,ready:`ready`,conflict:`conflict`,review_requested:`review`,merge_planned:`merge planned`,merged:`merged`,abandoned:`abandoned`,cleanup_requested:`cleanup`,cleaned:`cleaned`},H={conflict:0,ready:1,review_requested:2,merge_planned:3,active:4,cleanup_requested:5,merged:6,abandoned:7,cleaned:8},U=new Set(E);function W(e){let t=e.split(`/`).filter(Boolean);return t.length<=3?e||`-`:`/${t.slice(-3).join(`/`)}`}function G(e,t){return e?D(e):t||`-`}function K(e){return B[e]||`bg-zinc-500/10 text-zinc-400 border-zinc-500/20`}function q(e,t){let n=(H[e.status]??99)-(H[t.status]??99);return n===0?Number(t.updatedAt||0)-Number(e.updatedAt||0):n}function J(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(q)})).sort((e,t)=>{let n=e.workspaces.some(e=>L.has(e.status));return n===t.workspaces.some(e=>L.has(e.status))?e.repoRoot.localeCompare(t.repoRoot):n?-1:1})}function Y(e,t){return t===`all`?e:t===`cleaned`?e.filter(e=>U.has(e.status)):e.filter(e=>!U.has(e.status))}function X({workspace:e,expanded:t,onToggleDetails:n}){let r=w(e=>e.workspaceAction),i=w(e=>e.purgeWorkspace),a=w(e=>e.fetchWorkspaceMergePreview),s=w(e=>e.openFilesAt),c=e.status===`cleaned`||e.status===`merged`||e.status===`abandoned`,l=c||e.status===`cleanup_requested`,d=e.worktreePath||e.sourceCwd||e.repoRoot,f=w(t=>t.workspaceGitState[e.id]),p=!!f&&f.available!==!1&&f.landed===!0,b=e.mode===`isolated`&&!!e.worktreePath&&z.has(e.status)&&!p;async function x(){await a(e.id),await r(e.id,`merge`)}return(0,I.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-1.5`,children:[(0,I.jsx)(k,{size:`icon-sm`,variant:`ghost`,title:t?`Hide details`:`Show diff & timeline`,onClick:n,children:t?(0,I.jsx)(m,{className:`h-3.5 w-3.5`}):(0,I.jsx)(v,{className:`h-3.5 w-3.5`})}),(0,I.jsx)(k,{size:`icon-sm`,variant:`ghost`,title:`Open workspace`,disabled:!d||e.status===`cleaned`,onClick:()=>void s({path:d}),children:(0,I.jsx)(u,{className:`h-3.5 w-3.5`})}),(0,I.jsx)(A,{value:d,label:`Copy path`,copiedLabel:`Copied path`,size:`icon-sm`,variant:`ghost`,disabled:!d}),(0,I.jsx)(k,{size:`icon-sm`,variant:`outline`,title:`Mark ready`,disabled:l||e.status===`ready`,onClick:()=>void r(e.id,`ready`),children:(0,I.jsx)(h,{className:`h-3.5 w-3.5`})}),(0,I.jsx)(k,{size:`icon-sm`,variant:`outline`,title:`Request review`,disabled:l||e.status===`review_requested`,onClick:()=>void r(e.id,`request-review`),children:(0,I.jsx)(o,{className:`h-3.5 w-3.5`})}),(0,I.jsx)(k,{size:`icon-sm`,variant:`outline`,title:`Mark merge planned`,disabled:l||e.status===`merge_planned`,onClick:()=>void r(e.id,`merge-plan`),children:(0,I.jsx)(_,{className:`h-3.5 w-3.5`})}),(0,I.jsx)(k,{size:`icon-sm`,variant:`default`,title:p?`Already merged into base — nothing to land`:`Merge & land work`,disabled:!b,onClick:()=>void x(),children:(0,I.jsx)(S,{className:`h-3.5 w-3.5`})}),(0,I.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 r(e.id,`cleanup`),children:(0,I.jsx)(y,{className:`h-3.5 w-3.5`})}),c&&(0,I.jsx)(k,{size:`icon-sm`,variant:`ghost`,title:`Purge record (clears the row, does not touch disk)`,onClick:()=>void i(e.id),children:(0,I.jsx)(g,{className:`h-3.5 w-3.5`})})]})}function Z({workspace:e,unmerged:t}){let n=w(t=>t.workspaceMergePreview[e.id]),r=w(e=>e.fetchWorkspaceMergePreview),i=t>0&&z.has(e.status);return(0,F.useEffect)(()=>{i&&n===void 0&&r(e.id)},[i,n,e.id,r]),!i||n===void 0||n.available===!1?null:n.conflict?(0,I.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,I.jsx)(b,{className:`h-3 w-3`}),`conflict`]}):n.conflict===!1?(0,I.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,I.jsx)(h,{className:`h-3 w-3`}),n.strategy===`pr`?`PR ready`:`clean`]}):null}function Q({workspace:e}){let t=C(),r=w(t=>t.workspaceGitState[e.id]),i=w(e=>e.fetchWorkspaceGitState),a=e.mode===`isolated`&&!!e.worktreePath&&R.has(e.status);if((0,F.useEffect)(()=>{a&&r===void 0&&i(e.id)},[a,r,e.id,i]),!a)return null;let o=(0,I.jsx)(k,{size:`icon-sm`,variant:`ghost`,className:`h-5 w-5`,title:`Refresh git state`,onClick:()=>void i(e.id),children:(0,I.jsx)(s,{className:`h-3 w-3`})});if(r===void 0)return(0,I.jsx)(`div`,{className:`flex items-center gap-1 text-[11px] text-muted-foreground`,children:`Loading git state…`});if(r.available===!1)return(0,I.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] text-muted-foreground`,title:r.reason,children:[(0,I.jsx)(`span`,{children:`git state unavailable`}),o]});if(r.missing)return(0,I.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] text-muted-foreground`,children:[`worktree gone `,o]});if(r.error)return(0,I.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] text-red-400`,title:r.error,children:[(0,I.jsx)(`span`,{children:`git error`}),o]});let u=r.ahead??0,f=r.landed===!0,p=f?0:r.unmergedAhead??u,m=r.behind??0,g=r.dirtyCount??0,_=p===0&&g===0&&!f,v=r.lastCommit;return(0,I.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11px]`,children:[_?(0,I.jsx)(`span`,{className:`text-muted-foreground`,children:`no unmerged work`}):(0,I.jsxs)(I.Fragment,{children:[f?(0,I.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,I.jsx)(h,{className:`h-3 w-3`}),`landed`]}):(0,I.jsxs)(`span`,{className:p>0?`flex items-center text-emerald-400`:`flex items-center text-muted-foreground`,title:u===p?`${p} commit(s) ahead of base`:`${p} unmerged commit(s) (${u} ahead of base)`,children:[(0,I.jsx)(l,{className:`h-3 w-3`}),p]}),(0,I.jsxs)(`span`,{className:m>0?`flex items-center text-amber-400`:`flex items-center text-muted-foreground`,title:`${m} commit(s) behind base`,children:[(0,I.jsx)(c,{className:`h-3 w-3`}),m]}),g>0&&(0,I.jsxs)(`span`,{className:`flex items-center text-orange-400`,title:`${g} uncommitted change(s)`,children:[(0,I.jsx)(d,{className:`h-3 w-3`}),g]}),!f&&(0,I.jsx)(Z,{workspace:e,unmerged:p})]}),o]}),v&&(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 text-[11px] text-muted-foreground`,title:`${v.sha.slice(0,8)} — ${v.message}`,children:[(0,I.jsx)(n,{className:`h-3 w-3 shrink-0`}),(0,I.jsx)(`span`,{className:`truncate`,children:v.message||v.sha.slice(0,8)}),v.at?(0,I.jsxs)(`span`,{className:`shrink-0 opacity-70`,children:[`· `,T(t,v.at)]}):null]})]})}function $({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,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground`,children:[(0,I.jsxs)(`span`,{className:`flex items-center gap-1 font-medium text-foreground`,children:[(0,I.jsx)(p,{className:`h-3 w-3`}),`Timeline`]}),r.map((e,n)=>(0,I.jsxs)(`span`,{className:`flex items-center gap-1`,children:[n>0&&(0,I.jsx)(`span`,{className:`opacity-40`,children:`→`}),(0,I.jsx)(`span`,{className:`text-foreground`,children:e.label}),(0,I.jsx)(`span`,{title:new Date(e.at).toLocaleString(),children:T(t,e.at)})]},e.label))]})}function ee(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 te({workspace:e}){let t=w(t=>t.workspaceDiff[e.id]),n=w(e=>e.fetchWorkspaceDiff),r=e.mode===`isolated`&&!!e.worktreePath;if((0,F.useEffect)(()=>{r&&t===void 0&&n(e.id)},[r,t,e.id,n]),!r)return null;if(t===void 0)return(0,I.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:`Loading diff…`});if(t.available===!1)return(0,I.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[`Diff unavailable`,t.reason?`: ${t.reason}`:``]});if(t.missing)return(0,I.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:`Worktree no longer on disk`});if(t.error)return(0,I.jsxs)(`div`,{className:`text-[11px] text-red-400`,children:[`Diff error: `,t.error]});if(!t.files.length)return(0,I.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[`No committed changes against `,t.baseRef||`base`]});let i=(0,I.jsx)(k,{size:`icon-sm`,variant:`ghost`,className:`h-5 w-5`,title:`Refresh diff`,onClick:()=>void n(e.id),children:(0,I.jsx)(s,{className:`h-3 w-3`})});return(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium`,children:[(0,I.jsx)(a,{className:`h-3 w-3`}),(0,I.jsxs)(`span`,{children:[t.files.length,` file`,t.files.length===1?``:`s`,` vs `,t.baseRef||`base`]}),i]}),(0,I.jsx)(`ul`,{className:`space-y-0.5 text-[11px]`,children:t.files.map(e=>(0,I.jsxs)(`li`,{className:`flex items-center gap-2 font-mono`,children:[(0,I.jsx)(`span`,{className:`truncate`,title:e.path,children:e.path}),e.binary?(0,I.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`binary`}):(0,I.jsxs)(`span`,{className:`shrink-0`,children:[(0,I.jsxs)(`span`,{className:`text-emerald-400`,children:[`+`,e.additions??0]}),` `,(0,I.jsxs)(`span`,{className:`text-red-400`,children:[`−`,e.deletions??0]})]})]},e.path))}),t.patch&&(0,I.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,I.jsx)(`div`,{className:ee(e),children:e||` `},t)),t.truncated&&(0,I.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:`… patch truncated`})]})]})}function ne({workspace:e}){return(0,I.jsxs)(`div`,{className:`space-y-3 border-t border-dashed border-border bg-muted/20 px-3 py-3`,children:[(0,I.jsx)($,{workspace:e}),(0,I.jsx)(te,{workspace:e})]})}function re(){let e=w(e=>e.workspaceOrphans),t=w(e=>e.fetchWorkspaceOrphans),n=w(e=>e.reclaimWorkspaceOrphan);return(0,F.useEffect)(()=>{t()},[t]),e.length?(0,I.jsxs)(P,{className:`border-amber-500/30`,children:[(0,I.jsxs)(j,{className:`px-4 py-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(r,{className:`h-4 w-4 text-amber-400`}),(0,I.jsx)(M,{className:`text-sm font-medium`,children:`Orphaned worktrees`}),(0,I.jsx)(O,{variant:`outline`,className:`border-amber-500/30 text-amber-400 text-[10px]`,children:e.length}),(0,I.jsx)(k,{size:`icon-sm`,variant:`ghost`,className:`ml-auto h-6 w-6`,title:`Rescan`,onClick:()=>void t(),children:(0,I.jsx)(s,{className:`h-3.5 w-3.5`})})]}),(0,I.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,I.jsx)(N,{className:`p-0`,children:e.map(e=>(0,I.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-border px-4 py-2 text-xs`,children:[(0,I.jsx)(x,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,I.jsx)(`span`,{className:`truncate font-medium`,title:e.branch,children:e.branch||`(detached)`}),(0,I.jsx)(`span`,{className:`truncate font-mono text-muted-foreground`,title:e.worktreePath,children:W(e.worktreePath)}),e.hadTerminalRow&&(0,I.jsx)(O,{variant:`outline`,className:`text-[10px]`,children:`cleanup failed`}),(0,I.jsxs)(k,{size:`sm`,variant:`outline`,className:`ml-auto h-7 text-xs`,onClick:()=>void n(e),children:[(0,I.jsx)(i,{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,I.jsxs)(I.Fragment,{children:[n&&(0,I.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,I.jsx)(S,{className:`h-2.5 w-2.5`}),ie(n)]}),r&&(0,I.jsxs)(O,{variant:`outline`,className:`max-w-[16rem] border-amber-500/30 text-amber-400 text-[10px]`,title:r,children:[(0,I.jsx)(b,{className:`mr-0.5 h-2.5 w-2.5 shrink-0`}),(0,I.jsxs)(`span`,{className:`truncate`,children:[`merge: `,r]})]})]})}function oe({workspace:e}){let t=C(),[n,r]=(0,F.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,F.useRef)(null);return(0,F.useEffect)(()=>{a&&l.current?.scrollIntoView({behavior:`smooth`,block:`center`})},[a]),(0,I.jsxs)(`div`,{ref:l,className:`border-t border-border ${a?`bg-primary/5 ring-1 ring-inset ring-primary/40`:``}`,children:[(0,I.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,I.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,I.jsx)(x,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,I.jsx)(`span`,{className:`truncate font-medium`,title:e.branch||e.id,children:e.branch||e.id})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,I.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,I.jsxs)(O,{variant:`outline`,className:`text-[10px]`,children:[`requested `,e.requestedMode]}),(0,I.jsx)(O,{variant:`outline`,className:`text-[10px] ${K(e.status)}`,children:V[e.status]||e.status}),(0,I.jsx)(ae,{workspace:e})]})]}),(0,I.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,I.jsx)(`div`,{className:`truncate font-mono text-xs`,title:c,children:W(c)}),(0,I.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,title:e.sourceCwd,children:e.sourceCwd}),(0,I.jsx)(Q,{workspace:e})]}),(0,I.jsxs)(`div`,{className:`grid grid-cols-[4.5rem_minmax(0,1fr)] gap-x-2 gap-y-1 text-xs`,children:[(0,I.jsx)(`span`,{className:`text-muted-foreground`,children:`Owner`}),(0,I.jsx)(`span`,{className:`truncate`,title:e.ownerAgentId,children:G(o,e.ownerPolicyName||e.ownerAgentId)}),(0,I.jsx)(`span`,{className:`text-muted-foreground`,children:`Steward`}),(0,I.jsx)(`span`,{className:`truncate`,title:e.stewardAgentId,children:G(s,e.stewardAgentId)}),(0,I.jsx)(`span`,{className:`text-muted-foreground`,children:`Updated`}),(0,I.jsx)(`span`,{children:T(t,e.updatedAt)}),e.baseRef&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`text-muted-foreground`,children:`Base`}),(0,I.jsx)(`span`,{className:`truncate`,title:e.baseSha,children:e.baseRef})]})]}),(0,I.jsx)(X,{workspace:e,expanded:n,onToggleDetails:()=>r(e=>!e)})]}),n&&(0,I.jsx)(ne,{workspace:e})]})}function se({repoRoot:e,workspaces:t}){let n=t.filter(e=>L.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,I.jsxs)(P,{children:[(0,I.jsx)(j,{className:`px-4 py-3`,children:(0,I.jsx)(`div`,{className:`flex min-w-0 items-start gap-3`,children:(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(M,{className:`truncate text-sm font-medium`,title:e,children:e}),(0,I.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:[(0,I.jsxs)(O,{variant:`outline`,className:`text-[10px]`,children:[t.length,` total`]}),(0,I.jsxs)(O,{variant:`outline`,className:`text-[10px]`,children:[n,` live`]}),r>0&&(0,I.jsxs)(O,{variant:`outline`,className:`border-emerald-500/20 text-emerald-400 text-[10px]`,children:[r,` merge signal`]}),i>0&&(0,I.jsxs)(O,{variant:`outline`,className:`border-red-500/20 text-red-400 text-[10px]`,children:[i,` conflict`]})]})]})})}),(0,I.jsx)(N,{className:`p-0`,children:t.map(e=>(0,I.jsx)(oe,{workspace:e},e.id))})]})}function ce(){let[e,t]=(0,F.useState)(`active`),n=w(e=>e.workspaces),r=w(e=>e.set),i=w(e=>e.workspaceFocusId);(0,F.useEffect)(()=>{i&&t(`all`)},[i]),(0,F.useEffect)(()=>()=>{r({workspaceFocusId:null})},[r]);let a=(0,F.useMemo)(()=>Y(n,e),[n,e]),o=(0,F.useMemo)(()=>J(a),[a]),s=n.filter(e=>L.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=>U.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,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Workspaces`}),(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Agent worktrees, ownership, and merge readiness.`})]}),(0,I.jsxs)(`div`,{className:`ml-auto flex flex-wrap gap-1.5`,children:[(0,I.jsxs)(O,{variant:`outline`,children:[c,` isolated`]}),(0,I.jsxs)(O,{variant:`outline`,children:[s,` live`]}),(0,I.jsxs)(O,{variant:`outline`,children:[l,` ready`]}),u>0&&(0,I.jsxs)(O,{variant:`outline`,className:`border-red-500/20 text-red-400`,children:[u,` conflict`]})]})]}),(0,I.jsx)(re,{}),(0,I.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,I.jsx)(`div`,{className:`flex rounded-md border border-border bg-card p-1`,children:f.map(n=>(0,I.jsxs)(k,{size:`sm`,variant:e===n.key?`secondary`:`ghost`,className:`h-7 text-xs`,onClick:()=>t(n.key),children:[n.label,(0,I.jsx)(`span`,{className:`ml-1 text-muted-foreground`,children:n.count})]},n.key))})}),o.length===0?(0,I.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,I.jsx)(`div`,{className:`space-y-3`,children:o.map(e=>(0,I.jsx)(se,{repoRoot:e.repoRoot,workspaces:e.workspaces},e.repoRoot))})]})}export{ce as WorkspacesView};
3
- //# sourceMappingURL=workspaces-B_nIm6Tw.js.map