@wrongstack/webui 0.282.0 → 0.282.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AnalyticsDashboard-BrQc2ss-.js → AnalyticsDashboard-TCNC-sVb.js} +1 -1
- package/dist/assets/{AutoPhaseView-8NTdnZ0a.js → AutoPhaseView-BMUiT6aI.js} +1 -1
- package/dist/assets/{CodeEditor-C-pJLtUR.js → CodeEditor-C0si742k.js} +1 -1
- package/dist/assets/{DesignGalleryView-M6Hp7s9b.js → DesignGalleryView-BfZTw48N.js} +1 -1
- package/dist/assets/{KanbanView-nMv98m0N.js → KanbanView-C4T4y0b7.js} +1 -1
- package/dist/assets/{MailboxDetailView-g3IQx4DB.js → MailboxDetailView-DJtjP0NF.js} +1 -1
- package/dist/assets/{OfficeMapPanel-D3VE7UCd.js → OfficeMapPanel-CgvHvGQm.js} +1 -1
- package/dist/assets/{ProcessMonitor-CbfQYneY.js → ProcessMonitor-D53zn0h4.js} +1 -1
- package/dist/assets/{QueuePanel-eGK1SSKx.js → QueuePanel-DTO68vaB.js} +1 -1
- package/dist/assets/{SddBoardView-DvuH4f4e.js → SddBoardView-C8X4MiTy.js} +1 -1
- package/dist/assets/{SddWizard-G55Yw9Bb.js → SddWizard-t5Cly3CG.js} +1 -1
- package/dist/assets/{SkillDetailView-CX9zeWBG.js → SkillDetailView-Dq-fTqSp.js} +1 -1
- package/dist/assets/{SpecsView-BnUsqkrG.js → SpecsView-Cwd6PiYr.js} +1 -1
- package/dist/assets/{TerminalPanel-BCpddej2.js → TerminalPanel-Bzyhr2aC.js} +1 -1
- package/dist/assets/index-CWj2bI87.js +145 -0
- package/dist/index.html +1 -1
- package/dist/index.js +128 -58
- package/dist/index.js.map +1 -1
- package/dist/providers.json +2 -2
- package/dist/server/entry.js +300 -11
- package/dist/server/entry.js.map +1 -1
- package/dist/server/index.js +300 -11
- package/dist/server/index.js.map +1 -1
- package/package.json +6 -6
- package/dist/assets/index-BhO3caLf.js +0 -146
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{$r as r,Cr as i,It as a,Un as o,Ut as s,Vr as c,Z as l,Zt as u,ci as d,fn as f,gr as p,lr as m,pr as h,sr as g,ti as _,vn as v}from"./vendor-Ch4m_qLI.js";import"./i18n-CNo6A2vu.js";import{t as y}from"./utils-DBns3uMk.js";import{C as b,D as x,p as S,w as C}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{$r as r,Cr as i,It as a,Un as o,Ut as s,Vr as c,Z as l,Zt as u,ci as d,fn as f,gr as p,lr as m,pr as h,sr as g,ti as _,vn as v}from"./vendor-Ch4m_qLI.js";import"./i18n-CNo6A2vu.js";import{t as y}from"./utils-DBns3uMk.js";import{C as b,D as x,p as S,w as C}from"./index-CWj2bI87.js";var w=e(t(),1),T=n(),E={completed:{icon:(0,T.jsx)(_,{className:`h-3.5 w-3.5`}),label:`Completed`,text:`text-emerald-400`,ring:`border-emerald-500/40`},in_progress:{icon:(0,T.jsx)(c,{className:`h-3.5 w-3.5 animate-spin`}),label:`Running`,text:`text-sky-400`,ring:`border-sky-500/50`},queued:{icon:(0,T.jsx)(g,{className:`h-3.5 w-3.5`}),label:`Queued`,text:`text-amber-400`,ring:`border-amber-500/40`},blocked:{icon:(0,T.jsx)(f,{className:`h-3.5 w-3.5`}),label:`Blocked`,text:`text-rose-400`,ring:`border-rose-500/30`},pending:{icon:(0,T.jsx)(m,{className:`h-3.5 w-3.5`}),label:`Pending`,text:`text-slate-400`,ring:`border-white/10`},review:{icon:(0,T.jsx)(a,{className:`h-3.5 w-3.5`}),label:`Review`,text:`text-violet-400`,ring:`border-violet-500/40`},failed:{icon:(0,T.jsx)(r,{className:`h-3.5 w-3.5`}),label:`Failed`,text:`text-red-400`,ring:`border-red-500/50`},cancelled:{icon:(0,T.jsx)(i,{className:`h-3.5 w-3.5`}),label:`Cancelled`,text:`text-slate-400`,ring:`border-slate-500/40`}},D=[`completed`,`in_progress`,`queued`,`blocked`,`pending`,`failed`],O={critical:{label:`Crit`,cls:`bg-red-500/15 text-red-400`},high:{label:`High`,cls:`bg-red-500/15 text-red-400`},medium:{label:`Med`,cls:`bg-amber-500/15 text-amber-400`},low:{label:`Low`,cls:`bg-emerald-500/15 text-emerald-400`}};function k({columns:e,onTaskClick:t}){let{t:n}=d();return e.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-slate-400`,children:n(`activity:board.emptySpec`)}):(0,T.jsxs)(`div`,{className:`rounded-lg border border-white/10 bg-[#0f1115] p-4`,children:[(0,T.jsx)(`h3`,{className:`mb-3 text-sm font-semibold text-slate-200`,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:y(`inline-flex items-center gap-1.5`,E[e].text),children:[E[e].icon,(0,T.jsx)(`span`,{className:`text-slate-400`,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-white/10 pb-1 text-center text-xs font-medium uppercase tracking-wider text-slate-500`,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-slate-600`,children:(0,T.jsx)(h,{className:`h-5 w-5`})})]},n.label))})]})}function A({task:e,onClick:t}){let n=E[e.displayStatus],r=O[e.priority],{t:i}=d();return(0,T.jsxs)(`button`,{type:`button`,onClick:()=>t?.(e.id),className:y(`w-full rounded-md border bg-[#161a22] p-2.5 text-left transition-colors hover:border-orange-500/40`,n.ring),children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsxs)(`span`,{className:y(`inline-flex items-center gap-1.5 text-xs font-medium`,n.text),children:[n.icon,(0,T.jsx)(`span`,{className:`font-mono text-slate-300`,children:e.shortId})]}),(0,T.jsx)(`span`,{className:y(`rounded px-1.5 py-0.5 text-[10px] font-medium`,r.cls),children:r.label})]}),(0,T.jsx)(`p`,{className:`mt-1.5 text-xs text-slate-200`,children:e.title}),e.deps.length>0&&(0,T.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-slate-500`,children:[`← `,e.deps.join(`, `)]}),e.agentName&&(0,T.jsxs)(`div`,{className:y(`mt-1.5 inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[10px]`,e.displayStatus===`in_progress`?`bg-sky-500/15 text-sky-400`:`bg-white/5 text-slate-400`),title:e.worktreeBranch?i(`activity:board.worktreePrefix`,{branch:e.worktreeBranch}):void 0,children:[e.displayStatus===`in_progress`&&(0,T.jsx)(c,{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}){let{client:t}=b(),{t:n}=d(),r=x(e=>e.specs),i=x(e=>e.detail),a=x(e=>e.expandedSpecId),c=x(e=>e.setExpanded),[f,m]=(0,w.useState)(`graph`),g=(0,w.useCallback)(e=>{!i||i.specId!==e.id||(t?.send?.({type:`autophase.start`,payload:{title:e.title,phases:j(i),autonomous:!0}}),C(`autophase`))},[i,t]);(0,w.useEffect)(()=>{t?.send?.({type:`specs.list`})},[t]);let _=(0,w.useCallback)(e=>{a===e.id?c(null):(c(e.id),t?.send?.({type:`specs.get`,payload:{specId:e.id}}))},[a,c,t]),E=i?.columns.flatMap(e=>e.tasks)??[],D={done:E.filter(e=>e.status===`completed`).length,running:E.filter(e=>e.status===`in_progress`).length,pending:E.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)(o,{className:`h-5 w-5 text-orange-500`}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-lg font-semibold`,children:n(`activity:specs.heading`)}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`activity:specs.subtitle`)})]})]}),(0,T.jsx)(S,{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 p-4`,children:r.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:n(`activity:specs.empty`,{command:`/sdd`})}):(0,T.jsx)(`div`,{className:`space-y-3`,children:r.map(e=>{let t=a===e.id,r=e.total>0?Math.round(e.completed/e.total*100):0;return(0,T.jsxs)(`div`,{className:`rounded-lg border border-border bg-card/60`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>_(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)(p,{className:`h-4 w-4`}):(0,T.jsx)(h,{className:`h-4 w-4`})}),(0,T.jsx)(o,{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-emerald-500 transition-all`,style:{width:`${r}%`}})}),(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:[n(`activity:specs.tasks`,{count:i?.total??e.total}),i&&(0,T.jsxs)(`span`,{className:`ml-3 text-xs font-normal text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`text-emerald-500`,children:n(`activity:specs.doneCount`,{count:D.done})}),` `,(0,T.jsx)(`span`,{className:`text-sky-500`,children:n(`activity:specs.runningCount`,{count:D.running})}),` `,(0,T.jsx)(`span`,{children:n(`activity:specs.pendingCount`,{count:D.pending})})]})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(`button`,{type:`button`,disabled:!i||i.specId!==e.id,onClick:()=>g(e),title:n(`activity:specs.runTitle`),className:`inline-flex items-center gap-1 rounded-md bg-orange-500/15 px-2.5 py-1 text-xs font-medium text-orange-500 transition-colors hover:bg-orange-500/25 disabled:opacity-40`,children:[(0,T.jsx)(s,{className:`h-3.5 w-3.5`}),` `,n(`activity:specs.run`)]}),(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:()=>m(`list`),className:y(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,f===`list`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(v,{className:`h-3.5 w-3.5`}),` `,n(`activity:specs.list`)]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>m(`graph`),className:y(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,f===`graph`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(u,{className:`h-3.5 w-3.5`}),` `,n(`activity:specs.graph`)]})]})]})]}),!i||i.specId!==e.id?(0,T.jsx)(`div`,{className:`flex h-24 items-center justify-center text-sm text-muted-foreground`,children:n(`activity:specs.loadingTasks`)}):f===`graph`?(0,T.jsx)(k,{columns:i.columns}):(0,T.jsx)(`div`,{className:`space-y-1.5`,children:E.map(e=>(0,T.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border border-border bg-card px-3 py-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),(0,T.jsx)(`span`,{className:`flex-1 text-sm`,children:e.title}),(0,T.jsx)(`span`,{className:`text-xs capitalize text-muted-foreground`,children:e.displayStatus.replace(`_`,` `)})]},e.id))})]})]},e.id)})})})]})}export{M as SpecsView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{Fr as r,Ht as i,It as a,Z as o,ci as s,di as c,dt as l}from"./vendor-Ch4m_qLI.js";import"./i18n-CNo6A2vu.js";import{t as u}from"./ws-client-BAV7SLzK.js";import{t as d}from"./session-store-DN1UYDL9.js";import{n as f}from"./ui-store-BdOsq6T-.js";import{t as p}from"./utils-DBns3uMk.js";import{R as m}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{Fr as r,Ht as i,It as a,Z as o,ci as s,di as c,dt as l}from"./vendor-Ch4m_qLI.js";import"./i18n-CNo6A2vu.js";import{t as u}from"./ws-client-BAV7SLzK.js";import{t as d}from"./session-store-DN1UYDL9.js";import{n as f}from"./ui-store-BdOsq6T-.js";import{t as p}from"./utils-DBns3uMk.js";import{R as m}from"./index-CWj2bI87.js";import{n as h,t as g}from"./xterm-B9RXJkIu.js";var _=e(t(),1),v=`wrongstack.terminalDockHeight`;function y(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 b=n(),x={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`},S=8;function C(e=!1){return typeof window>`u`?300:y(window.innerHeight*(e?.32:.4))}function w(e=!1){if(typeof window>`u`)return C(e);try{let t=window.localStorage.getItem(v),n=t?Number.parseInt(t,10):NaN;return Number.isFinite(n)?y(n):C(e)}catch{return C(e)}}function T(e){try{window.localStorage.setItem(v,String(y(e)))}catch{}}function E(){try{return crypto.randomUUID()}catch{return`term-${Date.now()}-${Math.floor(Math.random()*1e6)}`}}function D(e){return{id:E(),name:`Terminal ${e}`,status:`starting`}}function O({desktopShell:e=!1,onClose:t}){let n=(0,_.useRef)(null),{t:c}=s(),u=(0,_.useRef)(1),[m,h]=(0,_.useState)(()=>w(e)),[g,v]=(0,_.useState)(()=>[D(1)]),[x,C]=(0,_.useState)(()=>g[0]?.id??``),O=f(e=>e.terminalCreateNonce),A=(0,_.useRef)(O),j=d(e=>e.projectName),M=d(e=>e.cwd);(0,_.useEffect)(()=>{let e=()=>{h(e=>{let t=y(e);return T(t),t})};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let N=e=>{e.preventDefault(),n.current?.();let t=e.clientY,r=m,i=document.body.style.cursor,a=document.body.style.userSelect;document.body.style.cursor=`ns-resize`,document.body.style.userSelect=`none`;let o=e=>{let n=y(r+t-e.clientY);h(n),T(n)},s=()=>{document.body.style.cursor=i,document.body.style.userSelect=a,window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s),n.current===s&&(n.current=null)};n.current=s,window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s,{once:!0}),window.addEventListener(`pointercancel`,s,{once:!0})};(0,_.useEffect)(()=>()=>n.current?.(),[]);let P=()=>{v(e=>{if(e.length>=S)return e;u.current+=1;let t=D(u.current);return C(t.id),[...e,t]})};(0,_.useEffect)(()=>{O!==A.current&&(A.current=O,P())},[O]);let F=e=>{v(n=>{let r=n.findIndex(t=>t.id===e);if(r===-1)return n;let i=n.filter(t=>t.id!==e);return i.length===0?(queueMicrotask(t),i):(x===e&&C(i[Math.max(0,r-1)]?.id??i[0]?.id??``),i)})},I=e=>{let t=E();v(n=>{let r=!1,i=n.map(n=>n.id===e?(r=!0,{...n,id:t,status:`starting`,exitCode:void 0}):n);return r&&C(t),i})},L=()=>{v([]),C(``),queueMicrotask(t)},R=(e,t)=>{v(n=>n.map(n=>n.id===e?{...n,...t}:n))},z=g.find(e=>e.id===x)??g[0]??null;return(0,b.jsxs)(`div`,{"data-terminal-dock":!0,style:{height:m},"data-shell":e?`desktop`:`browser`,className:p(`z-30 flex min-h-0 shrink-0 flex-col border-t border-border bg-[#1e1e2e] shadow-2xl`,e&&`ws-terminal-desktop`),children:[(0,b.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,title:c(`activity:terminal.resize`),onPointerDown:N,className:`h-1.5 cursor-ns-resize bg-[#181825] hover:bg-primary/35 transition-colors`}),(0,b.jsxs)(`div`,{className:p(`flex min-w-0 items-center justify-between gap-3 border-b border-border/40 bg-[#181825]`,e?`px-2 py-1`:`px-3 py-1.5`),children:[(0,b.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs text-[#cdd6f4]`,children:[(0,b.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`}),(0,b.jsx)(`span`,{className:`font-medium`,children:c(e?`activity:terminal.labelSingular`:`activity:terminal.labelPlural`)}),(0,b.jsx)(`span`,{className:`min-w-0 truncate text-[#a6adc8]`,children:j||M||c(`activity:terminal.projectShell`)})]}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:P,disabled:g.length>=S,title:g.length>=S?c(`activity:terminal.maxTerminals`,{count:S}):c(`activity:terminal.newTerminal`),className:`inline-flex items-center justify-center h-6 w-6 rounded text-[#a6adc8] hover:bg-white/10 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:(0,b.jsx)(i,{className:`h-4 w-4`})}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>z&&I(z.id),disabled:!z,title:c(`activity:terminal.restart`),className:`inline-flex items-center justify-center h-6 w-6 rounded text-[#a6adc8] hover:bg-white/10 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:(0,b.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,b.jsx)(`button`,{type:`button`,onClick:L,disabled:g.length===0,title:c(`activity:terminal.closeAll`),className:`inline-flex items-center justify-center h-6 w-6 rounded text-[#a6adc8] hover:bg-white/10 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:(0,b.jsx)(l,{className:`h-3.5 w-3.5`})}),(0,b.jsx)(`button`,{type:`button`,onClick:t,title:c(`activity:terminal.closeDock`),className:`inline-flex items-center justify-center h-6 w-6 rounded text-[#a6adc8] hover:bg-white/10 transition-colors`,children:(0,b.jsx)(o,{className:`h-4 w-4`})})]})]}),(0,b.jsx)(`div`,{className:p(`flex min-w-0 items-center gap-1 overflow-x-auto border-b border-border/40 bg-[#181825]`,e?`px-1.5 py-0.5`:`px-2 py-1`),children:g.map(t=>(0,b.jsxs)(`div`,{className:p(`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]`,x===t.id?`border-[#89b4fa]/45 bg-[#313244] text-[#cdd6f4]`:`border-transparent bg-transparent text-[#a6adc8] hover:bg-white/10`),children:[(0,b.jsxs)(`button`,{type:`button`,onClick:()=>C(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,b.jsx)(`span`,{className:p(`h-1.5 w-1.5 shrink-0 rounded-full`,t.status===`running`&&`bg-[#a6e3a1]`,t.status===`starting`&&`bg-[#89b4fa]`,t.status===`exited`&&`bg-[#f38ba8]`)}),(0,b.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[t.name,t.status===`exited`&&typeof t.exitCode==`number`?` (${t.exitCode})`:``]})]}),(0,b.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-[#a6adc8] opacity-70 hover:bg-white/10 hover:opacity-100`,title:c(`activity:terminal.closeTab`,{name:t.name}),children:(0,b.jsx)(o,{className:`h-3 w-3`})})]},t.id))}),M&&!e&&(0,b.jsx)(`div`,{className:`min-w-0 truncate border-b border-border/30 bg-[#181825] px-3 py-1 text-[11px] font-mono text-[#6c7086]`,children:M}),(0,b.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:g.map(e=>(0,b.jsx)(k,{id:e.id,active:e.id===x,onRunning:()=>R(e.id,{status:`running`}),onExit:t=>R(e.id,{status:`exited`,exitCode:t})},e.id))})]})}function k({id:e,active:t,onRunning:n,onExit:r}){let i=(0,_.useRef)(null),a=(0,_.useRef)(null),o=(0,_.useRef)(null),s=(0,_.useRef)(n),l=(0,_.useRef)(r),d=m(e=>e.wsConnected);return(0,_.useEffect)(()=>{s.current=n,l.current=r},[r,n]),(0,_.useEffect)(()=>{let t=i.current;if(!t)return;let n=new g({fontFamily:`"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:13,cursorBlink:!0,theme:x,scrollback:5e3}),r=new h;a.current=n,o.current=r,n.loadAddon(r),n.open(t);try{r.fit()}catch{}let d=u(m.getState().wsUrl);d.send({type:`terminal.create`,payload:{id:e,cols:n.cols,rows:n.rows}}),s.current();let f=d.on(`terminal.output`,t=>{t.type===`terminal.output`&&t.payload.id===e&&n.write(t.payload.data)}),p=d.on(`terminal.exit`,t=>{t.type===`terminal.exit`&&t.payload.id===e&&(n.write(`\r\n\x1b[2m${c.t(`activity:terminal.processExited`,{code:t.payload.exitCode})}\x1b[0m\r\n`),l.current(t.payload.exitCode))}),_=n.onData(t=>{d.send({type:`terminal.input`,payload:{id:e,data:t}})}),v=new ResizeObserver(()=>{if(t.offsetParent)try{r.fit(),d.send({type:`terminal.resize`,payload:{id:e,cols:n.cols,rows:n.rows}})}catch{}});return v.observe(t),()=>{f(),p(),_.dispose(),v.disconnect(),d.send({type:`terminal.close`,payload:{id:e}}),n.dispose(),a.current=null,o.current=null}},[e,d]),(0,_.useEffect)(()=>{t&&window.requestAnimationFrame(()=>{try{o.current?.fit();let t=a.current;t&&(u(m.getState().wsUrl).send({type:`terminal.resize`,payload:{id:e,cols:t.cols,rows:t.rows}}),t.focus())}catch{}})},[t,e]),(0,b.jsx)(`div`,{ref:i,className:p(`absolute inset-0 min-h-0 min-w-0 overflow-hidden px-2 py-1`,t?`block`:`hidden`)})}export{O as TerminalPanel};
|