@wrongstack/webui 1.0.24 → 1.0.27
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-BJ-1SQOm.js +12 -0
- package/dist/assets/{AnalyticsDashboard-DgqJODVI.js → AnalyticsDashboard-FYrD8BFQ.js} +1 -1
- package/dist/assets/AudienceMemoryPanel-BghMZicW.js +3 -0
- package/dist/assets/ChangesView-B3uQtZGR.js +3 -0
- package/dist/assets/ChimeraReviewsView-CBRbTHGM.js +1 -0
- package/dist/assets/ChronicleDashboard-B1E-_u64.js +1 -0
- package/dist/assets/CodeEditor-CbcWuMGV.js +2 -0
- package/dist/assets/CodeMap-WOfveRTG.js +1 -0
- package/dist/assets/{CronJobsPanel-GTK038V9.js → CronJobsPanel-DOFA5WVq.js} +1 -1
- package/dist/assets/{DeadCodeScanPanel-DX4OEuyp.js → DeadCodeScanPanel-4ToPZX7e.js} +1 -1
- package/dist/assets/{DebugDashboard-CKp3sa_k.js → DebugDashboard-DAsNHSpG.js} +1 -1
- package/dist/assets/{DesignGalleryView-DVUTYaP6.js → DesignGalleryView-Dd5YnKhs.js} +1 -1
- package/dist/assets/GoalView-BaDGAXuQ.js +1 -0
- package/dist/assets/KanbanView-CG8bVhpR.js +3 -0
- package/dist/assets/{MailboxDetailView-CylnzTVc.js → MailboxDetailView-COxz-eEJ.js} +1 -1
- package/dist/assets/{MemoryDrawer-DJ0Y98Z8.js → MemoryDrawer-4lDXuHCi.js} +1 -1
- package/dist/assets/MemoryManager-DQlnpch1.js +1 -0
- package/dist/assets/{ProcessMonitor-BnQ3vJtn.js → ProcessMonitor-BUjfYqG3.js} +1 -1
- package/dist/assets/PromptJournalView-o2dmPrwg.js +1 -0
- package/dist/assets/ProviderTestView-5wNbI46L.js +1 -0
- package/dist/assets/QueuePanel-DP9D99DX.js +1 -0
- package/dist/assets/{RefreshDebugView-s6MyGpPq.js → RefreshDebugView-CB7_a_TI.js} +1 -1
- package/dist/assets/{RepositoryHistoryView-CWi_Zo3F.js → RepositoryHistoryView-C_zpYLY6.js} +2 -2
- package/dist/assets/RequirementIntakeView-CahKEHJn.js +1 -0
- package/dist/assets/{SageTabs-D6eTg3ix.js → SageTabs-5Z2PR11S.js} +2 -2
- package/dist/assets/{SddFlowGraph-B-ptkFX6.js → SddFlowGraph-DSoWnlIt.js} +1 -1
- package/dist/assets/SddHub-0q2EpwYz.js +2 -0
- package/dist/assets/{SessionInspectView-NSpj5WEN.js → SessionInspectView-CbDFR_tP.js} +1 -1
- package/dist/assets/SessionList-DhQK7JnP.js +1 -0
- package/dist/assets/{SessionsDashboard-mF4PzdKY.js → SessionsDashboard-DNLDczSd.js} +1 -1
- package/dist/assets/SetupScreen-C-hpHQQ9.js +1 -0
- package/dist/assets/{SkillDetailView-B9BFyB1i.js → SkillDetailView-Bir-Kdm4.js} +3 -3
- package/dist/assets/TechStackView-CJ3Abnwg.js +2 -0
- package/dist/assets/TerminalPanel-8WHNTeQK.js +1 -0
- package/dist/assets/activity-B9WjS_Cz.js +10 -0
- package/dist/assets/activity-BB7AHL0U.js +10 -0
- package/dist/assets/activity-Bd0XmdqX.js +10 -0
- package/dist/assets/activity-BvmJte2K.js +10 -0
- package/dist/assets/activity-DOEbDWqw.js +10 -0
- package/dist/assets/activity-beTxIN7V.js +10 -0
- package/dist/assets/activity-t-0KDhv5.js +10 -0
- package/dist/assets/{button-BbeB5Qm8.js → button-UuKTnoM-.js} +1 -1
- package/dist/assets/chat-9GLubejR.js +1 -0
- package/dist/assets/chat-B50ssTLh.js +1 -0
- package/dist/assets/chat-CDioiM1L.js +1 -0
- package/dist/assets/chat-Cll_3gXD.js +1 -0
- package/dist/assets/chat-Cqhc6jQa.js +1 -0
- package/dist/assets/chat-DN1MggWt.js +1 -0
- package/dist/assets/chat-fyvZyUZM.js +1 -0
- package/dist/assets/chat-store-BMwP_sS0.js +1 -0
- package/dist/assets/{codemap-activity-store-Ha7XbGgq.js → codemap-activity-store-WjfEZe4_.js} +1 -1
- package/dist/assets/{common-DvjdaRhB.js → common-2kj0c3pG.js} +1 -1
- package/dist/assets/{common-D0QL7rwb.js → common-BAvh8XBp.js} +1 -1
- package/dist/assets/{common-opV6EoLd.js → common-CKwGvEQD.js} +1 -1
- package/dist/assets/{common-DJRPtYAt.js → common-CUd7l34J.js} +1 -1
- package/dist/assets/{common-BtyQBZBN.js → common-DmS4Wp1i.js} +1 -1
- package/dist/assets/common-PC103akE.js +1 -0
- package/dist/assets/{common-Bjl7V12m.js → common-zatZ4s-Z.js} +1 -1
- package/dist/assets/config-store-Cb4iyhGv.js +21 -0
- package/dist/assets/{dialog-b-Ai37sa.js → dialog-BDUaV5gY.js} +1 -1
- package/dist/assets/{empty-state-pfuS5znr.js → empty-state-BzoEa04Q.js} +1 -1
- package/dist/assets/{fonts-DRGbd-AM.js → fonts-C303yVU_.js} +2 -2
- package/dist/assets/i18n-CzTjKT4L.js +3 -0
- package/dist/assets/index-Ci22AODp.js +182 -0
- package/dist/assets/index-DfU9PQg8.css +1 -0
- package/dist/assets/{input-BA6D2L3K.js → input-DMnC2O7-.js} +1 -1
- package/dist/assets/{mailbox-store-ZQO_Rv6E.js → mailbox-store-DyOOYbni.js} +1 -1
- package/dist/assets/{roster-ws-Cv_PHlEV.js → roster-ws-D-DCMdrg.js} +1 -1
- package/dist/assets/settings-7W0ofid0.js +1 -0
- package/dist/assets/settings-BAArGYGW.js +1 -0
- package/dist/assets/settings-Btyr_M2v.js +1 -0
- package/dist/assets/settings-BwL_DVmc.js +1 -0
- package/dist/assets/settings-C7ybAkyi.js +1 -0
- package/dist/assets/settings-CgtL8eYb.js +1 -0
- package/dist/assets/settings-D57Fd8Z8.js +1 -0
- package/dist/assets/{shared-BFJvAYzX.js → shared-CLNEiW00.js} +1 -1
- package/dist/assets/stores-Svlibwo5.js +7 -0
- package/dist/assets/toasts-3tM1krOo.js +1 -0
- package/dist/assets/toasts-BrHW33qA.js +1 -0
- package/dist/assets/toasts-Buww129h.js +1 -0
- package/dist/assets/toasts-CSN9Fy47.js +1 -0
- package/dist/assets/toasts-DOoYxbHd.js +1 -0
- package/dist/assets/toasts-DkDnbhs_.js +1 -0
- package/dist/assets/toasts-Jo4VH13n.js +1 -0
- package/dist/assets/ui-store-DI0iusYZ.js +1 -0
- package/dist/assets/{utils-CKsqCaP8.js → utils-B21Devim.js} +1 -1
- package/dist/assets/{vector-memory-panel-YWv6xcza.js → vector-memory-panel-DnX-ODHC.js} +1 -1
- package/dist/assets/{vendor-V3ydTHqN.js → vendor-BfBvt432.js} +28 -28
- package/dist/assets/{view-navigation-CpIPxhZp.js → view-navigation-Cvrp_uJm.js} +1 -1
- package/dist/components/BrowserLivePane.d.ts +2 -0
- package/dist/components/ChangesView.d.ts +3 -1
- package/dist/components/ChatInput/chat-input-bars.d.ts +1 -1
- package/dist/components/ChatInput/image-attachments.d.ts +19 -2
- package/dist/components/ChatInput/slash-routing.d.ts +18 -0
- package/dist/components/ChatInput/use-paste-drop.d.ts +3 -0
- package/dist/components/ChatInput/use-prompt-queue-view.d.ts +13 -0
- package/dist/components/ChatView/BackgroundShellStrip.d.ts +16 -0
- package/dist/components/ChatView/TerminalStrip.d.ts +8 -0
- package/dist/components/CodeMap.d.ts +0 -12
- package/dist/components/GoalPanel.d.ts +2 -1
- package/dist/components/ImageDiffView.d.ts +12 -0
- package/dist/components/KanbanTaskExecution.d.ts +64 -0
- package/dist/components/KanbanTaskInspector.d.ts +1 -1
- package/dist/components/MessageBubble/AttachmentGallery.d.ts +1 -1
- package/dist/components/MessageBubble/FailedRunContinue.d.ts +7 -3
- package/dist/components/MessageBubble/GeneratedImagePreview.d.ts +10 -0
- package/dist/components/SessionTabBar/summaries.d.ts +4 -0
- package/dist/components/SettingsPanel/LimitsSection.d.ts +7 -0
- package/dist/components/SettingsPanel/MCPSection.d.ts +1 -37
- package/dist/components/SettingsPanel/MCPServerCards.d.ts +67 -0
- package/dist/components/SettingsPanel/MCPServerDialog.d.ts +11 -0
- package/dist/components/SettingsPanel/PreferenceControls.d.ts +8 -0
- package/dist/components/SettingsPanel/ProviderSavedProfiles.d.ts +50 -0
- package/dist/components/SettingsPanel/ProviderSection.d.ts +2 -79
- package/dist/components/SettingsPanel/SettingsNavigation.d.ts +12 -0
- package/dist/components/SettingsPanel/brain-section-options.d.ts +1 -2
- package/dist/components/SettingsPanel/provider-section-types.d.ts +79 -0
- package/dist/components/SidePanel/SessionList.d.ts +1 -34
- package/dist/components/SidePanel/session-history.d.ts +61 -0
- package/dist/components/SystemPromptPresetEditor.d.ts +9 -0
- package/dist/components/TechStackView/AnalyzeControls.d.ts +25 -0
- package/dist/components/TechStackView/RemediationTab.d.ts +20 -0
- package/dist/components/TechStackView/TrendsTab.d.ts +17 -0
- package/dist/components/TerminalPanel.d.ts +8 -1
- package/dist/components/WorkspaceDock.d.ts +2 -2
- package/dist/components/review/ReviewDiff.d.ts +21 -0
- package/dist/components/review/ReviewTray.d.ts +15 -0
- package/dist/components/review/review-diff-model.d.ts +31 -0
- package/dist/components/use-code-map-flow.d.ts +25 -0
- package/dist/components/use-office-map-canvas.d.ts +1 -1
- package/dist/components/use-office-map-topology.d.ts +31 -0
- package/dist/hooks/use-live-browser.d.ts +7 -0
- package/dist/hooks/useWebSocket.d.ts +1 -2
- package/dist/hooks/ws-handlers/chat-handlers.d.ts +12 -0
- package/dist/hooks/ws-handlers/goal-handlers.d.ts +2 -0
- package/dist/hooks/ws-handlers/mcp-status-handlers.d.ts +6 -0
- package/dist/hooks/ws-handlers/prompt-queue-handlers.d.ts +18 -0
- package/dist/hooks/ws-handlers/techstack-handlers.d.ts +7 -0
- package/dist/index.css +3013 -3013
- package/dist/index.html +19 -19
- package/dist/index.js +53010 -47407
- package/dist/lib/compact-file-tree.d.ts +30 -0
- package/dist/lib/project-image.d.ts +26 -0
- package/dist/lib/provider-warm.d.ts +3 -0
- package/dist/lib/ws-client-session-methods.d.ts +2 -0
- package/dist/lib/ws-client.d.ts +3 -0
- package/dist/stores/chat-lane-data.d.ts +153 -0
- package/dist/stores/chat-lanes.d.ts +3 -174
- package/dist/stores/chat-queue-helpers.d.ts +9 -0
- package/dist/stores/chat-store-types.d.ts +3 -0
- package/dist/stores/chat-store.d.ts +1 -1
- package/dist/stores/context-editor-store.d.ts +1 -1
- package/dist/stores/fleet-transcript.d.ts +14 -0
- package/dist/stores/git-changes-store.d.ts +3 -0
- package/dist/stores/goal-run-store.d.ts +8 -0
- package/dist/stores/goal-state-store.d.ts +3 -0
- package/dist/stores/goal-store.d.ts +9 -11
- package/dist/stores/index.d.ts +1 -1
- package/dist/stores/local-prefs-defaults.d.ts +341 -0
- package/dist/stores/local-prefs.d.ts +2 -318
- package/dist/stores/notification-store.d.ts +9 -0
- package/dist/stores/provider-quota-store.d.ts +5 -0
- package/dist/stores/review-store.d.ts +54 -0
- package/dist/stores/session-activity.d.ts +33 -0
- package/dist/stores/session-tab-store.d.ts +1 -46
- package/dist/stores/techstack-store.d.ts +140 -1
- package/dist/stores/terminal-strip-store.d.ts +26 -0
- package/dist/stores/types.d.ts +5 -0
- package/dist/stores/ui-store-chrome.d.ts +1 -1
- package/dist/stores/ui-store-persist.d.ts +2 -2
- package/dist/stores/ui-store-types.d.ts +3 -3
- package/dist/stores/ui-store.d.ts +5 -5
- package/dist/types/brain.d.ts +4 -2
- package/dist/types/client-message.d.ts +122 -14
- package/dist/types/jev.d.ts +2 -0
- package/dist/types/prompt-queue.d.ts +55 -0
- package/dist/types/protocol-core.d.ts +4 -216
- package/dist/types/runtime.d.ts +3 -38
- package/dist/types/server-message-files.d.ts +22 -0
- package/dist/types/server-message-mcp.d.ts +32 -0
- package/dist/types/server-message-system.d.ts +121 -0
- package/dist/types/server-message.d.ts +4 -3
- package/dist/types/system.d.ts +2 -24
- package/package.json +11 -9
- package/dist/assets/AgentRosterView-Dq8Xa0WK.js +0 -12
- package/dist/assets/AudienceMemoryPanel-BVGdDVTT.js +0 -3
- package/dist/assets/ChangesView-BVyLENBb.js +0 -1
- package/dist/assets/ChimeraReviewsView-CTuxzgTC.js +0 -1
- package/dist/assets/ChronicleDashboard-BRP7D6RZ.js +0 -1
- package/dist/assets/CodeEditor-k3z3M0NG.js +0 -2
- package/dist/assets/CodeMap-CvHNQZEF.js +0 -1
- package/dist/assets/GoalView-D8G8e8YG.js +0 -1
- package/dist/assets/KanbanView-BMXGDqGo.js +0 -3
- package/dist/assets/MemoryManager-DfcsYPUB.js +0 -1
- package/dist/assets/PromptJournalView-D7k8Yh5a.js +0 -1
- package/dist/assets/ProviderTestView-DSd6kkWT.js +0 -1
- package/dist/assets/QueuePanel-79KiyZWD.js +0 -1
- package/dist/assets/RequirementIntakeView-D_Ea20fx.js +0 -1
- package/dist/assets/SddHub-CSVfLGpr.js +0 -2
- package/dist/assets/SessionList-BYRCs1AK.js +0 -1
- package/dist/assets/SetupScreen-BUZeJSZi.js +0 -1
- package/dist/assets/TechStackView-CXJilX0M.js +0 -2
- package/dist/assets/TerminalPanel-CAXevSAa.js +0 -1
- package/dist/assets/activity-B3wutYIE.js +0 -10
- package/dist/assets/activity-Be03cc7g.js +0 -10
- package/dist/assets/activity-CiYZ3y4e.js +0 -10
- package/dist/assets/activity-CmIA2MhR.js +0 -10
- package/dist/assets/activity-Cp5GhldB.js +0 -10
- package/dist/assets/activity-DFCf7l5d.js +0 -10
- package/dist/assets/activity-EbNUY7Ci.js +0 -10
- package/dist/assets/chat-6dE2AJNN.js +0 -1
- package/dist/assets/chat-B3AJmhGD.js +0 -1
- package/dist/assets/chat-BHsbpaVt.js +0 -1
- package/dist/assets/chat-BITJe8-v.js +0 -1
- package/dist/assets/chat-U-Jjb8_k.js +0 -1
- package/dist/assets/chat-_Xp5fDnj.js +0 -1
- package/dist/assets/chat-mSbSzPl5.js +0 -1
- package/dist/assets/chat-store-C7InoWAO.js +0 -1
- package/dist/assets/common-DPPTV3yw.js +0 -1
- package/dist/assets/config-store-BbL0WxLE.js +0 -21
- package/dist/assets/i18n-Dv97urcO.js +0 -3
- package/dist/assets/index-CON0Nbm4.css +0 -1
- package/dist/assets/index-DX6tHUzs.js +0 -177
- package/dist/assets/settings-BCvuzOJ6.js +0 -1
- package/dist/assets/settings-DMPKd-4K.js +0 -1
- package/dist/assets/settings-DxQ2452f.js +0 -1
- package/dist/assets/settings-Dz3StaVx.js +0 -1
- package/dist/assets/settings-EBW1mlXc.js +0 -1
- package/dist/assets/settings-Er2LHp9d.js +0 -1
- package/dist/assets/settings-EzznCDaX.js +0 -1
- package/dist/assets/stores-DXn5tdr7.js +0 -7
- package/dist/assets/toasts-BsmyGP95.js +0 -1
- package/dist/assets/toasts-CgXHu8ZB.js +0 -1
- package/dist/assets/toasts-DZ6HdKgG.js +0 -1
- package/dist/assets/toasts-DizCJjAR.js +0 -1
- package/dist/assets/toasts-NC2MT4uN.js +0 -1
- package/dist/assets/toasts-bPl097de.js +0 -1
- package/dist/assets/toasts-tCVo15mP.js +0 -1
- package/dist/assets/ui-store-DxDwFHNK.js +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{j as t,nt as n,rt as r,t as i}from"./config-store-Cb4iyhGv.js";import{i as a,t as o}from"./react-core-wiHys0m2.js";import{Cr as s,En as c,Fr as l,Ii as u,La as d,Mn as f,Nn as p,Qt as m,Sr as h,Vn as g,Zn as _,bo as v,ca as y,gr as ee,qn as b,qr as x,qt as te,wo as S,xo as C}from"./vendor-BfBvt432.js";import"./i18n-CzTjKT4L.js";import{t as w}from"./utils-B21Devim.js";import{o as T}from"./view-navigation-Cvrp_uJm.js";import{n as E}from"./ui-store-DI0iusYZ.js";import"./stores-Svlibwo5.js";import{C as D}from"./fonts-C303yVU_.js";import{B as O,L as k,V as A,h as j,o as M}from"./index-Ci22AODp.js";import{i as N,r as P,s as F,t as I}from"./monaco-CbI7qrVD.js";import{t as L}from"./monaco-theme-Dr3-rSid.js";import{t as R}from"./empty-state-BzoEa04Q.js";var z=e(a(),1),B=o();function V(){let[e,t]=(0,z.useState)();return[e,e=>t({w:e.currentTarget.naturalWidth,h:e.currentTarget.naturalHeight})]}function H({label:e,size:t,bytes:n}){return(0,B.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-[11px] text-muted-foreground`,children:[(0,B.jsx)(`span`,{className:`font-semibold text-foreground/80`,children:e}),t&&(0,B.jsxs)(`span`,{children:[t.w,`×`,t.h]}),n!==void 0&&(0,B.jsx)(`span`,{children:j(n)})]})}function U({image:e,path:t}){let{t:n}=S(),r=!!(e.old&&e.new),[i,a]=(0,z.useState)(`side`),[o,s]=(0,z.useState)(50),[c,l]=V(),[u,d]=V(),f=n(`activity:changes.image.before`),p=n(`activity:changes.image.after`);return(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-border/60 px-3 py-1.5`,children:[(0,B.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.old?e.new?n(`activity:changes.image.changed`):n(`activity:changes.image.deleted`):n(`activity:changes.image.added`)}),(0,B.jsx)(`span`,{className:`flex-1`}),r&&(0,B.jsx)(`div`,{className:`flex items-center gap-1`,children:[[`side`,y,n(`activity:changes.image.side`)],[`onion`,x,n(`activity:changes.image.onion`)]].map(([e,t,n])=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>a(e),"aria-pressed":i===e,className:w(`inline-flex h-7 items-center gap-1 rounded-md border px-2 text-xs transition-colors`,i===e?`border-primary/40 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:bg-muted`),children:[(0,B.jsx)(t,{className:`h-3.5 w-3.5`}),` `,n]},e))})]}),(0,B.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:i===`onion`&&r?(0,B.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,B.jsxs)(`div`,{className:`ws-checkerboard grid max-w-full border border-border/60`,children:[(0,B.jsx)(`img`,{src:e.old,alt:`${t} (${f})`,onLoad:l,style:{gridArea:`1 / 1`},className:`block max-h-[60vh] max-w-full place-self-center`}),(0,B.jsx)(`img`,{src:e.new,alt:`${t} (${p})`,onLoad:d,style:{gridArea:`1 / 1`,opacity:o/100},className:`block max-h-[60vh] max-w-full place-self-center`})]}),(0,B.jsxs)(`label`,{className:`flex w-full max-w-md items-center gap-2 text-xs text-muted-foreground`,children:[(0,B.jsx)(`span`,{className:`shrink-0`,children:f}),(0,B.jsx)(`input`,{type:`range`,min:0,max:100,value:o,onChange:e=>s(Number(e.target.value)),"aria-label":n(`activity:changes.image.opacity`),className:`flex-1`}),(0,B.jsx)(`span`,{className:`shrink-0`,children:p})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-4`,children:[(0,B.jsx)(H,{label:f,size:c,bytes:e.oldBytes}),(0,B.jsx)(H,{label:p,size:u,bytes:e.newBytes})]})]}):(0,B.jsxs)(`div`,{className:`grid gap-3 [grid-template-columns:repeat(auto-fit,minmax(14rem,1fr))]`,children:[e.old&&(0,B.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-1.5`,children:[(0,B.jsx)(H,{label:f,size:c,bytes:e.oldBytes}),(0,B.jsx)(`div`,{className:`ws-checkerboard flex justify-center border border-border/60`,children:(0,B.jsx)(`img`,{src:e.old,alt:`${t} (${f})`,onLoad:l,className:`block max-h-[60vh] max-w-full object-contain`})})]}),e.new&&(0,B.jsxs)(`figure`,{className:`m-0 flex min-w-0 flex-col gap-1.5`,children:[(0,B.jsx)(H,{label:p,size:u,bytes:e.newBytes}),(0,B.jsx)(`div`,{className:`ws-checkerboard flex justify-center border border-border/60`,children:(0,B.jsx)(`img`,{src:e.new,alt:`${t} (${p})`,onLoad:d,className:`block max-h-[60vh] max-w-full object-contain`})})]})]})})]})}N.config({monaco:I});var W={ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,json:`json`,css:`css`,scss:`scss`,html:`html`,md:`markdown`,py:`python`,go:`go`,rs:`rust`,java:`java`,c:`c`,cpp:`cpp`,cs:`csharp`,rb:`ruby`,php:`php`,sh:`shell`,bash:`shell`,yml:`yaml`,yaml:`yaml`,toml:`toml`,sql:`sql`};function G(e){return W[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function ne({path:e,oldText:n,newText:r}){let{t:a}=S(),o=(0,z.useRef)(null),[s,c]=(0,z.useState)(!1),[u,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(null),{editor:g}=M();(0,z.useEffect)(()=>D(()=>F.remeasureFonts()),[]),(0,z.useEffect)(()=>{c(!1),p(!1),h(null)},[]);let _=(0,z.useCallback)(e=>{o.current=e,F.setTheme(L()),e.getModifiedEditor().onDidChangeModelContent(()=>c(!0))},[]),v=(0,z.useCallback)(()=>{let n=o.current?.getModifiedEditor().getValue();if(n==null)return;p(!0);let r=t(i.getState().wsUrl),a=r.on(`files.written`,t=>{t.type===`files.written`&&t.payload.filePath===e&&(a(),clearTimeout(s),p(!1),t.payload.success&&(c(!1),h(Date.now())))}),s=setTimeout(()=>{a(),p(!1)},5e3);r.send({type:`files.write`,payload:r.withSession({filePath:e,content:n})})},[e]),y=G(e);return(0,B.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2 px-2 py-1.5 border-b border-border/40`,children:[(0,B.jsx)(`span`,{className:`text-xs font-mono text-muted-foreground truncate`,children:e}),(0,B.jsxs)(`button`,{type:`button`,onClick:v,disabled:!s||u,className:`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-md border border-border text-xs font-medium disabled:opacity-40 enabled:hover:bg-muted transition-colors`,title:a(`activity:monacoDiff.applyTitle`),children:[u?(0,B.jsx)(l,{className:`h-3.5 w-3.5 animate-spin`}):m&&!s?(0,B.jsx)(d,{className:`h-3.5 w-3.5 text-success`}):(0,B.jsx)(f,{className:`h-3.5 w-3.5`}),a(u?`activity:monacoDiff.applying`:m&&!s?`activity:monacoDiff.applied`:`activity:monacoDiff.apply`)]})]}),(0,B.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,B.jsx)(P,{original:n,modified:r,language:y,theme:L(),onMount:_,options:{renderSideBySide:!0,readOnly:!1,originalEditable:!1,minimap:{enabled:!1},fontSize:g.fontSize,fontFamily:g.fontFamily,lineHeight:g.lineHeight,fontLigatures:g.fontLigatures,scrollBeyondLastLine:!1,automaticLayout:!0}})})]})}var K=4e3,re=400,q=0;function ie(){return q+=1,`rc-${Date.now().toString(36)}-${q}`}var J=C()(v(e=>({comments:[],add:t=>{let n=t.body.trim().slice(0,K);if(!n)return null;let r={...t,body:n,lineText:t.lineText.slice(0,re),id:ie(),createdAt:Date.now()};return e(e=>({comments:[...e.comments,r].slice(-200)})),r},update:(t,n)=>{let r=n.trim().slice(0,K);e(e=>({comments:r?e.comments.map(e=>e.id===t?{...e,body:r}:e):e.comments.filter(e=>e.id!==t)}))},remove:t=>e(e=>({comments:e.comments.filter(e=>e.id!==t)})),clearScope:t=>e(e=>({comments:e.comments.filter(e=>e.scope!==t)}))}),{name:`wrongstack-review-comments`,version:1,partialize:e=>({comments:e.comments.slice(-200)})}));function ae(e,t){return e.filter(e=>e.scope===t).sort((e,t)=>e.path===t.path?e.line-t.line||e.createdAt-t.createdAt:e.path<t.path?-1:1)}function oe(e){if(e.length===0)return``;let t=[e.length===1?`Code review of the working tree — please address this comment:`:`Code review of the working tree — please address these ${e.length} comments:`,``];return e.forEach((e,n)=>{let r=`${e.path}:${e.line}${e.side===`old`?` (removed line)`:``}`;t.push(`${n+1}. ${r}`),e.lineText.trim()&&t.push(` > ${e.lineText.trim()}`);for(let n of e.body.split(`
|
|
2
|
+
`))t.push(` ${n}`);t.push(``)}),t.join(`
|
|
3
|
+
`).trimEnd()}function se(e){let t=0,n=0;return e.map(e=>e.kind===`ctx`?(t+=1,n+=1,{...e,oldLine:t,newLine:n}):e.kind===`del`?(t+=1,{...e,oldLine:t}):e.kind===`add`?(n+=1,{...e,newLine:n}):{...e})}function Y(e){return e.kind===`del`&&e.oldLine?{side:`old`,line:e.oldLine}:(e.kind===`add`||e.kind===`ctx`)&&e.newLine?{side:`new`,line:e.newLine}:null}var X=(e,t)=>`${e}:${t}`;function ce(e,t){let n=new Map;for(let t of e){let e=Y(t);e&&n.set(X(e.side,e.line),t.text)}let r=new Map,i=[];for(let e of t){let t=X(e.side,e.line);n.get(t)===e.lineText?r.set(t,[...r.get(t)??[],e]):i.push(e)}return{byAnchor:r,outdated:i}}function Z({initial:e,onSave:t,onCancel:n}){let{t:r}=S(),[i,a]=(0,z.useState)(e);return(0,B.jsxs)(`div`,{className:`mx-2 my-1 rounded-md border border-primary/40 bg-card p-2 font-sans`,children:[(0,B.jsx)(`textarea`,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)?(e.preventDefault(),i.trim()&&t(i)):e.key===`Escape`&&(e.preventDefault(),n())},placeholder:r(`activity:review.placeholder`),"aria-label":r(`activity:review.placeholder`),rows:3,className:`w-full resize-y rounded border border-border bg-background px-2 py-1 text-xs text-foreground outline-none focus:border-primary/60`}),(0,B.jsxs)(`div`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:n,className:`h-7 rounded-md border border-border px-2 text-xs text-muted-foreground hover:bg-muted`,children:r(`common:action.cancel`)}),(0,B.jsx)(`button`,{type:`button`,disabled:!i.trim(),onClick:()=>t(i),className:`h-7 rounded-md bg-primary px-2 text-xs text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:r(`common:action.save`)})]})]})}function Q({comment:e,outdated:t}){let{t:n}=S(),r=J(e=>e.update),i=J(e=>e.remove),[a,o]=(0,z.useState)(!1);return a?(0,B.jsx)(Z,{initial:e.body,onSave:t=>{r(e.id,t),o(!1)},onCancel:()=>o(!1)}):(0,B.jsxs)(`div`,{className:w(`group/comment mx-2 my-1 rounded-md border bg-card px-2 py-1.5 font-sans text-xs`,t?`border-warning/50`:`border-border`),children:[t&&(0,B.jsxs)(`div`,{className:`mb-1 text-[10px] text-warning`,children:[n(`activity:review.outdated`),` · `,e.path,`:`,e.line,e.lineText.trim()&&(0,B.jsxs)(`span`,{className:`ml-1 font-mono text-muted-foreground`,children:[`“`,e.lineText.trim(),`”`]})]}),(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,B.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-words text-foreground`,children:e.body}),(0,B.jsxs)(`div`,{className:`flex shrink-0 gap-0.5 opacity-60 group-hover/comment:opacity-100`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>o(!0),title:n(`common:action.edit`),"aria-label":n(`common:action.edit`),className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,B.jsx)(_,{className:`h-3 w-3`})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>i(e.id),title:n(`common:action.delete`),"aria-label":n(`common:action.delete`),className:`rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,children:(0,B.jsx)(m,{className:`h-3 w-3`})})]})]})]})}var le=(0,z.memo)(function({path:e,scope:t,oldText:n,newText:r}){let{t:i}=S(),a=(0,z.useMemo)(()=>{let e=O(n,r);return e?se(e):null},[n,r]),o=J(e=>e.comments),c=J(e=>e.add),[l,u]=(0,z.useState)(null),d=(0,z.useMemo)(()=>o.filter(n=>n.scope===t&&n.path===e),[o,t,e]),f=(0,z.useMemo)(()=>a?ce(a,d):null,[a,d]);if(a===null||f===null)return(0,B.jsx)(`div`,{className:`px-3 py-2 text-xs italic text-muted-foreground`,children:i(`activity:diff.tooLarge`)});let p=a.filter(e=>e.kind===`add`).length,m=a.filter(e=>e.kind===`del`).length;return(0,B.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg border bg-background/40 text-xs`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 border-b bg-muted/40 px-3 py-1.5 font-mono text-[11px]`,children:[(0,B.jsx)(`span`,{className:`truncate text-muted-foreground`,children:e}),(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[p>0&&(0,B.jsxs)(`span`,{className:`text-success`,children:[`+`,p]}),m>0&&(0,B.jsxs)(`span`,{className:`text-destructive`,children:[`-`,m]})]})]}),(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto font-mono leading-relaxed`,children:[f.outdated.length>0&&(0,B.jsxs)(`div`,{className:`border-b border-warning/30 bg-warning/5 py-1`,children:[(0,B.jsx)(`div`,{className:`px-3 text-[10px] font-semibold uppercase text-warning`,children:i(`activity:review.outdatedHeader`)}),f.outdated.map(e=>(0,B.jsx)(Q,{comment:e,outdated:!0},e.id))]}),a.map((n,r)=>{let a=Y(n),o=a?X(a.side,a.line):null,d=o?f.byAnchor.get(o)??[]:[];return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:w(`group/row flex items-start`,n.kind===`add`&&`bg-success/10`,n.kind===`del`&&`bg-destructive/10`,n.kind===`meta`&&`bg-muted/60`),children:[(0,B.jsx)(`span`,{"aria-hidden":!0,className:`w-9 shrink-0 select-none pr-1 text-right text-[10px] text-muted-foreground/60`,children:n.oldLine??``}),(0,B.jsx)(`span`,{"aria-hidden":!0,className:`w-9 shrink-0 select-none pr-1 text-right text-[10px] text-muted-foreground/60`,children:n.newLine??``}),(0,B.jsx)(`span`,{className:`flex w-5 shrink-0 justify-center`,children:a&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>u(o),title:i(`activity:review.addComment`),"aria-label":`${i(`activity:review.addComment`)}: ${a.side===`old`?`${i(`activity:review.removedLine`)} `:``}${a.line}`,className:`mt-px rounded text-primary opacity-0 hover:bg-primary/15 focus:opacity-100 group-hover/row:opacity-100`,children:(0,B.jsx)(s,{className:`h-3.5 w-3.5`})})}),(0,B.jsx)(`span`,{"aria-hidden":!0,className:w(`w-4 shrink-0 select-none text-center`,n.kind===`add`&&`text-success`,n.kind===`del`&&`text-destructive`,(n.kind===`ctx`||n.kind===`meta`)&&`text-muted-foreground/70`),children:n.kind===`add`?`+`:n.kind===`del`?`-`:n.kind===`meta`?`@`:` `}),(0,B.jsx)(`pre`,{className:w(`flex-1 whitespace-pre-wrap break-all px-2`,(n.kind===`ctx`||n.kind===`meta`)&&`text-muted-foreground/70`),children:n.text||` `})]}),d.map(e=>(0,B.jsx)(Q,{comment:e},e.id)),a&&l===o&&(0,B.jsx)(Z,{initial:``,onSave:r=>{c({scope:t,path:e,side:a.side,line:a.line,lineText:n.text,body:r}),u(null)},onCancel:()=>u(null)})]},r)})]})]})});function $(e){let t=J(e=>e.comments);return(0,z.useMemo)(()=>ae(t,e),[t,e])}function ue({scope:e,onOpenFile:t}){let{t:n}=S(),r=$(e),i=()=>{let t=oe(r);t&&(E.getState().requestPromptInsert(t),J.getState().clearScope(e),T(`chat`))},a=async()=>{await k({title:n(`activity:review.confirmClearTitle`),message:n(`activity:review.confirmClearMsg`),confirmLabel:n(`common:action.discard`),danger:!0})&&J.getState().clearScope(e)},o=new Map;for(let e of r)o.set(e.path,[...o.get(e.path)??[],e]);return(0,B.jsxs)(`section`,{"aria-label":n(`activity:review.trayTitle`),className:`flex max-h-[40%] shrink-0 flex-col border-t border-border/70 bg-card/60`,children:[(0,B.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-3 py-2`,children:[(0,B.jsx)(h,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`text-xs font-semibold`,children:n(`activity:review.trayTitle`)}),(0,B.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:a,disabled:r.length===0,className:`inline-flex h-7 items-center gap-1 rounded-md border border-border px-2 text-xs text-muted-foreground hover:bg-destructive/10 hover:text-destructive disabled:opacity-50`,children:[(0,B.jsx)(m,{className:`h-3.5 w-3.5`}),` `,n(`common:action.clear`)]}),(0,B.jsxs)(`button`,{type:`button`,onClick:i,disabled:r.length===0,title:n(`activity:review.sendToChatTitle`),className:`inline-flex h-7 items-center gap-1 rounded-md bg-primary px-2 text-xs text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[(0,B.jsx)(c,{className:`h-3.5 w-3.5`}),` `,n(`activity:review.sendToChat`)]})]})]}),(0,B.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-3 pb-2`,children:r.length===0?(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`activity:review.empty`)}):[...o.entries()].map(([e,n])=>(0,B.jsxs)(`div`,{className:`mb-2`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>t(e),className:`truncate font-mono text-[11px] text-primary hover:underline`,title:e,children:e}),(0,B.jsx)(`ul`,{className:`mt-0.5 space-y-0.5`,children:n.map(e=>(0,B.jsxs)(`li`,{className:`flex gap-2 text-xs`,children:[(0,B.jsx)(`span`,{className:`w-14 shrink-0 text-right font-mono text-[10px] text-muted-foreground`,children:e.side===`old`?`-${e.line}`:e.line}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.body,children:e.body})]},e.id))})]},e))})]})}var de=1e4;function fe({className:e}){let{t:a}=S(),{stageGit:o,unstageGit:s,discardGit:c}=A(),d=r(e=>e.selectedPath),f=r(e=>e.files),m=r(e=>e.diff),_=r(e=>e.loadingDiff),v=f.find(e=>e.path===d),[x,C]=(0,z.useState)(`unified`),T=n(e=>e.projectRoot)??``,E=$(T),[D,O]=(0,z.useState)(!1),j=(0,B.jsx)(ue,{scope:T,onOpenFile:e=>{r.getState().select(e),t(i.getState().wsUrl).getGitDiff?.(e),C(`unified`)}}),[M,N]=(0,z.useState)(!1),P=!!d&&(_||!m);(0,z.useEffect)(()=>{if(N(!1),!P)return;let e=setTimeout(()=>N(!0),de);return()=>clearTimeout(e)},[P,d]);let F=()=>{d&&(N(!1),r.getState().setDiffLoading(!0),t(i.getState().wsUrl).getGitDiff?.(d))};if(!d){let t=(0,B.jsx)(R,{icon:(0,B.jsx)(u,{className:`h-6 w-6`}),title:a(`activity:changesView.sourceChanges`),description:a(`activity:changes.selectPrompt`),className:E.length>0?`min-h-0 flex-1`:e});return E.length===0?t:(0,B.jsxs)(`div`,{className:w(`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,e),children:[t,j]})}let I=m&&!m.error&&!m.binary&&!m.tooLarge;return(0,B.jsx)(`div`,{className:w(`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-[hsl(var(--surface-2)/0.45)] p-3`,e),children:(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border/70 bg-card/75 shadow-sm`,children:[(0,B.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border/70 px-3 py-2`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex max-w-full flex-1 basis-48 items-center gap-2`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`div`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:a(`activity:changesView.sourceControl`)}),(0,B.jsx)(`div`,{className:`truncate font-mono text-xs text-foreground`,title:d,children:d})]}),v?.staged&&(0,B.jsx)(`span`,{className:`shrink-0 rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary uppercase`,children:`Staged`})]}),(0,B.jsxs)(`div`,{className:`flex max-w-full flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>O(e=>!e),"aria-pressed":D,title:a(`activity:review.trayTitle`),className:w(`inline-flex h-8 items-center gap-1 rounded-md border px-2 text-xs transition-colors`,D?`border-primary/40 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:bg-muted`),children:[(0,B.jsx)(h,{className:`h-3.5 w-3.5`}),a(`activity:review.trayButton`,{count:E.length})]}),(0,B.jsx)(`div`,{className:`flex items-center gap-1 border-r border-border/70 pr-2`,children:v?.staged?(0,B.jsxs)(`button`,{type:`button`,onClick:()=>s?.(d),title:`Unstage this file`,className:`inline-flex h-8 items-center gap-1 rounded-md border border-border px-2 text-xs text-muted-foreground hover:bg-muted hover:text-foreground transition-colors`,children:[(0,B.jsx)(ee,{className:`h-3.5 w-3.5`}),` Unstage`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>o?.(d),title:`Stage this file`,className:`inline-flex h-8 items-center gap-1 rounded-md border border-border px-2 text-xs text-muted-foreground hover:bg-muted hover:text-foreground transition-colors`,children:[(0,B.jsx)(b,{className:`h-3.5 w-3.5`}),` Stage`]}),(0,B.jsxs)(`button`,{type:`button`,onClick:async()=>{d&&await k({title:a(`activity:changes.confirmDiscardTitle`,{path:d,defaultValue:`Discard changes in ${d}?`}),message:a(`activity:changes.confirmDiscardMsg`,{defaultValue:`This cannot be undone.`}),confirmLabel:a(`common:action.discard`,{defaultValue:`Discard`}),danger:!0})&&c?.(d)},title:`Discard changes in this file`,className:`inline-flex h-8 items-center gap-1 rounded-md border border-border px-2 text-xs text-muted-foreground hover:bg-destructive/10 hover:text-destructive transition-colors`,children:[(0,B.jsx)(te,{className:`h-3.5 w-3.5`}),` Discard`]})]})}),I&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>C(`unified`),title:a(`activity:changes.unifiedTitle`),className:w(`inline-flex h-8 items-center gap-1 rounded-md border px-2 text-xs transition-colors`,x===`unified`?`border-primary/40 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:bg-muted`),children:[(0,B.jsx)(p,{className:`h-3.5 w-3.5`}),` `,a(`activity:changes.unified`)]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>C(`edit`),title:a(`activity:changes.editTitle`),className:w(`inline-flex h-8 items-center gap-1 rounded-md border px-2 text-xs transition-colors`,x===`edit`?`border-primary/40 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:bg-muted`),children:[(0,B.jsx)(y,{className:`h-3.5 w-3.5`}),` `,a(`activity:changes.edit`)]})]})]})]}),(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:_||!m?M?(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-4 text-center`,children:[(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(`activity:changes.diffTimeout`)}),(0,B.jsxs)(`button`,{type:`button`,onClick:F,className:`inline-flex h-8 items-center gap-1.5 rounded-md border border-border px-3 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,B.jsx)(g,{className:`h-3.5 w-3.5`}),` `,a(`common:action.retry`)]})]}):(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,B.jsx)(l,{className:`h-4 w-4 animate-spin`}),` `,a(`activity:changes.loadingDiff`)]}):m.error?(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-sm text-destructive`,children:m.error}):m.image?(0,B.jsx)(U,{image:m.image,path:m.path},m.path):m.binary?(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-sm text-muted-foreground`,children:a(`activity:changes.binary`)}):m.tooLarge?(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-sm text-muted-foreground`,children:a(`activity:changes.tooLarge`)}):x===`edit`?(0,B.jsx)(ne,{path:m.path,oldText:m.oldText??``,newText:m.newText??``},m.path):(0,B.jsx)(le,{path:m.path,scope:T,oldText:m.oldText,newText:m.newText},m.path)}),D&&j]})})}export{fe as ChangesView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{At as t,j as n}from"./config-store-Cb4iyhGv.js";import{i as r,t as i}from"./react-core-wiHys0m2.js";import{Aa as a,Dn as o,En as s,Fn as c,Fr as l,Ia as u,La as d,Ln as f,Oa as p,Pa as m,Vn as h,Yt as g,bn as _,qn as v,ya as y,zi as b}from"./vendor-BfBvt432.js";import{t as x}from"./utils-B21Devim.js";import{p as S}from"./index-Ci22AODp.js";import{t as C}from"./empty-state-BzoEa04Q.js";var w=e(r(),1),T=i();function E(e){try{return new Date(e).toLocaleString()}catch{return e}}function D(e){try{let t=new Date(e),n=Date.now()-t.getTime();return n<6e4?`Just now`:n<36e5?`${Math.round(n/6e4)}m ago`:n<864e5?`${Math.round(n/36e5)}h ago`:n<6048e5?`${Math.round(n/864e5)}d ago`:t.toLocaleDateString()}catch{return e}}var O={open:{label:`Open`,cls:`border-primary/30 bg-primary/10 text-primary`,icon:a},actioned:{label:`Actioned`,cls:`border-warning/30 bg-warning/10 text-warning`,icon:c},completed:{label:`Completed`,cls:`border-success/30 bg-success/10 text-success`,icon:p},skipped:{label:`Skipped`,cls:`border-border bg-muted text-muted-foreground`,icon:y}},k={critical:{bg:`bg-destructive/10 border-destructive/30`,text:`text-destructive`,dot:`bg-destructive`},high:{bg:`bg-warning/15 border-warning/40`,text:`text-warning`,dot:`bg-warning`},medium:{bg:`bg-warning/10 border-warning/30`,text:`text-warning`,dot:`bg-warning`},low:{bg:`bg-muted border-border`,text:`text-muted-foreground`,dot:`bg-muted-foreground`}};function A(){let{reports:e,selectedReportId:r,detail:i,loading:a,detailLoading:A,error:j,filterSessionId:M,filterLifecycle:N,searchQuery:P,fetchReports:F,selectReport:I,setFilterSessionId:L,setFilterLifecycle:R,setSearchQuery:z,transitionReport:B,addReportNote:V,transitionFinding:H}=S(),[U,W]=(0,w.useState)(``),[G,K]=(0,w.useState)(!1);(0,w.useEffect)(()=>{F()},[F]);let q=(0,w.useMemo)(()=>{let t=new Set;for(let n of e)n.sessionId&&t.add(n.sessionId);return Array.from(t)},[e]),J=(0,w.useMemo)(()=>{let t=P.trim().toLowerCase();return e.filter(e=>{if(M&&e.sessionId!==M||N&&e.lifecycleStatus!==N)return!1;if(t){let n=e.reportId.toLowerCase().includes(t),r=e.sessionId.toLowerCase().includes(t),i=(e.reviewerModel??``).toLowerCase().includes(t);if(!n&&!r&&!i)return!1}return!0})},[e,M,N,P]);return(0,T.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 w-full flex-col overflow-hidden bg-background text-foreground [overflow-wrap:anywhere]`,children:[(0,T.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 border-b border-border bg-card/40 px-4 py-3 sm:px-6`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`text-xl`,"aria-hidden":!0,children:`🦂`}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-base font-semibold leading-none`,children:`Chimera Review Hub & Journal`}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:`Track agent code reviews, findings, session lineage, and audit event timeline`})]})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsxs)(`select`,{value:M,onChange:e=>L(e.target.value),className:`rounded-lg border border-border bg-background px-2.5 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`,"aria-label":`Filter by session`,children:[(0,T.jsxs)(`option`,{value:``,children:[`All Sessions (`,q.length,`)`]}),q.map(e=>(0,T.jsxs)(`option`,{value:e,children:[`Session: `,e.length>16?`${e.slice(0,16)}…`:e]},e))]}),(0,T.jsxs)(`select`,{value:N,onChange:e=>R(e.target.value),className:`rounded-lg border border-border bg-background px-2.5 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`,"aria-label":`Filter by status`,children:[(0,T.jsx)(`option`,{value:``,children:`All Statuses`}),(0,T.jsx)(`option`,{value:`open`,children:`Open`}),(0,T.jsx)(`option`,{value:`actioned`,children:`Actioned`}),(0,T.jsx)(`option`,{value:`completed`,children:`Completed`}),(0,T.jsx)(`option`,{value:`skipped`,children:`Skipped`})]}),(0,T.jsxs)(`div`,{className:`relative`,children:[(0,T.jsx)(o,{className:`absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,T.jsx)(`input`,{type:`text`,placeholder:`Search reports...`,value:P,onChange:e=>z(e.target.value),className:`rounded-lg border border-border bg-background pl-8 pr-3 py-1.5 text-xs placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary w-40 sm:w-52`})]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>F(),disabled:a,className:`inline-flex items-center gap-1 rounded-lg border border-border bg-background px-2.5 py-1.5 text-xs font-medium hover:bg-muted transition-colors disabled:opacity-50`,title:`Refresh reports`,children:[(0,T.jsx)(h,{className:x(`h-3.5 w-3.5`,a&&`animate-spin`)}),(0,T.jsx)(`span`,{className:`hidden sm:inline`,children:`Refresh`})]})]})]}),(0,T.jsxs)(`div`,{className:`flex flex-1 min-h-0 min-w-0 flex-col sm:flex-row`,children:[(0,T.jsxs)(`div`,{className:`flex w-full max-h-40 sm:max-h-none sm:w-80 flex-col border-b sm:border-b-0 sm:border-r border-border bg-card/20 shrink-0 overflow-y-auto`,children:[(0,T.jsxs)(`div`,{className:`border-b border-border px-3 py-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider flex items-center justify-between`,children:[(0,T.jsxs)(`span`,{children:[`Reports (`,J.length,`)`]}),a&&(0,T.jsx)(l,{className:`h-3 w-3 animate-spin`})]}),j&&!a&&(0,T.jsxs)(`div`,{className:`m-3 flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-3`,children:[(0,T.jsx)(g,{className:`mt-0.5 h-4 w-4 shrink-0 text-destructive`}),(0,T.jsx)(`p`,{className:`font-mono text-xs break-words text-destructive`,children:j})]}),J.length===0?(0,T.jsx)(`div`,{className:`p-6 text-center text-xs text-muted-foreground`,children:a?`Loading review reports…`:`No review reports match your filter.`}):(0,T.jsx)(`div`,{className:`divide-y divide-border/60`,children:J.map(e=>{let t=e.reportId===r,n=O[e.lifecycleStatus]??O.open,i=n.icon,a=e.totalFindings;return(0,T.jsxs)(`button`,{type:`button`,onClick:()=>I(e.reportId),className:x(`flex w-full flex-col gap-1.5 px-3.5 py-3 text-left transition-colors hover:bg-muted/60`,t&&`bg-primary/10 border-l-2 border-primary`),children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsxs)(`span`,{className:`text-xs font-semibold truncate font-mono text-foreground`,children:[e.reportId.slice(0,12),`…`]}),(0,T.jsxs)(`span`,{className:x(`inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium leading-none`,n.cls),children:[(0,T.jsx)(i,{className:`h-2.5 w-2.5`}),n.label]})]}),(0,T.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-muted-foreground`,children:[(0,T.jsxs)(`span`,{className:`truncate`,children:[`Sess: `,e.sessionId.slice(0,10),`…`]}),(0,T.jsx)(`span`,{children:D(e.reviewedAt)})]}),(0,T.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:a===0?(0,T.jsx)(`span`,{className:`text-success font-medium`,children:`All clear ✓`}):`${a} finding(s)`}),e.counts&&a>0&&(0,T.jsxs)(`div`,{className:`flex items-center gap-1 font-mono text-[10px]`,children:[e.counts.critical>0&&(0,T.jsxs)(`span`,{className:`text-destructive font-semibold`,children:[e.counts.critical,` critical`]}),e.counts.high>0&&(0,T.jsxs)(`span`,{className:`text-warning`,children:[e.counts.high,` high`]}),e.counts.medium>0&&(0,T.jsxs)(`span`,{className:`text-warning`,children:[e.counts.medium,` med`]}),e.counts.low>0&&(0,T.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.counts.low,` low`]})]})]})]},e.reportId)})})]}),r&&i?.report?(0,T.jsxs)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-y-auto lg:flex lg:overflow-hidden`,children:[(0,T.jsxs)(`div`,{className:`min-h-0 min-w-0 lg:flex-1 lg:overflow-y-auto p-4 sm:p-6 space-y-6`,children:[(0,T.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-5 space-y-4 shadow-sm`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,T.jsxs)(`h2`,{className:`text-lg font-bold`,children:[`Review Report`,` `,(0,T.jsxs)(`span`,{className:`font-mono text-sm text-muted-foreground`,children:[`(`,i.report.id,`)`]})]})}),(0,T.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`Session`,` `,(0,T.jsx)(`span`,{className:`font-mono font-medium text-foreground`,children:i.report.sessionId}),` `,`• Reviewed at `,E(i.report.reviewedAt)]})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>B(i.report.id,`actioned`,`Manual action status`),disabled:i.report.lifecycle===`actioned`,className:`inline-flex items-center gap-1 rounded-lg border border-warning/30 bg-warning/10 px-2.5 py-1 text-xs font-medium text-warning hover:bg-warning/20 disabled:opacity-40 transition-colors`,children:[(0,T.jsx)(c,{className:`h-3.5 w-3.5`}),`Mark Actioned`]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>B(i.report.id,`completed`,`Manual completion`),disabled:i.report.lifecycle===`completed`,className:`inline-flex items-center gap-1 rounded-lg border border-success/30 bg-success/10 px-2.5 py-1 text-xs font-medium text-success hover:bg-success/20 disabled:opacity-40 transition-colors`,children:[(0,T.jsx)(d,{className:`h-3.5 w-3.5`}),`Mark Completed`]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>B(i.report.id,`skipped`,`Manual skip`),disabled:i.report.lifecycle===`skipped`,className:`inline-flex items-center gap-1 rounded-lg border border-border bg-muted px-2.5 py-1 text-xs font-medium text-muted-foreground hover:bg-muted/80 disabled:opacity-40 transition-colors`,children:[(0,T.jsx)(y,{className:`h-3.5 w-3.5`}),`Skip`]})]})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3 pt-2 border-t border-border/60 text-xs`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground block text-[11px]`,children:`Reviewer Model`}),(0,T.jsx)(`span`,{className:`font-mono font-medium text-foreground`,children:i.report.reviewerModel||`default`})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground block text-[11px]`,children:`Reviewed Files`}),(0,T.jsxs)(`span`,{className:`font-medium text-foreground`,children:[i.report.files.length,` file(s)`]})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground block text-[11px]`,children:`Total Findings`}),(0,T.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.report.totalFindings})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground block text-[11px]`,children:`Cascade Depth`}),(0,T.jsx)(`span`,{className:`font-medium text-foreground`,children:i.report.cascadeDepth??0})]})]}),i.report.evidenceStatus&&(0,T.jsxs)(`div`,{className:`rounded-lg bg-muted/40 p-3 border border-border/80 text-xs space-y-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,T.jsx)(`span`,{children:`Machine Evidence Verification:`}),(0,T.jsx)(`span`,{className:x(`px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase border`,i.report.evidenceStatus===`verified`?`bg-success/10 text-success border-success/30`:i.report.evidenceStatus===`failed`?`bg-destructive/10 text-destructive border-destructive/30`:`bg-warning/10 text-warning border-warning/30`),children:i.report.evidenceStatus})]}),i.report.evidenceChecks&&i.report.evidenceChecks.length>0&&(0,T.jsx)(`div`,{className:`space-y-1 font-mono text-[11px] text-muted-foreground`,children:i.report.evidenceChecks.map((e,t)=>(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{children:e.ok?`✓`:`✗`}),(0,T.jsxs)(`span`,{className:`font-semibold text-foreground`,children:[e.name,`:`]}),(0,T.jsx)(`span`,{className:`truncate`,children:e.command})]},t))})]}),(0,T.jsx)(`div`,{className:`pt-2`,children:(0,T.jsxs)(`button`,{type:`button`,onClick:()=>{if(!i?.report)return;let e=i.report,r=`Take a look at the tasks mentioned in Chimera report (${e.id}) for session ${e.sessionId} — review the ${e.totalFindings} finding(s) it flagged and address them.`,a=t(e.sessionId);a.addMessage({role:`user`,content:r}),a.patch({isLoading:!0}),n().sendMessage(r,void 0,!1,e.sessionId===`__unbound__`?void 0:e.sessionId),B(e.id,`actioned`,`Prompt dispatched to leader`)},className:`inline-flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-xs font-semibold text-primary-foreground hover:bg-primary/90 transition-colors shadow-sm`,children:[(0,T.jsx)(s,{className:`h-3.5 w-3.5`}),`Dispatch Follow-up Task to Session Leader`]})})]}),(0,T.jsxs)(`div`,{className:`space-y-4`,children:[(0,T.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,T.jsxs)(`h3`,{className:`text-sm font-bold uppercase tracking-wider text-muted-foreground`,children:[`Findings (`,i.findings.length,`)`]})}),i.findings.length===0?(0,T.jsxs)(`div`,{className:`rounded-xl border border-border/80 bg-card/40 p-8 text-center text-xs text-muted-foreground`,children:[(0,T.jsx)(p,{className:`mx-auto h-8 w-8 text-success/60 mb-2`}),`No actionable findings were discovered in this review run.`]}):(0,T.jsx)(`div`,{className:`space-y-3`,children:i.findings.map(({finding:e})=>{let t=k[e.severity]??k.low;return(0,T.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4 space-y-3 shadow-sm transition-all hover:border-border/80`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(`span`,{className:x(`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-xs font-semibold uppercase border`,t.bg,t.text),children:[(0,T.jsx)(`span`,{className:x(`h-1.5 w-1.5 rounded-full`,t.dot)}),e.severity]}),e.category&&(0,T.jsx)(`span`,{className:`rounded-md bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground`,children:e.category}),e.location?.file&&(0,T.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-xs text-foreground bg-muted/60 px-2 py-0.5 rounded`,children:[(0,T.jsx)(b,{className:`h-3 w-3 text-muted-foreground`}),e.location.file,e.location.line?`:${e.location.line}`:``]})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,T.jsx)(`span`,{className:`font-semibold text-muted-foreground mr-1`,children:`Status:`}),(0,T.jsx)(`span`,{className:x(`px-2 py-0.5 rounded-full text-[11px] font-medium capitalize border`,e.status===`resolved`?`bg-success/10 text-success border-success/30`:e.status===`ignored`?`bg-muted text-muted-foreground border-border`:`bg-primary/10 text-primary border-primary/30`),children:e.status}),e.status!==`resolved`&&(0,T.jsx)(`button`,{type:`button`,onClick:()=>H(e.id,`resolved`,`fixed`,`Resolved by operator in WebUI`),className:`ml-2 rounded px-2 py-0.5 text-[11px] font-medium bg-success/10 text-success hover:bg-success/20 border border-success/30`,children:`Resolve (Fixed)`}),e.status!==`ignored`&&e.status!==`resolved`&&(0,T.jsx)(`button`,{type:`button`,onClick:()=>H(e.id,`ignored`,void 0,`Ignored by operator`),className:`rounded px-2 py-0.5 text-[11px] font-medium bg-muted text-muted-foreground hover:bg-muted/80 border border-border`,children:`Ignore`}),(e.status===`resolved`||e.status===`ignored`)&&(0,T.jsx)(`button`,{type:`button`,onClick:()=>H(e.id,`active`,void 0,`Reopened in WebUI`),className:`rounded px-2 py-0.5 text-[11px] font-medium bg-primary/10 text-primary hover:bg-primary/20 border border-primary/30`,children:`Reopen`})]})]}),(0,T.jsx)(`h4`,{className:`text-sm font-semibold text-foreground`,children:e.title}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground whitespace-pre-wrap`,children:e.description}),e.suggestedFix&&(0,T.jsxs)(`div`,{className:`rounded-lg bg-muted/40 border border-border/80 p-3 space-y-1 text-xs`,children:[(0,T.jsx)(`span`,{className:`font-semibold text-primary block`,children:`Suggested Fix:`}),(0,T.jsx)(`pre`,{className:`font-mono text-[11px] text-foreground overflow-x-auto whitespace-pre-wrap`,children:e.suggestedFix})]}),e.verification&&(0,T.jsxs)(`div`,{className:`text-[11px] text-muted-foreground flex items-center gap-2`,children:[(0,T.jsx)(`span`,{children:`Disk check:`}),(0,T.jsxs)(`span`,{className:x(`font-semibold`,e.verification.status===`verified`?`text-success`:e.verification.status===`failed`?`text-destructive`:`text-warning`),children:[e.verification.status,` (`,e.verification.reason,`)`]}),e.verification.evidence&&(0,T.jsxs)(`span`,{className:`font-mono text-muted-foreground truncate max-w-xs`,children:[`"`,e.verification.evidence,`"`]})]})]},e.id)})})]}),i.report.rawText&&(0,T.jsxs)(`div`,{className:`rounded-xl border border-border bg-card overflow-hidden`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>K(e=>!e),className:`flex w-full items-center justify-between px-4 py-3 text-xs font-semibold text-muted-foreground hover:bg-muted/50 transition-colors`,children:[(0,T.jsx)(`span`,{children:`Raw Report Markdown`}),G?(0,T.jsx)(u,{className:`h-4 w-4`}):(0,T.jsx)(m,{className:`h-4 w-4`})]}),G&&(0,T.jsx)(`div`,{className:`border-t border-border p-4 bg-muted/20`,children:(0,T.jsx)(`pre`,{className:`text-xs font-mono whitespace-pre-wrap break-words text-muted-foreground`,children:i.report.rawText})})]})]}),(0,T.jsxs)(`div`,{className:`w-full min-w-0 lg:w-80 border-t lg:border-t-0 lg:border-l border-border bg-card/30 shrink-0 lg:overflow-y-auto p-4 space-y-4`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border pb-3`,children:[(0,T.jsx)(f,{className:`h-4 w-4 text-primary`}),(0,T.jsx)(`h3`,{className:`text-sm font-bold`,children:`Activity Journal`})]}),(0,T.jsx)(`div`,{className:`space-y-3`,children:i.events.length===0?(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No journal events recorded yet.`}):(0,T.jsx)(`div`,{className:`relative pl-4 space-y-4 before:absolute before:left-1.5 before:top-2 before:bottom-2 before:w-0.5 before:bg-border`,children:i.events.map(e=>(0,T.jsxs)(`div`,{className:`relative space-y-1 text-xs`,children:[(0,T.jsx)(`div`,{className:`absolute -left-4 top-1 h-2 w-2 rounded-full bg-primary ring-4 ring-card`}),(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-1 text-[11px] text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`font-semibold text-foreground capitalize`,children:e.eventType.replace(`_`,` `)}),(0,T.jsx)(`span`,{children:D(e.timestamp)})]}),(0,T.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[`Actor: `,(0,T.jsx)(`span`,{className:`font-medium text-foreground`,children:e.actorId}),` (`,e.actorKind,`)`]}),e.fromLifecycle&&e.toLifecycle&&(0,T.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[`Status:`,` `,(0,T.jsxs)(`span`,{className:`text-foreground`,children:[e.fromLifecycle,` ➔ `,e.toLifecycle]})]}),e.reason&&(0,T.jsxs)(`p`,{className:`rounded bg-muted/60 p-1.5 text-[11px] text-foreground/90 italic`,children:[`"`,e.reason,`"`]})]},e.id))})}),(0,T.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),r&&U.trim()&&(V(r,U.trim()),W(``))},className:`pt-3 border-t border-border space-y-2`,children:[(0,T.jsx)(`label`,{htmlFor:`chimera-note-text`,className:`text-xs font-semibold text-muted-foreground block`,children:`Add Journal Note / Inote:`}),(0,T.jsx)(`textarea`,{id:`chimera-note-text`,rows:3,value:U,onChange:e=>W(e.target.value),placeholder:`Record an observation, fix PR link, or triage note...`,className:`w-full rounded-lg border border-border bg-background p-2 text-xs placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary`}),(0,T.jsxs)(`button`,{type:`submit`,disabled:!U.trim(),className:`inline-flex w-full items-center justify-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50`,children:[(0,T.jsx)(v,{className:`h-3.5 w-3.5`}),`Append to Journal`]})]})]})]}):A?(0,T.jsxs)(`div`,{className:`flex flex-1 items-center justify-center gap-2 p-8 text-sm text-muted-foreground`,children:[(0,T.jsx)(l,{className:`h-4 w-4 animate-spin`}),`Loading report details…`]}):(0,T.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,T.jsx)(C,{icon:(0,T.jsx)(_,{className:`h-12 w-12 text-muted-foreground/40`}),title:`Select a Chimera Review Report`,description:`Choose a review report from the left pane to view structured findings, disk verification proofs, and the activity journal.`})})]})]})}export{A as ChimeraReviewsView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{j as t}from"./config-store-Cb4iyhGv.js";import{i as n,t as r}from"./react-core-wiHys0m2.js";import{Dn as i,Ga as a,In as o,Mt as s,Pa as c,Qi as l,Vn as ee,Vr as te,Ya as u,Yt as d,di as f,gi as ne,ln as p,ma as re,vo as m,wo as h,yn as g,zi as _}from"./vendor-BfBvt432.js";import"./i18n-CzTjKT4L.js";import{t as v}from"./utils-B21Devim.js";import{A as ie,k as y}from"./index-Ci22AODp.js";var b=e(n(),1),x=r();function ae({status:e}){let{t}=h();return(0,x.jsxs)(`section`,{className:`flex flex-wrap gap-x-5 gap-y-1 border-b border-border/60 bg-primary/[0.025] px-4 py-1.5 font-mono text-[9px] text-muted-foreground`,title:e.chronicleDirectory,children:[(0,x.jsx)(`span`,{className:`font-sans font-semibold uppercase tracking-wider text-primary`,children:t(`activity:chroniclePipelineStrip.chronicleOwnership`)}),(0,x.jsxs)(`span`,{children:[`collect `,(0,x.jsx)(`b`,{className:`text-foreground`,children:e.pipeline.collection})]}),(0,x.jsxs)(`span`,{children:[`process `,(0,x.jsx)(`b`,{className:`text-foreground`,children:e.pipeline.processing})]}),(0,x.jsxs)(`span`,{children:[`serve `,(0,x.jsx)(`b`,{className:`text-foreground`,children:e.pipeline.serving})]}),(0,x.jsxs)(`span`,{children:[`PID `,(0,x.jsx)(`b`,{className:`text-foreground`,children:e.pid}),` · `,e.clients,` clients`]}),(0,x.jsxs)(`span`,{children:[`watcher`,` `,(0,x.jsx)(`b`,{className:v(e.watcher.active?`text-success`:`text-warning`),children:e.watcher.active?`active`:`inactive`}),` `,`· `,e.watcher.watchedFiles,` files`]}),(0,x.jsxs)(`span`,{children:[`store `,(0,x.jsx)(`b`,{className:`text-foreground`,children:S(e.pipeline.storage)})]}),e.mode===`inline`&&(0,x.jsx)(`span`,{className:`font-sans font-semibold text-warning`,children:t(`activity:chroniclePipelineStrip.inlineFallback`)})]})}function S(e){return e.replaceAll(`\\`,`/`).split(`/`).filter(Boolean).slice(-3).join(`/`)}var C={llm:0,agent:0,tool:0,file:0,memory:0,task:0,decision:0,runtime:0},w={logicalRequests:0,modelAttempts:0,completedAttempts:0,failedAttempts:0,scheduledRetries:0,fallbacks:0,providers:0,models:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,estimatedCostUsd:0,providerAvgDurationMs:0,providerP95DurationMs:0,toolCalls:0,completedTools:0,failedTools:0,toolAvgDurationMs:0,processes:0,failedProcesses:0,fileEvents:0,uniqueFiles:0,agentEvents:0,uniqueAgents:0,decisions:0,escalations:0,failures:0,cancellations:0,families:{...C},failuresByFamily:{...C}};function oe(e,t,n){return t===`all`?n:t===`llm`?e.families.llm:t===`agents`?e.families.agent:t===`tools`?e.families.tool:t===`files`?e.families.file:e.failures}function se(e){let t=e.inputTokens+e.cacheReadTokens;return t?e.cacheReadTokens/t*100:0}function ce(e,t){return t===`all`?!0:t===`llm`?/^(provider|token|context|compaction)\./.test(e.eventType):t===`agents`?/^(agent|subagent|delegate|fleet|sdd)\./.test(e.eventType):t===`tools`?/^(tool|process|mcp|network)\./.test(e.eventType):t===`files`?e.resource?.kind===`file`||/^(file|worktree|storage)\./.test(e.eventType):e.outcome===`failure`||/(?:failed|error|retry|fallback|blocked|conflict)/i.test(e.eventType)}function T(e){if(!e)return`—`;let t=e/1e6;return t<1?`${(e/1e3).toFixed(0)}µs`:t<1e3?`${t.toFixed(1)}ms`:`${(t/1e3).toFixed(1)}s`}function E(e){return e?e<1?`${(e*1e3).toFixed(0)}µs`:e<1e3?`${e.toFixed(1)}ms`:`${(e/1e3).toFixed(1)}s`:`—`}function D({placeholder:e,value:t,onChange:n,onEnter:r,icon:i}){return(0,x.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-2 focus-within:border-primary/60`,children:[i&&(0,x.jsx)(`span`,{className:`text-muted-foreground [&>svg]:h-3.5 [&>svg]:w-3.5`,children:i}),(0,x.jsx)(`input`,{className:`w-full bg-transparent text-xs outline-none placeholder:text-muted-foreground/70`,placeholder:e,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&r()}})]})}function O({icon:e,label:t,value:n,detail:r,tone:i=`normal`}){return(0,x.jsxs)(`div`,{className:`min-w-0 border-r border-border/60 px-4 py-3`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:[(0,x.jsx)(`span`,{className:`text-primary [&>svg]:h-3.5 [&>svg]:w-3.5`,children:e}),t]}),(0,x.jsx)(`div`,{className:v(`mt-1 text-xl font-semibold tabular-nums`,i===`danger`&&`text-destructive`),children:typeof n==`number`?n.toLocaleString():n}),(0,x.jsx)(`div`,{className:`mt-0.5 truncate text-[9px] text-muted-foreground`,children:r})]})}function le({health:e}){let{t}=h();return(0,x.jsxs)(`section`,{className:`flex flex-wrap gap-x-5 gap-y-1 border-b border-border/60 bg-success/[0.025] px-4 py-1.5 font-mono text-[9px] text-muted-foreground`,children:[(0,x.jsx)(`span`,{className:`font-sans font-semibold uppercase tracking-wider text-success`,children:t(`activity:chronicle.collectorHealthy`)}),(0,x.jsxs)(`span`,{children:[`ELU`,` `,(0,x.jsxs)(`b`,{className:`text-foreground`,children:[((e.eventLoop?.utilization??0)*100).toFixed(1),`%`]})]}),(0,x.jsxs)(`span`,{children:[`p95 `,(0,x.jsxs)(`b`,{className:`text-foreground`,children:[(e.eventLoop?.delayP95Ms??0).toFixed(1),`ms`]})]}),(0,x.jsxs)(`span`,{children:[`heap`,` `,(0,x.jsxs)(`b`,{className:`text-foreground`,children:[((e.memory?.heapUsedBytes??0)/1048576).toFixed(0),`MB`]})]}),(0,x.jsxs)(`span`,{children:[`queue `,(0,x.jsx)(`b`,{className:`text-foreground`,children:e.chronicle?.pendingEvents??0})]}),(0,x.jsxs)(`span`,{children:[`dropped`,` `,(0,x.jsx)(`b`,{className:v((e.chronicle?.rejectedEvents??0)>0&&`text-destructive`),children:e.chronicle?.rejectedEvents??0})]})]})}function ue({event:e,active:t,onClick:n}){let r=e.occurredAt??e.observedAt,i=e.runtime?.modelId??e.scope.agentId??e.runtime?.providerId??`—`,a=e.resource?.path??e.resource?.id??e.correlation.toolCallId??`—`;return(0,x.jsxs)(`button`,{type:`button`,onClick:n,className:v(`grid w-full grid-cols-[92px_minmax(190px,1.25fr)_110px_minmax(180px,1fr)_minmax(140px,.8fr)_24px] items-center gap-3 px-4 py-2.5 text-left hover:bg-muted/45`,t&&`bg-primary/[0.07]`),children:[(0,x.jsx)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(r).toLocaleTimeString()}),(0,x.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,x.jsx)(`span`,{className:v(`h-1.5 w-1.5 shrink-0 rounded-full`,e.outcome===`failure`?`bg-destructive`:e.outcome===`success`?`bg-success`:`bg-primary`)}),(0,x.jsx)(`span`,{className:`truncate font-mono text-[11px] font-medium`,children:e.eventType})]}),(0,x.jsx)(`span`,{className:v(`w-fit rounded px-1.5 py-0.5 text-[9px]`,j(e.outcome)),children:e.outcome??`unknown`}),(0,x.jsx)(`span`,{className:`truncate font-mono text-[9px] text-muted-foreground`,children:i}),(0,x.jsx)(`span`,{className:`truncate font-mono text-[9px] text-muted-foreground`,children:a}),(0,x.jsx)(c,{className:`h-3.5 w-3.5 text-muted-foreground`})]})}function de({event:e,graph:t}){let{t:n}=h(),r=(0,b.useMemo)(()=>[[`Scope`,e.scope],[`Correlation`,e.correlation],[`Runtime`,e.runtime],[`Resource`,e.resource],[`Attributes`,e.attributes],[`Tags`,e.tags]],[e]);return(0,x.jsxs)(`div`,{className:`p-4`,children:[(0,x.jsxs)(`div`,{className:`mb-4 rounded-lg border border-border bg-background/60 p-3`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`span`,{className:v(`h-2 w-2 rounded-full`,e.outcome===`failure`?`bg-destructive`:e.outcome===`success`?`bg-success`:`bg-primary`)}),(0,x.jsx)(`span`,{className:`font-mono text-xs font-semibold`,children:e.eventType})]}),(0,x.jsxs)(`div`,{className:`mt-2 flex gap-4 text-[9px] text-muted-foreground`,children:[(0,x.jsx)(`span`,{children:new Date(e.occurredAt??e.observedAt).toLocaleString()}),(0,x.jsx)(`span`,{children:T(Number(e.durationNs??0))})]})]}),(0,x.jsxs)(`div`,{className:`mb-4 grid grid-cols-2 gap-2`,children:[(0,x.jsx)(k,{icon:(0,x.jsx)(g,{}),label:n(`activity:chronicle.evidenceHash`),value:e.hash.slice(0,16)}),(0,x.jsx)(k,{icon:(0,x.jsx)(l,{}),label:n(`activity:chronicle.sequence`),value:String(e.sequence)})]}),t&&(0,x.jsxs)(`section`,{className:`mb-4`,children:[(0,x.jsxs)(`h3`,{className:`mb-1.5 flex items-center gap-1 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,x.jsx)(f,{className:`h-3 w-3`}),`Lineage · `,t.nodes.length,` nodes · `,t.edges.length,` edges`]}),(0,x.jsx)(`div`,{className:`space-y-1 rounded-md border border-border bg-background/70 p-2`,children:t.edges.slice(0,40).map((e,n)=>(0,x.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-[9px]`,children:[(0,x.jsx)(`span`,{className:v(`rounded px-1`,e.confidence===`explicit`?`bg-success/10 text-success`:e.confidence===`inferred`?`bg-warning/10 text-warning`:`bg-primary/10 text-primary`),children:e.confidence}),(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:e.kind}),(0,x.jsxs)(`span`,{className:`truncate`,children:[t.nodes.find(t=>t.eventId===e.from)?.eventType,` →`,` `,t.nodes.find(t=>t.eventId===e.to)?.eventType]})]},`${e.from}-${e.to}-${e.kind}-${n}`))}),t.truncated&&(0,x.jsx)(`p`,{className:`mt-1 text-[9px] text-warning`,children:n(`activity:chronicle.lineageTruncatedAtSafetyLimit`)})]}),r.map(([e,t])=>t&&(0,x.jsxs)(`section`,{className:`mb-4`,children:[(0,x.jsx)(`h3`,{className:`mb-1.5 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e}),(0,x.jsx)(`pre`,{className:`overflow-auto rounded-md border border-border bg-background/70 p-3 font-mono text-[9px] leading-relaxed`,children:JSON.stringify(t,null,2)})]},e))]})}function k({icon:e,label:t,value:n}){return(0,x.jsxs)(`div`,{className:`rounded-md border border-border p-2`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1 text-[8px] uppercase text-muted-foreground`,children:[(0,x.jsx)(`span`,{className:`[&>svg]:h-3 [&>svg]:w-3`,children:e}),t]}),(0,x.jsx)(`div`,{className:`mt-1 truncate font-mono text-[9px]`,children:n})]})}function A({text:e}){return(0,x.jsx)(`div`,{className:`flex h-48 items-center justify-center text-sm text-muted-foreground`,children:e})}function j(e){return e===`failure`?`bg-destructive/10 text-destructive`:e===`success`?`bg-success/10 text-success`:e===`started`?`bg-primary/10 text-primary`:`bg-muted text-muted-foreground`}var M=[`eventType`,`providerId`,`modelId`,`outcome`,`resourceKind`],N=864e5;function P(){return{limit:300,order:`desc`,from:new Date(Date.now()-N).toISOString()}}var fe=[{id:`all`,labelKey:`activity:chronicle.signalAllSignals`,icon:(0,x.jsx)(m,{})},{id:`llm`,labelKey:`activity:chronicle.signalLlm`,icon:(0,x.jsx)(a,{})},{id:`agents`,labelKey:`activity:chronicle.signalAgents`,icon:(0,x.jsx)(u,{})},{id:`tools`,labelKey:`activity:chronicle.signalTools`,icon:(0,x.jsx)(p,{})},{id:`files`,labelKey:`activity:chronicle.signalFiles`,icon:(0,x.jsx)(_,{})},{id:`failures`,labelKey:`activity:chronicle.signalFailures`,icon:(0,x.jsx)(d,{})}];function F(){let{t:e}=h(),n=t(),[r,c]=(0,b.useState)([]),[l,d]=(0,b.useState)(null),[f,m]=(0,b.useState)({}),[g,S]=(0,b.useState)(P()),[C,T]=(0,b.useState)({text:``,path:``,providerId:``,modelId:``,sessionId:``}),[k,j]=(0,b.useState)(`all`),[N,F]=(0,b.useState)({total:0,scannedEvents:0,sourceFiles:0,invalidLines:0}),[I,pe]=(0,b.useState)(w),[L,R]=(0,b.useState)(!0),[z,B]=(0,b.useState)(null),[me,V]=(0,b.useState)(null),[H,he]=(0,b.useState)([]),[U,ge]=(0,b.useState)([]),[W,_e]=(0,b.useState)(null),G=(0,b.useRef)(g);G.current=g;let K=(0,b.useCallback)(e=>{if(!n.supportsCapability(`chronicle.query`)){R(!1),B(`Restart the backend once to activate Chronicle protocol support.`);return}if(R(!0),B(null),S(e),m({}),n.send({type:`chronicle.query`,payload:{query:e}}),n.supportsCapability(`chronicle.facets`))n.send({type:`chronicle.facets`,payload:{fields:[...M],query:e,limit:12}});else for(let t of M)n.send({type:`chronicle.facet`,payload:{field:t,query:e,limit:12}})},[n]),q=(0,b.useCallback)(()=>{n.supportsCapability(`chronicle.metrics`)&&(n.send({type:`chronicle.metrics`,payload:{view:`providers`}}),n.send({type:`chronicle.metrics`,payload:{view:`tasks`,limit:200}}))},[n]),J=(0,b.useCallback)(()=>{n.supportsCapability(`chronicle.status`)&&n.send({type:`chronicle.status`})},[n]);(0,b.useEffect)(()=>{let e=n.on(`chronicle.query_result`,e=>{e.type===`chronicle.query_result`&&(c(e.payload.events),F(e.payload),pe(e.payload.summary??w),R(!1))}),t=n.on(`chronicle.facet_result`,e=>{e.type===`chronicle.facet_result`&&m(t=>({...t,[e.payload.field]:e.payload.values}))}),r=n.on(`chronicle.facets_result`,e=>{e.type===`chronicle.facets_result`&&m(e.payload.values)}),i=n.on(`chronicle.error`,e=>{e.type===`chronicle.error`&&(B(e.payload.message),R(!1))}),a=n.on(`chronicle.graph_result`,e=>{e.type===`chronicle.graph_result`&&V(e.payload)}),o=n.on(`chronicle.metrics_result`,e=>{e.type===`chronicle.metrics_result`&&(e.payload.view===`providers`?he(e.payload.data):e.payload.view===`tasks`&&ge(e.payload.data))}),s=n.on(`chronicle.status_result`,e=>{e.type===`chronicle.status_result`&&_e(e.payload)});return K(G.current),q(),J(),()=>{e(),t(),r(),i(),a(),o(),s()}},[n,K,q,J]);let Y=(0,b.useMemo)(()=>r.filter(e=>ce(e,k)),[r,k]),X=ie(Y,25,k),Z=(0,b.useMemo)(()=>{let e=r.find(e=>e.eventType===`metrics.rollup`&&e.attributes?.signal===`runtime.health`)?.attributes?.stats;if(!e)return;let t=t=>e[t]?.last;return{eventLoop:{utilization:t(`eventLoop.utilization`),delayP95Ms:t(`eventLoop.delayP95Ms`)},memory:{heapUsedBytes:t(`memory.heapUsedBytes`)},chronicle:{pendingEvents:t(`chronicle.pendingEvents`),rejectedEvents:t(`chronicle.rejectedEvents`)}}},[r]),Q=(0,b.useMemo)(()=>{let e={};for(let t of U)e[t.status]=(e[t.status]??0)+1;let t=(e.completed??0)+(e.merged??0)+(e.failed??0)+(e.conflict??0),n=(e.completed??0)+(e.merged??0),r=[...U].sort((e,t)=>(t.endedAt??t.startedAt??``).localeCompare(e.endedAt??e.startedAt??``)).slice(0,8);return{counts:e,total:U.length,terminal:t,successRate:t>0?n/t*100:100,recent:r}},[U]),$=()=>K({...P(),...C.text?{text:C.text}:{},...C.path?{path:C.path}:{},...C.providerId?{providerId:C.providerId}:{},...C.modelId?{modelId:C.modelId}:{},...C.sessionId?{sessionId:C.sessionId}:{}}),ve=()=>{T({text:``,path:``,providerId:``,modelId:``,sessionId:``}),j(`all`),K(P())},ye=e=>{d(e),V(null),n.supportsCapability(`chronicle.graph`)&&n.send({type:`chronicle.graph`,payload:{seed:{eventId:e.eventId},hops:2,maxNodes:250}})};return(0,x.jsxs)(`div`,{className:`flex h-full min-h-0 bg-background`,"data-testid":`chronicle-dashboard`,children:[(0,x.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,x.jsx)(`header`,{className:`border-b border-border/70 bg-gradient-to-r from-primary/[0.045] via-background to-background px-5 py-4`,children:(0,x.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(a,{className:`h-5 w-5 text-primary`}),(0,x.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:e(`activity:chronicle.codingIntelligence`)}),(0,x.jsx)(`span`,{className:`rounded-full border border-primary/20 bg-primary/10 px-2 py-0.5 text-[9px] font-semibold tracking-wider text-primary`,children:e(`activity:chronicle.chronicle`)})]}),(0,x.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`activity:chronicle.llmAgentToolAndFileEvidence`)})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`span`,{className:v(`h-2 w-2 rounded-full`,z?`bg-destructive`:L?`animate-pulse bg-warning`:`bg-success`)}),(0,x.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:L?`Reading journal`:z?`Unavailable`:`Live evidence`}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>{K(g),q(),J()},className:`ml-2 rounded-md border border-border bg-card p-2 hover:bg-muted`,title:e(`activity:chronicle.refreshEvidence`),children:(0,x.jsx)(ee,{className:v(`h-4 w-4`,L&&`animate-spin`)})})]})]})}),(0,x.jsxs)(`section`,{className:`grid grid-cols-2 border-b border-border/70 xl:grid-cols-6`,children:[(0,x.jsx)(O,{icon:(0,x.jsx)(a,{}),label:e(`activity:chronicle.llmRequests`),value:I.logicalRequests,detail:`${I.modelAttempts} attempts · ${I.providers} providers · ${I.models} models`}),(0,x.jsx)(O,{icon:(0,x.jsx)(u,{}),label:e(`activity:chronicle.agentWork`),value:I.agentEvents,detail:`${I.uniqueAgents} correlated agents · ${I.decisions} decisions`}),(0,x.jsx)(O,{icon:(0,x.jsx)(p,{}),label:e(`activity:chronicle.toolCalls`),value:I.toolCalls,detail:`${I.failedTools} failed · ${I.processes} processes`}),(0,x.jsx)(O,{icon:(0,x.jsx)(_,{}),label:e(`activity:chronicle.fileEvidence`),value:I.fileEvents,detail:`${I.uniqueFiles} unique paths`}),(0,x.jsx)(O,{icon:(0,x.jsx)(o,{}),label:e(`activity:chronicle.retries`),value:I.scheduledRetries,detail:`${I.failures} failures · ${I.fallbacks} fallbacks`,tone:I.failures?`danger`:`normal`}),(0,x.jsx)(O,{icon:(0,x.jsx)(re,{}),label:e(`activity:chronicle.providerP95`),value:E(I.providerP95DurationMs),detail:`${E(I.providerAvgDurationMs)} average · all matches`})]}),(0,x.jsxs)(`section`,{className:`flex flex-wrap gap-x-6 gap-y-1 border-b border-border/60 bg-primary/[0.018] px-4 py-1.5 font-mono text-[9px] text-muted-foreground`,children:[(0,x.jsx)(`span`,{className:`font-sans font-semibold uppercase tracking-wider text-primary`,children:e(`activity:chronicle.tokenEconomics`)}),(0,x.jsxs)(`span`,{children:[e(`activity:chronicle.freshInput`),` `,(0,x.jsx)(`b`,{className:`text-foreground`,children:I.inputTokens.toLocaleString()})]}),(0,x.jsxs)(`span`,{children:[`output `,(0,x.jsx)(`b`,{className:`text-foreground`,children:I.outputTokens.toLocaleString()})]}),(0,x.jsxs)(`span`,{children:[e(`activity:chronicle.cacheRead`),` `,(0,x.jsx)(`b`,{className:`text-foreground`,children:I.cacheReadTokens.toLocaleString()})]}),(0,x.jsxs)(`span`,{children:[`cache write`,` `,(0,x.jsx)(`b`,{className:`text-foreground`,children:I.cacheWriteTokens.toLocaleString()})]}),(0,x.jsxs)(`span`,{children:[e(`activity:chronicle.cacheHit`),` `,(0,x.jsxs)(`b`,{className:`text-foreground`,children:[se(I).toFixed(1),`%`]})]}),(0,x.jsxs)(`span`,{children:[e(`activity:chronicle.estimatedCost`),` `,(0,x.jsxs)(`b`,{className:`text-foreground`,children:[`$`,I.estimatedCostUsd.toFixed(4)]})]})]}),H.length>0&&(0,x.jsxs)(`section`,{className:`flex items-center gap-3 overflow-x-auto border-b border-border/60 bg-muted/[0.14] px-4 py-1.5`,children:[(0,x.jsx)(`span`,{className:`shrink-0 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e(`activity:chronicle.modelReliability`)}),H.slice(0,6).map(e=>{let t=e.completed+e.failed,n=t>0?e.completed/t*100:100;return(0,x.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 rounded-full border border-border bg-card px-2.5 py-0.5 font-mono text-[9px]`,title:`${e.day} · ${e.attempts} attempts · avg ${E(e.avgDurationMs)} · ${e.inputTokens.toLocaleString()} in / ${e.outputTokens.toLocaleString()} out`,children:[(0,x.jsx)(`span`,{className:v(`h-1.5 w-1.5 rounded-full`,n>=99?`bg-success`:n>=90?`bg-warning`:`bg-destructive`)}),(0,x.jsxs)(`span`,{className:`max-w-[180px] truncate`,children:[e.providerId,`/`,e.modelId]}),(0,x.jsxs)(`b`,{className:`text-foreground`,children:[n.toFixed(0),`%`]}),(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:e.day.slice(5)})]},`${e.day}-${e.providerId}-${e.modelId}`)})]}),Q.total>0&&(0,x.jsxs)(`section`,{className:`flex items-center gap-3 overflow-x-auto border-b border-border/60 bg-muted/[0.10] px-4 py-1.5`,children:[(0,x.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,x.jsx)(te,{className:`h-3 w-3`}),e(`activity:chronicle.taskOutcomes`)]}),(0,x.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 rounded-full border border-border bg-card px-2.5 py-0.5 font-mono text-[9px]`,title:`${Q.total} tasks tracked · ${Q.terminal} finished`,children:[(0,x.jsx)(`span`,{className:v(`h-1.5 w-1.5 rounded-full`,Q.successRate>=90?`bg-success`:Q.successRate>=60?`bg-warning`:`bg-destructive`)}),(0,x.jsxs)(`b`,{className:`text-foreground`,children:[Q.successRate.toFixed(0),`%`]}),(0,x.jsxs)(`span`,{className:`text-muted-foreground`,children:[`success · `,Q.total,` tasks`]})]}),[`completed`,`merged`,`failed`,`conflict`,`started`].filter(e=>Q.counts[e]).map(e=>(0,x.jsxs)(`span`,{className:`shrink-0 font-mono text-[9px] text-muted-foreground`,children:[e,` `,(0,x.jsx)(`b`,{className:v(e===`failed`||e===`conflict`?`text-destructive`:`text-foreground`),children:Q.counts[e]})]},e)),(0,x.jsx)(`span`,{className:`mx-1 h-3 w-px shrink-0 bg-border`}),Q.recent.map(e=>(0,x.jsxs)(`button`,{type:`button`,onClick:()=>K({limit:300,order:`desc`,taskId:e.taskId}),className:`flex shrink-0 items-center gap-1.5 rounded-full border border-border bg-card px-2 py-0.5 font-mono text-[9px] hover:border-primary/50`,title:`${e.taskId}${e.boardId?` · board ${e.boardId}`:``}${e.sessionId?` · ${e.sessionId}`:``} · ${e.filesTouched} files${e.retries?` · ${e.retries} retries`:``}${e.verificationFailures?` · ${e.verificationFailures} verify-fails`:``}`,children:[(0,x.jsx)(`span`,{className:v(`h-1.5 w-1.5 rounded-full`,e.status===`completed`||e.status===`merged`?`bg-success`:e.status===`failed`||e.status===`conflict`?`bg-destructive`:`bg-primary`)}),(0,x.jsx)(`span`,{className:`max-w-[84px] truncate`,children:e.taskId}),e.durationMs!==null&&(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:E(e.durationMs)}),e.filesTouched>0&&(0,x.jsxs)(`span`,{className:`flex items-center gap-0.5 text-muted-foreground`,children:[(0,x.jsx)(_,{className:`h-2.5 w-2.5`}),e.filesTouched]})]},e.taskId))]}),(0,x.jsx)(`section`,{className:`border-b border-border/70 px-4 py-3`,children:(0,x.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 xl:grid-cols-[1.35fr_1fr_1fr_1fr_1fr_auto]`,children:[(0,x.jsx)(D,{icon:(0,x.jsx)(i,{}),placeholder:e(`activity:chronicle.searchEventEvidence`),value:C.text,onChange:e=>T(t=>({...t,text:e})),onEnter:$}),(0,x.jsx)(D,{placeholder:e(`activity:chronicle.fileOrDirectory`),value:C.path,onChange:e=>T(t=>({...t,path:e})),onEnter:$}),(0,x.jsx)(D,{placeholder:e(`activity:chronicle.provider`),value:C.providerId,onChange:e=>T(t=>({...t,providerId:e})),onEnter:$}),(0,x.jsx)(D,{placeholder:e(`activity:chronicle.model`),value:C.modelId,onChange:e=>T(t=>({...t,modelId:e})),onEnter:$}),(0,x.jsx)(D,{placeholder:e(`activity:chronicle.session`),value:C.sessionId,onChange:e=>T(t=>({...t,sessionId:e})),onEnter:$}),(0,x.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,x.jsxs)(`button`,{type:`button`,onClick:$,className:`rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground`,children:[(0,x.jsx)(ne,{className:`mr-1 inline h-3 w-3`}),e(`activity:chronicle.apply`)]}),(0,x.jsx)(`button`,{type:`button`,onClick:ve,className:`rounded-md border border-border px-2.5 text-xs hover:bg-muted`,children:e(`activity:chronicle.clear`)})]})]})}),(0,x.jsxs)(`section`,{className:`flex items-center gap-1 overflow-x-auto border-b border-border/70 px-4 py-2`,children:[fe.map(t=>(0,x.jsxs)(`button`,{type:`button`,onClick:()=>j(t.id),className:v(`flex shrink-0 items-center gap-1.5 rounded-md px-2.5 py-1.5 text-[11px] transition-colors [&>svg]:h-3.5 [&>svg]:w-3.5`,k===t.id?`bg-primary/10 font-medium text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[t.icon,e(t.labelKey),(0,x.jsx)(`span`,{className:`ml-1 rounded bg-background/70 px-1 font-mono text-[9px]`,children:oe(I,t.id,N.total)})]},t.id)),(0,x.jsxs)(`div`,{className:`ml-auto hidden items-center gap-3 pl-4 text-[9px] text-muted-foreground lg:flex`,children:[(0,x.jsxs)(`span`,{children:[N.total.toLocaleString(),` matched`]}),(0,x.jsxs)(`span`,{children:[N.sourceFiles,` journal files`]}),N.invalidLines>0&&(0,x.jsxs)(`span`,{className:`text-warning`,children:[N.invalidLines,` invalid lines`]})]})]}),W&&(0,x.jsx)(ae,{status:W}),Z&&(0,x.jsx)(le,{health:Z}),(0,x.jsx)(`section`,{className:`flex gap-4 overflow-x-auto border-b border-border/60 bg-muted/[0.18] px-4 py-2`,children:[`providerId`,`modelId`,`outcome`].map(e=>(0,x.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,x.jsx)(`span`,{className:`mr-1 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e.replace(`Id`,``)}),(f[e]??[]).slice(0,4).map(t=>(0,x.jsxs)(`button`,{type:`button`,onClick:()=>K({...g,[e]:t.value}),className:`rounded-full border border-border bg-card px-2 py-0.5 text-[9px] hover:border-primary/50`,children:[t.value,` `,(0,x.jsx)(`b`,{children:t.count})]},t.value))]},e))}),(0,x.jsxs)(`div`,{className:`grid grid-cols-[92px_minmax(190px,1.25fr)_110px_minmax(180px,1fr)_minmax(140px,.8fr)_24px] gap-3 border-b border-border/60 bg-muted/20 px-4 py-1.5 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,x.jsx)(`span`,{children:e(`activity:chronicle.time`)}),(0,x.jsx)(`span`,{children:e(`activity:chronicle.signal`)}),(0,x.jsx)(`span`,{children:e(`activity:chronicle.outcome`)}),(0,x.jsx)(`span`,{children:e(`activity:chronicle.modelAgent`)}),(0,x.jsx)(`span`,{children:e(`activity:chronicle.resource`)}),(0,x.jsx)(`span`,{})]}),(0,x.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:z?(0,x.jsx)(A,{text:z}):!L&&Y.length===0?(0,x.jsx)(A,{text:`No coding evidence matches these filters.`}):(0,x.jsx)(`div`,{className:`divide-y divide-border/40`,children:X.pageItems.map(e=>(0,x.jsx)(ue,{event:e,active:l?.eventId===e.eventId,onClick:()=>ye(e)},e.eventId))})}),(0,x.jsx)(y,{page:X.page,pageSize:X.pageSize,totalItems:X.totalItems,onPageChange:X.setPage,itemLabel:`events`})]}),l&&(0,x.jsxs)(`aside`,{className:`w-[440px] max-w-[48vw] shrink-0 overflow-auto border-l border-border bg-card/60 shadow-[-12px_0_32px_hsl(var(--background)/.35)]`,children:[(0,x.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center justify-between border-b border-border bg-card/95 px-4 py-3 backdrop-blur`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`div`,{className:`text-xs font-semibold`,children:e(`activity:chronicle.evidenceLineage`)}),(0,x.jsxs)(`div`,{className:`mt-0.5 font-mono text-[9px] text-muted-foreground`,children:[`#`,l.sequence,` · `,l.eventId]})]}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>d(null),className:`rounded p-1 hover:bg-muted`,children:(0,x.jsx)(s,{className:`h-4 w-4`})})]}),(0,x.jsx)(de,{event:l,graph:me})]})]})}export{F as ChronicleDashboard};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,j as n,t as r}from"./config-store-Cb4iyhGv.js";import{i,t as a}from"./react-core-wiHys0m2.js";import{Bi as o,Bt as s,Da as c,Dr as l,En as u,Fr as d,Ga as f,Ia as p,Ii as m,Ir as h,La as g,Mt as _,Na as v,Oi as y,Ri as b,Vn as x,Ya as S,bn as C,di as w,en as T,ln as E,ra as D,va as O,vo as k,wo as A}from"./vendor-BfBvt432.js";import"./i18n-CzTjKT4L.js";import{t as j}from"./utils-B21Devim.js";import{o as M}from"./view-navigation-Cvrp_uJm.js";import{a as ee,m as N,x as P,y as F}from"./stores-Svlibwo5.js";import{i as I}from"./codemap-activity-store-WjfEZe4_.js";import{C as L}from"./fonts-C303yVU_.js";import{B as R,o as te,x as z,z as B}from"./index-Ci22AODp.js";import{a as V,c as H,i as U,n as ne,o as W,s as G,t as K}from"./monaco-CbI7qrVD.js";import{t as q}from"./monaco-theme-Dr3-rSid.js";import{t as J}from"./empty-state-BzoEa04Q.js";import{t as re}from"./MemoryDrawer-4lDXuHCi.js";var Y=e(i(),1),X={ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,css:`css`,html:`html`,svg:`xml`,md:`markdown`,yml:`yaml`,yaml:`yaml`,toml:`toml`,sh:`shell`,bash:`shell`,ps1:`powershell`,py:`python`,rs:`rust`,go:`go`,rb:`ruby`,java:`java`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sql:`sql`,xml:`xml`},ie=Array.from(new Set(Object.values(X))).filter(e=>e!==`plaintext`),ae=12e3,oe=4e3,se=5e3,ce=1e4;function le(e){return X[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function ue(e){return e.match(/([A-Za-z_$][\w$]*)$/)?.[1]??``}function de(e,t){return e.triggerCharacter?!0:t.length>=3}function fe(e,t){return e.triggerCharacter===`.`||!e.triggerCharacter&&/^(findBy|findAllBy|create|update|delete|remove|get[A-Z_]|set[A-Z_]|use[A-Z_])/.test(t)}function pe(e){return[e.filePath,e.language,e.lineNumber,e.column,e.versionId??``,e.triggerCharacter??``,e.linePrefix.slice(-160),e.suffix.slice(0,160)].join(`\0`)}function me(e){let t=new Set,n=new Set,r=new Set,i=new Set,a=new Set,o,s;for(let c of e)c.sessionId&&t.add(c.sessionId),c.taskId&&n.add(c.taskId),c.boardId&&r.add(c.boardId),c.toolName&&i.add(c.toolName),c.modelId&&a.add(c.modelId),(!o||c.occurredAt<o)&&(o=c.occurredAt),(!s||c.occurredAt>s)&&(s=c.occurredAt);return{mutations:e.length,sessions:t.size,tasks:n.size,boards:r.size,tools:[...i],models:[...a],firstAt:o,lastAt:s}}var he=/(write|edit|update|create|delete|rename|modified|changed)/i;function ge(e){return e.replace(/\\/g,`/`).replace(/^\.\//,``).replace(/\/{2,}/g,`/`).toLowerCase()}function Z(e,t){let n=ge(e),r=ge(t);return n===r||n.endsWith(`/${r}`)||r.endsWith(`/${n}`)}function _e(e,t=Date.now()){let n=e.filter(e=>t-e.at<=18e5),r=n.filter(e=>he.test(e.action)),i=new Set(n.map(e=>e.sessionId).filter(Boolean)).size,a=new Set(n.map(e=>e.actor).filter(Boolean)).size,o=new Set(n.map(e=>e.taskId).filter(Boolean)).size;return{level:r.length>=8||r.length>=4&&a>=3?`churn`:r.length>0?`active`:`quiet`,mutationCount:r.length,sessionCount:i,actorCount:a,taskCount:o}}function Q(e){return typeof e==`string`&&e.length>0?e:void 0}function ve(e){let t=Date.parse(e.occurredAt??e.observedAt);return Number.isFinite(t)?t:Date.now()}function ye(e){let t=e.attributes??{},n=Q(t.operation)??e.eventType,r=e.scope.agentId,i=e.runtime?.providerId,a=e.runtime?.modelId;return{id:e.eventId,at:ve(e),action:n,actor:r??i??Q(t.actor)??`external`,source:Q(t.source)??e.tags?.collector??`chronicle`,summary:[e.eventType,i&&a?`${i}/${a}`:i,e.outcome].filter(Boolean).join(` · `),sessionId:e.scope.sessionId,agentId:r,taskId:e.scope.taskId??Q(t.taskId),boardId:Q(t.boardId)??e.scope.boardId,tool:Q(t.toolName),status:e.outcome,raw:e}}function be(e){return{id:e.id??`${e.filePath}:${e.timestamp}:${e.type}`,at:e.timestamp,action:e.type,actor:e.agentName??e.agent??e.agentId??`external`,source:e.source??`live`,summary:e.summary,sessionId:e.sessionId,agentId:e.agentId,tool:e.toolName,status:e.status,raw:e}}function xe(e){let t=new Set;return e.sort((e,t)=>t.at-e.at).filter(e=>{let n=`${e.id}:${e.at}`;return!t.has(n)&&(t.add(n),!0)})}function Se(e){return e?e.split(/\r?\n/).length:0}function Ce(e){return new TextEncoder().encode(e).length}function we(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function Te(e){return e.length>18?`${e.slice(0,8)}…${e.slice(-6)}`:e}function Ee(e,t){let n=R(e,t);return n?{added:n.filter(e=>e.kind===`add`).length,removed:n.filter(e=>e.kind===`del`).length,large:!1}:{added:0,removed:0,large:!0}}var $=a();function De({text:e}){return(0,$.jsx)(`div`,{className:`px-3 py-3 text-center text-[10px] text-muted-foreground`,children:e})}function Oe({record:e,raw:t=!1}){let n=new Date(e.at).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),r=(0,$.jsxs)(`div`,{className:`grid grid-cols-[62px_74px_minmax(90px,.7fr)_minmax(160px,1.5fr)] items-center gap-2 text-[9px]`,children:[(0,$.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:n}),(0,$.jsx)(`span`,{className:j(`w-fit rounded px-1.5 py-0.5 font-mono`,he.test(e.action)?`bg-warning/10 text-warning`:`bg-primary/10 text-primary`),children:e.action}),(0,$.jsx)(`span`,{className:`truncate`,title:e.agentId,children:e.actor}),(0,$.jsx)(`span`,{className:`truncate text-muted-foreground`,title:e.summary,children:e.summary})]});return t?(0,$.jsxs)(`details`,{className:`group cursor-pointer px-2.5 py-1.5`,children:[(0,$.jsx)(`summary`,{className:`list-none [&::-webkit-details-marker]:hidden`,children:r}),(0,$.jsx)(`pre`,{className:`mt-1.5 max-h-48 overflow-auto rounded border border-border/60 bg-background/60 p-2 font-mono text-[8px] leading-relaxed text-muted-foreground`,children:JSON.stringify(e.raw,null,2)})]}):(0,$.jsx)(`div`,{className:`px-2.5 py-1.5`,children:r})}function ke({records:e,loading:t}){let{t:n}=A();return t&&e.length===0?(0,$.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-[10px] text-muted-foreground`,children:[(0,$.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}),n(`activity:fileActivity.loadingEvidence`)]}):e.length===0?(0,$.jsx)(De,{text:n(`activity:fileActivity.noEvidence`)}):(0,$.jsx)(`div`,{className:`divide-y divide-border/40`,children:e.map(e=>(0,$.jsx)(Oe,{record:e,raw:!0},`${e.id}:${e.at}`))})}function Ae({title:e,subtitle:t,raw:n}){return(0,$.jsxs)(`div`,{className:`rounded-md border border-border/60 bg-background/45 px-2 py-1.5`,title:n,children:[(0,$.jsx)(`div`,{className:`truncate text-[10px] font-medium`,children:e}),(0,$.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[8px] text-muted-foreground`,children:t})]})}function je({icon:e,title:t,empty:n,children:r}){let i=Array.isArray(r)?r.length>0:!!r;return(0,$.jsxs)(`section`,{className:`min-w-0 p-2`,children:[(0,$.jsxs)(`h3`,{className:`mb-1.5 flex items-center gap-1.5 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground [&>svg]:h-3 [&>svg]:w-3`,children:[e,t]}),(0,$.jsx)(`div`,{className:`space-y-1`,children:i?r:(0,$.jsx)(De,{text:n})})]})}function Me({sessions:e,agents:t,tasks:n,records:r,taskLabel:i,boardTitle:a}){let{t:o}=A();return(0,$.jsxs)(`div`,{className:`grid min-h-full grid-cols-1 divide-y divide-border/50 md:grid-cols-3 md:divide-x md:divide-y-0`,children:[(0,$.jsx)(je,{icon:(0,$.jsx)(s,{}),title:o(`activity:fileActivity.sessions`),empty:o(`activity:fileActivity.noSessions`),children:e.map(e=>(0,$.jsx)(Ae,{title:Te(e),subtitle:`${r.filter(t=>t.sessionId===e).length} ${o(`activity:fileActivity.events`)}`,raw:e},e))}),(0,$.jsx)(je,{icon:(0,$.jsx)(S,{}),title:o(`activity:fileActivity.actors`),empty:o(`activity:fileActivity.noActors`),children:t.map(e=>(0,$.jsx)(Ae,{title:e,subtitle:`${r.filter(t=>t.actor===e).length} ${o(`activity:fileActivity.events`)}`},e))}),(0,$.jsx)(je,{icon:(0,$.jsx)(h,{}),title:o(`activity:fileActivity.workLinks`),empty:o(`activity:fileActivity.noWorkLinks`),children:n.map(e=>(0,$.jsx)(Ae,{title:i(e),subtitle:a??o(`activity:fileActivity.taskOrTodo`),raw:e},e))})]})}function Ne({lifetime:e}){let{t}=A(),n=[{value:e.mutations,label:t(`activity:fileActivity.lifetimeChanges`)},{value:e.sessions,label:t(`activity:fileActivity.lifetimeSessions`)},{value:e.tasks,label:t(`activity:fileActivity.lifetimeTasks`)},{value:e.boards,label:t(`activity:fileActivity.lifetimeBoards`)}],r=e.firstAt?new Date(e.firstAt).toLocaleDateString():void 0;return(0,$.jsxs)(`div`,{className:`rounded-md border border-primary/15 bg-primary/[0.03] px-2.5 py-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[9px] font-semibold uppercase tracking-wider text-primary [&>svg]:h-3 [&>svg]:w-3`,children:[(0,$.jsx)(o,{}),t(`activity:fileActivity.lifetimeTitle`)]}),(0,$.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[9px] text-muted-foreground`,children:[n.map(e=>(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`b`,{className:`text-foreground`,children:e.value.toLocaleString()}),` `,e.label]},e.label)),r&&(0,$.jsx)(`span`,{children:t(`activity:fileActivity.lifetimeSince`,{date:r})})]}),e.tools.length>0&&(0,$.jsx)(`div`,{className:`mt-1 truncate font-mono text-[8px] text-muted-foreground`,title:e.tools.join(`, `),children:t(`activity:fileActivity.lifetimeTools`,{tools:e.tools.slice(0,6).join(`, `)})})]})}function Pe({analysis:e,lifetime:t,records:n,sessions:r,agents:i,tasks:a,taskLabel:o}){let{t:c}=A(),l=[{label:c(`activity:fileActivity.mutations30m`),value:e.mutationCount,icon:(0,$.jsx)(m,{})},{label:c(`activity:fileActivity.sessions`),value:r.length,icon:(0,$.jsx)(s,{})},{label:c(`activity:fileActivity.actors`),value:i.length,icon:(0,$.jsx)(S,{})},{label:c(`activity:fileActivity.linkedWork`),value:a.length,icon:(0,$.jsx)(h,{})}];return(0,$.jsxs)(`div`,{className:`grid min-h-full grid-cols-1 gap-2 p-2 lg:grid-cols-[minmax(360px,.9fr)_minmax(420px,1.35fr)]`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`div`,{className:`grid grid-cols-4 gap-1.5`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`rounded-md border border-border/70 bg-background/45 px-2 py-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1 text-[9px] text-muted-foreground [&>svg]:h-3 [&>svg]:w-3`,children:[e.icon,(0,$.jsx)(`span`,{className:`truncate`,children:e.label})]}),(0,$.jsx)(`div`,{className:`mt-0.5 font-mono text-sm font-semibold`,children:e.value})]},e.label))}),t.mutations>0&&(0,$.jsx)(Ne,{lifetime:t}),(0,$.jsxs)(`div`,{className:j(`flex items-start gap-2 rounded-md border px-2.5 py-2 text-[10px]`,e.level===`churn`?`border-destructive/25 bg-destructive/[0.055]`:`border-border/70 bg-background/45`),children:[(0,$.jsx)(C,{className:j(`mt-0.5 h-3.5 w-3.5 shrink-0`,e.level===`churn`?`text-destructive`:`text-primary`)}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`font-semibold`,children:c(`activity:fileActivity.analysisTitle.${e.level}`)}),(0,$.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:c(`activity:fileActivity.analysisBody.${e.level}`,{mutations:e.mutationCount,actors:e.actorCount,sessions:e.sessionCount})})]})]}),a.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 text-[9px]`,children:[(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[c(`activity:fileActivity.workLinks`),`:`]}),a.slice(0,4).map(e=>(0,$.jsx)(`span`,{className:`max-w-[180px] truncate rounded border border-primary/20 bg-primary/5 px-1.5 py-0.5 text-primary`,title:e,children:o(e)},e))]})]}),(0,$.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border/70 bg-background/35`,children:[(0,$.jsx)(`div`,{className:`border-b border-border/60 px-2.5 py-1.5 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:c(`activity:fileActivity.recentActivity`)}),(0,$.jsx)(`div`,{className:`divide-y divide-border/40`,children:n.length===0?(0,$.jsx)(De,{text:c(`activity:fileActivity.noEvidence`)}):n.slice(0,5).map(e=>(0,$.jsx)(Oe,{record:e},`${e.id}:${e.at}`))})]})]})}function Fe({file:e}){let i=r(e=>e.wsUrl),a=t(e=>e.jumpToLine),o=(0,Y.useMemo)(()=>n(i),[i]),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(!0),[_,v]=(0,Y.useState)(null),[y,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(!1),[T,E]=(0,Y.useState)(!0),O=(0,Y.useCallback)(()=>{h(!0),v(null),o.send({type:`files.skeleton`,payload:{filePath:e.path,content:e.content,options:{collapseImports:C,includeDocs:T}}})},[o,e.path,e.content,C,T]);(0,Y.useEffect)(()=>{let t=o.on(`files.skeleton_result`,t=>{if(t.type===`files.skeleton_result`&&t.payload.filePath===e.path){if(h(!1),t.payload.error){v(t.payload.error);return}c(t.payload.skeleton),t.payload.stats&&u(t.payload.stats),t.payload.lang&&p(t.payload.lang)}});return O(),()=>{t()}},[o,e.path,O]);let k=async()=>{if(s)try{await navigator.clipboard.writeText(s),S(!0),setTimeout(()=>S(!1),2e3)}catch{}},A=(e,t)=>{let n=e.match(/(?:\/\*\s*L(\d+)(?:-L\d+)?\s*\*\/|#\s*L(\d+)(?:-L\d+)?)/),r=n?parseInt(n[1]||n[2]||`0`,10):null;return r&&r>0?(0,$.jsxs)(`div`,{className:`group flex items-center justify-between gap-2 rounded px-1.5 py-0.5 hover:bg-primary/10 transition-colors`,children:[(0,$.jsx)(`span`,{className:`truncate`,children:e}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a(r),className:`shrink-0 cursor-pointer rounded bg-primary/20 px-1.5 py-0.5 font-mono text-[9px] font-semibold text-primary opacity-75 group-hover:opacity-100 hover:bg-primary hover:text-primary-foreground transition-all`,title:`Jump to line ${r} in editor`,children:[`Jump to L`,r,` →`]})]},t):(0,$.jsx)(`div`,{className:`px-1.5 py-0.5 whitespace-pre`,children:e},t)};return(0,$.jsxs)(`div`,{className:`flex h-full min-h-[140px] flex-col p-2`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center justify-between gap-2 border-b border-border/50 pb-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/10 px-2 py-0.5 font-mono text-[10px] font-semibold uppercase text-primary`,children:[(0,$.jsx)(b,{className:`h-3 w-3`}),f||`AST`]}),l&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 font-mono text-[10px] font-medium text-success`,children:[`-`,l.tokenSavingsPercent,`% Tokens`]}),(0,$.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[l.originalLines,` → `,l.skeletonLines,` lines`]}),(0,$.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`(`,l.symbolCount,` symbols)`]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[(0,$.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1 text-muted-foreground hover:text-foreground`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:C,onChange:e=>w(e.target.checked),className:`rounded border-border`}),(0,$.jsx)(`span`,{children:`Collapse imports`})]}),(0,$.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1 text-muted-foreground hover:text-foreground`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:T,onChange:e=>E(e.target.checked),className:`rounded border-border`}),(0,$.jsx)(`span`,{children:`Include docs`})]}),(0,$.jsx)(`button`,{type:`button`,onClick:O,className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,title:`Refresh Skeleton`,children:(0,$.jsx)(x,{className:j(`h-3.5 w-3.5`,m&&`animate-spin`)})}),(0,$.jsxs)(`button`,{type:`button`,onClick:k,disabled:!s,className:`inline-flex items-center gap-1 rounded bg-secondary px-2 py-1 text-[10px] font-medium text-secondary-foreground hover:bg-secondary/80 disabled:opacity-50`,children:[y?(0,$.jsx)(g,{className:`h-3 w-3 text-success`}):(0,$.jsx)(D,{className:`h-3 w-3`}),(0,$.jsx)(`span`,{children:y?`Copied`:`Copy`})]})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded border border-border/60 bg-muted/20 p-2 font-mono text-[11px] leading-relaxed`,children:m&&!s?(0,$.jsxs)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:[(0,$.jsx)(d,{className:`mr-2 h-4 w-4 animate-spin text-primary`}),(0,$.jsx)(`span`,{children:`Extracting AST Skeleton…`})]}):_?(0,$.jsx)(`div`,{className:`p-4 text-warning`,children:_}):(0,$.jsx)(`div`,{className:`font-mono select-text`,children:s.split(`
|
|
2
|
+
`).map((e,t)=>A(e,t))})})]})}function Ie({label:e}){return(0,$.jsx)(`span`,{className:`hidden whitespace-nowrap font-mono text-[9px] text-muted-foreground sm:inline`,children:e})}function Le({file:e}){let{t}=A(),[i,a]=(0,Y.useState)(!0),[s,l]=(0,Y.useState)(224),[u,d]=(0,Y.useState)(`overview`),[g,_]=(0,Y.useState)([]),[y,S]=(0,Y.useState)([]),[C,T]=(0,Y.useState)(!1),[D,O]=(0,Y.useState)(null),[M,P]=(0,Y.useState)(null),F=(0,Y.useRef)(null),L=r(e=>e.wsUrl),R=I(e=>e.history),te=I(e=>e.activeOperations),z=N(e=>e.activeBoard),V=ee(e=>e.snapshot),H=(0,Y.useMemo)(()=>n(L),[L]),U=(0,Y.useCallback)(()=>{O(null),T(!0),typeof H.getGitDiff==`function`&&H.getGitDiff(e.path);let t=typeof H.supportsCapability==`function`?H.supportsCapability.bind(H):null;t?.(`chronicle.query`)?H.send({type:`chronicle.query`,payload:{query:{path:e.path,resourceKind:`file`,order:`desc`,limit:150}}}):T(!1),t?.(`chronicle.metrics`)&&H.send({type:`chronicle.metrics`,payload:{view:`files`,path:e.path,limit:1e3}})},[H,e.path]);(0,Y.useEffect)(()=>{_([]),S([]),P(null);let t=H.on(`chronicle.query_result`,t=>{if(t.type!==`chronicle.query_result`)return;let n=t.payload.events.filter(t=>t.resource?.path&&Z(t.resource.path,e.path));t.payload.events.length>0&&n.length===0||(_(n),T(!1))}),n=H.on(`chronicle.metrics_result`,t=>{t.type===`chronicle.metrics_result`&&t.payload.view===`files`&&S(t.payload.data.filter(t=>Z(t.path,e.path)))}),r=H.on(`chronicle.error`,e=>{e.type===`chronicle.error`&&(O(e.payload.message),T(!1))}),i=H.on(`git.diff`,t=>{if(t.type!==`git.diff`||!Z(t.payload.path,e.path))return;let n=t.payload;if(n.error||n.binary||n.tooLarge){P({text:e.savedContent,available:!1,error:n.error});return}P({text:n.oldText??``,available:!0})});return U(),()=>{t(),n(),r(),i()}},[H,e.path,e.savedContent,U]),(0,Y.useEffect)(()=>{let e=e=>{if(!F.current)return;let t=F.current.startY-e.clientY,n=Math.max(150,Math.floor(window.innerHeight*.62));l(Math.min(n,Math.max(150,F.current.startHeight+t)))},t=()=>{F.current=null,document.body.style.cursor=``,document.body.style.userSelect=``};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t)}},[]);let ne=(0,Y.useMemo)(()=>{let t=[];for(let[n,r]of R)Z(n,e.path)&&t.push(...r);for(let n of te.values())t.push(...n.filter(t=>Z(t.filePath,e.path)));return t},[te,e.path,R]),W=(0,Y.useMemo)(()=>xe([...ne.map(be),...g.map(ye)]),[g,ne]),G=(0,Y.useMemo)(()=>_e(W),[W]),K=(0,Y.useMemo)(()=>me(y),[y]),q=M?.text??e.savedContent,J=(0,Y.useMemo)(()=>Ee(q,e.content),[q,e.content]),X=(0,Y.useMemo)(()=>[...new Set(W.map(e=>e.sessionId).filter(e=>!!e))],[W]),ie=(0,Y.useMemo)(()=>[...new Set(W.map(e=>e.actor).filter(Boolean))],[W]),ae=(0,Y.useMemo)(()=>[...new Set(W.map(e=>e.taskId).filter(e=>!!e))],[W]),oe=(0,Y.useCallback)(e=>{let t=z?.tasks.find(t=>t.id===e),n=V?.tasks.find(t=>t.id===e||t.shortId===e);return t?.title??n?.title??e},[z,V]),se=e=>{i||a(!0),F.current={startY:e.clientY,startHeight:i?s:150},document.body.style.cursor=`ns-resize`,document.body.style.userSelect=`none`},ce=[{id:`overview`,label:t(`activity:fileActivity.overview`),icon:(0,$.jsx)(k,{})},{id:`changes`,label:t(`activity:fileActivity.changes`),icon:(0,$.jsx)(m,{})},{id:`skeleton`,label:`Skeleton`,icon:(0,$.jsx)(b,{})},{id:`context`,label:t(`activity:fileActivity.context`),icon:(0,$.jsx)(h,{})},{id:`logs`,label:t(`activity:fileActivity.logs`),icon:(0,$.jsx)(E,{})},{id:`memory`,label:t(`activity:fileActivity.memory`),icon:(0,$.jsx)(f,{})}];return(0,$.jsxs)(`section`,{className:`flex shrink-0 flex-col overflow-hidden border-t border-border bg-card/95 shadow-[0_-10px_30px_hsl(var(--background)/0.24)] backdrop-blur`,style:{height:i?s:38},"data-testid":`file-activity-drawer`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":t(`activity:fileActivity.resizeHint`),className:`group relative block h-2 w-full cursor-ns-resize touch-none`,onPointerDown:se,onDoubleClick:()=>{a(!0),l(224)},title:t(`activity:fileActivity.resizeHint`),children:(0,$.jsx)(`span`,{className:`absolute left-1/2 top-0.5 h-1 w-10 -translate-x-1/2 rounded-full bg-border transition-colors group-hover:bg-primary/60`})}),(0,$.jsxs)(`header`,{className:`flex h-[30px] min-w-0 items-center gap-2 border-b border-border/70 px-2.5`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`inline-flex min-w-0 items-center gap-1.5 rounded px-1.5 py-1 text-[11px] font-semibold hover:bg-muted`,"aria-expanded":i,children:[(0,$.jsx)(o,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,$.jsx)(`span`,{className:`truncate`,children:t(`activity:fileActivity.title`)}),i?(0,$.jsx)(p,{className:`h-3 w-3`}):(0,$.jsx)(v,{className:`h-3 w-3`})]}),(0,$.jsx)(`span`,{className:`hidden h-3 w-px bg-border sm:block`}),(0,$.jsx)(Ie,{label:`${Se(e.content)} ${t(`activity:fileActivity.lines`)}`}),(0,$.jsx)(Ie,{label:we(Ce(e.content))}),!J.large&&(J.added>0||J.removed>0)&&(0,$.jsxs)(`span`,{className:`hidden items-center gap-1 font-mono text-[10px] md:flex`,children:[(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,J.added]}),(0,$.jsxs)(`span`,{className:`text-destructive`,children:[`−`,J.removed]})]}),(0,$.jsxs)(`span`,{className:j(`ml-auto inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[9px] font-semibold uppercase tracking-wide`,G.level===`churn`&&`bg-destructive/10 text-destructive`,G.level===`active`&&`bg-warning/10 text-warning`,G.level===`quiet`&&`bg-success/10 text-success`),children:[(0,$.jsx)(c,{className:`h-2.5 w-2.5`}),t(`activity:fileActivity.level.${G.level}`)]}),(0,$.jsx)(`span`,{className:`hidden text-[9px] text-muted-foreground lg:inline`,children:t(`activity:fileActivity.evidenceCount`,{count:W.length})}),i&&(0,$.jsx)(`button`,{type:`button`,onClick:U,className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,title:t(`activity:fileActivity.refresh`),children:(0,$.jsx)(x,{className:j(`h-3.5 w-3.5`,C&&`animate-spin`)})})]}),i&&(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(`nav`,{className:`flex shrink-0 items-center gap-0.5 border-b border-border/60 bg-muted/20 px-2`,children:[ce.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>d(e.id),className:j(`inline-flex h-7 items-center gap-1.5 border-b-2 px-2 text-[10px] transition-colors [&>svg]:h-3 [&>svg]:w-3`,u===e.id?`border-primary font-medium text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:[e.icon,e.label]},e.id)),D&&(0,$.jsx)(`span`,{className:`ml-auto truncate px-2 text-[9px] text-warning`,children:D})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[u===`overview`&&(0,$.jsx)(Pe,{analysis:G,lifetime:K,records:W,sessions:X,agents:ie,tasks:ae,taskLabel:oe}),u===`changes`&&(0,$.jsxs)(`div`,{className:`h-full min-h-[120px] p-2`,children:[(0,$.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2 text-[9px] text-muted-foreground`,children:[(0,$.jsx)(w,{className:`h-3 w-3`}),(0,$.jsx)(`span`,{children:M?.available?t(`activity:fileActivity.gitToBuffer`):t(`activity:fileActivity.savedToBuffer`)}),e.dirty&&(0,$.jsx)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:t(`activity:fileActivity.unsaved`)}),M?.error&&(0,$.jsx)(`span`,{className:`truncate text-warning`,children:M.error})]}),(0,$.jsx)(`div`,{className:`h-[calc(100%-24px)] min-h-[90px]`,children:(0,$.jsx)(B,{oldText:q,newText:e.content,caption:e.path,fill:!0})})]}),u===`skeleton`&&(0,$.jsx)(Fe,{file:e}),u===`context`&&(0,$.jsx)(Me,{sessions:X,agents:ie,tasks:ae,records:W,taskLabel:oe,boardTitle:z?.title??V?.title}),u===`logs`&&(0,$.jsx)(ke,{records:W,loading:C}),u===`memory`&&(0,$.jsx)(`div`,{className:`h-full min-h-[120px]`,children:(0,$.jsx)(re,{filePath:e.path,open:!0,onClose:()=>d(`overview`)})})]})]})]})}U.config({monaco:K});function Re(e){switch(e){case`method`:return H.CompletionItemKind.Method;case`function`:return H.CompletionItemKind.Function;case`constructor`:return H.CompletionItemKind.Constructor;case`field`:return H.CompletionItemKind.Field;case`variable`:return H.CompletionItemKind.Variable;case`class`:return H.CompletionItemKind.Class;case`interface`:return H.CompletionItemKind.Interface;case`module`:return H.CompletionItemKind.Module;case`property`:return H.CompletionItemKind.Property;case`unit`:return H.CompletionItemKind.Unit;case`value`:return H.CompletionItemKind.Value;case`enum`:return H.CompletionItemKind.Enum;case`keyword`:return H.CompletionItemKind.Keyword;case`snippet`:return H.CompletionItemKind.Snippet;case`file`:return H.CompletionItemKind.File;case`reference`:return H.CompletionItemKind.Reference;default:return H.CompletionItemKind.Text}}function ze(){let e=t(e=>e.openFiles),n=t(e=>e.activeFilePath),r=t(e=>e.setActiveFile),i=t(e=>e.closeFile);return e.length===0?null:(0,$.jsx)(`div`,{className:`flex items-center border-b bg-muted/40 overflow-x-auto shrink-0`,children:e.map(e=>{let t=e.path===n,a=e.path.split(`/`).pop()??e.path;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(e.path),onMouseDown:t=>{t.button===1&&(t.preventDefault(),i(e.path))},className:j(`group flex items-center gap-1.5 px-3 py-1.5 text-[11px] border-r whitespace-nowrap min-w-0 max-w-[180px] transition-colors`,t?`bg-background border-t-2 border-t-primary text-foreground -mb-px`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),title:e.path,children:[e.dirty&&(0,$.jsx)(O,{className:`h-2 w-2 fill-current text-primary shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:a}),(0,$.jsx)(_,{className:j(`h-3 w-3 shrink-0 rounded-sm hover:bg-muted-foreground/20 opacity-0 group-hover:opacity-100 transition-opacity`,t&&`opacity-100`),onClick:t=>{t.stopPropagation(),i(e.path)}})]},e.path)})})}function Be(){let{t:e}=A(),i=t(e=>e.openFiles),a=t(e=>e.activeFilePath),o=t(e=>e.updateContent),{theme:s}=z(),c=(0,Y.useRef)(null),d=(0,Y.useRef)(a),f=(0,Y.useRef)(new Map),p=(0,Y.useMemo)(()=>i.find(e=>e.path===a)??null,[i,a]),m=a?le(a):`plaintext`,h=q(),{editor:g}=te();(0,Y.useEffect)(()=>L(()=>G.remeasureFonts()),[]);let[_,v]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)({line:1,col:1}),[S,C]=(0,Y.useState)(!1),[E,D]=(0,Y.useState)(!1),O=F(e=>e.info?.branch);(0,Y.useEffect)(()=>{d.current=a},[a]),(0,Y.useEffect)(()=>{let e=q();G.setTheme(e)},[s]);let k=t(e=>e.targetLine),ee=t(e=>e.clearTargetLine);(0,Y.useEffect)(()=>{k&&c.current&&(c.current.revealLineInCenter(k.line),c.current.setPosition({lineNumber:k.line,column:k.col??1}),c.current.focus(),ee())},[k,ee]),(0,Y.useEffect)(()=>{let e=ie.map(e=>H.registerCompletionItemProvider(e,{triggerCharacters:[`.`,`_`],provideCompletionItems:async(e,t,i,a)=>{let o=d.current;if(!o)return{suggestions:[]};let s=e.getOffsetAt(t),c=e.getValue(),l=c.slice(Math.max(0,s-ae),s),u=c.slice(s,s+oe),p=e.getLineContent(t.lineNumber).slice(0,Math.max(0,t.column-1)),m=ue(p),h={triggerCharacter:i.triggerCharacter,triggerKind:i.triggerKind};if(!de(h,m))return{suggestions:[]};let g=`cmp_${Date.now()}_${Math.random().toString(36).slice(2)}`,_=e.getWordUntilPosition(t),v={startLineNumber:t.lineNumber,endLineNumber:t.lineNumber,startColumn:_.startColumn,endColumn:t.column},y=n(r.getState().wsUrl),b=e=>e.map((e,t)=>({label:e.label,kind:Re(e.kind),insertText:e.insertText,detail:e.detail??(e.source?`WrongStack ${e.source}`:void 0),documentation:e.documentation,sortText:e.sortText??`${String(t).padStart(3,`0`)}-${e.label}`,range:v,insertTextRules:e.kind===`snippet`?H.CompletionItemInsertTextRule.InsertAsSnippet:void 0})),x=pe({filePath:o,language:e.getLanguageId(),lineNumber:t.lineNumber,column:t.column,versionId:e.getVersionId(),triggerCharacter:i.triggerCharacter,linePrefix:p,suffix:u}),S=f.current.get(x);return S&&S.expiresAt>Date.now()?{suggestions:b(S.items)}:await new Promise(n=>{let r=!1,s=()=>{},d=null,p,_=e=>{r||(r=!0,s(),p!==void 0&&window.clearTimeout(p),d?.dispose(),n({suggestions:e}))};s=y.on(`completion.result`,e=>{let t=e;t.payload.requestId===g&&(f.current.set(x,{expiresAt:Date.now()+ce,items:t.payload.items}),_(b(t.payload.items)))}),p=window.setTimeout(()=>_([]),se),d=a.onCancellationRequested(()=>_([])),y.requestCompletion({requestId:g,filePath:o,language:e.getLanguageId(),lineNumber:t.lineNumber,column:t.column,content:c.length<=5e5?c:void 0,prefix:l,suffix:u,triggerCharacter:i.triggerCharacter,triggerKind:i.triggerKind,allowLlm:fe(h,m)})})}}));return()=>{e.forEach(e=>{e.dispose()})}},[]);let N=(0,Y.useCallback)(()=>{let e=c.current;if(!e)return null;let t=e.getSelection();if(!t||t.isEmpty())return null;let n=e.getModel();if(!n)return null;let r=n.getValueInRange(t);return r.trim()?{content:r,startLine:t.startLineNumber,endLine:t.endLineNumber}:null},[]),I=(0,Y.useCallback)(()=>{M(`chat`),requestAnimationFrame(()=>{document.querySelector(`[data-chat-textarea]`)?.focus()})},[]),R=(0,Y.useCallback)(()=>{let e=d.current;if(!e)return;let t=N();t&&(P.getState().addRef({kind:`snippet`,path:e,startLine:t.startLine,endLine:t.endLine,content:t.content}),I())},[N,I]),B=(0,Y.useCallback)(()=>{let e=d.current;e&&(P.getState().addRef({kind:`file`,path:e}),I())},[I]),U=(0,Y.useCallback)(t=>{c.current=t,G.setTheme(q()),t.onDidChangeCursorSelection?.(()=>{let e=t.getSelection();v(!!e&&!e.isEmpty())}),t.onDidChangeCursorPosition?.(e=>{e?.position&&x({line:e.position.lineNumber,col:e.position.column})}),t.addAction({id:`wrongstack-send-to-chat`,label:e(`activity:codeEditor.sendSelectionAction`),contextMenuGroupId:`wrongstack`,contextMenuOrder:0,precondition:void 0,keybindings:[W.CtrlCmd|W.Shift|V.KeyL],run:e=>{let t=e.getSelection();t&&!t.isEmpty()?R():B()}})},[R,B]),K=(0,Y.useCallback)(e=>{a&&e!==void 0&&o(a,e)},[a,o]);return(0,Y.useEffect)(()=>{let e=e=>{let n=e.ctrlKey||e.metaKey,r=e.target?.tagName?.toLowerCase()===`textarea`||e.target?.closest(`.monaco-editor`)!==null;n&&r&&(e.key.toLowerCase()===`s`&&(e.preventDefault(),window.dispatchEvent(new CustomEvent(`wrongstack:save-file`,{detail:{filePath:a}}))),e.key.toLowerCase()===`w`&&(e.preventDefault(),a&&t.getState().closeFile(a)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a]),i.length===0?(0,$.jsx)(J,{title:e(`activity:codeEditor.noFilesOpen`),description:e(`activity:codeEditor.selectToEdit`)}):(0,$.jsxs)(`div`,{className:`flex h-full min-w-0 flex-col overflow-hidden`,children:[(0,$.jsx)(ze,{}),(0,$.jsxs)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(_||p)&&(0,$.jsxs)(`div`,{className:`absolute top-2 right-2 z-10 flex items-center gap-1 rounded-lg border border-border bg-popover/95 backdrop-blur shadow-md p-1`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>C(e=>!e),className:j(`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[11px] transition-colors`,S?`bg-primary/20 text-primary font-medium`:`text-muted-foreground hover:text-foreground hover:bg-accent`),title:S?`Disable word wrap`:`Enable word wrap`,children:[(0,$.jsx)(T,{className:`h-3 w-3`}),(0,$.jsx)(`span`,{children:`Wrap`})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>D(e=>!e),className:j(`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[11px] transition-colors`,E?`bg-primary/20 text-primary font-medium`:`text-muted-foreground hover:text-foreground hover:bg-accent`),title:E?`Hide minimap`:`Show minimap`,children:[(0,$.jsx)(l,{className:`h-3 w-3`}),(0,$.jsx)(`span`,{children:`Map`})]}),(0,$.jsx)(`div`,{className:`h-3.5 w-px bg-border/80 mx-0.5`}),(0,$.jsxs)(`button`,{type:`button`,onClick:_?R:B,className:`inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[11px] text-foreground hover:bg-accent transition-colors`,title:e(_?`activity:codeEditor.sendSelectedTitle`:`activity:codeEditor.mentionFileTitle`),children:[_?(0,$.jsx)(u,{className:`h-3 w-3`}):(0,$.jsx)(y,{className:`h-3 w-3`}),(0,$.jsx)(`span`,{children:e(_?`activity:codeEditor.sendToChat`:`activity:codeEditor.mentionFile`)})]})]}),p?(0,$.jsx)(ne,{language:m,value:p.content,onChange:K,theme:h,onMount:U,loading:(0,$.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,$.jsx)(`span`,{className:`text-[11px] text-muted-foreground animate-pulse`,children:e(`activity:codeEditor.loadingEditor`)})}),options:{minimap:{enabled:E},fontSize:g.fontSize,fontFamily:g.fontFamily,lineHeight:g.lineHeight,fontLigatures:g.fontLigatures,lineNumbers:`on`,renderWhitespace:`selection`,scrollBeyondLastLine:!1,wordWrap:S?`on`:`off`,tabSize:2,smoothScrolling:!0,cursorBlinking:`smooth`,cursorSmoothCaretAnimation:`on`,bracketPairColorization:{enabled:!0},"semanticHighlighting.enabled":!0,automaticLayout:!0,padding:{top:8}}},p.path):(0,$.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e(`activity:codeEditor.selectTab`)})})]}),p&&(0,$.jsxs)(`div`,{className:`flex h-6 shrink-0 items-center justify-between border-t border-border/70 bg-muted/30 px-3 text-[11px] text-muted-foreground font-mono select-none`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[O&&(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-foreground/80 font-medium`,children:[(0,$.jsx)(w,{className:`h-3 w-3 text-primary shrink-0`}),(0,$.jsx)(`span`,{className:`truncate max-w-[140px]`,children:O})]}),(0,$.jsx)(`span`,{className:`truncate max-w-[320px] text-muted-foreground`,children:p.path})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,$.jsxs)(`span`,{children:[`Ln `,b.line,`, Col `,b.col]}),(0,$.jsx)(`span`,{children:`UTF-8`}),(0,$.jsx)(`span`,{className:`uppercase text-[10px] font-semibold text-primary`,children:m})]})]}),p&&(0,$.jsx)(Le,{file:p})]})}export{Be as CodeEditor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{$n as r,Ci as i,Dn as a,Fr as o,Gi as s,Hn as c,Ia as l,Ja as u,Jn as d,Mt as f,Pa as p,Ri as m,cr as h,di as g,n as _,ni as v,nn as y,qa as b,qr as x,sr as S,uo as C,ur as w,vo as T,wo as E,yi as ee,yn as D,yo as te}from"./vendor-BfBvt432.js";import"./i18n-CzTjKT4L.js";import{a as O,c as ne,d as re,f as ie,h as k,m as ae,n as A,o as oe,p as se,r as ce,t as le,u as ue}from"./xyflow-BqDBClm9.js";import{t as j}from"./utils-B21Devim.js";import{i as de,r as fe,t as pe}from"./codemap-activity-store-WjfEZe4_.js";import{S as me}from"./fonts-C303yVU_.js";import{H as he}from"./index-Ci22AODp.js";var M=e(t(),1),ge=4096,N=new Map;function P(e){let t=N.get(e);if(t!==void 0)return t;let n=e.replace(/\\/g,`/`).replace(/^\.\//,``).toLocaleLowerCase();for(;N.size>=ge;){let e=N.keys().next().value;if(e===void 0)break;N.delete(e)}return N.set(e,n),n}function F(e){return e.level===`packages`?`packages`:e.level===`files`?`files:${e.package}`:`symbols:${e.file}`}function _e(e){return e.level===`packages`?`/api/codemap/packages`:e.level===`files`?`/api/codemap/files?package=${encodeURIComponent(e.package)}`:`/api/codemap/symbols?file=${encodeURIComponent(e.file)}`}function ve(e,t,n){let r=new Map(e.nodes.map(e=>[e.id,e])),i=[];for(let a of e.edges){let e=n===`incoming`?a.target===t?a.source:void 0:a.source===t?a.target:void 0;if(!e)continue;let o=r.get(e);o&&i.push({node:o,edge:a})}return i.sort((e,t)=>t.edge.weight-e.edge.weight||e.node.label.localeCompare(t.node.label))}function ye(e,t){let n=new Set([t]);for(let r of e.edges)r.source===t&&n.add(r.target),r.target===t&&n.add(r.source);return n}function I(e,t){let n=new Map(e.nodes.map(e=>[e.id,0]));for(let r of e.edges)t.has(r.source)&&t.has(r.target)&&(n.set(r.source,(n.get(r.source)??0)+r.weight),r.target!==r.source&&n.set(r.target,(n.get(r.target)??0)+r.weight));return n}function be(e){let t=new Set(e.nodes.map(e=>e.id)),n=I(e,t),r=new Map(e.nodes.map(e=>[e.id,0])),i=new Map;for(let n of e.edges){if(!t.has(n.source)||!t.has(n.target)||n.source===n.target)continue;r.set(n.target,(r.get(n.target)??0)+1);let e=i.get(n.source)??[];e.push(n.target),i.set(n.source,e)}let a=new Map,o=e.nodes.filter(e=>(r.get(e.id)??0)===0).sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0)).map(e=>e.id);o.length===0&&e.nodes[0]&&o.push(e.nodes[0].id);for(let e of o)a.set(e,0);let s=new Set,c=0;for(;c<o.length;){let e=o[c++];if(!s.has(e)){s.add(e);for(let t of i.get(e)??[])a.set(t,Math.max(a.get(t)??0,Math.min((a.get(e)??0)+1,7))),r.set(t,(r.get(t)??1)-1),(r.get(t)??0)<=0&&o.push(t)}}let l=e.nodes.filter(e=>!a.has(e.id)).sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0));l.forEach((e,t)=>{a.set(e.id,t%Math.min(4,Math.max(1,l.length)))});let u=new Map;for(let t of e.nodes){let e=a.get(t.id)??0,n=u.get(e)??[];n.push(t),u.set(e,n)}for(let e of u.values())e.sort((e,t)=>Number(e.external)-Number(t.external)||(n.get(t.id)??0)-(n.get(e.id)??0)||e.label.localeCompare(t.label));let d=Math.max(1,...[...u.values()].map(e=>e.length))*208,f=[];for(let[e,t]of[...u.entries()].sort(([e],[t])=>e-t)){let n=(d-t.length*208)/2;t.forEach((t,r)=>{f.push({node:t,position:{x:e*386,y:n+r*208}})})}return f}function L(e,t){if(e.nodes.length===0)return[];let n=I(e,new Set(e.nodes.map(e=>e.id))),r=e.nodes.find(e=>e.id===t)??[...e.nodes].sort((e,t)=>(n.get(t.id)??0)-(n.get(e.id)??0))[0],i=ye(e,r.id);i.delete(r.id);let a=e.nodes.filter(e=>i.has(e.id)),o=e.nodes.filter(e=>e.id!==r.id&&!i.has(e.id)),s=[{node:r,position:{x:0,y:0}}],c=(e,t,n)=>{e.forEach((r,i)=>{let a=n+Math.PI*2*i/Math.max(1,e.length);s.push({node:r,position:{x:Math.cos(a)*t,y:Math.sin(a)*t}})})};c(a,Math.max(330,a.length*34),-Math.PI/2);for(let e=0;e<o.length;e+=18)c(o.slice(e,e+18),620+Math.floor(e/18)*280,-Math.PI/2+.12);return s}function xe(e,t,n){return t===`orbit`?L(e,n):t===`subsystems`?Te(e):be(e)}function Se(e){return e.subsystem??e.package??`(ungrouped)`}var Ce=6,we=96;function Te(e){if(e.nodes.length===0)return[];let t=I(e,new Set(e.nodes.map(e=>e.id))),n=e=>e.rank??(t.get(e.id)??0)/1e3,r=new Map;for(let t of e.nodes){let e=Se(t),n=r.get(e);n===void 0?r.set(e,[t]):n.push(t)}let i=[...r.entries()].map(([e,t])=>({name:e,nodes:[...t].sort((e,t)=>n(t)-n(e)||e.label.localeCompare(t.label)),weight:t.reduce((e,t)=>e+n(t),0)})).sort((e,t)=>e.name===`(ungrouped)`?1:t.name===`(ungrouped)`?-1:t.weight-e.weight||e.name.localeCompare(t.name)),a=[],o=0;for(let e of i){e.nodes.forEach((e,t)=>{a.push({node:e,position:{x:t%Ce*311,y:o+Math.floor(t/Ce)*208}})});let t=Math.ceil(e.nodes.length/Ce);o+=t*208+we}return a}function Ee(e,t,n){if(e.length<=n)return e;let r=t?e.filter(e=>e.source===t||e.target===t):[],i=e.filter(e=>!t||e.source!==t&&e.target!==t).sort((e,t)=>t.weight-e.weight||e.source.localeCompare(t.source)||e.target.localeCompare(t.target)),a=Math.max(0,n-r.length);return[...r,...i.slice(0,a)]}function De(e,t,n){if(n===`all`)return e;let r=e.nodes;if(e.nodes.length>96){let n=new Map(e.nodes.map(e=>[e.id,e])),i=new Map;for(let t of e.edges)i.set(t.source,(i.get(t.source)??0)+t.weight),i.set(t.target,(i.get(t.target)??0)+t.weight);let a=e.nodes.some(e=>e.rank!==void 0),o=e=>a?e.rank??0:i.get(e.id)??0,s=[...e.nodes].sort((e,t)=>o(t)-o(e)||e.label.localeCompare(t.label)),c=new Set,l=e=>{n.has(e)&&c.size<96&&c.add(e)};if(t&&n.has(t)){l(t);let n=e.edges.filter(e=>e.source===t||e.target===t).sort((e,t)=>t.weight-e.weight);for(let e of n)l(e.source),l(e.target);let r=new Set(c),i=e.edges.filter(e=>r.has(e.source)||r.has(e.target)).sort((e,t)=>t.weight-e.weight);for(let e of i)l(e.source),l(e.target)}else{let e=s.filter(e=>!e.external).slice(0,72),t=s.filter(e=>e.external).slice(0,24);for(let n of[...e,...t])l(n.id)}for(let e of s)l(e.id);r=e.nodes.filter(e=>c.has(e.id))}let i=new Set(r.map(e=>e.id)),a=e.edges.filter(e=>i.has(e.source)&&i.has(e.target));return{nodes:r,edges:Ee(a,t,180)}}var R=[`/src/main/java/`,`/src/main/kotlin/`,`/src/`,`/lib/`,`/internal/`,`/cmd/`,`/pkg/`,`/app/`];function z(e){let t=(e.file??e.label).replace(/\\/g,`/`),n=e.package??``,r=n.startsWith(`@wrongstack/`)?`/packages/${n.slice(12)}/`:n.startsWith(`app:`)?`/apps/${n.slice(4)}/`:void 0;if(!r)return;let i=t.indexOf(r);return i>=0?t.slice(i+r.length):void 0}function B(e){let t=(e.file??e.label).replace(/\\/g,`/`),n=z(e);if(n!==void 0)return n;let r=-1,i=0;for(let e of R){let n=t.lastIndexOf(e);n>r&&(r=n,i=n+e.length)}return r>=0?t.slice(i):t.split(`/`).slice(-3).join(`/`)}function Oe(e){if(e.length===0)return``;let t=e.map(e=>e.split(`/`)),n=t[0]??[],r=0;for(;r<n.length-1;){let e=n[r];if(!t.every(t=>t.length-1>r&&t[r]===e))break;r++}return r===0?``:`${n.slice(0,r).join(`/`)}/`}var ke=new WeakMap;function Ae(e){let t=ke.get(e);if(t)return t;let n={name:``,path:``,directories:[],files:[]},r=e.filter(e=>e.kind===`file`&&!e.external),i=r.map(z),a=i.every(e=>e!==void 0),o=a?``:Oe(r.map(e=>(e.file??e.label).replace(/\\/g,`/`)));for(let[e,t]of r.entries()){let r=(t.file??t.label).replace(/\\/g,`/`),s=i[e],c=(a?s??B(t):o&&r.startsWith(o)?r.slice(o.length):B(t)).split(`/`).filter(Boolean),l=c.pop()??t.label,u=n;for(let e of c){let t=u.path?`${u.path}/${e}`:e,n=u.directories.find(t=>t.name===e);n||(n={name:e,path:t,directories:[],files:[]},u.directories.push(n)),u=n}u.files.push({...t,label:l})}let s=e=>{e.directories.sort((e,t)=>e.name.localeCompare(t.name)),e.files.sort((e,t)=>e.label.localeCompare(t.label)),e.directories.forEach(s)};return s(n),ke.set(e,n),n}function je(e){let t=2166136261,n=e=>{for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)};for(let t of e.nodes)n(t.id);for(let r of e.edges)n(r.source),n(r.target),n(r.refType),t^=r.weight|0,t=Math.imul(t,16777619);return`${e.nodes.length}:${e.edges.length}:${t>>>0}`}function Me(e,t,n,r){for(e.has(t)&&e.delete(t),e.set(t,n);e.size>r;){let t=e.keys().next().value;if(t===void 0)break;e.delete(t)}}function Ne(e,t){if(!e||!t)return!1;let n=P(e),r=P(t);return n===r||n.endsWith(`/${r}`)||r.endsWith(`/${n}`)}function Pe(e){let t=P(e),n=t.match(/\/packages\/([^/]+)\//);if(n?.[1])return`@wrongstack/${n[1]}`;let r=t.match(/\/apps\/([^/]+)\//);return r?.[1]?`app:${r[1]}`:`(root)`}function Fe(e,t){return t.kind===`package`?Pe(e.filePath)===(t.package??t.label):Ne(e.filePath,t.file)?t.kind!==`symbol`||e.symbol?.id===t.id:!1}function Ie(e){let t=new Map;for(let n of e){let e=P(n.filePath),r=t.get(e);r?r.push(n):t.set(e,[n])}return t}function V(e,t){let n=new Map;if(t.length===0||e.length===0)return n;let r=Ie(t),i=new Map;for(let a of e){let e;if(a.kind===`package`){let n=a.package??a.label,r=i.get(n);r||(r=t.filter(e=>Pe(e.filePath)===n),i.set(n,r)),e=r}else if(a.file){let t=P(a.file),n=r.get(t);if(!n){n=[];for(let[e,i]of r)(e.endsWith(`/${t}`)||t.endsWith(`/${e}`))&&n.push(...i)}e=a.kind===`symbol`?n.filter(e=>e.symbol?.id===a.id):n}else e=[];e.length>0&&n.set(a.id,e)}return n}function Le(e){if(e.length===0)return``;let t=`${e.length}`;for(let n=0;n<e.length;n++){let r=e[n];t+=`|${r.id??``}:${r.toolUseId??``}:${r.filePath}:${r.type}:${r.status??``}:${r.symbol?.id??``}:${r.timestamp}`}return t}function Re(e,t){let n=t.filter(t=>t.kind===`symbol`&&!t.external&&Ne(t.file,e.filePath));if(n.length===0)return;if(e.line)return[...n].sort((e,t)=>(t.line??0)-(e.line??0)).find(t=>(t.line??0)<=e.line)??n[0];let r=e.summary.toLocaleLowerCase();return n.find(e=>e.label.length>2&&(r.includes(e.label.toLocaleLowerCase())||!!(e.signature&&r.includes(e.signature.toLocaleLowerCase()))))}var ze={nodes:[],edges:[]},H=n(),U={package:{icon:S,accent:`border-l-primary`,iconStyle:`bg-primary/12 text-primary`},file:{icon:m,accent:`border-l-info`,iconStyle:`bg-info/12 text-info`},symbol:{icon:u,accent:`border-l-success`,iconStyle:`bg-success/12 text-success`}},Be=.25;function Ve(e){return e===void 0?`border-l-[3px]`:e>=.6?`border-l-[7px]`:e>=Be?`border-l-[5px]`:`border-l-[3px]`}var He={call:`hsl(var(--primary))`,import:`hsl(var(--info))`,type_ref:`hsl(var(--success))`,inherit:`hsl(var(--warning))`,implement:`hsl(var(--destructive))`},Ue={read:`ring-2 ring-info/60 shadow-info/20`,write:`ring-2 ring-warning/70 shadow-warning/30`,edit:`ring-2 ring-warning/80 shadow-warning/40`,delete:`ring-2 ring-destructive/70 shadow-destructive/30`,search:`ring-2 ring-primary/55 shadow-primary/20`,memory:`ring-2 ring-success/60 shadow-success/30`,index:`ring-2 ring-info/50 shadow-info/20`,execute:`ring-2 ring-primary/55 shadow-primary/25`},We=[`bg-primary text-primary-foreground`,`bg-info text-info-foreground`,`bg-success text-success-foreground`,`bg-warning text-warning-foreground`,`bg-destructive text-destructive-foreground`];function W(e){let t=e.trim().split(/[\s:_-]+/).filter(Boolean);return(t.length>1?`${t[0]?.[0]??``}${t[1]?.[0]??``}`:e.slice(0,2)).toLocaleUpperCase()}function G(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)|0;return We[Math.abs(t)%We.length]??We[0]}function Ge(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)|0;return`hsl(${Math.abs(t)%360} 82% 58%)`}var K=[`/packages/`,`/apps/`,`/crates/`,`/cmd/`,`/internal/`,`/pkg/`,`/src/`];function Ke(e){let t=e.replace(/\\/g,`/`),n=K.reduce((e,n)=>Math.max(e,t.lastIndexOf(n)),-1);return n>=0?t.slice(n+1):t.split(`/`).slice(-3).join(`/`)}function q(e){return[e.symbol?.name,e.line?`L${e.line}`:void 0].filter(Boolean).join(` · `)}function qe({data:e}){let{t}=E(),{graphNode:n,selected:r,dimmed:i,incoming:a,outgoing:o,isActive:l,activityType:u,activeOperations:d}=e,f=U[n.kind],p=f.icon,m=n.kind===`package`||n.kind===`file`&&!!n.file,h=t(n.kind===`package`?`activity:codeMapTree.openFileMap`:`activity:codeMap.openSymbolMap`),g=n.kind===`symbol`?`${n.symbolKind??`symbol`}${n.line?` · L${n.line}`:``}`:n.kind===`file`?B(n):`${n.fileCount??0} files · ${n.symbolCount??0} symbols`;return(0,H.jsxs)(`div`,{className:j(`group relative w-[236px] pointer-events-auto border bg-card text-card-foreground shadow-[0_8px_24px_hsl(var(--shadow-color)/0.08)] transition-[opacity,box-shadow,border-color,background-color]`,f.accent,Ve(n.rank),r&&`border-primary bg-primary/5 shadow-[0_0_0_2px_hsl(var(--primary)/0.18),0_16px_36px_hsl(var(--shadow-color)/0.18)]`,n.external&&`border-dashed bg-muted/75`,i&&`opacity-25 grayscale`,l&&u&&Ue[u]),children:[d.length>0&&(0,H.jsxs)(`div`,{className:`absolute -top-5 left-2 z-20 flex max-w-[210px] items-center gap-1`,children:[d.slice(0,4).map(e=>{let t=e.agentName??e.agent??`External`,n=`${e.sessionId??`none`}:${e.agentId??t}`;return(0,H.jsxs)(`span`,{className:j(`flex h-6 items-center gap-1 border-2 border-background px-1.5 font-mono text-[8px] font-bold shadow-md`,G(n)),title:`${t} · ${e.type} ${q(e)}`,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse bg-current`}),W(t),e.symbol&&(0,H.jsx)(`span`,{className:`max-w-[80px] truncate`,children:e.symbol.name})]},e.id??`${n}:${e.filePath}`)}),d.length>4&&(0,H.jsxs)(`span`,{className:`border bg-card px-1 font-mono text-[8px] shadow`,children:[`+`,d.length-4]})]}),(0,H.jsx)(O,{type:`target`,position:k.Left,className:`!h-2.5 !w-2.5 !border-2 !border-card !bg-muted-foreground`}),(0,H.jsxs)(`button`,{type:`button`,className:`nodrag nopan block w-full cursor-pointer text-left focus-visible:outline-2 focus-visible:outline-primary`,onClick:t=>{if(t.shiftKey&&n.file){e.onShowHistory(n.file);return}m?e.onOpen(n):e.onSelect(n)},"aria-label":`${n.kind} ${n.label}`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3 p-3`,children:[(0,H.jsx)(`span`,{className:j(`flex h-8 w-8 shrink-0 items-center justify-center border`,f.iconStyle),children:(0,H.jsx)(p,{className:`h-4 w-4`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[9px] font-bold uppercase tracking-[0.18em] text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:n.kind}),n.external&&(0,H.jsx)(`span`,{className:`border border-border px-1 py-0.5 text-[8px] text-warning`,children:`external`}),n.rank!==void 0&&n.rank>=.6&&(0,H.jsx)(`span`,{className:`border border-primary/40 bg-primary/10 px-1 py-0.5 text-[8px] text-primary`,children:t(`activity:codeMap.hub`)}),n.lang&&(0,H.jsx)(`span`,{className:`ml-auto font-mono normal-case tracking-normal`,children:n.lang})]}),(0,H.jsx)(`div`,{className:`truncate font-mono text-[13px] font-semibold`,title:n.label,children:n.label}),(0,H.jsx)(`div`,{className:`mt-1 truncate text-[10px] text-muted-foreground`,title:g,children:g}),n.concept&&(0,H.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[9px] leading-snug text-muted-foreground/80`,title:n.concept,children:n.concept})]})]}),n.rank!==void 0&&(0,H.jsx)(`div`,{className:`h-[3px] w-full bg-muted`,title:t(`activity:codeMap.centrality`,{value:Math.round(n.rank*100)}),children:(0,H.jsx)(`div`,{className:`h-full bg-primary/70`,style:{width:`${Math.max(2,Math.round(n.rank*100))}%`}})}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 border-t bg-muted/30 px-3 py-1.5 font-mono text-[9px] text-muted-foreground`,children:[(0,H.jsxs)(`span`,{title:t(`activity:codeMapVisuals.incomingRelationships`),children:[`← `,a]}),(0,H.jsxs)(`span`,{title:t(`activity:codeMapVisuals.outgoingRelationships`),children:[`→ `,o]}),n.symbolCount!==void 0&&n.kind===`file`&&(0,H.jsxs)(`span`,{className:`ml-auto`,children:[n.symbolCount,` sym`]}),l&&(0,H.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 font-bold text-warning`,children:[(0,H.jsx)(c,{className:`h-2.5 w-2.5 animate-pulse`}),` LIVE`]})]})]}),(0,H.jsxs)(`div`,{className:`nodrag nopan flex items-center border-t bg-muted/20`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`flex h-8 cursor-pointer items-center gap-1 px-2 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:t=>{t.stopPropagation(),e.onSelect(n)},"aria-label":`${t(`activity:codeMap.relations`)}: ${n.label}`,"aria-pressed":r,children:[(0,H.jsx)(w,{className:`h-3.5 w-3.5`}),` `,t(`activity:codeMap.relations`)]}),m&&(0,H.jsxs)(`button`,{type:`button`,className:`ml-auto flex h-8 min-w-0 cursor-pointer items-center gap-1 px-2 text-[10px] text-primary hover:bg-primary/10`,onClick:t=>{t.stopPropagation(),e.onOpen(n)},title:h,"aria-label":`Open ${n.label} map`,children:[(0,H.jsx)(s,{className:`h-3.5 w-3.5 shrink-0`}),` `,(0,H.jsx)(`span`,{className:`truncate`,children:h})]}),n.file&&(0,H.jsx)(`button`,{type:`button`,className:`flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:t=>{t.stopPropagation(),e.onShowHistory(n.file)},"aria-label":`${t(`activity:codeMap.activity`)}: ${n.label}`,title:t(`activity:codeMap.activity`),children:(0,H.jsx)(T,{className:`h-3.5 w-3.5`})})]}),(0,H.jsx)(O,{type:`source`,position:k.Right,className:`!h-2.5 !w-2.5 !border-2 !border-card !bg-muted-foreground`})]})}function Je(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Ye(e,t){return e.graphNode===t.graphNode&&e.selected===t.selected&&e.dimmed===t.dimmed&&e.incoming===t.incoming&&e.outgoing===t.outgoing&&e.isActive===t.isActive&&e.activityType===t.activityType&&e.onSelect===t.onSelect&&e.onOpen===t.onOpen&&e.onShowHistory===t.onShowHistory&&Je(e.activeOperations,t.activeOperations)}var Xe={codemap:(0,M.memo)(qe,(e,t)=>Ye(e.data,t.data))};function Ze(e,t){let n=new Map(e.map(e=>[e.id,e])),r=e.length!==t.length,i=t.map((t,i)=>{let a=n.get(t.id);return a?a.type===t.type&&a.position.x===t.position.x&&a.position.y===t.position.y&&Ye(a.data,t.data)?(e[i]!==a&&(r=!0),a):(r=!0,{...a,...t,measured:a.measured}):(r=!0,t)});return r?i:e}function Qe(e){return e.data?.renderKey}function $e(e,t){let n=new Map(e.map(e=>[e.id,e])),r=e.length!==t.length,i=t.map((t,i)=>{let a=n.get(t.id);return a&&Qe(a)===Qe(t)?(e[i]!==a&&(r=!0),a):(r=!0,t)});return r?i:e}function et({positionedNodes:e,deferredActiveOperations:t,deferredPulseActivities:n,selectedId:r,connected:i,incomingCounts:a,outgoingCounts:o,handleSelectNode:s,handleOpenNode:c,setHistoryFile:l,setFlowNodes:u,canvasGraph:d,deferredRecentActivities:f,setAgentTrailCount:p,setFlowEdges:m,fitSignature:h,lastFlowStructuralKey:g,flowRebuildTimer:_,lastFitSignature:v,fitView:y,activityFlowKey:b}){(0,M.useEffect)(()=>{let b=()=>{let h=e.map(({node:e})=>e),g=V(h,t),_=V(h,n),v=new Set(g.keys()),y=e.map(({node:e,position:t})=>{let n=g.get(e.id)??[],u=n[0]??_.get(e.id)?.[0];return{id:e.id,type:`codemap`,position:t,style:{pointerEvents:`all`},data:{graphNode:e,selected:e.id===r,dimmed:!!r&&!i.has(e.id),incoming:a.get(e.id)??0,outgoing:o.get(e.id)??0,isActive:!!u,...u?{activityType:u.type}:{},activeOperations:n,onSelect:s,onOpen:c,onShowHistory:l}}});u(e=>Ze(e,y));let b=6,x=d.edges.map((e,t)=>{let n=!!r&&(e.source===r||e.target===r),i=v.has(e.source)||v.has(e.target),a=i&&(n||b>0);a&&--b;let o=He[e.refType]??`hsl(var(--muted-foreground))`,s=n||i?`smoothstep`:`default`;return{id:`edge:${e.source}:${e.target}:${t}`,source:e.source,target:e.target,type:s,animated:a,label:n?`${e.refType}${e.weight>1?` ×${e.weight}`:``}`:void 0,markerEnd:{type:ae.ArrowClosed,color:o,width:14,height:14},style:{stroke:o,strokeWidth:i?Math.min(2.5+Math.log2(e.weight+1)*.65,5):n?Math.min(1.25+Math.log2(e.weight+1)*.65,4):1,opacity:i?1:r?n?.88:.08:.52},labelStyle:{fontSize:me(9),fontFamily:`var(--font-mono)`,fill:`hsl(var(--muted-foreground))`},labelBgStyle:{fill:`hsl(var(--card))`,fillOpacity:.92},labelBgPadding:[4,2],zIndex:i?4:n?2:0,data:{renderKey:`${e.refType}:${e.weight}:${r?n?`focused`:`dimmed`:`idle`}:${i?`live`:`still`}:${a?`anim`:`still`}:${s}`}}}),S=new Map,C=new Set(t.map(pe));for(let e of[...f].sort((e,t)=>e.timestamp-t.timestamp)){let t=pe(e),n=S.get(t);n?n.push(e):S.set(t,[e])}let w=[...S.entries()].map(([e,t])=>({agentKey:e,activities:t,live:C.has(e),latest:t[t.length-1]?.timestamp??0})).sort((e,t)=>Number(t.live)-Number(e.live)||t.latest-e.latest).slice(0,4),T=[];for(let{agentKey:e,activities:t,live:n}of w){let r=t.slice(-7).map(e=>({activity:e,node:d.nodes.find(t=>Fe(e,t))})).filter(e=>!!e.node).filter((e,t,n)=>t===0||e.node.id!==n[t-1]?.node.id),i=Ge(e);for(let t=1;t<r.length;t++){let a=r[t-1],o=r[t],s=n&&b>0;s&&--b,T.push({id:`trail:${e}:${a.activity.timestamp}:${o.activity.timestamp}`,source:a.node.id,target:o.node.id,type:`smoothstep`,animated:s,label:t===r.length-1?`${W(o.activity.agentName??o.activity.agent??`agent`)} TRAIL`:void 0,markerEnd:{type:ae.ArrowClosed,color:i,width:13,height:13},style:{stroke:i,strokeWidth:2.5,strokeDasharray:`7 5`,opacity:.9},labelStyle:{fontSize:me(8),fontWeight:700,fill:i},labelBgStyle:{fill:`hsl(var(--card))`,fillOpacity:.94},labelBgPadding:[4,2],zIndex:6,data:{renderKey:`${i}:${t===r.length-1?`label`:`plain`}:${n?`live`:`still`}:${s?`anim`:`still`}`}})}}p(T.length),m(e=>$e(e,[...x,...T]))},x=h,S=g.current!==x;g.current=x,_.current!==null&&(window.clearTimeout(_.current),_.current=null),S?b():_.current=window.setTimeout(()=>{_.current=null,b()},120);let C;return v.current!==h&&(C=window.setTimeout(()=>{v.current=h,y({padding:.2,duration:d.nodes.length>48?0:240,maxZoom:1.25})},20)),()=>{_.current!==null&&(window.clearTimeout(_.current),_.current=null),C!==void 0&&window.clearTimeout(C)}},[b,d,r,t,f,n,h,i,y,c,s,a,o,e,m,u])}function tt({historyFile:e,fileHistory:t,onClose:n}){let{t:r}=E();return(0,H.jsxs)(`div`,{className:`absolute right-0 top-0 z-50 flex h-full w-[390px] max-w-[90%] flex-col border-l bg-card shadow-2xl`,children:[(0,H.jsxs)(`div`,{className:`flex h-12 items-center justify-between border-b px-4`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(T,{className:`h-4 w-4 shrink-0 text-warning`}),(0,H.jsx)(`span`,{className:`truncate font-mono text-[11px] font-semibold`,title:e,children:e})]}),(0,H.jsx)(`button`,{type:`button`,onClick:n,className:`flex h-7 w-7 items-center justify-center border text-muted-foreground hover:bg-muted`,"aria-label":r(`activity:codeMap.closeActivity`),children:(0,H.jsx)(f,{className:`h-3.5 w-3.5`})})]}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:t.length===0?(0,H.jsx)(`p`,{className:`py-12 text-center text-[10px] text-muted-foreground`,children:r(`activity:codeMap.noActivityRecordedForThisFile`)}):t.map((e,t)=>(0,H.jsxs)(`div`,{className:`mb-1 flex items-start gap-2 border p-2 text-[10px]`,children:[(0,H.jsx)(`span`,{className:j(`border px-1.5 py-0.5 font-mono text-[8px] font-bold uppercase`,e.type===`delete`?`border-destructive/40 text-destructive`:e.type===`read`?`border-info/40 text-info`:`border-warning/40 text-warning`),children:e.type}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(e.timestamp).toLocaleTimeString()}),e.toolName&&(0,H.jsxs)(`div`,{className:`mt-1`,children:[`via `,e.toolName]}),e.agent&&(0,H.jsx)(`div`,{className:`text-muted-foreground`,children:e.agent}),e.summary&&(0,H.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:e.summary}),e.change&&(0,H.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 font-mono text-[8px]`,children:[(0,H.jsxs)(`span`,{className:`border border-success/40 bg-success/10 px-1 text-success`,children:[`+`,e.change.added]}),(0,H.jsxs)(`span`,{className:`border border-destructive/40 bg-destructive/10 px-1 text-destructive`,children:[`−`,e.change.removed]}),e.change.before&&(0,H.jsx)(`span`,{className:`ml-1 truncate text-destructive/80`,title:e.change.before,children:e.change.before}),e.change.after&&(0,H.jsxs)(`span`,{className:`truncate text-success/80`,title:e.change.after,children:[`→ `,e.change.after]})]}),(0,H.jsxs)(`div`,{className:`mt-1 flex gap-2 font-mono text-[8px] uppercase text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:e.status??`observed`}),(0,H.jsx)(`span`,{children:e.source??`legacy`}),e.durationMs!==void 0&&(0,H.jsxs)(`span`,{children:[e.durationMs,`ms`]}),e.watcherConfirmed&&(0,H.jsx)(`span`,{className:`text-success`,children:r(`activity:codeMap.fsVerified`)})]})]})]},`${e.timestamp}-${t}`))}),(0,H.jsxs)(`div`,{className:`border-t px-4 py-2 font-mono text-[9px] text-muted-foreground`,children:[t.length,` events · newest first`]})]})}function nt(e){return/Authentication required|Unauthorized/i.test(e)}function rt({loading:e,error:t,graph:n,canvasNodeCount:r,flowNodes:i,flowEdges:a,onNodesChange:s,onEdgesChange:c,onNodeClick:l,agentTrailCount:u}){let{t:d}=E();return(0,H.jsxs)(H.Fragment,{children:[e&&(0,H.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 bg-background/75 backdrop-blur-sm`,children:[(0,H.jsx)(o,{className:`h-7 w-7 animate-spin text-primary`}),(0,H.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-widest text-muted-foreground`,children:d(`activity:codeMap.mappingRelationships`)})]}),t&&!e&&(0,H.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,H.jsx)(w,{className:`h-10 w-10 text-destructive`}),(0,H.jsx)(`p`,{className:`font-mono text-sm text-destructive`,children:t}),!nt(t)&&(0,H.jsxs)(`p`,{className:`max-w-md text-xs text-muted-foreground`,children:[`The map needs a codebase index. Run`,` `,(0,H.jsx)(`code`,{className:`border bg-muted px-1.5 py-0.5`,children:`codebase-index`}),` `,d(`activity:codeMap.onceThenReopenThisView`)]})]}),!e&&!t&&n.nodes.length===0&&(0,H.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-2 text-muted-foreground`,children:[(0,H.jsx)(w,{className:`h-8 w-8 opacity-40`}),(0,H.jsx)(`p`,{className:`text-xs`,children:d(`activity:codeMap.noIndexedNodesAtThisLevel`)})]}),!e&&!t&&n.nodes.length>1&&n.edges.length===0&&(0,H.jsxs)(`div`,{className:`pointer-events-none absolute left-1/2 top-14 z-10 -translate-x-1/2 border border-warning/40 bg-warning/10 px-3 py-2 text-center shadow backdrop-blur`,children:[(0,H.jsx)(`div`,{className:`font-mono text-[9px] font-bold uppercase tracking-wider text-warning`,children:d(`activity:codeMap.noResolvedRelationsInThisScope`)}),(0,H.jsx)(`div`,{className:`mt-0.5 text-[8px] text-muted-foreground`,children:d(`activity:codeMap.theUpgradedIndexWillRebuildAnd`)})]}),!t&&n.nodes.length>0&&(0,H.jsxs)(ue,{nodes:i,edges:a,onNodesChange:s,onEdgesChange:c,onNodeClick:l,nodeTypes:Xe,nodesConnectable:!1,nodesDraggable:!1,edgesFocusable:!1,elementsSelectable:!1,onlyRenderVisibleElements:!0,minZoom:.08,maxZoom:2.2,proOptions:{hideAttribution:!0},children:[(0,H.jsx)(le,{variant:A.Dots,gap:r>60?32:22,size:1,color:`hsl(var(--muted-foreground))`,className:`!opacity-25`}),(0,H.jsx)(ce,{position:`bottom-left`,showInteractive:!1,className:`!border !border-border !bg-card !shadow-md [&>button]:!border-border [&>button]:!bg-card [&>button]:!fill-foreground`}),r<=48&&(0,H.jsx)(oe,{position:`bottom-right`,pannable:!0,zoomable:!0,className:`!h-[112px] !w-[180px] !border !border-border !bg-card !shadow-md`,maskColor:`hsl(var(--background) / 0.72)`,nodeColor:e=>{let t=e.data?.graphNode.kind;return t===`package`?`hsl(var(--primary))`:t===`file`?`hsl(var(--info))`:`hsl(var(--success))`}})]}),(0,H.jsxs)(`div`,{className:`pointer-events-none absolute bottom-3 left-1/2 z-10 flex -translate-x-1/2 items-center gap-3 border bg-card/90 px-3 py-1.5 font-mono text-[8px] text-muted-foreground shadow backdrop-blur`,children:[Object.entries(He).map(([e,t])=>(0,H.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`span`,{className:`h-0.5 w-3`,style:{backgroundColor:t}}),e.replace(`_`,` `)]},e)),(0,H.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,"data-testid":`agent-trail-count`,children:[(0,H.jsx)(`span`,{className:`w-4 border-t-2 border-dashed border-primary`}),`agent trail`,u>0?` ×${u}`:``]})]})]})}function it({layout:e,canvasMode:t,edgeFilter:n,canvasNodeCount:r,graphNodeCount:i,onLayoutChange:a,onCanvasModeChange:o,onEdgeFilterChange:s}){let{t:c}=E();return(0,H.jsxs)(`div`,{className:`pointer-events-none absolute left-3 right-3 top-3 z-10 flex items-center gap-2`,children:[(0,H.jsxs)(`div`,{className:`pointer-events-auto flex border bg-card/95 shadow-md backdrop-blur`,children:[(0,H.jsxs)(`button`,{type:`button`,className:j(`flex h-8 items-center gap-1.5 border-r px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`layers`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>a(`layers`),children:[(0,H.jsx)(x,{className:`h-3 w-3`}),` `,c(`activity:codeMap.layers`)]}),(0,H.jsxs)(`button`,{type:`button`,className:j(`flex h-8 items-center gap-1.5 border-r px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`orbit`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>a(`orbit`),children:[(0,H.jsx)(h,{className:`h-3 w-3`}),` `,c(`activity:codeMap.relations`)]}),(0,H.jsxs)(`button`,{type:`button`,className:j(`flex h-8 items-center gap-1.5 px-2.5 text-[9px] font-semibold uppercase tracking-wider`,e===`subsystems`?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>a(`subsystems`),title:c(`activity:codeMap.groupNodesByTheSubsystemTheyBelongTo`),children:[(0,H.jsx)(b,{className:`h-3 w-3`}),` `,c(`activity:codeMap.subsystems`)]})]}),(0,H.jsxs)(`div`,{className:`pointer-events-auto flex border bg-card/95 shadow-md backdrop-blur`,children:[(0,H.jsxs)(`button`,{type:`button`,className:j(`h-8 border-r px-2.5 font-mono text-[9px] font-bold`,t===`smart`?`bg-success text-success-foreground`:`text-muted-foreground hover:bg-muted`),onClick:()=>o(`smart`),title:c(`activity:codeMap.keepTheFullTreeShowTheStrongestRelationsAndSelectedNeighbourhood`),children:[`SMART `,r,`/`,i]}),(0,H.jsx)(`button`,{type:`button`,className:j(`h-8 px-2.5 font-mono text-[9px] font-bold`,t===`all`?`bg-foreground text-background`:`text-muted-foreground hover:bg-muted`),onClick:()=>o(`all`),title:c(`activity:codeMap.renderEveryNodeAndRelationInThisScope`),children:c(`activity:codeMap.all`)})]}),(0,H.jsx)(`div`,{className:`pointer-events-auto ml-auto flex max-w-[60%] overflow-x-auto border bg-card/95 shadow-md backdrop-blur`,children:[`all`,`import`,`call`,`type_ref`,`inherit`,`implement`].map(e=>(0,H.jsx)(`button`,{type:`button`,className:j(`h-8 whitespace-nowrap border-r px-2.5 font-mono text-[9px] last:border-r-0`,n===e?`bg-foreground text-background`:`text-muted-foreground hover:bg-muted`),onClick:()=>s(e),children:e===`all`?`ALL LINKS`:e.replace(`_`,` `).toUpperCase()},e))})]})}function at({scope:e,graph:t,agentPresences:n,edgeWeight:r,connectedNodeCount:i,navigate:a}){let{t:o}=E();return(0,H.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center gap-x-4 gap-y-2 border-b bg-card px-4 py-3`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-[220px] items-center gap-3`,children:[(0,H.jsx)(`span`,{className:`flex h-9 w-9 items-center justify-center border border-primary bg-primary/10 text-primary`,children:(0,H.jsx)(w,{className:`h-4 w-4`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`font-display text-sm font-semibold tracking-tight`,children:o(`activity:codeMap.codeAtlas`)}),(0,H.jsx)(`p`,{className:`text-[9px] uppercase tracking-[0.18em] text-muted-foreground`,children:o(`activity:codeMap.architectureIntelligence`)})]})]}),(0,H.jsxs)(`nav`,{className:`order-last flex w-full min-w-0 items-center gap-1 overflow-x-auto border-t pt-2 font-mono text-[11px] [&>button]:shrink-0 [&>svg]:shrink-0`,"aria-label":o(`activity:codeMap.codeMapBreadcrumb`),children:[e.level!==`packages`&&(0,H.jsx)(`button`,{type:`button`,className:`mr-1 flex h-7 w-7 items-center justify-center border text-muted-foreground hover:bg-muted`,onClick:()=>{e.level===`symbols`?a({level:`files`,package:e.package??`(root)`},`file:${e.file}`):a({level:`packages`})},"aria-label":o(`activity:codeMap.back`),children:(0,H.jsx)(C,{className:`h-3.5 w-3.5`})}),(0,H.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 px-1.5 py-1 text-muted-foreground hover:text-foreground`,onClick:()=>a({level:`packages`}),"aria-current":e.level===`packages`?`page`:void 0,children:[(0,H.jsx)(v,{className:`h-3 w-3`}),` workspace`]}),e.level!==`packages`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(p,{className:`h-3 w-3 text-muted-foreground`}),(0,H.jsx)(`button`,{type:`button`,className:`whitespace-nowrap px-1.5 py-1 hover:text-primary`,"aria-current":e.level===`files`?`page`:void 0,onClick:()=>a({level:`files`,package:e.package??`(root)`}),children:e.package??`(root)`})]}),e.level===`symbols`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(p,{className:`h-3 w-3 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`whitespace-nowrap px-1.5 py-1 text-primary`,"aria-current":`page`,title:e.file,children:B({id:``,label:e.file,kind:`file`,file:e.file,package:e.package})})]})]}),(0,H.jsxs)(`div`,{className:`ml-auto hidden items-center gap-5 xl:flex`,children:[(0,H.jsxs)(`div`,{className:j(`flex h-8 items-center gap-2 border px-2.5`,n.length>0?`border-success/50 bg-success/10 text-success`:`text-muted-foreground`),children:[(0,H.jsx)(c,{className:j(`h-3 w-3`,n.length>0&&`animate-pulse`)}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`font-mono text-[10px] font-bold`,children:[n.length,` LIVE`]}),(0,H.jsx)(`div`,{className:`text-[7px] uppercase tracking-wider`,children:`agents`})]})]}),(0,H.jsxs)(`div`,{className:`text-right`,children:[(0,H.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:t.nodes.length}),(0,H.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`nodes`})]}),(0,H.jsxs)(`div`,{className:`text-right`,children:[(0,H.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:t.edges.length}),(0,H.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`links`})]}),(0,H.jsxs)(`div`,{className:`text-right`,children:[(0,H.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:r}),(0,H.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`references`})]}),(0,H.jsxs)(`div`,{className:`text-right`,children:[(0,H.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:i}),(0,H.jsx)(`div`,{className:`text-[8px] uppercase tracking-wider text-muted-foreground`,children:`connected`})]})]})]})}function ot({activity:e}){return(0,H.jsx)(`span`,{className:j(`shrink-0 border px-1.5 py-0.5 font-mono text-[8px] font-bold uppercase`,e.type===`delete`?`border-destructive/50 bg-destructive/10 text-destructive`:e.type===`read`?`border-info/50 bg-info/10 text-info`:e.type===`search`||e.type===`index`?`border-primary/50 bg-primary/10 text-primary`:`border-warning/50 bg-warning/10 text-warning`),children:e.filePath.startsWith(`(tool:`)?e.toolName:e.type})}function st({activity:e,onLocate:t,showAgent:n=!1}){let{t:r}=E(),i=e.agentName??e.agent??`External process`,a=`${e.sessionId??`none`}:${e.agentId??i}`;return(0,H.jsxs)(`button`,{type:`button`,className:`group flex w-full items-start gap-2 border-b px-3 py-2 text-left last:border-b-0 hover:bg-muted/70`,onClick:()=>!e.filePath.startsWith(`(`)&&t(e),title:`Locate ${e.filePath}`,children:[n&&(0,H.jsx)(`span`,{className:j(`mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center font-mono text-[8px] font-black`,G(a)),children:W(i)}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(ot,{activity:e}),n&&(0,H.jsx)(`span`,{className:`truncate text-[9px] font-semibold`,children:i}),e.status===`active`&&(0,H.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 font-mono text-[8px] font-bold text-success`,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse bg-success`}),` `,r(`activity:codeMap.live`)]}),e.watcherConfirmed&&(0,H.jsx)(D,{className:`ml-auto h-3 w-3 text-success`,"aria-label":r(`activity:codeMap.filesystemConfirmed`)}),e.attribution===`correlated`&&!e.watcherConfirmed&&(0,H.jsx)(`span`,{className:`ml-auto font-mono text-[7px] uppercase text-warning`,title:r(`activity:codeMap.correlatedFromTheOnlyActiveTool`),children:r(`activity:codeMap.correlated`)}),e.attribution===`external`&&(0,H.jsx)(`span`,{className:`ml-auto font-mono text-[7px] uppercase text-destructive`,children:`external`})]}),(0,H.jsx)(`div`,{className:`mt-1 truncate font-mono text-[9px] font-semibold`,title:e.filePath,children:Ke(e.filePath)}),(e.symbol||e.line)&&(0,H.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1 truncate font-mono text-[8px] text-success`,children:[(0,H.jsx)(y,{className:`h-2.5 w-2.5 shrink-0`}),e.symbol?.name??`line ${e.line}`,e.symbol?.kind&&(0,H.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,e.symbol.kind]})]}),e.change&&(0,H.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 font-mono text-[8px]`,children:[(0,H.jsxs)(`span`,{className:`border border-success/40 bg-success/10 px-1 text-success`,children:[`+`,e.change.added]}),(0,H.jsxs)(`span`,{className:`border border-destructive/40 bg-destructive/10 px-1 text-destructive`,children:[`−`,e.change.removed]}),e.durationMs!==void 0&&(0,H.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,children:[e.durationMs,`ms`]})]}),e.summary&&e.summary!==e.toolName&&(0,H.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[8px] leading-3 text-muted-foreground`,children:e.summary})]}),!e.filePath.startsWith(`(`)&&(0,H.jsx)(s,{className:`mt-1 h-3 w-3 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100`})]})}function ct({presences:e,onLocate:t}){let{t:n}=E();return e.length===0?null:(0,H.jsxs)(`section`,{className:`pointer-events-auto absolute left-3 top-14 z-20 w-[304px] border bg-card/95 shadow-xl backdrop-blur`,children:[(0,H.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,H.jsx)(c,{className:`h-3.5 w-3.5 animate-pulse text-success`}),(0,H.jsx)(`h2`,{className:`text-[9px] font-black uppercase tracking-[0.18em]`,children:n(`activity:codeMap.liveAgentOperations`)}),(0,H.jsxs)(`span`,{className:`ml-auto bg-success px-1.5 py-0.5 font-mono text-[8px] font-bold text-success-foreground`,children:[e.length,` ONLINE`]})]}),(0,H.jsx)(`div`,{className:`max-h-[330px] overflow-y-auto`,children:e.map(e=>(0,H.jsxs)(`div`,{className:`border-b last:border-b-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/35 px-3 py-1.5`,children:[(0,H.jsx)(`span`,{className:j(`flex h-6 w-6 items-center justify-center font-mono text-[8px] font-black`,G(e.key)),children:W(e.agentName)}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-[9px] font-bold`,children:e.agentName}),(0,H.jsxs)(`div`,{className:`truncate font-mono text-[7px] text-muted-foreground`,children:[`session `,e.sessionId.slice(0,12),` · agent `,e.agentId.slice(0,12)]})]}),(0,H.jsxs)(`span`,{className:`font-mono text-[8px] text-success`,children:[e.operations.length,` op`]})]}),e.operations.map(e=>(0,H.jsx)(st,{activity:e,onLocate:t},e.id??`${e.toolUseId}:${e.filePath}`))]},e.key))})]})}function lt({paused:e,followLive:t,agentFilter:n,agents:i,onTogglePaused:a,onToggleFollow:o,onAgentFilter:s}){let{t:c}=E();return(0,H.jsxs)(`div`,{className:`pointer-events-auto absolute right-3 top-14 z-20 flex h-9 items-center border bg-card/95 shadow-lg backdrop-blur`,children:[(0,H.jsxs)(`button`,{type:`button`,className:j(`flex h-full items-center gap-1.5 border-r px-2.5 text-[8px] font-bold uppercase tracking-wider`,t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),onClick:o,title:c(`activity:codeMap.automaticallyEnterTheFileFunctionUsedByTheNewestVisibleAgent`),children:[(0,H.jsx)(y,{className:`h-3 w-3`}),` `,c(`activity:codeMap.follow`)]}),(0,H.jsxs)(`button`,{type:`button`,className:j(`flex h-full items-center gap-1.5 border-r px-2.5 text-[8px] font-bold uppercase tracking-wider`,e?`bg-warning text-warning-foreground`:`text-success hover:bg-success/10`),onClick:a,title:e?`Resume the live telemetry stream`:`Freeze the current telemetry frame`,children:[e?(0,H.jsx)(d,{className:`h-3 w-3`}):(0,H.jsx)(r,{className:`h-3 w-3`}),e?`Resume`:`Live`]}),(0,H.jsxs)(`label`,{className:`flex h-full items-center gap-1.5 px-2 text-[8px] uppercase text-muted-foreground`,children:[c(`activity:codeMap.agent`),(0,H.jsxs)(`select`,{"aria-label":c(`activity:codeMap.filterCodemapByAgentAndSession`),className:`h-6 max-w-[170px] border bg-background px-1.5 font-mono text-[8px] text-foreground outline-none focus:border-primary`,value:n,onChange:e=>s(e.target.value),children:[(0,H.jsx)(`option`,{value:`all`,children:c(`activity:codeMap.allAgents`)}),i.map(e=>(0,H.jsxs)(`option`,{value:e.key,children:[e.agentName,` · `,e.sessionId.slice(0,10)]},e.key))]})]})]})}function ut({activeOperations:e,recentActivities:t,activityTotalCount:n,onLocate:r}){let{t:i}=E();return(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[e.length>0&&(0,H.jsxs)(`section`,{className:`border-b`,children:[(0,H.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b bg-success/5 px-3`,children:[(0,H.jsx)(c,{className:`h-3 w-3 animate-pulse text-success`}),(0,H.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:i(`activity:codeMap.activeNow`)}),(0,H.jsx)(`span`,{className:`ml-auto font-mono text-[9px] text-success`,children:e.length})]}),e.map(e=>(0,H.jsx)(st,{activity:e,onLocate:r,showAgent:!0},e.id??`${e.toolUseId}:${e.filePath}`))]}),(0,H.jsxs)(`section`,{children:[(0,H.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,H.jsx)(T,{className:`h-3 w-3 text-muted-foreground`}),(0,H.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:i(`activity:codeMap.eventStream`)}),(0,H.jsxs)(`span`,{className:`ml-auto font-mono text-[8px] text-muted-foreground`,children:[n,` total`]})]}),t.length>0?t.map((e,t)=>(0,H.jsx)(st,{activity:e,onLocate:r,showAgent:!0},e.id??`${e.timestamp}:${t}`)):(0,H.jsxs)(`div`,{className:`flex flex-col items-center justify-center px-7 py-16 text-center`,children:[(0,H.jsx)(`span`,{className:`mb-4 flex h-12 w-12 items-center justify-center border bg-muted text-muted-foreground`,children:(0,H.jsx)(g,{className:`h-5 w-5`})}),(0,H.jsx)(`h3`,{className:`text-xs font-semibold`,children:i(`activity:codeMap.selectANodeOrWaitFor`)}),(0,H.jsx)(`p`,{className:`mt-2 text-[10px] leading-relaxed text-muted-foreground`,children:i(`activity:codeMap.relationsAppearOnSelectionToolCalls`)})]})]})]})}function dt({node:e,incomingCount:t,outgoingCount:n,onOpenNode:r,onOpenActivity:i}){let{t:a}=E(),o=U[e.kind].icon;return(0,H.jsxs)(`div`,{className:`border-b bg-muted/25 p-3`,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:j(`flex h-8 w-8 items-center justify-center border`,U[e.kind].iconStyle),children:(0,H.jsx)(o,{className:`h-4 w-4`})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`text-[8px] font-bold uppercase tracking-[0.18em] text-muted-foreground`,children:[e.external?`external `:``,e.kind]}),(0,H.jsx)(`div`,{className:`truncate font-mono text-xs font-semibold`,title:e.label,children:e.label})]})]}),(0,H.jsx)(`div`,{className:`break-all font-mono text-[9px] leading-relaxed text-muted-foreground`,children:e.file?B(e):e.package}),e.subsystem&&(0,H.jsx)(`div`,{className:`mt-2 inline-flex items-center gap-1 border border-border px-1.5 py-0.5 text-[8px] uppercase tracking-wider text-muted-foreground`,children:e.subsystem}),e.concept&&(0,H.jsx)(`p`,{className:`mt-2 text-[11px] leading-relaxed text-foreground`,children:e.concept}),e.crux&&(0,H.jsxs)(`div`,{className:`mt-1 font-mono text-[9px] text-muted-foreground`,children:[a(`activity:codeMap.crux`),` L`,e.crux.start,`–L`,e.crux.end]}),e.signature&&(0,H.jsx)(`pre`,{className:`mt-3 overflow-x-auto border bg-background p-2 font-mono text-[9px] leading-relaxed text-foreground`,children:e.signature}),(0,H.jsxs)(`div`,{className:`mt-3 grid grid-cols-3 border`,children:[(0,H.jsx)(J,{value:t,label:a(`activity:codeMap.incoming`),className:`border-r text-info`}),(0,H.jsx)(J,{value:n,label:a(`activity:codeMap.outgoing`),className:`border-r text-primary`}),(0,H.jsx)(J,{value:e.symbolCount??e.fileCount??e.line??`—`,label:e.kind===`package`?`files`:e.kind===`file`?`symbols`:`line`})]}),(0,H.jsx)(`div`,{className:`mt-2 grid grid-cols-1 border`,children:(0,H.jsx)(J,{value:e.rank===void 0?`—`:`${Math.round(e.rank*100)}%`,label:a(`activity:codeMap.centralityLabel`)})}),(0,H.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[e.kind!==`symbol`&&(0,H.jsxs)(`button`,{type:`button`,className:`flex h-7 flex-1 items-center justify-center gap-1.5 border bg-foreground text-[9px] font-semibold uppercase tracking-wider text-background hover:opacity-90`,onClick:()=>r(e),children:[(0,H.jsx)(s,{className:`h-3 w-3`}),` Open`,` `,e.kind===`package`?`files`:`symbols`]}),e.file&&(0,H.jsxs)(`button`,{type:`button`,className:`flex h-7 items-center justify-center gap-1.5 border px-2 text-[9px] uppercase text-muted-foreground hover:bg-muted`,onClick:()=>i(e.file),children:[(0,H.jsx)(T,{className:`h-3 w-3`}),` `,a(`activity:codeMap.activity`)]})]})]})}function J({value:e,label:t,className:n}){return(0,H.jsxs)(`div`,{className:j(`p-2 text-center`,n),children:[(0,H.jsx)(`div`,{className:`font-mono text-sm font-semibold`,children:e}),(0,H.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:t})]})}function Y(e){let{t}=E(),{title:n,subtitle:r,items:i,graph:a,selectedId:o,expanded:s,onToggle:c,onSelect:u}=e;return(0,H.jsxs)(`section`,{className:`border-b py-3`,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-end justify-between px-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-[10px] font-bold uppercase tracking-[0.16em]`,children:n}),(0,H.jsx)(`p`,{className:`mt-0.5 text-[9px] text-muted-foreground`,children:r})]}),(0,H.jsx)(`span`,{className:`border bg-muted px-1.5 py-0.5 font-mono text-[9px]`,children:i.length})]}),i.length===0?(0,H.jsx)(`p`,{className:`px-3 py-2 text-[10px] text-muted-foreground`,children:t(`activity:codeMap.noRelationshipsInThisView`)}):i.map(e=>{let t=`${n}:${e.node.id}`,r=s.has(t),i=[...ve(a,e.node.id,`incoming`),...ve(a,e.node.id,`outgoing`)].filter((e,t,n)=>e.node.id!==o&&n.findIndex(t=>t.node.id===e.node.id)===t).slice(0,8);return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`group flex min-h-9 items-center gap-1 px-2 hover:bg-muted/70`,children:[(0,H.jsx)(`button`,{type:`button`,className:`flex h-6 w-5 shrink-0 items-center justify-center text-muted-foreground`,onClick:()=>i.length>0&&c(t),"aria-label":`${r?`Collapse`:`Expand`} relation ${e.node.label}`,children:i.length>0?r?(0,H.jsx)(l,{className:`h-3 w-3`}):(0,H.jsx)(p,{className:`h-3 w-3`}):(0,H.jsx)(`span`,{className:`h-px w-2 bg-border`})}),(0,H.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 py-1 text-left`,onClick:()=>u(e.node),children:[(0,H.jsx)(`span`,{className:`block truncate font-mono text-[10px] font-semibold`,title:e.node.label,children:e.node.label}),(0,H.jsx)(`span`,{className:`block truncate text-[9px] text-muted-foreground`,children:e.node.package??e.node.symbolKind??e.node.kind})]}),(0,H.jsx)(`span`,{className:`border px-1 py-0.5 font-mono text-[8px] text-muted-foreground`,children:e.edge.refType}),(0,H.jsxs)(`span`,{className:`w-5 text-right font-mono text-[9px] text-muted-foreground`,children:[`×`,e.edge.weight]})]}),r&&i.map(e=>(0,H.jsxs)(`button`,{type:`button`,className:`relative flex h-7 w-full items-center gap-2 border-l border-border pl-11 pr-3 text-left text-[9px] text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:()=>u(e.node),children:[(0,H.jsx)(`span`,{className:`absolute left-7 top-1/2 h-px w-3 bg-border`}),(0,H.jsx)(g,{className:`h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{className:`truncate font-mono`,children:e.node.label}),(0,H.jsx)(`span`,{className:`ml-auto font-mono opacity-70`,children:e.edge.refType})]},`${t}:${e.node.id}`))]},t)})]})}function ft({selectedNode:e,incoming:t,outgoing:n,filteredGraph:r,expandedRelations:i,activeOperations:a,recentActivities:o,activityTotalCount:s,selectedActivities:l,onClearSelection:u,onOpenNode:d,onOpenActivity:p,onLocateActivity:m,onToggleRelation:h,onSelectNode:g}){let{t:_}=E();return(0,H.jsxs)(`aside`,{className:`flex w-[326px] shrink-0 flex-col border-l bg-card/80`,children:[(0,H.jsxs)(`div`,{className:`flex h-10 items-center justify-between border-b px-3`,children:[(0,H.jsx)(`h2`,{className:`text-[10px] font-bold uppercase tracking-[0.18em]`,children:_(`activity:codeMap.relationInspector`)}),e&&(0,H.jsx)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground`,onClick:u,"aria-label":_(`activity:codeMap.clearSelection`),children:(0,H.jsx)(f,{className:`h-3.5 w-3.5`})})]}),e?(0,H.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[(0,H.jsx)(dt,{node:e,incomingCount:t.length,outgoingCount:n.length,onOpenNode:d,onOpenActivity:p}),l.length>0&&(0,H.jsxs)(`section`,{className:`border-b bg-success/5 py-2`,children:[(0,H.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 px-3`,children:[(0,H.jsx)(c,{className:`h-3 w-3 animate-pulse text-success`}),(0,H.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em]`,children:_(`activity:codeMap.agentsOnThisNode`)}),(0,H.jsx)(`span`,{className:`ml-auto font-mono text-[9px] text-success`,children:l.length})]}),l.map(e=>(0,H.jsx)(st,{activity:e,onLocate:m,showAgent:!0},e.id??`${e.toolUseId}:${e.filePath}`))]}),(0,H.jsx)(Y,{title:_(`activity:codeMap.incoming`),subtitle:_(`activity:codeMap.whoDependsOnThis`),items:t,graph:r,selectedId:e.id,expanded:i,onToggle:h,onSelect:g}),(0,H.jsx)(Y,{title:_(`activity:codeMap.outgoing`),subtitle:_(`activity:codeMap.whatThisDependsOn`),items:n,graph:r,selectedId:e.id,expanded:i,onToggle:h,onSelect:g})]}):(0,H.jsx)(ut,{activeOperations:a,recentActivities:o,activityTotalCount:s,onLocate:m})]})}function pt({node:e,onSelect:t,virtual:n}){let r=U[e.kind].icon;return(0,H.jsxs)(`button`,{type:`button`,"data-index":n?.index,ref:n?e=>n.measureElement(e):void 0,className:j(`min-h-8 items-center gap-2 px-3 py-1 text-left hover:bg-muted`,n?`absolute left-0 flex w-full`:`flex w-full`),style:n?{transform:`translateY(${n.start}px)`}:void 0,onClick:()=>t(e),children:[(0,H.jsx)(r,{className:j(`h-3.5 w-3.5 shrink-0`,e.kind===`package`?`text-primary`:e.kind===`file`?`text-info`:`text-success`)}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate font-mono text-[10px]`,children:e.label}),(0,H.jsx)(`span`,{className:`block truncate text-[8px] text-muted-foreground`,children:e.file??e.package??e.symbolKind})]}),(0,H.jsx)(`span`,{className:`text-[8px] uppercase text-muted-foreground`,children:e.kind.slice(0,3)})]},e.id)}var mt=80,ht=40;function X(e,t){if(!e||t.size===0)return!1;let n=P(e);if(t.has(n))return!0;for(let e of t)if(e.endsWith(`/${n}`)||n.endsWith(`/${e}`))return!0;return!1}var gt=(0,M.memo)(function e(t){let{t:n}=E(),{directory:r,packageName:a,depth:d,expandedDirectories:f,expandedFiles:h,loadingBranches:g,graphForFile:_,onToggleDirectory:v,onToggleFile:y,onSelectFile:b,onOpenFile:x,onSelectSymbol:S,selectedId:C,activeFileNorms:w,activeSymbolIds:T,revealAllKeys:D,onRevealAll:te}=t,O=`files:${a}:${r.path||`.`}`,ne=D.has(O)?r.files:r.files.slice(0,mt),re=r.files.length-ne.length;return(0,H.jsxs)(H.Fragment,{children:[r.directories.map(n=>{let r=`${a}:${n.path}`,o=f.has(r);return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center gap-1.5 pr-2 text-left text-[11px] text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:8+d*12},onClick:()=>v(r),children:[o?(0,H.jsx)(l,{className:`h-3 w-3`}):(0,H.jsx)(p,{className:`h-3 w-3`}),o?(0,H.jsx)(i,{className:`h-3.5 w-3.5 text-warning`}):(0,H.jsx)(ee,{className:`h-3.5 w-3.5 text-warning`}),(0,H.jsx)(`span`,{className:`truncate`,children:n.name})]}),o&&(0,H.jsx)(e,{...t,directory:n,depth:d+1})]},r)}),ne.map(e=>{let t=h.has(e.file??e.id),r=F({level:`symbols`,file:e.file??e.label}),i=(e.file?_(e.file):void 0)?.nodes.filter(t=>t.kind===`symbol`&&t.file===e.file&&!t.external)??[],a=`symbols:${e.file??e.id}`,f=D.has(a)?i:i.slice(0,ht),v=i.length-f.length,E=X(e.file,w);return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:j(`group flex h-7 items-center pr-1 text-[11px] hover:bg-muted`,C===e.id&&`bg-primary/10 text-primary`),style:{paddingLeft:8+d*12},children:[(0,H.jsx)(`button`,{type:`button`,className:`flex h-6 w-4 shrink-0 items-center justify-center text-muted-foreground`,onClick:()=>y(e),"aria-label":`${t?`Collapse`:`Expand`} ${e.label}`,children:g.has(r)?(0,H.jsx)(o,{className:`h-3 w-3 animate-spin`}):t?(0,H.jsx)(l,{className:`h-3 w-3`}):(0,H.jsx)(p,{className:`h-3 w-3`})}),(0,H.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left`,onClick:()=>b(e),onDoubleClick:()=>x(e),children:[(0,H.jsx)(m,{className:`h-3.5 w-3.5 shrink-0 text-info`}),E&&(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 animate-pulse bg-success`,title:n(`activity:codeMap.liveOperation`)}),(0,H.jsx)(`span`,{className:`truncate font-mono`,title:e.file,children:e.label}),(0,H.jsx)(`span`,{className:`ml-auto text-[9px] text-muted-foreground`,children:e.symbolCount??0})]}),(0,H.jsx)(`button`,{type:`button`,className:`ml-1 hidden h-5 w-5 items-center justify-center text-muted-foreground hover:text-foreground group-hover:flex`,onClick:()=>x(e),title:n(`activity:codeMap.openSymbolMap`),"aria-label":`Open ${e.label} map`,children:(0,H.jsx)(s,{className:`h-3 w-3`})})]}),t&&f.map(e=>(0,H.jsxs)(`button`,{type:`button`,className:j(`flex h-7 w-full items-center gap-1.5 pr-2 text-left text-[10px] hover:bg-muted`,C===e.id?`bg-primary/10 text-primary`:`text-muted-foreground`),style:{paddingLeft:38+d*12},onClick:()=>S(e),children:[(0,H.jsx)(u,{className:`h-3 w-3 shrink-0 text-success`}),T.has(e.id)&&(0,H.jsx)(c,{className:`h-3 w-3 shrink-0 animate-pulse text-success`}),(0,H.jsx)(`span`,{className:`truncate font-mono`,children:e.label}),e.line&&(0,H.jsxs)(`span`,{className:`ml-auto font-mono text-[8px] opacity-60`,children:[`:`,e.line]})]},e.id)),t&&v>0&&(0,H.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center text-left font-mono text-[9px] text-primary hover:bg-muted`,style:{paddingLeft:38+d*12},onClick:()=>te(a),children:[`Show `,v,` more symbols`]})]},e.id)}),re>0&&(0,H.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center text-left font-mono text-[9px] text-primary hover:bg-muted`,style:{paddingLeft:8+d*12},onClick:()=>te(O),children:[`Show `,re,` more files`]})]})});function _t({rootGraph:e,search:t,searchInput:n,searchResults:r,virtualizeSearch:i,searchVirtualizer:c,treeScrollRef:u,selectedId:d,expandedPackages:m,expandedDirectories:h,expandedFiles:g,loadingBranches:_,activeFileNorms:v,activeSymbolIds:y,revealAllKeys:b,packageGraph:x,graphForFile:C,navigate:w,togglePackage:T,toggleDirectory:ee,toggleFile:D,revealAllTree:te,selectFileFromTree:O,selectSymbolFromTree:ne,selectSearchResult:re,handleOpenNode:ie,onSearchInputChange:k,onSearchChange:ae}){let{t:A}=E();return(0,H.jsxs)(`aside`,{className:`flex w-[286px] shrink-0 flex-col border-r bg-card/70`,children:[(0,H.jsxs)(`div`,{className:`border-b p-3`,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,H.jsx)(`h2`,{className:`text-[10px] font-bold uppercase tracking-[0.18em]`,children:A(`activity:codeMapTree.codeTree`)}),(0,H.jsxs)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:[e.nodes.length,` roots`]})]}),(0,H.jsxs)(`label`,{className:`flex h-8 items-center gap-2 border bg-background px-2 focus-within:border-primary`,children:[(0,H.jsx)(a,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,H.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent font-mono text-[10px] outline-none placeholder:text-muted-foreground`,value:n,onChange:e=>k(e.target.value),placeholder:A(`activity:codeMapTree.findPackageFileSymbol`)}),n&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>{k(``),ae(``)},"aria-label":A(`activity:codeMapTree.clearSearch`),children:(0,H.jsx)(f,{className:`h-3 w-3 text-muted-foreground`})})]})]}),(0,H.jsx)(`div`,{ref:u,className:`min-h-0 flex-1 overflow-y-auto py-2`,children:t.trim()?(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`px-3 pb-2 text-[9px] text-muted-foreground`,children:[r.length,` loaded-map results`]}),r.length===0?(0,H.jsxs)(`p`,{className:`px-3 py-8 text-center text-[10px] text-muted-foreground`,children:[A(`activity:codeMapTree.noMatchInLoadedBranches`),(0,H.jsx)(`br`,{}),A(`activity:codeMapTree.expandAPackageToSearchIts`)]}):i?(0,H.jsx)(`div`,{style:{height:`${c.getTotalSize()}px`,width:`100%`,position:`relative`},children:c.getVirtualItems().map(e=>{let t=r[e.index];return t?(0,H.jsx)(pt,{node:t,onSelect:re,virtual:{index:e.index,start:e.start,measureElement:c.measureElement}},t.id):null})}):r.map(e=>(0,H.jsx)(pt,{node:e,onSelect:re},e.id))]}):e.nodes.map(e=>{let t=e.package??e.label,n=m.has(t),r=F({level:`files`,package:t}),i=x(t),a=i?Ae(i.nodes):void 0;return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:j(`group flex h-8 items-center px-2 hover:bg-muted`,d===e.id&&`bg-primary/10 text-primary`),children:[(0,H.jsx)(`button`,{type:`button`,className:`flex h-6 w-5 items-center justify-center text-muted-foreground`,onClick:()=>T(e),"aria-label":`${n?`Collapse`:`Expand`} ${t}`,children:_.has(r)?(0,H.jsx)(o,{className:`h-3 w-3 animate-spin`}):n?(0,H.jsx)(l,{className:`h-3 w-3`}):(0,H.jsx)(p,{className:`h-3 w-3`})}),(0,H.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,onClick:()=>w({level:`packages`},e.id),onDoubleClick:()=>w({level:`files`,package:t}),children:[(0,H.jsx)(S,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,H.jsx)(`span`,{className:`truncate font-mono text-[10px] font-semibold`,children:e.label}),(0,H.jsx)(`span`,{className:`ml-auto text-[9px] text-muted-foreground`,children:e.fileCount??0})]}),(0,H.jsx)(`button`,{type:`button`,className:`ml-1 hidden h-5 w-5 items-center justify-center text-muted-foreground hover:text-foreground group-hover:flex`,onClick:()=>w({level:`files`,package:t}),title:A(`activity:codeMapTree.openFileMap`),"aria-label":`Open ${t} map`,children:(0,H.jsx)(s,{className:`h-3 w-3`})})]}),n&&a&&(0,H.jsx)(gt,{directory:a,packageName:t,depth:1,expandedDirectories:h,expandedFiles:g,loadingBranches:_,graphForFile:C,onToggleDirectory:ee,onToggleFile:D,onSelectFile:O,onOpenFile:ie,onSelectSymbol:ne,selectedId:d,activeFileNorms:v,activeSymbolIds:y,revealAllKeys:b,onRevealAll:te})]},e.id)})}),(0,H.jsxs)(`div`,{className:`border-t px-3 py-2 text-[9px] leading-relaxed text-muted-foreground`,children:[A(`activity:codeMapTree.clickToFocusDoubleClickTo`),(0,H.jsx)(`br`,{}),A(`activity:codeMapTree.branchesStayOpenWhileTheMap`)]})]})}function Z(){let[e,t]=(0,M.useState)({level:`packages`}),n=F(e),[r,i]=(0,M.useState)(ze),a=(0,M.useRef)(r);a.current=r;let[o,s]=(0,M.useState)(!0),[c,l]=(0,M.useState)(null),[u,d]=(0,M.useState)(null),[f,p]=(0,M.useState)(`layers`),[m,h]=(0,M.useState)(`smart`),[g,v]=(0,M.useState)(`all`),[y,b]=(0,M.useState)(``),[x,S]=(0,M.useState)(``),[C,w]=(0,M.useState)(new Set),[T,ee]=(0,M.useState)(new Set),[D,O]=(0,M.useState)(new Set),[ne,k]=(0,M.useState)(new Set),[ae,A]=(0,M.useState)(new Set),[oe,ce]=(0,M.useState)(new Set),[le,ue]=(0,M.useState)(0),[j,me]=(0,M.useState)(null),[ge,N]=(0,M.useState)(!1),[I,be]=(0,M.useState)(`all`),[L,Se]=(0,M.useState)(null),[Ce,we]=(0,M.useState)(null),[Te,Ee]=(0,M.useState)(0),R=(0,M.useRef)(new Map),z=(0,M.useRef)(null),B=(0,M.useRef)(null),Oe=(0,M.useRef)(``),ke=(0,M.useRef)(``),Ie=(0,M.useRef)(null),V=(0,M.useRef)(new Set),{history:U,pulses:Be,activeOperationsMap:Ve,activityTotalCount:He,resolveActivitySymbol:Ue,getActivityForFile:We,sweepActivity:W}=de(te(e=>({history:e.history,pulses:e.pulses,activeOperationsMap:e.activeOperations,activityTotalCount:e.totalCount,resolveActivitySymbol:e.resolveActivitySymbol,getActivityForFile:e.getActivityForFile,sweepActivity:e._sweep}))),G=(0,M.useMemo)(()=>[...Ve.values()].flat(),[Ve]),Ge=(0,M.useMemo)(()=>[...Be.keys()].map(e=>U.get(e)?.[0]).filter(e=>!!e),[U,Be]),K=(0,M.useMemo)(()=>{let e=[];for(let t of U.values())e.push(...t.slice(0,16));return e.sort((e,t)=>t.timestamp-e.timestamp).slice(0,16)},[U]),Ke=(0,M.useMemo)(()=>fe([...G,...K]),[G,K]),q=(0,M.useMemo)(()=>{let e=L??G;return I===`all`?e:e.filter(e=>pe(e)===I)},[G,I,L]),qe=(0,M.useMemo)(()=>{let e=Ce??K;return I===`all`?e:e.filter(e=>pe(e)===I)},[I,Ce,K]),Je=(0,M.useDeferredValue)(q),Ye=(0,M.useDeferredValue)(qe),Xe=(0,M.useDeferredValue)(Ge),Ze=(0,M.useMemo)(()=>fe(q),[q]),[Qe,$e,nt]=ie([]),[ot,st,ut]=re([]),{fitView:dt}=se(),{t:J}=E(),Y=(0,M.useCallback)(async(e,t=!1)=>{let n=F(e),r=R.current.get(n);if(r&&!t)return Me(R.current,n,r,48),r;let i=await fetch(_e(e),{credentials:`same-origin`});if(!i.ok){if(i.status===401||i.status===403)throw Error(`Authentication required — open this dashboard from its token URL.`);let e=await i.json().catch(()=>({error:i.statusText}));throw Error(e.error??`HTTP ${i.status}`)}let a=await i.json().catch(()=>{throw Error(J(`activity:codeMap.snapshotUnavailable`,{defaultValue:`CodeMap graph unavailable — start the WebUI server to load it.`}))});return Me(R.current,n,a,48),ue(e=>e+1),a},[J]);(0,M.useEffect)(()=>{let e=window.setTimeout(()=>S(y),150);return()=>window.clearTimeout(e)},[y]);let pt=he(e=>e.generation),mt=(0,M.useRef)(0),ht=(0,M.useRef)(null);(0,M.useEffect)(()=>{let t=!1,n=pt>mt.current;n&&(mt.current=pt,R.current.clear(),ue(e=>e+1));let r=n&&a.current!==ze;return r||(s(!0),l(null)),Y(e,n).then(e=>{if(!t){if(i(e),r)d(t=>t&&e.nodes.some(e=>e.id===t)?t:null),l(null);else if(!n){let t=z.current;z.current=null,d(t&&e.nodes.some(e=>e.id===t)?t:null)}s(!1)}}).catch(e=>{t||(l(e instanceof Error?e.message:String(e)),r||i(ze),s(!1))}),()=>{t=!0}},[n,Y,pt,e]);let X=(0,M.useCallback)((e,r)=>{if(z.current=r??null,F(e)===n){d(r??null),z.current=null;return}t(e)},[n]),gt=(0,M.useCallback)(async e=>{let t=F(e);if(!(R.current.has(t)||oe.has(t))){ce(e=>new Set(e).add(t));try{await Y(e)}finally{ce(e=>{let n=new Set(e);return n.delete(t),n})}}},[Y,oe]);(0,M.useEffect)(()=>{let e=!1,t=0;for(let n of G){if(t>=2)break;if(n.symbol||!n.toolUseId||n.filePath.startsWith(`(`))continue;let r=n.filePath;V.current.has(r)||(V.current.add(r),t+=1,Y({level:`symbols`,file:r}).then(t=>{if(e)return;let i=Re(n,t.nodes);i&&Ue(n.toolUseId,r,{id:i.id,name:i.label,...i.symbolKind?{kind:i.symbolKind}:{},...i.line?{line:i.line}:{}})}).catch(()=>void 0).finally(()=>{V.current.delete(r)}))}return()=>{e=!0}},[G,Y,Ue]);let Z=(0,M.useMemo)(()=>({nodes:r.nodes,edges:g===`all`?r.edges:r.edges.filter(e=>e.refType===g)}),[r,g]),Q=r.nodes.find(e=>e.id===u),$=(0,M.useMemo)(()=>De(Z,u,m),[m,Z,u]),vt=(0,M.useMemo)(()=>u?ye(Z,u):new Set,[Z,u]),{incomingCounts:yt,outgoingCounts:bt}=(0,M.useMemo)(()=>{let e=new Map,t=new Map;for(let n of Z.edges)t.set(n.source,(t.get(n.source)??0)+1),e.set(n.target,(e.get(n.target)??0)+1);return{incomingCounts:e,outgoingCounts:t}},[Z]),xt=f===`orbit`?u??void 0:void 0,St=(0,M.useMemo)(()=>xe($,f,xt),[$,f,xt]),Ct=(0,M.useMemo)(()=>[n,f,f===`orbit`?u??``:``,je($)].join(``),[$,n,f,u]),wt=(0,M.useCallback)(e=>{d(e.id),k(new Set)},[]),Tt=(0,M.useCallback)(e=>{e.kind===`package`&&X({level:`files`,package:e.package??e.label}),e.kind===`file`&&e.file&&X({level:`symbols`,file:e.file,package:e.package})},[X]),Et=(0,M.useCallback)((e,t)=>{let n=t.data;n?.graphNode&&(n.graphNode.kind===`package`||n.graphNode.kind===`file`&&n.graphNode.file?Tt(n.graphNode):wt(n.graphNode))},[Tt,wt]),Dt=(0,M.useMemo)(()=>[Le(Je),Le(Xe),Le(Ye)].join(``),[Je,Xe,Ye]),Ot=(0,M.useMemo)(()=>{let e=new Set;for(let t of q)e.add(P(t.filePath));return e},[q]),kt=(0,M.useMemo)(()=>{let e=new Set;for(let t of q)t.symbol?.id&&e.add(t.symbol.id);return e},[q]);et({positionedNodes:St,deferredActiveOperations:Je,deferredPulseActivities:Xe,selectedId:u,connected:vt,incomingCounts:yt,outgoingCounts:bt,handleSelectNode:wt,handleOpenNode:Tt,setHistoryFile:me,setFlowNodes:$e,canvasGraph:$,deferredRecentActivities:Ye,setAgentTrailCount:Ee,setFlowEdges:st,fitSignature:Ct,lastFlowStructuralKey:ke,flowRebuildTimer:Ie,lastFitSignature:Oe,fitView:dt,activityFlowKey:Dt}),(0,M.useEffect)(()=>{let e=window.setInterval(()=>{W()},2e3);return()=>window.clearInterval(e)},[W]);let At=R.current.get(`packages`)??(e.level===`packages`?r:ze),jt=(0,M.useCallback)(e=>R.current.get(F({level:`files`,package:e})),[le]),Mt=(0,M.useCallback)(e=>R.current.get(F({level:`symbols`,file:e})),[le]),Nt=(0,M.useCallback)(e=>{let t=e.filePath,n=Pe(e.filePath),r=`file:${e.filePath}`;for(let i of R.current.values()){let a=i.nodes.find(t=>t.kind===`file`&&!t.external&&Ne(t.file,e.filePath));if(a){t=a.file??t,n=a.package??n,r=a.id;break}}if(e.symbol){X({level:`symbols`,file:t,package:n},e.symbol.id);return}X({level:`files`,package:n},r)},[X]);(0,M.useEffect)(()=>{if(!ge||L)return;let e=[...q].filter(e=>!e.filePath.startsWith(`(`)).sort((e,t)=>t.timestamp-e.timestamp)[0];if(!e)return;let t=`${e.id??e.toolUseId}:${e.filePath}:${e.symbol?.id??`file`}`;B.current!==t&&(B.current=t,Nt(e))},[q,ge,Nt,L]);let Pt=(0,M.useCallback)(()=>{if(L){Se(null),we(null);return}Se([...G]),we([...K])},[G,L,K]),Ft=(0,M.useCallback)(e=>{let t=e.package??e.label,n=!C.has(t);w(e=>{let r=new Set(e);return n?r.add(t):r.delete(t),r}),n&>({level:`files`,package:t}).then(()=>{let e=R.current.get(F({level:`files`,package:t})),n=e?Ae(e.nodes):void 0;n?.directories.length===1&&n.directories[0]&&ee(e=>new Set(e).add(`${t}:${n.directories[0].path}`))}).catch(()=>void 0)},[gt,C]),It=(0,M.useCallback)(e=>{if(!e.file)return;let t=!D.has(e.file);O(n=>{let r=new Set(n);return t?r.add(e.file):r.delete(e.file),r}),t&>({level:`symbols`,file:e.file,package:e.package}).catch(()=>void 0)},[gt,D]),Lt=(0,M.useCallback)(e=>{ee(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Rt=(0,M.useCallback)(e=>{A(t=>new Set(t).add(e))},[]),zt=(0,M.useCallback)(e=>{X({level:`files`,package:e.package??`(root)`},e.id)},[X]),Bt=(0,M.useCallback)(e=>{e.file&&X({level:`symbols`,file:e.file,package:e.package},e.id)},[X]),Vt=(0,M.useMemo)(()=>{let e=x.trim().toLocaleLowerCase();if(!e)return[];let t=new Map;for(let n of R.current.values())for(let r of n.nodes)`${r.label} ${r.file??``} ${r.signature??``} ${r.package??``}`.toLocaleLowerCase().includes(e)&&t.set(r.id,r);return[...t.values()].sort((e,t)=>e.kind.localeCompare(t.kind)||e.label.localeCompare(t.label)).slice(0,80)},[x,le]),Ht=Vt.length>40,Ut=_({count:Vt.length,getScrollElement:()=>ht.current,estimateSize:()=>40,overscan:8,enabled:Ht}),Wt=(0,M.useCallback)(e=>{e.kind===`package`?X({level:`packages`},e.id):e.kind===`file`?X({level:`files`,package:e.package??`(root)`},e.id):e.file&&X({level:`symbols`,file:e.file,package:e.package},e.id)},[X]),{incoming:Gt,outgoing:Kt}=(0,M.useMemo)(()=>({incoming:Q?ve(Z,Q.id,`incoming`):[],outgoing:Q?ve(Z,Q.id,`outgoing`):[]}),[Z,Q]),{edgeWeight:qt,connectedNodeCount:Jt}=(0,M.useMemo)(()=>{let e=0,t=new Set;for(let n of Z.edges)e+=n.weight,t.add(n.source),t.add(n.target);return{edgeWeight:e,connectedNodeCount:t.size}},[Z]),Yt=Q?q.filter(e=>Fe(e,Q)):[],Xt=j?We(j):[];return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[(0,H.jsx)(at,{scope:e,graph:r,agentPresences:Ze,edgeWeight:qt,connectedNodeCount:Jt,navigate:X}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,H.jsx)(_t,{rootGraph:At,search:x,searchInput:y,searchResults:Vt,virtualizeSearch:Ht,searchVirtualizer:Ut,treeScrollRef:ht,selectedId:u,expandedPackages:C,expandedDirectories:T,expandedFiles:D,loadingBranches:oe,activeFileNorms:Ot,activeSymbolIds:kt,revealAllKeys:ae,packageGraph:jt,graphForFile:Mt,navigate:X,togglePackage:Ft,toggleDirectory:Lt,toggleFile:It,revealAllTree:Rt,selectFileFromTree:zt,selectSymbolFromTree:Bt,selectSearchResult:Wt,handleOpenNode:Tt,onSearchInputChange:b,onSearchChange:S}),(0,H.jsxs)(`main`,{className:`relative min-w-0 flex-1 bg-[radial-gradient(circle_at_50%_0%,hsl(var(--primary)/0.055),transparent_38%)]`,children:[(0,H.jsx)(it,{layout:f,canvasMode:m,edgeFilter:g,canvasNodeCount:$.nodes.length,graphNodeCount:r.nodes.length,onLayoutChange:p,onCanvasModeChange:h,onEdgeFilterChange:v}),(0,H.jsx)(ct,{presences:Ze,onLocate:Nt}),(0,H.jsx)(lt,{paused:L!==null,followLive:ge,agentFilter:I,agents:Ke,onTogglePaused:Pt,onToggleFollow:()=>{B.current=null,N(e=>!e)},onAgentFilter:e=>{B.current=null,be(e)}}),(0,H.jsx)(rt,{loading:o,error:c,graph:r,canvasNodeCount:$.nodes.length,flowNodes:Qe,flowEdges:ot,onNodesChange:nt,onEdgesChange:ut,onNodeClick:Et,agentTrailCount:Te})]}),(0,H.jsx)(ft,{selectedNode:Q,incoming:Gt,outgoing:Kt,filteredGraph:Z,expandedRelations:ne,activeOperations:q,recentActivities:qe,activityTotalCount:He,selectedActivities:Yt,onClearSelection:()=>d(null),onOpenNode:Tt,onOpenActivity:me,onLocateActivity:Nt,onToggleRelation:e=>k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelectNode:wt})]}),j&&(0,H.jsx)(tt,{historyFile:j,fileHistory:Xt,onClose:()=>me(null)})]})}function Q(){return(0,H.jsx)(ne,{children:(0,H.jsx)(Z,{})})}export{Q as CodeMap};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{Fn as r,
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{Fn as r,Ta as i,pa as a,wa as o,wo as s}from"./vendor-BfBvt432.js";import"./i18n-CzTjKT4L.js";import{S as c}from"./stores-Svlibwo5.js";import{a as l,n as u,o as d,r as f,t as p}from"./dialog-BDUaV5gY.js";import{I as m,l as h}from"./index-Ci22AODp.js";var g=e(t(),1),_=n();function v(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:e<36e5?`${(e/6e4).toFixed(1)}m`:`${(e/36e5).toFixed(1)}h`}function y(e){if(!e)return`—`;let t=new Date(e),n=Date.now(),r=t.getTime()-n,i=Math.abs(r);if(i<6e4)return r>=0?`<1m`:`<1m ago`;if(i<36e5){let e=Math.round(i/6e4);return r>=0?`${e}m`:`${e}m ago`}if(i<864e5){let e=Math.round(i/36e5);return r>=0?`${e}h`:`${e}h ago`}return t.toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function b({enabled:e,overdue:t}){let{t:n}=s();return e?t?(0,_.jsxs)(h,{variant:`destructive`,className:`gap-1`,children:[(0,_.jsx)(a,{className:`h-3 w-3`}),n(`activity:cronJobs.statusOverdue`)]}):(0,_.jsxs)(h,{variant:`outline`,className:`gap-1 border-success/30 bg-success/10 text-success`,children:[(0,_.jsx)(o,{className:`h-3 w-3`}),n(`activity:cronJobs.statusActive`)]}):(0,_.jsxs)(h,{variant:`secondary`,className:`gap-1`,children:[(0,_.jsx)(i,{className:`h-3 w-3`}),n(`activity:cronJobs.statusDisabled`)]})}function x({open:e,onClose:t}){let{t:n}=s(),i=c(e=>e.snapshot),o=c(e=>e.lastFiredAt);c(e=>e.revision);let h=i?.jobs??[],x=i?.count??0,S=i?.maxConcurrent??0,C=h.filter(e=>e.overdue).length,w=h.filter(e=>e.enabled).length,T=h.reduce((e,t)=>e+t.runCount,0),E=(0,g.useCallback)(e=>{e||t()},[t]);return(0,_.jsx)(p,{open:e,onOpenChange:E,children:(0,_.jsxs)(u,{className:`max-w-3xl max-h-[80vh] flex flex-col`,children:[(0,_.jsxs)(l,{children:[(0,_.jsxs)(d,{className:`flex items-center gap-2`,children:[(0,_.jsx)(r,{className:`h-5 w-5`}),n(`activity:cronJobs.heading`)]}),(0,_.jsx)(f,{children:n(`activity:cronJobs.subtitle`)})]}),x>0&&(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-sm text-muted-foreground border-b border-border/70 pb-3`,children:[(0,_.jsx)(`span`,{className:`font-medium text-foreground`,children:n(`activity:cronJobs.jobCount`,{count:x})}),(0,_.jsx)(`span`,{className:`text-success`,children:n(`activity:cronJobs.enabledCount`,{count:w})}),C>0&&(0,_.jsx)(`span`,{className:`text-destructive`,children:n(`activity:cronJobs.overdueCount`,{count:C})}),(0,_.jsx)(`span`,{children:n(`activity:cronJobs.totalRuns`,{count:T})}),(0,_.jsx)(`span`,{className:`text-muted-foreground/60`,children:n(`activity:cronJobs.maxConcurrent`,{count:S})})]}),x===0&&(0,_.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-12 text-muted-foreground`,children:[(0,_.jsx)(a,{className:`h-8 w-8 opacity-40`}),(0,_.jsx)(`p`,{className:`text-sm`,children:n(`activity:cronJobs.emptyTitle`)}),(0,_.jsxs)(`p`,{className:`text-xs`,children:[n(`activity:cronJobs.emptyUse`),` `,(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:`cron_schedule`}),` `,n(`activity:cronJobs.emptyToAdd`)]})]}),x>0&&(0,_.jsx)(m,{className:`flex-1 -mx-6 px-6`,children:(0,_.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{className:`border-b border-border/50 text-left text-xs text-muted-foreground`,children:[(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:n(`activity:cronJobs.thStatus`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:n(`activity:cronJobs.thName`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:n(`activity:cronJobs.thInterval`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium text-right`,children:n(`activity:cronJobs.thRuns`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:n(`activity:cronJobs.thNextRun`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:n(`activity:cronJobs.thLastRun`)}),(0,_.jsx)(`th`,{className:`pb-2 font-medium`,children:n(`activity:cronJobs.thAction`)})]})}),(0,_.jsx)(`tbody`,{children:h.map(e=>(0,_.jsxs)(`tr`,{className:`border-b border-border/30 last:border-0`,children:[(0,_.jsx)(`td`,{className:`py-2.5 pr-3`,children:(0,_.jsx)(b,{enabled:e.enabled,overdue:e.overdue})}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs font-medium max-w-[160px] truncate`,title:e.name,children:e.name}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:v(e.intervalMs)}),(0,_.jsxs)(`td`,{className:`py-2.5 pr-3 text-right font-mono text-xs tabular-nums`,children:[e.runCount,o[e.name]&&(0,_.jsx)(`span`,{className:`ml-1 text-success`,title:n(`activity:cronJobs.lastFiredAtTitle`,{time:o[e.name]}),children:`●`})]}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:y(e.nextRun)}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:y(e.lastRun)}),(0,_.jsx)(`td`,{className:`py-2.5 font-mono text-xs max-w-[200px] truncate text-muted-foreground`,title:e.action,children:e.action})]},e.name))})]})}),x>0&&(0,_.jsxs)(`p`,{className:`text-xs text-muted-foreground pt-3 border-t border-border/70`,children:[n(`activity:cronJobs.footerUse`),` `,(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[11px]`,children:`cron_schedule`}),` `,n(`activity:cronJobs.footerToAdd`),(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[11px] ml-1`,children:`cron_cancel`}),` `,n(`activity:cronJobs.footerToRemove`)]})]})})}export{x as CronJobsPanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{wo as r}from"./vendor-BfBvt432.js";import"./i18n-CzTjKT4L.js";import{S as i}from"./fonts-C303yVU_.js";var a=e(t(),1),o=n(),s={0:`P0 Dead Package`,1:`P1 Dead File`,2:`P2 Dead Symbol`},c={0:`hsl(var(--destructive))`,1:`hsl(var(--warning))`,2:`hsl(var(--info))`};async function l(e){let t=await e.text();try{return JSON.parse(t)}catch{let e=t.length>300?`${t.slice(0,300)}…`:t;throw console.warn(JSON.stringify({level:`warn`,event:`deadcode_parse_error`,preview:e,timestamp:new Date().toISOString()})),Error(`The server returned a non-JSON response (possibly an HTML error page). Check that the backend is running and the /api/deadcode/* routes are wired.`)}}function u(){let{t:e}=r(),[t,n]=(0,a.useState)(`idle`),[u,d]=(0,a.useState)(`idle`),[h,g]=(0,a.useState)(null),[_,v]=(0,a.useState)(null),[y,b]=(0,a.useState)(null),x=(0,a.useCallback)(async()=>{n(`scanning`),b(null),g(null),v(null),d(`idle`);try{let e=await fetch(`/api/deadcode/scan`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});if(!e.ok){let t=await l(e);throw Error(t.detail??t.error??`HTTP ${e.status}`)}let t=await l(e);g(t),n(`done`)}catch(e){b(e instanceof Error?e.message:String(e)),n(`error`)}},[]),S=(0,a.useCallback)(async()=>{if(h){d(`generating`),b(null);try{let e=await fetch(`/api/deadcode/action-plan`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(h)});if(!e.ok){let t=await l(e);throw Error(t.detail??t.error??`HTTP ${e.status}`)}let t=await l(e);v(t),d(`ready`)}catch(e){b(e instanceof Error?e.message:String(e)),d(`idle`)}}},[h]),C=(0,a.useCallback)(()=>{if(!_)return;d(`executing`);let e=[`# Dead-Code Cleanup Plan`,``,_.summary,``,`## Files to address (in priority order)`,..._.files.map((e,t)=>`${t+1}. [${s[e.priority]}] ${e.file} — ${e.symbolCount} symbol(s) to remove`+(e.symbols.length>0?`\n Symbols: ${e.symbols.slice(0,5).join(`, `)}${e.symbols.length>5?` and ${e.symbols.length-5} more`:``}`:``))].join(`
|
|
2
2
|
`),t=window.__WS;t&&t.readyState===WebSocket.OPEN?t.send(JSON.stringify({type:`user.message`,payload:{text:e,action:`send`}})):(navigator.clipboard.writeText(e),b(`Agent not connected. Plan copied to clipboard — paste it into the chat.`)),d(`idle`)},[_]);return(0,o.jsxs)(`div`,{style:{padding:`16px`,fontFamily:`var(--font-sans, system-ui, sans-serif)`,color:`hsl(var(--foreground))`,background:`hsl(var(--background))`},children:[(0,o.jsx)(`h2`,{style:{margin:`0 0 16px`,fontSize:i(18),fontWeight:600,color:`hsl(var(--foreground))`},children:e(`activity:deadCode.deadCodeScan`)}),(0,o.jsx)(`button`,{type:`button`,onClick:x,disabled:t===`scanning`,style:{padding:`8px 16px`,fontSize:i(14),fontWeight:500,background:t===`scanning`?`hsl(var(--muted))`:`hsl(var(--primary))`,color:t===`scanning`?`hsl(var(--muted-foreground))`:`hsl(var(--primary-foreground))`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,cursor:t===`scanning`?`not-allowed`:`pointer`},children:t===`scanning`?`Scanning…`:`Scan for Dead Code`}),y&&(0,o.jsxs)(`div`,{style:{marginTop:`12px`,padding:`8px 12px`,background:`hsl(var(--destructive) / 0.1)`,color:`hsl(var(--destructive))`,border:`1px solid hsl(var(--destructive) / 0.3)`,borderRadius:`0`,fontSize:i(13)},children:[y,(0,o.jsx)(`button`,{type:`button`,onClick:()=>b(null),style:{marginLeft:`12px`,background:`none`,border:`none`,cursor:`pointer`,fontWeight:600,color:`hsl(var(--destructive))`},children:`✕`})]}),h&&(0,o.jsxs)(`div`,{style:{marginTop:`16px`},children:[(0,o.jsxs)(`div`,{style:{display:`flex`,gap:`12px`,marginBottom:`12px`},children:[(0,o.jsx)(f,{label:e(`activity:deadCode.totalSymbols`),value:h.stats.totalSymbols,token:`info`}),(0,o.jsx)(f,{label:e(`activity:deadCode.alive`),value:h.stats.alive,token:`success`}),(0,o.jsx)(f,{label:e(`activity:deadCode.dead`),value:h.stats.dead,token:`destructive`})]}),h.deadPackages.length>0&&(0,o.jsx)(p,{title:`Dead Packages (${h.deadPackages.length})`,token:`destructive`,children:h.deadPackages.map(e=>(0,o.jsx)(m,{columns:[e.package,e.path,`${e.fileCount} file(s)`]},e.package))}),h.deadFiles.length>0&&(0,o.jsx)(p,{title:`Dead Files (${h.deadFiles.length})`,token:`warning`,children:h.deadFiles.map(e=>(0,o.jsx)(m,{columns:[e.file,`${e.symbolCount} symbol(s)`,e.lang]},e.file))}),h.deadSymbols.length>0&&(0,o.jsxs)(p,{title:`Dead Symbols (${h.deadSymbols.length})`,token:`info`,children:[h.deadSymbols.slice(0,50).map(e=>(0,o.jsx)(m,{columns:[e.name,e.kind,e.file.split(`/`).pop()??e.file,`line ${e.line}`]},`${e.file}:${e.line}:${e.name}`)),h.deadSymbols.length>50&&(0,o.jsxs)(`div`,{style:{padding:`6px 8px`,color:`hsl(var(--muted-foreground))`,fontSize:i(12)},children:[`… and `,h.deadSymbols.length-50,` more`]})]}),t===`done`&&(0,o.jsx)(`button`,{type:`button`,onClick:S,disabled:u===`generating`,style:{marginTop:`12px`,padding:`8px 16px`,fontSize:i(14),fontWeight:500,background:u===`generating`?`hsl(var(--muted))`:`hsl(var(--accent))`,color:u===`generating`?`hsl(var(--muted-foreground))`:`hsl(var(--accent-foreground))`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,cursor:u===`generating`?`not-allowed`:`pointer`},children:u===`generating`?`Generating…`:`Generate Action Plan`})]}),_&&(0,o.jsxs)(`div`,{style:{marginTop:`16px`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,padding:`12px`,background:`hsl(var(--card))`},children:[(0,o.jsx)(`h3`,{style:{margin:`0 0 8px`,fontSize:i(15),fontWeight:600,color:`hsl(var(--card-foreground))`},children:e(`activity:deadCode.actionPlan`)}),(0,o.jsx)(`p`,{style:{fontSize:i(13),color:`hsl(var(--muted-foreground))`,margin:`0 0 12px`},children:_.summary}),_.files.map((e,t)=>(0,o.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:`8px`,padding:`6px 0`,borderBottom:t<_.files.length-1?`1px solid hsl(var(--border))`:`none`,fontSize:i(13)},children:[(0,o.jsx)(`span`,{style:{background:c[e.priority]??`hsl(var(--muted-foreground))`,color:`hsl(var(--primary-foreground))`,borderRadius:`0`,padding:`2px 6px`,fontSize:i(11),fontWeight:600,whiteSpace:`nowrap`,flexShrink:0},children:s[e.priority]??`P${e.priority}`}),(0,o.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,o.jsx)(`div`,{style:{fontWeight:500,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,color:`hsl(var(--foreground))`},children:e.file}),(0,o.jsxs)(`div`,{style:{color:`hsl(var(--muted-foreground))`,fontSize:i(12)},children:[e.symbolCount,` symbol(s)`,e.symbols.length>0&&` · ${e.symbols.slice(0,2).join(`, `)}${e.symbols.length>2?`…`:``}`]})]})]},e.file)),(0,o.jsx)(`button`,{type:`button`,onClick:C,disabled:u===`executing`,style:{marginTop:`12px`,padding:`8px 16px`,fontSize:i(14),fontWeight:500,background:u===`executing`?`hsl(var(--muted))`:`hsl(var(--success))`,color:`hsl(var(--primary-foreground))`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,cursor:u===`executing`?`not-allowed`:`pointer`},children:u===`executing`?`Sending…`:`Execute Plan via Agent`})]})]})}var d={success:`hsl(var(--success))`,warning:`hsl(var(--warning))`,info:`hsl(var(--info))`,destructive:`hsl(var(--destructive))`,primary:`hsl(var(--primary))`};function f({label:e,value:t,token:n}){let r=d[n];return(0,o.jsxs)(`div`,{style:{flex:1,padding:`10px`,borderRadius:`0`,border:`1px solid hsl(var(--border))`,background:`hsl(var(--card))`,textAlign:`center`},children:[(0,o.jsx)(`div`,{style:{fontSize:i(24),fontWeight:700,color:r},children:t}),(0,o.jsx)(`div`,{style:{fontSize:i(12),color:`hsl(var(--muted-foreground))`,marginTop:`2px`},children:e})]})}function p({title:e,token:t,children:n}){let r=d[t];return(0,o.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,o.jsx)(`h3`,{style:{margin:`0 0 6px`,fontSize:i(14),fontWeight:600,color:r,borderLeft:`3px solid ${r}`,paddingLeft:`8px`},children:e}),(0,o.jsx)(`div`,{style:{border:`1px solid hsl(var(--border))`,borderRadius:`0`,overflow:`hidden`,fontSize:i(13)},children:n})]})}function m({columns:e}){return(0,o.jsx)(`div`,{style:{display:`flex`,gap:`8px`,padding:`5px 8px`,borderBottom:`1px solid hsl(var(--border))`,fontSize:i(13),fontFamily:`var(--font-mono, monospace)`,background:`hsl(var(--card))`,color:`hsl(var(--card-foreground))`},children:e.map((e,t)=>(0,o.jsx)(`span`,{style:{flex:t===0?2:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e},t))})}export{u as DeadCodeScanPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{Da as r,La as i,Mi as a,Tn as o,Vn as s,Xt as c,fi as l,ho as u,ua as d,wo as f,xo as p,zi as m}from"./vendor-V3ydTHqN.js";import"./i18n-Dv97urcO.js";import{y as h}from"./index-DX6tHUzs.js";var g=e(t(),1),_=n();function v({title:e,value:t,subtitle:n,icon:r,color:i=`text-primary`,trend:a}){let{t:o}=p();return(0,_.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,_.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium`,children:e}),(0,_.jsx)(`p`,{className:`mt-1 truncate text-xl font-semibold tabular-nums sm:text-2xl ${i}`,children:t}),n&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:n})]}),(0,_.jsx)(`div`,{className:`shrink-0 rounded-lg bg-muted/70 p-2 ${i}`,children:(0,_.jsx)(r,{className:`w-5 h-5`})})]}),a&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-center gap-1`,children:[a===`up`&&(0,_.jsx)(c,{className:`w-3 h-3 text-success`}),a===`down`&&(0,_.jsx)(c,{className:`w-3 h-3 rotate-180 text-destructive`}),(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(a===`up`?`activity:debug.trendUp`:a===`down`?`activity:debug.trendDown`:`activity:debug.trendStable`)})]})]})}function y(){let{t:e}=p(),[t,n]=(0,g.useState)({fileWatcher:null,system:null,lastUpdated:null,error:null}),[y,C]=(0,g.useState)(!0),[w,T]=(0,g.useState)(2e3),E=(0,g.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch(`/debug/watcher-metrics`),fetch(`/debug/system`,{cache:`no-store`})]),r=null,i=e.headers.get(`content-type`)??``;if(e.ok&&i.includes(`application/json`)&&(r=await e.json()),!t.ok)throw Error(`System metrics request failed (${t.status})`);let a=await t.json();n({fileWatcher:r,system:a,lastUpdated:new Date,error:null})}catch(e){n(t=>({...t,error:e instanceof Error?e.message:f.t(`activity:debug.fetchFailed`)}))}finally{C(!1)}},[]);return(0,g.useEffect)(()=>{E();let e=setInterval(E,w);return()=>clearInterval(e)},[E,w]),(0,_.jsx)(`div`,{ref:h(`debug`),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,_.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col gap-5`,children:[(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-semibold sm:text-xl`,children:[(0,_.jsx)(i,{className:`h-5 w-5 text-primary`}),e(`activity:debug.heading`)]}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e(`activity:debug.subtitle`)})]}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,_.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-sm`,children:[(0,_.jsx)(s,{className:`w-4 h-4 text-muted-foreground`}),(0,_.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e(`activity:debug.refreshLabel`)}),(0,_.jsxs)(`select`,{value:w,onChange:e=>T(Number(e.target.value)),className:`h-9 rounded-md border border-border/70 bg-background/70 px-2 text-sm`,children:[(0,_.jsx)(`option`,{value:1e3,children:`1s`}),(0,_.jsx)(`option`,{value:2e3,children:`2s`}),(0,_.jsx)(`option`,{value:5e3,children:`5s`}),(0,_.jsx)(`option`,{value:1e4,children:`10s`})]})]}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>{C(!0),E()},disabled:y,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground shadow-sm shadow-primary/15 hover:bg-primary/90 disabled:opacity-50`,children:[(0,_.jsx)(s,{className:`w-4 h-4 ${y?`animate-spin`:``}`}),e(`common:action.refresh`)]})]})]})}),t.lastUpdated&&(0,_.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-card/55 px-3 py-2 text-sm text-muted-foreground`,children:[(0,_.jsx)(d,{className:`w-4 h-4`}),e(`activity:debug.lastUpdated`,{time:t.lastUpdated.toLocaleTimeString()})]}),t.error&&(0,_.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-destructive/25 bg-destructive/10 p-4 text-destructive`,children:[(0,_.jsx)(r,{className:`w-5 h-5 flex-shrink-0`}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`font-medium`,children:e(`activity:debug.fetchFailed`)}),(0,_.jsx)(`p`,{className:`text-sm opacity-80`,children:t.error})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(m,{className:`h-4 w-4 text-primary`}),e(`activity:debug.fileWatcher`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.watcherStatus`),value:t.fileWatcher?.watcherActive?e(`activity:debug.running`):e(`activity:debug.stopped`),icon:o,color:t.fileWatcher?.watcherActive?`text-success`:`text-destructive`}),(0,_.jsx)(v,{title:e(`activity:debug.activeProjects`),value:t.fileWatcher?.activeProjects??0,subtitle:e(`activity:debug.projectsWatched`),icon:a,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.fileChanges`),value:t.fileWatcher?.fileChangesDetected??0,subtitle:e(`activity:debug.totalDetected`),icon:u,color:`text-primary`,trend:`neutral`}),(0,_.jsx)(v,{title:e(`activity:debug.filesProcessed`),value:t.fileWatcher?.filesProcessed??0,subtitle:e(`activity:debug.afterHash`),icon:l,color:`text-success`})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mt-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.broadcastsSent`),value:t.fileWatcher?.broadcastsSent??0,subtitle:e(`activity:debug.toClients`),icon:c,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debug.debounceResets`),value:t.fileWatcher?.debounceResets??0,subtitle:e(`activity:debug.rapidWrites`),icon:s,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.avgDebounce`),value:`${(t.fileWatcher?.averageDebounceDelayMs??0).toFixed(1)}ms`,subtitle:e(`activity:debug.actualDelay`),icon:d,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.totalDelay`),value:`${(t.fileWatcher?.totalDebounceDelayMs??0).toFixed(0)}ms`,subtitle:e(`activity:debug.sumDelays`),icon:i,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(l,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.webuiServerProcess`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debugDash.processRamRss`),value:b(t.system?.memoryUsage?.rss??0),subtitle:t.system?`PID ${t.system.pid}`:void 0,icon:o,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapUsed`),value:b(t.system?.memoryUsage?.heapUsed??0),subtitle:e(`activity:debug.jsHeap`),icon:i,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapTotal`),value:b(t.system?.memoryUsage?.heapTotal??0),subtitle:e(`activity:debug.totalHeap`),icon:i,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debugDash.v8HeapLimit`),value:b(t.system?.heapLimit??0),subtitle:e(`activity:debugDash.oldSpaceCeiling`),icon:l,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.serverUptime`),value:S(t.system?.uptime??0),subtitle:e(`activity:debugDash.sinceProcessStart`),icon:d,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(u,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.liveWrongstackProcesses`)]}),(0,_.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-border/70 bg-card/75 shadow-sm`,children:(0,_.jsxs)(`table`,{className:`w-full min-w-[980px] text-left text-xs`,children:[(0,_.jsx)(`thead`,{className:`border-b border-border/70 bg-muted/35 text-muted-foreground`,children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.surface`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.memory`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.growthSignal`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.workload`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.hqOfflineQueue`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.resourcesHotspot`)})]})}),(0,_.jsxs)(`tbody`,{children:[(t.system?.processes??[]).map(e=>{let t=[e.workload.messages===void 0?void 0:`${e.workload.messages} msgs`,e.workload.messageEstimatedTokens===void 0?void 0:`${e.workload.messageEstimatedTokens.toLocaleString()} ctx tokens`,e.workload.historyEntries===void 0?void 0:`${e.workload.historyMountedEntries??0}/${e.workload.historyEntries} history mounted`,e.workload.appRenders===void 0?void 0:`${e.workload.appRenders} renders`,e.workload.metricsDroppedObservations?`${e.workload.metricsDroppedObservations} metric drops`:void 0,e.workload.kanbanSyncActive?`kanban sync active`:void 0,e.workload.kanbanSyncPendingBoards?`${e.workload.kanbanSyncPendingBoards} kanban pending`:void 0,e.workload.kanbanSyncFullRescanPending?`kanban full rescan pending`:void 0,e.workload.kanbanSyncRemoteApplyQueued?`${e.workload.kanbanSyncPendingRemoteBoards??0} remote boards queued`:void 0,e.workload.kanbanSyncCoalescedRefreshes?`${e.workload.kanbanSyncCoalescedRefreshes} kanban coalesced`:void 0,e.workload.kanbanSupervisorSnapshots?`${e.workload.kanbanSupervisorSnapshots} supervised boards`:void 0,e.workload.kanbanSupervisorScheduledBoards?`${e.workload.kanbanSupervisorScheduledBoards} supervisor schedules`:void 0].filter(Boolean).join(` · `);return(0,_.jsxs)(`tr`,{className:`border-b border-border/50 align-top last:border-b-0`,children:[(0,_.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,_.jsx)(`div`,{className:`font-medium text-foreground`,children:e.surface}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`PID `,e.pid]}),(0,_.jsx)(`div`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsxs)(`div`,{children:[`RSS `,b(e.memory.rss)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`heap `,b(e.memory.heapUsed),e.memory.retainedHeapUsed===void 0?``:` · retained ${b(e.memory.retainedHeapUsed)}`]}),e.memory.nativeResidual===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`native `,b(e.memory.nativeResidual)]}),e.memory.external===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`external `,b(e.memory.external),e.memory.arrayBuffers===void 0?``:` · buffers ${b(e.memory.arrayBuffers)}`]})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsx)(`div`,{className:e.signal===`stable`?`text-success`:e.signal?`text-warning`:`text-muted-foreground`,children:e.signal??`sampling`}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`heap `,x(e.heapGrowthBytesPerHour)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`RSS `,x(e.rssGrowthBytesPerHour)]})]}),(0,_.jsx)(`td`,{className:`px-3 py-3 text-muted-foreground`,children:t||`—`}),(0,_.jsx)(`td`,{className:`px-3 py-3 tabular-nums`,children:e.hqQueue?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{children:[e.hqQueue.entries,` frames ·`,` `,b(e.hqQueue.bytes),` /`,` `,b(e.hqQueue.maxBytes)]}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[e.hqQueue.coalescedFrames,` coalesced ·`,` `,e.hqQueue.droppedFrames,` dropped`]}),e.hqSnapshot?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`snapshot`,` `,e.hqSnapshot.inFlight?`in-flight`:e.hqSnapshot.pending?`pending`:e.hqSnapshot.timerScheduled?`scheduled`:`idle`]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`events`,` `,e.hqSnapshot.eventInFlight?`in-flight`:`idle`,` ·`,` `,e.hqSnapshot.pendingEvents,` pending ·`,` `,e.hqSnapshot.coalescedEvents,` coalesced ·`,` `,e.hqSnapshot.droppedEvents,` dropped`]})]}):null]}):(0,_.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,_.jsxs)(`td`,{className:`max-w-[360px] px-3 py-3 text-muted-foreground`,children:[(0,_.jsxs)(`div`,{children:[e.resources.active??0,` active`,e.resources.types?` · ${e.resources.types}`:``]}),e.profileTopStack?(0,_.jsxs)(`div`,{className:`mt-1 truncate`,title:e.profileTopStack,children:[e.profileTopStackBytes===void 0?``:`${b(e.profileTopStackBytes)} · `,e.profileTopStack]}):null]})]},e.pid)}),(t.system?.processes?.length??0)===0?(0,_.jsx)(`tr`,{children:(0,_.jsx)(`td`,{className:`px-3 py-5 text-muted-foreground`,colSpan:6,children:e(`activity:debugDash.waitingForHeapFlightRecorderSamples`)})}):null]})]})})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(o,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.codebaseIndexServer`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debugDash.connection`),value:t.system?.codebaseIndexServer?.health?.status??t.system?.codebaseIndexServer?.status??`unknown`,subtitle:t.system?.codebaseIndexServer?.pid?`PID ${t.system.codebaseIndexServer.pid} · RTT ${t.system.codebaseIndexServer.health?.latencyMs??`—`}ms`:`No connected project server`,icon:u,color:t.system?.codebaseIndexServer?.health?.status===`healthy`?`text-success`:t.system?.codebaseIndexServer?.status===`unresponsive`||t.system?.codebaseIndexServer?.status===`error`?`text-destructive`:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexRamRss`),value:b(t.system?.codebaseIndexServer?.health?.server?.memory.rss??0),subtitle:`Heap ${b(t.system?.codebaseIndexServer?.health?.server?.memory.heapUsed??0)} / ${b(t.system?.codebaseIndexServer?.health?.server?.memory.heapTotal??0)}`,icon:i,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWorkload`),value:`${t.system?.codebaseIndexServer?.health?.server?.activeRequests??0} requests`,subtitle:`${t.system?.codebaseIndexServer?.health?.server?.activeWrites??0} writes · ${t.system?.codebaseIndexServer?.health?.server?.queuedWrites??0} queued`,icon:l,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWatcher`),value:t.system?.codebaseIndexServer?.health?.server?.watchingExternal?`Active`:`Off`,subtitle:`${t.system?.codebaseIndexServer?.health?.server?.watchingClients??0} owners · ${t.system?.codebaseIndexServer?.health?.server?.pendingExternalFiles??0} pending`,icon:m,color:t.system?.codebaseIndexServer?.health?.server?.watchingExternal?`text-success`:`text-muted-foreground`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(u,{className:`h-4 w-4 text-primary`}),e(`activity:debug.rawData`)]}),(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsx)(`pre`,{className:`overflow-x-auto text-xs font-mono text-muted-foreground`,children:JSON.stringify({fileWatcher:t.fileWatcher,serverPid:t.system?.pid,serverMemory:t.system?.memoryUsage,serverHeapLimit:t.system?.heapLimit,serverUptime:t.system?.uptime,processes:t.system?.processes,codebaseIndexServer:t.system?.codebaseIndexServer},null,2)})})]})]})})}function b(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return`${(e/t**r).toFixed(1)} ${n[r]}`}function x(e){return e===void 0?`—`:`${e>0?`+`:e<0?`−`:``}${b(Math.abs(e))}/h`}function S(e){return e<60?`${e.toFixed(0)}s`:e<3600?`${(e/60).toFixed(1)}m`:`${(e/3600).toFixed(1)}h`}export{y as DebugDashboard};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{Aa as r,Ba as i,Do as a,Fi as o,Hi as s,Tn as c,Vn as l,Xt as u,hi as d,pa as f,vo as p,wo as m}from"./vendor-BfBvt432.js";import"./i18n-CzTjKT4L.js";import{u as h}from"./index-Ci22AODp.js";var g=e(t(),1),_=n();function v({title:e,value:t,subtitle:n,icon:r,color:i=`text-primary`,trend:a}){let{t:o}=m();return(0,_.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,_.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium`,children:e}),(0,_.jsx)(`p`,{className:`mt-1 truncate text-xl font-semibold tabular-nums sm:text-2xl ${i}`,children:t}),n&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:n})]}),(0,_.jsx)(`div`,{className:`shrink-0 rounded-lg bg-muted/70 p-2 ${i}`,children:(0,_.jsx)(r,{className:`w-5 h-5`})})]}),a&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-center gap-1`,children:[a===`up`&&(0,_.jsx)(u,{className:`w-3 h-3 text-success`}),a===`down`&&(0,_.jsx)(u,{className:`w-3 h-3 rotate-180 text-destructive`}),(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(a===`up`?`activity:debug.trendUp`:a===`down`?`activity:debug.trendDown`:`activity:debug.trendStable`)})]})]})}function y(){let{t:e}=m(),[t,n]=(0,g.useState)({fileWatcher:null,system:null,lastUpdated:null,error:null}),[y,C]=(0,g.useState)(!0),[w,T]=(0,g.useState)(2e3),E=(0,g.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch(`/debug/watcher-metrics`),fetch(`/debug/system`,{cache:`no-store`})]),r=null,i=e.headers.get(`content-type`)??``;if(e.ok&&i.includes(`application/json`)&&(r=await e.json()),!t.ok)throw Error(`System metrics request failed (${t.status})`);let a=await t.json();n({fileWatcher:r,system:a,lastUpdated:new Date,error:null})}catch(e){n(t=>({...t,error:e instanceof Error?e.message:a.t(`activity:debug.fetchFailed`)}))}finally{C(!1)}},[]);return(0,g.useEffect)(()=>{E();let e=setInterval(E,w);return()=>clearInterval(e)},[E,w]),(0,_.jsx)(`div`,{ref:h(`debug`),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,_.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col gap-5`,children:[(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-semibold sm:text-xl`,children:[(0,_.jsx)(i,{className:`h-5 w-5 text-primary`}),e(`activity:debug.heading`)]}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e(`activity:debug.subtitle`)})]}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,_.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-sm`,children:[(0,_.jsx)(l,{className:`w-4 h-4 text-muted-foreground`}),(0,_.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e(`activity:debug.refreshLabel`)}),(0,_.jsxs)(`select`,{value:w,onChange:e=>T(Number(e.target.value)),className:`h-9 rounded-md border border-border/70 bg-background/70 px-2 text-sm`,children:[(0,_.jsx)(`option`,{value:1e3,children:`1s`}),(0,_.jsx)(`option`,{value:2e3,children:`2s`}),(0,_.jsx)(`option`,{value:5e3,children:`5s`}),(0,_.jsx)(`option`,{value:1e4,children:`10s`})]})]}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>{C(!0),E()},disabled:y,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground shadow-sm shadow-primary/15 hover:bg-primary/90 disabled:opacity-50`,children:[(0,_.jsx)(l,{className:`w-4 h-4 ${y?`animate-spin`:``}`}),e(`common:action.refresh`)]})]})]})}),t.lastUpdated&&(0,_.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-card/55 px-3 py-2 text-sm text-muted-foreground`,children:[(0,_.jsx)(f,{className:`w-4 h-4`}),e(`activity:debug.lastUpdated`,{time:t.lastUpdated.toLocaleTimeString()})]}),t.error&&(0,_.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-destructive/25 bg-destructive/10 p-4 text-destructive`,children:[(0,_.jsx)(r,{className:`w-5 h-5 flex-shrink-0`}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`font-medium`,children:e(`activity:debug.fetchFailed`)}),(0,_.jsx)(`p`,{className:`text-sm opacity-80`,children:t.error})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(s,{className:`h-4 w-4 text-primary`}),e(`activity:debug.fileWatcher`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.watcherStatus`),value:t.fileWatcher?.watcherActive?e(`activity:debug.running`):e(`activity:debug.stopped`),icon:c,color:t.fileWatcher?.watcherActive?`text-success`:`text-destructive`}),(0,_.jsx)(v,{title:e(`activity:debug.activeProjects`),value:t.fileWatcher?.activeProjects??0,subtitle:e(`activity:debug.projectsWatched`),icon:o,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.fileChanges`),value:t.fileWatcher?.fileChangesDetected??0,subtitle:e(`activity:debug.totalDetected`),icon:p,color:`text-primary`,trend:`neutral`}),(0,_.jsx)(v,{title:e(`activity:debug.filesProcessed`),value:t.fileWatcher?.filesProcessed??0,subtitle:e(`activity:debug.afterHash`),icon:d,color:`text-success`})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mt-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.broadcastsSent`),value:t.fileWatcher?.broadcastsSent??0,subtitle:e(`activity:debug.toClients`),icon:u,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debug.debounceResets`),value:t.fileWatcher?.debounceResets??0,subtitle:e(`activity:debug.rapidWrites`),icon:l,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.avgDebounce`),value:`${(t.fileWatcher?.averageDebounceDelayMs??0).toFixed(1)}ms`,subtitle:e(`activity:debug.actualDelay`),icon:f,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.totalDelay`),value:`${(t.fileWatcher?.totalDebounceDelayMs??0).toFixed(0)}ms`,subtitle:e(`activity:debug.sumDelays`),icon:i,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(d,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.webuiServerProcess`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debugDash.processRamRss`),value:b(t.system?.memoryUsage?.rss??0),subtitle:t.system?`PID ${t.system.pid}`:void 0,icon:c,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapUsed`),value:b(t.system?.memoryUsage?.heapUsed??0),subtitle:e(`activity:debug.jsHeap`),icon:i,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapTotal`),value:b(t.system?.memoryUsage?.heapTotal??0),subtitle:e(`activity:debug.totalHeap`),icon:i,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debugDash.v8HeapLimit`),value:b(t.system?.heapLimit??0),subtitle:e(`activity:debugDash.oldSpaceCeiling`),icon:d,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.serverUptime`),value:S(t.system?.uptime??0),subtitle:e(`activity:debugDash.sinceProcessStart`),icon:f,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(p,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.liveWrongstackProcesses`)]}),(0,_.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-border/70 bg-card/75 shadow-sm`,children:(0,_.jsxs)(`table`,{className:`w-full min-w-[980px] text-left text-xs`,children:[(0,_.jsx)(`thead`,{className:`border-b border-border/70 bg-muted/35 text-muted-foreground`,children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.surface`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.memory`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.growthSignal`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.workload`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.hqOfflineQueue`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.resourcesHotspot`)})]})}),(0,_.jsxs)(`tbody`,{children:[(t.system?.processes??[]).map(e=>{let t=[e.workload.messages===void 0?void 0:`${e.workload.messages} msgs`,e.workload.messageEstimatedTokens===void 0?void 0:`${e.workload.messageEstimatedTokens.toLocaleString()} ctx tokens`,e.workload.historyEntries===void 0?void 0:`${e.workload.historyMountedEntries??0}/${e.workload.historyEntries} history mounted`,e.workload.appRenders===void 0?void 0:`${e.workload.appRenders} renders`,e.workload.metricsDroppedObservations?`${e.workload.metricsDroppedObservations} metric drops`:void 0,e.workload.kanbanSyncActive?`kanban sync active`:void 0,e.workload.kanbanSyncPendingBoards?`${e.workload.kanbanSyncPendingBoards} kanban pending`:void 0,e.workload.kanbanSyncFullRescanPending?`kanban full rescan pending`:void 0,e.workload.kanbanSyncRemoteApplyQueued?`${e.workload.kanbanSyncPendingRemoteBoards??0} remote boards queued`:void 0,e.workload.kanbanSyncCoalescedRefreshes?`${e.workload.kanbanSyncCoalescedRefreshes} kanban coalesced`:void 0,e.workload.kanbanSupervisorSnapshots?`${e.workload.kanbanSupervisorSnapshots} supervised boards`:void 0,e.workload.kanbanSupervisorScheduledBoards?`${e.workload.kanbanSupervisorScheduledBoards} supervisor schedules`:void 0].filter(Boolean).join(` · `);return(0,_.jsxs)(`tr`,{className:`border-b border-border/50 align-top last:border-b-0`,children:[(0,_.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,_.jsx)(`div`,{className:`font-medium text-foreground`,children:e.surface}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`PID `,e.pid]}),(0,_.jsx)(`div`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsxs)(`div`,{children:[`RSS `,b(e.memory.rss)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`heap `,b(e.memory.heapUsed),e.memory.retainedHeapUsed===void 0?``:` · retained ${b(e.memory.retainedHeapUsed)}`]}),e.memory.nativeResidual===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`native `,b(e.memory.nativeResidual)]}),e.memory.external===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`external `,b(e.memory.external),e.memory.arrayBuffers===void 0?``:` · buffers ${b(e.memory.arrayBuffers)}`]})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsx)(`div`,{className:e.signal===`stable`?`text-success`:e.signal?`text-warning`:`text-muted-foreground`,children:e.signal??`sampling`}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`heap `,x(e.heapGrowthBytesPerHour)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`RSS `,x(e.rssGrowthBytesPerHour)]})]}),(0,_.jsx)(`td`,{className:`px-3 py-3 text-muted-foreground`,children:t||`—`}),(0,_.jsx)(`td`,{className:`px-3 py-3 tabular-nums`,children:e.hqQueue?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{children:[e.hqQueue.entries,` frames ·`,` `,b(e.hqQueue.bytes),` /`,` `,b(e.hqQueue.maxBytes)]}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[e.hqQueue.coalescedFrames,` coalesced ·`,` `,e.hqQueue.droppedFrames,` dropped`]}),e.hqSnapshot?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`snapshot`,` `,e.hqSnapshot.inFlight?`in-flight`:e.hqSnapshot.pending?`pending`:e.hqSnapshot.timerScheduled?`scheduled`:`idle`]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`events`,` `,e.hqSnapshot.eventInFlight?`in-flight`:`idle`,` ·`,` `,e.hqSnapshot.pendingEvents,` pending ·`,` `,e.hqSnapshot.coalescedEvents,` coalesced ·`,` `,e.hqSnapshot.droppedEvents,` dropped`]})]}):null]}):(0,_.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,_.jsxs)(`td`,{className:`max-w-[360px] px-3 py-3 text-muted-foreground`,children:[(0,_.jsxs)(`div`,{children:[e.resources.active??0,` active`,e.resources.types?` · ${e.resources.types}`:``]}),e.profileTopStack?(0,_.jsxs)(`div`,{className:`mt-1 truncate`,title:e.profileTopStack,children:[e.profileTopStackBytes===void 0?``:`${b(e.profileTopStackBytes)} · `,e.profileTopStack]}):null]})]},e.pid)}),(t.system?.processes?.length??0)===0?(0,_.jsx)(`tr`,{children:(0,_.jsx)(`td`,{className:`px-3 py-5 text-muted-foreground`,colSpan:6,children:e(`activity:debugDash.waitingForHeapFlightRecorderSamples`)})}):null]})]})})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(c,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.codebaseIndexServer`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debugDash.connection`),value:t.system?.codebaseIndexServer?.health?.status??t.system?.codebaseIndexServer?.status??`unknown`,subtitle:t.system?.codebaseIndexServer?.pid?`PID ${t.system.codebaseIndexServer.pid} · RTT ${t.system.codebaseIndexServer.health?.latencyMs??`—`}ms`:`No connected project server`,icon:p,color:t.system?.codebaseIndexServer?.health?.status===`healthy`?`text-success`:t.system?.codebaseIndexServer?.status===`unresponsive`||t.system?.codebaseIndexServer?.status===`error`?`text-destructive`:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexRamRss`),value:b(t.system?.codebaseIndexServer?.health?.server?.memory.rss??0),subtitle:`Heap ${b(t.system?.codebaseIndexServer?.health?.server?.memory.heapUsed??0)} / ${b(t.system?.codebaseIndexServer?.health?.server?.memory.heapTotal??0)}`,icon:i,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWorkload`),value:`${t.system?.codebaseIndexServer?.health?.server?.activeRequests??0} requests`,subtitle:`${t.system?.codebaseIndexServer?.health?.server?.activeWrites??0} writes · ${t.system?.codebaseIndexServer?.health?.server?.queuedWrites??0} queued`,icon:d,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWatcher`),value:t.system?.codebaseIndexServer?.health?.server?.watchingExternal?`Active`:`Off`,subtitle:`${t.system?.codebaseIndexServer?.health?.server?.watchingClients??0} owners · ${t.system?.codebaseIndexServer?.health?.server?.pendingExternalFiles??0} pending`,icon:s,color:t.system?.codebaseIndexServer?.health?.server?.watchingExternal?`text-success`:`text-muted-foreground`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(p,{className:`h-4 w-4 text-primary`}),e(`activity:debug.rawData`)]}),(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsx)(`pre`,{className:`overflow-x-auto text-xs font-mono text-muted-foreground`,children:JSON.stringify({fileWatcher:t.fileWatcher,serverPid:t.system?.pid,serverMemory:t.system?.memoryUsage,serverHeapLimit:t.system?.heapLimit,serverUptime:t.system?.uptime,processes:t.system?.processes,codebaseIndexServer:t.system?.codebaseIndexServer},null,2)})})]})]})})}function b(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return`${(e/t**r).toFixed(1)} ${n[r]}`}function x(e){return e===void 0?`—`:`${e>0?`+`:e<0?`−`:``}${b(Math.abs(e))}/h`}function S(e){return e<60?`${e.toFixed(0)}s`:e<3600?`${(e/60).toFixed(1)}m`:`${(e/3600).toFixed(1)}h`}export{y as DebugDashboard};
|