@moxt-ai/mobius 0.0.335 → 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 (81) hide show
  1. package/dist/cli.js +709 -475
  2. package/dist/cli.js.map +4 -4
  3. package/dist/daemon/control/protocol.d.ts +2 -0
  4. package/dist/daemon/control/protocol.d.ts.map +1 -1
  5. package/dist/daemon/control/protocol.js +25 -0
  6. package/dist/daemon/control/protocol.js.map +1 -1
  7. package/dist/daemon/control/switch-status.d.ts.map +1 -1
  8. package/dist/daemon/control/switch-status.js +3 -3
  9. package/dist/daemon/control/switch-status.js.map +1 -1
  10. package/dist/daemon/lifecycle/manager-client.d.ts.map +1 -1
  11. package/dist/daemon/lifecycle/manager-client.js +12 -12
  12. package/dist/daemon/lifecycle/manager-client.js.map +1 -1
  13. package/dist/daemon/lifecycle/manager.d.ts.map +1 -1
  14. package/dist/daemon/lifecycle/manager.js +4 -9
  15. package/dist/daemon/lifecycle/manager.js.map +1 -1
  16. package/dist/daemon/upgrades/upgrade.d.ts.map +1 -1
  17. package/dist/daemon/upgrades/upgrade.js +4 -4
  18. package/dist/daemon/upgrades/upgrade.js.map +1 -1
  19. package/dist/runtime/relay/run-relay-connection.d.ts.map +1 -1
  20. package/dist/runtime/relay/run-relay-connection.js +5 -57
  21. package/dist/runtime/relay/run-relay-connection.js.map +1 -1
  22. package/dist/runtime.js +585 -402
  23. package/dist/runtime.js.map +4 -4
  24. package/dist/session/live/session-configurations.d.ts.map +1 -1
  25. package/dist/session/live/session-configurations.js +8 -1
  26. package/dist/session/live/session-configurations.js.map +1 -1
  27. package/dist/session/turn/execution-receipts.d.ts.map +1 -1
  28. package/dist/session/turn/execution-receipts.js +6 -3
  29. package/dist/session/turn/execution-receipts.js.map +1 -1
  30. package/dist/storage/session/execution-receipt-table.d.ts.map +1 -1
  31. package/dist/storage/session/execution-receipt-table.js +5 -2
  32. package/dist/storage/session/execution-receipt-table.js.map +1 -1
  33. package/dist/util/filesystem/private-path.js +6 -324
  34. package/dist/util/filesystem/private-path.js.map +4 -4
  35. package/dist/util/platform/contracts.d.ts +0 -26
  36. package/dist/util/platform/contracts.d.ts.map +1 -1
  37. package/dist/util/platform/index.d.ts.map +1 -1
  38. package/dist/util/platform/index.js +1 -4
  39. package/dist/util/platform/index.js.map +1 -1
  40. package/dist/util/platform/linux.d.ts.map +1 -1
  41. package/dist/util/platform/linux.js +1 -117
  42. package/dist/util/platform/linux.js.map +1 -1
  43. package/dist/util/platform/macos.d.ts.map +1 -1
  44. package/dist/util/platform/macos.js +1 -4
  45. package/dist/util/platform/macos.js.map +1 -1
  46. package/dist/util/platform/posix.d.ts +0 -21
  47. package/dist/util/platform/posix.d.ts.map +1 -1
  48. package/dist/util/platform/posix.js +1 -104
  49. package/dist/util/platform/posix.js.map +1 -1
  50. package/dist/util/platform/windows.d.ts.map +1 -1
  51. package/dist/util/platform/windows.js +1 -107
  52. package/dist/util/platform/windows.js.map +1 -1
  53. package/dist/util/process/executable.d.ts +2 -2
  54. package/dist/util/process/executable.d.ts.map +1 -1
  55. package/dist/util/process/executable.js +31 -222
  56. package/dist/util/process/executable.js.map +4 -4
  57. package/dist/util/process/platform/contracts.d.ts +29 -0
  58. package/dist/util/process/platform/contracts.d.ts.map +1 -0
  59. package/dist/util/process/platform/contracts.js +2 -0
  60. package/dist/util/process/platform/contracts.js.map +1 -0
  61. package/dist/util/process/platform/index.d.ts +3 -0
  62. package/dist/util/process/platform/index.d.ts.map +1 -0
  63. package/dist/util/process/platform/index.js +20 -0
  64. package/dist/util/process/platform/index.js.map +1 -0
  65. package/dist/util/process/platform/linux.d.ts +3 -0
  66. package/dist/util/process/platform/linux.d.ts.map +1 -0
  67. package/dist/util/process/platform/linux.js +122 -0
  68. package/dist/util/process/platform/linux.js.map +1 -0
  69. package/dist/util/process/platform/macos.d.ts +3 -0
  70. package/dist/util/process/platform/macos.d.ts.map +1 -0
  71. package/dist/util/process/platform/macos.js +8 -0
  72. package/dist/util/process/platform/macos.js.map +1 -0
  73. package/dist/util/process/platform/posix.d.ts +25 -0
  74. package/dist/util/process/platform/posix.d.ts.map +1 -0
  75. package/dist/util/process/platform/posix.js +107 -0
  76. package/dist/util/process/platform/posix.js.map +1 -0
  77. package/dist/util/process/platform/windows.d.ts +3 -0
  78. package/dist/util/process/platform/windows.d.ts.map +1 -0
  79. package/dist/util/process/platform/windows.js +114 -0
  80. package/dist/util/process/platform/windows.js.map +1 -0
  81. package/package.json +2 -2
