@wrongstack/webui 0.307.0 → 0.307.1
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-DYAdqgOi.js → AgentRosterView-Bb5m_XjZ.js} +1 -1
- package/dist/assets/{AnalyticsDashboard-BnRP4jRR.js → AnalyticsDashboard-lqPCAo9u.js} +1 -1
- package/dist/assets/{AudienceMemoryPanel-CLHvzRH_.js → AudienceMemoryPanel-putWTq5V.js} +1 -1
- package/dist/assets/{ChangesView-35TNNOyK.js → ChangesView-Cw-qvOLA.js} +1 -1
- package/dist/assets/{ChronicleDashboard-BkAPjMg8.js → ChronicleDashboard-DQdMkTLQ.js} +1 -1
- package/dist/assets/{CodeEditor-CJdcj7Lh.js → CodeEditor-BAv2f4se.js} +1 -1
- package/dist/assets/{CodeMap-BNfs5wrd.js → CodeMap-BB1WETLd.js} +1 -1
- package/dist/assets/{ConfirmModal-D0FaeNr8.js → ConfirmModal-LBZaZgsG.js} +1 -1
- package/dist/assets/{CronJobsPanel-DK10t9ty.js → CronJobsPanel-DE5CVuSW.js} +1 -1
- package/dist/assets/{DeadCodeScanPanel-CwpRRLLW.js → DeadCodeScanPanel-nlQ9nL3Y.js} +1 -1
- package/dist/assets/{DebugDashboard-BvQrhE38.js → DebugDashboard-CgRH9SvC.js} +1 -1
- package/dist/assets/{DesignGalleryView-DSYCeZWp.js → DesignGalleryView-Uwo3JXyu.js} +1 -1
- package/dist/assets/{GoalView-DjrhT9dw.js → GoalView-Cc4B-0Qd.js} +1 -1
- package/dist/assets/{KanbanView-oxhKdDA1.js → KanbanView-CK4bvZfi.js} +1 -1
- package/dist/assets/{MailboxDetailView-DVwTJlVk.js → MailboxDetailView-CGwtSBcH.js} +1 -1
- package/dist/assets/{MemoryDrawer-DL8ORfEs.js → MemoryDrawer-Cw1IiFCO.js} +1 -1
- package/dist/assets/{MemoryManager-CfbOPMAN.js → MemoryManager-l0R8JBzL.js} +1 -1
- package/dist/assets/{ModelPicker-BfnL3Y17.js → ModelPicker-DC-XCx0f.js} +1 -1
- package/dist/assets/{OfficeMapPanel-PO-Ziqir.js → OfficeMapPanel-CUI0PJBI.js} +1 -1
- package/dist/assets/{ProcessMonitor-C5kib2h4.js → ProcessMonitor-DLD6PrVx.js} +1 -1
- package/dist/assets/PromptJournalView-Cf1szLLw.js +1 -0
- package/dist/assets/{QueuePanel-Cgo0AeCj.js → QueuePanel-O7IsaKUs.js} +1 -1
- package/dist/assets/{RefreshDebugView-B_doTjkD.js → RefreshDebugView-CuKbgI-T.js} +1 -1
- package/dist/assets/{RequirementIntakeView-BPXI8cu2.js → RequirementIntakeView-Bg8ZoV7J.js} +1 -1
- package/dist/assets/{SageTabs-DWdF_2PE.js → SageTabs-Bk8VDMmR.js} +2 -2
- package/dist/assets/{SddFlowGraph-Ck97BG1F.js → SddFlowGraph-DdYgCVM_.js} +1 -1
- package/dist/assets/{SddHub-BcqPr8Hj.js → SddHub-tQztZlHf.js} +1 -1
- package/dist/assets/{SessionInspectView-TFuvc8uU.js → SessionInspectView-BnoD3YER.js} +1 -1
- package/dist/assets/{SessionList-CwVI8eZL.js → SessionList-BRbF7FVS.js} +1 -1
- package/dist/assets/{SessionsDashboard-Bc1iSTBm.js → SessionsDashboard-7heYIhHQ.js} +1 -1
- package/dist/assets/{SetupScreen-DT4PMl9C.js → SetupScreen-CQW-6bhj.js} +1 -1
- package/dist/assets/{SkillDetailView-DoXu60GN.js → SkillDetailView-DdxB0JI4.js} +1 -1
- package/dist/assets/{SpecsView-CoL5_ZKF.js → SpecsView-BAnFfPPH.js} +1 -1
- package/dist/assets/{TechStackView-CTf7eM_K.js → TechStackView-DJeNOZE9.js} +1 -1
- package/dist/assets/{TerminalPanel-BowAkbec.js → TerminalPanel-v3SC9LTq.js} +1 -1
- package/dist/assets/{Toaster-Dnn83kq_.js → Toaster-wXvKXbbS.js} +1 -1
- package/dist/assets/{activity-DGss9yYZ.js → activity-C0qPnCbW.js} +1 -1
- package/dist/assets/{activity-DWf-x6Rd.js → activity-DTSVEiLK.js} +1 -1
- package/dist/assets/{activity-Chofrfz8.js → activity-DWHlYL9x.js} +1 -1
- package/dist/assets/{activity-BAmXZRX5.js → activity-DjnYvN9C.js} +1 -1
- package/dist/assets/{activity-5tPFRU1U.js → activity-fdbTRXeg.js} +2 -2
- package/dist/assets/{activity-B7udcp0S.js → activity-jL8-j1D0.js} +1 -1
- package/dist/assets/{activity-BrRl22KD.js → activity-phJuGuf4.js} +1 -1
- package/dist/assets/{i18n-O7wMOn8G.js → i18n-CDoHRskt.js} +2 -2
- package/dist/assets/{index-CzVjuusy.js → index-BRJ_UrGk.js} +5 -5
- package/dist/assets/{index-C7U_T9PB.css → index-BRs425Ir.css} +1 -1
- package/dist/assets/{roster-ws-LJR_IyEw.js → roster-ws-CK52jAnG.js} +1 -1
- package/dist/assets/{stores-CmkcHezT.js → stores-DSGsI875.js} +1 -1
- package/dist/assets/ui-store-xx1NssJI.js +1 -0
- package/dist/assets/{useWebSocket-7Vm7doHG.js → useWebSocket-BFFntyS4.js} +1 -1
- package/dist/assets/{view-navigation-BiljGQYK.js → view-navigation-CZKugncK.js} +1 -1
- package/dist/assets/ws-client-B3MVz75-.js +1 -0
- package/dist/components/PromptJournalView.d.ts +2 -0
- package/dist/index.html +12 -12
- package/dist/index.js +3107 -2528
- package/dist/lib/view-navigation.d.ts +1 -1
- package/dist/stores/ui-store.d.ts +3 -3
- package/dist/types/client-message.d.ts +11 -0
- package/dist/types/server-message.d.ts +32 -0
- package/package.json +8 -8
- package/dist/assets/ui-store-tCiy1eTu.js +0 -1
- package/dist/assets/ws-client-C4OHn-_g.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./chat-store-c0pGYczr.js";import{Aa as n,Ba as r,Ca as i,Ga as a,dt as o,jt as s,lt as c,ra as l,ur as u}from"./vendor-C_zEzV4N.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./chat-store-c0pGYczr.js";import{Aa as n,Ba as r,Ca as i,Ga as a,dt as o,jt as s,lt as c,ra as l,ur as u}from"./vendor-C_zEzV4N.js";import"./i18n-CDoHRskt.js";import{t as d}from"./utils-tsZEnrBH.js";import"./stores-DSGsI875.js";import{n as f,o as p,r as m,t as h}from"./dialog-BJjDUqb3.js";var g=e(a(),1),_=c(),v={btw:{label:`btw`,titleKey:`btwTitle`,tone:`bg-primary/10 text-primary border-primary/30`},steer:{label:`steer`,titleKey:`steerTitle`,tone:`bg-warning/10 text-warning border-warning/35`},queue:{label:`queue`,titleKey:`queueTitle`,tone:`bg-info/10 text-info border-info/30`}};function y({open:e,onClose:a,className:c}){let{t:y}=r(),b=t(e=>e.queue),x=t(e=>e.removeQueued),S=t(e=>e.clearQueue),[C,w]=(0,g.useState)(`oldest`),T=(0,g.useCallback)(e=>{x(e)},[x]),E=(0,g.useMemo)(()=>{let e=b.map((e,t)=>({item:e,sourceIdx:t}));return e.sort((e,t)=>C===`newest`?t.item.addedAt-e.item.addedAt:e.item.addedAt-t.item.addedAt),e},[b,C]),D=b.length>0&&b.every(e=>e.alreadyDispatched);return(0,_.jsx)(h,{open:e,onOpenChange:e=>{e||a()},children:(0,_.jsxs)(f,{className:d(`max-w-lg gap-0 overflow-hidden border-border/80 bg-card p-0 pt-[10dvh] flex flex-col max-h-[70dvh]`,c),showCloseButton:!1,children:[(0,_.jsx)(p,{className:`sr-only`,children:y(`activity:queue.heading`)}),(0,_.jsx)(m,{className:`sr-only`,children:y(`activity:queue.subtitle`,{count:b.length})}),(0,_.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/70 bg-card/95 px-4 py-3 shrink-0`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,_.jsx)(`span`,{className:`flex items-center justify-center w-8 h-8 rounded-md border border-primary/20 bg-primary/10 text-primary`,children:(0,_.jsx)(u,{className:`h-4 w-4`})}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h2`,{className:`text-sm font-semibold`,children:y(`activity:queue.heading`)}),(0,_.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:y(`activity:queue.subtitle`,{count:b.length})})]})]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,_.jsxs)(`button`,{type:`button`,onClick:()=>w(e=>e===`newest`?`oldest`:`newest`),className:d(`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs transition-colors font-medium`,`text-muted-foreground hover:bg-muted hover:text-foreground`),title:y(C===`newest`?`activity:queue.sortNewestTitle`:`activity:queue.sortOldestTitle`),"data-testid":`queue-sort-toggle`,children:[C===`newest`?(0,_.jsx)(n,{className:`h-3 w-3`}):(0,_.jsx)(i,{className:`h-3 w-3`}),y(C===`newest`?`activity:queue.newest`:`activity:queue.oldest`)]}),b.length>0&&!D&&(0,_.jsxs)(`button`,{type:`button`,onClick:()=>S(),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs text-destructive hover:bg-destructive/10 transition-colors font-medium`,title:y(`activity:queue.clearDispatchedTitle`),"data-testid":`queue-clear-all`,children:[(0,_.jsx)(s,{className:`h-3 w-3`}),y(`activity:queue.clear`)]})]})]}),(0,_.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:b.length===0?(0,_.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-3 text-muted-foreground`,children:[(0,_.jsx)(u,{className:`h-10 w-10 opacity-15`}),(0,_.jsx)(`p`,{className:`text-sm font-medium`,children:y(`activity:queue.emptyTitle`)}),(0,_.jsx)(`p`,{className:`text-xs text-center max-w-xs`,children:y(`activity:queue.emptyBody`)})]}):(0,_.jsx)(`ul`,{className:`divide-y divide-border/60`,"data-testid":`queue-list`,children:E.map(({item:e,sourceIdx:t},n)=>{let r=v[e.mode],i=e.alreadyDispatched===!0;return(0,_.jsxs)(`li`,{className:d(`flex items-start justify-between gap-3 px-4 py-3 text-xs transition-colors`,i?`bg-muted/30 text-muted-foreground hover:bg-muted/40`:`hover:bg-muted/35`),"data-testid":`queue-item`,"data-dispatched":i?`true`:void 0,children:[(0,_.jsxs)(`div`,{className:`flex items-start gap-3 min-w-0 flex-1`,children:[(0,_.jsxs)(`span`,{className:`mt-1 text-[10px] font-mono text-muted-foreground shrink-0 w-5 text-right tabular-nums`,children:[n+1,`.`]}),(0,_.jsx)(`span`,{className:d(`shrink-0 inline-flex items-center justify-center rounded border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,r.tone,i&&`opacity-60`),title:y(`activity:queue.${r.titleKey}`),"data-testid":`queue-mode-${e.mode}`,children:r.label}),(0,_.jsx)(`p`,{className:`text-sm leading-relaxed min-w-0 break-words flex-1`,children:e.text.length>120?`${e.text.slice(0,117)}…`:e.text}),i&&(0,_.jsxs)(`span`,{className:`shrink-0 mt-0.5 inline-flex items-center gap-1 text-[10px] font-semibold uppercase text-success`,title:y(`activity:queue.dispatchedTitle`),"data-testid":`queue-dispatched-${t}`,children:[(0,_.jsx)(l,{className:`h-3 w-3`}),y(`activity:queue.dispatchedLabel`)]})]}),!i&&(0,_.jsx)(`button`,{type:`button`,onClick:()=>T(t),className:`ml-1 p-1.5 rounded-md shrink-0 hover:bg-destructive/10 hover:text-destructive transition-colors`,title:y(`activity:queue.removeTitle`),"data-testid":`queue-remove-${t}`,children:(0,_.jsx)(o,{className:`h-3.5 w-3.5`})})]},`${e.addedAt}-${t}`)})})}),b.length>0&&(0,_.jsx)(`div`,{className:`border-t border-border/70 bg-muted/20 px-4 py-2.5 shrink-0`,children:(0,_.jsx)(`p`,{className:`text-[10px] text-muted-foreground text-center`,children:y(`activity:queue.footer`)})})]})})}export{y as QueuePanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./chat-store-c0pGYczr.js";import{Ba as n,Ga as r,Ji as i,Ot as a,Pa as o,hn as s,lt as c,nn as l,pn as u,xi as d}from"./vendor-C_zEzV4N.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./chat-store-c0pGYczr.js";import{Ba as n,Ga as r,Ji as i,Ot as a,Pa as o,hn as s,lt as c,nn as l,pn as u,xi as d}from"./vendor-C_zEzV4N.js";import"./i18n-CDoHRskt.js";import{t as f}from"./session-store-BgiP4PnQ.js";import{n as p}from"./ui-store-xx1NssJI.js";var m=e(r(),1),h=c();function g(){let e=f(e=>e.session),{t:r}=n(),c=f.getState().session?.id,g=f(e=>e.projectName),x=f(e=>e.cwd),S=f(e=>e.mode),C=f(e=>e.contextMode),w=f(e=>e.lastVisitedAt),T=t(e=>e.messages),E=t(e=>e.queue.length),D=t(e=>e.boundSessionId),O=p(e=>e.currentView),k=p(e=>e.dockSection),[A,j]=(0,m.useState)([]),M=(0,m.useMemo)(()=>{if(typeof window>`u`)return 0;let e=0;for(let t of[`wrongstack-session`,`wrongstack-chat`,`wrongstack-ui`,`wrongstack-config`]){let n=window.localStorage.getItem(t);typeof n==`string`&&(e+=n.length)}return e},[T.length]),N=typeof window<`u`&&!!window.__wrongstackSessionRehydrated,P=typeof window<`u`&&!!window.__wrongstackChatRehydrated;function F(e,t){j(n=>[{ts:Date.now(),note:e,ok:t},...n].slice(0,20))}function I(){F(r(`activity:refresh.simulatedF5`),!0)}let L=D!==null&&c!==void 0&&D!==c;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)(u,{className:`h-6 w-6 shrink-0 text-primary sm:h-7 sm:w-7`}),r(`activity:refresh.heading`)]}),(0,h.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:r(`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:r(`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)(o,{className:`w-5 h-5`}),r(`activity:refresh.latestSession`)]}),(0,h.jsx)(_,{label:r(`activity:refresh.restoredLocal`),ok:N,extra:c?r(`activity:refresh.sessionIdExtra`,{id:c}):r(`activity:refresh.noSessionYet`)}),(0,h.jsx)(_,{label:r(`activity:refresh.activePointer`),ok:!!e?.id,extra:e?y(e):`null`}),(0,h.jsx)(_,{label:r(`activity:refresh.lastVisited`),ok:w>0,extra:w>0?new Date(w).toISOString():r(`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)(d,{className:`w-5 h-5`}),r(`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)(s,{className:`w-5 h-5`}),r(`activity:refresh.transcriptRehydrate`)]}),(0,h.jsx)(_,{label:r(`activity:refresh.localTranscript`),ok:P&&(T.length>0||D===null),extra:T.length===0?r(`activity:refresh.noMessages`):r(`activity:refresh.messagesExtra`,{count:T.length,queued:E})}),(0,h.jsx)(_,{label:r(`activity:refresh.noBleed`),ok:!L,extra:L?r(`activity:refresh.bleedExtra`,{bound:D??`∅`,active:c??`∅`}):r(`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)(l,{className:`w-5 h-5`}),r(`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??r(`activity:refresh.noneValue`),mono:!0})]}),(0,h.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`activity:refresh.payloadSize`,{count:M})})]}),(0,h.jsxs)(`section`,{className:`space-y-2`,children:[(0,h.jsx)(`h2`,{className:`text-lg font-semibold`,children:r(`activity:refresh.probeLog`)}),A.length===0?(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`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)(i,{className:`w-4 h-4 text-success shrink-0`}):(0,h.jsx)(a,{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)(i,{className:`h-4 w-4 shrink-0`}):(0,h.jsx)(a,{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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,lt as r}from"./vendor-C_zEzV4N.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,lt as r}from"./vendor-C_zEzV4N.js";import"./i18n-CDoHRskt.js";import{t as i}from"./utils-tsZEnrBH.js";import{t as a}from"./button-DvpRpKkt.js";import{t as o}from"./input-BtoHcCl9.js";import{o as s}from"./index-BRJ_UrGk.js";var c=e(n(),1),l=r(),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}=t(),[n,r]=(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();r(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(!n){j(`No project identity available yet.`);return}k(!0),j(null),N(null);try{let t=await fetch(`/api/projects/${encodeURIComponent(n)}/requirement-intakes`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectId:n,requestedBy:`webui`,originalRequest:e,...S.trim()?{title:S.trim()}:{},...w===`unspecified`?{}:{requestType:w},...E===`unspecified`?{}:{priority:E}})}),r=await t.json().catch(()=>null);if(!t.ok||!r?.record)throw Error(r?.error?.message??`Create failed (HTTP ${t.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,n,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{Ba as t,Ga as n,bt as r,dr as i,lt as a}from"./vendor-C_zEzV4N.js";import"./i18n-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MemoryManager-l0R8JBzL.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-C_zEzV4N.js","assets/monaco-BCqJp2xW.js","assets/monaco-Bowa0-zp.css","assets/markdown-CIRD7kOg.js","assets/vendor-BMdWcCR4.css","assets/i18n-CDoHRskt.js","assets/activity-fdbTRXeg.js","assets/chat-CzaGXz_W.js","assets/commandPalette-BovBiPec.js","assets/common-BBHmIHQW.js","assets/settings-CbtB0i7o.js","assets/setup-DfcCCvUO.js","assets/toasts-DOfXc7Rt.js","assets/useWebSocket-BFFntyS4.js","assets/chat-store-c0pGYczr.js","assets/utils-tsZEnrBH.js","assets/ws-client-B3MVz75-.js","assets/session-store-BgiP4PnQ.js","assets/codemap-activity-store-BH7Mh4k9.js","assets/stores-DSGsI875.js","assets/mailbox-store-bF96Ih2G.js","assets/ui-store-xx1NssJI.js","assets/view-navigation-CZKugncK.js","assets/codemap-index-store-BFm1TzVW.js","assets/Toaster-wXvKXbbS.js","assets/dialog-BJjDUqb3.js","assets/button-DvpRpKkt.js","assets/input-BtoHcCl9.js","assets/index-BRJ_UrGk.js","assets/ConfirmModal-LBZaZgsG.js","assets/ModelPicker-DC-XCx0f.js","assets/index-BRs425Ir.css","assets/roster-ws-CK52jAnG.js","assets/shared-B3czc2Dj.js","assets/MemoryDrawer-Cw1IiFCO.js","assets/AudienceMemoryPanel-putWTq5V.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,bt as r,dr as i,lt as a}from"./vendor-C_zEzV4N.js";import"./i18n-CDoHRskt.js";import{s as o}from"./monaco-BCqJp2xW.js";import{t as s}from"./utils-tsZEnrBH.js";import{C as c,E as l,T as u,w as d}from"./index-BRJ_UrGk.js";var f=e(n(),1),p=a(),m=(0,f.lazy)(()=>o(()=>import(`./MemoryManager-l0R8JBzL.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,31,32,33,34,35,36]))),h=(0,f.lazy)(()=>o(()=>import(`./AudienceMemoryPanel-putWTq5V.js`).then(e=>({default:e.AudienceMemoryPanel})),__vite__mapDeps([37,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,35])));function g({label:e}){return(0,p.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,p.jsxs)(`span`,{className:`font-mono uppercase tracking-wide`,children:[e,`…`]})})}var _=[{value:`all`,label:`activity:memoryManager.tabAllMemories`,hint:`activity:memoryManager.tabAllMemoriesHint`,Icon:i},{value:`audience`,label:`activity:memoryManager.tabAudience`,hint:`activity:memoryManager.tabAudienceHint`,Icon:r}];function v({defaultValue:e=`all`}={}){let{t:n}=t();return(0,p.jsxs)(c,{defaultValue:e,className:`flex h-full min-h-0 min-w-0 flex-1 flex-col`,children:[(0,p.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,p.jsx)(u,{"aria-label":n(`activity:memoryManager.lensesAria`),className:`h-9 bg-muted/40 p-1 shadow-none`,children:_.map(({value:e,label:t,hint:r,Icon:i})=>(0,p.jsxs)(l,{value:e,className:s(`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,p.jsx)(i,{className:`size-3.5`}),(0,p.jsx)(`span`,{children:n(t)}),(0,p.jsx)(`span`,{className:`hidden font-mono text-[9px] font-normal normal-case text-muted-foreground sm:inline`,children:n(r)})]},e))})}),(0,p.jsx)(d,{value:`all`,className:`mt-0 flex-1 overflow-hidden ring-offset-0 focus-visible:ring-0`,children:(0,p.jsx)(f.Suspense,{fallback:(0,p.jsx)(g,{label:n(`activity:memoryManager.loadingSage`)}),children:(0,p.jsx)(m,{})})}),(0,p.jsx)(d,{value:`audience`,className:`mt-0 flex-1 overflow-hidden ring-offset-0 focus-visible:ring-0`,children:(0,p.jsx)(f.Suspense,{fallback:(0,p.jsx)(g,{label:n(`activity:memoryManager.loadingAudience`)}),children:(0,p.jsx)(h,{})})})]})}export{v as SageTabs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,En as n,Ga as r,Mr as i,Ot as a,Pr as o,Qt as s,Ut as c,_ as l,a as u,c as d,dt as f,f as p,h as m,i as h,lt as g,mn as _,or as v,qi as y,r as b,ra as x,s as S,u as C,ua as w,vr as T,ya as E}from"./vendor-C_zEzV4N.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,En as n,Ga as r,Mr as i,Ot as a,Pr as o,Qt as s,Ut as c,_ as l,a as u,c as d,dt as f,f as p,h as m,i as h,lt as g,mn as _,or as v,qi as y,r as b,ra as x,s as S,u as C,ua as w,vr as T,ya as E}from"./vendor-C_zEzV4N.js";import"./i18n-CDoHRskt.js";import{t as D}from"./utils-tsZEnrBH.js";var O=e(r(),1),k=g();function A({pct:e}){let{t:n}=t(),r=(0,O.useId)(),i=2*Math.PI*26,a=i-Math.max(0,Math.min(100,e))/100*i;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":n(`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(#${r})`,strokeWidth:`6`,strokeLinecap:`round`,strokeDasharray:i,strokeDashoffset:a,style:{transition:`stroke-dashoffset 0.6s cubic-bezier(0.16,1,0.3,1)`}}),(0,k.jsx)(`defs`,{children:(0,k.jsxs)(`linearGradient`,{id:r,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:y,text:`text-muted-foreground`,ring:`border-border/70 bg-muted/45`,dot:`bg-muted-foreground`,hex:`hsl(var(--muted-foreground))`},queued:{label:`Ready`,icon:y,text:`text-primary`,ring:`border-primary/35 bg-primary/10`,dot:`bg-primary`,hex:`hsl(var(--primary))`},in_progress:{label:`Running`,icon:v,spin:!0,text:`text-warning`,ring:`border-warning/45 bg-warning/10`,dot:`bg-warning`,hex:`hsl(var(--warning))`},blocked:{label:`Blocked`,icon:y,text:`text-destructive`,ring:`border-destructive/30 bg-destructive/10`,dot:`bg-destructive`,hex:`hsl(var(--destructive))`},review:{label:`Review`,icon:y,text:`text-primary`,ring:`border-primary/35 bg-primary/10`,dot:`bg-primary`,hex:`hsl(var(--info))`},failed:{label:`Failed`,icon:f,text:`text-destructive`,ring:`border-destructive/45 bg-destructive/10`,dot:`bg-destructive`,hex:`hsl(var(--destructive))`},completed:{label:`Done`,icon:x,text:`text-success`,ring:`border-success/35 bg-success/10`,dot:`bg-success`,hex:`hsl(var(--success))`},cancelled:{label:`Cancelled`,icon:E,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:n,color:`text-warning`},completed:{icon:x,color:`text-success`},failed:{icon:f,color:`text-destructive`},retrying:{icon:_,color:`text-warning`},wave:{icon:T,color:`text-primary`},deadlock:{icon:a,color:`text-destructive`},verification_failed:{icon:s,color:`text-destructive`},conflict:{icon:i,color:`text-warning`},split:{icon:c,color:`text-primary`},supervisor:{icon:w,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 n=e.task,{t:r}=t(),i=W[n.displayStatus],a=n.displayStatus===`in_progress`,s=n.displayStatus===`completed`?x:n.displayStatus===`failed`?f:a?v:y;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`,n.displayStatus===`completed`&&`sdd-node-complete`,n.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":r(`activity:sdd.openTask`,{title:n.title,defaultValue:`Open task: ${n.title}`}),className:`absolute inset-0 z-10 cursor-pointer rounded-lg`,onClick:()=>e.onTaskClick?.(n.id)}),(0,k.jsx)(S,{type:`target`,position:l.Left,isConnectable:!1,className:`!h-1.5 !w-1.5 !border-0 !bg-border`}),(0,k.jsx)(S,{type:`source`,position:l.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)(s,{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:n.shortId}),(0,k.jsx)(`span`,{className:D(`font-mono text-[10px] font-bold uppercase`,P(n.priority).text),children:n.priority[0]}),(0,k.jsx)(`span`,{className:D(`ml-auto rounded px-1.5 py-px text-[9px] font-medium`,i.chip),children:r(`activity:sdd.status.${n.displayStatus}`)})]}),(0,k.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[11px] leading-snug text-foreground`,children:n.title}),(n.agentName||n.worktreeBranch)&&(0,k.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[n.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(n.agentName)}),(0,k.jsx)(`span`,{className:`max-w-[88px] truncate text-[10px] text-muted-foreground`,children:n.agentName})]}),n.retries?(0,k.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-destructive`,children:[(0,k.jsx)(_,{className:`h-2.5 w-2.5`}),n.retries]}):null,n.worktreeBranch&&(0,k.jsxs)(`span`,{className:`ml-auto flex items-center gap-0.5 text-[9px] text-muted-foreground`,title:n.worktreeBranch,children:[(0,k.jsx)(o,{className:`h-2.5 w-2.5`}),(0,k.jsx)(`span`,{className:`max-w-[70px] truncate`,children:n.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}=m(),{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)(p,{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)(b,{variant:h.Dots,gap:22,size:1,color:`hsl(var(--border))`}),(0,k.jsx)(u,{showInteractive:!1,className:`!bottom-2 !left-2`}),(0,k.jsx)(d,{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)(C,{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{$n as t,Ba as n,Bt as r,Ci as i,Ct as a,Ea as o,En as s,Et as c,Ga as l,Gt as u,Ji as d,Ni as f,Nt as p,Ot as m,Pa as h,Pr as g,Pt as _,Qr as v,Ti as y,Ua as b,Ut as ee,Vn as te,Wt as x,dt as S,ea as C,gi as w,gn as T,ia as E,in as D,jn as O,jt as k,lt as A,ma as j,mn as ne,mr as M,na as re,or as N,qn as P,ra as F,ut as I,xt as ie,zi as L}from"./vendor-C_zEzV4N.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$n as t,Ba as n,Bt as r,Ci as i,Ct as a,Ea as o,En as s,Et as c,Ga as l,Gt as u,Ji as d,Ni as f,Nt as p,Ot as m,Pa as h,Pr as g,Pt as _,Qr as v,Ti as y,Ua as b,Ut as ee,Vn as te,Wt as x,dt as S,ea as C,gi as w,gn as T,ia as E,in as D,jn as O,jt as k,lt as A,ma as j,mn as ne,mr as M,na as re,or as N,qn as P,ra as F,ut as I,xt as ie,zi as L}from"./vendor-C_zEzV4N.js";import"./i18n-CDoHRskt.js";import{t as ae}from"./useWebSocket-BFFntyS4.js";import{t as R}from"./utils-tsZEnrBH.js";import{c as z,p as B,s as V}from"./stores-DSGsI875.js";import{n as oe}from"./ui-store-xx1NssJI.js";import{o as H}from"./view-navigation-CZKugncK.js";import{a as se,i as ce,n as U,o as W,r as le,t as G}from"./dialog-BJjDUqb3.js";import{t as K}from"./button-DvpRpKkt.js";import{n as ue,t as q}from"./ModelPicker-DC-XCx0f.js";import{c as J,s as de}from"./index-BRJ_UrGk.js";import{a as Y,c as fe,i as X,l as pe,n as me,o as he,r as ge,s as _e,t as ve,u as ye}from"./SddFlowGraph-DdYgCVM_.js";import{SpecsView as be}from"./SpecsView-BAnFfPPH.js";var Z=e(l(),1),Q=A();function xe({feed:e,now:t}){let{t:r}=n();return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,Q.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,Q.jsx)(h,{className:`h-3.5 w-3.5 text-warning`}),r(`activity:sdd.activityHeading`)]}),(0,Q.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,Q.jsx)(`p`,{className:`px-1 pt-4 text-center text-[11px] text-muted-foreground`,children:r(`activity:sdd.feedEmpty`)}):e.map((e,n)=>{let r=ge[e.kind]??ge.started,i=r.icon;return(0,Q.jsxs)(`div`,{className:R(`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,Q.jsx)(i,{className:R(`mt-0.5 h-3.5 w-3.5 shrink-0`,r.color)}),(0,Q.jsx)(`span`,{className:`flex-1 leading-snug text-foreground`,children:e.text}),(0,Q.jsx)(`span`,{className:`shrink-0 tabular-nums text-[10px] text-muted-foreground`,children:he(e.ts,t)})]},`${e.ts}-${n}`)})})]})}function Se({open:e,onOpenChange:t,snapshot:r,busy:i,onConfirm:a}){let{t:o}=n(),s=r?.mergedCommits?.length??0,c=r?.baseBranch,[l,u]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{e&&u(!1)},[e]);let d=r?.status===`running`||r?.status===`paused`,f=(0,Z.useMemo)(()=>{let e=new Set;for(let t of r?.tasks??[])t.worktreeBranch&&e.add(t.worktreeBranch);return e.size},[r?.tasks]),p=(0,Z.useMemo)(()=>{let e=new Set;for(let t of r?.tasks??[])t.displayStatus===`in_progress`&&t.agentName&&e.add(t.agentName);return e.size},[r?.tasks]);return(0,Q.jsx)(G,{open:e,onOpenChange:e=>!i&&t(e),children:(0,Q.jsxs)(U,{className:`sm:max-w-lg border-destructive/50`,children:[(0,Q.jsxs)(se,{children:[(0,Q.jsxs)(W,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(k,{className:`h-5 w-5 text-destructive`}),o(`activity:sdd.destroyTitle`)]}),(0,Q.jsx)(le,{children:o(`activity:sdd.destroyDesc`)})]}),(0,Q.jsxs)(`ul`,{className:`space-y-1.5 py-1 text-sm`,children:[d&&(0,Q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,Q.jsx)(`span`,{children:p>0?o(`activity:sdd.stopRunAgents`,{count:p}):o(`activity:sdd.stopRun`)})]}),(0,Q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,Q.jsx)(`span`,{children:f>0?o(`activity:sdd.removeWorktreesCount`,{count:f}):o(`activity:sdd.removeWorktreesAll`)})]}),(0,Q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,Q.jsx)(`span`,{children:o(`activity:sdd.deleteArtifacts`)})]})]}),s>0&&(0,Q.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,Q.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked),className:`mt-0.5 h-4 w-4 accent-warning`}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:o(`activity:sdd.revertMerged`,{count:s})}),` `,`on `,(0,Q.jsx)(`code`,{className:`text-xs`,children:c??o(`activity:sdd.baseBranchFallback`)}),(0,Q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:o(`activity:sdd.revertHint`)})]})]}),(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md bg-muted/50 p-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(m,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-warning`}),o(s>0&&!l?`activity:sdd.noteLeaveMerged`:`activity:sdd.noteAbandon`)]}),(0,Q.jsxs)(ce,{className:`gap-2 sm:gap-2`,children:[(0,Q.jsx)(K,{variant:`outline`,size:`sm`,disabled:i,onClick:()=>t(!1),children:o(`common:action.cancel`)}),(0,Q.jsx)(K,{size:`sm`,disabled:i,onClick:()=>a(l),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{className:`mr-1 h-3.5 w-3.5 animate-spin`}),` `,o(`activity:sdd.destroying`)]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{className:`mr-1 h-3.5 w-3.5`}),` `,o(`activity:sdd.destroyAll`)]})})]})]})})}var Ce=[{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 we({tasks:e,selectedId:t,onTaskClick:r}){let{t:i}=n(),a=(0,Z.useMemo)(()=>{let t=new Map;for(let e of Ce)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,Q.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 gap-3 overflow-x-auto p-4`,children:Ce.map(e=>{let n=a.get(e.key)??[];return(0,Q.jsxs)(`div`,{className:`flex min-h-0 w-64 shrink-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:R(`mb-2 flex items-center gap-2 border-b-2 pb-1.5`,e.accent),children:[(0,Q.jsx)(`span`,{className:R(`text-xs font-bold uppercase tracking-wide`,e.head),children:i(`activity:sdd.${e.labelKey}`)}),(0,Q.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 text-[10px] text-muted-foreground`,children:n.length})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain pr-1`,children:[n.map(e=>(0,Q.jsx)(Te,{task:e,selected:e.id===t,onClick:()=>r(e.id)},e.id)),n.length===0&&(0,Q.jsx)(`div`,{className:`rounded-md border border-dashed border-border py-6 text-center text-[10px] text-muted-foreground`,children:i(`activity:sdd.kanbanEmpty`)})]})]},e.key)})})}function Te({task:e,selected:t,onClick:n}){let r=e.displayStatus===`in_progress`;return(0,Q.jsxs)(`button`,{type:`button`,onClick:n,className:R(`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,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[r&&(0,Q.jsx)(N,{className:`h-3 w-3 animate-spin text-warning`}),e.displayStatus===`completed`&&(0,Q.jsx)(F,{className:`h-3 w-3 text-success`}),e.displayStatus===`failed`&&(0,Q.jsx)(S,{className:`h-3 w-3 text-destructive`}),(0,Q.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:e.shortId}),(0,Q.jsx)(`span`,{className:R(`ml-auto rounded px-1.5 text-[9px] font-bold uppercase`,fe(e.priority).chip),children:e.priority})]}),(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[11px] leading-snug text-foreground`,children:e.title}),(e.agentName||e.worktreeBranch||e.retries)&&(0,Q.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[e.agentName&&(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`span`,{className:R(`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:Y(e.agentName)}),(0,Q.jsx)(`span`,{className:`max-w-[80px] truncate text-[10px] text-muted-foreground`,children:e.agentName})]}),e.retries?(0,Q.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-destructive`,children:[(0,Q.jsx)(ne,{className:`h-2.5 w-2.5`}),e.retries]}):null,e.worktreeBranch&&(0,Q.jsx)(g,{className:`ml-auto h-2.5 w-2.5 text-muted-foreground`})]})]})}function Ee({task:e,allTasks:i,feed:s,now:c,expanded:l,modelCandidates:u,defaultModel:d,onClose:p,onToggleExpanded:m,onRetry:h,onReassign:_,onSetModel:v,onSetVerification:y,onCancel:b,onDelete:te,onSplit:x,onSelectTask:C}){let{t:w}=n(),T=pe(e.displayStatus),E=T.icon,D=e.displayStatus===`in_progress`,O=e.displayStatus===`pending`||e.displayStatus===`blocked`||e.displayStatus===`queued`,[A,j]=(0,Z.useState)(!1),[M,re]=(0,Z.useState)(``),[N,I]=(0,Z.useState)(null),[ie,L]=(0,Z.useState)(!1),[ae,z]=(0,Z.useState)(``),[B,V]=(0,Z.useState)(!1),[oe,H]=(0,Z.useState)(e.verificationCommand??``),se=()=>{M.trim()&&(_(e.id,M.trim()),j(!1),re(``))},ce=()=>{let t=ae.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&&(x(e.id,t),L(!1),z(``))},U=(0,Z.useMemo)(()=>new Map(i.map(e=>[e.shortId,e])),[i]),W=(0,Z.useMemo)(()=>i.filter(t=>t.deps.includes(e.shortId)),[i,e.shortId]),le=(0,Z.useMemo)(()=>s.filter(t=>t.taskId===e.id||t.taskShortId===e.shortId),[s,e.id,e.shortId]),G=e.startedAt&&!e.completedAt?_e(c-e.startedAt):e.startedAt&&e.completedAt?_e(e.completedAt-e.startedAt):null;return(0,Q.jsxs)(`div`,{className:`sdd-rise flex h-full min-h-0 min-w-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:R(`flex items-center gap-2 border-b border-border/70 bg-card/70 px-3 py-2`,l&&`px-5 py-3`),children:[(0,Q.jsx)(`button`,{type:`button`,onClick:p,className:`text-muted-foreground hover:text-foreground`,title:w(`activity:sddTask.backTitle`),children:(0,Q.jsx)(o,{className:`h-4 w-4`})}),(0,Q.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),m&&(0,Q.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:w(l?`activity:sddTask.collapseTitle`:`activity:sddTask.expandTitle`),"aria-label":w(l?`activity:sddTask.collapseTitle`:`activity:sddTask.expandTitle`),"aria-pressed":l,children:l?(0,Q.jsx)(P,{className:`h-4 w-4`}):(0,Q.jsx)(t,{className:`h-4 w-4`})}),(0,Q.jsxs)(`span`,{className:R(`ml-auto flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px]`,T.ring,T.text),children:[(0,Q.jsx)(E,{className:R(`h-3 w-3`,D&&`animate-spin`)}),T.label]})]}),(0,Q.jsxs)(`div`,{className:R(`min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain`,l?`grid grid-cols-2 content-start gap-4 p-5`:`space-y-3 p-3`),children:[(0,Q.jsx)(`h3`,{className:R(`text-sm font-semibold leading-snug text-foreground`,l&&`col-span-2 text-lg`),children:e.title}),e.agentName&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/70 bg-muted/45 p-2`,children:[(0,Q.jsx)(`span`,{className:R(`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:Y(e.agentName)}),(0,Q.jsxs)(`div`,{className:`leading-tight`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:e.agentName}),(0,Q.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:w(D?`activity:sddTask.workingOn`:`activity:sddTask.assigned`)})]})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-1.5 text-[11px]`,children:[(0,Q.jsx)(Oe,{label:w(`activity:sddTask.metaPriority`),children:(0,Q.jsx)(`span`,{className:R(`font-medium uppercase`,fe(e.priority).text),children:e.priority})}),(0,Q.jsx)(Oe,{label:w(`activity:sddTask.metaType`),children:e.type}),G&&(0,Q.jsx)(Oe,{label:e.completedAt?w(`activity:sddTask.metaDuration`):w(`activity:sddTask.metaElapsed`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(f,{className:`h-3 w-3 text-muted-foreground`}),G]})}),e.retries?(0,Q.jsx)(Oe,{label:w(`activity:sddTask.metaRetries`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 text-destructive`,children:[(0,Q.jsx)(ne,{className:`h-3 w-3`}),e.retries]})}):null,e.worktreeBranch&&(0,Q.jsx)(Oe,{label:w(`activity:sddTask.metaWorktree`),full:!0,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 font-mono text-foreground`,title:e.worktreeBranch,children:[(0,Q.jsx)(g,{className:`h-3 w-3 text-muted-foreground`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.worktreeBranch})]})})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[w(`activity:sddTask.workerModel`),!e.model&&d&&(0,Q.jsxs)(`span`,{className:`font-normal normal-case text-muted-foreground`,children:[`· `,w(`activity:sddTask.runDefault`,{model:d})]})]}),(0,Q.jsx)(q,{value:e.model,provider:e.provider,candidates:u,placeholder:d?w(`activity:sddTask.runDefaultPlaceholderModel`,{model:d}):w(`activity:sddTask.runDefaultPlaceholder`),onPick:(t,n)=>v(e.id,t,n),onReset:e.model?()=>v(e.id,void 0,void 0):void 0}),e.fallbackModels&&e.fallbackModels.length>0&&(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:e.fallbackModels.map(e=>(0,Q.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`↳ `,e]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[w(`activity:sddTask.verificationCmd`),(0,Q.jsxs)(`span`,{className:`font-normal normal-case text-muted-foreground`,children:[`· `,w(`activity:sddTask.gatesCompletion`)]})]}),B?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`input`,{value:oe,onChange:e=>H(e.target.value),onKeyDown:t=>{t.key===`Enter`?(y(e.id,oe.trim()||void 0),V(!1)):t.key===`Escape`&&(H(e.verificationCommand??``),V(!1))},placeholder:w(`activity:sddTask.verifyPlaceholder`),className:`w-full rounded border border-border bg-background px-2 py-1 font-mono text-[11px] text-foreground`}),(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{y(e.id,oe.trim()||void 0),V(!1)},className:`rounded bg-primary px-2 py-0.5 text-[10px] text-primary-foreground hover:opacity-90`,children:w(`common:action.save`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{H(e.verificationCommand??``),V(!1)},className:`rounded bg-muted px-2 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:w(`common:action.cancel`)})]})]}):e.verificationCommand?(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.verificationState&&(0,Q.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,Q.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,Q.jsx)(`button`,{type:`button`,onClick:()=>V(!0),className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:w(`common:action.edit`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>y(e.id,void 0),className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:w(`common:action.clear`)})]}):(0,Q.jsx)(`button`,{type:`button`,onClick:()=>V(!0),className:`rounded border border-dashed border-border px-2 py-1 text-[10px] text-muted-foreground hover:bg-muted`,children:w(`activity:sddTask.addVerify`)})]}),e.description&&(0,Q.jsxs)(`div`,{className:R(l&&`col-span-2`),children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:w(`activity:sddTask.description`)}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap rounded-md bg-muted p-2 text-[11px] leading-relaxed text-foreground`,children:e.description})]}),(0,Q.jsx)(De,{events:le,expanded:l}),e.deps.length>0&&(0,Q.jsx)($,{title:w(`activity:sddTask.dependsOn`),shortIds:e.deps,byShort:U,onSelectTask:C}),W.length>0&&(0,Q.jsx)($,{title:w(`activity:sddTask.blocks`),shortIds:W.map(e=>e.shortId),byShort:U,onSelectTask:C})]}),(0,Q.jsxs)(`div`,{className:R(`border-t border-border p-2`,l&&`px-5 py-3`),children:[A?(0,Q.jsxs)(`div`,{className:`sdd-rise flex items-center gap-1.5`,children:[(0,Q.jsx)(`input`,{value:M,onChange:e=>re(e.target.value),onKeyDown:e=>{e.key===`Enter`&&se(),e.key===`Escape`&&j(!1)},placeholder:w(`activity:sddTask.newWorkerPlaceholder`),className:`min-w-0 flex-1 rounded-md border border-border/70 bg-background px-2 py-1.5 text-xs outline-none focus:border-primary/60`}),(0,Q.jsx)(`button`,{type:`button`,onClick:se,disabled:!M.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,Q.jsx)(F,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>j(!1),className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,Q.jsx)(S,{className:`h-3.5 w-3.5`})})]}):N?(0,Q.jsxs)(`div`,{className:`sdd-rise flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`flex-1 text-xs text-foreground`,children:w(N===`stop`?`activity:sddTask.confirmStop`:`activity:sddTask.confirmDelete`)}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{N===`stop`?b(e.id):te(e.id),I(null)},className:`inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,Q.jsx)(F,{className:`h-3.5 w-3.5`}),` `,w(N===`stop`?`common:action.stop`:`common:action.delete`)]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>I(null),className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,Q.jsx)(S,{className:`h-3.5 w-3.5`})})]}):(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>h(e.id),title:w(`activity:sddTask.retryTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-warning/12 py-1.5 text-xs font-medium text-warning hover:bg-warning/18`,children:[(0,Q.jsx)(ne,{className:`h-3.5 w-3.5`}),` `,w(`common:action.retry`)]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>j(!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,Q.jsx)(a,{className:`h-3.5 w-3.5`}),` `,w(`activity:sddTask.reassign`)]}),D&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>I(`stop`),title:w(`activity:sddTask.stopTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-destructive/10 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,Q.jsx)(r,{className:`h-3.5 w-3.5`}),` `,w(`common:action.stop`)]}),!D&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>L(!0),title:w(`activity:sddTask.splitTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-primary/10 py-1.5 text-xs font-medium text-primary hover:bg-primary/15`,children:[(0,Q.jsx)(ee,{className:`h-3.5 w-3.5`}),` `,w(`activity:sddTask.split`)]}),O&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>I(`delete`),title:w(`activity:sddTask.deleteTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-destructive/10 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,Q.jsx)(k,{className:`h-3.5 w-3.5`}),` `,w(`common:action.delete`)]})]}),ie&&(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2`,children:[(0,Q.jsx)(`label`,{className:`text-[11px] text-muted-foreground`,htmlFor:`sdd-split-input`,children:w(`activity:sddTask.splitHint`)}),(0,Q.jsx)(`textarea`,{id:`sdd-split-input`,rows:3,value:ae,onChange:e=>z(e.target.value),placeholder:w(`activity:sddTask.splitPlaceholder`),className:`w-full resize-y rounded-md border border-border/70 bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-ring`}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:ce,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,Q.jsx)(ee,{className:`h-3.5 w-3.5`}),` `,w(`activity:sddTask.splitInto`)]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{L(!1),z(``)},className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,Q.jsx)(S,{className:`h-3.5 w-3.5`})})]})]})]})]})}function De({events:e,expanded:t}){let{t:r}=n();return(0,Q.jsxs)(`section`,{className:R(`rounded-lg border border-border/70 bg-background/45`,t&&`col-span-2`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/60 px-3 py-2.5`,children:[(0,Q.jsx)(h,{className:`h-4 w-4 text-primary`}),(0,Q.jsx)(`h4`,{className:`text-xs font-semibold text-foreground`,children:r(`activity:sddTask.eventLog`)}),(0,Q.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[10px] text-muted-foreground`,children:e.length}),(0,Q.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:r(`activity:sddTask.newestFirst`)})]}),e.length===0?(0,Q.jsx)(`p`,{className:`px-3 py-5 text-center text-[11px] text-muted-foreground`,children:r(`activity:sddTask.noEvents`)}):(0,Q.jsx)(`div`,{className:R(`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?v:r?p:h;return(0,Q.jsxs)(`div`,{className:R(`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,Q.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,Q.jsx)(a,{className:R(`mt-0.5 h-3.5 w-3.5`,i?`text-destructive`:n?`text-info`:r?`text-warning`:`text-primary`)}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[e.action&&(0,Q.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,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.agentName}),e.durationMs!==void 0&&(0,Q.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,Q.jsx)(`code`,{className:`mt-1 block break-all font-mono text-[10px] leading-relaxed text-foreground`,children:e.filePath}):e.detail?(0,Q.jsx)(`code`,{className:`mt-1 block break-words font-mono text-[10px] leading-relaxed text-muted-foreground`,children:e.detail}):(0,Q.jsx)(`p`,{className:`mt-1 break-words leading-relaxed text-foreground`,children:e.text})]})]},`${e.ts}-${e.kind}-${t}`)})})]})}function Oe({label:e,children:t,full:n}){return(0,Q.jsxs)(`div`,{className:R(`rounded-md border border-border bg-muted/50 px-2 py-1`,n&&`col-span-2`),children:[(0,Q.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide text-muted-foreground`,children:e}),(0,Q.jsx)(`div`,{className:`text-foreground`,children:t})]})}function $({title:e,shortIds:t,byShort:n,onSelectTask:r}){return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map(e=>{let t=n.get(e);return(0,Q.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,Q.jsx)(`span`,{className:R(`h-1.5 w-1.5 rounded-full`,pe(t?.displayStatus??`pending`).dot)}),(0,Q.jsx)(`span`,{className:`font-mono`,children:e})]},e)})})]})}function ke({onClose:e}){let{t}=n(),{client:a}=ae(),o=z(e=>e.snapshot),l=z(e=>e.lifecycleResult),u=z(e=>e.destroying),d=z(e=>e.setDestroying),f=z(e=>e.setLifecycleResult),[p,g]=(0,Z.useState)(()=>Date.now()),[_,v]=(0,Z.useState)(null),[y,b]=(0,Z.useState)(!1),[ee,te]=(0,Z.useState)(`graph`),[x,C]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{a?.send?.({type:`sdd.board.get`})},[a]);let T=o&&(o.status===`running`||o.status===`paused`);(0,Z.useEffect)(()=>{if(!T)return;let e=setInterval(()=>g(Date.now()),1e3);return g(Date.now()),()=>clearInterval(e)},[T]);let E=(0,Z.useCallback)(e=>a?.send?.(e),[a]),D=(0,Z.useRef)(null),A=(0,Z.useCallback)(e=>{D.current=null,E({type:`sdd.board.destroy`,payload:{revertMerged:e}})},[E]),j=(0,Z.useCallback)(e=>{C(!1),f(null),d(!0),T?(E({type:`sdd.board.stop`,payload:{}}),D.current={revertMerged:e,deadline:Date.now()+5e3}):A(e)},[T,E,A,d,f]);(0,Z.useEffect)(()=>{let e=D.current;if(!e)return;if(!T||Date.now()>=e.deadline){A(e.revertMerged);return}let t=setTimeout(()=>{let e=D.current;e&&A(e.revertMerged)},Math.max(0,e.deadline-Date.now()));return()=>clearTimeout(t)},[T,o,A]);let M=(0,Z.useCallback)(()=>{f(null),E({type:`sdd.board.cleanup_worktrees`,payload:{}})},[E,f]),re=(0,Z.useCallback)(()=>{f(null),E({type:`sdd.board.rollback`,payload:{}})},[E,f]),N=(0,Z.useMemo)(()=>(o?.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})),[o?.tasks]),P=(0,Z.useMemo)(()=>{let e=new Map;for(let t of o?.tasks??[])t.displayStatus===`in_progress`&&t.agentName&&e.set(t.agentName,{name:t.agentName,task:t.title});return[...e.values()]},[o?.tasks]),F=(0,Z.useCallback)(e=>v(e),[]),ie=(0,Z.useCallback)(()=>{v(null),b(!1)},[]),L=(0,Z.useCallback)(e=>E({type:`sdd.board.retry`,payload:{taskId:e}}),[E]),V=(0,Z.useCallback)(()=>E({type:`sdd.board.retry_all_failed`,payload:{}}),[E]),H=(0,Z.useCallback)((e,t)=>{let n=t.trim();n&&E({type:`sdd.board.reassign`,payload:{taskId:e,agentName:n}})},[E]),se=(0,Z.useCallback)((e,t,n)=>E({type:`sdd.board.set_task_model`,payload:{taskId:e,model:t,provider:n}}),[E]),ce=(0,Z.useCallback)((e,t)=>E({type:`sdd.board.set_task_verification`,payload:{taskId:e,verificationCommand:t}}),[E]),U=(0,Z.useCallback)(e=>E({type:`sdd.board.cancel_task`,payload:{taskId:e}}),[E]),W=(0,Z.useCallback)(e=>{E({type:`sdd.board.delete_task`,payload:{taskId:e}}),v(null),b(!1)},[E]),le=(0,Z.useCallback)((e,t)=>{E({type:`sdd.board.split_task`,payload:{taskId:e,subtasks:t}}),v(null),b(!1)},[E]),G=ue(_!==null),q=(0,Z.useMemo)(()=>o?.tasks.find(e=>e.id===_)??null,[o?.tasks,_]),J=o?.progress,de=o?.diagnostics?.deadlockChains??[];return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,Q.jsxs)(`header`,{className:`sdd-sheen shrink-0 border-b border-border px-4 pb-3 pt-2.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(h,{className:`h-5 w-5 text-warning`}),(0,Q.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:o?.title??t(`activity:sddBoard.titleFallback`)}),o&&(0,Q.jsx)(`span`,{className:R(`rounded-full border px-2 py-0.5 text-[11px] font-medium capitalize`,X[o.status]??X.idle),children:o.status}),o?.defaultModel&&(0,Q.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,Q.jsx)(i,{className:`h-3 w-3 text-primary`}),o.defaultModel]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o&&(0,Q.jsxs)(`button`,{type:`button`,title:t(`activity:sddBoardView.openTheMirroredKanbanBoardSForThisRunOnePerDependencyWave`),onClick:()=>{let e=`run:${o.runId}`,t=B.getState().boards.filter(t=>t.tags?.includes(e)),n=t.find(e=>e.tags?.includes(`phase:wave-0`))??t[0];n&&(B.getState().setActiveBoardId(n.id),a?.send?.({type:`kanban.get`,payload:{boardId:n.id}})),oe.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,Q.jsx)(h,{className:`h-3.5 w-3.5`}),` Kanban`]}),o&&(0,Q.jsx)(`div`,{className:`flex items-center rounded-md border border-border bg-muted p-0.5 text-[11px]`,children:[`graph`,`kanban`].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>te(e),className:R(`rounded px-2 py-0.5 capitalize transition`,ee===e?`bg-primary/12 text-primary`:`text-muted-foreground hover:text-foreground`),children:t(e===`graph`?`activity:sddBoard.graphLabel`:`activity:sddBoard.kanbanLabel`)},e))}),T&&(J?.failed??0)>0&&(0,Q.jsxs)(`button`,{type:`button`,onClick:V,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,Q.jsx)(ne,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.retryFailed`,{count:J?.failed??0})]}),T&&(0,Q.jsxs)(Q.Fragment,{children:[o?.status===`paused`?(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>E({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,Q.jsx)(s,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.resume`)]}):(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>E({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,Q.jsx)(O,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.pause`)]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>E({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,Q.jsx)(r,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.stop`)]})]}),o&&!T&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:M,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,Q.jsx)(w,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.cleanWorktrees`)]}),(o.mergedCommits?.length??0)>0&&(0,Q.jsxs)(`button`,{type:`button`,onClick:re,title:t(`activity:sddBoard.rollbackTitle`,{count:o.mergedCommits?.length??0,base:o.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,Q.jsx)(c,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.rollback`,{count:o.mergedCommits?.length??0})]})]}),o&&(u?(0,Q.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,Q.jsx)(ne,{className:`h-3.5 w-3.5 animate-spin`}),` `,t(T?`activity:sddBoard.stopping`:`activity:sddBoard.destroying`)]}):(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>C(!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,Q.jsx)(k,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.destroy`)]})),(0,Q.jsx)(K,{variant:`ghost`,size:`icon`,onClick:e,children:(0,Q.jsx)(S,{className:`h-4 w-4`})})]})]}),o&&J&&(0,Q.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-5`,children:[(0,Q.jsx)(ye,{pct:J.percentComplete}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,Q.jsx)(Me,{label:t(`activity:sddBoard.statDone`),value:`${J.completed}/${J.total}`,color:`text-success`}),J.inProgress>0&&(0,Q.jsx)(Me,{label:t(`activity:sddBoard.statRunning`),value:J.inProgress,color:`text-warning`}),J.failed>0&&(0,Q.jsx)(Me,{label:t(`activity:sddBoard.statFailed`),value:J.failed,color:`text-destructive`}),(0,Q.jsx)(Me,{label:t(`activity:sddBoard.statWave`),value:o.wave+1,color:`text-primary`}),T&&o.startedAt>0&&(0,Q.jsx)(Me,{label:t(`activity:sddBoard.statElapsed`),value:_e(p-o.startedAt),color:`text-foreground`})]}),(0,Q.jsx)(`div`,{className:`flex min-h-[24px] items-center gap-1.5`,children:P.length===0?(0,Q.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t(`activity:sddBoard.noActiveWorkers`)}):P.map((e,t)=>(0,Q.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,Q.jsx)(`span`,{className:R(`sdd-agent-live flex h-5 w-5 items-center justify-center rounded-full text-[9px] font-bold text-white`,me[t%me.length]),children:Y(e.name)}),(0,Q.jsx)(`span`,{className:`max-w-[90px] truncate text-[11px] text-foreground`,children:e.name})]},e.name))})]})]})]}),l&&(0,Q.jsx)(je,{result:l,onDismiss:()=>f(null)}),de.length>0&&(0,Q.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,Q.jsx)(m,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`font-semibold`,children:t(`activity:sddBoard.deadlock`)}),de.map(e=>(0,Q.jsxs)(`div`,{className:`font-mono`,children:[e.blocked,` ← `,e.blockedBy.join(`, `)]},e.blocked))]})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:o?ee===`graph`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ve,{tasks:N,columns:o.columns,onTaskClick:F}),(0,Q.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,Q.jsx)(we,{tasks:o.tasks,selectedId:_,onTaskClick:F}):(0,Q.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 text-sm text-muted-foreground`,children:[(0,Q.jsx)(I,{className:`h-10 w-10 text-primary/40`}),(0,Q.jsx)(`p`,{className:`text-foreground`,children:t(`activity:sddBoard.noRunTitle`)}),(0,Q.jsx)(`p`,{className:`max-w-sm text-center text-xs text-muted-foreground`,children:t(`activity:sddBoard.noRunBody`)})]})}),o&&(0,Q.jsx)(`aside`,{"data-testid":`sdd-task-panel`,"data-expanded":y&&q?`true`:`false`,className:R(`shrink-0 border-l border-border bg-card transition-[width] duration-200 ease-out`,y&&q?`w-[min(72rem,72vw)]`:`w-80`),children:q?(0,Q.jsx)(Ee,{task:q,allTasks:o.tasks,feed:o.taskEvents?.[q.id]??o.feed??[],now:p,expanded:y,modelCandidates:G,defaultModel:o.defaultModel,onClose:ie,onToggleExpanded:()=>b(e=>!e),onRetry:L,onReassign:H,onSetModel:se,onSetVerification:ce,onCancel:U,onDelete:W,onSplit:le,onSelectTask:v},q.id):(0,Q.jsx)(xe,{feed:o.feed??[],now:p})})]}),(0,Q.jsx)(Se,{open:x,onOpenChange:C,snapshot:o,busy:u,onConfirm:j})]})}function Ae(e){let t=e.op===`cleanup_worktrees`?`lcClean`:e.op===`rollback`?`lcRollback`:`lcDestroy`,n=b.t(`activity:sddBoard.${t}`);if(!e.ok)return b.t(`activity:sddBoard.lcFailed`,{op:n,reason:e.reason??b.t(`activity:sddBoard.lcUnknownError`)});let r=[];typeof e.removed==`number`&&r.push(b.t(`activity:sddBoard.lcWorktrees`,{count:e.removed})),typeof e.reverted==`number`&&e.reverted>0&&r.push(b.t(`activity:sddBoard.lcCommits`,{count:e.reverted})),e.deleted?.length&&r.push(b.t(`activity:sddBoard.lcDeleted`,{items:e.deleted.join(`, `)}));let i=r.length?r.join(` · `):b.t(`activity:sddBoard.lcNothing`);return e.reason?b.t(`activity:sddBoard.lcNote`,{op:n,body:i,reason:e.reason}):b.t(`activity:sddBoard.lcOk`,{op:n,body:i})}function je({result:e,onDismiss:t}){let n=!e.ok||!!e.reason;return(0,Q.jsxs)(`div`,{className:R(`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,Q.jsx)(L,{className:`mt-0.5 h-4 w-4 shrink-0`}):(0,Q.jsx)(d,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:Ae(e)}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 opacity-60 hover:opacity-100`,children:(0,Q.jsx)(S,{className:`h-3.5 w-3.5`})})]})}function Me({label:e,value:t,color:n}){return(0,Q.jsxs)(`span`,{className:`flex items-baseline gap-1`,children:[(0,Q.jsx)(`span`,{className:R(`font-semibold tabular-nums`,n),children:t}),(0,Q.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:e})]})}var Ne={idle:`phaseStart`,questioning:`phaseInterview`,spec_review:`phaseSpecReview`,implementation:`phasePlanning`,task_review:`phaseTaskReview`,executing:`phaseRunning`,done:`phaseDone`},Pe=[`questioning`,`spec_review`,`implementation`,`task_review`,`executing`];function Fe({onClose:e,onRunStarted:t}){let{t:r}=n(),{client:i}=ae(),a=V(e=>e.snapshot),o=V(e=>e.agentText),s=V(e=>e.error),c=V(e=>e.startedRunId),l=V(e=>e.setStartedRunId),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(!0),[b,ee]=(0,Z.useState)(!0),[w,E]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(void 0),[A,j]=(0,Z.useState)(void 0),[P,ie]=(0,Z.useState)([]),[L,z]=(0,Z.useState)(4),[B,oe]=(0,Z.useState)(!0),[H,se]=(0,Z.useState)(!1),ce=ue(w),U=(0,Z.useCallback)(e=>i?.send?.(e),[i]),W=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{U({type:`sdd.spec.get`})},[U]);let le=a?.answers.length??0;(0,Z.useEffect)(()=>{W.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[le,o]),(0,Z.useEffect)(()=>{c&&(l(null),t?.())},[t,l,c]);let G=a?.busy??!1,Y=a?.phase??`idle`,X=!!a?.sessionId,pe=!!a?.resumed,me=a?.lastRunId;(0,Z.useEffect)(()=>{X&&g(!1)},[X]);let he=a?.answers[a.answers.length-1]?.question??``,ge=!!a&&(a.taskCount>0||!!a.graphId||Y===`task_review`||Y===`executing`),_e=()=>{let e=d.trim();!e||G||h||(g(!0),U({type:`sdd.spec.start`,payload:{goal:e}}))},ye=()=>{let e=p.trim();!e||G||(U({type:`sdd.spec.message`,payload:{text:e}}),m(``))},be=e=>{G||!e.trim()||(U({type:`sdd.spec.message`,payload:{text:e.trim()}}),m(``))},xe=()=>!G&&U({type:`sdd.spec.approve`,payload:{}}),Se=e=>!G&&U({type:`sdd.spec.rewind`,payload:e?{targetPhase:e}:{}}),Ce=()=>{U({type:`sdd.run.start`,payload:{parallelSlots:L,worktrees:B,planDecompose:H,...O?{model:O,provider:A}:{},...P.length?{fallbackModels:P}:{}}}),E(!1)},we=()=>{G||U({type:`sdd.spec.discard`,payload:{}})},Te=(0,Z.useMemo)(()=>(a?.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})),[a?.board]),Ee=Te.length>0,De=o&&Y===`questioning`?o:he??``,Oe=(0,Z.useMemo)(()=>Le(De),[De]),$=a?.answers.length??0,ke=a?.minQuestions??2,Ae=a?.maxQuestions??5,je=$>=ke,Me=Math.min(100,Math.round($/Math.max(1,Ae)*100));return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,Q.jsxs)(`header`,{className:`sdd-sheen flex shrink-0 items-center justify-between border-b border-border px-4 py-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(x,{className:`h-5 w-5 text-primary`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-lg font-semibold`,children:a?.title||r(`activity:sddWizard.titleFallback`)}),X&&(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[r(`activity:sddWizard.${Ne[Y]??`phaseStart`}`),Y===`questioning`&&` · ${r(`activity:sddWizard.questionsSuffix`,{cur:a?.questionCount??0,max:a?.maxQuestions??0})}`,a&&a.taskCount>0?` · ${r(`activity:sddWizard.tasksSuffix`,{count:a.taskCount})}`:``]})]}),G&&(0,Q.jsx)(N,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[me&&(0,Q.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,Q.jsx)(T,{className:`h-3.5 w-3.5`}),` `,r(`activity:sddWizard.openLiveBoard`)]}),X&&(0,Q.jsx)(`button`,{type:`button`,onClick:we,disabled:G,title:r(`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:r(`activity:sddWizard.discardInterview`)}),ge&&(0,Q.jsxs)(`div`,{className:`relative flex items-center gap-1.5`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>E(e=>!e),title:r(`activity:sddWizard.runCfgTitle`),className:R(`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs font-medium`,O||P.length||H?`border-primary/40 bg-primary/10 text-primary`:`border-border bg-muted text-muted-foreground hover:text-foreground`),children:[(0,Q.jsx)(u,{className:`h-3.5 w-3.5`}),O||r(`activity:sddWizard.modelsLabel`)]}),(0,Q.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,Q.jsx)(T,{className:`h-3.5 w-3.5`}),` `,r(`activity:sddWizard.startRun`)]}),w&&(0,Q.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,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.defaultWorkerModel`)}),(0,Q.jsx)(q,{value:O,provider:A,candidates:ce,placeholder:r(`activity:sddWizard.leaderDefaultPlaceholder`),resetLabel:r(`activity:sddWizard.useSessionDefault`),onPick:(e,t)=>{k(e),j(t)},onReset:O?()=>{k(void 0),j(void 0)}:void 0}),(0,Q.jsx)(`div`,{className:`mb-1 mt-3 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.fallbackChain`)}),(0,Q.jsx)(de,{value:P,candidates:ce,onChange:ie}),(0,Q.jsx)(`p`,{className:`mt-2 text-[10px] text-muted-foreground`,children:r(`activity:sddWizard.appliesToAll`)}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`sdd-slots`,className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.parallelAgents`)}),(0,Q.jsx)(`input`,{id:`sdd-slots`,type:`number`,min:1,max:16,value:L,onChange:e=>{let t=Number.parseInt(e.target.value,10);z(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,Q.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.isolateWorktrees`)}),(0,Q.jsx)(`input`,{type:`checkbox`,checked:B,onChange:e=>oe(e.target.checked),className:`h-3.5 w-3.5 accent-primary`})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:r(B?`activity:sddWizard.worktreeOn`:`activity:sddWizard.worktreeOff`)}),(0,Q.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.planDecompose`)}),(0,Q.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>se(e.target.checked),className:`h-3.5 w-3.5 accent-primary`})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:r(H?`activity:sddWizard.planDecomposeOn`:`activity:sddWizard.planDecomposeOff`)})]})]}),(0,Q.jsx)(K,{variant:`ghost`,size:`icon`,onClick:e,children:(0,Q.jsx)(S,{className:`h-4 w-4`})})]})]}),X&&(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 border-b bg-card/50 px-4 py-1.5 text-[11px]`,children:Pe.map((e,t)=>{let n=e===Y,i=Pe.indexOf(Y)>t;return(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[i&&!G&&Y!==`executing`&&Y!==`done`?(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>Se(e),title:r(`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,Q.jsx)(F,{className:`mr-0.5 inline h-3 w-3`}),r(`activity:sddWizard.${Ne[e]}`)]}):(0,Q.jsxs)(`span`,{className:R(`rounded-full px-2 py-0.5`,n?`bg-primary/15 text-primary font-medium`:i?`text-success`:`text-muted-foreground`),children:[i&&(0,Q.jsx)(F,{className:`mr-0.5 inline h-3 w-3`}),r(`activity:sddWizard.${Ne[e]}`)]}),t<Pe.length-1&&(0,Q.jsx)(`span`,{className:`text-muted-foreground/65`,children:`→`})]},e)})}),(0,Q.jsxs)(`div`,{ref:J(`sdd-wizard`),className:`min-h-0 flex-1 overflow-auto overscroll-contain p-4`,children:[s&&(0,Q.jsx)(`div`,{className:`mb-3 rounded-md border border-destructive/40 bg-destructive/5 p-2 text-xs text-destructive`,children:s}),pe&&X&&(0,Q.jsx)(`div`,{className:`mb-3 rounded-md border border-primary/30 bg-primary/5 px-3 py-2 text-xs text-primary`,children:r(`activity:sddWizard.resumeBanner`)}),X?(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[Y===`questioning`&&(0,Q.jsxs)(`div`,{className:`rounded-md border border-border/80 bg-card/60 p-2.5 shadow-sm`,children:[(0,Q.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between text-xs`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium text-foreground`,children:[(0,Q.jsx)(x,{className:`h-3.5 w-3.5 text-primary`}),r(`activity:sddWizard.interviewProgress`,`Interview Progress`)]}),(0,Q.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[r(`activity:sddWizard.questionOf`,{current:$+1,max:Ae}),` · `,je?(0,Q.jsx)(`span`,{className:`font-medium text-success`,children:r(`activity:sddWizard.minRequiredMet`,`Min met ✓`)}):(0,Q.jsx)(`span`,{children:r(`activity:sddWizard.minRequiredRemaining`,{count:ke-$})})]})]}),(0,Q.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,Q.jsx)(`div`,{className:R(`h-full transition-all duration-500`,je?`bg-success`:`bg-primary`),style:{width:`${Math.max(12,Me)}%`}})})]}),Ee&&(0,Q.jsxs)(`div`,{className:`sdd-rise overflow-hidden rounded-lg border border-primary/20 bg-[hsl(var(--surface-2)/0.85)]`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>y(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:[v?(0,Q.jsx)(re,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(C,{className:`h-3.5 w-3.5`}),(0,Q.jsx)(te,{className:`h-3.5 w-3.5`}),r(`activity:sddWizard.taskGraphSummary`,{count:a?.taskCount??0}),(0,Q.jsx)(`span`,{className:`ml-auto text-muted-foreground`,children:r(v?`activity:sddWizard.dragToExplore`:`activity:sddWizard.show`)})]}),v&&(0,Q.jsx)(`div`,{className:`h-[32dvh] min-h-[200px]`,children:(0,Q.jsx)(ve,{tasks:Te,columns:a?.board?.columns??[]})})]}),a?.goal&&(0,Q.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/30 px-3 py-2`,children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,Q.jsx)(_,{className:`h-3 w-3`}),` `,r(`activity:sddWizard.goalLabel`)]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:a.goal})]}),a?.answers.length||o&&Y===`questioning`||G?(0,Q.jsxs)(`div`,{className:`space-y-2.5`,children:[a?.answers.map((e,t)=>(0,Q.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,Q.jsx)(ze,{speaker:`assistant`,text:e.question,questionIndex:t+1}),(0,Q.jsx)(ze,{speaker:`user`,text:e.answer})]},`${t}-${e.question.slice(0,32)}`)),o&&Y===`questioning`&&o!==he&&(0,Q.jsx)(ze,{speaker:`assistant`,text:o,live:!0,questionIndex:$+1}),G&&(0,Q.jsx)(ze,{speaker:`assistant`,text:``,thinking:!0})]}):null,a?.spec&&(0,Q.jsxs)(`div`,{className:`sdd-rise rounded-md border border-border bg-card p-3`,children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-sm font-semibold`,children:[(0,Q.jsx)(x,{className:`h-3.5 w-3.5 text-primary`}),a.spec.title]}),(0,Q.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:a.spec.overview}),(0,Q.jsx)(`ul`,{className:`space-y-0.5 text-xs`,children:a.spec.requirements.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex gap-1.5`,children:[(0,Q.jsx)(`span`,{className:R(`shrink-0 font-mono uppercase`,fe(e.priority).text),children:e.priority[0]}),(0,Q.jsx)(`span`,{children:e.description})]},`${e.priority}-${t}-${e.description.slice(0,24)}`))})]}),o&&(Y===`implementation`||Y===`task_review`)&&(0,Q.jsxs)(`div`,{className:`sdd-rise rounded-md border border-border bg-card`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>ee(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:[b?(0,Q.jsx)(re,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(C,{className:`h-3.5 w-3.5`}),(0,Q.jsx)(x,{className:`h-3.5 w-3.5 text-primary`}),` `,r(`activity:sddWizard.implementationPlan`)]}),b&&(0,Q.jsx)(`div`,{className:`max-h-[40dvh] overflow-auto px-3 py-2`,children:(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:Ie(o)})})]}),o&&Y!==`questioning`&&Y!==`implementation`&&Y!==`task_review`&&!a?.spec&&(0,Q.jsx)(ze,{speaker:`assistant`,text:o}),(Y===`spec_review`||Y===`implementation`||Y===`task_review`)&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[Y===`task_review`?(0,Q.jsxs)(K,{className:`bg-success/15 text-success hover:bg-success/25`,onClick:Ce,disabled:G,children:[(0,Q.jsx)(T,{className:`mr-1.5 h-4 w-4`}),r(`activity:sddWizard.startRun`,`Start Run`)]}):(0,Q.jsxs)(K,{variant:`secondary`,onClick:xe,disabled:G,children:[(0,Q.jsx)(F,{className:`mr-1.5 h-4 w-4`}),r(Y===`spec_review`?`activity:sddWizard.approveSpec`:`activity:sddWizard.approvePlan`)]}),(0,Q.jsxs)(K,{variant:`outline`,onClick:()=>Se(),disabled:G,className:`text-xs text-muted-foreground hover:text-foreground`,title:Y===`spec_review`?r(`activity:sddWizard.backToQuestionsTitle`,`Reject spec and return to questioning`):r(`activity:sddWizard.backToSpecTitle`,`Reject plan and return to spec review`),children:[(0,Q.jsx)(ne,{className:`mr-1.5 h-3.5 w-3.5`}),Y===`spec_review`?r(`activity:sddWizard.backToQuestions`,`Back to Questions`):r(`activity:sddWizard.backToSpec`,`Back to Spec`)]})]}),(0,Q.jsx)(`div`,{ref:W})]}):(0,Q.jsxs)(`div`,{className:`mx-auto mt-8 max-w-xl`,children:[(0,Q.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,htmlFor:`sdd-goal`,children:r(`activity:sddWizard.goalPrompt`)}),(0,Q.jsx)(`textarea`,{id:`sdd-goal`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&_e()},rows:4,placeholder:r(`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,Q.jsx)(K,{className:`mt-3`,onClick:_e,disabled:!d.trim()||h,children:h?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{className:`mr-1.5 h-4 w-4 animate-spin`}),` `,r(`activity:sddWizard.startingInterview`)]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(x,{className:`mr-1.5 h-4 w-4`}),` `,r(`activity:sddWizard.startInterview`)]})}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:r(`activity:sddWizard.introBody`)})]})]}),X&&Y!==`executing`&&Y!==`done`&&(0,Q.jsxs)(`div`,{className:`border-t bg-card`,children:[Y===`questioning`&&!G&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-4 pt-2`,children:[Oe.map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>m(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,Q.jsx)(`span`,{className:`mr-1 opacity-70`,children:`👉`}),e]},e)),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>be(r(`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,Q.jsx)(M,{className:`mr-1 h-3 w-3`}),r(`activity:sddWizard.quickBestPractice`,`Use Best Practice`)]}),je&&(0,Q.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:r(`activity:sddWizard.generateSpecNowTitle`,`Generate the specification now with gathered requirements`),children:[(0,Q.jsx)(I,{className:`mr-1 h-3 w-3`}),r(`activity:sddWizard.generateSpecNow`,`Generate Spec Now`)]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-end gap-2 px-4 py-2`,children:[(0,Q.jsx)(`textarea`,{value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ye())},rows:1,placeholder:r(Y===`questioning`?`activity:sddWizard.answerPlaceholder`:`activity:sddWizard.changePlaceholder`),disabled:G,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,Q.jsx)(K,{size:`icon`,onClick:ye,disabled:G||!p.trim(),children:(0,Q.jsx)(D,{className:`h-4 w-4`})})]})]})]})}function Ie(e){let t=e.replace(/```json[\s\S]*?```/gi,``).trim();return t.length>0?t:e.trim()}function Le(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 Re(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 ze({speaker:e,text:t,live:n,thinking:r,questionIndex:i}){let a=e===`user`,[o,s]=(0,Z.useState)(!1),c=!a&&t?Re(t):null;return(0,Q.jsxs)(`div`,{className:R(`group sdd-rise flex items-start gap-2`,a&&`flex-row-reverse`),children:[(0,Q.jsx)(`span`,{className:R(`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,Q.jsx)(ie,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(j,{className:`h-3.5 w-3.5`})}),(0,Q.jsxs)(`div`,{className:R(`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,Q.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-[10px]`,children:[i!==void 0&&(0,Q.jsxs)(`span`,{className:`rounded bg-primary/15 px-1.5 py-0.2 font-mono font-semibold text-primary`,children:[`Q`,i]}),c&&(0,Q.jsx)(`span`,{className:R(`rounded border px-1.5 py-0.2 font-medium`,c.color),children:c.label})]}),r?(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 py-1`,children:[(0,Q.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground [animation-delay:-200ms]`}),(0,Q.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground [animation-delay:-100ms]`}),(0,Q.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground`})]}):(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap`,children:t}),!r&&t&&(0,Q.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,Q.jsx)(E,{className:`h-3 w-3 text-success`}):(0,Q.jsx)(y,{className:`h-3 w-3`})})]})]})}var Be=[{id:`project`,labelKey:`activity:sddhub.tabProject`},{id:`board`,labelKey:`activity:sddhub.tabBoard`},{id:`specs`,labelKey:`activity:sddhub.tabSpecs`}];function Ve(){let{t:e}=n(),[t,r]=(0,Z.useState)(`project`),i=V(e=>e.startedRunId),a=V(e=>e.setStartedRunId),o=()=>H(`chat`),s=(0,Z.useCallback)(()=>r(`board`),[]);(0,Z.useEffect)(()=>{i&&(r(`board`),a(null))},[i,a]);let c=(e,t)=>{let n;if(e.key===`ArrowLeft`&&(n=(t-1+Be.length)%Be.length),e.key===`ArrowRight`&&(n=(t+1)%Be.length),e.key===`Home`&&(n=0),e.key===`End`&&(n=Be.length-1),n===void 0)return;e.preventDefault();let i=Be[n];i&&(r(i.id),e.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)[n]?.focus())};return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,Q.jsx)(`div`,{role:`tablist`,"aria-orientation":`horizontal`,className:`flex shrink-0 items-end border-b border-border/70 bg-card px-4`,children:Be.map((n,i)=>{let a=t===n.id;return(0,Q.jsxs)(`button`,{id:`sdd-hub-tab-${n.id}`,type:`button`,role:`tab`,"aria-selected":a,"aria-controls":`sdd-hub-panel-${n.id}`,tabIndex:a?0:-1,onClick:()=>r(n.id),onKeyDown:e=>c(e,i),className:R(`relative px-4 py-2.5 text-sm font-medium transition-colors`,a?`text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e(n.labelKey),a&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute bottom-0 left-0 right-0 h-0.5 bg-primary`})]},n.id)})}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:[(0,Q.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,Q.jsx)(Fe,{onClose:o,onRunStarted:s})}),(0,Q.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,Q.jsx)(ke,{onClose:o})}),(0,Q.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,Q.jsx)(be,{onClose:o,onRunStarted:s})})]})]})}export{Ve as SddHub};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ci as n,Ea as r,Ga as i,Ji as a,Ot as o,Pa as s,Zn as c,an as l,ft as u,hn as d,li as f,lt as p,or as m,pn as h,sa as g,za as _,zi as v}from"./vendor-C_zEzV4N.js";import"./i18n-O7wMOn8G.js";import{t as y}from"./useWebSocket-7Vm7doHG.js";import{t as b}from"./ws-client-C4OHn-_g.js";import{t as x}from"./utils-tsZEnrBH.js";import{I as S}from"./stores-CmkcHezT.js";import{n as C}from"./ui-store-tCiy1eTu.js";import{i as w,n as T,r as E}from"./SessionList-CwVI8eZL.js";var D=e(i(),1),O=_(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})})),k=!1;function A(){if(k)return;let e=S.getState().wsUrl;e&&(b(e).on(`session.inspect`,e=>{let t=e.payload,n=O.getState();t?.error?n.setError(t.error):t&&n.setPayload(t)}),k=!0)}var j=p(),M={session_start:s,session_resumed:h,user_input:c,llm_request:n,llm_response:n,tool_use:u,tool_call_start:u,tool_call_end:u,tool_result:u,compaction:h,context_snapshot:d,error:v,session_end:a,message_appended:c,message_updated:c,messages_replaced:c,messages_dropped:c,file_event:f,mode_changed:s,task_created:s,task_updated:s,task_completed:a,task_failed:v,agent_spawned:s,agent_stopped:s,agent_error:v,provider_retry:h,provider_error:o};function N(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 P(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 F={create:`Created`,read:`Read`,update:`Modified`,delete:`Deleted`,rename:`Renamed`};function I(){let{t:e}=t(),i=C(e=>e.inspectSessionId),a=C(e=>e.clearInspectSession),{inspectSession:p}=y(),_=S(e=>e.wsConnected),{payload:v,loading:b,error:k,clear:I}=O(),[R,z]=(0,D.useState)(``),[B,V]=(0,D.useState)(!1);(0,D.useEffect)(()=>{A()},[]),(0,D.useEffect)(()=>{i&&(O.getState().setLoading(!0),p(i))},[i,p]),(0,D.useEffect)(()=>()=>I(),[I]);let H=(0,D.useCallback)(()=>{a()},[a]),U=(0,D.useCallback)(()=>{i&&(O.getState().setLoading(!0),p(i))},[i,p]),W=(0,D.useMemo)(()=>R?v?.events.filter(e=>e.label.toLowerCase().includes(R.toLowerCase())||e.type.toLowerCase().includes(R.toLowerCase()))??[]:v?.events??[],[v,R]),G=(0,D.useMemo)(()=>v?Object.entries(v.toolBreakdown).sort(([,e],[,t])=>t-e):[],[v]);if(b)return(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)]`,children:(0,j.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,j.jsx)(m,{className:`h-5 w-5 animate-spin text-primary`}),e(`activity:sessionInspect.loadingSessionInspection`)]})});if(k)return(0,j.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,j.jsx)(o,{className:`h-8 w-8 text-destructive`}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:k}),(0,j.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,j.jsx)(r,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.backToSessions`)]})]});if(!i)return(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)]`,children:(0,j.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 p-6 text-center`,children:[(0,j.jsx)(l,{className:`h-9 w-9 text-muted-foreground opacity-30`}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e(`activity:sessionInspect.noSessionSelected`)}),(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`activity:sessionInspect.selectASessionFromTheSessions`)})]})});if(!v)return null;let K=P(v.outcome,e),q=v.name||v.title||`Untitled`;return(0,j.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,j.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,j.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.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,j.jsx)(r,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.backToSessions`)]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`h1`,{className:`truncate text-lg font-semibold tracking-tight`,title:q,children:q}),v.outcome?(0,j.jsx)(`span`,{className:x(`inline-flex items-center border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,K.cls),children:K.label}):null]}),(0,j.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,j.jsxs)(`span`,{className:`font-mono`,children:[v.provider,`/`,v.model]}),(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,j.jsx)(g,{className:`h-3 w-3`}),E(v.startedAt)]}),(0,j.jsx)(`span`,{children:w({id:v.id,title:v.title,startedAt:v.startedAt,endedAt:v.endedAt,model:v.model,provider:v.provider,tokenTotal:v.tokenTotal,isCurrent:!1})}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px]`,children:[`ID: `,v.id.slice(0,12),`…`]})]}),v.lastUserMessage?(0,j.jsxs)(`p`,{className:`mt-2 truncate text-xs text-muted-foreground`,title:v.lastUserMessage,children:[`"`,v.lastUserMessage,`"`]}):null]}),(0,j.jsxs)(`button`,{type:`button`,onClick:U,disabled:!_,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,j.jsx)(h,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.refresh`)]})]})}),(0,j.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-4 p-4 sm:p-6`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4 lg:grid-cols-7`,children:[(0,j.jsx)(L,{icon:n,label:e(`activity:sessionInspect.tokens`),value:T(v.tokenTotal)}),(0,j.jsx)(L,{icon:c,label:e(`activity:sessionInspect.messages`),value:T(v.messageCount)}),(0,j.jsx)(L,{icon:s,label:e(`activity:sessionInspect.iterations`),value:T(v.iterationCount)}),(0,j.jsx)(L,{icon:u,label:e(`activity:sessionInspect.toolCalls`),value:T(v.toolCallCount),errorCount:v.toolErrorCount>0?v.toolErrorCount:void 0}),(0,j.jsx)(L,{icon:f,label:e(`activity:sessionInspect.files`),value:T(v.fileChangeCount)}),(0,j.jsx)(L,{icon:h,label:e(`activity:sessionInspect.compactions`),value:T(v.compactionCount)}),(0,j.jsx)(L,{icon:d,label:e(`activity:sessionInspect.events`),value:T(v.events.length)})]}),(0,j.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[1fr_20rem]`,children:[(0,j.jsxs)(`section`,{className:`min-w-0 border border-border/70 bg-card/70`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/70 px-4 py-2.5`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(d,{className:`h-4 w-4 text-primary`}),(0,j.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.eventTimeline`)}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:[W.length,` / `,v.events.length]})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(l,{className:`pointer-events-none absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground`}),(0,j.jsx)(`input`,{type:`search`,value:R,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,j.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,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:W.length===0?(0,j.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=M[e.type]??s;return(0,j.jsxs)(`div`,{className:x(`grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-2.5 gap-y-0.5 px-3 py-2 text-xs`,N(e.type)),children:[(0,j.jsx)(n,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`truncate font-medium`,children:e.label}),e.detail?(0,j.jsx)(`div`,{className:`truncate font-mono text-[10px] opacity-70`,children:e.detail}):null]}),(0,j.jsx)(`time`,{dateTime:e.ts,className:`whitespace-nowrap font-mono text-[10px] opacity-60`,children:new Date(e.ts).toLocaleTimeString()})]},`${e.ts}-${t}`)})})]}),(0,j.jsxs)(`aside`,{className:`flex flex-col gap-4`,children:[G.length>0?(0,j.jsxs)(`section`,{className:`border border-border/70 bg-card/70`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-4 py-2.5`,children:[(0,j.jsx)(u,{className:`h-4 w-4 text-primary`}),(0,j.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.toolBreakdown`)})]}),(0,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:G.map(([e,t])=>(0,j.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 text-xs`,children:[(0,j.jsx)(`span`,{className:`truncate font-medium`,children:e}),(0,j.jsx)(`span`,{className:`ml-2 shrink-0 font-mono font-semibold tabular-nums`,children:t})]},e))})]}):null,v.fileEvents.length>0?(0,j.jsxs)(`section`,{className:`border border-border/70 bg-card/70`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-4 py-2.5`,children:[(0,j.jsx)(f,{className:`h-4 w-4 text-success`}),(0,j.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.fileChanges`)}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:v.fileEvents.length})]}),(0,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:v.fileEvents.map((e,t)=>(0,j.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2 px-4 py-2 text-xs`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`truncate font-mono font-medium`,title:e.filePath,children:e.filePath}),(0,j.jsx)(`div`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:e.toolName})]}),(0,j.jsx)(`span`,{className:x(`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:F[e.operation]??e.operation})]},`${e.filePath}-${t}`))})]}):null]})]})]})]})}function L({icon:e,label:t,value:n,errorCount:r}){return(0,j.jsxs)(`div`,{className:`border border-border/70 bg-card/70 px-3 py-2.5`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground`,children:[(0,j.jsx)(e,{className:`h-3 w-3`}),t]}),(0,j.jsxs)(`div`,{className:`mt-1 flex items-baseline gap-1.5`,children:[(0,j.jsx)(`span`,{className:`font-mono text-lg font-semibold tabular-nums`,children:n}),r!==void 0&&r>0?(0,j.jsxs)(`span`,{className:`font-mono text-xs text-destructive`,children:[`(`,r,` err)`]}):null]})]})}export{I as SessionInspectView};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ci as n,Ea as r,Ga as i,Ji as a,Ot as o,Pa as s,Zn as c,an as l,ft as u,hn as d,li as f,lt as p,or as m,pn as h,sa as g,za as _,zi as v}from"./vendor-C_zEzV4N.js";import"./i18n-CDoHRskt.js";import{t as y}from"./useWebSocket-BFFntyS4.js";import{t as b}from"./ws-client-B3MVz75-.js";import{t as x}from"./utils-tsZEnrBH.js";import{I as S}from"./stores-DSGsI875.js";import{n as C}from"./ui-store-xx1NssJI.js";import{i as w,n as T,r as E}from"./SessionList-BRbF7FVS.js";var D=e(i(),1),O=_(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})})),k=!1;function A(){if(k)return;let e=S.getState().wsUrl;e&&(b(e).on(`session.inspect`,e=>{let t=e.payload,n=O.getState();t?.error?n.setError(t.error):t&&n.setPayload(t)}),k=!0)}var j=p(),M={session_start:s,session_resumed:h,user_input:c,llm_request:n,llm_response:n,tool_use:u,tool_call_start:u,tool_call_end:u,tool_result:u,compaction:h,context_snapshot:d,error:v,session_end:a,message_appended:c,message_updated:c,messages_replaced:c,messages_dropped:c,file_event:f,mode_changed:s,task_created:s,task_updated:s,task_completed:a,task_failed:v,agent_spawned:s,agent_stopped:s,agent_error:v,provider_retry:h,provider_error:o};function N(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 P(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 F={create:`Created`,read:`Read`,update:`Modified`,delete:`Deleted`,rename:`Renamed`};function I(){let{t:e}=t(),i=C(e=>e.inspectSessionId),a=C(e=>e.clearInspectSession),{inspectSession:p}=y(),_=S(e=>e.wsConnected),{payload:v,loading:b,error:k,clear:I}=O(),[R,z]=(0,D.useState)(``),[B,V]=(0,D.useState)(!1);(0,D.useEffect)(()=>{A()},[]),(0,D.useEffect)(()=>{i&&(O.getState().setLoading(!0),p(i))},[i,p]),(0,D.useEffect)(()=>()=>I(),[I]);let H=(0,D.useCallback)(()=>{a()},[a]),U=(0,D.useCallback)(()=>{i&&(O.getState().setLoading(!0),p(i))},[i,p]),W=(0,D.useMemo)(()=>R?v?.events.filter(e=>e.label.toLowerCase().includes(R.toLowerCase())||e.type.toLowerCase().includes(R.toLowerCase()))??[]:v?.events??[],[v,R]),G=(0,D.useMemo)(()=>v?Object.entries(v.toolBreakdown).sort(([,e],[,t])=>t-e):[],[v]);if(b)return(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)]`,children:(0,j.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,j.jsx)(m,{className:`h-5 w-5 animate-spin text-primary`}),e(`activity:sessionInspect.loadingSessionInspection`)]})});if(k)return(0,j.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,j.jsx)(o,{className:`h-8 w-8 text-destructive`}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:k}),(0,j.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,j.jsx)(r,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.backToSessions`)]})]});if(!i)return(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)]`,children:(0,j.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 p-6 text-center`,children:[(0,j.jsx)(l,{className:`h-9 w-9 text-muted-foreground opacity-30`}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e(`activity:sessionInspect.noSessionSelected`)}),(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`activity:sessionInspect.selectASessionFromTheSessions`)})]})});if(!v)return null;let K=P(v.outcome,e),q=v.name||v.title||`Untitled`;return(0,j.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,j.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,j.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.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,j.jsx)(r,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.backToSessions`)]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`h1`,{className:`truncate text-lg font-semibold tracking-tight`,title:q,children:q}),v.outcome?(0,j.jsx)(`span`,{className:x(`inline-flex items-center border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,K.cls),children:K.label}):null]}),(0,j.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,j.jsxs)(`span`,{className:`font-mono`,children:[v.provider,`/`,v.model]}),(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,j.jsx)(g,{className:`h-3 w-3`}),E(v.startedAt)]}),(0,j.jsx)(`span`,{children:w({id:v.id,title:v.title,startedAt:v.startedAt,endedAt:v.endedAt,model:v.model,provider:v.provider,tokenTotal:v.tokenTotal,isCurrent:!1})}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px]`,children:[`ID: `,v.id.slice(0,12),`…`]})]}),v.lastUserMessage?(0,j.jsxs)(`p`,{className:`mt-2 truncate text-xs text-muted-foreground`,title:v.lastUserMessage,children:[`"`,v.lastUserMessage,`"`]}):null]}),(0,j.jsxs)(`button`,{type:`button`,onClick:U,disabled:!_,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,j.jsx)(h,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.refresh`)]})]})}),(0,j.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-4 p-4 sm:p-6`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4 lg:grid-cols-7`,children:[(0,j.jsx)(L,{icon:n,label:e(`activity:sessionInspect.tokens`),value:T(v.tokenTotal)}),(0,j.jsx)(L,{icon:c,label:e(`activity:sessionInspect.messages`),value:T(v.messageCount)}),(0,j.jsx)(L,{icon:s,label:e(`activity:sessionInspect.iterations`),value:T(v.iterationCount)}),(0,j.jsx)(L,{icon:u,label:e(`activity:sessionInspect.toolCalls`),value:T(v.toolCallCount),errorCount:v.toolErrorCount>0?v.toolErrorCount:void 0}),(0,j.jsx)(L,{icon:f,label:e(`activity:sessionInspect.files`),value:T(v.fileChangeCount)}),(0,j.jsx)(L,{icon:h,label:e(`activity:sessionInspect.compactions`),value:T(v.compactionCount)}),(0,j.jsx)(L,{icon:d,label:e(`activity:sessionInspect.events`),value:T(v.events.length)})]}),(0,j.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[1fr_20rem]`,children:[(0,j.jsxs)(`section`,{className:`min-w-0 border border-border/70 bg-card/70`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/70 px-4 py-2.5`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(d,{className:`h-4 w-4 text-primary`}),(0,j.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.eventTimeline`)}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:[W.length,` / `,v.events.length]})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(l,{className:`pointer-events-none absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground`}),(0,j.jsx)(`input`,{type:`search`,value:R,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,j.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,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:W.length===0?(0,j.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=M[e.type]??s;return(0,j.jsxs)(`div`,{className:x(`grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-2.5 gap-y-0.5 px-3 py-2 text-xs`,N(e.type)),children:[(0,j.jsx)(n,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`truncate font-medium`,children:e.label}),e.detail?(0,j.jsx)(`div`,{className:`truncate font-mono text-[10px] opacity-70`,children:e.detail}):null]}),(0,j.jsx)(`time`,{dateTime:e.ts,className:`whitespace-nowrap font-mono text-[10px] opacity-60`,children:new Date(e.ts).toLocaleTimeString()})]},`${e.ts}-${t}`)})})]}),(0,j.jsxs)(`aside`,{className:`flex flex-col gap-4`,children:[G.length>0?(0,j.jsxs)(`section`,{className:`border border-border/70 bg-card/70`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-4 py-2.5`,children:[(0,j.jsx)(u,{className:`h-4 w-4 text-primary`}),(0,j.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.toolBreakdown`)})]}),(0,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:G.map(([e,t])=>(0,j.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 text-xs`,children:[(0,j.jsx)(`span`,{className:`truncate font-medium`,children:e}),(0,j.jsx)(`span`,{className:`ml-2 shrink-0 font-mono font-semibold tabular-nums`,children:t})]},e))})]}):null,v.fileEvents.length>0?(0,j.jsxs)(`section`,{className:`border border-border/70 bg-card/70`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-4 py-2.5`,children:[(0,j.jsx)(f,{className:`h-4 w-4 text-success`}),(0,j.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.fileChanges`)}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:v.fileEvents.length})]}),(0,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:v.fileEvents.map((e,t)=>(0,j.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2 px-4 py-2 text-xs`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`truncate font-mono font-medium`,title:e.filePath,children:e.filePath}),(0,j.jsx)(`div`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:e.toolName})]}),(0,j.jsx)(`span`,{className:x(`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:F[e.operation]??e.operation})]},`${e.filePath}-${t}`))})]}):null]})]})]})]})}function L({icon:e,label:t,value:n,errorCount:r}){return(0,j.jsxs)(`div`,{className:`border border-border/70 bg-card/70 px-3 py-2.5`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground`,children:[(0,j.jsx)(e,{className:`h-3 w-3`}),t]}),(0,j.jsxs)(`div`,{className:`mt-1 flex items-baseline gap-1.5`,children:[(0,j.jsx)(`span`,{className:`font-mono text-lg font-semibold tabular-nums`,children:n}),r!==void 0&&r>0?(0,j.jsxs)(`span`,{className:`font-mono text-xs text-destructive`,children:[`(`,r,` err)`]}):null]})]})}export{I as SessionInspectView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,En as n,Ga as r,Ji as i,Ot as a,Pa as o,Pi as s,Ua as c,Vi as l,an as u,dt as ee,ft as d,hn as f,jt as p,kn as te,li as m,lt as h,on as ne,or as g,yn as re,zt as _}from"./vendor-C_zEzV4N.js";import"./i18n-O7wMOn8G.js";import{t as v}from"./utils-tsZEnrBH.js";import"./stores-CmkcHezT.js";import{n as y}from"./ui-store-tCiy1eTu.js";import{r as b}from"./ConfirmModal-D0FaeNr8.js";import{b as ie}from"./index-CzVjuusy.js";var x=e(r(),1),S=h(),ae=10,oe=20,C=e=>{if(!e)return 0;let t=Date.parse(e);return Number.isNaN(t)?0:t},w=e=>(e.iterationCount??0)+(e.toolCallCount??0)+(e.fileChangeCount??0),T=e=>{let t=Date.parse(e);if(Number.isNaN(t))return``;let n=Math.max(0,Date.now()-t);if(n<6e4)return c.t(`common:time.justNow`);if(n<36e5)return c.t(`common:time.minutesAgo`,{count:Math.floor(n/6e4)});if(n<864e5)return c.t(`common:time.hoursAgo`,{count:Math.floor(n/36e5)});let r=Math.floor(n/864e5);return r<7?c.t(`common:time.daysAgo`,{count:r}):new Date(t).toLocaleDateString()},E=e=>e.lastActivityAt??e.endedAt??e.startedAt;function D(e){let t=C(e.startedAt);if(!t)return``;let n=e.isCurrent?Date.now():C(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 O(e){return new Intl.NumberFormat(void 0,{notation:e>=1e3?`compact`:`standard`,maximumFractionDigits:1}).format(e)}function se(e){return e.filter(e=>e.tokenTotal===0&&!e.isCurrent).map(e=>e.id)}function ce(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=w(n)-w(e);if(t!==0)return t}return C(E(n))-C(E(e))})}function le(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=C(E(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 ue(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 de(e){if(e.isCurrent)return{icon:o,label:`active`,defaultLabel:`Active`,className:`text-primary`};switch(e.outcome){case`completed`:return{icon:i,label:`completed`,defaultLabel:`Completed`,className:`text-success`};case`error`:return{icon:a,label:`error`,defaultLabel:`Error`,className:`text-destructive`};case`timeout`:return{icon:s,label:`timeout`,defaultLabel:`Timed out`,className:`text-warning`};case`aborted`:return{icon:l,label:`aborted`,defaultLabel:`Aborted`,className:`text-muted-foreground`};default:return e.endedAt?{icon:i,label:`completed`,defaultLabel:`Completed`,className:`text-success`}:{icon:f,label:`saved`,defaultLabel:`Saved session`,className:`text-muted-foreground`}}}function fe({stats:e}){let{t:n}=t(),r=[{label:n(`activity:sessions.stats.sessions`,{defaultValue:`Sessions`}),value:e.sessions,icon:f},{label:n(`activity:sessions.stats.tokens`,{defaultValue:`Tokens`}),value:e.tokens,icon:o},{label:n(`activity:sessions.stats.tools`,{defaultValue:`Tool calls`}),value:e.tools,icon:d},{label:n(`activity:sessions.stats.files`,{defaultValue:`Files changed`}),value:e.files,icon:m},{label:n(`activity:sessions.stats.errors`,{defaultValue:`Errors`}),value:e.errors,icon:a}];return(0,S.jsx)(`div`,{className:`grid grid-cols-2 border-b border-border/75 bg-card md:grid-cols-5`,children:r.map(e=>{let t=e.icon;return(0,S.jsxs)(`div`,{className:`border-b border-r border-border/75 px-4 py-3 md:border-b-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground`,children:[(0,S.jsx)(t,{className:`h-3 w-3`}),e.label]}),(0,S.jsx)(`div`,{className:`mt-1 font-mono text-xl font-semibold tabular-nums`,children:O(e.value)})]},e.label)})})}function k({historyQuery:e,setHistoryQuery:r,historyEntries:i,historyLoading:o,historyError:s,wsConnected:c,listSessions:l,resumeSession:h,deleteSession:C,renameSession:w,variant:k=`sidebar`}){let{t:A}=t(),j=y(e=>e.favoriteSessionIds),pe=y(e=>e.toggleFavoriteSession),M=y(e=>e.sessionNicknames),N=y(e=>e.setSessionNickname),me=y(e=>e.setInspectSession),[P,he]=(0,x.useState)(`all`),[F,ge]=(0,x.useState)(`recent`),[I,L]=(0,x.useState)(null),[R,z]=(0,x.useState)(``),[B,V]=(0,x.useState)(null),[H,U]=(0,x.useState)(1),W=(0,x.useRef)(null),G=(0,x.useRef)(null),K=k===`workspace`,q=(0,x.useCallback)(e=>e.name||M[e.id]||e.title||A(`activity:sessions.empty`),[M,A]),J=(0,x.useCallback)(e=>{L(e.id),z(e.name??M[e.id]??e.title??``)},[M]),Y=(0,x.useCallback)(e=>{L(null),N(e,R),w(e,R)},[R,w,N]);(0,x.useEffect)(()=>{B&&i.some(e=>e.id===B&&e.isCurrent)&&(V(null),W.current&&clearTimeout(W.current))},[i,B]),(0,x.useEffect)(()=>{I&&(G.current?.focus(),G.current?.select())},[I]),(0,x.useEffect)(()=>()=>{W.current&&clearTimeout(W.current)},[]);let X=(0,x.useCallback)(e=>{V(e),h(e),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>V(null),1e4)},[h]),Z=(0,x.useMemo)(()=>se(i),[i]),Q=(0,x.useMemo)(()=>ce(i,{query:e,filter:P,sort:F,favoriteIds:j}),[j,P,i,e,F]),$=K?oe:ae,_e=(0,x.useMemo)(()=>Q.slice((H-1)*$,H*$),[H,$,Q]),ve=(0,x.useMemo)(()=>le(_e,j),[j,_e]),ye=(0,x.useMemo)(()=>ue(i),[i]);(0,x.useEffect)(()=>{U(1)},[P,e,F]),(0,x.useEffect)(()=>{let e=Math.max(1,Math.ceil(Q.length/$));H>e&&U(e)},[H,$,Q.length]);let be=(0,x.useCallback)(async()=>{if(Z.length!==0&&await b({title:A(`activity:sessions.deleteEmptyTitle`,{count:Z.length}),message:A(`activity:sessions.deleteEmptyConfirmBody`),confirmLabel:A(`common:action.delete`),danger:!0}))for(let e of Z)C(e)},[C,Z,A]),xe=[{id:`all`,label:A(`activity:sessions.filters.all`,{defaultValue:`All`})},{id:`favorites`,label:A(`activity:sessions.filters.favorites`,{defaultValue:`Pinned`})},{id:`active`,label:A(`activity:sessions.filters.active`,{defaultValue:`Active`})},{id:`completed`,label:A(`activity:sessions.filters.completed`,{defaultValue:`Completed`})},{id:`issues`,label:A(`activity:sessions.filters.issues`,{defaultValue:`Issues`})}];return(0,S.jsxs)(`div`,{className:v(`flex min-h-0 min-w-0 flex-1 flex-col bg-background`,K&&`h-full`),"data-history-variant":k,children:[K?(0,S.jsx)(fe,{stats:ye}):null,(0,S.jsxs)(`div`,{className:v(`border-b border-border/75 bg-card`,K?`px-4 py-3`:`px-3 py-2`),children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:A(`activity:sessions.recentSessions`)}),K?(0,S.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:A(`activity:sessions.workspaceHint`,{defaultValue:`Search, inspect, pin and resume every project conversation.`})}):null]}),(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center border border-border/75`,children:[Z.length>0?(0,S.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:be,disabled:!c,title:A(`activity:sessions.deleteEmptyTitle`,{count:Z.length}),children:[(0,S.jsx)(p,{className:`h-3.5 w-3.5`}),K?(0,S.jsx)(`span`,{className:`text-[10px]`,children:Z.length}):null]}):null,(0,S.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:()=>l(200),disabled:!c,title:A(`common:action.refresh`),children:o?(0,S.jsx)(g,{className:`h-3.5 w-3.5 animate-spin`}):(0,S.jsx)(re,{className:`h-3.5 w-3.5`})})]})]}),(0,S.jsxs)(`div`,{className:v(`grid gap-2`,K?`mt-3 lg:grid-cols-[minmax(18rem,1fr)_auto_auto]`:`mt-2`),children:[(0,S.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,S.jsx)(u,{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,S.jsx)(`input`,{type:`search`,value:e,onChange:e=>r(e.target.value),placeholder:A(`activity:sessions.filterPlaceholder`),"aria-label":A(`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,S.jsx)(`button`,{type:`button`,onClick:()=>r(``),className:`absolute right-0 top-0 inline-flex h-9 w-8 items-center justify-center text-muted-foreground hover:text-foreground`,title:A(`activity:sessions.clearFilter`),children:(0,S.jsx)(ee,{className:`h-3.5 w-3.5`})}):null]}),(0,S.jsxs)(`fieldset`,{className:`flex min-w-0 overflow-x-auto border border-border/75`,children:[(0,S.jsx)(`legend`,{className:`sr-only`,children:A(`activity:sessionList.historyFilters`)}),xe.map(e=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>he(e.id),"aria-pressed":P===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`,P===e.id?`bg-foreground text-background`:`bg-background text-muted-foreground hover:bg-muted hover:text-foreground`),children:e.label},e.id))]}),(0,S.jsxs)(`select`,{value:F,onChange:e=>ge(e.target.value),"aria-label":A(`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,S.jsx)(`option`,{value:`recent`,children:A(`activity:sessions.sort.recent`,{defaultValue:`Recent`})}),(0,S.jsx)(`option`,{value:`tokens`,children:A(`activity:sessions.sort.tokens`,{defaultValue:`Most tokens`})}),(0,S.jsx)(`option`,{value:`activity`,children:A(`activity:sessions.sort.activity`,{defaultValue:`Most activity`})})]})]})]}),s?(0,S.jsx)(`div`,{className:`border-b border-destructive/30 bg-destructive/5 px-4 py-2 text-xs text-destructive`,children:s}):null,(0,S.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain overflow-x-hidden [scrollbar-gutter:stable]`,children:i.length===0&&!o?(0,S.jsxs)(`div`,{className:`flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center text-muted-foreground`,children:[(0,S.jsx)(f,{className:`h-9 w-9 opacity-25`}),(0,S.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:A(`activity:sessions.noHistory`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs`,children:A(`activity:sessions.noHistoryHint`)})]}):ve.length===0?(0,S.jsxs)(`div`,{className:`flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center text-muted-foreground`,children:[(0,S.jsx)(u,{className:`h-9 w-9 opacity-25`}),(0,S.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:A(`activity:sessions.noMatches`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs`,children:A(`activity:sessions.noMatchesHint`)})]}):(0,S.jsxs)(`div`,{className:v(K?`mx-auto w-full max-w-7xl p-4 lg:p-6`:`p-2`),children:[(0,S.jsx)(`div`,{className:v(`space-y-5`,K&&`grid gap-x-5 space-y-0 xl:grid-cols-2`),children:ve.map(e=>(0,S.jsxs)(`section`,{className:`min-w-0`,children:[(0,S.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,S.jsx)(_,{className:`h-3 w-3 fill-current`}):null,A(`activity:sessions.group.${e.label}`),(0,S.jsx)(`span`,{className:`ml-1 font-mono font-normal text-muted-foreground`,children:e.rows.length})]}),(0,S.jsx)(`div`,{className:`divide-y divide-border/75 border-x border-b border-border/75`,children:e.rows.map(e=>{let t=j.includes(e.id),r=de(e),i=r.icon,o=I===e.id,s=B===e.id;return(0,S.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,S.jsxs)(`div`,{className:`min-w-0 px-3 py-3`,children:[(0,S.jsx)(`label`,{className:`block text-[10px] font-semibold uppercase tracking-[0.1em] text-muted-foreground`,htmlFor:`session-name-${e.id}`,children:A(`activity:sessions.rename`,{defaultValue:`Session name`})}),(0,S.jsx)(`input`,{ref:G,id:`session-name-${e.id}`,value:R,onChange:e=>z(e.target.value),onBlur:()=>Y(e.id),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),Y(e.id)):t.key===`Escape`&&(t.preventDefault(),L(null))},placeholder:e.title||A(`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,S.jsx)(`button`,{type:`button`,disabled:e.isCurrent||B!==null,onClick:()=>X(e.id),onDoubleClick:()=>J(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,S.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,S.jsx)(`span`,{className:v(`mt-0.5 shrink-0`,r.className),title:A(`activity:sessions.status.${r.label}`,{defaultValue:r.defaultLabel}),children:(0,S.jsx)(i,{className:v(`h-3.5 w-3.5`,e.isCurrent&&`animate-pulse`)})}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:`truncate text-sm font-semibold text-foreground`,title:q(e),children:q(e)}),(0,S.jsxs)(`div`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:[e.provider,`/`,e.model]}),e.lastUserMessage?(0,S.jsx)(`div`,{className:`mt-1 truncate text-xs text-muted-foreground`,title:e.lastUserMessage,children:e.lastUserMessage}):null,(0,S.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,S.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-sans font-semibold text-primary`,children:[(0,S.jsx)(g,{className:`h-3 w-3 animate-spin`}),A(`activity:sessions.resuming`)]}):(0,S.jsx)(`span`,{title:new Date(E(e)).toLocaleString(),children:T(E(e))}),(0,S.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,S.jsx)(`span`,{children:D(e)}),e.tokenTotal>0?(0,S.jsxs)(`span`,{children:[O(e.tokenTotal),` tok`]}):null,(e.messageCount??0)>0?(0,S.jsxs)(`span`,{children:[O(e.messageCount??0),` msg`]}):null,(e.toolCallCount??0)>0?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,S.jsx)(d,{className:`h-3 w-3`}),e.toolCallCount]}):null,(e.fileChangeCount??0)>0?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,S.jsx)(m,{className:`h-3 w-3`}),e.fileChangeCount]}):null,(e.toolErrorCount??0)>0?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-destructive`,children:[(0,S.jsx)(a,{className:`h-3 w-3`}),e.toolErrorCount]}):null]})]})]})}),(0,S.jsxs)(`div`,{className:`flex items-start gap-0.5 p-2`,children:[!e.isCurrent&&K&&!o?(0,S.jsxs)(`button`,{type:`button`,onClick:()=>X(e.id),disabled:B!==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:A(`activity:sessions.resume`,{defaultValue:`Resume session`}),children:[(0,S.jsx)(n,{className:`h-3 w-3`}),A(`activity:sessions.resumeShort`,{defaultValue:`Resume`})]}):null,o?null:(0,S.jsx)(`button`,{type:`button`,onClick:()=>me(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:A(`activity:sessions.inspect`,{defaultValue:`Inspect session`}),children:(0,S.jsx)(ne,{className:`h-3.5 w-3.5`})}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>pe(e.id),"aria-pressed":t,className:v(`inline-flex h-7 w-7 items-center justify-center transition-colors hover:bg-warning/10 hover:text-warning`,t?`text-warning`:`text-muted-foreground`),title:A(t?`activity:sessions.unfavorite`:`activity:sessions.markFavorite`),children:(0,S.jsx)(_,{className:v(`h-3.5 w-3.5`,t&&`fill-current`)})}),o?null:(0,S.jsx)(`button`,{type:`button`,onClick:()=>J(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:A(`activity:sessions.renameAction`,{defaultValue:`Rename`}),children:(0,S.jsx)(te,{className:`h-3.5 w-3.5`})}),e.isCurrent?null:(0,S.jsx)(`button`,{type:`button`,onClick:async()=>{await b({title:A(`activity:sessions.deleteSessionConfirmTitle`),message:A(`activity:sessions.deleteSessionConfirmBody`,{name:q(e)}),confirmLabel:A(`common:action.delete`),danger:!0})&&C(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:A(`activity:sessions.deleteSessionTitle`),children:(0,S.jsx)(p,{className:`h-3.5 w-3.5`})})]})]},e.id)})})]},e.label))}),(0,S.jsx)(ie,{page:H,pageSize:$,totalItems:Q.length,onPageChange:U,compact:!K,itemLabel:`sessions`})]})})]})}export{D as i,O as n,T as r,k as t};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,En as n,Ga as r,Ji as i,Ot as a,Pa as o,Pi as s,Ua as c,Vi as l,an as u,dt as ee,ft as d,hn as f,jt as p,kn as te,li as m,lt as h,on as ne,or as g,yn as re,zt as _}from"./vendor-C_zEzV4N.js";import"./i18n-CDoHRskt.js";import{t as v}from"./utils-tsZEnrBH.js";import"./stores-DSGsI875.js";import{n as y}from"./ui-store-xx1NssJI.js";import{r as b}from"./ConfirmModal-LBZaZgsG.js";import{b as ie}from"./index-BRJ_UrGk.js";var x=e(r(),1),S=h(),ae=10,oe=20,C=e=>{if(!e)return 0;let t=Date.parse(e);return Number.isNaN(t)?0:t},w=e=>(e.iterationCount??0)+(e.toolCallCount??0)+(e.fileChangeCount??0),T=e=>{let t=Date.parse(e);if(Number.isNaN(t))return``;let n=Math.max(0,Date.now()-t);if(n<6e4)return c.t(`common:time.justNow`);if(n<36e5)return c.t(`common:time.minutesAgo`,{count:Math.floor(n/6e4)});if(n<864e5)return c.t(`common:time.hoursAgo`,{count:Math.floor(n/36e5)});let r=Math.floor(n/864e5);return r<7?c.t(`common:time.daysAgo`,{count:r}):new Date(t).toLocaleDateString()},E=e=>e.lastActivityAt??e.endedAt??e.startedAt;function D(e){let t=C(e.startedAt);if(!t)return``;let n=e.isCurrent?Date.now():C(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 O(e){return new Intl.NumberFormat(void 0,{notation:e>=1e3?`compact`:`standard`,maximumFractionDigits:1}).format(e)}function se(e){return e.filter(e=>e.tokenTotal===0&&!e.isCurrent).map(e=>e.id)}function ce(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=w(n)-w(e);if(t!==0)return t}return C(E(n))-C(E(e))})}function le(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=C(E(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 ue(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 de(e){if(e.isCurrent)return{icon:o,label:`active`,defaultLabel:`Active`,className:`text-primary`};switch(e.outcome){case`completed`:return{icon:i,label:`completed`,defaultLabel:`Completed`,className:`text-success`};case`error`:return{icon:a,label:`error`,defaultLabel:`Error`,className:`text-destructive`};case`timeout`:return{icon:s,label:`timeout`,defaultLabel:`Timed out`,className:`text-warning`};case`aborted`:return{icon:l,label:`aborted`,defaultLabel:`Aborted`,className:`text-muted-foreground`};default:return e.endedAt?{icon:i,label:`completed`,defaultLabel:`Completed`,className:`text-success`}:{icon:f,label:`saved`,defaultLabel:`Saved session`,className:`text-muted-foreground`}}}function fe({stats:e}){let{t:n}=t(),r=[{label:n(`activity:sessions.stats.sessions`,{defaultValue:`Sessions`}),value:e.sessions,icon:f},{label:n(`activity:sessions.stats.tokens`,{defaultValue:`Tokens`}),value:e.tokens,icon:o},{label:n(`activity:sessions.stats.tools`,{defaultValue:`Tool calls`}),value:e.tools,icon:d},{label:n(`activity:sessions.stats.files`,{defaultValue:`Files changed`}),value:e.files,icon:m},{label:n(`activity:sessions.stats.errors`,{defaultValue:`Errors`}),value:e.errors,icon:a}];return(0,S.jsx)(`div`,{className:`grid grid-cols-2 border-b border-border/75 bg-card md:grid-cols-5`,children:r.map(e=>{let t=e.icon;return(0,S.jsxs)(`div`,{className:`border-b border-r border-border/75 px-4 py-3 md:border-b-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground`,children:[(0,S.jsx)(t,{className:`h-3 w-3`}),e.label]}),(0,S.jsx)(`div`,{className:`mt-1 font-mono text-xl font-semibold tabular-nums`,children:O(e.value)})]},e.label)})})}function k({historyQuery:e,setHistoryQuery:r,historyEntries:i,historyLoading:o,historyError:s,wsConnected:c,listSessions:l,resumeSession:h,deleteSession:C,renameSession:w,variant:k=`sidebar`}){let{t:A}=t(),j=y(e=>e.favoriteSessionIds),pe=y(e=>e.toggleFavoriteSession),M=y(e=>e.sessionNicknames),N=y(e=>e.setSessionNickname),me=y(e=>e.setInspectSession),[P,he]=(0,x.useState)(`all`),[F,ge]=(0,x.useState)(`recent`),[I,L]=(0,x.useState)(null),[R,z]=(0,x.useState)(``),[B,V]=(0,x.useState)(null),[H,U]=(0,x.useState)(1),W=(0,x.useRef)(null),G=(0,x.useRef)(null),K=k===`workspace`,q=(0,x.useCallback)(e=>e.name||M[e.id]||e.title||A(`activity:sessions.empty`),[M,A]),J=(0,x.useCallback)(e=>{L(e.id),z(e.name??M[e.id]??e.title??``)},[M]),Y=(0,x.useCallback)(e=>{L(null),N(e,R),w(e,R)},[R,w,N]);(0,x.useEffect)(()=>{B&&i.some(e=>e.id===B&&e.isCurrent)&&(V(null),W.current&&clearTimeout(W.current))},[i,B]),(0,x.useEffect)(()=>{I&&(G.current?.focus(),G.current?.select())},[I]),(0,x.useEffect)(()=>()=>{W.current&&clearTimeout(W.current)},[]);let X=(0,x.useCallback)(e=>{V(e),h(e),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>V(null),1e4)},[h]),Z=(0,x.useMemo)(()=>se(i),[i]),Q=(0,x.useMemo)(()=>ce(i,{query:e,filter:P,sort:F,favoriteIds:j}),[j,P,i,e,F]),$=K?oe:ae,_e=(0,x.useMemo)(()=>Q.slice((H-1)*$,H*$),[H,$,Q]),ve=(0,x.useMemo)(()=>le(_e,j),[j,_e]),ye=(0,x.useMemo)(()=>ue(i),[i]);(0,x.useEffect)(()=>{U(1)},[P,e,F]),(0,x.useEffect)(()=>{let e=Math.max(1,Math.ceil(Q.length/$));H>e&&U(e)},[H,$,Q.length]);let be=(0,x.useCallback)(async()=>{if(Z.length!==0&&await b({title:A(`activity:sessions.deleteEmptyTitle`,{count:Z.length}),message:A(`activity:sessions.deleteEmptyConfirmBody`),confirmLabel:A(`common:action.delete`),danger:!0}))for(let e of Z)C(e)},[C,Z,A]),xe=[{id:`all`,label:A(`activity:sessions.filters.all`,{defaultValue:`All`})},{id:`favorites`,label:A(`activity:sessions.filters.favorites`,{defaultValue:`Pinned`})},{id:`active`,label:A(`activity:sessions.filters.active`,{defaultValue:`Active`})},{id:`completed`,label:A(`activity:sessions.filters.completed`,{defaultValue:`Completed`})},{id:`issues`,label:A(`activity:sessions.filters.issues`,{defaultValue:`Issues`})}];return(0,S.jsxs)(`div`,{className:v(`flex min-h-0 min-w-0 flex-1 flex-col bg-background`,K&&`h-full`),"data-history-variant":k,children:[K?(0,S.jsx)(fe,{stats:ye}):null,(0,S.jsxs)(`div`,{className:v(`border-b border-border/75 bg-card`,K?`px-4 py-3`:`px-3 py-2`),children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:A(`activity:sessions.recentSessions`)}),K?(0,S.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:A(`activity:sessions.workspaceHint`,{defaultValue:`Search, inspect, pin and resume every project conversation.`})}):null]}),(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center border border-border/75`,children:[Z.length>0?(0,S.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:be,disabled:!c,title:A(`activity:sessions.deleteEmptyTitle`,{count:Z.length}),children:[(0,S.jsx)(p,{className:`h-3.5 w-3.5`}),K?(0,S.jsx)(`span`,{className:`text-[10px]`,children:Z.length}):null]}):null,(0,S.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:()=>l(200),disabled:!c,title:A(`common:action.refresh`),children:o?(0,S.jsx)(g,{className:`h-3.5 w-3.5 animate-spin`}):(0,S.jsx)(re,{className:`h-3.5 w-3.5`})})]})]}),(0,S.jsxs)(`div`,{className:v(`grid gap-2`,K?`mt-3 lg:grid-cols-[minmax(18rem,1fr)_auto_auto]`:`mt-2`),children:[(0,S.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,S.jsx)(u,{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,S.jsx)(`input`,{type:`search`,value:e,onChange:e=>r(e.target.value),placeholder:A(`activity:sessions.filterPlaceholder`),"aria-label":A(`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,S.jsx)(`button`,{type:`button`,onClick:()=>r(``),className:`absolute right-0 top-0 inline-flex h-9 w-8 items-center justify-center text-muted-foreground hover:text-foreground`,title:A(`activity:sessions.clearFilter`),children:(0,S.jsx)(ee,{className:`h-3.5 w-3.5`})}):null]}),(0,S.jsxs)(`fieldset`,{className:`flex min-w-0 overflow-x-auto border border-border/75`,children:[(0,S.jsx)(`legend`,{className:`sr-only`,children:A(`activity:sessionList.historyFilters`)}),xe.map(e=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>he(e.id),"aria-pressed":P===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`,P===e.id?`bg-foreground text-background`:`bg-background text-muted-foreground hover:bg-muted hover:text-foreground`),children:e.label},e.id))]}),(0,S.jsxs)(`select`,{value:F,onChange:e=>ge(e.target.value),"aria-label":A(`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,S.jsx)(`option`,{value:`recent`,children:A(`activity:sessions.sort.recent`,{defaultValue:`Recent`})}),(0,S.jsx)(`option`,{value:`tokens`,children:A(`activity:sessions.sort.tokens`,{defaultValue:`Most tokens`})}),(0,S.jsx)(`option`,{value:`activity`,children:A(`activity:sessions.sort.activity`,{defaultValue:`Most activity`})})]})]})]}),s?(0,S.jsx)(`div`,{className:`border-b border-destructive/30 bg-destructive/5 px-4 py-2 text-xs text-destructive`,children:s}):null,(0,S.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain overflow-x-hidden [scrollbar-gutter:stable]`,children:i.length===0&&!o?(0,S.jsxs)(`div`,{className:`flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center text-muted-foreground`,children:[(0,S.jsx)(f,{className:`h-9 w-9 opacity-25`}),(0,S.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:A(`activity:sessions.noHistory`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs`,children:A(`activity:sessions.noHistoryHint`)})]}):ve.length===0?(0,S.jsxs)(`div`,{className:`flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center text-muted-foreground`,children:[(0,S.jsx)(u,{className:`h-9 w-9 opacity-25`}),(0,S.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:A(`activity:sessions.noMatches`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs`,children:A(`activity:sessions.noMatchesHint`)})]}):(0,S.jsxs)(`div`,{className:v(K?`mx-auto w-full max-w-7xl p-4 lg:p-6`:`p-2`),children:[(0,S.jsx)(`div`,{className:v(`space-y-5`,K&&`grid gap-x-5 space-y-0 xl:grid-cols-2`),children:ve.map(e=>(0,S.jsxs)(`section`,{className:`min-w-0`,children:[(0,S.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,S.jsx)(_,{className:`h-3 w-3 fill-current`}):null,A(`activity:sessions.group.${e.label}`),(0,S.jsx)(`span`,{className:`ml-1 font-mono font-normal text-muted-foreground`,children:e.rows.length})]}),(0,S.jsx)(`div`,{className:`divide-y divide-border/75 border-x border-b border-border/75`,children:e.rows.map(e=>{let t=j.includes(e.id),r=de(e),i=r.icon,o=I===e.id,s=B===e.id;return(0,S.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,S.jsxs)(`div`,{className:`min-w-0 px-3 py-3`,children:[(0,S.jsx)(`label`,{className:`block text-[10px] font-semibold uppercase tracking-[0.1em] text-muted-foreground`,htmlFor:`session-name-${e.id}`,children:A(`activity:sessions.rename`,{defaultValue:`Session name`})}),(0,S.jsx)(`input`,{ref:G,id:`session-name-${e.id}`,value:R,onChange:e=>z(e.target.value),onBlur:()=>Y(e.id),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),Y(e.id)):t.key===`Escape`&&(t.preventDefault(),L(null))},placeholder:e.title||A(`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,S.jsx)(`button`,{type:`button`,disabled:e.isCurrent||B!==null,onClick:()=>X(e.id),onDoubleClick:()=>J(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,S.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,S.jsx)(`span`,{className:v(`mt-0.5 shrink-0`,r.className),title:A(`activity:sessions.status.${r.label}`,{defaultValue:r.defaultLabel}),children:(0,S.jsx)(i,{className:v(`h-3.5 w-3.5`,e.isCurrent&&`animate-pulse`)})}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:`truncate text-sm font-semibold text-foreground`,title:q(e),children:q(e)}),(0,S.jsxs)(`div`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:[e.provider,`/`,e.model]}),e.lastUserMessage?(0,S.jsx)(`div`,{className:`mt-1 truncate text-xs text-muted-foreground`,title:e.lastUserMessage,children:e.lastUserMessage}):null,(0,S.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,S.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-sans font-semibold text-primary`,children:[(0,S.jsx)(g,{className:`h-3 w-3 animate-spin`}),A(`activity:sessions.resuming`)]}):(0,S.jsx)(`span`,{title:new Date(E(e)).toLocaleString(),children:T(E(e))}),(0,S.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,S.jsx)(`span`,{children:D(e)}),e.tokenTotal>0?(0,S.jsxs)(`span`,{children:[O(e.tokenTotal),` tok`]}):null,(e.messageCount??0)>0?(0,S.jsxs)(`span`,{children:[O(e.messageCount??0),` msg`]}):null,(e.toolCallCount??0)>0?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,S.jsx)(d,{className:`h-3 w-3`}),e.toolCallCount]}):null,(e.fileChangeCount??0)>0?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,S.jsx)(m,{className:`h-3 w-3`}),e.fileChangeCount]}):null,(e.toolErrorCount??0)>0?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-destructive`,children:[(0,S.jsx)(a,{className:`h-3 w-3`}),e.toolErrorCount]}):null]})]})]})}),(0,S.jsxs)(`div`,{className:`flex items-start gap-0.5 p-2`,children:[!e.isCurrent&&K&&!o?(0,S.jsxs)(`button`,{type:`button`,onClick:()=>X(e.id),disabled:B!==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:A(`activity:sessions.resume`,{defaultValue:`Resume session`}),children:[(0,S.jsx)(n,{className:`h-3 w-3`}),A(`activity:sessions.resumeShort`,{defaultValue:`Resume`})]}):null,o?null:(0,S.jsx)(`button`,{type:`button`,onClick:()=>me(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:A(`activity:sessions.inspect`,{defaultValue:`Inspect session`}),children:(0,S.jsx)(ne,{className:`h-3.5 w-3.5`})}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>pe(e.id),"aria-pressed":t,className:v(`inline-flex h-7 w-7 items-center justify-center transition-colors hover:bg-warning/10 hover:text-warning`,t?`text-warning`:`text-muted-foreground`),title:A(t?`activity:sessions.unfavorite`:`activity:sessions.markFavorite`),children:(0,S.jsx)(_,{className:v(`h-3.5 w-3.5`,t&&`fill-current`)})}),o?null:(0,S.jsx)(`button`,{type:`button`,onClick:()=>J(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:A(`activity:sessions.renameAction`,{defaultValue:`Rename`}),children:(0,S.jsx)(te,{className:`h-3.5 w-3.5`})}),e.isCurrent?null:(0,S.jsx)(`button`,{type:`button`,onClick:async()=>{await b({title:A(`activity:sessions.deleteSessionConfirmTitle`),message:A(`activity:sessions.deleteSessionConfirmBody`,{name:q(e)}),confirmLabel:A(`common:action.delete`),danger:!0})&&C(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:A(`activity:sessions.deleteSessionTitle`),children:(0,S.jsx)(p,{className:`h-3.5 w-3.5`})})]})]},e.id)})})]},e.label))}),(0,S.jsx)(ie,{page:H,pageSize:$,totalItems:Q.length,onPageChange:U,compact:!K,itemLabel:`sessions`})]})})]})}export{D as i,O as n,T as r,k as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ci as n,Ga as r,Gi as i,Ji as a,Jr as o,La as s,Ni as c,Pa as l,Ua as u,Xi as d,bn as f,hn as p,lt as m,mt as h,or as g,pt as _}from"./vendor-C_zEzV4N.js";import"./i18n-O7wMOn8G.js";import{t as v}from"./useWebSocket-7Vm7doHG.js";import{t as y}from"./utils-tsZEnrBH.js";import{t as b}from"./session-store-BgiP4PnQ.js";import{I as x,h as S}from"./stores-CmkcHezT.js";import{C,E as w,T,b as E,c as D,w as O}from"./index-CzVjuusy.js";import{t as k}from"./SessionList-CwVI8eZL.js";var A=e(r(),1),j=m(),M=12;async function N(e){try{let t=await e.clone().json(),n=typeof t.error==`string`?t.error:t.message;if(typeof n==`string`&&n.trim())return n}catch{try{let t=await e.text();if(t.trim())return t.trim()}catch{}}return e.statusText||`HTTP ${e.status}`}function P(e){switch(e){case`running`:return{icon:(0,j.jsx)(l,{className:`h-3.5 w-3.5`}),cls:`text-success`};case`streaming`:return{icon:(0,j.jsx)(f,{className:`h-3.5 w-3.5`}),cls:`text-primary`};case`waiting_user`:return{icon:(0,j.jsx)(c,{className:`h-3.5 w-3.5`}),cls:`text-warning`};case`error`:return{icon:(0,j.jsx)(d,{className:`h-3.5 w-3.5`}),cls:`text-destructive`};case`idle`:return{icon:(0,j.jsx)(i,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`};default:return{icon:(0,j.jsx)(a,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`}}}function F(e){switch(e){case`active`:return{icon:(0,j.jsx)(_,{className:`h-3.5 w-3.5`}),cls:`text-success`,badge:`border-success/25 bg-success/8 text-success`};case`idle`:return{icon:(0,j.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-primary`,badge:`border-primary/25 bg-primary/10 text-primary`};case`closing`:return{icon:(0,j.jsx)(c,{className:`h-3.5 w-3.5`}),cls:`text-warning`,badge:`border-warning/25 bg-warning/10 text-warning`};case`lost`:return{icon:(0,j.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-destructive/60`,badge:`border-destructive/15 bg-destructive/5 text-destructive/70`};default:return{icon:(0,j.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`,badge:`border-border bg-muted text-muted-foreground`}}}function I(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`<1m`;if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d`}function L(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/1e3);if(n<10)return u.t(`common:time.justNow`);if(n<60)return u.t(`common:time.secondsAgo`,{count:n});let r=Math.floor(n/60);return r<60?u.t(`common:time.minutesAgo`,{count:r}):u.t(`common:time.hoursAgo`,{count:Math.floor(r/60)})}function R(){let e=x(e=>e.wsConnected),t=b(e=>e.session?.id),{entries:n,loading:r,error:i}=S(s(e=>({entries:e.entries,loading:e.loading,error:e.error}))),{listSessions:a,resumeSession:o,deleteSession:c,renameSession:l}=v(),[u,d]=(0,A.useState)(``);return(0,A.useEffect)(()=>{e&&a(200)},[t,a,e]),(0,j.jsx)(k,{historyQuery:u,setHistoryQuery:d,historyEntries:n,historyLoading:r,historyError:i,wsConnected:e,listSessions:a,resumeSession:o,deleteSession:c,renameSession:l,variant:`workspace`})}function z(){let{t:e}=t();return(0,j.jsxs)(C,{defaultValue:`history`,className:`flex h-full min-h-0 flex-col bg-background`,"data-testid":`sessions-workspace`,children:[(0,j.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b border-border/75 bg-card px-4 py-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-primary`,children:e(`activity:sessions.workspaceEyebrow`,{defaultValue:`Conversation control`})}),(0,j.jsx)(`h1`,{className:`mt-0.5 text-lg font-semibold tracking-tight`,children:e(`activity:sessions.workspaceTitle`,{defaultValue:`Sessions`})})]}),(0,j.jsxs)(T,{className:`h-9 min-h-9 justify-start border-border/75 bg-background p-0 shadow-none`,children:[(0,j.jsxs)(w,{value:`history`,className:`h-9 gap-1.5 border-r border-border/75 px-3 text-xs shadow-none data-[state=active]:bg-foreground data-[state=active]:text-background data-[state=active]:ring-0`,children:[(0,j.jsx)(p,{className:`h-3.5 w-3.5`}),e(`activity:sessions.tabs.history`,{defaultValue:`History`})]}),(0,j.jsxs)(w,{value:`live`,className:`h-9 gap-1.5 px-3 text-xs shadow-none data-[state=active]:bg-foreground data-[state=active]:text-background data-[state=active]:ring-0`,children:[(0,j.jsx)(f,{className:`h-3.5 w-3.5`}),e(`activity:sessions.tabs.live`,{defaultValue:`Live sessions`})]})]})]}),(0,j.jsx)(O,{value:`history`,className:`mt-0 min-h-0 flex-1 overflow-hidden ring-0`,children:(0,j.jsx)(R,{})}),(0,j.jsx)(O,{value:`live`,className:`mt-0 min-h-0 flex-1 overflow-hidden ring-0`,children:(0,j.jsx)(B,{})})]})}function B(){let{t:e}=t(),[r,i]=(0,A.useState)([]),[a,s]=(0,A.useState)(!0),[l,u]=(0,A.useState)(null),[f,p]=(0,A.useState)(1),m=D(`sessions`,!a&&!l&&r.length>0),v=(0,A.useCallback)(async()=>{try{let e=await fetch(`/api/sessions`);if(!e.ok){if(e.status===404){u(null),i([]);return}throw Error(`HTTP ${e.status}: ${await N(e)}`)}if(!(e.headers.get(`content-type`)?.toLowerCase()??``).includes(`application/json`)){u(null),i([]);return}let t=await e.json();if(!Array.isArray(t)){u(null),i([]);return}i(e=>{let n=t;if(e.length===n.length){let t=!0;for(let r=0;r<n.length;r++){let i=n[r],a=e[r];if(i.sessionId!==a.sessionId||i.status!==a.status||i.agentCount!==a.agentCount||i.startedAt!==a.startedAt){t=!1;break}}if(t)return e}return n}),u(null)}catch(e){if(e instanceof SyntaxError){u(null),i([]);return}u(e instanceof Error?e.message:String(e))}finally{s(!1)}},[]);(0,A.useEffect)(()=>{v();let e=setInterval(v,5e3);return()=>clearInterval(e)},[v]);let b=r.filter(e=>e.status===`active`).length,x=r.reduce((e,t)=>e+t.agentCount,0),S=r.slice((f-1)*M,f*M);return(0,A.useEffect)(()=>{let e=Math.max(1,Math.ceil(r.length/M));f>e&&p(e)},[f,r.length]),a?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface flex items-center gap-2 px-4 py-3 text-sm text-muted-foreground`,children:[(0,j.jsx)(g,{className:`h-4 w-4 animate-spin text-primary`}),e(`activity:liveSessions.loading`)]})}):l?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface max-w-lg p-5 text-center`,children:[(0,j.jsx)(d,{className:`mx-auto h-8 w-8 text-warning`}),(0,j.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e(`activity:liveSessions.apiUnavailable`)}),(0,j.jsx)(`p`,{className:`mt-1 break-words text-xs text-muted-foreground`,children:l})]})}):r.length===0?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface max-w-md p-6 text-center text-muted-foreground`,children:[(0,j.jsx)(h,{className:`mx-auto h-9 w-9 opacity-50`}),(0,j.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:e(`activity:liveSessions.empty`)}),(0,j.jsx)(`p`,{className:`mt-1 text-xs`,children:e(`activity:liveSessions.autoRefresh`)})]})}):(0,j.jsx)(`div`,{ref:m,className:`h-full min-h-0 overflow-y-auto overscroll-contain bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,j.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col gap-4`,children:[(0,j.jsx)(`header`,{className:`border border-border/70 bg-card/75 p-4`,children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(_,{className:`h-4 w-4 text-primary`}),(0,j.jsx)(`h2`,{className:`text-base font-semibold`,children:e(`activity:liveSessions.heading`,{count:r.length})})]}),(0,j.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`activity:liveSessions.autoRefresh`)})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-center sm:min-w-[22rem]`,children:[(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:r.length}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.sessions`)})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-success`,children:b}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.active`)})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:x}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.agents`)})]})]})]})}),(0,j.jsx)(`div`,{className:`grid gap-3`,children:S.map(t=>{let r=F(t.status);return(0,j.jsxs)(`article`,{className:`border border-border/70 bg-card/75 p-3 sm:p-4`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:r.cls,children:r.icon}),(0,j.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold`,title:t.projectName,children:t.projectName}),(0,j.jsx)(`span`,{className:`bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:t.projectSlug}),(0,j.jsx)(`span`,{className:`inline-flex items-center border px-1.5 py-0.5 text-[10px] font-semibold uppercase ${r.badge}`,children:t.status})]}),(0,j.jsxs)(`div`,{className:`mt-2 grid gap-1.5 text-xs text-muted-foreground md:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,j.jsx)(n,{className:`h-3.5 w-3.5 shrink-0`}),(0,j.jsx)(`span`,{className:`min-w-0 truncate font-mono`,title:t.workingDir,children:t.workingDir})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[t.gitBranch?(0,j.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1 text-primary`,children:[(0,j.jsx)(o,{className:`h-3.5 w-3.5 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate font-mono`,children:t.gitBranch})]}):null,(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,j.jsx)(c,{className:`h-3.5 w-3.5`}),I(t.startedAt)]}),(0,j.jsx)(`span`,{className:`font-mono`,children:e(`activity:liveSessions.pidLabel`,{pid:t.pid})})]})]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs sm:grid-cols-3 lg:w-64`,children:[(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.agents`)}),(0,j.jsx)(`div`,{className:`font-semibold tabular-nums`,children:t.agentCount})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.status`)}),(0,j.jsx)(`div`,{className:`truncate font-mono font-semibold`,children:t.status})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.runtime`)}),(0,j.jsx)(`div`,{className:`font-mono font-semibold`,children:I(t.startedAt)})]})]})]}),(0,j.jsxs)(`div`,{className:`mt-3 overflow-hidden border border-border/70 bg-background/45`,children:[t.agents.length===0?(0,j.jsx)(`div`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e(`activity:liveSessions.noAgents`)}):(0,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:t.agents.slice(0,5).map(t=>{let n=P(t.status);return(0,j.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1 px-3 py-2 text-xs sm:grid-cols-[auto_minmax(0,1fr)_minmax(0,14rem)_auto]`,children:[(0,j.jsx)(`span`,{className:y(`mt-0.5 shrink-0`,n.cls),children:n.icon}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`truncate font-medium`,title:t.name,children:t.name}),(0,j.jsx)(`div`,{className:`font-mono text-[10px] text-muted-foreground`,children:e(`activity:liveSessions.agentMeta`,{iter:t.iterations,tools:t.toolCalls,ago:L(t.lastActivityAt)})})]}),(0,j.jsx)(`div`,{className:`min-w-0 font-mono text-[10px] text-muted-foreground sm:text-xs`,children:t.currentTool?(0,j.jsx)(`span`,{className:`block truncate`,title:t.currentTool,children:t.currentTool}):(0,j.jsx)(`span`,{className:`text-muted-foreground/75`,children:t.status})}),(0,j.jsx)(`span`,{className:`hidden font-mono text-[10px] text-muted-foreground sm:block`,children:L(t.lastActivityAt)})]},t.id)})}),t.agents.length>5?(0,j.jsx)(`div`,{className:`border-t border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:e(`activity:liveSessions.andMore`,{count:t.agents.length-5})}):null]})]},t.sessionId)})}),(0,j.jsx)(E,{page:f,pageSize:M,totalItems:r.length,onPageChange:p,itemLabel:`sessions`})]})})}export{z as SessionsDashboard};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ci as n,Ga as r,Gi as i,Ji as a,Jr as o,La as s,Ni as c,Pa as l,Ua as u,Xi as d,bn as f,hn as p,lt as m,mt as h,or as g,pt as _}from"./vendor-C_zEzV4N.js";import"./i18n-CDoHRskt.js";import{t as v}from"./useWebSocket-BFFntyS4.js";import{t as y}from"./utils-tsZEnrBH.js";import{t as b}from"./session-store-BgiP4PnQ.js";import{I as x,h as S}from"./stores-DSGsI875.js";import{C,E as w,T,b as E,c as D,w as O}from"./index-BRJ_UrGk.js";import{t as k}from"./SessionList-BRbF7FVS.js";var A=e(r(),1),j=m(),M=12;async function N(e){try{let t=await e.clone().json(),n=typeof t.error==`string`?t.error:t.message;if(typeof n==`string`&&n.trim())return n}catch{try{let t=await e.text();if(t.trim())return t.trim()}catch{}}return e.statusText||`HTTP ${e.status}`}function P(e){switch(e){case`running`:return{icon:(0,j.jsx)(l,{className:`h-3.5 w-3.5`}),cls:`text-success`};case`streaming`:return{icon:(0,j.jsx)(f,{className:`h-3.5 w-3.5`}),cls:`text-primary`};case`waiting_user`:return{icon:(0,j.jsx)(c,{className:`h-3.5 w-3.5`}),cls:`text-warning`};case`error`:return{icon:(0,j.jsx)(d,{className:`h-3.5 w-3.5`}),cls:`text-destructive`};case`idle`:return{icon:(0,j.jsx)(i,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`};default:return{icon:(0,j.jsx)(a,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`}}}function F(e){switch(e){case`active`:return{icon:(0,j.jsx)(_,{className:`h-3.5 w-3.5`}),cls:`text-success`,badge:`border-success/25 bg-success/8 text-success`};case`idle`:return{icon:(0,j.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-primary`,badge:`border-primary/25 bg-primary/10 text-primary`};case`closing`:return{icon:(0,j.jsx)(c,{className:`h-3.5 w-3.5`}),cls:`text-warning`,badge:`border-warning/25 bg-warning/10 text-warning`};case`lost`:return{icon:(0,j.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-destructive/60`,badge:`border-destructive/15 bg-destructive/5 text-destructive/70`};default:return{icon:(0,j.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`,badge:`border-border bg-muted text-muted-foreground`}}}function I(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`<1m`;if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d`}function L(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/1e3);if(n<10)return u.t(`common:time.justNow`);if(n<60)return u.t(`common:time.secondsAgo`,{count:n});let r=Math.floor(n/60);return r<60?u.t(`common:time.minutesAgo`,{count:r}):u.t(`common:time.hoursAgo`,{count:Math.floor(r/60)})}function R(){let e=x(e=>e.wsConnected),t=b(e=>e.session?.id),{entries:n,loading:r,error:i}=S(s(e=>({entries:e.entries,loading:e.loading,error:e.error}))),{listSessions:a,resumeSession:o,deleteSession:c,renameSession:l}=v(),[u,d]=(0,A.useState)(``);return(0,A.useEffect)(()=>{e&&a(200)},[t,a,e]),(0,j.jsx)(k,{historyQuery:u,setHistoryQuery:d,historyEntries:n,historyLoading:r,historyError:i,wsConnected:e,listSessions:a,resumeSession:o,deleteSession:c,renameSession:l,variant:`workspace`})}function z(){let{t:e}=t();return(0,j.jsxs)(C,{defaultValue:`history`,className:`flex h-full min-h-0 flex-col bg-background`,"data-testid":`sessions-workspace`,children:[(0,j.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b border-border/75 bg-card px-4 py-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-primary`,children:e(`activity:sessions.workspaceEyebrow`,{defaultValue:`Conversation control`})}),(0,j.jsx)(`h1`,{className:`mt-0.5 text-lg font-semibold tracking-tight`,children:e(`activity:sessions.workspaceTitle`,{defaultValue:`Sessions`})})]}),(0,j.jsxs)(T,{className:`h-9 min-h-9 justify-start border-border/75 bg-background p-0 shadow-none`,children:[(0,j.jsxs)(w,{value:`history`,className:`h-9 gap-1.5 border-r border-border/75 px-3 text-xs shadow-none data-[state=active]:bg-foreground data-[state=active]:text-background data-[state=active]:ring-0`,children:[(0,j.jsx)(p,{className:`h-3.5 w-3.5`}),e(`activity:sessions.tabs.history`,{defaultValue:`History`})]}),(0,j.jsxs)(w,{value:`live`,className:`h-9 gap-1.5 px-3 text-xs shadow-none data-[state=active]:bg-foreground data-[state=active]:text-background data-[state=active]:ring-0`,children:[(0,j.jsx)(f,{className:`h-3.5 w-3.5`}),e(`activity:sessions.tabs.live`,{defaultValue:`Live sessions`})]})]})]}),(0,j.jsx)(O,{value:`history`,className:`mt-0 min-h-0 flex-1 overflow-hidden ring-0`,children:(0,j.jsx)(R,{})}),(0,j.jsx)(O,{value:`live`,className:`mt-0 min-h-0 flex-1 overflow-hidden ring-0`,children:(0,j.jsx)(B,{})})]})}function B(){let{t:e}=t(),[r,i]=(0,A.useState)([]),[a,s]=(0,A.useState)(!0),[l,u]=(0,A.useState)(null),[f,p]=(0,A.useState)(1),m=D(`sessions`,!a&&!l&&r.length>0),v=(0,A.useCallback)(async()=>{try{let e=await fetch(`/api/sessions`);if(!e.ok){if(e.status===404){u(null),i([]);return}throw Error(`HTTP ${e.status}: ${await N(e)}`)}if(!(e.headers.get(`content-type`)?.toLowerCase()??``).includes(`application/json`)){u(null),i([]);return}let t=await e.json();if(!Array.isArray(t)){u(null),i([]);return}i(e=>{let n=t;if(e.length===n.length){let t=!0;for(let r=0;r<n.length;r++){let i=n[r],a=e[r];if(i.sessionId!==a.sessionId||i.status!==a.status||i.agentCount!==a.agentCount||i.startedAt!==a.startedAt){t=!1;break}}if(t)return e}return n}),u(null)}catch(e){if(e instanceof SyntaxError){u(null),i([]);return}u(e instanceof Error?e.message:String(e))}finally{s(!1)}},[]);(0,A.useEffect)(()=>{v();let e=setInterval(v,5e3);return()=>clearInterval(e)},[v]);let b=r.filter(e=>e.status===`active`).length,x=r.reduce((e,t)=>e+t.agentCount,0),S=r.slice((f-1)*M,f*M);return(0,A.useEffect)(()=>{let e=Math.max(1,Math.ceil(r.length/M));f>e&&p(e)},[f,r.length]),a?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface flex items-center gap-2 px-4 py-3 text-sm text-muted-foreground`,children:[(0,j.jsx)(g,{className:`h-4 w-4 animate-spin text-primary`}),e(`activity:liveSessions.loading`)]})}):l?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface max-w-lg p-5 text-center`,children:[(0,j.jsx)(d,{className:`mx-auto h-8 w-8 text-warning`}),(0,j.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e(`activity:liveSessions.apiUnavailable`)}),(0,j.jsx)(`p`,{className:`mt-1 break-words text-xs text-muted-foreground`,children:l})]})}):r.length===0?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface max-w-md p-6 text-center text-muted-foreground`,children:[(0,j.jsx)(h,{className:`mx-auto h-9 w-9 opacity-50`}),(0,j.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:e(`activity:liveSessions.empty`)}),(0,j.jsx)(`p`,{className:`mt-1 text-xs`,children:e(`activity:liveSessions.autoRefresh`)})]})}):(0,j.jsx)(`div`,{ref:m,className:`h-full min-h-0 overflow-y-auto overscroll-contain bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,j.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col gap-4`,children:[(0,j.jsx)(`header`,{className:`border border-border/70 bg-card/75 p-4`,children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(_,{className:`h-4 w-4 text-primary`}),(0,j.jsx)(`h2`,{className:`text-base font-semibold`,children:e(`activity:liveSessions.heading`,{count:r.length})})]}),(0,j.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`activity:liveSessions.autoRefresh`)})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-center sm:min-w-[22rem]`,children:[(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:r.length}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.sessions`)})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-success`,children:b}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.active`)})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:x}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.agents`)})]})]})]})}),(0,j.jsx)(`div`,{className:`grid gap-3`,children:S.map(t=>{let r=F(t.status);return(0,j.jsxs)(`article`,{className:`border border-border/70 bg-card/75 p-3 sm:p-4`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:r.cls,children:r.icon}),(0,j.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold`,title:t.projectName,children:t.projectName}),(0,j.jsx)(`span`,{className:`bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:t.projectSlug}),(0,j.jsx)(`span`,{className:`inline-flex items-center border px-1.5 py-0.5 text-[10px] font-semibold uppercase ${r.badge}`,children:t.status})]}),(0,j.jsxs)(`div`,{className:`mt-2 grid gap-1.5 text-xs text-muted-foreground md:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,j.jsx)(n,{className:`h-3.5 w-3.5 shrink-0`}),(0,j.jsx)(`span`,{className:`min-w-0 truncate font-mono`,title:t.workingDir,children:t.workingDir})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[t.gitBranch?(0,j.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1 text-primary`,children:[(0,j.jsx)(o,{className:`h-3.5 w-3.5 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate font-mono`,children:t.gitBranch})]}):null,(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,j.jsx)(c,{className:`h-3.5 w-3.5`}),I(t.startedAt)]}),(0,j.jsx)(`span`,{className:`font-mono`,children:e(`activity:liveSessions.pidLabel`,{pid:t.pid})})]})]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs sm:grid-cols-3 lg:w-64`,children:[(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.agents`)}),(0,j.jsx)(`div`,{className:`font-semibold tabular-nums`,children:t.agentCount})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.status`)}),(0,j.jsx)(`div`,{className:`truncate font-mono font-semibold`,children:t.status})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.runtime`)}),(0,j.jsx)(`div`,{className:`font-mono font-semibold`,children:I(t.startedAt)})]})]})]}),(0,j.jsxs)(`div`,{className:`mt-3 overflow-hidden border border-border/70 bg-background/45`,children:[t.agents.length===0?(0,j.jsx)(`div`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e(`activity:liveSessions.noAgents`)}):(0,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:t.agents.slice(0,5).map(t=>{let n=P(t.status);return(0,j.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1 px-3 py-2 text-xs sm:grid-cols-[auto_minmax(0,1fr)_minmax(0,14rem)_auto]`,children:[(0,j.jsx)(`span`,{className:y(`mt-0.5 shrink-0`,n.cls),children:n.icon}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`truncate font-medium`,title:t.name,children:t.name}),(0,j.jsx)(`div`,{className:`font-mono text-[10px] text-muted-foreground`,children:e(`activity:liveSessions.agentMeta`,{iter:t.iterations,tools:t.toolCalls,ago:L(t.lastActivityAt)})})]}),(0,j.jsx)(`div`,{className:`min-w-0 font-mono text-[10px] text-muted-foreground sm:text-xs`,children:t.currentTool?(0,j.jsx)(`span`,{className:`block truncate`,title:t.currentTool,children:t.currentTool}):(0,j.jsx)(`span`,{className:`text-muted-foreground/75`,children:t.status})}),(0,j.jsx)(`span`,{className:`hidden font-mono text-[10px] text-muted-foreground sm:block`,children:L(t.lastActivityAt)})]},t.id)})}),t.agents.length>5?(0,j.jsx)(`div`,{className:`border-t border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:e(`activity:liveSessions.andMore`,{count:t.agents.length-5})}):null]})]},t.sessionId)})}),(0,j.jsx)(E,{page:f,pageSize:M,totalItems:r.length,onPageChange:p,itemLabel:`sessions`})]})})}export{z as SessionsDashboard};
|