@wrongstack/webui 0.285.0 → 0.286.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/dist/App.d.ts.map +1 -1
- package/dist/assets/{AnalyticsDashboard-Bn2wIgV0.js → AnalyticsDashboard-BDpQqHtX.js} +1 -1
- package/dist/assets/AutoPhaseView-BL_RSAcj.js +1 -0
- package/dist/assets/{ChangesView-C_r4kccO.js → ChangesView-Dqfa8YFA.js} +1 -1
- package/dist/assets/{CodeEditor-DSpqZ-mS.js → CodeEditor-De8voGEi.js} +1 -1
- package/dist/assets/DebugDashboard-D0C8_NWJ.js +1 -0
- package/dist/assets/{DesignGalleryView-Bk3HH3al.js → DesignGalleryView-Dwn2JYAL.js} +1 -1
- package/dist/assets/KanbanView-BUugea4e.js +1 -0
- package/dist/assets/MailboxDetailView-DCjSrQNI.js +1 -0
- package/dist/assets/OfficeMapPanel-Bqqys7xo.js +4 -0
- package/dist/assets/{ProcessMonitor-dUyYv3Z4.js → ProcessMonitor-CS1LSf39.js} +1 -1
- package/dist/assets/{QueuePanel-BdwvWRuB.js → QueuePanel-Cs7k3M-4.js} +1 -1
- package/dist/assets/{RefreshDebugView-eZwtZXgZ.js → RefreshDebugView-Di0lyXKv.js} +1 -1
- package/dist/assets/SddBoardView-Dv9R7tBM.js +2 -0
- package/dist/assets/SddFlowGraph-BGPIWq7W.js +1 -0
- package/dist/assets/SddWizard-BWaJb5ZH.js +1 -0
- package/dist/assets/{SessionsDashboard-pMXfRTwN.js → SessionsDashboard-B1u7rjTK.js} +1 -1
- package/dist/assets/SetupScreen-nZMY7jM6.js +1 -0
- package/dist/assets/SkillDetailView-CQevybc9.js +3 -0
- package/dist/assets/SpecsView-Xw9k8Llw.js +1 -0
- package/dist/assets/TerminalPanel-CPuqFiXC.js +1 -0
- package/dist/assets/{activity-CcEdxJjx.js → activity-Bt5JliZ2.js} +2 -2
- package/dist/assets/activity-DVbfo6OS.js +5 -0
- package/dist/assets/activity-DkmpcH1_.js +5 -0
- package/dist/assets/{activity-T9kySYDT.js → activity-HUfcj2wp.js} +3 -3
- package/dist/assets/activity-lQ47COGt.js +5 -0
- package/dist/assets/activity-mgahm8RV.js +5 -0
- package/dist/assets/activity-naMKylQi.js +5 -0
- package/dist/assets/chat-BNf8yQ-i.js +1 -0
- package/dist/assets/chat-BwmYDkLr.js +1 -0
- package/dist/assets/chat-C_9_T_Py.js +1 -0
- package/dist/assets/chat-CmZiF8Sm.js +1 -0
- package/dist/assets/chat-DW62ursN.js +1 -0
- package/dist/assets/chat-DfjGjYKF.js +1 -0
- package/dist/assets/chat-eXJFi4bY.js +1 -0
- package/dist/assets/chat-store-Dy1m3oen.js +5 -0
- package/dist/assets/commandPalette-BcMV6x3_.js +1 -0
- package/dist/assets/commandPalette-C4o2rUOp.js +1 -0
- package/dist/assets/commandPalette-C5U6qfth.js +1 -0
- package/dist/assets/commandPalette-CBJfByB7.js +1 -0
- package/dist/assets/commandPalette-CrYfIhnW.js +1 -0
- package/dist/assets/commandPalette-Dgd8HfNm.js +1 -0
- package/dist/assets/{i18n-BMePmaPJ.js → i18n-ClFSbktB.js} +2 -2
- package/dist/assets/index-DGwt4pL3.js +157 -0
- package/dist/assets/index-pw_NYdQ9.css +1 -0
- package/dist/assets/local-prefs-DUm4LFyu.js +1 -0
- package/dist/assets/markdown-BRAejDWd.js +44 -0
- package/dist/assets/{monaco-XnLmrAXJ.js → monaco-MjnRih9i.js} +1 -1
- package/dist/assets/{monaco-theme-Lsd14tM-.js → monaco-theme-DhdHiZEb.js} +1 -1
- package/dist/assets/{session-store-P-JnaPPK.js → session-store-BOmBeF9r.js} +1 -1
- package/dist/assets/settings-BehzuKKh.js +1 -0
- package/dist/assets/settings-CO8sA1-8.js +1 -0
- package/dist/assets/settings-CSb_3QO0.js +1 -0
- package/dist/assets/settings-CVkZ15Hv.js +1 -0
- package/dist/assets/settings-DRDu_6WL.js +1 -0
- package/dist/assets/settings-Dj8eonZG.js +1 -0
- package/dist/assets/settings-DkZAyCk6.js +1 -0
- package/dist/assets/{ui-store-ComQYc5F.js → ui-store-LCpXBvQT.js} +1 -1
- package/dist/assets/utils-Bl7Yr7Bw.js +1 -0
- package/dist/assets/{vendor-CyLvG8N0.js → vendor-C9iFsXuW.js} +28 -28
- package/dist/assets/ws-client-WVS5hdJj.js +1 -0
- package/dist/assets/{xyflow-oYDGUYW6.js → xyflow-YzHYNDhB.js} +3 -3
- package/dist/components/ChatInput/image-attachments.d.ts +58 -0
- package/dist/components/ChatInput/image-attachments.d.ts.map +1 -0
- package/dist/components/ChatInput/slash-routing.d.ts +8 -0
- package/dist/components/ChatInput/slash-routing.d.ts.map +1 -1
- package/dist/components/ChatInput/use-paste-drop.d.ts +14 -4
- package/dist/components/ChatInput/use-paste-drop.d.ts.map +1 -1
- package/dist/components/ChatInput.d.ts.map +1 -1
- package/dist/components/ChatView/index.d.ts.map +1 -1
- package/dist/components/InspectorPanel.d.ts.map +1 -1
- package/dist/components/MailboxPanel.d.ts.map +1 -1
- package/dist/components/MessageBubble/AttachmentGallery.d.ts +12 -0
- package/dist/components/MessageBubble/AttachmentGallery.d.ts.map +1 -0
- package/dist/components/MessageBubble/LazyMarkdown.d.ts +27 -0
- package/dist/components/MessageBubble/LazyMarkdown.d.ts.map +1 -0
- package/dist/components/MessageBubble/ToolInputView.d.ts.map +1 -1
- package/dist/components/MessageBubble/index.d.ts.map +1 -1
- package/dist/components/ModelPickDialog.d.ts +22 -0
- package/dist/components/ModelPickDialog.d.ts.map +1 -0
- package/dist/components/ModelPicker.d.ts.map +1 -1
- package/dist/components/RefinePanel.d.ts.map +1 -1
- package/dist/components/SddFlowGraph.d.ts.map +1 -1
- package/dist/components/SddTaskDrawer.d.ts.map +1 -1
- package/dist/components/SearchOverlay.d.ts.map +1 -1
- package/dist/components/SettingsPanel/BrainSection.d.ts.map +1 -1
- package/dist/components/SettingsPanel/MCPSection.d.ts +21 -0
- package/dist/components/SettingsPanel/MCPSection.d.ts.map +1 -1
- package/dist/components/SettingsPanel/PreferenceControls.d.ts.map +1 -1
- package/dist/components/SettingsPanel/PreferenceToggle.d.ts.map +1 -1
- package/dist/components/SettingsPanel/RoutingSection.d.ts +6 -0
- package/dist/components/SettingsPanel/RoutingSection.d.ts.map +1 -0
- package/dist/components/SettingsPanel/ShadowSection.d.ts.map +1 -1
- package/dist/components/SettingsPanel/ToolsSection.d.ts.map +1 -1
- package/dist/components/SettingsPanel/index.d.ts.map +1 -1
- package/dist/components/SidePanel/SkillsList.d.ts.map +1 -1
- package/dist/components/SidePanel/index.d.ts.map +1 -1
- package/dist/components/SkillDetailView.d.ts.map +1 -1
- package/dist/components/TaskCard.d.ts.map +1 -1
- package/dist/components/TerminalPanel.d.ts.map +1 -1
- package/dist/components/Toaster.d.ts +0 -7
- package/dist/components/Toaster.d.ts.map +1 -1
- package/dist/components/TodosPanel.d.ts.map +1 -1
- package/dist/components/WelcomeScreen.d.ts +8 -1
- package/dist/components/WelcomeScreen.d.ts.map +1 -1
- package/dist/components/ui/sparkline.d.ts.map +1 -1
- package/dist/hooks/useWebSocket.d.ts +1 -1
- package/dist/hooks/useWebSocket.d.ts.map +1 -1
- package/dist/hooks/ws-handlers/chat-handlers.d.ts.map +1 -1
- package/dist/hooks/ws-handlers/files-mailbox-handlers.d.ts +3 -1
- package/dist/hooks/ws-handlers/files-mailbox-handlers.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.html +15 -15
- package/dist/index.js +21246 -19585
- package/dist/index.js.map +4 -4
- package/dist/lib/analytics.d.ts +2 -0
- package/dist/lib/analytics.d.ts.map +1 -1
- package/dist/lib/default-prompt-pools.d.ts +27 -0
- package/dist/lib/default-prompt-pools.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +7 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/ws-client.d.ts +6 -2
- package/dist/lib/ws-client.d.ts.map +1 -1
- package/dist/stores/chat-store.d.ts +10 -1
- package/dist/stores/chat-store.d.ts.map +1 -1
- package/dist/stores/local-prefs.d.ts +18 -0
- package/dist/stores/local-prefs.d.ts.map +1 -1
- package/dist/stores/mailbox-store.d.ts +10 -0
- package/dist/stores/mailbox-store.d.ts.map +1 -1
- package/dist/stores/types.d.ts +14 -0
- package/dist/stores/types.d.ts.map +1 -1
- package/dist/types.d.ts +200 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/assets/AutoPhaseView-DWp3yHpI.js +0 -1
- package/dist/assets/DebugDashboard-DWKLI7lR.js +0 -1
- package/dist/assets/KanbanView-CJqlvsbc.js +0 -1
- package/dist/assets/MailboxDetailView-BwWagFay.js +0 -1
- package/dist/assets/OfficeMapPanel-QFPaXTZ9.js +0 -4
- package/dist/assets/SddBoardView-OtKwEtAp.js +0 -2
- package/dist/assets/SddFlowGraph-MVMUCMEy.js +0 -1
- package/dist/assets/SddWizard-c7g68RFx.js +0 -1
- package/dist/assets/SkillDetailView-CcdIF-85.js +0 -2
- package/dist/assets/SpecsView-yunV-Xfj.js +0 -1
- package/dist/assets/TerminalPanel-BIYT1IB3.js +0 -1
- package/dist/assets/activity-3lpGdUIy.js +0 -5
- package/dist/assets/activity-Bi6wI_Cg.js +0 -5
- package/dist/assets/activity-CSPSX--m.js +0 -5
- package/dist/assets/activity-Cv0CmTyM.js +0 -5
- package/dist/assets/activity-Doy5Yots.js +0 -5
- package/dist/assets/chat--Zry3Atx.js +0 -1
- package/dist/assets/chat-0DeGMNFQ.js +0 -1
- package/dist/assets/chat-BErfSQjE.js +0 -1
- package/dist/assets/chat-CX5cjaC-.js +0 -1
- package/dist/assets/chat-CibJIps5.js +0 -1
- package/dist/assets/chat-Dr5SJikx.js +0 -1
- package/dist/assets/chat-Siz8aWTB.js +0 -1
- package/dist/assets/chat-store-De7J1E26.js +0 -5
- package/dist/assets/commandPalette-2M1hYRuH.js +0 -1
- package/dist/assets/commandPalette-BE_ljQwl.js +0 -1
- package/dist/assets/commandPalette-BYf22WAi.js +0 -1
- package/dist/assets/commandPalette-BZhacjvy.js +0 -1
- package/dist/assets/commandPalette-CTE9ITWg.js +0 -1
- package/dist/assets/commandPalette-RxWSjQIg.js +0 -1
- package/dist/assets/index-CbrHWxbT.css +0 -1
- package/dist/assets/index-CyTNJHe8.js +0 -154
- package/dist/assets/local-prefs-BBMxai9I.js +0 -1
- package/dist/assets/markdown-D0X23O-i.js +0 -44
- package/dist/assets/settings-BVvx94WK.js +0 -1
- package/dist/assets/settings-CKNx8p9I.js +0 -1
- package/dist/assets/settings-CQ4x-iFD.js +0 -1
- package/dist/assets/settings-CmHCQRVI.js +0 -1
- package/dist/assets/settings-D-SHf0yS.js +0 -1
- package/dist/assets/settings-DgGu17XI.js +0 -1
- package/dist/assets/settings-TqprB9wO.js +0 -1
- package/dist/assets/utils-CU_o9ioU.js +0 -1
- package/dist/assets/ws-client-CwL51TNh.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-Dy1m3oen.js";import{m as n,p as r}from"./markdown-BRAejDWd.js";import{An as i,At as a,Ft as o,Lr as s,ar as c,mi as l,si as u,zr as d}from"./vendor-C9iFsXuW.js";import"./i18n-ClFSbktB.js";import{t as f}from"./session-store-BOmBeF9r.js";import{n as p}from"./ui-store-LCpXBvQT.js";var m=e(n(),1),h=r();function g(){let e=f(e=>e.session),{t:n}=l(),r=f.getState().session?.id,g=f(e=>e.projectName),x=f(e=>e.cwd),S=f(e=>e.mode),C=f(e=>e.contextMode),w=f(e=>e.lastVisitedAt),T=t(e=>e.messages),E=t(e=>e.queue.length),D=t(e=>e.boundSessionId),O=p(e=>e.currentView),k=p(e=>e.dockSection),[A,j]=(0,m.useState)([]),M=(0,m.useMemo)(()=>{if(typeof window>`u`)return 0;let e=0;for(let t of[`wrongstack-session`,`wrongstack-chat`,`wrongstack-ui`,`wrongstack-config`]){let n=window.localStorage.getItem(t);typeof n==`string`&&(e+=n.length)}return e},[T.length]),N=typeof window<`u`&&!!window.__wrongstackSessionRehydrated,P=typeof window<`u`&&!!window.__wrongstackChatRehydrated;function F(e,t){j(n=>[{ts:Date.now(),note:e,ok:t},...n].slice(0,20))}function I(){F(n(`activity:refresh.simulatedF5`),!0)}let L=D!==null&&r!==void 0?D!==r:!1;return(0,h.jsx)(`div`,{className:`h-full min-h-0 min-w-0 flex-1 overflow-y-auto bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,h.jsxs)(`div`,{className:`mx-auto max-w-5xl space-y-5 sm:space-y-6`,children:[(0,h.jsx)(`header`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,h.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsxs)(`h1`,{className:`flex min-w-0 items-center gap-2 text-xl font-bold sm:text-2xl`,children:[(0,h.jsx)(o,{className:`h-6 w-6 shrink-0 text-primary sm:h-7 sm:w-7`}),n(`activity:refresh.heading`)]}),(0,h.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:n(`activity:refresh.subtitle`)})]}),(0,h.jsx)(`button`,{type:`button`,onClick:I,className:`inline-flex h-9 w-full items-center justify-center rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground shadow-sm shadow-primary/15 hover:bg-primary/90 sm:w-auto`,children:n(`activity:refresh.recordProbe`)})]})}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(s,{className:`w-5 h-5`}),n(`activity:refresh.latestSession`)]}),(0,h.jsx)(_,{label:n(`activity:refresh.restoredLocal`),ok:N,extra:r?n(`activity:refresh.sessionIdExtra`,{id:r}):n(`activity:refresh.noSessionYet`)}),(0,h.jsx)(_,{label:n(`activity:refresh.activePointer`),ok:!!e?.id,extra:e?y(e):`null`}),(0,h.jsx)(_,{label:n(`activity:refresh.lastVisited`),ok:w>0,extra:w>0?new Date(w).toISOString():n(`activity:refresh.never`)})]}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(c,{className:`w-5 h-5`}),n(`activity:refresh.persistedEnv`)]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,h.jsx)(v,{label:`projectName`,value:g||`∅`}),(0,h.jsx)(v,{label:`cwd`,value:x||`∅`,mono:!0}),(0,h.jsx)(v,{label:`mode`,value:S,mono:!0}),(0,h.jsx)(v,{label:`contextMode`,value:C,mono:!0})]})]}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(i,{className:`w-5 h-5`}),n(`activity:refresh.transcriptRehydrate`)]}),(0,h.jsx)(_,{label:n(`activity:refresh.localTranscript`),ok:P&&(T.length>0||D===null),extra:T.length===0?n(`activity:refresh.noMessages`):n(`activity:refresh.messagesExtra`,{count:T.length,queued:E})}),(0,h.jsx)(_,{label:n(`activity:refresh.noBleed`),ok:!L,extra:L?n(`activity:refresh.bleedExtra`,{bound:D??`∅`,active:r??`∅`}):n(`activity:refresh.transcriptBinds`),warn:L}),T.length>0&&(0,h.jsxs)(`div`,{className:`space-y-1 rounded-lg border border-border/70 bg-card/65 p-3 text-xs font-mono`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:`first:`}),` `,b(T[0])]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:`last:`}),` `,b(T[T.length-1]??T[0])]})]})]}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(a,{className:`w-5 h-5`}),n(`activity:refresh.uiWorkspace`)]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,h.jsx)(v,{label:`currentView`,value:O,mono:!0}),(0,h.jsx)(v,{label:`dockSection`,value:k??n(`activity:refresh.noneValue`),mono:!0})]}),(0,h.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`activity:refresh.payloadSize`,{count:M})})]}),(0,h.jsxs)(`section`,{className:`space-y-2`,children:[(0,h.jsx)(`h2`,{className:`text-lg font-semibold`,children:n(`activity:refresh.probeLog`)}),A.length===0?(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`activity:refresh.noProbes`)}):(0,h.jsx)(`ul`,{className:`space-y-1 text-xs font-mono`,children:A.map((e,t)=>(0,h.jsxs)(`li`,{className:`flex items-center gap-2`,children:[e.ok?(0,h.jsx)(u,{className:`w-4 h-4 text-success shrink-0`}):(0,h.jsx)(d,{className:`w-4 h-4 text-warning shrink-0`}),(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()}),(0,h.jsx)(`span`,{children:e.note})]},`${e.ts}-${t}`))})]})]})})}function _({label:e,extra:t,ok:n,warn:r}){return(0,h.jsxs)(`div`,{className:`rounded-lg border px-3 py-2 ${r?`border-warning/40 bg-warning/10 text-warning`:n?`border-success/40 bg-success/10 text-success`:`border-border bg-muted/40 text-muted-foreground`}`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs font-medium`,children:[n&&!r?(0,h.jsx)(u,{className:`h-4 w-4 shrink-0`}):(0,h.jsx)(d,{className:`h-4 w-4 shrink-0`}),(0,h.jsx)(`span`,{className:`min-w-0 break-words`,children:e})]}),(0,h.jsx)(`div`,{className:`text-xs font-mono mt-1 break-all`,children:t})]})}function v({label:e,value:t,mono:n}){return(0,h.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-border/70 bg-card/75 p-3 shadow-sm`,children:[(0,h.jsx)(`p`,{className:`text-xs uppercase tracking-wide text-muted-foreground`,children:e}),(0,h.jsx)(`p`,{className:`mt-1 text-sm break-all `+(n?`font-mono`:`font-medium`),children:t})]})}function y(e){let t=e.title?.trim();return t?`${e.id} — "${t}" (${e.provider}/${e.model})`:`${e.id} (${e.provider}/${e.model})`}function b(e){let t=(e.content??``).trim().replace(/\s+/g,` `);return`[${e.role}] ${t.length>100?`${t.slice(0,99)}…`:t}`}export{g as RefreshDebugView};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-BRAejDWd.js";import{In as r,It as i,Kr as a,Kt as o,Lr as s,Nr as c,Sr as l,X as u,Xt as d,Z as f,_i as p,bt as ee,cr as te,ct as m,dt as h,fr as g,ii as _,mi as v,nr as ne,ot as y,si as b,xt as x,zr as S}from"./vendor-C9iFsXuW.js";import"./i18n-ClFSbktB.js";import{t as C}from"./utils-Bl7Yr7Bw.js";import{C as w,D as T,E,O as D,R as O,S as k,T as A,d as j,j as M,u as N,w as P}from"./index-DGwt4pL3.js";import{a as re,c as F,i as I,l as ie,n as L,o as R,r as z,s as B,t as V}from"./SddFlowGraph-BGPIWq7W.js";var H=e(t(),1),U=n();function ae({feed:e,now:t}){let{t:n}=v();return(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border px-3 py-2 text-xs font-semibold text-foreground`,children:[(0,U.jsx)(s,{className:`h-3.5 w-3.5 text-warning`}),n(`activity:sdd.activityHeading`)]}),(0,U.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 space-y-1 overflow-auto p-2`,children:e.length===0?(0,U.jsx)(`p`,{className:`px-1 pt-4 text-center text-[11px] text-muted-foreground`,children:n(`activity:sdd.feedEmpty`)}):e.map((e,n)=>{let r=z[e.kind]??z.started,i=r.icon;return(0,U.jsxs)(`div`,{className:C(`sdd-rise flex items-start gap-2 rounded-md px-2 py-1.5 text-[11px]`,n===0?`bg-muted`:`hover:bg-muted`),children:[(0,U.jsx)(i,{className:C(`mt-0.5 h-3.5 w-3.5 shrink-0`,r.color)}),(0,U.jsx)(`span`,{className:`flex-1 leading-snug text-foreground`,children:e.text}),(0,U.jsx)(`span`,{className:`shrink-0 tabular-nums text-[10px] text-muted-foreground`,children:R(e.ts,t)})]},`${e.ts}-${n}`)})})]})}function W({open:e,onOpenChange:t,snapshot:n,busy:r,onConfirm:i}){let{t:o}=v(),s=n?.mergedCommits?.length??0,c=n?.baseBranch,[l,u]=(0,H.useState)(!1);(0,H.useEffect)(()=>{e&&u(!1)},[e]);let d=n?.status===`running`||n?.status===`paused`,f=(0,H.useMemo)(()=>{let e=new Set;for(let t of n?.tasks??[])t.worktreeBranch&&e.add(t.worktreeBranch);return e.size},[n?.tasks]),p=(0,H.useMemo)(()=>{let e=new Set;for(let t of n?.tasks??[])t.displayStatus===`in_progress`&&t.agentName&&e.add(t.agentName);return e.size},[n?.tasks]);return(0,U.jsx)(w,{open:e,onOpenChange:e=>!r&&t(e),children:(0,U.jsxs)(P,{className:`sm:max-w-lg border-destructive/50`,children:[(0,U.jsxs)(T,{children:[(0,U.jsxs)(D,{className:`flex items-center gap-2`,children:[(0,U.jsx)(h,{className:`h-5 w-5 text-destructive`}),o(`activity:sdd.destroyTitle`)]}),(0,U.jsx)(A,{children:o(`activity:sdd.destroyDesc`)})]}),(0,U.jsxs)(`ul`,{className:`space-y-1.5 py-1 text-sm`,children:[d&&(0,U.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,U.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,U.jsx)(`span`,{children:p>0?o(`activity:sdd.stopRunAgents`,{count:p}):o(`activity:sdd.stopRun`)})]}),(0,U.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,U.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,U.jsx)(`span`,{children:f>0?o(`activity:sdd.removeWorktreesCount`,{count:f}):o(`activity:sdd.removeWorktreesAll`)})]}),(0,U.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,U.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,U.jsx)(`span`,{children:o(`activity:sdd.deleteArtifacts`)})]})]}),s>0&&(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md border border-warning/30 bg-warning/5 p-2.5 text-sm`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked),className:`mt-0.5 h-4 w-4 accent-warning`}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`span`,{className:`font-medium`,children:o(`activity:sdd.revertMerged`,{count:s})}),` `,`on `,(0,U.jsx)(`code`,{className:`text-xs`,children:c??o(`activity:sdd.baseBranchFallback`)}),(0,U.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:o(`activity:sdd.revertHint`)})]})]}),(0,U.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md bg-muted/50 p-2 text-xs text-muted-foreground`,children:[(0,U.jsx)(S,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-warning`}),o(s>0&&!l?`activity:sdd.noteLeaveMerged`:`activity:sdd.noteAbandon`)]}),(0,U.jsxs)(E,{className:`gap-2 sm:gap-2`,children:[(0,U.jsx)(k,{variant:`outline`,size:`sm`,disabled:r,onClick:()=>t(!1),children:o(`common:action.cancel`)}),(0,U.jsx)(k,{size:`sm`,disabled:r,onClick:()=>i(l),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:r?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a,{className:`mr-1 h-3.5 w-3.5 animate-spin`}),` `,o(`activity:sdd.destroying`)]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(h,{className:`mr-1 h-3.5 w-3.5`}),` `,o(`activity:sdd.destroyAll`)]})})]})]})})}var G=[{key:`pending`,labelKey:`kanbanBacklog`,accent:`border-border/70`,head:`text-muted-foreground`},{key:`queued`,labelKey:`kanbanReady`,accent:`border-primary/35`,head:`text-primary`},{key:`in_progress`,labelKey:`kanbanRunning`,accent:`border-warning/45`,head:`text-warning`},{key:`review`,labelKey:`kanbanReview`,accent:`border-primary/35`,head:`text-primary`},{key:`failed`,labelKey:`kanbanFailed`,accent:`border-destructive/35`,head:`text-destructive`},{key:`completed`,labelKey:`kanbanDone`,accent:`border-success/35`,head:`text-success`}];function K({tasks:e,selectedId:t,onTaskClick:n}){let{t:r}=v(),i=(0,H.useMemo)(()=>{let t=new Map;for(let e of G)t.set(e.key,[]);for(let n of e){let e=n.displayStatus===`blocked`?`pending`:n.displayStatus===`cancelled`?`failed`:n.displayStatus;(t.get(e)??t.get(`pending`))?.push(n)}return t},[e]);return(0,U.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 gap-3 overflow-x-auto p-4`,children:G.map(e=>{let a=i.get(e.key)??[];return(0,U.jsxs)(`div`,{className:`flex min-h-0 w-64 shrink-0 flex-col`,children:[(0,U.jsxs)(`div`,{className:C(`mb-2 flex items-center gap-2 border-b-2 pb-1.5`,e.accent),children:[(0,U.jsx)(`span`,{className:C(`text-xs font-bold uppercase tracking-wide`,e.head),children:r(`activity:sdd.${e.labelKey}`)}),(0,U.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 text-[10px] text-muted-foreground`,children:a.length})]}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto pr-1`,children:[a.map(e=>(0,U.jsx)(q,{task:e,selected:e.id===t,onClick:()=>n(e.id)},e.id)),a.length===0&&(0,U.jsx)(`div`,{className:`rounded-md border border-dashed border-border py-6 text-center text-[10px] text-muted-foreground`,children:r(`activity:sdd.kanbanEmpty`)})]})]},e.key)})})}function q({task:e,selected:t,onClick:n}){let o=e.displayStatus===`in_progress`;return(0,U.jsxs)(`button`,{type:`button`,onClick:n,className:C(`sdd-node-enter w-full rounded-lg border bg-card/85 p-2 text-left shadow-sm transition hover:border-primary/35 hover:bg-accent/35`,t?`border-primary/55 ring-1 ring-primary/35`:`border-border/70`,o&&`sdd-node-running`,e.displayStatus===`completed`&&`sdd-node-complete`,e.displayStatus===`failed`&&`sdd-node-failed`),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[o&&(0,U.jsx)(a,{className:`h-3 w-3 animate-spin text-warning`}),e.displayStatus===`completed`&&(0,U.jsx)(l,{className:`h-3 w-3 text-success`}),e.displayStatus===`failed`&&(0,U.jsx)(f,{className:`h-3 w-3 text-destructive`}),(0,U.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:e.shortId}),(0,U.jsx)(`span`,{className:C(`ml-auto rounded px-1.5 text-[9px] font-bold uppercase`,F(e.priority).chip),children:e.priority})]}),(0,U.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[11px] leading-snug text-foreground`,children:e.title}),(e.agentName||e.worktreeBranch||e.retries)&&(0,U.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[e.agentName&&(0,U.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(`span`,{className:C(`flex h-4 w-4 items-center justify-center rounded-full text-[8px] font-bold text-white`,o?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:re(e.agentName)}),(0,U.jsx)(`span`,{className:`max-w-[80px] truncate text-[10px] text-muted-foreground`,children:e.agentName})]}),e.retries?(0,U.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-destructive`,children:[(0,U.jsx)(i,{className:`h-2.5 w-2.5`}),e.retries]}):null,e.worktreeBranch&&(0,U.jsx)(r,{className:`ml-auto h-2.5 w-2.5 text-muted-foreground`})]})]})}function oe({task:e,allTasks:t,feed:n,now:a,modelCandidates:o,defaultModel:s,onClose:u,onRetry:d,onReassign:p,onSetModel:te,onSetVerification:m,onCancel:_,onDelete:ne,onSplit:b,onSelectTask:S}){let{t:w}=v(),T=ie(e.displayStatus),E=T.icon,D=e.displayStatus===`in_progress`,O=e.displayStatus===`pending`||e.displayStatus===`blocked`||e.displayStatus===`queued`,[k,A]=(0,H.useState)(!1),[j,M]=(0,H.useState)(``),[P,I]=(0,H.useState)(null),[L,R]=(0,H.useState)(!1),[z,V]=(0,H.useState)(``),[ae,W]=(0,H.useState)(!1),[G,K]=(0,H.useState)(e.verificationCommand??``),q=()=>{j.trim()&&(p(e.id,j.trim()),A(!1),M(``))},oe=()=>{let t=z.split(`
|
|
2
|
+
`).map(e=>e.trim()).filter(Boolean).map(e=>{let[t,...n]=e.split(`::`),r=(t??``).trim();return{title:r,description:n.join(`::`).trim()||r}}).filter(e=>e.title);t.length&&(b(e.id,t),R(!1),V(``))},se=(0,H.useMemo)(()=>new Map(t.map(e=>[e.shortId,e])),[t]),X=(0,H.useMemo)(()=>t.filter(t=>t.deps.includes(e.shortId)),[t,e.shortId]),Z=(0,H.useMemo)(()=>n.filter(t=>t.taskShortId===e.shortId),[n,e.shortId]),ce=e.startedAt&&!e.completedAt?B(a-e.startedAt):e.startedAt&&e.completedAt?B(e.completedAt-e.startedAt):null;return(0,U.jsxs)(`div`,{className:`sdd-rise flex h-full min-h-0 min-w-0 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 bg-card/70 px-3 py-2`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:u,className:`text-muted-foreground hover:text-foreground`,title:w(`activity:sddTask.backTitle`),children:(0,U.jsx)(c,{className:`h-4 w-4`})}),(0,U.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),(0,U.jsxs)(`span`,{className:C(`ml-auto flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px]`,T.ring,T.text),children:[(0,U.jsx)(E,{className:C(`h-3 w-3`,D&&`animate-spin`)}),T.label]})]}),(0,U.jsxs)(`div`,{className:`min-h-0 min-w-0 flex-1 space-y-3 overflow-auto p-3`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold leading-snug text-foreground`,children:e.title}),e.agentName&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/70 bg-muted/45 p-2`,children:[(0,U.jsx)(`span`,{className:C(`flex h-7 w-7 items-center justify-center rounded-full text-[10px] font-bold text-white`,D?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:re(e.agentName)}),(0,U.jsxs)(`div`,{className:`leading-tight`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:e.agentName}),(0,U.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:w(D?`activity:sddTask.workingOn`:`activity:sddTask.assigned`)})]})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-1.5 text-[11px]`,children:[(0,U.jsx)(J,{label:w(`activity:sddTask.metaPriority`),children:(0,U.jsx)(`span`,{className:C(`font-medium uppercase`,F(e.priority).text),children:e.priority})}),(0,U.jsx)(J,{label:w(`activity:sddTask.metaType`),children:e.type}),ce&&(0,U.jsx)(J,{label:e.completedAt?w(`activity:sddTask.metaDuration`):w(`activity:sddTask.metaElapsed`),children:(0,U.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(g,{className:`h-3 w-3 text-muted-foreground`}),ce]})}),e.retries?(0,U.jsx)(J,{label:w(`activity:sddTask.metaRetries`),children:(0,U.jsxs)(`span`,{className:`flex items-center gap-1 text-destructive`,children:[(0,U.jsx)(i,{className:`h-3 w-3`}),e.retries]})}):null,e.worktreeBranch&&(0,U.jsx)(J,{label:w(`activity:sddTask.metaWorktree`),full:!0,children:(0,U.jsxs)(`span`,{className:`flex items-center gap-1 font-mono text-foreground`,title:e.worktreeBranch,children:[(0,U.jsx)(r,{className:`h-3 w-3 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.worktreeBranch})]})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[w(`activity:sddTask.workerModel`),!e.model&&s&&(0,U.jsxs)(`span`,{className:`font-normal normal-case text-muted-foreground`,children:[`· `,w(`activity:sddTask.runDefault`,{model:s})]})]}),(0,U.jsx)(N,{value:e.model,provider:e.provider,candidates:o,placeholder:s?w(`activity:sddTask.runDefaultPlaceholderModel`,{model:s}):w(`activity:sddTask.runDefaultPlaceholder`),onPick:(t,n)=>te(e.id,t,n),onReset:e.model?()=>te(e.id,void 0,void 0):void 0}),e.fallbackModels&&e.fallbackModels.length>0&&(0,U.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:e.fallbackModels.map(e=>(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`↳ `,e]},e))})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[w(`activity:sddTask.verificationCmd`),(0,U.jsxs)(`span`,{className:`font-normal normal-case text-muted-foreground`,children:[`· `,w(`activity:sddTask.gatesCompletion`)]})]}),ae?(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`input`,{value:G,onChange:e=>K(e.target.value),onKeyDown:t=>{t.key===`Enter`?(m(e.id,G.trim()||void 0),W(!1)):t.key===`Escape`&&(K(e.verificationCommand??``),W(!1))},placeholder:w(`activity:sddTask.verifyPlaceholder`),className:`w-full rounded border border-border bg-background px-2 py-1 font-mono text-[11px] text-foreground`}),(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>{m(e.id,G.trim()||void 0),W(!1)},className:`rounded bg-primary px-2 py-0.5 text-[10px] text-primary-foreground hover:opacity-90`,children:w(`common:action.save`)}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>{K(e.verificationCommand??``),W(!1)},className:`rounded bg-muted px-2 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:w(`common:action.cancel`)})]})]}):e.verificationCommand?(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(`code`,{className:`flex-1 truncate rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-foreground`,children:e.verificationCommand}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>W(!0),className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:w(`common:action.edit`)}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>m(e.id,void 0),className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:w(`common:action.clear`)})]}):(0,U.jsx)(`button`,{type:`button`,onClick:()=>W(!0),className:`rounded border border-dashed border-border px-2 py-1 text-[10px] text-muted-foreground hover:bg-muted`,children:w(`activity:sddTask.addVerify`)})]}),e.description&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:w(`activity:sddTask.description`)}),(0,U.jsx)(`p`,{className:`whitespace-pre-wrap rounded-md bg-muted p-2 text-[11px] leading-relaxed text-foreground`,children:e.description})]}),Z.length>0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:w(`activity:sddTask.timeline`)}),(0,U.jsx)(`div`,{className:`space-y-1 border-l border-border pl-2.5`,children:Z.map((e,t)=>(0,U.jsxs)(`div`,{className:`relative text-[11px] leading-snug text-foreground`,children:[(0,U.jsx)(`span`,{className:C(`absolute -left-[14px] top-1 h-1.5 w-1.5 rounded-full`,e.kind===`completed`?`bg-success`:e.kind===`failed`?`bg-destructive`:e.kind===`retrying`?`bg-warning`:`bg-primary`)}),e.text]},`${e.ts}-${t}`))})]}),e.deps.length>0&&(0,U.jsx)(Y,{title:w(`activity:sddTask.dependsOn`),shortIds:e.deps,byShort:se,onSelectTask:S}),X.length>0&&(0,U.jsx)(Y,{title:w(`activity:sddTask.blocks`),shortIds:X.map(e=>e.shortId),byShort:se,onSelectTask:S})]}),(0,U.jsxs)(`div`,{className:`border-t border-border p-2`,children:[k?(0,U.jsxs)(`div`,{className:`sdd-rise flex items-center gap-1.5`,children:[(0,U.jsx)(`input`,{value:j,onChange:e=>M(e.target.value),onKeyDown:e=>{e.key===`Enter`&&q(),e.key===`Escape`&&A(!1)},placeholder:w(`activity:sddTask.newWorkerPlaceholder`),className:`min-w-0 flex-1 rounded-md border border-border/70 bg-background px-2 py-1.5 text-xs outline-none focus:border-primary/60`}),(0,U.jsx)(`button`,{type:`button`,onClick:q,disabled:!j.trim(),className:`rounded-md bg-primary/10 px-2 py-1.5 text-xs font-medium text-primary hover:bg-primary/15 disabled:opacity-40`,children:(0,U.jsx)(l,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>A(!1),className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,U.jsx)(f,{className:`h-3.5 w-3.5`})})]}):P?(0,U.jsxs)(`div`,{className:`sdd-rise flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`flex-1 text-xs text-foreground`,children:w(P===`stop`?`activity:sddTask.confirmStop`:`activity:sddTask.confirmDelete`)}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{P===`stop`?_(e.id):ne(e.id),I(null)},className:`inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,U.jsx)(l,{className:`h-3.5 w-3.5`}),` `,w(P===`stop`?`common:action.stop`:`common:action.delete`)]}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>I(null),className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,U.jsx)(f,{className:`h-3.5 w-3.5`})})]}):(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>d(e.id),title:w(`activity:sddTask.retryTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-warning/12 py-1.5 text-xs font-medium text-warning hover:bg-warning/18`,children:[(0,U.jsx)(i,{className:`h-3.5 w-3.5`}),` `,w(`common:action.retry`)]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>A(!0),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-primary/10 py-1.5 text-xs font-medium text-primary hover:bg-primary/15`,children:[(0,U.jsx)(y,{className:`h-3.5 w-3.5`}),` `,w(`activity:sddTask.reassign`)]}),D&&(0,U.jsxs)(`button`,{type:`button`,onClick:()=>I(`stop`),title:w(`activity:sddTask.stopTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-destructive/10 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,U.jsx)(ee,{className:`h-3.5 w-3.5`}),` `,w(`common:action.stop`)]}),!D&&(0,U.jsxs)(`button`,{type:`button`,onClick:()=>R(!0),title:w(`activity:sddTask.splitTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-primary/10 py-1.5 text-xs font-medium text-primary hover:bg-primary/15`,children:[(0,U.jsx)(x,{className:`h-3.5 w-3.5`}),` `,w(`activity:sddTask.split`)]}),O&&(0,U.jsxs)(`button`,{type:`button`,onClick:()=>I(`delete`),title:w(`activity:sddTask.deleteTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-destructive/10 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,U.jsx)(h,{className:`h-3.5 w-3.5`}),` `,w(`common:action.delete`)]})]}),L&&(0,U.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2`,children:[(0,U.jsx)(`label`,{className:`text-[11px] text-muted-foreground`,htmlFor:`sdd-split-input`,children:w(`activity:sddTask.splitHint`)}),(0,U.jsx)(`textarea`,{id:`sdd-split-input`,rows:3,value:z,onChange:e=>V(e.target.value),placeholder:w(`activity:sddTask.splitPlaceholder`),className:`w-full resize-y rounded-md border border-border/70 bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-ring`}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:oe,className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-primary/10 py-1.5 text-xs font-medium text-primary hover:bg-primary/15`,children:[(0,U.jsx)(x,{className:`h-3.5 w-3.5`}),` `,w(`activity:sddTask.splitInto`)]}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>{R(!1),V(``)},className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,U.jsx)(f,{className:`h-3.5 w-3.5`})})]})]})]})]})}function J({label:e,children:t,full:n}){return(0,U.jsxs)(`div`,{className:C(`rounded-md border border-border bg-muted/50 px-2 py-1`,n&&`col-span-2`),children:[(0,U.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide text-muted-foreground`,children:e}),(0,U.jsx)(`div`,{className:`text-foreground`,children:t})]})}function Y({title:e,shortIds:t,byShort:n,onSelectTask:r}){return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map(e=>{let t=n.get(e);return(0,U.jsxs)(`button`,{type:`button`,disabled:!t,onClick:()=>t&&r(t.id),className:`flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] text-foreground hover:bg-muted disabled:opacity-50`,title:t?.title,children:[(0,U.jsx)(`span`,{className:C(`h-1.5 w-1.5 rounded-full`,ie(t?.displayStatus??`pending`).dot)}),(0,U.jsx)(`span`,{className:`font-mono`,children:e})]},e)})})]})}function se({pct:e}){let t=2*Math.PI*26,n=t-Math.max(0,Math.min(100,e))/100*t;return(0,U.jsxs)(`div`,{className:`relative h-16 w-16 shrink-0`,children:[(0,U.jsxs)(`svg`,{viewBox:`0 0 64 64`,className:`h-16 w-16 -rotate-90`,role:`img`,"aria-label":`Progress`,children:[(0,U.jsx)(`circle`,{cx:`32`,cy:`32`,r:26,fill:`none`,stroke:`hsl(var(--muted))`,strokeWidth:`6`}),(0,U.jsx)(`circle`,{cx:`32`,cy:`32`,r:26,fill:`none`,stroke:`url(#sddgrad)`,strokeWidth:`6`,strokeLinecap:`round`,strokeDasharray:t,strokeDashoffset:n,style:{transition:`stroke-dashoffset 0.6s cubic-bezier(0.16,1,0.3,1)`}}),(0,U.jsx)(`defs`,{children:(0,U.jsxs)(`linearGradient`,{id:`sddgrad`,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,U.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--primary))`}),(0,U.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--info))`})]})})]}),(0,U.jsxs)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm font-bold text-foreground`,children:[Math.round(e),`%`]})]})}function X({onClose:e}){let{t}=v(),{client:n}=M(),r=O(e=>e.snapshot),a=O(e=>e.lifecycleResult),c=O(e=>e.destroying),l=O(e=>e.setDestroying),p=O(e=>e.setLifecycleResult),[g,_]=(0,H.useState)(()=>Date.now()),[y,b]=(0,H.useState)(null),[x,w]=(0,H.useState)(`graph`),[T,E]=(0,H.useState)(!1);(0,H.useEffect)(()=>{n?.send?.({type:`sdd.board.get`})},[n]);let D=r&&(r.status===`running`||r.status===`paused`);(0,H.useEffect)(()=>{if(!D)return;let e=setInterval(()=>_(Date.now()),1e3);return _(Date.now()),()=>clearInterval(e)},[D]);let A=(0,H.useCallback)(e=>n?.send?.(e),[n]),N=(0,H.useRef)(null),P=(0,H.useCallback)(e=>{N.current=null,A({type:`sdd.board.destroy`,payload:{revertMerged:e}})},[A]),F=(0,H.useCallback)(e=>{E(!1),p(null),l(!0),D?(A({type:`sdd.board.stop`,payload:{}}),N.current={revertMerged:e,deadline:Date.now()+2e4}):P(e)},[D,A,P,l,p]);(0,H.useEffect)(()=>{let e=N.current;e&&(!D||Date.now()>=e.deadline)&&P(e.revertMerged)},[D,r,P]);let ie=(0,H.useCallback)(()=>{p(null),A({type:`sdd.board.cleanup_worktrees`,payload:{}})},[A,p]),R=(0,H.useCallback)(()=>{p(null),A({type:`sdd.board.rollback`,payload:{}})},[A,p]),z=(0,H.useMemo)(()=>(r?.tasks??[]).map(e=>({id:e.id,shortId:e.shortId,title:e.title,displayStatus:e.displayStatus,priority:e.priority,deps:e.deps,agentName:e.agentName,worktreeBranch:e.worktreeBranch})),[r?.tasks]),G=(0,H.useMemo)(()=>{let e=new Map;for(let t of r?.tasks??[])t.displayStatus===`in_progress`&&t.agentName&&e.set(t.agentName,{name:t.agentName,task:t.title});return[...e.values()]},[r?.tasks]),q=(0,H.useCallback)(e=>b(e),[]),J=(0,H.useCallback)(e=>A({type:`sdd.board.retry`,payload:{taskId:e}}),[A]),Y=(0,H.useCallback)(()=>A({type:`sdd.board.retry_all_failed`,payload:{}}),[A]),X=(0,H.useCallback)((e,t)=>{let n=t.trim();n&&A({type:`sdd.board.reassign`,payload:{taskId:e,agentName:n}})},[A]),Z=(0,H.useCallback)((e,t,n)=>A({type:`sdd.board.set_task_model`,payload:{taskId:e,model:t,provider:n}}),[A]),le=(0,H.useCallback)((e,t)=>A({type:`sdd.board.set_task_verification`,payload:{taskId:e,verificationCommand:t}}),[A]),ue=(0,H.useCallback)(e=>A({type:`sdd.board.cancel_task`,payload:{taskId:e}}),[A]),de=(0,H.useCallback)(e=>{A({type:`sdd.board.delete_task`,payload:{taskId:e}}),b(null)},[A]),fe=(0,H.useCallback)((e,t)=>{A({type:`sdd.board.split_task`,payload:{taskId:e,subtasks:t}}),b(null)},[A]),pe=j(y!==null),me=(0,H.useMemo)(()=>r?.tasks.find(e=>e.id===y)??null,[r?.tasks,y]),$=r?.progress,he=r?.diagnostics?.deadlockChains??[];return(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,U.jsxs)(`header`,{className:`sdd-sheen shrink-0 border-b border-border px-4 pb-3 pt-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(s,{className:`h-5 w-5 text-warning`}),(0,U.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:r?.title??t(`activity:sddBoard.titleFallback`)}),r&&(0,U.jsx)(`span`,{className:C(`rounded-full border px-2 py-0.5 text-[11px] font-medium capitalize`,I[r.status]??I.idle),children:r.status}),r?.defaultModel&&(0,U.jsxs)(`span`,{className:`flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] text-muted-foreground`,title:t(`activity:sddBoard.defaultModelTitle`),children:[(0,U.jsx)(te,{className:`h-3 w-3 text-primary`}),r.defaultModel]})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r&&(0,U.jsx)(`div`,{className:`flex items-center rounded-md border border-border bg-muted p-0.5 text-[11px]`,children:[`graph`,`kanban`].map(e=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>w(e),className:C(`rounded px-2 py-0.5 capitalize transition`,x===e?`bg-primary/12 text-primary`:`text-muted-foreground hover:text-foreground`),children:t(e===`graph`?`activity:sddBoard.graphLabel`:`activity:sddBoard.kanbanLabel`)},e))}),D&&($?.failed??0)>0&&(0,U.jsxs)(`button`,{type:`button`,onClick:Y,title:t(`activity:sddBoard.retryAllTitle`),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning hover:bg-warning/25`,children:[(0,U.jsx)(i,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.retryFailed`,{count:$?.failed??0})]}),D&&(0,U.jsxs)(U.Fragment,{children:[r?.status===`paused`?(0,U.jsxs)(`button`,{type:`button`,onClick:()=>A({type:`sdd.board.resume`,payload:{}}),className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success hover:bg-success/25`,children:[(0,U.jsx)(o,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.resume`)]}):(0,U.jsxs)(`button`,{type:`button`,onClick:()=>A({type:`sdd.board.pause`,payload:{}}),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning hover:bg-warning/25`,children:[(0,U.jsx)(d,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.pause`)]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>A({type:`sdd.board.stop`,payload:{}}),className:`inline-flex items-center gap-1 rounded-md bg-destructive/15 px-2.5 py-1 text-xs font-medium text-destructive hover:bg-destructive/25`,children:[(0,U.jsx)(ee,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.stop`)]})]}),r&&!D&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{type:`button`,onClick:ie,title:t(`activity:sddBoard.cleanTitle`),className:`inline-flex items-center gap-1 rounded-md bg-muted px-2.5 py-1 text-xs font-medium text-muted-foreground hover:bg-muted/80`,children:[(0,U.jsx)(ne,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.cleanWorktrees`)]}),(r.mergedCommits?.length??0)>0&&(0,U.jsxs)(`button`,{type:`button`,onClick:R,title:t(`activity:sddBoard.rollbackTitle`,{count:r.mergedCommits?.length??0,base:r.baseBranch??t(`activity:sdd.baseBranchFallback`)}),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning hover:bg-warning/25`,children:[(0,U.jsx)(m,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.rollback`,{count:r.mergedCommits?.length??0})]})]}),r&&(c?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-destructive/15 px-2.5 py-1 text-xs font-medium text-destructive`,children:[(0,U.jsx)(i,{className:`h-3.5 w-3.5 animate-spin`}),` `,t(D?`activity:sddBoard.stopping`:`activity:sddBoard.destroying`)]}):(0,U.jsxs)(`button`,{type:`button`,onClick:()=>E(!0),title:t(`activity:sddBoard.destroyTitle`),className:`inline-flex items-center gap-1 rounded-md bg-destructive px-2.5 py-1 text-xs font-medium text-destructive-foreground hover:bg-destructive/90`,children:[(0,U.jsx)(h,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.destroy`)]})),(0,U.jsx)(k,{variant:`ghost`,size:`icon`,onClick:e,children:(0,U.jsx)(f,{className:`h-4 w-4`})})]})]}),r&&$&&(0,U.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-5`,children:[(0,U.jsx)(se,{pct:$.percentComplete}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,U.jsx)(Q,{label:t(`activity:sddBoard.statDone`),value:`${$.completed}/${$.total}`,color:`text-success`}),$.inProgress>0&&(0,U.jsx)(Q,{label:t(`activity:sddBoard.statRunning`),value:$.inProgress,color:`text-warning`}),$.failed>0&&(0,U.jsx)(Q,{label:t(`activity:sddBoard.statFailed`),value:$.failed,color:`text-destructive`}),(0,U.jsx)(Q,{label:t(`activity:sddBoard.statWave`),value:r.wave+1,color:`text-primary`}),D&&r.startedAt>0&&(0,U.jsx)(Q,{label:t(`activity:sddBoard.statElapsed`),value:B(g-r.startedAt),color:`text-foreground`})]}),(0,U.jsx)(`div`,{className:`flex min-h-[24px] items-center gap-1.5`,children:G.length===0?(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t(`activity:sddBoard.noActiveWorkers`)}):G.map((e,t)=>(0,U.jsxs)(`span`,{title:`${e.name} → ${e.task}`,className:`flex items-center gap-1 rounded-full bg-muted py-0.5 pl-0.5 pr-2`,children:[(0,U.jsx)(`span`,{className:C(`sdd-agent-live flex h-5 w-5 items-center justify-center rounded-full text-[9px] font-bold text-white`,L[t%L.length]),children:re(e.name)}),(0,U.jsx)(`span`,{className:`max-w-[90px] truncate text-[11px] text-foreground`,children:e.name})]},e.name))})]})]})]}),a&&(0,U.jsx)(ce,{result:a,onDismiss:()=>p(null)}),he.length>0&&(0,U.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-destructive/30 bg-destructive/5 px-4 py-2 text-xs text-destructive`,children:[(0,U.jsx)(S,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`font-semibold`,children:t(`activity:sddBoard.deadlock`)}),he.map(e=>(0,U.jsxs)(`div`,{className:`font-mono`,children:[e.blocked,` ← `,e.blockedBy.join(`, `)]},e.blocked))]})]}),(0,U.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:r?x===`graph`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(V,{tasks:z,columns:r.columns,onTaskClick:q}),(0,U.jsx)(`div`,{className:`pointer-events-none absolute bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-black/40 px-2 py-0.5 text-[10px] text-muted-foreground backdrop-blur`,children:t(`activity:sddBoard.clickTaskHint`)})]}):(0,U.jsx)(K,{tasks:r.tasks,selectedId:y,onTaskClick:q}):(0,U.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 text-sm text-muted-foreground`,children:[(0,U.jsx)(u,{className:`h-10 w-10 text-primary/40`}),(0,U.jsx)(`p`,{className:`text-foreground`,children:t(`activity:sddBoard.noRunTitle`)}),(0,U.jsx)(`p`,{className:`max-w-sm text-center text-xs text-muted-foreground`,children:t(`activity:sddBoard.noRunBody`)})]})}),r&&(0,U.jsx)(`aside`,{className:`w-80 shrink-0 border-l border-border bg-card`,children:me?(0,U.jsx)(oe,{task:me,allTasks:r.tasks,feed:r.feed??[],now:g,modelCandidates:pe,defaultModel:r.defaultModel,onClose:()=>b(null),onRetry:J,onReassign:X,onSetModel:Z,onSetVerification:le,onCancel:ue,onDelete:de,onSplit:fe,onSelectTask:b},me.id):(0,U.jsx)(ae,{feed:r.feed??[],now:g})})]}),(0,U.jsx)(W,{open:T,onOpenChange:E,snapshot:r,busy:c,onConfirm:F})]})}function Z(e){let t=e.op===`cleanup_worktrees`?`lcClean`:e.op===`rollback`?`lcRollback`:`lcDestroy`,n=p.t(`activity:sddBoard.${t}`);if(!e.ok)return p.t(`activity:sddBoard.lcFailed`,{op:n,reason:e.reason??p.t(`activity:sddBoard.lcUnknownError`)});let r=[];typeof e.removed==`number`&&r.push(p.t(`activity:sddBoard.lcWorktrees`,{count:e.removed})),typeof e.reverted==`number`&&e.reverted>0&&r.push(p.t(`activity:sddBoard.lcCommits`,{count:e.reverted})),e.deleted?.length&&r.push(p.t(`activity:sddBoard.lcDeleted`,{items:e.deleted.join(`, `)}));let i=r.length?r.join(` · `):p.t(`activity:sddBoard.lcNothing`);return e.reason?p.t(`activity:sddBoard.lcNote`,{op:n,body:i,reason:e.reason}):p.t(`activity:sddBoard.lcOk`,{op:n,body:i})}function ce({result:e,onDismiss:t}){let n=!e.ok||!!e.reason;return(0,U.jsxs)(`div`,{className:C(`flex items-start gap-2 border-b px-4 py-2 text-xs`,n?`border-warning/30 bg-warning/5 text-warning`:`border-success/30 bg-success/5 text-success`),children:[n?(0,U.jsx)(_,{className:`mt-0.5 h-4 w-4 shrink-0`}):(0,U.jsx)(b,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,U.jsx)(`span`,{className:`flex-1`,children:Z(e)}),(0,U.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 opacity-60 hover:opacity-100`,children:(0,U.jsx)(f,{className:`h-3.5 w-3.5`})})]})}function Q({label:e,value:t,color:n}){return(0,U.jsxs)(`span`,{className:`flex items-baseline gap-1`,children:[(0,U.jsx)(`span`,{className:C(`font-semibold tabular-nums`,n),children:t}),(0,U.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:e})]})}export{X as SddBoardView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-BRAejDWd.js";import{Et as r,In as i,It as a,Kr as o,Kt as s,Or as c,Pn as l,Sr as u,Z as d,hr as f,mi as p,qr as m,wr as h,xt as g,zr as _}from"./vendor-C9iFsXuW.js";import"./i18n-ClFSbktB.js";import{t as v}from"./utils-Bl7Yr7Bw.js";import{a as y,c as b,m as x,n as S,o as C,p as w,r as T,t as E,u as D}from"./xyflow-YzHYNDhB.js";var O=e(t(),1),k={pending:{label:`Pending`,icon:f,text:`text-muted-foreground`,ring:`border-border/70 bg-muted/45`,dot:`bg-muted-foreground`,hex:`hsl(var(--muted-foreground))`},queued:{label:`Ready`,icon:f,text:`text-primary`,ring:`border-primary/35 bg-primary/10`,dot:`bg-primary`,hex:`hsl(var(--primary))`},in_progress:{label:`Running`,icon:o,spin:!0,text:`text-warning`,ring:`border-warning/45 bg-warning/10`,dot:`bg-warning`,hex:`hsl(var(--warning))`},blocked:{label:`Blocked`,icon:f,text:`text-destructive`,ring:`border-destructive/30 bg-destructive/10`,dot:`bg-destructive`,hex:`hsl(var(--destructive))`},review:{label:`Review`,icon:f,text:`text-primary`,ring:`border-primary/35 bg-primary/10`,dot:`bg-primary`,hex:`hsl(var(--info))`},failed:{label:`Failed`,icon:d,text:`text-destructive`,ring:`border-destructive/45 bg-destructive/10`,dot:`bg-destructive`,hex:`hsl(var(--destructive))`},completed:{label:`Done`,icon:u,text:`text-success`,ring:`border-success/35 bg-success/10`,dot:`bg-success`,hex:`hsl(var(--success))`},cancelled:{label:`Cancelled`,icon:c,text:`text-muted-foreground`,ring:`border-border/70 bg-muted/45`,dot:`bg-muted-foreground`,hex:`hsl(var(--muted-foreground))`}};function A(e){return k[e]??k.pending}var j={critical:{text:`text-destructive`,chip:`bg-destructive/10 text-destructive`},high:{text:`text-warning`,chip:`bg-warning/12 text-warning`},medium:{text:`text-primary`,chip:`bg-primary/10 text-primary`},low:{text:`text-muted-foreground`,chip:`bg-muted text-muted-foreground`}};function M(e){return j[e]??j.medium}var N={running:`border-primary/35 bg-primary/10 text-primary`,paused:`border-warning/35 bg-warning/10 text-warning`,stopped:`border-border/70 bg-muted text-muted-foreground`,completed:`border-success/35 bg-success/10 text-success`,failed:`border-destructive/35 bg-destructive/10 text-destructive`,deadlocked:`border-destructive/35 bg-destructive/10 text-destructive`,idle:`border-border bg-muted text-muted-foreground`},P=[`bg-warning`,`bg-primary`,`bg-success`,`bg-destructive`,`bg-secondary`,`bg-muted-foreground`,`bg-accent`],F={started:{icon:s,color:`text-warning`},completed:{icon:u,color:`text-success`},failed:{icon:d,color:`text-destructive`},retrying:{icon:a,color:`text-warning`},wave:{icon:m,color:`text-primary`},deadlock:{icon:_,color:`text-destructive`},verification_failed:{icon:r,color:`text-destructive`},conflict:{icon:l,color:`text-warning`},split:{icon:g,color:`text-primary`},supervisor:{icon:h,color:`text-primary`}};function I(e){let t=e.trim().split(/\s+/);return((t[0]?.[0]??``)+(t[1]?.[0]??``)).toUpperCase()||`·`}function L(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?t%60?`${n}m ${t%60}s`:`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function R(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));if(n<60)return`${n}s`;let r=Math.floor(n/60);return r<60?`${r}m`:`${Math.floor(r/60)}h`}var z=n(),B=300,V=128,H=240,U={pending:{ring:`border-border/70`,chip:`bg-muted text-muted-foreground`,dot:`bg-muted-foreground`},queued:{ring:`border-primary/35`,chip:`bg-primary/10 text-primary`,dot:`bg-primary`},in_progress:{ring:`border-warning/45`,chip:`bg-warning/12 text-warning`,dot:`bg-warning`},blocked:{ring:`border-destructive/30`,chip:`bg-destructive/10 text-destructive`,dot:`bg-destructive`},review:{ring:`border-primary/35`,chip:`bg-primary/10 text-primary`,dot:`bg-primary`},failed:{ring:`border-destructive/45`,chip:`bg-destructive/10 text-destructive`,dot:`bg-destructive`},completed:{ring:`border-success/35`,chip:`bg-success/12 text-success`,dot:`bg-success`},cancelled:{ring:`border-border/70`,chip:`bg-muted text-muted-foreground`,dot:`bg-muted-foreground`}};function W({data:e}){let t=e.task,{t:n}=p(),r=U[t.displayStatus],s=t.displayStatus===`in_progress`,c=t.displayStatus===`completed`?u:t.displayStatus===`failed`?d:s?o:f;return(0,z.jsxs)(`div`,{className:v(`sdd-node-enter group relative rounded-lg border bg-card/95 px-2.5 py-2 text-left shadow-lg backdrop-blur`,r.ring,s&&`sdd-node-running`,t.displayStatus===`completed`&&`sdd-node-complete`,t.displayStatus===`failed`&&`sdd-node-failed`,e.onTaskClick&&`hover:brightness-125`),style:{width:H,animationDelay:`${Math.min(e.index*45,600)}ms`},children:[e.onTaskClick&&(0,z.jsx)(`button`,{type:`button`,"aria-label":n(`activity:sdd.openTask`,{title:t.title,defaultValue:`Open task: ${t.title}`}),className:`absolute inset-0 z-10 cursor-pointer rounded-lg`,onClick:()=>e.onTaskClick?.(t.id)}),(0,z.jsx)(y,{type:`target`,position:x.Left,isConnectable:!1,className:`!h-1.5 !w-1.5 !border-0 !bg-border`}),(0,z.jsx)(y,{type:`source`,position:x.Right,isConnectable:!1,className:`!h-1.5 !w-1.5 !border-0 !bg-border`}),(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,z.jsx)(c,{className:v(`h-3.5 w-3.5`,s&&`animate-spin`,r.chip.split(` `).find(e=>e.startsWith(`text`)))}),(0,z.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:t.shortId}),(0,z.jsx)(`span`,{className:v(`font-mono text-[10px] font-bold uppercase`,M(t.priority).text),children:t.priority[0]}),(0,z.jsx)(`span`,{className:v(`ml-auto rounded px-1.5 py-px text-[9px] font-medium`,r.chip),children:n(`activity:sdd.status.${t.displayStatus}`)})]}),(0,z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[11px] leading-snug text-foreground`,children:t.title}),(t.agentName||t.worktreeBranch)&&(0,z.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[t.agentName&&(0,z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(`span`,{className:v(`flex h-4 w-4 items-center justify-center rounded-full text-[8px] font-bold text-white`,s?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:I(t.agentName)}),(0,z.jsx)(`span`,{className:`max-w-[88px] truncate text-[10px] text-muted-foreground`,children:t.agentName})]}),t.retries?(0,z.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-destructive`,children:[(0,z.jsx)(a,{className:`h-2.5 w-2.5`}),t.retries]}):null,t.worktreeBranch&&(0,z.jsxs)(`span`,{className:`ml-auto flex items-center gap-0.5 text-[9px] text-muted-foreground`,title:t.worktreeBranch,children:[(0,z.jsx)(i,{className:`h-2.5 w-2.5`}),(0,z.jsx)(`span`,{className:`max-w-[70px] truncate`,children:t.worktreeBranch.replace(/^.*\//,``)})]})]})]})}function G({data:e}){return(0,z.jsx)(`div`,{className:`whitespace-nowrap text-[11px] font-bold uppercase text-muted-foreground`,children:e.label})}var K={task:W,colLabel:G};function q(e,t,n){let r=new Map(e.map(e=>[e.shortId,e])),i=[],a=0;t.forEach((e,t)=>{i.push({id:`__col_${t}`,position:{x:t*B,y:-52},data:{label:e.label},draggable:!1,selectable:!1,type:`colLabel`,style:{pointerEvents:`none`}}),e.taskIds.forEach((e,o)=>{let s=r.get(e);s&&i.push({id:s.id,position:{x:t*B,y:o*V},data:{task:s,index:a++,onTaskClick:n},type:`task`,draggable:!0})})});let o=[];for(let t of e)for(let e of t.deps){let n=r.get(e);if(!n)continue;let i=n.displayStatus===`completed`&&(t.displayStatus===`in_progress`||t.displayStatus===`queued`);o.push({id:`${n.id}->${t.id}`,source:n.id,target:t.id,animated:i,className:i?`sdd-edge-flow`:void 0,style:{stroke:A(t.displayStatus).hex,strokeWidth:i?2.2:1.4,opacity:t.displayStatus===`pending`?.4:.85}})}return{nodes:i,edges:o}}function J({tasks:e,columns:t,onTaskClick:n}){let{fitView:r}=w(),{nodes:i,edges:a}=(0,O.useMemo)(()=>q(e,t,n),[e,t,n]),o=e.length;return(0,O.useEffect)(()=>{let e=setTimeout(()=>r({padding:.18,duration:400}),60);return()=>clearTimeout(e)},[o,r]),(0,z.jsxs)(D,{nodes:i,edges:a,nodeTypes:K,fitView:!0,fitViewOptions:{padding:.18},minZoom:.2,maxZoom:1.6,proOptions:{hideAttribution:!0},nodesConnectable:!1,elementsSelectable:!!n,children:[(0,z.jsx)(E,{variant:S.Dots,gap:22,size:1,color:`hsl(var(--border))`}),(0,z.jsx)(T,{showInteractive:!1,className:`!bottom-2 !left-2`}),(0,z.jsx)(C,{pannable:!0,zoomable:!0,nodeStrokeWidth:2,maskColor:`hsl(var(--background) / 0.65)`,nodeColor:e=>{let t=e.data?.task?.displayStatus;return t?A(t).hex:`hsl(var(--muted-foreground))`},className:`!bottom-2 !right-2 !h-24 !w-40 overflow-hidden rounded-md border border-border/70 bg-card`})]})}function Y({tasks:e,columns:t,onTaskClick:n}){return(0,z.jsx)(b,{children:(0,z.jsx)(J,{tasks:e,columns:t,onTaskClick:n})})}export{I as a,M as c,N as i,A as l,P as n,R as o,F as r,L as s,Y as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-BRAejDWd.js";import{Kr as r,Lt as i,Sr as a,St as ee,Tr as o,Vr as s,Z as te,en as ne,it as c,jt as re,mi as ie,mt as ae,vr as l,xr as u}from"./vendor-C9iFsXuW.js";import"./i18n-ClFSbktB.js";import{t as d}from"./utils-Bl7Yr7Bw.js";import{L as f,M as oe,S as p,d as se,j as m,l as ce,u as h}from"./index-DGwt4pL3.js";import{c as g,t as _}from"./SddFlowGraph-BGPIWq7W.js";var v=e(t(),1),y=n(),b={idle:`phaseStart`,questioning:`phaseInterview`,spec_review:`phaseSpecReview`,implementation:`phasePlanning`,task_review:`phaseTaskReview`,executing:`phaseRunning`,done:`phaseDone`},x=[`questioning`,`spec_review`,`implementation`,`task_review`,`executing`];function S({onClose:e}){let{t}=ie(),{client:n}=m(),o=f(e=>e.snapshot),c=f(e=>e.agentText),S=f(e=>e.error),T=f(e=>e.startedRunId),E=f(e=>e.setStartedRunId),[D,le]=(0,v.useState)(``),[O,k]=(0,v.useState)(``),[A,j]=(0,v.useState)(!1),[M,ue]=(0,v.useState)(!0),[N,P]=(0,v.useState)(!0),[F,I]=(0,v.useState)(!1),[L,R]=(0,v.useState)(void 0),[z,B]=(0,v.useState)(void 0),[V,H]=(0,v.useState)([]),[U,de]=(0,v.useState)(4),[W,fe]=(0,v.useState)(!0),G=se(F),K=(0,v.useCallback)(e=>n?.send?.(e),[n]),q=(0,v.useRef)(null);(0,v.useEffect)(()=>{K({type:`sdd.spec.get`})},[K]),(0,v.useEffect)(()=>{q.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[o?.answers.length??0,c]),(0,v.useEffect)(()=>{T&&(oe(`sddboard`),E(null))},[T,E]);let J=o?.busy??!1,Y=o?.phase??`idle`,X=!!o;(0,v.useEffect)(()=>{X&&j(!1)},[X]);let pe=o?.answers[o.answers.length-1]?.question??``,me=!!o&&(o.taskCount>0||!!o.graphId||Y===`task_review`||Y===`executing`),Z=()=>{let e=D.trim();!e||J||A||(j(!0),K({type:`sdd.spec.start`,payload:{goal:e}}))},Q=()=>{let e=O.trim();!e||J||(K({type:`sdd.spec.message`,payload:{text:e}}),k(``))},he=()=>!J&&K({type:`sdd.spec.approve`,payload:{}}),ge=()=>{K({type:`sdd.run.start`,payload:{parallelSlots:U,worktrees:W,...L?{model:L,provider:z}:{},...V.length?{fallbackModels:V}:{}}}),I(!1)},$=(0,v.useMemo)(()=>(o?.board?.tasks??[]).map(e=>({id:e.id,shortId:e.shortId,title:e.title,displayStatus:e.displayStatus,priority:e.priority,deps:e.deps,agentName:e.agentName,worktreeBranch:e.worktreeBranch,retries:e.retries})),[o?.board]),_e=$.length>0;return(0,y.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,y.jsxs)(`header`,{className:`sdd-sheen flex shrink-0 items-center justify-between border-b border-border px-4 py-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(s,{className:`h-5 w-5 text-primary`}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h1`,{className:`text-lg font-semibold`,children:o?.title||t(`activity:sddWizard.titleFallback`)}),X&&(0,y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t(`activity:sddWizard.${b[Y]??`phaseStart`}`),Y===`questioning`&&` · ${t(`activity:sddWizard.questionsSuffix`,{cur:o?.questionCount??0,max:o?.maxQuestions??0})}`,o&&o.taskCount>0?` · ${t(`activity:sddWizard.tasksSuffix`,{count:o.taskCount})}`:``]})]}),J&&(0,y.jsx)(r,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[me&&(0,y.jsxs)(`div`,{className:`relative flex items-center gap-1.5`,children:[(0,y.jsxs)(`button`,{type:`button`,onClick:()=>I(e=>!e),title:t(`activity:sddWizard.runCfgTitle`),className:d(`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs font-medium`,L||V.length?`border-primary/40 bg-primary/10 text-primary`:`border-border bg-muted text-muted-foreground hover:text-foreground`),children:[(0,y.jsx)(ee,{className:`h-3.5 w-3.5`}),L||t(`activity:sddWizard.modelsLabel`)]}),(0,y.jsxs)(`button`,{type:`button`,onClick:ge,className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success hover:bg-success/25`,children:[(0,y.jsx)(i,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddWizard.startRun`)]}),F&&(0,y.jsxs)(`div`,{className:`sdd-rise absolute right-0 top-9 z-50 w-72 rounded-lg border border-border bg-popover p-3 shadow-xl`,children:[(0,y.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:t(`activity:sddWizard.defaultWorkerModel`)}),(0,y.jsx)(h,{value:L,provider:z,candidates:G,placeholder:t(`activity:sddWizard.leaderDefaultPlaceholder`),resetLabel:t(`activity:sddWizard.useSessionDefault`),onPick:(e,t)=>{R(e),B(t)},onReset:L?()=>{R(void 0),B(void 0)}:void 0}),(0,y.jsx)(`div`,{className:`mb-1 mt-3 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:t(`activity:sddWizard.fallbackChain`)}),(0,y.jsx)(ce,{value:V,candidates:G,onChange:H}),(0,y.jsx)(`p`,{className:`mt-2 text-[10px] text-muted-foreground`,children:t(`activity:sddWizard.appliesToAll`)}),(0,y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,y.jsx)(`label`,{htmlFor:`sdd-slots`,className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:t(`activity:sddWizard.parallelAgents`)}),(0,y.jsx)(`input`,{id:`sdd-slots`,type:`number`,min:1,max:16,value:U,onChange:e=>{let t=Number.parseInt(e.target.value,10);de(Number.isFinite(t)?Math.min(16,Math.max(1,t)):1)},className:`w-16 rounded-md border border-border bg-background px-2 py-1 text-right text-xs outline-none focus:border-primary`})]}),(0,y.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:t(`activity:sddWizard.isolateWorktrees`)}),(0,y.jsx)(`input`,{type:`checkbox`,checked:W,onChange:e=>fe(e.target.checked),className:`h-3.5 w-3.5 accent-primary`})]}),(0,y.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:t(W?`activity:sddWizard.worktreeOn`:`activity:sddWizard.worktreeOff`)})]})]}),(0,y.jsx)(p,{variant:`ghost`,size:`icon`,onClick:e,children:(0,y.jsx)(te,{className:`h-4 w-4`})})]})]}),X&&(0,y.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 border-b bg-card/50 px-4 py-1.5 text-[11px]`,children:x.map((e,n)=>{let r=e===Y,i=x.indexOf(Y)>n;return(0,y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,y.jsxs)(`span`,{className:d(`rounded-full px-2 py-0.5`,r?`bg-primary/15 text-primary`:i?`text-success`:`text-muted-foreground`),children:[i&&(0,y.jsx)(a,{className:`mr-0.5 inline h-3 w-3`}),t(`activity:sddWizard.${b[e]}`)]}),n<x.length-1&&(0,y.jsx)(`span`,{className:`text-muted-foreground/65`,children:`→`})]},e)})}),(0,y.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:[S&&(0,y.jsx)(`div`,{className:`mb-3 rounded-md border border-destructive/40 bg-destructive/5 p-2 text-xs text-destructive`,children:S}),X?(0,y.jsxs)(`div`,{className:`space-y-4`,children:[_e&&(0,y.jsxs)(`div`,{className:`sdd-rise overflow-hidden rounded-lg border border-primary/20 bg-[hsl(var(--surface-2)/0.85)]`,children:[(0,y.jsxs)(`button`,{type:`button`,onClick:()=>ue(e=>!e),className:`flex w-full items-center gap-1.5 border-b border-border/60 px-3 py-1.5 text-[11px] font-medium text-primary hover:bg-muted/40`,children:[M?(0,y.jsx)(u,{className:`h-3.5 w-3.5`}):(0,y.jsx)(l,{className:`h-3.5 w-3.5`}),(0,y.jsx)(ne,{className:`h-3.5 w-3.5`}),t(`activity:sddWizard.taskGraphSummary`,{count:o?.taskCount??0}),(0,y.jsx)(`span`,{className:`ml-auto text-muted-foreground`,children:t(M?`activity:sddWizard.dragToExplore`:`activity:sddWizard.show`)})]}),M&&(0,y.jsx)(`div`,{className:`h-[32dvh] min-h-[200px]`,children:(0,y.jsx)(_,{tasks:$,columns:o?.board?.columns??[]})})]}),(0,y.jsxs)(`div`,{className:`mx-auto max-w-2xl space-y-3`,children:[o?.goal&&(0,y.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/30 px-3 py-2`,children:[(0,y.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,y.jsx)(ae,{className:`h-3 w-3`}),` `,t(`activity:sddWizard.goalLabel`)]}),(0,y.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:o.goal})]}),o?.answers.length||c&&Y===`questioning`||J?(0,y.jsxs)(`div`,{className:`space-y-2.5`,children:[o?.answers.map(e=>(0,y.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,y.jsx)(w,{speaker:`assistant`,text:e.question}),(0,y.jsx)(w,{speaker:`user`,text:e.answer})]},e.question.slice(0,64))),c&&Y===`questioning`&&c!==pe&&(0,y.jsx)(w,{speaker:`assistant`,text:c}),J&&(0,y.jsx)(w,{speaker:`assistant`,text:``,thinking:!0})]}):null,o?.spec&&(0,y.jsxs)(`div`,{className:`sdd-rise rounded-md border border-border bg-card p-3`,children:[(0,y.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-sm font-semibold`,children:[(0,y.jsx)(s,{className:`h-3.5 w-3.5 text-primary`}),o.spec.title]}),(0,y.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:o.spec.overview}),(0,y.jsx)(`ul`,{className:`space-y-0.5 text-xs`,children:o.spec.requirements.map(e=>(0,y.jsxs)(`li`,{className:`flex gap-1.5`,children:[(0,y.jsx)(`span`,{className:d(`shrink-0 font-mono uppercase`,g(e.priority).text),children:e.priority[0]}),(0,y.jsx)(`span`,{children:e.description})]},`${e.priority}-${e.description.slice(0,32)}`))})]}),c&&(Y===`implementation`||Y===`task_review`)&&(0,y.jsxs)(`div`,{className:`sdd-rise rounded-md border border-border bg-card`,children:[(0,y.jsxs)(`button`,{type:`button`,onClick:()=>P(e=>!e),className:`flex w-full items-center gap-1.5 border-b border-border/60 px-3 py-2 text-sm font-semibold hover:bg-muted/40`,children:[N?(0,y.jsx)(u,{className:`h-3.5 w-3.5`}):(0,y.jsx)(l,{className:`h-3.5 w-3.5`}),(0,y.jsx)(s,{className:`h-3.5 w-3.5 text-primary`}),` `,t(`activity:sddWizard.implementationPlan`)]}),N&&(0,y.jsx)(`div`,{className:`max-h-[40dvh] overflow-auto px-3 py-2`,children:(0,y.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:C(c)})})]}),c&&Y!==`questioning`&&Y!==`implementation`&&Y!==`task_review`&&!o?.spec&&(0,y.jsx)(w,{speaker:`assistant`,text:c}),(Y===`spec_review`||Y===`implementation`||Y===`task_review`)&&(0,y.jsxs)(p,{variant:`secondary`,onClick:he,disabled:J,children:[(0,y.jsx)(a,{className:`mr-1.5 h-4 w-4`}),t(Y===`spec_review`?`activity:sddWizard.approveSpec`:Y===`task_review`?`activity:sddWizard.approveTasks`:`activity:sddWizard.approvePlan`)]}),(0,y.jsx)(`div`,{ref:q})]})]}):(0,y.jsxs)(`div`,{className:`mx-auto mt-8 max-w-xl`,children:[(0,y.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,htmlFor:`sdd-goal`,children:t(`activity:sddWizard.goalPrompt`)}),(0,y.jsx)(`textarea`,{id:`sdd-goal`,value:D,onChange:e=>le(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&Z()},rows:4,placeholder:t(`activity:sddWizard.goalPlaceholder`),className:`w-full resize-none rounded-md border border-border bg-card px-3 py-2 text-sm outline-none focus:border-primary`}),(0,y.jsx)(p,{className:`mt-3`,onClick:Z,disabled:!D.trim()||A,children:A?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(r,{className:`mr-1.5 h-4 w-4 animate-spin`}),` `,t(`activity:sddWizard.startingInterview`)]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(s,{className:`mr-1.5 h-4 w-4`}),` `,t(`activity:sddWizard.startInterview`)]})}),(0,y.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:t(`activity:sddWizard.introBody`)})]})]}),X&&Y!==`executing`&&Y!==`done`&&(0,y.jsxs)(`div`,{className:`flex shrink-0 items-end gap-2 border-t bg-card px-4 py-2`,children:[(0,y.jsx)(`textarea`,{value:O,onChange:e=>k(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),Q())},rows:1,placeholder:t(Y===`questioning`?`activity:sddWizard.answerPlaceholder`:`activity:sddWizard.changePlaceholder`),disabled:J,className:`max-h-32 flex-1 resize-none rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary disabled:opacity-50`}),(0,y.jsx)(p,{size:`icon`,onClick:Q,disabled:J||!O.trim(),children:(0,y.jsx)(re,{className:`h-4 w-4`})})]})]})}function C(e){let t=e.replace(/```json[\s\S]*?```/gi,``).trim();return t.length>0?t:e.trim()}function w({speaker:e,text:t,live:n,thinking:r}){let i=e===`user`;return(0,y.jsxs)(`div`,{className:d(`sdd-rise flex items-start gap-2`,i&&`flex-row-reverse`),children:[(0,y.jsx)(`span`,{className:d(`mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full`,i?`bg-info/15 text-info`:`bg-primary/15 text-primary`,(n||r)&&`sdd-agent-live`),children:i?(0,y.jsx)(c,{className:`h-3.5 w-3.5`}):(0,y.jsx)(o,{className:`h-3.5 w-3.5`})}),(0,y.jsx)(`div`,{className:d(`max-w-[80%] whitespace-pre-wrap rounded-2xl px-3 py-2 text-sm leading-relaxed text-foreground`,i?`rounded-tr-sm bg-info/10`:`rounded-tl-sm bg-muted`),children:r?(0,y.jsxs)(`span`,{className:`flex items-center gap-1 py-0.5`,children:[(0,y.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground [animation-delay:-200ms]`}),(0,y.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground [animation-delay:-100ms]`}),(0,y.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground`})]}):t})]})}export{S as SddWizard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{$ as r,Fr as i,Hn as a,Vt as o,Wr as s,ai as c,et as l,fi as u,hi as d,ii as f,oi as p,or as m,ur as h}from"./vendor-CyLvG8N0.js";import"./i18n-BMePmaPJ.js";import{t as g}from"./utils-CU_o9ioU.js";var _=e(t(),1),v=n();async function y(e){try{let t=await e.clone().json(),n=typeof t.error==`string`?t.error:t.message;if(typeof n==`string`&&n.trim())return n}catch{try{let t=await e.text();if(t.trim())return t.trim()}catch{}}return e.statusText||`HTTP ${e.status}`}function b(e){switch(e){case`running`:return{icon:(0,v.jsx)(i,{className:`h-3.5 w-3.5`}),cls:`text-success`};case`streaming`:return{icon:(0,v.jsx)(o,{className:`h-3.5 w-3.5`}),cls:`text-primary`};case`waiting_user`:return{icon:(0,v.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-warning`};case`error`:return{icon:(0,v.jsx)(p,{className:`h-3.5 w-3.5`}),cls:`text-destructive`};case`idle`:return{icon:(0,v.jsx)(f,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`};default:return{icon:(0,v.jsx)(c,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`}}}function x(e){switch(e){case`active`:return{icon:(0,v.jsx)(r,{className:`h-3.5 w-3.5`}),cls:`text-success`,badge:`border-success/25 bg-success/8 text-success`};case`idle`:return{icon:(0,v.jsx)(l,{className:`h-3.5 w-3.5`}),cls:`text-primary`,badge:`border-primary/25 bg-primary/10 text-primary`};case`closing`:return{icon:(0,v.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-warning`,badge:`border-warning/25 bg-warning/10 text-warning`};case`lost`:return{icon:(0,v.jsx)(l,{className:`h-3.5 w-3.5`}),cls:`text-destructive/60`,badge:`border-destructive/15 bg-destructive/5 text-destructive/70`};default:return{icon:(0,v.jsx)(l,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`,badge:`border-border bg-muted text-muted-foreground`}}}function S(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`<1m`;if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d`}function C(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/1e3);if(n<10)return d.t(`common:time.justNow`);if(n<60)return d.t(`common:time.secondsAgo`,{count:n});let r=Math.floor(n/60);return r<60?d.t(`common:time.minutesAgo`,{count:r}):d.t(`common:time.hoursAgo`,{count:Math.floor(r/60)})}function w(){let{t:e}=u(),[t,n]=(0,_.useState)([]),[i,o]=(0,_.useState)(!0),[c,d]=(0,_.useState)(null),f=(0,_.useCallback)(async()=>{try{let e=await fetch(`/api/sessions`);if(!e.ok){if(e.status===404){d(null),n([]);return}throw Error(`HTTP ${e.status}: ${await y(e)}`)}if(!(e.headers.get(`content-type`)?.toLowerCase()??``).includes(`application/json`)){d(null),n([]);return}let t=await e.json();if(!Array.isArray(t)){d(null),n([]);return}n(e=>{let n=t;if(e.length===n.length){let t=!0;for(let r=0;r<n.length;r++){let i=n[r],a=e[r];if(i.sessionId!==a.sessionId||i.status!==a.status||i.agentCount!==a.agentCount||i.startedAt!==a.startedAt){t=!1;break}}if(t)return e}return n}),d(null)}catch(e){if(e instanceof SyntaxError){d(null),n([]);return}d(e instanceof Error?e.message:String(e))}finally{o(!1)}},[]);(0,_.useEffect)(()=>{f();let e=setInterval(f,5e3);return()=>clearInterval(e)},[f]);let w=t.filter(e=>e.status===`active`).length,T=t.reduce((e,t)=>e+t.agentCount,0);return i?(0,v.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,v.jsxs)(`div`,{className:`ws-surface flex items-center gap-2 rounded-xl px-4 py-3 text-sm text-muted-foreground`,children:[(0,v.jsx)(s,{className:`h-4 w-4 animate-spin text-primary`}),e(`activity:liveSessions.loading`)]})}):c?(0,v.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,v.jsxs)(`div`,{className:`ws-surface max-w-lg rounded-xl p-5 text-center`,children:[(0,v.jsx)(p,{className:`mx-auto h-8 w-8 text-warning`}),(0,v.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e(`activity:liveSessions.apiUnavailable`)}),(0,v.jsx)(`p`,{className:`mt-1 break-words text-xs text-muted-foreground`,children:c})]})}):t.length===0?(0,v.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,v.jsxs)(`div`,{className:`ws-surface max-w-md rounded-xl p-6 text-center text-muted-foreground`,children:[(0,v.jsx)(l,{className:`mx-auto h-9 w-9 opacity-50`}),(0,v.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:e(`activity:liveSessions.empty`)}),(0,v.jsx)(`p`,{className:`mt-1 text-xs`,children:e(`activity:liveSessions.autoRefresh`)})]})}):(0,v.jsx)(`div`,{className:`h-full min-h-0 overflow-y-auto bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,v.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col gap-4`,children:[(0,v.jsx)(`header`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,v.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(r,{className:`h-4 w-4 text-primary`}),(0,v.jsx)(`h2`,{className:`text-base font-semibold`,children:e(`activity:liveSessions.heading`,{count:t.length})})]}),(0,v.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`activity:liveSessions.autoRefresh`)})]}),(0,v.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-center sm:min-w-[22rem]`,children:[(0,v.jsxs)(`div`,{className:`rounded-lg border border-border/70 bg-background/60 px-3 py-2`,children:[(0,v.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:t.length}),(0,v.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:`Sessions`})]}),(0,v.jsxs)(`div`,{className:`rounded-lg border border-border/70 bg-background/60 px-3 py-2`,children:[(0,v.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-success`,children:w}),(0,v.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:`Active`})]}),(0,v.jsxs)(`div`,{className:`rounded-lg border border-border/70 bg-background/60 px-3 py-2`,children:[(0,v.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:T}),(0,v.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:`Agents`})]})]})]})}),(0,v.jsx)(`div`,{className:`grid gap-3`,children:t.map(t=>{let n=x(t.status);return(0,v.jsxs)(`article`,{className:`rounded-xl border border-border/70 bg-card/75 p-3 shadow-sm sm:p-4`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,v.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,v.jsx)(`span`,{className:n.cls,children:n.icon}),(0,v.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold`,title:t.projectName,children:t.projectName}),(0,v.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:t.projectSlug}),(0,v.jsx)(`span`,{className:`inline-flex items-center rounded-md border px-1.5 py-0.5 text-[10px] font-semibold uppercase ${n.badge}`,children:t.status})]}),(0,v.jsxs)(`div`,{className:`mt-2 grid gap-1.5 text-xs text-muted-foreground md:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,v.jsx)(m,{className:`h-3.5 w-3.5 shrink-0`}),(0,v.jsx)(`span`,{className:`min-w-0 truncate font-mono`,title:t.workingDir,children:t.workingDir})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[t.gitBranch?(0,v.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1 text-primary`,children:[(0,v.jsx)(a,{className:`h-3.5 w-3.5 shrink-0`}),(0,v.jsx)(`span`,{className:`truncate font-mono`,children:t.gitBranch})]}):null,(0,v.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,v.jsx)(h,{className:`h-3.5 w-3.5`}),S(t.startedAt)]}),(0,v.jsx)(`span`,{className:`font-mono`,children:e(`activity:liveSessions.pidLabel`,{pid:t.pid})})]})]})]}),(0,v.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs sm:grid-cols-3 lg:w-64`,children:[(0,v.jsxs)(`div`,{className:`rounded-lg border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,v.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Agents`}),(0,v.jsx)(`div`,{className:`font-semibold tabular-nums`,children:t.agentCount})]}),(0,v.jsxs)(`div`,{className:`rounded-lg border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,v.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Status`}),(0,v.jsx)(`div`,{className:`truncate font-mono font-semibold`,children:t.status})]}),(0,v.jsxs)(`div`,{className:`rounded-lg border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,v.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Runtime`}),(0,v.jsx)(`div`,{className:`font-mono font-semibold`,children:S(t.startedAt)})]})]})]}),(0,v.jsxs)(`div`,{className:`mt-3 overflow-hidden rounded-lg border border-border/70 bg-background/45`,children:[t.agents.length===0?(0,v.jsx)(`div`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e(`activity:liveSessions.noAgents`)}):(0,v.jsx)(`div`,{className:`divide-y divide-border/60`,children:t.agents.slice(0,5).map(t=>{let n=b(t.status);return(0,v.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1 px-3 py-2 text-xs sm:grid-cols-[auto_minmax(0,1fr)_minmax(0,14rem)_auto]`,children:[(0,v.jsx)(`span`,{className:g(`mt-0.5 shrink-0`,n.cls),children:n.icon}),(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(`div`,{className:`truncate font-medium`,title:t.name,children:t.name}),(0,v.jsx)(`div`,{className:`font-mono text-[10px] text-muted-foreground`,children:e(`activity:liveSessions.agentMeta`,{iter:t.iterations,tools:t.toolCalls,ago:C(t.lastActivityAt)})})]}),(0,v.jsx)(`div`,{className:`min-w-0 font-mono text-[10px] text-muted-foreground sm:text-xs`,children:t.currentTool?(0,v.jsx)(`span`,{className:`block truncate`,title:t.currentTool,children:t.currentTool}):(0,v.jsx)(`span`,{className:`text-muted-foreground/60`,children:t.status})}),(0,v.jsx)(`span`,{className:`hidden font-mono text-[10px] text-muted-foreground sm:block`,children:C(t.lastActivityAt)})]},t.id)})}),t.agents.length>5?(0,v.jsx)(`div`,{className:`border-t border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:e(`activity:liveSessions.andMore`,{count:t.agents.length-5})}):null]})]},t.sessionId)})})]})})}export{w as SessionsDashboard};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-BRAejDWd.js";import{$ as r,Kr as i,Lr as a,Vt as o,Wn as s,_i as c,ci as l,cr as u,et as d,fr as f,mi as p,oi as m,si as h}from"./vendor-C9iFsXuW.js";import"./i18n-ClFSbktB.js";import{t as g}from"./utils-Bl7Yr7Bw.js";var _=e(t(),1),v=n();async function y(e){try{let t=await e.clone().json(),n=typeof t.error==`string`?t.error:t.message;if(typeof n==`string`&&n.trim())return n}catch{try{let t=await e.text();if(t.trim())return t.trim()}catch{}}return e.statusText||`HTTP ${e.status}`}function b(e){switch(e){case`running`:return{icon:(0,v.jsx)(a,{className:`h-3.5 w-3.5`}),cls:`text-success`};case`streaming`:return{icon:(0,v.jsx)(o,{className:`h-3.5 w-3.5`}),cls:`text-primary`};case`waiting_user`:return{icon:(0,v.jsx)(f,{className:`h-3.5 w-3.5`}),cls:`text-warning`};case`error`:return{icon:(0,v.jsx)(l,{className:`h-3.5 w-3.5`}),cls:`text-destructive`};case`idle`:return{icon:(0,v.jsx)(m,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`};default:return{icon:(0,v.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`}}}function x(e){switch(e){case`active`:return{icon:(0,v.jsx)(r,{className:`h-3.5 w-3.5`}),cls:`text-success`,badge:`border-success/25 bg-success/8 text-success`};case`idle`:return{icon:(0,v.jsx)(d,{className:`h-3.5 w-3.5`}),cls:`text-primary`,badge:`border-primary/25 bg-primary/10 text-primary`};case`closing`:return{icon:(0,v.jsx)(f,{className:`h-3.5 w-3.5`}),cls:`text-warning`,badge:`border-warning/25 bg-warning/10 text-warning`};case`lost`:return{icon:(0,v.jsx)(d,{className:`h-3.5 w-3.5`}),cls:`text-destructive/60`,badge:`border-destructive/15 bg-destructive/5 text-destructive/70`};default:return{icon:(0,v.jsx)(d,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`,badge:`border-border bg-muted text-muted-foreground`}}}function S(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`<1m`;if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d`}function C(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/1e3);if(n<10)return c.t(`common:time.justNow`);if(n<60)return c.t(`common:time.secondsAgo`,{count:n});let r=Math.floor(n/60);return r<60?c.t(`common:time.minutesAgo`,{count:r}):c.t(`common:time.hoursAgo`,{count:Math.floor(r/60)})}function w(){let{t:e}=p(),[t,n]=(0,_.useState)([]),[a,o]=(0,_.useState)(!0),[c,m]=(0,_.useState)(null),h=(0,_.useCallback)(async()=>{try{let e=await fetch(`/api/sessions`);if(!e.ok){if(e.status===404){m(null),n([]);return}throw Error(`HTTP ${e.status}: ${await y(e)}`)}if(!(e.headers.get(`content-type`)?.toLowerCase()??``).includes(`application/json`)){m(null),n([]);return}let t=await e.json();if(!Array.isArray(t)){m(null),n([]);return}n(e=>{let n=t;if(e.length===n.length){let t=!0;for(let r=0;r<n.length;r++){let i=n[r],a=e[r];if(i.sessionId!==a.sessionId||i.status!==a.status||i.agentCount!==a.agentCount||i.startedAt!==a.startedAt){t=!1;break}}if(t)return e}return n}),m(null)}catch(e){if(e instanceof SyntaxError){m(null),n([]);return}m(e instanceof Error?e.message:String(e))}finally{o(!1)}},[]);(0,_.useEffect)(()=>{h();let e=setInterval(h,5e3);return()=>clearInterval(e)},[h]);let w=t.filter(e=>e.status===`active`).length,T=t.reduce((e,t)=>e+t.agentCount,0);return a?(0,v.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,v.jsxs)(`div`,{className:`ws-surface flex items-center gap-2 rounded-xl px-4 py-3 text-sm text-muted-foreground`,children:[(0,v.jsx)(i,{className:`h-4 w-4 animate-spin text-primary`}),e(`activity:liveSessions.loading`)]})}):c?(0,v.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,v.jsxs)(`div`,{className:`ws-surface max-w-lg rounded-xl p-5 text-center`,children:[(0,v.jsx)(l,{className:`mx-auto h-8 w-8 text-warning`}),(0,v.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e(`activity:liveSessions.apiUnavailable`)}),(0,v.jsx)(`p`,{className:`mt-1 break-words text-xs text-muted-foreground`,children:c})]})}):t.length===0?(0,v.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,v.jsxs)(`div`,{className:`ws-surface max-w-md rounded-xl p-6 text-center text-muted-foreground`,children:[(0,v.jsx)(d,{className:`mx-auto h-9 w-9 opacity-50`}),(0,v.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:e(`activity:liveSessions.empty`)}),(0,v.jsx)(`p`,{className:`mt-1 text-xs`,children:e(`activity:liveSessions.autoRefresh`)})]})}):(0,v.jsx)(`div`,{className:`h-full min-h-0 overflow-y-auto bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,v.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col gap-4`,children:[(0,v.jsx)(`header`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,v.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(r,{className:`h-4 w-4 text-primary`}),(0,v.jsx)(`h2`,{className:`text-base font-semibold`,children:e(`activity:liveSessions.heading`,{count:t.length})})]}),(0,v.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`activity:liveSessions.autoRefresh`)})]}),(0,v.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-center sm:min-w-[22rem]`,children:[(0,v.jsxs)(`div`,{className:`rounded-lg border border-border/70 bg-background/60 px-3 py-2`,children:[(0,v.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:t.length}),(0,v.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:`Sessions`})]}),(0,v.jsxs)(`div`,{className:`rounded-lg border border-border/70 bg-background/60 px-3 py-2`,children:[(0,v.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-success`,children:w}),(0,v.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:`Active`})]}),(0,v.jsxs)(`div`,{className:`rounded-lg border border-border/70 bg-background/60 px-3 py-2`,children:[(0,v.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:T}),(0,v.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:`Agents`})]})]})]})}),(0,v.jsx)(`div`,{className:`grid gap-3`,children:t.map(t=>{let n=x(t.status);return(0,v.jsxs)(`article`,{className:`rounded-xl border border-border/70 bg-card/75 p-3 shadow-sm sm:p-4`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,v.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,v.jsx)(`span`,{className:n.cls,children:n.icon}),(0,v.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold`,title:t.projectName,children:t.projectName}),(0,v.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:t.projectSlug}),(0,v.jsx)(`span`,{className:`inline-flex items-center rounded-md border px-1.5 py-0.5 text-[10px] font-semibold uppercase ${n.badge}`,children:t.status})]}),(0,v.jsxs)(`div`,{className:`mt-2 grid gap-1.5 text-xs text-muted-foreground md:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,v.jsx)(u,{className:`h-3.5 w-3.5 shrink-0`}),(0,v.jsx)(`span`,{className:`min-w-0 truncate font-mono`,title:t.workingDir,children:t.workingDir})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[t.gitBranch?(0,v.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1 text-primary`,children:[(0,v.jsx)(s,{className:`h-3.5 w-3.5 shrink-0`}),(0,v.jsx)(`span`,{className:`truncate font-mono`,children:t.gitBranch})]}):null,(0,v.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,v.jsx)(f,{className:`h-3.5 w-3.5`}),S(t.startedAt)]}),(0,v.jsx)(`span`,{className:`font-mono`,children:e(`activity:liveSessions.pidLabel`,{pid:t.pid})})]})]})]}),(0,v.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs sm:grid-cols-3 lg:w-64`,children:[(0,v.jsxs)(`div`,{className:`rounded-lg border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,v.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Agents`}),(0,v.jsx)(`div`,{className:`font-semibold tabular-nums`,children:t.agentCount})]}),(0,v.jsxs)(`div`,{className:`rounded-lg border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,v.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Status`}),(0,v.jsx)(`div`,{className:`truncate font-mono font-semibold`,children:t.status})]}),(0,v.jsxs)(`div`,{className:`rounded-lg border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,v.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Runtime`}),(0,v.jsx)(`div`,{className:`font-mono font-semibold`,children:S(t.startedAt)})]})]})]}),(0,v.jsxs)(`div`,{className:`mt-3 overflow-hidden rounded-lg border border-border/70 bg-background/45`,children:[t.agents.length===0?(0,v.jsx)(`div`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e(`activity:liveSessions.noAgents`)}):(0,v.jsx)(`div`,{className:`divide-y divide-border/60`,children:t.agents.slice(0,5).map(t=>{let n=b(t.status);return(0,v.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1 px-3 py-2 text-xs sm:grid-cols-[auto_minmax(0,1fr)_minmax(0,14rem)_auto]`,children:[(0,v.jsx)(`span`,{className:g(`mt-0.5 shrink-0`,n.cls),children:n.icon}),(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(`div`,{className:`truncate font-medium`,title:t.name,children:t.name}),(0,v.jsx)(`div`,{className:`font-mono text-[10px] text-muted-foreground`,children:e(`activity:liveSessions.agentMeta`,{iter:t.iterations,tools:t.toolCalls,ago:C(t.lastActivityAt)})})]}),(0,v.jsx)(`div`,{className:`min-w-0 font-mono text-[10px] text-muted-foreground sm:text-xs`,children:t.currentTool?(0,v.jsx)(`span`,{className:`block truncate`,title:t.currentTool,children:t.currentTool}):(0,v.jsx)(`span`,{className:`text-muted-foreground/75`,children:t.status})}),(0,v.jsx)(`span`,{className:`hidden font-mono text-[10px] text-muted-foreground sm:block`,children:C(t.lastActivityAt)})]},t.id)})}),t.agents.length>5?(0,v.jsx)(`div`,{className:`border-t border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:e(`activity:liveSessions.andMore`,{count:t.agents.length-5})}):null]})]},t.sessionId)})})]})})}export{w as SessionsDashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-BRAejDWd.js";import{Bt as r,Gt as i,Kr as a,Ln as o,Nn as s,Ot as c,Sr as l,Tn as u,Tr as d,Vr as f,X as p,Y as m,_i as h,jr as g,mi as _,t as v,tr as y,ur as b,vr as x,wt as S,xr as ee}from"./vendor-C9iFsXuW.js";import"./i18n-ClFSbktB.js";import{t as C}from"./ws-client-WVS5hdJj.js";import{t as w}from"./utils-Bl7Yr7Bw.js";import{C as T,D as te,J as ne,N as E,O as D,P as O,S as k,T as re,c as A,f as j,j as M,m as N,n as P,r as F,t as I,w as ie}from"./index-DGwt4pL3.js";var L=e(t(),1),ae=e(v(),1),R=n();function z(e,t=8e3){return new Promise((n,r)=>{let i=setTimeout(()=>{a(),r(Error(`timeout`))},t),a=e.on(`key.operation_result`,e=>{clearTimeout(i),a(),n(e.payload)})})}var B=[{id:`openai`,name:`OpenAI`,description:`GPT, o-series, and Codex models`,icon:`🤖`,color:`from-success/12 to-success/5 border-success/30 hover:border-success/50`,keyPlaceholder:`sk-...`,docsUrl:`https://platform.openai.com/api-keys`,family:`openai`},{id:`anthropic`,name:`Anthropic`,description:`Claude model access`,icon:`🧠`,color:`from-warning/12 to-warning/5 border-warning/30 hover:border-warning/50`,keyPlaceholder:`sk-ant-...`,docsUrl:`https://console.anthropic.com/settings/keys`,family:`anthropic`},{id:`google`,name:`Google`,description:`Gemini Pro, Flash, and Nano`,icon:`✨`,color:`from-info/12 to-info/5 border-info/30 hover:border-info/50`,keyPlaceholder:`AIza...`,docsUrl:`https://aistudio.google.com/apikey`,family:`google`},{id:`deepseek`,name:`DeepSeek`,description:`High-performance reasoning at low cost`,icon:`🐋`,color:`from-primary/12 to-primary/5 border-primary/30 hover:border-primary/50`,keyPlaceholder:`sk-...`,docsUrl:`https://platform.deepseek.com/api_keys`,family:`openai-compatible`},{id:`openrouter`,name:`OpenRouter`,description:`All models via one key`,icon:`🔀`,color:`from-primary/12 to-primary/5 border-primary/30 hover:border-primary/50`,keyPlaceholder:`sk-or-...`,docsUrl:`https://openrouter.ai/keys`,family:`openai-compatible`},{id:`minimax`,name:`MiniMax`,description:`Subscribe to one plan and unlock the latest models, including frontier coding capabilities, 1M ultra-long context, and native multimodality. Text, image, and speech models all share the same quota. Invite Friends, Win Together: Friends get 10% off plus Builder benefits when they subscribe, while referrers earn 10% cashback plus community perks.`,icon:`🔮`,color:`from-destructive/10 to-destructive/5 border-destructive/25 hover:border-destructive/45`,keyPlaceholder:`eyJ...`,docsUrl:`https://platform.minimax.io/subscribe/token-plan?code=JrA4R9QAEn&source=link`,family:`openai-compatible`},{id:`kimi`,name:`Kimi`,description:`Moonshot AI long-context models`,icon:`🌙`,color:`from-info/12 to-info/5 border-info/30 hover:border-info/50`,keyPlaceholder:`sk-...`,docsUrl:`https://www.kimi.com/membership/pricing`,family:`openai-compatible`},{id:`zai`,name:`Z.ai (GLM)`,description:`You've been invited to join the GLM Coding Plan! Enjoy full support for Claude Code, Cline, and 20+ top coding tools — starting at just $18/month. Subscribe now and grab the limited-time deal!`,icon:`🔷`,color:`from-primary/12 to-primary/5 border-primary/30 hover:border-primary/50`,keyPlaceholder:`...`,docsUrl:`https://z.ai/subscribe?ic=JQZ7TPPRA6`,family:`openai-compatible`},{id:`opencode-go`,name:`OpenCode Go`,description:`Global hosted API for 75+ LLM providers — stable access from US, EU, and Singapore`,icon:`🌍`,color:`from-success/12 to-success/5 border-success/30 hover:border-success/50`,keyPlaceholder:`oc-...`,docsUrl:`https://opencode.ai/go?ref=6VZAER87H4`,family:`openai-compatible`}];async function V(e,t){try{let n=await fetch(e,{signal:t});if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();if(!Array.isArray(r))throw Error(`Expected JSON array`);let i=r.filter(e=>typeof e.id==`string`&&typeof e.name==`string`&&typeof e.family==`string`);return i.length>0?i:B}catch{return B}}function H({popular:e,catalogProvider:t,savedProvider:n,onKeySaved:r}){let{t:i}=_(),[s,u]=(0,L.useState)(``),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(!!n?.apiKeys.some(e=>e.isActive)),[h,g]=(0,L.useState)(!1),[v,S]=(0,L.useState)(!1),[E,A]=(0,L.useState)(!1),[j,M]=(0,L.useState)(null);(0,L.useEffect)(()=>{E&&e.referral&&ae.toDataURL(e.referral.url,{width:200,margin:2,color:{dark:`#000000`,light:`#ffffff`}}).then(e=>M(e)).catch(()=>M(null))},[E,e.referral]);let B=async()=>{if(s.trim()){f(!0);try{let n=C(ne.getState().wsUrl),a=z(n);t?n.addKey(e.id,`default`,s.trim()):n.send({type:`provider.add`,payload:{id:e.id,family:e.family,apiKey:s.trim()}});let o=await a;if(!o.success)throw Error(o.message);m(!0),u(``),O.success(i(`setup:screen.toasts.keySaved`,{name:e.name})),r(e.id),P(`provider_key_saved`,`engagement`,{label:e.name,metadata:{providerId:e.id,providerFamily:e.family,hasReferral:!!e.referral,isNewProvider:!t}}),e.referral&&F(e.id,e.name)}catch(t){let n=t instanceof Error&&t.message&&t.message!==`timeout`?t.message:null;O.error(n??i(`setup:screen.toasts.keySaveFailed`,{name:e.name})),P(`provider_key_save_failed`,`error`,{label:e.name,metadata:{providerId:e.id,providerFamily:e.family}})}finally{f(!1)}}},V=e=>{e.key===`Enter`&&s.trim()&&B()},H=async()=>{if(e.referral)try{await navigator.clipboard.writeText(e.referral.url),S(!0),O.success(i(`setup:screen.toasts.referralCopied`)),setTimeout(()=>S(!1),2e3),P(`referral_link_copied`,`engagement`,{label:e.name,metadata:{providerId:e.id,referralCode:e.referral.code,referralUrl:e.referral.url}})}catch{O.error(i(`setup:screen.toasts.referralCopyFailed`)),P(`referral_link_copy_failed`,`error`,{label:e.name,metadata:{providerId:e.id,referralCode:e.referral.code}})}},oe=t&&t.modelCount>0;return(0,R.jsxs)(`div`,{className:w(`rounded-xl border p-4 transition-all`,p?`border-success/30 bg-success/5`:`bg-gradient-to-br ${e.color}`),children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`span`,{className:`text-2xl shrink-0 mt-0.5`,children:e.icon}),(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),p&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-success/10 text-success border border-success/20`,children:[(0,R.jsx)(l,{className:`h-2.5 w-2.5`}),i(`setup:screen.card.keySaved`)]}),e.referral&&!p&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-warning/10 text-warning border border-warning/20`,children:[(0,R.jsx)(o,{className:`h-2.5 w-2.5`}),i(`setup:screen.card.referral`)]})]}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),e.referral&&!p&&(0,R.jsxs)(`p`,{className:`text-[11px] text-warning/80 mt-1`,children:[`🎁 `,e.referral.reward]}),p?oe?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>g(!h),className:`mt-2 text-[11px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1`,children:[i(`setup:screen.providers.modelsAvailable`,{count:t?.modelCount??0}),h?(0,R.jsx)(ee,{className:`h-3 w-3`}):(0,R.jsx)(x,{className:`h-3 w-3`})]}):null:(0,R.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(N,{type:`password`,placeholder:e.keyPlaceholder,value:s,onChange:e=>u(e.target.value),onKeyDown:V,className:`font-mono text-sm`}),(0,R.jsx)(k,{onClick:B,disabled:!s.trim()||d,size:`sm`,className:`shrink-0`,children:d?(0,R.jsx)(a,{className:`h-4 w-4 animate-spin`}):i(`setup:screen.card.save`)})]}),e.docsUrl&&(0,R.jsxs)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors`,onClick:()=>{P(`provider_docs_link_clicked`,`engagement`,{label:e.name,metadata:{providerId:e.id,docsUrl:e.docsUrl,hasReferral:!!e.referral}}),e.referral&&I({providerId:e.id,providerName:e.name,referralCode:e.referral.code,clickedAt:new Date().toISOString(),docsUrl:e.docsUrl??``})},children:[i(`setup:screen.card.getKey`),` `,(0,R.jsx)(y,{className:`h-3 w-3`})]}),e.referral&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:H,className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:v?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(l,{className:`h-3 w-3`}),` `,i(`setup:screen.card.copied`)]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(b,{className:`h-3 w-3`}),` `,i(`setup:screen.card.copyReferral`)]})}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>A(!0),className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:[(0,R.jsx)(c,{className:`h-3 w-3`}),` `,i(`setup:screen.card.share`)]})]})]})]})]}),(0,R.jsx)(T,{open:E,onOpenChange:A,children:(0,R.jsxs)(ie,{className:`sm:max-w-md`,children:[(0,R.jsxs)(te,{children:[(0,R.jsxs)(D,{className:`flex items-center gap-2`,children:[(0,R.jsx)(o,{className:`h-4 w-4 text-warning`}),i(`setup:screen.share.title`,{name:e.name})]}),(0,R.jsx)(re,{children:i(`setup:screen.share.description`)})]}),(0,R.jsx)(`div`,{className:`flex flex-col items-center gap-4 py-4`,children:e.referral&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`text-sm text-center`,children:(0,R.jsxs)(`p`,{className:`font-medium text-warning`,children:[`🎁 `,e.referral.reward]})}),j?(0,R.jsx)(`div`,{className:`rounded-lg border border-border p-2 bg-white`,children:(0,R.jsx)(`img`,{src:j,alt:i(`setup:screen.card.qrAlt`,{name:e.name}),className:`w-[200px] h-[200px]`})}):(0,R.jsx)(`div`,{className:`w-[200px] h-[200px] rounded-lg border border-border flex items-center justify-center bg-muted`,children:(0,R.jsx)(a,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),(0,R.jsxs)(`div`,{className:`w-full space-y-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://twitter.com/intent/tweet?text=${t}&url=${n}`,`_blank`,`noopener,noreferrer`),P(`referral_share_twitter`,`engagement`,{label:e.name,metadata:{providerId:e.id}})},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:i(`setup:screen.share.twitter`),children:[(0,R.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,R.jsx)(`path`,{d:`M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z`})}),`X`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`Check out ${e.name}! ${e.referral.reward}`);window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${t}&summary=${n}`,`_blank`,`noopener,noreferrer`),P(`referral_share_linkedin`,`engagement`,{label:e.name,metadata:{providerId:e.id}})},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:i(`setup:screen.share.linkedin`),children:[(0,R.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,R.jsx)(`path`,{d:`M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z`})}),`LinkedIn`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward} ${e.referral.url}`);window.open(`https://t.me/share/url?url=${t}`,`_blank`,`noopener,noreferrer`),P(`referral_share_telegram`,`engagement`,{label:e.name,metadata:{providerId:e.id}})},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:i(`setup:screen.share.telegram`),children:[(0,R.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,R.jsx)(`path`,{d:`M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z`})}),`Telegram`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://wa.me/?text=${t}%20${n}`,`_blank`,`noopener,noreferrer`),P(`referral_share_whatsapp`,`engagement`,{label:e.name,metadata:{providerId:e.id}})},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:i(`setup:screen.share.whatsapp`),children:[(0,R.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,R.jsx)(`path`,{d:`M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.134 1.585 5.934L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z`})}),`WhatsApp`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`${e.name} - ${e.referral.reward}`);window.open(`https://www.reddit.com/submit?url=${t}&title=${n}`,`_blank`,`noopener,noreferrer`),P(`referral_share_reddit`,`engagement`,{label:e.name,metadata:{providerId:e.id}})},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:i(`setup:screen.share.reddit`),children:[(0,R.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,R.jsx)(`path`,{d:`M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm5.01 4.744c.688 0 1.25.561 1.25 1.249a1.25 1.25 0 0 1-2.498.056l-2.597-.547-.8 3.747c1.824.07 3.48.632 4.674 1.488.308-.309.73-.491 1.207-.491.968 0 1.754.786 1.754 1.754 0 .716-.435 1.333-1.01 1.614a3.111 3.111 0 0 1 .042.52c0 2.694-3.13 4.87-7.004 4.87-3.874 0-7.004-2.176-7.004-4.87 0-.183.015-.366.043-.534A1.748 1.748 0 0 1 4.028 12c0-.968.786-1.754 1.754-1.754.463 0 .898.196 1.207.49 1.207-.883 2.878-1.43 4.744-1.487l.885-4.182a.342.342 0 0 1 .14-.197.35.35 0 0 1 .238-.042l2.906.617a1.214 1.214 0 0 0 1.108-.701 1.25 1.25 0 0 1 2.144.33zm-8.811 8.748c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754zm7.944 0c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754z`})}),`Reddit`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://www.facebook.com/sharer/sharer.php?u=${n}"e=${t}`,`_blank`,`noopener,noreferrer`),P(`referral_share_facebook`,`engagement`,{label:e.name,metadata:{providerId:e.id}})},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:i(`setup:screen.share.facebook`),children:[(0,R.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,R.jsx)(`path`,{d:`M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z`})}),`Facebook`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`mailto:?subject=${t}&body=${n}`,`_blank`,`noopener,noreferrer`),P(`referral_share_email`,`engagement`,{label:e.name,metadata:{providerId:e.id}})},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs hover:bg-muted/80 transition-colors`,title:i(`setup:screen.share.email`),children:[(0,R.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,viewBox:`0 0 24 24`,children:(0,R.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25H4.5a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75`})}),`Email`]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(N,{value:e.referral.url,readOnly:!0,className:`font-mono text-xs flex-1`}),(0,R.jsx)(k,{size:`sm`,variant:`outline`,onClick:H,className:`shrink-0`,children:v?(0,R.jsx)(l,{className:`h-4 w-4`}):(0,R.jsx)(b,{className:`h-4 w-4`})})]}),(0,R.jsx)(`p`,{className:`text-[11px] text-muted-foreground text-center`,children:i(`setup:screen.share.hint`)})]})]})})]})})]})}function oe({onKeySaved:e}){let{t}=_(),[n,r]=(0,L.useState)(!1),[o,s]=(0,L.useState)(``),[c,l]=(0,L.useState)(`openai-compatible`),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(``),[m,h]=(0,L.useState)(!1);return(0,R.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/60 overflow-hidden`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(!n),className:`w-full flex items-center gap-3 p-4 text-left hover:bg-muted/30 transition-colors`,children:[(0,R.jsx)(`div`,{className:`w-10 h-10 rounded-lg bg-muted/50 flex items-center justify-center`,children:(0,R.jsx)(i,{className:`h-5 w-5 text-muted-foreground`})}),(0,R.jsxs)(`div`,{className:`flex-1`,children:[(0,R.jsx)(`h3`,{className:`text-sm font-medium`,children:t(`setup:screen.custom.title`)}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`setup:screen.custom.description`)})]}),(0,R.jsx)(x,{className:w(`h-4 w-4 text-muted-foreground transition-transform`,n&&`rotate-90`)})]}),n&&(0,R.jsxs)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/40`,children:[(0,R.jsxs)(`div`,{className:`space-y-1.5 pt-3`,children:[(0,R.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground block`,children:t(`setup:screen.custom.localServers`)}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:A.map(e=>(0,R.jsx)(k,{type:`button`,size:`sm`,variant:o===e.id?`default`:`outline`,onClick:()=>{s(e.id),l(`openai-compatible`),d(e.defaultBaseUrl),e.noAuth&&p(``)},title:e.hint,children:e.label},e.id))})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.providerId`)}),(0,R.jsx)(N,{placeholder:`e.g. my-llm`,value:o,onChange:e=>s(e.target.value),className:`text-sm`})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.family`)}),(0,R.jsxs)(`select`,{value:c,onChange:e=>l(e.target.value),className:`flex h-9 w-full rounded-md border border-input bg-transparent px-3 text-sm`,children:[(0,R.jsx)(`option`,{value:`openai-compatible`,children:t(`setup:screen.custom.familyOpenAiCompatible`)}),(0,R.jsx)(`option`,{value:`openai`,children:`OpenAI`}),(0,R.jsx)(`option`,{value:`anthropic`,children:`Anthropic`}),(0,R.jsx)(`option`,{value:`google`,children:`Google`})]})]})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.baseUrl`)}),(0,R.jsx)(N,{placeholder:`e.g. http://localhost:11434/v1`,value:u,onChange:e=>d(e.target.value),className:`text-sm font-mono`})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.apiKey`)}),(0,R.jsx)(N,{type:`password`,placeholder:t(`setup:screen.custom.apiKeyPlaceholder`),value:f,onChange:e=>p(e.target.value),className:`text-sm font-mono`})]}),(0,R.jsxs)(k,{onClick:async()=>{if(o.trim()){h(!0);try{let n=C(ne.getState().wsUrl),i=z(n);n.send({type:`provider.add`,payload:{id:o.trim(),family:c,baseUrl:u.trim()||void 0,apiKey:f.trim()||void 0}});let a=await i;if(!a.success)throw Error(a.message);O.success(t(`setup:screen.toasts.providerAdded`,{id:o.trim()})),e(o.trim()),s(``),d(``),p(``),r(!1)}catch(e){let n=e instanceof Error&&e.message&&e.message!==`timeout`?e.message:null;O.error(n??t(`setup:screen.toasts.providerAddFailed`))}finally{h(!1)}}},disabled:!o.trim()||m,size:`sm`,children:[m?(0,R.jsx)(a,{className:`h-4 w-4 animate-spin mr-2`}):null,t(`setup:screen.custom.add`)]})]})]})}function U(){let{t:e}=_(),{model:t,setProvider:n,setModel:i,wsConnected:o,wsUrl:c}=ne(m(e=>({model:e.model,setProvider:e.setProvider,setModel:e.setModel,wsConnected:e.wsConnected,wsUrl:e.wsUrl})));M();let[v,y]=(0,L.useState)(`keys`),[b,ee]=(0,L.useState)([]),[T,te]=(0,L.useState)({}),[D,re]=(0,L.useState)([]),[A,N]=(0,L.useState)(!1),[F,I]=(0,L.useState)(null),[ie,ae]=(0,L.useState)(0),[z,U]=(0,L.useState)(new Set),[W,se]=(0,L.useState)(B),[G,K]=(0,L.useState)(!1),[ce,le]=(0,L.useState)(0),[ue,de]=(0,L.useState)(0),[q,fe]=(0,L.useState)(null),J=(0,L.useRef)(!0);(0,L.useEffect)(()=>{let e=new AbortController,t=`${window.location.origin}/providers.json`,n=`https://raw.githubusercontent.com/WrongStack/WrongStack/main/packages/webui/public/providers.json`;return K(!0),V(t,e.signal).then(r=>{if(r!==B){if(se(r),K(!1),P(`providers_loaded`,`system`,{label:`local`,metadata:{providerCount:r.length,source:t}}),!J.current){let e=r.length-ue;e>0?O.success(h.t(`setup:screen.toasts.providersLoadedNew`,{count:r.length,diff:e})):e<0?O.success(h.t(`setup:screen.toasts.providersLoadedRemoved`,{count:r.length,diff:Math.abs(e)})):O.success(h.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:r.length})),de(r.length)}fe(new Date);return}return V(n,e.signal)}).then(e=>{if(e){if(se(e),P(`providers_loaded`,`system`,{label:`github`,metadata:{providerCount:e.length,source:n}}),!J.current){let t=e.length-ue;t>0?O.success(h.t(`setup:screen.toasts.providersLoadedNew`,{count:e.length,diff:t})):t<0?O.success(h.t(`setup:screen.toasts.providersLoadedRemoved`,{count:e.length,diff:Math.abs(t)})):O.success(h.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:e.length})),de(e.length)}fe(new Date)}}).catch(()=>{P(`providers_load_failed`,`error`,{metadata:{localUrl:t,githubUrl:n}}),J.current||O.error(h.t(`setup:screen.toasts.providersRefreshFailed`))}).finally(()=>{K(!1),J.current=!1}),()=>e.abort()},[ce]);let[Y,X]=(0,L.useState)(null),[Z,Q]=(0,L.useState)(null),[pe,me]=(0,L.useState)(!1);(0,L.useEffect)(()=>{if(!o)return;let e=C(c),n=setTimeout(()=>{n=null,N(!1),I(h.t(`setup:screen.errors.backendNotResponding`))},8e3),r=()=>{n&&=(clearTimeout(n),null)},i=e.on(`provider.catalog`,e=>{e.type===`provider.catalog`&&(r(),I(null),ee(e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id))),N(!1))}),a=e.on(`provider.models`,e=>{if(e.type===`provider.models`){let n=e.payload;te(e=>({...e,[n.provider]:n.models})),me(!1),n.models.length===1?Q(n.models[0].id):t&&n.models.some(e=>e.id===t)&&Q(t)}}),s=e.on(`providers.saved`,e=>{if(e.type===`providers.saved`){let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));re(t),U(new Set(t.filter(e=>e.apiKeys.some(e=>e.isActive)).map(e=>e.id)))}});return I(null),N(!0),e.listProviders(),()=>{r(),i?.(),a?.(),s?.()}},[o,c,t,ie]);let he=(0,L.useCallback)(()=>{I(null),ae(e=>e+1)},[]),ge=(0,L.useCallback)(()=>{le(e=>e+1),P(`providers_refresh_clicked`,`engagement`,{metadata:{currentProviderCount:W.length}})},[W.length]),_e=(0,L.useCallback)(t=>{let n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<10)return e(`setup:screen.time.justNow`);if(r<60)return e(`setup:screen.time.secondsAgo`,{count:r});let i=Math.floor(r/60);if(i<60)return e(`setup:screen.time.minutesAgo`,{count:i});let a=Math.floor(i/60);return a<24?e(`setup:screen.time.hoursAgo`,{count:a}):e(`setup:screen.time.daysAgo`,{count:Math.floor(a/24)})},[e]),ve=(0,L.useCallback)(e=>{U(t=>new Set([...t,e]))},[]),$=z.size>0,ye=(0,L.useCallback)(()=>{if(!$){if(D.length>0){let e=D[0];X(e.id),y(`done`)}return}let e=D.find(e=>e.apiKeys.some(e=>e.isActive));e&&(X(e.id),y(`done`))},[$,D]);(0,L.useEffect)(()=>{if(!Y||!o||v!==`done`)return;let e=C(c);T[Y]||(me(!0),e.listProviderModels(Y))},[Y,o,c,T,v]);let be=Y?T[Y]??[]:[],xe=(0,L.useCallback)(()=>{if(!Y||!Z)return;n(Y),i(Z);let e=C(c);e.switchModel(Y,Z);let t=null,r=()=>{t&&clearTimeout(t)},a=e.on(`key.operation_result`,t=>{let n=t.payload;r(),a(),n.success?(e.newSession(),E(`chat`)):O.error(n.message)});t=setTimeout(()=>{r(),a(),O.error(h.t(`setup:screen.errors.modelSwitchTimeout`))},5e3)},[Y,Z,n,i,c]),Se=new Set(W.map(e=>e.id)),Ce=b.filter(e=>!Se.has(e.id)).sort((e,t)=>e.id.localeCompare(t.id));return(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,R.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b bg-card px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-6`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,R.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-primary via-primary to-primary/60`,children:(0,R.jsx)(p,{className:`h-5 w-5 text-primary-foreground`})}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h1`,{className:`truncate text-lg font-semibold`,children:e(`setup:screen.header.title`)}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground sm:truncate`,children:e(`setup:screen.header.subtitle`)})]})]}),$&&(0,R.jsxs)(k,{onClick:ye,size:`sm`,className:`w-full sm:w-auto`,children:[e(`setup:screen.header.continue`),(0,R.jsx)(g,{className:`h-4 w-4 ml-1.5`})]})]}),(0,R.jsx)(j,{className:`min-h-0 flex-1`,children:v===`keys`?(0,R.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-4 sm:p-6`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-primary font-medium`,children:[(0,R.jsx)(u,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{children:e(`setup:screen.steps.addKeys`)})]}),(0,R.jsx)(x,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-muted-foreground`,children:[(0,R.jsx)(d,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{children:e(`setup:screen.steps.pickModel`)})]}),(0,R.jsx)(x,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-muted-foreground`,children:[(0,R.jsx)(f,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{children:e(`setup:screen.steps.start`)})]})]}),(0,R.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-primary/20 bg-primary/5 p-4`,children:[(0,R.jsx)(S,{className:`h-5 w-5 text-primary shrink-0 mt-0.5`}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`text-sm font-medium`,children:e(`setup:screen.security.title`)}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e(`setup:screen.security.body`)})]})]}),F?(0,R.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-4 py-12 rounded-xl border border-destructive/30 bg-destructive/5 px-6`,children:[(0,R.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-destructive/10 border border-destructive/30 flex items-center justify-center`,children:(0,R.jsx)(s,{className:`h-6 w-6 text-destructive`})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:e(`setup:screen.errors.backendUnreachable`)}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 max-w-sm`,children:F})]}),(0,R.jsxs)(k,{onClick:he,size:`sm`,variant:`outline`,children:[(0,R.jsx)(a,{className:`h-4 w-4 mr-2`}),e(`setup:screen.errors.retry`)]})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.popular`)}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[G&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,R.jsx)(a,{className:`h-3 w-3 animate-spin`}),e(`setup:screen.providers.updating`)]}),q&&!G&&(0,R.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,title:q.toLocaleString(),children:_e(q)}),(0,R.jsxs)(`button`,{type:`button`,onClick:ge,disabled:G,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,title:e(`setup:screen.providers.refreshTitle`),children:[(0,R.jsx)(r,{className:w(`h-3 w-3`,G&&`animate-spin`)}),e(`setup:screen.providers.refresh`)]})]})]}),(0,R.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:W.map(e=>(0,R.jsx)(H,{popular:e,catalogProvider:b.find(t=>t.id===e.id),savedProvider:D.find(t=>t.id===e.id),onKeySaved:ve},e.id))})]}),Ce.length>0&&(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.more`)}),(0,R.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:Ce.map(t=>(0,R.jsx)(H,{popular:{id:t.id,name:t.name,description:e(`setup:screen.providers.catalogDescription`,{family:t.family,count:t.modelCount}),icon:`🔗`,color:`from-muted/60 to-muted/20 border-border hover:border-primary/40`,keyPlaceholder:`API key`,family:t.family},catalogProvider:t,savedProvider:D.find(e=>e.id===t.id),onKeySaved:ve},t.id))})]}),(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.selfHosted`)}),(0,R.jsx)(oe,{onKeySaved:ve})]})]}),A&&(0,R.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,R.jsx)(a,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),$&&(0,R.jsx)(`div`,{className:`sticky bottom-0 -mx-4 border-t bg-background/80 px-4 py-4 backdrop-blur-sm sm:-mx-6 sm:px-6`,children:(0,R.jsxs)(k,{onClick:ye,className:`w-full`,size:`lg`,children:[(0,R.jsx)(d,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.pickAndStart`),(0,R.jsx)(g,{className:`h-4 w-4 ml-2`})]})})]}):(0,R.jsxs)(`div`,{className:`mx-auto max-w-2xl space-y-8 p-4 sm:p-6`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-success`,children:[(0,R.jsx)(l,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{children:e(`setup:screen.steps.keys`)})]}),(0,R.jsx)(x,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-primary font-medium`,children:[(0,R.jsx)(d,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{children:e(`setup:screen.steps.pickModel`)})]}),(0,R.jsx)(x,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-muted-foreground`,children:[(0,R.jsx)(f,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{children:e(`setup:screen.steps.start`)})]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>y(`keys`),className:`text-xs text-muted-foreground hover:text-foreground transition-colors`,children:e(`setup:screen.start.addMoreKeys`)}),(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsxs)(`h2`,{className:`text-base font-semibold flex items-center gap-2`,children:[(0,R.jsx)(d,{className:`h-4 w-4 text-primary`}),e(`setup:screen.start.chooseProvider`)]}),(0,R.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 gap-2`,children:D.map(t=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{X(t.id),Q(null)},className:w(`rounded-lg border p-3 text-left transition-all text-sm`,Y===t.id?`border-primary bg-primary/10 ring-1 ring-primary/30`:`border-border hover:border-primary/40 hover:bg-primary/5`),children:[(0,R.jsx)(`span`,{className:`font-medium`,children:t.id}),(0,R.jsx)(`span`,{className:`block text-[11px] text-muted-foreground mt-0.5`,children:e(`setup:screen.start.activeKeys`,{count:t.apiKeys.filter(e=>e.isActive).length})})]},t.id))})]}),Y&&(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsxs)(`h2`,{className:`text-base font-semibold flex items-center gap-2`,children:[(0,R.jsx)(f,{className:`h-4 w-4 text-primary`}),e(`setup:screen.start.chooseModel`)]}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`setup:screen.start.modelsFor`,{provider:Y})}),pe?(0,R.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,R.jsx)(a,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):be.length>0?(0,R.jsx)(`div`,{className:`grid grid-cols-1 gap-2`,children:be.map(e=>{let t=e.contextWindow?`${(e.contextWindow/1e6).toFixed(0)}M ctx`:null;return(0,R.jsx)(`button`,{type:`button`,onClick:()=>Q(e.id),className:w(`w-full text-left rounded-xl border p-3 transition-all`,`hover:border-primary/40 hover:bg-primary/5`,Z===e.id?`border-primary bg-primary/10 ring-1 ring-primary/30`:`border-border bg-card`),children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[t&&(0,R.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:t}),e.capabilities.slice(0,3).map(e=>(0,R.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20`,children:e},e))]})]}),Z===e.id&&(0,R.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary`,children:(0,R.jsx)(l,{className:`h-3 w-3 text-primary-foreground`})})]})},e.id)})}):(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground py-8 text-center`,children:e(`setup:screen.errors.noModels`)})]}),Y&&Z&&(0,R.jsxs)(`div`,{className:`sticky bottom-0 -mx-4 border-t bg-background/80 px-4 py-4 backdrop-blur-sm sm:-mx-6 sm:px-6`,children:[(0,R.jsx)(`div`,{className:`mb-3 flex min-w-0 items-center justify-between gap-2 text-sm text-muted-foreground`,children:(0,R.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Y,` / `,Z]})}),(0,R.jsxs)(k,{onClick:xe,className:`w-full`,size:`lg`,children:[(0,R.jsx)(d,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.startSession`),(0,R.jsx)(g,{className:`h-4 w-4 ml-2`})]})]})]})})]})}export{U as SetupScreen};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-C9iFsXuW.js","assets/rolldown-runtime-QTnfLwEv.js","assets/markdown-BRAejDWd.js","assets/vendor-CcOzUMQS.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{c as t,m as n,p as r}from"./markdown-BRAejDWd.js";import{Ar as i,Bt as ee,Er as te,Hn as ne,Jn as re,Kr as a,Nn as ie,Sr as ae,Vr as oe,Yt as se,Z as o,Zt as ce,_i as s,br as le,dt as c,mi as l,rr as ue,ur as de,vr as u}from"./vendor-C9iFsXuW.js";import"./i18n-ClFSbktB.js";import{l as d}from"./monaco-MjnRih9i.js";import{t as f}from"./utils-Bl7Yr7Bw.js";import{n as fe}from"./ui-store-LCpXBvQT.js";import{C as pe,D as me,N as he,O as ge,j as _e,v as p,w as ve,x as ye}from"./index-DGwt4pL3.js";var m=e(n(),1),h=r(),be=(0,m.lazy)(()=>d(()=>import(`./vendor-C9iFsXuW.js`).then(e=>e.m),__vite__mapDeps([0,1,2,3])));function g(e){return e===`project`||e===`user`}function _(e){let t=e.match(/^(.+?)\/SKILL(?:\.save)?\.md$/);return t?t[1]:null}function xe({source:e}){let{t}=l(),n=e===`project`?`project`:e===`user`?`user`:`bundled`;return(0,h.jsx)(`span`,{className:f(`inline-flex items-center rounded-md border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide`,n===`project`&&`border-success/25 bg-success/8 text-success`,n===`user`&&`border-primary/25 bg-primary/10 text-primary`,n===`bundled`&&`border-border/70 bg-muted/60 text-muted-foreground`),children:t(`activity:skillDetail.${{project:`scopeProject`,user:`scopeGlobal`,bundled:`scopeBundled`}[n]}`)})}function v({className:e}){let{t:n}=l(),{client:r}=_e(),d=fe(e=>e.skillsState),v=fe(e=>e.setSkillsState),y=d.selectedSkill,b=d.navHistory,x=d.historyIndex,[S,Se]=(0,m.useState)(null),[Ce,C]=(0,m.useState)(!1),[we,w]=(0,m.useState)(null),[T,E]=(0,m.useState)(!1),[D,O]=(0,m.useState)(``),[k,A]=(0,m.useState)(!1),[j,M]=(0,m.useState)(null),[N,P]=(0,m.useState)(!1),[F,I]=(0,m.useState)(null),[L,R]=(0,m.useState)(!1),z=(0,m.useRef)(``),[B,V]=(0,m.useState)(!1),[H,U]=(0,m.useState)(null),[Te,W]=(0,m.useState)(!1),[G,K]=(0,m.useState)(null),[q,Ee]=(0,m.useState)(!1),[De,Oe]=(0,m.useState)([]),J=(0,m.useRef)(d);J.current=d;let Y=(0,m.useRef)(!1),X=(0,m.useMemo)(()=>D?{lines:D.split(`
|
|
3
|
+
`).length,words:D.trim()?D.trim().split(/\s+/).length:0,chars:D.length}:{lines:0,words:0,chars:0},[D]),Z=(0,m.useMemo)(()=>{if(!D)return null;let e=5*1024*1024,t=new Blob([D]).size;return t>=e?{level:`critical`,used:t,limit:e}:t>=4194304?{level:`warn`,used:t,limit:e}:null},[D]);(0,m.useEffect)(()=>{if(!F)return;let e=setTimeout(()=>I(null),2e3);return()=>clearTimeout(e)},[F]),(0,m.useEffect)(()=>{if(!T||!y)return;let e=setInterval(()=>{D&&D!==z.current&&(z.current=D,localStorage.setItem(`skills_draft_${y.name}`,JSON.stringify({content:D,savedAt:Date.now()})),I(Date.now()))},5e3);return()=>clearInterval(e)},[T,D,y]),(0,m.useEffect)(()=>{if(!y||!T)return;let e=localStorage.getItem(`skills_draft_${y.name}`);if(e)try{let{content:t}=JSON.parse(e);t&&t!==D&&t!==z.current&&(O(t),z.current=t,R(!0))}catch{}},[y?.name,T]),(0,m.useEffect)(()=>{if(!r||!y)return;C(!0),Se(null),w(null);let e=setTimeout(()=>{C(!1),w(s.t(`activity:skillDetail.timeoutError`))},1e4),t=t=>{clearTimeout(e);let n=t;n.payload.error?w(n.payload.error):n.payload.name&&Se(n.payload),C(!1)},n=e=>{let t=e;V(!1);let n=J.current;if(t.payload.success){let e={...n.knownRefs};for(let n of t.payload.updated??[])e[n.name]=n.newRef;v({...n,knownRefs:e,updateAvailableCount:0}),U({updated:t.payload.updated??[],unchanged:t.payload.unchanged??[],errors:t.payload.errors??[]}),r.send({type:`skills.list`})}else U({updated:[],unchanged:[],errors:[{name:``,error:t.payload.error??s.t(`activity:skillDetail.updateFailed`)}]})},i=e=>{let t=e;t.payload.skills&&Oe(t.payload.skills)};return r.on(`skills.content`,t),r.on(`skills.updated`,n),r.on(`skills.list`,i),r.send({type:`skills.content`,payload:{name:y.name,source:y.source}}),()=>{clearTimeout(e),r.off(`skills.content`,t),r.off(`skills.updated`,n),r.off(`skills.list`,i)}},[r,y?.name,y?.source]),(0,m.useEffect)(()=>{T&&(E(!1),O(``),M(null))},[y?.name]);let Q=(0,m.useCallback)(e=>De.find(t=>t.name.toLowerCase()===e.toLowerCase()),[De]),ke=(0,m.useCallback)(e=>{let t=Q(e);if(t){Y.current=!1;let e=b.slice(0,x+1);e.push(t),v({...J.current,selectedSkill:t,navHistory:e,historyIndex:e.length-1}),E(!1),O(``),U(null)}},[Q,b,x,v]),Ae=(0,m.useCallback)(()=>{if(x<=0)return;Y.current=!0;let e=x-1,t=b[e];v({...J.current,selectedSkill:t,historyIndex:e}),E(!1),O(``),U(null)},[x,b,v]),je=(0,m.useCallback)(()=>{if(x>=b.length-1)return;Y.current=!0;let e=x+1,t=b[e];v({...J.current,selectedSkill:t,historyIndex:e}),E(!1),O(``),U(null)},[x,b,v]),$=(0,m.useCallback)(()=>{he(`chat`)},[]),Me=(0,m.useCallback)(()=>{S&&(O(S.body),z.current=S.body,R(!1),M(null),E(!0),P(!1))},[S]),Ne=(0,m.useCallback)(()=>{E(!1),O(``),M(null),P(!1),R(!1),y&&localStorage.removeItem(`skills_draft_${y.name}`)},[y]),Pe=(0,m.useCallback)(()=>{!y||!S||(R(!1),O(S.body),z.current=S.body,y&&localStorage.removeItem(`skills_draft_${y.name}`))},[y,S]),Fe=(0,m.useCallback)(()=>{if(!r||!y||!D.trim())return;A(!0),M(null);let e=t=>{let n=t;A(!1),n.payload.success?(z.current=``,localStorage.removeItem(`skills_draft_${y.name}`),R(!1),E(!1),r.send({type:`skills.content`,payload:{name:y.name,source:y.source}}),r.send({type:`skills.list`})):M(n.payload.error??s.t(`activity:skillDetail.saveFailed`)),r.off(`skills.edited`,e)};r.on(`skills.edited`,e),r.editSkill(y.name,D)},[r,y,D]),Ie=(0,m.useCallback)(()=>{!r||!y||(V(!0),U(null),r.checkForUpdates(y.name,y.source===`user`))},[r,y]),Le=(0,m.useCallback)(()=>{y?.sourceUrl&&navigator.clipboard.writeText(y.sourceUrl).then(()=>{W(!0),setTimeout(()=>W(!1),2e3)})},[y]),Re=(0,m.useCallback)(()=>{if(!S?.body)return;let e=new Blob([S.body],{type:`text/markdown`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${S.name.replace(/\//g,`_`)}-SKILL.md`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},[S]),ze=(0,m.useCallback)(async e=>{if(!r||!e)return;Ee(!0);let t=e=>{let n=e;Ee(!1),n.payload.success?(K(null),r.send({type:`skills.list`}),$()):M(n.payload.error??s.t(`activity:skillDetail.uninstallFailed`)),r.off(`skills.uninstalled`,t)};r.on(`skills.uninstalled`,t),r.uninstallSkill(e.name,e.source===`user`)},[r,$]);return y?(0,h.jsxs)(`div`,{className:f(`flex h-full min-h-0 min-w-0 flex-col gap-3 overflow-hidden bg-[hsl(var(--surface-2)/0.45)] p-3`,e),children:[(0,h.jsxs)(`div`,{className:`shrink-0 rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,h.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,h.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,h.jsx)(oe,{className:`h-4 w-4`})}),(0,h.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold`,children:y.name}),y.version&&(0,h.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`v`,y.version]}),(0,h.jsx)(xe,{source:y.source})]}),(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:y.description||y.trigger}),y.sourceUrl&&(0,h.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-1`,children:[(0,h.jsxs)(`a`,{href:`https://${y.sourceUrl.replace(`github:`,``)}`,target:`_blank`,rel:`noopener noreferrer`,className:`flex min-w-0 items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,title:n(`activity:skillDetail.openSourceRepo`),children:[(0,h.jsx)(ie,{className:`h-3 w-3 shrink-0`}),(0,h.jsx)(`span`,{className:`truncate font-mono`,children:y.sourceUrl})]}),(0,h.jsx)(`button`,{type:`button`,onClick:Le,className:`flex shrink-0 items-center text-muted-foreground transition-colors hover:text-foreground`,title:n(`activity:skillDetail.copySourceUrl`),children:Te?(0,h.jsx)(ae,{className:`h-3 w-3 text-success`}):(0,h.jsx)(de,{className:`h-3 w-3`})})]}),y.scope.length>0&&(0,h.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:y.scope.map(e=>(0,h.jsx)(`span`,{className:`px-1.5 py-0.5 text-[10px] rounded bg-muted text-muted-foreground`,children:e},e))}),H&&(0,h.jsxs)(`div`,{className:`mt-2 text-xs space-y-1`,children:[H.updated.length>0&&(0,h.jsx)(`div`,{className:`text-success`,children:n(`activity:skillDetail.updatedLabel`,{list:H.updated.map(e=>`${e.name} (${e.oldRef} → ${e.newRef})`).join(`, `)})}),H.unchanged.length>0&&(0,h.jsx)(`div`,{className:`text-muted-foreground`,children:n(`activity:skillDetail.upToDateLabel`,{list:H.unchanged.join(`, `)})}),H.errors.length>0&&(0,h.jsx)(`div`,{className:`text-destructive`,children:n(`activity:skillDetail.errorsLabel`,{list:H.errors.map(e=>`${e.name?`${e.name}: `:``}${e.error}`).join(`; `)})})]})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 lg:ml-auto lg:shrink-0 lg:justify-end`,children:[g(y.source)&&y.sourceUrl&&(0,h.jsx)(`button`,{type:`button`,onClick:Ie,disabled:B,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50`,title:n(`activity:skillDetail.checkUpdatesTitle`),children:B?(0,h.jsx)(a,{className:`h-3.5 w-3.5 animate-spin`}):(0,h.jsx)(ee,{className:`h-3.5 w-3.5`})}),y.source!==`bundled`&&!T&&(0,h.jsx)(`button`,{type:`button`,onClick:Re,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:n(`activity:skillDetail.exportTitle`),children:(0,h.jsx)(ue,{className:`h-3.5 w-3.5`})}),g(y.source)&&!T&&(0,h.jsx)(`button`,{type:`button`,onClick:Me,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:n(`activity:skillDetail.editTitle`),children:(0,h.jsx)(se,{className:`h-3.5 w-3.5`})}),g(y.source)&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>K(y),className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,title:n(`activity:skillDetail.uninstallTitle`),children:(0,h.jsx)(c,{className:`h-3.5 w-3.5`})}),(0,h.jsx)(`button`,{type:`button`,onClick:$,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:n(`activity:skillDetail.closeTitle`),children:(0,h.jsx)(o,{className:`h-4 w-4`})})]})]}),b.length>1&&(0,h.jsxs)(`div`,{className:`mt-3 flex min-w-0 items-center gap-1 rounded-lg border border-border/60 bg-muted/35 px-2 py-1`,children:[(0,h.jsx)(`button`,{type:`button`,onClick:Ae,disabled:x<=0,className:f(`rounded p-1 transition-colors`,x<=0?`text-muted-foreground/65 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:n(`activity:skillDetail.backTitle`),children:(0,h.jsx)(le,{className:`h-4 w-4`})}),(0,h.jsx)(`button`,{type:`button`,onClick:je,disabled:x>=b.length-1,className:f(`rounded p-1 transition-colors`,x>=b.length-1?`text-muted-foreground/65 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:n(`activity:skillDetail.forwardTitle`),children:(0,h.jsx)(u,{className:`h-4 w-4`})}),(0,h.jsx)(`div`,{className:`flex items-center gap-0.5 overflow-x-auto text-xs`,children:b.map((e,t)=>(0,h.jsxs)(`span`,{className:`flex items-center shrink-0`,children:[t>0&&(0,h.jsx)(u,{className:`h-3 w-3 text-muted-foreground/65 mx-0.5 shrink-0`}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>{t<x&&(Y.current=!0,v({...J.current,selectedSkill:e,historyIndex:t}),E(!1),O(``),U(null))},className:f(`hover:text-primary cursor-pointer transition-colors`,t===x?`text-primary font-medium`:`text-muted-foreground`),children:e.name})]},e.name+t))})]})]}),S&&(S.relatedFiles.length>0||S.references.length>0)&&(0,h.jsxs)(`div`,{className:`shrink-0 space-y-2 rounded-xl border border-border/70 bg-card/70 px-4 py-3 shadow-sm`,children:[S.relatedFiles.length>0&&(0,h.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,h.jsx)(ne,{className:`h-3 w-3`}),(0,h.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:n(`activity:skillDetail.relatedFiles`)})]}),S.relatedFiles.map(e=>{let t=_(e);return t&&Q(t)?(0,h.jsxs)(`button`,{type:`button`,onClick:()=>ke(t),className:`inline-flex min-w-0 items-center gap-1 rounded-md border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] transition-colors hover:border-primary/40 hover:text-primary`,title:n(`activity:skillDetail.goToSkillTitle`,{name:t}),children:[(0,h.jsx)(i,{className:`h-2.5 w-2.5`}),e]},e):(0,h.jsx)(`span`,{className:`rounded-md border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:e},e)})]}),S.references.length>0&&(0,h.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,h.jsx)(re,{className:`h-3 w-3`}),(0,h.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:n(`activity:skillDetail.references`)})]}),S.references.map(e=>{let t=_(e)??e.replace(/\.md$/,``);return Q(t)?(0,h.jsxs)(`button`,{type:`button`,onClick:()=>ke(t),className:`inline-flex min-w-0 items-center gap-1 rounded-md border border-primary/20 bg-primary/5 px-1.5 py-0.5 text-[10px] text-primary transition-colors hover:border-primary/30 hover:bg-primary/10`,title:n(`activity:skillDetail.goToSkillTitle`,{name:t}),children:[(0,h.jsx)(i,{className:`h-2.5 w-2.5`}),t]},e):(0,h.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:t},e)})]})]}),(0,h.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-hidden rounded-xl border border-border/70 bg-card/70 shadow-sm`,children:Ce?(0,h.jsxs)(`div`,{className:`flex h-full min-h-[16rem] flex-col items-center justify-center p-8 text-center text-muted-foreground`,children:[(0,h.jsx)(a,{className:`mx-auto mb-2 h-6 w-6 animate-spin text-primary`}),(0,h.jsx)(`p`,{children:n(`activity:skillDetail.loadingContent`)})]}):T?(0,h.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,h.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-border/70 bg-muted/30 px-4 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`activity:skillDetail.editingLabel`,{name:y.name})}),(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:n(`activity:skillDetail.editStats`,{lines:X.lines,words:X.words,chars:X.chars})}),Z&&(0,h.jsx)(`span`,{className:`text-xs tabular-nums ${Z.level===`critical`?`font-medium text-destructive`:`text-warning`}`,children:n(`activity:skillDetail.charsWarningFmt`,{used:(Z.used/(1024*1024)).toFixed(1),limit:(Z.limit/(1024*1024)).toFixed(0)})}),F&&(0,h.jsx)(`span`,{className:`text-xs text-success animate-pulse`,children:n(`activity:skillDetail.draftSaved`)}),L&&(0,h.jsx)(`span`,{className:`animate-pulse text-xs text-warning`,children:n(`activity:skillDetail.draftRestored`)})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[j&&(0,h.jsx)(`span`,{className:`text-xs text-destructive`,children:j}),L&&(0,h.jsx)(`button`,{type:`button`,onClick:Pe,className:`rounded-md border border-warning/35 px-2 py-1 text-[10px] text-warning transition-colors hover:bg-warning/10`,children:n(`activity:skillDetail.discardDraft`)}),(0,h.jsx)(`button`,{type:`button`,onClick:Ne,className:`rounded-md border border-border/70 px-2 py-1 text-xs transition-colors hover:bg-accent`,children:n(`common:action.cancel`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>P(e=>!e),title:n(N?`activity:skillDetail.hidePreviewTitle`:`activity:skillDetail.splitViewTitle`),className:`rounded-md border px-2 py-1 text-xs transition-colors ${N?`border-primary/40 bg-primary/10 text-primary`:`border-border/70 text-muted-foreground hover:bg-accent`}`,children:(0,h.jsx)(ce,{className:`h-3 w-3 inline`})}),(0,h.jsx)(`button`,{type:`button`,onClick:Fe,disabled:k||!D.trim(),className:`rounded-md bg-primary px-3 py-1 text-xs text-primary-foreground shadow-sm shadow-primary/15 transition-colors hover:bg-primary/90 disabled:opacity-50`,children:k?(0,h.jsx)(a,{className:`h-3 w-3 animate-spin inline`}):n(`common:action.save`)})]})]}),N?(0,h.jsxs)(`div`,{className:`flex flex-1 min-h-0 gap-0.5`,children:[(0,h.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0`,children:(0,h.jsx)(m.Suspense,{fallback:null,children:(0,h.jsx)(be,{value:D,onChange:e=>O(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:n(`activity:skillDetail.contentPlaceholder`)})})}),(0,h.jsx)(`div`,{className:`w-px bg-border flex-shrink-0`}),(0,h.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto bg-background/45 p-4 prose prose-sm dark:prose-invert max-w-none`,children:(0,h.jsx)(ye,{rehypePlugins:[t],components:p,children:D})})]}):(0,h.jsx)(m.Suspense,{fallback:null,children:(0,h.jsx)(be,{value:D,onChange:e=>O(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:n(`activity:skillDetail.contentPlaceholder`)})})]}):S?(0,h.jsx)(`div`,{className:`h-full min-h-0 overflow-y-auto p-5 sm:p-6 prose prose-sm dark:prose-invert max-w-none`,children:(0,h.jsx)(ye,{rehypePlugins:[t],components:p,children:S.body})}):we?(0,h.jsxs)(`div`,{className:`flex h-full min-h-[16rem] flex-col items-center justify-center p-8 text-center`,children:[(0,h.jsx)(`p`,{className:`text-destructive mb-2`,children:n(`activity:skillDetail.loadFailed`)}),(0,h.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:we}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>{r&&y&&(C(!0),w(null),r.send({type:`skills.content`,payload:{name:y.name,source:y.source}}))},className:`mt-4 rounded-md border border-border/70 px-3 py-1.5 text-xs transition-colors hover:bg-accent`,children:n(`common:action.retry`)})]}):(0,h.jsx)(`div`,{className:`flex h-full min-h-[16rem] items-center justify-center p-8 text-center text-muted-foreground`,children:n(`activity:skillDetail.noContent`)})}),(0,h.jsx)(pe,{open:!!G,onOpenChange:e=>{e||K(null)},children:(0,h.jsxs)(ve,{className:`flex max-h-[calc(100dvh-2rem)] w-[380px] max-w-[90vw] flex-col gap-0 overflow-hidden p-0`,showCloseButton:!1,children:[(0,h.jsxs)(me,{className:`flex shrink-0 items-center justify-between border-b border-border/70 p-4 sm:flex-row sm:justify-between sm:space-y-0`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(c,{className:`h-4 w-4 text-destructive`}),(0,h.jsx)(ge,{className:`font-semibold text-sm`,children:n(`activity:skillDetail.uninstallSkillHeading`)})]}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>K(null),"aria-label":n(`common:action.close`),className:`rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,h.jsx)(o,{className:`h-4 w-4`})})]}),(0,h.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto p-4`,children:[(0,h.jsx)(`p`,{className:`text-sm`,children:G&&n(`activity:skillDetail.uninstallConfirm`,{name:G.name})}),(0,h.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:G&&n(`activity:skillDetail.uninstallRemovePath`,{path:G.source===`user`?`~/.wrongstack/skills`:`.wrongstack/skills`})})]}),(0,h.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-border/70 bg-muted/20 p-4`,children:[(0,h.jsx)(`button`,{type:`button`,onClick:()=>K(null),disabled:q,className:`rounded-md border border-border/70 px-3 py-1.5 text-xs transition-colors hover:bg-accent disabled:opacity-50`,children:n(`common:action.cancel`)}),(0,h.jsxs)(`button`,{type:`button`,onClick:()=>G&&ze(G),disabled:q,className:`flex items-center gap-1.5 rounded-md bg-destructive px-3 py-1.5 text-xs text-destructive-foreground transition-colors hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50`,children:[q&&(0,h.jsx)(a,{className:`h-3 w-3 animate-spin`}),n(`activity:skillDetail.uninstallAction`)]})]})]})})]}):(0,h.jsx)(`div`,{className:f(`flex h-full min-h-0 flex-1 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4 text-muted-foreground`,e),children:(0,h.jsxs)(`div`,{className:`ws-surface flex max-w-md flex-col items-center gap-3 rounded-xl p-6 text-center`,children:[(0,h.jsx)(`span`,{className:`flex h-12 w-12 items-center justify-center rounded-xl bg-primary/10 text-primary`,children:(0,h.jsx)(te,{className:`h-6 w-6`})}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`p`,{className:`text-base font-medium text-foreground`,children:n(`activity:skillDetail.noSkillSelected`)}),(0,h.jsx)(`p`,{className:`mt-1 text-sm`,children:n(`activity:skillDetail.selectSkillHint`)})]}),(0,h.jsx)(`button`,{type:`button`,onClick:$,className:`mt-1 rounded-md border border-border/70 bg-card/70 px-4 py-2 text-sm text-foreground shadow-sm transition-colors hover:bg-accent`,children:n(`activity:skillDetail.goToChat`)})]})})}export{v as SkillDetailView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-BRAejDWd.js";import{It as r,Jn as i,Kr as a,Kt as o,Or as s,Z as c,en as l,fr as u,hn as d,ii as f,mi as p,mr as m,si as h,vr as g,xn as _,xr as v}from"./vendor-C9iFsXuW.js";import"./i18n-ClFSbktB.js";import{t as y}from"./utils-Bl7Yr7Bw.js";import{I as b,M as x,S,j as C}from"./index-DGwt4pL3.js";var w=e(t(),1),T=n(),E={completed:{icon:(0,T.jsx)(h,{className:`h-3.5 w-3.5`}),label:`Completed`,text:`text-success`,ring:`border-success/35`},in_progress:{icon:(0,T.jsx)(a,{className:`h-3.5 w-3.5 animate-spin`}),label:`Running`,text:`text-primary`,ring:`border-primary/45`},queued:{icon:(0,T.jsx)(u,{className:`h-3.5 w-3.5`}),label:`Queued`,text:`text-warning`,ring:`border-warning/35`},blocked:{icon:(0,T.jsx)(d,{className:`h-3.5 w-3.5`}),label:`Blocked`,text:`text-destructive`,ring:`border-destructive/30`},pending:{icon:(0,T.jsx)(m,{className:`h-3.5 w-3.5`}),label:`Pending`,text:`text-muted-foreground`,ring:`border-border/70`},review:{icon:(0,T.jsx)(r,{className:`h-3.5 w-3.5`}),label:`Review`,text:`text-primary`,ring:`border-primary/35`},failed:{icon:(0,T.jsx)(f,{className:`h-3.5 w-3.5`}),label:`Failed`,text:`text-destructive`,ring:`border-destructive/45`},cancelled:{icon:(0,T.jsx)(s,{className:`h-3.5 w-3.5`}),label:`Cancelled`,text:`text-muted-foreground`,ring:`border-border/70`}},D=[`completed`,`in_progress`,`queued`,`blocked`,`pending`,`failed`],O={critical:{label:`Crit`,cls:`bg-destructive/10 text-destructive`},high:{label:`High`,cls:`bg-destructive/10 text-destructive`},medium:{label:`Med`,cls:`bg-warning/12 text-warning`},low:{label:`Low`,cls:`bg-success/12 text-success`}};function k({columns:e,onTaskClick:t}){let{t:n}=p();return e.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:n(`activity:board.emptySpec`)}):(0,T.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,T.jsx)(`h3`,{className:`mb-3 text-sm font-semibold text-foreground`,children:n(`activity:board.depGraphHeading`)}),(0,T.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs`,children:D.map(e=>(0,T.jsxs)(`span`,{className:y(`inline-flex items-center gap-1.5`,E[e].text),children:[E[e].icon,(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:n(`activity:board.status.${e}`)})]},e))}),(0,T.jsx)(`div`,{className:`flex gap-3 overflow-x-auto pb-2`,children:e.map((n,r)=>(0,T.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,T.jsxs)(`div`,{className:`w-60 shrink-0`,children:[(0,T.jsx)(`div`,{className:`mb-2 border-b border-border/60 pb-1 text-center text-xs font-medium uppercase text-muted-foreground`,children:n.label}),(0,T.jsx)(`div`,{className:`space-y-2`,children:n.tasks.map(e=>(0,T.jsx)(A,{task:e,onClick:t},e.id))})]}),r<e.length-1&&(0,T.jsx)(`div`,{className:`flex h-full items-center pt-8 text-muted-foreground/75`,children:(0,T.jsx)(g,{className:`h-5 w-5`})})]},n.label))})]})}function A({task:e,onClick:t}){let n=E[e.displayStatus],r=O[e.priority],{t:i}=p();return(0,T.jsxs)(`button`,{type:`button`,onClick:()=>t?.(e.id),className:y(`w-full rounded-lg border bg-background/55 p-2.5 text-left shadow-sm transition-colors hover:border-primary/35 hover:bg-accent/35`,n.ring),children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsxs)(`span`,{className:y(`inline-flex items-center gap-1.5 text-xs font-medium`,n.text),children:[n.icon,(0,T.jsx)(`span`,{className:`font-mono text-foreground`,children:e.shortId})]}),(0,T.jsx)(`span`,{className:y(`rounded px-1.5 py-0.5 text-[10px] font-medium`,r.cls),children:r.label})]}),(0,T.jsx)(`p`,{className:`mt-1.5 text-xs text-foreground`,children:e.title}),e.deps.length>0&&(0,T.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:[`← `,e.deps.join(`, `)]}),e.agentName&&(0,T.jsxs)(`div`,{className:y(`mt-1.5 inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[10px]`,e.displayStatus===`in_progress`?`bg-primary/10 text-primary`:`bg-muted text-muted-foreground`),title:e.worktreeBranch?i(`activity:board.worktreePrefix`,{branch:e.worktreeBranch}):void 0,children:[e.displayStatus===`in_progress`&&(0,T.jsx)(a,{className:`h-3 w-3 animate-spin`}),(0,T.jsx)(`span`,{children:e.agentName})]})]})}function j(e){return e.columns.map(e=>({name:e.label,description:``,priority:`medium`,estimateHours:e.tasks.length,parallelizable:!1,taskTemplates:e.tasks.map(e=>({title:e.title,description:e.description,type:e.type,priority:e.priority,estimateHours:1}))}))}function M({onClose:e}){let{client:t}=C(),{t:n}=p(),r=b(e=>e.specs),a=b(e=>e.detail),s=b(e=>e.expandedSpecId),u=b(e=>e.setExpanded),[d,f]=(0,w.useState)(`graph`),m=(0,w.useCallback)(e=>{!a||a.specId!==e.id||(t?.send?.({type:`autophase.start`,payload:{title:e.title,phases:j(a),autonomous:!0}}),x(`autophase`))},[a,t]);(0,w.useEffect)(()=>{t?.send?.({type:`specs.list`})},[t]);let h=(0,w.useCallback)(e=>{s===e.id?u(null):(u(e.id),t?.send?.({type:`specs.get`,payload:{specId:e.id}}))},[s,u,t]),E=a?.columns.flatMap(e=>e.tasks)??[],D={done:E.filter(e=>e.status===`completed`).length,running:E.filter(e=>e.status===`in_progress`).length,pending:E.filter(e=>e.status===`pending`||e.displayStatus===`queued`).length};return(0,T.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,T.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b bg-card px-4 py-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(i,{className:`h-5 w-5 text-warning`}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-lg font-semibold`,children:n(`activity:specs.heading`)}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`activity:specs.subtitle`)})]})]}),(0,T.jsx)(S,{variant:`ghost`,size:`icon`,onClick:e,children:(0,T.jsx)(c,{className:`h-4 w-4`})})]}),(0,T.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:r.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:n(`activity:specs.empty`,{command:`/sdd`})}):(0,T.jsx)(`div`,{className:`space-y-3`,children:r.map(e=>{let t=s===e.id,r=e.total>0?Math.round(e.completed/e.total*100):0;return(0,T.jsxs)(`div`,{className:`rounded-lg border border-border bg-card/60`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>h(e),className:`flex w-full items-start gap-3 p-4 text-left`,children:[(0,T.jsx)(`span`,{className:`mt-1 text-muted-foreground`,children:t?(0,T.jsx)(v,{className:`h-4 w-4`}):(0,T.jsx)(g,{className:`h-4 w-4`})}),(0,T.jsx)(i,{className:`mt-0.5 h-4 w-4 text-muted-foreground`}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.displayId}),(0,T.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] capitalize text-muted-foreground`,children:e.status})]}),(0,T.jsx)(`h2`,{className:`mt-1 text-base font-semibold`,children:e.title}),(0,T.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,T.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-success transition-all`,style:{width:`${r}%`}})}),(0,T.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[e.completed,`/`,e.total]})]})]})]}),t&&(0,T.jsxs)(`div`,{className:`border-t border-border p-4`,children:[(0,T.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,T.jsxs)(`div`,{className:`text-sm font-medium`,children:[n(`activity:specs.tasks`,{count:a?.total??e.total}),a&&(0,T.jsxs)(`span`,{className:`ml-3 text-xs font-normal text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`text-success`,children:n(`activity:specs.doneCount`,{count:D.done})}),` `,(0,T.jsx)(`span`,{className:`text-primary`,children:n(`activity:specs.runningCount`,{count:D.running})}),` `,(0,T.jsx)(`span`,{children:n(`activity:specs.pendingCount`,{count:D.pending})})]})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(`button`,{type:`button`,disabled:!a||a.specId!==e.id,onClick:()=>m(e),title:n(`activity:specs.runTitle`),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning transition-colors hover:bg-warning/25 disabled:opacity-40`,children:[(0,T.jsx)(o,{className:`h-3.5 w-3.5`}),` `,n(`activity:specs.run`)]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>f(`list`),className:y(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,d===`list`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(_,{className:`h-3.5 w-3.5`}),` `,n(`activity:specs.list`)]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>f(`graph`),className:y(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,d===`graph`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(l,{className:`h-3.5 w-3.5`}),` `,n(`activity:specs.graph`)]})]})]})]}),!a||a.specId!==e.id?(0,T.jsx)(`div`,{className:`flex h-24 items-center justify-center text-sm text-muted-foreground`,children:n(`activity:specs.loadingTasks`)}):d===`graph`?(0,T.jsx)(k,{columns:a.columns}):(0,T.jsx)(`div`,{className:`space-y-1.5`,children:E.map(e=>(0,T.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border border-border bg-card px-3 py-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),(0,T.jsx)(`span`,{className:`flex-1 text-sm`,children:e.title}),(0,T.jsx)(`span`,{className:`text-xs capitalize text-muted-foreground`,children:e.displayStatus.replace(`_`,` `)})]},e.id))})]})]},e.id)})})})]})}export{M as SpecsView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-BRAejDWd.js";import{Br as r,Gt as i,It as a,Z as o,_i as s,dt as c,mi as l}from"./vendor-C9iFsXuW.js";import"./i18n-ClFSbktB.js";import{t as u}from"./ws-client-WVS5hdJj.js";import{t as d}from"./session-store-BOmBeF9r.js";import{n as f,t as p}from"./utils-Bl7Yr7Bw.js";import{n as m}from"./ui-store-LCpXBvQT.js";import{J as h}from"./index-DGwt4pL3.js";import{n as g,t as _}from"./xterm-B9RXJkIu.js";var v=e(t(),1),y=`wrongstack.terminalDockHeight`;function b(e){let t=typeof window>`u`?640:Math.max(140,Math.min(640,Math.floor(window.innerHeight*.55),window.innerHeight-260));return Math.min(Math.max(Math.round(e),140),t)}var x=n(),S={background:`#1e1e2e`,foreground:`#cdd6f4`,cursor:`#f5e0dc`,selectionBackground:`#585b70`,black:`#45475a`,red:`#f38ba8`,green:`#a6e3a1`,yellow:`#f9e2af`,blue:`#89b4fa`,magenta:`#f5c2e7`,cyan:`#94e2d5`,white:`#bac2de`,brightBlack:`#585b70`,brightRed:`#f38ba8`,brightGreen:`#a6e3a1`,brightYellow:`#f9e2af`,brightBlue:`#89b4fa`,brightMagenta:`#f5c2e7`,brightCyan:`#94e2d5`,brightWhite:`#a6adc8`},C=8;function w(e=!1){return typeof window>`u`?300:b(window.innerHeight*(e?.32:.4))}function T(e=!1){if(typeof window>`u`)return w(e);try{let t=window.localStorage.getItem(y),n=t?Number.parseInt(t,10):NaN;return Number.isFinite(n)?b(n):w(e)}catch{return w(e)}}function E(e){try{window.localStorage.setItem(y,String(b(e)))}catch{}}function D(){return f()}function O(e){return{id:D(),name:`Terminal ${e}`,status:`starting`}}function k({desktopShell:e=!1,onClose:t}){let n=(0,v.useRef)(null),{t:s}=l(),u=(0,v.useRef)(1),[f,h]=(0,v.useState)(()=>T(e)),[g,_]=(0,v.useState)(()=>[O(1)]),[y,S]=(0,v.useState)(()=>g[0]?.id??``),w=m(e=>e.terminalCreateNonce),k=(0,v.useRef)(w),j=d(e=>e.projectName),M=d(e=>e.cwd);(0,v.useEffect)(()=>{let e=()=>{h(e=>{let t=b(e);return E(t),t})};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let N=e=>{e.preventDefault(),n.current?.();let t=e.clientY,r=f,i=document.body.style.cursor,a=document.body.style.userSelect;document.body.style.cursor=`ns-resize`,document.body.style.userSelect=`none`;let o=e=>{let n=b(r+t-e.clientY);h(n),E(n)},s=()=>{document.body.style.cursor=i,document.body.style.userSelect=a,window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s),n.current===s&&(n.current=null)};n.current=s,window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s,{once:!0}),window.addEventListener(`pointercancel`,s,{once:!0})};(0,v.useEffect)(()=>()=>n.current?.(),[]);let P=()=>{_(e=>{if(e.length>=C)return e;u.current+=1;let t=O(u.current);return S(t.id),[...e,t]})};(0,v.useEffect)(()=>{w!==k.current&&(k.current=w,P())},[w]);let F=e=>{_(n=>{let r=n.findIndex(t=>t.id===e);if(r===-1)return n;let i=n.filter(t=>t.id!==e);return i.length===0?(queueMicrotask(t),i):(y===e&&S(i[Math.max(0,r-1)]?.id??i[0]?.id??``),i)})},I=e=>{let t=D();_(n=>{let r=!1,i=n.map(n=>n.id===e?(r=!0,{...n,id:t,status:`starting`,exitCode:void 0}):n);return r&&S(t),i})},L=()=>{_([]),S(``),queueMicrotask(t)},R=(e,t)=>{_(n=>n.map(n=>n.id===e?{...n,...t}:n))},z=g.find(e=>e.id===y)??g[0]??null;return(0,x.jsxs)(`div`,{"data-terminal-dock":!0,style:{height:f},"data-shell":e?`desktop`:`browser`,className:p(`z-30 flex min-h-0 shrink-0 flex-col border-t border-border/70 bg-card shadow-2xl`,e&&`ws-terminal-desktop`),children:[(0,x.jsx)(`hr`,{"aria-orientation":`horizontal`,tabIndex:0,title:s(`activity:terminal.resize`),onPointerDown:N,className:`h-1.5 cursor-ns-resize bg-muted/70 transition-colors hover:bg-primary/35 border-0`}),(0,x.jsxs)(`div`,{className:p(`flex min-w-0 items-center justify-between gap-3 border-b border-border/70 bg-card/85`,e?`px-2 py-1`:`px-3 py-1.5`),children:[(0,x.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs text-foreground`,children:[(0,x.jsx)(r,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,x.jsx)(`span`,{className:`font-medium`,children:s(e?`activity:terminal.labelSingular`:`activity:terminal.labelPlural`)}),(0,x.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:j||M||s(`activity:terminal.projectShell`)})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(`button`,{type:`button`,onClick:P,disabled:g.length>=C,title:g.length>=C?s(`activity:terminal.maxTerminals`,{count:C}):s(`activity:terminal.newTerminal`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,x.jsx)(i,{className:`h-4 w-4`})}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>z&&I(z.id),disabled:!z,title:s(`activity:terminal.restart`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,x.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,x.jsx)(`button`,{type:`button`,onClick:L,disabled:g.length===0,title:s(`activity:terminal.closeAll`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,x.jsx)(c,{className:`h-3.5 w-3.5`})}),(0,x.jsx)(`button`,{type:`button`,onClick:t,title:s(`activity:terminal.closeDock`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,x.jsx)(o,{className:`h-4 w-4`})})]})]}),(0,x.jsx)(`div`,{className:p(`flex min-w-0 items-center gap-1 overflow-x-auto border-b border-border/70 bg-[hsl(var(--surface-2)/0.45)]`,e?`px-1.5 py-0.5`:`px-2 py-1`),children:g.map(t=>(0,x.jsxs)(`div`,{className:p(`group inline-flex items-center rounded border text-xs transition-colors`,e?`h-6 min-w-[92px] max-w-[148px]`:`h-7 min-w-[112px] max-w-[180px]`,y===t.id?`border-primary/35 bg-primary/10 text-primary`:`border-transparent bg-transparent text-muted-foreground hover:bg-accent hover:text-foreground`),children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>S(t.id),title:t.status===`exited`?`${t.name} exited`:t.name,className:`inline-flex min-w-0 flex-1 items-center gap-2 px-2 text-left`,children:[(0,x.jsx)(`span`,{className:p(`h-1.5 w-1.5 shrink-0 rounded-full`,t.status===`running`&&`bg-success`,t.status===`starting`&&`bg-primary`,t.status===`exited`&&`bg-destructive`)}),(0,x.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[t.name,t.status===`exited`&&typeof t.exitCode==`number`?` (${t.exitCode})`:``]})]}),(0,x.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),F(t.id)},className:`mr-1 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground opacity-70 hover:bg-accent hover:text-foreground hover:opacity-100`,title:s(`activity:terminal.closeTab`,{name:t.name}),children:(0,x.jsx)(o,{className:`h-3 w-3`})})]},t.id))}),M&&!e&&(0,x.jsx)(`div`,{className:`min-w-0 truncate border-b border-border/60 bg-muted/30 px-3 py-1 text-[11px] font-mono text-muted-foreground`,children:M}),(0,x.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:g.map(e=>(0,x.jsx)(A,{id:e.id,active:e.id===y,onRunning:()=>R(e.id,{status:`running`}),onExit:t=>R(e.id,{status:`exited`,exitCode:t})},e.id))})]})}function A({id:e,active:t,onRunning:n,onExit:r}){let i=(0,v.useRef)(null),a=(0,v.useRef)(null),o=(0,v.useRef)(null),c=(0,v.useRef)(n),l=(0,v.useRef)(r),d=h(e=>e.wsConnected);return(0,v.useEffect)(()=>{c.current=n,l.current=r},[r,n]),(0,v.useEffect)(()=>{let t=i.current;if(!t)return;let n=new _({fontFamily:`"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:13,cursorBlink:!0,theme:S,scrollback:5e3}),r=new g;a.current=n,o.current=r,n.loadAddon(r),n.open(t);try{r.fit()}catch{}let d=u(h.getState().wsUrl);d.send({type:`terminal.create`,payload:{id:e,cols:n.cols,rows:n.rows}});let f=!1,p=d.on(`terminal.output`,t=>{t.type===`terminal.output`&&t.payload.id===e&&(f||(f=!0,c.current()),n.write(t.payload.data))}),m=d.on(`terminal.exit`,t=>{t.type===`terminal.exit`&&t.payload.id===e&&(n.write(`\r\n\x1b[2m${s.t(`activity:terminal.processExited`,{code:t.payload.exitCode})}\x1b[0m\r\n`),l.current(t.payload.exitCode))}),v=n.onData(t=>{d.send({type:`terminal.input`,payload:{id:e,data:t}})}),y=new ResizeObserver(()=>{if(t.offsetParent)try{r.fit(),d.send({type:`terminal.resize`,payload:{id:e,cols:n.cols,rows:n.rows}})}catch{}});return y.observe(t),()=>{p(),m(),v.dispose(),y.disconnect(),d.send({type:`terminal.close`,payload:{id:e}}),n.dispose(),a.current=null,o.current=null}},[e,d]),(0,v.useEffect)(()=>{t&&window.requestAnimationFrame(()=>{try{o.current?.fit();let t=a.current;t&&(u(h.getState().wsUrl).send({type:`terminal.resize`,payload:{id:e,cols:t.cols,rows:t.rows}}),t.focus())}catch{}})},[t,e]),(0,x.jsx)(`div`,{ref:i,className:p(`absolute inset-0 min-h-0 min-w-0 overflow-hidden px-2 py-1`,t?`block`:`hidden`)})}export{k as TerminalPanel};
|