specrails-desktop 2.30.2 → 2.30.3

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 (28) hide show
  1. package/client/dist/assets/{ActivityFeedPage-9DZOvIcY.js → ActivityFeedPage-CcBOllqm.js} +1 -1
  2. package/client/dist/assets/{AgentBrowserCapture-DqyHbzk7.js → AgentBrowserCapture-BOJkZUj_.js} +1 -1
  3. package/client/dist/assets/{AgentModeCodePane-BAYyFRmY.js → AgentModeCodePane-BIh67rGi.js} +2 -2
  4. package/client/dist/assets/{AgentModeJobsPane-CTIHMUKN.js → AgentModeJobsPane-C5tkU2Ed.js} +1 -1
  5. package/client/dist/assets/{AgentsPage-DuyJuaFs.js → AgentsPage-CNlE_Uh4.js} +1 -1
  6. package/client/dist/assets/{AnalyticsPage-BY7gtCx6.js → AnalyticsPage-cYcJxWPn.js} +1 -1
  7. package/client/dist/assets/{CodePage-vyQr40Vl.js → CodePage-D4QYa4t1.js} +1 -1
  8. package/client/dist/assets/{DesktopAnalyticsPage-CkXUFj3F.js → DesktopAnalyticsPage-DCmgYV86.js} +1 -1
  9. package/client/dist/assets/{DocsDialog-PhdCJNVj.js → DocsDialog-BXnOgm7V.js} +1 -1
  10. package/client/dist/assets/{DocsPage-BY-wDthx.js → DocsPage-nFkHh-Dc.js} +1 -1
  11. package/client/dist/assets/{InteractiveJobComposer-C9I0A4KR.js → InteractiveJobComposer-qoeZjwVY.js} +1 -1
  12. package/client/dist/assets/{JobDetailModal-I_RoQJV4.js → JobDetailModal-ChRBB9bc.js} +1 -1
  13. package/client/dist/assets/{JobDetailPage-CU4FEnUC.js → JobDetailPage-BuOnlndB.js} +1 -1
  14. package/client/dist/assets/{JobsPage-DcllM4Ip.js → JobsPage-C_UEIXWA.js} +1 -1
  15. package/client/dist/assets/{LoopBuilderPage-DGm_iuff.js → LoopBuilderPage-BV_wge0g.js} +1 -1
  16. package/client/dist/assets/{LoopPreviewModal-BC-TeFdD.js → LoopPreviewModal-Qk_Jaxo8.js} +1 -1
  17. package/client/dist/assets/{LoopsPage-SqglnXlp.js → LoopsPage-lLi6ax0p.js} +1 -1
  18. package/client/dist/assets/{PluginsPage-B89S8o1a.js → PluginsPage-DZIFv9kw.js} +1 -1
  19. package/client/dist/assets/{ProjectSettingsDialog-nEs-ENrE.js → ProjectSettingsDialog-DEHcyt_I.js} +1 -1
  20. package/client/dist/assets/{TemplatePreviewModal-D4qW-J9B.js → TemplatePreviewModal-Bxbtnzob.js} +1 -1
  21. package/client/dist/assets/{TicketDetailModal-CI47Dq9E.js → TicketDetailModal-CqQ5gx7O.js} +2 -2
  22. package/client/dist/assets/{dist-js-jwoXo0YD.js → dist-js-CBhuoTO6.js} +1 -1
  23. package/client/dist/assets/{dist-js-Dj72W6qo.js → dist-js-eSxaoEw0.js} +1 -1
  24. package/client/dist/assets/{index-F9r8mWP_.js → index-CewRMo0W.js} +10 -10
  25. package/client/dist/index.html +2 -2
  26. package/package.json +1 -1
  27. package/server/dist/core-update-manager.js +17 -1
  28. package/server/dist/framework-manager.js +19 -2
