@reason-machines/cli-linux-x64 0.2.407 → 0.2.410
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/THIRD_PARTY_NOTICES.txt +8 -7
- package/bin/reason +2 -2
- package/bin/runtime/srt/sandbox-runtime.mjs +52 -52
- package/bin/vm-hands/api-cjv8m2zy.js +2 -0
- package/bin/vm-hands/api-credentials-m5akr9fv.js +2 -0
- package/bin/vm-hands/connect-cli-nydbj6ae.js +2 -0
- package/bin/vm-hands/custom-endpoint-device-dkqb4rqy.js +2 -0
- package/bin/vm-hands/desktop-account-5v7x0ajx.js +2 -0
- package/bin/vm-hands/device-workspace-p9q9dckg.js +2 -0
- package/bin/vm-hands/fsevents-ekt70rcc.js +2 -0
- package/bin/vm-hands/hands-worker-source-cgrpm21b.js +2 -0
- package/bin/vm-hands/index-k8kcz8a3.js +12818 -0
- package/bin/vm-hands/install-receipt-7vt2y2vh.js +2 -0
- package/bin/vm-hands/local-automation-y9kx76wa.js +2 -0
- package/bin/vm-hands/local-capabilities-j6h63m79.js +2 -0
- package/bin/vm-hands/local-desktop-users-q886k0mm.js +2 -0
- package/bin/vm-hands/local-display-mac-w85956f1.js +2 -0
- package/bin/vm-hands/local-display-session-ftt74eb3.js +2 -0
- package/bin/vm-hands/local-pty-session-5f50sqq0.js +2 -0
- package/bin/vm-hands/managed-runtime-tjwpypgf.js +2 -0
- package/bin/vm-hands/network-contract-9x9kc5vv.js +2 -0
- package/bin/vm-hands/package-78fkast4.js +2 -0
- package/bin/vm-hands/permissions-byngw8v0.js +2 -0
- package/bin/vm-hands/reason-hands-protocol-2tnghj3b.js +2 -0
- package/bin/vm-hands/serve-service-j5wnq4bg.js +2 -0
- package/bin/vm-hands/status-8tjada6n.js +10 -0
- package/bin/vm-hands/version-5hrs2hvb.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-05rrh8yg.js +250 -0
- package/bin/vm-hands/vm-hands-entry-lite-09m2cdkw.js +4 -0
- package/bin/vm-hands/vm-hands-entry-lite-0g9xvgdy.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-0xrsph3r.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-10sbjfzx.js +9 -0
- package/bin/vm-hands/vm-hands-entry-lite-1cwqa4jr.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-1rrb66r9.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-1rtkf2xm.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-1sg8sdw5.js +5 -0
- package/bin/vm-hands/vm-hands-entry-lite-22kfyvnk.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-46fkv5sp.js +105 -0
- package/bin/vm-hands/vm-hands-entry-lite-66ctbcym.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-6aeea05q.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-70ba2bqj.js +458 -0
- package/bin/vm-hands/{vm-hands-entry-lite-vr4sva78.js → vm-hands-entry-lite-80y72d0e.js} +5 -9
- package/bin/vm-hands/vm-hands-entry-lite-88swf2qr.js +6 -0
- package/bin/vm-hands/vm-hands-entry-lite-89z488gz.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-8ns59paz.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-8t9xssf9.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-907pa7f9.js +65 -0
- package/bin/vm-hands/vm-hands-entry-lite-9ay6f56v.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-jcd21jpm.js → vm-hands-entry-lite-9c95p6n9.js} +54 -54
- package/bin/vm-hands/vm-hands-entry-lite-ab2m9erf.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-b885gwfh.js +7 -0
- package/bin/vm-hands/{vm-hands-entry-lite-xqve205b.js → vm-hands-entry-lite-bdhjpv7g.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-bk6akkdt.js +540 -0
- package/bin/vm-hands/vm-hands-entry-lite-ckv17tn8.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-eqgj4acy.js +112 -0
- package/bin/vm-hands/vm-hands-entry-lite-f5e3dbgk.js +4 -0
- package/bin/vm-hands/vm-hands-entry-lite-grm1tqs7.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-gvwdy3rf.js +4 -0
- package/bin/vm-hands/vm-hands-entry-lite-hj8n59y9.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-k278g9kj.js +42 -0
- package/bin/vm-hands/{vm-hands-entry-lite-wer0qzxg.js → vm-hands-entry-lite-m11j0f9q.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-pgb514h0.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-pmcz7j7t.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-q0k6kx6d.js +5 -0
- package/bin/vm-hands/vm-hands-entry-lite-qy9xg6em.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-qysyf65v.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-r29k28kb.js +14 -0
- package/bin/vm-hands/{vm-hands-entry-lite-fbpxs065.js → vm-hands-entry-lite-t7an5zg2.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-vrqzr15t.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-w59z67hf.js +52 -0
- package/bin/vm-hands/vm-hands-entry-lite-zg36myyf.js +5 -0
- package/bin/vm-hands/vm-hands-entry-lite.js +3 -1
- package/bin/vm-hands/vm-hands-executor-rdmj1wv4.js +11 -0
- package/bin/vm-hands/vm-hands-op-runner-f2bjvb7v.js +2 -0
- package/bin/vm-hands/vm-hands-runtime-aa4p4pqz.js +4 -0
- package/bin/vm-hands/worker-sandbox-smqj3mbe.js +2 -0
- package/package.json +1 -1
- package/bin/vm-hands/api-credentials-4e2gypqj.js +0 -2
- package/bin/vm-hands/api-f48wa4ym.js +0 -2
- package/bin/vm-hands/ask-relay-jatz6zdz.js +0 -8
- package/bin/vm-hands/connect-cli-7jc6q164.js +0 -2
- package/bin/vm-hands/custom-endpoint-device-8h95wy87.js +0 -2
- package/bin/vm-hands/desktop-account-2kkxwv1y.js +0 -2
- package/bin/vm-hands/device-workspace-nzz3kd5t.js +0 -2
- package/bin/vm-hands/hands-worker-source-as5wepvk.js +0 -2
- package/bin/vm-hands/index-2kk983b8.js +0 -12818
- package/bin/vm-hands/install-receipt-e6s355j1.js +0 -2
- package/bin/vm-hands/local-automation-c7sk21zn.js +0 -2
- package/bin/vm-hands/local-capabilities-dgaqqaw9.js +0 -2
- package/bin/vm-hands/local-desktop-users-sevkfkye.js +0 -2
- package/bin/vm-hands/local-display-mac-jzc0g5ge.js +0 -2
- package/bin/vm-hands/local-display-session-gcndscvj.js +0 -2
- package/bin/vm-hands/local-pty-session-fe6jz2zy.js +0 -2
- package/bin/vm-hands/managed-runtime-pveke48y.js +0 -2
- package/bin/vm-hands/network-contract-9smga6kn.js +0 -2
- package/bin/vm-hands/package-qjr5q0bp.js +0 -2
- package/bin/vm-hands/permissions-92a6yh7t.js +0 -2
- package/bin/vm-hands/reason-hands-protocol-5fhd49en.js +0 -2
- package/bin/vm-hands/serve-service-rjbca0dj.js +0 -2
- package/bin/vm-hands/status-1tqes7gw.js +0 -96
- package/bin/vm-hands/version-8qryvrwt.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-05qq23fw.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-1sc3wc94.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-2nec0vk1.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-2s9the7x.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-32ch1nr1.js +0 -346
- package/bin/vm-hands/vm-hands-entry-lite-40nkzw38.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-4bgxq9ps.js +0 -9
- package/bin/vm-hands/vm-hands-entry-lite-5rkakg10.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-69ray4x8.js +0 -6
- package/bin/vm-hands/vm-hands-entry-lite-6berk108.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-72nn2b4n.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-7k3vp3fe.js +0 -52
- package/bin/vm-hands/vm-hands-entry-lite-8f3px72v.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-8gjrr6hg.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-8tcnbfnm.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-9vf97byd.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-er3nrbb9.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-f6714myc.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-g5c9ec33.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-h0y0xv5f.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-h9t84ekh.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-hd4a0a6f.js +0 -112
- package/bin/vm-hands/vm-hands-entry-lite-hepppjp0.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-hye6r7dy.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-jw5y1aa5.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-ky0w7t09.js +0 -42
- package/bin/vm-hands/vm-hands-entry-lite-mapxp682.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-mxdztdmq.js +0 -11
- package/bin/vm-hands/vm-hands-entry-lite-np1fcr2t.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-nqvb7a2m.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-q4tcfj61.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-q590arx5.js +0 -251
- package/bin/vm-hands/vm-hands-entry-lite-r2xmr627.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-r6f6qkw6.js +0 -105
- package/bin/vm-hands/vm-hands-entry-lite-swwb5mp2.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-tkb2b6x8.js +0 -540
- package/bin/vm-hands/vm-hands-entry-lite-va3vbvsk.js +0 -458
- package/bin/vm-hands/vm-hands-entry-lite-vr38bh6k.js +0 -66
- package/bin/vm-hands/vm-hands-entry-lite-wa261sf8.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-yg5h9mhm.js +0 -7
- package/bin/vm-hands/vm-hands-entry-lite-yqrmr2c8.js +0 -5
- package/bin/vm-hands/vm-hands-executor-etthkykm.js +0 -11
- package/bin/vm-hands/vm-hands-op-runner-bbp6fzn2.js +0 -2
- package/bin/vm-hands/vm-hands-runtime-2x1ryrxr.js +0 -4
- package/bin/vm-hands/worker-sandbox-p242st5d.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Hr,qr,zr,Wt}from"./vm-hands-entry-lite-8t9xssf9.js";import{qi,zi,k,kr,Cr,wn,tt,bn,Ar,je,ye,vn,Ue,te,He,we,Lt,Pr,Tr,En}from"./vm-hands-entry-lite-22kfyvnk.js";import{Zt}from"./vm-hands-entry-lite-m11j0f9q.js";import{Dt}from"./vm-hands-entry-lite-bdhjpv7g.js";import{Se}from"./vm-hands-entry-lite-pgb514h0.js";var r=["cgroup_membership_read_failed","cgroup_v2_membership_absent","cgroup_scope_invalid","cgroup_root_unavailable","cgroup_directory_unavailable","cgroup_limit_read_failed","cgroup_events_read_failed","cgroup_current_read_failed","cgroup_stat_read_failed","boot_id_read_failed","boot_id_invalid","guest_meminfo_read_failed","guest_vmstat_read_failed","memory_counter_invalid","memory_field_missing","memory_capacity_invalid"];var o=String.raw`(function(fs, path) {
|
|
3
3
|
const fail = (message, reasonCode) => { throw Object.assign(Error(message), {reasonCode}); };
|
|
4
4
|
const read = (p, reasonCode, trim=true) => { try { const text=fs.readFileSync(p, "utf8"); return trim?text.trim():text; }
|
|
5
5
|
catch { fail("memory_read", reasonCode); } };
|
|
@@ -64,7 +64,7 @@ import{ch as H}from"./vm-hands-entry-lite-xqve205b.js";import{Bh as _,Eh as S,eh
|
|
|
64
64
|
if(!Number.isSafeInteger(limitBytes)||limitBytes<=0||!Number.isSafeInteger(available)||available>limitBytes) fail("memory_capacity", "memory_capacity_invalid");
|
|
65
65
|
return {bootId,oomKills:field(read("/proc/vmstat", "guest_vmstat_read_failed"),"oom_kill"),currentBytes:limitBytes-available,
|
|
66
66
|
limitBytes,inactiveFileBytes:0,capacitySource:"guest",memoryScope:"/proc"};
|
|
67
|
-
})`;var
|
|
67
|
+
})`;var i=String.raw`import os,sys,json,stat,fcntl,time,ctypes
|
|
68
68
|
v=json.load(sys.stdin)
|
|
69
69
|
root=v['root']; paths=list(dict.fromkeys([v['source'],v['snapshot']]))
|
|
70
70
|
marker=('# reason-job-env-owner:'+v['runId']+'\n').encode()
|
|
@@ -309,7 +309,7 @@ function fileOperation(request) {
|
|
|
309
309
|
});
|
|
310
310
|
return { promise, cancel() {} };
|
|
311
311
|
}
|
|
312
|
-
`;var
|
|
312
|
+
`;var s="a3e39eb55160acfc116fa9871ccc594c68be7a642d2331b24baa707c8f601ec0";import{createHash as I}from"crypto";var H=Object.freeze({"api.ara.so":"api.reasonmachines.com","api.reasonmachines.ai":"api.reasonmachines.com","api-staging.ara.so":"staging-api.reasonmachines.com","staging-api.reasonmachines.ai":"staging-api.reasonmachines.com"});var a=Object.freeze({trailingSlashPattern:/\/+$/.source,keyPrefix:"http.",keySuffix:"/.extraheader",valuePrefix:"Authorization: Bearer "});var c=Object.freeze({tokenEnv:"ARA_GIT_BROKER_TOKEN",reasonTokenEnv:"REASON_GIT_BROKER_TOKEN",urlEnv:"ARA_GIT_BROKER_URL",keyPrefix:"credential.",keySuffix:"/.helper",value:'!f(){ printf "username=%s\\npassword=%s\\n" "ara-run" "${REASON_GIT_BROKER_TOKEN:-$ARA_GIT_BROKER_TOKEN}"; };f'});var St=/^[A-Za-z_][A-Za-z0-9_]*$/;var h=new Set(["ARA_INFERENCE_TOKEN","AI_GATEWAY_API_KEY","CLOUD_AGENT_AI_GATEWAY_API_KEY","INFERENCE_V2_GATEWAY_API_KEY","VERCEL_AI_GATEWAY_API_KEY","INFERENCE_V2_CONCENTRATE_API_KEY","INFERENCE_V2_OPENAI_API_KEY","INFERENCE_V2_ANTHROPIC_API_KEY","INFERENCE_V2_FINGERPRINT_SECRET","OPENAI_API_KEY","OPENROUTER_API_KEY","ANTHROPIC_API_KEY","CODEX_ACCESS_TOKEN","GITHUB_COPILOT_API_KEY","AZURE_OPENAI_API_KEY","AZURE_OPENAI_CLIENT_SECRET"]),m=new Set(["ARA_OPERATOR_KEY","BL_API_KEY","BLAXEL_API_KEY","NSC_TOKEN","NSC_TOKEN_FILE","NAMESPACE_API_KEY","NAMESPACE_ACCESS_TOKEN","NAMESPACE_TOKEN","NAMESPACE_TOKEN_JSON","NAMESPACE_SANDBOX_TOKEN_JSON","ARA_LOCAL_QA_NAMESPACE_WORKLOAD_TOKEN_FILE","NAMESPACE_SANDBOX_USE_LOCAL_USER_TOKEN","COMPUTE_SERVICE_TOKEN"]),g=["INFISICAL_","NSC_"],_=new Set(["ARA_JOB_ENV","ARA_DELIVERY_BASE_SHA","WORK_ROOT","REPO_DIR","ARA_CONTROL_DIR","ARA_PRESERVE_WORKSPACE","ARA_PINNED_CHECKOUT_REUSE","FOLLOWUP_BRANCH","REPO_URL","TOKENLESS_URL","REPOSITORY_IDENTITY_URL","DEFAULT_BRANCH","BRANCH","BRANCH_GENERATED","BASE_REF","REPO_EMPTY","REPO_WRITABLE","ARA_DELIVERY_BASE_BRANCH","ARA_SERVER_GIT_PUBLICATION","ARA_EMPTY_REPOSITORY_COMMIT","REASON_MODEL","REASON_DELIVERY_BASE_BRANCH","REASON_DELIVERY_BASE_SHA","REASON_EMPTY_REPOSITORY_COMMIT","REASON_SCRATCH_SESSION_ID","REASON_SERVER_GIT_PUBLICATION","REASON_ALLOW_INSTALL_SCRIPTS","SCM_TOKEN","SCM_TOKEN_USER","REASON_OIDC_TOKEN_URL","REASON_OIDC_REQUEST_TOKEN","AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE","BASH_ENV","ENV","BASHOPTS","SHELLOPTS","PS4","IFS","CDPATH","GLOBIGNORE","PROMPT_COMMAND","PATH","HOME","TMPDIR","TMP","TEMP","XDG_CONFIG_HOME","GIT_DIR","GIT_WORK_TREE","GIT_INDEX_FILE","GIT_OBJECT_DIRECTORY","GIT_COMMON_DIR","GIT_NAMESPACE","GIT_CEILING_DIRECTORIES","GIT_DISCOVERY_ACROSS_FILESYSTEM","GIT_SHALLOW_FILE","GIT_ALLOW_PROTOCOL","GIT_PROTOCOL_FROM_USER","GIT_REPLACE_REF_BASE","NODE_OPTIONS","NODE_PATH","NODE_REPL_EXTERNAL_MODULES","CLASSPATH","PYTHONPATH","PYTHONSTARTUP","PYTHONHOME","RUBYOPT","RUBYLIB","PERL5LIB","PERL5OPT","JAVA_TOOL_OPTIONS","_JAVA_OPTIONS","JDK_JAVA_OPTIONS","GEM_PATH","GEM_HOME","GIT_SSH","GIT_SSH_COMMAND","GIT_EXEC_PATH","GIT_TEMPLATE_DIR","GIT_ALTERNATE_OBJECT_DIRECTORIES","GIT_PROXY_COMMAND","GIT_EXTERNAL_DIFF","GIT_PAGER","GIT_EDITOR","GIT_ASKPASS","SSH_ASKPASS","PAGER","EDITOR","TAR_OPTIONS","CURL_HOME","WGETRC","APT_CONFIG","PERLLIB","GIT_GRAFT_FILE","POSIXLY_CORRECT"]),y=["GIT_TRACE","CONTEXT_REPO_","ARA_CHECKPOINT_BOOTSTRAP_","_","ARA_HANDS_","ARA_DEVICE_","ARA_GIT_BROKER_","REASON_HANDS_","REASON_DEVICE_","REASON_GIT_BROKER_","LD_","DYLD_","GIT_CONFIG","BASH_FUNC_"];var t="^(?!(?:"+[...h,...m,..._].join("|")+")$)(?!(?:"+[...g,...y].join("|")+"))"+St.source.slice(1),V=new RegExp(t);var v=["HOME","PWD","OLDPWD","TMPDIR","TMP","TEMP","SHELL","USER","LOGNAME","SCM_TOKEN","SCM_TOKEN_USER","GH_TOKEN","GITHUB_TOKEN","GH_ENTERPRISE_TOKEN","GITHUB_ENTERPRISE_TOKEN","GITLAB_TOKEN"],b=["ARA_HANDS_","ARA_DEVICE_","ARA_GIT_BROKER_","REASON_HANDS_","REASON_DEVICE_","REASON_GIT_BROKER_","BUN_"],E="^(?!(?:"+v.join("|")+")$)(?!(?:"+b.join("|")+"))"+t.slice(1),w="ARA_DELIVERY_BASE_SHA|WORK_ROOT|FOLLOWUP_BRANCH|ARA_PRESERVE_WORKSPACE|ARA_PINNED_CHECKOUT_REUSE|CONTEXT_REPO_[A-Z0-9_]+|REPO_URL|TOKENLESS_URL|REPOSITORY_IDENTITY_URL|DEFAULT_BRANCH|BRANCH|BRANCH_GENERATED|BASE_REF|REPO_EMPTY|REPO_WRITABLE|ARA_DELIVERY_BASE_BRANCH|ARA_SERVER_GIT_PUBLICATION|ARA_EMPTY_REPOSITORY_COMMIT|REASON_MODEL|REASON_DELIVERY_BASE_BRANCH|REASON_DELIVERY_BASE_SHA|REASON_EMPTY_REPOSITORY_COMMIT|REASON_SCRATCH_SESSION_ID|REASON_SERVER_GIT_PUBLICATION|REASON_ALLOW_INSTALL_SCRIPTS",n="^(?:"+w+"|"+E.slice(1,-1)+")$",R=new RegExp(n);function pr(u){return R.test(u)}var Xe=Object.freeze({tokenPath:"/identity/token",awsPath:"/identity/aws",tokenPattern:/^[A-Za-z0-9_.~-]+$/.source}),W=Object.freeze({variables:256,valueBytes:130816,snapshotBytes:1048576}),Z=Object.freeze({valueChars:16384,snapshotBytes:65536});var l=["set -g history-limit 50000","set -g status off","set -g window-size smallest","set -gq fill-character ' '","set -g escape-time 10","set -g prefix None","set -g prefix2 None","set -g terminal-overrides ',*:smcup@:rmcup@'"];var D=2,O="ara-hands-worker.cjs",d=["/usr/local/go/bin","/opt/node/bin","/usr/local/bin","/usr/sbin","/usr/bin","/sbin","/bin","/usr/local/cargo/bin"],A=d.join(":"),T=["/opt/homebrew/bin",...d].join(":"),P='(platform, linuxPath, macosPath) => platform === "darwin" ? macosPath : linuxPath';var N=String.raw`(function(anchor, pid, native) {
|
|
313
313
|
const token = native.identity(pid);
|
|
314
314
|
const session = native.session(pid);
|
|
315
315
|
if (!native.same(anchor)) throw new Error("pty_session_identity_lost");
|
|
@@ -317,7 +317,7 @@ function fileOperation(request) {
|
|
|
317
317
|
if (session.id !== anchor[5]) throw new Error("pty_member_session_changed");
|
|
318
318
|
if (!token) return { retry: true, token: null };
|
|
319
319
|
return { retry: false, token };
|
|
320
|
-
})`,
|
|
320
|
+
})`,C=String.raw`(function(native) {
|
|
321
321
|
let probe;
|
|
322
322
|
try {
|
|
323
323
|
try {
|
|
@@ -327,7 +327,7 @@ function fileOperation(request) {
|
|
|
327
327
|
native.signal(probe);
|
|
328
328
|
} finally { if (probe) native.release(probe); }
|
|
329
329
|
} catch (error) { native.close(); throw error; }
|
|
330
|
-
})`,
|
|
330
|
+
})`,x=String.raw`(function(bootstrap) {
|
|
331
331
|
const { dlopen, ptr } = require("bun:ffi");
|
|
332
332
|
const api = dlopen("libc.so.6", {
|
|
333
333
|
prctl: { args: ["i32", "u64", "u64", "u64", "u64"], returns: "i32" },
|
|
@@ -348,7 +348,7 @@ function fileOperation(request) {
|
|
|
348
348
|
require("node:fs").writeSync(3, "subreaper\n");
|
|
349
349
|
api.execve(ptr(args[0]), ptr(argv), ptr(envp));
|
|
350
350
|
throw new Error("pty_exec_failed");
|
|
351
|
-
})`,
|
|
351
|
+
})`,To=String.raw`
|
|
352
352
|
"use strict";
|
|
353
353
|
const crypto = require("node:crypto");
|
|
354
354
|
const fs = require("node:fs");
|
|
@@ -356,46 +356,46 @@ const net = require("node:net");
|
|
|
356
356
|
const path = require("node:path");
|
|
357
357
|
const { spawn, spawnSync } = require("node:child_process");
|
|
358
358
|
const { StringDecoder } = require("node:string_decoder");
|
|
359
|
-
const GIT_BROKER_HTTP_HEADER_POLICY = ${JSON.stringify(
|
|
360
|
-
const GIT_BROKER_CREDENTIAL_HELPER_POLICY = ${JSON.stringify(
|
|
361
|
-
const DEVICE_ENVIRONMENT_NAME_RE = new RegExp(${JSON.stringify(
|
|
362
|
-
const DEVICE_CLOUD_ACCESS_POLICY = ${JSON.stringify(
|
|
363
|
-
const DEVICE_ENVIRONMENT_LIMITS = ${JSON.stringify(
|
|
359
|
+
const GIT_BROKER_HTTP_HEADER_POLICY = ${JSON.stringify(a)};
|
|
360
|
+
const GIT_BROKER_CREDENTIAL_HELPER_POLICY = ${JSON.stringify(c)};
|
|
361
|
+
const DEVICE_ENVIRONMENT_NAME_RE = new RegExp(${JSON.stringify(n)});
|
|
362
|
+
const DEVICE_CLOUD_ACCESS_POLICY = ${JSON.stringify(Xe)};
|
|
363
|
+
const DEVICE_ENVIRONMENT_LIMITS = ${JSON.stringify(W)};
|
|
364
364
|
|
|
365
|
-
const VERSION = ${
|
|
366
|
-
const WORKER_VERSION = ${
|
|
367
|
-
const WORKER_ENTRYPOINT = ${JSON.stringify(
|
|
368
|
-
const GUEST_MEMORY_UNAVAILABLE_REASONS = ${JSON.stringify(
|
|
369
|
-
const sampleGuestMemory = ${
|
|
370
|
-
const inspectMacPtyMember = ${
|
|
371
|
-
const probeLinuxPtyLibrary = ${
|
|
372
|
-
const windowsPtyApi = ${
|
|
373
|
-
const LINUX_PTY_EXEC_SOURCE = ${JSON.stringify(
|
|
374
|
-
const CLOSE_CODES = ${JSON.stringify(
|
|
365
|
+
const VERSION = ${k};
|
|
366
|
+
const WORKER_VERSION = ${D};
|
|
367
|
+
const WORKER_ENTRYPOINT = ${JSON.stringify(O)};
|
|
368
|
+
const GUEST_MEMORY_UNAVAILABLE_REASONS = ${JSON.stringify(r)};
|
|
369
|
+
const sampleGuestMemory = ${o};
|
|
370
|
+
const inspectMacPtyMember = ${N};
|
|
371
|
+
const probeLinuxPtyLibrary = ${C};
|
|
372
|
+
const windowsPtyApi = ${Dt};
|
|
373
|
+
const LINUX_PTY_EXEC_SOURCE = ${JSON.stringify(x)};
|
|
374
|
+
const CLOSE_CODES = ${JSON.stringify(Tr)};
|
|
375
375
|
const SHA256_RE = /^[0-9a-f]{64}$/;
|
|
376
|
-
const MAX_FRAME_BYTES = ${
|
|
377
|
-
const MAX_INPUT_CHARS = ${
|
|
378
|
-
const MAX_STRUCTURED_INPUT_CHARS = ${
|
|
379
|
-
const MAX_OUTPUT_CHARS = ${
|
|
380
|
-
const WORKSPACE_BEFORE_MAX_OUTPUT_CHARS = ${
|
|
381
|
-
const MAX_ERROR_CHARS = ${
|
|
376
|
+
const MAX_FRAME_BYTES = ${kr};
|
|
377
|
+
const MAX_INPUT_CHARS = ${Cr};
|
|
378
|
+
const MAX_STRUCTURED_INPUT_CHARS = ${wn};
|
|
379
|
+
const MAX_OUTPUT_CHARS = ${tt};
|
|
380
|
+
const WORKSPACE_BEFORE_MAX_OUTPUT_CHARS = ${En};
|
|
381
|
+
const MAX_ERROR_CHARS = ${bn};
|
|
382
382
|
const MAX_LEDGER_IDS = 16384;
|
|
383
383
|
const MAX_CACHED_RESULTS = 256;
|
|
384
|
-
const MAX_JOB_INPUT_CHARS = ${
|
|
385
|
-
const MAX_JOB_OUTPUT_CHARS = ${
|
|
386
|
-
const MAX_JOB_OUTPUT_CHUNKS = ${
|
|
387
|
-
const MAX_JOBS = ${
|
|
384
|
+
const MAX_JOB_INPUT_CHARS = ${Ar};
|
|
385
|
+
const MAX_JOB_OUTPUT_CHARS = ${je};
|
|
386
|
+
const MAX_JOB_OUTPUT_CHUNKS = ${ye};
|
|
387
|
+
const MAX_JOBS = ${vn};
|
|
388
388
|
const MAX_JOB_RECORD_BYTES = 262144;
|
|
389
389
|
const MAX_JOB_JOURNAL_BYTES = MAX_JOBS * MAX_JOB_RECORD_BYTES;
|
|
390
|
-
const MAX_JOB_CONTROL_FRAME_BYTES = ${
|
|
391
|
-
const MAX_PTY_INPUT_BYTES = ${
|
|
392
|
-
const MAX_PTY_OUTPUT_BYTES = ${
|
|
393
|
-
const MAX_PTY_DIMENSION = ${
|
|
390
|
+
const MAX_JOB_CONTROL_FRAME_BYTES = ${Ue};
|
|
391
|
+
const MAX_PTY_INPUT_BYTES = ${te};
|
|
392
|
+
const MAX_PTY_OUTPUT_BYTES = ${He};
|
|
393
|
+
const MAX_PTY_DIMENSION = ${we};
|
|
394
394
|
const ID_RE = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,199}$/;
|
|
395
395
|
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
396
396
|
const WINDOWS = process.platform === "win32";
|
|
397
397
|
// Each Bash leader's tree on Windows, children that outlive it included (shared/windows-job-object.ts).
|
|
398
|
-
const windowsJobs = WINDOWS ? ${
|
|
398
|
+
const windowsJobs = WINDOWS ? ${Zt}(require) : null;
|
|
399
399
|
/** Windows has no POSIX owner or mode bits: the user's own profile folders are
|
|
400
400
|
* private by their ACLs, and the worker runs as that ordinary user. */
|
|
401
401
|
function ownedPrivately(stat, mask = 0o077) {
|
|
@@ -492,9 +492,9 @@ function jobsUserPrefix(model) {
|
|
|
492
492
|
return user ? ["/usr/bin/setpriv", "--reuid=" + user.uid, "--regid=" + gid, "--clear-groups", "--no-new-privs", "--",
|
|
493
493
|
"/usr/bin/env", "HOME=" + user.home, "USER=" + user.username, "LOGNAME=" + user.username] : [];
|
|
494
494
|
}
|
|
495
|
-
const FIXED_CLOUD_CHILD_PATH = ${JSON.stringify(
|
|
496
|
-
const FIXED_MACOS_CLOUD_CHILD_PATH = ${JSON.stringify(
|
|
497
|
-
const selectCloudChildPath = ${
|
|
495
|
+
const FIXED_CLOUD_CHILD_PATH = ${JSON.stringify(A)};
|
|
496
|
+
const FIXED_MACOS_CLOUD_CHILD_PATH = ${JSON.stringify(T)};
|
|
497
|
+
const selectCloudChildPath = ${P};
|
|
498
498
|
const config = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
|
|
499
499
|
const FIXED_BASH = WINDOWS ? config.bashExecutable : "/bin/bash";
|
|
500
500
|
const allowedTools = config.allowedTools === undefined
|
|
@@ -577,12 +577,12 @@ function validJobEnvSourcePath() {
|
|
|
577
577
|
if (config.jobEnvSourcePath === undefined || config.jobEnvSourcePath === path.join(config.workRoot, "job.env")) return true;
|
|
578
578
|
// A cloud workspace's job.env is in its Session's root-only control
|
|
579
579
|
// directory (shared/device-workspace.ts), derived from the root alone.
|
|
580
|
-
const cloud = new RegExp(${JSON.stringify(
|
|
580
|
+
const cloud = new RegExp(${JSON.stringify(Wt.source)}).exec(config.workRoot);
|
|
581
581
|
if (process.platform === "linux" && cloud) {
|
|
582
582
|
const workspaceId = cloud[3];
|
|
583
|
-
const owner = (new RegExp(${JSON.stringify(
|
|
584
|
-
?? (new RegExp(${JSON.stringify(
|
|
585
|
-
return config.jobEnvSourcePath === ${JSON.stringify(
|
|
583
|
+
const owner = (new RegExp(${JSON.stringify(qr.source)}).exec(workspaceId) || [])[1]
|
|
584
|
+
?? (new RegExp(${JSON.stringify(zr.source)}).exec(workspaceId) || [])[1] ?? workspaceId;
|
|
585
|
+
return config.jobEnvSourcePath === ${JSON.stringify(Hr)} + "/" + owner + "/job.env";
|
|
586
586
|
}
|
|
587
587
|
// Personal Cloud controls are root-owned and outside the writable grant.
|
|
588
588
|
// Admit only the same canonical session, never a caller-selected private path.
|
|
@@ -1027,7 +1027,7 @@ function initializeJobs() {
|
|
|
1027
1027
|
// (shared/local-protected-paths.ts) that the file tools and every confinement
|
|
1028
1028
|
// refuse. A home-folder worker keeps it in ~/.config/reason, so its Session may
|
|
1029
1029
|
// work in the home folder itself, as a Mac's home grant does.
|
|
1030
|
-
const PROTECTED_STATE_DIRECTORIES = ${JSON.stringify(
|
|
1030
|
+
const PROTECTED_STATE_DIRECTORIES = ${JSON.stringify(Se)};
|
|
1031
1031
|
function stateOverlapsWorkspace(state, root) {
|
|
1032
1032
|
if (pathWithin(root, state)) return true;
|
|
1033
1033
|
if (!pathWithin(state, root)) return false;
|
|
@@ -1372,7 +1372,7 @@ async function handleTerminalCleanup(target, claim, raw) {
|
|
|
1372
1372
|
let child, timer, killTimer;
|
|
1373
1373
|
const finish = ok => { clearTimeout(timer); clearTimeout(killTimer); if (!ok) cleanupUnconfirmed = true; resolve(ok); };
|
|
1374
1374
|
try {
|
|
1375
|
-
child = spawn("/usr/bin/python3", ["-I", "-c", ${JSON.stringify(
|
|
1375
|
+
child = spawn("/usr/bin/python3", ["-I", "-c", ${JSON.stringify(i)}],
|
|
1376
1376
|
{ stdio: ["pipe", "ignore", "ignore"], env: { PATH: "/usr/bin:/bin" }, detached: true });
|
|
1377
1377
|
let timedOut = false;
|
|
1378
1378
|
timer = setTimeout(() => { timedOut = true; try { process.kill(-child.pid, "SIGTERM"); } catch { cleanupUnconfirmed = true; }
|
|
@@ -2347,7 +2347,7 @@ function windowsPtyOperation(request, managed) {
|
|
|
2347
2347
|
try {
|
|
2348
2348
|
if (pty.activeProcesses() > 0) pty.terminate();
|
|
2349
2349
|
for (const startedAt = Date.now(); pty.activeProcesses() > 0;) {
|
|
2350
|
-
if (Date.now() - startedAt > ${
|
|
2350
|
+
if (Date.now() - startedAt > ${Lt}) throw new Error("pty_cleanup_timeout");
|
|
2351
2351
|
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
2352
2352
|
}
|
|
2353
2353
|
pty.close();
|
|
@@ -2651,7 +2651,7 @@ function linuxPtyOwner() {
|
|
|
2651
2651
|
// user detaches from the shell (nohup, setsid, disown, or jobs left at exit)
|
|
2652
2652
|
// are not swept. At most TERMINAL_HOST_LIMIT shells per scope.
|
|
2653
2653
|
const TERMINAL_SHELL = "/bin/bash --noprofile --norc -i";
|
|
2654
|
-
const TERMINAL_TMUX_CONFIG = ${JSON.stringify([...
|
|
2654
|
+
const TERMINAL_TMUX_CONFIG = ${JSON.stringify([...l,"new-session -d -s main /bin/bash --noprofile --norc -i","set -g exit-empty on","run-shell -b -d 43200 -C kill-server",""].join(`
|
|
2655
2655
|
`))};
|
|
2656
2656
|
const TERMINAL_HOST_LIMIT = 4;
|
|
2657
2657
|
const terminalViewers = new Map();
|
|
@@ -2795,7 +2795,7 @@ function ptyOperation(request, managed, program = TERMINAL_SHELL) {
|
|
|
2795
2795
|
const { members, empty } = native.session(anchor, device);
|
|
2796
2796
|
try {
|
|
2797
2797
|
if (empty && exitCode !== null && subreaper) break;
|
|
2798
|
-
if (Date.now() - startedAt > ${
|
|
2798
|
+
if (Date.now() - startedAt > ${Lt}) throw new Error("pty_cleanup_timeout");
|
|
2799
2799
|
for (const token of members) {
|
|
2800
2800
|
if (!native.same(anchor)) throw new Error("pty_session_identity_lost");
|
|
2801
2801
|
const id = native.identityKey(token);
|
|
@@ -2811,7 +2811,7 @@ function ptyOperation(request, managed, program = TERMINAL_SHELL) {
|
|
|
2811
2811
|
controlReleased = true;
|
|
2812
2812
|
let exitTimer;
|
|
2813
2813
|
try { await Promise.race([child.exited, new Promise((_, reject) => {
|
|
2814
|
-
exitTimer = setTimeout(() => reject(new Error("pty_anchor_exit_unconfirmed")), ${
|
|
2814
|
+
exitTimer = setTimeout(() => reject(new Error("pty_anchor_exit_unconfirmed")), ${Pr});
|
|
2815
2815
|
})]); } finally { clearTimeout(exitTimer); }
|
|
2816
2816
|
if (timedOut) finish("timeout", 124);
|
|
2817
2817
|
else if (cancelled) finish("cancelled", 130);
|
|
@@ -3329,7 +3329,7 @@ function replOperation(request) {
|
|
|
3329
3329
|
// timeout and the lease, and background processes retained until the worker
|
|
3330
3330
|
// stops. One departure from stock: a command idle on a watcher's banner is
|
|
3331
3331
|
// stopped (PI_WATCH_BANNER). PI_* variables are not set here.
|
|
3332
|
-
const PI_TOOLS_SHA256 = "${
|
|
3332
|
+
const PI_TOOLS_SHA256 = "${s}";
|
|
3333
3333
|
const piToolsSource = typeof araHandsPiToolsSource === "function" ? araHandsPiToolsSource : null;
|
|
3334
3334
|
let piTools = null;
|
|
3335
3335
|
function loadPiTools() {
|
|
@@ -3362,10 +3362,10 @@ const PI_EXIT_STDIO_GRACE_MS = 100;
|
|
|
3362
3362
|
// the token once under quoteDepth layers of single quoting, so the confined
|
|
3363
3363
|
// script is byte-identical to what the Brain's confineBashPayload gives the
|
|
3364
3364
|
// bash tool: srt/bwrap, the payload uid, the network allowlist and allowWrite.
|
|
3365
|
-
const PI_TOOL_CONFINEMENT_TOKEN = "${
|
|
3365
|
+
const PI_TOOL_CONFINEMENT_TOKEN = "${qi}";
|
|
3366
3366
|
function validPiToolConfinement(value) {
|
|
3367
3367
|
return hasOnlyKeys(value, ["template", "quoteDepth"]) && typeof value.template === "string"
|
|
3368
|
-
&& value.template.length <= ${
|
|
3368
|
+
&& value.template.length <= ${zi} && !value.template.includes("\0")
|
|
3369
3369
|
&& value.template.split(PI_TOOL_CONFINEMENT_TOKEN).length === 2 && [1, 2, 3].includes(value.quoteDepth);
|
|
3370
3370
|
}
|
|
3371
3371
|
// The script T when this command is exactly this policy's confineBashPayload(T)
|
|
@@ -4176,5 +4176,5 @@ void startJobControl().then(() => {
|
|
|
4176
4176
|
try { loadJobs(); prepareRequestJournal(); } catch { process.exit(44); }
|
|
4177
4177
|
if (validPrivateJob) markReady(); else connect();
|
|
4178
4178
|
}, () => process.exit(45));
|
|
4179
|
-
`.trimStart()
|
|
4180
|
-
export{
|
|
4179
|
+
`.trimStart();var S=I("sha256").update(To,"utf8").digest("hex");
|
|
4180
|
+
export{St,pr,Xe,W,D,O,To,S};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{t,o,i,Q,oe,s,n}from"./vm-hands-entry-lite-907pa7f9.js";var Ye=32768,xt=67108864,gr=16384,E=204800,dn=600000,_=["content-type","anthropic-version","user-agent"],m=s(["openai-completions","openai-responses","anthropic-messages"]),f=new Set(_),C=oe(t(),t().max(2048)).refine((e)=>Object.keys(e).every((r)=>f.has(r))&&Object.values(e).every((r)=>!/[\r\n\0]/.test(r)),"Only non-secret custom endpoint request headers are permitted");function u(e){try{let r=new URL(e);return["http:","https:"].includes(r.protocol)&&!r.username&&!r.password&&!r.search&&!r.hash?r:null}catch{return null}}function _r(e,r){let c=u(e.baseUrl),l=u(r.baseUrl),a=u(e.url);if(!c||!l||!a||e.method!=="POST"||r.execution!=="device")return!1;let d=(p)=>p.origin+p.pathname.replace(/\/+$/,"");if(d(c)!==d(l)||a.origin!==c.origin)return!1;let h=r.api==="openai-completions"?"/chat/completions":r.api==="openai-responses"?"/responses":"/v1/messages";return a.pathname===c.pathname.replace(/\/+$/,"")+h}var pn=i({baseUrl:t().max(2048),url:t().max(4096),method:n("POST"),body:t().refine((e)=>new TextEncoder().encode(e).byteLength<=E).optional(),headers:C,credentialOrganizationId:t().uuid(),accountKey:t().min(1).max(256).optional()}).strict().refine((e)=>m.options.some((r)=>_r(e,{baseUrl:e.baseUrl,api:r,execution:"device"})),"Invalid custom endpoint inference URL"),x=i({status:o().int().min(200).max(599),statusText:t().max(256).refine((e)=>!/[\r\n\0]/.test(e)),headers:oe(t(),t().max(4096)).refine((e)=>Object.keys(e).every((r)=>["content-type","retry-after","x-request-id","request-id"].includes(r))&&Object.values(e).every((r)=>!/[\r\n\0]/.test(r)))}).strict(),D=Q([i({eof:n(!0)}).strict(),i({eof:n(!1),data:t().max(Math.ceil(Ye/3)*4).regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/).refine((e)=>e.length>0&&e.length*3/4-(e.endsWith("==")?2:e.endsWith("=")?1:0)<=Ye)}).strict()]),y=i({bytes:o().int().min(0).max(xt),chunks:o().int().min(0).max(gr)}).strict(),hn=i({apiKey:t().min(1).max(16384).refine((e)=>!/[\r\n\0]/.test(e)),api:m}).strict(),S=["custom_endpoint_host_not_found","custom_endpoint_connection_failed","custom_endpoint_tls_failed"];function fn(e){return typeof e==="string"&&S.includes(e)}var g="Ollama listens only on 127.0.0.1 unless it is started with OLLAMA_HOST=0.0.0.0.",T={custom_endpoint_host_not_found:"Your computer couldn't resolve your model server's hostname. Check the hostname in the Base URL, and that this computer is on the network or tailnet that resolves it.",custom_endpoint_connection_failed:`Your computer's connection to your model server was refused or timed out. Check that the server is running and listening on the Base URL's address and port. ${g}`,custom_endpoint_tls_failed:"Your computer couldn't make a secure (TLS) connection to your model server. Check the server's https certificate, or use an http:// Base URL for a server on your computer or private network.",401:"Your model server refused the request (HTTP 401). Check the API key saved for it in Models.",403:"Your model server refused the request (HTTP 403). Ollama refuses requests addressed to a hostname other than localhost, such as a *.ts.net name from tailscale serve or funnel: restart it with OLLAMA_HOST=0.0.0.0, or use http://localhost:11434/v1 when it runs on the session's computer. For another server, check the API key and its access rules.",404:"Your model server answered HTTP 404 (not found). Check that the Base URL is the API root (for Ollama, http://localhost:11434/v1) and that each model ID is one the server lists."};var I=new Set(Object.values(T));export{Ye,xt,gr,dn,_r,pn,hn,fn};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Et}from"./vm-hands-entry-lite-hj8n59y9.js";import{fe,se,x}from"./vm-hands-entry-lite-9ay6f56v.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{spawn as J,spawnSync as ee}from"child_process";import{existsSync as y,mkdtempSync as ne,readFileSync as K,readdirSync as te,realpathSync as re,rmSync as oe,statSync as G}from"fs";import{platform as T,tmpdir as ie}from"os";import{dirname as M,join as c,win32 as w}from"path";import{fileURLToPath as ae,pathToFileURL as W}from"url";var le=["bwrap","socat","rg"],de=2000;var ce=3,L=4000,ue=new Set([".git",".hg",".svn","node_modules"]),me=["runAsHostUid","sysrq-trigger"],X=c(M(M(ae(import.meta.url))),"packages","sandbox-runtime"),pe=c(X,"src","index.ts"),z=!1;function Ni(){z=!0}function j(){return z?c(M(re(process.execPath)),"runtime","srt"):void 0}function P(){let e=c(j()??X,"vendor","srt-win");return c(e,process.arch,"srt-win.exe")}async function Y(){let e=j();if(e&&process.platform==="linux"&&!y(c(e,"vendor","seccomp",process.arch,"apply-seccomp")))throw Error("packaged_sandbox_runtime_vendor_missing");if(e&&process.platform==="win32"&&!y(P()))throw Error("packaged_sandbox_runtime_vendor_missing");if(e){let i=K(c(e,"sandbox-runtime.mjs"),"utf8");for(let s of me)if(!i.includes(s))throw Error(`packaged_sandbox_runtime_fork_missing:${s}`)}let n=(await import(e?W(c(e,"sandbox-runtime.mjs")).href:W(pe).href)).SandboxManager;if(!n||typeof n.initialize!=="function"||typeof n.wrapWithSandboxArgv!=="function")throw Error("sandbox-runtime does not expose the expected SandboxManager API.");return{SandboxManager:n}}function ge(e={}){if((e.platformName??T())!=="linux")return!1;let o=e.fileExists??y,n=e.readFile??((i)=>K(i,"utf8"));for(let i of["/.dockerenv","/run/.containerenv"])try{if(o(i))return!0}catch{}try{return/docker|containerd|kubepods|lxc|libpod/.test(n("/proc/1/cgroup"))}catch{return!1}}function we(e){return["/bin/true","/usr/bin/true"].find((t)=>e(t))??null}function Se(e,t){return e==="strict"?["--ro-bind","/","/","--unshare-pid","--unshare-user","--cap-drop","ALL","--proc","/proc","--",t]:["--ro-bind","/","/","--unshare-pid","--unshare-user","--bind","/proc","/proc","--",t]}function be(e,t){try{let o=ee("bwrap",Se(e,t),{stdio:"ignore",timeout:de});return!o.error&&o.status===0}catch{return!1}}function xe(e){let t=e.platformName??T(),o=e.fileExists??y;if(t==="win32")return(e.bash??fe)()&&o(P())?m??"strict":null;if(t!=="linux")return null;let n=e.hasExecutable??Et;if(!le.every((l)=>n(l)))return null;let i=we(o);if(!i)return null;let s=m??(e.containerized??ge({platformName:t})?"weak":"strict");return(e.probeNamespaces??((l)=>be(l,i)))(s)?s:null}var S=null,C=!1,p=null,F=null;var m=null,E=null,A=null,R=null,v=[],g=new Map;function D(){throw b("sandbox_mode_conflict"),new r("sandbox_unavailable","Sandbox process policy conflicts with an existing probe or session. Restart the worker.")}function Li(e){if(m!==null&&m!==e||C&&S!==null&&S!==e||E!==null&&E!==e)D();m=e}function b(e){if(!p)process.stderr.write(`Reason worker: confined commands are off (${e})
|
|
3
|
+
`);p=e}function hr(e){if(p)return!1;if(!C){if(S=xe(e??{}),C=!0,S&&!e)Ce()}return S!==null}function he(){return hr()?S:null}var _=null,h=0;function I(e,t){if(p)throw new r("sandbox_unavailable","Confined execution is unavailable in this worker process.");if(m&&e.sandboxMode&&m!==e.sandboxMode)D();let o=m??e.sandboxMode??he();if(!o)throw new r("sandbox_unavailable","Confined command execution is unavailable on this operating system.");if(E&&E!==o)D();return E=o,_??=(async()=>{let{SandboxManager:n}=await(e.loadSandboxRuntime??Y)();return await n.initialize(Ne(o,t)),n})().catch((n)=>{if(_=null,t)A=null,process.stderr.write(`Reason worker: the Windows sandbox did not start for this folder (${String(n).slice(0,500)})
|
|
4
|
+
`);else b(`initialize_failed: ${String(n)}`);throw n instanceof r?n:new r("sandbox_unavailable","The confined execution sandbox failed to start.")}),_.then((n)=>{if(p)throw new r("sandbox_unavailable","Confined execution became unavailable during sandbox initialization.");return n})}function O(){if(h-=1,h===0)for(let e of v.splice(0))e()}async function ye(e,t=!0,o,n){let i=n===void 0?1/0:Date.now()+n;await Q();let s=_e();if(t)await s;let a=JSON.stringify(e),l=!1,u=()=>{if(!l)return;l=!1;let d=(g.get(a)??1)-1;if(d>0)g.set(a,d);else g.delete(a)};try{for(;;){if(o?.aborted)throw new r("cancelled","Operation was cancelled.");if(Date.now()>=i)return!1;if(R){await R;continue}let d=g.keys().next().value;if(A??=d??a,A===a&&(d===void 0||d===a))break;if(!l){l=!0,g.set(a,(g.get(a)??0)+1);continue}if(h===0&&d===a){Pe();continue}await new Promise((f)=>{if(v.push(f),o?.addEventListener("abort",()=>f(),{once:!0}),i!==1/0)setTimeout(f,Math.max(0,i-Date.now())).unref?.()})}return h+=1,!0}finally{if(l&&h===0)for(let d of v.splice(0))d();u()}}function Pe(){return R??=Me().finally(()=>{R=null}),R}function Ee(e,t,o=process.env){let n=o.USERPROFILE?w.resolve(o.USERPROFILE).toLowerCase():null,i=w.resolve(e).toLowerCase(),s=n!==null&&i.startsWith(`${n}\\`),a=t?q(o).filter((l)=>l.toLowerCase()===i||l.toLowerCase().startsWith(`${i}\\`)):[];return{denyRead:[],allowRead:[e],allowWrite:t?[e]:[],denyWrite:t?a:s?[]:[e]}}function q(e,t=process.execPath){let o=new Map;for(let n of[...(e.PATH??e.Path??"").split(";"),w.dirname(t)]){if(!n||!w.isAbsolute(n))continue;let i=w.resolve(n);if(!o.has(i.toLowerCase()))o.set(i.toLowerCase(),i)}return[...o.values()]}function Re(e=process.env,t=process.execPath){let o=[e.SystemRoot,e.ProgramFiles,e["ProgramFiles(x86)"],e.ProgramW6432,e.ProgramData,e.USERPROFILE].filter((n)=>!!n).map((n)=>w.resolve(n).toLowerCase());return q(e,t).filter((n)=>{let i=n.toLowerCase();return!o.some((s)=>i===s||i.startsWith(`${s}\\`))})}var U=null,H=null;function Q(e=P()){return H??=(async()=>{let t;try{t=JSON.parse((await V(e,["status"])).stdout).user?.user?.sid}catch{return null}if(typeof t!=="string"||!/^S-1-[0-9-]+$/.test(t))return null;if(!await new Promise((n)=>{let i=J(x("icacls"),[e,"/grant",`*${t}:(RX)`],{stdio:"ignore",windowsHide:!0,timeout:30000});i.on("error",()=>n(!1)),i.on("close",(s)=>n(s===0))}))process.stderr.write(`Reason worker: could not let the Windows sandbox user run srt-win.exe
|
|
5
|
+
`);return t})(),H}function V(e,t,o){return new Promise((n)=>{let i=J(e,t,{stdio:["pipe","pipe","ignore"],windowsHide:!0,timeout:120000}),s="";i.stdout?.setEncoding("utf8").on("data",(a)=>{s+=a}),i.on("error",()=>n({status:null,stdout:s})),i.on("close",(a)=>n({status:a,stdout:s})),i.stdin?.end(o??"")})}function _e(e=P()){return U??=(async()=>{let t=Re();if(t.length===0)return;let o=await Q(e),n=o?await V(e,["acl","stamp","--holder-pid",String(process.ppid),"--sandbox-user-sid",o],JSON.stringify({denyRead:[],denyWrite:t})):null;if(!n||n.status!==0&&n.status!==2)b(`program_folder_deny_failed: ${n?`exit ${n.status}`:"no sandbox user"}`),process.stderr.write(`Reason worker: could not deny the Windows sandbox writes to PATH folders (${n?`exit ${n.status}`:"no sandbox user"}); confined commands are off
|
|
6
|
+
`)})(),U}var Ae=`h=$(mktemp -d) || exit 125; trap 'rm -rf "$h"' EXIT; mkdir -p "$h/AppData/Roaming" "$h/AppData/Local"; w=$(cygpath -w "$h"); export HOME="$h" USERPROFILE="$w" APPDATA="$w\\AppData\\Roaming" LOCALAPPDATA="$w\\AppData\\Local" TEMP="$w" TMP="$w"; `;async function Me(){let e=_;if(_=null,A=null,!e)return;try{await(await e).reset()}catch{}}async function Ce(e={}){if(p)return!1;if(e.loadSandboxRuntime)return B(e.loadSandboxRuntime);if(!hr())return!1;return F??=B(Y),F}async function B(e){try{let{SandboxManager:t}=await e();if(process.platform==="win32"){if(!y(P()))b("dependencies_missing: srt-win.exe");return!p}let o=t.checkDependencies().errors;if(o.length>0)return b(`dependencies_missing: ${o.join(", ")}`),!1;return!p}catch(t){return b(`load_failed: ${String(t)}`),!1}}function cn(e=y,t=T()){if(t==="win32")return se("win32");return["/bin/bash","/bin/sh"].find((o)=>e(o))??"/bin/sh"}function ve(e){return e.map((t)=>`'${t.replaceAll("'","'\\''")}'`).join(" ")}function De(e,t,o=(n)=>te(n,{withFileTypes:!0}).filter((i)=>i.isDirectory()||i.isFile()).map((i)=>i.name)){let n=[],i=[{path:e,depth:0}],s=0;while(i.length>0&&s<L){let a=i.pop(),l;try{l=o(a.path)}catch{continue}for(let u of l){if(s+=1,s>L)break;let d=c(a.path,u);if(t(d)){n.push(d);continue}if(a.depth+1<ce&&!ue.has(u))i.push({path:d,depth:a.depth+1})}}return n}function Te(e){let t=c(e.root,".git"),o=[];try{if(G(t).isDirectory())o=[c(t,"config"),c(t,"hooks")]}catch{}return{denyRead:["/home","/root","/tmp","/tmp/.X11-unix",...e.protectedPaths],allowRead:[e.root,e.temporaryDirectory],allowWrite:[...e.allowWrite?[e.root]:[],e.temporaryDirectory],denyWrite:[...e.protectedPaths,...o]}}function ke(e,t){let o=c(t,".git"),n=[];try{if(G(o).isDirectory())n=[c(o,"config"),c(o,"hooks")]}catch{}return{denyRead:[...e],allowRead:[],allowWrite:[],denyWrite:[...e,...n]}}function Ne(e,t){if(t)return{network:{allowedDomains:[],deniedDomains:[]},filesystem:t,windows:{srtWin:{path:P()}}};return{network:{allowedDomains:[],deniedDomains:[]},filesystem:{denyRead:[],allowRead:[],allowWrite:[],denyWrite:[]},...e==="weak"?{enableWeakerNestedSandbox:!0}:{}}}function Mi(e){let t=e.createTemporaryDirectory??(()=>ne(c(ie(),"reason-device-"))),o=e.removeTemporaryDirectory??((n)=>oe(n,{recursive:!0,force:!0}));return async(n,i,s)=>{let a=process.platform==="win32",l;if(a){let d=Ee(s.root,s.allowWrite);if(!await ye(d,!s.workerProbe,s.signal,s.timeoutMs))return{exitCode:null,signal:null,stdout:"",stderr:"",timedOut:!0,truncated:!1};try{l=await I(e,d)}catch(f){throw O(),f}}else l=await I(e),h+=1;let u;try{u=t();let d=De(s.root,e.isProtectedPath),f;try{f=await l.wrapWithSandboxArgv((a?Ae:"")+ve([n,...i]),e.shell??cn(),{filesystem:a?ke(d,s.root):Te({root:s.root,allowWrite:s.allowWrite,temporaryDirectory:u,protectedPaths:d})},s.signal,s.cwd)}catch(N){throw N instanceof r?N:new r("sandbox_unavailable","The confined execution sandbox could not wrap the command.")}let[k,...Z]=f.argv;if(!k)throw new r("sandbox_unavailable","The confined execution sandbox produced no command.");return await e.spawnCaptured(k,Z,{cwd:s.cwd,timeoutMs:s.timeoutMs,signal:s.signal,env:a?f.env:e.scrubEnvironment(s.root,u)})}finally{O();try{l.cleanupAfterCommand()}catch{}if(u!==void 0)o(u)}}}
|
|
7
|
+
export{Ni,Li,hr,cn,Mi};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
2
|
+
var Dt=String.raw`(function(loadFfi, existsSync) {
|
|
3
3
|
const STARTF_USESTDHANDLES = 0x100;
|
|
4
4
|
const CREATE_SUSPENDED = 0x4;
|
|
5
5
|
const CREATE_UNICODE_ENVIRONMENT = 0x400;
|
|
@@ -242,4 +242,4 @@ var e=String.raw`(function(loadFfi, existsSync) {
|
|
|
242
242
|
}
|
|
243
243
|
return { available, unavailableReason, defaultShell, shellArgs, quoteArg, environmentBlock, spawn };
|
|
244
244
|
})`;
|
|
245
|
-
export{
|
|
245
|
+
export{Dt};
|