@tangle-network/sandbox-cli 0.23.11 → 0.23.12
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/SKILL.md +4 -0
- package/dist/{account-Bklwl_Tx.mjs → account-ppb4-uf5.mjs} +1 -1
- package/dist/credential-store-C6gb-zro.mjs +1 -0
- package/dist/{device-D6rmGHLz.mjs → device-CggsQEHQ.mjs} +1 -1
- package/dist/index.mjs +34 -34
- package/dist/{run-BxATA6T4.mjs → run-CJ0jL7ul.mjs} +1 -1
- package/dist/{solve-signer-D6EYGOv9.mjs → solve-signer-DPwZymEr.mjs} +1 -1
- package/dist/{submit-BCCjJAeU.mjs → submit-wmXtPZX6.mjs} +1 -1
- package/package.json +4 -4
- package/dist/credential-store-DysDRcD-.mjs +0 -1
package/SKILL.md
CHANGED
|
@@ -304,8 +304,12 @@ Canonical proxy custody at create time — the value never enters the box:
|
|
|
304
304
|
```bash
|
|
305
305
|
tangle sandbox create --proxy-secret '{"envName":"PROVIDER_KEY","secretRef":{"kind":"secret-ref","key":"PROVIDER_KEY"},"presentation":{"type":"bearer"},"hosts":["api.example.org"]}'
|
|
306
306
|
tangle sandbox create --proxy-secret @bindings.json # repeatable; array or single binding
|
|
307
|
+
tangle sandbox create --proxy-secret @bindings.json --allow-domain api.example.org
|
|
308
|
+
tangle sandbox egress <id> --allow-domain api.example.org # add a host; without the flag, show the policy
|
|
307
309
|
```
|
|
308
310
|
|
|
311
|
+
The default egress policy is strict and does not reach a binding's host; create warns and names the flag.
|
|
312
|
+
|
|
309
313
|
## Snapshots
|
|
310
314
|
|
|
311
315
|
```bash
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,o as t}from"./output-BqCeTtw4.mjs";import{n,t as r}from"./solve-signer-
|
|
1
|
+
import{a as e,o as t}from"./output-BqCeTtw4.mjs";import{n,t as r}from"./solve-signer-DPwZymEr.mjs";function i(i){let a=i.create?r():n();if(!a)throw Error("No Solve device signer found. Run `tangle solve account --create`");i.json?e({address:a.account.address,source:a.source}):t({Address:a.account.address,Source:a.source})}export{i as showSolveAccount};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"node:fs";import*as t from"node:path";import{randomUUID as n}from"node:crypto";import*as r from"node:os";import{execFileSync as i}from"node:child_process";import{lockSync as a}from"proper-lockfile";const o=t.join(r.homedir(),`.tangle`),s=t.join(o,`credentials.json`),c=`tangle-sandbox-cli`,l=`/usr/bin/security`,u=`tangle-base64:`,d=new Int32Array(new SharedArrayBuffer(4));var f=class extends Error{constructor(e,t){super(`Credentials file at ${e} is corrupted and cannot be parsed. Inspect or remove it manually before retrying — refusing to overwrite it automatically.`),this.filePath=e,this.name=`CredentialsFileCorruptedError`,t&&(this.cause=t)}},p=class extends Error{constructor(e){super(`Credential storage preflight failed: ${e}`),this.name=`CredentialStorageProbeError`}},m=class extends Error{constructor(e){super(`Credential storage is busy. Wait a moment and retry.`),this.name=`CredentialsFileLockedError`,e&&(this.cause=e)}};function h(e){let t=x(e);if(t)return{value:t,source:`keychain`};let n=T(e);return n?{value:n,source:`file`}:{source:`none`}}function g(e,t){return C(e,t)?(D(e),`keychain`):(E(e,t),`file`)}function _(){let e=`credential-write-probe:${process.pid}:${n()}`,t=n();if(C(e,t)){let n=x(e);if(!w(e))throw new p(`the OS keychain accepted a test credential but the CLI could not remove it`);if(n!==t)throw new p(`the OS keychain accepted a test credential but the CLI could not read it back`);return`keychain`}return j(e),`file`}function v(e){w(e),D(e)}function y(e,t,n={}){if(e===`darwin`)return{command:l,args:t.darwin,input:n.darwin};if(e===`linux`)return{command:`secret-tool`,args:t.linux,input:n.linux}}function b(e){if(e)try{return i(e.command,e.args,{encoding:`utf8`,input:e.input,stdio:[e.input===void 0?`ignore`:`pipe`,`pipe`,`ignore`],timeout:e.command===l?void 0:1e4}).trim()}catch{return}}function x(e){let t=N(e),n=b(y(process.platform,{darwin:[`find-generic-password`,`-s`,c,`-a`,t,`-w`],linux:[`lookup`,`service`,c,`account`,t]}));return n?.startsWith(u)?Buffer.from(n.slice(14),`base64`).toString(`utf8`):n}function S(e,t,n=process.platform){let r=N(e),i=`add-generic-password -U -s ${c} -a ${r} -w ${u+Buffer.from(t,`utf8`).toString(`base64`)}\n`;if(!(n===`darwin`&&Buffer.byteLength(i)>4096))return y(n,{darwin:[`-i`],linux:[`store`,`--label=Tangle Sandbox CLI`,`service`,c,`account`,r]},{darwin:i,linux:t})}function C(e,t){return b(S(e,t))===void 0?!1:x(e)===t}function w(e){let t=N(e);return b(y(process.platform,{darwin:[`delete-generic-password`,`-s`,c,`-a`,t],linux:[`clear`,`service`,c,`account`,t]}))!==void 0}function T(e){return k()[e]}function E(e,t){O(()=>{let n=k();n[e]=t,A(n)})}function D(e){return O(()=>{let t;try{t=k()}catch(e){if(e instanceof f)return!1;throw e}return e in t?(delete t[e],A(t),T(e)===void 0):!0})}function O(e){M();let t=Date.now()+2e3,n,r;for(;!n;)try{n=a(s,{realpath:!1,stale:5e3})}catch(e){if(r=e instanceof Error?e:void 0,!e||typeof e!=`object`||!(`code`in e)||e.code!==`ELOCKED`)throw e;if(Date.now()>=t)throw new m(r);Atomics.wait(d,0,0,20)}try{return e()}finally{n()}}function k(){let t;try{t=e.readFileSync(s,`utf8`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return{};throw e}try{let e=JSON.parse(t);if(typeof e!=`object`||!e||Array.isArray(e))throw new f(s);let n={};for(let[t,r]of Object.entries(e))typeof r==`string`&&(n[t]=r);return n}catch(e){throw e instanceof f?e:new f(s,e instanceof Error?e:void 0)}}function A(t){if(M(),Object.keys(t).length===0){e.existsSync(s)&&e.unlinkSync(s);return}let n=`${s}.${process.pid}.tmp`;e.writeFileSync(n,`${JSON.stringify(t,null,2)}\n`,{mode:384}),e.renameSync(n,s)}function j(e){let t=n(),r=!1,i;try{if(E(e,t),r=!0,T(e)!==t)throw new p(`the credentials file did not return the value just written`)}catch(e){i=e}finally{if(r)try{!D(e)&&!i&&(i=new p(`the credentials file accepted a test credential but the CLI could not remove it`))}catch(e){i??=e}}if(i)throw i}function M(){if(!e.existsSync(o)){e.mkdirSync(o,{mode:448,recursive:!0});return}if(process.platform!==`win32`)try{(e.statSync(o).mode&511)!=448&&e.chmodSync(o,448)}catch{}}function N(e){return`profile:${e}`}export{g as i,v as n,h as r,_ as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,f as t,i as n,p as r,r as i}from"./output-BqCeTtw4.mjs";import{p as a,y as o}from"./index.mjs";import{n as s,r as c}from"./solve-signer-
|
|
1
|
+
import{a as e,f as t,i as n,p as r,r as i}from"./output-BqCeTtw4.mjs";import{p as a,y as o}from"./index.mjs";import{n as s,r as c}from"./solve-signer-DPwZymEr.mjs";import{n as l,r as u,t as d}from"./api-COxVvwlJ.mjs";import{t as f}from"./deployment-t_Jhgj4Q.mjs";import{n as p,o as m,v as h,x as g}from"./transactions-C3dKwqB0.mjs";import{createPublicClient as _,getAddress as v,http as y,isAddress as b}from"viem";import{tempoModerato as x}from"viem/chains";const S={...f,chainName:`Tempo Moderato`,nativeSymbol:`TNT`},C={async read(e){let t=_({chain:x,transport:y(S.rpcUrl,{timeout:15e3})}),n=e=>e.catch(()=>null),r=await Promise.all(e.map(async e=>{let[r,i]=await Promise.all([n(t.readContract({address:S.tangleAddress,abi:g,functionName:`isPermittedCaller`,args:[S.serviceId,e]})),n(t.readContract({address:S.managerAddress,abi:h,functionName:`isDeviceRevoked`,args:[e]}))]);return[e.toLowerCase(),{permitted:r,revoked:i}]}));return new Map(r)},async revokeSelf(e){return p(await m(S,e),S)}},w={permitted:null,revoked:null};function T(e){return e.revoked?`revoked`:e.permitted===null?`unknown`:e.permitted?`permitted`:`not permitted`}async function E(t,r=C){try{let{devices:i}=await l({apiUrl:t.apiUrl,profile:t.profile}),a=s()?.account.address.toLowerCase(),o=i.map(e=>({...e,local:e.address===a,status:e.revokedAt?`revoked`:`active`}));a&&!o.some(e=>e.local)&&o.push({address:a,local:!0,status:`unbound`,boundAt:null,lastUsedAt:null,revokedAt:null,revocationMethod:null,revocationReason:null});let c=await r.read(o.map(e=>v(e.address))),u=o.map(e=>({...e,onChain:c.get(e.address)??w}));if(t.json){e({serviceId:S.serviceId.toString(),devices:u});return}n([`Address`,`Status`,`Local`,`Service ${S.serviceId}`,`Last used`,`Revoked`],u.map(e=>[e.address,e.status,e.local?`yes`:``,T(e.onChain),e.lastUsedAt??``,e.revokedAt?`${e.revokedAt} (${e.revocationMethod})`:``]))}catch(e){o(e,t.json)}}async function D(n,l,f=C){try{if(!b(n))throw Error(`${n} is not an EVM address`);let o=v(n),p=s(),m=p?.account.address===o;if(!l.yes){if(!process.stdin.isTTY)throw Error(`Revoking a device is permanent. Re-run with --yes to confirm`);if(!await a(`Permanently revoke Solve device ${o}${m?` (this machine's device)`:``}? [y/N] `,`--yes`)){i(`Revocation cancelled`);return}}let h;if(p&&m){let e=await d({deviceAddress:o,purpose:`revoke`,apiUrl:l.apiUrl,profile:l.profile});h={challengeId:e.challengeId,signature:await p.account.signMessage({message:e.message})}}let g=await u({deviceAddress:o,reason:l.reason,...h,apiUrl:l.apiUrl,profile:l.profile}),_=o.toLowerCase(),y=(await f.read([o])).get(_)??w,x;if(p&&m&&!y.revoked){try{x=await f.revokeSelf(p.account)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`The Solve API revoked ${o}, but the on-chain revocation failed and the local key was kept: ${t}. Run the command again to retry`)}y=(await f.read([o])).get(_)??w}let C=p&&m&&y.revoked?c(p):void 0;if(l.json){e({...g,serviceId:S.serviceId.toString(),onChain:y,...x?{revocationTransaction:x}:{},localKeyRetired:!!C});return}t(g.alreadyRevoked?`${o} was already revoked in the Solve API`:`Revoked ${o}; the Solve API refuses its signatures`),x&&t(`Revoked on Tempo in ${x}; service ${S.serviceId} refuses its jobs`),C&&i("The local device key was moved aside because its address may still hold stake or rewards. Run `tangle solve account --create` for a new device"),!m&&y.permitted&&r(`The device can still submit jobs to service ${S.serviceId}. Only its key, or the Solve blueprint owner, can revoke it on chain`)}catch(e){o(e,l.json)}}export{E as listSolveDevices,D as revokeSolveDevice};
|