@reason-machines/cli-linux-x64 0.2.392 → 0.2.395
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/README.md +1 -1
- package/bin/reason +4 -0
- 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-n25b0bc7.js → ask-relay-e424fxe1.js} +3 -3
- package/bin/vm-hands/connect-cli-t2cf1fhv.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-3msswz1s.js +2 -0
- package/bin/vm-hands/local-capabilities-jp7mfe90.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-4nz3ps1j.js +2 -0
- package/bin/vm-hands/local-pty-session-a0fz1f9t.js +2 -0
- package/bin/vm-hands/{managed-runtime-gq3w0s2m.js → managed-runtime-jpkvdh9q.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-nhtd0qmb.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-t7w6zjvy.js → serve-service-sdep4jmp.js} +1 -1
- package/bin/vm-hands/{status-pn9s61mk.js → status-r1k521hh.js} +2 -2
- package/bin/vm-hands/version-svxh3eka.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-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-szhgkxe9.js → vm-hands-entry-lite-3ypjvw3e.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-kkgqknmg.js → vm-hands-entry-lite-42chrtkc.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-v679rfw4.js → vm-hands-entry-lite-4d0szmz0.js} +2 -2
- 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-2sw5neq5.js → vm-hands-entry-lite-6256d8j5.js} +3 -3
- 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-4ze6psry.js → vm-hands-entry-lite-90r926q9.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-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-40eg3600.js → vm-hands-entry-lite-ep2n8nxv.js} +51 -51
- package/bin/vm-hands/{vm-hands-entry-lite-e5whbbf1.js → vm-hands-entry-lite-errnnc9y.js} +1 -1
- 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-csecgmaa.js → vm-hands-entry-lite-gk3y60ap.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-k4erfh5k.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-kbjh8x26.js +5 -0
- package/bin/vm-hands/{vm-hands-entry-lite-jngk09n6.js → vm-hands-entry-lite-kjjhcjp9.js} +2 -2
- package/bin/vm-hands/{vm-hands-entry-lite-bfz54fcx.js → vm-hands-entry-lite-nnggcccf.js} +1 -1
- package/bin/vm-hands/{vm-hands-entry-lite-s70v7hej.js → vm-hands-entry-lite-p3d5j70y.js} +7 -7
- package/bin/vm-hands/{vm-hands-entry-lite-00800vjk.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-02zaqpgh.js → vm-hands-entry-lite-qvj5560v.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-adpzn7fe.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-ejm7666a.js → vm-hands-entry-lite-vys6qap2.js} +2 -2
- 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-y7yr8pjm.js +105 -0
- package/bin/vm-hands/vm-hands-entry-lite.js +1 -1
- package/bin/vm-hands/{vm-hands-executor-pvxwbp9f.js → vm-hands-executor-pm8ns2zs.js} +1 -1
- package/bin/vm-hands/vm-hands-op-runner-7r51q98t.js +2 -0
- package/bin/vm-hands/{vm-hands-runtime-jfpsg002.js → vm-hands-runtime-h5s04mj9.js} +3 -3
- package/bin/vm-hands/worker-sandbox-ecjj14h5.js +2 -0
- package/package.json +1 -1
- package/bin/ara +0 -4
- 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-3a577w3r.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-v37jep3t.js +0 -2
- package/bin/vm-hands/local-capabilities-dn2qbnyg.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-q9bc8kvc.js +0 -2
- package/bin/vm-hands/local-pty-session-8ny1n2fv.js +0 -2
- package/bin/vm-hands/package-04cf0m62.js +0 -2
- package/bin/vm-hands/permissions-w6qgf9wr.js +0 -2
- package/bin/vm-hands/version-vzx5cveg.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-0z73amf7.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-1m7dd8d1.js +0 -105
- package/bin/vm-hands/vm-hands-entry-lite-bwpay74g.js +0 -3
- package/bin/vm-hands/vm-hands-op-runner-teazy42f.js +0 -2
- package/bin/vm-hands/worker-sandbox-nnk7fq89.js +0 -2
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ne as Qz,re as Zz,te as R,we as $z}from"./vm-hands-entry-lite-kbjh8x26.js";import{ri as zz}from"./vm-hands-entry-lite-gk3y60ap.js";import{Hi as e}from"./vm-hands-entry-lite-eatqxe5y.js";import{$i as Hz,nj as V,pj as Jz}from"./vm-hands-entry-lite-kjjhcjp9.js";import{Bk as X}from"./vm-hands-entry-lite-ek5r435m.js";import{spawnSync as C}from"child_process";import{createHash as Iz,randomUUID as Wz}from"crypto";import{chmodSync as bz,existsSync as y,mkdirSync as Sz,readdirSync as wz,readFileSync as L,renameSync as _z,rmSync as Y,statSync as xz,writeFileSync as Rz}from"fs";import{dirname as yz,isAbsolute as Bz,join as N}from"path";import{spawnSync as Oz}from"child_process";import{readFileSync as Cz}from"fs";import{userInfo as v}from"os";import{join as Kz}from"path";var Vz="REASON_SCHEDULED_TASK";function l(H){return Kz(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:${Vz}=${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 Pz(){let H=process.env.USERDOMAIN?.trim();return H?`${H}\\${v().username}`:v().username}function h(H){let z=S(H.user??Pz()),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=Cz(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=Oz(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",kz="worker_identity_unavailable";function qH(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)=>Ez(z,process.platform,process.getuid?.(),J)}}function Ez(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===fz)return!1;if(Z.error||Z.status!==0)return!0;let B=Number(/^\s*pid = (\d+)$/m.exec(Z.stdout??"")?.[1]??0);if(!B)return!1;let q=process.pid;for(let $=0;$<64&&q>1;$+=1){if(q===B)return!0;let j=C("/bin/ps",["-o","ppid=","-p",String(q)],{encoding:"utf8",timeout:5000}),G=Number(j.stdout?.trim());if(j.error||j.status!==0||!Number.isSafeInteger(G)||G<=0)return!0;if(G===q)return!1;q=G}return q>1}var fz=113;class M extends Error{code;constructor(H,z){super(H);this.code=z}}function jH(H,z){if(!u(H.home,H.platform))throw new M(Mz);if(H.platform==="darwin")F(H);let J=$z(Qz(z,H.home)),Q=zz({env:z})==="staging",Z=Q?"ara-staging":"ara",B=[J?Zz(J):null,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 q of B)try{if(q&&Bz(q)&&xz(q).isFile())return R(q)}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>)`),mz=/(<key>EnvironmentVariables<\/key>\s*<dict>[\s\S]*?)(\n\s*<\/dict>)/;function uz(H){return H.replaceAll("<","<").replaceAll(">",">").replaceAll(""",'"').replaceAll("'","'").replaceAll("&","&")}function E(H){let z=[...(k.exec(H)?.[2]??"").matchAll(/<string>([^<]*)<\/string>/g)].map((Q)=>uz(Q[1])),J=z[1]==="--run-worker"?z.slice(2):z;return J[0]?{launcher:J[0],args:J.slice(1)}:null}function GH(H,z){if(!pz(z))return null;try{return E(L(N(H,"Library","LaunchAgents",`${z}.plist`),"utf8"))?.launcher??null}catch{return null}}function qz(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 jz(H,z){let J;try{J=L(H,"utf8")}catch{return null}let Q=E(J);if(!Q)return null;let Z=Bz(Q.launcher)?R(Q.launcher):Q.launcher,{program:B,identity:q}=qz(Z,Q.args,z),$=J.replace(k,(j,G,U,g)=>`${G}${f(B)}
|
|
47
|
+
${g}`);if(!q)$=$.replace(O,"");else if(O.test($))$=$.replace(O,(j,G,U)=>`${G}${D(q.app)}${U}`);else $=$.replace(mz,(j,G,U)=>`${G}
|
|
48
|
+
<key>${V}</key>
|
|
49
|
+
<string>${D(q.app)}</string>${U}`);return $===J?null:$}function dz(H,z){let J=jz(H,z);if(J!==null)b(H,J)}function MH(H,z,J){if(z.platform!=="darwin")return!1;let Q=d(H,z,J);return Q!==null&&jz(Q.definition,z)!==null}var I="com.reasonmachines.worker.",m="so.reason.worker.",W=[I,m];function pz(H){return W.some((z)=>H.startsWith(z)&&/^[A-Za-z0-9._-]+$/.test(H.slice(z.length)))}function Gz(H,z=I){return`${z}connect${H==="production"?"":`.${H}`}`}function YH(H,z){return W.some((J)=>H===Gz(z,J))}function gz(H,z,J){if(z==="connect")return Gz(H.channel,J);let Q=Iz("sha256").update(H.workspaceRoot).digest("hex").slice(0,8);return`${J}${H.name.toLowerCase()}.${Q}`}var Mz="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=gz(H,J,Q),B=u(z.home,z.platform);if(!B)return null;return{label:Z,definition:N(B.directory,`${Z}${B.suffix}`),logs:z.platform==="linux"?`journalctl --user -u ${Z}.service`:N(H.stateDirectory,"service.log")}}function DH(H,z){let J=u(H,z);if(!J)return[];try{return wz(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 Yz(H,z,J)[0]??null}function Yz(H,z,J){return W.map((Q)=>T(H,z,J,Q)).filter((Q)=>Q!==null&&y(Q.definition))}function Dz(H,z,J){let Q=T(H,z,J,m);return Q&&y(Q.definition)?Q:null}function vz(H,z,J){let Q=T(H,z,J),Z=Dz(H,z,J);if(!Q||!Z||!y(Q.definition)||z.insideService?.(Z.label))return null;if(!lz(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 lz(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&&az.has(z.read("systemctl",["--user","show","--property=ActiveState","--value",J])?.trim()??"")}var az=new Set(["active","activating","reloading"]);function UH(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 NH(H){let{config:z,launcher:J,host:Q,kind:Z}=H,B=T(z,Q,Z);if(!B)return!1;let q;try{q=Q.platform==="win32"?r(B.definition):L(B.definition,"utf8")}catch{return!1}if(Q.platform==="win32")return q===Tz(z,Z,B,J);if(Q.platform!=="darwin")return q===Nz(z,Z,B,J,Q.home,H.path);let $=E(q);return q.replace(O,"").replace(k,(G,U,g,Az)=>`${U}${$?`${f([$.launcher,...$.args])}
|
|
50
|
+
`:""}${Az}`)===Uz(z,Z,B,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 Uz(H,z,J,Q,Z,B){let q=p(H,z),$=qz(Q,q.args,Z),j={HOME:Z.home,PATH:B,[P]:J.label,...q.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 Nz(H,z,J,Q,Z,B){let q=p(H,z);return`[Unit]
|
|
92
|
+
Description=${q.description}
|
|
93
|
+
|
|
94
|
+
[Service]
|
|
95
|
+
ExecStart=${[Q,...q.args].map(($)=>o($,!0)).join(" ")}
|
|
96
|
+
Environment=${[`HOME=${Z}`,`PATH=${B}`,`${P}=${J.label}`,...Object.entries(q.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 Tz(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 Lz(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){Sz(yz(H),{recursive:!0,mode:448});let J=`${H}.${Wz()}.tmp`;try{Rz(J,z,{mode:384,flag:"wx"}),bz(J,384),_z(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 TH(H){let{config:z,launcher:J,host:Q}=H,Z=H.kind??"serve",B=Dz(z,Q,Z),q=B!==null&&Q.insideService?.(B.label)===!0,$=T(z,Q,Z,q?m:I);if(!$)throw new M(Mz);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"?Uz(z,Z,$,J,Q,H.path):null;if(b($.definition,j?j.plist:Q.platform==="win32"?n(Tz(z,Z,$,J)):Nz(z,Z,$,J,Q.home,H.path)),Xz(z,Q,$,q?null:B),j)return j.identity?$:{...$,identityProblem:kz};if(Q.platform==="win32")return $;return{...$,lingering:Q.command("loginctl",["enable-linger"])===0}}function Xz(H,z,J,Q){if(z.platform==="darwin"){let q=F(z);if(Q)z.command("/bin/launchctl",["bootout",`${q}/${Q.label}`]);if(Fz(H,J,z)){if(Q)Y(Q.definition,{force:!0});return}if(Y(J.definition,{force:!0}),Q)z.command("/bin/launchctl",["bootstrap",q,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(Lz(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`,B=Q?`${Q.label}.service`:null;if(z.command("systemctl",["--user","daemon-reload"])!==0||B!==null&&z.command("systemctl",["--user","disable","--now",B])!==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"]),B)z.command("systemctl",["--user","enable","--now",B]);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 Fz(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 B=0,q=100;;q=Math.min(q*2,2000)){if(J.command("/bin/launchctl",["bootstrap",Q,z.definition])===0)return!0;if(B>=Z)return!1;J.sleep(q),B+=q}}function LH(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)dz(Q.definition,z);let B=T(H,z,J);if(B&&Q.label!==B.label&&!Z)return b(B.definition,L(Q.definition,"utf8").replaceAll(Q.label,B.label)),Xz(H,z,B,Q),B;let q=z.platform==="darwin"&&Z,$;if(z.platform==="win32")Lz(Q,z,!Z),$=z.command("schtasks",["/Run","/TN",Q.label])===0;else if(q)$=z.command("/bin/launchctl",["kickstart","-k",`${F(z)}/${Q.label}`])===0;else if(z.platform==="darwin")$=Fz(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(B&&Q.label===B.label)vz(H,z,J);return Q}function XH(H,z,J,Q){let Z=d(H,J,Q),B=T(z,J,Q);if(J.platform!=="darwin"||!Z||!B)return;let q=`<string>${D(Z.logs)}</string>`,$=L(Z.definition,"utf8");if($.includes(q))b(Z.definition,$.replaceAll(q,`<string>${D(B.logs)}</string>`))}function FH(H,z,J="serve"){let Q=Yz(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,kz as Rd,qH as Sd,M as Td,jH as Ud,GH as Vd,MH as Wd,Gz as Xd,YH as Yd,DH as Zd,d as _d,vz as $d,UH as ae,NH as be,TH as ce,LH as de,XH as ee,FH as fe};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./vm-hands-entry-lite-
|
|
2
|
+
import"./vm-hands-entry-lite-6nj2ejfh.js";import"./vm-hands-entry-lite-qvj5560v.js";import"./vm-hands-entry-lite-f9akybcm.js";import{Qk as A}from"./vm-hands-entry-lite-5d31qv44.js";import{readFileSync as J}from"fs";var G=performance.now();delete process.env.BUN_BE_BUN;var q=(j,b={})=>console.log(JSON.stringify({stage:j,ms:Math.round(performance.now()),...b}));async function K(){if(process.argv.includes("--vm-hands-op-runner")){let{runVmHandsOpRunner:D}=await import("./vm-hands-op-runner-7r51q98t.js");await D();return}q("parsed",{t0:Math.round(G)});let j="";try{j=J(3,"utf8")}catch{}q("fd3_read",{bytes:j.length});let b=null;if(j.trim())try{b=JSON.parse(j)}catch{b=null}if(!b||typeof b!=="object"||Array.isArray(b))q(j.trim()?"identity_invalid":"identity_free"),await new Promise(()=>{setInterval(()=>{return},1073741824)});let{parseVmHandsInit:B,runVmHands:C}=await import("./vm-hands-runtime-h5s04mj9.js"),z=B(b);if(!z)q("identity_invalid"),await new Promise(()=>{setInterval(()=>{return},1073741824)});await C(z,q),process.exit(0)}K();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{s as wq}from"./vm-hands-entry-lite-
|
|
2
|
+
import{s as wq}from"./vm-hands-entry-lite-errnnc9y.js";import{Mb as Nq,qc as Aq,wb as jq,wc as Rq}from"./vm-hands-entry-lite-vys6qap2.js";import"./vm-hands-entry-lite-e99ftdr6.js";import"./vm-hands-entry-lite-e4kdpq0t.js";import"./vm-hands-entry-lite-0nd56w02.js";import"./vm-hands-entry-lite-qvj5560v.js";import"./vm-hands-entry-lite-ps9gjbs5.js";import"./vm-hands-entry-lite-q5h859gg.js";import"./vm-hands-entry-lite-vqfpryez.js";import"./vm-hands-entry-lite-1cs1jy20.js";import"./vm-hands-entry-lite-k4erfh5k.js";import"./vm-hands-entry-lite-gk3y60ap.js";import"./vm-hands-entry-lite-eatqxe5y.js";import"./vm-hands-entry-lite-sbn9bmf7.js";import"./vm-hands-entry-lite-2sx1a43v.js";import"./vm-hands-entry-lite-29f3m7x2.js";import"./vm-hands-entry-lite-90r926q9.js";import"./vm-hands-entry-lite-f9akybcm.js";import"./vm-hands-entry-lite-sjn5yjvx.js";import"./vm-hands-entry-lite-ek5r435m.js";import"./vm-hands-entry-lite-bgs4zjkf.js";import"./vm-hands-entry-lite-e1cbqqqw.js";import"./vm-hands-entry-lite-69n9q5f1.js";import"./vm-hands-entry-lite-5d31qv44.js";import{spawn as gq}from"child_process";import{chmodSync as Sq,chownSync as Eq,existsSync as l,lstatSync as e,mkdirSync as r,mkdtempSync as yq,readdirSync as s,readFileSync as I,realpathSync as mq,rmdirSync as qq,rmSync as uq,writeFileSync as y}from"fs";import{join as L}from"path";import{readFileSync as Wq,readlinkSync as Gq}from"fs";import{relative as _q}from"path";var Jq=16;function Yq(X){return X.replace(/\\([0-7]{3})/g,($,W)=>String.fromCharCode(Number.parseInt(W,8)))}function hq(X){let $=[];for(let W of X.split(`
|
|
3
3
|
`)){let q=W.split(" ");if(q.length<10||!/^\d+:\d+$/.test(q[2]))continue;$.push({device:q[2],root:Yq(q[3]),mountPoint:Yq(q[4])})}return $}function kq(X,$,W){let q=X.replace(/\/+$/,"")||"/",J=(F)=>q==="/"||F===q||F.startsWith(`${q}/`),G=(F)=>new Map(hq(F).filter((R)=>J(R.mountPoint)).map((R)=>[`${R.mountPoint}\x00${R.device}\x00${R.root}`,R.mountPoint])),Y=G($),A=G(W),j=(F)=>_q(q,F)||".",f=[...Y].filter(([F])=>!A.has(F)).map(([,F])=>j(F)),O=[...A].filter(([F])=>!Y.has(F)).map(([,F])=>j(F));return{missing:f,extra:O,referenceCount:Y.size,ownCount:A.size}}function Kq(X,$,W,q="/proc"){let J,G,Y=null;try{J=Wq(`${q}/1/mountinfo`,"utf8"),G=Wq(`${q}/self/mountinfo`,"utf8")}catch(R){let v=R&&typeof R==="object"&&"code"in R&&typeof R.code==="string"?R.code:"unreadable";$("vm_hands.mount_check_unavailable",{code:v});return}try{Y=Gq(`${q}/1/ns/mnt`)===Gq(`${q}/self/ns/mnt`)}catch{}let{missing:A,extra:j,referenceCount:f,ownCount:O}=kq(X,J,G),F={reference_count:f,own_count:O,missing_count:A.length,extra_count:j.length,same_namespace:Y};if(j.length)$("vm_hands.mount_extra",{...F,extra:j.slice(0,Jq)});if(A.length)throw $("vm_hands.mount_mismatch",{...F,missing:A.slice(0,Jq)}),W(`${A.length} mount(s) under the Session root are missing from vm-hands' namespace`)}var Pq="/sys/fs/cgroup/reason-payload",H="vm-hands",lq="/run/ara-srt/fallbacks.jsonl",E="/reason-person",Xq=5000,cq=1e4,Bq="__VM_HANDS_PROOF_DIR__",pq="__VM_HANDS_PROBE_NONCE__";class D extends Error{code;constructor(X,$){super($);this.code=X}}function aq(X,$){if(!/^[0-9a-f-]{36}$/i.test($))throw new D("vm_hands_bind_invalid","bad bind id");return L(X,H,`b-${$.toLowerCase()}`)}var tq=5000,Iq=(X)=>`'${X.replaceAll("'","'\\''")}'`;function JX(X){let $=X.cgroup??Pq,W=X.init.layout.payload_uid,q=X.log??(()=>{}),J=new Map,G=new Map,Y=0,A=()=>{try{let Z=I("/run/ara-srt/starts.jsonl","utf8"),z=Z.slice(Y>Z.length?0:Y).split(`
|
|
4
4
|
`).filter(Boolean);Y=Z.length;let K=z.map((U)=>{try{return Number(JSON.parse(U).elapsed_ms)||0}catch{return 0}});if(K.length)q("vm_hands.srt_server_starts",{count:K.length,elapsed_ms:K.slice(0,8)})}catch{}},j=null,f=!1,O=X.srtCgroup??"/sys/fs/cgroup/reason-srt",F=()=>{j??=Uq()},R=0,v=()=>{try{let Z=I(lq,"utf8"),z=Z.slice(R>Z.length?0:R);R=Z.length;let K=z.split(`
|
|
5
5
|
`).filter(Boolean).slice(0,1000);if(!K.length)return null;let U={},T=0;for(let N of K)try{let M=JSON.parse(N),B=typeof M.code==="string"&&/^[a-z_]{1,40}$/.test(M.code)?M.code:"other";if(U[B]=(U[B]??0)+1,typeof M.elapsed_ms==="number")T=Math.max(T,M.elapsed_ms)}catch{U.unparsed=(U.unparsed??0)+1}return q("vm_hands.srt_fallbacks",{count:K.length,codes:U,max_elapsed_ms:T}),{count:K.length,codes:U,max_elapsed_ms:T}}catch{return null}},P=!1,m=(Z,z,K)=>{if(P)throw Error("vm_hands_pool_held");return vq(Z,z,K)},i=(Z)=>(z,K,U)=>gq("/bin/sh",["-c",`echo $$ > ${Iq(L(Z,"cgroup.procs"))} || exit 125; exec "$@"`,"vm-hands-join",z,...K],U),vq=i(L($,H)),u=L($,H,"probe"),g=(Z)=>aq($,Z),bq=(Z)=>{let z=g(Z);try{r(z,{mode:493})}catch(K){if(!(K&&typeof K==="object"&&("code"in K)&&K.code==="EEXIST"))throw new D("vm_hands_bind_failed","bind cgroup")}return z},xq=(Z)=>{try{qq(g(Z))}catch{}},x=X.prespawn?Nq({spawnProcess:m,...X.relayDependencies?.sourceEntrypoint?{sourceEntrypoint:X.relayDependencies.sourceEntrypoint}:{},log:(Z,z)=>q(Z,z??{})}):null;x?.arm();let n=x?setInterval(()=>{x.arm()},tq):null;n?.unref?.();async function c(Z){let z=J.get(Z);if(J.delete(Z),!z)return;z.abort.abort(),await z.done}return{bindCgroup:g,async startExecutor(Z){if(F(),G.set(Z.bindId,Uq()),f=!0,!Z.claim)throw new D("vm_hands_bind_invalid","an executor needs the claim it serves");await c(Z.bindId);let{claim:z,bindId:K}=Z,U=bq(K),T=z.owner;if(!T||typeof T.device_id!=="string"||typeof z.root_id!=="string")throw new D("vm_hands_bind_invalid","claim without its owner Device or root");let N=new AbortController,M,B,V=new Promise((Q,w)=>{M=Q,B=w}),_,C=new Promise((Q)=>{_=Q}),S=Rq({headless:!0,hostExecution:!0,runtimeDirectory:X.runtimeDirectory,deviceIdentity:{deviceId:T.device_id,rootId:z.root_id,apiOrigin:X.apiOrigin},claimOwner:z.owner,root:X.root,runId:z.run_id,operationId:z.operation_id,attemptId:z.attempt_id,payload:Object.fromEntries(Object.entries(z.payload).filter(([Q])=>!Q.startsWith("vm_hands_"))),signal:N.signal,...Z.workspaceGrant?{workspaceGrant:Z.workspaceGrant}:{},emitEvent:async(Q,w)=>{if(Q==="hands.ready"){M(w);return}if(Q==="hands.started"||Q==="hands.stopped"||Q==="hands.failed")return;await X.forward(K,Q,w)}},{...X.relayDependencies,spawnWorker:(Q)=>i(U)(Q.command,Q.args,Q.options),...x?{takePrespawnedWorker:(Q)=>{let w=x.take(Q);if(!w?.pid)return w;try{return y(L(U,"cgroup.procs"),String(w.pid)),w}catch{try{w.kill("SIGKILL")}catch{}return null}},adoptSpawnedWorker:x.adopt}:{}}).then(()=>{_("executor_stopped")},(Q)=>{let w=Q&&typeof Q==="object"&&"code"in Q?String(Q.code):"executor_failed";B(new D(w,Q instanceof Error?Q.message:String(Q))),_(w)}).finally(()=>B(new D("vm_hands_executor_exited","executor ended before it was ready")));J.set(K,{abort:N,done:S,exited:C,operationId:z.operation_id,runId:z.run_id,expiresAtMs:Date.parse(String(z.payload.expires_at??""))||0});let h=await V,p=h.executor_launch_id;if(typeof p!=="string")throw new D("vm_hands_bind_failed","executor ready without a launch id");return{launchId:p,readyData:h,applied:{hands_confinement:typeof z.payload.hands_confinement==="string"?z.payload.hands_confinement:null,browser_egress:z.payload.browser_egress??null}}},takeSrtFallbacks:v,executorExited(Z){return J.get(Z)?.exited??new Promise(()=>{})},freezeBind(Z){let z=g(Z);if(l(L(z,"cgroup.freeze")))y(L(z,"cgroup.freeze"),"1")},async killAndVerifyPayload(Z){let z=new Set(Z?.keep??[]);if(z.size||Z?.own)return Hq(Z?.bindId??null,z,Z?.own===!0);P=!0;let K=Tq();try{await Mq();let U=Promise.all([...J.keys()].map((B)=>c(B).catch(()=>{return})));A();let T=Date.now()+Xq;await a($,T,"payload"),await U;let N=(f||X.srtWarmLate?.()===!0)&&l(L(O,"cgroup.events"));if(N)await a(O,T,"srt");let M=$q(W).filter((B)=>!b(B,E));if(j!==null){let B=Zq(j).filter((V)=>V!==process.pid&&!b(V,E));if(B.length)throw q("vm_hands.kill_strays",{strays:t(B)}),new D("vm_hands_kill_unverified",`${B.length} process(es) the run started survived it`);j=null}if(f=!1,N)X.onSrtReset?.();if(M.length)throw q("vm_hands.kill_survivors",{pids:M.slice(0,16)}),new D("vm_hands_kill_unverified",`${M.length} payload-uid process(es) outside the payload cgroup`);G.clear();for(let B of zq())try{qq(L($,H,B))}catch{}}finally{P=!1,K()}if(x)setTimeout(()=>{if(!J.size)x.arm()},100).unref?.()},async killProbe(){let Z=Date.now()+Xq;if(l(L(u,"cgroup.events"))){await a(u,Z,"probe");try{qq(u)}catch{}}let z=Qq(process.pid);if(z===null)throw new D("vm_hands_kill_unverified","agent start time unreadable");await dq($,z,Z);let K=(T)=>{let N=Qq(T);return N!==null&&N<=z},U=$q(W).filter((T)=>K(T)&&!b(T,E));if(U.length)throw q("vm_hands.kill_survivors",{pids:U.slice(0,16),at:"attest"}),new D("vm_hands_kill_unverified",`${U.length} payload-uid process(es) from before this agent`);if(j!==null){let T=[$,L($,H)].map((B)=>B.replace(/^\/sys\/fs\/cgroup/,"")),N=O.replace(/^\/sys\/fs\/cgroup/,""),M=Zq(j).filter((B)=>B!==process.pid&&!b(B,E)&&!b(B,"/reason-vm-hands")&&!b(B,N)&&!T.some((V)=>Lq(B,V)));if(M.length&&f)throw q("vm_hands.kill_strays",{strays:t(M),at:"attest"}),new D("vm_hands_kill_unverified",`${M.length} process(es) the run started survived it`);if(M.length)q("vm_hands.attest_concurrent",{processes:t(M),count:M.length});j=null}},async runProbe({nonce:Z,script:z}){if(F(),!z.includes(Bq))throw new D("vm_hands_probe_failed","probe names no proof directory");let K=X.proofParent??"/tmp/reason-vm-hands-proof";r(K,{mode:457,recursive:!0});let U=e(K);if(U.isSymbolicLink()||!U.isDirectory()||U.uid!==(process.getuid?.()??-1)||(U.mode&4095)!==457)throw new D("vm_hands_probe_failed","proof parent is not root's 0711 directory");let T=yq(L(K,"p-")),N=!1;try{if(!/^[A-Za-z0-9/._-]+$/.test(T)||!/^[A-Za-z0-9_-]{1,128}$/.test(Z))throw new D("vm_hands_probe_failed","proof directory path or nonce");Eq(T,W,W),Sq(T,448);let M=e(T).ino;try{r(u,{mode:493})}catch(C){if(!(C&&typeof C==="object"&&("code"in C)&&C.code==="EEXIST"))throw new D("vm_hands_probe_failed","probe cgroup")}let B=i(u)("/bin/bash",["-c",z.replaceAll(Bq,T).replaceAll(pq,Z)],{cwd:"/",env:{PATH:"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"},stdio:["ignore","pipe","ignore"]}),V="";B.stdout?.on("data",(C)=>{if(V.length<16384)V+=C.toString("utf8").slice(0,16384-V.length)});let _=await new Promise((C)=>{let S=setTimeout(()=>{N=!0,B.kill("SIGKILL"),C(124)},cq);B.once("error",()=>{clearTimeout(S),C(127)}),B.once("close",(h)=>{clearTimeout(S),C(h??1)})});return q("vm_hands.probe",{nonce_len:Z.length,exit_code:_}),{exitCode:_,markers:V,proofDirInode:M}}finally{if(!N)uq(T,{recursive:!0,force:!0})}},restatLayout(){let{session_root:Z,alias:z}=X.init.layout,K="invalid";try{Aq(Z),K="0:0:755"}catch{}let U=!1,T=-1;try{let N=e(z);T=N.uid,U=K==="0:0:755"&&z===L(Z,"repo")&&!N.isSymbolicLink()&&N.isDirectory()&&mq(z)===z&&N.uid===W}catch{}return{root_mode:K,alias_ok:U,owner_uid:T}},verifyMounts(){Kq(X.init.layout.session_root,q,(Z)=>new D("vm_hands_mount_mismatch",Z))},installEnvironment(Z,z){let K=J.get(Z);if(!K)throw new D("environment_unavailable","no executor owns an environment");return jq({root:X.root,operationId:K.operationId,payload:z}).installed_revision},async stop(){if(n)clearInterval(n);x?.close(),await Promise.all([...J.keys()].map((Z)=>c(Z)))}};function zq(){try{return s(L($,H),{withFileTypes:!0}).filter((Z)=>Z.isDirectory()&&/^b-[0-9a-f-]{36}$/.test(Z.name)).map((Z)=>Z.name)}catch{return[]}}async function Hq(Z,z,K=!1){let U=new Set([...z].map((N)=>N.toLowerCase())),T=Tq();try{await Mq();let N=Date.now()+Xq,M=new Set(zq().filter((Q)=>!U.has(Q.slice(2))).map((Q)=>Q.slice(2)));if(Z)M.add(Z.toLowerCase());let B=null;for(let Q of M){let w=c(Q).catch(()=>{return}),o=G.get(Q);if(o!==void 0)B=B===null?o:Math.min(B,o);if(l(L(g(Q),"cgroup.events")))await a(g(Q),N,"bind");await w}let V=[...U].map((Q)=>g(Q).replace(/^\/sys\/fs\/cgroup/,"")),_=[$,L($,H)].map((Q)=>Q.replace(/^\/sys\/fs\/cgroup/,"")),C=O.replace(/^\/sys\/fs\/cgroup/,""),S=(Q)=>b(Q,E)||V.some((w)=>b(Q,w)),h=K?[]:$q(W).filter((Q)=>!S(Q));if(h.length)throw q("vm_hands.kill_survivors",{pids:h.slice(0,16),beside:U.size}),new D("vm_hands_kill_unverified",`${h.length} payload-uid process(es) outside a live bind`);let p=(Q)=>!S(Q)&&!b(Q,"/reason-vm-hands")&&!b(Q,C)&&!_.some((w)=>Lq(Q,w));if(B!==null){let Q=Zq(B).filter((w)=>w!==process.pid&&p(w));if(Q.length)throw q("vm_hands.kill_strays",{strays:t(Q),beside:U.size}),new D("vm_hands_kill_unverified",`${Q.length} process(es) the run started survived it`)}for(let Q of M)G.delete(Q),xq(Q)}finally{T()}}}function Qq(X,$="/proc"){try{let W=I(L($,String(X),"stat"),"utf8"),q=Number(W.slice(W.lastIndexOf(")")+2).split(" ")[19]);return Number.isFinite(q)?q:null}catch{return null}}function Cq(X,$="/proc"){try{let W=I(L($,String(X),"stat"),"utf8"),q=Number(W.slice(W.lastIndexOf(")")+2).split(" ")[1]);return Number.isFinite(q)?q:null}catch{return null}}async function dq(X,$,W){try{y(L(X,"cgroup.freeze"),"1")}catch(q){throw new D("vm_hands_kill_unverified",`payload cgroup.freeze: ${q instanceof Error?q.message:String(q)}`)}try{for(;;){let q=Oq(X).filter((G)=>fq(G,X)),J=new Set(q.filter((G)=>{let Y=Qq(G);return Y!==null&&Y<=$}));for(let G=!0;G;){G=!1;for(let Y of q){if(J.has(Y))continue;let A=Cq(Y);if(A!==null&&J.has(A))J.add(Y),G=!0}}if(J.size===0)return;if(Date.now()>W)throw new D("vm_hands_kill_unverified",`${J.size} previous-boot process(es) survived`);for(let G of J)try{process.kill(G,"SIGKILL")}catch{}await new Promise((G)=>setTimeout(G,10))}}finally{try{y(L(X,"cgroup.freeze"),"0")}catch{}}}function Lq(X,$,W="/proc"){try{return I(L(W,String(X),"cgroup"),"utf8").split(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{xa as k,ya as m,za as l}from"./vm-hands-entry-lite-
|
|
3
|
-
`,{mode:420}),Q("srt_base_keyed",{})}catch{Q("srt_base_keyed_skipped",{reason:"error"})}}function y(Q,j){let q=(G)=>{return j("srt_warm_skipped",{reason:G}),Promise.resolve()};if(typeof Q.srt_base_settings!=="string")return q("no_settings");let Z=Buffer.from(Q.srt_base_settings,"base64");if(Z.length===0||Z.length>Jj||Z.toString("base64")!==Q.srt_base_settings)return q("settings_invalid");let X;try{let G=A(S);if(!G.isDirectory()||G.uid!==0||(G.mode&18)!==0)return q("cgroup_unsafe");let L=qj.find((M)=>A(M,{throwIfNoEntry:!1})!==void 0);if(!L)return q("cgroup_or_exec_missing");X=L;for(let[M,H]of[[X,!1],["/usr/local/bin",!0]]){let Y=A(M);if((H?!Y.isDirectory():!Y.isFile())||Y.uid!==0||(Y.mode&18)!==0)return q("srt_exec_unsafe")}}catch{return q("cgroup_or_exec_missing")}if((process.getuid?.()??-1)!==0)return q("not_root");let z=performance.now(),f=t("sha256").update(Z).digest("hex"),D=`${C}/srt-base-settings.json`;try{c(D,Z,{mode:384,flag:"w"})}catch{return q("settings_write")}let W=i("/bin/sh",["-c",`echo $$ > ${S}/cgroup.procs || exit 125; exec "$@"`,"vm-hands-srt",X,"--settings",D,"--idle-ms",String(Qj),"--","/bin/true"],{cwd:"/",env:{PATH:"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"},stdio:"ignore"});return new Promise((G)=>{W.once("error",()=>{j("srt_warm_failed",{reason:"spawn"}),G()}),W.once("close",(L)=>{j(L===0?"srt_warm_done":"srt_warm_failed",{exit_code:L,warm_ms:Math.round(performance.now()-z),settings_sha256:f}),G()})})}var u=3000;function Nj(Q){if(!Q||typeof Q!=="object"||Array.isArray(Q))return null;let j=Q,q=j.layout,Z=j.device_key,X=j.credential;return typeof j.workspace_id==="string"&&Number.isSafeInteger(j.instance_generation)&&typeof j.api_origin==="string"&&jj.test(j.api_origin)&&typeof j.manifest_digest==="string"&&!!X&&typeof X.key_id==="string"&&Number.isSafeInteger(X.expires_at_ms)&&typeof X.signature==="string"&&!!q&&typeof q.session_root==="string"&&typeof q.alias==="string"&&Number.isSafeInteger(q.payload_uid)&&typeof q.kind==="string"&&!!Z&&typeof Z.pkcs8==="string"&&typeof Z.spki==="string"?j:null}function v(Q){s(Q,{recursive:!0,mode:448});let j=e(Q);if(!j.isDirectory()||(j.mode&63)!==0||j.uid!==(process.getuid?.()??-1))throw Error(`vm_hands_runtime_directory_unsafe: ${Q}`)}async function $j(Q){let[{CLI_VERSION:j},q,Z,X]=await Promise.all([import("./version-
|
|
4
|
-
`)){let q=j.split(":");if(q.length>=4&&Number(q[2])===Q&&/^\d+$/.test(q[3]??"")&&Number(q[3])>0)return Number(q[3])}throw Error("vm_hands_payload_account_unavailable")}function Fj(Q,j){let q=j.owner;if(!q||typeof q.organization_id!=="string"||typeof q.device_id!=="string"||typeof j.root_id!=="string")return null;return{version:4,apiOrigin:Q.api_origin,orgId:q.organization_id,deviceId:q.device_id,devicePublicKey:"",displayName:"vm-hands",registeredAt:new Date(0).toISOString(),handsSlots:1,roots:[{id:j.root_id,label:"workspace",path:h,pathFingerprint:"0".repeat(64),permissions:{read:!0,write:!0,execute:!0,discover_environment:!0,expose_mcp:!1}}]}}function Kj(Q=process.platform,j="/proc/self/oom_score_adj"){if(Q!=="linux")return null;let q;try{q=d(j,"utf8").trim()}catch{return{value:"unreadable"}}if(!/^-?\d+$/.test(q))return{value:"unreadable"};let Z=Number(q);return Z<0?{value:Z}:null}async function Wj(Q,j){let q=Kj();if(q)j("vm_hands.oom_protected",{code:"vm_hands_oom_protected",value:q.value}),await new Promise(()=>{setInterval(()=>{return},1073741824)});v(C),v(R),Zj(j);let Z=y(Q,j),X=!1,z=async()=>{if(!await Promise.race([Z.then(()=>!0),new Promise(($)=>setTimeout(()=>$(!1),u).unref?.())]))X=!0,j("srt_warm_late",{wait_ms:u})},[{configureDesktopAccount:f},{configureWorkerSandbox:D}]=await Promise.all([import("./desktop-account-
|
|
2
|
+
import{xa as k,ya as m,za as l}from"./vm-hands-entry-lite-6nj2ejfh.js";import{Me as p}from"./vm-hands-entry-lite-qvj5560v.js";import"./vm-hands-entry-lite-f9akybcm.js";import{Qk as F}from"./vm-hands-entry-lite-5d31qv44.js";import{spawn as i}from"child_process";import{createHash as t}from"crypto";import{lstatSync as A,mkdirSync as s,readFileSync as d,statSync as e,writeFileSync as c}from"fs";var C="/run/reason-vm-hands",R="/run/reason-vm-hands/env",h="/home/runner/.reason/workspace",jj=/^https:\/\/[a-z0-9.-]+(?::\d{1,5})?$/,S="/sys/fs/cgroup/reason-srt",qj=["/usr/local/bin/reason-srt-exec","/usr/local/bin/ara-srt-exec"],Jj=65536,Qj=21600000;function Zj(Q,j="/run/ara-srt"){try{if((process.getuid?.()??-1)!==0)return;s(j,{recursive:!0,mode:448});let q=A(j);if(!q.isDirectory()||q.uid!==0||(q.mode&63)!==0){Q("srt_base_keyed_skipped",{reason:"socket_dir_unsafe"});return}c(`${j}/base-keyed`,`1
|
|
3
|
+
`,{mode:420}),Q("srt_base_keyed",{})}catch{Q("srt_base_keyed_skipped",{reason:"error"})}}function y(Q,j){let q=(G)=>{return j("srt_warm_skipped",{reason:G}),Promise.resolve()};if(typeof Q.srt_base_settings!=="string")return q("no_settings");let Z=Buffer.from(Q.srt_base_settings,"base64");if(Z.length===0||Z.length>Jj||Z.toString("base64")!==Q.srt_base_settings)return q("settings_invalid");let X;try{let G=A(S);if(!G.isDirectory()||G.uid!==0||(G.mode&18)!==0)return q("cgroup_unsafe");let L=qj.find((M)=>A(M,{throwIfNoEntry:!1})!==void 0);if(!L)return q("cgroup_or_exec_missing");X=L;for(let[M,H]of[[X,!1],["/usr/local/bin",!0]]){let Y=A(M);if((H?!Y.isDirectory():!Y.isFile())||Y.uid!==0||(Y.mode&18)!==0)return q("srt_exec_unsafe")}}catch{return q("cgroup_or_exec_missing")}if((process.getuid?.()??-1)!==0)return q("not_root");let z=performance.now(),f=t("sha256").update(Z).digest("hex"),D=`${C}/srt-base-settings.json`;try{c(D,Z,{mode:384,flag:"w"})}catch{return q("settings_write")}let W=i("/bin/sh",["-c",`echo $$ > ${S}/cgroup.procs || exit 125; exec "$@"`,"vm-hands-srt",X,"--settings",D,"--idle-ms",String(Qj),"--","/bin/true"],{cwd:"/",env:{PATH:"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"},stdio:"ignore"});return new Promise((G)=>{W.once("error",()=>{j("srt_warm_failed",{reason:"spawn"}),G()}),W.once("close",(L)=>{j(L===0?"srt_warm_done":"srt_warm_failed",{exit_code:L,warm_ms:Math.round(performance.now()-z),settings_sha256:f}),G()})})}var u=3000;function Nj(Q){if(!Q||typeof Q!=="object"||Array.isArray(Q))return null;let j=Q,q=j.layout,Z=j.device_key,X=j.credential;return typeof j.workspace_id==="string"&&Number.isSafeInteger(j.instance_generation)&&typeof j.api_origin==="string"&&jj.test(j.api_origin)&&typeof j.manifest_digest==="string"&&!!X&&typeof X.key_id==="string"&&Number.isSafeInteger(X.expires_at_ms)&&typeof X.signature==="string"&&!!q&&typeof q.session_root==="string"&&typeof q.alias==="string"&&Number.isSafeInteger(q.payload_uid)&&typeof q.kind==="string"&&!!Z&&typeof Z.pkcs8==="string"&&typeof Z.spki==="string"?j:null}function v(Q){s(Q,{recursive:!0,mode:448});let j=e(Q);if(!j.isDirectory()||(j.mode&63)!==0||j.uid!==(process.getuid?.()??-1))throw Error(`vm_hands_runtime_directory_unsafe: ${Q}`)}async function $j(Q){let[{CLI_VERSION:j},q,Z,X]=await Promise.all([import("./version-svxh3eka.js"),import("./hands-worker-source-p6530nj7.js"),import("./network-contract-xgbrevt2.js"),import("./device-workspace-ntckpym4.js")]),{REASON_HANDS_PROTOCOL_VERSION:z}=await import("./reason-hands-protocol-90kpyg4s.js");return{reason_runtime_version:j,bridge_version:j,protocol_version:p,execution_eligible:!0,instance_generation:Q.instance_generation,capabilities:{supported_operations:["hands.connect"],hands_worker_artifact_sha256:q.REASON_HANDS_WORKER_ARTIFACT_SHA256,hands_worker_entrypoint:q.REASON_HANDS_WORKER_ENTRYPOINT,hands_slots:1,max_payload_bytes:Z.LOCAL_OPERATION_MAX_BYTES,max_result_bytes:Z.LOCAL_OPERATION_MAX_BYTES,operation_constraints:{"hands.connect":{ready:!0,execution_mode:"host",transport:"wss_relay",worker:"ara_hands",slots:1,session_group:Z.HANDS_SESSION_GROUP,worker_version:q.REASON_HANDS_WORKER_VERSION,protocol_version:z,worker_artifact_sha256:q.REASON_HANDS_WORKER_ARTIFACT_SHA256,worker_entrypoint:q.REASON_HANDS_WORKER_ENTRYPOINT,policy_mode:"full_access",policy_version:1,workspace_base:X.REASON_WORKSPACE_BASE,workspace_layout:X.SESSION_WORKSPACE_LAYOUT,browser_state:"optional_headless",desktop:!1,max_session_ms:43200000,environment_delivery:Z.HANDS_ENVIRONMENT_DELIVERY,[Z.HANDS_ENVIRONMENT_AT_CLAIM_KEY]:Z.HANDS_ENVIRONMENT_AT_CLAIM,[Z.HANDS_CLOUD_ACCESS_KEY]:Z.HANDS_CLOUD_ACCESS,[Z.HANDS_LARGE_ENVIRONMENT_KEY]:Z.HANDS_LARGE_ENVIRONMENT,[Z.HANDS_CONFINEMENT_KEY]:Z.HANDS_CONFINEMENT,[Z.HANDS_JOBS_USER_KEY]:Z.HANDS_JOBS_USER,vm_hands:"v1"}}}}}var P=["fs.read","fs.write","fs.export","fs.import","exec.run","exec.full","process.list","ports.list","pty.start","jobs.control","automation.call.v1"],Xj=new Set(["pty.start","jobs.control"]);function zj(Q,j){let q=j([{id:"vm-hands",label:"workspace",path:h,pathFingerprint:"0".repeat(64),permissions:{read:!0,write:!0,execute:!0,discover_environment:!0,expose_mcp:!1}}],{worker:{executionMode:"unsandboxed",readiness:Object.fromEntries(P.map((z)=>[z,!0]))}}),Z=Q.capabilities,X={...Z.operation_constraints};for(let z of P)X[z]={...q.operation_constraints?.[z]??{},ready:!0,execution_mode:q.operation_constraints?.[z]?.execution_mode??"host"};return{...Q,capabilities:{...Z,supported_operations:["hands.connect",...P],operation_constraints:X}}}function Gj(Q){for(let j of d("/etc/passwd","utf8").split(`
|
|
4
|
+
`)){let q=j.split(":");if(q.length>=4&&Number(q[2])===Q&&/^\d+$/.test(q[3]??"")&&Number(q[3])>0)return Number(q[3])}throw Error("vm_hands_payload_account_unavailable")}function Fj(Q,j){let q=j.owner;if(!q||typeof q.organization_id!=="string"||typeof q.device_id!=="string"||typeof j.root_id!=="string")return null;return{version:4,apiOrigin:Q.api_origin,orgId:q.organization_id,deviceId:q.device_id,devicePublicKey:"",displayName:"vm-hands",registeredAt:new Date(0).toISOString(),handsSlots:1,roots:[{id:j.root_id,label:"workspace",path:h,pathFingerprint:"0".repeat(64),permissions:{read:!0,write:!0,execute:!0,discover_environment:!0,expose_mcp:!1}}]}}function Kj(Q=process.platform,j="/proc/self/oom_score_adj"){if(Q!=="linux")return null;let q;try{q=d(j,"utf8").trim()}catch{return{value:"unreadable"}}if(!/^-?\d+$/.test(q))return{value:"unreadable"};let Z=Number(q);return Z<0?{value:Z}:null}async function Wj(Q,j){let q=Kj();if(q)j("vm_hands.oom_protected",{code:"vm_hands_oom_protected",value:q.value}),await new Promise(()=>{setInterval(()=>{return},1073741824)});v(C),v(R),Zj(j);let Z=y(Q,j),X=!1,z=async()=>{if(!await Promise.race([Z.then(()=>!0),new Promise(($)=>setTimeout(()=>$(!1),u).unref?.())]))X=!0,j("srt_warm_late",{wait_ms:u})},[{configureDesktopAccount:f},{configureWorkerSandbox:D}]=await Promise.all([import("./desktop-account-r5fsgx43.js"),import("./worker-sandbox-ecjj14h5.js")]);D();try{f({value:String(Q.layout.payload_uid)})}catch{j("payload_account_unavailable"),await new Promise(()=>{setInterval(()=>{return},1073741824)})}let W=new AbortController;for(let J of["SIGTERM","SIGINT"])process.on(J,()=>W.abort());let G=new Map,L,M=new Promise((J)=>{L=J}),H=M.then(()=>import("./vm-hands-executor-pm8ns2zs.js")).then(({createVmHandsExecutor:J})=>{let $=J({init:Q,root:h,runtimeDirectory:C,apiOrigin:Q.api_origin,prespawn:!0,onSrtReset:()=>{X=!1,Z=y(Q,j)},srtWarmLate:()=>X,forward:(B,K,g)=>G.get(B)?.(K,g)??Promise.reject(Error("vm_hands_not_bound")),log:(B,K)=>j(B,K)});return j("executor_loaded"),$}),Y=(J)=>async(...$)=>(await H)[J](...$),w=null;H.then((J)=>{w=($)=>J.executorExited($)});let N={startExecutor:async(...J)=>{return await z(),Y("startExecutor")(...J)},killAndVerifyPayload:Y("killAndVerifyPayload"),killProbe:Y("killProbe"),runProbe:async(...J)=>{return await z(),Y("runProbe")(...J)},restatLayout:()=>{throw Error("replaced below")},verifyMounts:()=>{throw Error("replaced below")},installEnvironment:()=>{throw Error("replaced below")},executorExited:(J)=>w?w(J):new Promise(()=>{}),takeSrtFallbacks:()=>null};H.then((J)=>{N.restatLayout=()=>J.restatLayout(),N.verifyMounts=()=>J.verifyMounts(),N.installEnvironment=($,B)=>J.installEnvironment($,B),N.freezeBind=($)=>J.freezeBind($),N.takeSrtFallbacks=()=>J.takeSrtFallbacks?.()??null});let o=await k(Q),n=new m(Q,o,N,{envRoot:R}),b=$j(Q),E=null,a=Promise.all([b,import("./local-capabilities-jp7mfe90.js")]).then(([J,$])=>{E=zj(J,$.capabilityInventoryForRoots),j("device_ops_loaded")}).catch((J)=>j("device_ops_unavailable",{error:J instanceof Error?J.name:"error"})),T=M.then(()=>import("./vm-hands-executor-pm8ns2zs.js")).then(({createVmHandsOpRunners:J,vmHandsBindCgroup:$,VM_HANDS_PAYLOAD_CGROUP:B})=>J({payloadUid:Q.layout.payload_uid,payloadGid:Gj(Q.layout.payload_uid),bindCgroup:(K)=>$(B,K),log:(K,g)=>j(K,g)})).catch(()=>null);T.then((J)=>J?.warm("person")),j("agent_ready"),await l({apiOrigin:Q.api_origin,agent:n,signal:W.signal,heartbeat:async()=>E??await b,executeOp:async({kind:J,claim:$,bindId:B,signal:K,emit:g})=>{let x=Fj(Q,$);if(!x)return{status:"failed",error_code:"vm_hands_bind_invalid"};let _={executionMode:"unsandboxed",runtimeDirectory:C,readiness:Object.fromEntries(P.map((U)=>[U,!0]))},I=(U)=>{let V=typeof U.kind==="string"?U.kind:"";if(V)g({kind:V,...U.data&&typeof U.data==="object"?{data:U.data}:{}})};if($.capability==="exec.full"&&J!=="person")return{status:"failed",error_code:"capability_not_granted"};if($.capability==="automation.call.v1"&&J!=="model")return{status:"failed",error_code:"capability_not_granted"};let r=$.capability==="pty.start"&&J==="person"&&!$.authority;if(Xj.has(String($.capability))&&!r){let{executeLocalOperation:U}=await import("./local-capabilities-jp7mfe90.js");return U(x,$,{worker:_,signal:K,emit:(V)=>I(V)})}let O=await T;if(!O)return{status:"failed",error_code:"vm_hands_payload_account_unavailable"};return O.run(J,{id:String($.attempt_id),claim:$,state:x,worker:_},I,K,B)},readyData:({launchId:J})=>({executor_launch_id:J}),log:(J,$)=>{if(J==="vm_hands.registered"||J==="vm_hands.reconnected")L();j(J,$)},onTurn:(J,$)=>{if($)G.set(J,$);else G.delete(J)}}),await(await H).stop(),(await T)?.stop()}export{Kj as vmHandsOomProtection,y as startBaseSrtServer,Wj as runVmHands,Nj as parseVmHandsInit,$j as heartbeatBody,Zj as enableBaseKeyedSrt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{r as a}from"./vm-hands-entry-lite-xhbjkkk5.js";import"./vm-hands-entry-lite-v0kpksbf.js";import"./vm-hands-entry-lite-e99ftdr6.js";import"./vm-hands-entry-lite-g7h6wjqy.js";import"./vm-hands-entry-lite-sbn9bmf7.js";import"./vm-hands-entry-lite-ek5r435m.js";import"./vm-hands-entry-lite-bgs4zjkf.js";import"./vm-hands-entry-lite-e1cbqqqw.js";import"./vm-hands-entry-lite-69n9q5f1.js";import"./vm-hands-entry-lite-5d31qv44.js";export{a as configureWorkerSandbox};
|
package/package.json
CHANGED
package/bin/ara
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{F as a,G as b,H as c,I as d,J as e,K as f}from"./vm-hands-entry-lite-trm3dn8c.js";import"./vm-hands-entry-lite-3ptq7p60.js";import"./vm-hands-entry-lite-csecgmaa.js";import"./vm-hands-entry-lite-ksz1k1dh.js";import"./vm-hands-entry-lite-5x04hakp.js";import"./vm-hands-entry-lite-3nr9q3nf.js";import"./vm-hands-entry-lite-8pgggvbb.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-f78n4wqt.js";export{d as sessionPlace,c as sessionMachine,e as createMachineEnrollmentTicketWithToken,f as ReasonApi,b as REASONING_EFFORTS,a as ApiError};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{v as a,w as b,x as c,y as d,z as e}from"./vm-hands-entry-lite-atg4z1vg.js";import"./vm-hands-entry-lite-trm3dn8c.js";import"./vm-hands-entry-lite-3ptq7p60.js";import"./vm-hands-entry-lite-rtt2w6c6.js";import"./vm-hands-entry-lite-csecgmaa.js";import"./vm-hands-entry-lite-ksz1k1dh.js";import"./vm-hands-entry-lite-5x04hakp.js";import"./vm-hands-entry-lite-3nr9q3nf.js";import"./vm-hands-entry-lite-8pgggvbb.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-f78n4wqt.js";export{d as resolveApiCredentials,e as requireApiCredentials,b as explicitApiOrigin,c as environmentApiKey,a as apiOriginFromEnvironment};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{e as a,f as b,g as c,h as d,i as e,j as f,k as g,l as h,m as i,n as j,o as k,p as l,q as m}from"./vm-hands-entry-lite-40eg3600.js";import"./vm-hands-entry-lite-0seprnh3.js";import"./vm-hands-entry-lite-atg4z1vg.js";import"./vm-hands-entry-lite-trm3dn8c.js";import"./vm-hands-entry-lite-s70v7hej.js";import"./vm-hands-entry-lite-3ptq7p60.js";import"./vm-hands-entry-lite-v679rfw4.js";import"./vm-hands-entry-lite-ejm7666a.js";import"./vm-hands-entry-lite-mc3pkj0q.js";import"./vm-hands-entry-lite-h0keewxv.js";import"./vm-hands-entry-lite-r166b92s.js";import"./vm-hands-entry-lite-rtt2w6c6.js";import"./vm-hands-entry-lite-180h5amj.js";import"./vm-hands-entry-lite-g7h6wjqy.js";import"./vm-hands-entry-lite-e73s63fb.js";import"./vm-hands-entry-lite-bfz54fcx.js";import"./vm-hands-entry-lite-1m7dd8d1.js";import"./vm-hands-entry-lite-0z73amf7.js";import"./vm-hands-entry-lite-02zaqpgh.js";import"./vm-hands-entry-lite-kkgqknmg.js";import"./vm-hands-entry-lite-adpzn7fe.js";import"./vm-hands-entry-lite-00800vjk.js";import"./vm-hands-entry-lite-hfv2tsm9.js";import"./vm-hands-entry-lite-wpcagqfw.js";import"./vm-hands-entry-lite-a1yy1yp3.js";import"./vm-hands-entry-lite-bwpay74g.js";import"./vm-hands-entry-lite-csecgmaa.js";import"./vm-hands-entry-lite-ksz1k1dh.js";import"./vm-hands-entry-lite-2sw5neq5.js";import"./vm-hands-entry-lite-mft9ke08.js";import"./vm-hands-entry-lite-jngk09n6.js";import"./vm-hands-entry-lite-5x04hakp.js";import"./vm-hands-entry-lite-3nr9q3nf.js";import"./vm-hands-entry-lite-szhgkxe9.js";import"./vm-hands-entry-lite-4ze6psry.js";import"./vm-hands-entry-lite-ebgackey.js";import"./vm-hands-entry-lite-8pgggvbb.js";import"./vm-hands-entry-lite-p1s0xyc2.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{g as runDisconnectCli,f as runConnectCli,m as restartConnectionWhenIdle,l as restartConnection,h as logoutConnection,k as connectionUsesUserChrome,i as connectionReport,j as connectionForBrowserExtension,c as connectionDirectory,d as computerDisconnected,e as addConnectionFolder,b as DISCONNECT_HELP,a as CONNECT_HELP};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Pg as a,Qg as b,Rg as c,Sg as d,Tg as e}from"./vm-hands-entry-lite-hfv2tsm9.js";import"./vm-hands-entry-lite-5x04hakp.js";import"./vm-hands-entry-lite-3nr9q3nf.js";import"./vm-hands-entry-lite-f78n4wqt.js";export{b as passwdAccount,e as desktopHome,d as desktopAccount,c as configureDesktopAccount,a as DESKTOP_USER_ENV};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ge as a,he as b,ie as c,je as d,ke as e,le as f,me as g,ne as h,oe as i,pe as j,qe as k,re as l,se as m,te as n,ue as o,ve as p,we as q,xe as r}from"./vm-hands-entry-lite-0z73amf7.js";import"./vm-hands-entry-lite-csecgmaa.js";import"./vm-hands-entry-lite-ksz1k1dh.js";import"./vm-hands-entry-lite-5x04hakp.js";import"./vm-hands-entry-lite-3nr9q3nf.js";import"./vm-hands-entry-lite-f78n4wqt.js";export{r as runInstallReceiptCli,q as recordInstallationReceipt,k as pathEntryAddedByInstaller,l as parseInstallationReceipt,m as loadInstallationReceipt,j as installerReasonAlias,h as installationReceiptPath,g as installationConfigHome,i as installationAliasMatchesTarget,n as hasInstallationDeviceConsent,o as authorizeInstallationForFutureDevice,p as authorizeDesktopInstallationForFutureDevice,a as INSTALLATION_RECEIPT_SCHEMA_VERSION,b as INSTALLATION_DEVICE_CONSENT_VERSION,f as INSTALLATION_BACKGROUND_MODES,e as FUTURE_DEVICE_CONSENT_SCOPE,c as DESKTOP_ACCOUNT_ACCESS_VERSION,d as DESKTOP_ACCOUNT_ACCESS_SCOPE};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Dd as a,Ed as b,Fd as c,Gd as d,Hd as e,Id as f,Jd as g,Kd as h,Ld as i,Md as j,Nd as k,Od as l}from"./vm-hands-entry-lite-bfz54fcx.js";import"./vm-hands-entry-lite-1m7dd8d1.js";import"./vm-hands-entry-lite-0z73amf7.js";import"./vm-hands-entry-lite-02zaqpgh.js";import"./vm-hands-entry-lite-kkgqknmg.js";import"./vm-hands-entry-lite-adpzn7fe.js";import"./vm-hands-entry-lite-00800vjk.js";import"./vm-hands-entry-lite-hfv2tsm9.js";import"./vm-hands-entry-lite-wpcagqfw.js";import"./vm-hands-entry-lite-a1yy1yp3.js";import"./vm-hands-entry-lite-bwpay74g.js";import"./vm-hands-entry-lite-csecgmaa.js";import"./vm-hands-entry-lite-ksz1k1dh.js";import"./vm-hands-entry-lite-2sw5neq5.js";import"./vm-hands-entry-lite-mft9ke08.js";import"./vm-hands-entry-lite-jngk09n6.js";import"./vm-hands-entry-lite-5x04hakp.js";import"./vm-hands-entry-lite-3nr9q3nf.js";import"./vm-hands-entry-lite-szhgkxe9.js";import"./vm-hands-entry-lite-4ze6psry.js";import"./vm-hands-entry-lite-ebgackey.js";import"./vm-hands-entry-lite-8pgggvbb.js";import"./vm-hands-entry-lite-p1s0xyc2.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{d as runRelayed,e as runMacComputerUse,l as runLocalAutomation,k as runAutomationCallLocally,b as parseAutomationPayload,g as localUserChromeProfiles,h as localUserChromeInstance,f as localUserChromeHost,j as localBrowserProfile,c as localAutomationAvailable,i as ensureLocalBrowser,a as AUTOMATION_CHUNK_BYTES};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{$a as m,Ra as c,Sa as d,Ta as e,Ua as f,Va as g,Wa as h,Xa as i,Ya as j,Za as k,_a as l,ab as n,bb as o,cb as p,db as q,eb as r,fb as s,gb as t,hb as u}from"./vm-hands-entry-lite-v679rfw4.js";import"./vm-hands-entry-lite-ejm7666a.js";import"./vm-hands-entry-lite-mc3pkj0q.js";import"./vm-hands-entry-lite-h0keewxv.js";import"./vm-hands-entry-lite-r166b92s.js";import"./vm-hands-entry-lite-rtt2w6c6.js";import"./vm-hands-entry-lite-180h5amj.js";import"./vm-hands-entry-lite-g7h6wjqy.js";import"./vm-hands-entry-lite-e73s63fb.js";import"./vm-hands-entry-lite-bfz54fcx.js";import"./vm-hands-entry-lite-1m7dd8d1.js";import"./vm-hands-entry-lite-0z73amf7.js";import"./vm-hands-entry-lite-02zaqpgh.js";import"./vm-hands-entry-lite-kkgqknmg.js";import"./vm-hands-entry-lite-adpzn7fe.js";import"./vm-hands-entry-lite-00800vjk.js";import"./vm-hands-entry-lite-hfv2tsm9.js";import"./vm-hands-entry-lite-wpcagqfw.js";import"./vm-hands-entry-lite-a1yy1yp3.js";import"./vm-hands-entry-lite-bwpay74g.js";import"./vm-hands-entry-lite-csecgmaa.js";import"./vm-hands-entry-lite-ksz1k1dh.js";import"./vm-hands-entry-lite-2sw5neq5.js";import{Wi as b}from"./vm-hands-entry-lite-mft9ke08.js";import"./vm-hands-entry-lite-jngk09n6.js";import"./vm-hands-entry-lite-5x04hakp.js";import"./vm-hands-entry-lite-3nr9q3nf.js";import"./vm-hands-entry-lite-szhgkxe9.js";import"./vm-hands-entry-lite-4ze6psry.js";import"./vm-hands-entry-lite-ebgackey.js";import"./vm-hands-entry-lite-8pgggvbb.js";import"./vm-hands-entry-lite-p1s0xyc2.js";import"./vm-hands-entry-lite-fb02h1zm.js";import"./vm-hands-entry-lite-8e932j3c.js";import"./vm-hands-entry-lite-88h9vwrv.js";import{Gk as a}from"./vm-hands-entry-lite-g87z5eb6.js";import"./vm-hands-entry-lite-f78n4wqt.js";export{j as writeOpenFlags,g as spawnCaptured,f as sandboxProfile,e as safeEnvironment,k as runTransferCapability,i as runFileCapability,t as rebindLocalHandsControl,b as isProtectedLocalPath,u as executeLocalOperation,m as enrolledWorkspaceRootFingerprint,q as enrolledRootPaths,p as enrolledHomeContainedRootFingerprints,n as enrolledAccountRootPath,o as enrolledAccountRootFingerprint,s as deliverLocalHandsEnvironment,h as defaultLocalCommandRunner,d as confinedExecutionShell,r as capabilityInventoryForRoots,c as SHORT_REQUEST_CAPABILITIES,a as LocalCapabilityError,l as LOCAL_CAPABILITY_REGISTRY};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{kk as a,lk as b,mk as c,nk as d,ok as e,pk as f,qk as g}from"./vm-hands-entry-lite-p1s0xyc2.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{f as trackDesktopRun,c as releaseLocalDesktop,a as noteLocalDesktopUse,g as holdLocalDesktop,b as forgetLocalDesktopUse,e as DESKTOP_WAIT_MS,d as DESKTOP_IDLE_MS};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ck as a,dk as b,ek as c,fk as d,gk as e,hk as f,ik as g}from"./vm-hands-entry-lite-ebgackey.js";import"./vm-hands-entry-lite-g87z5eb6.js";import"./vm-hands-entry-lite-f78n4wqt.js";export{c as requestMacScreenAccess,d as parseMacWindowBounds,a as parseMacScreenStatus,e as openMacWindowBounds,g as openMacInput,b as macScreenStatus,f as MacInputTranslator};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{fg as a,gg as b,hg as c,ig as d,jg as e,kg as f,lg as g,mg as h}from"./vm-hands-entry-lite-kkgqknmg.js";import"./vm-hands-entry-lite-adpzn7fe.js";import"./vm-hands-entry-lite-00800vjk.js";import"./vm-hands-entry-lite-hfv2tsm9.js";import"./vm-hands-entry-lite-wpcagqfw.js";import"./vm-hands-entry-lite-a1yy1yp3.js";import"./vm-hands-entry-lite-bwpay74g.js";import"./vm-hands-entry-lite-csecgmaa.js";import"./vm-hands-entry-lite-ksz1k1dh.js";import"./vm-hands-entry-lite-2sw5neq5.js";import"./vm-hands-entry-lite-mft9ke08.js";import"./vm-hands-entry-lite-jngk09n6.js";import"./vm-hands-entry-lite-5x04hakp.js";import"./vm-hands-entry-lite-3nr9q3nf.js";import"./vm-hands-entry-lite-szhgkxe9.js";import"./vm-hands-entry-lite-4ze6psry.js";import"./vm-hands-entry-lite-ebgackey.js";import"./vm-hands-entry-lite-8pgggvbb.js";import"./vm-hands-entry-lite-p1s0xyc2.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{h as runLocalDisplayStream,f as privateDirectory,c as parseDisplayStreamPayload,e as localDisplayReady,d as localDisplayAvailable,g as ensureLinuxDesktop,a as LOCAL_DISPLAY_MAX_SESSION_MS,b as LINUX_WORKER_DISPLAY};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{og as a,pg as b,qg as c,rg as d,sg as e,tg as f,ug as g,vg as h,wg as i,xg as j}from"./vm-hands-entry-lite-adpzn7fe.js";import"./vm-hands-entry-lite-00800vjk.js";import"./vm-hands-entry-lite-wpcagqfw.js";import"./vm-hands-entry-lite-a1yy1yp3.js";import"./vm-hands-entry-lite-bwpay74g.js";import"./vm-hands-entry-lite-csecgmaa.js";import"./vm-hands-entry-lite-ksz1k1dh.js";import"./vm-hands-entry-lite-5x04hakp.js";import"./vm-hands-entry-lite-3nr9q3nf.js";import"./vm-hands-entry-lite-8pgggvbb.js";import"./vm-hands-entry-lite-8e932j3c.js";import"./vm-hands-entry-lite-g87z5eb6.js";import"./vm-hands-entry-lite-f78n4wqt.js";export{j as runLocalPtySession,e as resolvePtyWorkingDirectory,g as ptyRuntimeSupported,d as parsePtyStartPayload,h as defaultSpawnPty,f as defaultLoginShell,i as defaultConnect,a as LOCAL_PTY_MAX_SESSION_MS,c as LOCAL_PTY_MAX_SESSIONS,b as LOCAL_PTY_MAX_BUFFERED_OUTPUT_BYTES};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ii as a,Ji as b,Ki as c,Li as d,Mi as e,Ni as f,Oi as g,Pi as h,Qi as i,Ri as j}from"./vm-hands-entry-lite-2sw5neq5.js";import"./vm-hands-entry-lite-mft9ke08.js";import"./vm-hands-entry-lite-jngk09n6.js";import"./vm-hands-entry-lite-5x04hakp.js";import"./vm-hands-entry-lite-3nr9q3nf.js";import"./vm-hands-entry-lite-szhgkxe9.js";import"./vm-hands-entry-lite-4ze6psry.js";import"./vm-hands-entry-lite-ebgackey.js";import"./vm-hands-entry-lite-g87z5eb6.js";import"./vm-hands-entry-lite-f78n4wqt.js";export{j as runPermissionsCli,d as reasonIdentity,e as readMacPermissions,f as permissionsSummary,i as parsePermissionsArgs,c as fullDiskAccessTarget,g as formatMacPermissions,h as allowMacPermissions,a as PERMISSIONS_HELP,b as MAC_PERMISSION_IDS};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{mi as A,ni as x,oi as u,xi as y}from"./vm-hands-entry-lite-csecgmaa.js";import{Di as c}from"./vm-hands-entry-lite-ksz1k1dh.js";import{randomUUID as m}from"crypto";import{chmodSync as l,existsSync as p,mkdirSync as jJ,readlinkSync as YJ,readFileSync as GJ,renameSync as OJ,unlinkSync as VJ,writeFileSync as FJ}from"fs";import{homedir as d}from"os";import{basename as P,dirname as H,isAbsolute as v,join as I,normalize as n,relative as HJ,resolve as LJ}from"path";import{unlinkSync as WJ}from"fs";import{dirname as XJ,join as ZJ}from"path";function $J(J){return ZJ(XJ(J),"future-device-grant.json")}function o(J){try{WJ($J(J))}catch(Q){if(!(Q instanceof Error&&("code"in Q)&&Q.code==="ENOENT"))throw Q}}var N=3,NJ=1,TJ=2,D=1,a=1,r="Reason may read and write files and run commands in this signed-in OS account, subject to saved restrictions and operating system permissions.",b="Reason may later execute on this computer inside a Reason sandbox, limited to folders explicitly attached by the user.",zJ=[b,"Ara may later execute on this computer inside an Ara sandbox, limited to folders explicitly attached by the user."];function i(J){return typeof J==="string"&&zJ.includes(J)}var BJ=["future_device","updates_only","cli_only"];function h(J){return typeof J==="string"&&BJ.some((Q)=>Q===J)}function SJ(J=process.env,Q=d()){return J.XDG_CONFIG_HOME?.trim()||I(Q,".config")}function K(J=process.env,Q=d()){let U=x({env:J}),W=SJ(J,Q);return I(W,y(W).state==="kept"?"ara":"reason",...U==="staging"?["staging"]:[],"installation.json")}function G(J){return typeof J==="string"&&J.trim().length>0}var _J=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function IJ(J){return typeof J==="string"&&_J.test(J)}function C(J){return G(J)&&v(J)&&n(J)===J}function t(J){if(!J||typeof J!=="object"||Array.isArray(J))return!1;let Q=J;return C(Q.path)&&(Q.role==="launcher"&&(Q.kind==="file"||Q.kind==="symlink")||Q.role==="worker_root"&&Q.kind==="directory"||Q.role==="alias"&&Q.kind==="symlink"&&C(Q.target))}function g(J){return J.owned_paths?.every((Q)=>Q.role!=="alias"||J.installer==="shell"&&Q.path===I(J.install_dir,J.channel==="staging"?"reason-staging":"reason")&&Q.target===I(J.install_dir,J.channel==="staging"?"ara-staging":"ara")&&J.owned_paths?.some((U)=>U.role==="launcher"&&U.path===Q.target))??!1}function e(J,Q){try{return LJ(H(J),YJ(J))===Q}catch{return!1}}function vJ(J){let Q=P(J),U=Q==="ara"?"reason":Q==="ara-staging"?"reason-staging":null;if(!U)return J;let W=I(H(J),U);return e(W,J)?W:J}function M(J,Q){let U=HJ(J,Q);return U.length>0&&!U.startsWith("..")&&!v(U)}function JJ(J){if(J===null)return!0;if(!J||typeof J!=="object"||Array.isArray(J))return!1;let Q=J;return(Q.kind==="shell_profile"||Q.kind==="windows_user_path")&&G(Q.location)&&G(Q.value)&&(typeof Q.added_by_installer==="boolean"||typeof Q.added_by_ara==="boolean")&&(Q.added_by_installer===void 0||typeof Q.added_by_installer==="boolean")&&(Q.added_by_ara===void 0||typeof Q.added_by_ara==="boolean")}function q(J){return J.added_by_installer??J.added_by_ara??!1}function QJ(J,Q){if(Q===null)return J==="cli_only";if(!Q||typeof Q!=="object"||Array.isArray(Q))return!1;let U=Q;if(U.version!==D||!G(U.recorded_at))return!1;if(J==="future_device")return U.decision==="authorized"&&i(U.scope);return U.scope===null&&U.decision===(J==="updates_only"?"ask":"disabled")}function AJ(J){if(!J||typeof J!=="object"||Array.isArray(J))return null;let Q=J;if(Q.schema_version!==NJ||!A.includes(Q.channel)||Q.install_method!=="curl"||Q.installer!=="shell"&&Q.installer!=="powershell"||!G(Q.installed_at)||!G(Q.version)||!G(Q.target)||!C(Q.install_dir)||!Array.isArray(Q.owned_paths)||!Q.owned_paths.every(t)||!Q.owned_paths.every((U)=>M(Q.install_dir,U.path))||!g(Q)||!JJ(Q.path_entry))return null;return{...Q,schema_version:N,installation_id:null,background_mode:"cli_only",device_consent:null}}function DJ(J){if(!J||typeof J!=="object"||Array.isArray(J))return null;let Q=J;if(Q.schema_version!==TJ||!UJ(Q)||!h(Q.background_mode)||!QJ(Q.background_mode,Q.device_consent))return null;return{...Q,schema_version:N,installation_id:null}}function UJ(J){return A.includes(J.channel)&&(J.install_method==="curl"&&(J.installer==="shell"||J.installer==="powershell")||J.install_method==="desktop"&&J.installer==="desktop"&&Array.isArray(J.owned_paths)&&J.owned_paths.length===0&&J.path_entry===null)&&G(J.installed_at)&&G(J.version)&&G(J.target)&&C(J.install_dir)&&Array.isArray(J.owned_paths)&&J.owned_paths.every(t)&&J.owned_paths.every((Q)=>M(J.install_dir,Q.path))&&g(J)&&JJ(J.path_entry)}function KJ(J){let Q=AJ(J);if(Q)return Q;let U=DJ(J);if(U)return U;if(!J||typeof J!=="object"||Array.isArray(J))return null;let W=J;if(W.schema_version!==N||!IJ(W.installation_id)||!UJ(W)||!h(W.background_mode)||!QJ(W.background_mode,W.device_consent)||W.desktop_account_access!==void 0&&(W.desktop_account_access===null||typeof W.desktop_account_access!=="object"||Array.isArray(W.desktop_account_access)||W.desktop_account_access.version!==a||W.desktop_account_access.scope!==r||!G(W.desktop_account_access.recorded_at)||!Number.isFinite(Date.parse(W.desktop_account_access.recorded_at))))return null;return W}function E(J=K()){if(!p(J))return null;try{return KJ(JSON.parse(GJ(J,"utf8")))}catch{return null}}function f(J){return Boolean(J?.installation_id&&J.background_mode==="future_device"&&J.device_consent?.version===D&&J.device_consent.decision==="authorized"&&i(J.device_consent.scope))}function s(J,Q){let U=E(Q);if(!(f(U)&&f(J)&&U.installation_id===J.installation_id&&U.channel===J.channel))o(Q);jJ(H(Q),{recursive:!0,mode:448}),l(H(Q),448);let X=`${Q}.${process.pid}.${m()}.tmp`;try{FJ(X,`${JSON.stringify(J,null,2)}
|
|
3
|
-
`,{mode:384,flag:"wx"}),l(X,384),OJ(X,Q)}finally{if(p(X))VJ(X)}let Y=H(Q),$=P(Y)==="staging"?H(Y):Y;if(P($)==="reason")y(H($));return J}function RJ(J=K(),Q=new Date){let U=E(J);if(!U?.installation_id)throw Error("Reason installation ownership is missing; reinstall the current CLI before enabling Device execution");if(f(U))return U;let W={...U,background_mode:"future_device",device_consent:{version:D,decision:"authorized",scope:b,recorded_at:Q.toISOString()}};return delete W.desktop_account_access,s(W,J)}function hJ(J,Q=K(),U=new Date){if(!A.includes(J.channel))throw Error("invalid installation channel");if(!J.version.trim())throw Error("installation version is required");if(!J.target.trim())throw Error("installation target is required");let W=_(J.installDir,"install directory"),X=E(Q);if(X?.installation_id&&!J.accountAccess)return RJ(Q,U);return s({...X??{schema_version:N,channel:J.channel,install_method:"desktop",installer:"desktop",installed_at:U.toISOString(),version:J.version.trim(),target:J.target.trim(),install_dir:W,owned_paths:[],path_entry:null},schema_version:N,installation_id:X?.installation_id??m(),background_mode:"future_device",...J.accountAccess?{desktop_account_access:{version:a,scope:r,recorded_at:U.toISOString()}}:{},device_consent:{version:D,decision:"authorized",scope:b,recorded_at:U.toISOString()}},Q)}function qJ(J,Q){return J.kind===Q.kind&&J.location===Q.location&&J.value===Q.value}function _(J,Q){let U=n(J);if(!v(U))throw Error(`${Q} must be an absolute path`);return U}function CJ(J,Q=K(),U=new Date){if(!A.includes(J.channel))throw Error("invalid installation channel");if(!J.version.trim())throw Error("installation version is required");if(!J.target.trim())throw Error("installation target is required");let W=_(J.install_dir,"install directory"),X=E(Q),Y=J.backgroundMode??"preserve",$=Y==="preserve"?X?.background_mode??"cli_only":Y,L=X?.channel===J.channel&&f(X)&&$==="future_device",T=Y==="preserve"&&!X||X?.channel===J.channel&&(Y==="preserve"||L),O={path:_(J.launcherPath,"launcher path"),kind:J.launcherKind,role:"launcher"};if(!M(W,O.path))throw Error("launcher path must be inside the install directory");let z=(J.workerRoots??[]).map((j)=>_(j,"worker root"));if(z.some((j)=>!M(W,j)))throw Error("worker root must be inside the install directory");let B=[];if(J.aliasPath){let j={path:_(J.aliasPath,"alias path"),kind:"symlink",role:"alias",target:O.path};if(!g({installer:J.installer,channel:J.channel,install_dir:W,owned_paths:[O,j]})||!e(j.path,j.target))throw Error("alias must be the channel's symlink to its canonical launcher");B.push(j)}let R=[...X?.channel===J.channel&&X.install_dir===W?X.owned_paths:[],O,...B,...z.map((j)=>({path:j,kind:"directory",role:"worker_root"}))],k=Array.from(new Map(R.map((j)=>[j.path,j])).values()),Z=J.pathEntry??null,F=Z?X?.path_entry&&qJ(Z,X.path_entry)?{...Z,added_by_installer:q(Z)||q(X.path_entry),added_by_ara:q(Z)||q(X.path_entry)}:Z:X?.path_entry??null,S={schema_version:N,installation_id:X?.installation_id??m(),channel:J.channel,install_method:"curl",installer:J.installer,installed_at:U.toISOString(),version:J.version.trim(),target:J.target.trim(),install_dir:W,owned_paths:k,path_entry:F,background_mode:$,device_consent:T?X?.device_consent??null:{version:D,decision:$==="future_device"?"authorized":$==="updates_only"?"ask":"disabled",scope:$==="future_device"?b:null,recorded_at:U.toISOString()},...L&&X.desktop_account_access?{desktop_account_access:X.desktop_account_access}:{}};return s(S,Q)}function w(J,Q){let U=J.indexOf(Q);if(U===-1)return;let W=J[U+1];if(!W||W.startsWith("--"))throw Error(`${Q} needs a value`);return W}function V(J,Q){let U=w(J,Q);if(!U)throw Error(`${Q} is required`);return U}function gJ(J,Q={}){let U=Q.io??{stdout:process.stdout,stderr:process.stderr};try{let W=new Set(["--channel","--installer","--version","--target","--install-dir","--launcher-path","--launcher-kind","--worker-root","--path-kind","--path-location","--path-value","--background-mode"]);for(let Z=0;Z<J.length;Z+=1){let F=J[Z];if(F==="--path-added")continue;if(!W.has(F))throw Error(`unknown option: ${F}`);if(Z+=1,Z>=J.length)throw Error(`${F} needs a value`)}let X=Q.env??process.env,Y=V(J,"--channel"),$=x({env:X,executablePath:Q.executablePath});if(Y!==$)throw Error(`installer channel ${Y} does not match running ${$} CLI`);let L=V(J,"--installer");if(L!=="shell"&&L!=="powershell")throw Error("--installer must be shell or powershell");let T=V(J,"--launcher-kind");if(T!=="file"&&T!=="symlink")throw Error("--launcher-kind must be file or symlink");let O=w(J,"--path-kind"),z=null;if(O){if(O!=="shell_profile"&&O!=="windows_user_path")throw Error("--path-kind must be shell_profile or windows_user_path");z={kind:O,location:V(J,"--path-location"),value:V(J,"--path-value"),added_by_installer:J.includes("--path-added"),added_by_ara:J.includes("--path-added")}}else if(J.includes("--path-location")||J.includes("--path-value")||J.includes("--path-added"))throw Error("path entry flags require --path-kind");let B={channel:$,install_method:"curl",installer:L,version:V(J,"--version"),target:V(J,"--target"),install_dir:V(J,"--install-dir"),launcherPath:V(J,"--launcher-path"),launcherKind:T,workerRoots:J.flatMap((Z,F)=>{if(Z!=="--worker-root")return[];let S=J[F+1];if(!S||S.startsWith("--"))throw Error("--worker-root needs a value");return[S]}),pathEntry:z,backgroundMode:(()=>{let Z=w(J,"--background-mode")??"preserve";if(Z!=="preserve"&&!h(Z))throw Error("--background-mode must be future_device, updates_only, cli_only, or preserve");return Z})()},R=c(X,"REASON_INSTALL_ALIAS_PATH");if(R)B.aliasPath=R;let k=K(u(X,$),Q.home??d());return(Q.writeReceipt??CJ)(B,k,Q.now?.()??new Date),0}catch(W){return U.stderr.write(`Reason installer receipt: ${W instanceof Error?W.message:String(W)}
|
|
4
|
-
`),1}}
|
|
5
|
-
export{N as ge,D as he,a as ie,r as je,b as ke,BJ as le,SJ as me,K as ne,e as oe,vJ as pe,q as qe,KJ as re,E as se,f as te,RJ as ue,hJ as ve,CJ as we,gJ as xe};
|
|
@@ -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-jngk09n6.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,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{createHash as f,createPublicKey as V,verify as G}from"crypto";var H="libara_device_keychain.dylib",Y="libreason_device_keychain.dylib",k=1,x=2,h=536870912,p=262144;var U=["darwin-arm64","darwin-x64"];class J extends Error{code;constructor(z,F){super(F);this.code=z;this.name="ManagedRuntimeError"}}var C=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,N=/^[a-f0-9]{64}$/;function X(z){return Boolean(z)&&typeof z==="object"&&!Array.isArray(z)}function $(z,F,Q=[]){let Z=new Set([...F,...Q]);return F.every((W)=>(W in z))&&Object.keys(z).every((W)=>Z.has(W))}function B(z){return typeof z==="string"&&C.test(z)}function O(z){return typeof z==="string"&&!Number.isNaN(Date.parse(z))&&new Date(z).toISOString()===z}function c(z){return U.includes(z)}function I(z,F){if(!B(z)||!c(F))throw new J("invalid_release_asset","Invalid managed runtime release asset.");return`ara-runtime-v${z}-${F}`}function m(z,F){return`${I(z,F)}-${H}`}var R="managed-runtime-identity.json",D="reason-macos-background-identity-v1";function q(z){if(z===null)return"null";if(typeof z==="string"||typeof z==="boolean")return JSON.stringify(z);if(typeof z==="number"){if(!Number.isFinite(z))throw new J("invalid_manifest","Manifest numbers must be finite.");return JSON.stringify(z)}if(Array.isArray(z))return`[${z.map((F)=>q(F)).join(",")}]`;if(X(z))return`{${Object.keys(z).sort().map((F)=>`${JSON.stringify(F)}:${q(z[F])}`).join(",")}}`;throw new J("invalid_manifest","Manifest contains an unsupported value.")}function j(z){if(!X(z)||!$(z,["url","sha256","size_bytes"])||typeof z.url!=="string"||typeof z.sha256!=="string"||!N.test(z.sha256)||typeof z.size_bytes!=="number"||!Number.isSafeInteger(z.size_bytes)||z.size_bytes<=0||z.size_bytes>h)throw new J("invalid_manifest","Manifest contains an invalid runtime artifact.");let F;try{F=new URL(z.url)}catch{throw new J("invalid_manifest","Runtime artifact URL is invalid.")}if(F.protocol!=="https:"||F.username||F.password||F.hash)throw new J("invalid_manifest","Runtime artifact URL must be an HTTPS URL without credentials or a fragment.");return{url:F.toString(),sha256:z.sha256,size_bytes:z.size_bytes}}function b(z){if(!X(z)||!$(z,["broker","credential_library"]))throw new J("invalid_manifest","Manifest must bind the broker and credential library as one runtime.");return{broker:j(z.broker),credential_library:j(z.credential_library)}}function K(z){if(!X(z)||!$(z,["schema_version","version","published_at","artifacts"])||z.schema_version!==x||!B(z.version)||!O(z.published_at)||!X(z.artifacts)||!$(z.artifacts,[...U]))throw new J("invalid_manifest","Managed Reason runtime manifest is invalid.");return{schema_version:x,version:z.version,published_at:z.published_at,artifacts:{"darwin-arm64":b(z.artifacts["darwin-arm64"]),"darwin-x64":b(z.artifacts["darwin-x64"])}}}function _(z){if(!X(z)||!$(z,["schema_version","version","published_at","artifacts"])||z.schema_version!==k||!B(z.version)||!O(z.published_at)||!X(z.artifacts)||!$(z.artifacts,[...U]))throw new J("invalid_manifest","Legacy managed runtime manifest is invalid.");return{schema_version:k,version:z.version,published_at:z.published_at,artifacts:{"darwin-arm64":j(z.artifacts["darwin-arm64"]),"darwin-x64":j(z.artifacts["darwin-x64"])}}}function M(z){if(!X(z)||!$(z,["schema","version","published_at","artifacts"])||z.schema!==D||!B(z.version)||!O(z.published_at)||!X(z.artifacts)||!$(z.artifacts,[...U]))throw new J("invalid_manifest","Reason background identity manifest is invalid.");return{schema:D,version:z.version,published_at:z.published_at,artifacts:{"darwin-arm64":j(z.artifacts["darwin-arm64"]),"darwin-x64":j(z.artifacts["darwin-x64"])}}}function S(z){if(typeof z!=="string"||!/^[A-Za-z0-9+/]+={0,2}$/.test(z))throw new J("invalid_signature","Runtime manifest signature is invalid.");let F=Buffer.from(z,"base64");if(F.length!==64||F.toString("base64")!==z)throw new J("invalid_signature","Runtime manifest signature is invalid.");return F}function L(z){let F=z;if(typeof z==="string")try{F=JSON.parse(z)}catch{throw new J("invalid_manifest","Managed Reason runtime manifest is not valid JSON.")}if(!X(F)||!$(F,["key_id","manifest","signature"])||typeof F.key_id!=="string"||!/^[A-Za-z0-9._-]{1,80}$/.test(F.key_id)||typeof F.signature!=="string")throw new J("invalid_manifest","Signed managed Reason runtime manifest is invalid.");return F}function o(z,F){let Q=L(z),Z=F[Q.key_id];if(!Z)throw new J("untrusted_key","Runtime manifest was signed by an unknown key.");let W=K(Q.manifest),w=S(Q.signature),P=!1;try{P=G(null,Buffer.from(q(W)),V(Z),w)}catch{throw new J("invalid_signature","Runtime manifest signature could not be verified.")}if(!P)throw new J("invalid_signature","Runtime manifest signature did not match.");return{key_id:Q.key_id,manifest:W,signature:Q.signature}}function E(z,F){let Q=L(z),Z=F[Q.key_id];if(!Z)throw new J("untrusted_key","Background identity manifest was signed by an unknown key.");let W=M(Q.manifest),w=S(Q.signature),P=!1;try{P=G(null,Buffer.from(q(W)),V(Z),w)}catch{throw new J("invalid_signature","Background identity manifest signature could not be verified.")}if(!P)throw new J("invalid_signature","Background identity manifest signature did not match.");return{key_id:Q.key_id,manifest:W,signature:Q.signature}}function d(z,F){let Q=z;if(typeof z==="string")try{Q=JSON.parse(z)}catch{throw new J("invalid_manifest","Legacy managed runtime manifest is not valid JSON.")}if(!X(Q)||!$(Q,["key_id","manifest","signature"])||typeof Q.key_id!=="string"||!/^[A-Za-z0-9._-]{1,80}$/.test(Q.key_id)||typeof Q.signature!=="string")throw new J("invalid_manifest","Signed legacy managed runtime manifest is invalid.");let Z=F[Q.key_id];if(!Z)throw new J("untrusted_key","Legacy runtime manifest was signed by an unknown key.");let W=_(Q.manifest),w=S(Q.signature),P=!1;try{P=G(null,Buffer.from(q(W)),V(Z),w)}catch{throw new J("invalid_signature","Legacy runtime manifest signature could not be verified.")}if(!P)throw new J("invalid_signature","Legacy runtime manifest signature did not match.");return{key_id:Q.key_id,manifest:W,signature:Q.signature}}function A(z){return f("sha256").update(z).digest("hex")}function i(z,F){if(z.byteLength!==F.size_bytes)throw new J("artifact_size_mismatch","Runtime artifact size did not match its manifest.");if(A(z)!==F.sha256)throw new J("artifact_checksum_mismatch","Runtime artifact checksum did not match its manifest.")}import{existsSync as y}from"fs";import{join as T}from"path";function v(z){let F=T(z,Y);return y(F)?F:T(z,H)}
|
|
3
|
-
export{H as Wh,Y as Xh,k as Yh,x as Zh,h as _h,p as $h,U as ai,J as bi,I as ci,m as di,R as ei,q as fi,o as gi,E as hi,d as ii,A as ji,i as ki,v as li};
|