@tangle-network/sandbox-cli 0.23.330 → 0.23.331
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/graph-campaign-child.mjs +1 -1
- package/dist/{graph-zoX4reCo.mjs → graph-eddIXBjC.mjs} +17 -17
- package/dist/{graph-profile-learning-BNgZ4ltM.mjs → graph-profile-learning-CVPbIlhI.mjs} +1 -1
- package/dist/{graph-workflow-dataset-DuIRSP8a.mjs → graph-workflow-dataset-DDhGZ8Sx.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./errors-CzkPwUni.mjs";import{A as t,M as n,N as r,j as i,k as a,n as o,r as s}from"./graph-
|
|
1
|
+
import{t as e}from"./errors-CzkPwUni.mjs";import{A as t,M as n,N as r,j as i,k as a,n as o,r as s}from"./graph-eddIXBjC.mjs";import{canonicalCandidateDigest as c}from"@tangle-network/agent-interface";import{z as l}from"zod";import{readFile as u}from"node:fs/promises";import{redactText as d}from"@tangle-network/agent-eval/traces";if(!process.send)throw Error(`Campaign execution requires its parent IPC channel`);const f=new AbortController,p=()=>f.abort();process.on(`SIGTERM`,p),process.on(`SIGINT`,p),process.on(`disconnect`,p);const m=l.strictObject({type:l.literal(`run`),request:t,launchId:l.uuid(),seatSource:i});let h=!1;process.on(`message`,e=>{if(typeof e==`object`&&e&&`type`in e&&e.type===`cancel`){p();return}h||(h=!0,g(e).finally(()=>process.disconnect?.()))});async function g(t){let i=m.safeParse(t);if(!i.success||Buffer.byteLength(JSON.stringify(t))>4*1024*1024){process.exitCode=1;return}let{request:p,launchId:h}=i.data,g=a(p),_=!1,v,y=`uncertain`;try{let e=n(i.data.seatSource);if(c(e)!==p.seatSourceDigest)throw Error(`Campaign seat source commitment mismatch`);if(o(await u(p.file))!==p.sourceDigest)throw Error(`Campaign subprocess source changed`);await s(p.file,{param:p.param,json:!0,...e,...p.resume&&{resume:p.runId},...p.seat&&{seat:p.seat},...p.mcpPolicy&&{mcpPolicy:p.mcpPolicy}},{runId:p.runId,cwd:p.cwd,defaultSeat:p.defaultSeat,graphDigest:p.graphDigest,purpose:`evaluation`,signal:f.signal,...p.trigger&&{trigger:p.trigger},...p.taskWorkspace&&{taskWorkspace:p.taskWorkspace},onHostAdmitted:()=>new Promise((e,t)=>{let n=()=>{i(),t(f.signal.reason)},r=t=>{l.strictObject({type:l.literal(`admitted`),requestDigest:l.literal(g),launchId:l.literal(h)}).safeParse(t).success&&(_=!0,i(),e())},i=()=>{process.off(`message`,r),f.signal.removeEventListener(`abort`,n)};if(process.on(`message`,r),f.signal.addEventListener(`abort`,n,{once:!0}),f.signal.aborted)return n();process.send?.({type:`host-admitted`,launchId:h,runId:p.runId,requestDigest:g})})}),y=`completed`}catch(t){if(_)t.code===`GRAPH_RUN_FAILED`&&(y=`work-failed`);else{y=`not-started`;let n=Object.entries(process.env).filter(([e])=>/(?:token|secret|pass(?:word)?|credential|api.?key|bearer)/iu.test(e)).flatMap(([,e])=>e?[e]:[]);i.data.seatSource.seatCredential&&n.push(i.data.seatSource.seatCredential),v=d(t instanceof e?`${t.code}: ${t.message}: ${t.cause}`:t instanceof Error?t.message:`Campaign child refused execution before admission`,{knownSecrets:n}).slice(0,1200)}process.exitCode=1}finally{await r(p.receipt,{version:1,runId:p.runId,requestDigest:g,launchId:h,status:y,...v&&{refusal:v}})}}export{};
|