@reason-machines/cli-linux-x64 0.2.566 → 0.2.568
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/bin/reason +1 -1
- package/bin/vm-hands/agent-network-dw7yrrwt.js +2 -0
- package/bin/vm-hands/api-credentials-ntpwt7rg.js +2 -0
- package/bin/vm-hands/api-xvjq0bka.js +2 -0
- package/bin/vm-hands/{ask-relay-gk4ks8mg.js → ask-relay-hfa5kzxn.js} +2 -2
- package/bin/vm-hands/connect-cli-2ja7aj4w.js +2 -0
- package/bin/vm-hands/credentials-nfx99zxr.js +2 -0
- package/bin/vm-hands/custom-endpoint-device-5047vdn3.js +2 -0
- package/bin/vm-hands/desktop-account-d1g1m6yb.js +2 -0
- package/bin/vm-hands/desktop-components-577haqrs.js +2 -0
- package/bin/vm-hands/desktop-delegate-4hb0163k.js +2 -0
- package/bin/vm-hands/device-workspace-8941tdsy.js +2 -0
- package/bin/vm-hands/{fsevents-ezcg3e40.js → fsevents-e57jgcfe.js} +1 -1
- package/bin/vm-hands/hands-worker-source-8a4kh44t.js +2 -0
- package/bin/vm-hands/{index-w92ys6ra.js → index-y21r07rf.js} +8 -8
- package/bin/vm-hands/install-receipt-rckwjqmt.js +2 -0
- package/bin/vm-hands/local-automation-fxdb4ynz.js +2 -0
- package/bin/vm-hands/local-capabilities-8fgrfpj4.js +2 -0
- package/bin/vm-hands/local-desktop-users-hkdfxqtj.js +2 -0
- package/bin/vm-hands/local-display-mac-gsh74khc.js +2 -0
- package/bin/vm-hands/local-display-session-8b2hx1k6.js +2 -0
- package/bin/vm-hands/local-display-video-511qjgmq.js +2 -0
- package/bin/vm-hands/local-managed-process-h0fypn67.js +2 -0
- package/bin/vm-hands/local-pty-session-w0yhjdvz.js +2 -0
- package/bin/vm-hands/managed-runtime-e4cj6r2s.js +2 -0
- package/bin/vm-hands/{network-auto-update-qwds22kt.js → network-auto-update-8f2745gk.js} +2 -2
- package/bin/vm-hands/network-contract-ht0psj5j.js +2 -0
- package/bin/vm-hands/{network-sign-in-kqdg70kc.js → network-sign-in-s00679q9.js} +2 -2
- package/bin/vm-hands/package-3rv6jngd.js +2 -0
- package/bin/vm-hands/permissions-74rj58e1.js +2 -0
- package/bin/vm-hands/reason-hands-protocol-9r62swp0.js +2 -0
- package/bin/vm-hands/serve-service-19s965ze.js +2 -0
- package/bin/vm-hands/{status-q55nprve.js → status-099b2ec1.js} +5 -5
- package/bin/vm-hands/version-avq09c5d.js +2 -0
- package/bin/vm-hands/{vm-hands-entry-lite-pg7nnyc6.js → vm-hands-entry-lite-04nx5y4f.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-33at6g06.js → vm-hands-entry-lite-0xfme8gg.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-xfak34av.js → vm-hands-entry-lite-1as6h9ed.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-gxf2r5en.js → vm-hands-entry-lite-1cdtev4n.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-fn2805g8.js → vm-hands-entry-lite-1sy80ca9.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-yg4dk99m.js → vm-hands-entry-lite-2927z566.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-bkhc5mt4.js → vm-hands-entry-lite-2qh3rat2.js} +6 -6
- package/bin/vm-hands/{vm-hands-entry-lite-3q2ng4e9.js → vm-hands-entry-lite-3594pdj0.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-2qfmabqn.js → vm-hands-entry-lite-4kb5rq3d.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-s93f3pbv.js → vm-hands-entry-lite-732hnx41.js} +3 -3
- package/bin/vm-hands/vm-hands-entry-lite-7aeqbfc8.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-5qrft0nw.js → vm-hands-entry-lite-7jmt3q38.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-a8z57vry.js → vm-hands-entry-lite-8s5n4wps.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-y0jtj8zz.js → vm-hands-entry-lite-8twdd0ff.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-50kqbrb7.js → vm-hands-entry-lite-9meg54bs.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-qjrgvdbj.js → vm-hands-entry-lite-bbjsnjct.js} +21 -21
- package/bin/vm-hands/{vm-hands-entry-lite-zp7chzcc.js → vm-hands-entry-lite-bc9zq8gx.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-b2w5071h.js → vm-hands-entry-lite-bcz4qpp6.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-ngry8nkq.js → vm-hands-entry-lite-bqs4pkyb.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-zpvr7wc6.js → vm-hands-entry-lite-bt6skt4h.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-q62g6sx0.js → vm-hands-entry-lite-chve4vmh.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-a3gq377t.js → vm-hands-entry-lite-dh87ysh2.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-rz1ep81m.js → vm-hands-entry-lite-dhn0fs5e.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-ttfqxjms.js → vm-hands-entry-lite-ezkb7f6j.js} +9 -9
- package/bin/vm-hands/{vm-hands-entry-lite-994kah8n.js → vm-hands-entry-lite-fp3gaa2c.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-chq0qx9f.js → vm-hands-entry-lite-g0bpdyfz.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-9wp7ahwa.js → vm-hands-entry-lite-h5x725z8.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-rxydyqke.js → vm-hands-entry-lite-h7f5a5mb.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-13nx02p7.js → vm-hands-entry-lite-hh0kba1y.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-fccn6s4j.js → vm-hands-entry-lite-hpe54h0b.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-kbnxk71q.js → vm-hands-entry-lite-hpw27zfb.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-x6ybft9v.js → vm-hands-entry-lite-jm9jpj77.js} +5 -5
- package/bin/vm-hands/{vm-hands-entry-lite-284z7ct8.js → vm-hands-entry-lite-kankyeep.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-2gxv7v1h.js → vm-hands-entry-lite-ksfd234v.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-ezhfkjqr.js → vm-hands-entry-lite-kzygj0q8.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-fs6jbfp3.js → vm-hands-entry-lite-mktndd2r.js} +19 -19
- package/bin/vm-hands/{vm-hands-entry-lite-6adz91f3.js → vm-hands-entry-lite-mzw2vcah.js} +70 -70
- package/bin/vm-hands/{vm-hands-entry-lite-72h3t64b.js → vm-hands-entry-lite-n9277v11.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-88dxn9b5.js → vm-hands-entry-lite-peyr9y6z.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-cmmb9k3g.js → vm-hands-entry-lite-r131db1f.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-p02vay5n.js → vm-hands-entry-lite-rd7bm9we.js} +5 -5
- package/bin/vm-hands/{vm-hands-entry-lite-72084j3g.js → vm-hands-entry-lite-rpf4t8r4.js} +24 -24
- package/bin/vm-hands/{vm-hands-entry-lite-1b21avcs.js → vm-hands-entry-lite-sb1xtqxr.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-b1vanmtv.js → vm-hands-entry-lite-sxnvhzy5.js} +4 -4
- package/bin/vm-hands/{vm-hands-entry-lite-cc8hwgxc.js → vm-hands-entry-lite-t2rhwchw.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-sh4mqy93.js → vm-hands-entry-lite-t3k90kdn.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-12ck5swp.js → vm-hands-entry-lite-tzv8s0e7.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-jj7873n8.js → vm-hands-entry-lite-vha0pf8k.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-fxptf351.js → vm-hands-entry-lite-vvhfaxpd.js} +5 -5
- package/bin/vm-hands/{vm-hands-entry-lite-3gc2bn5a.js → vm-hands-entry-lite-wtjqjvea.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-30z7wsqr.js → vm-hands-entry-lite-y2vqwds4.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-z65xva21.js → vm-hands-entry-lite-ys4jhf7n.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite.js +2 -2
- package/bin/vm-hands/{vm-hands-executor-r6v6tzqj.js → vm-hands-executor-xd8v5v0e.js} +4 -4
- package/bin/vm-hands/{vm-hands-op-runner-wcbc42nw.js → vm-hands-op-runner-nr4ncs4p.js} +1 -1
- package/bin/vm-hands/vm-hands-runtime-qvy5s122.js +4 -0
- package/bin/vm-hands/worker-preview-readiness-w4zy5g2p.js +2 -0
- package/bin/vm-hands/worker-sandbox-2trfs79b.js +2 -0
- package/package.json +1 -1
- package/bin/vm-hands/agent-network-pak3wvrv.js +0 -2
- package/bin/vm-hands/api-credentials-a433ykxs.js +0 -2
- package/bin/vm-hands/api-kex52g1d.js +0 -2
- package/bin/vm-hands/connect-cli-afdc1h11.js +0 -2
- package/bin/vm-hands/credentials-sk4sag42.js +0 -2
- package/bin/vm-hands/custom-endpoint-device-3jscber1.js +0 -2
- package/bin/vm-hands/desktop-account-xma0330a.js +0 -2
- package/bin/vm-hands/desktop-components-y89gpa6e.js +0 -2
- package/bin/vm-hands/desktop-delegate-tch2qzx0.js +0 -2
- package/bin/vm-hands/device-workspace-4bj43nxq.js +0 -2
- package/bin/vm-hands/hands-worker-source-8pe7yv0m.js +0 -2
- package/bin/vm-hands/install-receipt-68xxg7hn.js +0 -2
- package/bin/vm-hands/local-automation-1s7035zm.js +0 -2
- package/bin/vm-hands/local-capabilities-h1hxzrhn.js +0 -2
- package/bin/vm-hands/local-desktop-users-jpf0resr.js +0 -2
- package/bin/vm-hands/local-display-mac-h5yz0ydd.js +0 -2
- package/bin/vm-hands/local-display-session-0vw1x2k6.js +0 -2
- package/bin/vm-hands/local-display-video-k4bgptc7.js +0 -2
- package/bin/vm-hands/local-managed-process-b79p5wwv.js +0 -2
- package/bin/vm-hands/local-pty-session-tqn2xmph.js +0 -2
- package/bin/vm-hands/managed-runtime-9jfx2885.js +0 -2
- package/bin/vm-hands/network-contract-nkwcf4r9.js +0 -2
- package/bin/vm-hands/package-9w0mmxb5.js +0 -2
- package/bin/vm-hands/permissions-q9nfdxrh.js +0 -2
- package/bin/vm-hands/reason-hands-protocol-pck5har9.js +0 -2
- package/bin/vm-hands/serve-service-hcc0zvg8.js +0 -2
- package/bin/vm-hands/version-7q2ft41r.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-997y1m1r.js +0 -3
- package/bin/vm-hands/vm-hands-runtime-2t08ywa4.js +0 -4
- package/bin/vm-hands/worker-preview-readiness-h96yr4wf.js +0 -2
- package/bin/vm-hands/worker-sandbox-6kkhvryn.js +0 -2
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{er}from"./vm-hands-entry-lite-fxptf351.js";import"./vm-hands-entry-lite-gxf2r5en.js";import{Gr}from"./vm-hands-entry-lite-30z7wsqr.js";import{Ra,ao,Ta}from"./vm-hands-entry-lite.js";import{spawn as ee}from"child_process";import{createHash as ne}from"crypto";import{lstatSync as N,mkdirSync as j,readFileSync as G,statSync as te,writeFileSync as z}from"fs";var O="/run/reason-vm-hands",W="/run/reason-vm-hands/env",A="/run/reason-vm-hands/surface",V="/home/runner/.reason/workspace",re=/^https:\/\/[a-z0-9.-]+(?::\d{1,5})?$/,U="/sys/fs/cgroup/reason-srt",oe=["/usr/local/bin/reason-srt-exec","/usr/local/bin/ara-srt-exec"],se=65536,ae=21600000;function ie(o,n="/run/ara-srt"){try{if((process.getuid?.()??-1)!==0)return;j(n,{recursive:!0,mode:448});let t=N(n);if(!t.isDirectory()||t.uid!==0||(t.mode&63)!==0){o("srt_base_keyed_skipped",{reason:"socket_dir_unsafe"});return}z(`${n}/base-keyed`,`1
|
|
3
|
-
`,{mode:420}),o("srt_base_keyed",{})}catch{o("srt_base_keyed_skipped",{reason:"error"})}}function B(o,n){let t=(u)=>(n("srt_warm_skipped",{reason:u}),Promise.resolve());if(typeof o.srt_base_settings!=="string")return t("no_settings");let s=Buffer.from(o.srt_base_settings,"base64");if(s.length===0||s.length>se||s.toString("base64")!==o.srt_base_settings)return t("settings_invalid");let a;try{let u=N(U);if(!u.isDirectory()||u.uid!==0||(u.mode&18)!==0)return t("cgroup_unsafe");let f=oe.find((m)=>N(m,{throwIfNoEntry:!1})!==void 0);if(!f)return t("cgroup_or_exec_missing");a=f;for(let[m,S]of[[a,!1],["/usr/local/bin",!0]]){let _=N(m);if((S?!_.isDirectory():!_.isFile())||_.uid!==0||(_.mode&18)!==0)return t("srt_exec_unsafe")}}catch{return t("cgroup_or_exec_missing")}if((process.getuid?.()??-1)!==0)return t("not_root");let l=performance.now(),y=ne("sha256").update(s).digest("hex"),c=`${O}/srt-base-settings.json`;try{z(c,s,{mode:384,flag:"w"})}catch{return t("settings_write")}let v=ee("/bin/sh",["-c",`echo $$ > ${U}/cgroup.procs || exit 125; exec "$@"`,"vm-hands-srt",a,"--settings",c,"--idle-ms",String(ae),"--","/bin/true"],{cwd:"/",env:{PATH:"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"},stdio:"ignore"});return new Promise((u)=>{v.once("error",()=>{n("srt_warm_failed",{reason:"spawn"}),u()}),v.once("close",(f)=>{n(f===0?"srt_warm_done":"srt_warm_failed",{exit_code:f,warm_ms:Math.round(performance.now()-l),settings_sha256:y}),u()})})}var Y=3000;function Re(o){if(!o||typeof o!=="object"||Array.isArray(o))return null;let n=o,{layout:t,device_key:s,credential:a}=n;return typeof n.workspace_id==="string"&&Number.isSafeInteger(n.instance_generation)&&typeof n.api_origin==="string"&&re.test(n.api_origin)&&typeof n.manifest_digest==="string"&&!!a&&typeof a.key_id==="string"&&Number.isSafeInteger(a.expires_at_ms)&&typeof a.signature==="string"&&!!t&&typeof t.session_root==="string"&&typeof t.alias==="string"&&Number.isSafeInteger(t.payload_uid)&&typeof t.kind==="string"&&!!s&&typeof s.pkcs8==="string"&&typeof s.spki==="string"?n:null}function D(o){j(o,{recursive:!0,mode:448});let n=te(o);if(!n.isDirectory()||(n.mode&63)!==0||n.uid!==(process.getuid?.()??-1))throw Error(`vm_hands_runtime_directory_unsafe: ${o}`)}async function ce(o){let[{CLI_VERSION:n},t,s,a]=await Promise.all([import("./version-7q2ft41r.js"),import("./hands-worker-source-8pe7yv0m.js"),import("./network-contract-nkwcf4r9.js"),import("./device-workspace-4bj43nxq.js")]),{REASON_HANDS_PROTOCOL_VERSION:l}=await import("./reason-hands-protocol-pck5har9.js");return{reason_runtime_version:n,bridge_version:n,protocol_version:er,execution_eligible:!0,instance_generation:o.instance_generation,capabilities:{supported_operations:["hands.connect"],hands_worker_artifact_sha256:t.REASON_HANDS_WORKER_ARTIFACT_SHA256,hands_worker_entrypoint:t.REASON_HANDS_WORKER_ENTRYPOINT,hands_slots:1,max_payload_bytes:s.LOCAL_OPERATION_MAX_BYTES,max_result_bytes:s.LOCAL_OPERATION_MAX_BYTES,operation_constraints:{"hands.connect":{ready:!0,execution_mode:"host",transport:"wss_relay",worker:"ara_hands",slots:1,session_group:s.HANDS_SESSION_GROUP,worker_version:t.REASON_HANDS_WORKER_VERSION,protocol_version:l,worker_artifact_sha256:t.REASON_HANDS_WORKER_ARTIFACT_SHA256,worker_entrypoint:t.REASON_HANDS_WORKER_ENTRYPOINT,policy_mode:"full_access",policy_version:1,workspace_base:a.REASON_WORKSPACE_BASE,workspace_layout:a.SESSION_WORKSPACE_LAYOUT,browser_state:"optional_headless",desktop:!1,max_session_ms:43200000,environment_delivery:s.HANDS_ENVIRONMENT_DELIVERY,[s.HANDS_ENVIRONMENT_AT_CLAIM_KEY]:s.HANDS_ENVIRONMENT_AT_CLAIM,[s.HANDS_CLOUD_ACCESS_KEY]:s.HANDS_CLOUD_ACCESS,[s.HANDS_LARGE_ENVIRONMENT_KEY]:s.HANDS_LARGE_ENVIRONMENT,[s.HANDS_CONFINEMENT_KEY]:s.HANDS_CONFINEMENT,[s.HANDS_JOBS_USER_KEY]:s.HANDS_JOBS_USER,vm_hands:"v1"}}}}}var I=["fs.read","fs.write","fs.export","fs.import","exec.run","exec.full","process.list","ports.list","pty.start","jobs.control"],X=["automation.call.v1","display.stream.v1","preview.serve.v1","tunnel.open","tunnel.close"],de=new Set(["pty.start","jobs.control","tunnel.open","tunnel.close"]),ue=60000,le=30000;function J(o,n){return{executionMode:"unsandboxed",runtimeDirectory:n,readiness:{...Object.fromEntries(I.map((t)=>[t,!0])),...o.lanes},...o.probing?{probing:X.filter((t)=>o.lanes[t]!==!0)}:{},...o.displayVideo?{displayVideo:!0}:{}}}function _e(o,n,t){let s=n([{id:"vm-hands",label:"workspace",path:V,pathFingerprint:"0".repeat(64),permissions:{read:!0,write:!0,execute:!0,discover_environment:!0,expose_mcp:!1}}],{worker:J(t,A)}),a=o.capabilities,l={...a.operation_constraints};for(let c of I)l[c]={...s.operation_constraints?.[c]??{},ready:!0,execution_mode:s.operation_constraints?.[c]?.execution_mode??"host"};let y=X.filter((c)=>s.operation_constraints?.[c]!==void 0);for(let c of y)l[c]=s.operation_constraints[c];return{...o,capabilities:{...a,supported_operations:["hands.connect",...I,...y],operation_constraints:l}}}function pe(o){for(let n of G("/etc/passwd","utf8").split(`
|
|
4
|
-
`)){let t=n.split(":");if(t.length>=4&&Number(t[2])===o&&/^\d+$/.test(t[3]??"")&&Number(t[3])>0)return Number(t[3])}throw Error("vm_hands_payload_account_unavailable")}function fe(o,n){let t=n.owner;if(!t||typeof t.organization_id!=="string"||typeof t.device_id!=="string"||typeof n.root_id!=="string")return null;return{version:4,apiOrigin:o.api_origin,orgId:t.organization_id,deviceId:t.device_id,devicePublicKey:"",displayName:"vm-hands",registeredAt:new Date(0).toISOString(),handsSlots:1,roots:[{id:n.root_id,label:"workspace",path:V,pathFingerprint:"0".repeat(64),permissions:{read:!0,write:!0,execute:!0,discover_environment:!0,expose_mcp:!1}}]}}function we(o=process.platform,n="/proc/self/oom_score_adj"){if(o!=="linux")return null;let t;try{t=G(n,"utf8").trim()}catch{return{value:"unreadable"}}if(!/^-?\d+$/.test(t))return{value:"unreadable"};let s=Number(t);return s<0?{value:s}:null}async function ke(o,n){let t=we();if(t)n("vm_hands.oom_protected",{code:"vm_hands_oom_protected",value:t.value}),await new Promise(()=>{setInterval(()=>{return},1073741824)});D(O),D(W),D(A),ie(n);let s=B(o,n),a=!1,l=async()=>{if(!await Promise.race([s.then(()=>!0),new Promise((r)=>setTimeout(()=>r(!1),Y).unref?.())]))a=!0,n("srt_warm_late",{wait_ms:Y})},[{configureDesktopAccount:y},{configureWorkerSandbox:c}]=await Promise.all([import("./desktop-account-xma0330a.js"),import("./worker-sandbox-6kkhvryn.js")]);c();try{y({value:String(o.layout.payload_uid)})}catch{n("payload_account_unavailable"),await new Promise(()=>{setInterval(()=>{return},1073741824)})}let v=new AbortController;for(let e of["SIGTERM","SIGINT"])process.on(e,()=>v.abort());let u=new Map,f,m=new Promise((e)=>{f=e}),S=m.then(()=>import("./vm-hands-executor-r6v6tzqj.js")).then(({createVmHandsExecutor:e})=>{let r=e({init:o,root:V,runtimeDirectory:O,apiOrigin:o.api_origin,prespawn:!0,onSrtReset:()=>{a=!1,s=B(o,n)},srtWarmLate:()=>a,forward:(d,i,E)=>u.get(d)?.(i,E)??Promise.reject(Error("vm_hands_not_bound")),log:(d,i)=>n(d,i)});return n("executor_loaded"),r}),_=(e)=>async(...r)=>(await S)[e](...r),x=null;S.then((e)=>{x=(r)=>e.executorExited(r)});let g={startExecutor:async(...e)=>(await l(),_("startExecutor")(...e)),killAndVerifyPayload:_("killAndVerifyPayload"),killProbe:_("killProbe"),runProbe:async(...e)=>(await l(),_("runProbe")(...e)),restatLayout:(e)=>{throw Error("replaced below")},verifyMounts:(e)=>{throw Error("replaced below")},installEnvironment:()=>{throw Error("replaced below")},executorExited:(e)=>x?x(e):new Promise(()=>{}),takeSrtFallbacks:()=>null};S.then((e)=>{g.restatLayout=(r)=>e.restatLayout(r),g.verifyMounts=(r)=>e.verifyMounts(r),g.installEnvironment=(r,d)=>e.installEnvironment(r,d),g.freezeBind=(r)=>e.freezeBind(r),g.abortExecutor=(r)=>e.abortExecutor(r),g.takeSrtFallbacks=()=>e.takeSrtFallbacks?.()??null});let q=await Ra(o),C=new ao(o,q,g,{envRoot:W}),M=ce(o),w={probing:!0,lanes:{},displayVideo:!1},L=null,K=null,Q=Promise.all([M,import("./local-capabilities-h1hxzrhn.js")]).then(([e,r])=>{K=()=>_e(e,r.capabilityInventoryForRoots,w),n("device_ops_loaded")}).catch((e)=>n("device_ops_unavailable",{error:e instanceof Error?e.name:"error"})),H,R=(e)=>{clearTimeout(H),w=e,L?.()},b=m.then(()=>import("./vm-hands-executor-r6v6tzqj.js")).then(({createVmHandsOpRunners:e,vmHandsBindCgroup:r,VM_HANDS_PAYLOAD_CGROUP:d})=>e({payloadUid:o.layout.payload_uid,payloadGid:pe(o.layout.payload_uid),bindCgroup:(i)=>r(d,i),surfaceDirectory:A,onSurfaceReadiness:(i)=>{if(i)R({probing:!1,lanes:i.lanes??{},displayVideo:i.display_video===!0});else if(w.probing)R({probing:!1,lanes:{},displayVideo:!1})},log:(i,E)=>n(i,E)})).catch(()=>null);b.then((e)=>e?.warm("person")),b.then(async(e)=>{if(!e){R({probing:!1,lanes:{},displayVideo:!1});return}let r=Date.now()+le;while(C.settingUp&&Date.now()<r)await new Promise((d)=>setTimeout(d,250));H=setTimeout(()=>{if(w.probing)R({probing:!1,lanes:{},displayVideo:!1})},ue),H.unref?.(),e.warm("surface")}),n("agent_ready"),await Ta({apiOrigin:o.api_origin,agent:C,signal:v.signal,heartbeat:async()=>K?.()??await M,onHeartbeatNow:(e)=>{L=e},executeOp:async({kind:e,claim:r,bindId:d,signal:i,emit:E})=>{let k=fe(o,r);if(!k)return{status:"failed",error_code:"vm_hands_bind_invalid"};let F={executionMode:"unsandboxed",runtimeDirectory:O,readiness:{...Object.fromEntries(I.map((p)=>[p,!0])),"tunnel.open":w.lanes["tunnel.open"]===!0,"tunnel.close":w.lanes["tunnel.close"]===!0}},T=(p)=>{let h=typeof p.kind==="string"?p.kind:"";if(h)E({kind:h,...p.data&&typeof p.data==="object"?{data:p.data}:{}})};if(r.capability==="exec.full"&&e!=="person")return{status:"failed",error_code:"capability_not_granted"};if(r.capability==="automation.call.v1"&&e!=="model")return{status:"failed",error_code:"capability_not_granted"};let Z=r.capability==="pty.start"&&e==="person"&&!r.authority;if(de.has(String(r.capability))&&!Z||r.capability==="ports.list"){let{executeLocalOperation:p}=await import("./local-capabilities-h1hxzrhn.js");return p(k,r,{worker:F,signal:i,emit:(h)=>T(h)})}let P=await b;if(!P)return{status:"failed",error_code:"vm_hands_payload_account_unavailable"};if(Gr.has(String(r.capability))){if(w.lanes[String(r.capability)]!==!0)return{status:"failed",error_code:"capability_unavailable"};return P.run("surface",{id:String(r.attempt_id),claim:r,state:k,worker:J(w,A)},T,i)}return P.run(e,{id:String(r.attempt_id),claim:r,state:k,worker:F},T,i,d)},controlOp:async({claim:e,control:r})=>Gr.has(String(e.capability))&&((await b)?.notify("surface",{t:"control",id:String(e.attempt_id),control:{kind:r.kind,payload:r.payload??{}}})??!1),opCompleted:({claim:e,status:r,acknowledged:d})=>{if(d&&e.capability==="preview.serve.v1")b.then((i)=>i?.notify("surface",{t:"retire",operation_id:String(e.operation_id),status:r}))},readyData:({launchId:e})=>({executor_launch_id:e}),log:(e,r)=>{if(e==="vm_hands.registered"||e==="vm_hands.reconnected")f();n(e,r)},onTurn:(e,r)=>{if(r)u.set(e,r);else u.delete(e)}}),await(await S).stop(),(await b)?.stop()}export{Re as parseVmHandsInit,ke as runVmHands};
|