@wrongstack/webui 1.0.6 → 1.0.8
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/assets/{AgentRosterView-Cat9dDuY.js → AgentRosterView-C2PmzJWn.js} +4 -4
- package/dist/assets/AnalyticsDashboard-tA_UUQWD.js +1 -0
- package/dist/assets/AudienceMemoryPanel-DNopUX7m.js +3 -0
- package/dist/assets/{ChangesView-D0oqt9WQ.js → ChangesView-Cij-BSUX.js} +1 -1
- package/dist/assets/{ChimeraReviewsView-xYqbuZGK.js → ChimeraReviewsView-1TlYFUrk.js} +1 -1
- package/dist/assets/{ChronicleDashboard-BDaOO8qg.js → ChronicleDashboard-mZgdM2It.js} +1 -1
- package/dist/assets/{CodeEditor-BgJIgzjz.js → CodeEditor-CXf7lq5W.js} +2 -2
- package/dist/assets/{CodeMap-D47WG8ZE.js → CodeMap-CoQQ76zV.js} +1 -1
- package/dist/assets/{CronJobsPanel-oxmSB2ni.js → CronJobsPanel-CL4m2QgQ.js} +1 -1
- package/dist/assets/{DeadCodeScanPanel-DAOBcPPB.js → DeadCodeScanPanel-DxCRT8rV.js} +1 -1
- package/dist/assets/{DebugDashboard-P6-449d1.js → DebugDashboard-CMbbIq8d.js} +1 -1
- package/dist/assets/{DesignGalleryView-BUYdq9xj.js → DesignGalleryView-CcX5u8rA.js} +1 -1
- package/dist/assets/GoalView-CVjWpHkb.js +1 -0
- package/dist/assets/KanbanView-DQmHGtH3.js +3 -0
- package/dist/assets/{MailboxDetailView-CidOf8tE.js → MailboxDetailView-CfJjqySh.js} +1 -1
- package/dist/assets/{MemoryDrawer-D2iiRUm3.js → MemoryDrawer-C72rzAy0.js} +1 -1
- package/dist/assets/{MemoryManager-ajwrcppd.js → MemoryManager-DOZYeDYO.js} +1 -1
- package/dist/assets/{ProcessMonitor-D4q3YZ99.js → ProcessMonitor-C7h419Eb.js} +1 -1
- package/dist/assets/{PromptJournalView-BRTW81Ev.js → PromptJournalView-UkyefQGK.js} +1 -1
- package/dist/assets/ProviderTestView-B74V32hh.js +1 -0
- package/dist/assets/{QueuePanel--kMl1y82.js → QueuePanel-CW3iERCF.js} +1 -1
- package/dist/assets/RefreshDebugView-CDfO7Uid.js +1 -0
- package/dist/assets/RepositoryHistoryView-DnJ5jcgB.js +2 -0
- package/dist/assets/{RequirementIntakeView-DXimEE5N.js → RequirementIntakeView-CSTVrB4Y.js} +1 -1
- package/dist/assets/{SageTabs-DC4wv_Gu.js → SageTabs-DMFqP3JS.js} +2 -2
- package/dist/assets/{SddFlowGraph-BNd4F2pW.js → SddFlowGraph-hmWEIf45.js} +1 -1
- package/dist/assets/{SddHub-Dfsg4kpC.js → SddHub-BedY4SV-.js} +1 -1
- package/dist/assets/{SessionInspectView-CFKKgcpn.js → SessionInspectView-DA0kAM4e.js} +1 -1
- package/dist/assets/{SessionList-C_5GxI2E.js → SessionList-17tCMc4D.js} +1 -1
- package/dist/assets/{SessionsDashboard-yTvoFIQH.js → SessionsDashboard-CvrLsLGL.js} +1 -1
- package/dist/assets/SetupScreen-BHcAa0VI.js +1 -0
- package/dist/assets/{SkillDetailView-BZ-xB1C6.js → SkillDetailView-BODqDrPU.js} +1 -1
- package/dist/assets/{TechStackView-DPmmgBtE.js → TechStackView-DjP_PhtH.js} +2 -2
- package/dist/assets/TerminalPanel-perOinUJ.js +1 -0
- package/dist/assets/{activity-DBzijhvU.js → activity-BKJV5XjX.js} +1 -1
- package/dist/assets/{activity-D8QpThnB.js → activity-CHP09wRx.js} +1 -1
- package/dist/assets/{activity-DaNFfhdh.js → activity-DDfoWJrR.js} +1 -1
- package/dist/assets/{activity-BYWZhxvD.js → activity-DThW4oMo.js} +1 -1
- package/dist/assets/{activity-B6W4JEPC.js → activity-DZ2z6LSR.js} +1 -1
- package/dist/assets/{activity-C2ThLEx6.js → activity-EReqzYpW.js} +1 -1
- package/dist/assets/{activity-Co3aH0eV.js → activity-oY2h83Fp.js} +1 -1
- package/dist/assets/chat-store-BVz6zQLP.js +1 -0
- package/dist/assets/config-store-CZdk-vPj.js +22 -0
- package/dist/assets/i18n-BwptPW9U.js +3 -0
- package/dist/assets/index-BYBlSXtn.js +170 -0
- package/dist/assets/index-coebX2ug.css +1 -0
- package/dist/assets/{roster-ws-BviY2gOb.js → roster-ws-Cx9Bzoh0.js} +1 -1
- package/dist/assets/{stores-BOo4b1ZG.js → stores-Bt7wAdGA.js} +2 -2
- package/dist/assets/ui-store-CMdVzHOn.js +1 -0
- package/dist/assets/{view-navigation-Ca7VJMhX.js → view-navigation-BDsXeQ5i.js} +1 -1
- package/dist/components/ChatInput/slash-routing.d.ts +7 -0
- package/dist/components/ChatInput/subagent-models-button.d.ts +2 -0
- package/dist/components/ProviderTestView.d.ts +2 -0
- package/dist/components/QuickModelSwitcher.filter.d.ts +3 -1
- package/dist/components/SettingsPanel/ProviderSection.d.ts +1 -0
- package/dist/components/SettingsPanel/SubagentModelsSection.d.ts +14 -0
- package/dist/components/UserInputDialog.d.ts +2 -0
- package/dist/index.html +8 -8
- package/dist/index.js +14204 -12676
- package/dist/lib/clear-chat-context.d.ts +17 -0
- package/dist/lib/view-navigation.d.ts +1 -1
- package/dist/stores/index.d.ts +1 -0
- package/dist/stores/local-prefs.d.ts +29 -1
- package/dist/stores/ui-store-types.d.ts +1 -1
- package/dist/stores/user-input-store.d.ts +16 -0
- package/dist/types/client-message.d.ts +17 -2
- package/dist/types/runtime.d.ts +21 -0
- package/dist/types/server-message.d.ts +4 -4
- package/dist/types/system.d.ts +52 -0
- package/package.json +10 -9
- package/dist/assets/AnalyticsDashboard-BAC5fpQO.js +0 -1
- package/dist/assets/AudienceMemoryPanel-BOaFRWeR.js +0 -3
- package/dist/assets/GoalView-DfVrI8Br.js +0 -1
- package/dist/assets/KanbanView-DYzC0SvN.js +0 -3
- package/dist/assets/RefreshDebugView-Dty8h6nr.js +0 -1
- package/dist/assets/RepositoryHistoryView-DGlHg9K7.js +0 -2
- package/dist/assets/SetupScreen-BCgcO4L-.js +0 -1
- package/dist/assets/TerminalPanel-Cjineyx0.js +0 -1
- package/dist/assets/chat-store-Dl3XHXs8.js +0 -1
- package/dist/assets/config-store-Dq6MhrIA.js +0 -22
- package/dist/assets/i18n-CRIAwjnX.js +0 -3
- package/dist/assets/index-BI1MMjfc.js +0 -170
- package/dist/assets/index-DO49jK02.css +0 -1
- package/dist/assets/ui-store-D2CzZVyU.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{tt as t}from"./config-store-CZdk-vPj.js";import{i as n,t as r}from"./react-core-wiHys0m2.js";import{$t as i,La as a,Vi as o,Vt as s,Zt as c,di as l,dt as u,ja as d}from"./vendor-Cvuk-OYN.js";import"./i18n-BwptPW9U.js";import{n as f}from"./ui-store-CMdVzHOn.js";import{t as p}from"./chat-store-BVz6zQLP.js";var m=e(n(),1),h=r();function g(){let e=t(e=>e.session),{t:n}=a(),r=t.getState().session?.id,g=t(e=>e.projectName),x=t(e=>e.cwd),S=t(e=>e.mode),C=t(e=>e.contextMode),w=t(e=>e.lastVisitedAt),T=p(e=>e.messages),E=p(e=>e.queue.length),D=p(e=>e.boundSessionId),O=f(e=>e.currentView),k=f(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;return(0,h.jsx)(`div`,{className:`h-full min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain 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)(c,{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)(d,{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)(l,{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)(s,{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)(o,{className:`w-4 h-4 text-success shrink-0`}):(0,h.jsx)(u,{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)(o,{className:`h-4 w-4 shrink-0`}):(0,h.jsx)(u,{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-hePW80VL.js";import{nt as t,t as n}from"./config-store-CZdk-vPj.js";import{i as r,t as i}from"./react-core-wiHys0m2.js";import{Bi as a,Cr as o,Di as s,Jn as c,Qr as l,Ut as u,Xi as d,aa as f,br as p,gi as m,kr as h,qi as g,rn as _,wa as ee,wr as v,xr as y,yt as b}from"./vendor-Cvuk-OYN.js";import{t as x}from"./utils-sO9lidp6.js";import{o as S}from"./view-navigation-BDsXeQ5i.js";import"./stores-Bt7wAdGA.js";import{a as te,n as ne,o as re,r as ie,t as ae}from"./dialog-DNsBc-EF.js";import{I as C,P as oe}from"./index-BYBlSXtn.js";var w=e(r(),1),T=i(),E=[`#9b87f5`,`#37c9a2`,`#f2b95f`,`#67a7ff`,`#e879b8`,`#f07178`],D=48,O=15,k=`flex h-[44%] min-h-[230px] max-h-[460px] shrink-0 flex-col overflow-hidden border-t border-border/70 bg-card/35 shadow-[0_-16px_40px_-34px_hsl(var(--primary)/0.8)] sm:h-[36%] sm:max-h-[390px] sm:flex-row`;function A(e){let t=[],n=[],r=new Map(e.map((e,t)=>[e.hash,t]));for(let r of e){let e=t.indexOf(r.hash);e<0&&(e=t.indexOf(void 0),e<0&&(e=t.length)),n.push(e),t[e]=r.parents[0];for(let e of r.parents.slice(1)){if(t.includes(e))continue;let n=t.indexOf(void 0);n<0&&(n=t.length),t[n]=e}}let i=new Map(e.map((e,t)=>[e.hash,n[t]??0])),a=e.flatMap((e,t)=>e.parents.flatMap(e=>{let a=r.get(e);return a===void 0?[]:[{fromRow:t,fromLane:n[t]??0,toRow:a,toLane:i.get(e)??0}]}));return{lanes:n,laneCount:Math.max(1,...n.map(e=>e+1)),edges:a}}function j(e){return e.slice(0,7)}function se(e){let t=Date.now()-new Date(e).getTime();if(!Number.isFinite(t))return e;let n=Math.max(0,Math.round(t/6e4));if(n<60)return`${n}m`;let r=Math.round(n/60);if(r<48)return`${r}h`;let i=Math.round(r/24);return i<60?`${i}d`:new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(new Date(e))}function M(e){return e.split(/\s+/).slice(0,2).map(e=>e[0]?.toUpperCase()).join(``)}function N(e){return e.startsWith(`tag: `)?`border-amber-400/35 bg-amber-400/10 text-amber-500`:e.includes(`/`)?`border-emerald-400/30 bg-emerald-400/10 text-emerald-500`:`border-violet-400/35 bg-violet-400/12 text-violet-400`}function P({commits:e,layout:t}){let n=22+t.laneCount*O;return(0,T.jsxs)(`svg`,{"aria-label":`Commit topology`,className:`pointer-events-none absolute inset-y-0 left-0`,width:n,height:e.length*D,viewBox:`0 0 ${n} ${e.length*D}`,children:[t.edges.map((e,t)=>{let n=14+e.fromLane*O,r=14+e.toLane*O,i=e.fromRow*D+D/2,a=e.toRow*D+D/2,o=Math.min(18,Math.max(8,(a-i)*.35));return(0,T.jsx)(`path`,{d:`M ${n} ${i} C ${n} ${i+o}, ${r} ${a-o}, ${r} ${a}`,fill:`none`,stroke:E[e.fromLane%E.length],strokeWidth:`2`,strokeLinecap:`round`,opacity:`0.9`},`${e.fromRow}-${e.toRow}-${t}`)}),e.map((e,n)=>{let r=t.lanes[n]??0,i=e.parents.length>1;return(0,T.jsxs)(`g`,{children:[(0,T.jsx)(`circle`,{cx:14+r*O,cy:n*D+D/2,r:i?5:4,fill:`hsl(var(--background))`,stroke:E[r%E.length],strokeWidth:i?2.5:2}),!i&&(0,T.jsx)(`circle`,{cx:14+r*O,cy:n*D+D/2,r:`1.5`,fill:E[r%E.length]})]},e.hash)})]})}function ce({refs:e,activeRef:t,onSelect:n}){let r=[{kind:`local`,label:`Local branches`,icon:v},{kind:`remote`,label:`Remotes`,icon:y},{kind:`tag`,label:`Tags`,icon:b}];return(0,T.jsxs)(`aside`,{className:`hidden min-h-0 w-[218px] shrink-0 flex-col border-r border-border/70 bg-card/35 xl:flex`,children:[(0,T.jsxs)(`div`,{className:`border-b border-border/60 px-4 py-3`,children:[(0,T.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.18em] text-muted-foreground`,children:`Repository`}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>n(``),className:x(`mt-2 flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-xs transition-colors`,t===``?`bg-primary/12 text-primary`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:[(0,T.jsx)(f,{className:`h-3.5 w-3.5`}),` All branches`]})]}),(0,T.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 py-3`,children:r.map(({kind:r,label:i,icon:a})=>{let o=e.filter(e=>e.kind===r);return o.length===0?null:(0,T.jsxs)(`section`,{className:`mb-5`,children:[(0,T.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 px-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground/75`,children:[(0,T.jsx)(a,{className:`h-3 w-3`}),` `,i,(0,T.jsx)(`span`,{className:`ml-auto font-mono`,children:o.length})]}),o.map(e=>(0,T.jsxs)(`button`,{type:`button`,onClick:()=>n(e.name),title:e.name,className:x(`group flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left text-[11px] transition-colors`,t===e.name?`bg-primary/12 text-primary`:`text-muted-foreground hover:bg-muted/55 hover:text-foreground`),children:[(0,T.jsx)(`span`,{className:x(`h-1.5 w-1.5 shrink-0 rounded-full`,e.current?`bg-primary shadow-[0_0_8px_hsl(var(--primary))]`:`bg-muted-foreground/45`)}),(0,T.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.shortName}),e.current&&(0,T.jsx)(d,{className:`h-3 w-3`})]},e.name))]},r)})})]})}function F({commit:e,detail:t,loading:n,onOpenFile:r}){let[i,o]=(0,w.useState)(!1);if(!e)return(0,T.jsx)(`section`,{className:`flex h-[34%] min-h-[210px] shrink-0 items-center justify-center border-t border-border/70 bg-card/30 p-6 text-center text-xs text-muted-foreground`,children:`Select a commit to inspect its files and metadata.`});let u=t?.files??[],f=u.reduce((e,t)=>e+t.added,0),h=u.reduce((e,t)=>e+t.deleted,0),_=t?.body?.split(/\r?\n/).slice(1).join(`
|
|
2
|
+
`).trim();return(0,T.jsxs)(`section`,{className:k,children:[(0,T.jsxs)(`div`,{className:`w-full max-w-none shrink-0 overflow-y-auto border-b border-border/70 px-5 py-4 sm:w-[34%] sm:min-w-[250px] sm:max-w-[440px] sm:border-b-0 sm:border-r`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.17em] text-muted-foreground`,children:[(0,T.jsx)(a,{className:`h-3.5 w-3.5 text-primary`}),` Commit details`]}),(0,T.jsx)(`h2`,{className:`mt-3 text-sm font-semibold leading-5 text-foreground`,children:e.subject}),(0,T.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`flex h-7 w-7 items-center justify-center rounded-full border border-primary/25 bg-primary/10 text-[10px] font-bold text-primary`,children:M(e.author)}),(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`div`,{className:`truncate text-xs font-medium`,children:e.author}),(0,T.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:e.email})]})]}),(0,T.jsxs)(`button`,{type:`button`,onClick:async()=>{await navigator.clipboard?.writeText(e.hash),o(!0),window.setTimeout(()=>o(!1),1200)},className:`mt-4 flex w-full items-center justify-between rounded-lg border border-border/70 bg-background/55 px-3 py-2 font-mono text-[11px] text-muted-foreground hover:border-primary/35 hover:text-foreground`,children:[(0,T.jsx)(`span`,{children:j(e.hash)}),i?(0,T.jsx)(d,{className:`h-3.5 w-3.5 text-success`}):(0,T.jsx)(m,{className:`h-3.5 w-3.5`})]}),(0,T.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 overflow-hidden rounded-lg border border-border/70`,children:[(0,T.jsxs)(`div`,{className:`border-r border-border/70 p-3`,children:[(0,T.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:u.length}),(0,T.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`Files`})]}),(0,T.jsxs)(`div`,{className:`p-3`,children:[(0,T.jsxs)(`div`,{className:`font-mono text-xs`,children:[(0,T.jsxs)(`span`,{className:`text-success`,children:[`+`,f]}),` `,(0,T.jsxs)(`span`,{className:`text-destructive`,children:[`-`,h]})]}),(0,T.jsx)(`div`,{className:`mt-1 text-[10px] uppercase tracking-wider text-muted-foreground`,children:`Lines`})]})]}),(0,T.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,T.jsx)(s,{className:`h-3.5 w-3.5`}),new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e.authoredAt))]}),e.parents.length>1&&(0,T.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-[11px] text-violet-400`,children:[(0,T.jsx)(p,{className:`h-3.5 w-3.5`}),`Merge of `,e.parents.length,` parents`]}),_&&(0,T.jsx)(`p`,{className:`mt-4 whitespace-pre-wrap rounded-lg border border-border/60 bg-background/45 px-3 py-2.5 text-[11px] leading-5 text-muted-foreground`,children:_}),e.refs.length>0&&(0,T.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-1.5`,children:e.refs.map(e=>(0,T.jsx)(`span`,{className:x(`rounded-md border px-1.5 py-0.5 text-[9px]`,N(e)),children:e.replace(/^tag: /,``)},e))})]}),(0,T.jsxs)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto p-4 sm:p-5`,children:[(0,T.jsx)(`div`,{className:`mt-5 text-[10px] font-bold uppercase tracking-[0.15em] text-muted-foreground`,children:`Changed files`}),n?(0,T.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,T.jsx)(c,{className:`h-3.5 w-3.5 animate-spin`}),`Loading changes…`]}):t?.error?(0,T.jsx)(`div`,{className:`py-5 text-xs text-destructive`,children:t.error}):(0,T.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[u.map(e=>(0,T.jsxs)(`button`,{type:`button`,onClick:()=>r(e),className:`group w-full rounded-lg border border-transparent px-2 py-2 text-left transition-colors hover:border-primary/30 hover:bg-primary/[0.055]`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(l,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,T.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px]`,title:e.path,children:e.path}),(0,T.jsx)(g,{className:`h-3 w-3 shrink-0 text-muted-foreground opacity-0 transition-all group-hover:translate-x-0.5 group-hover:opacity-100`})]}),(0,T.jsxs)(`div`,{className:`mt-1 pl-5 font-mono text-[10px]`,children:[(0,T.jsxs)(`span`,{className:`text-success`,children:[`+`,e.added]}),(0,T.jsxs)(`span`,{className:`ml-2 text-destructive`,children:[`-`,e.deleted]})]})]},e.path)),u.length===0&&(0,T.jsx)(`div`,{className:`py-5 text-xs text-muted-foreground`,children:`No file changes reported.`})]})]})]})}function I(){let{client:e}=C(),r=n(e=>e.wsConnected),i=t(e=>e.files),[a,s]=(0,w.useState)(null),[d,f]=(0,w.useState)(null),[m,b]=(0,w.useState)(null),[E,k]=(0,w.useState)(``),[I,le]=(0,w.useState)(``),[L,R]=(0,w.useState)(!0),[ue,z]=(0,w.useState)(!1),[B,V]=(0,w.useState)(null),[H,U]=(0,w.useState)(!1),[de,W]=(0,w.useState)(!1),G=(0,w.useRef)(null),K=(0,w.useRef)(null);G.current=m;let q=(0,w.useCallback)((t,n=0)=>{e&&r&&(R(!0),e.getGitHistory({...t?{ref:t}:{},limit:160,skip:n}),e.getGitChanges())},[e,r]);(0,w.useEffect)(()=>{if(!e)return;let t=e.on(`git.history`,e=>{s(t=>e.payload.skip>0&&t?{...e.payload,commits:[...t.commits,...e.payload.commits],refs:t.refs}:e.payload),R(!1);let t=e.payload.commits[0]?.hash??null;b(n=>e.payload.skip>0||n&&e.payload.commits.some(e=>e.hash===n)?n:t)}),n=e.on(`git.commit_detail`,e=>{e.payload.hash===G.current&&(f(e.payload),z(!1))}),r=e.on(`git.commit_file_diff`,e=>{`${e.payload.hash}:${e.payload.path}`===K.current&&(V(e.payload),W(!1))});return q(``),()=>{t(),n(),r()}},[e,q]),(0,w.useEffect)(()=>{m&&e&&(f(null),z(!0),e.getGitCommitDetail(m))},[e,m]);let J=(0,w.useMemo)(()=>{let e=I.trim().toLowerCase();return e?(a?.commits??[]).filter(t=>`${t.subject} ${t.author} ${t.email} ${t.hash} ${t.refs.join(` `)}`.toLowerCase().includes(e)):a?.commits??[]},[a?.commits,I]),Y=(0,w.useMemo)(()=>A(J),[J]),X=22+Y.laneCount*O,fe=a?.commits.find(e=>e.hash===m)??null,Z=(0,w.useMemo)(()=>{let e=a?.commits??[];return{commits:e.length,contributors:new Set(e.map(e=>e.email||e.author)).size,merges:e.filter(e=>e.parents.length>1).length,branches:(a?.refs??[]).filter(e=>e.kind!==`tag`).length}},[a]),Q=e=>{k(e),b(null),f(null),q(e)},$=e=>{if(J.length===0)return;let t=Math.max(0,J.findIndex(e=>e.hash===m));b(J[Math.max(0,Math.min(J.length-1,t+e))]?.hash??null)};return(0,T.jsxs)(`div`,{className:`relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden bg-[radial-gradient(circle_at_48%_-20%,hsl(var(--primary)/0.10),transparent_42%),hsl(var(--background))]`,"data-testid":`repository-history-view`,children:[(0,T.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,T.jsx)(ce,{refs:a?.refs??[],activeRef:E,onSelect:Q}),(0,T.jsxs)(`section`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,T.jsxs)(`header`,{className:`shrink-0 border-b border-border/70 bg-card/30 px-4 py-3 backdrop-blur-xl sm:px-5`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,T.jsx)(`div`,{children:(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-xl border border-primary/25 bg-primary/10 text-primary shadow-[0_0_22px_hsl(var(--primary)/0.12)]`,children:(0,T.jsx)(y,{className:`h-4 w-4`})}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-base font-semibold tracking-tight`,children:`Repository history`}),(0,T.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Every branch. One clear picture.`})]})]})}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(`span`,{className:`hidden rounded-full border border-border/70 bg-background/55 px-2.5 py-1 font-mono text-[10px] text-muted-foreground sm:inline-flex`,children:[(0,T.jsx)(v,{className:`mr-1.5 h-3 w-3 text-primary`}),a?.currentBranch||`—`]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>q(E),className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-border/70 bg-background/55 px-2.5 text-xs text-muted-foreground transition-colors hover:border-primary/35 hover:text-foreground`,children:[(0,T.jsx)(_,{className:x(`h-3.5 w-3.5`,L&&`animate-spin`)}),`Refresh`]})]})]}),(0,T.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,T.jsxs)(`label`,{className:`relative min-w-[220px] flex-1`,children:[(0,T.jsx)(u,{className:`pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,T.jsx)(`input`,{value:I,onChange:e=>le(e.target.value),placeholder:`Search commits, authors, hashes…`,className:`h-9 w-full rounded-lg border border-border/70 bg-background/60 pl-9 pr-3 text-xs outline-none transition focus:border-primary/50 focus:ring-2 focus:ring-primary/10`})]}),(0,T.jsxs)(`label`,{className:`relative xl:hidden`,children:[(0,T.jsx)(h,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,T.jsxs)(`select`,{value:E,onChange:e=>Q(e.target.value),className:`h-9 max-w-[190px] appearance-none rounded-lg border border-border/70 bg-background/60 pl-8 pr-7 text-xs outline-none`,children:[(0,T.jsx)(`option`,{value:``,children:`All branches`}),a?.refs.map(e=>(0,T.jsx)(`option`,{value:e.name,children:e.shortName},e.name))]})]})]})]}),(0,T.jsx)(`div`,{className:`grid h-10 shrink-0 grid-cols-4 divide-x divide-border/60 border-b border-border/70 bg-card/20`,children:[[`Commits`,Z.commits],[`Branches`,Z.branches],[`Contributors`,Z.contributors],[`Merges`,Z.merges]].map(([e,t])=>(0,T.jsxs)(`div`,{className:`flex items-center justify-center gap-2 px-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs font-semibold tabular-nums text-foreground`,children:t}),(0,T.jsx)(`span`,{className:`hidden text-[9px] font-semibold uppercase tracking-wider text-muted-foreground sm:inline`,children:e})]},e))}),i.length>0&&(0,T.jsxs)(`button`,{type:`button`,onClick:()=>S(`changes`),className:`group flex h-10 shrink-0 items-center gap-3 border-b border-border/70 bg-primary/[0.055] px-4 text-left text-xs hover:bg-primary/[0.09]`,children:[(0,T.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full border border-primary bg-background`}),(0,T.jsx)(`span`,{className:`font-medium`,children:`Working changes`}),(0,T.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:i.length}),(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:`Your next chapter starts here`}),(0,T.jsx)(g,{className:`ml-auto h-3.5 w-3.5 text-muted-foreground transition-transform group-hover:translate-x-0.5`})]}),(0,T.jsxs)(`div`,{className:`grid h-7 shrink-0 grid-cols-[minmax(0,1fr)_120px_82px_48px] items-center border-b border-border/70 bg-muted/20 px-3 text-[9px] font-bold uppercase tracking-[0.14em] text-muted-foreground sm:grid-cols-[minmax(0,1fr)_160px_92px_58px]`,children:[(0,T.jsx)(`span`,{style:{paddingLeft:X+10},children:`Graph / commit message`}),(0,T.jsx)(`span`,{children:`Author`}),(0,T.jsx)(`span`,{children:`Commit`}),(0,T.jsx)(`span`,{children:`When`})]}),(0,T.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:L&&!a?(0,T.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,T.jsx)(c,{className:`h-4 w-4 animate-spin text-primary`}),`Mapping repository history…`]}):a?.error?(0,T.jsx)(`div`,{className:`flex h-full items-center justify-center p-8 text-sm text-destructive`,children:a.error}):J.length===0?(0,T.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,T.jsx)(o,{className:`h-7 w-7 opacity-45`}),`No commits match this view.`]}):(0,T.jsxs)(`div`,{className:`relative min-w-[700px]`,style:{height:J.length*D},children:[(0,T.jsx)(P,{commits:J,layout:Y}),J.map((e,t)=>{let n=e.hash===m;return(0,T.jsxs)(`button`,{type:`button`,onClick:()=>b(e.hash),onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`j`)&&(e.preventDefault(),$(1)),(e.key===`ArrowUp`||e.key===`k`)&&(e.preventDefault(),$(-1))},className:x(`absolute left-0 grid w-full grid-cols-[minmax(0,1fr)_120px_82px_48px] items-center border-b border-border/45 pr-3 text-left transition-colors sm:grid-cols-[minmax(0,1fr)_160px_92px_58px]`,n?`bg-primary/[0.075] shadow-[inset_2px_0_hsl(var(--primary))]`:`hover:bg-muted/35`),style:{top:t*D,height:D},children:[(0,T.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,style:{paddingLeft:X+10},children:(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.refs.slice(0,2).map(e=>(0,T.jsx)(`span`,{className:x(`hidden max-w-[170px] shrink-0 truncate rounded-md border px-1.5 py-0.5 text-[9px] font-medium md:inline`,N(e)),children:e.replace(/^tag: /,``)},e)),(0,T.jsx)(`span`,{className:x(`truncate text-xs`,n?`font-semibold text-foreground`:`text-foreground/90`),children:e.subject}),e.parents.length>1&&(0,T.jsx)(p,{className:`h-3.5 w-3.5 shrink-0 text-violet-400`})]})}),(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-bold text-muted-foreground`,children:M(e.author)}),(0,T.jsx)(`span`,{className:`truncate text-[10px] text-muted-foreground`,children:e.author})]}),(0,T.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:j(e.hash)}),(0,T.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:se(e.authoredAt)})]},e.hash)})]})}),(0,T.jsxs)(`footer`,{className:`flex h-7 shrink-0 items-center border-t border-border/70 bg-card/25 px-4 text-[9px] text-muted-foreground`,children:[(0,T.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,T.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-violet-400`}),`Commit`]}),(0,T.jsxs)(`span`,{className:`ml-4 flex items-center gap-1.5`,children:[(0,T.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full border border-emerald-400`}),`Merge`]}),(0,T.jsxs)(`span`,{className:`ml-auto font-mono`,children:[J.length,` commits · topological order`]}),a?.hasMore&&!I&&(0,T.jsx)(`button`,{type:`button`,onClick:()=>q(E,a.commits.length),disabled:L,className:`ml-3 rounded border border-border/70 px-1.5 py-0.5 font-sans text-[9px] font-semibold uppercase tracking-wider hover:border-primary/40 hover:text-primary disabled:opacity-50`,children:`Load more`}),(0,T.jsx)(ee,{className:`ml-2 h-3 w-3`})]})]})]}),(0,T.jsx)(F,{commit:fe,detail:d,loading:ue,onOpenFile:t=>{e&&m&&(K.current=`${m}:${t.path}`,V(null),W(!0),U(!0),e.getGitCommitFileDiff(m,t.path,t.previousPath))}}),(0,T.jsx)(ae,{open:H,onOpenChange:U,children:(0,T.jsxs)(ne,{className:`h-[min(86dvh,860px)] max-w-[min(94vw,1180px)] grid-rows-[auto_minmax(0,1fr)] gap-0 overflow-hidden p-0 sm:p-0`,children:[(0,T.jsx)(te,{className:`border-b border-border/70 bg-card/80 px-5 py-4 pr-12`,children:(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,T.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-primary/25 bg-primary/10 text-primary`,children:(0,T.jsx)(l,{className:`h-4 w-4`})}),(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(re,{className:`truncate font-mono text-sm`,children:B?.path??`Commit file diff`}),(0,T.jsxs)(ie,{className:`mt-1 flex items-center gap-2 text-[11px]`,children:[(0,T.jsx)(`span`,{className:`font-mono`,children:B?j(B.hash):`—`}),B?.previousPath&&B.previousPath!==B.path&&(0,T.jsxs)(`span`,{className:`truncate`,children:[`renamed from `,B.previousPath]})]})]})]})}),(0,T.jsx)(`div`,{className:`min-h-0 overflow-hidden bg-[hsl(var(--surface-2)/0.45)] p-3`,children:(0,T.jsx)(`div`,{className:`flex h-full min-h-0 overflow-hidden rounded-lg border border-border/70 bg-background/70`,children:de||!B?(0,T.jsxs)(`div`,{className:`flex flex-1 items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,T.jsx)(c,{className:`h-4 w-4 animate-spin text-primary`}),` Loading revision diff…`]}):B.error?(0,T.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-sm text-destructive`,children:B.error}):B.binary?(0,T.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Binary files cannot be displayed as text.`}):B.tooLarge?(0,T.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`This revision is too large for the inline diff viewer.`}):(0,T.jsx)(oe,{oldText:B.oldText??``,newText:B.newText??``,caption:B.path,fill:!0})})})]})})]})}export{I as RepositoryHistoryView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{La as r}from"./vendor-Cvuk-OYN.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{La as r}from"./vendor-Cvuk-OYN.js";import"./i18n-BwptPW9U.js";import{t as i}from"./utils-sO9lidp6.js";import{t as a}from"./button-CN_h6kNT.js";import{t as o}from"./input-BnTFqRjn.js";import{g as s}from"./index-BYBlSXtn.js";var c=e(t(),1),l=n(),u=[`feature`,`bug_fix`,`refactor`,`performance`,`security`,`ui_change`,`api_change`,`infrastructure`,`migration`,`testing`,`documentation`,`maintenance`,`other`,`unspecified`],d=[`unspecified`,`low`,`medium`,`high`,`critical`],f={draft:`bg-muted text-muted-foreground`,collecting_information:`bg-warning/15 text-warning`,submitted:`bg-success/15 text-success`,cancelled:`bg-destructive/15 text-destructive`,archived:`bg-muted text-muted-foreground`};function p(e){let t=Date.now()-e;if(t<6e4)return`just now`;let n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function m(){let{t:e}=r(),[t,n]=(0,c.useState)(null),[m,h]=(0,c.useState)([]),[g,_]=(0,c.useState)(!0),[v,y]=(0,c.useState)(null),[b,x]=(0,c.useState)(``),[S,C]=(0,c.useState)(``),[w,T]=(0,c.useState)(`unspecified`),[E,D]=(0,c.useState)(`unspecified`),[O,k]=(0,c.useState)(!1),[A,j]=(0,c.useState)(null),[M,N]=(0,c.useState)(null),P=(0,c.useCallback)(async()=>{_(!0),y(null);try{let e=await fetch(`/api/requirement-intakes`);if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error?.message??`List failed (HTTP ${e.status})`)}let t=await e.json();n(t.projectId),h(t.intakes)}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}},[]);(0,c.useEffect)(()=>{P()},[P]);let F=(0,c.useCallback)(async()=>{let e=b.trim();if(!e){j(`Describe the request first — it is preserved verbatim.`);return}if(!t){j(`No project identity available yet.`);return}k(!0),j(null),N(null);try{let n=await fetch(`/api/projects/${encodeURIComponent(t)}/requirement-intakes`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectId:t,requestedBy:`webui`,originalRequest:e,...S.trim()?{title:S.trim()}:{},...w===`unspecified`?{}:{requestType:w},...E===`unspecified`?{}:{priority:E}})}),r=await n.json().catch(()=>null);if(!n.ok||!r?.record)throw Error(r?.error?.message??`Create failed (HTTP ${n.status})`);let i=await fetch(`/api/requirement-intakes/${r.record.id}/submit`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!i.ok){let e=await i.json().catch(()=>null);throw Error(e?.error?.message??`Submit failed (HTTP ${i.status})`)}N(`Intake recorded and submitted (${r.record.id}).`),x(``),C(``),T(`unspecified`),D(`unspecified`),await P()}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}},[b,S,w,E,t,P]);return(0,l.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[(0,l.jsxs)(`header`,{className:`border-b border-border/70 px-5 py-3`,children:[(0,l.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:e(`activity:reqIntake.requirementsIntake`)}),(0,l.jsx)(`div`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:e(`activity:reqIntake.collectAndPreserveSoftwareDevelopmentRequests`)})]}),(0,l.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-5`,children:[v?(0,l.jsxs)(`div`,{role:`alert`,className:`mb-4 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:[v,(0,l.jsx)(`button`,{type:`button`,className:`ml-2 underline underline-offset-2`,onClick:()=>void P(),children:e(`activity:reqIntake.retry`)})]}):null,(0,l.jsxs)(`section`,{"aria-label":e(`activity:reqIntake.fileANewIntake`),className:`mb-6 rounded-lg border border-border/70 bg-card/60 p-4`,children:[(0,l.jsx)(`div`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:e(`activity:reqIntake.fileANewRequest`)}),(0,l.jsxs)(`div`,{className:`space-y-3`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsxs)(`label`,{htmlFor:`intake-request`,className:`mb-1 block text-xs text-foreground`,children:[e(`activity:reqIntake.requestText`),` `,(0,l.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,l.jsx)(`textarea`,{id:`intake-request`,value:b,onChange:e=>x(e.target.value),placeholder:e(`activity:reqIntake.describeTheFeatureBugFixRefactorOrChange`),rows:4,className:i(`w-full resize-y rounded-md border border-border/70 bg-background px-3 py-2`,`text-sm text-foreground placeholder:text-muted-foreground/70`,`focus:outline-none focus:ring-2 focus:ring-ring`)}),/\[VIBE\]/i.test(b)?(0,l.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5 rounded bg-primary/10 px-2 py-1 text-[11px] font-medium text-primary`,children:[(0,l.jsx)(`span`,{children:`🌊`}),(0,l.jsxs)(`span`,{children:[(0,l.jsx)(`strong`,{children:`VIBE Protocol Detected:`}),` Three-Stage Verification (Spec-Synthesizer → Coder → Auditor) is active.`]})]}):null,(0,l.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:e(`activity:reqIntake.storedVerbatimAsTheRecordApos`)})]}),(0,l.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`intake-title`,className:`mb-1 block text-xs text-foreground`,children:e(`activity:reqIntake.titleOptional`)}),(0,l.jsx)(o,{id:`intake-title`,value:S,onChange:e=>C(e.target.value),placeholder:e(`activity:reqIntake.shortDisplayTitle`)})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`intake-type`,className:`mb-1 block text-xs text-foreground`,children:e(`activity:reqIntake.type`)}),(0,l.jsx)(`select`,{id:`intake-type`,value:w,onChange:e=>T(e.target.value),className:i(`w-full rounded-md border border-border/70 bg-background px-2 py-2`,`text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-ring`),children:u.map(e=>(0,l.jsx)(`option`,{value:e,children:e},e))})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`intake-priority`,className:`mb-1 block text-xs text-foreground`,children:e(`activity:reqIntake.priority`)}),(0,l.jsx)(`select`,{id:`intake-priority`,value:E,onChange:e=>D(e.target.value),className:i(`w-full rounded-md border border-border/70 bg-background px-2 py-2`,`text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-ring`),children:d.map(e=>(0,l.jsx)(`option`,{value:e,children:e},e))})]})]}),A?(0,l.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:A}):null,M?(0,l.jsx)(`div`,{role:`status`,className:`rounded-md border border-success/30 bg-success/10 px-3 py-2 text-xs text-success`,children:M}):null,(0,l.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,l.jsx)(a,{variant:`secondary`,size:`sm`,disabled:O,onClick:()=>{x(``),j(null),N(null)},children:e(`activity:reqIntake.clear`)}),(0,l.jsx)(a,{size:`sm`,disabled:O||!b.trim(),onClick:()=>void F(),children:O?`Filing…`:`File + submit`})]})]})]}),(0,l.jsxs)(`section`,{"aria-label":e(`activity:reqIntake.intakeRecords`),className:`space-y-2`,children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,l.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:e(`activity:reqIntake.records`)}),(0,l.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[m.length,` total`]})]}),g?(0,l.jsx)(`div`,{className:`py-8 text-center text-xs text-muted-foreground`,children:e(`activity:reqIntake.loading`)}):m.length===0?(0,l.jsx)(`div`,{className:`rounded-md border border-dashed border-border/70 py-10 text-center text-xs text-muted-foreground`,children:e(`activity:reqIntake.noIntakeRecordsYetFileThe`)}):(0,l.jsx)(`ul`,{className:`space-y-2`,children:m.map(e=>(0,l.jsxs)(`li`,{className:`rounded-md border border-border/70 bg-card/60 p-3`,children:[(0,l.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,l.jsxs)(`div`,{className:`min-w-0`,children:[(0,l.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,title:e.title,children:e.title}),(0,l.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-muted-foreground`,children:e.id})]}),(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1.5`,children:[e.isVibeMode?(0,l.jsx)(s,{variant:`outline`,className:`border-primary/40 bg-primary/10 text-[10px] text-primary`,children:`🌊 VIBE`}):null,(0,l.jsx)(s,{variant:`secondary`,className:`text-[10px]`,children:e.requestType}),(0,l.jsx)(s,{className:i(`text-[10px]`,f[e.status]??`bg-muted text-muted-foreground`),children:e.status})]})]}),(0,l.jsxs)(`div`,{className:`mt-1.5 text-[11px] text-muted-foreground`,children:[e.priority,` · updated `,p(e.updatedAt)]})]},e.id))})]})]})]})}export{m as RequirementIntakeView};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MemoryManager-
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{$n as r,En as i,La as a,rt as o}from"./vendor-Cvuk-OYN.js";import"./i18n-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MemoryManager-DOZYeDYO.js","assets/rolldown-runtime-hePW80VL.js","assets/config-store-CZdk-vPj.js","assets/react-core-wiHys0m2.js","assets/vendor-Cvuk-OYN.js","assets/xyflow-BqDBClm9.js","assets/xyflow-DLioOiRN.css","assets/markdown-BzOXYqOo.js","assets/vendor-BShi5_Dg.css","assets/i18n-BwptPW9U.js","assets/chat-BITJe8-v.js","assets/commandPalette-BovBiPec.js","assets/common-CmkkiJUR.js","assets/setup-qooXjj4V.js","assets/toasts-DZ6HdKgG.js","assets/vite-preload-Czpn1I53.js","assets/utils-sO9lidp6.js","assets/ui-store-CMdVzHOn.js","assets/stores-Bt7wAdGA.js","assets/chat-store-BVz6zQLP.js","assets/codemap-activity-store-RqE4L9Os.js","assets/mailbox-store-CV5--Nmh.js","assets/dialog-DNsBc-EF.js","assets/button-CN_h6kNT.js","assets/input-BnTFqRjn.js","assets/index-BYBlSXtn.js","assets/view-navigation-BDsXeQ5i.js","assets/index-coebX2ug.css","assets/roster-ws-Cx9Bzoh0.js","assets/shared-h0I65HLY.js","assets/MemoryDrawer-C72rzAy0.js","assets/AudienceMemoryPanel-DNopUX7m.js","assets/vector-memory-panel-BtQElVO4.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{$n as r,En as i,La as a,rt as o}from"./vendor-Cvuk-OYN.js";import"./i18n-BwptPW9U.js";import{t as s}from"./vite-preload-Czpn1I53.js";import{t as c}from"./utils-sO9lidp6.js";import{A as l,D as u,O as d,k as f}from"./index-BYBlSXtn.js";var p=e(t(),1),m=n(),h=(0,p.lazy)(()=>s(()=>import(`./MemoryManager-DOZYeDYO.js`).then(e=>({default:e.MemoryManager})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]))),g=(0,p.lazy)(()=>s(()=>import(`./AudienceMemoryPanel-DNopUX7m.js`).then(e=>({default:e.AudienceMemoryPanel})),__vite__mapDeps([31,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,22,23,24,25,2,17,26,18,19,20,21,27,29]))),_=(0,p.lazy)(()=>s(()=>import(`./vector-memory-panel-BtQElVO4.js`).then(e=>({default:e.VectorMemoryPanel})),__vite__mapDeps([32,1,3,4,5,6,7,8,22,16,23])));function v({label:e}){return(0,m.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-background text-xs text-muted-foreground`,"aria-busy":`true`,children:(0,m.jsxs)(`span`,{className:`font-mono uppercase tracking-wide`,children:[e,`…`]})})}var y=[{value:`all`,label:`activity:memoryManager.tabAllMemories`,hint:`activity:memoryManager.tabAllMemoriesHint`,Icon:r},{value:`audience`,label:`activity:memoryManager.tabAudience`,hint:`activity:memoryManager.tabAudienceHint`,Icon:o},{value:`vector`,label:`activity:memoryManager.tabVectorMemory`,hint:`activity:memoryManager.tabVectorMemoryHint`,Icon:i}];function b({defaultValue:e=`all`}={}){let{t}=a();return(0,m.jsxs)(u,{defaultValue:e,className:`flex h-full min-h-0 min-w-0 flex-1 flex-col`,children:[(0,m.jsx)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-border/70 bg-card/55 px-4 py-2 sm:px-5`,role:`presentation`,children:(0,m.jsx)(f,{"aria-label":t(`activity:memoryManager.lensesAria`),className:`h-9 bg-muted/40 p-1 shadow-none`,children:y.map(({value:e,label:n,hint:r,Icon:i})=>(0,m.jsxs)(l,{value:e,className:c(`h-7 gap-2 px-3 text-[11px] font-semibold uppercase tracking-wide`,`data-[state=active]:bg-background data-[state=active]:text-foreground`,`data-[state=active]:shadow-[0_0_0_1px_hsl(var(--border)/0.7)]`),children:[(0,m.jsx)(i,{className:`size-3.5`}),(0,m.jsx)(`span`,{children:t(n)}),(0,m.jsx)(`span`,{className:`hidden font-mono text-[9px] font-normal normal-case text-muted-foreground sm:inline`,children:t(r)})]},e))})}),(0,m.jsx)(d,{value:`all`,className:`mt-0 flex-1 overflow-hidden ring-offset-0 focus-visible:ring-0`,children:(0,m.jsx)(p.Suspense,{fallback:(0,m.jsx)(v,{label:t(`activity:memoryManager.loadingSage`)}),children:(0,m.jsx)(h,{})})}),(0,m.jsx)(d,{value:`audience`,className:`mt-0 flex-1 overflow-hidden ring-offset-0 focus-visible:ring-0`,children:(0,m.jsx)(p.Suspense,{fallback:(0,m.jsx)(v,{label:t(`activity:memoryManager.loadingAudience`)}),children:(0,m.jsx)(g,{})})}),(0,m.jsx)(d,{value:`vector`,className:`mt-0 flex-1 overflow-y-auto px-4 pb-6 pt-4 ring-offset-0 focus-visible:ring-0 sm:px-5`,children:(0,m.jsx)(p.Suspense,{fallback:(0,m.jsx)(v,{label:t(`activity:memoryManager.loadingVectorMemory`)}),children:(0,m.jsx)(_,{})})})]})}export{b as SageTabs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{Bi as r,Dt as i,It as a,J as o,Jn as s,La as c,Qt as l,Xi as u,br as d,dt as f,ha as p,or as m,ra as h,un as g,wr as _}from"./vendor-Cvuk-OYN.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{Bi as r,Dt as i,It as a,J as o,Jn as s,La as c,Qt as l,Xi as u,br as d,dt as f,ha as p,or as m,ra as h,un as g,wr as _}from"./vendor-Cvuk-OYN.js";import"./i18n-BwptPW9U.js";import{a as v,c as y,h as b,n as x,o as S,p as C,r as w,t as T,u as E}from"./xyflow-BqDBClm9.js";import{t as D}from"./utils-sO9lidp6.js";var O=e(t(),1),k=n();function A({pct:e}){let{t}=c(),n=(0,O.useId)(),r=2*Math.PI*26,i=r-Math.max(0,Math.min(100,e))/100*r;return(0,k.jsxs)(`div`,{className:`relative h-16 w-16 shrink-0`,children:[(0,k.jsxs)(`svg`,{viewBox:`0 0 64 64`,className:`h-16 w-16 -rotate-90`,role:`img`,"aria-label":t(`activity:progressring.progress`),children:[(0,k.jsx)(`circle`,{cx:`32`,cy:`32`,r:26,fill:`none`,stroke:`hsl(var(--muted))`,strokeWidth:`6`}),(0,k.jsx)(`circle`,{cx:`32`,cy:`32`,r:26,fill:`none`,stroke:`url(#${n})`,strokeWidth:`6`,strokeLinecap:`round`,strokeDasharray:r,strokeDashoffset:i,style:{transition:`stroke-dashoffset 0.6s cubic-bezier(0.16,1,0.3,1)`}}),(0,k.jsx)(`defs`,{children:(0,k.jsxs)(`linearGradient`,{id:n,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,k.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--primary))`}),(0,k.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--info))`})]})})]}),(0,k.jsxs)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm font-bold text-foreground`,children:[Math.round(e),`%`]})]})}var j={pending:{label:`Pending`,icon:r,text:`text-muted-foreground`,ring:`border-border/70 bg-muted/45`,dot:`bg-muted-foreground`,hex:`hsl(var(--muted-foreground))`},queued:{label:`Ready`,icon:r,text:`text-primary`,ring:`border-primary/35 bg-primary/10`,dot:`bg-primary`,hex:`hsl(var(--primary))`},in_progress:{label:`Running`,icon:s,spin:!0,text:`text-warning`,ring:`border-warning/45 bg-warning/10`,dot:`bg-warning`,hex:`hsl(var(--warning))`},blocked:{label:`Blocked`,icon:r,text:`text-destructive`,ring:`border-destructive/30 bg-destructive/10`,dot:`bg-destructive`,hex:`hsl(var(--destructive))`},review:{label:`Review`,icon:r,text:`text-primary`,ring:`border-primary/35 bg-primary/10`,dot:`bg-primary`,hex:`hsl(var(--info))`},failed:{label:`Failed`,icon:o,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:p,text:`text-muted-foreground`,ring:`border-border/70 bg-muted/45`,dot:`bg-muted-foreground`,hex:`hsl(var(--muted-foreground))`}};function M(e){return j[e]??j.pending}var N={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 P(e){return N[e]??N.medium}var F={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`},I=[`bg-warning`,`bg-primary`,`bg-success`,`bg-destructive`,`bg-secondary`,`bg-muted-foreground`,`bg-accent`],L={started:{icon:g,color:`text-warning`},completed:{icon:u,color:`text-success`},failed:{icon:o,color:`text-destructive`},retrying:{icon:l,color:`text-warning`},wave:{icon:m,color:`text-primary`},deadlock:{icon:f,color:`text-destructive`},verification_failed:{icon:a,color:`text-destructive`},conflict:{icon:d,color:`text-warning`},split:{icon:i,color:`text-primary`},supervisor:{icon:h,color:`text-primary`}};function R(e){let t=e.trim().split(/\s+/);return((t[0]?.[0]??``)+(t[1]?.[0]??``)).toUpperCase()||`·`}function z(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 B(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 V=300,H=128,U=240,W={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 G({data:e}){let t=e.task,{t:n}=c(),i=W[t.displayStatus],a=t.displayStatus===`in_progress`,d=t.displayStatus===`completed`?u:t.displayStatus===`failed`?o:a?s:r;return(0,k.jsxs)(`div`,{className:D(`sdd-node-enter group relative rounded-lg border bg-card/95 px-2.5 py-2 text-left shadow-lg backdrop-blur`,i.ring,a&&`sdd-node-running`,t.displayStatus===`completed`&&`sdd-node-complete`,t.displayStatus===`failed`&&`sdd-node-failed`,e.onTaskClick&&`hover:brightness-125`),style:{width:U,animationDelay:`${Math.min(e.index*45,600)}ms`},children:[e.onTaskClick&&(0,k.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,k.jsx)(v,{type:`target`,position:b.Left,isConnectable:!1,className:`!h-1.5 !w-1.5 !border-0 !bg-border`}),(0,k.jsx)(v,{type:`source`,position:b.Right,isConnectable:!1,className:`!h-1.5 !w-1.5 !border-0 !bg-border`}),(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,k.jsx)(d,{className:D(`h-3.5 w-3.5`,a&&`animate-spin`,i.chip.split(` `).find(e=>e.startsWith(`text`)))}),(0,k.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:t.shortId}),(0,k.jsx)(`span`,{className:D(`font-mono text-[10px] font-bold uppercase`,P(t.priority).text),children:t.priority[0]}),(0,k.jsx)(`span`,{className:D(`ml-auto rounded px-1.5 py-px text-[9px] font-medium`,i.chip),children:n(`activity:sdd.status.${t.displayStatus}`)})]}),(0,k.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[11px] leading-snug text-foreground`,children:t.title}),(t.agentName||t.worktreeBranch)&&(0,k.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[t.agentName&&(0,k.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,k.jsx)(`span`,{className:D(`flex h-4 w-4 items-center justify-center rounded-full text-[8px] font-bold text-white`,a?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:R(t.agentName)}),(0,k.jsx)(`span`,{className:`max-w-[88px] truncate text-[10px] text-muted-foreground`,children:t.agentName})]}),t.retries?(0,k.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-destructive`,children:[(0,k.jsx)(l,{className:`h-2.5 w-2.5`}),t.retries]}):null,t.worktreeBranch&&(0,k.jsxs)(`span`,{className:`ml-auto flex items-center gap-0.5 text-[9px] text-muted-foreground`,title:t.worktreeBranch,children:[(0,k.jsx)(_,{className:`h-2.5 w-2.5`}),(0,k.jsx)(`span`,{className:`max-w-[70px] truncate`,children:t.worktreeBranch.replace(/^.*\//,``)})]})]})]})}function K({data:e}){return(0,k.jsx)(`div`,{className:`whitespace-nowrap text-[11px] font-bold uppercase text-muted-foreground`,children:e.label})}var q={task:G,colLabel:K};function J(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*V,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*V,y:o*H},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:M(t.displayStatus).hex,strokeWidth:i?2.2:1.4,opacity:t.displayStatus===`pending`?.4:.85}})}return{nodes:i,edges:o}}function Y({tasks:e,columns:t,onTaskClick:n}){let{fitView:r}=C(),{nodes:i,edges:a}=(0,O.useMemo)(()=>J(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,k.jsxs)(E,{nodes:i,edges:a,nodeTypes:q,fitView:!0,fitViewOptions:{padding:.18},minZoom:.2,maxZoom:1.6,proOptions:{hideAttribution:!0},nodesConnectable:!1,elementsSelectable:!!n,children:[(0,k.jsx)(T,{variant:x.Dots,gap:22,size:1,color:`hsl(var(--border))`}),(0,k.jsx)(w,{showInteractive:!1,className:`!bottom-2 !left-2`}),(0,k.jsx)(S,{pannable:!0,zoomable:!0,nodeStrokeWidth:2,maskColor:`hsl(var(--background) / 0.65)`,nodeColor:e=>{let t=e.data?.task?.displayStatus;return t?M(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 X({tasks:e,columns:t,onTaskClick:n}){return(0,k.jsx)(y,{children:(0,k.jsx)(Y,{tasks:e,columns:t,onTaskClick:n})})}export{R as a,P as c,F as i,M as l,I as n,B as o,L as r,z as s,X as t,A as u};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{Ba as r,Bn as i,Ca as a,Dt as o,Ei as s,En as c,Ht as l,J as u,Jn as d,Kn as f,La as p,Mi as m,Mn as h,Ot as g,Qt as _,Vi as v,Vr as y,Xi as b,Yi as x,Zi as S,_t as C,ai as ee,ca as w,dt as T,en as E,gi as te,ha as D,hn as ne,ir as O,it as k,ja as A,ji as j,kt as M,lt as N,mi as re,mt as P,nr as ie,ot as ae,q as oe,qi as F,un as I,vt as L,wr as se,wt as R}from"./vendor-Cvuk-OYN.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{Ba as r,Bn as i,Ca as a,Dt as o,Ei as s,En as c,Ht as l,J as u,Jn as d,Kn as f,La as p,Mi as m,Mn as h,Ot as g,Qt as _,Vi as v,Vr as y,Xi as b,Yi as x,Zi as S,_t as C,ai as ee,ca as w,dt as T,en as E,gi as te,ha as D,hn as ne,ir as O,it as k,ja as A,ji as j,kt as M,lt as N,mi as re,mt as P,nr as ie,ot as ae,q as oe,qi as F,un as I,vt as L,wr as se,wt as R}from"./vendor-Cvuk-OYN.js";import"./i18n-BwptPW9U.js";import{t as z}from"./utils-sO9lidp6.js";import{o as B,r as V}from"./view-navigation-BDsXeQ5i.js";import{n as H}from"./ui-store-CMdVzHOn.js";import{a as U,h as W,o as G,r as K}from"./stores-Bt7wAdGA.js";import{a as q,i as J,n as ce,o as le,r as ue,t as de}from"./dialog-DNsBc-EF.js";import{t as Y}from"./button-CN_h6kNT.js";import{I as fe,_ as pe,h as me,m as he,v as ge}from"./index-BYBlSXtn.js";import{a as _e,c as ve,i as ye,l as be,n as xe,o as Se,r as Ce,s as we,t as Te,u as Ee}from"./SddFlowGraph-hmWEIf45.js";var X=e(t(),1),Z=n();function De({feed:e,now:t}){let{t:n}=p();return(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,Z.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,Z.jsx)(A,{className:`h-3.5 w-3.5 text-warning`}),n(`activity:sdd.activityHeading`)]}),(0,Z.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 space-y-1 overflow-auto overscroll-contain p-2`,children:e.length===0?(0,Z.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=Ce[e.kind]??Ce.started,i=r.icon;return(0,Z.jsxs)(`div`,{className:z(`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,Z.jsx)(i,{className:z(`mt-0.5 h-3.5 w-3.5 shrink-0`,r.color)}),(0,Z.jsx)(`span`,{className:`flex-1 leading-snug text-foreground`,children:e.text}),(0,Z.jsx)(`span`,{className:`shrink-0 tabular-nums text-[10px] text-muted-foreground`,children:Se(e.ts,t)})]},`${e.ts}-${n}`)})})]})}function Oe({open:e,onOpenChange:t,snapshot:n,busy:r,onConfirm:i}){let{t:a}=p(),o=n?.mergedCommits?.length??0,s=n?.baseBranch,[c,l]=(0,X.useState)(!1);(0,X.useEffect)(()=>{e&&l(!1)},[e]);let u=n?.status===`running`||n?.status===`paused`,f=(0,X.useMemo)(()=>{let e=new Set;for(let t of n?.tasks??[])t.worktreeBranch&&e.add(t.worktreeBranch);return e.size},[n?.tasks]),m=(0,X.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,Z.jsx)(de,{open:e,onOpenChange:e=>!r&&t(e),children:(0,Z.jsxs)(ce,{className:`sm:max-w-lg border-destructive/50`,children:[(0,Z.jsxs)(q,{children:[(0,Z.jsxs)(le,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{className:`h-5 w-5 text-destructive`}),a(`activity:sdd.destroyTitle`)]}),(0,Z.jsx)(ue,{children:a(`activity:sdd.destroyDesc`)})]}),(0,Z.jsxs)(`ul`,{className:`space-y-1.5 py-1 text-sm`,children:[u&&(0,Z.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,Z.jsx)(`span`,{children:m>0?a(`activity:sdd.stopRunAgents`,{count:m}):a(`activity:sdd.stopRun`)})]}),(0,Z.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,Z.jsx)(`span`,{children:f>0?a(`activity:sdd.removeWorktreesCount`,{count:f}):a(`activity:sdd.removeWorktreesAll`)})]}),(0,Z.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,Z.jsx)(`span`,{children:a(`activity:sdd.deleteArtifacts`)})]})]}),o>0&&(0,Z.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,Z.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked),className:`mt-0.5 h-4 w-4 accent-warning`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:a(`activity:sdd.revertMerged`,{count:o})}),` `,`on`,` `,(0,Z.jsx)(`code`,{className:`text-xs`,children:s??a(`activity:sdd.baseBranchFallback`)}),(0,Z.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:a(`activity:sdd.revertHint`)})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md bg-muted/50 p-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(T,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-warning`}),a(o>0&&!c?`activity:sdd.noteLeaveMerged`:`activity:sdd.noteAbandon`)]}),(0,Z.jsxs)(J,{className:`gap-2 sm:gap-2`,children:[(0,Z.jsx)(Y,{variant:`outline`,size:`sm`,disabled:r,onClick:()=>t(!1),children:a(`common:action.cancel`)}),(0,Z.jsx)(Y,{size:`sm`,disabled:r,onClick:()=>i(c),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(d,{className:`mr-1 h-3.5 w-3.5 animate-spin`}),` `,a(`activity:sdd.destroying`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(P,{className:`mr-1 h-3.5 w-3.5`}),` `,a(`activity:sdd.destroyAll`)]})})]})]})})}var ke=[{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 Q({tasks:e,selectedId:t,onTaskClick:n}){let{t:r}=p(),i=(0,X.useMemo)(()=>{let t=new Map;for(let e of ke)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,Z.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 gap-3 overflow-x-auto p-4`,children:ke.map(e=>{let a=i.get(e.key)??[];return(0,Z.jsxs)(`div`,{className:`flex min-h-0 w-64 shrink-0 flex-col`,children:[(0,Z.jsxs)(`div`,{className:z(`mb-2 flex items-center gap-2 border-b-2 pb-1.5`,e.accent),children:[(0,Z.jsx)(`span`,{className:z(`text-xs font-bold uppercase tracking-wide`,e.head),children:r(`activity:sdd.${e.labelKey}`)}),(0,Z.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 text-[10px] text-muted-foreground`,children:a.length})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain pr-1`,children:[a.map(e=>(0,Z.jsx)(Ae,{task:e,selected:e.id===t,onClick:()=>n(e.id)},e.id)),a.length===0&&(0,Z.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 Ae({task:e,selected:t,onClick:n}){let r=e.displayStatus===`in_progress`;return(0,Z.jsxs)(`button`,{type:`button`,onClick:n,className:z(`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`,r&&`sdd-node-running`,e.displayStatus===`completed`&&`sdd-node-complete`,e.displayStatus===`failed`&&`sdd-node-failed`),children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[r&&(0,Z.jsx)(d,{className:`h-3 w-3 animate-spin text-warning`}),e.displayStatus===`completed`&&(0,Z.jsx)(b,{className:`h-3 w-3 text-success`}),e.displayStatus===`failed`&&(0,Z.jsx)(u,{className:`h-3 w-3 text-destructive`}),(0,Z.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:e.shortId}),(0,Z.jsx)(`span`,{className:z(`ml-auto rounded px-1.5 text-[9px] font-bold uppercase`,ve(e.priority).chip),children:e.priority})]}),(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[11px] leading-snug text-foreground`,children:e.title}),(e.agentName||e.worktreeBranch||e.retries)&&(0,Z.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[e.agentName&&(0,Z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{className:z(`flex h-4 w-4 items-center justify-center rounded-full text-[8px] font-bold text-white`,r?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:_e(e.agentName)}),(0,Z.jsx)(`span`,{className:`max-w-[80px] truncate text-[10px] text-muted-foreground`,children:e.agentName})]}),e.retries?(0,Z.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-destructive`,children:[(0,Z.jsx)(_,{className:`h-2.5 w-2.5`}),e.retries]}):null,e.worktreeBranch&&(0,Z.jsx)(se,{className:`ml-auto h-2.5 w-2.5 text-muted-foreground`})]})]})}function je({task:e,allTasks:t,feed:n,now:r,expanded:c,modelCandidates:l,defaultModel:d,onClose:f,onToggleExpanded:m,onRetry:g,onReassign:v,onSetModel:y,onSetVerification:x,onCancel:S,onDelete:C,onSplit:ee,onSelectTask:w}){let{t:T}=p(),E=be(e.displayStatus),te=E.icon,D=e.displayStatus===`in_progress`,ne=e.displayStatus===`pending`||e.displayStatus===`blocked`||e.displayStatus===`queued`,[O,k]=(0,X.useState)(!1),[A,j]=(0,X.useState)(``),[M,N]=(0,X.useState)(null),[re,ie]=(0,X.useState)(!1),[oe,F]=(0,X.useState)(``),[I,L]=(0,X.useState)(!1),[B,V]=(0,X.useState)(e.verificationCommand??``),H=()=>{A.trim()&&(v(e.id,A.trim()),k(!1),j(``))},U=()=>{let t=oe.split(`
|
|
2
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&&(ee(e.id,t),ie(!1),F(``))},W=(0,X.useMemo)(()=>new Map(t.map(e=>[e.shortId,e])),[t]),G=(0,X.useMemo)(()=>t.filter(t=>t.deps.includes(e.shortId)),[t,e.shortId]),K=(0,X.useMemo)(()=>n.filter(t=>t.taskId===e.id||t.taskShortId===e.shortId),[n,e.id,e.shortId]),q=e.startedAt&&!e.completedAt?we(r-e.startedAt):e.startedAt&&e.completedAt?we(e.completedAt-e.startedAt):null;return(0,Z.jsxs)(`div`,{className:`sdd-rise flex h-full min-h-0 min-w-0 flex-col`,children:[(0,Z.jsxs)(`div`,{className:z(`flex items-center gap-2 border-b border-border/70 bg-card/70 px-3 py-2`,c&&`px-5 py-3`),children:[(0,Z.jsx)(`button`,{type:`button`,onClick:f,className:`text-muted-foreground hover:text-foreground`,title:T(`activity:sddTask.backTitle`),children:(0,Z.jsx)(a,{className:`h-4 w-4`})}),(0,Z.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),m&&(0,Z.jsx)(`button`,{type:`button`,onClick:m,className:`ml-1 inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition hover:bg-muted hover:text-foreground`,title:T(c?`activity:sddTask.collapseTitle`:`activity:sddTask.expandTitle`),"aria-label":T(c?`activity:sddTask.collapseTitle`:`activity:sddTask.expandTitle`),"aria-pressed":c,children:c?(0,Z.jsx)(h,{className:`h-4 w-4`}):(0,Z.jsx)(i,{className:`h-4 w-4`})}),(0,Z.jsxs)(`span`,{className:z(`ml-auto flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px]`,E.ring,E.text),children:[(0,Z.jsx)(te,{className:z(`h-3 w-3`,D&&`animate-spin`)}),E.label]})]}),(0,Z.jsxs)(`div`,{className:z(`min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain`,c?`grid grid-cols-2 content-start gap-4 p-5`:`space-y-3 p-3`),children:[(0,Z.jsx)(`h3`,{className:z(`text-sm font-semibold leading-snug text-foreground`,c&&`col-span-2 text-lg`),children:e.title}),e.agentName&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/70 bg-muted/45 p-2`,children:[(0,Z.jsx)(`span`,{className:z(`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:_e(e.agentName)}),(0,Z.jsxs)(`div`,{className:`leading-tight`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:e.agentName}),(0,Z.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:T(D?`activity:sddTask.workingOn`:`activity:sddTask.assigned`)})]})]}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-1.5 text-[11px]`,children:[(0,Z.jsx)(Ne,{label:T(`activity:sddTask.metaPriority`),children:(0,Z.jsx)(`span`,{className:z(`font-medium uppercase`,ve(e.priority).text),children:e.priority})}),(0,Z.jsx)(Ne,{label:T(`activity:sddTask.metaType`),children:e.type}),q&&(0,Z.jsx)(Ne,{label:e.completedAt?T(`activity:sddTask.metaDuration`):T(`activity:sddTask.metaElapsed`),children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(s,{className:`h-3 w-3 text-muted-foreground`}),q]})}),e.retries?(0,Z.jsx)(Ne,{label:T(`activity:sddTask.metaRetries`),children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 text-destructive`,children:[(0,Z.jsx)(_,{className:`h-3 w-3`}),e.retries]})}):null,e.worktreeBranch&&(0,Z.jsx)(Ne,{label:T(`activity:sddTask.metaWorktree`),full:!0,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 font-mono text-foreground`,title:e.worktreeBranch,children:[(0,Z.jsx)(se,{className:`h-3 w-3 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.worktreeBranch})]})})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[T(`activity:sddTask.workerModel`),!e.model&&d&&(0,Z.jsxs)(`span`,{className:`font-normal normal-case text-muted-foreground`,children:[`· `,T(`activity:sddTask.runDefault`,{model:d})]})]}),(0,Z.jsx)(me,{value:e.model,provider:e.provider,candidates:l,placeholder:d?T(`activity:sddTask.runDefaultPlaceholderModel`,{model:d}):T(`activity:sddTask.runDefaultPlaceholder`),onPick:(t,n)=>y(e.id,t,n),onReset:e.model?()=>y(e.id,void 0,void 0):void 0}),e.fallbackModels&&e.fallbackModels.length>0&&(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:e.fallbackModels.map(e=>(0,Z.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`↳ `,e]},e))})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[T(`activity:sddTask.verificationCmd`),(0,Z.jsxs)(`span`,{className:`font-normal normal-case text-muted-foreground`,children:[`· `,T(`activity:sddTask.gatesCompletion`)]})]}),I?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`input`,{value:B,onChange:e=>V(e.target.value),onKeyDown:t=>{t.key===`Enter`?(x(e.id,B.trim()||void 0),L(!1)):t.key===`Escape`&&(V(e.verificationCommand??``),L(!1))},placeholder:T(`activity:sddTask.verifyPlaceholder`),className:`w-full rounded border border-border bg-background px-2 py-1 font-mono text-[11px] text-foreground`}),(0,Z.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{x(e.id,B.trim()||void 0),L(!1)},className:`rounded bg-primary px-2 py-0.5 text-[10px] text-primary-foreground hover:opacity-90`,children:T(`common:action.save`)}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{V(e.verificationCommand??``),L(!1)},className:`rounded bg-muted px-2 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:T(`common:action.cancel`)})]})]}):e.verificationCommand?(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.verificationState&&(0,Z.jsx)(`span`,{title:e.verificationDetail,className:e.verificationState===`passed`?`rounded bg-success/10 px-1.5 py-0.5 text-[10px] text-success`:`rounded bg-destructive/10 px-1.5 py-0.5 text-[10px] text-destructive`,children:e.verificationState===`passed`?`✓ verified`:`✗ failed`}),(0,Z.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,Z.jsx)(`button`,{type:`button`,onClick:()=>L(!0),className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:T(`common:action.edit`)}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>x(e.id,void 0),className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:T(`common:action.clear`)})]}):(0,Z.jsx)(`button`,{type:`button`,onClick:()=>L(!0),className:`rounded border border-dashed border-border px-2 py-1 text-[10px] text-muted-foreground hover:bg-muted`,children:T(`activity:sddTask.addVerify`)})]}),e.description&&(0,Z.jsxs)(`div`,{className:z(c&&`col-span-2`),children:[(0,Z.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:T(`activity:sddTask.description`)}),(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap rounded-md bg-muted p-2 text-[11px] leading-relaxed text-foreground`,children:e.description})]}),(0,Z.jsx)(Me,{events:K,expanded:c}),e.deps.length>0&&(0,Z.jsx)(Pe,{title:T(`activity:sddTask.dependsOn`),shortIds:e.deps,byShort:W,onSelectTask:w}),G.length>0&&(0,Z.jsx)(Pe,{title:T(`activity:sddTask.blocks`),shortIds:G.map(e=>e.shortId),byShort:W,onSelectTask:w})]}),(0,Z.jsxs)(`div`,{className:z(`border-t border-border p-2`,c&&`px-5 py-3`),children:[O?(0,Z.jsxs)(`div`,{className:`sdd-rise flex items-center gap-1.5`,children:[(0,Z.jsx)(`input`,{value:A,onChange:e=>j(e.target.value),onKeyDown:e=>{e.key===`Enter`&&H(),e.key===`Escape`&&k(!1)},placeholder:T(`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,Z.jsx)(`button`,{type:`button`,onClick:H,disabled:!A.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,Z.jsx)(b,{className:`h-3.5 w-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>k(!1),className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,Z.jsx)(u,{className:`h-3.5 w-3.5`})})]}):M?(0,Z.jsxs)(`div`,{className:`sdd-rise flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`flex-1 text-xs text-foreground`,children:T(M===`stop`?`activity:sddTask.confirmStop`:`activity:sddTask.confirmDelete`)}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{M===`stop`?S(e.id):C(e.id),N(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,Z.jsx)(b,{className:`h-3.5 w-3.5`}),` `,T(M===`stop`?`common:action.stop`:`common:action.delete`)]}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>N(null),className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,Z.jsx)(u,{className:`h-3.5 w-3.5`})})]}):(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>g(e.id),title:T(`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,Z.jsx)(_,{className:`h-3.5 w-3.5`}),` `,T(`common:action.retry`)]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>k(!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,Z.jsx)(ae,{className:`h-3.5 w-3.5`}),` `,T(`activity:sddTask.reassign`)]}),D&&(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>N(`stop`),title:T(`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,Z.jsx)(R,{className:`h-3.5 w-3.5`}),` `,T(`common:action.stop`)]}),!D&&(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>ie(!0),title:T(`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,Z.jsx)(o,{className:`h-3.5 w-3.5`}),` `,T(`activity:sddTask.split`)]}),ne&&(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>N(`delete`),title:T(`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,Z.jsx)(P,{className:`h-3.5 w-3.5`}),` `,T(`common:action.delete`)]})]}),re&&(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-[11px] text-muted-foreground`,htmlFor:`sdd-split-input`,children:T(`activity:sddTask.splitHint`)}),(0,Z.jsx)(`textarea`,{id:`sdd-split-input`,rows:3,value:oe,onChange:e=>F(e.target.value),placeholder:T(`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,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:U,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,Z.jsx)(o,{className:`h-3.5 w-3.5`}),` `,T(`activity:sddTask.splitInto`)]}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{ie(!1),F(``)},className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,Z.jsx)(u,{className:`h-3.5 w-3.5`})})]})]})]})]})}function Me({events:e,expanded:t}){let{t:n}=p();return(0,Z.jsxs)(`section`,{className:z(`rounded-lg border border-border/70 bg-background/45`,t&&`col-span-2`),children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/60 px-3 py-2.5`,children:[(0,Z.jsx)(A,{className:`h-4 w-4 text-primary`}),(0,Z.jsx)(`h4`,{className:`text-xs font-semibold text-foreground`,children:n(`activity:sddTask.eventLog`)}),(0,Z.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[10px] text-muted-foreground`,children:e.length}),(0,Z.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:n(`activity:sddTask.newestFirst`)})]}),e.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-5 text-center text-[11px] text-muted-foreground`,children:n(`activity:sddTask.noEvents`)}):(0,Z.jsx)(`div`,{className:z(`divide-y divide-border/45 overflow-auto`,t?`max-h-[32rem]`:`max-h-72`),children:e.map((e,t)=>{let n=e.kind===`file`,r=e.kind===`tool`,i=e.ok===!1||e.kind===`failed`||e.kind===`verification_failed`,a=n?y:r?C:A;return(0,Z.jsxs)(`div`,{className:z(`grid grid-cols-[4.75rem_1rem_minmax(0,1fr)] gap-2 px-3 py-2.5 text-[11px]`,i&&`bg-destructive/[0.035]`),children:[(0,Z.jsx)(`time`,{dateTime:new Date(e.ts).toISOString(),className:`font-mono text-[10px] text-muted-foreground`,title:new Date(e.ts).toLocaleString(),children:new Date(e.ts).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}),(0,Z.jsx)(a,{className:z(`mt-0.5 h-3.5 w-3.5`,i?`text-destructive`:n?`text-info`:r?`text-warning`:`text-primary`)}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[e.action&&(0,Z.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] font-medium text-foreground`,children:e.action}),e.agentName&&(0,Z.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.agentName}),e.durationMs!==void 0&&(0,Z.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.durationMs<1e3?`${Math.round(e.durationMs)}ms`:`${(e.durationMs/1e3).toFixed(1)}s`})]}),e.filePath?(0,Z.jsx)(`code`,{className:`mt-1 block break-all font-mono text-[10px] leading-relaxed text-foreground`,children:e.filePath}):e.detail?(0,Z.jsx)(`code`,{className:`mt-1 block break-words font-mono text-[10px] leading-relaxed text-muted-foreground`,children:e.detail}):(0,Z.jsx)(`p`,{className:`mt-1 break-words leading-relaxed text-foreground`,children:e.text})]})]},`${e.ts}-${e.kind}-${t}`)})})]})}function Ne({label:e,children:t,full:n}){return(0,Z.jsxs)(`div`,{className:z(`rounded-md border border-border bg-muted/50 px-2 py-1`,n&&`col-span-2`),children:[(0,Z.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide text-muted-foreground`,children:e}),(0,Z.jsx)(`div`,{className:`text-foreground`,children:t})]})}function Pe({title:e,shortIds:t,byShort:n,onSelectTask:r}){return(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map(e=>{let t=n.get(e);return(0,Z.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,Z.jsx)(`span`,{className:z(`h-1.5 w-1.5 rounded-full`,be(t?.displayStatus??`pending`).dot)}),(0,Z.jsx)(`span`,{className:`font-mono`,children:e})]},e)})})]})}function Fe({onClose:e}){let{t}=p(),{client:n}=fe(),r=G(e=>e.snapshot),i=G(e=>e.lifecycleResult),a=G(e=>e.destroying),o=G(e=>e.setDestroying),s=G(e=>e.setLifecycleResult),[c,l]=(0,X.useState)(()=>Date.now()),[d,f]=(0,X.useState)(null),[m,h]=(0,X.useState)(!1),[g,v]=(0,X.useState)(`graph`),[y,b]=(0,X.useState)(!1);(0,X.useEffect)(()=>{n?.send?.({type:`sdd.board.get`})},[n]);let x=r&&(r.status===`running`||r.status===`paused`);(0,X.useEffect)(()=>{if(!x)return;let e=setInterval(()=>l(Date.now()),1e3);return l(Date.now()),()=>clearInterval(e)},[x]);let S=(0,X.useCallback)(e=>n?.send?.(e),[n]),C=(0,X.useRef)(null),w=(0,X.useCallback)(e=>{C.current=null,S({type:`sdd.board.destroy`,payload:{revertMerged:e}})},[S]),E=(0,X.useCallback)(e=>{b(!1),s(null),o(!0),x?(S({type:`sdd.board.stop`,payload:{}}),C.current={revertMerged:e,deadline:Date.now()+5e3}):w(e)},[x,S,w,o,s]);(0,X.useEffect)(()=>{let e=C.current;if(!e)return;if(!x||Date.now()>=e.deadline){w(e.revertMerged);return}let t=setTimeout(()=>{let e=C.current;e&&w(e.revertMerged)},Math.max(0,e.deadline-Date.now()));return()=>clearTimeout(t)},[x,r,w]);let te=(0,X.useCallback)(()=>{s(null),S({type:`sdd.board.cleanup_worktrees`,payload:{}})},[S,s]),D=(0,X.useCallback)(()=>{s(null),S({type:`sdd.board.rollback`,payload:{}})},[S,s]),O=(0,X.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]),k=(0,X.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]),j=(0,X.useCallback)(e=>f(e),[]),M=(0,X.useCallback)(()=>{f(null),h(!1)},[]),ie=(0,X.useCallback)(e=>S({type:`sdd.board.retry`,payload:{taskId:e}}),[S]),ae=(0,X.useCallback)(()=>S({type:`sdd.board.retry_all_failed`,payload:{}}),[S]),F=(0,X.useCallback)((e,t)=>{let n=t.trim();n&&S({type:`sdd.board.reassign`,payload:{taskId:e,agentName:n}})},[S]),L=(0,X.useCallback)((e,t,n)=>S({type:`sdd.board.set_task_model`,payload:{taskId:e,model:t,provider:n}}),[S]),se=(0,X.useCallback)((e,t)=>S({type:`sdd.board.set_task_verification`,payload:{taskId:e,verificationCommand:t}}),[S]),B=(0,X.useCallback)(e=>S({type:`sdd.board.cancel_task`,payload:{taskId:e}}),[S]),V=(0,X.useCallback)(e=>{S({type:`sdd.board.delete_task`,payload:{taskId:e}}),f(null),h(!1)},[S]),U=(0,X.useCallback)((e,t)=>{S({type:`sdd.board.split_task`,payload:{taskId:e,subtasks:t}}),f(null),h(!1)},[S]),K=pe(d!==null),q=(0,X.useMemo)(()=>r?.tasks.find(e=>e.id===d)??null,[r?.tasks,d]),J=r?.progress,ce=r?.diagnostics?.deadlockChains??[];return(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,Z.jsxs)(`header`,{className:`sdd-sheen shrink-0 border-b border-border px-4 pb-3 pt-2.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(A,{className:`h-5 w-5 text-warning`}),(0,Z.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:r?.title??t(`activity:sddBoard.titleFallback`)}),r&&(0,Z.jsx)(`span`,{className:z(`rounded-full border px-2 py-0.5 text-[11px] font-medium capitalize`,ye[r.status]??ye.idle),children:r.status}),r?.defaultModel&&(0,Z.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,Z.jsx)(re,{className:`h-3 w-3 text-primary`}),r.defaultModel]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r&&(0,Z.jsxs)(`button`,{type:`button`,title:t(`activity:sddBoardView.openTheMirroredKanbanBoardSForThisRunOnePerDependencyWave`),onClick:()=>{let e=`run:${r.runId}`,t=W.getState().boards.filter(t=>t.tags?.includes(e)),i=t.find(e=>e.tags?.includes(`phase:wave-0`))??t[0];i&&(W.getState().setActiveBoardId(i.id),n?.send?.({type:`kanban.get`,payload:{boardId:i.id}})),H.getState().setCurrentView(`kanban`)},className:`inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-muted-foreground hover:bg-muted`,children:[(0,Z.jsx)(A,{className:`h-3.5 w-3.5`}),` Kanban`]}),r&&(0,Z.jsx)(`div`,{className:`flex items-center rounded-md border border-border bg-muted p-0.5 text-[11px]`,children:[`graph`,`kanban`].map(e=>(0,Z.jsx)(`button`,{type:`button`,onClick:()=>v(e),className:z(`rounded px-2 py-0.5 capitalize transition`,g===e?`bg-primary/12 text-primary`:`text-muted-foreground hover:text-foreground`),children:t(e===`graph`?`activity:sddBoard.graphLabel`:`activity:sddBoard.kanbanLabel`)},e))}),x&&(J?.failed??0)>0&&(0,Z.jsxs)(`button`,{type:`button`,onClick:ae,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,Z.jsx)(_,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.retryFailed`,{count:J?.failed??0})]}),x&&(0,Z.jsxs)(Z.Fragment,{children:[r?.status===`paused`?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>S({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,Z.jsx)(I,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.resume`)]}):(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>S({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,Z.jsx)(ne,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.pause`)]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>S({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,Z.jsx)(R,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.stop`)]})]}),r&&!x&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:te,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,Z.jsx)(ee,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.cleanWorktrees`)]}),(r.mergedCommits?.length??0)>0&&(0,Z.jsxs)(`button`,{type:`button`,onClick:D,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,Z.jsx)(N,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.rollback`,{count:r.mergedCommits?.length??0})]})]}),r&&(a?(0,Z.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,Z.jsx)(_,{className:`h-3.5 w-3.5 animate-spin`}),` `,t(x?`activity:sddBoard.stopping`:`activity:sddBoard.destroying`)]}):(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>b(!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,Z.jsx)(P,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.destroy`)]})),(0,Z.jsx)(Y,{variant:`ghost`,size:`icon`,onClick:e,children:(0,Z.jsx)(u,{className:`h-4 w-4`})})]})]}),r&&J&&(0,Z.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-5`,children:[(0,Z.jsx)(Ee,{pct:J.percentComplete}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,Z.jsx)(Re,{label:t(`activity:sddBoard.statDone`),value:`${J.completed}/${J.total}`,color:`text-success`}),J.inProgress>0&&(0,Z.jsx)(Re,{label:t(`activity:sddBoard.statRunning`),value:J.inProgress,color:`text-warning`}),J.failed>0&&(0,Z.jsx)(Re,{label:t(`activity:sddBoard.statFailed`),value:J.failed,color:`text-destructive`}),(0,Z.jsx)(Re,{label:t(`activity:sddBoard.statWave`),value:r.wave+1,color:`text-primary`}),x&&r.startedAt>0&&(0,Z.jsx)(Re,{label:t(`activity:sddBoard.statElapsed`),value:we(c-r.startedAt),color:`text-foreground`})]}),(0,Z.jsx)(`div`,{className:`flex min-h-[24px] items-center gap-1.5`,children:k.length===0?(0,Z.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t(`activity:sddBoard.noActiveWorkers`)}):k.map((e,t)=>(0,Z.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,Z.jsx)(`span`,{className:z(`sdd-agent-live flex h-5 w-5 items-center justify-center rounded-full text-[9px] font-bold text-white`,xe[t%xe.length]),children:_e(e.name)}),(0,Z.jsx)(`span`,{className:`max-w-[90px] truncate text-[11px] text-foreground`,children:e.name})]},e.name))})]})]})]}),i&&(0,Z.jsx)(Le,{result:i,onDismiss:()=>s(null)}),ce.length>0&&(0,Z.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,Z.jsx)(T,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`font-semibold`,children:t(`activity:sddBoard.deadlock`)}),ce.map(e=>(0,Z.jsxs)(`div`,{className:`font-mono`,children:[e.blocked,` ← `,e.blockedBy.join(`, `)]},e.blocked))]})]}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:r?g===`graph`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Te,{tasks:O,columns:r.columns,onTaskClick:j}),(0,Z.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,Z.jsx)(Q,{tasks:r.tasks,selectedId:d,onTaskClick:j}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 text-sm text-muted-foreground`,children:[(0,Z.jsx)(oe,{className:`h-10 w-10 text-primary/40`}),(0,Z.jsx)(`p`,{className:`text-foreground`,children:t(`activity:sddBoard.noRunTitle`)}),(0,Z.jsx)(`p`,{className:`max-w-sm text-center text-xs text-muted-foreground`,children:t(`activity:sddBoard.noRunBody`)})]})}),r&&(0,Z.jsx)(`aside`,{"data-testid":`sdd-task-panel`,"data-expanded":m&&q?`true`:`false`,className:z(`shrink-0 border-l border-border bg-card transition-[width] duration-200 ease-out`,m&&q?`w-[min(72rem,72vw)]`:`w-80`),children:q?(0,Z.jsx)(je,{task:q,allTasks:r.tasks,feed:r.taskEvents?.[q.id]??r.feed??[],now:c,expanded:m,modelCandidates:K,defaultModel:r.defaultModel,onClose:M,onToggleExpanded:()=>h(e=>!e),onRetry:ie,onReassign:F,onSetModel:L,onSetVerification:se,onCancel:B,onDelete:V,onSplit:U,onSelectTask:f},q.id):(0,Z.jsx)(De,{feed:r.feed??[],now:c})})]}),(0,Z.jsx)(Oe,{open:y,onOpenChange:b,snapshot:r,busy:a,onConfirm:E})]})}function Ie(e){let t=e.op===`cleanup_worktrees`?`lcClean`:e.op===`rollback`?`lcRollback`:`lcDestroy`,n=r.t(`activity:sddBoard.${t}`);if(!e.ok)return r.t(`activity:sddBoard.lcFailed`,{op:n,reason:e.reason??r.t(`activity:sddBoard.lcUnknownError`)});let i=[];typeof e.removed==`number`&&i.push(r.t(`activity:sddBoard.lcWorktrees`,{count:e.removed})),typeof e.reverted==`number`&&e.reverted>0&&i.push(r.t(`activity:sddBoard.lcCommits`,{count:e.reverted})),e.deleted?.length&&i.push(r.t(`activity:sddBoard.lcDeleted`,{items:e.deleted.join(`, `)}));let a=i.length?i.join(` · `):r.t(`activity:sddBoard.lcNothing`);return e.reason?r.t(`activity:sddBoard.lcNote`,{op:n,body:a,reason:e.reason}):r.t(`activity:sddBoard.lcOk`,{op:n,body:a})}function Le({result:e,onDismiss:t}){let n=!e.ok||!!e.reason;return(0,Z.jsxs)(`div`,{className:z(`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,Z.jsx)(m,{className:`mt-0.5 h-4 w-4 shrink-0`}):(0,Z.jsx)(v,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:Ie(e)}),(0,Z.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 opacity-60 hover:opacity-100`,children:(0,Z.jsx)(u,{className:`h-3.5 w-3.5`})})]})}function Re({label:e,value:t,color:n}){return(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-1`,children:[(0,Z.jsx)(`span`,{className:z(`font-semibold tabular-nums`,n),children:t}),(0,Z.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:e})]})}var ze={idle:`phaseStart`,questioning:`phaseInterview`,spec_review:`phaseSpecReview`,implementation:`phasePlanning`,task_review:`phaseTaskReview`,executing:`phaseRunning`,done:`phaseDone`},Be=[`questioning`,`spec_review`,`implementation`,`task_review`,`executing`];function Ve({onClose:e,onRunStarted:t}){let{t:n}=p(),{client:r}=fe(),i=U(e=>e.snapshot),a=U(e=>e.agentText),o=U(e=>e.error),s=U(e=>e.startedRunId),f=U(e=>e.setStartedRunId),[m,h]=(0,X.useState)(``),[v,y]=(0,X.useState)(``),[S,C]=(0,X.useState)(!1),[ee,w]=(0,X.useState)(!0),[T,te]=(0,X.useState)(!0),[D,ne]=(0,X.useState)(!1),[O,k]=(0,X.useState)(void 0),[A,j]=(0,X.useState)(void 0),[N,re]=(0,X.useState)([]),[P,ae]=(0,X.useState)(4),[I,se]=(0,X.useState)(!0),[R,B]=(0,X.useState)(!1),V=pe(D),H=(0,X.useCallback)(e=>r?.send?.(e),[r]),W=(0,X.useRef)(null);(0,X.useEffect)(()=>{H({type:`sdd.spec.get`})},[H]);let G=i?.answers.length??0;(0,X.useEffect)(()=>{W.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[G,a]),(0,X.useEffect)(()=>{s&&(f(null),t?.())},[t,f,s]);let K=i?.busy??!1,q=i?.phase??`idle`,J=!!i?.sessionId,ce=!!i?.resumed,le=i?.lastRunId;(0,X.useEffect)(()=>{J&&C(!1)},[J]);let ue=i?.answers[i.answers.length-1]?.question??``,de=!!i&&(i.taskCount>0||!!i.graphId||q===`task_review`||q===`executing`),_e=()=>{let e=m.trim();!e||K||S||(C(!0),H({type:`sdd.spec.start`,payload:{goal:e}}))},ye=()=>{let e=v.trim();e&&!K&&(H({type:`sdd.spec.message`,payload:{text:e}}),y(``))},be=e=>{!K&&e.trim()&&(H({type:`sdd.spec.message`,payload:{text:e.trim()}}),y(``))},xe=()=>!K&&H({type:`sdd.spec.approve`,payload:{}}),Se=e=>!K&&H({type:`sdd.spec.rewind`,payload:e?{targetPhase:e}:{}}),Ce=()=>{H({type:`sdd.run.start`,payload:{parallelSlots:P,worktrees:I,planDecompose:R,...O?{model:O,provider:A}:{},...N.length?{fallbackModels:N}:{}}}),ne(!1)},we=()=>{K||H({type:`sdd.spec.discard`,payload:{}})},Ee=(0,X.useMemo)(()=>(i?.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})),[i?.board]),De=Ee.length>0,Oe=a&&q===`questioning`?a:ue??``,ke=(0,X.useMemo)(()=>Ue(Oe),[Oe]),Q=i?.answers.length??0,Ae=i?.minQuestions??2,je=i?.maxQuestions??5,Me=Q>=Ae,Ne=Math.min(100,Math.round(Q/Math.max(1,je)*100));return(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,Z.jsxs)(`header`,{className:`sdd-sheen flex shrink-0 items-center justify-between border-b border-border px-4 py-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(g,{className:`h-5 w-5 text-primary`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold`,children:i?.title||n(`activity:sddWizard.titleFallback`)}),J&&(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[n(`activity:sddWizard.${ze[q]??`phaseStart`}`),q===`questioning`&&` · ${n(`activity:sddWizard.questionsSuffix`,{cur:i?.questionCount??0,max:i?.maxQuestions??0})}`,i&&i.taskCount>0?` · ${n(`activity:sddWizard.tasksSuffix`,{count:i.taskCount})}`:``]})]}),K&&(0,Z.jsx)(d,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[le&&(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>t?.(),className:`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-muted`,children:[(0,Z.jsx)(E,{className:`h-3.5 w-3.5`}),` `,n(`activity:sddWizard.openLiveBoard`)]}),J&&(0,Z.jsx)(`button`,{type:`button`,onClick:we,disabled:K,title:n(`activity:sddWizard.discardTitle`),className:`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-destructive/10 hover:text-destructive disabled:opacity-50`,children:n(`activity:sddWizard.discardInterview`)}),de&&(0,Z.jsxs)(`div`,{className:`relative flex items-center gap-1.5`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>ne(e=>!e),title:n(`activity:sddWizard.runCfgTitle`),className:z(`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs font-medium`,O||N.length||R?`border-primary/40 bg-primary/10 text-primary`:`border-border bg-muted text-muted-foreground hover:text-foreground`),children:[(0,Z.jsx)(M,{className:`h-3.5 w-3.5`}),O||n(`activity:sddWizard.modelsLabel`)]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:Ce,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,Z.jsx)(E,{className:`h-3.5 w-3.5`}),` `,n(`activity:sddWizard.startRun`)]}),D&&(0,Z.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,Z.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:n(`activity:sddWizard.defaultWorkerModel`)}),(0,Z.jsx)(me,{value:O,provider:A,candidates:V,placeholder:n(`activity:sddWizard.leaderDefaultPlaceholder`),resetLabel:n(`activity:sddWizard.useSessionDefault`),onPick:(e,t)=>{k(e),j(t)},onReset:O?()=>{k(void 0),j(void 0)}:void 0}),(0,Z.jsx)(`div`,{className:`mb-1 mt-3 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:n(`activity:sddWizard.fallbackChain`)}),(0,Z.jsx)(he,{value:N,candidates:V,onChange:re}),(0,Z.jsx)(`p`,{className:`mt-2 text-[10px] text-muted-foreground`,children:n(`activity:sddWizard.appliesToAll`)}),(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`label`,{htmlFor:`sdd-slots`,className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:n(`activity:sddWizard.parallelAgents`)}),(0,Z.jsx)(`input`,{id:`sdd-slots`,type:`number`,min:1,max:16,value:P,onChange:e=>{let t=Number.parseInt(e.target.value,10);ae(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,Z.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:n(`activity:sddWizard.isolateWorktrees`)}),(0,Z.jsx)(`input`,{type:`checkbox`,checked:I,onChange:e=>se(e.target.checked),className:`h-3.5 w-3.5 accent-primary`})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:n(I?`activity:sddWizard.worktreeOn`:`activity:sddWizard.worktreeOff`)}),(0,Z.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:n(`activity:sddWizard.planDecompose`)}),(0,Z.jsx)(`input`,{type:`checkbox`,checked:R,onChange:e=>B(e.target.checked),className:`h-3.5 w-3.5 accent-primary`})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:n(R?`activity:sddWizard.planDecomposeOn`:`activity:sddWizard.planDecomposeOff`)})]})]}),(0,Z.jsx)(Y,{variant:`ghost`,size:`icon`,onClick:e,children:(0,Z.jsx)(u,{className:`h-4 w-4`})})]})]}),J&&(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 border-b bg-card/50 px-4 py-1.5 text-[11px]`,children:Be.map((e,t)=>{let r=e===q,i=Be.indexOf(q)>t;return(0,Z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[i&&!K&&q!==`executing`&&q!==`done`?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>Se(e),title:n(`activity:sddWizard.rewindToPhaseTitle`,`Return to this phase to revise`),className:`inline-flex items-center rounded-full px-2 py-0.5 text-success transition hover:bg-success/10 hover:underline`,children:[(0,Z.jsx)(b,{className:`mr-0.5 inline h-3 w-3`}),n(`activity:sddWizard.${ze[e]}`)]}):(0,Z.jsxs)(`span`,{className:z(`rounded-full px-2 py-0.5`,r?`bg-primary/15 text-primary font-medium`:i?`text-success`:`text-muted-foreground`),children:[i&&(0,Z.jsx)(b,{className:`mr-0.5 inline h-3 w-3`}),n(`activity:sddWizard.${ze[e]}`)]}),t<Be.length-1&&(0,Z.jsx)(`span`,{className:`text-muted-foreground/65`,children:`→`})]},e)})}),(0,Z.jsxs)(`div`,{ref:ge(`sdd-wizard`),className:`min-h-0 flex-1 overflow-auto overscroll-contain p-4`,children:[o&&(0,Z.jsx)(`div`,{className:`mb-3 rounded-md border border-destructive/40 bg-destructive/5 p-2 text-xs text-destructive`,children:o}),ce&&J&&(0,Z.jsx)(`div`,{className:`mb-3 rounded-md border border-primary/30 bg-primary/5 px-3 py-2 text-xs text-primary`,children:n(`activity:sddWizard.resumeBanner`)}),J?(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[q===`questioning`&&(0,Z.jsxs)(`div`,{className:`rounded-md border border-border/80 bg-card/60 p-2.5 shadow-sm`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between text-xs`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium text-foreground`,children:[(0,Z.jsx)(g,{className:`h-3.5 w-3.5 text-primary`}),n(`activity:sddWizard.interviewProgress`,`Interview Progress`)]}),(0,Z.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[n(`activity:sddWizard.questionOf`,{current:Q+1,max:je}),` · `,Me?(0,Z.jsx)(`span`,{className:`font-medium text-success`,children:n(`activity:sddWizard.minRequiredMet`,`Min met ✓`)}):(0,Z.jsx)(`span`,{children:n(`activity:sddWizard.minRequiredRemaining`,{count:Ae-Q})})]})]}),(0,Z.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,Z.jsx)(`div`,{className:z(`h-full transition-all duration-500`,Me?`bg-success`:`bg-primary`),style:{width:`${Math.max(12,Ne)}%`}})})]}),De&&(0,Z.jsxs)(`div`,{className:`sdd-rise overflow-hidden rounded-lg border border-primary/20 bg-[hsl(var(--surface-2)/0.85)]`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>w(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:[ee?(0,Z.jsx)(x,{className:`h-3.5 w-3.5`}):(0,Z.jsx)(F,{className:`h-3.5 w-3.5`}),(0,Z.jsx)(c,{className:`h-3.5 w-3.5`}),n(`activity:sddWizard.taskGraphSummary`,{count:i?.taskCount??0}),(0,Z.jsx)(`span`,{className:`ml-auto text-muted-foreground`,children:n(ee?`activity:sddWizard.dragToExplore`:`activity:sddWizard.show`)})]}),ee&&(0,Z.jsx)(`div`,{className:`h-[32dvh] min-h-[200px]`,children:(0,Z.jsx)(Te,{tasks:Ee,columns:i?.board?.columns??[]})})]}),i?.goal&&(0,Z.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/30 px-3 py-2`,children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,Z.jsx)(L,{className:`h-3 w-3`}),` `,n(`activity:sddWizard.goalLabel`)]}),(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:i.goal})]}),i?.answers.length||a&&q===`questioning`||K?(0,Z.jsxs)(`div`,{className:`space-y-2.5`,children:[i?.answers.map((e,t)=>(0,Z.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,Z.jsx)(Ge,{speaker:`assistant`,text:e.question,questionIndex:t+1}),(0,Z.jsx)(Ge,{speaker:`user`,text:e.answer})]},`${t}-${e.question.slice(0,32)}`)),a&&q===`questioning`&&a!==ue&&(0,Z.jsx)(Ge,{speaker:`assistant`,text:a,live:!0,questionIndex:Q+1}),K&&(0,Z.jsx)(Ge,{speaker:`assistant`,text:``,thinking:!0})]}):null,i?.spec&&(0,Z.jsxs)(`div`,{className:`sdd-rise rounded-md border border-border bg-card p-3`,children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-sm font-semibold`,children:[(0,Z.jsx)(g,{className:`h-3.5 w-3.5 text-primary`}),i.spec.title]}),(0,Z.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:i.spec.overview}),(0,Z.jsx)(`ul`,{className:`space-y-0.5 text-xs`,children:i.spec.requirements.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex gap-1.5`,children:[(0,Z.jsx)(`span`,{className:z(`shrink-0 font-mono uppercase`,ve(e.priority).text),children:e.priority[0]}),(0,Z.jsx)(`span`,{children:e.description})]},`${e.priority}-${t}-${e.description.slice(0,24)}`))})]}),a&&(q===`implementation`||q===`task_review`)&&(0,Z.jsxs)(`div`,{className:`sdd-rise rounded-md border border-border bg-card`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>te(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:[T?(0,Z.jsx)(x,{className:`h-3.5 w-3.5`}):(0,Z.jsx)(F,{className:`h-3.5 w-3.5`}),(0,Z.jsx)(g,{className:`h-3.5 w-3.5 text-primary`}),` `,n(`activity:sddWizard.implementationPlan`)]}),T&&(0,Z.jsx)(`div`,{className:`max-h-[40dvh] overflow-auto px-3 py-2`,children:(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:He(a)})})]}),a&&q!==`questioning`&&q!==`implementation`&&q!==`task_review`&&!i?.spec&&(0,Z.jsx)(Ge,{speaker:`assistant`,text:a}),(q===`spec_review`||q===`implementation`||q===`task_review`)&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[q===`task_review`?(0,Z.jsxs)(Y,{className:`bg-success/15 text-success hover:bg-success/25`,onClick:Ce,disabled:K,children:[(0,Z.jsx)(E,{className:`mr-1.5 h-4 w-4`}),n(`activity:sddWizard.startRun`,`Start Run`)]}):(0,Z.jsxs)(Y,{variant:`secondary`,onClick:xe,disabled:K,children:[(0,Z.jsx)(b,{className:`mr-1.5 h-4 w-4`}),n(q===`spec_review`?`activity:sddWizard.approveSpec`:`activity:sddWizard.approvePlan`)]}),(0,Z.jsxs)(Y,{variant:`outline`,onClick:()=>Se(),disabled:K,className:`text-xs text-muted-foreground hover:text-foreground`,title:q===`spec_review`?n(`activity:sddWizard.backToQuestionsTitle`,`Reject spec and return to questioning`):n(`activity:sddWizard.backToSpecTitle`,`Reject plan and return to spec review`),children:[(0,Z.jsx)(_,{className:`mr-1.5 h-3.5 w-3.5`}),q===`spec_review`?n(`activity:sddWizard.backToQuestions`,`Back to Questions`):n(`activity:sddWizard.backToSpec`,`Back to Spec`)]})]}),(0,Z.jsx)(`div`,{ref:W})]}):(0,Z.jsxs)(`div`,{className:`mx-auto mt-8 max-w-xl`,children:[(0,Z.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,htmlFor:`sdd-goal`,children:n(`activity:sddWizard.goalPrompt`)}),(0,Z.jsx)(`textarea`,{id:`sdd-goal`,value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&_e()},rows:4,placeholder:n(`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,Z.jsx)(Y,{className:`mt-3`,onClick:_e,disabled:!m.trim()||S,children:S?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(d,{className:`mr-1.5 h-4 w-4 animate-spin`}),` `,n(`activity:sddWizard.startingInterview`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(g,{className:`mr-1.5 h-4 w-4`}),` `,n(`activity:sddWizard.startInterview`)]})}),(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:n(`activity:sddWizard.introBody`)})]})]}),J&&q!==`executing`&&q!==`done`&&(0,Z.jsxs)(`div`,{className:`border-t bg-card`,children:[q===`questioning`&&!K&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-4 pt-2`,children:[ke.map(e=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>y(e),className:`inline-flex items-center rounded-full border border-primary/25 bg-primary/5 px-2.5 py-1 text-xs text-primary transition hover:bg-primary/15 hover:border-primary/40 active:scale-95`,children:[(0,Z.jsx)(`span`,{className:`mr-1 opacity-70`,children:`👉`}),e]},e)),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>be(n(`activity:sddWizard.quickBestPracticeDirective`,`Use standard industry best practices for this.`)),className:`inline-flex items-center rounded-full border border-warning/30 bg-warning/10 px-2.5 py-1 text-xs text-warning transition hover:bg-warning/20 active:scale-95`,title:`Answer using standard industry best practice`,children:[(0,Z.jsx)(ie,{className:`mr-1 h-3 w-3`}),n(`activity:sddWizard.quickBestPractice`,`Use Best Practice`)]}),Me&&(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>be(`We have covered the necessary requirements. Please generate the complete specification JSON now.`),className:`inline-flex items-center rounded-full border border-success/30 bg-success/15 px-2.5 py-1 text-xs font-medium text-success transition hover:bg-success/25 active:scale-95`,title:n(`activity:sddWizard.generateSpecNowTitle`,`Generate the specification now with gathered requirements`),children:[(0,Z.jsx)(oe,{className:`mr-1 h-3 w-3`}),n(`activity:sddWizard.generateSpecNow`,`Generate Spec Now`)]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-end gap-2 px-4 py-2`,children:[(0,Z.jsx)(`textarea`,{value:v,onChange:e=>y(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ye())},rows:1,placeholder:n(q===`questioning`?`activity:sddWizard.answerPlaceholder`:`activity:sddWizard.changePlaceholder`),disabled:K,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,Z.jsx)(Y,{size:`icon`,onClick:ye,disabled:K||!v.trim(),children:(0,Z.jsx)(l,{className:`h-4 w-4`})})]})]})]})}function He(e){let t=e.replace(/```json[\s\S]*?```/gi,``).trim();return t.length>0?t:e.trim()}function Ue(e){if(!e)return[];let t=[],n=e.matchAll(/(?:^|\n)\s*(?:[0-9]+[.)]|[A-D][.)]|[-*]\s+\*\*|[-*]\s+\[)\s*([^:\n\r]+)/gi);for(let e of n){let n=(e[1]??``).trim().replace(/^[`"']|[`"']$/g,``);n&&n.length>2&&n.length<50&&!t.includes(n)&&t.push(n)}if(t.length===0){let n=e.match(/(?:Options|Choices|Öneriler|Seçenekler):\s*([^\n\r]+)/i);if(n?.[1]){let e=n[1].split(/[,|/]/).map(e=>e.trim()).filter(e=>e.length>2&&e.length<45);t.push(...e.slice(0,4))}}return t.slice(0,4)}function We(e){let t=e.toLowerCase();return/security|auth|jwt|oauth|token|permission|role|rbac|şifre|güvenlik/i.test(t)?{label:`Security & Auth`,color:`bg-destructive/10 text-destructive border-destructive/20`}:/database|sql|postgres|sqlite|redis|mongodb|schema|tablo|veritabanı/i.test(t)?{label:`Data & Storage`,color:`bg-info/10 text-info border-info/20`}:/api|endpoint|rest|graphql|grpc|route|http/i.test(t)?{label:`API & Routing`,color:`bg-success/10 text-success border-success/20`}:/test|vitest|jest|e2e|playwright|coverage|mock/i.test(t)?{label:`Testing & QA`,color:`bg-warning/10 text-warning border-warning/20`}:/ui|css|component|frontend|react|tailwind|button|view|görsel|arayüz/i.test(t)?{label:`UI & Layout`,color:`bg-primary/10 text-primary border-primary/20`}:/architecture|microservice|queue|worker|scale|mimari/i.test(t)?{label:`Architecture`,color:`bg-accent/30 text-accent-foreground border-border`}:null}function Ge({speaker:e,text:t,live:n,thinking:r,questionIndex:i}){let a=e===`user`,[o,s]=(0,X.useState)(!1),c=!a&&t?We(t):null;return(0,Z.jsxs)(`div`,{className:z(`group sdd-rise flex items-start gap-2`,a&&`flex-row-reverse`),children:[(0,Z.jsx)(`span`,{className:z(`mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs`,a?`bg-info/15 text-info`:`bg-primary/15 text-primary`,(n||r)&&`sdd-agent-live`),children:a?(0,Z.jsx)(k,{className:`h-3.5 w-3.5`}):(0,Z.jsx)(w,{className:`h-3.5 w-3.5`})}),(0,Z.jsxs)(`div`,{className:z(`relative max-w-[85%] rounded-2xl px-3.5 py-2.5 text-sm leading-relaxed text-foreground shadow-sm transition-all`,a?`rounded-tr-sm bg-info/10 border border-info/20`:`rounded-tl-sm bg-muted/80 border border-border/70`),children:[!a&&!r&&(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-[10px]`,children:[i!==void 0&&(0,Z.jsxs)(`span`,{className:`rounded bg-primary/15 px-1.5 py-0.2 font-mono font-semibold text-primary`,children:[`Q`,i]}),c&&(0,Z.jsx)(`span`,{className:z(`rounded border px-1.5 py-0.2 font-medium`,c.color),children:c.label})]}),r?(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 py-1`,children:[(0,Z.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground [animation-delay:-200ms]`}),(0,Z.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground [animation-delay:-100ms]`}),(0,Z.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground`})]}):(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap`,children:t}),!r&&t&&(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{t&&(navigator.clipboard.writeText(t),s(!0),setTimeout(()=>s(!1),1500))},title:o?`Copied`:`Copy`,className:`absolute -bottom-2 right-2 hidden rounded bg-background/90 p-1 text-[10px] text-muted-foreground shadow border group-hover:flex items-center gap-1 hover:text-foreground`,children:o?(0,Z.jsx)(S,{className:`h-3 w-3 text-success`}):(0,Z.jsx)(te,{className:`h-3 w-3`})})]})]})}var Ke={completed:{icon:(0,Z.jsx)(v,{className:`h-3.5 w-3.5`}),text:`text-success`,ring:`border-success/35`},in_progress:{icon:(0,Z.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}),text:`text-primary`,ring:`border-primary/45`},queued:{icon:(0,Z.jsx)(s,{className:`h-3.5 w-3.5`}),text:`text-warning`,ring:`border-warning/35`},blocked:{icon:(0,Z.jsx)(f,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/30`},pending:{icon:(0,Z.jsx)(j,{className:`h-3.5 w-3.5`}),text:`text-muted-foreground`,ring:`border-border/70`},review:{icon:(0,Z.jsx)(_,{className:`h-3.5 w-3.5`}),text:`text-primary`,ring:`border-primary/35`},failed:{icon:(0,Z.jsx)(m,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/45`},cancelled:{icon:(0,Z.jsx)(D,{className:`h-3.5 w-3.5`}),text:`text-muted-foreground`,ring:`border-border/70`}},qe=[`completed`,`in_progress`,`queued`,`blocked`,`pending`,`failed`],Je={critical:{labelKey:`activity:depGraph.prioCrit`,cls:`bg-destructive/10 text-destructive`},high:{labelKey:`activity:depGraph.prioHigh`,cls:`bg-destructive/10 text-destructive`},medium:{labelKey:`activity:depGraph.prioMed`,cls:`bg-warning/12 text-warning`},low:{labelKey:`activity:depGraph.prioLow`,cls:`bg-success/12 text-success`}};function Ye({columns:e,onTaskClick:t}){let{t:n}=p();return e.length===0?(0,Z.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:n(`activity:board.emptySpec`)}):(0,Z.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,Z.jsx)(`h3`,{className:`mb-3 text-sm font-semibold text-foreground`,children:n(`activity:board.depGraphHeading`)}),(0,Z.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs`,children:qe.map(e=>(0,Z.jsxs)(`span`,{className:z(`inline-flex items-center gap-1.5`,Ke[e].text),children:[Ke[e].icon,(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:n(`activity:board.status.${e}`)})]},e))}),(0,Z.jsx)(`div`,{className:`flex gap-3 overflow-x-auto pb-2`,children:e.map((n,r)=>(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Z.jsxs)(`div`,{className:`w-60 shrink-0`,children:[(0,Z.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,Z.jsx)(`div`,{className:`space-y-2`,children:n.tasks.map(e=>(0,Z.jsx)(Xe,{task:e,onClick:t},e.id))})]}),r<e.length-1&&(0,Z.jsx)(`div`,{className:`flex h-full items-center pt-8 text-muted-foreground/75`,children:(0,Z.jsx)(F,{className:`h-5 w-5`})})]},n.label))})]})}function Xe({task:e,onClick:t}){let n=Ke[e.displayStatus],r=Je[e.priority],{t:i}=p();return(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>t?.(e.id),className:z(`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,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsxs)(`span`,{className:z(`inline-flex items-center gap-1.5 text-xs font-medium`,n.text),children:[n.icon,(0,Z.jsx)(`span`,{className:`font-mono text-foreground`,children:e.shortId})]}),(0,Z.jsx)(`span`,{className:z(`rounded px-1.5 py-0.5 text-[10px] font-medium`,r.cls),children:i(r.labelKey)})]}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-xs text-foreground`,children:e.title}),e.deps.length>0&&(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:[`← `,e.deps.join(`, `)]}),e.agentName&&(0,Z.jsxs)(`div`,{className:z(`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,Z.jsx)(d,{className:`h-3 w-3 animate-spin`}),(0,Z.jsx)(`span`,{children:e.agentName})]})]})}function Ze(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 Qe({onClose:e,onRunStarted:t}){let{client:n}=fe(),{t:r}=p(),i=K(e=>e.specs),a=K(e=>e.detail),o=K(e=>e.expandedSpecId),s=K(e=>e.setExpanded),[l,d]=(0,X.useState)(`graph`),f=(0,X.useCallback)(e=>{a&&a.specId===e.id&&(n?.send?.({type:`goal.start`,payload:{title:e.title,phases:Ze(a),autonomous:!0}}),V(`goal`))},[a,n]),m=(0,X.useCallback)(e=>{let r=e.graphId??(a?.specId===e.id?a.graphId:void 0);r?n?.send?.({type:`sdd.run.from_graph`,payload:{graphId:r,worktrees:!0}}):n?.send?.({type:`sdd.run.from_spec`,payload:{specId:e.id,worktrees:!0}}),t?.(),V(`sddhub`)},[a,n,t]);(0,X.useEffect)(()=>{n?.send?.({type:`specs.list`})},[n]);let h=(0,X.useCallback)(e=>{o===e.id?s(null):(s(e.id),n?.send?.({type:`specs.get`,payload:{specId:e.id}}))},[o,s,n]),g=a?.columns.flatMap(e=>e.tasks)??[],_={done:g.filter(e=>e.status===`completed`).length,running:g.filter(e=>e.status===`in_progress`).length,pending:g.filter(e=>e.status===`pending`||e.displayStatus===`queued`).length};return(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,Z.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b bg-card px-4 py-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(y,{className:`h-5 w-5 text-warning`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold`,children:r(`activity:specs.heading`)}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`activity:specs.subtitle`)})]})]}),(0,Z.jsx)(Y,{variant:`ghost`,size:`icon`,onClick:e,children:(0,Z.jsx)(u,{className:`h-4 w-4`})})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4`,children:i.length===0?(0,Z.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:r(`activity:specs.empty`,{command:`/sdd`})}):(0,Z.jsx)(`div`,{className:`space-y-3`,children:i.map(e=>{let t=o===e.id,n=e.total>0?Math.round(e.completed/e.total*100):0;return(0,Z.jsxs)(`div`,{className:`rounded-lg border border-border bg-card/60`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>h(e),className:`flex w-full items-start gap-3 p-4 text-left`,children:[(0,Z.jsx)(`span`,{className:`mt-1 text-muted-foreground`,children:t?(0,Z.jsx)(x,{className:`h-4 w-4`}):(0,Z.jsx)(F,{className:`h-4 w-4`})}),(0,Z.jsx)(y,{className:`mt-0.5 h-4 w-4 text-muted-foreground`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.displayId}),(0,Z.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] capitalize text-muted-foreground`,children:e.status})]}),(0,Z.jsx)(`h2`,{className:`mt-1 text-base font-semibold`,children:e.title}),(0,Z.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-success transition-all`,style:{width:`${n}%`}})}),(0,Z.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[e.completed,`/`,e.total]})]})]})]}),t&&(0,Z.jsxs)(`div`,{className:`border-t border-border p-4`,children:[(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`text-sm font-medium`,children:[r(`activity:specs.tasks`,{count:a?.total??e.total}),a&&(0,Z.jsxs)(`span`,{className:`ml-3 text-xs font-normal text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`text-success`,children:r(`activity:specs.doneCount`,{count:_.done})}),` `,(0,Z.jsx)(`span`,{className:`text-primary`,children:r(`activity:specs.runningCount`,{count:_.running})}),` `,(0,Z.jsx)(`span`,{children:r(`activity:specs.pendingCount`,{count:_.pending})})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>m(e),title:r(`activity:specs.runAsSddTitle`),className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success transition-colors hover:bg-success/25`,children:[(0,Z.jsx)(I,{className:`h-3.5 w-3.5`}),` `,r(`activity:specs.runAsSdd`)]}),(0,Z.jsxs)(`button`,{type:`button`,disabled:!a||a.specId!==e.id,onClick:()=>f(e),title:r(`activity:specs.runAsGoalTitle`),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,Z.jsx)(I,{className:`h-3.5 w-3.5`}),` `,r(`activity:specs.runAsGoal`)]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>d(`list`),className:z(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,l===`list`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,Z.jsx)(O,{className:`h-3.5 w-3.5`}),` `,r(`activity:specs.list`)]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>d(`graph`),className:z(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,l===`graph`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,Z.jsx)(c,{className:`h-3.5 w-3.5`}),` `,r(`activity:specs.graph`)]})]})]})]}),!a||a.specId!==e.id?(0,Z.jsx)(`div`,{className:`flex h-24 items-center justify-center text-sm text-muted-foreground`,children:r(`activity:specs.loadingTasks`)}):l===`graph`?(0,Z.jsx)(Ye,{columns:a.columns}):(0,Z.jsx)(`div`,{className:`space-y-1.5`,children:g.map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border border-border bg-card px-3 py-2`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),(0,Z.jsx)(`span`,{className:`flex-1 text-sm`,children:e.title}),(0,Z.jsx)(`span`,{className:`text-xs capitalize text-muted-foreground`,children:e.displayStatus.replace(`_`,` `)})]},e.id))})]})]},e.id)})})})]})}var $=[{id:`project`,labelKey:`activity:sddhub.tabProject`},{id:`board`,labelKey:`activity:sddhub.tabBoard`},{id:`specs`,labelKey:`activity:sddhub.tabSpecs`}];function $e(){let{t:e}=p(),[t,n]=(0,X.useState)(`project`),r=U(e=>e.startedRunId),i=U(e=>e.setStartedRunId),a=()=>B(`chat`),o=(0,X.useCallback)(()=>n(`board`),[]);(0,X.useEffect)(()=>{r&&(n(`board`),i(null))},[r,i]);let s=(e,t)=>{let r;if(e.key===`ArrowLeft`&&(r=(t-1+$.length)%$.length),e.key===`ArrowRight`&&(r=(t+1)%$.length),e.key===`Home`&&(r=0),e.key===`End`&&(r=$.length-1),r===void 0)return;e.preventDefault();let i=$[r];i&&(n(i.id),e.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)[r]?.focus())};return(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,Z.jsx)(`div`,{role:`tablist`,"aria-orientation":`horizontal`,className:`flex shrink-0 items-end border-b border-border/70 bg-card px-4`,children:$.map((r,i)=>{let a=t===r.id;return(0,Z.jsxs)(`button`,{id:`sdd-hub-tab-${r.id}`,type:`button`,role:`tab`,"aria-selected":a,"aria-controls":`sdd-hub-panel-${r.id}`,tabIndex:a?0:-1,onClick:()=>n(r.id),onKeyDown:e=>s(e,i),className:z(`relative px-4 py-2.5 text-sm font-medium transition-colors`,a?`text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e(r.labelKey),a&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`absolute bottom-0 left-0 right-0 h-0.5 bg-primary`})]},r.id)})}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:[(0,Z.jsx)(`div`,{id:`sdd-hub-panel-project`,role:`tabpanel`,"aria-labelledby":`sdd-hub-tab-project`,hidden:t!==`project`,className:`h-full overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(Ve,{onClose:a,onRunStarted:o})}),(0,Z.jsx)(`div`,{id:`sdd-hub-panel-board`,role:`tabpanel`,"aria-labelledby":`sdd-hub-tab-board`,hidden:t!==`board`,className:`h-full overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(Fe,{onClose:a})}),(0,Z.jsx)(`div`,{id:`sdd-hub-panel-specs`,role:`tabpanel`,"aria-labelledby":`sdd-hub-tab-specs`,hidden:t!==`specs`,className:`h-full overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(Qe,{onClose:a,onRunStarted:o})})]})]})}export{$e as SddHub};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{W as t,t as n}from"./config-store-Dq6MhrIA.js";import{i as r,t as i}from"./react-core-wiHys0m2.js";import{$t as a,Ca as o,Jn as s,La as c,Ln as l,Mi as u,Pa as d,Qr as f,Ut as p,Vi as m,Y as h,Zt as g,dt as _,ea as v,ja as y,mi as b}from"./vendor-Cvuk-OYN.js";import{i as x}from"./i18n-CRIAwjnX.js";import{t as S}from"./utils-sO9lidp6.js";import{n as C}from"./ui-store-D2CzZVyU.js";import{P as w}from"./index-BI1MMjfc.js";import{i as T,n as E,r as D}from"./SessionList-C_5GxI2E.js";var O=e(r(),1),k=d(e=>({payload:null,loading:!1,error:null,setPayload:t=>e({payload:t,loading:!1,error:null}),setError:t=>e({error:t,loading:!1}),setLoading:t=>e({loading:t}),clear:()=>e({payload:null,loading:!1,error:null})})),A=!1;function j(){if(A)return;let e=n.getState().wsUrl;e&&(t(e).on(`session.inspect`,e=>{let t=e.payload,n=k.getState();t?.error?n.setError(x(t.error)):t&&n.setPayload(t)}),A=!0)}var M=i(),N={session_start:y,session_resumed:g,user_input:l,llm_request:b,llm_response:b,tool_use:h,tool_call_start:h,tool_call_end:h,tool_result:h,compaction:g,context_snapshot:a,error:u,session_end:m,message_appended:l,message_updated:l,messages_replaced:l,messages_dropped:l,file_event:f,mode_changed:y,task_created:y,task_updated:y,task_completed:m,task_failed:u,agent_spawned:y,agent_stopped:y,agent_error:u,provider_retry:g,provider_error:_};function P(e){switch(e){case`error`:case`task_failed`:case`agent_error`:return`text-destructive border-destructive/30 bg-destructive/5`;case`tool_call_end`:case`tool_use`:case`tool_call_start`:return`text-primary border-primary/30 bg-primary/5`;case`file_event`:return`text-success border-success/30 bg-success/5`;case`compaction`:return`text-warning border-warning/30 bg-warning/5`;case`user_input`:return`text-foreground border-border`;default:return`text-muted-foreground border-border`}}function F(e,t){switch(e){case`completed`:return{label:t(`activity:sessionInspect.outcomeCompleted`),cls:`border-success/30 bg-success/10 text-success`};case`error`:return{label:t(`activity:sessionInspect.outcomeError`),cls:`border-destructive/30 bg-destructive/10 text-destructive`};case`timeout`:return{label:t(`activity:sessionInspect.outcomeTimeout`),cls:`border-warning/30 bg-warning/10 text-warning`};case`aborted`:return{label:t(`activity:sessionInspect.outcomeAborted`),cls:`border-muted-foreground/30 bg-muted text-muted-foreground`};default:return{label:t(`activity:sessionInspect.outcomeUnknown`),cls:`border-border bg-muted text-muted-foreground`}}}var I={create:`Created`,read:`Read`,update:`Modified`,delete:`Deleted`,rename:`Renamed`};function L(){let{t:e}=c(),t=C(e=>e.inspectSessionId),r=C(e=>e.clearInspectSession),{inspectSession:i}=w(),u=n(e=>e.wsConnected),{payload:d,loading:m,error:x,clear:A}=k(),[L,z]=(0,O.useState)(``),[B,V]=(0,O.useState)(!1);(0,O.useEffect)(()=>{j()},[]),(0,O.useEffect)(()=>{t&&(k.getState().setLoading(!0),i(t))},[t,i]),(0,O.useEffect)(()=>()=>A(),[A]);let H=(0,O.useCallback)(()=>{r()},[r]),U=(0,O.useCallback)(()=>{t&&(k.getState().setLoading(!0),i(t))},[t,i]),W=(0,O.useMemo)(()=>L?d?.events.filter(e=>e.label.toLowerCase().includes(L.toLowerCase())||e.type.toLowerCase().includes(L.toLowerCase()))??[]:d?.events??[],[d,L]),G=(0,O.useMemo)(()=>d?Object.entries(d.toolBreakdown).sort(([,e],[,t])=>t-e):[],[d]);if(m)return(0,M.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)]`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-4 border border-border/60 bg-card text-sm text-muted-foreground`,children:[(0,M.jsx)(s,{className:`h-5 w-5 animate-spin text-primary`}),e(`activity:sessionInspect.loadingSessionInspection`)]})});if(x)return(0,M.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-3 bg-[hsl(var(--surface-2)/0.45)] p-6`,children:[(0,M.jsx)(_,{className:`h-8 w-8 text-destructive`}),(0,M.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:x}),(0,M.jsxs)(`button`,{type:`button`,onClick:H,className:`mt-2 inline-flex items-center gap-1.5 border border-border/60 px-3 py-1.5 text-xs font-medium text-muted-foreground hover:bg-muted`,children:[(0,M.jsx)(o,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.backToSessions`)]})]});if(!t)return(0,M.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)]`,children:(0,M.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 p-6 text-center`,children:[(0,M.jsx)(p,{className:`h-9 w-9 text-muted-foreground opacity-30`}),(0,M.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e(`activity:sessionInspect.noSessionSelected`)}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`activity:sessionInspect.selectASessionFromTheSessions`)})]})});if(!d)return null;let K=F(d.outcome,e),q=d.name||d.title||`Untitled`;return(0,M.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-[hsl(var(--surface-2)/0.45)] overflow-y-auto overscroll-contain`,children:[(0,M.jsx)(`header`,{className:`sticky top-0 z-10 shrink-0 border-b border-border/70 bg-card/90 px-4 py-3 backdrop-blur-sm`,children:(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:H,className:`mb-2 inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,M.jsx)(o,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.backToSessions`)]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`h1`,{className:`truncate text-lg font-semibold tracking-tight`,title:q,children:q}),d.outcome?(0,M.jsx)(`span`,{className:S(`inline-flex items-center border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,K.cls),children:K.label}):null]}),(0,M.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,M.jsxs)(`span`,{className:`font-mono`,children:[d.provider,`/`,d.model]}),(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,M.jsx)(v,{className:`h-3 w-3`}),D(d.startedAt)]}),(0,M.jsx)(`span`,{children:T({id:d.id,title:d.title,startedAt:d.startedAt,endedAt:d.endedAt,model:d.model,provider:d.provider,tokenTotal:d.tokenTotal,isCurrent:!1})}),(0,M.jsxs)(`span`,{className:`font-mono text-[10px]`,children:[`ID: `,d.id.slice(0,12),`…`]})]}),d.lastUserMessage?(0,M.jsxs)(`p`,{className:`mt-2 truncate text-xs text-muted-foreground`,title:d.lastUserMessage,children:[`"`,d.lastUserMessage,`"`]}):null]}),(0,M.jsxs)(`button`,{type:`button`,onClick:U,disabled:!u,className:`inline-flex h-8 items-center gap-1 border border-border/70 px-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground hover:bg-muted disabled:opacity-40`,title:e(`activity:sessionInspect.refresh`),children:[(0,M.jsx)(g,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.refresh`)]})]})}),(0,M.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-4 p-4 sm:p-6`,children:[(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4 lg:grid-cols-7`,children:[(0,M.jsx)(R,{icon:b,label:e(`activity:sessionInspect.tokens`),value:E(d.tokenTotal)}),(0,M.jsx)(R,{icon:l,label:e(`activity:sessionInspect.messages`),value:E(d.messageCount)}),(0,M.jsx)(R,{icon:y,label:e(`activity:sessionInspect.iterations`),value:E(d.iterationCount)}),(0,M.jsx)(R,{icon:h,label:e(`activity:sessionInspect.toolCalls`),value:E(d.toolCallCount),errorCount:d.toolErrorCount>0?d.toolErrorCount:void 0}),(0,M.jsx)(R,{icon:f,label:e(`activity:sessionInspect.files`),value:E(d.fileChangeCount)}),(0,M.jsx)(R,{icon:g,label:e(`activity:sessionInspect.compactions`),value:E(d.compactionCount)}),(0,M.jsx)(R,{icon:a,label:e(`activity:sessionInspect.events`),value:E(d.events.length)})]}),(0,M.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[1fr_20rem]`,children:[(0,M.jsxs)(`section`,{className:`min-w-0 border border-border/70 bg-card/70`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/70 px-4 py-2.5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(a,{className:`h-4 w-4 text-primary`}),(0,M.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.eventTimeline`)}),(0,M.jsxs)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:[W.length,` / `,d.events.length]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsx)(p,{className:`pointer-events-none absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground`}),(0,M.jsx)(`input`,{type:`search`,value:L,onChange:e=>z(e.target.value),placeholder:e(`activity:sessionInspect.filterEvents`),className:`h-7 w-36 border border-border/60 bg-background pl-7 pr-2 text-[11px] outline-none focus:border-primary`})]}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>V(!B),className:`text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground hover:text-foreground`,children:B?`Expand`:`Collapse`})]})]}),!B&&(0,M.jsx)(`div`,{className:`divide-y divide-border/60`,children:W.length===0?(0,M.jsx)(`div`,{className:`px-4 py-8 text-center text-xs text-muted-foreground`,children:e(`activity:sessionInspect.noEventsMatchTheFilter`)}):W.map((e,t)=>{let n=N[e.type]??y;return(0,M.jsxs)(`div`,{className:S(`grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-2.5 gap-y-0.5 px-3 py-2 text-xs`,P(e.type)),children:[(0,M.jsx)(n,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,M.jsxs)(`div`,{className:`min-w-0`,children:[(0,M.jsx)(`div`,{className:`truncate font-medium`,children:e.label}),e.detail?(0,M.jsx)(`div`,{className:`truncate font-mono text-[10px] opacity-70`,children:e.detail}):null]}),(0,M.jsx)(`time`,{dateTime:e.ts,className:`whitespace-nowrap font-mono text-[10px] opacity-60`,children:new Date(e.ts).toLocaleTimeString()})]},`${e.ts}-${t}`)})})]}),(0,M.jsxs)(`aside`,{className:`flex flex-col gap-4`,children:[G.length>0?(0,M.jsxs)(`section`,{className:`border border-border/70 bg-card/70`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-4 py-2.5`,children:[(0,M.jsx)(h,{className:`h-4 w-4 text-primary`}),(0,M.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.toolBreakdown`)})]}),(0,M.jsx)(`div`,{className:`divide-y divide-border/60`,children:G.map(([e,t])=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 text-xs`,children:[(0,M.jsx)(`span`,{className:`truncate font-medium`,children:e}),(0,M.jsx)(`span`,{className:`ml-2 shrink-0 font-mono font-semibold tabular-nums`,children:t})]},e))})]}):null,d.fileEvents.length>0?(0,M.jsxs)(`section`,{className:`border border-border/70 bg-card/70`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-4 py-2.5`,children:[(0,M.jsx)(f,{className:`h-4 w-4 text-success`}),(0,M.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.fileChanges`)}),(0,M.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:d.fileEvents.length})]}),(0,M.jsx)(`div`,{className:`divide-y divide-border/60`,children:d.fileEvents.map((e,t)=>(0,M.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2 px-4 py-2 text-xs`,children:[(0,M.jsxs)(`div`,{className:`min-w-0`,children:[(0,M.jsx)(`div`,{className:`truncate font-mono font-medium`,title:e.filePath,children:e.filePath}),(0,M.jsx)(`div`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:e.toolName})]}),(0,M.jsx)(`span`,{className:S(`shrink-0 inline-flex items-center border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,e.operation===`delete`?`border-destructive/30 bg-destructive/10 text-destructive`:e.operation===`create`?`border-success/30 bg-success/10 text-success`:`border-border bg-muted text-muted-foreground`),children:I[e.operation]??e.operation})]},`${e.filePath}-${t}`))})]}):null]})]})]})]})}function R({icon:e,label:t,value:n,errorCount:r}){return(0,M.jsxs)(`div`,{className:`border border-border/70 bg-card/70 px-3 py-2.5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground`,children:[(0,M.jsx)(e,{className:`h-3 w-3`}),t]}),(0,M.jsxs)(`div`,{className:`mt-1 flex items-baseline gap-1.5`,children:[(0,M.jsx)(`span`,{className:`font-mono text-lg font-semibold tabular-nums`,children:n}),r!==void 0&&r>0?(0,M.jsxs)(`span`,{className:`font-mono text-xs text-destructive`,children:[`(`,r,` err)`]}):null]})]})}export{L as SessionInspectView};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{K as t,t as n}from"./config-store-CZdk-vPj.js";import{i as r,t as i}from"./react-core-wiHys0m2.js";import{$t as a,Ca as o,Jn as s,La as c,Ln as l,Mi as u,Pa as d,Qr as f,Ut as p,Vi as m,Y as h,Zt as g,dt as _,ea as v,ja as y,mi as b}from"./vendor-Cvuk-OYN.js";import{i as x}from"./i18n-BwptPW9U.js";import{t as S}from"./utils-sO9lidp6.js";import{n as C}from"./ui-store-CMdVzHOn.js";import{I as w}from"./index-BYBlSXtn.js";import{i as T,n as E,r as D}from"./SessionList-17tCMc4D.js";var O=e(r(),1),k=d(e=>({payload:null,loading:!1,error:null,setPayload:t=>e({payload:t,loading:!1,error:null}),setError:t=>e({error:t,loading:!1}),setLoading:t=>e({loading:t}),clear:()=>e({payload:null,loading:!1,error:null})})),A=!1;function j(){if(A)return;let e=n.getState().wsUrl;e&&(t(e).on(`session.inspect`,e=>{let t=e.payload,n=k.getState();t?.error?n.setError(x(t.error)):t&&n.setPayload(t)}),A=!0)}var M=i(),N={session_start:y,session_resumed:g,user_input:l,llm_request:b,llm_response:b,tool_use:h,tool_call_start:h,tool_call_end:h,tool_result:h,compaction:g,context_snapshot:a,error:u,session_end:m,message_appended:l,message_updated:l,messages_replaced:l,messages_dropped:l,file_event:f,mode_changed:y,task_created:y,task_updated:y,task_completed:m,task_failed:u,agent_spawned:y,agent_stopped:y,agent_error:u,provider_retry:g,provider_error:_};function P(e){switch(e){case`error`:case`task_failed`:case`agent_error`:return`text-destructive border-destructive/30 bg-destructive/5`;case`tool_call_end`:case`tool_use`:case`tool_call_start`:return`text-primary border-primary/30 bg-primary/5`;case`file_event`:return`text-success border-success/30 bg-success/5`;case`compaction`:return`text-warning border-warning/30 bg-warning/5`;case`user_input`:return`text-foreground border-border`;default:return`text-muted-foreground border-border`}}function F(e,t){switch(e){case`completed`:return{label:t(`activity:sessionInspect.outcomeCompleted`),cls:`border-success/30 bg-success/10 text-success`};case`error`:return{label:t(`activity:sessionInspect.outcomeError`),cls:`border-destructive/30 bg-destructive/10 text-destructive`};case`timeout`:return{label:t(`activity:sessionInspect.outcomeTimeout`),cls:`border-warning/30 bg-warning/10 text-warning`};case`aborted`:return{label:t(`activity:sessionInspect.outcomeAborted`),cls:`border-muted-foreground/30 bg-muted text-muted-foreground`};default:return{label:t(`activity:sessionInspect.outcomeUnknown`),cls:`border-border bg-muted text-muted-foreground`}}}var I={create:`Created`,read:`Read`,update:`Modified`,delete:`Deleted`,rename:`Renamed`};function L(){let{t:e}=c(),t=C(e=>e.inspectSessionId),r=C(e=>e.clearInspectSession),{inspectSession:i}=w(),u=n(e=>e.wsConnected),{payload:d,loading:m,error:x,clear:A}=k(),[L,z]=(0,O.useState)(``),[B,V]=(0,O.useState)(!1);(0,O.useEffect)(()=>{j()},[]),(0,O.useEffect)(()=>{t&&(k.getState().setLoading(!0),i(t))},[t,i]),(0,O.useEffect)(()=>()=>A(),[A]);let H=(0,O.useCallback)(()=>{r()},[r]),U=(0,O.useCallback)(()=>{t&&(k.getState().setLoading(!0),i(t))},[t,i]),W=(0,O.useMemo)(()=>L?d?.events.filter(e=>e.label.toLowerCase().includes(L.toLowerCase())||e.type.toLowerCase().includes(L.toLowerCase()))??[]:d?.events??[],[d,L]),G=(0,O.useMemo)(()=>d?Object.entries(d.toolBreakdown).sort(([,e],[,t])=>t-e):[],[d]);if(m)return(0,M.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)]`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-4 border border-border/60 bg-card text-sm text-muted-foreground`,children:[(0,M.jsx)(s,{className:`h-5 w-5 animate-spin text-primary`}),e(`activity:sessionInspect.loadingSessionInspection`)]})});if(x)return(0,M.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-3 bg-[hsl(var(--surface-2)/0.45)] p-6`,children:[(0,M.jsx)(_,{className:`h-8 w-8 text-destructive`}),(0,M.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:x}),(0,M.jsxs)(`button`,{type:`button`,onClick:H,className:`mt-2 inline-flex items-center gap-1.5 border border-border/60 px-3 py-1.5 text-xs font-medium text-muted-foreground hover:bg-muted`,children:[(0,M.jsx)(o,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.backToSessions`)]})]});if(!t)return(0,M.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)]`,children:(0,M.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 p-6 text-center`,children:[(0,M.jsx)(p,{className:`h-9 w-9 text-muted-foreground opacity-30`}),(0,M.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e(`activity:sessionInspect.noSessionSelected`)}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`activity:sessionInspect.selectASessionFromTheSessions`)})]})});if(!d)return null;let K=F(d.outcome,e),q=d.name||d.title||`Untitled`;return(0,M.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-[hsl(var(--surface-2)/0.45)] overflow-y-auto overscroll-contain`,children:[(0,M.jsx)(`header`,{className:`sticky top-0 z-10 shrink-0 border-b border-border/70 bg-card/90 px-4 py-3 backdrop-blur-sm`,children:(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:H,className:`mb-2 inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,M.jsx)(o,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.backToSessions`)]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`h1`,{className:`truncate text-lg font-semibold tracking-tight`,title:q,children:q}),d.outcome?(0,M.jsx)(`span`,{className:S(`inline-flex items-center border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,K.cls),children:K.label}):null]}),(0,M.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,M.jsxs)(`span`,{className:`font-mono`,children:[d.provider,`/`,d.model]}),(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,M.jsx)(v,{className:`h-3 w-3`}),D(d.startedAt)]}),(0,M.jsx)(`span`,{children:T({id:d.id,title:d.title,startedAt:d.startedAt,endedAt:d.endedAt,model:d.model,provider:d.provider,tokenTotal:d.tokenTotal,isCurrent:!1})}),(0,M.jsxs)(`span`,{className:`font-mono text-[10px]`,children:[`ID: `,d.id.slice(0,12),`…`]})]}),d.lastUserMessage?(0,M.jsxs)(`p`,{className:`mt-2 truncate text-xs text-muted-foreground`,title:d.lastUserMessage,children:[`"`,d.lastUserMessage,`"`]}):null]}),(0,M.jsxs)(`button`,{type:`button`,onClick:U,disabled:!u,className:`inline-flex h-8 items-center gap-1 border border-border/70 px-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground hover:bg-muted disabled:opacity-40`,title:e(`activity:sessionInspect.refresh`),children:[(0,M.jsx)(g,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.refresh`)]})]})}),(0,M.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-4 p-4 sm:p-6`,children:[(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4 lg:grid-cols-7`,children:[(0,M.jsx)(R,{icon:b,label:e(`activity:sessionInspect.tokens`),value:E(d.tokenTotal)}),(0,M.jsx)(R,{icon:l,label:e(`activity:sessionInspect.messages`),value:E(d.messageCount)}),(0,M.jsx)(R,{icon:y,label:e(`activity:sessionInspect.iterations`),value:E(d.iterationCount)}),(0,M.jsx)(R,{icon:h,label:e(`activity:sessionInspect.toolCalls`),value:E(d.toolCallCount),errorCount:d.toolErrorCount>0?d.toolErrorCount:void 0}),(0,M.jsx)(R,{icon:f,label:e(`activity:sessionInspect.files`),value:E(d.fileChangeCount)}),(0,M.jsx)(R,{icon:g,label:e(`activity:sessionInspect.compactions`),value:E(d.compactionCount)}),(0,M.jsx)(R,{icon:a,label:e(`activity:sessionInspect.events`),value:E(d.events.length)})]}),(0,M.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[1fr_20rem]`,children:[(0,M.jsxs)(`section`,{className:`min-w-0 border border-border/70 bg-card/70`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/70 px-4 py-2.5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(a,{className:`h-4 w-4 text-primary`}),(0,M.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.eventTimeline`)}),(0,M.jsxs)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:[W.length,` / `,d.events.length]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsx)(p,{className:`pointer-events-none absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground`}),(0,M.jsx)(`input`,{type:`search`,value:L,onChange:e=>z(e.target.value),placeholder:e(`activity:sessionInspect.filterEvents`),className:`h-7 w-36 border border-border/60 bg-background pl-7 pr-2 text-[11px] outline-none focus:border-primary`})]}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>V(!B),className:`text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground hover:text-foreground`,children:B?`Expand`:`Collapse`})]})]}),!B&&(0,M.jsx)(`div`,{className:`divide-y divide-border/60`,children:W.length===0?(0,M.jsx)(`div`,{className:`px-4 py-8 text-center text-xs text-muted-foreground`,children:e(`activity:sessionInspect.noEventsMatchTheFilter`)}):W.map((e,t)=>{let n=N[e.type]??y;return(0,M.jsxs)(`div`,{className:S(`grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-2.5 gap-y-0.5 px-3 py-2 text-xs`,P(e.type)),children:[(0,M.jsx)(n,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,M.jsxs)(`div`,{className:`min-w-0`,children:[(0,M.jsx)(`div`,{className:`truncate font-medium`,children:e.label}),e.detail?(0,M.jsx)(`div`,{className:`truncate font-mono text-[10px] opacity-70`,children:e.detail}):null]}),(0,M.jsx)(`time`,{dateTime:e.ts,className:`whitespace-nowrap font-mono text-[10px] opacity-60`,children:new Date(e.ts).toLocaleTimeString()})]},`${e.ts}-${t}`)})})]}),(0,M.jsxs)(`aside`,{className:`flex flex-col gap-4`,children:[G.length>0?(0,M.jsxs)(`section`,{className:`border border-border/70 bg-card/70`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-4 py-2.5`,children:[(0,M.jsx)(h,{className:`h-4 w-4 text-primary`}),(0,M.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.toolBreakdown`)})]}),(0,M.jsx)(`div`,{className:`divide-y divide-border/60`,children:G.map(([e,t])=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 text-xs`,children:[(0,M.jsx)(`span`,{className:`truncate font-medium`,children:e}),(0,M.jsx)(`span`,{className:`ml-2 shrink-0 font-mono font-semibold tabular-nums`,children:t})]},e))})]}):null,d.fileEvents.length>0?(0,M.jsxs)(`section`,{className:`border border-border/70 bg-card/70`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-4 py-2.5`,children:[(0,M.jsx)(f,{className:`h-4 w-4 text-success`}),(0,M.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.fileChanges`)}),(0,M.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:d.fileEvents.length})]}),(0,M.jsx)(`div`,{className:`divide-y divide-border/60`,children:d.fileEvents.map((e,t)=>(0,M.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2 px-4 py-2 text-xs`,children:[(0,M.jsxs)(`div`,{className:`min-w-0`,children:[(0,M.jsx)(`div`,{className:`truncate font-mono font-medium`,title:e.filePath,children:e.filePath}),(0,M.jsx)(`div`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:e.toolName})]}),(0,M.jsx)(`span`,{className:S(`shrink-0 inline-flex items-center border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,e.operation===`delete`?`border-destructive/30 bg-destructive/10 text-destructive`:e.operation===`create`?`border-success/30 bg-success/10 text-success`:`border-border bg-muted text-muted-foreground`),children:I[e.operation]??e.operation})]},`${e.filePath}-${t}`))})]}):null]})]})]})]})}function R({icon:e,label:t,value:n,errorCount:r}){return(0,M.jsxs)(`div`,{className:`border border-border/70 bg-card/70 px-3 py-2.5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground`,children:[(0,M.jsx)(e,{className:`h-3 w-3`}),t]}),(0,M.jsxs)(`div`,{className:`mt-1 flex items-baseline gap-1.5`,children:[(0,M.jsx)(`span`,{className:`font-mono text-lg font-semibold tabular-nums`,children:n}),r!==void 0&&r>0?(0,M.jsxs)(`span`,{className:`font-mono text-xs text-destructive`,children:[`(`,r,` err)`]}):null]})]})}export{L as SessionInspectView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Y as t,_ as n,ft as r}from"./config-store-Dq6MhrIA.js";import{i,t as a}from"./react-core-wiHys0m2.js";import{$t as o,Ba as s,Ct as c,Di as l,J as u,Jn as d,La as ee,Pi as f,Qr as p,Ut as te,Vi as m,Wt as ne,Y as h,dt as g,ja as _,mt as re,pn as ie,rn as ae,un as oe}from"./vendor-Cvuk-OYN.js";import"./i18n-CRIAwjnX.js";import{t as v}from"./utils-sO9lidp6.js";import{n as y}from"./ui-store-D2CzZVyU.js";import"./stores-BOo4b1ZG.js";import{A as se,S as ce}from"./index-BI1MMjfc.js";var b=e(i(),1),x=a(),le=10,ue=20,S=e=>{if(!e)return 0;let t=Date.parse(e);return Number.isNaN(t)?0:t},C=e=>(e.iterationCount??0)+(e.toolCallCount??0)+(e.fileChangeCount??0),w=e=>{let t=Date.parse(e);if(Number.isNaN(t))return``;let n=Math.max(0,Date.now()-t);if(n<6e4)return s.t(`common:time.justNow`);if(n<36e5)return s.t(`common:time.minutesAgo`,{count:Math.floor(n/6e4)});if(n<864e5)return s.t(`common:time.hoursAgo`,{count:Math.floor(n/36e5)});let r=Math.floor(n/864e5);return r<7?s.t(`common:time.daysAgo`,{count:r}):new Date(t).toLocaleDateString()},T=e=>e.lastActivityAt??e.endedAt??e.startedAt;function E(e){let t=S(e.startedAt);if(!t)return``;let n=e.isCurrent?Date.now():S(e.endedAt)||t,r=Math.max(0,Math.floor((n-t)/6e4));if(r<1)return`<1m`;if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h ${r%60}m`:`${Math.floor(i/24)}d ${i%24}h`}function D(e){return new Intl.NumberFormat(void 0,{notation:e>=1e3?`compact`:`standard`,maximumFractionDigits:1}).format(e)}function de(e,t){let n=new Set(t);return e.filter(e=>e.tokenTotal===0&&!e.isCurrent&&!n.has(e.id)).map(e=>e.id)}function fe(e,t){let n=t.query.trim().toLocaleLowerCase(),r=new Set(t.favoriteIds);return[...e.filter(e=>{if(n&&![e.name,e.title,e.lastUserMessage,e.model,e.provider,e.id,...Object.keys(e.toolBreakdown??{})].some(e=>e?.toLocaleLowerCase().includes(n)))return!1;switch(t.filter){case`favorites`:return r.has(e.id);case`active`:return e.isCurrent;case`completed`:return!e.isCurrent&&(e.outcome===`completed`||e.outcome===void 0&&!!e.endedAt);case`issues`:return e.outcome===`error`||e.outcome===`timeout`||e.outcome===`aborted`||(e.toolErrorCount??0)>0;default:return!0}})].sort((e,n)=>{if(t.sort===`tokens`&&n.tokenTotal!==e.tokenTotal)return n.tokenTotal-e.tokenTotal;if(t.sort===`activity`){let t=C(n)-C(e);if(t!==0)return t}return S(T(n))-S(T(e))})}function pe(e,t,n=Date.now()){let r=new Date(n);r.setHours(0,0,0,0);let i=r.getTime(),a=i-864e5,o=i-5184e5,s=new Set(t),c=e.filter(e=>s.has(e.id)),l={today:[],yesterday:[],thisWeek:[],earlier:[]};for(let t of e){if(s.has(t.id))continue;let e=S(T(t));e>=i?l.today.push(t):e>=a?l.yesterday.push(t):e>=o?l.thisWeek.push(t):l.earlier.push(t)}let u=[];c.length>0&&u.push({label:`favorites`,rows:c,favorite:!0});for(let e of[`today`,`yesterday`,`thisWeek`,`earlier`])l[e].length>0&&u.push({label:e,rows:l[e]});return u}function me(e){return e.reduce((e,t)=>({sessions:e.sessions+1,active:e.active+ +!!t.isCurrent,tokens:e.tokens+t.tokenTotal,tools:e.tools+(t.toolCallCount??0),files:e.files+(t.fileChangeCount??0),errors:e.errors+(t.toolErrorCount??0)+ +(t.outcome===`error`)}),{sessions:0,active:0,tokens:0,tools:0,files:0,errors:0})}function he(e){if(e.isCurrent)return{icon:_,label:`active`,defaultLabel:`Active`,className:`text-primary`};switch(e.outcome){case`completed`:return{icon:m,label:`completed`,defaultLabel:`Completed`,className:`text-success`};case`error`:return{icon:g,label:`error`,defaultLabel:`Error`,className:`text-destructive`};case`timeout`:return{icon:l,label:`timeout`,defaultLabel:`Timed out`,className:`text-warning`};case`aborted`:return{icon:f,label:`aborted`,defaultLabel:`Aborted`,className:`text-muted-foreground`};default:return e.endedAt?{icon:m,label:`completed`,defaultLabel:`Completed`,className:`text-success`}:{icon:o,label:`saved`,defaultLabel:`Saved session`,className:`text-muted-foreground`}}}function ge({stats:e}){let{t}=ee(),n=[{label:t(`activity:sessions.stats.sessions`,{defaultValue:`Sessions`}),value:e.sessions,icon:o},{label:t(`activity:sessions.stats.tokens`,{defaultValue:`Tokens`}),value:e.tokens,icon:_},{label:t(`activity:sessions.stats.tools`,{defaultValue:`Tool calls`}),value:e.tools,icon:h},{label:t(`activity:sessions.stats.files`,{defaultValue:`Files changed`}),value:e.files,icon:p},{label:t(`activity:sessions.stats.errors`,{defaultValue:`Errors`}),value:e.errors,icon:g}];return(0,x.jsx)(`div`,{className:`grid grid-cols-2 border-b border-border/75 bg-card md:grid-cols-5`,children:n.map(e=>{let t=e.icon;return(0,x.jsxs)(`div`,{className:`border-b border-r border-border/75 px-4 py-3 md:border-b-0`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground`,children:[(0,x.jsx)(t,{className:`h-3 w-3`}),e.label]}),(0,x.jsx)(`div`,{className:`mt-1 font-mono text-xl font-semibold tabular-nums`,children:D(e.value)})]},e.label)})})}function O({historyQuery:e,setHistoryQuery:i,historyEntries:a,historyLoading:s,historyError:l,wsConnected:f,listSessions:m,resumeSession:_,deleteSession:S,renameSession:C,variant:O=`sidebar`}){let{t:k}=ee(),A=y(e=>e.favoriteSessionIds),_e=y(e=>e.toggleFavoriteSession),j=y(e=>e.sessionNicknames),M=y(e=>e.setSessionNickname),ve=y(e=>e.setInspectSession),[N,ye]=(0,b.useState)(`all`),[P,be]=(0,b.useState)(`recent`),[F,I]=(0,b.useState)(null),[L,R]=(0,b.useState)(``),[z,B]=(0,b.useState)(null),[V,H]=(0,b.useState)(1),U=(0,b.useRef)(null),W=(0,b.useRef)(null),G=O===`workspace`,K=(0,b.useCallback)(e=>e.name||j[e.id]||e.title||k(`activity:sessions.empty`),[j,k]),q=(0,b.useCallback)(e=>{I(e.id),R(e.name??j[e.id]??e.title??``)},[j]),xe=(0,b.useCallback)(e=>{I(null),M(e,L),C(e,L)},[L,C,M]);(0,b.useEffect)(()=>{z&&a.some(e=>e.id===z&&e.isCurrent)&&(B(null),U.current&&clearTimeout(U.current))},[a,z]),(0,b.useEffect)(()=>{F&&(W.current?.focus(),W.current?.select())},[F]),(0,b.useEffect)(()=>()=>{U.current&&clearTimeout(U.current)},[]);let J=n(e=>e.openTabIds),Se=(0,b.useCallback)(e=>{let t=n.getState().openTab(e,{resumeSession:_});t.success&&t.reason!==`already_active`&&t.reason!==`switched`&&(B(e),U.current&&clearTimeout(U.current),U.current=setTimeout(()=>B(null),1e4))},[_]),Y=r(),X=(0,b.useMemo)(()=>{let e=new Set;return Y&&e.add(Y),de(a,e)},[a,Y]),Z=(0,b.useMemo)(()=>fe(a,{query:e,filter:N,sort:P,favoriteIds:A}),[A,N,a,e,P]),Q=G?ue:le,Ce=(0,b.useMemo)(()=>Z.slice((V-1)*Q,V*Q),[V,Q,Z]),$=(0,b.useMemo)(()=>pe(Ce,A),[A,Ce]),we=(0,b.useMemo)(()=>me(a),[a]);(0,b.useEffect)(()=>{H(1)},[N,e,P]),(0,b.useEffect)(()=>{let e=Math.max(1,Math.ceil(Z.length/Q));V>e&&H(e)},[V,Q,Z.length]);let Te=(0,b.useCallback)(async()=>{if(X.length===0||!await se({title:k(`activity:sessions.deleteEmptyTitle`,{count:X.length}),message:k(`activity:sessions.deleteEmptyConfirmBody`),confirmLabel:k(`common:action.delete`),danger:!0}))return;let e=n.getState().closeTabsForSessions(X);for(let t of e)S(t)},[S,X,k]),Ee=[{id:`all`,label:k(`activity:sessions.filters.all`,{defaultValue:`All`})},{id:`favorites`,label:k(`activity:sessions.filters.favorites`,{defaultValue:`Pinned`})},{id:`active`,label:k(`activity:sessions.filters.active`,{defaultValue:`Active`})},{id:`completed`,label:k(`activity:sessions.filters.completed`,{defaultValue:`Completed`})},{id:`issues`,label:k(`activity:sessions.filters.issues`,{defaultValue:`Issues`})}];return(0,x.jsxs)(`div`,{className:v(`flex min-h-0 min-w-0 flex-1 flex-col bg-background`,G&&`h-full`),"data-history-variant":O,children:[G?(0,x.jsx)(ge,{stats:we}):null,(0,x.jsxs)(`div`,{className:v(`border-b border-border/75 bg-card`,G?`px-4 py-3`:`px-3 py-2`),children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:k(`activity:sessions.recentSessions`)}),G?(0,x.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:k(`activity:sessions.workspaceHint`,{defaultValue:`Search, inspect, pin and resume every project conversation.`})}):null]}),(0,x.jsxs)(`div`,{className:`flex shrink-0 items-center border border-border/75`,children:[X.length>0?(0,x.jsxs)(`button`,{type:`button`,className:`inline-flex h-8 items-center justify-center gap-1 border-r border-border/75 px-2 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive disabled:opacity-40`,onClick:Te,disabled:!f,title:k(`activity:sessions.deleteEmptyTitle`,{count:X.length}),"aria-label":k(`activity:sessions.deleteEmptyTitle`,{count:X.length}),children:[(0,x.jsx)(re,{className:`h-3.5 w-3.5`}),(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex min-w-4 items-center justify-center rounded-full bg-destructive/15 px-1 text-[10px] font-semibold leading-4 text-destructive`,children:X.length})]}):null,(0,x.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-8 items-center justify-center text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40`,onClick:()=>m(200),disabled:!f,title:k(`common:action.refresh`),children:s?(0,x.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}):(0,x.jsx)(ae,{className:`h-3.5 w-3.5`})})]})]}),(0,x.jsxs)(`div`,{className:v(`grid gap-2`,G?`mt-3 lg:grid-cols-[minmax(18rem,1fr)_auto_auto]`:`mt-2`),children:[(0,x.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,x.jsx)(te,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,x.jsx)(`input`,{type:`search`,value:e,onChange:e=>i(e.target.value),placeholder:k(`activity:sessions.filterPlaceholder`),"aria-label":k(`activity:sessions.filterPlaceholder`),className:`h-9 w-full border border-border/75 bg-background pl-8 pr-8 text-xs outline-none transition-colors placeholder:text-muted-foreground/70 focus:border-primary focus:ring-1 focus:ring-primary`}),e?(0,x.jsx)(`button`,{type:`button`,onClick:()=>i(``),className:`absolute right-0 top-0 inline-flex h-9 w-8 items-center justify-center text-muted-foreground hover:text-foreground`,title:k(`activity:sessions.clearFilter`),children:(0,x.jsx)(u,{className:`h-3.5 w-3.5`})}):null]}),(0,x.jsxs)(`fieldset`,{className:`flex min-w-0 overflow-x-auto border border-border/75`,children:[(0,x.jsx)(`legend`,{className:`sr-only`,children:k(`activity:sessionList.historyFilters`)}),Ee.map(e=>(0,x.jsx)(`button`,{type:`button`,onClick:()=>ye(e.id),"aria-pressed":N===e.id,className:v(`h-9 shrink-0 border-r border-border/75 px-2.5 text-[10px] font-semibold uppercase tracking-[0.08em] transition-colors last:border-r-0`,N===e.id?`bg-foreground text-background`:`bg-background text-muted-foreground hover:bg-muted hover:text-foreground`),children:e.label},e.id))]}),(0,x.jsxs)(`select`,{value:P,onChange:e=>be(e.target.value),"aria-label":k(`activity:sessions.sort.label`,{defaultValue:`Sort sessions`}),className:`h-9 border border-border/75 bg-background px-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground outline-none focus:border-primary`,children:[(0,x.jsx)(`option`,{value:`recent`,children:k(`activity:sessions.sort.recent`,{defaultValue:`Recent`})}),(0,x.jsx)(`option`,{value:`tokens`,children:k(`activity:sessions.sort.tokens`,{defaultValue:`Most tokens`})}),(0,x.jsx)(`option`,{value:`activity`,children:k(`activity:sessions.sort.activity`,{defaultValue:`Most activity`})})]})]})]}),l?(0,x.jsx)(`div`,{className:`border-b border-destructive/30 bg-destructive/5 px-4 py-2 text-xs text-destructive`,children:l}):null,(0,x.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain overflow-x-hidden [scrollbar-gutter:stable]`,children:a.length===0&&!s?(0,x.jsxs)(`div`,{className:`flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center text-muted-foreground`,children:[(0,x.jsx)(o,{className:`h-9 w-9 opacity-25`}),(0,x.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:k(`activity:sessions.noHistory`)}),(0,x.jsx)(`p`,{className:`mt-1 text-xs`,children:k(`activity:sessions.noHistoryHint`)})]}):$.length===0?(0,x.jsxs)(`div`,{className:`flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center text-muted-foreground`,children:[(0,x.jsx)(te,{className:`h-9 w-9 opacity-25`}),(0,x.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:k(`activity:sessions.noMatches`)}),(0,x.jsx)(`p`,{className:`mt-1 text-xs`,children:k(`activity:sessions.noMatchesHint`)})]}):(0,x.jsxs)(`div`,{className:v(G?`mx-auto w-full max-w-7xl p-4 lg:p-6`:`p-2`),children:[(0,x.jsx)(`div`,{className:v(`space-y-5`,G&&`grid gap-x-5 space-y-0 xl:grid-cols-2`),children:$.map(e=>(0,x.jsxs)(`section`,{className:`min-w-0`,children:[(0,x.jsxs)(`div`,{className:v(`sticky top-0 z-[1] flex items-center gap-1 border-b border-border/75 bg-background/95 px-1 py-2 text-[10px] font-semibold uppercase tracking-[0.14em] backdrop-blur-sm`,e.favorite?`text-warning`:`text-muted-foreground`),children:[e.favorite?(0,x.jsx)(c,{className:`h-3 w-3 fill-current`}):null,k(`activity:sessions.group.${e.label}`),(0,x.jsx)(`span`,{className:`ml-1 font-mono font-normal text-muted-foreground`,children:e.rows.length})]}),(0,x.jsx)(`div`,{className:`divide-y divide-border/75 border-x border-b border-border/75`,children:e.rows.map(e=>{let r=A.includes(e.id),i=he(e),a=i.icon,o=F===e.id,s=z===e.id;return(0,x.jsxs)(`article`,{className:v(`group grid min-w-0 grid-cols-[minmax(0,1fr)_auto] bg-card transition-colors`,e.isCurrent?`border-l-2 border-l-primary bg-primary/5`:`border-l-2 border-l-transparent hover:bg-muted/45`),"data-session-id":e.id,children:[o?(0,x.jsxs)(`div`,{className:`min-w-0 px-3 py-3`,children:[(0,x.jsx)(`label`,{className:`block text-[10px] font-semibold uppercase tracking-[0.1em] text-muted-foreground`,htmlFor:`session-name-${e.id}`,children:k(`activity:sessions.rename`,{defaultValue:`Session name`})}),(0,x.jsx)(`input`,{ref:W,id:`session-name-${e.id}`,value:L,onChange:e=>R(e.target.value),onBlur:()=>xe(e.id),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),xe(e.id)):t.key===`Escape`&&(t.preventDefault(),I(null))},placeholder:e.title||k(`activity:sessions.nicknamePlaceholder`),className:`mt-1 h-8 w-full border border-primary bg-background px-2 text-sm outline-none ring-1 ring-primary`})]}):(0,x.jsx)(`button`,{type:`button`,disabled:e.isCurrent||s,onClick:()=>Se(e.id),onDoubleClick:()=>q(e),"aria-current":e.isCurrent?`page`:void 0,className:`min-w-0 px-3 py-3 text-left outline-none focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary disabled:cursor-default`,children:(0,x.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,x.jsx)(`span`,{className:v(`mt-0.5 shrink-0`,i.className),title:k(`activity:sessions.status.${i.label}`,{defaultValue:i.defaultLabel}),children:(0,x.jsx)(a,{className:v(`h-3.5 w-3.5`,e.isCurrent&&`animate-pulse`)})}),(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,x.jsx)(`div`,{className:`truncate text-sm font-semibold text-foreground`,title:K(e),children:K(e)}),e.isCurrent?(0,x.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded bg-primary/15 px-1.5 py-0.5 text-[10px] font-semibold text-primary`,children:[(0,x.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-primary animate-pulse`}),k(`activity:sessions.activeTab`,{defaultValue:`Active Tab`})]}):J.includes(e.id)?(0,x.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[10px] font-semibold text-muted-foreground`,children:[(0,x.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-success`}),k(`activity:sessions.tabNumber`,{count:J.indexOf(e.id)+1,defaultValue:`Tab ${J.indexOf(e.id)+1}`})]}):null]}),(0,x.jsxs)(`div`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:[e.provider,`/`,e.model]}),e.lastUserMessage?(0,x.jsx)(`div`,{className:`mt-1 truncate text-xs text-muted-foreground`,title:e.lastUserMessage,children:e.lastUserMessage}):null,(0,x.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 font-mono text-[10px] text-muted-foreground`,children:[s?(0,x.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-sans font-semibold text-primary`,children:[(0,x.jsx)(d,{className:`h-3 w-3 animate-spin`}),k(`activity:sessions.resuming`)]}):(0,x.jsx)(`span`,{title:new Date(T(e)).toLocaleString(),children:w(T(e))}),(0,x.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,x.jsx)(`span`,{children:E(e)}),e.tokenTotal>0?(0,x.jsxs)(`span`,{children:[D(e.tokenTotal),` tok`]}):null,(e.messageCount??0)>0?(0,x.jsxs)(`span`,{children:[D(e.messageCount??0),` msg`]}):null,(e.toolCallCount??0)>0?(0,x.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,x.jsx)(h,{className:`h-3 w-3`}),e.toolCallCount]}):null,(e.fileChangeCount??0)>0?(0,x.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,x.jsx)(p,{className:`h-3 w-3`}),e.fileChangeCount]}):null,(e.toolErrorCount??0)>0?(0,x.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-destructive`,children:[(0,x.jsx)(g,{className:`h-3 w-3`}),e.toolErrorCount]}):null]})]})]})}),(0,x.jsxs)(`div`,{className:`flex items-start gap-0.5 p-2`,children:[!e.isCurrent&&!J.includes(e.id)&&G&&!o?(0,x.jsxs)(`button`,{type:`button`,onClick:()=>Se(e.id),disabled:z!==null,className:`inline-flex h-7 items-center gap-1 border border-border/75 px-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground hover:border-primary hover:text-primary disabled:opacity-40`,title:k(`activity:sessions.resume`,{defaultValue:`Resume session`}),children:[(0,x.jsx)(oe,{className:`h-3 w-3`}),k(`activity:sessions.resumeShort`,{defaultValue:`Resume`})]}):null,o?null:(0,x.jsx)(`button`,{type:`button`,onClick:()=>ve(e.id),className:`inline-flex h-7 w-7 items-center justify-center text-muted-foreground transition-colors hover:bg-primary/10 hover:text-primary`,title:k(`activity:sessions.inspect`,{defaultValue:`Inspect session`}),children:(0,x.jsx)(ne,{className:`h-3.5 w-3.5`})}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>_e(e.id),"aria-pressed":r,className:v(`inline-flex h-7 w-7 items-center justify-center transition-colors hover:bg-warning/10 hover:text-warning`,r?`text-warning`:`text-muted-foreground`),title:k(r?`activity:sessions.unfavorite`:`activity:sessions.markFavorite`),children:(0,x.jsx)(c,{className:v(`h-3.5 w-3.5`,r&&`fill-current`)})}),o?null:(0,x.jsx)(`button`,{type:`button`,onClick:()=>q(e),className:`inline-flex h-7 w-7 items-center justify-center text-muted-foreground transition-colors hover:bg-primary/10 hover:text-primary`,title:k(`activity:sessions.renameAction`,{defaultValue:`Rename`}),children:(0,x.jsx)(ie,{className:`h-3.5 w-3.5`})}),e.isCurrent?null:(0,x.jsx)(`button`,{type:`button`,onClick:async()=>{if(await se({title:k(`activity:sessions.deleteSessionConfirmTitle`),message:k(`activity:sessions.deleteSessionConfirmBody`,{name:K(e)}),confirmLabel:k(`common:action.delete`),danger:!0})){if(!n.getState().closeTabsForSessions([e.id]).includes(e.id)){t.info(k(`activity:sessions.deleteKeptLastTab`,{defaultValue:`Session not deleted — at least one tab must stay open.`}));return}S(e.id)}},className:`inline-flex h-7 w-7 items-center justify-center text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,title:k(`activity:sessions.deleteSessionTitle`),children:(0,x.jsx)(re,{className:`h-3.5 w-3.5`})})]})]},e.id)})})]},e.label))}),(0,x.jsx)(ce,{page:V,pageSize:Q,totalItems:Z.length,onPageChange:H,compact:!G,itemLabel:`sessions`})]})})]})}export{E as i,D as n,w as r,O as t};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Z as t,_ as n,mt as r}from"./config-store-CZdk-vPj.js";import{i,t as a}from"./react-core-wiHys0m2.js";import{$t as o,Ba as s,Ct as c,Di as l,J as u,Jn as d,La as ee,Pi as f,Qr as p,Ut as te,Vi as m,Wt as ne,Y as h,dt as g,ja as _,mt as re,pn as ie,rn as ae,un as oe}from"./vendor-Cvuk-OYN.js";import"./i18n-BwptPW9U.js";import{t as v}from"./utils-sO9lidp6.js";import{n as y}from"./ui-store-CMdVzHOn.js";import"./stores-Bt7wAdGA.js";import{M as se,w as ce}from"./index-BYBlSXtn.js";var b=e(i(),1),x=a(),le=10,ue=20,S=e=>{if(!e)return 0;let t=Date.parse(e);return Number.isNaN(t)?0:t},C=e=>(e.iterationCount??0)+(e.toolCallCount??0)+(e.fileChangeCount??0),w=e=>{let t=Date.parse(e);if(Number.isNaN(t))return``;let n=Math.max(0,Date.now()-t);if(n<6e4)return s.t(`common:time.justNow`);if(n<36e5)return s.t(`common:time.minutesAgo`,{count:Math.floor(n/6e4)});if(n<864e5)return s.t(`common:time.hoursAgo`,{count:Math.floor(n/36e5)});let r=Math.floor(n/864e5);return r<7?s.t(`common:time.daysAgo`,{count:r}):new Date(t).toLocaleDateString()},T=e=>e.lastActivityAt??e.endedAt??e.startedAt;function E(e){let t=S(e.startedAt);if(!t)return``;let n=e.isCurrent?Date.now():S(e.endedAt)||t,r=Math.max(0,Math.floor((n-t)/6e4));if(r<1)return`<1m`;if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h ${r%60}m`:`${Math.floor(i/24)}d ${i%24}h`}function D(e){return new Intl.NumberFormat(void 0,{notation:e>=1e3?`compact`:`standard`,maximumFractionDigits:1}).format(e)}function de(e,t){let n=new Set(t);return e.filter(e=>e.tokenTotal===0&&!e.isCurrent&&!n.has(e.id)).map(e=>e.id)}function fe(e,t){let n=t.query.trim().toLocaleLowerCase(),r=new Set(t.favoriteIds);return[...e.filter(e=>{if(n&&![e.name,e.title,e.lastUserMessage,e.model,e.provider,e.id,...Object.keys(e.toolBreakdown??{})].some(e=>e?.toLocaleLowerCase().includes(n)))return!1;switch(t.filter){case`favorites`:return r.has(e.id);case`active`:return e.isCurrent;case`completed`:return!e.isCurrent&&(e.outcome===`completed`||e.outcome===void 0&&!!e.endedAt);case`issues`:return e.outcome===`error`||e.outcome===`timeout`||e.outcome===`aborted`||(e.toolErrorCount??0)>0;default:return!0}})].sort((e,n)=>{if(t.sort===`tokens`&&n.tokenTotal!==e.tokenTotal)return n.tokenTotal-e.tokenTotal;if(t.sort===`activity`){let t=C(n)-C(e);if(t!==0)return t}return S(T(n))-S(T(e))})}function pe(e,t,n=Date.now()){let r=new Date(n);r.setHours(0,0,0,0);let i=r.getTime(),a=i-864e5,o=i-5184e5,s=new Set(t),c=e.filter(e=>s.has(e.id)),l={today:[],yesterday:[],thisWeek:[],earlier:[]};for(let t of e){if(s.has(t.id))continue;let e=S(T(t));e>=i?l.today.push(t):e>=a?l.yesterday.push(t):e>=o?l.thisWeek.push(t):l.earlier.push(t)}let u=[];c.length>0&&u.push({label:`favorites`,rows:c,favorite:!0});for(let e of[`today`,`yesterday`,`thisWeek`,`earlier`])l[e].length>0&&u.push({label:e,rows:l[e]});return u}function me(e){return e.reduce((e,t)=>({sessions:e.sessions+1,active:e.active+ +!!t.isCurrent,tokens:e.tokens+t.tokenTotal,tools:e.tools+(t.toolCallCount??0),files:e.files+(t.fileChangeCount??0),errors:e.errors+(t.toolErrorCount??0)+ +(t.outcome===`error`)}),{sessions:0,active:0,tokens:0,tools:0,files:0,errors:0})}function he(e){if(e.isCurrent)return{icon:_,label:`active`,defaultLabel:`Active`,className:`text-primary`};switch(e.outcome){case`completed`:return{icon:m,label:`completed`,defaultLabel:`Completed`,className:`text-success`};case`error`:return{icon:g,label:`error`,defaultLabel:`Error`,className:`text-destructive`};case`timeout`:return{icon:l,label:`timeout`,defaultLabel:`Timed out`,className:`text-warning`};case`aborted`:return{icon:f,label:`aborted`,defaultLabel:`Aborted`,className:`text-muted-foreground`};default:return e.endedAt?{icon:m,label:`completed`,defaultLabel:`Completed`,className:`text-success`}:{icon:o,label:`saved`,defaultLabel:`Saved session`,className:`text-muted-foreground`}}}function ge({stats:e}){let{t}=ee(),n=[{label:t(`activity:sessions.stats.sessions`,{defaultValue:`Sessions`}),value:e.sessions,icon:o},{label:t(`activity:sessions.stats.tokens`,{defaultValue:`Tokens`}),value:e.tokens,icon:_},{label:t(`activity:sessions.stats.tools`,{defaultValue:`Tool calls`}),value:e.tools,icon:h},{label:t(`activity:sessions.stats.files`,{defaultValue:`Files changed`}),value:e.files,icon:p},{label:t(`activity:sessions.stats.errors`,{defaultValue:`Errors`}),value:e.errors,icon:g}];return(0,x.jsx)(`div`,{className:`grid grid-cols-2 border-b border-border/75 bg-card md:grid-cols-5`,children:n.map(e=>{let t=e.icon;return(0,x.jsxs)(`div`,{className:`border-b border-r border-border/75 px-4 py-3 md:border-b-0`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground`,children:[(0,x.jsx)(t,{className:`h-3 w-3`}),e.label]}),(0,x.jsx)(`div`,{className:`mt-1 font-mono text-xl font-semibold tabular-nums`,children:D(e.value)})]},e.label)})})}function O({historyQuery:e,setHistoryQuery:i,historyEntries:a,historyLoading:s,historyError:l,wsConnected:f,listSessions:m,resumeSession:_,deleteSession:S,renameSession:C,variant:O=`sidebar`}){let{t:k}=ee(),A=y(e=>e.favoriteSessionIds),_e=y(e=>e.toggleFavoriteSession),j=y(e=>e.sessionNicknames),M=y(e=>e.setSessionNickname),ve=y(e=>e.setInspectSession),[N,ye]=(0,b.useState)(`all`),[P,be]=(0,b.useState)(`recent`),[F,I]=(0,b.useState)(null),[L,R]=(0,b.useState)(``),[z,B]=(0,b.useState)(null),[V,H]=(0,b.useState)(1),U=(0,b.useRef)(null),W=(0,b.useRef)(null),G=O===`workspace`,K=(0,b.useCallback)(e=>e.name||j[e.id]||e.title||k(`activity:sessions.empty`),[j,k]),q=(0,b.useCallback)(e=>{I(e.id),R(e.name??j[e.id]??e.title??``)},[j]),xe=(0,b.useCallback)(e=>{I(null),M(e,L),C(e,L)},[L,C,M]);(0,b.useEffect)(()=>{z&&a.some(e=>e.id===z&&e.isCurrent)&&(B(null),U.current&&clearTimeout(U.current))},[a,z]),(0,b.useEffect)(()=>{F&&(W.current?.focus(),W.current?.select())},[F]),(0,b.useEffect)(()=>()=>{U.current&&clearTimeout(U.current)},[]);let J=n(e=>e.openTabIds),Se=(0,b.useCallback)(e=>{let t=n.getState().openTab(e,{resumeSession:_});t.success&&t.reason!==`already_active`&&t.reason!==`switched`&&(B(e),U.current&&clearTimeout(U.current),U.current=setTimeout(()=>B(null),1e4))},[_]),Y=r(),X=(0,b.useMemo)(()=>{let e=new Set;return Y&&e.add(Y),de(a,e)},[a,Y]),Z=(0,b.useMemo)(()=>fe(a,{query:e,filter:N,sort:P,favoriteIds:A}),[A,N,a,e,P]),Q=G?ue:le,Ce=(0,b.useMemo)(()=>Z.slice((V-1)*Q,V*Q),[V,Q,Z]),$=(0,b.useMemo)(()=>pe(Ce,A),[A,Ce]),we=(0,b.useMemo)(()=>me(a),[a]);(0,b.useEffect)(()=>{H(1)},[N,e,P]),(0,b.useEffect)(()=>{let e=Math.max(1,Math.ceil(Z.length/Q));V>e&&H(e)},[V,Q,Z.length]);let Te=(0,b.useCallback)(async()=>{if(X.length===0||!await se({title:k(`activity:sessions.deleteEmptyTitle`,{count:X.length}),message:k(`activity:sessions.deleteEmptyConfirmBody`),confirmLabel:k(`common:action.delete`),danger:!0}))return;let e=n.getState().closeTabsForSessions(X);for(let t of e)S(t)},[S,X,k]),Ee=[{id:`all`,label:k(`activity:sessions.filters.all`,{defaultValue:`All`})},{id:`favorites`,label:k(`activity:sessions.filters.favorites`,{defaultValue:`Pinned`})},{id:`active`,label:k(`activity:sessions.filters.active`,{defaultValue:`Active`})},{id:`completed`,label:k(`activity:sessions.filters.completed`,{defaultValue:`Completed`})},{id:`issues`,label:k(`activity:sessions.filters.issues`,{defaultValue:`Issues`})}];return(0,x.jsxs)(`div`,{className:v(`flex min-h-0 min-w-0 flex-1 flex-col bg-background`,G&&`h-full`),"data-history-variant":O,children:[G?(0,x.jsx)(ge,{stats:we}):null,(0,x.jsxs)(`div`,{className:v(`border-b border-border/75 bg-card`,G?`px-4 py-3`:`px-3 py-2`),children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:k(`activity:sessions.recentSessions`)}),G?(0,x.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:k(`activity:sessions.workspaceHint`,{defaultValue:`Search, inspect, pin and resume every project conversation.`})}):null]}),(0,x.jsxs)(`div`,{className:`flex shrink-0 items-center border border-border/75`,children:[X.length>0?(0,x.jsxs)(`button`,{type:`button`,className:`inline-flex h-8 items-center justify-center gap-1 border-r border-border/75 px-2 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive disabled:opacity-40`,onClick:Te,disabled:!f,title:k(`activity:sessions.deleteEmptyTitle`,{count:X.length}),"aria-label":k(`activity:sessions.deleteEmptyTitle`,{count:X.length}),children:[(0,x.jsx)(re,{className:`h-3.5 w-3.5`}),(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex min-w-4 items-center justify-center rounded-full bg-destructive/15 px-1 text-[10px] font-semibold leading-4 text-destructive`,children:X.length})]}):null,(0,x.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-8 items-center justify-center text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40`,onClick:()=>m(200),disabled:!f,title:k(`common:action.refresh`),children:s?(0,x.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}):(0,x.jsx)(ae,{className:`h-3.5 w-3.5`})})]})]}),(0,x.jsxs)(`div`,{className:v(`grid gap-2`,G?`mt-3 lg:grid-cols-[minmax(18rem,1fr)_auto_auto]`:`mt-2`),children:[(0,x.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,x.jsx)(te,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,x.jsx)(`input`,{type:`search`,value:e,onChange:e=>i(e.target.value),placeholder:k(`activity:sessions.filterPlaceholder`),"aria-label":k(`activity:sessions.filterPlaceholder`),className:`h-9 w-full border border-border/75 bg-background pl-8 pr-8 text-xs outline-none transition-colors placeholder:text-muted-foreground/70 focus:border-primary focus:ring-1 focus:ring-primary`}),e?(0,x.jsx)(`button`,{type:`button`,onClick:()=>i(``),className:`absolute right-0 top-0 inline-flex h-9 w-8 items-center justify-center text-muted-foreground hover:text-foreground`,title:k(`activity:sessions.clearFilter`),children:(0,x.jsx)(u,{className:`h-3.5 w-3.5`})}):null]}),(0,x.jsxs)(`fieldset`,{className:`flex min-w-0 overflow-x-auto border border-border/75`,children:[(0,x.jsx)(`legend`,{className:`sr-only`,children:k(`activity:sessionList.historyFilters`)}),Ee.map(e=>(0,x.jsx)(`button`,{type:`button`,onClick:()=>ye(e.id),"aria-pressed":N===e.id,className:v(`h-9 shrink-0 border-r border-border/75 px-2.5 text-[10px] font-semibold uppercase tracking-[0.08em] transition-colors last:border-r-0`,N===e.id?`bg-foreground text-background`:`bg-background text-muted-foreground hover:bg-muted hover:text-foreground`),children:e.label},e.id))]}),(0,x.jsxs)(`select`,{value:P,onChange:e=>be(e.target.value),"aria-label":k(`activity:sessions.sort.label`,{defaultValue:`Sort sessions`}),className:`h-9 border border-border/75 bg-background px-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground outline-none focus:border-primary`,children:[(0,x.jsx)(`option`,{value:`recent`,children:k(`activity:sessions.sort.recent`,{defaultValue:`Recent`})}),(0,x.jsx)(`option`,{value:`tokens`,children:k(`activity:sessions.sort.tokens`,{defaultValue:`Most tokens`})}),(0,x.jsx)(`option`,{value:`activity`,children:k(`activity:sessions.sort.activity`,{defaultValue:`Most activity`})})]})]})]}),l?(0,x.jsx)(`div`,{className:`border-b border-destructive/30 bg-destructive/5 px-4 py-2 text-xs text-destructive`,children:l}):null,(0,x.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain overflow-x-hidden [scrollbar-gutter:stable]`,children:a.length===0&&!s?(0,x.jsxs)(`div`,{className:`flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center text-muted-foreground`,children:[(0,x.jsx)(o,{className:`h-9 w-9 opacity-25`}),(0,x.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:k(`activity:sessions.noHistory`)}),(0,x.jsx)(`p`,{className:`mt-1 text-xs`,children:k(`activity:sessions.noHistoryHint`)})]}):$.length===0?(0,x.jsxs)(`div`,{className:`flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center text-muted-foreground`,children:[(0,x.jsx)(te,{className:`h-9 w-9 opacity-25`}),(0,x.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:k(`activity:sessions.noMatches`)}),(0,x.jsx)(`p`,{className:`mt-1 text-xs`,children:k(`activity:sessions.noMatchesHint`)})]}):(0,x.jsxs)(`div`,{className:v(G?`mx-auto w-full max-w-7xl p-4 lg:p-6`:`p-2`),children:[(0,x.jsx)(`div`,{className:v(`space-y-5`,G&&`grid gap-x-5 space-y-0 xl:grid-cols-2`),children:$.map(e=>(0,x.jsxs)(`section`,{className:`min-w-0`,children:[(0,x.jsxs)(`div`,{className:v(`sticky top-0 z-[1] flex items-center gap-1 border-b border-border/75 bg-background/95 px-1 py-2 text-[10px] font-semibold uppercase tracking-[0.14em] backdrop-blur-sm`,e.favorite?`text-warning`:`text-muted-foreground`),children:[e.favorite?(0,x.jsx)(c,{className:`h-3 w-3 fill-current`}):null,k(`activity:sessions.group.${e.label}`),(0,x.jsx)(`span`,{className:`ml-1 font-mono font-normal text-muted-foreground`,children:e.rows.length})]}),(0,x.jsx)(`div`,{className:`divide-y divide-border/75 border-x border-b border-border/75`,children:e.rows.map(e=>{let r=A.includes(e.id),i=he(e),a=i.icon,o=F===e.id,s=z===e.id;return(0,x.jsxs)(`article`,{className:v(`group grid min-w-0 grid-cols-[minmax(0,1fr)_auto] bg-card transition-colors`,e.isCurrent?`border-l-2 border-l-primary bg-primary/5`:`border-l-2 border-l-transparent hover:bg-muted/45`),"data-session-id":e.id,children:[o?(0,x.jsxs)(`div`,{className:`min-w-0 px-3 py-3`,children:[(0,x.jsx)(`label`,{className:`block text-[10px] font-semibold uppercase tracking-[0.1em] text-muted-foreground`,htmlFor:`session-name-${e.id}`,children:k(`activity:sessions.rename`,{defaultValue:`Session name`})}),(0,x.jsx)(`input`,{ref:W,id:`session-name-${e.id}`,value:L,onChange:e=>R(e.target.value),onBlur:()=>xe(e.id),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),xe(e.id)):t.key===`Escape`&&(t.preventDefault(),I(null))},placeholder:e.title||k(`activity:sessions.nicknamePlaceholder`),className:`mt-1 h-8 w-full border border-primary bg-background px-2 text-sm outline-none ring-1 ring-primary`})]}):(0,x.jsx)(`button`,{type:`button`,disabled:e.isCurrent||s,onClick:()=>Se(e.id),onDoubleClick:()=>q(e),"aria-current":e.isCurrent?`page`:void 0,className:`min-w-0 px-3 py-3 text-left outline-none focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary disabled:cursor-default`,children:(0,x.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,x.jsx)(`span`,{className:v(`mt-0.5 shrink-0`,i.className),title:k(`activity:sessions.status.${i.label}`,{defaultValue:i.defaultLabel}),children:(0,x.jsx)(a,{className:v(`h-3.5 w-3.5`,e.isCurrent&&`animate-pulse`)})}),(0,x.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,x.jsx)(`div`,{className:`truncate text-sm font-semibold text-foreground`,title:K(e),children:K(e)}),e.isCurrent?(0,x.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded bg-primary/15 px-1.5 py-0.5 text-[10px] font-semibold text-primary`,children:[(0,x.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-primary animate-pulse`}),k(`activity:sessions.activeTab`,{defaultValue:`Active Tab`})]}):J.includes(e.id)?(0,x.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[10px] font-semibold text-muted-foreground`,children:[(0,x.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-success`}),k(`activity:sessions.tabNumber`,{count:J.indexOf(e.id)+1,defaultValue:`Tab ${J.indexOf(e.id)+1}`})]}):null]}),(0,x.jsxs)(`div`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:[e.provider,`/`,e.model]}),e.lastUserMessage?(0,x.jsx)(`div`,{className:`mt-1 truncate text-xs text-muted-foreground`,title:e.lastUserMessage,children:e.lastUserMessage}):null,(0,x.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 font-mono text-[10px] text-muted-foreground`,children:[s?(0,x.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-sans font-semibold text-primary`,children:[(0,x.jsx)(d,{className:`h-3 w-3 animate-spin`}),k(`activity:sessions.resuming`)]}):(0,x.jsx)(`span`,{title:new Date(T(e)).toLocaleString(),children:w(T(e))}),(0,x.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,x.jsx)(`span`,{children:E(e)}),e.tokenTotal>0?(0,x.jsxs)(`span`,{children:[D(e.tokenTotal),` tok`]}):null,(e.messageCount??0)>0?(0,x.jsxs)(`span`,{children:[D(e.messageCount??0),` msg`]}):null,(e.toolCallCount??0)>0?(0,x.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,x.jsx)(h,{className:`h-3 w-3`}),e.toolCallCount]}):null,(e.fileChangeCount??0)>0?(0,x.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,x.jsx)(p,{className:`h-3 w-3`}),e.fileChangeCount]}):null,(e.toolErrorCount??0)>0?(0,x.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-destructive`,children:[(0,x.jsx)(g,{className:`h-3 w-3`}),e.toolErrorCount]}):null]})]})]})}),(0,x.jsxs)(`div`,{className:`flex items-start gap-0.5 p-2`,children:[!e.isCurrent&&!J.includes(e.id)&&G&&!o?(0,x.jsxs)(`button`,{type:`button`,onClick:()=>Se(e.id),disabled:z!==null,className:`inline-flex h-7 items-center gap-1 border border-border/75 px-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground hover:border-primary hover:text-primary disabled:opacity-40`,title:k(`activity:sessions.resume`,{defaultValue:`Resume session`}),children:[(0,x.jsx)(oe,{className:`h-3 w-3`}),k(`activity:sessions.resumeShort`,{defaultValue:`Resume`})]}):null,o?null:(0,x.jsx)(`button`,{type:`button`,onClick:()=>ve(e.id),className:`inline-flex h-7 w-7 items-center justify-center text-muted-foreground transition-colors hover:bg-primary/10 hover:text-primary`,title:k(`activity:sessions.inspect`,{defaultValue:`Inspect session`}),children:(0,x.jsx)(ne,{className:`h-3.5 w-3.5`})}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>_e(e.id),"aria-pressed":r,className:v(`inline-flex h-7 w-7 items-center justify-center transition-colors hover:bg-warning/10 hover:text-warning`,r?`text-warning`:`text-muted-foreground`),title:k(r?`activity:sessions.unfavorite`:`activity:sessions.markFavorite`),children:(0,x.jsx)(c,{className:v(`h-3.5 w-3.5`,r&&`fill-current`)})}),o?null:(0,x.jsx)(`button`,{type:`button`,onClick:()=>q(e),className:`inline-flex h-7 w-7 items-center justify-center text-muted-foreground transition-colors hover:bg-primary/10 hover:text-primary`,title:k(`activity:sessions.renameAction`,{defaultValue:`Rename`}),children:(0,x.jsx)(ie,{className:`h-3.5 w-3.5`})}),e.isCurrent?null:(0,x.jsx)(`button`,{type:`button`,onClick:async()=>{if(await se({title:k(`activity:sessions.deleteSessionConfirmTitle`),message:k(`activity:sessions.deleteSessionConfirmBody`,{name:K(e)}),confirmLabel:k(`common:action.delete`),danger:!0})){if(!n.getState().closeTabsForSessions([e.id]).includes(e.id)){t.info(k(`activity:sessions.deleteKeptLastTab`,{defaultValue:`Session not deleted — at least one tab must stay open.`}));return}S(e.id)}},className:`inline-flex h-7 w-7 items-center justify-center text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,title:k(`activity:sessions.deleteSessionTitle`),children:(0,x.jsx)(re,{className:`h-3.5 w-3.5`})})]})]},e.id)})})]},e.label))}),(0,x.jsx)(ce,{page:V,pageSize:Q,totalItems:Z.length,onPageChange:H,compact:!G,itemLabel:`sessions`})]})})]})}export{E as i,D as n,w as r,O as t};
|