@@ -1,11 +1,8 @@
1
1
  import { execFile } from "node:child_process";
2
- import { readFile, realpath } from "node:fs/promises";
3
- import { dirname, extname, isAbsolute, join, resolve } from "node:path";
2
+ import { isAbsolute, join } from "node:path";
4
3
  import { promisify } from "node:util";
5
4
  import { LocalPathError } from "../filesystem/path-error.js";
6
- import { ProcessExecutionError } from "../process/process-error.js";
7
5
  import { claudeDesktopExecutablePaths, installedDirectories } from "./claude-desktop.js";
8
- import { parseProcessTable, processExists } from "./posix.js";
9
6
  const execute = promisify(execFile);
10
7
  function environmentValue(environment, name) {
11
8
  return Object.entries(environment).find(([key]) => key.toUpperCase() === name.toUpperCase())?.[1];
@@ -27,98 +24,6 @@ function desktopClaudeExecutablePaths(environment) {
27
24
  }
28
25
  return claudeDesktopExecutablePaths(roots, [["claude.exe"]]);
29
26
  }
30
- function executableExtensions(executableName, environment) {
31
- if (/\.[a-zA-Z0-9]+$/.test(executableName)) {
32
- return [""];
33
- }
34
- const configured = environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD";
35
- const extensions = configured
36
- .split(";")
37
- .map((extension) => extension.trim())
38
- .filter((extension) => extension.length > 0)
39
- .map((extension) => (extension.startsWith(".") ? extension : `.${extension}`));
40
- return extensions.length > 0 ? extensions : [".EXE"];
41
- }
42
- async function resolveExecutableTarget(path) {
43
- let resolvedPath;
44
- try {
45
- resolvedPath = await realpath(extname(path) === "" ? `${path}.cmd` : path);
46
- }
47
- catch (cause) {
48
- if (extname(path) !== "" || !(cause instanceof Error) || !("code" in cause) || cause.code !== "ENOENT") {
49
- throw cause;
50
- }
51
- resolvedPath = await realpath(path);
52
- }
53
- if (extname(resolvedPath).toLowerCase() === ".cmd") {
54
- // npm cmd-shim entrypoints are Node scripts. Resolve the script instead of
55
- // handing untrusted arguments to cmd.exe's command language.
56
- const shim = await readFile(resolvedPath, "utf8");
57
- // Node's bundled npm uses its own shim format, not npm cmd-shim.
58
- if (shim.includes('SET "NPM_CLI_JS=%~dp0\\node_modules\\npm\\bin\\npm-cli.js"') &&
59
- shim.includes('"%NODE_EXE%" "%NPM_CLI_JS%" %*')) {
60
- return await realpath(resolve(dirname(resolvedPath), "node_modules/npm/bin/npm-cli.js"));
61
- }
62
- const script = /"%_prog%"\s+"%dp0%[\\/]([^"\r\n]+\.(?:js|mjs|cjs))"\s+%\*/iu.exec(shim)?.[1];
63
- if (script !== undefined && shim.includes("SET dp0=%~dp0")) {
64
- resolvedPath = await realpath(resolve(dirname(resolvedPath), script));
65
- }
66
- else {
67
- const pnpmScript = /^\s*node\s+"%~dp0[\\/]([^"\r\n]+\.(?:js|mjs|cjs))"\s+%\*\s*$/imu.exec(shim)?.[1];
68
- if (pnpmScript === undefined || !shim.includes("@SETLOCAL")) {
69
- throw new ProcessExecutionError("process_unsupported_script", "Use a native executable or a verified Node entrypoint");
70
- }
71
- resolvedPath = await realpath(resolve(dirname(resolvedPath), pnpmScript));
72
- }
73
- }
74
- return resolvedPath;
75
- }
76
- function executableLaunch(command, args) {
77
- if (/\.(?:js|mjs|cjs)$/iu.test(command)) {
78
- return { command: process.execPath, arguments: [command, ...args] };
79
- }
80
- if (/\.(?:cmd|bat)$/iu.test(command)) {
81
- throw new ProcessExecutionError("process_unsupported_script", "Use a native executable or a verified Node entrypoint");
82
- }
83
- return { command, arguments: args };
84
- }
85
- function readProcessTable() {
86
- const systemRoot = environmentValue(process.env, "SystemRoot");
87
- if (systemRoot === undefined) {
88
- return Promise.resolve([]);
89
- }
90
- return new Promise((resolveTable) => {
91
- execFile(join(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"), [
92
- "-NoLogo",
93
- "-NoProfile",
94
- "-NonInteractive",
95
- "-Command",
96
- "Get-CimInstance Win32_Process | ForEach-Object { '{0} {1} {0}' -f $_.ProcessId, $_.ParentProcessId }",
97
- ], {
98
- encoding: "utf8",
99
- windowsHide: true,
100
- timeout: 10000,
101
- signal: AbortSignal.timeout(10000),
102
- maxBuffer: 1024 * 1024,
103
- }, (error, stdout) => resolveTable(error === null ? parseProcessTable(stdout) : []));
104
- });
105
- }
106
- function signalCapturedProcesses(processes, _rootProcessId, signal) {
107
- for (const identity of [...processes].reverse()) {
108
- try {
109
- process.kill(identity.processId, signal);
110
- }
111
- catch {
112
- // A concurrently exited process no longer needs cleanup.
113
- }
114
- }
115
- }
116
- function terminateProcess(child, signal) {
117
- if (child.exitCode !== null || child.signalCode !== null || child.pid === undefined) {
118
- return;
119
- }
120
- child.kill(signal);
121
- }
122
27
  // The path is data in the environment, never interpolated into PowerShell source.
