@tangle-network/sandbox-cli 0.23.12 → 0.23.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-ppb4-uf5.mjs → account-7XAhMt97.mjs} +1 -1
- package/dist/credential-store-QcpDsEtL.mjs +1 -0
- package/dist/{device-CggsQEHQ.mjs → device-BEp1WVHD.mjs} +1 -1
- package/dist/index.mjs +34 -33
- package/dist/{run-CJ0jL7ul.mjs → run-B8ZGc03g.mjs} +1 -1
- package/dist/{solve-signer-DPwZymEr.mjs → solve-signer-CZZ0ccM_.mjs} +1 -1
- package/dist/{submit-wmXtPZX6.mjs → submit-B2ANeTIO.mjs} +1 -1
- package/package.json +7 -7
- package/dist/credential-store-C6gb-zro.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,f as t,o as n,r,u as i}from"./output-BqCeTtw4.mjs";import{y as a}from"./index.mjs";import{t as o}from"./solve-signer-
|
|
1
|
+
import{a as e,f as t,o as n,r,u as i}from"./output-BqCeTtw4.mjs";import{y as a}from"./index.mjs";import{t as o}from"./solve-signer-CZZ0ccM_.mjs";import{c as s,f as c,n as l,o as u,s as d,t as f}from"./workspace-BOqrV945.mjs";import{n as p,t as m}from"./solve-checker-gdxdE3g4.mjs";import*as h from"node:path";import{randomBytes as g,randomUUID as _}from"node:crypto";import{toHex as v}from"viem";async function y(y,b){try{let{root:a,manifest:x}=await d(y,b.directory),S=await u(a),C=x.provenance?await s(a,x,S,{allowMissing:!0}):void 0,w=o(),T=i(`Running ${x.title} checker…`);b.json||T.start();let E;try{E=await m(a,x.checker)}finally{T.stop()}let D=l(E,C,x.provenance,void 0,{allowMissingSource:!0,requirePullRequest:!1}),O=v(g(32)),k=p(E.candidateRef,O),A={version:1,competition:x.slug,candidateRef:E.candidateRef,evidence:D.evidence,evidenceJson:E.evidenceJson,evidenceRefs:D.evidenceRefs,salt:O,candidateId:k,...C?{source:C}:{},deviceAddress:w.account.address,clientSubmissionId:_(),createdAt:new Date().toISOString()};await c(h.join(a,`.tangle-solve-run.json`),A),b.json?e({localRun:A}):(t(`Checker output recorded locally for operator evaluation`),n({Competition:x.slug,Candidate:E.candidateRef,"Device address":w.account.address,"Evidence refs":D.evidenceRefs.length}),r("Commit any changes, then run `tangle solve submit` from this directory."),x.provenance&&!C&&r(`Add your GitHub fork as 'origin' before submitting. The task repository is available as '${f}'.`))}catch(e){a(e)}}export{y as runCompetition};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,r as n}from"./credential-store-
|
|
1
|
+
import{i as e,n as t,r as n}from"./credential-store-QcpDsEtL.mjs";import{generatePrivateKey as r,privateKeyToAccount as i}from"viem/accounts";const a=`solve:device:secp256k1`,o=/^0x[0-9a-f]{64}$/i;function s(e){return e&&o.test(e)?e:void 0}function c(){let e=n(a),t=s(e.value);if(!(!t||e.source===`none`))return{account:i(t),source:e.source}}function l(){let t=c();if(t)return t;let n=r(),o=e(a,n);return{account:i(n),source:o}}function u(r){let o=s(n(a).value);if(!o||i(o).address!==r.account.address)throw Error(`The local Solve device key changed; it was not retired`);let c=`${a}:retired:${r.account.address.toLowerCase()}`;if(e(c,o),n(c).value!==o)throw Error(`The revoked device key could not be retired safely`);return t(a),c}export{c as n,u as r,l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,f as t,o as n,u as r}from"./output-BqCeTtw4.mjs";import{y as i}from"./index.mjs";import{n as a}from"./solve-signer-
|
|
1
|
+
import{a as e,f as t,o as n,u as r}from"./output-BqCeTtw4.mjs";import{y as i}from"./index.mjs";import{n as a}from"./solve-signer-CZZ0ccM_.mjs";import{a as o,c as s,d as c,f as l,h as u,l as d,m as f,n as p,o as m,s as h,u as g}from"./workspace-BOqrV945.mjs";import{a as _,i as v,t as y}from"./api-COxVvwlJ.mjs";import{n as b,r as x,t as S}from"./solve-checker-gdxdE3g4.mjs";import*as C from"node:path";const w=/^0x[0-9a-f]{64}$/i;async function T(e){let t=await y({deviceAddress:e.deviceAddress,apiUrl:e.apiUrl,profile:e.profile}),n=await e.signer.signMessage({message:t.message});return{walletChallengeId:t.challengeId,walletSignature:n}}async function E(y,E){try{let{root:i,manifest:D}=await h(y,E.directory);v({profile:E.profile});let O=await m(i),k=await o(i);if(k.competition!==D.slug)throw Error(`.tangle-solve-run.json does not match this competition`);if(!w.test(k.salt)||!w.test(k.candidateId))throw Error("This run predates durable candidate identity. Run `tangle solve run` again");let A=D.provenance?await s(i,D,O):void 0;if(D.provenance&&k.source&&!d(k.source,A))throw Error("The saved run points to a different repository or revision. Keep your fork as 'origin' and run `tangle solve run` again before submitting");let j=a();if(!j)throw Error("No Solve device signer found. Run `tangle solve run` first");if(j.account.address.toLowerCase()!==k.deviceAddress.toLowerCase())throw Error("The local Solve device account changed after `tangle solve run`; run the checker again");let M=r(`Checking the committed candidate…`);E.json||M.start();let N;try{N=await S(i,D.checker)}finally{M.stop()}if(N.candidateRef!==k.candidateRef||N.evidenceJson!==k.evidenceJson)throw Error("The committed checker output changed after `tangle solve run`; run the checker again");if(b(N.candidateRef,k.salt).toLowerCase()!==k.candidateId.toLowerCase())throw Error(`The saved candidate identity does not match the checker output; run the checker again`);let P=u(E.prUrl);if(!D.provenance&&P)throw Error(`This competition does not accept GitHub pull request provenance`);if(P){if(!A)throw Error(`A provenance policy is required for a pull request`);await c({pullRequest:P,taskRepository:A.taskRepository,submissionRepository:A.submissionRepository,submissionRevision:O})}let F=p(N,A,D.provenance,P,{requirePullRequest:!0}),I={...k,...A?{source:A}:{},chainState:{status:`submitting`,transactions:{...k.chainState?.transactions??{}}}},L=C.join(i,`.tangle-solve-run.json`);await l(L,I);let R=r(`Submitting candidate to Tempo…`);E.json||R.start();let z;try{z=await x(f(D),j.account,{artifactRef:N.candidateRef,salt:k.salt,evidenceJson:N.evidenceJson,evidenceRefs:F.evidenceRefs},{resumeTransactions:I.chainState?.transactions,onTransaction:async(e,t)=>{I={...I,chainState:{status:`submitting`,transactions:{...I.chainState?.transactions??{},[e]:t}}},await l(L,I)}})}finally{R.stop()}I={...I,chainReceipt:z,chainState:{status:`accepted`,transactions:{...I.chainState?.transactions??{},...g(z)}}},await l(L,I);let B=await T({deviceAddress:z.address,signer:j.account,apiUrl:E.apiUrl,profile:E.profile}),V=await _({path:`/v1/submissions`,method:`POST`,apiUrl:E.apiUrl,profile:E.profile,body:{competition:D.slug,candidateRef:N.candidateRef,candidateId:z.candidateId,evidenceJson:N.evidenceJson,evidenceRefs:F.evidenceRefs,deviceAddress:z.address,reportTxHash:z.report,evaluationTxHash:z.evaluation,transactions:g(z),...D.provenance&&A?{source:{...A,...P?{pullRequest:P}:{}}}:{},clientSubmissionId:k.clientSubmissionId,...B,...E.model?{model:E.model}:{},...E.note?{note:E.note}:{}}});E.json?e({...V,transactions:g(z),candidateId:z.candidateId}):(t(`Submission accepted on Tempo`),n({Competition:D.slug,Candidate:z.candidateId,"Device address":z.address,"Report transaction":z.report,"Evaluation transaction":z.evaluation,"Submission ID":typeof V.id==`string`?V.id:V.submission?.id}))}catch(e){i(e)}}export{E as submitCompetition};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/sandbox-cli",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.13",
|
|
4
4
|
"description": "CLI for Tangle Sandbox operations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@tangle-network/agent-runtime": "^9.0.12",
|
|
27
27
|
"@tangle-network/harness-sessions": "^1.0.2",
|
|
28
28
|
"@tangle-network/hub-sdk": "1.0.30",
|
|
29
|
-
"@tangle-network/sandbox": "^1.0.
|
|
29
|
+
"@tangle-network/sandbox": "^1.0.425",
|
|
30
30
|
"@tangle-network/sdk-cli-runner": "^0.3.12",
|
|
31
31
|
"chalk": "^5.6.2",
|
|
32
32
|
"cli-bridge": "https://codeload.github.com/drewstone/cli-bridge/tar.gz/9c020ce3d94b3b0157c39f939c3c9b3738c1028a",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@tangle-network/brand": "1.31.11",
|
|
45
45
|
"@tangle-network/charts": "4.0.21",
|
|
46
46
|
"@tangle-network/sandbox-ui": "8.0.4",
|
|
47
|
-
"@tangle-network/ui": "11.51.
|
|
47
|
+
"@tangle-network/ui": "11.51.32",
|
|
48
48
|
"@types/node": "25.6.0",
|
|
49
49
|
"@types/proper-lockfile": "4.1.4",
|
|
50
50
|
"@types/react": "19.3.0",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"typescript": "^6.0.3",
|
|
61
61
|
"vitest": "^4.1.12",
|
|
62
62
|
"@repo/shared": "0.0.0",
|
|
63
|
+
"@tangle-network/runtime-contracts": "0.20.0",
|
|
63
64
|
"@tangle-network/sdk-session-persistence": "0.7.0",
|
|
64
|
-
"@repo/knowledge-host": "0.0.0"
|
|
65
|
-
"@tangle-network/runtime-contracts": "0.20.0"
|
|
65
|
+
"@repo/knowledge-host": "0.0.0"
|
|
66
66
|
},
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public",
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"author": "Tangle Network",
|
|
87
87
|
"license": "MIT",
|
|
88
88
|
"tangleRelease": {
|
|
89
|
-
"sourceSha": "
|
|
90
|
-
"mergedAt": "2026-11-
|
|
89
|
+
"sourceSha": "c7cc5c88cfdb69c25f02d3b7b4cfcc1a04ce06a4",
|
|
90
|
+
"mergedAt": "2026-11-16T12:57:15-08:00"
|
|
91
91
|
},
|
|
92
92
|
"scripts": {
|
|
93
93
|
"build": "tsdown",
|
|
@@ -1 +0,0 @@
|
|
|
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};
|