@tangle-network/sandbox-cli 0.23.8 → 0.23.10
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-BaGFNxyq.mjs → account-Bklwl_Tx.mjs} +1 -1
- package/dist/{credential-store-Bpw_4ZTQ.mjs → credential-store-DysDRcD-.mjs} +1 -1
- package/dist/{device-i0PzYisd.mjs → device-D6rmGHLz.mjs} +1 -1
- package/dist/graph-native-B8Vtf07K.mjs +1 -0
- package/dist/index.mjs +34 -34
- package/dist/{run-BSXC2ytE.mjs → run-BxATA6T4.mjs} +1 -1
- package/dist/{solve-signer--UaZcdFY.mjs → solve-signer-D6EYGOv9.mjs} +1 -1
- package/dist/{submit-D2jvFJtX.mjs → submit-BCCjJAeU.mjs} +1 -1
- package/package.json +5 -5
- package/dist/graph-native-CmG9wDbX.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-D6EYGOv9.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-DysDRcD-.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-D6EYGOv9.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.10",
|
|
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.422",
|
|
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/e36c675aafde9e51aca828cb28a2dfb3f885867b",
|
|
@@ -60,8 +60,8 @@
|
|
|
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",
|
|
64
63
|
"@tangle-network/sdk-session-persistence": "0.7.0",
|
|
64
|
+
"@tangle-network/runtime-contracts": "0.20.0",
|
|
65
65
|
"@repo/knowledge-host": "0.0.0"
|
|
66
66
|
},
|
|
67
67
|
"publishConfig": {
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"author": "Tangle Network",
|
|
87
87
|
"license": "MIT",
|
|
88
88
|
"tangleRelease": {
|
|
89
|
-
"sourceSha": "
|
|
90
|
-
"mergedAt": "2026-11-
|
|
89
|
+
"sourceSha": "2d761a433969e7d73fb48ce88d751ad6130e28f6",
|
|
90
|
+
"mergedAt": "2026-11-16T10:45:04-08:00"
|
|
91
91
|
},
|
|
92
92
|
"scripts": {
|
|
93
93
|
"build": "tsdown",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{isAbsolute as e,join as t,relative as n}from"node:path";import{createHash as r}from"node:crypto";import{z as i}from"zod";import{constants as a}from"node:fs";import{open as o,opendir as s,realpath as c}from"node:fs/promises";import*as l from"@tangle-network/agent-runtime/kernel";import{CODEX_HOME_RULE as u,STORES as d,claudeCodeRefForFile as f,codexRefForFile as p,readSessionInput as m,storeGlob as h,withinPath as g}from"@tangle-network/harness-sessions";const _=i.object({harness:i.enum([`codex`,`claude-code`]),root:i.string().refine(e),basis:i.literal(`host-jail`),nativeSessionId:i.string().min(1),runId:i.string().min(1),requestDigest:i.string().regex(/^sha256:[a-f0-9]{64}$/)}),v=i.object({externalId:i.string(),internalId:i.string(),backend:i.enum([`codex`,`claude-code`]),cwd:i.string(),metadata:i.object({effective_native_store:_,agent_profile_binding:i.object({effectiveProfileDigest:i.string()})})});function y(){let e=new Map;return{observe(t){e.set(`${t.runId}:${t.requestDigest}`,t)},close(){e.clear()},redact(t,n){for(let n of t.runs){let r=e.get(`${n.runId}:${n.requestDigest}`);if(!r||r.sessionId!==t.sessionId||r.profileDigest!==t.profileDigest||r.cwd!==t.cwd)throw Error(`Exact native execution has no trusted redaction authority`)}if(!t.runs.length)throw Error(`Native redaction requires an exact execution binding`);let r=n;for(let n of e.values())n.sessionId===t.sessionId&&n.profileDigest===t.profileDigest&&n.cwd===t.cwd&&(r=n.redact(r));return r}}}function b(e,t){if(e===`codex`)return p(t);let n=t.split(`/`),r=n.indexOf(`subagents`,3);return f(t,r>0?n[r-1]??null:null)}async function x(e,r,i){let a=[],o=d[`claude-code.projects-jsonl`],f=t(r,...o.root.split(`/`).slice(1)),p=e===`codex`?u.sessionDirs.map(e=>t(r,e)):[f],m=e===`codex`?[h(u.rollout)]:o.files.map(e=>h(e)),_=0;for(;p.length;){i.throwIfAborted();let o=p.shift();if(o===void 0)break;let u;try{u=await c(o)}catch(e){if(e.code===`ENOENT`)continue;throw e}if(!g(u,r))throw Error(`Native inventory escaped its attested store`);let d=await s(u);for await(let o of d){if(i.throwIfAborted(),++_>l.HARNESS_TRANSCRIPT_READ_LIMITS.maxFiles)throw Error(`Native inventory exceeds the capture bound`);let s=t(d.path,o.name);o.isDirectory()?p.push(s):o.isFile()&&m.some(t=>t.test(e===`codex`?o.name:n(f,s)))&&a.push({path:n(r,s),nativeSessionId:b(e,n(r,s)).nativeSessionId})}}return a}function S(e){return async n=>{if(![`codex`,`claude-code`].includes(n.harness))return{status:`unavailable`,reason:`unknown-harness`,skipped:[{path:n.harness,reason:`Native transcript capture is not configured for this harness`}]};let s=await fetch(`${e.bridgeUrl}/v1/sessions?session_id=${encodeURIComponent(n.sessionId)}&backend=${n.harness}`,{headers:{authorization:`Bearer ${e.bridgeBearer}`},signal:n.signal});if(!s.ok)throw Error(`Bridge session lookup failed (HTTP ${s.status})`);let u=i.object({data:i.tuple([v])}).parse(await s.json()).data[0],d=u.metadata.effective_native_store,f=await c(d.root);if(u.backend!==n.harness||d.harness!==n.harness||u.externalId!==n.sessionId||u.internalId!==d.nativeSessionId||u.cwd!==e.cwd||n.cwd!==e.cwd||u.metadata.agent_profile_binding.effectiveProfileDigest!==n.profileDigest||f!==d.root||!g(f,t(e.cwd,`.agent-home`))||!n.runs.some(e=>e.runId===d.runId&&e.requestDigest===d.requestDigest))throw Error(`Bridge native binding does not match this execution`);let p=[],h=[...new Set(e.privateMcpSecrets?.()??[])].flatMap(e=>[e,JSON.stringify(e).slice(1,-1)]).filter(Boolean).sort((e,t)=>t.length-e.length),_=await l.captureBoundHarnessTranscript({harness:n.harness,binding:{kind:`bridge`,sessionId:n.sessionId,nativeSessionId:d.nativeSessionId,profileDigest:n.profileDigest,runs:n.runs,...n.node===void 0?{}:{node:n.node}},nativeSessionId:d.nativeSessionId,files:await x(n.harness,f,n.signal),signal:n.signal,parse:(e,t)=>m(n.harness,{text:e},{...b(n.harness,t.path),label:t.path},{corruption:`strict`}),read:async(i,s)=>{let u=await c(t(f,i.path));if(!g(u,f))throw Error(`Native session escaped its attested store`);let d=await o(u,a.O_RDONLY|a.O_NOFOLLOW);try{let t=await d.stat();if(!t.isFile()||t.size>l.HARNESS_TRANSCRIPT_READ_LIMITS.maxFileBytes)throw Error(`Native session is not a bounded regular file`);s?.throwIfAborted();let a=await d.readFile();if(s?.throwIfAborted(),!e.redact)throw Error(`The native host did not supply private redaction authority`);let o=e.redact(n,a),c=new TextDecoder(`utf-8`,{fatal:!0}).decode(o);for(let e of h)c=c.split(e).join(`[redacted:MCP]`);let u=Buffer.from(c,`utf8`);return u.equals(a)||p.push({path:i.path,reason:`Original bytes withheld for private MCP credential redaction; source sha256:${r(`sha256`).update(a).digest(`hex`)}; retained copy is redacted`}),u}finally{await d.close()}}});return _.status!==`captured`||!p.length?_:{..._,artifact:{..._.artifact,skipped:[..._.artifact.skipped,...p]},skippedCount:_.skippedCount+p.length,coverageComplete:!1,missing:[`private-mcp-secret-original-bytes`]}}}const C=async(e,t)=>{if(![`codex`,`claude-code`].includes(e.harness)||e.binding?.kind!==`bridge`)throw Error(`Native transcript reader is not configured for this capture`);return(await l.readBoundHarnessSessions({nativeSessionId:e.binding.nativeSessionId,files:e.files.map(t=>({path:t.path,nativeSessionId:b(e.harness,t.path).nativeSessionId,byteLength:t.bytes})),read:async t=>{let n=e.files.find(e=>e.path===t.path);if(!n)throw Error(`Retained native file is absent`);return Buffer.from(n.content,`utf8`)},parse:(t,n)=>m(e.harness,{text:t},{...b(e.harness,n.path),label:n.path},{corruption:`strict`}),signal:t})).sessions};export{S as graphNativeCapture,y as graphNativeRedaction,C as readGraphSessions};
|