agent-relay-server 0.96.0 → 0.97.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.
- package/docs/openapi.json +1 -1
- package/package.json +2 -2
- package/public/assets/MessageBubble-CIDyX8f7.js +4 -0
- package/public/assets/{MessageBubble-BO9eaLce.js.map → MessageBubble-CIDyX8f7.js.map} +1 -1
- package/public/assets/{PlanGraphPanel-BK2GoOql.js → PlanGraphPanel-BmWB81w_.js} +2 -2
- package/public/assets/{PlanGraphPanel-BK2GoOql.js.map → PlanGraphPanel-BmWB81w_.js.map} +1 -1
- package/public/assets/{activity-FPNsylmj.js → activity-QQikHZe4.js} +2 -2
- package/public/assets/{activity-FPNsylmj.js.map → activity-QQikHZe4.js.map} +1 -1
- package/public/assets/agent-profiles-WvAN5cR_.js +2 -0
- package/public/assets/agent-profiles-WvAN5cR_.js.map +1 -0
- package/public/assets/agents-BsFfumLn.js +2 -0
- package/public/assets/{agents-DwXYbjeZ.js.map → agents-BsFfumLn.js.map} +1 -1
- package/public/assets/{analytics-BiYHZABE.js → analytics-CUJbpoA7.js} +2 -2
- package/public/assets/{analytics-BiYHZABE.js.map → analytics-CUJbpoA7.js.map} +1 -1
- package/public/assets/{automation-deDG3zs5.js → automation-BTbpiINE.js} +2 -2
- package/public/assets/{automation-deDG3zs5.js.map → automation-BTbpiINE.js.map} +1 -1
- package/public/assets/{badge-BbfOskRI.js → badge-BLar6FjP.js} +2 -2
- package/public/assets/{badge-BbfOskRI.js.map → badge-BLar6FjP.js.map} +1 -1
- package/public/assets/branch-state-badge-CNko2_BL.js +2 -0
- package/public/assets/{branch-state-badge-ClWlvQks.js.map → branch-state-badge-CNko2_BL.js.map} +1 -1
- package/public/assets/{button-DWiw--lT.js → button-BrIB69qd.js} +2 -2
- package/public/assets/{button-DWiw--lT.js.map → button-BrIB69qd.js.map} +1 -1
- package/public/assets/card-lhnFnBoz.js +2 -0
- package/public/assets/{card-BeqvuYTT.js.map → card-lhnFnBoz.js.map} +1 -1
- package/public/assets/{channels-ln-_oQlI.js → channels-Tg8l4n5J.js} +2 -2
- package/public/assets/{channels-ln-_oQlI.js.map → channels-Tg8l4n5J.js.map} +1 -1
- package/public/assets/chat-BlFUmD3r.js +2 -0
- package/public/assets/{chat-DH8vR-mf.js.map → chat-BlFUmD3r.js.map} +1 -1
- package/public/assets/{connectors-CmxpixdH.js → connectors-B5wbjyUd.js} +2 -2
- package/public/assets/{connectors-CmxpixdH.js.map → connectors-B5wbjyUd.js.map} +1 -1
- package/public/assets/copy-button-Cd-LbSbg.js +2 -0
- package/public/assets/{copy-button-CIXy8ks6.js.map → copy-button-Cd-LbSbg.js.map} +1 -1
- package/public/assets/dist-30weaXto.js +2 -0
- package/public/assets/{dist-LFuRypZd.js.map → dist-30weaXto.js.map} +1 -1
- package/public/assets/{dist-CtuS_3Jl.js → dist-B5VvlkhI.js} +2 -2
- package/public/assets/{dist-CtuS_3Jl.js.map → dist-B5VvlkhI.js.map} +1 -1
- package/public/assets/dist-BEzpMqLy.js +2 -0
- package/public/assets/{dist-Q6OOS84U.js.map → dist-BEzpMqLy.js.map} +1 -1
- package/public/assets/{dist-CbxR2pzD.js → dist-BjOBkHHY.js} +2 -2
- package/public/assets/{dist-CbxR2pzD.js.map → dist-BjOBkHHY.js.map} +1 -1
- package/public/assets/{dist-zTw85jD8.js → dist-BnbGIUmi.js} +2 -2
- package/public/assets/{dist-zTw85jD8.js.map → dist-BnbGIUmi.js.map} +1 -1
- package/public/assets/{dist-BufB2Xy_.js → dist-Bp10H3oR.js} +2 -2
- package/public/assets/{dist-BufB2Xy_.js.map → dist-Bp10H3oR.js.map} +1 -1
- package/public/assets/{dist-Du_bcq-z.js → dist-CQF3Jiqg.js} +2 -2
- package/public/assets/{dist-Du_bcq-z.js.map → dist-CQF3Jiqg.js.map} +1 -1
- package/public/assets/dist-Cgy0FmP-.js +2 -0
- package/public/assets/{dist-CXkmW1Od.js.map → dist-Cgy0FmP-.js.map} +1 -1
- package/public/assets/{dist-KxiSP9h9.js → dist-DAl28ejX.js} +2 -2
- package/public/assets/{dist-KxiSP9h9.js.map → dist-DAl28ejX.js.map} +1 -1
- package/public/assets/{dist-eG_93I3z.js → dist-DDUGmmoi.js} +2 -2
- package/public/assets/{dist-eG_93I3z.js.map → dist-DDUGmmoi.js.map} +1 -1
- package/public/assets/{dist-BQXmO19g.js → dist-DZ97OosY.js} +2 -2
- package/public/assets/{dist-BQXmO19g.js.map → dist-DZ97OosY.js.map} +1 -1
- package/public/assets/{es2015-ibwCE_JR.js → es2015-B8Z9p8oQ.js} +2 -2
- package/public/assets/{es2015-ibwCE_JR.js.map → es2015-B8Z9p8oQ.js.map} +1 -1
- package/public/assets/{formatted-body-impl-l_m1i28m.js → formatted-body-impl-Dbjjdcu9.js} +2 -2
- package/public/assets/{formatted-body-impl-l_m1i28m.js.map → formatted-body-impl-Dbjjdcu9.js.map} +1 -1
- package/public/assets/index-CPWbr4sq.css +2 -0
- package/public/assets/index-CPXz74W5.js +23 -0
- package/public/assets/index-CPXz74W5.js.map +1 -0
- package/public/assets/{input-DUdtS3nG.js → input-B_fUHtLD.js} +2 -2
- package/public/assets/{input-DUdtS3nG.js.map → input-B_fUHtLD.js.map} +1 -1
- package/public/assets/{insights-DpNVkiVq.js → insights-D1Oq25BL.js} +2 -2
- package/public/assets/{insights-DpNVkiVq.js.map → insights-D1Oq25BL.js.map} +1 -1
- package/public/assets/{integrations-DscgKx2I.js → integrations-sYKtupOq.js} +2 -2
- package/public/assets/{integrations-DscgKx2I.js.map → integrations-sYKtupOq.js.map} +1 -1
- package/public/assets/{lib-Gp69YB9e.js → lib-ng6WZYjE.js} +2 -2
- package/public/assets/{lib-Gp69YB9e.js.map → lib-ng6WZYjE.js.map} +1 -1
- package/public/assets/{lucide-react-uFIMC7W7.js → lucide-react-BYZuAhQs.js} +2 -2
- package/public/assets/{lucide-react-uFIMC7W7.js.map → lucide-react-BYZuAhQs.js.map} +1 -1
- package/public/assets/maintenance-CgXJwFTo.js +2 -0
- package/public/assets/{maintenance-BhAxK-Fd.js.map → maintenance-CgXJwFTo.js.map} +1 -1
- package/public/assets/{managed-agents-Bg4aG1a9.js → managed-agents-CbuFHwWE.js} +4 -4
- package/public/assets/{managed-agents-Bg4aG1a9.js.map → managed-agents-CbuFHwWE.js.map} +1 -1
- package/public/assets/markdown-preview-impl-B79bSsKK.js +2 -0
- package/public/assets/{markdown-preview-impl-BJHjAo1H.js.map → markdown-preview-impl-B79bSsKK.js.map} +1 -1
- package/public/assets/memory-Box_rMj_.js +2 -0
- package/public/assets/{memory-WwrerNC0.js.map → memory-Box_rMj_.js.map} +1 -1
- package/public/assets/{messages-BY6mboBf.js → messages-BXIHBaN2.js} +2 -2
- package/public/assets/{messages-BY6mboBf.js.map → messages-BXIHBaN2.js.map} +1 -1
- package/public/assets/{orchestrators-ClNqQHnw.js → orchestrators-MNj_mp3U.js} +2 -2
- package/public/assets/{orchestrators-ClNqQHnw.js.map → orchestrators-MNj_mp3U.js.map} +1 -1
- package/public/assets/{overview-Bk91s8bA.js → overview-KfwJgCUa.js} +2 -2
- package/public/assets/{overview-Bk91s8bA.js.map → overview-KfwJgCUa.js.map} +1 -1
- package/public/assets/{pairs-IxkuPIfN.js → pairs-DfrGWlgL.js} +2 -2
- package/public/assets/{pairs-IxkuPIfN.js.map → pairs-DfrGWlgL.js.map} +1 -1
- package/public/assets/{projects-D7WJtj7Y.js → projects-BPI8z55X.js} +2 -2
- package/public/assets/{projects-D7WJtj7Y.js.map → projects-BPI8z55X.js.map} +1 -1
- package/public/assets/{react-dom-DF2cuNaf.js → react-dom-Dbhs84ug.js} +2 -2
- package/public/assets/{react-dom-DF2cuNaf.js.map → react-dom-Dbhs84ug.js.map} +1 -1
- package/public/assets/{registry-DUzVG_Oi.js → registry-CiBC97sL.js} +2 -2
- package/public/assets/{registry-DUzVG_Oi.js.map → registry-CiBC97sL.js.map} +1 -1
- package/public/assets/{security-D9ru8DHd.js → security-BbU_vIdb.js} +2 -2
- package/public/assets/{security-D9ru8DHd.js.map → security-BbU_vIdb.js.map} +1 -1
- package/public/assets/{select-Bu-gipoC.js → select-CeQwmVTm.js} +2 -2
- package/public/assets/{select-Bu-gipoC.js.map → select-CeQwmVTm.js.map} +1 -1
- package/public/assets/settings-DBsL3jb7.js +6 -0
- package/public/assets/{settings-CoOySnqS.js.map → settings-DBsL3jb7.js.map} +1 -1
- package/public/assets/{store-DGM2s9L1.js → store-pKbf_WYd.js} +5 -5
- package/public/assets/{store-DGM2s9L1.js.map → store-pKbf_WYd.js.map} +1 -1
- package/public/assets/{tasks-C94dSpvI.js → tasks-za0RxIQw.js} +2 -2
- package/public/assets/{tasks-C94dSpvI.js.map → tasks-za0RxIQw.js.map} +1 -1
- package/public/assets/{teams-Cq7HWQe9.js → teams-ByAqwLG9.js} +2 -2
- package/public/assets/{teams-Cq7HWQe9.js.map → teams-ByAqwLG9.js.map} +1 -1
- package/public/assets/{terminal-viewer-impl-BQr-VK32.js → terminal-viewer-impl-CkoWD5D_.js} +3 -3
- package/public/assets/{terminal-viewer-impl-BQr-VK32.js.map → terminal-viewer-impl-CkoWD5D_.js.map} +1 -1
- package/public/assets/{use-keyboard-viewport-CeLM-PeW.js → use-keyboard-viewport-D8_NYDkh.js} +2 -2
- package/public/assets/{use-keyboard-viewport-CeLM-PeW.js.map → use-keyboard-viewport-D8_NYDkh.js.map} +1 -1
- package/public/assets/user-avatar-Q_N6iHEn.js +2 -0
- package/public/assets/{user-avatar-aCd8Fb5v.js.map → user-avatar-Q_N6iHEn.js.map} +1 -1
- package/public/assets/{work-queue-BuyQhedx.js → work-queue-DfRo1B2P.js} +2 -2
- package/public/assets/{work-queue-BuyQhedx.js.map → work-queue-DfRo1B2P.js.map} +1 -1
- package/public/assets/workspaces-BolccWZy.js +3 -0
- package/public/assets/{workspaces-DXTrd2or.js.map → workspaces-BolccWZy.js.map} +1 -1
- package/public/index.html +21 -21
- package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/src/agent-busy-health.ts +22 -20
- package/src/mcp/tools-spawn.ts +13 -2
- package/src/mcp-team-template-tools.ts +8 -1
- package/src/routes/agents-spawn.ts +4 -2
- package/src/services/spawn-agent.ts +46 -1
- package/public/assets/MessageBubble-BO9eaLce.js +0 -4
- package/public/assets/agent-profiles-lEZqu7Gm.js +0 -2
- package/public/assets/agent-profiles-lEZqu7Gm.js.map +0 -1
- package/public/assets/agents-DwXYbjeZ.js +0 -2
- package/public/assets/branch-state-badge-ClWlvQks.js +0 -2
- package/public/assets/card-BeqvuYTT.js +0 -2
- package/public/assets/chat-DH8vR-mf.js +0 -2
- package/public/assets/copy-button-CIXy8ks6.js +0 -2
- package/public/assets/dist-CXkmW1Od.js +0 -2
- package/public/assets/dist-LFuRypZd.js +0 -2
- package/public/assets/dist-Q6OOS84U.js +0 -2
- package/public/assets/index-BETon8ID.css +0 -2
- package/public/assets/index-D1GX2b-m.js +0 -23
- package/public/assets/index-D1GX2b-m.js.map +0 -1
- package/public/assets/maintenance-BhAxK-Fd.js +0 -2
- package/public/assets/markdown-preview-impl-BJHjAo1H.js +0 -2
- package/public/assets/memory-WwrerNC0.js +0 -2
- package/public/assets/settings-CoOySnqS.js +0 -6
- package/public/assets/user-avatar-aCd8Fb5v.js +0 -2
- package/public/assets/workspaces-DXTrd2or.js +0 -3
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{H as t,I as n,Jn as r,Xn as i,a,an as o,lr as s,m as c,pn as l,qn as u}from"./lucide-react-uFIMC7W7.js";import{l as d,t as f}from"./store-DGM2s9L1.js";import{K as p,h as m}from"./display-DRiGi1zj.js";import{t as h}from"./badge-BbfOskRI.js";import{t as g}from"./button-DWiw--lT.js";import{s as _}from"./index-D1GX2b-m.js";var v=e(s(),1),y=i(),b={succeeded:`bg-emerald-500/10 text-emerald-400 border-emerald-500/30`,running:`bg-blue-500/10 text-blue-400 border-blue-500/30`,failed:`bg-red-500/10 text-red-400 border-red-500/30`,idle:`bg-zinc-500/10 text-zinc-400 border-zinc-500/30`,disabled:`bg-zinc-500/10 text-zinc-500 border-zinc-500/20`};function x(){let e=d(),t=f(e=>e.maintenanceJobs),r=f(e=>e.fetchMaintenanceJobs),i=f(e=>e.runMaintenanceJob),o=(0,v.useMemo)(()=>({failed:t.filter(e=>e.lastStatus===`failed`).length,running:t.filter(e=>e.running||e.lastStatus===`running`).length,dueSoon:t.filter(t=>t.nextRunAt&&t.nextRunAt<=e+300*1e3).length}),[t,e]);return(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,y.jsx)(a,{className:`h-5 w-5 text-muted-foreground`}),(0,y.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Maintenance`}),(0,y.jsx)(h,{variant:`secondary`,children:t.length}),o.running>0&&(0,y.jsxs)(h,{className:`border border-blue-500/30 bg-blue-500/10 text-blue-400`,children:[o.running,` running`]}),o.failed>0&&(0,y.jsxs)(h,{variant:`destructive`,children:[o.failed,` failing`]}),o.dueSoon>0&&(0,y.jsxs)(h,{className:`border border-yellow-500/30 bg-yellow-500/10 text-yellow-400`,children:[o.dueSoon,` due soon`]})]}),(0,y.jsxs)(g,{size:`sm`,variant:`outline`,onClick:()=>void r(),children:[(0,y.jsx)(n,{className:`h-3.5 w-3.5`}),` Refresh`]})]}),(0,y.jsx)(_,{className:`h-[calc(100dvh-10rem)]`,children:t.length===0?(0,y.jsx)(`div`,{className:`rounded-md border border-border px-3 py-12 text-center text-sm text-muted-foreground`,children:`No maintenance jobs registered`}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`hidden overflow-x-auto rounded-md border border-border md:block`,children:(0,y.jsxs)(`table`,{className:`w-full min-w-[980px] text-sm`,children:[(0,y.jsx)(`thead`,{className:`bg-muted/40 text-xs text-muted-foreground`,children:(0,y.jsxs)(`tr`,{children:[(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Job`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Status`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Last run`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Next run`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Duration`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Result`}),(0,y.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:`Action`})]})}),(0,y.jsx)(`tbody`,{children:t.map(t=>(0,y.jsx)(T,{job:t,now:e,onRun:()=>void i(t.id)},t.id))})]})}),(0,y.jsx)(`div`,{className:`space-y-3 md:hidden`,children:t.map(t=>(0,y.jsx)(w,{job:t,now:e,onRun:()=>void i(t.id)},t.id))})]})})]})}function S(e){return e.running?`running`:e.enabled?e.lastStatus:`disabled`}function C({status:e}){return(0,y.jsxs)(h,{variant:`outline`,className:r(`border`,b[e]||b.idle),children:[E(e),e]})}function w({job:e,now:n,onRun:r}){let i=S(e);return(0,y.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,y.jsxs)(`div`,{className:`min-w-0`,children:[(0,y.jsx)(`div`,{className:`font-medium`,children:e.title}),(0,y.jsx)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:e.description}),(0,y.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground/80`,children:e.id})]}),(0,y.jsx)(C,{status:i})]}),e.consecutiveFailures>0&&(0,y.jsxs)(`div`,{className:`mt-2 text-xs text-red-400`,children:[e.consecutiveFailures,` failure`,e.consecutiveFailures===1?``:`s`]}),(0,y.jsxs)(`dl`,{className:`mt-3 grid grid-cols-3 gap-2 text-xs`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Last run`}),(0,y.jsx)(`dd`,{children:e.lastRunAt?(0,y.jsx)(`span`,{title:m(e.lastRunAt),children:p(n,e.lastRunAt)}):`never`})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Next run`}),(0,y.jsx)(`dd`,{children:e.nextRunAt?(0,y.jsx)(`span`,{title:m(e.nextRunAt),children:O(n,e.nextRunAt)}):`-`})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`dt`,{className:`text-muted-foreground`,children:`Duration`}),(0,y.jsx)(`dd`,{children:e.lastDurationMs===void 0?`-`:`${e.lastDurationMs}ms`})]})]}),(0,y.jsxs)(`div`,{className:`mt-3`,children:[(0,y.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Result`}),e.lastError?(0,y.jsx)(`div`,{className:`mt-0.5 text-xs text-red-400 line-clamp-3`,children:e.lastError}):(0,y.jsx)(`div`,{className:`mt-0.5 font-mono text-[11px] text-muted-foreground line-clamp-3`,children:D(e)})]}),(0,y.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,y.jsxs)(g,{size:`sm`,variant:`outline`,disabled:!e.enabled||e.running,onClick:r,children:[(0,y.jsx)(t,{className:`h-3.5 w-3.5`}),` Run`]})})]})}function T({job:e,now:n,onRun:r}){let i=S(e);return(0,y.jsxs)(`tr`,{className:`border-t border-border align-top`,children:[(0,y.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,y.jsx)(`div`,{className:`font-medium`,children:e.title}),(0,y.jsx)(`div`,{className:`mt-0.5 max-w-md text-xs text-muted-foreground`,children:e.description}),(0,y.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground/80`,children:e.id})]}),(0,y.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,y.jsx)(C,{status:i}),e.consecutiveFailures>0&&(0,y.jsxs)(`div`,{className:`mt-1 text-xs text-red-400`,children:[e.consecutiveFailures,` failure`,e.consecutiveFailures===1?``:`s`]})]}),(0,y.jsx)(`td`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e.lastRunAt?(0,y.jsx)(`span`,{title:m(e.lastRunAt),children:p(n,e.lastRunAt)}):`never`}),(0,y.jsx)(`td`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e.nextRunAt?(0,y.jsx)(`span`,{title:m(e.nextRunAt),children:O(n,e.nextRunAt)}):`-`}),(0,y.jsx)(`td`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e.lastDurationMs===void 0?`-`:`${e.lastDurationMs}ms`}),(0,y.jsx)(`td`,{className:`px-3 py-3`,children:e.lastError?(0,y.jsx)(`div`,{className:`max-w-sm text-xs text-red-400 line-clamp-3`,children:e.lastError}):(0,y.jsx)(`div`,{className:`max-w-sm font-mono text-[11px] text-muted-foreground line-clamp-3`,children:D(e)})}),(0,y.jsx)(`td`,{className:`px-3 py-3 text-right`,children:(0,y.jsxs)(g,{size:`sm`,variant:`outline`,disabled:!e.enabled||e.running,onClick:r,children:[(0,y.jsx)(t,{className:`h-3.5 w-3.5`}),` Run`]})})]})}function E(e){return e===`succeeded`?(0,y.jsx)(l,{className:`mr-1 h-3 w-3`}):e===`running`?(0,y.jsx)(u,{className:`mr-1 h-3 w-3`}):e===`failed`?(0,y.jsx)(c,{className:`mr-1 h-3 w-3`}):(0,y.jsx)(o,{className:`mr-1 h-3 w-3`})}function D(e){if(!e.lastResult)return`-`;let t=Object.entries(e.lastResult).filter(([,e])=>Array.isArray(e)?e.length>0:e!=null&&e!==0).map(([e,t])=>`${e}: ${Array.isArray(t)?t.length:String(t)}`);return t.length?t.join(`, `):`no changes`}function O(e,t){if(t<=e)return`due now`;let n=Math.max(0,(t-e)/1e3);return n<60?`in ${Math.ceil(n)}s`:n<3600?`in ${Math.ceil(n/60)}m`:n<86400?`in ${Math.ceil(n/3600)}h`:`in ${Math.ceil(n/86400)}d`}export{x as MaintenanceView};
|
|
2
|
-
//# sourceMappingURL=maintenance-BhAxK-Fd.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Xn as e}from"./lucide-react-uFIMC7W7.js";import{O as t,k as n}from"./index-D1GX2b-m.js";import{i as r,n as i,r as a,t as o}from"./lib-Gp69YB9e.js";var s=e(),c={...a,attributes:{...a.attributes,code:[...a.attributes?.code||[],[`className`,/^language-[\w-]+$/]]}};function l(e){return!e||!/^https?:\/\//i.test(e)?{}:{target:`_blank`,rel:`noreferrer`}}function u({content:e,path:a}){return(0,s.jsx)(`div`,{className:`markdown-preview max-w-none overflow-hidden p-4 text-sm leading-6`,children:(0,s.jsx)(r,{remarkPlugins:[o],rehypePlugins:[[i,c]],components:{a({href:e,children:t}){return(0,s.jsx)(`a`,{href:e,...l(e),children:t})},img({src:e,alt:n}){return e?(0,s.jsx)(t,{src:e,alt:n,className:`max-w-full`}):null},code({className:e,children:t,...r}){let i=/language-([\w-]+)/.exec(e||``),o=String(t).replace(/\n$/,``);return i?(0,s.jsx)(n,{content:o,path:`${a}.${i[1]}`,languageHint:i[1],compact:!0}):(0,s.jsx)(`code`,{className:e,...r,children:t})}},children:e})})}export{u as MarkdownPreview};
|
|
2
|
-
//# sourceMappingURL=markdown-preview-impl-BJHjAo1H.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{B as t,G as n,I as r,O as ee,Xn as i,Zt as a,h as te,k as o,kn as ne,lr as s}from"./lucide-react-uFIMC7W7.js";import{l as re,t as c}from"./store-DGM2s9L1.js";import{K as l,d as ie,h as u}from"./display-DRiGi1zj.js";import{t as d}from"./badge-BbfOskRI.js";import{t as f}from"./button-DWiw--lT.js";import{t as p}from"./input-DUdtS3nG.js";import{F as ae,r as oe,s as m}from"./index-D1GX2b-m.js";import{a as h,o as g,r as _,t as v}from"./card-BeqvuYTT.js";var y=e(s(),1),b=i(),x=[`organization`,`role`,`project`,`task`,`interaction`,`agent`],se=[`private`,`project`,`org`,`public`],ce=[`public`,`normal`,`sensitive`,`secret`],S=[`reported`,`inferred`,`verified`];function C(){return{type:`project`,scope:`default`,title:``,content:``,tags:``,visibility:`project`,sensitivity:`normal`,confidence:`reported`,relevanceScore:`0.7`}}function w(e){return{type:e.type,scope:e.scope,title:e.title,content:e.content,tags:e.tags.join(`, `),visibility:e.visibility,sensitivity:e.sensitivity,confidence:e.confidence,relevanceScore:String(e.relevanceScore)}}function T(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function le(e){let t={limit:100};e.type&&(t.type=e.type),e.scope.trim()&&(t.scope=e.scope.trim()),e.visibility&&(t.visibility=e.visibility);let n=T(e.tags);if(n.length&&(t.tags=n),e.minRelevance.trim()){let n=Number(e.minRelevance);Number.isFinite(n)&&(t.minRelevance=Math.max(0,Math.min(1,n)))}return t}function E(e){return e===`secret`?`bg-red-500/10 text-red-400 border-red-500/30`:e===`sensitive`?`bg-yellow-500/10 text-yellow-400 border-yellow-500/30`:e===`public`?`bg-blue-500/10 text-blue-400 border-blue-500/30`:`bg-zinc-500/10 text-zinc-400 border-zinc-500/30`}function D(e){return e>=.8?`text-emerald-400`:e>=.5?`text-yellow-400`:`text-zinc-400`}function ue(e){return e?Object.entries(e).map(([e,t])=>`${e}=${Array.isArray(t)?t.join(` `):String(t)}`).join(` `):`default`}function de(e){return e.filter(e=>![`system`,`user`,`channel`].includes(e.kind||``))}function O(){let e=re(),i=c(e=>e.agents),s=c(e=>e.memories),O=c(e=>e.memoryTotal),A=c(e=>e.memoryStats),j=c(e=>e.memoryBrokerInfo),M=c(e=>e.memoryFilters),N=c(e=>e.selectedMemoryId),pe=c(e=>e.memoryLoading),P=c(e=>e.set),me=c(e=>e.fetchMemories),he=c(e=>e.refreshMemory),F=c(e=>e.saveMemory),I=c(e=>e.deleteMemory),L=c(e=>e.injectMemory),R=s.find(e=>e.id===N),[z,B]=(0,y.useState)(`create`),[V,H]=(0,y.useState)(C),[U,W]=(0,y.useState)(``),[G,ge]=(0,y.useState)(`manual`),[K,_e]=(0,y.useState)(`1600`),[q,ve]=(0,y.useState)(`8`),[J,ye]=(0,y.useState)(``),Y=(0,y.useMemo)(()=>de(i),[i]);(0,y.useEffect)(()=>{!U&&Y[0]&&W(Y[0].id)},[Y,U]),(0,y.useEffect)(()=>{R&&z===`edit`&&H(w(R))},[R?.id,z]);let X=(0,y.useMemo)(()=>{let e=M.search.trim().toLowerCase();return e?s.filter(t=>[t.id,t.type,t.scope,t.title,t.content,...t.tags].some(t=>String(t).toLowerCase().includes(e))):s},[s,M.search]);function Z(e){P({memoryFilters:{...M,...e}})}async function be(){let e=Number(V.relevanceScore),t={title:V.title.trim(),content:V.content.trim(),tags:T(V.tags),visibility:V.visibility,sensitivity:V.sensitivity,confidence:V.confidence,relevanceScore:Number.isFinite(e)?Math.max(0,Math.min(1,e)):.7};if(z===`edit`&&R){await F(t,R.id);return}await F({...t,type:V.type,scope:V.scope.trim()}),B(`create`),H(C())}async function Q(e){if(!U)return;let t=await L({agentId:U,memoryIds:e,query:e?.length?void 0:le(M),reason:G.trim()||`manual`,budget:{maxTokens:Math.max(200,Number(K)||1600),maxMemories:Math.max(1,Number(q)||8),priorityCutoff:3}});t?.command?.id&&ye(t.command.id)}function xe(){B(`create`),H(C())}function Se(){R&&(B(`edit`),H(w(R)))}let Ce=V.title.trim()&&V.content.trim()&&(z===`edit`||V.scope.trim()),$=ue(j?.config);return(0,b.jsxs)(`div`,{className:`space-y-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(ne,{className:`w-5 h-5 text-muted-foreground`}),(0,b.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Memory`}),(0,b.jsx)(d,{variant:`secondary`,children:A?.total??O}),j&&(0,b.jsx)(d,{className:j.external?`bg-blue-500/15 text-blue-400 border-blue-500/30`:`bg-emerald-500/15 text-emerald-400 border-emerald-500/30`,children:j.type})]}),(0,b.jsxs)(f,{size:`sm`,variant:`outline`,className:`gap-1.5`,onClick:()=>he(),children:[(0,b.jsx)(r,{className:`w-3.5 h-3.5 ${pe?`animate-spin`:``}`}),`Refresh`]})]}),(0,b.jsxs)(`div`,{className:`grid gap-3 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,b.jsxs)(v,{children:[(0,b.jsx)(h,{className:`py-3 px-4`,children:(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,b.jsxs)(g,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,b.jsx)(a,{className:`w-4 h-4 text-muted-foreground`}),`Broker`]}),j?.capabilities&&(0,b.jsx)(`div`,{className:`flex flex-wrap gap-1 justify-end`,children:Object.entries(j.capabilities).filter(([,e])=>!!e).map(([e])=>(0,b.jsx)(d,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:e},e))})]})}),(0,b.jsxs)(_,{className:`px-4 pb-4 space-y-3`,children:[(0,b.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-2`,children:[(0,b.jsx)(k,{label:`total`,value:A?.total??O}),(0,b.jsx)(k,{label:`project`,value:A?.byType?.project??0}),(0,b.jsx)(k,{label:`task`,value:A?.byType?.task??0}),(0,b.jsx)(k,{label:`agent`,value:A?.byType?.agent??0}),(0,b.jsx)(k,{label:`sensitive`,value:(A?.bySensitivity?.sensitive??0)+(A?.bySensitivity?.secret??0)})]}),(0,b.jsx)(`div`,{className:`font-mono text-xs text-muted-foreground truncate`,title:$,children:$})]})]}),(0,b.jsxs)(v,{children:[(0,b.jsx)(h,{className:`py-3 px-4`,children:(0,b.jsx)(g,{className:`text-sm font-medium`,children:`Inject`})}),(0,b.jsxs)(_,{className:`px-4 pb-4 space-y-2`,children:[(0,b.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2`,children:[(0,b.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:U,onChange:e=>W(e.target.value),children:[(0,b.jsx)(`option`,{value:``,children:`Agent`}),Y.map(e=>(0,b.jsx)(`option`,{value:e.id,children:ie(e)},e.id))]}),(0,b.jsx)(p,{value:G,onChange:e=>ge(e.target.value),placeholder:`reason`}),(0,b.jsx)(p,{value:K,onChange:e=>_e(e.target.value),inputMode:`numeric`,placeholder:`tokens`}),(0,b.jsx)(p,{value:q,onChange:e=>ve(e.target.value),inputMode:`numeric`,placeholder:`memories`})]}),(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,b.jsxs)(f,{size:`sm`,className:`gap-1.5`,disabled:!U||!R,onClick:()=>R&&Q([R.id]),children:[(0,b.jsx)(ee,{className:`w-3.5 h-3.5`}),`Selected`]}),(0,b.jsxs)(f,{size:`sm`,variant:`outline`,className:`gap-1.5`,disabled:!U,onClick:()=>Q(),children:[(0,b.jsx)(o,{className:`w-3.5 h-3.5`}),`Filtered`]}),J&&(0,b.jsx)(d,{variant:`outline`,className:`font-mono text-[10px]`,children:J})]})]})]})]}),(0,b.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,b.jsxs)(`div`,{className:`space-y-3`,children:[(0,b.jsx)(v,{children:(0,b.jsx)(_,{className:`p-3`,children:(0,b.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-6 gap-2`,children:[(0,b.jsx)(p,{className:`lg:col-span-2`,value:M.search,onChange:e=>Z({search:e.target.value}),placeholder:`Search visible memories`}),(0,b.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:M.type,onChange:e=>Z({type:e.target.value}),children:[(0,b.jsx)(`option`,{value:``,children:`All types`}),x.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))]}),(0,b.jsx)(p,{value:M.scope,onChange:e=>Z({scope:e.target.value}),placeholder:`scope`}),(0,b.jsx)(p,{value:M.tags,onChange:e=>Z({tags:e.target.value}),placeholder:`tags`}),(0,b.jsxs)(`div`,{className:`flex gap-2`,children:[(0,b.jsx)(p,{value:M.minRelevance,onChange:e=>Z({minRelevance:e.target.value}),placeholder:`score`}),(0,b.jsx)(f,{size:`sm`,variant:`outline`,className:`h-8 px-2`,onClick:()=>me(),children:(0,b.jsx)(o,{className:`w-4 h-4`})})]})]})})}),(0,b.jsx)(m,{className:`h-[calc(100dvh-24rem)] min-h-[360px]`,children:(0,b.jsxs)(`div`,{className:`space-y-2 pr-2`,children:[X.length===0&&(0,b.jsx)(`div`,{className:`text-center text-sm text-muted-foreground py-16`,children:`No memories`}),X.map(t=>(0,b.jsx)(fe,{memory:t,selected:t.id===N,now:e,onSelect:()=>P({selectedMemoryId:t.id})},t.id))]})})]}),(0,b.jsxs)(v,{children:[(0,b.jsx)(h,{className:`py-3 px-4`,children:(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,b.jsx)(g,{className:`text-sm font-medium`,children:z===`edit`?`Edit Memory`:`New Memory`}),(0,b.jsxs)(`div`,{className:`flex gap-1`,children:[(0,b.jsx)(f,{size:`sm`,variant:`ghost`,className:`h-7 px-2`,onClick:xe,title:`New memory`,children:(0,b.jsx)(t,{className:`w-3.5 h-3.5`})}),(0,b.jsx)(f,{size:`sm`,variant:`ghost`,className:`h-7 px-2`,onClick:Se,disabled:!R,title:`Edit selected`,children:(0,b.jsx)(n,{className:`w-3.5 h-3.5`})}),(0,b.jsx)(f,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-red-400 hover:text-red-300`,disabled:!R,onClick:()=>R&&I(R.id),title:`Delete selected`,children:(0,b.jsx)(te,{className:`w-3.5 h-3.5`})})]})]})}),(0,b.jsxs)(_,{className:`px-4 pb-4 space-y-3`,children:[R&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`space-y-2`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,b.jsx)(d,{variant:`secondary`,children:R.type}),(0,b.jsx)(d,{variant:`outline`,children:R.scope}),(0,b.jsx)(d,{className:E(R.sensitivity),children:R.sensitivity}),(0,b.jsx)(d,{variant:`outline`,className:D(R.relevanceScore),children:R.relevanceScore.toFixed(2)})]}),(0,b.jsxs)(`div`,{className:`text-xs text-muted-foreground`,title:u(R.updatedAt),children:[`updated `,l(e,R.updatedAt)]}),(0,b.jsx)(`p`,{className:`text-sm font-medium`,children:R.title}),(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground whitespace-pre-wrap max-h-24 overflow-auto`,children:R.content})]}),(0,b.jsx)(ae,{})]}),(0,b.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,b.jsx)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,disabled:z===`edit`,value:V.type,onChange:e=>H({...V,type:e.target.value}),children:x.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))}),(0,b.jsx)(p,{disabled:z===`edit`,value:V.scope,onChange:e=>H({...V,scope:e.target.value}),placeholder:`scope`}),(0,b.jsx)(p,{className:`col-span-2`,value:V.title,onChange:e=>H({...V,title:e.target.value}),placeholder:`title`}),(0,b.jsx)(oe,{className:`col-span-2 min-h-32`,value:V.content,onChange:e=>H({...V,content:e.target.value}),placeholder:`content`}),(0,b.jsx)(p,{className:`col-span-2`,value:V.tags,onChange:e=>H({...V,tags:e.target.value}),placeholder:`tags`}),(0,b.jsx)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:V.visibility,onChange:e=>H({...V,visibility:e.target.value}),children:se.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))}),(0,b.jsx)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:V.sensitivity,onChange:e=>H({...V,sensitivity:e.target.value}),children:ce.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))}),(0,b.jsx)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:V.confidence,onChange:e=>H({...V,confidence:e.target.value}),children:S.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))}),(0,b.jsx)(p,{value:V.relevanceScore,onChange:e=>H({...V,relevanceScore:e.target.value}),inputMode:`decimal`,placeholder:`score`})]}),(0,b.jsx)(f,{size:`sm`,className:`w-full`,disabled:!Ce,onClick:be,children:z===`edit`?`Save memory`:`Create memory`})]})]})]})]})}function k({label:e,value:t}){return(0,b.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/20 px-3 py-2`,children:[(0,b.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:t}),(0,b.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e})]})}function fe({memory:e,selected:t,now:n,onSelect:r}){return(0,b.jsx)(`button`,{onClick:r,className:`w-full text-left rounded-md border p-3 transition-colors ${t?`border-primary bg-primary/5`:`border-border bg-card hover:border-zinc-600`}`,children:(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,b.jsx)(d,{variant:`secondary`,className:`text-[10px]`,children:e.type}),(0,b.jsx)(d,{variant:`outline`,className:`text-[10px] font-mono`,children:e.scope}),(0,b.jsx)(d,{className:`text-[10px] ${E(e.sensitivity)}`,children:e.sensitivity})]}),(0,b.jsx)(`div`,{className:`font-medium text-sm mt-2 truncate`,children:e.title}),(0,b.jsx)(`div`,{className:`text-xs text-muted-foreground line-clamp-2 mt-1`,children:e.content}),e.tags.length>0&&(0,b.jsx)(`div`,{className:`flex gap-1 flex-wrap mt-2`,children:e.tags.slice(0,8).map(e=>(0,b.jsxs)(d,{variant:`outline`,className:`text-[10px] text-zinc-400`,children:[`#`,e]},e))})]}),(0,b.jsxs)(`div`,{className:`text-right shrink-0 space-y-1`,children:[(0,b.jsx)(`div`,{className:`text-sm font-semibold tabular-nums ${D(e.relevanceScore)}`,children:e.relevanceScore.toFixed(2)}),(0,b.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,title:u(e.updatedAt),children:l(n,e.updatedAt)}),e.accessCount>0&&(0,b.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[e.accessCount,` hits`]})]})]})})}export{O as MemoryView};
|
|
2
|
-
//# sourceMappingURL=memory-WwrerNC0.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{A as t,At as n,B as r,D as i,Gt as a,I as o,Jn as s,On as c,S as l,W as u,Wt as d,Xn as f,Yt as p,Z as m,Zn as h,c as g,ft as _,h as v,hn as y,j as b,lr as x,p as S,pn as C,tr as w,wn as T}from"./lucide-react-uFIMC7W7.js";import{d as E,p as D,s as ee,t as O}from"./store-DGM2s9L1.js";import{o as k,r as A}from"./types-Tv67voFu.js";import{t as te}from"./themes-DjSwmAZN.js";import{a as j,i as M,n as N,r as P,t as F}from"./select-Bu-gipoC.js";import{t as I}from"./badge-BbfOskRI.js";import{t as L}from"./button-DWiw--lT.js";import{t as R}from"./input-DUdtS3nG.js";import{I as z,r as B}from"./index-D1GX2b-m.js";import{a as V,i as H,n as U,o as W,r as G,t as K}from"./card-BeqvuYTT.js";import{t as ne}from"./user-avatar-aCd8Fb5v.js";var q=e(x(),1);function J(e){return`${e.namespace}/${e.key}`}function re(e){return`/settings/${encodeURIComponent(e.namespace)}/${encodeURIComponent(e.key)}`}function ie(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`settings`}function ae(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:ie(e),settings:t.sort(oe)})).sort((e,t)=>se(e.settings)-se(t.settings)||e.group.localeCompare(t.group))}function oe(e,t){return(e.display?.order??2**53-1)-(t.display?.order??2**53-1)||e.display?.label?.localeCompare(t.display?.label??``)||J(e).localeCompare(J(t))}function se(e){return Math.min(...e.map(e=>e.display?.order??2**53-1))}function ce(e){return Array.isArray(e.type)?e.type.find(e=>e!==`null`):e.type}function Y(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]=Y(t[r],i,n),t}let a=k(e)?{...e}:{},o=Y(a[r],i,n);return o===void 0?delete a[r]:a[r]=o,a}function le(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(ce(e)){case`boolean`:return!1;case`integer`:case`number`:return 0;case`array`:return[];case`object`:return{};case`string`:return``;default:return}}function ue(e){return e.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean)}function de(e){return Array.isArray(e)?e.map(e=>String(e)).join(`
|
|
2
|
-
`):``}function fe(e){return k(e)?Object.entries(e).map(([e,t])=>`${e}=${String(t??``)}`).join(`
|
|
3
|
-
`):``}function pe(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 X=f(),me=`__unset__`;function he(e){return e===`server-runtime`?`Server runtime`:e===`bootstrap`?`Bootstrap`:`Browser`}function ge(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 _e(e){return e===`browser`?(0,X.jsx)(m,{className:`size-3.5`}):(0,X.jsx)(i,{className:`size-3.5`})}function Z(e){return e.details??[]}function ve({group:e,settings:t,onSaved:n}){let r=[...new Set(t.map(e=>e.tier))];return(0,X.jsxs)(`section`,{className:`space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:e}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:r.map(e=>(0,X.jsxs)(I,{variant:`outline`,className:`gap-1`,title:ge(e),children:[_e(e),he(e)]},e))})]}),t.length===0?(0,X.jsx)(K,{size:`sm`,children:(0,X.jsx)(G,{className:`text-sm text-muted-foreground`,children:`No settings in this group.`})}):(0,X.jsx)(`div`,{className:`space-y-3`,children:t.map(e=>(0,X.jsx)(ye,{setting:e,onSaved:n},J(e)))})]})}function ye({setting:e,onSaved:n}){let[r,i]=(0,q.useState)(()=>e.value??e.defaults??le(e.schema)),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(``),[l,u]=(0,q.useState)([]),d=e.writable&&e.tier===`server-runtime`;function f(e,t){i(n=>Y(n,e,t)),u([]),c(``)}async function p(){if(d){o(!0),u([]),c(``);try{let t=await h(`PUT`,re(e),{value:r,updatedBy:`dashboard`});i(t.value),n(t),c(`Saved`)}catch(e){let t=Z(e);u(t.length?t:[e.message])}finally{o(!1)}}}return(0,X.jsxs)(K,{size:`sm`,children:[(0,X.jsxs)(V,{children:[(0,X.jsxs)(W,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[e.display.label,(0,X.jsxs)(I,{variant:`outline`,className:`gap-1`,title:ge(e.tier),children:[_e(e.tier),he(e.tier)]}),!e.writable&&(0,X.jsx)(I,{variant:`secondary`,children:`Read only`})]}),e.display.description&&(0,X.jsx)(H,{children:e.display.description}),(0,X.jsx)(U,{children:(0,X.jsxs)(L,{size:`sm`,onClick:p,disabled:!d||a,children:[(0,X.jsx)(t,{className:`size-4`}),a?`Saving`:`Save`]})})]}),(0,X.jsxs)(G,{className:`space-y-3`,children:[(0,X.jsx)(be,{schema:e.schema,value:r,path:[],label:e.display.label,required:!0,disabled:!d||a,onChange:f}),(0,X.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-[11px] text-muted-foreground`,children:[(0,X.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono`,children:[e.namespace,`/`,e.key]}),(0,X.jsxs)(`span`,{children:[`read `,(0,X.jsx)(`span`,{className:`text-foreground/70`,children:e.scope.read})]}),(0,X.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,X.jsxs)(`span`,{children:[`write `,(0,X.jsx)(`span`,{className:`text-foreground/70`,children:e.scope.write})]})]}),l.length>0&&(0,X.jsxs)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,X.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 font-medium`,children:[(0,X.jsx)(y,{className:`size-4`}),`Save failed`]}),(0,X.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:l.map(e=>(0,X.jsx)(`li`,{children:e},e))})]}),s&&(0,X.jsxs)(`p`,{className:`flex items-center gap-1 text-sm text-emerald-500`,children:[(0,X.jsx)(C,{className:`size-4`}),s]})]})]})}function be(e){let{schema:t,value:n,path:r,label:i,required:a,disabled:o,onChange:s}=e,c=ce(t);if(t.enum?.length){let e=n==null||n===``?me:String(n);return(0,X.jsx)(Q,{label:i,description:t.description,children:(0,X.jsxs)(F,{value:e,onValueChange:e=>s(r,e===`__unset__`?void 0:e),disabled:o,children:[(0,X.jsx)(M,{children:(0,X.jsx)(j,{})}),(0,X.jsxs)(N,{children:[!a&&(0,X.jsx)(P,{value:`__unset__`,children:`Not set`}),t.enum.map(e=>(0,X.jsx)(P,{value:String(e),children:String(e)},String(e)))]})]})})}if(c===`boolean`)return(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border bg-muted/20 p-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-sm font-medium`,children:i}),t.description&&(0,X.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.description})]}),(0,X.jsx)(z,{checked:!!n,onCheckedChange:e=>s(r,e),disabled:o})]});if(c===`integer`||c===`number`)return(0,X.jsx)(Q,{label:i,description:t.description,children:(0,X.jsx)(R,{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,X.jsx)(Q,{label:i,description:t.description??`One item per line.`,children:(0,X.jsx)(B,{rows:Math.min(8,Math.max(3,Array.isArray(n)?n.length+1:3)),value:de(n),disabled:o,onChange:e=>s(r,ue(e.target.value))})});if(c===`object`){let e=t.properties??{},a=new Set(t.required??[]);return Object.keys(e).length===0&&t.additionalProperties?(0,X.jsx)(Q,{label:i,description:t.description??`KEY=value, one entry per line.`,children:(0,X.jsx)(B,{rows:5,value:fe(n),disabled:o,onChange:e=>s(r,pe(e.target.value))})}):(0,X.jsxs)(`div`,{className:`space-y-3`,children:[r.length>0&&(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-sm font-medium`,children:i}),t.description&&(0,X.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.description})]}),(0,X.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:Object.entries(e).map(([e,t])=>{let i=k(n)?n[e]:void 0;return(0,X.jsx)(be,{schema:t,value:i===void 0&&a.has(e)?le(t):i,path:[...r,e],label:t.title||xe(e),required:a.has(e),disabled:o,onChange:s},e)})})]})}return(0,X.jsx)(Q,{label:i,description:t.description,children:(0,X.jsx)(R,{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 Q({label:e,description:t,children:n}){return(0,X.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:e}),n,t&&(0,X.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:t})]})}function xe(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).replace(/^\w/,e=>e.toUpperCase())}function Se(){let e=O(e=>e.theme),t=O(e=>e.showReasoning),n=O(e=>e.set);return(0,X.jsxs)(`section`,{className:`space-y-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Browser preferences`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`These are stored in local dashboard state, not in Relay server config.`})]}),(0,X.jsxs)(K,{size:`sm`,children:[(0,X.jsxs)(V,{children:[(0,X.jsx)(W,{className:`text-sm`,children:`Dashboard display`}),(0,X.jsx)(H,{className:`text-xs`,children:`Browser tier · persisted in this browser profile.`}),(0,X.jsx)(U,{children:(0,X.jsxs)(I,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(m,{className:`size-3.5`}),`Browser`]})})]}),(0,X.jsxs)(G,{className:`grid gap-3 md:grid-cols-2`,children:[(0,X.jsx)(Q,{label:`Theme`,children:(0,X.jsxs)(F,{value:e,onValueChange:e=>n({theme:e}),children:[(0,X.jsx)(M,{children:(0,X.jsx)(j,{})}),(0,X.jsx)(N,{children:te.map(e=>(0,X.jsx)(P,{value:e.id,children:e.label},e.id))})]})}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border bg-muted/20 p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(c,{className:`size-4`}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-sm font-medium`,children:`Show reasoning details`}),(0,X.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,X.jsx)(z,{checked:t,onCheckedChange:e=>n({showReasoning:e})})]})]})]}),(0,X.jsx)(Ce,{})]})}function Ce(){let e=O(e=>e.voiceTtsEnabled),t=O(e=>e.setVoiceTtsEnabled),n=O(e=>e.voiceTtsMode),r=O(e=>e.setVoiceTtsMode),i=O(e=>e.voiceTtsKokoroVoice),a=O(e=>e.setVoiceTtsKokoroVoice),o=O(e=>e.voiceTtsBrowserVoice),s=O(e=>e.setVoiceTtsBrowserVoice),c=O(e=>e.voiceInputMode),l=O(e=>e.setVoiceInputMode),[u,d]=(0,q.useState)(()=>D());(0,q.useEffect)(()=>{if(typeof window>`u`||!(`speechSynthesis`in window))return;let e=()=>d(D());return e(),window.speechSynthesis.addEventListener?.(`voiceschanged`,e),()=>window.speechSynthesis.removeEventListener?.(`voiceschanged`,e)},[]);let f=E.some(e=>e.id===i)?E:[...E,{id:i,label:i}];return(0,X.jsxs)(K,{size:`sm`,children:[(0,X.jsxs)(V,{children:[(0,X.jsxs)(W,{className:`flex items-center gap-2 text-sm`,children:[(0,X.jsx)(g,{className:`size-4`}),`Voice`]}),(0,X.jsx)(H,{className:`text-xs`,children:`Browser tier TTS and push-to-talk behavior.`}),(0,X.jsx)(U,{children:(0,X.jsx)(z,{checked:e,onCheckedChange:t})})]}),(0,X.jsxs)(G,{className:`grid gap-3 md:grid-cols-2`,children:[(0,X.jsx)(Q,{label:`Speech engine`,children:(0,X.jsxs)(F,{value:n,onValueChange:e=>r(e),children:[(0,X.jsx)(M,{children:(0,X.jsx)(j,{})}),(0,X.jsxs)(N,{children:[(0,X.jsx)(P,{value:`kokoro`,children:`Kokoro (server, fallback to browser)`}),(0,X.jsx)(P,{value:`browser`,children:`Browser Web Speech API`})]})]})}),(0,X.jsx)(Q,{label:`Kokoro voice`,children:(0,X.jsxs)(F,{value:i,onValueChange:a,children:[(0,X.jsx)(M,{children:(0,X.jsx)(j,{})}),(0,X.jsx)(N,{children:f.map(e=>(0,X.jsx)(P,{value:e.id,children:e.label},e.id))})]})}),(0,X.jsx)(Q,{label:`Browser voice`,children:(0,X.jsxs)(F,{value:o||`__unset__`,onValueChange:e=>s(e===`__unset__`?``:e),children:[(0,X.jsx)(M,{children:(0,X.jsx)(j,{})}),(0,X.jsxs)(N,{children:[(0,X.jsx)(P,{value:me,children:`System default`}),u.map(e=>(0,X.jsx)(P,{value:e.uri,children:e.label},e.uri))]})]})}),(0,X.jsx)(Q,{label:`Push-to-talk input`,children:(0,X.jsxs)(F,{value:c,onValueChange:e=>l(e),children:[(0,X.jsx)(M,{children:(0,X.jsx)(j,{})}),(0,X.jsxs)(N,{children:[(0,X.jsx)(P,{value:`compose`,children:`Fill message box`}),(0,X.jsx)(P,{value:`autosend`,children:`Send immediately`})]})]})})]})]})}function we({catalog:e,error:t,canWrite:n,onCatalog:o}){let s=e[0]?.provider??`codex`,[c,f]=(0,q.useState)(s),[p,m]=(0,q.useState)(()=>Te(s)),[g,_]=(0,q.useState)(``),[y,b]=(0,q.useState)([]),x=e.some(e=>e.provider===c)?c:s,S=e.find(e=>e.provider===x)??e[0],w=e.map(e=>e.provider);function T(e){m(t=>({...t,...e})),b([]),_(``)}function E(e){f(e),m(Te(e)),b([]),_(``)}async function D(){o((await h(`GET`,`/providers`)).catalog)}async function ee(){if(n){b([]),_(``);try{await h(`PUT`,`/providers/${encodeURIComponent(p.provider)}/models/${encodeURIComponent(p.alias)}`,{label:p.label,providerModel:p.providerModel,efforts:ue(p.efforts),defaultEffort:p.defaultEffort.trim()||void 0,limits:p.limits,capabilities:p.capabilities,contextThreshold:Ee(p),disabled:p.disabled,updatedBy:`dashboard`}),await D(),_(`${p.alias} saved`),m(Te(p.provider))}catch(e){let t=Z(e);b(t.length?t:[e.message])}}}async function O(e,t){if(n){b([]),_(``);try{await h(`PATCH`,`/providers/${encodeURIComponent(x)}/models/${encodeURIComponent(e.alias)}`,{disabled:t,updatedBy:`dashboard`}),await D(),_(`${e.alias} ${t?`disabled`:`enabled`}`)}catch(e){let t=Z(e);b(t.length?t:[e.message])}}}async function k(e){if(n){b([]),_(``);try{await h(`DELETE`,`/providers/${encodeURIComponent(x)}/models/${encodeURIComponent(e.alias)}`),await D(),_(`${e.alias} removed`)}catch(e){let t=Z(e);b(t.length?t:[e.message])}}}function A(e){m({provider:x,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}),b([]),_(``)}return t?(0,X.jsx)(K,{size:`sm`,children:(0,X.jsxs)(G,{className:`text-sm text-muted-foreground`,children:[(0,X.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 font-medium text-foreground`,children:[(0,X.jsx)(l,{className:`size-4`}),`Model catalog`]}),t]})}):(0,X.jsxs)(`section`,{className:`space-y-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Model catalog`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Add override models, disable unavailable models, or remove custom entries from the provider catalog.`})]}),!n&&(0,X.jsx)(I,{variant:`secondary`,children:`Read only: needs settings:write:provider`})]}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:w.map(e=>(0,X.jsx)(L,{variant:e===x?`default`:`outline`,size:`sm`,onClick:()=>E(e),children:e},e))}),(0,X.jsxs)(K,{size:`sm`,children:[(0,X.jsxs)(V,{children:[(0,X.jsx)(W,{className:`text-sm`,children:`Add or edit model`}),(0,X.jsx)(U,{children:(0,X.jsxs)(I,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(i,{className:`size-3.5`}),`Server runtime`]})})]}),(0,X.jsxs)(G,{className:`space-y-3`,children:[(0,X.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,X.jsx)(Q,{label:`Alias`,children:(0,X.jsx)(R,{value:p.alias,disabled:!n,placeholder:`nightly`,onChange:e=>T({alias:e.target.value.trim()})})}),(0,X.jsx)(Q,{label:`Label`,children:(0,X.jsx)(R,{value:p.label,disabled:!n,placeholder:`Nightly Codex`,onChange:e=>T({label:e.target.value})})}),(0,X.jsx)(Q,{label:`Provider model`,children:(0,X.jsx)(R,{value:p.providerModel,disabled:!n,placeholder:`codex-nightly`,onChange:e=>T({providerModel:e.target.value})})}),(0,X.jsx)(Q,{label:`Efforts`,children:(0,X.jsx)(R,{value:p.efforts,disabled:!n,placeholder:`low, medium, high`,onChange:e=>T({efforts:e.target.value})})}),(0,X.jsx)(Q,{label:`Default effort`,children:(0,X.jsx)(R,{value:p.defaultEffort,disabled:!n,placeholder:`medium`,onChange:e=>T({defaultEffort:e.target.value})})}),(0,X.jsx)(Q,{label:`Self compact utilization`,children:(0,X.jsx)(R,{value:p.selfCompactUtilization,disabled:!n,placeholder:`0.80`,inputMode:`decimal`,onChange:e=>T({selfCompactUtilization:e.target.value})})}),(0,X.jsx)(Q,{label:`Warn utilization`,children:(0,X.jsx)(R,{value:p.warnUtilization,disabled:!n,placeholder:`default: self - 0.10`,inputMode:`decimal`,onChange:e=>T({warnUtilization:e.target.value})})}),(0,X.jsx)(Q,{label:`Hard backstop utilization`,children:(0,X.jsx)(R,{value:p.hardBackstopUtilization,disabled:!n,placeholder:`0.90`,inputMode:`decimal`,onChange:e=>T({hardBackstopUtilization:e.target.value})})}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border bg-muted/20 p-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-sm font-medium`,children:`Disabled`}),(0,X.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Keep visible but unavailable for new launches.`})]}),(0,X.jsx)(z,{checked:p.disabled,disabled:!n,onCheckedChange:e=>T({disabled:e})})]})]}),(0,X.jsxs)(L,{onClick:ee,disabled:!n||!p.alias||!p.label||!p.providerModel,children:[(0,X.jsx)(r,{className:`size-4`}),`Save model`]})]})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[S&&S.models.length===0&&(0,X.jsx)(K,{size:`sm`,children:(0,X.jsx)(G,{className:`text-sm text-muted-foreground`,children:`No models in this provider catalog yet.`})}),S?.models.map(e=>(0,X.jsx)(K,{size:`sm`,children:(0,X.jsxs)(G,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,X.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs`,children:e.alias}),e.disabled&&(0,X.jsx)(I,{variant:`secondary`,children:`Disabled`})]}),(0,X.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 ${Oe(e)}`]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(L,{variant:`outline`,size:`sm`,onClick:()=>A(e),children:[(0,X.jsx)(u,{className:`size-4`}),`Edit`]}),(0,X.jsxs)(L,{variant:`outline`,size:`sm`,disabled:!n,onClick:()=>void O(e,!e.disabled),children:[e.disabled?(0,X.jsx)(d,{className:`size-4`}):(0,X.jsx)(a,{className:`size-4`}),e.disabled?`Enable`:`Disable`]}),(0,X.jsxs)(L,{variant:`outline`,size:`sm`,disabled:!n,onClick:()=>void k(e),children:[(0,X.jsx)(v,{className:`size-4`}),`Remove`]})]})]})},e.alias))]}),y.length>0&&(0,X.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:(0,X.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:y.map(e=>(0,X.jsx)(`li`,{children:e},e))})}),g&&(0,X.jsxs)(`p`,{className:`flex items-center gap-1 text-sm text-emerald-500`,children:[(0,X.jsx)(C,{className:`size-4`}),g]})]})}function Te(e){return{provider:e,alias:``,label:``,providerModel:``,efforts:``,defaultEffort:``,selfCompactUtilization:``,warnUtilization:``,hardBackstopUtilization:``,disabled:!1}}function Ee(e){let t=De(e.selfCompactUtilization,`Self compact utilization`),n=De(e.warnUtilization,`Warn utilization`),r=De(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 De(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 Oe(e){if(e.contextThreshold)return`self ${$(e.contextThreshold.selfCompactUtilization)}, warn ${$(e.contextThreshold.warnUtilization??Math.max(0,e.contextThreshold.selfCompactUtilization-.1))}`;let t=ee(e.limits?.contextWindowTokens?.value);return`derived self ${$(t.selfCompactUtilization)}, warn ${$(t.warnUtilization)}`}function $(e){return`${Math.round(e*100)}%`}var ke=5,Ae=15,je={claude:`Claude`,codex:`Codex`};function Me(e){return Math.round(e/6e4)}function Ne(e){return`${Me(e)} min`}function Pe({canWrite:e}){let[t,r]=(0,q.useState)(null),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(null);(0,q.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await h(`GET`,`/providers/quota-config`);e||r(t)}catch(t){e||a(t.message)}})(),()=>{e=!0}},[]);async function u(e,t){r(n=>({...n??{},[e]:t})),s(``),l(e);try{let n=await h(`PUT`,`/providers/${e}/quota-config`,t);r(t=>({...t??{},[e]:n}))}catch(t){s(`${je[e]??e}: ${t.message}`)}finally{l(null)}}let d=t?Object.keys(t).sort():[];return(0,X.jsxs)(`section`,{className:`space-y-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Quota`}),(0,X.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Per-provider quota collection and display. `,(0,X.jsx)(`strong`,{children:`Enabled`}),` governs collection (disabled stops polling — no API calls);`,(0,X.jsx)(`strong`,{children:` Show in widget`}),` governs display only.`]})]}),i&&(0,X.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,X.jsx)(y,{className:`mt-0.5 size-4`}),(0,X.jsx)(`span`,{children:i})]}),o&&(0,X.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,X.jsx)(y,{className:`mt-0.5 size-4`}),(0,X.jsx)(`span`,{children:o})]}),!t&&!i&&(0,X.jsx)(K,{size:`sm`,children:(0,X.jsxs)(G,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,X.jsx)(_,{className:`size-4 animate-spin`}),`Loading quota config…`]})}),d.map(i=>{let a=t[i],o=!e||c===i;return(0,X.jsxs)(K,{size:`sm`,children:[(0,X.jsxs)(V,{children:[(0,X.jsxs)(W,{className:`flex items-center gap-2 text-sm`,children:[(0,X.jsx)(n,{className:`size-4`}),je[i]??i,c===i&&(0,X.jsx)(_,{className:`size-3 animate-spin text-muted-foreground`})]}),(0,X.jsxs)(H,{className:`text-xs`,children:[a.enabled?`Polled every ${Ne(a.pollIntervalMs)}`:`Collection disabled`,a.enabled&&!a.showInWidget?` · hidden from widget`:``]})]}),(0,X.jsxs)(G,{className:`space-y-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border bg-muted/20 p-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-sm font-medium`,children:`Enabled`}),(0,X.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Collect quota for this provider. Off stops all polling (no API calls, no token spend).`})]}),(0,X.jsx)(z,{checked:a.enabled,disabled:o,onCheckedChange:e=>void u(i,{...a,enabled:e})})]}),(0,X.jsxs)(`div`,{className:`rounded-md border bg-muted/20 p-3 space-y-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(`div`,{className:`text-sm font-medium`,children:`Polling interval`}),(0,X.jsx)(I,{variant:`outline`,className:`tabular-nums`,children:Ne(a.pollIntervalMs)})]}),(0,X.jsx)(`input`,{type:`range`,min:ke,max:Ae,step:1,value:Me(a.pollIntervalMs),disabled:o||!a.enabled,onChange:e=>{let t=Number(e.target.value)*6e4;r(e=>({...e??{},[i]:{...a,pollIntervalMs:t}}))},onPointerUp:e=>void u(i,{...a,pollIntervalMs:Number(e.target.value)*6e4}),onKeyUp:e=>void u(i,{...a,pollIntervalMs:Number(e.target.value)*6e4}),className:`w-full accent-primary disabled:opacity-50`}),(0,X.jsxs)(`div`,{className:`flex justify-between text-[10px] text-muted-foreground`,children:[(0,X.jsxs)(`span`,{children:[ke,` min`]}),(0,X.jsxs)(`span`,{children:[Ae,` min`]})]})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border bg-muted/20 p-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-sm font-medium`,children:`Show in quota widget`}),(0,X.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Display only. Off hides this provider from the dashboard widget; collection continues if enabled.`})]}),(0,X.jsx)(z,{checked:a.showInWidget,disabled:o,onCheckedChange:e=>void u(i,{...a,showInWidget:e})})]})]})]},i)})]})}var Fe=`browser`,Ie=`models`,Le=`profile`,Re=[`branch.landed`,`landed-failure`,`agent.ready`,`agent.exited`,`agent.spawn_failed`,`agent.context_threshold`,`agent.quota_threshold`,`workspace.steward_task`,`workspace.conflict`,`workspace.review_request`];function ze(){if(typeof window>`u`)return``;let e=window.location.hash.replace(/^#/,``);return e.startsWith(`settings/`)?decodeURIComponent(e.slice(9)):``}function Be(e){if(typeof window>`u`)return;let t=new URL(window.location.href);t.hash=`settings/${encodeURIComponent(e)}`,window.history.pushState({},``,t)}function Ve(){let[e,t]=(0,q.useState)([]),[n,r]=(0,q.useState)(null),[i,a]=(0,q.useState)([]),[c,l]=(0,q.useState)(()=>ze()),[u,d]=(0,q.useState)(!0),[f,m]=(0,q.useState)(``),[g,_]=(0,q.useState)(``);async function v(){d(!0),m(``),_(``);try{let[e,n,i]=await Promise.all([h(`GET`,`/settings`),h(`GET`,`/tokens/me`),h(`GET`,`/providers`).catch(e=>(_(e.message),{catalog:[]}))]);t(e.settings),r(n),a(i.catalog)}catch(e){m(e.message)}finally{d(!1)}}(0,q.useEffect)(()=>{v()},[]),(0,q.useEffect)(()=>{let e=()=>l(ze());return window.addEventListener(`hashchange`,e),window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`hashchange`,e),window.removeEventListener(`popstate`,e)}},[]);let b=(0,q.useMemo)(()=>ae(e),[e]),x=(0,q.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:Le,label:`Profile`,description:`Display name and avatar`,kind:`profile`,settings:[]},{slug:Fe,label:`Browser`,description:`Local dashboard preferences`,kind:`browser`,settings:[]},{slug:Ie,label:`Models`,description:`Provider model catalog`,kind:`models`,settings:[]}],[b]),S=x.find(e=>e.slug===c)??x[0];function C(e){l(e),Be(e)}function w(e){t(t=>t.map(t=>J(t)===J(e)?e:t))}return(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Settings`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Schema-driven Relay settings, browser preferences, and model catalog controls.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n&&(0,X.jsxs)(I,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(p,{className:`size-3`}),n.kind,`:`,n.actor]}),(0,X.jsxs)(L,{variant:`outline`,size:`sm`,onClick:()=>void v(),disabled:u,children:[(0,X.jsx)(o,{className:s(`size-4`,u&&`animate-spin`)}),`Refresh`]})]})]}),f&&(0,X.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,X.jsx)(y,{className:`mt-0.5 size-4`}),(0,X.jsx)(`span`,{children:f})]}),(0,X.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[230px_minmax(0,1fr)]`,children:[(0,X.jsx)(`nav`,{className:`space-y-1 lg:sticky lg:top-4 lg:self-start`,children:x.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:s(`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,X.jsx)(`span`,{className:`block font-medium`,children:e.label}),(0,X.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.description})]},e.slug))}),(0,X.jsx)(`div`,{className:`min-w-0 space-y-4`,children:u&&!e.length?(0,X.jsx)(K,{size:`sm`,children:(0,X.jsx)(G,{className:`text-sm text-muted-foreground`,children:`Loading settings…`})}):S?.kind===`descriptors`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ve,{group:S.label,settings:S.settings,onSaved:w}),S.label===`Providers`&&(0,X.jsx)(Pe,{canWrite:A(n?.scopes,`settings:write:provider`)}),S.label===`Notifications`&&(0,X.jsx)(He,{})]}):S?.kind===`profile`?(0,X.jsx)(Ue,{}):S?.kind===`browser`?(0,X.jsx)(Se,{}):(0,X.jsx)(we,{catalog:i,error:g,canWrite:A(n?.scopes,`settings:write:provider`),onCatalog:a})})]})]})}function He(){let[e,t]=(0,q.useState)(`branch.landed`),[n,r]=(0,q.useState)(`{
|
|
4
|
-
"repoRoot": "/repo"
|
|
5
|
-
}`),[i,a]=(0,q.useState)(null),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(``);async function u(){s(!0),l(``);try{let t=JSON.parse(n);if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Scope must be a JSON object`);a((await h(`POST`,`/notifications/preview`,{type:e,scope:t})).preview)}catch(e){a(null),l(e.message)}finally{s(!1)}}return(0,X.jsx)(K,{size:`sm`,children:(0,X.jsxs)(G,{className:`space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Who gets what`}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Dry-run notification routing without sending.`})]}),(0,X.jsxs)(L,{size:`sm`,onClick:()=>void u(),disabled:o,children:[(0,X.jsx)(b,{className:`size-4`}),`Preview`]})]}),(0,X.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Type`}),(0,X.jsxs)(F,{value:e,onValueChange:t,children:[(0,X.jsx)(M,{className:`w-full`,children:(0,X.jsx)(j,{})}),(0,X.jsx)(N,{children:Re.map(e=>(0,X.jsx)(P,{value:e,children:e},e))})]})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Scope`}),(0,X.jsx)(B,{value:n,onChange:e=>r(e.target.value),rows:4,className:`font-mono text-xs`})]})]}),c&&(0,X.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-2 text-xs text-destructive`,children:[(0,X.jsx)(y,{className:`mt-0.5 size-3.5`}),(0,X.jsx)(`span`,{children:c})]}),i&&(0,X.jsx)(`div`,{className:`overflow-hidden rounded-md border border-border`,children:i.recipients.length===0?(0,X.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:`No recipients`}):i.recipients.map(e=>(0,X.jsxs)(`div`,{className:`grid gap-1 border-b border-border px-3 py-2 text-xs last:border-b-0 md:grid-cols-[minmax(0,180px)_minmax(0,160px)_minmax(0,1fr)]`,children:[(0,X.jsx)(`span`,{className:`truncate font-medium`,children:e.recipient}),(0,X.jsx)(`span`,{className:`truncate font-mono text-muted-foreground`,children:e.matchedRule}),(0,X.jsx)(`span`,{className:`truncate text-muted-foreground`,children:e.reason})]},`${e.recipient}-${e.matchedRule}`))})]})})}function Ue(){let e=O(e=>e.fetchUsers),n=(0,q.useRef)(null),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(!0),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(``);async function p(){c(!0),f(``);try{let e=await h(`GET`,`/users/me`);i(e),o(e.displayName||e.handle)}catch(e){f(e.message)}finally{c(!1)}}(0,q.useEffect)(()=>{p()},[]);async function m(){u(!0),f(``);try{let t=await h(`PATCH`,`/users/me`,{displayName:a});i(t),o(t.displayName||t.handle),await e()}catch(e){f(e.message)}finally{u(!1)}}async function g(t){if(t){u(!0),f(``);try{let n=await w(`/users/me/avatar`,t);i(n.user),o(n.user.displayName||n.user.handle),await e()}catch(e){f(e.message)}finally{u(!1),n.current&&(n.current.value=``)}}}async function _(){u(!0),f(``);try{i(await h(`DELETE`,`/users/me/avatar`)),await e()}catch(e){f(e.message)}finally{u(!1)}}return(0,X.jsx)(K,{size:`sm`,children:(0,X.jsxs)(G,{className:`space-y-4`,children:[d&&(0,X.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,X.jsx)(y,{className:`mt-0.5 size-4`}),(0,X.jsx)(`span`,{children:d})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,X.jsx)(ne,{user:r??void 0,distinct:!0,className:`size-16 text-lg`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,X.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground`,htmlFor:`profile-display-name`,children:`Display name`}),(0,X.jsx)(`input`,{id:`profile-display-name`,className:`h-9 w-full rounded-md border border-input bg-background px-3 text-sm`,value:a,onChange:e=>o(e.target.value),disabled:s||l,maxLength:120})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(L,{size:`sm`,onClick:()=>void m(),disabled:s||l||!a.trim(),children:[(0,X.jsx)(t,{className:`size-4`}),`Save`]}),(0,X.jsxs)(L,{size:`sm`,variant:`outline`,onClick:()=>n.current?.click(),disabled:s||l,children:[(0,X.jsx)(S,{className:`size-4`}),`Upload`]}),(0,X.jsxs)(L,{size:`sm`,variant:`outline`,onClick:()=>void _(),disabled:s||l||!r?.avatarArtifactId,children:[(0,X.jsx)(v,{className:`size-4`}),`Remove`]}),l&&(0,X.jsx)(T,{className:`size-4 animate-pulse text-muted-foreground`}),(0,X.jsx)(`input`,{ref:n,type:`file`,accept:`image/png,image/jpeg,image/gif,image/webp`,className:`hidden`,onChange:e=>void g(e.target.files?.[0])})]})]})})}export{Ve as SettingsView};
|
|
6
|
-
//# sourceMappingURL=settings-CoOySnqS.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{Jn as t,Qn as n,Xn as r,lr as i}from"./lucide-react-uFIMC7W7.js";import{_ as a,rt as o}from"./display-DRiGi1zj.js";import{w as s}from"./index-D1GX2b-m.js";var c=e(i(),1),l=r(),u={id:o};function d({user:e,address:r,distinct:i=!1,className:o}){let d=e?.avatarUrl??(e?.avatarArtifactId?`/artifacts/${encodeURIComponent(e.avatarArtifactId)}/content`:null),[f,p]=(0,c.useState)(null);(0,c.useEffect)(()=>{if(!d){p(null);return}let e=!1,t=null;return(async()=>{try{let r=await n(d);if(e)return;t=URL.createObjectURL(r),p(t)}catch{e||p(null)}})(),()=>{e=!0,t&&URL.revokeObjectURL(t)}},[d]);let m=e?.displayName||e?.handle||`User`;if(f)return(0,l.jsx)(`img`,{src:f,alt:m,title:m,className:t(`w-7 h-7 rounded-md object-cover`,o)});if(i){let e=(m.trim()[0]||`U`).toUpperCase();return(0,l.jsx)(`span`,{title:m,className:t(`inline-flex w-7 h-7 items-center justify-center rounded-md bg-muted text-xs font-semibold ring-1 ring-foreground/10`,a(r),o),children:e})}return(0,l.jsx)(s,{agent:u,className:o})}export{d as t};
|
|
2
|
-
//# sourceMappingURL=user-avatar-aCd8Fb5v.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{Et as t,Ft as n,I as r,Kn as i,Ot as a,Rn as o,Rt as s,Un as c,Ut as l,Vt as u,Wt as d,X as f,Xn as p,_n as m,bn as h,h as g,i as _,in as v,kt as y,lr as b,m as x,yn as S}from"./lucide-react-uFIMC7W7.js";import{l as C,t as w}from"./store-DGM2s9L1.js";import{K as T,d as E}from"./display-DRiGi1zj.js";import{i as D}from"./types-Tv67voFu.js";import{t as O}from"./badge-BbfOskRI.js";import{t as k}from"./button-DWiw--lT.js";import{t as A}from"./copy-button-CIXy8ks6.js";import{a as j,o as M,r as N,t as P}from"./card-BeqvuYTT.js";var F=e(b(),1),I=p(),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(D);function W(e){let t=e.split(`/`).filter(Boolean);return t.length<=3?e||`-`:`/${t.slice(-3).join(`/`)}`}function G(e,t){return e?E(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:r,onToggleDetails:i}){let a=w(e=>e.workspaceAction),o=w(e=>e.purgeWorkspace),c=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`,p=e.worktreePath||e.sourceCwd||e.repoRoot,v=w(t=>t.workspaceGitState[e.id]),y=!!v&&v.available!==!1&&v.landed===!0,b=e.mode===`isolated`&&!!e.worktreePath&&z.has(e.status)&&!y;async function x(){await c(e.id),await a(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:r?`Hide details`:`Show diff & timeline`,onClick:i,children:r?(0,I.jsx)(S,{className:`h-3.5 w-3.5`}):(0,I.jsx)(m,{className:`h-3.5 w-3.5`})}),(0,I.jsx)(k,{size:`icon-sm`,variant:`ghost`,title:`Open workspace`,disabled:!p||e.status===`cleaned`,onClick:()=>void l({path:p}),children:(0,I.jsx)(n,{className:`h-3.5 w-3.5`})}),(0,I.jsx)(A,{value:p,label:`Copy path`,copiedLabel:`Copied path`,size:`icon-sm`,variant:`ghost`,disabled:!p}),(0,I.jsx)(k,{size:`icon-sm`,variant:`outline`,title:`Mark ready`,disabled:f||e.status===`ready`,onClick:()=>void a(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:f||e.status===`review_requested`,onClick:()=>void a(e.id,`request-review`),children:(0,I.jsx)(d,{className:`h-3.5 w-3.5`})}),(0,I.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,I.jsx)(s,{className:`h-3.5 w-3.5`})}),(0,I.jsx)(k,{size:`icon-sm`,variant:`default`,title:y?`Already merged into base — nothing to land`:`Merge & land work`,disabled:!b,onClick:()=>void x(),children:(0,I.jsx)(t,{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 a(e.id,`cleanup`),children:(0,I.jsx)(g,{className:`h-3.5 w-3.5`})}),u&&(0,I.jsx)(k,{size:`icon-sm`,variant:`ghost`,title:`Purge record (clears the row, does not touch disk)`,onClick:()=>void o(e.id),children:(0,I.jsx)(_,{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)(x,{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(),n=w(t=>t.workspaceGitState[e.id]),i=w(e=>e.fetchWorkspaceGitState),s=e.mode===`isolated`&&!!e.worktreePath&&R.has(e.status);if((0,F.useEffect)(()=>{s&&n===void 0&&i(e.id)},[s,n,e.id,i]),!s)return null;let l=(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)(r,{className:`h-3 w-3`})});if(n===void 0)return(0,I.jsx)(`div`,{className:`flex items-center gap-1 text-[11px] text-muted-foreground`,children:`Loading git state…`});if(n.available===!1)return(0,I.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] text-muted-foreground`,title:n.reason,children:[(0,I.jsx)(`span`,{children:`git state unavailable`}),l]});if(n.missing)return(0,I.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] text-muted-foreground`,children:[`worktree gone `,l]});if(n.error)return(0,I.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] text-red-400`,title:n.error,children:[(0,I.jsx)(`span`,{children:`git error`}),l]});let d=n.ahead??0,f=n.landed===!0,p=f?0:n.unmergedAhead??d,m=n.behind??0,g=n.dirtyCount??0,_=p===0&&g===0&&!f,v=n.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 ${n.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:d===p?`${p} commit(s) ahead of base`:`${p} unmerged commit(s) (${d} ahead of base)`,children:[(0,I.jsx)(o,{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)(u,{className:`h-3 w-3`}),g]}),!f&&(0,I.jsx)(Z,{workspace:e,unmerged:p})]}),l]}),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)(a,{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)(v,{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),i=e.mode===`isolated`&&!!e.worktreePath;if((0,F.useEffect)(()=>{i&&t===void 0&&n(e.id)},[i,t,e.id,n]),!i)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 a=(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)(r,{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)(l,{className:`h-3 w-3`}),(0,I.jsxs)(`span`,{children:[t.files.length,` file`,t.files.length===1?``:`s`,` vs `,t.baseRef||`base`]}),a]}),(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)(f,{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)(r,{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)(y,{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 n=e.metadata?.mergeResult,r=n?.prUrl,i=n?.error||e.metadata?.mergeError;return!r&&!i?null:(0,I.jsxs)(I.Fragment,{children:[r&&(0,I.jsxs)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,title:r,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)(t,{className:`h-2.5 w-2.5`}),ie(r)]}),i&&(0,I.jsxs)(O,{variant:`outline`,className:`max-w-[16rem] border-amber-500/30 text-amber-400 text-[10px]`,title:i,children:[(0,I.jsx)(x,{className:`mr-0.5 h-2.5 w-2.5 shrink-0`}),(0,I.jsxs)(`span`,{className:`truncate`,children:[`merge: `,i]})]})]})}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)(y,{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-DXTrd2or.js.map
|