@moxt-ai/mobius 0.0.336 → 0.0.337

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 (53) hide show
  1. package/dist/cli.js +427 -353
  2. package/dist/cli.js.map +4 -4
  3. package/dist/runtime.js +350 -310
  4. package/dist/runtime.js.map +4 -4
  5. package/dist/util/filesystem/private-path.js +6 -324
  6. package/dist/util/filesystem/private-path.js.map +4 -4
  7. package/dist/util/platform/contracts.d.ts +0 -26
  8. package/dist/util/platform/contracts.d.ts.map +1 -1
  9. package/dist/util/platform/index.d.ts.map +1 -1
  10. package/dist/util/platform/index.js +1 -4
  11. package/dist/util/platform/index.js.map +1 -1
  12. package/dist/util/platform/linux.d.ts.map +1 -1
  13. package/dist/util/platform/linux.js +1 -117
  14. package/dist/util/platform/linux.js.map +1 -1
  15. package/dist/util/platform/macos.d.ts.map +1 -1
  16. package/dist/util/platform/macos.js +1 -4
  17. package/dist/util/platform/macos.js.map +1 -1
  18. package/dist/util/platform/posix.d.ts +0 -21
  19. package/dist/util/platform/posix.d.ts.map +1 -1
  20. package/dist/util/platform/posix.js +1 -104
  21. package/dist/util/platform/posix.js.map +1 -1
  22. package/dist/util/platform/windows.d.ts.map +1 -1
  23. package/dist/util/platform/windows.js +1 -107
  24. package/dist/util/platform/windows.js.map +1 -1
  25. package/dist/util/process/executable.d.ts +2 -2
  26. package/dist/util/process/executable.d.ts.map +1 -1
  27. package/dist/util/process/executable.js +31 -222
  28. package/dist/util/process/executable.js.map +4 -4
  29. package/dist/util/process/platform/contracts.d.ts +29 -0
  30. package/dist/util/process/platform/contracts.d.ts.map +1 -0
  31. package/dist/util/process/platform/contracts.js +2 -0
  32. package/dist/util/process/platform/contracts.js.map +1 -0
  33. package/dist/util/process/platform/index.d.ts +3 -0
  34. package/dist/util/process/platform/index.d.ts.map +1 -0
  35. package/dist/util/process/platform/index.js +20 -0
  36. package/dist/util/process/platform/index.js.map +1 -0
  37. package/dist/util/process/platform/linux.d.ts +3 -0
  38. package/dist/util/process/platform/linux.d.ts.map +1 -0
  39. package/dist/util/process/platform/linux.js +122 -0
  40. package/dist/util/process/platform/linux.js.map +1 -0
  41. package/dist/util/process/platform/macos.d.ts +3 -0
  42. package/dist/util/process/platform/macos.d.ts.map +1 -0
  43. package/dist/util/process/platform/macos.js +8 -0
  44. package/dist/util/process/platform/macos.js.map +1 -0
  45. package/dist/util/process/platform/posix.d.ts +25 -0
  46. package/dist/util/process/platform/posix.d.ts.map +1 -0
  47. package/dist/util/process/platform/posix.js +107 -0
  48. package/dist/util/process/platform/posix.js.map +1 -0
  49. package/dist/util/process/platform/windows.d.ts +3 -0
  50. package/dist/util/process/platform/windows.d.ts.map +1 -0
  51. package/dist/util/process/platform/windows.js +114 -0
  52. package/dist/util/process/platform/windows.js.map +1 -0
  53. package/package.json +2 -2
@@ -2,14 +2,10 @@
2
2
  import { lstat as lstat2 } from "node:fs/promises";
3
3
 
4
4
  // src/util/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
5
  import { isAbsolute, join as join2 } from "node:path";
8
6
 
9
7
  // src/util/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";
8
+ import { chmod, lstat, unlink } from "node:fs/promises";
13
9
  import { tmpdir } from "node:os";
14
10
  import { join } from "node:path";
15
11
 
@@ -23,85 +19,6 @@ var LocalPathError = class extends Error {
23
19
  };
24
20
 
25
21
  // src/util/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
