@reason-machines/cli-linux-x64 0.2.393 → 0.2.394
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/reason +1 -1
- package/bin/vm-hands/api-credentials-200ret9z.js +2 -0
- package/bin/vm-hands/api-jcccjxss.js +2 -0
- package/bin/vm-hands/{ask-relay-q0ysjj22.js → ask-relay-3cek7z3p.js} +3 -3
- package/bin/vm-hands/connect-cli-vjrqqwcb.js +2 -0
- package/bin/vm-hands/{custom-endpoint-device-3g0rc3wp.js → custom-endpoint-device-qd3zcysz.js} +1 -1
- package/bin/vm-hands/desktop-account-r5fsgx43.js +2 -0
- package/bin/vm-hands/{device-workspace-35hjc1ff.js → device-workspace-ntckpym4.js} +1 -1
- package/bin/vm-hands/{hands-worker-source-msdkfx9x.js → hands-worker-source-p6530nj7.js} +1 -1
- package/bin/vm-hands/{index-m32pjcjr.js → index-z6q2j1e0.js} +1 -1
- package/bin/vm-hands/install-receipt-kqayxfsn.js +2 -0
- package/bin/vm-hands/local-automation-s04b6p1s.js +2 -0
- package/bin/vm-hands/local-capabilities-x34aehzt.js +2 -0
- package/bin/vm-hands/local-desktop-users-7kbrnvba.js +2 -0
- package/bin/vm-hands/local-display-mac-0k5twcjj.js +2 -0
- package/bin/vm-hands/local-display-session-etdwwy0w.js +2 -0
- package/bin/vm-hands/local-pty-session-a0fz1f9t.js +2 -0
- package/bin/vm-hands/{managed-runtime-bgbzjn5s.js → managed-runtime-3xskn9nc.js} +1 -1
- package/bin/vm-hands/{network-contract-3h853c6e.js → network-contract-xgbrevt2.js} +1 -1
- package/bin/vm-hands/package-x8ct3epg.js +2 -0
- package/bin/vm-hands/permissions-9y5zk8r0.js +2 -0
- package/bin/vm-hands/{reason-hands-protocol-mw7ba8vz.js → reason-hands-protocol-90kpyg4s.js} +1 -1
- package/bin/vm-hands/{serve-service-qqrsrb6k.js → serve-service-e8xp70yg.js} +1 -1
- package/bin/vm-hands/{status-g0yna6nk.js → status-fnnjxbx6.js} +2 -2
- package/bin/vm-hands/version-t0b2cxf1.js +2 -0
- package/bin/vm-hands/{vm-hands-entry-lite-180h5amj.js → vm-hands-entry-lite-0nd56w02.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-a1yy1yp3.js → vm-hands-entry-lite-1cs1jy20.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-pjctaaxx.js → vm-hands-entry-lite-1ndnrf11.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-3nr9q3nf.js → vm-hands-entry-lite-29f3m7x2.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-5x04hakp.js → vm-hands-entry-lite-2sx1a43v.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-3ptq7p60.js → vm-hands-entry-lite-34h6rv5c.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-f78n4wqt.js → vm-hands-entry-lite-5d31qv44.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-g87z5eb6.js → vm-hands-entry-lite-69n9q5f1.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-ezahexcb.js → vm-hands-entry-lite-6nj2ejfh.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-3xtndjrw.js → vm-hands-entry-lite-7e41q634.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-y64x380n.js → vm-hands-entry-lite-7f9asswm.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-nnmhnxqs.js → vm-hands-entry-lite-a2wbh54x.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-8e932j3c.js → vm-hands-entry-lite-bgs4zjkf.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-trm3dn8c.js → vm-hands-entry-lite-cfwke54v.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-c7qb87xk.js → vm-hands-entry-lite-ctx006e7.js} +3 -3
- package/bin/vm-hands/{vm-hands-entry-lite-88h9vwrv.js → vm-hands-entry-lite-e1cbqqqw.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-r166b92s.js → vm-hands-entry-lite-e4kdpq0t.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-h0keewxv.js → vm-hands-entry-lite-e99ftdr6.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-ksz1k1dh.js → vm-hands-entry-lite-eatqxe5y.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-fb02h1zm.js → vm-hands-entry-lite-ek5r435m.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-atg4z1vg.js → vm-hands-entry-lite-f50vcbjg.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-8pgggvbb.js → vm-hands-entry-lite-f9akybcm.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-9rnba1mg.js → vm-hands-entry-lite-fy8zabtd.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-csecgmaa.js → vm-hands-entry-lite-gk3y60ap.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-1edhwzhg.js → vm-hands-entry-lite-gvstv2dh.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-ebgackey.js → vm-hands-entry-lite-hx4w3r63.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-9gjjvcmz.js → vm-hands-entry-lite-k4erfh5k.js} +1 -1
- package/bin/vm-hands/vm-hands-entry-lite-kbjh8x26.js +5 -0
- package/bin/vm-hands/{vm-hands-entry-lite-0apahx7m.js → vm-hands-entry-lite-mzsx3wcy.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-n3y7495e.js → vm-hands-entry-lite-ps9gjbs5.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-hfv2tsm9.js → vm-hands-entry-lite-q5h859gg.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-y99g8x7f.js → vm-hands-entry-lite-q62fwa20.js} +1 -1
- package/bin/vm-hands/vm-hands-entry-lite-qmzjqwh4.js +105 -0
- package/bin/vm-hands/{vm-hands-entry-lite-02zaqpgh.js → vm-hands-entry-lite-qvj5560v.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-t7g13jac.js → vm-hands-entry-lite-r5pq4tkf.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-na1vayq4.js → vm-hands-entry-lite-rdx8pt8v.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-mft9ke08.js → vm-hands-entry-lite-sbn9bmf7.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-p1s0xyc2.js → vm-hands-entry-lite-sjn5yjvx.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-e73s63fb.js → vm-hands-entry-lite-smrymax6.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-yr1n57v6.js → vm-hands-entry-lite-t839nkd2.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-mc3pkj0q.js → vm-hands-entry-lite-v0kpksbf.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-wpcagqfw.js → vm-hands-entry-lite-vqfpryez.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-z4q7mrn5.js → vm-hands-entry-lite-w6wz3jqh.js} +7 -7
- package/bin/vm-hands/{vm-hands-entry-lite-0seprnh3.js → vm-hands-entry-lite-xhbjkkk5.js} +1 -1
- package/bin/vm-hands/vm-hands-entry-lite.js +1 -1
- package/bin/vm-hands/{vm-hands-executor-mz0bewc9.js → vm-hands-executor-w3w2wkh8.js} +1 -1
- package/bin/vm-hands/vm-hands-op-runner-s5ep05ke.js +2 -0
- package/bin/vm-hands/{vm-hands-runtime-h39vjxh4.js → vm-hands-runtime-wfjwxqbh.js} +3 -3
- package/bin/vm-hands/worker-sandbox-ecjj14h5.js +2 -0
- package/package.json +1 -1
- package/bin/vm-hands/api-2edgrjpe.js +0 -2
- package/bin/vm-hands/api-credentials-1bfy2pqp.js +0 -2
- package/bin/vm-hands/connect-cli-9xve38p0.js +0 -2
- package/bin/vm-hands/desktop-account-8yf4aqgb.js +0 -2
- package/bin/vm-hands/install-receipt-7qanbz38.js +0 -2
- package/bin/vm-hands/local-automation-svznxf54.js +0 -2
- package/bin/vm-hands/local-capabilities-a2fhpy8v.js +0 -2
- package/bin/vm-hands/local-desktop-users-p6n48895.js +0 -2
- package/bin/vm-hands/local-display-mac-7havkbhd.js +0 -2
- package/bin/vm-hands/local-display-session-42vasad3.js +0 -2
- package/bin/vm-hands/local-pty-session-pe20a847.js +0 -2
- package/bin/vm-hands/package-04cf0m62.js +0 -2
- package/bin/vm-hands/permissions-2ez0eqav.js +0 -2
- package/bin/vm-hands/version-5tfam1n3.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-0z73amf7.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-vc06etcb.js +0 -105
- package/bin/vm-hands/vm-hands-op-runner-6vttwrek.js +0 -2
- package/bin/vm-hands/worker-sandbox-nnk7fq89.js +0 -2
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ne as Qz,pe as R,se as Zz}from"./vm-hands-entry-lite-0z73amf7.js";import{ni as zz}from"./vm-hands-entry-lite-csecgmaa.js";import{Di as e}from"./vm-hands-entry-lite-ksz1k1dh.js";import{Xi as Hz,jj as V,lj as Jz}from"./vm-hands-entry-lite-na1vayq4.js";import{xk as X}from"./vm-hands-entry-lite-fb02h1zm.js";import{spawnSync as C}from"child_process";import{createHash as Pz,randomUUID as Iz}from"crypto";import{chmodSync as Wz,existsSync as y,mkdirSync as bz,readdirSync as Sz,readFileSync as L,renameSync as wz,rmSync as Y,statSync as _z,writeFileSync as xz}from"fs";import{dirname as Rz,isAbsolute as $z,join as N}from"path";import{spawnSync as Az}from"child_process";import{readFileSync as Oz}from"fs";import{userInfo as v}from"os";import{join as Cz}from"path";var Kz="REASON_SCHEDULED_TASK";function l(H){return Cz(H,"AppData","Local","Reason","Tasks")}function A(H){if(/[\0-\x1f\x7f"%]/.test(H))throw Error(`A background task cannot use a value with a double quote, percent sign or control character: ${H}`);return`'${H.replace(/['\u2018\u2019\u201a\u201b]/g,"$&$&")}'`}function a(H){if(!/^[A-Za-z0-9._-]+$/.test(H))throw Error(`Invalid Windows Scheduled Task name: ${H}`);return`$env:${Kz}=${A(H)};`}function c(H){let z=Object.entries(H.environment).map(([Q,Z])=>{if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(Q))throw Error(`Invalid Windows Scheduled Task environment name: ${Q}`);return`$env:${Q}=${A(Z)};`}),J=`$global:LASTEXITCODE=1; & ${[H.program,...H.args].map(A).join(" ")} 2>&1 | ForEach-Object { Add-Content -LiteralPath ${A(H.log)} -Value $_.ToString() -Encoding UTF8 }; $c=$LASTEXITCODE;`;return[a(H.name),...z,"$ErrorActionPreference='Continue';",H.keepAlive?`do { ${J} if ($c) { Start-Sleep -Seconds 10 } } while ($c)`:`${J} exit $c`].join(" ")}function S(H){return H.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function Vz(){let H=process.env.USERDOMAIN?.trim();return H?`${H}\\${v().username}`:v().username}function h(H){let z=S(H.user??Vz()),J=H.schedule==="logon",Q=H.schedule==="logon"?`<LogonTrigger><Enabled>true</Enabled><UserId>${z}</UserId></LogonTrigger>`:`<TimeTrigger><Repetition><Interval>PT${H.schedule.everyMinutes}M</Interval><StopAtDurationEnd>false</StopAtDurationEnd></Repetition><StartBoundary>2026-01-01T00:00:00</StartBoundary><Enabled>true</Enabled></TimeTrigger>`,Z=`-NoProfile -NonInteractive -ExecutionPolicy Bypass -WindowStyle Hidden -Command "${H.script}"`;return`<?xml version="1.0" encoding="UTF-16"?>
|
|
3
|
-
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
4
|
-
<RegistrationInfo>
|
|
5
|
-
<Description>${S(H.description)}</Description>
|
|
6
|
-
</RegistrationInfo>
|
|
7
|
-
<Triggers>
|
|
8
|
-
${Q}
|
|
9
|
-
</Triggers>
|
|
10
|
-
<Principals>
|
|
11
|
-
<Principal id="Author">
|
|
12
|
-
<UserId>${z}</UserId>
|
|
13
|
-
<LogonType>InteractiveToken</LogonType>
|
|
14
|
-
<RunLevel>LeastPrivilege</RunLevel>
|
|
15
|
-
</Principal>
|
|
16
|
-
</Principals>
|
|
17
|
-
<Settings>
|
|
18
|
-
<MultipleInstancesPolicy>${J?"StopExisting":"IgnoreNew"}</MultipleInstancesPolicy>
|
|
19
|
-
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
|
|
20
|
-
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
|
|
21
|
-
<StartWhenAvailable>true</StartWhenAvailable>
|
|
22
|
-
<IdleSettings>
|
|
23
|
-
<StopOnIdleEnd>false</StopOnIdleEnd>
|
|
24
|
-
<RestartOnIdle>false</RestartOnIdle>
|
|
25
|
-
</IdleSettings>
|
|
26
|
-
<ExecutionTimeLimit>${J?"PT0S":"PT1H"}</ExecutionTimeLimit>
|
|
27
|
-
<Priority>${J?5:7}</Priority>
|
|
28
|
-
</Settings>
|
|
29
|
-
<Actions Context="Author">
|
|
30
|
-
<Exec>
|
|
31
|
-
<Command>%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe</Command>
|
|
32
|
-
<Arguments>${S(Z)}</Arguments>
|
|
33
|
-
</Exec>
|
|
34
|
-
</Actions>
|
|
35
|
-
</Task>
|
|
36
|
-
`}function n(H){return Buffer.concat([Buffer.from([255,254]),Buffer.from(H.replaceAll(`\r
|
|
37
|
-
`,`
|
|
38
|
-
`).replaceAll(`
|
|
39
|
-
`,`\r
|
|
40
|
-
`),"utf16le")])}function r(H){let z=Oz(H);return(z[0]===255&&z[1]===254?z.subarray(2).toString("utf16le"):z.toString("utf8")).replaceAll(`\r
|
|
41
|
-
`,`
|
|
42
|
-
`)}function i(H,z){return["/Create","/TN",H,"/XML",z,"/F"]}function w(H){return["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",Buffer.from(H,"utf16le").toString("base64")]}function _(H){return`'*${a(H).replaceAll("'","''")}*'`}function x(H,z){return w(["$all = @(Get-CimInstance Win32_Process)",`$wrappers = @($all | ? { $_.ProcessId -ne $PID -and $_.CommandLine -like ${_(H)} })`,...z.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 ${z.tree?"/T ":""}/PID $_.ProcessId | Out-Null } }`].join(`
|
|
43
|
-
`))}function s(H){return w(["$all = @(Get-CimInstance Win32_Process)",`$wrappers = @($all | ? { $_.ProcessId -ne $PID -and $_.CommandLine -like ${_(H)} })`,"foreach ($w in $wrappers) { if ($all | ? { $_.ParentProcessId -eq $w.ProcessId -and $_.Name -ne 'conhost.exe' }) { 'running'; exit 0 } }","exit 1"].join(`
|
|
44
|
-
`))}function t(H,z=process.pid){let J=Az(X("powershell.exe"),w(["$all = @{}; Get-CimInstance Win32_Process | % { $all[[int]$_.ProcessId] = $_ }",`$p = $all[${Math.trunc(z)}]`,"for ($i = 0; $p -and $i -lt 64; $i++) {",` if ($p.CommandLine -like ${_(H)}) { 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 J.status===10?!0:J.status===11?!1:null}var P="REASON_WORKER_SERVICE",yz="worker_identity_unavailable";function BH(H){return{platform:process.platform,home:H,uid:process.getuid?.(),command:(z,J)=>C(X(z),[...J],{stdio:"ignore"}).status??1,read:(z,J)=>{let Q=C(X(z),[...J],{stdio:["ignore","pipe","ignore"],encoding:"utf8",timeout:1e4});return Q.status===0?Q.stdout:null},sleep:(z)=>Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,z),workerIdentity:(z)=>Jz(H,z),insideService:(z,J)=>kz(z,process.platform,process.getuid?.(),J)}}function kz(H,z,J,Q=!0){if(process.env[P]===H||process.env.XPC_SERVICE_NAME===H)return!0;if(z==="linux")try{return L("/proc/self/cgroup","utf8").includes(`/${H}.service`)}catch{return!0}if(z==="win32")return t(H)??Q;if(z!=="darwin")return!1;if(typeof J!=="number")return!0;let Z=C("/bin/launchctl",["print",`gui/${J}/${H}`],{encoding:"utf8",timeout:5000});if(Z.status===Ez)return!1;if(Z.error||Z.status!==0)return!0;let q=Number(/^\s*pid = (\d+)$/m.exec(Z.stdout??"")?.[1]??0);if(!q)return!1;let B=process.pid;for(let $=0;$<64&&B>1;$+=1){if(B===q)return!0;let j=C("/bin/ps",["-o","ppid=","-p",String(B)],{encoding:"utf8",timeout:5000}),G=Number(j.stdout?.trim());if(j.error||j.status!==0||!Number.isSafeInteger(G)||G<=0)return!0;if(G===B)return!1;B=G}return B>1}var Ez=113;class M extends Error{code;constructor(H,z){super(H);this.code=z}}function qH(H,z){if(!u(H.home,H.platform))throw new M(Gz);if(H.platform==="darwin")F(H);let J=Zz(Qz(z,H.home)),Q=zz({env:z})==="staging",Z=Q?"ara-staging":"ara",q=[J?.owned_paths.find((B)=>B.role==="launcher")?.path,e(z,"REASON_CLI_LAUNCHER_PATH")?.trim(),H.platform==="win32"?N(H.home,"AppData","Local","Reason",...Q?["staging"]:[],"bin",Q?"reason-staging.exe":"reason.exe"):N(H.home,".local","bin",Z)];for(let B of q)try{if(B&&$z(B)&&_z(B).isFile())return R(B)}catch{}throw new M(`A background service runs the installed Reason launcher, which was not found. Install Reason with: ${H.platform==="win32"?"irm https://reasonmachines.com/install.ps1 | iex":"curl -fsSL https://reasonmachines.com/install | sh"}`,"worker_launcher_missing")}var k=/(<key>ProgramArguments<\/key>\s*<array>\n)((?:\s*<string>[^<]*<\/string>\n)*)(\s*<\/array>)/,O=new RegExp(`(\\n\\s*<key>${V}</key>\\s*<string>)[^<]*(</string>)`),fz=/(<key>EnvironmentVariables<\/key>\s*<dict>[\s\S]*?)(\n\s*<\/dict>)/;function mz(H){return H.replaceAll("<","<").replaceAll(">",">").replaceAll(""",'"').replaceAll("'","'").replaceAll("&","&")}function E(H){let z=[...(k.exec(H)?.[2]??"").matchAll(/<string>([^<]*)<\/string>/g)].map((Q)=>mz(Q[1])),J=z[1]==="--run-worker"?z.slice(2):z;return J[0]?{launcher:J[0],args:J.slice(1)}:null}function jH(H,z){if(!dz(z))return null;try{return E(L(N(H,"Library","LaunchAgents",`${z}.plist`),"utf8"))?.launcher??null}catch{return null}}function Bz(H,z,J){let Q=J.workerIdentity?.(H)??null;return{program:Q?[Q.executable,"--run-worker",H,...z]:[H,...z],identity:Q}}function f(H){return H.map((z)=>` <string>${D(z)}</string>`).join(`
|
|
46
|
-
`)}function qz(H,z){let J;try{J=L(H,"utf8")}catch{return null}let Q=E(J);if(!Q)return null;let Z=$z(Q.launcher)?R(Q.launcher):Q.launcher,{program:q,identity:B}=Bz(Z,Q.args,z),$=J.replace(k,(j,G,U,g)=>`${G}${f(q)}
|
|
47
|
-
${g}`);if(!B)$=$.replace(O,"");else if(O.test($))$=$.replace(O,(j,G,U)=>`${G}${D(B.app)}${U}`);else $=$.replace(fz,(j,G,U)=>`${G}
|
|
48
|
-
<key>${V}</key>
|
|
49
|
-
<string>${D(B.app)}</string>${U}`);return $===J?null:$}function uz(H,z){let J=qz(H,z);if(J!==null)b(H,J)}function GH(H,z,J){if(z.platform!=="darwin")return!1;let Q=d(H,z,J);return Q!==null&&qz(Q.definition,z)!==null}var I="com.reasonmachines.worker.",m="so.reason.worker.",W=[I,m];function dz(H){return W.some((z)=>H.startsWith(z)&&/^[A-Za-z0-9._-]+$/.test(H.slice(z.length)))}function jz(H,z=I){return`${z}connect${H==="production"?"":`.${H}`}`}function MH(H,z){return W.some((J)=>H===jz(z,J))}function pz(H,z,J){if(z==="connect")return jz(H.channel,J);let Q=Pz("sha256").update(H.workspaceRoot).digest("hex").slice(0,8);return`${J}${H.name.toLowerCase()}.${Q}`}var Gz="A background service needs macOS (launchd), Linux (systemd --user) or Windows (Task Scheduler).";function u(H,z){if(z==="darwin")return{directory:N(H,"Library","LaunchAgents"),suffix:".plist"};if(z==="linux")return{directory:N(H,".config","systemd","user"),suffix:".service"};if(z==="win32")return{directory:l(H),suffix:".xml"};return null}function T(H,z,J,Q=I){let Z=pz(H,J,Q),q=u(z.home,z.platform);if(!q)return null;return{label:Z,definition:N(q.directory,`${Z}${q.suffix}`),logs:z.platform==="linux"?`journalctl --user -u ${Z}.service`:N(H.stateDirectory,"service.log")}}function YH(H,z){let J=u(H,z);if(!J)return[];try{return Sz(J.directory).filter((Q)=>W.some((Z)=>Q.startsWith(Z))&&Q.endsWith(J.suffix)).sort().map((Q)=>N(J.directory,Q))}catch{return[]}}function d(H,z,J="serve"){return Mz(H,z,J)[0]??null}function Mz(H,z,J){return W.map((Q)=>T(H,z,J,Q)).filter((Q)=>Q!==null&&y(Q.definition))}function Yz(H,z,J){let Q=T(H,z,J,m);return Q&&y(Q.definition)?Q:null}function gz(H,z,J){let Q=T(H,z,J),Z=Yz(H,z,J);if(!Q||!Z||!y(Q.definition)||z.insideService?.(Z.label))return null;if(!vz(Q,z))return"current_not_running";if(z.platform==="darwin"){if(typeof z.uid==="number"&&z.uid>0)z.command("/bin/launchctl",["bootout",`gui/${z.uid}/${Z.label}`]);return Y(Z.definition,{force:!0}),"retired"}if(z.platform==="win32")return K(Z,z,!0),"retired";return z.command("systemctl",["--user","disable","--now",`${Z.label}.service`]),Y(Z.definition,{force:!0}),z.command("systemctl",["--user","daemon-reload"]),"retired"}function vz(H,z){if(z.platform==="darwin")return typeof z.uid==="number"&&z.uid>0&&z.command("/bin/launchctl",["print",`gui/${z.uid}/${H.label}`])===0;if(z.platform==="win32")return z.command("schtasks",["/Query","/TN",H.label])===0;let J=`${H.label}.service`;return z.command("systemctl",["--user","is-enabled","--quiet",J])===0&&lz.has(z.read("systemctl",["--user","show","--property=ActiveState","--value",J])?.trim()??"")}var lz=new Set(["active","activating","reloading"]);function DH(H,z){if(z.platform==="darwin"){if(typeof z.uid!=="number"||z.uid<=0)return!1;let J=z.read("/bin/launchctl",["print",`gui/${z.uid}/${H.label}`]);return Number(/^\s*pid = (\d+)$/m.exec(J??"")?.[1]??0)>0}if(z.platform==="win32")return z.read("powershell.exe",s(H.label))?.trim()==="running";return Number(z.read("systemctl",["--user","show","--property=MainPID","--value",`${H.label}.service`])?.trim()??0)>0}function UH(H){let{config:z,launcher:J,host:Q,kind:Z}=H,q=T(z,Q,Z);if(!q)return!1;let B;try{B=Q.platform==="win32"?r(q.definition):L(q.definition,"utf8")}catch{return!1}if(Q.platform==="win32")return B===Nz(z,Z,q,J);if(Q.platform!=="darwin")return B===Uz(z,Z,q,J,Q.home,H.path);let $=E(B);return B.replace(O,"").replace(k,(G,U,g,Fz)=>`${U}${$?`${f([$.launcher,...$.args])}
|
|
50
|
-
`:""}${Fz}`)===Dz(z,Z,q,J,{...Q,workerIdentity:()=>null},H.path).plist}function p(H,z){if(z==="connect")return{args:["connect"],environment:{REASON_CLI_CHANNEL:H.channel},description:"Reason connection of this computer"};return{args:["serve",H.name,"--dir",H.workspaceRoot,...H.executionMode==="confined"?["--sandbox"]:[]],environment:{},description:`Reason machine ${H.name} worker`}}function D(H){return H.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function o(H,z=!1){if(/[\0-\x1f\x7f]/.test(H))throw new M("A background service cannot use a path with control characters.");let J=H.replaceAll("\\","\\\\").replaceAll('"',"\\\"").replaceAll("%","%%");return`"${z?J.replaceAll("$","$$$$"):J}"`}function Dz(H,z,J,Q,Z,q){let B=p(H,z),$=Bz(Q,B.args,Z),j={HOME:Z.home,PATH:q,[P]:J.label,...B.environment,...$.identity?{[V]:$.identity.app}:{}};return{identity:$.identity,plist:`<?xml version="1.0" encoding="UTF-8"?>
|
|
51
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
52
|
-
<plist version="1.0">
|
|
53
|
-
<dict>
|
|
54
|
-
<key>Label</key>
|
|
55
|
-
<string>${D(J.label)}</string>
|
|
56
|
-
<key>AssociatedBundleIdentifiers</key>
|
|
57
|
-
<array>
|
|
58
|
-
<string>${Hz}</string>
|
|
59
|
-
</array>
|
|
60
|
-
<key>ProgramArguments</key>
|
|
61
|
-
<array>
|
|
62
|
-
${f($.program)}
|
|
63
|
-
</array>
|
|
64
|
-
<key>EnvironmentVariables</key>
|
|
65
|
-
<dict>
|
|
66
|
-
${Object.entries(j).map(([G,U])=>` <key>${G}</key>
|
|
67
|
-
<string>${D(U)}</string>`).join(`
|
|
68
|
-
`)}
|
|
69
|
-
</dict>
|
|
70
|
-
<key>RunAtLoad</key>
|
|
71
|
-
<true/>
|
|
72
|
-
<key>KeepAlive</key>
|
|
73
|
-
<dict>
|
|
74
|
-
<key>SuccessfulExit</key>
|
|
75
|
-
<false/>
|
|
76
|
-
</dict>
|
|
77
|
-
<key>ThrottleInterval</key>
|
|
78
|
-
<integer>10</integer>
|
|
79
|
-
<key>ExitTimeOut</key>
|
|
80
|
-
<integer>${Math.ceil(H.shutdownGraceMs/1000)+10}</integer>
|
|
81
|
-
<key>ProcessType</key>
|
|
82
|
-
<string>Standard</string>
|
|
83
|
-
<key>Umask</key>
|
|
84
|
-
<integer>63</integer>
|
|
85
|
-
<key>StandardOutPath</key>
|
|
86
|
-
<string>${D(J.logs)}</string>
|
|
87
|
-
<key>StandardErrorPath</key>
|
|
88
|
-
<string>${D(J.logs)}</string>
|
|
89
|
-
</dict>
|
|
90
|
-
</plist>
|
|
91
|
-
`}}function Uz(H,z,J,Q,Z,q){let B=p(H,z);return`[Unit]
|
|
92
|
-
Description=${B.description}
|
|
93
|
-
|
|
94
|
-
[Service]
|
|
95
|
-
ExecStart=${[Q,...B.args].map(($)=>o($,!0)).join(" ")}
|
|
96
|
-
Environment=${[`HOME=${Z}`,`PATH=${q}`,`${P}=${J.label}`,...Object.entries(B.environment).map(([$,j])=>`${$}=${j}`)].map(($)=>o($)).join(" ")}
|
|
97
|
-
Restart=on-failure
|
|
98
|
-
RestartSec=10
|
|
99
|
-
TimeoutStopSec=${Math.ceil(H.shutdownGraceMs/1000)+10}
|
|
100
|
-
UMask=0077
|
|
101
|
-
|
|
102
|
-
[Install]
|
|
103
|
-
WantedBy=default.target
|
|
104
|
-
`}function Nz(H,z,J,Q){let Z=p(H,z);return h({description:Z.description,schedule:"logon",script:c({name:J.label,program:Q,args:Z.args,environment:{[P]:J.label,...Z.environment},log:J.logs,keepAlive:!0})})}function Tz(H,z,J){z.command("powershell.exe",x(H.label,{tree:J,keepWrapper:!J}))}function K(H,z,J){z.command("schtasks",["/Delete","/F","/TN",H.label]),z.command("powershell.exe",x(H.label,{tree:J,keepWrapper:!1})),Y(H.definition,{force:!0})}function b(H,z){bz(Rz(H),{recursive:!0,mode:448});let J=`${H}.${Iz()}.tmp`;try{xz(J,z,{mode:384,flag:"wx"}),Wz(J,384),wz(J,H)}finally{Y(J,{force:!0})}}function F(H){if(typeof H.uid!=="number"||!Number.isSafeInteger(H.uid)||H.uid<=0)throw new M("Set up a background service as your own user, not with sudo.","worker_service_root_user");return`gui/${H.uid}`}function NH(H){let{config:z,launcher:J,host:Q}=H,Z=H.kind??"serve",q=Yz(z,Q,Z),B=q!==null&&Q.insideService?.(q.label)===!0,$=T(z,Q,Z,B?m:I);if(!$)throw new M(Gz);if(Q.platform==="darwin")F(Q);if(Q.platform==="linux"&&Q.command("systemctl",["--user","show-environment"])!==0)throw new M("No background service here: this computer has no systemd user session.","worker_service_manager_missing");let j=Q.platform==="darwin"?Dz(z,Z,$,J,Q,H.path):null;if(b($.definition,j?j.plist:Q.platform==="win32"?n(Nz(z,Z,$,J)):Uz(z,Z,$,J,Q.home,H.path)),Lz(z,Q,$,B?null:q),j)return j.identity?$:{...$,identityProblem:yz};if(Q.platform==="win32")return $;return{...$,lingering:Q.command("loginctl",["enable-linger"])===0}}function Lz(H,z,J,Q){if(z.platform==="darwin"){let B=F(z);if(Q)z.command("/bin/launchctl",["bootout",`${B}/${Q.label}`]);if(Xz(H,J,z)){if(Q)Y(Q.definition,{force:!0});return}if(Y(J.definition,{force:!0}),Q)z.command("/bin/launchctl",["bootstrap",B,Q.definition]);throw new M("Could not start the background service (launchctl bootstrap failed).","worker_service_start_failed")}if(z.platform==="win32"){if(Q)K(Q,z,!0);if(z.command("schtasks",i(J.label,J.definition))===0){if(Tz(J,z,z.insideService?.(J.label)!==!0),z.command("schtasks",["/Run","/TN",J.label])===0)return}throw K(J,z,!0),new M("Could not start the background service (schtasks failed).")}let Z=`${J.label}.service`,q=Q?`${Q.label}.service`:null;if(z.command("systemctl",["--user","daemon-reload"])!==0||q!==null&&z.command("systemctl",["--user","disable","--now",q])!==0||z.command("systemctl",["--user","enable",Z])!==0||z.command("systemctl",["--user","restart",Z])!==0){if(z.command("systemctl",["--user","disable",Z]),Y(J.definition,{force:!0}),z.command("systemctl",["--user","daemon-reload"]),q)z.command("systemctl",["--user","enable","--now",q]);throw new M("Could not start the background service (systemctl --user failed).","worker_service_start_failed")}if(Q)Y(Q.definition,{force:!0}),z.command("systemctl",["--user","daemon-reload"])}function Xz(H,z,J){let Q=F(J);J.command("/bin/launchctl",["bootout",`${Q}/${z.label}`]);let Z=(Math.ceil(H.shutdownGraceMs/1000)+10)*1000;for(let q=0,B=100;;B=Math.min(B*2,2000)){if(J.command("/bin/launchctl",["bootstrap",Q,z.definition])===0)return!0;if(q>=Z)return!1;J.sleep(B),q+=B}}function TH(H,z,J){let Q=d(H,z,J);if(!Q)return null;let Z=z.insideService?.(Q.label)===!0;if(z.platform==="darwin"&&!Z)uz(Q.definition,z);let q=T(H,z,J);if(q&&Q.label!==q.label&&!Z)return b(q.definition,L(Q.definition,"utf8").replaceAll(Q.label,q.label)),Lz(H,z,q,Q),q;let B=z.platform==="darwin"&&Z,$;if(z.platform==="win32")Tz(Q,z,!Z),$=z.command("schtasks",["/Run","/TN",Q.label])===0;else if(B)$=z.command("/bin/launchctl",["kickstart","-k",`${F(z)}/${Q.label}`])===0;else if(z.platform==="darwin")$=Xz(H,Q,z);else z.command("systemctl",["--user","enable",`${Q.label}.service`]),$=z.command("systemctl",["--user","restart",`${Q.label}.service`])===0;if(!$)throw new M(`Could not restart the background service ${Q.label}.`,"worker_service_restart_failed");if(q&&Q.label===q.label)gz(H,z,J);return Q}function LH(H,z,J,Q){let Z=d(H,J,Q),q=T(z,J,Q);if(J.platform!=="darwin"||!Z||!q)return;let B=`<string>${D(Z.logs)}</string>`,$=L(Z.definition,"utf8");if($.includes(B))b(Z.definition,$.replaceAll(B,`<string>${D(q.logs)}</string>`))}function XH(H,z,J="serve"){let Q=Mz(H,z,J);for(let Z of Q){if(z.platform==="win32"){K(Z,z,z.insideService?.(Z.label,!1)!==!0);continue}if(z.platform==="darwin"){if(typeof z.uid==="number"&&z.uid>0)z.command("/bin/launchctl",["bootout",`gui/${z.uid}/${Z.label}`]);Y(Z.definition,{force:!0});continue}z.command("systemctl",["--user","disable","--now",`${Z.label}.service`]),Y(Z.definition,{force:!0}),z.command("systemctl",["--user","daemon-reload"])}return Q[0]??null}
|
|
105
|
-
export{l as Pd,P as Qd,yz as Rd,BH as Sd,M as Td,qH as Ud,jH as Vd,GH as Wd,jz as Xd,MH as Yd,YH as Zd,d as _d,gz as $d,DH as ae,UH as be,NH as ce,TH as de,LH as ee,XH as fe};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{r as a}from"./vm-hands-entry-lite-0seprnh3.js";import"./vm-hands-entry-lite-mc3pkj0q.js";import"./vm-hands-entry-lite-h0keewxv.js";import"./vm-hands-entry-lite-g7h6wjqy.js";import"./vm-hands-entry-lite-mft9ke08.js";import"./vm-hands-entry-lite-fb02h1zm.js";import"./vm-hands-entry-lite-8e932j3c.js";import"./vm-hands-entry-lite-88h9vwrv.js";import"./vm-hands-entry-lite-g87z5eb6.js";import"./vm-hands-entry-lite-f78n4wqt.js";export{a as configureWorkerSandbox};
|