@oxagen/cli 3.0.1-802 → 3.0.1-816
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/oxagen.mjs +1117 -721
- package/package.json +1 -1
package/oxagen.mjs
CHANGED
|
@@ -11275,8 +11275,8 @@ var init_mcp_config_writer = __esm({
|
|
|
11275
11275
|
|
|
11276
11276
|
// ../../packages/tacho/src/host/claude-desktop-writer.ts
|
|
11277
11277
|
import { join as join3 } from "node:path";
|
|
11278
|
-
function claudeDesktopConfigPath(
|
|
11279
|
-
if (
|
|
11278
|
+
function claudeDesktopConfigPath(platform2, home, env = {}) {
|
|
11279
|
+
if (platform2 === "darwin") {
|
|
11280
11280
|
return join3(
|
|
11281
11281
|
home,
|
|
11282
11282
|
"Library",
|
|
@@ -11285,7 +11285,7 @@ function claudeDesktopConfigPath(platform, home, env = {}) {
|
|
|
11285
11285
|
"claude_desktop_config.json"
|
|
11286
11286
|
);
|
|
11287
11287
|
}
|
|
11288
|
-
if (
|
|
11288
|
+
if (platform2 === "win32") {
|
|
11289
11289
|
const appData = env["APPDATA"] ?? join3(home, "AppData", "Roaming");
|
|
11290
11290
|
return join3(appData, "Claude", "claude_desktop_config.json");
|
|
11291
11291
|
}
|
|
@@ -11554,16 +11554,16 @@ var init_cursor_adapter = __esm({
|
|
|
11554
11554
|
|
|
11555
11555
|
// ../../packages/tacho/src/host/cursor-writer.ts
|
|
11556
11556
|
import { join as join4 } from "node:path";
|
|
11557
|
-
function cursorConfigDir(home,
|
|
11557
|
+
function cursorConfigDir(home, platform2, env = {}) {
|
|
11558
11558
|
const explicit = env["CURSOR_CONFIG_DIR"];
|
|
11559
11559
|
if (explicit !== void 0 && explicit.length > 0) return explicit;
|
|
11560
11560
|
const xdg = env["XDG_CONFIG_HOME"];
|
|
11561
|
-
if (
|
|
11561
|
+
if (platform2 !== "darwin" && platform2 !== "win32" && xdg !== void 0 && xdg.length > 0)
|
|
11562
11562
|
return join4(xdg, "cursor");
|
|
11563
11563
|
return join4(home, ".cursor");
|
|
11564
11564
|
}
|
|
11565
|
-
function cursorHooksPaths(home,
|
|
11566
|
-
const resolved = join4(cursorConfigDir(home,
|
|
11565
|
+
function cursorHooksPaths(home, platform2, env = {}) {
|
|
11566
|
+
const resolved = join4(cursorConfigDir(home, platform2, env), "hooks.json");
|
|
11567
11567
|
const fallback = join4(home, ".cursor", "hooks.json");
|
|
11568
11568
|
return resolved === fallback ? [resolved] : [resolved, fallback];
|
|
11569
11569
|
}
|
|
@@ -11700,7 +11700,7 @@ function harnessConfigDirs(home, env = process.env, ownHome = homedir()) {
|
|
|
11700
11700
|
codexHome: codexHomeFor(own, home)
|
|
11701
11701
|
};
|
|
11702
11702
|
}
|
|
11703
|
-
function tachoHome(env = process.env, home = homedir(),
|
|
11703
|
+
function tachoHome(env = process.env, home = homedir(), platform2 = process.platform) {
|
|
11704
11704
|
const tachoDir = env["TACHO_HOME"] ?? join5(home, ".config", "oxagen", "tacho");
|
|
11705
11705
|
const claudeConfigDir = claudeConfigDirFor(env, home);
|
|
11706
11706
|
const codexHome = codexHomeFor(env, home);
|
|
@@ -11715,10 +11715,10 @@ function tachoHome(env = process.env, home = homedir(), platform = process.platf
|
|
|
11715
11715
|
claudeUserConfig: claudeUserConfigFor(env, home),
|
|
11716
11716
|
claudeProjects: join5(claudeConfigDir, "projects"),
|
|
11717
11717
|
codexHooks: join5(codexHome, "hooks.json"),
|
|
11718
|
-
cursorHooks: cursorHooksPaths(home,
|
|
11718
|
+
cursorHooks: cursorHooksPaths(home, platform2, env),
|
|
11719
11719
|
stellaToml: join5(stellaHome, "stella.toml"),
|
|
11720
11720
|
stellaSettingsJson: join5(stellaHome, "settings.json"),
|
|
11721
|
-
claudeDesktopConfig: claudeDesktopConfigPath(
|
|
11721
|
+
claudeDesktopConfig: claudeDesktopConfigPath(platform2, home, env)
|
|
11722
11722
|
};
|
|
11723
11723
|
}
|
|
11724
11724
|
function homeOf(paths) {
|
|
@@ -13061,19 +13061,19 @@ function psStartCommand(pids) {
|
|
|
13061
13061
|
[...PS_ZONE, "ps", "-o", "pid=,lstart=", "-p", pids.join(",")]
|
|
13062
13062
|
];
|
|
13063
13063
|
}
|
|
13064
|
-
function readProcessStarts(pids, exec4 = psExec,
|
|
13065
|
-
if (
|
|
13066
|
-
if (
|
|
13064
|
+
function readProcessStarts(pids, exec4 = psExec, platform2 = process.platform, read2 = readText) {
|
|
13065
|
+
if (platform2 === "win32" || pids.length === 0) return void 0;
|
|
13066
|
+
if (platform2 === "linux") return readProcStarts(pids, read2);
|
|
13067
13067
|
return parsePsStarts(pids, exec4(...psStartCommand(pids)));
|
|
13068
13068
|
}
|
|
13069
|
-
async function readProcessStartsAsync(pids, exec4 = psExecAsync,
|
|
13070
|
-
if (
|
|
13071
|
-
if (
|
|
13069
|
+
async function readProcessStartsAsync(pids, exec4 = psExecAsync, platform2 = process.platform, read2 = readText) {
|
|
13070
|
+
if (platform2 === "win32" || pids.length === 0) return void 0;
|
|
13071
|
+
if (platform2 === "linux") return readProcStarts(pids, read2);
|
|
13072
13072
|
return parsePsStarts(pids, await exec4(...psStartCommand(pids)));
|
|
13073
13073
|
}
|
|
13074
|
-
function readProcessStartsNoWait(pids, exec4 = psExecAsync,
|
|
13075
|
-
if (
|
|
13076
|
-
if (
|
|
13074
|
+
function readProcessStartsNoWait(pids, exec4 = psExecAsync, platform2 = process.platform, read2 = readText) {
|
|
13075
|
+
if (platform2 === "win32" || pids.length === 0) return void 0;
|
|
13076
|
+
if (platform2 === "linux") return readProcStarts(pids, read2);
|
|
13077
13077
|
return exec4(...psStartCommand(pids)).then(
|
|
13078
13078
|
(result2) => parsePsStarts(pids, result2),
|
|
13079
13079
|
() => void 0
|
|
@@ -13352,8 +13352,8 @@ function psLookup(pid, timeoutMs = 2e3) {
|
|
|
13352
13352
|
return void 0;
|
|
13353
13353
|
return parsePsLine(result2.stdout);
|
|
13354
13354
|
}
|
|
13355
|
-
function stellaHarnessPid(parentPid,
|
|
13356
|
-
if (
|
|
13355
|
+
function stellaHarnessPid(parentPid, platform2, lookup = psLookup) {
|
|
13356
|
+
if (platform2 === "win32") return parentPid;
|
|
13357
13357
|
const parent = lookup(parentPid);
|
|
13358
13358
|
if (parent === void 0) return parentPid;
|
|
13359
13359
|
return isShellWithParent(parent) ? parent.ppid : parentPid;
|
|
@@ -13368,8 +13368,8 @@ function stellaExportedPid(value) {
|
|
|
13368
13368
|
const pid = Number(text6);
|
|
13369
13369
|
return Number.isSafeInteger(pid) && pid > 1 ? pid : void 0;
|
|
13370
13370
|
}
|
|
13371
|
-
function procLookupFor(
|
|
13372
|
-
if (
|
|
13371
|
+
function procLookupFor(platform2) {
|
|
13372
|
+
if (platform2 !== "linux") return () => void 0;
|
|
13373
13373
|
return (pid) => readProcParent(pid);
|
|
13374
13374
|
}
|
|
13375
13375
|
function cachePath(cacheDir, pid) {
|
|
@@ -13425,16 +13425,16 @@ function confirmsCached(cached4, current, legacy) {
|
|
|
13425
13425
|
return cached4.instance === current || cached4.instance === legacy();
|
|
13426
13426
|
}
|
|
13427
13427
|
function resolveStellaIdentity(options) {
|
|
13428
|
-
const { parentPid, platform, cacheDir, now } = options;
|
|
13428
|
+
const { parentPid, platform: platform2, cacheDir, now } = options;
|
|
13429
13429
|
const isAlive = options.isAlive ?? processAlive;
|
|
13430
13430
|
const exported = options.exportedPid !== void 0 && isAlive(options.exportedPid) ? options.exportedPid : void 0;
|
|
13431
|
-
if (
|
|
13431
|
+
if (platform2 === "win32") return { pid: exported ?? parentPid };
|
|
13432
13432
|
const clock2 = options.clock ?? Date.now;
|
|
13433
13433
|
const deadline = clock2() + STELLA_PS_BUDGET_MS;
|
|
13434
13434
|
const left = () => Math.max(STELLA_PS_FLOOR_MS, deadline - clock2());
|
|
13435
|
-
const procLookup = options.procLookup ?? procLookupFor(
|
|
13435
|
+
const procLookup = options.procLookup ?? procLookupFor(platform2);
|
|
13436
13436
|
const lookup = (pid) => procLookup(pid) ?? (options.lookup ?? psLookup)(pid, left());
|
|
13437
|
-
const startInstance = (pid) => options.startInstance !== void 0 ? options.startInstance(pid, left()) : processStartInstance(pid, left(),
|
|
13437
|
+
const startInstance = (pid) => options.startInstance !== void 0 ? options.startInstance(pid, left()) : processStartInstance(pid, left(), platform2);
|
|
13438
13438
|
const legacyStartInstance = (pid) => (options.legacyStartInstance ?? lstartInstance)(pid, left());
|
|
13439
13439
|
const starting = options.event === "SessionStart";
|
|
13440
13440
|
const key = exported ?? parentPid;
|
|
@@ -13494,8 +13494,8 @@ function startInstanceToken(started) {
|
|
|
13494
13494
|
if (text6.length === 0) return void 0;
|
|
13495
13495
|
return digestJcs(text6).slice("sha256:".length, "sha256:".length + 12);
|
|
13496
13496
|
}
|
|
13497
|
-
function processStartInstance(pid, timeoutMs = 2e3,
|
|
13498
|
-
const started = readProcessStarts([pid], exec4,
|
|
13497
|
+
function processStartInstance(pid, timeoutMs = 2e3, platform2 = process.platform, exec4 = psExecWithin(timeoutMs), read2) {
|
|
13498
|
+
const started = readProcessStarts([pid], exec4, platform2, read2)?.get(pid);
|
|
13499
13499
|
return started === void 0 ? void 0 : startInstanceToken(started);
|
|
13500
13500
|
}
|
|
13501
13501
|
function lstartInstance(pid, timeoutMs = 2e3) {
|
|
@@ -13673,8 +13673,8 @@ function psArgs(pid, timeoutMs = 2e3) {
|
|
|
13673
13673
|
const line = result2.stdout.trim();
|
|
13674
13674
|
return line.length > 0 ? line : void 0;
|
|
13675
13675
|
}
|
|
13676
|
-
function codexHarnessPid(parentPid,
|
|
13677
|
-
if (
|
|
13676
|
+
function codexHarnessPid(parentPid, platform2, lookup = psLookup, argsOf = psArgs, now = Date.now) {
|
|
13677
|
+
if (platform2 === "win32") return void 0;
|
|
13678
13678
|
const deadline = now() + WALK_BUDGET_MS;
|
|
13679
13679
|
const left = () => {
|
|
13680
13680
|
const ms = deadline - now();
|
|
@@ -15652,7 +15652,7 @@ async function runTachoHook(deps) {
|
|
|
15652
15652
|
const now = deps.now ?? (() => Date.now());
|
|
15653
15653
|
const hookId = deps.hookId ?? ulid(now());
|
|
15654
15654
|
const receivedAt = toProtocolTimestamp(now());
|
|
15655
|
-
const
|
|
15655
|
+
const platform2 = deps.platform ?? process.platform;
|
|
15656
15656
|
const agent = deps.agent;
|
|
15657
15657
|
const agentProblem = agent !== void 0 ? customAgentNameProblem(agent) : void 0;
|
|
15658
15658
|
if (agentProblem !== void 0) {
|
|
@@ -15705,8 +15705,8 @@ async function runTachoHook(deps) {
|
|
|
15705
15705
|
if (stella) {
|
|
15706
15706
|
let identity;
|
|
15707
15707
|
if (deps.harnessPid !== void 0 || deps.harnessInstance !== void 0) {
|
|
15708
|
-
const pid = deps.harnessPid?.() ?? stellaHarnessPid(process.ppid,
|
|
15709
|
-
const instance = (deps.harnessInstance ?? ((pid2) => processStartInstance(pid2, void 0,
|
|
15708
|
+
const pid = deps.harnessPid?.() ?? stellaHarnessPid(process.ppid, platform2);
|
|
15709
|
+
const instance = (deps.harnessInstance ?? ((pid2) => processStartInstance(pid2, void 0, platform2)))(pid);
|
|
15710
15710
|
identity = { pid, ...instance !== void 0 ? { instance } : {} };
|
|
15711
15711
|
} else if (host === void 0 && hostReadError === void 0) {
|
|
15712
15712
|
identity = { pid: process.ppid };
|
|
@@ -15715,7 +15715,7 @@ async function runTachoHook(deps) {
|
|
|
15715
15715
|
const exportedPid = stellaExportedPid(deps.env[STELLA_PID_ENV]);
|
|
15716
15716
|
identity = resolveStellaIdentity({
|
|
15717
15717
|
parentPid: process.ppid,
|
|
15718
|
-
platform,
|
|
15718
|
+
platform: platform2,
|
|
15719
15719
|
cacheDir: deps.paths.stellaIdentity,
|
|
15720
15720
|
now: now(),
|
|
15721
15721
|
...exportedPid !== void 0 ? { exportedPid } : {},
|
|
@@ -15772,7 +15772,7 @@ async function runTachoHook(deps) {
|
|
|
15772
15772
|
}
|
|
15773
15773
|
const input = parsed2.data;
|
|
15774
15774
|
if (codex && CODEX_PID_EVENTS.has(input.hook_event_name) && (host !== void 0 || hostReadError !== void 0))
|
|
15775
|
-
harnessPid = (deps.harnessPid ?? (() => codexHarnessPid(process.ppid,
|
|
15775
|
+
harnessPid = (deps.harnessPid ?? (() => codexHarnessPid(process.ppid, platform2)))();
|
|
15776
15776
|
if (codex && (host !== void 0 || hostReadError !== void 0))
|
|
15777
15777
|
raw = withCodexPromptSource(raw);
|
|
15778
15778
|
const answer = (response) => stella ? stellaAnswer(response, input.hook_event_name) : cursor ? cursorAnswer(response, input.hook_event_name) : `${JSON.stringify(codex ? codexAnswer(response, input.hook_event_name) : response)}
|
|
@@ -15796,8 +15796,8 @@ async function runTachoHook(deps) {
|
|
|
15796
15796
|
...harnessPid !== void 0 ? { TACHO_HARNESS_PID: String(harnessPid) } : {},
|
|
15797
15797
|
...workOrder !== void 0 ? { [WORK_ORDER_ENV]: workOrder } : {}
|
|
15798
15798
|
};
|
|
15799
|
-
const
|
|
15800
|
-
const useTcp =
|
|
15799
|
+
const post3 = deps.post ?? postUnix;
|
|
15800
|
+
const useTcp = platform2 === "win32";
|
|
15801
15801
|
const label = agent !== void 0 ? { agent } : { harness };
|
|
15802
15802
|
const enrollment = deps.enrollment ?? enrollmentFromArgv(process.argv);
|
|
15803
15803
|
const staleEntry = (current) => enrollment !== void 0 && enrollment !== current ? {
|
|
@@ -15818,7 +15818,7 @@ async function runTachoHook(deps) {
|
|
|
15818
15818
|
const port = routing.port;
|
|
15819
15819
|
if (!useTcp || port !== void 0) {
|
|
15820
15820
|
try {
|
|
15821
|
-
const result2 = await
|
|
15821
|
+
const result2 = await post3({
|
|
15822
15822
|
...useTcp ? { loopbackPort: port } : { socketPath: deps.paths.socket },
|
|
15823
15823
|
path: `/hook/${routing.host_enrollment_id}`,
|
|
15824
15824
|
headers: {
|
|
@@ -15871,7 +15871,7 @@ async function runTachoHook(deps) {
|
|
|
15871
15871
|
const stale = staleEntry(host.host_enrollment_id);
|
|
15872
15872
|
if (stale !== void 0) return stale;
|
|
15873
15873
|
try {
|
|
15874
|
-
const result2 = await
|
|
15874
|
+
const result2 = await post3({
|
|
15875
15875
|
...useTcp ? { loopbackPort: host.port } : { socketPath: deps.paths.socket },
|
|
15876
15876
|
path: `/hook/${host.host_enrollment_id}`,
|
|
15877
15877
|
headers: {
|
|
@@ -16051,7 +16051,7 @@ function readAnswer(body2) {
|
|
|
16051
16051
|
async function runSteerWait(deps) {
|
|
16052
16052
|
const now = deps.now ?? (() => Date.now());
|
|
16053
16053
|
const sleep2 = deps.sleep ?? ((ms) => new Promise((resolve29) => setTimeout(resolve29, ms)));
|
|
16054
|
-
const
|
|
16054
|
+
const post3 = deps.post ?? postUnix;
|
|
16055
16055
|
const sessionId = sessionOf(deps.stdin);
|
|
16056
16056
|
if (sessionId === void 0) return DONE;
|
|
16057
16057
|
const useTcp = deps.platform === "win32";
|
|
@@ -16079,7 +16079,7 @@ async function runSteerWait(deps) {
|
|
|
16079
16079
|
const askedAt = now();
|
|
16080
16080
|
let result2;
|
|
16081
16081
|
try {
|
|
16082
|
-
result2 = await
|
|
16082
|
+
result2 = await post3({
|
|
16083
16083
|
...useTcp ? { loopbackPort: routing.port } : { socketPath: deps.paths.socket },
|
|
16084
16084
|
path: `/steer-wait/${routing.host_enrollment_id}`,
|
|
16085
16085
|
headers: { Authorization: `Bearer ${routing.local_token}` },
|
|
@@ -26724,20 +26724,20 @@ function findHarnessBinary(name2, env, home) {
|
|
|
26724
26724
|
}
|
|
26725
26725
|
return void 0;
|
|
26726
26726
|
}
|
|
26727
|
-
function setupTokenCommand(claude,
|
|
26727
|
+
function setupTokenCommand(claude, platform2) {
|
|
26728
26728
|
const quoted3 = `'${claude.replace(/'/g, `'\\''`)}'`;
|
|
26729
26729
|
const inner = `stty cols 1000 2>/dev/null; exec ${quoted3} setup-token`;
|
|
26730
|
-
if (
|
|
26730
|
+
if (platform2 === "darwin")
|
|
26731
26731
|
return { file: "script", args: ["-q", "/dev/null", "sh", "-c", inner] };
|
|
26732
|
-
if (
|
|
26732
|
+
if (platform2 === "linux")
|
|
26733
26733
|
return { file: "script", args: ["-q", "-e", "-c", inner, "/dev/null"] };
|
|
26734
26734
|
return void 0;
|
|
26735
26735
|
}
|
|
26736
26736
|
function shellQuote(value) {
|
|
26737
26737
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
26738
26738
|
}
|
|
26739
|
-
function setupTokenShellLine(claude,
|
|
26740
|
-
const command2 = setupTokenCommand(claude,
|
|
26739
|
+
function setupTokenShellLine(claude, platform2) {
|
|
26740
|
+
const command2 = setupTokenCommand(claude, platform2);
|
|
26741
26741
|
if (command2 === void 0) return void 0;
|
|
26742
26742
|
const script = [command2.file, ...command2.args].map(shellQuote).join(" ");
|
|
26743
26743
|
return `sleep 2147483647 | { ${script}; echo "${SETUP_TOKEN_EXIT_MARK}$?"; }`;
|
|
@@ -27117,17 +27117,17 @@ function stellaValue(file, text6) {
|
|
|
27117
27117
|
const found = findStellaBaseUrl(splitLines(text6));
|
|
27118
27118
|
return found.kind === "table" ? found.value : null;
|
|
27119
27119
|
}
|
|
27120
|
-
function claudeManagedSettingsPath(
|
|
27121
|
-
if (
|
|
27120
|
+
function claudeManagedSettingsPath(platform2 = process.platform) {
|
|
27121
|
+
if (platform2 === "darwin")
|
|
27122
27122
|
return "/Library/Application Support/ClaudeCode/managed-settings.json";
|
|
27123
|
-
if (
|
|
27123
|
+
if (platform2 === "win32")
|
|
27124
27124
|
return "C:\\Program Files\\ClaudeCode\\managed-settings.json";
|
|
27125
27125
|
return "/etc/claude-code/managed-settings.json";
|
|
27126
27126
|
}
|
|
27127
|
-
function stellaManagedSettingsPath(
|
|
27127
|
+
function stellaManagedSettingsPath(platform2 = process.platform, env = process.env) {
|
|
27128
27128
|
const named = env["STELLA_MANAGED_SETTINGS"];
|
|
27129
27129
|
if (named !== void 0 && named.length > 0) return named;
|
|
27130
|
-
const dir =
|
|
27130
|
+
const dir = platform2 === "darwin" ? "/Library/Application Support/stella" : "/etc/stella";
|
|
27131
27131
|
const toml = join15(dir, "stella.toml");
|
|
27132
27132
|
const json2 = join15(dir, "settings.json");
|
|
27133
27133
|
return !existsSync6(toml) && existsSync6(json2) ? json2 : toml;
|
|
@@ -29161,8 +29161,8 @@ function cmdArgument(value) {
|
|
|
29161
29161
|
quoted3 = `"${quoted3}${"\\".repeat(slashes * 2)}"`;
|
|
29162
29162
|
return quoted3.replace(CMD_META, "^$1").replace(CMD_META, "^$1");
|
|
29163
29163
|
}
|
|
29164
|
-
function spawnInvocation(command2, args,
|
|
29165
|
-
if (
|
|
29164
|
+
function spawnInvocation(command2, args, platform2 = process.platform, env = process.env) {
|
|
29165
|
+
if (platform2 !== "win32" || !/\.(cmd|bat)$/i.test(command2))
|
|
29166
29166
|
return { command: command2, args: [...args] };
|
|
29167
29167
|
const line = [command2.replace(CMD_META, "^$1"), ...args.map(cmdArgument)];
|
|
29168
29168
|
return {
|
|
@@ -29915,7 +29915,7 @@ import { readFileSync as readFileSync10 } from "node:fs";
|
|
|
29915
29915
|
import { dirname as dirname9, resolve as resolve3 } from "node:path";
|
|
29916
29916
|
import { fileURLToPath } from "node:url";
|
|
29917
29917
|
function readVersion() {
|
|
29918
|
-
if (true) return "3.0.1-
|
|
29918
|
+
if (true) return "3.0.1-816";
|
|
29919
29919
|
try {
|
|
29920
29920
|
const here = dirname9(fileURLToPath(import.meta.url));
|
|
29921
29921
|
const pkg = JSON.parse(
|
|
@@ -30000,9 +30000,9 @@ function transientBinDir(binDir, env = process.env) {
|
|
|
30000
30000
|
return "an AppImage mount";
|
|
30001
30001
|
return void 0;
|
|
30002
30002
|
}
|
|
30003
|
-
function shellQuote2(value,
|
|
30003
|
+
function shellQuote2(value, platform2 = process.platform) {
|
|
30004
30004
|
if (/^[A-Za-z0-9_@%+=:,./-]+$/.test(value)) return value;
|
|
30005
|
-
if (
|
|
30005
|
+
if (platform2 === "win32") return `"${value}"`;
|
|
30006
30006
|
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
30007
30007
|
}
|
|
30008
30008
|
function isNativeBuild() {
|
|
@@ -30013,11 +30013,11 @@ function isNativeBuild() {
|
|
|
30013
30013
|
return false;
|
|
30014
30014
|
}
|
|
30015
30015
|
}
|
|
30016
|
-
function exeName(name2,
|
|
30017
|
-
return
|
|
30016
|
+
function exeName(name2, platform2) {
|
|
30017
|
+
return platform2 === "win32" ? `${name2}.exe` : name2;
|
|
30018
30018
|
}
|
|
30019
|
-
function stableExecutablePath(executable,
|
|
30020
|
-
const stable =
|
|
30019
|
+
function stableExecutablePath(executable, platform2, exists = existsSync10) {
|
|
30020
|
+
const stable = platform2 === "win32" ? executable.replace(
|
|
30021
30021
|
/^(.*\\apps\\[^\\]+\\)(?!current\\)[^\\]+(\\.*)$/i,
|
|
30022
30022
|
"$1current$2"
|
|
30023
30023
|
) : executable.replace(
|
|
@@ -30026,12 +30026,12 @@ function stableExecutablePath(executable, platform, exists = existsSync10) {
|
|
|
30026
30026
|
);
|
|
30027
30027
|
return stable !== executable && exists(stable) ? stable : executable;
|
|
30028
30028
|
}
|
|
30029
|
-
function isRecorderExecutable(fileName,
|
|
30030
|
-
const name2 =
|
|
30029
|
+
function isRecorderExecutable(fileName, platform2) {
|
|
30030
|
+
const name2 = platform2 === "win32" ? fileName.toLowerCase() : fileName;
|
|
30031
30031
|
return name2.startsWith(EXECUTABLE_NAMES.current.native) || name2.startsWith(EXECUTABLE_NAMES.legacy.native);
|
|
30032
30032
|
}
|
|
30033
|
-
function runtimeCommands(entry2 = process.argv[1], env = process.env, nodePath = process.execPath,
|
|
30034
|
-
const P =
|
|
30033
|
+
function runtimeCommands(entry2 = process.argv[1], env = process.env, nodePath = process.execPath, platform2 = process.platform, native = isNativeBuild(), exists = existsSync10) {
|
|
30034
|
+
const P = platform2 === "win32" ? win323 : posix3;
|
|
30035
30035
|
const { current, legacy } = EXECUTABLE_NAMES;
|
|
30036
30036
|
const holdsBundle = (dir) => exists(P.join(dir, current.daemon)) || exists(P.join(dir, legacy.daemon));
|
|
30037
30037
|
const named = env["TACHO_BIN_DIR"];
|
|
@@ -30046,19 +30046,19 @@ function runtimeCommands(entry2 = process.argv[1], env = process.env, nodePath =
|
|
|
30046
30046
|
else binDir = resolve4(here, "..", "..", "bin");
|
|
30047
30047
|
}
|
|
30048
30048
|
}
|
|
30049
|
-
const nativeCurrent = P.join(binDir, exeName(current.native,
|
|
30050
|
-
const nativeLegacy = P.join(binDir, exeName(legacy.native,
|
|
30049
|
+
const nativeCurrent = P.join(binDir, exeName(current.native, platform2));
|
|
30050
|
+
const nativeLegacy = P.join(binDir, exeName(legacy.native, platform2));
|
|
30051
30051
|
const nativeLayout = native || (exists(nativeCurrent) || exists(nativeLegacy)) && !holdsBundle(binDir);
|
|
30052
30052
|
if (nativeLayout) {
|
|
30053
30053
|
const running = P.basename(nodePath);
|
|
30054
|
-
const found = exists(nativeCurrent) ? nativeCurrent : exists(nativeLegacy) ? nativeLegacy : native && isRecorderExecutable(running,
|
|
30055
|
-
const recorder = found !== void 0 ? stableExecutablePath(found,
|
|
30054
|
+
const found = exists(nativeCurrent) ? nativeCurrent : exists(nativeLegacy) ? nativeLegacy : native && isRecorderExecutable(running, platform2) && named === void 0 ? nodePath : void 0;
|
|
30055
|
+
const recorder = found !== void 0 ? stableExecutablePath(found, platform2, exists) : nativeCurrent;
|
|
30056
30056
|
const dir = P.dirname(recorder);
|
|
30057
30057
|
const transient2 = transientBinDir(dir, env);
|
|
30058
|
-
const missing = exeName(current.native,
|
|
30058
|
+
const missing = exeName(current.native, platform2);
|
|
30059
30059
|
return {
|
|
30060
|
-
hookCommand: `${shellQuote2(recorder,
|
|
30061
|
-
credentialHelperCommand: helperCommandFor(shellQuote2(recorder,
|
|
30060
|
+
hookCommand: `${shellQuote2(recorder, platform2)} hook`,
|
|
30061
|
+
credentialHelperCommand: helperCommandFor(shellQuote2(recorder, platform2)),
|
|
30062
30062
|
daemonCommand: [recorder, "daemon"],
|
|
30063
30063
|
mcpStdioCommand: [recorder, "mcp-stdio"],
|
|
30064
30064
|
binDir: dir,
|
|
@@ -30071,11 +30071,11 @@ function runtimeCommands(entry2 = process.argv[1], env = process.env, nodePath =
|
|
|
30071
30071
|
const files2 = exists(P.join(binDir, legacy.daemon)) && !exists(P.join(binDir, current.daemon)) ? legacy : current;
|
|
30072
30072
|
const transient = transientBinDir(binDir, env);
|
|
30073
30073
|
const flagged = transient !== void 0 ? { transient } : {};
|
|
30074
|
-
const node2 = stableExecutablePath(nodePath,
|
|
30074
|
+
const node2 = stableExecutablePath(nodePath, platform2, exists);
|
|
30075
30075
|
return {
|
|
30076
|
-
hookCommand: `${shellQuote2(node2,
|
|
30076
|
+
hookCommand: `${shellQuote2(node2, platform2)} ${shellQuote2(P.join(binDir, files2.hook), platform2)}`,
|
|
30077
30077
|
credentialHelperCommand: helperCommandFor(
|
|
30078
|
-
`${shellQuote2(node2,
|
|
30078
|
+
`${shellQuote2(node2, platform2)} ${shellQuote2(P.join(binDir, files2.cli), platform2)}`
|
|
30079
30079
|
),
|
|
30080
30080
|
daemonCommand: [node2, P.join(binDir, files2.daemon)],
|
|
30081
30081
|
mcpStdioCommand: [node2, P.join(binDir, files2.cli), "mcp-stdio"],
|
|
@@ -30083,27 +30083,27 @@ function runtimeCommands(entry2 = process.argv[1], env = process.env, nodePath =
|
|
|
30083
30083
|
...flagged
|
|
30084
30084
|
};
|
|
30085
30085
|
}
|
|
30086
|
-
function oxagenRuntimeCommands(entry2 = process.argv[1], env = process.env, nodePath = process.execPath,
|
|
30087
|
-
const P =
|
|
30086
|
+
function oxagenRuntimeCommands(entry2 = process.argv[1], env = process.env, nodePath = process.execPath, platform2 = process.platform, native = isNativeBuild(), exists = existsSync10) {
|
|
30087
|
+
const P = platform2 === "win32" ? win323 : posix3;
|
|
30088
30088
|
const named = env["TACHO_BIN_DIR"];
|
|
30089
30089
|
let prefix;
|
|
30090
30090
|
let executableProblem;
|
|
30091
30091
|
if (named !== void 0) {
|
|
30092
|
-
const executable = P.join(named, exeName("oxagen",
|
|
30092
|
+
const executable = P.join(named, exeName("oxagen", platform2));
|
|
30093
30093
|
prefix = [executable];
|
|
30094
30094
|
if (!exists(executable))
|
|
30095
|
-
executableProblem = `TACHO_BIN_DIR names ${named}, which holds no ${exeName("oxagen",
|
|
30095
|
+
executableProblem = `TACHO_BIN_DIR names ${named}, which holds no ${exeName("oxagen", platform2)}`;
|
|
30096
30096
|
} else if (native) {
|
|
30097
|
-
prefix = [stableExecutablePath(nodePath,
|
|
30097
|
+
prefix = [stableExecutablePath(nodePath, platform2, exists)];
|
|
30098
30098
|
} else if (entry2 !== void 0 && !/\.[cm]?tsx?$/.test(entry2)) {
|
|
30099
30099
|
prefix = [
|
|
30100
|
-
stableExecutablePath(nodePath,
|
|
30100
|
+
stableExecutablePath(nodePath, platform2, exists),
|
|
30101
30101
|
P.resolve(entry2)
|
|
30102
30102
|
];
|
|
30103
30103
|
} else {
|
|
30104
|
-
return runtimeCommands(void 0, env, nodePath,
|
|
30104
|
+
return runtimeCommands(void 0, env, nodePath, platform2, false, exists);
|
|
30105
30105
|
}
|
|
30106
|
-
const line = prefix.map((word2) => shellQuote2(word2,
|
|
30106
|
+
const line = prefix.map((word2) => shellQuote2(word2, platform2)).join(" ");
|
|
30107
30107
|
const binDir = P.dirname(prefix[prefix.length - 1]);
|
|
30108
30108
|
const transient = transientBinDir(binDir, env);
|
|
30109
30109
|
return {
|
|
@@ -30137,8 +30137,8 @@ function realExec(command2, args) {
|
|
|
30137
30137
|
function realExecLong(command2, args) {
|
|
30138
30138
|
return spawnCapture(command2, args, EXEC_LONG_TIMEOUT_MS);
|
|
30139
30139
|
}
|
|
30140
|
-
function wellKnownBinDirs(home,
|
|
30141
|
-
if (
|
|
30140
|
+
function wellKnownBinDirs(home, platform2, env = {}) {
|
|
30141
|
+
if (platform2 === "win32") {
|
|
30142
30142
|
const appData = env["APPDATA"] ?? `${home}\\AppData\\Roaming`;
|
|
30143
30143
|
const local = env["LOCALAPPDATA"] ?? `${home}\\AppData\\Local`;
|
|
30144
30144
|
return [
|
|
@@ -30173,9 +30173,9 @@ function whereExecutable(result2) {
|
|
|
30173
30173
|
function shellExecutable(result2) {
|
|
30174
30174
|
return outputLines(result2).reverse().find((line) => line.startsWith("/"));
|
|
30175
30175
|
}
|
|
30176
|
-
function harnessFacts(exec4, name2,
|
|
30176
|
+
function harnessFacts(exec4, name2, platform2 = process.platform, env = process.env, home = env["HOME"] ?? env["USERPROFILE"] ?? "", exists = existsSync10) {
|
|
30177
30177
|
let path2;
|
|
30178
|
-
if (
|
|
30178
|
+
if (platform2 === "win32") {
|
|
30179
30179
|
path2 = whereExecutable(exec4("where", [name2]));
|
|
30180
30180
|
} else {
|
|
30181
30181
|
const shell = env["SHELL"];
|
|
@@ -30184,9 +30184,9 @@ function harnessFacts(exec4, name2, platform = process.platform, env = process.e
|
|
|
30184
30184
|
path2 ??= shellExecutable(exec4("sh", ["-lc", `command -v ${name2}`]));
|
|
30185
30185
|
}
|
|
30186
30186
|
if (path2 === void 0) {
|
|
30187
|
-
const sep14 =
|
|
30188
|
-
const names2 =
|
|
30189
|
-
outer: for (const dir of wellKnownBinDirs(home,
|
|
30187
|
+
const sep14 = platform2 === "win32" ? "\\" : "/";
|
|
30188
|
+
const names2 = platform2 === "win32" ? [`${name2}.exe`, `${name2}.cmd`] : [name2];
|
|
30189
|
+
outer: for (const dir of wellKnownBinDirs(home, platform2, env)) {
|
|
30190
30190
|
for (const file of names2) {
|
|
30191
30191
|
const candidate = `${dir}${sep14}${file}`;
|
|
30192
30192
|
if (exists(candidate)) {
|
|
@@ -30201,8 +30201,8 @@ function harnessFacts(exec4, name2, platform = process.platform, env = process.e
|
|
|
30201
30201
|
const match = /(\d+\.\d+\.\d+)/.exec(version3.stdout);
|
|
30202
30202
|
return { path: path2, ...match?.[1] !== void 0 ? { version: match[1] } : {} };
|
|
30203
30203
|
}
|
|
30204
|
-
function claudeDesktopFacts(
|
|
30205
|
-
const candidates =
|
|
30204
|
+
function claudeDesktopFacts(platform2 = process.platform, home = homedir3(), env = process.env, exists = existsSync10) {
|
|
30205
|
+
const candidates = platform2 === "darwin" ? ["/Applications/Claude.app", `${home}/Applications/Claude.app`] : platform2 === "win32" ? [
|
|
30206
30206
|
`${env["LOCALAPPDATA"] ?? `${home}\\AppData\\Local`}\\AnthropicClaude`,
|
|
30207
30207
|
`${env["LOCALAPPDATA"] ?? `${home}\\AppData\\Local`}\\Programs\\Claude`
|
|
30208
30208
|
] : [];
|
|
@@ -30211,26 +30211,26 @@ function claudeDesktopFacts(platform = process.platform, home = homedir3(), env
|
|
|
30211
30211
|
}
|
|
30212
30212
|
return { installed: false };
|
|
30213
30213
|
}
|
|
30214
|
-
function cursorAppFacts(
|
|
30214
|
+
function cursorAppFacts(platform2 = process.platform, home = homedir3(), env = process.env, exists = existsSync10) {
|
|
30215
30215
|
const local = env["LOCALAPPDATA"] ?? `${home}\\AppData\\Local`;
|
|
30216
30216
|
const programs = env["PROGRAMFILES"] ?? "C:\\Program Files";
|
|
30217
|
-
const candidates =
|
|
30217
|
+
const candidates = platform2 === "darwin" ? ["/Applications/Cursor.app", `${home}/Applications/Cursor.app`] : platform2 === "win32" ? [`${local}\\Programs\\cursor`, `${programs}\\Cursor`] : [];
|
|
30218
30218
|
for (const candidate of candidates) {
|
|
30219
30219
|
if (exists(candidate)) return { installed: true, path: candidate };
|
|
30220
30220
|
}
|
|
30221
30221
|
return { installed: false };
|
|
30222
30222
|
}
|
|
30223
|
-
function cursorFacts(exec4,
|
|
30224
|
-
const app = exists === void 0 ? cursorAppFacts(
|
|
30223
|
+
function cursorFacts(exec4, platform2 = process.platform, env = process.env, home, exists) {
|
|
30224
|
+
const app = exists === void 0 ? cursorAppFacts(platform2, home, env) : cursorAppFacts(platform2, home ?? homedir3(), env, exists);
|
|
30225
30225
|
const found = app.installed ? { app } : {};
|
|
30226
30226
|
for (const name2 of CURSOR_CLI_NAMES) {
|
|
30227
|
-
const facts = exists === void 0 ? harnessFacts(exec4, name2,
|
|
30227
|
+
const facts = exists === void 0 ? harnessFacts(exec4, name2, platform2, env, home) : harnessFacts(exec4, name2, platform2, env, home, exists);
|
|
30228
30228
|
if (facts.version !== void 0) return { ...facts, ...found };
|
|
30229
30229
|
}
|
|
30230
30230
|
return found;
|
|
30231
30231
|
}
|
|
30232
|
-
function claudeFacts(exec4,
|
|
30233
|
-
return harnessFacts(exec4, "claude",
|
|
30232
|
+
function claudeFacts(exec4, platform2 = process.platform, env = process.env, home) {
|
|
30233
|
+
return harnessFacts(exec4, "claude", platform2, env, home);
|
|
30234
30234
|
}
|
|
30235
30235
|
function settleOrThrow(harnessFiles) {
|
|
30236
30236
|
const outcomes = harnessFiles.settle();
|
|
@@ -30306,14 +30306,14 @@ function defaultCliDeps(overrides = {}, managed = {}) {
|
|
|
30306
30306
|
const env = overrides.env ?? process.env;
|
|
30307
30307
|
const home = overrides.home ?? homedir3();
|
|
30308
30308
|
const exec4 = overrides.exec ?? realExec;
|
|
30309
|
-
const
|
|
30310
|
-
const claudeManaged = managed.claude ?? claudeManagedSettingsPath(
|
|
30309
|
+
const platform2 = overrides.platform ?? process.platform;
|
|
30310
|
+
const claudeManaged = managed.claude ?? claudeManagedSettingsPath(platform2);
|
|
30311
30311
|
const baseUrlInternals = {
|
|
30312
30312
|
managedSettingsFile: claudeManaged,
|
|
30313
30313
|
...managed.stella !== void 0 ? { stellaManagedSettingsFile: managed.stella } : {}
|
|
30314
30314
|
};
|
|
30315
30315
|
const credentialInternals = { managedSettingsFile: claudeManaged };
|
|
30316
|
-
const paths = overrides.paths ?? defaultAgentPaths(tachoHome(env, home,
|
|
30316
|
+
const paths = overrides.paths ?? defaultAgentPaths(tachoHome(env, home, platform2));
|
|
30317
30317
|
const harnessFiles = new HarnessFiles(paths.dir);
|
|
30318
30318
|
const harnessDirs = {
|
|
30319
30319
|
claudeConfigDir: dirname10(paths.claudeSettings),
|
|
@@ -30367,7 +30367,7 @@ function defaultCliDeps(overrides = {}, managed = {}) {
|
|
|
30367
30367
|
paths,
|
|
30368
30368
|
env,
|
|
30369
30369
|
home,
|
|
30370
|
-
platform,
|
|
30370
|
+
platform: platform2,
|
|
30371
30371
|
fetch: async (input, init) => {
|
|
30372
30372
|
const response = await fetch(input, init);
|
|
30373
30373
|
return {
|
|
@@ -30383,7 +30383,7 @@ function defaultCliDeps(overrides = {}, managed = {}) {
|
|
|
30383
30383
|
// Resolved per call: `codex` may be installed between one command and
|
|
30384
30384
|
// the next, and the probe is cheap next to spawning the server.
|
|
30385
30385
|
codexAppServerClient({
|
|
30386
|
-
binary: harnessFacts(exec4, "codex",
|
|
30386
|
+
binary: harnessFacts(exec4, "codex", platform2, env, home).path ?? "codex",
|
|
30387
30387
|
cwd: process.cwd(),
|
|
30388
30388
|
env,
|
|
30389
30389
|
// The name sent in the app server's `initialize` request. Another
|
|
@@ -30393,7 +30393,7 @@ function defaultCliDeps(overrides = {}, managed = {}) {
|
|
|
30393
30393
|
})(requests)
|
|
30394
30394
|
),
|
|
30395
30395
|
serviceManager: serviceManagerFor({
|
|
30396
|
-
platform,
|
|
30396
|
+
platform: platform2,
|
|
30397
30397
|
home,
|
|
30398
30398
|
exec: exec4,
|
|
30399
30399
|
launcherPath: paths.daemonLauncher,
|
|
@@ -30503,7 +30503,7 @@ function defaultCliDeps(overrides = {}, managed = {}) {
|
|
|
30503
30503
|
const payload = JSON.stringify(body2);
|
|
30504
30504
|
try {
|
|
30505
30505
|
return await postUnix({
|
|
30506
|
-
...
|
|
30506
|
+
...platform2 === "win32" ? { loopbackPort: host.port } : { socketPath: paths.socket },
|
|
30507
30507
|
path: path2,
|
|
30508
30508
|
headers: { Authorization: `Bearer ${host.local_token}` },
|
|
30509
30509
|
body: payload,
|
|
@@ -30527,7 +30527,7 @@ function defaultCliDeps(overrides = {}, managed = {}) {
|
|
|
30527
30527
|
};
|
|
30528
30528
|
const req = httpRequest(
|
|
30529
30529
|
{
|
|
30530
|
-
...
|
|
30530
|
+
...platform2 === "win32" ? { host: "127.0.0.1", port: host.port } : { socketPath: paths.socket },
|
|
30531
30531
|
path: path2,
|
|
30532
30532
|
method: "POST",
|
|
30533
30533
|
agent: false,
|
|
@@ -30561,13 +30561,13 @@ function defaultCliDeps(overrides = {}, managed = {}) {
|
|
|
30561
30561
|
req.end(payload);
|
|
30562
30562
|
});
|
|
30563
30563
|
},
|
|
30564
|
-
claude: () => claudeFacts(exec4,
|
|
30565
|
-
codex: () => harnessFacts(exec4, "codex",
|
|
30566
|
-
cursor: () => cursorFacts(exec4,
|
|
30567
|
-
cursorEditor: () => cursorAppFacts(
|
|
30568
|
-
stella: () => harnessFacts(exec4, "stella",
|
|
30569
|
-
claudeDesktop: () => claudeDesktopFacts(
|
|
30570
|
-
runtime: runtimeCommands(void 0, env, void 0,
|
|
30564
|
+
claude: () => claudeFacts(exec4, platform2, env, home),
|
|
30565
|
+
codex: () => harnessFacts(exec4, "codex", platform2, env, home),
|
|
30566
|
+
cursor: () => cursorFacts(exec4, platform2, env, home),
|
|
30567
|
+
cursorEditor: () => cursorAppFacts(platform2, home, env),
|
|
30568
|
+
stella: () => harnessFacts(exec4, "stella", platform2, env, home),
|
|
30569
|
+
claudeDesktop: () => claudeDesktopFacts(platform2, home, env),
|
|
30570
|
+
runtime: runtimeCommands(void 0, env, void 0, platform2),
|
|
30571
30571
|
daemonGet,
|
|
30572
30572
|
findFreePort: () => new Promise((resolvePromise, reject) => {
|
|
30573
30573
|
const server = createServer();
|
|
@@ -31297,7 +31297,7 @@ function createControlClient(options) {
|
|
|
31297
31297
|
const timeoutMs = options.timeoutMs ?? 15e3;
|
|
31298
31298
|
const ingestTimeoutMs = options.ingestTimeoutMs ?? TACHO_INGEST_TIMEOUT_MS;
|
|
31299
31299
|
const nowMs = options.now ?? Date.now;
|
|
31300
|
-
async function
|
|
31300
|
+
async function post3(url2, body2, boundMs = timeoutMs, method = "POST", extraHeaders = {}) {
|
|
31301
31301
|
const controller = new AbortController();
|
|
31302
31302
|
const timer = setTimeout(() => controller.abort(), boundMs);
|
|
31303
31303
|
const signal = options.signal === void 0 ? controller.signal : AbortSignal.any([controller.signal, options.signal]);
|
|
@@ -31351,7 +31351,7 @@ function createControlClient(options) {
|
|
|
31351
31351
|
}
|
|
31352
31352
|
async function call2(url2, schema, body2, boundMs, method = "POST", extraHeaders) {
|
|
31353
31353
|
const parsed2 = schema.safeParse(
|
|
31354
|
-
await
|
|
31354
|
+
await post3(url2, body2, boundMs, method, extraHeaders)
|
|
31355
31355
|
);
|
|
31356
31356
|
if (!parsed2.success)
|
|
31357
31357
|
throw new ControlAnswerUnreadable(url2, zodIssues(parsed2.error));
|
|
@@ -36998,8 +36998,8 @@ async function abandonAddition(revoked, addition, options, deps, warnings) {
|
|
|
36998
36998
|
async function enrollSteps(options, deps, addition) {
|
|
36999
36999
|
const warnings = [];
|
|
37000
37000
|
const step = (n2, text6) => deps.out(`[${n2}/6] ${text6}`);
|
|
37001
|
-
const
|
|
37002
|
-
if (!
|
|
37001
|
+
const platform2 = tachoPlatformSchema.safeParse(deps.platform);
|
|
37002
|
+
if (!platform2.success) {
|
|
37003
37003
|
deps.err(
|
|
37004
37004
|
`Oxagen agents run on macOS, Linux and Windows, and this machine reports ${deps.platform}, so nothing was enrolled.`
|
|
37005
37005
|
);
|
|
@@ -37242,7 +37242,8 @@ ${problems.map((problem) => ` ${problem}`).join("\n")}`
|
|
|
37242
37242
|
token: options.enrollmentToken,
|
|
37243
37243
|
...facts,
|
|
37244
37244
|
deviceKeyProof,
|
|
37245
|
-
...remote !== void 0 ? { repositoryRemote: remote } : {}
|
|
37245
|
+
...remote !== void 0 ? { repositoryRemote: remote } : {},
|
|
37246
|
+
...options.machineId !== void 0 ? { machineId: options.machineId } : {}
|
|
37246
37247
|
});
|
|
37247
37248
|
response = answer;
|
|
37248
37249
|
agentId = answer.agentId;
|
|
@@ -37351,7 +37352,7 @@ ${problems.map((problem) => ` ${problem}`).join("\n")}`
|
|
|
37351
37352
|
local_token: existing?.local_token ?? deps.randomToken(),
|
|
37352
37353
|
hostname: deps.hostname,
|
|
37353
37354
|
os_user: deps.osUser,
|
|
37354
|
-
platform:
|
|
37355
|
+
platform: platform2.data,
|
|
37355
37356
|
harnesses,
|
|
37356
37357
|
managed,
|
|
37357
37358
|
claude_version: claude.version ?? null,
|
|
@@ -38985,10 +38986,10 @@ import {
|
|
|
38985
38986
|
unlinkSync as unlinkSync11
|
|
38986
38987
|
} from "node:fs";
|
|
38987
38988
|
import { dirname as dirname16, isAbsolute as isAbsolute2, join as join26, relative, resolve as resolve7, sep } from "node:path";
|
|
38988
|
-
function dataLocalDir(home, env,
|
|
38989
|
-
if (
|
|
38989
|
+
function dataLocalDir(home, env, platform2) {
|
|
38990
|
+
if (platform2 === "darwin")
|
|
38990
38991
|
return join26(home, "Library", "Application Support");
|
|
38991
|
-
if (
|
|
38992
|
+
if (platform2 === "win32")
|
|
38992
38993
|
return env["LOCALAPPDATA"] ?? join26(home, "AppData", "Local");
|
|
38993
38994
|
const xdg = env["XDG_DATA_HOME"];
|
|
38994
38995
|
return xdg !== void 0 && isAbsolute2(xdg) ? xdg : join26(home, ".local", "share");
|
|
@@ -39276,10 +39277,10 @@ function journaledCopies(journal, copies, tally2) {
|
|
|
39276
39277
|
}
|
|
39277
39278
|
return dirs;
|
|
39278
39279
|
}
|
|
39279
|
-
function removeSidecars(dir,
|
|
39280
|
-
const note =
|
|
39280
|
+
function removeSidecars(dir, platform2, tally2) {
|
|
39281
|
+
const note = platform2 === "win32" ? `. Windows keeps a running program's file, so delete ${dir} after this command exits` : "";
|
|
39281
39282
|
for (const name2 of ["oxagen", "recorder", "tacho", "codegraph"]) {
|
|
39282
|
-
const file = join26(dir,
|
|
39283
|
+
const file = join26(dir, platform2 === "win32" ? `${name2}.exe` : name2);
|
|
39283
39284
|
removeFile(file, tally2, note);
|
|
39284
39285
|
}
|
|
39285
39286
|
}
|
|
@@ -43344,7 +43345,7 @@ function createContainedRunner(options) {
|
|
|
43344
43345
|
...payload
|
|
43345
43346
|
}
|
|
43346
43347
|
});
|
|
43347
|
-
const
|
|
43348
|
+
const release3 = () => {
|
|
43348
43349
|
signal?.removeEventListener("abort", abort);
|
|
43349
43350
|
if (sessionUuid2) active2.delete(sessionUuid2);
|
|
43350
43351
|
if (launchedSessionId) {
|
|
@@ -43427,7 +43428,7 @@ function createContainedRunner(options) {
|
|
|
43427
43428
|
await end(sessionId, { reason: "other", exit_code: exitCode });
|
|
43428
43429
|
}
|
|
43429
43430
|
});
|
|
43430
|
-
return { ...run3, exited: run3.exited.finally(
|
|
43431
|
+
return { ...run3, exited: run3.exited.finally(release3) };
|
|
43431
43432
|
} catch (error2) {
|
|
43432
43433
|
if (opened && !ended && launchedSessionId !== void 0) {
|
|
43433
43434
|
try {
|
|
@@ -43438,7 +43439,7 @@ function createContainedRunner(options) {
|
|
|
43438
43439
|
);
|
|
43439
43440
|
}
|
|
43440
43441
|
}
|
|
43441
|
-
|
|
43442
|
+
release3();
|
|
43442
43443
|
throw error2;
|
|
43443
43444
|
}
|
|
43444
43445
|
}
|
|
@@ -46739,6 +46740,283 @@ var init_git_lane = __esm({
|
|
|
46739
46740
|
}
|
|
46740
46741
|
});
|
|
46741
46742
|
|
|
46743
|
+
// ../../packages/tacho/src/interjection.ts
|
|
46744
|
+
var digest4, timestamp, count5, configVersion, workspaceSlug, interjectionKeySchema, INTERJECTION_RECEIPT_ID_PATTERN, INTERJECTION_QUESTION_MAX, INTERJECTION_OPEN, INTERJECTION_PATHS, INTERJECTION_ANSWER_SOURCES, SKILLS_RESOLVED_REASONS, repoUnknownBodySchema, interjectLinkPathSchema, interjectCreatePathSchema, INTERJECT_PROVIDERS, interjectBodySchema, answerBodySchema, repoBoundBodySchema, workspaceCreatedBodySchema, skillsResolvedBodySchema, interjectionAnswerPayloadSchema;
|
|
46745
|
+
var init_interjection = __esm({
|
|
46746
|
+
"../../packages/tacho/src/interjection.ts"() {
|
|
46747
|
+
"use strict";
|
|
46748
|
+
init_zod();
|
|
46749
|
+
init_digest();
|
|
46750
|
+
init_timestamp();
|
|
46751
|
+
digest4 = external_exports.string().regex(SHA256_DIGEST_PATTERN);
|
|
46752
|
+
timestamp = external_exports.string().refine(isProtocolTimestamp, "protocol timestamp");
|
|
46753
|
+
count5 = external_exports.number().int().nonnegative();
|
|
46754
|
+
configVersion = external_exports.string().min(1).max(64).nullable();
|
|
46755
|
+
workspaceSlug = external_exports.string().min(1).max(64);
|
|
46756
|
+
interjectionKeySchema = external_exports.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/, "a ULID");
|
|
46757
|
+
INTERJECTION_RECEIPT_ID_PATTERN = /^rcp_[0-9a-z]+$/;
|
|
46758
|
+
INTERJECTION_QUESTION_MAX = 2e3;
|
|
46759
|
+
INTERJECTION_OPEN = "interjection_open";
|
|
46760
|
+
INTERJECTION_PATHS = ["link", "create", "deny"];
|
|
46761
|
+
INTERJECTION_ANSWER_SOURCES = ["person", "timeout"];
|
|
46762
|
+
SKILLS_RESOLVED_REASONS = [
|
|
46763
|
+
"skills_off",
|
|
46764
|
+
"denied",
|
|
46765
|
+
"resolved"
|
|
46766
|
+
];
|
|
46767
|
+
repoUnknownBodySchema = external_exports.object({
|
|
46768
|
+
/** sha256 of `canonicalRemote(origin)`; the remote itself never leaves the host. */
|
|
46769
|
+
remote_digest: digest4,
|
|
46770
|
+
/** sha256 of `foldedRemote(canonicalRemote(origin))`; absent when the host does not fold. */
|
|
46771
|
+
remote_digest_folded: digest4.optional(),
|
|
46772
|
+
head_sha: external_exports.string().max(512).optional(),
|
|
46773
|
+
/** The bundle asked only because the workspace has skills on. */
|
|
46774
|
+
skills_enabled: external_exports.literal(true),
|
|
46775
|
+
/** The bundle's `unbound_repo.policy`. */
|
|
46776
|
+
unbound_repo: external_exports.literal("ask"),
|
|
46777
|
+
/** The skills configuration the bundle carried; null when none was named. */
|
|
46778
|
+
config_version: configVersion
|
|
46779
|
+
}).strict();
|
|
46780
|
+
interjectLinkPathSchema = external_exports.object({
|
|
46781
|
+
path: external_exports.literal("link"),
|
|
46782
|
+
workspace_slug: workspaceSlug,
|
|
46783
|
+
config_version: configVersion,
|
|
46784
|
+
/** Skills the workspace's configuration pins; null when not counted. */
|
|
46785
|
+
skills_pinned: count5.nullable(),
|
|
46786
|
+
/** Repositories the workspace already links; null when not counted. */
|
|
46787
|
+
linked_repositories: count5.nullable()
|
|
46788
|
+
}).strict();
|
|
46789
|
+
interjectCreatePathSchema = external_exports.object({
|
|
46790
|
+
path: external_exports.literal("create"),
|
|
46791
|
+
/** From the repository's name; null when the host could not read one. */
|
|
46792
|
+
proposed_name: external_exports.string().min(1).max(120).nullable(),
|
|
46793
|
+
proposed_slug: workspaceSlug.nullable(),
|
|
46794
|
+
skills_enabled: external_exports.literal(false)
|
|
46795
|
+
}).strict();
|
|
46796
|
+
INTERJECT_PROVIDERS = ["github", "gitlab"];
|
|
46797
|
+
interjectBodySchema = external_exports.object({
|
|
46798
|
+
interjection_key: interjectionKeySchema,
|
|
46799
|
+
reason: external_exports.literal("repo_unknown"),
|
|
46800
|
+
question: external_exports.string().min(1).max(INTERJECTION_QUESTION_MAX),
|
|
46801
|
+
remote_digest: digest4,
|
|
46802
|
+
remote_digest_folded: digest4.optional(),
|
|
46803
|
+
/** How long the host waits, from the bundle's `unbound_repo.timeout_ms`. */
|
|
46804
|
+
timeout_ms: external_exports.number().int().positive(),
|
|
46805
|
+
/** The host's clock plus `timeout_ms`. The control plane keeps its own deadline. */
|
|
46806
|
+
expires_at: timestamp,
|
|
46807
|
+
/** What the timeout answers. */
|
|
46808
|
+
on_timeout: external_exports.literal("deny"),
|
|
46809
|
+
/** The two paths a person can take, link first. Deny needs no path. */
|
|
46810
|
+
paths: external_exports.tuple([interjectLinkPathSchema, interjectCreatePathSchema]),
|
|
46811
|
+
/**
|
|
46812
|
+
* The forge the remote's host names (#4439): `github` for github.com and
|
|
46813
|
+
* `gitlab` for gitlab.com. Absent for any other host, and from a host
|
|
46814
|
+
* built before the field, which the control plane reads as GitHub. The
|
|
46815
|
+
* host string itself stays on the machine. A GitLab project binds through
|
|
46816
|
+
* its own project access token, so the control plane offers no link for
|
|
46817
|
+
* a `gitlab` question.
|
|
46818
|
+
*/
|
|
46819
|
+
provider: external_exports.enum(INTERJECT_PROVIDERS).optional()
|
|
46820
|
+
}).strict();
|
|
46821
|
+
answerBodySchema = external_exports.object({
|
|
46822
|
+
interjection_key: interjectionKeySchema,
|
|
46823
|
+
/** The control plane's row (`inj_…`); absent on a timeout the host answered alone. */
|
|
46824
|
+
interjection_id: external_exports.string().regex(/^inj_[0-9a-z]+$/).optional(),
|
|
46825
|
+
path: external_exports.enum(INTERJECTION_PATHS),
|
|
46826
|
+
source: external_exports.enum(INTERJECTION_ANSWER_SOURCES),
|
|
46827
|
+
/** The receipt the control plane recorded; absent on a host-side timeout. */
|
|
46828
|
+
receipt_id: external_exports.string().regex(INTERJECTION_RECEIPT_ID_PATTERN).optional(),
|
|
46829
|
+
/** The person who answered (`usr_…`); absent on a timeout. */
|
|
46830
|
+
answered_by: external_exports.string().regex(/^usr_[0-9a-z]+$/).optional(),
|
|
46831
|
+
/** The `message` command that carried the answer (`tcm_…`). */
|
|
46832
|
+
command_id: external_exports.string().regex(/^tcm_[0-9a-z]+$/).optional()
|
|
46833
|
+
}).strict();
|
|
46834
|
+
repoBoundBodySchema = external_exports.object({
|
|
46835
|
+
interjection_key: interjectionKeySchema,
|
|
46836
|
+
binding_id: external_exports.string().min(1).max(64),
|
|
46837
|
+
workspace_slug: workspaceSlug,
|
|
46838
|
+
role: external_exports.enum(["linked", "main"])
|
|
46839
|
+
}).strict();
|
|
46840
|
+
workspaceCreatedBodySchema = external_exports.object({
|
|
46841
|
+
interjection_key: interjectionKeySchema,
|
|
46842
|
+
workspace_id: external_exports.string().min(1).max(64),
|
|
46843
|
+
workspace_slug: workspaceSlug,
|
|
46844
|
+
skills_enabled: external_exports.literal(false)
|
|
46845
|
+
}).strict();
|
|
46846
|
+
skillsResolvedBodySchema = external_exports.object({
|
|
46847
|
+
/** The interjection that settled it; absent when no question was asked. */
|
|
46848
|
+
interjection_key: interjectionKeySchema.optional(),
|
|
46849
|
+
config_version: configVersion,
|
|
46850
|
+
/** Skills the session may load. */
|
|
46851
|
+
in_scope: count5,
|
|
46852
|
+
/** Skills the configuration holds back; null until the catalog read counts them (#3098). */
|
|
46853
|
+
withheld: count5.nullable(),
|
|
46854
|
+
reason: external_exports.enum(SKILLS_RESOLVED_REASONS)
|
|
46855
|
+
}).strict();
|
|
46856
|
+
interjectionAnswerPayloadSchema = external_exports.object({
|
|
46857
|
+
key: interjectionKeySchema,
|
|
46858
|
+
path: external_exports.enum(INTERJECTION_PATHS),
|
|
46859
|
+
source: external_exports.enum(INTERJECTION_ANSWER_SOURCES),
|
|
46860
|
+
receipt_id: external_exports.string().regex(INTERJECTION_RECEIPT_ID_PATTERN),
|
|
46861
|
+
/** The person who answered (`usr_…`); null on a timeout. */
|
|
46862
|
+
answered_by: external_exports.string().regex(/^usr_[0-9a-z]+$/).nullable(),
|
|
46863
|
+
/** Set on a link or create answer. */
|
|
46864
|
+
binding_id: external_exports.string().min(1).max(64).optional(),
|
|
46865
|
+
/** Set on a create answer. */
|
|
46866
|
+
workspace_id: external_exports.string().min(1).max(64).optional(),
|
|
46867
|
+
workspace_slug: workspaceSlug.optional()
|
|
46868
|
+
}).strict();
|
|
46869
|
+
}
|
|
46870
|
+
});
|
|
46871
|
+
|
|
46872
|
+
// ../../packages/tacho/src/loops.ts
|
|
46873
|
+
function isMcpTool(tool) {
|
|
46874
|
+
return tool.startsWith(MCP_TOOL_PREFIX) || tool.startsWith(CURSOR_MCP_TOOL_PREFIX);
|
|
46875
|
+
}
|
|
46876
|
+
function slotsOf(steps) {
|
|
46877
|
+
return steps.map((step) => "fileChanged" in step ? null : step);
|
|
46878
|
+
}
|
|
46879
|
+
function sameResult(a, b3) {
|
|
46880
|
+
return a.tool === b3.tool && a.inputHash === b3.inputHash && a.outputHash === b3.outputHash;
|
|
46881
|
+
}
|
|
46882
|
+
function sameFailure(a, b3) {
|
|
46883
|
+
return a.tool === b3.tool && a.inputHash === b3.inputHash && a.errorClass === b3.errorClass;
|
|
46884
|
+
}
|
|
46885
|
+
function hashed(c) {
|
|
46886
|
+
return c.inputHash !== "" && c.outputHash !== "";
|
|
46887
|
+
}
|
|
46888
|
+
function failed(c) {
|
|
46889
|
+
return c.inputHash !== "" && c.errorClass !== null && c.errorClass !== "";
|
|
46890
|
+
}
|
|
46891
|
+
function reaches(loop, length) {
|
|
46892
|
+
const calls = loop.positions.length;
|
|
46893
|
+
return "calls" in length ? calls >= length.calls : Math.floor(calls / loop.period) >= length.cycles;
|
|
46894
|
+
}
|
|
46895
|
+
function streaks(slots, kind, joins, matches2) {
|
|
46896
|
+
const out = [];
|
|
46897
|
+
let run3 = [];
|
|
46898
|
+
let positions = [];
|
|
46899
|
+
const close = () => {
|
|
46900
|
+
const first = run3[0];
|
|
46901
|
+
if (first !== void 0 && run3.length >= 2)
|
|
46902
|
+
out.push({ kind, positions, period: 1, tool: first.tool });
|
|
46903
|
+
run3 = [];
|
|
46904
|
+
positions = [];
|
|
46905
|
+
};
|
|
46906
|
+
slots.forEach((c, i2) => {
|
|
46907
|
+
if (c === null || !joins(c)) {
|
|
46908
|
+
close();
|
|
46909
|
+
return;
|
|
46910
|
+
}
|
|
46911
|
+
const last = run3.at(-1);
|
|
46912
|
+
if (last !== void 0 && !matches2(last, c)) close();
|
|
46913
|
+
run3.push(c);
|
|
46914
|
+
positions.push(i2);
|
|
46915
|
+
});
|
|
46916
|
+
close();
|
|
46917
|
+
return out;
|
|
46918
|
+
}
|
|
46919
|
+
function shortCycles(slots) {
|
|
46920
|
+
const out = [];
|
|
46921
|
+
const segments = [[]];
|
|
46922
|
+
slots.forEach((c, i2) => {
|
|
46923
|
+
if (c === null || !hashed(c)) segments.push([]);
|
|
46924
|
+
else segments.at(-1)?.push({ call: c, at: i2 });
|
|
46925
|
+
});
|
|
46926
|
+
for (const segment of segments) {
|
|
46927
|
+
const same = (k, period) => {
|
|
46928
|
+
const a = segment[k];
|
|
46929
|
+
const b3 = segment[k - period];
|
|
46930
|
+
return a !== void 0 && b3 !== void 0 && sameResult(a.call, b3.call);
|
|
46931
|
+
};
|
|
46932
|
+
for (let period = 2; period <= MAX_PERIOD; period += 1) {
|
|
46933
|
+
let k = period;
|
|
46934
|
+
while (k < segment.length) {
|
|
46935
|
+
if (!same(k, period)) {
|
|
46936
|
+
k += 1;
|
|
46937
|
+
continue;
|
|
46938
|
+
}
|
|
46939
|
+
const start = k - period;
|
|
46940
|
+
let end = k;
|
|
46941
|
+
while (same(end, period)) end += 1;
|
|
46942
|
+
const cycle2 = segment.slice(start, start + period).map((s2) => s2.call);
|
|
46943
|
+
const distinct = cycle2.every(
|
|
46944
|
+
(c, j) => cycle2.slice(j + 1).every((d) => !sameResult(c, d))
|
|
46945
|
+
);
|
|
46946
|
+
const first = cycle2[0];
|
|
46947
|
+
if (first !== void 0 && distinct && end - start >= 2 * period)
|
|
46948
|
+
out.push({
|
|
46949
|
+
kind: "short_cycle",
|
|
46950
|
+
positions: segment.slice(start, end).map((s2) => s2.at),
|
|
46951
|
+
period,
|
|
46952
|
+
tool: first.tool
|
|
46953
|
+
});
|
|
46954
|
+
k = end;
|
|
46955
|
+
}
|
|
46956
|
+
}
|
|
46957
|
+
}
|
|
46958
|
+
return out;
|
|
46959
|
+
}
|
|
46960
|
+
function stagnations(slots) {
|
|
46961
|
+
const out = [];
|
|
46962
|
+
const seen = /* @__PURE__ */ new Map();
|
|
46963
|
+
let run3 = [];
|
|
46964
|
+
let positions = [];
|
|
46965
|
+
const close = () => {
|
|
46966
|
+
const first = run3[0];
|
|
46967
|
+
const inputs = new Set(run3.map((c) => c.inputHash));
|
|
46968
|
+
if (first !== void 0 && run3.length >= 2 && inputs.size >= 2)
|
|
46969
|
+
out.push({ kind: "stagnation", positions, period: 1, tool: first.tool });
|
|
46970
|
+
run3 = [];
|
|
46971
|
+
positions = [];
|
|
46972
|
+
};
|
|
46973
|
+
slots.forEach((c, i2) => {
|
|
46974
|
+
if (c === null || !hashed(c)) {
|
|
46975
|
+
close();
|
|
46976
|
+
return;
|
|
46977
|
+
}
|
|
46978
|
+
const outputs = seen.get(c.tool) ?? /* @__PURE__ */ new Set();
|
|
46979
|
+
const repeated = outputs.has(c.outputHash);
|
|
46980
|
+
outputs.add(c.outputHash);
|
|
46981
|
+
seen.set(c.tool, outputs);
|
|
46982
|
+
if (c.mayWrite || isMcpTool(c.tool)) {
|
|
46983
|
+
close();
|
|
46984
|
+
return;
|
|
46985
|
+
}
|
|
46986
|
+
const first = run3[0];
|
|
46987
|
+
if (first !== void 0 && (first.tool !== c.tool || !repeated)) close();
|
|
46988
|
+
run3.push(c);
|
|
46989
|
+
positions.push(i2);
|
|
46990
|
+
});
|
|
46991
|
+
close();
|
|
46992
|
+
return out;
|
|
46993
|
+
}
|
|
46994
|
+
function findLoops(steps, threshold) {
|
|
46995
|
+
const slots = slotsOf(steps);
|
|
46996
|
+
return [
|
|
46997
|
+
...streaks(slots, "exact_repeat", hashed, sameResult),
|
|
46998
|
+
...streaks(slots, "failing_retry", failed, sameFailure),
|
|
46999
|
+
...shortCycles(slots),
|
|
47000
|
+
...stagnations(slots)
|
|
47001
|
+
].filter((loop) => reaches(loop, threshold[loop.kind])).sort((a, b3) => (a.positions[0] ?? 0) - (b3.positions[0] ?? 0));
|
|
47002
|
+
}
|
|
47003
|
+
var LOOP_NOTICE_REASON_CODE, LOOP_START, MAX_PERIOD, MCP_TOOL_PREFIX, CURSOR_MCP_TOOL_PREFIX;
|
|
47004
|
+
var init_loops = __esm({
|
|
47005
|
+
"../../packages/tacho/src/loops.ts"() {
|
|
47006
|
+
"use strict";
|
|
47007
|
+
LOOP_NOTICE_REASON_CODE = "loop_notice";
|
|
47008
|
+
LOOP_START = {
|
|
47009
|
+
exact_repeat: { calls: 3 },
|
|
47010
|
+
failing_retry: { calls: 3 },
|
|
47011
|
+
short_cycle: { cycles: 3 },
|
|
47012
|
+
stagnation: { calls: 6 }
|
|
47013
|
+
};
|
|
47014
|
+
MAX_PERIOD = 3;
|
|
47015
|
+
MCP_TOOL_PREFIX = "mcp__";
|
|
47016
|
+
CURSOR_MCP_TOOL_PREFIX = "MCP:";
|
|
47017
|
+
}
|
|
47018
|
+
});
|
|
47019
|
+
|
|
46742
47020
|
// ../../packages/tacho/src/collector/steering-manifest.ts
|
|
46743
47021
|
function steeringManifestFrame(manifest, bundle2, delivered) {
|
|
46744
47022
|
const steers = delivered.map((prompt) => ({
|
|
@@ -47275,153 +47553,6 @@ var init_subagent_meta = __esm({
|
|
|
47275
47553
|
}
|
|
47276
47554
|
});
|
|
47277
47555
|
|
|
47278
|
-
// ../../packages/tacho/src/loops.ts
|
|
47279
|
-
function isMcpTool(tool) {
|
|
47280
|
-
return tool.startsWith(MCP_TOOL_PREFIX) || tool.startsWith(CURSOR_MCP_TOOL_PREFIX);
|
|
47281
|
-
}
|
|
47282
|
-
function slotsOf(steps) {
|
|
47283
|
-
return steps.map((step) => "fileChanged" in step ? null : step);
|
|
47284
|
-
}
|
|
47285
|
-
function sameResult(a, b3) {
|
|
47286
|
-
return a.tool === b3.tool && a.inputHash === b3.inputHash && a.outputHash === b3.outputHash;
|
|
47287
|
-
}
|
|
47288
|
-
function sameFailure(a, b3) {
|
|
47289
|
-
return a.tool === b3.tool && a.inputHash === b3.inputHash && a.errorClass === b3.errorClass;
|
|
47290
|
-
}
|
|
47291
|
-
function hashed(c) {
|
|
47292
|
-
return c.inputHash !== "" && c.outputHash !== "";
|
|
47293
|
-
}
|
|
47294
|
-
function failed(c) {
|
|
47295
|
-
return c.inputHash !== "" && c.errorClass !== null && c.errorClass !== "";
|
|
47296
|
-
}
|
|
47297
|
-
function reaches(loop, length) {
|
|
47298
|
-
const calls = loop.positions.length;
|
|
47299
|
-
return "calls" in length ? calls >= length.calls : Math.floor(calls / loop.period) >= length.cycles;
|
|
47300
|
-
}
|
|
47301
|
-
function streaks(slots, kind, joins, matches2) {
|
|
47302
|
-
const out = [];
|
|
47303
|
-
let run3 = [];
|
|
47304
|
-
let positions = [];
|
|
47305
|
-
const close = () => {
|
|
47306
|
-
const first = run3[0];
|
|
47307
|
-
if (first !== void 0 && run3.length >= 2)
|
|
47308
|
-
out.push({ kind, positions, period: 1, tool: first.tool });
|
|
47309
|
-
run3 = [];
|
|
47310
|
-
positions = [];
|
|
47311
|
-
};
|
|
47312
|
-
slots.forEach((c, i2) => {
|
|
47313
|
-
if (c === null || !joins(c)) {
|
|
47314
|
-
close();
|
|
47315
|
-
return;
|
|
47316
|
-
}
|
|
47317
|
-
const last = run3.at(-1);
|
|
47318
|
-
if (last !== void 0 && !matches2(last, c)) close();
|
|
47319
|
-
run3.push(c);
|
|
47320
|
-
positions.push(i2);
|
|
47321
|
-
});
|
|
47322
|
-
close();
|
|
47323
|
-
return out;
|
|
47324
|
-
}
|
|
47325
|
-
function shortCycles(slots) {
|
|
47326
|
-
const out = [];
|
|
47327
|
-
const segments = [[]];
|
|
47328
|
-
slots.forEach((c, i2) => {
|
|
47329
|
-
if (c === null || !hashed(c)) segments.push([]);
|
|
47330
|
-
else segments.at(-1)?.push({ call: c, at: i2 });
|
|
47331
|
-
});
|
|
47332
|
-
for (const segment of segments) {
|
|
47333
|
-
const same = (k, period) => {
|
|
47334
|
-
const a = segment[k];
|
|
47335
|
-
const b3 = segment[k - period];
|
|
47336
|
-
return a !== void 0 && b3 !== void 0 && sameResult(a.call, b3.call);
|
|
47337
|
-
};
|
|
47338
|
-
for (let period = 2; period <= MAX_PERIOD; period += 1) {
|
|
47339
|
-
let k = period;
|
|
47340
|
-
while (k < segment.length) {
|
|
47341
|
-
if (!same(k, period)) {
|
|
47342
|
-
k += 1;
|
|
47343
|
-
continue;
|
|
47344
|
-
}
|
|
47345
|
-
const start = k - period;
|
|
47346
|
-
let end = k;
|
|
47347
|
-
while (same(end, period)) end += 1;
|
|
47348
|
-
const cycle2 = segment.slice(start, start + period).map((s2) => s2.call);
|
|
47349
|
-
const distinct = cycle2.every(
|
|
47350
|
-
(c, j) => cycle2.slice(j + 1).every((d) => !sameResult(c, d))
|
|
47351
|
-
);
|
|
47352
|
-
const first = cycle2[0];
|
|
47353
|
-
if (first !== void 0 && distinct && end - start >= 2 * period)
|
|
47354
|
-
out.push({
|
|
47355
|
-
kind: "short_cycle",
|
|
47356
|
-
positions: segment.slice(start, end).map((s2) => s2.at),
|
|
47357
|
-
period,
|
|
47358
|
-
tool: first.tool
|
|
47359
|
-
});
|
|
47360
|
-
k = end;
|
|
47361
|
-
}
|
|
47362
|
-
}
|
|
47363
|
-
}
|
|
47364
|
-
return out;
|
|
47365
|
-
}
|
|
47366
|
-
function stagnations(slots) {
|
|
47367
|
-
const out = [];
|
|
47368
|
-
const seen = /* @__PURE__ */ new Map();
|
|
47369
|
-
let run3 = [];
|
|
47370
|
-
let positions = [];
|
|
47371
|
-
const close = () => {
|
|
47372
|
-
const first = run3[0];
|
|
47373
|
-
const inputs = new Set(run3.map((c) => c.inputHash));
|
|
47374
|
-
if (first !== void 0 && run3.length >= 2 && inputs.size >= 2)
|
|
47375
|
-
out.push({ kind: "stagnation", positions, period: 1, tool: first.tool });
|
|
47376
|
-
run3 = [];
|
|
47377
|
-
positions = [];
|
|
47378
|
-
};
|
|
47379
|
-
slots.forEach((c, i2) => {
|
|
47380
|
-
if (c === null || !hashed(c)) {
|
|
47381
|
-
close();
|
|
47382
|
-
return;
|
|
47383
|
-
}
|
|
47384
|
-
const outputs = seen.get(c.tool) ?? /* @__PURE__ */ new Set();
|
|
47385
|
-
const repeated = outputs.has(c.outputHash);
|
|
47386
|
-
outputs.add(c.outputHash);
|
|
47387
|
-
seen.set(c.tool, outputs);
|
|
47388
|
-
if (c.mayWrite || isMcpTool(c.tool)) {
|
|
47389
|
-
close();
|
|
47390
|
-
return;
|
|
47391
|
-
}
|
|
47392
|
-
const first = run3[0];
|
|
47393
|
-
if (first !== void 0 && (first.tool !== c.tool || !repeated)) close();
|
|
47394
|
-
run3.push(c);
|
|
47395
|
-
positions.push(i2);
|
|
47396
|
-
});
|
|
47397
|
-
close();
|
|
47398
|
-
return out;
|
|
47399
|
-
}
|
|
47400
|
-
function findLoops(steps, threshold) {
|
|
47401
|
-
const slots = slotsOf(steps);
|
|
47402
|
-
return [
|
|
47403
|
-
...streaks(slots, "exact_repeat", hashed, sameResult),
|
|
47404
|
-
...streaks(slots, "failing_retry", failed, sameFailure),
|
|
47405
|
-
...shortCycles(slots),
|
|
47406
|
-
...stagnations(slots)
|
|
47407
|
-
].filter((loop) => reaches(loop, threshold[loop.kind])).sort((a, b3) => (a.positions[0] ?? 0) - (b3.positions[0] ?? 0));
|
|
47408
|
-
}
|
|
47409
|
-
var LOOP_START, MAX_PERIOD, MCP_TOOL_PREFIX, CURSOR_MCP_TOOL_PREFIX;
|
|
47410
|
-
var init_loops = __esm({
|
|
47411
|
-
"../../packages/tacho/src/loops.ts"() {
|
|
47412
|
-
"use strict";
|
|
47413
|
-
LOOP_START = {
|
|
47414
|
-
exact_repeat: { calls: 3 },
|
|
47415
|
-
failing_retry: { calls: 3 },
|
|
47416
|
-
short_cycle: { cycles: 3 },
|
|
47417
|
-
stagnation: { calls: 6 }
|
|
47418
|
-
};
|
|
47419
|
-
MAX_PERIOD = 3;
|
|
47420
|
-
MCP_TOOL_PREFIX = "mcp__";
|
|
47421
|
-
CURSOR_MCP_TOOL_PREFIX = "MCP:";
|
|
47422
|
-
}
|
|
47423
|
-
});
|
|
47424
|
-
|
|
47425
47556
|
// ../../packages/tacho/src/collector/memory-capture/reflection-ask.ts
|
|
47426
47557
|
function stateOf(record2) {
|
|
47427
47558
|
let state = states.get(record2);
|
|
@@ -47828,7 +47959,7 @@ function loopNoticeBody(notice, boundary) {
|
|
|
47828
47959
|
...notice.callSeq !== void 0 ? { call_seq: notice.callSeq } : {}
|
|
47829
47960
|
};
|
|
47830
47961
|
}
|
|
47831
|
-
var NOTICED_LOOP_KINDS, LOOP_NOTICE_BOUNDARIES,
|
|
47962
|
+
var NOTICED_LOOP_KINDS, LOOP_NOTICE_BOUNDARIES, LOOP_REFUSAL_LEAD, LOOP_WINDOW_CALLS, LOOP_CHAINS_PER_SESSION, NOTICED_PER_CHAIN, TOOL_NAME_MAX_CHARS2, ROOT_CHAIN, states2, loopNoticeBodySchema;
|
|
47832
47963
|
var init_loop_notice = __esm({
|
|
47833
47964
|
"../../packages/tacho/src/collector/loop-notice.ts"() {
|
|
47834
47965
|
"use strict";
|
|
@@ -47844,7 +47975,6 @@ var init_loop_notice = __esm({
|
|
|
47844
47975
|
"PostToolUseFailure",
|
|
47845
47976
|
"PreToolUse"
|
|
47846
47977
|
];
|
|
47847
|
-
LOOP_NOTICE_REASON_CODE = "loop_notice";
|
|
47848
47978
|
LOOP_REFUSAL_LEAD = "This call did not run. ";
|
|
47849
47979
|
LOOP_WINDOW_CALLS = 32;
|
|
47850
47980
|
LOOP_CHAINS_PER_SESSION = 16;
|
|
@@ -47866,134 +47996,6 @@ var init_loop_notice = __esm({
|
|
|
47866
47996
|
}
|
|
47867
47997
|
});
|
|
47868
47998
|
|
|
47869
|
-
// ../../packages/tacho/src/interjection.ts
|
|
47870
|
-
var digest4, timestamp, count5, configVersion, workspaceSlug, interjectionKeySchema, INTERJECTION_RECEIPT_ID_PATTERN, INTERJECTION_QUESTION_MAX, INTERJECTION_PATHS, INTERJECTION_ANSWER_SOURCES, SKILLS_RESOLVED_REASONS, repoUnknownBodySchema, interjectLinkPathSchema, interjectCreatePathSchema, INTERJECT_PROVIDERS, interjectBodySchema, answerBodySchema, repoBoundBodySchema, workspaceCreatedBodySchema, skillsResolvedBodySchema, interjectionAnswerPayloadSchema;
|
|
47871
|
-
var init_interjection = __esm({
|
|
47872
|
-
"../../packages/tacho/src/interjection.ts"() {
|
|
47873
|
-
"use strict";
|
|
47874
|
-
init_zod();
|
|
47875
|
-
init_digest();
|
|
47876
|
-
init_timestamp();
|
|
47877
|
-
digest4 = external_exports.string().regex(SHA256_DIGEST_PATTERN);
|
|
47878
|
-
timestamp = external_exports.string().refine(isProtocolTimestamp, "protocol timestamp");
|
|
47879
|
-
count5 = external_exports.number().int().nonnegative();
|
|
47880
|
-
configVersion = external_exports.string().min(1).max(64).nullable();
|
|
47881
|
-
workspaceSlug = external_exports.string().min(1).max(64);
|
|
47882
|
-
interjectionKeySchema = external_exports.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/, "a ULID");
|
|
47883
|
-
INTERJECTION_RECEIPT_ID_PATTERN = /^rcp_[0-9a-z]+$/;
|
|
47884
|
-
INTERJECTION_QUESTION_MAX = 2e3;
|
|
47885
|
-
INTERJECTION_PATHS = ["link", "create", "deny"];
|
|
47886
|
-
INTERJECTION_ANSWER_SOURCES = ["person", "timeout"];
|
|
47887
|
-
SKILLS_RESOLVED_REASONS = [
|
|
47888
|
-
"skills_off",
|
|
47889
|
-
"denied",
|
|
47890
|
-
"resolved"
|
|
47891
|
-
];
|
|
47892
|
-
repoUnknownBodySchema = external_exports.object({
|
|
47893
|
-
/** sha256 of `canonicalRemote(origin)`; the remote itself never leaves the host. */
|
|
47894
|
-
remote_digest: digest4,
|
|
47895
|
-
/** sha256 of `foldedRemote(canonicalRemote(origin))`; absent when the host does not fold. */
|
|
47896
|
-
remote_digest_folded: digest4.optional(),
|
|
47897
|
-
head_sha: external_exports.string().max(512).optional(),
|
|
47898
|
-
/** The bundle asked only because the workspace has skills on. */
|
|
47899
|
-
skills_enabled: external_exports.literal(true),
|
|
47900
|
-
/** The bundle's `unbound_repo.policy`. */
|
|
47901
|
-
unbound_repo: external_exports.literal("ask"),
|
|
47902
|
-
/** The skills configuration the bundle carried; null when none was named. */
|
|
47903
|
-
config_version: configVersion
|
|
47904
|
-
}).strict();
|
|
47905
|
-
interjectLinkPathSchema = external_exports.object({
|
|
47906
|
-
path: external_exports.literal("link"),
|
|
47907
|
-
workspace_slug: workspaceSlug,
|
|
47908
|
-
config_version: configVersion,
|
|
47909
|
-
/** Skills the workspace's configuration pins; null when not counted. */
|
|
47910
|
-
skills_pinned: count5.nullable(),
|
|
47911
|
-
/** Repositories the workspace already links; null when not counted. */
|
|
47912
|
-
linked_repositories: count5.nullable()
|
|
47913
|
-
}).strict();
|
|
47914
|
-
interjectCreatePathSchema = external_exports.object({
|
|
47915
|
-
path: external_exports.literal("create"),
|
|
47916
|
-
/** From the repository's name; null when the host could not read one. */
|
|
47917
|
-
proposed_name: external_exports.string().min(1).max(120).nullable(),
|
|
47918
|
-
proposed_slug: workspaceSlug.nullable(),
|
|
47919
|
-
skills_enabled: external_exports.literal(false)
|
|
47920
|
-
}).strict();
|
|
47921
|
-
INTERJECT_PROVIDERS = ["github", "gitlab"];
|
|
47922
|
-
interjectBodySchema = external_exports.object({
|
|
47923
|
-
interjection_key: interjectionKeySchema,
|
|
47924
|
-
reason: external_exports.literal("repo_unknown"),
|
|
47925
|
-
question: external_exports.string().min(1).max(INTERJECTION_QUESTION_MAX),
|
|
47926
|
-
remote_digest: digest4,
|
|
47927
|
-
remote_digest_folded: digest4.optional(),
|
|
47928
|
-
/** How long the host waits, from the bundle's `unbound_repo.timeout_ms`. */
|
|
47929
|
-
timeout_ms: external_exports.number().int().positive(),
|
|
47930
|
-
/** The host's clock plus `timeout_ms`. The control plane keeps its own deadline. */
|
|
47931
|
-
expires_at: timestamp,
|
|
47932
|
-
/** What the timeout answers. */
|
|
47933
|
-
on_timeout: external_exports.literal("deny"),
|
|
47934
|
-
/** The two paths a person can take, link first. Deny needs no path. */
|
|
47935
|
-
paths: external_exports.tuple([interjectLinkPathSchema, interjectCreatePathSchema]),
|
|
47936
|
-
/**
|
|
47937
|
-
* The forge the remote's host names (#4439): `github` for github.com and
|
|
47938
|
-
* `gitlab` for gitlab.com. Absent for any other host, and from a host
|
|
47939
|
-
* built before the field, which the control plane reads as GitHub. The
|
|
47940
|
-
* host string itself stays on the machine. A GitLab project binds through
|
|
47941
|
-
* its own project access token, so the control plane offers no link for
|
|
47942
|
-
* a `gitlab` question.
|
|
47943
|
-
*/
|
|
47944
|
-
provider: external_exports.enum(INTERJECT_PROVIDERS).optional()
|
|
47945
|
-
}).strict();
|
|
47946
|
-
answerBodySchema = external_exports.object({
|
|
47947
|
-
interjection_key: interjectionKeySchema,
|
|
47948
|
-
/** The control plane's row (`inj_…`); absent on a timeout the host answered alone. */
|
|
47949
|
-
interjection_id: external_exports.string().regex(/^inj_[0-9a-z]+$/).optional(),
|
|
47950
|
-
path: external_exports.enum(INTERJECTION_PATHS),
|
|
47951
|
-
source: external_exports.enum(INTERJECTION_ANSWER_SOURCES),
|
|
47952
|
-
/** The receipt the control plane recorded; absent on a host-side timeout. */
|
|
47953
|
-
receipt_id: external_exports.string().regex(INTERJECTION_RECEIPT_ID_PATTERN).optional(),
|
|
47954
|
-
/** The person who answered (`usr_…`); absent on a timeout. */
|
|
47955
|
-
answered_by: external_exports.string().regex(/^usr_[0-9a-z]+$/).optional(),
|
|
47956
|
-
/** The `message` command that carried the answer (`tcm_…`). */
|
|
47957
|
-
command_id: external_exports.string().regex(/^tcm_[0-9a-z]+$/).optional()
|
|
47958
|
-
}).strict();
|
|
47959
|
-
repoBoundBodySchema = external_exports.object({
|
|
47960
|
-
interjection_key: interjectionKeySchema,
|
|
47961
|
-
binding_id: external_exports.string().min(1).max(64),
|
|
47962
|
-
workspace_slug: workspaceSlug,
|
|
47963
|
-
role: external_exports.enum(["linked", "main"])
|
|
47964
|
-
}).strict();
|
|
47965
|
-
workspaceCreatedBodySchema = external_exports.object({
|
|
47966
|
-
interjection_key: interjectionKeySchema,
|
|
47967
|
-
workspace_id: external_exports.string().min(1).max(64),
|
|
47968
|
-
workspace_slug: workspaceSlug,
|
|
47969
|
-
skills_enabled: external_exports.literal(false)
|
|
47970
|
-
}).strict();
|
|
47971
|
-
skillsResolvedBodySchema = external_exports.object({
|
|
47972
|
-
/** The interjection that settled it; absent when no question was asked. */
|
|
47973
|
-
interjection_key: interjectionKeySchema.optional(),
|
|
47974
|
-
config_version: configVersion,
|
|
47975
|
-
/** Skills the session may load. */
|
|
47976
|
-
in_scope: count5,
|
|
47977
|
-
/** Skills the configuration holds back; null until the catalog read counts them (#3098). */
|
|
47978
|
-
withheld: count5.nullable(),
|
|
47979
|
-
reason: external_exports.enum(SKILLS_RESOLVED_REASONS)
|
|
47980
|
-
}).strict();
|
|
47981
|
-
interjectionAnswerPayloadSchema = external_exports.object({
|
|
47982
|
-
key: interjectionKeySchema,
|
|
47983
|
-
path: external_exports.enum(INTERJECTION_PATHS),
|
|
47984
|
-
source: external_exports.enum(INTERJECTION_ANSWER_SOURCES),
|
|
47985
|
-
receipt_id: external_exports.string().regex(INTERJECTION_RECEIPT_ID_PATTERN),
|
|
47986
|
-
/** The person who answered (`usr_…`); null on a timeout. */
|
|
47987
|
-
answered_by: external_exports.string().regex(/^usr_[0-9a-z]+$/).nullable(),
|
|
47988
|
-
/** Set on a link or create answer. */
|
|
47989
|
-
binding_id: external_exports.string().min(1).max(64).optional(),
|
|
47990
|
-
/** Set on a create answer. */
|
|
47991
|
-
workspace_id: external_exports.string().min(1).max(64).optional(),
|
|
47992
|
-
workspace_slug: workspaceSlug.optional()
|
|
47993
|
-
}).strict();
|
|
47994
|
-
}
|
|
47995
|
-
});
|
|
47996
|
-
|
|
47997
47999
|
// ../../packages/tacho/src/collector/interjection.ts
|
|
47998
48000
|
function showsRefusedPrompt(harness) {
|
|
47999
48001
|
return harness !== "stella";
|
|
@@ -48198,7 +48200,7 @@ function settle2(record2, held, answer, payload, fields) {
|
|
|
48198
48200
|
record2.control.interjection = void 0;
|
|
48199
48201
|
return events;
|
|
48200
48202
|
}
|
|
48201
|
-
var SLUG_PATTERN, SLUG_MIN, SLUG_MAX, NAME_MAX2,
|
|
48203
|
+
var SLUG_PATTERN, SLUG_MIN, SLUG_MAX, NAME_MAX2, INTERJECTION_TIMED_OUT_TEXT, expiredByHook, putBack;
|
|
48202
48204
|
var init_interjection2 = __esm({
|
|
48203
48205
|
"../../packages/tacho/src/collector/interjection.ts"() {
|
|
48204
48206
|
"use strict";
|
|
@@ -48209,7 +48211,6 @@ var init_interjection2 = __esm({
|
|
|
48209
48211
|
SLUG_MIN = 2;
|
|
48210
48212
|
SLUG_MAX = 40;
|
|
48211
48213
|
NAME_MAX2 = 120;
|
|
48212
|
-
INTERJECTION_OPEN = "interjection_open";
|
|
48213
48214
|
INTERJECTION_TIMED_OUT_TEXT = "Oxagen asked a person whether to bind this repository to a workspace, and nobody answered in time. This session goes on without skills.";
|
|
48214
48215
|
expiredByHook = /* @__PURE__ */ new WeakMap();
|
|
48215
48216
|
putBack = /* @__PURE__ */ new WeakSet();
|
|
@@ -49650,6 +49651,8 @@ var init_hook_handler = __esm({
|
|
|
49650
49651
|
init_payload_members();
|
|
49651
49652
|
init_work_order_context();
|
|
49652
49653
|
init_tools();
|
|
49654
|
+
init_interjection();
|
|
49655
|
+
init_loops();
|
|
49653
49656
|
init_steering_manifest();
|
|
49654
49657
|
init_frame_body();
|
|
49655
49658
|
init_harness_limits();
|
|
@@ -50693,7 +50696,7 @@ function createGithubProxy(deps) {
|
|
|
50693
50696
|
host
|
|
50694
50697
|
);
|
|
50695
50698
|
}
|
|
50696
|
-
function
|
|
50699
|
+
function release3(token) {
|
|
50697
50700
|
leases.delete(hash(token));
|
|
50698
50701
|
}
|
|
50699
50702
|
async function mintInstallationToken(host, controller, res, path2, lease) {
|
|
@@ -51042,7 +51045,7 @@ function createGithubProxy(deps) {
|
|
|
51042
51045
|
}
|
|
51043
51046
|
}
|
|
51044
51047
|
}
|
|
51045
|
-
return { issue: issue2, issueForSession, release:
|
|
51048
|
+
return { issue: issue2, issueForSession, release: release3, handle };
|
|
51046
51049
|
}
|
|
51047
51050
|
var LIFE_MS, MAX_LEASES, MAX_REQUEST_BYTES, REPO, GITLAB_PATH, GITLAB_HOST, MAX_REFUSAL_CHARS, REFUSED, CONFIGURE_STEP;
|
|
51048
51051
|
var init_github_proxy = __esm({
|
|
@@ -53881,8 +53884,8 @@ async function whichOnPath(command2, pathValue, search) {
|
|
|
53881
53884
|
}
|
|
53882
53885
|
return void 0;
|
|
53883
53886
|
}
|
|
53884
|
-
function platformPathSearch(
|
|
53885
|
-
if (
|
|
53887
|
+
function platformPathSearch(platform2, env, isExecutable2) {
|
|
53888
|
+
if (platform2 !== "win32")
|
|
53886
53889
|
return { delimiter: ":", extensions: [""], isExecutable: isExecutable2 };
|
|
53887
53890
|
const pathExt = env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD";
|
|
53888
53891
|
return {
|
|
@@ -53951,8 +53954,8 @@ function createPackageDigester(deps) {
|
|
|
53951
53954
|
}
|
|
53952
53955
|
async function releaseFile(pkg, signal) {
|
|
53953
53956
|
const url2 = `${REGISTRY_URLS.pypi}/${encodeURIComponent(pkg.name)}/${encodeURIComponent(pkg.version)}/json`;
|
|
53954
|
-
const
|
|
53955
|
-
return pickPypiFile(
|
|
53957
|
+
const release3 = objectOf(await (await read2(url2, signal)).json());
|
|
53958
|
+
return pickPypiFile(release3?.urls) ?? null;
|
|
53956
53959
|
}
|
|
53957
53960
|
function fileDigest(url2, signal) {
|
|
53958
53961
|
const known = files2.get(url2);
|
|
@@ -54957,8 +54960,8 @@ async function isExecutable(path2) {
|
|
|
54957
54960
|
return false;
|
|
54958
54961
|
}
|
|
54959
54962
|
}
|
|
54960
|
-
function machineDigester(fetch2, env,
|
|
54961
|
-
const search = platformPathSearch(
|
|
54963
|
+
function machineDigester(fetch2, env, platform2) {
|
|
54964
|
+
const search = platformPathSearch(platform2, env, isExecutable);
|
|
54962
54965
|
return createPackageDigester({
|
|
54963
54966
|
fetch: fetch2,
|
|
54964
54967
|
readFile: (path2) => readFile2(path2),
|
|
@@ -55369,11 +55372,11 @@ import {
|
|
|
55369
55372
|
writeFileSync as writeFileSync5
|
|
55370
55373
|
} from "node:fs";
|
|
55371
55374
|
import { join as join49 } from "node:path";
|
|
55372
|
-
function codegraphTriple(
|
|
55373
|
-
if (
|
|
55374
|
-
if (
|
|
55375
|
-
if (
|
|
55376
|
-
if (
|
|
55375
|
+
function codegraphTriple(platform2, arch) {
|
|
55376
|
+
if (platform2 === "darwin" && arch === "arm64") return "aarch64-apple-darwin";
|
|
55377
|
+
if (platform2 === "darwin" && arch === "x64") return "x86_64-apple-darwin";
|
|
55378
|
+
if (platform2 === "linux" && arch === "x64") return "x86_64-unknown-linux-gnu";
|
|
55379
|
+
if (platform2 === "win32" && arch === "x64") return "x86_64-pc-windows-msvc";
|
|
55377
55380
|
return void 0;
|
|
55378
55381
|
}
|
|
55379
55382
|
function codegraphAssetName(triple) {
|
|
@@ -56919,9 +56922,9 @@ function sessionSkills(options) {
|
|
|
56919
56922
|
let tail = Promise.resolve();
|
|
56920
56923
|
async function inTurn(task) {
|
|
56921
56924
|
const before = tail;
|
|
56922
|
-
let
|
|
56925
|
+
let release3 = () => void 0;
|
|
56923
56926
|
const mine = new Promise((resolve29) => {
|
|
56924
|
-
|
|
56927
|
+
release3 = resolve29;
|
|
56925
56928
|
});
|
|
56926
56929
|
tail = before.then(() => mine);
|
|
56927
56930
|
const turn = await new Promise((resolve29) => {
|
|
@@ -56936,7 +56939,7 @@ function sessionSkills(options) {
|
|
|
56936
56939
|
await task();
|
|
56937
56940
|
return true;
|
|
56938
56941
|
} finally {
|
|
56939
|
-
|
|
56942
|
+
release3();
|
|
56940
56943
|
}
|
|
56941
56944
|
}
|
|
56942
56945
|
return {
|
|
@@ -59222,14 +59225,14 @@ function createModelProxy(deps) {
|
|
|
59222
59225
|
const calls = inFlight.get(sessionKey) ?? /* @__PURE__ */ new Set();
|
|
59223
59226
|
calls.add(entry2);
|
|
59224
59227
|
inFlight.set(sessionKey, calls);
|
|
59225
|
-
const
|
|
59228
|
+
const release3 = () => {
|
|
59226
59229
|
if (calls.delete(entry2) && calls.size === 0 && inFlight.get(sessionKey) === calls)
|
|
59227
59230
|
inFlight.delete(sessionKey);
|
|
59228
59231
|
};
|
|
59229
59232
|
const finish = (outcome) => {
|
|
59230
59233
|
if (done) return;
|
|
59231
59234
|
done = true;
|
|
59232
|
-
|
|
59235
|
+
release3();
|
|
59233
59236
|
resolve29(outcome);
|
|
59234
59237
|
};
|
|
59235
59238
|
try {
|
|
@@ -59313,7 +59316,7 @@ function createModelProxy(deps) {
|
|
|
59313
59316
|
const end = (errorClass2) => {
|
|
59314
59317
|
if (done || answered) return;
|
|
59315
59318
|
answered = true;
|
|
59316
|
-
|
|
59319
|
+
release3();
|
|
59317
59320
|
const encoding = response.headers["content-encoding"];
|
|
59318
59321
|
const decoding = over ? Promise.resolve(void 0) : readableModelBody(
|
|
59319
59322
|
Buffer.concat(chunks),
|
|
@@ -62837,11 +62840,11 @@ async function initializeDaemon(options, server, port, ready, clock2) {
|
|
|
62837
62840
|
const exec4 = options.exec ?? defaultExec;
|
|
62838
62841
|
const execAsync = options.execAsync ?? (options.exec !== void 0 ? async (command2, args) => exec4(command2, args) : defaultExecAsync);
|
|
62839
62842
|
const kill = options.kill ?? defaultKill;
|
|
62840
|
-
const
|
|
62843
|
+
const platform2 = options.platform ?? process.platform;
|
|
62841
62844
|
const injectedStarts = options.processStarts;
|
|
62842
|
-
const processStarts = injectedStarts ?? ((pids) => readProcessStarts(pids, options.exec,
|
|
62843
|
-
const processStartsAsync = async (pids) => injectedStarts !== void 0 ? injectedStarts(pids) : options.exec !== void 0 ? readProcessStarts(pids, options.exec,
|
|
62844
|
-
const hookProcessStarts = injectedStarts ?? ((pids) => readProcessStartsNoWait(pids, execAsync,
|
|
62845
|
+
const processStarts = injectedStarts ?? ((pids) => readProcessStarts(pids, options.exec, platform2));
|
|
62846
|
+
const processStartsAsync = async (pids) => injectedStarts !== void 0 ? injectedStarts(pids) : options.exec !== void 0 ? readProcessStarts(pids, options.exec, platform2) : readProcessStartsAsync(pids, void 0, platform2);
|
|
62847
|
+
const hookProcessStarts = injectedStarts ?? ((pids) => readProcessStartsNoWait(pids, execAsync, platform2));
|
|
62845
62848
|
const loaded = options.host;
|
|
62846
62849
|
let host = loaded.wrapper_version === TACHO_VERSION ? loaded : { ...loaded, wrapper_version: TACHO_VERSION };
|
|
62847
62850
|
const onDisk = readHostFileLenient(paths.hostFile).host;
|
|
@@ -63331,9 +63334,9 @@ async function initializeDaemon(options, server, port, ready, clock2) {
|
|
|
63331
63334
|
if (retention.proven) {
|
|
63332
63335
|
let released = false;
|
|
63333
63336
|
try {
|
|
63334
|
-
const
|
|
63335
|
-
written2 +=
|
|
63336
|
-
dropped +=
|
|
63337
|
+
const release3 = wal.releaseHeld(sessionUuid2, retention.mandate);
|
|
63338
|
+
written2 += release3.written;
|
|
63339
|
+
dropped += release3.dropped;
|
|
63337
63340
|
released = true;
|
|
63338
63341
|
} catch (error2) {
|
|
63339
63342
|
log(
|
|
@@ -72837,9 +72840,9 @@ import { posix as posix6, win32 as win326 } from "node:path";
|
|
|
72837
72840
|
function isLegacyName(value) {
|
|
72838
72841
|
return LEGACY_NAMES.some((name2) => name2 === value);
|
|
72839
72842
|
}
|
|
72840
|
-
function legacyNameOf(marker, argv0,
|
|
72843
|
+
function legacyNameOf(marker, argv0, platform2) {
|
|
72841
72844
|
if (isLegacyName(marker)) return marker;
|
|
72842
|
-
const name2 =
|
|
72845
|
+
const name2 = platform2 === "win32" ? win326.basename(argv0).toLowerCase().replace(/\.exe$/, "") : posix6.basename(argv0);
|
|
72843
72846
|
return isLegacyName(name2) ? name2 : void 0;
|
|
72844
72847
|
}
|
|
72845
72848
|
function invokedLegacyName() {
|
|
@@ -73445,7 +73448,7 @@ var init_package = __esm({
|
|
|
73445
73448
|
"package.json"() {
|
|
73446
73449
|
package_default = {
|
|
73447
73450
|
name: "@oxagen/cli",
|
|
73448
|
-
version: "3.0.1-
|
|
73451
|
+
version: "3.0.1-816",
|
|
73449
73452
|
description: "Oxagen governance CLI: spend, source tracking, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
|
|
73450
73453
|
type: "module",
|
|
73451
73454
|
main: "./dist/index.js",
|
|
@@ -88436,6 +88439,15 @@ var init_loop_detected = __esm({
|
|
|
88436
88439
|
}
|
|
88437
88440
|
});
|
|
88438
88441
|
|
|
88442
|
+
// ../../packages/tacho/src/remote-digests.ts
|
|
88443
|
+
var init_remote_digests = __esm({
|
|
88444
|
+
"../../packages/tacho/src/remote-digests.ts"() {
|
|
88445
|
+
"use strict";
|
|
88446
|
+
init_digest();
|
|
88447
|
+
init_remote();
|
|
88448
|
+
}
|
|
88449
|
+
});
|
|
88450
|
+
|
|
88439
88451
|
// ../../packages/tacho/src/evidence/merkle.ts
|
|
88440
88452
|
import { createHash as createHash20 } from "node:crypto";
|
|
88441
88453
|
function digestToBytes(digest6) {
|
|
@@ -92408,6 +92420,7 @@ var init_src4 = __esm({
|
|
|
92408
92420
|
init_loop_detected();
|
|
92409
92421
|
init_record_basis();
|
|
92410
92422
|
init_remote();
|
|
92423
|
+
init_remote_digests();
|
|
92411
92424
|
init_timestamp();
|
|
92412
92425
|
init_wire();
|
|
92413
92426
|
init_evidence();
|
|
@@ -92716,16 +92729,16 @@ function isExecutableFile(path2) {
|
|
|
92716
92729
|
return false;
|
|
92717
92730
|
}
|
|
92718
92731
|
}
|
|
92719
|
-
function commandNames(command2,
|
|
92720
|
-
return
|
|
92732
|
+
function commandNames(command2, platform2) {
|
|
92733
|
+
return platform2 === "win32" ? [`${command2}.exe`, `${command2}.cmd`] : [command2];
|
|
92721
92734
|
}
|
|
92722
92735
|
async function detectHarnesses(deps = {}) {
|
|
92723
92736
|
const dirs = await (deps.searchDirs ?? terminalDirs)();
|
|
92724
92737
|
const isExecutable2 = deps.isExecutable ?? isExecutableFile;
|
|
92725
|
-
const
|
|
92738
|
+
const platform2 = deps.platform ?? process.platform;
|
|
92726
92739
|
const found = [];
|
|
92727
92740
|
for (const harness of WRAPPED_HARNESSES) {
|
|
92728
|
-
const names2 = commandNames(HARNESS_BINARY[harness],
|
|
92741
|
+
const names2 = commandNames(HARNESS_BINARY[harness], platform2);
|
|
92729
92742
|
const path2 = dirs.flatMap((dir) => names2.map((name2) => join65(dir, name2))).find(isExecutable2);
|
|
92730
92743
|
if (path2 !== void 0) {
|
|
92731
92744
|
found.push({ harness, label: harnessLabel(harness), path: path2 });
|
|
@@ -92766,6 +92779,493 @@ var init_harnesses = __esm({
|
|
|
92766
92779
|
}
|
|
92767
92780
|
});
|
|
92768
92781
|
|
|
92782
|
+
// src/lib/working-copy.ts
|
|
92783
|
+
import { execFile as execFile6 } from "node:child_process";
|
|
92784
|
+
import { createHash as createHash27, randomBytes as randomBytes14 } from "node:crypto";
|
|
92785
|
+
import {
|
|
92786
|
+
existsSync as existsSync29,
|
|
92787
|
+
lstatSync as lstatSync13,
|
|
92788
|
+
mkdirSync as mkdirSync13,
|
|
92789
|
+
readFileSync as readFileSync30,
|
|
92790
|
+
readdirSync as readdirSync17,
|
|
92791
|
+
realpathSync as realpathSync10,
|
|
92792
|
+
writeFileSync as writeFileSync10
|
|
92793
|
+
} from "node:fs";
|
|
92794
|
+
import { homedir as homedir12, hostname as osHostname3 } from "node:os";
|
|
92795
|
+
import { join as join66, resolve as resolve24, sep as sep10 } from "node:path";
|
|
92796
|
+
function git3(cwd, args) {
|
|
92797
|
+
return new Promise((done) => {
|
|
92798
|
+
try {
|
|
92799
|
+
execFile6(
|
|
92800
|
+
"git",
|
|
92801
|
+
args,
|
|
92802
|
+
{ cwd, timeout: GIT_TIMEOUT_MS2, encoding: "utf8", windowsHide: true },
|
|
92803
|
+
(err2, stdout) => {
|
|
92804
|
+
if (err2) return done(null);
|
|
92805
|
+
const out = String(stdout).trim();
|
|
92806
|
+
done(out.length > 0 ? out : null);
|
|
92807
|
+
}
|
|
92808
|
+
);
|
|
92809
|
+
} catch {
|
|
92810
|
+
done(null);
|
|
92811
|
+
}
|
|
92812
|
+
});
|
|
92813
|
+
}
|
|
92814
|
+
async function projectRootFor(cwd) {
|
|
92815
|
+
const top = await git3(cwd, ["rev-parse", "--show-toplevel"]);
|
|
92816
|
+
return top ? resolve24(top) : resolve24(cwd);
|
|
92817
|
+
}
|
|
92818
|
+
function parseRemoteRepository(url2) {
|
|
92819
|
+
const raw = url2.trim();
|
|
92820
|
+
if (raw.length === 0) return null;
|
|
92821
|
+
let path2 = null;
|
|
92822
|
+
const scp = /^(?:[^@/\s]+@)?([^:/\s]+):(?!\/\/)(.+)$/.exec(raw);
|
|
92823
|
+
if (!raw.includes("://") && scp) {
|
|
92824
|
+
if (scp[1].length === 1) return null;
|
|
92825
|
+
path2 = scp[2];
|
|
92826
|
+
} else {
|
|
92827
|
+
try {
|
|
92828
|
+
const parsed2 = new URL(raw);
|
|
92829
|
+
if (parsed2.protocol === "file:") return null;
|
|
92830
|
+
path2 = decodeURIComponent(parsed2.pathname);
|
|
92831
|
+
} catch {
|
|
92832
|
+
return null;
|
|
92833
|
+
}
|
|
92834
|
+
}
|
|
92835
|
+
const segments = path2.replace(/\/+$/, "").replace(/\.git$/, "").split("/").filter((s2) => s2.length > 0);
|
|
92836
|
+
if (segments.length < 2) return null;
|
|
92837
|
+
const name2 = segments.join("/");
|
|
92838
|
+
return name2.length >= 3 && name2.length <= 512 ? name2 : null;
|
|
92839
|
+
}
|
|
92840
|
+
function oxagenPresent(root) {
|
|
92841
|
+
try {
|
|
92842
|
+
return readdirSync17(join66(root, ".oxagen")).some(
|
|
92843
|
+
(name2) => name2 !== "workspace.json"
|
|
92844
|
+
);
|
|
92845
|
+
} catch {
|
|
92846
|
+
return false;
|
|
92847
|
+
}
|
|
92848
|
+
}
|
|
92849
|
+
function symlinkState(root) {
|
|
92850
|
+
try {
|
|
92851
|
+
if (!lstatSync13(join66(root, ".stella")).isDirectory()) return "none";
|
|
92852
|
+
} catch {
|
|
92853
|
+
return "none";
|
|
92854
|
+
}
|
|
92855
|
+
let oxagenReal;
|
|
92856
|
+
try {
|
|
92857
|
+
oxagenReal = realpathSync10(join66(root, ".oxagen"));
|
|
92858
|
+
} catch {
|
|
92859
|
+
return "missing";
|
|
92860
|
+
}
|
|
92861
|
+
for (const link of STELLA_LINKS) {
|
|
92862
|
+
const at2 = join66(root, link);
|
|
92863
|
+
try {
|
|
92864
|
+
if (!lstatSync13(at2).isSymbolicLink()) return "missing";
|
|
92865
|
+
const target = realpathSync10(at2);
|
|
92866
|
+
if (target !== oxagenReal && !target.startsWith(oxagenReal + sep10)) {
|
|
92867
|
+
return "missing";
|
|
92868
|
+
}
|
|
92869
|
+
} catch {
|
|
92870
|
+
return "missing";
|
|
92871
|
+
}
|
|
92872
|
+
}
|
|
92873
|
+
return "linked";
|
|
92874
|
+
}
|
|
92875
|
+
function machineId(configDir = getConfigDir()) {
|
|
92876
|
+
const file = join66(configDir, MACHINE_ID_FILE);
|
|
92877
|
+
let secret = null;
|
|
92878
|
+
try {
|
|
92879
|
+
if (existsSync29(file)) {
|
|
92880
|
+
const stored = readFileSync30(file, "utf8").trim();
|
|
92881
|
+
if (/^[0-9a-f]{64}$/.test(stored)) secret = stored;
|
|
92882
|
+
}
|
|
92883
|
+
if (secret === null) {
|
|
92884
|
+
secret = randomBytes14(32).toString("hex");
|
|
92885
|
+
mkdirSync13(configDir, { recursive: true });
|
|
92886
|
+
writeFileSync10(file, `${secret}
|
|
92887
|
+
`, { encoding: "utf8", mode: 384 });
|
|
92888
|
+
}
|
|
92889
|
+
} catch {
|
|
92890
|
+
secret = `fallback:${osHostname3()}:${homedir12()}`;
|
|
92891
|
+
}
|
|
92892
|
+
return createHash27("sha256").update(secret).digest("hex");
|
|
92893
|
+
}
|
|
92894
|
+
function cliVersion() {
|
|
92895
|
+
const v = package_default.version;
|
|
92896
|
+
return typeof v === "string" && v.length > 0 ? v.slice(0, 64) : null;
|
|
92897
|
+
}
|
|
92898
|
+
async function probeWorkingCopy(opts) {
|
|
92899
|
+
const { root } = opts;
|
|
92900
|
+
const [remote, branch, head3] = await Promise.all([
|
|
92901
|
+
git3(root, ["remote", "get-url", "origin"]),
|
|
92902
|
+
git3(root, ["rev-parse", "--abbrev-ref", "HEAD"]),
|
|
92903
|
+
git3(root, ["rev-parse", "HEAD"])
|
|
92904
|
+
]);
|
|
92905
|
+
const host = (() => {
|
|
92906
|
+
try {
|
|
92907
|
+
return osHostname3().slice(0, 255);
|
|
92908
|
+
} catch {
|
|
92909
|
+
return "";
|
|
92910
|
+
}
|
|
92911
|
+
})();
|
|
92912
|
+
return {
|
|
92913
|
+
machineId: machineId(opts.configDir),
|
|
92914
|
+
hostname: host.length > 0 ? host : "unknown",
|
|
92915
|
+
directory: resolve24(root),
|
|
92916
|
+
repository: remote ? parseRemoteRepository(remote) : null,
|
|
92917
|
+
// `HEAD` is git's answer on a detached head.
|
|
92918
|
+
branch: branch && branch !== "HEAD" ? branch.slice(0, 255) : null,
|
|
92919
|
+
headCommit: head3 && COMMIT_SHA.test(head3) ? head3 : null,
|
|
92920
|
+
oxagenPresent: oxagenPresent(root),
|
|
92921
|
+
symlinks: symlinkState(root),
|
|
92922
|
+
pulledCommit: null,
|
|
92923
|
+
event: "init",
|
|
92924
|
+
cliVersion: cliVersion()
|
|
92925
|
+
};
|
|
92926
|
+
}
|
|
92927
|
+
async function reportWorkingCopy(opts) {
|
|
92928
|
+
try {
|
|
92929
|
+
const report = await probeWorkingCopy(opts);
|
|
92930
|
+
const recorded = await apiPostOrThrow(
|
|
92931
|
+
"working-copies",
|
|
92932
|
+
report,
|
|
92933
|
+
opts.scope,
|
|
92934
|
+
{ timeoutMs: REPORT_TIMEOUT_MS }
|
|
92935
|
+
);
|
|
92936
|
+
return {
|
|
92937
|
+
workingCopyId: recorded.workingCopyId,
|
|
92938
|
+
lastSeenAt: recorded.lastSeenAt
|
|
92939
|
+
};
|
|
92940
|
+
} catch (err2) {
|
|
92941
|
+
return { error: err2 instanceof Error ? err2.message : String(err2) };
|
|
92942
|
+
}
|
|
92943
|
+
}
|
|
92944
|
+
var GIT_TIMEOUT_MS2, REPORT_TIMEOUT_MS, MACHINE_ID_FILE, STELLA_LINKS, COMMIT_SHA;
|
|
92945
|
+
var init_working_copy = __esm({
|
|
92946
|
+
"src/lib/working-copy.ts"() {
|
|
92947
|
+
init_package();
|
|
92948
|
+
init_api();
|
|
92949
|
+
init_config();
|
|
92950
|
+
GIT_TIMEOUT_MS2 = 3e3;
|
|
92951
|
+
REPORT_TIMEOUT_MS = 8e3;
|
|
92952
|
+
MACHINE_ID_FILE = "machine-id";
|
|
92953
|
+
STELLA_LINKS = [
|
|
92954
|
+
".stella/rules",
|
|
92955
|
+
".stella/proposals",
|
|
92956
|
+
".stella/agents"
|
|
92957
|
+
];
|
|
92958
|
+
COMMIT_SHA = /^[0-9a-f]{7,64}$/;
|
|
92959
|
+
}
|
|
92960
|
+
});
|
|
92961
|
+
|
|
92962
|
+
// src/commands/agent-connect.ts
|
|
92963
|
+
var agent_connect_exports = {};
|
|
92964
|
+
__export(agent_connect_exports, {
|
|
92965
|
+
RequestRefused: () => RequestRefused,
|
|
92966
|
+
RequestUnreachable: () => RequestUnreachable,
|
|
92967
|
+
agentConnect: () => agentConnect
|
|
92968
|
+
});
|
|
92969
|
+
import { hostname, platform, release as release2 } from "node:os";
|
|
92970
|
+
async function post(apiUrl, path2, body2) {
|
|
92971
|
+
let response;
|
|
92972
|
+
try {
|
|
92973
|
+
response = await fetch(`${apiUrl.replace(/\/+$/, "")}${path2}`, {
|
|
92974
|
+
method: "POST",
|
|
92975
|
+
headers: { "content-type": "application/json" },
|
|
92976
|
+
body: JSON.stringify(body2),
|
|
92977
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
92978
|
+
});
|
|
92979
|
+
} catch (err2) {
|
|
92980
|
+
throw new RequestUnreachable(errorMessage3(err2));
|
|
92981
|
+
}
|
|
92982
|
+
const text6 = await response.text();
|
|
92983
|
+
let parsed2;
|
|
92984
|
+
try {
|
|
92985
|
+
parsed2 = text6.length === 0 ? {} : JSON.parse(text6);
|
|
92986
|
+
} catch {
|
|
92987
|
+
parsed2 = {};
|
|
92988
|
+
}
|
|
92989
|
+
if (!response.ok) {
|
|
92990
|
+
const error2 = parsed2.error;
|
|
92991
|
+
throw new RequestRefused(
|
|
92992
|
+
response.status,
|
|
92993
|
+
typeof error2?.reason === "string" ? error2.reason : void 0,
|
|
92994
|
+
typeof error2?.message === "string" ? error2.message : `Oxagen answered ${response.status}.`
|
|
92995
|
+
);
|
|
92996
|
+
}
|
|
92997
|
+
return parsed2;
|
|
92998
|
+
}
|
|
92999
|
+
function isPreview(value) {
|
|
93000
|
+
if (typeof value !== "object" || value === null) return false;
|
|
93001
|
+
const v = value;
|
|
93002
|
+
return typeof v["state"] === "string" && typeof v["connectedHere"] === "boolean" && typeof v["agent"] === "object" && typeof v["org"] === "object" && typeof v["workspace"] === "object";
|
|
93003
|
+
}
|
|
93004
|
+
async function defaultPreview(apiUrl, token, machineId2) {
|
|
93005
|
+
const answer = await post(apiUrl, "/v1/enrollment/request", {
|
|
93006
|
+
token,
|
|
93007
|
+
machineId: machineId2
|
|
93008
|
+
});
|
|
93009
|
+
if (!isPreview(answer))
|
|
93010
|
+
throw new RequestUnreachable("Oxagen's answer was not a request.");
|
|
93011
|
+
return answer;
|
|
93012
|
+
}
|
|
93013
|
+
async function defaultReject(apiUrl, token, code) {
|
|
93014
|
+
await post(apiUrl, "/v1/enrollment/request/reject", { token, code });
|
|
93015
|
+
}
|
|
93016
|
+
async function defaultEnroll(opts, writer) {
|
|
93017
|
+
const { defaultCliDeps: defaultCliDeps2, enroll: enroll2, oxagenRuntimeCommands: oxagenRuntimeCommands2 } = await Promise.resolve().then(() => (init_cli2(), cli_exports));
|
|
93018
|
+
const deps = {
|
|
93019
|
+
...defaultCliDeps2({
|
|
93020
|
+
out: (line) => writer.write(line),
|
|
93021
|
+
err: (line) => writer.writeErr(line),
|
|
93022
|
+
runtime: oxagenRuntimeCommands2()
|
|
93023
|
+
}),
|
|
93024
|
+
getuid: () => process.getuid?.()
|
|
93025
|
+
};
|
|
93026
|
+
const result2 = await enroll2(
|
|
93027
|
+
{
|
|
93028
|
+
enrollmentToken: opts.token,
|
|
93029
|
+
apiUrl: opts.apiUrl,
|
|
93030
|
+
harnesses: [opts.harness],
|
|
93031
|
+
machineId: opts.machineId
|
|
93032
|
+
},
|
|
93033
|
+
deps
|
|
93034
|
+
);
|
|
93035
|
+
return result2.ok && result2.shipping?.healthy !== false;
|
|
93036
|
+
}
|
|
93037
|
+
async function defaultConfirm(question) {
|
|
93038
|
+
const { createInterface: createInterface5 } = await import("node:readline/promises");
|
|
93039
|
+
const rl = createInterface5({ input: process.stdin, output: process.stdout });
|
|
93040
|
+
try {
|
|
93041
|
+
const answer = await rl.question(`${question} [y/N] `);
|
|
93042
|
+
return /^y(es)?$/i.test(answer.trim());
|
|
93043
|
+
} finally {
|
|
93044
|
+
rl.close();
|
|
93045
|
+
}
|
|
93046
|
+
}
|
|
93047
|
+
function isDeviceHarness(harness) {
|
|
93048
|
+
return DEVICE_HARNESSES.includes(harness);
|
|
93049
|
+
}
|
|
93050
|
+
function closedMessage(state) {
|
|
93051
|
+
switch (state) {
|
|
93052
|
+
case "expired":
|
|
93053
|
+
return "This request expired. Create a new one on the page, then run the command it shows.";
|
|
93054
|
+
case "replaced":
|
|
93055
|
+
return "A newer request for this agent replaced this one. Run the command the page shows now.";
|
|
93056
|
+
case "type_changed":
|
|
93057
|
+
return "The agent's type changed after this request was made. Create a new request on the page.";
|
|
93058
|
+
default:
|
|
93059
|
+
return void 0;
|
|
93060
|
+
}
|
|
93061
|
+
}
|
|
93062
|
+
async function agentConnect(opts, writer = stdoutWriter, deps = {}) {
|
|
93063
|
+
const out = createOutput({ json: opts.json }, writer);
|
|
93064
|
+
const token = opts.request.trim();
|
|
93065
|
+
if (!REQUEST_TOKEN.test(token))
|
|
93066
|
+
return out.error(
|
|
93067
|
+
"That is not a connection request. Copy the whole command from the page, starting with oxagen agent connect.",
|
|
93068
|
+
"usage"
|
|
93069
|
+
);
|
|
93070
|
+
const apiUrl = opts.apiUrl ?? getApiUrl();
|
|
93071
|
+
const device = {
|
|
93072
|
+
hostname: (deps.hostname ?? hostname)(),
|
|
93073
|
+
platform: (deps.platform ?? platform)(),
|
|
93074
|
+
osVersion: (deps.osVersion ?? release2)(),
|
|
93075
|
+
machineId: (deps.machineId ?? (() => machineId()))()
|
|
93076
|
+
};
|
|
93077
|
+
const folder = opts.folder ?? (deps.cwd ?? (() => process.cwd()))();
|
|
93078
|
+
const reject = deps.reject ?? defaultReject;
|
|
93079
|
+
const refuse3 = async (code) => {
|
|
93080
|
+
try {
|
|
93081
|
+
await reject(apiUrl, token, code);
|
|
93082
|
+
} catch (err2) {
|
|
93083
|
+
out.warn(`Could not tell Oxagen why: ${errorMessage3(err2)}`);
|
|
93084
|
+
}
|
|
93085
|
+
};
|
|
93086
|
+
let preview;
|
|
93087
|
+
try {
|
|
93088
|
+
preview = await (deps.preview ?? defaultPreview)(
|
|
93089
|
+
apiUrl,
|
|
93090
|
+
token,
|
|
93091
|
+
device.machineId
|
|
93092
|
+
);
|
|
93093
|
+
} catch (err2) {
|
|
93094
|
+
if (err2 instanceof RequestRefused)
|
|
93095
|
+
return out.error(err2.message, err2.reason ?? "request_refused");
|
|
93096
|
+
return out.error(
|
|
93097
|
+
`Could not reach Oxagen at ${apiUrl}: ${errorMessage3(err2)}. Check this device's connection, then run the command again.`,
|
|
93098
|
+
"lost_connection"
|
|
93099
|
+
);
|
|
93100
|
+
}
|
|
93101
|
+
const ref = `${preview.org.slug}/${preview.workspace.slug}`;
|
|
93102
|
+
const label = isDeviceHarness(preview.agent.harness) ? harnessLabel(preview.agent.harness) : preview.agent.harness;
|
|
93103
|
+
if (preview.state === "connected") {
|
|
93104
|
+
if (!preview.connectedHere)
|
|
93105
|
+
return out.error(
|
|
93106
|
+
"Another device already answered this request. Create a new request on the page to connect this one.",
|
|
93107
|
+
"token_used"
|
|
93108
|
+
);
|
|
93109
|
+
if (out.isJson) {
|
|
93110
|
+
out.data({
|
|
93111
|
+
state: "connected",
|
|
93112
|
+
alreadyConnected: true,
|
|
93113
|
+
device,
|
|
93114
|
+
agent: preview.agent,
|
|
93115
|
+
workspace: ref
|
|
93116
|
+
});
|
|
93117
|
+
return;
|
|
93118
|
+
}
|
|
93119
|
+
writer.write(
|
|
93120
|
+
`${device.hostname} is already connected to ${ref} as ${preview.agent.name}. Nothing changed.`
|
|
93121
|
+
);
|
|
93122
|
+
return;
|
|
93123
|
+
}
|
|
93124
|
+
const closed2 = closedMessage(preview.state);
|
|
93125
|
+
if (closed2 !== void 0) return out.error(closed2, preview.state);
|
|
93126
|
+
if (!isDeviceHarness(preview.agent.harness)) {
|
|
93127
|
+
await refuse3("unsupported_type");
|
|
93128
|
+
return out.error(
|
|
93129
|
+
`A ${label} agent cannot run on a device. Pick Claude Code, Codex, Cursor, or Stella on the page.`,
|
|
93130
|
+
"unsupported_type"
|
|
93131
|
+
);
|
|
93132
|
+
}
|
|
93133
|
+
const harness = preview.agent.harness;
|
|
93134
|
+
let installed;
|
|
93135
|
+
try {
|
|
93136
|
+
installed = (await (deps.detect ?? detectHarnesses)()).find(
|
|
93137
|
+
(h) => h.harness === harness
|
|
93138
|
+
);
|
|
93139
|
+
} catch (err2) {
|
|
93140
|
+
return out.error(
|
|
93141
|
+
`Could not look for ${label} on this device: ${errorMessage3(err2)}`,
|
|
93142
|
+
"detect"
|
|
93143
|
+
);
|
|
93144
|
+
}
|
|
93145
|
+
if (installed === void 0) {
|
|
93146
|
+
await refuse3("adapter_missing");
|
|
93147
|
+
return out.error(
|
|
93148
|
+
`${label} is not installed on ${device.hostname}. Install it, then run the command again.`,
|
|
93149
|
+
"adapter_missing"
|
|
93150
|
+
);
|
|
93151
|
+
}
|
|
93152
|
+
const interactive = (deps.isTty ?? (() => process.stdin.isTTY === true))() && !out.isJson;
|
|
93153
|
+
const confirm = deps.confirm ?? defaultConfirm;
|
|
93154
|
+
const active2 = (deps.activeWorkspace ?? (() => {
|
|
93155
|
+
const org = getOrgId();
|
|
93156
|
+
const workspace = getWorkspaceId();
|
|
93157
|
+
return org && workspace ? `${org}/${workspace}` : void 0;
|
|
93158
|
+
}))();
|
|
93159
|
+
if (active2 !== void 0 && active2 !== ref && opts.yes !== true) {
|
|
93160
|
+
const proceed = interactive && await confirm(
|
|
93161
|
+
`This device works in ${active2}, and the request is for ${ref}. Connect it to ${ref} anyway?`
|
|
93162
|
+
);
|
|
93163
|
+
if (!proceed) {
|
|
93164
|
+
await refuse3("wrong_workspace");
|
|
93165
|
+
return out.error(
|
|
93166
|
+
`The request is for ${ref}, and this device works in ${active2}. Run \`oxagen workspace use ${ref}\`, then run this command again, or pass --yes to connect anyway.`,
|
|
93167
|
+
"wrong_workspace"
|
|
93168
|
+
);
|
|
93169
|
+
}
|
|
93170
|
+
}
|
|
93171
|
+
if (opts.yes !== true) {
|
|
93172
|
+
if (!interactive)
|
|
93173
|
+
return out.error(
|
|
93174
|
+
"Pass --yes to connect without a terminal to confirm in.",
|
|
93175
|
+
"usage"
|
|
93176
|
+
);
|
|
93177
|
+
const yes = await confirm(
|
|
93178
|
+
`Connect ${device.hostname} to ${preview.org.name} / ${preview.workspace.name} as ${preview.agent.name} (${label}), working in ${folder}?`
|
|
93179
|
+
);
|
|
93180
|
+
if (!yes) {
|
|
93181
|
+
await refuse3("declined");
|
|
93182
|
+
return out.error(
|
|
93183
|
+
"Nothing was connected. Run the command again when you are ready.",
|
|
93184
|
+
"declined"
|
|
93185
|
+
);
|
|
93186
|
+
}
|
|
93187
|
+
}
|
|
93188
|
+
const lines = [];
|
|
93189
|
+
const warnings = [];
|
|
93190
|
+
const captured = {
|
|
93191
|
+
write: (line) => void lines.push(line),
|
|
93192
|
+
writeErr: (line) => {
|
|
93193
|
+
lines.push(line);
|
|
93194
|
+
warnings.push(line);
|
|
93195
|
+
}
|
|
93196
|
+
};
|
|
93197
|
+
let ok;
|
|
93198
|
+
try {
|
|
93199
|
+
ok = await (deps.enroll ?? defaultEnroll)(
|
|
93200
|
+
{ apiUrl, token, harness, machineId: device.machineId },
|
|
93201
|
+
captured
|
|
93202
|
+
);
|
|
93203
|
+
} catch (err2) {
|
|
93204
|
+
lines.push(errorMessage3(err2));
|
|
93205
|
+
ok = false;
|
|
93206
|
+
}
|
|
93207
|
+
if (!ok) {
|
|
93208
|
+
for (const line of lines) if (line.trim() !== "") writer.writeErr(line);
|
|
93209
|
+
return out.error(
|
|
93210
|
+
`${device.hostname} could not connect to ${ref}. The lines above say why.`,
|
|
93211
|
+
"enroll"
|
|
93212
|
+
);
|
|
93213
|
+
}
|
|
93214
|
+
if (out.isJson) {
|
|
93215
|
+
out.data({
|
|
93216
|
+
state: "connected",
|
|
93217
|
+
alreadyConnected: false,
|
|
93218
|
+
device,
|
|
93219
|
+
agent: preview.agent,
|
|
93220
|
+
workspace: ref,
|
|
93221
|
+
adapter: { harness, path: installed.path },
|
|
93222
|
+
folder
|
|
93223
|
+
});
|
|
93224
|
+
return;
|
|
93225
|
+
}
|
|
93226
|
+
writer.write(
|
|
93227
|
+
`Connected ${device.hostname} to ${ref} as ${preview.agent.name}.`
|
|
93228
|
+
);
|
|
93229
|
+
writer.write(
|
|
93230
|
+
` Device: ${device.hostname} (${device.platform} ${device.osVersion})`
|
|
93231
|
+
);
|
|
93232
|
+
writer.write(` Machine id: ${device.machineId}`);
|
|
93233
|
+
writer.write(` Agent type: ${label}, at ${installed.path}`);
|
|
93234
|
+
writer.write(` Working folder: ${folder}`);
|
|
93235
|
+
for (const line of warnings)
|
|
93236
|
+
if (line.trim() !== "") writer.writeErr(` ${line}`);
|
|
93237
|
+
writer.write("The page shows this device now.");
|
|
93238
|
+
}
|
|
93239
|
+
var REQUEST_TOKEN, DEVICE_HARNESSES, REQUEST_TIMEOUT_MS, RequestUnreachable, RequestRefused;
|
|
93240
|
+
var init_agent_connect = __esm({
|
|
93241
|
+
"src/commands/agent-connect.ts"() {
|
|
93242
|
+
init_capture_writer();
|
|
93243
|
+
init_config();
|
|
93244
|
+
init_harnesses();
|
|
93245
|
+
init_output();
|
|
93246
|
+
init_working_copy();
|
|
93247
|
+
REQUEST_TOKEN = /^oxe_1time_[0-9a-hjkmnp-tv-z]{26}$/;
|
|
93248
|
+
DEVICE_HARNESSES = [
|
|
93249
|
+
"claude-code",
|
|
93250
|
+
"codex",
|
|
93251
|
+
"cursor",
|
|
93252
|
+
"stella"
|
|
93253
|
+
];
|
|
93254
|
+
REQUEST_TIMEOUT_MS = 15e3;
|
|
93255
|
+
RequestUnreachable = class extends Error {
|
|
93256
|
+
};
|
|
93257
|
+
RequestRefused = class extends Error {
|
|
93258
|
+
constructor(status2, reason3, message2) {
|
|
93259
|
+
super(message2);
|
|
93260
|
+
this.status = status2;
|
|
93261
|
+
this.reason = reason3;
|
|
93262
|
+
}
|
|
93263
|
+
status;
|
|
93264
|
+
reason;
|
|
93265
|
+
};
|
|
93266
|
+
}
|
|
93267
|
+
});
|
|
93268
|
+
|
|
92769
93269
|
// src/commands/agent-enroll.ts
|
|
92770
93270
|
var agent_enroll_exports = {};
|
|
92771
93271
|
__export(agent_enroll_exports, {
|
|
@@ -92816,7 +93316,7 @@ var machine_register_exports = {};
|
|
|
92816
93316
|
__export(machine_register_exports, {
|
|
92817
93317
|
machineRegister: () => machineRegister
|
|
92818
93318
|
});
|
|
92819
|
-
import { hostname } from "node:os";
|
|
93319
|
+
import { hostname as hostname2 } from "node:os";
|
|
92820
93320
|
function isMachineHarness(name2) {
|
|
92821
93321
|
return Object.keys(MACHINE_HARNESSES).includes(name2);
|
|
92822
93322
|
}
|
|
@@ -92848,7 +93348,7 @@ async function machineRegister(opts, writer = stdoutWriter, deps = {}) {
|
|
|
92848
93348
|
);
|
|
92849
93349
|
return refused2;
|
|
92850
93350
|
}
|
|
92851
|
-
const machineName = (opts.machineName ?? (deps.hostname ??
|
|
93351
|
+
const machineName = (opts.machineName ?? (deps.hostname ?? hostname2)()).trim();
|
|
92852
93352
|
if (machineName === "") {
|
|
92853
93353
|
out.error(
|
|
92854
93354
|
opts.machineName === void 0 ? "This machine reports no host name. Pass --machine-name <name>." : "--machine-name is empty. Pass the machine's host name.",
|
|
@@ -93140,7 +93640,7 @@ __export(workspace_exports, {
|
|
|
93140
93640
|
workspaceList: () => workspaceList,
|
|
93141
93641
|
workspaceUse: () => workspaceUse
|
|
93142
93642
|
});
|
|
93143
|
-
import { hostname as
|
|
93643
|
+
import { hostname as hostname3 } from "node:os";
|
|
93144
93644
|
function holdsHarness(enrollment, harness) {
|
|
93145
93645
|
return enrollment.harnesses.includes(harness);
|
|
93146
93646
|
}
|
|
@@ -93439,7 +93939,7 @@ async function workspaceConnect(argument, opts, writer = stdoutWriter, deps = {}
|
|
|
93439
93939
|
if (!await lookupWorkspace(target, out)) return;
|
|
93440
93940
|
const harnesses = await harnessesToConnect(opts, ref, interactive, deps, out);
|
|
93441
93941
|
if (!harnesses) return;
|
|
93442
|
-
const machineName = (opts.machineName ?? (deps.hostname ??
|
|
93942
|
+
const machineName = (opts.machineName ?? (deps.hostname ?? hostname3)()).trim();
|
|
93443
93943
|
const enrollments = await enrollmentsOrWarn(deps, out);
|
|
93444
93944
|
const register = deps.register ?? ((o, w) => machineRegister(o, w));
|
|
93445
93945
|
const results = [];
|
|
@@ -96262,13 +96762,17 @@ var init_finding_shared = __esm({
|
|
|
96262
96762
|
"retry_loops",
|
|
96263
96763
|
"commits_never_shipped",
|
|
96264
96764
|
"overpowered_prompts",
|
|
96265
|
-
"underpowered_prompts"
|
|
96765
|
+
"underpowered_prompts",
|
|
96766
|
+
"repeated_refusals",
|
|
96767
|
+
"recurring_setup_failures",
|
|
96768
|
+
"failing_tool_calls"
|
|
96266
96769
|
]);
|
|
96267
96770
|
findingLevelSchema = external_exports.enum([
|
|
96268
96771
|
"tool",
|
|
96269
96772
|
"agent",
|
|
96270
96773
|
"operator",
|
|
96271
|
-
"workspace"
|
|
96774
|
+
"workspace",
|
|
96775
|
+
"repository"
|
|
96272
96776
|
]);
|
|
96273
96777
|
findingConfidenceSchema = external_exports.enum(["high", "medium"]);
|
|
96274
96778
|
findingStatusSchema = external_exports.enum(["open", "applied", "dismissed"]);
|
|
@@ -98132,7 +98636,7 @@ async function findingsList(opts, writer = stdoutWriter) {
|
|
|
98132
98636
|
if (opts.level !== void 0 && !isLevel(opts.level)) {
|
|
98133
98637
|
process.exitCode = 2;
|
|
98134
98638
|
out.error(
|
|
98135
|
-
`Invalid --level "${opts.level}". Use tool, agent, operator or
|
|
98639
|
+
`Invalid --level "${opts.level}". Use tool, agent, operator, workspace or repository.`,
|
|
98136
98640
|
"usage"
|
|
98137
98641
|
);
|
|
98138
98642
|
return;
|
|
@@ -98235,7 +98739,13 @@ var init_findings = __esm({
|
|
|
98235
98739
|
init_capture_writer();
|
|
98236
98740
|
init_output();
|
|
98237
98741
|
STATUSES = ["open", "applied", "dismissed"];
|
|
98238
|
-
LEVELS = [
|
|
98742
|
+
LEVELS = [
|
|
98743
|
+
"tool",
|
|
98744
|
+
"agent",
|
|
98745
|
+
"operator",
|
|
98746
|
+
"workspace",
|
|
98747
|
+
"repository"
|
|
98748
|
+
];
|
|
98239
98749
|
CURSOR_MAX = 256;
|
|
98240
98750
|
SUBJECT_MAX = 256;
|
|
98241
98751
|
FRAMES_SHOWN = 5;
|
|
@@ -101315,7 +101825,7 @@ var init_json_text = __esm({
|
|
|
101315
101825
|
});
|
|
101316
101826
|
|
|
101317
101827
|
// ../../packages/run-evidence/src/digest.ts
|
|
101318
|
-
import { createHash as
|
|
101828
|
+
import { createHash as createHash28 } from "node:crypto";
|
|
101319
101829
|
function intrinsicHashMethod(name2) {
|
|
101320
101830
|
const method = Object.getOwnPropertyDescriptor(
|
|
101321
101831
|
intrinsicHashPrototype,
|
|
@@ -101338,7 +101848,7 @@ function sha256Digest(bytes) {
|
|
|
101338
101848
|
if (!(bytes instanceof intrinsicUint8ArrayConstructor)) {
|
|
101339
101849
|
throw new TypeError("sha256Digest requires exact bytes");
|
|
101340
101850
|
}
|
|
101341
|
-
const hash4 =
|
|
101851
|
+
const hash4 = createHash28("sha256");
|
|
101342
101852
|
Reflect.apply(intrinsicHashUpdate, hash4, [bytes]);
|
|
101343
101853
|
const hex = Reflect.apply(intrinsicHashDigest, hash4, ["hex"]);
|
|
101344
101854
|
return `sha256:${hex}`;
|
|
@@ -101357,7 +101867,7 @@ var init_digest3 = __esm({
|
|
|
101357
101867
|
intrinsicTextEncoderEncode = TextEncoder.prototype.encode;
|
|
101358
101868
|
intrinsicUint8ArrayConstructor = Uint8Array;
|
|
101359
101869
|
intrinsicHashPrototype = Object.getPrototypeOf(
|
|
101360
|
-
|
|
101870
|
+
createHash28("sha256")
|
|
101361
101871
|
);
|
|
101362
101872
|
intrinsicHashUpdate = intrinsicHashMethod("update");
|
|
101363
101873
|
intrinsicHashDigest = intrinsicHashMethod("digest");
|
|
@@ -106681,6 +107191,17 @@ function isHighEntropyBlob(token) {
|
|
|
106681
107191
|
if (!/^[A-Za-z0-9_\-+~]+$/.test(token)) return false;
|
|
106682
107192
|
return /[A-Z]/.test(token) && /[a-z]/.test(token) && /[0-9]/.test(token);
|
|
106683
107193
|
}
|
|
107194
|
+
function isVendorToken(token) {
|
|
107195
|
+
if (VENDOR_FORMATS.some((format) => format.test(token))) return true;
|
|
107196
|
+
return SECRET_PREFIXES.some((p) => {
|
|
107197
|
+
if (!token.startsWith(p)) return false;
|
|
107198
|
+
const tail = token.slice(p.length);
|
|
107199
|
+
return tail.length >= 16 && /[0-9]/.test(tail);
|
|
107200
|
+
});
|
|
107201
|
+
}
|
|
107202
|
+
function hasCredentialPiece(token) {
|
|
107203
|
+
return token.split(TOKEN_PIECES).some((piece) => isVendorToken(piece) || isJwt(piece));
|
|
107204
|
+
}
|
|
106684
107205
|
function isSecretToken(token) {
|
|
106685
107206
|
if (token.length < 8) return false;
|
|
106686
107207
|
if (SECRET_PREFIXES.some(
|
|
@@ -106709,7 +107230,7 @@ function findSecretsAndPii(text6) {
|
|
|
106709
107230
|
if (/-----BEGIN [A-Z ]*PRIVATE KEY-----/.test(text6))
|
|
106710
107231
|
findings.push("private key block");
|
|
106711
107232
|
for (const token of text6.match(TOKEN2) ?? []) {
|
|
106712
|
-
if (isSecretToken(token)) {
|
|
107233
|
+
if (isSecretToken(token) || hasCredentialPiece(token)) {
|
|
106713
107234
|
findings.push("credential token");
|
|
106714
107235
|
break;
|
|
106715
107236
|
}
|
|
@@ -106735,7 +107256,7 @@ function findSecretsAndPii(text6) {
|
|
|
106735
107256
|
}
|
|
106736
107257
|
return findings;
|
|
106737
107258
|
}
|
|
106738
|
-
var SECRET_PREFIXES, SENSITIVE_KEY_MARKERS, TOKEN2;
|
|
107259
|
+
var SECRET_PREFIXES, SENSITIVE_KEY_MARKERS, TOKEN2, TOKEN_PIECES, VENDOR_FORMATS;
|
|
106739
107260
|
var init_secrets2 = __esm({
|
|
106740
107261
|
"../../packages/steering-check/src/secrets.ts"() {
|
|
106741
107262
|
"use strict";
|
|
@@ -106787,6 +107308,23 @@ var init_secrets2 = __esm({
|
|
|
106787
107308
|
"client_secret"
|
|
106788
107309
|
];
|
|
106789
107310
|
TOKEN2 = /[A-Za-z0-9_\-./+~]+/g;
|
|
107311
|
+
TOKEN_PIECES = /\//;
|
|
107312
|
+
VENDOR_FORMATS = [
|
|
107313
|
+
// AWS access key ids.
|
|
107314
|
+
/^(?:AKIA|ASIA)[A-Z0-9]{16}(?![A-Za-z0-9])/,
|
|
107315
|
+
// GitHub classic tokens and fine-grained personal access tokens.
|
|
107316
|
+
/^gh[pousr]_[A-Za-z0-9]{36}(?![A-Za-z0-9])/,
|
|
107317
|
+
/^github_pat_[A-Za-z0-9_]{22,}/,
|
|
107318
|
+
// GitLab personal access tokens.
|
|
107319
|
+
/^glpat-[A-Za-z0-9_-]{20}(?![A-Za-z0-9_-])/,
|
|
107320
|
+
// Slack tokens.
|
|
107321
|
+
/^xox[abposr]-[A-Za-z0-9-]{10,}/,
|
|
107322
|
+
// Stripe live secret and restricted keys.
|
|
107323
|
+
/^(?:sk|rk)_live_[A-Za-z0-9]{16,}/,
|
|
107324
|
+
// Anthropic and OpenAI project keys.
|
|
107325
|
+
/^sk-ant-[A-Za-z0-9_-]{20,}/,
|
|
107326
|
+
/^sk-proj-[A-Za-z0-9_-]{20,}/
|
|
107327
|
+
];
|
|
106790
107328
|
}
|
|
106791
107329
|
});
|
|
106792
107330
|
|
|
@@ -107428,8 +107966,8 @@ import {
|
|
|
107428
107966
|
dirname as dirname35,
|
|
107429
107967
|
isAbsolute as isAbsolute18,
|
|
107430
107968
|
relative as relative8,
|
|
107431
|
-
resolve as
|
|
107432
|
-
sep as
|
|
107969
|
+
resolve as resolve25,
|
|
107970
|
+
sep as sep11
|
|
107433
107971
|
} from "node:path";
|
|
107434
107972
|
function inside(rel) {
|
|
107435
107973
|
return rel !== "" && !rel.startsWith("..") && !isAbsolute18(rel);
|
|
@@ -107437,9 +107975,9 @@ function inside(rel) {
|
|
|
107437
107975
|
function importFilename(path2, folder) {
|
|
107438
107976
|
let rel = relative8(process.cwd(), path2);
|
|
107439
107977
|
if (!inside(rel) && folder !== void 0) {
|
|
107440
|
-
rel = relative8(dirname35(
|
|
107978
|
+
rel = relative8(dirname35(resolve25(folder)), resolve25(path2));
|
|
107441
107979
|
}
|
|
107442
|
-
const name2 = inside(rel) ? rel.split(
|
|
107980
|
+
const name2 = inside(rel) ? rel.split(sep11).join("/") : basename10(path2);
|
|
107443
107981
|
return name2.length > 256 ? basename10(path2).slice(-256) : name2;
|
|
107444
107982
|
}
|
|
107445
107983
|
async function readImportDocuments(sources, target, writer) {
|
|
@@ -107731,43 +108269,43 @@ __export(steering_import_exports, {
|
|
|
107731
108269
|
harnessHome: () => harnessHome
|
|
107732
108270
|
});
|
|
107733
108271
|
import { readdir as readdir5, realpath as realpath3, stat as stat5 } from "node:fs/promises";
|
|
107734
|
-
import { homedir as
|
|
107735
|
-
import { basename as basename11, extname, join as
|
|
108272
|
+
import { homedir as homedir13 } from "node:os";
|
|
108273
|
+
import { basename as basename11, extname, join as join67, relative as relative9, sep as sep12 } from "node:path";
|
|
107736
108274
|
function envDir2(env, key) {
|
|
107737
108275
|
const value = env[key];
|
|
107738
108276
|
return value === void 0 || value.trim() === "" ? null : value;
|
|
107739
108277
|
}
|
|
107740
|
-
function harnessHome(harness, env = process.env, home =
|
|
108278
|
+
function harnessHome(harness, env = process.env, home = homedir13()) {
|
|
107741
108279
|
switch (harness) {
|
|
107742
108280
|
case "claude-code": {
|
|
107743
|
-
const config2 = envDir2(env, "CLAUDE_CONFIG_DIR") ??
|
|
108281
|
+
const config2 = envDir2(env, "CLAUDE_CONFIG_DIR") ?? join67(home, ".claude");
|
|
107744
108282
|
return {
|
|
107745
108283
|
harness,
|
|
107746
108284
|
folders: [
|
|
107747
108285
|
{
|
|
107748
|
-
dir: skillsRoot("claude-code", env, home) ??
|
|
108286
|
+
dir: skillsRoot("claude-code", env, home) ?? join67(config2, "skills"),
|
|
107749
108287
|
mount: ".claude/skills"
|
|
107750
108288
|
},
|
|
107751
|
-
{ dir:
|
|
107752
|
-
{ dir:
|
|
108289
|
+
{ dir: join67(config2, "commands"), mount: ".claude/commands" },
|
|
108290
|
+
{ dir: join67(config2, "agents"), mount: ".claude/agents" }
|
|
107753
108291
|
],
|
|
107754
108292
|
instructions: [
|
|
107755
|
-
{ file:
|
|
108293
|
+
{ file: join67(config2, "CLAUDE.md"), filename: ".claude/CLAUDE.md" }
|
|
107756
108294
|
]
|
|
107757
108295
|
};
|
|
107758
108296
|
}
|
|
107759
108297
|
case "codex": {
|
|
107760
|
-
const codexHome = envDir2(env, "CODEX_HOME") ??
|
|
108298
|
+
const codexHome = envDir2(env, "CODEX_HOME") ?? join67(home, ".codex");
|
|
107761
108299
|
return {
|
|
107762
108300
|
harness,
|
|
107763
108301
|
folders: [
|
|
107764
108302
|
{
|
|
107765
|
-
dir: skillsRoot("codex", env, home) ??
|
|
108303
|
+
dir: skillsRoot("codex", env, home) ?? join67(home, ".agents", "skills"),
|
|
107766
108304
|
mount: ".agents/skills"
|
|
107767
108305
|
}
|
|
107768
108306
|
],
|
|
107769
108307
|
instructions: ["AGENTS.override.md", "AGENTS.md"].map((name2) => ({
|
|
107770
|
-
file:
|
|
108308
|
+
file: join67(codexHome, name2),
|
|
107771
108309
|
filename: `.codex/${name2}`
|
|
107772
108310
|
}))
|
|
107773
108311
|
};
|
|
@@ -107776,8 +108314,8 @@ function harnessHome(harness, env = process.env, home = homedir12()) {
|
|
|
107776
108314
|
return {
|
|
107777
108315
|
harness,
|
|
107778
108316
|
folders: [
|
|
107779
|
-
{ dir:
|
|
107780
|
-
{ dir:
|
|
108317
|
+
{ dir: join67(home, ".cursor", "skills"), mount: ".cursor/skills" },
|
|
108318
|
+
{ dir: join67(home, ".cursor", "commands"), mount: ".cursor/commands" }
|
|
107781
108319
|
],
|
|
107782
108320
|
instructions: []
|
|
107783
108321
|
};
|
|
@@ -107787,7 +108325,7 @@ function byName(a, b3) {
|
|
|
107787
108325
|
return a.name < b3.name ? -1 : 1;
|
|
107788
108326
|
}
|
|
107789
108327
|
function under(root, path2) {
|
|
107790
|
-
return relative9(root, path2).split(
|
|
108328
|
+
return relative9(root, path2).split(sep12).join("/");
|
|
107791
108329
|
}
|
|
107792
108330
|
function isPersonal(rel) {
|
|
107793
108331
|
return classifyHarnessFile(rel)?.kind === "personal";
|
|
@@ -107823,7 +108361,7 @@ async function findMarkdownFiles(paths, harness) {
|
|
|
107823
108361
|
}
|
|
107824
108362
|
const found = [];
|
|
107825
108363
|
for (const entry2 of entries2.sort(byName)) {
|
|
107826
|
-
const path2 =
|
|
108364
|
+
const path2 = join67(dir, entry2.name);
|
|
107827
108365
|
if (entry2.isDirectory()) {
|
|
107828
108366
|
if (!entry2.name.startsWith(".") && entry2.name !== "node_modules")
|
|
107829
108367
|
found.push(...await filesUnder(path2, from));
|
|
@@ -107845,7 +108383,7 @@ async function findMarkdownFiles(paths, harness) {
|
|
|
107845
108383
|
const { folder } = frame2;
|
|
107846
108384
|
const named = (rel) => frame2.fixedNames ? { filename: rel } : {};
|
|
107847
108385
|
for (const entry2 of entries2) {
|
|
107848
|
-
const path2 =
|
|
108386
|
+
const path2 = join67(dir, entry2.name);
|
|
107849
108387
|
const rel = frame2.relOf(path2);
|
|
107850
108388
|
if (entry2.isDirectory()) {
|
|
107851
108389
|
if (entry2.name === "node_modules") continue;
|
|
@@ -107904,7 +108442,7 @@ async function findMarkdownFiles(paths, harness) {
|
|
|
107904
108442
|
}
|
|
107905
108443
|
if (folderGiven) {
|
|
107906
108444
|
const catalogue = CATALOGUE_FOLDERS.has(basename11(path2));
|
|
107907
|
-
const root = catalogue ?
|
|
108445
|
+
const root = catalogue ? join67(path2, "..") : path2;
|
|
107908
108446
|
await walk2(path2, {
|
|
107909
108447
|
relOf: (p) => under(root, p),
|
|
107910
108448
|
folder: path2,
|
|
@@ -107965,7 +108503,7 @@ function parseTarget(value, writer) {
|
|
|
107965
108503
|
writer
|
|
107966
108504
|
);
|
|
107967
108505
|
}
|
|
107968
|
-
async function handleSteeringImport(paths, opts, writer = stdoutWriter, env = process.env, home =
|
|
108506
|
+
async function handleSteeringImport(paths, opts, writer = stdoutWriter, env = process.env, home = homedir13()) {
|
|
107969
108507
|
const harness = parseHarness(opts.harness, writer);
|
|
107970
108508
|
if (paths.length === 0 && harness === void 0) {
|
|
107971
108509
|
failCommand(
|
|
@@ -108969,9 +109507,9 @@ __export(run_exports, {
|
|
|
108969
109507
|
runTurns: () => runTurns,
|
|
108970
109508
|
writeColumns: () => writeColumns
|
|
108971
109509
|
});
|
|
108972
|
-
import { createHash as
|
|
109510
|
+
import { createHash as createHash29 } from "node:crypto";
|
|
108973
109511
|
import { createWriteStream, renameSync as renameSync8, rmSync as rmSync13 } from "node:fs";
|
|
108974
|
-
import { resolve as
|
|
109512
|
+
import { resolve as resolve26 } from "node:path";
|
|
108975
109513
|
import { Readable as Readable2 } from "node:stream";
|
|
108976
109514
|
import { pipeline as pipeline2 } from "node:stream/promises";
|
|
108977
109515
|
async function runExport(runId, opts = {}, writer = stdoutWriter) {
|
|
@@ -109069,9 +109607,9 @@ async function runDownload(exportId, opts = {}, writer = stdoutWriter) {
|
|
|
109069
109607
|
return;
|
|
109070
109608
|
}
|
|
109071
109609
|
const url2 = resolveDownloadUrl(status2.download.url, getApiUrl());
|
|
109072
|
-
const path2 =
|
|
109610
|
+
const path2 = resolve26(opts.out ?? `${status2.runId}-${exportId}.zip`);
|
|
109073
109611
|
const partial2 = `${path2}.${process.pid}.partial`;
|
|
109074
|
-
const hash4 =
|
|
109612
|
+
const hash4 = createHash29("sha256");
|
|
109075
109613
|
let size = 0;
|
|
109076
109614
|
let headerDigest;
|
|
109077
109615
|
const controller = new AbortController();
|
|
@@ -111033,10 +111571,10 @@ var init_esm2 = __esm({
|
|
|
111033
111571
|
};
|
|
111034
111572
|
deo = /* @__PURE__ */ new i322([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);
|
|
111035
111573
|
et = /* @__PURE__ */ new u82(0);
|
|
111036
|
-
dflt = function(dat, lvl, plvl, pre,
|
|
111574
|
+
dflt = function(dat, lvl, plvl, pre, post3, st) {
|
|
111037
111575
|
var s2 = st.z || dat.length;
|
|
111038
|
-
var o = new u82(pre + s2 + 5 * (1 + Math.ceil(s2 / 7e3)) +
|
|
111039
|
-
var w = o.subarray(pre, o.length -
|
|
111576
|
+
var o = new u82(pre + s2 + 5 * (1 + Math.ceil(s2 / 7e3)) + post3);
|
|
111577
|
+
var w = o.subarray(pre, o.length - post3);
|
|
111040
111578
|
var lst = st.l;
|
|
111041
111579
|
var pos = (st.r || 0) & 7;
|
|
111042
111580
|
if (lvl) {
|
|
@@ -111132,7 +111670,7 @@ var init_esm2 = __esm({
|
|
|
111132
111670
|
}
|
|
111133
111671
|
st.i = s2;
|
|
111134
111672
|
}
|
|
111135
|
-
return slc(o, 0, pre + shft(pos) +
|
|
111673
|
+
return slc(o, 0, pre + shft(pos) + post3);
|
|
111136
111674
|
};
|
|
111137
111675
|
crct = /* @__PURE__ */ (function() {
|
|
111138
111676
|
var t = new Int32Array(256);
|
|
@@ -111158,7 +111696,7 @@ var init_esm2 = __esm({
|
|
|
111158
111696
|
}
|
|
111159
111697
|
};
|
|
111160
111698
|
};
|
|
111161
|
-
dopt = function(dat, opt, pre,
|
|
111699
|
+
dopt = function(dat, opt, pre, post3, st) {
|
|
111162
111700
|
if (!st) {
|
|
111163
111701
|
st = { l: 1 };
|
|
111164
111702
|
if (opt.dictionary) {
|
|
@@ -111170,7 +111708,7 @@ var init_esm2 = __esm({
|
|
|
111170
111708
|
st.w = dict.length;
|
|
111171
111709
|
}
|
|
111172
111710
|
}
|
|
111173
|
-
return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20 : 12 + opt.mem, pre,
|
|
111711
|
+
return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20 : 12 + opt.mem, pre, post3, st);
|
|
111174
111712
|
};
|
|
111175
111713
|
mrg = function(a, b3) {
|
|
111176
111714
|
var o = {};
|
|
@@ -111330,14 +111868,14 @@ __export(verify_exports, {
|
|
|
111330
111868
|
writeVerifier: () => writeVerifier
|
|
111331
111869
|
});
|
|
111332
111870
|
import {
|
|
111333
|
-
existsSync as
|
|
111334
|
-
mkdirSync as
|
|
111335
|
-
readdirSync as
|
|
111336
|
-
readFileSync as
|
|
111871
|
+
existsSync as existsSync30,
|
|
111872
|
+
mkdirSync as mkdirSync14,
|
|
111873
|
+
readdirSync as readdirSync18,
|
|
111874
|
+
readFileSync as readFileSync31,
|
|
111337
111875
|
statSync as statSync20,
|
|
111338
|
-
writeFileSync as
|
|
111876
|
+
writeFileSync as writeFileSync11
|
|
111339
111877
|
} from "node:fs";
|
|
111340
|
-
import { dirname as dirname36, join as
|
|
111878
|
+
import { dirname as dirname36, join as join68 } from "node:path";
|
|
111341
111879
|
function isBundleName(name2) {
|
|
111342
111880
|
return BUNDLE_FILES.has(name2) || isClaimBundleName(name2);
|
|
111343
111881
|
}
|
|
@@ -111348,8 +111886,8 @@ function underOneFolder(name2) {
|
|
|
111348
111886
|
function readDirectoryEntries(dir) {
|
|
111349
111887
|
const entries2 = /* @__PURE__ */ new Map();
|
|
111350
111888
|
const walk2 = (folder, prefix) => {
|
|
111351
|
-
for (const entry2 of
|
|
111352
|
-
const path2 =
|
|
111889
|
+
for (const entry2 of readdirSync18(folder)) {
|
|
111890
|
+
const path2 = join68(folder, entry2);
|
|
111353
111891
|
const name2 = `${prefix}${entry2}`;
|
|
111354
111892
|
if (statSync20(path2).isDirectory()) {
|
|
111355
111893
|
if (prefix === "" && (entry2 === "heads" || entry2 === "trust"))
|
|
@@ -111358,7 +111896,7 @@ function readDirectoryEntries(dir) {
|
|
|
111358
111896
|
} else {
|
|
111359
111897
|
entries2.set(
|
|
111360
111898
|
name2,
|
|
111361
|
-
isBundleName(name2) ? new Uint8Array(
|
|
111899
|
+
isBundleName(name2) ? new Uint8Array(readFileSync31(path2)) : UNREAD
|
|
111362
111900
|
);
|
|
111363
111901
|
}
|
|
111364
111902
|
}
|
|
@@ -111370,7 +111908,7 @@ function readZipEntries(path2) {
|
|
|
111370
111908
|
let raw;
|
|
111371
111909
|
const skipped2 = [];
|
|
111372
111910
|
try {
|
|
111373
|
-
raw = unzipSync(new Uint8Array(
|
|
111911
|
+
raw = unzipSync(new Uint8Array(readFileSync31(path2)), {
|
|
111374
111912
|
filter: (file) => {
|
|
111375
111913
|
const inner = underOneFolder(file.name);
|
|
111376
111914
|
const read2 = file.originalSize <= MAX_ENTRY_BYTES && (isBundleName(file.name) || inner !== null && isBundleName(inner));
|
|
@@ -111402,7 +111940,7 @@ function readZipEntries(path2) {
|
|
|
111402
111940
|
return entries2;
|
|
111403
111941
|
}
|
|
111404
111942
|
function readBundleEntries(path2) {
|
|
111405
|
-
if (!
|
|
111943
|
+
if (!existsSync30(path2)) {
|
|
111406
111944
|
throw new BundleReadError(`${path2} does not exist.`);
|
|
111407
111945
|
}
|
|
111408
111946
|
return statSync20(path2).isDirectory() ? readDirectoryEntries(path2) : readZipEntries(path2);
|
|
@@ -111571,8 +112109,8 @@ async function verifyBundle3(bundle2, opts = {}, writer = stdoutWriter) {
|
|
|
111571
112109
|
process.exitCode = unpinned ? 3 : 1;
|
|
111572
112110
|
}
|
|
111573
112111
|
async function writeVerifier(path2, writer = stdoutWriter) {
|
|
111574
|
-
|
|
111575
|
-
|
|
112112
|
+
mkdirSync14(dirname36(path2), { recursive: true });
|
|
112113
|
+
writeFileSync11(path2, CLAIM_VERIFIER_SCRIPT, { mode: 420 });
|
|
111576
112114
|
writer.write(
|
|
111577
112115
|
`Wrote the claim export verifier to ${path2}. Run it with: node ${path2} <export directory> [the same flags as oxagen verify]`
|
|
111578
112116
|
);
|
|
@@ -111581,16 +112119,16 @@ async function writeSampleBundle(dir, writer = stdoutWriter) {
|
|
|
111581
112119
|
const { files: files2, pins } = buildSampleClaimBundle();
|
|
111582
112120
|
const zipped = {};
|
|
111583
112121
|
for (const [name2, bytes] of files2) {
|
|
111584
|
-
const path2 =
|
|
111585
|
-
|
|
111586
|
-
|
|
112122
|
+
const path2 = join68(dir, name2);
|
|
112123
|
+
mkdirSync14(dirname36(path2), { recursive: true });
|
|
112124
|
+
writeFileSync11(path2, bytes);
|
|
111587
112125
|
zipped[name2] = bytes;
|
|
111588
112126
|
}
|
|
111589
112127
|
const base2 = dir.replace(/\/+$/, "");
|
|
111590
112128
|
const zipPath = `${base2}.zip`;
|
|
111591
112129
|
const verifierPath = `${base2}-verify.mjs`;
|
|
111592
|
-
|
|
111593
|
-
|
|
112130
|
+
writeFileSync11(zipPath, zipSync(zipped, { level: 6 }));
|
|
112131
|
+
writeFileSync11(verifierPath, CLAIM_VERIFIER_SCRIPT, { mode: 420 });
|
|
111594
112132
|
const pinArgs = [
|
|
111595
112133
|
...pins.issuerKeys.map((k) => `--issuer-key ${k}`),
|
|
111596
112134
|
...pins.tsKeys.map((k) => `--ts-key ${k}`),
|
|
@@ -112716,7 +113254,7 @@ function datetime(args) {
|
|
|
112716
113254
|
const timeRegex2 = `${time3}(?:${opts.join("|")})`;
|
|
112717
113255
|
return new RegExp(`^${dateSource}T(?:${timeRegex2})$`);
|
|
112718
113256
|
}
|
|
112719
|
-
var cuid, cuid2, ulid2, xid, ksuid, nanoid, duration2, guid, uuid, email, _emoji, ipv4, ipv6, cidrv4, cidrv6, base64, base64url,
|
|
113257
|
+
var cuid, cuid2, ulid2, xid, ksuid, nanoid, duration2, guid, uuid, email, _emoji, ipv4, ipv6, cidrv4, cidrv6, base64, base64url, hostname4, e164, dateSource, date, string, bigint, integer2, number2, boolean, _null, lowercase, uppercase;
|
|
112720
113258
|
var init_regexes = __esm({
|
|
112721
113259
|
"../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/regexes.js"() {
|
|
112722
113260
|
cuid = /^[cC][^\s-]{8,}$/;
|
|
@@ -112740,7 +113278,7 @@ var init_regexes = __esm({
|
|
|
112740
113278
|
cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
112741
113279
|
base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
112742
113280
|
base64url = /^[A-Za-z0-9_-]*$/;
|
|
112743
|
-
|
|
113281
|
+
hostname4 = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
|
|
112744
113282
|
e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
|
|
112745
113283
|
dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
112746
113284
|
date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
@@ -113554,7 +114092,7 @@ var init_schemas3 = __esm({
|
|
|
113554
114092
|
code: "invalid_format",
|
|
113555
114093
|
format: "url",
|
|
113556
114094
|
note: "Invalid hostname",
|
|
113557
|
-
pattern:
|
|
114095
|
+
pattern: hostname4.source,
|
|
113558
114096
|
input: payload.value,
|
|
113559
114097
|
inst,
|
|
113560
114098
|
continue: !def.abort
|
|
@@ -123155,9 +123693,9 @@ var require_json_schema_traverse = __commonJS({
|
|
|
123155
123693
|
cb = opts.cb || cb;
|
|
123156
123694
|
var pre = typeof cb == "function" ? cb : cb.pre || function() {
|
|
123157
123695
|
};
|
|
123158
|
-
var
|
|
123696
|
+
var post3 = cb.post || function() {
|
|
123159
123697
|
};
|
|
123160
|
-
_traverse(opts, pre,
|
|
123698
|
+
_traverse(opts, pre, post3, schema, "", schema);
|
|
123161
123699
|
};
|
|
123162
123700
|
traverse.keywords = {
|
|
123163
123701
|
additionalItems: true,
|
|
@@ -123203,7 +123741,7 @@ var require_json_schema_traverse = __commonJS({
|
|
|
123203
123741
|
maxProperties: true,
|
|
123204
123742
|
minProperties: true
|
|
123205
123743
|
};
|
|
123206
|
-
function _traverse(opts, pre,
|
|
123744
|
+
function _traverse(opts, pre, post3, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
|
123207
123745
|
if (schema && typeof schema == "object" && !Array.isArray(schema)) {
|
|
123208
123746
|
pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
123209
123747
|
for (var key in schema) {
|
|
@@ -123211,18 +123749,18 @@ var require_json_schema_traverse = __commonJS({
|
|
|
123211
123749
|
if (Array.isArray(sch)) {
|
|
123212
123750
|
if (key in traverse.arrayKeywords) {
|
|
123213
123751
|
for (var i2 = 0; i2 < sch.length; i2++)
|
|
123214
|
-
_traverse(opts, pre,
|
|
123752
|
+
_traverse(opts, pre, post3, sch[i2], jsonPtr + "/" + key + "/" + i2, rootSchema, jsonPtr, key, schema, i2);
|
|
123215
123753
|
}
|
|
123216
123754
|
} else if (key in traverse.propsKeywords) {
|
|
123217
123755
|
if (sch && typeof sch == "object") {
|
|
123218
123756
|
for (var prop in sch)
|
|
123219
|
-
_traverse(opts, pre,
|
|
123757
|
+
_traverse(opts, pre, post3, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop);
|
|
123220
123758
|
}
|
|
123221
123759
|
} else if (key in traverse.keywords || opts.allKeys && !(key in traverse.skipKeywords)) {
|
|
123222
|
-
_traverse(opts, pre,
|
|
123760
|
+
_traverse(opts, pre, post3, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key, schema);
|
|
123223
123761
|
}
|
|
123224
123762
|
}
|
|
123225
|
-
|
|
123763
|
+
post3(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
123226
123764
|
}
|
|
123227
123765
|
}
|
|
123228
123766
|
function escapeJsonPtr(str3) {
|
|
@@ -125858,11 +126396,11 @@ var require_core = __commonJS({
|
|
|
125858
126396
|
}
|
|
125859
126397
|
function addRule(keyword, definition, dataType) {
|
|
125860
126398
|
var _a2;
|
|
125861
|
-
const
|
|
125862
|
-
if (dataType &&
|
|
126399
|
+
const post3 = definition === null || definition === void 0 ? void 0 : definition.post;
|
|
126400
|
+
if (dataType && post3)
|
|
125863
126401
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
125864
126402
|
const { RULES } = this;
|
|
125865
|
-
let ruleGroup =
|
|
126403
|
+
let ruleGroup = post3 ? RULES.post : RULES.rules.find(({ type: t }) => t === dataType);
|
|
125866
126404
|
if (!ruleGroup) {
|
|
125867
126405
|
ruleGroup = { type: dataType, rules: [] };
|
|
125868
126406
|
RULES.rules.push(ruleGroup);
|
|
@@ -129722,186 +130260,6 @@ var init_open_browser = __esm({
|
|
|
129722
130260
|
}
|
|
129723
130261
|
});
|
|
129724
130262
|
|
|
129725
|
-
// src/lib/working-copy.ts
|
|
129726
|
-
import { execFile as execFile6 } from "node:child_process";
|
|
129727
|
-
import { createHash as createHash29, randomBytes as randomBytes14 } from "node:crypto";
|
|
129728
|
-
import {
|
|
129729
|
-
existsSync as existsSync30,
|
|
129730
|
-
lstatSync as lstatSync13,
|
|
129731
|
-
mkdirSync as mkdirSync14,
|
|
129732
|
-
readFileSync as readFileSync31,
|
|
129733
|
-
readdirSync as readdirSync18,
|
|
129734
|
-
realpathSync as realpathSync10,
|
|
129735
|
-
writeFileSync as writeFileSync11
|
|
129736
|
-
} from "node:fs";
|
|
129737
|
-
import { homedir as homedir13, hostname as osHostname3 } from "node:os";
|
|
129738
|
-
import { join as join68, resolve as resolve26, sep as sep12 } from "node:path";
|
|
129739
|
-
function git3(cwd, args) {
|
|
129740
|
-
return new Promise((done) => {
|
|
129741
|
-
try {
|
|
129742
|
-
execFile6(
|
|
129743
|
-
"git",
|
|
129744
|
-
args,
|
|
129745
|
-
{ cwd, timeout: GIT_TIMEOUT_MS2, encoding: "utf8", windowsHide: true },
|
|
129746
|
-
(err2, stdout) => {
|
|
129747
|
-
if (err2) return done(null);
|
|
129748
|
-
const out = String(stdout).trim();
|
|
129749
|
-
done(out.length > 0 ? out : null);
|
|
129750
|
-
}
|
|
129751
|
-
);
|
|
129752
|
-
} catch {
|
|
129753
|
-
done(null);
|
|
129754
|
-
}
|
|
129755
|
-
});
|
|
129756
|
-
}
|
|
129757
|
-
async function projectRootFor(cwd) {
|
|
129758
|
-
const top = await git3(cwd, ["rev-parse", "--show-toplevel"]);
|
|
129759
|
-
return top ? resolve26(top) : resolve26(cwd);
|
|
129760
|
-
}
|
|
129761
|
-
function parseRemoteRepository(url2) {
|
|
129762
|
-
const raw = url2.trim();
|
|
129763
|
-
if (raw.length === 0) return null;
|
|
129764
|
-
let path2 = null;
|
|
129765
|
-
const scp = /^(?:[^@/\s]+@)?([^:/\s]+):(?!\/\/)(.+)$/.exec(raw);
|
|
129766
|
-
if (!raw.includes("://") && scp) {
|
|
129767
|
-
if (scp[1].length === 1) return null;
|
|
129768
|
-
path2 = scp[2];
|
|
129769
|
-
} else {
|
|
129770
|
-
try {
|
|
129771
|
-
const parsed2 = new URL(raw);
|
|
129772
|
-
if (parsed2.protocol === "file:") return null;
|
|
129773
|
-
path2 = decodeURIComponent(parsed2.pathname);
|
|
129774
|
-
} catch {
|
|
129775
|
-
return null;
|
|
129776
|
-
}
|
|
129777
|
-
}
|
|
129778
|
-
const segments = path2.replace(/\/+$/, "").replace(/\.git$/, "").split("/").filter((s2) => s2.length > 0);
|
|
129779
|
-
if (segments.length < 2) return null;
|
|
129780
|
-
const name2 = segments.join("/");
|
|
129781
|
-
return name2.length >= 3 && name2.length <= 512 ? name2 : null;
|
|
129782
|
-
}
|
|
129783
|
-
function oxagenPresent(root) {
|
|
129784
|
-
try {
|
|
129785
|
-
return readdirSync18(join68(root, ".oxagen")).some(
|
|
129786
|
-
(name2) => name2 !== "workspace.json"
|
|
129787
|
-
);
|
|
129788
|
-
} catch {
|
|
129789
|
-
return false;
|
|
129790
|
-
}
|
|
129791
|
-
}
|
|
129792
|
-
function symlinkState(root) {
|
|
129793
|
-
try {
|
|
129794
|
-
if (!lstatSync13(join68(root, ".stella")).isDirectory()) return "none";
|
|
129795
|
-
} catch {
|
|
129796
|
-
return "none";
|
|
129797
|
-
}
|
|
129798
|
-
let oxagenReal;
|
|
129799
|
-
try {
|
|
129800
|
-
oxagenReal = realpathSync10(join68(root, ".oxagen"));
|
|
129801
|
-
} catch {
|
|
129802
|
-
return "missing";
|
|
129803
|
-
}
|
|
129804
|
-
for (const link of STELLA_LINKS) {
|
|
129805
|
-
const at2 = join68(root, link);
|
|
129806
|
-
try {
|
|
129807
|
-
if (!lstatSync13(at2).isSymbolicLink()) return "missing";
|
|
129808
|
-
const target = realpathSync10(at2);
|
|
129809
|
-
if (target !== oxagenReal && !target.startsWith(oxagenReal + sep12)) {
|
|
129810
|
-
return "missing";
|
|
129811
|
-
}
|
|
129812
|
-
} catch {
|
|
129813
|
-
return "missing";
|
|
129814
|
-
}
|
|
129815
|
-
}
|
|
129816
|
-
return "linked";
|
|
129817
|
-
}
|
|
129818
|
-
function machineId(configDir = getConfigDir()) {
|
|
129819
|
-
const file = join68(configDir, MACHINE_ID_FILE);
|
|
129820
|
-
let secret = null;
|
|
129821
|
-
try {
|
|
129822
|
-
if (existsSync30(file)) {
|
|
129823
|
-
const stored = readFileSync31(file, "utf8").trim();
|
|
129824
|
-
if (/^[0-9a-f]{64}$/.test(stored)) secret = stored;
|
|
129825
|
-
}
|
|
129826
|
-
if (secret === null) {
|
|
129827
|
-
secret = randomBytes14(32).toString("hex");
|
|
129828
|
-
mkdirSync14(configDir, { recursive: true });
|
|
129829
|
-
writeFileSync11(file, `${secret}
|
|
129830
|
-
`, { encoding: "utf8", mode: 384 });
|
|
129831
|
-
}
|
|
129832
|
-
} catch {
|
|
129833
|
-
secret = `fallback:${osHostname3()}:${homedir13()}`;
|
|
129834
|
-
}
|
|
129835
|
-
return createHash29("sha256").update(secret).digest("hex");
|
|
129836
|
-
}
|
|
129837
|
-
function cliVersion() {
|
|
129838
|
-
const v = package_default.version;
|
|
129839
|
-
return typeof v === "string" && v.length > 0 ? v.slice(0, 64) : null;
|
|
129840
|
-
}
|
|
129841
|
-
async function probeWorkingCopy(opts) {
|
|
129842
|
-
const { root } = opts;
|
|
129843
|
-
const [remote, branch, head3] = await Promise.all([
|
|
129844
|
-
git3(root, ["remote", "get-url", "origin"]),
|
|
129845
|
-
git3(root, ["rev-parse", "--abbrev-ref", "HEAD"]),
|
|
129846
|
-
git3(root, ["rev-parse", "HEAD"])
|
|
129847
|
-
]);
|
|
129848
|
-
const host = (() => {
|
|
129849
|
-
try {
|
|
129850
|
-
return osHostname3().slice(0, 255);
|
|
129851
|
-
} catch {
|
|
129852
|
-
return "";
|
|
129853
|
-
}
|
|
129854
|
-
})();
|
|
129855
|
-
return {
|
|
129856
|
-
machineId: machineId(opts.configDir),
|
|
129857
|
-
hostname: host.length > 0 ? host : "unknown",
|
|
129858
|
-
directory: resolve26(root),
|
|
129859
|
-
repository: remote ? parseRemoteRepository(remote) : null,
|
|
129860
|
-
// `HEAD` is git's answer on a detached head.
|
|
129861
|
-
branch: branch && branch !== "HEAD" ? branch.slice(0, 255) : null,
|
|
129862
|
-
headCommit: head3 && COMMIT_SHA.test(head3) ? head3 : null,
|
|
129863
|
-
oxagenPresent: oxagenPresent(root),
|
|
129864
|
-
symlinks: symlinkState(root),
|
|
129865
|
-
pulledCommit: null,
|
|
129866
|
-
event: "init",
|
|
129867
|
-
cliVersion: cliVersion()
|
|
129868
|
-
};
|
|
129869
|
-
}
|
|
129870
|
-
async function reportWorkingCopy(opts) {
|
|
129871
|
-
try {
|
|
129872
|
-
const report = await probeWorkingCopy(opts);
|
|
129873
|
-
const recorded = await apiPostOrThrow(
|
|
129874
|
-
"working-copies",
|
|
129875
|
-
report,
|
|
129876
|
-
opts.scope,
|
|
129877
|
-
{ timeoutMs: REPORT_TIMEOUT_MS }
|
|
129878
|
-
);
|
|
129879
|
-
return {
|
|
129880
|
-
workingCopyId: recorded.workingCopyId,
|
|
129881
|
-
lastSeenAt: recorded.lastSeenAt
|
|
129882
|
-
};
|
|
129883
|
-
} catch (err2) {
|
|
129884
|
-
return { error: err2 instanceof Error ? err2.message : String(err2) };
|
|
129885
|
-
}
|
|
129886
|
-
}
|
|
129887
|
-
var GIT_TIMEOUT_MS2, REPORT_TIMEOUT_MS, MACHINE_ID_FILE, STELLA_LINKS, COMMIT_SHA;
|
|
129888
|
-
var init_working_copy = __esm({
|
|
129889
|
-
"src/lib/working-copy.ts"() {
|
|
129890
|
-
init_package();
|
|
129891
|
-
init_api();
|
|
129892
|
-
init_config();
|
|
129893
|
-
GIT_TIMEOUT_MS2 = 3e3;
|
|
129894
|
-
REPORT_TIMEOUT_MS = 8e3;
|
|
129895
|
-
MACHINE_ID_FILE = "machine-id";
|
|
129896
|
-
STELLA_LINKS = [
|
|
129897
|
-
".stella/rules",
|
|
129898
|
-
".stella/proposals",
|
|
129899
|
-
".stella/agents"
|
|
129900
|
-
];
|
|
129901
|
-
COMMIT_SHA = /^[0-9a-f]{7,64}$/;
|
|
129902
|
-
}
|
|
129903
|
-
});
|
|
129904
|
-
|
|
129905
130263
|
// src/commands/init.ts
|
|
129906
130264
|
var init_exports = {};
|
|
129907
130265
|
__export(init_exports, {
|
|
@@ -151224,7 +151582,7 @@ function sessionHeaders(session) {
|
|
|
151224
151582
|
function invalidResponse(detail, status2) {
|
|
151225
151583
|
return { ok: false, error: { title: "Invalid response", detail, status: status2 } };
|
|
151226
151584
|
}
|
|
151227
|
-
async function
|
|
151585
|
+
async function post2(session, message2) {
|
|
151228
151586
|
const { call: call2 } = session;
|
|
151229
151587
|
const context = call2.context;
|
|
151230
151588
|
const pending = settle3(
|
|
@@ -151362,7 +151720,7 @@ function rpcError2(error2) {
|
|
|
151362
151720
|
};
|
|
151363
151721
|
}
|
|
151364
151722
|
async function initialize(session) {
|
|
151365
|
-
const sent = await
|
|
151723
|
+
const sent = await post2(session, {
|
|
151366
151724
|
jsonrpc: "2.0",
|
|
151367
151725
|
id: INITIALIZE_ID,
|
|
151368
151726
|
method: "initialize",
|
|
@@ -151403,7 +151761,7 @@ async function initialize(session) {
|
|
|
151403
151761
|
return { ok: true, value: void 0 };
|
|
151404
151762
|
}
|
|
151405
151763
|
async function notifyInitialized(session) {
|
|
151406
|
-
const sent = await
|
|
151764
|
+
const sent = await post2(session, {
|
|
151407
151765
|
jsonrpc: "2.0",
|
|
151408
151766
|
method: "notifications/initialized"
|
|
151409
151767
|
});
|
|
@@ -151428,7 +151786,7 @@ function toolsCallMessage(template, args) {
|
|
|
151428
151786
|
}
|
|
151429
151787
|
async function callTool2(session) {
|
|
151430
151788
|
const { template, args } = session.call;
|
|
151431
|
-
const sent = await
|
|
151789
|
+
const sent = await post2(session, toolsCallMessage(template, args));
|
|
151432
151790
|
if (!sent.ok) return { attempt: sent, exchange: void 0 };
|
|
151433
151791
|
const response = sent.value;
|
|
151434
151792
|
if (response.status < 200 || response.status >= 300) {
|
|
@@ -155454,8 +155812,8 @@ var require_service_config = __commonJS({
|
|
|
155454
155812
|
}
|
|
155455
155813
|
if (Array.isArray(validatedConfig.clientHostname)) {
|
|
155456
155814
|
let hostnameMatched = false;
|
|
155457
|
-
for (const
|
|
155458
|
-
if (
|
|
155815
|
+
for (const hostname6 of validatedConfig.clientHostname) {
|
|
155816
|
+
if (hostname6 === os2.hostname()) {
|
|
155459
155817
|
hostnameMatched = true;
|
|
155460
155818
|
}
|
|
155461
155819
|
}
|
|
@@ -162292,8 +162650,8 @@ var require_single_subchannel_channel = __commonJS({
|
|
|
162292
162650
|
if (splitPath.length >= 2) {
|
|
162293
162651
|
serviceName = splitPath[1];
|
|
162294
162652
|
}
|
|
162295
|
-
const
|
|
162296
|
-
this.serviceUrl = `https://${
|
|
162653
|
+
const hostname6 = (_b2 = (_a2 = (0, uri_parser_1.splitHostPort)(this.options.host)) === null || _a2 === void 0 ? void 0 : _a2.host) !== null && _b2 !== void 0 ? _b2 : "localhost";
|
|
162654
|
+
this.serviceUrl = `https://${hostname6}/${serviceName}`;
|
|
162297
162655
|
const timeout = (0, deadline_1.getRelativeTimeout)(options.deadline);
|
|
162298
162656
|
if (timeout !== Infinity) {
|
|
162299
162657
|
if (timeout <= 0) {
|
|
@@ -162960,8 +163318,8 @@ var require_resolver_dns = __commonJS({
|
|
|
162960
163318
|
}
|
|
162961
163319
|
trace("Looking up DNS hostname " + this.dnsHostname);
|
|
162962
163320
|
this.latestLookupResult = null;
|
|
162963
|
-
const
|
|
162964
|
-
this.pendingLookupPromise = this.lookup(
|
|
163321
|
+
const hostname6 = this.dnsHostname;
|
|
163322
|
+
this.pendingLookupPromise = this.lookup(hostname6);
|
|
162965
163323
|
this.pendingLookupPromise.then((addressList) => {
|
|
162966
163324
|
if (this.pendingLookupPromise === null) {
|
|
162967
163325
|
return;
|
|
@@ -162984,7 +163342,7 @@ var require_resolver_dns = __commonJS({
|
|
|
162984
163342
|
this.listener((0, call_interface_1.statusOrFromError)(this.defaultResolutionError), {}, this.latestServiceConfigResult, "");
|
|
162985
163343
|
});
|
|
162986
163344
|
if (this.isServiceConfigEnabled && this.pendingTxtPromise === null) {
|
|
162987
|
-
this.pendingTxtPromise = this.resolveTxt(
|
|
163345
|
+
this.pendingTxtPromise = this.resolveTxt(hostname6);
|
|
162988
163346
|
this.pendingTxtPromise.then((txtRecord) => {
|
|
162989
163347
|
if (this.pendingTxtPromise === null) {
|
|
162990
163348
|
return;
|
|
@@ -163026,12 +163384,12 @@ var require_resolver_dns = __commonJS({
|
|
|
163026
163384
|
this.continueResolving = true;
|
|
163027
163385
|
}
|
|
163028
163386
|
}
|
|
163029
|
-
async lookup(
|
|
163387
|
+
async lookup(hostname6) {
|
|
163030
163388
|
if (environment_1.GRPC_NODE_USE_ALTERNATIVE_RESOLVER) {
|
|
163031
163389
|
trace("Using alternative DNS resolver.");
|
|
163032
163390
|
const records = await Promise.allSettled([
|
|
163033
|
-
this.alternativeResolver.resolve4(
|
|
163034
|
-
this.alternativeResolver.resolve6(
|
|
163391
|
+
this.alternativeResolver.resolve4(hostname6),
|
|
163392
|
+
this.alternativeResolver.resolve6(hostname6)
|
|
163035
163393
|
]);
|
|
163036
163394
|
if (records.every((result2) => result2.status === "rejected")) {
|
|
163037
163395
|
throw new Error(records[0].reason);
|
|
@@ -163043,15 +163401,15 @@ var require_resolver_dns = __commonJS({
|
|
|
163043
163401
|
port: +this.port
|
|
163044
163402
|
}));
|
|
163045
163403
|
}
|
|
163046
|
-
const addressList = await dns_1.promises.lookup(
|
|
163404
|
+
const addressList = await dns_1.promises.lookup(hostname6, { all: true });
|
|
163047
163405
|
return addressList.map((addr) => ({ host: addr.address, port: +this.port }));
|
|
163048
163406
|
}
|
|
163049
|
-
async resolveTxt(
|
|
163407
|
+
async resolveTxt(hostname6) {
|
|
163050
163408
|
if (environment_1.GRPC_NODE_USE_ALTERNATIVE_RESOLVER) {
|
|
163051
163409
|
trace("Using alternative DNS resolver.");
|
|
163052
|
-
return this.alternativeResolver.resolveTxt(
|
|
163410
|
+
return this.alternativeResolver.resolveTxt(hostname6);
|
|
163053
163411
|
}
|
|
163054
|
-
return dns_1.promises.resolveTxt(
|
|
163412
|
+
return dns_1.promises.resolveTxt(hostname6);
|
|
163055
163413
|
}
|
|
163056
163414
|
startNextResolutionTimer() {
|
|
163057
163415
|
var _a2, _b2;
|
|
@@ -163179,13 +163537,13 @@ var require_http_proxy = __commonJS({
|
|
|
163179
163537
|
userCred = proxyUrl.username;
|
|
163180
163538
|
}
|
|
163181
163539
|
}
|
|
163182
|
-
const
|
|
163540
|
+
const hostname6 = proxyUrl.hostname;
|
|
163183
163541
|
let port = proxyUrl.port;
|
|
163184
163542
|
if (port === "") {
|
|
163185
163543
|
port = "80";
|
|
163186
163544
|
}
|
|
163187
163545
|
const result2 = {
|
|
163188
|
-
address: `${
|
|
163546
|
+
address: `${hostname6}:${port}`
|
|
163189
163547
|
};
|
|
163190
163548
|
if (userCred) {
|
|
163191
163549
|
result2.creds = userCred;
|
|
@@ -164589,8 +164947,8 @@ var require_load_balancing_call = __commonJS({
|
|
|
164589
164947
|
if (splitPath.length >= 2) {
|
|
164590
164948
|
serviceName = splitPath[1];
|
|
164591
164949
|
}
|
|
164592
|
-
const
|
|
164593
|
-
this.serviceUrl = `https://${
|
|
164950
|
+
const hostname6 = (_b2 = (_a2 = (0, uri_parser_1.splitHostPort)(this.host)) === null || _a2 === void 0 ? void 0 : _a2.host) !== null && _b2 !== void 0 ? _b2 : "localhost";
|
|
164951
|
+
this.serviceUrl = `https://${hostname6}/${serviceName}`;
|
|
164594
164952
|
this.startTime = /* @__PURE__ */ new Date();
|
|
164595
164953
|
}
|
|
164596
164954
|
getDeadlineInfo() {
|
|
@@ -174276,10 +174634,18 @@ async function mapBounded(items, limit, fn) {
|
|
|
174276
174634
|
if (failures.size > 0) throw failures.get(Math.min(...failures.keys()));
|
|
174277
174635
|
return results;
|
|
174278
174636
|
}
|
|
174279
|
-
var TreeReader, READ_CONCURRENCY;
|
|
174637
|
+
var FileUnreadableError, TreeReader, READ_CONCURRENCY;
|
|
174280
174638
|
var init_tree = __esm({
|
|
174281
174639
|
"../../packages/steering-bundle/src/tree.ts"() {
|
|
174282
174640
|
"use strict";
|
|
174641
|
+
FileUnreadableError = class extends Error {
|
|
174642
|
+
constructor(path2, message2) {
|
|
174643
|
+
super(message2);
|
|
174644
|
+
this.path = path2;
|
|
174645
|
+
this.name = "FileUnreadableError";
|
|
174646
|
+
}
|
|
174647
|
+
path;
|
|
174648
|
+
};
|
|
174283
174649
|
TreeReader = class _TreeReader {
|
|
174284
174650
|
constructor(tree, cache, paths) {
|
|
174285
174651
|
this.tree = tree;
|
|
@@ -174299,6 +174665,8 @@ var init_tree = __esm({
|
|
|
174299
174665
|
decoding = /* @__PURE__ */ new Map();
|
|
174300
174666
|
blobs = /* @__PURE__ */ new Map();
|
|
174301
174667
|
listed;
|
|
174668
|
+
/** Listed paths that hold no regular file, such as a symlink. */
|
|
174669
|
+
irregular = /* @__PURE__ */ new Set();
|
|
174302
174670
|
/** How many files this reader fetched from the host. */
|
|
174303
174671
|
reads = 0;
|
|
174304
174672
|
static async open(tree, cache) {
|
|
@@ -174310,9 +174678,18 @@ var init_tree = __esm({
|
|
|
174310
174678
|
);
|
|
174311
174679
|
for (const entry2 of entries2) {
|
|
174312
174680
|
if (entry2.blob !== void 0) reader.blobs.set(entry2.path, entry2.blob);
|
|
174681
|
+
if (entry2.regular === false) reader.irregular.add(entry2.path);
|
|
174313
174682
|
}
|
|
174314
174683
|
return reader;
|
|
174315
174684
|
}
|
|
174685
|
+
/** Throws FileUnreadableError for a listed path that holds no regular file. */
|
|
174686
|
+
assertRegular(path2) {
|
|
174687
|
+
if (this.irregular.has(path2))
|
|
174688
|
+
throw new FileUnreadableError(
|
|
174689
|
+
path2,
|
|
174690
|
+
`${path2} is a symlink or a submodule, so its content is not in the repository.`
|
|
174691
|
+
);
|
|
174692
|
+
}
|
|
174316
174693
|
has(path2) {
|
|
174317
174694
|
return this.listed.has(path2);
|
|
174318
174695
|
}
|
|
@@ -174331,6 +174708,7 @@ var init_tree = __esm({
|
|
|
174331
174708
|
* fetch, and a fetch that fails is not kept.
|
|
174332
174709
|
*/
|
|
174333
174710
|
async text(path2) {
|
|
174711
|
+
this.assertRegular(path2);
|
|
174334
174712
|
if (this.tree.readBytes === void 0) return this.read(path2);
|
|
174335
174713
|
const listed = this.blobs.get(path2);
|
|
174336
174714
|
const key = listed === void 0 ? `path:${path2}` : `blob:${listed}`;
|
|
@@ -174354,6 +174732,7 @@ var init_tree = __esm({
|
|
|
174354
174732
|
}
|
|
174355
174733
|
/** The file's text, from this reader, the cache, or the host. */
|
|
174356
174734
|
async read(path2) {
|
|
174735
|
+
this.assertRegular(path2);
|
|
174357
174736
|
const held = this.texts.get(path2);
|
|
174358
174737
|
if (held !== void 0) return held;
|
|
174359
174738
|
const inFlight = this.pending.get(path2);
|
|
@@ -177374,6 +177753,17 @@ function addAgentLifecycleCommands(agent) {
|
|
|
177374
177753
|
resume: true
|
|
177375
177754
|
})
|
|
177376
177755
|
);
|
|
177756
|
+
agent.command("connect").description(
|
|
177757
|
+
"Connect this device to a new agent with the request the page shows, and report the device back to the page. Enrolls nothing until you confirm"
|
|
177758
|
+
).requiredOption(
|
|
177759
|
+
"--request <token>",
|
|
177760
|
+
"The request token from the page (oxe_1time_\u2026)"
|
|
177761
|
+
).option(
|
|
177762
|
+
"--folder <path>",
|
|
177763
|
+
"The folder the agent works in (default: this one)"
|
|
177764
|
+
).option("--yes", "Connect without asking").option("--json", "Output JSON").action(
|
|
177765
|
+
async (opts) => (await Promise.resolve().then(() => (init_agent_connect(), agent_connect_exports))).agentConnect(opts)
|
|
177766
|
+
);
|
|
177377
177767
|
agent.command("enroll-token").description(
|
|
177378
177768
|
"Mint a single-use enrollment token for an agent, and print the command that enrolls a machine with it. Owner only"
|
|
177379
177769
|
).argument("<agent>", "An agent id or slug").option(
|
|
@@ -178976,7 +179366,13 @@ var init_program = __esm({
|
|
|
178976
179366
|
({ version: version2 } = package_default);
|
|
178977
179367
|
ENROLLMENT_TOKEN_PREFIX = "oxe_1time_";
|
|
178978
179368
|
EXPORT_FORMATS2 = ["recorder", "trace", "otlp"];
|
|
178979
|
-
CREDENTIAL_FLAGS = /* @__PURE__ */ new Set([
|
|
179369
|
+
CREDENTIAL_FLAGS = /* @__PURE__ */ new Set([
|
|
179370
|
+
"--token",
|
|
179371
|
+
"--input",
|
|
179372
|
+
"--endpoint",
|
|
179373
|
+
// `oxagen agent connect --request <token>` carries an enrollment token.
|
|
179374
|
+
"--request"
|
|
179375
|
+
]);
|
|
178980
179376
|
WORKSPACE_SLUG_HELP = "The workspace to act in (or OXAGEN_WORKSPACE)";
|
|
178981
179377
|
}
|
|
178982
179378
|
});
|