forge-cw 0.1.32 → 0.1.34

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.
@@ -7,8 +7,8 @@
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
8
  <title>Forge Console</title>
9
9
  <script type="importmap">{"imports":{"preact":"/shared/preact.js","preact/hooks":"/shared/preact-hooks.js","preact/jsx-runtime":"/shared/preact-jsx-runtime.js","preact/compat":"/shared/preact-compat.js","@preact/signals":"/shared/preact-signals.js","@forge-dev/ui":"/shared/forge-dev-ui.js","@forge-dev/sdk":"/shared/forge-dev-sdk.js"}}</script>
10
- <script type="module" crossorigin src="/assets/index-BWlifYmN.js"></script>
11
- <link rel="stylesheet" crossorigin href="/assets/index-DPf7M8cb.css">
10
+ <script type="module" crossorigin src="/assets/index-DhVIne91.js"></script>
11
+ <link rel="stylesheet" crossorigin href="/assets/index-BzYNk_Ny.css">
12
12
  <link rel="stylesheet" href="/shared/forge-dev-ui.css">
13
13
  </head>
14
14
  <body>
@@ -1,13 +1,13 @@
1
- import{jsx as e}from"./preact-jsx-runtime.js";import{useState as B,useRef as w,useEffect as O,useLayoutEffect as Z,useCallback as ee}from"./preact-hooks.js";import{signal as re}from"./preact-signals.js";import{createPortal as Q}from"./preact-compat.js";import"./preact.js";const te={good:"var(--green)",warn:"var(--orange)",bad:"var(--red)",neutral:"var(--ink-3)"},ye=({icon:r,label:n,value:o,trend:t,status:a})=>e("div",{class:"relative overflow-hidden",style:{padding:"10px 12px",borderRadius:"13px",background:"var(--card)",border:"1px solid var(--hair)",boxShadow:"var(--shadow-s)"},children:[e("div",{class:"flex items-center gap-2",style:{fontSize:"11.5px",color:"var(--ink-2)"},children:[e("span",{children:r}),e("span",{children:n})]}),e("div",{class:"mono",style:{fontSize:"19px",fontWeight:650,marginTop:"2px"},children:o}),t&&e("div",{class:"mono",style:{fontSize:"11.5px",marginTop:"2px",color:t.startsWith("-")?"var(--red)":"var(--green)"},children:t}),e("div",{class:"absolute bottom-0 left-0 right-0 h-0.5",style:{backgroundColor:te[a]}})]}),ne={sm:{pad:"6px 12px",primaryPad:"6px 14px",font:"12.5px",radius:"9px"},md:{pad:"7px 13px",primaryPad:"7px 15px",font:"13px",radius:"9px"},lg:{pad:"12px 16px",primaryPad:"12px 16px",font:"14.5px",radius:"12px"}},V={primary:{background:"linear-gradient(180deg, var(--blue-2), var(--blue))",color:"#fff",border:"0",boxShadow:"var(--shadow-m)",fontWeight:"600"},secondary:{background:"var(--card)",color:"var(--ink)",border:"1px solid var(--hair)",boxShadow:"var(--shadow-s)",fontWeight:"500"},danger:{background:"var(--card)",color:"var(--red)",border:"1px solid var(--hair)",boxShadow:"var(--shadow-s)",fontWeight:"500"},destructive:{background:"var(--red)",color:"#fff",border:"0",boxShadow:"var(--shadow-m)",fontWeight:"600"}},oe={background:"var(--elev)",color:"var(--ink-3)",border:"1px solid transparent",boxShadow:"none",opacity:".8"},se=({label:r,icon:n,variant:o="primary",size:t="md",block:a,title:h,disabled:s,loading:c,onClick:d})=>{const[i,f]=B(!1),p=c??i,l=!!(s||p),u=async()=>{if(!l){f(!0);try{await d()}finally{f(!1)}}},g=ne[t],S=o==="primary"||o==="destructive",z=s&&!p?{...V[o],...oe}:V[o];return e("button",{type:"button",class:`inline-flex items-center justify-center gap-1.5 whitespace-nowrap transition-all duration-180 ease-spring ${l?"cursor-not-allowed":`cursor-pointer hover:-translate-y-px hover:shadow-m${S?" hover:brightness-106":""}`}${a?" w-full":""}`,style:{...z,padding:S?g.primaryPad:g.pad,fontSize:g.font,borderRadius:g.radius},disabled:l,title:h,onClick:u,children:[p?e("span",{class:"i-lucide-loader-2 animate-spin"}):n?e("span",{class:n}):null,e("span",{children:r})]})},ae="modulepreload",ie=function(r){return"/"+r},q={},N=function(n,o,t){let a=Promise.resolve();if(o&&o.length>0){let s=function(i){return Promise.all(i.map(f=>Promise.resolve(f).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));a=s(o.map(i=>{if(i=ie(i),i in q)return;q[i]=!0;const f=i.endsWith(".css"),p=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${p}`))return;const l=document.createElement("link");if(l.rel=f?"stylesheet":ae,f||(l.as="script"),l.crossOrigin="",l.href=i,d&&l.setAttribute("nonce",d),document.head.appendChild(l),f)return new Promise((u,g)=>{l.addEventListener("load",u),l.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${i}`)))})}))}function h(s){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=s,window.dispatchEvent(c),!c.defaultPrevented)throw s}return a.then(s=>{for(const c of s||[])c.status==="rejected"&&h(c.reason);return n().catch(h)})};function X(r){/^https?:\/\//i.test(r)&&window.open(r,"_blank","noopener")}const le='ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace',I=r=>({background:r==="dark"?"#0e0e10":"#1c1c1e",foreground:"#e3e3e8",cursor:"#e3e3e8",selectionBackground:"rgba(10,132,255,0.35)"}),we=({streamUrl:r,content:n,wsUrl:o,height:t=300,onExit:a,onGiveUp:h,onConnectionChange:s,onOutput:c,focused:d=!0,theme:i="dark"})=>{const f=w(null),p=!!o,l=w(a);l.current=a;const u=w(h);u.current=h;const g=w(s);g.current=s;const S=w(c);S.current=c;const z=w(i);z.current=i;const j=w(d);j.current=d;const T=w(null);O(()=>{T.current&&(T.current.options.theme=I(i))},[i]),O(()=>{var k;p&&d&&((k=T.current)==null||k.focus())},[d,p]),O(()=>{if(!f.current)return;let k=!1,b=null,C=null,$=0;const J=[];return(async()=>{const{Terminal:F}=await N(async()=>{const{Terminal:v}=await import("./chunk-DlVFs1Kw.js").then(x=>x.x);return{Terminal:v}},[]),{FitAddon:G}=await N(async()=>{const{FitAddon:v}=await import("./chunk-BlxrFPDK.js").then(x=>x.a);return{FitAddon:v}},[]),{WebLinksAddon:U}=await N(async()=>{const{WebLinksAddon:v}=await import("./chunk-BWjmmSgS.js");return{WebLinksAddon:v}},[]);if(k)return;const m=new F({theme:I(z.current),fontSize:13,fontFamily:le,convertEol:!p,disableStdin:!p,cursorBlink:p,scrollback:1e4,linkHandler:{activate:(v,x)=>X(x),allowNonHttpProtocols:!1}});T.current=m;const D=v=>{var x;m.write(v),(x=S.current)==null||x.call(S,v)},A=new G;m.loadAddon(A),m.loadAddon(new U((v,x)=>X(x))),m.open(f.current),setTimeout(()=>{A.fit(),p&&j.current&&m.focus()},50),n&&!p&&D(n);let E;if(r&&!p&&(E=new EventSource(r),E.addEventListener("output",v=>{const{chunk:x}=JSON.parse(v.data);D(x)}),E.addEventListener("done",v=>{const{exitCode:x}=JSON.parse(v.data);m.write(`\r
1
+ import{jsx as e}from"./preact-jsx-runtime.js";import{useState as C,useRef as y,useEffect as B,useLayoutEffect as Z,useCallback as ee}from"./preact-hooks.js";import{signal as re}from"./preact-signals.js";import{createPortal as Q}from"./preact-compat.js";import"./preact.js";const te={good:"var(--green)",warn:"var(--orange)",bad:"var(--red)",neutral:"var(--ink-3)"},we=({icon:r,label:n,value:o,trend:t,status:a})=>e("div",{class:"relative overflow-hidden",style:{padding:"10px 12px",borderRadius:"13px",background:"var(--card)",border:"1px solid var(--hair)",boxShadow:"var(--shadow-s)"},children:[e("div",{class:"flex items-center gap-2",style:{fontSize:"11.5px",color:"var(--ink-2)"},children:[e("span",{children:r}),e("span",{children:n})]}),e("div",{class:"mono",style:{fontSize:"19px",fontWeight:650,marginTop:"2px"},children:o}),t&&e("div",{class:"mono",style:{fontSize:"11.5px",marginTop:"2px",color:t.startsWith("-")?"var(--red)":"var(--green)"},children:t}),e("div",{class:"absolute bottom-0 left-0 right-0 h-0.5",style:{backgroundColor:te[a]}})]}),ne={sm:{pad:"6px 12px",primaryPad:"6px 14px",font:"12.5px",radius:"var(--r-sm)"},md:{pad:"7px 13px",primaryPad:"7px 15px",font:"13px",radius:"var(--r-sm)"},lg:{pad:"10px 18px",primaryPad:"10px 18px",font:"14px",radius:"var(--r-md)"}},V={primary:{background:"linear-gradient(180deg, var(--accent-top), var(--accent-bot))",color:"var(--on-accent)",border:"0",boxShadow:"var(--shadow-primary)",fontWeight:"600"},secondary:{background:"var(--card)",color:"var(--ink)",border:"0",boxShadow:"var(--shadow-s)",fontWeight:"500"},danger:{background:"var(--card)",color:"var(--red-ink, var(--red))",border:"0",boxShadow:"var(--shadow-s)",fontWeight:"500"},destructive:{background:"var(--red-fill, var(--red))",color:"#fff",border:"0",boxShadow:"var(--shadow-s)",fontWeight:"600"},ghost:{background:"transparent",color:"var(--blue-ink)",border:"0",boxShadow:"none",fontWeight:"600"}},oe={background:"var(--well)",color:"var(--ink-4)",border:"0",boxShadow:"var(--inset-s)",opacity:"1"},ae=({label:r,icon:n,variant:o="primary",size:t="md",block:a,title:u,disabled:i,loading:d,onClick:s})=>{const[l,f]=C(!1),p=d??l,c=!!(i||p),h=async()=>{if(!c){f(!0);try{await s()}finally{f(!1)}}},g=ne[t],S=o==="primary"||o==="destructive",L=o==="ghost"?"hover:bg-elev":`hover:-translate-y-px ${S?"hover:brightness-106":"hover:shadow-m"}`,A=i&&!p?{...V[o],...oe}:V[o];return e("button",{type:"button",class:`inline-flex items-center justify-center gap-1.5 whitespace-nowrap transition-all duration-180 ease-spring ${c?"cursor-not-allowed":`cursor-pointer ${L}`}${a?" w-full":""}`,style:{...A,padding:S?g.primaryPad:g.pad,fontSize:g.font,borderRadius:g.radius},disabled:c,title:u,onClick:h,children:[p?e("span",{class:"i-lucide-loader-2 animate-spin"}):n?e("span",{class:n}):null,e("span",{children:r})]})},se="modulepreload",ie=function(r){return"/"+r},q={},I=function(n,o,t){let a=Promise.resolve();if(o&&o.length>0){let i=function(l){return Promise.all(l.map(f=>Promise.resolve(f).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),s=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));a=i(o.map(l=>{if(l=ie(l),l in q)return;q[l]=!0;const f=l.endsWith(".css"),p=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${p}`))return;const c=document.createElement("link");if(c.rel=f?"stylesheet":se,f||(c.as="script"),c.crossOrigin="",c.href=l,s&&c.setAttribute("nonce",s),document.head.appendChild(c),f)return new Promise((h,g)=>{c.addEventListener("load",h),c.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${l}`)))})}))}function u(i){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=i,window.dispatchEvent(d),!d.defaultPrevented)throw i}return a.then(i=>{for(const d of i||[])d.status==="rejected"&&u(d.reason);return n().catch(u)})};function X(r){/^https?:\/\//i.test(r)&&window.open(r,"_blank","noopener")}const le='ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace',j=r=>({background:r==="dark"?"#0e0e10":"#1c1c1e",foreground:"#e3e3e8",cursor:"#e3e3e8",selectionBackground:"rgba(10,132,255,0.35)"}),ye=({streamUrl:r,content:n,wsUrl:o,height:t=300,onExit:a,onGiveUp:u,onConnectionChange:i,onOutput:d,focused:s=!0,theme:l="dark"})=>{const f=y(null),p=!!o,c=y(a);c.current=a;const h=y(u);h.current=u;const g=y(i);g.current=i;const S=y(d);S.current=d;const L=y(l);L.current=l;const A=y(s);A.current=s;const R=y(null);B(()=>{R.current&&(R.current.options.theme=j(l))},[l]),B(()=>{var k;p&&s&&((k=R.current)==null||k.focus())},[s,p]),B(()=>{if(!f.current)return;let k=!1,m=null,F=null,T=0;const J=[];return(async()=>{const{Terminal:D}=await I(async()=>{const{Terminal:v}=await import("./chunk-DlVFs1Kw.js").then(x=>x.x);return{Terminal:v}},[]),{FitAddon:G}=await I(async()=>{const{FitAddon:v}=await import("./chunk-BlxrFPDK.js").then(x=>x.a);return{FitAddon:v}},[]),{WebLinksAddon:U}=await I(async()=>{const{WebLinksAddon:v}=await import("./chunk-BWjmmSgS.js");return{WebLinksAddon:v}},[]);if(k)return;const b=new D({theme:j(L.current),fontSize:13,fontFamily:le,convertEol:!p,disableStdin:!p,cursorBlink:p,scrollback:1e4,linkHandler:{activate:(v,x)=>X(x),allowNonHttpProtocols:!1}});R.current=b;const N=v=>{var x;b.write(v),(x=S.current)==null||x.call(S,v)},M=new G;b.loadAddon(M),b.loadAddon(new U((v,x)=>X(x))),b.open(f.current),setTimeout(()=>{M.fit(),p&&A.current&&b.focus()},50),n&&!p&&N(n);let E;if(r&&!p&&(E=new EventSource(r),E.addEventListener("output",v=>{const{chunk:x}=JSON.parse(v.data);N(x)}),E.addEventListener("done",v=>{const{exitCode:x}=JSON.parse(v.data);b.write(`\r
2
2
  \x1B[${x===0?"32":"31"}m--- Exit code: ${x} ---\x1B[0m\r
3
- `),E==null||E.close()})),o&&!k){const v=x=>{if(k)return;console.log("[ForgeTerminal] Connecting to:",x),b=new WebSocket(x);const M=[];b.onopen=()=>{var y;console.log("[ForgeTerminal] WebSocket OPEN"),$=0,(y=g.current)==null||y.call(g,!0),A.fit();const{cols:L,rows:W}=m;b.send(JSON.stringify({type:"resize",cols:L,rows:W})),M.push(m.onData(R=>{(b==null?void 0:b.readyState)===WebSocket.OPEN&&b.send(JSON.stringify({type:"input",data:R}))})),M.push(m.onResize(({cols:R,rows:P})=>{(b==null?void 0:b.readyState)===WebSocket.OPEN&&b.send(JSON.stringify({type:"resize",cols:R,rows:P}))}))},b.onmessage=L=>{var W;try{const y=JSON.parse(L.data);y.type==="output"||y.type==="scrollback"?D(y.data):y.type==="exit"?(m.write(`\r
4
- \x1B[33m--- Session ended (code ${y.code}) ---\x1B[0m\r
5
- `),(W=l.current)==null||W.call(l,y.code)):y.type==="error"&&m.write(`\r
6
- \x1B[31m--- Error: ${y.message} ---\x1B[0m\r
7
- `)}catch{}},b.onclose=L=>{var W,y,R;if(console.log("[ForgeTerminal] WebSocket CLOSE:",L.code,L.reason),M.forEach(P=>P.dispose()),M.length=0,(W=g.current)==null||W.call(g,!1),!k)if(L.code===4404)m.write(`\r
3
+ `),E==null||E.close()})),o&&!k){const v=x=>{if(k)return;console.log("[ForgeTerminal] Connecting to:",x),m=new WebSocket(x);const O=[];m.onopen=()=>{var w;console.log("[ForgeTerminal] WebSocket OPEN"),T=0,(w=g.current)==null||w.call(g,!0),M.fit();const{cols:W,rows:z}=b;m.send(JSON.stringify({type:"resize",cols:W,rows:z})),O.push(b.onData($=>{(m==null?void 0:m.readyState)===WebSocket.OPEN&&m.send(JSON.stringify({type:"input",data:$}))})),O.push(b.onResize(({cols:$,rows:P})=>{(m==null?void 0:m.readyState)===WebSocket.OPEN&&m.send(JSON.stringify({type:"resize",cols:$,rows:P}))}))},m.onmessage=W=>{var z;try{const w=JSON.parse(W.data);w.type==="output"||w.type==="scrollback"?N(w.data):w.type==="exit"?(b.write(`\r
4
+ \x1B[33m--- Session ended (code ${w.code}) ---\x1B[0m\r
5
+ `),(z=c.current)==null||z.call(c,w.code)):w.type==="error"&&b.write(`\r
6
+ \x1B[31m--- Error: ${w.message} ---\x1B[0m\r
7
+ `)}catch{}},m.onclose=W=>{var z,w,$;if(console.log("[ForgeTerminal] WebSocket CLOSE:",W.code,W.reason),O.forEach(P=>P.dispose()),O.length=0,(z=g.current)==null||z.call(g,!1),!k)if(W.code===4404)b.write(`\r
8
8
  \x1B[31m--- Click Restart to try again. ---\x1B[0m\r
9
- `),(y=u.current)==null||y.call(u);else if($<5){const P=Math.min(2e3*Math.pow(2,$),16e3);$++,m.write(`\r
10
- \x1B[90m--- Reconnecting (attempt ${$}/5)... ---\x1B[0m\r
11
- `),C=setTimeout(()=>v(x),P)}else m.write(`\r
9
+ `),(w=h.current)==null||w.call(h);else if(T<5){const P=Math.min(2e3*Math.pow(2,T),16e3);T++,b.write(`\r
10
+ \x1B[90m--- Reconnecting (attempt ${T}/5)... ---\x1B[0m\r
11
+ `),F=setTimeout(()=>v(x),P)}else b.write(`\r
12
12
  \x1B[31m--- Connection lost. Click Restart to try again. ---\x1B[0m\r
13
- `),(R=u.current)==null||R.call(u)},b.onerror=L=>{console.error("[ForgeTerminal] WebSocket error:",L)}};v(o)}const H=new ResizeObserver(()=>{k||A.fit()});H.observe(f.current),J.push({dispose:()=>{E==null||E.close(),H.disconnect(),C&&clearTimeout(C),b&&(k=!0,b.close()),m.dispose(),T.current=null}})})(),()=>{k=!0,J.forEach(F=>F.dispose())}},[r,n,o,p]);const K=p?{width:"100%",height:"100%"}:{width:"100%",height:`${t}px`};return e("div",{ref:f,class:"overflow-hidden",style:{...K,background:I(i).background}})},_=re([]);function ke(r,n="info"){const o=Math.random().toString(36).slice(2);_.value=[..._.value,{id:o,message:r,type:n}],setTimeout(()=>{_.value=_.value.filter(t=>t.id!==o)},4e3)}const ce={success:"var(--green)",error:"var(--red)",info:"var(--blue)"},Se=()=>e("div",{class:"fixed bottom-4 right-4 flex flex-col gap-2 z-[70]",style:{maxWidth:"calc(100vw - 32px)"},role:"status","aria-live":"polite",children:_.value.map(r=>e("div",{class:"flex items-center gap-2.5",style:{padding:"10px 14px",borderRadius:"12px",background:"var(--card)",border:"1px solid var(--hair)",boxShadow:"var(--shadow-l)",fontSize:"13px",color:"var(--ink)",animation:"riseIn .3s var(--ease) both"},children:[e("span",{class:"shrink-0",style:{width:"6px",height:"6px",borderRadius:"50%",background:ce[r.type]}}),r.message]},r.id))}),de=({label:r,color:n="var(--ink-2)",variant:o="tint",dot:t})=>{const a=o==="tint"?{background:`color-mix(in srgb, ${n} 18%, transparent)`,color:n}:{background:"var(--elev)",color:"var(--ink-2)",border:"1px solid var(--hair)"};return e("span",{class:"inline-flex items-center gap-1.5 whitespace-nowrap shrink-0",style:{...a,padding:"2px 8px",borderRadius:"99px",fontSize:"11px",fontWeight:600},children:[t&&e("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:n}}),r]})},Y=({onClick:r,label:n="Close"})=>e("button",{type:"button","aria-label":n,class:"grid place-items-center shrink-0 cursor-pointer transition-all duration-180 ease-spring hover:text-ink",style:{width:"26px",height:"26px",borderRadius:"50%",border:"1px solid var(--hair)",background:"var(--card)",color:"var(--ink-2)"},onClick:r,children:e("span",{class:"i-lucide-x",style:{width:"13px",height:"13px"}})}),Ee=({open:r,title:n,onClose:o,footer:t,width:a=540,children:h})=>(Z(()=>{if(!r)return;const s=c=>{c.key==="Escape"&&o()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[r,o]),r?Q(e("div",{class:"fixed inset-0 z-[55] flex items-start justify-center overflow-auto",style:{background:"rgba(0,0,0,.42)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",padding:"56px 16px 16px"},onClick:o,children:e("div",{role:"dialog","aria-modal":"true","aria-label":n,class:"flex flex-col overflow-hidden",style:{width:`min(${a}px, 100%)`,maxHeight:"calc(100vh - 72px)",borderRadius:"18px",background:"var(--bg-2)",border:"1px solid var(--hair-2)",boxShadow:"var(--shadow-l)",animation:"popIn .26s var(--ease) both"},onClick:s=>s.stopPropagation(),children:[e("div",{class:"flex items-center gap-2.5 shrink-0",style:{padding:"14px 18px",borderBottom:"1px solid var(--hair)"},children:[e("h2",{style:{fontSize:"17px",fontWeight:700,letterSpacing:"-0.02em"},children:n}),e("span",{class:"flex-1"}),e(Y,{onClick:o})]}),e("div",{class:"overflow-auto min-h-0",style:{padding:"16px 18px"},children:h}),t&&e("div",{class:"flex items-center gap-2.5 shrink-0",style:{padding:"13px 18px",borderTop:"1px solid var(--hair)"},children:t})]})}),document.body):null),Le=({title:r,onClose:n,children:o})=>(Z(()=>{const t=a=>{a.key==="Escape"&&n()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[n]),Q(e("div",{class:"fixed inset-0 z-50 flex justify-end",style:{background:"rgba(0,0,0,.38)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:n,children:e("aside",{role:"dialog","aria-modal":"true","aria-label":r,class:"flex flex-col h-full overflow-auto",style:{width:"min(492px, 100%)",background:"var(--bg-2)",borderLeft:"1px solid var(--hair)",boxShadow:"var(--shadow-l)",animation:"slideIn .3s var(--ease) both"},onClick:t=>t.stopPropagation(),children:[e("div",{class:"glass flex items-center sticky top-0 z-1",style:{gap:"10px",padding:"14px 18px",borderBottom:"1px solid var(--hair)"},children:[e("h2",{style:{fontSize:"17px",fontWeight:700,letterSpacing:"-0.02em"},children:r}),e("span",{class:"flex-1"}),e(Y,{onClick:n})]}),e("div",{class:"flex flex-col",style:{padding:"16px 18px 24px",gap:"14px"},children:o})]})}),document.body)),We=({tabs:r,active:n,onChange:o,fill:t,size:a="md",label:h})=>{const s=a!=="md",c=a==="xs";return e("div",{role:"tablist","aria-label":h,class:`${t?"flex":"inline-flex"} max-w-full overflow-x-auto`,style:{padding:"3px",borderRadius:s?"10px":"11px",background:"var(--elev)",border:"1px solid var(--hair)"},children:r.map(d=>{const i=n===d.id;return e("button",{type:"button",role:"tab","aria-selected":i,disabled:d.disabled,class:`flex items-center justify-center gap-1.5 whitespace-nowrap transition-all duration-200 ease-spring ${t?"flex-1":""} ${d.disabled?"cursor-not-allowed opacity-50":"cursor-pointer"}`,style:{padding:c?"4px 0":t?s?"5px 6px":"7px 8px":s?"5px 11px":"6px 12px",border:0,borderRadius:s?"7px":"8px",fontSize:c?"11.5px":s?"12px":"12.5px",fontWeight:600,background:i?"var(--card)":"transparent",color:i?"var(--ink)":"var(--ink-3)",boxShadow:i?"var(--shadow-s)":"none"},onClick:()=>o(d.id),children:[d.label,d.count!==void 0&&e("span",{class:"mono",style:{fontSize:"11px",fontWeight:400,color:"var(--ink-3)"},children:d.count})]},d.id)})})},pe=({item:r,onItemClick:n})=>{const[o,t]=B(!1);return e("div",{class:`flex items-center justify-between transition-all duration-180 ease-spring ${n?"cursor-pointer":""}`,style:{padding:"11px 15px",borderRadius:"12px",background:"var(--card)",border:`1px solid ${n&&o?"var(--hair-2)":"var(--hair)"}`,boxShadow:"var(--shadow-s)"},onMouseEnter:n?()=>t(!0):void 0,onMouseLeave:n?()=>t(!1):void 0,onClick:n?()=>n(r.id):void 0,children:[e("div",{class:"min-w-0 flex-1",children:[e("div",{class:"truncate",style:{fontSize:"14px",fontWeight:600},children:r.title}),r.subtitle&&e("div",{class:"truncate",style:{fontSize:"12px",color:"var(--ink-2)",marginTop:"2px"},children:r.subtitle})]}),e("div",{class:"flex items-center gap-2 ml-3",children:[r.badge&&e(de,{label:r.badge.label,color:r.badge.color,variant:"tint"}),r.trailing]})]})},ze=({items:r,loading:n,onItemClick:o})=>n?e("div",{class:"space-y-2",children:[1,2,3].map(t=>e("div",{class:"h-16 animate-pulse",style:{borderRadius:"12px",background:"var(--card)"}},t))}):r.length===0?null:e("div",{class:"space-y-1",children:r.map(t=>e(pe,{item:t,onItemClick:o},t.id))}),Re=({icon:r,title:n,description:o,action:t})=>e("div",{class:"flex flex-col items-center justify-center text-center mx-auto",style:{maxWidth:"520px",padding:"36px 28px",borderRadius:"16px",background:"var(--card)",border:"1px solid var(--hair)",boxShadow:"var(--shadow-m)",animation:"riseIn .34s var(--ease) both"},children:[r&&e("span",{class:r,style:{width:"28px",height:"28px",color:"var(--ink-3)",marginBottom:"14px"}}),e("h3",{style:{fontSize:"17px",fontWeight:700,letterSpacing:"-0.02em",marginBottom:"6px"},children:n}),o&&e("p",{style:{fontSize:"13px",color:"var(--ink-2)",maxWidth:"40ch",marginBottom:t?"16px":0},children:o}),t&&e(se,{label:t.label,variant:"primary",onClick:t.onClick})]}),Te=({checked:r,onChange:n,label:o,disabled:t})=>e("button",{type:"button",role:"switch","aria-checked":r,"aria-label":o,disabled:t,class:`relative shrink-0 ${t?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,style:{width:"44px",height:"26px",borderRadius:"99px",border:0,background:r?"var(--green)":"var(--hair-2)",transition:"background .22s var(--ease)"},onClick:()=>!t&&n(!r),children:e("span",{class:"absolute pointer-events-none",style:{top:"3px",left:r?"21px":"3px",width:"20px",height:"20px",borderRadius:"50%",background:"#fff",boxShadow:"var(--shadow-s)",transition:"left .22s var(--ease)"}})}),$e=({left:r,right:n,defaultWidth:o=300,minWidth:t=200,maxWidth:a=600,storageKey:h="forge-split-width"})=>{const[s,c]=B(()=>{if(typeof localStorage<"u"&&h){const l=localStorage.getItem(h);if(l){const u=parseInt(l,10);if(!isNaN(u)&&u>=t&&u<=a)return u}}return o}),d=w(!1),i=w(0),f=w(0),p=ee(l=>{l.preventDefault(),d.current=!0,i.current=l.clientX,f.current=s,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[s]);return O(()=>{const l=g=>{if(!d.current)return;const S=g.clientX-i.current,z=Math.min(a,Math.max(t,f.current+S));c(z)},u=()=>{d.current&&(d.current=!1,document.body.style.cursor="",document.body.style.userSelect="",typeof localStorage<"u"&&h&&localStorage.setItem(h,String(s)))};return document.addEventListener("mousemove",l),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",u)}},[s,t,a,h]),e("div",{class:"flex h-full w-full overflow-hidden",children:[e("div",{class:"shrink-0 overflow-y-auto overflow-x-hidden",style:{width:`${s}px`},children:r}),e("div",{class:"shrink-0 w-1 cursor-col-resize transition-colors hover:bg-blue",style:{backgroundColor:"var(--hair)"},onMouseDown:p}),e("div",{class:"flex-1 min-w-0 overflow-hidden",children:n})]})},Pe=({title:r,defaultOpen:n=!1,children:o})=>{const[t,a]=B(n);return e("div",{style:{borderBottom:"1px solid var(--hair)"},children:[e("button",{class:"flex items-center justify-between w-full px-3 py-2.5 cursor-pointer transition-colors text-ink3 hover:text-ink",style:{fontSize:"11px",fontWeight:600,border:0,background:"none"},onClick:()=>a(!t),children:[e("span",{children:r}),e("span",{class:"transition-transform",style:{transform:t?"rotate(90deg)":"rotate(0deg)"},children:e("span",{class:"i-lucide-chevron-right"})})]}),t&&e("div",{class:"px-3 pb-3",children:o})]})},ue={normal:"--blue",warning:"--orange",critical:"--red"},xe=({bar:r,size:n})=>{const o=`var(${ue[r.severity]})`,t=n==="sm",a=Math.max(0,Math.min(100,r.percent));return e("span",{class:"flex items-center w-full",style:{gap:t?"6px":"9px"},children:[e("span",{class:"mono shrink-0 text-right",style:{width:t?"28px":"32px",fontSize:t?"10px":"11.5px",color:"var(--ink-3)"},children:r.label}),e("span",{class:"relative block flex-1 overflow-hidden",style:{height:t?"4px":"6px",borderRadius:"99px",background:"var(--elev)"},children:e("span",{class:"block h-full",style:{width:`${a}%`,borderRadius:"99px",background:o,transition:"width .6s var(--ease)"}})}),e("span",{class:"mono shrink-0 text-right",style:{width:t?"30px":"36px",fontSize:t?"10px":"11.5px",fontWeight:600,color:r.severity==="normal"?"var(--ink-2)":o},children:[Math.round(r.percent),"%"]}),!t&&r.reset&&e("span",{class:"shrink-0 whitespace-nowrap",style:{fontSize:"11px",color:"var(--ink-3)"},children:r.reset})]})},_e=({bars:r,size:n="md"})=>e("span",{class:"flex flex-col w-full",style:{gap:n==="sm"?"4px":"6px"},children:r.map((o,t)=>e("span",{class:"flex flex-col w-full",style:{gap:"2px"},children:[e(xe,{bar:o,size:n}),o.scope&&n==="md"&&e("span",{style:{paddingLeft:"39px",fontSize:"10.5px",color:"var(--ink-3)"},children:o.scope})]},t))});export{Pe as AccordionSection,se as ActionButton,de as Badge,Y as CloseButton,ze as DataList,Le as Drawer,Re as EmptyState,we as ForgeTerminal,Ee as Modal,$e as SplitPane,ye as StatusCard,We as Tabs,Se as ToastContainer,Te as ToggleSwitch,_e as UsageMeter,ke as showToast,_ as toasts};
13
+ `),($=h.current)==null||$.call(h)},m.onerror=W=>{console.error("[ForgeTerminal] WebSocket error:",W)}};v(o)}const H=new ResizeObserver(()=>{k||M.fit()});H.observe(f.current),J.push({dispose:()=>{E==null||E.close(),H.disconnect(),F&&clearTimeout(F),m&&(k=!0,m.close()),b.dispose(),R.current=null}})})(),()=>{k=!0,J.forEach(D=>D.dispose())}},[r,n,o,p]);const K=p?{width:"100%",height:"100%"}:{width:"100%",height:`${t}px`};return e("div",{ref:f,class:"overflow-hidden",style:{...K,background:j(l).background}})},_=re([]);function ke(r,n="info"){const o=Math.random().toString(36).slice(2);_.value=[..._.value,{id:o,message:r,type:n}],setTimeout(()=>{_.value=_.value.filter(t=>t.id!==o)},4e3)}const ce={success:"var(--green)",error:"var(--red)",info:"var(--blue)"},Se=()=>e("div",{class:"fixed bottom-4 right-4 flex flex-col gap-2 z-[70]",style:{maxWidth:"calc(100vw - 32px)"},role:"status","aria-live":"polite",children:_.value.map(r=>e("div",{class:"flex items-center gap-2.5",style:{padding:"10px 14px",borderRadius:"var(--r-md)",background:"var(--card)",boxShadow:"var(--shadow-l)",fontSize:"13px",color:"var(--ink)",animation:"riseIn .3s var(--ease) both"},children:[e("span",{class:"shrink-0",style:{width:"6px",height:"6px",borderRadius:"50%",background:ce[r.type]}}),r.message]},r.id))}),de=({label:r,color:n="var(--ink-2)",variant:o="tint",dot:t})=>{const a=o==="tint"?{background:`color-mix(in srgb, ${n} var(--tint, 18%), transparent)`,color:n}:{background:"var(--well)",color:"var(--ink-2)"};return e("span",{class:"inline-flex items-center gap-1.5 whitespace-nowrap shrink-0",style:{...a,height:"20px",padding:"0 8px",borderRadius:"var(--r-pill)",fontSize:"11px",lineHeight:"20px",fontWeight:600},children:[t&&e("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:n}}),r]})},Y=({onClick:r,label:n="Close"})=>e("button",{type:"button","aria-label":n,class:"grid place-items-center shrink-0 cursor-pointer transition-all duration-180 ease-spring hover:text-ink",style:{width:"26px",height:"26px",borderRadius:"50%",border:0,background:"var(--card)",boxShadow:"var(--shadow-s)",color:"var(--ink-2)"},onClick:r,children:e("span",{class:"i-lucide-x",style:{width:"13px",height:"13px"}})}),Ee=({open:r,title:n,onClose:o,footer:t,width:a=540,children:u})=>(Z(()=>{if(!r)return;const i=d=>{d.key==="Escape"&&o()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[r,o]),r?Q(e("div",{class:"fixed inset-0 z-[55] flex items-start justify-center overflow-auto",style:{background:"var(--scrim)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",padding:"56px 16px 16px"},onClick:o,children:e("div",{role:"dialog","aria-modal":"true","aria-label":n,class:"flex flex-col overflow-hidden",style:{width:`min(${a}px, 100%)`,maxHeight:"calc(100vh - 72px)",borderRadius:"var(--r-xl)",background:"var(--bg-2)",boxShadow:"var(--shadow-l)",animation:"popIn .26s var(--ease) both"},onClick:i=>i.stopPropagation(),children:[e("div",{class:"flex items-center gap-2.5 shrink-0",style:{padding:"14px 18px",borderBottom:"1px solid var(--hair)"},children:[e("h2",{style:{fontSize:"17px",fontWeight:700,letterSpacing:"-0.02em"},children:n}),e("span",{class:"flex-1"}),e(Y,{onClick:o})]}),e("div",{class:"overflow-auto min-h-0",style:{padding:"16px 18px"},children:u}),t&&e("div",{class:"flex items-center gap-2.5 shrink-0",style:{padding:"13px 18px",borderTop:"1px solid var(--hair)"},children:t})]})}),document.body):null),We=({title:r,onClose:n,children:o})=>(Z(()=>{const t=a=>{a.key==="Escape"&&n()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[n]),Q(e("div",{class:"fixed inset-0 z-50 flex justify-end",style:{background:"var(--scrim)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:n,children:e("aside",{role:"dialog","aria-modal":"true","aria-label":r,class:"flex flex-col h-full overflow-auto",style:{width:"min(492px, 100%)",background:"var(--bg-2)",boxShadow:"var(--shadow-l)",animation:"slideIn .3s var(--ease) both"},onClick:t=>t.stopPropagation(),children:[e("div",{class:"glass flex items-center sticky top-0 z-1",style:{gap:"10px",padding:"14px 18px",boxShadow:"var(--chrome-edge)"},children:[e("h2",{style:{fontSize:"17px",fontWeight:700,letterSpacing:"-0.02em"},children:r}),e("span",{class:"flex-1"}),e(Y,{onClick:n})]}),e("div",{class:"flex flex-col",style:{padding:"16px 18px 24px",gap:"14px"},children:o})]})}),document.body)),ze=({tabs:r,active:n,onChange:o,fill:t,size:a="md",label:u})=>{const i=a!=="md",d=a==="xs";return e("div",{role:"tablist","aria-label":u,class:`${t?"flex":"inline-flex"} max-w-full overflow-x-auto`,style:{padding:"3px",borderRadius:"var(--r-md)",background:"var(--well)",boxShadow:"var(--inset-s)"},children:r.map(s=>{const l=n===s.id;return e("button",{type:"button",role:"tab","aria-selected":l,disabled:s.disabled,"aria-label":s.icon?s.label:void 0,title:s.icon?s.label:void 0,class:`flex items-center justify-center gap-1.5 whitespace-nowrap transition-all duration-200 ease-spring ${t?"flex-1":""} ${s.disabled?"cursor-not-allowed opacity-50":"cursor-pointer"}`,style:{padding:s.icon?"5px 9px":d?"4px 0":t?i?"5px 6px":"7px 8px":i?"5px 11px":"6px 12px",border:0,borderRadius:"var(--r-sm)",fontSize:d?"11px":i?"12px":"12.5px",fontWeight:600,background:l?"var(--seg-on, var(--card))":"transparent",color:l?"var(--ink)":"var(--ink-2)",boxShadow:l?"var(--lit), var(--shadow-s)":"none"},onClick:()=>o(s.id),children:[s.icon?e("span",{class:s.icon,"aria-hidden":"true",style:{width:"14px",height:"14px"}}):s.label,s.count!==void 0&&e("span",{class:"mono num",style:{fontSize:"11px",fontWeight:400,color:"var(--ink-3)"},children:s.count})]},s.id)})})},pe=({item:r,onItemClick:n})=>{const[o,t]=C(!1);return e("div",{class:`flex items-center justify-between transition-all duration-180 ease-spring ${n?"cursor-pointer":""}`,style:{padding:"11px 15px",borderRadius:"12px",background:"var(--card)",border:`1px solid ${n&&o?"var(--hair-2)":"var(--hair)"}`,boxShadow:"var(--shadow-s)"},onMouseEnter:n?()=>t(!0):void 0,onMouseLeave:n?()=>t(!1):void 0,onClick:n?()=>n(r.id):void 0,children:[e("div",{class:"min-w-0 flex-1",children:[e("div",{class:"truncate",style:{fontSize:"14px",fontWeight:600},children:r.title}),r.subtitle&&e("div",{class:"truncate",style:{fontSize:"12px",color:"var(--ink-2)",marginTop:"2px"},children:r.subtitle})]}),e("div",{class:"flex items-center gap-2 ml-3",children:[r.badge&&e(de,{label:r.badge.label,color:r.badge.color,variant:"tint"}),r.trailing]})]})},Le=({items:r,loading:n,onItemClick:o})=>n?e("div",{class:"space-y-2",children:[1,2,3].map(t=>e("div",{class:"h-16 animate-pulse",style:{borderRadius:"12px",background:"var(--card)"}},t))}):r.length===0?null:e("div",{class:"space-y-1",children:r.map(t=>e(pe,{item:t,onItemClick:o},t.id))}),$e=({icon:r,title:n,description:o,action:t})=>e("div",{class:"flex flex-col items-center justify-center text-center mx-auto",style:{maxWidth:"520px",padding:"36px 28px",borderRadius:"16px",background:"var(--card)",border:"1px solid var(--hair)",boxShadow:"var(--shadow-m)",animation:"riseIn .34s var(--ease) both"},children:[r&&e("span",{class:r,style:{width:"28px",height:"28px",color:"var(--ink-3)",marginBottom:"14px"}}),e("h3",{style:{fontSize:"17px",fontWeight:700,letterSpacing:"-0.02em",marginBottom:"6px"},children:n}),o&&e("p",{style:{fontSize:"13px",color:"var(--ink-2)",maxWidth:"40ch",marginBottom:t?"16px":0},children:o}),t&&e(ae,{label:t.label,variant:"primary",onClick:t.onClick})]}),Re=({checked:r,onChange:n,label:o,disabled:t})=>e("button",{type:"button",role:"switch","aria-checked":r,"aria-label":o,disabled:t,class:`relative shrink-0 ${t?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,style:{width:"44px",height:"26px",borderRadius:"99px",border:0,background:r?"linear-gradient(180deg, var(--accent-top), var(--accent-bot))":"var(--well)",boxShadow:r?"none":"inset 0 0 0 1px var(--hair-2), var(--inset-s)",transition:"background .22s var(--ease)"},onClick:()=>!t&&n(!r),children:e("span",{class:"absolute pointer-events-none",style:{top:"3px",left:r?"21px":"3px",width:"20px",height:"20px",borderRadius:"50%",background:"#fff",boxShadow:"var(--shadow-s)",transition:"left .22s var(--ease)"}})}),Te=({left:r,right:n,defaultWidth:o=300,minWidth:t=200,maxWidth:a=600,storageKey:u="forge-split-width"})=>{const[i,d]=C(()=>{if(typeof localStorage<"u"&&u){const c=localStorage.getItem(u);if(c){const h=parseInt(c,10);if(!isNaN(h)&&h>=t&&h<=a)return h}}return o}),s=y(!1),l=y(0),f=y(0),p=ee(c=>{c.preventDefault(),s.current=!0,l.current=c.clientX,f.current=i,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[i]);return B(()=>{const c=g=>{if(!s.current)return;const S=g.clientX-l.current,L=Math.min(a,Math.max(t,f.current+S));d(L)},h=()=>{s.current&&(s.current=!1,document.body.style.cursor="",document.body.style.userSelect="",typeof localStorage<"u"&&u&&localStorage.setItem(u,String(i)))};return document.addEventListener("mousemove",c),document.addEventListener("mouseup",h),()=>{document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",h)}},[i,t,a,u]),e("div",{class:"flex h-full w-full overflow-hidden",children:[e("div",{class:"shrink-0 overflow-y-auto overflow-x-hidden",style:{width:`${i}px`},children:r}),e("div",{class:"shrink-0 w-1 cursor-col-resize transition-colors hover:bg-blue",style:{backgroundColor:"var(--hair)"},onMouseDown:p}),e("div",{class:"flex-1 min-w-0 overflow-hidden",children:n})]})},Pe=({title:r,defaultOpen:n=!1,children:o})=>{const[t,a]=C(n);return e("div",{style:{borderBottom:"1px solid var(--hair)"},children:[e("button",{class:"flex items-center justify-between w-full px-3 py-2.5 cursor-pointer transition-colors text-ink3 hover:text-ink",style:{fontSize:"11px",fontWeight:600,border:0,background:"none"},onClick:()=>a(!t),children:[e("span",{children:r}),e("span",{class:"transition-transform",style:{transform:t?"rotate(90deg)":"rotate(0deg)"},children:e("span",{class:"i-lucide-chevron-right"})})]}),t&&e("div",{class:"px-3 pb-3",children:o})]})},ue={normal:"--ink-2",warning:"--orange",critical:"--red"},he=({bar:r,size:n})=>{const o=ue[r.severity],t=`var(${o})`,a=n==="sm",u=Math.max(0,Math.min(100,r.percent));return e("span",{class:"flex items-center w-full",style:{gap:a?"6px":"9px"},children:[e("span",{class:"mono num shrink-0 text-right",style:{width:a?"28px":"32px",fontSize:"11px",color:"var(--ink-3)"},children:r.label}),e("span",{class:"relative block flex-1 overflow-hidden",style:{height:a?"4px":"6px",borderRadius:"99px",background:"var(--well)",boxShadow:a?"none":"var(--inset-s)"},children:e("span",{class:"block h-full",style:{width:`${u}%`,borderRadius:"99px",background:t,transition:"width .6s var(--ease)"}})}),e("span",{class:"mono num shrink-0 text-right",style:{width:a?"30px":"36px",fontSize:"11px",fontWeight:600,color:r.severity==="normal"?"var(--ink-2)":`var(${o}-ink, ${t})`},children:[Math.round(r.percent),"%"]}),!a&&e("span",{class:"shrink-0 text-right whitespace-nowrap",style:{width:"112px",fontSize:"11px",color:"var(--ink-3)"},children:r.reset??"—"})]})},_e=({bars:r,size:n="md"})=>e("span",{class:"flex flex-col w-full",style:{gap:n==="sm"?"4px":"6px"},children:r.map((o,t)=>e("span",{class:"flex flex-col w-full",style:{gap:"2px"},children:[e(he,{bar:o,size:n}),o.scope&&n==="md"&&e("span",{style:{paddingLeft:"39px",fontSize:"11px",color:"var(--ink-3)"},children:o.scope})]},t))});export{Pe as AccordionSection,ae as ActionButton,de as Badge,Y as CloseButton,Le as DataList,We as Drawer,$e as EmptyState,ye as ForgeTerminal,Ee as Modal,Te as SplitPane,we as StatusCard,ze as Tabs,Se as ToastContainer,Re as ToggleSwitch,_e as UsageMeter,ke as showToast,_ as toasts};
package/dist/index.js CHANGED
@@ -2213,13 +2213,29 @@ function takeSession(reader, project, sessionDir, general) {
2213
2213
  const known = general?.get(sessionId);
2214
2214
  return known ? { session: known, isNew: true } : null;
2215
2215
  }
2216
+ function noteLaunch(key, session, now = Date.now()) {
2217
+ for (const [k, v] of launched)
2218
+ if (now - v.at > LAUNCH_TTL_MS)
2219
+ launched.delete(k);
2220
+ launched.set(key, { session, at: now });
2221
+ }
2222
+ function recentLaunch(key, now = Date.now()) {
2223
+ const hit = launched.get(key);
2224
+ if (hit && now - hit.at <= LAUNCH_TTL_MS)
2225
+ return hit.session;
2226
+ launched.delete(key);
2227
+ return void 0;
2228
+ }
2216
2229
  function launchHeadless(project, sessionDir, deps) {
2217
2230
  const taken = takeSession(deps.reader, project, sessionDir, deps.general);
2218
2231
  if (!taken)
2219
2232
  return null;
2220
- return deps.manager.getOrCreate(project, sessionDir, taken.session, { isNew: taken.isNew, headless: true });
2233
+ const pty4 = deps.manager.getOrCreate(project, sessionDir, taken.session, { isNew: taken.isNew, headless: true });
2234
+ if (pty4 && taken.isNew)
2235
+ noteLaunch(`${project}::${sessionDir}`, taken.session);
2236
+ return pty4;
2221
2237
  }
2222
- var GENERAL_PROJECT, CREATING_PROJECT, ACCOUNTS_PROJECT, pendingSessions;
2238
+ var GENERAL_PROJECT, CREATING_PROJECT, ACCOUNTS_PROJECT, pendingSessions, LAUNCH_TTL_MS, launched;
2223
2239
  var init_cw_start = __esm({
2224
2240
  "../core/dist/cw-start.js"() {
2225
2241
  "use strict";
@@ -2229,6 +2245,8 @@ var init_cw_start = __esm({
2229
2245
  CREATING_PROJECT = "__creating";
2230
2246
  ACCOUNTS_PROJECT = "__accounts";
2231
2247
  pendingSessions = /* @__PURE__ */ new Map();
2248
+ LAUNCH_TTL_MS = 15 * 6e4;
2249
+ launched = /* @__PURE__ */ new Map();
2232
2250
  }
2233
2251
  });
2234
2252
 
@@ -2315,7 +2333,8 @@ function cwRoutes(reader, options = {}) {
2315
2333
  });
2316
2334
  app.get("/session/:project/:sessionDir", (c) => {
2317
2335
  const { project, sessionDir } = c.req.param();
2318
- const session = reader.getSession(project, sessionDir);
2336
+ const key = `${project}::${sessionDir}`;
2337
+ const session = reader.getSession(project, sessionDir) ?? options.general?.get(key) ?? recentLaunch(key);
2319
2338
  if (!session)
2320
2339
  return c.json({ error: "Session not found" }, 404);
2321
2340
  return c.json(session);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forge-cw",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "description": "A visual dashboard for your coding agents on Claude Code, Codex, Pi or OpenCode. Installs CW for you.",
5
5
  "license": "MIT",
6
6
  "type": "module",