@reason-machines/cli-linux-arm64 0.2.416 → 0.2.419

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.
Files changed (117) hide show
  1. package/bin/reason +1 -1
  2. package/bin/runtime/srt/sandbox-runtime.mjs +38 -38
  3. package/bin/vm-hands/api-18d75dfn.js +2 -0
  4. package/bin/vm-hands/api-credentials-3vhge1ap.js +2 -0
  5. package/bin/vm-hands/connect-cli-k7px2rdj.js +2 -0
  6. package/bin/vm-hands/custom-endpoint-device-17t4efc4.js +2 -0
  7. package/bin/vm-hands/desktop-account-6sjrxy69.js +2 -0
  8. package/bin/vm-hands/device-workspace-s50q53sz.js +2 -0
  9. package/bin/vm-hands/{fsevents-ekt70rcc.js → fsevents-p3d8kd0p.js} +1 -1
  10. package/bin/vm-hands/hands-worker-source-kddz4y15.js +2 -0
  11. package/bin/vm-hands/{index-k8kcz8a3.js → index-wrw65904.js} +35 -35
  12. package/bin/vm-hands/install-receipt-ysa70fvh.js +2 -0
  13. package/bin/vm-hands/local-automation-y36wa5fz.js +2 -0
  14. package/bin/vm-hands/local-capabilities-t6fwch4h.js +2 -0
  15. package/bin/vm-hands/local-desktop-users-cppjjr81.js +2 -0
  16. package/bin/vm-hands/local-display-mac-0qz3b627.js +2 -0
  17. package/bin/vm-hands/local-display-session-5cgt72jx.js +2 -0
  18. package/bin/vm-hands/local-display-video-3xk3kg9p.js +2 -0
  19. package/bin/vm-hands/local-managed-process-bnqnzd8d.js +2 -0
  20. package/bin/vm-hands/local-pty-session-rpk05ap5.js +2 -0
  21. package/bin/vm-hands/managed-runtime-wbsp37xw.js +2 -0
  22. package/bin/vm-hands/network-contract-trkxqc0w.js +2 -0
  23. package/bin/vm-hands/package-xqbhdf15.js +2 -0
  24. package/bin/vm-hands/permissions-vys6xvz7.js +2 -0
  25. package/bin/vm-hands/reason-hands-protocol-xn3ddz70.js +2 -0
  26. package/bin/vm-hands/serve-service-rcvza2vj.js +2 -0
  27. package/bin/vm-hands/status-5q2w623r.js +10 -0
  28. package/bin/vm-hands/version-qgew2890.js +2 -0
  29. package/bin/vm-hands/vm-hands-entry-lite-03gh7msy.js +52 -0
  30. package/bin/vm-hands/{vm-hands-entry-lite-enah5gv4.js → vm-hands-entry-lite-09sq8090.js} +2 -2
  31. package/bin/vm-hands/{vm-hands-entry-lite-bdhjpv7g.js → vm-hands-entry-lite-21qpxvt8.js} +2 -2
  32. package/bin/vm-hands/vm-hands-entry-lite-2nvhegyc.js +3 -0
  33. package/bin/vm-hands/vm-hands-entry-lite-34z9890s.js +452 -0
  34. package/bin/vm-hands/{vm-hands-entry-lite-8t9xssf9.js → vm-hands-entry-lite-3krzmhkk.js} +2 -2
  35. package/bin/vm-hands/{vm-hands-entry-lite-k278g9kj.js → vm-hands-entry-lite-4vks5phw.js} +5 -5
  36. package/bin/vm-hands/{vm-hands-entry-lite-1cwqa4jr.js → vm-hands-entry-lite-50zbqwkv.js} +2 -2
  37. package/bin/vm-hands/{vm-hands-entry-lite-1rrb66r9.js → vm-hands-entry-lite-5dtfehjv.js} +2 -2
  38. package/bin/vm-hands/{vm-hands-entry-lite-6aeea05q.js → vm-hands-entry-lite-60pg3wxj.js} +2 -2
  39. package/bin/vm-hands/{vm-hands-entry-lite-9ay6f56v.js → vm-hands-entry-lite-6c67a3jc.js} +2 -2
  40. package/bin/vm-hands/{vm-hands-entry-lite-zybbbegw.js → vm-hands-entry-lite-706c7f7x.js} +2 -2
  41. package/bin/vm-hands/vm-hands-entry-lite-8h2p4crd.js +539 -0
  42. package/bin/vm-hands/{vm-hands-entry-lite-zg36myyf.js → vm-hands-entry-lite-8r31b0ps.js} +4 -4
  43. package/bin/vm-hands/{vm-hands-entry-lite-ckv17tn8.js → vm-hands-entry-lite-aj139v8j.js} +2 -2
  44. package/bin/vm-hands/{vm-hands-entry-lite-907pa7f9.js → vm-hands-entry-lite-avc65bd7.js} +6 -6
  45. package/bin/vm-hands/{vm-hands-entry-lite-9c95p6n9.js → vm-hands-entry-lite-beyyy1gz.js} +37 -37
  46. package/bin/vm-hands/{vm-hands-entry-lite-ab2m9erf.js → vm-hands-entry-lite-bx5zy5bd.js} +1 -1
  47. package/bin/vm-hands/{vm-hands-entry-lite-pgb514h0.js → vm-hands-entry-lite-dk79tnax.js} +2 -2
  48. package/bin/vm-hands/vm-hands-entry-lite-ec9jemny.js +5 -0
  49. package/bin/vm-hands/{vm-hands-entry-lite-dqd4p5kw.js → vm-hands-entry-lite-ehthgxsx.js} +16 -16
  50. package/bin/vm-hands/vm-hands-entry-lite-ewxc9m4d.js +128 -0
  51. package/bin/vm-hands/vm-hands-entry-lite-f1by8av5.js +2 -0
  52. package/bin/vm-hands/{vm-hands-entry-lite-gvwdy3rf.js → vm-hands-entry-lite-fbhqfzbq.js} +3 -3
  53. package/bin/vm-hands/{vm-hands-entry-lite-t7an5zg2.js → vm-hands-entry-lite-fcvf8md1.js} +2 -2
  54. package/bin/vm-hands/{vm-hands-entry-lite-qysyf65v.js → vm-hands-entry-lite-g4zd2d5n.js} +1 -1
  55. package/bin/vm-hands/{vm-hands-entry-lite-0xrsph3r.js → vm-hands-entry-lite-hbs3tpdg.js} +2 -2
  56. package/bin/vm-hands/{vm-hands-entry-lite-f5e3dbgk.js → vm-hands-entry-lite-hk6trmwa.js} +3 -3
  57. package/bin/vm-hands/{vm-hands-entry-lite-89z488gz.js → vm-hands-entry-lite-jev771b3.js} +2 -2
  58. package/bin/vm-hands/{vm-hands-entry-lite-eqgj4acy.js → vm-hands-entry-lite-jzz73e3f.js} +10 -10
  59. package/bin/vm-hands/{vm-hands-entry-lite-hj8n59y9.js → vm-hands-entry-lite-np07qyeq.js} +2 -2
  60. package/bin/vm-hands/{vm-hands-entry-lite-1rtkf2xm.js → vm-hands-entry-lite-nzmkyezg.js} +2 -2
  61. package/bin/vm-hands/{vm-hands-entry-lite-cs5t8eyd.js → vm-hands-entry-lite-p9v963ks.js} +5 -5
  62. package/bin/vm-hands/{vm-hands-entry-lite-qk4kexta.js → vm-hands-entry-lite-pcvgqrse.js} +5 -5
  63. package/bin/vm-hands/{vm-hands-entry-lite-q0k6kx6d.js → vm-hands-entry-lite-pf5qtbj5.js} +4 -4
  64. package/bin/vm-hands/{vm-hands-entry-lite-m11j0f9q.js → vm-hands-entry-lite-rfz60hb3.js} +2 -2
  65. package/bin/vm-hands/vm-hands-entry-lite-s4bharcb.js +9 -0
  66. package/bin/vm-hands/{vm-hands-entry-lite-88swf2qr.js → vm-hands-entry-lite-s5qkb1fk.js} +3 -3
  67. package/bin/vm-hands/{vm-hands-entry-lite-22kfyvnk.js → vm-hands-entry-lite-tdgtpx8e.js} +1 -1
  68. package/bin/vm-hands/{vm-hands-entry-lite-6sgfhegd.js → vm-hands-entry-lite-tfra9vjt.js} +4 -4
  69. package/bin/vm-hands/{vm-hands-entry-lite-b885gwfh.js → vm-hands-entry-lite-vpz54vwj.js} +6 -6
  70. package/bin/vm-hands/vm-hands-entry-lite-w8ykfw5h.js +126 -0
  71. package/bin/vm-hands/vm-hands-entry-lite-wmynasc4.js +4 -0
  72. package/bin/vm-hands/{vm-hands-entry-lite-09m2cdkw.js → vm-hands-entry-lite-wx4ax7wg.js} +3 -3
  73. package/bin/vm-hands/vm-hands-entry-lite-yretc2th.js +3 -0
  74. package/bin/vm-hands/vm-hands-entry-lite-z76nfb19.js +3 -0
  75. package/bin/vm-hands/vm-hands-entry-lite-zp6naptr.js +3 -0
  76. package/bin/vm-hands/vm-hands-entry-lite.js +2 -2
  77. package/bin/vm-hands/vm-hands-executor-6357p4cd.js +11 -0
  78. package/bin/vm-hands/vm-hands-op-runner-7tcv4e0v.js +2 -0
  79. package/bin/vm-hands/vm-hands-runtime-mc2e6wsv.js +4 -0
  80. package/bin/vm-hands/worker-preview-readiness-w62n91kr.js +2 -0
  81. package/bin/vm-hands/worker-sandbox-2r5nseff.js +2 -0
  82. package/package.json +1 -1
  83. package/bin/vm-hands/api-cjv8m2zy.js +0 -2
  84. package/bin/vm-hands/api-credentials-m5akr9fv.js +0 -2
  85. package/bin/vm-hands/connect-cli-pcfvh00f.js +0 -2
  86. package/bin/vm-hands/custom-endpoint-device-dkqb4rqy.js +0 -2
  87. package/bin/vm-hands/desktop-account-5v7x0ajx.js +0 -2
  88. package/bin/vm-hands/device-workspace-p9q9dckg.js +0 -2
  89. package/bin/vm-hands/hands-worker-source-cgrpm21b.js +0 -2
  90. package/bin/vm-hands/install-receipt-7vt2y2vh.js +0 -2
  91. package/bin/vm-hands/local-automation-zj5h05b9.js +0 -2
  92. package/bin/vm-hands/local-capabilities-gkdh1z5z.js +0 -2
  93. package/bin/vm-hands/local-desktop-users-q886k0mm.js +0 -2
  94. package/bin/vm-hands/local-display-mac-w85956f1.js +0 -2
  95. package/bin/vm-hands/local-display-session-m6an1hqp.js +0 -2
  96. package/bin/vm-hands/local-pty-session-5f50sqq0.js +0 -2
  97. package/bin/vm-hands/managed-runtime-esfmzn6z.js +0 -2
  98. package/bin/vm-hands/network-contract-9x9kc5vv.js +0 -2
  99. package/bin/vm-hands/package-78fkast4.js +0 -2
  100. package/bin/vm-hands/permissions-bvfecyb8.js +0 -2
  101. package/bin/vm-hands/reason-hands-protocol-2tnghj3b.js +0 -2
  102. package/bin/vm-hands/serve-service-mr4mkymv.js +0 -2
  103. package/bin/vm-hands/status-7m9d0yek.js +0 -10
  104. package/bin/vm-hands/version-4bsjs55h.js +0 -2
  105. package/bin/vm-hands/vm-hands-entry-lite-7n60veqy.js +0 -458
  106. package/bin/vm-hands/vm-hands-entry-lite-8ns59paz.js +0 -3
  107. package/bin/vm-hands/vm-hands-entry-lite-8vfd0kez.js +0 -250
  108. package/bin/vm-hands/vm-hands-entry-lite-pmcz7j7t.js +0 -3
  109. package/bin/vm-hands/vm-hands-entry-lite-sm5nkxpw.js +0 -540
  110. package/bin/vm-hands/vm-hands-entry-lite-t7n6t3j9.js +0 -2
  111. package/bin/vm-hands/vm-hands-entry-lite-vq14wv7h.js +0 -52
  112. package/bin/vm-hands/vm-hands-entry-lite-vrqzr15t.js +0 -3
  113. package/bin/vm-hands/vm-hands-entry-lite-zjn2nsth.js +0 -3
  114. package/bin/vm-hands/vm-hands-executor-a7aqej5n.js +0 -11
  115. package/bin/vm-hands/vm-hands-op-runner-k4n3zrqb.js +0 -2
  116. package/bin/vm-hands/vm-hands-runtime-z6ydmvqc.js +0 -4
  117. package/bin/vm-hands/worker-sandbox-smqj3mbe.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
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) {
2
+ import{Yr,Qr,en,nr}from"./vm-hands-entry-lite-3krzmhkk.js";import{uo,po,P,Mr,$r,Ln,ut,Mn,Br,Ke,ve,$n,Je,ne,Ze,Se,Vt,Fr,jr,Fn}from"./vm-hands-entry-lite-tdgtpx8e.js";import{sr}from"./vm-hands-entry-lite-rfz60hb3.js";import{qt}from"./vm-hands-entry-lite-21qpxvt8.js";import{ke}from"./vm-hands-entry-lite-dk79tnax.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); } };
@@ -309,7 +309,7 @@ function fileOperation(request) {
309
309
  });
