@moxt-ai/mobius 0.0.195 → 0.0.196

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 (60) hide show
  1. package/dist/acp/agent-connection.d.ts.map +1 -1
  2. package/dist/acp/agent-connection.js +4 -3
  3. package/dist/acp/agent-connection.js.map +1 -1
  4. package/dist/acp/codex/app-server-client.d.ts.map +1 -1
  5. package/dist/acp/codex/app-server-client.js +4 -2
  6. package/dist/acp/codex/app-server-client.js.map +1 -1
  7. package/dist/agent-catalog/acp-readiness-probe.d.ts.map +1 -1
  8. package/dist/agent-catalog/acp-readiness-probe.js +4 -3
  9. package/dist/agent-catalog/acp-readiness-probe.js.map +1 -1
  10. package/dist/cli.js +526 -290
  11. package/dist/cli.js.map +4 -4
  12. package/dist/daemon-manager.d.ts.map +1 -1
  13. package/dist/daemon-manager.js +7 -17
  14. package/dist/daemon-manager.js.map +1 -1
  15. package/dist/filesystem/path-error.d.ts +5 -0
  16. package/dist/filesystem/path-error.d.ts.map +1 -0
  17. package/dist/filesystem/path-error.js +8 -0
  18. package/dist/filesystem/path-error.js.map +1 -0
  19. package/dist/filesystem/private-path.d.ts +3 -0
  20. package/dist/filesystem/private-path.d.ts.map +1 -0
  21. package/dist/filesystem/private-path.js +550 -0
  22. package/dist/filesystem/private-path.js.map +7 -0
  23. package/dist/index.js +498 -253
  24. package/dist/index.js.map +4 -4
  25. package/dist/native-sessions/codex-history.d.ts.map +1 -1
  26. package/dist/native-sessions/codex-history.js +4 -3
  27. package/dist/native-sessions/codex-history.js.map +1 -1
  28. package/dist/platform/contracts.d.ts +21 -0
  29. package/dist/platform/contracts.d.ts.map +1 -1
  30. package/dist/platform/index.d.ts.map +1 -1
  31. package/dist/platform/index.js +5 -3
  32. package/dist/platform/index.js.map +1 -1
  33. package/dist/platform/linux.d.ts.map +1 -1
  34. package/dist/platform/linux.js +2 -1
  35. package/dist/platform/linux.js.map +1 -1
  36. package/dist/platform/macos.d.ts.map +1 -1
  37. package/dist/platform/macos.js +2 -1
  38. package/dist/platform/macos.js.map +1 -1
  39. package/dist/platform/posix.d.ts +28 -1
  40. package/dist/platform/posix.d.ts.map +1 -1
  41. package/dist/platform/posix.js +91 -1
  42. package/dist/platform/posix.js.map +1 -1
  43. package/dist/platform/windows.d.ts +3 -0
  44. package/dist/platform/windows.d.ts.map +1 -0
  45. package/dist/platform/windows.js +174 -0
  46. package/dist/platform/windows.js.map +1 -0
  47. package/dist/process/executable.d.ts +7 -5
  48. package/dist/process/executable.d.ts.map +1 -1
  49. package/dist/process/executable.js +844 -386
  50. package/dist/process/executable.js.map +7 -1
  51. package/dist/process/process-error.d.ts +5 -0
  52. package/dist/process/process-error.d.ts.map +1 -0
  53. package/dist/process/process-error.js +9 -0
  54. package/dist/process/process-error.js.map +1 -0
  55. package/dist/runtime.js +498 -253
  56. package/dist/runtime.js.map +4 -4
  57. package/dist/storage/runtime-installation-store.d.ts.map +1 -1
  58. package/dist/storage/runtime-installation-store.js +3 -0
  59. package/dist/storage/runtime-installation-store.js.map +1 -1
  60. package/package.json +72 -70
package/dist/runtime.js CHANGED
@@ -5,8 +5,8 @@ var __export = (target, all) => {
5
5
  };
6
6
 
7
7
  // src/runtime.ts
8
- import { mkdir as mkdir7, realpath as realpath12, stat as stat11 } from "node:fs/promises";
9
- import { resolve as resolve8 } from "node:path";
8
+ import { mkdir as mkdir7, realpath as realpath13, stat as stat11 } from "node:fs/promises";
9
+ import { resolve as resolve9 } from "node:path";
10
10
 
11
11
  // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/external.js
12
12
  var external_exports = {};
@@ -5034,7 +5034,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
5034
5034
  var NONE = 0;
5035
5035
  var ASSUMED = 1;
5036
5036
  var PROVEN = 2;
