@reason-machines/cli-linux-x64 0.2.505 → 0.2.506
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.txt +8 -7
- package/bin/reason +2 -2
- package/bin/runtime/srt/sandbox-runtime.mjs +52 -52
- package/bin/vm-hands/api-credentials-09xx3z37.js +2 -0
- package/bin/vm-hands/api-s4znv8fp.js +2 -0
- package/bin/vm-hands/connect-cli-f76njmkm.js +2 -0
- package/bin/vm-hands/credentials-drj5ktpt.js +2 -0
- package/bin/vm-hands/custom-endpoint-device-j1x988g0.js +2 -0
- package/bin/vm-hands/desktop-account-4525j7h3.js +2 -0
- package/bin/vm-hands/device-workspace-pt07525s.js +2 -0
- package/bin/vm-hands/fsevents-8zxmv89w.js +2 -0
- package/bin/vm-hands/hands-worker-source-atg5dc7b.js +2 -0
- package/bin/vm-hands/index-ttmxy9nd.js +12818 -0
- package/bin/vm-hands/install-receipt-6v65enmf.js +2 -0
- package/bin/vm-hands/local-automation-qbgbpftn.js +2 -0
- package/bin/vm-hands/local-capabilities-3j6ftyf5.js +2 -0
- package/bin/vm-hands/local-desktop-users-9dqayaej.js +2 -0
- package/bin/vm-hands/local-display-mac-fnp3317m.js +2 -0
- package/bin/vm-hands/local-display-session-8dc6mct3.js +2 -0
- package/bin/vm-hands/local-display-video-zj8mz5vs.js +2 -0
- package/bin/vm-hands/local-managed-process-qgj5jfnb.js +2 -0
- package/bin/vm-hands/local-pty-session-5yh2a63r.js +2 -0
- package/bin/vm-hands/managed-runtime-jwxh8gfp.js +2 -0
- package/bin/vm-hands/network-contract-rzw769gw.js +2 -0
- package/bin/vm-hands/package-r7sgmw4t.js +2 -0
- package/bin/vm-hands/permissions-j5ggzkk4.js +2 -0
- package/bin/vm-hands/reason-hands-protocol-8fgk2s53.js +2 -0
- package/bin/vm-hands/serve-service-2m11vpyd.js +2 -0
- package/bin/vm-hands/status-qg16wxre.js +10 -0
- package/bin/vm-hands/version-96pq5c8m.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-23m94yra.js +539 -0
- package/bin/vm-hands/vm-hands-entry-lite-38g65s5x.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-3h9rka2b.js +14 -0
- package/bin/vm-hands/vm-hands-entry-lite-3sjkzhf6.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-5gevvgec.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-5tbntcyq.js +42 -0
- package/bin/vm-hands/vm-hands-entry-lite-622t4qbv.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-s8ty42st.js → vm-hands-entry-lite-69ng6mye.js} +5 -9
- package/bin/vm-hands/vm-hands-entry-lite-6x1an7es.js +7 -0
- package/bin/vm-hands/vm-hands-entry-lite-7777m86y.js +3 -0
- package/bin/vm-hands/{vm-hands-entry-lite-b7wy89y0.js → vm-hands-entry-lite-77j164ps.js} +54 -54
- package/bin/vm-hands/vm-hands-entry-lite-87vmbt38.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-8wcyveeh.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-b4ebg75b.js +52 -0
- package/bin/vm-hands/vm-hands-entry-lite-cqramfsh.js +4 -0
- package/bin/vm-hands/vm-hands-entry-lite-eabever7.js +112 -0
- package/bin/vm-hands/vm-hands-entry-lite-ewr54tpc.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-ezbs3nn1.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-f62fvme8.js +5 -0
- package/bin/vm-hands/vm-hands-entry-lite-f69t48dj.js +4 -0
- package/bin/vm-hands/{vm-hands-entry-lite-8p8hz0j1.js → vm-hands-entry-lite-fcvf8md1.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-gs7j14bz.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-gvjffc5t.js +65 -0
- package/bin/vm-hands/vm-hands-entry-lite-hmaazqdr.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-mcjca0ez.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-mk5ayds8.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-ncbzy69k.js +4 -0
- package/bin/vm-hands/vm-hands-entry-lite-nkp4ccvt.js +9 -0
- package/bin/vm-hands/vm-hands-entry-lite-np07qyeq.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-nqdstx24.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-nwrqwqhh.js +5 -0
- package/bin/vm-hands/vm-hands-entry-lite-ppzj5jgc.js +2 -0
- package/bin/vm-hands/vm-hands-entry-lite-psywfz8m.js +9 -0
- package/bin/vm-hands/vm-hands-entry-lite-qpdpzg8g.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-qy9xg6em.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-r3vd5k1q.js +452 -0
- package/bin/vm-hands/{vm-hands-entry-lite-xd2dn3n8.js → vm-hands-entry-lite-rfz60hb3.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-rzr2ncf5.js +5 -0
- package/bin/vm-hands/vm-hands-entry-lite-swrymqj9.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-t0wbspg5.js +126 -0
- package/bin/vm-hands/vm-hands-entry-lite-t3a1fsnk.js +128 -0
- package/bin/vm-hands/vm-hands-entry-lite-tebh7dcm.js +6 -0
- package/bin/vm-hands/vm-hands-entry-lite-txd50spx.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-v9qq2cgv.js +4 -0
- package/bin/vm-hands/{vm-hands-entry-lite-c8bf82tx.js → vm-hands-entry-lite-wrvz9jxy.js} +2 -2
- package/bin/vm-hands/vm-hands-entry-lite-x39tmj7j.js +5 -0
- package/bin/vm-hands/vm-hands-entry-lite-xh59ch7y.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite-xwqrndky.js +105 -0
- package/bin/vm-hands/vm-hands-entry-lite-yretc2th.js +3 -0
- package/bin/vm-hands/vm-hands-entry-lite.js +3 -1
- package/bin/vm-hands/vm-hands-executor-bcw4gm80.js +12 -0
- package/bin/vm-hands/vm-hands-op-runner-r4m9whbb.js +2 -0
- package/bin/vm-hands/vm-hands-runtime-x79a9j7q.js +4 -0
- package/bin/vm-hands/worker-preview-readiness-7xtgxsar.js +2 -0
- package/bin/vm-hands/worker-sandbox-s9pyac8p.js +2 -0
- package/package.json +1 -1
- package/bin/vm-hands/api-credentials-23k36ayh.js +0 -2
- package/bin/vm-hands/api-jd29p2kc.js +0 -2
- package/bin/vm-hands/ask-relay-zpp0rkhg.js +0 -4
- package/bin/vm-hands/connect-cli-xyxgcg6z.js +0 -2
- package/bin/vm-hands/credentials-byna24dv.js +0 -2
- package/bin/vm-hands/custom-endpoint-device-p2agcsk0.js +0 -2
- package/bin/vm-hands/desktop-account-z16mmkxg.js +0 -2
- package/bin/vm-hands/device-workspace-y0tk3ne8.js +0 -2
- package/bin/vm-hands/hands-worker-source-0qa16xzj.js +0 -2
- package/bin/vm-hands/index-h6xkz48h.js +0 -12818
- package/bin/vm-hands/install-receipt-nnragt7p.js +0 -2
- package/bin/vm-hands/local-automation-xbpca0f3.js +0 -2
- package/bin/vm-hands/local-capabilities-30m8pzpv.js +0 -2
- package/bin/vm-hands/local-desktop-users-gxfywsan.js +0 -2
- package/bin/vm-hands/local-display-mac-n236gkpe.js +0 -2
- package/bin/vm-hands/local-display-session-ddafdm8k.js +0 -2
- package/bin/vm-hands/local-display-video-gha54xwa.js +0 -2
- package/bin/vm-hands/local-managed-process-0zwxyqxd.js +0 -2
- package/bin/vm-hands/local-pty-session-w1yrmjm0.js +0 -2
- package/bin/vm-hands/managed-runtime-8y90twae.js +0 -2
- package/bin/vm-hands/network-contract-v0fkg94d.js +0 -2
- package/bin/vm-hands/network-sign-in-3dkdkh3a.js +0 -34
- package/bin/vm-hands/package-z2dk6xva.js +0 -2
- package/bin/vm-hands/permissions-ga1ax8wd.js +0 -2
- package/bin/vm-hands/reason-hands-protocol-vzgxd159.js +0 -2
- package/bin/vm-hands/serve-service-42nqanvr.js +0 -2
- package/bin/vm-hands/status-m0g7k47a.js +0 -96
- package/bin/vm-hands/version-ye6800p2.js +0 -2
- package/bin/vm-hands/vm-hands-entry-lite-00y3kn86.js +0 -7
- package/bin/vm-hands/vm-hands-entry-lite-0572m6cr.js +0 -344
- package/bin/vm-hands/vm-hands-entry-lite-07q2xvk1.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-0a4cy8gw.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-1nj03gbj.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-26xb026c.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-33h8294z.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-3882raa5.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-3rg3znp8.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-4swa18qz.js +0 -10
- package/bin/vm-hands/vm-hands-entry-lite-56v9haps.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-6x5pj2y0.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-8twscwtw.js +0 -112
- package/bin/vm-hands/vm-hands-entry-lite-8xe0wzp9.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-ah2ep922.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-b0p8f295.js +0 -52
- package/bin/vm-hands/vm-hands-entry-lite-c5gt0086.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-dgmap6z4.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-dhqmbqsh.js +0 -9
- package/bin/vm-hands/vm-hands-entry-lite-e1xjfj57.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-e4hwb89r.js +0 -66
- package/bin/vm-hands/vm-hands-entry-lite-g6r5xrk0.js +0 -105
- package/bin/vm-hands/vm-hands-entry-lite-ghhpgt3v.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-h5smacqn.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-jd31as70.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-k9n1pk42.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-kqbats5n.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-p9fwt68c.js +0 -42
- package/bin/vm-hands/vm-hands-entry-lite-pkk555dx.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-pmw3ycgc.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-q9g11dbj.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-r374pchj.js +0 -9
- package/bin/vm-hands/vm-hands-entry-lite-r665z809.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-rck5h8fr.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-rj8yq6gp.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-s8zfzv0k.js +0 -6
- package/bin/vm-hands/vm-hands-entry-lite-tafgty5k.js +0 -4
- package/bin/vm-hands/vm-hands-entry-lite-tbdcmq09.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-td309c1y.js +0 -5
- package/bin/vm-hands/vm-hands-entry-lite-v0bp1v66.js +0 -128
- package/bin/vm-hands/vm-hands-entry-lite-v0k8b768.js +0 -452
- package/bin/vm-hands/vm-hands-entry-lite-v4r1fggm.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-vqr3zrqr.js +0 -539
- package/bin/vm-hands/vm-hands-entry-lite-wbfmc0xn.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-x3pbyg92.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-yqn8h1p0.js +0 -3
- package/bin/vm-hands/vm-hands-entry-lite-zj3hb5jk.js +0 -127
- package/bin/vm-hands/vm-hands-entry-lite-zz8tr0bm.js +0 -12
- package/bin/vm-hands/vm-hands-executor-6tncheya.js +0 -12
- package/bin/vm-hands/vm-hands-op-runner-s1ghsym7.js +0 -2
- package/bin/vm-hands/vm-hands-runtime-k6egwk2t.js +0 -4
- package/bin/vm-hands/worker-preview-readiness-wh0yg1dz.js +0 -2
- package/bin/vm-hands/worker-sandbox-s054x4zw.js +0 -2
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{$e as Zz,Xe as Qz,bf as R,ef as $z}from"./vm-hands-entry-lite-dgmap6z4.js";import{Pj as e,ck as V,ek as zz}from"./vm-hands-entry-lite-r374pchj.js";import{Tk as Jz}from"./vm-hands-entry-lite-e1xjfj57.js";import{bl as Hz}from"./vm-hands-entry-lite-8p8hz0j1.js";import{sl as X}from"./vm-hands-entry-lite-kqbats5n.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)=>zz(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=Jz({env:z})==="staging",Z=Q?"ara-staging":"ara",B=[J?Zz(J):null,Hz(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>${e}</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 xe,P as ye,kz as ze,qH as Ae,M as Be,jH as Ce,GH as De,MH as Ee,Gz as Fe,YH as Ge,DH as He,d as Ie,vz as Je,UH as Ke,NH as Le,TH as Me,LH as Ne,XH as Oe,FH as Pe};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Dl as e}from"./vm-hands-entry-lite-pkk555dx.js";var i=e((o,t)=>{t.exports={name:"playwright-core",version:"1.60.0",description:"A high-level API to automate web browsers",repository:{type:"git",url:"git+https://github.com/microsoft/playwright.git"},homepage:"https://playwright.dev",engines:{node:">=18"},author:{name:"Microsoft Corporation"},license:"Apache-2.0",exports:{".":{types:"./index.d.ts",import:"./index.mjs",require:"./index.js",default:"./index.js"},"./package.json":"./package.json","./lib/bootstrap":"./lib/bootstrap.js","./lib/coreBundle":"./lib/coreBundle.js","./lib/utilsBundle":"./lib/utilsBundle.js","./lib/tools/cli-client/program":"./lib/tools/cli-client/program.js"},bin:{"playwright-core":"cli.js"},types:"types/types.d.ts"}});
|
|
3
|
-
export{i as Wa};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var U=".reason/workspace",T="workspace_base",y="sessions",W="workspace_layout",g=".reason/workspace/sessions",B=/^[0-9a-f]{8}$/;function C(j){if(!J(j))return!1;let q=".reason/workspace/sessions/";if(!j.startsWith(q))return!1;let z=j.slice(q.length).split("/");return z.length===2&&B.test(z[0])}var G=4096,X="workspaces/pi";function J(j){if(typeof j!=="string"||!j||j.length>G)return!1;if(j.startsWith("/")||j.includes("\x00")||j.includes("\\"))return!1;return j.split("/").every((q)=>q!==""&&q!=="."&&q!=="..")}function Z(j){if(j.kind==="root"){if(j.path===void 0)return".";if(!J(j.path))throw Error("invalid_device_workspace_identity");return j.path}if(!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$/.test(j.workspaceId)||j.workspaceId==="."||j.workspaceId==="..")throw Error("invalid_device_workspace_identity");let q=j.layout==="sessions"?"sessions":X;return`${j.base?`${j.base}/`:""}${q}/${j.workspaceId}/repo`}function L(j){if(!j||typeof j!=="object"||Array.isArray(j))return null;let q=j;if(q.kind==="root"&&Object.keys(q).length===1)return{kind:"root"};if(q.kind==="root"&&Object.keys(q).length===2&&J(q.path))return{kind:"root",path:q.path};if(q.kind!=="managed"||typeof q.workspaceId!=="string"||Object.keys(q).length!==2+(q.base===void 0?0:1)+(q.layout===void 0?0:1)||q.base!==void 0&&q.base!==".reason/workspace"||q.layout!==void 0&&q.layout!=="sessions")return null;let z={kind:"managed",workspaceId:q.workspaceId,...q.base===".reason/workspace"?{base:".reason/workspace"}:{},...q.layout==="sessions"?{layout:"sessions"}:{}};try{return Z(z),z}catch{return null}}var b="/home/runner",P=10001,x="/run/reason/sessions",f=/^(?:\/[A-Za-z0-9._-]+)+$/,M=/-sidechat-([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/,H=/^(.+)-repository-[a-z0-9][a-z0-9._-]*-[0-9a-f]{12}$/;function K(j){return M.exec(j)?.[1]??H.exec(j)?.[1]??j}var $=/^((?:\/[A-Za-z0-9._-]+)+)\/\.reason\/workspace\/(workspaces\/pi|sessions)\/([^/]+)$/,A="*/.reason/workspace/workspaces/pi/*|*/.reason/workspace/sessions/*";function N(j,q=b,z="sessions"){if(!f.test(q)||q.split("/").some((V)=>V==="."||V===".."))throw Error("invalid_cloud_payload_home");let Q=`${q}/${Z({kind:"managed",workspaceId:j,base:".reason/workspace",...z?{layout:z}:{}})}`,F=`${x}/${K(j)}`;return{home:q,root:Q.slice(0,-5),checkout:Q,control:F,jobEnv:`${F}/job.env`,cloudAccess:`${F}/cloud-access`,logs:`${F}/logs`,pin:`${F}/ws`}}function Y(j){return $.exec(j.replace(/\/+$/,""))?.[2]==="sessions"?"sessions":null}function D(j){return{kind:"managed",workspaceId:j,layout:"sessions"}}function R(j){let q=$.exec(j.replace(/\/+$/,""));if(!q)return null;try{let z=N(q[3],q[1],Y(j));return z.root===j.replace(/\/+$/,"")?z:null}catch{return null}}
|
|
3
|
-
export{U as rk,T as sk,y as tk,W as uk,g as vk,B as wk,C as xk,J as yk,Z as zk,L as Ak,b as Bk,P as Ck,x as Dk,M as Ek,H as Fk,$ as Gk,A as Hk,N as Ik,Y as Jk,D as Kk,R as Lk};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{mk as J}from"./vm-hands-entry-lite-56v9haps.js";import{readFileSync as L}from"fs";import{isAbsolute as M,normalize as Q}from"path";var W="REASON_WORKER_DESKTOP_USER",G=null;function X(q,B){for(let I of B.split(`
|
|
3
|
-
`)){let j=I.split(":");if(j.length<7||Number(j[2])!==q||!/^\d+$/.test(j[2])||!/^\d+$/.test(j[3]))continue;let x=j[5];if(!/^[a-z_][a-z0-9_-]*$/i.test(j[0])||!M(x)||Q(x)!==x||x==="/")return null;return{username:j[0],uid:q,gid:Number(j[3]),home:x}}return null}function b(q={}){let B="value"in q?q.value:process.env[W];if(G=null,B===void 0||B==="")return null;let I=q.platform??process.platform,j="euid"in q?q.euid:process.geteuid?.(),x=/^[1-9]\d{0,9}$/.test(B)?Number(B):NaN,C=I==="linux"&&j===0&&Number.isSafeInteger(x)?X(x,(q.passwd??(()=>L("/etc/passwd","utf8")))()):null;if(!C||C.gid===0)throw Error("worker_desktop_user_invalid");return G=C,C}function k(){return G}function y(){return G?.home??J()}
|
|
4
|
-
export{W as sj,X as tj,b as uj,k as vj,y as wj};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{zl as M}from"./vm-hands-entry-lite-xd2dn3n8.js";import{Al as D}from"./vm-hands-entry-lite-ghhpgt3v.js";import{execFileSync as A}from"child_process";import{realpathSync as U,statSync as F}from"fs";import{tmpdir as j}from"os";import{createRequire as I}from"module";import{win32 as Z}from"path";var J=["/bin/bash","/usr/bin/bash"],u="Git Bash was not found. Install Git for Windows (https://git-scm.com/download/win), then run `reason connect`.";function k(K){try{return F(K).isFile()}catch{return!1}}var q=(K)=>[Z.join(K,"bin","bash.exe"),Z.join(K,"usr","bin","bash.exe")];function O(K,Q){let L=Z.normalize(K).toLowerCase(),Y=(Q.SystemRoot??Q.SYSTEMROOT??"C:\\Windows").toLowerCase();return L.startsWith(Z.join(Y,"system32").toLowerCase()+"\\")||L.startsWith(Z.join(Y,"sysnative").toLowerCase()+"\\")||L.includes("\\windowsapps\\")}function C(K=process.env,Q=k){let L=[];for(let Y of(K.PATH??K.Path??"").split(";"))if(Y&&Z.isAbsolute(Y))L.push(Z.join(Y,"git.exe"));for(let Y of[K.ProgramW6432,K.ProgramFiles,K["ProgramFiles(x86)"]])if(Y)L.push(Z.join(Y,"Git","cmd","git.exe"));if(K.LOCALAPPDATA)L.push(Z.join(K.LOCALAPPDATA,"Programs","Git","cmd","git.exe"));return L.find(Q)??null}var T;function w(K=process.platform){if(K!=="win32")return"git";return T??=C(),T}function P(K){let Q=process.platform==="win32"?C(K):"git";if(!Q)return null;try{return A(Q,["--exec-path"],{encoding:"utf8",timeout:5000,windowsHide:!0,stdio:["ignore","pipe","ignore"],env:K}).trim()||null}catch{return null}}function G(K=process.env,Q=P,L=k){let Y=[],H=Q(K);if(H)Y.push(...q(Z.resolve(H,"..","..","..")));for(let $ of[K.ProgramW6432,K.ProgramFiles,K["ProgramFiles(x86)"]])if($)Y.push(...q(Z.join($,"Git")));if(K.LOCALAPPDATA)Y.push(...q(Z.join(K.LOCALAPPDATA,"Programs","Git")));for(let $ of(K.PATH??K.Path??"").split(";"))if($&&Z.isAbsolute($))Y.push(Z.join($,"bash.exe"));return Y.find(($)=>!O($,K)&&L($))??null}var z;function W(K=process.platform){if(K!=="win32")return J.find(k)??null;return z??=G(),z}function f(K=process.platform){let Q=W(K);if(!Q)throw Error(K==="win32"?u:"bash_unavailable");return Q}function h(K=process.platform){return U(K==="win32"?j():"/tmp")}function X(K=process.platform,Q=process.env){if(K!=="win32")return"/usr/bin:/bin";let L=Q.SystemRoot??Q.SYSTEMROOT??"C:\\Windows";return[Z.join(L,"System32"),L,Z.join(L,"System32","Wbem"),Z.join(L,"System32","WindowsPowerShell","v1.0")].join(";")}function _(K,Q=process.platform){if(Q!=="win32"||/[\\/]/.test(K))return K;let L=/\.exe$/i.test(K)?K:`${K}.exe`,Y=X(Q).split(";");return Z.join(L.toLowerCase()==="powershell.exe"?Y[3]:Y[0],L)}function v(K=process.platform,Q=process.env){if(K!=="win32")return{PATH:X(K)};let L=Q.SystemRoot??Q.SYSTEMROOT??"C:\\Windows";return{PATH:X(K,Q),SystemRoot:L,WINDIR:L}}function c(K=process.platform){return K==="win32"?{windowsHide:!0}:{detached:!0}}var V;function N(){if(V===void 0)V=D(M)(I(import.meta.url));return V}function p(K,Q=process.platform){let L=K.pid;if(Q!=="win32"||L===void 0)return;let Y=N();if(Y?.track(L))K.once("close",()=>Y.release(L))}function l(K,Q="SIGTERM",L=process.platform){if(L!=="win32"){process.kill(-K,Q);return}if(Q===0){process.kill(K,0);return}if(N()?.terminate(K))return;A(_("taskkill",L),["/PID",String(K),"/T","/F"],{stdio:"ignore",timeout:1e4,windowsHide:!0})}function d(K,Q=63,L=process.platform){return L==="win32"||K.uid===process.getuid?.()&&(K.mode&Q)===0}var x=/^(?:con|prn|aux|nul|com[0-9\u00b9\u00b2\u00b3]|lpt[0-9\u00b9\u00b2\u00b3]|conin\$|conout\$)(?:\..*)?$|:|[. ]$/i;function s(K){return K!=="."&&K!==".."&&x.test(K)}
|
|
3
|
-
export{u as ml,w as nl,W as ol,f as pl,h as ql,X as rl,_ as sl,v as tl,c as ul,p as vl,l as wl,d as xl,s as yl};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{dl as W}from"./vm-hands-entry-lite-e4hwb89r.js";var T=W.string().max(201).regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/).refine((Q)=>Q.split("/").every((Z)=>Z!=="."&&Z!=="..")),G=W.string().min(1).max(255).regex(/^[A-Za-z0-9_][A-Za-z0-9_./-]*$/).refine((Q)=>!Q.includes("..")&&!Q.includes("//")&&!Q.endsWith("/")&&!Q.endsWith(".lock")),M=W.string().regex(/^[a-f0-9]{40}$/),q=W.number().int().positive(),C=W.string().min(1).max(256),A=W.string().max(60000),B={version:W.literal(1),repoFullName:T},J=W.array(W.string().max(1024).regex(/^(?:Co-authored-by: [^<>\r\n\x00]+ <[^<>\s]+@[^<>\s]+>|Reason-Contributor-ID: rc_[a-f0-9]{32})$/)).max(1000),c=W.strictObject({expectedTrailers:J,missingFromHead:J}),y=W.discriminatedUnion("action",[W.strictObject({action:W.literal("edit"),title:C.optional(),body:A.optional(),base:G.optional()}),W.strictObject({action:W.enum(["ready","draft","close"])}),W.strictObject({action:W.literal("metadata"),field:W.enum(["reviewer","assignee","label"]),change:W.enum(["add","remove"]),value:W.string().min(1).max(100).refine((Q)=>!/[\r\n\0]/.test(Q))})]),d=W.discriminatedUnion("kind",[W.strictObject({...B,kind:W.literal("read"),path:W.string().min(1).max(2048),accept:W.enum(["application/vnd.github+json","application/vnd.github.full+json","application/vnd.github.v3.diff"]).optional()}),W.strictObject({...B,kind:W.literal("pr_review_context"),number:q,after:W.string().min(1).max(1024).optional()}),W.strictObject({...B,kind:W.literal("prepare"),branch:G,baseSha:M,defaultBranch:G,diagnosticsVersion:W.literal(1).optional()}),W.strictObject({...B,kind:W.literal("publish"),branch:G,defaultBranch:G,baseSha:M,remoteHeadSha:M.nullable(),contributorTrailers:J.optional()}),W.strictObject({...B,kind:W.literal("pr_create"),head:G,base:G,title:C,body:A,draft:W.boolean()}),W.strictObject({...B,kind:W.literal("pr_mutation"),number:q,mutation:y}),W.strictObject({...B,kind:W.literal("pr_merge"),number:q,expectedHeadSha:M,expectedBaseRef:G,method:W.enum(["merge","squash","rebase"]),commitBody:W.string().max(65536).optional()})]),O=["local_device_gh_prepare_setup","local_device_gh_prepare_metadata","local_device_gh_prepare_private_init","local_device_gh_prepare_fetch","local_device_gh_prepare_base_mismatch","local_device_gh_prepare_checkout_validation","local_device_gh_prepare_checkout_init","local_device_gh_prepare_materialization"];function h(Q){return O.some((Z)=>Z===Q)}class R extends Error{code;constructor(Q){super(Q);this.code=Q}}function ZQ(Q,Z,$){let z=d.safeParse(Q);return Z==="failed"&&z.success&&z.data.kind==="prepare"&&z.data.diagnosticsVersion===1&&h($)}var x=245760,$Q=W.discriminatedUnion("kind",[W.strictObject({kind:W.literal("pr_review_context"),body:W.string().max(x)}),W.strictObject({kind:W.literal("prepare"),headSha:M}),W.strictObject({kind:W.literal("read"),status:W.number().int().min(200).max(599),headers:W.record(W.string(),W.string().max(8192)).refine((Q)=>Object.keys(Q).every((Z)=>Z==="link"||Z==="content-type")),body:W.string().max(x)}),W.strictObject({kind:W.literal("publish"),headSha:M,scannedObjectCount:W.number().int().min(0).max(5000),attribution:c.optional()}),W.strictObject({kind:W.literal("pr_create"),url:W.string().max(1024).regex(/^https:\/\/github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\/pull\/[1-9][0-9]*$/)}),W.strictObject({kind:W.literal("pr_mutation"),number:q,applied:W.literal(!0)}),W.strictObject({kind:W.literal("pr_merge"),number:q,merged:W.literal(!0)})]).refine((Q)=>new TextEncoder().encode(JSON.stringify(Q)).byteLength<=x,"local_device_gh_result_too_large"),r=W.strictObject({source:W.enum(["agent","human"]),operationId:W.uuid()}),m=W.strictObject({version:W.literal(1),userId:W.guid(),deviceId:W.guid(),rootId:W.guid(),runId:W.guid(),merge:r.optional(),contributorRefresh:W.guid().optional(),repoFullName:T.nullable(),rootRevision:W.string().regex(/^[1-9][0-9]*$/),readOnly:W.boolean(),generation:W.number().int().positive().nullable(),fenceId:W.guid().nullable()}).refine((Q)=>Q.generation===null===(Q.fenceId===null));function P(Q){return/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(Q)&&Q.split("/").every((Z)=>Z!=="."&&Z!=="..")}function KQ(Q,Z,$={},z="read"){if(P(Q)&&(Z==="/search/issues"||Z.startsWith("/search/issues?")))return p(Q,Z,$);if(!P(Q)||!Z.startsWith(`/repos/${Q}/`)&&Z!==`/repos/${Q}`)throw Error("local_device_gh_repository_mismatch");if(/[\\#\u0000-\u001f]/.test(Z)||/%(?:2e|5c|00)/i.test(Z))throw Error("local_device_gh_path_denied");let V=new URL(Z,"https://api.github.com");if(V.pathname!==Z.split("?")[0]||V.username||V.password)throw Error("local_device_gh_path_denied");let Y;try{Y=decodeURIComponent(V.pathname.slice(`/repos/${Q}`.length))}catch{throw Error("local_device_gh_path_denied")}if(Y.includes("%")||Y.split("/").some((D)=>D==="."||D===".."))throw Error("local_device_gh_path_denied");if(($.method??"GET").toUpperCase()!=="GET"||$.body!=null)throw Error("local_device_gh_mutation_not_admitted");if(![/^$/,/^\/commits$/,/^\/pulls$/,/^\/pulls\/[1-9][0-9]*(?:\/(?:commits|files|reviews|comments))?$/,/^\/issues\/[1-9][0-9]*(?:\/comments)?$/,/^\/issues\/comments\/[1-9][0-9]*\/reactions$/,/^\/commits\/[A-Za-z0-9_./-]+(?:\/(?:check-runs|status))?$/,/^\/check-runs\/[1-9][0-9]*(?:\/annotations)?$/,/^\/branches\/[A-Za-z0-9_./-]+$/,/^\/git\/ref\/heads\/[A-Za-z0-9_./-]+$/,/^\/compare\/[A-Za-z0-9_./-]+\.\.\.[A-Za-z0-9_./-]+$/].some((D)=>D.test(Y)))throw Error("local_device_gh_path_denied");if(V.searchParams.forEach((D,X)=>{if(X==="per_page"&&/^[1-9][0-9]*$/.test(D)&&Number(D)<=100)return;if(X==="page"&&/^[1-9][0-9]*$/.test(D)&&Number(D)<=100)return;if(Y==="/pulls"&&X==="state"&&["open","closed","all"].includes(D))return;if(Y==="/pulls"&&X==="sort"&&D==="updated")return;if(Y==="/pulls"&&X==="direction"&&D==="desc")return;if(Y==="/pulls"&&["head","base"].includes(X)&&/^[A-Za-z0-9_./:-]{1,255}$/.test(D))return;throw Error("local_device_gh_query_denied")}),$.headers)new Headers($.headers).forEach((X,_)=>{if(_!=="accept"||!["application/vnd.github+json","application/vnd.github.full+json","application/vnd.github.v3.diff"].includes(X))throw Error("local_device_gh_header_denied")})}function p(Q,Z,$){if(/[\\#\u0000-\u001f]/.test(Z))throw Error("local_device_gh_path_denied");let z=new URL(Z,"https://api.github.com");if(z.pathname!=="/search/issues"||z.username||z.password)throw Error("local_device_gh_path_denied");if(($.method??"GET").toUpperCase()!=="GET"||$.body!=null)throw Error("local_device_gh_mutation_not_admitted");let V=null;z.searchParams.forEach((H,D)=>{if(D==="q"&&V===null){V=H;return}if(D==="per_page"&&/^[1-9][0-9]*$/.test(H)&&Number(H)<=100)return;if(D==="page"&&/^[1-9][0-9]*$/.test(H)&&Number(H)<=100)return;throw Error("local_device_gh_query_denied")});let Y=`repo:${Q.toLowerCase()} `,N=V?.toLowerCase()??"";if(N.length>512||!(N+" ").startsWith(Y)||/(?:^|\s)(?:repo|org|user):/.test(N.slice(Y.length)))throw Error("local_device_gh_query_denied");if($.headers)new Headers($.headers).forEach((H,D)=>{if(D!=="accept"||H!=="application/vnd.github+json")throw Error("local_device_gh_header_denied")})}var DQ=`query PullRequestReviewContext($owner: String!, $repo: String!, $number: Int!, $after: String) {
|
|
3
|
-
repository(owner: $owner, name: $repo) {
|
|
4
|
-
nameWithOwner
|
|
5
|
-
pullRequest(number: $number) {
|
|
6
|
-
number
|
|
7
|
-
reviewDecision
|
|
8
|
-
headRefOid
|
|
9
|
-
baseRefOid
|
|
10
|
-
baseRef {
|
|
11
|
-
branchProtectionRule {
|
|
12
|
-
requiresApprovingReviews
|
|
13
|
-
requiredApprovingReviewCount
|
|
14
|
-
requiresStatusChecks
|
|
15
|
-
requiredStatusCheckContexts
|
|
16
|
-
requiresConversationResolution
|
|
17
|
-
dismissesStaleReviews
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
reviewThreads(first: 100, after: $after) {
|
|
21
|
-
nodes {
|
|
22
|
-
id isResolved isOutdated viewerCanResolve viewerCanUnresolve
|
|
23
|
-
path line originalLine startLine originalStartLine diffSide startDiffSide
|
|
24
|
-
comments(first: 100) {
|
|
25
|
-
nodes {
|
|
26
|
-
id databaseId body createdAt updatedAt url
|
|
27
|
-
author { __typename login }
|
|
28
|
-
replyTo { databaseId }
|
|
29
|
-
}
|
|
30
|
-
pageInfo { hasNextPage }
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
pageInfo { hasNextPage endCursor }
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}`;function zQ(Q){return Q.kind==="read"||Q.kind==="pr_review_context"}var b=["inspect_project","fs.read","fs.write","fs.search","fs.watch","fs.upload","fs.export","fs.import","fs.download","exec.run","exec.full","process.run.v1","process.full.v1","pty.start","pty.input","pty.resize","pty.close","git.run","process.list","process.signal","ports.list","tunnel.open","tunnel.close","env.discover","setup.run","mcp.discover","mcp.start","mcp.proxy","browser.snapshot","browser.navigate","browser.act","computer.snapshot","computer.act","computer.use","browser.use","browser.recording.v1","browser.pr-proof.v1","hands.connect","jobs.control","environment.install","github.local.v1","inference.ollama.v1","inference.custom.v1","delegate.devin.copy.v1","delegate.cursor.copy.v1","display.stream.v1","automation.call.v1","preview.serve.v1","workspace.setup.v1","simulator.call.v1","simulator.stream.v1"];var j=2,I="/app/local-runtime",n=262144,HQ="x-reason-relay-host-alias",XQ="v1";function F(Q,Z){return{path:`${I}${Q}`,routerPath:Q,auth:Z}}function g(Q,Z){return{...F(Q,"device_proof"),forOperation($){return F(`/operations/${encodeURIComponent($)}${Z}`,"device_proof")}}}var GQ={register:F("/register","registration_bearer"),enroll:F("/enroll","none"),authChallenge:F("/auth/challenge","none"),identity:F("/identity","device_proof"),heartbeat:F("/heartbeat","device_proof"),rootsSync:F("/roots/sync","device_proof"),disconnect:F("/disconnect","device_proof"),lifecycle:F("/lifecycle","device_proof"),localSubscription:F("/local-subscription","device_proof"),ownerWorkspaces:F("/owner-workspaces","device_proof"),ownerWorkspaceEnrollment:F("/owner-workspaces/enrollment","device_proof"),sessionWorktrees:F("/session-worktrees","device_proof"),operationClaim:F("/operations/claim","device_proof"),operationHeartbeat:g("/operations/:operationId/heartbeat","/heartbeat"),operationEvents:g("/operations/:operationId/events","/events"),operationComplete:g("/operations/:operationId/complete","/complete"),operationEnvironment:g("/operations/:operationId/environment","/environment"),operationEnvironmentAck:g("/operations/:operationId/environment-ack","/environment-ack"),operationCustomEndpointCredential:g("/operations/:operationId/custom-endpoint-credential","/custom-endpoint-credential")},BQ=`${I}/session`,MQ=4096,gQ=5000,o=[/^\/app\/local-runtime\/heartbeat$/,/^\/app\/local-runtime\/operations\/claim$/,/^\/app\/local-runtime\/operations\/[0-9a-fA-F-]{36}\/(?:heartbeat|events|complete|environment|environment-ack)$/];function qQ(Q){return o.some((Z)=>Z.test(Q))}var NQ="vm_hands_v1",mQ=60000,UQ={unauthenticated:4401,unavailable:4404,overloaded:4429,serviceRestart:1012},jQ="hands_control_v1",xQ="environment.deliver",JQ="vm_hands_workspace_deferred",SQ="vm_hands.workspace_grant",IQ="hands.unbind_unverified",PQ="claim_v1",TQ="environment_at_claim",CQ="ready_v1",AQ="workspace_check",bQ="rebind_v1",EQ="resident_rebind",kQ="hands.rebind",LQ="snapshot_v1",fQ="cloud_access",_Q="playwright_v1",cQ="headless_browser",yQ="v1",dQ="job_env_large_values",OQ="srt_root_v1",hQ="hands_confinement",RQ="gid_v1",rQ="model_jobs_egress",pQ="setpriv_v1",nQ="jobs_user",oQ="spawning_attempt_v1",sQ="hands_session_group",iQ="session_uid_v1",tQ="hands_session_account",vQ="session_cap",lQ="none",uQ="same_launch_v1",aQ="exit_v1",eQ="start_wait",QW="user_chrome",WW="cloud_sessions";function S(Q){if(!K(Q)||Object.keys(Q).length!==5||Q.version!==1)return!1;let Z=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;return["boot_generation","recording_operation_id","recording_attempt_id"].every(($)=>typeof Q[$]==="string"&&Z.test(Q[$]))&&typeof Q.root_version==="string"&&/^[0-9]{1,20}(?:\.[0-9]{1,6})?$/.test(Q.root_version)}function U(Q){if(!K(Q)||Object.keys(Q).length!==6)return!1;let Z=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;return typeof Q.device_id==="string"&&Z.test(Q.device_id)&&(Q.binding==="workspace_source"||Q.binding==="mcp_control")&&Number.isSafeInteger(Q.target_revision)&&Number(Q.target_revision)>=0&&Number.isSafeInteger(Q.root_grant_revision)&&Number(Q.root_grant_revision)>0&&Number.isSafeInteger(Q.target_generation)&&Number(Q.target_generation)>0&&typeof Q.target_fence_id==="string"&&Z.test(Q.target_fence_id)}var ZW=["lock_acquired","enrollment_started","enrollment_completed","readiness_started","readiness_completed","inventory_completed","control_ready"],$W=86400000,KW=["service.install_started","service.install_completed","service.install_failed","service.launcher_adopted","service.launcher_conflict","service.started","service.reconnecting","service.reconnected","service.idle_sleep_held","service.idle_sleep_released","service.idle_sleep_failed","service.start_failed","service.stopped","service.exit_failed","service.singleton_rejected","credential.migration_started","credential.migration_completed","credential.migration_failed","credential.store_started","credential.store_completed","credential.store_failed","credential.delete_started","credential.delete_completed","credential.delete_failed","update.check_started","update.not_available","update.download_started","update.downloaded","update.verified","update.activated","update.rollback","update.failed","executor.update.check_started","executor.update.not_available","executor.update.download_started","executor.update.downloaded","executor.update.verified","executor.update.activated","executor.update.rollback","executor.update.failed","identity.refresh_completed","identity.refresh_failed","update.device_moved","update.components_installed","update.deferred","update.deferral_expired","worker.previous_exit","worker.capabilities_withheld","identity.computer_use_unavailable"],s=["production","staging"];function E(Q){if(!K(Q)||Object.keys(Q).length!==3)return!1;let Z=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;return["organization_id","user_id","device_id"].every(($)=>Object.hasOwn(Q,$)&&typeof Q[$]==="string"&&Z.test(Q[$])&&Q[$]!=="00000000-0000-0000-0000-000000000000")}var i="DEVICE-PROOF-V2",DW="ARA-DEVICE-V1";function zW(Q,Z=i){let $=Q.method.toUpperCase();if(!/^[A-Z]+$/.test($)||!Q.pathAndQuery.startsWith(`${I}/`)||Q.pathAndQuery.includes(`
|
|
38
|
-
`)||!/^[0-9]{1,20}$/.test(Q.timestamp)||!/^[A-Za-z0-9_-]{22,43}$/.test(Q.nonce)||Q.challenge.length<16||Q.challenge.length>1024||Q.challenge.includes(`
|
|
39
|
-
`)||!/^[a-f0-9]{64}$/.test(Q.bodySha256))throw Error("Invalid Reason Device proof input.");return Buffer.from([Z,$,Q.pathAndQuery,Q.timestamp,Q.nonce,Q.challenge,Q.bodySha256].join(`
|
|
40
|
-
`),"utf8")}function K(Q){return Boolean(Q)&&typeof Q==="object"&&!Array.isArray(Q)}function t(Q,Z){return typeof Q==="string"&&Z.some(($)=>$===Q)}function k(Q){return K(Q)&&typeof Q.id==="string"&&typeof Q.label==="string"&&typeof Q.path_fingerprint==="string"}function v(Q){return K(Q)&&Number.isInteger(Q.seq)&&Number(Q.seq)>=0&&typeof Q.kind==="string"&&/^[A-Za-z0-9._:-]{1,64}$/.test(Q.kind)&&K(Q.payload)}function w(Q){throw Error(Q)}function FW(Q,Z){let $=K(Q)?Q:{},z=typeof $.error==="string"?$.error:`http_${Z}`,V=typeof $.detail==="string"?$.detail:typeof $.message==="string"?$.message:`Reason Device request failed (${Z})`;return{code:z,message:V}}function l(Q){if(!K(Q)||typeof Q.challenge!=="string"||Q.challenge.length<16||Q.challenge.length>1024||Q.challenge.includes(`
|
|
41
|
-
`)||typeof Q.expires_at!=="string"||!Number.isFinite(Date.parse(Q.expires_at)))w("Reason returned an invalid Device proof challenge.");return{challenge:Q.challenge,expires_at:Q.expires_at}}function L(Q,Z){if(!K(Q)||typeof Q.device_id!=="string"||Q.auth_scheme!=="p256"||Q.organization_id!==void 0&&typeof Q.organization_id!=="string"||Q.protocol_version!==j||!Array.isArray(Q.roots)||!Q.roots.every(k)||Z&&typeof Q.organization_id!=="string"||Q.device_credential!==void 0)w(Z?"Reason returned an invalid Device enrollment.":"Reason returned an invalid Device registration.");return{...{device_id:Q.device_id,...typeof Q.organization_id==="string"?{organization_id:Q.organization_id}:{},protocol_version:j,roots:Q.roots},auth_scheme:"p256"}}function wW(Q){return L(Q,!1)}function VW(Q){let Z=L(Q,!0);if(typeof Z.organization_id!=="string")return w("Reason returned an invalid Device enrollment.");return{...Z,organization_id:Z.organization_id}}function YW(Q){if(!K(Q)||typeof Q.server_time!=="string"||typeof Q.drain!=="boolean")return w("Reason returned an invalid Device heartbeat.");return{server_time:Q.server_time,drain:Q.drain,...f(Q),...typeof Q.update_policy==="string"||Q.update_policy===null?{update_policy:Q.update_policy}:{},...typeof Q.supported_protocol_version==="number"?{supported_protocol_version:Q.supported_protocol_version}:{},...a(Q.latest_cli_versions),...Q.hands_prespawn===!0?{hands_prespawn:!0}:{}}}var u=["account_root_metadata_supported","workspace_root_metadata_supported","account_root_path_supported","home_contained_roots_supported","root_paths_supported","startup_supported"];function f(Q){return Object.fromEntries(u.filter((Z)=>Q[Z]===!0).map((Z)=>[Z,!0]))}function HW(Q){if(!K(Q))return;try{return{...l(Q),...f(Q)}}catch{return}}function a(Q){if(!K(Q))return{};let Z={};for(let $ of s){let z=Q[$];if(typeof z==="string"&&/^(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})$/.test(z))Z[$]=z}return Object.keys(Z).length>0?{latest_cli_versions:Z}:{}}function XW(Q){if(!K(Q)||!Array.isArray(Q.roots)||!Q.roots.every(k))return w("Reason returned an invalid Device root sync.");return{roots:Q.roots}}function GW(Q){if(!K(Q)||Q.user_id!==void 0&&typeof Q.user_id!=="string"||typeof Q.organization_id!=="string"||typeof Q.organization_name!=="string"||typeof Q.organization_slug!=="string")return w("Reason returned an invalid Device identity.");return{...typeof Q.user_id==="string"?{user_id:Q.user_id}:{},organization_id:Q.organization_id,organization_name:Q.organization_name,organization_slug:Q.organization_slug}}function BW(Q){if(!K(Q)||Q.disconnected!==!0)return w("Reason did not disconnect this Device.");let Z=Q.sessions_moved;return typeof Z==="number"&&Number.isSafeInteger(Z)&&Z>=0?{disconnected:!0,sessions_moved:Z}:{disconnected:!0}}function MW(Q){if(K(Q)&&Q.ok===!0&&typeof Q.expires==="number")return{ok:!0,expires:Q.expires};if(K(Q)&&Q.ok===!1&&typeof Q.error==="string")return{ok:!1,error:Q.error};return w("Reason did not answer the local login hand-over.")}function gW(Q){if(!K(Q)||Q.accepted!==!0)return w("Reason did not accept the Device lifecycle event.");return{accepted:!0}}function e(Q){return Buffer.byteLength(JSON.stringify(Q),"utf8")}function qW(Q,Z=b){if(!K(Q)||typeof Q.operation_id!=="string"||typeof Q.attempt_id!=="string"||typeof Q.attempt_token!=="string"||!/^(?:reason|ara)_attempt_/.test(Q.attempt_token)||typeof Q.lease_until!=="string"||typeof Q.run_id!=="string"||typeof Q.root_id!=="string"||Q.owner!==void 0&&!E(Q.owner)||!t(Q.capability,Z)||!K(Q.payload)||Q.protocol_version!==j||e(Q.payload)>n||Q.authority!==void 0&&!U(Q.authority)||Q.local_github_authority!==void 0&&!m.safeParse(Q.local_github_authority).success||Q.capability==="github.local.v1"&&!m.safeParse(Q.local_github_authority).success||Q.recording_authority!==void 0&&!S(Q.recording_authority)||Q.capability==="browser.recording.v1"&&(!S(Q.recording_authority)||!E(Q.owner))||Q.capability!=="browser.recording.v1"&&Q.recording_authority!==void 0)return w("Reason returned an invalid Device operation claim.");let $={operation_id:Q.operation_id,attempt_id:Q.attempt_id,attempt_token:Q.attempt_token,lease_until:Q.lease_until,run_id:Q.run_id,root_id:Q.root_id,capability:Q.capability,payload:Q.payload,...U(Q.authority)?{authority:Q.authority}:{},...S(Q.recording_authority)?{recording_authority:Object.freeze({...Q.recording_authority})}:{},...Q.local_github_authority!==void 0?{local_github_authority:m.parse(Q.local_github_authority)}:{},...Q.capability==="hands.connect"&&K(Q.environment)&&K(Q.environment.payload)&&U(Q.environment.authority)?{environment:{payload:Q.environment.payload,authority:Q.environment.authority}}:{},protocol_version:j};if(Q.owner!==void 0)$.owner=Object.freeze({...Q.owner});return $}function NW(Q){if(!K(Q)||typeof Q.lease_until!=="string"||!Array.isArray(Q.controls)||!Q.controls.every(v)||!Number.isInteger(Q.next_control_seq)||Number(Q.next_control_seq)<0)return w("Reason returned an invalid Device operation heartbeat.");return{lease_until:Q.lease_until,controls:Q.controls,next_control_seq:Number(Q.next_control_seq)}}function mW(Q){if(!K(Q)||!Number.isInteger(Q.next_event_seq)||Number(Q.next_event_seq)<0||typeof Q.duplicate!=="boolean"||!Number.isInteger(Q.accepted_count)||Number(Q.accepted_count)<0)return w("Reason returned an invalid Device operation event result.");return{next_event_seq:Number(Q.next_event_seq),duplicate:Q.duplicate,accepted_count:Number(Q.accepted_count)}}function UW(Q){if(!K(Q)||!K(Q.payload)||!U(Q.authority))return w("Reason returned an invalid Device environment delivery.");return{payload:Q.payload,authority:Q.authority}}function QQ(Q){return Q==="succeeded"||Q==="failed"||Q==="cancelled"||Q==="expired"}function jW(Q){if(!K(Q)||!QQ(Q.status)||typeof Q.idempotent!=="boolean")return w("Reason returned an invalid Device operation completion.");return{status:Q.status,idempotent:Q.idempotent}}
|
|
42
|
-
export{d as kf,R as lf,ZQ as mf,x as nf,$Q as of,m as pf,KQ as qf,DQ as rf,zQ as sf,b as tf,j as uf,I as vf,n as wf,HQ as xf,XQ as yf,GQ as zf,BQ as Af,MQ as Bf,gQ as Cf,qQ as Df,NQ as Ef,mQ as Ff,UQ as Gf,jQ as Hf,xQ as If,JQ as Jf,SQ as Kf,IQ as Lf,PQ as Mf,TQ as Nf,CQ as Of,AQ as Pf,bQ as Qf,EQ as Rf,kQ as Sf,LQ as Tf,fQ as Uf,_Q as Vf,cQ as Wf,yQ as Xf,dQ as Yf,OQ as Zf,hQ as _f,RQ as $f,rQ as ag,pQ as bg,nQ as cg,oQ as dg,sQ as eg,iQ as fg,tQ as gg,vQ as hg,lQ as ig,uQ as jg,aQ as kg,eQ as lg,QW as mg,WW as ng,ZW as og,$W as pg,KW as qg,i as rg,DW as sg,zW as tg,FW as ug,l as vg,wW as wg,VW as xg,YW as yg,HW as zg,XW as Ag,GW as Bg,BW as Cg,MW as Dg,gW as Eg,qW as Fg,NW as Gg,mW as Hg,UW as Ig,jW as Jg};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var n=Object.create;var{getPrototypeOf:o,defineProperty:e,getOwnPropertyNames:k,getOwnPropertyDescriptor:p}=Object,l=Object.prototype.hasOwnProperty;function m(a){return this[a]}var q,r,u=(a,b,c)=>{var d=a!=null&&typeof a==="object";if(d){var h=b?q??=new WeakMap:r??=new WeakMap,i=h.get(a);if(i)return i}c=a!=null?n(o(a)):{};let f=b||!a||!a.__esModule?e(c,"default",{value:a,enumerable:!0}):c;for(let g of k(a))if(!l.call(f,g))e(f,g,{get:m.bind(a,g),enumerable:!0});if(d)h.set(a,f);return f},v=(a)=>{var b=(j??=new WeakMap).get(a),c;if(b)return b;if(b=e({},"__esModule",{value:!0}),a&&typeof a==="object"||typeof a==="function"){for(var d of k(a))if(!l.call(b,d))e(b,d,{get:m.bind(a,d),enumerable:!(c=p(a,d))||c.enumerable})}return j.set(a,b),b},j,w=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var s=(a)=>a;function t(a,b){this[a]=s.bind(null,b)}var x=(a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:!0,configurable:!0,set:t.bind(b,c)})};var y=(a,b)=>()=>(a&&(b=a(a=0)),b);var z=import.meta.require;
|
|
3
|
-
export{u as Bl,v as Cl,w as Dl,x as El,y as Fl,z as Gl};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Bd as L,Cd as S,Gd as f}from"./vm-hands-entry-lite-dhqmbqsh.js";import{tl as R,ul as E,vl as W}from"./vm-hands-entry-lite-kqbats5n.js";import{spawn as x}from"child_process";import{randomUUID as J}from"crypto";import{basename as k}from"path";import{fileURLToPath as m}from"url";function g(){let $=k(process.execPath).startsWith("bun");return{command:process.execPath,args:[...$?["--no-env-file",m(new URL("./worker-candidate-entry.ts",import.meta.url))]:[],"worker","__preview-probe"]}}async function d($,Q,H=g()){if(Q.aborted||!["darwin","linux","win32"].includes(process.platform)||process.platform==="win32"&&!S())return!1;let F=new AbortController,C=()=>F.abort();Q.addEventListener("abort",C,{once:!0});let T=setTimeout(C,5000),B=x(H.command,H.args,{cwd:$,...E(),stdio:["pipe","pipe","ignore"],env:R()});W(B);let Z=!1,N=new Promise((j)=>B.once("close",()=>{Z=!0,j()}));B.on("error",C);let O,V,D=new Promise((j)=>{O=j}),P=new Promise((j)=>{V=j}),_=new Promise((j)=>F.signal.addEventListener("abort",()=>j(null),{once:!0})),K="",A=0,G=!1;B.stdout.setEncoding("utf8"),B.stdout.on("data",(j)=>{if(A+=Buffer.byteLength(j),K+=j,A>512){C();return}while(K.includes(`
|
|
3
|
-
`)){let X=K.indexOf(`
|
|
4
|
-
`),Y=K.slice(0,X);K=K.slice(X+1);try{if(!G){let z=JSON.parse(Y);if(!z||Object.keys(z).length!==2||!Number.isInteger(z.port)||z.port<1024||z.port>65535||typeof z.token!=="string"||!/^[a-zA-Z0-9_-]{43}$/.test(z.token))throw Error("probe_receipt_invalid");G=!0,O({port:z.port,token:z.token})}else if(Y==="ready")V(!0);else C()}catch{C()}}}),N.then(C);let M,q=!1;try{let j=await Promise.race([D,_]);if(!j||!B.pid||F.signal.aborted||Q.aborted)return!1;let X=Date.now()+4500,Y=J(),z={organizationId:J(),userId:J(),runId:J(),deviceId:J(),rootId:J(),attachmentRevision:0,grantRevision:1,jobId:"readiness",generation:1,fenceId:J(),port:j.port,expiresAtMs:X},y={binding:z,executorLaunchId:Y,job:{jobId:z.jobId,state:"running",startedAtMs:Date.now(),finishedAtMs:null,leaseExpiresAtMs:X,exitCode:null,inputSequence:0,output:[],firstCursor:1,nextCursor:0,truncated:!1,process:{pid:B.pid,processGroupId:B.pid,executorLaunchId:Y}}},I=f({binding:z,deniedPorts:new Set,readCurrentJob:async()=>!Z&&!F.signal.aborted?y:null});M=await L({binding:z,deviceRelayUrl:`ws://127.0.0.1:${j.port}/device/readiness/${j.token}`,port:I,signal:F.signal}),q=await Promise.race([P,_])===!0&&!F.signal.aborted&&!Q.aborted}catch{q=!1}finally{if(clearTimeout(T),Q.removeEventListener("abort",C),M?.close(),F.abort(),B.stdin.destroy(),!Z)B.kill("SIGKILL");await N}return q&&Z}
|
|
5
|
-
export{d as z};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Rk as $}from"./vm-hands-entry-lite-c5gt0086.js";var k=$.version,O=`reason-cli/${k}`,Z=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;function S(B,D){if(!Z.test(B)||!Z.test(D))throw Error("cannot compare invalid CLI versions");let J=(q)=>{let y=q.indexOf("-");return y===-1?[q,void 0]:[q.slice(0,y),q.slice(y+1)]},[j,F]=J(B),[w,G]=J(D),K=j.split(".").map(BigInt),M=w.split(".").map(BigInt);for(let q=0;q<3;q+=1){if(K[q]===M[q])continue;return K[q]<M[q]?-1:1}if(F===void 0||G===void 0){if(F===G)return 0;return F===void 0?1:-1}let Q=F.split("."),U=G.split("."),A=Math.max(Q.length,U.length);for(let q=0;q<A;q+=1){let y=Q[q],z=U[q];if(y===void 0||z===void 0){if(y===z)return 0;return y===void 0?-1:1}if(y===z)continue;let H=/^\d+$/.test(y),W=/^\d+$/.test(z);if(H&&W){let X=BigInt(y),Y=BigInt(z);if(X===Y)continue;return X<Y?-1:1}if(H!==W)return H?-1:1;return y<z?-1:1}return 0}function b(B,D){return D?`cli ${B} \xB7 agent ${D}`:`cli ${B}`}
|
|
3
|
-
export{k as Mk,O as Nk,Z as Ok,S as Pk,b as Qk};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{mk as w}from"./vm-hands-entry-lite-56v9haps.js";import{Mk as h}from"./vm-hands-entry-lite-q9g11dbj.js";import{randomUUID as d}from"crypto";import{spawnSync as F}from"child_process";import{chmodSync as Kj,cpSync as Nj,existsSync as I,lstatSync as H,mkdirSync as s,readdirSync as Qj,readFileSync as S,readlinkSync as Uj,realpathSync as B,renameSync as A,rmdirSync as Vj,rmSync as D,symlinkSync as y,writeFileSync as Wj}from"fs";import{dirname as G,join as V,relative as Xj,resolve as Yj}from"path";var Zj="so.ara.cli",E=[Zj,"com.reasonmachines.cli"],m="5LJFSBRY2F";function u(j){return`(${j.map((z)=>`identifier "${z}"`).join(" or ")}) and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists and certificate leaf[subject.OU] = "${m}"`}var $j="Background/Reason.app",l="ReasonBackgroundIdentity",yj="Contents/Helpers/ReasonPermissionTile",wj="so.ara.cli.permission-tile",xj=u([wj,"com.reasonmachines.cli.permission-tile"]),k="AraBackgroundIdentity",Dj="Reason",gj=u(E),Pj=`anchor apple generic and (${E.map((j)=>`identifier "${j}"`).join(" or ")}) and certificate leaf[subject.OU] = "${m}"`;class C extends Error{code;constructor(j,z){super(z);this.code=j;this.name="MacOSBackgroundIdentityError"}}var M="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister";function L(j=w()){return V(j,"Library","Application Support","Reason","Background","Reason.app")}function O(j=w()){return V(j,"Library","Application Support","Ara","Background","Ara.app")}function bj(j=process.execPath){return V(G(B(j)),$j)}function qj(j){try{return H(j).isFile()}catch{return!1}}function f(j){return[l,k].map((z)=>V(j,"Contents","MacOS",z)).find(qj)??null}function Y(j){try{if(!H(j).isDirectory())return!1;let z=S(V(j,"Contents","Info.plist"),"utf8");return E.some((J)=>z.includes(`<string>${J}</string>`))&&(z.includes(`<string>${Dj}</string>`)||z.includes("<string>Ara</string>"))&&f(j)!==null}catch{return!1}}function c(j=w()){let z=L(j);if(!Y(z))return null;try{let J=S(V(z,"Contents","Info.plist"),"utf8");return/<key>CFBundleVersion<\/key>\s*<string>(\d+\.\d+\.\d+)<\/string>/.exec(J)?.[1]??null}catch{return null}}function Aj(j,z=w()){let J=c(z);return J===null||t(v(J.split(".")),v(j.split(/[.-]/).slice(0,3)))}var Gj=1e4;function i(j,z){return F(j,[...z],{stdio:"ignore",timeout:Gj}).status??1}var o=new Set;function r(j){if(process.env.REASON_TEST_REFUSE_REAL_IDENTITY!=="1")return;let z=(J)=>{try{return B(J)}catch{return Yj(J)}};if(j!==void 0&&z(j)!==z(w()))return;throw Error("A test tried to change this computer's real Reason background identity; pass a temporary home. Refused by scripts/test-env.ts.")}var n=/\/(?:runtime|CLI)\/versions\/(\d+)\.(\d+)\.(\d+)[^/]*\/[^/]+$|\/\.(?:ara|reason)(?:-staging)?-worker-(\d+)\.(\d+)\.(\d+)[^/]*\/[^/]+$/,p=new Set(["ara","ara.exe","reason","reason.exe"]);function v(j){return j.map((z)=>Number(z))}function t(j,z){for(let J=0;J<3;J+=1)if(j[J]!==z[J])return j[J]<z[J];return!1}var Lj=[0,2,161];function Tj(j){if(j===null)return!0;let z=Lj,J=null;try{J=B(process.execPath)}catch{}return j.some((K)=>{let N=n.exec(K);if(N){let Z=N[1]===void 0?N.slice(4,7):N.slice(1,4);return t(v(Z),z)}let Q=K.slice(K.lastIndexOf("/")+1);return p.has(Q)&&K!==J&&K!==process.execPath})}function _j(){let j=F("/bin/ps",["-xo","pid=,comm="],{encoding:"utf8",timeout:5000});if(j.status!==0)return null;let z=[];for(let J of j.stdout.split(`
|
|
3
|
-
`)){let K=/^\s*(\d+)\s+(\S.*)$/.exec(J);if(!K||Number(K[1])===process.pid)continue;let N=K[2].trimEnd(),Q=N.slice(N.lastIndexOf("/")+1);if(!n.test(N)&&p.has(Q)){let W=F("/usr/sbin/lsof",["-a","-p",K[1],"-d","txt","-Fn"],{encoding:"utf8",timeout:5000}).stdout?.split(`
|
|
4
|
-
`).find((X)=>X.startsWith("n/"));if(W)N=W.slice(1)}z.push(N)}return z}function Cj(j){if(r(j.home),!Y(j.sourceApp))throw new C("identity_invalid","The packaged Reason background identity is missing or invalid.");let z=j.command??i,J=L(j.home),K=G(J);s(K,{recursive:!0,mode:448}),Kj(K,448);let N=B(j.sourceApp),Q=null;try{Q=B(J)}catch{}if(N!==Q){let Z=`${process.pid}.${d()}`,W=V(K,`.Reason.app.${Z}.tmp`),X=V(K,`.Reason.app.${Z}.old`),P=!1;try{if(Nj(N,W,{recursive:!0,errorOnExist:!0,preserveTimestamps:!0}),!Y(W))throw new C("identity_invalid","The copied Reason background identity is invalid.");let T=j.releaseSigned?["--test-requirement",`=${Pj}`]:[];if(z("/usr/bin/codesign",["--verify","--strict",...T,W])!==0)throw new C("identity_invalid_signature","The installed Reason background identity has an invalid signature.");let _=!1;for(let $=0;$<4;$+=1){let q=!1;try{A(J,X),q=!0,P=!0}catch(U){if(U.code!=="ENOENT")throw U}if($===0)j.beforePublish?.();try{A(W,J),_=!0}catch(U){let Jj=U.code;if(!["EEXIST","ENOTEMPTY"].includes(Jj??""))throw U;if(q)D(X,{recursive:!0,force:!0}),P=!1;if($===3)throw U;continue}if(q)D(X,{recursive:!0,force:!0}),P=!1;break}if(!_)throw Error("Could not publish Reason's background identity.")}catch(T){if(P&&!I(J)&&I(X))A(X,J);throw T}finally{D(W,{recursive:!0,force:!0}),D(X,{recursive:!0,force:!0})}}return zj(J,j,{verified:N!==Q}),J}function a(j){return V(G(j),".Reason.app.registered")}function e(j){try{let z=H(j);return z.isDirectory()?`${z.ino}:${z.birthtimeMs}`:null}catch{return null}}function R(j){let z=e(j);try{return z!==null&&S(a(j),"utf8")===z}catch{return!1}}function jj(j){if(Y(j))return"bundle";try{if(H(V(j,"Contents","Info.plist"),{throwIfNoEntry:!1}))return null;return H(V(j,"Contents","MacOS",k)).isSymbolicLink()?"retired":null}catch{return null}}function zj(j,z,J={}){let K=z.command??i;if(!J.verified&&K("/usr/bin/codesign",["--verify","--strict",j])!==0)throw new C("identity_invalid_signature","The installed Reason background identity has an invalid signature.");if(K(M,["-f",j])!==0)throw new C("identity_register_failed","Could not register Reason's macOS background identity.");let N=e(j);try{if(N)Wj(a(j),N,{mode:384})}catch{}try{Fj(j,z.home,K,z.runningExecutables??_j)}catch(Q){let Z=Q.code??"unknown";process.stderr.write(`Reason background identity: legacy_identity_retire_failed (${Z})
|
|
5
|
-
`)}}function Fj(j,z,J,K){let N=f(j);if(!N)return;let Q=O(z),Z=G(Q),W=(U)=>V(U,"Contents","MacOS",k),X=Xj(G(W(Q)),N),P=`${process.pid}.${d()}`,T=jj(Q);if(T===null)return;let _=T==="bundle";if(_)J(M,["-u",Q]);let $=V(Z,`.Ara.app.${P}.old`);if(!o.has(Q)&&!Tj(K())){if(!_)J(M,["-u",Q]);try{A(Q,$)}catch(U){if(U.code==="ENOENT")return;throw U}D($,{recursive:!0,force:!0}),Hj(Z);return}if(!_){if(Uj(W(Q))===X)return;let U=`${W(Q)}.${P}`;y(X,U);try{A(U,W(Q))}finally{D(U,{force:!0})}return}let q=V(Z,`.Ara.app.${P}.shim`);s(G(W(q)),{recursive:!0}),y(X,W(q));try{try{A(Q,$)}catch(U){if(U.code==="ENOENT")return;throw U}try{A(q,Q)}catch(U){if(I(Q))return;throw A($,Q),U}}finally{D(q,{recursive:!0,force:!0}),D($,{recursive:!0,force:!0})}}function Hj(j){try{if(Qj(j).some((J)=>J!==".DS_Store"))return;D(V(j,".DS_Store"),{force:!0}),Vj(j)}catch{}}var x=new Map;function Bj(j=w()){let z=x.get(j);if(z)return z;if(process.platform!=="darwin")return[];let J=g(j);if(J===null&&I(G(L(j))))Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,100),J=g(j);if(J===null)return[];return x.set(j,J),J}function g(j){let z=L(j),J=O(j);if(!Y(z)||!R(z))try{Oj({home:j,skipWhenSettled:!0})}catch{}let K=Y(z)&&(R(z)||!Y(J))?z:Y(J)?J:null,N=K?f(K):null;if(!N)return null;if(K===J)o.add(J);let Q=F(N,["--can-spawn"],{env:{},timeout:2000,encoding:"utf8"});return Q.status===0&&Q.stdout===`spawn
|
|
6
|
-
`?[N,"--spawn"]:[]}var b=new Map;function Ij(j=w()){let z=Bj(j),J=z[0];if(!J)return[];let K=b.get(J);if(K===void 0){let N=F(J,["--can-spawn-computer-use"],{env:{},timeout:2000,encoding:"utf8"});K=N.status===0&&N.stdout===`spawn
|
|
7
|
-
`,b.set(J,K)}return K?z:[]}function hj(j=Ij(),z=w()){if(j.length>0)return null;if(c(z)===null)return"computer_use_identity_missing";return Aj(h,z)?"computer_use_identity_outdated":"computer_use_identity_unavailable"}function Oj(j={}){r(j.home);let z=L(j.home);if(j.skipWhenSettled&&Y(z)&&R(z)&&jj(O(j.home))===null)return!0;if(!Y(z)){let J=O(j.home);if(!Y(J))return!1;try{return Cj({...j,sourceApp:J}),!0}catch(K){if(!Y(z))throw K}}return zj(z,j),!0}var Mj="REASON_WORKER_IDENTITY_APP";function dj(j,z=process.env,J=w()){let K=z[Mj];return K&&K===L(J)?K:j}function sj(j,z){if(process.platform!=="darwin")return null;let J=L(j),K=V(J,"Contents","MacOS",l),N=F(K,["--can-run-worker",z],{env:{},timeout:2000,encoding:"utf8"});return N.status===0&&N.stdout===`run-worker
|
|
8
|
-
`?{app:J,executable:K}:null}
|
|
9
|
-
export{Zj as Pj,m as Qj,u as Rj,yj as Sj,C as Tj,M as Uj,L as Vj,bj as Wj,c as Xj,Aj as Yj,Cj as Zj,Bj as _j,Ij as $j,hj as ak,Oj as bk,Mj as ck,dj as dk,sj as ek};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ll as L}from"./vm-hands-entry-lite-v4r1fggm.js";import{sl as O}from"./vm-hands-entry-lite-kqbats5n.js";import{execFileSync as K}from"child_process";import{mkdirSync as j,readdirSync as f,readFileSync as v,rmSync as R,statSync as A,writeFileSync as C}from"fs";import{join as $,sep as F}from"path";import{setTimeout as M}from"timers/promises";var k=3000,Y=null;function W(z){return $(z,"users")}function h(z){if(Y?.root===z.root)return;let J=W(z.root);j(J,{recursive:!0,mode:448}),C($(J,String(process.pid)),"",{mode:384}),Y=z}function y(){if(!Y)return;R($(W(Y.root),String(process.pid)),{force:!0}),Y=null}function G(z){try{return process.kill(z,0),!0}catch(J){return J instanceof Error&&"code"in J&&J.code==="EPERM"}}function P(){let z=process.getuid?.();if(process.platform==="linux")return f("/proc").flatMap((N)=>{if(!/^\d+$/.test(N))return[];try{if(A(`/proc/${N}`).uid!==z)return[];let Q=v(`/proc/${N}/cmdline`).toString("utf8").split("\x00").join(" ").trim();return Q?[{pid:Number(N),command:Q}]:[]}catch{return[]}});if(process.platform==="win32")return K(O("powershell.exe"),["-NoLogo","-NoProfile","-NonInteractive","-Command",'Get-CimInstance Win32_Process | ForEach-Object { "$($_.ProcessId) $($_.CommandLine)" }'],{encoding:"utf8",maxBuffer:16777216,windowsHide:!0}).split(/\r?\n/).flatMap((Q)=>{let X=/^(\d+) (.+)$/.exec(Q.trim());return X?[{pid:Number(X[1]),command:X[2]}]:[]});return K("/bin/ps",["-axww","-o","pid=,uid=,command="],{encoding:"utf8",maxBuffer:16777216}).split(`
|
|
3
|
-
`).flatMap((N)=>{let Q=/^\s*(\d+)\s+(\d+)\s+(.+)$/.exec(N);return Q&&Number(Q[2])===z?[{pid:Number(Q[1]),command:Q[3]}]:[]})}async function u(){let z=Y;if(!z)return{released:"unused",stopped:0};let J=W(z.root);R($(J,String(process.pid)),{force:!0}),Y=null;let N=!1;for(let H of f(J)){let V=Number(H);if(Number.isSafeInteger(V)&&V>0&&G(V))N=!0;else R($(J,H),{force:!0})}if(N)return{released:"shared",stopped:0};let Q=P().filter((H)=>H.pid!==process.pid&&(H.command.includes(`${z.root}${F}`)||H.command.includes(`${z.automation}${F}`)||H.command.includes(z.extensionDir))),X=(H,V)=>{try{process.kill(H,V)}catch{}};for(let H of Q)X(H.pid,"SIGTERM");for(let H=Date.now()+k;Date.now()<H&&Q.some((V)=>G(V.pid));)await new Promise((V)=>setTimeout(V,100));for(let H of Q)if(G(H.pid))X(H.pid,"SIGKILL");return{released:"stopped",stopped:Q.length}}var T=20000,b=30000,D=100,Z=new Map,U=null,x=0,B=[];function c(z){Z.set(z,(Z.get(z)??0)+1);let J=!1;return()=>{if(J)return;J=!0;let N=(Z.get(z)??1)-1;if(N>0){Z.set(z,N);return}if(Z.delete(z),U?.run===z)U.idleUntil=0}}function E(){return new L("automation_desktop_busy","Another Session, or another agent of this Session, is using this worker's desktop. Retry after it finishes.")}function g(z,J){return U!==null&&U.run!==z&&(U.calls>0||J<U.idleUntil)}async function l(z,J,N=Date.now,Q="run"){let X=Symbol(z);B.push(X);try{let q=N()+b;for(;;){if(x===0&&!g(z,N())&&(U?.run===z||B[0]===X))break;if(N()>=q)throw E();await M(D,void 0,{signal:J}).catch(()=>J.throwIfAborted())}}finally{B.splice(B.indexOf(X),1)}if(Q==="call"&&!(U?.run===z&&(U.calls>0||N()<U.idleUntil))){x+=1;let q=!1;return()=>{if(q)return;q=!0,x-=1}}if(U?.run!==z)U={run:z,calls:0,idleUntil:0};let H=U;H.calls+=1;let V=!1;return()=>{if(V)return;V=!0,H.calls-=1,H.idleUntil=N()+T}}
|
|
4
|
-
export{h as el,y as fl,u as gl,T as hl,b as il,c as jl,l as kl};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{J as T,M as U}from"./vm-hands-entry-lite-6x5pj2y0.js";import{Hd as V}from"./vm-hands-entry-lite-3882raa5.js";import{Tk as M,Vk as Q}from"./vm-hands-entry-lite-e1xjfj57.js";import{bl as G}from"./vm-hands-entry-lite-8p8hz0j1.js";function W(j,B){let k=G(j,"REASON_API_URL")?.trim();if(!k)return Q(B);let z=new URL(k);if(z.protocol!=="https:"&&!(z.protocol==="http:"&&["127.0.0.1","localhost","::1"].includes(z.hostname)))throw Error("REASON_API_URL must use HTTPS (HTTP is allowed only for loopback development).");return z.origin}function X(j){return G(j,"REASON_API_URL")?.trim()?W(j,"production"):void 0}function $(j){return G(j,"REASON_API_KEY")?.trim()||void 0}async function N(j,B){let k=j.env??process.env,z=$(k);if(!z)return(j.getCredentials??T)({apiOrigin:X(k),signal:B});let J=W(k,j.channel??M({env:k})),D=await(j.fetchImpl??fetch)(J+"/v3/self",{redirect:"error",headers:{authorization:"Bearer "+z,accept:"application/json"},signal:B}),L=await D.json().catch(()=>({})),w=V(L)?L:{};if(!D.ok){let H=typeof w.detail==="string"?w.detail:typeof w.message==="string"?w.message:"API key authentication failed ("+D.status+")";throw new U(D.status,typeof w.error==="string"?w.error:"api_key_auth_failed",H)}if(typeof w.org_id!=="string"||!w.org_id)throw Error("The API key in the environment did not resolve to a Workspace.");let Z=Array.isArray(w.scopes)?w.scopes.filter((H)=>typeof H==="string"):[];return{credentialKind:"api_key",apiOrigin:J,accessToken:z,orgId:w.org_id,clientId:"api-key",refreshToken:"",expiresAt:"",scopes:Z}}async function P(j){let B=await N(j),k=X(j.env??process.env);if(!B)throw Error(k?`Not signed in to ${k}. Set REASON_API_KEY, or run \`reason login --api-url ${k}\`.`:"Not signed in. Run `reason login`, or set REASON_API_KEY.");return B}
|
|
3
|
-
export{W as A,X as B,$ as C,N as D,P as E};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ti as d}from"./vm-hands-entry-lite-td309c1y.js";import{vi as h}from"./vm-hands-entry-lite-c8bf82tx.js";import{Di as p}from"./vm-hands-entry-lite-1nj03gbj.js";import{nk as s}from"./vm-hands-entry-lite-56v9haps.js";import{Ak as i}from"./vm-hands-entry-lite-jd31as70.js";import{ll as V}from"./vm-hands-entry-lite-v4r1fggm.js";import{Al as P}from"./vm-hands-entry-lite-ghhpgt3v.js";import{existsSync as U,realpathSync as l,statSync as e}from"fs";import{platform as f}from"os";import{isAbsolute as r,sep as zz}from"path";import{existsSync as n}from"fs";import{createRequire as t}from"module";var E=P(h)(()=>t(import.meta.url)("bun:ffi"),n);function m(){return process.platform==="win32"&&typeof globalThis.Bun<"u"&&E.available()}function w(z=process.env){return E.defaultShell(z)}function k(z){return E.shellArgs(z)}function v(z){let H=E.spawn({...z,env:z.environment});return H.exited.then(()=>H.close()),{write:(Q)=>H.write(Q),resize:(Q,J)=>H.resize(Q,J),kill:()=>H.close(),exited:H.exited}}var Hz=43200000,y=p,Jz=4,Qz=/^[A-Za-z0-9._:-]{1,160}$/,Vz=1000;function u(z){return Boolean(z)&&typeof z==="object"&&!Array.isArray(z)}function g(z,H){if(typeof z!=="number"||!Number.isFinite(z)||z<=0)return H;return Math.min(Vz,Math.max(1,Math.floor(z)))}function Zz(z,H=Date.now()){let Q=["relay_url","session_id","expires_at"],J=new Set([...Q,"cols","rows","cwd","workspace"]);if(!u(z)||Q.some((C)=>!(C in z))||Object.keys(z).some((C)=>!J.has(C)))throw new V("invalid_pty_request","Reason terminal request is malformed.");let{relay_url:N,session_id:Y,expires_at:R}=z;if(typeof N!=="string")throw new V("invalid_pty_request","Reason terminal relay URL is missing.");let K;try{K=new URL(N)}catch{throw new V("invalid_pty_request","Reason terminal relay URL is invalid.")}if(K.protocol!=="wss:"&&K.protocol!=="ws:"||K.username||K.password)throw new V("invalid_pty_request","Reason terminal relay URL is invalid.");if(typeof Y!=="string"||!Qz.test(Y))throw new V("invalid_pty_request","Reason terminal session identity is invalid.");let D=typeof R==="string"?Date.parse(R):Number.NaN;if(!Number.isFinite(D)||D<=H)throw new V("invalid_pty_request","Reason terminal session has already expired.");if(z.cwd!==void 0&&typeof z.cwd!=="string")throw new V("invalid_pty_request","Reason terminal working directory is invalid.");let j=z.workspace===void 0?void 0:i(z.workspace);if(j===null||j&&z.cwd!==void 0)throw new V("invalid_pty_request","Reason terminal workspace is invalid.");return{relay_url:N,session_id:Y,expires_at:new Date(Math.min(D,H+Hz)).toISOString(),cols:g(z.cols,80),rows:g(z.rows,24),...z.cwd===void 0?{}:{cwd:z.cwd},...j?{workspace:j}:{}}}function $z(z,H){if(f()==="win32")[z,H]=[z.toLowerCase(),H.toLowerCase()];return H===z||H.startsWith(z+zz)}function c(z,H){if(H===void 0)return z;if(!r(H))throw new V("pty_cwd_invalid","Reason terminal working directory must be absolute.");let Q;try{Q=l(H)}catch{throw new V("pty_cwd_invalid","Reason terminal working directory does not exist.")}if(!$z(z,Q))throw new V("pty_cwd_outside_root","Reason terminal working directory escapes the granted root.");if(!e(Q).isDirectory())throw new V("pty_cwd_invalid","Reason terminal working directory is not a directory.");return Q}function jz(z=process.env){if(f()==="win32")return w(z);let H=z.SHELL;if(H&&r(H)&&U(H))return H;for(let Q of f()==="darwin"?["/bin/zsh","/bin/bash","/bin/sh"]:["/bin/bash","/bin/sh"])if(U(Q))return Q;return"/bin/sh"}function Gz(){let z=globalThis.Bun;if(!z)throw new V("pty_unavailable","Reason terminals require the Bun runtime.");return z.spawn}function Sz(){if(f()==="win32")return m();return typeof globalThis.Bun<"u"}var Nz=(z)=>{if(f()==="win32")try{return v({...z,file:z.shell,args:k(z.shell),environment:{...z.environment,TERM:"xterm-256color"}})}catch{throw new V("pty_unavailable","Reason could not allocate a pseudo-terminal.")}let H=Gz()({cmd:[z.shell,"-i","-l"],cwd:z.cwd,env:{...z.environment,TERM:"xterm-256color"},terminal:{cols:z.cols,rows:z.rows,data:(J,N)=>{z.onData(N)}}}),Q=H.terminal;if(!Q){try{H.kill()}catch{}throw new V("pty_unavailable","Reason could not allocate a pseudo-terminal.")}return{write:(J)=>Q.write(J),resize:(J,N)=>Q.resize(J,N),kill:()=>{try{H.kill()}catch{}},exited:H.exited.then((J)=>typeof J==="number"?J:null,()=>null)}},Wz=(z,H)=>{return H===void 0?new WebSocket(z):new WebSocket(z,{proxy:H})},M=new Set;function Kz(z){if(M.size>=Jz||M.has(z))return null;M.add(z);let H=!1;return()=>{if(H)return;H=!0,M.delete(z)}}async function Tz(z,H={}){let Q=H.now??Date.now,J=Zz(z.payload,Q()),N=Kz(z.operationId);if(!N)throw new V("pty_slot_busy","This Reason Device already runs the maximum number of terminals.");let Y=Q(),R,K,D;try{let j=J.workspace?s(z.root,J.workspace):void 0;R=j?c(U(j.boundary)?l(j.boundary):j.boundary,j.path):c(z.root,J.cwd),K=H.environment??process.env,D=H.shellPath??jz(K)}catch(j){throw N(),j}return await new Promise((j,C)=>{let F=null,$=null,I=!1,B=!1,X=!1,_=null,b=0,x=0,O=[],S=0,T=null,G=(Z)=>{if(X)return;if(X=!0,T)clearTimeout(T);z.signal.removeEventListener("abort",A);try{F?.kill()}catch{}try{$?.close(1000,"pty_session_over")}catch{}if(N(),Z.kind==="rejected"){C(Z.error);return}let W={reason:Z.reason,exit_code:_,output_bytes:b,input_bytes:x,duration_ms:Math.max(0,Q()-Y)};z.emitEvent("pty.stopped",{...W}).catch(()=>{return}),j({...W})},A=()=>{let Z=z.signal.reason;G({kind:"rejected",error:Z instanceof V?Z:new V("cancelled","Reason closed the terminal session.")})};if(z.signal.aborted){A();return}z.signal.addEventListener("abort",A,{once:!0}),T=setTimeout(()=>G({kind:"resolved",reason:"session_expired"}),Math.max(1,Date.parse(J.expires_at)-Q()));let a=(Z)=>{if(b+=Z.byteLength,!I||!$){if(O.push(Z),S+=Z.byteLength,S>y)G({kind:"resolved",reason:"output_backpressure"});return}try{$.send(Z)}catch{G({kind:"resolved",reason:"relay_closed"});return}if($.bufferedAmount>y)G({kind:"resolved",reason:"output_backpressure"})};try{F=(H.spawnPty??Nz)({shell:D,args:["-i","-l"],cwd:R,cols:J.cols,rows:J.rows,environment:K,onData:(Z)=>{if(!X)a(Z)}})}catch(Z){G({kind:"rejected",error:Z instanceof V?Z:new V("pty_spawn_failed","Reason could not start the terminal shell.")});return}F.exited.then((Z)=>{if(X)return;if(_=Z,I&&$)try{$.send(JSON.stringify({t:"exit",code:Z}))}catch{}G({kind:"resolved",reason:"shell_exited"})});let o=(H.loadProxy??d)()?.url;try{$=(H.connect??Wz)(J.relay_url,o)}catch{G({kind:"rejected",error:new V("pty_relay_unavailable","Reason could not reach the terminal relay.")});return}$.binaryType="arraybuffer",$.onopen=()=>{if(X||!$)return;I=!0;try{$.send(JSON.stringify({t:"open",cols:J.cols,rows:J.rows}));for(let Z of O.splice(0))$.send(Z);S=0}catch{G({kind:"resolved",reason:"relay_closed"});return}B=!0,z.emitEvent("pty.ready",{session_id:J.session_id,cols:J.cols,rows:J.rows}).catch(()=>{return})},$.onmessage=(Z)=>{if(X||!F)return;let W=Z.data;if(typeof W==="string"){let L;try{L=JSON.parse(W)}catch{return}if(!u(L))return;if(L.t==="resize"){try{F.resize(g(L.cols,J.cols),g(L.rows,J.rows))}catch{}return}if(L.t==="close")G({kind:"resolved",reason:"client_closed"});return}let q=W instanceof ArrayBuffer?new Uint8Array(W):ArrayBuffer.isView(W)?new Uint8Array(W.buffer,W.byteOffset,W.byteLength):null;if(!q||q.byteLength===0)return;x+=q.byteLength;try{F.write(q)}catch{}},$.onclose=()=>{if(X)return;if(!B){G({kind:"rejected",error:new V("pty_relay_unavailable","Reason could not reach the terminal relay.")});return}G({kind:"resolved",reason:"relay_closed"})},$.onerror=()=>{if(X||B)return;G({kind:"rejected",error:new V("pty_relay_unavailable","Reason could not reach the terminal relay.")})}})}
|
|
3
|
-
export{m as Vh,Hz as Wh,y as Xh,Jz as Yh,Zz as Zh,c as _h,jz as $h,Sz as ai,Nz as bi,Wz as ci,Tz as di};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ah as I}from"./vm-hands-entry-lite-26xb026c.js";import{ol as R,rl as U,ul as C,vl as O,wl as g}from"./vm-hands-entry-lite-kqbats5n.js";import{spawn as S}from"child_process";import{existsSync as x,mkdirSync as T,readFileSync as w,writeFileSync as E}from"fs";import{homedir as H}from"os";import{basename as L,delimiter as D,join as G,win32 as $}from"path";var N=process.platform==="win32"?U("win32"):"/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",b=N.split(D),_=5000,j=65536,k=new Set(["zsh","bash"]),f=[[".local","bin"],[".bun","bin"],[".cargo","bin"],["go","bin"]],P=(z,J)=>new Promise((B,Q)=>{let K;try{K=S(z,[...J],{...C(),stdio:["ignore","pipe","ignore"]}),O(K)}catch(X){Q(X);return}let W=[],V=0,Z=null,q=(X)=>{Z??=Error(X);try{if(K.pid!==void 0)g(K.pid,"SIGKILL")}catch{}},F=setTimeout(()=>q("login_shell_timeout"),_);K.stdout?.on("data",(X)=>{if(V+=X.length,V>j)q("login_shell_output_too_large");else W.push(X)}),K.once("error",(X)=>{clearTimeout(F),Q(X)}),K.once("close",(X)=>{if(clearTimeout(F),Z)Q(Z);else if(X!==0)Q(Error("login_shell_exit_nonzero"));else B(Buffer.concat(W).toString("utf8"))})});function v(z){return typeof z==="string"&&z.startsWith("/")&&!z.includes("\x00")&&k.has(L(z))}function M(z){let J=new Set,B=[];for(let Q of z){if(J.has(Q))continue;J.add(Q),B.push(Q)}return B}function A(z,J=process.platform){let B=J==="win32",Q=z.split(`
|
|
3
|
-
`).at(-1)??"",K=[];for(let W of Q.split(B?";":":")){let V=W.trim();if(B?!$.isAbsolute(V):!V.startsWith("/"))continue;if(V.includes("\x00"))continue;if(I(V))continue;K.push(V)}return M(K)}function y(z){let J=z?.home??H(),B=z?.directoryExists??x,Q=f.map((K)=>G(J,...K)).filter((K)=>{try{return B(K)}catch{return!1}});return M([...Q,...process.platform==="win32"?A(process.env.PATH??process.env.Path??""):[],...b]).join(D)}async function d(z){let J=z?.shell??process.env.SHELL,B=()=>({path:y({home:z?.home,directoryExists:z?.directoryExists}),source:"fallback"});if(process.platform==="win32"||!v(J))return B();let Q;try{Q=await(z?.runLoginShell??P)(J,["-lic",'printf %s "$PATH"'])}catch{return B()}if(Buffer.byteLength(Q,"utf8")>j)return B();let K=A(Q);if(K.length===0)return B();return{path:M([...K,...b]).join(":"),source:"login_shell"}}function n(z){let J=null;return()=>{return J??=d(z),J}}function Y(z){if(z===void 0||z.includes("\x00")||Buffer.byteLength(z,"utf8")>32768)return;return z}function r(z){let J=z.source??process.env,B={HOME:z.home,PATH:z.path??N,TMPDIR:z.temporaryDirectory,SHELL:Y(J.SHELL)??"/bin/zsh",LANG:Y(J.LANG)??"C.UTF-8",LC_ALL:Y(J.LC_ALL)??Y(J.LANG)??"C.UTF-8"},Q=Y(J.LC_CTYPE),K=Y(J.TERM),W=Y(J.COLORTERM);if(Q)B.LC_CTYPE=Q;if(K)B.TERM=K;if(W)B.COLORTERM=W;if(process.platform==="win32"){for(let V of h){let Z=Y(J[V]);if(Z)B[V]=Z}B.TEMP=B.TMP=z.temporaryDirectory,B.SHELL=R()??B.SHELL,B.PATH=m(B.PATH)}return B}function m(z,J=G(H(),".reason","python3")){let B=(W)=>z.split($.delimiter).filter((V)=>V&&!/[\\/]WindowsApps[\\/]?$/i.test(V)).map((V)=>$.join(V,W)).find((V)=>x(V)),Q=B("python.exe");if(B("python3.exe")||!Q)return z;let K=`#!/bin/sh
|
|
4
|
-
exec "${Q.replaceAll("\\","/")}" "$@"
|
|
5
|
-
`;try{let W=G(J,"python3");if(!x(W)||w(W,"utf8")!==K)T(J,{recursive:!0}),E(W,K)}catch{return z}return[J,z].join($.delimiter)}var h=["SystemRoot","SystemDrive","windir","ComSpec","PATHEXT","USERPROFILE","USERNAME","USERDOMAIN","APPDATA","LOCALAPPDATA","ProgramData","ProgramFiles","ProgramFiles(x86)","ProgramW6432","CommonProgramFiles","NUMBER_OF_PROCESSORS","PROCESSOR_ARCHITECTURE","OS"];
|
|
6
|
-
export{N as ad,A as bd,y as cd,n as dd,r as ed,m as fd};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{xl as N}from"./vm-hands-entry-lite-kqbats5n.js";import{randomUUID as K}from"crypto";import{closeSync as L,constants as V,fstatSync as M,lstatSync as Z,mkdirSync as $,openSync as O,readFileSync as T,realpathSync as b,renameSync as U,unlinkSync as X,writeFileSync as Y}from"fs";import{dirname as g,resolve as z}from"path";var A=65536;function J(j){try{return Z(j),!0}catch(q){if(q instanceof Error&&"code"in q&&q.code==="ENOENT")return!1;throw q}}function I(j,q=!1){if(!J(j)){if(!q)throw Error("worker_state_missing");D(j),$(j,{mode:448})}let C=Z(j);if(!C.isDirectory()||C.isSymbolicLink()||!N(C)||b(j)!==z(j))throw Error("worker_state_directory_not_private_or_canonical")}function D(j){let q=g(j);if(!J(q))D(q),$(q,{mode:448});if(b(q)!==z(q))throw Error("worker_parent_not_canonical")}function u(j,q=A){let C=O(j,V.O_RDONLY|V.O_NOFOLLOW);try{let G=M(C);if(!G.isFile()||G.nlink!==1||!N(G)||G.size>q)throw Error("worker_file_not_private");return T(C,"utf8")}finally{L(C)}}function f(j,q,C=A){let G=JSON.stringify(q);if(G===void 0)throw Error("worker_file_invalid");let Q=G+`
|
|
3
|
-
`;if(Buffer.byteLength(Q,"utf8")>C)throw Error("worker_file_too_large");if(I(g(j)),J(j))u(j,C);let H=`${j}.${K()}`;try{Y(H,Q,{mode:384,flag:"wx"}),U(H,j)}finally{if(J(H))X(H)}}
|
|
4
|
-
export{J as Ld,I as Md,u as Nd,f as Od};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{spawn as N}from"child_process";import{statSync as O}from"fs";import{delimiter as Q,join as R}from"path";function X(q,z=process.env.PATH??"",D=process.env,G=process.platform){let A=G==="win32",H=q.includes("/")||A&&q.includes("\\");if(!q||H||q.includes("\x00"))return!1;let I=A?["",...(D.PATHEXT??".EXE;.CMD;.BAT;.COM").split(";")]:[""];return z.split(Q).some((C)=>{if(!C)return!1;return I.some((E)=>{if(E===void 0)return!1;try{let J=O(R(C,`${q}${E}`));if(!J.isFile())return!1;return A||(J.mode&73)!==0}catch{return!1}})})}async function K(q){if(!q)return"";let z=[];try{for await(let D of q)z.push(Buffer.from(D))}catch{}return Buffer.concat(z).toString("utf8")}async function Y(q,z){let[D,...G]=q;if(!D)throw Error("A child process probe requires a program.");if(z.signal?.aborted)return{exitCode:-1,stdout:"",stderr:""};let A=N(D,G,{stdio:["ignore","pipe","pipe"],...z.env?{env:z.env}:{}}),H=K(A.stdout),I=K(A.stderr),C=()=>{try{A.kill()}catch{}};if(z.signal?.aborted)C();else z.signal?.addEventListener("abort",C,{once:!0});let E;try{return{exitCode:await Promise.race([new Promise((F)=>{A.once("error",()=>F(-1)),A.once("close",(M)=>F(M??-1))}),new Promise((F)=>{E=setTimeout(()=>{C(),F(-1)},z.timeoutMs)})]),stdout:await H,stderr:await I}}finally{if(E)clearTimeout(E);z.signal?.removeEventListener("abort",C)}}function Z(q){if(!(q>0))return;Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,q)}
|
|
3
|
-
export{X as Id,Y as Jd,Z as Kd};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Oj as v}from"./vm-hands-entry-lite-wbfmc0xn.js";import{fk as g,gk as h,hk as a}from"./vm-hands-entry-lite-3rg3znp8.js";import{mk as V}from"./vm-hands-entry-lite-56v9haps.js";import{Tk as r,_k as o}from"./vm-hands-entry-lite-e1xjfj57.js";import{dl as U}from"./vm-hands-entry-lite-e4hwb89r.js";import{createHmac as mQ,createPublicKey as CQ,randomBytes as LQ,randomUUID as t,verify as EQ}from"crypto";import{chmodSync as _,existsSync as e,mkdirSync as IQ,readFileSync as gQ,realpathSync as hQ,renameSync as vQ,statSync as yQ,unlinkSync as uQ,writeFileSync as pQ}from"fs";import{basename as cQ,dirname as F,isAbsolute as QQ,join as A,resolve as lQ}from"path";var WZ=[Object.freeze({family:"ara",channel:"stable",applicationId:"so.ara.desktop"}),Object.freeze({family:"ara",channel:"staging",applicationId:"so.ara.desktop.staging"}),Object.freeze({family:"reason",channel:"stable",applicationId:"com.reasonmachines.desktop"}),Object.freeze({family:"reason",channel:"staging",applicationId:"com.reasonmachines.desktop.staging"})];var zQ="REASON_DESKTOP_RUNTIME",UQ="REASON_DESKTOP_RUNTIME_CHANNEL",JQ="REASON_DESKTOP_RUNTIME_INSTANCE_ID",MQ="REASON_DESKTOP_RUNTIME_WORKSPACE_SCOPE",zZ={[zQ]:"ARA_DESKTOP_RUNTIME",[UQ]:"ARA_DESKTOP_RUNTIME_CHANNEL",[JQ]:"ARA_DESKTOP_RUNTIME_INSTANCE_ID",[MQ]:"ARA_DESKTOP_RUNTIME_WORKSPACE_SCOPE"};function m(Q){if(Q===void 0)return;if(!/^[a-f0-9]{64}$/.test(Q))throw Error("Invalid desktop workspace scope.");return Q}import{chmodSync as N,existsSync as z,mkdirSync as O,readFileSync as C,realpathSync as xQ,renameSync as wQ,unlinkSync as R,writeFileSync as f}from"fs";import{createPrivateKey as KQ,createPublicKey as VQ,generateKeyPairSync as AQ,randomUUID as NQ,sign as OQ}from"crypto";import{createRequire as RQ}from"module";import{homedir as fQ,platform as y}from"os";import{dirname as kQ,join as J}from"path";var L=1,BQ=16384,M=65536,_Q=128,TQ=128,u=65536;class q extends Error{code;nativeStatus;constructor(Q,Z){super(`Reason Device proof boundary failed (${Q}).${Z===void 0?"":` Native status: ${Z}.`}`);this.code=Q;this.nativeStatus=Z;this.name="LocalCredentialBoundaryError"}}function p(Q){if(Q.code==="proof_key_read_failed"&&Q.nativeStatus===-25300)return"proof_key_missing";switch(Q.nativeStatus){case-25308:return"keychain_interaction_required";case-25293:return"keychain_access_denied";case-25291:return"keychain_unavailable";default:return Q.code}}var k=null;function c(){if(!k)try{k=RQ(import.meta.url)("bun:ffi")}catch{throw new q("native_boundary_unavailable")}return k}function FQ(Q){if(typeof Q!=="string")return null;try{let Z=new URL(Q);if(Z.protocol!=="https:"&&Z.hostname!=="127.0.0.1"&&Z.hostname!=="localhost"&&Z.hostname!=="[::1]"&&Z.hostname!=="::1")return null;return Z.origin}catch{return null}}function PQ(Q){if(!Q||typeof Q!=="object"||Array.isArray(Q))throw new q("invalid_credential_record");let Z=Q,$=FQ(Z.apiOrigin);if(Z.version!==L||!$||typeof Z.orgId!=="string"||Z.orgId.length<1||Z.orgId.length>160||typeof Z.deviceId!=="string"||Z.deviceId.length<1||Z.deviceId.length>160||typeof Z.credential!=="string"||!/^(?:reason|ara)_dev_/.test(Z.credential)||Z.credential.length>4096)throw new q("invalid_credential_record");return{version:L,apiOrigin:$,orgId:Z.orgId,deviceId:Z.deviceId,credential:Z.credential}}function DQ(Q=process.execPath){let Z=Q;try{Z=xQ(Q)}catch{}return v(kQ(Z))}function j(Q){return c().ptr(Q)}function bQ(Q){if(!z(Q))throw new q("native_boundary_unavailable");let{dlopen:Z,FFIType:$}=c();try{return Z(Q,{ara_device_configure_scope:{args:[$.ptr,$.u64],returns:$.i32},ara_device_key_load_public:{args:[$.ptr,$.u64,$.ptr],returns:$.i32},ara_device_key_create_fresh_public:{args:[$.ptr,$.u64,$.ptr],returns:$.i32},ara_device_key_sign:{args:[$.ptr,$.u64,$.ptr,$.u64,$.ptr],returns:$.i32},ara_device_key_is_non_extractable:{args:[$.ptr],returns:$.i32},ara_device_key_delete:{args:[$.ptr],returns:$.i32},ara_device_binding_read:{args:[$.ptr,$.u64,$.ptr],returns:$.i32},ara_device_binding_create:{args:[$.ptr,$.u64],returns:$.i32},ara_device_binding_update:{args:[$.ptr,$.u64],returns:$.i32},ara_device_binding_delete:{args:[$.ptr],returns:$.i32},ara_device_keychain_read:{args:[$.ptr,$.u64,$.ptr],returns:$.i32},ara_device_keychain_delete:{args:[$.ptr],returns:$.i32}})}catch(W){if(W instanceof q)throw W;throw new q("native_boundary_unavailable")}}function E(Q){return Buffer.from(Q).toString("base64url")}function x(Q){if(typeof Q!=="string"||!/^[A-Za-z0-9_-]{87}$/.test(Q))return!1;try{let Z=Buffer.from(Q,"base64url");return Z.byteLength===65&&Z[0]===4}catch{return!1}}function l(Q){if(Q.byteLength<8||Q.byteLength>72||Q[0]!==48)return!1;let Z=Q[1];return Z!==void 0&&Z<128&&Z+2===Q.byteLength}class d{libraryPath;runtimePlatform;workspaceScope;library=null;constructor(Q=DQ(),Z=y(),$){this.libraryPath=Q;this.runtimePlatform=Z;this.workspaceScope=$;m($)}symbols(){if(this.runtimePlatform!=="darwin")throw new q("unsupported_platform");this.library??=bQ(this.libraryPath);let Q=new TextEncoder().encode(this.workspaceScope??""),Z=this.library.symbols.ara_device_configure_scope(j(Q.length?Q:new Uint8Array(1)),BigInt(Q.length));if(Z!==0)throw new q("native_boundary_unavailable",Z);return this.library.symbols}publicKey(Q){let Z=new Uint8Array(_Q),$=new BigUint64Array(1),W=Q==="load"?this.symbols().ara_device_key_load_public(j(Z),BigInt(Z.byteLength),j($)):this.symbols().ara_device_key_create_fresh_public(j(Z),BigInt(Z.byteLength),j($));if(W!==0)throw new q(Q==="load"?"proof_key_read_failed":"proof_key_generation_failed",W);let X=Number($[0]);if(!Number.isSafeInteger(X)||X!==65)throw new q("invalid_public_key");let Y=E(Z.subarray(0,X));if(!x(Y))throw new q("invalid_public_key");return Y}loadPublicKey(){return this.publicKey("load")}createFreshPublicKey(){return this.publicKey("create_fresh")}sign(Q){if(Q.byteLength<1||Q.byteLength>u)throw new q("proof_sign_failed");let Z=new Uint8Array(TQ),$=new BigUint64Array(1),W=this.symbols().ara_device_key_sign(j(Q),BigInt(Q.byteLength),j(Z),BigInt(Z.byteLength),j($));if(W!==0)throw new q("proof_sign_failed",W);let X=Number($[0]);if(!Number.isSafeInteger(X)||X<1||X>Z.byteLength)throw new q("invalid_signature");let Y=Z.subarray(0,X);if(!l(Y))throw new q("invalid_signature");return E(Y)}privateKeyIsNonExtractable(){let Q=new Uint8Array(1),Z=this.symbols().ara_device_key_is_non_extractable(j(Q));if(Z!==0||Q[0]!==1)throw new q("proof_key_read_failed",Z);return!0}deleteKey(){let Q=new Uint8Array(1),Z=this.symbols().ara_device_key_delete(j(Q));if(Z!==0)throw new q("proof_key_delete_failed",Z);return Q[0]===1}loadBinding(){let Q=new Uint8Array(M),Z=new BigUint64Array(1),$=this.symbols().ara_device_binding_read(j(Q),BigInt(Q.byteLength),j(Z));if($===1)return null;if($!==0)throw new q("binding_read_failed",$);let W=Number(Z[0]);if(!Number.isSafeInteger(W)||W<1||W>Q.byteLength)throw new q("invalid_binding");return Q.slice(0,W)}createBinding(Q){if(Q.byteLength<1||Q.byteLength>M)throw new q("invalid_binding");let Z=this.symbols().ara_device_binding_create(j(Q),BigInt(Q.byteLength));if(Z!==0)throw new q("binding_create_failed",Z)}updateBinding(Q){if(Q.byteLength<1||Q.byteLength>M)throw new q("invalid_binding");let Z=this.symbols().ara_device_binding_update(j(Q),BigInt(Q.byteLength));if(Z!==0)throw new q("binding_update_failed",Z)}deleteBinding(){let Q=new Uint8Array(1),Z=this.symbols().ara_device_binding_delete(j(Q));if(Z!==0)throw new q("binding_delete_failed",Z);return Q[0]===1}loadLegacyCredential(){let Q=new Uint8Array(BQ),Z=new BigUint64Array(1),$=this.symbols().ara_device_keychain_read(j(Q),BigInt(Q.byteLength),j(Z));if($===1)return null;if($!==0)throw new q("legacy_credential_read_failed",$);let W=Number(Z[0]);if(!Number.isSafeInteger(W)||W<1||W>Q.byteLength)throw new q("invalid_credential_record");try{let X=new TextDecoder("utf-8",{fatal:!0}).decode(Q.subarray(0,W));return PQ(JSON.parse(X))}catch(X){if(X instanceof q)throw X;throw new q("invalid_credential_record")}}deleteLegacyCredential(){let Q=new Uint8Array(1),Z=this.symbols().ara_device_keychain_delete(j(Q));if(Z!==0)throw new q("legacy_credential_delete_failed",Z);return Q[0]===1}}function I(Q){let Z=Q.export({format:"jwk"});if(Z.crv!=="P-256"||typeof Z.x!=="string"||typeof Z.y!=="string")throw new q("invalid_public_key");let $=Buffer.from(Z.x,"base64url"),W=Buffer.from(Z.y,"base64url");if($.byteLength!==32||W.byteLength!==32)throw new q("invalid_public_key");let X=Buffer.concat([Buffer.of(4),$,W]).toString("base64url");if(!x(X))throw new q("invalid_public_key");return X}function SQ(){let Q=process.env.XDG_CONFIG_HOME?.trim()||J(fQ(),".config");h(Q);let Z=J(Q,"ara");return g(Z)?Z:J(Q,"reason")}class i{directory;constructor(Q=SQ()){this.directory=Q}keyPath(){return J(this.directory,"local-device.key")}bindingPath(){return J(this.directory,"local-device.binding")}loadPrivateKeyObject(){let Q=this.keyPath();if(!z(Q))throw new q("proof_key_read_failed");try{let Z=C(Q,"utf8");return KQ({key:Z,format:"pem"})}catch{throw new q("proof_key_read_failed")}}loadPublicKey(){let Q=this.loadPrivateKeyObject(),Z=VQ(Q);return I(Z)}createFreshPublicKey(){O(this.directory,{recursive:!0,mode:448});let{privateKey:Q,publicKey:Z}=AQ("ec",{namedCurve:"P-256"}),$=Q.export({type:"pkcs8",format:"pem"}),W=this.keyPath();return f(W,$,{mode:384}),N(W,384),I(Z)}sign(Q){if(Q.byteLength<1||Q.byteLength>u)throw new q("proof_sign_failed");let Z=this.loadPrivateKeyObject(),$;try{$=OQ("sha256",Q,Z)}catch{throw new q("proof_sign_failed")}if(!l($))throw new q("invalid_signature");return $.toString("base64url")}privateKeyIsNonExtractable(){return!1}deleteKey(){let Q=this.keyPath();if(!z(Q))return!1;return R(Q),!0}loadBinding(){let Q=this.bindingPath();if(!z(Q))return null;try{return new Uint8Array(C(Q))}catch{return null}}createBinding(Q){if(Q.byteLength<1||Q.byteLength>M)throw new q("invalid_binding");O(this.directory,{recursive:!0,mode:448});let Z=this.bindingPath();if(z(Z))throw new q("binding_create_failed");f(Z,Q,{mode:384}),N(Z,384)}updateBinding(Q){if(Q.byteLength<1||Q.byteLength>M)throw new q("invalid_binding");O(this.directory,{recursive:!0,mode:448});let Z=this.bindingPath();if(!z(Z))throw new q("binding_update_failed");let $=`${Z}.${NQ()}`;try{f($,Q,{mode:384,flag:"wx"}),N($,384),wQ($,Z)}finally{if(z($))R($)}}deleteBinding(){let Q=this.bindingPath();if(!z(Q))return!1;return R(Q),!0}loadLegacyCredential(){return null}deleteLegacyCredential(){return!1}}function B(){return y()==="darwin"?new d:new i}var w=U.string().min(1).max(160).regex(/^[A-Za-z0-9._:-]+$/),s=U.object({id:w,kind:U.literal("permission_denied"),operation:U.enum(["bash","read","write","edit"]),provenance:U.enum(["sandbox_policy","os_permission_unknown"]),occurredAt:U.string().datetime(),expiresAt:U.string().datetime(),sessionId:w,deviceId:w,organizationId:w}).strict();var P=4;var K="macos-keychain-p256-v1",ZQ=1,dQ=`ARA-DEVICE-BINDING-V1
|
|
3
|
-
`;function iQ(Q){return Q===void 0||typeof Q==="number"&&Number.isInteger(Q)&&Q>=1&&Q<=4}function $Q(Q,Z=Date.now()){let $=s.safeParse(Q);if(!$.success)return!1;let W=$.data,X=typeof W.occurredAt==="string"?Date.parse(W.occurredAt):NaN,Y=typeof W.expiresAt==="string"?Date.parse(W.expiresAt):NaN;return W.kind==="permission_denied"&&["bash","read","write","edit"].includes(W.operation)&&["sandbox_policy","os_permission_unknown"].includes(W.provenance)&&Number.isFinite(X)&&X<=Z&&Y>Z&&Y>X&&Y-X<=600000}function LZ(Q,Z,$=Date.now()){if(!Q||!Z||Q.state!=="connected"||Q.deviceId!==Z.deviceId)return null;let W=Date.parse(Q.lastHeartbeatAt??""),X=Q.permissionRecovery;if(!($-W>=0&&$-W<30000)||!$Q(X,$)||X.deviceId!==Z.deviceId||X.organizationId!==Z.orgId)return null;try{process.kill(Q.pid,0)}catch{return null}return X}function WQ(Q={},Z=V()){let $=r({env:{...process.env,...Q}}),W=Q.XDG_CONFIG_HOME?.trim()||A(Z,".config");return a(W,...$==="staging"?["staging"]:[])}function D(Q={},Z=V()){return A(WQ(Q,Z),"local-device.json")}function qQ(Q={},Z=V()){return A(WQ(Q,Z),"local-daemon.json")}function b(Q,Z){IQ(F(Q),{recursive:!0,mode:448}),_(F(Q),448);let $=`${Q}.${process.pid}.${t()}.tmp`;try{pQ($,`${JSON.stringify(Z,null,2)}
|
|
4
|
-
`,{mode:384,flag:"wx"}),_($,384),vQ($,Q),_(Q,384)}finally{if(e($))uQ($)}return Q}function S(Q){if(!e(Q))return null;try{return JSON.parse(gQ(Q,"utf8"))}catch{return null}}function T(Q,Z,$){try{Q.onCredentialLifecycle?.({event:Z,...$?{reasonCode:$}:{}})}catch{}}function sQ(Q){if(!Array.isArray(Q))return null;let Z=[];for(let $ of Q){if(!$||typeof $!=="object")return null;let W=$;if(typeof W.id!=="string"||typeof W.label!=="string"||typeof W.path!=="string"||typeof W.pathFingerprint!=="string"||!W.permissions||typeof W.permissions.read!=="boolean"||typeof W.permissions.write!=="boolean"||typeof W.permissions.execute!=="boolean"||typeof W.permissions.discover_environment!=="boolean"||typeof W.permissions.expose_mcp!=="boolean")return null;Z.push({id:W.id,label:W.label,path:W.path,pathFingerprint:W.pathFingerprint,permissions:W.permissions})}return Z}function XQ(Q,Z,$=[]){let W=Object.keys(Q);return Z.every((X)=>Object.hasOwn(Q,X))&&W.every((X)=>Z.includes(X)||$.includes(X))}function nQ(Q){if(typeof Q!=="string")return null;try{let Z=new URL(Q);if(Z.protocol!=="https:"&&Z.hostname!=="127.0.0.1"&&Z.hostname!=="localhost")return null;return Z.origin}catch{return null}}function YQ(Q){if(!Q||typeof Q!=="object"||Array.isArray(Q))return null;let Z=Q,$=sQ(Z.roots),W=nQ(Z.apiOrigin);if(!W||typeof Z.orgId!=="string"||typeof Z.deviceId!=="string"||typeof Z.displayName!=="string"||typeof Z.registeredAt!=="string"||!iQ(Z.handsSlots)||Z.worker!==void 0&&(!Z.worker||!/^[a-f0-9]{64}$/.test(Z.worker.configDigest)||!["persistent","ephemeral"].includes(Z.worker.lifetime)||!Number.isFinite(Date.parse(Z.worker.expiresAt)))||!$)return null;return{apiOrigin:W,orgId:Z.orgId,deviceId:Z.deviceId,displayName:Z.displayName,registeredAt:Z.registeredAt,...Z.handsSlots!==void 0?{handsSlots:Z.handsSlots}:{},...Z.worker!==void 0?{worker:Z.worker}:{},roots:$}}function rQ(Q){return{...Q,credentialStorage:K}}function oQ(Q){return{version:P,apiOrigin:Q.apiOrigin,orgId:Q.orgId,deviceId:Q.deviceId,devicePublicKey:Q.devicePublicKey,displayName:Q.displayName,registeredAt:Q.registeredAt,...Q.handsSlots!==void 0?{handsSlots:Q.handsSlots}:{},...Q.worker!==void 0?{worker:Q.worker}:{},roots:Q.roots.map((Z)=>({id:Z.id,label:Z.label,path:Z.path,pathFingerprint:Z.pathFingerprint,permissions:{read:Z.permissions.read,write:Z.permissions.write,execute:Z.permissions.execute,discover_environment:Z.permissions.discover_environment,expose_mcp:Z.permissions.expose_mcp}})),credentialStorage:K}}function jQ(Q){if(!Q||typeof Q!=="object"||Array.isArray(Q))return null;let Z=Q;if(!XQ(Z,["version","apiOrigin","orgId","deviceId","devicePublicKey","displayName","registeredAt","roots","credentialStorage"],["handsSlots","worker"]))return null;let $=YQ(Z);if(!$||Z.version!==P||Z.credentialStorage!==K||!x(Z.devicePublicKey))return null;return{version:P,...$,devicePublicKey:Z.devicePublicKey,credentialStorage:K}}function GQ(Q){return new TextEncoder().encode(`${dQ}${JSON.stringify(oQ(Q))}`)}function aQ(Q){let Z=Buffer.from(Q,"base64url");return CQ({format:"jwk",key:{kty:"EC",crv:"P-256",x:Z.subarray(1,33).toString("base64url"),y:Z.subarray(33,65).toString("base64url")}})}function tQ(Q,Z){let $={version:ZQ,state:Q,signature:Z.sign(GQ(Q))};return new TextEncoder().encode(JSON.stringify($))}function HQ(Q){let Z;try{Z=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(Q))}catch{throw new q("invalid_binding")}if(!Z||typeof Z!=="object"||Array.isArray(Z))throw new q("invalid_binding");let $=Z;if(!XQ($,["version","state","signature"])||$.version!==ZQ||typeof $.signature!=="string"||!/^[A-Za-z0-9_-]{10,128}$/.test($.signature))throw new q("invalid_binding");let W=jQ($.state);if(!W)throw new q("invalid_binding");let X=!1;try{X=EQ("sha256",GQ(W),aQ(W.devicePublicKey),Buffer.from($.signature,"base64url"))}catch{X=!1}if(!X)throw new q("invalid_binding");return W}function eQ(Q){let{credentialStorage:Z,...$}=Q;return $}function QZ(Q){return Q instanceof q?p(Q):"credential_boundary_failed"}function EZ(Q=D(),Z={}){let $=S(Q),W=Z.proofStore??Z.credentialStore??B(),X=W.loadBinding();if(!X){if($&&typeof $==="object"&&!Array.isArray($)&&ZZ($))return null;if($!==null)throw new q("invalid_binding");return null}let Y=HQ(X),G=W.loadPublicKey();if(W.privateKeyIsNonExtractable(),G!==Y.devicePublicKey)throw new q("invalid_public_key");let H=jQ($);if(Z.repair!==!1&&(!H||JSON.stringify(H)!==JSON.stringify(Y)))b(Q,Y);return eQ(Y)}function ZZ(Q){let Z=Q,$=YQ(Q);if(!$)return null;if(Z.version===2){if(typeof Z.deviceCredential!=="string"||!/^(?:reason|ara)_dev_/.test(Z.deviceCredential)||Z.deviceCredential.length>4096)return null;return{state:$,credentialSource:"plaintext-v2"}}if(Z.version!==3||Z.credentialStorage!=="macos-keychain-v1"||"deviceCredential"in Z)return null;return{state:$,credentialSource:"keychain-v3"}}function IZ(Q,Z=D(),$={}){let W=$.proofStore??$.credentialStore??B();T($,"credential.store_started");try{if(!x(Q.devicePublicKey)||W.loadPublicKey()!==Q.devicePublicKey)throw new q("invalid_public_key");W.privateKeyIsNonExtractable();let X=rQ(Q),Y=W.loadBinding();if(Y){let H=HQ(Y);if(H.devicePublicKey!==Q.devicePublicKey||H.orgId!==Q.orgId||H.deviceId!==Q.deviceId||H.apiOrigin!==Q.apiOrigin&&!o(H.apiOrigin,Q.apiOrigin))throw new q("invalid_binding")}let G=tQ(X,W);if(Y)W.updateBinding(G);else W.createBinding(G);return b(Z,X),T($,"credential.store_completed"),Z}catch(X){throw T($,"credential.store_failed",QZ(X)),X}}function gZ(Q=qQ()){let Z=S(Q);if(!Z||typeof Z!=="object")return null;let $=Z;if($.version!==1||typeof $.pid!=="number"||!Number.isInteger($.pid)||!["starting","connected","stopped","error"].includes($.state??"")||typeof $.startedAt!=="string"||$.lastHeartbeatAt!==void 0&&typeof $.lastHeartbeatAt!=="string"||$.lastUsedAt!==void 0&&typeof $.lastUsedAt!=="string"||$.organizationId!==void 0&&typeof $.organizationId!=="string"||$.organizationName!==void 0&&typeof $.organizationName!=="string"||$.organizationSlug!==void 0&&typeof $.organizationSlug!=="string"||$.error!==void 0&&typeof $.error!=="string"||$.reconnectingSince!==void 0&&typeof $.reconnectingSince!=="string"||$.workspace!==void 0&&typeof $.workspace!=="string")return null;if($.permissionRecovery!==void 0&&!$Q($.permissionRecovery))delete $.permissionRecovery;return $}function hZ(Q,Z=qQ()){return b(Z,Q)}var n=1;function $Z(Q=D()){return A(F(Q),"local-device.proxy.json")}function vZ(Q=$Z()){let Z=S(Q);if(!Z||typeof Z!=="object"||Array.isArray(Z))return null;let $=Z;if($.version!==n||typeof $.url!=="string"||$.url.length===0||$.caFile!==void 0&&(typeof $.caFile!=="string"||!QQ($.caFile)))return null;return{version:n,url:$.url,...$.caFile?{caFile:$.caFile}:{}}}function yZ(Q,Z={read:!0,write:!1,execute:!1,discover_environment:!1,expose_mcp:!1},$=LQ(32)){let W=new Set,X=[];for(let Y of Q){let G=hQ(QQ(Y)?Y:lQ(Y));if(!yQ(G).isDirectory())throw Error(`Local execution root is not a directory: ${Y}`);if(W.has(G))continue;W.add(G),X.push({id:t(),label:cQ(G)||G,path:G,pathFingerprint:mQ("sha256",$).update(G).digest("hex"),permissions:{...Z}})}if(X.length===0)throw Error("At least one explicit local execution root is required.");return X}
|
|
5
|
-
export{q as ei,DQ as fi,x as gi,l as hi,d as ii,i as ji,$Q as ki,LZ as li,D as mi,qQ as ni,EZ as oi,IZ as pi,gZ as qi,hZ as ri,n as si,vZ as ti,yZ as ui};
|