@tangle-network/sandbox-cli 0.22.140 → 0.22.141

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.
Files changed (2) hide show
  1. package/dist/index.mjs +1 -1
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -121,7 +121,7 @@ await connect(new StdioServerTransport());`;case`claude-desktop`:return`// Add t
121
121
  }
122
122
  }`}}function lr(e){return{anthropic:`Anthropic Messages API (Claude)`,openai:`OpenAI Chat Completions (function calling)`,"vercel-ai":`Vercel AI SDK (generateText / streamText)`,mastra:`Mastra agent framework`,"mcp-local":`Local MCP server bridge (stdio)`,"claude-desktop":`Claude Desktop config (uses local MCP)`,cursor:`Cursor config (uses local MCP)`,zed:`Zed config (uses local MCP)`}[e]}function ur(){return new N(`connect`).description(`Print a copy-paste SDK integration snippet for one of: ${sr.join(`, `)} (to stream a local agent's telemetry to Intelligence, see 'tangle connect')`).argument(`<framework>`,sr.join(` | `)).option(`-i, --sandbox <id>`,`Sandbox ID to embed in the snippet`,`<SANDBOX_ID>`).option(`-s, --session <id>`,`Session ID to embed in the snippet`,`default`).action((e,t)=>{sr.includes(e)||(console.error(j.red(`unknown framework: ${e}`),`\nsupported: ${sr.join(`, `)}`),process.exit(2));let n=e;process.stdout.write(j.cyan(`# ${lr(n)}\n\n`)),process.stdout.write(`${cr(n,t.sandbox,t.session)}\n`)})}async function dr(e,t=!1,n){n?.throwIfAborted();let r=t?new tt({write(e,t,n){n()}}):process.stderr,i=et({input:process.stdin,signal:n,output:r,...t?{terminal:!0}:{}});n&&i.once(`SIGINT`,()=>{process.emit(`SIGINT`),i.close()}),t&&process.stderr.write(e);try{return await new Promise(n=>{i.once(`close`,()=>n(void 0)),i.question(t?``:e,e=>{n(e.trim()),i.close()})})}finally{i.close(),t&&process.stderr.write(`
123
123
  `)}}async function fr(e){let t=await dr(e,!0);if(t===void 0)throw Error(`No answer on stdin.`);return t}async function pr(e,t){let n=await dr(e);if(n===void 0)throw process.stderr.write(`
124
- `),Error(t?`No answer on stdin. Pass ${t} to skip the confirmation.`:`No answer on stdin.`);return[`y`,`yes`].includes(n.toLowerCase())}async function mr(e,t,n){let r=await dr(`${e}${t?` [${t}]`:``}: `,!1,n);if(r===void 0)throw Error(`No answer on stdin.`);return r||t||``}async function hr(e,t=`secret`){if(process.stdin.isTTY)throw Error(e?`${e} reads ${t} from stdin, but stdin is a terminal; pipe it in`:`Cannot read ${t} from stdin when stdin is a TTY`);return(await nt(process.stdin)).toString(`utf8`).replace(/\r?\n$/,``)}function gr(){let t=new N(`profile`).description(`Create, inspect, and validate portable agent profiles`);return t.command(`create [output]`).description(`Create a profile — interactively (a wizard), or fully via flags`).option(`--name <name>`,`Profile name (when set, skips the wizard)`).option(`--description <text>`,`Profile description`).option(`--model <model>`,`Model (provider/model)`).option(`--system-prompt <text>`,`System prompt`).option(`--skills <ref...>`,`Skill refs: local path or github:<owner>/<repo>/<path>[@<ref>]`).option(`--tools <ref...>`,`Tool refs: local path or github:<owner>/<repo>/<path>[@<ref>]`).option(`--harness <name>`,`Harness hint shown in the run command`).action(async(t,n)=>{let r=n.name,i=n.description,a=n.harness,o=n.model,s=n.systemPrompt,c=n.skills??[],u=n.tools??[];if(!r&&process.stdin.isTTY&&(r=await mr(`Profile name`,`my-agent`),i=await mr(`Description (optional)`)||void 0,a=await mr(`Harness`,`claude-code`)||void 0,o=await mr(`Model (optional, provider/model)`)||void 0,s=await mr(`System prompt (optional)`)||void 0,c=await _r(`Skill ref (local path or github:..., blank to finish)`),u=await _r(`Tool ref (blank to finish)`)),!r)throw Error(process.stdin.isTTY?`Profile name is required.`:"`agent profile create` needs at least --name in a non-interactive shell (no TTY to prompt). Pass --name <name> (and optionally --model/--skills/--tools/--system-prompt).");let d=Ht({model:o,systemPrompt:s,skills:c,tools:u}),f=Wt({...r?{name:r}:{},...i?{description:i}:{},...d??{},...a?{harness:a}:{}},`new profile`);if(n.json){e(f);return}let p=t??`agent-profile.json`;He(p,`${JSON.stringify(f,null,2)}\n`),l(`Wrote ${p}`),l(`Run it: tangle agent prompt <box> --profile ${p}${a?` --harness ${a}`:``}`)}),t.command(`show <source>`).description(`Load and print a profile (local path, https URL, or github:owner/repo/path[@ref])`).action(async t=>{try{e(await Ut(t))}catch(e){H(e,!0)}}),t.command(`validate <source>`).description(`Validate a profile against the canonical AgentProfile schema`).action(async(t,n)=>{let r=await Ut(t),i=typeof r.name==`string`?r.name:`(unnamed)`;n.json?e({ok:!0,name:i}):l(`Profile valid: "${i}"`)}),t}async function _r(e){let t=[];for(;;){let n=await mr(e);if(!n)break;t.push(n)}return t}function vr(e){return(process.env.TANGLE_SANDBOX_WEB_URL?.trim()||e).replace(/\/+$/,``)}function yr(e,t){if(process.exitCode=1,e.status===`blocked_on_approval`){console.error(j.yellow(`⚠ Blocked on a hub approval.`));let t=e.approval?.approvalId;console.error(t?`Approve it: tangle hub approvals approve ${t}`:"Approve the pending request (`tangle hub approvals`), then re-run.");return}if(e.status===`awaiting_question`){console.error(j.yellow(`⚠ Agent is awaiting an answer to a question.`)),console.error(`Re-run with --interactive to answer it, or answer programmatically via box.session(<id>).answer(<questionId>, { ... }).`);return}if(e.status===`awaiting_interaction`){console.error(j.yellow(`⚠ Agent is awaiting a response.`)),console.error(`Open an interactive session, or answer the canonical interaction through the Sandbox SDK.`);return}if(e.status===`awaiting_plan_decision`){console.error(j.yellow(`⚠ Agent is awaiting a plan decision.`)),console.error(`Approve or reject the pending plan before continuing.`);return}console.error(j.red(`✗ ${e.error&&e.error.length>0?e.error:t}`))}async function br(e,t,n,r){if(n.errorCode!==`TIMEOUT`)return;let i=n.executionId,a=Ne(t);if(!n.error?.startsWith(`Prompt stream timed out`))return{partial:[],note:`A gateway timed out; the run may still be going in the box. Read it with the Sandbox SDK: box.session(${a}).messages()`};if(!i)return{partial:[],note:`Nothing ran: the box never admitted this turn.`};let o=e.session(t).messages(),s=xe(5e3,[],{ref:!1});return{partial:(await Promise.race([o,s]).catch(()=>[])).filter(e=>e.role===`assistant`&&e.id.startsWith(i)).flatMap(e=>e.parts).flatMap(e=>{if(e.type===`text`&&typeof e.text==`string`)return[e.text];let t=e.state;return e.type===`tool`?[`[tool ${String(e.tool)}: ${t?.status??`unknown`}]`]:[]}),note:`The run stopped in the box at the same limit; files it wrote stay there.`,next:`tangle agent prompt ${Ne(e.id)} 'continue' --session ${a} --timeout ${r*2}`}}function xr(e){let t=e.part;if(t?.type===`text`)return t.text??t.content??void 0}function Sr(e){return e.finalText??e.response??e.output??e.content??e.text??void 0}function Cr(e){if(!e.result.success){yr(e.result,`Agent run failed`);return}let t=Date.now()-e.startedAt,n=e.tokenUsage,r=[`${t}ms`,n?.inputTokens===void 0?void 0:`${n.inputTokens} in`,n?.outputTokens===void 0?void 0:`${n.outputTokens} out`].filter(e=>!!e);console.log(j.green(`✓ Done`),j.dim(`(${r.join(`, `)})`))}async function wr(e,t,n=!0){let r=``,i,a=ne(),o=e=>{if(e.startsWith(r)){let t=e.slice(r.length);t&&n&&process.stdout.write(t)}else n&&process.stdout.write(e);r=e};try{for await(let t of e)switch(a.observe(t),t.type){case`token`:{let e=t.data?.value;typeof e==`string`&&(n&&process.stdout.write(e),r+=e);break}case`message.part.updated`:{let e=xr(t.data);typeof e==`string`&&e.length>0&&o(e);break}case`raw`:break;case`result`:i=t.data;break}}catch(e){a.observe({type:`error`,data:{message:e instanceof Error?e.message:String(e)}})}if(r.length===0&&i){let e=Sr(i);typeof e==`string`&&e.length>0&&(n&&process.stdout.write(e),r=e)}return{outcome:{result:a.finish(),startedAt:t,tokenUsage:i?.tokenUsage},resultData:i,printed:r.length,...r.length>0?{response:r}:{}}}function Tr(e){let t=Vn(e??[]);if(t.length!==0)return{profile:{connections:t}}}function Er(e,t,n){if(!Bt(e)||Rt.has(e))return;let r=`Harness "${e}" takes no opening prompt, so it has no interactive session; run the task headless.`;throw new B(`USAGE_INVALID`,r,r,`tangle agent prompt ${Ne(t)} ${Ne(n)} --harness ${e}`)}function Dr(e,t,n,r,i,a){let o={...r??{},harness:n,...i?{model:{...r?.model??{},default:i}}:{}},s={profile:o,requestedProfileDigest:Oe(o),initialPrompt:a};return{...s,run:Ee({provider:`tangle-sandbox`,environmentId:e,sessionId:t,executionId:`interactive-execution-${t}`},s)}}async function Or(e){let t=Vn(e.connection??[]);if(t.length===0)throw Error(`--allow-writes needs at least one --connection to grant writes for.`);if(t.some(e=>e.connectionId===`*`))throw Error("--allow-writes needs explicit --connection ids; the `*:*` wildcard can't be bulk-granted. Grant per connection, e.g. --connection conn_x:* --allow-writes.");let n=await K({hubKey:e.hubKey});for(let r of t){let t=await n.permissions.allowWrites(r.connectionId);e.json||l(`Allowed ${t.writeActions} write action${t.writeActions===1?``:`s`} for connection ${r.connectionId} (${t.granted} newly granted).`)}e.json||l(`Revert anytime: ${t.map(e=>`tangle hub permissions revert-writes --connection ${e.connectionId}`).join(` · `)}`)}async function kr(e){!e.connection||e.connection.length===0||(e.connection=await Bn(e.connection,()=>K({hubKey:e.hubKey})))}const Ar=15e3;async function jr(e){let t=process.stdin,n=process.stdout,r=null,i=!1,a=!1,o=!1,s=!1,c,u=0,d,f,p=new Promise(e=>{f=e}),m=()=>{try{t.setRawMode(!1)}catch{}t.pause()},h=()=>{i||(i=!0,clearTimeout(d),m(),t.off(`data`,w),process.off(`SIGWINCH`,_),process.off(`SIGINT`,g),process.off(`SIGTERM`,g),process.off(`exit`,m),f())},g=e=>{s=!0,Promise.resolve(r?.close()).finally(()=>{h(),process.exit(e===`SIGTERM`?143:130)})},_=()=>{r?.isOpen&&!o&&r.resize(n.columns||80,n.rows||24)},v=[],y=e=>{if(e.length!==0){try{if(!o&&r?.isOpen)return r.write(e)}catch{}v.push(e),C()}},b=()=>{clearTimeout(d);let e=r?.authorityLifetimeMs;e!==void 0&&(d=setTimeout(()=>void C(),Math.max(Ar,e*.8)))},S=async e=>{for(let t=1;;t++)try{return await e.reconnect({cols:n.columns||80,rows:n.rows||24})}catch(e){if(t>=3||e instanceof x)throw e;await new Promise(e=>setTimeout(e,500*2**t))}},C=async()=>{let e=r;if(!(o||i||a||!e)){o=!0,clearTimeout(d);try{await e.close(),r=await S(e);for(let e of v.splice(0))r.write(e)}catch(t){i||(c=t instanceof x?`the session ended`:`could not reattach: ${t.message}`),o=!1,r!==e&&await r?.close(),h();return}if(o=!1,i){await r.close();return}_(),b()}},w=e=>{if(!r)return;let t=e.indexOf(29);if(t===-1){y(e);return}y(e.subarray(0,t)),s=!0,r.close().finally(h)};if(r=await e.attach({cols:n.columns||80,rows:n.rows||24,handlers:{onData:e=>{n.write(Buffer.from(e.buffer,e.byteOffset,e.byteLength))},onExit:e=>{a=!0;let t=e.exitCode===void 0?``:` (code ${e.exitCode})`;n.write(`\r\n[interactive session exited${t}]\r\n`),r?.close().finally(h)},onError:e=>{n.write(`\r\n[terminal stream error: ${e.message}]\r\n`)},onClose:()=>{if(o||i)return;let e=Date.now();s||a?h():e-u<Ar?(c=`the connection keeps closing`,h()):(u=e,C())}}}),b(),t.setRawMode(!0),t.resume(),t.on(`data`,w),process.on(`SIGWINCH`,_),process.on(`SIGINT`,g),process.on(`SIGTERM`,g),process.on(`exit`,m),await p,console.log(),a){l(`Interactive session ended.`);return}l(`Detached — ${c??`the session keeps running`}.`)}function Mr(){let t=new N(`agent`).description(`Interact with AI agent`);return t.command(`prompt <idOrMessage> [message]`).description("Send a single prompt to the agent. With one arg it's the prompt and the box comes from `tangle use` / --box / TANGLE_SANDBOX; with two it's <id> <message>.").option(`--box <id>`,`Target sandbox (overrides the active one)`).option(`--session <id>`,`Continue existing session`).option(`--model <model>`,`Model to use`).option(`-t, --timeout <ms>`,`Timeout in milliseconds`,`300000`).option(`--stream`,`Stream response in real-time`).option(`--interactive`,`Spawn the harness's interactive TUI in the sandbox, inject this prompt, and print a link to watch + drive the live session in the browser (omit for the default headless run)`).option(`--harness <name>`,`Harness that executes this run (claude-code, codex, kimi-code, opencode, pi, hermes; amp needs your own Amp token, so create its box with --backend amp --backend-api-key-env AMP_API_KEY). Defaults to the sandbox's configured backend. The box ships every harness, so this is a per-run choice.`).option(`--profile <source>`,`Agent profile to run: a local JSON path, an https URL, or github:<owner>/<repo>/<path>[@<ref>]`).option(`--skills <ref...>`,`Attach skills (repeatable): a local file path, or github:<owner>/<repo>/<path>[@<ref>] to pull from a repo`).option(`--tools <ref...>`,`Attach tools (repeatable): a local file path, or github:<owner>/<repo>/<path>[@<ref>]`).option(`--system-prompt <text>`,`Override the agent's system prompt for this run`).option(`--connection <spec>`,"Grant a hub connection to the agent as MCP tools (repeatable). The connection is a connection id or a provider name. Modes: <connection>:<cap1>,<cap2> (least privilege, recommended), <connection>:* (all of one connection), or *:* (all connections). List connections with `tangle hub connections`; paths with `tangle hub tools search <keyword>`.",zn,[]).option(`--allow-writes`,"Pre-approve every WRITE action of each granted --connection so the agent can write unattended (reads are already allowed; destructive actions still prompt). Revert with `tangle hub permissions revert-writes`.").option(`--no-hub-key`,`Do not auto-mint a platform Hub key for --allow-writes; use the stored credential as-is`).action(async(t,n,r)=>{let i=n===void 0?t:n,a=n===void 0?pn(r.box):t,{context:o,client:c}=G(r),u=await Kt({profileSource:r.profile,systemPrompt:r.systemPrompt,skills:r.skills,tools:r.tools});await kr(r);let d=Tr(r.connection);r.allowWrites&&await Or(r);let p=u||d?{...u,...d?.profile}:void 0,m=r.harness;r.interactive&&m&&Er(m,a,i);let h=p||m||r.model?{...m?{type:m}:{},...p?{profile:p}:{},...r.model?{model:{model:r.model}}:{}}:void 0,g=await q(c,o,a);if(g=await J(g),r.interactive){let t=r.session??`int-${be()}`,n=m??(await g.backend.status()).type;Er(n,g.id,i);let a=Dr(g.id,t,n,p,r.model,i),c=g.session(t).interactive(),u=f(`Starting interactive ${n} session...`);u.start();let d;try{d=await c.start(a)}finally{u.stop()}let h=d.ref.preparationReceipt.harness,_=d.state===`running`?d.streamUrl:void 0,v=`${vr(o.baseUrl)}/dashboard/sandbox/${encodeURIComponent(g.id)}?interactive=${encodeURIComponent(d.ref.run.sessionId)}`;if(r.json){e({state:d.state,sessionId:d.ref.run.sessionId,harness:h,..._?{streamUrl:_}:{},webUrl:v});return}if(l(`Interactive ${h} session ${d.state}.`),console.log(),d.state===`running`&&(s({"Watch & drive":v}),console.log()),d.state===`exited`){l(`The initial prompt completed with reason: ${d.reason}.`);return}l(`Open the link to watch the agent and type to take over.`),process.stdin.isTTY===!0&&process.stdout.isTTY===!0&&(console.log(),l(`Attaching to the live session — press Ctrl-] to detach.`),await jr(c));return}if(r.stream){r.json||(l(`Streaming response...`),console.log());let t=Date.now(),n=await wr(g.streamPrompt(i,{sessionId:r.session,timeoutMs:Number.parseInt(r.timeout,10),...h?{backend:h}:{}}),t,!r.json);r.json?(e({...n.outcome.result,...n.response?{response:n.response}:{},...n.outcome.tokenUsage?{tokenUsage:n.outcome.tokenUsage}:{},durationMs:Date.now()-t}),n.outcome.result.success||(process.exitCode=1)):(n.printed>0&&console.log(),Cr(n.outcome))}else{let t=f(`Processing prompt...`);t.start();let n=r.session??`prompt-${be()}`,a=Number.parseInt(r.timeout,10),o=await g.prompt(i,{sessionId:n,timeoutMs:a,...h?{backend:h}:{}}),c=await br(g,n,o,a);if(t.stop(),r.json)e({...o,sessionId:n,...c}),o.success===!1&&(process.exitCode=1);else if(o.success===!1){for(let e of c?.partial??[])console.log(e);yr(o,`Agent prompt failed`),c&&console.error(c.note),c?.next&&console.error(`Continue it: ${c.next}`)}else console.log(o.response),console.log(),s({Duration:`${o.durationMs}ms`,"Input Tokens":o.usage?.inputTokens,"Output Tokens":o.usage?.outputTokens})}}),t.addCommand(ur()),t.addCommand(gr()),t}async function Nr(e){let t=e.timeoutMs??1e4,n=e.baseUrl.replace(/\/$/,``),r=`${n}/v1/account/me`;try{let n=await fetch(r,{headers:{Accept:`application/json`,Authorization:`Bearer ${e.apiKey}`},signal:AbortSignal.timeout(t)});if(!n.ok){let e=await Fr(n);throw n.status===401||n.status===403?new b(e||`Invalid API key`):n.status>=500?new O(e||`Sandbox API returned an unexpected error`,{status:n.status}):Error(e||`Credential validation failed with status ${n.status}`)}let i=await n.json();if(!i.success||!i.data)throw Error(`Sandbox API returned an invalid account response`);return{customerId:i.data.customer_id,billingOwnerId:typeof i.data.billing_owner_id==`string`?i.data.billing_owner_id:void 0,apiKeyId:typeof i.data.api_key_id==`string`||i.data.api_key_id===null?i.data.api_key_id:void 0,billingDelegationAuthorized:typeof i.data.billing_delegation_authorized==`boolean`?i.data.billing_delegation_authorized:void 0,email:i.data.email,name:i.data.name,tier:i.data.tier,createdAt:i.data.created_at}}catch(e){throw e instanceof b||e instanceof O||e instanceof A?e:e instanceof Error&&e.name===`AbortError`?new A(`Timed out validating credentials against ${n}`,{timeoutMs:t}):e instanceof Error&&!(e instanceof TypeError)?e:new S(`Failed to reach ${n}`,{cause:Pr(e)})}}function Pr(e){return e instanceof Error?e:void 0}async function Fr(e){let t=await e.text();if(t)try{let e=JSON.parse(t);return e.error?.message??e.message??t}catch{return t}}function Ir(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function Lr(e){if(!zr(e.hostHeader))return{kind:`host-mismatch`};let t;try{t=new URL(e.requestUrl??`/`,`http://127.0.0.1`)}catch{return{kind:`not-found`}}if(t.pathname!==`/callback`)return{kind:`not-found`};if(t.searchParams.get(`state`)!==e.expectedState)return{kind:`state-mismatch`};let n=t.searchParams.get(`error`);if(n)return{kind:`error`,reason:n};let r=t.searchParams.get(`grant_token`);return r?{kind:`ok`,token:r}:{kind:`missing-token`}}async function Rr(e){e.signal?.throwIfAborted();let t=e.timeoutMs??12e4,n=e.baseUrl.replace(/\/$/,``),r=await import(`node:http`),i=ye(32).toString(`hex`),a=null,o=null,s=new Promise((e,t)=>{a=e,o=t}),c=r.createServer((e,t)=>{try{let n=Lr({hostHeader:e.headers.host,requestUrl:e.url,expectedState:i});switch(n.kind){case`host-mismatch`:t.writeHead(421,{"content-type":`text/plain; charset=utf-8`}),t.end(`Misdirected request`);return;case`not-found`:t.writeHead(404,{"content-type":`text/plain; charset=utf-8`}),t.end(`Not found`);return;case`state-mismatch`:t.writeHead(400,{"content-type":`text/html; charset=utf-8`}),t.end(Ur(`State mismatch — refusing login`)),o?.(Error(`Browser login state mismatch — refusing potentially hijacked callback`));return;case`error`:t.writeHead(400,{"content-type":`text/html; charset=utf-8`}),t.end(Ur(n.reason)),o?.(Error(`Browser login failed: ${n.reason}`));return;case`missing-token`:t.writeHead(400,{"content-type":`text/html; charset=utf-8`}),t.end(Ur(null)),o?.(Error(`Browser login did not return a grant token`));return;case`ok`:t.writeHead(200,{"content-type":`text/html; charset=utf-8`}),t.end(Ur(null)),a?.(n.token);return}}catch(e){o?.(e instanceof Error?e:Error(`Browser login callback failed`))}});await new Promise((e,t)=>{c.once(`error`,t),c.listen(0,`127.0.0.1`,()=>e())});try{let r=c.address();if(!r||typeof r==`string`)throw Error(`Failed to bind local callback server`);let a=new URL(`http://127.0.0.1:${r.port}/callback`);a.searchParams.set(`state`,i);let o=new URL(`${n}/auth/cli/login`);o.searchParams.set(`callback_url`,a.toString()),e.provider&&o.searchParams.set(`provider`,e.provider);let l=await Hr(o.toString());e.onLoginUrl?.({loginUrl:o.toString(),browserOpened:l});let u=await Vr({baseUrl:n,grantToken:await Br(s,t,e.signal),timeoutMs:t,signal:e.signal});return{apiKey:u.apiKey,email:u.email,name:u.name,tier:u.tier}}finally{e.signal?.aborted&&c.closeAllConnections(),await new Promise((e,t)=>{c.close(n=>{if(n){t(n);return}e()})}).catch(()=>void 0)}}function zr(e){if(!e)return!1;let t=e.toLowerCase().match(/^(\[[^\]]+\]|[^:]+)(?::\d+)?$/);if(!t)return!1;let n=t[1];return n===`127.0.0.1`||n===`localhost`||n===`[::1]`}async function Br(e,t,n){let r=new AbortController;try{return await Promise.race([e,xe(t,void 0,{signal:AbortSignal.any([r.signal,...n?[n]:[]])}).then(()=>{throw new A(`Timed out waiting for browser login to complete`,{timeoutMs:t})})])}finally{r.abort()}}async function Vr(e){let t=await fetch(`${e.baseUrl}/auth/cli/exchange`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({grant_token:e.grantToken}),signal:AbortSignal.any([AbortSignal.timeout(e.timeoutMs),...e.signal?[e.signal]:[]])}).catch(t=>{throw new S(`Failed to reach ${e.baseUrl}`,{cause:t instanceof Error?t:void 0})}),n=await t.json().catch(()=>null);if(!t.ok||!n?.success||!n.data?.api_key)throw Error(n?.error?.message||`Failed to exchange browser login grant`);return{apiKey:n.data.api_key,email:n.data.email,name:n.data.name,tier:n.data.tier}}async function Hr(e){let{spawn:t}=await import(`node:child_process`),n=process.platform===`darwin`?[`open`,e]:process.platform===`win32`?[`cmd`,`/c`,`start`,``,e]:[`xdg-open`,e];return await new Promise(e=>{let r=t(n[0],n.slice(1),{detached:!0,stdio:`ignore`});r.once(`error`,()=>e(!1)),r.once(`spawn`,()=>{r.unref(),e(!0)})})}function Ur(e){return`<!doctype html>
124
+ `),Error(t?`No answer on stdin. Pass ${t} to skip the confirmation.`:`No answer on stdin.`);return[`y`,`yes`].includes(n.toLowerCase())}async function mr(e,t,n){let r=await dr(`${e}${t?` [${t}]`:``}: `,!1,n);if(r===void 0)throw Error(`No answer on stdin.`);return r||t||``}async function hr(e,t=`secret`){if(process.stdin.isTTY)throw Error(e?`${e} reads ${t} from stdin, but stdin is a terminal; pipe it in`:`Cannot read ${t} from stdin when stdin is a TTY`);return(await nt(process.stdin)).toString(`utf8`).replace(/\r?\n$/,``)}function gr(){let t=new N(`profile`).description(`Create, inspect, and validate portable agent profiles`);return t.command(`create [output]`).description(`Create a profile — interactively (a wizard), or fully via flags`).option(`--name <name>`,`Profile name (when set, skips the wizard)`).option(`--description <text>`,`Profile description`).option(`--model <model>`,`Model (provider/model)`).option(`--system-prompt <text>`,`System prompt`).option(`--skills <ref...>`,`Skill refs: local path or github:<owner>/<repo>/<path>[@<ref>]`).option(`--tools <ref...>`,`Tool refs: local path or github:<owner>/<repo>/<path>[@<ref>]`).option(`--harness <name>`,`Harness hint shown in the run command`).action(async(t,n)=>{let r=n.name,i=n.description,a=n.harness,o=n.model,s=n.systemPrompt,c=n.skills??[],u=n.tools??[];if(!r&&process.stdin.isTTY&&(r=await mr(`Profile name`,`my-agent`),i=await mr(`Description (optional)`)||void 0,a=await mr(`Harness`,`claude-code`)||void 0,o=await mr(`Model (optional, provider/model)`)||void 0,s=await mr(`System prompt (optional)`)||void 0,c=await _r(`Skill ref (local path or github:..., blank to finish)`),u=await _r(`Tool ref (blank to finish)`)),!r)throw Error(process.stdin.isTTY?`Profile name is required.`:"`agent profile create` needs at least --name in a non-interactive shell (no TTY to prompt). Pass --name <name> (and optionally --model/--skills/--tools/--system-prompt).");let d=Ht({model:o,systemPrompt:s,skills:c,tools:u}),f=Wt({...r?{name:r}:{},...i?{description:i}:{},...d??{},...a?{harness:a}:{}},`new profile`);if(n.json){e(f);return}let p=t??`agent-profile.json`;He(p,`${JSON.stringify(f,null,2)}\n`),l(`Wrote ${p}`),l(`Run it: tangle agent prompt <box> --profile ${p}${a?` --harness ${a}`:``}`)}),t.command(`show <source>`).description(`Load and print a profile (local path, https URL, or github:owner/repo/path[@ref])`).action(async t=>{try{e(await Ut(t))}catch(e){H(e,!0)}}),t.command(`validate <source>`).description(`Validate a profile against the canonical AgentProfile schema`).action(async(t,n)=>{let r=await Ut(t),i=typeof r.name==`string`?r.name:`(unnamed)`;n.json?e({ok:!0,name:i}):l(`Profile valid: "${i}"`)}),t}async function _r(e){let t=[];for(;;){let n=await mr(e);if(!n)break;t.push(n)}return t}function vr(e){return(process.env.TANGLE_SANDBOX_WEB_URL?.trim()||e).replace(/\/+$/,``)}function yr(e,t){if(process.exitCode=1,e.status===`blocked_on_approval`){console.error(j.yellow(`⚠ Blocked on a hub approval.`));let t=e.approval?.approvalId;console.error(t?`Approve it: tangle hub approvals approve ${t}`:"Approve the pending request (`tangle hub approvals`), then re-run.");return}if(e.status===`awaiting_question`){console.error(j.yellow(`⚠ Agent is awaiting an answer to a question.`)),console.error(`Re-run with --interactive to answer it, or answer programmatically via box.session(<id>).answer(<questionId>, { ... }).`);return}if(e.status===`awaiting_interaction`){console.error(j.yellow(`⚠ Agent is awaiting a response.`)),console.error(`Open an interactive session, or answer the canonical interaction through the Sandbox SDK.`);return}if(e.status===`awaiting_plan_decision`){console.error(j.yellow(`⚠ Agent is awaiting a plan decision.`)),console.error(`Approve or reject the pending plan before continuing.`);return}console.error(j.red(`✗ ${e.error&&e.error.length>0?e.error:t}`))}async function br(e,t,n,r){if(n.errorCode!==`TIMEOUT`)return;let i=n.executionId,a=Ne(t);if(!n.error?.startsWith(`Prompt stream timed out`))return{partial:[],note:`A gateway timed out; the run may still be going in the box. Read it with the Sandbox SDK: box.session(${a}).messages()`};if(!i)return{partial:[],note:`Nothing ran: the box never admitted this turn.`};let o=e.session(t).messages(),s=xe(5e3,[],{ref:!1});return{partial:(await Promise.race([o,s]).catch(()=>[])).filter(e=>e.role===`assistant`&&e.id.startsWith(i)).flatMap(e=>e.parts).flatMap(e=>{if(e.type===`text`&&typeof e.text==`string`)return[e.text];let t=e.state;return e.type===`tool`?[`[tool ${String(e.tool)}: ${t?.status??`unknown`}]`]:[]}),note:`The run stopped in the box at the same limit; files it wrote stay there.`,next:`tangle agent prompt ${Ne(e.id)} 'continue' --session ${a} --timeout ${r*2}`}}function xr(e){let t=e.part;if(t?.type===`text`)return t.text??t.content??void 0}function Sr(e){return e.finalText??e.response??e.output??e.content??e.text??void 0}function Cr(e,t){if(!e.result.success){yr(e.result,`Agent run failed`);return}let n=performance.now(),r=e=>`${(e/1e3).toFixed(1)} s`,i=e.tokenUsage,a=[`agent ${r(n-t.agentStartedAt)}`,`total ${r(n-t.commandStartedAt)}`,i?.inputTokens===void 0?void 0:`${i.inputTokens} in`,i?.outputTokens===void 0?void 0:`${i.outputTokens} out`].filter(e=>!!e);console.log(j.green(`✓ Done`),j.dim(`(${a.join(`, `)})`))}async function wr(e,t,n=!0){let r=``,i,a=ne(),o=e=>{if(e.startsWith(r)){let t=e.slice(r.length);t&&n&&process.stdout.write(t)}else n&&process.stdout.write(e);r=e};try{for await(let t of e)switch(a.observe(t),t.type){case`token`:{let e=t.data?.value;typeof e==`string`&&(n&&process.stdout.write(e),r+=e);break}case`message.part.updated`:{let e=xr(t.data);typeof e==`string`&&e.length>0&&o(e);break}case`raw`:break;case`result`:i=t.data;break}}catch(e){a.observe({type:`error`,data:{message:e instanceof Error?e.message:String(e)}})}if(r.length===0&&i){let e=Sr(i);typeof e==`string`&&e.length>0&&(n&&process.stdout.write(e),r=e)}return{outcome:{result:a.finish(),startedAt:t,tokenUsage:i?.tokenUsage},resultData:i,printed:r.length,...r.length>0?{response:r}:{}}}function Tr(e){let t=Vn(e??[]);if(t.length!==0)return{profile:{connections:t}}}function Er(e,t,n){if(!Bt(e)||Rt.has(e))return;let r=`Harness "${e}" takes no opening prompt, so it has no interactive session; run the task headless.`;throw new B(`USAGE_INVALID`,r,r,`tangle agent prompt ${Ne(t)} ${Ne(n)} --harness ${e}`)}function Dr(e,t,n,r,i,a){let o={...r??{},harness:n,...i?{model:{...r?.model??{},default:i}}:{}},s={profile:o,requestedProfileDigest:Oe(o),initialPrompt:a};return{...s,run:Ee({provider:`tangle-sandbox`,environmentId:e,sessionId:t,executionId:`interactive-execution-${t}`},s)}}async function Or(e){let t=Vn(e.connection??[]);if(t.length===0)throw Error(`--allow-writes needs at least one --connection to grant writes for.`);if(t.some(e=>e.connectionId===`*`))throw Error("--allow-writes needs explicit --connection ids; the `*:*` wildcard can't be bulk-granted. Grant per connection, e.g. --connection conn_x:* --allow-writes.");let n=await K({hubKey:e.hubKey});for(let r of t){let t=await n.permissions.allowWrites(r.connectionId);e.json||l(`Allowed ${t.writeActions} write action${t.writeActions===1?``:`s`} for connection ${r.connectionId} (${t.granted} newly granted).`)}e.json||l(`Revert anytime: ${t.map(e=>`tangle hub permissions revert-writes --connection ${e.connectionId}`).join(` · `)}`)}async function kr(e){!e.connection||e.connection.length===0||(e.connection=await Bn(e.connection,()=>K({hubKey:e.hubKey})))}const Ar=15e3;async function jr(e){let t=process.stdin,n=process.stdout,r=null,i=!1,a=!1,o=!1,s=!1,c,u=0,d,f,p=new Promise(e=>{f=e}),m=()=>{try{t.setRawMode(!1)}catch{}t.pause()},h=()=>{i||(i=!0,clearTimeout(d),m(),t.off(`data`,w),process.off(`SIGWINCH`,_),process.off(`SIGINT`,g),process.off(`SIGTERM`,g),process.off(`exit`,m),f())},g=e=>{s=!0,Promise.resolve(r?.close()).finally(()=>{h(),process.exit(e===`SIGTERM`?143:130)})},_=()=>{r?.isOpen&&!o&&r.resize(n.columns||80,n.rows||24)},v=[],y=e=>{if(e.length!==0){try{if(!o&&r?.isOpen)return r.write(e)}catch{}v.push(e),C()}},b=()=>{clearTimeout(d);let e=r?.authorityLifetimeMs;e!==void 0&&(d=setTimeout(()=>void C(),Math.max(Ar,e*.8)))},S=async e=>{for(let t=1;;t++)try{return await e.reconnect({cols:n.columns||80,rows:n.rows||24})}catch(e){if(t>=3||e instanceof x)throw e;await new Promise(e=>setTimeout(e,500*2**t))}},C=async()=>{let e=r;if(!(o||i||a||!e)){o=!0,clearTimeout(d);try{await e.close(),r=await S(e);for(let e of v.splice(0))r.write(e)}catch(t){i||(c=t instanceof x?`the session ended`:`could not reattach: ${t.message}`),o=!1,r!==e&&await r?.close(),h();return}if(o=!1,i){await r.close();return}_(),b()}},w=e=>{if(!r)return;let t=e.indexOf(29);if(t===-1){y(e);return}y(e.subarray(0,t)),s=!0,r.close().finally(h)};if(r=await e.attach({cols:n.columns||80,rows:n.rows||24,handlers:{onData:e=>{n.write(Buffer.from(e.buffer,e.byteOffset,e.byteLength))},onExit:e=>{a=!0;let t=e.exitCode===void 0?``:` (code ${e.exitCode})`;n.write(`\r\n[interactive session exited${t}]\r\n`),r?.close().finally(h)},onError:e=>{n.write(`\r\n[terminal stream error: ${e.message}]\r\n`)},onClose:()=>{if(o||i)return;let e=Date.now();s||a?h():e-u<Ar?(c=`the connection keeps closing`,h()):(u=e,C())}}}),b(),t.setRawMode(!0),t.resume(),t.on(`data`,w),process.on(`SIGWINCH`,_),process.on(`SIGINT`,g),process.on(`SIGTERM`,g),process.on(`exit`,m),await p,console.log(),a){l(`Interactive session ended.`);return}l(`Detached — ${c??`the session keeps running`}.`)}function Mr(){let t=new N(`agent`).description(`Interact with AI agent`);return t.command(`prompt <idOrMessage> [message]`).description("Send a single prompt to the agent. With one arg it's the prompt and the box comes from `tangle use` / --box / TANGLE_SANDBOX; with two it's <id> <message>.").option(`--box <id>`,`Target sandbox (overrides the active one)`).option(`--session <id>`,`Continue existing session`).option(`--model <model>`,`Model to use`).option(`-t, --timeout <ms>`,`Timeout in milliseconds`,`300000`).option(`--stream`,`Stream response in real-time`).option(`--interactive`,`Spawn the harness's interactive TUI in the sandbox, inject this prompt, and print a link to watch + drive the live session in the browser (omit for the default headless run)`).option(`--harness <name>`,`Harness that executes this run (claude-code, codex, kimi-code, opencode, pi, hermes; amp needs your own Amp token, so create its box with --backend amp --backend-api-key-env AMP_API_KEY). Defaults to the sandbox's configured backend. The box ships every harness, so this is a per-run choice.`).option(`--profile <source>`,`Agent profile to run: a local JSON path, an https URL, or github:<owner>/<repo>/<path>[@<ref>]`).option(`--skills <ref...>`,`Attach skills (repeatable): a local file path, or github:<owner>/<repo>/<path>[@<ref>] to pull from a repo`).option(`--tools <ref...>`,`Attach tools (repeatable): a local file path, or github:<owner>/<repo>/<path>[@<ref>]`).option(`--system-prompt <text>`,`Override the agent's system prompt for this run`).option(`--connection <spec>`,"Grant a hub connection to the agent as MCP tools (repeatable). The connection is a connection id or a provider name. Modes: <connection>:<cap1>,<cap2> (least privilege, recommended), <connection>:* (all of one connection), or *:* (all connections). List connections with `tangle hub connections`; paths with `tangle hub tools search <keyword>`.",zn,[]).option(`--allow-writes`,"Pre-approve every WRITE action of each granted --connection so the agent can write unattended (reads are already allowed; destructive actions still prompt). Revert with `tangle hub permissions revert-writes`.").option(`--no-hub-key`,`Do not auto-mint a platform Hub key for --allow-writes; use the stored credential as-is`).action(async(t,n,r)=>{let i=n===void 0?t:n,a=n===void 0?pn(r.box):t,{context:o,client:c}=G(r),u=await Kt({profileSource:r.profile,systemPrompt:r.systemPrompt,skills:r.skills,tools:r.tools});await kr(r);let d=Tr(r.connection);r.allowWrites&&await Or(r);let p=u||d?{...u,...d?.profile}:void 0,m=r.harness;r.interactive&&m&&Er(m,a,i);let h=p||m||r.model?{...m?{type:m}:{},...p?{profile:p}:{},...r.model?{model:{model:r.model}}:{}}:void 0,g=performance.now(),_=await q(c,o,a);if(_=await J(_),r.interactive){let t=r.session??`int-${be()}`,n=m??(await _.backend.status()).type;Er(n,_.id,i);let a=Dr(_.id,t,n,p,r.model,i),c=_.session(t).interactive(),u=f(`Starting interactive ${n} session...`);u.start();let d;try{d=await c.start(a)}finally{u.stop()}let h=d.ref.preparationReceipt.harness,g=d.state===`running`?d.streamUrl:void 0,v=`${vr(o.baseUrl)}/dashboard/sandbox/${encodeURIComponent(_.id)}?interactive=${encodeURIComponent(d.ref.run.sessionId)}`;if(r.json){e({state:d.state,sessionId:d.ref.run.sessionId,harness:h,...g?{streamUrl:g}:{},webUrl:v});return}if(l(`Interactive ${h} session ${d.state}.`),console.log(),d.state===`running`&&(s({"Watch & drive":v}),console.log()),d.state===`exited`){l(`The initial prompt completed with reason: ${d.reason}.`);return}l(`Open the link to watch the agent and type to take over.`),process.stdin.isTTY===!0&&process.stdout.isTTY===!0&&(console.log(),l(`Attaching to the live session — press Ctrl-] to detach.`),await jr(c));return}if(r.stream){r.json||(l(`Streaming response...`),console.log());let t=Date.now(),n=performance.now(),a=await wr(_.streamPrompt(i,{sessionId:r.session,timeoutMs:Number.parseInt(r.timeout,10),...h?{backend:h}:{}}),t,!r.json);r.json?(e({...a.outcome.result,...a.response?{response:a.response}:{},...a.outcome.tokenUsage?{tokenUsage:a.outcome.tokenUsage}:{},durationMs:Date.now()-t}),a.outcome.result.success||(process.exitCode=1)):(a.printed>0&&console.log(),Cr(a.outcome,{commandStartedAt:g,agentStartedAt:n}))}else{let t=f(`Processing prompt...`);t.start();let n=r.session??`prompt-${be()}`,a=Number.parseInt(r.timeout,10),o=await _.prompt(i,{sessionId:n,timeoutMs:a,...h?{backend:h}:{}}),c=await br(_,n,o,a);if(t.stop(),r.json)e({...o,sessionId:n,...c}),o.success===!1&&(process.exitCode=1);else if(o.success===!1){for(let e of c?.partial??[])console.log(e);yr(o,`Agent prompt failed`),c&&console.error(c.note),c?.next&&console.error(`Continue it: ${c.next}`)}else console.log(o.response),console.log(),s({Duration:`${o.durationMs}ms`,"Input Tokens":o.usage?.inputTokens,"Output Tokens":o.usage?.outputTokens})}}),t.addCommand(ur()),t.addCommand(gr()),t}async function Nr(e){let t=e.timeoutMs??1e4,n=e.baseUrl.replace(/\/$/,``),r=`${n}/v1/account/me`;try{let n=await fetch(r,{headers:{Accept:`application/json`,Authorization:`Bearer ${e.apiKey}`},signal:AbortSignal.timeout(t)});if(!n.ok){let e=await Fr(n);throw n.status===401||n.status===403?new b(e||`Invalid API key`):n.status>=500?new O(e||`Sandbox API returned an unexpected error`,{status:n.status}):Error(e||`Credential validation failed with status ${n.status}`)}let i=await n.json();if(!i.success||!i.data)throw Error(`Sandbox API returned an invalid account response`);return{customerId:i.data.customer_id,billingOwnerId:typeof i.data.billing_owner_id==`string`?i.data.billing_owner_id:void 0,apiKeyId:typeof i.data.api_key_id==`string`||i.data.api_key_id===null?i.data.api_key_id:void 0,billingDelegationAuthorized:typeof i.data.billing_delegation_authorized==`boolean`?i.data.billing_delegation_authorized:void 0,email:i.data.email,name:i.data.name,tier:i.data.tier,createdAt:i.data.created_at}}catch(e){throw e instanceof b||e instanceof O||e instanceof A?e:e instanceof Error&&e.name===`AbortError`?new A(`Timed out validating credentials against ${n}`,{timeoutMs:t}):e instanceof Error&&!(e instanceof TypeError)?e:new S(`Failed to reach ${n}`,{cause:Pr(e)})}}function Pr(e){return e instanceof Error?e:void 0}async function Fr(e){let t=await e.text();if(t)try{let e=JSON.parse(t);return e.error?.message??e.message??t}catch{return t}}function Ir(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function Lr(e){if(!zr(e.hostHeader))return{kind:`host-mismatch`};let t;try{t=new URL(e.requestUrl??`/`,`http://127.0.0.1`)}catch{return{kind:`not-found`}}if(t.pathname!==`/callback`)return{kind:`not-found`};if(t.searchParams.get(`state`)!==e.expectedState)return{kind:`state-mismatch`};let n=t.searchParams.get(`error`);if(n)return{kind:`error`,reason:n};let r=t.searchParams.get(`grant_token`);return r?{kind:`ok`,token:r}:{kind:`missing-token`}}async function Rr(e){e.signal?.throwIfAborted();let t=e.timeoutMs??12e4,n=e.baseUrl.replace(/\/$/,``),r=await import(`node:http`),i=ye(32).toString(`hex`),a=null,o=null,s=new Promise((e,t)=>{a=e,o=t}),c=r.createServer((e,t)=>{try{let n=Lr({hostHeader:e.headers.host,requestUrl:e.url,expectedState:i});switch(n.kind){case`host-mismatch`:t.writeHead(421,{"content-type":`text/plain; charset=utf-8`}),t.end(`Misdirected request`);return;case`not-found`:t.writeHead(404,{"content-type":`text/plain; charset=utf-8`}),t.end(`Not found`);return;case`state-mismatch`:t.writeHead(400,{"content-type":`text/html; charset=utf-8`}),t.end(Ur(`State mismatch — refusing login`)),o?.(Error(`Browser login state mismatch — refusing potentially hijacked callback`));return;case`error`:t.writeHead(400,{"content-type":`text/html; charset=utf-8`}),t.end(Ur(n.reason)),o?.(Error(`Browser login failed: ${n.reason}`));return;case`missing-token`:t.writeHead(400,{"content-type":`text/html; charset=utf-8`}),t.end(Ur(null)),o?.(Error(`Browser login did not return a grant token`));return;case`ok`:t.writeHead(200,{"content-type":`text/html; charset=utf-8`}),t.end(Ur(null)),a?.(n.token);return}}catch(e){o?.(e instanceof Error?e:Error(`Browser login callback failed`))}});await new Promise((e,t)=>{c.once(`error`,t),c.listen(0,`127.0.0.1`,()=>e())});try{let r=c.address();if(!r||typeof r==`string`)throw Error(`Failed to bind local callback server`);let a=new URL(`http://127.0.0.1:${r.port}/callback`);a.searchParams.set(`state`,i);let o=new URL(`${n}/auth/cli/login`);o.searchParams.set(`callback_url`,a.toString()),e.provider&&o.searchParams.set(`provider`,e.provider);let l=await Hr(o.toString());e.onLoginUrl?.({loginUrl:o.toString(),browserOpened:l});let u=await Vr({baseUrl:n,grantToken:await Br(s,t,e.signal),timeoutMs:t,signal:e.signal});return{apiKey:u.apiKey,email:u.email,name:u.name,tier:u.tier}}finally{e.signal?.aborted&&c.closeAllConnections(),await new Promise((e,t)=>{c.close(n=>{if(n){t(n);return}e()})}).catch(()=>void 0)}}function zr(e){if(!e)return!1;let t=e.toLowerCase().match(/^(\[[^\]]+\]|[^:]+)(?::\d+)?$/);if(!t)return!1;let n=t[1];return n===`127.0.0.1`||n===`localhost`||n===`[::1]`}async function Br(e,t,n){let r=new AbortController;try{return await Promise.race([e,xe(t,void 0,{signal:AbortSignal.any([r.signal,...n?[n]:[]])}).then(()=>{throw new A(`Timed out waiting for browser login to complete`,{timeoutMs:t})})])}finally{r.abort()}}async function Vr(e){let t=await fetch(`${e.baseUrl}/auth/cli/exchange`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({grant_token:e.grantToken}),signal:AbortSignal.any([AbortSignal.timeout(e.timeoutMs),...e.signal?[e.signal]:[]])}).catch(t=>{throw new S(`Failed to reach ${e.baseUrl}`,{cause:t instanceof Error?t:void 0})}),n=await t.json().catch(()=>null);if(!t.ok||!n?.success||!n.data?.api_key)throw Error(n?.error?.message||`Failed to exchange browser login grant`);return{apiKey:n.data.api_key,email:n.data.email,name:n.data.name,tier:n.data.tier}}async function Hr(e){let{spawn:t}=await import(`node:child_process`),n=process.platform===`darwin`?[`open`,e]:process.platform===`win32`?[`cmd`,`/c`,`start`,``,e]:[`xdg-open`,e];return await new Promise(e=>{let r=t(n[0],n.slice(1),{detached:!0,stdio:`ignore`});r.once(`error`,()=>e(!1)),r.once(`spawn`,()=>{r.unref(),e(!0)})})}function Ur(e){return`<!doctype html>
125
125
  <html lang="en">
126
126
  <head>
127
127
  <meta charset="utf-8" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox-cli",
3
- "version": "0.22.140",
3
+ "version": "0.22.141",
4
4
  "description": "CLI for Tangle Sandbox operations",
5
5
  "type": "module",
6
6
  "engines": {
@@ -60,10 +60,10 @@
60
60
  "tsx": "^4.23.15",
61
61
  "typescript": "^6.0.3",
62
62
  "vitest": "^4.1.12",
63
+ "@tangle-network/runtime-contracts": "0.20.0",
63
64
  "@repo/shared": "0.0.0",
64
- "@tangle-network/sdk-session-persistence": "0.7.0",
65
65
  "@repo/knowledge-host": "0.0.0",
66
- "@tangle-network/runtime-contracts": "0.20.0"
66
+ "@tangle-network/sdk-session-persistence": "0.7.0"
67
67
  },
68
68
  "publishConfig": {
69
69
  "access": "public",
@@ -87,8 +87,8 @@
87
87
  "author": "Tangle Network",
88
88
  "license": "MIT",
89
89
  "tangleRelease": {
90
- "sourceSha": "91dadc6eb53b1841d2bd13e10e4348aaea0748cf",
91
- "mergedAt": "2026-11-15T16:43:05-08:00"
90
+ "sourceSha": "b0118655211e8645097099397103a4e175be86da",
91
+ "mergedAt": "2026-11-15T17:22:28-08:00"
92
92
  },
93
93
  "scripts": {
94
94
  "build": "tsdown",