310
310
  return { promise, cancel() {} };
311
311
  }
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) {
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 It=/^[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("|")+"))"+It.source.slice(1),W=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"],E=["ARA_HANDS_","ARA_DEVICE_","ARA_GIT_BROKER_","REASON_HANDS_","REASON_DEVICE_","REASON_GIT_BROKER_","BUN_"],S="^(?!(?:"+v.join("|")+")$)(?!(?:"+E.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+"|"+S.slice(1,-1)+")$",O=new RegExp(n);function Sr(u){return O.test(u)}var st=Object.freeze({tokenPath:"/identity/token",awsPath:"/identity/aws",tokenPattern:/^[A-Za-z0-9_.~-]+$/.source}),V=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,R="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(":"),k='(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");
@@ -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
- })`,To=String.raw`
351
+ })`,Zo=String.raw`
352
352
  "use strict";
353
353
  const crypto = require("node:crypto");
354
354
  const fs = require("node:fs");
@@ -359,43 +359,43 @@ const { StringDecoder } = require("node:string_decoder");
359
359
  const GIT_BROKER_HTTP_HEADER_POLICY = ${JSON.stringify(a)};
360
360
  const GIT_BROKER_CREDENTIAL_HELPER_POLICY = ${JSON.stringify(c)};
361
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)};
362
+ const DEVICE_CLOUD_ACCESS_POLICY = ${JSON.stringify(st)};
363
+ const DEVICE_ENVIRONMENT_LIMITS = ${JSON.stringify(V)};
364
364
 
365
- const VERSION = ${k};
365
+ const VERSION = ${P};
366
366
  const WORKER_VERSION = ${D};
367
- const WORKER_ENTRYPOINT = ${JSON.stringify(O)};
367
+ const WORKER_ENTRYPOINT = ${JSON.stringify(R)};
368
368
  const GUEST_MEMORY_UNAVAILABLE_REASONS = ${JSON.stringify(r)};
369
369
  const sampleGuestMemory = ${o};
370
370
  const inspectMacPtyMember = ${N};
371
371
  const probeLinuxPtyLibrary = ${C};
372
- const windowsPtyApi = ${Dt};
372
+ const windowsPtyApi = ${qt};
373
373
  const LINUX_PTY_EXEC_SOURCE = ${JSON.stringify(x)};
374
- const CLOSE_CODES = ${JSON.stringify(Tr)};
374
+ const CLOSE_CODES = ${JSON.stringify(jr)};
375
375
  const SHA256_RE = /^[0-9a-f]{64}$/;
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};
376
+ const MAX_FRAME_BYTES = ${Mr};
377
+ const MAX_INPUT_CHARS = ${$r};
378
+ const MAX_STRUCTURED_INPUT_CHARS = ${Ln};
379
+ const MAX_OUTPUT_CHARS = ${ut};
380
+ const WORKSPACE_BEFORE_MAX_OUTPUT_CHARS = ${Fn};
381
+ const MAX_ERROR_CHARS = ${Mn};
382
382
  const MAX_LEDGER_IDS = 16384;
383
383
  const MAX_CACHED_RESULTS = 256;
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};
384
+ const MAX_JOB_INPUT_CHARS = ${Br};
385
+ const MAX_JOB_OUTPUT_CHARS = ${Ke};
386
+ const MAX_JOB_OUTPUT_CHUNKS = ${ve};
387
+ const MAX_JOBS = ${$n};
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 = ${Ue};
391
- const MAX_PTY_INPUT_BYTES = ${te};
392
- const MAX_PTY_OUTPUT_BYTES = ${He};
393
- const MAX_PTY_DIMENSION = ${we};
390
+ const MAX_JOB_CONTROL_FRAME_BYTES = ${Je};
391
+ const MAX_PTY_INPUT_BYTES = ${ne};
392
+ const MAX_PTY_OUTPUT_BYTES = ${Ze};
393
+ const MAX_PTY_DIMENSION = ${Se};
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 ? ${Zt}(require) : null;
398
+ const windowsJobs = WINDOWS ? ${sr}(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) {
@@ -494,7 +494,7 @@ function jobsUserPrefix(model) {
494
494
  }
495
495
  const FIXED_CLOUD_CHILD_PATH = ${JSON.stringify(A)};
496
496
  const FIXED_MACOS_CLOUD_CHILD_PATH = ${JSON.stringify(T)};
497
- const selectCloudChildPath = ${P};
497
+ const selectCloudChildPath = ${k};
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(Wt.source)}).exec(config.workRoot);
580
+ const cloud = new RegExp(${JSON.stringify(nr.source)}).exec(config.workRoot);
581
581
  if (process.platform === "linux" && cloud) {
582
582
  const workspaceId = cloud[3];
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";
583
+ const owner = (new RegExp(${JSON.stringify(Qr.source)}).exec(workspaceId) || [])[1]
584
+ ?? (new RegExp(${JSON.stringify(en.source)}).exec(workspaceId) || [])[1] ?? workspaceId;
585
+ return config.jobEnvSourcePath === ${JSON.stringify(Yr)} + "/" + 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(Se)};
1030
+ const PROTECTED_STATE_DIRECTORIES = ${JSON.stringify(ke)};
1031
1031
  function stateOverlapsWorkspace(state, root) {
1032
1032
  if (pathWithin(root, state)) return true;
1033
1033
  if (!pathWithin(state, root)) return false;
@@ -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 > ${Lt}) throw new Error("pty_cleanup_timeout");
2350
+ if (Date.now() - startedAt > ${Vt}) throw new Error("pty_cleanup_timeout");
2351
2351
  await new Promise((resolve) => setTimeout(resolve, 20));
2352
2352
  }
2353
2353
  pty.close();
@@ -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 > ${Lt}) throw new Error("pty_cleanup_timeout");
2798
+ if (Date.now() - startedAt > ${Vt}) 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")), ${Pr});
2814
+ exitTimer = setTimeout(() => reject(new Error("pty_anchor_exit_unconfirmed")), ${Fr});
2815
2815
  })]); } finally { clearTimeout(exitTimer); }
2816
2816
  if (timedOut) finish("timeout", 124);
2817
2817
  else if (cancelled) finish("cancelled", 130);
