@moxt-ai/mobius 0.0.336 → 0.0.337

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/cli.js +427 -353
  2. package/dist/cli.js.map +4 -4
  3. package/dist/runtime.js +350 -310
  4. package/dist/runtime.js.map +4 -4
  5. package/dist/util/filesystem/private-path.js +6 -324
  6. package/dist/util/filesystem/private-path.js.map +4 -4
  7. package/dist/util/platform/contracts.d.ts +0 -26
  8. package/dist/util/platform/contracts.d.ts.map +1 -1
  9. package/dist/util/platform/index.d.ts.map +1 -1
  10. package/dist/util/platform/index.js +1 -4
  11. package/dist/util/platform/index.js.map +1 -1
  12. package/dist/util/platform/linux.d.ts.map +1 -1
  13. package/dist/util/platform/linux.js +1 -117
  14. package/dist/util/platform/linux.js.map +1 -1
  15. package/dist/util/platform/macos.d.ts.map +1 -1
  16. package/dist/util/platform/macos.js +1 -4
  17. package/dist/util/platform/macos.js.map +1 -1
  18. package/dist/util/platform/posix.d.ts +0 -21
  19. package/dist/util/platform/posix.d.ts.map +1 -1
  20. package/dist/util/platform/posix.js +1 -104
  21. package/dist/util/platform/posix.js.map +1 -1
  22. package/dist/util/platform/windows.d.ts.map +1 -1
  23. package/dist/util/platform/windows.js +1 -107
  24. package/dist/util/platform/windows.js.map +1 -1
  25. package/dist/util/process/executable.d.ts +2 -2
  26. package/dist/util/process/executable.d.ts.map +1 -1
  27. package/dist/util/process/executable.js +31 -222
  28. package/dist/util/process/executable.js.map +4 -4
  29. package/dist/util/process/platform/contracts.d.ts +29 -0
  30. package/dist/util/process/platform/contracts.d.ts.map +1 -0
  31. package/dist/util/process/platform/contracts.js +2 -0
  32. package/dist/util/process/platform/contracts.js.map +1 -0
  33. package/dist/util/process/platform/index.d.ts +3 -0
  34. package/dist/util/process/platform/index.d.ts.map +1 -0
  35. package/dist/util/process/platform/index.js +20 -0
  36. package/dist/util/process/platform/index.js.map +1 -0
  37. package/dist/util/process/platform/linux.d.ts +3 -0
  38. package/dist/util/process/platform/linux.d.ts.map +1 -0
  39. package/dist/util/process/platform/linux.js +122 -0
  40. package/dist/util/process/platform/linux.js.map +1 -0
  41. package/dist/util/process/platform/macos.d.ts +3 -0
  42. package/dist/util/process/platform/macos.d.ts.map +1 -0
  43. package/dist/util/process/platform/macos.js +8 -0
  44. package/dist/util/process/platform/macos.js.map +1 -0
  45. package/dist/util/process/platform/posix.d.ts +25 -0
  46. package/dist/util/process/platform/posix.d.ts.map +1 -0
  47. package/dist/util/process/platform/posix.js +107 -0
  48. package/dist/util/process/platform/posix.js.map +1 -0
  49. package/dist/util/process/platform/windows.d.ts +3 -0
  50. package/dist/util/process/platform/windows.d.ts.map +1 -0
  51. package/dist/util/process/platform/windows.js +114 -0
  52. package/dist/util/process/platform/windows.js.map +1 -0
  53. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -2086,7 +2086,7 @@ var init_package = __esm({
2086
2086
  "package.json"() {
2087
2087
  package_default = {
2088
2088
  name: "@moxt-ai/mobius",
2089
- version: "0.0.336",
2089
+ version: "0.0.337",
2090
2090
  description: "Mobius CLI for pairing and running local AI agent services.",
2091
2091
  type: "module",
2092
2092
  bin: {
@@ -70440,11 +70440,270 @@ var init_path_error = __esm({
70440
70440
  });
70441
70441
 
70442
70442
  // src/util/platform/posix.ts
70443
- import { execFile as execFile2 } from "node:child_process";
70444
- import { constants as constants3 } from "node:fs";
70445
- import { access as access2, chmod, lstat as lstat2, realpath as realpath3, unlink as unlink3 } from "node:fs/promises";
70443
+ import { chmod, lstat as lstat2, unlink as unlink3 } from "node:fs/promises";
70446
70444
  import { tmpdir } from "node:os";
70447
70445
  import { join as join10 } from "node:path";
70446
+ async function removeControlSocket(path8) {
70447
+ try {
70448
+ await unlink3(path8);
70449
+ } catch (cause) {
70450
+ if (!(cause instanceof Error) || !("code" in cause) || cause.code !== "ENOENT") {
70451
+ throw cause;
70452
+ }
70453
+ }
70454
+ }
70455
+ var posixOperations;
70456
+ var init_posix = __esm({
70457
+ "src/util/platform/posix.ts"() {
70458
+ "use strict";
70459
+ init_path_error();
70460
+ posixOperations = {
70461
+ controlSocketPath: (installationHash) => join10(tmpdir(), `mobius-${installationHash}.sock`),
70462
+ prepareControlSocket: removeControlSocket,
70463
+ secureControlSocket: async (path8) => {
70464
+ await chmod(path8, 384);
70465
+ },
70466
+ removeControlSocket,
70467
+ validatePathPermissions: async (path8, directory, privateAccess, signal) => {
70468
+ signal.throwIfAborted();
70469
+ const metadata = await lstat2(path8);
70470
+ if (process.getuid === void 0 || metadata.uid !== process.getuid()) {
70471
+ throw new LocalPathError("Path is not user-owned");
70472
+ }
70473
+ if (privateAccess) {
70474
+ await chmod(path8, directory ? 448 : 384);
70475
+ }
70476
+ signal.throwIfAborted();
70477
+ }
70478
+ };
70479
+ }
70480
+ });
70481
+
70482
+ // src/util/platform/linux.ts
70483
+ import { isAbsolute as isAbsolute5, join as join11 } from "node:path";
70484
+ var linuxPlatform;
70485
+ var init_linux = __esm({
70486
+ "src/util/platform/linux.ts"() {
70487
+ "use strict";
70488
+ init_posix();
70489
+ linuxPlatform = {
70490
+ ...posixOperations,
70491
+ claudeCodeExecutablePaths: (environment) => {
70492
+ const homeDirectory = environment["HOME"];
70493
+ return homeDirectory !== void 0 && isAbsolute5(homeDirectory) ? [join11(homeDirectory, ".local", "bin", "claude")] : [];
70494
+ }
70495
+ };
70496
+ }
70497
+ });
70498
+
70499
+ // src/util/platform/claude-desktop.ts
70500
+ import { readdirSync as readdirSync2 } from "node:fs";
70501
+ import { join as join12 } from "node:path";
70502
+ function installedDirectories(directory) {
70503
+ try {
70504
+ return readdirSync2(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
70505
+ } catch (cause) {
70506
+ if (cause instanceof Error && "code" in cause && (cause.code === "ENOENT" || cause.code === "ENOTDIR" || cause.code === "EACCES")) {
70507
+ return [];
70508
+ }
70509
+ throw cause;
70510
+ }
70511
+ }
70512
+ function claudeDesktopExecutablePaths(roots, executablePaths) {
70513
+ const paths = [];
70514
+ for (const root of roots) {
70515
+ const versions = installedDirectories(root).filter((version2) => /^\d+\.\d+\.\d+$/.test(version2)).toSorted((left, right) => right.localeCompare(left, "en", { numeric: true }));
70516
+ for (const version2 of versions) {
70517
+ const directory = join12(root, version2);
70518
+ const installations = [
70519
+ directory,
70520
+ ...installedDirectories(directory).map((build) => join12(directory, build))
70521
+ ];
70522
+ for (const installation of installations) {
70523
+ for (const executablePath of executablePaths) {
70524
+ paths.push(join12(installation, ...executablePath));
70525
+ }
70526
+ }
70527
+ }
70528
+ }
70529
+ return paths;
70530
+ }
70531
+ var init_claude_desktop = __esm({
70532
+ "src/util/platform/claude-desktop.ts"() {
70533
+ "use strict";
70534
+ }
70535
+ });
70536
+
70537
+ // src/util/platform/macos.ts
70538
+ import { isAbsolute as isAbsolute6, join as join13 } from "node:path";
70539
+ var macosPlatform;
70540
+ var init_macos = __esm({
70541
+ "src/util/platform/macos.ts"() {
70542
+ "use strict";
70543
+ init_claude_desktop();
70544
+ init_posix();
70545
+ macosPlatform = {
70546
+ ...posixOperations,
70547
+ claudeCodeExecutablePaths: (environment) => {
70548
+ const paths = ["/opt/homebrew/bin/claude", "/usr/local/bin/claude"];
70549
+ const homeDirectory = environment["HOME"];
70550
+ if (homeDirectory !== void 0 && isAbsolute6(homeDirectory)) {
70551
+ paths.unshift(join13(homeDirectory, ".local", "bin", "claude"));
70552
+ paths.push(
70553
+ ...claudeDesktopExecutablePaths(
70554
+ [join13(homeDirectory, "Library", "Application Support", "Claude", "claude-code")],
70555
+ [["claude.app", "Contents", "MacOS", "claude"], ["claude"]]
70556
+ )
70557
+ );
70558
+ }
70559
+ return paths;
70560
+ }
70561
+ };
70562
+ }
70563
+ });
70564
+
70565
+ // src/util/platform/windows.ts
70566
+ import { execFile as execFile2 } from "node:child_process";
70567
+ import { isAbsolute as isAbsolute7, join as join14 } from "node:path";
70568
+ import { promisify as promisify2 } from "node:util";
70569
+ function environmentValue(environment, name2) {
70570
+ return Object.entries(environment).find(([key]) => key.toUpperCase() === name2.toUpperCase())?.[1];
70571
+ }
70572
+ function desktopClaudeExecutablePaths(environment) {
70573
+ const roots = [];
70574
+ const localAppData = environmentValue(environment, "LOCALAPPDATA");
70575
+ if (localAppData !== void 0 && isAbsolute7(localAppData)) {
70576
+ const dataDirectory = join14(localAppData, "Claude-Data");
70577
+ for (const installation of installedDirectories(dataDirectory)) {
70578
+ if (installation.startsWith("claude_")) {
70579
+ roots.push(join14(dataDirectory, installation, "claude-code"));
70580
+ }
70581
+ }
70582
+ }
70583
+ const appData = environmentValue(environment, "APPDATA");
70584
+ if (appData !== void 0 && isAbsolute7(appData)) {
70585
+ roots.push(join14(appData, "Claude", "claude-code"));
70586
+ }
70587
+ return claudeDesktopExecutablePaths(roots, [["claude.exe"]]);
70588
+ }
70589
+ async function validatePathPermissions(path8, _directory, privateAccess, signal) {
70590
+ signal.throwIfAborted();
70591
+ const systemRoot = environmentValue(process.env, "SystemRoot");
70592
+ if (systemRoot === void 0) {
70593
+ throw new LocalPathError("Windows system directory is unavailable");
70594
+ }
70595
+ try {
70596
+ await execute(
70597
+ join14(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"),
70598
+ [
70599
+ "-NoLogo",
70600
+ "-NoProfile",
70601
+ "-NonInteractive",
70602
+ "-EncodedCommand",
70603
+ Buffer.from(windowsPermissions, "utf16le").toString("base64")
70604
+ ],
70605
+ {
70606
+ env: {
70607
+ ...process.env,
70608
+ MOBIUS_PERMISSION_PATH: path8,
70609
+ MOBIUS_PERMISSION_PRIVATE: privateAccess ? "1" : "0"
70610
+ },
70611
+ windowsHide: true,
70612
+ signal: AbortSignal.any([signal, AbortSignal.timeout(windowsPermissionsTimeoutMs)]),
70613
+ timeout: windowsPermissionsTimeoutMs,
70614
+ maxBuffer: 16384
70615
+ }
70616
+ );
70617
+ } catch (cause) {
70618
+ signal.throwIfAborted();
70619
+ throw new LocalPathError("The local path permissions could not be secured", { cause });
70620
+ }
70621
+ }
70622
+ var execute, windowsPermissions, windowsPermissionsTimeoutMs, windowsPlatform;
70623
+ var init_windows = __esm({
70624
+ "src/util/platform/windows.ts"() {
70625
+ "use strict";
70626
+ init_path_error();
70627
+ init_claude_desktop();
70628
+ execute = promisify2(execFile2);
70629
+ windowsPermissions = `
70630
+ $ErrorActionPreference = 'Stop'
70631
+ $ProgressPreference = 'SilentlyContinue'
70632
+ $item = Get-Item -LiteralPath $env:MOBIUS_PERMISSION_PATH -Force
70633
+ if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'Unsafe path' }
70634
+ $sid = [Security.Principal.WindowsIdentity]::GetCurrent().User
70635
+ $acl = $item.GetAccessControl()
70636
+ $owner = $acl.GetOwner([Security.Principal.SecurityIdentifier])
70637
+ 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' }
70638
+ if ($env:MOBIUS_PERMISSION_PRIVATE -eq '1') {
70639
+ if ($item.PSIsContainer) {
70640
+ $private = New-Object Security.AccessControl.DirectorySecurity
70641
+ $rule = New-Object Security.AccessControl.FileSystemAccessRule($sid, 'FullControl', 'ContainerInherit,ObjectInherit', 'None', 'Allow')
70642
+ } else {
70643
+ $private = New-Object Security.AccessControl.FileSecurity
70644
+ $rule = New-Object Security.AccessControl.FileSystemAccessRule($sid, 'FullControl', 'Allow')
70645
+ }
70646
+ $private.SetOwner($sid)
70647
+ $private.SetAccessRuleProtection($true, $false)
70648
+ $private.AddAccessRule($rule)
70649
+ $item.SetAccessControl($private)
70650
+ }
70651
+ `;
70652
+ windowsPermissionsTimeoutMs = 3e4;
70653
+ windowsPlatform = {
70654
+ controlSocketPath: (installationHash) => `\\\\.\\pipe\\mobius-${installationHash}`,
70655
+ prepareControlSocket: async () => {
70656
+ },
70657
+ secureControlSocket: async () => {
70658
+ },
70659
+ removeControlSocket: async () => {
70660
+ },
70661
+ validatePathPermissions,
70662
+ claudeCodeExecutablePaths: (environment) => {
70663
+ const paths = [];
70664
+ const userProfile = environmentValue(environment, "USERPROFILE");
70665
+ if (userProfile !== void 0 && isAbsolute7(userProfile)) {
70666
+ paths.push(join14(userProfile, ".local", "bin", "claude.exe"));
70667
+ }
70668
+ const localAppData = environmentValue(environment, "LOCALAPPDATA");
70669
+ if (localAppData !== void 0 && isAbsolute7(localAppData)) {
70670
+ paths.push(join14(localAppData, "Microsoft", "WinGet", "Links", "claude.exe"));
70671
+ }
70672
+ paths.push(...desktopClaudeExecutablePaths(environment));
70673
+ return paths;
70674
+ }
70675
+ };
70676
+ }
70677
+ });
70678
+
70679
+ // src/util/platform/index.ts
70680
+ function platformSupportFor(platform2) {
70681
+ return platforms.get(platform2) ?? fallbackPlatform;
70682
+ }
70683
+ var fallbackPlatform, platforms;
70684
+ var init_platform = __esm({
70685
+ "src/util/platform/index.ts"() {
70686
+ "use strict";
70687
+ init_linux();
70688
+ init_macos();
70689
+ init_posix();
70690
+ init_windows();
70691
+ fallbackPlatform = {
70692
+ ...posixOperations,
70693
+ claudeCodeExecutablePaths: () => []
70694
+ };
70695
+ platforms = /* @__PURE__ */ new Map([
70696
+ ["linux", linuxPlatform],
70697
+ ["darwin", macosPlatform],
70698
+ ["win32", windowsPlatform]
70699
+ ]);
70700
+ }
70701
+ });
70702
+
70703
+ // src/util/process/platform/posix.ts
70704
+ import { execFile as execFile3 } from "node:child_process";
70705
+ import { constants as constants3 } from "node:fs";
70706
+ import { access as access2, realpath as realpath3 } from "node:fs/promises";
70448
70707
  function parseProcessTable(output2) {
70449
70708
  const entries = [];
70450
70709
  for (const line of output2.split("\n")) {
@@ -70464,7 +70723,7 @@ function parseProcessTable(output2) {
70464
70723
  }
70465
70724
  function readProcessTableWithPs(executable) {
70466
70725
  return new Promise((resolveTable) => {
70467
- execFile2(
70726
+ execFile3(
70468
70727
  executable,
70469
70728
  ["-axo", "pid=,ppid=,pgid="],
70470
70729
  {
@@ -70522,29 +70781,13 @@ function terminateProcess(child, signal) {
70522
70781
  }
70523
70782
  child.kill(signal);
70524
70783
  }
70525
- async function removeControlSocket(path8) {
70526
- try {
70527
- await unlink3(path8);
70528
- } catch (cause) {
70529
- if (!(cause instanceof Error) || !("code" in cause) || cause.code !== "ENOENT") {
70530
- throw cause;
70531
- }
70532
- }
70533
- }
70534
- var PROCESS_TABLE_TIMEOUT_MILLISECONDS, PROCESS_TABLE_OUTPUT_LIMIT_BYTES, posixOperations;
70535
- var init_posix = __esm({
70536
- "src/util/platform/posix.ts"() {
70784
+ var PROCESS_TABLE_TIMEOUT_MILLISECONDS, PROCESS_TABLE_OUTPUT_LIMIT_BYTES, posixOperations2;
70785
+ var init_posix2 = __esm({
70786
+ "src/util/process/platform/posix.ts"() {
70537
70787
  "use strict";
70538
- init_path_error();
70539
70788
  PROCESS_TABLE_TIMEOUT_MILLISECONDS = 1e3;
70540
70789
  PROCESS_TABLE_OUTPUT_LIMIT_BYTES = 1024 * 1024;
70541
- posixOperations = {
70542
- controlSocketPath: (installationHash) => join10(tmpdir(), `mobius-${installationHash}.sock`),
70543
- prepareControlSocket: removeControlSocket,
70544
- secureControlSocket: async (path8) => {
70545
- await chmod(path8, 384);
70546
- },
70547
- removeControlSocket,
70790
+ posixOperations2 = {
70548
70791
  pathDelimiter: ":",
70549
70792
  environmentValue: (environment, name2) => environment[name2],
70550
70793
  executableExtensions: () => [""],
@@ -70556,26 +70799,15 @@ var init_posix = __esm({
70556
70799
  executableLaunch: (command, args) => ({ command, arguments: args }),
70557
70800
  spawnOptions: { detached: true, windowsHide: true },
70558
70801
  signalCapturedProcesses,
70559
- terminateProcess,
70560
- validatePathPermissions: async (path8, directory, privateAccess, signal) => {
70561
- signal.throwIfAborted();
70562
- const metadata = await lstat2(path8);
70563
- if (process.getuid === void 0 || metadata.uid !== process.getuid()) {
70564
- throw new LocalPathError("Path is not user-owned");
70565
- }
70566
- if (privateAccess) {
70567
- await chmod(path8, directory ? 448 : 384);
70568
- }
70569
- signal.throwIfAborted();
70570
- }
70802
+ terminateProcess
70571
70803
  };
70572
70804
  }
70573
70805
  });
70574
70806
 
70575
- // src/util/platform/linux.ts
70576
- import { constants as constants4, readdirSync as readdirSync2, readFileSync as readFileSync2 } from "node:fs";
70807
+ // src/util/process/platform/linux.ts
70808
+ import { constants as constants4, readdirSync as readdirSync3, readFileSync as readFileSync2 } from "node:fs";
70577
70809
  import { access as access3, readdir as readdir4, readFile as readFile4, realpath as realpath4, stat as stat4 } from "node:fs/promises";
70578
- import { isAbsolute as isAbsolute5, join as join11 } from "node:path";
70810
+ import { join as join15 } from "node:path";
70579
70811
  function appendLinuxProcessTableEntry(entries, processId, encoded) {
70580
70812
  const closingParenthesis = encoded.lastIndexOf(")");
70581
70813
  if (!encoded.startsWith(`${processId.toString()} (`) || closingParenthesis < 0) {
@@ -70605,7 +70837,7 @@ async function readLinuxProcessTable() {
70605
70837
  appendLinuxProcessTableEntry(
70606
70838
  entries,
70607
70839
  processId,
70608
- await readFile4(join11("/proc", directory.name, "stat"), "utf8")
70840
+ await readFile4(join15("/proc", directory.name, "stat"), "utf8")
70609
70841
  );
70610
70842
  } catch {
70611
70843
  }
@@ -70617,7 +70849,7 @@ async function readLinuxProcessTable() {
70617
70849
  function readLinuxProcessTableSynchronously() {
70618
70850
  const entries = [];
70619
70851
  try {
70620
- const directories = readdirSync2("/proc", { withFileTypes: true });
70852
+ const directories = readdirSync3("/proc", { withFileTypes: true });
70621
70853
  for (const directory of directories) {
70622
70854
  if (!directory.isDirectory() || !/^\d+$/.test(directory.name)) {
70623
70855
  continue;
@@ -70630,7 +70862,7 @@ function readLinuxProcessTableSynchronously() {
70630
70862
  appendLinuxProcessTableEntry(
70631
70863
  entries,
70632
70864
  processId,
70633
- readFileSync2(join11("/proc", directory.name, "stat"), "utf8")
70865
+ readFileSync2(join15("/proc", directory.name, "stat"), "utf8")
70634
70866
  );
70635
70867
  } catch {
70636
70868
  }
@@ -70663,7 +70895,7 @@ async function readLinuxProcessTableWithFallback() {
70663
70895
  }
70664
70896
  function processExists2(processId) {
70665
70897
  try {
70666
- const encoded = readFileSync2(join11("/proc", processId.toString(), "stat"), "utf8");
70898
+ const encoded = readFileSync2(join15("/proc", processId.toString(), "stat"), "utf8");
70667
70899
  const closingParenthesis = encoded.lastIndexOf(")");
70668
70900
  if (closingParenthesis >= 0) {
70669
70901
  const processState = encoded.slice(closingParenthesis + 1).trimStart().charAt(0);
@@ -70675,89 +70907,31 @@ function processExists2(processId) {
70675
70907
  }
70676
70908
  return processExists(processId);
70677
70909
  }
70678
- var linuxPlatform;
70679
- var init_linux = __esm({
70680
- "src/util/platform/linux.ts"() {
70910
+ var linuxProcessPlatform;
70911
+ var init_linux2 = __esm({
70912
+ "src/util/process/platform/linux.ts"() {
70681
70913
  "use strict";
70682
- init_posix();
70683
- linuxPlatform = {
70684
- ...posixOperations,
70914
+ init_posix2();
70915
+ linuxProcessPlatform = {
70916
+ ...posixOperations2,
70685
70917
  readProcessTable: readLinuxProcessTableWithFallback,
70686
70918
  readProcessTableSynchronously: readLinuxProcessTableSynchronously,
70687
- processExists: processExists2,
70688
- claudeCodeExecutablePaths: (environment) => {
70689
- const homeDirectory = environment["HOME"];
70690
- return homeDirectory !== void 0 && isAbsolute5(homeDirectory) ? [join11(homeDirectory, ".local", "bin", "claude")] : [];
70691
- }
70919
+ processExists: processExists2
70692
70920
  };
70693
70921
  }
70694
70922
  });
70695
70923
 
70696
- // src/util/platform/claude-desktop.ts
70697
- import { readdirSync as readdirSync3 } from "node:fs";
70698
- import { join as join12 } from "node:path";
70699
- function installedDirectories(directory) {
70700
- try {
70701
- return readdirSync3(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
70702
- } catch (cause) {
70703
- if (cause instanceof Error && "code" in cause && (cause.code === "ENOENT" || cause.code === "ENOTDIR" || cause.code === "EACCES")) {
70704
- return [];
70705
- }
70706
- throw cause;
70707
- }
70708
- }
70709
- function claudeDesktopExecutablePaths(roots, executablePaths) {
70710
- const paths = [];
70711
- for (const root of roots) {
70712
- const versions = installedDirectories(root).filter((version2) => /^\d+\.\d+\.\d+$/.test(version2)).toSorted((left, right) => right.localeCompare(left, "en", { numeric: true }));
70713
- for (const version2 of versions) {
70714
- const directory = join12(root, version2);
70715
- const installations = [
70716
- directory,
70717
- ...installedDirectories(directory).map((build) => join12(directory, build))
70718
- ];
70719
- for (const installation of installations) {
70720
- for (const executablePath of executablePaths) {
70721
- paths.push(join12(installation, ...executablePath));
70722
- }
70723
- }
70724
- }
70725
- }
70726
- return paths;
70727
- }
70728
- var init_claude_desktop = __esm({
70729
- "src/util/platform/claude-desktop.ts"() {
70924
+ // src/util/process/platform/macos.ts
70925
+ var macosProcessPlatform;
70926
+ var init_macos2 = __esm({
70927
+ "src/util/process/platform/macos.ts"() {
70730
70928
  "use strict";
70731
- }
70732
- });
70733
-
70734
- // src/util/platform/macos.ts
70735
- import { isAbsolute as isAbsolute6, join as join13 } from "node:path";
70736
- var macosPlatform;
70737
- var init_macos = __esm({
70738
- "src/util/platform/macos.ts"() {
70739
- "use strict";
70740
- init_claude_desktop();
70741
- init_posix();
70742
- macosPlatform = {
70743
- ...posixOperations,
70929
+ init_posix2();
70930
+ macosProcessPlatform = {
70931
+ ...posixOperations2,
70744
70932
  readProcessTable: () => readProcessTableWithPs("/bin/ps"),
70745
70933
  readProcessTableSynchronously: () => [],
70746
- processExists,
70747
- claudeCodeExecutablePaths: (environment) => {
70748
- const paths = ["/opt/homebrew/bin/claude", "/usr/local/bin/claude"];
70749
- const homeDirectory = environment["HOME"];
70750
- if (homeDirectory !== void 0 && isAbsolute6(homeDirectory)) {
70751
- paths.unshift(join13(homeDirectory, ".local", "bin", "claude"));
70752
- paths.push(
70753
- ...claudeDesktopExecutablePaths(
70754
- [join13(homeDirectory, "Library", "Application Support", "Claude", "claude-code")],
70755
- [["claude.app", "Contents", "MacOS", "claude"], ["claude"]]
70756
- )
70757
- );
70758
- }
70759
- return paths;
70760
- }
70934
+ processExists
70761
70935
  };
70762
70936
  }
70763
70937
  });
@@ -70778,36 +70952,18 @@ var init_process_error = __esm({
70778
70952
  }
70779
70953
  });
70780
70954
 
70781
- // src/util/platform/windows.ts
70782
- import { execFile as execFile3 } from "node:child_process";
70955
+ // src/util/process/platform/windows.ts
70956
+ import { execFile as execFile4 } from "node:child_process";
70783
70957
  import { readFile as readFile5, realpath as realpath5 } from "node:fs/promises";
70784
- import { dirname as dirname7, extname, isAbsolute as isAbsolute7, join as join14, resolve as resolve8 } from "node:path";
70785
- import { promisify as promisify2 } from "node:util";
70786
- function environmentValue(environment, name2) {
70958
+ import { dirname as dirname7, extname, join as join16, resolve as resolve8 } from "node:path";
70959
+ function environmentValue2(environment, name2) {
70787
70960
  return Object.entries(environment).find(([key]) => key.toUpperCase() === name2.toUpperCase())?.[1];
70788
70961
  }
70789
- function desktopClaudeExecutablePaths(environment) {
70790
- const roots = [];
70791
- const localAppData = environmentValue(environment, "LOCALAPPDATA");
70792
- if (localAppData !== void 0 && isAbsolute7(localAppData)) {
70793
- const dataDirectory = join14(localAppData, "Claude-Data");
70794
- for (const installation of installedDirectories(dataDirectory)) {
70795
- if (installation.startsWith("claude_")) {
70796
- roots.push(join14(dataDirectory, installation, "claude-code"));
70797
- }
70798
- }
70799
- }
70800
- const appData = environmentValue(environment, "APPDATA");
70801
- if (appData !== void 0 && isAbsolute7(appData)) {
70802
- roots.push(join14(appData, "Claude", "claude-code"));
70803
- }
70804
- return claudeDesktopExecutablePaths(roots, [["claude.exe"]]);
70805
- }
70806
70962
  function executableExtensions(executableName, environment) {
70807
70963
  if (/\.[a-zA-Z0-9]+$/.test(executableName)) {
70808
70964
  return [""];
70809
70965
  }
70810
- const configured = environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD";
70966
+ const configured = environmentValue2(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD";
70811
70967
  const extensions = configured.split(";").map((extension) => extension.trim()).filter((extension) => extension.length > 0).map((extension) => extension.startsWith(".") ? extension : `.${extension}`);
70812
70968
  return extensions.length > 0 ? extensions : [".EXE"];
70813
70969
  }
@@ -70855,13 +71011,13 @@ function executableLaunch(command, args) {
70855
71011
  return { command, arguments: args };
70856
71012
  }
70857
71013
  function readProcessTable() {
70858
- const systemRoot = environmentValue(process.env, "SystemRoot");
71014
+ const systemRoot = environmentValue2(process.env, "SystemRoot");
70859
71015
  if (systemRoot === void 0) {
70860
71016
  return Promise.resolve([]);
70861
71017
  }
70862
71018
  return new Promise((resolveTable) => {
70863
- execFile3(
70864
- join14(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"),
71019
+ execFile4(
71020
+ join16(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"),
70865
71021
  [
70866
71022
  "-NoLogo",
70867
71023
  "-NoProfile",
@@ -70894,132 +71050,50 @@ function terminateProcess2(child, signal) {
70894
71050
  }
70895
71051
  child.kill(signal);
70896
71052
  }
70897
- async function validatePathPermissions(path8, _directory, privateAccess, signal) {
70898
- signal.throwIfAborted();
70899
- const systemRoot = environmentValue(process.env, "SystemRoot");
70900
- if (systemRoot === void 0) {
70901
- throw new LocalPathError("Windows system directory is unavailable");
70902
- }
70903
- try {
70904
- await execute(
70905
- join14(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"),
70906
- [
70907
- "-NoLogo",
70908
- "-NoProfile",
70909
- "-NonInteractive",
70910
- "-EncodedCommand",
70911
- Buffer.from(windowsPermissions, "utf16le").toString("base64")
70912
- ],
70913
- {
70914
- env: {
70915
- ...process.env,
70916
- MOBIUS_PERMISSION_PATH: path8,
70917
- MOBIUS_PERMISSION_PRIVATE: privateAccess ? "1" : "0"
70918
- },
70919
- windowsHide: true,
70920
- signal: AbortSignal.any([signal, AbortSignal.timeout(windowsPermissionsTimeoutMs)]),
70921
- timeout: windowsPermissionsTimeoutMs,
70922
- maxBuffer: 16384
70923
- }
70924
- );
70925
- } catch (cause) {
70926
- signal.throwIfAborted();
70927
- throw new LocalPathError("The local path permissions could not be secured", { cause });
70928
- }
70929
- }
70930
- var execute, windowsPermissions, windowsPermissionsTimeoutMs, windowsPlatform;
70931
- var init_windows = __esm({
70932
- "src/util/platform/windows.ts"() {
71053
+ var windowsProcessPlatform;
71054
+ var init_windows2 = __esm({
71055
+ "src/util/process/platform/windows.ts"() {
70933
71056
  "use strict";
70934
- init_path_error();
70935
71057
  init_process_error();
70936
- init_claude_desktop();
70937
- init_posix();
70938
- execute = promisify2(execFile3);
70939
- windowsPermissions = `
70940
- $ErrorActionPreference = 'Stop'
70941
- $ProgressPreference = 'SilentlyContinue'
70942
- $item = Get-Item -LiteralPath $env:MOBIUS_PERMISSION_PATH -Force
70943
- if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'Unsafe path' }
70944
- $sid = [Security.Principal.WindowsIdentity]::GetCurrent().User
70945
- $acl = $item.GetAccessControl()
70946
- $owner = $acl.GetOwner([Security.Principal.SecurityIdentifier])
70947
- 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' }
70948
- if ($env:MOBIUS_PERMISSION_PRIVATE -eq '1') {
70949
- if ($item.PSIsContainer) {
70950
- $private = New-Object Security.AccessControl.DirectorySecurity
70951
- $rule = New-Object Security.AccessControl.FileSystemAccessRule($sid, 'FullControl', 'ContainerInherit,ObjectInherit', 'None', 'Allow')
70952
- } else {
70953
- $private = New-Object Security.AccessControl.FileSecurity
70954
- $rule = New-Object Security.AccessControl.FileSystemAccessRule($sid, 'FullControl', 'Allow')
70955
- }
70956
- $private.SetOwner($sid)
70957
- $private.SetAccessRuleProtection($true, $false)
70958
- $private.AddAccessRule($rule)
70959
- $item.SetAccessControl($private)
70960
- }
70961
- `;
70962
- windowsPermissionsTimeoutMs = 3e4;
70963
- windowsPlatform = {
70964
- controlSocketPath: (installationHash) => `\\\\.\\pipe\\mobius-${installationHash}`,
70965
- prepareControlSocket: async () => {
70966
- },
70967
- secureControlSocket: async () => {
70968
- },
70969
- removeControlSocket: async () => {
70970
- },
71058
+ init_posix2();
71059
+ windowsProcessPlatform = {
70971
71060
  pathDelimiter: ";",
70972
- environmentValue,
71061
+ environmentValue: environmentValue2,
70973
71062
  executableExtensions,
70974
71063
  resolveExecutableTarget,
70975
71064
  executableLaunch,
70976
71065
  spawnOptions: { detached: false, windowsHide: true },
70977
71066
  signalCapturedProcesses: signalCapturedProcesses2,
70978
71067
  terminateProcess: terminateProcess2,
70979
- validatePathPermissions,
70980
71068
  readProcessTable,
70981
71069
  readProcessTableSynchronously: () => [],
70982
- processExists,
70983
- claudeCodeExecutablePaths: (environment) => {
70984
- const paths = [];
70985
- const userProfile = environmentValue(environment, "USERPROFILE");
70986
- if (userProfile !== void 0 && isAbsolute7(userProfile)) {
70987
- paths.push(join14(userProfile, ".local", "bin", "claude.exe"));
70988
- }
70989
- const localAppData = environmentValue(environment, "LOCALAPPDATA");
70990
- if (localAppData !== void 0 && isAbsolute7(localAppData)) {
70991
- paths.push(join14(localAppData, "Microsoft", "WinGet", "Links", "claude.exe"));
70992
- }
70993
- paths.push(...desktopClaudeExecutablePaths(environment));
70994
- return paths;
70995
- }
71070
+ processExists
70996
71071
  };
70997
71072
  }
70998
71073
  });
70999
71074
 
71000
- // src/util/platform/index.ts
71001
- function platformSupportFor(platform2) {
71002
- return platforms.get(platform2) ?? fallbackPlatform;
71075
+ // src/util/process/platform/index.ts
71076
+ function processPlatformSupportFor(platform2) {
71077
+ return platforms2.get(platform2) ?? fallbackPlatform2;
71003
71078
  }
71004
- var fallbackPlatform, platforms;
71005
- var init_platform = __esm({
71006
- "src/util/platform/index.ts"() {
71079
+ var fallbackPlatform2, platforms2;
71080
+ var init_platform2 = __esm({
71081
+ "src/util/process/platform/index.ts"() {
71007
71082
  "use strict";
71008
- init_linux();
71009
- init_macos();
71010
- init_posix();
71011
- init_windows();
71012
- fallbackPlatform = {
71013
- ...posixOperations,
71083
+ init_linux2();
71084
+ init_macos2();
71085
+ init_posix2();
71086
+ init_windows2();
71087
+ fallbackPlatform2 = {
71088
+ ...posixOperations2,
71014
71089
  readProcessTable: () => readProcessTableWithPs("/usr/bin/ps"),
71015
71090
  readProcessTableSynchronously: () => [],
71016
- processExists,
71017
- claudeCodeExecutablePaths: () => []
71091
+ processExists
71018
71092
  };
71019
- platforms = /* @__PURE__ */ new Map([
71020
- ["linux", linuxPlatform],
71021
- ["darwin", macosPlatform],
71022
- ["win32", windowsPlatform]
71093
+ platforms2 = /* @__PURE__ */ new Map([
71094
+ ["linux", linuxProcessPlatform],
71095
+ ["darwin", macosProcessPlatform],
71096
+ ["win32", windowsProcessPlatform]
71023
71097
  ]);
71024
71098
  }
71025
71099
  });
@@ -71027,11 +71101,11 @@ var init_platform = __esm({
71027
71101
  // src/util/process/executable.ts
71028
71102
  import { spawn as spawn3 } from "node:child_process";
71029
71103
  import { stat as stat5 } from "node:fs/promises";
71030
- import { join as join15, resolve as resolve9 } from "node:path";
71104
+ import { join as join17, resolve as resolve9 } from "node:path";
71031
71105
  async function resolveExecutablePath(requestedPath2, platform2 = process.platform) {
71032
71106
  const absoluteRequestedPath = resolve9(requestedPath2);
71033
71107
  try {
71034
- const resolvedPath = await platformSupportFor(platform2).resolveExecutableTarget(absoluteRequestedPath);
71108
+ const resolvedPath = await processPlatformSupportFor(platform2).resolveExecutableTarget(absoluteRequestedPath);
71035
71109
  const metadata = await stat5(resolvedPath);
71036
71110
  if (!metadata.isFile()) {
71037
71111
  return null;
@@ -71051,7 +71125,7 @@ async function resolveExecutablePath(requestedPath2, platform2 = process.platfor
71051
71125
  }
71052
71126
  }
71053
71127
  async function findExecutableOnPath(executableName, environment, platform2 = process.platform) {
71054
- const support = platformSupportFor(platform2);
71128
+ const support = processPlatformSupportFor(platform2);
71055
71129
  const encodedPath = support.environmentValue(environment, "PATH") ?? "";
71056
71130
  const separator = support.pathDelimiter;
71057
71131
  const extensions = support.executableExtensions(executableName, environment);
@@ -71060,7 +71134,7 @@ async function findExecutableOnPath(executableName, environment, platform2 = pro
71060
71134
  continue;
71061
71135
  }
71062
71136
  for (const extension of extensions) {
71063
- const requestedPath2 = resolve9(join15(entry, `${executableName}${extension}`));
71137
+ const requestedPath2 = resolve9(join17(entry, `${executableName}${extension}`));
71064
71138
  const executable = await resolveExecutablePath(requestedPath2, platform2);
71065
71139
  if (executable !== null) {
71066
71140
  return executable;
@@ -71309,10 +71383,10 @@ var hostPlatform, DEFAULT_OUTPUT_LIMIT_BYTES, PROCESS_GRACEFUL_STOP_TIMEOUT_MILL
71309
71383
  var init_executable = __esm({
71310
71384
  "src/util/process/executable.ts"() {
71311
71385
  "use strict";
71312
- init_platform();
71386
+ init_platform2();
71313
71387
  init_process_error();
71314
71388
  init_process_error();
71315
- hostPlatform = platformSupportFor(process.platform);
71389
+ hostPlatform = processPlatformSupportFor(process.platform);
71316
71390
  DEFAULT_OUTPUT_LIMIT_BYTES = 16 * 1024;
71317
71391
  PROCESS_GRACEFUL_STOP_TIMEOUT_MILLISECONDS = 1e3;
71318
71392
  PROCESS_FORCED_STOP_TIMEOUT_MILLISECONDS = 5e3;
@@ -78041,12 +78115,12 @@ var init_environment = __esm({
78041
78115
  });
78042
78116
 
78043
78117
  // src/acp/harness/pi/upstream/dist/acp/paths.js
78044
- import { join as join16 } from "node:path";
78118
+ import { join as join18 } from "node:path";
78045
78119
  function getPiAcpDir(environment = process.env) {
78046
- return join16(environmentHome(environment), ".pi", "pi-acp");
78120
+ return join18(environmentHome(environment), ".pi", "pi-acp");
78047
78121
  }
78048
78122
  function getPiAcpSessionMapPath(environment = process.env) {
78049
- return join16(getPiAcpDir(environment), "session-map.json");
78123
+ return join18(getPiAcpDir(environment), "session-map.json");
78050
78124
  }
78051
78125
  var init_paths = __esm({
78052
78126
  "src/acp/harness/pi/upstream/dist/acp/paths.js"() {
@@ -78102,13 +78176,13 @@ var init_pi_commands = __esm({
78102
78176
 
78103
78177
  // src/acp/harness/pi/upstream/dist/acp/pi-sessions.js
78104
78178
  import { closeSync as closeSync2, existsSync as existsSync4, openSync as openSync2, readdirSync as readdirSync4, readFileSync as readFileSync3, readSync as readSync2, statSync as statSync2 } from "node:fs";
78105
- import { isAbsolute as isAbsolute10, join as join17, resolve as resolve10 } from "node:path";
78179
+ import { isAbsolute as isAbsolute10, join as join19, resolve as resolve10 } from "node:path";
78106
78180
  function getPiAgentDir(environment) {
78107
78181
  const configured = environment["PI_CODING_AGENT_DIR"];
78108
- return configured ? resolve10(configured) : join17(environmentHome(environment), ".pi", "agent");
78182
+ return configured ? resolve10(configured) : join19(environmentHome(environment), ".pi", "agent");
78109
78183
  }
78110
78184
  function readSessionDirFromSettings(agentDir) {
78111
- const settingsPath = join17(agentDir, "settings.json");
78185
+ const settingsPath = join19(agentDir, "settings.json");
78112
78186
  try {
78113
78187
  if (!existsSync4(settingsPath)) {
78114
78188
  return null;
@@ -78129,7 +78203,7 @@ function readSessionDirFromSettings(agentDir) {
78129
78203
  }
78130
78204
  function getPiSessionsDir(environment = process.env) {
78131
78205
  const agentDir = getPiAgentDir(environment);
78132
- return readSessionDirFromSettings(agentDir) ?? join17(agentDir, "sessions");
78206
+ return readSessionDirFromSettings(agentDir) ?? join19(agentDir, "sessions");
78133
78207
  }
78134
78208
  function getPiSessionDiscoveryDirs(environment) {
78135
78209
  const discoveryDirectories = [getPiSessionsDir(environment)];
@@ -78140,7 +78214,7 @@ function getPiSessionDiscoveryDirs(environment) {
78140
78214
  if (!entry.isDirectory()) {
78141
78215
  continue;
78142
78216
  }
78143
- const directory = join17(mobiusSessionsRoot, entry.name);
78217
+ const directory = join19(mobiusSessionsRoot, entry.name);
78144
78218
  if (!discoveryDirectories.includes(directory)) {
78145
78219
  discoveryDirectories.push(directory);
78146
78220
  }
@@ -78157,7 +78231,7 @@ function walkJsonlFiles(dir, out2) {
78157
78231
  }
78158
78232
  for (const e of entries) {
78159
78233
  const name2 = typeof e.name === "string" ? e.name : String(e.name);
78160
- const p = join17(dir, name2);
78234
+ const p = join19(dir, name2);
78161
78235
  if (e.isDirectory()) {
78162
78236
  walkJsonlFiles(p, out2);
78163
78237
  } else if (e.isFile() && name2.endsWith(".jsonl")) {
@@ -78435,7 +78509,7 @@ var init_pi_sessions = __esm({
78435
78509
 
78436
78510
  // src/acp/harness/pi/upstream/dist/acp/pi-settings.js
78437
78511
  import { existsSync as existsSync5, readFileSync as readFileSync4 } from "node:fs";
78438
- import { join as join18, resolve as resolve11 } from "node:path";
78512
+ import { join as join20, resolve as resolve11 } from "node:path";
78439
78513
  function isObject2(x) {
78440
78514
  return Boolean(x) && typeof x === "object" && !Array.isArray(x);
78441
78515
  }
@@ -78464,7 +78538,7 @@ function readJsonFile(path8) {
78464
78538
  }
78465
78539
  }
78466
78540
  function getMergedSettings(cwd, environment) {
78467
- const globalSettingsPath = join18(getAgentDir(environment), "settings.json");
78541
+ const globalSettingsPath = join20(getAgentDir(environment), "settings.json");
78468
78542
  const projectSettingsPath = resolve11(cwd, ".pi", "settings.json");
78469
78543
  const global2 = readJsonFile(globalSettingsPath);
78470
78544
  const project = readJsonFile(projectSettingsPath);
@@ -78472,7 +78546,7 @@ function getMergedSettings(cwd, environment) {
78472
78546
  }
78473
78547
  function getAgentDir(environment = process.env) {
78474
78548
  const configured = environment["PI_CODING_AGENT_DIR"];
78475
- return configured ? resolve11(configured) : join18(environmentHome(environment), ".pi", "agent");
78549
+ return configured ? resolve11(configured) : join20(environmentHome(environment), ".pi", "agent");
78476
78550
  }
78477
78551
  function getEnableSkillCommands(cwd, environment = process.env) {
78478
78552
  const merged = getMergedSettings(cwd, environment);
@@ -78742,7 +78816,7 @@ var init_session_store = __esm({
78742
78816
 
78743
78817
  // src/acp/harness/pi/upstream/dist/acp/slash-commands.js
78744
78818
  import { existsSync as existsSync6, readdirSync as readdirSync5, readFileSync as readFileSync6 } from "node:fs";
78745
- import { join as join19, resolve as resolve12 } from "node:path";
78819
+ import { join as join21, resolve as resolve12 } from "node:path";
78746
78820
  function parseFrontmatter(content) {
78747
78821
  const frontmatter = {};
78748
78822
  if (!content.startsWith("---")) {
@@ -78770,7 +78844,7 @@ function loadCommandsFromDir(dir, source, subdir = "") {
78770
78844
  try {
78771
78845
  const entries = readdirSync5(dir, { withFileTypes: true });
78772
78846
  for (const entry of entries) {
78773
- const fullPath = join19(dir, entry.name);
78847
+ const fullPath = join21(dir, entry.name);
78774
78848
  if (entry.isDirectory()) {
78775
78849
  const newSubdir = subdir ? `${subdir}:${entry.name}` : entry.name;
78776
78850
  commands.push(...loadCommandsFromDir(fullPath, source, newSubdir));
@@ -78810,7 +78884,7 @@ function loadCommandsFromDir(dir, source, subdir = "") {
78810
78884
  }
78811
78885
  function loadSlashCommands(cwd, environment = process.env) {
78812
78886
  const commands = [];
78813
- const userDir = join19(environmentHome(environment), ".pi", "agent", "prompts");
78887
+ const userDir = join21(environmentHome(environment), ".pi", "agent", "prompts");
78814
78888
  const projectDir = resolve12(cwd, ".pi", "prompts");
78815
78889
  commands.push(...loadCommandsFromDir(userDir, "user"));
78816
78890
  commands.push(...loadCommandsFromDir(projectDir, "project"));
@@ -79902,7 +79976,7 @@ var init_prompt = __esm({
79902
79976
  import { spawnSync } from "node:child_process";
79903
79977
  import { randomUUID as randomUUID10 } from "node:crypto";
79904
79978
  import { existsSync as existsSync7, readdirSync as readdirSync6, readFileSync as readFileSync8, realpathSync as realpathSync3, statSync as statSync3, unlinkSync as unlinkSync2 } from "node:fs";
79905
- import { basename as basename6, dirname as dirname9, isAbsolute as isAbsolute12, join as join20 } from "node:path";
79979
+ import { basename as basename6, dirname as dirname9, isAbsolute as isAbsolute12, join as join22 } from "node:path";
79906
79980
  import { RequestError as RequestError10 } from "@agentclientprotocol/sdk";
79907
79981
  function thinkingLevelName(id) {
79908
79982
  return id.split(/[_-]/u).map((part) => part.length === 0 ? part : `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ");
@@ -80177,7 +80251,7 @@ function buildStartupInfo(opts) {
80177
80251
  md.push("");
80178
80252
  };
80179
80253
  const contextItems = [];
80180
- const contextPath = join20(opts.cwd, "AGENTS.md");
80254
+ const contextPath = join22(opts.cwd, "AGENTS.md");
80181
80255
  if (existsSync7(contextPath)) {
80182
80256
  contextItems.push(contextPath);
80183
80257
  }
@@ -80186,7 +80260,7 @@ function buildStartupInfo(opts) {
80186
80260
  const pushSkillFromRoot = (root) => {
80187
80261
  try {
80188
80262
  for (const e of readdirSync6(root)) {
80189
- const p = join20(root, e);
80263
+ const p = join22(root, e);
80190
80264
  try {
80191
80265
  const st2 = statSync3(p);
80192
80266
  if (st2.isFile() && e.toLowerCase().endsWith(".md")) {
@@ -80211,7 +80285,7 @@ function buildStartupInfo(opts) {
80211
80285
  if (name2 === "node_modules" || name2 === ".git") {
80212
80286
  continue;
80213
80287
  }
80214
- const p = join20(dir, name2);
80288
+ const p = join22(dir, name2);
80215
80289
  let st2;
80216
80290
  try {
80217
80291
  st2 = statSync3(p);
@@ -80228,16 +80302,16 @@ function buildStartupInfo(opts) {
80228
80302
  } catch {
80229
80303
  }
80230
80304
  };
80231
- const globalSkillsDir = join20(getAgentDir(opts.environment), "skills");
80305
+ const globalSkillsDir = join22(getAgentDir(opts.environment), "skills");
80232
80306
  pushSkillFromRoot(globalSkillsDir);
80233
80307
  const home = opts.environment["HOME"] ?? opts.environment["USERPROFILE"] ?? "";
80234
- const legacyAgentsSkillsDir = join20(home, ".agents", "skills");
80308
+ const legacyAgentsSkillsDir = join22(home, ".agents", "skills");
80235
80309
  pushSkillFromRoot(legacyAgentsSkillsDir);
80236
- const projectSkillsDir = join20(opts.cwd, ".pi", "skills");
80310
+ const projectSkillsDir = join22(opts.cwd, ".pi", "skills");
80237
80311
  pushSkillFromRoot(projectSkillsDir);
80238
80312
  addSection("Skills", skillsItems);
80239
80313
  const promptsItems = [];
80240
- const promptsDir = join20(home, ".pi", "agent", "prompts");
80314
+ const promptsDir = join22(home, ".pi", "agent", "prompts");
80241
80315
  try {
80242
80316
  const prompts = readdirSync6(promptsDir).filter((f) => f.endsWith(".md"));
80243
80317
  for (const f of prompts) {
@@ -80247,17 +80321,17 @@ function buildStartupInfo(opts) {
80247
80321
  }
80248
80322
  addSection("Prompts", promptsItems);
80249
80323
  const extItems = [];
80250
- const extDir = join20(home, ".pi", "agent", "extensions");
80324
+ const extDir = join22(home, ".pi", "agent", "extensions");
80251
80325
  try {
80252
80326
  const exts = readdirSync6(extDir).filter((f) => f.endsWith(".ts") || f.endsWith(".js"));
80253
80327
  for (const f of exts) {
80254
- extItems.push(join20(extDir, f));
80328
+ extItems.push(join22(extDir, f));
80255
80329
  }
80256
80330
  } catch {
80257
80331
  }
80258
80332
  const settingsPaths = [
80259
- join20(getAgentDir(opts.environment), "settings.json"),
80260
- join20(opts.cwd, ".pi", "settings.json")
80333
+ join22(getAgentDir(opts.environment), "settings.json"),
80334
+ join22(opts.cwd, ".pi", "settings.json")
80261
80335
  ];
80262
80336
  for (const settingsPath of settingsPaths) {
80263
80337
  try {
@@ -80848,7 +80922,7 @@ ${JSON.stringify(stats, null, 2)}`;
80848
80922
  if (piPath) {
80849
80923
  const resolved = realpathSync3(piPath);
80850
80924
  const pkgRoot = dirname9(dirname9(resolved));
80851
- const p = join20(pkgRoot, "CHANGELOG.md");
80925
+ const p = join22(pkgRoot, "CHANGELOG.md");
80852
80926
  if (existsSync7(p)) {
80853
80927
  return p;
80854
80928
  }
@@ -80859,7 +80933,7 @@ ${JSON.stringify(stats, null, 2)}`;
80859
80933
  const npmRoot = spawnSync("npm", ["root", "-g"], { encoding: "utf-8" });
80860
80934
  const root = String(npmRoot.stdout ?? "").trim();
80861
80935
  if (root) {
80862
- const p = join20(root, "@earendil-works", "pi-coding-agent", "CHANGELOG.md");
80936
+ const p = join22(root, "@earendil-works", "pi-coding-agent", "CHANGELOG.md");
80863
80937
  if (existsSync7(p)) {
80864
80938
  return p;
80865
80939
  }
@@ -80953,7 +81027,7 @@ ${JSON.stringify(stats, null, 2)}`;
80953
81027
  return { stopReason: "end_turn" };
80954
81028
  }
80955
81029
  const safeSessionId = session.sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
80956
- const outputPath = join20(session.cwd, `pi-session-${safeSessionId}.html`);
81030
+ const outputPath = join22(session.cwd, `pi-session-${safeSessionId}.html`);
80957
81031
  let resultPath = "";
80958
81032
  try {
80959
81033
  const result2 = await session.proc.exportHtml(outputPath);
@@ -81646,7 +81720,7 @@ var init_agent_probe_error = __esm({
81646
81720
 
81647
81721
  // src/agent/specification/vendors/pi-agent.ts
81648
81722
  import { createHash as createHash3 } from "node:crypto";
81649
- import { join as join21 } from "node:path";
81723
+ import { join as join23 } from "node:path";
81650
81724
  import {
81651
81725
  methods as methods7
81652
81726
  } from "@agentclientprotocol/sdk";
@@ -81666,7 +81740,7 @@ var init_pi_agent = __esm({
81666
81740
  // keeps the adapter's opt-in capability flag enabled for every launch it owns.
81667
81741
  createLaunchEnvironment = async (_agent, context) => {
81668
81742
  const workspaceHash = createHash3("sha256").update(context.defaultWorkspace).digest("hex").slice(0, 24);
81669
- const sessionDirectory = join21(context.dataDirectory, "agents", "pi", "sessions", workspaceHash);
81743
+ const sessionDirectory = join23(context.dataDirectory, "agents", "pi", "sessions", workspaceHash);
81670
81744
  return Object.freeze({
81671
81745
  PI_ACP_ENABLE_EMBEDDED_CONTEXT: "true",
81672
81746
  MOBIUS_PI_SESSION_DIR: sessionDirectory
@@ -85145,7 +85219,7 @@ var init_sql = __esm({
85145
85219
  return new SQL([new StringChunk(str)]);
85146
85220
  }
85147
85221
  _sql.raw = raw;
85148
- function join39(chunks, separator) {
85222
+ function join41(chunks, separator) {
85149
85223
  const result = [];
85150
85224
  for (const [i, chunk] of chunks.entries()) {
85151
85225
  if (i > 0 && separator !== void 0) result.push(separator);
@@ -85153,7 +85227,7 @@ var init_sql = __esm({
85153
85227
  }
85154
85228
  return new SQL(result);
85155
85229
  }
85156
- _sql.join = join39;
85230
+ _sql.join = join41;
85157
85231
  function identifier2(value) {
85158
85232
  return new Name(value);
85159
85233
  }
@@ -87111,7 +87185,7 @@ var init_select = __esm({
87111
87185
  const baseTableName = this.tableName;
87112
87186
  const tableName = getTableLikeName(table);
87113
87187
  for (const item of extractUsedTable(table)) this.usedTables.add(item);
87114
- if (typeof tableName === "string" && this.config.joins?.some((join39) => join39.alias === tableName)) throw new Error(`Alias "${tableName}" is already used in this query`);
87188
+ if (typeof tableName === "string" && this.config.joins?.some((join41) => join41.alias === tableName)) throw new Error(`Alias "${tableName}" is already used in this query`);
87115
87189
  if (!this.isPartialSelect) {
87116
87190
  if (Object.keys(this.joinsNotNullableMap).length === 1 && typeof baseTableName === "string") this.config.fields = { [baseTableName]: this.config.fields };
87117
87191
  if (typeof tableName === "string" && !is(table, SQL)) {
@@ -88708,7 +88782,7 @@ var init_dialect = __esm({
88708
88782
  if (!joins2) return;
88709
88783
  const withEntries = Object.entries(joins2).filter(([_, v]) => v);
88710
88784
  if (!withEntries.length) return;
88711
- return sql.join(withEntries.map(([k2, join39]) => {
88785
+ return sql.join(withEntries.map(([k2, join41]) => {
88712
88786
  const relation = tableConfig.relations[k2];
88713
88787
  const isSingle2 = is(relation, One2);
88714
88788
  const targetTable = aliasedTable(relation.targetTable, `d${currentDepth + 1}`);
@@ -88719,7 +88793,7 @@ var init_dialect = __esm({
88719
88793
  table: targetTable,
88720
88794
  mode: isSingle2 ? "first" : "many",
88721
88795
  schema,
88722
- queryConfig: join39,
88796
+ queryConfig: join41,
88723
88797
  tableConfig: schema[relation.targetTableName],
88724
88798
  relationWhere: filter,
88725
88799
  isNested: true,
@@ -88733,7 +88807,7 @@ var init_dialect = __esm({
88733
88807
  key: k2,
88734
88808
  selection: innerQuery.selection,
88735
88809
  isArray: !isSingle2,
88736
- isOptional: (relation.optional ?? false) || join39 !== true && !!join39.where
88810
+ isOptional: (relation.optional ?? false) || join41 !== true && !!join41.where
88737
88811
  });
88738
88812
  const jsonColumns = sql.join(innerQuery.selection.map((s) => {
88739
88813
  return sql`${sql.raw(this.escapeString(s.key))}, ${s.selection ? sql`${jsonb}(${sql.identifier(s.key)})` : sql.identifier(s.key)}`;
@@ -89155,7 +89229,7 @@ var init_update = __esm({
89155
89229
  createJoin(joinType) {
89156
89230
  return ((table, on2) => {
89157
89231
  const tableName = getTableLikeName(table);
89158
- if (typeof tableName === "string" && this.config.joins.some((join39) => join39.alias === tableName)) throw new Error(`Alias "${tableName}" is already used in this query`);
89232
+ if (typeof tableName === "string" && this.config.joins.some((join41) => join41.alias === tableName)) throw new Error(`Alias "${tableName}" is already used in this query`);
89159
89233
  if (typeof on2 === "function") {
89160
89234
  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;
89161
89235
  on2 = on2(new Proxy(this.config.table[Table.Symbol.Columns], new SelectionProxyHandler({
@@ -90041,12 +90115,12 @@ var init_local_sqlite_database = __esm({
90041
90115
 
90042
90116
  // src/storage/sqlite/local-databases.ts
90043
90117
  import { createHash as createHash4 } from "node:crypto";
90044
- import { join as join22 } from "node:path";
90118
+ import { join as join24 } from "node:path";
90045
90119
  function channelSessionDatabasePaths(stateDirectory, channelId) {
90046
90120
  const channelHash = createHash4("sha256").update(channelId).digest("hex");
90047
90121
  return {
90048
- events: join22(stateDirectory, "sessions", `${channelHash}.events.sqlite`),
90049
- sessions: join22(stateDirectory, "sessions", `${channelHash}.sqlite`)
90122
+ events: join24(stateDirectory, "sessions", `${channelHash}.events.sqlite`),
90123
+ sessions: join24(stateDirectory, "sessions", `${channelHash}.sqlite`)
90050
90124
  };
90051
90125
  }
90052
90126
  var openAcpSessionDatabase, openSessionEventCacheDatabase;
@@ -90279,13 +90353,13 @@ var init_session_event_cache_table = __esm({
90279
90353
  // src/storage/session/temporary-session-event-cache.ts
90280
90354
  import { mkdtempSync, rmSync as rmSync2 } from "node:fs";
90281
90355
  import { tmpdir as tmpdir2 } from "node:os";
90282
- import { join as join23 } from "node:path";
90356
+ import { join as join25 } from "node:path";
90283
90357
  function openTemporarySessionEventCache() {
90284
- const directory = mkdtempSync(join23(tmpdir2(), "mobius-preview-events-"));
90358
+ const directory = mkdtempSync(join25(tmpdir2(), "mobius-preview-events-"));
90285
90359
  const removeFiles = () => rmSync2(directory, { recursive: true, force: true });
90286
90360
  try {
90287
90361
  return {
90288
- table: new SessionEventCacheTable(openSessionEventCacheDatabase(join23(directory, "events.sqlite"))),
90362
+ table: new SessionEventCacheTable(openSessionEventCacheDatabase(join25(directory, "events.sqlite"))),
90289
90363
  removeFiles
90290
90364
  };
90291
90365
  } catch (error62) {
@@ -91134,10 +91208,10 @@ var init_catalog2 = __esm({
91134
91208
  });
91135
91209
 
91136
91210
  // src/runtime/config.ts
91137
- import { join as join24, resolve as resolve14 } from "node:path";
91211
+ import { join as join26, resolve as resolve14 } from "node:path";
91138
91212
  function loadDefaultWorkspace(dataDirectory, environment = process.env) {
91139
91213
  const { MOBIUS_DEFAULT_WORKSPACE: configuredWorkspace } = environment;
91140
- return configuredWorkspace ?? join24(dataDirectory, "workspace");
91214
+ return configuredWorkspace ?? join26(dataDirectory, "workspace");
91141
91215
  }
91142
91216
  function withRuntimeEnvironment(agent, environment) {
91143
91217
  const launchEnvironment = {};
@@ -91774,9 +91848,9 @@ var init_runtime_installation_store = __esm({
91774
91848
  // src/storage/daemon/version-data.ts
91775
91849
  import { randomUUID as randomUUID14 } from "node:crypto";
91776
91850
  import { cp as cp2, lstat as lstat4, mkdtemp, readFile as readFile7, rename as rename4, rm as rm3, writeFile as writeFile2 } from "node:fs/promises";
91777
- import { join as join25, relative as relative2, sep as sep5 } from "node:path";
91851
+ import { join as join27, relative as relative2, sep as sep5 } from "node:path";
91778
91852
  async function readCurrentDataVersion(root, signal) {
91779
- const pointer = join25(root, STATE_ROOT_LAYOUT.currentData);
91853
+ const pointer = join27(root, STATE_ROOT_LAYOUT.currentData);
91780
91854
  try {
91781
91855
  await validateLocalPath(pointer, false, true, signal);
91782
91856
  const value = (await readFile7(pointer, { encoding: "utf8", signal })).trim();
@@ -91793,7 +91867,7 @@ async function readCurrentDataVersion(root, signal) {
91793
91867
  }
91794
91868
  async function versionDataExists(root, version2, signal) {
91795
91869
  try {
91796
- await validateLocalPath(join25(root, STATE_ROOT_LAYOUT.versions, version2), true, true, signal);
91870
+ await validateLocalPath(join27(root, STATE_ROOT_LAYOUT.versions, version2), true, true, signal);
91797
91871
  return true;
91798
91872
  } catch (cause) {
91799
91873
  if (!isNodeError(cause, "ENOENT")) {
@@ -91807,13 +91881,13 @@ function nestedRootEntry(segments) {
91807
91881
  }
91808
91882
  async function copyVersionData(root, sourceVersion, targetVersion, signal) {
91809
91883
  const leftBehind = [];
91810
- const versions = join25(root, STATE_ROOT_LAYOUT.versions);
91811
- const source = join25(versions, sourceVersion);
91812
- const target = join25(versions, targetVersion);
91884
+ const versions = join27(root, STATE_ROOT_LAYOUT.versions);
91885
+ const source = join27(versions, sourceVersion);
91886
+ const target = join27(versions, targetVersion);
91813
91887
  await validateLocalPath(root, true, true, signal);
91814
91888
  await validateLocalPath(versions, true, true, signal);
91815
91889
  await validateLocalPath(source, true, true, signal);
91816
- const staging = await mkdtemp(join25(versions, `.${targetVersion}-`));
91890
+ const staging = await mkdtemp(join27(versions, `.${targetVersion}-`));
91817
91891
  try {
91818
91892
  await cp2(source, staging, {
91819
91893
  recursive: true,
@@ -91850,10 +91924,10 @@ async function discardVersionData(root, version2, signal) {
91850
91924
  if (await readCurrentDataVersion(root, signal) === version2 || !await versionDataExists(root, version2, signal)) {
91851
91925
  return;
91852
91926
  }
91853
- const versions = join25(root, STATE_ROOT_LAYOUT.versions);
91854
- const discarded = join25(versions, `.${version2}-discarded-${randomUUID14()}`);
91927
+ const versions = join27(root, STATE_ROOT_LAYOUT.versions);
91928
+ const discarded = join27(versions, `.${version2}-discarded-${randomUUID14()}`);
91855
91929
  try {
91856
- await rename4(join25(versions, version2), discarded);
91930
+ await rename4(join27(versions, version2), discarded);
91857
91931
  } catch (cause) {
91858
91932
  if (isNodeError(cause, "ENOENT")) {
91859
91933
  return;
@@ -91864,13 +91938,13 @@ async function discardVersionData(root, version2, signal) {
91864
91938
  }
91865
91939
  async function writeCurrentDataVersion(root, version2, signal) {
91866
91940
  await validateLocalPath(root, true, true, signal);
91867
- await validateLocalPath(join25(root, STATE_ROOT_LAYOUT.versions, version2), true, true, signal);
91868
- const temporary = join25(root, `.current-data-${randomUUID14()}.txt`);
91941
+ await validateLocalPath(join27(root, STATE_ROOT_LAYOUT.versions, version2), true, true, signal);
91942
+ const temporary = join27(root, `.current-data-${randomUUID14()}.txt`);
91869
91943
  try {
91870
91944
  await writeFile2(temporary, `versions/${version2}
91871
91945
  `, { mode: 384, flag: "wx", signal });
91872
91946
  signal.throwIfAborted();
91873
- await rename4(temporary, join25(root, STATE_ROOT_LAYOUT.currentData));
91947
+ await rename4(temporary, join27(root, STATE_ROOT_LAYOUT.currentData));
91874
91948
  } finally {
91875
91949
  await rm3(temporary, { force: true });
91876
91950
  }
@@ -91891,7 +91965,7 @@ var init_version_data = __esm({
91891
91965
 
91892
91966
  // src/daemon/pairing/pair-local-machine.ts
91893
91967
  import { hostname as hostname3 } from "node:os";
91894
- import { basename as basename7, join as join26, resolve as resolve16 } from "node:path";
91968
+ import { basename as basename7, join as join28, resolve as resolve16 } from "node:path";
91895
91969
  import { fetch as fetch3 } from "undici";
91896
91970
  function hasExactKeys2(value, expectedKeys) {
91897
91971
  const keys = Object.keys(value);
@@ -92152,7 +92226,7 @@ async function openMobiusVersionInstallation(version2, signal, environment) {
92152
92226
  return await openRuntimeInstallationStore(
92153
92227
  {
92154
92228
  applicationId: MOBIUS_CLI_APPLICATION_ID,
92155
- stateDirectory: join26(readStateDirectory(environment), "versions", version2)
92229
+ stateDirectory: join28(readStateDirectory(environment), "versions", version2)
92156
92230
  },
92157
92231
  signal
92158
92232
  );
@@ -92425,9 +92499,9 @@ var init_agents = __esm({
92425
92499
 
92426
92500
  // src/storage/daemon/manager-lock.ts
92427
92501
  import { readFile as readFile8, unlink as unlink4, writeFile as writeFile3 } from "node:fs/promises";
92428
- import { join as join27 } from "node:path";
92502
+ import { join as join29 } from "node:path";
92429
92503
  async function acquireManagerLock(stateDirectory, name2 = "manager.lock") {
92430
- const path8 = join27(stateDirectory, name2);
92504
+ const path8 = join29(stateDirectory, name2);
92431
92505
  for (let attempt = 0; attempt < 2; attempt += 1) {
92432
92506
  try {
92433
92507
  await writeFile3(path8, `${process.pid.toString()}
@@ -92456,7 +92530,7 @@ async function acquireManagerLock(stateDirectory, name2 = "manager.lock") {
92456
92530
  }
92457
92531
  async function managerLockExists(stateDirectory) {
92458
92532
  try {
92459
- await readFile8(join27(stateDirectory, "manager.lock"), "utf8");
92533
+ await readFile8(join29(stateDirectory, "manager.lock"), "utf8");
92460
92534
  return true;
92461
92535
  } catch (cause) {
92462
92536
  if (isNodeError(cause, "ENOENT")) {
@@ -92475,9 +92549,9 @@ var init_manager_lock = __esm({
92475
92549
  // src/storage/daemon/control-token.ts
92476
92550
  import { randomBytes } from "node:crypto";
92477
92551
  import { readFile as readFile9, writeFile as writeFile4 } from "node:fs/promises";
92478
- import { join as join28 } from "node:path";
92552
+ import { join as join30 } from "node:path";
92479
92553
  function controlTokenPath(stateDirectory) {
92480
- return join28(stateDirectory, "manager.token");
92554
+ return join30(stateDirectory, "manager.token");
92481
92555
  }
92482
92556
  async function readOrCreateControlToken(stateDirectory) {
92483
92557
  const path8 = controlTokenPath(stateDirectory);
@@ -92801,7 +92875,7 @@ var init_data = __esm({
92801
92875
 
92802
92876
  // src/storage/logs/bounded-log.ts
92803
92877
  import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync4, readFileSync as readFileSync9, renameSync as renameSync2, statSync as statSync5, writeFileSync as writeFileSync2 } from "node:fs";
92804
- import { join as join29 } from "node:path";
92878
+ import { join as join31 } from "node:path";
92805
92879
  var BoundedLineLog;
92806
92880
  var init_bounded_log = __esm({
92807
92881
  "src/storage/logs/bounded-log.ts"() {
@@ -92814,7 +92888,7 @@ var init_bounded_log = __esm({
92814
92888
  #onWriteFailure;
92815
92889
  constructor(directory, filename, maximumBytes, onWriteFailure = () => void 0) {
92816
92890
  this.#directory = directory;
92817
- this.#path = join29(directory, filename);
92891
+ this.#path = join31(directory, filename);
92818
92892
  this.#maximumBytes = maximumBytes;
92819
92893
  this.#onWriteFailure = onWriteFailure;
92820
92894
  }
@@ -92868,19 +92942,19 @@ var init_bounded_log = __esm({
92868
92942
  // src/storage/logs/log-files.ts
92869
92943
  import { readFileSync as readFileSync10 } from "node:fs";
92870
92944
  import { lstat as lstat5, readdir as readdir6, readFile as readFile10 } from "node:fs/promises";
92871
- import { join as join30, relative as relative3 } from "node:path";
92945
+ import { join as join32, relative as relative3 } from "node:path";
92872
92946
  function unhandledRejectionLogFilename(role) {
92873
92947
  return `unhandled-rejections-${role}.log`;
92874
92948
  }
92875
92949
  function logDirectory(stateDirectory) {
92876
- return join30(stateDirectory, "logs");
92950
+ return join32(stateDirectory, "logs");
92877
92951
  }
92878
92952
  function processLogPaths(stateDirectory) {
92879
92953
  return [
92880
92954
  WORKER_LIFECYCLE_LOG_FILENAME,
92881
92955
  unhandledRejectionLogFilename("manager"),
92882
92956
  unhandledRejectionLogFilename("worker")
92883
- ].map((filename) => join30(logDirectory(stateDirectory), filename));
92957
+ ].map((filename) => join32(logDirectory(stateDirectory), filename));
92884
92958
  }
92885
92959
  function readLogText(path8) {
92886
92960
  try {
@@ -92893,17 +92967,17 @@ function isAbsent(cause) {
92893
92967
  return typeof cause === "object" && cause !== null && Reflect.get(cause, "code") === "ENOENT";
92894
92968
  }
92895
92969
  async function findLogDirectories(root, unreadable, signal) {
92896
- const versions = join30(root, VERSIONS_DIRECTORY);
92897
- const installationsRoots = [join30(root, INSTALLATIONS_DIRECTORY)];
92970
+ const versions = join32(root, VERSIONS_DIRECTORY);
92971
+ const installationsRoots = [join32(root, INSTALLATIONS_DIRECTORY)];
92898
92972
  for (const version2 of await listDirectories(versions, root, unreadable, signal)) {
92899
- installationsRoots.push(join30(versions, version2, INSTALLATIONS_DIRECTORY));
92973
+ installationsRoots.push(join32(versions, version2, INSTALLATIONS_DIRECTORY));
92900
92974
  }
92901
92975
  const found = [];
92902
92976
  for (const installations of installationsRoots) {
92903
92977
  for (const applicationId of await listDirectories(installations, root, unreadable, signal)) {
92904
- const application = join30(installations, applicationId);
92978
+ const application = join32(installations, applicationId);
92905
92979
  for (const installationId2 of await listDirectories(application, root, unreadable, signal)) {
92906
- const logs = join30(application, installationId2, "logs");
92980
+ const logs = join32(application, installationId2, "logs");
92907
92981
  const status = await directoryStatus(logs);
92908
92982
  if (status === "listed") {
92909
92983
  found.push(logs);
@@ -93511,13 +93585,13 @@ var init_manager2 = __esm({
93511
93585
 
93512
93586
  // src/storage/daemon/release-files.ts
93513
93587
  import { readFile as readFile11, realpath as realpath8 } from "node:fs/promises";
93514
- import { join as join31 } from "node:path";
93588
+ import { join as join33 } from "node:path";
93515
93589
  function releasePrefix(version2) {
93516
- return join31(readStateDirectory(), STATE_ROOT_LAYOUT.releases, version2);
93590
+ return join33(readStateDirectory(), STATE_ROOT_LAYOUT.releases, version2);
93517
93591
  }
93518
93592
  async function readInstalledRelease(prefix) {
93519
- const packageRoot = await realpath8(join31(prefix, "node_modules", "@moxt-ai", "mobius"));
93520
- return { manifest: await readFile11(join31(packageRoot, "package.json"), "utf8"), packageRoot };
93593
+ const packageRoot = await realpath8(join33(prefix, "node_modules", "@moxt-ai", "mobius"));
93594
+ return { manifest: await readFile11(join33(packageRoot, "package.json"), "utf8"), packageRoot };
93521
93595
  }
93522
93596
  var init_release_files = __esm({
93523
93597
  "src/storage/daemon/release-files.ts"() {
@@ -93528,7 +93602,7 @@ var init_release_files = __esm({
93528
93602
  });
93529
93603
 
93530
93604
  // src/daemon/upgrades/package.ts
93531
- import { isAbsolute as isAbsolute16, join as join32, relative as relative4 } from "node:path";
93605
+ import { isAbsolute as isAbsolute16, join as join34, relative as relative4 } from "node:path";
93532
93606
  async function prepareDaemonReleaseVersion(version2, signal) {
93533
93607
  runtimeUpgradeVersionSchema.parse(version2);
93534
93608
  signal.throwIfAborted();
@@ -93609,7 +93683,7 @@ async function verifyInstalledDaemonRelease(installed, prefix, version2, signal)
93609
93683
  bin: external_exports.object({ mobius: external_exports.literal("dist/cli.js") }),
93610
93684
  engines: external_exports.object({ node: external_exports.string().refine((value) => (0, import_semver.validRange)(value) !== null) })
93611
93685
  }).parse(JSON.parse(installed.manifest));
93612
- const entry = await canonicalPath(join32(installed.packageRoot, metadata.bin.mobius));
93686
+ const entry = await canonicalPath(join34(installed.packageRoot, metadata.bin.mobius));
93613
93687
  const resolved = relative4(await canonicalPath(prefix), entry);
93614
93688
  if (resolved.startsWith("..") || isAbsolute16(resolved)) {
93615
93689
  throw new Error("Installed entry escaped npm prefix");
@@ -98127,7 +98201,7 @@ var init_session_turns = __esm({
98127
98201
 
98128
98202
  // src/session/workspace/workspace-directory.ts
98129
98203
  import { homedir as homedir4 } from "node:os";
98130
- import { basename as basename8, dirname as dirname11, isAbsolute as isAbsolute17, join as join33, normalize as normalize2, relative as relative5 } from "node:path";
98204
+ import { basename as basename8, dirname as dirname11, isAbsolute as isAbsolute17, join as join35, normalize as normalize2, relative as relative5 } from "node:path";
98131
98205
  function encodePath(path8) {
98132
98206
  const encoded = Buffer.from(path8, "utf8").toString("base64url");
98133
98207
  if (path8.length === 0 || path8.length > MAX_WORKSPACE_PATH_LENGTH || encoded.length + "path-".length > MAX_DIRECTORY_IDENTIFIER_LENGTH) {
@@ -98256,7 +98330,7 @@ var init_workspace_directory = __esm({
98256
98330
  continue;
98257
98331
  }
98258
98332
  try {
98259
- const path8 = await this.resolvePath(join33(target, child.name), signal);
98333
+ const path8 = await this.resolvePath(join35(target, child.name), signal);
98260
98334
  entries.push({ directoryId: encodePath(path8), name: child.name });
98261
98335
  } catch (cause) {
98262
98336
  signal.throwIfAborted();
@@ -98428,7 +98502,7 @@ var init_session_layer = __esm({
98428
98502
  // src/storage/files/scratch-directory.ts
98429
98503
  import { randomUUID as randomUUID18 } from "node:crypto";
98430
98504
  import { lstat as lstat6, mkdir as mkdir5, readdir as readdir7, readFile as readFile12, realpath as realpath9, rename as rename5, rm as rm4, stat as stat8, utimes, writeFile as writeFile5 } from "node:fs/promises";
98431
- import { dirname as dirname12, join as join34 } from "node:path";
98505
+ import { dirname as dirname12, join as join36 } from "node:path";
98432
98506
  async function atomicWrite(path8, bytes, signal) {
98433
98507
  const temporary = `${path8}.${randomUUID18()}.tmp`;
98434
98508
  try {
@@ -98446,7 +98520,7 @@ var init_scratch_directory = __esm({
98446
98520
  ScratchDirectory = class {
98447
98521
  #root;
98448
98522
  constructor(parent) {
98449
- this.#root = join34(parent, randomUUID18());
98523
+ this.#root = join36(parent, randomUUID18());
98450
98524
  }
98451
98525
  /** Refreshes this directory's lease and removes sibling directories whose lease is older than `leaseMilliseconds`. */
98452
98526
  refreshLease = async (leaseMilliseconds) => {
@@ -98457,7 +98531,7 @@ var init_scratch_directory = __esm({
98457
98531
  if (!directory.isDirectory() || !/^[a-f0-9-]{36}$/u.test(directory.name)) {
98458
98532
  continue;
98459
98533
  }
98460
- const path8 = join34(dirname12(this.#root), directory.name);
98534
+ const path8 = join36(dirname12(this.#root), directory.name);
98461
98535
  if (path8 === this.#root) {
98462
98536
  continue;
98463
98537
  }
@@ -98472,10 +98546,10 @@ var init_scratch_directory = __esm({
98472
98546
  };
98473
98547
  /** Writes `bytes` atomically to `<group>/<name>` with owner-only permissions and returns the path. */
98474
98548
  write = async (group, name2, bytes, signal) => {
98475
- const directory = join34(this.#root, group);
98549
+ const directory = join36(this.#root, group);
98476
98550
  await mkdir5(directory, { mode: 448, recursive: true });
98477
98551
  signal.throwIfAborted();
98478
- const path8 = join34(directory, name2);
98552
+ const path8 = join36(directory, name2);
98479
98553
  await atomicWrite(path8, bytes, signal);
98480
98554
  return path8;
98481
98555
  };
@@ -98510,7 +98584,7 @@ var init_scratch_directory = __esm({
98510
98584
 
98511
98585
  // src/session/content/external-content-store.ts
98512
98586
  import { createHash as createHash8 } from "node:crypto";
98513
- import { join as join35 } from "node:path";
98587
+ import { join as join37 } from "node:path";
98514
98588
  var contentRequest, CONTENT_LIFETIME_MILLISECONDS, metadataSchema, LocalExternalContentStore;
98515
98589
  var init_external_content_store = __esm({
98516
98590
  "src/session/content/external-content-store.ts"() {
@@ -98532,7 +98606,7 @@ var init_external_content_store = __esm({
98532
98606
  #expirationTimer;
98533
98607
  #cleanup = Promise.resolve();
98534
98608
  constructor(stateDirectory) {
98535
- this.#scratch = new ScratchDirectory(join35(stateDirectory, "tmp", "session-content"));
98609
+ this.#scratch = new ScratchDirectory(join37(stateDirectory, "tmp", "session-content"));
98536
98610
  this.#expirationTimer = setInterval(() => {
98537
98611
  void this.#expire().catch(() => void 0);
98538
98612
  }, 6e4);
@@ -98937,7 +99011,7 @@ var init_agent_process_pool = __esm({
98937
99011
  });
98938
99012
 
98939
99013
  // src/runtime/observability/diagnostic-log.ts
98940
- import { join as join36 } from "node:path";
99014
+ import { join as join38 } from "node:path";
98941
99015
  function exportedFields(value) {
98942
99016
  const entry = {};
98943
99017
  for (const field of REMOTE_DIAGNOSTIC_FIELDS) {
@@ -99006,7 +99080,7 @@ var init_diagnostic_log = __esm({
99006
99080
  this.#maximumBytes = maximumBytes;
99007
99081
  const processLogsDirectory = options.processLogsDirectory;
99008
99082
  this.#sources = [
99009
- { maximumBytes, path: join36(directory, DAEMON_LOG_FILENAME) },
99083
+ { maximumBytes, path: join38(directory, DAEMON_LOG_FILENAME) },
99010
99084
  // The process logs a Runtime does not own, but must read to explain its own deaths.
99011
99085
  ...processLogsDirectory === void 0 ? [] : processLogPaths(processLogsDirectory).map((path8) => ({ maximumBytes: null, path: path8 }))
99012
99086
  ];
@@ -100046,7 +100120,7 @@ var init_content_write = __esm({
100046
100120
  });
100047
100121
 
100048
100122
  // src/session/content/session-files.ts
100049
- import { basename as basename9, extname as extname2, isAbsolute as isAbsolute18, join as join37, normalize as normalize3, resolve as resolve18 } from "node:path";
100123
+ import { basename as basename9, extname as extname2, isAbsolute as isAbsolute18, join as join39, normalize as normalize3, resolve as resolve18 } from "node:path";
100050
100124
  import { fileURLToPath as fileURLToPath2 } from "node:url";
100051
100125
  function requestedPath(value) {
100052
100126
  if (value.includes("\0")) {
@@ -100070,7 +100144,7 @@ async function resolveFile(value, workingDirectory, signal) {
100070
100144
  if (isAbsolute18(requested.path) && normalize3(requested.path) !== requested.path) {
100071
100145
  return null;
100072
100146
  }
100073
- const candidates = requested.explicitUrl || workingDirectory === null ? [requested.path] : isAbsolute18(requested.path) ? [join37(workingDirectory, requested.path), requested.path] : [resolve18(workingDirectory, requested.path)];
100147
+ const candidates = requested.explicitUrl || workingDirectory === null ? [requested.path] : isAbsolute18(requested.path) ? [join39(workingDirectory, requested.path), requested.path] : [resolve18(workingDirectory, requested.path)];
100074
100148
  for (const candidate of candidates) {
100075
100149
  if (!isAbsolute18(candidate) || normalize3(candidate) !== candidate) {
100076
100150
  continue;
@@ -103117,7 +103191,7 @@ var init_daemon = __esm({
103117
103191
  });
103118
103192
 
103119
103193
  // src/cli/handler/logs/logic/collect-local-logs.ts
103120
- import { join as join38, relative as relative6, resolve as resolve19 } from "node:path";
103194
+ import { join as join40, relative as relative6, resolve as resolve19 } from "node:path";
103121
103195
  async function collectLocalDaemonLogs(stateDirectory, tailLines, signal) {
103122
103196
  signal.throwIfAborted();
103123
103197
  const root = resolve19(stateDirectory);
@@ -103127,7 +103201,7 @@ async function collectLocalDaemonLogs(stateDirectory, tailLines, signal) {
103127
103201
  for (const directory of directories) {
103128
103202
  const names = await listLogFiles(directory, root, unreadable);
103129
103203
  for (const name2 of names) {
103130
- const path8 = join38(directory, name2);
103204
+ const path8 = join40(directory, name2);
103131
103205
  const reported = relative6(root, path8);
103132
103206
  const read = await readOwnedLogFile(path8, signal);
103133
103207
  if (read.kind === "unreadable") {