@moxt-ai/mobius 0.0.336 → 0.0.338
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1407 -1283
- package/dist/cli.js.map +4 -4
- package/dist/daemon/upgrades/upgrade.d.ts.map +1 -1
- package/dist/daemon/upgrades/upgrade.js +25 -2
- package/dist/daemon/upgrades/upgrade.js.map +1 -1
- package/dist/runtime.js +1091 -1021
- package/dist/runtime.js.map +4 -4
- package/dist/session/turn/runtime-turn-activity.d.ts +12 -1
- package/dist/session/turn/runtime-turn-activity.d.ts.map +1 -1
- package/dist/session/turn/runtime-turn-activity.js +52 -26
- package/dist/session/turn/runtime-turn-activity.js.map +1 -1
- package/dist/util/filesystem/private-path.js +6 -324
- package/dist/util/filesystem/private-path.js.map +4 -4
- package/dist/util/platform/contracts.d.ts +0 -26
- package/dist/util/platform/contracts.d.ts.map +1 -1
- package/dist/util/platform/index.d.ts.map +1 -1
- package/dist/util/platform/index.js +1 -4
- package/dist/util/platform/index.js.map +1 -1
- package/dist/util/platform/linux.d.ts.map +1 -1
- package/dist/util/platform/linux.js +1 -117
- package/dist/util/platform/linux.js.map +1 -1
- package/dist/util/platform/macos.d.ts.map +1 -1
- package/dist/util/platform/macos.js +1 -4
- package/dist/util/platform/macos.js.map +1 -1
- package/dist/util/platform/posix.d.ts +0 -21
- package/dist/util/platform/posix.d.ts.map +1 -1
- package/dist/util/platform/posix.js +1 -104
- package/dist/util/platform/posix.js.map +1 -1
- package/dist/util/platform/windows.d.ts.map +1 -1
- package/dist/util/platform/windows.js +1 -107
- package/dist/util/platform/windows.js.map +1 -1
- package/dist/util/process/executable.d.ts +2 -2
- package/dist/util/process/executable.d.ts.map +1 -1
- package/dist/util/process/executable.js +31 -222
- package/dist/util/process/executable.js.map +4 -4
- package/dist/util/process/platform/contracts.d.ts +29 -0
- package/dist/util/process/platform/contracts.d.ts.map +1 -0
- package/dist/util/process/platform/contracts.js +2 -0
- package/dist/util/process/platform/contracts.js.map +1 -0
- package/dist/util/process/platform/index.d.ts +3 -0
- package/dist/util/process/platform/index.d.ts.map +1 -0
- package/dist/util/process/platform/index.js +20 -0
- package/dist/util/process/platform/index.js.map +1 -0
- package/dist/util/process/platform/linux.d.ts +3 -0
- package/dist/util/process/platform/linux.d.ts.map +1 -0
- package/dist/util/process/platform/linux.js +122 -0
- package/dist/util/process/platform/linux.js.map +1 -0
- package/dist/util/process/platform/macos.d.ts +3 -0
- package/dist/util/process/platform/macos.d.ts.map +1 -0
- package/dist/util/process/platform/macos.js +8 -0
- package/dist/util/process/platform/macos.js.map +1 -0
- package/dist/util/process/platform/posix.d.ts +25 -0
- package/dist/util/process/platform/posix.d.ts.map +1 -0
- package/dist/util/process/platform/posix.js +107 -0
- package/dist/util/process/platform/posix.js.map +1 -0
- package/dist/util/process/platform/windows.d.ts +3 -0
- package/dist/util/process/platform/windows.d.ts.map +1 -0
- package/dist/util/process/platform/windows.js +114 -0
- package/dist/util/process/platform/windows.js.map +1 -0
- 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.
|
|
2089
|
+
version: "0.0.338",
|
|
2090
2090
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
2091
2091
|
type: "module",
|
|
2092
2092
|
bin: {
|
|
@@ -68539,16 +68539,20 @@ var init_acp_agent = __esm({
|
|
|
68539
68539
|
}, message.tool_use_id !== void 0)
|
|
68540
68540
|
});
|
|
68541
68541
|
}
|
|
68542
|
-
backgroundTasks.delete(message.task_id);
|
|
68543
68542
|
if (message.skip_transcript) {
|
|
68543
|
+
backgroundTasks.delete(message.task_id);
|
|
68544
68544
|
awaitingBackgroundResults.delete(message.task_id);
|
|
68545
|
-
} else {
|
|
68545
|
+
} else if (backgroundTasks.delete(message.task_id)) {
|
|
68546
68546
|
awaitingBackgroundResults.add(message.task_id);
|
|
68547
68547
|
}
|
|
68548
68548
|
reportBackgroundActivity();
|
|
68549
68549
|
session.liveBackgroundTasks.delete(message.task_id);
|
|
68550
68550
|
break;
|
|
68551
68551
|
case "task_updated":
|
|
68552
|
+
if (!hasBackgroundLevel && message.patch.is_backgrounded === true) {
|
|
68553
|
+
backgroundTasks.add(message.task_id);
|
|
68554
|
+
reportBackgroundActivity();
|
|
68555
|
+
}
|
|
68552
68556
|
if (message.patch.status === "completed" || message.patch.status === "failed" || message.patch.status === "killed") {
|
|
68553
68557
|
session.liveBackgroundTasks.delete(message.task_id);
|
|
68554
68558
|
if (backgroundTasks.delete(message.task_id)) {
|
|
@@ -70440,11 +70444,270 @@ var init_path_error = __esm({
|
|
|
70440
70444
|
});
|
|
70441
70445
|
|
|
70442
70446
|
// src/util/platform/posix.ts
|
|
70443
|
-
import {
|
|
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";
|
|
70447
|
+
import { chmod, lstat as lstat2, unlink as unlink3 } from "node:fs/promises";
|
|
70446
70448
|
import { tmpdir } from "node:os";
|
|
70447
70449
|
import { join as join10 } from "node:path";
|
|
70450
|
+
async function removeControlSocket(path8) {
|
|
70451
|
+
try {
|
|
70452
|
+
await unlink3(path8);
|
|
70453
|
+
} catch (cause) {
|
|
70454
|
+
if (!(cause instanceof Error) || !("code" in cause) || cause.code !== "ENOENT") {
|
|
70455
|
+
throw cause;
|
|
70456
|
+
}
|
|
70457
|
+
}
|
|
70458
|
+
}
|
|
70459
|
+
var posixOperations;
|
|
70460
|
+
var init_posix = __esm({
|
|
70461
|
+
"src/util/platform/posix.ts"() {
|
|
70462
|
+
"use strict";
|
|
70463
|
+
init_path_error();
|
|
70464
|
+
posixOperations = {
|
|
70465
|
+
controlSocketPath: (installationHash) => join10(tmpdir(), `mobius-${installationHash}.sock`),
|
|
70466
|
+
prepareControlSocket: removeControlSocket,
|
|
70467
|
+
secureControlSocket: async (path8) => {
|
|
70468
|
+
await chmod(path8, 384);
|
|
70469
|
+
},
|
|
70470
|
+
removeControlSocket,
|
|
70471
|
+
validatePathPermissions: async (path8, directory, privateAccess, signal) => {
|
|
70472
|
+
signal.throwIfAborted();
|
|
70473
|
+
const metadata = await lstat2(path8);
|
|
70474
|
+
if (process.getuid === void 0 || metadata.uid !== process.getuid()) {
|
|
70475
|
+
throw new LocalPathError("Path is not user-owned");
|
|
70476
|
+
}
|
|
70477
|
+
if (privateAccess) {
|
|
70478
|
+
await chmod(path8, directory ? 448 : 384);
|
|
70479
|
+
}
|
|
70480
|
+
signal.throwIfAborted();
|
|
70481
|
+
}
|
|
70482
|
+
};
|
|
70483
|
+
}
|
|
70484
|
+
});
|
|
70485
|
+
|
|
70486
|
+
// src/util/platform/linux.ts
|
|
70487
|
+
import { isAbsolute as isAbsolute5, join as join11 } from "node:path";
|
|
70488
|
+
var linuxPlatform;
|
|
70489
|
+
var init_linux = __esm({
|
|
70490
|
+
"src/util/platform/linux.ts"() {
|
|
70491
|
+
"use strict";
|
|
70492
|
+
init_posix();
|
|
70493
|
+
linuxPlatform = {
|
|
70494
|
+
...posixOperations,
|
|
70495
|
+
claudeCodeExecutablePaths: (environment) => {
|
|
70496
|
+
const homeDirectory = environment["HOME"];
|
|
70497
|
+
return homeDirectory !== void 0 && isAbsolute5(homeDirectory) ? [join11(homeDirectory, ".local", "bin", "claude")] : [];
|
|
70498
|
+
}
|
|
70499
|
+
};
|
|
70500
|
+
}
|
|
70501
|
+
});
|
|
70502
|
+
|
|
70503
|
+
// src/util/platform/claude-desktop.ts
|
|
70504
|
+
import { readdirSync as readdirSync2 } from "node:fs";
|
|
70505
|
+
import { join as join12 } from "node:path";
|
|
70506
|
+
function installedDirectories(directory) {
|
|
70507
|
+
try {
|
|
70508
|
+
return readdirSync2(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
70509
|
+
} catch (cause) {
|
|
70510
|
+
if (cause instanceof Error && "code" in cause && (cause.code === "ENOENT" || cause.code === "ENOTDIR" || cause.code === "EACCES")) {
|
|
70511
|
+
return [];
|
|
70512
|
+
}
|
|
70513
|
+
throw cause;
|
|
70514
|
+
}
|
|
70515
|
+
}
|
|
70516
|
+
function claudeDesktopExecutablePaths(roots, executablePaths) {
|
|
70517
|
+
const paths = [];
|
|
70518
|
+
for (const root of roots) {
|
|
70519
|
+
const versions = installedDirectories(root).filter((version2) => /^\d+\.\d+\.\d+$/.test(version2)).toSorted((left, right) => right.localeCompare(left, "en", { numeric: true }));
|
|
70520
|
+
for (const version2 of versions) {
|
|
70521
|
+
const directory = join12(root, version2);
|
|
70522
|
+
const installations = [
|
|
70523
|
+
directory,
|
|
70524
|
+
...installedDirectories(directory).map((build) => join12(directory, build))
|
|
70525
|
+
];
|
|
70526
|
+
for (const installation of installations) {
|
|
70527
|
+
for (const executablePath of executablePaths) {
|
|
70528
|
+
paths.push(join12(installation, ...executablePath));
|
|
70529
|
+
}
|
|
70530
|
+
}
|
|
70531
|
+
}
|
|
70532
|
+
}
|
|
70533
|
+
return paths;
|
|
70534
|
+
}
|
|
70535
|
+
var init_claude_desktop = __esm({
|
|
70536
|
+
"src/util/platform/claude-desktop.ts"() {
|
|
70537
|
+
"use strict";
|
|
70538
|
+
}
|
|
70539
|
+
});
|
|
70540
|
+
|
|
70541
|
+
// src/util/platform/macos.ts
|
|
70542
|
+
import { isAbsolute as isAbsolute6, join as join13 } from "node:path";
|
|
70543
|
+
var macosPlatform;
|
|
70544
|
+
var init_macos = __esm({
|
|
70545
|
+
"src/util/platform/macos.ts"() {
|
|
70546
|
+
"use strict";
|
|
70547
|
+
init_claude_desktop();
|
|
70548
|
+
init_posix();
|
|
70549
|
+
macosPlatform = {
|
|
70550
|
+
...posixOperations,
|
|
70551
|
+
claudeCodeExecutablePaths: (environment) => {
|
|
70552
|
+
const paths = ["/opt/homebrew/bin/claude", "/usr/local/bin/claude"];
|
|
70553
|
+
const homeDirectory = environment["HOME"];
|
|
70554
|
+
if (homeDirectory !== void 0 && isAbsolute6(homeDirectory)) {
|
|
70555
|
+
paths.unshift(join13(homeDirectory, ".local", "bin", "claude"));
|
|
70556
|
+
paths.push(
|
|
70557
|
+
...claudeDesktopExecutablePaths(
|
|
70558
|
+
[join13(homeDirectory, "Library", "Application Support", "Claude", "claude-code")],
|
|
70559
|
+
[["claude.app", "Contents", "MacOS", "claude"], ["claude"]]
|
|
70560
|
+
)
|
|
70561
|
+
);
|
|
70562
|
+
}
|
|
70563
|
+
return paths;
|
|
70564
|
+
}
|
|
70565
|
+
};
|
|
70566
|
+
}
|
|
70567
|
+
});
|
|
70568
|
+
|
|
70569
|
+
// src/util/platform/windows.ts
|
|
70570
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
70571
|
+
import { isAbsolute as isAbsolute7, join as join14 } from "node:path";
|
|
70572
|
+
import { promisify as promisify2 } from "node:util";
|
|
70573
|
+
function environmentValue(environment, name2) {
|
|
70574
|
+
return Object.entries(environment).find(([key]) => key.toUpperCase() === name2.toUpperCase())?.[1];
|
|
70575
|
+
}
|
|
70576
|
+
function desktopClaudeExecutablePaths(environment) {
|
|
70577
|
+
const roots = [];
|
|
70578
|
+
const localAppData = environmentValue(environment, "LOCALAPPDATA");
|
|
70579
|
+
if (localAppData !== void 0 && isAbsolute7(localAppData)) {
|
|
70580
|
+
const dataDirectory = join14(localAppData, "Claude-Data");
|
|
70581
|
+
for (const installation of installedDirectories(dataDirectory)) {
|
|
70582
|
+
if (installation.startsWith("claude_")) {
|
|
70583
|
+
roots.push(join14(dataDirectory, installation, "claude-code"));
|
|
70584
|
+
}
|
|
70585
|
+
}
|
|
70586
|
+
}
|
|
70587
|
+
const appData = environmentValue(environment, "APPDATA");
|
|
70588
|
+
if (appData !== void 0 && isAbsolute7(appData)) {
|
|
70589
|
+
roots.push(join14(appData, "Claude", "claude-code"));
|
|
70590
|
+
}
|
|
70591
|
+
return claudeDesktopExecutablePaths(roots, [["claude.exe"]]);
|
|
70592
|
+
}
|
|
70593
|
+
async function validatePathPermissions(path8, _directory, privateAccess, signal) {
|
|
70594
|
+
signal.throwIfAborted();
|
|
70595
|
+
const systemRoot = environmentValue(process.env, "SystemRoot");
|
|
70596
|
+
if (systemRoot === void 0) {
|
|
70597
|
+
throw new LocalPathError("Windows system directory is unavailable");
|
|
70598
|
+
}
|
|
70599
|
+
try {
|
|
70600
|
+
await execute(
|
|
70601
|
+
join14(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"),
|
|
70602
|
+
[
|
|
70603
|
+
"-NoLogo",
|
|
70604
|
+
"-NoProfile",
|
|
70605
|
+
"-NonInteractive",
|
|
70606
|
+
"-EncodedCommand",
|
|
70607
|
+
Buffer.from(windowsPermissions, "utf16le").toString("base64")
|
|
70608
|
+
],
|
|
70609
|
+
{
|
|
70610
|
+
env: {
|
|
70611
|
+
...process.env,
|
|
70612
|
+
MOBIUS_PERMISSION_PATH: path8,
|
|
70613
|
+
MOBIUS_PERMISSION_PRIVATE: privateAccess ? "1" : "0"
|
|
70614
|
+
},
|
|
70615
|
+
windowsHide: true,
|
|
70616
|
+
signal: AbortSignal.any([signal, AbortSignal.timeout(windowsPermissionsTimeoutMs)]),
|
|
70617
|
+
timeout: windowsPermissionsTimeoutMs,
|
|
70618
|
+
maxBuffer: 16384
|
|
70619
|
+
}
|
|
70620
|
+
);
|
|
70621
|
+
} catch (cause) {
|
|
70622
|
+
signal.throwIfAborted();
|
|
70623
|
+
throw new LocalPathError("The local path permissions could not be secured", { cause });
|
|
70624
|
+
}
|
|
70625
|
+
}
|
|
70626
|
+
var execute, windowsPermissions, windowsPermissionsTimeoutMs, windowsPlatform;
|
|
70627
|
+
var init_windows = __esm({
|
|
70628
|
+
"src/util/platform/windows.ts"() {
|
|
70629
|
+
"use strict";
|
|
70630
|
+
init_path_error();
|
|
70631
|
+
init_claude_desktop();
|
|
70632
|
+
execute = promisify2(execFile2);
|
|
70633
|
+
windowsPermissions = `
|
|
70634
|
+
$ErrorActionPreference = 'Stop'
|
|
70635
|
+
$ProgressPreference = 'SilentlyContinue'
|
|
70636
|
+
$item = Get-Item -LiteralPath $env:MOBIUS_PERMISSION_PATH -Force
|
|
70637
|
+
if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'Unsafe path' }
|
|
70638
|
+
$sid = [Security.Principal.WindowsIdentity]::GetCurrent().User
|
|
70639
|
+
$acl = $item.GetAccessControl()
|
|
70640
|
+
$owner = $acl.GetOwner([Security.Principal.SecurityIdentifier])
|
|
70641
|
+
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' }
|
|
70642
|
+
if ($env:MOBIUS_PERMISSION_PRIVATE -eq '1') {
|
|
70643
|
+
if ($item.PSIsContainer) {
|
|
70644
|
+
$private = New-Object Security.AccessControl.DirectorySecurity
|
|
70645
|
+
$rule = New-Object Security.AccessControl.FileSystemAccessRule($sid, 'FullControl', 'ContainerInherit,ObjectInherit', 'None', 'Allow')
|
|
70646
|
+
} else {
|
|
70647
|
+
$private = New-Object Security.AccessControl.FileSecurity
|
|
70648
|
+
$rule = New-Object Security.AccessControl.FileSystemAccessRule($sid, 'FullControl', 'Allow')
|
|
70649
|
+
}
|
|
70650
|
+
$private.SetOwner($sid)
|
|
70651
|
+
$private.SetAccessRuleProtection($true, $false)
|
|
70652
|
+
$private.AddAccessRule($rule)
|
|
70653
|
+
$item.SetAccessControl($private)
|
|
70654
|
+
}
|
|
70655
|
+
`;
|
|
70656
|
+
windowsPermissionsTimeoutMs = 3e4;
|
|
70657
|
+
windowsPlatform = {
|
|
70658
|
+
controlSocketPath: (installationHash) => `\\\\.\\pipe\\mobius-${installationHash}`,
|
|
70659
|
+
prepareControlSocket: async () => {
|
|
70660
|
+
},
|
|
70661
|
+
secureControlSocket: async () => {
|
|
70662
|
+
},
|
|
70663
|
+
removeControlSocket: async () => {
|
|
70664
|
+
},
|
|
70665
|
+
validatePathPermissions,
|
|
70666
|
+
claudeCodeExecutablePaths: (environment) => {
|
|
70667
|
+
const paths = [];
|
|
70668
|
+
const userProfile = environmentValue(environment, "USERPROFILE");
|
|
70669
|
+
if (userProfile !== void 0 && isAbsolute7(userProfile)) {
|
|
70670
|
+
paths.push(join14(userProfile, ".local", "bin", "claude.exe"));
|
|
70671
|
+
}
|
|
70672
|
+
const localAppData = environmentValue(environment, "LOCALAPPDATA");
|
|
70673
|
+
if (localAppData !== void 0 && isAbsolute7(localAppData)) {
|
|
70674
|
+
paths.push(join14(localAppData, "Microsoft", "WinGet", "Links", "claude.exe"));
|
|
70675
|
+
}
|
|
70676
|
+
paths.push(...desktopClaudeExecutablePaths(environment));
|
|
70677
|
+
return paths;
|
|
70678
|
+
}
|
|
70679
|
+
};
|
|
70680
|
+
}
|
|
70681
|
+
});
|
|
70682
|
+
|
|
70683
|
+
// src/util/platform/index.ts
|
|
70684
|
+
function platformSupportFor(platform2) {
|
|
70685
|
+
return platforms.get(platform2) ?? fallbackPlatform;
|
|
70686
|
+
}
|
|
70687
|
+
var fallbackPlatform, platforms;
|
|
70688
|
+
var init_platform = __esm({
|
|
70689
|
+
"src/util/platform/index.ts"() {
|
|
70690
|
+
"use strict";
|
|
70691
|
+
init_linux();
|
|
70692
|
+
init_macos();
|
|
70693
|
+
init_posix();
|
|
70694
|
+
init_windows();
|
|
70695
|
+
fallbackPlatform = {
|
|
70696
|
+
...posixOperations,
|
|
70697
|
+
claudeCodeExecutablePaths: () => []
|
|
70698
|
+
};
|
|
70699
|
+
platforms = /* @__PURE__ */ new Map([
|
|
70700
|
+
["linux", linuxPlatform],
|
|
70701
|
+
["darwin", macosPlatform],
|
|
70702
|
+
["win32", windowsPlatform]
|
|
70703
|
+
]);
|
|
70704
|
+
}
|
|
70705
|
+
});
|
|
70706
|
+
|
|
70707
|
+
// src/util/process/platform/posix.ts
|
|
70708
|
+
import { execFile as execFile3 } from "node:child_process";
|
|
70709
|
+
import { constants as constants3 } from "node:fs";
|
|
70710
|
+
import { access as access2, realpath as realpath3 } from "node:fs/promises";
|
|
70448
70711
|
function parseProcessTable(output2) {
|
|
70449
70712
|
const entries = [];
|
|
70450
70713
|
for (const line of output2.split("\n")) {
|
|
@@ -70464,7 +70727,7 @@ function parseProcessTable(output2) {
|
|
|
70464
70727
|
}
|
|
70465
70728
|
function readProcessTableWithPs(executable) {
|
|
70466
70729
|
return new Promise((resolveTable) => {
|
|
70467
|
-
|
|
70730
|
+
execFile3(
|
|
70468
70731
|
executable,
|
|
70469
70732
|
["-axo", "pid=,ppid=,pgid="],
|
|
70470
70733
|
{
|
|
@@ -70522,29 +70785,13 @@ function terminateProcess(child, signal) {
|
|
|
70522
70785
|
}
|
|
70523
70786
|
child.kill(signal);
|
|
70524
70787
|
}
|
|
70525
|
-
|
|
70526
|
-
|
|
70527
|
-
|
|
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"() {
|
|
70788
|
+
var PROCESS_TABLE_TIMEOUT_MILLISECONDS, PROCESS_TABLE_OUTPUT_LIMIT_BYTES, posixOperations2;
|
|
70789
|
+
var init_posix2 = __esm({
|
|
70790
|
+
"src/util/process/platform/posix.ts"() {
|
|
70537
70791
|
"use strict";
|
|
70538
|
-
init_path_error();
|
|
70539
70792
|
PROCESS_TABLE_TIMEOUT_MILLISECONDS = 1e3;
|
|
70540
70793
|
PROCESS_TABLE_OUTPUT_LIMIT_BYTES = 1024 * 1024;
|
|
70541
|
-
|
|
70542
|
-
controlSocketPath: (installationHash) => join10(tmpdir(), `mobius-${installationHash}.sock`),
|
|
70543
|
-
prepareControlSocket: removeControlSocket,
|
|
70544
|
-
secureControlSocket: async (path8) => {
|
|
70545
|
-
await chmod(path8, 384);
|
|
70546
|
-
},
|
|
70547
|
-
removeControlSocket,
|
|
70794
|
+
posixOperations2 = {
|
|
70548
70795
|
pathDelimiter: ":",
|
|
70549
70796
|
environmentValue: (environment, name2) => environment[name2],
|
|
70550
70797
|
executableExtensions: () => [""],
|
|
@@ -70556,26 +70803,15 @@ var init_posix = __esm({
|
|
|
70556
70803
|
executableLaunch: (command, args) => ({ command, arguments: args }),
|
|
70557
70804
|
spawnOptions: { detached: true, windowsHide: true },
|
|
70558
70805
|
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
|
-
}
|
|
70806
|
+
terminateProcess
|
|
70571
70807
|
};
|
|
70572
70808
|
}
|
|
70573
70809
|
});
|
|
70574
70810
|
|
|
70575
|
-
// src/util/platform/linux.ts
|
|
70576
|
-
import { constants as constants4, readdirSync as
|
|
70811
|
+
// src/util/process/platform/linux.ts
|
|
70812
|
+
import { constants as constants4, readdirSync as readdirSync3, readFileSync as readFileSync2 } from "node:fs";
|
|
70577
70813
|
import { access as access3, readdir as readdir4, readFile as readFile4, realpath as realpath4, stat as stat4 } from "node:fs/promises";
|
|
70578
|
-
import {
|
|
70814
|
+
import { join as join15 } from "node:path";
|
|
70579
70815
|
function appendLinuxProcessTableEntry(entries, processId, encoded) {
|
|
70580
70816
|
const closingParenthesis = encoded.lastIndexOf(")");
|
|
70581
70817
|
if (!encoded.startsWith(`${processId.toString()} (`) || closingParenthesis < 0) {
|
|
@@ -70605,7 +70841,7 @@ async function readLinuxProcessTable() {
|
|
|
70605
70841
|
appendLinuxProcessTableEntry(
|
|
70606
70842
|
entries,
|
|
70607
70843
|
processId,
|
|
70608
|
-
await readFile4(
|
|
70844
|
+
await readFile4(join15("/proc", directory.name, "stat"), "utf8")
|
|
70609
70845
|
);
|
|
70610
70846
|
} catch {
|
|
70611
70847
|
}
|
|
@@ -70617,7 +70853,7 @@ async function readLinuxProcessTable() {
|
|
|
70617
70853
|
function readLinuxProcessTableSynchronously() {
|
|
70618
70854
|
const entries = [];
|
|
70619
70855
|
try {
|
|
70620
|
-
const directories =
|
|
70856
|
+
const directories = readdirSync3("/proc", { withFileTypes: true });
|
|
70621
70857
|
for (const directory of directories) {
|
|
70622
70858
|
if (!directory.isDirectory() || !/^\d+$/.test(directory.name)) {
|
|
70623
70859
|
continue;
|
|
@@ -70630,7 +70866,7 @@ function readLinuxProcessTableSynchronously() {
|
|
|
70630
70866
|
appendLinuxProcessTableEntry(
|
|
70631
70867
|
entries,
|
|
70632
70868
|
processId,
|
|
70633
|
-
readFileSync2(
|
|
70869
|
+
readFileSync2(join15("/proc", directory.name, "stat"), "utf8")
|
|
70634
70870
|
);
|
|
70635
70871
|
} catch {
|
|
70636
70872
|
}
|
|
@@ -70663,7 +70899,7 @@ async function readLinuxProcessTableWithFallback() {
|
|
|
70663
70899
|
}
|
|
70664
70900
|
function processExists2(processId) {
|
|
70665
70901
|
try {
|
|
70666
|
-
const encoded = readFileSync2(
|
|
70902
|
+
const encoded = readFileSync2(join15("/proc", processId.toString(), "stat"), "utf8");
|
|
70667
70903
|
const closingParenthesis = encoded.lastIndexOf(")");
|
|
70668
70904
|
if (closingParenthesis >= 0) {
|
|
70669
70905
|
const processState = encoded.slice(closingParenthesis + 1).trimStart().charAt(0);
|
|
@@ -70675,89 +70911,31 @@ function processExists2(processId) {
|
|
|
70675
70911
|
}
|
|
70676
70912
|
return processExists(processId);
|
|
70677
70913
|
}
|
|
70678
|
-
var
|
|
70679
|
-
var
|
|
70680
|
-
"src/util/platform/linux.ts"() {
|
|
70914
|
+
var linuxProcessPlatform;
|
|
70915
|
+
var init_linux2 = __esm({
|
|
70916
|
+
"src/util/process/platform/linux.ts"() {
|
|
70681
70917
|
"use strict";
|
|
70682
|
-
|
|
70683
|
-
|
|
70684
|
-
...
|
|
70918
|
+
init_posix2();
|
|
70919
|
+
linuxProcessPlatform = {
|
|
70920
|
+
...posixOperations2,
|
|
70685
70921
|
readProcessTable: readLinuxProcessTableWithFallback,
|
|
70686
70922
|
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
|
-
}
|
|
70923
|
+
processExists: processExists2
|
|
70692
70924
|
};
|
|
70693
70925
|
}
|
|
70694
70926
|
});
|
|
70695
70927
|
|
|
70696
|
-
// src/util/platform/
|
|
70697
|
-
|
|
70698
|
-
|
|
70699
|
-
|
|
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"() {
|
|
70730
|
-
"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"() {
|
|
70928
|
+
// src/util/process/platform/macos.ts
|
|
70929
|
+
var macosProcessPlatform;
|
|
70930
|
+
var init_macos2 = __esm({
|
|
70931
|
+
"src/util/process/platform/macos.ts"() {
|
|
70739
70932
|
"use strict";
|
|
70740
|
-
|
|
70741
|
-
|
|
70742
|
-
|
|
70743
|
-
...posixOperations,
|
|
70933
|
+
init_posix2();
|
|
70934
|
+
macosProcessPlatform = {
|
|
70935
|
+
...posixOperations2,
|
|
70744
70936
|
readProcessTable: () => readProcessTableWithPs("/bin/ps"),
|
|
70745
70937
|
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
|
-
}
|
|
70938
|
+
processExists
|
|
70761
70939
|
};
|
|
70762
70940
|
}
|
|
70763
70941
|
});
|
|
@@ -70778,36 +70956,18 @@ var init_process_error = __esm({
|
|
|
70778
70956
|
}
|
|
70779
70957
|
});
|
|
70780
70958
|
|
|
70781
|
-
// src/util/platform/windows.ts
|
|
70782
|
-
import { execFile as
|
|
70959
|
+
// src/util/process/platform/windows.ts
|
|
70960
|
+
import { execFile as execFile4 } from "node:child_process";
|
|
70783
70961
|
import { readFile as readFile5, realpath as realpath5 } from "node:fs/promises";
|
|
70784
|
-
import { dirname as dirname7, extname,
|
|
70785
|
-
|
|
70786
|
-
function environmentValue(environment, name2) {
|
|
70962
|
+
import { dirname as dirname7, extname, join as join16, resolve as resolve8 } from "node:path";
|
|
70963
|
+
function environmentValue2(environment, name2) {
|
|
70787
70964
|
return Object.entries(environment).find(([key]) => key.toUpperCase() === name2.toUpperCase())?.[1];
|
|
70788
70965
|
}
|
|
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
70966
|
function executableExtensions(executableName, environment) {
|
|
70807
70967
|
if (/\.[a-zA-Z0-9]+$/.test(executableName)) {
|
|
70808
70968
|
return [""];
|
|
70809
70969
|
}
|
|
70810
|
-
const configured =
|
|
70970
|
+
const configured = environmentValue2(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD";
|
|
70811
70971
|
const extensions = configured.split(";").map((extension) => extension.trim()).filter((extension) => extension.length > 0).map((extension) => extension.startsWith(".") ? extension : `.${extension}`);
|
|
70812
70972
|
return extensions.length > 0 ? extensions : [".EXE"];
|
|
70813
70973
|
}
|
|
@@ -70855,13 +71015,13 @@ function executableLaunch(command, args) {
|
|
|
70855
71015
|
return { command, arguments: args };
|
|
70856
71016
|
}
|
|
70857
71017
|
function readProcessTable() {
|
|
70858
|
-
const systemRoot =
|
|
71018
|
+
const systemRoot = environmentValue2(process.env, "SystemRoot");
|
|
70859
71019
|
if (systemRoot === void 0) {
|
|
70860
71020
|
return Promise.resolve([]);
|
|
70861
71021
|
}
|
|
70862
71022
|
return new Promise((resolveTable) => {
|
|
70863
|
-
|
|
70864
|
-
|
|
71023
|
+
execFile4(
|
|
71024
|
+
join16(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"),
|
|
70865
71025
|
[
|
|
70866
71026
|
"-NoLogo",
|
|
70867
71027
|
"-NoProfile",
|
|
@@ -70894,132 +71054,50 @@ function terminateProcess2(child, signal) {
|
|
|
70894
71054
|
}
|
|
70895
71055
|
child.kill(signal);
|
|
70896
71056
|
}
|
|
70897
|
-
|
|
70898
|
-
|
|
70899
|
-
|
|
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"() {
|
|
71057
|
+
var windowsProcessPlatform;
|
|
71058
|
+
var init_windows2 = __esm({
|
|
71059
|
+
"src/util/process/platform/windows.ts"() {
|
|
70933
71060
|
"use strict";
|
|
70934
|
-
init_path_error();
|
|
70935
71061
|
init_process_error();
|
|
70936
|
-
|
|
70937
|
-
|
|
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
|
-
},
|
|
71062
|
+
init_posix2();
|
|
71063
|
+
windowsProcessPlatform = {
|
|
70971
71064
|
pathDelimiter: ";",
|
|
70972
|
-
environmentValue,
|
|
71065
|
+
environmentValue: environmentValue2,
|
|
70973
71066
|
executableExtensions,
|
|
70974
71067
|
resolveExecutableTarget,
|
|
70975
71068
|
executableLaunch,
|
|
70976
71069
|
spawnOptions: { detached: false, windowsHide: true },
|
|
70977
71070
|
signalCapturedProcesses: signalCapturedProcesses2,
|
|
70978
71071
|
terminateProcess: terminateProcess2,
|
|
70979
|
-
validatePathPermissions,
|
|
70980
71072
|
readProcessTable,
|
|
70981
71073
|
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
|
-
}
|
|
71074
|
+
processExists
|
|
70996
71075
|
};
|
|
70997
71076
|
}
|
|
70998
71077
|
});
|
|
70999
71078
|
|
|
71000
|
-
// src/util/platform/index.ts
|
|
71001
|
-
function
|
|
71002
|
-
return
|
|
71079
|
+
// src/util/process/platform/index.ts
|
|
71080
|
+
function processPlatformSupportFor(platform2) {
|
|
71081
|
+
return platforms2.get(platform2) ?? fallbackPlatform2;
|
|
71003
71082
|
}
|
|
71004
|
-
var
|
|
71005
|
-
var
|
|
71006
|
-
"src/util/platform/index.ts"() {
|
|
71083
|
+
var fallbackPlatform2, platforms2;
|
|
71084
|
+
var init_platform2 = __esm({
|
|
71085
|
+
"src/util/process/platform/index.ts"() {
|
|
71007
71086
|
"use strict";
|
|
71008
|
-
|
|
71009
|
-
|
|
71010
|
-
|
|
71011
|
-
|
|
71012
|
-
|
|
71013
|
-
...
|
|
71087
|
+
init_linux2();
|
|
71088
|
+
init_macos2();
|
|
71089
|
+
init_posix2();
|
|
71090
|
+
init_windows2();
|
|
71091
|
+
fallbackPlatform2 = {
|
|
71092
|
+
...posixOperations2,
|
|
71014
71093
|
readProcessTable: () => readProcessTableWithPs("/usr/bin/ps"),
|
|
71015
71094
|
readProcessTableSynchronously: () => [],
|
|
71016
|
-
processExists
|
|
71017
|
-
claudeCodeExecutablePaths: () => []
|
|
71095
|
+
processExists
|
|
71018
71096
|
};
|
|
71019
|
-
|
|
71020
|
-
["linux",
|
|
71021
|
-
["darwin",
|
|
71022
|
-
["win32",
|
|
71097
|
+
platforms2 = /* @__PURE__ */ new Map([
|
|
71098
|
+
["linux", linuxProcessPlatform],
|
|
71099
|
+
["darwin", macosProcessPlatform],
|
|
71100
|
+
["win32", windowsProcessPlatform]
|
|
71023
71101
|
]);
|
|
71024
71102
|
}
|
|
71025
71103
|
});
|
|
@@ -71027,11 +71105,11 @@ var init_platform = __esm({
|
|
|
71027
71105
|
// src/util/process/executable.ts
|
|
71028
71106
|
import { spawn as spawn3 } from "node:child_process";
|
|
71029
71107
|
import { stat as stat5 } from "node:fs/promises";
|
|
71030
|
-
import { join as
|
|
71108
|
+
import { join as join17, resolve as resolve9 } from "node:path";
|
|
71031
71109
|
async function resolveExecutablePath(requestedPath2, platform2 = process.platform) {
|
|
71032
71110
|
const absoluteRequestedPath = resolve9(requestedPath2);
|
|
71033
71111
|
try {
|
|
71034
|
-
const resolvedPath = await
|
|
71112
|
+
const resolvedPath = await processPlatformSupportFor(platform2).resolveExecutableTarget(absoluteRequestedPath);
|
|
71035
71113
|
const metadata = await stat5(resolvedPath);
|
|
71036
71114
|
if (!metadata.isFile()) {
|
|
71037
71115
|
return null;
|
|
@@ -71051,7 +71129,7 @@ async function resolveExecutablePath(requestedPath2, platform2 = process.platfor
|
|
|
71051
71129
|
}
|
|
71052
71130
|
}
|
|
71053
71131
|
async function findExecutableOnPath(executableName, environment, platform2 = process.platform) {
|
|
71054
|
-
const support =
|
|
71132
|
+
const support = processPlatformSupportFor(platform2);
|
|
71055
71133
|
const encodedPath = support.environmentValue(environment, "PATH") ?? "";
|
|
71056
71134
|
const separator = support.pathDelimiter;
|
|
71057
71135
|
const extensions = support.executableExtensions(executableName, environment);
|
|
@@ -71060,7 +71138,7 @@ async function findExecutableOnPath(executableName, environment, platform2 = pro
|
|
|
71060
71138
|
continue;
|
|
71061
71139
|
}
|
|
71062
71140
|
for (const extension of extensions) {
|
|
71063
|
-
const requestedPath2 = resolve9(
|
|
71141
|
+
const requestedPath2 = resolve9(join17(entry, `${executableName}${extension}`));
|
|
71064
71142
|
const executable = await resolveExecutablePath(requestedPath2, platform2);
|
|
71065
71143
|
if (executable !== null) {
|
|
71066
71144
|
return executable;
|
|
@@ -71309,10 +71387,10 @@ var hostPlatform, DEFAULT_OUTPUT_LIMIT_BYTES, PROCESS_GRACEFUL_STOP_TIMEOUT_MILL
|
|
|
71309
71387
|
var init_executable = __esm({
|
|
71310
71388
|
"src/util/process/executable.ts"() {
|
|
71311
71389
|
"use strict";
|
|
71312
|
-
|
|
71390
|
+
init_platform2();
|
|
71313
71391
|
init_process_error();
|
|
71314
71392
|
init_process_error();
|
|
71315
|
-
hostPlatform =
|
|
71393
|
+
hostPlatform = processPlatformSupportFor(process.platform);
|
|
71316
71394
|
DEFAULT_OUTPUT_LIMIT_BYTES = 16 * 1024;
|
|
71317
71395
|
PROCESS_GRACEFUL_STOP_TIMEOUT_MILLISECONDS = 1e3;
|
|
71318
71396
|
PROCESS_FORCED_STOP_TIMEOUT_MILLISECONDS = 5e3;
|
|
@@ -74415,154 +74493,6 @@ var init_title = __esm({
|
|
|
74415
74493
|
}
|
|
74416
74494
|
});
|
|
74417
74495
|
|
|
74418
|
-
// ../mobius-sdk/src/protocol/session/files/index.ts
|
|
74419
|
-
function binaryBytes(value) {
|
|
74420
|
-
if (value instanceof ArrayBuffer) {
|
|
74421
|
-
return new Uint8Array(value);
|
|
74422
|
-
}
|
|
74423
|
-
if (ArrayBuffer.isView(value)) {
|
|
74424
|
-
return new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
74425
|
-
}
|
|
74426
|
-
throw new Error("Content chunk must be a binary WebSocket frame");
|
|
74427
|
-
}
|
|
74428
|
-
function encodeContentChunkFrame(frame) {
|
|
74429
|
-
if (!isIdentifier(frame.requestId)) {
|
|
74430
|
-
throw new Error("Content chunk request identifier is invalid");
|
|
74431
|
-
}
|
|
74432
|
-
if (!Number.isSafeInteger(frame.sequence) || frame.sequence < 0 || frame.sequence > 4294967295) {
|
|
74433
|
-
throw new Error("Content chunk sequence is invalid");
|
|
74434
|
-
}
|
|
74435
|
-
if (frame.bytes.byteLength < 1 || frame.bytes.byteLength > CONTENT_CHUNK_MAX_BYTES) {
|
|
74436
|
-
throw new Error("Content chunk size is invalid");
|
|
74437
|
-
}
|
|
74438
|
-
const requestId = new TextEncoder().encode(frame.requestId);
|
|
74439
|
-
if (requestId.byteLength > 255) {
|
|
74440
|
-
throw new Error("Content chunk request identifier is too long");
|
|
74441
|
-
}
|
|
74442
|
-
const encoded = new Uint8Array(CONTENT_CHUNK_HEADER_BYTES + requestId.byteLength + frame.bytes.byteLength);
|
|
74443
|
-
encoded.set(CONTENT_CHUNK_MAGIC, 0);
|
|
74444
|
-
encoded[CONTENT_CHUNK_MAGIC.byteLength] = requestId.byteLength;
|
|
74445
|
-
new DataView(encoded.buffer).setUint32(CONTENT_CHUNK_MAGIC.byteLength + 1, frame.sequence);
|
|
74446
|
-
encoded.set(requestId, CONTENT_CHUNK_HEADER_BYTES);
|
|
74447
|
-
encoded.set(frame.bytes, CONTENT_CHUNK_HEADER_BYTES + requestId.byteLength);
|
|
74448
|
-
return encoded;
|
|
74449
|
-
}
|
|
74450
|
-
function decodeContentChunkFrame(value) {
|
|
74451
|
-
const encoded = binaryBytes(value);
|
|
74452
|
-
if (encoded.byteLength <= CONTENT_CHUNK_HEADER_BYTES || !CONTENT_CHUNK_MAGIC.every((byte, index2) => encoded[index2] === byte)) {
|
|
74453
|
-
throw new Error("Content chunk frame header is invalid");
|
|
74454
|
-
}
|
|
74455
|
-
const requestIdLength = encoded[CONTENT_CHUNK_MAGIC.byteLength] ?? 0;
|
|
74456
|
-
const payloadOffset = CONTENT_CHUNK_HEADER_BYTES + requestIdLength;
|
|
74457
|
-
if (requestIdLength < 1 || payloadOffset >= encoded.byteLength) {
|
|
74458
|
-
throw new Error("Content chunk frame length is invalid");
|
|
74459
|
-
}
|
|
74460
|
-
const requestId = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(
|
|
74461
|
-
encoded.subarray(CONTENT_CHUNK_HEADER_BYTES, payloadOffset)
|
|
74462
|
-
);
|
|
74463
|
-
const bytes = encoded.slice(payloadOffset);
|
|
74464
|
-
const sequence = new DataView(encoded.buffer, encoded.byteOffset, encoded.byteLength).getUint32(
|
|
74465
|
-
CONTENT_CHUNK_MAGIC.byteLength + 1
|
|
74466
|
-
);
|
|
74467
|
-
if (!isIdentifier(requestId) || bytes.byteLength > CONTENT_CHUNK_MAX_BYTES) {
|
|
74468
|
-
throw new Error("Content chunk frame is invalid");
|
|
74469
|
-
}
|
|
74470
|
-
return { bytes, requestId, sequence };
|
|
74471
|
-
}
|
|
74472
|
-
var FILE_READ_KIND, FILE_BEGIN_KIND, FILE_END_KIND, FILE_FAILED_KIND, CONTENT_WRITE_KIND, CONTENT_COMMIT_KIND, CONTENT_READY_KIND, CONTENT_AVAILABLE_KIND, CONTENT_CHUNK_MAX_BYTES, CONTENT_WRITE_MAX_BYTES, PROMPT_IMAGE_MAX_BYTES, CONTENT_CHUNK_MAGIC, CONTENT_CHUNK_HEADER_BYTES, fileReadCommandSchema, fileBeginEventSchema, contentWriteCommandSchema, contentCommitCommandSchema, contentReadyEventSchema, contentAvailableEventSchema, fileEndEventSchema, fileFailedEventSchema, decodeFileReadCommand, encodeFileReadCommand, decodeFileBeginEvent, encodeFileBeginEvent, decodeFileEndEvent, encodeFileEndEvent, decodeFileFailedEvent, encodeFileFailedEvent, decodeContentWriteCommand, encodeContentWriteCommand, decodeContentCommitCommand, encodeContentCommitCommand, decodeContentReadyEvent, encodeContentReadyEvent, decodeContentAvailableEvent, encodeContentAvailableEvent;
|
|
74473
|
-
var init_files = __esm({
|
|
74474
|
-
"../mobius-sdk/src/protocol/session/files/index.ts"() {
|
|
74475
|
-
"use strict";
|
|
74476
|
-
init_zod();
|
|
74477
|
-
init_identifier();
|
|
74478
|
-
init_message_codec();
|
|
74479
|
-
FILE_READ_KIND = "file.read";
|
|
74480
|
-
FILE_BEGIN_KIND = "file.begin";
|
|
74481
|
-
FILE_END_KIND = "file.end";
|
|
74482
|
-
FILE_FAILED_KIND = "file.failed";
|
|
74483
|
-
CONTENT_WRITE_KIND = "content.write";
|
|
74484
|
-
CONTENT_COMMIT_KIND = "content.commit";
|
|
74485
|
-
CONTENT_READY_KIND = "content.ready";
|
|
74486
|
-
CONTENT_AVAILABLE_KIND = "content.available";
|
|
74487
|
-
CONTENT_CHUNK_MAX_BYTES = 192 * 1024;
|
|
74488
|
-
CONTENT_WRITE_MAX_BYTES = 32 * 1024 * 1024;
|
|
74489
|
-
PROMPT_IMAGE_MAX_BYTES = 5e6;
|
|
74490
|
-
CONTENT_CHUNK_MAGIC = new Uint8Array([77, 66, 67, 49]);
|
|
74491
|
-
CONTENT_CHUNK_HEADER_BYTES = CONTENT_CHUNK_MAGIC.byteLength + 1 + 4;
|
|
74492
|
-
fileReadCommandSchema = external_exports.object({
|
|
74493
|
-
kind: external_exports.literal(FILE_READ_KIND),
|
|
74494
|
-
maxBytes: external_exports.number().int().positive().max(128 * 1024 * 1024),
|
|
74495
|
-
requestId: identifierStringSchema,
|
|
74496
|
-
sessionId: identifierStringSchema,
|
|
74497
|
-
path: external_exports.string().min(1).max(4096)
|
|
74498
|
-
}).readonly();
|
|
74499
|
-
fileBeginEventSchema = external_exports.object({
|
|
74500
|
-
byteLength: external_exports.number().int().positive().max(128 * 1024 * 1024),
|
|
74501
|
-
kind: external_exports.literal(FILE_BEGIN_KIND),
|
|
74502
|
-
mediaType: external_exports.string().min(1).max(255),
|
|
74503
|
-
modifiedAt: external_exports.iso.datetime({ offset: true }),
|
|
74504
|
-
name: external_exports.string().min(1).max(500),
|
|
74505
|
-
requestId: identifierStringSchema,
|
|
74506
|
-
sessionId: identifierStringSchema
|
|
74507
|
-
}).readonly();
|
|
74508
|
-
contentWriteCommandSchema = external_exports.object({
|
|
74509
|
-
byteLength: external_exports.number().int().positive().max(CONTENT_WRITE_MAX_BYTES),
|
|
74510
|
-
contentKey: external_exports.string().regex(/^[a-f0-9]{64}$/u),
|
|
74511
|
-
contentKind: external_exports.enum(["image", "resource"]),
|
|
74512
|
-
kind: external_exports.literal(CONTENT_WRITE_KIND),
|
|
74513
|
-
mediaType: external_exports.string().min(1).max(255),
|
|
74514
|
-
name: external_exports.string().min(1).max(500),
|
|
74515
|
-
requestId: identifierStringSchema,
|
|
74516
|
-
sessionId: identifierStringSchema
|
|
74517
|
-
}).readonly();
|
|
74518
|
-
contentCommitCommandSchema = external_exports.object({
|
|
74519
|
-
kind: external_exports.literal(CONTENT_COMMIT_KIND),
|
|
74520
|
-
requestId: identifierStringSchema,
|
|
74521
|
-
sessionId: identifierStringSchema
|
|
74522
|
-
}).readonly();
|
|
74523
|
-
contentReadyEventSchema = external_exports.object({
|
|
74524
|
-
kind: external_exports.literal(CONTENT_READY_KIND),
|
|
74525
|
-
requestId: identifierStringSchema,
|
|
74526
|
-
sessionId: identifierStringSchema
|
|
74527
|
-
}).readonly();
|
|
74528
|
-
contentAvailableEventSchema = external_exports.object({
|
|
74529
|
-
byteLength: external_exports.number().int().positive().max(CONTENT_WRITE_MAX_BYTES),
|
|
74530
|
-
contentKey: external_exports.string().regex(/^[a-f0-9]{64}$/u),
|
|
74531
|
-
kind: external_exports.literal(CONTENT_AVAILABLE_KIND),
|
|
74532
|
-
requestId: identifierStringSchema,
|
|
74533
|
-
sessionId: identifierStringSchema
|
|
74534
|
-
}).readonly();
|
|
74535
|
-
fileEndEventSchema = external_exports.object({
|
|
74536
|
-
kind: external_exports.literal(FILE_END_KIND),
|
|
74537
|
-
requestId: identifierStringSchema,
|
|
74538
|
-
sessionId: identifierStringSchema
|
|
74539
|
-
}).readonly();
|
|
74540
|
-
fileFailedEventSchema = external_exports.object({
|
|
74541
|
-
code: identifierStringSchema,
|
|
74542
|
-
kind: external_exports.literal(FILE_FAILED_KIND),
|
|
74543
|
-
message: external_exports.string().min(1).max(500),
|
|
74544
|
-
requestId: identifierStringSchema,
|
|
74545
|
-
sessionId: identifierStringSchema
|
|
74546
|
-
}).readonly();
|
|
74547
|
-
decodeFileReadCommand = (encoded) => decodeZodMessage(encoded, fileReadCommandSchema);
|
|
74548
|
-
encodeFileReadCommand = (message) => encodeZodMessage(message, fileReadCommandSchema);
|
|
74549
|
-
decodeFileBeginEvent = (encoded) => decodeZodMessage(encoded, fileBeginEventSchema);
|
|
74550
|
-
encodeFileBeginEvent = (message) => encodeZodMessage(message, fileBeginEventSchema);
|
|
74551
|
-
decodeFileEndEvent = (encoded) => decodeZodMessage(encoded, fileEndEventSchema);
|
|
74552
|
-
encodeFileEndEvent = (message) => encodeZodMessage(message, fileEndEventSchema);
|
|
74553
|
-
decodeFileFailedEvent = (encoded) => decodeZodMessage(encoded, fileFailedEventSchema);
|
|
74554
|
-
encodeFileFailedEvent = (message) => encodeZodMessage(message, fileFailedEventSchema);
|
|
74555
|
-
decodeContentWriteCommand = (encoded) => decodeZodMessage(encoded, contentWriteCommandSchema);
|
|
74556
|
-
encodeContentWriteCommand = (message) => encodeZodMessage(message, contentWriteCommandSchema);
|
|
74557
|
-
decodeContentCommitCommand = (encoded) => decodeZodMessage(encoded, contentCommitCommandSchema);
|
|
74558
|
-
encodeContentCommitCommand = (message) => encodeZodMessage(message, contentCommitCommandSchema);
|
|
74559
|
-
decodeContentReadyEvent = (encoded) => decodeZodMessage(encoded, contentReadyEventSchema);
|
|
74560
|
-
encodeContentReadyEvent = (message) => encodeZodMessage(message, contentReadyEventSchema);
|
|
74561
|
-
decodeContentAvailableEvent = (encoded) => decodeZodMessage(encoded, contentAvailableEventSchema);
|
|
74562
|
-
encodeContentAvailableEvent = (message) => encodeZodMessage(message, contentAvailableEventSchema);
|
|
74563
|
-
}
|
|
74564
|
-
});
|
|
74565
|
-
|
|
74566
74496
|
// ../mobius-sdk/src/protocol/shared/tool-input.ts
|
|
74567
74497
|
function boundedJsonIssue(value, depth = 0) {
|
|
74568
74498
|
if (depth > MAX_JSON_DEPTH) {
|
|
@@ -74737,6 +74667,730 @@ var init_interactions = __esm({
|
|
|
74737
74667
|
}
|
|
74738
74668
|
});
|
|
74739
74669
|
|
|
74670
|
+
// ../mobius-sdk/src/protocol/session/events/index.ts
|
|
74671
|
+
function isRecord4(value) {
|
|
74672
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
74673
|
+
}
|
|
74674
|
+
function hasUnknownDiscriminator(value, key, known) {
|
|
74675
|
+
if (!isRecord4(value)) {
|
|
74676
|
+
return false;
|
|
74677
|
+
}
|
|
74678
|
+
const variant = value[key];
|
|
74679
|
+
return typeof variant === "string" && !known.has(variant);
|
|
74680
|
+
}
|
|
74681
|
+
function containsUnknownContentBlock(value) {
|
|
74682
|
+
return hasUnknownDiscriminator(value, "type", knownContentBlockTypes);
|
|
74683
|
+
}
|
|
74684
|
+
function containsUnknownToolCallContent(value) {
|
|
74685
|
+
if (hasUnknownDiscriminator(value, "type", knownToolCallContentTypes)) {
|
|
74686
|
+
return true;
|
|
74687
|
+
}
|
|
74688
|
+
return isRecord4(value) && value["type"] === "content" && containsUnknownContentBlock(value["content"]);
|
|
74689
|
+
}
|
|
74690
|
+
function arrayContainsUnknown(value, predicate) {
|
|
74691
|
+
return Array.isArray(value) && value.some(predicate);
|
|
74692
|
+
}
|
|
74693
|
+
function containsUnknownAcpVariant(payload) {
|
|
74694
|
+
const update = payload["sessionUpdate"];
|
|
74695
|
+
if (typeof update !== "string") {
|
|
74696
|
+
return false;
|
|
74697
|
+
}
|
|
74698
|
+
if (!knownSessionUpdates.has(update)) {
|
|
74699
|
+
return true;
|
|
74700
|
+
}
|
|
74701
|
+
if (["user_message_chunk", "agent_message_chunk", "agent_thought_chunk", "compaction_summary_chunk"].includes(
|
|
74702
|
+
update
|
|
74703
|
+
)) {
|
|
74704
|
+
return containsUnknownContentBlock(payload["content"]);
|
|
74705
|
+
}
|
|
74706
|
+
if (update === "tool_call" || update === "tool_call_update") {
|
|
74707
|
+
return arrayContainsUnknown(payload["content"], containsUnknownToolCallContent);
|
|
74708
|
+
}
|
|
74709
|
+
if (update === "plan_update") {
|
|
74710
|
+
return hasUnknownDiscriminator(payload["plan"], "type", knownPlanTypes);
|
|
74711
|
+
}
|
|
74712
|
+
if (update === "config_option_update") {
|
|
74713
|
+
return arrayContainsUnknown(
|
|
74714
|
+
payload["configOptions"],
|
|
74715
|
+
(option) => hasUnknownDiscriminator(option, "type", knownConfigOptionTypes)
|
|
74716
|
+
);
|
|
74717
|
+
}
|
|
74718
|
+
if (update === "compaction_update") {
|
|
74719
|
+
return arrayContainsUnknown(payload["summary"], containsUnknownContentBlock);
|
|
74720
|
+
}
|
|
74721
|
+
return false;
|
|
74722
|
+
}
|
|
74723
|
+
function isKnownSessionEventVariant(value) {
|
|
74724
|
+
if (!isRecord4(value)) {
|
|
74725
|
+
return true;
|
|
74726
|
+
}
|
|
74727
|
+
const type = value["type"];
|
|
74728
|
+
if (typeof type !== "string") {
|
|
74729
|
+
return true;
|
|
74730
|
+
}
|
|
74731
|
+
if (type === "acp") {
|
|
74732
|
+
const payload = value["payload"];
|
|
74733
|
+
return !isRecord4(payload) || !containsUnknownAcpVariant(payload);
|
|
74734
|
+
}
|
|
74735
|
+
if (type === "lifecycle-metadata") {
|
|
74736
|
+
const payload = value["payload"];
|
|
74737
|
+
if (!isRecord4(payload)) {
|
|
74738
|
+
return true;
|
|
74739
|
+
}
|
|
74740
|
+
const kind = payload["kind"];
|
|
74741
|
+
if (typeof kind === "string" && !knownLifecycleKinds.has(kind)) {
|
|
74742
|
+
return false;
|
|
74743
|
+
}
|
|
74744
|
+
return kind !== "prompt.requested" || !arrayContainsUnknown(payload["content"], containsUnknownContentBlock);
|
|
74745
|
+
}
|
|
74746
|
+
return false;
|
|
74747
|
+
}
|
|
74748
|
+
function filterKnownSessionEventVariants(events) {
|
|
74749
|
+
return Array.isArray(events) ? events.filter(isKnownSessionEventVariant) : events;
|
|
74750
|
+
}
|
|
74751
|
+
function inputValue(value) {
|
|
74752
|
+
if (typeof value !== "string") {
|
|
74753
|
+
return value;
|
|
74754
|
+
}
|
|
74755
|
+
try {
|
|
74756
|
+
return JSON.parse(value);
|
|
74757
|
+
} catch (cause) {
|
|
74758
|
+
throw new ProtocolMessageError("Session Event Log V2 message is not valid JSON", { cause });
|
|
74759
|
+
}
|
|
74760
|
+
}
|
|
74761
|
+
function decode3(value, schema) {
|
|
74762
|
+
const result = schema.safeParse(inputValue(value));
|
|
74763
|
+
if (!result.success) {
|
|
74764
|
+
throw new ProtocolMessageError("Session Event Log V2 message does not match its schema", {
|
|
74765
|
+
cause: result.error
|
|
74766
|
+
});
|
|
74767
|
+
}
|
|
74768
|
+
return result.data;
|
|
74769
|
+
}
|
|
74770
|
+
function encode3(value, schema) {
|
|
74771
|
+
return JSON.stringify(decode3(value, schema));
|
|
74772
|
+
}
|
|
74773
|
+
function sanitizeKnownNativeSessionEvents(value) {
|
|
74774
|
+
const input2 = inputValue(value);
|
|
74775
|
+
if (!isRecord4(input2)) {
|
|
74776
|
+
return input2;
|
|
74777
|
+
}
|
|
74778
|
+
const page = input2["events"];
|
|
74779
|
+
const queuedPromptRequests = input2["queuedPromptRequests"];
|
|
74780
|
+
return {
|
|
74781
|
+
...input2,
|
|
74782
|
+
events: isRecord4(page) ? { ...page, events: filterKnownSessionEventVariants(page["events"]) } : page,
|
|
74783
|
+
queuedPromptRequests: Array.isArray(queuedPromptRequests) ? queuedPromptRequests.filter(
|
|
74784
|
+
(prompt) => !isRecord4(prompt) || !arrayContainsUnknown(prompt["content"], containsUnknownContentBlock)
|
|
74785
|
+
) : queuedPromptRequests
|
|
74786
|
+
};
|
|
74787
|
+
}
|
|
74788
|
+
var MAX_EVENT_COUNT, MAX_COLLECTION_SIZE2, MAX_CONTENT_LENGTH2, SESSION_EVENT_KIND, SESSION_EVENT_BATCH_MAX_SIZE, boundedString2, shortString, externalContentKeySchema, annotationsSchema, contentFields, textContentSchema, imageContentSchema, audioContentSchema, externalImageContentSchema, externalAudioContentSchema, externalResourceContentSchema, resourceLinkSchema, textResourceSchema, blobResourceSchema, embeddedResourceSchema, contentBlockSchema, toolCallContentSchema, toolKindSchema, toolStatusSchema, backgroundTaskSchema, toolPatchFields, planEntrySchema, planContentSchema, commandSchema, configSelectOptionSchema, configSelectGroupSchema, configBaseFields, sessionConfigOptionSchema2, contentChunkFields, acpSessionUpdateSchema, lifecycleBase, promptExecutionContextSchema, lifecycleMetadataSchema, sessionEventPayloadSchema, positionSchema, sharedSessionEventFields, sessionLiveEventFields, sessionEventSchema, sessionLiveEventSchema, wireLifecyclePayloadSchema, wireEventFields, sessionWireEventSchema, sessionWireEnvelopeSchema, knownContentBlockTypes, knownToolCallContentTypes, knownPlanTypes, knownConfigOptionTypes, knownSessionUpdates, knownLifecycleKinds, sessionEventBatchSchema, sessionLiveEventBatchSchema, sessionExportSchema, mobiusSessionExportSchema, sessionEventEnvelopeSchema, sessionEventLogPageSchema, sessionEventOmissionSchema, nativeEventPageRequestSchema, queuedPromptRequestEventLogSchema, nativeSessionEventsSchema, knownSessionLiveEventBatchSchema, decodeSessionEvent, decodeKnownSessionEventPayload, decodeSessionEventEnvelope, encodeSessionEventEnvelope, decodeAcpSessionUpdate, decodeKnownNativeSessionEvents;
|
|
74789
|
+
var init_events = __esm({
|
|
74790
|
+
"../mobius-sdk/src/protocol/session/events/index.ts"() {
|
|
74791
|
+
"use strict";
|
|
74792
|
+
init_zod();
|
|
74793
|
+
init_directory();
|
|
74794
|
+
init_tool_input();
|
|
74795
|
+
init_tool_input();
|
|
74796
|
+
init_identifier();
|
|
74797
|
+
init_message_codec();
|
|
74798
|
+
init_interactions();
|
|
74799
|
+
MAX_EVENT_COUNT = 1e4;
|
|
74800
|
+
MAX_COLLECTION_SIZE2 = 1e3;
|
|
74801
|
+
MAX_CONTENT_LENGTH2 = 1e6;
|
|
74802
|
+
SESSION_EVENT_KIND = "session.event.v2";
|
|
74803
|
+
SESSION_EVENT_BATCH_MAX_SIZE = 1e3;
|
|
74804
|
+
boundedString2 = external_exports.string().max(MAX_CONTENT_LENGTH2);
|
|
74805
|
+
shortString = external_exports.string().max(2048);
|
|
74806
|
+
externalContentKeySchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
74807
|
+
annotationsSchema = external_exports.object({
|
|
74808
|
+
audience: external_exports.array(external_exports.enum(["assistant", "user"])).max(2).readonly().nullable().optional(),
|
|
74809
|
+
lastModified: shortString.nullable().optional(),
|
|
74810
|
+
priority: external_exports.number().finite().nullable().optional()
|
|
74811
|
+
}).readonly();
|
|
74812
|
+
contentFields = { annotations: annotationsSchema.nullable().optional() };
|
|
74813
|
+
textContentSchema = external_exports.object({ ...contentFields, text: boundedString2, type: external_exports.literal("text") }).readonly();
|
|
74814
|
+
imageContentSchema = external_exports.object({
|
|
74815
|
+
...contentFields,
|
|
74816
|
+
data: external_exports.string(),
|
|
74817
|
+
mimeType: shortString,
|
|
74818
|
+
type: external_exports.literal("image"),
|
|
74819
|
+
uri: boundedString2.nullable().optional()
|
|
74820
|
+
}).readonly();
|
|
74821
|
+
audioContentSchema = external_exports.object({ ...contentFields, data: external_exports.string(), mimeType: shortString, type: external_exports.literal("audio") }).readonly();
|
|
74822
|
+
externalImageContentSchema = external_exports.object({
|
|
74823
|
+
...contentFields,
|
|
74824
|
+
byteLength: external_exports.number().int().positive().safe(),
|
|
74825
|
+
imageKey: externalContentKeySchema,
|
|
74826
|
+
mimeType: shortString,
|
|
74827
|
+
type: external_exports.literal("external_image"),
|
|
74828
|
+
uri: boundedString2.nullable().optional()
|
|
74829
|
+
}).readonly();
|
|
74830
|
+
externalAudioContentSchema = external_exports.object({
|
|
74831
|
+
...contentFields,
|
|
74832
|
+
audioKey: externalContentKeySchema,
|
|
74833
|
+
byteLength: external_exports.number().int().positive().safe(),
|
|
74834
|
+
mimeType: shortString,
|
|
74835
|
+
type: external_exports.literal("external_audio")
|
|
74836
|
+
}).readonly();
|
|
74837
|
+
externalResourceContentSchema = external_exports.object({
|
|
74838
|
+
...contentFields,
|
|
74839
|
+
byteLength: external_exports.number().int().positive().safe(),
|
|
74840
|
+
encoding: external_exports.enum(["binary", "text"]),
|
|
74841
|
+
mimeType: shortString.nullable().optional(),
|
|
74842
|
+
resourceKey: externalContentKeySchema,
|
|
74843
|
+
type: external_exports.literal("external_resource"),
|
|
74844
|
+
uri: boundedString2
|
|
74845
|
+
}).readonly();
|
|
74846
|
+
resourceLinkSchema = external_exports.object({
|
|
74847
|
+
...contentFields,
|
|
74848
|
+
description: boundedString2.nullable().optional(),
|
|
74849
|
+
mimeType: shortString.nullable().optional(),
|
|
74850
|
+
name: shortString,
|
|
74851
|
+
size: external_exports.number().int().nonnegative().safe().nullable().optional(),
|
|
74852
|
+
title: shortString.nullable().optional(),
|
|
74853
|
+
type: external_exports.literal("resource_link"),
|
|
74854
|
+
uri: boundedString2
|
|
74855
|
+
}).readonly();
|
|
74856
|
+
textResourceSchema = external_exports.object({
|
|
74857
|
+
mimeType: shortString.nullable().optional(),
|
|
74858
|
+
text: boundedString2,
|
|
74859
|
+
uri: boundedString2
|
|
74860
|
+
}).readonly();
|
|
74861
|
+
blobResourceSchema = external_exports.object({
|
|
74862
|
+
blob: external_exports.string(),
|
|
74863
|
+
mimeType: shortString.nullable().optional(),
|
|
74864
|
+
uri: boundedString2
|
|
74865
|
+
}).readonly();
|
|
74866
|
+
embeddedResourceSchema = external_exports.object({
|
|
74867
|
+
...contentFields,
|
|
74868
|
+
resource: external_exports.union([textResourceSchema, blobResourceSchema]),
|
|
74869
|
+
type: external_exports.literal("resource")
|
|
74870
|
+
}).readonly();
|
|
74871
|
+
contentBlockSchema = external_exports.discriminatedUnion("type", [
|
|
74872
|
+
textContentSchema,
|
|
74873
|
+
imageContentSchema,
|
|
74874
|
+
audioContentSchema,
|
|
74875
|
+
resourceLinkSchema,
|
|
74876
|
+
embeddedResourceSchema,
|
|
74877
|
+
externalImageContentSchema,
|
|
74878
|
+
externalAudioContentSchema,
|
|
74879
|
+
externalResourceContentSchema
|
|
74880
|
+
]);
|
|
74881
|
+
toolCallContentSchema = external_exports.discriminatedUnion("type", [
|
|
74882
|
+
external_exports.object({ content: contentBlockSchema, type: external_exports.literal("content") }).readonly(),
|
|
74883
|
+
external_exports.object({
|
|
74884
|
+
newText: boundedString2,
|
|
74885
|
+
oldText: boundedString2.nullable().optional(),
|
|
74886
|
+
path: boundedString2,
|
|
74887
|
+
type: external_exports.literal("diff")
|
|
74888
|
+
}).readonly(),
|
|
74889
|
+
external_exports.object({ terminalId: shortString, type: external_exports.literal("terminal") }).readonly()
|
|
74890
|
+
]);
|
|
74891
|
+
toolKindSchema = external_exports.enum([
|
|
74892
|
+
"read",
|
|
74893
|
+
"edit",
|
|
74894
|
+
"delete",
|
|
74895
|
+
"move",
|
|
74896
|
+
"search",
|
|
74897
|
+
"execute",
|
|
74898
|
+
"think",
|
|
74899
|
+
"fetch",
|
|
74900
|
+
"switch_mode",
|
|
74901
|
+
"other"
|
|
74902
|
+
]);
|
|
74903
|
+
toolStatusSchema = external_exports.enum(["pending", "in_progress", "completed", "failed"]);
|
|
74904
|
+
backgroundTaskSchema = external_exports.object({
|
|
74905
|
+
id: shortString,
|
|
74906
|
+
status: external_exports.enum(["running", "completed", "failed", "stopped", "unknown"])
|
|
74907
|
+
}).readonly();
|
|
74908
|
+
toolPatchFields = {
|
|
74909
|
+
backgroundTask: backgroundTaskSchema.optional(),
|
|
74910
|
+
content: external_exports.array(toolCallContentSchema).max(MAX_COLLECTION_SIZE2).readonly().nullable().optional(),
|
|
74911
|
+
kind: toolKindSchema.nullable().optional(),
|
|
74912
|
+
locations: external_exports.array(toolCallLocationSchema).max(MAX_COLLECTION_SIZE2).readonly().nullable().optional(),
|
|
74913
|
+
name: shortString.nullable().optional(),
|
|
74914
|
+
rawInput: boundedJsonSchema.optional(),
|
|
74915
|
+
rawOutput: boundedJsonSchema.optional(),
|
|
74916
|
+
status: toolStatusSchema.nullable().optional(),
|
|
74917
|
+
title: boundedString2.nullable().optional()
|
|
74918
|
+
};
|
|
74919
|
+
planEntrySchema = external_exports.object({
|
|
74920
|
+
content: boundedString2,
|
|
74921
|
+
priority: external_exports.enum(["high", "medium", "low"]),
|
|
74922
|
+
status: external_exports.enum(["pending", "in_progress", "completed"])
|
|
74923
|
+
}).readonly();
|
|
74924
|
+
planContentSchema = external_exports.discriminatedUnion("type", [
|
|
74925
|
+
external_exports.object({
|
|
74926
|
+
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
74927
|
+
planId: shortString,
|
|
74928
|
+
type: external_exports.literal("items")
|
|
74929
|
+
}).readonly(),
|
|
74930
|
+
external_exports.object({ planId: shortString, type: external_exports.literal("file"), uri: boundedString2 }).readonly(),
|
|
74931
|
+
external_exports.object({
|
|
74932
|
+
content: boundedString2,
|
|
74933
|
+
planId: shortString,
|
|
74934
|
+
type: external_exports.literal("markdown")
|
|
74935
|
+
}).readonly()
|
|
74936
|
+
]);
|
|
74937
|
+
commandSchema = external_exports.object({
|
|
74938
|
+
description: boundedString2,
|
|
74939
|
+
input: external_exports.object({ hint: boundedString2 }).readonly().nullable().optional(),
|
|
74940
|
+
name: shortString
|
|
74941
|
+
}).readonly();
|
|
74942
|
+
configSelectOptionSchema = external_exports.object({
|
|
74943
|
+
description: boundedString2.nullable().optional(),
|
|
74944
|
+
name: shortString,
|
|
74945
|
+
value: shortString
|
|
74946
|
+
}).readonly();
|
|
74947
|
+
configSelectGroupSchema = external_exports.object({
|
|
74948
|
+
group: shortString,
|
|
74949
|
+
name: shortString,
|
|
74950
|
+
options: external_exports.array(configSelectOptionSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
74951
|
+
}).readonly();
|
|
74952
|
+
configBaseFields = {
|
|
74953
|
+
category: shortString.nullable().optional(),
|
|
74954
|
+
description: boundedString2.nullable().optional(),
|
|
74955
|
+
id: shortString,
|
|
74956
|
+
name: shortString
|
|
74957
|
+
};
|
|
74958
|
+
sessionConfigOptionSchema2 = external_exports.discriminatedUnion("type", [
|
|
74959
|
+
external_exports.object({
|
|
74960
|
+
...configBaseFields,
|
|
74961
|
+
currentValue: shortString,
|
|
74962
|
+
options: external_exports.union([
|
|
74963
|
+
external_exports.array(configSelectOptionSchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
74964
|
+
external_exports.array(configSelectGroupSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
74965
|
+
]),
|
|
74966
|
+
type: external_exports.literal("select")
|
|
74967
|
+
}).readonly(),
|
|
74968
|
+
external_exports.object({ ...configBaseFields, currentValue: external_exports.boolean(), type: external_exports.literal("boolean") }).readonly()
|
|
74969
|
+
]);
|
|
74970
|
+
contentChunkFields = {
|
|
74971
|
+
content: contentBlockSchema,
|
|
74972
|
+
messageId: shortString.nullable().optional()
|
|
74973
|
+
};
|
|
74974
|
+
acpSessionUpdateSchema = external_exports.discriminatedUnion("sessionUpdate", [
|
|
74975
|
+
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("user_message_chunk") }).readonly(),
|
|
74976
|
+
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("agent_message_chunk") }).readonly(),
|
|
74977
|
+
external_exports.object({
|
|
74978
|
+
...contentChunkFields,
|
|
74979
|
+
meta: external_exports.object({ truncated: external_exports.boolean().optional() }).readonly().optional(),
|
|
74980
|
+
sessionUpdate: external_exports.literal("agent_thought_chunk")
|
|
74981
|
+
}).readonly(),
|
|
74982
|
+
external_exports.object({
|
|
74983
|
+
backgroundTask: backgroundTaskSchema.optional(),
|
|
74984
|
+
content: external_exports.array(toolCallContentSchema).max(MAX_COLLECTION_SIZE2).readonly().optional(),
|
|
74985
|
+
kind: toolKindSchema.optional(),
|
|
74986
|
+
locations: external_exports.array(toolCallLocationSchema).max(MAX_COLLECTION_SIZE2).readonly().optional(),
|
|
74987
|
+
name: shortString.nullable().optional(),
|
|
74988
|
+
rawInput: boundedJsonSchema.optional(),
|
|
74989
|
+
rawOutput: boundedJsonSchema.optional(),
|
|
74990
|
+
sessionUpdate: external_exports.literal("tool_call"),
|
|
74991
|
+
status: toolStatusSchema.optional(),
|
|
74992
|
+
title: boundedString2,
|
|
74993
|
+
toolCallId: shortString
|
|
74994
|
+
}).readonly(),
|
|
74995
|
+
external_exports.object({ ...toolPatchFields, sessionUpdate: external_exports.literal("tool_call_update"), toolCallId: shortString }).readonly(),
|
|
74996
|
+
external_exports.object({
|
|
74997
|
+
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
74998
|
+
sessionUpdate: external_exports.literal("plan")
|
|
74999
|
+
}).readonly(),
|
|
75000
|
+
external_exports.object({ plan: planContentSchema, sessionUpdate: external_exports.literal("plan_update") }).readonly(),
|
|
75001
|
+
external_exports.object({ planId: shortString, sessionUpdate: external_exports.literal("plan_removed") }).readonly(),
|
|
75002
|
+
external_exports.object({
|
|
75003
|
+
availableCommands: external_exports.array(commandSchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
75004
|
+
sessionUpdate: external_exports.literal("available_commands_update")
|
|
75005
|
+
}).readonly(),
|
|
75006
|
+
external_exports.object({
|
|
75007
|
+
currentModeId: shortString,
|
|
75008
|
+
sessionUpdate: external_exports.literal("current_mode_update")
|
|
75009
|
+
}).readonly(),
|
|
75010
|
+
external_exports.object({
|
|
75011
|
+
configOptions: external_exports.array(sessionConfigOptionSchema2).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
75012
|
+
sessionUpdate: external_exports.literal("config_option_update")
|
|
75013
|
+
}).readonly(),
|
|
75014
|
+
external_exports.object({
|
|
75015
|
+
sessionUpdate: external_exports.literal("session_info_update"),
|
|
75016
|
+
title: boundedString2.nullable().optional(),
|
|
75017
|
+
updatedAt: shortString.nullable().optional()
|
|
75018
|
+
}).readonly(),
|
|
75019
|
+
external_exports.object({
|
|
75020
|
+
cost: external_exports.object({ amount: external_exports.number().finite(), currency: external_exports.string().max(16) }).readonly().nullable().optional(),
|
|
75021
|
+
sessionUpdate: external_exports.literal("usage_update"),
|
|
75022
|
+
size: external_exports.number().int().nonnegative().safe(),
|
|
75023
|
+
used: external_exports.number().int().nonnegative().safe()
|
|
75024
|
+
}).readonly(),
|
|
75025
|
+
external_exports.object({
|
|
75026
|
+
compactionId: shortString,
|
|
75027
|
+
error: boundedString2.nullable().optional(),
|
|
75028
|
+
sessionUpdate: external_exports.literal("compaction_update"),
|
|
75029
|
+
status: shortString,
|
|
75030
|
+
summary: external_exports.array(contentBlockSchema).max(MAX_COLLECTION_SIZE2).readonly().nullable().optional()
|
|
75031
|
+
}).readonly(),
|
|
75032
|
+
external_exports.object({
|
|
75033
|
+
compactionId: shortString,
|
|
75034
|
+
content: contentBlockSchema,
|
|
75035
|
+
sessionUpdate: external_exports.literal("compaction_summary_chunk")
|
|
75036
|
+
}).readonly()
|
|
75037
|
+
]);
|
|
75038
|
+
lifecycleBase = { commandId: identifierStringSchema };
|
|
75039
|
+
promptExecutionContextSchema = external_exports.object({
|
|
75040
|
+
agentId: identifierStringSchema,
|
|
75041
|
+
directoryId: DIRECTORY_IDENTIFIER,
|
|
75042
|
+
additionalDirectoryIds: external_exports.array(DIRECTORY_IDENTIFIER).max(16).readonly()
|
|
75043
|
+
}).readonly();
|
|
75044
|
+
lifecycleMetadataSchema = external_exports.discriminatedUnion("kind", [
|
|
75045
|
+
external_exports.object({ kind: external_exports.literal("session.queue.changed") }).readonly(),
|
|
75046
|
+
external_exports.object({ event: sessionPermissionRequestedEventSchema, kind: external_exports.literal("session.permission.requested") }).readonly(),
|
|
75047
|
+
external_exports.object({ event: sessionPermissionResolvedEventSchema, kind: external_exports.literal("session.permission.resolved") }).readonly(),
|
|
75048
|
+
external_exports.object({ event: sessionElicitationRequestedEventSchema, kind: external_exports.literal("session.elicitation.requested") }).readonly(),
|
|
75049
|
+
external_exports.object({ event: sessionElicitationResolvedEventSchema, kind: external_exports.literal("session.elicitation.resolved") }).readonly(),
|
|
75050
|
+
external_exports.object({
|
|
75051
|
+
...lifecycleBase,
|
|
75052
|
+
content: external_exports.array(contentBlockSchema).min(1).max(100).readonly(),
|
|
75053
|
+
disposition: shortString.optional(),
|
|
75054
|
+
kind: external_exports.literal("prompt.requested"),
|
|
75055
|
+
context: promptExecutionContextSchema.optional(),
|
|
75056
|
+
targetCommandId: identifierStringSchema.optional()
|
|
75057
|
+
}).readonly(),
|
|
75058
|
+
external_exports.object({ ...lifecycleBase, attemptId: identifierStringSchema, epoch: identifierStringSchema, kind: external_exports.literal("prompt.started") }).readonly(),
|
|
75059
|
+
external_exports.object({
|
|
75060
|
+
...lifecycleBase,
|
|
75061
|
+
kind: external_exports.literal("prompt.completed"),
|
|
75062
|
+
stopReason: shortString
|
|
75063
|
+
}).readonly(),
|
|
75064
|
+
external_exports.object({
|
|
75065
|
+
...lifecycleBase,
|
|
75066
|
+
code: identifierStringSchema,
|
|
75067
|
+
kind: external_exports.literal("prompt.failed-before-start"),
|
|
75068
|
+
message: external_exports.string().min(1).max(500)
|
|
75069
|
+
}).readonly(),
|
|
75070
|
+
external_exports.object({
|
|
75071
|
+
...lifecycleBase,
|
|
75072
|
+
attemptId: identifierStringSchema,
|
|
75073
|
+
code: identifierStringSchema,
|
|
75074
|
+
kind: external_exports.literal("prompt.failed"),
|
|
75075
|
+
message: external_exports.string().min(1).max(500)
|
|
75076
|
+
}).readonly()
|
|
75077
|
+
]);
|
|
75078
|
+
sessionEventPayloadSchema = external_exports.discriminatedUnion("type", [
|
|
75079
|
+
external_exports.object({ payload: acpSessionUpdateSchema, type: external_exports.literal("acp") }).readonly(),
|
|
75080
|
+
external_exports.object({ payload: lifecycleMetadataSchema, type: external_exports.literal("lifecycle-metadata") }).readonly()
|
|
75081
|
+
]);
|
|
75082
|
+
positionSchema = external_exports.string().regex(/^(0|[1-9][0-9]*)$/);
|
|
75083
|
+
sharedSessionEventFields = {
|
|
75084
|
+
eventId: identifierStringSchema,
|
|
75085
|
+
mobiusMetadata: external_exports.object({ omitted: external_exports.literal(true).optional() }).readonly().optional(),
|
|
75086
|
+
recordedAt: external_exports.iso.datetime({ offset: true }),
|
|
75087
|
+
sessionGenerationId: identifierStringSchema,
|
|
75088
|
+
sessionId: identifierStringSchema
|
|
75089
|
+
};
|
|
75090
|
+
sessionLiveEventFields = { ...sharedSessionEventFields, position: positionSchema };
|
|
75091
|
+
sessionEventSchema = external_exports.object({ ...sharedSessionEventFields, payload: acpSessionUpdateSchema, type: external_exports.literal("acp") }).readonly();
|
|
75092
|
+
sessionLiveEventSchema = external_exports.discriminatedUnion("type", [
|
|
75093
|
+
external_exports.object({ ...sessionLiveEventFields, payload: acpSessionUpdateSchema, type: external_exports.literal("acp") }).readonly(),
|
|
75094
|
+
external_exports.object({
|
|
75095
|
+
...sessionLiveEventFields,
|
|
75096
|
+
payload: lifecycleMetadataSchema,
|
|
75097
|
+
type: external_exports.literal("lifecycle-metadata")
|
|
75098
|
+
}).readonly()
|
|
75099
|
+
]);
|
|
75100
|
+
wireLifecyclePayloadSchema = external_exports.object({
|
|
75101
|
+
kind: identifierStringSchema,
|
|
75102
|
+
commandId: identifierStringSchema.optional(),
|
|
75103
|
+
context: promptExecutionContextSchema.unwrap().passthrough().readonly().optional(),
|
|
75104
|
+
event: external_exports.object({ interactionId: identifierStringSchema.optional() }).passthrough().readonly().optional()
|
|
75105
|
+
}).passthrough().readonly();
|
|
75106
|
+
wireEventFields = {
|
|
75107
|
+
...sessionLiveEventFields,
|
|
75108
|
+
mobiusMetadata: external_exports.object({ omitted: external_exports.literal(true).optional() }).passthrough().readonly().optional()
|
|
75109
|
+
};
|
|
75110
|
+
sessionWireEventSchema = external_exports.union([
|
|
75111
|
+
external_exports.object({
|
|
75112
|
+
...wireEventFields,
|
|
75113
|
+
type: external_exports.literal("acp"),
|
|
75114
|
+
payload: external_exports.object({ sessionUpdate: identifierStringSchema }).passthrough().readonly()
|
|
75115
|
+
}).passthrough().readonly(),
|
|
75116
|
+
external_exports.object({
|
|
75117
|
+
...wireEventFields,
|
|
75118
|
+
type: external_exports.literal("lifecycle-metadata"),
|
|
75119
|
+
payload: wireLifecyclePayloadSchema
|
|
75120
|
+
}).passthrough().readonly(),
|
|
75121
|
+
external_exports.object({
|
|
75122
|
+
...wireEventFields,
|
|
75123
|
+
type: identifierStringSchema.refine((type) => type !== "acp" && type !== "lifecycle-metadata"),
|
|
75124
|
+
payload: external_exports.record(external_exports.string(), external_exports.unknown()).readonly()
|
|
75125
|
+
}).passthrough().readonly()
|
|
75126
|
+
]);
|
|
75127
|
+
sessionWireEnvelopeSchema = external_exports.object({
|
|
75128
|
+
kind: external_exports.literal(SESSION_EVENT_KIND),
|
|
75129
|
+
events: external_exports.array(sessionWireEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly()
|
|
75130
|
+
}).passthrough().readonly();
|
|
75131
|
+
knownContentBlockTypes = /* @__PURE__ */ new Set([
|
|
75132
|
+
"text",
|
|
75133
|
+
"image",
|
|
75134
|
+
"audio",
|
|
75135
|
+
"resource_link",
|
|
75136
|
+
"resource",
|
|
75137
|
+
"external_image",
|
|
75138
|
+
"external_audio",
|
|
75139
|
+
"external_resource"
|
|
75140
|
+
]);
|
|
75141
|
+
knownToolCallContentTypes = /* @__PURE__ */ new Set(["content", "diff", "terminal"]);
|
|
75142
|
+
knownPlanTypes = /* @__PURE__ */ new Set(["items", "file", "markdown"]);
|
|
75143
|
+
knownConfigOptionTypes = /* @__PURE__ */ new Set(["select", "boolean"]);
|
|
75144
|
+
knownSessionUpdates = /* @__PURE__ */ new Set([
|
|
75145
|
+
"user_message_chunk",
|
|
75146
|
+
"agent_message_chunk",
|
|
75147
|
+
"agent_thought_chunk",
|
|
75148
|
+
"tool_call",
|
|
75149
|
+
"tool_call_update",
|
|
75150
|
+
"plan",
|
|
75151
|
+
"plan_update",
|
|
75152
|
+
"plan_removed",
|
|
75153
|
+
"available_commands_update",
|
|
75154
|
+
"current_mode_update",
|
|
75155
|
+
"config_option_update",
|
|
75156
|
+
"session_info_update",
|
|
75157
|
+
"usage_update",
|
|
75158
|
+
"compaction_update",
|
|
75159
|
+
"compaction_summary_chunk"
|
|
75160
|
+
]);
|
|
75161
|
+
knownLifecycleKinds = /* @__PURE__ */ new Set([
|
|
75162
|
+
"session.queue.changed",
|
|
75163
|
+
"session.permission.requested",
|
|
75164
|
+
"session.permission.resolved",
|
|
75165
|
+
"session.elicitation.requested",
|
|
75166
|
+
"session.elicitation.resolved",
|
|
75167
|
+
"prompt.requested",
|
|
75168
|
+
"prompt.started",
|
|
75169
|
+
"prompt.completed",
|
|
75170
|
+
"prompt.failed-before-start",
|
|
75171
|
+
"prompt.failed"
|
|
75172
|
+
]);
|
|
75173
|
+
sessionEventBatchSchema = external_exports.array(sessionEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
75174
|
+
sessionLiveEventBatchSchema = external_exports.array(sessionLiveEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
75175
|
+
sessionExportSchema = external_exports.object({
|
|
75176
|
+
binding: external_exports.object({
|
|
75177
|
+
bindingId: identifierStringSchema,
|
|
75178
|
+
runtimeId: identifierStringSchema
|
|
75179
|
+
}).readonly(),
|
|
75180
|
+
events: external_exports.array(sessionEventSchema).max(MAX_EVENT_COUNT).readonly(),
|
|
75181
|
+
sessionId: identifierStringSchema,
|
|
75182
|
+
truncated: external_exports.boolean()
|
|
75183
|
+
}).readonly().superRefine((session, context) => {
|
|
75184
|
+
const eventIds = /* @__PURE__ */ new Set();
|
|
75185
|
+
for (const [index2, event] of session.events.entries()) {
|
|
75186
|
+
if (event.sessionId !== session.sessionId) {
|
|
75187
|
+
context.addIssue({
|
|
75188
|
+
code: "custom",
|
|
75189
|
+
message: "Exported event belongs to a different Session",
|
|
75190
|
+
path: ["events", index2, "sessionId"]
|
|
75191
|
+
});
|
|
75192
|
+
}
|
|
75193
|
+
if (eventIds.has(event.eventId)) {
|
|
75194
|
+
context.addIssue({
|
|
75195
|
+
code: "custom",
|
|
75196
|
+
message: "Exported event identities are not unique",
|
|
75197
|
+
path: ["events", index2, "eventId"]
|
|
75198
|
+
});
|
|
75199
|
+
}
|
|
75200
|
+
eventIds.add(event.eventId);
|
|
75201
|
+
}
|
|
75202
|
+
});
|
|
75203
|
+
mobiusSessionExportSchema = external_exports.object({
|
|
75204
|
+
formatVersion: external_exports.literal("2"),
|
|
75205
|
+
session: sessionExportSchema
|
|
75206
|
+
}).readonly();
|
|
75207
|
+
sessionEventEnvelopeSchema = external_exports.object({ events: sessionLiveEventBatchSchema, kind: external_exports.literal(SESSION_EVENT_KIND) }).readonly();
|
|
75208
|
+
sessionEventLogPageSchema = external_exports.object({
|
|
75209
|
+
events: external_exports.array(sessionEventSchema).max(MAX_EVENT_COUNT).readonly(),
|
|
75210
|
+
nextCursor: external_exports.string().min(1).max(512).nullable(),
|
|
75211
|
+
sessionGenerationId: identifierStringSchema,
|
|
75212
|
+
tailCursor: external_exports.string().max(512),
|
|
75213
|
+
// The generation-scoped live position covered by this snapshot, including
|
|
75214
|
+
// coalesced and omitted events. Absent only on older Runtime versions.
|
|
75215
|
+
throughPosition: positionSchema.optional(),
|
|
75216
|
+
truncated: external_exports.boolean(),
|
|
75217
|
+
version: external_exports.literal(2)
|
|
75218
|
+
}).readonly();
|
|
75219
|
+
sessionEventOmissionSchema = external_exports.literal("agent-reasoning");
|
|
75220
|
+
nativeEventPageRequestSchema = external_exports.object({
|
|
75221
|
+
cursor: external_exports.string().min(1).max(512).nullable(),
|
|
75222
|
+
eventLimit: external_exports.number().int().min(1).max(1e4),
|
|
75223
|
+
// Legacy callers may still send this option; readers must ignore it.
|
|
75224
|
+
omit: external_exports.array(sessionEventOmissionSchema).max(1).readonly().optional()
|
|
75225
|
+
}).readonly();
|
|
75226
|
+
queuedPromptRequestEventLogSchema = external_exports.object({
|
|
75227
|
+
commandId: identifierStringSchema,
|
|
75228
|
+
content: external_exports.array(contentBlockSchema).min(1).max(100).readonly(),
|
|
75229
|
+
disposition: shortString.optional(),
|
|
75230
|
+
targetCommandId: identifierStringSchema.optional()
|
|
75231
|
+
}).readonly();
|
|
75232
|
+
nativeSessionEventsSchema = external_exports.object({
|
|
75233
|
+
events: sessionEventLogPageSchema,
|
|
75234
|
+
queuedPromptRequests: external_exports.array(queuedPromptRequestEventLogSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
75235
|
+
}).readonly();
|
|
75236
|
+
knownSessionLiveEventBatchSchema = external_exports.array(sessionLiveEventSchema).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
75237
|
+
decodeSessionEvent = (value) => decode3(value, sessionEventSchema);
|
|
75238
|
+
decodeKnownSessionEventPayload = (value) => isKnownSessionEventVariant(value) ? decode3(value, sessionEventPayloadSchema) : null;
|
|
75239
|
+
decodeSessionEventEnvelope = (value) => decode3(value, sessionEventEnvelopeSchema);
|
|
75240
|
+
encodeSessionEventEnvelope = (value) => encode3(value, sessionEventEnvelopeSchema);
|
|
75241
|
+
decodeAcpSessionUpdate = (value) => decode3(value, acpSessionUpdateSchema);
|
|
75242
|
+
decodeKnownNativeSessionEvents = (value) => decode3(sanitizeKnownNativeSessionEvents(value), nativeSessionEventsSchema);
|
|
75243
|
+
}
|
|
75244
|
+
});
|
|
75245
|
+
|
|
75246
|
+
// ../mobius-sdk/src/protocol/session/files/index.ts
|
|
75247
|
+
function binaryBytes(value) {
|
|
75248
|
+
if (value instanceof ArrayBuffer) {
|
|
75249
|
+
return new Uint8Array(value);
|
|
75250
|
+
}
|
|
75251
|
+
if (ArrayBuffer.isView(value)) {
|
|
75252
|
+
return new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
75253
|
+
}
|
|
75254
|
+
throw new Error("Content chunk must be a binary WebSocket frame");
|
|
75255
|
+
}
|
|
75256
|
+
function encodeContentChunkFrame(frame) {
|
|
75257
|
+
if (!isIdentifier(frame.requestId)) {
|
|
75258
|
+
throw new Error("Content chunk request identifier is invalid");
|
|
75259
|
+
}
|
|
75260
|
+
if (!Number.isSafeInteger(frame.sequence) || frame.sequence < 0 || frame.sequence > 4294967295) {
|
|
75261
|
+
throw new Error("Content chunk sequence is invalid");
|
|
75262
|
+
}
|
|
75263
|
+
if (frame.bytes.byteLength < 1 || frame.bytes.byteLength > CONTENT_CHUNK_MAX_BYTES) {
|
|
75264
|
+
throw new Error("Content chunk size is invalid");
|
|
75265
|
+
}
|
|
75266
|
+
const requestId = new TextEncoder().encode(frame.requestId);
|
|
75267
|
+
if (requestId.byteLength > 255) {
|
|
75268
|
+
throw new Error("Content chunk request identifier is too long");
|
|
75269
|
+
}
|
|
75270
|
+
const encoded = new Uint8Array(CONTENT_CHUNK_HEADER_BYTES + requestId.byteLength + frame.bytes.byteLength);
|
|
75271
|
+
encoded.set(CONTENT_CHUNK_MAGIC, 0);
|
|
75272
|
+
encoded[CONTENT_CHUNK_MAGIC.byteLength] = requestId.byteLength;
|
|
75273
|
+
new DataView(encoded.buffer).setUint32(CONTENT_CHUNK_MAGIC.byteLength + 1, frame.sequence);
|
|
75274
|
+
encoded.set(requestId, CONTENT_CHUNK_HEADER_BYTES);
|
|
75275
|
+
encoded.set(frame.bytes, CONTENT_CHUNK_HEADER_BYTES + requestId.byteLength);
|
|
75276
|
+
return encoded;
|
|
75277
|
+
}
|
|
75278
|
+
function decodeContentChunkFrame(value) {
|
|
75279
|
+
const encoded = binaryBytes(value);
|
|
75280
|
+
if (encoded.byteLength <= CONTENT_CHUNK_HEADER_BYTES || !CONTENT_CHUNK_MAGIC.every((byte, index2) => encoded[index2] === byte)) {
|
|
75281
|
+
throw new Error("Content chunk frame header is invalid");
|
|
75282
|
+
}
|
|
75283
|
+
const requestIdLength = encoded[CONTENT_CHUNK_MAGIC.byteLength] ?? 0;
|
|
75284
|
+
const payloadOffset = CONTENT_CHUNK_HEADER_BYTES + requestIdLength;
|
|
75285
|
+
if (requestIdLength < 1 || payloadOffset >= encoded.byteLength) {
|
|
75286
|
+
throw new Error("Content chunk frame length is invalid");
|
|
75287
|
+
}
|
|
75288
|
+
const requestId = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(
|
|
75289
|
+
encoded.subarray(CONTENT_CHUNK_HEADER_BYTES, payloadOffset)
|
|
75290
|
+
);
|
|
75291
|
+
const bytes = encoded.slice(payloadOffset);
|
|
75292
|
+
const sequence = new DataView(encoded.buffer, encoded.byteOffset, encoded.byteLength).getUint32(
|
|
75293
|
+
CONTENT_CHUNK_MAGIC.byteLength + 1
|
|
75294
|
+
);
|
|
75295
|
+
if (!isIdentifier(requestId) || bytes.byteLength > CONTENT_CHUNK_MAX_BYTES) {
|
|
75296
|
+
throw new Error("Content chunk frame is invalid");
|
|
75297
|
+
}
|
|
75298
|
+
return { bytes, requestId, sequence };
|
|
75299
|
+
}
|
|
75300
|
+
var FILE_READ_KIND, FILE_BEGIN_KIND, FILE_END_KIND, FILE_FAILED_KIND, CONTENT_WRITE_KIND, CONTENT_COMMIT_KIND, CONTENT_READY_KIND, CONTENT_AVAILABLE_KIND, CONTENT_CHUNK_MAX_BYTES, CONTENT_WRITE_MAX_BYTES, PROMPT_IMAGE_MAX_BYTES, CONTENT_CHUNK_MAGIC, CONTENT_CHUNK_HEADER_BYTES, fileReadCommandSchema, fileBeginEventSchema, contentWriteCommandSchema, contentCommitCommandSchema, contentReadyEventSchema, contentAvailableEventSchema, fileEndEventSchema, fileFailedEventSchema, decodeFileReadCommand, encodeFileReadCommand, decodeFileBeginEvent, encodeFileBeginEvent, decodeFileEndEvent, encodeFileEndEvent, decodeFileFailedEvent, encodeFileFailedEvent, decodeContentWriteCommand, encodeContentWriteCommand, decodeContentCommitCommand, encodeContentCommitCommand, decodeContentReadyEvent, encodeContentReadyEvent, decodeContentAvailableEvent, encodeContentAvailableEvent;
|
|
75301
|
+
var init_files = __esm({
|
|
75302
|
+
"../mobius-sdk/src/protocol/session/files/index.ts"() {
|
|
75303
|
+
"use strict";
|
|
75304
|
+
init_zod();
|
|
75305
|
+
init_identifier();
|
|
75306
|
+
init_message_codec();
|
|
75307
|
+
FILE_READ_KIND = "file.read";
|
|
75308
|
+
FILE_BEGIN_KIND = "file.begin";
|
|
75309
|
+
FILE_END_KIND = "file.end";
|
|
75310
|
+
FILE_FAILED_KIND = "file.failed";
|
|
75311
|
+
CONTENT_WRITE_KIND = "content.write";
|
|
75312
|
+
CONTENT_COMMIT_KIND = "content.commit";
|
|
75313
|
+
CONTENT_READY_KIND = "content.ready";
|
|
75314
|
+
CONTENT_AVAILABLE_KIND = "content.available";
|
|
75315
|
+
CONTENT_CHUNK_MAX_BYTES = 192 * 1024;
|
|
75316
|
+
CONTENT_WRITE_MAX_BYTES = 32 * 1024 * 1024;
|
|
75317
|
+
PROMPT_IMAGE_MAX_BYTES = 5e6;
|
|
75318
|
+
CONTENT_CHUNK_MAGIC = new Uint8Array([77, 66, 67, 49]);
|
|
75319
|
+
CONTENT_CHUNK_HEADER_BYTES = CONTENT_CHUNK_MAGIC.byteLength + 1 + 4;
|
|
75320
|
+
fileReadCommandSchema = external_exports.object({
|
|
75321
|
+
kind: external_exports.literal(FILE_READ_KIND),
|
|
75322
|
+
maxBytes: external_exports.number().int().positive().max(128 * 1024 * 1024),
|
|
75323
|
+
requestId: identifierStringSchema,
|
|
75324
|
+
sessionId: identifierStringSchema,
|
|
75325
|
+
path: external_exports.string().min(1).max(4096)
|
|
75326
|
+
}).readonly();
|
|
75327
|
+
fileBeginEventSchema = external_exports.object({
|
|
75328
|
+
byteLength: external_exports.number().int().positive().max(128 * 1024 * 1024),
|
|
75329
|
+
kind: external_exports.literal(FILE_BEGIN_KIND),
|
|
75330
|
+
mediaType: external_exports.string().min(1).max(255),
|
|
75331
|
+
modifiedAt: external_exports.iso.datetime({ offset: true }),
|
|
75332
|
+
name: external_exports.string().min(1).max(500),
|
|
75333
|
+
requestId: identifierStringSchema,
|
|
75334
|
+
sessionId: identifierStringSchema
|
|
75335
|
+
}).readonly();
|
|
75336
|
+
contentWriteCommandSchema = external_exports.object({
|
|
75337
|
+
byteLength: external_exports.number().int().positive().max(CONTENT_WRITE_MAX_BYTES),
|
|
75338
|
+
contentKey: external_exports.string().regex(/^[a-f0-9]{64}$/u),
|
|
75339
|
+
contentKind: external_exports.enum(["image", "resource"]),
|
|
75340
|
+
kind: external_exports.literal(CONTENT_WRITE_KIND),
|
|
75341
|
+
mediaType: external_exports.string().min(1).max(255),
|
|
75342
|
+
name: external_exports.string().min(1).max(500),
|
|
75343
|
+
requestId: identifierStringSchema,
|
|
75344
|
+
sessionId: identifierStringSchema
|
|
75345
|
+
}).readonly();
|
|
75346
|
+
contentCommitCommandSchema = external_exports.object({
|
|
75347
|
+
kind: external_exports.literal(CONTENT_COMMIT_KIND),
|
|
75348
|
+
requestId: identifierStringSchema,
|
|
75349
|
+
sessionId: identifierStringSchema
|
|
75350
|
+
}).readonly();
|
|
75351
|
+
contentReadyEventSchema = external_exports.object({
|
|
75352
|
+
kind: external_exports.literal(CONTENT_READY_KIND),
|
|
75353
|
+
requestId: identifierStringSchema,
|
|
75354
|
+
sessionId: identifierStringSchema
|
|
75355
|
+
}).readonly();
|
|
75356
|
+
contentAvailableEventSchema = external_exports.object({
|
|
75357
|
+
byteLength: external_exports.number().int().positive().max(CONTENT_WRITE_MAX_BYTES),
|
|
75358
|
+
contentKey: external_exports.string().regex(/^[a-f0-9]{64}$/u),
|
|
75359
|
+
kind: external_exports.literal(CONTENT_AVAILABLE_KIND),
|
|
75360
|
+
requestId: identifierStringSchema,
|
|
75361
|
+
sessionId: identifierStringSchema
|
|
75362
|
+
}).readonly();
|
|
75363
|
+
fileEndEventSchema = external_exports.object({
|
|
75364
|
+
kind: external_exports.literal(FILE_END_KIND),
|
|
75365
|
+
requestId: identifierStringSchema,
|
|
75366
|
+
sessionId: identifierStringSchema
|
|
75367
|
+
}).readonly();
|
|
75368
|
+
fileFailedEventSchema = external_exports.object({
|
|
75369
|
+
code: identifierStringSchema,
|
|
75370
|
+
kind: external_exports.literal(FILE_FAILED_KIND),
|
|
75371
|
+
message: external_exports.string().min(1).max(500),
|
|
75372
|
+
requestId: identifierStringSchema,
|
|
75373
|
+
sessionId: identifierStringSchema
|
|
75374
|
+
}).readonly();
|
|
75375
|
+
decodeFileReadCommand = (encoded) => decodeZodMessage(encoded, fileReadCommandSchema);
|
|
75376
|
+
encodeFileReadCommand = (message) => encodeZodMessage(message, fileReadCommandSchema);
|
|
75377
|
+
decodeFileBeginEvent = (encoded) => decodeZodMessage(encoded, fileBeginEventSchema);
|
|
75378
|
+
encodeFileBeginEvent = (message) => encodeZodMessage(message, fileBeginEventSchema);
|
|
75379
|
+
decodeFileEndEvent = (encoded) => decodeZodMessage(encoded, fileEndEventSchema);
|
|
75380
|
+
encodeFileEndEvent = (message) => encodeZodMessage(message, fileEndEventSchema);
|
|
75381
|
+
decodeFileFailedEvent = (encoded) => decodeZodMessage(encoded, fileFailedEventSchema);
|
|
75382
|
+
encodeFileFailedEvent = (message) => encodeZodMessage(message, fileFailedEventSchema);
|
|
75383
|
+
decodeContentWriteCommand = (encoded) => decodeZodMessage(encoded, contentWriteCommandSchema);
|
|
75384
|
+
encodeContentWriteCommand = (message) => encodeZodMessage(message, contentWriteCommandSchema);
|
|
75385
|
+
decodeContentCommitCommand = (encoded) => decodeZodMessage(encoded, contentCommitCommandSchema);
|
|
75386
|
+
encodeContentCommitCommand = (message) => encodeZodMessage(message, contentCommitCommandSchema);
|
|
75387
|
+
decodeContentReadyEvent = (encoded) => decodeZodMessage(encoded, contentReadyEventSchema);
|
|
75388
|
+
encodeContentReadyEvent = (message) => encodeZodMessage(message, contentReadyEventSchema);
|
|
75389
|
+
decodeContentAvailableEvent = (encoded) => decodeZodMessage(encoded, contentAvailableEventSchema);
|
|
75390
|
+
encodeContentAvailableEvent = (message) => encodeZodMessage(message, contentAvailableEventSchema);
|
|
75391
|
+
}
|
|
75392
|
+
});
|
|
75393
|
+
|
|
74740
75394
|
// ../mobius-sdk/src/protocol/session/interactions/model.ts
|
|
74741
75395
|
var timestampSchema, permissionRequestSchema, elicitationRequestSchema, interactionRequestSchema, interactionResponseSchema, interactionStateSchema, interactionSchema;
|
|
74742
75396
|
var init_model = __esm({
|
|
@@ -75069,776 +75723,200 @@ function decodeSessionCancelCommand(encoded) {
|
|
|
75069
75723
|
sessionId: readIdentifier(value, "sessionId")
|
|
75070
75724
|
};
|
|
75071
75725
|
}
|
|
75072
|
-
function decodeSessionPromptDispositionCommand(encoded) {
|
|
75073
|
-
const value = parseJson(encoded);
|
|
75074
|
-
assertKind(value, SESSION_PROMPT_DISPOSITION_KIND);
|
|
75075
|
-
if (readPromptDisposition(value) !== SessionPromptDisposition.Steer) {
|
|
75076
|
-
throw new ProtocolMessageError("Only queued prompts can be steered");
|
|
75077
|
-
}
|
|
75078
|
-
return {
|
|
75079
|
-
commandId: readIdentifier(value, "commandId"),
|
|
75080
|
-
disposition: SessionPromptDisposition.Steer,
|
|
75081
|
-
kind: SESSION_PROMPT_DISPOSITION_KIND,
|
|
75082
|
-
sessionId: readIdentifier(value, "sessionId")
|
|
75083
|
-
};
|
|
75084
|
-
}
|
|
75085
|
-
function encodeSessionPromptCommand(message) {
|
|
75086
|
-
const command = decodeSessionPromptCommand(JSON.stringify(message));
|
|
75087
|
-
return JSON.stringify({
|
|
75088
|
-
...command,
|
|
75089
|
-
// Keep text prompts compatible with the previous Runtime release while
|
|
75090
|
-
// attachments move to the content-key protocol. Older Runtimes ignore
|
|
75091
|
-
// `attachments` and require both legacy arrays to be present.
|
|
75092
|
-
images: [],
|
|
75093
|
-
resources: []
|
|
75094
|
-
});
|
|
75095
|
-
}
|
|
75096
|
-
function encodeSessionCancelCommand(message) {
|
|
75097
|
-
return JSON.stringify(decodeSessionCancelCommand(JSON.stringify(message)));
|
|
75098
|
-
}
|
|
75099
|
-
function encodeSessionPromptDispositionCommand(message) {
|
|
75100
|
-
return JSON.stringify(decodeSessionPromptDispositionCommand(JSON.stringify(message)));
|
|
75101
|
-
}
|
|
75102
|
-
var SESSION_PROMPT_KIND, SESSION_PROMPT_DISPOSITION_KIND, SESSION_CANCEL_KIND, SESSION_CANCEL_BEFORE_START_KIND, SessionPromptDisposition, SessionHistoryPolicy, MAX_PROMPT_LENGTH, MAX_PROMPT_ATTACHMENT_BYTES, encodeSessionCancelBeforeStartCommand, promptAttachmentSchema, decodePromptAttachmentsValue;
|
|
75103
|
-
var init_commands = __esm({
|
|
75104
|
-
"../mobius-sdk/src/protocol/session/prompt/commands.ts"() {
|
|
75105
|
-
"use strict";
|
|
75106
|
-
init_zod();
|
|
75107
|
-
init_identifier();
|
|
75108
|
-
init_message_codec();
|
|
75109
|
-
init_configuration();
|
|
75110
|
-
SESSION_PROMPT_KIND = "session.prompt";
|
|
75111
|
-
SESSION_PROMPT_DISPOSITION_KIND = "session.prompt.disposition";
|
|
75112
|
-
SESSION_CANCEL_KIND = "session.cancel";
|
|
75113
|
-
SESSION_CANCEL_BEFORE_START_KIND = "session.cancel-before-start";
|
|
75114
|
-
SessionPromptDisposition = Object.freeze({
|
|
75115
|
-
Queue: "queue",
|
|
75116
|
-
Reject: "reject",
|
|
75117
|
-
Steer: "steer"
|
|
75118
|
-
});
|
|
75119
|
-
SessionHistoryPolicy = Object.freeze({
|
|
75120
|
-
Eager: "eager",
|
|
75121
|
-
ExecutionOnly: "execution-only"
|
|
75122
|
-
});
|
|
75123
|
-
MAX_PROMPT_LENGTH = 1e5;
|
|
75124
|
-
MAX_PROMPT_ATTACHMENT_BYTES = 32 * 1024 * 1024;
|
|
75125
|
-
encodeSessionCancelBeforeStartCommand = (message) => JSON.stringify(decodeSessionCancelBeforeStartCommand(JSON.stringify(message)));
|
|
75126
|
-
promptAttachmentSchema = external_exports.object({
|
|
75127
|
-
byteLength: external_exports.number().int().positive().max(MAX_PROMPT_ATTACHMENT_BYTES),
|
|
75128
|
-
contentKey: external_exports.string().regex(/^[a-f0-9]{64}$/u),
|
|
75129
|
-
kind: external_exports.enum(["image", "resource"]),
|
|
75130
|
-
mimeType: external_exports.string().min(1).max(255),
|
|
75131
|
-
name: external_exports.string().min(1).max(500),
|
|
75132
|
-
uri: external_exports.string().min(1).max(4096)
|
|
75133
|
-
}).readonly();
|
|
75134
|
-
decodePromptAttachmentsValue = (value) => decodeZodValue(value, external_exports.array(promptAttachmentSchema).max(16).readonly());
|
|
75135
|
-
}
|
|
75136
|
-
});
|
|
75137
|
-
|
|
75138
|
-
// ../mobius-sdk/src/protocol/session/native/index.ts
|
|
75139
|
-
function decode3(schema, encoded) {
|
|
75140
|
-
try {
|
|
75141
|
-
const value = JSON.parse(encoded);
|
|
75142
|
-
return schema.parse(value);
|
|
75143
|
-
} catch (cause) {
|
|
75144
|
-
throw new ProtocolMessageError("Invalid native session message", { cause });
|
|
75145
|
-
}
|
|
75146
|
-
}
|
|
75147
|
-
var NATIVE_SESSION_REQUEST_KIND, NATIVE_SESSION_RESULT_KIND, NATIVE_SESSION_CANCEL_KIND, envelope, activeTurnSnapshotSchema, identity, nativeSessionRequestSchema, nativeSessionCommandSchema, nativeSessionEntrySchema, resultEnvelope, nativeSessionResultSchema, nativeSessionCancelSchema, decodeNativeSessionCommand, encodeNativeSessionCommand, decodeNativeSessionResult, encodeNativeSessionResult, decodeNativeSessionCancel, encodeNativeSessionCancel;
|
|
75148
|
-
var init_native = __esm({
|
|
75149
|
-
"../mobius-sdk/src/protocol/session/native/index.ts"() {
|
|
75150
|
-
"use strict";
|
|
75151
|
-
init_zod();
|
|
75152
|
-
init_directory();
|
|
75153
|
-
init_identifier();
|
|
75154
|
-
init_message_codec();
|
|
75155
|
-
init_interactions();
|
|
75156
|
-
init_lifecycle();
|
|
75157
|
-
init_commands();
|
|
75158
|
-
init_shared2();
|
|
75159
|
-
NATIVE_SESSION_REQUEST_KIND = "native.session.request";
|
|
75160
|
-
NATIVE_SESSION_RESULT_KIND = "native.session.result";
|
|
75161
|
-
NATIVE_SESSION_CANCEL_KIND = "native.session.cancel";
|
|
75162
|
-
envelope = {
|
|
75163
|
-
requestId: identifierStringSchema,
|
|
75164
|
-
sessionId: identifierStringSchema
|
|
75165
|
-
};
|
|
75166
|
-
activeTurnSnapshotSchema = external_exports.object({
|
|
75167
|
-
commandId: identifierStringSchema,
|
|
75168
|
-
epoch: identifierStringSchema,
|
|
75169
|
-
interaction: external_exports.discriminatedUnion("kind", [sessionPermissionRequestedEventSchema, sessionElicitationRequestedEventSchema]).nullable(),
|
|
75170
|
-
sequence: external_exports.number().int().nonnegative(),
|
|
75171
|
-
state: external_exports.literal("running")
|
|
75172
|
-
}).readonly();
|
|
75173
|
-
identity = {
|
|
75174
|
-
...envelope,
|
|
75175
|
-
kind: external_exports.literal(NATIVE_SESSION_REQUEST_KIND),
|
|
75176
|
-
additionalDirectoryIds: external_exports.array(DIRECTORY_IDENTIFIER).max(16).readonly(),
|
|
75177
|
-
agentId: identifierStringSchema,
|
|
75178
|
-
bindingId: identifierStringSchema,
|
|
75179
|
-
directoryId: DIRECTORY_IDENTIFIER
|
|
75180
|
-
};
|
|
75181
|
-
nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
|
|
75182
|
-
external_exports.object({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
75183
|
-
external_exports.object({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
75184
|
-
external_exports.object({
|
|
75185
|
-
...identity,
|
|
75186
|
-
action: external_exports.literal("list"),
|
|
75187
|
-
cursor: identifierStringSchema.nullable()
|
|
75188
|
-
}).readonly(),
|
|
75189
|
-
external_exports.object({
|
|
75190
|
-
...identity,
|
|
75191
|
-
action: external_exports.enum(["import", "fork"]),
|
|
75192
|
-
entryId: identifierStringSchema,
|
|
75193
|
-
targetSessionId: identifierStringSchema
|
|
75194
|
-
}).readonly()
|
|
75195
|
-
]);
|
|
75196
|
-
nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
|
|
75197
|
-
external_exports.object({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
75198
|
-
external_exports.object({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
75199
|
-
external_exports.object({
|
|
75200
|
-
...identity,
|
|
75201
|
-
action: external_exports.literal("list"),
|
|
75202
|
-
cursor: identifierStringSchema.nullable()
|
|
75203
|
-
}).readonly(),
|
|
75204
|
-
external_exports.object({
|
|
75205
|
-
...identity,
|
|
75206
|
-
action: external_exports.enum(["import", "fork"]),
|
|
75207
|
-
entryId: identifierStringSchema,
|
|
75208
|
-
targetSessionId: identifierStringSchema
|
|
75209
|
-
}).readonly()
|
|
75210
|
-
]);
|
|
75211
|
-
nativeSessionEntrySchema = external_exports.object({
|
|
75212
|
-
entryId: identifierStringSchema,
|
|
75213
|
-
mobiusSessionIds: external_exports.array(identifierStringSchema).max(500).readonly(),
|
|
75214
|
-
nativeSessionId: identifierStringSchema,
|
|
75215
|
-
title: external_exports.string().max(500),
|
|
75216
|
-
directoryId: DIRECTORY_IDENTIFIER,
|
|
75217
|
-
directoryLabel: external_exports.string().min(1).max(MAX_WORKSPACE_PATH_LENGTH),
|
|
75218
|
-
updatedAt: external_exports.iso.datetime({ offset: true }).nullable(),
|
|
75219
|
-
additionalDirectories: external_exports.array(external_exports.object({ directoryId: DIRECTORY_IDENTIFIER, name: external_exports.string().min(1).max(255) }).readonly()).max(16).readonly()
|
|
75220
|
-
}).readonly();
|
|
75221
|
-
resultEnvelope = {
|
|
75222
|
-
...envelope,
|
|
75223
|
-
kind: external_exports.literal(NATIVE_SESSION_RESULT_KIND)
|
|
75224
|
-
};
|
|
75225
|
-
nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
75226
|
-
external_exports.object({
|
|
75227
|
-
...resultEnvelope,
|
|
75228
|
-
action: external_exports.literal("active-turn"),
|
|
75229
|
-
targetSessionId: identifierStringSchema,
|
|
75230
|
-
queued: external_exports.array(
|
|
75231
|
-
external_exports.object({
|
|
75232
|
-
commandId: identifierStringSchema,
|
|
75233
|
-
prompt: external_exports.string().max(1e5),
|
|
75234
|
-
attachments: external_exports.array(promptAttachmentSchema).max(16).readonly()
|
|
75235
|
-
}).readonly()
|
|
75236
|
-
).readonly(),
|
|
75237
|
-
turn: activeTurnSnapshotSchema.nullable()
|
|
75238
|
-
}).readonly(),
|
|
75239
|
-
external_exports.object({
|
|
75240
|
-
...resultEnvelope,
|
|
75241
|
-
action: external_exports.literal("find"),
|
|
75242
|
-
entry: nativeSessionEntrySchema
|
|
75243
|
-
}).readonly(),
|
|
75244
|
-
external_exports.object({
|
|
75245
|
-
...resultEnvelope,
|
|
75246
|
-
action: external_exports.literal("list"),
|
|
75247
|
-
capabilities: sessionCapabilitiesSchema,
|
|
75248
|
-
entries: external_exports.array(nativeSessionEntrySchema).max(500).readonly(),
|
|
75249
|
-
nextCursor: identifierStringSchema.nullable()
|
|
75250
|
-
}).readonly(),
|
|
75251
|
-
external_exports.object({
|
|
75252
|
-
...resultEnvelope,
|
|
75253
|
-
action: external_exports.enum(["import", "fork"]),
|
|
75254
|
-
targetSessionId: identifierStringSchema,
|
|
75255
|
-
ready: sessionReadyEventSchema,
|
|
75256
|
-
title: external_exports.string().max(500)
|
|
75257
|
-
}).readonly()
|
|
75258
|
-
]);
|
|
75259
|
-
nativeSessionCancelSchema = external_exports.object({ ...envelope, kind: external_exports.literal(NATIVE_SESSION_CANCEL_KIND) }).readonly();
|
|
75260
|
-
decodeNativeSessionCommand = (encoded) => decode3(nativeSessionCommandSchema, encoded);
|
|
75261
|
-
encodeNativeSessionCommand = (value) => JSON.stringify(nativeSessionCommandSchema.parse(value));
|
|
75262
|
-
decodeNativeSessionResult = (encoded) => decode3(nativeSessionResultSchema, encoded);
|
|
75263
|
-
encodeNativeSessionResult = (value) => JSON.stringify(nativeSessionResultSchema.parse(value));
|
|
75264
|
-
decodeNativeSessionCancel = (encoded) => decode3(nativeSessionCancelSchema, encoded);
|
|
75265
|
-
encodeNativeSessionCancel = (value) => JSON.stringify(nativeSessionCancelSchema.parse(value));
|
|
75266
|
-
}
|
|
75267
|
-
});
|
|
75268
|
-
|
|
75269
|
-
// ../mobius-sdk/src/protocol/session/observability/event-log.ts
|
|
75270
|
-
function isRecord4(value) {
|
|
75271
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
75272
|
-
}
|
|
75273
|
-
function hasUnknownDiscriminator(value, key, known) {
|
|
75274
|
-
if (!isRecord4(value)) {
|
|
75275
|
-
return false;
|
|
75276
|
-
}
|
|
75277
|
-
const variant = value[key];
|
|
75278
|
-
return typeof variant === "string" && !known.has(variant);
|
|
75279
|
-
}
|
|
75280
|
-
function containsUnknownContentBlock(value) {
|
|
75281
|
-
return hasUnknownDiscriminator(value, "type", knownContentBlockTypes);
|
|
75282
|
-
}
|
|
75283
|
-
function containsUnknownToolCallContent(value) {
|
|
75284
|
-
if (hasUnknownDiscriminator(value, "type", knownToolCallContentTypes)) {
|
|
75285
|
-
return true;
|
|
75286
|
-
}
|
|
75287
|
-
return isRecord4(value) && value["type"] === "content" && containsUnknownContentBlock(value["content"]);
|
|
75288
|
-
}
|
|
75289
|
-
function arrayContainsUnknown(value, predicate) {
|
|
75290
|
-
return Array.isArray(value) && value.some(predicate);
|
|
75291
|
-
}
|
|
75292
|
-
function containsUnknownAcpVariant(payload) {
|
|
75293
|
-
const update = payload["sessionUpdate"];
|
|
75294
|
-
if (typeof update !== "string") {
|
|
75295
|
-
return false;
|
|
75296
|
-
}
|
|
75297
|
-
if (!knownSessionUpdates.has(update)) {
|
|
75298
|
-
return true;
|
|
75299
|
-
}
|
|
75300
|
-
if (["user_message_chunk", "agent_message_chunk", "agent_thought_chunk", "compaction_summary_chunk"].includes(
|
|
75301
|
-
update
|
|
75302
|
-
)) {
|
|
75303
|
-
return containsUnknownContentBlock(payload["content"]);
|
|
75304
|
-
}
|
|
75305
|
-
if (update === "tool_call" || update === "tool_call_update") {
|
|
75306
|
-
return arrayContainsUnknown(payload["content"], containsUnknownToolCallContent);
|
|
75307
|
-
}
|
|
75308
|
-
if (update === "plan_update") {
|
|
75309
|
-
return hasUnknownDiscriminator(payload["plan"], "type", knownPlanTypes);
|
|
75310
|
-
}
|
|
75311
|
-
if (update === "config_option_update") {
|
|
75312
|
-
return arrayContainsUnknown(
|
|
75313
|
-
payload["configOptions"],
|
|
75314
|
-
(option) => hasUnknownDiscriminator(option, "type", knownConfigOptionTypes)
|
|
75315
|
-
);
|
|
75316
|
-
}
|
|
75317
|
-
if (update === "compaction_update") {
|
|
75318
|
-
return arrayContainsUnknown(payload["summary"], containsUnknownContentBlock);
|
|
75319
|
-
}
|
|
75320
|
-
return false;
|
|
75321
|
-
}
|
|
75322
|
-
function isKnownSessionEventVariant(value) {
|
|
75323
|
-
if (!isRecord4(value)) {
|
|
75324
|
-
return true;
|
|
75325
|
-
}
|
|
75326
|
-
const type = value["type"];
|
|
75327
|
-
if (typeof type !== "string") {
|
|
75328
|
-
return true;
|
|
75329
|
-
}
|
|
75330
|
-
if (type === "acp") {
|
|
75331
|
-
const payload = value["payload"];
|
|
75332
|
-
return !isRecord4(payload) || !containsUnknownAcpVariant(payload);
|
|
75333
|
-
}
|
|
75334
|
-
if (type === "lifecycle-metadata") {
|
|
75335
|
-
const payload = value["payload"];
|
|
75336
|
-
if (!isRecord4(payload)) {
|
|
75337
|
-
return true;
|
|
75338
|
-
}
|
|
75339
|
-
const kind = payload["kind"];
|
|
75340
|
-
if (typeof kind === "string" && !knownLifecycleKinds.has(kind)) {
|
|
75341
|
-
return false;
|
|
75342
|
-
}
|
|
75343
|
-
return kind !== "prompt.requested" || !arrayContainsUnknown(payload["content"], containsUnknownContentBlock);
|
|
75344
|
-
}
|
|
75345
|
-
return false;
|
|
75346
|
-
}
|
|
75347
|
-
function filterKnownSessionEventVariants(events) {
|
|
75348
|
-
return Array.isArray(events) ? events.filter(isKnownSessionEventVariant) : events;
|
|
75349
|
-
}
|
|
75350
|
-
function inputValue(value) {
|
|
75351
|
-
if (typeof value !== "string") {
|
|
75352
|
-
return value;
|
|
75353
|
-
}
|
|
75354
|
-
try {
|
|
75355
|
-
return JSON.parse(value);
|
|
75356
|
-
} catch (cause) {
|
|
75357
|
-
throw new ProtocolMessageError("Session Event Log V2 message is not valid JSON", { cause });
|
|
75358
|
-
}
|
|
75359
|
-
}
|
|
75360
|
-
function decode4(value, schema) {
|
|
75361
|
-
const result = schema.safeParse(inputValue(value));
|
|
75362
|
-
if (!result.success) {
|
|
75363
|
-
throw new ProtocolMessageError("Session Event Log V2 message does not match its schema", {
|
|
75364
|
-
cause: result.error
|
|
75365
|
-
});
|
|
75366
|
-
}
|
|
75367
|
-
return result.data;
|
|
75368
|
-
}
|
|
75369
|
-
function encode3(value, schema) {
|
|
75370
|
-
return JSON.stringify(decode4(value, schema));
|
|
75371
|
-
}
|
|
75372
|
-
function sanitizeKnownNativeSessionEvents(value) {
|
|
75373
|
-
const input2 = inputValue(value);
|
|
75374
|
-
if (!isRecord4(input2)) {
|
|
75375
|
-
return input2;
|
|
75376
|
-
}
|
|
75377
|
-
const page = input2["events"];
|
|
75378
|
-
const queuedPromptRequests = input2["queuedPromptRequests"];
|
|
75379
|
-
return {
|
|
75380
|
-
...input2,
|
|
75381
|
-
events: isRecord4(page) ? { ...page, events: filterKnownSessionEventVariants(page["events"]) } : page,
|
|
75382
|
-
queuedPromptRequests: Array.isArray(queuedPromptRequests) ? queuedPromptRequests.filter(
|
|
75383
|
-
(prompt) => !isRecord4(prompt) || !arrayContainsUnknown(prompt["content"], containsUnknownContentBlock)
|
|
75384
|
-
) : queuedPromptRequests
|
|
75385
|
-
};
|
|
75386
|
-
}
|
|
75387
|
-
var MAX_EVENT_COUNT, MAX_COLLECTION_SIZE2, MAX_CONTENT_LENGTH2, SESSION_EVENT_KIND, SESSION_EVENT_BATCH_MAX_SIZE, boundedString2, shortString, externalContentKeySchema, annotationsSchema, contentFields, textContentSchema, imageContentSchema, audioContentSchema, externalImageContentSchema, externalAudioContentSchema, externalResourceContentSchema, resourceLinkSchema, textResourceSchema, blobResourceSchema, embeddedResourceSchema, contentBlockSchema, toolCallContentSchema, toolKindSchema, toolStatusSchema, backgroundTaskSchema, toolPatchFields, planEntrySchema, planContentSchema, commandSchema, configSelectOptionSchema, configSelectGroupSchema, configBaseFields, sessionConfigOptionSchema2, contentChunkFields, acpSessionUpdateSchema, lifecycleBase, promptExecutionContextSchema, lifecycleMetadataSchema, sessionEventPayloadSchema, positionSchema, sharedSessionEventFields, sessionLiveEventFields, sessionEventSchema, sessionLiveEventSchema, wireLifecyclePayloadSchema, wireEventFields, sessionWireEventSchema, sessionWireEnvelopeSchema, knownContentBlockTypes, knownToolCallContentTypes, knownPlanTypes, knownConfigOptionTypes, knownSessionUpdates, knownLifecycleKinds, sessionEventBatchSchema, sessionLiveEventBatchSchema, sessionExportSchema, mobiusSessionExportSchema, sessionEventEnvelopeSchema, sessionEventLogPageSchema, sessionEventOmissionSchema, nativeEventPageRequestSchema, queuedPromptRequestEventLogSchema, nativeSessionEventsSchema, knownSessionLiveEventBatchSchema, decodeSessionEvent, decodeKnownSessionEventPayload, decodeSessionEventEnvelope, encodeSessionEventEnvelope, decodeAcpSessionUpdate, decodeKnownNativeSessionEvents;
|
|
75388
|
-
var init_event_log = __esm({
|
|
75389
|
-
"../mobius-sdk/src/protocol/session/observability/event-log.ts"() {
|
|
75390
|
-
"use strict";
|
|
75391
|
-
init_zod();
|
|
75392
|
-
init_directory();
|
|
75393
|
-
init_tool_input();
|
|
75394
|
-
init_tool_input();
|
|
75395
|
-
init_identifier();
|
|
75396
|
-
init_message_codec();
|
|
75397
|
-
init_interactions();
|
|
75398
|
-
MAX_EVENT_COUNT = 1e4;
|
|
75399
|
-
MAX_COLLECTION_SIZE2 = 1e3;
|
|
75400
|
-
MAX_CONTENT_LENGTH2 = 1e6;
|
|
75401
|
-
SESSION_EVENT_KIND = "session.event.v2";
|
|
75402
|
-
SESSION_EVENT_BATCH_MAX_SIZE = 1e3;
|
|
75403
|
-
boundedString2 = external_exports.string().max(MAX_CONTENT_LENGTH2);
|
|
75404
|
-
shortString = external_exports.string().max(2048);
|
|
75405
|
-
externalContentKeySchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
75406
|
-
annotationsSchema = external_exports.object({
|
|
75407
|
-
audience: external_exports.array(external_exports.enum(["assistant", "user"])).max(2).readonly().nullable().optional(),
|
|
75408
|
-
lastModified: shortString.nullable().optional(),
|
|
75409
|
-
priority: external_exports.number().finite().nullable().optional()
|
|
75410
|
-
}).readonly();
|
|
75411
|
-
contentFields = { annotations: annotationsSchema.nullable().optional() };
|
|
75412
|
-
textContentSchema = external_exports.object({ ...contentFields, text: boundedString2, type: external_exports.literal("text") }).readonly();
|
|
75413
|
-
imageContentSchema = external_exports.object({
|
|
75414
|
-
...contentFields,
|
|
75415
|
-
data: external_exports.string(),
|
|
75416
|
-
mimeType: shortString,
|
|
75417
|
-
type: external_exports.literal("image"),
|
|
75418
|
-
uri: boundedString2.nullable().optional()
|
|
75419
|
-
}).readonly();
|
|
75420
|
-
audioContentSchema = external_exports.object({ ...contentFields, data: external_exports.string(), mimeType: shortString, type: external_exports.literal("audio") }).readonly();
|
|
75421
|
-
externalImageContentSchema = external_exports.object({
|
|
75422
|
-
...contentFields,
|
|
75423
|
-
byteLength: external_exports.number().int().positive().safe(),
|
|
75424
|
-
imageKey: externalContentKeySchema,
|
|
75425
|
-
mimeType: shortString,
|
|
75426
|
-
type: external_exports.literal("external_image"),
|
|
75427
|
-
uri: boundedString2.nullable().optional()
|
|
75428
|
-
}).readonly();
|
|
75429
|
-
externalAudioContentSchema = external_exports.object({
|
|
75430
|
-
...contentFields,
|
|
75431
|
-
audioKey: externalContentKeySchema,
|
|
75432
|
-
byteLength: external_exports.number().int().positive().safe(),
|
|
75433
|
-
mimeType: shortString,
|
|
75434
|
-
type: external_exports.literal("external_audio")
|
|
75435
|
-
}).readonly();
|
|
75436
|
-
externalResourceContentSchema = external_exports.object({
|
|
75437
|
-
...contentFields,
|
|
75438
|
-
byteLength: external_exports.number().int().positive().safe(),
|
|
75439
|
-
encoding: external_exports.enum(["binary", "text"]),
|
|
75440
|
-
mimeType: shortString.nullable().optional(),
|
|
75441
|
-
resourceKey: externalContentKeySchema,
|
|
75442
|
-
type: external_exports.literal("external_resource"),
|
|
75443
|
-
uri: boundedString2
|
|
75444
|
-
}).readonly();
|
|
75445
|
-
resourceLinkSchema = external_exports.object({
|
|
75446
|
-
...contentFields,
|
|
75447
|
-
description: boundedString2.nullable().optional(),
|
|
75448
|
-
mimeType: shortString.nullable().optional(),
|
|
75449
|
-
name: shortString,
|
|
75450
|
-
size: external_exports.number().int().nonnegative().safe().nullable().optional(),
|
|
75451
|
-
title: shortString.nullable().optional(),
|
|
75452
|
-
type: external_exports.literal("resource_link"),
|
|
75453
|
-
uri: boundedString2
|
|
75454
|
-
}).readonly();
|
|
75455
|
-
textResourceSchema = external_exports.object({
|
|
75456
|
-
mimeType: shortString.nullable().optional(),
|
|
75457
|
-
text: boundedString2,
|
|
75458
|
-
uri: boundedString2
|
|
75459
|
-
}).readonly();
|
|
75460
|
-
blobResourceSchema = external_exports.object({
|
|
75461
|
-
blob: external_exports.string(),
|
|
75462
|
-
mimeType: shortString.nullable().optional(),
|
|
75463
|
-
uri: boundedString2
|
|
75464
|
-
}).readonly();
|
|
75465
|
-
embeddedResourceSchema = external_exports.object({
|
|
75466
|
-
...contentFields,
|
|
75467
|
-
resource: external_exports.union([textResourceSchema, blobResourceSchema]),
|
|
75468
|
-
type: external_exports.literal("resource")
|
|
75469
|
-
}).readonly();
|
|
75470
|
-
contentBlockSchema = external_exports.discriminatedUnion("type", [
|
|
75471
|
-
textContentSchema,
|
|
75472
|
-
imageContentSchema,
|
|
75473
|
-
audioContentSchema,
|
|
75474
|
-
resourceLinkSchema,
|
|
75475
|
-
embeddedResourceSchema,
|
|
75476
|
-
externalImageContentSchema,
|
|
75477
|
-
externalAudioContentSchema,
|
|
75478
|
-
externalResourceContentSchema
|
|
75479
|
-
]);
|
|
75480
|
-
toolCallContentSchema = external_exports.discriminatedUnion("type", [
|
|
75481
|
-
external_exports.object({ content: contentBlockSchema, type: external_exports.literal("content") }).readonly(),
|
|
75482
|
-
external_exports.object({
|
|
75483
|
-
newText: boundedString2,
|
|
75484
|
-
oldText: boundedString2.nullable().optional(),
|
|
75485
|
-
path: boundedString2,
|
|
75486
|
-
type: external_exports.literal("diff")
|
|
75487
|
-
}).readonly(),
|
|
75488
|
-
external_exports.object({ terminalId: shortString, type: external_exports.literal("terminal") }).readonly()
|
|
75489
|
-
]);
|
|
75490
|
-
toolKindSchema = external_exports.enum([
|
|
75491
|
-
"read",
|
|
75492
|
-
"edit",
|
|
75493
|
-
"delete",
|
|
75494
|
-
"move",
|
|
75495
|
-
"search",
|
|
75496
|
-
"execute",
|
|
75497
|
-
"think",
|
|
75498
|
-
"fetch",
|
|
75499
|
-
"switch_mode",
|
|
75500
|
-
"other"
|
|
75501
|
-
]);
|
|
75502
|
-
toolStatusSchema = external_exports.enum(["pending", "in_progress", "completed", "failed"]);
|
|
75503
|
-
backgroundTaskSchema = external_exports.object({
|
|
75504
|
-
id: shortString,
|
|
75505
|
-
status: external_exports.enum(["running", "completed", "failed", "stopped", "unknown"])
|
|
75726
|
+
function decodeSessionPromptDispositionCommand(encoded) {
|
|
75727
|
+
const value = parseJson(encoded);
|
|
75728
|
+
assertKind(value, SESSION_PROMPT_DISPOSITION_KIND);
|
|
75729
|
+
if (readPromptDisposition(value) !== SessionPromptDisposition.Steer) {
|
|
75730
|
+
throw new ProtocolMessageError("Only queued prompts can be steered");
|
|
75731
|
+
}
|
|
75732
|
+
return {
|
|
75733
|
+
commandId: readIdentifier(value, "commandId"),
|
|
75734
|
+
disposition: SessionPromptDisposition.Steer,
|
|
75735
|
+
kind: SESSION_PROMPT_DISPOSITION_KIND,
|
|
75736
|
+
sessionId: readIdentifier(value, "sessionId")
|
|
75737
|
+
};
|
|
75738
|
+
}
|
|
75739
|
+
function encodeSessionPromptCommand(message) {
|
|
75740
|
+
const command = decodeSessionPromptCommand(JSON.stringify(message));
|
|
75741
|
+
return JSON.stringify({
|
|
75742
|
+
...command,
|
|
75743
|
+
// Keep text prompts compatible with the previous Runtime release while
|
|
75744
|
+
// attachments move to the content-key protocol. Older Runtimes ignore
|
|
75745
|
+
// `attachments` and require both legacy arrays to be present.
|
|
75746
|
+
images: [],
|
|
75747
|
+
resources: []
|
|
75748
|
+
});
|
|
75749
|
+
}
|
|
75750
|
+
function encodeSessionCancelCommand(message) {
|
|
75751
|
+
return JSON.stringify(decodeSessionCancelCommand(JSON.stringify(message)));
|
|
75752
|
+
}
|
|
75753
|
+
function encodeSessionPromptDispositionCommand(message) {
|
|
75754
|
+
return JSON.stringify(decodeSessionPromptDispositionCommand(JSON.stringify(message)));
|
|
75755
|
+
}
|
|
75756
|
+
var SESSION_PROMPT_KIND, SESSION_PROMPT_DISPOSITION_KIND, SESSION_CANCEL_KIND, SESSION_CANCEL_BEFORE_START_KIND, SessionPromptDisposition, SessionHistoryPolicy, MAX_PROMPT_LENGTH, MAX_PROMPT_ATTACHMENT_BYTES, encodeSessionCancelBeforeStartCommand, promptAttachmentSchema, decodePromptAttachmentsValue;
|
|
75757
|
+
var init_commands = __esm({
|
|
75758
|
+
"../mobius-sdk/src/protocol/session/prompt/commands.ts"() {
|
|
75759
|
+
"use strict";
|
|
75760
|
+
init_zod();
|
|
75761
|
+
init_identifier();
|
|
75762
|
+
init_message_codec();
|
|
75763
|
+
init_configuration();
|
|
75764
|
+
SESSION_PROMPT_KIND = "session.prompt";
|
|
75765
|
+
SESSION_PROMPT_DISPOSITION_KIND = "session.prompt.disposition";
|
|
75766
|
+
SESSION_CANCEL_KIND = "session.cancel";
|
|
75767
|
+
SESSION_CANCEL_BEFORE_START_KIND = "session.cancel-before-start";
|
|
75768
|
+
SessionPromptDisposition = Object.freeze({
|
|
75769
|
+
Queue: "queue",
|
|
75770
|
+
Reject: "reject",
|
|
75771
|
+
Steer: "steer"
|
|
75772
|
+
});
|
|
75773
|
+
SessionHistoryPolicy = Object.freeze({
|
|
75774
|
+
Eager: "eager",
|
|
75775
|
+
ExecutionOnly: "execution-only"
|
|
75776
|
+
});
|
|
75777
|
+
MAX_PROMPT_LENGTH = 1e5;
|
|
75778
|
+
MAX_PROMPT_ATTACHMENT_BYTES = 32 * 1024 * 1024;
|
|
75779
|
+
encodeSessionCancelBeforeStartCommand = (message) => JSON.stringify(decodeSessionCancelBeforeStartCommand(JSON.stringify(message)));
|
|
75780
|
+
promptAttachmentSchema = external_exports.object({
|
|
75781
|
+
byteLength: external_exports.number().int().positive().max(MAX_PROMPT_ATTACHMENT_BYTES),
|
|
75782
|
+
contentKey: external_exports.string().regex(/^[a-f0-9]{64}$/u),
|
|
75783
|
+
kind: external_exports.enum(["image", "resource"]),
|
|
75784
|
+
mimeType: external_exports.string().min(1).max(255),
|
|
75785
|
+
name: external_exports.string().min(1).max(500),
|
|
75786
|
+
uri: external_exports.string().min(1).max(4096)
|
|
75506
75787
|
}).readonly();
|
|
75507
|
-
|
|
75508
|
-
|
|
75509
|
-
|
|
75510
|
-
|
|
75511
|
-
|
|
75512
|
-
|
|
75513
|
-
|
|
75514
|
-
|
|
75515
|
-
|
|
75516
|
-
|
|
75788
|
+
decodePromptAttachmentsValue = (value) => decodeZodValue(value, external_exports.array(promptAttachmentSchema).max(16).readonly());
|
|
75789
|
+
}
|
|
75790
|
+
});
|
|
75791
|
+
|
|
75792
|
+
// ../mobius-sdk/src/protocol/session/native/index.ts
|
|
75793
|
+
function decode4(schema, encoded) {
|
|
75794
|
+
try {
|
|
75795
|
+
const value = JSON.parse(encoded);
|
|
75796
|
+
return schema.parse(value);
|
|
75797
|
+
} catch (cause) {
|
|
75798
|
+
throw new ProtocolMessageError("Invalid native session message", { cause });
|
|
75799
|
+
}
|
|
75800
|
+
}
|
|
75801
|
+
var NATIVE_SESSION_REQUEST_KIND, NATIVE_SESSION_RESULT_KIND, NATIVE_SESSION_CANCEL_KIND, envelope, activeTurnSnapshotSchema, identity, nativeSessionRequestSchema, nativeSessionCommandSchema, nativeSessionEntrySchema, resultEnvelope, nativeSessionResultSchema, nativeSessionCancelSchema, decodeNativeSessionCommand, encodeNativeSessionCommand, decodeNativeSessionResult, encodeNativeSessionResult, decodeNativeSessionCancel, encodeNativeSessionCancel;
|
|
75802
|
+
var init_native = __esm({
|
|
75803
|
+
"../mobius-sdk/src/protocol/session/native/index.ts"() {
|
|
75804
|
+
"use strict";
|
|
75805
|
+
init_zod();
|
|
75806
|
+
init_directory();
|
|
75807
|
+
init_identifier();
|
|
75808
|
+
init_message_codec();
|
|
75809
|
+
init_interactions();
|
|
75810
|
+
init_lifecycle();
|
|
75811
|
+
init_commands();
|
|
75812
|
+
init_shared2();
|
|
75813
|
+
NATIVE_SESSION_REQUEST_KIND = "native.session.request";
|
|
75814
|
+
NATIVE_SESSION_RESULT_KIND = "native.session.result";
|
|
75815
|
+
NATIVE_SESSION_CANCEL_KIND = "native.session.cancel";
|
|
75816
|
+
envelope = {
|
|
75817
|
+
requestId: identifierStringSchema,
|
|
75818
|
+
sessionId: identifierStringSchema
|
|
75517
75819
|
};
|
|
75518
|
-
|
|
75519
|
-
|
|
75520
|
-
|
|
75521
|
-
|
|
75820
|
+
activeTurnSnapshotSchema = external_exports.object({
|
|
75821
|
+
commandId: identifierStringSchema,
|
|
75822
|
+
epoch: identifierStringSchema,
|
|
75823
|
+
interaction: external_exports.discriminatedUnion("kind", [sessionPermissionRequestedEventSchema, sessionElicitationRequestedEventSchema]).nullable(),
|
|
75824
|
+
sequence: external_exports.number().int().nonnegative(),
|
|
75825
|
+
state: external_exports.literal("running")
|
|
75522
75826
|
}).readonly();
|
|
75523
|
-
|
|
75827
|
+
identity = {
|
|
75828
|
+
...envelope,
|
|
75829
|
+
kind: external_exports.literal(NATIVE_SESSION_REQUEST_KIND),
|
|
75830
|
+
additionalDirectoryIds: external_exports.array(DIRECTORY_IDENTIFIER).max(16).readonly(),
|
|
75831
|
+
agentId: identifierStringSchema,
|
|
75832
|
+
bindingId: identifierStringSchema,
|
|
75833
|
+
directoryId: DIRECTORY_IDENTIFIER
|
|
75834
|
+
};
|
|
75835
|
+
nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
|
|
75836
|
+
external_exports.object({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
75837
|
+
external_exports.object({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
75524
75838
|
external_exports.object({
|
|
75525
|
-
|
|
75526
|
-
|
|
75527
|
-
|
|
75839
|
+
...identity,
|
|
75840
|
+
action: external_exports.literal("list"),
|
|
75841
|
+
cursor: identifierStringSchema.nullable()
|
|
75528
75842
|
}).readonly(),
|
|
75529
|
-
external_exports.object({ planId: shortString, type: external_exports.literal("file"), uri: boundedString2 }).readonly(),
|
|
75530
75843
|
external_exports.object({
|
|
75531
|
-
|
|
75532
|
-
|
|
75533
|
-
|
|
75844
|
+
...identity,
|
|
75845
|
+
action: external_exports.enum(["import", "fork"]),
|
|
75846
|
+
entryId: identifierStringSchema,
|
|
75847
|
+
targetSessionId: identifierStringSchema
|
|
75534
75848
|
}).readonly()
|
|
75535
75849
|
]);
|
|
75536
|
-
|
|
75537
|
-
|
|
75538
|
-
|
|
75539
|
-
name: shortString
|
|
75540
|
-
}).readonly();
|
|
75541
|
-
configSelectOptionSchema = external_exports.object({
|
|
75542
|
-
description: boundedString2.nullable().optional(),
|
|
75543
|
-
name: shortString,
|
|
75544
|
-
value: shortString
|
|
75545
|
-
}).readonly();
|
|
75546
|
-
configSelectGroupSchema = external_exports.object({
|
|
75547
|
-
group: shortString,
|
|
75548
|
-
name: shortString,
|
|
75549
|
-
options: external_exports.array(configSelectOptionSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
75550
|
-
}).readonly();
|
|
75551
|
-
configBaseFields = {
|
|
75552
|
-
category: shortString.nullable().optional(),
|
|
75553
|
-
description: boundedString2.nullable().optional(),
|
|
75554
|
-
id: shortString,
|
|
75555
|
-
name: shortString
|
|
75556
|
-
};
|
|
75557
|
-
sessionConfigOptionSchema2 = external_exports.discriminatedUnion("type", [
|
|
75558
|
-
external_exports.object({
|
|
75559
|
-
...configBaseFields,
|
|
75560
|
-
currentValue: shortString,
|
|
75561
|
-
options: external_exports.union([
|
|
75562
|
-
external_exports.array(configSelectOptionSchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
75563
|
-
external_exports.array(configSelectGroupSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
75564
|
-
]),
|
|
75565
|
-
type: external_exports.literal("select")
|
|
75566
|
-
}).readonly(),
|
|
75567
|
-
external_exports.object({ ...configBaseFields, currentValue: external_exports.boolean(), type: external_exports.literal("boolean") }).readonly()
|
|
75568
|
-
]);
|
|
75569
|
-
contentChunkFields = {
|
|
75570
|
-
content: contentBlockSchema,
|
|
75571
|
-
messageId: shortString.nullable().optional()
|
|
75572
|
-
};
|
|
75573
|
-
acpSessionUpdateSchema = external_exports.discriminatedUnion("sessionUpdate", [
|
|
75574
|
-
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("user_message_chunk") }).readonly(),
|
|
75575
|
-
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("agent_message_chunk") }).readonly(),
|
|
75576
|
-
external_exports.object({
|
|
75577
|
-
...contentChunkFields,
|
|
75578
|
-
meta: external_exports.object({ truncated: external_exports.boolean().optional() }).readonly().optional(),
|
|
75579
|
-
sessionUpdate: external_exports.literal("agent_thought_chunk")
|
|
75580
|
-
}).readonly(),
|
|
75581
|
-
external_exports.object({
|
|
75582
|
-
backgroundTask: backgroundTaskSchema.optional(),
|
|
75583
|
-
content: external_exports.array(toolCallContentSchema).max(MAX_COLLECTION_SIZE2).readonly().optional(),
|
|
75584
|
-
kind: toolKindSchema.optional(),
|
|
75585
|
-
locations: external_exports.array(toolCallLocationSchema).max(MAX_COLLECTION_SIZE2).readonly().optional(),
|
|
75586
|
-
name: shortString.nullable().optional(),
|
|
75587
|
-
rawInput: boundedJsonSchema.optional(),
|
|
75588
|
-
rawOutput: boundedJsonSchema.optional(),
|
|
75589
|
-
sessionUpdate: external_exports.literal("tool_call"),
|
|
75590
|
-
status: toolStatusSchema.optional(),
|
|
75591
|
-
title: boundedString2,
|
|
75592
|
-
toolCallId: shortString
|
|
75593
|
-
}).readonly(),
|
|
75594
|
-
external_exports.object({ ...toolPatchFields, sessionUpdate: external_exports.literal("tool_call_update"), toolCallId: shortString }).readonly(),
|
|
75595
|
-
external_exports.object({
|
|
75596
|
-
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
75597
|
-
sessionUpdate: external_exports.literal("plan")
|
|
75598
|
-
}).readonly(),
|
|
75599
|
-
external_exports.object({ plan: planContentSchema, sessionUpdate: external_exports.literal("plan_update") }).readonly(),
|
|
75600
|
-
external_exports.object({ planId: shortString, sessionUpdate: external_exports.literal("plan_removed") }).readonly(),
|
|
75601
|
-
external_exports.object({
|
|
75602
|
-
availableCommands: external_exports.array(commandSchema).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
75603
|
-
sessionUpdate: external_exports.literal("available_commands_update")
|
|
75604
|
-
}).readonly(),
|
|
75605
|
-
external_exports.object({
|
|
75606
|
-
currentModeId: shortString,
|
|
75607
|
-
sessionUpdate: external_exports.literal("current_mode_update")
|
|
75608
|
-
}).readonly(),
|
|
75609
|
-
external_exports.object({
|
|
75610
|
-
configOptions: external_exports.array(sessionConfigOptionSchema2).max(MAX_COLLECTION_SIZE2).readonly(),
|
|
75611
|
-
sessionUpdate: external_exports.literal("config_option_update")
|
|
75612
|
-
}).readonly(),
|
|
75613
|
-
external_exports.object({
|
|
75614
|
-
sessionUpdate: external_exports.literal("session_info_update"),
|
|
75615
|
-
title: boundedString2.nullable().optional(),
|
|
75616
|
-
updatedAt: shortString.nullable().optional()
|
|
75617
|
-
}).readonly(),
|
|
75618
|
-
external_exports.object({
|
|
75619
|
-
cost: external_exports.object({ amount: external_exports.number().finite(), currency: external_exports.string().max(16) }).readonly().nullable().optional(),
|
|
75620
|
-
sessionUpdate: external_exports.literal("usage_update"),
|
|
75621
|
-
size: external_exports.number().int().nonnegative().safe(),
|
|
75622
|
-
used: external_exports.number().int().nonnegative().safe()
|
|
75623
|
-
}).readonly(),
|
|
75850
|
+
nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
|
|
75851
|
+
external_exports.object({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
75852
|
+
external_exports.object({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
75624
75853
|
external_exports.object({
|
|
75625
|
-
|
|
75626
|
-
|
|
75627
|
-
|
|
75628
|
-
status: shortString,
|
|
75629
|
-
summary: external_exports.array(contentBlockSchema).max(MAX_COLLECTION_SIZE2).readonly().nullable().optional()
|
|
75854
|
+
...identity,
|
|
75855
|
+
action: external_exports.literal("list"),
|
|
75856
|
+
cursor: identifierStringSchema.nullable()
|
|
75630
75857
|
}).readonly(),
|
|
75631
75858
|
external_exports.object({
|
|
75632
|
-
|
|
75633
|
-
|
|
75634
|
-
|
|
75859
|
+
...identity,
|
|
75860
|
+
action: external_exports.enum(["import", "fork"]),
|
|
75861
|
+
entryId: identifierStringSchema,
|
|
75862
|
+
targetSessionId: identifierStringSchema
|
|
75635
75863
|
}).readonly()
|
|
75636
75864
|
]);
|
|
75637
|
-
|
|
75638
|
-
|
|
75639
|
-
|
|
75865
|
+
nativeSessionEntrySchema = external_exports.object({
|
|
75866
|
+
entryId: identifierStringSchema,
|
|
75867
|
+
mobiusSessionIds: external_exports.array(identifierStringSchema).max(500).readonly(),
|
|
75868
|
+
nativeSessionId: identifierStringSchema,
|
|
75869
|
+
title: external_exports.string().max(500),
|
|
75640
75870
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
75641
|
-
|
|
75871
|
+
directoryLabel: external_exports.string().min(1).max(MAX_WORKSPACE_PATH_LENGTH),
|
|
75872
|
+
updatedAt: external_exports.iso.datetime({ offset: true }).nullable(),
|
|
75873
|
+
additionalDirectories: external_exports.array(external_exports.object({ directoryId: DIRECTORY_IDENTIFIER, name: external_exports.string().min(1).max(255) }).readonly()).max(16).readonly()
|
|
75642
75874
|
}).readonly();
|
|
75643
|
-
|
|
75644
|
-
|
|
75645
|
-
|
|
75646
|
-
|
|
75647
|
-
|
|
75648
|
-
external_exports.object({ event: sessionElicitationResolvedEventSchema, kind: external_exports.literal("session.elicitation.resolved") }).readonly(),
|
|
75875
|
+
resultEnvelope = {
|
|
75876
|
+
...envelope,
|
|
75877
|
+
kind: external_exports.literal(NATIVE_SESSION_RESULT_KIND)
|
|
75878
|
+
};
|
|
75879
|
+
nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
75649
75880
|
external_exports.object({
|
|
75650
|
-
...
|
|
75651
|
-
|
|
75652
|
-
|
|
75653
|
-
|
|
75654
|
-
|
|
75655
|
-
|
|
75881
|
+
...resultEnvelope,
|
|
75882
|
+
action: external_exports.literal("active-turn"),
|
|
75883
|
+
targetSessionId: identifierStringSchema,
|
|
75884
|
+
queued: external_exports.array(
|
|
75885
|
+
external_exports.object({
|
|
75886
|
+
commandId: identifierStringSchema,
|
|
75887
|
+
prompt: external_exports.string().max(1e5),
|
|
75888
|
+
attachments: external_exports.array(promptAttachmentSchema).max(16).readonly()
|
|
75889
|
+
}).readonly()
|
|
75890
|
+
).readonly(),
|
|
75891
|
+
turn: activeTurnSnapshotSchema.nullable()
|
|
75656
75892
|
}).readonly(),
|
|
75657
|
-
external_exports.object({ ...lifecycleBase, attemptId: identifierStringSchema, epoch: identifierStringSchema, kind: external_exports.literal("prompt.started") }).readonly(),
|
|
75658
75893
|
external_exports.object({
|
|
75659
|
-
...
|
|
75660
|
-
|
|
75661
|
-
|
|
75894
|
+
...resultEnvelope,
|
|
75895
|
+
action: external_exports.literal("find"),
|
|
75896
|
+
entry: nativeSessionEntrySchema
|
|
75662
75897
|
}).readonly(),
|
|
75663
75898
|
external_exports.object({
|
|
75664
|
-
...
|
|
75665
|
-
|
|
75666
|
-
|
|
75667
|
-
|
|
75899
|
+
...resultEnvelope,
|
|
75900
|
+
action: external_exports.literal("list"),
|
|
75901
|
+
capabilities: sessionCapabilitiesSchema,
|
|
75902
|
+
entries: external_exports.array(nativeSessionEntrySchema).max(500).readonly(),
|
|
75903
|
+
nextCursor: identifierStringSchema.nullable()
|
|
75668
75904
|
}).readonly(),
|
|
75669
75905
|
external_exports.object({
|
|
75670
|
-
...
|
|
75671
|
-
|
|
75672
|
-
|
|
75673
|
-
|
|
75674
|
-
|
|
75675
|
-
}).readonly()
|
|
75676
|
-
]);
|
|
75677
|
-
sessionEventPayloadSchema = external_exports.discriminatedUnion("type", [
|
|
75678
|
-
external_exports.object({ payload: acpSessionUpdateSchema, type: external_exports.literal("acp") }).readonly(),
|
|
75679
|
-
external_exports.object({ payload: lifecycleMetadataSchema, type: external_exports.literal("lifecycle-metadata") }).readonly()
|
|
75680
|
-
]);
|
|
75681
|
-
positionSchema = external_exports.string().regex(/^(0|[1-9][0-9]*)$/);
|
|
75682
|
-
sharedSessionEventFields = {
|
|
75683
|
-
eventId: identifierStringSchema,
|
|
75684
|
-
mobiusMetadata: external_exports.object({ omitted: external_exports.literal(true).optional() }).readonly().optional(),
|
|
75685
|
-
recordedAt: external_exports.iso.datetime({ offset: true }),
|
|
75686
|
-
sessionGenerationId: identifierStringSchema,
|
|
75687
|
-
sessionId: identifierStringSchema
|
|
75688
|
-
};
|
|
75689
|
-
sessionLiveEventFields = { ...sharedSessionEventFields, position: positionSchema };
|
|
75690
|
-
sessionEventSchema = external_exports.object({ ...sharedSessionEventFields, payload: acpSessionUpdateSchema, type: external_exports.literal("acp") }).readonly();
|
|
75691
|
-
sessionLiveEventSchema = external_exports.discriminatedUnion("type", [
|
|
75692
|
-
external_exports.object({ ...sessionLiveEventFields, payload: acpSessionUpdateSchema, type: external_exports.literal("acp") }).readonly(),
|
|
75693
|
-
external_exports.object({
|
|
75694
|
-
...sessionLiveEventFields,
|
|
75695
|
-
payload: lifecycleMetadataSchema,
|
|
75696
|
-
type: external_exports.literal("lifecycle-metadata")
|
|
75906
|
+
...resultEnvelope,
|
|
75907
|
+
action: external_exports.enum(["import", "fork"]),
|
|
75908
|
+
targetSessionId: identifierStringSchema,
|
|
75909
|
+
ready: sessionReadyEventSchema,
|
|
75910
|
+
title: external_exports.string().max(500)
|
|
75697
75911
|
}).readonly()
|
|
75698
75912
|
]);
|
|
75699
|
-
|
|
75700
|
-
|
|
75701
|
-
|
|
75702
|
-
|
|
75703
|
-
|
|
75704
|
-
|
|
75705
|
-
|
|
75706
|
-
...sessionLiveEventFields,
|
|
75707
|
-
mobiusMetadata: external_exports.object({ omitted: external_exports.literal(true).optional() }).passthrough().readonly().optional()
|
|
75708
|
-
};
|
|
75709
|
-
sessionWireEventSchema = external_exports.union([
|
|
75710
|
-
external_exports.object({
|
|
75711
|
-
...wireEventFields,
|
|
75712
|
-
type: external_exports.literal("acp"),
|
|
75713
|
-
payload: external_exports.object({ sessionUpdate: identifierStringSchema }).passthrough().readonly()
|
|
75714
|
-
}).passthrough().readonly(),
|
|
75715
|
-
external_exports.object({
|
|
75716
|
-
...wireEventFields,
|
|
75717
|
-
type: external_exports.literal("lifecycle-metadata"),
|
|
75718
|
-
payload: wireLifecyclePayloadSchema
|
|
75719
|
-
}).passthrough().readonly(),
|
|
75720
|
-
external_exports.object({
|
|
75721
|
-
...wireEventFields,
|
|
75722
|
-
type: identifierStringSchema.refine((type) => type !== "acp" && type !== "lifecycle-metadata"),
|
|
75723
|
-
payload: external_exports.record(external_exports.string(), external_exports.unknown()).readonly()
|
|
75724
|
-
}).passthrough().readonly()
|
|
75725
|
-
]);
|
|
75726
|
-
sessionWireEnvelopeSchema = external_exports.object({
|
|
75727
|
-
kind: external_exports.literal(SESSION_EVENT_KIND),
|
|
75728
|
-
events: external_exports.array(sessionWireEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly()
|
|
75729
|
-
}).passthrough().readonly();
|
|
75730
|
-
knownContentBlockTypes = /* @__PURE__ */ new Set([
|
|
75731
|
-
"text",
|
|
75732
|
-
"image",
|
|
75733
|
-
"audio",
|
|
75734
|
-
"resource_link",
|
|
75735
|
-
"resource",
|
|
75736
|
-
"external_image",
|
|
75737
|
-
"external_audio",
|
|
75738
|
-
"external_resource"
|
|
75739
|
-
]);
|
|
75740
|
-
knownToolCallContentTypes = /* @__PURE__ */ new Set(["content", "diff", "terminal"]);
|
|
75741
|
-
knownPlanTypes = /* @__PURE__ */ new Set(["items", "file", "markdown"]);
|
|
75742
|
-
knownConfigOptionTypes = /* @__PURE__ */ new Set(["select", "boolean"]);
|
|
75743
|
-
knownSessionUpdates = /* @__PURE__ */ new Set([
|
|
75744
|
-
"user_message_chunk",
|
|
75745
|
-
"agent_message_chunk",
|
|
75746
|
-
"agent_thought_chunk",
|
|
75747
|
-
"tool_call",
|
|
75748
|
-
"tool_call_update",
|
|
75749
|
-
"plan",
|
|
75750
|
-
"plan_update",
|
|
75751
|
-
"plan_removed",
|
|
75752
|
-
"available_commands_update",
|
|
75753
|
-
"current_mode_update",
|
|
75754
|
-
"config_option_update",
|
|
75755
|
-
"session_info_update",
|
|
75756
|
-
"usage_update",
|
|
75757
|
-
"compaction_update",
|
|
75758
|
-
"compaction_summary_chunk"
|
|
75759
|
-
]);
|
|
75760
|
-
knownLifecycleKinds = /* @__PURE__ */ new Set([
|
|
75761
|
-
"session.queue.changed",
|
|
75762
|
-
"session.permission.requested",
|
|
75763
|
-
"session.permission.resolved",
|
|
75764
|
-
"session.elicitation.requested",
|
|
75765
|
-
"session.elicitation.resolved",
|
|
75766
|
-
"prompt.requested",
|
|
75767
|
-
"prompt.started",
|
|
75768
|
-
"prompt.completed",
|
|
75769
|
-
"prompt.failed-before-start",
|
|
75770
|
-
"prompt.failed"
|
|
75771
|
-
]);
|
|
75772
|
-
sessionEventBatchSchema = external_exports.array(sessionEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
75773
|
-
sessionLiveEventBatchSchema = external_exports.array(sessionLiveEventSchema).min(1).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
75774
|
-
sessionExportSchema = external_exports.object({
|
|
75775
|
-
binding: external_exports.object({
|
|
75776
|
-
bindingId: identifierStringSchema,
|
|
75777
|
-
runtimeId: identifierStringSchema
|
|
75778
|
-
}).readonly(),
|
|
75779
|
-
events: external_exports.array(sessionEventSchema).max(MAX_EVENT_COUNT).readonly(),
|
|
75780
|
-
sessionId: identifierStringSchema,
|
|
75781
|
-
truncated: external_exports.boolean()
|
|
75782
|
-
}).readonly().superRefine((session, context) => {
|
|
75783
|
-
const eventIds = /* @__PURE__ */ new Set();
|
|
75784
|
-
for (const [index2, event] of session.events.entries()) {
|
|
75785
|
-
if (event.sessionId !== session.sessionId) {
|
|
75786
|
-
context.addIssue({
|
|
75787
|
-
code: "custom",
|
|
75788
|
-
message: "Exported event belongs to a different Session",
|
|
75789
|
-
path: ["events", index2, "sessionId"]
|
|
75790
|
-
});
|
|
75791
|
-
}
|
|
75792
|
-
if (eventIds.has(event.eventId)) {
|
|
75793
|
-
context.addIssue({
|
|
75794
|
-
code: "custom",
|
|
75795
|
-
message: "Exported event identities are not unique",
|
|
75796
|
-
path: ["events", index2, "eventId"]
|
|
75797
|
-
});
|
|
75798
|
-
}
|
|
75799
|
-
eventIds.add(event.eventId);
|
|
75800
|
-
}
|
|
75801
|
-
});
|
|
75802
|
-
mobiusSessionExportSchema = external_exports.object({
|
|
75803
|
-
formatVersion: external_exports.literal("2"),
|
|
75804
|
-
session: sessionExportSchema
|
|
75805
|
-
}).readonly();
|
|
75806
|
-
sessionEventEnvelopeSchema = external_exports.object({ events: sessionLiveEventBatchSchema, kind: external_exports.literal(SESSION_EVENT_KIND) }).readonly();
|
|
75807
|
-
sessionEventLogPageSchema = external_exports.object({
|
|
75808
|
-
events: external_exports.array(sessionEventSchema).max(MAX_EVENT_COUNT).readonly(),
|
|
75809
|
-
nextCursor: external_exports.string().min(1).max(512).nullable(),
|
|
75810
|
-
sessionGenerationId: identifierStringSchema,
|
|
75811
|
-
tailCursor: external_exports.string().max(512),
|
|
75812
|
-
// The generation-scoped live position covered by this snapshot, including
|
|
75813
|
-
// coalesced and omitted events. Absent only on older Runtime versions.
|
|
75814
|
-
throughPosition: positionSchema.optional(),
|
|
75815
|
-
truncated: external_exports.boolean(),
|
|
75816
|
-
version: external_exports.literal(2)
|
|
75817
|
-
}).readonly();
|
|
75818
|
-
sessionEventOmissionSchema = external_exports.literal("agent-reasoning");
|
|
75819
|
-
nativeEventPageRequestSchema = external_exports.object({
|
|
75820
|
-
cursor: external_exports.string().min(1).max(512).nullable(),
|
|
75821
|
-
eventLimit: external_exports.number().int().min(1).max(1e4),
|
|
75822
|
-
// Legacy callers may still send this option; readers must ignore it.
|
|
75823
|
-
omit: external_exports.array(sessionEventOmissionSchema).max(1).readonly().optional()
|
|
75824
|
-
}).readonly();
|
|
75825
|
-
queuedPromptRequestEventLogSchema = external_exports.object({
|
|
75826
|
-
commandId: identifierStringSchema,
|
|
75827
|
-
content: external_exports.array(contentBlockSchema).min(1).max(100).readonly(),
|
|
75828
|
-
disposition: shortString.optional(),
|
|
75829
|
-
targetCommandId: identifierStringSchema.optional()
|
|
75830
|
-
}).readonly();
|
|
75831
|
-
nativeSessionEventsSchema = external_exports.object({
|
|
75832
|
-
events: sessionEventLogPageSchema,
|
|
75833
|
-
queuedPromptRequests: external_exports.array(queuedPromptRequestEventLogSchema).max(MAX_COLLECTION_SIZE2).readonly()
|
|
75834
|
-
}).readonly();
|
|
75835
|
-
knownSessionLiveEventBatchSchema = external_exports.array(sessionLiveEventSchema).max(SESSION_EVENT_BATCH_MAX_SIZE).readonly();
|
|
75836
|
-
decodeSessionEvent = (value) => decode4(value, sessionEventSchema);
|
|
75837
|
-
decodeKnownSessionEventPayload = (value) => isKnownSessionEventVariant(value) ? decode4(value, sessionEventPayloadSchema) : null;
|
|
75838
|
-
decodeSessionEventEnvelope = (value) => decode4(value, sessionEventEnvelopeSchema);
|
|
75839
|
-
encodeSessionEventEnvelope = (value) => encode3(value, sessionEventEnvelopeSchema);
|
|
75840
|
-
decodeAcpSessionUpdate = (value) => decode4(value, acpSessionUpdateSchema);
|
|
75841
|
-
decodeKnownNativeSessionEvents = (value) => decode4(sanitizeKnownNativeSessionEvents(value), nativeSessionEventsSchema);
|
|
75913
|
+
nativeSessionCancelSchema = external_exports.object({ ...envelope, kind: external_exports.literal(NATIVE_SESSION_CANCEL_KIND) }).readonly();
|
|
75914
|
+
decodeNativeSessionCommand = (encoded) => decode4(nativeSessionCommandSchema, encoded);
|
|
75915
|
+
encodeNativeSessionCommand = (value) => JSON.stringify(nativeSessionCommandSchema.parse(value));
|
|
75916
|
+
decodeNativeSessionResult = (encoded) => decode4(nativeSessionResultSchema, encoded);
|
|
75917
|
+
encodeNativeSessionResult = (value) => JSON.stringify(nativeSessionResultSchema.parse(value));
|
|
75918
|
+
decodeNativeSessionCancel = (encoded) => decode4(nativeSessionCancelSchema, encoded);
|
|
75919
|
+
encodeNativeSessionCancel = (value) => JSON.stringify(nativeSessionCancelSchema.parse(value));
|
|
75842
75920
|
}
|
|
75843
75921
|
});
|
|
75844
75922
|
|
|
@@ -75870,7 +75948,7 @@ var init_history2 = __esm({
|
|
|
75870
75948
|
init_directory();
|
|
75871
75949
|
init_identifier();
|
|
75872
75950
|
init_message_codec();
|
|
75873
|
-
|
|
75951
|
+
init_events();
|
|
75874
75952
|
SESSION_HISTORY_PAGE_LOAD_KIND = "session.live-history.v2.page.load";
|
|
75875
75953
|
SESSION_HISTORY_PAGE_LOADED_KIND = "session.live-history.v2.page.loaded";
|
|
75876
75954
|
SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND = "session.preview-history.page.load";
|
|
@@ -76027,7 +76105,7 @@ var init_recording = __esm({
|
|
|
76027
76105
|
init_zod();
|
|
76028
76106
|
init_directory();
|
|
76029
76107
|
init_identifier();
|
|
76030
|
-
|
|
76108
|
+
init_events();
|
|
76031
76109
|
sessionRecordingWriteSchema = external_exports.object({
|
|
76032
76110
|
envelope: sessionEventEnvelopeSchema,
|
|
76033
76111
|
projectId: identifierStringSchema,
|
|
@@ -76082,8 +76160,8 @@ var init_turn_history = __esm({
|
|
|
76082
76160
|
"use strict";
|
|
76083
76161
|
init_zod();
|
|
76084
76162
|
init_identifier();
|
|
76163
|
+
init_events();
|
|
76085
76164
|
init_interactions();
|
|
76086
|
-
init_event_log();
|
|
76087
76165
|
init_recording();
|
|
76088
76166
|
SESSION_RECORDING_TURN_PAGE_DECODE_MAX_ELEMENTS = 1e4;
|
|
76089
76167
|
SESSION_RECORDING_TURN_ITEM_ID_MAX_LENGTH = 4200;
|
|
@@ -76458,11 +76536,11 @@ var init_daemon_transport = __esm({
|
|
|
76458
76536
|
init_settings2();
|
|
76459
76537
|
init_configuration();
|
|
76460
76538
|
init_title();
|
|
76539
|
+
init_events();
|
|
76461
76540
|
init_files();
|
|
76462
76541
|
init_interactions();
|
|
76463
76542
|
init_lifecycle();
|
|
76464
76543
|
init_native();
|
|
76465
|
-
init_event_log();
|
|
76466
76544
|
init_history2();
|
|
76467
76545
|
init_commands();
|
|
76468
76546
|
init_workspace();
|
|
@@ -76744,12 +76822,12 @@ var init_protocol = __esm({
|
|
|
76744
76822
|
init_settings2();
|
|
76745
76823
|
init_configuration();
|
|
76746
76824
|
init_title();
|
|
76825
|
+
init_events();
|
|
76747
76826
|
init_files();
|
|
76748
76827
|
init_interactions();
|
|
76749
76828
|
init_model();
|
|
76750
76829
|
init_lifecycle();
|
|
76751
76830
|
init_native();
|
|
76752
|
-
init_event_log();
|
|
76753
76831
|
init_history2();
|
|
76754
76832
|
init_commands();
|
|
76755
76833
|
init_usage();
|
|
@@ -78041,12 +78119,12 @@ var init_environment = __esm({
|
|
|
78041
78119
|
});
|
|
78042
78120
|
|
|
78043
78121
|
// src/acp/harness/pi/upstream/dist/acp/paths.js
|
|
78044
|
-
import { join as
|
|
78122
|
+
import { join as join18 } from "node:path";
|
|
78045
78123
|
function getPiAcpDir(environment = process.env) {
|
|
78046
|
-
return
|
|
78124
|
+
return join18(environmentHome(environment), ".pi", "pi-acp");
|
|
78047
78125
|
}
|
|
78048
78126
|
function getPiAcpSessionMapPath(environment = process.env) {
|
|
78049
|
-
return
|
|
78127
|
+
return join18(getPiAcpDir(environment), "session-map.json");
|
|
78050
78128
|
}
|
|
78051
78129
|
var init_paths = __esm({
|
|
78052
78130
|
"src/acp/harness/pi/upstream/dist/acp/paths.js"() {
|
|
@@ -78102,13 +78180,13 @@ var init_pi_commands = __esm({
|
|
|
78102
78180
|
|
|
78103
78181
|
// src/acp/harness/pi/upstream/dist/acp/pi-sessions.js
|
|
78104
78182
|
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
|
|
78183
|
+
import { isAbsolute as isAbsolute10, join as join19, resolve as resolve10 } from "node:path";
|
|
78106
78184
|
function getPiAgentDir(environment) {
|
|
78107
78185
|
const configured = environment["PI_CODING_AGENT_DIR"];
|
|
78108
|
-
return configured ? resolve10(configured) :
|
|
78186
|
+
return configured ? resolve10(configured) : join19(environmentHome(environment), ".pi", "agent");
|
|
78109
78187
|
}
|
|
78110
78188
|
function readSessionDirFromSettings(agentDir) {
|
|
78111
|
-
const settingsPath =
|
|
78189
|
+
const settingsPath = join19(agentDir, "settings.json");
|
|
78112
78190
|
try {
|
|
78113
78191
|
if (!existsSync4(settingsPath)) {
|
|
78114
78192
|
return null;
|
|
@@ -78129,7 +78207,7 @@ function readSessionDirFromSettings(agentDir) {
|
|
|
78129
78207
|
}
|
|
78130
78208
|
function getPiSessionsDir(environment = process.env) {
|
|
78131
78209
|
const agentDir = getPiAgentDir(environment);
|
|
78132
|
-
return readSessionDirFromSettings(agentDir) ??
|
|
78210
|
+
return readSessionDirFromSettings(agentDir) ?? join19(agentDir, "sessions");
|
|
78133
78211
|
}
|
|
78134
78212
|
function getPiSessionDiscoveryDirs(environment) {
|
|
78135
78213
|
const discoveryDirectories = [getPiSessionsDir(environment)];
|
|
@@ -78140,7 +78218,7 @@ function getPiSessionDiscoveryDirs(environment) {
|
|
|
78140
78218
|
if (!entry.isDirectory()) {
|
|
78141
78219
|
continue;
|
|
78142
78220
|
}
|
|
78143
|
-
const directory =
|
|
78221
|
+
const directory = join19(mobiusSessionsRoot, entry.name);
|
|
78144
78222
|
if (!discoveryDirectories.includes(directory)) {
|
|
78145
78223
|
discoveryDirectories.push(directory);
|
|
78146
78224
|
}
|
|
@@ -78157,7 +78235,7 @@ function walkJsonlFiles(dir, out2) {
|
|
|
78157
78235
|
}
|
|
78158
78236
|
for (const e of entries) {
|
|
78159
78237
|
const name2 = typeof e.name === "string" ? e.name : String(e.name);
|
|
78160
|
-
const p =
|
|
78238
|
+
const p = join19(dir, name2);
|
|
78161
78239
|
if (e.isDirectory()) {
|
|
78162
78240
|
walkJsonlFiles(p, out2);
|
|
78163
78241
|
} else if (e.isFile() && name2.endsWith(".jsonl")) {
|
|
@@ -78435,7 +78513,7 @@ var init_pi_sessions = __esm({
|
|
|
78435
78513
|
|
|
78436
78514
|
// src/acp/harness/pi/upstream/dist/acp/pi-settings.js
|
|
78437
78515
|
import { existsSync as existsSync5, readFileSync as readFileSync4 } from "node:fs";
|
|
78438
|
-
import { join as
|
|
78516
|
+
import { join as join20, resolve as resolve11 } from "node:path";
|
|
78439
78517
|
function isObject2(x) {
|
|
78440
78518
|
return Boolean(x) && typeof x === "object" && !Array.isArray(x);
|
|
78441
78519
|
}
|
|
@@ -78464,7 +78542,7 @@ function readJsonFile(path8) {
|
|
|
78464
78542
|
}
|
|
78465
78543
|
}
|
|
78466
78544
|
function getMergedSettings(cwd, environment) {
|
|
78467
|
-
const globalSettingsPath =
|
|
78545
|
+
const globalSettingsPath = join20(getAgentDir(environment), "settings.json");
|
|
78468
78546
|
const projectSettingsPath = resolve11(cwd, ".pi", "settings.json");
|
|
78469
78547
|
const global2 = readJsonFile(globalSettingsPath);
|
|
78470
78548
|
const project = readJsonFile(projectSettingsPath);
|
|
@@ -78472,7 +78550,7 @@ function getMergedSettings(cwd, environment) {
|
|
|
78472
78550
|
}
|
|
78473
78551
|
function getAgentDir(environment = process.env) {
|
|
78474
78552
|
const configured = environment["PI_CODING_AGENT_DIR"];
|
|
78475
|
-
return configured ? resolve11(configured) :
|
|
78553
|
+
return configured ? resolve11(configured) : join20(environmentHome(environment), ".pi", "agent");
|
|
78476
78554
|
}
|
|
78477
78555
|
function getEnableSkillCommands(cwd, environment = process.env) {
|
|
78478
78556
|
const merged = getMergedSettings(cwd, environment);
|
|
@@ -78742,7 +78820,7 @@ var init_session_store = __esm({
|
|
|
78742
78820
|
|
|
78743
78821
|
// src/acp/harness/pi/upstream/dist/acp/slash-commands.js
|
|
78744
78822
|
import { existsSync as existsSync6, readdirSync as readdirSync5, readFileSync as readFileSync6 } from "node:fs";
|
|
78745
|
-
import { join as
|
|
78823
|
+
import { join as join21, resolve as resolve12 } from "node:path";
|
|
78746
78824
|
function parseFrontmatter(content) {
|
|
78747
78825
|
const frontmatter = {};
|
|
78748
78826
|
if (!content.startsWith("---")) {
|
|
@@ -78770,7 +78848,7 @@ function loadCommandsFromDir(dir, source, subdir = "") {
|
|
|
78770
78848
|
try {
|
|
78771
78849
|
const entries = readdirSync5(dir, { withFileTypes: true });
|
|
78772
78850
|
for (const entry of entries) {
|
|
78773
|
-
const fullPath =
|
|
78851
|
+
const fullPath = join21(dir, entry.name);
|
|
78774
78852
|
if (entry.isDirectory()) {
|
|
78775
78853
|
const newSubdir = subdir ? `${subdir}:${entry.name}` : entry.name;
|
|
78776
78854
|
commands.push(...loadCommandsFromDir(fullPath, source, newSubdir));
|
|
@@ -78810,7 +78888,7 @@ function loadCommandsFromDir(dir, source, subdir = "") {
|
|
|
78810
78888
|
}
|
|
78811
78889
|
function loadSlashCommands(cwd, environment = process.env) {
|
|
78812
78890
|
const commands = [];
|
|
78813
|
-
const userDir =
|
|
78891
|
+
const userDir = join21(environmentHome(environment), ".pi", "agent", "prompts");
|
|
78814
78892
|
const projectDir = resolve12(cwd, ".pi", "prompts");
|
|
78815
78893
|
commands.push(...loadCommandsFromDir(userDir, "user"));
|
|
78816
78894
|
commands.push(...loadCommandsFromDir(projectDir, "project"));
|
|
@@ -79902,7 +79980,7 @@ var init_prompt = __esm({
|
|
|
79902
79980
|
import { spawnSync } from "node:child_process";
|
|
79903
79981
|
import { randomUUID as randomUUID10 } from "node:crypto";
|
|
79904
79982
|
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
|
|
79983
|
+
import { basename as basename6, dirname as dirname9, isAbsolute as isAbsolute12, join as join22 } from "node:path";
|
|
79906
79984
|
import { RequestError as RequestError10 } from "@agentclientprotocol/sdk";
|
|
79907
79985
|
function thinkingLevelName(id) {
|
|
79908
79986
|
return id.split(/[_-]/u).map((part) => part.length === 0 ? part : `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join(" ");
|
|
@@ -80177,7 +80255,7 @@ function buildStartupInfo(opts) {
|
|
|
80177
80255
|
md.push("");
|
|
80178
80256
|
};
|
|
80179
80257
|
const contextItems = [];
|
|
80180
|
-
const contextPath =
|
|
80258
|
+
const contextPath = join22(opts.cwd, "AGENTS.md");
|
|
80181
80259
|
if (existsSync7(contextPath)) {
|
|
80182
80260
|
contextItems.push(contextPath);
|
|
80183
80261
|
}
|
|
@@ -80186,7 +80264,7 @@ function buildStartupInfo(opts) {
|
|
|
80186
80264
|
const pushSkillFromRoot = (root) => {
|
|
80187
80265
|
try {
|
|
80188
80266
|
for (const e of readdirSync6(root)) {
|
|
80189
|
-
const p =
|
|
80267
|
+
const p = join22(root, e);
|
|
80190
80268
|
try {
|
|
80191
80269
|
const st2 = statSync3(p);
|
|
80192
80270
|
if (st2.isFile() && e.toLowerCase().endsWith(".md")) {
|
|
@@ -80211,7 +80289,7 @@ function buildStartupInfo(opts) {
|
|
|
80211
80289
|
if (name2 === "node_modules" || name2 === ".git") {
|
|
80212
80290
|
continue;
|
|
80213
80291
|
}
|
|
80214
|
-
const p =
|
|
80292
|
+
const p = join22(dir, name2);
|
|
80215
80293
|
let st2;
|
|
80216
80294
|
try {
|
|
80217
80295
|
st2 = statSync3(p);
|
|
@@ -80228,16 +80306,16 @@ function buildStartupInfo(opts) {
|
|
|
80228
80306
|
} catch {
|
|
80229
80307
|
}
|
|
80230
80308
|
};
|
|
80231
|
-
const globalSkillsDir =
|
|
80309
|
+
const globalSkillsDir = join22(getAgentDir(opts.environment), "skills");
|
|
80232
80310
|
pushSkillFromRoot(globalSkillsDir);
|
|
80233
80311
|
const home = opts.environment["HOME"] ?? opts.environment["USERPROFILE"] ?? "";
|
|
80234
|
-
const legacyAgentsSkillsDir =
|
|
80312
|
+
const legacyAgentsSkillsDir = join22(home, ".agents", "skills");
|
|
80235
80313
|
pushSkillFromRoot(legacyAgentsSkillsDir);
|
|
80236
|
-
const projectSkillsDir =
|
|
80314
|
+
const projectSkillsDir = join22(opts.cwd, ".pi", "skills");
|
|
80237
80315
|
pushSkillFromRoot(projectSkillsDir);
|
|
80238
80316
|
addSection("Skills", skillsItems);
|
|
80239
80317
|
const promptsItems = [];
|
|
80240
|
-
const promptsDir =
|
|
80318
|
+
const promptsDir = join22(home, ".pi", "agent", "prompts");
|
|
80241
80319
|
try {
|
|
80242
80320
|
const prompts = readdirSync6(promptsDir).filter((f) => f.endsWith(".md"));
|
|
80243
80321
|
for (const f of prompts) {
|
|
@@ -80247,17 +80325,17 @@ function buildStartupInfo(opts) {
|
|
|
80247
80325
|
}
|
|
80248
80326
|
addSection("Prompts", promptsItems);
|
|
80249
80327
|
const extItems = [];
|
|
80250
|
-
const extDir =
|
|
80328
|
+
const extDir = join22(home, ".pi", "agent", "extensions");
|
|
80251
80329
|
try {
|
|
80252
80330
|
const exts = readdirSync6(extDir).filter((f) => f.endsWith(".ts") || f.endsWith(".js"));
|
|
80253
80331
|
for (const f of exts) {
|
|
80254
|
-
extItems.push(
|
|
80332
|
+
extItems.push(join22(extDir, f));
|
|
80255
80333
|
}
|
|
80256
80334
|
} catch {
|
|
80257
80335
|
}
|
|
80258
80336
|
const settingsPaths = [
|
|
80259
|
-
|
|
80260
|
-
|
|
80337
|
+
join22(getAgentDir(opts.environment), "settings.json"),
|
|
80338
|
+
join22(opts.cwd, ".pi", "settings.json")
|
|
80261
80339
|
];
|
|
80262
80340
|
for (const settingsPath of settingsPaths) {
|
|
80263
80341
|
try {
|
|
@@ -80848,7 +80926,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80848
80926
|
if (piPath) {
|
|
80849
80927
|
const resolved = realpathSync3(piPath);
|
|
80850
80928
|
const pkgRoot = dirname9(dirname9(resolved));
|
|
80851
|
-
const p =
|
|
80929
|
+
const p = join22(pkgRoot, "CHANGELOG.md");
|
|
80852
80930
|
if (existsSync7(p)) {
|
|
80853
80931
|
return p;
|
|
80854
80932
|
}
|
|
@@ -80859,7 +80937,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80859
80937
|
const npmRoot = spawnSync("npm", ["root", "-g"], { encoding: "utf-8" });
|
|
80860
80938
|
const root = String(npmRoot.stdout ?? "").trim();
|
|
80861
80939
|
if (root) {
|
|
80862
|
-
const p =
|
|
80940
|
+
const p = join22(root, "@earendil-works", "pi-coding-agent", "CHANGELOG.md");
|
|
80863
80941
|
if (existsSync7(p)) {
|
|
80864
80942
|
return p;
|
|
80865
80943
|
}
|
|
@@ -80953,7 +81031,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80953
81031
|
return { stopReason: "end_turn" };
|
|
80954
81032
|
}
|
|
80955
81033
|
const safeSessionId = session.sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
80956
|
-
const outputPath =
|
|
81034
|
+
const outputPath = join22(session.cwd, `pi-session-${safeSessionId}.html`);
|
|
80957
81035
|
let resultPath = "";
|
|
80958
81036
|
try {
|
|
80959
81037
|
const result2 = await session.proc.exportHtml(outputPath);
|
|
@@ -81646,7 +81724,7 @@ var init_agent_probe_error = __esm({
|
|
|
81646
81724
|
|
|
81647
81725
|
// src/agent/specification/vendors/pi-agent.ts
|
|
81648
81726
|
import { createHash as createHash3 } from "node:crypto";
|
|
81649
|
-
import { join as
|
|
81727
|
+
import { join as join23 } from "node:path";
|
|
81650
81728
|
import {
|
|
81651
81729
|
methods as methods7
|
|
81652
81730
|
} from "@agentclientprotocol/sdk";
|
|
@@ -81666,7 +81744,7 @@ var init_pi_agent = __esm({
|
|
|
81666
81744
|
// keeps the adapter's opt-in capability flag enabled for every launch it owns.
|
|
81667
81745
|
createLaunchEnvironment = async (_agent, context) => {
|
|
81668
81746
|
const workspaceHash = createHash3("sha256").update(context.defaultWorkspace).digest("hex").slice(0, 24);
|
|
81669
|
-
const sessionDirectory =
|
|
81747
|
+
const sessionDirectory = join23(context.dataDirectory, "agents", "pi", "sessions", workspaceHash);
|
|
81670
81748
|
return Object.freeze({
|
|
81671
81749
|
PI_ACP_ENABLE_EMBEDDED_CONTEXT: "true",
|
|
81672
81750
|
MOBIUS_PI_SESSION_DIR: sessionDirectory
|
|
@@ -85145,7 +85223,7 @@ var init_sql = __esm({
|
|
|
85145
85223
|
return new SQL([new StringChunk(str)]);
|
|
85146
85224
|
}
|
|
85147
85225
|
_sql.raw = raw;
|
|
85148
|
-
function
|
|
85226
|
+
function join41(chunks, separator) {
|
|
85149
85227
|
const result = [];
|
|
85150
85228
|
for (const [i, chunk] of chunks.entries()) {
|
|
85151
85229
|
if (i > 0 && separator !== void 0) result.push(separator);
|
|
@@ -85153,7 +85231,7 @@ var init_sql = __esm({
|
|
|
85153
85231
|
}
|
|
85154
85232
|
return new SQL(result);
|
|
85155
85233
|
}
|
|
85156
|
-
_sql.join =
|
|
85234
|
+
_sql.join = join41;
|
|
85157
85235
|
function identifier2(value) {
|
|
85158
85236
|
return new Name(value);
|
|
85159
85237
|
}
|
|
@@ -87111,7 +87189,7 @@ var init_select = __esm({
|
|
|
87111
87189
|
const baseTableName = this.tableName;
|
|
87112
87190
|
const tableName = getTableLikeName(table);
|
|
87113
87191
|
for (const item of extractUsedTable(table)) this.usedTables.add(item);
|
|
87114
|
-
if (typeof tableName === "string" && this.config.joins?.some((
|
|
87192
|
+
if (typeof tableName === "string" && this.config.joins?.some((join41) => join41.alias === tableName)) throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
87115
87193
|
if (!this.isPartialSelect) {
|
|
87116
87194
|
if (Object.keys(this.joinsNotNullableMap).length === 1 && typeof baseTableName === "string") this.config.fields = { [baseTableName]: this.config.fields };
|
|
87117
87195
|
if (typeof tableName === "string" && !is(table, SQL)) {
|
|
@@ -88708,7 +88786,7 @@ var init_dialect = __esm({
|
|
|
88708
88786
|
if (!joins2) return;
|
|
88709
88787
|
const withEntries = Object.entries(joins2).filter(([_, v]) => v);
|
|
88710
88788
|
if (!withEntries.length) return;
|
|
88711
|
-
return sql.join(withEntries.map(([k2,
|
|
88789
|
+
return sql.join(withEntries.map(([k2, join41]) => {
|
|
88712
88790
|
const relation = tableConfig.relations[k2];
|
|
88713
88791
|
const isSingle2 = is(relation, One2);
|
|
88714
88792
|
const targetTable = aliasedTable(relation.targetTable, `d${currentDepth + 1}`);
|
|
@@ -88719,7 +88797,7 @@ var init_dialect = __esm({
|
|
|
88719
88797
|
table: targetTable,
|
|
88720
88798
|
mode: isSingle2 ? "first" : "many",
|
|
88721
88799
|
schema,
|
|
88722
|
-
queryConfig:
|
|
88800
|
+
queryConfig: join41,
|
|
88723
88801
|
tableConfig: schema[relation.targetTableName],
|
|
88724
88802
|
relationWhere: filter,
|
|
88725
88803
|
isNested: true,
|
|
@@ -88733,7 +88811,7 @@ var init_dialect = __esm({
|
|
|
88733
88811
|
key: k2,
|
|
88734
88812
|
selection: innerQuery.selection,
|
|
88735
88813
|
isArray: !isSingle2,
|
|
88736
|
-
isOptional: (relation.optional ?? false) ||
|
|
88814
|
+
isOptional: (relation.optional ?? false) || join41 !== true && !!join41.where
|
|
88737
88815
|
});
|
|
88738
88816
|
const jsonColumns = sql.join(innerQuery.selection.map((s) => {
|
|
88739
88817
|
return sql`${sql.raw(this.escapeString(s.key))}, ${s.selection ? sql`${jsonb}(${sql.identifier(s.key)})` : sql.identifier(s.key)}`;
|
|
@@ -89155,7 +89233,7 @@ var init_update = __esm({
|
|
|
89155
89233
|
createJoin(joinType) {
|
|
89156
89234
|
return ((table, on2) => {
|
|
89157
89235
|
const tableName = getTableLikeName(table);
|
|
89158
|
-
if (typeof tableName === "string" && this.config.joins.some((
|
|
89236
|
+
if (typeof tableName === "string" && this.config.joins.some((join41) => join41.alias === tableName)) throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
89159
89237
|
if (typeof on2 === "function") {
|
|
89160
89238
|
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
89239
|
on2 = on2(new Proxy(this.config.table[Table.Symbol.Columns], new SelectionProxyHandler({
|
|
@@ -90041,12 +90119,12 @@ var init_local_sqlite_database = __esm({
|
|
|
90041
90119
|
|
|
90042
90120
|
// src/storage/sqlite/local-databases.ts
|
|
90043
90121
|
import { createHash as createHash4 } from "node:crypto";
|
|
90044
|
-
import { join as
|
|
90122
|
+
import { join as join24 } from "node:path";
|
|
90045
90123
|
function channelSessionDatabasePaths(stateDirectory, channelId) {
|
|
90046
90124
|
const channelHash = createHash4("sha256").update(channelId).digest("hex");
|
|
90047
90125
|
return {
|
|
90048
|
-
events:
|
|
90049
|
-
sessions:
|
|
90126
|
+
events: join24(stateDirectory, "sessions", `${channelHash}.events.sqlite`),
|
|
90127
|
+
sessions: join24(stateDirectory, "sessions", `${channelHash}.sqlite`)
|
|
90050
90128
|
};
|
|
90051
90129
|
}
|
|
90052
90130
|
var openAcpSessionDatabase, openSessionEventCacheDatabase;
|
|
@@ -90279,13 +90357,13 @@ var init_session_event_cache_table = __esm({
|
|
|
90279
90357
|
// src/storage/session/temporary-session-event-cache.ts
|
|
90280
90358
|
import { mkdtempSync, rmSync as rmSync2 } from "node:fs";
|
|
90281
90359
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
90282
|
-
import { join as
|
|
90360
|
+
import { join as join25 } from "node:path";
|
|
90283
90361
|
function openTemporarySessionEventCache() {
|
|
90284
|
-
const directory = mkdtempSync(
|
|
90362
|
+
const directory = mkdtempSync(join25(tmpdir2(), "mobius-preview-events-"));
|
|
90285
90363
|
const removeFiles = () => rmSync2(directory, { recursive: true, force: true });
|
|
90286
90364
|
try {
|
|
90287
90365
|
return {
|
|
90288
|
-
table: new SessionEventCacheTable(openSessionEventCacheDatabase(
|
|
90366
|
+
table: new SessionEventCacheTable(openSessionEventCacheDatabase(join25(directory, "events.sqlite"))),
|
|
90289
90367
|
removeFiles
|
|
90290
90368
|
};
|
|
90291
90369
|
} catch (error62) {
|
|
@@ -91134,10 +91212,10 @@ var init_catalog2 = __esm({
|
|
|
91134
91212
|
});
|
|
91135
91213
|
|
|
91136
91214
|
// src/runtime/config.ts
|
|
91137
|
-
import { join as
|
|
91215
|
+
import { join as join26, resolve as resolve14 } from "node:path";
|
|
91138
91216
|
function loadDefaultWorkspace(dataDirectory, environment = process.env) {
|
|
91139
91217
|
const { MOBIUS_DEFAULT_WORKSPACE: configuredWorkspace } = environment;
|
|
91140
|
-
return configuredWorkspace ??
|
|
91218
|
+
return configuredWorkspace ?? join26(dataDirectory, "workspace");
|
|
91141
91219
|
}
|
|
91142
91220
|
function withRuntimeEnvironment(agent, environment) {
|
|
91143
91221
|
const launchEnvironment = {};
|
|
@@ -91774,9 +91852,9 @@ var init_runtime_installation_store = __esm({
|
|
|
91774
91852
|
// src/storage/daemon/version-data.ts
|
|
91775
91853
|
import { randomUUID as randomUUID14 } from "node:crypto";
|
|
91776
91854
|
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
|
|
91855
|
+
import { join as join27, relative as relative2, sep as sep5 } from "node:path";
|
|
91778
91856
|
async function readCurrentDataVersion(root, signal) {
|
|
91779
|
-
const pointer =
|
|
91857
|
+
const pointer = join27(root, STATE_ROOT_LAYOUT.currentData);
|
|
91780
91858
|
try {
|
|
91781
91859
|
await validateLocalPath(pointer, false, true, signal);
|
|
91782
91860
|
const value = (await readFile7(pointer, { encoding: "utf8", signal })).trim();
|
|
@@ -91793,7 +91871,7 @@ async function readCurrentDataVersion(root, signal) {
|
|
|
91793
91871
|
}
|
|
91794
91872
|
async function versionDataExists(root, version2, signal) {
|
|
91795
91873
|
try {
|
|
91796
|
-
await validateLocalPath(
|
|
91874
|
+
await validateLocalPath(join27(root, STATE_ROOT_LAYOUT.versions, version2), true, true, signal);
|
|
91797
91875
|
return true;
|
|
91798
91876
|
} catch (cause) {
|
|
91799
91877
|
if (!isNodeError(cause, "ENOENT")) {
|
|
@@ -91807,13 +91885,13 @@ function nestedRootEntry(segments) {
|
|
|
91807
91885
|
}
|
|
91808
91886
|
async function copyVersionData(root, sourceVersion, targetVersion, signal) {
|
|
91809
91887
|
const leftBehind = [];
|
|
91810
|
-
const versions =
|
|
91811
|
-
const source =
|
|
91812
|
-
const target =
|
|
91888
|
+
const versions = join27(root, STATE_ROOT_LAYOUT.versions);
|
|
91889
|
+
const source = join27(versions, sourceVersion);
|
|
91890
|
+
const target = join27(versions, targetVersion);
|
|
91813
91891
|
await validateLocalPath(root, true, true, signal);
|
|
91814
91892
|
await validateLocalPath(versions, true, true, signal);
|
|
91815
91893
|
await validateLocalPath(source, true, true, signal);
|
|
91816
|
-
const staging = await mkdtemp(
|
|
91894
|
+
const staging = await mkdtemp(join27(versions, `.${targetVersion}-`));
|
|
91817
91895
|
try {
|
|
91818
91896
|
await cp2(source, staging, {
|
|
91819
91897
|
recursive: true,
|
|
@@ -91850,10 +91928,10 @@ async function discardVersionData(root, version2, signal) {
|
|
|
91850
91928
|
if (await readCurrentDataVersion(root, signal) === version2 || !await versionDataExists(root, version2, signal)) {
|
|
91851
91929
|
return;
|
|
91852
91930
|
}
|
|
91853
|
-
const versions =
|
|
91854
|
-
const discarded =
|
|
91931
|
+
const versions = join27(root, STATE_ROOT_LAYOUT.versions);
|
|
91932
|
+
const discarded = join27(versions, `.${version2}-discarded-${randomUUID14()}`);
|
|
91855
91933
|
try {
|
|
91856
|
-
await rename4(
|
|
91934
|
+
await rename4(join27(versions, version2), discarded);
|
|
91857
91935
|
} catch (cause) {
|
|
91858
91936
|
if (isNodeError(cause, "ENOENT")) {
|
|
91859
91937
|
return;
|
|
@@ -91864,13 +91942,13 @@ async function discardVersionData(root, version2, signal) {
|
|
|
91864
91942
|
}
|
|
91865
91943
|
async function writeCurrentDataVersion(root, version2, signal) {
|
|
91866
91944
|
await validateLocalPath(root, true, true, signal);
|
|
91867
|
-
await validateLocalPath(
|
|
91868
|
-
const temporary =
|
|
91945
|
+
await validateLocalPath(join27(root, STATE_ROOT_LAYOUT.versions, version2), true, true, signal);
|
|
91946
|
+
const temporary = join27(root, `.current-data-${randomUUID14()}.txt`);
|
|
91869
91947
|
try {
|
|
91870
91948
|
await writeFile2(temporary, `versions/${version2}
|
|
91871
91949
|
`, { mode: 384, flag: "wx", signal });
|
|
91872
91950
|
signal.throwIfAborted();
|
|
91873
|
-
await rename4(temporary,
|
|
91951
|
+
await rename4(temporary, join27(root, STATE_ROOT_LAYOUT.currentData));
|
|
91874
91952
|
} finally {
|
|
91875
91953
|
await rm3(temporary, { force: true });
|
|
91876
91954
|
}
|
|
@@ -91891,7 +91969,7 @@ var init_version_data = __esm({
|
|
|
91891
91969
|
|
|
91892
91970
|
// src/daemon/pairing/pair-local-machine.ts
|
|
91893
91971
|
import { hostname as hostname3 } from "node:os";
|
|
91894
|
-
import { basename as basename7, join as
|
|
91972
|
+
import { basename as basename7, join as join28, resolve as resolve16 } from "node:path";
|
|
91895
91973
|
import { fetch as fetch3 } from "undici";
|
|
91896
91974
|
function hasExactKeys2(value, expectedKeys) {
|
|
91897
91975
|
const keys = Object.keys(value);
|
|
@@ -92152,7 +92230,7 @@ async function openMobiusVersionInstallation(version2, signal, environment) {
|
|
|
92152
92230
|
return await openRuntimeInstallationStore(
|
|
92153
92231
|
{
|
|
92154
92232
|
applicationId: MOBIUS_CLI_APPLICATION_ID,
|
|
92155
|
-
stateDirectory:
|
|
92233
|
+
stateDirectory: join28(readStateDirectory(environment), "versions", version2)
|
|
92156
92234
|
},
|
|
92157
92235
|
signal
|
|
92158
92236
|
);
|
|
@@ -92425,9 +92503,9 @@ var init_agents = __esm({
|
|
|
92425
92503
|
|
|
92426
92504
|
// src/storage/daemon/manager-lock.ts
|
|
92427
92505
|
import { readFile as readFile8, unlink as unlink4, writeFile as writeFile3 } from "node:fs/promises";
|
|
92428
|
-
import { join as
|
|
92506
|
+
import { join as join29 } from "node:path";
|
|
92429
92507
|
async function acquireManagerLock(stateDirectory, name2 = "manager.lock") {
|
|
92430
|
-
const path8 =
|
|
92508
|
+
const path8 = join29(stateDirectory, name2);
|
|
92431
92509
|
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
92432
92510
|
try {
|
|
92433
92511
|
await writeFile3(path8, `${process.pid.toString()}
|
|
@@ -92456,7 +92534,7 @@ async function acquireManagerLock(stateDirectory, name2 = "manager.lock") {
|
|
|
92456
92534
|
}
|
|
92457
92535
|
async function managerLockExists(stateDirectory) {
|
|
92458
92536
|
try {
|
|
92459
|
-
await readFile8(
|
|
92537
|
+
await readFile8(join29(stateDirectory, "manager.lock"), "utf8");
|
|
92460
92538
|
return true;
|
|
92461
92539
|
} catch (cause) {
|
|
92462
92540
|
if (isNodeError(cause, "ENOENT")) {
|
|
@@ -92475,9 +92553,9 @@ var init_manager_lock = __esm({
|
|
|
92475
92553
|
// src/storage/daemon/control-token.ts
|
|
92476
92554
|
import { randomBytes } from "node:crypto";
|
|
92477
92555
|
import { readFile as readFile9, writeFile as writeFile4 } from "node:fs/promises";
|
|
92478
|
-
import { join as
|
|
92556
|
+
import { join as join30 } from "node:path";
|
|
92479
92557
|
function controlTokenPath(stateDirectory) {
|
|
92480
|
-
return
|
|
92558
|
+
return join30(stateDirectory, "manager.token");
|
|
92481
92559
|
}
|
|
92482
92560
|
async function readOrCreateControlToken(stateDirectory) {
|
|
92483
92561
|
const path8 = controlTokenPath(stateDirectory);
|
|
@@ -92801,7 +92879,7 @@ var init_data = __esm({
|
|
|
92801
92879
|
|
|
92802
92880
|
// src/storage/logs/bounded-log.ts
|
|
92803
92881
|
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
|
|
92882
|
+
import { join as join31 } from "node:path";
|
|
92805
92883
|
var BoundedLineLog;
|
|
92806
92884
|
var init_bounded_log = __esm({
|
|
92807
92885
|
"src/storage/logs/bounded-log.ts"() {
|
|
@@ -92814,7 +92892,7 @@ var init_bounded_log = __esm({
|
|
|
92814
92892
|
#onWriteFailure;
|
|
92815
92893
|
constructor(directory, filename, maximumBytes, onWriteFailure = () => void 0) {
|
|
92816
92894
|
this.#directory = directory;
|
|
92817
|
-
this.#path =
|
|
92895
|
+
this.#path = join31(directory, filename);
|
|
92818
92896
|
this.#maximumBytes = maximumBytes;
|
|
92819
92897
|
this.#onWriteFailure = onWriteFailure;
|
|
92820
92898
|
}
|
|
@@ -92868,19 +92946,19 @@ var init_bounded_log = __esm({
|
|
|
92868
92946
|
// src/storage/logs/log-files.ts
|
|
92869
92947
|
import { readFileSync as readFileSync10 } from "node:fs";
|
|
92870
92948
|
import { lstat as lstat5, readdir as readdir6, readFile as readFile10 } from "node:fs/promises";
|
|
92871
|
-
import { join as
|
|
92949
|
+
import { join as join32, relative as relative3 } from "node:path";
|
|
92872
92950
|
function unhandledRejectionLogFilename(role) {
|
|
92873
92951
|
return `unhandled-rejections-${role}.log`;
|
|
92874
92952
|
}
|
|
92875
92953
|
function logDirectory(stateDirectory) {
|
|
92876
|
-
return
|
|
92954
|
+
return join32(stateDirectory, "logs");
|
|
92877
92955
|
}
|
|
92878
92956
|
function processLogPaths(stateDirectory) {
|
|
92879
92957
|
return [
|
|
92880
92958
|
WORKER_LIFECYCLE_LOG_FILENAME,
|
|
92881
92959
|
unhandledRejectionLogFilename("manager"),
|
|
92882
92960
|
unhandledRejectionLogFilename("worker")
|
|
92883
|
-
].map((filename) =>
|
|
92961
|
+
].map((filename) => join32(logDirectory(stateDirectory), filename));
|
|
92884
92962
|
}
|
|
92885
92963
|
function readLogText(path8) {
|
|
92886
92964
|
try {
|
|
@@ -92893,17 +92971,17 @@ function isAbsent(cause) {
|
|
|
92893
92971
|
return typeof cause === "object" && cause !== null && Reflect.get(cause, "code") === "ENOENT";
|
|
92894
92972
|
}
|
|
92895
92973
|
async function findLogDirectories(root, unreadable, signal) {
|
|
92896
|
-
const versions =
|
|
92897
|
-
const installationsRoots = [
|
|
92974
|
+
const versions = join32(root, VERSIONS_DIRECTORY);
|
|
92975
|
+
const installationsRoots = [join32(root, INSTALLATIONS_DIRECTORY)];
|
|
92898
92976
|
for (const version2 of await listDirectories(versions, root, unreadable, signal)) {
|
|
92899
|
-
installationsRoots.push(
|
|
92977
|
+
installationsRoots.push(join32(versions, version2, INSTALLATIONS_DIRECTORY));
|
|
92900
92978
|
}
|
|
92901
92979
|
const found = [];
|
|
92902
92980
|
for (const installations of installationsRoots) {
|
|
92903
92981
|
for (const applicationId of await listDirectories(installations, root, unreadable, signal)) {
|
|
92904
|
-
const application =
|
|
92982
|
+
const application = join32(installations, applicationId);
|
|
92905
92983
|
for (const installationId2 of await listDirectories(application, root, unreadable, signal)) {
|
|
92906
|
-
const logs =
|
|
92984
|
+
const logs = join32(application, installationId2, "logs");
|
|
92907
92985
|
const status = await directoryStatus(logs);
|
|
92908
92986
|
if (status === "listed") {
|
|
92909
92987
|
found.push(logs);
|
|
@@ -93511,13 +93589,13 @@ var init_manager2 = __esm({
|
|
|
93511
93589
|
|
|
93512
93590
|
// src/storage/daemon/release-files.ts
|
|
93513
93591
|
import { readFile as readFile11, realpath as realpath8 } from "node:fs/promises";
|
|
93514
|
-
import { join as
|
|
93592
|
+
import { join as join33 } from "node:path";
|
|
93515
93593
|
function releasePrefix(version2) {
|
|
93516
|
-
return
|
|
93594
|
+
return join33(readStateDirectory(), STATE_ROOT_LAYOUT.releases, version2);
|
|
93517
93595
|
}
|
|
93518
93596
|
async function readInstalledRelease(prefix) {
|
|
93519
|
-
const packageRoot = await realpath8(
|
|
93520
|
-
return { manifest: await readFile11(
|
|
93597
|
+
const packageRoot = await realpath8(join33(prefix, "node_modules", "@moxt-ai", "mobius"));
|
|
93598
|
+
return { manifest: await readFile11(join33(packageRoot, "package.json"), "utf8"), packageRoot };
|
|
93521
93599
|
}
|
|
93522
93600
|
var init_release_files = __esm({
|
|
93523
93601
|
"src/storage/daemon/release-files.ts"() {
|
|
@@ -93528,7 +93606,7 @@ var init_release_files = __esm({
|
|
|
93528
93606
|
});
|
|
93529
93607
|
|
|
93530
93608
|
// src/daemon/upgrades/package.ts
|
|
93531
|
-
import { isAbsolute as isAbsolute16, join as
|
|
93609
|
+
import { isAbsolute as isAbsolute16, join as join34, relative as relative4 } from "node:path";
|
|
93532
93610
|
async function prepareDaemonReleaseVersion(version2, signal) {
|
|
93533
93611
|
runtimeUpgradeVersionSchema.parse(version2);
|
|
93534
93612
|
signal.throwIfAborted();
|
|
@@ -93609,7 +93687,7 @@ async function verifyInstalledDaemonRelease(installed, prefix, version2, signal)
|
|
|
93609
93687
|
bin: external_exports.object({ mobius: external_exports.literal("dist/cli.js") }),
|
|
93610
93688
|
engines: external_exports.object({ node: external_exports.string().refine((value) => (0, import_semver.validRange)(value) !== null) })
|
|
93611
93689
|
}).parse(JSON.parse(installed.manifest));
|
|
93612
|
-
const entry = await canonicalPath(
|
|
93690
|
+
const entry = await canonicalPath(join34(installed.packageRoot, metadata.bin.mobius));
|
|
93613
93691
|
const resolved = relative4(await canonicalPath(prefix), entry);
|
|
93614
93692
|
if (resolved.startsWith("..") || isAbsolute16(resolved)) {
|
|
93615
93693
|
throw new Error("Installed entry escaped npm prefix");
|
|
@@ -97756,56 +97834,82 @@ var init_runtime_turn_activity = __esm({
|
|
|
97756
97834
|
RuntimeTurnActivity = class {
|
|
97757
97835
|
#turns = /* @__PURE__ */ new Set();
|
|
97758
97836
|
#backgroundSources = /* @__PURE__ */ new Set();
|
|
97759
|
-
#
|
|
97760
|
-
|
|
97837
|
+
#idleWaiters = /* @__PURE__ */ new Set();
|
|
97838
|
+
// When work last started or stopped; the quiet period is measured from here.
|
|
97839
|
+
#changedAt = Date.now();
|
|
97840
|
+
#reserved = false;
|
|
97841
|
+
acceptsPrompts = () => !this.#reserved;
|
|
97761
97842
|
count = () => this.#turns.size + this.#backgroundSources.size;
|
|
97843
|
+
describe = () => ({
|
|
97844
|
+
turns: this.#turns.size,
|
|
97845
|
+
backgroundSources: this.#backgroundSources.size
|
|
97846
|
+
});
|
|
97762
97847
|
setBackgroundActivity = (source, active) => {
|
|
97848
|
+
if (active === this.#backgroundSources.has(source)) {
|
|
97849
|
+
return;
|
|
97850
|
+
}
|
|
97763
97851
|
if (active) {
|
|
97764
97852
|
this.#backgroundSources.add(source);
|
|
97765
97853
|
} else {
|
|
97766
97854
|
this.#backgroundSources.delete(source);
|
|
97767
97855
|
}
|
|
97768
|
-
this.#
|
|
97856
|
+
this.#changed();
|
|
97769
97857
|
};
|
|
97770
|
-
#reserveIfIdle() {
|
|
97771
|
-
if (this.count() === 0 && this.#admission.kind === "waiting") {
|
|
97772
|
-
this.#admission.reserve();
|
|
97773
|
-
}
|
|
97774
|
-
}
|
|
97775
97858
|
start = (turn) => {
|
|
97776
97859
|
this.#turns.add(turn);
|
|
97860
|
+
this.#changed();
|
|
97777
97861
|
};
|
|
97778
97862
|
finish = (turn) => {
|
|
97779
97863
|
this.#turns.delete(turn);
|
|
97780
|
-
this.#
|
|
97864
|
+
this.#changed();
|
|
97781
97865
|
};
|
|
97782
|
-
|
|
97866
|
+
#changed() {
|
|
97867
|
+
this.#changedAt = Date.now();
|
|
97868
|
+
if (this.count() === 0) {
|
|
97869
|
+
for (const resolve21 of this.#idleWaiters) {
|
|
97870
|
+
resolve21();
|
|
97871
|
+
}
|
|
97872
|
+
this.#idleWaiters.clear();
|
|
97873
|
+
}
|
|
97874
|
+
}
|
|
97875
|
+
whenIdle = (signal) => {
|
|
97783
97876
|
signal.throwIfAborted();
|
|
97784
|
-
if (this
|
|
97785
|
-
|
|
97877
|
+
if (this.count() === 0) {
|
|
97878
|
+
return Promise.resolve();
|
|
97786
97879
|
}
|
|
97787
97880
|
return new Promise((resolve21, reject2) => {
|
|
97788
97881
|
const abort = () => {
|
|
97789
|
-
this.#
|
|
97790
|
-
signal.removeEventListener("abort", abort);
|
|
97882
|
+
this.#idleWaiters.delete(idle);
|
|
97791
97883
|
reject2(signal.reason);
|
|
97792
97884
|
};
|
|
97793
|
-
const
|
|
97794
|
-
this.#admission = { kind: "reserved" };
|
|
97885
|
+
const idle = () => {
|
|
97795
97886
|
signal.removeEventListener("abort", abort);
|
|
97796
|
-
resolve21(
|
|
97797
|
-
[Symbol.dispose]: () => {
|
|
97798
|
-
this.#admission = { kind: "open" };
|
|
97799
|
-
}
|
|
97800
|
-
});
|
|
97887
|
+
resolve21();
|
|
97801
97888
|
};
|
|
97802
|
-
this.#
|
|
97889
|
+
this.#idleWaiters.add(idle);
|
|
97803
97890
|
signal.addEventListener("abort", abort, { once: true });
|
|
97804
|
-
if (this.count() === 0) {
|
|
97805
|
-
reserve();
|
|
97806
|
-
}
|
|
97807
97891
|
});
|
|
97808
97892
|
};
|
|
97893
|
+
/**
|
|
97894
|
+
* Close admission only after the Runtime has had no work for `quietMilliseconds`.
|
|
97895
|
+
* The moment a reply finishes is when a user is most likely to continue, so idle
|
|
97896
|
+
* alone is not an upgrade window. Checking and reserving happen synchronously, so
|
|
97897
|
+
* no prompt can be admitted between them.
|
|
97898
|
+
*/
|
|
97899
|
+
reserveIfQuiet = (quietMilliseconds) => {
|
|
97900
|
+
if (this.#reserved) {
|
|
97901
|
+
throw new Error("A daemon upgrade already owns admission");
|
|
97902
|
+
}
|
|
97903
|
+
if (this.count() > 0 || Date.now() - this.#changedAt < quietMilliseconds) {
|
|
97904
|
+
return null;
|
|
97905
|
+
}
|
|
97906
|
+
this.#reserved = true;
|
|
97907
|
+
return {
|
|
97908
|
+
[Symbol.dispose]: () => {
|
|
97909
|
+
this.#reserved = false;
|
|
97910
|
+
}
|
|
97911
|
+
};
|
|
97912
|
+
};
|
|
97809
97913
|
};
|
|
97810
97914
|
}
|
|
97811
97915
|
});
|
|
@@ -98127,7 +98231,7 @@ var init_session_turns = __esm({
|
|
|
98127
98231
|
|
|
98128
98232
|
// src/session/workspace/workspace-directory.ts
|
|
98129
98233
|
import { homedir as homedir4 } from "node:os";
|
|
98130
|
-
import { basename as basename8, dirname as dirname11, isAbsolute as isAbsolute17, join as
|
|
98234
|
+
import { basename as basename8, dirname as dirname11, isAbsolute as isAbsolute17, join as join35, normalize as normalize2, relative as relative5 } from "node:path";
|
|
98131
98235
|
function encodePath(path8) {
|
|
98132
98236
|
const encoded = Buffer.from(path8, "utf8").toString("base64url");
|
|
98133
98237
|
if (path8.length === 0 || path8.length > MAX_WORKSPACE_PATH_LENGTH || encoded.length + "path-".length > MAX_DIRECTORY_IDENTIFIER_LENGTH) {
|
|
@@ -98256,7 +98360,7 @@ var init_workspace_directory = __esm({
|
|
|
98256
98360
|
continue;
|
|
98257
98361
|
}
|
|
98258
98362
|
try {
|
|
98259
|
-
const path8 = await this.resolvePath(
|
|
98363
|
+
const path8 = await this.resolvePath(join35(target, child.name), signal);
|
|
98260
98364
|
entries.push({ directoryId: encodePath(path8), name: child.name });
|
|
98261
98365
|
} catch (cause) {
|
|
98262
98366
|
signal.throwIfAborted();
|
|
@@ -98428,7 +98532,7 @@ var init_session_layer = __esm({
|
|
|
98428
98532
|
// src/storage/files/scratch-directory.ts
|
|
98429
98533
|
import { randomUUID as randomUUID18 } from "node:crypto";
|
|
98430
98534
|
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
|
|
98535
|
+
import { dirname as dirname12, join as join36 } from "node:path";
|
|
98432
98536
|
async function atomicWrite(path8, bytes, signal) {
|
|
98433
98537
|
const temporary = `${path8}.${randomUUID18()}.tmp`;
|
|
98434
98538
|
try {
|
|
@@ -98446,7 +98550,7 @@ var init_scratch_directory = __esm({
|
|
|
98446
98550
|
ScratchDirectory = class {
|
|
98447
98551
|
#root;
|
|
98448
98552
|
constructor(parent) {
|
|
98449
|
-
this.#root =
|
|
98553
|
+
this.#root = join36(parent, randomUUID18());
|
|
98450
98554
|
}
|
|
98451
98555
|
/** Refreshes this directory's lease and removes sibling directories whose lease is older than `leaseMilliseconds`. */
|
|
98452
98556
|
refreshLease = async (leaseMilliseconds) => {
|
|
@@ -98457,7 +98561,7 @@ var init_scratch_directory = __esm({
|
|
|
98457
98561
|
if (!directory.isDirectory() || !/^[a-f0-9-]{36}$/u.test(directory.name)) {
|
|
98458
98562
|
continue;
|
|
98459
98563
|
}
|
|
98460
|
-
const path8 =
|
|
98564
|
+
const path8 = join36(dirname12(this.#root), directory.name);
|
|
98461
98565
|
if (path8 === this.#root) {
|
|
98462
98566
|
continue;
|
|
98463
98567
|
}
|
|
@@ -98472,10 +98576,10 @@ var init_scratch_directory = __esm({
|
|
|
98472
98576
|
};
|
|
98473
98577
|
/** Writes `bytes` atomically to `<group>/<name>` with owner-only permissions and returns the path. */
|
|
98474
98578
|
write = async (group, name2, bytes, signal) => {
|
|
98475
|
-
const directory =
|
|
98579
|
+
const directory = join36(this.#root, group);
|
|
98476
98580
|
await mkdir5(directory, { mode: 448, recursive: true });
|
|
98477
98581
|
signal.throwIfAborted();
|
|
98478
|
-
const path8 =
|
|
98582
|
+
const path8 = join36(directory, name2);
|
|
98479
98583
|
await atomicWrite(path8, bytes, signal);
|
|
98480
98584
|
return path8;
|
|
98481
98585
|
};
|
|
@@ -98510,7 +98614,7 @@ var init_scratch_directory = __esm({
|
|
|
98510
98614
|
|
|
98511
98615
|
// src/session/content/external-content-store.ts
|
|
98512
98616
|
import { createHash as createHash8 } from "node:crypto";
|
|
98513
|
-
import { join as
|
|
98617
|
+
import { join as join37 } from "node:path";
|
|
98514
98618
|
var contentRequest, CONTENT_LIFETIME_MILLISECONDS, metadataSchema, LocalExternalContentStore;
|
|
98515
98619
|
var init_external_content_store = __esm({
|
|
98516
98620
|
"src/session/content/external-content-store.ts"() {
|
|
@@ -98532,7 +98636,7 @@ var init_external_content_store = __esm({
|
|
|
98532
98636
|
#expirationTimer;
|
|
98533
98637
|
#cleanup = Promise.resolve();
|
|
98534
98638
|
constructor(stateDirectory) {
|
|
98535
|
-
this.#scratch = new ScratchDirectory(
|
|
98639
|
+
this.#scratch = new ScratchDirectory(join37(stateDirectory, "tmp", "session-content"));
|
|
98536
98640
|
this.#expirationTimer = setInterval(() => {
|
|
98537
98641
|
void this.#expire().catch(() => void 0);
|
|
98538
98642
|
}, 6e4);
|
|
@@ -98937,7 +99041,7 @@ var init_agent_process_pool = __esm({
|
|
|
98937
99041
|
});
|
|
98938
99042
|
|
|
98939
99043
|
// src/runtime/observability/diagnostic-log.ts
|
|
98940
|
-
import { join as
|
|
99044
|
+
import { join as join38 } from "node:path";
|
|
98941
99045
|
function exportedFields(value) {
|
|
98942
99046
|
const entry = {};
|
|
98943
99047
|
for (const field of REMOTE_DIAGNOSTIC_FIELDS) {
|
|
@@ -99006,7 +99110,7 @@ var init_diagnostic_log = __esm({
|
|
|
99006
99110
|
this.#maximumBytes = maximumBytes;
|
|
99007
99111
|
const processLogsDirectory = options.processLogsDirectory;
|
|
99008
99112
|
this.#sources = [
|
|
99009
|
-
{ maximumBytes, path:
|
|
99113
|
+
{ maximumBytes, path: join38(directory, DAEMON_LOG_FILENAME) },
|
|
99010
99114
|
// The process logs a Runtime does not own, but must read to explain its own deaths.
|
|
99011
99115
|
...processLogsDirectory === void 0 ? [] : processLogPaths(processLogsDirectory).map((path8) => ({ maximumBytes: null, path: path8 }))
|
|
99012
99116
|
];
|
|
@@ -100046,7 +100150,7 @@ var init_content_write = __esm({
|
|
|
100046
100150
|
});
|
|
100047
100151
|
|
|
100048
100152
|
// src/session/content/session-files.ts
|
|
100049
|
-
import { basename as basename9, extname as extname2, isAbsolute as isAbsolute18, join as
|
|
100153
|
+
import { basename as basename9, extname as extname2, isAbsolute as isAbsolute18, join as join39, normalize as normalize3, resolve as resolve18 } from "node:path";
|
|
100050
100154
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
100051
100155
|
function requestedPath(value) {
|
|
100052
100156
|
if (value.includes("\0")) {
|
|
@@ -100070,7 +100174,7 @@ async function resolveFile(value, workingDirectory, signal) {
|
|
|
100070
100174
|
if (isAbsolute18(requested.path) && normalize3(requested.path) !== requested.path) {
|
|
100071
100175
|
return null;
|
|
100072
100176
|
}
|
|
100073
|
-
const candidates = requested.explicitUrl || workingDirectory === null ? [requested.path] : isAbsolute18(requested.path) ? [
|
|
100177
|
+
const candidates = requested.explicitUrl || workingDirectory === null ? [requested.path] : isAbsolute18(requested.path) ? [join39(workingDirectory, requested.path), requested.path] : [resolve18(workingDirectory, requested.path)];
|
|
100074
100178
|
for (const candidate of candidates) {
|
|
100075
100179
|
if (!isAbsolute18(candidate) || normalize3(candidate) !== candidate) {
|
|
100076
100180
|
continue;
|
|
@@ -102783,6 +102887,21 @@ async function awaitDaemonReleaseSwitch(stateDirectory, id, signal) {
|
|
|
102783
102887
|
}
|
|
102784
102888
|
return outcome;
|
|
102785
102889
|
}
|
|
102890
|
+
async function reserveWhenQuiet(activity, signal) {
|
|
102891
|
+
for (; ; ) {
|
|
102892
|
+
await activity.whenIdle(signal);
|
|
102893
|
+
for await (const _tick of setInterval2(UPGRADE_QUIET_CHECK_MILLISECONDS, void 0, { signal })) {
|
|
102894
|
+
const reservation = activity.reserveIfQuiet(UPGRADE_QUIET_MILLISECONDS);
|
|
102895
|
+
if (reservation !== null) {
|
|
102896
|
+
return reservation;
|
|
102897
|
+
}
|
|
102898
|
+
if (activity.count() > 0) {
|
|
102899
|
+
break;
|
|
102900
|
+
}
|
|
102901
|
+
}
|
|
102902
|
+
signal.throwIfAborted();
|
|
102903
|
+
}
|
|
102904
|
+
}
|
|
102786
102905
|
async function checkDaemonReleaseUpgrade(signal, activity) {
|
|
102787
102906
|
var _stack = [];
|
|
102788
102907
|
try {
|
|
@@ -102796,17 +102915,20 @@ async function checkDaemonReleaseUpgrade(signal, activity) {
|
|
|
102796
102915
|
return;
|
|
102797
102916
|
}
|
|
102798
102917
|
const launch = await installDaemonReleaseVersion(version2, signal);
|
|
102799
|
-
|
|
102918
|
+
let reservation = activity.reserveIfQuiet(UPGRADE_QUIET_MILLISECONDS);
|
|
102919
|
+
if (reservation === null) {
|
|
102800
102920
|
new RuntimeDiagnosticLog(control.stateDirectory).record(
|
|
102801
102921
|
`Mobius daemon diagnostic ${JSON.stringify({
|
|
102802
102922
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
102803
102923
|
event: "daemon_upgrade_deferred",
|
|
102804
102924
|
version: version2,
|
|
102805
|
-
activeWork: activity.count()
|
|
102925
|
+
activeWork: activity.count(),
|
|
102926
|
+
...activity.describe()
|
|
102806
102927
|
})}`
|
|
102807
102928
|
);
|
|
102929
|
+
reservation = await reserveWhenQuiet(activity, signal);
|
|
102808
102930
|
}
|
|
102809
|
-
const _reservation = __using(_stack,
|
|
102931
|
+
const _reservation = __using(_stack, reservation);
|
|
102810
102932
|
signal.throwIfAborted();
|
|
102811
102933
|
await requestInstalledDaemonReleaseSwitch(control.stateDirectory, launch, signal);
|
|
102812
102934
|
await new Promise((resolve21) => {
|
|
@@ -102822,7 +102944,7 @@ async function checkDaemonReleaseUpgrade(signal, activity) {
|
|
|
102822
102944
|
__callDispose(_stack, _error, _hasError);
|
|
102823
102945
|
}
|
|
102824
102946
|
}
|
|
102825
|
-
var SWITCH_COMPLETION_MILLISECONDS, SWITCH_POLL_MILLISECONDS;
|
|
102947
|
+
var SWITCH_COMPLETION_MILLISECONDS, SWITCH_POLL_MILLISECONDS, UPGRADE_QUIET_MILLISECONDS, UPGRADE_QUIET_CHECK_MILLISECONDS;
|
|
102826
102948
|
var init_upgrade2 = __esm({
|
|
102827
102949
|
"src/daemon/upgrades/upgrade.ts"() {
|
|
102828
102950
|
"use strict";
|
|
@@ -102837,6 +102959,8 @@ var init_upgrade2 = __esm({
|
|
|
102837
102959
|
init_package2();
|
|
102838
102960
|
SWITCH_COMPLETION_MILLISECONDS = 3e5;
|
|
102839
102961
|
SWITCH_POLL_MILLISECONDS = 200;
|
|
102962
|
+
UPGRADE_QUIET_MILLISECONDS = 30 * 6e4;
|
|
102963
|
+
UPGRADE_QUIET_CHECK_MILLISECONDS = 6e4;
|
|
102840
102964
|
}
|
|
102841
102965
|
});
|
|
102842
102966
|
|
|
@@ -103117,7 +103241,7 @@ var init_daemon = __esm({
|
|
|
103117
103241
|
});
|
|
103118
103242
|
|
|
103119
103243
|
// src/cli/handler/logs/logic/collect-local-logs.ts
|
|
103120
|
-
import { join as
|
|
103244
|
+
import { join as join40, relative as relative6, resolve as resolve19 } from "node:path";
|
|
103121
103245
|
async function collectLocalDaemonLogs(stateDirectory, tailLines, signal) {
|
|
103122
103246
|
signal.throwIfAborted();
|
|
103123
103247
|
const root = resolve19(stateDirectory);
|
|
@@ -103127,7 +103251,7 @@ async function collectLocalDaemonLogs(stateDirectory, tailLines, signal) {
|
|
|
103127
103251
|
for (const directory of directories) {
|
|
103128
103252
|
const names = await listLogFiles(directory, root, unreadable);
|
|
103129
103253
|
for (const name2 of names) {
|
|
103130
|
-
const path8 =
|
|
103254
|
+
const path8 = join40(directory, name2);
|
|
103131
103255
|
const reported = relative6(root, path8);
|
|
103132
103256
|
const read = await readOwnedLogFile(path8, signal);
|
|
103133
103257
|
if (read.kind === "unreadable") {
|