22
  async function removeControlSocket(path) {
106
23
  try {
107
24
  await unlink(path);
@@ -118,18 +35,6 @@ var posixOperations = {
118
35
  await chmod(path, 384);
119
36
  },
120
37
  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
38
  validatePathPermissions: async (path, directory, privateAccess, signal) => {
134
39
  signal.throwIfAborted();
135
40
  const metadata = await lstat(path);
@@ -144,110 +49,8 @@ var posixOperations = {
144
49
  };
145
50
 
146
51
  // src/util/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
52
  var linuxPlatform = {
247
53
  ...posixOperations,
248
- readProcessTable: readLinuxProcessTableWithFallback,
249
- readProcessTableSynchronously: readLinuxProcessTableSynchronously,
250
- processExists: processExists2,
251
54
  claudeCodeExecutablePaths: (environment) => {
252
55
  const homeDirectory = environment["HOME"];
253
56
  return homeDirectory !== void 0 && isAbsolute(homeDirectory) ? [join2(homeDirectory, ".local", "bin", "claude")] : [];
@@ -258,11 +61,11 @@ var linuxPlatform = {
258
61
  import { isAbsolute as isAbsolute2, join as join4 } from "node:path";
259
62
 
260
63
  // src/util/platform/claude-desktop.ts
261
- import { readdirSync as readdirSync2 } from "node:fs";
64
+ import { readdirSync } from "node:fs";
262
65
  import { join as join3 } from "node:path";
263
66
  function installedDirectories(directory) {
264
67
  try {
265
- return readdirSync2(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
68
+ return readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
266
69
  } catch (cause) {
267
70
  if (cause instanceof Error && "code" in cause && (cause.code === "ENOENT" || cause.code === "ENOTDIR" || cause.code === "EACCES")) {
268
71
  return [];
@@ -293,9 +96,6 @@ function claudeDesktopExecutablePaths(roots, executablePaths) {
293
96
  // src/util/platform/macos.ts
294
97
  var macosPlatform = {
295
98
  ...posixOperations,
296
- readProcessTable: () => readProcessTableWithPs("/bin/ps"),
297
- readProcessTableSynchronously: () => [],
298
- processExists,
299
99
  claudeCodeExecutablePaths: (environment) => {
300
100
  const paths = ["/opt/homebrew/bin/claude", "/usr/local/bin/claude"];
301
101
  const homeDirectory = environment["HOME"];
@@ -313,23 +113,10 @@ var macosPlatform = {
313
113
  };
314
114
 
315
115
  // src/util/platform/windows.ts
316
- import { execFile as execFile2 } from "node:child_process";
317
- import { readFile as readFile2, realpath as realpath3 } from "node:fs/promises";
318
- import { dirname, extname, isAbsolute as isAbsolute3, join as join5, resolve } from "node:path";
116
+ import { execFile } from "node:child_process";
117
+ import { isAbsolute as isAbsolute3, join as join5 } from "node:path";
319
118
  import { promisify } from "node:util";
320
-
321
- // src/util/process/process-error.ts
322
- var ProcessExecutionError = class extends Error {
323
- code;
324
- constructor(code, message, options = {}) {
325
- super(message, options);
326
- this.code = code;
327
- this.name = "ProcessExecutionError";
328
- }
329
- };
330
-
331
- // src/util/platform/windows.ts
332
- var execute = promisify(execFile2);
119
+ var execute = promisify(execFile);
333
120
  function environmentValue(environment, name) {
334
121
  return Object.entries(environment).find(([key]) => key.toUpperCase() === name.toUpperCase())?.[1];
335
122
  }
@@ -350,97 +137,6 @@ function desktopClaudeExecutablePaths(environment) {
350
137
  }
351
138
  return claudeDesktopExecutablePaths(roots, [["claude.exe"]]);
352
139
  }
353
- function executableExtensions(executableName, environment) {
354
- if (/\.[a-zA-Z0-9]+$/.test(executableName)) {
355
- return [""];
356
- }
357
- const configured = environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD";
358
- const extensions = configured.split(";").map((extension) => extension.trim()).filter((extension) => extension.length > 0).map((extension) => extension.startsWith(".") ? extension : `.${extension}`);
359
- return extensions.length > 0 ? extensions : [".EXE"];
360
- }
361
- async function resolveExecutableTarget(path) {
362
- let resolvedPath;
363
- try {
364
- resolvedPath = await realpath3(extname(path) === "" ? `${path}.cmd` : path);
365
- } catch (cause) {
366
- if (extname(path) !== "" || !(cause instanceof Error) || !("code" in cause) || cause.code !== "ENOENT") {
367
- throw cause;
368
- }
369
- resolvedPath = await realpath3(path);
370
- }
371
- if (extname(resolvedPath).toLowerCase() === ".cmd") {
372
- const shim = await readFile2(resolvedPath, "utf8");
373
- if (shim.includes('SET "NPM_CLI_JS=%~dp0\\node_modules\\npm\\bin\\npm-cli.js"') && shim.includes('"%NODE_EXE%" "%NPM_CLI_JS%" %*')) {
374
- return await realpath3(resolve(dirname(resolvedPath), "node_modules/npm/bin/npm-cli.js"));
375
- }
376
- const script = /"%_prog%"\s+"%dp0%[\\/]([^"\r\n]+\.(?:js|mjs|cjs))"\s+%\*/iu.exec(shim)?.[1];
377
- if (script !== void 0 && shim.includes("SET dp0=%~dp0")) {
378
- resolvedPath = await realpath3(resolve(dirname(resolvedPath), script));
379
- } else {
380
- const pnpmScript = /^\s*node\s+"%~dp0[\\/]([^"\r\n]+\.(?:js|mjs|cjs))"\s+%\*\s*$/imu.exec(shim)?.[1];
381
- if (pnpmScript === void 0 || !shim.includes("@SETLOCAL")) {
382
- throw new ProcessExecutionError(
383
- "process_unsupported_script",
384
- "Use a native executable or a verified Node entrypoint"
385
- );
386
- }
387
- resolvedPath = await realpath3(resolve(dirname(resolvedPath), pnpmScript));
388
- }
389
- }
390
- return resolvedPath;
391
- }
392
- function executableLaunch(command, args) {
393
- if (/\.(?:js|mjs|cjs)$/iu.test(command)) {
394
- return { command: process.execPath, arguments: [command, ...args] };
395
- }
396
- if (/\.(?:cmd|bat)$/iu.test(command)) {
397
- throw new ProcessExecutionError(
398
- "process_unsupported_script",
399
- "Use a native executable or a verified Node entrypoint"
400
- );
401
- }
402
- return { command, arguments: args };
403
- }
404
- function readProcessTable() {
405
- const systemRoot = environmentValue(process.env, "SystemRoot");
406
- if (systemRoot === void 0) {
407
- return Promise.resolve([]);
408
- }
409
- return new Promise((resolveTable) => {
410
- execFile2(
411
- join5(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"),
412
- [
413
- "-NoLogo",
414
- "-NoProfile",
415
- "-NonInteractive",
416
- "-Command",
417
- "Get-CimInstance Win32_Process | ForEach-Object { '{0} {1} {0}' -f $_.ProcessId, $_.ParentProcessId }"
418
- ],
419
- {
420
- encoding: "utf8",
421
- windowsHide: true,
422
- timeout: 1e4,
423
- signal: AbortSignal.timeout(1e4),
424
- maxBuffer: 1024 * 1024
425
- },
426
- (error, stdout) => resolveTable(error === null ? parseProcessTable(stdout) : [])
427
- );
428
- });
429
- }
430
- function signalCapturedProcesses2(processes, _rootProcessId, signal) {
431
- for (const identity of [...processes].reverse()) {
432
- try {
433
- process.kill(identity.processId, signal);
434
- } catch {
435
- }
436
- }
437
- }
438
- function terminateProcess2(child, signal) {
439
- if (child.exitCode !== null || child.signalCode !== null || child.pid === void 0) {
440
- return;
441
- }
442
- child.kill(signal);
443
- }
444
140
  var windowsPermissions = `
445
141
  $ErrorActionPreference = 'Stop'
446
142
  $ProgressPreference = 'SilentlyContinue'
@@ -506,18 +202,7 @@ var windowsPlatform = {
506
202
  },
507
203
  removeControlSocket: async () => {
508
204
  },
509
- pathDelimiter: ";",
510
- environmentValue,
511
- executableExtensions,
512
- resolveExecutableTarget,
513
- executableLaunch,
514
- spawnOptions: { detached: false, windowsHide: true },
515
- signalCapturedProcesses: signalCapturedProcesses2,
516
- terminateProcess: terminateProcess2,
517
205
  validatePathPermissions,
518
- readProcessTable,
519
- readProcessTableSynchronously: () => [],
520
- processExists,
521
206
  claudeCodeExecutablePaths: (environment) => {
522
207
  const paths = [];
523
208
  const userProfile = environmentValue(environment, "USERPROFILE");
@@ -536,9 +221,6 @@ var windowsPlatform = {
536
221
  // src/util/platform/index.ts
537
222
  var fallbackPlatform = {
538
223
  ...posixOperations,
539
- readProcessTable: () => readProcessTableWithPs("/usr/bin/ps"),
540
- readProcessTableSynchronously: () => [],
541
- processExists,
542
224
  claudeCodeExecutablePaths: () => []
543
225
  };
544
226
  var platforms = /* @__PURE__ */ new Map([
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/util/filesystem/private-path.ts", "../../../src/util/platform/linux.ts", "../../../src/util/platform/posix.ts", "../../../src/util/filesystem/path-error.ts", "../../../src/util/platform/macos.ts", "../../../src/util/platform/claude-desktop.ts", "../../../src/util/platform/windows.ts", "../../../src/util/process/process-error.ts", "../../../src/util/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 { isAbsolute, 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 claudeCodeExecutablePaths: (environment) => {\n const homeDirectory = environment[\"HOME\"];\n return homeDirectory !== undefined && isAbsolute(homeDirectory)\n ? [join(homeDirectory, \".local\", \"bin\", \"claude\")]\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 { claudeDesktopExecutablePaths } from \"./claude-desktop.ts\";\nimport type { PlatformSupport } from \"./contracts.ts\";\nimport { posixOperations, processExists, readProcessTableWithPs } from \"./posix.ts\";\n\nexport const macosPlatform: PlatformSupport = {\n ...posixOperations,\n readProcessTable: () => readProcessTableWithPs(\"/bin/ps\"),\n readProcessTableSynchronously: () => [],\n processExists,\n claudeCodeExecutablePaths: (environment) => {\n const paths = [\"/opt/homebrew/bin/claude\", \"/usr/local/bin/claude\"];\n const homeDirectory = environment[\"HOME\"];\n if (homeDirectory !== undefined && isAbsolute(homeDirectory)) {\n paths.unshift(join(homeDirectory, \".local\", \"bin\", \"claude\"));\n paths.push(\n ...claudeDesktopExecutablePaths(\n [join(homeDirectory, \"Library\", \"Application Support\", \"Claude\", \"claude-code\")],\n [[\"claude.app\", \"Contents\", \"MacOS\", \"claude\"], [\"claude\"]],\n ),\n );\n }\n return paths;\n },\n};\n", "import { readdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport function installedDirectories(directory: string): readonly string[] {\n try {\n return readdirSync(directory, { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry) => entry.name);\n } catch (cause) {\n if (\n cause instanceof Error &&\n \"code\" in cause &&\n (cause.code === \"ENOENT\" || cause.code === \"ENOTDIR\" || cause.code === \"EACCES\")\n ) {\n return [];\n }\n throw cause;\n }\n}\n\nexport function claudeDesktopExecutablePaths(\n roots: readonly string[],\n executablePaths: readonly (readonly string[])[],\n): readonly string[] {\n const paths: string[] = [];\n for (const root of roots) {\n const versions = installedDirectories(root)\n .filter((version) => /^\\d+\\.\\d+\\.\\d+$/.test(version))\n .toSorted((left, right) => right.localeCompare(left, \"en\", { numeric: true }));\n for (const version of versions) {\n const directory = join(root, version);\n // Current Desktop builds use checksum directories; older versions install directly.\n const installations = [\n directory,\n ...installedDirectories(directory).map((build) => join(directory, build)),\n ];\n for (const installation of installations) {\n for (const executablePath of executablePaths) {\n paths.push(join(installation, ...executablePath));\n }\n }\n }\n }\n return paths;\n}\n", "import { type ChildProcess, execFile } from \"node:child_process\";\nimport { readFile, realpath } from \"node:fs/promises\";\nimport { dirname, extname, isAbsolute, 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 { claudeDesktopExecutablePaths, installedDirectories } from \"./claude-desktop.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 desktopClaudeExecutablePaths(environment: Readonly<NodeJS.ProcessEnv>): readonly string[] {\n const roots: string[] = [];\n const localAppData = environmentValue(environment, \"LOCALAPPDATA\");\n if (localAppData !== undefined && isAbsolute(localAppData)) {\n const dataDirectory = join(localAppData, \"Claude-Data\");\n for (const installation of installedDirectories(dataDirectory)) {\n if (installation.startsWith(\"claude_\")) {\n roots.push(join(dataDirectory, installation, \"claude-code\"));\n }\n }\n }\n const appData = environmentValue(environment, \"APPDATA\");\n if (appData !== undefined && isAbsolute(appData)) {\n roots.push(join(appData, \"Claude\", \"claude-code\"));\n }\n return claudeDesktopExecutablePaths(roots, [[\"claude.exe\"]]);\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 // Node's bundled npm uses its own shim format, not npm cmd-shim.\n if (\n shim.includes('SET \"NPM_CLI_JS=%~dp0\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js\"') &&\n shim.includes('\"%NODE_EXE%\" \"%NPM_CLI_JS%\" %*')\n ) {\n return await realpath(resolve(dirname(resolvedPath), \"node_modules/npm/bin/npm-cli.js\"));\n }\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'\n$ProgressPreference = 'SilentlyContinue'\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 = $item.GetAccessControl()\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 $item.SetAccessControl($private)\n}\n`;\n\n// Keep ACL validation bounded in case Windows filesystem operations stall.\nconst windowsPermissionsTimeoutMs = 30_000;\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(windowsPermissionsTimeoutMs)]),\n timeout: windowsPermissionsTimeoutMs,\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 claudeCodeExecutablePaths: (environment) => {\n const paths: string[] = [];\n const userProfile = environmentValue(environment, \"USERPROFILE\");\n if (userProfile !== undefined && isAbsolute(userProfile)) {\n paths.push(join(userProfile, \".local\", \"bin\", \"claude.exe\"));\n }\n const localAppData = environmentValue(environment, \"LOCALAPPDATA\");\n if (localAppData !== undefined && isAbsolute(localAppData)) {\n paths.push(join(localAppData, \"Microsoft\", \"WinGet\", \"Links\", \"claude.exe\"));\n }\n paths.push(...desktopClaudeExecutablePaths(environment));\n return paths;\n },\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 claudeCodeExecutablePaths: () => [],\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,YAAY,QAAAC,aAAY;;;ACFjC,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,O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;AAC/D,QAAI,gBAAgB,UAAaL,YAAW,WAAW,GAAG;AACtD,YAAM,KAAKC,MAAK,aAAa,UAAU,OAAO,YAAY,CAAC;AAAA,IAC/D;AACA,UAAM,eAAe,iBAAiB,aAAa,cAAc;AACjE,QAAI,iBAAiB,UAAaD,YAAW,YAAY,GAAG;AACxD,YAAM,KAAKC,MAAK,cAAc,aAAa,UAAU,SAAS,YAAY,CAAC;AAAA,IAC/E;AACA,UAAM,KAAK,GAAG,6BAA6B,WAAW,CAAC;AACvD,WAAO;AAAA,EACX;AACJ;;;AE7OA,IAAM,mBAAoC;AAAA,EACtC,GAAG;AAAA,EACH,kBAAkB,MAAM,uBAAuB,aAAa;AAAA,EAC5D,+BAA+B,MAAM,CAAC;AAAA,EACtC;AAAA,EACA,2BAA2B,MAAM,CAAC;AACtC;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;;;ARhBA,eAAsB,kBAClB,MACA,WACA,eACA,QACa;AACb,SAAO,eAAe;AACtB,QAAM,WAAW,MAAMK,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", "isAbsolute", "join", "readdirSync", "join", "isAbsolute", "join", "execFile", "readFile", "realpath", "isAbsolute", "join", "execFile", "isAbsolute", "join", "realpath", "readFile", "signalCapturedProcesses", "terminateProcess", "lstat"]
3
+ "sources": ["../../../src/util/filesystem/private-path.ts", "../../../src/util/platform/linux.ts", "../../../src/util/platform/posix.ts", "../../../src/util/filesystem/path-error.ts", "../../../src/util/platform/macos.ts", "../../../src/util/platform/claude-desktop.ts", "../../../src/util/platform/windows.ts", "../../../src/util/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 { isAbsolute, join } from \"node:path\";\nimport type { PlatformSupport } from \"./contracts.ts\";\nimport { posixOperations } from \"./posix.ts\";\n\nexport const linuxPlatform: PlatformSupport = {\n ...posixOperations,\n claudeCodeExecutablePaths: (environment) => {\n const homeDirectory = environment[\"HOME\"];\n return homeDirectory !== undefined && isAbsolute(homeDirectory)\n ? [join(homeDirectory, \".local\", \"bin\", \"claude\")]\n : [];\n },\n};\n", "import { chmod, lstat, 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 } from \"./contracts.ts\";\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 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 | \"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 { claudeDesktopExecutablePaths } from \"./claude-desktop.ts\";\nimport type { PlatformSupport } from \"./contracts.ts\";\nimport { posixOperations } from \"./posix.ts\";\n\nexport const macosPlatform: PlatformSupport = {\n ...posixOperations,\n claudeCodeExecutablePaths: (environment) => {\n const paths = [\"/opt/homebrew/bin/claude\", \"/usr/local/bin/claude\"];\n const homeDirectory = environment[\"HOME\"];\n if (homeDirectory !== undefined && isAbsolute(homeDirectory)) {\n paths.unshift(join(homeDirectory, \".local\", \"bin\", \"claude\"));\n paths.push(\n ...claudeDesktopExecutablePaths(\n [join(homeDirectory, \"Library\", \"Application Support\", \"Claude\", \"claude-code\")],\n [[\"claude.app\", \"Contents\", \"MacOS\", \"claude\"], [\"claude\"]],\n ),\n );\n }\n return paths;\n },\n};\n", "import { readdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport function installedDirectories(directory: string): readonly string[] {\n try {\n return readdirSync(directory, { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry) => entry.name);\n } catch (cause) {\n if (\n cause instanceof Error &&\n \"code\" in cause &&\n (cause.code === \"ENOENT\" || cause.code === \"ENOTDIR\" || cause.code === \"EACCES\")\n ) {\n return [];\n }\n throw cause;\n }\n}\n\nexport function claudeDesktopExecutablePaths(\n roots: readonly string[],\n executablePaths: readonly (readonly string[])[],\n): readonly string[] {\n const paths: string[] = [];\n for (const root of roots) {\n const versions = installedDirectories(root)\n .filter((version) => /^\\d+\\.\\d+\\.\\d+$/.test(version))\n .toSorted((left, right) => right.localeCompare(left, \"en\", { numeric: true }));\n for (const version of versions) {\n const directory = join(root, version);\n // Current Desktop builds use checksum directories; older versions install directly.\n const installations = [\n directory,\n ...installedDirectories(directory).map((build) => join(directory, build)),\n ];\n for (const installation of installations) {\n for (const executablePath of executablePaths) {\n paths.push(join(installation, ...executablePath));\n }\n }\n }\n }\n return paths;\n}\n", "import { execFile } from \"node:child_process\";\nimport { isAbsolute, join } from \"node:path\";\nimport { promisify } from \"node:util\";\nimport { LocalPathError } from \"../filesystem/path-error.ts\";\nimport { claudeDesktopExecutablePaths, installedDirectories } from \"./claude-desktop.ts\";\nimport type { PlatformSupport } from \"./contracts.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 desktopClaudeExecutablePaths(environment: Readonly<NodeJS.ProcessEnv>): readonly string[] {\n const roots: string[] = [];\n const localAppData = environmentValue(environment, \"LOCALAPPDATA\");\n if (localAppData !== undefined && isAbsolute(localAppData)) {\n const dataDirectory = join(localAppData, \"Claude-Data\");\n for (const installation of installedDirectories(dataDirectory)) {\n if (installation.startsWith(\"claude_\")) {\n roots.push(join(dataDirectory, installation, \"claude-code\"));\n }\n }\n }\n const appData = environmentValue(environment, \"APPDATA\");\n if (appData !== undefined && isAbsolute(appData)) {\n roots.push(join(appData, \"Claude\", \"claude-code\"));\n }\n return claudeDesktopExecutablePaths(roots, [[\"claude.exe\"]]);\n}\n\n// The path is data in the environment, never interpolated into PowerShell source.\nconst windowsPermissions = `\n$ErrorActionPreference = 'Stop'\n$ProgressPreference = 'SilentlyContinue'\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 = $item.GetAccessControl()\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 $item.SetAccessControl($private)\n}\n`;\n\n// Keep ACL validation bounded in case Windows filesystem operations stall.\nconst windowsPermissionsTimeoutMs = 30_000;\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(windowsPermissionsTimeoutMs)]),\n timeout: windowsPermissionsTimeoutMs,\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 validatePathPermissions,\n claudeCodeExecutablePaths: (environment) => {\n const paths: string[] = [];\n const userProfile = environmentValue(environment, \"USERPROFILE\");\n if (userProfile !== undefined && isAbsolute(userProfile)) {\n paths.push(join(userProfile, \".local\", \"bin\", \"claude.exe\"));\n }\n const localAppData = environmentValue(environment, \"LOCALAPPDATA\");\n if (localAppData !== undefined && isAbsolute(localAppData)) {\n paths.push(join(localAppData, \"Microsoft\", \"WinGet\", \"Links\", \"claude.exe\"));\n }\n paths.push(...desktopClaudeExecutablePaths(environment));\n return paths;\n },\n};\n", "import type { PlatformSupport } from \"./contracts.ts\";\nimport { linuxPlatform } from \"./linux.ts\";\nimport { macosPlatform } from \"./macos.ts\";\nimport { posixOperations } from \"./posix.ts\";\nimport { windowsPlatform } from \"./windows.ts\";\n\n// Preserve the existing fallback for other POSIX hosts.\nconst fallbackPlatform: PlatformSupport = {\n ...posixOperations,\n claudeCodeExecutablePaths: () => [],\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,YAAY,QAAAC,aAAY;;;ACA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AaD,YAAW,YAAY,GAAG;AACxD,YAAM,KAAKC,MAAK,cAAc,aAAa,UAAU,SAAS,YAAY,CAAC;AAAA,IAC/E;AACA,UAAM,KAAK,GAAG,6BAA6B,WAAW,CAAC;AACvD,WAAO;AAAA,EACX;AACJ;;;AC9GA,IAAM,mBAAoC;AAAA,EACtC,GAAG;AAAA,EACH,2BAA2B,MAAM,CAAC;AACtC;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;;;APbA,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", "join", "join", "isAbsolute", "join", "join", "isAbsolute", "join", "isAbsolute", "join", "isAbsolute", "join", "lstat"]
7
7
  }
@@ -1,35 +1,9 @@
1
- import type { ChildProcess } from "node:child_process";
2
- export interface ProcessTreeIdentity {
3
- readonly processGroupId: number;
4
- readonly processId: number;
5
- }
6
- export interface ProcessTableEntry extends ProcessTreeIdentity {
7
- readonly parentProcessId: number;
8
- }
9
- export interface ProcessLaunch {
10
- readonly command: string;
11
- readonly arguments: readonly string[];
12
- }
13
1
  export interface PlatformSupport {
14
2
  readonly controlSocketPath: (installationHash: string) => string;
15
3
  readonly prepareControlSocket: (path: string) => Promise<void>;
16
4
  readonly secureControlSocket: (path: string) => Promise<void>;
17
5
  readonly removeControlSocket: (path: string) => Promise<void>;
18
- readonly pathDelimiter: string;
19
- readonly environmentValue: (environment: Readonly<NodeJS.ProcessEnv>, name: string) => string | undefined;
20
- readonly executableExtensions: (name: string, environment: Readonly<NodeJS.ProcessEnv>) => readonly string[];
21
- readonly resolveExecutableTarget: (path: string) => Promise<string>;
22
- readonly executableLaunch: (command: string, args: readonly string[]) => ProcessLaunch;
23
- readonly spawnOptions: {
24
- readonly detached: boolean;
25
- readonly windowsHide: boolean;
26
- };
27
- readonly signalCapturedProcesses: (processes: readonly ProcessTreeIdentity[], rootProcessId: number, signal: number) => void;
28
- readonly terminateProcess: (child: ChildProcess, signal: NodeJS.Signals) => void;
29
6
  readonly validatePathPermissions: (path: string, directory: boolean, privateAccess: boolean, signal: AbortSignal) => Promise<void>;
30
- readonly readProcessTable: () => Promise<readonly ProcessTableEntry[]>;
31
- readonly readProcessTableSynchronously: () => readonly ProcessTableEntry[];
32
- readonly processExists: (processId: number) => boolean;
33
7
  readonly claudeCodeExecutablePaths: (environment: Readonly<NodeJS.ProcessEnv>) => readonly string[];
34
8
  }
35
9
  //# sourceMappingURL=contracts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../src/util/platform/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB;IAC1D,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAED,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC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,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,SAAS,MAAM,EAAE,CAAC;CACvG"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/util/platform/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAoBtD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,eAAe,CAE7E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/util/platform/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAiBtD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,eAAe,CAE7E"}
@@ -1,13 +1,10 @@
1
1
  import { linuxPlatform } from "./linux.js";
2
2
  import { macosPlatform } from "./macos.js";
3
- import { posixOperations, processExists, readProcessTableWithPs } from "./posix.js";
3
+ import { posixOperations } from "./posix.js";
4
4
  import { windowsPlatform } from "./windows.js";
5
5
  // Preserve the existing fallback for other POSIX hosts.
6
6
  const fallbackPlatform = {
7
7
  ...posixOperations,
8
- readProcessTable: () => readProcessTableWithPs("/usr/bin/ps"),
9
- readProcessTableSynchronously: () => [],
10
- processExists,
11
8
  claudeCodeExecutablePaths: () => [],
12
9
  };
13
10
  const platforms = new Map([
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/util/platform/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,wDAAwD;AACxD,MAAM,gBAAgB,GAAoB;IACtC,GAAG,eAAe;IAClB,gBAAgB,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,aAAa,CAAC;IAC7D,6BAA6B,EAAE,GAAG,EAAE,CAAC,EAAE;IACvC,aAAa;IACb,yBAAyB,EAAE,GAAG,EAAE,CAAC,EAAE;CACtC,CAAC;AACF,MAAM,SAAS,GAAkD,IAAI,GAAG,CAAC;IACrE,CAAC,OAAO,EAAE,aAAa,CAAC;IACxB,CAAC,QAAQ,EAAE,aAAa,CAAC;IACzB,CAAC,OAAO,EAAE,eAAe,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,UAAU,kBAAkB,CAAC,QAAyB;IACxD,OAAO,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC;AACvD,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/util/platform/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,wDAAwD;AACxD,MAAM,gBAAgB,GAAoB;IACtC,GAAG,eAAe;IAClB,yBAAyB,EAAE,GAAG,EAAE,CAAC,EAAE;CACtC,CAAC;AACF,MAAM,SAAS,GAAkD,IAAI,GAAG,CAAC;IACrE,CAAC,OAAO,EAAE,aAAa,CAAC;IACxB,CAAC,QAAQ,EAAE,aAAa,CAAC;IACzB,CAAC,OAAO,EAAE,eAAe,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,UAAU,kBAAkB,CAAC,QAAyB;IACxD,OAAO,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC;AACvD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"linux.d.ts","sourceRoot":"","sources":["../../../src/util/platform/linux.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,gBAAgB,CAAC;AA2HzE,eAAO,MAAM,aAAa,EAAE,eAW3B,CAAC"}
1
+ {"version":3,"file":"linux.d.ts","sourceRoot":"","sources":["../../../src/util/platform/linux.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,eAAO,MAAM,aAAa,EAAE,eAQ3B,CAAC"}