5037
- function isRecursive(inst, stack, resolve9) {
5037
+ function isRecursive(inst, stack, resolve10) {
5038
5038
  const cached2 = recursive.get(inst);
5039
5039
  if (cached2 !== void 0)
5040
5040
  return cached2 ? PROVEN : NONE;
@@ -5044,7 +5044,7 @@ function isRecursive(inst, stack, resolve9) {
5044
5044
  let result = NONE;
5045
5045
  const check2 = (child2) => {
5046
5046
  if (result !== PROVEN && child2?._zod) {
5047
- const answer = isRecursive(child2, stack, resolve9);
5047
+ const answer = isRecursive(child2, stack, resolve10);
5048
5048
  if (answer > result)
5049
5049
  result = answer;
5050
5050
  }
@@ -5055,7 +5055,7 @@ function isRecursive(inst, stack, resolve9) {
5055
5055
  const desc2 = Object.getOwnPropertyDescriptor(sh, key);
5056
5056
  if (spread && !desc2.enumerable)
5057
5057
  continue;
5058
- const child2 = desc2.get ? ASSUMED : desc2.value?._zod ? isRecursive(desc2.value, stack, resolve9) : NONE;
5058
+ const child2 = desc2.get ? ASSUMED : desc2.value?._zod ? isRecursive(desc2.value, stack, resolve10) : NONE;
5059
5059
  if (child2 > answer)
5060
5060
  answer = child2;
5061
5061
  }
@@ -5119,7 +5119,7 @@ function isRecursive(inst, stack, resolve9) {
5119
5119
  break;
5120
5120
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
5121
5121
  case "lazy": {
5122
- const inner = def._cachedInner ?? (resolve9 ? inst._zod.innerType : void 0);
5122
+ const inner = def._cachedInner ?? (resolve10 ? inst._zod.innerType : void 0);
5123
5123
  merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
5124
5124
  break;
5125
5125
  }
@@ -21804,17 +21804,31 @@ function normalizeAcpCapabilities(initialized) {
21804
21804
 
21805
21805
  // src/process/executable.ts
21806
21806
  import { spawn } from "node:child_process";
21807
- import { constants as constants2 } from "node:fs";
21808
- import { access as access2, realpath as realpath2, stat as stat2 } from "node:fs/promises";
21809
- import { join as join3, resolve } from "node:path";
21807
+ import { stat as stat2 } from "node:fs/promises";
21808
+ import { join as join5, resolve as resolve2 } from "node:path";
21810
21809
 
21811
21810
  // src/platform/linux.ts
21812
- import { constants, readdirSync, readFileSync } from "node:fs";
21813
- import { access, readdir, readFile, realpath, stat } from "node:fs/promises";
21814
- import { join } from "node:path";
21811
+ import { constants as constants2, readdirSync, readFileSync } from "node:fs";
21812
+ import { access as access2, readdir, readFile, realpath as realpath2, stat } from "node:fs/promises";
21813
+ import { join as join2 } from "node:path";
21815
21814
 
21816
21815
  // src/platform/posix.ts
21817
21816
  import { execFile } from "node:child_process";
21817
+ import { constants } from "node:fs";
21818
+ import { access, chmod, lstat, realpath, unlink } from "node:fs/promises";
21819
+ import { tmpdir } from "node:os";
21820
+ import { join } from "node:path";
21821
+
21822
+ // src/filesystem/path-error.ts
21823
+ var LocalPathError = class extends Error {
21824
+ code = "unsafe_local_path";
21825
+ constructor(message, options = {}) {
21826
+ super(message, options);
21827
+ this.name = "LocalPathError";
21828
+ }
21829
+ };
21830
+
21831
+ // src/platform/posix.ts
21818
21832
  var PROCESS_TABLE_TIMEOUT_MILLISECONDS = 1e3;
21819
21833
  var PROCESS_TABLE_OUTPUT_LIMIT_BYTES = 1024 * 1024;
21820
21834
  function parseProcessTable(output2) {
@@ -21859,6 +21873,81 @@ function processExists(processId) {
21859
21873
  return false;
21860
21874
  }
21861
21875
  }
21876
+ function signalCapturedProcesses(processes, rootProcessId, signal) {
21877
+ const processIds = new Set(processes.map((identity2) => identity2.processId));
21878
+ const signalledGroups = /* @__PURE__ */ new Set();
21879
+ for (const identity2 of processes) {
21880
+ const isRootProcessGroup = identity2.processGroupId === rootProcessId;
21881
+ if (!isRootProcessGroup && !processIds.has(identity2.processGroupId) || signalledGroups.has(identity2.processGroupId)) {
21882
+ continue;
21883
+ }
21884
+ try {
21885
+ process.kill(-identity2.processGroupId, signal);
21886
+ signalledGroups.add(identity2.processGroupId);
21887
+ } catch {
21888
+ }
21889
+ }
21890
+ for (const identity2 of processes) {
21891
+ if (identity2.processId === rootProcessId || identity2.processGroupId === rootProcessId || signalledGroups.has(identity2.processGroupId)) {
21892
+ continue;
21893
+ }
21894
+ try {
21895
+ process.kill(identity2.processId, signal);
21896
+ } catch {
21897
+ }
21898
+ }
21899
+ }
21900
+ function terminateProcess(child2, signal) {
21901
+ if (child2.exitCode !== null || child2.signalCode !== null || child2.pid === void 0) {
21902
+ return;
21903
+ }
21904
+ try {
21905
+ process.kill(-child2.pid, signal);
21906
+ return;
21907
+ } catch {
21908
+ }
21909
+ child2.kill(signal);
21910
+ }
21911
+ async function removeControlSocket(path2) {
21912
+ try {
21913
+ await unlink(path2);
21914
+ } catch (cause) {
21915
+ if (!(cause instanceof Error) || !("code" in cause) || cause.code !== "ENOENT") {
21916
+ throw cause;
21917
+ }
21918
+ }
21919
+ }
21920
+ var posixOperations = {
21921
+ controlSocketPath: (installationHash) => join(tmpdir(), `mobius-${installationHash}.sock`),
21922
+ prepareControlSocket: removeControlSocket,
21923
+ secureControlSocket: async (path2) => {
21924
+ await chmod(path2, 384);
21925
+ },
21926
+ removeControlSocket,
21927
+ pathDelimiter: ":",
21928
+ environmentValue: (environment, name2) => environment[name2],
21929
+ executableExtensions: () => [""],
21930
+ resolveExecutableTarget: async (path2) => {
21931
+ const target = await realpath(path2);
21932
+ await access(target, constants.X_OK);
21933
+ return target;
21934
+ },
21935
+ executableLaunch: (command, args) => ({ command, arguments: args }),
21936
+ spawnOptions: { detached: true, windowsHide: true },
21937
+ signalCapturedProcesses,
21938
+ terminateProcess,
21939
+ validatePathPermissions: async (path2, directory, privateAccess, signal) => {
21940
+ signal.throwIfAborted();
21941
+ const metadata = await lstat(path2);
21942
+ if (process.getuid === void 0 || metadata.uid !== process.getuid()) {
21943
+ throw new LocalPathError("Path is not user-owned");
21944
+ }
21945
+ if (privateAccess) {
21946
+ await chmod(path2, directory ? 448 : 384);
21947
+ }
21948
+ signal.throwIfAborted();
21949
+ }
21950
+ };
21862
21951
 
21863
21952
  // src/platform/linux.ts
21864
21953
  function appendLinuxProcessTableEntry(entries, processId, encoded) {
@@ -21890,7 +21979,7 @@ async function readLinuxProcessTable() {
21890
21979
  appendLinuxProcessTableEntry(
21891
21980
  entries,
21892
21981
  processId,
21893
- await readFile(join("/proc", directory.name, "stat"), "utf8")
21982
+ await readFile(join2("/proc", directory.name, "stat"), "utf8")
21894
21983
  );
21895
21984
  } catch {
21896
21985
  }
@@ -21915,7 +22004,7 @@ function readLinuxProcessTableSynchronously() {
21915
22004
  appendLinuxProcessTableEntry(
21916
22005
  entries,
21917
22006
  processId,
21918
- readFileSync(join("/proc", directory.name, "stat"), "utf8")
22007
+ readFileSync(join2("/proc", directory.name, "stat"), "utf8")
21919
22008
  );
21920
22009
  } catch {
21921
22010
  }
@@ -21931,11 +22020,11 @@ async function readLinuxProcessTableWithFallback() {
21931
22020
  }
21932
22021
  for (const candidate of ["/usr/bin/ps", "/bin/ps", "/run/current-system/sw/bin/ps"]) {
21933
22022
  try {
21934
- const resolvedPath = await realpath(candidate);
22023
+ const resolvedPath = await realpath2(candidate);
21935
22024
  if (!(await stat(resolvedPath)).isFile()) {
21936
22025
  continue;
21937
22026
  }
21938
- await access(resolvedPath, constants.X_OK);
22027
+ await access2(resolvedPath, constants2.X_OK);
21939
22028
  } catch {
21940
22029
  continue;
21941
22030
  }
@@ -21948,7 +22037,7 @@ async function readLinuxProcessTableWithFallback() {
21948
22037
  }
21949
22038
  function processExists2(processId) {
21950
22039
  try {
21951
- const encoded = readFileSync(join("/proc", processId.toString(), "stat"), "utf8");
22040
+ const encoded = readFileSync(join2("/proc", processId.toString(), "stat"), "utf8");
21952
22041
  const closingParenthesis = encoded.lastIndexOf(")");
21953
22042
  if (closingParenthesis >= 0) {
21954
22043
  const processState = encoded.slice(closingParenthesis + 1).trimStart().charAt(0);
@@ -21961,6 +22050,7 @@ function processExists2(processId) {
21961
22050
  return processExists(processId);
21962
22051
  }
21963
22052
  var linuxPlatform = {
22053
+ ...posixOperations,
21964
22054
  readProcessTable: readLinuxProcessTableWithFallback,
21965
22055
  readProcessTableSynchronously: readLinuxProcessTableSynchronously,
21966
22056
  processExists: processExists2,
@@ -21992,7 +22082,7 @@ var linuxPlatform = {
21992
22082
  };
21993
22083
 
21994
22084
  // src/platform/macos.ts
21995
- import { isAbsolute, join as join2 } from "node:path";
22085
+ import { isAbsolute, join as join3 } from "node:path";
21996
22086
  var WORKBUDDY_MACOS_EXECUTABLE_PATH = Object.freeze([
21997
22087
  "WorkBuddy.app",
21998
22088
  "Contents",
@@ -22003,14 +22093,15 @@ var WORKBUDDY_MACOS_EXECUTABLE_PATH = Object.freeze([
22003
22093
  "codebuddy"
22004
22094
  ]);
22005
22095
  var macosPlatform = {
22096
+ ...posixOperations,
22006
22097
  readProcessTable: () => readProcessTableWithPs("/bin/ps"),
22007
22098
  readProcessTableSynchronously: () => [],
22008
22099
  processExists,
22009
22100
  workBuddyExecutablePaths: (environment) => {
22010
- const paths = [join2("/Applications", ...WORKBUDDY_MACOS_EXECUTABLE_PATH)];
22101
+ const paths = [join3("/Applications", ...WORKBUDDY_MACOS_EXECUTABLE_PATH)];
22011
22102
  const homeDirectory = environment["HOME"];
22012
22103
  if (homeDirectory !== void 0 && isAbsolute(homeDirectory)) {
22013
- paths.unshift(join2(homeDirectory, "Applications", ...WORKBUDDY_MACOS_EXECUTABLE_PATH));
22104
+ paths.unshift(join3(homeDirectory, "Applications", ...WORKBUDDY_MACOS_EXECUTABLE_PATH));
22014
22105
  }
22015
22106
  return paths;
22016
22107
  },
@@ -22040,8 +22131,199 @@ var macosPlatform = {
22040
22131
  }
22041
22132
  };
22042
22133
 
22134
+ // src/platform/windows.ts
22135
+ import { execFile as execFile2 } from "node:child_process";
22136
+ import { readFile as readFile2, realpath as realpath3 } from "node:fs/promises";
22137
+ import { dirname, extname, join as join4, resolve } from "node:path";
22138
+ import { promisify } from "node:util";
22139
+
22140
+ // src/process/process-error.ts
22141
+ var ProcessExecutionError = class extends Error {
22142
+ code;
22143
+ constructor(code, message, options = {}) {
22144
+ super(message, options);
22145
+ this.code = code;
22146
+ this.name = "ProcessExecutionError";
22147
+ }
22148
+ };
22149
+
22150
+ // src/platform/windows.ts
22151
+ var execute = promisify(execFile2);
22152
+ function environmentValue(environment, name2) {
22153
+ return Object.entries(environment).find(([key]) => key.toUpperCase() === name2.toUpperCase())?.[1];
22154
+ }
22155
+ function executableExtensions(executableName, environment) {
22156
+ if (/\.[a-zA-Z0-9]+$/.test(executableName)) {
22157
+ return [""];
22158
+ }
22159
+ const configured = environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD";
22160
+ const extensions = configured.split(";").map((extension) => extension.trim()).filter((extension) => extension.length > 0).map((extension) => extension.startsWith(".") ? extension : `.${extension}`);
22161
+ return extensions.length > 0 ? extensions : [".EXE"];
22162
+ }
22163
+ async function resolveExecutableTarget(path2) {
22164
+ let resolvedPath;
22165
+ try {
22166
+ resolvedPath = await realpath3(extname(path2) === "" ? `${path2}.cmd` : path2);
22167
+ } catch (cause) {
22168
+ if (extname(path2) !== "" || !(cause instanceof Error) || !("code" in cause) || cause.code !== "ENOENT") {
22169
+ throw cause;
22170
+ }
22171
+ resolvedPath = await realpath3(path2);
22172
+ }
22173
+ if (extname(resolvedPath).toLowerCase() === ".cmd") {
22174
+ const shim = await readFile2(resolvedPath, "utf8");
22175
+ const script = /"%_prog%"\s+"%dp0%[\\/]([^"\r\n]+\.(?:js|mjs|cjs))"\s+%\*/iu.exec(shim)?.[1];
22176
+ if (script !== void 0 && shim.includes("SET dp0=%~dp0")) {
22177
+ resolvedPath = await realpath3(resolve(dirname(resolvedPath), script));
22178
+ } else {
22179
+ const pnpmScript = /^\s*node\s+"%~dp0[\\/]([^"\r\n]+\.(?:js|mjs|cjs))"\s+%\*\s*$/imu.exec(shim)?.[1];
22180
+ if (pnpmScript === void 0 || !shim.includes("@SETLOCAL")) {
22181
+ throw new ProcessExecutionError(
22182
+ "process_unsupported_script",
22183
+ "Use a native executable or a verified Node entrypoint"
22184
+ );
22185
+ }
22186
+ resolvedPath = await realpath3(resolve(dirname(resolvedPath), pnpmScript));
22187
+ }
22188
+ }
22189
+ return resolvedPath;
22190
+ }
22191
+ function executableLaunch(command, args) {
22192
+ if (/\.(?:js|mjs|cjs)$/iu.test(command)) {
22193
+ return { command: process.execPath, arguments: [command, ...args] };
22194
+ }
22195
+ if (/\.(?:cmd|bat)$/iu.test(command)) {
22196
+ throw new ProcessExecutionError(
22197
+ "process_unsupported_script",
22198
+ "Use a native executable or a verified Node entrypoint"
22199
+ );
22200
+ }
22201
+ return { command, arguments: args };
22202
+ }
22203
+ function readProcessTable() {
22204
+ const systemRoot = environmentValue(process.env, "SystemRoot");
22205
+ if (systemRoot === void 0) {
22206
+ return Promise.resolve([]);
22207
+ }
22208
+ return new Promise((resolveTable) => {
22209
+ execFile2(
22210
+ join4(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"),
22211
+ [
22212
+ "-NoLogo",
22213
+ "-NoProfile",
22214
+ "-NonInteractive",
22215
+ "-Command",
22216
+ "Get-CimInstance Win32_Process | ForEach-Object { '{0} {1} {0}' -f $_.ProcessId, $_.ParentProcessId }"
22217
+ ],
22218
+ {
22219
+ encoding: "utf8",
22220
+ windowsHide: true,
22221
+ timeout: 1e4,
22222
+ signal: AbortSignal.timeout(1e4),
22223
+ maxBuffer: 1024 * 1024
22224
+ },
22225
+ (error62, stdout) => resolveTable(error62 === null ? parseProcessTable(stdout) : [])
22226
+ );
22227
+ });
22228
+ }
22229
+ function signalCapturedProcesses2(processes, _rootProcessId, signal) {
22230
+ for (const identity2 of [...processes].reverse()) {
22231
+ try {
22232
+ process.kill(identity2.processId, signal);
22233
+ } catch {
22234
+ }
22235
+ }
22236
+ }
22237
+ function terminateProcess2(child2, signal) {
22238
+ if (child2.exitCode !== null || child2.signalCode !== null || child2.pid === void 0) {
22239
+ return;
22240
+ }
22241
+ child2.kill(signal);
22242
+ }
22243
+ var windowsPermissions = `
22244
+ $ErrorActionPreference = 'Stop'
22245
+ Import-Module (Join-Path $PSHOME 'Modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1')
22246
+ $item = Get-Item -LiteralPath $env:MOBIUS_PERMISSION_PATH -Force
22247
+ if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'Unsafe path' }
22248
+ $sid = [Security.Principal.WindowsIdentity]::GetCurrent().User
22249
+ $acl = Get-Acl -LiteralPath $item.FullName
22250
+ $owner = $acl.GetOwner([Security.Principal.SecurityIdentifier])
22251
+ 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' }
22252
+ if ($env:MOBIUS_PERMISSION_PRIVATE -eq '1') {
22253
+ if ($item.PSIsContainer) {
22254
+ $private = New-Object Security.AccessControl.DirectorySecurity
22255
+ $rule = New-Object Security.AccessControl.FileSystemAccessRule($sid, 'FullControl', 'ContainerInherit,ObjectInherit', 'None', 'Allow')
22256
+ } else {
22257
+ $private = New-Object Security.AccessControl.FileSecurity
22258
+ $rule = New-Object Security.AccessControl.FileSystemAccessRule($sid, 'FullControl', 'Allow')
22259
+ }
22260
+ $private.SetOwner($sid)
22261
+ $private.SetAccessRuleProtection($true, $false)
22262
+ $private.AddAccessRule($rule)
22263
+ Set-Acl -LiteralPath $item.FullName -AclObject $private
22264
+ }
22265
+ `;
22266
+ async function validatePathPermissions(path2, _directory, privateAccess, signal) {
22267
+ signal.throwIfAborted();
22268
+ const systemRoot = environmentValue(process.env, "SystemRoot");
22269
+ if (systemRoot === void 0) {
22270
+ throw new LocalPathError("Windows system directory is unavailable");
22271
+ }
22272
+ try {
22273
+ await execute(
22274
+ join4(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"),
22275
+ [
22276
+ "-NoLogo",
22277
+ "-NoProfile",
22278
+ "-NonInteractive",
22279
+ "-EncodedCommand",
22280
+ Buffer.from(windowsPermissions, "utf16le").toString("base64")
22281
+ ],
22282
+ {
22283
+ env: {
22284
+ ...process.env,
22285
+ MOBIUS_PERMISSION_PATH: path2,
22286
+ MOBIUS_PERMISSION_PRIVATE: privateAccess ? "1" : "0"
22287
+ },
22288
+ windowsHide: true,
22289
+ signal: AbortSignal.any([signal, AbortSignal.timeout(1e4)]),
22290
+ timeout: 1e4,
22291
+ maxBuffer: 16384
22292
+ }
22293
+ );
22294
+ } catch (cause) {
22295
+ signal.throwIfAborted();
22296
+ throw new LocalPathError("The local path permissions could not be secured", { cause });
22297
+ }
22298
+ }
22299
+ var windowsPlatform = {
22300
+ controlSocketPath: (installationHash) => `\\\\.\\pipe\\mobius-${installationHash}`,
22301
+ prepareControlSocket: async () => {
22302
+ },
22303
+ secureControlSocket: async () => {
22304
+ },
22305
+ removeControlSocket: async () => {
22306
+ },
22307
+ pathDelimiter: ";",
22308
+ environmentValue,
22309
+ executableExtensions,
22310
+ resolveExecutableTarget,
22311
+ executableLaunch,
22312
+ spawnOptions: { detached: false, windowsHide: true },
22313
+ signalCapturedProcesses: signalCapturedProcesses2,
22314
+ terminateProcess: terminateProcess2,
22315
+ validatePathPermissions,
22316
+ readProcessTable,
22317
+ readProcessTableSynchronously: () => [],
22318
+ processExists,
22319
+ workBuddyExecutablePaths: () => [],
22320
+ openCodeArchives: {},
22321
+ grokDependencies: {}
22322
+ };
22323
+
22043
22324
  // src/platform/index.ts
22044
22325
  var fallbackPlatform = {
22326
+ ...posixOperations,
22045
22327
  readProcessTable: () => readProcessTableWithPs("/usr/bin/ps"),
22046
22328
  readProcessTableSynchronously: () => [],
22047
22329
  processExists,
@@ -22052,7 +22334,7 @@ var fallbackPlatform = {
22052
22334
  var platforms = /* @__PURE__ */ new Map([
22053
22335
  ["linux", linuxPlatform],
22054
22336
  ["darwin", macosPlatform],
22055
- ["win32", { ...fallbackPlatform, readProcessTable: () => Promise.resolve([]) }]
22337
+ ["win32", windowsPlatform]
22056
22338
  ]);
22057
22339
  function platformSupportFor(platform) {
22058
22340
  return platforms.get(platform) ?? fallbackPlatform;
@@ -22091,14 +22373,6 @@ var ResolvedExecutable = class {
22091
22373
  this.path = identity2.realPath;
22092
22374
  }
22093
22375
  };
22094
- var ProcessExecutionError = class extends Error {
22095
- code;
22096
- constructor(code, message, options = {}) {
22097
- super(message, options);
22098
- this.code = code;
22099
- this.name = "ProcessExecutionError";
22100
- }
22101
- };
22102
22376
  var ProcessResult = class {
22103
22377
  stderr;
22104
22378
  stdout;
@@ -22107,28 +22381,14 @@ var ProcessResult = class {
22107
22381
  this.stdout = stdout;
22108
22382
  }
22109
22383
  };
22110
- function executableExtensions(executableName, environment, platform) {
22111
- if (platform !== "win32") {
22112
- return [""];
22113
- }
22114
- if (/\.[a-zA-Z0-9]+$/.test(executableName)) {
22115
- return [""];
22116
- }
22117
- const configured = environment["PATHEXT"] ?? ".COM;.EXE;.BAT;.CMD";
22118
- const extensions = configured.split(";").map((extension) => extension.trim()).filter((extension) => extension.length > 0).map((extension) => extension.startsWith(".") ? extension : `.${extension}`);
22119
- return extensions.length > 0 ? extensions : [".EXE"];
22120
- }
22121
22384
  async function resolveExecutablePath(requestedPath2, platform = process.platform) {
22122
- const absoluteRequestedPath = resolve(requestedPath2);
22385
+ const absoluteRequestedPath = resolve2(requestedPath2);
22123
22386
  try {
22124
- const resolvedPath = await realpath2(absoluteRequestedPath);
22387
+ const resolvedPath = await platformSupportFor(platform).resolveExecutableTarget(absoluteRequestedPath);
22125
22388
  const metadata = await stat2(resolvedPath);
22126
22389
  if (!metadata.isFile()) {
22127
22390
  return null;
22128
22391
  }
22129
- if (platform !== "win32") {
22130
- await access2(resolvedPath, constants2.X_OK);
22131
- }
22132
22392
  return new ResolvedExecutable(
22133
22393
  new ExecutableIdentity(
22134
22394
  absoluteRequestedPath,
@@ -22144,15 +22404,16 @@ async function resolveExecutablePath(requestedPath2, platform = process.platform
22144
22404
  }
22145
22405
  }
22146
22406
  async function findExecutableOnPath(executableName, environment, platform = process.platform) {
22147
- const encodedPath = environment["PATH"] ?? "";
22148
- const separator = platform === "win32" ? ";" : ":";
22149
- const extensions = executableExtensions(executableName, environment, platform);
22407
+ const support = platformSupportFor(platform);
22408
+ const encodedPath = support.environmentValue(environment, "PATH") ?? "";
22409
+ const separator = support.pathDelimiter;
22410
+ const extensions = support.executableExtensions(executableName, environment);
22150
22411
  for (const entry of encodedPath.split(separator)) {
22151
22412
  if (entry.length === 0) {
22152
22413
  continue;
22153
22414
  }
22154
22415
  for (const extension of extensions) {
22155
- const requestedPath2 = resolve(join3(entry, `${executableName}${extension}`));
22416
+ const requestedPath2 = resolve2(join5(entry, `${executableName}${extension}`));
22156
22417
  const executable = await resolveExecutablePath(requestedPath2, platform);
22157
22418
  if (executable !== null) {
22158
22419
  return executable;
@@ -22173,7 +22434,7 @@ function appendBounded(chunks, chunk, currentBytes, limitBytes) {
22173
22434
  chunks.push(chunk);
22174
22435
  return nextBytes;
22175
22436
  }
22176
- function readProcessTable() {
22437
+ function readProcessTable2() {
22177
22438
  return hostPlatform.readProcessTable();
22178
22439
  }
22179
22440
  function selectProcessTree(entries, rootProcessId) {
@@ -22208,38 +22469,14 @@ function mergeProcessTrees(captured, current) {
22208
22469
  return [...processes.values()];
22209
22470
  }
22210
22471
  async function captureProcessTree(child2) {
22211
- if (process.platform === "win32" || child2.pid === void 0) {
22472
+ if (child2.pid === void 0) {
22212
22473
  return [];
22213
22474
  }
22214
22475
  const entries = hostPlatform.readProcessTableSynchronously();
22215
22476
  if (entries.length > 0) {
22216
22477
  return selectProcessTree(entries, child2.pid);
22217
22478
  }
22218
- return selectProcessTree(await readProcessTable(), child2.pid);
22219
- }
22220
- function signalCapturedProcessGroups(processes, rootProcessId, signal) {
22221
- const processIds = new Set(processes.map((identity2) => identity2.processId));
22222
- const signalledGroups = /* @__PURE__ */ new Set();
22223
- for (const identity2 of processes) {
22224
- const isRootProcessGroup = identity2.processGroupId === rootProcessId;
22225
- if (!isRootProcessGroup && !processIds.has(identity2.processGroupId) || signalledGroups.has(identity2.processGroupId)) {
22226
- continue;
22227
- }
22228
- try {
22229
- process.kill(-identity2.processGroupId, signal);
22230
- signalledGroups.add(identity2.processGroupId);
22231
- } catch {
22232
- }
22233
- }
22234
- for (const identity2 of processes) {
22235
- if (identity2.processId === rootProcessId || identity2.processGroupId === rootProcessId || signalledGroups.has(identity2.processGroupId)) {
22236
- continue;
22237
- }
22238
- try {
22239
- process.kill(identity2.processId, signal);
22240
- } catch {
22241
- }
22242
- }
22479
+ return selectProcessTree(await readProcessTable2(), child2.pid);
22243
22480
  }
22244
22481
  async function waitForCapturedProcessesExit(processes, rootProcessId) {
22245
22482
  const processIds = processes.map((identity2) => identity2.processId).filter((processId) => processId !== rootProcessId);
@@ -22247,36 +22484,10 @@ async function waitForCapturedProcessesExit(processes, rootProcessId) {
22247
22484
  if (processIds.every((processId) => !hostPlatform.processExists(processId))) {
22248
22485
  return true;
22249
22486
  }
22250
- await readProcessTable();
22487
+ await readProcessTable2();
22251
22488
  }
22252
22489
  return processIds.every((processId) => !hostPlatform.processExists(processId));
22253
22490
  }
22254
- function terminateProcess(child2) {
22255
- if (child2.exitCode !== null || child2.signalCode !== null || child2.pid === void 0) {
22256
- return;
22257
- }
22258
- if (process.platform !== "win32") {
22259
- try {
22260
- process.kill(-child2.pid, "SIGTERM");
22261
- return;
22262
- } catch {
22263
- }
22264
- }
22265
- child2.kill("SIGTERM");
22266
- }
22267
- function forceTerminateProcess(child2) {
22268
- if (child2.exitCode !== null || child2.signalCode !== null || child2.pid === void 0) {
22269
- return;
22270
- }
22271
- if (process.platform !== "win32") {
22272
- try {
22273
- process.kill(-child2.pid, "SIGKILL");
22274
- return;
22275
- } catch {
22276
- }
22277
- }
22278
- child2.kill("SIGKILL");
22279
- }
22280
22491
  async function stopProcessTree(child2, capturedProcesses = []) {
22281
22492
  const childProcessId = child2.pid;
22282
22493
  if (childProcessId === void 0) {
@@ -22287,8 +22498,8 @@ async function stopProcessTree(child2, capturedProcesses = []) {
22287
22498
  if (childExited && processes.length === 0) {
22288
22499
  return;
22289
22500
  }
22290
- signalCapturedProcessGroups(processes, childProcessId, GRACEFUL_STOP_SIGNAL);
22291
- terminateProcess(child2);
22501
+ hostPlatform.signalCapturedProcesses(processes, childProcessId, GRACEFUL_STOP_SIGNAL);
22502
+ hostPlatform.terminateProcess(child2, "SIGTERM");
22292
22503
  const [exitedAfterTermination, descendantsExitedAfterTermination] = await Promise.all([
22293
22504
  waitForProcessExit(child2, PROCESS_GRACEFUL_STOP_TIMEOUT_MILLISECONDS),
22294
22505
  waitForCapturedProcessesExit(processes, childProcessId)
@@ -22296,8 +22507,8 @@ async function stopProcessTree(child2, capturedProcesses = []) {
22296
22507
  if (exitedAfterTermination && descendantsExitedAfterTermination) {
22297
22508
  return;
22298
22509
  }
22299
- signalCapturedProcessGroups(processes, childProcessId, FORCED_STOP_SIGNAL);
22300
- forceTerminateProcess(child2);
22510
+ hostPlatform.signalCapturedProcesses(processes, childProcessId, FORCED_STOP_SIGNAL);
22511
+ hostPlatform.terminateProcess(child2, "SIGKILL");
22301
22512
  const [exitedAfterForce, descendantsExitedAfterForce] = await Promise.all([
22302
22513
  waitForProcessExit(child2, PROCESS_FORCED_STOP_TIMEOUT_MILLISECONDS),
22303
22514
  waitForCapturedProcessesExit(processes, childProcessId)
@@ -22332,9 +22543,10 @@ function waitForProcessExit(child2, timeoutMilliseconds) {
22332
22543
  async function runBoundedProcess(options) {
22333
22544
  options.signal.throwIfAborted();
22334
22545
  const outputLimitBytes = options.outputLimitBytes ?? DEFAULT_OUTPUT_LIMIT_BYTES;
22335
- const child2 = spawn(options.command, [...options.arguments], {
22546
+ const launch = executableLaunch2(options.command, options.arguments);
22547
+ const child2 = spawn(launch.command, [...launch.arguments], {
22336
22548
  cwd: options.cwd,
22337
- detached: process.platform !== "win32",
22549
+ ...hostPlatform.spawnOptions,
22338
22550
  env: { ...options.environment },
22339
22551
  shell: false,
22340
22552
  stdio: ["ignore", "pipe", "pipe"]
@@ -22443,6 +22655,10 @@ async function runBoundedProcess(options) {
22443
22655
  }
22444
22656
  }
22445
22657
  }
22658
+ function executableLaunch2(command, args) {
22659
+ return hostPlatform.executableLaunch(command, args);
22660
+ }
22661
+ var platformSpawnOptions = hostPlatform.spawnOptions;
22446
22662
 
22447
22663
  // src/agent-catalog/local-agent.ts
22448
22664
  function readTrustedIdentity(path2) {
@@ -22735,8 +22951,8 @@ var LocalAgentInventory = class {
22735
22951
  };
22736
22952
 
22737
22953
  // src/agent-installation/managed-npm-package.ts
22738
- import { mkdir, mkdtemp, open as open2, realpath as realpath3, rename, rm, stat as stat3 } from "node:fs/promises";
22739
- import { delimiter, dirname, isAbsolute as isAbsolute2, join as join4, relative, sep } from "node:path";
22954
+ import { mkdir, mkdtemp, open as open2, realpath as realpath4, rename, rm, stat as stat3 } from "node:fs/promises";
22955
+ import { delimiter, dirname as dirname2, isAbsolute as isAbsolute2, join as join6, relative, sep } from "node:path";
22740
22956
  var INSTALL_TIMEOUT_MILLISECONDS = 5 * 60 * 1e3;
22741
22957
  var PACKAGE_METADATA_LIMIT_BYTES = 64 * 1024;
22742
22958
  var PACKAGE_LOCK_LIMIT_BYTES = 8 * 1024 * 1024;
@@ -22787,7 +23003,7 @@ function isRecord3(value) {
22787
23003
  return typeof value === "object" && value !== null && !Array.isArray(value);
22788
23004
  }
22789
23005
  function packagePath(root, packageName) {
22790
- return join4(root, "node_modules", ...packageName.split("/"));
23006
+ return join6(root, "node_modules", ...packageName.split("/"));
22791
23007
  }
22792
23008
  function isContainedPath(root, candidate) {
22793
23009
  const difference = relative(root, candidate);
@@ -22892,14 +23108,14 @@ function verifyPackageLockEntry(lock, definition, verifyDependencyClosure) {
22892
23108
  }
22893
23109
  }
22894
23110
  async function verifyRequiredDependency(rootPath, lock, definition) {
22895
- const dependencyRoot = await realpath3(packagePath(rootPath, definition.packageName));
23111
+ const dependencyRoot = await realpath4(packagePath(rootPath, definition.packageName));
22896
23112
  if (!isContainedPath(rootPath, dependencyRoot)) {
22897
23113
  throw new ManagedNpmPackageError(
22898
23114
  "managed_package_verification_failed",
22899
23115
  "The required managed npm dependency escaped its private cache"
22900
23116
  );
22901
23117
  }
22902
- const metadata = await readJsonRecord(join4(dependencyRoot, "package.json"), PACKAGE_METADATA_LIMIT_BYTES);
23118
+ const metadata = await readJsonRecord(join6(dependencyRoot, "package.json"), PACKAGE_METADATA_LIMIT_BYTES);
22903
23119
  if (metadata["name"] !== definition.packageName || metadata["version"] !== definition.version) {
22904
23120
  throw new ManagedNpmPackageError(
22905
23121
  "managed_package_verification_failed",
@@ -22921,15 +23137,15 @@ async function validateManagedNpmPackage(root, definition) {
22921
23137
  }
22922
23138
  }
22923
23139
  async function validateManagedNpmPackageContents(root, definition) {
22924
- const rootPath = await realpath3(root);
22925
- const packageRoot = await realpath3(packagePath(rootPath, definition.packageName));
23140
+ const rootPath = await realpath4(root);
23141
+ const packageRoot = await realpath4(packagePath(rootPath, definition.packageName));
22926
23142
  if (!isContainedPath(rootPath, packageRoot)) {
22927
23143
  throw new ManagedNpmPackageError(
22928
23144
  "managed_package_verification_failed",
22929
23145
  "The managed npm package escaped its private cache"
22930
23146
  );
22931
23147
  }
22932
- const metadata = await readJsonRecord(join4(packageRoot, "package.json"), PACKAGE_METADATA_LIMIT_BYTES);
23148
+ const metadata = await readJsonRecord(join6(packageRoot, "package.json"), PACKAGE_METADATA_LIMIT_BYTES);
22933
23149
  if (metadata["name"] !== definition.packageName || metadata["version"] !== definition.version) {
22934
23150
  throw new ManagedNpmPackageError(
22935
23151
  "managed_package_verification_failed",
@@ -22937,14 +23153,14 @@ async function validateManagedNpmPackageContents(root, definition) {
22937
23153
  );
22938
23154
  }
22939
23155
  if (definition instanceof SriManagedNpmPackageDefinition) {
22940
- const lock = await readJsonRecord(join4(rootPath, "package-lock.json"), PACKAGE_LOCK_LIMIT_BYTES);
23156
+ const lock = await readJsonRecord(join6(rootPath, "package-lock.json"), PACKAGE_LOCK_LIMIT_BYTES);
22941
23157
  verifyPackageLockEntry(lock, definition, definition.verifyDependencyClosure);
22942
23158
  for (const dependency of definition.requiredDependencies) {
22943
23159
  await verifyRequiredDependency(rootPath, lock, dependency);
22944
23160
  }
22945
23161
  }
22946
23162
  const declaredBin = readBinPath(metadata, definition.executableName);
22947
- const executable = await resolveExecutablePath(join4(packageRoot, declaredBin));
23163
+ const executable = await resolveExecutablePath(join6(packageRoot, declaredBin));
22948
23164
  if (executable === null || !isContainedPath(rootPath, executable.path)) {
22949
23165
  throw new ManagedNpmPackageError(
22950
23166
  "managed_package_verification_failed",
@@ -22966,9 +23182,9 @@ var ManagedNpmPackageInstaller = class {
22966
23182
  throw error62;
22967
23183
  }
22968
23184
  }
22969
- const parent = dirname(root);
23185
+ const parent = dirname2(root);
22970
23186
  await mkdir(parent, { mode: 448, recursive: true });
22971
- const staging = await mkdtemp(join4(parent, `.${definition.version}.staging-`));
23187
+ const staging = await mkdtemp(join6(parent, `.${definition.version}.staging-`));
22972
23188
  try {
22973
23189
  const npm = await findExecutableOnPath(process.platform === "win32" ? "npm.cmd" : "npm", environment);
22974
23190
  if (npm === null) {
@@ -22994,14 +23210,14 @@ var ManagedNpmPackageInstaller = class {
22994
23210
  `${definition.packageName}@${definition.version}`
22995
23211
  );
22996
23212
  const installEnvironment = {
22997
- HOME: join4(staging, "home"),
23213
+ HOME: join6(staging, "home"),
22998
23214
  NPM_CONFIG_AUDIT: "false",
22999
- NPM_CONFIG_CACHE: join4(staging, ".npm-cache"),
23215
+ NPM_CONFIG_CACHE: join6(staging, ".npm-cache"),
23000
23216
  NPM_CONFIG_FUND: "false",
23001
23217
  NPM_CONFIG_IGNORE_SCRIPTS: "true",
23002
23218
  NPM_CONFIG_PACKAGE_LOCK: "true",
23003
23219
  NPM_CONFIG_REGISTRY: "https://registry.npmjs.org/",
23004
- PATH: `${dirname(process.execPath)}${delimiter}/usr/bin${delimiter}/bin`
23220
+ PATH: `${dirname2(process.execPath)}${delimiter}/usr/bin${delimiter}/bin`
23005
23221
  };
23006
23222
  if (definition.includeOptionalDependencies) {
23007
23223
  installEnvironment["NPM_CONFIG_INCLUDE"] = "optional";
@@ -23018,8 +23234,8 @@ var ManagedNpmPackageInstaller = class {
23018
23234
  timeoutMilliseconds: INSTALL_TIMEOUT_MILLISECONDS
23019
23235
  });
23020
23236
  await Promise.all([
23021
- rm(join4(staging, ".npm-cache"), { force: true, recursive: true }),
23022
- rm(join4(staging, "home"), { force: true, recursive: true })
23237
+ rm(join6(staging, ".npm-cache"), { force: true, recursive: true }),
23238
+ rm(join6(staging, "home"), { force: true, recursive: true })
23023
23239
  ]);
23024
23240
  await validateManagedNpmPackage(staging, definition);
23025
23241
  try {
@@ -23055,7 +23271,7 @@ var ManagedNpmPackageInstaller = class {
23055
23271
  };
23056
23272
 
23057
23273
  // src/agent-catalog/agent-specification.ts
23058
- import { join as join5 } from "node:path";
23274
+ import { join as join7 } from "node:path";
23059
23275
 
23060
23276
  // src/agent-catalog/version-output.ts
23061
23277
  function normalizeVersionOutput(output2) {
@@ -23078,7 +23294,7 @@ var LocalAgentSpecification = class {
23078
23294
  resolveManagedAgent = async (stateDirectory, platform, signal) => {
23079
23295
  signal.throwIfAborted();
23080
23296
  const executable = await resolveExecutablePath(
23081
- join5(stateDirectory, ...this.managedAgentExecutablePath),
23297
+ join7(stateDirectory, ...this.managedAgentExecutablePath),
23082
23298
  platform
23083
23299
  );
23084
23300
  signal.throwIfAborted();
@@ -23560,9 +23776,10 @@ var CodexAppServerClient = class {
23560
23776
  #pendingFragments = [];
23561
23777
  constructor(options) {
23562
23778
  this.#handlers = options.handlers;
23563
- this.#child = spawn2(options.command, ["app-server"], {
23779
+ const launch = executableLaunch2(options.command, ["app-server"]);
23780
+ this.#child = spawn2(launch.command, [...launch.arguments], {
23564
23781
  cwd: options.cwd,
23565
- detached: process.platform !== "win32",
23782
+ ...platformSpawnOptions,
23566
23783
  env: { ...process.env, ...options.environment },
23567
23784
  shell: false,
23568
23785
  stdio: ["pipe", "pipe", "pipe"]
@@ -25219,7 +25436,7 @@ var AgentProbeError = class extends Error {
25219
25436
  };
25220
25437
 
25221
25438
  // src/agent-catalog/agents/resolve-user-local-executable.ts
25222
- import { isAbsolute as isAbsolute4, join as join6 } from "node:path";
25439
+ import { isAbsolute as isAbsolute4, join as join8 } from "node:path";
25223
25440
  async function resolveUserLocalExecutable(executableName, context) {
25224
25441
  context.signal.throwIfAborted();
25225
25442
  const platform = context.platform ?? process.platform;
@@ -25227,7 +25444,7 @@ async function resolveUserLocalExecutable(executableName, context) {
25227
25444
  if (platform === "win32" || homeDirectory === void 0 || !isAbsolute4(homeDirectory)) {
25228
25445
  return [];
25229
25446
  }
25230
- const executable = await resolveExecutablePath(join6(homeDirectory, ".local", "bin", executableName), platform);
25447
+ const executable = await resolveExecutablePath(join8(homeDirectory, ".local", "bin", executableName), platform);
25231
25448
  context.signal.throwIfAborted();
25232
25449
  return executable === null ? [] : [executable];
25233
25450
  }
@@ -25316,8 +25533,8 @@ var CursorCliAgentSpecification = class extends DirectAcpAgentDefinition {
25316
25533
  };
25317
25534
 
25318
25535
  // src/agent-catalog/agents/deepseek-harness-agent.ts
25319
- import { mkdir as mkdir2, realpath as realpath4, stat as stat4, writeFile } from "node:fs/promises";
25320
- import { isAbsolute as isAbsolute5, join as join8, normalize } from "node:path";
25536
+ import { mkdir as mkdir2, realpath as realpath5, stat as stat4, writeFile } from "node:fs/promises";
25537
+ import { isAbsolute as isAbsolute5, join as join10, normalize } from "node:path";
25321
25538
 
25322
25539
  // src/agent-installation/deepseek-managed-package.ts
25323
25540
  var DeepSeekHarnessManagedPackage = class extends SriManagedNpmPackageDefinition {
@@ -25335,13 +25552,13 @@ var DEEPSEEK_HARNESS_PACKAGE = new DeepSeekHarnessManagedPackage(
25335
25552
 
25336
25553
  // src/storage/state-directory.ts
25337
25554
  import { homedir } from "node:os";
25338
- import { join as join7, resolve as resolve2 } from "node:path";
25555
+ import { join as join9, resolve as resolve3 } from "node:path";
25339
25556
  function readStateDirectory(environment = process.env) {
25340
25557
  const configured = environment["MOBIUS_STATE_DIRECTORY"]?.trim();
25341
25558
  if (configured !== void 0 && configured.length > 0) {
25342
- return resolve2(configured);
25559
+ return resolve3(configured);
25343
25560
  }
25344
- return join7(homedir(), ".mobius");
25561
+ return join9(homedir(), ".mobius");
25345
25562
  }
25346
25563
 
25347
25564
  // src/agent-catalog/agents/deepseek-harness-agent.ts
@@ -25359,13 +25576,13 @@ async function prepareAgentHome(path2, imagePrompts) {
25359
25576
  if (imagePrompts) {
25360
25577
  await mkdir2(path2, { mode: 448, recursive: true });
25361
25578
  }
25362
- const resolved = await realpath4(path2);
25579
+ const resolved = await realpath5(path2);
25363
25580
  const metadata = await stat4(resolved);
25364
25581
  if (!metadata.isDirectory() || typeof process.getuid === "function" && metadata.uid !== process.getuid()) {
25365
25582
  throw new Error("Agent home is not a user-owned directory");
25366
25583
  }
25367
25584
  if (imagePrompts) {
25368
- await writeFile(join8(resolved, "cordis.patch.yml"), DEEPSEEK_HARNESS_IMAGE_PROMPT_PATCH, {
25585
+ await writeFile(join10(resolved, "cordis.patch.yml"), DEEPSEEK_HARNESS_IMAGE_PROMPT_PATCH, {
25369
25586
  mode: 384
25370
25587
  });
25371
25588
  }
@@ -25413,7 +25630,7 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
25413
25630
  context.signal
25414
25631
  );
25415
25632
  if (managed.path === agent.path) {
25416
- selectedHome = join8(readStateDirectory(context.environment), "agents", this.id, "home");
25633
+ selectedHome = join10(readStateDirectory(context.environment), "agents", this.id, "home");
25417
25634
  managedHome = true;
25418
25635
  }
25419
25636
  } catch {
@@ -25429,7 +25646,7 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
25429
25646
  resolveManagedAgent = async (stateDirectory, _platform, signal) => {
25430
25647
  signal.throwIfAborted();
25431
25648
  const executable = await validateManagedNpmPackage(
25432
- join8(stateDirectory, "agents", this.id, DEEPSEEK_HARNESS_PACKAGE.version),
25649
+ join10(stateDirectory, "agents", this.id, DEEPSEEK_HARNESS_PACKAGE.version),
25433
25650
  DEEPSEEK_HARNESS_PACKAGE
25434
25651
  );
25435
25652
  signal.throwIfAborted();
@@ -25483,8 +25700,8 @@ var GeminiCliAgentSpecification = class extends DirectAcpAgentDefinition {
25483
25700
  };
25484
25701
 
25485
25702
  // src/agent-catalog/agents/grok-build-agent.ts
25486
- import { realpath as realpath5 } from "node:fs/promises";
25487
- import { isAbsolute as isAbsolute6, join as join9, relative as relative2, sep as sep2 } from "node:path";
25703
+ import { realpath as realpath6 } from "node:fs/promises";
25704
+ import { isAbsolute as isAbsolute6, join as join11, relative as relative2, sep as sep2 } from "node:path";
25488
25705
  import {
25489
25706
  RequestError
25490
25707
  } from "@agentclientprotocol/sdk";
@@ -25554,8 +25771,8 @@ var GrokBuildAgentSpecification = class extends DirectAcpAgentDefinition {
25554
25771
  );
25555
25772
  if (managed.path === agent.path) {
25556
25773
  return Object.freeze({
25557
- GROK_HOME: await realpath5(
25558
- join9(stateDirectory, "agents", this.id, GROK_BUILD_MANAGED_VERSION, "home")
25774
+ GROK_HOME: await realpath6(
25775
+ join11(stateDirectory, "agents", this.id, GROK_BUILD_MANAGED_VERSION, "home")
25559
25776
  )
25560
25777
  });
25561
25778
  }
@@ -25566,9 +25783,9 @@ var GrokBuildAgentSpecification = class extends DirectAcpAgentDefinition {
25566
25783
  };
25567
25784
  resolveManagedAgent = async (stateDirectory, platform, signal) => {
25568
25785
  signal.throwIfAborted();
25569
- const versionRoot = await realpath5(join9(stateDirectory, "agents", this.id, GROK_BUILD_MANAGED_VERSION));
25570
- await validateManagedNpmPackage(join9(versionRoot, "package"), grokBuildManagedPackage(platform, process.arch));
25571
- const executable = await resolveExecutablePath(join9(versionRoot, "home", "bin", "grok"), platform);
25786
+ const versionRoot = await realpath6(join11(stateDirectory, "agents", this.id, GROK_BUILD_MANAGED_VERSION));
25787
+ await validateManagedNpmPackage(join11(versionRoot, "package"), grokBuildManagedPackage(platform, process.arch));
25788
+ const executable = await resolveExecutablePath(join11(versionRoot, "home", "bin", "grok"), platform);
25572
25789
  signal.throwIfAborted();
25573
25790
  if (executable === null || !isContainedPath2(versionRoot, executable.path)) {
25574
25791
  throw new AgentProbeError("managed_agent_invalid", "The managed Grok Build executable is invalid");
@@ -25668,13 +25885,13 @@ var OhMyPiAgentSpecification = class extends DirectAcpAgentDefinition {
25668
25885
  };
25669
25886
 
25670
25887
  // src/agent-catalog/agents/opencode-agent.ts
25671
- import { join as join11 } from "node:path";
25888
+ import { join as join13 } from "node:path";
25672
25889
 
25673
25890
  // src/agent-installation/managed-agent-archive.ts
25674
25891
  import { createHash } from "node:crypto";
25675
25892
  import { createReadStream } from "node:fs";
25676
- import { chmod, copyFile, mkdir as mkdir3, mkdtemp as mkdtemp2, open as open3, realpath as realpath6, rename as rename2, rm as rm2, stat as stat5, writeFile as writeFile2 } from "node:fs/promises";
25677
- import { delimiter as delimiter2, dirname as dirname2, isAbsolute as isAbsolute7, join as join10, relative as relative3, sep as sep3 } from "node:path";
25893
+ import { chmod as chmod2, copyFile, mkdir as mkdir3, mkdtemp as mkdtemp2, open as open3, realpath as realpath7, rename as rename2, rm as rm2, stat as stat5, writeFile as writeFile2 } from "node:fs/promises";
25894
+ import { delimiter as delimiter2, dirname as dirname3, isAbsolute as isAbsolute7, join as join12, relative as relative3, sep as sep3 } from "node:path";
25678
25895
 
25679
25896
  // src/agent-installation/verified-download.ts
25680
25897
  import { fetch } from "undici";
@@ -25854,16 +26071,16 @@ async function readManifest(path2) {
25854
26071
  }
25855
26072
  async function validateManagedAgentArchive(root, definition, signal) {
25856
26073
  try {
25857
- const rootPath = await realpath6(root);
26074
+ const rootPath = await realpath7(root);
25858
26075
  const rootMetadata = await stat5(rootPath);
25859
26076
  if (!rootMetadata.isDirectory() || typeof process.getuid === "function" && rootMetadata.uid !== process.getuid()) {
25860
26077
  throw new Error("Managed Agent root is not user-owned");
25861
26078
  }
25862
- const manifest = await readManifest(join10(rootPath, "archive.json"));
26079
+ const manifest = await readManifest(join12(rootPath, "archive.json"));
25863
26080
  if (manifest["archiveSha256"] !== definition.archiveSha256 || manifest["archiveUrl"] !== definition.archiveUrl.toString() || manifest["version"] !== definition.version || typeof manifest["executableSha256"] !== "string") {
25864
26081
  throw new Error("Managed Agent archive identity is invalid");
25865
26082
  }
25866
- const executable = await resolveExecutablePath(join10(rootPath, "bin", definition.executableName));
26083
+ const executable = await resolveExecutablePath(join12(rootPath, "bin", definition.executableName));
25867
26084
  if (executable === null || !isContainedPath3(rootPath, executable.path) || await hashFile(executable.path, signal) !== manifest["executableSha256"]) {
25868
26085
  throw new Error("Managed Agent executable is invalid");
25869
26086
  }
@@ -26029,7 +26246,7 @@ var OpenCodeAgentSpecification = class extends DirectAcpAgentDefinition {
26029
26246
  return Object.freeze(environment);
26030
26247
  };
26031
26248
  resolveManagedAgent = async (stateDirectory, platform, signal) => await validateManagedAgentArchive(
26032
- join11(stateDirectory, "agents", this.id, OPENCODE_MANAGED_VERSION),
26249
+ join13(stateDirectory, "agents", this.id, OPENCODE_MANAGED_VERSION),
26033
26250
  openCodeManagedArchive(platform, process.arch),
26034
26251
  signal
26035
26252
  );
@@ -26047,7 +26264,7 @@ var OpenCodeAgentSpecification = class extends DirectAcpAgentDefinition {
26047
26264
  };
26048
26265
 
26049
26266
  // src/agent-catalog/agents/pi-agent.ts
26050
- import { join as join12 } from "node:path";
26267
+ import { join as join14 } from "node:path";
26051
26268
  import {
26052
26269
  methods as methods4
26053
26270
  } from "@agentclientprotocol/sdk";
@@ -26106,7 +26323,7 @@ var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
26106
26323
  resolveManagedAgent = async (stateDirectory, _platform, signal) => {
26107
26324
  signal.throwIfAborted();
26108
26325
  const executable = await validateManagedNpmPackage(
26109
- join12(stateDirectory, "agents", this.id, PI_AGENT_PACKAGE.version),
26326
+ join14(stateDirectory, "agents", this.id, PI_AGENT_PACKAGE.version),
26110
26327
  PI_AGENT_PACKAGE
26111
26328
  );
26112
26329
  signal.throwIfAborted();
@@ -26144,7 +26361,7 @@ var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
26144
26361
  };
26145
26362
 
26146
26363
  // src/agent-catalog/agents/workbuddy-agent.ts
26147
- import { join as join13 } from "node:path";
26364
+ import { join as join15 } from "node:path";
26148
26365
 
26149
26366
  // src/agent-installation/workbuddy-managed-package.ts
26150
26367
  var WORKBUDDY_MANAGED_VERSION = "2.146.0";
@@ -26190,7 +26407,7 @@ var WorkBuddyAgentSpecification = class extends DirectAcpAgentDefinition {
26190
26407
  resolveManagedAgent = async (stateDirectory, _platform, signal) => {
26191
26408
  signal.throwIfAborted();
26192
26409
  const executable = await validateManagedNpmPackage(
26193
- join13(stateDirectory, "agents", this.id, WORKBUDDY_MANAGED_VERSION),
26410
+ join15(stateDirectory, "agents", this.id, WORKBUDDY_MANAGED_VERSION),
26194
26411
  WORKBUDDY_MANAGED_PACKAGE
26195
26412
  );
26196
26413
  signal.throwIfAborted();
@@ -26427,9 +26644,10 @@ async function probeAcpReadiness(specification, agent, environment, defaultWorks
26427
26644
  signal.removeEventListener("abort", abort);
26428
26645
  }
26429
26646
  }
26430
- const child2 = spawn3(agent.adapterPath, [...agent.arguments], {
26647
+ const launch = executableLaunch2(agent.adapterPath, agent.arguments);
26648
+ const child2 = spawn3(launch.command, [...launch.arguments], {
26431
26649
  cwd: defaultWorkspace,
26432
- detached: process.platform !== "win32",
26650
+ ...platformSpawnOptions,
26433
26651
  env: { ...environment, ...agent.environment },
26434
26652
  shell: false,
26435
26653
  stdio: ["pipe", "pipe", "pipe"]
@@ -26562,10 +26780,10 @@ function isAgentVersionSupported(reportedVersion, minimumSupportedVersion) {
26562
26780
  }
26563
26781
 
26564
26782
  // src/agent-catalog/executable-discovery.ts
26565
- import { isAbsolute as isAbsolute8, join as join15 } from "node:path";
26783
+ import { isAbsolute as isAbsolute8, join as join17 } from "node:path";
26566
26784
 
26567
26785
  // src/agent-installation/managed-adapter-installer.ts
26568
- import { join as join14 } from "node:path";
26786
+ import { join as join16 } from "node:path";
26569
26787
  var ManagedAdapterInstallError = class extends Error {
26570
26788
  code;
26571
26789
  constructor(code, message, options = {}) {
@@ -26622,7 +26840,7 @@ var ManagedAdapterInstaller = class {
26622
26840
  this.#stateDirectory = options.stateDirectory;
26623
26841
  }
26624
26842
  install = async (specification, signal) => {
26625
- const root = join14(this.#stateDirectory, "adapters", specification.id, specification.adapterVersion);
26843
+ const root = join16(this.#stateDirectory, "adapters", specification.id, specification.adapterVersion);
26626
26844
  try {
26627
26845
  return await this.#npmInstaller.install(
26628
26846
  root,
@@ -26656,7 +26874,7 @@ async function resolveManagedAdapterExecutable(specification, context) {
26656
26874
  let managed;
26657
26875
  try {
26658
26876
  managed = await validateManagedAdapter(
26659
- join15(readStateDirectory(context.environment), "adapters", specification.id, specification.adapterVersion),
26877
+ join17(readStateDirectory(context.environment), "adapters", specification.id, specification.adapterVersion),
26660
26878
  specification
26661
26879
  );
26662
26880
  } catch {
@@ -27081,16 +27299,16 @@ async function publishAgentCatalog(config2, signal) {
27081
27299
  }
27082
27300
 
27083
27301
  // src/config.ts
27084
- import { join as join16, resolve as resolve3 } from "node:path";
27302
+ import { join as join18, resolve as resolve4 } from "node:path";
27085
27303
  function loadDefaultWorkspace(environment = process.env) {
27086
27304
  const { MOBIUS_DEFAULT_WORKSPACE: configuredWorkspace } = environment;
27087
- return configuredWorkspace ?? join16(readStateDirectory(environment), "workspace");
27305
+ return configuredWorkspace ?? join18(readStateDirectory(environment), "workspace");
27088
27306
  }
27089
27307
  var DaemonLocalContext = class {
27090
27308
  environment;
27091
27309
  stateDirectory;
27092
27310
  constructor(stateDirectory, environment = process.env) {
27093
- this.stateDirectory = resolve3(stateDirectory);
27311
+ this.stateDirectory = resolve4(stateDirectory);
27094
27312
  this.environment = Object.freeze({ ...environment, MOBIUS_STATE_DIRECTORY: this.stateDirectory });
27095
27313
  }
27096
27314
  };
@@ -27204,7 +27422,7 @@ var AuditStore = class {
27204
27422
 
27205
27423
  // src/run-daemon.ts
27206
27424
  import { createHash as createHash7, randomUUID as randomUUID8 } from "node:crypto";
27207
- import { join as join20 } from "node:path";
27425
+ import { join as join22 } from "node:path";
27208
27426
  import { styleText } from "node:util";
27209
27427
 
27210
27428
  // src/acp/active-executions.ts
@@ -27295,7 +27513,7 @@ import {
27295
27513
  } from "@agentclientprotocol/sdk";
27296
27514
 
27297
27515
  // src/authorization/local-raster.ts
27298
- import { open as open4, readFile as readFile2, realpath as realpath7, stat as stat6 } from "node:fs/promises";
27516
+ import { open as open4, readFile as readFile3, realpath as realpath8, stat as stat6 } from "node:fs/promises";
27299
27517
  import { basename, isAbsolute as isAbsolute9, normalize as normalize2 } from "node:path";
27300
27518
  import { fileURLToPath } from "node:url";
27301
27519
  var MAX_LOCAL_RASTER_BYTES = 128 * 1024 * 1024;
@@ -27318,7 +27536,7 @@ var LocalRasterImage = class {
27318
27536
  this.sourceUri = sourceUri;
27319
27537
  }
27320
27538
  base64 = async () => {
27321
- const bytes = this.bytes ?? new Uint8Array(await readFile2(this.sourceUri));
27539
+ const bytes = this.bytes ?? new Uint8Array(await readFile3(this.sourceUri));
27322
27540
  return Buffer.from(bytes).toString("base64");
27323
27541
  };
27324
27542
  };
@@ -27366,7 +27584,7 @@ async function resolveCanonicalPath(requested, signal) {
27366
27584
  return null;
27367
27585
  }
27368
27586
  try {
27369
- const target = await realpath7(requested);
27587
+ const target = await realpath8(requested);
27370
27588
  signal.throwIfAborted();
27371
27589
  if (!isAbsolute9(target) || normalize2(target) !== target) {
27372
27590
  return null;
@@ -27947,7 +28165,7 @@ function createWritableAcpStream(output2) {
27947
28165
  if (outputFailure !== void 0) {
27948
28166
  return Promise.reject(outputFailure);
27949
28167
  }
27950
- return new Promise((resolve9, reject) => {
28168
+ return new Promise((resolve10, reject) => {
27951
28169
  pendingWriteFailures.add(reject);
27952
28170
  output2.write(chunk, (error62) => {
27953
28171
  pendingWriteFailures.delete(reject);
@@ -27960,7 +28178,7 @@ function createWritableAcpStream(output2) {
27960
28178
  reject(outputFailure);
27961
28179
  return;
27962
28180
  }
27963
- resolve9();
28181
+ resolve10();
27964
28182
  });
27965
28183
  });
27966
28184
  }
@@ -27982,9 +28200,10 @@ var AgentConnection = class {
27982
28200
  this.connection = createAcpClient(client2).connect(inProcess.app());
27983
28201
  return;
27984
28202
  }
27985
- const child2 = spawn4(agent.adapterPath, [...agent.arguments], {
28203
+ const launch = executableLaunch2(agent.adapterPath, agent.arguments);
28204
+ const child2 = spawn4(launch.command, [...launch.arguments], {
27986
28205
  cwd,
27987
- detached: process.platform !== "win32",
28206
+ ...platformSpawnOptions,
27988
28207
  env: { ...process.env, ...agent.environment },
27989
28208
  shell: false,
27990
28209
  stdio: ["pipe", "pipe", "pipe"]
@@ -28001,12 +28220,12 @@ var AgentConnection = class {
28001
28220
  stderr.on("data", (chunk) => {
28002
28221
  process.stderr.write(`[${agent.id}-acp] ${chunk}`);
28003
28222
  });
28004
- this.termination = new Promise((resolve9) => {
28223
+ this.termination = new Promise((resolve10) => {
28005
28224
  child2.once("error", (cause) => {
28006
- resolve9({ kind: "failed", error: new AcpExecutionError("The ACP process could not run", { cause }) });
28225
+ resolve10({ kind: "failed", error: new AcpExecutionError("The ACP process could not run", { cause }) });
28007
28226
  });
28008
28227
  child2.once("exit", (code, signal) => {
28009
- resolve9({
28228
+ resolve10({
28010
28229
  kind: "failed",
28011
28230
  error: new AcpExecutionError("The ACP process stopped", { cause: { code, signal } })
28012
28231
  });
@@ -30162,7 +30381,7 @@ function sql(strings, ...params) {
30162
30381
  return new SQL([new StringChunk(str)]);
30163
30382
  }
30164
30383
  _sql.raw = raw;
30165
- function join22(chunks, separator) {
30384
+ function join24(chunks, separator) {
30166
30385
  const result = [];
30167
30386
  for (const [i, chunk] of chunks.entries()) {
30168
30387
  if (i > 0 && separator !== void 0) result.push(separator);
@@ -30170,7 +30389,7 @@ function sql(strings, ...params) {
30170
30389
  }
30171
30390
  return new SQL(result);
30172
30391
  }
30173
- _sql.join = join22;
30392
+ _sql.join = join24;
30174
30393
  function identifier2(value) {
30175
30394
  return new Name(value);
30176
30395
  }
@@ -32315,7 +32534,7 @@ var SQLiteSelectBase = class extends TypedQueryBuilder {
32315
32534
  const baseTableName = this.tableName;
32316
32535
  const tableName = getTableLikeName(table);
32317
32536
  for (const item of extractUsedTable(table)) this.usedTables.add(item);
32318
- if (typeof tableName === "string" && this.config.joins?.some((join22) => join22.alias === tableName)) throw new Error(`Alias "${tableName}" is already used in this query`);
32537
+ if (typeof tableName === "string" && this.config.joins?.some((join24) => join24.alias === tableName)) throw new Error(`Alias "${tableName}" is already used in this query`);
32319
32538
  if (!this.isPartialSelect) {
32320
32539
  if (Object.keys(this.joinsNotNullableMap).length === 1 && typeof baseTableName === "string") this.config.fields = { [baseTableName]: this.config.fields };
32321
32540
  if (typeof tableName === "string" && !is(table, SQL)) {
@@ -33154,7 +33373,7 @@ var SQLiteDialect = class {
33154
33373
  if (!joins2) return;
33155
33374
  const withEntries = Object.entries(joins2).filter(([_, v]) => v);
33156
33375
  if (!withEntries.length) return;
33157
- return sql.join(withEntries.map(([k, join22]) => {
33376
+ return sql.join(withEntries.map(([k, join24]) => {
33158
33377
  const relation = tableConfig.relations[k];
33159
33378
  const isSingle2 = is(relation, One);
33160
33379
  const targetTable = aliasedTable(relation.targetTable, `d${currentDepth + 1}`);
@@ -33165,7 +33384,7 @@ var SQLiteDialect = class {
33165
33384
  table: targetTable,
33166
33385
  mode: isSingle2 ? "first" : "many",
33167
33386
  schema,
33168
- queryConfig: join22,
33387
+ queryConfig: join24,
33169
33388
  tableConfig: schema[relation.targetTableName],
33170
33389
  relationWhere: filter,
33171
33390
  isNested: true,
@@ -33179,7 +33398,7 @@ var SQLiteDialect = class {
33179
33398
  key: k,
33180
33399
  selection: innerQuery.selection,
33181
33400
  isArray: !isSingle2,
33182
- isOptional: (relation.optional ?? false) || join22 !== true && !!join22.where
33401
+ isOptional: (relation.optional ?? false) || join24 !== true && !!join24.where
33183
33402
  });
33184
33403
  const jsonColumns = sql.join(innerQuery.selection.map((s) => {
33185
33404
  return sql`${sql.raw(this.escapeString(s.key))}, ${s.selection ? sql`${jsonb}(${sql.identifier(s.key)})` : sql.identifier(s.key)}`;
@@ -33795,7 +34014,7 @@ var SQLiteUpdateBase = class {
33795
34014
  createJoin(joinType) {
33796
34015
  return ((table, on) => {
33797
34016
  const tableName = getTableLikeName(table);
33798
- if (typeof tableName === "string" && this.config.joins.some((join22) => join22.alias === tableName)) throw new Error(`Alias "${tableName}" is already used in this query`);
34017
+ if (typeof tableName === "string" && this.config.joins.some((join24) => join24.alias === tableName)) throw new Error(`Alias "${tableName}" is already used in this query`);
33799
34018
  if (typeof on === "function") {
33800
34019
  const from = this.config.from ? is(table, SQLiteTable) ? table[Table.Symbol.Columns] : is(table, Subquery) ? table._.selectedFields : is(table, SQLiteViewBase) ? table[ViewBaseConfig].selectedFields : void 0 : void 0;
33801
34020
  on = on(new Proxy(this.config.table[Table.Symbol.Columns], new SelectionProxyHandler({
@@ -36454,8 +36673,8 @@ var AcpContentExternalizer = class {
36454
36673
 
36455
36674
  // src/external-content/local-external-content-store.ts
36456
36675
  import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
36457
- import { lstat, mkdir as mkdir4, readdir as readdir2, realpath as realpath8, rename as rename3, rm as rm3, stat as stat7, utimes, writeFile as writeFile3 } from "node:fs/promises";
36458
- import { dirname as dirname3, join as join17 } from "node:path";
36676
+ import { lstat as lstat2, mkdir as mkdir4, readdir as readdir2, realpath as realpath9, rename as rename3, rm as rm3, stat as stat7, utimes, writeFile as writeFile3 } from "node:fs/promises";
36677
+ import { dirname as dirname4, join as join19 } from "node:path";
36459
36678
  var contentRequest = /^mobius-content:(image|audio|resource):([a-f0-9]{64})$/u;
36460
36679
  var CONTENT_LIFETIME_MILLISECONDS = 24 * 60 * 60 * 1e3;
36461
36680
  var metadataSchema2 = external_exports.strictObject({
@@ -36491,7 +36710,7 @@ var LocalExternalContentStore = class {
36491
36710
  #expirationTimer;
36492
36711
  #cleanup = Promise.resolve();
36493
36712
  constructor(stateDirectory) {
36494
- this.#root = join17(stateDirectory, "tmp", "session-content", randomUUID2());
36713
+ this.#root = join19(stateDirectory, "tmp", "session-content", randomUUID2());
36495
36714
  this.#expirationTimer = setInterval(() => {
36496
36715
  void this.#expire().catch(() => void 0);
36497
36716
  }, 6e4);
@@ -36502,11 +36721,11 @@ var LocalExternalContentStore = class {
36502
36721
  await mkdir4(this.#root, { mode: 448, recursive: true });
36503
36722
  const now = /* @__PURE__ */ new Date();
36504
36723
  await utimes(this.#root, now, now);
36505
- for (const directory of await readdir2(dirname3(this.#root), { withFileTypes: true })) {
36724
+ for (const directory of await readdir2(dirname4(this.#root), { withFileTypes: true })) {
36506
36725
  if (!directory.isDirectory() || !/^[a-f0-9-]{36}$/u.test(directory.name)) {
36507
36726
  continue;
36508
36727
  }
36509
- const path2 = join17(dirname3(this.#root), directory.name);
36728
+ const path2 = join19(dirname4(this.#root), directory.name);
36510
36729
  if (path2 === this.#root) {
36511
36730
  continue;
36512
36731
  }
@@ -36556,10 +36775,10 @@ var LocalExternalContentStore = class {
36556
36775
  }
36557
36776
  await this.#expire();
36558
36777
  active.throwIfAborted();
36559
- const directory = join17(this.#root, kind);
36778
+ const directory = join19(this.#root, kind);
36560
36779
  await mkdir4(directory, { mode: 448, recursive: true });
36561
36780
  active.throwIfAborted();
36562
- const path2 = join17(directory, key);
36781
+ const path2 = join19(directory, key);
36563
36782
  const write = atomicWrite(path2, bytes, active);
36564
36783
  await write;
36565
36784
  active.throwIfAborted();
@@ -36592,12 +36811,12 @@ var LocalExternalContentStore = class {
36592
36811
  }
36593
36812
  try {
36594
36813
  const [resolvedDirectory, resolvedPath, file2] = await Promise.all([
36595
- realpath8(dirname3(entry.path)),
36596
- realpath8(entry.path),
36597
- lstat(entry.path)
36814
+ realpath9(dirname4(entry.path)),
36815
+ realpath9(entry.path),
36816
+ lstat2(entry.path)
36598
36817
  ]);
36599
36818
  signal.throwIfAborted();
36600
- if (!file2.isFile() || file2.isSymbolicLink() || dirname3(resolvedPath) !== resolvedDirectory) {
36819
+ if (!file2.isFile() || file2.isSymbolicLink() || dirname4(resolvedPath) !== resolvedDirectory) {
36601
36820
  return null;
36602
36821
  }
36603
36822
  return { mediaType: entry.mediaType, name: entry.name, path: resolvedPath };
@@ -37898,7 +38117,7 @@ var AgentInstallationManager = class {
37898
38117
 
37899
38118
  // src/agent-installation/fixed-installation-executor.ts
37900
38119
  import { realpathSync as realpathSync2, statSync as statSync2 } from "node:fs";
37901
- import { resolve as resolve4 } from "node:path";
38120
+ import { resolve as resolve5 } from "node:path";
37902
38121
  function findSpecification(specifications, agentId) {
37903
38122
  for (const specification of specifications) {
37904
38123
  if (specification.id === agentId) {
@@ -37909,7 +38128,7 @@ function findSpecification(specifications, agentId) {
37909
38128
  }
37910
38129
  function resolveDefaultWorkspace(path2) {
37911
38130
  try {
37912
- const directory = realpathSync2(resolve4(path2));
38131
+ const directory = realpathSync2(resolve5(path2));
37913
38132
  if (!statSync2(directory).isDirectory()) {
37914
38133
  throw new Error("Default workspace is not a directory");
37915
38134
  }
@@ -37924,7 +38143,7 @@ function resolveDefaultWorkspace(path2) {
37924
38143
  }
37925
38144
  function resolveIntegrationStateDirectory(path2) {
37926
38145
  try {
37927
- const directory = realpathSync2(resolve4(path2));
38146
+ const directory = realpathSync2(resolve5(path2));
37928
38147
  const metadata = statSync2(directory);
37929
38148
  if (!metadata.isDirectory() || typeof process.getuid === "function" && metadata.uid !== process.getuid()) {
37930
38149
  throw new Error("Installation directory is not user-owned");
@@ -38096,9 +38315,9 @@ var FixedInstallationExecutor = class {
38096
38315
  };
38097
38316
 
38098
38317
  // src/authorization/workspace-directory.ts
38099
- import { readdir as readdir3, realpath as realpath9, stat as stat8 } from "node:fs/promises";
38318
+ import { readdir as readdir3, realpath as realpath10, stat as stat8 } from "node:fs/promises";
38100
38319
  import { homedir as homedir2 } from "node:os";
38101
- import { basename as basename3, dirname as dirname4, isAbsolute as isAbsolute10, join as join18, normalize as normalize3, relative as relative4 } from "node:path";
38320
+ import { basename as basename3, dirname as dirname5, isAbsolute as isAbsolute10, join as join20, normalize as normalize3, relative as relative4 } from "node:path";
38102
38321
 
38103
38322
  // src/authorization/local-authorization-error.ts
38104
38323
  var LocalAuthorizationError = class extends Error {
@@ -38177,7 +38396,7 @@ var WorkspaceDirectoryService = class {
38177
38396
  throw new LocalAuthorizationError("The local directory path is invalid");
38178
38397
  }
38179
38398
  try {
38180
- const target = await realpath9(requested);
38399
+ const target = await realpath10(requested);
38181
38400
  signal.throwIfAborted();
38182
38401
  const metadata = await stat8(target);
38183
38402
  signal.throwIfAborted();
@@ -38227,7 +38446,7 @@ var WorkspaceDirectoryService = class {
38227
38446
  continue;
38228
38447
  }
38229
38448
  try {
38230
- const path2 = await this.resolvePath(join18(target, child2.name), signal);
38449
+ const path2 = await this.resolvePath(join20(target, child2.name), signal);
38231
38450
  entries.push({ directoryId: encodePath(path2), name: child2.name });
38232
38451
  } catch (cause) {
38233
38452
  signal.throwIfAborted();
@@ -38237,7 +38456,7 @@ var WorkspaceDirectoryService = class {
38237
38456
  }
38238
38457
  }
38239
38458
  entries.sort((a, b) => a.name.localeCompare(b.name));
38240
- const parent = dirname4(target);
38459
+ const parent = dirname5(target);
38241
38460
  return new WorkspaceDirectoryListing(
38242
38461
  id,
38243
38462
  this.label(target),
@@ -38263,15 +38482,15 @@ var WorkspaceDirectoryService = class {
38263
38482
 
38264
38483
  // src/daemon-diagnostic-log.ts
38265
38484
  import { appendFileSync, mkdirSync, readFileSync as readFileSync2, renameSync, statSync as statSync3, writeFileSync } from "node:fs";
38266
- import { join as join19 } from "node:path";
38485
+ import { join as join21 } from "node:path";
38267
38486
  var MAXIMUM_DAEMON_LOG_BYTES = 1 * 1024 * 1024;
38268
38487
  var DaemonDiagnosticLog = class {
38269
38488
  #directory;
38270
38489
  #path;
38271
38490
  #maximumBytes;
38272
38491
  constructor(stateDirectory, maximumBytes = MAXIMUM_DAEMON_LOG_BYTES) {
38273
- this.#directory = join19(stateDirectory, "logs");
38274
- this.#path = join19(this.#directory, "daemon.log");
38492
+ this.#directory = join21(stateDirectory, "logs");
38493
+ this.#path = join21(this.#directory, "daemon.log");
38275
38494
  this.#maximumBytes = maximumBytes;
38276
38495
  }
38277
38496
  // Export only correlation and failure metadata. Local messages and paths stay local.
@@ -39087,7 +39306,7 @@ var ActiveDaemonTurn = class {
39087
39306
  var MAX_SESSIONS_WITH_COMPLETED_RECOVERY = 32;
39088
39307
  var waitForTurnCompletion = (turn, waitSignal) => {
39089
39308
  waitSignal.throwIfAborted();
39090
- return new Promise((resolve9, reject) => {
39309
+ return new Promise((resolve10, reject) => {
39091
39310
  let settled = false;
39092
39311
  const finish = (result) => {
39093
39312
  if (settled) {
@@ -39096,7 +39315,7 @@ var waitForTurnCompletion = (turn, waitSignal) => {
39096
39315
  settled = true;
39097
39316
  waitSignal.removeEventListener("abort", onAbort);
39098
39317
  if (result.kind === "completed") {
39099
- resolve9();
39318
+ resolve10();
39100
39319
  } else {
39101
39320
  reject(result.error);
39102
39321
  }
@@ -39294,7 +39513,7 @@ var sessionEventCacheMigrations = [
39294
39513
 
39295
39514
  // src/infra/local-sqlite-database.ts
39296
39515
  import { chmodSync, mkdirSync as mkdirSync2 } from "node:fs";
39297
- import { dirname as dirname5 } from "node:path";
39516
+ import { dirname as dirname6 } from "node:path";
39298
39517
  import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
39299
39518
 
39300
39519
  // ../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.4_@cloudflare+workers-types@5.20260918.1_@types+better-sqlite3@7.6_f872c171b7e1945bb1fa42180063dab2/node_modules/drizzle-orm/node-sqlite/session.js
@@ -39405,7 +39624,7 @@ var LocalSqliteDatabase = class {
39405
39624
  orm;
39406
39625
  #sqlite;
39407
39626
  constructor(path2, label, migrations, pragmas = []) {
39408
- mkdirSync2(dirname5(path2), { mode: 448, recursive: true });
39627
+ mkdirSync2(dirname6(path2), { mode: 448, recursive: true });
39409
39628
  this.#sqlite = new DatabaseSync2(path2);
39410
39629
  chmodSync(path2, 384);
39411
39630
  try {
@@ -39964,10 +40183,11 @@ async function readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal,
39964
40183
  );
39965
40184
  }
39966
40185
  signal.throwIfAborted();
39967
- const child2 = spawn5(agent.agentIdentity.realPath, ["app-server"], {
40186
+ const launch = executableLaunch2(agent.agentIdentity.realPath, ["app-server"]);
40187
+ const child2 = spawn5(launch.command, [...launch.arguments], {
39968
40188
  cwd,
39969
40189
  env: { ...process.env, ...agent.environment },
39970
- detached: process.platform !== "win32",
40190
+ ...platformSpawnOptions,
39971
40191
  shell: false,
39972
40192
  stdio: ["pipe", "pipe", "ignore"]
39973
40193
  });
@@ -40771,7 +40991,7 @@ import { WebSocket as WebSocket5 } from "undici";
40771
40991
  // package.json
40772
40992
  var package_default = {
40773
40993
  name: "@moxt-ai/mobius",
40774
- version: "0.0.195",
40994
+ version: "0.0.196",
40775
40995
  description: "Mobius CLI for pairing and running local AI agent services.",
40776
40996
  type: "module",
40777
40997
  bin: {
@@ -40780,7 +41000,9 @@ var package_default = {
40780
41000
  types: "./src/index.ts",
40781
41001
  exports: {
40782
41002
  ".": "./src/index.ts",
40783
- "./runtime": "./src/runtime.ts"
41003
+ "./runtime": "./src/runtime.ts",
41004
+ "./process": "./src/process/executable.ts",
41005
+ "./filesystem": "./src/filesystem/private-path.ts"
40784
41006
  },
40785
41007
  files: [
40786
41008
  "dist"
@@ -40799,6 +41021,14 @@ var package_default = {
40799
41021
  "./runtime": {
40800
41022
  types: "./dist/runtime.d.ts",
40801
41023
  import: "./dist/runtime.js"
41024
+ },
41025
+ "./process": {
41026
+ types: "./dist/process/executable.d.ts",
41027
+ import: "./dist/process/executable.js"
41028
+ },
41029
+ "./filesystem": {
41030
+ types: "./dist/filesystem/private-path.d.ts",
41031
+ import: "./dist/filesystem/private-path.js"
40802
41032
  }
40803
41033
  }
40804
41034
  },
@@ -40808,7 +41038,7 @@ var package_default = {
40808
41038
  directory: "packages/cli"
40809
41039
  },
40810
41040
  scripts: {
40811
- build: "tsc --project tsconfig.build.json && esbuild src/cli.ts src/index.ts src/runtime.ts --bundle --platform=node --format=esm --sourcemap --outdir=dist --external:@agentclientprotocol/* --external:undici",
41041
+ build: "tsc --project tsconfig.build.json && esbuild src/cli.ts src/index.ts src/runtime.ts src/process/executable.ts src/filesystem/private-path.ts --bundle --platform=node --format=esm --sourcemap --outdir=dist --external:@agentclientprotocol/* --external:undici",
40812
41042
  dev: "node --watch src/cli.ts",
40813
41043
  prepack: "pnpm build",
40814
41044
  start: "node dist/cli.js",
@@ -41469,8 +41699,8 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
41469
41699
 
41470
41700
  // src/artifacts/local-file-streamer.ts
41471
41701
  import { createReadStream as createReadStream2 } from "node:fs";
41472
- import { realpath as realpath10, stat as stat9 } from "node:fs/promises";
41473
- import { basename as basename4, extname, isAbsolute as isAbsolute11, normalize as normalize4, resolve as resolve5 } from "node:path";
41702
+ import { realpath as realpath11, stat as stat9 } from "node:fs/promises";
41703
+ import { basename as basename4, extname as extname2, isAbsolute as isAbsolute11, normalize as normalize4, resolve as resolve6 } from "node:path";
41474
41704
  import { fileURLToPath as fileURLToPath2 } from "node:url";
41475
41705
  var CHUNK_BYTES = 192 * 1024;
41476
41706
  function requestedPath(value) {
@@ -41492,12 +41722,12 @@ async function resolveFile(value, workingDirectory, signal) {
41492
41722
  if (path2 === null || !isAbsolute11(path2) && workingDirectory === null) {
41493
41723
  return null;
41494
41724
  }
41495
- const requested = workingDirectory === null ? path2 : resolve5(workingDirectory, path2);
41725
+ const requested = workingDirectory === null ? path2 : resolve6(workingDirectory, path2);
41496
41726
  if (!isAbsolute11(requested) || isAbsolute11(path2) && normalize4(path2) !== path2) {
41497
41727
  return null;
41498
41728
  }
41499
41729
  try {
41500
- const target = await realpath10(requested);
41730
+ const target = await realpath11(requested);
41501
41731
  signal.throwIfAborted();
41502
41732
  return isAbsolute11(target) && normalize4(target) === target ? target : null;
41503
41733
  } catch {
@@ -41520,7 +41750,7 @@ async function streamLocalFile(command, send2, signal, workingDirectory, externa
41520
41750
  send2({
41521
41751
  byteLength: before.size,
41522
41752
  kind: FILE_BEGIN_KIND,
41523
- mediaType: external?.mediaType ?? raster?.mimeType ?? (extname(target).toLowerCase() === ".svg" ? "image/svg+xml" : "application/octet-stream"),
41753
+ mediaType: external?.mediaType ?? raster?.mimeType ?? (extname2(target).toLowerCase() === ".svg" ? "image/svg+xml" : "application/octet-stream"),
41524
41754
  modifiedAt: before.mtime.toISOString(),
41525
41755
  name: external?.name ?? (basename4(target) || "file"),
41526
41756
  requestId: command.requestId,
@@ -42422,13 +42652,13 @@ function createNativeSessionRequestHandler(dependencies) {
42422
42652
  operationSignal.throwIfAborted();
42423
42653
  const skipPrevious = command.action === "active-turn";
42424
42654
  if (previous.length > 0 && !skipPrevious) {
42425
- await new Promise((resolve9, reject) => {
42655
+ await new Promise((resolve10, reject) => {
42426
42656
  const onAbort = () => reject(operationSignal.reason);
42427
42657
  operationSignal.addEventListener("abort", onAbort, { once: true });
42428
42658
  void Promise.all(previous.map((request) => request.completion)).then(
42429
42659
  () => {
42430
42660
  operationSignal.removeEventListener("abort", onAbort);
42431
- resolve9();
42661
+ resolve10();
42432
42662
  },
42433
42663
  (error62) => {
42434
42664
  operationSignal.removeEventListener("abort", onAbort);
@@ -42862,7 +43092,7 @@ var RelayConnectionError = class extends Error {
42862
43092
  };
42863
43093
  function connectRelay(url2, signal) {
42864
43094
  signal.throwIfAborted();
42865
- return new Promise((resolve9, reject) => {
43095
+ return new Promise((resolve10, reject) => {
42866
43096
  const endpoint = new URL(url2);
42867
43097
  const headers = runtimeAuthorization(endpoint);
42868
43098
  endpoint.searchParams.delete("token");
@@ -42929,7 +43159,7 @@ function connectRelay(url2, signal) {
42929
43159
  }
42930
43160
  finished = true;
42931
43161
  cleanup();
42932
- resolve9(socket);
43162
+ resolve10(socket);
42933
43163
  };
42934
43164
  function onTimeout() {
42935
43165
  fail(
@@ -43111,7 +43341,7 @@ async function runRelayConnection({
43111
43341
  installationObserver.connect(socket);
43112
43342
  onConnected();
43113
43343
  try {
43114
- await new Promise((resolve9, reject) => {
43344
+ await new Promise((resolve10, reject) => {
43115
43345
  let finished = false;
43116
43346
  const cleanup = () => {
43117
43347
  connectionLiveness.close();
@@ -43129,7 +43359,7 @@ async function runRelayConnection({
43129
43359
  }
43130
43360
  finished = true;
43131
43361
  cleanup();
43132
- resolve9();
43362
+ resolve10();
43133
43363
  };
43134
43364
  const rejectConnection = (failure2) => {
43135
43365
  if (finished) {
@@ -43515,12 +43745,12 @@ function waitForRelayRetry(signal, timer) {
43515
43745
  if (signal.aborted) {
43516
43746
  return Promise.resolve();
43517
43747
  }
43518
- return new Promise((resolve9) => {
43748
+ return new Promise((resolve10) => {
43519
43749
  const retry = timer.schedule(finish, RELAY_RECONNECT_DELAY_MILLISECONDS);
43520
43750
  function finish() {
43521
43751
  retry.cancel();
43522
43752
  signal.removeEventListener("abort", finish);
43523
- resolve9();
43753
+ resolve10();
43524
43754
  }
43525
43755
  signal.addEventListener("abort", finish, { once: true });
43526
43756
  });
@@ -43576,11 +43806,11 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
43576
43806
  stateDirectory
43577
43807
  });
43578
43808
  const channelHash = createHash7("sha256").update(config2.channelId).digest("hex");
43579
- const sessionDatabase = openAcpSessionDatabase(join20(stateDirectory, "sessions", `${channelHash}.sqlite`));
43809
+ const sessionDatabase = openAcpSessionDatabase(join22(stateDirectory, "sessions", `${channelHash}.sqlite`));
43580
43810
  let eventsV2;
43581
43811
  try {
43582
43812
  eventsV2 = new CachedAcpSessionEventStoreV2(
43583
- openSessionEventCacheV2Database(join20(stateDirectory, "sessions", `${channelHash}.events.sqlite`))
43813
+ openSessionEventCacheV2Database(join22(stateDirectory, "sessions", `${channelHash}.events.sqlite`))
43584
43814
  );
43585
43815
  } catch (error62) {
43586
43816
  sessionDatabase.close();
@@ -43783,15 +44013,28 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
43783
44013
  }
43784
44014
 
43785
44015
  // src/pairing/pair-local-machine.ts
43786
- import { mkdir as mkdir6, realpath as realpath11, stat as stat10 } from "node:fs/promises";
44016
+ import { mkdir as mkdir6, realpath as realpath12, stat as stat10 } from "node:fs/promises";
43787
44017
  import { hostname as hostname3 } from "node:os";
43788
- import { basename as basename6, resolve as resolve7 } from "node:path";
44018
+ import { basename as basename6, resolve as resolve8 } from "node:path";
43789
44019
  import { fetch as fetch4 } from "undici";
43790
44020
 
43791
44021
  // src/storage/runtime-installation-store.ts
43792
44022
  import { createHash as createHash8, randomUUID as randomUUID9 } from "node:crypto";
43793
- import { mkdir as mkdir5, open as open5, readdir as readdir4, rename as rename4, unlink, writeFile as writeFile4 } from "node:fs/promises";
43794
- import { dirname as dirname6, join as join21, resolve as resolve6 } from "node:path";
44023
+ import { mkdir as mkdir5, open as open5, readdir as readdir4, rename as rename4, unlink as unlink2, writeFile as writeFile4 } from "node:fs/promises";
44024
+ import { dirname as dirname7, join as join23, resolve as resolve7 } from "node:path";
44025
+
44026
+ // src/filesystem/private-path.ts
44027
+ import { lstat as lstat3 } from "node:fs/promises";
44028
+ async function validateLocalPath(path2, directory, privateAccess, signal) {
44029
+ signal.throwIfAborted();
44030
+ const metadata = await lstat3(path2);
44031
+ if (metadata.isSymbolicLink() || (directory ? !metadata.isDirectory() : !metadata.isFile())) {
44032
+ throw new LocalPathError("Unsafe local path");
44033
+ }
44034
+ await platformSupportFor(process.platform).validatePathPermissions(path2, directory, privateAccess, signal);
44035
+ }
44036
+
44037
+ // src/storage/runtime-installation-store.ts
43795
44038
  var APPLICATION_ID_PATTERN = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+){1,31}$/;
43796
44039
  var CONNECTION_ID_PATTERN = /^mcn_[a-f0-9]{32}$/;
43797
44040
  var INSTALLATION_ID_PATTERN = /^min_[a-f0-9]{32}$/;
@@ -44033,8 +44276,8 @@ async function readJsonFile(path2, signal, missingCode) {
44033
44276
  }
44034
44277
  async function writeJsonAtomically(path2, value, signal) {
44035
44278
  signal.throwIfAborted();
44036
- const directory = dirname6(path2);
44037
- const temporaryPath = join21(directory, `.${randomUUID9()}.tmp`);
44279
+ const directory = dirname7(path2);
44280
+ const temporaryPath = join23(directory, `.${randomUUID9()}.tmp`);
44038
44281
  try {
44039
44282
  await mkdir5(directory, { mode: 448, recursive: true });
44040
44283
  signal.throwIfAborted();
@@ -44043,7 +44286,7 @@ async function writeJsonAtomically(path2, value, signal) {
44043
44286
  signal.throwIfAborted();
44044
44287
  await rename4(temporaryPath, path2);
44045
44288
  } catch (cause) {
44046
- await unlink(temporaryPath).catch(() => void 0);
44289
+ await unlink2(temporaryPath).catch(() => void 0);
44047
44290
  signal.throwIfAborted();
44048
44291
  throw new RuntimeInstallationStoreError("connection_unavailable", "The local Runtime state cannot be written", {
44049
44292
  cause
@@ -44060,15 +44303,17 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
44060
44303
  this.applicationId = applicationId;
44061
44304
  this.installationId = installationId2;
44062
44305
  this.stateDirectory = stateDirectory;
44063
- this.#channelDirectory = join21(stateDirectory, "channels");
44064
- this.#connectionDirectory = join21(stateDirectory, "connections");
44306
+ this.#channelDirectory = join23(stateDirectory, "channels");
44307
+ this.#connectionDirectory = join23(stateDirectory, "connections");
44065
44308
  }
44066
44309
  static open = async (options, signal) => {
44067
44310
  signal.throwIfAborted();
44068
44311
  const applicationId = validateApplicationId(options.applicationId);
44069
- const rootDirectory = resolve6(options.stateDirectory);
44070
- const applicationDirectory = join21(rootDirectory, "installations", applicationId);
44312
+ const rootDirectory = resolve7(options.stateDirectory);
44313
+ const applicationDirectory = join23(rootDirectory, "installations", applicationId);
44071
44314
  try {
44315
+ await mkdir5(rootDirectory, { mode: 448, recursive: true });
44316
+ await validateLocalPath(rootDirectory, true, true, signal);
44072
44317
  await mkdir5(applicationDirectory, { mode: 448, recursive: true });
44073
44318
  } catch (cause) {
44074
44319
  throw new RuntimeInstallationStoreError(
@@ -44080,7 +44325,7 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
44080
44325
  );
44081
44326
  }
44082
44327
  const storedInstallationId = await readOrCreateInstallationId(applicationDirectory, signal);
44083
- const stateDirectory = join21(applicationDirectory, storedInstallationId);
44328
+ const stateDirectory = join23(applicationDirectory, storedInstallationId);
44084
44329
  try {
44085
44330
  await mkdir5(stateDirectory, { mode: 448, recursive: true });
44086
44331
  } catch (cause) {
@@ -44095,8 +44340,8 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
44095
44340
  signal.throwIfAborted();
44096
44341
  return new _RuntimeInstallationStore(applicationId, storedInstallationId, stateDirectory);
44097
44342
  };
44098
- connectionPath = (connectionId2) => join21(this.#connectionDirectory, `${validateConnectionId(connectionId2)}.json`);
44099
- channelIndexPath = (channelId) => join21(this.#channelDirectory, channelIndexFileName(validateIdentifier(channelId, "invalid_channel_id")));
44343
+ connectionPath = (connectionId2) => join23(this.#connectionDirectory, `${validateConnectionId(connectionId2)}.json`);
44344
+ channelIndexPath = (channelId) => join23(this.#channelDirectory, channelIndexFileName(validateIdentifier(channelId, "invalid_channel_id")));
44100
44345
  readConnection = async (connectionId2, signal) => {
44101
44346
  const stored = decodeConnection(
44102
44347
  await readJsonFile(this.connectionPath(connectionId2), signal, "connection_not_found")
@@ -44219,9 +44464,9 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
44219
44464
  const connection = await this.readConnection(connectionId2, signal);
44220
44465
  signal.throwIfAborted();
44221
44466
  try {
44222
- await unlink(this.connectionPath(connection.connectionId));
44467
+ await unlink2(this.connectionPath(connection.connectionId));
44223
44468
  signal.throwIfAborted();
44224
- await unlink(this.channelIndexPath(connection.channelId));
44469
+ await unlink2(this.channelIndexPath(connection.channelId));
44225
44470
  } catch (cause) {
44226
44471
  signal.throwIfAborted();
44227
44472
  if (isNodeError(cause, "ENOENT")) {
@@ -44258,7 +44503,7 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
44258
44503
  };
44259
44504
  };
44260
44505
  async function readOrCreateInstallationId(applicationDirectory, signal) {
44261
- const pointerPath = join21(applicationDirectory, "current.json");
44506
+ const pointerPath = join23(applicationDirectory, "current.json");
44262
44507
  try {
44263
44508
  return decodeInstallationPointer(await readJsonFile(pointerPath, signal, "installation_not_found")).installationId;
44264
44509
  } catch (cause) {
@@ -44350,10 +44595,10 @@ function validatePairingId(value) {
44350
44595
  return value;
44351
44596
  }
44352
44597
  async function resolveDefaultWorkspace2(path2) {
44353
- const requestedWorkspace = resolve7(path2);
44598
+ const requestedWorkspace = resolve8(path2);
44354
44599
  try {
44355
44600
  await mkdir6(requestedWorkspace, { recursive: true, mode: 448 });
44356
- const defaultWorkspace = await realpath11(requestedWorkspace);
44601
+ const defaultWorkspace = await realpath12(requestedWorkspace);
44357
44602
  const metadata = await stat10(defaultWorkspace);
44358
44603
  if (!metadata.isDirectory()) {
44359
44604
  throw new PairingClientError("invalid_workspace", "The default workspace is not a directory");
@@ -44596,10 +44841,10 @@ function loadMobiusRuntimeConnection(environment = process.env) {
44596
44841
  });
44597
44842
  }
44598
44843
  async function resolveWorkspace(path2) {
44599
- const requested = resolve8(path2);
44844
+ const requested = resolve9(path2);
44600
44845
  try {
44601
44846
  await mkdir7(requested, { recursive: true, mode: 448 });
44602
- const resolved = await realpath12(requested);
44847
+ const resolved = await realpath13(requested);
44603
44848
  const metadata = await stat11(resolved);
44604
44849
  if (!metadata.isDirectory()) {
44605
44850
  throw new MobiusRuntimeConfigurationError("The Runtime workspace is not a directory");