@@ -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 = "${qi}";
3365
+ const PI_TOOL_CONFINEMENT_TOKEN = "${uo}";
3366
3366
  function validPiToolConfinement(value) {
3367
3367
  return hasOnlyKeys(value, ["template", "quoteDepth"]) && typeof value.template === "string"
3368
- && value.template.length <= ${zi} && !value.template.includes("\0")
3368
+ && value.template.length <= ${po} && !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();var S=I("sha256").update(To,"utf8").digest("hex");
4180
- export{St,pr,Xe,W,D,O,To,S};
4179
+ `.trimStart();var b=I("sha256").update(Zo,"utf8").digest("hex");
4180
+ export{It,Sr,st,V,D,R,Zo,b};
@@ -1,2 +1,2 @@
1
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};
2
+ import{t,o,i,W,ee,s,n}from"./vm-hands-entry-lite-avc65bd7.js";var ct=32768,Lt=67108864,Cr=16384,E=204800,Sn=600000,_=["content-type","anthropic-version","user-agent"],m=s(["openai-completions","openai-responses","anthropic-messages"]),f=new Set(_),C=ee(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 Ar(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 En=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)=>Ar(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:ee(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=W([i({eof:n(!0)}).strict(),i({eof:n(!1),data:t().max(Math.ceil(ct/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)<=ct)}).strict()]),y=i({bytes:o().int().min(0).max(Lt),chunks:o().int().min(0).max(Cr)}).strict(),xn=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 kn(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{ct,Lt,Cr,Sn,Ar,En,xn,kn};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{resolve as s,sep as i}from"path";var Se=[[".ssh"],[".gnupg"],[".aws"],[".azure"],[".kube"],[".docker"],[".infisical"],[".password-store"],[".terraform.d"],[".config","ara"],[".config","reason"],[".config","gh"],[".config","gcloud"],[".config","infisical"],[".config","op"],[".config","1password"],[".config","pass"],[".local","share","keyrings"],["library","keychains"],["library","application support","so.ara.desktop"],["appdata","roaming","github cli"],["appdata","roaming","gcloud"],["appdata","roaming","microsoft","credentials"],["appdata","local","microsoft","credentials"],["appdata","roaming","microsoft","protect"],["appdata","roaming","1password"],["appdata","local","1password"],["appdata","roaming","microsoft","windows","start menu","programs","startup"],["documents","windowspowershell"],["documents","powershell"],["appdata","local","reason"]],Bt=[[".codex","config.toml"],[".cursor","mcp.json"],[".claude","settings.json"],[".claude","settings.local.json"],[".cargo","credentials"],[".cargo","credentials.toml"],[".gem","credentials"],[".config","git","config"],[".config","git","credentials"],[".config","pip","pip.conf"]],Ft=new Set([".bash_login",".bash_profile",".bashrc",".bunfig.toml",".claude.json",".env",".envrc",".git-credentials",".gitconfig",".mcp.json",".netrc",".npmrc",".profile",".pypirc",".terraformrc",".yarnrc",".yarnrc.yml",".zlogin",".zlogout",".zprofile",".zshenv",".zshrc","auth.json","credentials.json","credentials.tfrc.json","local-daemon.json","local-device.json","mcp.json"]),jt=[".key",".p12",".pfx",".pem"];function t(n,a){if(n.length<a.length)return!1;for(let r=0;r<=n.length-a.length;r+=1)if(a.every((o,e)=>n[r+e]===o))return!0;return!1}function E(n){let a=s(n).split(i).filter(Boolean).map((o)=>o.toLowerCase());if(Se.some((o)=>t(a,o)))return!0;if(Bt.some((o)=>t(a,o)))return!0;let r=a.at(-1)??"";return Ft.has(r)||r.startsWith(".env.")||jt.some((o)=>r.endsWith(o))}
3
- export{Se,Bt,Ft,jt,E};
2
+ import{resolve as s,sep as i}from"path";var ke=[[".ssh"],[".gnupg"],[".aws"],[".azure"],[".kube"],[".docker"],[".infisical"],[".password-store"],[".terraform.d"],[".config","ara"],[".config","reason"],[".config","gh"],[".config","gcloud"],[".config","infisical"],[".config","op"],[".config","1password"],[".config","pass"],[".local","share","keyrings"],["library","keychains"],["library","application support","so.ara.desktop"],["appdata","roaming","github cli"],["appdata","roaming","gcloud"],["appdata","roaming","microsoft","credentials"],["appdata","local","microsoft","credentials"],["appdata","roaming","microsoft","protect"],["appdata","roaming","1password"],["appdata","local","1password"],["appdata","roaming","microsoft","windows","start menu","programs","startup"],["documents","windowspowershell"],["documents","powershell"],["appdata","local","reason"]],Zt=[[".codex","config.toml"],[".cursor","mcp.json"],[".claude","settings.json"],[".claude","settings.local.json"],[".cargo","credentials"],[".cargo","credentials.toml"],[".gem","credentials"],[".config","git","config"],[".config","git","credentials"],[".config","pip","pip.conf"]],Xt=new Set([".bash_login",".bash_profile",".bashrc",".bunfig.toml",".claude.json",".env",".envrc",".git-credentials",".gitconfig",".mcp.json",".netrc",".npmrc",".profile",".pypirc",".terraformrc",".yarnrc",".yarnrc.yml",".zlogin",".zlogout",".zprofile",".zshenv",".zshrc","auth.json","credentials.json","credentials.tfrc.json","local-daemon.json","local-device.json","mcp.json"]),Yt=[".key",".p12",".pfx",".pem"];function t(n,a){if(n.length<a.length)return!1;for(let r=0;r<=n.length-a.length;r+=1)if(a.every((o,e)=>n[r+e]===o))return!0;return!1}function E(n){let a=s(n).split(i).filter(Boolean).map((o)=>o.toLowerCase());if(ke.some((o)=>t(a,o)))return!0;if(Zt.some((o)=>t(a,o)))return!0;let r=a.at(-1)??"";return Xt.has(r)||r.startsWith(".env.")||Yt.some((o)=>r.endsWith(o))}
3
+ export{ke,Zt,Xt,Yt,E};
@@ -0,0 +1,5 @@
1
+ // @bun
2
+ import{_e,ye,we}from"./vm-hands-entry-lite-s4bharcb.js";import{Ne,Le,Me}from"./vm-hands-entry-lite-6c67a3jc.js";import{spawn as A}from"child_process";import{randomUUID as s}from"crypto";import{basename as C}from"path";import{fileURLToPath as E}from"url";function S(){let p=C(process.execPath).startsWith("bun");return{command:process.execPath,args:[...p?["--no-env-file",E(new URL("./worker-candidate-entry.ts",import.meta.url))]:[],"worker","__preview-probe"]}}async function ds(p,a,m=S()){if(a.aborted||!["darwin","linux","win32"].includes(process.platform)||process.platform==="win32"&&!ye())return!1;let n=new AbortController,o=()=>n.abort();a.addEventListener("abort",o,{once:!0});let y=setTimeout(o,5000),t=A(m.command,m.args,{cwd:p,...Le(),stdio:["pipe","pipe","ignore"],env:Ne()});Me(t);let l=!1,b=new Promise((e)=>t.once("close",()=>{l=!0,e()}));t.on("error",o);let f,w,k=new Promise((e)=>{f=e}),I=new Promise((e)=>{w=e}),v=new Promise((e)=>n.signal.addEventListener("abort",()=>e(null),{once:!0})),i="",g=0,P=!1;t.stdout.setEncoding("utf8"),t.stdout.on("data",(e)=>{if(g+=Buffer.byteLength(e),i+=e,g>512){o();return}while(i.includes(`
3
+ `)){let c=i.indexOf(`
4
+ `),d=i.slice(0,c);i=i.slice(c+1);try{if(!P){let r=JSON.parse(d);if(!r||Object.keys(r).length!==2||!Number.isInteger(r.port)||r.port<1024||r.port>65535||typeof r.token!=="string"||!/^[a-zA-Z0-9_-]{43}$/.test(r.token))throw Error("probe_receipt_invalid");P=!0,f({port:r.port,token:r.token})}else if(d==="ready")w(!0);else o()}catch{o()}}}),b.then(o);let h,u=!1;try{let e=await Promise.race([k,v]);if(!e||!t.pid||n.signal.aborted||a.aborted)return!1;let c=Date.now()+4500,d=s(),r={organizationId:s(),userId:s(),runId:s(),deviceId:s(),rootId:s(),attachmentRevision:0,grantRevision:1,jobId:"readiness",generation:1,fenceId:s(),port:e.port,expiresAtMs:c},L={binding:r,executorLaunchId:d,job:{jobId:r.jobId,state:"running",startedAtMs:Date.now(),finishedAtMs:null,leaseExpiresAtMs:c,exitCode:null,inputSequence:0,output:[],firstCursor:1,nextCursor:0,truncated:!1,process:{pid:t.pid,processGroupId:t.pid,executorLaunchId:d}}},x=we({binding:r,deniedPorts:new Set,readCurrentJob:async()=>!l&&!n.signal.aborted?L:null});h=await _e({binding:r,deviceRelayUrl:`ws://127.0.0.1:${e.port}/device/readiness/${e.token}`,port:x,signal:n.signal}),u=await Promise.race([I,v])===!0&&!n.signal.aborted&&!a.aborted}catch{u=!1}finally{if(clearTimeout(y),a.removeEventListener("abort",o),h?.close(),n.abort(),t.stdin.destroy(),!l)t.kill("SIGKILL");await b}return u&&l}
5
+ export{ds};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{C}from"./vm-hands-entry-lite-t7an5zg2.js";import{g}from"./vm-hands-entry-lite-ckv17tn8.js";import{Nr,Pn,Lr,Tn}from"./vm-hands-entry-lite-qysyf65v.js";import{Ln,Ut,lo}from"./vm-hands-entry-lite-qk4kexta.js";import{x}from"./vm-hands-entry-lite-9ay6f56v.js";import{spawnSync as v}from"child_process";import{createHash as ke,randomUUID as Se}from"crypto";import{chmodSync as we,existsSync as P,mkdirSync as $e,readdirSync as Ve,readFileSync as k,renameSync as ye,rmSync as u,statSync as ve,writeFileSync as We}from"fs";import{dirname as Ae,isAbsolute as Y,join as p}from"path";import{spawnSync as de}from"child_process";import{readFileSync as me}from"fs";import{userInfo as D}from"os";import{join as fe}from"path";var ge="REASON_SCHEDULED_TASK";function H(r){return fe(r,"AppData","Local","Reason","Tasks")}function w(r){if(/[\0-\x1f\x7f"%]/.test(r))throw Error(`A background task cannot use a value with a double quote, percent sign or control character: ${r}`);return`'${r.replace(/['\u2018\u2019\u201a\u201b]/g,"$&$&")}'`}function M(r){if(!/^[A-Za-z0-9._-]+$/.test(r))throw Error(`Invalid Windows Scheduled Task name: ${r}`);return`$env:${ge}=${w(r)};`}function U(r){let e=Object.entries(r.environment).map(([t,i])=>{if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(t))throw Error(`Invalid Windows Scheduled Task environment name: ${t}`);return`$env:${t}=${w(i)};`}),n=`$global:LASTEXITCODE=1; & ${[r.program,...r.args].map(w).join(" ")} 2>&1 | ForEach-Object { Add-Content -LiteralPath ${w(r.log)} -Value $_.ToString() -Encoding UTF8 }; $c=$LASTEXITCODE;`;return[M(r.name),...e,"$ErrorActionPreference='Continue';",r.keepAlive?`do { ${n} if ($c) { Start-Sleep -Seconds 10 } } while ($c)`:`${n} exit $c`].join(" ")}function I(r){return r.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function pe(){let r=process.env.USERDOMAIN?.trim();return r?`${r}\\${D().username}`:D().username}function B(r){let e=I(r.user??pe()),n=r.schedule==="logon",t=r.schedule==="logon"?`<LogonTrigger><Enabled>true</Enabled><UserId>${e}</UserId></LogonTrigger>`:`<TimeTrigger><Repetition><Interval>PT${r.schedule.everyMinutes}M</Interval><StopAtDurationEnd>false</StopAtDurationEnd></Repetition><StartBoundary>2026-01-01T00:00:00</StartBoundary><Enabled>true</Enabled></TimeTrigger>`,i=`-NoProfile -NonInteractive -ExecutionPolicy Bypass -WindowStyle Hidden -Command "${r.script}"`;return`<?xml version="1.0" encoding="UTF-16"?>
2
+ import{T}from"./vm-hands-entry-lite-fcvf8md1.js";import{g}from"./vm-hands-entry-lite-aj139v8j.js";import{Wr,qn,Vr,Wn}from"./vm-hands-entry-lite-g4zd2d5n.js";import{Xn,Qt,Oo}from"./vm-hands-entry-lite-pcvgqrse.js";import{C}from"./vm-hands-entry-lite-6c67a3jc.js";import{spawnSync as v}from"child_process";import{createHash as ke,randomUUID as Se}from"crypto";import{chmodSync as we,existsSync as P,mkdirSync as $e,readdirSync as Ve,readFileSync as k,renameSync as ye,rmSync as u,statSync as ve,writeFileSync as be}from"fs";import{dirname as We,isAbsolute as q,join as p}from"path";import{spawnSync as de}from"child_process";import{readFileSync as me}from"fs";import{userInfo as D}from"os";import{join as fe}from"path";var ge="REASON_SCHEDULED_TASK";function H(r){return fe(r,"AppData","Local","Reason","Tasks")}function w(r){if(/[\0-\x1f\x7f"%]/.test(r))throw Error(`A background task cannot use a value with a double quote, percent sign or control character: ${r}`);return`'${r.replace(/['\u2018\u2019\u201a\u201b]/g,"$&$&")}'`}function M(r){if(!/^[A-Za-z0-9._-]+$/.test(r))throw Error(`Invalid Windows Scheduled Task name: ${r}`);return`$env:${ge}=${w(r)};`}function K(r){let e=Object.entries(r.environment).map(([t,i])=>{if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(t))throw Error(`Invalid Windows Scheduled Task environment name: ${t}`);return`$env:${t}=${w(i)};`}),n=`$global:LASTEXITCODE=1; & ${[r.program,...r.args].map(w).join(" ")} 2>&1 | ForEach-Object { Add-Content -LiteralPath ${w(r.log)} -Value $_.ToString() -Encoding UTF8 }; $c=$LASTEXITCODE;`;return[M(r.name),...e,"$ErrorActionPreference='Continue';",r.keepAlive?`do { ${n} if ($c) { Start-Sleep -Seconds 10 } } while ($c)`:`${n} exit $c`].join(" ")}function I(r){return r.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function pe(){let r=process.env.USERDOMAIN?.trim();return r?`${r}\\${D().username}`:D().username}function U(r){let e=I(r.user??pe()),n=r.schedule==="logon",t=r.schedule==="logon"?`<LogonTrigger><Enabled>true</Enabled><UserId>${e}</UserId></LogonTrigger>`:`<TimeTrigger><Repetition><Interval>PT${r.schedule.everyMinutes}M</Interval><StopAtDurationEnd>false</StopAtDurationEnd></Repetition><StartBoundary>2026-01-01T00:00:00</StartBoundary><Enabled>true</Enabled></TimeTrigger>`,i=`-NoProfile -NonInteractive -ExecutionPolicy Bypass -WindowStyle Hidden -Command "${r.script}"`;return`<?xml version="1.0" encoding="UTF-16"?>
3
3
  <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
4
4
  <RegistrationInfo>
5
5
  <Description>${I(r.description)}</Description>
@@ -33,21 +33,21 @@ import{C}from"./vm-hands-entry-lite-t7an5zg2.js";import{g}from"./vm-hands-entry-
33
33
  </Exec>
34
34
  </Actions>
35
35
  </Task>
36
- `}function V(r){return Buffer.concat([Buffer.from([255,254]),Buffer.from(r.replaceAll(`\r
36
+ `}function B(r){return Buffer.concat([Buffer.from([255,254]),Buffer.from(r.replaceAll(`\r
37
37
  `,`
38
38
  `).replaceAll(`
39
39
  `,`\r
40
- `),"utf16le")])}function j(r){let e=me(r);return(e[0]===255&&e[1]===254?e.subarray(2).toString("utf16le"):e.toString("utf8")).replaceAll(`\r
40
+ `),"utf16le")])}function V(r){let e=me(r);return(e[0]===255&&e[1]===254?e.subarray(2).toString("utf16le"):e.toString("utf8")).replaceAll(`\r
41
41
  `,`
42
- `)}function F(r,e){return["/Create","/TN",r,"/XML",e,"/F"]}function E(r){return["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",Buffer.from(r,"utf16le").toString("base64")]}function _(r){return`'*${M(r).replaceAll("'","''")}*'`}function T(r,e){return E(["$all = @(Get-CimInstance Win32_Process)",`$wrappers = @($all | ? { $_.ProcessId -ne $PID -and $_.CommandLine -like ${_(r)} })`,...e.keepWrapper?[]:["foreach ($w in $wrappers) { Stop-Process -Id $w.ProcessId -Force -ErrorAction SilentlyContinue }"],`foreach ($w in $wrappers) { $all | ? { $_.ParentProcessId -eq $w.ProcessId } | % { taskkill.exe /F ${e.tree?"/T ":""}/PID $_.ProcessId | Out-Null } }`].join(`
43
- `))}function X(r){return E(["$all = @(Get-CimInstance Win32_Process)",`$wrappers = @($all | ? { $_.ProcessId -ne $PID -and $_.CommandLine -like ${_(r)} })`,"foreach ($w in $wrappers) { if ($all | ? { $_.ParentProcessId -eq $w.ProcessId -and $_.Name -ne 'conhost.exe' }) { 'running'; exit 0 } }","exit 1"].join(`
44
- `))}function G(r,e=process.pid){let n=de(x("powershell.exe"),E(["$all = @{}; Get-CimInstance Win32_Process | % { $all[[int]$_.ProcessId] = $_ }",`$p = $all[${Math.trunc(e)}]`,"for ($i = 0; $p -and $i -lt 64; $i++) {",` if ($p.CommandLine -like ${_(r)}) { exit 10 }`," $n = $all[[int]$p.ParentProcessId]"," if (-not $n -or $n.ProcessId -eq $p.ProcessId -or $n.CreationDate -gt $p.CreationDate) { exit 11 }"," $p = $n","}","exit 11"].join(`
45
- `)),{stdio:"ignore",timeout:15000,windowsHide:!0});return n.status===10?!0:n.status===11?!1:null}var Ir="REASON_WORKER_SERVICE",Ie="worker_identity_unavailable";function be(r){return{platform:process.platform,home:r,uid:process.getuid?.(),command:(e,n)=>v(x(e),[...n],{stdio:"ignore"}).status??1,read:(e,n)=>{let t=v(x(e),[...n],{stdio:["ignore","pipe","ignore"],encoding:"utf8",timeout:1e4});return t.status===0?t.stdout:null},sleep:(e)=>Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e),workerIdentity:(e)=>lo(r,e),insideService:(e,n)=>xe(e,process.platform,process.getuid?.(),n)}}function xe(r,e,n,t=!0){if(process.env[Ir]===r||process.env.XPC_SERVICE_NAME===r)return!0;if(e==="linux")try{return k("/proc/self/cgroup","utf8").includes(`/${r}.service`)}catch{return!0}if(e==="win32")return G(r)??t;if(e!=="darwin")return!1;if(typeof n!=="number")return!0;let i=v("/bin/launchctl",["print",`gui/${n}/${r}`],{encoding:"utf8",timeout:5000});if(i.status===Ee)return!1;if(i.error||i.status!==0)return!0;let s=Number(/^\s*pid = (\d+)$/m.exec(i.stdout??"")?.[1]??0);if(!s)return!1;let a=process.pid;for(let o=0;o<64&&a>1;o+=1){if(a===s)return!0;let l=v("/bin/ps",["-o","ppid=","-p",String(a)],{encoding:"utf8",timeout:5000}),c=Number(l.stdout?.trim());if(l.error||l.status!==0||!Number.isSafeInteger(c)||c<=0)return!0;if(c===a)return!1;a=c}return a>1}var Ee=113;class K extends Error{code;constructor(r,e){super(r);this.code=e}}function Cn(r,e){if(!re(r.home,r.platform))throw new K(ee);if(r.platform==="darwin")S(r);let n=Tn(Nr(e,r.home)),t=g({env:e})==="staging",i=t?"ara-staging":"ara",s=[n?Pn(n):null,C(e,"REASON_CLI_LAUNCHER_PATH")?.trim(),r.platform==="win32"?p(r.home,"AppData","Local","Reason",...t?["staging"]:[],"bin",t?"reason-staging.exe":"reason.exe"):p(r.home,".local","bin",i)];for(let a of s)try{if(a&&Y(a)&&ve(a).isFile())return Lr(a)}catch{}throw new K(`A background service runs the installed Reason launcher, which was not found. Install Reason with: ${r.platform==="win32"?"irm https://reasonmachines.com/install.ps1 | iex":"curl -fsSL https://reasonmachines.com/install | sh"}`,"worker_launcher_missing")}var R=/(<key>ProgramArguments<\/key>\s*<array>\n)((?:\s*<string>[^<]*<\/string>\n)*)(\s*<\/array>)/,y=new RegExp(`(\\n\\s*<key>${Ut}</key>\\s*<string>)[^<]*(</string>)`),_e=/(<key>EnvironmentVariables<\/key>\s*<dict>[\s\S]*?)(\n\s*<\/dict>)/;function Te(r){return r.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&quot;",'"').replaceAll("&apos;","'").replaceAll("&amp;","&")}function J(r){let e=[...(R.exec(r)?.[2]??"").matchAll(/<string>([^<]*)<\/string>/g)].map((t)=>Te(t[1])),n=e[1]==="--run-worker"?e.slice(2):e;return n[0]?{launcher:n[0],args:n.slice(1)}:null}function z(r,e,n){let t=n.workerIdentity?.(r)??null;return{program:t?[t.executable,"--run-worker",r,...e]:[r,...e],identity:t}}function h(r){return r.map((e)=>` <string>${d(e)}</string>`).join(`
46
- `)}function Z(r,e){let n;try{n=k(r,"utf8")}catch{return null}let t=J(n);if(!t)return null;let i=Y(t.launcher)?Lr(t.launcher):t.launcher,{program:s,identity:a}=z(i,t.args,e),o=n.replace(R,(l,c,m,O)=>`${c}${h(s)}
42
+ `)}function j(r,e){return["/Create","/TN",r,"/XML",e,"/F"]}function x(r){return["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",Buffer.from(r,"utf16le").toString("base64")]}function E(r){return`'*${M(r).replaceAll("'","''")}*'`}function _(r,e){return x(["$all = @(Get-CimInstance Win32_Process)",`$wrappers = @($all | ? { $_.ProcessId -ne $PID -and $_.CommandLine -like ${E(r)} })`,...e.keepWrapper?[]:["foreach ($w in $wrappers) { Stop-Process -Id $w.ProcessId -Force -ErrorAction SilentlyContinue }"],`foreach ($w in $wrappers) { $all | ? { $_.ParentProcessId -eq $w.ProcessId } | % { taskkill.exe /F ${e.tree?"/T ":""}/PID $_.ProcessId | Out-Null } }`].join(`
43
+ `))}function F(r){return x(["$all = @(Get-CimInstance Win32_Process)",`$wrappers = @($all | ? { $_.ProcessId -ne $PID -and $_.CommandLine -like ${E(r)} })`,"foreach ($w in $wrappers) { if ($all | ? { $_.ParentProcessId -eq $w.ProcessId -and $_.Name -ne 'conhost.exe' }) { 'running'; exit 0 } }","exit 1"].join(`
44
+ `))}function X(r,e=process.pid){let n=de(C("powershell.exe"),x(["$all = @{}; Get-CimInstance Win32_Process | % { $all[[int]$_.ProcessId] = $_ }",`$p = $all[${Math.trunc(e)}]`,"for ($i = 0; $p -and $i -lt 64; $i++) {",` if ($p.CommandLine -like ${E(r)}) { exit 10 }`," $n = $all[[int]$p.ParentProcessId]"," if (-not $n -or $n.ProcessId -eq $p.ProcessId -or $n.CreationDate -gt $p.CreationDate) { exit 11 }"," $p = $n","}","exit 11"].join(`
45
+ `)),{stdio:"ignore",timeout:15000,windowsHide:!0});return n.status===10?!0:n.status===11?!1:null}var zr="REASON_WORKER_SERVICE",Ae="worker_identity_unavailable";function Ee(r){return{platform:process.platform,home:r,uid:process.getuid?.(),command:(e,n)=>v(C(e),[...n],{stdio:"ignore"}).status??1,read:(e,n)=>{let t=v(C(e),[...n],{stdio:["ignore","pipe","ignore"],encoding:"utf8",timeout:1e4});return t.status===0?t.stdout:null},sleep:(e)=>Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e),workerIdentity:(e)=>Oo(r,e),insideService:(e,n)=>Ie(e,process.platform,process.getuid?.(),n)}}function Ie(r,e,n,t=!0){if(process.env[zr]===r||process.env.XPC_SERVICE_NAME===r)return!0;if(e==="linux")try{return k("/proc/self/cgroup","utf8").includes(`/${r}.service`)}catch{return!0}if(e==="win32")return X(r)??t;if(e!=="darwin")return!1;if(typeof n!=="number")return!0;let i=v("/bin/launchctl",["print",`gui/${n}/${r}`],{encoding:"utf8",timeout:5000});if(i.status===xe)return!1;if(i.error||i.status!==0)return!0;let s=Number(/^\s*pid = (\d+)$/m.exec(i.stdout??"")?.[1]??0);if(!s)return!1;let a=process.pid;for(let o=0;o<64&&a>1;o+=1){if(a===s)return!0;let l=v("/bin/ps",["-o","ppid=","-p",String(a)],{encoding:"utf8",timeout:5000}),c=Number(l.stdout?.trim());if(l.error||l.status!==0||!Number.isSafeInteger(c)||c<=0)return!0;if(c===a)return!1;a=c}return a>1}var xe=113;class J extends Error{code;constructor(r,e){super(r);this.code=e}}function Hn(r,e){if(!re(r.home,r.platform))throw new J(ee);if(r.platform==="darwin")S(r);let n=Wn(Wr(e,r.home)),t=g({env:e})==="staging",i=t?"ara-staging":"ara",s=[n?qn(n):null,T(e,"REASON_CLI_LAUNCHER_PATH")?.trim(),r.platform==="win32"?p(r.home,"AppData","Local","Reason",...t?["staging"]:[],"bin",t?"reason-staging.exe":"reason.exe"):p(r.home,".local","bin",i)];for(let a of s)try{if(a&&q(a)&&ve(a).isFile())return Vr(a)}catch{}throw new J(`A background service runs the installed Reason launcher, which was not found. Install Reason with: ${r.platform==="win32"?"irm https://reasonmachines.com/install.ps1 | iex":"curl -fsSL https://reasonmachines.com/install | sh"}`,"worker_launcher_missing")}var R=/(<key>ProgramArguments<\/key>\s*<array>\n)((?:\s*<string>[^<]*<\/string>\n)*)(\s*<\/array>)/,y=new RegExp(`(\\n\\s*<key>${Qt}</key>\\s*<string>)[^<]*(</string>)`),_e=/(<key>EnvironmentVariables<\/key>\s*<dict>[\s\S]*?)(\n\s*<\/dict>)/;function Te(r){return r.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&quot;",'"').replaceAll("&apos;","'").replaceAll("&amp;","&")}function Y(r){let e=[...(R.exec(r)?.[2]??"").matchAll(/<string>([^<]*)<\/string>/g)].map((t)=>Te(t[1])),n=e[1]==="--run-worker"?e.slice(2):e;return n[0]?{launcher:n[0],args:n.slice(1)}:null}function z(r,e,n){let t=n.workerIdentity?.(r)??null;return{program:t?[t.executable,"--run-worker",r,...e]:[r,...e],identity:t}}function h(r){return r.map((e)=>` <string>${d(e)}</string>`).join(`
46
+ `)}function Z(r,e){let n;try{n=k(r,"utf8")}catch{return null}let t=Y(n);if(!t)return null;let i=q(t.launcher)?Vr(t.launcher):t.launcher,{program:s,identity:a}=z(i,t.args,e),o=n.replace(R,(l,c,m,O)=>`${c}${h(s)}
47
47
  ${O}`);if(!a)o=o.replace(y,"");else if(y.test(o))o=o.replace(y,(l,c,m)=>`${c}${d(a.app)}${m}`);else o=o.replace(_e,(l,c,m)=>`${c}
48
- <key>${Ut}</key>
49
- <string>${d(a.app)}</string>${m}`);return o===n?null:o}function Pe(r,e){let n=Z(r,e);if(n!==null)A(r,n)}function ps(r,e,n){if(e.platform!=="darwin")return!1;let t=qe(r,e,n);return t!==null&&Z(t.definition,e)!==null}var W="com.reasonmachines.worker.",N="so.reason.worker.",Q=[W,N];function Wi(r,e=W){return`${e}connect${r==="production"?"":`.${r}`}`}function hs(r,e){return Q.some((n)=>r===Wi(e,n))}function Re(r,e,n){if(e==="connect")return Wi(r.channel,n);let t=ke("sha256").update(r.workspaceRoot).digest("hex").slice(0,8);return`${n}${r.name.toLowerCase()}.${t}`}var ee="A background service needs macOS (launchd), Linux (systemd --user) or Windows (Task Scheduler).";function re(r,e){if(e==="darwin")return{directory:p(r,"Library","LaunchAgents"),suffix:".plist"};if(e==="linux")return{directory:p(r,".config","systemd","user"),suffix:".service"};if(e==="win32")return{directory:H(r),suffix:".xml"};return null}function f(r,e,n,t=W){let i=Re(r,n,t),s=re(e.home,e.platform);if(!s)return null;return{label:i,definition:p(s.directory,`${i}${s.suffix}`),logs:e.platform==="linux"?`journalctl --user -u ${i}.service`:p(r.stateDirectory,"service.log")}}function qe(r,e,n="serve"){return ne(r,e,n)[0]??null}function ne(r,e,n){return Q.map((t)=>f(r,e,n,t)).filter((t)=>t!==null&&P(t.definition))}function te(r,e,n){let t=f(r,e,n,N);return t&&P(t.definition)?t:null}function Oo(r,e,n){let t=f(r,e,n),i=te(r,e,n);if(!t||!i||!P(t.definition)||e.insideService?.(i.label))return null;if(!Ce(t,e))return"current_not_running";if(e.platform==="darwin"){if(typeof e.uid==="number"&&e.uid>0)e.command("/bin/launchctl",["bootout",`gui/${e.uid}/${i.label}`]);return u(i.definition,{force:!0}),"retired"}if(e.platform==="win32")return b(i,e,!0),"retired";return e.command("systemctl",["--user","disable","--now",`${i.label}.service`]),u(i.definition,{force:!0}),e.command("systemctl",["--user","daemon-reload"]),"retired"}function Ce(r,e){if(e.platform==="darwin")return typeof e.uid==="number"&&e.uid>0&&e.command("/bin/launchctl",["print",`gui/${e.uid}/${r.label}`])===0;if(e.platform==="win32")return e.command("schtasks",["/Query","/TN",r.label])===0;let n=`${r.label}.service`;return e.command("systemctl",["--user","is-enabled","--quiet",n])===0&&he.has(e.read("systemctl",["--user","show","--property=ActiveState","--value",n])?.trim()??"")}var he=new Set(["active","activating","reloading"]);function An(r,e){if(e.platform==="darwin"){if(typeof e.uid!=="number"||e.uid<=0)return!1;let n=e.read("/bin/launchctl",["print",`gui/${e.uid}/${r.label}`]);return Number(/^\s*pid = (\d+)$/m.exec(n??"")?.[1]??0)>0}if(e.platform==="win32")return e.read("powershell.exe",X(r.label))?.trim()==="running";return Number(e.read("systemctl",["--user","show","--property=MainPID","--value",`${r.label}.service`])?.trim()??0)>0}function fs(r){let{config:e,launcher:n,host:t,kind:i}=r,s=f(e,t,i);if(!s)return!1;let a;try{a=t.platform==="win32"?j(s.definition):k(s.definition,"utf8")}catch{return!1}if(t.platform==="win32")return a===se(e,i,s,n);if(t.platform!=="darwin")return a===oe(e,i,s,n,t.home,r.path);let o=J(a);return a.replace(y,"").replace(R,(c,m,O,ue)=>`${m}${o?`${h([o.launcher,...o.args])}
50
- `:""}${ue}`)===ie(e,i,s,n,{...t,workerIdentity:()=>null},r.path).plist}function L(r,e){if(e==="connect")return{args:["connect"],environment:{REASON_CLI_CHANNEL:r.channel},description:"Reason connection of this computer"};return{args:["serve",r.name,"--dir",r.workspaceRoot,...r.executionMode==="confined"?["--sandbox"]:[]],environment:{},description:`Reason machine ${r.name} worker`}}function d(r){return r.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function q(r,e=!1){if(/[\0-\x1f\x7f]/.test(r))throw new K("A background service cannot use a path with control characters.");let n=r.replaceAll("\\","\\\\").replaceAll('"',"\\\"").replaceAll("%","%%");return`"${e?n.replaceAll("$","$$$$"):n}"`}function ie(r,e,n,t,i,s){let a=L(r,e),o=z(t,a.args,i),l={HOME:i.home,PATH:s,[Ir]:n.label,...a.environment,...o.identity?{[Ut]:o.identity.app}:{}};return{identity:o.identity,plist:`<?xml version="1.0" encoding="UTF-8"?>
48
+ <key>${Qt}</key>
49
+ <string>${d(a.app)}</string>${m}`);return o===n?null:o}function Pe(r,e){let n=Z(r,e);if(n!==null)A(r,n)}function $s(r,e,n){if(e.platform!=="darwin")return!1;let t=Xe(r,e,n);return t!==null&&Z(t.definition,e)!==null}var W="com.reasonmachines.worker.",N="so.reason.worker.",Q=[W,N];function ho(r,e=W){return`${e}connect${r==="production"?"":`.${r}`}`}function Bs(r,e){return Q.some((n)=>r===ho(e,n))}function Re(r,e,n){if(e==="connect")return ho(r.channel,n);let t=ke("sha256").update(r.workspaceRoot).digest("hex").slice(0,8);return`${n}${r.name.toLowerCase()}.${t}`}var ee="A background service needs macOS (launchd), Linux (systemd --user) or Windows (Task Scheduler).";function re(r,e){if(e==="darwin")return{directory:p(r,"Library","LaunchAgents"),suffix:".plist"};if(e==="linux")return{directory:p(r,".config","systemd","user"),suffix:".service"};if(e==="win32")return{directory:H(r),suffix:".xml"};return null}function f(r,e,n,t=W){let i=Re(r,n,t),s=re(e.home,e.platform);if(!s)return null;return{label:i,definition:p(s.directory,`${i}${s.suffix}`),logs:e.platform==="linux"?`journalctl --user -u ${i}.service`:p(r.stateDirectory,"service.log")}}function Xe(r,e,n="serve"){return ne(r,e,n)[0]??null}function ne(r,e,n){return Q.map((t)=>f(r,e,n,t)).filter((t)=>t!==null&&P(t.definition))}function te(r,e,n){let t=f(r,e,n,N);return t&&P(t.definition)?t:null}function Yo(r,e,n){let t=f(r,e,n),i=te(r,e,n);if(!t||!i||!P(t.definition)||e.insideService?.(i.label))return null;if(!Ce(t,e))return"current_not_running";if(e.platform==="darwin"){if(typeof e.uid==="number"&&e.uid>0)e.command("/bin/launchctl",["bootout",`gui/${e.uid}/${i.label}`]);return u(i.definition,{force:!0}),"retired"}if(e.platform==="win32")return b(i,e,!0),"retired";return e.command("systemctl",["--user","disable","--now",`${i.label}.service`]),u(i.definition,{force:!0}),e.command("systemctl",["--user","daemon-reload"]),"retired"}function Ce(r,e){if(e.platform==="darwin")return typeof e.uid==="number"&&e.uid>0&&e.command("/bin/launchctl",["print",`gui/${e.uid}/${r.label}`])===0;if(e.platform==="win32")return e.command("schtasks",["/Query","/TN",r.label])===0;let n=`${r.label}.service`;return e.command("systemctl",["--user","is-enabled","--quiet",n])===0&&he.has(e.read("systemctl",["--user","show","--property=ActiveState","--value",n])?.trim()??"")}var he=new Set(["active","activating","reloading"]);function zn(r,e){if(e.platform==="darwin"){if(typeof e.uid!=="number"||e.uid<=0)return!1;let n=e.read("/bin/launchctl",["print",`gui/${e.uid}/${r.label}`]);return Number(/^\s*pid = (\d+)$/m.exec(n??"")?.[1]??0)>0}if(e.platform==="win32")return e.read("powershell.exe",F(r.label))?.trim()==="running";return Number(e.read("systemctl",["--user","show","--property=MainPID","--value",`${r.label}.service`])?.trim()??0)>0}function Fs(r){let{config:e,launcher:n,host:t,kind:i}=r,s=f(e,t,i);if(!s)return!1;let a;try{a=t.platform==="win32"?V(s.definition):k(s.definition,"utf8")}catch{return!1}if(t.platform==="win32")return a===se(e,i,s,n);if(t.platform!=="darwin")return a===oe(e,i,s,n,t.home,r.path);let o=Y(a);return a.replace(y,"").replace(R,(c,m,O,ue)=>`${m}${o?`${h([o.launcher,...o.args])}
50
+ `:""}${ue}`)===ie(e,i,s,n,{...t,workerIdentity:()=>null},r.path).plist}function L(r,e){if(e==="connect")return{args:["connect"],environment:{REASON_CLI_CHANNEL:r.channel},description:"Reason connection of this computer"};return{args:["serve",r.name,"--dir",r.workspaceRoot,...r.executionMode==="confined"?["--sandbox"]:[]],environment:{},description:`Reason machine ${r.name} worker`}}function d(r){return r.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function G(r,e=!1){if(/[\0-\x1f\x7f]/.test(r))throw new J("A background service cannot use a path with control characters.");let n=r.replaceAll("\\","\\\\").replaceAll('"',"\\\"").replaceAll("%","%%");return`"${e?n.replaceAll("$","$$$$"):n}"`}function ie(r,e,n,t,i,s){let a=L(r,e),o=z(t,a.args,i),l={HOME:i.home,PATH:s,[zr]:n.label,...a.environment,...o.identity?{[Qt]:o.identity.app}:{}};return{identity:o.identity,plist:`<?xml version="1.0" encoding="UTF-8"?>
51
51
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
52
52
  <plist version="1.0">
53
53
  <dict>
@@ -55,7 +55,7 @@ ${O}`);if(!a)o=o.replace(y,"");else if(y.test(o))o=o.replace(y,(l,c,m)=>`${c}${d
55
55
  <string>${d(n.label)}</string>
56
56
  <key>AssociatedBundleIdentifiers</key>
57
57
  <array>
58
- <string>${Ln}</string>
58
+ <string>${Xn}</string>
59
59
  </array>
60
60
  <key>ProgramArguments</key>
61
61
  <array>
@@ -92,8 +92,8 @@ ${Object.entries(l).map(([c,m])=>` <key>${c}</key>
92
92
  Description=${a.description}
93
93
 
94
94
  [Service]
95
- ExecStart=${[t,...a.args].map((o)=>q(o,!0)).join(" ")}
96
- Environment=${[`HOME=${i}`,`PATH=${s}`,`${Ir}=${n.label}`,...Object.entries(a.environment).map(([o,l])=>`${o}=${l}`)].map((o)=>q(o)).join(" ")}
95
+ ExecStart=${[t,...a.args].map((o)=>G(o,!0)).join(" ")}
96
+ Environment=${[`HOME=${i}`,`PATH=${s}`,`${zr}=${n.label}`,...Object.entries(a.environment).map(([o,l])=>`${o}=${l}`)].map((o)=>G(o)).join(" ")}
97
97
  Restart=on-failure
98
98
  RestartSec=10
99
99
  TimeoutStopSec=${Math.ceil(r.shutdownGraceMs/1000)+10}
@@ -101,5 +101,5 @@ UMask=0077
101
101
 
102
102
  [Install]
103
103
  WantedBy=default.target
104
- `}function se(r,e,n,t){let i=L(r,e);return B({description:i.description,schedule:"logon",script:U({name:n.label,program:t,args:i.args,environment:{[Ir]:n.label,...i.environment},log:n.logs,keepAlive:!0})})}function ae(r,e,n){e.command("powershell.exe",T(r.label,{tree:n,keepWrapper:!n}))}function b(r,e,n){e.command("schtasks",["/Delete","/F","/TN",r.label]),e.command("powershell.exe",T(r.label,{tree:n,keepWrapper:!1})),u(r.definition,{force:!0})}function A(r,e){$e(Ae(r),{recursive:!0,mode:448});let n=`${r}.${Se()}.tmp`;try{We(n,e,{mode:384,flag:"wx"}),we(n,384),ye(n,r)}finally{u(n,{force:!0})}}function S(r){if(typeof r.uid!=="number"||!Number.isSafeInteger(r.uid)||r.uid<=0)throw new K("Set up a background service as your own user, not with sudo.","worker_service_root_user");return`gui/${r.uid}`}function ms(r){let{config:e,launcher:n,host:t}=r,i=r.kind??"serve",s=te(e,t,i),a=s!==null&&t.insideService?.(s.label)===!0,o=f(e,t,i,a?N:W);if(!o)throw new K(ee);if(t.platform==="darwin")S(t);if(t.platform==="linux"&&t.command("systemctl",["--user","show-environment"])!==0)throw new K("No background service here: this computer has no systemd user session.","worker_service_manager_missing");let l=t.platform==="darwin"?ie(e,i,o,n,t,r.path):null;if(A(o.definition,l?l.plist:t.platform==="win32"?V(se(e,i,o,n)):oe(e,i,o,n,t.home,r.path)),le(e,t,o,a?null:s),l)return l.identity?o:{...o,identityProblem:Ie};if(t.platform==="win32")return o;return{...o,lingering:t.command("loginctl",["enable-linger"])===0}}function le(r,e,n,t){if(e.platform==="darwin"){let a=S(e);if(t)e.command("/bin/launchctl",["bootout",`${a}/${t.label}`]);if(ce(r,n,e)){if(t)u(t.definition,{force:!0});return}if(u(n.definition,{force:!0}),t)e.command("/bin/launchctl",["bootstrap",a,t.definition]);throw new K("Could not start the background service (launchctl bootstrap failed).","worker_service_start_failed")}if(e.platform==="win32"){if(t)b(t,e,!0);if(e.command("schtasks",F(n.label,n.definition))===0){if(ae(n,e,e.insideService?.(n.label)!==!0),e.command("schtasks",["/Run","/TN",n.label])===0)return}throw b(n,e,!0),new K("Could not start the background service (schtasks failed).")}let i=`${n.label}.service`,s=t?`${t.label}.service`:null;if(e.command("systemctl",["--user","daemon-reload"])!==0||s!==null&&e.command("systemctl",["--user","disable","--now",s])!==0||e.command("systemctl",["--user","enable",i])!==0||e.command("systemctl",["--user","restart",i])!==0){if(e.command("systemctl",["--user","disable",i]),u(n.definition,{force:!0}),e.command("systemctl",["--user","daemon-reload"]),s)e.command("systemctl",["--user","enable","--now",s]);throw new K("Could not start the background service (systemctl --user failed).","worker_service_start_failed")}if(t)u(t.definition,{force:!0}),e.command("systemctl",["--user","daemon-reload"])}function ce(r,e,n){let t=S(n);n.command("/bin/launchctl",["bootout",`${t}/${e.label}`]);let i=(Math.ceil(r.shutdownGraceMs/1000)+10)*1000;for(let s=0,a=100;;a=Math.min(a*2,2000)){if(n.command("/bin/launchctl",["bootstrap",t,e.definition])===0)return!0;if(s>=i)return!1;n.sleep(a),s+=a}}function Dr(r,e,n){let t=qe(r,e,n);if(!t)return null;let i=e.insideService?.(t.label)===!0;if(e.platform==="darwin"&&!i)Pe(t.definition,e);let s=f(r,e,n);if(s&&t.label!==s.label&&!i)return A(s.definition,k(t.definition,"utf8").replaceAll(t.label,s.label)),le(r,e,s,t),s;let a=e.platform==="darwin"&&i,o;if(e.platform==="win32")ae(t,e,!i),o=e.command("schtasks",["/Run","/TN",t.label])===0;else if(a)o=e.command("/bin/launchctl",["kickstart","-k",`${S(e)}/${t.label}`])===0;else if(e.platform==="darwin")o=ce(r,t,e);else e.command("systemctl",["--user","enable",`${t.label}.service`]),o=e.command("systemctl",["--user","restart",`${t.label}.service`])===0;if(!o)throw new K(`Could not restart the background service ${t.label}.`,"worker_service_restart_failed");if(s&&t.label===s.label)Oo(r,e,n);return t}function gs(r,e,n,t){let i=qe(r,n,t),s=f(e,n,t);if(n.platform!=="darwin"||!i||!s)return;let a=`<string>${d(i.logs)}</string>`,o=k(i.definition,"utf8");if(o.includes(a))A(i.definition,o.replaceAll(a,`<string>${d(s.logs)}</string>`))}function _s(r,e,n="serve"){let t=ne(r,e,n);for(let i of t){if(e.platform==="win32"){b(i,e,e.insideService?.(i.label,!1)!==!0);continue}if(e.platform==="darwin"){if(typeof e.uid==="number"&&e.uid>0)e.command("/bin/launchctl",["bootout",`gui/${e.uid}/${i.label}`]);u(i.definition,{force:!0});continue}e.command("systemctl",["--user","disable","--now",`${i.label}.service`]),u(i.definition,{force:!0}),e.command("systemctl",["--user","daemon-reload"])}return t[0]??null}
105
- export{Ir,be,K,Cn,ps,Wi,hs,qe,Oo,An,fs,ms,Dr,gs,_s};
104
+ `}function se(r,e,n,t){let i=L(r,e);return U({description:i.description,schedule:"logon",script:K({name:n.label,program:t,args:i.args,environment:{[zr]:n.label,...i.environment},log:n.logs,keepAlive:!0})})}function ae(r,e,n){e.command("powershell.exe",_(r.label,{tree:n,keepWrapper:!n}))}function b(r,e,n){e.command("schtasks",["/Delete","/F","/TN",r.label]),e.command("powershell.exe",_(r.label,{tree:n,keepWrapper:!1})),u(r.definition,{force:!0})}function A(r,e){$e(We(r),{recursive:!0,mode:448});let n=`${r}.${Se()}.tmp`;try{be(n,e,{mode:384,flag:"wx"}),we(n,384),ye(n,r)}finally{u(n,{force:!0})}}function S(r){if(typeof r.uid!=="number"||!Number.isSafeInteger(r.uid)||r.uid<=0)throw new J("Set up a background service as your own user, not with sudo.","worker_service_root_user");return`gui/${r.uid}`}function js(r){let{config:e,launcher:n,host:t}=r,i=r.kind??"serve",s=te(e,t,i),a=s!==null&&t.insideService?.(s.label)===!0,o=f(e,t,i,a?N:W);if(!o)throw new J(ee);if(t.platform==="darwin")S(t);if(t.platform==="linux"&&t.command("systemctl",["--user","show-environment"])!==0)throw new J("No background service here: this computer has no systemd user session.","worker_service_manager_missing");let l=t.platform==="darwin"?ie(e,i,o,n,t,r.path):null;if(A(o.definition,l?l.plist:t.platform==="win32"?B(se(e,i,o,n)):oe(e,i,o,n,t.home,r.path)),le(e,t,o,a?null:s),l)return l.identity?o:{...o,identityProblem:Ae};if(t.platform==="win32")return o;return{...o,lingering:t.command("loginctl",["enable-linger"])===0}}function le(r,e,n,t){if(e.platform==="darwin"){let a=S(e);if(t)e.command("/bin/launchctl",["bootout",`${a}/${t.label}`]);if(ce(r,n,e)){if(t)u(t.definition,{force:!0});return}if(u(n.definition,{force:!0}),t)e.command("/bin/launchctl",["bootstrap",a,t.definition]);throw new J("Could not start the background service (launchctl bootstrap failed).","worker_service_start_failed")}if(e.platform==="win32"){if(t)b(t,e,!0);if(e.command("schtasks",j(n.label,n.definition))===0){if(ae(n,e,e.insideService?.(n.label)!==!0),e.command("schtasks",["/Run","/TN",n.label])===0)return}throw b(n,e,!0),new J("Could not start the background service (schtasks failed).")}let i=`${n.label}.service`,s=t?`${t.label}.service`:null;if(e.command("systemctl",["--user","daemon-reload"])!==0||s!==null&&e.command("systemctl",["--user","disable","--now",s])!==0||e.command("systemctl",["--user","enable",i])!==0||e.command("systemctl",["--user","restart",i])!==0){if(e.command("systemctl",["--user","disable",i]),u(n.definition,{force:!0}),e.command("systemctl",["--user","daemon-reload"]),s)e.command("systemctl",["--user","enable","--now",s]);throw new J("Could not start the background service (systemctl --user failed).","worker_service_start_failed")}if(t)u(t.definition,{force:!0}),e.command("systemctl",["--user","daemon-reload"])}function ce(r,e,n){let t=S(n);n.command("/bin/launchctl",["bootout",`${t}/${e.label}`]);let i=(Math.ceil(r.shutdownGraceMs/1000)+10)*1000;for(let s=0,a=100;;a=Math.min(a*2,2000)){if(n.command("/bin/launchctl",["bootstrap",t,e.definition])===0)return!0;if(s>=i)return!1;n.sleep(a),s+=a}}function qr(r,e,n){let t=Xe(r,e,n);if(!t)return null;let i=e.insideService?.(t.label)===!0;if(e.platform==="darwin"&&!i)Pe(t.definition,e);let s=f(r,e,n);if(s&&t.label!==s.label&&!i)return A(s.definition,k(t.definition,"utf8").replaceAll(t.label,s.label)),le(r,e,s,t),s;let a=e.platform==="darwin"&&i,o;if(e.platform==="win32")ae(t,e,!i),o=e.command("schtasks",["/Run","/TN",t.label])===0;else if(a)o=e.command("/bin/launchctl",["kickstart","-k",`${S(e)}/${t.label}`])===0;else if(e.platform==="darwin")o=ce(r,t,e);else e.command("systemctl",["--user","enable",`${t.label}.service`]),o=e.command("systemctl",["--user","restart",`${t.label}.service`])===0;if(!o)throw new J(`Could not restart the background service ${t.label}.`,"worker_service_restart_failed");if(s&&t.label===s.label)Yo(r,e,n);return t}function Us(r,e,n,t){let i=Xe(r,n,t),s=f(e,n,t);if(n.platform!=="darwin"||!i||!s)return;let a=`<string>${d(i.logs)}</string>`,o=k(i.definition,"utf8");if(o.includes(a))A(i.definition,o.replaceAll(a,`<string>${d(s.logs)}</string>`))}function Hs(r,e,n="serve"){let t=ne(r,e,n);for(let i of t){if(e.platform==="win32"){b(i,e,e.insideService?.(i.label,!1)!==!0);continue}if(e.platform==="darwin"){if(typeof e.uid==="number"&&e.uid>0)e.command("/bin/launchctl",["bootout",`gui/${e.uid}/${i.label}`]);u(i.definition,{force:!0});continue}e.command("systemctl",["--user","disable","--now",`${i.label}.service`]),u(i.definition,{force:!0}),e.command("systemctl",["--user","daemon-reload"])}return t[0]??null}
105
+ export{zr,Ee,J,Hn,$s,ho,Bs,Xe,Yo,zn,Fs,js,qr,Us,Hs};
@@ -0,0 +1,128 @@
1
+ // @bun
2
+ import{Gn,Ao,Jt}from"./vm-hands-entry-lite-jzz73e3f.js";import{Pn,Ve,ao,Tn,Rn,On,Pr,x}from"./vm-hands-entry-lite-w8ykfw5h.js";import{kt}from"./vm-hands-entry-lite-fbhqfzbq.js";import{Ir}from"./vm-hands-entry-lite-nzmkyezg.js";import{j}from"./vm-hands-entry-lite-pf5qtbj5.js";import{a}from"./vm-hands-entry-lite-jev771b3.js";import{r}from"./vm-hands-entry-lite-qy9xg6em.js";import{execFile as Y,spawn as z}from"child_process";import{randomBytes as Te}from"crypto";import{chmodSync as he,existsSync as H,lstatSync as Qe,mkdirSync as _e,readFileSync as De,rmSync as I,writeFileSync as C}from"fs";import{connect as we}from"net";import{join as y}from"path";var P=32,w=76;var W="./desktop-wallpaper-0pjhgyfk.jpg";var B="./dock-browser-afp005mt.png";var O="./dock-files-rywdm96b.png";var F="./dock-terminal-s41cj1jp.png";var k=`# Sets the X root window background and _XROOTPMAP_ID, as feh --bg-fill does.
3
+ # The native Blaxel image ships no feh, hsetroot or compositor, but it does ship
4
+ # python3-gi and libX11. tint2 reads _XROOTPMAP_ID to draw its transparent panel.
5
+ # Usage: DISPLAY=:99 python3 set-root-wallpaper.py IMAGE
6
+ import ctypes, sys
7
+ import gi
8
+ gi.require_version("GdkPixbuf", "2.0")
9
+ from gi.repository import GdkPixbuf
10
+ x = ctypes.cdll.LoadLibrary("libX11.so.6")
11
+ x.XOpenDisplay.restype = ctypes.c_void_p
12
+ x.XOpenDisplay.argtypes = [ctypes.c_char_p]
13
+ d = x.XOpenDisplay(None)
14
+ if not d: sys.exit("no display")
15
+ for name, res, args in [
16
+ ("XDefaultScreen", ctypes.c_int, [ctypes.c_void_p]),
17
+ ("XRootWindow", ctypes.c_ulong, [ctypes.c_void_p, ctypes.c_int]),
18
+ ("XDisplayWidth", ctypes.c_int, [ctypes.c_void_p, ctypes.c_int]),
19
+ ("XDisplayHeight", ctypes.c_int, [ctypes.c_void_p, ctypes.c_int]),
20
+ ("XDefaultDepth", ctypes.c_int, [ctypes.c_void_p, ctypes.c_int]),
21
+ ("XDefaultVisual", ctypes.c_void_p, [ctypes.c_void_p, ctypes.c_int]),
22
+ ("XDefaultGC", ctypes.c_void_p, [ctypes.c_void_p, ctypes.c_int]),
23
+ ("XCreatePixmap", ctypes.c_ulong, [ctypes.c_void_p, ctypes.c_ulong, ctypes.c_uint, ctypes.c_uint, ctypes.c_uint]),
24
+ ("XCreateImage", ctypes.c_void_p, [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_uint, ctypes.c_int, ctypes.c_int, ctypes.c_char_p, ctypes.c_uint, ctypes.c_uint, ctypes.c_int, ctypes.c_int]),
25
+ ("XPutImage", ctypes.c_int, [ctypes.c_void_p, ctypes.c_ulong, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_uint, ctypes.c_uint]),
26
+ ("XInternAtom", ctypes.c_ulong, [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_int]),
27
+ ("XChangeProperty", ctypes.c_int, [ctypes.c_void_p, ctypes.c_ulong, ctypes.c_ulong, ctypes.c_ulong, ctypes.c_int, ctypes.c_int, ctypes.c_void_p, ctypes.c_int]),
28
+ ("XSetWindowBackgroundPixmap", ctypes.c_int, [ctypes.c_void_p, ctypes.c_ulong, ctypes.c_ulong]),
29
+ ("XClearWindow", ctypes.c_int, [ctypes.c_void_p, ctypes.c_ulong]),
30
+ ("XSetCloseDownMode", ctypes.c_int, [ctypes.c_void_p, ctypes.c_int]),
31
+ ("XCloseDisplay", ctypes.c_int, [ctypes.c_void_p]),
32
+ ]:
33
+ f = getattr(x, name); f.restype = res; f.argtypes = args
34
+ s = x.XDefaultScreen(d); root = x.XRootWindow(d, s)
35
+ w, h = x.XDisplayWidth(d, s), x.XDisplayHeight(d, s)
36
+ if x.XDefaultDepth(d, s) != 24: sys.exit("unsupported depth")
37
+ # Scale to cover the screen, then crop the centre.
38
+ src = GdkPixbuf.Pixbuf.new_from_file(sys.argv[1])
39
+ k = max(w / src.get_width(), h / src.get_height())
40
+ sw, sh = max(w, round(src.get_width() * k)), max(h, round(src.get_height() * k))
41
+ pb = src.scale_simple(sw, sh, GdkPixbuf.InterpType.BILINEAR).new_subpixbuf((sw - w) // 2, (sh - h) // 2, w, h).copy()
42
+ if pb.get_has_alpha(): pb = pb.composite_color_simple(w, h, GdkPixbuf.InterpType.NEAREST, 255, 1, 0, 0)
43
+ rgb, stride = pb.get_pixels(), pb.get_rowstride()
44
+ bgrx = bytearray(w * h * 4)
45
+ for y in range(h):
46
+ row = rgb[y * stride:y * stride + w * 3]; o = y * w * 4
47
+ bgrx[o:o + w * 4:4] = row[2::3]; bgrx[o + 1:o + w * 4:4] = row[1::3]; bgrx[o + 2:o + w * 4:4] = row[0::3]
48
+ buf = ctypes.create_string_buffer(bytes(bgrx), len(bgrx))
49
+ pix = x.XCreatePixmap(d, root, w, h, 24)
50
+ img = x.XCreateImage(d, x.XDefaultVisual(d, s), 24, 2, 0, buf, w, h, 32, 0) # ZPixmap
51
+ x.XPutImage(d, pix, x.XDefaultGC(d, s), img, 0, 0, 0, 0, w, h)
52
+ ref = ctypes.c_ulong(pix)
53
+ for atom in (b"_XROOTPMAP_ID", b"ESETROOT_PMAP_ID"):
54
+ x.XChangeProperty(d, root, x.XInternAtom(d, atom, 0), 20, 32, 0, ctypes.byref(ref), 1) # XA_PIXMAP, PropModeReplace
55
+ x.XSetWindowBackgroundPixmap(d, root, pix)
56
+ x.XClearWindow(d, root)
57
+ x.XSetCloseDownMode(d, 1) # RetainPermanent: the pixmap outlives this process
58
+ x.XCloseDisplay(d)
59
+ `;function ce(e){return`<?xml version="1.0" encoding="UTF-8"?>
60
+ <openbox_config xmlns="http://openbox.org/3.4/rc">
61
+ <theme><keepBorder>no</keepBorder></theme>
62
+ <applications>
63
+ <!-- Debian Chromium is "Chromium"; Chrome for Testing is "Chromium-browser". -->
64
+ <application class="Chromium*">
65
+ <decor>no</decor>
66
+ <position force="yes"><x>${P}</x><y>${P}</y></position>
67
+ <size><width>${e.width-P*2}</width><height>${e.height-P-w}</height></size>
68
+ </application>
69
+ </applications>
70
+ </openbox_config>`}var be=`# Remote sandbox dock \u2014 launcher icons only, centred, no panel fill
71
+ panel_items = L
72
+ panel_size = 100% 46
73
+ panel_margin = 0 10
74
+ panel_padding = 0 0 10
75
+ panel_position = bottom center horizontal
76
+ panel_shrink = 1
77
+ panel_background_id = 0
78
+ panel_layer = top
79
+ mouse_effects = 1
80
+ mouse_hover_icon_asb = 100 0 12
81
+ mouse_pressed_icon_asb = 100 0 -12
82
+
83
+ launcher_icon_size = 46
84
+ launcher_padding = 0 0 10
85
+ launcher_background_id = 0
86
+ launcher_tooltip = 1
87
+
88
+ launcher_item_app = /tmp/ara-chromium.desktop
89
+ launcher_item_app = /tmp/ara-terminal.desktop
90
+ launcher_item_app = /tmp/ara-files.desktop
91
+ `,ye=`corner-radius = 12;
92
+ rounded-corners-exclude = [
93
+ "class_g = 'tint2'",
94
+ "window_type = 'dock'",
95
+ "window_type = 'desktop'"
96
+ ];
97
+ backend = "xrender";
98
+ shadow = false;
99
+ fading = false;
100
+ vsync = false;
101
+ inactive-opacity = 1.0;
102
+ active-opacity = 1.0;
103
+ `,le="/tmp/ara-dock-browser.png",ue=`[Desktop Entry]
104
+ Name=Chrome
105
+ Exec=chromium --no-sandbox %U
106
+ Icon=${le}
107
+ Type=Application
108
+ Categories=Network;WebBrowser;
109
+ `,Pe=`[Desktop Entry]
110
+ Name=Terminal
111
+ Exec=bash -c "DISPLAY=:99 xterm -fa DejaVuSansMono -fs 11 -bg black -fg white"
112
+ Icon=/tmp/ara-dock-terminal.png
113
+ Type=Application
114
+ Categories=System;TerminalEmulator;
115
+ `,Se=`[Desktop Entry]
116
+ Name=Files
117
+ Exec=bash -c "DISPLAY=:99 pcmanfm --no-desktop"
118
+ Icon=/tmp/ara-dock-files.png
119
+ Type=Application
120
+ Categories=System;FileManager;
121
+ `;var K={"wallpaper.jpg":W,"dock-browser.png":B,"dock-terminal.png":F,"dock-files.png":O},Xe=k,fe='set_wallpaper() { if command -v feh >/dev/null 2>&1; then feh --bg-fill "$1"; else python3 "$2" "$1"; fi; }';function v(e){let s=(i)=>i.replaceAll("DISPLAY=:99",`DISPLAY=${e.display}`).replaceAll("/tmp/ara-",`${e.root}/ara-`),p=new Set(e.absent??[]),n=be.split(`
122
+ `).filter((i)=>!(p.has("terminal")&&i.endsWith("/ara-terminal.desktop"))&&!(p.has("files")&&i.endsWith("/ara-files.desktop"))).join(`
123
+ `);return{files:{"openbox/rc.xml":ce(e.screen),"tint2/tint2rc":s(n),"picom/picom.conf":ye,...p.has("terminal")?{}:{"ara-terminal.desktop":s(Pe)},...p.has("files")?{}:{"ara-files.desktop":s(Se)},"ara-chromium.desktop":s(ue).replace("chromium --no-sandbox %U",e.browserExec),"ara-set-root-wallpaper.py":Xe},start:['ticks() { line=$(cat "/proc/$1/stat" 2>/dev/null) || return 1; rest=${line##*) }; case $rest in Z*|X*) return 1;; esac; printf "%s" "$rest" | cut -d " " -f20; }','alive() { [ -f "$ROOT/$1.pid" ] || return 1; read -r pid start <"$ROOT/$1.pid"; current=$(ticks "$pid") || return 1; [ "$current" = "$start" ] && kill -0 "$pid" 2>/dev/null; }','launch() { name=$1; shift; "$@" 9>&- >"$ROOT/$name.log" 2>&1 & pid=$!; start=$(ticks "$pid"); printf "%s %s\\n" "$pid" "$start" >"$ROOT/$name.pid"; }',fe,'[ ! -f "$ROOT/ara-wallpaper.jpg" ] || set_wallpaper "$ROOT/ara-wallpaper.jpg" "$ROOT/ara-set-root-wallpaper.py" || true','if ! alive tint2 && command -v tint2 >/dev/null 2>&1; then launch tint2 tint2 -c "$ROOT/tint2/tint2rc"; fi','if ! alive picom && command -v picom >/dev/null 2>&1; then launch picom picom --config "$ROOT/picom/picom.conf"; fi']}}var Re=43200000,_=":99",de=60000,D=15000,L={width:1280,height:800},Ae=/^[A-Za-z0-9._:-]{1,160}$/;function Ne(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}var Ee=["video","viewer","viewer_same_network","viewer_network"];function Le(e,s=Date.now()){let p=["relay_url","session_id","expires_at"];if(!Ne(e)||p.some((c)=>!(c in e))||Object.keys(e).some((c)=>!p.includes(c)&&!Ee.includes(c)))throw new r("invalid_display_request","Reason desktop request is malformed.");let n="video"in e?Ao(e.video):void 0,t="viewer"in e?Gn(e.viewer):null;if(n===null)throw new r("invalid_display_request","Reason desktop video request is invalid.");let o=null;try{o=typeof e.relay_url==="string"?new URL(e.relay_url):null}catch{}if(!o||o.protocol!=="wss:"&&o.protocol!=="ws:"||o.username||o.password)throw new r("invalid_display_request","Reason desktop relay URL is invalid.");if(typeof e.session_id!=="string"||!Ae.test(e.session_id))throw new r("invalid_display_request","Reason desktop session identity is invalid.");let i=typeof e.expires_at==="string"?Date.parse(e.expires_at):Number.NaN;if(!Number.isFinite(i)||i<=s)throw new r("invalid_display_request","Reason desktop session has already expired.");return{relay_url:e.relay_url,session_id:e.session_id,expires_at:new Date(Math.min(i,s+Re)).toISOString(),...n?{video:n}:{},...t?{viewer:t}:{},...n&&e.viewer_same_network===!0?{viewer_same_network:!0}:{}}}function $t(e=process.platform){return(e==="linux"||e==="darwin"||e==="win32")&&x()?.features.display===!0}async function Ls(){if(process.platform==="win32")return $t()&&await Pr();if(process.platform!=="darwin")return $t();return await Pr()}function G(e){_e(e,{recursive:!0,mode:448});let s=Qe(e);if(!s.isDirectory()||s.isSymbolicLink()||process.getuid&&s.uid!==process.getuid())throw new r("display_unavailable","Reason desktop state directory is not private.");he(e,448)}function Je(e,s){let p=(t)=>{let o=Buffer.alloc(2);return o.writeUInt16BE(t.length),Buffer.concat([o,t])},n=Buffer.from([255,255]);return Buffer.concat([n,p(Buffer.alloc(0)),p(Buffer.from(e)),p(Buffer.from("MIT-MAGIC-COOKIE-1")),p(s)])}function f(e,s,p=2000){return new Promise((n)=>{let t=we(e),o="",i=(c)=>{t.destroy(),n(c)};t.setTimeout(p,()=>i(!1)),t.once("error",()=>i(!1)),t.once("close",()=>i(!1)),t.once("connect",()=>{if(!s)i(!0)}),t.on("data",(c)=>{if(o+=c.toString("latin1"),o.length>=4)i(o.startsWith("RFB "))})})}async function U(e,s){let p=Date.now()+s;while(Date.now()<p){if(await e())return!0;await new Promise((n)=>setTimeout(n,100))}return!1}function R(e,s,p){return new Promise((n)=>{let t=z(e,s,{detached:!0,stdio:"ignore",env:p});t.once("error",()=>n(-1)),t.once("exit",(o)=>n(o)),t.unref(),setTimeout(()=>n(null),D).unref()})}var J=null;function qe(e=a()){return J??=Ce(e).finally(()=>{J=null}),J}async function Ce(e){let s=x({home:e});if(!s?.xvfb||!s.x11vnc||!s.openbox)throw new r("display_unavailable","Run `reason desktop install` on this machine to enable its desktop.");kt({root:s.root,automation:s.automation,extensionDir:s.extensionDir});let p=y(s.root,"display");G(p);let n=await ge(e,p,s.x11vnc);if(n)return n;let t={display:_,xauthority:y(p,"Xauthority"),rfbSocket:y(p,"rfb.sock")},o=y(p,"pulse"),i=(async()=>{try{G(o)}catch{return null}return await ao(o,s.pulseaudio)})();G(y(p,"home"));let c=ee(p,t,s.pulseaudio),T=async()=>({...t,sound:await i});if(await f({path:t.rfbSocket},!0))return await T();if(!H(t.xauthority))C(t.xauthority,Je(_.slice(1),Te(16)),{mode:384,flag:"wx"});let l=se(y(p,"theme"),t.display,L),S={path:`/tmp/.X11-unix/X${_.slice(1)}`};if(!await f(S,!1)){let q=`${L.width}x${L.height}`;if(s.xvnc)I(t.rfbSocket,{force:!0}),R(s.xvnc,[t.display,"-geometry",q,"-depth","24","-nolisten","tcp","-auth",t.xauthority,"-rfbport","-1","-rfbunixpath",t.rfbSocket,"-SecurityTypes","None","-AlwaysShared","-desktop","Reason"],c);else R(s.xvfb,[t.display,"-screen","0",`${q}x24`,"-nolisten","tcp","-auth",t.xauthority],c);if(!await U(()=>f(S,!1),D)||s.xvnc&&!await U(()=>f({path:t.rfbSocket},!0),D))throw new r("display_unavailable","Reason could not start the virtual display.");R(s.openbox,["--config-file",l.openboxConfig],c)}if(await te(l,c),!await re(s.x11vnc,t,p,"x11vnc.log",c))throw new r("display_unavailable","Reason could not start the desktop server.");return await T()}function ee(e,s,p){let n={HOME:y(e,"home"),PATH:"/usr/local/bin:/usr/bin:/bin",DISPLAY:s.display,XAUTHORITY:s.xauthority};if(p)n.PULSE_SERVER=Ve(Pn(y(e,"pulse")));return n}async function re(e,s,p,n,t){if(await f({path:s.rfbSocket},!0))return!0;I(s.rfbSocket,{force:!0});let o=await R(e,["-display",s.display,"-auth",s.xauthority,"-rfbport","0","-rfbportv6","-1","-unixsock",s.rfbSocket,"-nopw","-forever","-shared","-noxdamage","-sb","0","-rfbversion","3.7","-quiet","-bg","-o",y(p,n)],t);if(o!==null&&o!==0)return!1;return await U(()=>f({path:s.rfbSocket},!0),D)}async function Ue(){let e=["DISPLAY","XAUTHORITY","WAYLAND_DISPLAY","XDG_SESSION_TYPE"],s=(p)=>Object.fromEntries(e.flatMap((n)=>p[n]?[[n,p[n]]]:[]));if(process.env.DISPLAY)return s(process.env);try{let p=await new Promise((n,t)=>Y("systemctl",["--user","show-environment"],{encoding:"utf8",timeout:2000},(o,i)=>o?t(o):n(i)));return s(Object.fromEntries(p.split(`
124
+ `).flatMap((n)=>{let t=n.indexOf("=");return t>0?[[n.slice(0,t),n.slice(t+1)]]:[]})))}catch{return{}}}var V=new Set;async function ge(e,s,p){let n=await Ue(),t=/^:(\d+)(?:\.\d+)?$/.exec(n.DISPLAY??"")?.[1];if(!t||`:${t}`===_||n.WAYLAND_DISPLAY||n.XDG_SESSION_TYPE==="wayland")return null;let o={display:`:${t}`,xauthority:n.XAUTHORITY??y(e,".Xauthority"),rfbSocket:y(s,`rfb-${t}.sock`)},i=`${o.display} ${o.xauthority}`;if(V.has(i)||!await f({path:`/tmp/.X11-unix/X${t}`},!1))return null;let c={HOME:e,PATH:"/usr/local/bin:/usr/bin:/bin",DISPLAY:o.display,XAUTHORITY:o.xauthority};if(await re(p,o,s,`x11vnc-${t}.log`,c))return{...o,sound:null};return V.add(i),process.stderr.write(`Reason worker: your screen ${o.display} could not be served; using the virtual desktop
125
+ `),null}function se(e,s,p){let n=`chromium --no-first-run --no-default-browser-check${process.geteuid?.()===0?" --no-sandbox":""} %U`,t=[["terminal","xterm"],["files","pcmanfm"]].filter(([,i])=>!H(`/usr/bin/${i}`)).map(([i])=>i),o=v({root:e,display:s,screen:p,browserExec:n,absent:t});for(let i of["","openbox","tint2","picom"])G(y(e,i));for(let[i,c]of Object.entries(o.files))C(y(e,i),c,{mode:384});for(let[i,c]of Object.entries(K))C(y(e,`ara-${i}`),De(c),{mode:384});return{root:e,openboxConfig:y(e,"openbox","rc.xml"),start:o.start}}async function te(e,s){let p=[`ROOT=${JSON.stringify(e.root)}`,...e.start,"openbox --reconfigure >/dev/null 2>&1 || true"].join(`
126
+ `);await new Promise((n)=>{let t=z("/bin/sh",["-c",p],{stdio:"ignore",env:{...s,PATH:"/usr/bin:/bin"}}),o=setTimeout(()=>{t.kill(),n()},D);t.once("error",()=>{clearTimeout(o),n()}),t.once("exit",()=>{clearTimeout(o),n()})})}var me=2073600,Me=320;function We(e,s){let p=Math.min(1,Math.sqrt(me/(e.width*e.height))),n=(t,o)=>Math.min(Math.floor(o/8)*8,Math.max(Me,Math.round(t*p/8)*8));return{width:n(e.width,s.width),height:n(e.height,s.height)}}function ne(e,s,p){return new Promise((n)=>Y(e,s,{env:p,encoding:"utf8",timeout:5000},(t,o)=>n(t?null:o)))}function je(e){let s=/current (\d+) x (\d+), maximum (\d+) x (\d+)/.exec(e),p=e.split(`
127
+ `),n=p.findIndex((o)=>/^\S+ connected/.test(o));if(!s||n<0)return null;let t=[];for(let o of p.slice(n+1)){let i=/^\s+(\d+x\d+)\s/.exec(o);if(!i)break;t.push(i[1])}return{current:{width:Number(s[1]),height:Number(s[2])},maximum:{width:Number(s[3]),height:Number(s[4])},output:p[n].split(" ")[0],modes:t}}async function Be(e,s,p){if(e.display!==_)return null;let n={PATH:"/usr/bin:/bin",DISPLAY:e.display,XAUTHORITY:e.xauthority},t=(T)=>ne("xrandr",T,n),o=je(await t(["--query"])??"");if(!o||o.maximum.width<=o.current.width&&o.maximum.height<=o.current.height)return null;let i=We(s,o.maximum);if(i.width===o.current.width&&i.height===o.current.height)return{size:i,changed:!1};let c=`${i.width}x${i.height}`;if(!o.modes.includes(c)){if(await t(["--newmode",c,"60",...[i.width,i.width,i.width,i.width,i.height,i.height,i.height,i.height].map(String)]),await t(["--addmode",o.output,c])===null)return null}return p(),await t(["--output",o.output,"--mode",c])===null?null:{size:i,changed:!0}}async function Oe(e,s){let p=x({home:a()});if(!p)return;let n=y(p.root,"display"),t=ee(n,e,p.pulseaudio);await te(se(y(n,"theme"),e.display,s),t);let o=s.width-P*2,i=s.height-P-w;await ne("xdotool",["search","--onlyvisible","--class","Chromium","windowsize","%@",String(o),String(i),"windowmove","%@",String(P),String(P)],{...t,PATH:"/usr/bin:/bin"})}var Z=Promise.resolve();function Fe(e,s,p=()=>{}){let n=Z.then(()=>Be(e,s,p));return Z=n.then((t)=>t?.changed?Oe(e,t.size):void 0).catch(()=>{}),n.then((t)=>t?.size??null,()=>null)}async function Bt(e,s={}){let p=s.now??Date.now,n=Le(e.payload,p());if(e.signal.throwIfAborted(),!n.video)throw new r("display_video_required","Reason desktops stream as video now; this request came without it.");let t=s.platform??process.platform;if(t!=="linux"&&t!=="darwin"&&t!=="win32")throw new r("display_video_unsupported","This machine does not serve desktop video.");let o=n.video,i=(s.video?.desktop??(t==="darwin"?async()=>Tn:t==="win32"?async()=>Rn:qe))();return await ke(e.signal,n,s,p,(c)=>On(c,{request:o,desktop:i,...n.viewer?{viewer:n.viewer}:{},viewerSameNetwork:n.viewer_same_network===!0},{resizeDesktop:Fe,...s.video}),(c)=>Jt({type:"error",code:c}))}function ke(e,s,p,n,t,o){let i=n();return new Promise((c,T)=>{let l=null,S=!1,q=!1,g,d,h,m=!1,u=null,X=(b)=>{if(q)return;if(u)b=u;q=!0,clearTimeout(g),clearTimeout(d),e.removeEventListener("abort",N),h?.close();try{l?.close(1000,"display_session_over")}catch{}if("error"in b){T(b.error);return}c({reason:b.reason,...h?.summary(),duration_ms:Math.max(0,n()-i)})},A=()=>X({error:new r("display_relay_unavailable","Reason could not reach the desktop relay.")}),N=()=>{let b=e.reason;X({error:b instanceof r?b:new r("cancelled","Reason closed the desktop session.")})},M=()=>{if(!u||!l)return;let b=u.error;try{l.send(o(b instanceof r?b.code:"display_unavailable"))}catch{}X(u)};if(h=t({get done(){return q||u!==null},get open(){return S&&!q&&u===null},get bufferedAmount(){return l?.bufferedAmount??0},send(b){if(q||u||!S||!l)return;try{l.send(b)}catch{X({reason:"relay_closed"})}},end:(b)=>{if(q||u)return;if(!("error"in b)){X(b);return}if(u=b,m&&S)M()}}),q){h.close();return}if(e.aborted){N();return}e.addEventListener("abort",N,{once:!0}),g=setTimeout(()=>X({reason:"session_expired"}),Math.max(1,Date.parse(s.expires_at)-n())),d=setTimeout(()=>X({reason:"viewer_absent"}),p.viewerWaitMs??de);try{l=(p.connect??Ir)(s.relay_url,(p.loadProxy??j)()?.url)}catch{A();return}l.binaryType="arraybuffer",l.onopen=()=>{if(q||!l)return;S=!0,h?.opened()},l.onmessage=(b)=>{if(q)return;let Q=b.data,E=Q instanceof ArrayBuffer?new Uint8Array(Q):ArrayBuffer.isView(Q)?new Uint8Array(Q.buffer,Q.byteOffset,Q.byteLength):null;if(!E||E.byteLength===0)return;if(clearTimeout(d),m=!0,u){M();return}h?.received(E)},l.onclose=()=>{if(q)return;if(!S){A();return}X({reason:"relay_closed"})},l.onerror=()=>{if(q||S)return;A()}})}
128
+ export{$t,Ls,G,qe,Bt};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{er}from"./vm-hands-entry-lite-706c7f7x.js";var _t=er.version;export{_t};