@wrongstack/webui 0.282.2 → 0.283.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-vbaFTrJa.js +1 -0
- package/dist/assets/AutoPhaseView-Ce8a1eUl.js +1 -0
- package/dist/assets/{CodeEditor-dOQDoCfn.js → CodeEditor-CduSdsMI.js} +1 -1
- package/dist/assets/DebugDashboard-DoVJhkxa.js +1 -0
- package/dist/assets/DesignGalleryView-DaLPPF4Q.js +1 -0
- package/dist/assets/KanbanView-BdsVeyFI.js +1 -0
- package/dist/assets/MailboxDetailView-BYR6CSvz.js +1 -0
- package/dist/assets/OfficeMapPanel-BkaZBJEZ.js +4 -0
- package/dist/assets/ProcessMonitor-C7OgHnln.js +1 -0
- package/dist/assets/QueuePanel-BweqXLzT.js +1 -0
- package/dist/assets/RefreshDebugView-LYcQUNfU.js +1 -0
- package/dist/assets/SddBoardView-c87Bwdig.js +2 -0
- package/dist/assets/SddFlowGraph-DK7RD9NA.js +1 -0
- package/dist/assets/SddWizard-C8wm_izV.js +1 -0
- package/dist/assets/SessionsDashboard-DySTssFb.js +1 -0
- package/dist/assets/SkillDetailView-y0BgfnBr.js +2 -0
- package/dist/assets/SpecsView-BudIVvtN.js +1 -0
- package/dist/assets/TerminalPanel-DxtPDRk5.js +1 -0
- package/dist/assets/{activity-CqiCPjKb.js → activity-BjnFo4NL.js} +1 -1
- package/dist/assets/{activity-DT93tsyC.js → activity-Lmjx6MD1.js} +1 -1
- package/dist/assets/{chat-store-7ekEnPAf.js → chat-store-uNXIpAx_.js} +2 -2
- package/dist/assets/{i18n-BCQuDmQo.js → i18n-DD-_8vnT.js} +2 -2
- package/dist/assets/index-0LBBDKsK.js +147 -0
- package/dist/assets/index-Dv6bXQoD.css +1 -0
- package/dist/assets/{session-store-KCJiKVqL.js → session-store-DhcyG2AC.js} +1 -1
- package/dist/assets/settings-Os0ifjjB.js +1 -0
- package/dist/assets/settings-UGa_oSYC.js +1 -0
- package/dist/assets/{ui-store-CcznRsiV.js → ui-store-isn1eTG7.js} +1 -1
- package/dist/assets/utils-B-rhScDN.js +1 -0
- package/dist/assets/{vendor-Cm3Womkr.js → vendor-OWPFcqeg.js} +25 -25
- package/dist/assets/ws-client-Dglowar-.js +1 -0
- package/dist/assets/{xyflow-Dy5Edi88.js → xyflow-CGx_hPAX.js} +1 -1
- package/dist/index.html +11 -11
- package/dist/index.js +3886 -3334
- package/dist/index.js.map +1 -1
- package/dist/server/entry.js +11 -0
- package/dist/server/entry.js.map +1 -1
- package/dist/server/index.js +11 -0
- package/dist/server/index.js.map +1 -1
- package/package.json +6 -6
- package/dist/assets/AnalyticsDashboard-CPLSpHzV.js +0 -1
- package/dist/assets/AutoPhaseView-HIzNPExo.js +0 -1
- package/dist/assets/DebugDashboard-CQCI-B4W.js +0 -1
- package/dist/assets/DesignGalleryView-BxTlrmrr.js +0 -1
- package/dist/assets/KanbanView-2uDRr6Qd.js +0 -1
- package/dist/assets/MailboxDetailView-B0DCs5lu.js +0 -1
- package/dist/assets/OfficeMapPanel-lGSaptet.js +0 -4
- package/dist/assets/ProcessMonitor-eTb8_-ZW.js +0 -1
- package/dist/assets/QueuePanel-TbbkNAx_.js +0 -1
- package/dist/assets/RefreshDebugView-CX6x-xHs.js +0 -1
- package/dist/assets/SddBoardView-BXQsH6fr.js +0 -2
- package/dist/assets/SddFlowGraph-DTWV-DPB.js +0 -1
- package/dist/assets/SddWizard-1ZhDgcgM.js +0 -1
- package/dist/assets/SessionsDashboard-CfNbqjeh.js +0 -1
- package/dist/assets/SkillDetailView-UzixISza.js +0 -2
- package/dist/assets/SpecsView-BO8yG6ID.js +0 -1
- package/dist/assets/TerminalPanel-Bjbu9ktV.js +0 -1
- package/dist/assets/index-Cb-hw9qG.js +0 -147
- package/dist/assets/index-ZtF5f7wy.css +0 -1
- package/dist/assets/settings-OOQ-99Tn.js +0 -1
- package/dist/assets/settings-wb322bGN.js +0 -1
- package/dist/assets/utils-C3qJEm2b.js +0 -1
- package/dist/assets/ws-client-9j1mjm9I.js +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{c as t,m as n,o as r,p as i}from"./markdown-D0X23O-i.js";import{An as ee,Bt as te,Cr as ne,Dr as re,Gn as ie,Jt as ae,Rr as oe,Ur as a,Xt as se,Z as o,_r as ce,dt as s,er as le,hr as c,pi as l,sr as ue,t as de,ui as fe,yr as pe,zn as me}from"./vendor-Cm3Womkr.js";import"./i18n-BCQuDmQo.js";import{n as u}from"./ui-store-CcznRsiV.js";import{t as d}from"./utils-C3qJEm2b.js";import{C as he,T as ge,d as f}from"./index-Cb-hw9qG.js";var p=e(n(),1),m=i();function h(e){return e===`project`||e===`user`}function g(e){let t=e.match(/^(.+?)\/SKILL(?:\.save)?\.md$/);return t?t[1]:null}function _e({source:e}){let{t}=fe(),n=e===`project`?`project`:e===`user`?`user`:`bundled`;return(0,m.jsx)(`span`,{className:d(`inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide`,n===`project`&&`bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400`,n===`user`&&`bg-violet-100 text-violet-700 dark:bg-violet-950 dark:text-violet-400`,n===`bundled`&&`bg-slate-100 text-slate-600 dark:bg-slate-800 dark:text-slate-400`),children:t(`activity:skillDetail.${{project:`scopeProject`,user:`scopeGlobal`,bundled:`scopeBundled`}[n]}`)})}function _({className:e}){let{t:n}=fe(),{client:i}=he(),_=u(e=>e.skillsState),v=u(e=>e.setSkillsState),y=_.selectedSkill,b=_.navHistory,x=_.historyIndex,[S,C]=(0,p.useState)(null),[ve,w]=(0,p.useState)(!1),[T,E]=(0,p.useState)(null),[D,O]=(0,p.useState)(!1),[k,A]=(0,p.useState)(``),[j,M]=(0,p.useState)(!1),[N,P]=(0,p.useState)(null),[F,I]=(0,p.useState)(!1),[L,R]=(0,p.useState)(null),[z,B]=(0,p.useState)(!1),V=(0,p.useRef)(``),[H,ye]=(0,p.useState)(!1),[U,W]=(0,p.useState)(null),[be,xe]=(0,p.useState)(!1),[G,K]=(0,p.useState)(null),[q,Se]=(0,p.useState)(!1),[Ce,we]=(0,p.useState)([]),J=(0,p.useRef)(_);J.current=_;let Y=(0,p.useRef)(!1),X=(0,p.useMemo)(()=>k?{lines:k.split(`
|
|
2
|
-
`).length,words:k.trim()?k.trim().split(/\s+/).length:0,chars:k.length}:{lines:0,words:0,chars:0},[k]),Z=(0,p.useMemo)(()=>{if(!k)return null;let e=5*1024*1024,t=new Blob([k]).size;return t>=e?{level:`critical`,used:t,limit:e}:t>=4194304?{level:`warn`,used:t,limit:e}:null},[k]);(0,p.useEffect)(()=>{if(!L)return;let e=setTimeout(()=>R(null),2e3);return()=>clearTimeout(e)},[L]),(0,p.useEffect)(()=>{if(!D||!y)return;let e=setInterval(()=>{k&&k!==V.current&&(V.current=k,localStorage.setItem(`skills_draft_${y.name}`,JSON.stringify({content:k,savedAt:Date.now()})),R(Date.now()))},5e3);return()=>clearInterval(e)},[D,k,y]),(0,p.useEffect)(()=>{if(!y||!D)return;let e=localStorage.getItem(`skills_draft_${y.name}`);if(e)try{let{content:t}=JSON.parse(e);t&&t!==k&&t!==V.current&&(A(t),V.current=t,B(!0))}catch{}},[y?.name,D]),(0,p.useEffect)(()=>{if(!i||!y)return;w(!0),C(null),E(null);let e=setTimeout(()=>{w(!1),E(l.t(`activity:skillDetail.timeoutError`))},1e4),t=t=>{clearTimeout(e);let n=t;n.payload.error?E(n.payload.error):n.payload.name&&C(n.payload),w(!1)},n=e=>{let t=e;ye(!1);let n=J.current;if(t.payload.success){let e={...n.knownRefs};for(let n of t.payload.updated??[])e[n.name]=n.newRef;v({...n,knownRefs:e,updateAvailableCount:0}),W({updated:t.payload.updated??[],unchanged:t.payload.unchanged??[],errors:t.payload.errors??[]}),i.send({type:`skills.list`})}else W({updated:[],unchanged:[],errors:[{name:``,error:t.payload.error??l.t(`activity:skillDetail.updateFailed`)}]})},r=e=>{let t=e;t.payload.skills&&we(t.payload.skills)};return i.on(`skills.content`,t),i.on(`skills.updated`,n),i.on(`skills.list`,r),i.send({type:`skills.content`,payload:{name:y.name,source:y.source}}),()=>{clearTimeout(e),i.off(`skills.content`,t),i.off(`skills.updated`,n),i.off(`skills.list`,r)}},[i,y?.name,y?.source]),(0,p.useEffect)(()=>{D&&(O(!1),A(``),P(null))},[y?.name]);let Q=(0,p.useCallback)(e=>Ce.find(t=>t.name.toLowerCase()===e.toLowerCase()),[Ce]),Te=(0,p.useCallback)(e=>{let t=Q(e);if(t){Y.current=!1;let e=b.slice(0,x+1);e.push(t),v({...J.current,selectedSkill:t,navHistory:e,historyIndex:e.length-1}),O(!1),A(``),W(null)}},[Q,b,x,v]),Ee=(0,p.useCallback)(()=>{if(x<=0)return;Y.current=!0;let e=x-1,t=b[e];v({...J.current,selectedSkill:t,historyIndex:e}),O(!1),A(``),W(null)},[x,b,v]),De=(0,p.useCallback)(()=>{if(x>=b.length-1)return;Y.current=!0;let e=x+1,t=b[e];v({...J.current,selectedSkill:t,historyIndex:e}),O(!1),A(``),W(null)},[x,b,v]),$=(0,p.useCallback)(()=>{ge(`chat`)},[]),Oe=(0,p.useCallback)(()=>{S&&(A(S.body),V.current=S.body,B(!1),P(null),O(!0),I(!1))},[S]),ke=(0,p.useCallback)(()=>{O(!1),A(``),P(null),I(!1),B(!1),y&&localStorage.removeItem(`skills_draft_${y.name}`)},[y]),Ae=(0,p.useCallback)(()=>{!y||!S||(B(!1),A(S.body),V.current=S.body,y&&localStorage.removeItem(`skills_draft_${y.name}`))},[y,S]),je=(0,p.useCallback)(()=>{if(!i||!y||!k.trim())return;M(!0),P(null);let e=t=>{let n=t;M(!1),n.payload.success?(V.current=``,localStorage.removeItem(`skills_draft_${y.name}`),B(!1),O(!1),i.send({type:`skills.content`,payload:{name:y.name,source:y.source}}),i.send({type:`skills.list`})):P(n.payload.error??l.t(`activity:skillDetail.saveFailed`)),i.off(`skills.edited`,e)};i.on(`skills.edited`,e),i.editSkill(y.name,k)},[i,y,k]),Me=(0,p.useCallback)(()=>{!i||!y||(ye(!0),W(null),i.checkForUpdates(y.name,y.source===`user`))},[i,y]),Ne=(0,p.useCallback)(()=>{y?.sourceUrl&&navigator.clipboard.writeText(y.sourceUrl).then(()=>{xe(!0),setTimeout(()=>xe(!1),2e3)})},[y]),Pe=(0,p.useCallback)(()=>{if(!S?.body)return;let e=new Blob([S.body],{type:`text/markdown`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${S.name.replace(/\//g,`_`)}-SKILL.md`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},[S]),Fe=(0,p.useCallback)(async e=>{if(!i||!e)return;Se(!0);let t=e=>{let n=e;Se(!1),n.payload.success?(K(null),i.send({type:`skills.list`}),$()):P(n.payload.error??l.t(`activity:skillDetail.uninstallFailed`)),i.off(`skills.uninstalled`,t)};i.on(`skills.uninstalled`,t),i.uninstallSkill(e.name,e.source===`user`)},[i,$]);return y?(0,m.jsxs)(`div`,{className:d(`flex h-full min-h-0 min-w-0 flex-col overflow-hidden bg-background`,e),children:[(0,m.jsxs)(`div`,{className:`px-4 py-3 border-b bg-card shrink-0`,children:[(0,m.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,m.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(oe,{className:`h-4 w-4 text-primary shrink-0`}),(0,m.jsx)(`h1`,{className:`text-base font-semibold truncate`,children:y.name}),y.version&&(0,m.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`v`,y.version]}),(0,m.jsx)(_e,{source:y.source})]}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:y.description||y.trigger}),y.sourceUrl&&(0,m.jsxs)(`div`,{className:`flex items-center gap-1 mt-2`,children:[(0,m.jsxs)(`a`,{href:`https://${y.sourceUrl.replace(`github:`,``)}`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,title:n(`activity:skillDetail.openSourceRepo`),children:[(0,m.jsx)(ee,{className:`h-3 w-3 shrink-0`}),(0,m.jsx)(`span`,{className:`truncate font-mono`,children:y.sourceUrl})]}),(0,m.jsx)(`button`,{type:`button`,onClick:Ne,className:`flex items-center shrink-0 text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,title:n(`activity:skillDetail.copySourceUrl`),children:be?(0,m.jsx)(pe,{className:`h-3 w-3 text-green-500`}):(0,m.jsx)(ue,{className:`h-3 w-3`})})]}),y.scope.length>0&&(0,m.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:y.scope.map(e=>(0,m.jsx)(`span`,{className:`px-1.5 py-0.5 text-[10px] rounded bg-muted text-muted-foreground`,children:e},e))}),U&&(0,m.jsxs)(`div`,{className:`mt-2 text-xs space-y-1`,children:[U.updated.length>0&&(0,m.jsx)(`div`,{className:`text-green-600`,children:n(`activity:skillDetail.updatedLabel`,{list:U.updated.map(e=>`${e.name} (${e.oldRef} → ${e.newRef})`).join(`, `)})}),U.unchanged.length>0&&(0,m.jsx)(`div`,{className:`text-muted-foreground`,children:n(`activity:skillDetail.upToDateLabel`,{list:U.unchanged.join(`, `)})}),U.errors.length>0&&(0,m.jsx)(`div`,{className:`text-destructive`,children:n(`activity:skillDetail.errorsLabel`,{list:U.errors.map(e=>`${e.name?`${e.name}: `:``}${e.error}`).join(`; `)})})]})]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-1 ml-auto shrink-0`,children:[h(y.source)&&y.sourceUrl&&(0,m.jsx)(`button`,{type:`button`,onClick:Me,disabled:H,className:`flex items-center gap-1 px-2 py-1.5 text-xs rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors cursor-pointer disabled:opacity-50`,title:n(`activity:skillDetail.checkUpdatesTitle`),children:H?(0,m.jsx)(a,{className:`h-3.5 w-3.5 animate-spin`}):(0,m.jsx)(te,{className:`h-3.5 w-3.5`})}),y.source!==`bundled`&&!D&&(0,m.jsx)(`button`,{type:`button`,onClick:Pe,className:`flex items-center gap-1 px-2 py-1.5 text-xs rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors cursor-pointer`,title:n(`activity:skillDetail.exportTitle`),children:(0,m.jsx)(le,{className:`h-3.5 w-3.5`})}),h(y.source)&&!D&&(0,m.jsx)(`button`,{type:`button`,onClick:Oe,className:`flex items-center gap-1 px-2 py-1.5 text-xs rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors cursor-pointer`,title:n(`activity:skillDetail.editTitle`),children:(0,m.jsx)(ae,{className:`h-3.5 w-3.5`})}),h(y.source)&&(0,m.jsx)(`button`,{type:`button`,onClick:()=>K(y),className:`flex items-center gap-1 px-2 py-1.5 text-xs rounded text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors cursor-pointer`,title:n(`activity:skillDetail.uninstallTitle`),children:(0,m.jsx)(s,{className:`h-3.5 w-3.5`})}),(0,m.jsx)(`button`,{type:`button`,onClick:$,className:`p-1.5 rounded hover:bg-accent text-muted-foreground cursor-pointer`,title:n(`activity:skillDetail.closeTitle`),children:(0,m.jsx)(o,{className:`h-4 w-4`})})]})]}),b.length>1&&(0,m.jsxs)(`div`,{className:`flex items-center gap-1 mt-2`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:Ee,disabled:x<=0,className:d(`p-1 rounded transition-colors`,x<=0?`text-muted-foreground/40 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:n(`activity:skillDetail.backTitle`),children:(0,m.jsx)(ce,{className:`h-4 w-4`})}),(0,m.jsx)(`button`,{type:`button`,onClick:De,disabled:x>=b.length-1,className:d(`p-1 rounded transition-colors`,x>=b.length-1?`text-muted-foreground/40 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:n(`activity:skillDetail.forwardTitle`),children:(0,m.jsx)(c,{className:`h-4 w-4`})}),(0,m.jsx)(`div`,{className:`flex items-center gap-0.5 overflow-x-auto text-xs`,children:b.map((e,t)=>(0,m.jsxs)(`span`,{className:`flex items-center shrink-0`,children:[t>0&&(0,m.jsx)(c,{className:`h-3 w-3 text-muted-foreground/40 mx-0.5 shrink-0`}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>{t<x&&(Y.current=!0,v({...J.current,selectedSkill:e,historyIndex:t}),O(!1),A(``),W(null))},className:d(`hover:text-primary cursor-pointer transition-colors`,t===x?`text-primary font-medium`:`text-muted-foreground`),children:e.name})]},e.name+t))})]})]}),S&&(S.relatedFiles.length>0||S.references.length>0)&&(0,m.jsxs)(`div`,{className:`px-4 py-2 border-b bg-muted/30 shrink-0 space-y-2`,children:[S.relatedFiles.length>0&&(0,m.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,m.jsx)(me,{className:`h-3 w-3`}),(0,m.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:n(`activity:skillDetail.relatedFiles`)})]}),S.relatedFiles.map(e=>{let t=g(e);return t&&Q(t)?(0,m.jsxs)(`button`,{type:`button`,onClick:()=>Te(t),className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded bg-background border border-border hover:border-primary hover:text-primary transition-colors cursor-pointer`,title:n(`activity:skillDetail.goToSkillTitle`,{name:t}),children:[(0,m.jsx)(re,{className:`h-2.5 w-2.5`}),e]},e):(0,m.jsx)(`span`,{className:`px-1.5 py-0.5 text-[10px] rounded bg-background border border-border text-muted-foreground`,children:e},e)})]}),S.references.length>0&&(0,m.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,m.jsx)(ie,{className:`h-3 w-3`}),(0,m.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:n(`activity:skillDetail.references`)})]}),S.references.map(e=>{let t=g(e)??e.replace(/\.md$/,``);return Q(t)?(0,m.jsxs)(`button`,{type:`button`,onClick:()=>Te(t),className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded bg-primary/5 border border-primary/20 text-primary hover:bg-primary/10 hover:border-primary/30 transition-colors cursor-pointer`,title:n(`activity:skillDetail.goToSkillTitle`,{name:t}),children:[(0,m.jsx)(re,{className:`h-2.5 w-2.5`}),t]},e):(0,m.jsx)(`span`,{className:`px-1.5 py-0.5 text-[10px] rounded bg-muted text-muted-foreground`,children:t},e)})]})]}),(0,m.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto`,children:ve?(0,m.jsxs)(`div`,{className:`p-8 text-center text-muted-foreground`,children:[(0,m.jsx)(a,{className:`h-6 w-6 animate-spin mx-auto mb-2`}),(0,m.jsx)(`p`,{children:n(`activity:skillDetail.loadingContent`)})]}):D?(0,m.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,m.jsxs)(`div`,{className:`px-4 py-2 border-b shrink-0 flex items-center justify-between gap-2`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,m.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`activity:skillDetail.editingLabel`,{name:y.name})}),(0,m.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:n(`activity:skillDetail.editStats`,{lines:X.lines,words:X.words,chars:X.chars})}),Z&&(0,m.jsx)(`span`,{className:`text-xs tabular-nums ${Z.level===`critical`?`text-red-500 font-medium`:`text-amber-500`}`,children:n(`activity:skillDetail.charsWarningFmt`,{used:(Z.used/(1024*1024)).toFixed(1),limit:(Z.limit/(1024*1024)).toFixed(0)})}),L&&(0,m.jsx)(`span`,{className:`text-xs text-green-500 animate-pulse`,children:n(`activity:skillDetail.draftSaved`)}),z&&(0,m.jsx)(`span`,{className:`text-xs text-amber-500 animate-pulse`,children:n(`activity:skillDetail.draftRestored`)})]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[N&&(0,m.jsx)(`span`,{className:`text-xs text-destructive`,children:N}),z&&(0,m.jsx)(`button`,{type:`button`,onClick:Ae,className:`px-2 py-1 text-[10px] rounded border border-amber-500/50 text-amber-600 dark:text-amber-400 hover:bg-amber-500/10 transition-colors cursor-pointer`,children:n(`activity:skillDetail.discardDraft`)}),(0,m.jsx)(`button`,{type:`button`,onClick:ke,className:`px-2 py-1 text-xs rounded border border-border hover:bg-accent transition-colors cursor-pointer`,children:n(`common:action.cancel`)}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>I(e=>!e),title:n(F?`activity:skillDetail.hidePreviewTitle`:`activity:skillDetail.splitViewTitle`),className:`px-2 py-1 text-xs rounded border transition-colors cursor-pointer ${F?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-accent text-muted-foreground`}`,children:(0,m.jsx)(se,{className:`h-3 w-3 inline`})}),(0,m.jsx)(`button`,{type:`button`,onClick:je,disabled:j||!k.trim(),className:`px-3 py-1 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors cursor-pointer`,children:j?(0,m.jsx)(a,{className:`h-3 w-3 animate-spin inline`}):n(`common:action.save`)})]})]}),F?(0,m.jsxs)(`div`,{className:`flex flex-1 min-h-0 gap-0.5`,children:[(0,m.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0`,children:(0,m.jsx)(de,{value:k,onChange:e=>A(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:n(`activity:skillDetail.contentPlaceholder`)})}),(0,m.jsx)(`div`,{className:`w-px bg-border flex-shrink-0`}),(0,m.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto p-4 prose prose-sm dark:prose-invert max-w-none`,children:(0,m.jsx)(t,{rehypePlugins:[r],components:f,children:k})})]}):(0,m.jsx)(de,{value:k,onChange:e=>A(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:n(`activity:skillDetail.contentPlaceholder`)})]}):S?(0,m.jsx)(`div`,{className:`p-6 prose prose-sm dark:prose-invert max-w-none`,children:(0,m.jsx)(t,{rehypePlugins:[r],components:f,children:S.body})}):T?(0,m.jsxs)(`div`,{className:`p-8 text-center`,children:[(0,m.jsx)(`p`,{className:`text-destructive mb-2`,children:n(`activity:skillDetail.loadFailed`)}),(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:T}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>{i&&y&&(w(!0),E(null),i.send({type:`skills.content`,payload:{name:y.name,source:y.source}}))},className:`mt-4 px-3 py-1.5 text-xs rounded border border-border hover:bg-accent transition-colors`,children:n(`common:action.retry`)})]}):(0,m.jsx)(`div`,{className:`p-8 text-center text-muted-foreground`,children:n(`activity:skillDetail.noContent`)})}),G&&(0,m.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40`,onClick:e=>{e.target===e.currentTarget&&K(null)},children:(0,m.jsxs)(`div`,{className:`flex max-h-[calc(100dvh-2rem)] w-[380px] max-w-[90vw] flex-col overflow-hidden rounded-lg border bg-background shadow-xl`,children:[(0,m.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between p-4 border-b`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(s,{className:`h-4 w-4 text-destructive`}),(0,m.jsx)(`span`,{className:`font-semibold text-sm`,children:n(`activity:skillDetail.uninstallSkillHeading`)})]}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>K(null),className:`p-1 rounded hover:bg-accent text-muted-foreground cursor-pointer`,children:(0,m.jsx)(o,{className:`h-4 w-4`})})]}),(0,m.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4 space-y-2`,children:[(0,m.jsx)(`p`,{className:`text-sm`,children:n(`activity:skillDetail.uninstallConfirm`,{name:G.name})}),(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`activity:skillDetail.uninstallRemovePath`,{path:G.source===`user`?`~/.wrongstack/skills`:`.wrongstack/skills`})})]}),(0,m.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 p-4 border-t bg-muted/20`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:()=>K(null),disabled:q,className:`px-3 py-1.5 text-xs rounded border border-border hover:bg-accent transition-colors disabled:opacity-50`,children:n(`common:action.cancel`)}),(0,m.jsxs)(`button`,{type:`button`,onClick:()=>Fe(G),disabled:q,className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,children:[q&&(0,m.jsx)(a,{className:`h-3 w-3 animate-spin`}),n(`activity:skillDetail.uninstallAction`)]})]})]})})]}):(0,m.jsxs)(`div`,{className:d(`flex-1 flex flex-col items-center justify-center text-muted-foreground p-8`,e),children:[(0,m.jsx)(ne,{className:`h-12 w-12 mb-4 opacity-20`}),(0,m.jsx)(`p`,{className:`text-base font-medium`,children:n(`activity:skillDetail.noSkillSelected`)}),(0,m.jsx)(`p`,{className:`text-sm mt-1 text-center max-w-[300px]`,children:n(`activity:skillDetail.selectSkillHint`)}),(0,m.jsx)(`button`,{type:`button`,onClick:$,className:`mt-4 px-4 py-2 text-sm rounded-md border border-border hover:bg-accent transition-colors`,children:n(`activity:skillDetail.goToChat`)})]})}export{_ as SkillDetailView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{$t as r,Gn as i,Gt as a,It as o,Tr as s,Ur as c,Z as l,bn as u,dr as d,hr as f,lr as p,mn as m,ri as h,ti as g,ui as _,vr as v}from"./vendor-Cm3Womkr.js";import"./i18n-BCQuDmQo.js";import{t as y}from"./utils-C3qJEm2b.js";import{C as b,D as x,p as S,w as C}from"./index-Cb-hw9qG.js";var w=e(t(),1),T=n(),E={completed:{icon:(0,T.jsx)(h,{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)(p,{className:`h-3.5 w-3.5`}),label:`Queued`,text:`text-amber-400`,ring:`border-amber-500/40`},blocked:{icon:(0,T.jsx)(m,{className:`h-3.5 w-3.5`}),label:`Blocked`,text:`text-rose-400`,ring:`border-rose-500/30`},pending:{icon:(0,T.jsx)(d,{className:`h-3.5 w-3.5`}),label:`Pending`,text:`text-slate-400`,ring:`border-white/10`},review:{icon:(0,T.jsx)(o,{className:`h-3.5 w-3.5`}),label:`Review`,text:`text-violet-400`,ring:`border-violet-500/40`},failed:{icon:(0,T.jsx)(g,{className:`h-3.5 w-3.5`}),label:`Failed`,text:`text-red-400`,ring:`border-red-500/50`},cancelled:{icon:(0,T.jsx)(s,{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}=_();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)(f,{className:`h-5 w-5`})})]},n.label))})]})}function A({task:e,onClick:t}){let n=E[e.displayStatus],r=O[e.priority],{t:i}=_();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}=_(),o=x(e=>e.specs),s=x(e=>e.detail),c=x(e=>e.expandedSpecId),d=x(e=>e.setExpanded),[p,m]=(0,w.useState)(`graph`),h=(0,w.useCallback)(e=>{!s||s.specId!==e.id||(t?.send?.({type:`autophase.start`,payload:{title:e.title,phases:j(s),autonomous:!0}}),C(`autophase`))},[s,t]);(0,w.useEffect)(()=>{t?.send?.({type:`specs.list`})},[t]);let g=(0,w.useCallback)(e=>{c===e.id?d(null):(d(e.id),t?.send?.({type:`specs.get`,payload:{specId:e.id}}))},[c,d,t]),E=s?.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)(i,{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:o.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:o.map(e=>{let t=c===e.id,o=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:()=>g(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)(v,{className:`h-4 w-4`}):(0,T.jsx)(f,{className:`h-4 w-4`})}),(0,T.jsx)(i,{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:`${o}%`}})}),(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:s?.total??e.total}),s&&(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:!s||s.specId!==e.id,onClick:()=>h(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)(a,{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`,p===`list`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(u,{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`,p===`graph`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(r,{className:`h-3.5 w-3.5`}),` `,n(`activity:specs.graph`)]})]})]})]}),!s||s.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`)}):p===`graph`?(0,T.jsx)(k,{columns:s.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 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{It as r,Lr as i,Wt as a,Z as o,dt as s,pi as c,ui as l}from"./vendor-Cm3Womkr.js";import"./i18n-BCQuDmQo.js";import{t as u}from"./ws-client-9j1mjm9I.js";import{t as d}from"./session-store-KCJiKVqL.js";import{n as f}from"./ui-store-CcznRsiV.js";import{t as p}from"./utils-C3qJEm2b.js";import{R as m}from"./index-Cb-hw9qG.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}=l(),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)(i,{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)(a,{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)(r,{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)(s,{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};
|