@reason-machines/cli-linux-arm64-musl 0.2.381 → 0.2.382

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +3 -1
  2. package/bin/ara +2 -2
  3. package/bin/vm-hands/api-credentials-xppmbg0m.js +2 -0
  4. package/bin/vm-hands/api-xmpbsm6b.js +2 -0
  5. package/bin/vm-hands/{ask-relay-fc0jc3t5.js → ask-relay-zjqyxvxe.js} +3 -3
  6. package/bin/vm-hands/connect-cli-ehxeg8m5.js +2 -0
  7. package/bin/vm-hands/{custom-endpoint-device-zhpake9f.js → custom-endpoint-device-bm94e9r0.js} +1 -1
  8. package/bin/vm-hands/desktop-account-3tnm4z5w.js +2 -0
  9. package/bin/vm-hands/{device-workspace-vbcry9d6.js → device-workspace-0xsj5ykf.js} +1 -1
  10. package/bin/vm-hands/hands-worker-source-azdrrhsz.js +2 -0
  11. package/bin/vm-hands/{index-bbk6a9sk.js → index-7f2kwwen.js} +1 -1
  12. package/bin/vm-hands/{install-receipt-7x81ek76.js → install-receipt-3xyx3rdd.js} +1 -1
  13. package/bin/vm-hands/local-automation-ynx1qr9v.js +2 -0
  14. package/bin/vm-hands/local-capabilities-855ch0dq.js +2 -0
  15. package/bin/vm-hands/local-desktop-users-ajb81vjm.js +2 -0
  16. package/bin/vm-hands/local-display-mac-9h6btvvq.js +2 -0
  17. package/bin/vm-hands/local-display-session-f9ywkbba.js +2 -0
  18. package/bin/vm-hands/local-pty-session-cjas515w.js +2 -0
  19. package/bin/vm-hands/managed-runtime-dars4628.js +2 -0
  20. package/bin/vm-hands/{network-contract-zqvt1v0t.js → network-contract-dsw79qkc.js} +1 -1
  21. package/bin/vm-hands/package-smk3nqjs.js +2 -0
  22. package/bin/vm-hands/permissions-pdmhp2s3.js +2 -0
  23. package/bin/vm-hands/{reason-hands-protocol-8fxjynte.js → reason-hands-protocol-7d7xj1h3.js} +1 -1
  24. package/bin/vm-hands/serve-service-n6xd6323.js +2 -0
  25. package/bin/vm-hands/status-2m75kz1h.js +96 -0
  26. package/bin/vm-hands/version-74zqccyz.js +2 -0
  27. package/bin/vm-hands/vm-hands-entry-lite-06qnb2w1.js +458 -0
  28. package/bin/vm-hands/{vm-hands-entry-lite-7shpbsw8.js → vm-hands-entry-lite-1gxktkpe.js} +2 -2
  29. package/bin/vm-hands/{vm-hands-entry-lite-hgkf1svv.js → vm-hands-entry-lite-23bb8ce4.js} +2 -2
  30. package/bin/vm-hands/vm-hands-entry-lite-245929bs.js +346 -0
  31. package/bin/vm-hands/vm-hands-entry-lite-2e18tm6w.js +245 -0
  32. package/bin/vm-hands/{vm-hands-entry-lite-g036gtem.js → vm-hands-entry-lite-2t0vcvd8.js} +1 -1
  33. package/bin/vm-hands/{vm-hands-entry-lite-0asdf4pm.js → vm-hands-entry-lite-2tcjqgfp.js} +3 -3
  34. package/bin/vm-hands/vm-hands-entry-lite-3n3xh0xv.js +540 -0
  35. package/bin/vm-hands/vm-hands-entry-lite-50n6vbfx.js +251 -0
  36. package/bin/vm-hands/{vm-hands-entry-lite-j2q1k9vb.js → vm-hands-entry-lite-51hmj6am.js} +1 -1
  37. package/bin/vm-hands/{vm-hands-entry-lite-zfwg7ehq.js → vm-hands-entry-lite-5n4vsm6b.js} +2 -2
  38. package/bin/vm-hands/vm-hands-entry-lite-8fj07njx.js +3 -0
  39. package/bin/vm-hands/{vm-hands-entry-lite-4q8tsaqv.js → vm-hands-entry-lite-8zawqa9q.js} +2 -2
  40. package/bin/vm-hands/{vm-hands-entry-lite-3hbe4em3.js → vm-hands-entry-lite-9cmfthkq.js} +1 -1
  41. package/bin/vm-hands/{vm-hands-entry-lite-45j8qwsf.js → vm-hands-entry-lite-9w5vs9zv.js} +1 -1
  42. package/bin/vm-hands/{vm-hands-entry-lite-k7wwza46.js → vm-hands-entry-lite-aj1ccphg.js} +2 -2
  43. package/bin/vm-hands/{vm-hands-entry-lite-za55dtte.js → vm-hands-entry-lite-ammr3xbc.js} +2 -2
  44. package/bin/vm-hands/{vm-hands-entry-lite-yjn6sk08.js → vm-hands-entry-lite-ch7y4b1b.js} +1 -1
  45. package/bin/vm-hands/{vm-hands-entry-lite-34e71nbe.js → vm-hands-entry-lite-cwe16c51.js} +174 -16
  46. package/bin/vm-hands/vm-hands-entry-lite-dh5gwmyf.js +3 -0
  47. package/bin/vm-hands/vm-hands-entry-lite-dsdwzasy.js +105 -0
  48. package/bin/vm-hands/{vm-hands-entry-lite-5pm6bhb8.js → vm-hands-entry-lite-e0gdt6r5.js} +1 -1
  49. package/bin/vm-hands/{vm-hands-entry-lite-5kgvss4p.js → vm-hands-entry-lite-e2mjbqmr.js} +2 -2
  50. package/bin/vm-hands/vm-hands-entry-lite-ejm5er3h.js +7 -0
  51. package/bin/vm-hands/{vm-hands-entry-lite-mh0xecf3.js → vm-hands-entry-lite-f02906k8.js} +4 -4
  52. package/bin/vm-hands/vm-hands-entry-lite-f5230h6t.js +67 -0
  53. package/bin/vm-hands/{vm-hands-entry-lite-zh8p7ndn.js → vm-hands-entry-lite-fb5dzy9x.js} +2 -2
  54. package/bin/vm-hands/vm-hands-entry-lite-fyvgav60.js +3 -0
  55. package/bin/vm-hands/vm-hands-entry-lite-g7h6wjqy.js +3 -0
  56. package/bin/vm-hands/vm-hands-entry-lite-h8dbw0c7.js +4 -0
  57. package/bin/vm-hands/{vm-hands-entry-lite-nhtb458c.js → vm-hands-entry-lite-hnsm5t36.js} +1 -1
  58. package/bin/vm-hands/{vm-hands-entry-lite-r6pap1kh.js → vm-hands-entry-lite-ma001vzh.js} +1 -1
  59. package/bin/vm-hands/{vm-hands-entry-lite-anmv8hp7.js → vm-hands-entry-lite-mn64e4pt.js} +286 -104
  60. package/bin/vm-hands/{vm-hands-entry-lite-9cgm6g8t.js → vm-hands-entry-lite-pk3q774c.js} +1 -1
  61. package/bin/vm-hands/vm-hands-entry-lite-qef2ndkd.js +6 -0
  62. package/bin/vm-hands/vm-hands-entry-lite-qnnfvm5r.js +5 -0
  63. package/bin/vm-hands/vm-hands-entry-lite-qwf78yqr.js +11 -0
  64. package/bin/vm-hands/vm-hands-entry-lite-r8qg3wp1.js +3 -0
  65. package/bin/vm-hands/vm-hands-entry-lite-rd0ak4ye.js +4 -0
  66. package/bin/vm-hands/{vm-hands-entry-lite-00qsbphw.js → vm-hands-entry-lite-rpn0frzb.js} +2 -2
  67. package/bin/vm-hands/{vm-hands-entry-lite-g9rvf5qk.js → vm-hands-entry-lite-rtt2w6c6.js} +1 -1
  68. package/bin/vm-hands/vm-hands-entry-lite-sex82vb1.js +3 -0
  69. package/bin/vm-hands/{vm-hands-entry-lite-dgxxsdwb.js → vm-hands-entry-lite-xrthfx3q.js} +2 -2
  70. package/bin/vm-hands/{vm-hands-entry-lite-kxdw4myj.js → vm-hands-entry-lite-y2s2w174.js} +1 -1
  71. package/bin/vm-hands/{vm-hands-entry-lite-hc3p6r9p.js → vm-hands-entry-lite-zjfr0zh8.js} +2 -2
  72. package/bin/vm-hands/vm-hands-entry-lite.js +1 -1
  73. package/bin/vm-hands/{vm-hands-executor-qssgfea1.js → vm-hands-executor-yx6mxa2p.js} +1 -1
  74. package/bin/vm-hands/vm-hands-op-runner-yt3v3v6w.js +2 -0
  75. package/bin/vm-hands/{vm-hands-runtime-5me6cpmn.js → vm-hands-runtime-ygddqgbs.js} +3 -3
  76. package/bin/vm-hands/worker-sandbox-tgqbmy6b.js +2 -0
  77. package/package.json +1 -1
  78. package/bin/vm-hands/api-af9g18n7.js +0 -2
  79. package/bin/vm-hands/api-credentials-65mrr3tn.js +0 -2
  80. package/bin/vm-hands/connect-cli-j478km3s.js +0 -2
  81. package/bin/vm-hands/desktop-account-5zvgspyw.js +0 -2
  82. package/bin/vm-hands/hands-worker-source-h0b1j53p.js +0 -2
  83. package/bin/vm-hands/local-automation-c86tjeft.js +0 -2
  84. package/bin/vm-hands/local-capabilities-1h99gkt6.js +0 -2
  85. package/bin/vm-hands/local-desktop-users-0hadyvx1.js +0 -2
  86. package/bin/vm-hands/local-display-mac-v1pc7177.js +0 -2
  87. package/bin/vm-hands/local-display-session-tzq0hne8.js +0 -2
  88. package/bin/vm-hands/local-pty-session-hs7rq03x.js +0 -2
  89. package/bin/vm-hands/managed-runtime-5dqaaw1x.js +0 -2
  90. package/bin/vm-hands/package-3cd7cfyv.js +0 -2
  91. package/bin/vm-hands/permissions-vbyqjbyb.js +0 -2
  92. package/bin/vm-hands/serve-service-be739c9s.js +0 -2
  93. package/bin/vm-hands/status-s8ny6men.js +0 -96
  94. package/bin/vm-hands/version-8s4syrp2.js +0 -2
  95. package/bin/vm-hands/vm-hands-entry-lite-1085xsma.js +0 -5
  96. package/bin/vm-hands/vm-hands-entry-lite-4m40gwkf.js +0 -3
  97. package/bin/vm-hands/vm-hands-entry-lite-62wmnm7g.js +0 -540
  98. package/bin/vm-hands/vm-hands-entry-lite-98076n5g.js +0 -62
  99. package/bin/vm-hands/vm-hands-entry-lite-bvbfcp1k.js +0 -4
  100. package/bin/vm-hands/vm-hands-entry-lite-c01eyep6.js +0 -3
  101. package/bin/vm-hands/vm-hands-entry-lite-dcynw6t2.js +0 -3
  102. package/bin/vm-hands/vm-hands-entry-lite-hh24bq0d.js +0 -3
  103. package/bin/vm-hands/vm-hands-entry-lite-jb2sr2r7.js +0 -3
  104. package/bin/vm-hands/vm-hands-entry-lite-kt5aj2ax.js +0 -11
  105. package/bin/vm-hands/vm-hands-entry-lite-n9nnb482.js +0 -459
  106. package/bin/vm-hands/vm-hands-entry-lite-sb9a1jcn.js +0 -4
  107. package/bin/vm-hands/vm-hands-entry-lite-xg3d0a2y.js +0 -340
  108. package/bin/vm-hands/vm-hands-entry-lite-zamt8xp7.js +0 -181
  109. package/bin/vm-hands/vm-hands-entry-lite-ze9msfq1.js +0 -3
  110. package/bin/vm-hands/vm-hands-op-runner-b76rjaps.js +0 -2
  111. package/bin/vm-hands/worker-sandbox-wpzkvwer.js +0 -2