123
28
  const windowsPermissions = `
124
29
  $ErrorActionPreference = 'Stop'
@@ -180,18 +85,7 @@ export const windowsPlatform = {
180
85
  prepareControlSocket: async () => { },
181
86
  secureControlSocket: async () => { },
182
87
  removeControlSocket: async () => { },
183
- pathDelimiter: ";",
184
- environmentValue,
185
- executableExtensions,
186
- resolveExecutableTarget,
187
- executableLaunch,
188
- spawnOptions: { detached: false, windowsHide: true },
189
- signalCapturedProcesses,
190
- terminateProcess,
191
88
  validatePathPermissions,
192
- readProcessTable,
193
- readProcessTableSynchronously: () => [],
194
- processExists,
195
89
  claudeCodeExecutablePaths: (environment) => {
196
90
  const paths = [];
197
91
  const userProfile = environmentValue(environment, "USERPROFILE");
@@ -1 +1 @@
1
- {"version":3,"file":"windows.js","sourceRoot":"","sources":["../../../src/util/platform/windows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,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;QACxB,MAAM,IAAI,cAAc,CAAC,iDAAiD,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3F,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAoB;IAC5C,iBAAiB,EAAE,CAAC,gBAAgB,EAAE,EAAE,CAAC,uBAAuB,gBAAgB,EAAE;IAClF,oBAAoB,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;IACpC,mBAAmB,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;IACnC,mBAAmB,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;IACnC,uBAAuB;IACvB,yBAAyB,EAAE,CAAC,WAAW,EAAE,EAAE;QACvC,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,MAAM,WAAW,GAAG,gBAAgB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;QACjE,IAAI,WAAW,KAAK,SAAS,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YACvD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC;QACjE,CAAC;QACD,MAAM,YAAY,GAAG,gBAAgB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QACnE,IAAI,YAAY,KAAK,SAAS,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YACzD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;QACjF,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,GAAG,4BAA4B,CAAC,WAAW,CAAC,CAAC,CAAC;QACzD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { spawn } from "node:child_process";
2
- import type { ProcessLaunch, ProcessTreeIdentity } from "../platform/contracts.ts";
3
- export type { ProcessTreeIdentity } from "../platform/contracts.ts";
2
+ import type { ProcessLaunch, ProcessTreeIdentity } from "./platform/contracts.ts";
3
+ export type { ProcessTreeIdentity } from "./platform/contracts.ts";
4
4
  export { ProcessExecutionError } from "./process-error.ts";
5
5
  export declare class ExecutableIdentity {
6
6
  readonly changedAtMilliseconds: number;
@@ -1 +1 @@
1
- {"version":3,"file":"executable.d.ts","sourceRoot":"","sources":["../../../src/util/process/executable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,OAAO,KAAK,EAAE,aAAa,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAKtG,YAAY,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAW3D,qBAAa,kBAAkB;IAC3B,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,YACI,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,qBAAqB,EAAE,MAAM,EAQhC;IAED,QAAQ,CAAC,OAAO,cAAe,kBAAkB,KAAG,OAAO,CAMQ;CACtE;AAED,qBAAa,kBAAkB;IAC3B,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,YAAY,QAAQ,EAAE,kBAAkB,EAGvC;CACJ;AAED,qBAAa,aAAa;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC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EAAO,GACvD,OAAO,CAAC,IAAI,CAAC,CA4Bf;AA0BD,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC,CAgI1F;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,aAAa,CAExF;AAED,eAAO,MAAM,oBAAoB;;;CAA4B,CAAC"}
@@ -1,30 +1,17 @@
1
1
  // src/util/process/executable.ts
2
2
  import { spawn } from "node:child_process";
3
3
  import { stat as stat2 } from "node:fs/promises";
4
- import { join as join6, resolve as resolve2 } from "node:path";
4
+ import { join as join3, resolve as resolve2 } from "node:path";
5
5
 
6
- // src/util/platform/linux.ts
6
+ // src/util/process/platform/linux.ts
7
7
  import { constants as constants2, readdirSync, readFileSync } from "node:fs";
8
8
  import { access as access2, readdir, readFile, realpath as realpath2, stat } from "node:fs/promises";
9
- import { isAbsolute, join as join2 } from "node:path";
9
+ import { join } from "node:path";
10
10
 
11
- // src/util/platform/posix.ts
11
+ // src/util/process/platform/posix.ts
12
12
  import { execFile } from "node:child_process";
13
13
  import { constants } from "node:fs";
14
- import { access, chmod, lstat, realpath, unlink } from "node:fs/promises";
15
- import { tmpdir } from "node:os";
16
- import { join } from "node:path";
17
-
18
- // src/util/filesystem/path-error.ts
19
- var LocalPathError = class extends Error {
20
- code = "unsafe_local_path";
21
- constructor(message, options = {}) {
22
- super(message, options);
23
- this.name = "LocalPathError";
24
- }
25
- };
26
-
27
- // src/util/platform/posix.ts
14
+ import { access, realpath } from "node:fs/promises";
28
15
  var PROCESS_TABLE_TIMEOUT_MILLISECONDS = 1e3;
29
16
  var PROCESS_TABLE_OUTPUT_LIMIT_BYTES = 1024 * 1024;
30
17
  function parseProcessTable(output) {
@@ -104,22 +91,7 @@ function terminateProcess(child, signal) {
104
91
  }
105
92
  child.kill(signal);
106
93
  }
107
- async function removeControlSocket(path) {
108
- try {
109
- await unlink(path);
110
- } catch (cause) {
111
- if (!(cause instanceof Error) || !("code" in cause) || cause.code !== "ENOENT") {
112
- throw cause;
113
- }
114
- }
115
- }
116
94
  var posixOperations = {
117
- controlSocketPath: (installationHash) => join(tmpdir(), `mobius-${installationHash}.sock`),
118
- prepareControlSocket: removeControlSocket,
119
- secureControlSocket: async (path) => {
120
- await chmod(path, 384);
121
- },
122
- removeControlSocket,
123
95
  pathDelimiter: ":",
124
96
  environmentValue: (environment, name) => environment[name],
125
97
  executableExtensions: () => [""],
@@ -131,21 +103,10 @@ var posixOperations = {
131
103
  executableLaunch: (command, args) => ({ command, arguments: args }),
132
104
  spawnOptions: { detached: true, windowsHide: true },
133
105
  signalCapturedProcesses,
134
- terminateProcess,
135
- validatePathPermissions: async (path, directory, privateAccess, signal) => {
136
- signal.throwIfAborted();
137
- const metadata = await lstat(path);
138
- if (process.getuid === void 0 || metadata.uid !== process.getuid()) {
139
- throw new LocalPathError("Path is not user-owned");
140
- }
141
- if (privateAccess) {
142
- await chmod(path, directory ? 448 : 384);
143
- }
144
- signal.throwIfAborted();
145
- }
106
+ terminateProcess
146
107
  };
147
108
 
148
- // src/util/platform/linux.ts
109
+ // src/util/process/platform/linux.ts
149
110
  function appendLinuxProcessTableEntry(entries, processId, encoded) {
150
111
  const closingParenthesis = encoded.lastIndexOf(")");
151
112
  if (!encoded.startsWith(`${processId.toString()} (`) || closingParenthesis < 0) {
@@ -175,7 +136,7 @@ async function readLinuxProcessTable() {
175
136
  appendLinuxProcessTableEntry(
176
137
  entries,
177
138
  processId,
178
- await readFile(join2("/proc", directory.name, "stat"), "utf8")
139
+ await readFile(join("/proc", directory.name, "stat"), "utf8")
179
140
  );
180
141
  } catch {
181
142
  }
@@ -200,7 +161,7 @@ function readLinuxProcessTableSynchronously() {
200
161
  appendLinuxProcessTableEntry(
201
162
  entries,
202
163
  processId,
203
- readFileSync(join2("/proc", directory.name, "stat"), "utf8")
164
+ readFileSync(join("/proc", directory.name, "stat"), "utf8")
204
165
  );
205
166
  } catch {
206
167
  }
@@ -233,7 +194,7 @@ async function readLinuxProcessTableWithFallback() {
233
194
  }
234
195
  function processExists2(processId) {
235
196
  try {
236
- const encoded = readFileSync(join2("/proc", processId.toString(), "stat"), "utf8");
197
+ const encoded = readFileSync(join("/proc", processId.toString(), "stat"), "utf8");
237
198
  const closingParenthesis = encoded.lastIndexOf(")");
238
199
  if (closingParenthesis >= 0) {
239
200
  const processState = encoded.slice(closingParenthesis + 1).trimStart().charAt(0);
@@ -245,80 +206,25 @@ function processExists2(processId) {
245
206
  }
246
207
  return processExists(processId);
247
208
  }
248
- var linuxPlatform = {
209
+ var linuxProcessPlatform = {
249
210
  ...posixOperations,
250
211
  readProcessTable: readLinuxProcessTableWithFallback,
251
212
  readProcessTableSynchronously: readLinuxProcessTableSynchronously,
252
- processExists: processExists2,
253
- claudeCodeExecutablePaths: (environment) => {
254
- const homeDirectory = environment["HOME"];
255
- return homeDirectory !== void 0 && isAbsolute(homeDirectory) ? [join2(homeDirectory, ".local", "bin", "claude")] : [];
256
- }
213
+ processExists: processExists2
257
214
  };
258
215
 
259
- // src/util/platform/macos.ts
260
- import { isAbsolute as isAbsolute2, join as join4 } from "node:path";
261
-
262
- // src/util/platform/claude-desktop.ts
263
- import { readdirSync as readdirSync2 } from "node:fs";
264
- import { join as join3 } from "node:path";
265
- function installedDirectories(directory) {
266
- try {
267
- return readdirSync2(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
268
- } catch (cause) {
269
- if (cause instanceof Error && "code" in cause && (cause.code === "ENOENT" || cause.code === "ENOTDIR" || cause.code === "EACCES")) {
270
- return [];
271
- }
272
- throw cause;
273
- }
274
- }
275
- function claudeDesktopExecutablePaths(roots, executablePaths) {
276
- const paths = [];
277
- for (const root of roots) {
278
- const versions = installedDirectories(root).filter((version) => /^\d+\.\d+\.\d+$/.test(version)).toSorted((left, right) => right.localeCompare(left, "en", { numeric: true }));
279
- for (const version of versions) {
280
- const directory = join3(root, version);
281
- const installations = [
282
- directory,
283
- ...installedDirectories(directory).map((build) => join3(directory, build))
284
- ];
285
- for (const installation of installations) {
286
- for (const executablePath of executablePaths) {
287
- paths.push(join3(installation, ...executablePath));
288
- }
289
- }
290
- }
291
- }
292
- return paths;
293
- }
294
-
295
- // src/util/platform/macos.ts
296
- var macosPlatform = {
216
+ // src/util/process/platform/macos.ts
217
+ var macosProcessPlatform = {
297
218
  ...posixOperations,
298
219
  readProcessTable: () => readProcessTableWithPs("/bin/ps"),
299
220
  readProcessTableSynchronously: () => [],
300
- processExists,
301
- claudeCodeExecutablePaths: (environment) => {
302
- const paths = ["/opt/homebrew/bin/claude", "/usr/local/bin/claude"];
303
- const homeDirectory = environment["HOME"];
304
- if (homeDirectory !== void 0 && isAbsolute2(homeDirectory)) {
305
- paths.unshift(join4(homeDirectory, ".local", "bin", "claude"));
306
- paths.push(
307
- ...claudeDesktopExecutablePaths(
308
- [join4(homeDirectory, "Library", "Application Support", "Claude", "claude-code")],
309
- [["claude.app", "Contents", "MacOS", "claude"], ["claude"]]
310
- )
311
- );
312
- }
313
- return paths;
314
- }
221
+ processExists
315
222
  };
316
223
 
317
- // src/util/platform/windows.ts
224
+ // src/util/process/platform/windows.ts
318
225
  import { execFile as execFile2 } from "node:child_process";
319
226
  import { readFile as readFile2, realpath as realpath3 } from "node:fs/promises";
320
- import { dirname, extname, isAbsolute as isAbsolute3, join as join5, resolve } from "node:path";
321
- import { promisify } from "node:util";
227
+ import { dirname, extname, join as join2, resolve } from "node:path";
322
228
 
323
229
  // src/util/process/process-error.ts
324
230
  var ProcessExecutionError = class extends Error {
@@ -330,28 +236,10 @@ var ProcessExecutionError = class extends Error {
330
236
  }
331
237
  };
332
238
 
333
- // src/util/platform/windows.ts
334
- var execute = promisify(execFile2);
239
+ // src/util/process/platform/windows.ts
335
240
  function environmentValue(environment, name) {
336
241
  return Object.entries(environment).find(([key]) => key.toUpperCase() === name.toUpperCase())?.[1];
337
242
  }
338
- function desktopClaudeExecutablePaths(environment) {
339
- const roots = [];
340
- const localAppData = environmentValue(environment, "LOCALAPPDATA");
341
- if (localAppData !== void 0 && isAbsolute3(localAppData)) {
342
- const dataDirectory = join5(localAppData, "Claude-Data");
343
- for (const installation of installedDirectories(dataDirectory)) {
344
- if (installation.startsWith("claude_")) {
345
- roots.push(join5(dataDirectory, installation, "claude-code"));
346
- }
347
- }
348
- }
349
- const appData = environmentValue(environment, "APPDATA");
350
- if (appData !== void 0 && isAbsolute3(appData)) {
351
- roots.push(join5(appData, "Claude", "claude-code"));
352
- }
353
- return claudeDesktopExecutablePaths(roots, [["claude.exe"]]);
354
- }
355
243
  function executableExtensions(executableName, environment) {
356
244
  if (/\.[a-zA-Z0-9]+$/.test(executableName)) {
357
245
  return [""];
@@ -410,7 +298,7 @@ function readProcessTable() {
410
298
  }
411
299
  return new Promise((resolveTable) => {
412
300
  execFile2(
413
- join5(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"),
301
+ join2(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"),
414
302
  [
415
303
  "-NoLogo",
416
304
  "-NoProfile",
@@ -443,71 +331,7 @@ function terminateProcess2(child, signal) {
443
331
  }
444
332
  child.kill(signal);
445
333
  }
446
- var windowsPermissions = `
447
- $ErrorActionPreference = 'Stop'
448
- $ProgressPreference = 'SilentlyContinue'
449
- $item = Get-Item -LiteralPath $env:MOBIUS_PERMISSION_PATH -Force
450
- if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'Unsafe path' }
451
- $sid = [Security.Principal.WindowsIdentity]::GetCurrent().User
452
- $acl = $item.GetAccessControl()
453
- $owner = $acl.GetOwner([Security.Principal.SecurityIdentifier])
454
- 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' }
455
- if ($env:MOBIUS_PERMISSION_PRIVATE -eq '1') {
456
- if ($item.PSIsContainer) {
457
- $private = New-Object Security.AccessControl.DirectorySecurity
458
- $rule = New-Object Security.AccessControl.FileSystemAccessRule($sid, 'FullControl', 'ContainerInherit,ObjectInherit', 'None', 'Allow')
459
- } else {
460
- $private = New-Object Security.AccessControl.FileSecurity
461
- $rule = New-Object Security.AccessControl.FileSystemAccessRule($sid, 'FullControl', 'Allow')
462
- }
463
- $private.SetOwner($sid)
464
- $private.SetAccessRuleProtection($true, $false)
465
- $private.AddAccessRule($rule)
466
- $item.SetAccessControl($private)
467
- }
468
- `;
469
- var windowsPermissionsTimeoutMs = 3e4;
470
- async function validatePathPermissions(path, _directory, privateAccess, signal) {
471
- signal.throwIfAborted();
472
- const systemRoot = environmentValue(process.env, "SystemRoot");
473
- if (systemRoot === void 0) {
474
- throw new LocalPathError("Windows system directory is unavailable");
475
- }
476
- try {
477
- await execute(
478
- join5(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"),
479
- [
480
- "-NoLogo",
481
- "-NoProfile",
482
- "-NonInteractive",
483
- "-EncodedCommand",
484
- Buffer.from(windowsPermissions, "utf16le").toString("base64")
485
- ],
486
- {
487
- env: {
488
- ...process.env,
489
- MOBIUS_PERMISSION_PATH: path,
490
- MOBIUS_PERMISSION_PRIVATE: privateAccess ? "1" : "0"
491
- },
492
- windowsHide: true,
493
- signal: AbortSignal.any([signal, AbortSignal.timeout(windowsPermissionsTimeoutMs)]),
494
- timeout: windowsPermissionsTimeoutMs,
495
- maxBuffer: 16384
496
- }
497
- );
498
- } catch (cause) {
499
- signal.throwIfAborted();
500
- throw new LocalPathError("The local path permissions could not be secured", { cause });
501
- }
502
- }
503
- var windowsPlatform = {
504
- controlSocketPath: (installationHash) => `\\\\.\\pipe\\mobius-${installationHash}`,
505
- prepareControlSocket: async () => {
506
- },
507
- secureControlSocket: async () => {
508
- },
509
- removeControlSocket: async () => {
510
- },
334
+ var windowsProcessPlatform = {
511
335
  pathDelimiter: ";",
512
336
  environmentValue,
513
337
  executableExtensions,
@@ -516,44 +340,29 @@ var windowsPlatform = {
516
340
  spawnOptions: { detached: false, windowsHide: true },
517
341
  signalCapturedProcesses: signalCapturedProcesses2,
518
342
  terminateProcess: terminateProcess2,
519
- validatePathPermissions,
520
343
  readProcessTable,
521
344
  readProcessTableSynchronously: () => [],
522
- processExists,
523
- claudeCodeExecutablePaths: (environment) => {
524
- const paths = [];
525
- const userProfile = environmentValue(environment, "USERPROFILE");
526
- if (userProfile !== void 0 && isAbsolute3(userProfile)) {
527
- paths.push(join5(userProfile, ".local", "bin", "claude.exe"));
528
- }
529
- const localAppData = environmentValue(environment, "LOCALAPPDATA");
530
- if (localAppData !== void 0 && isAbsolute3(localAppData)) {
531
- paths.push(join5(localAppData, "Microsoft", "WinGet", "Links", "claude.exe"));
532
- }
533
- paths.push(...desktopClaudeExecutablePaths(environment));
534
- return paths;
535
- }
345
+ processExists
536
346
  };
537
347
 
538
- // src/util/platform/index.ts
348
+ // src/util/process/platform/index.ts
539
349
  var fallbackPlatform = {
540
350
  ...posixOperations,
541
351
  readProcessTable: () => readProcessTableWithPs("/usr/bin/ps"),
542
352
  readProcessTableSynchronously: () => [],
543
- processExists,
544
- claudeCodeExecutablePaths: () => []
353
+ processExists
545
354
  };
546
355
  var platforms = /* @__PURE__ */ new Map([
547
- ["linux", linuxPlatform],
548
- ["darwin", macosPlatform],
549
- ["win32", windowsPlatform]
356
+ ["linux", linuxProcessPlatform],
357
+ ["darwin", macosProcessPlatform],
358
+ ["win32", windowsProcessPlatform]
550
359
  ]);
551
- function platformSupportFor(platform) {
360
+ function processPlatformSupportFor(platform) {
552
361
  return platforms.get(platform) ?? fallbackPlatform;
553
362
  }
554
363
 
555
364
  // src/util/process/executable.ts
556
- var hostPlatform = platformSupportFor(process.platform);
365
+ var hostPlatform = processPlatformSupportFor(process.platform);
557
366
  var DEFAULT_OUTPUT_LIMIT_BYTES = 16 * 1024;
558
367
  var PROCESS_GRACEFUL_STOP_TIMEOUT_MILLISECONDS = 1e3;
559
368
  var PROCESS_FORCED_STOP_TIMEOUT_MILLISECONDS = 5e3;
@@ -596,7 +405,7 @@ var ProcessResult = class {
596
405
  async function resolveExecutablePath(requestedPath, platform = process.platform) {
597
406
  const absoluteRequestedPath = resolve2(requestedPath);
598
407
  try {
599
- const resolvedPath = await platformSupportFor(platform).resolveExecutableTarget(absoluteRequestedPath);
408
+ const resolvedPath = await processPlatformSupportFor(platform).resolveExecutableTarget(absoluteRequestedPath);
600
409
  const metadata = await stat2(resolvedPath);
601
410
  if (!metadata.isFile()) {
602
411
  return null;
@@ -616,7 +425,7 @@ async function resolveExecutablePath(requestedPath, platform = process.platform)
616
425
  }
617
426
  }
618
427
  async function findExecutableOnPath(executableName, environment, platform = process.platform) {
619
- const support = platformSupportFor(platform);
428
+ const support = processPlatformSupportFor(platform);
620
429
  const encodedPath = support.environmentValue(environment, "PATH") ?? "";
621
430
  const separator = support.pathDelimiter;
622
431
  const extensions = support.executableExtensions(executableName, environment);
@@ -625,7 +434,7 @@ async function findExecutableOnPath(executableName, environment, platform = proc
625
434
  continue;
626
435
  }
627
436
  for (const extension of extensions) {
628
- const requestedPath = resolve2(join6(entry, `${executableName}${extension}`));
437
+ const requestedPath = resolve2(join3(entry, `${executableName}${extension}`));
629
438
  const executable = await resolveExecutablePath(requestedPath, platform);
630
439
  if (executable !== null) {
631
440
  return executable;