@wrongstack/webui 0.299.0 → 0.301.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AgentRosterView-BV6ysoGs.js +9 -0
- package/dist/assets/{AnalyticsDashboard-D58kSekC.js → AnalyticsDashboard-UWNP8zjE.js} +1 -1
- package/dist/assets/AudienceMemoryPanel-DwDKbvSA.js +3 -0
- package/dist/assets/ChangesView-DuVlGWkD.js +1 -0
- package/dist/assets/ChronicleDashboard-cs16n708.js +1 -0
- package/dist/assets/CodeEditor-sr50ljZN.js +1 -0
- package/dist/assets/CodeMap-CtK-C8gK.js +1 -0
- package/dist/assets/ConfirmModal-ndS17YwF.js +1 -0
- package/dist/assets/CronJobsPanel-Dovomns5.js +1 -0
- package/dist/assets/DeadCodeScanPanel-DjR4LLMs.js +2 -0
- package/dist/assets/DebugDashboard-jK1yp3qS.js +1 -0
- package/dist/assets/DesignGalleryView-CqXlEUzE.js +1 -0
- package/dist/assets/GoalView-CGNLrnA4.js +1 -0
- package/dist/assets/KanbanView--tAf_K7N.js +3 -0
- package/dist/assets/{MailboxDetailView-ZcKcOEAe.js → MailboxDetailView-0TBzZTdN.js} +1 -1
- package/dist/assets/MemoryManager-CDK_MO8A.js +1 -0
- package/dist/assets/{ModelPicker-DvNLZzkm.js → ModelPicker-BbBZuQwR.js} +1 -1
- package/dist/assets/OfficeMapPanel-68sVzHRD.js +4 -0
- package/dist/assets/OfficeMapPanel-D6yTfGIT.css +1 -0
- package/dist/assets/{ProcessMonitor-2nSk6sXA.js → ProcessMonitor-gFwiF8gX.js} +1 -1
- package/dist/assets/{QueuePanel-4KBBWFxj.js → QueuePanel-Cx-isRGl.js} +1 -1
- package/dist/assets/{RefreshDebugView-D3XnE53y.js → RefreshDebugView-C9tdu6Ld.js} +1 -1
- package/dist/assets/RequirementIntakeView-cPEw-RpV.js +1 -0
- package/dist/assets/SageTabs-BbK6VFO0.js +2 -0
- package/dist/assets/SddHub-NKvDRECi.js +2 -0
- package/dist/assets/SessionInspectView-DPG5qWhj.js +1 -0
- package/dist/assets/SessionList-ncl-20X_.js +1 -0
- package/dist/assets/SessionsDashboard-D23UVLr4.js +1 -0
- package/dist/assets/SetupScreen-D3XQ8MGk.js +1 -0
- package/dist/assets/{SkillDetailView-D7EQ2XtV.js → SkillDetailView-DDPhVFet.js} +1 -1
- package/dist/assets/SpecsView-afIS0QpX.js +1 -0
- package/dist/assets/TechStackView-kQ2OGxxw.js +1 -0
- package/dist/assets/{TerminalPanel-BL9ZPGJt.js → TerminalPanel-GcJWeldW.js} +1 -1
- package/dist/assets/{Toaster-CJI70aa-.js → Toaster-CgQA9256.js} +1 -1
- package/dist/assets/activity-B-cvKIfT.js +9 -0
- package/dist/assets/activity-Ba3aMzvo.js +9 -0
- package/dist/assets/activity-CRTVZ5A4.js +9 -0
- package/dist/assets/activity-DsSuflRW.js +9 -0
- package/dist/assets/activity-DxDRJ8kN.js +9 -0
- package/dist/assets/activity-VI776bUZ.js +9 -0
- package/dist/assets/activity-nVmsmqAI.js +9 -0
- package/dist/assets/chat-BPuAsrkF.js +1 -0
- package/dist/assets/chat-BfQBSiII.js +1 -0
- package/dist/assets/chat-BnkVCZ3Q.js +1 -0
- package/dist/assets/chat-CR2B97dj.js +1 -0
- package/dist/assets/chat-CdiY7G6Z.js +1 -0
- package/dist/assets/chat-DResBrkV.js +1 -0
- package/dist/assets/chat-Di8o0wDz.js +1 -0
- package/dist/assets/chat-store-DbxFVDwi.js +17 -0
- package/dist/assets/{common-DMM-xyW3.js → common-BXJbu5Y-.js} +1 -1
- package/dist/assets/{common-C9ikgX7d.js → common-BiNu_WzQ.js} +1 -1
- package/dist/assets/common-COVxQ0FV.js +1 -0
- package/dist/assets/{common-D29Zdkxb.js → common-Ch7JihXD.js} +1 -1
- package/dist/assets/{common-DoUBSHRY.js → common-DPaTeTls.js} +1 -1
- package/dist/assets/{common-vdwxzODB.js → common-DdGpRh8j.js} +1 -1
- package/dist/assets/{common-C5hY-d_0.js → common-pI6fYZW3.js} +1 -1
- package/dist/assets/i18n-COgumVF5.js +2 -0
- package/dist/assets/index-CtpViiZy.js +132 -0
- package/dist/assets/index-fIsq43fR.css +1 -0
- package/dist/assets/mailbox-store-C1mzoSqJ.js +1 -0
- package/dist/assets/{progress-ring-61A-xUEl.js → progress-ring-D_48qsBl.js} +1 -1
- package/dist/assets/{roster-ws-Dfg_187V.js → roster-ws-Da57e_sI.js} +1 -1
- package/dist/assets/session-store-Df7_hhe9.js +1 -0
- package/dist/assets/settings-Bb7_utQE.js +1 -0
- package/dist/assets/settings-Bd8zMwvC.js +1 -0
- package/dist/assets/settings-DdFgBMAw.js +1 -0
- package/dist/assets/settings-De6sXIFO.js +1 -0
- package/dist/assets/settings-E8SKMLxq.js +1 -0
- package/dist/assets/settings-zIY9-ivF.js +1 -0
- package/dist/assets/settings-zKBcRjqE.js +1 -0
- package/dist/assets/stores-ChEnUmic.js +7 -0
- package/dist/assets/ui-store-CE4-TlwB.js +1 -0
- package/dist/assets/useWebSocket-_gk4MRJz.js +29 -0
- package/dist/assets/{view-navigation-DxfiZrXS.js → view-navigation-DIDEcp4V.js} +1 -1
- package/dist/assets/ws-client-TTMa0XaT.js +1 -0
- package/dist/components/AgentCard.d.ts +21 -0
- package/dist/components/AgentsPage.d.ts +0 -3
- package/dist/components/AutonomyPicker.d.ts +1 -1
- package/dist/components/ChatInput/refine-panel-host.d.ts +2 -2
- package/dist/components/ChatView/auto-collapse.d.ts +42 -0
- package/dist/components/ConfirmModal.d.ts +7 -2
- package/dist/components/FallbackModal.d.ts +2 -0
- package/dist/components/KanbanBoardState.d.ts +1 -1
- package/dist/components/KanbanVerificationDashboard.d.ts +0 -6
- package/dist/components/SettingsPanel/PluginToggleList.d.ts +11 -3
- package/dist/components/SettingsPanel/ShadowSection.d.ts +18 -1
- package/dist/components/SettingsPanel/brain-section-options.d.ts +27 -55
- package/dist/components/TaskCard.d.ts +0 -1
- package/dist/components/TaskRiskPanel.d.ts +10 -3
- package/dist/components/TechStackView/shared.d.ts +11 -6
- package/dist/components/ThemeProvider.d.ts +6 -1
- package/dist/components/agent-roster-data.d.ts +2 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/hooks/useWebSocket.d.ts +10 -2
- package/dist/hooks/ws-handlers/files-mailbox-handlers.d.ts +1 -0
- package/dist/hooks/ws-handlers/misc-handlers.d.ts +13 -0
- package/dist/hooks/ws-handlers/session-handlers.d.ts +1 -0
- package/dist/index.css +62 -0
- package/dist/index.html +18 -17
- package/dist/index.js +26640 -12728
- package/dist/lib/file-icons.d.ts +3 -3
- package/dist/lib/kanban-board-active.d.ts +19 -0
- package/dist/lib/palettes.d.ts +37 -0
- package/dist/lib/plugin-enablement.d.ts +1 -1
- package/dist/lib/ws-client.d.ts +24 -4
- package/dist/providers.json +7 -7
- package/dist/stores/config-store.d.ts +9 -1
- package/dist/stores/context-editor-store.d.ts +9 -1
- package/dist/stores/fallback-store.d.ts +30 -0
- package/dist/stores/fleet-store.d.ts +14 -1
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/local-prefs.d.ts +13 -0
- package/dist/stores/mailbox-store.d.ts +2 -0
- package/dist/stores/session-store.d.ts +9 -1
- package/dist/stores/ui-store.d.ts +2 -0
- package/dist/types/brain.d.ts +2 -0
- package/dist/types/client-message.d.ts +19 -2
- package/dist/types/protocol-core.d.ts +21 -0
- package/dist/types/runtime.d.ts +22 -0
- package/dist/types/server-message.d.ts +15 -4
- package/package.json +9 -9
- package/dist/assets/AgentRosterView-BqojERFR.js +0 -11
- package/dist/assets/AudienceMemoryPanel-Cc1UkbDl.js +0 -3
- package/dist/assets/ChangesView-BKU80ANq.js +0 -1
- package/dist/assets/ChronicleDashboard-CvCS1Dj1.js +0 -1
- package/dist/assets/CodeEditor-BHZQhx_8.js +0 -1
- package/dist/assets/CodeMap-qllGEFLB.js +0 -1
- package/dist/assets/CronJobsPanel-DD5mhZ4Q.js +0 -1
- package/dist/assets/DeadCodeScanPanel-PB-c8et_.js +0 -2
- package/dist/assets/DebugDashboard-Q8QiVflQ.js +0 -1
- package/dist/assets/DesignGalleryView-CGOtWO7s.js +0 -1
- package/dist/assets/GoalView-Dlk42vW7.js +0 -1
- package/dist/assets/KanbanView-DIP6kKmU.js +0 -3
- package/dist/assets/MemoryManager-B7620q_K.js +0 -1
- package/dist/assets/OfficeMapPanel-BFIF-EMt.css +0 -1
- package/dist/assets/OfficeMapPanel-DKJNTtOZ.js +0 -4
- package/dist/assets/RequirementIntakeView-BMxlf8bt.js +0 -1
- package/dist/assets/SageTabs-g1hO2hJ0.js +0 -2
- package/dist/assets/SddHub-Kv_TbTgT.js +0 -2
- package/dist/assets/SessionInspectView-PnKTvyvP.js +0 -1
- package/dist/assets/SessionList-BeinIC-h.js +0 -1
- package/dist/assets/SessionsDashboard-DEG_BylE.js +0 -1
- package/dist/assets/SetupScreen-DxJwZ1OZ.js +0 -1
- package/dist/assets/SpecsView-Fm7pYYcj.js +0 -1
- package/dist/assets/TechStackView-Bo_UenRF.js +0 -1
- package/dist/assets/activity-BCgOEWgR.js +0 -5
- package/dist/assets/activity-BQ0zqkw2.js +0 -5
- package/dist/assets/activity-CAovbq3e.js +0 -5
- package/dist/assets/activity-CFQyCvgu.js +0 -5
- package/dist/assets/activity-CdQf7zRK.js +0 -5
- package/dist/assets/activity-DACvyn2-.js +0 -5
- package/dist/assets/activity-DOwYydU-.js +0 -5
- package/dist/assets/chat-CRmMDzCb.js +0 -1
- package/dist/assets/chat-CwnuX7tG.js +0 -1
- package/dist/assets/chat-DLn1hY01.js +0 -1
- package/dist/assets/chat-DSEq1Bdz.js +0 -1
- package/dist/assets/chat-DxLD17ER.js +0 -1
- package/dist/assets/chat-DzPxYALH.js +0 -1
- package/dist/assets/chat-OunddzYy.js +0 -1
- package/dist/assets/chat-store-CtOyUCdF.js +0 -17
- package/dist/assets/common-BfVFjVhf.js +0 -1
- package/dist/assets/i18n-B0hsnanh.js +0 -2
- package/dist/assets/index-DHdO0CRE.js +0 -132
- package/dist/assets/index-DKrFQ76m.css +0 -1
- package/dist/assets/mailbox-store-D8TvJsuk.js +0 -1
- package/dist/assets/session-store-b2KGFwkX.js +0 -1
- package/dist/assets/settings-B5xal2R3.js +0 -1
- package/dist/assets/settings-BHtFy8EG.js +0 -1
- package/dist/assets/settings-Bss5hBla.js +0 -1
- package/dist/assets/settings-BzrLCVRP.js +0 -1
- package/dist/assets/settings-C7RdvmLZ.js +0 -1
- package/dist/assets/settings-Dd94HoV6.js +0 -1
- package/dist/assets/settings-Dm9THFe8.js +0 -1
- package/dist/assets/stores-BptlyD_v.js +0 -7
- package/dist/assets/ui-store-BsBnjO3w.js +0 -1
- package/dist/assets/useWebSocket-Bc4S0N4r.js +0 -29
- package/dist/assets/ws-client-DqFoX4jJ.js +0 -1
- package/dist/components/AgentsMonitor.d.ts +0 -26
- package/dist/components/FleetMonitor.d.ts +0 -21
- package/dist/lib/accent-colors.d.ts +0 -136
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$i as t,Ar as n,Cn as r,Jt as i,La as a,Pa as o,Pr as s,Qi as c,Si as l,Wt as u,Xi as d,di as f,en as p,ir as m,ja as h,la as g,lt as _,t as v,vn as y,ya as b,yr as x,za as S}from"./vendor-BuarzSSb.js";import"./i18n-COgumVF5.js";import{t as ee}from"./useWebSocket-_gk4MRJz.js";import{t as C}from"./ws-client-TTMa0XaT.js";import{t as w}from"./utils-B-9lSDIn.js";import{I as te}from"./stores-ChEnUmic.js";import{o as T}from"./view-navigation-DIDEcp4V.js";import{n as E}from"./Toaster-CgQA9256.js";import{a as D,n as ne,o as re,r as O,t as k}from"./dialog-ftgTihmF.js";import{t as A}from"./button-Dcy288Mc.js";import{t as j}from"./input-fo9-BPBC.js";import{D as M,a as N,b as P,i as F,r as I,t as L,x as R}from"./index-CtpViiZy.js";var z=e(S(),1);function B(e,t=8e3){return new Promise((n,r)=>{let i=setTimeout(()=>{a(),r(Error(`timeout`))},t),a=e.on(`key.operation_result`,e=>{clearTimeout(i),a(),n(e.payload)})})}var V=_();function ie({onKeySaved:e}){let{t}=o(),[n,i]=(0,z.useState)(!1),[a,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(`openai-compatible`),[u,f]=(0,z.useState)(``),[p,h]=(0,z.useState)(``),[g,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)([]),{setFieldRef:b,handleKeyDown:x}=N(),S=async()=>{if(a.trim()){_(!0);try{let n=C(te.getState().wsUrl),r=B(n);n.send({type:`provider.add`,payload:{id:a.trim(),family:c,baseUrl:u.trim()||void 0,apiKey:p.trim()||void 0,models:v.length>0?v.map(e=>e.id):void 0,customModels:v.length>0?Object.fromEntries(v.filter(e=>e.name||e.maxOutput||e.capabilities).map(e=>[e.id,{...e.name&&e.name!==e.id?{name:e.name}:{},...e.maxOutput?{maxOutput:e.maxOutput}:{},...e.capabilities&&Object.values(e.capabilities).some(Boolean)?{capabilities:e.capabilities}:{}}])):void 0}});let o=await r;if(!o.success)throw Error(o.message);E.success(t(`setup:screen.toasts.providerAdded`,{id:a.trim()})),e(a.trim()),n.listSavedProviders(),n.probeProvider(a.trim()),s(``),f(``),h(``),y([]),i(!1)}catch(e){let n=e instanceof Error&&e.message&&e.message!==`timeout`?e.message:null;E.error(n??t(`setup:screen.toasts.providerAddFailed`))}finally{_(!1)}}};return(0,V.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/60 overflow-hidden`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>i(!n),className:`w-full flex items-center gap-3 p-4 text-left hover:bg-muted/30 transition-colors`,children:[(0,V.jsx)(`div`,{className:`w-10 h-10 rounded-lg bg-muted/50 flex items-center justify-center`,children:(0,V.jsx)(r,{className:`h-5 w-5 text-muted-foreground`})}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium`,children:t(`setup:screen.custom.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`setup:screen.custom.description`)})]}),(0,V.jsx)(d,{className:w(`h-4 w-4 text-muted-foreground transition-transform`,n&&`rotate-90`)})]}),n&&(0,V.jsxs)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/40`,children:[(0,V.jsxs)(`div`,{className:`space-y-1.5 pt-3`,children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground block`,children:t(`setup:screen.custom.localServers`)}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:I.map(e=>(0,V.jsx)(A,{type:`button`,size:`sm`,variant:a===e.id?`default`:`outline`,onClick:()=>{s(e.id),l(`openai-compatible`),f(e.defaultBaseUrl),e.noAuth&&h(``),y([])},title:e.hint,children:e.label},e.id))})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.providerId`)}),(0,V.jsx)(j,{placeholder:t(`activity:customProviderSection.eGMyLlm`),value:a,onChange:e=>s(e.target.value),className:`text-sm`,ref:b(0),onKeyDown:e=>x(e,0)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.family`)}),(0,V.jsxs)(`select`,{value:c,onChange:e=>l(e.target.value),className:`flex h-9 w-full rounded-md border border-input bg-transparent px-3 text-sm`,ref:b(1),onKeyDown:e=>x(e,1),children:[(0,V.jsx)(`option`,{value:`openai-compatible`,children:t(`setup:screen.custom.familyOpenAiCompatible`)}),(0,V.jsx)(`option`,{value:`openai`,children:`OpenAI`}),(0,V.jsx)(`option`,{value:`anthropic`,children:`Anthropic`}),(0,V.jsx)(`option`,{value:`google`,children:`Google`})]})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.baseUrl`)}),(0,V.jsx)(j,{placeholder:t(`activity:customProviderSection.eGHttpLocalhost11434V1`),value:u,onChange:e=>f(e.target.value),className:`text-sm font-mono`,ref:b(2),onKeyDown:e=>x(e,2)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.apiKey`)}),(0,V.jsx)(j,{type:`password`,placeholder:t(`setup:screen.custom.apiKeyPlaceholder`),value:p,onChange:e=>h(e.target.value),className:`text-sm font-mono`,ref:b(3),onKeyDown:e=>x(e,3)})]}),(0,V.jsx)(L,{models:v,onChange:y}),(0,V.jsxs)(A,{onClick:S,disabled:!a.trim()||g,size:`sm`,ref:b(4),onKeyDown:e=>x(e,4,S),children:[g?(0,V.jsx)(m,{className:`h-4 w-4 animate-spin mr-2`}):null,t(`setup:screen.custom.add`)]})]})]})}var H=F();async function ae(e,t){try{let n=await fetch(e,{signal:t});if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();if(!Array.isArray(r))throw Error(`Expected JSON array`);let i=r.filter(e=>typeof e.id==`string`&&typeof e.name==`string`&&typeof e.family==`string`);return i.length>0?i:H}catch{return H}}function oe(e,t){let n=new Date().getTime()-e.getTime(),r=Math.floor(n/1e3);if(r<10)return t(`setup:screen.time.justNow`);if(r<60)return t(`setup:screen.time.secondsAgo`,{count:r});let i=Math.floor(r/60);if(i<60)return t(`setup:screen.time.minutesAgo`,{count:i});let a=Math.floor(i/60);return a<24?t(`setup:screen.time.hoursAgo`,{count:a}):t(`setup:screen.time.daysAgo`,{count:Math.floor(a/24)})}var se=e(v(),1);function ce({popular:e,catalogProvider:n,savedProvider:r,onKeySaved:i,probeResult:a}){let{t:u}=o(),[h,g]=(0,z.useState)(``),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)(!!r?.apiKeys.some(e=>e.isActive)),[x,S]=(0,z.useState)(!1),[ee,T]=(0,z.useState)(!1),[M,N]=(0,z.useState)(!1),[P,F]=(0,z.useState)(null);(0,z.useEffect)(()=>{M&&e.referral&&se.toDataURL(e.referral.url,{width:200,margin:2,color:{dark:`#000000`,light:`#ffffff`}}).then(e=>F(e)).catch(()=>F(null))},[M,e.referral]);let I=async()=>{if(h.trim()){v(!0);try{let t=C(te.getState().wsUrl),r=B(t);n?t.addKey(e.id,`default`,h.trim()):t.send({type:`provider.add`,payload:{id:e.id,family:e.family,apiKey:h.trim()}});let a=await r;if(!a.success)throw Error(a.message);b(!0),g(``),E.success(u(`setup:screen.toasts.keySaved`,{name:e.name})),i(e.id),t.listSavedProviders(),t.probeProvider(e.id)}catch(t){let n=t instanceof Error&&t.message&&t.message!==`timeout`?t.message:null;E.error(n??u(`setup:screen.toasts.keySaveFailed`,{name:e.name}))}finally{v(!1)}}},L=e=>{e.key===`Enter`&&h.trim()&&I()},R=async()=>{if(e.referral)try{await navigator.clipboard.writeText(e.referral.url),T(!0),E.success(u(`setup:screen.toasts.referralCopied`)),setTimeout(()=>T(!1),2e3)}catch{E.error(u(`setup:screen.toasts.referralCopyFailed`))}},ie=n&&n.modelCount>0;return(0,V.jsxs)(`div`,{className:w(`rounded-xl border p-4 transition-all`,y?`border-success/30 bg-success/5`:`bg-gradient-to-br ${e.color}`),children:[(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(`span`,{className:`text-2xl shrink-0 mt-0.5`,children:e.icon}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),y&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-success/10 text-success border border-success/20`,children:[(0,V.jsx)(t,{className:`h-2.5 w-2.5`}),u(`setup:screen.card.keySaved`)]}),e.referral&&!y&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-warning/10 text-warning border border-warning/20`,children:[(0,V.jsx)(s,{className:`h-2.5 w-2.5`}),u(`setup:screen.card.referral`)]})]}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),e.referral&&!y&&(0,V.jsxs)(`p`,{className:`text-[11px] text-warning/80 mt-1`,children:[`🎁 `,e.referral.reward]}),y?y?(0,V.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[r?.baseUrl&&(0,V.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70 font-mono truncate`,title:r.baseUrl,children:[(0,V.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[u(`activity:providerKey.url`),` `]}),r.baseUrl]}),r?.models&&r.models.length>0&&(0,V.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70`,children:[(0,V.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[u(`activity:providerKey.models`),` `]}),r.pickedModelId??r.models[0],(0,V.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[` (+`,r.models.length-1,` more)`]})]}),a===`probing`?(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground mt-1`,children:[(0,V.jsx)(m,{className:`h-3 w-3 animate-spin`}),u(`setup:screen.probe.checking`,`Checking connection…`)]}):a?.ok?(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-success mt-1`,children:[(0,V.jsx)(t,{className:`h-3 w-3`}),(0,V.jsxs)(`span`,{children:[u(`setup:screen.probe.connected`,`Connected`),a.modelCount!=null&&` · ${a.modelCount} ${u(`setup:screen.probe.models`,`models`)}`,a.elapsedMs!=null&&` · ${a.elapsedMs}ms`]})]}):a&&!a.ok?(0,V.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-destructive mt-1`,children:[(0,V.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:`✕`}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:u(`setup:screen.probe.failed`,`Probe failed`)}),a.status===`no_base_url`&&(0,V.jsx)(`span`,{className:`block text-destructive/70`,children:u(`setup:screen.probe.noBaseUrl`,`No base URL configured`)}),a.status===`unreachable`&&(0,V.jsxs)(`span`,{className:`block text-destructive/70`,children:[u(`setup:screen.probe.unreachable`,`Could not connect`),a.detail?`: ${a.detail}`:``]}),a.status!==`no_base_url`&&a.status!==`unreachable`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`block text-destructive/70`,children:a.httpStatus==null?a.status:`${u(`setup:screen.probe.httpStatus`,`Status`)} ${a.httpStatus}`}),a.detail&&(0,V.jsx)(`span`,{className:`block text-destructive/70 truncate max-w-[250px]`,title:a.detail,children:a.detail})]})]})]}):null,ie&&(0,V.jsxs)(`button`,{type:`button`,onClick:()=>S(!x),className:`text-[11px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1`,children:[u(`setup:screen.providers.modelsAvailable`,{count:n?.modelCount??0}),x?(0,V.jsx)(c,{className:`h-3 w-3`}):(0,V.jsx)(d,{className:`h-3 w-3`})]})]}):null:(0,V.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(j,{type:`password`,placeholder:e.keyPlaceholder,value:h,onChange:e=>g(e.target.value),onKeyDown:L,className:`font-mono text-sm`}),(0,V.jsx)(A,{onClick:I,disabled:!h.trim()||_,size:`sm`,className:`shrink-0`,children:_?(0,V.jsx)(m,{className:`h-4 w-4 animate-spin`}):u(`setup:screen.card.save`)})]}),e.docsUrl&&(0,V.jsxs)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors`,children:[u(`setup:screen.card.getKey`),` `,(0,V.jsx)(f,{className:`h-3 w-3`})]}),e.referral&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:R,className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:ee?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(t,{className:`h-3 w-3`}),` `,u(`setup:screen.card.copied`)]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(l,{className:`h-3 w-3`}),` `,u(`setup:screen.card.copyReferral`)]})}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>N(!0),className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:[(0,V.jsx)(p,{className:`h-3 w-3`}),` `,u(`setup:screen.card.share`)]})]})]})]})]}),(0,V.jsx)(k,{open:M,onOpenChange:N,children:(0,V.jsxs)(ne,{className:`sm:max-w-md`,children:[(0,V.jsxs)(D,{children:[(0,V.jsxs)(re,{className:`flex items-center gap-2`,children:[(0,V.jsx)(s,{className:`h-4 w-4 text-warning`}),u(`setup:screen.share.title`,{name:e.name})]}),(0,V.jsx)(O,{children:u(`setup:screen.share.description`)})]}),(0,V.jsx)(`div`,{className:`flex flex-col items-center gap-4 py-4`,children:e.referral&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`text-sm text-center`,children:(0,V.jsxs)(`p`,{className:`font-medium text-warning`,children:[`🎁 `,e.referral.reward]})}),P?(0,V.jsx)(`div`,{className:`rounded-lg border border-border p-2 bg-white`,children:(0,V.jsx)(`img`,{src:P,alt:u(`setup:screen.card.qrAlt`,{name:e.name}),className:`w-[200px] h-[200px]`})}):(0,V.jsx)(`div`,{className:`w-[200px] h-[200px] rounded-lg border border-border flex items-center justify-center bg-muted`,children:(0,V.jsx)(m,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),(0,V.jsxs)(`div`,{className:`w-full space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://twitter.com/intent/tweet?text=${t}&url=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:u(`setup:screen.share.twitter`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z`})}),`X`]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`Check out ${e.name}! ${e.referral.reward}`);window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${t}&summary=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:u(`setup:screen.share.linkedin`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z`})}),u(`activity:providerKey.linkedin`)]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward} ${e.referral.url}`);window.open(`https://t.me/share/url?url=${t}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:u(`setup:screen.share.telegram`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z`})}),u(`activity:providerKey.telegram`)]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://wa.me/?text=${t}%20${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:u(`setup:screen.share.whatsapp`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.134 1.585 5.934L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z`})}),u(`activity:providerKey.whatsapp`)]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`${e.name} - ${e.referral.reward}`);window.open(`https://www.reddit.com/submit?url=${t}&title=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:u(`setup:screen.share.reddit`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm5.01 4.744c.688 0 1.25.561 1.25 1.249a1.25 1.25 0 0 1-2.498.056l-2.597-.547-.8 3.747c1.824.07 3.48.632 4.674 1.488.308-.309.73-.491 1.207-.491.968 0 1.754.786 1.754 1.754 0 .716-.435 1.333-1.01 1.614a3.111 3.111 0 0 1 .042.52c0 2.694-3.13 4.87-7.004 4.87-3.874 0-7.004-2.176-7.004-4.87 0-.183.015-.366.043-.534A1.748 1.748 0 0 1 4.028 12c0-.968.786-1.754 1.754-1.754.463 0 .898.196 1.207.49 1.207-.883 2.878-1.43 4.744-1.487l.885-4.182a.342.342 0 0 1 .14-.197.35.35 0 0 1 .238-.042l2.906.617a1.214 1.214 0 0 0 1.108-.701 1.25 1.25 0 0 1 2.144.33zm-8.811 8.748c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754zm7.944 0c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754z`})}),u(`activity:providerKey.reddit`)]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://www.facebook.com/sharer/sharer.php?u=${n}"e=${t}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:u(`setup:screen.share.facebook`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z`})}),u(`activity:providerKey.facebook`)]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`mailto:?subject=${t}&body=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs hover:bg-muted/80 transition-colors`,title:u(`setup:screen.share.email`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25H4.5a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75`})}),u(`activity:providerKey.email`)]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(j,{value:e.referral.url,readOnly:!0,className:`font-mono text-xs flex-1`}),(0,V.jsx)(A,{size:`sm`,variant:`outline`,onClick:R,className:`shrink-0`,children:ee?(0,V.jsx)(t,{className:`h-4 w-4`}):(0,V.jsx)(l,{className:`h-4 w-4`})})]}),(0,V.jsx)(`p`,{className:`text-[11px] text-muted-foreground text-center`,children:u(`setup:screen.share.hint`)})]})]})})]})})]})}function U(){let{t:e}=o(),{model:r,setProvider:s,setModel:c,wsConnected:l,wsUrl:f}=te(h(e=>({model:e.model,setProvider:e.setProvider,setModel:e.setModel,wsConnected:e.wsConnected,wsUrl:e.wsUrl})));ee();let[p,_]=(0,z.useState)([]),[v,S]=(0,z.useState)({}),[D,ne]=(0,z.useState)([]),[re,O]=(0,z.useState)(!1),[k,j]=(0,z.useState)(null),[N,F]=(0,z.useState)(0),[I,L]=(0,z.useState)(new Set),[B,se]=(0,z.useState)({}),[U,le]=(0,z.useState)(H),[W,G]=(0,z.useState)(!1),[ue,de]=(0,z.useState)(0),[fe,pe]=(0,z.useState)(0),[K,me]=(0,z.useState)(null),q=(0,z.useRef)(!0);(0,z.useEffect)(()=>{let e=new AbortController,t=`${window.location.origin}/providers.json`;return G(!0),ae(t,e.signal).then(t=>{if(t!==H){if(le(t),G(!1),!q.current){let e=t.length-fe;e>0?E.success(a.t(`setup:screen.toasts.providersLoadedNew`,{count:t.length,diff:e})):e<0?E.success(a.t(`setup:screen.toasts.providersLoadedRemoved`,{count:t.length,diff:Math.abs(e)})):E.success(a.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:t.length})),pe(t.length)}me(new Date);return}return ae(`https://raw.githubusercontent.com/WrongStack/WrongStack/main/packages/webui/public/providers.json`,e.signal)}).then(e=>{if(e){if(le(e),!q.current){let t=e.length-fe;t>0?E.success(a.t(`setup:screen.toasts.providersLoadedNew`,{count:e.length,diff:t})):t<0?E.success(a.t(`setup:screen.toasts.providersLoadedRemoved`,{count:e.length,diff:Math.abs(t)})):E.success(a.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:e.length})),pe(e.length)}me(new Date)}}).catch(()=>{q.current||E.error(a.t(`setup:screen.toasts.providersRefreshFailed`))}).finally(()=>{G(!1),q.current=!1}),()=>e.abort()},[ue]);let[J,he]=(0,z.useState)(null),[Y,X]=(0,z.useState)(null),[ge,_e]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(!l)return;let e=C(f),t=setTimeout(()=>{t=null,O(!1),j(a.t(`setup:screen.errors.backendNotResponding`))},8e3),n=()=>{t&&=(clearTimeout(t),null)},i=e.on(`provider.catalog`,e=>{if(e.type===`provider.catalog`){n(),j(null);let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));_(t),O(!1)}}),o=e.on(`provider.models`,e=>{if(e.type===`provider.models`){let t=e.payload;if(t.provider!==J)return;S(e=>({...e,[t.provider]:t.models})),_e(!1),t.models.length===1?X(t.models[0].id):r&&t.models.some(e=>e.id===r)&&X(r)}}),s=e.on(`providers.saved`,e=>{if(e.type===`providers.saved`){let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));ne(t);let n=new Set(t.filter(e=>e.apiKeys.some(e=>e.isActive)).map(e=>e.id));L(n)}}),c=e.on(`provider.probe`,e=>{if(e.type!==`provider.probe`)return;let t=e.payload;se(e=>({...e,[t.providerId]:t}))});return j(null),O(!0),e.listProviders(),()=>{n(),i?.(),o?.(),s?.(),c?.()}},[l,f,r,N,J]);let ve=(0,z.useCallback)(()=>{j(null),F(e=>e+1)},[]),ye=(0,z.useCallback)(()=>{de(e=>e+1)},[]),be=(0,z.useCallback)(t=>oe(t,e),[e]),Z=(0,z.useCallback)(e=>{L(t=>new Set([...t,e])),he(e),X(null)},[]),xe=I.size>0;(0,z.useEffect)(()=>{if(!J||!l)return;let e=C(f);v[J]||(_e(!0),e.listProviderModels(J))},[J,l,f,v]);let Se=J?v[J]??[]:[],Ce=(0,z.useCallback)(async()=>{if(!J||!Y)return;if(!I.has(J)){E.error(`Please save the provider configuration before starting a session.`);return}s(J),c(Y);let e=C(f),t=await e.switchModel(J,Y,5e3);t.success?(e.newSession(),T(`chat`)):E.error(t.message||a.t(`setup:screen.errors.modelSwitchTimeout`))},[J,Y,s,c,f]),we=(0,z.useCallback)(async()=>{if(!J||!Y)return;s(J),c(Y);let e=await C(f).switchModel(J,Y,5e3);e.success?T(`chat`):E.error(e.message||a.t(`setup:screen.errors.modelSwitchTimeout`))},[J,Y,s,c,f]),Te=new Set(U.map(e=>e.id)),Ee=p.filter(e=>!Te.has(e.id)).sort((e,t)=>e.id.localeCompare(t.id)),Q=R(Ee,10);R(D,9);let $=R(Se,12,J);return(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,V.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b bg-card px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-6`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,V.jsx)(`img`,{src:`/wrongstack.svg`,alt:`WrongStack`,draggable:!1,className:`ws-brand-logo h-10 w-10 shrink-0 border border-border/70 shadow-sm`}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h1`,{className:`truncate text-lg font-semibold`,children:e(`setup:screen.header.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground sm:truncate`,children:e(`setup:screen.header.subtitle`)})]})]}),xe&&J?(0,V.jsxs)(`span`,{className:`text-xs text-success/80`,children:[(0,V.jsx)(t,{className:`h-3 w-3 inline-block mr-1`}),e(`setup:screen.header.continue`)]}):null]}),(0,V.jsx)(M,{className:`min-h-0 flex-1`,children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-4 pb-4 sm:p-6`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,xe?`text-success`:`text-primary font-medium`),children:[(0,V.jsx)(x,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.addKeys`)})]}),(0,V.jsx)(d,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,J?`text-primary font-medium`:`text-muted-foreground`),children:[(0,V.jsx)(g,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.pickModel`)})]}),(0,V.jsx)(d,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,J&&Y?`text-primary font-medium`:`text-muted-foreground`),children:[(0,V.jsx)(u,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.start`)})]})]}),(0,V.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-primary/20 bg-primary/5 p-4`,children:[(0,V.jsx)(i,{className:`h-5 w-5 text-primary shrink-0 mt-0.5`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium`,children:e(`setup:screen.security.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e(`setup:screen.security.body`)})]})]}),k?(0,V.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-4 py-12 rounded-xl border border-destructive/30 bg-destructive/5 px-6`,children:[(0,V.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-destructive/10 border border-destructive/30 flex items-center justify-center`,children:(0,V.jsx)(n,{className:`h-6 w-6 text-destructive`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:e(`setup:screen.errors.backendUnreachable`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 max-w-sm`,children:k})]}),(0,V.jsxs)(A,{onClick:ve,size:`sm`,variant:`outline`,children:[(0,V.jsx)(m,{className:`h-4 w-4 mr-2`}),e(`setup:screen.errors.retry`)]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.popular`)}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[W&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,V.jsx)(m,{className:`h-3 w-3 animate-spin`}),e(`setup:screen.providers.updating`)]}),K&&!W&&(0,V.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,title:K.toLocaleString(),children:be(K)}),(0,V.jsxs)(`button`,{type:`button`,onClick:ye,disabled:W,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,title:e(`setup:screen.providers.refreshTitle`),children:[(0,V.jsx)(y,{className:w(`h-3 w-3`,W&&`animate-spin`)}),e(`setup:screen.providers.refresh`)]})]})]}),(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:U.map(e=>(0,V.jsx)(ce,{popular:e,catalogProvider:p.find(t=>t.id===e.id),savedProvider:D.find(t=>t.id===e.id),onKeySaved:Z,probeResult:B[e.id]},e.id))})]}),Ee.length>0&&(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.more`)}),(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:Q.pageItems.map(t=>(0,V.jsx)(ce,{popular:{id:t.id,name:t.name,description:e(`setup:screen.providers.catalogDescription`,{family:t.family,count:t.modelCount}),icon:`🔗`,color:`from-muted/60 to-muted/20 border-border hover:border-primary/40`,keyPlaceholder:`API key`,family:t.family},catalogProvider:t,savedProvider:D.find(e=>e.id===t.id),onKeySaved:Z,probeResult:B[t.id]},t.id))}),(0,V.jsx)(P,{page:Q.page,pageSize:Q.pageSize,totalItems:Q.totalItems,onPageChange:Q.setPage,itemLabel:`providers`})]}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.selfHosted`)}),(0,V.jsx)(ie,{onKeySaved:Z})]})]}),re&&(0,V.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,V.jsx)(m,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),J&&(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`h2`,{className:`text-base font-semibold flex items-center gap-2`,children:[(0,V.jsx)(u,{className:`h-4 w-4 text-primary`}),e(`setup:screen.start.chooseModel`)]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>{he(null),X(null)},className:`text-xs text-muted-foreground hover:text-foreground transition-colors`,children:e(`setup:screen.start.addMoreKeys`)})]}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`setup:screen.start.modelsFor`,{provider:J})}),ge?(0,V.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,V.jsx)(m,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):Se.length>0?(0,V.jsx)(`div`,{className:`grid grid-cols-1 gap-2`,children:$.pageItems.map(e=>{let n=e.contextWindow?`${(e.contextWindow/1e6).toFixed(0)}M ctx`:null;return(0,V.jsx)(`button`,{type:`button`,onClick:()=>X(e.id),className:w(`w-full text-left rounded-xl border p-3 transition-all`,`hover:border-primary/40 hover:bg-primary/5`,Y===e.id?`border-primary bg-primary/10 ring-1 ring-primary/30`:`border-border bg-card`),children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[n&&(0,V.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:n}),e.capabilities.slice(0,3).map(e=>(0,V.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20`,children:e},e))]})]}),Y===e.id&&(0,V.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary`,children:(0,V.jsx)(t,{className:`h-3 w-3 text-primary-foreground`})})]})},e.id)})}):(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground py-8 text-center`,children:e(`setup:screen.errors.noModels`)}),(0,V.jsx)(P,{page:$.page,pageSize:$.pageSize,totalItems:$.totalItems,onPageChange:$.setPage,itemLabel:`models`})]}),J&&Y&&(0,V.jsxs)(`div`,{className:`sticky bottom-0 -mx-4 border-t bg-background/80 px-4 py-4 backdrop-blur-sm sm:-mx-6 sm:px-6`,children:[(0,V.jsx)(`div`,{className:`mb-3 flex min-w-0 items-center justify-between gap-2 text-sm text-muted-foreground`,children:(0,V.jsxs)(`span`,{className:`min-w-0 truncate`,children:[J,` / `,Y]})}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,V.jsxs)(A,{onClick:Ce,className:`flex-1`,size:`lg`,children:[(0,V.jsx)(g,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.startSession`),(0,V.jsx)(b,{className:`h-4 w-4 ml-2`})]}),(0,V.jsxs)(A,{onClick:we,variant:`outline`,className:`flex-1`,size:`lg`,children:[(0,V.jsx)(t,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.saveConfig`)]})]}),(0,V.jsx)(`p`,{className:`text-[11px] text-muted-foreground/60 text-center mt-2`,children:e(`setup:screen.start.saveConfigHint`)})]})]})})]})}export{U as SetupScreen};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-BuarzSSb.js","assets/rolldown-runtime-QTnfLwEv.js","assets/monaco-BLUV5g0U.js","assets/monaco-Bowa0-zp.css","assets/markdown-sSmz-Ua_.js","assets/vendor-BMdWcCR4.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$i as t,Ar as n,Dn as r,La as i,Pa as ee,Si as te,Wr as ne,Wt as re,Xi as ie,Xr as ae,Zi as oe,da as se,dt as a,ga as o,gi as ce,ir as s,jn as le,jt as c,lt as l,vn as ue,za as u}from"./vendor-BuarzSSb.js";import"./i18n-
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$i as t,Ar as n,Dn as r,La as i,Pa as ee,Si as te,Wr as ne,Wt as re,Xi as ie,Xr as ae,Zi as oe,da as se,dt as a,ga as o,gi as ce,ir as s,jn as le,jt as c,lt as l,vn as ue,za as u}from"./vendor-BuarzSSb.js";import"./i18n-COgumVF5.js";import{s as d}from"./monaco-BLUV5g0U.js";import{t as de}from"./useWebSocket-_gk4MRJz.js";import{t as f}from"./utils-B-9lSDIn.js";import{n as fe}from"./ui-store-CE4-TlwB.js";import{o as pe}from"./view-navigation-DIDEcp4V.js";import{a as me,n as he,o as ge,t as _e}from"./dialog-ftgTihmF.js";import{p}from"./markdown-sSmz-Ua_.js";import{c as ve,g as m,u as h}from"./index-CtpViiZy.js";import{t as ye}from"./empty-state-RRSqQaCk.js";var g=e(u(),1),_=l(),be=(0,g.lazy)(()=>d(()=>import(`./vendor-BuarzSSb.js`).then(e=>e.S),__vite__mapDeps([0,1,2,3,4,5])));function v(e){return e===`project`||e===`user`}function xe(e){let t=e.match(/^(.+?)\/SKILL(?:\.save)?\.md$/);return t?t[1]:null}function Se({source:e}){let{t}=ee(),n=e===`project`?`project`:e===`user`?`user`:`bundled`;return(0,_.jsx)(`span`,{className:f(`inline-flex items-center rounded-md border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide`,n===`project`&&`border-success/25 bg-success/8 text-success`,n===`user`&&`border-primary/25 bg-primary/10 text-primary`,n===`bundled`&&`border-border/70 bg-muted/60 text-muted-foreground`),children:t(`activity:skillDetail.${{project:`scopeProject`,user:`scopeGlobal`,bundled:`scopeBundled`}[n]}`)})}function y({className:e}){let{t:l}=ee(),{client:u}=de(),d=fe(e=>e.skillsState),y=fe(e=>e.setSkillsState),b=d.selectedSkill,x=d.navHistory,S=d.historyIndex,[C,w]=(0,g.useState)(null),[Ce,T]=(0,g.useState)(!1),[E,D]=(0,g.useState)(null),we=ve(`skill-detail`,!!C),[O,k]=(0,g.useState)(!1),[A,j]=(0,g.useState)(``),[M,N]=(0,g.useState)(!1),[P,F]=(0,g.useState)(null),[I,L]=(0,g.useState)(!1),[R,z]=(0,g.useState)(null),[Te,B]=(0,g.useState)(!1),V=(0,g.useRef)(``),[Ee,De]=(0,g.useState)(!1),[H,U]=(0,g.useState)(null),[Oe,ke]=(0,g.useState)(!1),[W,G]=(0,g.useState)(null),[K,Ae]=(0,g.useState)(!1),[je,Me]=(0,g.useState)([]),q=(0,g.useRef)(d);q.current=d;let J=(0,g.useRef)(!1),Y=(0,g.useMemo)(()=>A?{lines:A.split(`
|
|
3
3
|
`).length,words:A.trim()?A.trim().split(/\s+/).length:0,chars:A.length}:{lines:0,words:0,chars:0},[A]),X=(0,g.useMemo)(()=>{if(!A)return null;let e=5*1024*1024,t=new Blob([A]).size;return t>=e?{level:`critical`,used:t,limit:e}:t>=4194304?{level:`warn`,used:t,limit:e}:null},[A]);(0,g.useEffect)(()=>{if(!R)return;let e=setTimeout(()=>z(null),2e3);return()=>clearTimeout(e)},[R]),(0,g.useEffect)(()=>{if(!O||!b)return;let e=setInterval(()=>{A&&A!==V.current&&(V.current=A,localStorage.setItem(`skills_draft_${b.name}`,JSON.stringify({content:A,savedAt:Date.now()})),z(Date.now()))},5e3);return()=>clearInterval(e)},[O,A,b]),(0,g.useEffect)(()=>{if(!b||!O)return;let e=localStorage.getItem(`skills_draft_${b.name}`);if(e)try{let{content:t}=JSON.parse(e);t&&t!==A&&t!==V.current&&(j(t),V.current=t,B(!0))}catch{}},[b?.name,O]),(0,g.useEffect)(()=>{if(!u||!b)return;T(!0),w(null),D(null);let e=setTimeout(()=>{T(!1),D(i.t(`activity:skillDetail.timeoutError`))},1e4),t=t=>{clearTimeout(e);let n=t;n.payload.error?D(n.payload.error):n.payload.name&&w(n.payload),T(!1)},n=e=>{let t=e;De(!1);let n=q.current;if(t.payload.success){let e={...n.knownRefs};for(let n of t.payload.updated??[])e[n.name]=n.newRef;y({...n,knownRefs:e,updateAvailableCount:0}),U({updated:t.payload.updated??[],unchanged:t.payload.unchanged??[],errors:t.payload.errors??[]}),u.send({type:`skills.list`},{echoToChat:!1})}else U({updated:[],unchanged:[],errors:[{name:``,error:t.payload.error??i.t(`activity:skillDetail.updateFailed`)}]})},r=e=>{let t=e;t.payload.skills&&Me(t.payload.skills)};return u.on(`skills.content`,t),u.on(`skills.updated`,n),u.on(`skills.list`,r),u.send({type:`skills.content`,payload:{name:b.name,source:b.source}}),()=>{clearTimeout(e),u.off(`skills.content`,t),u.off(`skills.updated`,n),u.off(`skills.list`,r)}},[u,b?.name,b?.source]),(0,g.useEffect)(()=>{O&&(k(!1),j(``),F(null))},[b?.name]);let Z=(0,g.useCallback)(e=>je.find(t=>t.name.toLowerCase()===e.toLowerCase()),[je]),Q=(0,g.useCallback)(e=>{let t=Z(e);if(t){J.current=!1;let e=x.slice(0,S+1);e.push(t),y({...q.current,selectedSkill:t,navHistory:e,historyIndex:e.length-1}),k(!1),j(``),U(null)}},[Z,x,S,y]),Ne=(0,g.useCallback)(()=>{if(S<=0)return;J.current=!0;let e=S-1,t=x[e];y({...q.current,selectedSkill:t,historyIndex:e}),k(!1),j(``),U(null)},[S,x,y]),Pe=(0,g.useCallback)(()=>{if(S>=x.length-1)return;J.current=!0;let e=S+1,t=x[e];y({...q.current,selectedSkill:t,historyIndex:e}),k(!1),j(``),U(null)},[S,x,y]),$=(0,g.useCallback)(()=>{pe(`chat`)},[]),Fe=(0,g.useCallback)(()=>{C&&(j(C.body),V.current=C.body,B(!1),F(null),k(!0),L(!1))},[C]),Ie=(0,g.useCallback)(()=>{k(!1),j(``),F(null),L(!1),B(!1),b&&localStorage.removeItem(`skills_draft_${b.name}`)},[b]),Le=(0,g.useCallback)(()=>{!b||!C||(B(!1),j(C.body),V.current=C.body,b&&localStorage.removeItem(`skills_draft_${b.name}`))},[b,C]),Re=(0,g.useCallback)(()=>{if(!u||!b||!A.trim())return;N(!0),F(null);let e=t=>{let n=t;N(!1),n.payload.success?(V.current=``,localStorage.removeItem(`skills_draft_${b.name}`),B(!1),k(!1),u.send({type:`skills.content`,payload:{name:b.name,source:b.source}}),u.send({type:`skills.list`},{echoToChat:!1})):F(n.payload.error??i.t(`activity:skillDetail.saveFailed`)),u.off(`skills.edited`,e)};u.on(`skills.edited`,e),u.editSkill(b.name,A)},[u,b,A]),ze=(0,g.useCallback)(()=>{!u||!b||(De(!0),U(null),u.checkForUpdates(b.name,b.source===`user`))},[u,b]),Be=(0,g.useCallback)(()=>{b?.sourceUrl&&navigator.clipboard.writeText(b.sourceUrl).then(()=>{ke(!0),setTimeout(()=>ke(!1),2e3)})},[b]),Ve=(0,g.useCallback)(()=>{if(!C?.body)return;let e=new Blob([C.body],{type:`text/markdown`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${C.name.replace(/\//g,`_`)}-SKILL.md`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},[C]),He=(0,g.useCallback)(async e=>{if(!u||!e)return;Ae(!0);let t=e=>{let n=e;Ae(!1),n.payload.success?(G(null),u.send({type:`skills.list`},{echoToChat:!1}),$()):F(n.payload.error??i.t(`activity:skillDetail.uninstallFailed`)),u.off(`skills.uninstalled`,t)};u.on(`skills.uninstalled`,t),u.uninstallSkill(e.name,e.source===`user`)},[u,$]);return b?(0,_.jsxs)(`div`,{className:f(`flex h-full min-h-0 min-w-0 flex-col gap-3 overflow-hidden bg-[hsl(var(--surface-2)/0.45)] p-3`,e),children:[(0,_.jsxs)(`div`,{className:`shrink-0 rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,_.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,_.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,_.jsx)(re,{className:`h-4 w-4`})}),(0,_.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold`,children:b.name}),b.version&&(0,_.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`v`,b.version]}),(0,_.jsx)(Se,{source:b.source})]}),(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:b.description||b.trigger}),b.sourceUrl&&(0,_.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-1`,children:[(0,_.jsxs)(`a`,{href:`https://${b.sourceUrl.replace(`github:`,``)}`,target:`_blank`,rel:`noopener noreferrer`,className:`flex min-w-0 items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,title:l(`activity:skillDetail.openSourceRepo`),children:[(0,_.jsx)(n,{className:`h-3 w-3 shrink-0`}),(0,_.jsx)(`span`,{className:`truncate font-mono`,children:b.sourceUrl})]}),(0,_.jsx)(`button`,{type:`button`,onClick:Be,className:`flex shrink-0 items-center text-muted-foreground transition-colors hover:text-foreground`,title:l(`activity:skillDetail.copySourceUrl`),children:Oe?(0,_.jsx)(t,{className:`h-3 w-3 text-success`}):(0,_.jsx)(te,{className:`h-3 w-3`})})]}),b.scope.length>0&&(0,_.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:b.scope.map(e=>(0,_.jsx)(`span`,{className:`px-1.5 py-0.5 text-[10px] rounded bg-muted text-muted-foreground`,children:e},e))}),H&&(0,_.jsxs)(`div`,{className:`mt-2 text-xs space-y-1`,children:[H.updated.length>0&&(0,_.jsx)(`div`,{className:`text-success`,children:l(`activity:skillDetail.updatedLabel`,{list:H.updated.map(e=>`${e.name} (${e.oldRef} → ${e.newRef})`).join(`, `)})}),H.unchanged.length>0&&(0,_.jsx)(`div`,{className:`text-muted-foreground`,children:l(`activity:skillDetail.upToDateLabel`,{list:H.unchanged.join(`, `)})}),H.errors.length>0&&(0,_.jsx)(`div`,{className:`text-destructive`,children:l(`activity:skillDetail.errorsLabel`,{list:H.errors.map(e=>`${e.name?`${e.name}: `:``}${e.error}`).join(`; `)})})]})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 lg:ml-auto lg:shrink-0 lg:justify-end`,children:[v(b.source)&&b.sourceUrl&&(0,_.jsx)(`button`,{type:`button`,onClick:ze,disabled:Ee,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50`,title:l(`activity:skillDetail.checkUpdatesTitle`),children:Ee?(0,_.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}):(0,_.jsx)(ue,{className:`h-3.5 w-3.5`})}),b.source!==`bundled`&&!O&&(0,_.jsx)(`button`,{type:`button`,onClick:Ve,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:l(`activity:skillDetail.exportTitle`),children:(0,_.jsx)(ce,{className:`h-3.5 w-3.5`})}),v(b.source)&&!O&&(0,_.jsx)(`button`,{type:`button`,onClick:Fe,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:l(`activity:skillDetail.editTitle`),children:(0,_.jsx)(r,{className:`h-3.5 w-3.5`})}),v(b.source)&&(0,_.jsx)(`button`,{type:`button`,onClick:()=>G(b),className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,title:l(`activity:skillDetail.uninstallTitle`),children:(0,_.jsx)(c,{className:`h-3.5 w-3.5`})}),(0,_.jsx)(`button`,{type:`button`,onClick:$,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:l(`activity:skillDetail.closeTitle`),children:(0,_.jsx)(a,{className:`h-4 w-4`})})]})]}),x.length>1&&(0,_.jsxs)(`div`,{className:`mt-3 flex min-w-0 items-center gap-1 rounded-lg border border-border/60 bg-muted/35 px-2 py-1`,children:[(0,_.jsx)(`button`,{type:`button`,onClick:Ne,disabled:S<=0,className:f(`rounded p-1 transition-colors`,S<=0?`text-muted-foreground/65 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:l(`activity:skillDetail.backTitle`),children:(0,_.jsx)(oe,{className:`h-4 w-4`})}),(0,_.jsx)(`button`,{type:`button`,onClick:Pe,disabled:S>=x.length-1,className:f(`rounded p-1 transition-colors`,S>=x.length-1?`text-muted-foreground/65 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:l(`activity:skillDetail.forwardTitle`),children:(0,_.jsx)(ie,{className:`h-4 w-4`})}),(0,_.jsx)(`div`,{className:`flex items-center gap-0.5 overflow-x-auto text-xs`,children:x.map((e,t)=>(0,_.jsxs)(`span`,{className:`flex items-center shrink-0`,children:[t>0&&(0,_.jsx)(ie,{className:`h-3 w-3 text-muted-foreground/65 mx-0.5 shrink-0`}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>{t<S&&(J.current=!0,y({...q.current,selectedSkill:e,historyIndex:t}),k(!1),j(``),U(null))},className:f(`hover:text-primary cursor-pointer transition-colors`,t===S?`text-primary font-medium`:`text-muted-foreground`),children:e.name})]},e.name+t))})]})]}),C&&(C.relatedFiles.length>0||C.references.length>0)&&(0,_.jsxs)(`div`,{className:`shrink-0 space-y-2 rounded-xl border border-border/70 bg-card/70 px-4 py-3 shadow-sm`,children:[C.relatedFiles.length>0&&(0,_.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,_.jsx)(ne,{className:`h-3 w-3`}),(0,_.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:l(`activity:skillDetail.relatedFiles`)})]}),C.relatedFiles.map(e=>{let t=xe(e);return t&&Z(t)?(0,_.jsxs)(`button`,{type:`button`,onClick:()=>Q(t),className:`inline-flex min-w-0 items-center gap-1 rounded-md border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] transition-colors hover:border-primary/40 hover:text-primary`,title:l(`activity:skillDetail.goToSkillTitle`,{name:t}),children:[(0,_.jsx)(o,{className:`h-2.5 w-2.5`}),e]},e):(0,_.jsx)(`span`,{className:`rounded-md border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:e},e)})]}),C.references.length>0&&(0,_.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,_.jsx)(ae,{className:`h-3 w-3`}),(0,_.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:l(`activity:skillDetail.references`)})]}),C.references.map(e=>{let t=xe(e)??e.replace(/\.md$/,``);return Z(t)?(0,_.jsxs)(`button`,{type:`button`,onClick:()=>Q(t),className:`inline-flex min-w-0 items-center gap-1 rounded-md border border-primary/20 bg-primary/5 px-1.5 py-0.5 text-[10px] text-primary transition-colors hover:border-primary/30 hover:bg-primary/10`,title:l(`activity:skillDetail.goToSkillTitle`,{name:t}),children:[(0,_.jsx)(o,{className:`h-2.5 w-2.5`}),t]},e):(0,_.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:t},e)})]})]}),(0,_.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-hidden rounded-xl border border-border/70 bg-card/70 shadow-sm`,children:Ce?(0,_.jsxs)(`div`,{className:`flex h-full min-h-[16rem] flex-col items-center justify-center p-8 text-center text-muted-foreground`,children:[(0,_.jsx)(s,{className:`mx-auto mb-2 h-6 w-6 animate-spin text-primary`}),(0,_.jsx)(`p`,{children:l(`activity:skillDetail.loadingContent`)})]}):O?(0,_.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,_.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-border/70 bg-muted/30 px-4 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,_.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l(`activity:skillDetail.editingLabel`,{name:b.name})}),(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:l(`activity:skillDetail.editStats`,{lines:Y.lines,words:Y.words,chars:Y.chars})}),X&&(0,_.jsx)(`span`,{className:`text-xs tabular-nums ${X.level===`critical`?`font-medium text-destructive`:`text-warning`}`,children:l(`activity:skillDetail.charsWarningFmt`,{used:(X.used/(1024*1024)).toFixed(1),limit:(X.limit/(1024*1024)).toFixed(0)})}),R&&(0,_.jsx)(`span`,{className:`text-xs text-success animate-pulse`,children:l(`activity:skillDetail.draftSaved`)}),Te&&(0,_.jsx)(`span`,{className:`animate-pulse text-xs text-warning`,children:l(`activity:skillDetail.draftRestored`)})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[P&&(0,_.jsx)(`span`,{className:`text-xs text-destructive`,children:P}),Te&&(0,_.jsx)(`button`,{type:`button`,onClick:Le,className:`rounded-md border border-warning/35 px-2 py-1 text-[10px] text-warning transition-colors hover:bg-warning/10`,children:l(`activity:skillDetail.discardDraft`)}),(0,_.jsx)(`button`,{type:`button`,onClick:Ie,className:`rounded-md border border-border/70 px-2 py-1 text-xs transition-colors hover:bg-accent`,children:l(`common:action.cancel`)}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>L(e=>!e),title:l(I?`activity:skillDetail.hidePreviewTitle`:`activity:skillDetail.splitViewTitle`),className:`rounded-md border px-2 py-1 text-xs transition-colors ${I?`border-primary/40 bg-primary/10 text-primary`:`border-border/70 text-muted-foreground hover:bg-accent`}`,children:(0,_.jsx)(le,{className:`h-3 w-3 inline`})}),(0,_.jsx)(`button`,{type:`button`,onClick:Re,disabled:M||!A.trim(),className:`rounded-md bg-primary px-3 py-1 text-xs text-primary-foreground shadow-sm shadow-primary/15 transition-colors hover:bg-primary/90 disabled:opacity-50`,children:M?(0,_.jsx)(s,{className:`h-3 w-3 animate-spin inline`}):l(`common:action.save`)})]})]}),I?(0,_.jsxs)(`div`,{className:`flex flex-1 min-h-0 gap-0.5`,children:[(0,_.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0`,children:(0,_.jsx)(g.Suspense,{fallback:null,children:(0,_.jsx)(be,{value:A,onChange:e=>j(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:l(`activity:skillDetail.contentPlaceholder`)})})}),(0,_.jsx)(`div`,{className:`w-px bg-border flex-shrink-0`}),(0,_.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain bg-background/45 p-4 prose prose-sm dark:prose-invert max-w-none`,children:(0,_.jsx)(h,{rehypePlugins:[p],components:m,children:A})})]}):(0,_.jsx)(g.Suspense,{fallback:null,children:(0,_.jsx)(be,{value:A,onChange:e=>j(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:l(`activity:skillDetail.contentPlaceholder`)})})]}):C?(0,_.jsx)(`div`,{ref:we,className:`h-full min-h-0 overflow-y-auto overscroll-contain p-5 sm:p-6 prose prose-sm dark:prose-invert max-w-none`,children:(0,_.jsx)(h,{rehypePlugins:[p],components:m,children:C.body})}):E?(0,_.jsxs)(`div`,{className:`flex h-full min-h-[16rem] flex-col items-center justify-center p-8 text-center`,children:[(0,_.jsx)(`p`,{className:`text-destructive mb-2`,children:l(`activity:skillDetail.loadFailed`)}),(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:E}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>{u&&b&&(T(!0),D(null),u.send({type:`skills.content`,payload:{name:b.name,source:b.source}}))},className:`mt-4 rounded-md border border-border/70 px-3 py-1.5 text-xs transition-colors hover:bg-accent`,children:l(`common:action.retry`)})]}):(0,_.jsx)(`div`,{className:`flex h-full min-h-[16rem] items-center justify-center p-8 text-center text-muted-foreground`,children:l(`activity:skillDetail.noContent`)})}),(0,_.jsx)(_e,{open:!!W,onOpenChange:e=>{e||G(null)},children:(0,_.jsxs)(he,{className:`flex max-h-[calc(100dvh-2rem)] w-[380px] max-w-[90vw] flex-col gap-0 overflow-hidden p-0`,showCloseButton:!1,children:[(0,_.jsxs)(me,{className:`flex shrink-0 items-center justify-between border-b border-border/70 p-4 sm:flex-row sm:justify-between sm:space-y-0`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(c,{className:`h-4 w-4 text-destructive`}),(0,_.jsx)(ge,{className:`font-semibold text-sm`,children:l(`activity:skillDetail.uninstallSkillHeading`)})]}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>G(null),"aria-label":l(`common:action.close`),className:`rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,_.jsx)(a,{className:`h-4 w-4`})})]}),(0,_.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-4`,children:[(0,_.jsx)(`p`,{className:`text-sm`,children:W&&l(`activity:skillDetail.uninstallConfirm`,{name:W.name})}),(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:W&&l(`activity:skillDetail.uninstallRemovePath`,{path:W.path})})]}),(0,_.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-border/70 bg-muted/20 p-4`,children:[(0,_.jsx)(`button`,{type:`button`,onClick:()=>G(null),disabled:K,className:`rounded-md border border-border/70 px-3 py-1.5 text-xs transition-colors hover:bg-accent disabled:opacity-50`,children:l(`common:action.cancel`)}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>W&&He(W),disabled:K,className:`flex items-center gap-1.5 rounded-md bg-destructive px-3 py-1.5 text-xs text-destructive-foreground transition-colors hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50`,children:[K&&(0,_.jsx)(s,{className:`h-3 w-3 animate-spin`}),l(`activity:skillDetail.uninstallAction`)]})]})]})})]}):(0,_.jsx)(ye,{icon:(0,_.jsx)(se,{className:`h-6 w-6`}),title:l(`activity:skillDetail.noSkillSelected`),description:l(`activity:skillDetail.selectSkillHint`),action:{label:l(`activity:skillDetail.goToChat`),onClick:$},className:e})}export{y as SkillDetailView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ai as t,Fi as n,Ii as r,Pa as i,Qi as a,Wi as o,Xi as s,Xr as c,dt as l,ir as u,lt as d,ma as f,mn as p,mr as m,nr as h,wn as g,za as _,zn as v}from"./vendor-BuarzSSb.js";import"./i18n-COgumVF5.js";import{t as y}from"./useWebSocket-_gk4MRJz.js";import{t as b}from"./utils-B-9lSDIn.js";import{a as x}from"./stores-ChEnUmic.js";import{r as S}from"./view-navigation-DIDEcp4V.js";import{t as C}from"./button-Dcy288Mc.js";var w=e(_(),1),T=d(),E={completed:{icon:(0,T.jsx)(o,{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)(t,{className:`h-3.5 w-3.5`}),text:`text-warning`,ring:`border-warning/35`},blocked:{icon:(0,T.jsx)(h,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/30`},pending:{icon:(0,T.jsx)(n,{className:`h-3.5 w-3.5`}),text:`text-muted-foreground`,ring:`border-border/70`},review:{icon:(0,T.jsx)(p,{className:`h-3.5 w-3.5`}),text:`text-primary`,ring:`border-primary/35`},failed:{icon:(0,T.jsx)(r,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/45`},cancelled:{icon:(0,T.jsx)(f,{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)(s,{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)(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:t}){let{client:n}=y(),{t:r}=i(),o=x(e=>e.specs),u=x(e=>e.detail),d=x(e=>e.expandedSpecId),f=x(e=>e.setExpanded),[p,h]=(0,w.useState)(`graph`),_=(0,w.useCallback)(e=>{!u||u.specId!==e.id||(n?.send?.({type:`goal.start`,payload:{title:e.title,phases:j(u),autonomous:!0}}),S(`goal`))},[u,n]),E=(0,w.useCallback)(e=>{let r=e.graphId??(u?.specId===e.id?u.graphId:void 0);r?n?.send?.({type:`sdd.run.from_graph`,payload:{graphId:r,worktrees:!0}}):n?.send?.({type:`sdd.run.from_spec`,payload:{specId:e.id,worktrees:!0}}),t?.(),S(`sddhub`)},[u,n,t]);(0,w.useEffect)(()=>{n?.send?.({type:`specs.list`})},[n]);let D=(0,w.useCallback)(e=>{d===e.id?f(null):(f(e.id),n?.send?.({type:`specs.get`,payload:{specId:e.id}}))},[d,f,n]),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)(c,{className:`h-5 w-5 text-warning`}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-lg font-semibold`,children:r(`activity:specs.heading`)}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`activity:specs.subtitle`)})]})]}),(0,T.jsx)(C,{variant:`ghost`,size:`icon`,onClick:e,children:(0,T.jsx)(l,{className:`h-4 w-4`})})]}),(0,T.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4`,children:o.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:r(`activity:specs.empty`,{command:`/sdd`})}):(0,T.jsx)(`div`,{className:`space-y-3`,children:o.map(e=>{let t=d===e.id,n=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:t?(0,T.jsx)(a,{className:`h-4 w-4`}):(0,T.jsx)(s,{className:`h-4 w-4`})}),(0,T.jsx)(c,{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:`${n}%`}})}),(0,T.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[e.completed,`/`,e.total]})]})]})]}),t&&(0,T.jsxs)(`div`,{className:`border-t border-border p-4`,children:[(0,T.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,T.jsxs)(`div`,{className:`text-sm font-medium`,children:[r(`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:r(`activity:specs.doneCount`,{count:A.done})}),` `,(0,T.jsx)(`span`,{className:`text-primary`,children:r(`activity:specs.runningCount`,{count:A.running})}),` `,(0,T.jsx)(`span`,{children:r(`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:r(`activity:specs.runAsSddTitle`),className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success transition-colors hover:bg-success/25`,children:[(0,T.jsx)(g,{className:`h-3.5 w-3.5`}),` `,r(`activity:specs.runAsSdd`)]}),(0,T.jsxs)(`button`,{type:`button`,disabled:!u||u.specId!==e.id,onClick:()=>_(e),title:r(`activity:specs.runAsGoalTitle`),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning transition-colors hover:bg-warning/25 disabled:opacity-40`,children:[(0,T.jsx)(g,{className:`h-3.5 w-3.5`}),` `,r(`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:()=>h(`list`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,p===`list`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(m,{className:`h-3.5 w-3.5`}),` `,r(`activity:specs.list`)]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>h(`graph`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,p===`graph`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(v,{className:`h-3.5 w-3.5`}),` `,r(`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:r(`activity:specs.loadingTasks`)}):p===`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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ci as t,Di as n,Ea as r,Fr as i,Jt as a,Ln as o,M as s,Nt as c,Pa as l,Un as u,Wt as d,an as f,ca as p,di as m,dt as ee,gi as te,hn as h,ir as g,ki as _,lt as v,sa as y,ut as ne,vn as re,xa as b,za as x,zr as S}from"./vendor-BuarzSSb.js";import"./i18n-COgumVF5.js";import{t as C}from"./utils-B-9lSDIn.js";import{i as w}from"./stores-ChEnUmic.js";import{t as T}from"./button-Dcy288Mc.js";import{t as E}from"./input-fo9-BPBC.js";import{b as D,x as O}from"./index-CtpViiZy.js";var k=e(x(),1),A=v(),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:o},python:{label:`Python`,icon:n},rust:{label:`Rust`,icon:a},go:{label:`Go`,icon:h},dotnet:{label:`.NET`,icon:u},php:{label:`PHP`,icon:c},dart:{label:`Dart / Flutter`,icon:t},maven:{label:`Maven`,icon:r},gradle:{label:`Gradle`,icon:p},ruby:{label:`Ruby`,icon:i},swift:{label:`Swift`,icon:ne},elixir:{label:`Elixir`,icon:c},cpp:{label:`C / C++`,icon:_}},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:a}){let{t:o}=l(),s=j(e.status),c=U(e),u=H(e),f=a?B(a).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":o(`activity:techStack.backToDependencyList`),className:`shrink-0 md:hidden`,children:(0,A.jsx)(b,{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:s.badge,children:o(s.labelKey)})]}),(0,A.jsxs)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:[N(e.ecosystem,o),` ·`,` `,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:o(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:c??`—`}),e.latestStable&&e.latestStable!==c&&(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:o(`activity:techStack.constraint`),value:e.requested??`—`,mono:!0}),(0,A.jsx)(q,{label:o(`activity:techStack.locked`),value:e.locked??`—`,mono:!0}),(0,A.jsx)(q,{label:o(`activity:techStack.latestStable`),value:e.latestStable??`—`,mono:!0}),(0,A.jsx)(q,{label:o(`activity:techStack.license`),value:e.license??`—`}),e.wanted&&(0,A.jsx)(q,{label:o(`activity:techStack.wanted`),value:e.wanted,mono:!0}),e.resolvable&&(0,A.jsx)(q,{label:o(`activity:techStack.resolvable`),value:e.resolvable,mono:!0}),e.purl&&(0,A.jsx)(q,{label:o(`activity:techStack.purl`),value:e.purl,mono:!0}),(0,A.jsx)(q,{label:o(`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:o(`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)(d,{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:o(`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:o(L[e.severity].labelKey)}),(0,A.jsx)(G,{className:`border-border/70 bg-muted text-muted-foreground`,children:R[e.action]?o(R[e.action]):e.action}),W(e)&&(0,A.jsxs)(G,{className:`border-info/35 bg-info/10 text-info`,children:[(0,A.jsx)(d,{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:o(`activity:techStack.evidence`)}),e.evidence.length===0?(0,A.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:o(`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)(m,{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:a}=l(),o=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:a(`activity:techStack.package`)}),(0,A.jsx)(`span`,{children:a(`activity:techStack.installedLatest`)}),(0,A.jsx)(`span`,{children:a(`activity:techStack.status`)})]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,A.jsx)(s,{className:`h-full`,"aria-label":a(`activity:techStack.dependencies`),children:o.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:o.page,pageSize:o.pageSize,totalItems:o.totalItems,onPageChange:o.setPage,itemLabel:`dependencies`})]})}function Y({dependency:e,selected:t,coverage:n,onSelect:r}){let{t:i}=l(),a=j(e.status),o=U(e),s=H(e),c=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`,a.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,c&&(0,A.jsxs)(A.Fragment,{children:[` · `,(0,A.jsx)(`span`,{className:`text-warning`,children:i(c)})]})]})]}),(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:o??`—`}),e.latestStable&&e.latestStable!==o&&(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})]})]}),s.label?(0,A.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-warning`,children:s.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:a.badge,children:i(a.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}=l(),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}=l(),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)(d,{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:r,sort:i,hasFilters:a,ecosystems:o,statuses:s,visibleCount:c,totalCount:u,onSearchChange:d,onEcosystemFilterChange:p,onStatusFilterChange:m,onToggleDirectOnly:te,onSortChange:h,onClearFilters:g}){let{t:_}=l();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)(f,{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":_(`activity:techStack.searchDependencies`),value:e,onChange:e=>d(e.target.value),placeholder:_(`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":_(`activity:techStack.clearSearch`),onClick:()=>d(``),className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground`,children:(0,A.jsx)(ee,{className:`size-3.5`})})]}),(0,A.jsx)(T,{variant:r?`default`:`outline`,size:`sm`,onClick:te,"aria-pressed":r,title:_(`activity:techStack.showOnlyDependenciesThisProjectDeclaresItself`),className:`shrink-0`,children:_(`activity:techStack.directOnly`)}),a&&(0,A.jsx)(T,{variant:`ghost`,size:`icon`,onClick:g,"aria-label":_(`activity:techStack.clearAllFilters`),title:_(`activity:techStack.clearAllFilters`),className:`shrink-0`,children:(0,A.jsx)(S,{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:_(`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:_(`activity:techStack.allEcosystems`)}),o.map(([e,t])=>(0,A.jsxs)(`option`,{value:e,children:[N(e,_),` · `,t]},e))]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-status-filter`,children:_(`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:_(`activity:techStack.allStatuses`)}),s.map(([e,t])=>(0,A.jsxs)(`option`,{value:e,children:[_(j(e).labelKey),` · `,t]},e))]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-sort`,children:_(`activity:techStack.sortDependencies`)}),(0,A.jsxs)(`select`,{id:`techstack-sort`,value:i,onChange:e=>h(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:_(`activity:techStack.sortNeedsAttention`)}),(0,A.jsx)(`option`,{value:`drift`,children:_(`activity:techStack.sortMostOutOfDate`)}),(0,A.jsx)(`option`,{value:`name`,children:_(`activity:techStack.sortName`)})]})]})]}),(0,A.jsx)(`p`,{className:C(`text-[10px] text-muted-foreground`,a&&`text-info`),children:c===u?`${u} dependencies`:`${c} of ${u} 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}=l(),t=w(e=>e.snapshot),n=w(e=>e.stale),r=w(e=>e.loading),i=w(e=>e.error),a=w(e=>e.activeJob),[o,s]=(0,k.useState)(`dependencies`),[c,u]=(0,k.useState)(``),[f,p]=(0,k.useState)(`all`),[m,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)(()=>{o!==`trends`&&o!==`remediation`||fetch(`/api/techstack/${o===`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)))},[o,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=c.trim().toLowerCase(),t=[...U.filter(t=>!(e&&!t.name.toLowerCase().includes(e)||f!==`all`&&t.ecosystem!==f||m!==`all`&&t.status!==m||_&&!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,c,f,m,_,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=c.trim()!==``||f!==`all`||m!==`all`||_,we=(0,k.useCallback)(()=>{u(``),p(`all`),h(`all`),v(!1)},[]),$=!!(a&&![`completed`,`failed`,`cancelled`].includes(a.status)),Te=(0,k.useCallback)(e=>{x(e),s(`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)(d,{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)(ee,{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)(te,{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:[$&&a&&(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:a.status}),a.progress&&(0,A.jsxs)(`span`,{className:`text-muted-foreground`,children:[a.progress.completed,`/`,a.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:()=>s(t.id),"aria-current":o===t.id,className:C(`border-b-2 px-3 py-2 text-xs font-medium transition-colors`,o===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))}),o===`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:c,ecosystemFilter:f,statusFilter:m,directOnly:_,sort:y,hasFilters:Ce,ecosystems:q,statuses:J,visibleCount:X.length,totalCount:U.length,onSearchChange:u,onEcosystemFilterChange:p,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`)})})})]}),o===`findings`&&(0,A.jsx)(ue,{findings:W,dependenciesById:G,onSelectDependency:Te}),o===`workspaces`&&(0,A.jsx)(ge,{snapshot:t}),o===`trends`&&(0,A.jsx)(me,{trend:ie}),o===`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:a}=l();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:a(`activity:techStack.requiresAManualPackageChoice`)})]})]},n)}),e.items.length===0&&(0,A.jsx)(`p`,{className:`p-8 text-center text-xs text-muted-foreground`,children:a(`activity:techStack.noRemediationNeeded`)})]})]}):(0,A.jsx)(Q,{})}function ge({snapshot:e}){let{t}=l(),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}=l();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}=l(),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{Cn as t,La as n,Pa as r,Vt as i,dt as a,jt as o,lt as s,mn as c,za as l}from"./vendor-BuarzSSb.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Cn as t,La as n,Pa as r,Vt as i,dt as a,jt as o,lt as s,mn as c,za as l}from"./vendor-BuarzSSb.js";import"./i18n-COgumVF5.js";import{t as u}from"./ws-client-TTMa0XaT.js";import{n as d,t as f}from"./utils-B-9lSDIn.js";import{t as p}from"./session-store-Df7_hhe9.js";import{I as m}from"./stores-ChEnUmic.js";import{n as h}from"./ui-store-CE4-TlwB.js";import{n as g,t as _}from"./xterm-DUBp1lnG.js";var v=e(l(),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:n}){let s=(0,v.useRef)(null),{t:l}=r(),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(),s.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)},o=()=>{document.body.style.cursor=r,document.body.style.userSelect=i,window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o),s.current===o&&(s.current=null)};s.current=o,window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o,{once:!0}),window.addEventListener(`pointercancel`,o,{once:!0})};(0,v.useEffect)(()=>()=>s.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)(i,{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)(t,{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)(c,{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)(o,{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)(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:l(`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:r,onExit:i}){let a=(0,v.useRef)(null),o=(0,v.useRef)(null),s=(0,v.useRef)(null),c=(0,v.useRef)(r),l=(0,v.useRef)(i),d=m(e=>e.wsConnected);return(0,v.useEffect)(()=>{c.current=r,l.current=i},[i,r]),(0,v.useEffect)(()=>{let t=a.current;if(!t)return;let r=new _({fontFamily:`"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:13,cursorBlink:!0,theme:S,scrollback:5e3}),i=new g;o.current=r,s.current=i,r.loadAddon(i),r.open(t);try{i.fit()}catch{}let d=u(m.getState().wsUrl);d.send({type:`terminal.create`,payload:{id:e,cols:r.cols,rows:r.rows}});let f=!1,p=d.on(`terminal.output`,t=>{t.type===`terminal.output`&&t.payload.id===e&&(f||(f=!0,c.current()),r.write(t.payload.data))}),h=d.on(`terminal.exit`,t=>{t.type===`terminal.exit`&&t.payload.id===e&&(r.write(`\r\n\x1b[2m${n.t(`activity:terminal.processExited`,{code:t.payload.exitCode})}\x1b[0m\r\n`),l.current(t.payload.exitCode))}),v=r.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:r.cols,rows:r.rows}})}catch{}});return y.observe(t),()=>{p(),h(),v.dispose(),y.disconnect(),d.send({type:`terminal.close`,payload:{id:e}}),r.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 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ii as t,La as n,Na as r,Ot as i,Pa as a,Wi as o,br as s,dt as c,lt as l,za as u}from"./vendor-BuarzSSb.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ii as t,La as n,Na as r,Ot as i,Pa as a,Wi as o,br as s,dt as c,lt as l,za as u}from"./vendor-BuarzSSb.js";import"./i18n-COgumVF5.js";import{n as d,t as f}from"./utils-B-9lSDIn.js";var p=e(u(),1),m=l();function h(){return`toast_${d()}`}var g=8e3,_=r(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,r=n.t(`common:action.undo`),i=g)=>_.getState().push({message:e,variant:`info`,ttl:i,action:{label:r,onClick:t}}),dismiss:e=>_.getState().dismiss(e)};function y({variant:e}){return e===`success`?(0,m.jsx)(o,{className:`h-4 w-4 text-success`}):e===`error`?(0,m.jsx)(t,{className:`h-4 w-4 text-destructive`}):e===`warn`?(0,m.jsx)(i,{className:`h-4 w-4 text-warning`}):(0,m.jsx)(s,{className:`h-4 w-4 text-info`})}function b({entry:e}){let{t}=a(),n=_(e=>e.dismiss);return(0,p.useEffect)(()=>{let t=setTimeout(()=>n(e.id),e.ttl);return()=>clearTimeout(t)},[e.id,e.ttl,n]),(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(),n(e.id)},className:`shrink-0 font-medium text-primary hover:underline`,children:e.action.label}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>n(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}=a(),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};
|