@wrongstack/webui 0.303.0 → 0.305.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/assets/AgentRosterView-g1KmcsGN.js +9 -0
  2. package/dist/assets/{AnalyticsDashboard-CMs176Dp.js → AnalyticsDashboard-D7KwqZWe.js} +1 -1
  3. package/dist/assets/{AudienceMemoryPanel-BRXM47H1.js → AudienceMemoryPanel-CkCY5vFN.js} +2 -2
  4. package/dist/assets/ChangesView-Cd7XaPKE.js +1 -0
  5. package/dist/assets/{ChronicleDashboard-DPI_5S2R.js → ChronicleDashboard-CKTXZQBu.js} +1 -1
  6. package/dist/assets/CodeEditor-xrPrWeRC.js +1 -0
  7. package/dist/assets/CodeMap-CnlnHM8P.js +1 -0
  8. package/dist/assets/{ConfirmModal-DXy17_uy.js → ConfirmModal-BD6pUkAB.js} +1 -1
  9. package/dist/assets/{CronJobsPanel-C_bGieGQ.js → CronJobsPanel-DVbRI19g.js} +1 -1
  10. package/dist/assets/{DeadCodeScanPanel-hkBvamWn.js → DeadCodeScanPanel-Dp6vW6pV.js} +2 -2
  11. package/dist/assets/{DebugDashboard-CDWJ9nLR.js → DebugDashboard-L27zCOIW.js} +1 -1
  12. package/dist/assets/DesignGalleryView-BSOnBsKq.js +1 -0
  13. package/dist/assets/GoalView-5ELSJ5fI.js +1 -0
  14. package/dist/assets/KanbanView-Cs3ei9fW.js +3 -0
  15. package/dist/assets/MailboxDetailView-BKPIVEkq.js +1 -0
  16. package/dist/assets/{MemoryDrawer-D2Yq9oba.js → MemoryDrawer-WBQBcL-C.js} +1 -1
  17. package/dist/assets/MemoryManager-svukiuox.js +1 -0
  18. package/dist/assets/{ModelPicker-BazB-GbH.js → ModelPicker-C1ohvzbO.js} +1 -1
  19. package/dist/assets/OfficeMapPanel-DnOaGBxn.js +4 -0
  20. package/dist/assets/{ProcessMonitor-BTjaxnO-.js → ProcessMonitor-Cu3KUgai.js} +1 -1
  21. package/dist/assets/{QueuePanel-BOD9qtHp.js → QueuePanel-B4zQao-A.js} +1 -1
  22. package/dist/assets/{RefreshDebugView-DfbZ-vgF.js → RefreshDebugView-DTO6YlTY.js} +1 -1
  23. package/dist/assets/{RequirementIntakeView-CeZFJlrn.js → RequirementIntakeView-Bz0BWn9P.js} +1 -1
  24. package/dist/assets/SageTabs-DGzgZls5.js +2 -0
  25. package/dist/assets/{SddFlowGraph-DWphr6Tr.js → SddFlowGraph-B-5J7zOV.js} +1 -1
  26. package/dist/assets/SddHub-CTVOMFR2.js +2 -0
  27. package/dist/assets/{SessionInspectView-DqrSHseG.js → SessionInspectView-CvxwjPXI.js} +1 -1
  28. package/dist/assets/SessionList-BiYRM1rX.js +1 -0
  29. package/dist/assets/{SessionsDashboard-CUj2WSYM.js → SessionsDashboard-DKRZzumv.js} +1 -1
  30. package/dist/assets/SetupScreen-CQnV2Grl.js +1 -0
  31. package/dist/assets/SkillDetailView-BP3g7iie.js +3 -0
  32. package/dist/assets/{SpecsView-Cl4vpAoL.js → SpecsView-D4uEj-OZ.js} +1 -1
  33. package/dist/assets/{TechStackView-DsFV85XT.js → TechStackView-epS5clib.js} +1 -1
  34. package/dist/assets/{TerminalPanel-GraS3zw1.js → TerminalPanel-Dj4n-0MH.js} +1 -1
  35. package/dist/assets/{Toaster-D76T-Ld4.js → Toaster-Dic3369l.js} +1 -1
  36. package/dist/assets/{activity-CZIixoel.js → activity-BI4XyF_x.js} +3 -3
  37. package/dist/assets/{activity-BwEBEQ51.js → activity-Dg9Q9kwt.js} +3 -3
  38. package/dist/assets/{activity-BnTQWNPX.js → activity-Dr_u3dOm.js} +3 -3
  39. package/dist/assets/{activity-CRMLR4a3.js → activity-Dzgvt4Nh.js} +3 -3
  40. package/dist/assets/{activity-Xqrt9v4z.js → activity-IttuV5ar.js} +3 -3
  41. package/dist/assets/{activity-BLSyJfTr.js → activity-L2_b8Uan.js} +3 -3
  42. package/dist/assets/{activity-C-9I3_s4.js → activity-gB90peLu.js} +3 -3
  43. package/dist/assets/{button-ELs5xgtQ.js → button-DvHe5h9X.js} +1 -1
  44. package/dist/assets/{chat-store-CBJ1gc8n.js → chat-store-RzAVkc8a.js} +2 -2
  45. package/dist/assets/{codemap-activity-store-D67-genN.js → codemap-activity-store-DBdfN0ix.js} +1 -1
  46. package/dist/assets/codemap-index-store-45CkVCxN.js +1 -0
  47. package/dist/assets/{dialog-CfAoIH8P.js → dialog-jbs7gu-q.js} +1 -1
  48. package/dist/assets/{empty-state-BDwjdvMh.js → empty-state-D-ojp6Gp.js} +1 -1
  49. package/dist/assets/i18n-nlW2iAya.js +2 -0
  50. package/dist/assets/index-hNmvVlqt.js +132 -0
  51. package/dist/assets/{index-DHsJniTZ.css → index-mNf-KFcC.css} +1 -1
  52. package/dist/assets/{input-DSTQkMEh.js → input-oJ0Gehqp.js} +1 -1
  53. package/dist/assets/{mailbox-store-CKpkM0H1.js → mailbox-store-BuLRsYu3.js} +1 -1
  54. package/dist/assets/{roster-ws-a3-SO1Yb.js → roster-ws-IRvFZ_v1.js} +1 -1
  55. package/dist/assets/{session-store-Ce4Dck2K.js → session-store-DkPaOIhe.js} +1 -1
  56. package/dist/assets/{settings-Orwkg3lH.js → settings-4A6zNjep.js} +1 -1
  57. package/dist/assets/{settings-BlMNd_AC.js → settings-Bq1PPj3V.js} +1 -1
  58. package/dist/assets/{settings-DyIEVRJT.js → settings-BxL8m0v6.js} +1 -1
  59. package/dist/assets/{settings-ClpzPWKE.js → settings-CZR4viP9.js} +1 -1
  60. package/dist/assets/{settings-CyYYbmdR.js → settings-L8hBHrGD.js} +1 -1
  61. package/dist/assets/{settings-BUtmAZBV.js → settings-t7_uBgp_.js} +1 -1
  62. package/dist/assets/{settings-XRC0dC9D.js → settings-uLdezc9e.js} +1 -1
  63. package/dist/assets/{shared-D368RBth.js → shared-CiaNczO0.js} +1 -1
  64. package/dist/assets/{stores-BATHCuMN.js → stores-DxTO5dWX.js} +2 -2
  65. package/dist/assets/{ui-store-BGNdg1e4.js → ui-store-FVcXVdRC.js} +1 -1
  66. package/dist/assets/useWebSocket-B3WtCdii.js +29 -0
  67. package/dist/assets/utils-D1fGupR8.js +1 -0
  68. package/dist/assets/{vendor-GiKfK4Iw.js → vendor-AeHpGMaG.js} +30 -30
  69. package/dist/assets/{view-navigation-FdnvQSOv.js → view-navigation-D-afwlSZ.js} +1 -1
  70. package/dist/assets/ws-client-Cvio0IrC.js +1 -0
  71. package/dist/components/KanbanContractGraphPanel.d.ts +6 -1
  72. package/dist/components/KanbanTaskInspectorChrome.d.ts +62 -0
  73. package/dist/components/MemoryManager/MemoryDetail.d.ts +1 -1
  74. package/dist/components/MemoryManager/ReviewQueue.d.ts +25 -0
  75. package/dist/components/SettingsPanel/ToolsSection.d.ts +1 -0
  76. package/dist/components/agent-roster-data.d.ts +12 -0
  77. package/dist/hooks/useWebSocket.d.ts +3 -0
  78. package/dist/index.html +23 -23
  79. package/dist/index.js +5444 -4368
  80. package/dist/lib/kanban-cleaner.d.ts +20 -1
  81. package/dist/lib/ws-client-actions.d.ts +3 -0
  82. package/dist/stores/kanban-store.d.ts +4 -1
  83. package/dist/stores/local-prefs.d.ts +1 -1
  84. package/dist/stores/session-store.d.ts +2 -0
  85. package/dist/stores/ui-store.d.ts +3 -3
  86. package/dist/types/client-message.d.ts +5 -0
  87. package/dist/types/sage.d.ts +13 -0
  88. package/dist/types/server-message.d.ts +2 -2
  89. package/dist/types/system.d.ts +2 -0
  90. package/package.json +8 -8
  91. package/dist/assets/AgentRosterView-BnnhSRau.js +0 -9
  92. package/dist/assets/ChangesView-DxAQY4v4.js +0 -1
  93. package/dist/assets/CodeEditor-9Fu9hRrw.js +0 -1
  94. package/dist/assets/CodeMap-B7YGx2G0.js +0 -1
  95. package/dist/assets/DesignGalleryView-BG-p6kFX.js +0 -1
  96. package/dist/assets/GoalView-CCklBpTx.js +0 -1
  97. package/dist/assets/KanbanView-Dzvn9y79.js +0 -3
  98. package/dist/assets/MailboxDetailView-7dtt5joR.js +0 -1
  99. package/dist/assets/MemoryManager-CL5AiyKr.js +0 -1
  100. package/dist/assets/OfficeMapPanel-Dtb75DlY.js +0 -4
  101. package/dist/assets/SageTabs-BlK58zgb.js +0 -2
  102. package/dist/assets/SddHub-ZRkMmA7e.js +0 -2
  103. package/dist/assets/SessionList-DLoIKc1b.js +0 -1
  104. package/dist/assets/SetupScreen-B_2CuLeR.js +0 -1
  105. package/dist/assets/SkillDetailView-ChspOaAw.js +0 -3
  106. package/dist/assets/codemap-index-store-ByAYIzQA.js +0 -1
  107. package/dist/assets/i18n-BvFgJYE2.js +0 -2
  108. package/dist/assets/index-BTRQG7C5.js +0 -132
  109. package/dist/assets/useWebSocket-B2opfRwA.js +0 -29
  110. package/dist/assets/utils-CUCQrODG.js +0 -1
  111. package/dist/assets/ws-client-CGEB75Dy.js +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$i as t,Ba as n,Bn as r,Fa as i,Gi as a,Ii as o,Li as s,Tn as c,Zi as l,Zr as u,ar as d,dt as f,ha as p,hr as m,ji as h,lt as g,mn as _,rr as v}from"./vendor-GiKfK4Iw.js";import"./i18n-BvFgJYE2.js";import{t as y}from"./useWebSocket-B2opfRwA.js";import{t as b}from"./utils-CUCQrODG.js";import{a as x}from"./stores-BATHCuMN.js";import{r as S}from"./view-navigation-FdnvQSOv.js";import{t as C}from"./button-ELs5xgtQ.js";var w=e(n(),1),T=g(),E={completed:{icon:(0,T.jsx)(a,{className:`h-3.5 w-3.5`}),text:`text-success`,ring:`border-success/35`},in_progress:{icon:(0,T.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}),text:`text-primary`,ring:`border-primary/45`},queued:{icon:(0,T.jsx)(h,{className:`h-3.5 w-3.5`}),text:`text-warning`,ring:`border-warning/35`},blocked:{icon:(0,T.jsx)(v,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/30`},pending:{icon:(0,T.jsx)(o,{className:`h-3.5 w-3.5`}),text:`text-muted-foreground`,ring:`border-border/70`},review:{icon:(0,T.jsx)(_,{className:`h-3.5 w-3.5`}),text:`text-primary`,ring:`border-primary/35`},failed:{icon:(0,T.jsx)(s,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/45`},cancelled:{icon:(0,T.jsx)(p,{className:`h-3.5 w-3.5`}),text:`text-muted-foreground`,ring:`border-border/70`}},D=[`completed`,`in_progress`,`queued`,`blocked`,`pending`,`failed`],O={critical:{labelKey:`activity:depGraph.prioCrit`,cls:`bg-destructive/10 text-destructive`},high:{labelKey:`activity:depGraph.prioHigh`,cls:`bg-destructive/10 text-destructive`},medium:{labelKey:`activity:depGraph.prioMed`,cls:`bg-warning/12 text-warning`},low:{labelKey:`activity:depGraph.prioLow`,cls:`bg-success/12 text-success`}};function k({columns:e,onTaskClick:t}){let{t:n}=i();return e.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:n(`activity:board.emptySpec`)}):(0,T.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,T.jsx)(`h3`,{className:`mb-3 text-sm font-semibold text-foreground`,children:n(`activity:board.depGraphHeading`)}),(0,T.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs`,children:D.map(e=>(0,T.jsxs)(`span`,{className:b(`inline-flex items-center gap-1.5`,E[e].text),children:[E[e].icon,(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:n(`activity:board.status.${e}`)})]},e))}),(0,T.jsx)(`div`,{className:`flex gap-3 overflow-x-auto pb-2`,children:e.map((n,r)=>(0,T.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,T.jsxs)(`div`,{className:`w-60 shrink-0`,children:[(0,T.jsx)(`div`,{className:`mb-2 border-b border-border/60 pb-1 text-center text-xs font-medium uppercase text-muted-foreground`,children:n.label}),(0,T.jsx)(`div`,{className:`space-y-2`,children:n.tasks.map(e=>(0,T.jsx)(A,{task:e,onClick:t},e.id))})]}),r<e.length-1&&(0,T.jsx)(`div`,{className:`flex h-full items-center pt-8 text-muted-foreground/75`,children:(0,T.jsx)(l,{className:`h-5 w-5`})})]},n.label))})]})}function A({task:e,onClick:t}){let n=E[e.displayStatus],r=O[e.priority],{t:a}=i();return(0,T.jsxs)(`button`,{type:`button`,onClick:()=>t?.(e.id),className:b(`w-full rounded-lg border bg-background/55 p-2.5 text-left shadow-sm transition-colors hover:border-primary/35 hover:bg-accent/35`,n.ring),children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsxs)(`span`,{className:b(`inline-flex items-center gap-1.5 text-xs font-medium`,n.text),children:[n.icon,(0,T.jsx)(`span`,{className:`font-mono text-foreground`,children:e.shortId})]}),(0,T.jsx)(`span`,{className:b(`rounded px-1.5 py-0.5 text-[10px] font-medium`,r.cls),children:a(r.labelKey)})]}),(0,T.jsx)(`p`,{className:`mt-1.5 text-xs text-foreground`,children:e.title}),e.deps.length>0&&(0,T.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:[`← `,e.deps.join(`, `)]}),e.agentName&&(0,T.jsxs)(`div`,{className:b(`mt-1.5 inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[10px]`,e.displayStatus===`in_progress`?`bg-primary/10 text-primary`:`bg-muted text-muted-foreground`),title:e.worktreeBranch?a(`activity:board.worktreePrefix`,{branch:e.worktreeBranch}):void 0,children:[e.displayStatus===`in_progress`&&(0,T.jsx)(d,{className:`h-3 w-3 animate-spin`}),(0,T.jsx)(`span`,{children:e.agentName})]})]})}function j(e){return e.columns.map(e=>({name:e.label,description:``,priority:`medium`,estimateHours:e.tasks.length,parallelizable:!1,taskTemplates:e.tasks.map(e=>({title:e.title,description:e.description,type:e.type,priority:e.priority,estimateHours:1}))}))}function M({onClose:e,onRunStarted:n}){let{client:a}=y(),{t:o}=i(),s=x(e=>e.specs),d=x(e=>e.detail),p=x(e=>e.expandedSpecId),h=x(e=>e.setExpanded),[g,_]=(0,w.useState)(`graph`),v=(0,w.useCallback)(e=>{!d||d.specId!==e.id||(a?.send?.({type:`goal.start`,payload:{title:e.title,phases:j(d),autonomous:!0}}),S(`goal`))},[d,a]),E=(0,w.useCallback)(e=>{let t=e.graphId??(d?.specId===e.id?d.graphId:void 0);t?a?.send?.({type:`sdd.run.from_graph`,payload:{graphId:t,worktrees:!0}}):a?.send?.({type:`sdd.run.from_spec`,payload:{specId:e.id,worktrees:!0}}),n?.(),S(`sddhub`)},[d,a,n]);(0,w.useEffect)(()=>{a?.send?.({type:`specs.list`})},[a]);let D=(0,w.useCallback)(e=>{p===e.id?h(null):(h(e.id),a?.send?.({type:`specs.get`,payload:{specId:e.id}}))},[p,h,a]),O=d?.columns.flatMap(e=>e.tasks)??[],A={done:O.filter(e=>e.status===`completed`).length,running:O.filter(e=>e.status===`in_progress`).length,pending:O.filter(e=>e.status===`pending`||e.displayStatus===`queued`).length};return(0,T.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,T.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b bg-card px-4 py-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(u,{className:`h-5 w-5 text-warning`}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-lg font-semibold`,children:o(`activity:specs.heading`)}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o(`activity:specs.subtitle`)})]})]}),(0,T.jsx)(C,{variant:`ghost`,size:`icon`,onClick:e,children:(0,T.jsx)(f,{className:`h-4 w-4`})})]}),(0,T.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4`,children:s.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:o(`activity:specs.empty`,{command:`/sdd`})}):(0,T.jsx)(`div`,{className:`space-y-3`,children:s.map(e=>{let n=p===e.id,i=e.total>0?Math.round(e.completed/e.total*100):0;return(0,T.jsxs)(`div`,{className:`rounded-lg border border-border bg-card/60`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>D(e),className:`flex w-full items-start gap-3 p-4 text-left`,children:[(0,T.jsx)(`span`,{className:`mt-1 text-muted-foreground`,children:n?(0,T.jsx)(t,{className:`h-4 w-4`}):(0,T.jsx)(l,{className:`h-4 w-4`})}),(0,T.jsx)(u,{className:`mt-0.5 h-4 w-4 text-muted-foreground`}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.displayId}),(0,T.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] capitalize text-muted-foreground`,children:e.status})]}),(0,T.jsx)(`h2`,{className:`mt-1 text-base font-semibold`,children:e.title}),(0,T.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,T.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-success transition-all`,style:{width:`${i}%`}})}),(0,T.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[e.completed,`/`,e.total]})]})]})]}),n&&(0,T.jsxs)(`div`,{className:`border-t border-border p-4`,children:[(0,T.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,T.jsxs)(`div`,{className:`text-sm font-medium`,children:[o(`activity:specs.tasks`,{count:d?.total??e.total}),d&&(0,T.jsxs)(`span`,{className:`ml-3 text-xs font-normal text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`text-success`,children:o(`activity:specs.doneCount`,{count:A.done})}),` `,(0,T.jsx)(`span`,{className:`text-primary`,children:o(`activity:specs.runningCount`,{count:A.running})}),` `,(0,T.jsx)(`span`,{children:o(`activity:specs.pendingCount`,{count:A.pending})})]})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>E(e),title:o(`activity:specs.runAsSddTitle`),className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success transition-colors hover:bg-success/25`,children:[(0,T.jsx)(c,{className:`h-3.5 w-3.5`}),` `,o(`activity:specs.runAsSdd`)]}),(0,T.jsxs)(`button`,{type:`button`,disabled:!d||d.specId!==e.id,onClick:()=>v(e),title:o(`activity:specs.runAsGoalTitle`),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning transition-colors hover:bg-warning/25 disabled:opacity-40`,children:[(0,T.jsx)(c,{className:`h-3.5 w-3.5`}),` `,o(`activity:specs.runAsGoal`)]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>_(`list`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,g===`list`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(m,{className:`h-3.5 w-3.5`}),` `,o(`activity:specs.list`)]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>_(`graph`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,g===`graph`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(r,{className:`h-3.5 w-3.5`}),` `,o(`activity:specs.graph`)]})]})]})]}),!d||d.specId!==e.id?(0,T.jsx)(`div`,{className:`flex h-24 items-center justify-center text-sm text-muted-foreground`,children:o(`activity:specs.loadingTasks`)}):g===`graph`?(0,T.jsx)(k,{columns:d.columns}):(0,T.jsx)(`div`,{className:`space-y-1.5`,children:O.map(e=>(0,T.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border border-border bg-card px-3 py-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),(0,T.jsx)(`span`,{className:`flex-1 text-sm`,children:e.title}),(0,T.jsx)(`span`,{className:`text-xs capitalize text-muted-foreground`,children:e.displayStatus.replace(`_`,` `)})]},e.id))})]})]},e.id)})})})]})}export{M as SpecsView};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Bn as t,Ia as n,Ii as r,Ki as i,Li as a,Qi as o,Tn as s,Va as c,Zr as l,ar as u,dt as d,ea as f,ga as p,hr as m,ji as h,lt as g,mn as _,rr as v}from"./vendor-AeHpGMaG.js";import"./i18n-nlW2iAya.js";import{t as y}from"./useWebSocket-B3WtCdii.js";import{t as b}from"./utils-D1fGupR8.js";import{a as x}from"./stores-DxTO5dWX.js";import{r as S}from"./view-navigation-D-afwlSZ.js";import{t as C}from"./button-DvHe5h9X.js";var w=e(c(),1),T=g(),E={completed:{icon:(0,T.jsx)(i,{className:`h-3.5 w-3.5`}),text:`text-success`,ring:`border-success/35`},in_progress:{icon:(0,T.jsx)(u,{className:`h-3.5 w-3.5 animate-spin`}),text:`text-primary`,ring:`border-primary/45`},queued:{icon:(0,T.jsx)(h,{className:`h-3.5 w-3.5`}),text:`text-warning`,ring:`border-warning/35`},blocked:{icon:(0,T.jsx)(v,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/30`},pending:{icon:(0,T.jsx)(r,{className:`h-3.5 w-3.5`}),text:`text-muted-foreground`,ring:`border-border/70`},review:{icon:(0,T.jsx)(_,{className:`h-3.5 w-3.5`}),text:`text-primary`,ring:`border-primary/35`},failed:{icon:(0,T.jsx)(a,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/45`},cancelled:{icon:(0,T.jsx)(p,{className:`h-3.5 w-3.5`}),text:`text-muted-foreground`,ring:`border-border/70`}},D=[`completed`,`in_progress`,`queued`,`blocked`,`pending`,`failed`],O={critical:{labelKey:`activity:depGraph.prioCrit`,cls:`bg-destructive/10 text-destructive`},high:{labelKey:`activity:depGraph.prioHigh`,cls:`bg-destructive/10 text-destructive`},medium:{labelKey:`activity:depGraph.prioMed`,cls:`bg-warning/12 text-warning`},low:{labelKey:`activity:depGraph.prioLow`,cls:`bg-success/12 text-success`}};function k({columns:e,onTaskClick:t}){let{t:r}=n();return e.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:r(`activity:board.emptySpec`)}):(0,T.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,T.jsx)(`h3`,{className:`mb-3 text-sm font-semibold text-foreground`,children:r(`activity:board.depGraphHeading`)}),(0,T.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs`,children:D.map(e=>(0,T.jsxs)(`span`,{className:b(`inline-flex items-center gap-1.5`,E[e].text),children:[E[e].icon,(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:r(`activity:board.status.${e}`)})]},e))}),(0,T.jsx)(`div`,{className:`flex gap-3 overflow-x-auto pb-2`,children:e.map((n,r)=>(0,T.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,T.jsxs)(`div`,{className:`w-60 shrink-0`,children:[(0,T.jsx)(`div`,{className:`mb-2 border-b border-border/60 pb-1 text-center text-xs font-medium uppercase text-muted-foreground`,children:n.label}),(0,T.jsx)(`div`,{className:`space-y-2`,children:n.tasks.map(e=>(0,T.jsx)(A,{task:e,onClick:t},e.id))})]}),r<e.length-1&&(0,T.jsx)(`div`,{className:`flex h-full items-center pt-8 text-muted-foreground/75`,children:(0,T.jsx)(o,{className:`h-5 w-5`})})]},n.label))})]})}function A({task:e,onClick:t}){let r=E[e.displayStatus],i=O[e.priority],{t:a}=n();return(0,T.jsxs)(`button`,{type:`button`,onClick:()=>t?.(e.id),className:b(`w-full rounded-lg border bg-background/55 p-2.5 text-left shadow-sm transition-colors hover:border-primary/35 hover:bg-accent/35`,r.ring),children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsxs)(`span`,{className:b(`inline-flex items-center gap-1.5 text-xs font-medium`,r.text),children:[r.icon,(0,T.jsx)(`span`,{className:`font-mono text-foreground`,children:e.shortId})]}),(0,T.jsx)(`span`,{className:b(`rounded px-1.5 py-0.5 text-[10px] font-medium`,i.cls),children:a(i.labelKey)})]}),(0,T.jsx)(`p`,{className:`mt-1.5 text-xs text-foreground`,children:e.title}),e.deps.length>0&&(0,T.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:[`← `,e.deps.join(`, `)]}),e.agentName&&(0,T.jsxs)(`div`,{className:b(`mt-1.5 inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[10px]`,e.displayStatus===`in_progress`?`bg-primary/10 text-primary`:`bg-muted text-muted-foreground`),title:e.worktreeBranch?a(`activity:board.worktreePrefix`,{branch:e.worktreeBranch}):void 0,children:[e.displayStatus===`in_progress`&&(0,T.jsx)(u,{className:`h-3 w-3 animate-spin`}),(0,T.jsx)(`span`,{children:e.agentName})]})]})}function j(e){return e.columns.map(e=>({name:e.label,description:``,priority:`medium`,estimateHours:e.tasks.length,parallelizable:!1,taskTemplates:e.tasks.map(e=>({title:e.title,description:e.description,type:e.type,priority:e.priority,estimateHours:1}))}))}function M({onClose:e,onRunStarted:r}){let{client:i}=y(),{t:a}=n(),c=x(e=>e.specs),u=x(e=>e.detail),p=x(e=>e.expandedSpecId),h=x(e=>e.setExpanded),[g,_]=(0,w.useState)(`graph`),v=(0,w.useCallback)(e=>{!u||u.specId!==e.id||(i?.send?.({type:`goal.start`,payload:{title:e.title,phases:j(u),autonomous:!0}}),S(`goal`))},[u,i]),E=(0,w.useCallback)(e=>{let t=e.graphId??(u?.specId===e.id?u.graphId:void 0);t?i?.send?.({type:`sdd.run.from_graph`,payload:{graphId:t,worktrees:!0}}):i?.send?.({type:`sdd.run.from_spec`,payload:{specId:e.id,worktrees:!0}}),r?.(),S(`sddhub`)},[u,i,r]);(0,w.useEffect)(()=>{i?.send?.({type:`specs.list`})},[i]);let D=(0,w.useCallback)(e=>{p===e.id?h(null):(h(e.id),i?.send?.({type:`specs.get`,payload:{specId:e.id}}))},[p,h,i]),O=u?.columns.flatMap(e=>e.tasks)??[],A={done:O.filter(e=>e.status===`completed`).length,running:O.filter(e=>e.status===`in_progress`).length,pending:O.filter(e=>e.status===`pending`||e.displayStatus===`queued`).length};return(0,T.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,T.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b bg-card px-4 py-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(l,{className:`h-5 w-5 text-warning`}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-lg font-semibold`,children:a(`activity:specs.heading`)}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a(`activity:specs.subtitle`)})]})]}),(0,T.jsx)(C,{variant:`ghost`,size:`icon`,onClick:e,children:(0,T.jsx)(d,{className:`h-4 w-4`})})]}),(0,T.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4`,children:c.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:a(`activity:specs.empty`,{command:`/sdd`})}):(0,T.jsx)(`div`,{className:`space-y-3`,children:c.map(e=>{let n=p===e.id,r=e.total>0?Math.round(e.completed/e.total*100):0;return(0,T.jsxs)(`div`,{className:`rounded-lg border border-border bg-card/60`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>D(e),className:`flex w-full items-start gap-3 p-4 text-left`,children:[(0,T.jsx)(`span`,{className:`mt-1 text-muted-foreground`,children:n?(0,T.jsx)(f,{className:`h-4 w-4`}):(0,T.jsx)(o,{className:`h-4 w-4`})}),(0,T.jsx)(l,{className:`mt-0.5 h-4 w-4 text-muted-foreground`}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.displayId}),(0,T.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] capitalize text-muted-foreground`,children:e.status})]}),(0,T.jsx)(`h2`,{className:`mt-1 text-base font-semibold`,children:e.title}),(0,T.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,T.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-success transition-all`,style:{width:`${r}%`}})}),(0,T.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[e.completed,`/`,e.total]})]})]})]}),n&&(0,T.jsxs)(`div`,{className:`border-t border-border p-4`,children:[(0,T.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,T.jsxs)(`div`,{className:`text-sm font-medium`,children:[a(`activity:specs.tasks`,{count:u?.total??e.total}),u&&(0,T.jsxs)(`span`,{className:`ml-3 text-xs font-normal text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`text-success`,children:a(`activity:specs.doneCount`,{count:A.done})}),` `,(0,T.jsx)(`span`,{className:`text-primary`,children:a(`activity:specs.runningCount`,{count:A.running})}),` `,(0,T.jsx)(`span`,{children:a(`activity:specs.pendingCount`,{count:A.pending})})]})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>E(e),title:a(`activity:specs.runAsSddTitle`),className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success transition-colors hover:bg-success/25`,children:[(0,T.jsx)(s,{className:`h-3.5 w-3.5`}),` `,a(`activity:specs.runAsSdd`)]}),(0,T.jsxs)(`button`,{type:`button`,disabled:!u||u.specId!==e.id,onClick:()=>v(e),title:a(`activity:specs.runAsGoalTitle`),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning transition-colors hover:bg-warning/25 disabled:opacity-40`,children:[(0,T.jsx)(s,{className:`h-3.5 w-3.5`}),` `,a(`activity:specs.runAsGoal`)]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>_(`list`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,g===`list`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(m,{className:`h-3.5 w-3.5`}),` `,a(`activity:specs.list`)]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>_(`graph`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,g===`graph`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(t,{className:`h-3.5 w-3.5`}),` `,a(`activity:specs.graph`)]})]})]})]}),!u||u.specId!==e.id?(0,T.jsx)(`div`,{className:`flex h-24 items-center justify-center text-sm text-muted-foreground`,children:a(`activity:specs.loadingTasks`)}):g===`graph`?(0,T.jsx)(k,{columns:u.columns}):(0,T.jsx)(`div`,{className:`space-y-1.5`,children:O.map(e=>(0,T.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border border-border bg-card px-3 py-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),(0,T.jsx)(`span`,{className:`flex-1 text-sm`,children:e.title}),(0,T.jsx)(`span`,{className:`text-xs capitalize text-muted-foreground`,children:e.displayStatus.replace(`_`,` `)})]},e.id))})]})]},e.id)})})})]})}export{M as SpecsView};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ai as t,Ba as n,Br as r,Da as i,Fa as a,Ir as o,Jt as s,M as c,Nt as l,Oi as u,Rn as d,Sa as f,Wn as p,Wt as m,_i as ee,an as h,ar as g,ca as _,dt as te,fi as v,hn as y,la as ne,lt as b,ut as x,vn as re,wi as S}from"./vendor-GiKfK4Iw.js";import"./i18n-BvFgJYE2.js";import{t as C}from"./utils-CUCQrODG.js";import{i as w}from"./stores-BATHCuMN.js";import{t as T}from"./button-ELs5xgtQ.js";import{t as E}from"./input-DSTQkMEh.js";import{b as D,x as O}from"./index-BTRQG7C5.js";var k=e(n(),1),A=b(),ie={current:{labelKey:`activity:techStackStatus.current`,badge:`border-success/35 bg-success/10 text-success`,dot:`bg-success`,weight:0},update_available_safe:{labelKey:`activity:techStackStatus.update_available_safe`,badge:`border-info/35 bg-info/10 text-info`,dot:`bg-info`,weight:30},update_available_breaking:{labelKey:`activity:techStackStatus.update_available_breaking`,badge:`border-warning/35 bg-warning/10 text-warning`,dot:`bg-warning`,weight:50},vulnerable:{labelKey:`activity:techStackStatus.vulnerable`,badge:`border-destructive/45 bg-destructive/15 text-destructive`,dot:`bg-destructive`,weight:100},deprecated:{labelKey:`activity:techStackStatus.deprecated`,badge:`border-destructive/35 bg-destructive/10 text-destructive`,dot:`bg-destructive`,weight:70},yanked:{labelKey:`activity:techStackStatus.yanked`,badge:`border-destructive/45 bg-destructive/15 text-destructive`,dot:`bg-destructive`,weight:80},unmaintained_suspected:{labelKey:`activity:techStackStatus.unmaintained_suspected`,badge:`border-warning/35 bg-warning/10 text-warning`,dot:`bg-warning`,weight:60},blocked_by_constraints:{labelKey:`activity:techStackStatus.blocked_by_constraints`,badge:`border-warning/30 bg-warning/5 text-warning`,dot:`bg-warning`,weight:40},private_or_unresolved:{labelKey:`activity:techStackStatus.private_or_unresolved`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:10},local_path:{labelKey:`activity:techStackStatus.local_path`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},git_dependency:{labelKey:`activity:techStackStatus.git_dependency`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},unsupported:{labelKey:`activity:techStackStatus.unsupported`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},unknown:{labelKey:`activity:techStackStatus.unknown`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:20}},ae={labelKey:`activity:techStackStatus.unknown`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:0};function j(e){return ie[e]??ae}var M={npm:{label:`npm / Node.js`,icon:d},python:{label:`Python`,icon:u},rust:{label:`Rust`,icon:s},go:{label:`Go`,icon:y},dotnet:{label:`.NET`,icon:p},php:{label:`PHP`,icon:l},dart:{label:`Dart / Flutter`,icon:S},maven:{label:`Maven`,icon:i},gradle:{label:`Gradle`,icon:ne},ruby:{label:`Ruby`,icon:o},swift:{label:`Swift`,icon:x},elixir:{label:`Elixir`,icon:l},cpp:{label:`C / C++`,icon:t}},oe={labelKey:`activity:techStackStatus.unknown`};function N(e,t){let n=P(e);return n.labelKey?t(n.labelKey):n.label??e}function P(e){return M[e]??oe}function F({ecosystem:e,className:t=`size-3.5 shrink-0`}){let n=P(e);if(!n.icon)return null;let r=n.icon;return(0,A.jsx)(r,{className:t})}function se(e){return j(e.status).weight>=50}var I=[`critical`,`high`,`medium`,`low`,`info`],L={critical:{labelKey:`activity:techStackSeverity.critical`,badge:`border-destructive/45 bg-destructive/15 text-destructive`},high:{labelKey:`activity:techStackSeverity.high`,badge:`border-destructive/35 bg-destructive/10 text-destructive`},medium:{labelKey:`activity:techStackSeverity.medium`,badge:`border-warning/35 bg-warning/10 text-warning`},low:{labelKey:`activity:techStackSeverity.low`,badge:`border-info/35 bg-info/10 text-info`},info:{labelKey:`activity:techStackSeverity.info`,badge:`border-border/70 bg-muted text-muted-foreground`}},R={none:`activity:techStackAction.none`,upgrade_patch:`activity:techStackAction.upgrade_patch`,upgrade_minor:`activity:techStackAction.upgrade_minor`,upgrade_major:`activity:techStackAction.upgrade_major`,replace:`activity:techStackAction.replace`,remove:`activity:techStackAction.remove`,investigate:`activity:techStackAction.investigate`},z={full:{labelKey:`activity:techStackCoverage.full`,badge:`border-success/35 bg-success/10 text-success`,noteKey:void 0},partial:{labelKey:`activity:techStackCoverage.partial`,badge:`border-warning/35 bg-warning/10 text-warning`,noteKey:`activity:techStackCoverage.partialNote`},unsupported:{labelKey:`activity:techStackCoverage.unsupported`,badge:`border-border/70 bg-muted text-muted-foreground`,noteKey:`activity:techStackCoverage.unsupportedNote`}};function B(e){return z[e]??z.unsupported}function V(e){if(!e)return null;let t=/^\D*(\d+)/.exec(e);if(!t?.[1])return null;let n=Number(t[1]);return Number.isFinite(n)?n:null}function H(e){let t=V(e.locked??e.installed??e.requested),n=V(e.latestStable);if(t===null||n===null||n<=t)return{majorsBehind:0,label:null};let r=n-t;return{majorsBehind:r,label:`${r} major${r===1?``:`s`} behind`}}function U(e){return e.locked??e.installed??e.requested??null}function W(e){return e.confidence<1}function G({className:e,children:t}){return(0,A.jsx)(`span`,{className:C(`inline-flex shrink-0 items-center gap-1 border px-1.5 py-0.5 text-[10px] font-medium`,e),children:t})}function K({label:e,value:t,hint:n,tone:r=`default`}){let i={default:`text-foreground`,success:`text-success`,warning:`text-warning`,info:`text-info`,destructive:`text-destructive`}[r];return(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/55 px-3 py-2.5 shadow-[inset_0_1px_0_hsl(var(--foreground)/0.035)]`,children:[(0,A.jsx)(`p`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:e}),(0,A.jsxs)(`div`,{className:`mt-1 flex items-end justify-between gap-2`,children:[(0,A.jsx)(`p`,{className:C(`font-mono text-xl font-bold tabular-nums`,i),children:t}),(0,A.jsx)(`p`,{className:`truncate text-[9px] text-muted-foreground`,children:n})]})]})}function ce({dependency:e,findings:t,deepDive:n,onDeepDive:r,onBack:i,coverage:o}){let{t:s}=a(),c=j(e.status),l=U(e),u=H(e),d=o?B(o).noteKey:void 0;return(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,A.jsxs)(`header`,{className:`shrink-0 border-b border-border/70 bg-card/45 p-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,A.jsx)(T,{variant:`ghost`,size:`icon`,onClick:i,"aria-label":s(`activity:techStack.backToDependencyList`),className:`shrink-0 md:hidden`,children:(0,A.jsx)(f,{className:`size-4`})}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(`h2`,{className:`min-w-0 truncate font-mono text-sm font-bold text-foreground`,children:e.name}),(0,A.jsx)(G,{className:c.badge,children:s(c.labelKey)})]}),(0,A.jsxs)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:[N(e.ecosystem,s),` ·`,` `,e.direct?`direct`:`transitive`,` · `,e.scope,` ·`,` `,e.sourceType,d&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,A.jsx)(`span`,{className:`text-warning`,children:s(d)})]})]})]})]}),(0,A.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-baseline gap-2 font-mono text-xs`,children:[(0,A.jsx)(`span`,{className:`text-foreground`,children:l??`—`}),e.latestStable&&e.latestStable!==l&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,A.jsx)(`span`,{className:`text-info`,children:e.latestStable})]}),u.label&&(0,A.jsxs)(`span`,{className:`text-[10px] text-warning`,children:[`(`,u.label,`)`]})]})]}),(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,A.jsxs)(`dl`,{className:`grid grid-cols-2 gap-px border border-border/70 bg-border/60`,children:[(0,A.jsx)(q,{label:s(`activity:techStack.constraint`),value:e.requested??`—`,mono:!0}),(0,A.jsx)(q,{label:s(`activity:techStack.locked`),value:e.locked??`—`,mono:!0}),(0,A.jsx)(q,{label:s(`activity:techStack.latestStable`),value:e.latestStable??`—`,mono:!0}),(0,A.jsx)(q,{label:s(`activity:techStack.license`),value:e.license??`—`}),e.wanted&&(0,A.jsx)(q,{label:s(`activity:techStack.wanted`),value:e.wanted,mono:!0}),e.resolvable&&(0,A.jsx)(q,{label:s(`activity:techStack.resolvable`),value:e.resolvable,mono:!0}),e.purl&&(0,A.jsx)(q,{label:s(`activity:techStack.purl`),value:e.purl,mono:!0}),(0,A.jsx)(q,{label:s(`activity:techStack.registryFlags`),value:[e.deprecated&&`deprecated`,e.yanked&&`yanked`].filter(Boolean).join(`, `)||`none`})]}),(0,A.jsxs)(`section`,{className:`mt-4`,children:[(0,A.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-center justify-between gap-2`,children:[(0,A.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:s(`activity:techStack.findings`)}),(0,A.jsxs)(T,{variant:`outline`,size:`sm`,onClick:()=>r(e),disabled:n.status===`loading`,className:`h-7 text-[10px]`,children:[n.status===`loading`?(0,A.jsx)(g,{className:`size-3 animate-spin`}):(0,A.jsx)(m,{className:`size-3`}),n.status===`loading`?`Researching…`:`Deep dive`]})]}),n.status===`error`&&n.error&&(0,A.jsx)(`p`,{role:`alert`,className:`mb-1.5 text-[10px] text-destructive`,children:n.error}),t.length===0?(0,A.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:s(`activity:techStack.nothingFlaggedRunADeepDive`)}):(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.map(e=>(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(G,{className:L[e.severity].badge,children:s(L[e.severity].labelKey)}),(0,A.jsx)(G,{className:`border-border/70 bg-muted text-muted-foreground`,children:R[e.action]?s(R[e.action]):e.action}),W(e)&&(0,A.jsxs)(G,{className:`border-info/35 bg-info/10 text-info`,children:[(0,A.jsx)(m,{className:`size-2.5`}),`AI · `,Math.round(e.confidence*100),`%`]})]}),(0,A.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-muted-foreground`,children:e.rationale}),e.breakingRisk&&(0,A.jsx)(`p`,{className:`mt-1 border-l-2 border-warning/40 pl-2 text-[10px] leading-relaxed text-warning`,children:e.breakingRisk})]},e.id))})]}),(0,A.jsxs)(`section`,{className:`mt-4`,children:[(0,A.jsx)(`h3`,{className:`mb-1.5 text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:s(`activity:techStack.evidence`)}),e.evidence.length===0?(0,A.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:s(`activity:techStack.noEvidenceRecorded`)}):(0,A.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.evidence.map((t,n)=>(0,A.jsxs)(`li`,{className:`border border-border/70 bg-card/40 p-2`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(G,{className:`border-border/70 bg-muted text-muted-foreground`,children:t.kind}),(0,A.jsx)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(t.retrievedAt).toLocaleString()})]}),t.source.startsWith(`http`)?(0,A.jsxs)(`a`,{href:t.source,target:`_blank`,rel:`noreferrer noopener`,className:`mt-1 flex min-w-0 items-center gap-1 truncate text-[10px] text-info underline-offset-2 hover:underline`,children:[(0,A.jsx)(`span`,{className:`truncate`,children:t.source}),(0,A.jsx)(v,{className:`size-2.5 shrink-0`})]}):(0,A.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-muted-foreground`,children:t.source}),t.detail&&(0,A.jsx)(`p`,{className:`mt-0.5 text-[10px] leading-relaxed text-muted-foreground`,children:t.detail})]},`${e.id}-evidence-${n}`))})]})]})]})}function q({label:e,value:t,mono:n}){return(0,A.jsxs)(`div`,{className:`bg-card/55 px-2.5 py-1.5`,children:[(0,A.jsx)(`dt`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:e}),(0,A.jsx)(`dd`,{className:C(`mt-0.5 truncate text-[11px] text-foreground`,n&&`font-mono`),children:t})]})}var J=`grid grid-cols-[minmax(0,2.2fr)_minmax(0,1.6fr)_minmax(0,1.1fr)] gap-2`;function le({dependencies:e,selectedId:t,hasDependencies:n,coverageByWorkspaceId:r,onSelect:i}){let{t:o}=a(),s=O(e,30);return e.length===0?(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,A.jsx)(`p`,{className:`max-w-xs text-xs text-muted-foreground`,children:n?`No dependencies match the current filters.`:`No dependencies inventoried yet. Run a scan to populate the inventory.`})}):(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,A.jsxs)(`div`,{className:C(J,`shrink-0 border-b border-border/70 bg-card/45 px-3 py-1.5 text-[9px] font-bold uppercase tracking-[0.14em] text-muted-foreground`),children:[(0,A.jsx)(`span`,{children:o(`activity:techStack.package`)}),(0,A.jsx)(`span`,{children:o(`activity:techStack.installedLatest`)}),(0,A.jsx)(`span`,{children:o(`activity:techStack.status`)})]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,A.jsx)(c,{className:`h-full`,"aria-label":o(`activity:techStack.dependencies`),children:s.pageItems.map(e=>(0,A.jsx)(Y,{dependency:e,selected:e.id===t,coverage:r?.get(e.workspaceId),onSelect:i},e.id))})}),(0,A.jsx)(D,{page:s.page,pageSize:s.pageSize,totalItems:s.totalItems,onPageChange:s.setPage,itemLabel:`dependencies`})]})}function Y({dependency:e,selected:t,coverage:n,onSelect:r}){let{t:i}=a(),o=j(e.status),s=U(e),c=H(e),l=n?B(n).noteKey:void 0;return(0,A.jsxs)(`button`,{type:`button`,onClick:()=>r(e),"aria-current":t,className:C(J,`w-full items-center border-b border-border/40 px-3 py-2 text-left transition-colors hover:bg-accent/40`,t&&`bg-accent/60`),children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,A.jsx)(`span`,{className:C(`size-1.5 shrink-0`,o.dot),"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`truncate font-mono text-xs text-foreground`,children:e.name})]}),(0,A.jsxs)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:[(0,A.jsx)(F,{ecosystem:e.ecosystem,className:`mr-0.5 inline-block size-3 align-text-bottom`}),N(e.ecosystem,i),` · `,e.direct?`direct`:`transitive`,` · `,e.scope,l&&(0,A.jsxs)(A.Fragment,{children:[` · `,(0,A.jsx)(`span`,{className:`text-warning`,children:i(l)})]})]})]}),(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-1.5 font-mono text-[11px]`,children:[(0,A.jsx)(`span`,{className:`truncate text-foreground`,children:s??`—`}),e.latestStable&&e.latestStable!==s&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`→`}),(0,A.jsx)(`span`,{className:`truncate text-info`,children:e.latestStable})]})]}),c.label?(0,A.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-warning`,children:c.label}):e.requested&&(0,A.jsx)(`p`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:e.requested})]}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,A.jsx)(G,{className:o.badge,children:i(o.labelKey)}),e.deprecated&&(0,A.jsx)(G,{className:`border-destructive/35 bg-destructive/10 text-destructive`,children:`dep`}),e.yanked&&(0,A.jsx)(G,{className:`border-destructive/45 bg-destructive/15 text-destructive`,children:`yank`})]})]})}function ue({findings:e,dependenciesById:t,onSelectDependency:n}){let{t:r}=a(),i=O(e,20);return e.length===0?(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,A.jsxs)(`p`,{className:`max-w-sm text-xs text-muted-foreground`,children:[r(`activity:techStack.noFindingsRun`),` `,(0,A.jsx)(`span`,{className:`font-mono text-foreground`,children:r(`activity:techStack.analyze`)}),` `,r(`activity:techStack.toCheckVersionsAndAdvisoriesAgainst`)]})}):(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,A.jsx)(`div`,{className:`flex flex-col gap-4`,children:I.map(e=>[e,i.pageItems.filter(t=>t.severity===e)]).filter(([,e])=>e.length>0).map(([e,i])=>(0,A.jsxs)(`section`,{children:[(0,A.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2`,children:[(0,A.jsx)(G,{className:L[e].badge,children:r(L[e].labelKey)}),(0,A.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums text-muted-foreground`,children:i.length})]}),(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:i.map(e=>(0,A.jsx)(X,{finding:e,dependency:t.get(e.dependencyId),onSelectDependency:n},e.id))})]},e))})}),(0,A.jsx)(D,{page:i.page,pageSize:i.pageSize,totalItems:i.totalItems,onPageChange:i.setPage,itemLabel:`findings`})]})}function X({finding:e,dependency:t,onSelectDependency:n}){let{t:r}=a(),i=W(e);return(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2.5`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>n(e.dependencyId),className:`min-w-0 truncate font-mono text-xs text-foreground underline-offset-2 hover:underline`,children:t?.name??e.dependencyId}),(0,A.jsx)(G,{className:`border-border/70 bg-muted text-muted-foreground`,children:R[e.action]?r(R[e.action]):e.action}),i&&(0,A.jsxs)(G,{className:`border-info/35 bg-info/10 text-info`,children:[(0,A.jsx)(m,{className:`size-2.5`}),`AI · `,Math.round(e.confidence*100),`%`]})]}),(0,A.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-muted-foreground`,children:e.rationale}),e.breakingRisk&&(0,A.jsx)(`p`,{className:`mt-1 border-l-2 border-warning/40 pl-2 text-[10px] leading-relaxed text-warning`,children:e.breakingRisk}),e.evidence.length>0&&(0,A.jsx)(`ul`,{className:C(`mt-1.5 flex flex-col gap-0.5`),children:e.evidence.slice(0,4).map((t,n)=>(0,A.jsx)(`li`,{className:`min-w-0 truncate text-[10px]`,children:t.source.startsWith(`http`)?(0,A.jsx)(`a`,{href:t.source,target:`_blank`,rel:`noreferrer noopener`,className:`text-info underline-offset-2 hover:underline`,children:t.detail??t.source}):(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:t.detail??t.source})},`${e.id}-${n}`))})]})}function de({searchQuery:e,ecosystemFilter:t,statusFilter:n,directOnly:i,sort:o,hasFilters:s,ecosystems:c,statuses:l,visibleCount:u,totalCount:d,onSearchChange:f,onEcosystemFilterChange:p,onStatusFilterChange:m,onToggleDirectOnly:ee,onSortChange:g,onClearFilters:_}){let{t:v}=a();return(0,A.jsxs)(`div`,{className:`shrink-0 space-y-2 border-b border-border/70 bg-card/45 p-3`,children:[(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[(0,A.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,A.jsx)(h,{className:`pointer-events-none absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,A.jsx)(E,{"aria-label":v(`activity:techStack.searchDependencies`),value:e,onChange:e=>f(e.target.value),placeholder:v(`activity:techStack.searchByPackageName`),className:`h-10 min-w-0 bg-background pl-9 pr-8 text-xs`}),e&&(0,A.jsx)(`button`,{type:`button`,"aria-label":v(`activity:techStack.clearSearch`),onClick:()=>f(``),className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground`,children:(0,A.jsx)(te,{className:`size-3.5`})})]}),(0,A.jsx)(T,{variant:i?`default`:`outline`,size:`sm`,onClick:ee,"aria-pressed":i,title:v(`activity:techStack.showOnlyDependenciesThisProjectDeclaresItself`),className:`shrink-0`,children:v(`activity:techStack.directOnly`)}),s&&(0,A.jsx)(T,{variant:`ghost`,size:`icon`,onClick:_,"aria-label":v(`activity:techStack.clearAllFilters`),title:v(`activity:techStack.clearAllFilters`),className:`shrink-0`,children:(0,A.jsx)(r,{className:`size-4`})})]}),(0,A.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-ecosystem-filter`,children:v(`activity:techStack.filterByEcosystem`)}),(0,A.jsxs)(`select`,{id:`techstack-ecosystem-filter`,value:t,onChange:e=>p(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,A.jsx)(`option`,{value:`all`,children:v(`activity:techStack.allEcosystems`)}),c.map(([e,t])=>(0,A.jsxs)(`option`,{value:e,children:[N(e,v),` · `,t]},e))]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-status-filter`,children:v(`activity:techStack.filterByStatus`)}),(0,A.jsxs)(`select`,{id:`techstack-status-filter`,value:n,onChange:e=>m(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,A.jsx)(`option`,{value:`all`,children:v(`activity:techStack.allStatuses`)}),l.map(([e,t])=>(0,A.jsxs)(`option`,{value:e,children:[v(j(e).labelKey),` · `,t]},e))]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-sort`,children:v(`activity:techStack.sortDependencies`)}),(0,A.jsxs)(`select`,{id:`techstack-sort`,value:o,onChange:e=>g(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,A.jsx)(`option`,{value:`attention`,children:v(`activity:techStack.sortNeedsAttention`)}),(0,A.jsx)(`option`,{value:`drift`,children:v(`activity:techStack.sortMostOutOfDate`)}),(0,A.jsx)(`option`,{value:`name`,children:v(`activity:techStack.sortName`)})]})]})]}),(0,A.jsx)(`p`,{className:C(`text-[10px] text-muted-foreground`,s&&`text-info`),children:u===d?`${d} dependencies`:`${u} of ${d} dependencies`})]})}var fe=[{id:`dependencies`,labelKey:`activity:techStack.tabDependencies`},{id:`findings`,labelKey:`activity:techStack.tabFindings`},{id:`workspaces`,labelKey:`activity:techStack.tabWorkspaces`},{id:`trends`,labelKey:`activity:techStack.tabTrends`},{id:`remediation`,labelKey:`activity:techStack.tabRemediation`}],Z=new Set([`npm`,`python`,`rust`,`go`,`php`,`dotnet`]);function pe(){let{t:e}=a(),t=w(e=>e.snapshot),n=w(e=>e.stale),r=w(e=>e.loading),i=w(e=>e.error),o=w(e=>e.activeJob),[s,c]=(0,k.useState)(`dependencies`),[l,u]=(0,k.useState)(``),[d,f]=(0,k.useState)(`all`),[p,h]=(0,k.useState)(`all`),[_,v]=(0,k.useState)(!1),[y,ne]=(0,k.useState)(`attention`),[b,x]=(0,k.useState)(null),[S,E]=(0,k.useState)([]),[D,O]=(0,k.useState)({status:`idle`,error:null}),[ie,ae]=(0,k.useState)(null),[M,oe]=(0,k.useState)(null),[N,P]=(0,k.useState)(new Set),[F,I]=(0,k.useState)(!1),L=(0,k.useCallback)(async()=>{let e=w.getState();e.setLoading(!0),e.setError(null);try{let t=await fetch(`/api/techstack/snapshot`);if(t.status===404){e.setSnapshot(null,!1);return}if(!t.ok)throw Error(`HTTP ${t.status}: ${t.statusText}`);let n=await t.json();e.setSnapshot(n.snapshot,n.stale)}catch(t){e.setError(t instanceof Error?t.message:String(t))}},[]),R=(0,k.useCallback)(async e=>{let t=w.getState();t.setLoading(!0),t.setError(null);try{let n=await fetch(`/api/techstack/${e}`,{method:`POST`}),r=await n.json();if(!n.ok||!r.jobId)throw Error(r.error??`HTTP ${n.status}: ${n.statusText}`);t.jobStarted(r.jobId,e)}catch(e){t.setError(e instanceof Error?e.message:String(e))}},[]),z=(0,k.useCallback)(async()=>{let e=w.getState().activeJob;if(e)try{let t=await fetch(`/api/techstack/jobs/${encodeURIComponent(e.id)}/cancel`,{method:`POST`});if(!t.ok)throw Error(`HTTP ${t.status}: ${t.statusText}`);w.getState().jobCancelled(e.id)}catch(e){w.getState().setError(e instanceof Error?e.message:String(e))}},[]),B=(0,k.useCallback)(async e=>{O({status:`loading`,error:null});try{let t=await fetch(`/api/techstack/deps/${encodeURIComponent(e.id)}/research`,{method:`POST`}),n=await t.json();if(!t.ok)throw Error(n.error??`HTTP ${t.status}`);E(n.findings??[]),O({status:`idle`,error:null})}catch(e){O({status:`error`,error:e instanceof Error?e.message:String(e)})}},[]);(0,k.useEffect)(()=>{L()},[L]),(0,k.useEffect)(()=>{s!==`trends`&&s!==`remediation`||fetch(`/api/techstack/${s===`trends`?`trends`:`remediation`}`).then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);t.trend&&ae(t.trend),t.plan&&oe(t.plan)}).catch(e=>w.getState().setError(e instanceof Error?e.message:String(e)))},[s,t?.id]);let V=(0,k.useCallback)(async()=>{if(N.size!==0){I(!0);try{let e=await fetch(`/api/techstack/remediation/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({approvedItems:[...N]})}),t=await e.json();if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);P(new Set),await R(`inventory`)}catch(e){w.getState().setError(e instanceof Error?e.message:String(e))}finally{I(!1)}}},[N,R]);(0,k.useEffect)(()=>{E([]),O({status:`idle`,error:null})},[t?.id]);let U=(0,k.useMemo)(()=>t?.dependencies??[],[t]),W=(0,k.useMemo)(()=>t?.findings??[],[t]),G=(0,k.useMemo)(()=>new Map(U.map(e=>[e.id,e])),[U]),q=(0,k.useMemo)(()=>ve(U.map(e=>e.ecosystem)),[U]),J=(0,k.useMemo)(()=>ve(U.map(e=>e.status)),[U]),Y=(0,k.useMemo)(()=>new Map(t?.workspaces.map(e=>[e.id,e.coverage])??[]),[t]),X=(0,k.useMemo)(()=>{let e=l.trim().toLowerCase(),t=[...U.filter(t=>!(e&&!t.name.toLowerCase().includes(e)||d!==`all`&&t.ecosystem!==d||p!==`all`&&t.status!==p||_&&!t.direct))];return y===`name`?t.sort((e,t)=>e.name.localeCompare(t.name)):y===`drift`?t.sort((e,t)=>H(t).majorsBehind-H(e).majorsBehind||e.name.localeCompare(t.name)):t.sort((e,t)=>j(t.status).weight-j(e.status).weight||Number(t.direct)-Number(e.direct)||e.name.localeCompare(t.name)),t},[U,l,d,p,_,y]),Z=b?G.get(b):void 0,pe=(0,k.useMemo)(()=>Z?[...W.filter(e=>e.dependencyId===Z.id),...S.filter(e=>e.dependencyId===Z.id)]:[],[W,S,Z]),be=(0,k.useMemo)(()=>U.filter(se).length,[U]),xe=(0,k.useMemo)(()=>U.filter(e=>H(e).majorsBehind>0).length,[U]),Se=(0,k.useMemo)(()=>U.filter(e=>e.status===`vulnerable`).length,[U]),Ce=l.trim()!==``||d!==`all`||p!==`all`||_,we=(0,k.useCallback)(()=>{u(``),f(`all`),h(`all`),v(!1)},[]),$=!!(o&&![`completed`,`failed`,`cancelled`].includes(o.status)),Te=(0,k.useCallback)(e=>{x(e),c(`dependencies`)},[]);return(0,A.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,A.jsx)(`header`,{className:`shrink-0 border-b border-border/70 px-4 py-3`,children:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`h1`,{className:`text-base font-bold sm:text-lg`,children:e(`activity:techStack.techstack`)}),(0,A.jsx)(`span`,{className:`border border-info/35 bg-info/10 px-2 py-0.5 font-mono text-[9px] font-bold uppercase text-info`,children:t?`${t.workspaces.length} workspaces`:`no scan yet`}),n&&(0,A.jsx)(`span`,{className:`border border-warning/35 bg-warning/10 px-2 py-0.5 font-mono text-[9px] font-bold uppercase text-warning`,children:e(`activity:techStack.staleGt24h`)})]}),(0,A.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground sm:text-xs`,children:t?`${t.targetRoot} · scanned ${new Date(t.createdAt).toLocaleString()}`:`Scan the open project to inventory its dependencies.`})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsxs)(T,{variant:`outline`,size:`sm`,onClick:()=>void R(`inventory`),disabled:$,title:e(`activity:techStack.offlineReReadManifestsAndLockfiles`),children:[(0,A.jsx)(re,{className:C(`size-3.5`,$&&`animate-spin`)}),(0,A.jsx)(`span`,{className:`hidden sm:inline`,children:e(`activity:techStack.refresh`)})]}),(0,A.jsxs)(T,{size:`sm`,onClick:()=>void R(`analyze`),disabled:$,title:e(`activity:techStack.checkRegistriesAndAdvisoriesThenInterpretTheResultsWithTheModel`),children:[(0,A.jsx)(m,{className:`size-3.5`}),e(`activity:techStack.analyze`)]}),$&&(0,A.jsx)(T,{variant:`ghost`,size:`icon`,onClick:()=>void z(),"aria-label":e(`activity:techStack.cancelJob`),children:(0,A.jsx)(te,{className:`size-4`})}),(0,A.jsx)(T,{variant:`ghost`,size:`icon`,onClick:()=>t&&ye(t),disabled:!t,"aria-label":e(`activity:techStack.exportSnapshotAsJson`),title:e(`activity:techStack.exportSnapshotAsJson`),children:(0,A.jsx)(ee,{className:`size-4`})})]})]})}),t&&(0,A.jsxs)(`div`,{className:`grid shrink-0 grid-cols-2 gap-px border-b border-border/70 bg-border/60 sm:grid-cols-4`,children:[(0,A.jsx)(K,{label:e(`activity:techStack.dependencies`),value:U.length,hint:`${X.length} visible`}),(0,A.jsx)(K,{label:e(`activity:techStack.outdated`),value:xe,hint:e(`activity:techStack.majorsBehind`),tone:xe>0?`warning`:`success`}),(0,A.jsx)(K,{label:e(`activity:techStack.vulnerable`),value:Se,hint:e(`activity:techStack.knownAdvisories`),tone:Se>0?`destructive`:`success`}),(0,A.jsx)(K,{label:e(`activity:techStack.findings`),value:W.length,hint:`${be} need attention`,tone:W.length>0?`info`:`default`})]}),($||i)&&(0,A.jsxs)(`div`,{className:`shrink-0 border-b border-border/70 px-4 py-2`,"aria-live":`polite`,children:[$&&o&&(0,A.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 text-xs text-info`,children:[(0,A.jsx)(g,{className:`size-3.5 animate-spin`}),(0,A.jsx)(`span`,{className:`font-mono`,children:o.status}),o.progress&&(0,A.jsxs)(`span`,{className:`text-muted-foreground`,children:[o.progress.completed,`/`,o.progress.total]})]}),i&&(0,A.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-2 text-xs text-destructive`,children:[(0,A.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:i}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>void L(),className:`underline`,children:e(`activity:techStack.retry`)})]})]}),r&&!t?(0,A.jsx)(Q,{}):t?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`nav`,{className:`flex shrink-0 gap-1 border-b border-border/70 px-2`,children:fe.map(t=>(0,A.jsxs)(`button`,{type:`button`,onClick:()=>c(t.id),"aria-current":s===t.id,className:C(`border-b-2 px-3 py-2 text-xs font-medium transition-colors`,s===t.id?`border-primary text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:[e(t.labelKey),t.id===`findings`&&W.length>0&&(0,A.jsx)(`span`,{className:`ml-1.5 font-mono text-[10px] tabular-nums text-muted-foreground`,children:W.length})]},t.id))}),s===`dependencies`&&(0,A.jsxs)(`div`,{className:`grid min-h-0 flex-1 md:grid-cols-[minmax(340px,1fr)_minmax(0,1.15fr)]`,children:[(0,A.jsxs)(`section`,{className:C(`min-h-0 border-r border-border/70`,Z?`hidden md:flex md:flex-col`:`flex flex-col`),"aria-label":e(`activity:techStack.dependencyList`),children:[(0,A.jsx)(de,{searchQuery:l,ecosystemFilter:d,statusFilter:p,directOnly:_,sort:y,hasFilters:Ce,ecosystems:q,statuses:J,visibleCount:X.length,totalCount:U.length,onSearchChange:u,onEcosystemFilterChange:f,onStatusFilterChange:h,onToggleDirectOnly:()=>v(e=>!e),onSortChange:ne,onClearFilters:we}),(0,A.jsx)(le,{dependencies:X,selectedId:b,hasDependencies:U.length>0,coverageByWorkspaceId:Y,onSelect:e=>x(e.id)})]}),(0,A.jsx)(`section`,{className:C(`min-h-0`,Z?`flex flex-col`:`hidden md:flex md:flex-col`),"aria-label":e(`activity:techStack.dependencyDetail`),children:Z?(0,A.jsx)(ce,{dependency:Z,findings:pe,deepDive:D,onDeepDive:B,onBack:()=>x(null),coverage:Y.get(Z.workspaceId)}):(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,A.jsx)(`p`,{className:`max-w-xs text-xs text-muted-foreground`,children:e(`activity:techStack.selectADependencyToSeeIts`)})})})]}),s===`findings`&&(0,A.jsx)(ue,{findings:W,dependenciesById:G,onSelectDependency:Te}),s===`workspaces`&&(0,A.jsx)(ge,{snapshot:t}),s===`trends`&&(0,A.jsx)(me,{trend:ie}),s===`remediation`&&(0,A.jsx)(he,{plan:M,approved:N,applying:F,onToggle:e=>P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onApply:()=>void V()})]}):(0,A.jsx)(_e,{onScan:()=>void R(`inventory`),disabled:$})]})}function me({trend:e}){return e?(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,A.jsxs)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:[e.snapshots,` snapshots`,e.vulnerabilityHalfLifeMs===void 0?``:` · vulnerability half-life ${(e.vulnerabilityHalfLifeMs/864e5).toFixed(1)} days`]}),(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.points.map(e=>(0,A.jsxs)(`div`,{className:`grid grid-cols-4 border border-border/70 bg-card/40 p-2 text-xs`,children:[(0,A.jsx)(`span`,{children:new Date(e.createdAt).toLocaleDateString()}),(0,A.jsxs)(`span`,{children:[e.dependencies,` deps`]}),(0,A.jsxs)(`span`,{className:`text-warning`,children:[e.outdated,` outdated`]}),(0,A.jsxs)(`span`,{className:`text-destructive`,children:[e.vulnerable,` vulnerable`]})]},e.snapshotId))})]}):(0,A.jsx)(Q,{})}function he({plan:e,approved:t,applying:n,onToggle:r,onApply:i}){let{t:o}=a();return e?(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,A.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.warning}),(0,A.jsxs)(T,{size:`sm`,disabled:t.size===0||n,onClick:i,children:[n&&(0,A.jsx)(g,{className:`size-3.5 animate-spin`}),`Apply `,t.size>0?t.size:``]})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e.items.map(e=>{let n=`${e.workspaceId}:${e.ecosystem}:${e.dependencyName}:${e.action}`,i=e.action===`replace`||e.action===`investigate`||!Z.has(e.ecosystem);return(0,A.jsxs)(`label`,{className:C(`flex gap-3 border border-border/70 bg-card/40 p-2.5`,i?`cursor-not-allowed opacity-65`:`cursor-pointer`),children:[(0,A.jsx)(`input`,{type:`checkbox`,disabled:i,checked:t.has(n),onChange:()=>r(n)}),(0,A.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`span`,{className:`block font-mono text-xs`,children:[e.dependencyName,` · `,e.action]}),(0,A.jsxs)(`span`,{className:`block text-[10px] text-muted-foreground`,children:[e.currentVersion??`?`,` → `,e.targetVersion??`latest`,` · `,e.rationale]}),i&&(0,A.jsx)(`span`,{className:`block text-[10px] text-warning`,children:o(`activity:techStack.requiresAManualPackageChoice`)})]})]},n)}),e.items.length===0&&(0,A.jsx)(`p`,{className:`p-8 text-center text-xs text-muted-foreground`,children:o(`activity:techStack.noRemediationNeeded`)})]})]}):(0,A.jsx)(Q,{})}function ge({snapshot:e}){let{t}=a(),n=(0,k.useMemo)(()=>{let t=new Map;for(let n of e.dependencies)t.set(n.workspaceId,(t.get(n.workspaceId)??0)+1);return t},[e]);return e.workspaces.length===0?(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`activity:techStack.noWorkspacesDetected`)})}):(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.workspaces.map(e=>{let r=z[e.coverage];return(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2.5`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{className:`truncate font-mono text-xs text-foreground`,children:e.relativeRoot}),(0,A.jsxs)(`p`,{className:`mt-0.5 flex items-center gap-1 truncate text-[10px] text-muted-foreground`,children:[(0,A.jsx)(F,{ecosystem:e.ecosystem}),(0,A.jsx)(`span`,{children:N(e.ecosystem,t)}),e.packageManager?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,A.jsx)(`span`,{children:e.packageManager})]}):null,(0,A.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,A.jsxs)(`span`,{children:[n.get(e.id)??0,` deps`]})]})]}),(0,A.jsx)(`span`,{className:C(`shrink-0 border px-1.5 py-0.5 text-[10px] font-medium`,r.badge),children:t(r.labelKey)})]}),e.manifests.length>0&&(0,A.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:e.manifests.map(e=>(0,A.jsx)(`span`,{className:`border border-border/70 bg-background/45 px-1.5 py-0.5 font-mono text-[9px] text-muted-foreground`,children:e.split(/[/\\]/).pop()},e))})]},e.id)})})})}function Q(){let{t:e}=a();return(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,A.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,A.jsx)(g,{className:`size-5 animate-spin text-muted-foreground`}),(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`activity:techStack.loadingSnapshot`)})]})})}function _e({onScan:e,disabled:t}){let{t:n}=a(),r=(0,k.useMemo)(()=>Object.values(M).map(e=>e.label??``).filter(Boolean).join(`, `),[]);return(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,A.jsxs)(`div`,{className:`flex max-w-md flex-col items-center gap-3 text-center`,children:[(0,A.jsx)(`div`,{className:`flex size-14 items-center justify-center border border-info/25 bg-info/5 text-info`,children:(0,A.jsx)(_,{className:`size-6`})}),(0,A.jsx)(`h2`,{className:`text-sm font-semibold`,children:n(`activity:techStack.noInventoryYet`)}),(0,A.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[`TechStack reads every manifest and lockfile in the open project — `,r,` — and compares what you have against the upstream registries.`]}),(0,A.jsxs)(T,{size:`sm`,onClick:e,disabled:t,children:[(0,A.jsx)(re,{className:C(`size-3.5`,t&&`animate-spin`)}),n(`activity:techStack.scanThisProject`)]})]})})}function ve(e){let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return[...t.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))}function ye(e){let t=new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`techstack.json`,r.click(),URL.revokeObjectURL(n)}export{pe as TechStackView};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ai as t,Br as n,Ca as r,Ia as i,Ir as a,Jt as o,M as s,Nt as c,Oa as l,Oi as u,Rn as d,Va as f,Wn as p,Wt as m,_i as ee,an as h,ar as g,dt as te,fi as _,hn as v,la as y,lt as ne,ua as b,ut as x,vn as re,wi as S}from"./vendor-AeHpGMaG.js";import"./i18n-nlW2iAya.js";import{t as C}from"./utils-D1fGupR8.js";import{i as w}from"./stores-DxTO5dWX.js";import{t as T}from"./button-DvHe5h9X.js";import{t as E}from"./input-oJ0Gehqp.js";import{b as D,x as O}from"./index-hNmvVlqt.js";var k=e(f(),1),A=ne(),ie={current:{labelKey:`activity:techStackStatus.current`,badge:`border-success/35 bg-success/10 text-success`,dot:`bg-success`,weight:0},update_available_safe:{labelKey:`activity:techStackStatus.update_available_safe`,badge:`border-info/35 bg-info/10 text-info`,dot:`bg-info`,weight:30},update_available_breaking:{labelKey:`activity:techStackStatus.update_available_breaking`,badge:`border-warning/35 bg-warning/10 text-warning`,dot:`bg-warning`,weight:50},vulnerable:{labelKey:`activity:techStackStatus.vulnerable`,badge:`border-destructive/45 bg-destructive/15 text-destructive`,dot:`bg-destructive`,weight:100},deprecated:{labelKey:`activity:techStackStatus.deprecated`,badge:`border-destructive/35 bg-destructive/10 text-destructive`,dot:`bg-destructive`,weight:70},yanked:{labelKey:`activity:techStackStatus.yanked`,badge:`border-destructive/45 bg-destructive/15 text-destructive`,dot:`bg-destructive`,weight:80},unmaintained_suspected:{labelKey:`activity:techStackStatus.unmaintained_suspected`,badge:`border-warning/35 bg-warning/10 text-warning`,dot:`bg-warning`,weight:60},blocked_by_constraints:{labelKey:`activity:techStackStatus.blocked_by_constraints`,badge:`border-warning/30 bg-warning/5 text-warning`,dot:`bg-warning`,weight:40},private_or_unresolved:{labelKey:`activity:techStackStatus.private_or_unresolved`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:10},local_path:{labelKey:`activity:techStackStatus.local_path`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},git_dependency:{labelKey:`activity:techStackStatus.git_dependency`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},unsupported:{labelKey:`activity:techStackStatus.unsupported`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},unknown:{labelKey:`activity:techStackStatus.unknown`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:20}},ae={labelKey:`activity:techStackStatus.unknown`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:0};function j(e){return ie[e]??ae}var M={npm:{label:`npm / Node.js`,icon:d},python:{label:`Python`,icon:u},rust:{label:`Rust`,icon:o},go:{label:`Go`,icon:v},dotnet:{label:`.NET`,icon:p},php:{label:`PHP`,icon:c},dart:{label:`Dart / Flutter`,icon:S},maven:{label:`Maven`,icon:l},gradle:{label:`Gradle`,icon:b},ruby:{label:`Ruby`,icon:a},swift:{label:`Swift`,icon:x},elixir:{label:`Elixir`,icon:c},cpp:{label:`C / C++`,icon:t}},oe={labelKey:`activity:techStackStatus.unknown`};function N(e,t){let n=P(e);return n.labelKey?t(n.labelKey):n.label??e}function P(e){return M[e]??oe}function F({ecosystem:e,className:t=`size-3.5 shrink-0`}){let n=P(e);if(!n.icon)return null;let r=n.icon;return(0,A.jsx)(r,{className:t})}function se(e){return j(e.status).weight>=50}var I=[`critical`,`high`,`medium`,`low`,`info`],L={critical:{labelKey:`activity:techStackSeverity.critical`,badge:`border-destructive/45 bg-destructive/15 text-destructive`},high:{labelKey:`activity:techStackSeverity.high`,badge:`border-destructive/35 bg-destructive/10 text-destructive`},medium:{labelKey:`activity:techStackSeverity.medium`,badge:`border-warning/35 bg-warning/10 text-warning`},low:{labelKey:`activity:techStackSeverity.low`,badge:`border-info/35 bg-info/10 text-info`},info:{labelKey:`activity:techStackSeverity.info`,badge:`border-border/70 bg-muted text-muted-foreground`}},R={none:`activity:techStackAction.none`,upgrade_patch:`activity:techStackAction.upgrade_patch`,upgrade_minor:`activity:techStackAction.upgrade_minor`,upgrade_major:`activity:techStackAction.upgrade_major`,replace:`activity:techStackAction.replace`,remove:`activity:techStackAction.remove`,investigate:`activity:techStackAction.investigate`},z={full:{labelKey:`activity:techStackCoverage.full`,badge:`border-success/35 bg-success/10 text-success`,noteKey:void 0},partial:{labelKey:`activity:techStackCoverage.partial`,badge:`border-warning/35 bg-warning/10 text-warning`,noteKey:`activity:techStackCoverage.partialNote`},unsupported:{labelKey:`activity:techStackCoverage.unsupported`,badge:`border-border/70 bg-muted text-muted-foreground`,noteKey:`activity:techStackCoverage.unsupportedNote`}};function B(e){return z[e]??z.unsupported}function V(e){if(!e)return null;let t=/^\D*(\d+)/.exec(e);if(!t?.[1])return null;let n=Number(t[1]);return Number.isFinite(n)?n:null}function H(e){let t=V(e.locked??e.installed??e.requested),n=V(e.latestStable);if(t===null||n===null||n<=t)return{majorsBehind:0,label:null};let r=n-t;return{majorsBehind:r,label:`${r} major${r===1?``:`s`} behind`}}function U(e){return e.locked??e.installed??e.requested??null}function W(e){return e.confidence<1}function G({className:e,children:t}){return(0,A.jsx)(`span`,{className:C(`inline-flex shrink-0 items-center gap-1 border px-1.5 py-0.5 text-[10px] font-medium`,e),children:t})}function K({label:e,value:t,hint:n,tone:r=`default`}){let i={default:`text-foreground`,success:`text-success`,warning:`text-warning`,info:`text-info`,destructive:`text-destructive`}[r];return(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/55 px-3 py-2.5 shadow-[inset_0_1px_0_hsl(var(--foreground)/0.035)]`,children:[(0,A.jsx)(`p`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:e}),(0,A.jsxs)(`div`,{className:`mt-1 flex items-end justify-between gap-2`,children:[(0,A.jsx)(`p`,{className:C(`font-mono text-xl font-bold tabular-nums`,i),children:t}),(0,A.jsx)(`p`,{className:`truncate text-[9px] text-muted-foreground`,children:n})]})]})}function ce({dependency:e,findings:t,deepDive:n,onDeepDive:a,onBack:o,coverage:s}){let{t:c}=i(),l=j(e.status),u=U(e),d=H(e),f=s?B(s).noteKey:void 0;return(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,A.jsxs)(`header`,{className:`shrink-0 border-b border-border/70 bg-card/45 p-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,A.jsx)(T,{variant:`ghost`,size:`icon`,onClick:o,"aria-label":c(`activity:techStack.backToDependencyList`),className:`shrink-0 md:hidden`,children:(0,A.jsx)(r,{className:`size-4`})}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(`h2`,{className:`min-w-0 truncate font-mono text-sm font-bold text-foreground`,children:e.name}),(0,A.jsx)(G,{className:l.badge,children:c(l.labelKey)})]}),(0,A.jsxs)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:[N(e.ecosystem,c),` ·`,` `,e.direct?`direct`:`transitive`,` · `,e.scope,` ·`,` `,e.sourceType,f&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,A.jsx)(`span`,{className:`text-warning`,children:c(f)})]})]})]})]}),(0,A.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-baseline gap-2 font-mono text-xs`,children:[(0,A.jsx)(`span`,{className:`text-foreground`,children:u??`—`}),e.latestStable&&e.latestStable!==u&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,A.jsx)(`span`,{className:`text-info`,children:e.latestStable})]}),d.label&&(0,A.jsxs)(`span`,{className:`text-[10px] text-warning`,children:[`(`,d.label,`)`]})]})]}),(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,A.jsxs)(`dl`,{className:`grid grid-cols-2 gap-px border border-border/70 bg-border/60`,children:[(0,A.jsx)(q,{label:c(`activity:techStack.constraint`),value:e.requested??`—`,mono:!0}),(0,A.jsx)(q,{label:c(`activity:techStack.locked`),value:e.locked??`—`,mono:!0}),(0,A.jsx)(q,{label:c(`activity:techStack.latestStable`),value:e.latestStable??`—`,mono:!0}),(0,A.jsx)(q,{label:c(`activity:techStack.license`),value:e.license??`—`}),e.wanted&&(0,A.jsx)(q,{label:c(`activity:techStack.wanted`),value:e.wanted,mono:!0}),e.resolvable&&(0,A.jsx)(q,{label:c(`activity:techStack.resolvable`),value:e.resolvable,mono:!0}),e.purl&&(0,A.jsx)(q,{label:c(`activity:techStack.purl`),value:e.purl,mono:!0}),(0,A.jsx)(q,{label:c(`activity:techStack.registryFlags`),value:[e.deprecated&&`deprecated`,e.yanked&&`yanked`].filter(Boolean).join(`, `)||`none`})]}),(0,A.jsxs)(`section`,{className:`mt-4`,children:[(0,A.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-center justify-between gap-2`,children:[(0,A.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:c(`activity:techStack.findings`)}),(0,A.jsxs)(T,{variant:`outline`,size:`sm`,onClick:()=>a(e),disabled:n.status===`loading`,className:`h-7 text-[10px]`,children:[n.status===`loading`?(0,A.jsx)(g,{className:`size-3 animate-spin`}):(0,A.jsx)(m,{className:`size-3`}),n.status===`loading`?`Researching…`:`Deep dive`]})]}),n.status===`error`&&n.error&&(0,A.jsx)(`p`,{role:`alert`,className:`mb-1.5 text-[10px] text-destructive`,children:n.error}),t.length===0?(0,A.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:c(`activity:techStack.nothingFlaggedRunADeepDive`)}):(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.map(e=>(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(G,{className:L[e.severity].badge,children:c(L[e.severity].labelKey)}),(0,A.jsx)(G,{className:`border-border/70 bg-muted text-muted-foreground`,children:R[e.action]?c(R[e.action]):e.action}),W(e)&&(0,A.jsxs)(G,{className:`border-info/35 bg-info/10 text-info`,children:[(0,A.jsx)(m,{className:`size-2.5`}),`AI · `,Math.round(e.confidence*100),`%`]})]}),(0,A.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-muted-foreground`,children:e.rationale}),e.breakingRisk&&(0,A.jsx)(`p`,{className:`mt-1 border-l-2 border-warning/40 pl-2 text-[10px] leading-relaxed text-warning`,children:e.breakingRisk})]},e.id))})]}),(0,A.jsxs)(`section`,{className:`mt-4`,children:[(0,A.jsx)(`h3`,{className:`mb-1.5 text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:c(`activity:techStack.evidence`)}),e.evidence.length===0?(0,A.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:c(`activity:techStack.noEvidenceRecorded`)}):(0,A.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.evidence.map((t,n)=>(0,A.jsxs)(`li`,{className:`border border-border/70 bg-card/40 p-2`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(G,{className:`border-border/70 bg-muted text-muted-foreground`,children:t.kind}),(0,A.jsx)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(t.retrievedAt).toLocaleString()})]}),t.source.startsWith(`http`)?(0,A.jsxs)(`a`,{href:t.source,target:`_blank`,rel:`noreferrer noopener`,className:`mt-1 flex min-w-0 items-center gap-1 truncate text-[10px] text-info underline-offset-2 hover:underline`,children:[(0,A.jsx)(`span`,{className:`truncate`,children:t.source}),(0,A.jsx)(_,{className:`size-2.5 shrink-0`})]}):(0,A.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-muted-foreground`,children:t.source}),t.detail&&(0,A.jsx)(`p`,{className:`mt-0.5 text-[10px] leading-relaxed text-muted-foreground`,children:t.detail})]},`${e.id}-evidence-${n}`))})]})]})]})}function q({label:e,value:t,mono:n}){return(0,A.jsxs)(`div`,{className:`bg-card/55 px-2.5 py-1.5`,children:[(0,A.jsx)(`dt`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:e}),(0,A.jsx)(`dd`,{className:C(`mt-0.5 truncate text-[11px] text-foreground`,n&&`font-mono`),children:t})]})}var J=`grid grid-cols-[minmax(0,2.2fr)_minmax(0,1.6fr)_minmax(0,1.1fr)] gap-2`;function le({dependencies:e,selectedId:t,hasDependencies:n,coverageByWorkspaceId:r,onSelect:a}){let{t:o}=i(),c=O(e,30);return e.length===0?(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,A.jsx)(`p`,{className:`max-w-xs text-xs text-muted-foreground`,children:n?`No dependencies match the current filters.`:`No dependencies inventoried yet. Run a scan to populate the inventory.`})}):(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,A.jsxs)(`div`,{className:C(J,`shrink-0 border-b border-border/70 bg-card/45 px-3 py-1.5 text-[9px] font-bold uppercase tracking-[0.14em] text-muted-foreground`),children:[(0,A.jsx)(`span`,{children:o(`activity:techStack.package`)}),(0,A.jsx)(`span`,{children:o(`activity:techStack.installedLatest`)}),(0,A.jsx)(`span`,{children:o(`activity:techStack.status`)})]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,A.jsx)(s,{className:`h-full`,"aria-label":o(`activity:techStack.dependencies`),children:c.pageItems.map(e=>(0,A.jsx)(Y,{dependency:e,selected:e.id===t,coverage:r?.get(e.workspaceId),onSelect:a},e.id))})}),(0,A.jsx)(D,{page:c.page,pageSize:c.pageSize,totalItems:c.totalItems,onPageChange:c.setPage,itemLabel:`dependencies`})]})}function Y({dependency:e,selected:t,coverage:n,onSelect:r}){let{t:a}=i(),o=j(e.status),s=U(e),c=H(e),l=n?B(n).noteKey:void 0;return(0,A.jsxs)(`button`,{type:`button`,onClick:()=>r(e),"aria-current":t,className:C(J,`w-full items-center border-b border-border/40 px-3 py-2 text-left transition-colors hover:bg-accent/40`,t&&`bg-accent/60`),children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,A.jsx)(`span`,{className:C(`size-1.5 shrink-0`,o.dot),"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`truncate font-mono text-xs text-foreground`,children:e.name})]}),(0,A.jsxs)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:[(0,A.jsx)(F,{ecosystem:e.ecosystem,className:`mr-0.5 inline-block size-3 align-text-bottom`}),N(e.ecosystem,a),` · `,e.direct?`direct`:`transitive`,` · `,e.scope,l&&(0,A.jsxs)(A.Fragment,{children:[` · `,(0,A.jsx)(`span`,{className:`text-warning`,children:a(l)})]})]})]}),(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-1.5 font-mono text-[11px]`,children:[(0,A.jsx)(`span`,{className:`truncate text-foreground`,children:s??`—`}),e.latestStable&&e.latestStable!==s&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`→`}),(0,A.jsx)(`span`,{className:`truncate text-info`,children:e.latestStable})]})]}),c.label?(0,A.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-warning`,children:c.label}):e.requested&&(0,A.jsx)(`p`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:e.requested})]}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,A.jsx)(G,{className:o.badge,children:a(o.labelKey)}),e.deprecated&&(0,A.jsx)(G,{className:`border-destructive/35 bg-destructive/10 text-destructive`,children:`dep`}),e.yanked&&(0,A.jsx)(G,{className:`border-destructive/45 bg-destructive/15 text-destructive`,children:`yank`})]})]})}function ue({findings:e,dependenciesById:t,onSelectDependency:n}){let{t:r}=i(),a=O(e,20);return e.length===0?(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,A.jsxs)(`p`,{className:`max-w-sm text-xs text-muted-foreground`,children:[r(`activity:techStack.noFindingsRun`),` `,(0,A.jsx)(`span`,{className:`font-mono text-foreground`,children:r(`activity:techStack.analyze`)}),` `,r(`activity:techStack.toCheckVersionsAndAdvisoriesAgainst`)]})}):(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,A.jsx)(`div`,{className:`flex flex-col gap-4`,children:I.map(e=>[e,a.pageItems.filter(t=>t.severity===e)]).filter(([,e])=>e.length>0).map(([e,i])=>(0,A.jsxs)(`section`,{children:[(0,A.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2`,children:[(0,A.jsx)(G,{className:L[e].badge,children:r(L[e].labelKey)}),(0,A.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums text-muted-foreground`,children:i.length})]}),(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:i.map(e=>(0,A.jsx)(X,{finding:e,dependency:t.get(e.dependencyId),onSelectDependency:n},e.id))})]},e))})}),(0,A.jsx)(D,{page:a.page,pageSize:a.pageSize,totalItems:a.totalItems,onPageChange:a.setPage,itemLabel:`findings`})]})}function X({finding:e,dependency:t,onSelectDependency:n}){let{t:r}=i(),a=W(e);return(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2.5`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>n(e.dependencyId),className:`min-w-0 truncate font-mono text-xs text-foreground underline-offset-2 hover:underline`,children:t?.name??e.dependencyId}),(0,A.jsx)(G,{className:`border-border/70 bg-muted text-muted-foreground`,children:R[e.action]?r(R[e.action]):e.action}),a&&(0,A.jsxs)(G,{className:`border-info/35 bg-info/10 text-info`,children:[(0,A.jsx)(m,{className:`size-2.5`}),`AI · `,Math.round(e.confidence*100),`%`]})]}),(0,A.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-muted-foreground`,children:e.rationale}),e.breakingRisk&&(0,A.jsx)(`p`,{className:`mt-1 border-l-2 border-warning/40 pl-2 text-[10px] leading-relaxed text-warning`,children:e.breakingRisk}),e.evidence.length>0&&(0,A.jsx)(`ul`,{className:C(`mt-1.5 flex flex-col gap-0.5`),children:e.evidence.slice(0,4).map((t,n)=>(0,A.jsx)(`li`,{className:`min-w-0 truncate text-[10px]`,children:t.source.startsWith(`http`)?(0,A.jsx)(`a`,{href:t.source,target:`_blank`,rel:`noreferrer noopener`,className:`text-info underline-offset-2 hover:underline`,children:t.detail??t.source}):(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:t.detail??t.source})},`${e.id}-${n}`))})]})}function de({searchQuery:e,ecosystemFilter:t,statusFilter:r,directOnly:a,sort:o,hasFilters:s,ecosystems:c,statuses:l,visibleCount:u,totalCount:d,onSearchChange:f,onEcosystemFilterChange:p,onStatusFilterChange:m,onToggleDirectOnly:ee,onSortChange:g,onClearFilters:_}){let{t:v}=i();return(0,A.jsxs)(`div`,{className:`shrink-0 space-y-2 border-b border-border/70 bg-card/45 p-3`,children:[(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[(0,A.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,A.jsx)(h,{className:`pointer-events-none absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,A.jsx)(E,{"aria-label":v(`activity:techStack.searchDependencies`),value:e,onChange:e=>f(e.target.value),placeholder:v(`activity:techStack.searchByPackageName`),className:`h-10 min-w-0 bg-background pl-9 pr-8 text-xs`}),e&&(0,A.jsx)(`button`,{type:`button`,"aria-label":v(`activity:techStack.clearSearch`),onClick:()=>f(``),className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground`,children:(0,A.jsx)(te,{className:`size-3.5`})})]}),(0,A.jsx)(T,{variant:a?`default`:`outline`,size:`sm`,onClick:ee,"aria-pressed":a,title:v(`activity:techStack.showOnlyDependenciesThisProjectDeclaresItself`),className:`shrink-0`,children:v(`activity:techStack.directOnly`)}),s&&(0,A.jsx)(T,{variant:`ghost`,size:`icon`,onClick:_,"aria-label":v(`activity:techStack.clearAllFilters`),title:v(`activity:techStack.clearAllFilters`),className:`shrink-0`,children:(0,A.jsx)(n,{className:`size-4`})})]}),(0,A.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-ecosystem-filter`,children:v(`activity:techStack.filterByEcosystem`)}),(0,A.jsxs)(`select`,{id:`techstack-ecosystem-filter`,value:t,onChange:e=>p(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,A.jsx)(`option`,{value:`all`,children:v(`activity:techStack.allEcosystems`)}),c.map(([e,t])=>(0,A.jsxs)(`option`,{value:e,children:[N(e,v),` · `,t]},e))]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-status-filter`,children:v(`activity:techStack.filterByStatus`)}),(0,A.jsxs)(`select`,{id:`techstack-status-filter`,value:r,onChange:e=>m(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,A.jsx)(`option`,{value:`all`,children:v(`activity:techStack.allStatuses`)}),l.map(([e,t])=>(0,A.jsxs)(`option`,{value:e,children:[v(j(e).labelKey),` · `,t]},e))]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-sort`,children:v(`activity:techStack.sortDependencies`)}),(0,A.jsxs)(`select`,{id:`techstack-sort`,value:o,onChange:e=>g(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,A.jsx)(`option`,{value:`attention`,children:v(`activity:techStack.sortNeedsAttention`)}),(0,A.jsx)(`option`,{value:`drift`,children:v(`activity:techStack.sortMostOutOfDate`)}),(0,A.jsx)(`option`,{value:`name`,children:v(`activity:techStack.sortName`)})]})]})]}),(0,A.jsx)(`p`,{className:C(`text-[10px] text-muted-foreground`,s&&`text-info`),children:u===d?`${d} dependencies`:`${u} of ${d} dependencies`})]})}var fe=[{id:`dependencies`,labelKey:`activity:techStack.tabDependencies`},{id:`findings`,labelKey:`activity:techStack.tabFindings`},{id:`workspaces`,labelKey:`activity:techStack.tabWorkspaces`},{id:`trends`,labelKey:`activity:techStack.tabTrends`},{id:`remediation`,labelKey:`activity:techStack.tabRemediation`}],Z=new Set([`npm`,`python`,`rust`,`go`,`php`,`dotnet`]);function pe(){let{t:e}=i(),t=w(e=>e.snapshot),n=w(e=>e.stale),r=w(e=>e.loading),a=w(e=>e.error),o=w(e=>e.activeJob),[s,c]=(0,k.useState)(`dependencies`),[l,u]=(0,k.useState)(``),[d,f]=(0,k.useState)(`all`),[p,h]=(0,k.useState)(`all`),[_,v]=(0,k.useState)(!1),[y,ne]=(0,k.useState)(`attention`),[b,x]=(0,k.useState)(null),[S,E]=(0,k.useState)([]),[D,O]=(0,k.useState)({status:`idle`,error:null}),[ie,ae]=(0,k.useState)(null),[M,oe]=(0,k.useState)(null),[N,P]=(0,k.useState)(new Set),[F,I]=(0,k.useState)(!1),L=(0,k.useCallback)(async()=>{let e=w.getState();e.setLoading(!0),e.setError(null);try{let t=await fetch(`/api/techstack/snapshot`);if(t.status===404){e.setSnapshot(null,!1);return}if(!t.ok)throw Error(`HTTP ${t.status}: ${t.statusText}`);let n=await t.json();e.setSnapshot(n.snapshot,n.stale)}catch(t){e.setError(t instanceof Error?t.message:String(t))}},[]),R=(0,k.useCallback)(async e=>{let t=w.getState();t.setLoading(!0),t.setError(null);try{let n=await fetch(`/api/techstack/${e}`,{method:`POST`}),r=await n.json();if(!n.ok||!r.jobId)throw Error(r.error??`HTTP ${n.status}: ${n.statusText}`);t.jobStarted(r.jobId,e)}catch(e){t.setError(e instanceof Error?e.message:String(e))}},[]),z=(0,k.useCallback)(async()=>{let e=w.getState().activeJob;if(e)try{let t=await fetch(`/api/techstack/jobs/${encodeURIComponent(e.id)}/cancel`,{method:`POST`});if(!t.ok)throw Error(`HTTP ${t.status}: ${t.statusText}`);w.getState().jobCancelled(e.id)}catch(e){w.getState().setError(e instanceof Error?e.message:String(e))}},[]),B=(0,k.useCallback)(async e=>{O({status:`loading`,error:null});try{let t=await fetch(`/api/techstack/deps/${encodeURIComponent(e.id)}/research`,{method:`POST`}),n=await t.json();if(!t.ok)throw Error(n.error??`HTTP ${t.status}`);E(n.findings??[]),O({status:`idle`,error:null})}catch(e){O({status:`error`,error:e instanceof Error?e.message:String(e)})}},[]);(0,k.useEffect)(()=>{L()},[L]),(0,k.useEffect)(()=>{s!==`trends`&&s!==`remediation`||fetch(`/api/techstack/${s===`trends`?`trends`:`remediation`}`).then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);t.trend&&ae(t.trend),t.plan&&oe(t.plan)}).catch(e=>w.getState().setError(e instanceof Error?e.message:String(e)))},[s,t?.id]);let V=(0,k.useCallback)(async()=>{if(N.size!==0){I(!0);try{let e=await fetch(`/api/techstack/remediation/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({approvedItems:[...N]})}),t=await e.json();if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);P(new Set),await R(`inventory`)}catch(e){w.getState().setError(e instanceof Error?e.message:String(e))}finally{I(!1)}}},[N,R]);(0,k.useEffect)(()=>{E([]),O({status:`idle`,error:null})},[t?.id]);let U=(0,k.useMemo)(()=>t?.dependencies??[],[t]),W=(0,k.useMemo)(()=>t?.findings??[],[t]),G=(0,k.useMemo)(()=>new Map(U.map(e=>[e.id,e])),[U]),q=(0,k.useMemo)(()=>ve(U.map(e=>e.ecosystem)),[U]),J=(0,k.useMemo)(()=>ve(U.map(e=>e.status)),[U]),Y=(0,k.useMemo)(()=>new Map(t?.workspaces.map(e=>[e.id,e.coverage])??[]),[t]),X=(0,k.useMemo)(()=>{let e=l.trim().toLowerCase(),t=[...U.filter(t=>!(e&&!t.name.toLowerCase().includes(e)||d!==`all`&&t.ecosystem!==d||p!==`all`&&t.status!==p||_&&!t.direct))];return y===`name`?t.sort((e,t)=>e.name.localeCompare(t.name)):y===`drift`?t.sort((e,t)=>H(t).majorsBehind-H(e).majorsBehind||e.name.localeCompare(t.name)):t.sort((e,t)=>j(t.status).weight-j(e.status).weight||Number(t.direct)-Number(e.direct)||e.name.localeCompare(t.name)),t},[U,l,d,p,_,y]),Z=b?G.get(b):void 0,pe=(0,k.useMemo)(()=>Z?[...W.filter(e=>e.dependencyId===Z.id),...S.filter(e=>e.dependencyId===Z.id)]:[],[W,S,Z]),be=(0,k.useMemo)(()=>U.filter(se).length,[U]),xe=(0,k.useMemo)(()=>U.filter(e=>H(e).majorsBehind>0).length,[U]),Se=(0,k.useMemo)(()=>U.filter(e=>e.status===`vulnerable`).length,[U]),Ce=l.trim()!==``||d!==`all`||p!==`all`||_,we=(0,k.useCallback)(()=>{u(``),f(`all`),h(`all`),v(!1)},[]),$=!!(o&&![`completed`,`failed`,`cancelled`].includes(o.status)),Te=(0,k.useCallback)(e=>{x(e),c(`dependencies`)},[]);return(0,A.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,A.jsx)(`header`,{className:`shrink-0 border-b border-border/70 px-4 py-3`,children:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`h1`,{className:`text-base font-bold sm:text-lg`,children:e(`activity:techStack.techstack`)}),(0,A.jsx)(`span`,{className:`border border-info/35 bg-info/10 px-2 py-0.5 font-mono text-[9px] font-bold uppercase text-info`,children:t?`${t.workspaces.length} workspaces`:`no scan yet`}),n&&(0,A.jsx)(`span`,{className:`border border-warning/35 bg-warning/10 px-2 py-0.5 font-mono text-[9px] font-bold uppercase text-warning`,children:e(`activity:techStack.staleGt24h`)})]}),(0,A.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground sm:text-xs`,children:t?`${t.targetRoot} · scanned ${new Date(t.createdAt).toLocaleString()}`:`Scan the open project to inventory its dependencies.`})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsxs)(T,{variant:`outline`,size:`sm`,onClick:()=>void R(`inventory`),disabled:$,title:e(`activity:techStack.offlineReReadManifestsAndLockfiles`),children:[(0,A.jsx)(re,{className:C(`size-3.5`,$&&`animate-spin`)}),(0,A.jsx)(`span`,{className:`hidden sm:inline`,children:e(`activity:techStack.refresh`)})]}),(0,A.jsxs)(T,{size:`sm`,onClick:()=>void R(`analyze`),disabled:$,title:e(`activity:techStack.checkRegistriesAndAdvisoriesThenInterpretTheResultsWithTheModel`),children:[(0,A.jsx)(m,{className:`size-3.5`}),e(`activity:techStack.analyze`)]}),$&&(0,A.jsx)(T,{variant:`ghost`,size:`icon`,onClick:()=>void z(),"aria-label":e(`activity:techStack.cancelJob`),children:(0,A.jsx)(te,{className:`size-4`})}),(0,A.jsx)(T,{variant:`ghost`,size:`icon`,onClick:()=>t&&ye(t),disabled:!t,"aria-label":e(`activity:techStack.exportSnapshotAsJson`),title:e(`activity:techStack.exportSnapshotAsJson`),children:(0,A.jsx)(ee,{className:`size-4`})})]})]})}),t&&(0,A.jsxs)(`div`,{className:`grid shrink-0 grid-cols-2 gap-px border-b border-border/70 bg-border/60 sm:grid-cols-4`,children:[(0,A.jsx)(K,{label:e(`activity:techStack.dependencies`),value:U.length,hint:`${X.length} visible`}),(0,A.jsx)(K,{label:e(`activity:techStack.outdated`),value:xe,hint:e(`activity:techStack.majorsBehind`),tone:xe>0?`warning`:`success`}),(0,A.jsx)(K,{label:e(`activity:techStack.vulnerable`),value:Se,hint:e(`activity:techStack.knownAdvisories`),tone:Se>0?`destructive`:`success`}),(0,A.jsx)(K,{label:e(`activity:techStack.findings`),value:W.length,hint:`${be} need attention`,tone:W.length>0?`info`:`default`})]}),($||a)&&(0,A.jsxs)(`div`,{className:`shrink-0 border-b border-border/70 px-4 py-2`,"aria-live":`polite`,children:[$&&o&&(0,A.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 text-xs text-info`,children:[(0,A.jsx)(g,{className:`size-3.5 animate-spin`}),(0,A.jsx)(`span`,{className:`font-mono`,children:o.status}),o.progress&&(0,A.jsxs)(`span`,{className:`text-muted-foreground`,children:[o.progress.completed,`/`,o.progress.total]})]}),a&&(0,A.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-2 text-xs text-destructive`,children:[(0,A.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:a}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>void L(),className:`underline`,children:e(`activity:techStack.retry`)})]})]}),r&&!t?(0,A.jsx)(Q,{}):t?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`nav`,{className:`flex shrink-0 gap-1 border-b border-border/70 px-2`,children:fe.map(t=>(0,A.jsxs)(`button`,{type:`button`,onClick:()=>c(t.id),"aria-current":s===t.id,className:C(`border-b-2 px-3 py-2 text-xs font-medium transition-colors`,s===t.id?`border-primary text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:[e(t.labelKey),t.id===`findings`&&W.length>0&&(0,A.jsx)(`span`,{className:`ml-1.5 font-mono text-[10px] tabular-nums text-muted-foreground`,children:W.length})]},t.id))}),s===`dependencies`&&(0,A.jsxs)(`div`,{className:`grid min-h-0 flex-1 md:grid-cols-[minmax(340px,1fr)_minmax(0,1.15fr)]`,children:[(0,A.jsxs)(`section`,{className:C(`min-h-0 border-r border-border/70`,Z?`hidden md:flex md:flex-col`:`flex flex-col`),"aria-label":e(`activity:techStack.dependencyList`),children:[(0,A.jsx)(de,{searchQuery:l,ecosystemFilter:d,statusFilter:p,directOnly:_,sort:y,hasFilters:Ce,ecosystems:q,statuses:J,visibleCount:X.length,totalCount:U.length,onSearchChange:u,onEcosystemFilterChange:f,onStatusFilterChange:h,onToggleDirectOnly:()=>v(e=>!e),onSortChange:ne,onClearFilters:we}),(0,A.jsx)(le,{dependencies:X,selectedId:b,hasDependencies:U.length>0,coverageByWorkspaceId:Y,onSelect:e=>x(e.id)})]}),(0,A.jsx)(`section`,{className:C(`min-h-0`,Z?`flex flex-col`:`hidden md:flex md:flex-col`),"aria-label":e(`activity:techStack.dependencyDetail`),children:Z?(0,A.jsx)(ce,{dependency:Z,findings:pe,deepDive:D,onDeepDive:B,onBack:()=>x(null),coverage:Y.get(Z.workspaceId)}):(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,A.jsx)(`p`,{className:`max-w-xs text-xs text-muted-foreground`,children:e(`activity:techStack.selectADependencyToSeeIts`)})})})]}),s===`findings`&&(0,A.jsx)(ue,{findings:W,dependenciesById:G,onSelectDependency:Te}),s===`workspaces`&&(0,A.jsx)(ge,{snapshot:t}),s===`trends`&&(0,A.jsx)(me,{trend:ie}),s===`remediation`&&(0,A.jsx)(he,{plan:M,approved:N,applying:F,onToggle:e=>P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onApply:()=>void V()})]}):(0,A.jsx)(_e,{onScan:()=>void R(`inventory`),disabled:$})]})}function me({trend:e}){return e?(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,A.jsxs)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:[e.snapshots,` snapshots`,e.vulnerabilityHalfLifeMs===void 0?``:` · vulnerability half-life ${(e.vulnerabilityHalfLifeMs/864e5).toFixed(1)} days`]}),(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.points.map(e=>(0,A.jsxs)(`div`,{className:`grid grid-cols-4 border border-border/70 bg-card/40 p-2 text-xs`,children:[(0,A.jsx)(`span`,{children:new Date(e.createdAt).toLocaleDateString()}),(0,A.jsxs)(`span`,{children:[e.dependencies,` deps`]}),(0,A.jsxs)(`span`,{className:`text-warning`,children:[e.outdated,` outdated`]}),(0,A.jsxs)(`span`,{className:`text-destructive`,children:[e.vulnerable,` vulnerable`]})]},e.snapshotId))})]}):(0,A.jsx)(Q,{})}function he({plan:e,approved:t,applying:n,onToggle:r,onApply:a}){let{t:o}=i();return e?(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,A.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.warning}),(0,A.jsxs)(T,{size:`sm`,disabled:t.size===0||n,onClick:a,children:[n&&(0,A.jsx)(g,{className:`size-3.5 animate-spin`}),`Apply `,t.size>0?t.size:``]})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e.items.map(e=>{let n=`${e.workspaceId}:${e.ecosystem}:${e.dependencyName}:${e.action}`,i=e.action===`replace`||e.action===`investigate`||!Z.has(e.ecosystem);return(0,A.jsxs)(`label`,{className:C(`flex gap-3 border border-border/70 bg-card/40 p-2.5`,i?`cursor-not-allowed opacity-65`:`cursor-pointer`),children:[(0,A.jsx)(`input`,{type:`checkbox`,disabled:i,checked:t.has(n),onChange:()=>r(n)}),(0,A.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`span`,{className:`block font-mono text-xs`,children:[e.dependencyName,` · `,e.action]}),(0,A.jsxs)(`span`,{className:`block text-[10px] text-muted-foreground`,children:[e.currentVersion??`?`,` → `,e.targetVersion??`latest`,` · `,e.rationale]}),i&&(0,A.jsx)(`span`,{className:`block text-[10px] text-warning`,children:o(`activity:techStack.requiresAManualPackageChoice`)})]})]},n)}),e.items.length===0&&(0,A.jsx)(`p`,{className:`p-8 text-center text-xs text-muted-foreground`,children:o(`activity:techStack.noRemediationNeeded`)})]})]}):(0,A.jsx)(Q,{})}function ge({snapshot:e}){let{t}=i(),n=(0,k.useMemo)(()=>{let t=new Map;for(let n of e.dependencies)t.set(n.workspaceId,(t.get(n.workspaceId)??0)+1);return t},[e]);return e.workspaces.length===0?(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`activity:techStack.noWorkspacesDetected`)})}):(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.workspaces.map(e=>{let r=z[e.coverage];return(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2.5`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{className:`truncate font-mono text-xs text-foreground`,children:e.relativeRoot}),(0,A.jsxs)(`p`,{className:`mt-0.5 flex items-center gap-1 truncate text-[10px] text-muted-foreground`,children:[(0,A.jsx)(F,{ecosystem:e.ecosystem}),(0,A.jsx)(`span`,{children:N(e.ecosystem,t)}),e.packageManager?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,A.jsx)(`span`,{children:e.packageManager})]}):null,(0,A.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,A.jsxs)(`span`,{children:[n.get(e.id)??0,` deps`]})]})]}),(0,A.jsx)(`span`,{className:C(`shrink-0 border px-1.5 py-0.5 text-[10px] font-medium`,r.badge),children:t(r.labelKey)})]}),e.manifests.length>0&&(0,A.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:e.manifests.map(e=>(0,A.jsx)(`span`,{className:`border border-border/70 bg-background/45 px-1.5 py-0.5 font-mono text-[9px] text-muted-foreground`,children:e.split(/[/\\]/).pop()},e))})]},e.id)})})})}function Q(){let{t:e}=i();return(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,A.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,A.jsx)(g,{className:`size-5 animate-spin text-muted-foreground`}),(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`activity:techStack.loadingSnapshot`)})]})})}function _e({onScan:e,disabled:t}){let{t:n}=i(),r=(0,k.useMemo)(()=>Object.values(M).map(e=>e.label??``).filter(Boolean).join(`, `),[]);return(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,A.jsxs)(`div`,{className:`flex max-w-md flex-col items-center gap-3 text-center`,children:[(0,A.jsx)(`div`,{className:`flex size-14 items-center justify-center border border-info/25 bg-info/5 text-info`,children:(0,A.jsx)(y,{className:`size-6`})}),(0,A.jsx)(`h2`,{className:`text-sm font-semibold`,children:n(`activity:techStack.noInventoryYet`)}),(0,A.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[`TechStack reads every manifest and lockfile in the open project — `,r,` — and compares what you have against the upstream registries.`]}),(0,A.jsxs)(T,{size:`sm`,onClick:e,disabled:t,children:[(0,A.jsx)(re,{className:C(`size-3.5`,t&&`animate-spin`)}),n(`activity:techStack.scanThisProject`)]})]})})}function ve(e){let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return[...t.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))}function ye(e){let t=new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`techstack.json`,r.click(),URL.revokeObjectURL(n)}export{pe as TechStackView};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ba as t,Fa as n,Ra as r,Vt as i,dt as a,jt as o,lt as s,mn as c,wn as l}from"./vendor-GiKfK4Iw.js";import"./i18n-BvFgJYE2.js";import{t as u}from"./ws-client-CGEB75Dy.js";import{n as d,t as f}from"./utils-CUCQrODG.js";import{t as p}from"./session-store-Ce4Dck2K.js";import{I as m}from"./stores-BATHCuMN.js";import{n as h}from"./ui-store-BGNdg1e4.js";import{n as g,t as _}from"./xterm-DUBp1lnG.js";var v=e(t(),1),y=`wrongstack.terminalDockHeight`;function b(e){let t=typeof window>`u`?640:Math.max(140,Math.min(640,Math.floor(window.innerHeight*.55),window.innerHeight-260));return Math.min(Math.max(Math.round(e),140),t)}var x=s(),S={background:`#1e1e2e`,foreground:`#cdd6f4`,cursor:`#f5e0dc`,selectionBackground:`#585b70`,black:`#45475a`,red:`#f38ba8`,green:`#a6e3a1`,yellow:`#f9e2af`,blue:`#89b4fa`,magenta:`#f5c2e7`,cyan:`#94e2d5`,white:`#bac2de`,brightBlack:`#585b70`,brightRed:`#f38ba8`,brightGreen:`#a6e3a1`,brightYellow:`#f9e2af`,brightBlue:`#89b4fa`,brightMagenta:`#f5c2e7`,brightCyan:`#94e2d5`,brightWhite:`#a6adc8`},C=8;function w(e=!1){return typeof window>`u`?300:b(window.innerHeight*(e?.32:.4))}function T(e=!1){if(typeof window>`u`)return w(e);try{let t=window.localStorage.getItem(y),n=t?Number.parseInt(t,10):NaN;return Number.isFinite(n)?b(n):w(e)}catch{return w(e)}}function E(e){try{window.localStorage.setItem(y,String(b(e)))}catch{}}function D(){return d()}function O(e){return{id:D(),name:`Terminal ${e}`,status:`starting`}}function k({desktopShell:e=!1,onClose:t}){let r=(0,v.useRef)(null),{t:s}=n(),u=(0,v.useRef)(1),[d,m]=(0,v.useState)(()=>T(e)),[g,_]=(0,v.useState)(()=>[O(1)]),[y,S]=(0,v.useState)(()=>g[0]?.id??``),w=h(e=>e.terminalCreateNonce),k=(0,v.useRef)(w),j=p(e=>e.projectName),M=p(e=>e.cwd);(0,v.useEffect)(()=>{let e=()=>{m(e=>{let t=b(e);return E(t),t})};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let N=e=>{e.preventDefault(),r.current?.();let t=e.clientY,n=d,i=document.body.style.cursor,a=document.body.style.userSelect;document.body.style.cursor=`ns-resize`,document.body.style.userSelect=`none`;let o=e=>{let r=b(n+t-e.clientY);m(r),E(r)},s=()=>{document.body.style.cursor=i,document.body.style.userSelect=a,window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s),r.current===s&&(r.current=null)};r.current=s,window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s,{once:!0}),window.addEventListener(`pointercancel`,s,{once:!0})};(0,v.useEffect)(()=>()=>r.current?.(),[]);let P=()=>{_(e=>{if(e.length>=C)return e;u.current+=1;let t=O(u.current);return S(t.id),[...e,t]})};(0,v.useEffect)(()=>{w!==k.current&&(k.current=w,P())},[w]);let F=e=>{_(n=>{let r=n.findIndex(t=>t.id===e);if(r===-1)return n;let i=n.filter(t=>t.id!==e);return i.length===0?(queueMicrotask(t),i):(y===e&&S(i[Math.max(0,r-1)]?.id??i[0]?.id??``),i)})},I=e=>{let t=D();_(n=>{let r=!1,i=n.map(n=>n.id===e?(r=!0,{...n,id:t,status:`starting`,exitCode:void 0}):n);return r&&S(t),i})},L=()=>{_([]),S(``),queueMicrotask(t)},R=(e,t)=>{_(n=>n.map(n=>n.id===e?{...n,...t}:n))},z=g.find(e=>e.id===y)??g[0]??null;return(0,x.jsxs)(`div`,{"data-terminal-dock":!0,style:{height:d},"data-shell":e?`desktop`:`browser`,className:f(`z-30 flex min-h-0 shrink-0 flex-col border-t border-border/70 bg-card shadow-2xl`,e&&`ws-terminal-desktop`),children:[(0,x.jsx)(`hr`,{"aria-orientation":`horizontal`,tabIndex:0,title:s(`activity:terminal.resize`),onPointerDown:N,className:`h-1.5 cursor-ns-resize bg-muted/70 transition-colors hover:bg-primary/35 border-0`}),(0,x.jsxs)(`div`,{className:f(`flex min-w-0 items-center justify-between gap-3 border-b border-border/70 bg-card/85`,e?`px-2 py-1`:`px-3 py-1.5`),children:[(0,x.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs text-foreground`,children:[(0,x.jsx)(i,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,x.jsx)(`span`,{className:`font-medium`,children:s(e?`activity:terminal.labelSingular`:`activity:terminal.labelPlural`)}),(0,x.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:j||M||s(`activity:terminal.projectShell`)})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(`button`,{type:`button`,onClick:P,disabled:g.length>=C,title:g.length>=C?s(`activity:terminal.maxTerminals`,{count:C}):s(`activity:terminal.newTerminal`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,x.jsx)(l,{className:`h-4 w-4`})}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>z&&I(z.id),disabled:!z,title:s(`activity:terminal.restart`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,x.jsx)(c,{className:`h-3.5 w-3.5`})}),(0,x.jsx)(`button`,{type:`button`,onClick:L,disabled:g.length===0,title:s(`activity:terminal.closeAll`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,x.jsx)(o,{className:`h-3.5 w-3.5`})}),(0,x.jsx)(`button`,{type:`button`,onClick:t,title:s(`activity:terminal.closeDock`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,x.jsx)(a,{className:`h-4 w-4`})})]})]}),(0,x.jsx)(`div`,{className:f(`flex min-w-0 items-center gap-1 overflow-x-auto border-b border-border/70 bg-[hsl(var(--surface-2)/0.45)]`,e?`px-1.5 py-0.5`:`px-2 py-1`),children:g.map(t=>(0,x.jsxs)(`div`,{className:f(`group inline-flex items-center rounded border text-xs transition-colors`,e?`h-6 min-w-[92px] max-w-[148px]`:`h-7 min-w-[112px] max-w-[180px]`,y===t.id?`border-primary/35 bg-primary/10 text-primary`:`border-transparent bg-transparent text-muted-foreground hover:bg-accent hover:text-foreground`),children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>S(t.id),title:t.status===`exited`?`${t.name} exited`:t.name,className:`inline-flex min-w-0 flex-1 items-center gap-2 px-2 text-left`,children:[(0,x.jsx)(`span`,{className:f(`h-1.5 w-1.5 shrink-0 rounded-full`,t.status===`running`&&`bg-success`,t.status===`starting`&&`bg-primary`,t.status===`exited`&&`bg-destructive`)}),(0,x.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[t.name,t.status===`exited`&&typeof t.exitCode==`number`?` (${t.exitCode})`:``]})]}),(0,x.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),F(t.id)},className:`mr-1 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground opacity-70 hover:bg-accent hover:text-foreground hover:opacity-100`,title:s(`activity:terminal.closeTab`,{name:t.name}),children:(0,x.jsx)(a,{className:`h-3 w-3`})})]},t.id))}),M&&!e&&(0,x.jsx)(`div`,{className:`min-w-0 truncate border-b border-border/60 bg-muted/30 px-3 py-1 text-[11px] font-mono text-muted-foreground`,children:M}),(0,x.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:g.map(e=>(0,x.jsx)(A,{id:e.id,active:e.id===y,onRunning:()=>R(e.id,{status:`running`}),onExit:t=>R(e.id,{status:`exited`,exitCode:t})},e.id))})]})}function A({id:e,active:t,onRunning:n,onExit:i}){let a=(0,v.useRef)(null),o=(0,v.useRef)(null),s=(0,v.useRef)(null),c=(0,v.useRef)(n),l=(0,v.useRef)(i),d=m(e=>e.wsConnected);return(0,v.useEffect)(()=>{c.current=n,l.current=i},[i,n]),(0,v.useEffect)(()=>{let t=a.current;if(!t)return;let n=new _({fontFamily:`"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:13,cursorBlink:!0,theme:S,scrollback:5e3}),i=new g;o.current=n,s.current=i,n.loadAddon(i),n.open(t);try{i.fit()}catch{}let d=u(m.getState().wsUrl);d.send({type:`terminal.create`,payload:{id:e,cols:n.cols,rows:n.rows}});let f=!1,p=d.on(`terminal.output`,t=>{t.type===`terminal.output`&&t.payload.id===e&&(f||(f=!0,c.current()),n.write(t.payload.data))}),h=d.on(`terminal.exit`,t=>{t.type===`terminal.exit`&&t.payload.id===e&&(n.write(`\r\n\x1b[2m${r.t(`activity:terminal.processExited`,{code:t.payload.exitCode})}\x1b[0m\r\n`),l.current(t.payload.exitCode))}),v=n.onData(t=>{d.send({type:`terminal.input`,payload:{id:e,data:t}})}),y=new ResizeObserver(()=>{if(t.offsetParent)try{i.fit(),d.send({type:`terminal.resize`,payload:{id:e,cols:n.cols,rows:n.rows}})}catch{}});return y.observe(t),()=>{p(),h(),v.dispose(),y.disconnect(),d.send({type:`terminal.close`,payload:{id:e}}),n.dispose(),o.current=null,s.current=null}},[e,d]),(0,v.useEffect)(()=>{t&&window.requestAnimationFrame(()=>{try{s.current?.fit();let t=o.current;t&&(u(m.getState().wsUrl).send({type:`terminal.resize`,payload:{id:e,cols:t.cols,rows:t.rows}}),t.focus())}catch{}})},[t,e]),(0,x.jsx)(`div`,{ref:a,className:f(`absolute inset-0 min-h-0 min-w-0 overflow-hidden px-2 py-1`,t?`block`:`hidden`)})}export{k as TerminalPanel};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ia as t,Va as n,Vt as r,dt as i,jt as a,lt as o,mn as s,wn as c,za as l}from"./vendor-AeHpGMaG.js";import"./i18n-nlW2iAya.js";import{t as u}from"./ws-client-Cvio0IrC.js";import{n as d,t as f}from"./utils-D1fGupR8.js";import{t as p}from"./session-store-DkPaOIhe.js";import{I as m}from"./stores-DxTO5dWX.js";import{n as h}from"./ui-store-FVcXVdRC.js";import{n as g,t as _}from"./xterm-DUBp1lnG.js";var v=e(n(),1),y=`wrongstack.terminalDockHeight`;function b(e){let t=typeof window>`u`?640:Math.max(140,Math.min(640,Math.floor(window.innerHeight*.55),window.innerHeight-260));return Math.min(Math.max(Math.round(e),140),t)}var x=o(),S={background:`#1e1e2e`,foreground:`#cdd6f4`,cursor:`#f5e0dc`,selectionBackground:`#585b70`,black:`#45475a`,red:`#f38ba8`,green:`#a6e3a1`,yellow:`#f9e2af`,blue:`#89b4fa`,magenta:`#f5c2e7`,cyan:`#94e2d5`,white:`#bac2de`,brightBlack:`#585b70`,brightRed:`#f38ba8`,brightGreen:`#a6e3a1`,brightYellow:`#f9e2af`,brightBlue:`#89b4fa`,brightMagenta:`#f5c2e7`,brightCyan:`#94e2d5`,brightWhite:`#a6adc8`},C=8;function w(e=!1){return typeof window>`u`?300:b(window.innerHeight*(e?.32:.4))}function T(e=!1){if(typeof window>`u`)return w(e);try{let t=window.localStorage.getItem(y),n=t?Number.parseInt(t,10):NaN;return Number.isFinite(n)?b(n):w(e)}catch{return w(e)}}function E(e){try{window.localStorage.setItem(y,String(b(e)))}catch{}}function D(){return d()}function O(e){return{id:D(),name:`Terminal ${e}`,status:`starting`}}function k({desktopShell:e=!1,onClose:n}){let o=(0,v.useRef)(null),{t:l}=t(),u=(0,v.useRef)(1),[d,m]=(0,v.useState)(()=>T(e)),[g,_]=(0,v.useState)(()=>[O(1)]),[y,S]=(0,v.useState)(()=>g[0]?.id??``),w=h(e=>e.terminalCreateNonce),k=(0,v.useRef)(w),j=p(e=>e.projectName),M=p(e=>e.cwd);(0,v.useEffect)(()=>{let e=()=>{m(e=>{let t=b(e);return E(t),t})};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let N=e=>{e.preventDefault(),o.current?.();let t=e.clientY,n=d,r=document.body.style.cursor,i=document.body.style.userSelect;document.body.style.cursor=`ns-resize`,document.body.style.userSelect=`none`;let a=e=>{let r=b(n+t-e.clientY);m(r),E(r)},s=()=>{document.body.style.cursor=r,document.body.style.userSelect=i,window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s),o.current===s&&(o.current=null)};o.current=s,window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,s,{once:!0}),window.addEventListener(`pointercancel`,s,{once:!0})};(0,v.useEffect)(()=>()=>o.current?.(),[]);let P=()=>{_(e=>{if(e.length>=C)return e;u.current+=1;let t=O(u.current);return S(t.id),[...e,t]})};(0,v.useEffect)(()=>{w!==k.current&&(k.current=w,P())},[w]);let F=e=>{_(t=>{let r=t.findIndex(t=>t.id===e);if(r===-1)return t;let i=t.filter(t=>t.id!==e);return i.length===0?(queueMicrotask(n),i):(y===e&&S(i[Math.max(0,r-1)]?.id??i[0]?.id??``),i)})},I=e=>{let t=D();_(n=>{let r=!1,i=n.map(n=>n.id===e?(r=!0,{...n,id:t,status:`starting`,exitCode:void 0}):n);return r&&S(t),i})},L=()=>{_([]),S(``),queueMicrotask(n)},R=(e,t)=>{_(n=>n.map(n=>n.id===e?{...n,...t}:n))},z=g.find(e=>e.id===y)??g[0]??null;return(0,x.jsxs)(`div`,{"data-terminal-dock":!0,style:{height:d},"data-shell":e?`desktop`:`browser`,className:f(`z-30 flex min-h-0 shrink-0 flex-col border-t border-border/70 bg-card shadow-2xl`,e&&`ws-terminal-desktop`),children:[(0,x.jsx)(`hr`,{"aria-orientation":`horizontal`,tabIndex:0,title:l(`activity:terminal.resize`),onPointerDown:N,className:`h-1.5 cursor-ns-resize bg-muted/70 transition-colors hover:bg-primary/35 border-0`}),(0,x.jsxs)(`div`,{className:f(`flex min-w-0 items-center justify-between gap-3 border-b border-border/70 bg-card/85`,e?`px-2 py-1`:`px-3 py-1.5`),children:[(0,x.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs text-foreground`,children:[(0,x.jsx)(r,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,x.jsx)(`span`,{className:`font-medium`,children:l(e?`activity:terminal.labelSingular`:`activity:terminal.labelPlural`)}),(0,x.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:j||M||l(`activity:terminal.projectShell`)})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(`button`,{type:`button`,onClick:P,disabled:g.length>=C,title:g.length>=C?l(`activity:terminal.maxTerminals`,{count:C}):l(`activity:terminal.newTerminal`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,x.jsx)(c,{className:`h-4 w-4`})}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>z&&I(z.id),disabled:!z,title:l(`activity:terminal.restart`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,x.jsx)(s,{className:`h-3.5 w-3.5`})}),(0,x.jsx)(`button`,{type:`button`,onClick:L,disabled:g.length===0,title:l(`activity:terminal.closeAll`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,x.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,x.jsx)(`button`,{type:`button`,onClick:n,title:l(`activity:terminal.closeDock`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,x.jsx)(i,{className:`h-4 w-4`})})]})]}),(0,x.jsx)(`div`,{className:f(`flex min-w-0 items-center gap-1 overflow-x-auto border-b border-border/70 bg-[hsl(var(--surface-2)/0.45)]`,e?`px-1.5 py-0.5`:`px-2 py-1`),children:g.map(t=>(0,x.jsxs)(`div`,{className:f(`group inline-flex items-center rounded border text-xs transition-colors`,e?`h-6 min-w-[92px] max-w-[148px]`:`h-7 min-w-[112px] max-w-[180px]`,y===t.id?`border-primary/35 bg-primary/10 text-primary`:`border-transparent bg-transparent text-muted-foreground hover:bg-accent hover:text-foreground`),children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>S(t.id),title:t.status===`exited`?`${t.name} exited`:t.name,className:`inline-flex min-w-0 flex-1 items-center gap-2 px-2 text-left`,children:[(0,x.jsx)(`span`,{className:f(`h-1.5 w-1.5 shrink-0 rounded-full`,t.status===`running`&&`bg-success`,t.status===`starting`&&`bg-primary`,t.status===`exited`&&`bg-destructive`)}),(0,x.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[t.name,t.status===`exited`&&typeof t.exitCode==`number`?` (${t.exitCode})`:``]})]}),(0,x.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),F(t.id)},className:`mr-1 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground opacity-70 hover:bg-accent hover:text-foreground hover:opacity-100`,title:l(`activity:terminal.closeTab`,{name:t.name}),children:(0,x.jsx)(i,{className:`h-3 w-3`})})]},t.id))}),M&&!e&&(0,x.jsx)(`div`,{className:`min-w-0 truncate border-b border-border/60 bg-muted/30 px-3 py-1 text-[11px] font-mono text-muted-foreground`,children:M}),(0,x.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:g.map(e=>(0,x.jsx)(A,{id:e.id,active:e.id===y,onRunning:()=>R(e.id,{status:`running`}),onExit:t=>R(e.id,{status:`exited`,exitCode:t})},e.id))})]})}function A({id:e,active:t,onRunning:n,onExit:r}){let i=(0,v.useRef)(null),a=(0,v.useRef)(null),o=(0,v.useRef)(null),s=(0,v.useRef)(n),c=(0,v.useRef)(r),d=m(e=>e.wsConnected);return(0,v.useEffect)(()=>{s.current=n,c.current=r},[r,n]),(0,v.useEffect)(()=>{let t=i.current;if(!t)return;let n=new _({fontFamily:`"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:13,cursorBlink:!0,theme:S,scrollback:5e3}),r=new g;a.current=n,o.current=r,n.loadAddon(r),n.open(t);try{r.fit()}catch{}let d=u(m.getState().wsUrl);d.send({type:`terminal.create`,payload:{id:e,cols:n.cols,rows:n.rows}});let f=!1,p=d.on(`terminal.output`,t=>{t.type===`terminal.output`&&t.payload.id===e&&(f||(f=!0,s.current()),n.write(t.payload.data))}),h=d.on(`terminal.exit`,t=>{t.type===`terminal.exit`&&t.payload.id===e&&(n.write(`\r\n\x1b[2m${l.t(`activity:terminal.processExited`,{code:t.payload.exitCode})}\x1b[0m\r\n`),c.current(t.payload.exitCode))}),v=n.onData(t=>{d.send({type:`terminal.input`,payload:{id:e,data:t}})}),y=new ResizeObserver(()=>{if(t.offsetParent)try{r.fit(),d.send({type:`terminal.resize`,payload:{id:e,cols:n.cols,rows:n.rows}})}catch{}});return y.observe(t),()=>{p(),h(),v.dispose(),y.disconnect(),d.send({type:`terminal.close`,payload:{id:e}}),n.dispose(),a.current=null,o.current=null}},[e,d]),(0,v.useEffect)(()=>{t&&window.requestAnimationFrame(()=>{try{o.current?.fit();let t=a.current;t&&(u(m.getState().wsUrl).send({type:`terminal.resize`,payload:{id:e,cols:t.cols,rows:t.rows}}),t.focus())}catch{}})},[t,e]),(0,x.jsx)(`div`,{ref:i,className:f(`absolute inset-0 min-h-0 min-w-0 overflow-hidden px-2 py-1`,t?`block`:`hidden`)})}export{k as TerminalPanel};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ba as t,Fa as n,Gi as r,Li as i,Ot as a,Pa as o,Ra as s,dt as c,lt as l,xr as u}from"./vendor-GiKfK4Iw.js";import"./i18n-BvFgJYE2.js";import{n as d,t as f}from"./utils-CUCQrODG.js";var p=e(t(),1),m=l();function h(){return`toast_${d()}`}var g=8e3,_=o(e=>({toasts:[],push:t=>{let n=h();return e(e=>({toasts:[...e.toasts,{...t,id:n}]})),n},dismiss:t=>e(e=>({toasts:e.toasts.filter(e=>e.id!==t)}))})),v={success:(e,t=3500)=>_.getState().push({message:e,variant:`success`,ttl:t}),error:(e,t=6e3)=>_.getState().push({message:e,variant:`error`,ttl:t}),warn:(e,t=4500)=>_.getState().push({message:e,variant:`warn`,ttl:t}),info:(e,t=3500)=>_.getState().push({message:e,variant:`info`,ttl:t}),undoable:(e,t,n=s.t(`common:action.undo`),r=g)=>_.getState().push({message:e,variant:`info`,ttl:r,action:{label:n,onClick:t}}),dismiss:e=>_.getState().dismiss(e)};function y({variant:e}){return e===`success`?(0,m.jsx)(r,{className:`h-4 w-4 text-success`}):e===`error`?(0,m.jsx)(i,{className:`h-4 w-4 text-destructive`}):e===`warn`?(0,m.jsx)(a,{className:`h-4 w-4 text-warning`}):(0,m.jsx)(u,{className:`h-4 w-4 text-info`})}function b({entry:e}){let{t}=n(),r=_(e=>e.dismiss);return(0,p.useEffect)(()=>{let t=setTimeout(()=>r(e.id),e.ttl);return()=>clearTimeout(t)},[e.id,e.ttl,r]),(0,m.jsxs)(`div`,{className:f(`flex items-start gap-2 rounded-lg border bg-popover shadow-lg px-3 py-2 text-sm max-w-sm`,`animate-message`,e.variant===`error`&&`border-destructive/40`,e.variant===`warn`&&`border-warning/40`,e.variant===`success`&&`border-success/40`),children:[(0,m.jsx)(y,{variant:e.variant}),(0,m.jsx)(`div`,{className:`flex-1 min-w-0 whitespace-pre-wrap break-words leading-snug`,children:e.message}),e.action&&(0,m.jsx)(`button`,{type:`button`,onClick:()=>{e.action?.onClick(),r(e.id)},className:`shrink-0 font-medium text-primary hover:underline`,children:e.action.label}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:`text-muted-foreground hover:text-foreground`,title:t(`activity:toast.dismiss`),"aria-label":t(`activity:toast.dismiss`),children:(0,m.jsx)(c,{className:`h-3.5 w-3.5`})})]})}function x(){let{t:e}=n(),t=_(e=>e.toasts);return t.length===0?null:(0,m.jsx)(`section`,{className:`fixed bottom-4 right-4 z-[60] flex flex-col gap-2 pointer-events-auto`,"aria-label":e(`activity:toaster.notifications`),"aria-live":`polite`,children:t.map(e=>(0,m.jsx)(b,{entry:e},e.id))})}export{v as n,x as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Fa as t,Ia as n,Ki as r,Li as i,Ot as a,Va as o,dt as s,lt as c,xr as l,za as u}from"./vendor-AeHpGMaG.js";import"./i18n-nlW2iAya.js";import{n as d,t as f}from"./utils-D1fGupR8.js";var p=e(o(),1),m=c();function h(){return`toast_${d()}`}var g=8e3,_=t(e=>({toasts:[],push:t=>{let n=h();return e(e=>({toasts:[...e.toasts,{...t,id:n}]})),n},dismiss:t=>e(e=>({toasts:e.toasts.filter(e=>e.id!==t)}))})),v={success:(e,t=3500)=>_.getState().push({message:e,variant:`success`,ttl:t}),error:(e,t=6e3)=>_.getState().push({message:e,variant:`error`,ttl:t}),warn:(e,t=4500)=>_.getState().push({message:e,variant:`warn`,ttl:t}),info:(e,t=3500)=>_.getState().push({message:e,variant:`info`,ttl:t}),undoable:(e,t,n=u.t(`common:action.undo`),r=g)=>_.getState().push({message:e,variant:`info`,ttl:r,action:{label:n,onClick:t}}),dismiss:e=>_.getState().dismiss(e)};function y({variant:e}){return e===`success`?(0,m.jsx)(r,{className:`h-4 w-4 text-success`}):e===`error`?(0,m.jsx)(i,{className:`h-4 w-4 text-destructive`}):e===`warn`?(0,m.jsx)(a,{className:`h-4 w-4 text-warning`}):(0,m.jsx)(l,{className:`h-4 w-4 text-info`})}function b({entry:e}){let{t}=n(),r=_(e=>e.dismiss);return(0,p.useEffect)(()=>{let t=setTimeout(()=>r(e.id),e.ttl);return()=>clearTimeout(t)},[e.id,e.ttl,r]),(0,m.jsxs)(`div`,{className:f(`flex items-start gap-2 rounded-lg border bg-popover shadow-lg px-3 py-2 text-sm max-w-sm`,`animate-message`,e.variant===`error`&&`border-destructive/40`,e.variant===`warn`&&`border-warning/40`,e.variant===`success`&&`border-success/40`),children:[(0,m.jsx)(y,{variant:e.variant}),(0,m.jsx)(`div`,{className:`flex-1 min-w-0 whitespace-pre-wrap break-words leading-snug`,children:e.message}),e.action&&(0,m.jsx)(`button`,{type:`button`,onClick:()=>{e.action?.onClick(),r(e.id)},className:`shrink-0 font-medium text-primary hover:underline`,children:e.action.label}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:`text-muted-foreground hover:text-foreground`,title:t(`activity:toast.dismiss`),"aria-label":t(`activity:toast.dismiss`),children:(0,m.jsx)(s,{className:`h-3.5 w-3.5`})})]})}function x(){let{t:e}=n(),t=_(e=>e.toasts);return t.length===0?null:(0,m.jsx)(`section`,{className:`fixed bottom-4 right-4 z-[60] flex flex-col gap-2 pointer-events-auto`,"aria-label":e(`activity:toaster.notifications`),"aria-live":`polite`,children:t.map(e=>(0,m.jsx)(b,{entry:e},e.id))})}export{v as n,x as t};