@oxagen/cli 2.1.4-955 → 2.1.4-957
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 +378 -278
- package/package.json +1 -1
package/oxagen.mjs
CHANGED
|
@@ -25231,7 +25231,7 @@ import { readFileSync as readFileSync10 } from "node:fs";
|
|
|
25231
25231
|
import { dirname as dirname9, resolve as resolve3 } from "node:path";
|
|
25232
25232
|
import { fileURLToPath } from "node:url";
|
|
25233
25233
|
function readVersion() {
|
|
25234
|
-
if (true) return "2.1.4-
|
|
25234
|
+
if (true) return "2.1.4-957";
|
|
25235
25235
|
try {
|
|
25236
25236
|
const here = dirname9(fileURLToPath(import.meta.url));
|
|
25237
25237
|
const pkg = JSON.parse(
|
|
@@ -29029,6 +29029,70 @@ var init_github = __esm({
|
|
|
29029
29029
|
}
|
|
29030
29030
|
});
|
|
29031
29031
|
|
|
29032
|
+
// ../../packages/tacho/src/host/harness-path.ts
|
|
29033
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
29034
|
+
import { delimiter, join as join18 } from "node:path";
|
|
29035
|
+
function knownDirs(home) {
|
|
29036
|
+
return [
|
|
29037
|
+
join18(home, ".local", "bin"),
|
|
29038
|
+
join18(home, ".bun", "bin"),
|
|
29039
|
+
join18(home, ".npm-global", "bin"),
|
|
29040
|
+
join18(home, ".volta", "bin"),
|
|
29041
|
+
join18(home, ".cargo", "bin"),
|
|
29042
|
+
join18(home, "bin"),
|
|
29043
|
+
"/opt/homebrew/bin",
|
|
29044
|
+
"/usr/local/bin",
|
|
29045
|
+
"/usr/bin",
|
|
29046
|
+
"/bin",
|
|
29047
|
+
"/usr/sbin",
|
|
29048
|
+
"/sbin"
|
|
29049
|
+
];
|
|
29050
|
+
}
|
|
29051
|
+
function loginShellPath(env, run3 = spawnSync5) {
|
|
29052
|
+
const shell = env["SHELL"] ?? "/bin/zsh";
|
|
29053
|
+
try {
|
|
29054
|
+
const result2 = run3(
|
|
29055
|
+
shell,
|
|
29056
|
+
["-ilc", `printf '%s%s%s' '${MARK}' "$PATH" '${MARK}'`],
|
|
29057
|
+
{
|
|
29058
|
+
encoding: "utf8",
|
|
29059
|
+
timeout: LOGIN_SHELL_TIMEOUT_MS,
|
|
29060
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
29061
|
+
env: { ...env, TERM: env["TERM"] ?? "dumb" }
|
|
29062
|
+
}
|
|
29063
|
+
);
|
|
29064
|
+
const out = typeof result2.stdout === "string" ? result2.stdout : "";
|
|
29065
|
+
const start = out.indexOf(MARK);
|
|
29066
|
+
const end = out.indexOf(MARK, start + MARK.length);
|
|
29067
|
+
if (start < 0 || end < 0) return void 0;
|
|
29068
|
+
const path2 = out.slice(start + MARK.length, end).trim();
|
|
29069
|
+
return path2.length > 0 ? path2 : void 0;
|
|
29070
|
+
} catch {
|
|
29071
|
+
return void 0;
|
|
29072
|
+
}
|
|
29073
|
+
}
|
|
29074
|
+
function harnessPath(env, home, loginPath) {
|
|
29075
|
+
const seen = /* @__PURE__ */ new Set();
|
|
29076
|
+
const dirs = [];
|
|
29077
|
+
const add2 = (dir) => {
|
|
29078
|
+
if (dir.length === 0 || seen.has(dir)) return;
|
|
29079
|
+
seen.add(dir);
|
|
29080
|
+
dirs.push(dir);
|
|
29081
|
+
};
|
|
29082
|
+
for (const dir of (loginPath ?? "").split(delimiter)) add2(dir);
|
|
29083
|
+
for (const dir of (env["PATH"] ?? "").split(delimiter)) add2(dir);
|
|
29084
|
+
for (const dir of knownDirs(home)) add2(dir);
|
|
29085
|
+
return dirs.join(delimiter);
|
|
29086
|
+
}
|
|
29087
|
+
var MARK, LOGIN_SHELL_TIMEOUT_MS;
|
|
29088
|
+
var init_harness_path = __esm({
|
|
29089
|
+
"../../packages/tacho/src/host/harness-path.ts"() {
|
|
29090
|
+
"use strict";
|
|
29091
|
+
MARK = "__OXAGEN_PATH__";
|
|
29092
|
+
LOGIN_SHELL_TIMEOUT_MS = 5e3;
|
|
29093
|
+
}
|
|
29094
|
+
});
|
|
29095
|
+
|
|
29032
29096
|
// ../../packages/tacho/src/cli/daemon-service.ts
|
|
29033
29097
|
function daemonServiceSpec(daemonCommand, deps) {
|
|
29034
29098
|
return {
|
|
@@ -29043,7 +29107,11 @@ function daemonServiceSpec(daemonCommand, deps) {
|
|
|
29043
29107
|
return value !== void 0 ? [[key, value]] : [];
|
|
29044
29108
|
})
|
|
29045
29109
|
),
|
|
29046
|
-
|
|
29110
|
+
// The login shell's PATH, so the daemon's git calls find their
|
|
29111
|
+
// credential helpers and a work order's harness is found. A desktop app
|
|
29112
|
+
// installs the service from a GUI process whose PATH is the bare system
|
|
29113
|
+
// path (#5936).
|
|
29114
|
+
PATH: harnessPath(deps.env, deps.home, loginShellPath(deps.env)),
|
|
29047
29115
|
HOME: deps.home
|
|
29048
29116
|
},
|
|
29049
29117
|
// One tachod serves every agent, so its log and working directory are
|
|
@@ -29056,6 +29124,7 @@ var HARNESS_HOME_VARS;
|
|
|
29056
29124
|
var init_daemon_service = __esm({
|
|
29057
29125
|
"../../packages/tacho/src/cli/daemon-service.ts"() {
|
|
29058
29126
|
"use strict";
|
|
29127
|
+
init_harness_path();
|
|
29059
29128
|
HARNESS_HOME_VARS = [
|
|
29060
29129
|
"CLAUDE_CONFIG_DIR",
|
|
29061
29130
|
"CODEX_HOME",
|
|
@@ -29090,7 +29159,7 @@ var init_policy_mode = __esm({
|
|
|
29090
29159
|
|
|
29091
29160
|
// ../../packages/tacho/src/host/wal-ceiling.ts
|
|
29092
29161
|
import { statfsSync } from "node:fs";
|
|
29093
|
-
import { join as
|
|
29162
|
+
import { join as join19 } from "node:path";
|
|
29094
29163
|
function freeBytesOn(dir) {
|
|
29095
29164
|
try {
|
|
29096
29165
|
const stats2 = statfsSync(dir);
|
|
@@ -29137,7 +29206,7 @@ function isDrop(value) {
|
|
|
29137
29206
|
function readWalCeilingState(walDir) {
|
|
29138
29207
|
let raw;
|
|
29139
29208
|
try {
|
|
29140
|
-
raw = readJsonFileIfExists(
|
|
29209
|
+
raw = readJsonFileIfExists(join19(walDir, STATE_FILE));
|
|
29141
29210
|
} catch (error) {
|
|
29142
29211
|
if (error instanceof SyntaxError) return void 0;
|
|
29143
29212
|
throw error;
|
|
@@ -29337,7 +29406,7 @@ var init_wal_ceiling = __esm({
|
|
|
29337
29406
|
const changed = this.unsaved || prior === void 0 || prior.stalled_sessions !== next.stalled_sessions || prior.drops.length !== next.drops.length || prior.drops.at(-1)?.dropped_at !== next.drops.at(-1)?.dropped_at || !sameClocks(prior.stall_clocks, next.stall_clocks) || next.stalled_sessions > 0 && (prior.stalled_bytes !== next.stalled_bytes || prior.ceiling_bytes !== next.ceiling_bytes);
|
|
29338
29407
|
this.state = next;
|
|
29339
29408
|
if (!changed) return;
|
|
29340
|
-
const path2 =
|
|
29409
|
+
const path2 = join19(this.walDir, STATE_FILE);
|
|
29341
29410
|
try {
|
|
29342
29411
|
writeSensitiveFileAtomic(path2, JSON.stringify(next));
|
|
29343
29412
|
this.unsaved = false;
|
|
@@ -29841,7 +29910,7 @@ import {
|
|
|
29841
29910
|
rmdirSync as rmdirSync5,
|
|
29842
29911
|
rmSync as rmSync2
|
|
29843
29912
|
} from "node:fs";
|
|
29844
|
-
import { dirname as dirname12, join as
|
|
29913
|
+
import { dirname as dirname12, join as join20 } from "node:path";
|
|
29845
29914
|
async function revokeOnControlPlane(host, options, deps, warnings) {
|
|
29846
29915
|
const resolved = resolveCredentials(
|
|
29847
29916
|
{
|
|
@@ -30452,7 +30521,7 @@ async function unenrollLocked(options, deps) {
|
|
|
30452
30521
|
];
|
|
30453
30522
|
const purged = parts.filter(([, path2, recursive]) => remove2(path2, recursive)).map(([name]) => name);
|
|
30454
30523
|
let failed3 = purged.length < parts.length;
|
|
30455
|
-
if (!existsSync15(
|
|
30524
|
+
if (!existsSync15(join20(deps.paths.dir, HARNESS_RECEIPTS)) && !remove2(join20(deps.paths.dir, HARNESS_BACKUPS), true))
|
|
30456
30525
|
failed3 = true;
|
|
30457
30526
|
const logShared = otherLiveAgents(deps.paths, deps.paths.dir).length > 0;
|
|
30458
30527
|
if (!logShared) {
|
|
@@ -30510,7 +30579,7 @@ var init_unenroll = __esm({
|
|
|
30510
30579
|
|
|
30511
30580
|
// ../../packages/tacho/src/cli/enroll.ts
|
|
30512
30581
|
import { existsSync as existsSync16, lstatSync as lstatSync4, rmSync as rmSync3 } from "node:fs";
|
|
30513
|
-
import { dirname as dirname13, isAbsolute, join as
|
|
30582
|
+
import { dirname as dirname13, isAbsolute, join as join21 } from "node:path";
|
|
30514
30583
|
function rootRefusal(command2, deps, allowRoot) {
|
|
30515
30584
|
if (allowRoot === true || deps.getuid?.() !== 0) return void 0;
|
|
30516
30585
|
const user = deps.env["SUDO_USER"] ?? "<user>";
|
|
@@ -30536,7 +30605,7 @@ function runtimeOf(host) {
|
|
|
30536
30605
|
if (first === void 0 || !files2.every((file) => existsSync16(file)))
|
|
30537
30606
|
return void 0;
|
|
30538
30607
|
const binDir = dirname13(first);
|
|
30539
|
-
const tacho = host.daemon_command[0] === first ? shellQuote(first) : `${host.daemon_command[0]} ${shellQuote(
|
|
30608
|
+
const tacho = host.daemon_command[0] === first ? shellQuote(first) : `${host.daemon_command[0]} ${shellQuote(join21(binDir, "tacho.mjs"))}`;
|
|
30540
30609
|
return {
|
|
30541
30610
|
hookCommand: host.hook_command,
|
|
30542
30611
|
credentialHelperCommand: helperCommandFor(tacho),
|
|
@@ -32792,21 +32861,21 @@ import {
|
|
|
32792
32861
|
statSync as statSync7,
|
|
32793
32862
|
unlinkSync as unlinkSync10
|
|
32794
32863
|
} from "node:fs";
|
|
32795
|
-
import { dirname as dirname14, isAbsolute as isAbsolute2, join as
|
|
32864
|
+
import { dirname as dirname14, isAbsolute as isAbsolute2, join as join22, relative, resolve as resolve7, sep } from "node:path";
|
|
32796
32865
|
function dataLocalDir(home, env, platform) {
|
|
32797
32866
|
if (platform === "darwin")
|
|
32798
|
-
return
|
|
32867
|
+
return join22(home, "Library", "Application Support");
|
|
32799
32868
|
if (platform === "win32")
|
|
32800
|
-
return env["LOCALAPPDATA"] ??
|
|
32869
|
+
return env["LOCALAPPDATA"] ?? join22(home, "AppData", "Local");
|
|
32801
32870
|
const xdg = env["XDG_DATA_HOME"];
|
|
32802
|
-
return xdg !== void 0 && isAbsolute2(xdg) ? xdg :
|
|
32871
|
+
return xdg !== void 0 && isAbsolute2(xdg) ? xdg : join22(home, ".local", "share");
|
|
32803
32872
|
}
|
|
32804
32873
|
function desktopPlaces(deps) {
|
|
32805
|
-
const oxagenDir =
|
|
32874
|
+
const oxagenDir = join22(deps.home, ".config", "oxagen");
|
|
32806
32875
|
return {
|
|
32807
32876
|
oxagenDir,
|
|
32808
|
-
desktopConfig:
|
|
32809
|
-
copies:
|
|
32877
|
+
desktopConfig: join22(oxagenDir, "desktop.json"),
|
|
32878
|
+
copies: join22(
|
|
32810
32879
|
dataLocalDir(deps.home, deps.env, deps.platform),
|
|
32811
32880
|
"oxagen",
|
|
32812
32881
|
"bin"
|
|
@@ -33051,7 +33120,7 @@ function undoEntry(entry2, deps, tally2) {
|
|
|
33051
33120
|
}
|
|
33052
33121
|
function versionDirs(copies) {
|
|
33053
33122
|
try {
|
|
33054
|
-
return readdirSync9(copies, { withFileTypes: true }).filter((entry2) => entry2.isDirectory() && !entry2.name.startsWith(".")).map((entry2) =>
|
|
33123
|
+
return readdirSync9(copies, { withFileTypes: true }).filter((entry2) => entry2.isDirectory() && !entry2.name.startsWith(".")).map((entry2) => join22(copies, entry2.name)).sort();
|
|
33055
33124
|
} catch {
|
|
33056
33125
|
return [];
|
|
33057
33126
|
}
|
|
@@ -33087,7 +33156,7 @@ function journaledCopies(journal, copies, tally2) {
|
|
|
33087
33156
|
function removeSidecars(dir, platform, tally2) {
|
|
33088
33157
|
const note = platform === "win32" ? `. Windows keeps a running program's file, so delete ${dir} after this command exits` : "";
|
|
33089
33158
|
for (const name of ["oxagen", "tacho"]) {
|
|
33090
|
-
const file =
|
|
33159
|
+
const file = join22(dir, platform === "win32" ? `${name}.exe` : name);
|
|
33091
33160
|
removeFile(file, tally2, note);
|
|
33092
33161
|
}
|
|
33093
33162
|
}
|
|
@@ -33175,7 +33244,7 @@ async function uninstall(options, deps) {
|
|
|
33175
33244
|
tally2.left.push(`cannot remove ${dir}: ${reasonOf3(error)}`);
|
|
33176
33245
|
}
|
|
33177
33246
|
}
|
|
33178
|
-
const configDir =
|
|
33247
|
+
const configDir = join22(deps.home, ".config");
|
|
33179
33248
|
if (record.configDirCreated && removeDirIfEmpty(configDir))
|
|
33180
33249
|
tally2.removed.push(configDir);
|
|
33181
33250
|
for (const path2 of tally2.removed) deps.out(` removed ${path2}`);
|
|
@@ -33853,11 +33922,11 @@ var init_work_order_start = __esm({
|
|
|
33853
33922
|
|
|
33854
33923
|
// ../../packages/tacho/src/host/work-orders.ts
|
|
33855
33924
|
import { readdirSync as readdirSync10, rmSync as rmSync5 } from "node:fs";
|
|
33856
|
-
import { join as
|
|
33925
|
+
import { join as join23 } from "node:path";
|
|
33857
33926
|
function orderFile(paths, id2) {
|
|
33858
33927
|
if (!WORK_ORDER_ID_PATTERN.test(id2))
|
|
33859
33928
|
throw new Error(`${JSON.stringify(id2)} is not a work order id`);
|
|
33860
|
-
return
|
|
33929
|
+
return join23(paths.workOrders, `${id2}.json`);
|
|
33861
33930
|
}
|
|
33862
33931
|
function readKept(path2) {
|
|
33863
33932
|
try {
|
|
@@ -33907,7 +33976,7 @@ function removeWorkOrder(paths, id2) {
|
|
|
33907
33976
|
function runningFile(paths, id2) {
|
|
33908
33977
|
if (!WORK_ORDER_ID_PATTERN.test(id2))
|
|
33909
33978
|
throw new Error(`${JSON.stringify(id2)} is not a work order id`);
|
|
33910
|
-
return
|
|
33979
|
+
return join23(paths.workOrders, `${id2}.running`);
|
|
33911
33980
|
}
|
|
33912
33981
|
function processIsAlive(pid) {
|
|
33913
33982
|
try {
|
|
@@ -34000,7 +34069,7 @@ var init_work_orders = __esm({
|
|
|
34000
34069
|
});
|
|
34001
34070
|
|
|
34002
34071
|
// ../../packages/tacho/src/cli/work.ts
|
|
34003
|
-
import { spawnSync as
|
|
34072
|
+
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
34004
34073
|
function liveAgents(deps) {
|
|
34005
34074
|
return listAgents(homeOf(deps.paths)).filter(agentIsLive);
|
|
34006
34075
|
}
|
|
@@ -34188,7 +34257,7 @@ async function workStart(id2, deps) {
|
|
|
34188
34257
|
return exitCodeOf(exit);
|
|
34189
34258
|
}
|
|
34190
34259
|
function gitHeadIn(cwd) {
|
|
34191
|
-
const result2 =
|
|
34260
|
+
const result2 = spawnSync6("git", ["-C", cwd, "rev-parse", "HEAD"], {
|
|
34192
34261
|
encoding: "utf8",
|
|
34193
34262
|
stdio: ["ignore", "pipe", "pipe"],
|
|
34194
34263
|
timeout: 1e4
|
|
@@ -38265,7 +38334,7 @@ var init_bridge = __esm({
|
|
|
38265
38334
|
|
|
38266
38335
|
// ../../packages/tacho/src/contained/workspace.ts
|
|
38267
38336
|
import { lstatSync as lstatSync6, readFileSync as readFileSync14, readdirSync as readdirSync11, realpathSync as realpathSync3 } from "node:fs";
|
|
38268
|
-
import { isAbsolute as isAbsolute3, join as
|
|
38337
|
+
import { isAbsolute as isAbsolute3, join as join24, relative as relative2, resolve as resolve9, sep as sep2 } from "node:path";
|
|
38269
38338
|
function within(root, path2) {
|
|
38270
38339
|
const rel = relative2(root, path2);
|
|
38271
38340
|
return rel === "" || !isAbsolute3(rel) && rel !== ".." && !rel.startsWith(`..${sep2}`);
|
|
@@ -38295,7 +38364,7 @@ function validateContainedWorkspace(workspace, sessionDirectory, mountInfo = rea
|
|
|
38295
38364
|
}
|
|
38296
38365
|
const visit2 = (directory) => {
|
|
38297
38366
|
for (const entry2 of readdirSync11(directory)) {
|
|
38298
|
-
const path2 =
|
|
38367
|
+
const path2 = join24(directory, entry2);
|
|
38299
38368
|
if (CREDENTIAL_PATHS.has(entry2) || isEnvFile(entry2))
|
|
38300
38369
|
throw new Error(
|
|
38301
38370
|
`Remove local credential files from the contained checkout before launch: ${named(path2)}`
|
|
@@ -38329,7 +38398,7 @@ function validateContainedWorkspace(workspace, sessionDirectory, mountInfo = rea
|
|
|
38329
38398
|
}
|
|
38330
38399
|
function gitDirectoryMounts(workspace) {
|
|
38331
38400
|
const root = realpathSync3(workspace);
|
|
38332
|
-
const dotGit =
|
|
38401
|
+
const dotGit = join24(root, ".git");
|
|
38333
38402
|
let stat7;
|
|
38334
38403
|
try {
|
|
38335
38404
|
stat7 = lstatSync6(dotGit);
|
|
@@ -38367,7 +38436,7 @@ function gitDirectoryMounts(workspace) {
|
|
|
38367
38436
|
if (gitDir !== void 0) {
|
|
38368
38437
|
let common;
|
|
38369
38438
|
try {
|
|
38370
|
-
common = readFileSync14(
|
|
38439
|
+
common = readFileSync14(join24(gitDir, "commondir"), "utf8").trim();
|
|
38371
38440
|
} catch {
|
|
38372
38441
|
common = void 0;
|
|
38373
38442
|
}
|
|
@@ -38394,7 +38463,7 @@ var init_workspace = __esm({
|
|
|
38394
38463
|
// ../../packages/tacho/src/collector/hardened-git.ts
|
|
38395
38464
|
import { execFile as execFile2 } from "node:child_process";
|
|
38396
38465
|
import { lstatSync as lstatSync7, readFileSync as readFileSync15, statSync as statSync8 } from "node:fs";
|
|
38397
|
-
import { dirname as dirname15, join as
|
|
38466
|
+
import { dirname as dirname15, join as join25, resolve as resolve10 } from "node:path";
|
|
38398
38467
|
function hardenedGitArgs(cwd, args, globals = []) {
|
|
38399
38468
|
const subcommand = args[0];
|
|
38400
38469
|
const end = args.indexOf("--");
|
|
@@ -38433,7 +38502,7 @@ function gitIdentity(repository, deps = DEFAULT_IDENTITY_DEPS) {
|
|
|
38433
38502
|
};
|
|
38434
38503
|
}
|
|
38435
38504
|
for (let at2 = directory; ; at2 = dirname15(at2)) {
|
|
38436
|
-
const marker =
|
|
38505
|
+
const marker = join25(at2, ".git");
|
|
38437
38506
|
const link = tryStat(deps.lstat, marker);
|
|
38438
38507
|
if (link !== void 0) {
|
|
38439
38508
|
owners.push(link);
|
|
@@ -38441,7 +38510,7 @@ function gitIdentity(repository, deps = DEFAULT_IDENTITY_DEPS) {
|
|
|
38441
38510
|
if (target2 !== void 0) {
|
|
38442
38511
|
owners.push(target2);
|
|
38443
38512
|
if (target2.isDirectory()) {
|
|
38444
|
-
const config = tryStat(deps.stat,
|
|
38513
|
+
const config = tryStat(deps.stat, join25(marker, "config"));
|
|
38445
38514
|
if (config !== void 0) owners.push(config);
|
|
38446
38515
|
}
|
|
38447
38516
|
}
|
|
@@ -38593,7 +38662,7 @@ var init_hardened_git = __esm({
|
|
|
38593
38662
|
|
|
38594
38663
|
// ../../packages/tacho/src/contained/profile.ts
|
|
38595
38664
|
import { createHash as createHash6 } from "node:crypto";
|
|
38596
|
-
import { isAbsolute as isAbsolute4, join as
|
|
38665
|
+
import { isAbsolute as isAbsolute4, join as join26, relative as relative3, sep as sep3 } from "node:path";
|
|
38597
38666
|
function containerPath(workspace, path2) {
|
|
38598
38667
|
const inside2 = relative3(workspace, path2);
|
|
38599
38668
|
if (inside2 === "" || isAbsolute4(inside2) || inside2 === ".." || inside2.startsWith(`..${sep3}`))
|
|
@@ -38603,7 +38672,7 @@ function containerPath(workspace, path2) {
|
|
|
38603
38672
|
return `/workspace/${inside2.split(sep3).join("/")}`;
|
|
38604
38673
|
}
|
|
38605
38674
|
function gitMountPairs(spec) {
|
|
38606
|
-
if (!spec.gitMounts.includes(
|
|
38675
|
+
if (!spec.gitMounts.includes(join26(spec.workspace, ".git")))
|
|
38607
38676
|
throw new Error(
|
|
38608
38677
|
"Contained execution must mount the repository's .git read-only"
|
|
38609
38678
|
);
|
|
@@ -38770,7 +38839,7 @@ import {
|
|
|
38770
38839
|
writeFileSync as writeFileSync2
|
|
38771
38840
|
} from "node:fs";
|
|
38772
38841
|
import { tmpdir } from "node:os";
|
|
38773
|
-
import { isAbsolute as isAbsolute5, join as
|
|
38842
|
+
import { isAbsolute as isAbsolute5, join as join27 } from "node:path";
|
|
38774
38843
|
import { promisify } from "node:util";
|
|
38775
38844
|
function reason(error) {
|
|
38776
38845
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -38809,7 +38878,7 @@ async function launchContainedAgent(options) {
|
|
|
38809
38878
|
if (digest6 === void 0)
|
|
38810
38879
|
throw new Error("The operator's contained image is not installed");
|
|
38811
38880
|
const sessionId = `contained-${randomBytes8(16).toString("hex")}`;
|
|
38812
|
-
const directory = mkdtempSync(
|
|
38881
|
+
const directory = mkdtempSync(join27(tmpdir(), "oxagen-contained-"));
|
|
38813
38882
|
chmodSync7(directory, 448);
|
|
38814
38883
|
let prepared;
|
|
38815
38884
|
let containerCreated = false;
|
|
@@ -38830,7 +38899,7 @@ async function launchContainedAgent(options) {
|
|
|
38830
38899
|
for (const [name2, contents] of entries2) {
|
|
38831
38900
|
if (!/^[a-z0-9.-]+$/.test(name2))
|
|
38832
38901
|
throw new Error("Invalid contained configuration filename");
|
|
38833
|
-
writeFileSync2(
|
|
38902
|
+
writeFileSync2(join27(directory, name2), contents, {
|
|
38834
38903
|
mode: 256,
|
|
38835
38904
|
flag: "wx"
|
|
38836
38905
|
});
|
|
@@ -39229,7 +39298,7 @@ var init_privilege = __esm({
|
|
|
39229
39298
|
|
|
39230
39299
|
// ../../packages/tacho/src/contained/sandbox/launcher.ts
|
|
39231
39300
|
import { randomBytes as randomBytes9 } from "node:crypto";
|
|
39232
|
-
import { join as
|
|
39301
|
+
import { join as join28 } from "node:path";
|
|
39233
39302
|
function shellQuote3(value) {
|
|
39234
39303
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
39235
39304
|
}
|
|
@@ -39319,7 +39388,7 @@ async function launchSandboxAgent(options) {
|
|
|
39319
39388
|
{ ...asAgent, cwd: SANDBOX_AGENT_HOME, timeoutMs: 15 * 6e4 }
|
|
39320
39389
|
);
|
|
39321
39390
|
for (const [name, contents] of Object.entries(claudeCodeUserState())) {
|
|
39322
|
-
const path2 =
|
|
39391
|
+
const path2 = join28(SANDBOX_AGENT_HOME, name);
|
|
39323
39392
|
system.writeFile(path2, contents, 384);
|
|
39324
39393
|
system.chown(path2, SANDBOX_AGENT_UID, SANDBOX_AGENT_GID);
|
|
39325
39394
|
}
|
|
@@ -39525,10 +39594,10 @@ var init_system = __esm({
|
|
|
39525
39594
|
});
|
|
39526
39595
|
|
|
39527
39596
|
// ../../packages/tacho/src/contained/runner.ts
|
|
39528
|
-
import { join as
|
|
39597
|
+
import { join as join29 } from "node:path";
|
|
39529
39598
|
function containedHookEnv(harness, workspace) {
|
|
39530
|
-
const home =
|
|
39531
|
-
return harness === "codex" ? { CODEX_HOME:
|
|
39599
|
+
const home = join29(workspace, ".oxagen-contained", "home");
|
|
39600
|
+
return harness === "codex" ? { CODEX_HOME: join29(home, ".codex") } : { CLAUDE_CONFIG_DIR: join29(home, ".claude") };
|
|
39532
39601
|
}
|
|
39533
39602
|
function containedLaunchEndpoint(host) {
|
|
39534
39603
|
const ingest = new URL(host.endpoints.ingest);
|
|
@@ -39726,7 +39795,7 @@ function createContainedRunner(options) {
|
|
|
39726
39795
|
sessionUuid2 = started.recorder.sessionUuid;
|
|
39727
39796
|
active2.set(sessionUuid2, controller);
|
|
39728
39797
|
const bridge = await startContainedBridge({
|
|
39729
|
-
socketPath:
|
|
39798
|
+
socketPath: join29(directory, "bridge.sock"),
|
|
39730
39799
|
...bridgeRoutes({
|
|
39731
39800
|
sessionId,
|
|
39732
39801
|
workspace,
|
|
@@ -39810,7 +39879,7 @@ function createContainedRunner(options) {
|
|
|
39810
39879
|
const abort = () => controller.abort();
|
|
39811
39880
|
signal?.addEventListener("abort", abort, { once: true });
|
|
39812
39881
|
if (signal?.aborted) abort();
|
|
39813
|
-
const env = { CLAUDE_CONFIG_DIR:
|
|
39882
|
+
const env = { CLAUDE_CONFIG_DIR: join29(SANDBOX_AGENT_HOME, ".claude") };
|
|
39814
39883
|
let sessionUuid2;
|
|
39815
39884
|
let launchedSessionId;
|
|
39816
39885
|
let opened = false;
|
|
@@ -39944,13 +40013,13 @@ var init_runner = __esm({
|
|
|
39944
40013
|
});
|
|
39945
40014
|
|
|
39946
40015
|
// ../../packages/tacho/src/host/repositories.ts
|
|
39947
|
-
import { existsSync as existsSync18 } from "node:fs";
|
|
39948
|
-
import { join as
|
|
40016
|
+
import { existsSync as existsSync18, readFileSync as readFileSync17, statSync as statSync10 } from "node:fs";
|
|
40017
|
+
import { dirname as dirname17, join as join30, resolve as resolve11, sep as sep4 } from "node:path";
|
|
39949
40018
|
function repositoriesFile(home) {
|
|
39950
|
-
return
|
|
40019
|
+
return join30(home.tachoDir, "repositories.json");
|
|
39951
40020
|
}
|
|
39952
40021
|
function workTreesDir(home) {
|
|
39953
|
-
return
|
|
40022
|
+
return join30(home.tachoDir, "work");
|
|
39954
40023
|
}
|
|
39955
40024
|
function readIndex(home) {
|
|
39956
40025
|
let raw;
|
|
@@ -39974,6 +40043,7 @@ function latest(checkouts) {
|
|
|
39974
40043
|
function recordCheckout(home, canonical3, root, seenAt) {
|
|
39975
40044
|
if (canonical3.length === 0 || root.length === 0) return false;
|
|
39976
40045
|
if (isUnder(root, workTreesDir(home))) return false;
|
|
40046
|
+
root = mainCheckoutOf(root);
|
|
39977
40047
|
const key = canonical3.toLowerCase();
|
|
39978
40048
|
const index = readIndex(home);
|
|
39979
40049
|
const kept = index.repositories[key] ?? [];
|
|
@@ -40000,8 +40070,24 @@ function recordCheckout(home, canonical3, root, seenAt) {
|
|
|
40000
40070
|
);
|
|
40001
40071
|
return true;
|
|
40002
40072
|
}
|
|
40073
|
+
function mainCheckoutOf(root) {
|
|
40074
|
+
const dotGit = join30(root, ".git");
|
|
40075
|
+
try {
|
|
40076
|
+
if (!statSync10(dotGit).isFile()) return root;
|
|
40077
|
+
const line = readFileSync17(dotGit, "utf8").trim();
|
|
40078
|
+
const match = /^gitdir:\s*(.+)$/m.exec(line);
|
|
40079
|
+
if (match === null) return root;
|
|
40080
|
+
const gitdir = resolve11(root, match[1].trim());
|
|
40081
|
+
const worktrees = dirname17(gitdir);
|
|
40082
|
+
if (!worktrees.endsWith(`${sep4}.git${sep4}worktrees`)) return root;
|
|
40083
|
+
const clone4 = dirname17(dirname17(worktrees));
|
|
40084
|
+
return existsSync18(join30(clone4, ".git")) ? clone4 : root;
|
|
40085
|
+
} catch {
|
|
40086
|
+
return root;
|
|
40087
|
+
}
|
|
40088
|
+
}
|
|
40003
40089
|
function defaultIsCheckout(root) {
|
|
40004
|
-
return existsSync18(
|
|
40090
|
+
return existsSync18(join30(root, ".git"));
|
|
40005
40091
|
}
|
|
40006
40092
|
function findCheckout(home, repository, host, deps = {}) {
|
|
40007
40093
|
const isCheckout = deps.isCheckout ?? defaultIsCheckout;
|
|
@@ -40049,7 +40135,7 @@ var init_repositories = __esm({
|
|
|
40049
40135
|
|
|
40050
40136
|
// ../../packages/tacho/src/collector/detector.ts
|
|
40051
40137
|
import { promises as fs3 } from "node:fs";
|
|
40052
|
-
import { basename as basename5, join as
|
|
40138
|
+
import { basename as basename5, join as join31 } from "node:path";
|
|
40053
40139
|
async function eachLimited(items, limit, task) {
|
|
40054
40140
|
let next = 0;
|
|
40055
40141
|
const workers = Array.from(
|
|
@@ -40075,7 +40161,7 @@ async function scanProject(dir) {
|
|
|
40075
40161
|
await eachLimited(names2, SCAN_CONCURRENCY, async (name) => {
|
|
40076
40162
|
const match = SESSION_FILE.exec(name);
|
|
40077
40163
|
if (match === null) return;
|
|
40078
|
-
const path2 =
|
|
40164
|
+
const path2 = join31(dir, name);
|
|
40079
40165
|
try {
|
|
40080
40166
|
const st = await fs3.stat(path2);
|
|
40081
40167
|
out.push({ sessionId: match[1], path: path2, mtimeMs: st.mtimeMs });
|
|
@@ -40116,7 +40202,7 @@ var init_detector = __esm({
|
|
|
40116
40202
|
continue;
|
|
40117
40203
|
}
|
|
40118
40204
|
await eachLimited(names2, SCAN_CONCURRENCY, async (name) => {
|
|
40119
|
-
const dir =
|
|
40205
|
+
const dir = join31(root, name);
|
|
40120
40206
|
try {
|
|
40121
40207
|
const st = await fs3.stat(dir);
|
|
40122
40208
|
if (st.isDirectory()) dirs.push({ dir, mtimeMs: st.mtimeMs });
|
|
@@ -40356,7 +40442,7 @@ var init_detector = __esm({
|
|
|
40356
40442
|
transcript_path: transcript.path,
|
|
40357
40443
|
transcript_mtime: new Date(transcript.mtimeMs).toISOString(),
|
|
40358
40444
|
claude_pids: processes.map((p) => p.pid),
|
|
40359
|
-
project: basename5(
|
|
40445
|
+
project: basename5(join31(transcript.path, ".."))
|
|
40360
40446
|
}
|
|
40361
40447
|
})
|
|
40362
40448
|
);
|
|
@@ -40728,7 +40814,7 @@ var init_git_facts = __esm({
|
|
|
40728
40814
|
// ../../packages/tacho/src/collector/work-order-autostart.ts
|
|
40729
40815
|
import { spawn as spawn5 } from "node:child_process";
|
|
40730
40816
|
import { closeSync as closeSync7, existsSync as existsSync19, openSync as openSync7 } from "node:fs";
|
|
40731
|
-
import { dirname as
|
|
40817
|
+
import { dirname as dirname18, join as join32 } from "node:path";
|
|
40732
40818
|
function asError(error) {
|
|
40733
40819
|
return error instanceof Error ? error : new Error(String(error));
|
|
40734
40820
|
}
|
|
@@ -40741,6 +40827,14 @@ function createWorkOrderAutostart(deps) {
|
|
|
40741
40827
|
const { paths, log } = deps;
|
|
40742
40828
|
const isAlive = deps.isAlive ?? processIsAlive;
|
|
40743
40829
|
const spawnHarness = deps.spawn ?? spawnDetached;
|
|
40830
|
+
let searchPath;
|
|
40831
|
+
const pathForHarness = () => {
|
|
40832
|
+
if (searchPath === void 0) {
|
|
40833
|
+
const login = (deps.loginPath ?? (() => loginShellPath(deps.env)))();
|
|
40834
|
+
searchPath = harnessPath(deps.env, deps.env["HOME"] ?? "", login);
|
|
40835
|
+
}
|
|
40836
|
+
return searchPath;
|
|
40837
|
+
};
|
|
40744
40838
|
const lookup = deps.findCheckout ?? ((repository) => findCheckout(paths, repository, deps.host()));
|
|
40745
40839
|
const retry = /* @__PURE__ */ new Map();
|
|
40746
40840
|
const cleanups = /* @__PURE__ */ new Set();
|
|
@@ -40773,7 +40867,7 @@ function createWorkOrderAutostart(deps) {
|
|
|
40773
40867
|
}
|
|
40774
40868
|
async function abandon(id2) {
|
|
40775
40869
|
forget(id2);
|
|
40776
|
-
const worktree =
|
|
40870
|
+
const worktree = join32(workTreesDir(paths), id2);
|
|
40777
40871
|
if (!existsSync19(worktree)) return;
|
|
40778
40872
|
const [common, branch, head2] = await Promise.all([
|
|
40779
40873
|
git6(worktree, ["rev-parse", "--path-format=absolute", "--git-common-dir"]),
|
|
@@ -40789,7 +40883,7 @@ function createWorkOrderAutostart(deps) {
|
|
|
40789
40883
|
await cleanUp(
|
|
40790
40884
|
{
|
|
40791
40885
|
work_order: id2,
|
|
40792
|
-
root:
|
|
40886
|
+
root: dirname18(common.out),
|
|
40793
40887
|
worktree,
|
|
40794
40888
|
branch: branch.out,
|
|
40795
40889
|
base_sha: head2.out
|
|
@@ -40811,7 +40905,7 @@ function createWorkOrderAutostart(deps) {
|
|
|
40811
40905
|
return waitMs;
|
|
40812
40906
|
}
|
|
40813
40907
|
async function prepareWorktree(root, id2, itemNumber) {
|
|
40814
|
-
const worktree =
|
|
40908
|
+
const worktree = join32(workTreesDir(paths), id2);
|
|
40815
40909
|
const logPath = `${worktree}.log`;
|
|
40816
40910
|
if (existsSync19(worktree)) {
|
|
40817
40911
|
const [branch2, head2] = await Promise.all([
|
|
@@ -40963,7 +41057,12 @@ function createWorkOrderAutostart(deps) {
|
|
|
40963
41057
|
headlessArgs(harness, claim.prompt),
|
|
40964
41058
|
{
|
|
40965
41059
|
cwd: workspace.worktree,
|
|
40966
|
-
env: {
|
|
41060
|
+
env: {
|
|
41061
|
+
...deps.env,
|
|
41062
|
+
PATH: pathForHarness(),
|
|
41063
|
+
...headlessEnv(harness),
|
|
41064
|
+
[WORK_ORDER_ENV]: id2
|
|
41065
|
+
},
|
|
40967
41066
|
logPath: workspace.log
|
|
40968
41067
|
}
|
|
40969
41068
|
);
|
|
@@ -41060,6 +41159,7 @@ var init_work_order_autostart = __esm({
|
|
|
41060
41159
|
"../../packages/tacho/src/collector/work-order-autostart.ts"() {
|
|
41061
41160
|
"use strict";
|
|
41062
41161
|
init_fs();
|
|
41162
|
+
init_harness_path();
|
|
41063
41163
|
init_repositories();
|
|
41064
41164
|
init_work_order_start();
|
|
41065
41165
|
init_work_orders();
|
|
@@ -41071,7 +41171,7 @@ var init_work_order_autostart = __esm({
|
|
|
41071
41171
|
spawnDetached = (command2, args, options) => new Promise((resolve25) => {
|
|
41072
41172
|
let fd2;
|
|
41073
41173
|
try {
|
|
41074
|
-
ensureDir(
|
|
41174
|
+
ensureDir(dirname18(options.logPath));
|
|
41075
41175
|
fd2 = openSync7(options.logPath, "a", 384);
|
|
41076
41176
|
} catch (error) {
|
|
41077
41177
|
resolve25({ ok: false, error: asError(error) });
|
|
@@ -41175,7 +41275,7 @@ import {
|
|
|
41175
41275
|
rm,
|
|
41176
41276
|
unlink
|
|
41177
41277
|
} from "node:fs/promises";
|
|
41178
|
-
import { dirname as
|
|
41278
|
+
import { dirname as dirname19, join as join33 } from "node:path";
|
|
41179
41279
|
function byPath(a, b3) {
|
|
41180
41280
|
return a.path < b3.path ? -1 : a.path > b3.path ? 1 : 0;
|
|
41181
41281
|
}
|
|
@@ -41218,7 +41318,7 @@ async function contentHash(absolutePath, kind, keep) {
|
|
|
41218
41318
|
if (keep !== void 0) {
|
|
41219
41319
|
try {
|
|
41220
41320
|
await mkdir(keep.dir, { recursive: true, mode: 448 });
|
|
41221
|
-
const temp2 =
|
|
41321
|
+
const temp2 = join33(keep.dir, `.partial-${randomUUID3()}`);
|
|
41222
41322
|
copy = {
|
|
41223
41323
|
temp: temp2,
|
|
41224
41324
|
handle: await open3(temp2, "wx", keep.executable ? 448 : 384)
|
|
@@ -41262,7 +41362,7 @@ async function settleCopy(temp, name) {
|
|
|
41262
41362
|
if (temp === void 0) return;
|
|
41263
41363
|
if (name !== void 0)
|
|
41264
41364
|
try {
|
|
41265
|
-
await rename(temp,
|
|
41365
|
+
await rename(temp, join33(dirname19(temp), name));
|
|
41266
41366
|
return;
|
|
41267
41367
|
} catch {
|
|
41268
41368
|
}
|
|
@@ -41278,7 +41378,7 @@ async function copiedBytes(dir) {
|
|
|
41278
41378
|
let total2 = 0;
|
|
41279
41379
|
for (const name of names2) {
|
|
41280
41380
|
try {
|
|
41281
|
-
total2 += (await lstat(
|
|
41381
|
+
total2 += (await lstat(join33(dir, name))).size;
|
|
41282
41382
|
} catch {
|
|
41283
41383
|
}
|
|
41284
41384
|
}
|
|
@@ -41294,7 +41394,7 @@ async function removeCopiesOutside(root, live) {
|
|
|
41294
41394
|
const keep = new Set(live());
|
|
41295
41395
|
await Promise.all(
|
|
41296
41396
|
names2.filter((name) => !keep.has(name)).map(
|
|
41297
|
-
(name) => rm(
|
|
41397
|
+
(name) => rm(join33(root, name), { recursive: true, force: true }).catch(
|
|
41298
41398
|
() => void 0
|
|
41299
41399
|
)
|
|
41300
41400
|
)
|
|
@@ -41316,7 +41416,7 @@ async function readPreexistingPaths(exec4, root, startedAtMs, copies) {
|
|
|
41316
41416
|
if (found === void 0) return;
|
|
41317
41417
|
if (found === "absent") {
|
|
41318
41418
|
if (!deletedIn(entry2.code)) return;
|
|
41319
|
-
const parent = await directoryChangedAt(
|
|
41419
|
+
const parent = await directoryChangedAt(dirname19(absolute));
|
|
41320
41420
|
if (parent === void 0 || parent >= startedAtMs) return;
|
|
41321
41421
|
paths[entry2.path] = null;
|
|
41322
41422
|
return;
|
|
@@ -41401,7 +41501,7 @@ async function contributionOf(exec4, cwd, root, repoRelative, entry2, copies) {
|
|
|
41401
41501
|
let copy = null;
|
|
41402
41502
|
if (entry2 !== null) {
|
|
41403
41503
|
if (copies === void 0 || !COPY_NAME.test(entry2[0])) return void 0;
|
|
41404
|
-
copy =
|
|
41504
|
+
copy = join33(copies, entry2[0]);
|
|
41405
41505
|
const kept = await statOf(copy);
|
|
41406
41506
|
if (kept === void 0 || kept === "absent" || kept.kind !== "file")
|
|
41407
41507
|
return void 0;
|
|
@@ -41803,7 +41903,7 @@ var init_session_changes = __esm({
|
|
|
41803
41903
|
});
|
|
41804
41904
|
|
|
41805
41905
|
// ../../packages/tacho/src/collector/session-commits.ts
|
|
41806
|
-
import { join as
|
|
41906
|
+
import { join as join34 } from "node:path";
|
|
41807
41907
|
function parseMeta(stdout) {
|
|
41808
41908
|
const out = [];
|
|
41809
41909
|
for (const record of stdout.split("\0")) {
|
|
@@ -41928,7 +42028,7 @@ async function readSessionCommits(exec4, cwd, input) {
|
|
|
41928
42028
|
const test = input.tests[commit.sha];
|
|
41929
42029
|
const toolUseId = callAt(times.get(commit.sha), calls);
|
|
41930
42030
|
const written2 = input.written;
|
|
41931
|
-
const outside = merge || written2 === void 0 || root === void 0 ? void 0 : files2.some((file) => !written2.has(
|
|
42031
|
+
const outside = merge || written2 === void 0 || root === void 0 ? void 0 : files2.some((file) => !written2.has(join34(root, file.path)));
|
|
41932
42032
|
return {
|
|
41933
42033
|
sha: commit.sha,
|
|
41934
42034
|
parent_shas: commit.parents.slice(0, MAX_COMMIT_PARENTS),
|
|
@@ -41976,7 +42076,7 @@ var init_session_commits = __esm({
|
|
|
41976
42076
|
|
|
41977
42077
|
// ../../packages/tacho/src/collector/worktree-snapshot.ts
|
|
41978
42078
|
import { lstat as lstat2 } from "node:fs/promises";
|
|
41979
|
-
import { join as
|
|
42079
|
+
import { join as join35 } from "node:path";
|
|
41980
42080
|
function headerPath(prefix, path2) {
|
|
41981
42081
|
const name = `${prefix}${path2}`;
|
|
41982
42082
|
let quoted3 = false;
|
|
@@ -42060,7 +42160,7 @@ async function worktreeFingerprint(status2, root) {
|
|
|
42060
42160
|
const path2 = statusPath(record);
|
|
42061
42161
|
if (path2 === null) return "";
|
|
42062
42162
|
try {
|
|
42063
|
-
const info = await lstat2(
|
|
42163
|
+
const info = await lstat2(join35(root, path2));
|
|
42064
42164
|
return `${info.size}:${info.mtimeMs}:${info.ctimeMs}`;
|
|
42065
42165
|
} catch {
|
|
42066
42166
|
return "absent";
|
|
@@ -42168,7 +42268,7 @@ async function readWorktreeSnapshot(exec4, cwd, baseline, measured) {
|
|
|
42168
42268
|
}
|
|
42169
42269
|
let present;
|
|
42170
42270
|
try {
|
|
42171
|
-
present = (await lstat2(
|
|
42271
|
+
present = (await lstat2(join35(root, path2))).isFile();
|
|
42172
42272
|
} catch {
|
|
42173
42273
|
present = false;
|
|
42174
42274
|
}
|
|
@@ -42271,10 +42371,10 @@ var init_worktree_snapshot = __esm({
|
|
|
42271
42371
|
});
|
|
42272
42372
|
|
|
42273
42373
|
// ../../packages/tacho/src/collector/git-lane.ts
|
|
42274
|
-
import { join as
|
|
42374
|
+
import { join as join36 } from "node:path";
|
|
42275
42375
|
function copiesDirOf(root, session) {
|
|
42276
42376
|
const uuid = session.recorder.sessionUuid;
|
|
42277
|
-
return /^[0-9a-f-]{36}$/i.test(uuid) ?
|
|
42377
|
+
return /^[0-9a-f-]{36}$/i.test(uuid) ? join36(root, uuid) : void 0;
|
|
42278
42378
|
}
|
|
42279
42379
|
function holdsBaseline(session) {
|
|
42280
42380
|
return session.baselineCommit !== void 0 || Object.keys(session.baselines ?? {}).length > 0;
|
|
@@ -43308,7 +43408,7 @@ var init_policy_run = __esm({
|
|
|
43308
43408
|
|
|
43309
43409
|
// ../../packages/tacho/src/collector/hook-handler.ts
|
|
43310
43410
|
import { homedir as homedir4 } from "node:os";
|
|
43311
|
-
import { dirname as
|
|
43411
|
+
import { dirname as dirname20, isAbsolute as isAbsolute7 } from "node:path";
|
|
43312
43412
|
function containmentUnmet(view, record) {
|
|
43313
43413
|
return view.verified && view.bundle.mode === "enforce" && view.bundle.containment?.required === true && view.launchedContained?.(record.harnessSessionId) !== true;
|
|
43314
43414
|
}
|
|
@@ -44264,7 +44364,7 @@ async function routeHook(raw, env, deps, replay, harness, agent, hookId) {
|
|
|
44264
44364
|
}
|
|
44265
44365
|
function writtenDir(input) {
|
|
44266
44366
|
const path2 = writtenPath(input);
|
|
44267
|
-
return path2 === void 0 ? void 0 :
|
|
44367
|
+
return path2 === void 0 ? void 0 : dirname20(path2);
|
|
44268
44368
|
}
|
|
44269
44369
|
function writtenPath(input) {
|
|
44270
44370
|
if (input.hook_event_name !== "PreToolUse" && input.hook_event_name !== "PostToolUse")
|
|
@@ -44490,7 +44590,7 @@ var init_steer_waiters = __esm({
|
|
|
44490
44590
|
});
|
|
44491
44591
|
|
|
44492
44592
|
// ../../packages/tacho/src/collector/hook-id-journal.ts
|
|
44493
|
-
import { appendFileSync as appendFileSync3, existsSync as existsSync20, readFileSync as
|
|
44593
|
+
import { appendFileSync as appendFileSync3, existsSync as existsSync20, readFileSync as readFileSync18, rmSync as rmSync7 } from "node:fs";
|
|
44494
44594
|
function hookIdJournalEntry(session, key, at2, events) {
|
|
44495
44595
|
const highest = /* @__PURE__ */ new Map();
|
|
44496
44596
|
for (const event of events) {
|
|
@@ -44517,7 +44617,7 @@ function isEntry(value) {
|
|
|
44517
44617
|
function readHookIdJournal(path2) {
|
|
44518
44618
|
if (!existsSync20(path2)) return [];
|
|
44519
44619
|
const entries2 = [];
|
|
44520
|
-
for (const line of
|
|
44620
|
+
for (const line of readFileSync18(path2, "utf8").split("\n")) {
|
|
44521
44621
|
if (line.trim().length === 0) continue;
|
|
44522
44622
|
try {
|
|
44523
44623
|
const value = JSON.parse(line);
|
|
@@ -45642,7 +45742,7 @@ var init_hook_queues = __esm({
|
|
|
45642
45742
|
|
|
45643
45743
|
// ../../packages/tacho/src/collector/memory-capture/memory-reader.ts
|
|
45644
45744
|
import { createRequire as createRequire2 } from "node:module";
|
|
45645
|
-
import { isAbsolute as isAbsolute8, join as
|
|
45745
|
+
import { isAbsolute as isAbsolute8, join as join37, sep as sep6 } from "node:path";
|
|
45646
45746
|
function claudeCodeLocation(projectsDir, memoryDir) {
|
|
45647
45747
|
return {
|
|
45648
45748
|
harness: "claude-code",
|
|
@@ -45654,13 +45754,13 @@ function claudeCodeLocation(projectsDir, memoryDir) {
|
|
|
45654
45754
|
}
|
|
45655
45755
|
function claudeCodeMemoryLocations(configDir, projectDirs = []) {
|
|
45656
45756
|
const locations = [
|
|
45657
|
-
claudeCodeLocation(() =>
|
|
45658
|
-
claudeCodeLocation(() =>
|
|
45757
|
+
claudeCodeLocation(() => join37(configDir, "projects"), "memory"),
|
|
45758
|
+
claudeCodeLocation(() => join37(configDir, "agent-memory"), "")
|
|
45659
45759
|
];
|
|
45660
45760
|
for (const dir of projectDirs.slice(0, MEMORY_PROJECT_DIRS_MAX))
|
|
45661
45761
|
locations.push(
|
|
45662
|
-
claudeCodeLocation(() =>
|
|
45663
|
-
claudeCodeLocation(() =>
|
|
45762
|
+
claudeCodeLocation(() => join37(dir, ".claude", "agent-memory"), ""),
|
|
45763
|
+
claudeCodeLocation(() => join37(dir, ".claude", "agent-memory-local"), "")
|
|
45664
45764
|
);
|
|
45665
45765
|
return locations;
|
|
45666
45766
|
}
|
|
@@ -45845,13 +45945,13 @@ function createMemoryReader(deps) {
|
|
|
45845
45945
|
const projects = await list2(top);
|
|
45846
45946
|
let complete = projects.complete;
|
|
45847
45947
|
for (const project2 of projects.names) {
|
|
45848
|
-
const dir = location.memoryDir === "" ?
|
|
45948
|
+
const dir = location.memoryDir === "" ? join37(top, project2) : join37(top, project2, location.memoryDir);
|
|
45849
45949
|
const files2 = await list2(dir);
|
|
45850
45950
|
if (!files2.complete) complete = false;
|
|
45851
45951
|
for (const name of files2.names) {
|
|
45852
45952
|
if (!name.endsWith(location.extension)) continue;
|
|
45853
45953
|
if (location.skip.includes(name)) continue;
|
|
45854
|
-
const path2 =
|
|
45954
|
+
const path2 = join37(dir, name);
|
|
45855
45955
|
const file = await readAt2(location.harness, path2);
|
|
45856
45956
|
if (file.kind === "absent" || file.kind === "empty") continue;
|
|
45857
45957
|
paths.push(path2);
|
|
@@ -45937,8 +46037,8 @@ var init_memory_reader = __esm({
|
|
|
45937
46037
|
MEMORY_TYPE_PATTERN = /^[a-z][a-z0-9_-]{0,31}$/;
|
|
45938
46038
|
MEMORY_PROJECT_DIRS_MAX = 200;
|
|
45939
46039
|
HARNESS_MEMORY_LOCATIONS = [
|
|
45940
|
-
claudeCodeLocation((home) =>
|
|
45941
|
-
claudeCodeLocation((home) =>
|
|
46040
|
+
claudeCodeLocation((home) => join37(home, ".claude", "projects"), "memory"),
|
|
46041
|
+
claudeCodeLocation((home) => join37(home, ".claude", "agent-memory"), "")
|
|
45942
46042
|
];
|
|
45943
46043
|
FRONTMATTER = /^---[ \t]*\r?\n(?:([\s\S]*?)\r?\n)?---[ \t]*(?:\r?\n|$)/;
|
|
45944
46044
|
FRONTMATTER_LINE = /^([ \t]*)([A-Za-z_][\w-]*)[ \t]*:[ \t]*(.*)$/;
|
|
@@ -46430,25 +46530,25 @@ var init_memory_recall = __esm({
|
|
|
46430
46530
|
});
|
|
46431
46531
|
|
|
46432
46532
|
// ../../packages/tacho/src/collector/memory-capture/memory-uses.ts
|
|
46433
|
-
import { basename as basename6, dirname as
|
|
46533
|
+
import { basename as basename6, dirname as dirname21, isAbsolute as isAbsolute9, join as join38, resolve as resolve14 } from "node:path";
|
|
46434
46534
|
function memoryFileOf(path2, locations, home) {
|
|
46435
46535
|
if (!isAbsolute9(path2)) return void 0;
|
|
46436
46536
|
const file = resolve14(path2);
|
|
46437
46537
|
const name = basename6(file);
|
|
46438
|
-
const folder =
|
|
46538
|
+
const folder = dirname21(file);
|
|
46439
46539
|
for (const location of locations) {
|
|
46440
46540
|
if (!name.endsWith(location.extension)) continue;
|
|
46441
46541
|
if (location.skip.includes(name)) continue;
|
|
46442
|
-
const projectDir = location.memoryDir === "" ? folder :
|
|
46542
|
+
const projectDir = location.memoryDir === "" ? folder : dirname21(folder);
|
|
46443
46543
|
if (location.memoryDir !== "" && basename6(folder) !== location.memoryDir)
|
|
46444
46544
|
continue;
|
|
46445
|
-
if (
|
|
46545
|
+
if (dirname21(projectDir) !== resolve14(location.projectsDir(home))) continue;
|
|
46446
46546
|
return { harness: location.harness, path: file };
|
|
46447
46547
|
}
|
|
46448
46548
|
return void 0;
|
|
46449
46549
|
}
|
|
46450
46550
|
function pathOf(word, cwd, home) {
|
|
46451
|
-
const expanded = /^(?:~|\$HOME|\$\{HOME\})\//.test(word) ?
|
|
46551
|
+
const expanded = /^(?:~|\$HOME|\$\{HOME\})\//.test(word) ? join38(home, word.slice(word.indexOf("/") + 1)) : word;
|
|
46452
46552
|
if (isAbsolute9(expanded)) return expanded;
|
|
46453
46553
|
if (cwd !== void 0 && isAbsolute9(cwd)) return resolve14(cwd, expanded);
|
|
46454
46554
|
return void 0;
|
|
@@ -46704,7 +46804,7 @@ ${use.path}`;
|
|
|
46704
46804
|
});
|
|
46705
46805
|
|
|
46706
46806
|
// ../../packages/tacho/src/collector/memory-capture/stella-store.ts
|
|
46707
|
-
import { dirname as
|
|
46807
|
+
import { dirname as dirname22, isAbsolute as isAbsolute10, join as join39, resolve as resolve15 } from "node:path";
|
|
46708
46808
|
function queryStellaStore(path2, afterSeq, limit) {
|
|
46709
46809
|
const db = new (nodeSqlite()).DatabaseSync(path2, { readOnly: true });
|
|
46710
46810
|
try {
|
|
@@ -46794,9 +46894,9 @@ async function stellaStoreOf(dir, exists) {
|
|
|
46794
46894
|
if (!isAbsolute10(dir)) return void 0;
|
|
46795
46895
|
let at2 = resolve15(dir);
|
|
46796
46896
|
for (let depth = 0; depth < WORKSPACE_SEARCH_DEPTH; depth += 1) {
|
|
46797
|
-
const candidate =
|
|
46897
|
+
const candidate = join39(at2, STELLA_CONTEXT_DB);
|
|
46798
46898
|
if (await exists(candidate)) return candidate;
|
|
46799
|
-
const up =
|
|
46899
|
+
const up = dirname22(at2);
|
|
46800
46900
|
if (up === at2) return void 0;
|
|
46801
46901
|
at2 = up;
|
|
46802
46902
|
}
|
|
@@ -46807,7 +46907,7 @@ var init_stella_store = __esm({
|
|
|
46807
46907
|
"../../packages/tacho/src/collector/memory-capture/stella-store.ts"() {
|
|
46808
46908
|
"use strict";
|
|
46809
46909
|
init_memory_reader();
|
|
46810
|
-
STELLA_CONTEXT_DB =
|
|
46910
|
+
STELLA_CONTEXT_DB = join39(".stella", "private", "context.db");
|
|
46811
46911
|
STELLA_MEMORIES_VIEW = "export_memories_v1";
|
|
46812
46912
|
STELLA_USES_VIEW = "export_memory_uses_v1";
|
|
46813
46913
|
STELLA_USES_PER_READ = 5e3;
|
|
@@ -47469,7 +47569,7 @@ var init_cloud_link = __esm({
|
|
|
47469
47569
|
|
|
47470
47570
|
// ../../packages/tacho/src/collector/local-servers/digest.ts
|
|
47471
47571
|
import { createHash as createHash10 } from "node:crypto";
|
|
47472
|
-
import { join as
|
|
47572
|
+
import { join as join40 } from "node:path";
|
|
47473
47573
|
function rememberBounded(map, key, value) {
|
|
47474
47574
|
if (!map.has(key) && map.size >= MAX_REMEMBERED_DIGESTS) {
|
|
47475
47575
|
const oldest = map.keys().next();
|
|
@@ -47506,7 +47606,7 @@ function npmNameSegment(name) {
|
|
|
47506
47606
|
return name.startsWith("@") ? `@${encodeURIComponent(name.slice(1))}` : encodeURIComponent(name);
|
|
47507
47607
|
}
|
|
47508
47608
|
async function whichOnPath(command2, pathValue, search) {
|
|
47509
|
-
const candidates = command2.includes("/") || command2.includes("\\") ? [command2] : (pathValue ?? "").split(search.delimiter).filter((dir) => dir.length > 0).map((dir) =>
|
|
47609
|
+
const candidates = command2.includes("/") || command2.includes("\\") ? [command2] : (pathValue ?? "").split(search.delimiter).filter((dir) => dir.length > 0).map((dir) => join40(dir, command2));
|
|
47510
47610
|
for (const candidate of candidates) {
|
|
47511
47611
|
for (const extension of search.extensions) {
|
|
47512
47612
|
if (await search.isExecutable(candidate + extension))
|
|
@@ -48802,9 +48902,9 @@ import {
|
|
|
48802
48902
|
writeFile
|
|
48803
48903
|
} from "node:fs/promises";
|
|
48804
48904
|
import { homedir as homedir5 } from "node:os";
|
|
48805
|
-
import { dirname as
|
|
48905
|
+
import { dirname as dirname23, join as join41 } from "node:path";
|
|
48806
48906
|
function stagingFolder(root, name) {
|
|
48807
|
-
return
|
|
48907
|
+
return join41(root, `.${name}${STAGING_SUFFIX}`);
|
|
48808
48908
|
}
|
|
48809
48909
|
function isStagingName(name) {
|
|
48810
48910
|
return name.startsWith(".") && name.endsWith(STAGING_SUFFIX);
|
|
@@ -48847,17 +48947,17 @@ function envDir(env, key) {
|
|
|
48847
48947
|
function skillsRoot(harness, env = process.env, home = homedir5()) {
|
|
48848
48948
|
switch (harness) {
|
|
48849
48949
|
case "claude-code":
|
|
48850
|
-
return
|
|
48851
|
-
envDir(env, "CLAUDE_CONFIG_DIR") ??
|
|
48950
|
+
return join41(
|
|
48951
|
+
envDir(env, "CLAUDE_CONFIG_DIR") ?? join41(home, ".claude"),
|
|
48852
48952
|
"skills"
|
|
48853
48953
|
);
|
|
48854
48954
|
case "codex": {
|
|
48855
48955
|
const codexHome = envDir(env, "CODEX_HOME");
|
|
48856
|
-
return codexHome === null ?
|
|
48956
|
+
return codexHome === null ? join41(home, ".agents", "skills") : join41(codexHome, "skills");
|
|
48857
48957
|
}
|
|
48858
48958
|
case "stella":
|
|
48859
|
-
return
|
|
48860
|
-
envDir(env, "STELLA_HOME") ??
|
|
48959
|
+
return join41(
|
|
48960
|
+
envDir(env, "STELLA_HOME") ?? join41(home, ".stella"),
|
|
48861
48961
|
"skills"
|
|
48862
48962
|
);
|
|
48863
48963
|
case "cursor":
|
|
@@ -48918,7 +49018,7 @@ async function readMarker(folder) {
|
|
|
48918
49018
|
if (!entries2.includes(SESSION_MARKER)) return { state: "foreign" };
|
|
48919
49019
|
try {
|
|
48920
49020
|
const parsed2 = JSON.parse(
|
|
48921
|
-
await readFile2(
|
|
49021
|
+
await readFile2(join41(folder, SESSION_MARKER), "utf8")
|
|
48922
49022
|
);
|
|
48923
49023
|
return isMarker(parsed2) ? { state: "ours", marker: parsed2 } : { state: "foreign" };
|
|
48924
49024
|
} catch {
|
|
@@ -48935,23 +49035,23 @@ function liveSessions(marker, now) {
|
|
|
48935
49035
|
return live;
|
|
48936
49036
|
}
|
|
48937
49037
|
async function writeMarker(folder, marker) {
|
|
48938
|
-
const temp =
|
|
49038
|
+
const temp = join41(folder, MARKER_TEMP);
|
|
48939
49039
|
await writeFile(temp, `${JSON.stringify(marker, null, 2)}
|
|
48940
49040
|
`);
|
|
48941
|
-
await rename2(temp,
|
|
49041
|
+
await rename2(temp, join41(folder, SESSION_MARKER));
|
|
48942
49042
|
}
|
|
48943
49043
|
async function writeSkill(root, skill, marker) {
|
|
48944
|
-
const folder =
|
|
49044
|
+
const folder = join41(root, skill.name);
|
|
48945
49045
|
const staging = stagingFolder(root, skill.name);
|
|
48946
49046
|
await rm2(folder, { recursive: true, force: true });
|
|
48947
49047
|
await rm2(staging, { recursive: true, force: true });
|
|
48948
49048
|
await mkdir2(staging);
|
|
48949
49049
|
await writeMarker(staging, { digest: UNFINISHED_DIGEST, sessions: {} });
|
|
48950
49050
|
await rename2(staging, folder);
|
|
48951
|
-
await writeFile(
|
|
49051
|
+
await writeFile(join41(folder, "SKILL.md"), skillMarkdown(skill));
|
|
48952
49052
|
for (const file of skill.files) {
|
|
48953
|
-
const target2 =
|
|
48954
|
-
await mkdir2(
|
|
49053
|
+
const target2 = join41(folder, file.path);
|
|
49054
|
+
await mkdir2(dirname23(target2), { recursive: true });
|
|
48955
49055
|
await writeFile(target2, file.content);
|
|
48956
49056
|
}
|
|
48957
49057
|
await writeMarker(folder, marker);
|
|
@@ -48979,7 +49079,7 @@ async function placeSkills(root, sessionId, skills, now = /* @__PURE__ */ new Da
|
|
|
48979
49079
|
result2.warnings.push(refusal);
|
|
48980
49080
|
continue;
|
|
48981
49081
|
}
|
|
48982
|
-
const folder =
|
|
49082
|
+
const folder = join41(root, skill.name);
|
|
48983
49083
|
if (taken.has(skill.name)) {
|
|
48984
49084
|
result2.skipped.push(skill.name);
|
|
48985
49085
|
result2.warnings.push(
|
|
@@ -49044,7 +49144,7 @@ async function removeSkills(root, sessionId, now = /* @__PURE__ */ new Date()) {
|
|
|
49044
49144
|
throw error;
|
|
49045
49145
|
}
|
|
49046
49146
|
for (const name of names2.sort(compareText)) {
|
|
49047
|
-
const folder =
|
|
49147
|
+
const folder = join41(root, name);
|
|
49048
49148
|
if (isStagingName(name)) {
|
|
49049
49149
|
await rm2(folder, { recursive: true, force: true });
|
|
49050
49150
|
continue;
|
|
@@ -52287,7 +52387,7 @@ var init_model_proxy_listener = __esm({
|
|
|
52287
52387
|
import {
|
|
52288
52388
|
createServer as createServer5
|
|
52289
52389
|
} from "node:http";
|
|
52290
|
-
import { chmodSync as chmodSync9, existsSync as existsSync21, statSync as
|
|
52390
|
+
import { chmodSync as chmodSync9, existsSync as existsSync21, statSync as statSync11, unlinkSync as unlinkSync11 } from "node:fs";
|
|
52291
52391
|
import { randomBytes as randomBytes11, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
|
|
52292
52392
|
import { createConnection } from "node:net";
|
|
52293
52393
|
function isExportFormat(value) {
|
|
@@ -52652,7 +52752,7 @@ function createRequestHandler(api, log, options = {}) {
|
|
|
52652
52752
|
}
|
|
52653
52753
|
async function removeStaleSocket(socketPath) {
|
|
52654
52754
|
if (!existsSync21(socketPath)) return;
|
|
52655
|
-
if (!
|
|
52755
|
+
if (!statSync11(socketPath).isSocket()) {
|
|
52656
52756
|
throw new Error(`collector socket path is not a socket: ${socketPath}`);
|
|
52657
52757
|
}
|
|
52658
52758
|
const stale = await new Promise((resolve25, reject) => {
|
|
@@ -52820,13 +52920,13 @@ var init_server = __esm({
|
|
|
52820
52920
|
});
|
|
52821
52921
|
|
|
52822
52922
|
// ../../packages/tacho/src/collector/refused.ts
|
|
52823
|
-
import { readdirSync as readdirSync12, readFileSync as
|
|
52824
|
-
import { join as
|
|
52923
|
+
import { readdirSync as readdirSync12, readFileSync as readFileSync19, statSync as statSync12 } from "node:fs";
|
|
52924
|
+
import { join as join42 } from "node:path";
|
|
52825
52925
|
function refusalRetryable(refusal) {
|
|
52826
52926
|
return refusal === "malformed" || refusal === "parked";
|
|
52827
52927
|
}
|
|
52828
52928
|
function refusedRecordPath(dir, event) {
|
|
52829
|
-
return
|
|
52929
|
+
return join42(dir, `${event.session_uuid}-${String(event.seq).padStart(8, "0")}.json`);
|
|
52830
52930
|
}
|
|
52831
52931
|
function newRefusedRecord(event, reason3, refusal, at2, body2) {
|
|
52832
52932
|
const retryable = refusalRetryable(refusal);
|
|
@@ -52869,8 +52969,8 @@ function readRefusedEntry(file) {
|
|
|
52869
52969
|
let record;
|
|
52870
52970
|
let mtimeMs;
|
|
52871
52971
|
try {
|
|
52872
|
-
record = JSON.parse(
|
|
52873
|
-
mtimeMs =
|
|
52972
|
+
record = JSON.parse(readFileSync19(file, "utf8"));
|
|
52973
|
+
mtimeMs = statSync12(file).mtimeMs;
|
|
52874
52974
|
} catch {
|
|
52875
52975
|
return void 0;
|
|
52876
52976
|
}
|
|
@@ -52902,7 +53002,7 @@ function scanRefused(dir, now, limit = MAX_REFUSED_RETRIES_PER_PASS) {
|
|
|
52902
53002
|
};
|
|
52903
53003
|
const due = [];
|
|
52904
53004
|
for (const name of names2) {
|
|
52905
|
-
const entry2 = readRefusedEntry(
|
|
53005
|
+
const entry2 = readRefusedEntry(join42(dir, name));
|
|
52906
53006
|
if (entry2 === void 0) continue;
|
|
52907
53007
|
summary.total += 1;
|
|
52908
53008
|
if (summary.lastRefusedAt === void 0 || entry2.refusedAt > summary.lastRefusedAt)
|
|
@@ -52938,8 +53038,8 @@ var init_refused = __esm({
|
|
|
52938
53038
|
});
|
|
52939
53039
|
|
|
52940
53040
|
// ../../packages/tacho/src/collector/spool.ts
|
|
52941
|
-
import { existsSync as existsSync22, readFileSync as
|
|
52942
|
-
import { join as
|
|
53041
|
+
import { existsSync as existsSync22, readFileSync as readFileSync20, unlinkSync as unlinkSync12 } from "node:fs";
|
|
53042
|
+
import { join as join43 } from "node:path";
|
|
52943
53043
|
function sessionOwnedElsewhere(error) {
|
|
52944
53044
|
return error.status === 403 && error.body.includes(SESSION_OWNED_ELSEWHERE);
|
|
52945
53045
|
}
|
|
@@ -53172,12 +53272,12 @@ var init_spool = __esm({
|
|
|
53172
53272
|
}
|
|
53173
53273
|
/** Add a body to a quarantine record that was written without one. */
|
|
53174
53274
|
stashBodyBeside(event, body2) {
|
|
53175
|
-
const path2 =
|
|
53275
|
+
const path2 = join43(
|
|
53176
53276
|
this.options.quarantineDir,
|
|
53177
53277
|
`${event.session_uuid}-${String(event.seq).padStart(8, "0")}.json`
|
|
53178
53278
|
);
|
|
53179
53279
|
try {
|
|
53180
|
-
const record = JSON.parse(
|
|
53280
|
+
const record = JSON.parse(readFileSync20(path2, "utf8"));
|
|
53181
53281
|
if (record["body"] !== void 0) return;
|
|
53182
53282
|
writeSensitiveFileAtomic(
|
|
53183
53283
|
path2,
|
|
@@ -53821,15 +53921,15 @@ var init_session_heads = __esm({
|
|
|
53821
53921
|
import {
|
|
53822
53922
|
existsSync as existsSync23,
|
|
53823
53923
|
readdirSync as readdirSync13,
|
|
53824
|
-
readFileSync as
|
|
53924
|
+
readFileSync as readFileSync21,
|
|
53825
53925
|
renameSync as renameSync4,
|
|
53826
|
-
statSync as
|
|
53926
|
+
statSync as statSync13,
|
|
53827
53927
|
unlinkSync as unlinkSync13
|
|
53828
53928
|
} from "node:fs";
|
|
53829
53929
|
import { readdir as readdir3, readFile as readFile3, stat as stat2 } from "node:fs/promises";
|
|
53830
53930
|
import { homedir as homedir7, hostname as osHostname2 } from "node:os";
|
|
53831
|
-
import { dirname as
|
|
53832
|
-
import { spawnSync as
|
|
53931
|
+
import { dirname as dirname24, join as join44 } from "node:path";
|
|
53932
|
+
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
53833
53933
|
function cloudGatewayUpstreams(origin = CLOUD_GATEWAY_ORIGIN) {
|
|
53834
53934
|
const base2 = new URL(origin).origin;
|
|
53835
53935
|
const openai = `${base2}${CLOUD_GATEWAY_BASE_PATH}/openai/v1`;
|
|
@@ -53859,7 +53959,7 @@ function cloudGatewayCredentialStore(disk, runToken) {
|
|
|
53859
53959
|
}
|
|
53860
53960
|
function readTextOrUndefined(path2) {
|
|
53861
53961
|
try {
|
|
53862
|
-
return
|
|
53962
|
+
return readFileSync21(path2, "utf8");
|
|
53863
53963
|
} catch {
|
|
53864
53964
|
return void 0;
|
|
53865
53965
|
}
|
|
@@ -53880,7 +53980,7 @@ function parseOtlpPayload(payload) {
|
|
|
53880
53980
|
return otlpPayloadSchema.parse(payload);
|
|
53881
53981
|
}
|
|
53882
53982
|
function defaultExec(command2, args) {
|
|
53883
|
-
const result2 =
|
|
53983
|
+
const result2 = spawnSync7(command2, args, {
|
|
53884
53984
|
encoding: "utf8",
|
|
53885
53985
|
maxBuffer: 4 * 1024 * 1024,
|
|
53886
53986
|
timeout: 1e4
|
|
@@ -54060,7 +54160,7 @@ async function initializeDaemon(options, server, port, ready) {
|
|
|
54060
54160
|
}) : void 0;
|
|
54061
54161
|
const memoryHome = options.home ?? homedir7();
|
|
54062
54162
|
const memoryLocations = () => claudeCodeMemoryLocations(
|
|
54063
|
-
|
|
54163
|
+
dirname24(paths.claudeProjects),
|
|
54064
54164
|
projectDirsOf(registry2.list())
|
|
54065
54165
|
);
|
|
54066
54166
|
const memoryUses = options.listen ?? true ? createMemoryUses({
|
|
@@ -54171,7 +54271,7 @@ async function initializeDaemon(options, server, port, ready) {
|
|
|
54171
54271
|
processStarts: hookProcessStarts,
|
|
54172
54272
|
adoptedChain: (sessionUuid2) => backfillLedger.chainHead(sessionUuid2)
|
|
54173
54273
|
});
|
|
54174
|
-
const priorStateWrittenAt = existsSync23(paths.daemonState) ?
|
|
54274
|
+
const priorStateWrittenAt = existsSync23(paths.daemonState) ? statSync13(paths.daemonState).mtimeMs : void 0;
|
|
54175
54275
|
const sealedState = parseSealedState(
|
|
54176
54276
|
readJsonStateFile(
|
|
54177
54277
|
paths.daemonSealedState,
|
|
@@ -54572,7 +54672,7 @@ async function initializeDaemon(options, server, port, ready) {
|
|
|
54572
54672
|
controlReachable: lastControlAt !== void 0 && now() - lastControlAt < 2 * timers.bundleRefreshMs
|
|
54573
54673
|
};
|
|
54574
54674
|
}
|
|
54575
|
-
const bodyPurgeOwedPath =
|
|
54675
|
+
const bodyPurgeOwedPath = join44(paths.wal, "body-purge-owed");
|
|
54576
54676
|
function markBodyPurgeOwed(retention, dropped) {
|
|
54577
54677
|
try {
|
|
54578
54678
|
ensureDir(paths.wal);
|
|
@@ -54594,7 +54694,7 @@ async function initializeDaemon(options, server, port, ready) {
|
|
|
54594
54694
|
if (!existsSync23(bodyPurgeOwedPath)) return void 0;
|
|
54595
54695
|
let text5;
|
|
54596
54696
|
try {
|
|
54597
|
-
text5 =
|
|
54697
|
+
text5 = readFileSync21(bodyPurgeOwedPath, "utf8");
|
|
54598
54698
|
} catch (error) {
|
|
54599
54699
|
log(
|
|
54600
54700
|
`cannot read the owed body purge at ${bodyPurgeOwedPath}: ${error instanceof Error ? error.message : String(error)}; the retry sweeps against the clause in force. Check the file's permissions`
|
|
@@ -54849,7 +54949,7 @@ async function initializeDaemon(options, server, port, ready) {
|
|
|
54849
54949
|
}
|
|
54850
54950
|
void workOrderAutostart.reconcile();
|
|
54851
54951
|
}
|
|
54852
|
-
const lastIngestFile =
|
|
54952
|
+
const lastIngestFile = join44(paths.dir, "last-ingest.json");
|
|
54853
54953
|
const shipper = new Shipper({
|
|
54854
54954
|
wal,
|
|
54855
54955
|
client,
|
|
@@ -54890,7 +54990,7 @@ async function initializeDaemon(options, server, port, ready) {
|
|
|
54890
54990
|
read: () => {
|
|
54891
54991
|
try {
|
|
54892
54992
|
const at2 = Date.parse(
|
|
54893
|
-
JSON.parse(
|
|
54993
|
+
JSON.parse(readFileSync21(lastIngestFile, "utf8")).at ?? ""
|
|
54894
54994
|
);
|
|
54895
54995
|
return Number.isFinite(at2) ? at2 : void 0;
|
|
54896
54996
|
} catch {
|
|
@@ -55371,7 +55471,7 @@ async function initializeDaemon(options, server, port, ready) {
|
|
|
55371
55471
|
async function readSpoolFile(name) {
|
|
55372
55472
|
try {
|
|
55373
55473
|
const file = parseSpoolFile(
|
|
55374
|
-
await readFile3(
|
|
55474
|
+
await readFile3(join44(paths.spool, name), "utf8")
|
|
55375
55475
|
);
|
|
55376
55476
|
spoolFacts.set(name, spoolFactsOf(file));
|
|
55377
55477
|
return file;
|
|
@@ -55560,7 +55660,7 @@ async function initializeDaemon(options, server, port, ready) {
|
|
|
55560
55660
|
function setAsideConflictingTerminal(uuid, pending, conflict) {
|
|
55561
55661
|
const name = `${uuid}-terminal-conflict-${String(conflict.seq).padStart(8, "0")}.json`;
|
|
55562
55662
|
writeSensitiveFileAtomic(
|
|
55563
|
-
|
|
55663
|
+
join44(paths.quarantine, name),
|
|
55564
55664
|
JSON.stringify(
|
|
55565
55665
|
{
|
|
55566
55666
|
reason: conflict.message,
|
|
@@ -55640,8 +55740,8 @@ async function initializeDaemon(options, server, port, ready) {
|
|
|
55640
55740
|
function moveToFailedSpool(path2, name, reason3) {
|
|
55641
55741
|
log(`spool file ${name} moved to spool/failed/: ${reason3}`);
|
|
55642
55742
|
try {
|
|
55643
|
-
ensureDir(
|
|
55644
|
-
renameSync4(path2,
|
|
55743
|
+
ensureDir(join44(paths.spool, "failed"));
|
|
55744
|
+
renameSync4(path2, join44(paths.spool, "failed", name));
|
|
55645
55745
|
} catch (error) {
|
|
55646
55746
|
log(
|
|
55647
55747
|
`spool file ${name} could not be moved to spool/failed/: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -55694,7 +55794,7 @@ async function initializeDaemon(options, server, port, ready) {
|
|
|
55694
55794
|
continue;
|
|
55695
55795
|
}
|
|
55696
55796
|
reads += 1;
|
|
55697
|
-
const path2 =
|
|
55797
|
+
const path2 = join44(paths.spool, name);
|
|
55698
55798
|
let file;
|
|
55699
55799
|
try {
|
|
55700
55800
|
file = await readSpoolFile(name);
|
|
@@ -55979,7 +56079,7 @@ async function initializeDaemon(options, server, port, ready) {
|
|
|
55979
56079
|
const state = await readModelBaseUrlState({
|
|
55980
56080
|
home: options.home ?? homedir7(),
|
|
55981
56081
|
port: modelProxyPortFor(host),
|
|
55982
|
-
stellaHome:
|
|
56082
|
+
stellaHome: dirname24(options.paths.stellaToml),
|
|
55983
56083
|
harnesses: ["claude-code", "codex", "stella"]
|
|
55984
56084
|
});
|
|
55985
56085
|
const next = {};
|
|
@@ -56521,9 +56621,9 @@ async function initializeDaemon(options, server, port, ready) {
|
|
|
56521
56621
|
let removed = 0;
|
|
56522
56622
|
for (const name of readdirSync13(paths.quarantine)) {
|
|
56523
56623
|
if (!name.endsWith(".json")) continue;
|
|
56524
|
-
const file =
|
|
56624
|
+
const file = join44(paths.quarantine, name);
|
|
56525
56625
|
try {
|
|
56526
|
-
const refusedAt = readRefusedEntry(file)?.refusedAt ??
|
|
56626
|
+
const refusedAt = readRefusedEntry(file)?.refusedAt ?? statSync13(file).mtimeMs;
|
|
56527
56627
|
if (at2 - refusedAt < retainMs) continue;
|
|
56528
56628
|
unlinkSync13(file);
|
|
56529
56629
|
removed += 1;
|
|
@@ -56851,7 +56951,7 @@ async function initializeDaemon(options, server, port, ready) {
|
|
|
56851
56951
|
let memoryScan;
|
|
56852
56952
|
if (options.listen ?? true) {
|
|
56853
56953
|
const codexMemories = createCodexMemoryStore({
|
|
56854
|
-
path:
|
|
56954
|
+
path: join44(dirname24(paths.codexHooks), CODEX_MEMORY_STORE_FILE),
|
|
56855
56955
|
stat: (path2) => stat2(path2),
|
|
56856
56956
|
log
|
|
56857
56957
|
});
|
|
@@ -57139,7 +57239,7 @@ var init_daemon = __esm({
|
|
|
57139
57239
|
});
|
|
57140
57240
|
|
|
57141
57241
|
// ../../packages/tacho/src/collector/run.ts
|
|
57142
|
-
import { readFileSync as
|
|
57242
|
+
import { readFileSync as readFileSync22, unlinkSync as unlinkSync14 } from "node:fs";
|
|
57143
57243
|
function stopWithin(stop, graceMs, exit, log) {
|
|
57144
57244
|
const timer = setTimeout(() => {
|
|
57145
57245
|
log(`tachod: stop did not finish within ${graceMs} ms, exiting
|
|
@@ -57207,14 +57307,14 @@ function ownProcStart() {
|
|
|
57207
57307
|
}
|
|
57208
57308
|
function readPidFile(path2) {
|
|
57209
57309
|
try {
|
|
57210
|
-
return
|
|
57310
|
+
return readFileSync22(path2, "utf8");
|
|
57211
57311
|
} catch {
|
|
57212
57312
|
return void 0;
|
|
57213
57313
|
}
|
|
57214
57314
|
}
|
|
57215
57315
|
function releaseDaemonPid(path2, previous) {
|
|
57216
57316
|
try {
|
|
57217
|
-
if (parseDaemonPid(
|
|
57317
|
+
if (parseDaemonPid(readFileSync22(path2, "utf8"))?.pid !== process.pid) return;
|
|
57218
57318
|
if (previous === void 0) unlinkSync14(path2);
|
|
57219
57319
|
else writeSensitiveFileAtomic(path2, previous, 420);
|
|
57220
57320
|
} catch {
|
|
@@ -57363,7 +57463,7 @@ import {
|
|
|
57363
57463
|
realpathSync as realpathSync5,
|
|
57364
57464
|
writeFileSync as writeFileSync4
|
|
57365
57465
|
} from "node:fs";
|
|
57366
|
-
import { dirname as
|
|
57466
|
+
import { dirname as dirname25, join as join45, resolve as resolve17 } from "node:path";
|
|
57367
57467
|
function bundlePath(root, relative11, create2 = false) {
|
|
57368
57468
|
const absolute = resolve17(root);
|
|
57369
57469
|
if (create2) mkdirSync6(absolute, { recursive: true, mode: 448 });
|
|
@@ -57374,7 +57474,7 @@ function bundlePath(root, relative11, create2 = false) {
|
|
|
57374
57474
|
let current = base2;
|
|
57375
57475
|
const parts = relative11.split("/");
|
|
57376
57476
|
for (let i2 = 0; i2 < parts.length; i2++) {
|
|
57377
|
-
current =
|
|
57477
|
+
current = join45(current, parts[i2]);
|
|
57378
57478
|
try {
|
|
57379
57479
|
const stat7 = lstatSync8(current);
|
|
57380
57480
|
if (stat7.isSymbolicLink() || i2 < parts.length - 1 && !stat7.isDirectory()) {
|
|
@@ -57388,7 +57488,7 @@ function bundlePath(root, relative11, create2 = false) {
|
|
|
57388
57488
|
else if (i2 < parts.length - 1) throw error;
|
|
57389
57489
|
}
|
|
57390
57490
|
}
|
|
57391
|
-
if (realpathSync5(
|
|
57491
|
+
if (realpathSync5(dirname25(current)) !== dirname25(current)) {
|
|
57392
57492
|
arpFail(`The bundle directory changed while ${relative11} was read.`);
|
|
57393
57493
|
}
|
|
57394
57494
|
return current;
|
|
@@ -58335,7 +58435,7 @@ import {
|
|
|
58335
58435
|
rmSync as rmSync8,
|
|
58336
58436
|
writeFileSync as writeFileSync5
|
|
58337
58437
|
} from "node:fs";
|
|
58338
|
-
import { dirname as
|
|
58438
|
+
import { dirname as dirname26, isAbsolute as isAbsolute11, join as join46, relative as relative5, resolve as resolve18, sep as sep7 } from "node:path";
|
|
58339
58439
|
function outsideProfile(path2) {
|
|
58340
58440
|
return HARNESS_CONFIG_PATH.test(path2) || CREDENTIAL_PATH.test(path2);
|
|
58341
58441
|
}
|
|
@@ -58391,9 +58491,9 @@ function within2(root, path2) {
|
|
|
58391
58491
|
}
|
|
58392
58492
|
function newPath(path2) {
|
|
58393
58493
|
const full = resolve18(path2);
|
|
58394
|
-
return
|
|
58395
|
-
realpathSync6(
|
|
58396
|
-
full.slice(
|
|
58494
|
+
return join46(
|
|
58495
|
+
realpathSync6(dirname26(full)),
|
|
58496
|
+
full.slice(dirname26(full).length + 1)
|
|
58397
58497
|
);
|
|
58398
58498
|
}
|
|
58399
58499
|
function sourcePath(root, path2) {
|
|
@@ -58405,7 +58505,7 @@ function sourcePath(root, path2) {
|
|
|
58405
58505
|
}
|
|
58406
58506
|
let current = root;
|
|
58407
58507
|
for (const part2 of path2.split("/")) {
|
|
58408
|
-
current =
|
|
58508
|
+
current = join46(current, part2);
|
|
58409
58509
|
if (lstatSync9(current).isSymbolicLink())
|
|
58410
58510
|
arpFail(
|
|
58411
58511
|
`${path2} is a symlink or passes through one. Symlinks require a resource adapter.`
|
|
@@ -58672,23 +58772,23 @@ function prepareCheckpoint(options) {
|
|
|
58672
58772
|
});
|
|
58673
58773
|
mkdirSync7(destination, { mode: 448 });
|
|
58674
58774
|
try {
|
|
58675
|
-
const restored =
|
|
58775
|
+
const restored = join46(destination, "workspace");
|
|
58676
58776
|
mkdirSync7(restored, { mode: 448 });
|
|
58677
58777
|
for (const item of restore) {
|
|
58678
|
-
const path2 =
|
|
58778
|
+
const path2 = join46(restored, item.path);
|
|
58679
58779
|
if (item.kind === "directory")
|
|
58680
58780
|
mkdirSync7(path2, { recursive: true, mode: 448 });
|
|
58681
58781
|
else {
|
|
58682
|
-
mkdirSync7(
|
|
58782
|
+
mkdirSync7(dirname26(path2), { recursive: true, mode: 448 });
|
|
58683
58783
|
writeFileSync5(path2, item.bytes, {
|
|
58684
58784
|
flag: "wx",
|
|
58685
58785
|
mode: item.executable ? 448 : 384
|
|
58686
58786
|
});
|
|
58687
58787
|
}
|
|
58688
58788
|
}
|
|
58689
|
-
const promptDir =
|
|
58789
|
+
const promptDir = join46(restored, ".arp");
|
|
58690
58790
|
mkdirSync7(promptDir, { mode: 448 });
|
|
58691
|
-
const promptFile =
|
|
58791
|
+
const promptFile = join46(promptDir, "handoff.json");
|
|
58692
58792
|
const prompt = {
|
|
58693
58793
|
checkpoint_digest: checkpointDigest,
|
|
58694
58794
|
task: task.data.request,
|
|
@@ -58705,7 +58805,7 @@ function prepareCheckpoint(options) {
|
|
|
58705
58805
|
flag: "wx",
|
|
58706
58806
|
mode: 384
|
|
58707
58807
|
});
|
|
58708
|
-
const reportPath =
|
|
58808
|
+
const reportPath = join46(destination, "report.json");
|
|
58709
58809
|
writeFileSync5(
|
|
58710
58810
|
reportPath,
|
|
58711
58811
|
jcs(
|
|
@@ -58890,7 +58990,7 @@ __export(main_exports, {
|
|
|
58890
58990
|
recordedCliDeps: () => recordedCliDeps,
|
|
58891
58991
|
tokenOption: () => tokenOption
|
|
58892
58992
|
});
|
|
58893
|
-
import { readFileSync as
|
|
58993
|
+
import { readFileSync as readFileSync23 } from "node:fs";
|
|
58894
58994
|
function parsePort(value) {
|
|
58895
58995
|
const port = Number(value);
|
|
58896
58996
|
if (!/^\d+$/.test(value) || port < 1024 || port > 65535)
|
|
@@ -58927,7 +59027,7 @@ function parseOneHarness(value) {
|
|
|
58927
59027
|
throw new InvalidArgumentError("name one harness");
|
|
58928
59028
|
return harness;
|
|
58929
59029
|
}
|
|
58930
|
-
function tokenOption(opts, err2, readStdin3 = () =>
|
|
59030
|
+
function tokenOption(opts, err2, readStdin3 = () => readFileSync23(0, "utf8")) {
|
|
58931
59031
|
const flag2 = opts.token;
|
|
58932
59032
|
if (opts.tokenStdin !== true) {
|
|
58933
59033
|
if (flag2 !== void 0)
|
|
@@ -59346,7 +59446,7 @@ var init_package = __esm({
|
|
|
59346
59446
|
"package.json"() {
|
|
59347
59447
|
package_default = {
|
|
59348
59448
|
name: "@oxagen/cli",
|
|
59349
|
-
version: "2.1.4-
|
|
59449
|
+
version: "2.1.4-957",
|
|
59350
59450
|
description: "Oxagen governance CLI \u2014 spend, lineage, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
|
|
59351
59451
|
type: "module",
|
|
59352
59452
|
main: "./dist/index.js",
|
|
@@ -59413,10 +59513,10 @@ var init_package = __esm({
|
|
|
59413
59513
|
|
|
59414
59514
|
// src/lib/atomic-write.ts
|
|
59415
59515
|
import { writeFileSync as writeFileSync6, renameSync as renameSync5, unlinkSync as unlinkSync15, existsSync as existsSync24 } from "node:fs";
|
|
59416
|
-
import { dirname as
|
|
59516
|
+
import { dirname as dirname27, join as join47 } from "node:path";
|
|
59417
59517
|
function atomicWriteFileSync(path2, data, mode) {
|
|
59418
|
-
const dir =
|
|
59419
|
-
const tmp =
|
|
59518
|
+
const dir = dirname27(path2);
|
|
59519
|
+
const tmp = join47(
|
|
59420
59520
|
dir,
|
|
59421
59521
|
`.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`
|
|
59422
59522
|
);
|
|
@@ -59441,8 +59541,8 @@ var init_atomic_write = __esm({
|
|
|
59441
59541
|
|
|
59442
59542
|
// src/lib/config.ts
|
|
59443
59543
|
import { homedir as homedir8 } from "os";
|
|
59444
|
-
import { join as
|
|
59445
|
-
import { readFileSync as
|
|
59544
|
+
import { join as join48 } from "path";
|
|
59545
|
+
import { readFileSync as readFileSync24, mkdirSync as mkdirSync8, existsSync as existsSync25, statSync as statSync14 } from "fs";
|
|
59446
59546
|
function getConfigDir() {
|
|
59447
59547
|
return CONFIG_DIR;
|
|
59448
59548
|
}
|
|
@@ -59472,7 +59572,7 @@ function parseConfig(raw) {
|
|
|
59472
59572
|
function readConfig() {
|
|
59473
59573
|
let identity;
|
|
59474
59574
|
try {
|
|
59475
|
-
const info =
|
|
59575
|
+
const info = statSync14(CONFIG_FILE);
|
|
59476
59576
|
identity = `${info.ino}:${info.size}:${info.mtimeMs}`;
|
|
59477
59577
|
} catch {
|
|
59478
59578
|
cached2 = void 0;
|
|
@@ -59480,7 +59580,7 @@ function readConfig() {
|
|
|
59480
59580
|
}
|
|
59481
59581
|
if (cached2?.identity === identity) return structuredClone(cached2.config);
|
|
59482
59582
|
try {
|
|
59483
|
-
const config = parseConfig(JSON.parse(
|
|
59583
|
+
const config = parseConfig(JSON.parse(readFileSync24(CONFIG_FILE, "utf8")));
|
|
59484
59584
|
cached2 = { identity, config };
|
|
59485
59585
|
return structuredClone(config);
|
|
59486
59586
|
} catch (err2) {
|
|
@@ -59528,8 +59628,8 @@ var CONFIG_DIR, CONFIG_FILE, STRING_FIELDS, TELEMETRY_FIELDS, cached2;
|
|
|
59528
59628
|
var init_config = __esm({
|
|
59529
59629
|
"src/lib/config.ts"() {
|
|
59530
59630
|
init_atomic_write();
|
|
59531
|
-
CONFIG_DIR =
|
|
59532
|
-
CONFIG_FILE =
|
|
59631
|
+
CONFIG_DIR = join48(homedir8(), ".config", "oxagen");
|
|
59632
|
+
CONFIG_FILE = join48(CONFIG_DIR, "config.json");
|
|
59533
59633
|
STRING_FIELDS = [
|
|
59534
59634
|
"token",
|
|
59535
59635
|
"orgSlug",
|
|
@@ -59574,16 +59674,16 @@ import {
|
|
|
59574
59674
|
writeFile as writeFile2
|
|
59575
59675
|
} from "node:fs/promises";
|
|
59576
59676
|
import { homedir as homedir9 } from "node:os";
|
|
59577
|
-
import { join as
|
|
59677
|
+
import { join as join49 } from "node:path";
|
|
59578
59678
|
function isDebugEnabled() {
|
|
59579
59679
|
const v = process.env[DEBUG_ENV];
|
|
59580
59680
|
return v === "1" || v === "true";
|
|
59581
59681
|
}
|
|
59582
59682
|
function logsDir() {
|
|
59583
|
-
return
|
|
59683
|
+
return join49(homedir9(), ".oxagen", "logs");
|
|
59584
59684
|
}
|
|
59585
59685
|
function debugLogFile() {
|
|
59586
|
-
return
|
|
59686
|
+
return join49(logsDir(), "cli.output");
|
|
59587
59687
|
}
|
|
59588
59688
|
function sanitize(value, depth = 0) {
|
|
59589
59689
|
if (value === null || value === void 0) return value;
|
|
@@ -62878,9 +62978,9 @@ var init_git = __esm({
|
|
|
62878
62978
|
|
|
62879
62979
|
// ../../packages/steering-freshness/src/cache.ts
|
|
62880
62980
|
import { mkdir as mkdir4, readFile as readFile6, writeFile as writeFile4 } from "node:fs/promises";
|
|
62881
|
-
import { dirname as
|
|
62981
|
+
import { dirname as dirname28, join as join50 } from "node:path";
|
|
62882
62982
|
function stampPath(gitCommonDir) {
|
|
62883
|
-
return
|
|
62983
|
+
return join50(gitCommonDir, "oxagen", "steering-freshness.json");
|
|
62884
62984
|
}
|
|
62885
62985
|
async function readFetchStamp(gitCommonDir, io = defaultIo) {
|
|
62886
62986
|
try {
|
|
@@ -62901,7 +63001,7 @@ async function readFetchStamp(gitCommonDir, io = defaultIo) {
|
|
|
62901
63001
|
async function writeFetchStamp(gitCommonDir, stamp, io = defaultIo) {
|
|
62902
63002
|
const path2 = stampPath(gitCommonDir);
|
|
62903
63003
|
try {
|
|
62904
|
-
await io.mkdirp(
|
|
63004
|
+
await io.mkdirp(dirname28(path2));
|
|
62905
63005
|
await io.write(path2, `${JSON.stringify(stamp)}
|
|
62906
63006
|
`, "utf8");
|
|
62907
63007
|
} catch {
|
|
@@ -62932,24 +63032,24 @@ var init_cache = __esm({
|
|
|
62932
63032
|
// ../../packages/steering-freshness/src/hooks.ts
|
|
62933
63033
|
import { mkdir as mkdir5, readFile as readFile7, writeFile as writeFile5 } from "node:fs/promises";
|
|
62934
63034
|
import { homedir as homedir10 } from "node:os";
|
|
62935
|
-
import { dirname as
|
|
63035
|
+
import { dirname as dirname29, join as join51 } from "node:path";
|
|
62936
63036
|
function hookCommand(harness) {
|
|
62937
63037
|
return `oxagen steering gate --harness ${harness}`;
|
|
62938
63038
|
}
|
|
62939
63039
|
function hookConfigPath(projectRoot, harness, env = process.env, home = homedir10()) {
|
|
62940
63040
|
switch (harness) {
|
|
62941
63041
|
case "claude-code":
|
|
62942
|
-
return
|
|
63042
|
+
return join51(projectRoot, ".claude", "settings.json");
|
|
62943
63043
|
case "codex":
|
|
62944
|
-
return
|
|
63044
|
+
return join51(env["CODEX_HOME"] ?? join51(home, ".codex"), "hooks.json");
|
|
62945
63045
|
case "cursor":
|
|
62946
|
-
return
|
|
63046
|
+
return join51(home, ".cursor", "hooks.json");
|
|
62947
63047
|
case "stella":
|
|
62948
|
-
return
|
|
63048
|
+
return join51(env["STELLA_HOME"] ?? join51(home, ".stella"), "stella.toml");
|
|
62949
63049
|
}
|
|
62950
63050
|
}
|
|
62951
63051
|
function stellaJsonPath(env, home) {
|
|
62952
|
-
return
|
|
63052
|
+
return join51(env["STELLA_HOME"] ?? join51(home, ".stella"), "settings.json");
|
|
62953
63053
|
}
|
|
62954
63054
|
function isRecord7(v) {
|
|
62955
63055
|
return v !== null && typeof v === "object" && !Array.isArray(v);
|
|
@@ -63036,7 +63136,7 @@ async function installJsonGroupHook(path2, harness, entry2, io) {
|
|
|
63036
63136
|
};
|
|
63037
63137
|
}
|
|
63038
63138
|
const had = hasGroupHook(loaded.config);
|
|
63039
|
-
await io.mkdirp(
|
|
63139
|
+
await io.mkdirp(dirname29(path2));
|
|
63040
63140
|
await io.write(
|
|
63041
63141
|
path2,
|
|
63042
63142
|
`${JSON.stringify(withGroupHook(loaded.config, entry2), null, 2)}
|
|
@@ -63138,7 +63238,7 @@ async function installCursorHook(path2, io) {
|
|
|
63138
63238
|
];
|
|
63139
63239
|
const next = { ...config, hooks };
|
|
63140
63240
|
if (next.version === void 0) next.version = 1;
|
|
63141
|
-
await io.mkdirp(
|
|
63241
|
+
await io.mkdirp(dirname29(path2));
|
|
63142
63242
|
await io.write(path2, `${JSON.stringify(next, null, 2)}
|
|
63143
63243
|
`, "utf8");
|
|
63144
63244
|
return {
|
|
@@ -63321,7 +63421,7 @@ async function installStellaHook(projectRoot, io, env, home) {
|
|
|
63321
63421
|
}
|
|
63322
63422
|
const separator = base2.length === 0 ? "" : eol;
|
|
63323
63423
|
const next = `${base2}${separator}${renderStellaBlock(eol)}`;
|
|
63324
|
-
await io.mkdirp(
|
|
63424
|
+
await io.mkdirp(dirname29(path2));
|
|
63325
63425
|
await io.write(path2, next, "utf8");
|
|
63326
63426
|
return {
|
|
63327
63427
|
harness: "stella",
|
|
@@ -63609,7 +63709,7 @@ var init_policy = __esm({
|
|
|
63609
63709
|
// ../../packages/steering-freshness/src/settings.ts
|
|
63610
63710
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
63611
63711
|
import { homedir as homedir11 } from "node:os";
|
|
63612
|
-
import { join as
|
|
63712
|
+
import { join as join52 } from "node:path";
|
|
63613
63713
|
async function readLayer(scope, path2, read2) {
|
|
63614
63714
|
let text5;
|
|
63615
63715
|
try {
|
|
@@ -63661,14 +63761,14 @@ function parseLayer(scope, path2, text5) {
|
|
|
63661
63761
|
}
|
|
63662
63762
|
async function loadSteeringSettings({
|
|
63663
63763
|
projectRoot,
|
|
63664
|
-
userSettingsPath =
|
|
63764
|
+
userSettingsPath = join52(homedir11(), USER_SETTINGS_RELATIVE),
|
|
63665
63765
|
read: read2 = readFile8,
|
|
63666
63766
|
workspacePolicy = null
|
|
63667
63767
|
}) {
|
|
63668
63768
|
const targets = [
|
|
63669
63769
|
["user", userSettingsPath],
|
|
63670
|
-
["project",
|
|
63671
|
-
["local",
|
|
63770
|
+
["project", join52(projectRoot, PROJECT_DIR_NAME, PROJECT_SETTINGS_FILE)],
|
|
63771
|
+
["local", join52(projectRoot, PROJECT_DIR_NAME, LOCAL_SETTINGS_FILE)]
|
|
63672
63772
|
];
|
|
63673
63773
|
const layers = [];
|
|
63674
63774
|
const warnings = [];
|
|
@@ -63731,7 +63831,7 @@ var init_settings = __esm({
|
|
|
63731
63831
|
"use strict";
|
|
63732
63832
|
init_git();
|
|
63733
63833
|
init_policy();
|
|
63734
|
-
USER_SETTINGS_RELATIVE =
|
|
63834
|
+
USER_SETTINGS_RELATIVE = join52(
|
|
63735
63835
|
".config",
|
|
63736
63836
|
"oxagen",
|
|
63737
63837
|
"settings.json"
|
|
@@ -63744,7 +63844,7 @@ var init_settings = __esm({
|
|
|
63744
63844
|
|
|
63745
63845
|
// ../../packages/steering-freshness/src/check.ts
|
|
63746
63846
|
import { lstat as lstat3 } from "node:fs/promises";
|
|
63747
|
-
import { isAbsolute as isAbsolute12, join as
|
|
63847
|
+
import { isAbsolute as isAbsolute12, join as join53, resolve as resolve19 } from "node:path";
|
|
63748
63848
|
function publishedCommits(platform) {
|
|
63749
63849
|
if (platform.headCommits && platform.headCommits.length > 0)
|
|
63750
63850
|
return platform.headCommits;
|
|
@@ -64081,7 +64181,7 @@ async function absentFromDisk(root, paths) {
|
|
|
64081
64181
|
const flags = await Promise.all(
|
|
64082
64182
|
paths.map(async (path2) => {
|
|
64083
64183
|
try {
|
|
64084
|
-
await lstat3(
|
|
64184
|
+
await lstat3(join53(root, path2));
|
|
64085
64185
|
return false;
|
|
64086
64186
|
} catch {
|
|
64087
64187
|
return true;
|
|
@@ -64140,7 +64240,7 @@ var init_check = __esm({
|
|
|
64140
64240
|
// ../../packages/steering-freshness/src/sync.ts
|
|
64141
64241
|
import { mkdtemp, rm as rm3, writeFile as writeFile6 } from "node:fs/promises";
|
|
64142
64242
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
64143
|
-
import { join as
|
|
64243
|
+
import { join as join54 } from "node:path";
|
|
64144
64244
|
function refuse3(refusal, message) {
|
|
64145
64245
|
return {
|
|
64146
64246
|
applied: false,
|
|
@@ -64321,9 +64421,9 @@ async function syncSteering(opts) {
|
|
|
64321
64421
|
};
|
|
64322
64422
|
}
|
|
64323
64423
|
async function commitPaths(ctx, message, paths) {
|
|
64324
|
-
const dir = await mkdtemp(
|
|
64424
|
+
const dir = await mkdtemp(join54(tmpdir2(), "oxagen-steering-sync-"));
|
|
64325
64425
|
try {
|
|
64326
|
-
const list2 =
|
|
64426
|
+
const list2 = join54(dir, "pathspec");
|
|
64327
64427
|
await writeFile6(list2, `${paths.join("\0")}\0`, "utf8");
|
|
64328
64428
|
await git3(
|
|
64329
64429
|
ctx,
|
|
@@ -64850,10 +64950,10 @@ var init_paths2 = __esm({
|
|
|
64850
64950
|
});
|
|
64851
64951
|
|
|
64852
64952
|
// src/commands/workspace-link.ts
|
|
64853
|
-
import { existsSync as existsSync26, mkdirSync as mkdirSync9, readFileSync as
|
|
64854
|
-
import { dirname as
|
|
64953
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync9, readFileSync as readFileSync25 } from "node:fs";
|
|
64954
|
+
import { dirname as dirname30, join as join55 } from "node:path";
|
|
64855
64955
|
function workspaceLinkPath(cwd) {
|
|
64856
|
-
return
|
|
64956
|
+
return join55(cwd, WORKSPACE_LINK_PATH);
|
|
64857
64957
|
}
|
|
64858
64958
|
function isRecord8(value) {
|
|
64859
64959
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -64886,7 +64986,7 @@ function readWorkspaceLink(cwd) {
|
|
|
64886
64986
|
if (!existsSync26(filePath)) return null;
|
|
64887
64987
|
let parsed2;
|
|
64888
64988
|
try {
|
|
64889
|
-
parsed2 = JSON.parse(
|
|
64989
|
+
parsed2 = JSON.parse(readFileSync25(filePath, "utf8"));
|
|
64890
64990
|
} catch (err2) {
|
|
64891
64991
|
const detail = err2 instanceof Error ? err2.message : String(err2);
|
|
64892
64992
|
process.stderr.write(
|
|
@@ -64907,7 +65007,7 @@ function readWorkspaceLink(cwd) {
|
|
|
64907
65007
|
}
|
|
64908
65008
|
function writeWorkspaceLink(cwd, link) {
|
|
64909
65009
|
const filePath = workspaceLinkPath(cwd);
|
|
64910
|
-
mkdirSync9(
|
|
65010
|
+
mkdirSync9(dirname30(filePath), { recursive: true });
|
|
64911
65011
|
atomicWriteFileSync(filePath, JSON.stringify(link, null, 2));
|
|
64912
65012
|
}
|
|
64913
65013
|
var LINK_STRING_FIELDS;
|
|
@@ -64943,7 +65043,7 @@ __export(steering_exports, {
|
|
|
64943
65043
|
});
|
|
64944
65044
|
import { execFileSync } from "node:child_process";
|
|
64945
65045
|
import { existsSync as existsSync27, realpathSync as realpathSync7 } from "node:fs";
|
|
64946
|
-
import { dirname as
|
|
65046
|
+
import { dirname as dirname31, join as join56, normalize, parse as parsePath } from "node:path";
|
|
64947
65047
|
function findProjectRoot(start) {
|
|
64948
65048
|
const { root } = parsePath(start);
|
|
64949
65049
|
const rawGitRoot = gitRootOr(start);
|
|
@@ -64952,9 +65052,9 @@ function findProjectRoot(start) {
|
|
|
64952
65052
|
if (gitRoot !== null) return gitRoot;
|
|
64953
65053
|
let dir = from;
|
|
64954
65054
|
for (; ; ) {
|
|
64955
|
-
if (existsSync27(
|
|
65055
|
+
if (existsSync27(join56(dir, PROJECT_DIR_NAME))) return dir;
|
|
64956
65056
|
if (dir === root) return from;
|
|
64957
|
-
const parent =
|
|
65057
|
+
const parent = dirname31(dir);
|
|
64958
65058
|
if (parent === dir) return from;
|
|
64959
65059
|
dir = parent;
|
|
64960
65060
|
}
|
|
@@ -82044,7 +82144,7 @@ var init_memory_client = __esm({
|
|
|
82044
82144
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
82045
82145
|
import {
|
|
82046
82146
|
basename as basename7,
|
|
82047
|
-
dirname as
|
|
82147
|
+
dirname as dirname32,
|
|
82048
82148
|
isAbsolute as isAbsolute13,
|
|
82049
82149
|
relative as relative6,
|
|
82050
82150
|
resolve as resolve20,
|
|
@@ -82056,7 +82156,7 @@ function inside(rel) {
|
|
|
82056
82156
|
function importFilename(path2, folder) {
|
|
82057
82157
|
let rel = relative6(process.cwd(), path2);
|
|
82058
82158
|
if (!inside(rel) && folder !== void 0) {
|
|
82059
|
-
rel = relative6(
|
|
82159
|
+
rel = relative6(dirname32(resolve20(folder)), resolve20(path2));
|
|
82060
82160
|
}
|
|
82061
82161
|
const name = inside(rel) ? rel.split(sep8).join("/") : basename7(path2);
|
|
82062
82162
|
return name.length > 256 ? basename7(path2).slice(-256) : name;
|
|
@@ -82343,7 +82443,7 @@ __export(steering_import_exports, {
|
|
|
82343
82443
|
});
|
|
82344
82444
|
import { readdir as readdir4, realpath as realpath2, stat as stat4 } from "node:fs/promises";
|
|
82345
82445
|
import { homedir as homedir12 } from "node:os";
|
|
82346
|
-
import { basename as basename8, extname, join as
|
|
82446
|
+
import { basename as basename8, extname, join as join57, relative as relative7, sep as sep9 } from "node:path";
|
|
82347
82447
|
function envDir2(env, key) {
|
|
82348
82448
|
const value = env[key];
|
|
82349
82449
|
return value === void 0 || value.trim() === "" ? null : value;
|
|
@@ -82351,34 +82451,34 @@ function envDir2(env, key) {
|
|
|
82351
82451
|
function harnessHome(harness, env = process.env, home = homedir12()) {
|
|
82352
82452
|
switch (harness) {
|
|
82353
82453
|
case "claude-code": {
|
|
82354
|
-
const config = envDir2(env, "CLAUDE_CONFIG_DIR") ??
|
|
82454
|
+
const config = envDir2(env, "CLAUDE_CONFIG_DIR") ?? join57(home, ".claude");
|
|
82355
82455
|
return {
|
|
82356
82456
|
harness,
|
|
82357
82457
|
folders: [
|
|
82358
82458
|
{
|
|
82359
|
-
dir: skillsRoot("claude-code", env, home) ??
|
|
82459
|
+
dir: skillsRoot("claude-code", env, home) ?? join57(config, "skills"),
|
|
82360
82460
|
mount: ".claude/skills"
|
|
82361
82461
|
},
|
|
82362
|
-
{ dir:
|
|
82363
|
-
{ dir:
|
|
82462
|
+
{ dir: join57(config, "commands"), mount: ".claude/commands" },
|
|
82463
|
+
{ dir: join57(config, "agents"), mount: ".claude/agents" }
|
|
82364
82464
|
],
|
|
82365
82465
|
instructions: [
|
|
82366
|
-
{ file:
|
|
82466
|
+
{ file: join57(config, "CLAUDE.md"), filename: ".claude/CLAUDE.md" }
|
|
82367
82467
|
]
|
|
82368
82468
|
};
|
|
82369
82469
|
}
|
|
82370
82470
|
case "codex": {
|
|
82371
|
-
const codexHome = envDir2(env, "CODEX_HOME") ??
|
|
82471
|
+
const codexHome = envDir2(env, "CODEX_HOME") ?? join57(home, ".codex");
|
|
82372
82472
|
return {
|
|
82373
82473
|
harness,
|
|
82374
82474
|
folders: [
|
|
82375
82475
|
{
|
|
82376
|
-
dir: skillsRoot("codex", env, home) ??
|
|
82476
|
+
dir: skillsRoot("codex", env, home) ?? join57(home, ".agents", "skills"),
|
|
82377
82477
|
mount: ".agents/skills"
|
|
82378
82478
|
}
|
|
82379
82479
|
],
|
|
82380
82480
|
instructions: ["AGENTS.override.md", "AGENTS.md"].map((name) => ({
|
|
82381
|
-
file:
|
|
82481
|
+
file: join57(codexHome, name),
|
|
82382
82482
|
filename: `.codex/${name}`
|
|
82383
82483
|
}))
|
|
82384
82484
|
};
|
|
@@ -82387,8 +82487,8 @@ function harnessHome(harness, env = process.env, home = homedir12()) {
|
|
|
82387
82487
|
return {
|
|
82388
82488
|
harness,
|
|
82389
82489
|
folders: [
|
|
82390
|
-
{ dir:
|
|
82391
|
-
{ dir:
|
|
82490
|
+
{ dir: join57(home, ".cursor", "skills"), mount: ".cursor/skills" },
|
|
82491
|
+
{ dir: join57(home, ".cursor", "commands"), mount: ".cursor/commands" }
|
|
82392
82492
|
],
|
|
82393
82493
|
instructions: []
|
|
82394
82494
|
};
|
|
@@ -82434,7 +82534,7 @@ async function findMarkdownFiles(paths, harness) {
|
|
|
82434
82534
|
}
|
|
82435
82535
|
const found = [];
|
|
82436
82536
|
for (const entry2 of entries2.sort(byName)) {
|
|
82437
|
-
const path2 =
|
|
82537
|
+
const path2 = join57(dir, entry2.name);
|
|
82438
82538
|
if (entry2.isDirectory()) {
|
|
82439
82539
|
if (!entry2.name.startsWith(".") && entry2.name !== "node_modules")
|
|
82440
82540
|
found.push(...await filesUnder(path2, from));
|
|
@@ -82456,7 +82556,7 @@ async function findMarkdownFiles(paths, harness) {
|
|
|
82456
82556
|
const { folder } = frame;
|
|
82457
82557
|
const named = (rel) => frame.fixedNames ? { filename: rel } : {};
|
|
82458
82558
|
for (const entry2 of entries2) {
|
|
82459
|
-
const path2 =
|
|
82559
|
+
const path2 = join57(dir, entry2.name);
|
|
82460
82560
|
const rel = frame.relOf(path2);
|
|
82461
82561
|
if (entry2.isDirectory()) {
|
|
82462
82562
|
if (entry2.name === "node_modules") continue;
|
|
@@ -82515,7 +82615,7 @@ async function findMarkdownFiles(paths, harness) {
|
|
|
82515
82615
|
}
|
|
82516
82616
|
if (folderGiven) {
|
|
82517
82617
|
const catalogue = CATALOGUE_FOLDERS.has(basename8(path2));
|
|
82518
|
-
const root = catalogue ?
|
|
82618
|
+
const root = catalogue ? join57(path2, "..") : path2;
|
|
82519
82619
|
await walk2(path2, {
|
|
82520
82620
|
relOf: (p) => under(root, p),
|
|
82521
82621
|
folder: path2,
|
|
@@ -84174,12 +84274,12 @@ __export(verify_exports, {
|
|
|
84174
84274
|
readBundle: () => readBundle,
|
|
84175
84275
|
verifyBundle: () => verifyBundle3
|
|
84176
84276
|
});
|
|
84177
|
-
import { existsSync as existsSync28, readFileSync as
|
|
84178
|
-
import { join as
|
|
84277
|
+
import { existsSync as existsSync28, readFileSync as readFileSync26, statSync as statSync15 } from "node:fs";
|
|
84278
|
+
import { join as join58 } from "node:path";
|
|
84179
84279
|
function readDirectory(dir) {
|
|
84180
84280
|
const read2 = (name) => {
|
|
84181
|
-
const path2 =
|
|
84182
|
-
return existsSync28(path2) ?
|
|
84281
|
+
const path2 = join58(dir, name);
|
|
84282
|
+
return existsSync28(path2) ? readFileSync26(path2, "utf8") : void 0;
|
|
84183
84283
|
};
|
|
84184
84284
|
return assemble(read2, dir);
|
|
84185
84285
|
}
|
|
@@ -84189,7 +84289,7 @@ function isBundleEntry(name) {
|
|
|
84189
84289
|
function readZip(path2) {
|
|
84190
84290
|
let entries2;
|
|
84191
84291
|
try {
|
|
84192
|
-
entries2 = unzipSync(new Uint8Array(
|
|
84292
|
+
entries2 = unzipSync(new Uint8Array(readFileSync26(path2)), {
|
|
84193
84293
|
filter: (file) => isBundleEntry(file.name)
|
|
84194
84294
|
});
|
|
84195
84295
|
} catch (err2) {
|
|
@@ -84225,7 +84325,7 @@ function readBundle(path2) {
|
|
|
84225
84325
|
if (!existsSync28(path2)) {
|
|
84226
84326
|
throw new BundleReadError(`${path2} does not exist.`);
|
|
84227
84327
|
}
|
|
84228
|
-
return
|
|
84328
|
+
return statSync15(path2).isDirectory() ? readDirectory(path2) : readZip(path2);
|
|
84229
84329
|
}
|
|
84230
84330
|
function plural3(count12, one, many) {
|
|
84231
84331
|
return `${count12} ${count12 === 1 ? one : many}`;
|
|
@@ -85301,13 +85401,13 @@ import {
|
|
|
85301
85401
|
existsSync as existsSync29,
|
|
85302
85402
|
lstatSync as lstatSync10,
|
|
85303
85403
|
mkdirSync as mkdirSync10,
|
|
85304
|
-
readFileSync as
|
|
85404
|
+
readFileSync as readFileSync27,
|
|
85305
85405
|
readdirSync as readdirSync14,
|
|
85306
85406
|
realpathSync as realpathSync8,
|
|
85307
85407
|
writeFileSync as writeFileSync7
|
|
85308
85408
|
} from "node:fs";
|
|
85309
85409
|
import { homedir as homedir13, hostname as osHostname3 } from "node:os";
|
|
85310
|
-
import { join as
|
|
85410
|
+
import { join as join59, relative as relative8, resolve as resolve22, sep as sep10 } from "node:path";
|
|
85311
85411
|
function git4(cwd, args) {
|
|
85312
85412
|
return new Promise((done) => {
|
|
85313
85413
|
try {
|
|
@@ -85354,7 +85454,7 @@ function parseRemoteRepository(url) {
|
|
|
85354
85454
|
}
|
|
85355
85455
|
function oxagenPresent(root) {
|
|
85356
85456
|
try {
|
|
85357
|
-
return readdirSync14(
|
|
85457
|
+
return readdirSync14(join59(root, ".oxagen")).some(
|
|
85358
85458
|
(name) => name !== "workspace.json"
|
|
85359
85459
|
);
|
|
85360
85460
|
} catch {
|
|
@@ -85363,18 +85463,18 @@ function oxagenPresent(root) {
|
|
|
85363
85463
|
}
|
|
85364
85464
|
function symlinkState(root) {
|
|
85365
85465
|
try {
|
|
85366
|
-
if (!lstatSync10(
|
|
85466
|
+
if (!lstatSync10(join59(root, ".stella")).isDirectory()) return "none";
|
|
85367
85467
|
} catch {
|
|
85368
85468
|
return "none";
|
|
85369
85469
|
}
|
|
85370
85470
|
let oxagenReal;
|
|
85371
85471
|
try {
|
|
85372
|
-
oxagenReal = realpathSync8(
|
|
85472
|
+
oxagenReal = realpathSync8(join59(root, ".oxagen"));
|
|
85373
85473
|
} catch {
|
|
85374
85474
|
return "missing";
|
|
85375
85475
|
}
|
|
85376
85476
|
for (const link of STELLA_LINKS) {
|
|
85377
|
-
const at2 =
|
|
85477
|
+
const at2 = join59(root, link);
|
|
85378
85478
|
try {
|
|
85379
85479
|
if (!lstatSync10(at2).isSymbolicLink()) return "missing";
|
|
85380
85480
|
const target2 = realpathSync8(at2);
|
|
@@ -85388,11 +85488,11 @@ function symlinkState(root) {
|
|
|
85388
85488
|
return "linked";
|
|
85389
85489
|
}
|
|
85390
85490
|
function machineId(configDir = getConfigDir()) {
|
|
85391
|
-
const file =
|
|
85491
|
+
const file = join59(configDir, MACHINE_ID_FILE);
|
|
85392
85492
|
let secret = null;
|
|
85393
85493
|
try {
|
|
85394
85494
|
if (existsSync29(file)) {
|
|
85395
|
-
const stored =
|
|
85495
|
+
const stored = readFileSync27(file, "utf8").trim();
|
|
85396
85496
|
if (/^[0-9a-f]{64}$/.test(stored)) secret = stored;
|
|
85397
85497
|
}
|
|
85398
85498
|
if (secret === null) {
|
|
@@ -85470,15 +85570,15 @@ async function ensureWorkspaceLinkIgnored(root) {
|
|
|
85470
85570
|
const topDir = resolve22(top);
|
|
85471
85571
|
const entry2 = relative8(
|
|
85472
85572
|
topDir,
|
|
85473
|
-
|
|
85573
|
+
join59(realpathOr2(root), ".oxagen", "workspace.json")
|
|
85474
85574
|
).split(sep10).join("/");
|
|
85475
85575
|
if (entry2.startsWith("../")) return null;
|
|
85476
85576
|
const rule = await git4(topDir, ["check-ignore", "--no-index", "-v", entry2]);
|
|
85477
85577
|
if (rule !== null) return null;
|
|
85478
|
-
const gitignore =
|
|
85578
|
+
const gitignore = join59(resolve22(top), ".gitignore");
|
|
85479
85579
|
let existing = "";
|
|
85480
85580
|
try {
|
|
85481
|
-
existing =
|
|
85581
|
+
existing = readFileSync27(gitignore, "utf8");
|
|
85482
85582
|
} catch {
|
|
85483
85583
|
}
|
|
85484
85584
|
const prefix = existing.length > 0 && !existing.endsWith("\n") ? "\n" : "";
|
|
@@ -85991,16 +86091,16 @@ import { createHash as createHash18 } from "node:crypto";
|
|
|
85991
86091
|
import {
|
|
85992
86092
|
lstatSync as lstatSync11,
|
|
85993
86093
|
mkdirSync as mkdirSync11,
|
|
85994
|
-
readFileSync as
|
|
86094
|
+
readFileSync as readFileSync28,
|
|
85995
86095
|
readdirSync as readdirSync15,
|
|
85996
86096
|
realpathSync as realpathSync9,
|
|
85997
86097
|
rmSync as rmSync10,
|
|
85998
86098
|
rmdirSync as rmdirSync7
|
|
85999
86099
|
} from "node:fs";
|
|
86000
86100
|
import {
|
|
86001
|
-
dirname as
|
|
86101
|
+
dirname as dirname33,
|
|
86002
86102
|
isAbsolute as isAbsolute14,
|
|
86003
|
-
join as
|
|
86103
|
+
join as join60,
|
|
86004
86104
|
parse as parsePath2,
|
|
86005
86105
|
posix as posix4,
|
|
86006
86106
|
sep as sep11
|
|
@@ -86113,32 +86213,32 @@ function findLinkedRoot(start) {
|
|
|
86113
86213
|
} catch {
|
|
86114
86214
|
}
|
|
86115
86215
|
if (dir === root) return null;
|
|
86116
|
-
const parent =
|
|
86216
|
+
const parent = dirname33(dir);
|
|
86117
86217
|
if (parent === dir) return null;
|
|
86118
86218
|
dir = parent;
|
|
86119
86219
|
}
|
|
86120
86220
|
}
|
|
86121
86221
|
function fsReader(root) {
|
|
86122
86222
|
return (path2) => {
|
|
86123
|
-
const abs =
|
|
86223
|
+
const abs = join60(root, ...path2.split("/"));
|
|
86124
86224
|
try {
|
|
86125
86225
|
const st = lstatSync11(abs);
|
|
86126
86226
|
if (!st.isFile()) return Buffer.from(`\0not-a-file:${abs}`);
|
|
86127
|
-
return
|
|
86227
|
+
return readFileSync28(abs);
|
|
86128
86228
|
} catch {
|
|
86129
86229
|
return null;
|
|
86130
86230
|
}
|
|
86131
86231
|
};
|
|
86132
86232
|
}
|
|
86133
86233
|
function assertInsideOxagen(root, path2) {
|
|
86134
|
-
const oxagenAbs =
|
|
86234
|
+
const oxagenAbs = join60(root, OXAGEN_DIR);
|
|
86135
86235
|
let oxagenReal;
|
|
86136
86236
|
try {
|
|
86137
86237
|
oxagenReal = realpathSync9(oxagenAbs);
|
|
86138
86238
|
} catch {
|
|
86139
86239
|
return;
|
|
86140
86240
|
}
|
|
86141
|
-
const abs =
|
|
86241
|
+
const abs = join60(root, ...path2.split("/"));
|
|
86142
86242
|
try {
|
|
86143
86243
|
if (lstatSync11(abs).isSymbolicLink()) {
|
|
86144
86244
|
throw new Error(
|
|
@@ -86148,7 +86248,7 @@ function assertInsideOxagen(root, path2) {
|
|
|
86148
86248
|
} catch (err2) {
|
|
86149
86249
|
if (err2.code !== "ENOENT") throw err2;
|
|
86150
86250
|
}
|
|
86151
|
-
let dir =
|
|
86251
|
+
let dir = dirname33(abs);
|
|
86152
86252
|
for (; ; ) {
|
|
86153
86253
|
let real = null;
|
|
86154
86254
|
try {
|
|
@@ -86162,14 +86262,14 @@ function assertInsideOxagen(root, path2) {
|
|
|
86162
86262
|
}
|
|
86163
86263
|
return;
|
|
86164
86264
|
}
|
|
86165
|
-
const parent =
|
|
86265
|
+
const parent = dirname33(dir);
|
|
86166
86266
|
if (parent === dir) return;
|
|
86167
86267
|
dir = parent;
|
|
86168
86268
|
}
|
|
86169
86269
|
}
|
|
86170
86270
|
function pruneEmptyDirs(root, path2) {
|
|
86171
|
-
const stop =
|
|
86172
|
-
let dir =
|
|
86271
|
+
const stop = join60(root, OXAGEN_DIR);
|
|
86272
|
+
let dir = dirname33(join60(root, ...path2.split("/")));
|
|
86173
86273
|
while (dir.startsWith(stop + sep11)) {
|
|
86174
86274
|
try {
|
|
86175
86275
|
if (readdirSync15(dir).length > 0) return;
|
|
@@ -86177,19 +86277,19 @@ function pruneEmptyDirs(root, path2) {
|
|
|
86177
86277
|
} catch {
|
|
86178
86278
|
return;
|
|
86179
86279
|
}
|
|
86180
|
-
dir =
|
|
86280
|
+
dir = dirname33(dir);
|
|
86181
86281
|
}
|
|
86182
86282
|
}
|
|
86183
86283
|
function applyPlan(root, plan) {
|
|
86184
86284
|
for (const w of plan.writes) assertInsideOxagen(root, w.path);
|
|
86185
86285
|
for (const d of plan.deletes) assertInsideOxagen(root, d);
|
|
86186
86286
|
for (const w of plan.writes) {
|
|
86187
|
-
const abs =
|
|
86188
|
-
mkdirSync11(
|
|
86287
|
+
const abs = join60(root, ...w.path.split("/"));
|
|
86288
|
+
mkdirSync11(dirname33(abs), { recursive: true });
|
|
86189
86289
|
atomicWriteFileSync(abs, w.content);
|
|
86190
86290
|
}
|
|
86191
86291
|
for (const d of plan.deletes) {
|
|
86192
|
-
rmSync10(
|
|
86292
|
+
rmSync10(join60(root, ...d.split("/")), { force: true });
|
|
86193
86293
|
pruneEmptyDirs(root, d);
|
|
86194
86294
|
}
|
|
86195
86295
|
}
|
|
@@ -108277,12 +108377,12 @@ function queryEntries(parameter, value) {
|
|
|
108277
108377
|
}
|
|
108278
108378
|
if (shape.items.length === 0) return [];
|
|
108279
108379
|
if (explode) return shape.items.map((item) => pair(name, item));
|
|
108280
|
-
const [raw,
|
|
108380
|
+
const [raw, delimiter2] = style === "form" ? [",", ","] : style === "spaceDelimited" ? [" ", "%20"] : ["|", "|"];
|
|
108281
108381
|
return [
|
|
108282
108382
|
entry(
|
|
108283
108383
|
name,
|
|
108284
108384
|
shape.items.join(raw),
|
|
108285
|
-
`${enc(name)}=${shape.items.map(val).join(
|
|
108385
|
+
`${enc(name)}=${shape.items.map(val).join(delimiter2)}`
|
|
108286
108386
|
)
|
|
108287
108387
|
];
|
|
108288
108388
|
}
|
|
@@ -130060,11 +130160,11 @@ import { createHash as createHash20 } from "node:crypto";
|
|
|
130060
130160
|
import {
|
|
130061
130161
|
lstatSync as lstatSync12,
|
|
130062
130162
|
mkdirSync as mkdirSync12,
|
|
130063
|
-
readFileSync as
|
|
130163
|
+
readFileSync as readFileSync29,
|
|
130064
130164
|
readlinkSync as readlinkSync4,
|
|
130065
|
-
statSync as
|
|
130165
|
+
statSync as statSync16
|
|
130066
130166
|
} from "node:fs";
|
|
130067
|
-
import { dirname as
|
|
130167
|
+
import { dirname as dirname34, isAbsolute as isAbsolute15, join as join61, relative as relative9, resolve as resolve24, sep as sep12 } from "node:path";
|
|
130068
130168
|
function git5(cwd, args, input) {
|
|
130069
130169
|
try {
|
|
130070
130170
|
return execFileSync2("git", args, {
|
|
@@ -130096,11 +130196,11 @@ function commitOf2(root, ref2) {
|
|
|
130096
130196
|
return sha2.length > 0 ? sha2 : null;
|
|
130097
130197
|
}
|
|
130098
130198
|
function readWorkingFile(root, path2) {
|
|
130099
|
-
const abs =
|
|
130199
|
+
const abs = join61(root, ...path2.split("/"));
|
|
130100
130200
|
try {
|
|
130101
130201
|
const stat7 = lstatSync12(abs);
|
|
130102
130202
|
if (stat7.isSymbolicLink()) return readlinkSync4(abs, "utf8");
|
|
130103
|
-
return stat7.isFile() ?
|
|
130203
|
+
return stat7.isFile() ? readFileSync29(abs, "utf8") : null;
|
|
130104
130204
|
} catch {
|
|
130105
130205
|
return null;
|
|
130106
130206
|
}
|
|
@@ -130175,14 +130275,14 @@ function chooseBase(root, ref2) {
|
|
|
130175
130275
|
}
|
|
130176
130276
|
function isFile(path2) {
|
|
130177
130277
|
try {
|
|
130178
|
-
return
|
|
130278
|
+
return statSync16(path2).isFile();
|
|
130179
130279
|
} catch {
|
|
130180
130280
|
return false;
|
|
130181
130281
|
}
|
|
130182
130282
|
}
|
|
130183
130283
|
function isDir(path2) {
|
|
130184
130284
|
try {
|
|
130185
|
-
return
|
|
130285
|
+
return statSync16(path2).isDirectory();
|
|
130186
130286
|
} catch {
|
|
130187
130287
|
return false;
|
|
130188
130288
|
}
|
|
@@ -130190,10 +130290,10 @@ function isDir(path2) {
|
|
|
130190
130290
|
function findSteeringRoot(start) {
|
|
130191
130291
|
let dir = resolve24(start);
|
|
130192
130292
|
for (; ; ) {
|
|
130193
|
-
if (isFile(
|
|
130293
|
+
if (isFile(join61(dir, WORKSPACE_TOML_PATH)) || isFile(join61(dir, AGENTS_MD_PATH)) && isDir(join61(dir, STEERING_DIR))) {
|
|
130194
130294
|
return dir;
|
|
130195
130295
|
}
|
|
130196
|
-
const parent =
|
|
130296
|
+
const parent = dirname34(dir);
|
|
130197
130297
|
if (parent === dir) return null;
|
|
130198
130298
|
dir = parent;
|
|
130199
130299
|
}
|
|
@@ -130270,12 +130370,12 @@ function cacheFile(cacheDir, root) {
|
|
|
130270
130370
|
key: token === void 0 ? null : createHash20("sha256").update(token).digest("hex").slice(0, 16)
|
|
130271
130371
|
};
|
|
130272
130372
|
const key = createHash20("sha256").update(JSON.stringify([root, identity])).digest("hex").slice(0, 32);
|
|
130273
|
-
return
|
|
130373
|
+
return join61(cacheDir, `${key}.json`);
|
|
130274
130374
|
}
|
|
130275
130375
|
function readCache(file, now) {
|
|
130276
130376
|
let entry2;
|
|
130277
130377
|
try {
|
|
130278
|
-
entry2 = JSON.parse(
|
|
130378
|
+
entry2 = JSON.parse(readFileSync29(file, "utf8"));
|
|
130279
130379
|
} catch {
|
|
130280
130380
|
return null;
|
|
130281
130381
|
}
|
|
@@ -130298,7 +130398,7 @@ async function publishedInputs(root, deps, refresh, out) {
|
|
|
130298
130398
|
}
|
|
130299
130399
|
if (file !== null) {
|
|
130300
130400
|
try {
|
|
130301
|
-
mkdirSync12(
|
|
130401
|
+
mkdirSync12(dirname34(file), { recursive: true });
|
|
130302
130402
|
atomicWriteFileSync(
|
|
130303
130403
|
file,
|
|
130304
130404
|
JSON.stringify({
|
|
@@ -130384,7 +130484,7 @@ function defaultDeps2() {
|
|
|
130384
130484
|
return {
|
|
130385
130485
|
fetchPublished: fetchSteeringIndex,
|
|
130386
130486
|
cedar: cedarHooks,
|
|
130387
|
-
cacheDir:
|
|
130487
|
+
cacheDir: join61(getConfigDir(), "cache", "steering-check"),
|
|
130388
130488
|
now: () => Date.now()
|
|
130389
130489
|
};
|
|
130390
130490
|
}
|
|
@@ -134267,7 +134367,7 @@ var init_src9 = __esm({
|
|
|
134267
134367
|
|
|
134268
134368
|
// src/commands/codegraph-upload/files.ts
|
|
134269
134369
|
import { readdir as readdir5, stat as stat5 } from "node:fs/promises";
|
|
134270
|
-
import { join as
|
|
134370
|
+
import { join as join62, relative as relative10, sep as sep13 } from "node:path";
|
|
134271
134371
|
function hasGlobChars(pattern) {
|
|
134272
134372
|
return /[*?[\]{}]/.test(pattern);
|
|
134273
134373
|
}
|
|
@@ -134279,7 +134379,7 @@ async function walk(root, dir, out) {
|
|
|
134279
134379
|
const entries2 = await readdir5(dir, { withFileTypes: true });
|
|
134280
134380
|
for (const entry2 of entries2) {
|
|
134281
134381
|
if (entry2.isSymbolicLink()) continue;
|
|
134282
|
-
const full =
|
|
134382
|
+
const full = join62(dir, entry2.name);
|
|
134283
134383
|
if (entry2.isDirectory()) {
|
|
134284
134384
|
if (!SKIP_DIRS.has(entry2.name)) await walk(root, full, out);
|
|
134285
134385
|
} else if (entry2.isFile()) {
|
|
@@ -134291,7 +134391,7 @@ async function expandPattern(root, pattern) {
|
|
|
134291
134391
|
const wanted = normalize2(pattern.trim());
|
|
134292
134392
|
if (!hasGlobChars(wanted)) {
|
|
134293
134393
|
try {
|
|
134294
|
-
const info = await stat5(
|
|
134394
|
+
const info = await stat5(join62(root, wanted));
|
|
134295
134395
|
return info.isFile() ? [wanted] : [];
|
|
134296
134396
|
} catch {
|
|
134297
134397
|
return [];
|
|
@@ -134442,7 +134542,7 @@ var init_token = __esm({
|
|
|
134442
134542
|
});
|
|
134443
134543
|
|
|
134444
134544
|
// src/commands/codegraph-upload/run.ts
|
|
134445
|
-
import { join as
|
|
134545
|
+
import { join as join63 } from "node:path";
|
|
134446
134546
|
function addDropped(into, more) {
|
|
134447
134547
|
into.sensitiveValues += more.sensitiveValues;
|
|
134448
134548
|
into.secretData += more.secretData;
|
|
@@ -134460,7 +134560,7 @@ async function uploadOne(deps, config, token, group, path2, totals2) {
|
|
|
134460
134560
|
const label2 = `${group.kind}/${group.source} ${path2}`;
|
|
134461
134561
|
let bytes;
|
|
134462
134562
|
try {
|
|
134463
|
-
bytes = await deps.readFile(
|
|
134563
|
+
bytes = await deps.readFile(join63(deps.cwd, path2));
|
|
134464
134564
|
} catch (error) {
|
|
134465
134565
|
totals2.failed += 1;
|
|
134466
134566
|
deps.log(`error: ${label2}: cannot read the file: ${error.message}`);
|
|
@@ -136296,7 +136396,7 @@ __export(secret_exports, {
|
|
|
136296
136396
|
handleSecretReveal: () => handleSecretReveal,
|
|
136297
136397
|
handleSecretSet: () => handleSecretSet
|
|
136298
136398
|
});
|
|
136299
|
-
import { readFileSync as
|
|
136399
|
+
import { readFileSync as readFileSync30, writeFileSync as writeFileSync8 } from "fs";
|
|
136300
136400
|
async function readStdin2() {
|
|
136301
136401
|
const chunks = [];
|
|
136302
136402
|
for await (const chunk2 of process.stdin) chunks.push(chunk2);
|
|
@@ -136409,7 +136509,7 @@ async function handleSecretReveal(key, opts, writer = stdoutWriter) {
|
|
|
136409
136509
|
async function handleSecretImport(opts, writer = stdoutWriter) {
|
|
136410
136510
|
const out = createOutput({}, writer);
|
|
136411
136511
|
try {
|
|
136412
|
-
const text5 = opts.file ?
|
|
136512
|
+
const text5 = opts.file ? readFileSync30(opts.file, "utf8") : await readStdin2();
|
|
136413
136513
|
const environmentId = opts.env ? await resolveEnvironmentId2(opts.env) : null;
|
|
136414
136514
|
const { rows, committed } = await apiPostOrThrow("secret/import-env", { text: text5, environmentId, commit: !!opts.yes });
|
|
136415
136515
|
const newCount = rows.filter((r) => r.isNewKey).length;
|