@@ -1,2 +1,2 @@
1
- import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{n as r,t as i}from"./createLucideIcon-Bjbbp_KS.js";import{n as a}from"./dist-bVqfYmby.js";import{t as o}from"./download-CFHyyHcw.js";import{t as s}from"./loader-circle-DcygOQpC.js";import{t as c}from"./search-Cq_gE3Ik.js";import{t as l}from"./trash-2-BOU3WdZZ.js";import{t as u}from"./triangle-alert-H9T4jAmh.js";import{a as d}from"./auth-D_5bQv5W.js";import{n as f}from"./useSharedWebSocket-DaPh7QBL.js";import{n as p,r as m}from"./useDesktop-B4pSBIDd.js";import{t as h}from"./button-BUIIBQPT.js";import{t as g}from"./utils-BC4DHlz2.js";import{a as _,n as v,o as y,r as b,t as x}from"./dialog-CzIekCw0.js";import{t as S}from"./jira-api-BgFIr8eD.js";import{at as C,jt as w,kt as T,nt as ee,rt as te,tt as ne,u as E,ut as D}from"./index-F9r8mWP_.js";var O=i(`earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),re=i(`folder-kanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),k=i(`plug-zap`,[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]]),A=i(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),ie=i(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),j=e(t(),1),M=n(),N=[`todo`,`in_progress`,`on_review`,`done`,`cancelled`],ae={todo:`todo`,in_progress:`inProgress`,on_review:`onReview`,done:`done`,cancelled:`cancelled`};function P({state:e,onChanged:t,apiBase:n}){let{t:i}=r(`jira`),o=e.connection,[s,c]=(0,j.useState)(o.enabled),[l,u]=(0,j.useState)(!1),[d,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)([]),[g,_]=(0,j.useState)([]),[v,y]=(0,j.useState)(o.discardStatus??``),[b,x]=(0,j.useState)(o.statusMap??{}),C=e.outbox??{pending:0,inflight:0,done:0,dead:0},w=(0,j.useCallback)(async()=>{try{let{ops:e}=n?await S.listOutbox(`dead`,n):await S.listOutbox(`dead`);m(e)}catch{m([])}},[n]);(0,j.useEffect)(()=>{w()},[w]),(0,j.useEffect)(()=>{let e=!1;return S.listStatuses(n).then(({statuses:t})=>{e||_(t)}).catch(()=>{e||_([])}),()=>{e=!0}},[n]);async function T(e){let r=v;y(e);try{n?await S.patchConnection({discardStatus:e||null},n):await S.patchConnection({discardStatus:e||null}),t()}catch(e){y(r),a.error(I(e,i))}}async function ee(e,r){let o=b,s={...b,[e]:r||void 0};x(s);let c=Object.fromEntries(Object.entries(s).filter(([,e])=>e));try{n?await S.patchConnection({statusMap:Object.keys(c).length?c:null},n):await S.patchConnection({statusMap:Object.keys(c).length?c:null}),t()}catch(e){x(o),a.error(I(e,i))}}async function te(){let e=!s;c(e),f(!0);try{n?await S.setEnabled(e,n):await S.setEnabled(e)}catch(t){c(!e),a.error(I(t,i))}finally{f(!1)}}async function ne(){u(!0);try{let e=n?await S.syncNow(n):await S.syncNow();a.success(i(`status.syncedToast`,{count:e.upserted}))}catch(e){a.error(I(e,i))}finally{u(!1)}}async function E(){if(window.confirm(i(`status.disconnectConfirm`))){f(!0);try{n?await S.disconnect(n):await S.disconnect(),a.success(i(`status.disconnectedToast`)),t()}catch(e){a.error(I(e,i))}finally{f(!1)}}}async function D(e){try{n?await S.retryOutbox(e,n):await S.retryOutbox(e),await w()}catch(e){a.error(I(e,i))}}let O=C.pending+C.inflight;return(0,M.jsxs)(`div`,{className:`space-y-4`,"data-testid":`jira-connected`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:i(`status.connected`,{key:o.jiraProjectKey})}),(0,M.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[o.baseUrl,` · `,o.deployment===`cloud`?i(`review.cloud`):i(`review.dc`)]})]}),(0,M.jsx)(`a`,{href:`${o.baseUrl}/browse/${o.jiraProjectKey}`,target:`_blank`,rel:`noreferrer`,className:`text-xs text-accent-primary hover:underline`,children:i(`badge.openInJira`)})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-border p-3`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:i(`status.enabledLabel`)}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(s?`status.enabledHelp`:`status.pausedHelp`)})]}),(0,M.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":s,"aria-label":i(`status.enabledLabel`),disabled:d,onClick:te,className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${s?`bg-accent-success`:`bg-input`}`,children:(0,M.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-background shadow-sm transition-transform ${s?`translate-x-4`:`translate-x-0.5`}`})})]}),(0,M.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`jira-status-map`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:i(`wizard.step3Title`)}),(0,M.jsx)(`p`,{className:`mt-0.5 mb-2 text-xs text-muted-foreground`,children:i(`mapping.intro`)}),(0,M.jsx)(`div`,{className:`space-y-2`,children:N.map(e=>(0,M.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i(`mapping.${ae[e]}`)}),(0,M.jsxs)(`select`,{value:b[e]??``,onChange:t=>void ee(e,t.target.value),className:`w-44 rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-statusmap-${e}`,children:[(0,M.jsx)(`option`,{value:``,children:i(`mapping.auto`)}),g.map(e=>(0,M.jsx)(`option`,{value:e.name,children:e.name},e.id)),b[e]&&!g.some(t=>t.name===b[e])&&(0,M.jsx)(`option`,{value:b[e],children:b[e]})]})]},e))})]}),(0,M.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:i(`discard.configLabel`)}),(0,M.jsx)(`p`,{className:`mt-0.5 mb-2 text-xs text-muted-foreground`,children:i(`discard.configHelp`)}),(0,M.jsxs)(`select`,{value:v,onChange:e=>void T(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-discard-status-select`,children:[(0,M.jsx)(`option`,{value:``,children:i(`discard.configNone`)}),g.map(e=>(0,M.jsx)(`option`,{value:e.name,children:e.name},e.id)),v&&!g.some(e=>e.name===v)&&(0,M.jsx)(`option`,{value:v,children:v})]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(h,{variant:`outline`,size:`sm`,onClick:ne,disabled:l,children:i(l?`status.syncing`:`status.syncNow`)}),(0,M.jsx)(h,{variant:`ghost`,size:`sm`,onClick:E,disabled:d,className:`text-destructive`,children:i(`status.disconnect`)})]}),(0,M.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`jira-outbox`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:i(`outbox.title`)}),C.dead>0?(0,M.jsx)(`p`,{className:`mt-1 text-xs text-accent-warning`,children:i(`outbox.dead`,{count:C.dead})}):O>0?(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:i(`outbox.pending`,{count:O})}):(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:i(`outbox.allSynced`)}),p.length>0&&(0,M.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`outbox.deadHelp`)}),p.map(e=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded border border-border/60 px-2 py-1`,children:[(0,M.jsxs)(`span`,{className:`truncate text-xs`,children:[F(e,i),` · `,e.deadReason??e.lastError??``]}),(0,M.jsx)(h,{variant:`outline`,size:`sm`,onClick:()=>D(e.id),children:i(`outbox.retry`)})]},e.id))]})]})]})}function F(e,t){return e.opType===`transition`?t(`outbox.opTransition`):e.opType===`comment`?t(`outbox.opComment`):t(`outbox.opCreate`)}function I(e,t){return e instanceof Error?e.message:t(`errors.generic`)}function L(e){return{provider:e,label:e===`codex`?`Codex`:`Claude`,active:!1,available:!1,detectedRoute:!1,requests:0,inputTokens:0,inputTokensSaved:0,outputTokens:0,outputTokensSaved:0,outputSavingsPercent:0,outputSavingsMethod:`none`,outputSavingsAllocated:!1}}function R(){return{updatedAt:null,proxyStatsAvailable:!1,durableSavingsAvailable:!1,outputSavingsAvailable:!1,outputSavingsMethod:null,outputConfidence:null,providers:{codex:L(`codex`),claude:L(`claude`)},lastIssue:null}}var z={installed:!1,installSource:null,version:null,executablePath:null,uvPath:null,port:8787,phase:`idle`,activeProviders:{codex:!1,claude:!1},availableProviders:{codex:!1,claude:!1},detectedRoutes:{codex:!1,claude:!1},proxyRunning:!1,proxyPid:null,learning:{enabled:!1,baselineReady:!1,baselineSamples:0,updatedAt:null,lastIssue:null},metrics:R(),lastIssue:null,updatedAt:null};function B(e){let t=e?.metrics??R();return{...z,...e,activeProviders:{...z.activeProviders,...e?.activeProviders},availableProviders:{...z.availableProviders,...e?.availableProviders},detectedRoutes:{...z.detectedRoutes,...e?.detectedRoutes},learning:{...z.learning,...e?.learning},metrics:{...R(),...t,providers:{codex:{...L(`codex`),...t.providers?.codex},claude:{...L(`claude`),...t.providers?.claude}}}}}async function V(e){let t=await e.text(),n=t?JSON.parse(t):{};if(!e.ok){let t=n.issue;throw Object.assign(Error(t?.title??n.error??`HTTP ${e.status}`),{payload:n})}return n}function H(e){return`${d}/api/projects/${e}`}function U(e,t=`en`){if(!Number.isFinite(e))return`0`;try{return Intl.NumberFormat(t,{notation:`compact`,maximumFractionDigits:1}).format(Math.max(0,e))}catch{return Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}).format(Math.max(0,e))}}function W(e,t,n){return`${U(e,t)} ${n}`}function G(){let{t:e}=r(`integrations`),{projects:t}=m(),{registerHandler:n,unregisterHandler:i}=f(),[a,o]=(0,j.useState)(``),[s,l]=(0,j.useState)(`all`),[u,p]=(0,j.useState)(z),[h,S]=(0,j.useState)(!0),[C,w]=(0,j.useState)(null),[T,E]=(0,j.useState)([]),[O,A]=(0,j.useState)(!1),[ie,N]=(0,j.useState)(!1),[ae,P]=(0,j.useState)(null),[F,I]=(0,j.useState)({jira:0,serena:0,projects:0}),L=(0,j.useCallback)(async()=>{try{let e=await fetch(`${d}/api/global-plugins/headroom`).then(e=>V(e));p(B(e.state))}finally{S(!1)}},[]);(0,j.useEffect)(()=>{L()},[L]),(0,j.useEffect)(()=>(n(`plugins-page`,e=>{let t=e;t.type===`plugin.headroom_progress`&&(t.line&&E(e=>[...e.slice(-80),t.line]),L())}),()=>i(`plugins-page`)),[n,i,L]),(0,j.useEffect)(()=>{let e=!1;async function n(){let n=await Promise.all(t.map(async e=>{let[t,n]=await Promise.all([fetch(`${H(e.id)}/jira/connection`).then(e=>V(e)).catch(()=>({connected:!1})),fetch(`${H(e.id)}/plugins`).then(e=>V(e)).catch(()=>({plugins:[]}))]),r=n.plugins.find(e=>e.name===`serena`);return{jira:+!!t.connected,serena:r&&r.status!==`not-installed`&&r.status!==`orphan`?1:0}}));e||I({jira:n.reduce((e,t)=>e+t.jira,0),serena:n.reduce((e,t)=>e+t.serena,0),projects:t.length})}return n(),()=>{e=!0}},[t]);async function R(e,t){w(e),E([]);try{let e=(await t()).state;e&&p(B(e))}catch(e){let t=e.payload;t?.state&&p(B(t.state))}finally{w(null),L()}}let U=(0,j.useMemo)(()=>[{id:`headroom-ai`,title:`Headroom AI`,scope:`global`,icon:k,description:e(`plugins.catalog.headroom.description`),installed:u.installed,status:u.lastIssue?`attention`:u.installed?u.activeProviders.codex||u.activeProviders.claude?u.installSource===`system`?`external-active`:`active`:u.installSource===`system`?`external`:`installed`:`available`,statusLabel:u.lastIssue?e(`plugins.status.attention`):u.installed?u.activeProviders.codex||u.activeProviders.claude?u.installSource===`system`?e(`plugins.status.externalActive`):e(`plugins.status.active`):u.installSource===`system`?e(`plugins.status.external`):e(`plugins.status.installed`):e(`plugins.status.available`),actionKind:u.lastIssue?`review`:u.installed?`manage`:`install`,actionLabel:u.lastIssue?e(`plugins.actions.review`):u.installed?e(`plugins.actions.manage`):e(`plugins.actions.install`),busy:C===`install`,action:()=>{if(u.lastIssue||u.installed){A(!0);return}R(`install`,()=>fetch(`${d}/api/global-plugins/headroom/install`,{method:`POST`}).then(e=>V(e)))}}],[u,C,e]),W=(0,j.useMemo)(()=>[{id:`jira`,title:`Jira`,scope:`project`,icon:re,description:e(`plugins.catalog.jira.description`),installed:F.jira>0,status:F.jira>0?`configured`:`available`,statusLabel:F.jira>0?e(`plugins.status.configuredCount`,{count:F.jira}):e(`plugins.status.available`),actionKind:F.jira>0?`manage`:`install`,actionLabel:F.jira>0?e(`plugins.actions.manage`):e(`plugins.actions.install`),action:()=>P(`jira`)},{id:`serena`,title:`Serena`,scope:`project`,icon:ne,description:e(`plugins.catalog.serena.description`),installed:F.serena>0,status:F.serena>0?`installed`:`available`,statusLabel:F.serena>0?e(`plugins.status.installedCount`,{count:F.serena}):e(`plugins.status.available`),actionKind:F.serena>0?`manage`:`install`,actionLabel:F.serena>0?e(`plugins.actions.manage`):e(`plugins.actions.install`),action:()=>P(`serena`)}],[F,e]),G=a.trim().toLowerCase(),K=t=>`${t.title} ${t.description} ${t.statusLabel} ${e(`plugins.scope.${t.scope}`)}`.toLowerCase().includes(G),q=[...U,...W].filter(e=>s!==`all`&&e.scope!==s?!1:K(e)),J=q.filter(e=>e.scope===`global`&&e.installed),Y=q.filter(e=>e.scope===`project`&&e.installed),X=q.filter(e=>e.scope===`global`&&!e.installed),Z=q.filter(e=>e.scope===`project`&&!e.installed),Q=J.length>0||Y.length>0,le=X.length>0||Z.length>0,$=[u.installed,F.jira>0,F.serena>0].filter(Boolean).length;return(0,M.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[(0,M.jsxs)(`div`,{className:`border-b border-border px-6 py-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,M.jsx)(`div`,{className:`grid h-9 w-9 place-items-center rounded-lg border border-accent-primary/25 bg-accent-primary/10 text-accent-primary`,children:(0,M.jsx)(D,{className:`h-4 w-4`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`h1`,{className:`text-lg font-semibold tracking-normal`,children:e(`plugins.page.title`)}),(0,M.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:e(`plugins.page.subtitle`)})]}),(0,M.jsxs)(`div`,{className:`mr-12 flex items-center gap-2 rounded-lg border border-border bg-card/60 px-3 py-2 text-xs`,children:[(0,M.jsx)(te,{className:`h-3.5 w-3.5 text-accent-success`}),(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(`plugins.page.readyCount`,{count:$})})]})]}),(0,M.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 md:flex-row md:items-center`,children:[(0,M.jsxs)(`label`,{className:`relative flex-1`,children:[(0,M.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,M.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:e(`plugins.search.placeholder`),className:`h-9 w-full rounded-lg border border-border bg-background pl-9 pr-3 text-sm outline-none transition-colors focus:border-accent-primary/60`})]}),(0,M.jsx)(`div`,{className:`inline-flex h-9 rounded-lg border border-border bg-card p-1`,children:[`all`,`global`,`project`].map(t=>(0,M.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:g(`rounded-md px-3 text-xs capitalize transition-colors`,s===t?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:e(`plugins.filters.${t}`)},t))})]})]}),(0,M.jsxs)(`div`,{className:`flex-1 overflow-auto px-6 py-5`,children:[(0,M.jsxs)(`section`,{className:`mb-6`,children:[(0,M.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,M.jsx)(ee,{className:`h-3.5 w-3.5`}),e(`plugins.sections.installed`)]}),Q?(0,M.jsx)(oe,{globalPlugins:J,projectPlugins:Y}):(0,M.jsx)(se,{text:e(G?`plugins.empty.installedSearch`:`plugins.empty.installed`)})]}),(0,M.jsxs)(`section`,{children:[(0,M.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,M.jsx)(D,{className:`h-3.5 w-3.5`}),e(`plugins.sections.available`)]}),le?(0,M.jsx)(oe,{globalPlugins:X,projectPlugins:Z}):(0,M.jsx)(se,{text:e(G?`plugins.empty.availableSearch`:`plugins.empty.allInstalled`)})]})]}),(0,M.jsx)(x,{open:O,onOpenChange:A,children:(0,M.jsxs)(v,{className:`w-[calc(100vw-2rem)] max-w-xl overflow-x-hidden p-4 sm:p-6`,children:[(0,M.jsxs)(_,{children:[(0,M.jsx)(y,{children:e(`plugins.headroom.title`)}),(0,M.jsx)(b,{children:e(`plugins.headroom.dialogDescription`)})]}),(0,M.jsx)(ce,{state:u,loading:h,busy:C,logs:T,onInstall:()=>R(`install`,()=>fetch(`${d}/api/global-plugins/headroom/install`,{method:`POST`}).then(e=>V(e))),onToggleProvider:(e,t)=>R(`${t?`deactivate`:`activate`}-${e}`,()=>fetch(`${d}/api/global-plugins/headroom/${t?`deactivate`:`activate`}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e})}).then(e=>V(e))),onDeactivateAll:()=>R(`deactivate-all`,async()=>{let e={state:u};for(let t of[`codex`,`claude`])u.activeProviders[t]&&(e=await fetch(`${d}/api/global-plugins/headroom/deactivate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:t})}).then(e=>V(e)));return e}),onUninstall:()=>R(`uninstall`,()=>fetch(`${d}/api/global-plugins/headroom/uninstall`,{method:`POST`}).then(e=>V(e))),onSetPort:e=>R(`port`,()=>fetch(`${d}/api/global-plugins/headroom/port`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({port:e})}).then(e=>V(e))),onOpenDiagnostics:()=>N(!0)})]})}),(0,M.jsx)(ue,{plugin:ae,projects:t,onClose:()=>P(null)}),(0,M.jsx)(pe,{open:ie,onClose:()=>N(!1)})]})}function oe({globalPlugins:e,projectPlugins:t}){let{t:n}=r(`integrations`);return(0,M.jsxs)(`div`,{className:g(`grid grid-cols-1 gap-4`,e.length>0&&t.length>0&&`xl:grid-cols-2`),children:[e.length>0&&(0,M.jsxs)(`section`,{children:[(0,M.jsx)(q,{title:n(`plugins.groups.global.title`),detail:n(`plugins.groups.global.detail`),scope:`global`}),(0,M.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(260px,320px))] justify-start gap-3`,children:e.map(e=>(0,M.jsx)(J,{plugin:e},e.id))})]}),t.length>0&&(0,M.jsxs)(`section`,{children:[(0,M.jsx)(q,{title:n(`plugins.groups.project.title`),detail:n(`plugins.groups.project.detail`),scope:`project`}),(0,M.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(260px,320px))] justify-start gap-3`,children:t.map(e=>(0,M.jsx)(J,{plugin:e},e.id))})]})]})}function se({text:e}){return(0,M.jsx)(`div`,{className:`flex h-[74px] max-w-[320px] items-center rounded-lg border border-dashed border-border bg-card/35 px-3 text-xs text-muted-foreground`,children:e})}function K({scope:e}){let{t}=r(`integrations`);return(0,M.jsx)(`span`,{className:g(`rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wide`,e===`global`?`bg-accent-primary/10 text-accent-primary`:`bg-accent-info/10 text-accent-info`),children:t(`plugins.scope.${e}`)})}function q({title:e,detail:t,scope:n}){return(0,M.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,M.jsx)(`div`,{className:g(`h-px flex-1`,n===`global`?`bg-accent-primary/30`:`bg-accent-info/30`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card/70 px-2 py-1`,children:[(0,M.jsx)(K,{scope:n}),(0,M.jsx)(`span`,{className:`text-xs font-medium`,children:e}),(0,M.jsx)(`span`,{className:`hidden text-[11px] text-muted-foreground sm:inline`,children:t})]}),(0,M.jsx)(`div`,{className:g(`h-px flex-1`,n===`global`?`bg-accent-primary/30`:`bg-accent-info/30`)})]})}function J({plugin:e}){let{t}=r(`integrations`),n=e.icon,i=e.scope===`global`,a=e.status===`attention`,c=e.busy?s:e.actionKind===`install`?o:e.actionKind===`review`?u:C,l=g(`shrink-0 rounded border px-1.5 py-0.5 text-[10px] leading-none`,a?`border-accent-warning/30 bg-accent-warning/10 text-accent-warning`:e.installed?`border-accent-success/25 bg-accent-success/10 text-accent-success`:`border-border bg-muted text-muted-foreground`);return(0,M.jsxs)(`article`,{className:`grid h-[88px] w-full grid-cols-[38px_minmax(0,1fr)_auto] items-center gap-3 rounded-lg border border-border bg-card/70 px-3 transition-colors hover:border-accent-primary/35 hover:bg-card`,children:[(0,M.jsx)(`div`,{className:g(`grid h-[38px] w-[38px] shrink-0 place-items-center rounded-lg border`,i?`border-accent-primary/25 bg-accent-primary/10 text-accent-primary`:`border-accent-info/25 bg-accent-info/10 text-accent-info`),children:(0,M.jsx)(n,{className:`h-4 w-4`})}),(0,M.jsxs)(`div`,{className:`min-w-0`,children:[(0,M.jsx)(`h2`,{className:`truncate text-sm font-semibold leading-5`,children:e.title}),(0,M.jsx)(`p`,{className:`mt-1 truncate text-[11px] leading-4 text-muted-foreground`,children:e.description}),(0,M.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[(0,M.jsx)(K,{scope:e.scope}),(0,M.jsx)(`span`,{className:l,children:e.statusLabel})]})]}),(0,M.jsxs)(`button`,{type:`button`,disabled:e.busy,onClick:e.action,className:`flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-border bg-background px-2.5 text-xs font-medium transition-colors hover:bg-muted disabled:opacity-50`,children:[(0,M.jsx)(c,{className:g(`h-3.5 w-3.5`,e.busy&&`animate-spin`)}),e.busy?t(`plugins.actions.installing`):e.actionLabel]})]})}function ce({state:e,loading:t,busy:n,logs:i,onInstall:a,onToggleProvider:c,onDeactivateAll:u,onUninstall:d,onSetPort:f,onOpenDiagnostics:p}){let{t:m}=r(`integrations`),[h,g]=(0,j.useState)(String(e.port)),[_,v]=(0,j.useState)(!1);(0,j.useEffect)(()=>g(String(e.port)),[e.port]),(0,j.useEffect)(()=>{e.installed||v(!1)},[e.installed]);let y=e.activeProviders.codex||e.activeProviders.claude,b=e.installSource===`system`;return(0,M.jsxs)(`aside`,{className:`w-full min-w-0 overflow-hidden rounded-lg border border-border bg-card/80 p-4`,children:[(0,M.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,M.jsx)(`div`,{className:`grid h-10 w-10 place-items-center rounded-lg border border-accent-primary/25 bg-accent-primary/10 text-accent-primary`,children:(0,M.jsx)(k,{className:`h-4 w-4`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold`,children:m(`plugins.headroom.title`)}),(0,M.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:m(`plugins.headroom.panelDescription`)})]})]}),(0,M.jsxs)(`div`,{className:`mb-4 grid grid-cols-3 gap-2 text-xs`,children:[(0,M.jsx)(Y,{label:m(`plugins.headroom.metrics.install`),value:t?m(`plugins.headroom.metrics.checking`):e.installed?m(`plugins.headroom.metrics.ready`):m(`plugins.headroom.metrics.missing`),good:e.installed}),(0,M.jsx)(Y,{label:m(`plugins.headroom.metrics.source`),value:e.installSource===`system`?m(`plugins.headroom.metrics.system`):e.installSource===`managed`?m(`plugins.headroom.metrics.specrails`):m(`plugins.headroom.metrics.none`),good:e.installed}),(0,M.jsx)(Y,{label:m(`plugins.headroom.metrics.proxy`),value:e.proxyRunning?`:${e.port}`:m(y?`plugins.headroom.metrics.starting`:`plugins.headroom.metrics.off`),good:e.proxyRunning||!y})]}),e.lastIssue&&(0,M.jsx)(X,{issue:e.lastIssue}),e.installed?(0,M.jsxs)(`div`,{className:`mb-4 space-y-2`,children:[(0,M.jsx)($,{provider:`codex`,active:e.activeProviders.codex,available:e.availableProviders.codex,detectedRoute:e.detectedRoutes.codex,busy:n===`activate-codex`||n===`deactivate-codex`,onClick:()=>c(`codex`,e.activeProviders.codex)}),(0,M.jsx)($,{provider:`claude`,active:e.activeProviders.claude,available:e.availableProviders.claude,detectedRoute:e.detectedRoutes.claude,busy:n===`activate-claude`||n===`deactivate-claude`,onClick:()=>c(`claude`,e.activeProviders.claude)}),y&&(0,M.jsxs)(`button`,{type:`button`,disabled:!!n,onClick:u,className:`flex h-8 w-full items-center justify-center gap-2 rounded-lg border border-border bg-background/45 text-xs hover:bg-muted/50 disabled:opacity-50`,children:[n===`deactivate-all`?(0,M.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}):(0,M.jsx)(A,{className:`h-3.5 w-3.5`}),m(`plugins.headroom.actions.disableAllRoutes`)]})]}):(0,M.jsxs)(`button`,{type:`button`,disabled:!!n,onClick:a,className:`mb-3 flex h-9 w-full items-center justify-center gap-2 rounded-lg bg-accent-primary px-3 text-xs font-medium text-white disabled:opacity-50`,children:[n===`install`?(0,M.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}):(0,M.jsx)(o,{className:`h-3.5 w-3.5`}),m(`plugins.headroom.actions.installWithUv`)]}),e.installed&&(0,M.jsx)(Z,{state:e}),(0,M.jsxs)(`div`,{className:`mb-4 rounded-lg border border-border bg-background/45 p-3`,children:[(0,M.jsx)(`label`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:m(`plugins.headroom.port.label`)}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),className:`h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-sm`}),(0,M.jsx)(`button`,{type:`button`,disabled:!!n||Number(h)===e.port,onClick:()=>f(Number(h)),className:`rounded-md border border-border px-2 text-xs hover:bg-muted disabled:opacity-50`,children:m(`plugins.headroom.port.apply`)})]})]}),i.length>0&&(0,M.jsx)(`pre`,{className:`mb-3 max-h-32 overflow-y-auto overflow-x-hidden whitespace-pre-wrap break-words rounded-lg border border-border bg-background/60 p-2 text-[10px] text-muted-foreground`,children:i.join(`
1
+ import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{n as r,t as i}from"./createLucideIcon-Bjbbp_KS.js";import{n as a}from"./dist-bVqfYmby.js";import{t as o}from"./download-CFHyyHcw.js";import{t as s}from"./loader-circle-DcygOQpC.js";import{t as c}from"./search-Cq_gE3Ik.js";import{t as l}from"./trash-2-BOU3WdZZ.js";import{t as u}from"./triangle-alert-H9T4jAmh.js";import{a as d}from"./auth-D_5bQv5W.js";import{n as f}from"./useSharedWebSocket-DaPh7QBL.js";import{n as p,r as m}from"./useDesktop-B4pSBIDd.js";import{t as h}from"./button-BUIIBQPT.js";import{t as g}from"./utils-BC4DHlz2.js";import{a as _,n as v,o as y,r as b,t as x}from"./dialog-CzIekCw0.js";import{t as S}from"./jira-api-BgFIr8eD.js";import{at as C,jt as w,kt as T,nt as ee,rt as te,tt as ne,u as E,ut as D}from"./index-CewRMo0W.js";var O=i(`earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),re=i(`folder-kanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),k=i(`plug-zap`,[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]]),A=i(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),ie=i(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),j=e(t(),1),M=n(),N=[`todo`,`in_progress`,`on_review`,`done`,`cancelled`],ae={todo:`todo`,in_progress:`inProgress`,on_review:`onReview`,done:`done`,cancelled:`cancelled`};function P({state:e,onChanged:t,apiBase:n}){let{t:i}=r(`jira`),o=e.connection,[s,c]=(0,j.useState)(o.enabled),[l,u]=(0,j.useState)(!1),[d,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)([]),[g,_]=(0,j.useState)([]),[v,y]=(0,j.useState)(o.discardStatus??``),[b,x]=(0,j.useState)(o.statusMap??{}),C=e.outbox??{pending:0,inflight:0,done:0,dead:0},w=(0,j.useCallback)(async()=>{try{let{ops:e}=n?await S.listOutbox(`dead`,n):await S.listOutbox(`dead`);m(e)}catch{m([])}},[n]);(0,j.useEffect)(()=>{w()},[w]),(0,j.useEffect)(()=>{let e=!1;return S.listStatuses(n).then(({statuses:t})=>{e||_(t)}).catch(()=>{e||_([])}),()=>{e=!0}},[n]);async function T(e){let r=v;y(e);try{n?await S.patchConnection({discardStatus:e||null},n):await S.patchConnection({discardStatus:e||null}),t()}catch(e){y(r),a.error(I(e,i))}}async function ee(e,r){let o=b,s={...b,[e]:r||void 0};x(s);let c=Object.fromEntries(Object.entries(s).filter(([,e])=>e));try{n?await S.patchConnection({statusMap:Object.keys(c).length?c:null},n):await S.patchConnection({statusMap:Object.keys(c).length?c:null}),t()}catch(e){x(o),a.error(I(e,i))}}async function te(){let e=!s;c(e),f(!0);try{n?await S.setEnabled(e,n):await S.setEnabled(e)}catch(t){c(!e),a.error(I(t,i))}finally{f(!1)}}async function ne(){u(!0);try{let e=n?await S.syncNow(n):await S.syncNow();a.success(i(`status.syncedToast`,{count:e.upserted}))}catch(e){a.error(I(e,i))}finally{u(!1)}}async function E(){if(window.confirm(i(`status.disconnectConfirm`))){f(!0);try{n?await S.disconnect(n):await S.disconnect(),a.success(i(`status.disconnectedToast`)),t()}catch(e){a.error(I(e,i))}finally{f(!1)}}}async function D(e){try{n?await S.retryOutbox(e,n):await S.retryOutbox(e),await w()}catch(e){a.error(I(e,i))}}let O=C.pending+C.inflight;return(0,M.jsxs)(`div`,{className:`space-y-4`,"data-testid":`jira-connected`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:i(`status.connected`,{key:o.jiraProjectKey})}),(0,M.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[o.baseUrl,` · `,o.deployment===`cloud`?i(`review.cloud`):i(`review.dc`)]})]}),(0,M.jsx)(`a`,{href:`${o.baseUrl}/browse/${o.jiraProjectKey}`,target:`_blank`,rel:`noreferrer`,className:`text-xs text-accent-primary hover:underline`,children:i(`badge.openInJira`)})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-border p-3`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:i(`status.enabledLabel`)}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(s?`status.enabledHelp`:`status.pausedHelp`)})]}),(0,M.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":s,"aria-label":i(`status.enabledLabel`),disabled:d,onClick:te,className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${s?`bg-accent-success`:`bg-input`}`,children:(0,M.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-background shadow-sm transition-transform ${s?`translate-x-4`:`translate-x-0.5`}`})})]}),(0,M.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`jira-status-map`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:i(`wizard.step3Title`)}),(0,M.jsx)(`p`,{className:`mt-0.5 mb-2 text-xs text-muted-foreground`,children:i(`mapping.intro`)}),(0,M.jsx)(`div`,{className:`space-y-2`,children:N.map(e=>(0,M.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i(`mapping.${ae[e]}`)}),(0,M.jsxs)(`select`,{value:b[e]??``,onChange:t=>void ee(e,t.target.value),className:`w-44 rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-statusmap-${e}`,children:[(0,M.jsx)(`option`,{value:``,children:i(`mapping.auto`)}),g.map(e=>(0,M.jsx)(`option`,{value:e.name,children:e.name},e.id)),b[e]&&!g.some(t=>t.name===b[e])&&(0,M.jsx)(`option`,{value:b[e],children:b[e]})]})]},e))})]}),(0,M.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:i(`discard.configLabel`)}),(0,M.jsx)(`p`,{className:`mt-0.5 mb-2 text-xs text-muted-foreground`,children:i(`discard.configHelp`)}),(0,M.jsxs)(`select`,{value:v,onChange:e=>void T(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-discard-status-select`,children:[(0,M.jsx)(`option`,{value:``,children:i(`discard.configNone`)}),g.map(e=>(0,M.jsx)(`option`,{value:e.name,children:e.name},e.id)),v&&!g.some(e=>e.name===v)&&(0,M.jsx)(`option`,{value:v,children:v})]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(h,{variant:`outline`,size:`sm`,onClick:ne,disabled:l,children:i(l?`status.syncing`:`status.syncNow`)}),(0,M.jsx)(h,{variant:`ghost`,size:`sm`,onClick:E,disabled:d,className:`text-destructive`,children:i(`status.disconnect`)})]}),(0,M.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`jira-outbox`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:i(`outbox.title`)}),C.dead>0?(0,M.jsx)(`p`,{className:`mt-1 text-xs text-accent-warning`,children:i(`outbox.dead`,{count:C.dead})}):O>0?(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:i(`outbox.pending`,{count:O})}):(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:i(`outbox.allSynced`)}),p.length>0&&(0,M.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`outbox.deadHelp`)}),p.map(e=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded border border-border/60 px-2 py-1`,children:[(0,M.jsxs)(`span`,{className:`truncate text-xs`,children:[F(e,i),` · `,e.deadReason??e.lastError??``]}),(0,M.jsx)(h,{variant:`outline`,size:`sm`,onClick:()=>D(e.id),children:i(`outbox.retry`)})]},e.id))]})]})]})}function F(e,t){return e.opType===`transition`?t(`outbox.opTransition`):e.opType===`comment`?t(`outbox.opComment`):t(`outbox.opCreate`)}function I(e,t){return e instanceof Error?e.message:t(`errors.generic`)}function L(e){return{provider:e,label:e===`codex`?`Codex`:`Claude`,active:!1,available:!1,detectedRoute:!1,requests:0,inputTokens:0,inputTokensSaved:0,outputTokens:0,outputTokensSaved:0,outputSavingsPercent:0,outputSavingsMethod:`none`,outputSavingsAllocated:!1}}function R(){return{updatedAt:null,proxyStatsAvailable:!1,durableSavingsAvailable:!1,outputSavingsAvailable:!1,outputSavingsMethod:null,outputConfidence:null,providers:{codex:L(`codex`),claude:L(`claude`)},lastIssue:null}}var z={installed:!1,installSource:null,version:null,executablePath:null,uvPath:null,port:8787,phase:`idle`,activeProviders:{codex:!1,claude:!1},availableProviders:{codex:!1,claude:!1},detectedRoutes:{codex:!1,claude:!1},proxyRunning:!1,proxyPid:null,learning:{enabled:!1,baselineReady:!1,baselineSamples:0,updatedAt:null,lastIssue:null},metrics:R(),lastIssue:null,updatedAt:null};function B(e){let t=e?.metrics??R();return{...z,...e,activeProviders:{...z.activeProviders,...e?.activeProviders},availableProviders:{...z.availableProviders,...e?.availableProviders},detectedRoutes:{...z.detectedRoutes,...e?.detectedRoutes},learning:{...z.learning,...e?.learning},metrics:{...R(),...t,providers:{codex:{...L(`codex`),...t.providers?.codex},claude:{...L(`claude`),...t.providers?.claude}}}}}async function V(e){let t=await e.text(),n=t?JSON.parse(t):{};if(!e.ok){let t=n.issue;throw Object.assign(Error(t?.title??n.error??`HTTP ${e.status}`),{payload:n})}return n}function H(e){return`${d}/api/projects/${e}`}function U(e,t=`en`){if(!Number.isFinite(e))return`0`;try{return Intl.NumberFormat(t,{notation:`compact`,maximumFractionDigits:1}).format(Math.max(0,e))}catch{return Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}).format(Math.max(0,e))}}function W(e,t,n){return`${U(e,t)} ${n}`}function G(){let{t:e}=r(`integrations`),{projects:t}=m(),{registerHandler:n,unregisterHandler:i}=f(),[a,o]=(0,j.useState)(``),[s,l]=(0,j.useState)(`all`),[u,p]=(0,j.useState)(z),[h,S]=(0,j.useState)(!0),[C,w]=(0,j.useState)(null),[T,E]=(0,j.useState)([]),[O,A]=(0,j.useState)(!1),[ie,N]=(0,j.useState)(!1),[ae,P]=(0,j.useState)(null),[F,I]=(0,j.useState)({jira:0,serena:0,projects:0}),L=(0,j.useCallback)(async()=>{try{let e=await fetch(`${d}/api/global-plugins/headroom`).then(e=>V(e));p(B(e.state))}finally{S(!1)}},[]);(0,j.useEffect)(()=>{L()},[L]),(0,j.useEffect)(()=>(n(`plugins-page`,e=>{let t=e;t.type===`plugin.headroom_progress`&&(t.line&&E(e=>[...e.slice(-80),t.line]),L())}),()=>i(`plugins-page`)),[n,i,L]),(0,j.useEffect)(()=>{let e=!1;async function n(){let n=await Promise.all(t.map(async e=>{let[t,n]=await Promise.all([fetch(`${H(e.id)}/jira/connection`).then(e=>V(e)).catch(()=>({connected:!1})),fetch(`${H(e.id)}/plugins`).then(e=>V(e)).catch(()=>({plugins:[]}))]),r=n.plugins.find(e=>e.name===`serena`);return{jira:+!!t.connected,serena:r&&r.status!==`not-installed`&&r.status!==`orphan`?1:0}}));e||I({jira:n.reduce((e,t)=>e+t.jira,0),serena:n.reduce((e,t)=>e+t.serena,0),projects:t.length})}return n(),()=>{e=!0}},[t]);async function R(e,t){w(e),E([]);try{let e=(await t()).state;e&&p(B(e))}catch(e){let t=e.payload;t?.state&&p(B(t.state))}finally{w(null),L()}}let U=(0,j.useMemo)(()=>[{id:`headroom-ai`,title:`Headroom AI`,scope:`global`,icon:k,description:e(`plugins.catalog.headroom.description`),installed:u.installed,status:u.lastIssue?`attention`:u.installed?u.activeProviders.codex||u.activeProviders.claude?u.installSource===`system`?`external-active`:`active`:u.installSource===`system`?`external`:`installed`:`available`,statusLabel:u.lastIssue?e(`plugins.status.attention`):u.installed?u.activeProviders.codex||u.activeProviders.claude?u.installSource===`system`?e(`plugins.status.externalActive`):e(`plugins.status.active`):u.installSource===`system`?e(`plugins.status.external`):e(`plugins.status.installed`):e(`plugins.status.available`),actionKind:u.lastIssue?`review`:u.installed?`manage`:`install`,actionLabel:u.lastIssue?e(`plugins.actions.review`):u.installed?e(`plugins.actions.manage`):e(`plugins.actions.install`),busy:C===`install`,action:()=>{if(u.lastIssue||u.installed){A(!0);return}R(`install`,()=>fetch(`${d}/api/global-plugins/headroom/install`,{method:`POST`}).then(e=>V(e)))}}],[u,C,e]),W=(0,j.useMemo)(()=>[{id:`jira`,title:`Jira`,scope:`project`,icon:re,description:e(`plugins.catalog.jira.description`),installed:F.jira>0,status:F.jira>0?`configured`:`available`,statusLabel:F.jira>0?e(`plugins.status.configuredCount`,{count:F.jira}):e(`plugins.status.available`),actionKind:F.jira>0?`manage`:`install`,actionLabel:F.jira>0?e(`plugins.actions.manage`):e(`plugins.actions.install`),action:()=>P(`jira`)},{id:`serena`,title:`Serena`,scope:`project`,icon:ne,description:e(`plugins.catalog.serena.description`),installed:F.serena>0,status:F.serena>0?`installed`:`available`,statusLabel:F.serena>0?e(`plugins.status.installedCount`,{count:F.serena}):e(`plugins.status.available`),actionKind:F.serena>0?`manage`:`install`,actionLabel:F.serena>0?e(`plugins.actions.manage`):e(`plugins.actions.install`),action:()=>P(`serena`)}],[F,e]),G=a.trim().toLowerCase(),K=t=>`${t.title} ${t.description} ${t.statusLabel} ${e(`plugins.scope.${t.scope}`)}`.toLowerCase().includes(G),q=[...U,...W].filter(e=>s!==`all`&&e.scope!==s?!1:K(e)),J=q.filter(e=>e.scope===`global`&&e.installed),Y=q.filter(e=>e.scope===`project`&&e.installed),X=q.filter(e=>e.scope===`global`&&!e.installed),Z=q.filter(e=>e.scope===`project`&&!e.installed),Q=J.length>0||Y.length>0,le=X.length>0||Z.length>0,$=[u.installed,F.jira>0,F.serena>0].filter(Boolean).length;return(0,M.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[(0,M.jsxs)(`div`,{className:`border-b border-border px-6 py-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,M.jsx)(`div`,{className:`grid h-9 w-9 place-items-center rounded-lg border border-accent-primary/25 bg-accent-primary/10 text-accent-primary`,children:(0,M.jsx)(D,{className:`h-4 w-4`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`h1`,{className:`text-lg font-semibold tracking-normal`,children:e(`plugins.page.title`)}),(0,M.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:e(`plugins.page.subtitle`)})]}),(0,M.jsxs)(`div`,{className:`mr-12 flex items-center gap-2 rounded-lg border border-border bg-card/60 px-3 py-2 text-xs`,children:[(0,M.jsx)(te,{className:`h-3.5 w-3.5 text-accent-success`}),(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(`plugins.page.readyCount`,{count:$})})]})]}),(0,M.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 md:flex-row md:items-center`,children:[(0,M.jsxs)(`label`,{className:`relative flex-1`,children:[(0,M.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,M.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:e(`plugins.search.placeholder`),className:`h-9 w-full rounded-lg border border-border bg-background pl-9 pr-3 text-sm outline-none transition-colors focus:border-accent-primary/60`})]}),(0,M.jsx)(`div`,{className:`inline-flex h-9 rounded-lg border border-border bg-card p-1`,children:[`all`,`global`,`project`].map(t=>(0,M.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:g(`rounded-md px-3 text-xs capitalize transition-colors`,s===t?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:e(`plugins.filters.${t}`)},t))})]})]}),(0,M.jsxs)(`div`,{className:`flex-1 overflow-auto px-6 py-5`,children:[(0,M.jsxs)(`section`,{className:`mb-6`,children:[(0,M.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,M.jsx)(ee,{className:`h-3.5 w-3.5`}),e(`plugins.sections.installed`)]}),Q?(0,M.jsx)(oe,{globalPlugins:J,projectPlugins:Y}):(0,M.jsx)(se,{text:e(G?`plugins.empty.installedSearch`:`plugins.empty.installed`)})]}),(0,M.jsxs)(`section`,{children:[(0,M.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,M.jsx)(D,{className:`h-3.5 w-3.5`}),e(`plugins.sections.available`)]}),le?(0,M.jsx)(oe,{globalPlugins:X,projectPlugins:Z}):(0,M.jsx)(se,{text:e(G?`plugins.empty.availableSearch`:`plugins.empty.allInstalled`)})]})]}),(0,M.jsx)(x,{open:O,onOpenChange:A,children:(0,M.jsxs)(v,{className:`w-[calc(100vw-2rem)] max-w-xl overflow-x-hidden p-4 sm:p-6`,children:[(0,M.jsxs)(_,{children:[(0,M.jsx)(y,{children:e(`plugins.headroom.title`)}),(0,M.jsx)(b,{children:e(`plugins.headroom.dialogDescription`)})]}),(0,M.jsx)(ce,{state:u,loading:h,busy:C,logs:T,onInstall:()=>R(`install`,()=>fetch(`${d}/api/global-plugins/headroom/install`,{method:`POST`}).then(e=>V(e))),onToggleProvider:(e,t)=>R(`${t?`deactivate`:`activate`}-${e}`,()=>fetch(`${d}/api/global-plugins/headroom/${t?`deactivate`:`activate`}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e})}).then(e=>V(e))),onDeactivateAll:()=>R(`deactivate-all`,async()=>{let e={state:u};for(let t of[`codex`,`claude`])u.activeProviders[t]&&(e=await fetch(`${d}/api/global-plugins/headroom/deactivate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:t})}).then(e=>V(e)));return e}),onUninstall:()=>R(`uninstall`,()=>fetch(`${d}/api/global-plugins/headroom/uninstall`,{method:`POST`}).then(e=>V(e))),onSetPort:e=>R(`port`,()=>fetch(`${d}/api/global-plugins/headroom/port`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({port:e})}).then(e=>V(e))),onOpenDiagnostics:()=>N(!0)})]})}),(0,M.jsx)(ue,{plugin:ae,projects:t,onClose:()=>P(null)}),(0,M.jsx)(pe,{open:ie,onClose:()=>N(!1)})]})}function oe({globalPlugins:e,projectPlugins:t}){let{t:n}=r(`integrations`);return(0,M.jsxs)(`div`,{className:g(`grid grid-cols-1 gap-4`,e.length>0&&t.length>0&&`xl:grid-cols-2`),children:[e.length>0&&(0,M.jsxs)(`section`,{children:[(0,M.jsx)(q,{title:n(`plugins.groups.global.title`),detail:n(`plugins.groups.global.detail`),scope:`global`}),(0,M.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(260px,320px))] justify-start gap-3`,children:e.map(e=>(0,M.jsx)(J,{plugin:e},e.id))})]}),t.length>0&&(0,M.jsxs)(`section`,{children:[(0,M.jsx)(q,{title:n(`plugins.groups.project.title`),detail:n(`plugins.groups.project.detail`),scope:`project`}),(0,M.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(260px,320px))] justify-start gap-3`,children:t.map(e=>(0,M.jsx)(J,{plugin:e},e.id))})]})]})}function se({text:e}){return(0,M.jsx)(`div`,{className:`flex h-[74px] max-w-[320px] items-center rounded-lg border border-dashed border-border bg-card/35 px-3 text-xs text-muted-foreground`,children:e})}function K({scope:e}){let{t}=r(`integrations`);return(0,M.jsx)(`span`,{className:g(`rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wide`,e===`global`?`bg-accent-primary/10 text-accent-primary`:`bg-accent-info/10 text-accent-info`),children:t(`plugins.scope.${e}`)})}function q({title:e,detail:t,scope:n}){return(0,M.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,M.jsx)(`div`,{className:g(`h-px flex-1`,n===`global`?`bg-accent-primary/30`:`bg-accent-info/30`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card/70 px-2 py-1`,children:[(0,M.jsx)(K,{scope:n}),(0,M.jsx)(`span`,{className:`text-xs font-medium`,children:e}),(0,M.jsx)(`span`,{className:`hidden text-[11px] text-muted-foreground sm:inline`,children:t})]}),(0,M.jsx)(`div`,{className:g(`h-px flex-1`,n===`global`?`bg-accent-primary/30`:`bg-accent-info/30`)})]})}function J({plugin:e}){let{t}=r(`integrations`),n=e.icon,i=e.scope===`global`,a=e.status===`attention`,c=e.busy?s:e.actionKind===`install`?o:e.actionKind===`review`?u:C,l=g(`shrink-0 rounded border px-1.5 py-0.5 text-[10px] leading-none`,a?`border-accent-warning/30 bg-accent-warning/10 text-accent-warning`:e.installed?`border-accent-success/25 bg-accent-success/10 text-accent-success`:`border-border bg-muted text-muted-foreground`);return(0,M.jsxs)(`article`,{className:`grid h-[88px] w-full grid-cols-[38px_minmax(0,1fr)_auto] items-center gap-3 rounded-lg border border-border bg-card/70 px-3 transition-colors hover:border-accent-primary/35 hover:bg-card`,children:[(0,M.jsx)(`div`,{className:g(`grid h-[38px] w-[38px] shrink-0 place-items-center rounded-lg border`,i?`border-accent-primary/25 bg-accent-primary/10 text-accent-primary`:`border-accent-info/25 bg-accent-info/10 text-accent-info`),children:(0,M.jsx)(n,{className:`h-4 w-4`})}),(0,M.jsxs)(`div`,{className:`min-w-0`,children:[(0,M.jsx)(`h2`,{className:`truncate text-sm font-semibold leading-5`,children:e.title}),(0,M.jsx)(`p`,{className:`mt-1 truncate text-[11px] leading-4 text-muted-foreground`,children:e.description}),(0,M.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[(0,M.jsx)(K,{scope:e.scope}),(0,M.jsx)(`span`,{className:l,children:e.statusLabel})]})]}),(0,M.jsxs)(`button`,{type:`button`,disabled:e.busy,onClick:e.action,className:`flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-border bg-background px-2.5 text-xs font-medium transition-colors hover:bg-muted disabled:opacity-50`,children:[(0,M.jsx)(c,{className:g(`h-3.5 w-3.5`,e.busy&&`animate-spin`)}),e.busy?t(`plugins.actions.installing`):e.actionLabel]})]})}function ce({state:e,loading:t,busy:n,logs:i,onInstall:a,onToggleProvider:c,onDeactivateAll:u,onUninstall:d,onSetPort:f,onOpenDiagnostics:p}){let{t:m}=r(`integrations`),[h,g]=(0,j.useState)(String(e.port)),[_,v]=(0,j.useState)(!1);(0,j.useEffect)(()=>g(String(e.port)),[e.port]),(0,j.useEffect)(()=>{e.installed||v(!1)},[e.installed]);let y=e.activeProviders.codex||e.activeProviders.claude,b=e.installSource===`system`;return(0,M.jsxs)(`aside`,{className:`w-full min-w-0 overflow-hidden rounded-lg border border-border bg-card/80 p-4`,children:[(0,M.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,M.jsx)(`div`,{className:`grid h-10 w-10 place-items-center rounded-lg border border-accent-primary/25 bg-accent-primary/10 text-accent-primary`,children:(0,M.jsx)(k,{className:`h-4 w-4`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold`,children:m(`plugins.headroom.title`)}),(0,M.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:m(`plugins.headroom.panelDescription`)})]})]}),(0,M.jsxs)(`div`,{className:`mb-4 grid grid-cols-3 gap-2 text-xs`,children:[(0,M.jsx)(Y,{label:m(`plugins.headroom.metrics.install`),value:t?m(`plugins.headroom.metrics.checking`):e.installed?m(`plugins.headroom.metrics.ready`):m(`plugins.headroom.metrics.missing`),good:e.installed}),(0,M.jsx)(Y,{label:m(`plugins.headroom.metrics.source`),value:e.installSource===`system`?m(`plugins.headroom.metrics.system`):e.installSource===`managed`?m(`plugins.headroom.metrics.specrails`):m(`plugins.headroom.metrics.none`),good:e.installed}),(0,M.jsx)(Y,{label:m(`plugins.headroom.metrics.proxy`),value:e.proxyRunning?`:${e.port}`:m(y?`plugins.headroom.metrics.starting`:`plugins.headroom.metrics.off`),good:e.proxyRunning||!y})]}),e.lastIssue&&(0,M.jsx)(X,{issue:e.lastIssue}),e.installed?(0,M.jsxs)(`div`,{className:`mb-4 space-y-2`,children:[(0,M.jsx)($,{provider:`codex`,active:e.activeProviders.codex,available:e.availableProviders.codex,detectedRoute:e.detectedRoutes.codex,busy:n===`activate-codex`||n===`deactivate-codex`,onClick:()=>c(`codex`,e.activeProviders.codex)}),(0,M.jsx)($,{provider:`claude`,active:e.activeProviders.claude,available:e.availableProviders.claude,detectedRoute:e.detectedRoutes.claude,busy:n===`activate-claude`||n===`deactivate-claude`,onClick:()=>c(`claude`,e.activeProviders.claude)}),y&&(0,M.jsxs)(`button`,{type:`button`,disabled:!!n,onClick:u,className:`flex h-8 w-full items-center justify-center gap-2 rounded-lg border border-border bg-background/45 text-xs hover:bg-muted/50 disabled:opacity-50`,children:[n===`deactivate-all`?(0,M.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}):(0,M.jsx)(A,{className:`h-3.5 w-3.5`}),m(`plugins.headroom.actions.disableAllRoutes`)]})]}):(0,M.jsxs)(`button`,{type:`button`,disabled:!!n,onClick:a,className:`mb-3 flex h-9 w-full items-center justify-center gap-2 rounded-lg bg-accent-primary px-3 text-xs font-medium text-white disabled:opacity-50`,children:[n===`install`?(0,M.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}):(0,M.jsx)(o,{className:`h-3.5 w-3.5`}),m(`plugins.headroom.actions.installWithUv`)]}),e.installed&&(0,M.jsx)(Z,{state:e}),(0,M.jsxs)(`div`,{className:`mb-4 rounded-lg border border-border bg-background/45 p-3`,children:[(0,M.jsx)(`label`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:m(`plugins.headroom.port.label`)}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),className:`h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-sm`}),(0,M.jsx)(`button`,{type:`button`,disabled:!!n||Number(h)===e.port,onClick:()=>f(Number(h)),className:`rounded-md border border-border px-2 text-xs hover:bg-muted disabled:opacity-50`,children:m(`plugins.headroom.port.apply`)})]})]}),i.length>0&&(0,M.jsx)(`pre`,{className:`mb-3 max-h-32 overflow-y-auto overflow-x-hidden whitespace-pre-wrap break-words rounded-lg border border-border bg-background/60 p-2 text-[10px] text-muted-foreground`,children:i.join(`
2
2
  `)}),(0,M.jsxs)(`button`,{type:`button`,onClick:p,className:`mb-2 flex h-8 w-full items-center justify-center gap-2 rounded-lg border border-border text-xs hover:bg-muted/50`,children:[(0,M.jsx)(ie,{className:`h-3.5 w-3.5`}),m(`plugins.headroom.actions.viewDiagnostics`)]}),e.installed&&(0,M.jsx)(`div`,{className:`rounded-lg border border-destructive/25 bg-destructive/5 p-3`,children:_?(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:m(b?`plugins.headroom.confirmDetach`:`plugins.headroom.confirmUninstall`)}),(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,M.jsx)(`button`,{type:`button`,disabled:!!n,onClick:()=>v(!1),className:`h-8 rounded-md border border-border text-xs hover:bg-muted/50 disabled:opacity-50`,children:m(`plugins.actions.cancel`)}),(0,M.jsxs)(`button`,{type:`button`,disabled:!!n,onClick:d,className:`flex h-8 items-center justify-center gap-2 rounded-md bg-destructive px-2 text-xs font-medium text-destructive-foreground disabled:opacity-50`,children:[n===`uninstall`?(0,M.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}):(0,M.jsx)(l,{className:`h-3.5 w-3.5`}),m(b?`plugins.headroom.actions.detach`:`plugins.headroom.actions.uninstall`)]})]})]}):(0,M.jsxs)(`button`,{type:`button`,disabled:!!n,onClick:()=>v(!0),className:`flex h-8 w-full items-center justify-center gap-2 rounded-md text-xs font-medium text-destructive hover:bg-destructive/10 disabled:opacity-50`,children:[(0,M.jsx)(l,{className:`h-3.5 w-3.5`}),m(b?`plugins.headroom.actions.detachHeadroom`:`plugins.headroom.actions.uninstallHeadroom`)]})})]})}function Y({label:e,value:t,good:n}){return(0,M.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/45 p-2`,children:[(0,M.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e}),(0,M.jsx)(`div`,{className:g(`mt-0.5 font-medium`,n?`text-foreground`:`text-accent-warning`),children:t})]})}function X({issue:e}){let{t}=r(`integrations`),n=`plugins.headroom.issues.${e.code}`,i=t(`${n}.title`,{defaultValue:e.title}),a=t(`${n}.guidance`,{defaultValue:e.guidance});return(0,M.jsx)(`div`,{className:`mb-3 rounded-lg border border-accent-warning/35 bg-accent-warning/10 p-3`,children:(0,M.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,M.jsx)(u,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-accent-warning`}),(0,M.jsxs)(`div`,{className:`min-w-0`,children:[(0,M.jsx)(`div`,{className:`text-xs font-medium`,children:i}),(0,M.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-muted-foreground`,children:a}),(0,M.jsx)(`div`,{className:`mt-1 text-[10px] text-muted-foreground`,children:t(`plugins.headroom.issueCode`,{code:e.code})})]})]})})}function Z({state:e}){let{t,i18n:n}=r(`integrations`),i=e.metrics,a=i.outputSavingsAvailable,o=[`codex`,`claude`].map(e=>({provider:e,metric:i.providers[e]})),s=t(`plugins.headroom.savings.tokens`),c=o.reduce((e,{metric:t})=>({inputTokens:e.inputTokens+t.inputTokens,inputTokensSaved:e.inputTokensSaved+t.inputTokensSaved,outputTokens:e.outputTokens+t.outputTokens,outputTokensSaved:e.outputTokensSaved+t.outputTokensSaved}),{inputTokens:0,inputTokensSaved:0,outputTokens:0,outputTokensSaved:0}),l=o.some(({metric:e})=>e.inputTokensSaved>0),u=o.some(({metric:e})=>e.active),d=t(a?`plugins.headroom.savings.statusInputOutput`:l?`plugins.headroom.savings.statusInputOnly`:u?`plugins.headroom.savings.statusRouting`:`plugins.headroom.savings.statusInactive`),f=a||l;return(0,M.jsxs)(`div`,{className:`mb-4 rounded-lg border border-border bg-background/45 p-3`,children:[(0,M.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,M.jsx)(w,{className:`h-3.5 w-3.5 text-accent-primary`}),(0,M.jsx)(`div`,{className:`truncate text-xs font-medium`,children:t(`plugins.headroom.savings.title`)})]}),(0,M.jsx)(`span`,{className:g(`shrink-0 rounded border px-1.5 py-0.5 text-[10px]`,f?`border-accent-success/25 bg-accent-success/10 text-accent-success`:u?`border-accent-primary/25 bg-accent-primary/10 text-accent-primary`:`border-border bg-muted text-muted-foreground`),children:d})]}),(0,M.jsxs)(`div`,{className:`mb-2 rounded-md bg-muted/35 px-2.5 py-2`,children:[(0,M.jsx)(`div`,{className:`mb-1.5 text-[10px] font-medium uppercase text-muted-foreground`,children:t(`plugins.headroom.savings.totals`)}),(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,M.jsx)(Q,{label:t(`plugins.headroom.savings.input`),processed:c.inputTokens>0?W(c.inputTokens,n.language,s):t(`plugins.headroom.savings.noData`),saved:W(c.inputTokensSaved,n.language,s)}),(0,M.jsx)(Q,{align:`right`,label:t(`plugins.headroom.savings.output`),processed:c.outputTokens>0?W(c.outputTokens,n.language,s):t(`plugins.headroom.savings.noData`),saved:a?W(c.outputTokensSaved,n.language,s):t(`plugins.headroom.savings.noData`)})]})]}),(0,M.jsx)(`div`,{className:`grid gap-2`,children:o.map(({provider:e,metric:t})=>(0,M.jsx)(le,{metric:t,outputAvailable:i.outputSavingsAvailable},e))}),(0,M.jsx)(`div`,{className:`mt-2 flex items-center justify-end gap-2 text-[10px] text-muted-foreground`,children:i.updatedAt?t(`plugins.headroom.savings.updatedLive`):t(`plugins.headroom.savings.baselineSamples`,{count:e.learning.baselineSamples})})]})}function Q({label:e,processed:t,saved:n,detail:i,align:a=`left`}){let{t:o}=r(`integrations`);return(0,M.jsxs)(`div`,{className:g(`min-w-0`,a===`right`&&`text-right`),children:[(0,M.jsx)(`div`,{className:`text-[10px] font-medium uppercase text-muted-foreground`,children:e}),(0,M.jsxs)(`div`,{className:`mt-1 space-y-0.5 text-[11px]`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-baseline justify-between gap-2`,children:[(0,M.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:o(`plugins.headroom.savings.processed`)}),(0,M.jsx)(`span`,{className:`truncate font-semibold tabular-nums text-foreground`,children:t})]}),(0,M.jsxs)(`div`,{className:`flex min-w-0 items-baseline justify-between gap-2`,children:[(0,M.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:o(`plugins.headroom.savings.saved`)}),(0,M.jsx)(`span`,{className:`truncate font-semibold tabular-nums text-foreground`,children:n})]})]}),i&&(0,M.jsx)(`div`,{className:`mt-1 truncate text-[10px] text-muted-foreground`,children:i})]})}function le({metric:e,outputAvailable:t}){let{t:n,i18n:i}=r(`integrations`),a=!e.available,o=a||!e.active,s=n(`plugins.headroom.savings.tokens`),c=e.inputTokens>0?W(e.inputTokens,i.language,s):n(`plugins.headroom.savings.noData`),l=W(e.inputTokensSaved,i.language,s),u=e.outputTokens>0?W(e.outputTokens,i.language,s):n(`plugins.headroom.savings.noData`),d=t?W(e.outputTokensSaved,i.language,s):e.active?n(`plugins.headroom.savings.noData`):n(`plugins.headroom.savings.off`),f=e.requests>0?n(`plugins.headroom.savings.requestCount`,{count:U(e.requests,i.language)}):a?n(`plugins.headroom.provider.noProjectUsesProvider`):e.active?n(`plugins.headroom.savings.inputSavingsActive`):n(`plugins.headroom.savings.routeDisabled`);return(0,M.jsxs)(`div`,{className:g(`rounded-md border border-border bg-card/45 px-2.5 py-2`,o&&`opacity-70`),children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,M.jsx)(`span`,{className:`text-xs font-medium`,children:e.label}),e.detectedRoute&&(0,M.jsx)(`span`,{className:`rounded bg-accent-primary/10 px-1.5 py-0.5 text-[9px] uppercase text-accent-primary`,children:n(`plugins.headroom.savings.detected`)})]}),(0,M.jsx)(`div`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:f}),(0,M.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-3`,children:[(0,M.jsx)(Q,{label:n(`plugins.headroom.savings.input`),processed:c,saved:l}),(0,M.jsx)(Q,{align:`right`,label:n(`plugins.headroom.savings.output`),processed:u,saved:d})]})]})}function $({provider:e,active:t,available:n,detectedRoute:i,busy:a,onClick:o}){let{t:c}=r(`integrations`),l=c(n?t?`plugins.headroom.provider.routedThroughHeadroom`:i?`plugins.headroom.provider.detectedExternalRoute`:`plugins.headroom.provider.notRouted`:`plugins.headroom.provider.noProjectUsesProvider`);return(0,M.jsxs)(`button`,{type:`button`,onClick:o,disabled:a||!n,className:`flex w-full items-center gap-3 rounded-lg border border-border bg-background/45 p-3 text-left hover:bg-muted/35 disabled:opacity-50`,children:[(0,M.jsx)(`div`,{className:g(`grid h-8 w-8 place-items-center rounded-md`,t?`bg-accent-success/15 text-accent-success`:`bg-muted text-muted-foreground`),children:a?(0,M.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}):(0,M.jsx)(O,{className:`h-3.5 w-3.5`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`div`,{className:`text-xs font-medium capitalize`,children:e}),(0,M.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:l})]}),(0,M.jsx)(`span`,{className:g(`h-5 w-9 rounded-full p-0.5 transition-colors`,t?`bg-accent-success`:`bg-muted`),children:(0,M.jsx)(`span`,{className:g(`block h-4 w-4 rounded-full bg-white shadow transition-transform`,t&&`translate-x-4`)})})]})}function ue({plugin:e,projects:t,onClose:n}){let{t:i}=r(`integrations`),[a,o]=(0,j.useState)(``);(0,j.useEffect)(()=>o(``),[e]);let s=t.find(e=>e.id===a)??null;return(0,M.jsx)(x,{open:!!e,onOpenChange:e=>{e||n()},children:(0,M.jsxs)(v,{className:`w-[calc(100vw-2rem)] max-w-3xl overflow-x-hidden p-4 sm:p-6`,children:[(0,M.jsxs)(_,{children:[(0,M.jsx)(y,{children:i(e===`jira`?`plugins.projectWizard.configureJira`:`plugins.projectWizard.installSerena`)}),(0,M.jsx)(b,{children:i(`plugins.projectWizard.description`)})]}),(0,M.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,M.jsxs)(`div`,{className:`rounded-lg border border-border bg-card/70 p-3`,children:[(0,M.jsx)(`div`,{className:`mb-2 text-xs font-medium text-muted-foreground`,children:i(`plugins.projectWizard.chooseProject`)}),(0,M.jsx)(`div`,{className:`max-h-[52vh] space-y-1 overflow-auto`,children:t.map(t=>{let n=e===`serena`&&!p(t).includes(`claude`);return(0,M.jsxs)(`button`,{type:`button`,disabled:n,onClick:()=>o(t.id),className:g(`w-full rounded-md px-2 py-2 text-left transition-colors`,t.id===a?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/45 hover:text-foreground`,n&&`cursor-not-allowed opacity-45`),children:[(0,M.jsx)(`div`,{className:`truncate text-xs font-medium`,children:t.name}),(0,M.jsx)(`div`,{className:`truncate text-[10px]`,children:n?i(`plugins.projectWizard.requiresClaudeProvider`):t.path})]},t.id)})})]}),(0,M.jsx)(`div`,{className:`min-h-[360px] rounded-lg border border-border bg-card/70 p-4`,children:s?e===`jira`?(0,M.jsx)(de,{project:s,onDone:n}):(0,M.jsx)(fe,{project:s,onDone:n}):(0,M.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:i(`plugins.projectWizard.selectProjectToContinue`)})})]})]})})}function de({project:e,onDone:t}){let{t:n}=r(`integrations`),i=H(e.id),[a,o]=(0,j.useState)(null),[c,l]=(0,j.useState)(!0),[u,d]=(0,j.useState)(null),f=(0,j.useCallback)(async()=>{l(!0),d(null);try{let e=await fetch(`${i}/jira/connection`).then(e=>V(e));o(e)}catch(e){o({connected:!1}),d(e.message)}finally{l(!1)}},[i]);return(0,j.useEffect)(()=>{f()},[f]),c?(0,M.jsxs)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:[(0,M.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),n(`plugins.jira.loading`,{defaultValue:`Loading Jira...`})]}):a?.connected&&a.connection?(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h3`,{className:`text-sm font-semibold`,children:n(`plugins.jira.titleForProject`,{name:e.name,defaultValue:`Jira for ${e.name}`})}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:n(`plugins.jira.configuredDescription`,{defaultValue:`Manage the Jira project, status mapping, discard status, sync, and connection state.`})})]}),(0,M.jsx)(P,{state:a,apiBase:i,onChanged:()=>{f()}})]}):(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h3`,{className:`text-sm font-semibold`,children:n(`plugins.jira.titleForProject`,{name:e.name,defaultValue:`Jira for ${e.name}`})}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:u?n(`plugins.jira.loadFailed`,{message:u,defaultValue:`Could not load the current Jira configuration: ${u}`}):n(`plugins.jira.notConfiguredDescription`,{defaultValue:`Connect this project to Jira.`})})]}),(0,M.jsx)(E,{apiBase:i,onConnected:()=>{f()},onSkip:t})]})}function fe({project:e,onDone:t}){let{t:n}=r(`integrations`),[i,a]=(0,j.useState)(null),[c,l]=(0,j.useState)(null),[d,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)(null),h=(0,j.useCallback)(async()=>{m(null);let t=(await fetch(`${H(e.id)}/plugins`).then(e=>V(e))).plugins.find(e=>e.name===`serena`)??null;if(a(t),t?.status===`not-installed`){let t=await fetch(`${H(e.id)}/plugins/serena/preview-install`).then(e=>V(e));l(t)}},[e.id]);(0,j.useEffect)(()=>{h().catch(e=>m(e.message))},[h]);async function g(){f(!0),m(null);try{await fetch(`${H(e.id)}/plugins/serena/install`,{method:`POST`}).then(e=>V(e)),await h(),t()}catch(e){m(e.message)}finally{f(!1)}}let _=(c?.requirements??[]).every(e=>e.installed&&e.executable&&e.meetsMinimum),v=i?n(`plugins.projectStatus.${i.status}`,{defaultValue:i.status}):``,y=i?.name===`serena`?n(`plugins.catalog.serena.description`):i?.description;return!i&&!p?(0,M.jsxs)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:[(0,M.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),` `,n(`plugins.serena.loading`)]}):(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h3`,{className:`text-sm font-semibold`,children:n(`plugins.serena.titleForProject`,{name:e.name})}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:n(`plugins.serena.description`)})]}),i&&(0,M.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/45 p-3`,children:[(0,M.jsx)(`div`,{className:`text-xs font-medium`,children:n(`plugins.serena.status`,{status:v})}),y&&(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:y})]}),c&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`mb-1 text-xs font-medium`,children:n(`plugins.serena.files`)}),(0,M.jsx)(`ul`,{className:`space-y-1 text-xs font-mono`,children:c.files.map(e=>(0,M.jsxs)(`li`,{className:e.op===`create`?`text-accent-success`:`text-accent-info`,children:[e.op===`create`?`+ `:`~ `,e.path]},e.path))})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`mb-1 text-xs font-medium`,children:n(`plugins.serena.prerequisites`)}),(0,M.jsx)(`ul`,{className:`space-y-1 text-xs`,children:c.requirements.map(e=>(0,M.jsxs)(`li`,{className:`flex items-center gap-2`,children:[e.installed&&e.executable&&e.meetsMinimum?(0,M.jsx)(T,{className:`h-3 w-3 text-accent-success`}):(0,M.jsx)(u,{className:`h-3 w-3 text-accent-warning`}),(0,M.jsxs)(`span`,{children:[e.name,e.minVersion?` >= ${e.minVersion}`:``]}),e.version&&(0,M.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.version,`)`]})]},e.name))})]})]}),p&&(0,M.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/10 p-3 text-xs text-destructive`,children:p}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md border border-border px-3 py-1.5 text-xs`,children:n(`plugins.actions.cancel`)}),(0,M.jsxs)(`button`,{type:`button`,disabled:d||i?.status!==`not-installed`||!_,onClick:g,className:`flex items-center gap-2 rounded-md bg-accent-primary px-3 py-1.5 text-xs text-white disabled:opacity-50`,children:[d?(0,M.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}):(0,M.jsx)(o,{className:`h-3.5 w-3.5`}),n(`plugins.actions.install`)]})]})]})}function pe({open:e,onClose:t}){let{t:n}=r(`integrations`),[i,a]=(0,j.useState)(null);return(0,j.useEffect)(()=>{e&&fetch(`${d}/api/global-plugins/headroom/diagnostics`).then(e=>V(e)).then(a).catch(e=>a({error:e.message}))},[e]),(0,M.jsx)(x,{open:e,onOpenChange:e=>{e||t()},children:(0,M.jsxs)(v,{className:`max-w-3xl`,children:[(0,M.jsxs)(_,{children:[(0,M.jsxs)(y,{className:`flex items-center gap-2`,children:[(0,M.jsx)(C,{className:`h-4 w-4`}),` `,n(`plugins.diagnostics.title`)]}),(0,M.jsx)(b,{children:n(`plugins.diagnostics.description`)})]}),(0,M.jsx)(`pre`,{className:`max-h-[62vh] overflow-y-auto overflow-x-hidden whitespace-pre-wrap break-words rounded-lg border border-border bg-background p-3 text-xs`,children:JSON.stringify(i,null,2)})]})})}export{G as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{n as r,t as i}from"./createLucideIcon-Bjbbp_KS.js";import{t as a}from"./git-branch-BRM0F5GN.js";import{r as o}from"./useDesktop-B4pSBIDd.js";import{t as s}from"./utils-BC4DHlz2.js";import{a as c,n as l,o as u,r as d,t as f}from"./dialog-CzIekCw0.js";import{Ft as p,Z as m,_ as h,g,h as _,it as v,m as y,nt as b,p as x,tt as S,v as C}from"./index-F9r8mWP_.js";var w=i(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),T=e(t(),1),E=n(),D=[{id:`general`,icon:b,labelKey:`projectDialog.nav.general`},{id:`branch`,icon:a,labelKey:`projectDialog.nav.branch`},{id:`environment`,icon:w,labelKey:`projectDialog.nav.environment`},{id:`budget`,icon:m,labelKey:`projectDialog.nav.budget`},{id:`telemetry`,icon:p,labelKey:`projectDialog.nav.telemetry`},{id:`terminal`,icon:S,labelKey:`projectDialog.nav.terminal`}];function O({open:e,onClose:t}){let{t:n}=r(`settings`),{activeProjectId:i,projects:a}=o(),p=a.find(e=>e.id===i),[m,b]=(0,T.useState)(`general`),S=e=>s(`space-y-5`,m===e?``:`hidden`);return(0,E.jsx)(f,{open:e,onOpenChange:e=>{e||t()},children:(0,E.jsxs)(l,{movableResizable:!0,className:`flex max-w-5xl w-[92vw] h-[82vh] flex-col overflow-hidden`,children:[(0,E.jsxs)(c,{children:[(0,E.jsxs)(u,{className:`flex items-center gap-2`,children:[(0,E.jsx)(v,{className:`w-4 h-4`}),p?n(`projectDialog.title`,{name:p.name}):n(`page.title`)]}),(0,E.jsx)(d,{children:n(`projectDialog.description`)})]}),(0,E.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-5 py-2`,children:[(0,E.jsx)(`nav`,{className:`w-40 shrink-0 space-y-0.5 overflow-y-auto border-r border-border pr-2`,children:D.map(e=>{let t=e.icon;return(0,E.jsxs)(`button`,{type:`button`,onClick:()=>b(e.id),className:s(`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs transition-colors`,m===e.id?`bg-accent-primary/15 font-medium text-foreground`:`text-muted-foreground hover:bg-muted/40 hover:text-foreground`),children:[(0,E.jsx)(t,{className:`w-3.5 h-3.5 shrink-0`}),(0,E.jsx)(`span`,{className:`truncate`,children:n(e.labelKey)})]},e.id)})}),(0,E.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto pr-1`,children:[(0,E.jsx)(`div`,{className:S(`general`),children:(0,E.jsx)(_,{})}),(0,E.jsx)(`div`,{className:S(`branch`),children:(0,E.jsx)(y,{})}),(0,E.jsx)(`div`,{className:S(`environment`),children:(0,E.jsx)(h,{})}),(0,E.jsx)(`div`,{className:S(`budget`),children:(0,E.jsx)(x,{})}),(0,E.jsx)(`div`,{className:S(`telemetry`),children:(0,E.jsx)(g,{})}),(0,E.jsx)(`div`,{className:S(`terminal`),children:(0,E.jsx)(C,{mode:`project`})})]})]})]})})}export{O as ProjectSettingsDialog};
1
+ import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{n as r,t as i}from"./createLucideIcon-Bjbbp_KS.js";import{t as a}from"./git-branch-BRM0F5GN.js";import{r as o}from"./useDesktop-B4pSBIDd.js";import{t as s}from"./utils-BC4DHlz2.js";import{a as c,n as l,o as u,r as d,t as f}from"./dialog-CzIekCw0.js";import{Ft as p,Z as m,_ as h,g,h as _,it as v,m as y,nt as b,p as x,tt as S,v as C}from"./index-CewRMo0W.js";var w=i(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),T=e(t(),1),E=n(),D=[{id:`general`,icon:b,labelKey:`projectDialog.nav.general`},{id:`branch`,icon:a,labelKey:`projectDialog.nav.branch`},{id:`environment`,icon:w,labelKey:`projectDialog.nav.environment`},{id:`budget`,icon:m,labelKey:`projectDialog.nav.budget`},{id:`telemetry`,icon:p,labelKey:`projectDialog.nav.telemetry`},{id:`terminal`,icon:S,labelKey:`projectDialog.nav.terminal`}];function O({open:e,onClose:t}){let{t:n}=r(`settings`),{activeProjectId:i,projects:a}=o(),p=a.find(e=>e.id===i),[m,b]=(0,T.useState)(`general`),S=e=>s(`space-y-5`,m===e?``:`hidden`);return(0,E.jsx)(f,{open:e,onOpenChange:e=>{e||t()},children:(0,E.jsxs)(l,{movableResizable:!0,className:`flex max-w-5xl w-[92vw] h-[82vh] flex-col overflow-hidden`,children:[(0,E.jsxs)(c,{children:[(0,E.jsxs)(u,{className:`flex items-center gap-2`,children:[(0,E.jsx)(v,{className:`w-4 h-4`}),p?n(`projectDialog.title`,{name:p.name}):n(`page.title`)]}),(0,E.jsx)(d,{children:n(`projectDialog.description`)})]}),(0,E.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-5 py-2`,children:[(0,E.jsx)(`nav`,{className:`w-40 shrink-0 space-y-0.5 overflow-y-auto border-r border-border pr-2`,children:D.map(e=>{let t=e.icon;return(0,E.jsxs)(`button`,{type:`button`,onClick:()=>b(e.id),className:s(`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs transition-colors`,m===e.id?`bg-accent-primary/15 font-medium text-foreground`:`text-muted-foreground hover:bg-muted/40 hover:text-foreground`),children:[(0,E.jsx)(t,{className:`w-3.5 h-3.5 shrink-0`}),(0,E.jsx)(`span`,{className:`truncate`,children:n(e.labelKey)})]},e.id)})}),(0,E.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto pr-1`,children:[(0,E.jsx)(`div`,{className:S(`general`),children:(0,E.jsx)(_,{})}),(0,E.jsx)(`div`,{className:S(`branch`),children:(0,E.jsx)(y,{})}),(0,E.jsx)(`div`,{className:S(`environment`),children:(0,E.jsx)(h,{})}),(0,E.jsx)(`div`,{className:S(`budget`),children:(0,E.jsx)(x,{})}),(0,E.jsx)(`div`,{className:S(`telemetry`),children:(0,E.jsx)(g,{})}),(0,E.jsx)(`div`,{className:S(`terminal`),children:(0,E.jsx)(C,{mode:`project`})})]})]})]})})}export{O as ProjectSettingsDialog};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-zu2_FqZY.js";import{n as t}from"./createLucideIcon-Bjbbp_KS.js";import{t as n}from"./brain-DI9lHkKY.js";import{t as r}from"./download-CFHyyHcw.js";import{t as i}from"./git-branch-BRM0F5GN.js";import{t as a}from"./play-DNlrawbS.js";import{t as o}from"./button-BUIIBQPT.js";import{a as s,i as c,n as l,o as u,r as d,t as f}from"./dialog-CzIekCw0.js";import{E as p,Et as m,Q as h,et as g}from"./index-F9r8mWP_.js";var _=e(),v={start:a,"ai-step":n,shell:h,decider:i,condition:i,end:g};function y(e){return e.type===`ai-step`?typeof e.data?.prompt==`string`?e.data.prompt:null:e.type===`shell`?typeof e.data?.command==`string`?e.data.command:null:e.type===`decider`?typeof e.data?.goal==`string`?e.data.goal:null:e.type===`end`?e.data?.outcome===`failure`?`failure`:`success`:null}function b({template:e,onClose:i,onUse:a,mode:h=`use`}){let{t:b}=t(`loops`);return(0,_.jsx)(f,{open:e!==null,onOpenChange:e=>{e||i()},children:(0,_.jsx)(l,{movableResizable:!0,className:`max-w-lg`,children:e&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(s,{children:[(0,_.jsxs)(u,{className:`flex items-center gap-2`,children:[(0,_.jsx)(n,{className:`w-4 h-4 text-accent-highlight`}),e.name]}),(0,_.jsx)(d,{children:e.description})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[p(e.graph)?(0,_.jsx)(`span`,{title:b(`gallery.needsSpecHint`),className:`px-1.5 py-0.5 rounded text-[10px] bg-accent-secondary/15 text-accent-secondary`,children:b(`gallery.needsSpec`)}):(0,_.jsx)(`span`,{title:b(`gallery.standaloneHint`),className:`px-1.5 py-0.5 rounded text-[10px] bg-accent-success/15 text-accent-success`,children:b(`gallery.standalone`)}),e.category&&(0,_.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-accent-info/15 text-accent-info`,children:b(`categories.${e.category}`,{defaultValue:e.category})}),e.tags.map(e=>(0,_.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-muted text-muted-foreground`,children:e},e))]}),(0,_.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:b(`preview.limits`,{iterations:e.graph.config.maxIterations,timeout:e.graph.config.timeoutMinutes})}),(0,_.jsxs)(`div`,{className:`max-h-[50vh] overflow-y-auto space-y-1.5 pr-1`,children:[(0,_.jsx)(`span`,{className:`block text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:b(`preview.steps`)}),e.graph.nodes.map((e,t)=>{let n=v[e.type]??g,r=y(e);return(0,_.jsxs)(`div`,{className:`rounded border border-border bg-surface/30 p-2`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[(0,_.jsxs)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[t+1,`.`]}),(0,_.jsx)(n,{className:`w-3.5 h-3.5 text-accent-primary`}),b(`builder.nodes.${e.type}`)]}),r&&(0,_.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-words text-[11px] text-muted-foreground font-mono`,children:r})]},e.id)})]}),(0,_.jsxs)(c,{children:[(0,_.jsx)(o,{variant:`ghost`,onClick:i,children:b(`common:actions.cancel`)}),(0,_.jsxs)(o,{onClick:()=>a(e.id),children:[h===`fork`?(0,_.jsx)(m,{className:`w-3.5 h-3.5 mr-1.5`}):(0,_.jsx)(r,{className:`w-3.5 h-3.5 mr-1.5`}),b(h===`fork`?`actions.fork`:`actions.use`)]})]})]})})})}export{b as n,y as r,v as t};
1
+ import{t as e}from"./jsx-runtime-zu2_FqZY.js";import{n as t}from"./createLucideIcon-Bjbbp_KS.js";import{t as n}from"./brain-DI9lHkKY.js";import{t as r}from"./download-CFHyyHcw.js";import{t as i}from"./git-branch-BRM0F5GN.js";import{t as a}from"./play-DNlrawbS.js";import{t as o}from"./button-BUIIBQPT.js";import{a as s,i as c,n as l,o as u,r as d,t as f}from"./dialog-CzIekCw0.js";import{E as p,Et as m,Q as h,et as g}from"./index-CewRMo0W.js";var _=e(),v={start:a,"ai-step":n,shell:h,decider:i,condition:i,end:g};function y(e){return e.type===`ai-step`?typeof e.data?.prompt==`string`?e.data.prompt:null:e.type===`shell`?typeof e.data?.command==`string`?e.data.command:null:e.type===`decider`?typeof e.data?.goal==`string`?e.data.goal:null:e.type===`end`?e.data?.outcome===`failure`?`failure`:`success`:null}function b({template:e,onClose:i,onUse:a,mode:h=`use`}){let{t:b}=t(`loops`);return(0,_.jsx)(f,{open:e!==null,onOpenChange:e=>{e||i()},children:(0,_.jsx)(l,{movableResizable:!0,className:`max-w-lg`,children:e&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(s,{children:[(0,_.jsxs)(u,{className:`flex items-center gap-2`,children:[(0,_.jsx)(n,{className:`w-4 h-4 text-accent-highlight`}),e.name]}),(0,_.jsx)(d,{children:e.description})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[p(e.graph)?(0,_.jsx)(`span`,{title:b(`gallery.needsSpecHint`),className:`px-1.5 py-0.5 rounded text-[10px] bg-accent-secondary/15 text-accent-secondary`,children:b(`gallery.needsSpec`)}):(0,_.jsx)(`span`,{title:b(`gallery.standaloneHint`),className:`px-1.5 py-0.5 rounded text-[10px] bg-accent-success/15 text-accent-success`,children:b(`gallery.standalone`)}),e.category&&(0,_.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-accent-info/15 text-accent-info`,children:b(`categories.${e.category}`,{defaultValue:e.category})}),e.tags.map(e=>(0,_.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-muted text-muted-foreground`,children:e},e))]}),(0,_.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:b(`preview.limits`,{iterations:e.graph.config.maxIterations,timeout:e.graph.config.timeoutMinutes})}),(0,_.jsxs)(`div`,{className:`max-h-[50vh] overflow-y-auto space-y-1.5 pr-1`,children:[(0,_.jsx)(`span`,{className:`block text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:b(`preview.steps`)}),e.graph.nodes.map((e,t)=>{let n=v[e.type]??g,r=y(e);return(0,_.jsxs)(`div`,{className:`rounded border border-border bg-surface/30 p-2`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[(0,_.jsxs)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[t+1,`.`]}),(0,_.jsx)(n,{className:`w-3.5 h-3.5 text-accent-primary`}),b(`builder.nodes.${e.type}`)]}),r&&(0,_.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-words text-[11px] text-muted-foreground font-mono`,children:r})]},e.id)})]}),(0,_.jsxs)(c,{children:[(0,_.jsx)(o,{variant:`ghost`,onClick:i,children:b(`common:actions.cancel`)}),(0,_.jsxs)(o,{onClick:()=>a(e.id),children:[h===`fork`?(0,_.jsx)(m,{className:`w-3.5 h-3.5 mr-1.5`}):(0,_.jsx)(r,{className:`w-3.5 h-3.5 mr-1.5`}),b(h===`fork`?`actions.fork`:`actions.use`)]})]})]})})})}export{b as n,y as r,v as t};