@@ -0,0 +1,245 @@
1
+ // @bun
2
+ var e=String.raw`(function(loadFfi, existsSync) {
3
+ const STARTF_USESTDHANDLES = 0x100;
4
+ const CREATE_SUSPENDED = 0x4;
5
+ const CREATE_UNICODE_ENVIRONMENT = 0x400;
6
+ const EXTENDED_STARTUPINFO_PRESENT = 0x80000;
7
+ const PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE = 0x20016;
8
+ const JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 0x2000;
9
+ const JOB_OBJECT_BASIC_ACCOUNTING_INFORMATION = 1;
10
+ const JOB_OBJECT_EXTENDED_LIMIT_INFORMATION = 9;
11
+ const POLL_MS = 10;
12
+ // Output the console renders after the shell exits still reaches the viewer.
13
+ const EXIT_LINGER_MS = 100;
14
+ const READ_CHUNK_BYTES = 65536;
15
+ const READ_TICK_BYTES = 1048576;
16
+ const PIPE_NOWAIT = 1;
17
+ let api = null, loadError = null;
18
+ function kernel32() {
19
+ if (api) return api;
20
+ const ffi = loadFfi();
21
+ const { symbols } = ffi.dlopen("kernel32.dll", {
22
+ CreatePipe: { args: ["ptr", "ptr", "ptr", "u32"], returns: "i32" },
23
+ CreatePseudoConsole: { args: ["u32", "u64", "u64", "u32", "ptr"], returns: "i32" },
24
+ ResizePseudoConsole: { args: ["u64", "u32"], returns: "i32" },
25
+ ClosePseudoConsole: { args: ["u64"], returns: "void" },
26
+ InitializeProcThreadAttributeList: { args: ["ptr", "u32", "u32", "ptr"], returns: "i32" },
27
+ UpdateProcThreadAttribute: { args: ["ptr", "u32", "u64", "u64", "u64", "ptr", "ptr"], returns: "i32" },
28
+ DeleteProcThreadAttributeList: { args: ["ptr"], returns: "void" },
29
+ CreateProcessW: { args: ["ptr", "ptr", "ptr", "ptr", "i32", "u32", "ptr", "ptr", "ptr", "ptr"], returns: "i32" },
30
+ CreateJobObjectW: { args: ["ptr", "ptr"], returns: "u64" },
31
+ SetInformationJobObject: { args: ["u64", "u32", "ptr", "u32"], returns: "i32" },
32
+ QueryInformationJobObject: { args: ["u64", "u32", "ptr", "u32", "ptr"], returns: "i32" },
33
+ AssignProcessToJobObject: { args: ["u64", "u64"], returns: "i32" },
34
+ TerminateJobObject: { args: ["u64", "u32"], returns: "i32" },
35
+ ResumeThread: { args: ["u64"], returns: "u32" },
36
+ TerminateProcess: { args: ["u64", "u32"], returns: "i32" },
37
+ PeekNamedPipe: { args: ["u64", "ptr", "u32", "ptr", "ptr", "ptr"], returns: "i32" },
38
+ ReadFile: { args: ["u64", "ptr", "u32", "ptr", "ptr"], returns: "i32" },
39
+ WriteFile: { args: ["u64", "ptr", "u32", "ptr", "ptr"], returns: "i32" },
40
+ SetNamedPipeHandleState: { args: ["u64", "ptr", "ptr", "ptr"], returns: "i32" },
41
+ WaitForSingleObject: { args: ["u64", "u32"], returns: "u32" },
42
+ GetExitCodeProcess: { args: ["u64", "ptr"], returns: "i32" },
43
+ CloseHandle: { args: ["u64"], returns: "i32" },
44
+ GetLastError: { args: [], returns: "u32" },
45
+ });
46
+ api = Object.assign({}, symbols, { ptr: ffi.ptr });
47
+ return api;
48
+ }
49
+ function available() {
50
+ try { kernel32(); return true; } catch (error) { loadError = String(error && error.message || error); return false; }
51
+ }
52
+ /** Why available() is false, for diagnostics only. */
53
+ function unavailableReason() { return loadError;
54
+ }
55
+ function variable(env, name) {
56
+ const key = Object.keys(env).find((candidate) => candidate.toUpperCase() === name);
57
+ return key === undefined ? undefined : env[key];
58
+ }
59
+ /** PowerShell 7 when it is on PATH, else Windows PowerShell, else cmd.exe. */
60
+ function defaultShell(env) {
61
+ for (const directory of String(variable(env, "PATH") || "").split(";")) {
62
+ if (!/^[A-Za-z]:\\/.test(directory)) continue;
63
+ const candidate = directory.replace(/\\+$/, "") + "\\pwsh.exe";
64
+ if (existsSync(candidate)) return candidate;
65
+ }
66
+ const systemRoot = variable(env, "SYSTEMROOT") || "C:\\Windows";
67
+ const powershell = systemRoot + "\\System32\\WindowsPowerShell\\v1.0\\powershell.exe";
68
+ if (existsSync(powershell)) return powershell;
69
+ return variable(env, "COMSPEC") || systemRoot + "\\System32\\cmd.exe";
70
+ }
71
+ function shellArgs(shell) {
72
+ return /(^|[\\/])(pwsh|powershell)(\.exe)?$/i.test(shell) ? ["-NoLogo"] : [];
73
+ }
74
+ /** One CreateProcessW argument, quoted as CommandLineToArgvW reads it. */
75
+ function quoteArg(value) {
76
+ if (value && !/[\s"]/.test(value)) return value;
77
+ let quoted = '"', backslashes = 0;
78
+ for (const character of value) {
79
+ if (character === "\\") { backslashes += 1; continue; }
80
+ quoted += "\\".repeat(character === '"' ? backslashes * 2 + 1 : backslashes) + character;
81
+ backslashes = 0;
82
+ }
83
+ return quoted + "\\".repeat(backslashes * 2) + '"';
84
+ }
85
+ /** A CREATE_UNICODE_ENVIRONMENT block: sorted name=value NUL entries, then NUL. */
86
+ function environmentBlock(env) {
87
+ const entries = Object.entries(env)
88
+ .filter(([name, value]) => typeof value === "string" && name !== "" && !name.includes("="))
89
+ .sort(([left], [right]) => left.toUpperCase() < right.toUpperCase() ? -1 : left.toUpperCase() > right.toUpperCase() ? 1 : 0);
90
+ return Buffer.from(entries.map(([name, value]) => name + "=" + value + "\0").join("") + "\0" + (entries.length ? "" : "\0"), "utf16le");
91
+ }
92
+ // Diagnostics name the failed call; codes only, never terminal content.
93
+ const win32Error = (name) => new Error(name + " (GetLastError " + kernel32().GetLastError() + ")");
94
+ const hresultError = (name, hr) => new Error(name + " (HRESULT 0x" + (hr >>> 0).toString(16).padStart(8, "0") + ")");
95
+ const wide = (value) => Buffer.from(value + "\0", "utf16le");
96
+ const coord = (cols, rows) => ((rows & 0xffff) << 16 | (cols & 0xffff)) >>> 0;
97
+ /** input: { file, args, cwd, cols, rows, env, onData(bytes) } */
98
+ function spawn(input) {
99
+ const k = kernel32();
100
+ const opened = [];
101
+ const own = (handle) => { opened.push(handle); return handle; };
102
+ const closeHandle = (handle) => {
103
+ const index = opened.indexOf(handle);
104
+ if (index < 0) return;
105
+ opened.splice(index, 1);
106
+ k.CloseHandle(handle);
107
+ };
108
+ const pipe = () => {
109
+ const read = new BigUint64Array(1), write = new BigUint64Array(1);
110
+ if (!k.CreatePipe(read, write, null, 0)) throw win32Error("conpty_pipe_failed");
111
+ return [own(read[0]), own(write[0])];
112
+ };
113
+ let hpc = null, attributes = null, job, processHandle, inputWrite, outputRead, pid;
114
+ try {
115
+ job = k.CreateJobObjectW(null, null);
116
+ if (!job) throw win32Error("conpty_job_failed");
117
+ own(job);
118
+ // JOBOBJECT_EXTENDED_LIMIT_INFORMATION (x64): LimitFlags at 16, 144 bytes.
119
+ const limits = new Uint8Array(144);
120
+ new DataView(limits.buffer).setUint32(16, JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE, true);
121
+ if (!k.SetInformationJobObject(job, JOB_OBJECT_EXTENDED_LIMIT_INFORMATION, limits, limits.length)) throw win32Error("conpty_job_failed");
122
+ const [inputRead, inputWriteEnd] = pipe();
123
+ const [outputReadEnd, outputWrite] = pipe();
124
+ inputWrite = inputWriteEnd; outputRead = outputReadEnd;
125
+ if (!k.SetNamedPipeHandleState(inputWrite, new Uint32Array([PIPE_NOWAIT]), null, null)) throw win32Error("conpty_pipe_failed");
126
+ const created = new BigUint64Array(1);
127
+ const createdResult = k.CreatePseudoConsole(coord(input.cols, input.rows), inputRead, outputWrite, 0, created);
128
+ if (createdResult !== 0) throw hresultError("conpty_create_failed", createdResult);
129
+ hpc = created[0];
130
+ // The console host holds its own duplicates of the far ends.
131
+ closeHandle(inputRead); closeHandle(outputWrite);
132
+ const size = new BigUint64Array(1);
133
+ k.InitializeProcThreadAttributeList(null, 1, 0, size);
134
+ const list = new Uint8Array(Number(size[0]));
135
+ if (!k.InitializeProcThreadAttributeList(list, 1, 0, size)) throw win32Error("conpty_attributes_failed");
136
+ attributes = list;
137
+ if (!k.UpdateProcThreadAttribute(attributes, 0, PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE, hpc, 8, null, null)) throw win32Error("conpty_attributes_failed");
138
+ // STARTUPINFOEXW (x64): dwFlags at 60, lpAttributeList at 104, 112 bytes.
139
+ // Null standard handles: otherwise an owner whose own stdio is
140
+ // redirected hands those pipes to the shell instead of the console.
141
+ const startup = new Uint8Array(112);
142
+ const startupView = new DataView(startup.buffer);
143
+ startupView.setUint32(0, startup.length, true);
144
+ startupView.setUint32(60, STARTF_USESTDHANDLES, true);
145
+ startupView.setBigUint64(104, BigInt(k.ptr(attributes)), true);
146
+ // PROCESS_INFORMATION (x64): hProcess 0, hThread 8, dwProcessId 16.
147
+ const information = new Uint8Array(24);
148
+ const commandLine = wide([input.file].concat(input.args).map(quoteArg).join(" "));
149
+ if (!k.CreateProcessW(null, commandLine, null, null, 0, EXTENDED_STARTUPINFO_PRESENT | CREATE_UNICODE_ENVIRONMENT | CREATE_SUSPENDED,
150
+ environmentBlock(input.env), wide(input.cwd), startup, information)) throw win32Error("conpty_spawn_failed");
151
+ const view = new DataView(information.buffer);
152
+ processHandle = own(view.getBigUint64(0, true));
153
+ const thread = own(view.getBigUint64(8, true));
154
+ pid = view.getUint32(16, true);
155
+ if (!k.AssignProcessToJobObject(job, processHandle)) {
156
+ k.TerminateProcess(processHandle, 1);
157
+ throw win32Error("conpty_job_failed");
158
+ }
159
+ if (k.ResumeThread(thread) === 0xffffffff) throw win32Error("conpty_spawn_failed");
160
+ closeHandle(thread);
161
+ } catch (error) {
162
+ if (attributes) k.DeleteProcThreadAttributeList(attributes);
163
+ if (outputRead !== undefined) closeHandle(outputRead);
164
+ if (hpc !== null) k.ClosePseudoConsole(hpc);
165
+ if (job) k.TerminateJobObject(job, 1);
166
+ for (const handle of opened.slice()) closeHandle(handle);
167
+ throw error;
168
+ }
169
+ k.DeleteProcThreadAttributeList(attributes);
170
+
171
+ const waiting = new Uint32Array(1), transferred = new Uint32Array(1), exitCode = new Uint32Array(1);
172
+ const accounting = new Uint8Array(48);
173
+ const chunk = new Uint8Array(READ_CHUNK_BYTES);
174
+ let closed = false, exitedAt = null, code = null, resolveExit, pending = [];
175
+ const exited = new Promise((resolve) => { resolveExit = resolve; });
176
+ const drain = () => {
177
+ for (let read = 0; read < READ_TICK_BYTES;) {
178
+ if (!k.PeekNamedPipe(outputRead, null, 0, null, waiting, null) || waiting[0] === 0) return;
179
+ if (!k.ReadFile(outputRead, chunk, Math.min(waiting[0], READ_CHUNK_BYTES), transferred, null)) return;
180
+ if (transferred[0] > 0) input.onData(chunk.slice(0, transferred[0]));
181
+ read += transferred[0];
182
+ }
183
+ };
184
+ // Nonblocking: a full input pipe accepts fewer bytes (possibly none).
185
+ const flush = () => {
186
+ while (pending.length > 0) {
187
+ if (!k.WriteFile(inputWrite, pending[0], pending[0].byteLength, transferred, null)) throw win32Error("conpty_write_failed");
188
+ if (transferred[0] === 0) return;
189
+ pending[0] = pending[0].subarray(transferred[0]);
190
+ if (pending[0].byteLength === 0) pending.shift();
191
+ }
192
+ };
193
+ function close() {
194
+ if (closed) return;
195
+ closed = true;
196
+ clearInterval(timer);
197
+ closeHandle(outputRead);
198
+ k.ClosePseudoConsole(hpc);
199
+ k.TerminateJobObject(job, 1);
200
+ for (const handle of opened.slice()) closeHandle(handle);
201
+ resolveExit(code);
202
+ }
203
+ const timer = setInterval(() => {
204
+ try {
205
+ if (exitedAt === null && k.WaitForSingleObject(processHandle, 0) === 0) {
206
+ exitedAt = Date.now();
207
+ if (k.GetExitCodeProcess(processHandle, exitCode)) code = exitCode[0];
208
+ }
209
+ drain();
210
+ flush();
211
+ if (exitedAt !== null && Date.now() - exitedAt >= EXIT_LINGER_MS) resolveExit(code);
212
+ } catch { close(); }
213
+ }, POLL_MS);
214
+ return {
215
+ pid,
216
+ exited,
217
+ write(data) {
218
+ if (closed) throw new Error("conpty_closed");
219
+ // A copy: the caller may reuse its buffer before the queue flushes.
220
+ const bytes = typeof data === "string" ? Buffer.from(data, "utf8") : Buffer.from(data);
221
+ if (bytes.byteLength > 0) pending.push(bytes);
222
+ flush();
223
+ },
224
+ resize(cols, rows) {
225
+ if (closed) throw new Error("conpty_closed");
226
+ const resized = k.ResizePseudoConsole(hpc, coord(cols, rows));
227
+ if (resized !== 0) throw hresultError("conpty_resize_failed", resized);
228
+ },
229
+ /** Ends the shell and everything it started; the console stays open. */
230
+ terminate() {
231
+ if (closed || !k.TerminateJobObject(job, 1)) throw win32Error("conpty_terminate_failed");
232
+ },
233
+ /** Live processes in the shell's job (JOBOBJECT_BASIC_ACCOUNTING_INFORMATION.ActiveProcesses). */
234
+ activeProcesses() {
235
+ if (closed || !k.QueryInformationJobObject(job, JOB_OBJECT_BASIC_ACCOUNTING_INFORMATION, accounting, accounting.length, null)) {
236
+ throw win32Error("conpty_job_unreadable");
237
+ }
238
+ return new DataView(accounting.buffer).getUint32(40, true);
239
+ },
240
+ close,
241
+ };
242
+ }
243
+ return { available, unavailableReason, defaultShell, shellArgs, quoteArg, environmentBlock, spawn };
244
+ })`;
245
+ export{e as Tg};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
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 ck,v as dk,w as ek,x as fk,y as gk,z as hk};
3
+ export{u as Fk,v as Gk,w as Hk,x as Ik,y as Jk,z as Kk};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Gi as F}from"./vm-hands-entry-lite-4m40gwkf.js";import{Ji as T,Mi as d,Oi as p,Si as n,Ti as a}from"./vm-hands-entry-lite-4q8tsaqv.js";import{Yi as j,_i as v}from"./vm-hands-entry-lite-c01eyep6.js";import{wj as l}from"./vm-hands-entry-lite-k7wwza46.js";import{Pj as m,Qj as h}from"./vm-hands-entry-lite-7shpbsw8.js";import{hk as y}from"./vm-hands-entry-lite-g036gtem.js";import{spawnSync as Eq}from"child_process";import{dirname as I}from"path";import{spawn as r}from"child_process";import{accessSync as e,constants as qq}from"fs";import{basename as zq,join as Jq}from"path";var V=null;function O(q){if(V===q)V=null;if(q.exitCode===null&&q.signalCode===null)q.kill("SIGTERM")}var _=(q,z)=>{if(V)O(V);let Q=Jq(q,T);try{e(Q,qq.X_OK)}catch{return()=>{}}let J;try{J=r(Q,["--app",q,"--name",zq(q,".app"),"--permission",z==="screen"?"screen_recording":"accessibility"],{detached:!0,stdio:"ignore"})}catch{return()=>{}}return J.on("error",()=>{if(V===J)V=null}),J.once("exit",()=>{if(V===J)V=null}),J.unref(),V=J,()=>O(J)};import{chmodSync as Qq,existsSync as x,mkdirSync as Xq,readFileSync as Zq,realpathSync as k,renameSync as $q,statSync as G,writeFileSync as Kq}from"fs";import{dirname as P,isAbsolute as Rq,join as Vq,resolve as S,sep as W}from"path";function U(q=j()){return Vq(v(q),"reason","protected-path-grants.json")}var B=null;function Yq(q){let z=JSON.parse(q);if(!Array.isArray(z?.grants))return[];return z.grants.flatMap((Q)=>{let J=Q;return J&&typeof J.path==="string"&&Rq(J.path)&&(J.kind==="file"||J.kind==="folder")&&typeof J.grantedAt==="number"?[{path:J.path,kind:J.kind,grantedAt:J.grantedAt}]:[]})}function D(q=U()){try{let{mtimeMs:z}=G(q);if(B&&B.file===q&&B.mtimeMs===z)return B.grants;let Q=Yq(Zq(q,"utf8"));return B={file:q,mtimeMs:z,grants:Q},Q}catch{return[]}}function Bq(q,z){return q.kind==="file"?z===q.path:z===q.path||z.startsWith(`${q.path}${W}`)}function Dq(q,z){let Q=S(q);return D(z).some((J)=>Bq(J,Q))}function Sq(q,z){return F(q)&&!Dq(q,z)}function w(q,z){Xq(P(z),{recursive:!0,mode:448});let Q=`${z}.${process.pid}.tmp`;Kq(Q,`${JSON.stringify({version:1,grants:q},null,2)}
2
+ import{Vi as F}from"./vm-hands-entry-lite-sex82vb1.js";import{$i as d,Yi as T,bj as p,fj as n,gj as a}from"./vm-hands-entry-lite-8zawqa9q.js";import{lj as j,nj as v}from"./vm-hands-entry-lite-fyvgav60.js";import{Lj as l}from"./vm-hands-entry-lite-aj1ccphg.js";import{ck as m,dk as h}from"./vm-hands-entry-lite-1gxktkpe.js";import{Kk as y}from"./vm-hands-entry-lite-2t0vcvd8.js";import{spawnSync as Eq}from"child_process";import{dirname as I}from"path";import{spawn as r}from"child_process";import{accessSync as e,constants as qq}from"fs";import{basename as zq,join as Jq}from"path";var V=null;function O(q){if(V===q)V=null;if(q.exitCode===null&&q.signalCode===null)q.kill("SIGTERM")}var _=(q,z)=>{if(V)O(V);let Q=Jq(q,T);try{e(Q,qq.X_OK)}catch{return()=>{}}let J;try{J=r(Q,["--app",q,"--name",zq(q,".app"),"--permission",z==="screen"?"screen_recording":"accessibility"],{detached:!0,stdio:"ignore"})}catch{return()=>{}}return J.on("error",()=>{if(V===J)V=null}),J.once("exit",()=>{if(V===J)V=null}),J.unref(),V=J,()=>O(J)};import{chmodSync as Qq,existsSync as x,mkdirSync as Xq,readFileSync as Zq,realpathSync as k,renameSync as $q,statSync as G,writeFileSync as Kq}from"fs";import{dirname as P,isAbsolute as Rq,join as Vq,resolve as S,sep as W}from"path";function U(q=j()){return Vq(v(q),"reason","protected-path-grants.json")}var B=null;function Yq(q){let z=JSON.parse(q);if(!Array.isArray(z?.grants))return[];return z.grants.flatMap((Q)=>{let J=Q;return J&&typeof J.path==="string"&&Rq(J.path)&&(J.kind==="file"||J.kind==="folder")&&typeof J.grantedAt==="number"?[{path:J.path,kind:J.kind,grantedAt:J.grantedAt}]:[]})}function D(q=U()){try{let{mtimeMs:z}=G(q);if(B&&B.file===q&&B.mtimeMs===z)return B.grants;let Q=Yq(Zq(q,"utf8"));return B={file:q,mtimeMs:z,grants:Q},Q}catch{return[]}}function Bq(q,z){return q.kind==="file"?z===q.path:z===q.path||z.startsWith(`${q.path}${W}`)}function Dq(q,z){let Q=S(q);return D(z).some((J)=>Bq(J,Q))}function Sq(q,z){return F(q)&&!Dq(q,z)}function w(q,z){Xq(P(z),{recursive:!0,mode:448});let Q=`${z}.${process.pid}.tmp`;Kq(Q,`${JSON.stringify({version:1,grants:q},null,2)}
3
3
  `,{mode:384}),Qq(Q,384),$q(Q,z),B=null}function b(q,z=U(),Q=Date.now()){if(!x(q))throw Error(`No file or folder at ${q}.`);let J=k(q),X=P(z);if(X===J||X.startsWith(`${J}${W}`)||J.startsWith(`${X}${W}`))throw Error("Reason's own configuration folder cannot be allowed.");let Z={path:J,kind:G(J).isDirectory()?"folder":"file",grantedAt:Q},$=D(z).filter((R)=>R.path!==J);return w([...$,Z],z),Z}function u(q,z=U()){let Q=x(q)?k(q):S(q),J=D(z),X=J.filter((Z)=>Z.path!==Q);if(X.length===J.length)return!1;return w(X,z),!0}function wq(q,z,Q){let J=z?"file-read* file-write*":"file-read*";return D(Q).filter((X)=>X.path===q||X.path.startsWith(`${q}${W}`)).map((X)=>`(allow ${J} (${X.kind==="file"?"literal":"subpath"} ${JSON.stringify(X.path)}))`)}var f=`Reason permissions
4
4
 
5
5
  Usage:
@@ -20,7 +20,7 @@ this Mac may open. Only you can change this list; Sessions cannot.
20
20
  allow asks for each missing one, or the one named. macOS cannot ask for Full
21
21
  Disk Access: allow disk opens its pane, shows the file to add in Finder and
22
22
  waits until the worker has it.
23
- `,M="x-apple.systempreferences:com.apple.preference.security",Nq="curl -fsSL https://reasonmachines.com/install.sh | bash",Hq=180000,Wq=2000,A=["screen","accessibility","disk"],L={screen:{label:"Screen & System Audio Recording",purpose:"desktop video, computer-use screenshots",level:"required",pane:`${M}?Privacy_ScreenCapture`},accessibility:{label:"Accessibility",purpose:"computer-use clicks and typing, desktop input",level:"required",pane:`${M}?Privacy_Accessibility`},disk:{label:"Full Disk Access",purpose:"Sessions in Desktop, Documents, Downloads, iCloud Drive and Mail",level:"recommended",pane:`${M}?Privacy_AllFiles`}};function s(q){return q.executable}function jq(q,z){if(q==="computer_use_identity_missing")return`Reason's background identity is not installed (${q}); reinstall Reason: ${Nq}`;if(q==="computer_use_identity_outdated")return`Reason's background identity is outdated (${p(z)??"unknown"}; this CLI is ${l}) (${q}); \`reason update\` installs this release's`;return`Reason's background identity cannot run computer use for this CLI (${q}); run the installed \`reason\``}function Cq(q=j()){let z=n(q);if(z.length>0)return{state:"ready",path:I(I(I(z[0]))),prefix:z};let Q=a(z,q)??"computer_use_identity_unavailable";return{state:Q,path:d(q),detail:jq(Q,q)}}function o(){return{identity:()=>Cq(),grants:(q)=>m(q),request:(q,z)=>h(q,z),worker:async()=>(await import("./status-s8ny6men.js")).connectionMacState(),open:(q)=>{Eq("/usr/bin/open",q,{stdio:"ignore",timeout:1e4})},tile:_,restartConnection:async()=>(await import("./connect-cli-j478km3s.js")).restartConnection(),sleep:(q)=>new Promise((z)=>setTimeout(z,q)),now:()=>Date.now()}}function c(q,z,Q){if(q.state!=="ready"||!z)return"unknown";return z[Q]?"granted":"missing"}async function i(q){let z=q.identity(),Q=z.state==="ready"?await q.grants(z.prefix):null,J=await q.worker(),X=J?s(J):null,Z=!X||J?.full_disk_access==="unknown"?"unknown":J?.full_disk_access==="granted"?"granted":"missing",$=(R,Y,K)=>{let{label:E,purpose:H,level:N}=L[R];return{id:R,label:E,purpose:H,level:N,state:Y,holder:K}};return{identity:{state:z.state,path:z.path,detail:z.state==="ready"?null:z.detail},worker_detail:X?null:"Full Disk Access is read from this computer's running worker; `reason connect` starts it.",permissions:[$("screen",c(z,Q,"screen"),z.path),$("accessibility",c(z,Q,"accessibility"),z.path),$("disk",Z,X)]}}function dq(q){let z=q.identity.state==="ready"?null:q.identity.state,Q=q.permissions.filter((Z)=>Z.state==="granted").length,J=[...z?[z]:[],...q.permissions.filter((Z)=>Z.state!=="granted"&&!(z&&Z.id!=="disk")).map((Z)=>`${Z.label} ${Z.state}`)],X=!z&&q.permissions.some((Z)=>Z.state==="missing");return`Permissions: ${Q} of ${q.permissions.length}${J.length>0?` (${J.join(", ")})`:""}`+(X?" \u2014 reason permissions allow":J.length>0?" \u2014 reason permissions":"")}function Uq(q){let z=[];if(q.identity.detail)z.push(q.identity.detail);z.push(`Reason: ${q.identity.path}`);let Q=q.permissions.find((J)=>J.id==="disk");z.push(Q?.holder?`Worker: ${Q.holder}`:`Worker: ${q.worker_detail}`),z.push("");for(let J of q.permissions){let X=`${J.label}${J.level==="recommended"?" (recommended)":""}`;z.push(` ${J.id.padEnd(13)} ${J.state.padEnd(7)} ${X}: ${J.purpose}`)}if(q.permissions.some((J)=>J.state==="missing"))z.push("","Allow the missing ones: reason permissions allow");return`${z.join(`
23
+ `,M="x-apple.systempreferences:com.apple.preference.security",Nq="curl -fsSL https://reasonmachines.com/install.sh | bash",Hq=180000,Wq=2000,A=["screen","accessibility","disk"],L={screen:{label:"Screen & System Audio Recording",purpose:"desktop video, computer-use screenshots",level:"required",pane:`${M}?Privacy_ScreenCapture`},accessibility:{label:"Accessibility",purpose:"computer-use clicks and typing, desktop input",level:"required",pane:`${M}?Privacy_Accessibility`},disk:{label:"Full Disk Access",purpose:"Sessions in Desktop, Documents, Downloads, iCloud Drive and Mail",level:"recommended",pane:`${M}?Privacy_AllFiles`}};function s(q){return q.executable}function jq(q,z){if(q==="computer_use_identity_missing")return`Reason's background identity is not installed (${q}); reinstall Reason: ${Nq}`;if(q==="computer_use_identity_outdated")return`Reason's background identity is outdated (${p(z)??"unknown"}; this CLI is ${l}) (${q}); \`reason update\` installs this release's`;return`Reason's background identity cannot run computer use for this CLI (${q}); run the installed \`reason\``}function Cq(q=j()){let z=n(q);if(z.length>0)return{state:"ready",path:I(I(I(z[0]))),prefix:z};let Q=a(z,q)??"computer_use_identity_unavailable";return{state:Q,path:d(q),detail:jq(Q,q)}}function o(){return{identity:()=>Cq(),grants:(q)=>m(q),request:(q,z)=>h(q,z),worker:async()=>(await import("./status-2m75kz1h.js")).connectionMacState(),open:(q)=>{Eq("/usr/bin/open",q,{stdio:"ignore",timeout:1e4})},tile:_,restartConnection:async()=>(await import("./connect-cli-ehxeg8m5.js")).restartConnection(),sleep:(q)=>new Promise((z)=>setTimeout(z,q)),now:()=>Date.now()}}function c(q,z,Q){if(q.state!=="ready"||!z)return"unknown";return z[Q]?"granted":"missing"}async function i(q){let z=q.identity(),Q=z.state==="ready"?await q.grants(z.prefix):null,J=await q.worker(),X=J?s(J):null,Z=!X||J?.full_disk_access==="unknown"?"unknown":J?.full_disk_access==="granted"?"granted":"missing",$=(R,Y,K)=>{let{label:E,purpose:H,level:N}=L[R];return{id:R,label:E,purpose:H,level:N,state:Y,holder:K}};return{identity:{state:z.state,path:z.path,detail:z.state==="ready"?null:z.detail},worker_detail:X?null:"Full Disk Access is read from this computer's running worker; `reason connect` starts it.",permissions:[$("screen",c(z,Q,"screen"),z.path),$("accessibility",c(z,Q,"accessibility"),z.path),$("disk",Z,X)]}}function dq(q){let z=q.identity.state==="ready"?null:q.identity.state,Q=q.permissions.filter((Z)=>Z.state==="granted").length,J=[...z?[z]:[],...q.permissions.filter((Z)=>Z.state!=="granted"&&!(z&&Z.id!=="disk")).map((Z)=>`${Z.label} ${Z.state}`)],X=!z&&q.permissions.some((Z)=>Z.state==="missing");return`Permissions: ${Q} of ${q.permissions.length}${J.length>0?` (${J.join(", ")})`:""}`+(X?" \u2014 reason permissions allow":J.length>0?" \u2014 reason permissions":"")}function Uq(q){let z=[];if(q.identity.detail)z.push(q.identity.detail);z.push(`Reason: ${q.identity.path}`);let Q=q.permissions.find((J)=>J.id==="disk");z.push(Q?.holder?`Worker: ${Q.holder}`:`Worker: ${q.worker_detail}`),z.push("");for(let J of q.permissions){let X=`${J.label}${J.level==="recommended"?" (recommended)":""}`;z.push(` ${J.id.padEnd(13)} ${J.state.padEnd(7)} ${X}: ${J.purpose}`)}if(q.permissions.some((J)=>J.state==="missing"))z.push("","Allow the missing ones: reason permissions allow");return`${z.join(`
24
24
  `)}
25
25
  `}async function g(q,z){let Q=z.now()+Hq;for(;;){if(await q())return!0;if(z.now()>=Q)return!1;await z.sleep(Wq)}}async function Iq(q,z){let Q=z.host??o(),{io:J}=z,X=await i(Q),Z=X.permissions.filter((K)=>q.includes(K.id)&&K.state!=="granted");if(Z.length===0)return J.stdout.write(`Reason permissions: ${q.map((K)=>L[K].label).join(", ")} already allowed.
26
26
  `),0;let $=!1,R=!1,Y=Q.identity();for(let K of Z){let{label:E,pane:H}=L[K.id];if(K.id!=="disk"){if(Y.state!=="ready"){if(!$)J.stderr.write(`Reason permissions: ${Y.detail}
@@ -49,4 +49,4 @@ ${f}`),1;if(J.command==="help")return Q.stdout.write(f),0;if(J.command==="protec
49
49
  `).join(""):`No protected paths are allowed on this computer.
50
50
  `),0}catch(Q){return z.stderr.write(`${Q instanceof Error?Q.message:String(Q)}
51
51
  `),1}}
52
- export{Sq as pi,wq as qi,_ as ri,f as si,A as ti,s as ui,Cq as vi,i as wi,dq as xi,Uq as yi,Iq as zi,Mq as Ai,pq as Bi};
52
+ export{Sq as Ei,wq as Fi,_ as Gi,f as Hi,A as Ii,s as Ji,Cq as Ki,i as Li,dq as Mi,Uq as Ni,Iq as Oi,Mq as Pi,pq as Qi};