@moxt-ai/mobius 0.0.195 → 0.0.197
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/dist/acp/agent-connection.d.ts.map +1 -1
- package/dist/acp/agent-connection.js +4 -3
- package/dist/acp/agent-connection.js.map +1 -1
- package/dist/acp/codex/app-server-client.d.ts.map +1 -1
- package/dist/acp/codex/app-server-client.js +4 -2
- package/dist/acp/codex/app-server-client.js.map +1 -1
- package/dist/agent-catalog/acp-readiness-probe.d.ts.map +1 -1
- package/dist/agent-catalog/acp-readiness-probe.js +4 -3
- package/dist/agent-catalog/acp-readiness-probe.js.map +1 -1
- package/dist/cli.js +532 -292
- package/dist/cli.js.map +4 -4
- package/dist/daemon-manager.d.ts.map +1 -1
- package/dist/daemon-manager.js +7 -17
- package/dist/daemon-manager.js.map +1 -1
- package/dist/filesystem/path-error.d.ts +5 -0
- package/dist/filesystem/path-error.d.ts.map +1 -0
- package/dist/filesystem/path-error.js +8 -0
- package/dist/filesystem/path-error.js.map +1 -0
- package/dist/filesystem/private-path.d.ts +3 -0
- package/dist/filesystem/private-path.d.ts.map +1 -0
- package/dist/filesystem/private-path.js +550 -0
- package/dist/filesystem/private-path.js.map +7 -0
- package/dist/index.js +504 -255
- package/dist/index.js.map +4 -4
- package/dist/native-sessions/codex-history.d.ts.map +1 -1
- package/dist/native-sessions/codex-history.js +4 -3
- package/dist/native-sessions/codex-history.js.map +1 -1
- package/dist/platform/contracts.d.ts +21 -0
- package/dist/platform/contracts.d.ts.map +1 -1
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/index.js +5 -3
- package/dist/platform/index.js.map +1 -1
- package/dist/platform/linux.d.ts.map +1 -1
- package/dist/platform/linux.js +2 -1
- package/dist/platform/linux.js.map +1 -1
- package/dist/platform/macos.d.ts.map +1 -1
- package/dist/platform/macos.js +2 -1
- package/dist/platform/macos.js.map +1 -1
- package/dist/platform/posix.d.ts +28 -1
- package/dist/platform/posix.d.ts.map +1 -1
- package/dist/platform/posix.js +91 -1
- package/dist/platform/posix.js.map +1 -1
- package/dist/platform/windows.d.ts +3 -0
- package/dist/platform/windows.d.ts.map +1 -0
- package/dist/platform/windows.js +174 -0
- package/dist/platform/windows.js.map +1 -0
- package/dist/process/executable.d.ts +7 -5
- package/dist/process/executable.d.ts.map +1 -1
- package/dist/process/executable.js +844 -386
- package/dist/process/executable.js.map +7 -1
- package/dist/process/process-error.d.ts +5 -0
- package/dist/process/process-error.d.ts.map +1 -0
- package/dist/process/process-error.js +9 -0
- package/dist/process/process-error.js.map +1 -0
- package/dist/runtime.js +504 -255
- package/dist/runtime.js.map +4 -4
- package/dist/storage/runtime-installation-store.d.ts.map +1 -1
- package/dist/storage/runtime-installation-store.js +3 -0
- package/dist/storage/runtime-installation-store.js.map +1 -1
- package/package.json +76 -70
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
// src/filesystem/private-path.ts
|
|
2
|
+
import { lstat as lstat2 } from "node:fs/promises";
|
|
3
|
+
|
|
4
|
+
// src/platform/linux.ts
|
|
5
|
+
import { constants as constants2, readdirSync, readFileSync } from "node:fs";
|
|
6
|
+
import { access as access2, readdir, readFile, realpath as realpath2, stat } from "node:fs/promises";
|
|
7
|
+
import { join as join2 } from "node:path";
|
|
8
|
+
|
|
9
|
+
// src/platform/posix.ts
|
|
10
|
+
import { execFile } from "node:child_process";
|
|
11
|
+
import { constants } from "node:fs";
|
|
12
|
+
import { access, chmod, lstat, realpath, unlink } from "node:fs/promises";
|
|
13
|
+
import { tmpdir } from "node:os";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
|
|
16
|
+
// src/filesystem/path-error.ts
|
|
17
|
+
var LocalPathError = class extends Error {
|
|
18
|
+
code = "unsafe_local_path";
|
|
19
|
+
constructor(message, options = {}) {
|
|
20
|
+
super(message, options);
|
|
21
|
+
this.name = "LocalPathError";
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// src/platform/posix.ts
|
|
26
|
+
var PROCESS_TABLE_TIMEOUT_MILLISECONDS = 1e3;
|
|
27
|
+
var PROCESS_TABLE_OUTPUT_LIMIT_BYTES = 1024 * 1024;
|
|
28
|
+
function parseProcessTable(output) {
|
|
29
|
+
const entries = [];
|
|
30
|
+
for (const line of output.split("\n")) {
|
|
31
|
+
const groups = /^\s*(?<pid>\d+)\s+(?<ppid>\d+)\s+(?<pgid>\d+)\s*$/.exec(line)?.groups;
|
|
32
|
+
if (groups === void 0) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const processId = Number(groups["pid"]);
|
|
36
|
+
const parentProcessId = Number(groups["ppid"]);
|
|
37
|
+
const processGroupId = Number(groups["pgid"]);
|
|
38
|
+
if (!Number.isSafeInteger(processId) || processId <= 0 || !Number.isSafeInteger(parentProcessId) || parentProcessId < 0 || !Number.isSafeInteger(processGroupId) || processGroupId <= 0) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
entries.push({ parentProcessId, processGroupId, processId });
|
|
42
|
+
}
|
|
43
|
+
return entries;
|
|
44
|
+
}
|
|
45
|
+
function readProcessTableWithPs(executable) {
|
|
46
|
+
return new Promise((resolveTable) => {
|
|
47
|
+
execFile(
|
|
48
|
+
executable,
|
|
49
|
+
["-axo", "pid=,ppid=,pgid="],
|
|
50
|
+
{
|
|
51
|
+
encoding: "utf8",
|
|
52
|
+
maxBuffer: PROCESS_TABLE_OUTPUT_LIMIT_BYTES,
|
|
53
|
+
signal: AbortSignal.timeout(PROCESS_TABLE_TIMEOUT_MILLISECONDS),
|
|
54
|
+
timeout: PROCESS_TABLE_TIMEOUT_MILLISECONDS
|
|
55
|
+
},
|
|
56
|
+
(error, stdout) => {
|
|
57
|
+
resolveTable(error === null ? parseProcessTable(stdout) : []);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function processExists(processId) {
|
|
63
|
+
try {
|
|
64
|
+
process.kill(processId, 0);
|
|
65
|
+
return true;
|
|
66
|
+
} catch {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function signalCapturedProcesses(processes, rootProcessId, signal) {
|
|
71
|
+
const processIds = new Set(processes.map((identity) => identity.processId));
|
|
72
|
+
const signalledGroups = /* @__PURE__ */ new Set();
|
|
73
|
+
for (const identity of processes) {
|
|
74
|
+
const isRootProcessGroup = identity.processGroupId === rootProcessId;
|
|
75
|
+
if (!isRootProcessGroup && !processIds.has(identity.processGroupId) || signalledGroups.has(identity.processGroupId)) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
process.kill(-identity.processGroupId, signal);
|
|
80
|
+
signalledGroups.add(identity.processGroupId);
|
|
81
|
+
} catch {
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
for (const identity of processes) {
|
|
85
|
+
if (identity.processId === rootProcessId || identity.processGroupId === rootProcessId || signalledGroups.has(identity.processGroupId)) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
process.kill(identity.processId, signal);
|
|
90
|
+
} catch {
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function terminateProcess(child, signal) {
|
|
95
|
+
if (child.exitCode !== null || child.signalCode !== null || child.pid === void 0) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
process.kill(-child.pid, signal);
|
|
100
|
+
return;
|
|
101
|
+
} catch {
|
|
102
|
+
}
|
|
103
|
+
child.kill(signal);
|
|
104
|
+
}
|
|
105
|
+
async function removeControlSocket(path) {
|
|
106
|
+
try {
|
|
107
|
+
await unlink(path);
|
|
108
|
+
} catch (cause) {
|
|
109
|
+
if (!(cause instanceof Error) || !("code" in cause) || cause.code !== "ENOENT") {
|
|
110
|
+
throw cause;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
var posixOperations = {
|
|
115
|
+
controlSocketPath: (installationHash) => join(tmpdir(), `mobius-${installationHash}.sock`),
|
|
116
|
+
prepareControlSocket: removeControlSocket,
|
|
117
|
+
secureControlSocket: async (path) => {
|
|
118
|
+
await chmod(path, 384);
|
|
119
|
+
},
|
|
120
|
+
removeControlSocket,
|
|
121
|
+
pathDelimiter: ":",
|
|
122
|
+
environmentValue: (environment, name) => environment[name],
|
|
123
|
+
executableExtensions: () => [""],
|
|
124
|
+
resolveExecutableTarget: async (path) => {
|
|
125
|
+
const target = await realpath(path);
|
|
126
|
+
await access(target, constants.X_OK);
|
|
127
|
+
return target;
|
|
128
|
+
},
|
|
129
|
+
executableLaunch: (command, args) => ({ command, arguments: args }),
|
|
130
|
+
spawnOptions: { detached: true, windowsHide: true },
|
|
131
|
+
signalCapturedProcesses,
|
|
132
|
+
terminateProcess,
|
|
133
|
+
validatePathPermissions: async (path, directory, privateAccess, signal) => {
|
|
134
|
+
signal.throwIfAborted();
|
|
135
|
+
const metadata = await lstat(path);
|
|
136
|
+
if (process.getuid === void 0 || metadata.uid !== process.getuid()) {
|
|
137
|
+
throw new LocalPathError("Path is not user-owned");
|
|
138
|
+
}
|
|
139
|
+
if (privateAccess) {
|
|
140
|
+
await chmod(path, directory ? 448 : 384);
|
|
141
|
+
}
|
|
142
|
+
signal.throwIfAborted();
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
// src/platform/linux.ts
|
|
147
|
+
function appendLinuxProcessTableEntry(entries, processId, encoded) {
|
|
148
|
+
const closingParenthesis = encoded.lastIndexOf(")");
|
|
149
|
+
if (!encoded.startsWith(`${processId.toString()} (`) || closingParenthesis < 0) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const fields = encoded.slice(closingParenthesis + 1).trim().split(/\s+/);
|
|
153
|
+
const parentProcessId = Number(fields[1]);
|
|
154
|
+
const processGroupId = Number(fields[2]);
|
|
155
|
+
if (!Number.isSafeInteger(parentProcessId) || parentProcessId < 0 || !Number.isSafeInteger(processGroupId) || processGroupId <= 0) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
entries.push({ parentProcessId, processGroupId, processId });
|
|
159
|
+
}
|
|
160
|
+
async function readLinuxProcessTable() {
|
|
161
|
+
const entries = [];
|
|
162
|
+
try {
|
|
163
|
+
const directories = await readdir("/proc", { withFileTypes: true });
|
|
164
|
+
for (const directory of directories) {
|
|
165
|
+
if (!directory.isDirectory() || !/^\d+$/.test(directory.name)) {
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
const processId = Number(directory.name);
|
|
169
|
+
if (!Number.isSafeInteger(processId) || processId <= 0) {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
try {
|
|
173
|
+
appendLinuxProcessTableEntry(
|
|
174
|
+
entries,
|
|
175
|
+
processId,
|
|
176
|
+
await readFile(join2("/proc", directory.name, "stat"), "utf8")
|
|
177
|
+
);
|
|
178
|
+
} catch {
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
} catch {
|
|
182
|
+
}
|
|
183
|
+
return entries;
|
|
184
|
+
}
|
|
185
|
+
function readLinuxProcessTableSynchronously() {
|
|
186
|
+
const entries = [];
|
|
187
|
+
try {
|
|
188
|
+
const directories = readdirSync("/proc", { withFileTypes: true });
|
|
189
|
+
for (const directory of directories) {
|
|
190
|
+
if (!directory.isDirectory() || !/^\d+$/.test(directory.name)) {
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
const processId = Number(directory.name);
|
|
194
|
+
if (!Number.isSafeInteger(processId) || processId <= 0) {
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
appendLinuxProcessTableEntry(
|
|
199
|
+
entries,
|
|
200
|
+
processId,
|
|
201
|
+
readFileSync(join2("/proc", directory.name, "stat"), "utf8")
|
|
202
|
+
);
|
|
203
|
+
} catch {
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
} catch {
|
|
207
|
+
}
|
|
208
|
+
return entries;
|
|
209
|
+
}
|
|
210
|
+
async function readLinuxProcessTableWithFallback() {
|
|
211
|
+
const procfsEntries = await readLinuxProcessTable();
|
|
212
|
+
if (procfsEntries.length > 0) {
|
|
213
|
+
return procfsEntries;
|
|
214
|
+
}
|
|
215
|
+
for (const candidate of ["/usr/bin/ps", "/bin/ps", "/run/current-system/sw/bin/ps"]) {
|
|
216
|
+
try {
|
|
217
|
+
const resolvedPath = await realpath2(candidate);
|
|
218
|
+
if (!(await stat(resolvedPath)).isFile()) {
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
await access2(resolvedPath, constants2.X_OK);
|
|
222
|
+
} catch {
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
const entries = await readProcessTableWithPs(candidate);
|
|
226
|
+
if (entries.length > 0) {
|
|
227
|
+
return entries;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return [];
|
|
231
|
+
}
|
|
232
|
+
function processExists2(processId) {
|
|
233
|
+
try {
|
|
234
|
+
const encoded = readFileSync(join2("/proc", processId.toString(), "stat"), "utf8");
|
|
235
|
+
const closingParenthesis = encoded.lastIndexOf(")");
|
|
236
|
+
if (closingParenthesis >= 0) {
|
|
237
|
+
const processState = encoded.slice(closingParenthesis + 1).trimStart().charAt(0);
|
|
238
|
+
if (processState === "Z" || processState === "X") {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
} catch {
|
|
243
|
+
}
|
|
244
|
+
return processExists(processId);
|
|
245
|
+
}
|
|
246
|
+
var linuxPlatform = {
|
|
247
|
+
...posixOperations,
|
|
248
|
+
readProcessTable: readLinuxProcessTableWithFallback,
|
|
249
|
+
readProcessTableSynchronously: readLinuxProcessTableSynchronously,
|
|
250
|
+
processExists: processExists2,
|
|
251
|
+
workBuddyExecutablePaths: () => [],
|
|
252
|
+
openCodeArchives: {
|
|
253
|
+
arm64: {
|
|
254
|
+
asset: "opencode-linux-arm64.tar.gz",
|
|
255
|
+
sha256: "70baf769395ca4e7a68924026530c390eace194f3b7e4919d4efcb2aa2eed3c0",
|
|
256
|
+
format: "tar.gz"
|
|
257
|
+
},
|
|
258
|
+
x64: {
|
|
259
|
+
asset: "opencode-linux-x64.tar.gz",
|
|
260
|
+
sha256: "ea800b7ff56226b70952126c9fc1e2517ca4c4b5682fd9d3f9e87449697a1194",
|
|
261
|
+
format: "tar.gz"
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
grokDependencies: {
|
|
265
|
+
arm64: {
|
|
266
|
+
name: "@xai-official/grok-linux-arm64",
|
|
267
|
+
integrity: "sha512-Jlwz9XtZPNKz/V/ydifC8OVu3hIZz7pmoStt8c4KCqkSWjWiZ/PBIC0iJiq8rvByhx5Z0EdSyq8ZXVwtocceGA==",
|
|
268
|
+
tarballUrl: "https://registry.npmjs.org/@xai-official/grok-linux-arm64/-/grok-linux-arm64-1.0.21.tgz"
|
|
269
|
+
},
|
|
270
|
+
x64: {
|
|
271
|
+
name: "@xai-official/grok-linux-x64",
|
|
272
|
+
integrity: "sha512-AjDV5ifEz5LFG2Jt5IlhAeEkJati/wOvCchVbR4eIj2ogjvmXoXlzBrYRXuAJpXBy5q0se/Yuez5FxDU9Ju81w==",
|
|
273
|
+
tarballUrl: "https://registry.npmjs.org/@xai-official/grok-linux-x64/-/grok-linux-x64-1.0.21.tgz"
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
// src/platform/macos.ts
|
|
279
|
+
import { isAbsolute, join as join3 } from "node:path";
|
|
280
|
+
var WORKBUDDY_MACOS_EXECUTABLE_PATH = Object.freeze([
|
|
281
|
+
"WorkBuddy.app",
|
|
282
|
+
"Contents",
|
|
283
|
+
"Resources",
|
|
284
|
+
"app.asar.unpacked",
|
|
285
|
+
"cli",
|
|
286
|
+
"bin",
|
|
287
|
+
"codebuddy"
|
|
288
|
+
]);
|
|
289
|
+
var macosPlatform = {
|
|
290
|
+
...posixOperations,
|
|
291
|
+
readProcessTable: () => readProcessTableWithPs("/bin/ps"),
|
|
292
|
+
readProcessTableSynchronously: () => [],
|
|
293
|
+
processExists,
|
|
294
|
+
workBuddyExecutablePaths: (environment) => {
|
|
295
|
+
const paths = [join3("/Applications", ...WORKBUDDY_MACOS_EXECUTABLE_PATH)];
|
|
296
|
+
const homeDirectory = environment["HOME"];
|
|
297
|
+
if (homeDirectory !== void 0 && isAbsolute(homeDirectory)) {
|
|
298
|
+
paths.unshift(join3(homeDirectory, "Applications", ...WORKBUDDY_MACOS_EXECUTABLE_PATH));
|
|
299
|
+
}
|
|
300
|
+
return paths;
|
|
301
|
+
},
|
|
302
|
+
openCodeArchives: {
|
|
303
|
+
arm64: {
|
|
304
|
+
asset: "opencode-darwin-arm64.zip",
|
|
305
|
+
sha256: "fe764f7f360c584a83e18dd5f23fb1a6b2725f5ee8854b0252fe558f7798e946",
|
|
306
|
+
format: "zip"
|
|
307
|
+
},
|
|
308
|
+
x64: {
|
|
309
|
+
asset: "opencode-darwin-x64.zip",
|
|
310
|
+
sha256: "9858853e7bacdbbd22c2d70c377e009dc4b354dd04f5588705411e7afb89fd2d",
|
|
311
|
+
format: "zip"
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
grokDependencies: {
|
|
315
|
+
arm64: {
|
|
316
|
+
name: "@xai-official/grok-darwin-arm64",
|
|
317
|
+
integrity: "sha512-I4pKZGnR6Mv4MJOJsB9B/i2o0ODF4eZtp4jHN5feoTqKIeAUVg38OzBtE8aN/wZa7Xg+qhnf6Jd1tcAFvMoFtQ==",
|
|
318
|
+
tarballUrl: "https://registry.npmjs.org/@xai-official/grok-darwin-arm64/-/grok-darwin-arm64-1.0.21.tgz"
|
|
319
|
+
},
|
|
320
|
+
x64: {
|
|
321
|
+
name: "@xai-official/grok-darwin-x64",
|
|
322
|
+
integrity: "sha512-h0nFj3NZ9Kz8w6fQ6UDxxeSIhC1WjwwoRE92iNbG//tZy6YGkppR3s7oRVtt4Xl0CJANKUt0EusyIYnnAvKLzw==",
|
|
323
|
+
tarballUrl: "https://registry.npmjs.org/@xai-official/grok-darwin-x64/-/grok-darwin-x64-1.0.21.tgz"
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
// src/platform/windows.ts
|
|
329
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
330
|
+
import { readFile as readFile2, realpath as realpath3 } from "node:fs/promises";
|
|
331
|
+
import { dirname, extname, join as join4, resolve } from "node:path";
|
|
332
|
+
import { promisify } from "node:util";
|
|
333
|
+
|
|
334
|
+
// src/process/process-error.ts
|
|
335
|
+
var ProcessExecutionError = class extends Error {
|
|
336
|
+
code;
|
|
337
|
+
constructor(code, message, options = {}) {
|
|
338
|
+
super(message, options);
|
|
339
|
+
this.code = code;
|
|
340
|
+
this.name = "ProcessExecutionError";
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
// src/platform/windows.ts
|
|
345
|
+
var execute = promisify(execFile2);
|
|
346
|
+
function environmentValue(environment, name) {
|
|
347
|
+
return Object.entries(environment).find(([key]) => key.toUpperCase() === name.toUpperCase())?.[1];
|
|
348
|
+
}
|
|
349
|
+
function executableExtensions(executableName, environment) {
|
|
350
|
+
if (/\.[a-zA-Z0-9]+$/.test(executableName)) {
|
|
351
|
+
return [""];
|
|
352
|
+
}
|
|
353
|
+
const configured = environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD";
|
|
354
|
+
const extensions = configured.split(";").map((extension) => extension.trim()).filter((extension) => extension.length > 0).map((extension) => extension.startsWith(".") ? extension : `.${extension}`);
|
|
355
|
+
return extensions.length > 0 ? extensions : [".EXE"];
|
|
356
|
+
}
|
|
357
|
+
async function resolveExecutableTarget(path) {
|
|
358
|
+
let resolvedPath;
|
|
359
|
+
try {
|
|
360
|
+
resolvedPath = await realpath3(extname(path) === "" ? `${path}.cmd` : path);
|
|
361
|
+
} catch (cause) {
|
|
362
|
+
if (extname(path) !== "" || !(cause instanceof Error) || !("code" in cause) || cause.code !== "ENOENT") {
|
|
363
|
+
throw cause;
|
|
364
|
+
}
|
|
365
|
+
resolvedPath = await realpath3(path);
|
|
366
|
+
}
|
|
367
|
+
if (extname(resolvedPath).toLowerCase() === ".cmd") {
|
|
368
|
+
const shim = await readFile2(resolvedPath, "utf8");
|
|
369
|
+
const script = /"%_prog%"\s+"%dp0%[\\/]([^"\r\n]+\.(?:js|mjs|cjs))"\s+%\*/iu.exec(shim)?.[1];
|
|
370
|
+
if (script !== void 0 && shim.includes("SET dp0=%~dp0")) {
|
|
371
|
+
resolvedPath = await realpath3(resolve(dirname(resolvedPath), script));
|
|
372
|
+
} else {
|
|
373
|
+
const pnpmScript = /^\s*node\s+"%~dp0[\\/]([^"\r\n]+\.(?:js|mjs|cjs))"\s+%\*\s*$/imu.exec(shim)?.[1];
|
|
374
|
+
if (pnpmScript === void 0 || !shim.includes("@SETLOCAL")) {
|
|
375
|
+
throw new ProcessExecutionError(
|
|
376
|
+
"process_unsupported_script",
|
|
377
|
+
"Use a native executable or a verified Node entrypoint"
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
resolvedPath = await realpath3(resolve(dirname(resolvedPath), pnpmScript));
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return resolvedPath;
|
|
384
|
+
}
|
|
385
|
+
function executableLaunch(command, args) {
|
|
386
|
+
if (/\.(?:js|mjs|cjs)$/iu.test(command)) {
|
|
387
|
+
return { command: process.execPath, arguments: [command, ...args] };
|
|
388
|
+
}
|
|
389
|
+
if (/\.(?:cmd|bat)$/iu.test(command)) {
|
|
390
|
+
throw new ProcessExecutionError(
|
|
391
|
+
"process_unsupported_script",
|
|
392
|
+
"Use a native executable or a verified Node entrypoint"
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
return { command, arguments: args };
|
|
396
|
+
}
|
|
397
|
+
function readProcessTable() {
|
|
398
|
+
const systemRoot = environmentValue(process.env, "SystemRoot");
|
|
399
|
+
if (systemRoot === void 0) {
|
|
400
|
+
return Promise.resolve([]);
|
|
401
|
+
}
|
|
402
|
+
return new Promise((resolveTable) => {
|
|
403
|
+
execFile2(
|
|
404
|
+
join4(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"),
|
|
405
|
+
[
|
|
406
|
+
"-NoLogo",
|
|
407
|
+
"-NoProfile",
|
|
408
|
+
"-NonInteractive",
|
|
409
|
+
"-Command",
|
|
410
|
+
"Get-CimInstance Win32_Process | ForEach-Object { '{0} {1} {0}' -f $_.ProcessId, $_.ParentProcessId }"
|
|
411
|
+
],
|
|
412
|
+
{
|
|
413
|
+
encoding: "utf8",
|
|
414
|
+
windowsHide: true,
|
|
415
|
+
timeout: 1e4,
|
|
416
|
+
signal: AbortSignal.timeout(1e4),
|
|
417
|
+
maxBuffer: 1024 * 1024
|
|
418
|
+
},
|
|
419
|
+
(error, stdout) => resolveTable(error === null ? parseProcessTable(stdout) : [])
|
|
420
|
+
);
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
function signalCapturedProcesses2(processes, _rootProcessId, signal) {
|
|
424
|
+
for (const identity of [...processes].reverse()) {
|
|
425
|
+
try {
|
|
426
|
+
process.kill(identity.processId, signal);
|
|
427
|
+
} catch {
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
function terminateProcess2(child, signal) {
|
|
432
|
+
if (child.exitCode !== null || child.signalCode !== null || child.pid === void 0) {
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
child.kill(signal);
|
|
436
|
+
}
|
|
437
|
+
var windowsPermissions = `
|
|
438
|
+
$ErrorActionPreference = 'Stop'
|
|
439
|
+
Import-Module (Join-Path $PSHOME 'Modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1')
|
|
440
|
+
$item = Get-Item -LiteralPath $env:MOBIUS_PERMISSION_PATH -Force
|
|
441
|
+
if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'Unsafe path' }
|
|
442
|
+
$sid = [Security.Principal.WindowsIdentity]::GetCurrent().User
|
|
443
|
+
$acl = Get-Acl -LiteralPath $item.FullName
|
|
444
|
+
$owner = $acl.GetOwner([Security.Principal.SecurityIdentifier])
|
|
445
|
+
if ($owner -ne $sid -and -not ($owner.Value -eq 'S-1-5-32-544' -and ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))) { throw 'Path is not user-owned' }
|
|
446
|
+
if ($env:MOBIUS_PERMISSION_PRIVATE -eq '1') {
|
|
447
|
+
if ($item.PSIsContainer) {
|
|
448
|
+
$private = New-Object Security.AccessControl.DirectorySecurity
|
|
449
|
+
$rule = New-Object Security.AccessControl.FileSystemAccessRule($sid, 'FullControl', 'ContainerInherit,ObjectInherit', 'None', 'Allow')
|
|
450
|
+
} else {
|
|
451
|
+
$private = New-Object Security.AccessControl.FileSecurity
|
|
452
|
+
$rule = New-Object Security.AccessControl.FileSystemAccessRule($sid, 'FullControl', 'Allow')
|
|
453
|
+
}
|
|
454
|
+
$private.SetOwner($sid)
|
|
455
|
+
$private.SetAccessRuleProtection($true, $false)
|
|
456
|
+
$private.AddAccessRule($rule)
|
|
457
|
+
Set-Acl -LiteralPath $item.FullName -AclObject $private
|
|
458
|
+
}
|
|
459
|
+
`;
|
|
460
|
+
async function validatePathPermissions(path, _directory, privateAccess, signal) {
|
|
461
|
+
signal.throwIfAborted();
|
|
462
|
+
const systemRoot = environmentValue(process.env, "SystemRoot");
|
|
463
|
+
if (systemRoot === void 0) {
|
|
464
|
+
throw new LocalPathError("Windows system directory is unavailable");
|
|
465
|
+
}
|
|
466
|
+
try {
|
|
467
|
+
await execute(
|
|
468
|
+
join4(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"),
|
|
469
|
+
[
|
|
470
|
+
"-NoLogo",
|
|
471
|
+
"-NoProfile",
|
|
472
|
+
"-NonInteractive",
|
|
473
|
+
"-EncodedCommand",
|
|
474
|
+
Buffer.from(windowsPermissions, "utf16le").toString("base64")
|
|
475
|
+
],
|
|
476
|
+
{
|
|
477
|
+
env: {
|
|
478
|
+
...process.env,
|
|
479
|
+
MOBIUS_PERMISSION_PATH: path,
|
|
480
|
+
MOBIUS_PERMISSION_PRIVATE: privateAccess ? "1" : "0"
|
|
481
|
+
},
|
|
482
|
+
windowsHide: true,
|
|
483
|
+
signal: AbortSignal.any([signal, AbortSignal.timeout(1e4)]),
|
|
484
|
+
timeout: 1e4,
|
|
485
|
+
maxBuffer: 16384
|
|
486
|
+
}
|
|
487
|
+
);
|
|
488
|
+
} catch (cause) {
|
|
489
|
+
signal.throwIfAborted();
|
|
490
|
+
throw new LocalPathError("The local path permissions could not be secured", { cause });
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
var windowsPlatform = {
|
|
494
|
+
controlSocketPath: (installationHash) => `\\\\.\\pipe\\mobius-${installationHash}`,
|
|
495
|
+
prepareControlSocket: async () => {
|
|
496
|
+
},
|
|
497
|
+
secureControlSocket: async () => {
|
|
498
|
+
},
|
|
499
|
+
removeControlSocket: async () => {
|
|
500
|
+
},
|
|
501
|
+
pathDelimiter: ";",
|
|
502
|
+
environmentValue,
|
|
503
|
+
executableExtensions,
|
|
504
|
+
resolveExecutableTarget,
|
|
505
|
+
executableLaunch,
|
|
506
|
+
spawnOptions: { detached: false, windowsHide: true },
|
|
507
|
+
signalCapturedProcesses: signalCapturedProcesses2,
|
|
508
|
+
terminateProcess: terminateProcess2,
|
|
509
|
+
validatePathPermissions,
|
|
510
|
+
readProcessTable,
|
|
511
|
+
readProcessTableSynchronously: () => [],
|
|
512
|
+
processExists,
|
|
513
|
+
workBuddyExecutablePaths: () => [],
|
|
514
|
+
openCodeArchives: {},
|
|
515
|
+
grokDependencies: {}
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
// src/platform/index.ts
|
|
519
|
+
var fallbackPlatform = {
|
|
520
|
+
...posixOperations,
|
|
521
|
+
readProcessTable: () => readProcessTableWithPs("/usr/bin/ps"),
|
|
522
|
+
readProcessTableSynchronously: () => [],
|
|
523
|
+
processExists,
|
|
524
|
+
workBuddyExecutablePaths: () => [],
|
|
525
|
+
openCodeArchives: {},
|
|
526
|
+
grokDependencies: {}
|
|
527
|
+
};
|
|
528
|
+
var platforms = /* @__PURE__ */ new Map([
|
|
529
|
+
["linux", linuxPlatform],
|
|
530
|
+
["darwin", macosPlatform],
|
|
531
|
+
["win32", windowsPlatform]
|
|
532
|
+
]);
|
|
533
|
+
function platformSupportFor(platform) {
|
|
534
|
+
return platforms.get(platform) ?? fallbackPlatform;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
// src/filesystem/private-path.ts
|
|
538
|
+
async function validateLocalPath(path, directory, privateAccess, signal) {
|
|
539
|
+
signal.throwIfAborted();
|
|
540
|
+
const metadata = await lstat2(path);
|
|
541
|
+
if (metadata.isSymbolicLink() || (directory ? !metadata.isDirectory() : !metadata.isFile())) {
|
|
542
|
+
throw new LocalPathError("Unsafe local path");
|
|
543
|
+
}
|
|
544
|
+
await platformSupportFor(process.platform).validatePathPermissions(path, directory, privateAccess, signal);
|
|
545
|
+
}
|
|
546
|
+
export {
|
|
547
|
+
LocalPathError,
|
|
548
|
+
validateLocalPath
|
|
549
|
+
};
|
|
550
|
+
//# sourceMappingURL=private-path.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/filesystem/private-path.ts", "../../src/platform/linux.ts", "../../src/platform/posix.ts", "../../src/filesystem/path-error.ts", "../../src/platform/macos.ts", "../../src/platform/windows.ts", "../../src/process/process-error.ts", "../../src/platform/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { lstat } from \"node:fs/promises\";\nimport { platformSupportFor } from \"../platform/index.ts\";\nimport { LocalPathError } from \"./path-error.ts\";\n\nexport { LocalPathError } from \"./path-error.ts\";\n\nexport async function validateLocalPath(\n path: string,\n directory: boolean,\n privateAccess: boolean,\n signal: AbortSignal,\n): Promise<void> {\n signal.throwIfAborted();\n const metadata = await lstat(path);\n if (metadata.isSymbolicLink() || (directory ? !metadata.isDirectory() : !metadata.isFile())) {\n throw new LocalPathError(\"Unsafe local path\");\n }\n await platformSupportFor(process.platform).validatePathPermissions(path, directory, privateAccess, signal);\n}\n", "import { constants, readdirSync, readFileSync } from \"node:fs\";\nimport { access, readdir, readFile, realpath, stat } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport type { PlatformSupport, ProcessTableEntry } from \"./contracts.ts\";\nimport { posixOperations, processExists as posixProcessExists, readProcessTableWithPs } from \"./posix.ts\";\n\nfunction appendLinuxProcessTableEntry(entries: ProcessTableEntry[], processId: number, encoded: string): void {\n const closingParenthesis = encoded.lastIndexOf(\")\");\n if (!encoded.startsWith(`${processId.toString()} (`) || closingParenthesis < 0) {\n return;\n }\n const fields = encoded\n .slice(closingParenthesis + 1)\n .trim()\n .split(/\\s+/);\n const parentProcessId = Number(fields[1]);\n const processGroupId = Number(fields[2]);\n if (\n !Number.isSafeInteger(parentProcessId) ||\n parentProcessId < 0 ||\n !Number.isSafeInteger(processGroupId) ||\n processGroupId <= 0\n ) {\n return;\n }\n entries.push({ parentProcessId, processGroupId, processId });\n}\n\nasync function readLinuxProcessTable(): Promise<readonly ProcessTableEntry[]> {\n const entries: ProcessTableEntry[] = [];\n try {\n const directories = await readdir(\"/proc\", { withFileTypes: true });\n for (const directory of directories) {\n if (!directory.isDirectory() || !/^\\d+$/.test(directory.name)) {\n continue;\n }\n const processId = Number(directory.name);\n if (!Number.isSafeInteger(processId) || processId <= 0) {\n continue;\n }\n try {\n appendLinuxProcessTableEntry(\n entries,\n processId,\n await readFile(join(\"/proc\", directory.name, \"stat\"), \"utf8\"),\n );\n } catch {\n // Processes can exit while procfs is being enumerated.\n }\n }\n } catch {\n // A restricted Linux runtime may not mount procfs; the fixed ps fallback runs below.\n }\n return entries;\n}\n\nfunction readLinuxProcessTableSynchronously(): readonly ProcessTableEntry[] {\n const entries: ProcessTableEntry[] = [];\n try {\n const directories = readdirSync(\"/proc\", { withFileTypes: true });\n for (const directory of directories) {\n if (!directory.isDirectory() || !/^\\d+$/.test(directory.name)) {\n continue;\n }\n const processId = Number(directory.name);\n if (!Number.isSafeInteger(processId) || processId <= 0) {\n continue;\n }\n try {\n appendLinuxProcessTableEntry(\n entries,\n processId,\n readFileSync(join(\"/proc\", directory.name, \"stat\"), \"utf8\"),\n );\n } catch {\n // Processes can exit while procfs is being enumerated.\n }\n }\n } catch {\n // A restricted Linux runtime may not mount procfs; the asynchronous fallback runs below.\n }\n return entries;\n}\n\nasync function readLinuxProcessTableWithFallback(): Promise<readonly ProcessTableEntry[]> {\n const procfsEntries = await readLinuxProcessTable();\n if (procfsEntries.length > 0) {\n return procfsEntries;\n }\n for (const candidate of [\"/usr/bin/ps\", \"/bin/ps\", \"/run/current-system/sw/bin/ps\"]) {\n try {\n const resolvedPath = await realpath(candidate);\n if (!(await stat(resolvedPath)).isFile()) {\n continue;\n }\n await access(resolvedPath, constants.X_OK);\n } catch {\n continue;\n }\n const entries = await readProcessTableWithPs(candidate);\n if (entries.length > 0) {\n return entries;\n }\n }\n return [];\n}\n\nfunction processExists(processId: number): boolean {\n try {\n const encoded = readFileSync(join(\"/proc\", processId.toString(), \"stat\"), \"utf8\");\n const closingParenthesis = encoded.lastIndexOf(\")\");\n if (closingParenthesis >= 0) {\n const processState = encoded\n .slice(closingParenthesis + 1)\n .trimStart()\n .charAt(0);\n if (processState === \"Z\" || processState === \"X\") {\n return false;\n }\n }\n } catch {\n // Fall through so restricted procfs mounts still use the portable signal probe.\n }\n return posixProcessExists(processId);\n}\n\nexport const linuxPlatform: PlatformSupport = {\n ...posixOperations,\n readProcessTable: readLinuxProcessTableWithFallback,\n readProcessTableSynchronously: readLinuxProcessTableSynchronously,\n processExists,\n workBuddyExecutablePaths: () => [],\n openCodeArchives: {\n arm64: {\n asset: \"opencode-linux-arm64.tar.gz\",\n sha256: \"70baf769395ca4e7a68924026530c390eace194f3b7e4919d4efcb2aa2eed3c0\",\n format: \"tar.gz\",\n },\n x64: {\n asset: \"opencode-linux-x64.tar.gz\",\n sha256: \"ea800b7ff56226b70952126c9fc1e2517ca4c4b5682fd9d3f9e87449697a1194\",\n format: \"tar.gz\",\n },\n },\n grokDependencies: {\n arm64: {\n name: \"@xai-official/grok-linux-arm64\",\n integrity:\n \"sha512-Jlwz9XtZPNKz/V/ydifC8OVu3hIZz7pmoStt8c4KCqkSWjWiZ/PBIC0iJiq8rvByhx5Z0EdSyq8ZXVwtocceGA==\",\n tarballUrl: \"https://registry.npmjs.org/@xai-official/grok-linux-arm64/-/grok-linux-arm64-1.0.21.tgz\",\n },\n x64: {\n name: \"@xai-official/grok-linux-x64\",\n integrity:\n \"sha512-AjDV5ifEz5LFG2Jt5IlhAeEkJati/wOvCchVbR4eIj2ogjvmXoXlzBrYRXuAJpXBy5q0se/Yuez5FxDU9Ju81w==\",\n tarballUrl: \"https://registry.npmjs.org/@xai-official/grok-linux-x64/-/grok-linux-x64-1.0.21.tgz\",\n },\n },\n};\n", "import { type ChildProcess, execFile } from \"node:child_process\";\nimport { constants } from \"node:fs\";\nimport { access, chmod, lstat, realpath, unlink } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { LocalPathError } from \"../filesystem/path-error.ts\";\nimport type { PlatformSupport, ProcessTableEntry, ProcessTreeIdentity } from \"./contracts.ts\";\n\nconst PROCESS_TABLE_TIMEOUT_MILLISECONDS = 1_000;\nconst PROCESS_TABLE_OUTPUT_LIMIT_BYTES = 1024 * 1024;\n\nexport function parseProcessTable(output: string): readonly ProcessTableEntry[] {\n const entries: ProcessTableEntry[] = [];\n for (const line of output.split(\"\\n\")) {\n const groups = /^\\s*(?<pid>\\d+)\\s+(?<ppid>\\d+)\\s+(?<pgid>\\d+)\\s*$/.exec(line)?.groups;\n if (groups === undefined) {\n continue;\n }\n const processId = Number(groups[\"pid\"]);\n const parentProcessId = Number(groups[\"ppid\"]);\n const processGroupId = Number(groups[\"pgid\"]);\n if (\n !Number.isSafeInteger(processId) ||\n processId <= 0 ||\n !Number.isSafeInteger(parentProcessId) ||\n parentProcessId < 0 ||\n !Number.isSafeInteger(processGroupId) ||\n processGroupId <= 0\n ) {\n continue;\n }\n entries.push({ parentProcessId, processGroupId, processId });\n }\n return entries;\n}\n\nexport function readProcessTableWithPs(executable: string): Promise<readonly ProcessTableEntry[]> {\n return new Promise((resolveTable) => {\n execFile(\n executable,\n [\"-axo\", \"pid=,ppid=,pgid=\"],\n {\n encoding: \"utf8\",\n maxBuffer: PROCESS_TABLE_OUTPUT_LIMIT_BYTES,\n signal: AbortSignal.timeout(PROCESS_TABLE_TIMEOUT_MILLISECONDS),\n timeout: PROCESS_TABLE_TIMEOUT_MILLISECONDS,\n },\n (error, stdout) => {\n resolveTable(error === null ? parseProcessTable(stdout) : []);\n },\n );\n });\n}\n\nexport function processExists(processId: number): boolean {\n try {\n process.kill(processId, 0);\n return true;\n } catch {\n return false;\n }\n}\n\nexport function signalCapturedProcesses(\n processes: readonly ProcessTreeIdentity[],\n rootProcessId: number,\n signal: number,\n): void {\n const processIds = new Set(processes.map((identity) => identity.processId));\n const signalledGroups = new Set<number>();\n for (const identity of processes) {\n const isRootProcessGroup = identity.processGroupId === rootProcessId;\n if (\n (!isRootProcessGroup && !processIds.has(identity.processGroupId)) ||\n signalledGroups.has(identity.processGroupId)\n ) {\n continue;\n }\n try {\n process.kill(-identity.processGroupId, signal);\n signalledGroups.add(identity.processGroupId);\n } catch {\n // A concurrently exited group no longer needs cleanup.\n }\n }\n for (const identity of processes) {\n if (\n identity.processId === rootProcessId ||\n identity.processGroupId === rootProcessId ||\n signalledGroups.has(identity.processGroupId)\n ) {\n continue;\n }\n try {\n process.kill(identity.processId, signal);\n } catch {\n // A concurrently exited process no longer needs cleanup.\n }\n }\n}\n\nfunction terminateProcess(child: ChildProcess, signal: NodeJS.Signals): void {\n if (child.exitCode !== null || child.signalCode !== null || child.pid === undefined) {\n return;\n }\n try {\n process.kill(-child.pid, signal);\n return;\n } catch {\n // Fall through when the child did not create a process group.\n }\n child.kill(signal);\n}\n\nasync function removeControlSocket(path: string): Promise<void> {\n try {\n await unlink(path);\n } catch (cause) {\n if (!(cause instanceof Error) || !(\"code\" in cause) || cause.code !== \"ENOENT\") {\n throw cause;\n }\n }\n}\n\nexport const posixOperations = {\n controlSocketPath: (installationHash: string) => join(tmpdir(), `mobius-${installationHash}.sock`),\n prepareControlSocket: removeControlSocket,\n secureControlSocket: async (path: string) => {\n await chmod(path, 0o600);\n },\n removeControlSocket,\n\n pathDelimiter: \":\",\n environmentValue: (environment: Readonly<NodeJS.ProcessEnv>, name: string) => environment[name],\n executableExtensions: () => [\"\"],\n resolveExecutableTarget: async (path: string) => {\n const target = await realpath(path);\n await access(target, constants.X_OK);\n return target;\n },\n executableLaunch: (command: string, args: readonly string[]) => ({ command, arguments: args }),\n spawnOptions: { detached: true, windowsHide: true },\n signalCapturedProcesses,\n terminateProcess,\n validatePathPermissions: async (path: string, directory: boolean, privateAccess: boolean, signal: AbortSignal) => {\n signal.throwIfAborted();\n const metadata = await lstat(path);\n if (process.getuid === undefined || metadata.uid !== process.getuid()) {\n throw new LocalPathError(\"Path is not user-owned\");\n }\n if (privateAccess) {\n await chmod(path, directory ? 0o700 : 0o600);\n }\n signal.throwIfAborted();\n },\n} satisfies Pick<\n PlatformSupport,\n | \"controlSocketPath\"\n | \"prepareControlSocket\"\n | \"secureControlSocket\"\n | \"removeControlSocket\"\n | \"pathDelimiter\"\n | \"environmentValue\"\n | \"executableExtensions\"\n | \"resolveExecutableTarget\"\n | \"executableLaunch\"\n | \"spawnOptions\"\n | \"signalCapturedProcesses\"\n | \"terminateProcess\"\n | \"validatePathPermissions\"\n>;\n", "export class LocalPathError extends Error {\n readonly code = \"unsafe_local_path\";\n\n constructor(message: string, options: ErrorOptions = {}) {\n super(message, options);\n this.name = \"LocalPathError\";\n }\n}\n", "import { isAbsolute, join } from \"node:path\";\nimport type { PlatformSupport } from \"./contracts.ts\";\nimport { posixOperations, processExists, readProcessTableWithPs } from \"./posix.ts\";\n\nconst WORKBUDDY_MACOS_EXECUTABLE_PATH = Object.freeze([\n \"WorkBuddy.app\",\n \"Contents\",\n \"Resources\",\n \"app.asar.unpacked\",\n \"cli\",\n \"bin\",\n \"codebuddy\",\n]);\n\nexport const macosPlatform: PlatformSupport = {\n ...posixOperations,\n readProcessTable: () => readProcessTableWithPs(\"/bin/ps\"),\n readProcessTableSynchronously: () => [],\n processExists,\n workBuddyExecutablePaths: (environment) => {\n const paths = [join(\"/Applications\", ...WORKBUDDY_MACOS_EXECUTABLE_PATH)];\n const homeDirectory = environment[\"HOME\"];\n if (homeDirectory !== undefined && isAbsolute(homeDirectory)) {\n paths.unshift(join(homeDirectory, \"Applications\", ...WORKBUDDY_MACOS_EXECUTABLE_PATH));\n }\n return paths;\n },\n openCodeArchives: {\n arm64: {\n asset: \"opencode-darwin-arm64.zip\",\n sha256: \"fe764f7f360c584a83e18dd5f23fb1a6b2725f5ee8854b0252fe558f7798e946\",\n format: \"zip\",\n },\n x64: {\n asset: \"opencode-darwin-x64.zip\",\n sha256: \"9858853e7bacdbbd22c2d70c377e009dc4b354dd04f5588705411e7afb89fd2d\",\n format: \"zip\",\n },\n },\n grokDependencies: {\n arm64: {\n name: \"@xai-official/grok-darwin-arm64\",\n integrity:\n \"sha512-I4pKZGnR6Mv4MJOJsB9B/i2o0ODF4eZtp4jHN5feoTqKIeAUVg38OzBtE8aN/wZa7Xg+qhnf6Jd1tcAFvMoFtQ==\",\n tarballUrl: \"https://registry.npmjs.org/@xai-official/grok-darwin-arm64/-/grok-darwin-arm64-1.0.21.tgz\",\n },\n x64: {\n name: \"@xai-official/grok-darwin-x64\",\n integrity:\n \"sha512-h0nFj3NZ9Kz8w6fQ6UDxxeSIhC1WjwwoRE92iNbG//tZy6YGkppR3s7oRVtt4Xl0CJANKUt0EusyIYnnAvKLzw==\",\n tarballUrl: \"https://registry.npmjs.org/@xai-official/grok-darwin-x64/-/grok-darwin-x64-1.0.21.tgz\",\n },\n },\n};\n", "import { type ChildProcess, execFile } from \"node:child_process\";\nimport { readFile, realpath } from \"node:fs/promises\";\nimport { dirname, extname, join, resolve } from \"node:path\";\nimport { promisify } from \"node:util\";\nimport { LocalPathError } from \"../filesystem/path-error.ts\";\nimport { ProcessExecutionError } from \"../process/process-error.ts\";\nimport type { PlatformSupport, ProcessLaunch, ProcessTableEntry, ProcessTreeIdentity } from \"./contracts.ts\";\nimport { parseProcessTable, processExists } from \"./posix.ts\";\n\nconst execute = promisify(execFile);\n\nfunction environmentValue(environment: Readonly<NodeJS.ProcessEnv>, name: string): string | undefined {\n return Object.entries(environment).find(([key]) => key.toUpperCase() === name.toUpperCase())?.[1];\n}\n\nfunction executableExtensions(executableName: string, environment: Readonly<NodeJS.ProcessEnv>): readonly string[] {\n if (/\\.[a-zA-Z0-9]+$/.test(executableName)) {\n return [\"\"];\n }\n const configured = environmentValue(environment, \"PATHEXT\") ?? \".COM;.EXE;.BAT;.CMD\";\n const extensions = configured\n .split(\";\")\n .map((extension) => extension.trim())\n .filter((extension) => extension.length > 0)\n .map((extension) => (extension.startsWith(\".\") ? extension : `.${extension}`));\n return extensions.length > 0 ? extensions : [\".EXE\"];\n}\n\nasync function resolveExecutableTarget(path: string): Promise<string> {\n let resolvedPath: string;\n try {\n resolvedPath = await realpath(extname(path) === \"\" ? `${path}.cmd` : path);\n } catch (cause) {\n if (extname(path) !== \"\" || !(cause instanceof Error) || !(\"code\" in cause) || cause.code !== \"ENOENT\") {\n throw cause;\n }\n resolvedPath = await realpath(path);\n }\n if (extname(resolvedPath).toLowerCase() === \".cmd\") {\n // npm cmd-shim entrypoints are Node scripts. Resolve the script instead of\n // handing untrusted arguments to cmd.exe's command language.\n const shim = await readFile(resolvedPath, \"utf8\");\n const script = /\"%_prog%\"\\s+\"%dp0%[\\\\/]([^\"\\r\\n]+\\.(?:js|mjs|cjs))\"\\s+%\\*/iu.exec(shim)?.[1];\n if (script !== undefined && shim.includes(\"SET dp0=%~dp0\")) {\n resolvedPath = await realpath(resolve(dirname(resolvedPath), script));\n } else {\n const pnpmScript = /^\\s*node\\s+\"%~dp0[\\\\/]([^\"\\r\\n]+\\.(?:js|mjs|cjs))\"\\s+%\\*\\s*$/imu.exec(shim)?.[1];\n if (pnpmScript === undefined || !shim.includes(\"@SETLOCAL\")) {\n throw new ProcessExecutionError(\n \"process_unsupported_script\",\n \"Use a native executable or a verified Node entrypoint\",\n );\n }\n resolvedPath = await realpath(resolve(dirname(resolvedPath), pnpmScript));\n }\n }\n return resolvedPath;\n}\n\nfunction executableLaunch(command: string, args: readonly string[]): ProcessLaunch {\n if (/\\.(?:js|mjs|cjs)$/iu.test(command)) {\n return { command: process.execPath, arguments: [command, ...args] };\n }\n if (/\\.(?:cmd|bat)$/iu.test(command)) {\n throw new ProcessExecutionError(\n \"process_unsupported_script\",\n \"Use a native executable or a verified Node entrypoint\",\n );\n }\n return { command, arguments: args };\n}\n\nfunction readProcessTable(): Promise<readonly ProcessTableEntry[]> {\n const systemRoot = environmentValue(process.env, \"SystemRoot\");\n if (systemRoot === undefined) {\n return Promise.resolve([]);\n }\n return new Promise((resolveTable) => {\n execFile(\n join(systemRoot, \"System32\", \"WindowsPowerShell\", \"v1.0\", \"powershell.exe\"),\n [\n \"-NoLogo\",\n \"-NoProfile\",\n \"-NonInteractive\",\n \"-Command\",\n \"Get-CimInstance Win32_Process | ForEach-Object { '{0} {1} {0}' -f $_.ProcessId, $_.ParentProcessId }\",\n ],\n {\n encoding: \"utf8\",\n windowsHide: true,\n timeout: 10000,\n signal: AbortSignal.timeout(10000),\n maxBuffer: 1024 * 1024,\n },\n (error, stdout) => resolveTable(error === null ? parseProcessTable(stdout) : []),\n );\n });\n}\n\nfunction signalCapturedProcesses(\n processes: readonly ProcessTreeIdentity[],\n _rootProcessId: number,\n signal: number,\n): void {\n for (const identity of [...processes].reverse()) {\n try {\n process.kill(identity.processId, signal);\n } catch {\n // A concurrently exited process no longer needs cleanup.\n }\n }\n}\n\nfunction terminateProcess(child: ChildProcess, signal: NodeJS.Signals): void {\n if (child.exitCode !== null || child.signalCode !== null || child.pid === undefined) {\n return;\n }\n child.kill(signal);\n}\n\n// The path is data in the environment, never interpolated into PowerShell source.\nconst windowsPermissions = `\n$ErrorActionPreference = 'Stop'\nImport-Module (Join-Path $PSHOME 'Modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1')\n$item = Get-Item -LiteralPath $env:MOBIUS_PERMISSION_PATH -Force\nif (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'Unsafe path' }\n$sid = [Security.Principal.WindowsIdentity]::GetCurrent().User\n$acl = Get-Acl -LiteralPath $item.FullName\n$owner = $acl.GetOwner([Security.Principal.SecurityIdentifier])\nif ($owner -ne $sid -and -not ($owner.Value -eq 'S-1-5-32-544' -and ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))) { throw 'Path is not user-owned' }\nif ($env:MOBIUS_PERMISSION_PRIVATE -eq '1') {\n if ($item.PSIsContainer) {\n $private = New-Object Security.AccessControl.DirectorySecurity\n $rule = New-Object Security.AccessControl.FileSystemAccessRule($sid, 'FullControl', 'ContainerInherit,ObjectInherit', 'None', 'Allow')\n } else {\n $private = New-Object Security.AccessControl.FileSecurity\n $rule = New-Object Security.AccessControl.FileSystemAccessRule($sid, 'FullControl', 'Allow')\n }\n $private.SetOwner($sid)\n $private.SetAccessRuleProtection($true, $false)\n $private.AddAccessRule($rule)\n Set-Acl -LiteralPath $item.FullName -AclObject $private\n}\n`;\n\nasync function validatePathPermissions(\n path: string,\n _directory: boolean,\n privateAccess: boolean,\n signal: AbortSignal,\n): Promise<void> {\n signal.throwIfAborted();\n const systemRoot = environmentValue(process.env, \"SystemRoot\");\n if (systemRoot === undefined) {\n throw new LocalPathError(\"Windows system directory is unavailable\");\n }\n try {\n await execute(\n join(systemRoot, \"System32\", \"WindowsPowerShell\", \"v1.0\", \"powershell.exe\"),\n [\n \"-NoLogo\",\n \"-NoProfile\",\n \"-NonInteractive\",\n \"-EncodedCommand\",\n Buffer.from(windowsPermissions, \"utf16le\").toString(\"base64\"),\n ],\n {\n env: {\n ...process.env,\n MOBIUS_PERMISSION_PATH: path,\n MOBIUS_PERMISSION_PRIVATE: privateAccess ? \"1\" : \"0\",\n },\n windowsHide: true,\n signal: AbortSignal.any([signal, AbortSignal.timeout(10000)]),\n timeout: 10000,\n maxBuffer: 16384,\n },\n );\n } catch (cause) {\n signal.throwIfAborted();\n throw new LocalPathError(\"The local path permissions could not be secured\", { cause });\n }\n}\n\nexport const windowsPlatform: PlatformSupport = {\n controlSocketPath: (installationHash) => `\\\\\\\\.\\\\pipe\\\\mobius-${installationHash}`,\n prepareControlSocket: async () => {},\n secureControlSocket: async () => {},\n removeControlSocket: async () => {},\n\n pathDelimiter: \";\",\n environmentValue,\n executableExtensions,\n resolveExecutableTarget,\n executableLaunch,\n spawnOptions: { detached: false, windowsHide: true },\n signalCapturedProcesses,\n terminateProcess,\n validatePathPermissions,\n readProcessTable,\n readProcessTableSynchronously: () => [],\n processExists,\n workBuddyExecutablePaths: () => [],\n openCodeArchives: {},\n grokDependencies: {},\n};\n", "export class ProcessExecutionError extends Error {\n readonly code: string;\n\n constructor(code: string, message: string, options: ErrorOptions = {}) {\n super(message, options);\n this.code = code;\n this.name = \"ProcessExecutionError\";\n }\n}\n", "import type { PlatformSupport } from \"./contracts.ts\";\nimport { linuxPlatform } from \"./linux.ts\";\nimport { macosPlatform } from \"./macos.ts\";\nimport { posixOperations, processExists, readProcessTableWithPs } from \"./posix.ts\";\nimport { windowsPlatform } from \"./windows.ts\";\n\n// Preserve the existing fallback for other POSIX hosts.\nconst fallbackPlatform: PlatformSupport = {\n ...posixOperations,\n readProcessTable: () => readProcessTableWithPs(\"/usr/bin/ps\"),\n readProcessTableSynchronously: () => [],\n processExists,\n workBuddyExecutablePaths: () => [],\n openCodeArchives: {},\n grokDependencies: {},\n};\nconst platforms: ReadonlyMap<NodeJS.Platform, PlatformSupport> = new Map([\n [\"linux\", linuxPlatform],\n [\"darwin\", macosPlatform],\n [\"win32\", windowsPlatform],\n]);\n\nexport function platformSupportFor(platform: NodeJS.Platform): PlatformSupport {\n return platforms.get(platform) ?? fallbackPlatform;\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,SAAAA,cAAa;;;ACAtB,SAAS,aAAAC,YAAW,aAAa,oBAAoB;AACrD,SAAS,UAAAC,SAAQ,SAAS,UAAU,YAAAC,WAAU,YAAY;AAC1D,SAAS,QAAAC,aAAY;;;ACFrB,SAA4B,gBAAgB;AAC5C,SAAS,iBAAiB;AAC1B,SAAS,QAAQ,OAAO,OAAO,UAAU,cAAc;AACvD,SAAS,cAAc;AACvB,SAAS,YAAY;;;ACJd,IAAM,iBAAN,cAA6B,MAAM;AAAA,EAC7B,OAAO;AAAA,EAEhB,YAAY,SAAiB,UAAwB,CAAC,GAAG;AACrD,UAAM,SAAS,OAAO;AACtB,SAAK,OAAO;AAAA,EAChB;AACJ;;;ADCA,IAAM,qCAAqC;AAC3C,IAAM,mCAAmC,OAAO;AAEzC,SAAS,kBAAkB,QAA8C;AAC5E,QAAM,UAA+B,CAAC;AACtC,aAAW,QAAQ,OAAO,MAAM,IAAI,GAAG;AACnC,UAAM,SAAS,oDAAoD,KAAK,IAAI,GAAG;AAC/E,QAAI,WAAW,QAAW;AACtB;AAAA,IACJ;AACA,UAAM,YAAY,OAAO,OAAO,KAAK,CAAC;AACtC,UAAM,kBAAkB,OAAO,OAAO,MAAM,CAAC;AAC7C,UAAM,iBAAiB,OAAO,OAAO,MAAM,CAAC;AAC5C,QACI,CAAC,OAAO,cAAc,SAAS,KAC/B,aAAa,KACb,CAAC,OAAO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a;AAAA,EAC5D,+BAA+B,MAAM,CAAC;AAAA,EACtC;AAAA,EACA,0BAA0B,MAAM,CAAC;AAAA,EACjC,kBAAkB,CAAC;AAAA,EACnB,kBAAkB,CAAC;AACvB;AACA,IAAM,YAA2D,oBAAI,IAAI;AAAA,EACrE,CAAC,SAAS,aAAa;AAAA,EACvB,CAAC,UAAU,aAAa;AAAA,EACxB,CAAC,SAAS,eAAe;AAC7B,CAAC;AAEM,SAAS,mBAAmB,UAA4C;AAC3E,SAAO,UAAU,IAAI,QAAQ,KAAK;AACtC;;;APlBA,eAAsB,kBAClB,MACA,WACA,eACA,QACa;AACb,SAAO,eAAe;AACtB,QAAM,WAAW,MAAMC,OAAM,IAAI;AACjC,MAAI,SAAS,eAAe,MAAM,YAAY,CAAC,SAAS,YAAY,IAAI,CAAC,SAAS,OAAO,IAAI;AACzF,UAAM,IAAI,eAAe,mBAAmB;AAAA,EAChD;AACA,QAAM,mBAAmB,QAAQ,QAAQ,EAAE,wBAAwB,MAAM,WAAW,eAAe,MAAM;AAC7G;",
|
|
6
|
+
"names": ["lstat", "constants", "access", "realpath", "join", "join", "realpath", "access", "constants", "processExists", "join", "join", "execFile", "readFile", "realpath", "join", "execFile", "realpath", "readFile", "join", "signalCapturedProcesses", "terminateProcess", "lstat"]
|
|
7
|
+
}
|