Lines 1-18javascript
1var $t=Object.defineProperty;var Jt=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(s){throw n=[s],s}};var Rt=(e,t)=>{for(var n in t)$t(e,n,{get:t[n],enumerable:!0})};var Be={};Rt(Be,{addProject:()=>re,hideSession:()=>te,listProjects:()=>se,projectNames:()=>ie,removeProject:()=>oe,sessionOverrides:()=>R,setPinned:()=>ne,setProjectName:()=>ae,setSessionName:()=>ee});import{readFileSync as zt,writeFileSync as Ft,mkdirSync as Wt}from"node:fs";import{join as Ue}from"node:path";import{homedir as Ht}from"node:os";function w(){try{let e=JSON.parse(zt(Le,"utf8"));return{names:e.names??{ ...
2`);d>=0&&(a=a.slice(d+1))}return a}finally{await n.close()}}async function Ge(e,t,n=2e6){let s;try{s=await Ke(e,n)}catch{return[]}let r=[];for(let i of s.split(`
HighChild Process
Package source references child process execution.
dist-server/index.jsView on unpkg · L1 HighSame File Env Network Execution
A single source file combines environment access, network access, and code or shell execution; review context before blocking.
dist-server/index.jsView on unpkg · L1 3`))if(i.trim())try{qt(JSON.parse(i),r)}catch{}let o=r.map((i,a)=>({it:i,i:a}));return o.sort((i,a)=>{let d=i.it.ts,c=a.it.ts;return d&&c&&d!==c?d<c?-1:1:i.i-a.i}),o.map(i=>i.it).slice(-t)}async function N(e,t=600){let n=await F(e);if(!n)return[];let s=Math.min(24e6,Math.max(1e6,t*4e4));return Ge(g(n,`${e}.jsonl`),t,s)}async function W(e){let t=await F(e);return t?(await $e(g(t,`${e}.jsonl`),{force:!0}).catch(()=>{}),await $e(g(t,e),{recursive:!0,force:!0}).catch(()=>{}),!0):!1}async function Qt(e,t=65536){let n=await Fe(e,"r");try{let{size:s}=await n.stat(),r=Math.min(s,t),o=Buffer.alloc(r);re ...
4`)){if(!d.trim())continue;let c;try{c=JSON.parse(d)}catch{continue}if(c.type==="ai-title"&&c.aiTitle&&(t=String(c.aiTitle)),c.cwd&&(a?n||(n=String(c.cwd)):s||(s=String(c.cwd))),a&&!r&&c.type==="user"){let u=c.message?.content,l="";if(typeof u=="string")l=u;else if(Array.isArray(u)){let p=u.find(f=>f.type==="text");p?.text&&(l=String(p.text))}ze(l)&&(r=l)}}};try{o(await Qt(e,65536),!0)}catch{}try{o(await Ke(e,131072),!1)}catch{}return{aiTitle:t,cwd:n||s,firstUser:ze(r).slice(0,100).replace(/\s+/g," ").trim()}}function ze(e){if(!e)return"";let t=e.match(/<command-name>\s*\/?([^<]+?)\s*<\/command ...
5`)){let r=s.match(/^##\s+\[([^\]]+)\](?:\s*[—-]\s*(.+))?\s*$/);if(r){n&&t.push(n),n={version:r[1].trim(),date:r[2]?.trim()||
6`+t),console.log(`\u25B8 Preflight \xB7 ${P?"Windows":process.platform} \xB7 node-pty loaded \u2713`),console.log(t);for(let s of e){let r=s.ok?"\u2713":s.info?"\u2139":"\u2717";console.log(` ${r} ${s.label.padEnd(14)} ${s.detail}`),!s.ok&&s.hint&&console.log(` \u2192 ${s.hint}`)}console.log(t);let n=e.some(s=>!s.ok&&!s.info);return console.log(n?" \u26A0 \u0E1A\u0E32\u0E07\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E44\u0E21\u0E48\u0E1E\u0E23\u0E49\u0E2D\u0E21 (\u0E14\u0E39 \u2717) \u2014 resume/\u0E14\u0E39\u0E1B\u0E23\u0E30\u0E27\u0E31\u0E15\u0E34\u0E22\u0E31\u0E07\u0E43\u0E0A\u0E49\u0E44\u0E1 ...
7`),{allOk:!n,checks:e}}import ge from"node:net";import{readFileSync as mn,existsSync as ye,readdirSync as fe}from"node:fs";import{join as V,delimiter as fn}from"node:path";import{homedir as Z}from"node:os";import{randomUUID as gn}from"node:crypto";import{execFileSync as yn}from"node:child_process";import*as
8`)}),u.on("data",l=>{if(d){i.forEach(h=>h(l));return}c=Buffer.concat([c,l]);let p=c.indexOf(10);if(p<0)return;d=!0;let f=c.subarray(0,p).toString(),A=c.subarray(p+1);try{let h=JSON.parse(f);if(!h.ok){a.forEach($=>$(h.error||"attach failed")),u.destroy();return}}catch{}A.length&&i.forEach(h=>h(A))}),u.on("close",()=>a.forEach(l=>l())),u.on("error",l=>a.forEach(p=>p(l.message))),{onData:l=>i.push(l),onClose:l=>a.push(l),write:l=>{d&&u.write(Buffer.from(l,"utf8"))},resize:(l,p)=>{let f=ge.connect(s);f.on("connect",()=>{f.write(JSON.stringify({proto:1,op:"resize",short:e,cols:l,rows:p,attachId:o}) ...
9`),f.end()}),f.on("error",()=>{})},destroy:()=>u.destroy()}}function Se(e){return new Promise(t=>{let n,s;try{n=ct(),s=lt()}catch(d){t({ok:!1,error:String(d?.message??d)});
10`)),r.on("data",d=>{o=Buffer.concat([o,d]);let c=o.indexOf(10);if(!(c<0))try{let u=JSON.parse(o.subarray(0,c).toString());a({ok:!!u.ok,error:u.error})}catch{a({ok:
13`):"")})}r({type:"closed"})})(),{prompt:(l,p)=>i.push(l,p),permission:(l,p)=>{let f=a.get(l);f&&(a.delete(l),p==="deny"?f.resolve({behavior:"deny",message:"\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49\u0E44\u0E21\u0E48\u0E2D\u0E19\u0E38\u0E0D\u0E32\u0E15\u0E43\u0E2B\u0E49\u0E43\u0E0A\u0E49\u0E40\u0E04\u0E23\u0E37\u0E48\u0E2D\u0E07\u0E21\u0E37\u0E2D\u0E19\u0E35\u0E49"}):(p==="always"&&d.add(f.toolName),f.resolve({behavior:"allow",updatedInput:f.input})))},setMode:l=>{try{u.setPermissionMode?.(l)?.catch?.(()=>{})}catch{}},setModel:l=>{try{u.setModel?.(l||void 0)?.catch?.(()=>{})}catch{}},setEffort:l=>{t ...
14`:""}\u{1F5BC} ${n.length} \u0E23\u0E39\u0E1B`:"")}),e.bridge.prompt(t,n)}function At(e,t){e.lastActivity=Date.now(),e.bridge.setMode(t)}function It(e,t){e.lastActivity=Date.now();let n=ke(t);e.model=n,B(e,{type:"model",model:n}),e.bridge.setModel(n)}function jt(e,t){e.lastActivity=Date.now(),e.bridge.setEffort(t)}function xt(e,t,n){e.lastActivity=Date.now();for(let s of e.log)s&&s.type==="permission"&&s.id===t&&(s.decided=n);e.bridge.permission(t,n)}function _t(e){e.running=!1,e.lastActivity=Date.now(),B(e,{type:"user",text:"[Request interrupted by user]"}),e.bridge.interrupt()}function Ct(e, ...
15 \x1B[33m\u0E41\u0E0A\u0E17\u0E19\u0E35\u0E49\u0E44\u0E21\u0E48\u0E21\u0E35\u0E1A\u0E17\u0E2A\u0E19\u0E17\u0E19\u0E32\u0E43\u0E2B\u0E49\u0E40\u0E1B\u0E34\u0E14\x1B[0m \u2014 session \u0E25\u0E49\u0E21\u0E40\u0E2B\u0E25\u0E27/\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01\u0E15\u0E31\u0E49\u0E07\u0E41\u0E15\u0E48\u0E01\u0E48\u0E2D\u0E19\u0E40\u0E23\u0E34\u0E48\u0E21\u0E04\u0E38\u0E22 (\u0E44\u0E21\u0E48\u0E21\u0E35\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E08\u0E23\u0E34\u0E07)\r
16`)),a("empty session");return}try{let u=ut(String(s.sessionId),String(s.cwd||""),r,o);u.onData(i),u.onClose(a),t=u}catch(u){a(String(u?.message??u))}};if(s.type==="resume"){d();return}try{let c=dt(String
17[Image: ${Lt(String(o.mediaType),String(o.data))}]`}catch{}t?.write(r+"\r")}else s.type==="resize"&&t?.resize(Number(s.cols)||120,Number(s.rows)||30)}),e.on("close",()=>t?.destroy
Long lines were clipped for display.