specrails-desktop 2.59.3 → 2.60.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/client/dist/assets/{ActivityFeedPage-BGEayjTY.js → ActivityFeedPage-3J7fR8yB.js} +1 -1
- package/client/dist/assets/{AgentBrowserCapture-Qvg4y5Tr.js → AgentBrowserCapture-D4a3wYM1.js} +1 -1
- package/client/dist/assets/{AgentModeAnalyticsPane-CR7aFeLJ.js → AgentModeAnalyticsPane-Dps30tk9.js} +2 -2
- package/client/dist/assets/{AgentModeCodePane-gAd88Gng.js → AgentModeCodePane-CvLimey8.js} +2 -2
- package/client/dist/assets/{AgentModeJobsPane-EjCDuTow.js → AgentModeJobsPane-25tQlLpF.js} +1 -1
- package/client/dist/assets/{AgentsPage-CRHHcp1V.js → AgentsPage-CUDp_sfw.js} +2 -2
- package/client/dist/assets/{AnalyticsPage-a0b1fNEl.js → AnalyticsPage-DXWMGn8b.js} +1 -1
- package/client/dist/assets/{CodePage-BmV1m7l3.js → CodePage-D981zRHy.js} +1 -1
- package/client/dist/assets/{DesktopAnalyticsPage-B87WmXOQ.js → DesktopAnalyticsPage-BkFBq0E6.js} +1 -1
- package/client/dist/assets/{DocsDialog-Co0O672q.js → DocsDialog-BL7uSbIJ.js} +1 -1
- package/client/dist/assets/{DocsPage-DxGI6A2T.js → DocsPage-CsDLbmZX.js} +1 -1
- package/client/dist/assets/{ExportDropdown-1Ce031vB.js → ExportDropdown-B4Olg1Fk.js} +1 -1
- package/client/dist/assets/{InteractiveJobComposer-DkqR77pO.js → InteractiveJobComposer-Z6fl4791.js} +1 -1
- package/client/dist/assets/{JobDetailModal-DVLDVgzz.js → JobDetailModal-DS_Owxs6.js} +1 -1
- package/client/dist/assets/{JobDetailPage-RcP9N-D-.js → JobDetailPage-1TUQ9vlE.js} +1 -1
- package/client/dist/assets/{JobsPage-R9M4xQnp.js → JobsPage-BSrl8P7u.js} +1 -1
- package/client/dist/assets/LoopBuilderPage-Dh5uk2Qy.js +1 -0
- package/client/dist/assets/{LoopPreviewModal-DA2JeKWX.js → LoopPreviewModal-CH1r-KhU.js} +1 -1
- package/client/dist/assets/{LoopWindowSurface-BkkeD0hx.js → LoopWindowSurface-CiZdI6aw.js} +1 -1
- package/client/dist/assets/{LoopsPage-BHv--iI7.js → LoopsPage-BwFujdGi.js} +1 -1
- package/client/dist/assets/{MinimizedChatsContext-Bc9xHByW.js → MinimizedChatsContext-BD2bsRBe.js} +1 -1
- package/client/dist/assets/{PluginsPage-BEy62gxK.js → PluginsPage-B8f49Mvn.js} +1 -1
- package/client/dist/assets/{ProjectSettingsDialog-DDQ_f94T.js → ProjectSettingsDialog-D7q-O6h3.js} +1 -1
- package/client/dist/assets/{RepositoryDeliveries-DIWDFLRM.js → RepositoryDeliveries-NNorcGzT.js} +1 -1
- package/client/dist/assets/{RepositoryScopeSelector-D3PlHIM-.js → RepositoryScopeSelector-D-jb4bI_.js} +1 -1
- package/client/dist/assets/{ReviewPacketPage-BXdPwmdE.js → ReviewPacketPage-DpZSzF-Q.js} +1 -1
- package/client/dist/assets/{TemplatePreviewModal-C7-G6lvI.js → TemplatePreviewModal-5CZdAZ0G.js} +1 -1
- package/client/dist/assets/{TicketDetailModalContext-gGUv7gsQ.js → TicketDetailModalContext-BHmtj1As.js} +1 -1
- package/client/dist/assets/{Trans-Br_OIUKP.js → Trans-wmTUDVyC.js} +1 -1
- package/client/dist/assets/{agentRuntime-TXPQowKJ.js → agentRuntime-7Ydcvr6P.js} +1 -1
- package/client/dist/assets/{agentRuntime-Bpx3yWHK.js → agentRuntime-BHVw9orA.js} +1 -1
- package/client/dist/assets/{agentRuntime-15Pkk6we.js → agentRuntime-DCPDaQcV.js} +1 -1
- package/client/dist/assets/{agentRuntime-C78n13To.js → agentRuntime-DKTw4Ajg.js} +1 -1
- package/client/dist/assets/{agentRuntime-CCI7XF4c.js → agentRuntime-DVhij_i_.js} +1 -1
- package/client/dist/assets/{agentRuntime-Ddqvp2bP.js → agentRuntime-Doss-T8o.js} +1 -1
- package/client/dist/assets/{agentRuntime-CKDHe2-a.js → agentRuntime-eZSMUlkM.js} +1 -1
- package/client/dist/assets/{agentRuntime-hqZRy08E.js → agentRuntime-qSSU7fQk.js} +1 -1
- package/client/dist/assets/agents-B6ZsnARo.js +1 -0
- package/client/dist/assets/agents-BORdhe0K.js +1 -0
- package/client/dist/assets/agents-C6aq9Oqs.js +1 -0
- package/client/dist/assets/agents-Cbsc4bcX.js +1 -0
- package/client/dist/assets/agents-D0uYR6hq.js +1 -0
- package/client/dist/assets/agents-Doe1sHY5.js +1 -0
- package/client/dist/assets/agents-DyNi_I9m.js +1 -0
- package/client/dist/assets/agents-StKxiTg0.js +1 -0
- package/client/dist/assets/agentstudio-7cYCXn-L.js +1 -0
- package/client/dist/assets/{agentstudio-QdAJIDef.js → agentstudio-BHWQh8G3.js} +1 -1
- package/client/dist/assets/agentstudio-BjnWHyRs.js +1 -0
- package/client/dist/assets/{agentstudio-fLXpRGIi.js → agentstudio-BkV8vcK4.js} +1 -1
- package/client/dist/assets/{agentstudio-BWAKeGgB.js → agentstudio-BzugqB_N.js} +1 -1
- package/client/dist/assets/{agentstudio-Cja8Sjcp.js → agentstudio-CWbp7KvH.js} +1 -1
- package/client/dist/assets/agentstudio-DG6plf5o.js +1 -0
- package/client/dist/assets/agentstudio-DkZVF-Cc.js +1 -0
- package/client/dist/assets/{formatDistanceToNow-Q7QPRFV4.js → formatDistanceToNow-Dax4zqPF.js} +1 -1
- package/client/dist/assets/{getTimezoneOffsetInMilliseconds-Bq0CXBaJ.js → getTimezoneOffsetInMilliseconds-dpIo42JZ.js} +1 -1
- package/client/dist/assets/{index-DVkWHOR3.js → index-g8S62tpS.js} +7 -7
- package/client/dist/assets/{jira-api-C2Tzc362.js → jira-api-CLrIvXFm.js} +1 -1
- package/client/dist/assets/{project-repositories-DZKmieH3.js → project-repositories-BkyT8AjU.js} +1 -1
- package/client/dist/assets/{spending-EXaboRU0.js → spending-Oov7p52A.js} +1 -1
- package/client/dist/assets/{useDesktop-ChSmmJfc.js → useDesktop-DpiS8Uov.js} +1 -1
- package/client/dist/assets/{useRuntimeRuns-w9-5OzZl.js → useRuntimeRuns-DBm1mul0.js} +1 -1
- package/client/dist/assets/{useSharedWebSocket-g0nTHfTT.js → useSharedWebSocket-BZxKaVNT.js} +2 -2
- package/client/dist/index.html +17 -17
- package/docs/getting-started.md +2 -2
- package/docs/guide/de/agents/1-meet-the-agents.md +1 -1
- package/docs/guide/de/agents/2-profiles-and-the-balanced-default.md +1 -1
- package/docs/guide/de/agents/3-customizing-models-per-agent.md +1 -1
- package/docs/guide/de/agents/4-custom-agents-catalog.md +3 -3
- package/docs/guide/en/agents/1-meet-the-agents.md +1 -1
- package/docs/guide/en/agents/2-profiles-and-the-balanced-default.md +1 -1
- package/docs/guide/en/agents/3-customizing-models-per-agent.md +1 -1
- package/docs/guide/en/agents/4-custom-agents-catalog.md +3 -3
- package/docs/guide/es/agents/1-meet-the-agents.md +1 -1
- package/docs/guide/es/agents/2-profiles-and-the-balanced-default.md +1 -1
- package/docs/guide/es/agents/3-customizing-models-per-agent.md +1 -1
- package/docs/guide/es/agents/4-custom-agents-catalog.md +3 -3
- package/docs/guide/fr/agents/1-meet-the-agents.md +1 -1
- package/docs/guide/fr/agents/2-profiles-and-the-balanced-default.md +1 -1
- package/docs/guide/fr/agents/3-customizing-models-per-agent.md +1 -1
- package/docs/guide/fr/agents/4-custom-agents-catalog.md +3 -3
- package/docs/guide/it/agents/1-meet-the-agents.md +1 -1
- package/docs/guide/it/agents/2-profiles-and-the-balanced-default.md +1 -1
- package/docs/guide/it/agents/3-customizing-models-per-agent.md +1 -1
- package/docs/guide/it/agents/4-custom-agents-catalog.md +3 -3
- package/docs/guide/ja/agents/1-meet-the-agents.md +1 -1
- package/docs/guide/ja/agents/2-profiles-and-the-balanced-default.md +1 -1
- package/docs/guide/ja/agents/3-customizing-models-per-agent.md +1 -1
- package/docs/guide/ja/agents/4-custom-agents-catalog.md +3 -3
- package/docs/guide/pt/agents/1-meet-the-agents.md +1 -1
- package/docs/guide/pt/agents/2-profiles-and-the-balanced-default.md +1 -1
- package/docs/guide/pt/agents/3-customizing-models-per-agent.md +1 -1
- package/docs/guide/pt/agents/4-custom-agents-catalog.md +3 -3
- package/docs/guide/zh/agents/1-meet-the-agents.md +1 -1
- package/docs/guide/zh/agents/2-profiles-and-the-balanced-default.md +1 -1
- package/docs/guide/zh/agents/3-customizing-models-per-agent.md +1 -1
- package/docs/guide/zh/agents/4-custom-agents-catalog.md +3 -3
- package/docs/internals/adding-a-provider.md +7 -6
- package/docs/internals/core-runtime-updates.md +19 -0
- package/docs/internals/profiles.md +17 -10
- package/docs/internals/review-packet.md +1 -1
- package/docs/internals/source-map.md +1 -1
- package/docs/running-pipelines.md +2 -2
- package/package.json +1 -1
- package/server/dist/core-compat.js +7 -3
- package/server/dist/mcp/guide.js +4 -3
- package/server/dist/modules/agent-runtime/runtime/agent-runtime-bridge.js +7 -3
- package/server/dist/modules/agent-runtime/runtime/agent-runtime-settings.js +24 -1
- package/server/dist/modules/agents/runtime/profiles-router.js +74 -36
- package/server/dist/modules/execution/runtime/queue-manager.js +7 -9
- package/server/dist/modules/loops/runtime/loop-agents.js +2 -5
- package/server/dist/modules/loops/runtime/loop-command-catalog.js +5 -5
- package/server/dist/modules/loops/runtime/loop-definition.js +1 -1
- package/server/dist/modules/loops/runtime/loop-executors.js +0 -2
- package/server/dist/modules/loops/runtime/loop-implement-recipe.js +5 -4
- package/server/dist/modules/loops/runtime/loops-router.js +3 -1
- package/server/dist/providers/gemini-agent-ack.js +13 -10
- package/server/dist/setup-manager.js +28 -43
- package/server/dist/workspace-manager.js +13 -71
- package/client/dist/assets/LoopBuilderPage-C4S-rkWp.js +0 -1
- package/client/dist/assets/agents-CA5eT1d0.js +0 -1
- package/client/dist/assets/agents-CAgy-5uS.js +0 -1
- package/client/dist/assets/agents-CNm6Qzlv.js +0 -1
- package/client/dist/assets/agents-CTwbx-fb.js +0 -1
- package/client/dist/assets/agents-DEGV1Vao.js +0 -1
- package/client/dist/assets/agents-HsDF1aQU.js +0 -1
- package/client/dist/assets/agents-IQjdA-z9.js +0 -1
- package/client/dist/assets/agents-RkGoteXh.js +0 -1
- package/client/dist/assets/agentstudio-B2CTtQgZ.js +0 -1
- package/client/dist/assets/agentstudio-DtfPcr99.js +0 -1
- package/client/dist/assets/agentstudio-X70BKf6u.js +0 -1
- package/client/dist/assets/agentstudio-qXKqVnWS.js +0 -1
- package/server/dist/modules/loops/runtime/loop-agent-defaults.json +0 -6
|
@@ -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{h as r,r as i}from"./useSharedWebSocket-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{h as r,r as i}from"./useSharedWebSocket-BZxKaVNT.js";import{n as a}from"./createLucideIcon-Bjbbp_KS.js";import{a as o,r as s}from"./useDesktop-DpiS8Uov.js";import{n as c,t as l}from"./zap-CUOlvtT1.js";import{t as u}from"./circle-x-CMYsN4ZH.js";import{t as d}from"./loader-circle-DcygOQpC.js";import{$t as f,Gt as p}from"./index-g8S62tpS.js";var m=e(t(),1);function h(e){let t=new Set;return e.filter(e=>{let n=`${e.type}:${e.jobId}`;return t.has(n)?!1:(t.add(n),!0)})}function g({activeProjectId:e,limit:t=50}){let[n,a]=(0,m.useState)([]),[s,c]=(0,m.useState)(!1),[l,u]=(0,m.useState)(!0),d=(0,m.useRef)(e);(0,m.useEffect)(()=>{d.current=e},[e]);let{registerHandler:f,unregisterHandler:p}=i();(0,m.useEffect)(()=>{if(!e){a([]),u(!0);return}let n=!1;c(!0),a([]),u(!0);async function r(){let e=o();try{let r=await fetch(`${e}/activity?limit=${t}`);if(!r.ok||n)return;let i=await r.json();if(n)return;a(i),u(i.length===t)}catch{}finally{n||c(!1)}}return r(),()=>{n=!0}},[e,t]);let g=(0,m.useCallback)(async()=>{if(s||!l)return;c(!0);let e=o(),n=d.current;try{a(r=>{let i=r[r.length-1];if(!i)return r;let o=encodeURIComponent(i.timestamp);return fetch(`${e}/activity?limit=${t}&before=${o}`).then(e=>e.json()).then(e=>{if(d.current!==n){c(!1);return}a(t=>h([...t,...e])),u(e.length===t),c(!1)}).catch(()=>c(!1)),r})}catch{c(!1)}},[s,l,t]),_=(0,m.useCallback)(e=>{let t=e,n=d.current;if(!(!t||typeof t.type!=`string`)&&!(t.projectId&&t.projectId!==n)){if(t.type===`queue`&&Array.isArray(t.jobs)){let e=[];for(let n of t.jobs){let t=n.status===`completed`?`job_completed`:n.status===`failed`?`job_failed`:n.status===`canceled`?`job_canceled`:`job_started`;e.push({id:`${t}:${n.id}`,type:t,jobId:n.id,jobCommand:n.command??``,timestamp:n.startedAt??new Date().toISOString(),summary:`${t.replace(`_`,` `)}: ${n.command??``}`,costUsd:null})}e.length>0&&a(t=>h([...e,...t]))}if(t.type===`phase`&&t.phase&&t.state&&t.timestamp){let e={id:`phase:${t.phase}:${t.state}:${t.timestamp}`,type:`job_started`,jobId:`phase-${t.phase}`,jobCommand:r.t(`activity:feed.phaseCommand`,{phase:t.phase,state:t.state}),timestamp:t.timestamp,summary:`Phase ${t.phase} is ${t.state}`,costUsd:null};a(t=>h([e,...t]))}}},[]);return(0,m.useLayoutEffect)(()=>(f(`activity`,_),()=>p(`activity`)),[_,f,p]),{items:n,loading:s,hasMore:l,loadMore:g}}var _=n();function v(e,t){let n=Date.now()-new Date(e).getTime(),r=Math.floor(n/1e3);if(r<60)return t(`feed.relativeTime.seconds`,{value:r});let i=Math.floor(r/60);if(i<60)return t(`feed.relativeTime.minutes`,{value:i});let a=Math.floor(i/60);return a<24?t(`feed.relativeTime.hours`,{value:a}):t(`feed.relativeTime.days`,{value:Math.floor(a/24)})}function y({type:e}){switch(e){case`job_completed`:return(0,_.jsx)(p,{className:`w-4 h-4 text-green-500 aurora-light:text-accent-success flex-shrink-0`});case`job_failed`:return(0,_.jsx)(u,{className:`w-4 h-4 text-red-500 aurora-light:text-destructive flex-shrink-0`});case`job_canceled`:return(0,_.jsx)(c,{className:`w-4 h-4 text-muted-foreground flex-shrink-0`});default:return(0,_.jsx)(l,{className:`w-4 h-4 text-blue-500 aurora-light:text-accent-info flex-shrink-0`})}}function b(e,t){switch(e){case`job_completed`:return t(`common:status.completed`);case`job_failed`:return t(`common:status.failed`);case`job_canceled`:return t(`common:status.canceled`);default:return t(`feed.typeStarted`)}}function x(e){switch(e){case`job_completed`:return`text-green-500 aurora-light:text-accent-success`;case`job_failed`:return`text-red-500 aurora-light:text-destructive`;case`job_canceled`:return`text-muted-foreground`;default:return`text-blue-500 aurora-light:text-accent-info`}}function S(){let{t:e}=a(`activity`),{activeProjectId:t}=s(),{items:n,loading:r,hasMore:i,loadMore:o}=g({activeProjectId:t}),c=(0,m.useRef)(null);return(0,m.useEffect)(()=>{let e=c.current;if(!e)return;let t=new IntersectionObserver(e=>{e[0].isIntersecting&&i&&!r&&o()},{threshold:.1});return t.observe(e),()=>t.disconnect()},[i,r,o]),(0,_.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 border-b border-border bg-background/50`,children:[(0,_.jsx)(f,{className:`w-4 h-4 text-muted-foreground`}),(0,_.jsx)(`h1`,{className:`text-sm font-medium`,children:e(`feed.title`)})]}),(0,_.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[r&&n.length===0?(0,_.jsx)(`div`,{className:`flex items-center justify-center h-32`,children:(0,_.jsx)(d,{className:`w-4 h-4 animate-spin text-muted-foreground`})}):n.length===0?(0,_.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 gap-2 text-muted-foreground`,children:[(0,_.jsx)(f,{className:`w-8 h-8 opacity-40`}),(0,_.jsx)(`p`,{className:`text-sm`,children:e(`feed.emptyTitle`)}),(0,_.jsx)(`p`,{className:`text-xs opacity-70`,children:e(`feed.emptyHint`)})]}):(0,_.jsx)(`ul`,{className:`divide-y divide-border/50`,children:n.map(t=>(0,_.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-2.5 hover:bg-accent/30 transition-colors`,children:[(0,_.jsx)(y,{type:t.type}),(0,_.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,_.jsx)(`p`,{className:`text-xs text-foreground truncate`,title:t.jobCommand,children:t.jobCommand}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5`,children:[(0,_.jsx)(`span`,{className:`text-xs font-medium ${x(t.type)}`,children:b(t.type,e)}),t.costUsd!=null&&(0,_.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`$`,t.costUsd.toFixed(4)]})]})]}),(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground flex-shrink-0 tabular-nums`,children:v(t.timestamp,e)})]},`${t.type}:${t.jobId}`))}),(0,_.jsx)(`div`,{ref:c,className:`h-1`}),r&&n.length>0&&(0,_.jsx)(`div`,{className:`flex justify-center py-3`,children:(0,_.jsx)(d,{className:`w-4 h-4 animate-spin text-muted-foreground`})}),!i&&n.length>0&&(0,_.jsx)(`p`,{className:`text-center text-xs text-muted-foreground py-3`,children:e(`feed.allLoaded`)})]})]})}export{S as default};
|
package/client/dist/assets/{AgentBrowserCapture-Qvg4y5Tr.js → AgentBrowserCapture-D4a3wYM1.js}
RENAMED
|
@@ -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}from"./createLucideIcon-Bjbbp_KS.js";import{s as i}from"./useDesktop-
|
|
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}from"./createLucideIcon-Bjbbp_KS.js";import{s as i}from"./useDesktop-DpiS8Uov.js";import{d as a,f as o,m as s,u as c}from"./TicketDetailModalContext-BHmtj1As.js";import{H as l,O as u,Q as d,en as f,ft as p,lt as m,nn as h}from"./index-g8S62tpS.js";var g=e(t(),1),_=n();function v({projectId:e,conversationId:t}){let{t:n}=r(`agent`),{error:v}=h(),y=p(t??`__new-mission__`),{closeBrowser:b,queueCapture:x,browserOwnerId:S,browserUrl:C,setBrowserUrl:w}=d(),{materializeDraftConversation:T}=l(),[E,D]=(0,g.useState)(!1),[O,k]=(0,g.useState)(!1),[A,j]=(0,g.useState)(`probing`);(0,g.useEffect)(()=>{if(t&&(E||O||A===`screencast`))return m(t)},[t,E,O,A]);let M=(0,g.useMemo)(()=>{if(C)return C;try{return o(localStorage.getItem(`specrails-desktop:agent-browser-url:${e}`)??``)??`about:blank`}catch{return`about:blank`}},[e]);(0,g.useEffect)(()=>{let e=!0;return a().then(t=>{e&&j(t?`native`:`screencast`)}),()=>{e=!1}},[]);let N=(0,g.useMemo)(()=>`agent-${t??`home`}-${Math.round(performance.now())}`,[t]),P=async e=>{k(!0);try{let r=await f(t??(await T()).id,s(e.screenshotDataUrl,`capture-${Date.now()}.png`));x(r),i.success(n(`workspace.browserCaptured`)),b()}catch(e){throw i.error(n(`workspace.uploadFailed`),{description:e instanceof Error?e.message:void 0}),e}finally{k(!1)}};return A===`probing`?null:A===`native`?(0,_.jsx)(c,{ownerId:S??void 0,leaseRevision:y,onBusyChange:D,transferError:v,url:M,onClose:b,onFallback:()=>j(`screencast`),onUrlChange:t=>{if(w(t),o(t)&&t!==`about:blank`)try{localStorage.setItem(`specrails-desktop:agent-browser-url:${e}`,t)}catch{}},confirmLabel:n(`workspace.browserConfirm`),selectLabel:n(`workspace.browserSelectStart`),onCaptured:P}):(0,_.jsx)(u,{open:!0,onClose:b,projectId:e,pendingSpecId:N,confirmLabel:n(`workspace.browserConfirm`),selectLabel:n(`workspace.browserSelectStart`),onCaptured:P})}export{v as AgentBrowserCapture};
|
package/client/dist/assets/{AgentModeAnalyticsPane-CR7aFeLJ.js → AgentModeAnalyticsPane-Dps30tk9.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AnalyticsPage-
|
|
2
|
-
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{n as i}from"./createLucideIcon-Bjbbp_KS.js";import{t as a}from"./loader-circle-DcygOQpC.js";import{t as o}from"./x-CBMI9ejn.js";import{t as s}from"./utils-BC4DHlz2.js";import{At as c,Q as l,kt as u}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AnalyticsPage-DXWMGn8b.js","assets/rolldown-runtime-CNC7AqOf.js","assets/jsx-runtime-zu2_FqZY.js","assets/chunk-KS7C4IRE-DEKu087k.js","assets/preload-helper-Czpn1I53.js","assets/useSharedWebSocket-BZxKaVNT.js","assets/activity-DiyjsgQV.js","assets/addspec-BOvgmcgk.js","assets/agent-Z5s_GTP0.js","assets/agentRuntime-BHVw9orA.js","assets/agents-Doe1sHY5.js","assets/agentstudio-BzugqB_N.js","assets/aiedit-iIjz2_Qk.js","assets/analytics-BWynXPEm.js","assets/attachments-B53PG733.js","assets/browser-CG0PE1j_.js","assets/builder-CpS9liE9.js","assets/chat-BGD7MXAy.js","assets/code-DaZ-ZwCT.js","assets/commands-BAWSYHjQ.js","assets/common-Bdi0qN4S.js","assets/dashboard-XGdQ5mjw.js","assets/explore-DgBACn39.js","assets/integrations-Dwl9KQp0.js","assets/jira-FXr7u2lh.js","assets/jobs-De3EqaO0.js","assets/loops--KWr0X-w.js","assets/mcp-CUAN6ORK.js","assets/narration-n3hOA7LY.js","assets/nav--u7iPYlS.js","assets/packet-B0H15elv.js","assets/settings-Dbyd6gmj.js","assets/setup-CKGUxKr-.js","assets/specs-DfIdoU5L.js","assets/subscriptionUsage-CdlE5Mg1.js","assets/terminal-BAzpHtpY.js","assets/tickets-D41ZMQpf.js","assets/createLucideIcon-Bjbbp_KS.js","assets/Trans-wmTUDVyC.js","assets/useDesktop-DpiS8Uov.js","assets/react-dom-DiWzBDP9.js","assets/provider-capabilities-lePfeT_Y.js","assets/spending-Oov7p52A.js","assets/clsx-CjueKrWZ.js","assets/formatDistanceToNow-Dax4zqPF.js","assets/getTimezoneOffsetInMilliseconds-dpIo42JZ.js","assets/index-g8S62tpS.js","assets/tauri-shell-DE6LfGPw.js","assets/TicketDetailModalContext-BHmtj1As.js","assets/save-OsUqVn99.js","assets/MinimizedChatsContext-BD2bsRBe.js","assets/sparkles-DrY8hb0X.js","assets/x-CBMI9ejn.js","assets/zap-CUOlvtT1.js","assets/file-text-BcLCfcWZ.js","assets/circle-x-CMYsN4ZH.js","assets/download-CFHyyHcw.js","assets/external-link-D6XxC_Cu.js","assets/git-branch-BRM0F5GN.js","assets/loader-circle-DcygOQpC.js","assets/pencil-C9RkrIPZ.js","assets/square-Ci-PFcFe.js","assets/plus-CsnjfkmX.js","assets/rotate-ccw-Wh4id13q.js","assets/search-Cq_gE3Ik.js","assets/trash-2-BOU3WdZZ.js","assets/triangle-alert-H9T4jAmh.js","assets/jira-api-CLrIvXFm.js","assets/dialog-CMgps2MY.js","assets/utils-BC4DHlz2.js","assets/lib-CGdyxIWg.js","assets/button-D1xExSTF.js","assets/RepositoryScopeSelector-D-jb4bI_.js","assets/project-repositories-BkyT8AjU.js","assets/core-B3mKBIh5.js","assets/RepositoryDeliveries-NNorcGzT.js","assets/useRuntimeRuns-DBm1mul0.js","assets/event-Bt7f3wXe.js","assets/index-Bfunvi6w.css","assets/ExportDropdown-B4Olg1Fk.js","assets/BarChart-nBOMNfiy.js","assets/value-s-gzBeyF.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{n as i}from"./createLucideIcon-Bjbbp_KS.js";import{t as a}from"./loader-circle-DcygOQpC.js";import{t as o}from"./x-CBMI9ejn.js";import{t as s}from"./utils-BC4DHlz2.js";import{At as c,Q as l,kt as u}from"./index-g8S62tpS.js";var d=e(t(),1),f=n(),p=(0,d.lazy)(()=>r(()=>import(`./AnalyticsPage-DXWMGn8b.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81]))),m=420,h=560;function g(){let{t:e}=i(`agent`),{closeAnalyticsPane:t}=l(),[n,r]=(0,d.useState)(h),[g,_]=(0,d.useState)(!1),v=(0,d.useCallback)(e=>{let t=e.clientX,i=n,a=window.innerWidth-m;try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}let o=e=>{let n=Math.min(Math.max(i+(t-e.clientX),m),a);r(n)},s=()=>{window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s),window.addEventListener(`pointercancel`,s)},[n]);return(0,f.jsxs)(`div`,{className:s(`flex h-full flex-col overflow-hidden border-l border-border bg-background`,g&&`absolute inset-0 z-30 border-l-0`),style:g?void 0:{width:n,flexShrink:0},"data-testid":`agent-analytics-pane`,children:[(0,f.jsx)(`div`,{className:`relative flex items-center`,children:!g&&(0,f.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:v,className:`absolute left-0 top-0 h-full w-1.5 -translate-x-full cursor-col-resize select-none touch-none hover:bg-accent-primary/20`,title:e(`workspace.resizeAnalytics`)})}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/60 bg-surface/40 px-3 py-1.5`,children:[(0,f.jsx)(`span`,{className:`text-xs font-medium text-foreground/70`,children:e(`workspace.analytics`)}),(0,f.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,f.jsx)(`button`,{type:`button`,onClick:()=>_(e=>!e),"aria-label":e(g?`restore`:`maximize`),title:e(g?`restore`:`maximize`),className:`rounded-md p-1 text-foreground/60 hover:bg-surface hover:text-foreground`,children:g?(0,f.jsx)(u,{className:`h-4 w-4`}):(0,f.jsx)(c,{className:`h-4 w-4`})}),(0,f.jsx)(`button`,{type:`button`,onClick:t,"aria-label":e(`workspace.closeAnalytics`),title:e(`workspace.closeAnalytics`),className:`rounded-md p-1 text-foreground/60 hover:bg-surface hover:text-foreground`,children:(0,f.jsx)(o,{className:`h-4 w-4`})})]})]}),(0,f.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,f.jsx)(d.Suspense,{fallback:(0,f.jsx)(`div`,{className:`flex h-24 items-center justify-center text-muted-foreground`,children:(0,f.jsx)(a,{className:`h-4 w-4 animate-spin`})}),children:(0,f.jsx)(p,{})})})]})}export{g as AgentModeAnalyticsPane};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodePage-
|
|
2
|
-
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{n as i}from"./createLucideIcon-Bjbbp_KS.js";import{t as a}from"./x-CBMI9ejn.js";import{At as o,Q as s,dt as c,kt as l,ut as u}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodePage-D981zRHy.js","assets/rolldown-runtime-CNC7AqOf.js","assets/jsx-runtime-zu2_FqZY.js","assets/react-dom-DiWzBDP9.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-DEKu087k.js","assets/useSharedWebSocket-BZxKaVNT.js","assets/activity-DiyjsgQV.js","assets/addspec-BOvgmcgk.js","assets/agent-Z5s_GTP0.js","assets/agentRuntime-BHVw9orA.js","assets/agents-Doe1sHY5.js","assets/agentstudio-BzugqB_N.js","assets/aiedit-iIjz2_Qk.js","assets/analytics-BWynXPEm.js","assets/attachments-B53PG733.js","assets/browser-CG0PE1j_.js","assets/builder-CpS9liE9.js","assets/chat-BGD7MXAy.js","assets/code-DaZ-ZwCT.js","assets/commands-BAWSYHjQ.js","assets/common-Bdi0qN4S.js","assets/dashboard-XGdQ5mjw.js","assets/explore-DgBACn39.js","assets/integrations-Dwl9KQp0.js","assets/jira-FXr7u2lh.js","assets/jobs-De3EqaO0.js","assets/loops--KWr0X-w.js","assets/mcp-CUAN6ORK.js","assets/narration-n3hOA7LY.js","assets/nav--u7iPYlS.js","assets/packet-B0H15elv.js","assets/settings-Dbyd6gmj.js","assets/setup-CKGUxKr-.js","assets/specs-DfIdoU5L.js","assets/subscriptionUsage-CdlE5Mg1.js","assets/terminal-BAzpHtpY.js","assets/tickets-D41ZMQpf.js","assets/createLucideIcon-Bjbbp_KS.js","assets/useDesktop-DpiS8Uov.js","assets/TicketDetailModalContext-BHmtj1As.js","assets/tauri-shell-DE6LfGPw.js","assets/Trans-wmTUDVyC.js","assets/provider-capabilities-lePfeT_Y.js","assets/save-OsUqVn99.js","assets/spending-Oov7p52A.js","assets/MinimizedChatsContext-BD2bsRBe.js","assets/sparkles-DrY8hb0X.js","assets/x-CBMI9ejn.js","assets/zap-CUOlvtT1.js","assets/file-text-BcLCfcWZ.js","assets/circle-x-CMYsN4ZH.js","assets/download-CFHyyHcw.js","assets/external-link-D6XxC_Cu.js","assets/git-branch-BRM0F5GN.js","assets/loader-circle-DcygOQpC.js","assets/pencil-C9RkrIPZ.js","assets/square-Ci-PFcFe.js","assets/plus-CsnjfkmX.js","assets/rotate-ccw-Wh4id13q.js","assets/search-Cq_gE3Ik.js","assets/trash-2-BOU3WdZZ.js","assets/triangle-alert-H9T4jAmh.js","assets/jira-api-CLrIvXFm.js","assets/dialog-CMgps2MY.js","assets/utils-BC4DHlz2.js","assets/clsx-CjueKrWZ.js","assets/lib-CGdyxIWg.js","assets/formatDistanceToNow-Dax4zqPF.js","assets/getTimezoneOffsetInMilliseconds-dpIo42JZ.js","assets/button-D1xExSTF.js","assets/RepositoryScopeSelector-D-jb4bI_.js","assets/project-repositories-BkyT8AjU.js","assets/index-g8S62tpS.js","assets/core-B3mKBIh5.js","assets/RepositoryDeliveries-NNorcGzT.js","assets/useRuntimeRuns-DBm1mul0.js","assets/event-Bt7f3wXe.js","assets/index-Bfunvi6w.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{n as i}from"./createLucideIcon-Bjbbp_KS.js";import{t as a}from"./x-CBMI9ejn.js";import{At as o,Q as s,dt as c,kt as l,ut as u}from"./index-g8S62tpS.js";var d=e(t(),1),f=n(),p=(0,d.lazy)(()=>r(()=>import(`./CodePage-D981zRHy.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78]))),m=420,h=560;function g({projectId:e,conversationId:t}){let{t:n}=i(`agent`),{closeCodePane:r}=s(),[g,_]=(0,d.useState)(h),[v,y]=(0,d.useState)(()=>window.innerWidth),[b,x]=(0,d.useState)(!1),S=(0,d.useRef)(null),C=(0,d.useRef)(null),w=Math.max(0,v-Math.min(m,v/2)),T=Math.min(m,w),E=Math.min(w,Math.max(T,g)),D=(0,d.useCallback)(e=>Math.min(w,Math.max(T,e)),[w,T]),O=`${e}:${t}`,k=(0,d.useCallback)(n=>{c(e,t,{path:n})},[e,t]);(0,d.useLayoutEffect)(()=>{let e=S.current,t=e?.parentElement;if(!e||!t)return;let n=()=>{let n=t.getBoundingClientRect().width||t.clientWidth||window.innerWidth,r=0;for(let n of t.children){if(n===e||!(n instanceof HTMLElement))continue;let t=getComputedStyle(n);t.display===`none`||t.position===`absolute`||t.position===`fixed`||Number(t.flexGrow)>0||(r+=n.getBoundingClientRect().width)}y(Math.max(0,n-r))},r=new ResizeObserver(n),i=()=>{r.disconnect(),r.observe(t);for(let n of t.children)n!==e&&r.observe(n);n()},a=new MutationObserver(i);return a.observe(t,{childList:!0}),i(),window.addEventListener(`resize`,n),()=>{r.disconnect(),a.disconnect(),window.removeEventListener(`resize`,n)}},[O]),(0,d.useEffect)(()=>()=>{C.current?.()},[O,b,w]);let A=(0,d.useCallback)(e=>{if(e.button!==0)return;e.preventDefault(),C.current?.();let t=e.clientX,n=E,r=e.pointerId,i=e.currentTarget;try{i.setPointerCapture(r)}catch{}let a=e=>{e.pointerId===r&&_(D(n+t-e.clientX))},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s),window.removeEventListener(`blur`,o),i.removeEventListener(`lostpointercapture`,o);try{i.hasPointerCapture(r)&&i.releasePointerCapture(r)}catch{}C.current=null},s=e=>{e.pointerId===r&&o()};C.current=o,window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,s),window.addEventListener(`pointercancel`,s),window.addEventListener(`blur`,o),i.addEventListener(`lostpointercapture`,o)},[E,D]);return(0,f.jsxs)(`div`,{ref:S,className:`flex h-full min-w-0 flex-col overflow-hidden border-l border-border bg-background${b?` absolute inset-0 z-30 border-l-0`:` relative`}`,style:b?void 0:{width:E,maxWidth:`100%`,flexShrink:0},"data-testid":`agent-code-pane`,children:[!b&&(0,f.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:A,tabIndex:0,"aria-label":n(`workspace.resizeCode`),"aria-valuemin":Math.round(T),"aria-valuemax":Math.round(w),"aria-valuenow":Math.round(E),onKeyDown:e=>{let t=e.key===`ArrowLeft`?E+32:e.key===`ArrowRight`?E-32:e.key===`Home`?T:e.key===`End`?w:null;t!==null&&(e.preventDefault(),_(D(t)))},className:`absolute inset-y-0 left-0 z-20 w-1.5 cursor-col-resize select-none touch-none hover:bg-accent-primary/20 focus-visible:bg-accent-primary/30 focus-visible:outline-none`,title:n(`workspace.resizeCode`)}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/60 bg-surface/40 px-3 py-1.5`,children:[(0,f.jsx)(`span`,{className:`text-xs font-medium text-foreground/70`,children:n(`workspace.files`)}),(0,f.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,f.jsx)(`button`,{type:`button`,onClick:()=>{C.current?.(),x(e=>!e)},"aria-label":n(b?`restore`:`maximize`),title:n(b?`restore`:`maximize`),className:`rounded-md p-1 text-foreground/60 hover:bg-surface hover:text-foreground`,children:b?(0,f.jsx)(l,{className:`h-4 w-4`}):(0,f.jsx)(o,{className:`h-4 w-4`})}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>{C.current?.(),r()},"aria-label":n(`workspace.closeFiles`),title:n(`workspace.closeFiles`),className:`rounded-md p-1 text-foreground/60 hover:bg-surface hover:text-foreground`,children:(0,f.jsx)(a,{className:`h-4 w-4`})})]})]}),(0,f.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,f.jsx)(d.Suspense,{fallback:(0,f.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`…`}),children:(0,f.jsx)(p,{embedded:!0,initialRepositoryId:u(e,t).repositoryId,onRepositoryChange:n=>c(e,t,{repositoryId:n}),initialPath:u(e,t).path,onSelectedPathChange:k},O)})})]},O)}export{g as AgentModeCodePane};
|
|
@@ -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{m as r,r as i}from"./useSharedWebSocket-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{m as r,r as i}from"./useSharedWebSocket-BZxKaVNT.js";import{n as a}from"./createLucideIcon-Bjbbp_KS.js";import{i as o,r as s}from"./useDesktop-DpiS8Uov.js";import{t as c}from"./loader-circle-DcygOQpC.js";import{t as l}from"./x-CBMI9ejn.js";import{t as u}from"./utils-BC4DHlz2.js";import{t as d}from"./formatDistanceToNow-Dax4zqPF.js";import{n as f}from"./project-repositories-BkyT8AjU.js";import{At as p,Jt as m,Q as h,k as g,kt as _}from"./index-g8S62tpS.js";import{t as v}from"./format-command-C0D9IPmV.js";import{n as y,t as b}from"./job-time-BCL7wee9.js";import{JobDetailModal as x}from"./JobDetailModal-DS_Owxs6.js";var S=e(t(),1),C=n(),w=360,T=480,E={running:`running`,completed:`success`,failed:`failed`,canceled:`canceled`,queued:`queued`};function D({projectId:e}){let{t}=a(`agent`),{t:n}=a(`jobs`),{closeJobsPane:D,requestedJobId:O,clearRequestedJob:k}=h(),{projects:A}=s(),j=A.find(t=>t.id===e)?.provider,[M,N]=(0,S.useState)(T),[P,F]=(0,S.useState)(!1),[I,L]=(0,S.useState)(null);(0,S.useEffect)(()=>{O&&(L(O),k())},[O,k]);let{data:R,isFirstLoad:z,refresh:B}=o({namespace:`agent-jobs`,projectId:e,initialValue:[],fetcher:async()=>{let t=await fetch(`${f(e)}/jobs?limit=50`);return t.ok?(await t.json()).jobs:[]},pollInterval:5e3}),{registerHandler:V,unregisterHandler:H}=i(),U=(0,S.useRef)(e);U.current=e;let W=(0,S.useRef)(B);W.current=B,(0,S.useEffect)(()=>(V(`agent-jobs-pane`,e=>{let t=e;t.type===`queue`&&(t.projectId&&t.projectId!==U.current||W.current())}),()=>H(`agent-jobs-pane`)),[V,H]);let G=(0,S.useCallback)(e=>{let t=e.clientX,n=M,r=window.innerWidth-w;try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}let i=e=>{let i=Math.min(Math.max(n+(t-e.clientX),w),r);N(i)},a=()=>{window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,a)};window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,a),window.addEventListener(`pointercancel`,a)},[M]);return(0,C.jsxs)(`div`,{className:u(`flex h-full flex-col overflow-hidden border-l border-border bg-background`,P&&`absolute inset-0 z-30 border-l-0`),style:P?void 0:{width:M,flexShrink:0},children:[(0,C.jsx)(`div`,{className:`relative flex items-center`,children:!P&&(0,C.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:G,className:`absolute left-0 top-0 h-full w-1.5 -translate-x-full cursor-col-resize select-none touch-none hover:bg-accent-primary/20`,title:t(`workspace.resizeJobs`)})}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/60 bg-surface/40 px-3 py-1.5`,children:[(0,C.jsx)(`span`,{className:`text-xs font-medium text-foreground/70`,children:t(`workspace.jobs`)}),(0,C.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,C.jsx)(`button`,{type:`button`,onClick:()=>F(e=>!e),"aria-label":t(P?`restore`:`maximize`),title:t(P?`restore`:`maximize`),className:`rounded-md p-1 text-foreground/60 hover:bg-surface hover:text-foreground`,children:P?(0,C.jsx)(_,{className:`h-4 w-4`}):(0,C.jsx)(p,{className:`h-4 w-4`})}),(0,C.jsx)(`button`,{type:`button`,onClick:D,"aria-label":t(`workspace.closeJobs`),title:t(`workspace.closeJobs`),className:`rounded-md p-1 text-foreground/60 hover:bg-surface hover:text-foreground`,children:(0,C.jsx)(l,{className:`h-4 w-4`})})]})]}),(0,C.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2`,children:z?(0,C.jsx)(`div`,{className:`flex h-24 items-center justify-center text-muted-foreground`,children:(0,C.jsx)(c,{className:`h-4 w-4 animate-spin`})}):R.length===0?(0,C.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 text-center text-muted-foreground`,children:[(0,C.jsx)(m,{className:`h-6 w-6 opacity-40`}),(0,C.jsx)(`p`,{className:`text-xs`,children:t(`workspace.noJobs`)})]}):(0,C.jsx)(`ul`,{className:`space-y-1`,children:R.map(e=>(0,C.jsx)(`li`,{children:(0,C.jsxs)(`button`,{type:`button`,onClick:()=>L(e.id),className:u(`flex w-full flex-col gap-1 rounded-lg border border-border/50 bg-surface/30 px-2.5 py-2 text-left transition-colors`,`hover:border-accent-primary/40 hover:bg-surface/60`),children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(g,{variant:E[e.status]??`queued`,children:n(`statusLabel.${e.status in E?e.status:`queued`}`)}),e.status===`running`&&(0,C.jsx)(c,{className:`h-3 w-3 animate-spin text-accent-primary`}),(0,C.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:(()=>{let t=y(b(e));return t?d(t,{addSuffix:!0,locale:r()}):`—`})()})]}),(0,C.jsx)(`code`,{className:`truncate font-mono text-xs text-foreground/85`,children:v(e.command,j)})]})},e.id))})}),I&&(0,C.jsx)(x,{jobId:I,projectId:e,onClose:()=>L(null)})]})}export{D as AgentModeJobsPane};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{t as r}from"./react-dom-DiWzBDP9.js";import{h as i,r as a}from"./useSharedWebSocket-g0nTHfTT.js";import{t as o}from"./Trans-Br_OIUKP.js";import{n as s,t as c}from"./createLucideIcon-Bjbbp_KS.js";import{a as l,r as u,s as d}from"./useDesktop-ChSmmJfc.js";import{c as f,s as p}from"./provider-capabilities-lePfeT_Y.js";import{n as m,r as h,t as g}from"./save-OsUqVn99.js";import{l as _,n as v,r as y,u as b}from"./MinimizedChatsContext-Bc9xHByW.js";import{n as x,t as S}from"./file-text-BcLCfcWZ.js";import{t as C}from"./external-link-D6XxC_Cu.js";import{t as ee}from"./loader-circle-DcygOQpC.js";import{t as te}from"./pencil-C9RkrIPZ.js";import{t as ne}from"./plus-CsnjfkmX.js";import{t as re}from"./search-Cq_gE3Ik.js";import{t as w}from"./sparkles-DrY8hb0X.js";import{t as T}from"./trash-2-BOU3WdZZ.js";import{t as E}from"./triangle-alert-H9T4jAmh.js";import{t as D}from"./x-CBMI9ejn.js";import{F as O,P as k,a as A,i as j,l as M,o as N,r as P,t as F}from"./dialog-CMgps2MY.js";import{t as I}from"./button-D1xExSTF.js";import{A as ie,B as L,D as ae,Dt as R,F as oe,Ht as se,I as ce,It as z,Kt as le,L as ue,M as de,N as fe,Ot as pe,P as me,Pt as he,Qt as ge,R as B,U as _e,V as ve,X as V,_ as H,_t as ye,at as be,j as xe,mt as Se,wt as Ce,z as we}from"./index-DVkWHOR3.js";import{t as Te}from"./format-command-C0D9IPmV.js";var Ee=c(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),U=e(t(),1),W=n(),De=/^[a-z0-9][a-z0-9-]*$/;function Oe({open:e,mode:t=`add`,initial:n,chainAgents:r,onConfirm:i,onCancel:a}){let{t:c}=s(`agents`),[l,u]=(0,U.useState)(``),[d,f]=(0,U.useState)(r[0]??``);(0,U.useEffect)(()=>{e&&(t===`edit`&&n?(u(n.tags.join(`, `)),f(r.includes(n.agent)?n.agent:r[0]??``)):(u(``),f(r[0]??``)))},[e,t,n,r]);let p=l.split(`,`).map(e=>e.trim()).filter(Boolean),m=p.filter(e=>!De.test(e)),h=p.length>0&&m.length===0&&r.includes(d);return(0,W.jsx)(F,{open:e,onOpenChange:e=>{e||a()},children:(0,W.jsxs)(P,{movableResizable:!0,className:`max-w-md`,children:[(0,W.jsxs)(N,{children:[(0,W.jsx)(M,{children:c(t===`edit`?`routingRule.editTitle`:`routingRule.addTitle`)}),(0,W.jsx)(j,{children:c(t===`edit`?`routingRule.editDescription`:`routingRule.addDescription`)})]}),(0,W.jsxs)(`div`,{className:`py-2 space-y-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground mb-1`,children:c(`routingRule.tagsLabel`)}),(0,W.jsx)(_e,{autoFocus:!0,value:l,onChange:e=>u(e.target.value),placeholder:`frontend, ui`,"aria-label":c(`routingRule.tagsLabel`),className:`text-sm font-mono`}),(0,W.jsx)(`p`,{className:`text-[11px] text-muted-foreground mt-1`,children:(0,W.jsx)(o,{t:c,i18nKey:`routingRule.tagsHint`,components:{code:(0,W.jsx)(`code`,{})}})}),m.length>0&&(0,W.jsx)(`p`,{className:`text-[11px] text-red-400 aurora-light:text-destructive mt-1`,children:c(`routingRule.invalidTags`,{count:m.length,tags:m.join(`, `)})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground mb-1`,children:c(`routingRule.routeToLabel`)}),(0,W.jsx)(`select`,{value:d,onChange:e=>f(e.target.value),"aria-label":c(`routingRule.routeToLabel`),className:`w-full h-9 px-2 text-sm rounded-md border border-border bg-background`,children:r.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))}),(0,W.jsx)(`p`,{className:`text-[11px] text-muted-foreground mt-1`,children:c(`routingRule.routeToHint`)})]})]}),(0,W.jsxs)(A,{children:[(0,W.jsx)(I,{variant:`ghost`,size:`sm`,onClick:a,children:c(`common:actions.cancel`)}),(0,W.jsx)(I,{size:`sm`,onClick:()=>i(p,d),disabled:!h,children:c(t===`edit`?`routingRule.saveChanges`:`routingRule.addRule`)})]})]})})}var ke=new Set([`sr-architect`,`sr-developer`,`sr-reviewer`,`sr-merge-resolver`]),Ae=[`sonnet`,`fable`,`opus`,`haiku`],je=/^[a-z0-9][a-z0-9-]*$/,Me=Ae.map(e=>({value:e,label:e})),Ne=[...ke];function Pe({profile:e,onChange:t,footer:n,provider:r=e.provider??`claude`,modelCatalog:i=Me,defaultModel:a=i[0]?.value??``,customModelAliases:c=!1,baselineAgents:u=Ne,onValidityChange:d,onSoftWarningsChange:f}){let{t:p}=s(`agentstudio`),[m,h]=(0,U.useState)([]),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(!1),[b,x]=(0,U.useState)(null),S=(0,U.useMemo)(()=>new Set(u),[u]);(0,U.useEffect)(()=>{let e=!1;return fetch(`${l()}/profiles/catalog?provider=${encodeURIComponent(r)}`).then(e=>e.ok?e.json():{agents:[]}).then(t=>{e||h(t.agents)}).catch(()=>{e||h([])}),()=>{e=!0}},[r]);let C=n=>{let r=JSON.parse(JSON.stringify(e));n(r),t(r)},ee=new Set(e.agents.map(e=>e.id)),te=m.filter(e=>!ee.has(e.id)),re=(0,U.useMemo)(()=>{let t=[];for(let n of S)e.agents.some(e=>e.id===n)||t.push(p(`profileEditor.validation.missingBaseline`,{agent:n}));let n=e.routing.filter(e=>`default`in e&&e.default===!0);if(n.length>1&&t.push(p(`profileEditor.validation.multipleDefaultRules`,{found:n.length})),n.length===1){let n=e.routing[e.routing.length-1];`default`in n&&n.default===!0||t.push(p(`profileEditor.validation.defaultRuleNotLast`))}for(let n of e.routing)if(e.agents.some(e=>e.id===n.agent)||t.push(p(`profileEditor.validation.unknownRoutingAgent`,{agent:n.agent})),`tags`in n){let e=n.tags.filter(e=>!je.test(e));e.length>0&&t.push(p(`profileEditor.validation.invalidTags`,{agent:n.agent,tags:e.join(`, `)}))}return t},[e,S,p]),w=(0,U.useMemo)(()=>{if(e.routing.length===0)return[];let t=new Set(e.routing.map(e=>e.agent));return e.agents.filter(e=>!S.has(e.id)&&!t.has(e.id)).map(e=>e.id)},[e,S]),T=(0,U.useMemo)(()=>e.routing.some(e=>`default`in e&&e.default===!0),[e.routing]);(0,U.useEffect)(()=>{d&&d(re)},[re,d]),(0,U.useEffect)(()=>{f&&f({agentsMissingRouting:w})},[w,f]);let E=e=>{C(t=>{let n={id:e,model:a},r=t.agents.findIndex(e=>e.id===`sr-merge-resolver`);r>=0?t.agents.splice(r,0,n):t.agents.push(n)}),_(!1)},O=t=>{let n=e.agents[t];S.has(n.id)||C(e=>{e.agents.splice(t,1),e.routing=e.routing.filter(e=>e.agent!==n.id)})},k=(t,n)=>{if(t===n)return;let r=e.agents.findIndex(e=>e.id===t),i=e.agents.findIndex(e=>e.id===n);if(r<0||i<0)return;let a=xe(e.agents,r,i),o=a.findIndex(e=>e.id===`sr-architect`);if(o>0){let[e]=a.splice(o,1);a.unshift(e)}let s=a.findIndex(e=>e.id===`sr-merge-resolver`);if(s>=0&&s!==a.length-1){let[e]=a.splice(s,1);a.push(e)}C(e=>{e.agents=a})},A=L(we(ue,{activationConstraint:{distance:4}}),we(ce,{coordinateGetter:de})),j=e=>{let{active:t,over:n}=e;n&&k(String(t.id),String(n.id))},M=(e,t)=>{C(n=>{n.agents[e].model=t})},N=(e,t)=>{C(n=>{let r={tags:e,agent:t},i=n.routing.findIndex(e=>`default`in e&&e.default===!0);i>=0?n.routing.splice(i,0,r):n.routing.push(r)}),y(!1)},P=()=>{C(e=>{e.routing.some(e=>`default`in e&&e.default===!0)||e.agents.some(e=>e.id===`sr-developer`)&&e.routing.push({default:!0,agent:`sr-developer`})})},F=e=>`default`in e&&e.default===!0,ae=(e,t)=>{C(n=>{let r=n.routing[e];r&&(F(r)||(r.agent=t))})},R=(e,t,n)=>{C(r=>{let i=r.routing[e];i&&(F(i)||(i.tags=t,i.agent=n))})},se=e=>{C(t=>{let n=t.routing[e];n&&(F(n)||t.routing.splice(e,1))})},z=(t,n)=>{let r=t+n;if(r<0||r>=e.routing.length)return;let i=e.routing[t],a=e.routing[r];F(i)||F(a)||C(e=>{let[n]=e.routing.splice(t,1);e.routing.splice(r,0,n)})};return(0,W.jsxs)(`div`,{className:`p-6 space-y-6 max-w-3xl`,children:[(0,W.jsx)(Oe,{open:v,mode:`add`,chainAgents:e.agents.map(e=>e.id),onConfirm:N,onCancel:()=>y(!1)}),(0,W.jsx)(Oe,{open:b!==null,mode:`edit`,initial:b!==null&&e.routing[b]&&!(`default`in e.routing[b])?{tags:e.routing[b].tags,agent:e.routing[b].agent}:void 0,chainAgents:e.agents.map(e=>e.id),onConfirm:(e,t)=>{b!==null&&(R(b,e,t),x(null))},onCancel:()=>x(null)}),re.length>0&&(0,W.jsxs)(`div`,{className:`px-3 py-2 text-xs rounded-md border border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/10 aurora-light:bg-accent-warning/10 text-yellow-500 aurora-light:text-accent-warning`,children:[(0,W.jsx)(`div`,{className:`font-medium mb-1`,children:p(`profileEditor.validationSummary`,{count:re.length})}),(0,W.jsx)(`ul`,{className:`list-disc list-inside space-y-0.5`,children:re.map((e,t)=>(0,W.jsx)(`li`,{children:e},t))})]}),(0,W.jsxs)(`section`,{className:`space-y-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground mb-1`,children:p(`profileEditor.nameLabel`)}),(0,W.jsx)(_e,{value:e.name,disabled:!0,className:`text-sm`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground mb-1`,children:p(`profileEditor.descriptionLabel`)}),(0,W.jsx)(_e,{value:e.description??``,onChange:e=>C(t=>{t.description=e.target.value}),className:`text-sm`,placeholder:p(`profileEditor.descriptionPlaceholder`)})]})]}),(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground mb-3`,children:p(`profileEditor.legacyWorkflowNotice`)}),(0,W.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2`,children:p(`profileEditor.orchestrator.heading`)}),(0,W.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-md border border-border`,children:[(0,W.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,W.jsx)(`div`,{className:`text-sm font-mono text-foreground truncate`,children:Te(`/specrails:implement`,r)}),(0,W.jsx)(`div`,{className:`text-[11px] text-muted-foreground mt-0.5`,children:p(`profileEditor.orchestrator.description`)})]}),(0,W.jsx)(G,{value:e.orchestrator.model,models:i,customModelAliases:c,testId:`profile-orchestrator-model`,onChange:e=>C(t=>{t.orchestrator.model=e})})]})]}),(0,W.jsxs)(`section`,{children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,W.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:p(`profileEditor.agentChain.heading`,{n:e.agents.length})}),(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,onClick:()=>_(e=>!e),disabled:te.length===0,title:te.length===0?p(`profileEditor.agentChain.addDisabledTitle`):p(`profileEditor.agentChain.addTitle`),children:[(0,W.jsx)(ne,{className:`w-3.5 h-3.5 mr-1`}),` `,p(`common:actions.add`)]})]}),g&&(0,W.jsxs)(`div`,{className:`mb-2 p-2 rounded-md border border-border bg-muted/30`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5 px-1`,children:[(0,W.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:p(`profileEditor.agentChain.pickFromCatalog`,{n:te.length})}),(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-accent rounded`,onClick:()=>_(!1),title:p(`common:actions.close`),children:(0,W.jsx)(D,{className:`w-3 h-3`})})]}),te.length===0?(0,W.jsx)(`div`,{className:`px-2 py-3 text-xs text-muted-foreground text-center`,children:p(`profileEditor.agentChain.emptyCatalog`)}):(0,W.jsx)(`div`,{className:`space-y-0.5 max-h-64 overflow-auto`,children:te.map(e=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>E(e.id),className:`w-full flex items-center justify-between gap-2 px-2 py-1.5 text-left rounded hover:bg-accent transition-colors`,children:[(0,W.jsx)(`span`,{className:`text-sm font-mono`,children:e.id}),(0,W.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded `+(e.kind===`custom`?`bg-purple-500/15 aurora-light:bg-accent-secondary/15 text-purple-400 aurora-light:text-accent-secondary`:`bg-muted text-muted-foreground`),children:p(`profileEditor.agentChain.kind.${e.kind}`)})]},e.id))})]}),(0,W.jsx)(oe,{sensors:A,collisionDetection:B,onDragEnd:j,children:(0,W.jsx)(ie,{items:e.agents.map(e=>e.id),strategy:me,children:(0,W.jsx)(`div`,{className:`space-y-1.5`,children:e.agents.map((e,t)=>(0,W.jsx)(Fe,{agent:e,required:S.has(e.id),canRemove:!S.has(e.id),models:i,defaultModel:a,customModelAliases:c,onModel:e=>M(t,e),onRemove:()=>O(t)},e.id))})})})]}),(0,W.jsxs)(`section`,{children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,W.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:p(`profileEditor.routing.heading`,{n:e.routing.length})}),(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[!T&&(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,onClick:P,disabled:e.agents.length===0,title:e.agents.length===0?p(`profileEditor.routing.needAgentsTitle`):void 0,children:[(0,W.jsx)(ne,{className:`w-3.5 h-3.5 mr-1`}),` `,p(`profileEditor.routing.addDefault`)]}),(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,onClick:()=>y(!0),disabled:e.agents.length===0,title:e.agents.length===0?p(`profileEditor.routing.needAgentsTitle`):void 0,children:[(0,W.jsx)(ne,{className:`w-3.5 h-3.5 mr-1`}),` `,p(`profileEditor.routing.addRule`)]})]})]}),(0,W.jsx)(`p`,{className:`text-[11px] text-muted-foreground mb-2`,children:p(`profileEditor.routing.explainer`)}),w.length>0&&(0,W.jsxs)(`div`,{className:`mb-2 px-3 py-2 text-xs rounded-md border border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/10 aurora-light:bg-accent-warning/10 text-yellow-500 aurora-light:text-accent-warning`,children:[(0,W.jsx)(`div`,{className:`font-medium mb-1`,children:p(`profileEditor.routing.untargetedTitle`)}),(0,W.jsx)(`div`,{children:(0,W.jsx)(o,{t:p,i18nKey:`profileEditor.routing.untargetedDetail`,values:{agents:w.join(`, `)},components:{mono:(0,W.jsx)(`span`,{className:`font-mono`})}})})]}),(0,W.jsx)(`div`,{className:`space-y-1.5`,children:e.routing.map((t,n)=>{let r=`default`in t&&t.default===!0;return(0,W.jsx)(Ie,{rule:t,ordinal:n+1,isLast:n===e.routing.length-1,canMove:!r,canRemove:!r,canEdit:!r,chainAgents:e.agents.map(e=>e.id),onAgentChange:e=>ae(n,e),onEdit:()=>x(n),onUp:()=>z(n,-1),onDown:()=>z(n,1),onRemove:()=>se(n)},n)})})]}),n&&(0,W.jsx)(`div`,{className:`pt-3 border-t border-border`,children:n})]})}function Fe({agent:e,required:t,canRemove:n,models:r,defaultModel:i,customModelAliases:a,onModel:o,onRemove:c}){let{t:l}=s(`agentstudio`),u=t,d=e.id===`sr-architect`,f=e.id===`sr-merge-resolver`,{attributes:p,listeners:m,setNodeRef:h,transform:g,transition:_,isDragging:v}=fe({id:e.id});return(0,W.jsxs)(`div`,{ref:h,style:{transform:ve.Transform.toString(g),transition:_,opacity:v?.5:void 0,zIndex:v?10:void 0},className:`flex items-center gap-2 px-2 py-1.5 rounded-md border border-border group hover:bg-accent/30 transition-colors bg-background`,children:[(0,W.jsx)(`button`,{type:`button`,className:`flex-shrink-0 p-0.5 rounded text-muted-foreground cursor-grab active:cursor-grabbing hover:text-foreground`,title:l(`profileEditor.agentRow.dragTitle`),"aria-label":l(`profileEditor.agentRow.dragHandleAria`),...p,...m,children:(0,W.jsx)(z,{className:`w-3.5 h-3.5`})}),(0,W.jsx)(`span`,{className:`text-sm font-mono flex-1 truncate`,children:e.id}),d&&(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded bg-accent-primary/15 text-accent-primary`,title:l(`profileEditor.agentRow.pinnedFirstTitle`),children:[(0,W.jsx)(R,{className:`w-2.5 h-2.5 rotate-[135deg]`}),` `,l(`profileEditor.agentRow.pinnedFirst`)]}),f&&(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded bg-accent-primary/15 text-accent-primary`,title:l(`profileEditor.agentRow.pinnedLastTitle`),children:[(0,W.jsx)(R,{className:`w-2.5 h-2.5 rotate-45`}),` `,l(`profileEditor.agentRow.pinnedLast`)]}),u&&!d&&!f&&(0,W.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:l(`profileEditor.agentRow.required`)}),(0,W.jsx)(G,{value:e.model??i,models:r,customModelAliases:a,testId:`profile-agent-model-${e.id}`,onChange:o}),(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-red-500/20 aurora-light:hover:bg-destructive/15 text-red-400 aurora-light:text-destructive rounded disabled:opacity-30 disabled:cursor-not-allowed opacity-0 group-hover:opacity-100 transition-opacity`,onClick:c,disabled:!n,title:l(n?`common:actions.remove`:`profileEditor.agentRow.requiredRemoveTitle`),children:(0,W.jsx)(D,{className:`w-3 h-3`})})]})}function Ie({rule:e,ordinal:t,isLast:n,canMove:r,canRemove:i,canEdit:a,chainAgents:o,onAgentChange:c,onEdit:l,onUp:u,onDown:d,onRemove:f}){let{t:p}=s(`agentstudio`),m=`default`in e&&e.default===!0;return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 rounded-md border border-border group hover:bg-accent/30 transition-colors`,children:[(0,W.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground w-5 text-center flex-shrink-0`,children:[t,`.`]}),m?(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground flex-1`,children:p(`profileEditor.routingRow.everythingElse`)}):(0,W.jsx)(`span`,{className:`text-xs flex-1 flex gap-1 flex-wrap items-center`,children:e.tags.map(e=>(0,W.jsx)(`span`,{className:`px-1.5 py-0.5 rounded bg-muted font-mono text-[11px]`,children:e},e))}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`→`}),m?(0,W.jsx)(`span`,{className:`h-7 max-w-[15rem] px-2 text-xs font-mono rounded border border-border bg-muted/40 text-muted-foreground inline-flex items-center`,"aria-label":p(`profileEditor.routingRow.defaultTargetAria`),title:p(`profileEditor.routingRow.defaultTargetTitle`),children:e.agent}):(0,W.jsx)(`select`,{value:e.agent,onChange:e=>c(e.target.value),"aria-label":p(`profileEditor.routingRow.targetAria`,{ordinal:t}),className:`h-7 max-w-[15rem] px-2 text-xs font-mono rounded border border-border bg-background`,children:o.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))}),(0,W.jsxs)(`div`,{className:`flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity`,children:[a&&(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-accent rounded`,onClick:l,title:p(`profileEditor.routingRow.editTitle`),"aria-label":p(`profileEditor.routingRow.editAria`,{ordinal:t}),children:(0,W.jsx)(te,{className:`w-3 h-3`})}),r&&!n&&(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-accent rounded`,onClick:d,title:p(`profileEditor.routingRow.moveDown`),children:(0,W.jsx)(ge,{className:`w-3 h-3`})}),r&&t>1&&(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-accent rounded`,onClick:u,title:p(`profileEditor.routingRow.moveUp`),children:(0,W.jsx)(b,{className:`w-3 h-3`})}),i&&(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-red-500/20 aurora-light:hover:bg-destructive/15 text-red-400 aurora-light:text-destructive rounded`,onClick:f,title:p(`common:actions.remove`),children:(0,W.jsx)(D,{className:`w-3 h-3`})})]}),m&&(0,W.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,title:p(`profileEditor.routingRow.coreDefaultTitle`),children:p(`profileEditor.routingRow.coreDefaultBadge`)})]})}function G({value:e,models:t,customModelAliases:n,testId:r,onChange:i}){return n?(0,W.jsx)(V,{value:e,options:t,ariaLabel:`Model alias`,testId:r,className:`h-7 w-52 bg-background px-2 text-xs`,onCommit:i}):(0,W.jsx)(`select`,{value:e,onChange:e=>i(e.target.value),className:`h-7 px-2 text-xs rounded border border-border bg-background`,children:(t.some(t=>t.value===e)?t:[...t,{value:e,label:e}]).map(e=>(0,W.jsx)(`option`,{value:e.value,children:e.label},e.value))})}function Le({open:e,title:t,description:n,placeholder:r,initialValue:i=``,confirmLabel:a,inputPattern:o,inputInvalidHint:c,onConfirm:l,onCancel:u}){let{t:d}=s(),[f,p]=(0,U.useState)(i);(0,U.useEffect)(()=>{e&&p(i)},[e,i]);let m=f.trim(),h=!o||o.test(m),g=m.length>0&&h;return(0,W.jsx)(F,{open:e,onOpenChange:e=>{e||u()},children:(0,W.jsxs)(P,{movableResizable:!0,className:`max-w-md`,children:[(0,W.jsx)(N,{children:(0,W.jsx)(M,{children:t})}),(0,W.jsxs)(`div`,{className:`py-2 space-y-2`,children:[n&&(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n}),(0,W.jsx)(_e,{autoFocus:!0,value:f,placeholder:r,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&g&&l(m)},className:`text-sm font-mono`}),m.length>0&&!h&&c&&(0,W.jsx)(`p`,{className:`text-[11px] text-yellow-500 aurora-light:text-accent-warning`,children:c})]}),(0,W.jsxs)(A,{children:[(0,W.jsx)(I,{variant:`ghost`,size:`sm`,onClick:u,children:d(`actions.cancel`)}),(0,W.jsx)(I,{size:`sm`,onClick:()=>l(m),disabled:!g,children:a??d(`actions.confirm`)})]})]})})}function Re({open:e,title:t,description:n,confirmLabel:r,destructive:i=!1,onConfirm:a,onCancel:o}){let{t:c}=s();return(0,W.jsx)(F,{open:e,onOpenChange:e=>{e||o()},children:(0,W.jsxs)(P,{movableResizable:!0,className:`max-w-md`,children:[(0,W.jsx)(N,{children:(0,W.jsx)(M,{children:t})}),n&&(0,W.jsx)(`div`,{className:`py-2`,children:(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})}),(0,W.jsxs)(A,{children:[(0,W.jsx)(I,{variant:`ghost`,size:`sm`,onClick:o,children:c(`actions.cancel`)}),(0,W.jsx)(I,{size:`sm`,onClick:a,className:i?`bg-red-500 hover:bg-red-600 text-white`:void 0,children:r??c(`actions.confirm`)})]})]})})}var ze={models:Ae.map(e=>({value:e,label:e})),defaultModel:`sonnet`,baselineAgents:[...ke],customModelAliases:!1},Be={primaryProvider:`claude`,providers:[`claude`],catalogs:{claude:ze}};function Ve(e,t,n){return{schemaVersion:1,name:e,description:``,provider:t,orchestrator:{model:n.defaultModel},agents:n.baselineAgents.map(e=>({id:e,model:n.defaultModel,required:!0})),routing:[{default:!0,agent:`sr-developer`}]}}function He(){let{t:e}=s(`agents`),[t,n]=(0,U.useState)([]),[r,i]=(0,U.useState)(Be),[a,c]=(0,U.useState)(``),[u,f]=(0,U.useState)(null),[m,h]=(0,U.useState)(null),[_,v]=(0,U.useState)(!0),[y,b]=(0,U.useState)(null),[x,S]=(0,U.useState)(!1),[C,ee]=(0,U.useState)([]),[te,re]=(0,U.useState)([]),[w,E]=(0,U.useState)(!1),[D,O]=(0,U.useState)(null),[k,A]=(0,U.useState)(null),j=a,M=r.catalogs[j]??ze;(0,U.useEffect)(()=>{let e=!1;return fetch(`${l()}/profiles/context`).then(e=>{if(!e.ok)throw Error(`profile context unavailable`);return e.json()}).then(t=>{if(e)return;let n=Array.isArray(t.providers)&&t.providers.length>0?t.providers:[t.primaryProvider||`claude`],r=n.includes(t.primaryProvider)?t.primaryProvider:n[0];i({...t,providers:n,primaryProvider:r}),c(r)}).catch(()=>{e||(i(Be),c(Be.primaryProvider))}),()=>{e=!0}},[]);let N=(0,U.useCallback)(async()=>{if(j){v(!0),b(null);try{let t=await fetch(`${l()}/profiles?provider=${encodeURIComponent(j)}`);if(!t.ok)throw Error(e(`profiles.errors.listFailed`,{status:t.status}));let r=await t.json();n(r.profiles),f(e=>e&&r.profiles.some(t=>t.name===e)?e:r.profiles[0]?.name??null)}catch(e){b(e.message)}finally{v(!1)}}},[j,e]);(0,U.useEffect)(()=>{j&&N()},[j,N]),(0,U.useEffect)(()=>{if(!u){h(null);return}let t=!1;return fetch(`${l()}/profiles/${encodeURIComponent(u)}?provider=${encodeURIComponent(j)}`).then(t=>{if(!t.ok)throw Error(e(`profiles.errors.loadFailed`,{status:t.status}));return t.json()}).then(e=>{t||h(e.profile)}).catch(e=>{t||b(e.message)}),()=>{t=!0}},[j,u,e]);let P=(0,U.useCallback)(async()=>{S(!0),b(null);try{let t=await fetch(`${l()}/profiles/migrate-from-settings?provider=${encodeURIComponent(j)}`,{method:`POST`});if(!t.ok){let n=await t.json().catch(()=>({}));throw Error(n.error??e(`profiles.errors.migrationFailed`,{status:t.status}))}await N(),f(`default`),d.success(e(`profiles.toasts.migrated`),{description:e(`profiles.toasts.migratedDescription`)})}catch(t){let n=t.message;b(n),d.error(e(`profiles.toasts.migrationFailed`),{description:n})}finally{S(!1)}},[j,N,e]),F=(0,U.useCallback)(async t=>{E(!1),S(!0),b(null);try{let n=Ve(t,j,M),r=await fetch(`${l()}/profiles?provider=${encodeURIComponent(j)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});if(!r.ok){let t=await r.json().catch(()=>({}));throw Error(t.error??e(`profiles.errors.createFailed`,{status:r.status}))}await N(),f(t),d.success(e(`profiles.toasts.created`),{description:t})}catch(t){let n=t.message;b(n),d.error(e(`profiles.toasts.createFailed`),{description:n})}finally{S(!1)}},[M,j,N,e]),ie=(0,U.useCallback)(async(t,n)=>{O(null),S(!0),b(null);try{let r=await fetch(`${l()}/profiles/${encodeURIComponent(t)}/duplicate?provider=${encodeURIComponent(j)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:n,provider:j})});if(!r.ok){let t=await r.json().catch(()=>({}));throw Error(t.error??e(`profiles.errors.duplicateFailed`,{status:r.status}))}await N(),f(n),d.success(e(`profiles.toasts.duplicated`),{description:e(`profiles.toasts.duplicatedDescription`,{from:t,to:n})})}catch(t){let n=t.message;b(n),d.error(e(`profiles.toasts.duplicateFailed`),{description:n})}finally{S(!1)}},[j,N,e]),L=(0,U.useCallback)(async t=>{A(null),S(!0),b(null);try{let n=await fetch(`${l()}/profiles/${encodeURIComponent(t)}?provider=${encodeURIComponent(j)}`,{method:`DELETE`});if(!n.ok){let t=await n.json().catch(()=>({}));throw Error(t.error??e(`profiles.errors.deleteFailed`,{status:n.status}))}f(e=>e===t?null:e),await N(),d.success(e(`profiles.toasts.deleted`),{description:t})}catch(t){let n=t.message;b(n),d.error(e(`profiles.toasts.deleteFailed`),{description:n})}finally{S(!1)}},[j,N,e]),ae=(0,U.useCallback)(()=>E(!0),[]),R=(0,U.useCallback)(e=>O({from:e}),[]),oe=(0,U.useCallback)(e=>A({name:e}),[]),ce=(0,U.useCallback)(async(t,n)=>{S(!0),b(null);try{let r=await fetch(`${l()}/profiles/${encodeURIComponent(t.name)}?provider=${encodeURIComponent(j)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...t,provider:j})});if(!r.ok){let t=await r.json().catch(()=>({}));throw Error(t.error??e(`profiles.errors.saveFailed`,{status:r.status}))}h(t),n.length>0?d.warning(e(`profiles.toasts.savedWithUntargeted`),{description:e(`profiles.toasts.savedWithUntargetedDescription`,{agents:n.join(`, `)}),duration:6e3}):d.success(e(`profiles.toasts.saved`),{description:t.name})}catch(t){let n=t.message;b(n),d.error(e(`profiles.toasts.saveFailed`),{description:n})}finally{S(!1)}},[j,e]),z=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Le,{open:w,title:e(`profiles.createDialog.title`),description:e(`profiles.createDialog.description`),placeholder:`my-profile`,confirmLabel:e(`profiles.createDialog.confirmLabel`),inputPattern:/^[a-z0-9][a-z0-9-]*$/,inputInvalidHint:e(`profiles.createDialog.invalidHint`),onConfirm:e=>void F(e),onCancel:()=>E(!1)}),D&&(0,W.jsx)(Le,{open:!0,title:e(`profiles.duplicateDialog.title`,{name:D.from}),description:e(`profiles.duplicateDialog.description`),placeholder:`${D.from}-copy`,initialValue:`${D.from}-copy`,confirmLabel:e(`common:actions.duplicate`),inputPattern:/^[a-z0-9][a-z0-9-]*$/,inputInvalidHint:e(`profiles.duplicateDialog.invalidHint`),onConfirm:e=>void ie(D.from,e),onCancel:()=>O(null)}),k&&(0,W.jsx)(Re,{open:!0,title:e(`profiles.deleteDialog.title`,{name:k.name}),description:e(`profiles.deleteDialog.description`),confirmLabel:e(`common:actions.delete`),destructive:!0,onConfirm:()=>void L(k.name),onCancel:()=>A(null)})]});return _?(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`profiles.loading`)})}):t.length===0?(0,W.jsxs)(W.Fragment,{children:[z,(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,W.jsxs)(`div`,{className:`text-center max-w-md`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e(`profiles.empty.title`)}),(0,W.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1 mb-4`,children:e(`profiles.empty.body`)}),r.providers.length>1&&(0,W.jsx)(`select`,{value:j,"aria-label":e(`profiles.providerLabel`),onChange:e=>{f(null),h(null),c(e.target.value)},className:`mb-4 h-8 w-full rounded border border-border bg-background px-2 text-xs`,children:r.providers.map(e=>(0,W.jsx)(`option`,{value:e,children:p(e)},e))}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2 justify-center`,children:[(0,W.jsxs)(I,{size:`sm`,onClick:P,disabled:x,children:[(0,W.jsx)(Se,{className:`w-3.5 h-3.5 mr-1.5`}),` `,e(`profiles.empty.migrateButton`)]}),(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,onClick:ae,disabled:x,children:[(0,W.jsx)(ne,{className:`w-3.5 h-3.5 mr-1.5`}),` `,e(`profiles.empty.blankButton`)]})]}),(0,W.jsx)(`div`,{className:`text-[11px] text-muted-foreground/70 mt-3`,children:(0,W.jsx)(o,{t:e,i18nKey:`profiles.empty.migrateExplainer`,components:{code:(0,W.jsx)(`code`,{className:`text-foreground`})}})}),y&&(0,W.jsx)(`div`,{className:`mt-3 text-xs text-red-400 aurora-light:text-destructive`,children:y})]})})]}):(0,W.jsxs)(`div`,{className:`flex flex-col h-full`,children:[z,(0,W.jsxs)(`div`,{className:`flex flex-1 min-h-0`,children:[(0,W.jsxs)(`aside`,{className:`w-64 flex-shrink-0 border-r border-border flex flex-col`,children:[(0,W.jsxs)(`div`,{className:`p-3 space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e(`profiles.sidebar.title`)}),(0,W.jsx)(I,{size:`sm`,variant:`ghost`,onClick:ae,disabled:x,children:(0,W.jsx)(ne,{className:`w-3.5 h-3.5`})})]}),r.providers.length>1&&(0,W.jsx)(`select`,{value:j,"aria-label":e(`profiles.providerLabel`),onChange:e=>{f(null),h(null),c(e.target.value)},className:`h-7 w-full rounded border border-border bg-background px-2 text-xs`,children:r.providers.map(e=>(0,W.jsx)(`option`,{value:e,children:p(e)},e))})]}),(0,W.jsx)(`div`,{className:`flex-1 overflow-auto px-2 pb-3`,children:t.map(t=>(0,W.jsxs)(`div`,{className:`group mb-1 rounded-md px-2 py-1.5 text-xs cursor-pointer transition-colors flex items-center justify-between `+(t.name===u?`bg-accent text-foreground`:`text-muted-foreground hover:bg-accent/50 hover:text-foreground`),onClick:()=>f(t.name),role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&f(t.name)},children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,W.jsx)(`span`,{className:`truncate font-medium`,children:t.name}),t.isDefault&&(0,W.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e(`profiles.sidebar.teamDefault`)})]}),(0,W.jsxs)(`div`,{className:`flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-accent rounded`,title:e(`common:actions.duplicate`),onClick:e=>{e.stopPropagation(),R(t.name)},children:(0,W.jsx)(se,{className:`w-3 h-3`})}),!t.isDefault&&(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-red-500/20 text-red-400 aurora-light:text-destructive rounded`,title:e(`common:actions.delete`),onClick:e=>{e.stopPropagation(),oe(t.name)},children:(0,W.jsx)(T,{className:`w-3 h-3`})})]})]},t.name))})]}),(0,W.jsxs)(`main`,{className:`flex-1 overflow-auto`,children:[y&&(0,W.jsx)(`div`,{className:`mx-4 mt-4 px-3 py-2 text-xs rounded border border-red-500/30 aurora-light:border-destructive/30 bg-red-500/10 aurora-light:bg-destructive/10 text-red-400 aurora-light:text-destructive`,children:y}),m?(0,W.jsx)(Pe,{profile:m,provider:j,modelCatalog:M.models,defaultModel:M.defaultModel,customModelAliases:M.customModelAliases===!0,baselineAgents:M.baselineAgents,onChange:h,onValidityChange:ee,onSoftWarningsChange:e=>re(e.agentsMissingRouting),footer:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsxs)(I,{size:`sm`,onClick:()=>void ce(m,te),disabled:x||C.length>0,title:C.length>0?e(`profiles.editorFooter.fixValidationIssues`):void 0,children:[(0,W.jsx)(g,{className:`w-3.5 h-3.5 mr-1.5`}),e(`common:actions.save`)]}),x&&(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`common:states.saving`)}),C.length>0&&(0,W.jsx)(`span`,{className:`text-xs text-yellow-500 aurora-light:text-accent-warning`,children:e(`profiles.editorFooter.issuesToResolve`,{count:C.length})})]})},`${j}:${m.name}`):(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`profiles.selectPrompt`)})})]})]})]})}function Ue(e){return e==null}function We(e){return typeof e==`object`&&!!e}function Ge(e){return Array.isArray(e)?e:Ue(e)?[]:[e]}function Ke(e,t){var n,r,i,a;if(t)for(a=Object.keys(t),n=0,r=a.length;n<r;n+=1)i=a[n],e[i]=t[i];return e}function qe(e,t){var n=``,r;for(r=0;r<t;r+=1)n+=e;return n}function Je(e){return e===0&&1/e==-1/0}var K={isNothing:Ue,isObject:We,toArray:Ge,repeat:qe,isNegativeZero:Je,extend:Ke};function Ye(e,t){var n=``,r=e.reason||`(unknown reason)`;return e.mark?(e.mark.name&&(n+=`in "`+e.mark.name+`" `),n+=`(`+(e.mark.line+1)+`:`+(e.mark.column+1)+`)`,!t&&e.mark.snippet&&(n+=`
|
|
1
|
+
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{t as r}from"./react-dom-DiWzBDP9.js";import{h as i,r as a}from"./useSharedWebSocket-BZxKaVNT.js";import{t as o}from"./Trans-wmTUDVyC.js";import{n as s,t as c}from"./createLucideIcon-Bjbbp_KS.js";import{a as l,r as u,s as d}from"./useDesktop-DpiS8Uov.js";import{c as f,s as p}from"./provider-capabilities-lePfeT_Y.js";import{n as m,r as h,t as g}from"./save-OsUqVn99.js";import{l as _,n as v,r as y,u as b}from"./MinimizedChatsContext-BD2bsRBe.js";import{n as x,t as S}from"./file-text-BcLCfcWZ.js";import{t as C}from"./external-link-D6XxC_Cu.js";import{t as ee}from"./loader-circle-DcygOQpC.js";import{t as te}from"./pencil-C9RkrIPZ.js";import{t as ne}from"./plus-CsnjfkmX.js";import{t as re}from"./search-Cq_gE3Ik.js";import{t as w}from"./sparkles-DrY8hb0X.js";import{t as T}from"./trash-2-BOU3WdZZ.js";import{t as E}from"./triangle-alert-H9T4jAmh.js";import{t as D}from"./x-CBMI9ejn.js";import{F as O,P as k,a as A,i as j,l as M,o as N,r as P,t as F}from"./dialog-CMgps2MY.js";import{t as I}from"./button-D1xExSTF.js";import{A as ie,B as L,D as ae,Dt as R,F as oe,Ht as se,I as ce,It as z,Kt as le,L as ue,M as de,N as fe,Ot as pe,P as me,Pt as he,Qt as ge,R as B,U as _e,V as ve,X as V,_ as H,_t as ye,at as be,j as xe,mt as Se,wt as Ce,z as we}from"./index-g8S62tpS.js";import{t as Te}from"./format-command-C0D9IPmV.js";var Ee=c(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),U=e(t(),1),W=n(),De=/^[a-z0-9][a-z0-9-]*$/;function Oe({open:e,mode:t=`add`,initial:n,chainAgents:r,onConfirm:i,onCancel:a}){let{t:c}=s(`agents`),[l,u]=(0,U.useState)(``),[d,f]=(0,U.useState)(r[0]??``);(0,U.useEffect)(()=>{e&&(t===`edit`&&n?(u(n.tags.join(`, `)),f(r.includes(n.agent)?n.agent:r[0]??``)):(u(``),f(r[0]??``)))},[e,t,n,r]);let p=l.split(`,`).map(e=>e.trim()).filter(Boolean),m=p.filter(e=>!De.test(e)),h=p.length>0&&m.length===0&&r.includes(d);return(0,W.jsx)(F,{open:e,onOpenChange:e=>{e||a()},children:(0,W.jsxs)(P,{movableResizable:!0,className:`max-w-md`,children:[(0,W.jsxs)(N,{children:[(0,W.jsx)(M,{children:c(t===`edit`?`routingRule.editTitle`:`routingRule.addTitle`)}),(0,W.jsx)(j,{children:c(t===`edit`?`routingRule.editDescription`:`routingRule.addDescription`)})]}),(0,W.jsxs)(`div`,{className:`py-2 space-y-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground mb-1`,children:c(`routingRule.tagsLabel`)}),(0,W.jsx)(_e,{autoFocus:!0,value:l,onChange:e=>u(e.target.value),placeholder:`frontend, ui`,"aria-label":c(`routingRule.tagsLabel`),className:`text-sm font-mono`}),(0,W.jsx)(`p`,{className:`text-[11px] text-muted-foreground mt-1`,children:(0,W.jsx)(o,{t:c,i18nKey:`routingRule.tagsHint`,components:{code:(0,W.jsx)(`code`,{})}})}),m.length>0&&(0,W.jsx)(`p`,{className:`text-[11px] text-red-400 aurora-light:text-destructive mt-1`,children:c(`routingRule.invalidTags`,{count:m.length,tags:m.join(`, `)})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground mb-1`,children:c(`routingRule.routeToLabel`)}),(0,W.jsx)(`select`,{value:d,onChange:e=>f(e.target.value),"aria-label":c(`routingRule.routeToLabel`),className:`w-full h-9 px-2 text-sm rounded-md border border-border bg-background`,children:r.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))}),(0,W.jsx)(`p`,{className:`text-[11px] text-muted-foreground mt-1`,children:c(`routingRule.routeToHint`)})]})]}),(0,W.jsxs)(A,{children:[(0,W.jsx)(I,{variant:`ghost`,size:`sm`,onClick:a,children:c(`common:actions.cancel`)}),(0,W.jsx)(I,{size:`sm`,onClick:()=>i(p,d),disabled:!h,children:c(t===`edit`?`routingRule.saveChanges`:`routingRule.addRule`)})]})]})})}var ke=new Set([`sr-architect`,`sr-developer`,`sr-reviewer`,`sr-merge-resolver`]),Ae=[`sonnet`,`fable`,`opus`,`haiku`],je=/^[a-z0-9][a-z0-9-]*$/,Me=Ae.map(e=>({value:e,label:e})),Ne=[...ke];function Pe({profile:e,onChange:t,footer:n,provider:r=e.provider??`claude`,modelCatalog:i=Me,defaultModel:a=i[0]?.value??``,customModelAliases:c=!1,baselineAgents:u=Ne,onValidityChange:d,onSoftWarningsChange:f}){let{t:p}=s(`agentstudio`),[m,h]=(0,U.useState)([]),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(!1),[b,x]=(0,U.useState)(null),S=(0,U.useMemo)(()=>new Set(u),[u]);(0,U.useEffect)(()=>{let e=!1;return fetch(`${l()}/profiles/catalog?provider=${encodeURIComponent(r)}`).then(e=>e.ok?e.json():{agents:[]}).then(t=>{e||h(t.agents)}).catch(()=>{e||h([])}),()=>{e=!0}},[r]);let C=n=>{let r=JSON.parse(JSON.stringify(e));n(r),t(r)},ee=new Set(e.agents.map(e=>e.id)),te=m.filter(e=>!ee.has(e.id)),re=(0,U.useMemo)(()=>{let t=[];for(let n of S)e.agents.some(e=>e.id===n)||t.push(p(`profileEditor.validation.missingBaseline`,{agent:n}));let n=e.routing.filter(e=>`default`in e&&e.default===!0);if(n.length>1&&t.push(p(`profileEditor.validation.multipleDefaultRules`,{found:n.length})),n.length===1){let n=e.routing[e.routing.length-1];`default`in n&&n.default===!0||t.push(p(`profileEditor.validation.defaultRuleNotLast`))}for(let n of e.routing)if(e.agents.some(e=>e.id===n.agent)||t.push(p(`profileEditor.validation.unknownRoutingAgent`,{agent:n.agent})),`tags`in n){let e=n.tags.filter(e=>!je.test(e));e.length>0&&t.push(p(`profileEditor.validation.invalidTags`,{agent:n.agent,tags:e.join(`, `)}))}return t},[e,S,p]),w=(0,U.useMemo)(()=>{if(e.routing.length===0)return[];let t=new Set(e.routing.map(e=>e.agent));return e.agents.filter(e=>!S.has(e.id)&&!t.has(e.id)).map(e=>e.id)},[e,S]),T=(0,U.useMemo)(()=>e.routing.some(e=>`default`in e&&e.default===!0),[e.routing]);(0,U.useEffect)(()=>{d&&d(re)},[re,d]),(0,U.useEffect)(()=>{f&&f({agentsMissingRouting:w})},[w,f]);let E=e=>{C(t=>{let n={id:e,model:a},r=t.agents.findIndex(e=>e.id===`sr-merge-resolver`);r>=0?t.agents.splice(r,0,n):t.agents.push(n)}),_(!1)},O=t=>{let n=e.agents[t];S.has(n.id)||C(e=>{e.agents.splice(t,1),e.routing=e.routing.filter(e=>e.agent!==n.id)})},k=(t,n)=>{if(t===n)return;let r=e.agents.findIndex(e=>e.id===t),i=e.agents.findIndex(e=>e.id===n);if(r<0||i<0)return;let a=xe(e.agents,r,i),o=a.findIndex(e=>e.id===`sr-architect`);if(o>0){let[e]=a.splice(o,1);a.unshift(e)}let s=a.findIndex(e=>e.id===`sr-merge-resolver`);if(s>=0&&s!==a.length-1){let[e]=a.splice(s,1);a.push(e)}C(e=>{e.agents=a})},A=L(we(ue,{activationConstraint:{distance:4}}),we(ce,{coordinateGetter:de})),j=e=>{let{active:t,over:n}=e;n&&k(String(t.id),String(n.id))},M=(e,t)=>{C(n=>{n.agents[e].model=t})},N=(e,t)=>{C(n=>{let r={tags:e,agent:t},i=n.routing.findIndex(e=>`default`in e&&e.default===!0);i>=0?n.routing.splice(i,0,r):n.routing.push(r)}),y(!1)},P=()=>{C(e=>{e.routing.some(e=>`default`in e&&e.default===!0)||e.agents.some(e=>e.id===`sr-developer`)&&e.routing.push({default:!0,agent:`sr-developer`})})},F=e=>`default`in e&&e.default===!0,ae=(e,t)=>{C(n=>{let r=n.routing[e];r&&(F(r)||(r.agent=t))})},R=(e,t,n)=>{C(r=>{let i=r.routing[e];i&&(F(i)||(i.tags=t,i.agent=n))})},se=e=>{C(t=>{let n=t.routing[e];n&&(F(n)||t.routing.splice(e,1))})},z=(t,n)=>{let r=t+n;if(r<0||r>=e.routing.length)return;let i=e.routing[t],a=e.routing[r];F(i)||F(a)||C(e=>{let[n]=e.routing.splice(t,1);e.routing.splice(r,0,n)})};return(0,W.jsxs)(`div`,{className:`p-6 space-y-6 max-w-3xl`,children:[(0,W.jsx)(Oe,{open:v,mode:`add`,chainAgents:e.agents.map(e=>e.id),onConfirm:N,onCancel:()=>y(!1)}),(0,W.jsx)(Oe,{open:b!==null,mode:`edit`,initial:b!==null&&e.routing[b]&&!(`default`in e.routing[b])?{tags:e.routing[b].tags,agent:e.routing[b].agent}:void 0,chainAgents:e.agents.map(e=>e.id),onConfirm:(e,t)=>{b!==null&&(R(b,e,t),x(null))},onCancel:()=>x(null)}),re.length>0&&(0,W.jsxs)(`div`,{className:`px-3 py-2 text-xs rounded-md border border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/10 aurora-light:bg-accent-warning/10 text-yellow-500 aurora-light:text-accent-warning`,children:[(0,W.jsx)(`div`,{className:`font-medium mb-1`,children:p(`profileEditor.validationSummary`,{count:re.length})}),(0,W.jsx)(`ul`,{className:`list-disc list-inside space-y-0.5`,children:re.map((e,t)=>(0,W.jsx)(`li`,{children:e},t))})]}),(0,W.jsxs)(`section`,{className:`space-y-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground mb-1`,children:p(`profileEditor.nameLabel`)}),(0,W.jsx)(_e,{value:e.name,disabled:!0,className:`text-sm`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground mb-1`,children:p(`profileEditor.descriptionLabel`)}),(0,W.jsx)(_e,{value:e.description??``,onChange:e=>C(t=>{t.description=e.target.value}),className:`text-sm`,placeholder:p(`profileEditor.descriptionPlaceholder`)})]})]}),(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground mb-3`,children:p(`profileEditor.legacyWorkflowNotice`)}),(0,W.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2`,children:p(`profileEditor.orchestrator.heading`)}),(0,W.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-md border border-border`,children:[(0,W.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,W.jsx)(`div`,{className:`text-sm font-mono text-foreground truncate`,children:Te(`/specrails:implement`,r)}),(0,W.jsx)(`div`,{className:`text-[11px] text-muted-foreground mt-0.5`,children:p(`profileEditor.orchestrator.description`)})]}),(0,W.jsx)(G,{value:e.orchestrator.model,models:i,customModelAliases:c,testId:`profile-orchestrator-model`,onChange:e=>C(t=>{t.orchestrator.model=e})})]})]}),(0,W.jsxs)(`section`,{children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,W.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:p(`profileEditor.agentChain.heading`,{n:e.agents.length})}),(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,onClick:()=>_(e=>!e),disabled:te.length===0,title:te.length===0?p(`profileEditor.agentChain.addDisabledTitle`):p(`profileEditor.agentChain.addTitle`),children:[(0,W.jsx)(ne,{className:`w-3.5 h-3.5 mr-1`}),` `,p(`common:actions.add`)]})]}),g&&(0,W.jsxs)(`div`,{className:`mb-2 p-2 rounded-md border border-border bg-muted/30`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5 px-1`,children:[(0,W.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:p(`profileEditor.agentChain.pickFromCatalog`,{n:te.length})}),(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-accent rounded`,onClick:()=>_(!1),title:p(`common:actions.close`),children:(0,W.jsx)(D,{className:`w-3 h-3`})})]}),te.length===0?(0,W.jsx)(`div`,{className:`px-2 py-3 text-xs text-muted-foreground text-center`,children:p(`profileEditor.agentChain.emptyCatalog`)}):(0,W.jsx)(`div`,{className:`space-y-0.5 max-h-64 overflow-auto`,children:te.map(e=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>E(e.id),className:`w-full flex items-center justify-between gap-2 px-2 py-1.5 text-left rounded hover:bg-accent transition-colors`,children:[(0,W.jsx)(`span`,{className:`text-sm font-mono`,children:e.id}),(0,W.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded `+(e.kind===`custom`?`bg-purple-500/15 aurora-light:bg-accent-secondary/15 text-purple-400 aurora-light:text-accent-secondary`:`bg-muted text-muted-foreground`),children:p(`profileEditor.agentChain.kind.${e.kind}`)})]},e.id))})]}),(0,W.jsx)(oe,{sensors:A,collisionDetection:B,onDragEnd:j,children:(0,W.jsx)(ie,{items:e.agents.map(e=>e.id),strategy:me,children:(0,W.jsx)(`div`,{className:`space-y-1.5`,children:e.agents.map((e,t)=>(0,W.jsx)(Fe,{agent:e,required:S.has(e.id),canRemove:!S.has(e.id),models:i,defaultModel:a,customModelAliases:c,onModel:e=>M(t,e),onRemove:()=>O(t)},e.id))})})})]}),(0,W.jsxs)(`section`,{children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,W.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:p(`profileEditor.routing.heading`,{n:e.routing.length})}),(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[!T&&(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,onClick:P,disabled:e.agents.length===0,title:e.agents.length===0?p(`profileEditor.routing.needAgentsTitle`):void 0,children:[(0,W.jsx)(ne,{className:`w-3.5 h-3.5 mr-1`}),` `,p(`profileEditor.routing.addDefault`)]}),(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,onClick:()=>y(!0),disabled:e.agents.length===0,title:e.agents.length===0?p(`profileEditor.routing.needAgentsTitle`):void 0,children:[(0,W.jsx)(ne,{className:`w-3.5 h-3.5 mr-1`}),` `,p(`profileEditor.routing.addRule`)]})]})]}),(0,W.jsx)(`p`,{className:`text-[11px] text-muted-foreground mb-2`,children:p(`profileEditor.routing.explainer`)}),w.length>0&&(0,W.jsxs)(`div`,{className:`mb-2 px-3 py-2 text-xs rounded-md border border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/10 aurora-light:bg-accent-warning/10 text-yellow-500 aurora-light:text-accent-warning`,children:[(0,W.jsx)(`div`,{className:`font-medium mb-1`,children:p(`profileEditor.routing.untargetedTitle`)}),(0,W.jsx)(`div`,{children:(0,W.jsx)(o,{t:p,i18nKey:`profileEditor.routing.untargetedDetail`,values:{agents:w.join(`, `)},components:{mono:(0,W.jsx)(`span`,{className:`font-mono`})}})})]}),(0,W.jsx)(`div`,{className:`space-y-1.5`,children:e.routing.map((t,n)=>{let r=`default`in t&&t.default===!0;return(0,W.jsx)(Ie,{rule:t,ordinal:n+1,isLast:n===e.routing.length-1,canMove:!r,canRemove:!r,canEdit:!r,chainAgents:e.agents.map(e=>e.id),onAgentChange:e=>ae(n,e),onEdit:()=>x(n),onUp:()=>z(n,-1),onDown:()=>z(n,1),onRemove:()=>se(n)},n)})})]}),n&&(0,W.jsx)(`div`,{className:`pt-3 border-t border-border`,children:n})]})}function Fe({agent:e,required:t,canRemove:n,models:r,defaultModel:i,customModelAliases:a,onModel:o,onRemove:c}){let{t:l}=s(`agentstudio`),u=t,d=e.id===`sr-architect`,f=e.id===`sr-merge-resolver`,{attributes:p,listeners:m,setNodeRef:h,transform:g,transition:_,isDragging:v}=fe({id:e.id});return(0,W.jsxs)(`div`,{ref:h,style:{transform:ve.Transform.toString(g),transition:_,opacity:v?.5:void 0,zIndex:v?10:void 0},className:`flex items-center gap-2 px-2 py-1.5 rounded-md border border-border group hover:bg-accent/30 transition-colors bg-background`,children:[(0,W.jsx)(`button`,{type:`button`,className:`flex-shrink-0 p-0.5 rounded text-muted-foreground cursor-grab active:cursor-grabbing hover:text-foreground`,title:l(`profileEditor.agentRow.dragTitle`),"aria-label":l(`profileEditor.agentRow.dragHandleAria`),...p,...m,children:(0,W.jsx)(z,{className:`w-3.5 h-3.5`})}),(0,W.jsx)(`span`,{className:`text-sm font-mono flex-1 truncate`,children:e.id}),d&&(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded bg-accent-primary/15 text-accent-primary`,title:l(`profileEditor.agentRow.pinnedFirstTitle`),children:[(0,W.jsx)(R,{className:`w-2.5 h-2.5 rotate-[135deg]`}),` `,l(`profileEditor.agentRow.pinnedFirst`)]}),f&&(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded bg-accent-primary/15 text-accent-primary`,title:l(`profileEditor.agentRow.pinnedLastTitle`),children:[(0,W.jsx)(R,{className:`w-2.5 h-2.5 rotate-45`}),` `,l(`profileEditor.agentRow.pinnedLast`)]}),u&&!d&&!f&&(0,W.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:l(`profileEditor.agentRow.required`)}),(0,W.jsx)(G,{value:e.model??i,models:r,customModelAliases:a,testId:`profile-agent-model-${e.id}`,onChange:o}),(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-red-500/20 aurora-light:hover:bg-destructive/15 text-red-400 aurora-light:text-destructive rounded disabled:opacity-30 disabled:cursor-not-allowed opacity-0 group-hover:opacity-100 transition-opacity`,onClick:c,disabled:!n,title:l(n?`common:actions.remove`:`profileEditor.agentRow.requiredRemoveTitle`),children:(0,W.jsx)(D,{className:`w-3 h-3`})})]})}function Ie({rule:e,ordinal:t,isLast:n,canMove:r,canRemove:i,canEdit:a,chainAgents:o,onAgentChange:c,onEdit:l,onUp:u,onDown:d,onRemove:f}){let{t:p}=s(`agentstudio`),m=`default`in e&&e.default===!0;return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 rounded-md border border-border group hover:bg-accent/30 transition-colors`,children:[(0,W.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground w-5 text-center flex-shrink-0`,children:[t,`.`]}),m?(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground flex-1`,children:p(`profileEditor.routingRow.everythingElse`)}):(0,W.jsx)(`span`,{className:`text-xs flex-1 flex gap-1 flex-wrap items-center`,children:e.tags.map(e=>(0,W.jsx)(`span`,{className:`px-1.5 py-0.5 rounded bg-muted font-mono text-[11px]`,children:e},e))}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`→`}),m?(0,W.jsx)(`span`,{className:`h-7 max-w-[15rem] px-2 text-xs font-mono rounded border border-border bg-muted/40 text-muted-foreground inline-flex items-center`,"aria-label":p(`profileEditor.routingRow.defaultTargetAria`),title:p(`profileEditor.routingRow.defaultTargetTitle`),children:e.agent}):(0,W.jsx)(`select`,{value:e.agent,onChange:e=>c(e.target.value),"aria-label":p(`profileEditor.routingRow.targetAria`,{ordinal:t}),className:`h-7 max-w-[15rem] px-2 text-xs font-mono rounded border border-border bg-background`,children:o.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))}),(0,W.jsxs)(`div`,{className:`flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity`,children:[a&&(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-accent rounded`,onClick:l,title:p(`profileEditor.routingRow.editTitle`),"aria-label":p(`profileEditor.routingRow.editAria`,{ordinal:t}),children:(0,W.jsx)(te,{className:`w-3 h-3`})}),r&&!n&&(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-accent rounded`,onClick:d,title:p(`profileEditor.routingRow.moveDown`),children:(0,W.jsx)(ge,{className:`w-3 h-3`})}),r&&t>1&&(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-accent rounded`,onClick:u,title:p(`profileEditor.routingRow.moveUp`),children:(0,W.jsx)(b,{className:`w-3 h-3`})}),i&&(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-red-500/20 aurora-light:hover:bg-destructive/15 text-red-400 aurora-light:text-destructive rounded`,onClick:f,title:p(`common:actions.remove`),children:(0,W.jsx)(D,{className:`w-3 h-3`})})]}),m&&(0,W.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,title:p(`profileEditor.routingRow.coreDefaultTitle`),children:p(`profileEditor.routingRow.coreDefaultBadge`)})]})}function G({value:e,models:t,customModelAliases:n,testId:r,onChange:i}){return n?(0,W.jsx)(V,{value:e,options:t,ariaLabel:`Model alias`,testId:r,className:`h-7 w-52 bg-background px-2 text-xs`,onCommit:i}):(0,W.jsx)(`select`,{value:e,onChange:e=>i(e.target.value),className:`h-7 px-2 text-xs rounded border border-border bg-background`,children:(t.some(t=>t.value===e)?t:[...t,{value:e,label:e}]).map(e=>(0,W.jsx)(`option`,{value:e.value,children:e.label},e.value))})}function Le({open:e,title:t,description:n,placeholder:r,initialValue:i=``,confirmLabel:a,inputPattern:o,inputInvalidHint:c,onConfirm:l,onCancel:u}){let{t:d}=s(),[f,p]=(0,U.useState)(i);(0,U.useEffect)(()=>{e&&p(i)},[e,i]);let m=f.trim(),h=!o||o.test(m),g=m.length>0&&h;return(0,W.jsx)(F,{open:e,onOpenChange:e=>{e||u()},children:(0,W.jsxs)(P,{movableResizable:!0,className:`max-w-md`,children:[(0,W.jsx)(N,{children:(0,W.jsx)(M,{children:t})}),(0,W.jsxs)(`div`,{className:`py-2 space-y-2`,children:[n&&(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n}),(0,W.jsx)(_e,{autoFocus:!0,value:f,placeholder:r,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&g&&l(m)},className:`text-sm font-mono`}),m.length>0&&!h&&c&&(0,W.jsx)(`p`,{className:`text-[11px] text-yellow-500 aurora-light:text-accent-warning`,children:c})]}),(0,W.jsxs)(A,{children:[(0,W.jsx)(I,{variant:`ghost`,size:`sm`,onClick:u,children:d(`actions.cancel`)}),(0,W.jsx)(I,{size:`sm`,onClick:()=>l(m),disabled:!g,children:a??d(`actions.confirm`)})]})]})})}function Re({open:e,title:t,description:n,confirmLabel:r,destructive:i=!1,onConfirm:a,onCancel:o}){let{t:c}=s();return(0,W.jsx)(F,{open:e,onOpenChange:e=>{e||o()},children:(0,W.jsxs)(P,{movableResizable:!0,className:`max-w-md`,children:[(0,W.jsx)(N,{children:(0,W.jsx)(M,{children:t})}),n&&(0,W.jsx)(`div`,{className:`py-2`,children:(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})}),(0,W.jsxs)(A,{children:[(0,W.jsx)(I,{variant:`ghost`,size:`sm`,onClick:o,children:c(`actions.cancel`)}),(0,W.jsx)(I,{size:`sm`,onClick:a,className:i?`bg-red-500 hover:bg-red-600 text-white`:void 0,children:r??c(`actions.confirm`)})]})]})})}var ze={models:Ae.map(e=>({value:e,label:e})),defaultModel:`sonnet`,baselineAgents:[...ke],customModelAliases:!1},Be={primaryProvider:`claude`,providers:[`claude`],catalogs:{claude:ze}};function Ve(e,t,n){return{schemaVersion:1,name:e,description:``,provider:t,orchestrator:{model:n.defaultModel},agents:n.baselineAgents.map(e=>({id:e,model:n.defaultModel,required:!0})),routing:[{default:!0,agent:`sr-developer`}]}}function He(){let{t:e}=s(`agents`),[t,n]=(0,U.useState)([]),[r,i]=(0,U.useState)(Be),[a,c]=(0,U.useState)(``),[u,f]=(0,U.useState)(null),[m,h]=(0,U.useState)(null),[_,v]=(0,U.useState)(!0),[y,b]=(0,U.useState)(null),[x,S]=(0,U.useState)(!1),[C,ee]=(0,U.useState)([]),[te,re]=(0,U.useState)([]),[w,E]=(0,U.useState)(!1),[D,O]=(0,U.useState)(null),[k,A]=(0,U.useState)(null),j=a,M=r.catalogs[j]??ze;(0,U.useEffect)(()=>{let e=!1;return fetch(`${l()}/profiles/context`).then(e=>{if(!e.ok)throw Error(`profile context unavailable`);return e.json()}).then(t=>{if(e)return;let n=Array.isArray(t.providers)&&t.providers.length>0?t.providers:[t.primaryProvider||`claude`],r=n.includes(t.primaryProvider)?t.primaryProvider:n[0];i({...t,providers:n,primaryProvider:r}),c(r)}).catch(()=>{e||(i(Be),c(Be.primaryProvider))}),()=>{e=!0}},[]);let N=(0,U.useCallback)(async()=>{if(j){v(!0),b(null);try{let t=await fetch(`${l()}/profiles?provider=${encodeURIComponent(j)}`);if(!t.ok)throw Error(e(`profiles.errors.listFailed`,{status:t.status}));let r=await t.json();n(r.profiles),f(e=>e&&r.profiles.some(t=>t.name===e)?e:r.profiles[0]?.name??null)}catch(e){b(e.message)}finally{v(!1)}}},[j,e]);(0,U.useEffect)(()=>{j&&N()},[j,N]),(0,U.useEffect)(()=>{if(!u){h(null);return}let t=!1;return fetch(`${l()}/profiles/${encodeURIComponent(u)}?provider=${encodeURIComponent(j)}`).then(t=>{if(!t.ok)throw Error(e(`profiles.errors.loadFailed`,{status:t.status}));return t.json()}).then(e=>{t||h(e.profile)}).catch(e=>{t||b(e.message)}),()=>{t=!0}},[j,u,e]);let P=(0,U.useCallback)(async()=>{S(!0),b(null);try{let t=await fetch(`${l()}/profiles/migrate-from-settings?provider=${encodeURIComponent(j)}`,{method:`POST`});if(!t.ok){let n=await t.json().catch(()=>({}));throw Error(n.error??e(`profiles.errors.migrationFailed`,{status:t.status}))}await N(),f(`default`),d.success(e(`profiles.toasts.migrated`),{description:e(`profiles.toasts.migratedDescription`)})}catch(t){let n=t.message;b(n),d.error(e(`profiles.toasts.migrationFailed`),{description:n})}finally{S(!1)}},[j,N,e]),F=(0,U.useCallback)(async t=>{E(!1),S(!0),b(null);try{let n=Ve(t,j,M),r=await fetch(`${l()}/profiles?provider=${encodeURIComponent(j)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});if(!r.ok){let t=await r.json().catch(()=>({}));throw Error(t.error??e(`profiles.errors.createFailed`,{status:r.status}))}await N(),f(t),d.success(e(`profiles.toasts.created`),{description:t})}catch(t){let n=t.message;b(n),d.error(e(`profiles.toasts.createFailed`),{description:n})}finally{S(!1)}},[M,j,N,e]),ie=(0,U.useCallback)(async(t,n)=>{O(null),S(!0),b(null);try{let r=await fetch(`${l()}/profiles/${encodeURIComponent(t)}/duplicate?provider=${encodeURIComponent(j)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:n,provider:j})});if(!r.ok){let t=await r.json().catch(()=>({}));throw Error(t.error??e(`profiles.errors.duplicateFailed`,{status:r.status}))}await N(),f(n),d.success(e(`profiles.toasts.duplicated`),{description:e(`profiles.toasts.duplicatedDescription`,{from:t,to:n})})}catch(t){let n=t.message;b(n),d.error(e(`profiles.toasts.duplicateFailed`),{description:n})}finally{S(!1)}},[j,N,e]),L=(0,U.useCallback)(async t=>{A(null),S(!0),b(null);try{let n=await fetch(`${l()}/profiles/${encodeURIComponent(t)}?provider=${encodeURIComponent(j)}`,{method:`DELETE`});if(!n.ok){let t=await n.json().catch(()=>({}));throw Error(t.error??e(`profiles.errors.deleteFailed`,{status:n.status}))}f(e=>e===t?null:e),await N(),d.success(e(`profiles.toasts.deleted`),{description:t})}catch(t){let n=t.message;b(n),d.error(e(`profiles.toasts.deleteFailed`),{description:n})}finally{S(!1)}},[j,N,e]),ae=(0,U.useCallback)(()=>E(!0),[]),R=(0,U.useCallback)(e=>O({from:e}),[]),oe=(0,U.useCallback)(e=>A({name:e}),[]),ce=(0,U.useCallback)(async(t,n)=>{S(!0),b(null);try{let r=await fetch(`${l()}/profiles/${encodeURIComponent(t.name)}?provider=${encodeURIComponent(j)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...t,provider:j})});if(!r.ok){let t=await r.json().catch(()=>({}));throw Error(t.error??e(`profiles.errors.saveFailed`,{status:r.status}))}h(t),n.length>0?d.warning(e(`profiles.toasts.savedWithUntargeted`),{description:e(`profiles.toasts.savedWithUntargetedDescription`,{agents:n.join(`, `)}),duration:6e3}):d.success(e(`profiles.toasts.saved`),{description:t.name})}catch(t){let n=t.message;b(n),d.error(e(`profiles.toasts.saveFailed`),{description:n})}finally{S(!1)}},[j,e]),z=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Le,{open:w,title:e(`profiles.createDialog.title`),description:e(`profiles.createDialog.description`),placeholder:`my-profile`,confirmLabel:e(`profiles.createDialog.confirmLabel`),inputPattern:/^[a-z0-9][a-z0-9-]*$/,inputInvalidHint:e(`profiles.createDialog.invalidHint`),onConfirm:e=>void F(e),onCancel:()=>E(!1)}),D&&(0,W.jsx)(Le,{open:!0,title:e(`profiles.duplicateDialog.title`,{name:D.from}),description:e(`profiles.duplicateDialog.description`),placeholder:`${D.from}-copy`,initialValue:`${D.from}-copy`,confirmLabel:e(`common:actions.duplicate`),inputPattern:/^[a-z0-9][a-z0-9-]*$/,inputInvalidHint:e(`profiles.duplicateDialog.invalidHint`),onConfirm:e=>void ie(D.from,e),onCancel:()=>O(null)}),k&&(0,W.jsx)(Re,{open:!0,title:e(`profiles.deleteDialog.title`,{name:k.name}),description:e(`profiles.deleteDialog.description`),confirmLabel:e(`common:actions.delete`),destructive:!0,onConfirm:()=>void L(k.name),onCancel:()=>A(null)})]});return _?(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`profiles.loading`)})}):t.length===0?(0,W.jsxs)(W.Fragment,{children:[z,(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,W.jsxs)(`div`,{className:`text-center max-w-md`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e(`profiles.empty.title`)}),(0,W.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1 mb-4`,children:e(`profiles.empty.body`)}),r.providers.length>1&&(0,W.jsx)(`select`,{value:j,"aria-label":e(`profiles.providerLabel`),onChange:e=>{f(null),h(null),c(e.target.value)},className:`mb-4 h-8 w-full rounded border border-border bg-background px-2 text-xs`,children:r.providers.map(e=>(0,W.jsx)(`option`,{value:e,children:p(e)},e))}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2 justify-center`,children:[(0,W.jsxs)(I,{size:`sm`,onClick:P,disabled:x,children:[(0,W.jsx)(Se,{className:`w-3.5 h-3.5 mr-1.5`}),` `,e(`profiles.empty.migrateButton`)]}),(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,onClick:ae,disabled:x,children:[(0,W.jsx)(ne,{className:`w-3.5 h-3.5 mr-1.5`}),` `,e(`profiles.empty.blankButton`)]})]}),(0,W.jsx)(`div`,{className:`text-[11px] text-muted-foreground/70 mt-3`,children:(0,W.jsx)(o,{t:e,i18nKey:`profiles.empty.migrateExplainer`,components:{code:(0,W.jsx)(`code`,{className:`text-foreground`})}})}),y&&(0,W.jsx)(`div`,{className:`mt-3 text-xs text-red-400 aurora-light:text-destructive`,children:y})]})})]}):(0,W.jsxs)(`div`,{className:`flex flex-col h-full`,children:[z,(0,W.jsxs)(`div`,{className:`flex flex-1 min-h-0`,children:[(0,W.jsxs)(`aside`,{className:`w-64 flex-shrink-0 border-r border-border flex flex-col`,children:[(0,W.jsxs)(`div`,{className:`p-3 space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e(`profiles.sidebar.title`)}),(0,W.jsx)(I,{size:`sm`,variant:`ghost`,onClick:ae,disabled:x,children:(0,W.jsx)(ne,{className:`w-3.5 h-3.5`})})]}),r.providers.length>1&&(0,W.jsx)(`select`,{value:j,"aria-label":e(`profiles.providerLabel`),onChange:e=>{f(null),h(null),c(e.target.value)},className:`h-7 w-full rounded border border-border bg-background px-2 text-xs`,children:r.providers.map(e=>(0,W.jsx)(`option`,{value:e,children:p(e)},e))})]}),(0,W.jsx)(`div`,{className:`flex-1 overflow-auto px-2 pb-3`,children:t.map(t=>(0,W.jsxs)(`div`,{className:`group mb-1 rounded-md px-2 py-1.5 text-xs cursor-pointer transition-colors flex items-center justify-between `+(t.name===u?`bg-accent text-foreground`:`text-muted-foreground hover:bg-accent/50 hover:text-foreground`),onClick:()=>f(t.name),role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&f(t.name)},children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,W.jsx)(`span`,{className:`truncate font-medium`,children:t.name}),t.isDefault&&(0,W.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e(`profiles.sidebar.teamDefault`)})]}),(0,W.jsxs)(`div`,{className:`flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-accent rounded`,title:e(`common:actions.duplicate`),onClick:e=>{e.stopPropagation(),R(t.name)},children:(0,W.jsx)(se,{className:`w-3 h-3`})}),!t.isDefault&&(0,W.jsx)(`button`,{type:`button`,className:`p-1 hover:bg-red-500/20 text-red-400 aurora-light:text-destructive rounded`,title:e(`common:actions.delete`),onClick:e=>{e.stopPropagation(),oe(t.name)},children:(0,W.jsx)(T,{className:`w-3 h-3`})})]})]},t.name))})]}),(0,W.jsxs)(`main`,{className:`flex-1 overflow-auto`,children:[y&&(0,W.jsx)(`div`,{className:`mx-4 mt-4 px-3 py-2 text-xs rounded border border-red-500/30 aurora-light:border-destructive/30 bg-red-500/10 aurora-light:bg-destructive/10 text-red-400 aurora-light:text-destructive`,children:y}),m?(0,W.jsx)(Pe,{profile:m,provider:j,modelCatalog:M.models,defaultModel:M.defaultModel,customModelAliases:M.customModelAliases===!0,baselineAgents:M.baselineAgents,onChange:h,onValidityChange:ee,onSoftWarningsChange:e=>re(e.agentsMissingRouting),footer:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsxs)(I,{size:`sm`,onClick:()=>void ce(m,te),disabled:x||C.length>0,title:C.length>0?e(`profiles.editorFooter.fixValidationIssues`):void 0,children:[(0,W.jsx)(g,{className:`w-3.5 h-3.5 mr-1.5`}),e(`common:actions.save`)]}),x&&(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`common:states.saving`)}),C.length>0&&(0,W.jsx)(`span`,{className:`text-xs text-yellow-500 aurora-light:text-accent-warning`,children:e(`profiles.editorFooter.issuesToResolve`,{count:C.length})})]})},`${j}:${m.name}`):(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`profiles.selectPrompt`)})})]})]})]})}function Ue(e){return e==null}function We(e){return typeof e==`object`&&!!e}function Ge(e){return Array.isArray(e)?e:Ue(e)?[]:[e]}function Ke(e,t){var n,r,i,a;if(t)for(a=Object.keys(t),n=0,r=a.length;n<r;n+=1)i=a[n],e[i]=t[i];return e}function qe(e,t){var n=``,r;for(r=0;r<t;r+=1)n+=e;return n}function Je(e){return e===0&&1/e==-1/0}var K={isNothing:Ue,isObject:We,toArray:Ge,repeat:qe,isNegativeZero:Je,extend:Ke};function Ye(e,t){var n=``,r=e.reason||`(unknown reason)`;return e.mark?(e.mark.name&&(n+=`in "`+e.mark.name+`" `),n+=`(`+(e.mark.line+1)+`:`+(e.mark.column+1)+`)`,!t&&e.mark.snippet&&(n+=`
|
|
2
2
|
|
|
3
3
|
`+e.mark.snippet),r+` `+n):r}function Xe(e,t){Error.call(this),this.name=`YAMLException`,this.reason=e,this.mark=t,this.message=Ye(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack||``}Xe.prototype=Object.create(Error.prototype),Xe.prototype.constructor=Xe,Xe.prototype.toString=function(e){return this.name+`: `+Ye(this,e)};var q=Xe;function Ze(e,t,n,r,i){var a=``,o=``,s=Math.floor(i/2)-1;return r-t>s&&(a=` ... `,t=r-s+a.length),n-r>s&&(o=` ...`,n=r+s-o.length),{str:a+e.slice(t,n).replace(/\t/g,`→`)+o,pos:r-t+a.length}}function Qe(e,t){return K.repeat(` `,t-e.length)+e}function $e(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||=79,typeof t.indent!=`number`&&(t.indent=1),typeof t.linesBefore!=`number`&&(t.linesBefore=3),typeof t.linesAfter!=`number`&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,r=[0],i=[],a,o=-1;a=n.exec(e.buffer);)i.push(a.index),r.push(a.index+a[0].length),e.position<=a.index&&o<0&&(o=r.length-2);o<0&&(o=r.length-1);var s=``,c,l,u=Math.min(e.line+t.linesAfter,i.length).toString().length,d=t.maxLength-(t.indent+u+3);for(c=1;c<=t.linesBefore&&!(o-c<0);c++)l=Ze(e.buffer,r[o-c],i[o-c],e.position-(r[o]-r[o-c]),d),s=K.repeat(` `,t.indent)+Qe((e.line-c+1).toString(),u)+` | `+l.str+`
|
|
4
4
|
`+s;for(l=Ze(e.buffer,r[o],i[o],e.position,d),s+=K.repeat(` `,t.indent)+Qe((e.line+1).toString(),u)+` | `+l.str+`
|
|
@@ -115,4 +115,4 @@ You are ...
|
|
|
115
115
|
`}),o++):(i.push({type:`del`,text:n[a]+`
|
|
116
116
|
`}),a++)}for(;a<n.length;)i.push({type:`del`,text:n[a++]+`
|
|
117
117
|
`});for(;o<r.length;)i.push({type:`add`,text:r[o++]+`
|
|
118
|
-
`});return i}function oa({value:e,onChange:t,onSubmit:n,disabled:r,placeholder:i,autoFocus:a,inputRef:o}){let{t:c}=s(`aiedit`);return(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(`div`,{className:`relative rounded-xl border border-border bg-card/40 focus-within:border-accent-primary/40 focus-within:ring-2 focus-within:ring-accent-primary/20 transition-all`,children:[(0,W.jsx)(`textarea`,{ref:o,value:e,onChange:e=>t(e.target.value),placeholder:i,rows:3,disabled:r,autoFocus:a,className:`w-full text-sm p-3 pr-14 bg-transparent resize-none focus:outline-none disabled:opacity-50 placeholder:text-muted-foreground/60`,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),n())}}),(0,W.jsx)(`button`,{type:`button`,onClick:n,disabled:!e.trim()||r,"aria-label":c(`shell.composer.sendAriaLabel`),className:`absolute bottom-2.5 right-2.5 p-2 rounded-md bg-accent-primary text-white hover:bg-accent-primary/90 disabled:opacity-30 disabled:cursor-not-allowed focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:outline-none transition-opacity`,children:r?(0,W.jsx)(ee,{className:`w-3.5 h-3.5 animate-spin`}):(0,W.jsx)(sa,{})})]}),(0,W.jsx)(`div`,{className:`flex items-center justify-end text-[11px] text-muted-foreground/70`,children:(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`kbd`,{className:`px-1.5 py-0.5 rounded bg-muted/60 text-[10px] font-mono`,children:H(`⌘⏎`)}),` `,c(`shell.composer.kbdSubmit`),(0,W.jsx)(`span`,{className:`mx-1.5`,children:`·`}),(0,W.jsx)(`kbd`,{className:`px-1.5 py-0.5 rounded bg-muted/60 text-[10px] font-mono`,children:`Esc`}),` `,c(`shell.composer.kbdCancel`)]})})]})}function sa(){return(0,W.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`w-3.5 h-3.5`,children:[(0,W.jsx)(`path`,{d:`M22 2 11 13`}),(0,W.jsx)(`path`,{d:`M22 2 15 22l-4-9-9-4Z`})]})}var ca=[`refine.chips.tightenTools`,`refine.chips.stricterPersonality`,`refine.chips.workflowSection`,`refine.chips.sharpenDescription`,`refine.chips.matchDeveloperStyle`];function la({agentId:e,baseBody:t,resumeRefineId:n,onClose:r,onMinimize:i,onStateChange:a,onOpenInStudio:o,onApplied:c}){let{t:l}=s(`agentstudio`),{activeProjectId:d}=u(),f=zi(d),[p,m]=(0,U.useState)(``),h=(0,U.useRef)(null),g=(0,U.useRef)(!1);(0,U.useEffect)(()=>{g.current||(g.current=!0,n?f.rehydrate(n,e):f.open(e,t))},[e,t,n,f]),(0,U.useEffect)(()=>{let e=setTimeout(()=>h.current?.focus(),50);return()=>clearTimeout(e)},[]);let _=(0,U.useRef)(a);_.current=a,(0,U.useEffect)(()=>{_.current?.({refineId:f.state.refineId??null})},[f.state.refineId]);let v=(0,U.useRef)(null);(0,U.useEffect)(()=>{f.state.uiState===`applied`&&f.state.appliedVersion!==null&&f.state.appliedVersion!==v.current&&(v.current=f.state.appliedVersion,c&&f.state.agentId&&c(f.state.agentId,f.state.appliedVersion))},[f.state.uiState,f.state.appliedVersion,f.state.agentId,c]);let y=(0,U.useCallback)(async e=>{let t=e.trim();t&&(m(``),f.state.refineId?await f.sendTurn(t):await f.start(t))},[f]),b=(0,U.useCallback)(()=>{y(p)},[p,y]),x=(0,U.useCallback)(async()=>{f.state.refineId&&(f.state.uiState===`streaming`||f.state.uiState===`reviewing`)&&await f.cancel(),r()},[f,r]),S=ua(f.state),ee=(0,U.useMemo)(()=>!f.state.draftBody||!f.state.baseBody?null:(0,W.jsx)(na,{hunks:ia(f.state.baseBody,f.state.draftBody)}),[f.state.baseBody,f.state.draftBody]);return(0,W.jsx)(Hi,{uiPhase:S,errorMessage:f.state.errorMessage,applyConflict:f.state.applyConflict,eyebrow:l(`refine.eyebrow`),targetLabel:e,targetLabelMono:!0,headline:l(`refine.headline`),streamingHeadline:l(`refine.streamingHeadline`),description:da(t),chips:ca.map(e=>l(e)),onChipSubmit:e=>void y(e),composer:(0,W.jsx)(oa,{value:p,onChange:m,onSubmit:b,disabled:S===`streaming`||S===`applied`,placeholder:f.state.refineId?l(`refine.placeholderFollowUp`):l(`refine.placeholderInitial`),inputRef:h}),streamingText:f.state.streamingText,history:f.state.history,diff:ee,diffHeaderLabel:`.claude/agents/${e}.md`,baseBody:t,baseBodyDisclosureLabel:l(`refine.viewCurrentBody`),appliedNotice:f.state.appliedVersion===null?void 0:(0,W.jsx)(`div`,{className:`rounded-md border border-green-500/40 aurora-light:border-accent-success/40 bg-green-500/10 aurora-light:bg-accent-success/10 p-3 text-xs text-green-300 aurora-light:text-accent-success`,children:l(`refine.appliedAsVersion`,{version:f.state.appliedVersion})}),canApply:f.state.uiState===`reviewing`&&!!f.state.draftBody&&!f.state.applyConflict,onApply:()=>void f.apply(),onForceApply:()=>void f.apply(!0),onDiscard:()=>void x(),onClose:()=>void x(),onMinimize:i?()=>i(f.state.refineId??null):void 0,secondaryAction:o&&f.state.draftBody&&f.state.refineId?{label:l(`refine.openInStudio`),icon:(0,W.jsx)(C,{className:`w-3 h-3`}),onClick:()=>{f.state.refineId&&f.state.draftBody&&o&&o(f.state.refineId,f.state.draftBody)}}:void 0})}function ua(e){switch(e.uiState){case`streaming`:return`streaming`;case`reviewing`:return`reviewing`;case`applied`:return`applied`;case`error`:return`error`;default:return`composing`}}function da(e){let t=e.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!t)return null;let n=t[1].match(/^description:\s*([\s\S]*?)(?=^[a-z_]+:\s|\Z)/m);if(!n)return null;let r=n[1].trim();return(r.startsWith(`"`)&&r.endsWith(`"`)||r.startsWith(`'`)&&r.endsWith(`'`))&&(r=r.slice(1,-1)),r=r.replace(/\\n/g,` `).replace(/\\t/g,` `).replace(/\\"/g,`"`).replace(/\\'/g,`'`).replace(/\\\\/g,`\\`).replace(/\s+/g,` `).trim(),r.length>240&&(r=r.slice(0,237)+`…`),r||null}function fa(){let{t:e}=s(`agents`),[t,n]=(0,U.useState)([]),[r,i]=(0,U.useState)(null),[a,c]=(0,U.useState)(null),[d,p]=(0,U.useState)(!0),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(null),[b,x]=(0,U.useState)({kind:`closed`}),[C,T]=(0,U.useState)({kind:`closed`}),[E,O]=(0,U.useState)(!1),[k,j]=(0,U.useState)(``),[ie,L]=(0,U.useState)(`all`),[R,oe]=(0,U.useState)(null),[ce,z]=(0,U.useState)(!1),[le,ue]=(0,U.useState)(``),[de,fe]=(0,U.useState)(``),[pe,me]=(0,U.useState)(!1),[he,ge]=(0,U.useState)(null),{activeProjectId:B,projects:ve}=u(),V=ve.find(e=>e.id===B)?.provider??`claude`,H=f(V),{minimize:xe}=v(),Ce=(0,U.useRef)({refineId:null}),we=(0,U.useRef)(C);we.current=C;let Te=(0,U.useCallback)(()=>{let t=we.current;t.kind!==`open`||!t.projectId||xe({kind:`ai-edit`,projectId:t.projectId,label:e(`catalog.aiEditChipLabel`,{agentId:t.agentId}),restoreRoute:`/agents`,params:{agentId:t.agentId,baseBody:t.baseBody,resumeRefineId:Ce.current.refineId??t.resumeRefineId}})},[xe,e]);y(`ai-edit`,B,e=>{e.kind!==`ai-edit`||!H||(Te(),Ce.current={refineId:e.params.resumeRefineId??null},T({kind:`open`,projectId:e.projectId,agentId:e.params.agentId,baseBody:e.params.baseBody,resumeRefineId:e.params.resumeRefineId}))});let Ee=(0,U.useCallback)(()=>{let t=!1;return p(!0),fetch(`${l()}/profiles/catalog?provider=${encodeURIComponent(V)}`).then(t=>{if(!t.ok)throw Error(e(`catalog.errors.loadFailed`,{status:t.status}));return t.json()}).then(e=>{t||(n(e.agents),e.agents.length>0&&!r&&i(e.agents[0].id))}).catch(e=>{t||_(e.message)}).finally(()=>{t||p(!1)}),()=>{t=!0}},[V,r,e]);(0,U.useEffect)(()=>Ee(),[Ee]);let De=(0,U.useCallback)(t=>{let n=!1;return h(!0),c(null),fetch(`${l()}/profiles/catalog/${encodeURIComponent(t)}?provider=${encodeURIComponent(V)}`).then(t=>{if(!t.ok)throw Error(e(`catalog.errors.bodyLoadFailed`,{status:t.status}));return t.json()}).then(e=>{n||c(e.body)}).catch(e=>{n||_(e.message)}).finally(()=>{n||h(!1)}),()=>{n=!0}},[V,e]);if((0,U.useEffect)(()=>{if(r)return De(r)},[r,De]),d)return(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`catalog.loading`)})});if(b.kind!==`closed`)return(0,W.jsx)(Pi,{agentId:b.kind===`edit`?b.agentId:void 0,initialBody:b.kind===`duplicate`||b.kind===`create`?b.initialBody:void 0,initialName:b.kind===`create`?b.initialName:void 0,draftFromRefine:b.kind===`edit`?b.draftFromRefine:void 0,provider:V,defaultModel:be(V),automationEnabled:H,onClose:()=>x({kind:`closed`}),onSaved:e=>{i(e),x({kind:`closed`}),Ee()},onResumeRefine:(e,t,n)=>{x({kind:`closed`}),B&&(Te(),Ce.current={refineId:e},T({kind:`open`,projectId:B,agentId:t,baseBody:n,resumeRefineId:e}))}});if(C.kind===`open`&&H)return(0,W.jsx)(ae,{onClose:()=>T({kind:`closed`}),children:(0,W.jsx)(la,{agentId:C.agentId,baseBody:C.baseBody,resumeRefineId:C.resumeRefineId,onStateChange:e=>{Ce.current=e},onClose:()=>T({kind:`closed`}),onMinimize:t=>{let n=C.kind===`open`?C.projectId:B;if(!n){T({kind:`closed`});return}let r=C.kind===`open`?C.agentId:``,i=C.kind===`open`?C.baseBody:``;xe({kind:`ai-edit`,projectId:n,label:e(`catalog.aiEditChipLabel`,{agentId:r}),restoreRoute:`/agents`,params:{agentId:r,baseBody:i,resumeRefineId:t??void 0}}),T({kind:`closed`})},onApplied:e=>{T({kind:`closed`}),i(e),Ee()},onOpenInStudio:(e,t)=>{T({kind:`closed`}),x({kind:`edit`,agentId:C.agentId,draftFromRefine:e})}},`${C.agentId}:${C.resumeRefineId??`fresh`}`)});let Oe=(()=>{let e=k.trim().toLowerCase();return Oi.filter(t=>!(ie!==`all`&&t.category!==ie||R&&!t.tags.includes(R)||e&&!(t.label+` `+t.blurb+` `+t.tags.join(` `)+` `+t.category).toLowerCase().includes(e)))})(),ke=(()=>{let e=new Map;for(let t of Oi)e.set(t.category,(e.get(t.category)??0)+1);return e})(),Ae=()=>{O(!1),j(``),L(`all`),oe(null)},je=()=>(0,W.jsx)(F,{open:E,onOpenChange:e=>{e||Ae()},children:(0,W.jsxs)(P,{className:`max-w-4xl p-0 h-[85vh] flex flex-col overflow-hidden`,children:[(0,W.jsxs)(`div`,{className:`flex-shrink-0 px-6 pt-5 pb-3 border-b border-border`,children:[(0,W.jsxs)(N,{children:[(0,W.jsxs)(M,{className:`flex items-center gap-2 text-base`,children:[(0,W.jsx)(S,{className:`w-4 h-4 text-accent-primary`}),` `,e(`catalog.templates.title`),(0,W.jsx)(`span`,{className:`text-[11px] font-normal text-muted-foreground ml-1`,children:e(`catalog.templates.countOf`,{shown:Oe.length,total:Oi.length})})]}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:e(`catalog.templates.description`)})]}),(0,W.jsxs)(`div`,{className:`mt-3 relative`,children:[(0,W.jsx)(re,{className:`w-3.5 h-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,W.jsx)(`input`,{value:k,onChange:e=>j(e.target.value),placeholder:e(`catalog.templates.searchPlaceholder`),className:`w-full h-9 pl-8 pr-8 text-sm rounded-md border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary/40`,autoFocus:!0}),k&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>j(``),className:`absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded hover:bg-accent text-muted-foreground`,children:(0,W.jsx)(D,{className:`w-3.5 h-3.5`})})]}),(0,W.jsxs)(`div`,{className:`flex gap-1.5 overflow-x-auto mt-3 pb-1 scrollbar-thin`,children:[(0,W.jsx)(pa,{label:e(`catalog.templates.allCategories`),count:Oi.length,active:ie===`all`,onClick:()=>L(`all`)}),ki.map(e=>(0,W.jsx)(pa,{label:e,count:ke.get(e)??0,active:ie===e,onClick:()=>L(e)},e))]}),R&&(0,W.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,W.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e(`catalog.templates.tagFilter`)}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>oe(null),className:`inline-flex items-center gap-1 text-[11px] px-2 py-0.5 rounded-full bg-accent-primary/20 text-accent-primary hover:bg-accent-primary/30`,children:[(0,W.jsx)(ye,{className:`w-3 h-3`}),` `,R,(0,W.jsx)(D,{className:`w-3 h-3`})]})]})]}),(0,W.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4`,children:Oe.length===0?(0,W.jsx)(`div`,{className:`h-full flex items-center justify-center text-center`,children:(0,W.jsxs)(`div`,{className:`max-w-sm`,children:[(0,W.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e(`catalog.templates.noMatch`)}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{j(``),L(`all`),oe(null)},className:`text-xs text-accent-primary hover:underline mt-2`,children:e(`catalog.templates.clearFilters`)})]})}):(0,W.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:Oe.map(t=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>{Ae(),x({kind:`create`,initialBody:t.body,initialName:t.nameHint})},className:`group text-left p-4 rounded-lg border border-border bg-card/40 hover:border-accent-primary/50 hover:bg-accent/40 hover:shadow-sm transition-all`,children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-3 mb-2`,children:[(0,W.jsx)(`span`,{className:`text-2xl leading-none mt-0.5`,children:t.emoji}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`text-sm font-semibold text-foreground group-hover:text-accent-primary truncate`,children:t.label}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:t.category})]})]}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed line-clamp-2 min-h-[2lh]`,children:t.blurb}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-3`,children:t.tags.slice(0,5).map(e=>(0,W.jsx)(`span`,{role:`button`,tabIndex:0,onClick:t=>{t.stopPropagation(),oe(e)},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),oe(e))},className:`text-[10px] px-1.5 py-0.5 rounded bg-muted/50 text-muted-foreground hover:bg-accent-primary/20 hover:text-accent-primary cursor-pointer transition-colors `+(R===e?`bg-accent-primary/20 text-accent-primary`:``),children:e},e))}),(0,W.jsxs)(`div`,{className:`mt-3 pt-2 border-t border-border/40 flex items-center justify-between`,children:[(0,W.jsx)(`code`,{className:`text-[10px] font-mono text-muted-foreground/70 truncate`,children:t.nameHint}),(0,W.jsx)(`span`,{className:`text-[10px] text-accent-primary opacity-0 group-hover:opacity-100 transition-opacity`,children:e(`catalog.templates.openInStudio`)})]})]},t.id))})}),(0,W.jsxs)(`div`,{className:`flex-shrink-0 px-6 py-3 border-t border-border flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e(`catalog.templates.tip`)}),(0,W.jsx)(I,{variant:`ghost`,size:`sm`,onClick:Ae,children:e(`common:actions.cancel`)})]})]})}),Me=()=>H?(0,W.jsx)(F,{open:ce,onOpenChange:e=>{!e&&!pe&&(z(!1),ge(null))},children:(0,W.jsxs)(P,{className:`max-w-lg`,children:[(0,W.jsx)(N,{children:(0,W.jsxs)(M,{className:`flex items-center gap-2`,children:[(0,W.jsx)(w,{className:`w-4 h-4 text-accent-primary`}),` `,e(`catalog.generate.title`)]})}),(0,W.jsxs)(`div`,{className:`space-y-3 py-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground mb-1`,children:e(`catalog.generate.agentIdLabel`)}),(0,W.jsx)(_e,{value:le,onChange:e=>ue(e.target.value),placeholder:`custom-my-agent`,className:`text-sm font-mono`,disabled:pe}),(0,W.jsx)(`p`,{className:`text-[11px] text-muted-foreground mt-1`,children:(0,W.jsx)(o,{t:e,i18nKey:`catalog.generate.agentIdHint`,components:{code:(0,W.jsx)(`code`,{})}})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground mb-1`,children:e(`catalog.generate.descriptionLabel`)}),(0,W.jsx)(`textarea`,{value:de,onChange:e=>fe(e.target.value),placeholder:e(`catalog.generate.descriptionPlaceholder`),className:`w-full text-sm p-2 rounded border border-border bg-background min-h-[120px] resize-y`,disabled:pe})]}),he&&(0,W.jsx)(`div`,{className:`px-3 py-2 text-xs rounded border border-red-500/30 aurora-light:border-destructive/30 bg-red-500/10 aurora-light:bg-destructive/10 text-red-400 aurora-light:text-destructive`,children:he}),(0,W.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:(0,W.jsx)(o,{t:e,i18nKey:`catalog.generate.note`,components:{code:(0,W.jsx)(`code`,{})}})})]}),(0,W.jsxs)(A,{children:[(0,W.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>z(!1),disabled:pe,children:e(`common:actions.cancel`)}),(0,W.jsx)(I,{size:`sm`,onClick:Ne,disabled:pe||!le.trim()||!de.trim(),children:pe?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ee,{className:`w-3.5 h-3.5 mr-1.5 animate-spin`}),` `,e(`catalog.generate.generating`)]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(w,{className:`w-3.5 h-3.5 mr-1.5`}),` `,e(`catalog.generate.generateButton`)]})})]})]})}):null,Ne=async()=>{if(H){me(!0),ge(null);try{let t=await fetch(`${l()}/profiles/catalog/generate?provider=${encodeURIComponent(V)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:le.trim(),description:de.trim()})});if(!t.ok){let n=await t.json().catch(()=>({}));throw Error(n.error??e(`catalog.errors.generateFailed`,{status:t.status}))}let n=await t.json();z(!1),x({kind:`create`,initialBody:n.draft,initialName:le.trim()})}catch(e){ge(e.message)}finally{me(!1)}}},Pe=async t=>{try{let n=await fetch(`${l()}/profiles/catalog/${encodeURIComponent(t)}?provider=${encodeURIComponent(V)}`);if(!n.ok)throw Error(e(`catalog.errors.agentLoadFailed`,{status:n.status}));let r=await n.json();x({kind:`duplicate`,from:t,initialBody:r.body})}catch(e){_(e.message)}};if(t.length===0)return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,W.jsxs)(`div`,{className:`text-center max-w-sm`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e(`catalog.empty.title`)}),(0,W.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1 mb-4`,children:(0,W.jsx)(o,{t:e,i18nKey:`catalog.empty.body`,values:{command:`npx specrails-core@latest update`},components:{code:(0,W.jsx)(`code`,{className:`text-foreground`})}})}),(0,W.jsxs)(`div`,{className:`flex gap-2 justify-center flex-wrap`,children:[H&&(0,W.jsxs)(I,{size:`sm`,onClick:()=>z(!0),children:[(0,W.jsx)(w,{className:`w-3.5 h-3.5 mr-1.5`}),` `,e(`catalog.actions.generateWithAi`)]}),(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,onClick:()=>O(!0),children:[(0,W.jsx)(S,{className:`w-3.5 h-3.5 mr-1.5`}),` `,e(`catalog.actions.template`)]}),(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,onClick:()=>x({kind:`create`}),children:[(0,W.jsx)(ne,{className:`w-3.5 h-3.5 mr-1.5`}),` `,e(`catalog.actions.blank`)]})]})]})}),je(),Me()]});let Fe=t.filter(e=>e.kind===`upstream`),Ie=t.filter(e=>e.kind===`custom`),G=t.find(e=>e.id===r);return(0,W.jsxs)(W.Fragment,{children:[je(),Me(),(0,W.jsxs)(`div`,{className:`flex h-full`,children:[(0,W.jsxs)(`aside`,{className:`w-72 flex-shrink-0 border-r border-border flex flex-col`,children:[(0,W.jsxs)(`div`,{className:`px-3 py-2 border-b border-border`,children:[(0,W.jsx)(`div`,{className:`text-[11px] text-muted-foreground uppercase tracking-wide mb-1.5`,children:e(`catalog.sidebar.title`)}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted-foreground/70 mb-2`,children:e(`catalog.sidebar.createLabel`)}),(0,W.jsxs)(`div`,{className:`flex gap-1`,children:[(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,className:`flex-1 h-7 text-[11px] px-2`,onClick:()=>O(!0),title:e(`catalog.actions.templateTitle`),children:[(0,W.jsx)(S,{className:`w-3 h-3 mr-1`}),` `,e(`catalog.actions.template`)]}),H&&(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,className:`flex-1 h-7 text-[11px] px-2`,onClick:()=>z(!0),title:e(`catalog.actions.generateWithAi`),children:[(0,W.jsx)(w,{className:`w-3 h-3 mr-1`}),` `,e(`catalog.actions.generate`)]}),(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,className:`flex-1 h-7 text-[11px] px-2`,onClick:()=>x({kind:`create`}),title:e(`catalog.actions.blankTitle`),children:[(0,W.jsx)(ne,{className:`w-3 h-3 mr-1`}),` `,e(`catalog.actions.blank`)]})]})]}),(0,W.jsxs)(`div`,{className:`flex-1 overflow-auto p-2`,children:[(0,W.jsx)(ma,{title:e(`catalog.sections.upstream`,{count:Fe.length}),description:e(`catalog.sections.upstreamDescription`),children:Fe.map(e=>(0,W.jsx)(ha,{agent:e,selected:e.id===r,onSelect:()=>i(e.id)},e.id))}),(0,W.jsx)(ma,{title:e(`catalog.sections.custom`,{count:Ie.length}),description:e(`catalog.sections.customDescription`),children:Ie.length===0?(0,W.jsx)(`div`,{className:`text-[11px] text-muted-foreground px-2 py-2 italic`,children:e(`catalog.sections.noCustomAgents`)}):Ie.map(e=>(0,W.jsx)(ha,{agent:e,selected:e.id===r,onSelect:()=>i(e.id)},e.id))})]})]}),(0,W.jsxs)(`main`,{className:`flex-1 min-w-0 overflow-auto`,children:[g&&(0,W.jsx)(`div`,{className:`m-4 px-3 py-2 text-xs rounded border border-red-500/30 aurora-light:border-destructive/30 bg-red-500/10 aurora-light:bg-destructive/10 text-red-400 aurora-light:text-destructive`,children:g}),G&&(0,W.jsxs)(`div`,{className:`p-6 min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-4 mb-1`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,W.jsx)(`h2`,{className:`text-base font-mono font-semibold`,children:G.id}),(0,W.jsx)(ga,{kind:G.kind}),G.model&&(0,W.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:e(`catalog.detail.defaultModel`,{model:G.model})})]}),G.description&&(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 break-words`,children:G.description})]}),(0,W.jsxs)(`div`,{className:`flex gap-2 flex-shrink-0`,children:[(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,onClick:()=>void Pe(G.id),children:[(0,W.jsx)(se,{className:`w-3.5 h-3.5 mr-1`}),` `,e(`common:actions.duplicate`)]}),G.kind===`custom`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,onClick:()=>x({kind:`edit`,agentId:G.id}),children:[(0,W.jsx)(te,{className:`w-3.5 h-3.5 mr-1`}),` `,e(`common:actions.edit`)]}),H&&(0,W.jsxs)(I,{size:`sm`,onClick:async()=>{if(B)try{let e=await fetch(`${l()}/profiles/catalog/${encodeURIComponent(G.id)}?provider=${encodeURIComponent(V)}`);if(!e.ok)throw Error(`Load failed: ${e.status}`);let t=await e.json();Te(),Ce.current={refineId:null},T({kind:`open`,projectId:B,agentId:G.id,baseBody:t.body})}catch(e){_(e.message)}},title:e(`catalog.detail.aiEditTitle`),children:[(0,W.jsx)(Se,{className:`w-3.5 h-3.5 mr-1`}),` `,e(`catalog.detail.aiEdit`)]})]})]})]}),(0,W.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/30 mt-4 min-w-0 overflow-hidden`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5 border-b border-border`,children:[(0,W.jsx)(`span`,{className:`text-[11px] font-mono text-muted-foreground truncate`,children:Ni(V,G.id)}),(0,W.jsx)(`span`,{className:`text-[10px] text-muted-foreground flex-shrink-0 ml-2`,children:G.kind===`upstream`?e(`catalog.detail.readOnly`):e(`catalog.detail.editableHint`)})]}),(0,W.jsx)(`pre`,{className:`p-4 text-xs font-mono overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:m?e(`common:states.loading`):a??``})]})]})]})]})]})}function pa({label:e,count:t,active:n,onClick:r}){return(0,W.jsxs)(`button`,{type:`button`,onClick:r,className:`flex-shrink-0 inline-flex items-center gap-1 h-7 px-2.5 text-[11px] rounded-full border transition-colors whitespace-nowrap `+(n?`bg-accent-primary/20 border-accent-primary/50 text-accent-primary`:`bg-transparent border-border text-muted-foreground hover:bg-accent/50 hover:text-foreground`),children:[e,(0,W.jsx)(`span`,{className:`text-[9px] px-1 rounded `+(n?`bg-accent-primary/30`:`bg-muted/60`),children:t})]})}function ma({title:e,description:t,children:n}){return(0,W.jsxs)(`div`,{className:`mb-4`,children:[(0,W.jsxs)(`div`,{className:`px-2 pb-1`,children:[(0,W.jsx)(`div`,{className:`text-[11px] font-medium text-muted-foreground uppercase tracking-wide`,children:e}),t&&(0,W.jsx)(`div`,{className:`text-[11px] text-muted-foreground/70 mt-0.5`,children:t})]}),(0,W.jsx)(`div`,{className:`space-y-0.5`,children:n})]})}function ha({agent:e,selected:t,onSelect:n}){return(0,W.jsxs)(`button`,{type:`button`,onClick:n,className:`w-full flex items-center justify-between gap-2 px-2 py-1.5 text-left rounded transition-colors `+(t?`bg-accent text-foreground`:`text-muted-foreground hover:bg-accent/50 hover:text-foreground`),children:[(0,W.jsx)(`span`,{className:`text-sm font-mono truncate`,children:e.id}),(0,W.jsx)(ga,{kind:e.kind})]})}function ga({kind:e}){let{t}=s(`agents`);return(0,W.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 `+(e===`custom`?`bg-purple-500/15 aurora-light:bg-accent-secondary/15 text-purple-400 aurora-light:text-accent-secondary`:`bg-muted text-muted-foreground`),children:t(e===`custom`?`catalog.kind.custom`:`catalog.kind.upstream`)})}var _a=[{days:7},{days:30},{days:90}];function va(){let{t:e}=s(`agents`),[t,n]=(0,U.useState)(null),[r,i]=(0,U.useState)(30),[a,o]=(0,U.useState)(!0);if((0,U.useEffect)(()=>{let e=!1;return o(!0),fetch(`${l()}/profiles/analytics?windowDays=${r}`).then(e=>e.ok?e.json():null).then(t=>{!e&&t&&n(t)}).catch(()=>{}).finally(()=>{e||o(!1)}),()=>{e=!0}},[r]),a&&!t)return null;if(!t||t.rows.length===0)return(0,W.jsxs)(`div`,{className:`mx-6 my-4 rounded-md border border-border bg-muted/20`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:e(`usage.title`)}),(0,W.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e(`usage.subtitleEmpty`)})]}),(0,W.jsx)(`div`,{className:`flex gap-0.5`,children:_a.map(t=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>i(t.days),className:`text-[10px] px-2 py-1 rounded transition-colors `+(r===t.days?`bg-accent text-foreground`:`text-muted-foreground hover:bg-accent/50 hover:text-foreground`),children:e(`usage.windowLabel`,{days:t.days})},t.days))})]}),(0,W.jsx)(`div`,{className:`px-4 py-8 text-xs text-muted-foreground`,children:e(`usage.empty`)})]});let c=Math.max(...t.rows.map(e=>e.jobs),1);return(0,W.jsxs)(`div`,{className:`mx-6 my-4 rounded-md border border-border bg-muted/20`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:e(`usage.title`)}),(0,W.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e(`usage.subtitle`,{count:t.windowDays})})]}),(0,W.jsx)(`div`,{className:`flex gap-0.5`,children:_a.map(t=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>i(t.days),className:`text-[10px] px-2 py-1 rounded transition-colors `+(r===t.days?`bg-accent text-foreground`:`text-muted-foreground hover:bg-accent/50 hover:text-foreground`),children:e(`usage.windowLabel`,{days:t.days})},t.days))})]}),(0,W.jsx)(`div`,{className:`p-4 space-y-2`,children:t.rows.map(t=>(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`div`,{className:`w-32 text-xs font-mono truncate`,children:t.profileName}),(0,W.jsx)(`div`,{className:`flex-1 h-4 bg-muted/50 rounded overflow-hidden`,children:(0,W.jsx)(`div`,{className:`h-full bg-accent-primary/70`,style:{width:`${Math.max(6,Math.round(t.jobs/c*100))}%`}})}),(0,W.jsxs)(`div`,{className:`flex gap-4 text-[11px] text-muted-foreground min-w-0 flex-shrink-0`,children:[(0,W.jsxs)(`span`,{title:e(`usage.jobsTooltip`),children:[(0,W.jsx)(`span`,{className:`text-foreground font-mono`,children:t.jobs}),` `,e(`usage.jobsLabel`,{count:t.jobs})]}),(0,W.jsxs)(`span`,{title:e(`usage.successRateTooltip`),children:[(0,W.jsxs)(`span`,{className:`text-foreground font-mono`,children:[Math.round(t.successRate*100),`%`]}),` `,e(`usage.okSuffix`)]}),t.avgDurationMs!=null&&(0,W.jsx)(`span`,{title:e(`usage.avgDurationTooltip`),children:(0,W.jsx)(`span`,{className:`text-foreground font-mono`,children:ya(t.avgDurationMs)})}),t.avgTokens!=null&&(0,W.jsxs)(`span`,{title:e(`usage.avgTokensTooltip`),children:[(0,W.jsx)(`span`,{className:`text-foreground font-mono`,children:ba(t.avgTokens)}),` `,e(`usage.tokensSuffix`)]})]})]},t.profileName))})]})}function ya(e){let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m`:`${Math.floor(n/60)}h${n%60}m`}function ba(e){return e<1e3?Math.round(e).toString():e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(1)}M`}var xa=`specrails-desktop:agents-tab`;function Sa(){try{let e=localStorage.getItem(xa);if(e===`profiles`||e===`usage`||e===`catalog`)return e}catch{}return`profiles`}function Ca(){let{t:e}=s(`agents`),[t,n]=(0,U.useState)(()=>Sa()),r=e=>{n(e);try{localStorage.setItem(xa,e)}catch{}},[i,a]=(0,U.useState)(null),{activeProjectId:c}=u(),{pendingRestores:d}=v(),f=(0,U.useRef)(!1);return(0,U.useEffect)(()=>{if(!c)return;let e=d.some(e=>e.kind===`ai-edit`&&e.projectId===c);e&&!f.current&&t!==`catalog`&&r(`catalog`),f.current=e},[d,c,t]),(0,U.useEffect)(()=>{let e=!1;return fetch(`${l()}/profiles/core-version`).then(e=>e.ok?e.json():null).then(t=>{!e&&t&&a(t)}).catch(()=>{}),()=>{e=!0}},[]),(0,W.jsxs)(`div`,{className:`flex flex-col h-full`,children:[i!==null&&!i.profileAware&&(0,W.jsxs)(`div`,{className:`flex-shrink-0 flex items-start gap-3 px-6 py-3 border-b border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/10 aurora-light:bg-accent-warning/10`,children:[(0,W.jsx)(E,{className:`w-4 h-4 text-yellow-500 aurora-light:text-accent-warning mt-0.5 flex-shrink-0`}),(0,W.jsxs)(`div`,{className:`text-xs`,children:[(0,W.jsx)(`div`,{className:`font-medium text-yellow-500 aurora-light:text-accent-warning`,children:e(`page.banner.title`,{required:i.required})}),(0,W.jsx)(`div`,{className:`text-yellow-500/80 aurora-light:text-accent-warning mt-0.5`,children:(0,W.jsx)(o,{t:e,i18nKey:`page.banner.body`,values:{version:i.version??e(`page.banner.unknownVersion`),command:`npx specrails-core@latest update`},components:{code:(0,W.jsx)(`code`,{className:`px-1 rounded bg-yellow-500/20 aurora-light:bg-accent-warning/20`})}})})]})]}),(0,W.jsxs)(`div`,{className:`flex-shrink-0 border-b border-border`,children:[(0,W.jsxs)(`div`,{className:`px-6 pt-4`,children:[(0,W.jsx)(`h1`,{className:`text-lg font-semibold`,children:e(`page.title`)}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e(`page.subtitle`)})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-1 px-4 pt-3`,children:[(0,W.jsx)(Ta,{active:t===`profiles`,onClick:()=>r(`profiles`),children:e(`page.tabs.profiles`)}),(0,W.jsx)(Ta,{active:t===`usage`,onClick:()=>r(`usage`),children:e(`page.tabs.usage`)}),(0,W.jsx)(Ta,{active:t===`catalog`,onClick:()=>r(`catalog`),children:e(`page.tabs.catalog`)})]})]}),(0,W.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-auto`,children:[t===`profiles`&&(0,W.jsx)(He,{}),t===`usage`&&(0,W.jsx)(wa,{}),t===`catalog`&&(0,W.jsx)(fa,{})]})]})}function wa(){return(0,W.jsx)(`div`,{className:`min-h-full`,children:(0,W.jsx)(va,{})})}function Ta({active:e,children:t,onClick:n}){return(0,W.jsx)(`button`,{type:`button`,onClick:n,className:`h-8 px-3 text-xs font-medium rounded-t-md border-b-2 transition-colors `+(e?`text-foreground border-foreground`:`text-muted-foreground border-transparent hover:text-foreground hover:border-border`),children:t})}export{Ca as default};
|
|
118
|
+
`});return i}function oa({value:e,onChange:t,onSubmit:n,disabled:r,placeholder:i,autoFocus:a,inputRef:o}){let{t:c}=s(`aiedit`);return(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(`div`,{className:`relative rounded-xl border border-border bg-card/40 focus-within:border-accent-primary/40 focus-within:ring-2 focus-within:ring-accent-primary/20 transition-all`,children:[(0,W.jsx)(`textarea`,{ref:o,value:e,onChange:e=>t(e.target.value),placeholder:i,rows:3,disabled:r,autoFocus:a,className:`w-full text-sm p-3 pr-14 bg-transparent resize-none focus:outline-none disabled:opacity-50 placeholder:text-muted-foreground/60`,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),n())}}),(0,W.jsx)(`button`,{type:`button`,onClick:n,disabled:!e.trim()||r,"aria-label":c(`shell.composer.sendAriaLabel`),className:`absolute bottom-2.5 right-2.5 p-2 rounded-md bg-accent-primary text-white hover:bg-accent-primary/90 disabled:opacity-30 disabled:cursor-not-allowed focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:outline-none transition-opacity`,children:r?(0,W.jsx)(ee,{className:`w-3.5 h-3.5 animate-spin`}):(0,W.jsx)(sa,{})})]}),(0,W.jsx)(`div`,{className:`flex items-center justify-end text-[11px] text-muted-foreground/70`,children:(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`kbd`,{className:`px-1.5 py-0.5 rounded bg-muted/60 text-[10px] font-mono`,children:H(`⌘⏎`)}),` `,c(`shell.composer.kbdSubmit`),(0,W.jsx)(`span`,{className:`mx-1.5`,children:`·`}),(0,W.jsx)(`kbd`,{className:`px-1.5 py-0.5 rounded bg-muted/60 text-[10px] font-mono`,children:`Esc`}),` `,c(`shell.composer.kbdCancel`)]})})]})}function sa(){return(0,W.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`w-3.5 h-3.5`,children:[(0,W.jsx)(`path`,{d:`M22 2 11 13`}),(0,W.jsx)(`path`,{d:`M22 2 15 22l-4-9-9-4Z`})]})}var ca=[`refine.chips.tightenTools`,`refine.chips.stricterPersonality`,`refine.chips.workflowSection`,`refine.chips.sharpenDescription`,`refine.chips.matchDeveloperStyle`];function la({agentId:e,baseBody:t,resumeRefineId:n,onClose:r,onMinimize:i,onStateChange:a,onOpenInStudio:o,onApplied:c}){let{t:l}=s(`agentstudio`),{activeProjectId:d}=u(),f=zi(d),[p,m]=(0,U.useState)(``),h=(0,U.useRef)(null),g=(0,U.useRef)(!1);(0,U.useEffect)(()=>{g.current||(g.current=!0,n?f.rehydrate(n,e):f.open(e,t))},[e,t,n,f]),(0,U.useEffect)(()=>{let e=setTimeout(()=>h.current?.focus(),50);return()=>clearTimeout(e)},[]);let _=(0,U.useRef)(a);_.current=a,(0,U.useEffect)(()=>{_.current?.({refineId:f.state.refineId??null})},[f.state.refineId]);let v=(0,U.useRef)(null);(0,U.useEffect)(()=>{f.state.uiState===`applied`&&f.state.appliedVersion!==null&&f.state.appliedVersion!==v.current&&(v.current=f.state.appliedVersion,c&&f.state.agentId&&c(f.state.agentId,f.state.appliedVersion))},[f.state.uiState,f.state.appliedVersion,f.state.agentId,c]);let y=(0,U.useCallback)(async e=>{let t=e.trim();t&&(m(``),f.state.refineId?await f.sendTurn(t):await f.start(t))},[f]),b=(0,U.useCallback)(()=>{y(p)},[p,y]),x=(0,U.useCallback)(async()=>{f.state.refineId&&(f.state.uiState===`streaming`||f.state.uiState===`reviewing`)&&await f.cancel(),r()},[f,r]),S=ua(f.state),ee=(0,U.useMemo)(()=>!f.state.draftBody||!f.state.baseBody?null:(0,W.jsx)(na,{hunks:ia(f.state.baseBody,f.state.draftBody)}),[f.state.baseBody,f.state.draftBody]);return(0,W.jsx)(Hi,{uiPhase:S,errorMessage:f.state.errorMessage,applyConflict:f.state.applyConflict,eyebrow:l(`refine.eyebrow`),targetLabel:e,targetLabelMono:!0,headline:l(`refine.headline`),streamingHeadline:l(`refine.streamingHeadline`),description:da(t),chips:ca.map(e=>l(e)),onChipSubmit:e=>void y(e),composer:(0,W.jsx)(oa,{value:p,onChange:m,onSubmit:b,disabled:S===`streaming`||S===`applied`,placeholder:f.state.refineId?l(`refine.placeholderFollowUp`):l(`refine.placeholderInitial`),inputRef:h}),streamingText:f.state.streamingText,history:f.state.history,diff:ee,diffHeaderLabel:`.claude/agents/${e}.md`,baseBody:t,baseBodyDisclosureLabel:l(`refine.viewCurrentBody`),appliedNotice:f.state.appliedVersion===null?void 0:(0,W.jsx)(`div`,{className:`rounded-md border border-green-500/40 aurora-light:border-accent-success/40 bg-green-500/10 aurora-light:bg-accent-success/10 p-3 text-xs text-green-300 aurora-light:text-accent-success`,children:l(`refine.appliedAsVersion`,{version:f.state.appliedVersion})}),canApply:f.state.uiState===`reviewing`&&!!f.state.draftBody&&!f.state.applyConflict,onApply:()=>void f.apply(),onForceApply:()=>void f.apply(!0),onDiscard:()=>void x(),onClose:()=>void x(),onMinimize:i?()=>i(f.state.refineId??null):void 0,secondaryAction:o&&f.state.draftBody&&f.state.refineId?{label:l(`refine.openInStudio`),icon:(0,W.jsx)(C,{className:`w-3 h-3`}),onClick:()=>{f.state.refineId&&f.state.draftBody&&o&&o(f.state.refineId,f.state.draftBody)}}:void 0})}function ua(e){switch(e.uiState){case`streaming`:return`streaming`;case`reviewing`:return`reviewing`;case`applied`:return`applied`;case`error`:return`error`;default:return`composing`}}function da(e){let t=e.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!t)return null;let n=t[1].match(/^description:\s*([\s\S]*?)(?=^[a-z_]+:\s|\Z)/m);if(!n)return null;let r=n[1].trim();return(r.startsWith(`"`)&&r.endsWith(`"`)||r.startsWith(`'`)&&r.endsWith(`'`))&&(r=r.slice(1,-1)),r=r.replace(/\\n/g,` `).replace(/\\t/g,` `).replace(/\\"/g,`"`).replace(/\\'/g,`'`).replace(/\\\\/g,`\\`).replace(/\s+/g,` `).trim(),r.length>240&&(r=r.slice(0,237)+`…`),r||null}function fa(){let{t:e}=s(`agents`),[t,n]=(0,U.useState)([]),[r,i]=(0,U.useState)(null),[a,c]=(0,U.useState)(null),[d,p]=(0,U.useState)(!0),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(null),[b,x]=(0,U.useState)({kind:`closed`}),[C,T]=(0,U.useState)({kind:`closed`}),[E,O]=(0,U.useState)(!1),[k,j]=(0,U.useState)(``),[ie,L]=(0,U.useState)(`all`),[R,oe]=(0,U.useState)(null),[ce,z]=(0,U.useState)(!1),[le,ue]=(0,U.useState)(``),[de,fe]=(0,U.useState)(``),[pe,me]=(0,U.useState)(!1),[he,ge]=(0,U.useState)(null),{activeProjectId:B,projects:ve}=u(),V=ve.find(e=>e.id===B)?.provider??`claude`,H=f(V),{minimize:xe}=v(),Ce=(0,U.useRef)({refineId:null}),we=(0,U.useRef)(C);we.current=C;let Te=(0,U.useCallback)(()=>{let t=we.current;t.kind!==`open`||!t.projectId||xe({kind:`ai-edit`,projectId:t.projectId,label:e(`catalog.aiEditChipLabel`,{agentId:t.agentId}),restoreRoute:`/agents`,params:{agentId:t.agentId,baseBody:t.baseBody,resumeRefineId:Ce.current.refineId??t.resumeRefineId}})},[xe,e]);y(`ai-edit`,B,e=>{e.kind!==`ai-edit`||!H||(Te(),Ce.current={refineId:e.params.resumeRefineId??null},T({kind:`open`,projectId:e.projectId,agentId:e.params.agentId,baseBody:e.params.baseBody,resumeRefineId:e.params.resumeRefineId}))});let Ee=(0,U.useCallback)(()=>{let t=!1;return p(!0),fetch(`${l()}/profiles/catalog?provider=${encodeURIComponent(V)}`).then(t=>{if(!t.ok)throw Error(e(`catalog.errors.loadFailed`,{status:t.status}));return t.json()}).then(e=>{t||(n(e.agents),e.agents.length>0&&!r&&i(e.agents[0].id))}).catch(e=>{t||_(e.message)}).finally(()=>{t||p(!1)}),()=>{t=!0}},[V,r,e]);(0,U.useEffect)(()=>Ee(),[Ee]);let De=(0,U.useCallback)(t=>{let n=!1;return h(!0),c(null),fetch(`${l()}/profiles/catalog/${encodeURIComponent(t)}?provider=${encodeURIComponent(V)}`).then(t=>{if(!t.ok)throw Error(e(`catalog.errors.bodyLoadFailed`,{status:t.status}));return t.json()}).then(e=>{n||c(e.body)}).catch(e=>{n||_(e.message)}).finally(()=>{n||h(!1)}),()=>{n=!0}},[V,e]);if((0,U.useEffect)(()=>{if(!r)return;let e=t.find(e=>e.id===r&&e.kind===`upstream`);if(e){h(!1),c(e.body??``);return}return De(r)},[r,De,t]),d)return(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`catalog.loading`)})});if(b.kind!==`closed`)return(0,W.jsx)(Pi,{agentId:b.kind===`edit`?b.agentId:void 0,initialBody:b.kind===`duplicate`||b.kind===`create`?b.initialBody:void 0,initialName:b.kind===`create`?b.initialName:void 0,draftFromRefine:b.kind===`edit`?b.draftFromRefine:void 0,provider:V,defaultModel:be(V),automationEnabled:H,onClose:()=>x({kind:`closed`}),onSaved:e=>{i(e),x({kind:`closed`}),Ee()},onResumeRefine:(e,t,n)=>{x({kind:`closed`}),B&&(Te(),Ce.current={refineId:e},T({kind:`open`,projectId:B,agentId:t,baseBody:n,resumeRefineId:e}))}});if(C.kind===`open`&&H)return(0,W.jsx)(ae,{onClose:()=>T({kind:`closed`}),children:(0,W.jsx)(la,{agentId:C.agentId,baseBody:C.baseBody,resumeRefineId:C.resumeRefineId,onStateChange:e=>{Ce.current=e},onClose:()=>T({kind:`closed`}),onMinimize:t=>{let n=C.kind===`open`?C.projectId:B;if(!n){T({kind:`closed`});return}let r=C.kind===`open`?C.agentId:``,i=C.kind===`open`?C.baseBody:``;xe({kind:`ai-edit`,projectId:n,label:e(`catalog.aiEditChipLabel`,{agentId:r}),restoreRoute:`/agents`,params:{agentId:r,baseBody:i,resumeRefineId:t??void 0}}),T({kind:`closed`})},onApplied:e=>{T({kind:`closed`}),i(e),Ee()},onOpenInStudio:(e,t)=>{T({kind:`closed`}),x({kind:`edit`,agentId:C.agentId,draftFromRefine:e})}},`${C.agentId}:${C.resumeRefineId??`fresh`}`)});let Oe=(()=>{let e=k.trim().toLowerCase();return Oi.filter(t=>!(ie!==`all`&&t.category!==ie||R&&!t.tags.includes(R)||e&&!(t.label+` `+t.blurb+` `+t.tags.join(` `)+` `+t.category).toLowerCase().includes(e)))})(),ke=(()=>{let e=new Map;for(let t of Oi)e.set(t.category,(e.get(t.category)??0)+1);return e})(),Ae=()=>{O(!1),j(``),L(`all`),oe(null)},je=()=>(0,W.jsx)(F,{open:E,onOpenChange:e=>{e||Ae()},children:(0,W.jsxs)(P,{className:`max-w-4xl p-0 h-[85vh] flex flex-col overflow-hidden`,children:[(0,W.jsxs)(`div`,{className:`flex-shrink-0 px-6 pt-5 pb-3 border-b border-border`,children:[(0,W.jsxs)(N,{children:[(0,W.jsxs)(M,{className:`flex items-center gap-2 text-base`,children:[(0,W.jsx)(S,{className:`w-4 h-4 text-accent-primary`}),` `,e(`catalog.templates.title`),(0,W.jsx)(`span`,{className:`text-[11px] font-normal text-muted-foreground ml-1`,children:e(`catalog.templates.countOf`,{shown:Oe.length,total:Oi.length})})]}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:e(`catalog.templates.description`)})]}),(0,W.jsxs)(`div`,{className:`mt-3 relative`,children:[(0,W.jsx)(re,{className:`w-3.5 h-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,W.jsx)(`input`,{value:k,onChange:e=>j(e.target.value),placeholder:e(`catalog.templates.searchPlaceholder`),className:`w-full h-9 pl-8 pr-8 text-sm rounded-md border border-border bg-background focus:outline-none focus:ring-1 focus:ring-primary/40`,autoFocus:!0}),k&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>j(``),className:`absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded hover:bg-accent text-muted-foreground`,children:(0,W.jsx)(D,{className:`w-3.5 h-3.5`})})]}),(0,W.jsxs)(`div`,{className:`flex gap-1.5 overflow-x-auto mt-3 pb-1 scrollbar-thin`,children:[(0,W.jsx)(pa,{label:e(`catalog.templates.allCategories`),count:Oi.length,active:ie===`all`,onClick:()=>L(`all`)}),ki.map(e=>(0,W.jsx)(pa,{label:e,count:ke.get(e)??0,active:ie===e,onClick:()=>L(e)},e))]}),R&&(0,W.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,W.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e(`catalog.templates.tagFilter`)}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>oe(null),className:`inline-flex items-center gap-1 text-[11px] px-2 py-0.5 rounded-full bg-accent-primary/20 text-accent-primary hover:bg-accent-primary/30`,children:[(0,W.jsx)(ye,{className:`w-3 h-3`}),` `,R,(0,W.jsx)(D,{className:`w-3 h-3`})]})]})]}),(0,W.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4`,children:Oe.length===0?(0,W.jsx)(`div`,{className:`h-full flex items-center justify-center text-center`,children:(0,W.jsxs)(`div`,{className:`max-w-sm`,children:[(0,W.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e(`catalog.templates.noMatch`)}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{j(``),L(`all`),oe(null)},className:`text-xs text-accent-primary hover:underline mt-2`,children:e(`catalog.templates.clearFilters`)})]})}):(0,W.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:Oe.map(t=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>{Ae(),x({kind:`create`,initialBody:t.body,initialName:t.nameHint})},className:`group text-left p-4 rounded-lg border border-border bg-card/40 hover:border-accent-primary/50 hover:bg-accent/40 hover:shadow-sm transition-all`,children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-3 mb-2`,children:[(0,W.jsx)(`span`,{className:`text-2xl leading-none mt-0.5`,children:t.emoji}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`text-sm font-semibold text-foreground group-hover:text-accent-primary truncate`,children:t.label}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:t.category})]})]}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed line-clamp-2 min-h-[2lh]`,children:t.blurb}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-3`,children:t.tags.slice(0,5).map(e=>(0,W.jsx)(`span`,{role:`button`,tabIndex:0,onClick:t=>{t.stopPropagation(),oe(e)},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),oe(e))},className:`text-[10px] px-1.5 py-0.5 rounded bg-muted/50 text-muted-foreground hover:bg-accent-primary/20 hover:text-accent-primary cursor-pointer transition-colors `+(R===e?`bg-accent-primary/20 text-accent-primary`:``),children:e},e))}),(0,W.jsxs)(`div`,{className:`mt-3 pt-2 border-t border-border/40 flex items-center justify-between`,children:[(0,W.jsx)(`code`,{className:`text-[10px] font-mono text-muted-foreground/70 truncate`,children:t.nameHint}),(0,W.jsx)(`span`,{className:`text-[10px] text-accent-primary opacity-0 group-hover:opacity-100 transition-opacity`,children:e(`catalog.templates.openInStudio`)})]})]},t.id))})}),(0,W.jsxs)(`div`,{className:`flex-shrink-0 px-6 py-3 border-t border-border flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e(`catalog.templates.tip`)}),(0,W.jsx)(I,{variant:`ghost`,size:`sm`,onClick:Ae,children:e(`common:actions.cancel`)})]})]})}),Me=()=>H?(0,W.jsx)(F,{open:ce,onOpenChange:e=>{!e&&!pe&&(z(!1),ge(null))},children:(0,W.jsxs)(P,{className:`max-w-lg`,children:[(0,W.jsx)(N,{children:(0,W.jsxs)(M,{className:`flex items-center gap-2`,children:[(0,W.jsx)(w,{className:`w-4 h-4 text-accent-primary`}),` `,e(`catalog.generate.title`)]})}),(0,W.jsxs)(`div`,{className:`space-y-3 py-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground mb-1`,children:e(`catalog.generate.agentIdLabel`)}),(0,W.jsx)(_e,{value:le,onChange:e=>ue(e.target.value),placeholder:`custom-my-agent`,className:`text-sm font-mono`,disabled:pe}),(0,W.jsx)(`p`,{className:`text-[11px] text-muted-foreground mt-1`,children:(0,W.jsx)(o,{t:e,i18nKey:`catalog.generate.agentIdHint`,components:{code:(0,W.jsx)(`code`,{})}})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground mb-1`,children:e(`catalog.generate.descriptionLabel`)}),(0,W.jsx)(`textarea`,{value:de,onChange:e=>fe(e.target.value),placeholder:e(`catalog.generate.descriptionPlaceholder`),className:`w-full text-sm p-2 rounded border border-border bg-background min-h-[120px] resize-y`,disabled:pe})]}),he&&(0,W.jsx)(`div`,{className:`px-3 py-2 text-xs rounded border border-red-500/30 aurora-light:border-destructive/30 bg-red-500/10 aurora-light:bg-destructive/10 text-red-400 aurora-light:text-destructive`,children:he}),(0,W.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:(0,W.jsx)(o,{t:e,i18nKey:`catalog.generate.note`,components:{code:(0,W.jsx)(`code`,{})}})})]}),(0,W.jsxs)(A,{children:[(0,W.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>z(!1),disabled:pe,children:e(`common:actions.cancel`)}),(0,W.jsx)(I,{size:`sm`,onClick:Ne,disabled:pe||!le.trim()||!de.trim(),children:pe?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ee,{className:`w-3.5 h-3.5 mr-1.5 animate-spin`}),` `,e(`catalog.generate.generating`)]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(w,{className:`w-3.5 h-3.5 mr-1.5`}),` `,e(`catalog.generate.generateButton`)]})})]})]})}):null,Ne=async()=>{if(H){me(!0),ge(null);try{let t=await fetch(`${l()}/profiles/catalog/generate?provider=${encodeURIComponent(V)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:le.trim(),description:de.trim()})});if(!t.ok){let n=await t.json().catch(()=>({}));throw Error(n.error??e(`catalog.errors.generateFailed`,{status:t.status}))}let n=await t.json();z(!1),x({kind:`create`,initialBody:n.draft,initialName:le.trim()})}catch(e){ge(e.message)}finally{me(!1)}}},Pe=async t=>{try{let n=await fetch(`${l()}/profiles/catalog/${encodeURIComponent(t)}?provider=${encodeURIComponent(V)}`);if(!n.ok)throw Error(e(`catalog.errors.agentLoadFailed`,{status:n.status}));let r=await n.json();x({kind:`duplicate`,from:t,initialBody:r.body})}catch(e){_(e.message)}};if(t.length===0)return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,W.jsxs)(`div`,{className:`text-center max-w-sm`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e(`catalog.empty.title`)}),(0,W.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1 mb-4`,children:(0,W.jsx)(o,{t:e,i18nKey:`catalog.empty.body`,components:{code:(0,W.jsx)(`code`,{className:`text-foreground`})}})}),(0,W.jsxs)(`div`,{className:`flex gap-2 justify-center flex-wrap`,children:[H&&(0,W.jsxs)(I,{size:`sm`,onClick:()=>z(!0),children:[(0,W.jsx)(w,{className:`w-3.5 h-3.5 mr-1.5`}),` `,e(`catalog.actions.generateWithAi`)]}),(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,onClick:()=>O(!0),children:[(0,W.jsx)(S,{className:`w-3.5 h-3.5 mr-1.5`}),` `,e(`catalog.actions.template`)]}),(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,onClick:()=>x({kind:`create`}),children:[(0,W.jsx)(ne,{className:`w-3.5 h-3.5 mr-1.5`}),` `,e(`catalog.actions.blank`)]})]})]})}),je(),Me()]});let Fe=t.filter(e=>e.kind===`upstream`),Ie=t.filter(e=>e.kind===`custom`),G=t.find(e=>e.id===r);return(0,W.jsxs)(W.Fragment,{children:[je(),Me(),(0,W.jsxs)(`div`,{className:`flex h-full`,children:[(0,W.jsxs)(`aside`,{className:`w-72 flex-shrink-0 border-r border-border flex flex-col`,children:[(0,W.jsxs)(`div`,{className:`px-3 py-2 border-b border-border`,children:[(0,W.jsx)(`div`,{className:`text-[11px] text-muted-foreground uppercase tracking-wide mb-1.5`,children:e(`catalog.sidebar.title`)}),(0,W.jsx)(`div`,{className:`text-[10px] text-muted-foreground/70 mb-2`,children:e(`catalog.sidebar.createLabel`)}),(0,W.jsxs)(`div`,{className:`flex gap-1`,children:[(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,className:`flex-1 h-7 text-[11px] px-2`,onClick:()=>O(!0),title:e(`catalog.actions.templateTitle`),children:[(0,W.jsx)(S,{className:`w-3 h-3 mr-1`}),` `,e(`catalog.actions.template`)]}),H&&(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,className:`flex-1 h-7 text-[11px] px-2`,onClick:()=>z(!0),title:e(`catalog.actions.generateWithAi`),children:[(0,W.jsx)(w,{className:`w-3 h-3 mr-1`}),` `,e(`catalog.actions.generate`)]}),(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,className:`flex-1 h-7 text-[11px] px-2`,onClick:()=>x({kind:`create`}),title:e(`catalog.actions.blankTitle`),children:[(0,W.jsx)(ne,{className:`w-3 h-3 mr-1`}),` `,e(`catalog.actions.blank`)]})]})]}),(0,W.jsxs)(`div`,{className:`flex-1 overflow-auto p-2`,children:[(0,W.jsx)(ma,{title:e(`catalog.sections.upstream`,{count:Fe.length}),description:e(`catalog.sections.upstreamDescription`),children:Fe.map(e=>(0,W.jsx)(ha,{agent:e,selected:e.id===r,onSelect:()=>i(e.id)},e.id))}),(0,W.jsx)(ma,{title:e(`catalog.sections.custom`,{count:Ie.length}),description:e(`catalog.sections.customDescription`),children:Ie.length===0?(0,W.jsx)(`div`,{className:`text-[11px] text-muted-foreground px-2 py-2 italic`,children:e(`catalog.sections.noCustomAgents`)}):Ie.map(e=>(0,W.jsx)(ha,{agent:e,selected:e.id===r,onSelect:()=>i(e.id)},e.id))})]})]}),(0,W.jsxs)(`main`,{className:`flex-1 min-w-0 overflow-auto`,children:[g&&(0,W.jsx)(`div`,{className:`m-4 px-3 py-2 text-xs rounded border border-red-500/30 aurora-light:border-destructive/30 bg-red-500/10 aurora-light:bg-destructive/10 text-red-400 aurora-light:text-destructive`,children:g}),G&&(0,W.jsxs)(`div`,{className:`p-6 min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-4 mb-1`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,W.jsx)(`h2`,{className:`text-base font-mono font-semibold`,children:G.id}),(0,W.jsx)(ga,{kind:G.kind}),G.model&&(0,W.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:e(`catalog.detail.defaultModel`,{model:G.model})})]}),G.description&&(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 break-words`,children:G.description}),G.runtimeRoleError&&(0,W.jsx)(`p`,{className:`text-xs text-red-400 aurora-light:text-destructive mt-1 break-words`,children:G.runtimeRoleError})]}),(0,W.jsxs)(`div`,{className:`flex gap-2 flex-shrink-0`,children:[(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,onClick:()=>void Pe(G.id),children:[(0,W.jsx)(se,{className:`w-3.5 h-3.5 mr-1`}),` `,e(`common:actions.duplicate`)]}),G.kind===`custom`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(I,{size:`sm`,variant:`ghost`,onClick:()=>x({kind:`edit`,agentId:G.id}),children:[(0,W.jsx)(te,{className:`w-3.5 h-3.5 mr-1`}),` `,e(`common:actions.edit`)]}),H&&(0,W.jsxs)(I,{size:`sm`,onClick:async()=>{if(B)try{let e=await fetch(`${l()}/profiles/catalog/${encodeURIComponent(G.id)}?provider=${encodeURIComponent(V)}`);if(!e.ok)throw Error(`Load failed: ${e.status}`);let t=await e.json();Te(),Ce.current={refineId:null},T({kind:`open`,projectId:B,agentId:G.id,baseBody:t.body})}catch(e){_(e.message)}},title:e(`catalog.detail.aiEditTitle`),children:[(0,W.jsx)(Se,{className:`w-3.5 h-3.5 mr-1`}),` `,e(`catalog.detail.aiEdit`)]})]})]})]}),(0,W.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/30 mt-4 min-w-0 overflow-hidden`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5 border-b border-border`,children:[(0,W.jsx)(`span`,{className:`text-[11px] font-mono text-muted-foreground truncate`,children:G.kind===`upstream`?e(`catalog.detail.runtimeDefinition`):Ni(V,G.id)}),(0,W.jsx)(`span`,{className:`text-[10px] text-muted-foreground flex-shrink-0 ml-2`,children:G.kind===`upstream`?e(`catalog.detail.readOnly`):e(`catalog.detail.editableHint`)})]}),(0,W.jsx)(`pre`,{className:`p-4 text-xs font-mono overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:m?e(`common:states.loading`):a??``})]})]})]})]})]})}function pa({label:e,count:t,active:n,onClick:r}){return(0,W.jsxs)(`button`,{type:`button`,onClick:r,className:`flex-shrink-0 inline-flex items-center gap-1 h-7 px-2.5 text-[11px] rounded-full border transition-colors whitespace-nowrap `+(n?`bg-accent-primary/20 border-accent-primary/50 text-accent-primary`:`bg-transparent border-border text-muted-foreground hover:bg-accent/50 hover:text-foreground`),children:[e,(0,W.jsx)(`span`,{className:`text-[9px] px-1 rounded `+(n?`bg-accent-primary/30`:`bg-muted/60`),children:t})]})}function ma({title:e,description:t,children:n}){return(0,W.jsxs)(`div`,{className:`mb-4`,children:[(0,W.jsxs)(`div`,{className:`px-2 pb-1`,children:[(0,W.jsx)(`div`,{className:`text-[11px] font-medium text-muted-foreground uppercase tracking-wide`,children:e}),t&&(0,W.jsx)(`div`,{className:`text-[11px] text-muted-foreground/70 mt-0.5`,children:t})]}),(0,W.jsx)(`div`,{className:`space-y-0.5`,children:n})]})}function ha({agent:e,selected:t,onSelect:n}){return(0,W.jsxs)(`button`,{type:`button`,onClick:n,className:`w-full flex items-center justify-between gap-2 px-2 py-1.5 text-left rounded transition-colors `+(t?`bg-accent text-foreground`:`text-muted-foreground hover:bg-accent/50 hover:text-foreground`),children:[(0,W.jsx)(`span`,{className:`text-sm font-mono truncate`,children:e.id}),(0,W.jsx)(ga,{kind:e.kind})]})}function ga({kind:e}){let{t}=s(`agents`);return(0,W.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 `+(e===`custom`?`bg-purple-500/15 aurora-light:bg-accent-secondary/15 text-purple-400 aurora-light:text-accent-secondary`:`bg-muted text-muted-foreground`),children:t(e===`custom`?`catalog.kind.custom`:`catalog.kind.upstream`)})}var _a=[{days:7},{days:30},{days:90}];function va(){let{t:e}=s(`agents`),[t,n]=(0,U.useState)(null),[r,i]=(0,U.useState)(30),[a,o]=(0,U.useState)(!0);if((0,U.useEffect)(()=>{let e=!1;return o(!0),fetch(`${l()}/profiles/analytics?windowDays=${r}`).then(e=>e.ok?e.json():null).then(t=>{!e&&t&&n(t)}).catch(()=>{}).finally(()=>{e||o(!1)}),()=>{e=!0}},[r]),a&&!t)return null;if(!t||t.rows.length===0)return(0,W.jsxs)(`div`,{className:`mx-6 my-4 rounded-md border border-border bg-muted/20`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:e(`usage.title`)}),(0,W.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e(`usage.subtitleEmpty`)})]}),(0,W.jsx)(`div`,{className:`flex gap-0.5`,children:_a.map(t=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>i(t.days),className:`text-[10px] px-2 py-1 rounded transition-colors `+(r===t.days?`bg-accent text-foreground`:`text-muted-foreground hover:bg-accent/50 hover:text-foreground`),children:e(`usage.windowLabel`,{days:t.days})},t.days))})]}),(0,W.jsx)(`div`,{className:`px-4 py-8 text-xs text-muted-foreground`,children:e(`usage.empty`)})]});let c=Math.max(...t.rows.map(e=>e.jobs),1);return(0,W.jsxs)(`div`,{className:`mx-6 my-4 rounded-md border border-border bg-muted/20`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:e(`usage.title`)}),(0,W.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e(`usage.subtitle`,{count:t.windowDays})})]}),(0,W.jsx)(`div`,{className:`flex gap-0.5`,children:_a.map(t=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>i(t.days),className:`text-[10px] px-2 py-1 rounded transition-colors `+(r===t.days?`bg-accent text-foreground`:`text-muted-foreground hover:bg-accent/50 hover:text-foreground`),children:e(`usage.windowLabel`,{days:t.days})},t.days))})]}),(0,W.jsx)(`div`,{className:`p-4 space-y-2`,children:t.rows.map(t=>(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`div`,{className:`w-32 text-xs font-mono truncate`,children:t.profileName}),(0,W.jsx)(`div`,{className:`flex-1 h-4 bg-muted/50 rounded overflow-hidden`,children:(0,W.jsx)(`div`,{className:`h-full bg-accent-primary/70`,style:{width:`${Math.max(6,Math.round(t.jobs/c*100))}%`}})}),(0,W.jsxs)(`div`,{className:`flex gap-4 text-[11px] text-muted-foreground min-w-0 flex-shrink-0`,children:[(0,W.jsxs)(`span`,{title:e(`usage.jobsTooltip`),children:[(0,W.jsx)(`span`,{className:`text-foreground font-mono`,children:t.jobs}),` `,e(`usage.jobsLabel`,{count:t.jobs})]}),(0,W.jsxs)(`span`,{title:e(`usage.successRateTooltip`),children:[(0,W.jsxs)(`span`,{className:`text-foreground font-mono`,children:[Math.round(t.successRate*100),`%`]}),` `,e(`usage.okSuffix`)]}),t.avgDurationMs!=null&&(0,W.jsx)(`span`,{title:e(`usage.avgDurationTooltip`),children:(0,W.jsx)(`span`,{className:`text-foreground font-mono`,children:ya(t.avgDurationMs)})}),t.avgTokens!=null&&(0,W.jsxs)(`span`,{title:e(`usage.avgTokensTooltip`),children:[(0,W.jsx)(`span`,{className:`text-foreground font-mono`,children:ba(t.avgTokens)}),` `,e(`usage.tokensSuffix`)]})]})]},t.profileName))})]})}function ya(e){let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m`:`${Math.floor(n/60)}h${n%60}m`}function ba(e){return e<1e3?Math.round(e).toString():e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(1)}M`}var xa=`specrails-desktop:agents-tab`;function Sa(){try{let e=localStorage.getItem(xa);if(e===`profiles`||e===`usage`||e===`catalog`)return e}catch{}return`profiles`}function Ca(){let{t:e}=s(`agents`),[t,n]=(0,U.useState)(()=>Sa()),r=e=>{n(e);try{localStorage.setItem(xa,e)}catch{}},[i,a]=(0,U.useState)(null),{activeProjectId:c}=u(),{pendingRestores:d}=v(),f=(0,U.useRef)(!1);return(0,U.useEffect)(()=>{if(!c)return;let e=d.some(e=>e.kind===`ai-edit`&&e.projectId===c);e&&!f.current&&t!==`catalog`&&r(`catalog`),f.current=e},[d,c,t]),(0,U.useEffect)(()=>{let e=!1;return fetch(`${l()}/profiles/core-version`).then(e=>e.ok?e.json():null).then(t=>{!e&&t&&a(t)}).catch(()=>{}),()=>{e=!0}},[]),(0,W.jsxs)(`div`,{className:`flex flex-col h-full`,children:[i!==null&&!i.profileAware&&(0,W.jsxs)(`div`,{className:`flex-shrink-0 flex items-start gap-3 px-6 py-3 border-b border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/10 aurora-light:bg-accent-warning/10`,children:[(0,W.jsx)(E,{className:`w-4 h-4 text-yellow-500 aurora-light:text-accent-warning mt-0.5 flex-shrink-0`}),(0,W.jsxs)(`div`,{className:`text-xs`,children:[(0,W.jsx)(`div`,{className:`font-medium text-yellow-500 aurora-light:text-accent-warning`,children:e(`page.banner.title`,{required:i.required})}),(0,W.jsx)(`div`,{className:`text-yellow-500/80 aurora-light:text-accent-warning mt-0.5`,children:(0,W.jsx)(o,{t:e,i18nKey:`page.banner.body`,values:{version:i.version??e(`page.banner.unknownVersion`),command:`npx specrails-core@latest update`},components:{code:(0,W.jsx)(`code`,{className:`px-1 rounded bg-yellow-500/20 aurora-light:bg-accent-warning/20`})}})})]})]}),(0,W.jsxs)(`div`,{className:`flex-shrink-0 border-b border-border`,children:[(0,W.jsxs)(`div`,{className:`px-6 pt-4`,children:[(0,W.jsx)(`h1`,{className:`text-lg font-semibold`,children:e(`page.title`)}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e(`page.subtitle`)})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-1 px-4 pt-3`,children:[(0,W.jsx)(Ta,{active:t===`profiles`,onClick:()=>r(`profiles`),children:e(`page.tabs.profiles`)}),(0,W.jsx)(Ta,{active:t===`usage`,onClick:()=>r(`usage`),children:e(`page.tabs.usage`)}),(0,W.jsx)(Ta,{active:t===`catalog`,onClick:()=>r(`catalog`),children:e(`page.tabs.catalog`)})]})]}),(0,W.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-auto`,children:[t===`profiles`&&(0,W.jsx)(He,{}),t===`usage`&&(0,W.jsx)(wa,{}),t===`catalog`&&(0,W.jsx)(fa,{})]})]})}function wa(){return(0,W.jsx)(`div`,{className:`min-h-full`,children:(0,W.jsx)(va,{})})}function Ta({active:e,children:t,onClick:n}){return(0,W.jsx)(`button`,{type:`button`,onClick:n,className:`h-8 px-3 text-xs font-medium rounded-t-md border-b-2 transition-colors `+(e?`text-foreground border-foreground`:`text-muted-foreground border-transparent hover:text-foreground hover:border-border`),children:t})}export{Ca as default};
|