@oxagen/cli 5.5.1-22 → 5.5.1-95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/oxagen.mjs +1004 -625
  2. package/package.json +1 -1
package/oxagen.mjs CHANGED
@@ -8517,6 +8517,29 @@ function classifySimpleEffect(command2) {
8517
8517
  }
8518
8518
  return "git_commit";
8519
8519
  }
8520
+ function shellSkillLoad(line) {
8521
+ const named2 = new Set(
8522
+ [...line.matchAll(SKILL_FILE_IN_LINE)].map((match) => match[1])
8523
+ );
8524
+ if (named2.size !== 1) return void 0;
8525
+ for (const piece of splitCommandList(line)) {
8526
+ const words3 = tokenizeSimpleCommand(piece);
8527
+ if (words3 === void 0) continue;
8528
+ const start = words3.findIndex((word2) => !ASSIGNMENT.test(word2));
8529
+ if (start === -1) continue;
8530
+ const [program2, ...args] = words3.slice(start);
8531
+ const printer = posix.basename(program2 ?? "");
8532
+ if (!FILE_PRINTERS.has(printer)) continue;
8533
+ if (args.some((arg) => STDOUT_REDIRECT.test(arg))) continue;
8534
+ if (printer === "sed" && args.some((arg) => SED_IN_PLACE.test(arg)))
8535
+ continue;
8536
+ for (const arg of args) {
8537
+ const name2 = skillFileName(arg);
8538
+ if (name2 !== void 0 && named2.has(name2)) return name2;
8539
+ }
8540
+ }
8541
+ return void 0;
8542
+ }
8520
8543
  function classifyTool(toolName4, toolInput2) {
8521
8544
  const input = toolInput2 ?? {};
8522
8545
  const mcp = mcpToolName(toolName4);
@@ -8585,8 +8608,9 @@ function classifyTool(toolName4, toolInput2) {
8585
8608
  const raw = input["command"];
8586
8609
  const command2 = head(raw);
8587
8610
  const effect = typeof raw === "string" ? classifyShellEffect(raw) : void 0;
8611
+ const loadsSkill = command2 !== void 0 && shellSkillLoad(command2) !== void 0;
8588
8612
  return {
8589
- tool_source: "builtin",
8613
+ tool_source: loadsSkill ? "skill" : "builtin",
8590
8614
  effect_kind: effect ?? "command",
8591
8615
  tool_is_mutating: true,
8592
8616
  ...command2 !== void 0 ? { tool_target: command2 } : {}
@@ -8760,7 +8784,7 @@ function mcpIssueAction(tool, input) {
8760
8784
  if (ends("update_issue") || ends("issue_update")) return bystate("edited");
8761
8785
  return void 0;
8762
8786
  }
8763
- var TARGET_MAX, READ_TOOLS, SINGLE_FILE_READS, SKILL_FILE, WRITE_TOOLS, EDIT_TOOLS, NETWORK_TOOLS, READ_VERBS, WRITE_VERBS, READ_ONLY_BUILTINS, COMMAND_SEPARATORS, GIT_GLOBAL_OPTIONS_WITH_VALUE, GIT_GLOBAL_FLAGS, EFFECT_REACH, ASSIGNMENT, ARGV_SHELLS, PULL_REQUEST_URL, ISSUE_URL, WHOLE_ISSUE_URL, REPO_SEGMENT;
8787
+ var TARGET_MAX, READ_TOOLS, SINGLE_FILE_READS, SKILL_FILE, WRITE_TOOLS, EDIT_TOOLS, NETWORK_TOOLS, READ_VERBS, WRITE_VERBS, READ_ONLY_BUILTINS, COMMAND_SEPARATORS, GIT_GLOBAL_OPTIONS_WITH_VALUE, GIT_GLOBAL_FLAGS, EFFECT_REACH, ASSIGNMENT, FILE_PRINTERS, SED_IN_PLACE, STDOUT_REDIRECT, SKILL_FILE_IN_LINE, ARGV_SHELLS, PULL_REQUEST_URL, ISSUE_URL, WHOLE_ISSUE_URL, REPO_SEGMENT;
8764
8788
  var init_tools = __esm({
8765
8789
  "../../packages/tacho/src/claude-code/tools.ts"() {
8766
8790
  "use strict";
@@ -8776,7 +8800,7 @@ var init_tools = __esm({
8776
8800
  "read_file"
8777
8801
  ]);
8778
8802
  SINGLE_FILE_READS = /* @__PURE__ */ new Set(["Read", "read_file"]);
8779
- SKILL_FILE = /(?:^|\/)\.(?:claude|agents|cursor|stella)\/skills\/([^/]+)\/SKILL\.md$/;
8803
+ SKILL_FILE = /(?:^|\/)\.(?:claude|agents|codex|cursor|stella)\/skills\/([^/]+)\/SKILL\.md$/;
8780
8804
  WRITE_TOOLS = /* @__PURE__ */ new Set(["Write"]);
8781
8805
  EDIT_TOOLS = /* @__PURE__ */ new Set(["Edit", "MultiEdit", "NotebookEdit"]);
8782
8806
  NETWORK_TOOLS = /* @__PURE__ */ new Set(["WebFetch", "WebSearch"]);
@@ -8862,6 +8886,19 @@ var init_tools = __esm({
8862
8886
  "git_commit"
8863
8887
  ];
8864
8888
  ASSIGNMENT = /^[A-Za-z_][A-Za-z0-9_]*=/;
8889
+ FILE_PRINTERS = /* @__PURE__ */ new Set([
8890
+ "cat",
8891
+ "sed",
8892
+ "head",
8893
+ "tail",
8894
+ "nl",
8895
+ "less",
8896
+ "more",
8897
+ "bat"
8898
+ ]);
8899
+ SED_IN_PLACE = /^(?:-[a-zA-Z]*i|--in-place)/;
8900
+ STDOUT_REDIRECT = /^1?>/;
8901
+ SKILL_FILE_IN_LINE = /(?:^|[/\s'"])\.(?:claude|agents|codex|cursor|stella)\/skills\/([^/\s'"]+)\/SKILL\.md(?=$|[\s'";&|)])/g;
8865
8902
  ARGV_SHELLS = /* @__PURE__ */ new Set(["bash", "sh", "zsh", "dash"]);
8866
8903
  PULL_REQUEST_URL = /https:\/\/github\.com\/([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\/pull\/(\d+)/;
8867
8904
  ISSUE_URL = /https:\/\/github\.com\/([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\/issues\/(\d+)\b/;
@@ -17912,7 +17949,8 @@ var init_replay_grade = __esm({
17912
17949
  "hooks_partial",
17913
17950
  "unobserved_tail",
17914
17951
  "chain_break",
17915
- "telemetry_gap"
17952
+ "telemetry_gap",
17953
+ "unapproved_output_schema"
17916
17954
  ];
17917
17955
  GRADE_ENFORCEMENT_TIERS = [
17918
17956
  "contained",
@@ -23858,6 +23896,101 @@ var init_recorder = __esm({
23858
23896
  }
23859
23897
  });
23860
23898
 
23899
+ // ../../packages/tacho/src/collector/agent-file.ts
23900
+ import {
23901
+ closeSync as closeSync4,
23902
+ constants as constants2,
23903
+ fstatSync,
23904
+ openSync as openSync4,
23905
+ promises as fsp,
23906
+ readFileSync as readFileSync6
23907
+ } from "node:fs";
23908
+ function processAgentFileGuard() {
23909
+ return processGuard;
23910
+ }
23911
+ function refused(path2) {
23912
+ const error2 = new Error(
23913
+ `${path2} is not a file or folder the agent owns, so it is not read`
23914
+ );
23915
+ error2.code = "ENOENT";
23916
+ return error2;
23917
+ }
23918
+ function admits(st, guard) {
23919
+ return st.isFile() && st.uid === guard.allowedOwner;
23920
+ }
23921
+ async function statAgentFile(path2, guard) {
23922
+ try {
23923
+ if (guard === void 0) return await fsp.stat(path2);
23924
+ const st = await fsp.lstat(path2);
23925
+ return admits(st, guard) ? st : void 0;
23926
+ } catch (error2) {
23927
+ if (error2.code === "ENOENT") return void 0;
23928
+ throw error2;
23929
+ }
23930
+ }
23931
+ async function openAgentFile(path2, guard) {
23932
+ if (guard === void 0) return fsp.open(path2, "r");
23933
+ let handle;
23934
+ try {
23935
+ handle = await fsp.open(path2, NO_FOLLOW);
23936
+ } catch (error2) {
23937
+ if (error2.code === "ELOOP") throw refused(path2);
23938
+ throw error2;
23939
+ }
23940
+ try {
23941
+ if (!admits(await handle.stat(), guard)) throw refused(path2);
23942
+ return handle;
23943
+ } catch (error2) {
23944
+ await handle.close();
23945
+ throw error2;
23946
+ }
23947
+ }
23948
+ async function readAgentDir(path2, guard) {
23949
+ if (guard === void 0) return fsp.readdir(path2);
23950
+ let handle;
23951
+ try {
23952
+ handle = await fsp.open(path2, NO_FOLLOW_DIR);
23953
+ } catch (error2) {
23954
+ const code = error2.code;
23955
+ if (code === "ELOOP" || code === "ENOTDIR") throw refused(path2);
23956
+ throw error2;
23957
+ }
23958
+ try {
23959
+ const st = await handle.stat();
23960
+ if (!st.isDirectory() || st.uid !== guard.allowedOwner) throw refused(path2);
23961
+ try {
23962
+ return await fsp.readdir(`/proc/self/fd/${String(handle.fd)}`);
23963
+ } catch (error2) {
23964
+ if (error2.code !== "ENOENT") throw error2;
23965
+ return await fsp.readdir(path2);
23966
+ }
23967
+ } finally {
23968
+ await handle.close();
23969
+ }
23970
+ }
23971
+ function readAgentTextOrUndefined(path2, guard = processAgentFileGuard()) {
23972
+ try {
23973
+ if (guard === void 0) return readFileSync6(path2, "utf8");
23974
+ const fd2 = openSync4(path2, NO_FOLLOW);
23975
+ try {
23976
+ if (!admits(fstatSync(fd2), guard)) return void 0;
23977
+ return readFileSync6(fd2, "utf8");
23978
+ } finally {
23979
+ closeSync4(fd2);
23980
+ }
23981
+ } catch {
23982
+ return void 0;
23983
+ }
23984
+ }
23985
+ var processGuard, NO_FOLLOW, NO_FOLLOW_DIR;
23986
+ var init_agent_file = __esm({
23987
+ "../../packages/tacho/src/collector/agent-file.ts"() {
23988
+ "use strict";
23989
+ NO_FOLLOW = constants2.O_RDONLY | (constants2.O_NOFOLLOW ?? 0);
23990
+ NO_FOLLOW_DIR = NO_FOLLOW | (constants2.O_DIRECTORY ?? 0);
23991
+ }
23992
+ });
23993
+
23861
23994
  // ../../packages/tacho/src/collector/registry.ts
23862
23995
  function contextForHarness(context, harness, customAgent) {
23863
23996
  if (customAgent !== void 0) {
@@ -24888,7 +25021,6 @@ var init_registry = __esm({
24888
25021
  });
24889
25022
 
24890
25023
  // ../../packages/tacho/src/collector/transcript-tailer.ts
24891
- import { promises as fs } from "node:fs";
24892
25024
  import { basename as basename2, join as join14 } from "node:path";
24893
25025
  function hasTranscriptNormalizer(session) {
24894
25026
  return session.harness === void 0 || TRANSCRIPT_NORMALIZED_HARNESSES.has(session.harness);
@@ -24913,7 +25045,7 @@ function isFileCursor(value) {
24913
25045
  if (!isRecord4(value)) return false;
24914
25046
  return typeof value.path === "string" && Number.isSafeInteger(value.offset) && value.offset >= 0 && isOptional(value.ino, (ino) => typeof ino === "number") && isOptional(value.head, (head3) => typeof head3 === "string") && isOptional(
24915
25047
  value.refused,
24916
- (refused2) => isRecord4(refused2) && typeof refused2.count === "number" && typeof refused2.detail === "string"
25048
+ (refused3) => isRecord4(refused3) && typeof refused3.count === "number" && typeof refused3.detail === "string"
24917
25049
  ) && isOptional(value.codex, isRecord4);
24918
25050
  }
24919
25051
  function storedCursor(value) {
@@ -24937,20 +25069,15 @@ function storedCursor(value) {
24937
25069
  subagents: stored.subagents ?? []
24938
25070
  };
24939
25071
  }
24940
- async function statIfExists(path2) {
24941
- try {
24942
- const st = await fs.stat(path2);
24943
- return { size: st.size, ino: st.ino };
24944
- } catch (error2) {
24945
- if (error2.code === "ENOENT") return void 0;
24946
- throw error2;
24947
- }
25072
+ async function statIfExists(path2, guard) {
25073
+ const st = await statAgentFile(path2, guard);
25074
+ return st === void 0 ? void 0 : { size: st.size, ino: st.ino };
24948
25075
  }
24949
25076
  function yieldTurn() {
24950
25077
  return new Promise((resolve29) => setImmediate(resolve29));
24951
25078
  }
24952
- async function readAt(path2, offset, length) {
24953
- const handle = await fs.open(path2, "r");
25079
+ async function readAt(path2, offset, length, guard) {
25080
+ const handle = await openAgentFile(path2, guard);
24954
25081
  try {
24955
25082
  const buffer = Buffer.allocUnsafe(length);
24956
25083
  let filled = 0;
@@ -24984,6 +25111,7 @@ var init_transcript_tailer = __esm({
24984
25111
  "use strict";
24985
25112
  init_hook_payload_fit();
24986
25113
  init_fs();
25114
+ init_agent_file();
24987
25115
  init_registry();
24988
25116
  DEFAULT_TAIL_BUDGET_BYTES = 4 * 1024 * 1024;
24989
25117
  MAX_TRANSCRIPT_LINE_BYTES = HOOK_READ_MAX_BYTES;
@@ -25016,8 +25144,11 @@ var init_transcript_tailer = __esm({
25016
25144
  * start: a subagent id, or `OWN_TRANSCRIPT` for the session's own.
25017
25145
  */
25018
25146
  fileResumeAt = /* @__PURE__ */ new Map();
25147
+ /** What every read of a transcript refuses; see `TranscriptTailerOptions.guard`. */
25148
+ guard;
25019
25149
  constructor(options) {
25020
25150
  this.options = options;
25151
+ this.guard = options.guard ?? processAgentFileGuard();
25021
25152
  this.budget = options.budgetBytes ?? DEFAULT_TAIL_BUDGET_BYTES;
25022
25153
  this.maxLine = options.maxLineBytes ?? MAX_TRANSCRIPT_LINE_BYTES;
25023
25154
  this.tickBudget = Math.max(
@@ -25426,7 +25557,7 @@ var init_transcript_tailer = __esm({
25426
25557
  );
25427
25558
  if (found === void 0)
25428
25559
  return cursor.finished?.[subagentId] === void 0 ? void 0 : 0;
25429
- const ino = cursor.finished?.[subagentId] === void 0 ? void 0 : (await statIfExists(found))?.ino;
25560
+ const ino = cursor.finished?.[subagentId] === void 0 ? void 0 : (await statIfExists(found, this.guard))?.ino;
25430
25561
  sub = this.takeFinished(cursor, subagentId, found, ino) ?? {
25431
25562
  path: found,
25432
25563
  offset: 0
@@ -25539,13 +25670,23 @@ var init_transcript_tailer = __esm({
25539
25670
  * project directory its transcript is in. Undefined when neither is there.
25540
25671
  */
25541
25672
  async locateSubagentTranscript(session, subagentId, path2) {
25542
- if (await statIfExists(path2) !== void 0) return path2;
25673
+ if (await statIfExists(path2, this.guard) !== void 0) return path2;
25543
25674
  if (session.harness === "codex") return void 0;
25544
25675
  const dir = session.transcriptPath === void 0 ? void 0 : subagentDirOf(session.transcriptPath);
25545
25676
  if (dir === void 0) return void 0;
25546
- const own = join14(dir, `agent-${subagentId}.jsonl`);
25547
- if (own === path2) return void 0;
25548
- return await statIfExists(own) === void 0 ? void 0 : own;
25677
+ const name2 = `agent-${subagentId}.jsonl`;
25678
+ const own = join14(dir, name2);
25679
+ if (own !== path2 && await statIfExists(own, this.guard) !== void 0)
25680
+ return own;
25681
+ const workflows = join14(dir, "workflows");
25682
+ for (const workflow of await this.listDir(workflows)) {
25683
+ const at2 = join14(workflows, workflow);
25684
+ if (!(await this.listDir(at2)).includes(name2)) continue;
25685
+ const found = join14(at2, name2);
25686
+ if (found !== path2 && await statIfExists(found, this.guard) !== void 0)
25687
+ return found;
25688
+ }
25689
+ return void 0;
25549
25690
  }
25550
25691
  /**
25551
25692
  * Start tailing a Codex subagent's rollout on a cursor of its own, fed
@@ -25650,7 +25791,7 @@ var init_transcript_tailer = __esm({
25650
25791
  */
25651
25792
  async listDir(dir) {
25652
25793
  try {
25653
- return await fs.readdir(dir);
25794
+ return await readAgentDir(dir, this.guard);
25654
25795
  } catch (error2) {
25655
25796
  const code = error2.code;
25656
25797
  if (code !== "ENOENT" && code !== "ENOTDIR")
@@ -25730,14 +25871,14 @@ var init_transcript_tailer = __esm({
25730
25871
  const pass2 = await this.feed(session, cursor, budget, sealer, subagentId);
25731
25872
  if (cursor.refused === void 0) return pass2;
25732
25873
  await sealer.run(() => {
25733
- const refused2 = cursor.refused;
25734
- if (refused2 === void 0 || !sealer.current()) return;
25874
+ const refused3 = cursor.refused;
25875
+ if (refused3 === void 0 || !sealer.current()) return;
25735
25876
  this.sealGap(
25736
25877
  session,
25737
25878
  "transcript_line_refused",
25738
- refused2.detail,
25879
+ refused3.detail,
25739
25880
  subagentId,
25740
- refused2.count
25881
+ refused3.count
25741
25882
  );
25742
25883
  delete cursor.refused;
25743
25884
  this.dirty = true;
@@ -25760,7 +25901,7 @@ var init_transcript_tailer = __esm({
25760
25901
  let bytes = 0;
25761
25902
  let st;
25762
25903
  try {
25763
- st = await statIfExists(cursor.path);
25904
+ st = await statIfExists(cursor.path, this.guard);
25764
25905
  } catch (error2) {
25765
25906
  this.options.log?.(
25766
25907
  `transcript ${cursor.path} unreadable: ${describe2(error2)}`
@@ -25777,7 +25918,12 @@ var init_transcript_tailer = __esm({
25777
25918
  if (!replaced && !idle && at2 > 0 && cursor.head !== void 0) {
25778
25919
  const expected = Buffer.from(cursor.head, "base64");
25779
25920
  try {
25780
- const actual = await readAt(cursor.path, 0, expected.length);
25921
+ const actual = await readAt(
25922
+ cursor.path,
25923
+ 0,
25924
+ expected.length,
25925
+ this.guard
25926
+ );
25781
25927
  replaced = !actual.equals(expected);
25782
25928
  } catch {
25783
25929
  }
@@ -25809,7 +25955,7 @@ var init_transcript_tailer = __esm({
25809
25955
  const want = Math.min(remaining, size - from, this.budget);
25810
25956
  let chunk;
25811
25957
  try {
25812
- chunk = await readAt(cursor.path, from, want);
25958
+ chunk = await readAt(cursor.path, from, want, this.guard);
25813
25959
  } catch (error2) {
25814
25960
  this.options.log?.(
25815
25961
  `transcript ${cursor.path} read failed at ${from}: ${describe2(error2)}`
@@ -25825,7 +25971,7 @@ var init_transcript_tailer = __esm({
25825
25971
  if (skipTo - from <= this.maxLine) {
25826
25972
  let whole;
25827
25973
  try {
25828
- whole = await readAt(cursor.path, from, skipTo - from);
25974
+ whole = await readAt(cursor.path, from, skipTo - from, this.guard);
25829
25975
  } catch (error2) {
25830
25976
  this.options.log?.(
25831
25977
  `transcript ${cursor.path} read failed at ${from}: ${describe2(error2)}`
@@ -25915,7 +26061,7 @@ var init_transcript_tailer = __esm({
25915
26061
  const known = cursor.head === void 0 ? 0 : Buffer.from(cursor.head, "base64").length;
25916
26062
  if (statApplied && headLength > known) {
25917
26063
  try {
25918
- const head3 = await readAt(cursor.path, 0, headLength);
26064
+ const head3 = await readAt(cursor.path, 0, headLength, this.guard);
25919
26065
  await sealer.run(() => {
25920
26066
  if (!sealer.current() || cursor.offset < headLength) return;
25921
26067
  cursor.head = head3.toString("base64");
@@ -25936,7 +26082,12 @@ var init_transcript_tailer = __esm({
25936
26082
  async findLineEnd(path2, from, size) {
25937
26083
  let at2 = from;
25938
26084
  while (at2 < size) {
25939
- const chunk = await readAt(path2, at2, Math.min(this.budget, size - at2));
26085
+ const chunk = await readAt(
26086
+ path2,
26087
+ at2,
26088
+ Math.min(this.budget, size - at2),
26089
+ this.guard
26090
+ );
25940
26091
  if (chunk.length === 0) return void 0;
25941
26092
  const nl = chunk.indexOf(10);
25942
26093
  if (nl >= 0) return at2 + nl + 1;
@@ -25949,7 +26100,7 @@ var init_transcript_tailer = __esm({
25949
26100
  });
25950
26101
 
25951
26102
  // ../../packages/tacho/src/collector/backfill.ts
25952
- import { promises as fs2 } from "node:fs";
26103
+ import { promises as fs } from "node:fs";
25953
26104
  import { basename as basename3, dirname as dirname10, join as join15 } from "node:path";
25954
26105
  function shown(value) {
25955
26106
  return JSON.stringify(value.length > 64 ? `${value.slice(0, 64)}\u2026` : value);
@@ -25998,12 +26149,12 @@ function parseBackfillRequest(value) {
25998
26149
  return { request: request4 };
25999
26150
  }
26000
26151
  async function writeSensitiveFile(path2, text6) {
26001
- await fs2.mkdir(dirname10(path2), { recursive: true, mode: 448 });
26152
+ await fs.mkdir(dirname10(path2), { recursive: true, mode: 448 });
26002
26153
  const tmp = join15(
26003
26154
  dirname10(path2),
26004
26155
  `.${basename3(path2)}.${process.pid}.${Date.now()}.tmp`
26005
26156
  );
26006
- const handle = await fs2.open(tmp, "w", 384);
26157
+ const handle = await fs.open(tmp, "w", 384);
26007
26158
  try {
26008
26159
  try {
26009
26160
  await handle.writeFile(text6, "utf8");
@@ -26011,10 +26162,10 @@ async function writeSensitiveFile(path2, text6) {
26011
26162
  } finally {
26012
26163
  await handle.close();
26013
26164
  }
26014
- await fs2.chmod(tmp, 384);
26015
- await fs2.rename(tmp, path2);
26165
+ await fs.chmod(tmp, 384);
26166
+ await fs.rename(tmp, path2);
26016
26167
  } catch (error2) {
26017
- await fs2.unlink(tmp).catch(() => void 0);
26168
+ await fs.unlink(tmp).catch(() => void 0);
26018
26169
  throw error2;
26019
26170
  }
26020
26171
  }
@@ -26196,7 +26347,7 @@ async function discover(request4, deps, unreadable) {
26196
26347
  if (!included) continue;
26197
26348
  let stat7;
26198
26349
  try {
26199
- stat7 = await fs2.stat(path2);
26350
+ stat7 = await fs.stat(path2);
26200
26351
  } catch (error2) {
26201
26352
  unreadable(path2, error2);
26202
26353
  continue;
@@ -26234,7 +26385,7 @@ function isAbsent(error2) {
26234
26385
  }
26235
26386
  async function listDir(dir, unreadable) {
26236
26387
  try {
26237
- return await fs2.readdir(dir);
26388
+ return await fs.readdir(dir);
26238
26389
  } catch (error2) {
26239
26390
  if (isAbsent(error2)) return [];
26240
26391
  if (unreadable === void 0) throw error2;
@@ -26244,7 +26395,7 @@ async function listDir(dir, unreadable) {
26244
26395
  }
26245
26396
  async function isDirectory(path2, unreadable) {
26246
26397
  try {
26247
- return (await fs2.stat(path2)).isDirectory();
26398
+ return (await fs.stat(path2)).isDirectory();
26248
26399
  } catch (error2) {
26249
26400
  if (!isAbsent(error2)) unreadable(path2, error2);
26250
26401
  return false;
@@ -26297,7 +26448,7 @@ async function countSubagents(sessionDir) {
26297
26448
  async function readMeta(path2, unreadable) {
26298
26449
  let parsed2;
26299
26450
  try {
26300
- parsed2 = JSON.parse(await fs2.readFile(path2, "utf8"));
26451
+ parsed2 = JSON.parse(await fs.readFile(path2, "utf8"));
26301
26452
  } catch (error2) {
26302
26453
  if (!isAbsent(error2)) unreadable(path2, error2);
26303
26454
  return {};
@@ -26329,7 +26480,7 @@ async function firstRecordMs(path2) {
26329
26480
  async function readHead(path2, length) {
26330
26481
  let handle;
26331
26482
  try {
26332
- handle = await fs2.open(path2, "r");
26483
+ handle = await fs.open(path2, "r");
26333
26484
  const buffer = Buffer.alloc(length);
26334
26485
  const { bytesRead } = await handle.read(buffer, 0, length, 0);
26335
26486
  return buffer.subarray(0, bytesRead);
@@ -26582,7 +26733,7 @@ async function resultAgentIds(path2) {
26582
26733
  return out;
26583
26734
  }
26584
26735
  async function readSlices(path2, sliceBytes, onSlice) {
26585
- const handle = await fs2.open(path2, "r");
26736
+ const handle = await fs.open(path2, "r");
26586
26737
  try {
26587
26738
  const buffer = Buffer.alloc(READ_CHUNK_BYTES2);
26588
26739
  let position = 0;
@@ -26737,7 +26888,7 @@ var init_backfill2 = __esm({
26737
26888
  async prune() {
26738
26889
  for (const [path2, entry2] of [...this.entries]) {
26739
26890
  try {
26740
- await fs2.stat(path2);
26891
+ await fs.stat(path2);
26741
26892
  } catch (error2) {
26742
26893
  if (errorCodeOf(error2) !== "ENOENT") continue;
26743
26894
  this.entries.delete(path2);
@@ -27750,7 +27901,7 @@ var init_model_failure = __esm({
27750
27901
 
27751
27902
  // ../../packages/tacho/src/host/run-token.ts
27752
27903
  import { createHmac, randomBytes as randomBytes4, timingSafeEqual } from "node:crypto";
27753
- import { readFileSync as readFileSync6 } from "node:fs";
27904
+ import { readFileSync as readFileSync7 } from "node:fs";
27754
27905
  function keyFromBytes(bytes) {
27755
27906
  if (bytes.length !== KEY_BYTES)
27756
27907
  throw new Error(
@@ -27771,7 +27922,7 @@ function runTokenKeyFromHex(hex) {
27771
27922
  function loadOrCreateRunTokenKey(path2) {
27772
27923
  try {
27773
27924
  return {
27774
- key: runTokenKeyFromHex(readFileSync6(path2, "utf8")),
27925
+ key: runTokenKeyFromHex(readFileSync7(path2, "utf8")),
27775
27926
  created: false
27776
27927
  };
27777
27928
  } catch (error2) {
@@ -27792,7 +27943,7 @@ function readRunTokenKey(path2) {
27792
27943
  if (seen?.version === version3) return seen.key;
27793
27944
  let key;
27794
27945
  try {
27795
- key = runTokenKeyFromHex(readFileSync6(path2, "utf8"));
27946
+ key = runTokenKeyFromHex(readFileSync7(path2, "utf8"));
27796
27947
  } catch (error2) {
27797
27948
  if (error2.code === "ENOENT") return void 0;
27798
27949
  throw error2;
@@ -27928,11 +28079,11 @@ var init_run_token = __esm({
27928
28079
  // ../../packages/tacho/src/host/credential-store.ts
27929
28080
  import { createCipheriv, createDecipheriv, randomBytes as randomBytes5 } from "node:crypto";
27930
28081
  import {
27931
- closeSync as closeSync4,
28082
+ closeSync as closeSync5,
27932
28083
  existsSync as existsSync7,
27933
28084
  fsyncSync as fsyncSync3,
27934
- openSync as openSync4,
27935
- readFileSync as readFileSync7,
28085
+ openSync as openSync5,
28086
+ readFileSync as readFileSync8,
27936
28087
  statSync as statSync3,
27937
28088
  unlinkSync as unlinkSync4,
27938
28089
  writeSync as writeSync3
@@ -28007,7 +28158,7 @@ function heldBackAt(failure4, now) {
28007
28158
  }
28008
28159
  function readKey(path2) {
28009
28160
  try {
28010
- const hex = readFileSync7(path2, "utf8").trim();
28161
+ const hex = readFileSync8(path2, "utf8").trim();
28011
28162
  if (!/^[0-9a-f]{64}$/i.test(hex))
28012
28163
  throw new Error(`${path2} does not hold a 32-byte key`);
28013
28164
  return Buffer.from(hex, "hex");
@@ -28036,13 +28187,13 @@ function overwriteInPlace(path2) {
28036
28187
  let fd2;
28037
28188
  try {
28038
28189
  const size = statSync3(path2).size;
28039
- fd2 = openSync4(path2, "r+");
28190
+ fd2 = openSync5(path2, "r+");
28040
28191
  writeSync3(fd2, randomBytes5(Math.max(size, KEY_BYTES2 * 2)), 0, void 0, 0);
28041
28192
  fsyncSync3(fd2);
28042
28193
  } catch (error2) {
28043
28194
  if (error2.code !== "ENOENT") throw error2;
28044
28195
  } finally {
28045
- if (fd2 !== void 0) closeSync4(fd2);
28196
+ if (fd2 !== void 0) closeSync5(fd2);
28046
28197
  }
28047
28198
  }
28048
28199
  function seal(key, secret, aad) {
@@ -28147,7 +28298,7 @@ function openCredentialStore(paths) {
28147
28298
  if (entriesSeen?.version === version3) return entriesSeen.entries;
28148
28299
  let text6;
28149
28300
  try {
28150
- text6 = readFileSync7(paths.file, "utf8");
28301
+ text6 = readFileSync8(paths.file, "utf8");
28151
28302
  } catch (error2) {
28152
28303
  if (error2.code === "ENOENT") return [];
28153
28304
  throw error2;
@@ -28549,7 +28700,7 @@ var init_credential_store = __esm({
28549
28700
 
28550
28701
  // ../../packages/tacho/src/host/claude-setup-token.ts
28551
28702
  import { spawn } from "node:child_process";
28552
- import { accessSync as accessSync2, constants as constants2 } from "node:fs";
28703
+ import { accessSync as accessSync2, constants as constants3 } from "node:fs";
28553
28704
  import { delimiter, join as join17 } from "node:path";
28554
28705
  function isSubscriptionToken(value) {
28555
28706
  return TOKEN.test(value.trim());
@@ -28592,7 +28743,7 @@ function findHarnessBinary(name2, env, home) {
28592
28743
  ].map((dir) => join17(dir, file));
28593
28744
  for (const path2 of candidates) {
28594
28745
  try {
28595
- accessSync2(path2, constants2.X_OK);
28746
+ accessSync2(path2, constants3.X_OK);
28596
28747
  return path2;
28597
28748
  } catch {
28598
28749
  }
@@ -28835,7 +28986,7 @@ var init_model_base_url_toml = __esm({
28835
28986
  });
28836
28987
 
28837
28988
  // ../../packages/tacho/src/host/model-base-url.ts
28838
- import { chmodSync as chmodSync3, existsSync as existsSync8, readFileSync as readFileSync8, unlinkSync as unlinkSync5 } from "node:fs";
28989
+ import { chmodSync as chmodSync3, existsSync as existsSync8, readFileSync as readFileSync9, unlinkSync as unlinkSync5 } from "node:fs";
28839
28990
  import { basename as basename4, dirname as dirname12, join as join18 } from "node:path";
28840
28991
  function claudeToolSearchEnabled(value) {
28841
28992
  return typeof value === "string" && /^(true|auto(:\d+)?)$/i.test(value);
@@ -29213,7 +29364,7 @@ function describe3(harness, options, { changed, text: text6, sidecar, unreadable
29213
29364
  }
29214
29365
  function readBytesIfExists(path2) {
29215
29366
  try {
29216
- return readFileSync8(path2);
29367
+ return readFileSync9(path2);
29217
29368
  } catch (error2) {
29218
29369
  if (error2.code === "ENOENT") return void 0;
29219
29370
  throw error2;
@@ -31358,7 +31509,7 @@ import { join as join20 } from "node:path";
31358
31509
  import {
31359
31510
  existsSync as existsSync11,
31360
31511
  readdirSync as readdirSync7,
31361
- readFileSync as readFileSync9,
31512
+ readFileSync as readFileSync10,
31362
31513
  rmdirSync as rmdirSync4,
31363
31514
  unlinkSync as unlinkSync7
31364
31515
  } from "node:fs";
@@ -31459,7 +31610,7 @@ function launchdManager(options) {
31459
31610
  unitPath,
31460
31611
  install: (spec) => {
31461
31612
  const plist = renderLaunchdPlist(spec);
31462
- const unchanged = existsSync11(unitPath) && readFileSync9(unitPath, "utf8") === plist;
31613
+ const unchanged = existsSync11(unitPath) && readFileSync10(unitPath, "utf8") === plist;
31463
31614
  if (unchanged && loaded()) {
31464
31615
  const kicked = options.exec("launchctl", ["kickstart", "-k", target]);
31465
31616
  if (kicked.status === 0 && loaded()) return;
@@ -31509,7 +31660,7 @@ function noUserManager(result2) {
31509
31660
  function stopByPidFile(options) {
31510
31661
  const { pidPath } = options;
31511
31662
  if (pidPath === void 0 || !existsSync11(pidPath)) return;
31512
- const record2 = parseDaemonPid(readFileSync9(pidPath, "utf8"));
31663
+ const record2 = parseDaemonPid(readFileSync10(pidPath, "utf8"));
31513
31664
  if (record2 === void 0) return;
31514
31665
  const sleep2 = options.sleep ?? blockingSleep;
31515
31666
  const processes = options.processes ?? {
@@ -31560,7 +31711,7 @@ function systemdManager(options) {
31560
31711
  throw new Error(
31561
31712
  `no systemd user manager is available (${probe.stderr.trim().split("\n")[0] ?? ""}). Turn on systemd for your login (on WSL, set \`systemd=true\` under \`[boot]\` in /etc/wsl.conf and run \`wsl --shutdown\`), or run \`oxagen daemon\` yourself`
31562
31713
  );
31563
- const previous = existsSync11(unitPath) ? readFileSync9(unitPath, "utf8") : void 0;
31714
+ const previous = existsSync11(unitPath) ? readFileSync10(unitPath, "utf8") : void 0;
31564
31715
  const createsWants = previous === void 0 ? !existsSync11(wants) : unitCreatedWants(previous);
31565
31716
  ensureDir(dir, 493);
31566
31717
  writeSensitiveFileAtomic(
@@ -31619,7 +31770,7 @@ function systemdManager(options) {
31619
31770
  `systemctl could not remove tachod.service: ${disabled.stderr.trim() || active2.stderr.trim() || active2.stdout.trim() || "service state is unknown"}. Run \`systemctl --user disable --now tachod.service\`, then try again`
31620
31771
  );
31621
31772
  }
31622
- const unit4 = existsSync11(unitPath) ? readFileSync9(unitPath, "utf8") : void 0;
31773
+ const unit4 = existsSync11(unitPath) ? readFileSync10(unitPath, "utf8") : void 0;
31623
31774
  if (unit4 !== void 0) unlinkSync7(unitPath);
31624
31775
  try {
31625
31776
  const reload = options.exec("systemctl", ["--user", "daemon-reload"]);
@@ -31705,7 +31856,7 @@ function schtasksManager(options) {
31705
31856
  const pidPath = options.pidPath ?? join20(launcher, "..", "tachod.pid");
31706
31857
  const liveRecord = () => {
31707
31858
  if (!existsSync11(pidPath)) return void 0;
31708
- const record2 = parseDaemonPid(readFileSync9(pidPath, "utf8"));
31859
+ const record2 = parseDaemonPid(readFileSync10(pidPath, "utf8"));
31709
31860
  if (record2 === void 0) return void 0;
31710
31861
  const { pid } = record2;
31711
31862
  const query = options.exec("tasklist", [
@@ -31876,15 +32027,15 @@ var init_service = __esm({
31876
32027
  });
31877
32028
 
31878
32029
  // ../../packages/tacho/src/version.ts
31879
- import { readFileSync as readFileSync10 } from "node:fs";
32030
+ import { readFileSync as readFileSync11 } from "node:fs";
31880
32031
  import { dirname as dirname14, resolve as resolve3 } from "node:path";
31881
32032
  import { fileURLToPath } from "node:url";
31882
32033
  function readVersion() {
31883
- if (true) return "5.5.1-22";
32034
+ if (true) return "5.5.1-95";
31884
32035
  try {
31885
32036
  const here = dirname14(fileURLToPath(import.meta.url));
31886
32037
  const pkg = JSON.parse(
31887
- readFileSync10(resolve3(here, "..", "package.json"), "utf8")
32038
+ readFileSync11(resolve3(here, "..", "package.json"), "utf8")
31888
32039
  );
31889
32040
  return pkg.version ?? "0.0.0";
31890
32041
  } catch {
@@ -33062,7 +33213,7 @@ import {
33062
33213
  sign as sign3,
33063
33214
  verify as verify3
33064
33215
  } from "node:crypto";
33065
- import { readFileSync as readFileSync11 } from "node:fs";
33216
+ import { readFileSync as readFileSync12 } from "node:fs";
33066
33217
  function encodePublicKey(privateKey) {
33067
33218
  const spki = createPublicKey3(privateKey).export({
33068
33219
  type: "spki",
@@ -33100,7 +33251,7 @@ function deviceKeyPem(key) {
33100
33251
  function loadOrCreateDeviceKey(path2) {
33101
33252
  try {
33102
33253
  return {
33103
- key: deviceKeyFromPem(readFileSync11(path2, "utf8")),
33254
+ key: deviceKeyFromPem(readFileSync12(path2, "utf8")),
33104
33255
  created: false
33105
33256
  };
33106
33257
  } catch (error2) {
@@ -33523,9 +33674,9 @@ var init_control_client = __esm({
33523
33674
  // ../../packages/tacho/src/host/wal-index.ts
33524
33675
  import {
33525
33676
  appendFileSync,
33526
- closeSync as closeSync5,
33677
+ closeSync as closeSync6,
33527
33678
  existsSync as existsSync13,
33528
- openSync as openSync5,
33679
+ openSync as openSync6,
33529
33680
  readSync as readSync2,
33530
33681
  statSync as statSync5,
33531
33682
  unlinkSync as unlinkSync8
@@ -33547,7 +33698,7 @@ function parseStoredBody(text6) {
33547
33698
  }
33548
33699
  function readTailLine(path2, size = statSync5(path2).size, window2 = SCAN_CHUNK_BYTES) {
33549
33700
  if (size === 0) return void 0;
33550
- const fd2 = openSync5(path2, "r");
33701
+ const fd2 = openSync6(path2, "r");
33551
33702
  try {
33552
33703
  let end = size;
33553
33704
  let terminated = false;
@@ -33595,12 +33746,12 @@ function readTailLine(path2, size = statSync5(path2).size, window2 = SCAN_CHUNK_
33595
33746
  windowSize *= 2;
33596
33747
  }
33597
33748
  } finally {
33598
- closeSync5(fd2);
33749
+ closeSync6(fd2);
33599
33750
  }
33600
33751
  }
33601
33752
  function* readLinesBackward(path2, size = statSync5(path2).size, window2 = SCAN_CHUNK_BYTES) {
33602
33753
  if (size === 0) return;
33603
- const fd2 = openSync5(path2, "r");
33754
+ const fd2 = openSync6(path2, "r");
33604
33755
  try {
33605
33756
  let buffer = Buffer.alloc(0);
33606
33757
  let start = size;
@@ -33662,11 +33813,11 @@ function* readLinesBackward(path2, size = statSync5(path2).size, window2 = SCAN_
33662
33813
  end = offset;
33663
33814
  }
33664
33815
  } finally {
33665
- closeSync5(fd2);
33816
+ closeSync6(fd2);
33666
33817
  }
33667
33818
  }
33668
33819
  function* readLinesFrom(path2, from = 0, chunkBytes = SCAN_CHUNK_BYTES) {
33669
- const fd2 = openSync5(path2, "r");
33820
+ const fd2 = openSync6(path2, "r");
33670
33821
  try {
33671
33822
  const splitter = new LineSplitter(from);
33672
33823
  let position = from;
@@ -33680,7 +33831,7 @@ function* readLinesFrom(path2, from = 0, chunkBytes = SCAN_CHUNK_BYTES) {
33680
33831
  const rest = splitter.rest();
33681
33832
  if (rest !== void 0) yield rest;
33682
33833
  } finally {
33683
- closeSync5(fd2);
33834
+ closeSync6(fd2);
33684
33835
  }
33685
33836
  }
33686
33837
  async function* readLinesFromAsync(path2, from = 0, to = Number.POSITIVE_INFINITY) {
@@ -34218,11 +34369,11 @@ ${list2.join("\n")}
34218
34369
  // ../../packages/tacho/src/host/wal.ts
34219
34370
  import {
34220
34371
  appendFileSync as appendFileSync3,
34221
- closeSync as closeSync6,
34372
+ closeSync as closeSync7,
34222
34373
  fdatasyncSync,
34223
- fstatSync,
34374
+ fstatSync as fstatSync2,
34224
34375
  fsyncSync as fsyncSync4,
34225
- openSync as openSync6,
34376
+ openSync as openSync7,
34226
34377
  existsSync as existsSync15,
34227
34378
  readdirSync as readdirSync9,
34228
34379
  readSync as readSync3,
@@ -34308,7 +34459,7 @@ async function copyRange(path2, out, from, to, signal) {
34308
34459
  function readRangeSync(path2, from, to) {
34309
34460
  const buffer = Buffer.alloc(Math.max(0, to - from));
34310
34461
  if (buffer.length === 0) return buffer;
34311
- const fd2 = openSync6(path2, "r");
34462
+ const fd2 = openSync7(path2, "r");
34312
34463
  try {
34313
34464
  let filled = 0;
34314
34465
  while (filled < buffer.length) {
@@ -34324,7 +34475,7 @@ function readRangeSync(path2, from, to) {
34324
34475
  }
34325
34476
  return buffer.subarray(0, filled);
34326
34477
  } finally {
34327
- closeSync6(fd2);
34478
+ closeSync7(fd2);
34328
34479
  }
34329
34480
  }
34330
34481
  var BODY_READ_SLICE, BODY_DROP_SLICE_BYTES, BODY_DROP_SCANS, BODY_PURGE_SLICE_BYTES, BODY_PURGE_SCANS, BODY_PURGE_CATCH_UPS, NEWLINE, EVENT_TAIL_WINDOW, WalRecoveryConflict, Wal;
@@ -34496,7 +34647,7 @@ var init_wal = __esm({
34496
34647
  for (const path2 of paths) {
34497
34648
  let fd2;
34498
34649
  try {
34499
- fd2 = openSync6(path2, "r+");
34650
+ fd2 = openSync7(path2, "r+");
34500
34651
  fdatasyncSync(fd2);
34501
34652
  } catch (error2) {
34502
34653
  if (fd2 === void 0 && error2.code === "ENOENT")
@@ -34504,7 +34655,7 @@ var init_wal = __esm({
34504
34655
  this.dirtyPaths.add(path2);
34505
34656
  failure4 ??= error2;
34506
34657
  } finally {
34507
- if (fd2 !== void 0) closeSync6(fd2);
34658
+ if (fd2 !== void 0) closeSync7(fd2);
34508
34659
  }
34509
34660
  }
34510
34661
  if (failure4 !== void 0) throw failure4;
@@ -34928,7 +35079,7 @@ ${lines.join("\n")}
34928
35079
  */
34929
35080
  readBodiesAt(path2, idems, index) {
34930
35081
  const found = /* @__PURE__ */ new Map();
34931
- const fd2 = openSync6(path2, "r");
35082
+ const fd2 = openSync7(path2, "r");
34932
35083
  try {
34933
35084
  for (const idem of idems) {
34934
35085
  const at2 = index.entries.get(idem);
@@ -34956,7 +35107,7 @@ ${lines.join("\n")}
34956
35107
  });
34957
35108
  }
34958
35109
  } finally {
34959
- closeSync6(fd2);
35110
+ closeSync7(fd2);
34960
35111
  }
34961
35112
  return found;
34962
35113
  }
@@ -35247,7 +35398,7 @@ ${lines.join("\n")}
35247
35398
  blankSlice(path2, found, from, idems) {
35248
35399
  let fd2;
35249
35400
  try {
35250
- fd2 = openSync6(path2, "r+");
35401
+ fd2 = openSync7(path2, "r+");
35251
35402
  } catch (error2) {
35252
35403
  if (error2.code === "ENOENT") return void 0;
35253
35404
  throw error2;
@@ -35256,7 +35407,7 @@ ${lines.join("\n")}
35256
35407
  let moved = false;
35257
35408
  let next = from;
35258
35409
  try {
35259
- const size = fstatSync(fd2).size;
35410
+ const size = fstatSync2(fd2).size;
35260
35411
  let taken = 0;
35261
35412
  while (next < found.length && taken < BODY_DROP_SLICE_BYTES) {
35262
35413
  const at2 = found[next];
@@ -35271,7 +35422,7 @@ ${lines.join("\n")}
35271
35422
  }
35272
35423
  if (blanked > 0) fdatasyncSync(fd2);
35273
35424
  } finally {
35274
- closeSync6(fd2);
35425
+ closeSync7(fd2);
35275
35426
  }
35276
35427
  return { blanked, moved, next };
35277
35428
  }
@@ -36214,10 +36365,10 @@ ${lines.join("\n")}
36214
36365
  if (!scan.keptAny && tail.toString("utf8").trim().length === 0) {
36215
36366
  unlinkSync10(path2);
36216
36367
  } else {
36217
- const fd2 = openSync6(tmp, "r+");
36368
+ const fd2 = openSync7(tmp, "r+");
36218
36369
  try {
36219
36370
  let written2 = 0;
36220
- const at2 = fstatSync(fd2).size;
36371
+ const at2 = fstatSync2(fd2).size;
36221
36372
  while (written2 < tail.length)
36222
36373
  written2 += writeSync4(
36223
36374
  fd2,
@@ -36228,7 +36379,7 @@ ${lines.join("\n")}
36228
36379
  );
36229
36380
  fdatasyncSync(fd2);
36230
36381
  } finally {
36231
- closeSync6(fd2);
36382
+ closeSync7(fd2);
36232
36383
  }
36233
36384
  renameSync3(tmp, path2);
36234
36385
  }
@@ -36300,7 +36451,7 @@ ${lines.join("\n")}
36300
36451
  const path2 = this.bodyFileFor(sessionUuid2);
36301
36452
  if (!existsSync15(path2)) return 0;
36302
36453
  const tmp = `${path2}.${randomUUID()}.tmp`;
36303
- const fd2 = openSync6(tmp, "wx", 384);
36454
+ const fd2 = openSync7(tmp, "wx", 384);
36304
36455
  let cut = 0;
36305
36456
  let kept = 0;
36306
36457
  try {
@@ -36320,7 +36471,7 @@ ${lines.join("\n")}
36320
36471
  }
36321
36472
  if (cut > 0 && kept > 0) fsyncSync4(fd2);
36322
36473
  } finally {
36323
- closeSync6(fd2);
36474
+ closeSync7(fd2);
36324
36475
  }
36325
36476
  if (cut === 0) return 0;
36326
36477
  if (kept === 0) unlinkSync10(path2);
@@ -36455,7 +36606,7 @@ ${lines.join("\n")}
36455
36606
  });
36456
36607
 
36457
36608
  // ../../packages/tacho/src/cli/github.ts
36458
- import { existsSync as existsSync16, readFileSync as readFileSync12, realpathSync } from "node:fs";
36609
+ import { existsSync as existsSync16, readFileSync as readFileSync13, realpathSync } from "node:fs";
36459
36610
  import { resolve as resolve6 } from "node:path";
36460
36611
  function git(deps, cwd, args, allowMissing = false) {
36461
36612
  const out = deps.exec("git", ["-C", cwd, ...args]);
@@ -36657,7 +36808,7 @@ function daemonReason(body2) {
36657
36808
  return body2.trim().slice(0, 200) || "no reason given";
36658
36809
  }
36659
36810
  function readCredentialInput() {
36660
- return readFileSync12(0, "utf8");
36811
+ return readFileSync13(0, "utf8");
36661
36812
  }
36662
36813
  function checkoutGone(deps, cwd) {
36663
36814
  if (!existsSync16(cwd)) return true;
@@ -38852,7 +39003,7 @@ ${problems.map((problem2) => ` ${problem2}`).join("\n")}`
38852
39003
  deps.out(
38853
39004
  ` adding ${added.join(", ")} to ${existing.agent_key}: revoking ${existing.host_enrollment_id} and enrolling again for ${harnesses.join(", ")} so the control plane's host record follows (device key, port and local token kept)`
38854
39005
  );
38855
- const refused2 = [];
39006
+ const refused3 = [];
38856
39007
  const revoked = await revokeOnControlPlane(
38857
39008
  existing,
38858
39009
  {
@@ -38860,13 +39011,13 @@ ${problems.map((problem2) => ` ${problem2}`).join("\n")}`
38860
39011
  reason: `oxagen agent enroll --harness ${harnesses.join(",")}`
38861
39012
  },
38862
39013
  deps,
38863
- refused2
39014
+ refused3
38864
39015
  );
38865
39016
  if (!revoked) {
38866
39017
  deps.err(
38867
- `Cannot add ${added.join(", ")}: ${existing.host_enrollment_id} could not be revoked (${refused2.join("; ")}), so nothing was changed; this host still reports as ${existing.agent_key} for ${existing.harnesses.join(", ")}.`
39018
+ `Cannot add ${added.join(", ")}: ${existing.host_enrollment_id} could not be revoked (${refused3.join("; ")}), so nothing was changed; this host still reports as ${existing.agent_key} for ${existing.harnesses.join(", ")}.`
38868
39019
  );
38869
- return { ok: false, warnings: [...warnings, ...refused2] };
39020
+ return { ok: false, warnings: [...warnings, ...refused3] };
38870
39021
  }
38871
39022
  writeHostFile(deps.paths.hostFile, {
38872
39023
  ...existing,
@@ -40749,7 +40900,7 @@ var init_reassign = __esm({
40749
40900
  import {
40750
40901
  lstatSync as lstatSync6,
40751
40902
  readdirSync as readdirSync11,
40752
- readFileSync as readFileSync13,
40903
+ readFileSync as readFileSync14,
40753
40904
  readlinkSync as readlinkSync3,
40754
40905
  realpathSync as realpathSync2,
40755
40906
  rmdirSync as rmdirSync6,
@@ -40810,7 +40961,7 @@ function readDesktopRecord(path2) {
40810
40961
  };
40811
40962
  let parsed2;
40812
40963
  try {
40813
- parsed2 = JSON.parse(readFileSync13(path2, "utf8"));
40964
+ parsed2 = JSON.parse(readFileSync14(path2, "utf8"));
40814
40965
  } catch (error2) {
40815
40966
  if (error2.code === "ENOENT") return none;
40816
40967
  return {
@@ -40892,7 +41043,7 @@ function errorCode(error2) {
40892
41043
  function readText2(path2) {
40893
41044
  let bytes;
40894
41045
  try {
40895
- bytes = readFileSync13(path2);
41046
+ bytes = readFileSync14(path2);
40896
41047
  } catch (error2) {
40897
41048
  if (errorCode(error2) === "ENOENT") return void 0;
40898
41049
  throw error2;
@@ -43528,6 +43679,25 @@ import { chmodSync as chmodSync6 } from "node:fs";
43528
43679
  import {
43529
43680
  createServer as createServer2
43530
43681
  } from "node:http";
43682
+ import { join as join29 } from "node:path";
43683
+ function isClaudeSubagentId(value) {
43684
+ return typeof value === "string" && CLAUDE_SUBAGENT_ID.test(value);
43685
+ }
43686
+ function transcriptPathOf(options, sessionId) {
43687
+ if (options.harness !== "claude-code" || options.transcripts === void 0)
43688
+ return void 0;
43689
+ if (typeof sessionId !== "string" || !CLAUDE_SESSION_ID.test(sessionId))
43690
+ return void 0;
43691
+ return join29(options.transcripts.projectsDir, `${sessionId}.jsonl`);
43692
+ }
43693
+ function subagentTranscriptPathOf(sessionTranscript, hookEventName, agentId) {
43694
+ if (hookEventName !== "SubagentStop" || sessionTranscript === void 0)
43695
+ return void 0;
43696
+ if (typeof agentId !== "string" || !isClaudeSubagentId(agentId))
43697
+ return void 0;
43698
+ const dir = subagentDirOf(sessionTranscript);
43699
+ return dir === void 0 ? void 0 : join29(dir, `agent-${agentId}.jsonl`);
43700
+ }
43531
43701
  function send(response, status2, body2) {
43532
43702
  response.writeHead(status2, { "content-type": "application/json" });
43533
43703
  response.end(JSON.stringify(body2));
@@ -43602,13 +43772,26 @@ function containedBridgeHandler(options) {
43602
43772
  "Contained hook payload must be a JSON object"
43603
43773
  );
43604
43774
  const stella = options.harness === "stella";
43775
+ const sent = stella ? translateStellaPayload(input, 0) : input;
43605
43776
  const payload = {
43606
- ...stella ? translateStellaPayload(input, 0) : input,
43777
+ ...sent,
43607
43778
  session_id: options.sessionId,
43608
43779
  cwd: options.workspace
43609
43780
  };
43610
43781
  delete payload["transcript_path"];
43782
+ delete payload["agent_transcript_path"];
43611
43783
  delete payload["pid"];
43784
+ const transcript = transcriptPathOf(options, sent["session_id"]);
43785
+ if (transcript !== void 0) payload["transcript_path"] = transcript;
43786
+ if (options.harness === "claude-code" && payload["agent_id"] !== void 0 && !isClaudeSubagentId(payload["agent_id"]))
43787
+ delete payload["agent_id"];
43788
+ const subagentTranscript = subagentTranscriptPathOf(
43789
+ transcript,
43790
+ payload["hook_event_name"],
43791
+ payload["agent_id"]
43792
+ );
43793
+ if (subagentTranscript !== void 0)
43794
+ payload["agent_transcript_path"] = subagentTranscript;
43612
43795
  const event = typeof payload["hook_event_name"] === "string" ? payload["hook_event_name"] : "";
43613
43796
  const answer = (body2) => {
43614
43797
  if (!stella) {
@@ -43746,12 +43929,15 @@ async function startContainedBridge(options) {
43746
43929
  }
43747
43930
  };
43748
43931
  }
43749
- var GIT_HEADERS, ContainedRequestError, MAX_BODY_BYTES, CLAUDE_CODE_BETA_QUERY, ANTHROPIC_MODEL_PATHS, ANTHROPIC_PREFIX, ASK_IN_OXAGEN;
43932
+ var CLAUDE_SESSION_ID, CLAUDE_SUBAGENT_ID, GIT_HEADERS, ContainedRequestError, MAX_BODY_BYTES, CLAUDE_CODE_BETA_QUERY, ANTHROPIC_MODEL_PATHS, ANTHROPIC_PREFIX, ASK_IN_OXAGEN;
43750
43933
  var init_bridge = __esm({
43751
43934
  "../../packages/tacho/src/contained/bridge.ts"() {
43752
43935
  "use strict";
43753
43936
  init_stella_adapter();
43937
+ init_transcript_tailer();
43754
43938
  init_github2();
43939
+ CLAUDE_SESSION_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
43940
+ CLAUDE_SUBAGENT_ID = /^[A-Za-z0-9_-]{1,128}$/;
43755
43941
  GIT_HEADERS = [
43756
43942
  "content-type",
43757
43943
  "content-encoding",
@@ -43780,8 +43966,8 @@ var init_bridge = __esm({
43780
43966
  });
43781
43967
 
43782
43968
  // ../../packages/tacho/src/contained/workspace.ts
43783
- import { lstatSync as lstatSync7, readFileSync as readFileSync14, readdirSync as readdirSync12, realpathSync as realpathSync4 } from "node:fs";
43784
- import { isAbsolute as isAbsolute4, join as join29, relative as relative3, resolve as resolve9, sep as sep3 } from "node:path";
43969
+ import { lstatSync as lstatSync7, readFileSync as readFileSync15, readdirSync as readdirSync12, realpathSync as realpathSync4 } from "node:fs";
43970
+ import { isAbsolute as isAbsolute4, join as join30, relative as relative3, resolve as resolve9, sep as sep3 } from "node:path";
43785
43971
  function within(root, path2) {
43786
43972
  const rel = relative3(root, path2);
43787
43973
  return rel === "" || !isAbsolute4(rel) && rel !== ".." && !rel.startsWith(`..${sep3}`);
@@ -43789,7 +43975,7 @@ function within(root, path2) {
43789
43975
  function isEnvFile(entry2) {
43790
43976
  return /^\.env(?:\.|$)/.test(entry2) && !/^\.env\.(?:example|sample|template)$/.test(entry2);
43791
43977
  }
43792
- function validateContainedWorkspace(workspace, sessionDirectory, mountInfo = readFileSync14("/proc/self/mountinfo", "utf8")) {
43978
+ function validateContainedWorkspace(workspace, sessionDirectory, mountInfo = readFileSync15("/proc/self/mountinfo", "utf8")) {
43793
43979
  const root = realpathSync4(workspace);
43794
43980
  const session = realpathSync4(sessionDirectory);
43795
43981
  if (root === "/" || within(root, session) || within(session, root))
@@ -43811,7 +43997,7 @@ function validateContainedWorkspace(workspace, sessionDirectory, mountInfo = rea
43811
43997
  }
43812
43998
  const visit2 = (directory) => {
43813
43999
  for (const entry2 of readdirSync12(directory)) {
43814
- const path2 = join29(directory, entry2);
44000
+ const path2 = join30(directory, entry2);
43815
44001
  if (CREDENTIAL_PATHS.has(entry2) || isEnvFile(entry2))
43816
44002
  throw new Error(
43817
44003
  `Remove local credential files from the contained checkout before launch: ${named2(path2)}`
@@ -43845,7 +44031,7 @@ function validateContainedWorkspace(workspace, sessionDirectory, mountInfo = rea
43845
44031
  }
43846
44032
  function gitDirectoryMounts(workspace) {
43847
44033
  const root = realpathSync4(workspace);
43848
- const dotGit = join29(root, ".git");
44034
+ const dotGit = join30(root, ".git");
43849
44035
  let stat7;
43850
44036
  try {
43851
44037
  stat7 = lstatSync7(dotGit);
@@ -43864,7 +44050,7 @@ function gitDirectoryMounts(workspace) {
43864
44050
  throw new Error(
43865
44051
  "Contained repository's .git is neither a directory nor a file"
43866
44052
  );
43867
- const pointer = /^gitdir:\s*(.+?)\s*$/m.exec(readFileSync14(dotGit, "utf8"));
44053
+ const pointer = /^gitdir:\s*(.+?)\s*$/m.exec(readFileSync15(dotGit, "utf8"));
43868
44054
  if (pointer === null)
43869
44055
  throw new Error(
43870
44056
  "Contained repository's .git file names no git directory"
@@ -43883,7 +44069,7 @@ function gitDirectoryMounts(workspace) {
43883
44069
  if (gitDir !== void 0) {
43884
44070
  let common;
43885
44071
  try {
43886
- common = readFileSync14(join29(gitDir, "commondir"), "utf8").trim();
44072
+ common = readFileSync15(join30(gitDir, "commondir"), "utf8").trim();
43887
44073
  } catch {
43888
44074
  common = void 0;
43889
44075
  }
@@ -43909,8 +44095,8 @@ var init_workspace = __esm({
43909
44095
 
43910
44096
  // ../../packages/tacho/src/collector/hardened-git.ts
43911
44097
  import { execFile as execFile2 } from "node:child_process";
43912
- import { lstatSync as lstatSync8, readFileSync as readFileSync15, statSync as statSync8 } from "node:fs";
43913
- import { dirname as dirname20, join as join30, resolve as resolve10 } from "node:path";
44098
+ import { lstatSync as lstatSync8, readFileSync as readFileSync16, statSync as statSync8 } from "node:fs";
44099
+ import { dirname as dirname20, join as join31, resolve as resolve10 } from "node:path";
43914
44100
  function hardenedGitArgs(cwd, args, globals = []) {
43915
44101
  const subcommand = args[0];
43916
44102
  const end = args.indexOf("--");
@@ -43949,7 +44135,7 @@ function gitIdentity(repository, deps = DEFAULT_IDENTITY_DEPS) {
43949
44135
  };
43950
44136
  }
43951
44137
  for (let at2 = directory; ; at2 = dirname20(at2)) {
43952
- const marker = join30(at2, ".git");
44138
+ const marker = join31(at2, ".git");
43953
44139
  const link = tryStat(deps.lstat, marker);
43954
44140
  if (link !== void 0) {
43955
44141
  owners.push(link);
@@ -43957,7 +44143,7 @@ function gitIdentity(repository, deps = DEFAULT_IDENTITY_DEPS) {
43957
44143
  if (target !== void 0) {
43958
44144
  owners.push(target);
43959
44145
  if (target.isDirectory()) {
43960
- const config2 = tryStat(deps.stat, join30(marker, "config"));
44146
+ const config2 = tryStat(deps.stat, join31(marker, "config"));
43961
44147
  if (config2 !== void 0) owners.push(config2);
43962
44148
  }
43963
44149
  }
@@ -44013,13 +44199,13 @@ function createGitExecAsync(run3 = runExecFile, deps = DEFAULT_IDENTITY_DEPS, en
44013
44199
  const repository = options?.repository ?? (command2 === "git" && args[0] === "-C" ? args[1] : void 0);
44014
44200
  if (repository === void 0) {
44015
44201
  if (command2 === "git" && deps.getuid() === 0)
44016
- return refused(
44202
+ return refused2(
44017
44203
  "git did not run: root names no repository to run it as"
44018
44204
  );
44019
44205
  return run3(command2, args, inherited);
44020
44206
  }
44021
44207
  const identity = gitIdentity(repository, deps);
44022
- if (identity.kind === "refuse") return refused(identity.reason);
44208
+ if (identity.kind === "refuse") return refused2(identity.reason);
44023
44209
  if (identity.kind === "self") return run3(command2, args, inherited);
44024
44210
  const env = {};
44025
44211
  for (const name2 of KEPT_VARIABLES) {
@@ -44035,7 +44221,7 @@ function createGitExecAsync(run3 = runExecFile, deps = DEFAULT_IDENTITY_DEPS, en
44035
44221
  });
44036
44222
  };
44037
44223
  }
44038
- function refused(reason3) {
44224
+ function refused2(reason3) {
44039
44225
  return { status: 1, stdout: "", stderr: reason3 };
44040
44226
  }
44041
44227
  function definedOnly(environment) {
@@ -44097,7 +44283,7 @@ var init_hardened_git = __esm({
44097
44283
  lstat: (path2) => lstatSync8(path2),
44098
44284
  passwd: () => {
44099
44285
  try {
44100
- return readFileSync15("/etc/passwd", "utf8");
44286
+ return readFileSync16("/etc/passwd", "utf8");
44101
44287
  } catch {
44102
44288
  return void 0;
44103
44289
  }
@@ -44109,7 +44295,7 @@ var init_hardened_git = __esm({
44109
44295
 
44110
44296
  // ../../packages/tacho/src/contained/profile.ts
44111
44297
  import { createHash as createHash9 } from "node:crypto";
44112
- import { isAbsolute as isAbsolute5, join as join31, relative as relative4, sep as sep4 } from "node:path";
44298
+ import { isAbsolute as isAbsolute5, join as join32, relative as relative4, sep as sep4 } from "node:path";
44113
44299
  function containerPath(workspace, path2) {
44114
44300
  const inside2 = relative4(workspace, path2);
44115
44301
  if (inside2 === "" || isAbsolute5(inside2) || inside2 === ".." || inside2.startsWith(`..${sep4}`))
@@ -44119,7 +44305,7 @@ function containerPath(workspace, path2) {
44119
44305
  return `/workspace/${inside2.split(sep4).join("/")}`;
44120
44306
  }
44121
44307
  function gitMountPairs(spec) {
44122
- if (!spec.gitMounts.includes(join31(spec.workspace, ".git")))
44308
+ if (!spec.gitMounts.includes(join32(spec.workspace, ".git")))
44123
44309
  throw new Error(
44124
44310
  "Contained execution must mount the repository's .git read-only"
44125
44311
  );
@@ -44286,7 +44472,7 @@ import {
44286
44472
  writeFileSync as writeFileSync2
44287
44473
  } from "node:fs";
44288
44474
  import { tmpdir } from "node:os";
44289
- import { isAbsolute as isAbsolute6, join as join32 } from "node:path";
44475
+ import { isAbsolute as isAbsolute6, join as join33 } from "node:path";
44290
44476
  import { promisify } from "node:util";
44291
44477
  function reason(error2) {
44292
44478
  return error2 instanceof Error ? error2.message : String(error2);
@@ -44325,7 +44511,7 @@ async function launchContainedAgent(options) {
44325
44511
  if (digest6 === void 0)
44326
44512
  throw new Error("The operator's contained image is not installed");
44327
44513
  const sessionId = `contained-${randomBytes8(16).toString("hex")}`;
44328
- const directory = mkdtempSync(join32(tmpdir(), "oxagen-contained-"));
44514
+ const directory = mkdtempSync(join33(tmpdir(), "oxagen-contained-"));
44329
44515
  chmodSync7(directory, 448);
44330
44516
  let prepared;
44331
44517
  let containerCreated = false;
@@ -44346,7 +44532,7 @@ async function launchContainedAgent(options) {
44346
44532
  for (const [name3, contents] of entries2) {
44347
44533
  if (!/^[a-z0-9.-]+$/.test(name3))
44348
44534
  throw new Error("Invalid contained configuration filename");
44349
- writeFileSync2(join32(directory, name3), contents, {
44535
+ writeFileSync2(join33(directory, name3), contents, {
44350
44536
  mode: 256,
44351
44537
  flag: "wx"
44352
44538
  });
@@ -44763,7 +44949,7 @@ var init_privilege = __esm({
44763
44949
 
44764
44950
  // ../../packages/tacho/src/contained/sandbox/launcher.ts
44765
44951
  import { randomBytes as randomBytes9 } from "node:crypto";
44766
- import { dirname as dirname22, join as join33 } from "node:path";
44952
+ import { dirname as dirname22, join as join34 } from "node:path";
44767
44953
  function harnessVersionOf(stdout) {
44768
44954
  const words3 = stdout.trim().split(/\s+/).filter((word2) => word2.length > 0);
44769
44955
  const version3 = words3.find((word2) => /^v?\d+(?:\.\d+)+/.test(word2));
@@ -44917,7 +45103,7 @@ async function launchSandboxAgent(options) {
44917
45103
  for (const [name2, contents] of Object.entries(
44918
45104
  start.userState(options.gatewayPort, checkouts.target.path)
44919
45105
  )) {
44920
- const path2 = join33(SANDBOX_AGENT_HOME, name2);
45106
+ const path2 = join34(SANDBOX_AGENT_HOME, name2);
44921
45107
  if (dirname22(path2) !== SANDBOX_AGENT_HOME)
44922
45108
  system.mkdir(dirname22(path2), 448, AGENT_OWNER);
44923
45109
  system.writeFile(path2, contents, 384, AGENT_OWNER);
@@ -45049,6 +45235,85 @@ var init_launcher2 = __esm({
45049
45235
  }
45050
45236
  });
45051
45237
 
45238
+ // ../../packages/tacho/src/collector/memory-capture/memory-text.ts
45239
+ function clip2(text6, max2) {
45240
+ if (text6.length <= max2) return text6;
45241
+ let end = max2;
45242
+ const last = text6.charCodeAt(end - 1);
45243
+ if (last >= 55296 && last <= 56319) end -= 1;
45244
+ return text6.slice(0, end).trimEnd();
45245
+ }
45246
+ function frontmatterScalar(raw) {
45247
+ const value = raw.trim();
45248
+ if (/^[|>][+-]?$/.test(value)) return void 0;
45249
+ if (value.length >= 2 && value.startsWith('"') && value.endsWith('"'))
45250
+ return value.slice(1, -1).replace(/\\"/g, '"');
45251
+ if (value.length >= 2 && value.startsWith("'") && value.endsWith("'"))
45252
+ return value.slice(1, -1).replace(/''/g, "'");
45253
+ return value;
45254
+ }
45255
+ function frontmatterOf(block) {
45256
+ const fields = {};
45257
+ let inMetadata = false;
45258
+ for (const line of block.split(/\r?\n/)) {
45259
+ const match = FRONTMATTER_LINE.exec(line);
45260
+ if (match === null) continue;
45261
+ const [, indent = "", key = "", raw = ""] = match;
45262
+ if (indent === "") {
45263
+ inMetadata = key === "metadata" && raw.trim() === "";
45264
+ if (key === "name" || key === "description" || key === "type") {
45265
+ const value = frontmatterScalar(raw);
45266
+ if (value !== void 0) fields[key] = value;
45267
+ }
45268
+ continue;
45269
+ }
45270
+ if (inMetadata && key === "type") {
45271
+ const value = frontmatterScalar(raw);
45272
+ if (value !== void 0) fields.metadataType = value;
45273
+ }
45274
+ }
45275
+ return fields;
45276
+ }
45277
+ function textField(value, max2) {
45278
+ if (value === void 0) return void 0;
45279
+ const text6 = clip2(value.trim(), max2);
45280
+ return text6.length > 0 ? text6 : void 0;
45281
+ }
45282
+ function typeField(fields) {
45283
+ const value = (fields.metadataType ?? fields.type)?.trim().toLowerCase();
45284
+ return value !== void 0 && MEMORY_TYPE_PATTERN.test(value) ? value : void 0;
45285
+ }
45286
+ function memoryTextOf(text6) {
45287
+ const unmarked = text6.replace(/^\uFEFF/, "");
45288
+ const match = FRONTMATTER.exec(unmarked);
45289
+ const body2 = match === null ? unmarked : unmarked.slice(match[0].length);
45290
+ const fields = match === null ? {} : frontmatterOf(match[1] ?? "");
45291
+ const label = textField(fields.name, MEMORY_LABEL_MAX_CHARS);
45292
+ const summary = textField(fields.description, MEMORY_SUMMARY_MAX_CHARS);
45293
+ const memoryType = typeField(fields);
45294
+ return {
45295
+ statement: clip2(body2.trim(), MEMORY_STATEMENT_MAX_CHARS),
45296
+ ...label !== void 0 ? { label } : {},
45297
+ ...summary !== void 0 ? { summary } : {},
45298
+ ...memoryType !== void 0 ? { memoryType } : {}
45299
+ };
45300
+ }
45301
+ function claudeCodeProjectName(dir) {
45302
+ return dir.replace(/[^a-zA-Z0-9]/g, "-");
45303
+ }
45304
+ var MEMORY_STATEMENT_MAX_CHARS, MEMORY_LABEL_MAX_CHARS, MEMORY_SUMMARY_MAX_CHARS, MEMORY_TYPE_PATTERN, FRONTMATTER, FRONTMATTER_LINE;
45305
+ var init_memory_text = __esm({
45306
+ "../../packages/tacho/src/collector/memory-capture/memory-text.ts"() {
45307
+ "use strict";
45308
+ MEMORY_STATEMENT_MAX_CHARS = 2e3;
45309
+ MEMORY_LABEL_MAX_CHARS = 200;
45310
+ MEMORY_SUMMARY_MAX_CHARS = 1e3;
45311
+ MEMORY_TYPE_PATTERN = /^[a-z][a-z0-9_-]{0,31}$/;
45312
+ FRONTMATTER = /^---[ \t]*\r?\n(?:([\s\S]*?)\r?\n)?---[ \t]*(?:\r?\n|$)/;
45313
+ FRONTMATTER_LINE = /^([ \t]*)([A-Za-z_][\w-]*)[ \t]*:[ \t]*(.*)$/;
45314
+ }
45315
+ });
45316
+
45052
45317
  // ../../packages/tacho/src/contained/sandbox/system.ts
45053
45318
  var system_exports = {};
45054
45319
  __export(system_exports, {
@@ -45058,16 +45323,16 @@ __export(system_exports, {
45058
45323
  });
45059
45324
  import { execFile as execFile4, spawn as spawn5 } from "node:child_process";
45060
45325
  import {
45061
- closeSync as closeSync7,
45062
- constants as constants3,
45326
+ closeSync as closeSync8,
45327
+ constants as constants4,
45063
45328
  existsSync as existsSync20,
45064
45329
  fchmodSync,
45065
45330
  fchownSync,
45066
45331
  lchownSync,
45067
45332
  lstatSync as lstatSync9,
45068
45333
  mkdirSync as mkdirSync5,
45069
- openSync as openSync7,
45070
- readFileSync as readFileSync16,
45334
+ openSync as openSync8,
45335
+ readFileSync as readFileSync17,
45071
45336
  rmSync as rmSync7,
45072
45337
  statSync as statSync9,
45073
45338
  unlinkSync as unlinkSync12,
@@ -45119,12 +45384,12 @@ function writeFileNoFollow(path2, contents, mode, owner) {
45119
45384
  if (parent !== void 0) assertDirectoriesOnly(parent, path2);
45120
45385
  const found = entryAt(path2);
45121
45386
  if (found !== void 0) removeEntry(path2, found);
45122
- const fd2 = openSync7(path2, "wx", mode);
45387
+ const fd2 = openSync8(path2, "wx", mode);
45123
45388
  try {
45124
45389
  writeFileSync3(fd2, contents);
45125
45390
  settle(fd2, mode, owner);
45126
45391
  } finally {
45127
- closeSync7(fd2);
45392
+ closeSync8(fd2);
45128
45393
  }
45129
45394
  }
45130
45395
  function mkdirNoFollow(path2, mode, owner) {
@@ -45139,14 +45404,14 @@ function mkdirNoFollow(path2, mode, owner) {
45139
45404
  if (found !== void 0) removeEntry(directory, found);
45140
45405
  mkdirSync5(directory, { mode });
45141
45406
  }
45142
- const fd2 = openSync7(
45407
+ const fd2 = openSync8(
45143
45408
  target,
45144
- constants3.O_RDONLY | constants3.O_DIRECTORY | constants3.O_NOFOLLOW
45409
+ constants4.O_RDONLY | constants4.O_DIRECTORY | constants4.O_NOFOLLOW
45145
45410
  );
45146
45411
  try {
45147
45412
  settle(fd2, mode, owner);
45148
45413
  } finally {
45149
- closeSync7(fd2);
45414
+ closeSync8(fd2);
45150
45415
  }
45151
45416
  }
45152
45417
  var run, nodeSandboxSystem;
@@ -45205,7 +45470,7 @@ var init_system = __esm({
45205
45470
  return void 0;
45206
45471
  }
45207
45472
  },
45208
- readFile: (path2) => readFileSync16(path2),
45473
+ readFile: (path2) => readFileSync17(path2),
45209
45474
  writeFile: writeFileNoFollow,
45210
45475
  mkdir: mkdirNoFollow,
45211
45476
  chown: (path2, uid, gid) => lchownSync(path2, uid, gid)
@@ -45214,10 +45479,20 @@ var init_system = __esm({
45214
45479
  });
45215
45480
 
45216
45481
  // ../../packages/tacho/src/contained/runner.ts
45217
- import { join as join34 } from "node:path";
45482
+ import { join as join35 } from "node:path";
45483
+ function sandboxClaudeProjectsDir(workspace) {
45484
+ return {
45485
+ projectsDir: join35(
45486
+ SANDBOX_AGENT_HOME,
45487
+ ".claude",
45488
+ "projects",
45489
+ claudeCodeProjectName(workspace)
45490
+ )
45491
+ };
45492
+ }
45218
45493
  function containedHookEnv(harness, workspace) {
45219
- const home = join34(workspace, ".oxagen-contained", "home");
45220
- return harness === "codex" ? { CODEX_HOME: join34(home, ".codex") } : { CLAUDE_CONFIG_DIR: join34(home, ".claude") };
45494
+ const home = join35(workspace, ".oxagen-contained", "home");
45495
+ return harness === "codex" ? { CODEX_HOME: join35(home, ".codex") } : { CLAUDE_CONFIG_DIR: join35(home, ".claude") };
45221
45496
  }
45222
45497
  function containedLaunchEndpoint(host) {
45223
45498
  const ingest = new URL(host.endpoints.ingest);
@@ -45363,6 +45638,7 @@ function createContainedRunner(options) {
45363
45638
  opening: route.opening,
45364
45639
  env: route.env,
45365
45640
  log: options.log,
45641
+ ...route.transcripts === void 0 ? {} : { transcripts: route.transcripts },
45366
45642
  mcp: (body2) => gateway.handle(body2, {
45367
45643
  sessionId: route.sessionId,
45368
45644
  enrollmentId: options.host().host_enrollment_id,
@@ -45467,7 +45743,7 @@ function createContainedRunner(options) {
45467
45743
  sessionUuid2 = started.recorder.sessionUuid;
45468
45744
  active2.set(sessionUuid2, controller);
45469
45745
  const bridge = await startContainedBridge({
45470
- socketPath: join34(directory, "bridge.sock"),
45746
+ socketPath: join35(directory, "bridge.sock"),
45471
45747
  ...bridgeRoutes({
45472
45748
  sessionId,
45473
45749
  workspace,
@@ -45551,7 +45827,7 @@ function createContainedRunner(options) {
45551
45827
  const abort = () => controller.abort();
45552
45828
  signal?.addEventListener("abort", abort, { once: true });
45553
45829
  if (signal?.aborted) abort();
45554
- const env = input.harness === "codex" ? { CODEX_HOME: CODEX_SANDBOX_HOME } : input.harness === "stella" ? { STELLA_HOME: STELLA_SANDBOX_HOME } : { CLAUDE_CONFIG_DIR: join34(SANDBOX_AGENT_HOME, ".claude") };
45830
+ const env = input.harness === "codex" ? { CODEX_HOME: CODEX_SANDBOX_HOME } : input.harness === "stella" ? { STELLA_HOME: STELLA_SANDBOX_HOME } : { CLAUDE_CONFIG_DIR: join35(SANDBOX_AGENT_HOME, ".claude") };
45555
45831
  let sessionUuid2;
45556
45832
  let launchedSessionId;
45557
45833
  let opened = false;
@@ -45641,7 +45917,14 @@ function createContainedRunner(options) {
45641
45917
  })
45642
45918
  )
45643
45919
  },
45644
- ...input.gitlab !== void 0 ? { gitlabHost: input.gitlab.host } : {}
45920
+ ...input.gitlab !== void 0 ? { gitlabHost: input.gitlab.host } : {},
45921
+ // Claude Code runs as the agent user and writes its
45922
+ // transcript, and each subagent's, under its own config
45923
+ // folder. Naming that folder lets the daemon tail them, and
45924
+ // open a chain for each subagent the run starts.
45925
+ ...input.harness === "claude-code" ? {
45926
+ transcripts: sandboxClaudeProjectsDir(context.workspace)
45927
+ } : {}
45645
45928
  }),
45646
45929
  options.sandboxGatewayPort
45647
45930
  );
@@ -45700,6 +45983,7 @@ var init_runner = __esm({
45700
45983
  init_launcher2();
45701
45984
  init_stella();
45702
45985
  init_profile();
45986
+ init_memory_text();
45703
45987
  init_request();
45704
45988
  init_system();
45705
45989
  LAUNCH_FAILED_REASON = "contained_launch_failed";
@@ -46225,13 +46509,13 @@ var init_credential_pool = __esm({
46225
46509
  });
46226
46510
 
46227
46511
  // ../../packages/tacho/src/host/repositories.ts
46228
- import { existsSync as existsSync21, readFileSync as readFileSync17, statSync as statSync10 } from "node:fs";
46229
- import { dirname as dirname23, join as join35, resolve as resolve11, sep as sep5 } from "node:path";
46512
+ import { existsSync as existsSync21, readFileSync as readFileSync18, statSync as statSync10 } from "node:fs";
46513
+ import { dirname as dirname23, join as join36, resolve as resolve11, sep as sep5 } from "node:path";
46230
46514
  function repositoriesFile(home) {
46231
- return join35(home.tachoDir, "repositories.json");
46515
+ return join36(home.tachoDir, "repositories.json");
46232
46516
  }
46233
46517
  function workTreesDir(home) {
46234
- return join35(home.tachoDir, "work");
46518
+ return join36(home.tachoDir, "work");
46235
46519
  }
46236
46520
  function readIndex(home) {
46237
46521
  let raw;
@@ -46283,23 +46567,23 @@ function recordCheckout(home, canonical3, root, seenAt) {
46283
46567
  return true;
46284
46568
  }
46285
46569
  function mainCheckoutOf(root) {
46286
- const dotGit = join35(root, ".git");
46570
+ const dotGit = join36(root, ".git");
46287
46571
  try {
46288
46572
  if (!statSync10(dotGit).isFile()) return root;
46289
- const line = readFileSync17(dotGit, "utf8").trim();
46573
+ const line = readFileSync18(dotGit, "utf8").trim();
46290
46574
  const match = /^gitdir:\s*(.+)$/m.exec(line);
46291
46575
  if (match === null) return root;
46292
46576
  const gitdir = resolve11(root, match[1].trim());
46293
46577
  const worktrees = dirname23(gitdir);
46294
46578
  if (!worktrees.endsWith(`${sep5}.git${sep5}worktrees`)) return root;
46295
46579
  const clone5 = dirname23(dirname23(worktrees));
46296
- return existsSync21(join35(clone5, ".git")) ? clone5 : root;
46580
+ return existsSync21(join36(clone5, ".git")) ? clone5 : root;
46297
46581
  } catch {
46298
46582
  return root;
46299
46583
  }
46300
46584
  }
46301
46585
  function defaultIsCheckout(root) {
46302
- return existsSync21(join35(root, ".git"));
46586
+ return existsSync21(join36(root, ".git"));
46303
46587
  }
46304
46588
  function findCheckout(home, repository, host, deps = {}) {
46305
46589
  const isCheckout = deps.isCheckout ?? defaultIsCheckout;
@@ -46343,11 +46627,11 @@ var init_repositories = __esm({
46343
46627
 
46344
46628
  // ../../packages/tacho/src/host/reauth-requests.ts
46345
46629
  import { readdirSync as readdirSync13, rmSync as rmSync8 } from "node:fs";
46346
- import { join as join36 } from "node:path";
46630
+ import { join as join37 } from "node:path";
46347
46631
  function requestFile(paths, id2) {
46348
46632
  if (!REAUTH_REQUEST_ID_PATTERN.test(id2))
46349
46633
  throw new Error(`${JSON.stringify(id2)} is not a sign-in request id`);
46350
- return join36(paths.reauthRequests, `${id2}.json`);
46634
+ return join37(paths.reauthRequests, `${id2}.json`);
46351
46635
  }
46352
46636
  function readKept2(path2) {
46353
46637
  try {
@@ -46417,8 +46701,8 @@ var init_reauth_requests = __esm({
46417
46701
  });
46418
46702
 
46419
46703
  // ../../packages/tacho/src/collector/detector.ts
46420
- import { promises as fs3 } from "node:fs";
46421
- import { basename as basename6, join as join37 } from "node:path";
46704
+ import { promises as fs2 } from "node:fs";
46705
+ import { basename as basename6, join as join38 } from "node:path";
46422
46706
  async function eachLimited(items, limit, task) {
46423
46707
  let next = 0;
46424
46708
  const workers = Array.from(
@@ -46436,7 +46720,7 @@ async function eachLimited(items, limit, task) {
46436
46720
  async function scanProject(dir) {
46437
46721
  let names2;
46438
46722
  try {
46439
- names2 = await fs3.readdir(dir);
46723
+ names2 = await fs2.readdir(dir);
46440
46724
  } catch {
46441
46725
  return [];
46442
46726
  }
@@ -46444,9 +46728,9 @@ async function scanProject(dir) {
46444
46728
  await eachLimited(names2, SCAN_CONCURRENCY, async (name2) => {
46445
46729
  const match = SESSION_FILE.exec(name2);
46446
46730
  if (match === null) return;
46447
- const path2 = join37(dir, name2);
46731
+ const path2 = join38(dir, name2);
46448
46732
  try {
46449
- const st = await fs3.stat(path2);
46733
+ const st = await fs2.stat(path2);
46450
46734
  out.push({ sessionId: match[1], path: path2, mtimeMs: st.mtimeMs });
46451
46735
  } catch {
46452
46736
  }
@@ -46480,14 +46764,14 @@ var init_detector = __esm({
46480
46764
  for (const root of this.roots) {
46481
46765
  let names2;
46482
46766
  try {
46483
- names2 = await fs3.readdir(root);
46767
+ names2 = await fs2.readdir(root);
46484
46768
  } catch {
46485
46769
  continue;
46486
46770
  }
46487
46771
  await eachLimited(names2, SCAN_CONCURRENCY, async (name2) => {
46488
- const dir = join37(root, name2);
46772
+ const dir = join38(root, name2);
46489
46773
  try {
46490
- const st = await fs3.stat(dir);
46774
+ const st = await fs2.stat(dir);
46491
46775
  if (st.isDirectory()) dirs.push({ dir, mtimeMs: st.mtimeMs });
46492
46776
  } catch {
46493
46777
  }
@@ -46535,7 +46819,7 @@ var init_detector = __esm({
46535
46819
  await eachLimited([...out], SCAN_CONCURRENCY, async (entry2) => {
46536
46820
  if (!watched.has(entry2.path)) return;
46537
46821
  try {
46538
- entry2.mtimeMs = (await fs3.stat(entry2.path)).mtimeMs;
46822
+ entry2.mtimeMs = (await fs2.stat(entry2.path)).mtimeMs;
46539
46823
  } catch {
46540
46824
  }
46541
46825
  });
@@ -46725,7 +47009,7 @@ var init_detector = __esm({
46725
47009
  transcript_path: transcript.path,
46726
47010
  transcript_mtime: new Date(transcript.mtimeMs).toISOString(),
46727
47011
  claude_pids: processes.map((p) => p.pid),
46728
- project: basename6(join37(transcript.path, ".."))
47012
+ project: basename6(join38(transcript.path, ".."))
46729
47013
  }
46730
47014
  })
46731
47015
  );
@@ -47134,9 +47418,9 @@ var init_git_facts = __esm({
47134
47418
  });
47135
47419
 
47136
47420
  // ../../packages/tacho/src/host/workspace-connection.ts
47137
- import { join as join38 } from "node:path";
47421
+ import { join as join39 } from "node:path";
47138
47422
  function workspaceConnectionFile(home) {
47139
- return join38(home.tachoDir, "connection.json");
47423
+ return join39(home.tachoDir, "connection.json");
47140
47424
  }
47141
47425
  function readWorkspaceConnection(home) {
47142
47426
  const path2 = workspaceConnectionFile(home);
@@ -47362,15 +47646,15 @@ var init_work_order_start = __esm({
47362
47646
 
47363
47647
  // ../../packages/tacho/src/collector/work-order-autostart.ts
47364
47648
  import { spawn as spawn6 } from "node:child_process";
47365
- import { closeSync as closeSync8, existsSync as existsSync22, openSync as openSync8, readSync as readSync4, statSync as statSync11 } from "node:fs";
47366
- import { dirname as dirname24, join as join39 } from "node:path";
47649
+ import { closeSync as closeSync9, existsSync as existsSync22, openSync as openSync9, readSync as readSync4, statSync as statSync11 } from "node:fs";
47650
+ import { dirname as dirname24, join as join40 } from "node:path";
47367
47651
  function lastLogLine(path2) {
47368
47652
  let fd2;
47369
47653
  try {
47370
47654
  const size = statSync11(path2).size;
47371
47655
  const length = Math.min(size, 4096);
47372
47656
  const buffer = Buffer.alloc(length);
47373
- fd2 = openSync8(path2, "r");
47657
+ fd2 = openSync9(path2, "r");
47374
47658
  readSync4(fd2, buffer, 0, length, size - length);
47375
47659
  const line = buffer.toString("utf8").replace(TERMINAL_CODE, "").split(/\r?\n/).map((text6) => text6.trim()).filter((text6) => text6.length > 0).pop();
47376
47660
  if (line === void 0) return void 0;
@@ -47380,7 +47664,7 @@ function lastLogLine(path2) {
47380
47664
  } finally {
47381
47665
  if (fd2 !== void 0) {
47382
47666
  try {
47383
- closeSync8(fd2);
47667
+ closeSync9(fd2);
47384
47668
  } catch {
47385
47669
  }
47386
47670
  }
@@ -47462,7 +47746,7 @@ function createWorkOrderAutostart(deps) {
47462
47746
  }
47463
47747
  async function abandon(id2) {
47464
47748
  forget(id2);
47465
- const worktree = join39(workTreesDir(paths), id2);
47749
+ const worktree = join40(workTreesDir(paths), id2);
47466
47750
  if (!existsSync22(worktree)) return;
47467
47751
  const [common, branch, head3] = await Promise.all([
47468
47752
  git5(worktree, [
@@ -47504,7 +47788,7 @@ function createWorkOrderAutostart(deps) {
47504
47788
  return waitMs;
47505
47789
  }
47506
47790
  async function prepareWorktree(root, id2, itemNumber, continued) {
47507
- const worktree = join39(workTreesDir(paths), id2);
47791
+ const worktree = join40(workTreesDir(paths), id2);
47508
47792
  const logPath = `${worktree}.log`;
47509
47793
  if (existsSync22(worktree)) {
47510
47794
  const [branch2, head3] = await Promise.all([
@@ -47679,9 +47963,9 @@ function createWorkOrderAutostart(deps) {
47679
47963
  if (running !== void 0) return;
47680
47964
  const wait2 = retry.get(id2);
47681
47965
  if (wait2 !== void 0 && deps.now() < wait2.at) return;
47682
- let refused2;
47966
+ let refused3;
47683
47967
  try {
47684
- refused2 = workOrderConnectionRefusal(
47968
+ refused3 = workOrderConnectionRefusal(
47685
47969
  readWorkspaceConnection(paths),
47686
47970
  deps.host(),
47687
47971
  order.connection_generation ?? 0
@@ -47693,8 +47977,8 @@ function createWorkOrderAutostart(deps) {
47693
47977
  );
47694
47978
  return;
47695
47979
  }
47696
- if (refused2 !== void 0) {
47697
- await endSend(id2, refused2);
47980
+ if (refused3 !== void 0) {
47981
+ await endSend(id2, refused3);
47698
47982
  return;
47699
47983
  }
47700
47984
  const outcome = await claimForStart(deps.client, deps.host(), id2);
@@ -47888,7 +48172,7 @@ var init_work_order_autostart = __esm({
47888
48172
  let fd2;
47889
48173
  try {
47890
48174
  ensureDir(dirname24(options.logPath));
47891
- fd2 = openSync8(options.logPath, "a", 384);
48175
+ fd2 = openSync9(options.logPath, "a", 384);
47892
48176
  } catch (error2) {
47893
48177
  resolve29({ ok: false, error: asError(error2) });
47894
48178
  return;
@@ -47898,7 +48182,7 @@ var init_work_order_autostart = __esm({
47898
48182
  if (!open7) return;
47899
48183
  open7 = false;
47900
48184
  try {
47901
- closeSync8(fd2);
48185
+ closeSync9(fd2);
47902
48186
  } catch {
47903
48187
  }
47904
48188
  };
@@ -47991,7 +48275,7 @@ import {
47991
48275
  rm,
47992
48276
  unlink
47993
48277
  } from "node:fs/promises";
47994
- import { dirname as dirname25, join as join40 } from "node:path";
48278
+ import { dirname as dirname25, join as join41 } from "node:path";
47995
48279
  function byPath(a, b3) {
47996
48280
  return a.path < b3.path ? -1 : a.path > b3.path ? 1 : 0;
47997
48281
  }
@@ -48034,7 +48318,7 @@ async function contentHash(absolutePath, kind, keep) {
48034
48318
  if (keep !== void 0) {
48035
48319
  try {
48036
48320
  await mkdir(keep.dir, { recursive: true, mode: 448 });
48037
- const temp2 = join40(keep.dir, `.partial-${randomUUID2()}`);
48321
+ const temp2 = join41(keep.dir, `.partial-${randomUUID2()}`);
48038
48322
  copy = {
48039
48323
  temp: temp2,
48040
48324
  handle: await open4(temp2, "wx", keep.executable ? 448 : 384)
@@ -48078,7 +48362,7 @@ async function settleCopy(temp, name2) {
48078
48362
  if (temp === void 0) return;
48079
48363
  if (name2 !== void 0)
48080
48364
  try {
48081
- await rename(temp, join40(dirname25(temp), name2));
48365
+ await rename(temp, join41(dirname25(temp), name2));
48082
48366
  return;
48083
48367
  } catch {
48084
48368
  }
@@ -48094,7 +48378,7 @@ async function copiedBytes(dir) {
48094
48378
  let total2 = 0;
48095
48379
  for (const name2 of names2) {
48096
48380
  try {
48097
- total2 += (await lstat(join40(dir, name2))).size;
48381
+ total2 += (await lstat(join41(dir, name2))).size;
48098
48382
  } catch {
48099
48383
  }
48100
48384
  }
@@ -48110,7 +48394,7 @@ async function removeCopiesOutside(root, live) {
48110
48394
  const keep = new Set(live());
48111
48395
  await Promise.all(
48112
48396
  names2.filter((name2) => !keep.has(name2)).map(
48113
- (name2) => rm(join40(root, name2), { recursive: true, force: true }).catch(
48397
+ (name2) => rm(join41(root, name2), { recursive: true, force: true }).catch(
48114
48398
  () => void 0
48115
48399
  )
48116
48400
  )
@@ -48217,7 +48501,7 @@ async function contributionOf(exec4, cwd, root, repoRelative, entry2, copies) {
48217
48501
  let copy = null;
48218
48502
  if (entry2 !== null) {
48219
48503
  if (copies === void 0 || !COPY_NAME.test(entry2[0])) return void 0;
48220
- copy = join40(copies, entry2[0]);
48504
+ copy = join41(copies, entry2[0]);
48221
48505
  const kept = await statOf(copy);
48222
48506
  if (kept === void 0 || kept === "absent" || kept.kind !== "file")
48223
48507
  return void 0;
@@ -48634,7 +48918,7 @@ var init_session_changes = __esm({
48634
48918
  });
48635
48919
 
48636
48920
  // ../../packages/tacho/src/collector/session-commits.ts
48637
- import { join as join41 } from "node:path";
48921
+ import { join as join42 } from "node:path";
48638
48922
  function parseMeta(stdout) {
48639
48923
  const out = [];
48640
48924
  for (const record2 of stdout.split("\0")) {
@@ -48759,7 +49043,7 @@ async function readSessionCommits(exec4, cwd, input) {
48759
49043
  const test = input.tests[commit.sha];
48760
49044
  const toolUseId = callAt(times.get(commit.sha), calls);
48761
49045
  const written2 = input.written;
48762
- const outside = merge2 || written2 === void 0 || root === void 0 ? void 0 : files2.some((file) => !written2.has(join41(root, file.path)));
49046
+ const outside = merge2 || written2 === void 0 || root === void 0 ? void 0 : files2.some((file) => !written2.has(join42(root, file.path)));
48763
49047
  return {
48764
49048
  sha: commit.sha,
48765
49049
  parent_shas: commit.parents.slice(0, MAX_COMMIT_PARENTS),
@@ -48807,7 +49091,7 @@ var init_session_commits = __esm({
48807
49091
 
48808
49092
  // ../../packages/tacho/src/collector/worktree-snapshot.ts
48809
49093
  import { lstat as lstat2 } from "node:fs/promises";
48810
- import { join as join42 } from "node:path";
49094
+ import { join as join43 } from "node:path";
48811
49095
  function headerPath(prefix, path2) {
48812
49096
  const name2 = `${prefix}${path2}`;
48813
49097
  let quoted3 = false;
@@ -48891,7 +49175,7 @@ async function worktreeFingerprint(status2, root) {
48891
49175
  const path2 = statusPath(record2);
48892
49176
  if (path2 === null) return "";
48893
49177
  try {
48894
- const info = await lstat2(join42(root, path2));
49178
+ const info = await lstat2(join43(root, path2));
48895
49179
  return `${info.size}:${info.mtimeMs}:${info.ctimeMs}`;
48896
49180
  } catch {
48897
49181
  return "absent";
@@ -48999,7 +49283,7 @@ async function readWorktreeSnapshot(exec4, cwd, baseline, measured) {
48999
49283
  }
49000
49284
  let present;
49001
49285
  try {
49002
- present = (await lstat2(join42(root, path2))).isFile();
49286
+ present = (await lstat2(join43(root, path2))).isFile();
49003
49287
  } catch {
49004
49288
  present = false;
49005
49289
  }
@@ -49102,10 +49386,10 @@ var init_worktree_snapshot = __esm({
49102
49386
  });
49103
49387
 
49104
49388
  // ../../packages/tacho/src/collector/git-lane.ts
49105
- import { join as join43 } from "node:path";
49389
+ import { join as join44 } from "node:path";
49106
49390
  function copiesDirOf(root, session) {
49107
49391
  const uuid2 = session.recorder.sessionUuid;
49108
- return /^[0-9a-f-]{36}$/i.test(uuid2) ? join43(root, uuid2) : void 0;
49392
+ return /^[0-9a-f-]{36}$/i.test(uuid2) ? join44(root, uuid2) : void 0;
49109
49393
  }
49110
49394
  function holdsBaseline(session) {
49111
49395
  return session.baselineCommit !== void 0 || Object.keys(session.baselines ?? {}).length > 0;
@@ -49922,9 +50206,9 @@ import {
49922
50206
  writeFile
49923
50207
  } from "node:fs/promises";
49924
50208
  import { homedir as homedir5 } from "node:os";
49925
- import { dirname as dirname26, join as join44, resolve as resolve12 } from "node:path";
50209
+ import { dirname as dirname26, join as join45, resolve as resolve12 } from "node:path";
49926
50210
  function stagingFolder(root, name2) {
49927
- return join44(root, `.${name2}${STAGING_SUFFIX}`);
50211
+ return join45(root, `.${name2}${STAGING_SUFFIX}`);
49928
50212
  }
49929
50213
  function isStagingName(name2) {
49930
50214
  return name2.startsWith(".") && name2.endsWith(STAGING_SUFFIX);
@@ -49967,17 +50251,17 @@ function envDir(env, key) {
49967
50251
  function skillsRoot(harness, env = process.env, home = homedir5()) {
49968
50252
  switch (harness) {
49969
50253
  case "claude-code":
49970
- return join44(
49971
- envDir(env, "CLAUDE_CONFIG_DIR") ?? join44(home, ".claude"),
50254
+ return join45(
50255
+ envDir(env, "CLAUDE_CONFIG_DIR") ?? join45(home, ".claude"),
49972
50256
  "skills"
49973
50257
  );
49974
50258
  case "codex": {
49975
50259
  const codexHome = envDir(env, "CODEX_HOME");
49976
- return codexHome === null ? join44(home, ".agents", "skills") : join44(codexHome, "skills");
50260
+ return codexHome === null ? join45(home, ".agents", "skills") : join45(codexHome, "skills");
49977
50261
  }
49978
50262
  case "stella":
49979
- return join44(
49980
- envDir(env, "STELLA_HOME") ?? join44(home, ".stella"),
50263
+ return join45(
50264
+ envDir(env, "STELLA_HOME") ?? join45(home, ".stella"),
49981
50265
  "skills"
49982
50266
  );
49983
50267
  case "cursor":
@@ -50072,11 +50356,11 @@ async function readMarker(folder) {
50072
50356
  if (!found.isDirectory()) return { state: "foreign" };
50073
50357
  const entries2 = await readdir2(folder);
50074
50358
  if (!entries2.includes(SESSION_MARKER)) return { state: "foreign" };
50075
- if ((await entryAt2(join44(folder, SESSION_MARKER)))?.isFile() !== true)
50359
+ if ((await entryAt2(join45(folder, SESSION_MARKER)))?.isFile() !== true)
50076
50360
  return { state: "foreign" };
50077
50361
  try {
50078
50362
  const parsed2 = JSON.parse(
50079
- await readFile(join44(folder, SESSION_MARKER), "utf8")
50363
+ await readFile(join45(folder, SESSION_MARKER), "utf8")
50080
50364
  );
50081
50365
  return isMarker(parsed2) ? { state: "ours", marker: parsed2 } : { state: "foreign" };
50082
50366
  } catch {
@@ -50093,22 +50377,22 @@ function liveSessions(marker, now) {
50093
50377
  return live;
50094
50378
  }
50095
50379
  async function writeMarker(folder, marker) {
50096
- const temp = join44(folder, MARKER_TEMP);
50380
+ const temp = join45(folder, MARKER_TEMP);
50097
50381
  await writeNew(temp, `${JSON.stringify(marker, null, 2)}
50098
50382
  `);
50099
- await rename2(temp, join44(folder, SESSION_MARKER));
50383
+ await rename2(temp, join45(folder, SESSION_MARKER));
50100
50384
  }
50101
50385
  async function writeSkill(root, skill, marker) {
50102
- const folder = join44(root, skill.name);
50386
+ const folder = join45(root, skill.name);
50103
50387
  const staging = stagingFolder(root, skill.name);
50104
50388
  await removeEntry2(folder);
50105
50389
  await removeEntry2(staging);
50106
50390
  await mkdir2(staging);
50107
50391
  await writeMarker(staging, { digest: UNFINISHED_DIGEST, sessions: {} });
50108
50392
  await rename2(staging, folder);
50109
- await writeNew(join44(folder, "SKILL.md"), skillMarkdown(skill));
50393
+ await writeNew(join45(folder, "SKILL.md"), skillMarkdown(skill));
50110
50394
  for (const file of skill.files) {
50111
- const target = join44(folder, file.path);
50395
+ const target = join45(folder, file.path);
50112
50396
  await mkdir2(dirname26(target), { recursive: true });
50113
50397
  await writeNew(target, file.content);
50114
50398
  }
@@ -50138,7 +50422,7 @@ async function placeSkills(root, sessionId, skills, now = /* @__PURE__ */ new Da
50138
50422
  result2.warnings.push(refusal);
50139
50423
  continue;
50140
50424
  }
50141
- const folder = join44(root, skill.name);
50425
+ const folder = join45(root, skill.name);
50142
50426
  if (taken.has(skill.name)) {
50143
50427
  result2.skipped.push(skill.name);
50144
50428
  result2.warnings.push(
@@ -50222,7 +50506,7 @@ async function removeSkills(root, sessionId, now = /* @__PURE__ */ new Date(), l
50222
50506
  throw error2;
50223
50507
  }
50224
50508
  for (const name2 of names2.sort(compareText)) {
50225
- const folder = join44(root, name2);
50509
+ const folder = join45(root, name2);
50226
50510
  if (isStagingName(name2)) {
50227
50511
  await removeEntry2(folder);
50228
50512
  continue;
@@ -50280,7 +50564,7 @@ var init_place = __esm({
50280
50564
 
50281
50565
  // ../../packages/tacho/src/skills/inventory.ts
50282
50566
  import { lstatSync as lstatSync10, readdirSync as readdirSync14 } from "node:fs";
50283
- import { join as join45 } from "node:path";
50567
+ import { join as join46 } from "node:path";
50284
50568
  function errorCode2(error2) {
50285
50569
  return typeof error2 === "object" && error2 !== null && "code" in error2 ? error2.code : void 0;
50286
50570
  }
@@ -50291,8 +50575,8 @@ function skillInventoryRoots(place2) {
50291
50575
  const project2 = projectOf(place2);
50292
50576
  if (project2 !== void 0)
50293
50577
  for (const folder of PROJECT_SKILL_FOLDERS[place2.harness])
50294
- roots.push(join45(project2, folder));
50295
- const user = place2.harness === "cursor" ? join45(home, ".cursor", "skills") : skillsRoot(place2.harness, place2.env, home);
50578
+ roots.push(join46(project2, folder));
50579
+ const user = place2.harness === "cursor" ? join46(home, ".cursor", "skills") : skillsRoot(place2.harness, place2.env, home);
50296
50580
  if (user !== null) roots.push(user);
50297
50581
  return [...new Set(roots)];
50298
50582
  }
@@ -50313,7 +50597,7 @@ function skillInventory(place2, reader) {
50313
50597
  if (entries2.length > SKILL_INVENTORY_SCAN_MAX) return void 0;
50314
50598
  for (const entry2 of entries2) {
50315
50599
  if (entry2.startsWith(".")) continue;
50316
- if (reader.isFile(join45(root, entry2, SKILL_FILE2)))
50600
+ if (reader.isFile(join46(root, entry2, SKILL_FILE2)))
50317
50601
  names2.add(entry2.slice(0, SKILL_INVENTORY_NAME_MAX));
50318
50602
  }
50319
50603
  }
@@ -50361,14 +50645,14 @@ var init_inventory = __esm({
50361
50645
  });
50362
50646
 
50363
50647
  // ../../packages/tacho/src/collector/subagent-meta.ts
50364
- import { join as join46 } from "node:path";
50648
+ import { join as join47 } from "node:path";
50365
50649
  function subagentMetaPaths(sessionTranscript, agentId, agentTranscript) {
50366
50650
  const paths = [];
50367
50651
  if (agentTranscript?.endsWith(".jsonl"))
50368
50652
  paths.push(`${agentTranscript.slice(0, -".jsonl".length)}.meta.json`);
50369
50653
  const dir = sessionTranscript === void 0 ? void 0 : subagentDirOf(sessionTranscript);
50370
50654
  if (dir !== void 0) {
50371
- const own = join46(dir, `agent-${agentId}.meta.json`);
50655
+ const own = join47(dir, `agent-${agentId}.meta.json`);
50372
50656
  if (!paths.includes(own)) paths.push(own);
50373
50657
  }
50374
50658
  return paths;
@@ -50864,7 +51148,7 @@ function questionBoundary(harness) {
50864
51148
  function holdToolCall(evaluation, record2) {
50865
51149
  const held = record2.control.interjection;
50866
51150
  if (held === void 0 || evaluation.decision === "deny") return evaluation;
50867
- const refused2 = {
51151
+ const refused3 = {
50868
51152
  ...evaluation,
50869
51153
  decision: "deny",
50870
51154
  evaluated: "deny",
@@ -50872,9 +51156,9 @@ function holdToolCall(evaluation, record2) {
50872
51156
  reason_code: INTERJECTION_OPEN,
50873
51157
  reason: held.question
50874
51158
  };
50875
- delete refused2.rule;
50876
- delete refused2.rules;
50877
- return refused2;
51159
+ delete refused3.rule;
51160
+ delete refused3.rules;
51161
+ return refused3;
50878
51162
  }
50879
51163
  function isBound(clause, remote) {
50880
51164
  const bound = new Set(clause.bound_remote_digests);
@@ -51553,7 +51837,7 @@ function loopRefusal(input, record2, deps, events, replay, evaluation, call2, at
51553
51837
  return void 0;
51554
51838
  events.push(...sealLoopNotice(record2, input, held, "PreToolUse", at2));
51555
51839
  markLoopNoticed(record2, chain, held);
51556
- const refused2 = {
51840
+ const refused3 = {
51557
51841
  ...evaluation,
51558
51842
  decision: "deny",
51559
51843
  evaluated: "deny",
@@ -51561,9 +51845,9 @@ function loopRefusal(input, record2, deps, events, replay, evaluation, call2, at
51561
51845
  reason_code: LOOP_NOTICE_REASON_CODE,
51562
51846
  reason: `${LOOP_REFUSAL_LEAD}${loopNoticeText(held)}`
51563
51847
  };
51564
- delete refused2.rule;
51565
- delete refused2.rules;
51566
- return refused2;
51848
+ delete refused3.rule;
51849
+ delete refused3.rules;
51850
+ return refused3;
51567
51851
  }
51568
51852
  function noteHandedContext(record2, input, replay, text6, at2) {
51569
51853
  if (replay !== void 0 || input.agent_id !== void 0) return;
@@ -51860,15 +52144,16 @@ async function routeHook(raw, env, deps, replay, harness, agent, hookId) {
51860
52144
  const events = [...reopening];
51861
52145
  const replayed = replayAttrs(replay);
51862
52146
  const pushBasis = await gitPushBasis(input, record2, deps);
52147
+ const readSettings = deps.readAgentText ?? deps.readText;
51863
52148
  const settingsOf = (draft) => {
51864
- if (draft.kind !== "agent_start" || (record2.harness ?? "claude-code") !== "claude-code" || deps.readText === void 0)
52149
+ if (draft.kind !== "agent_start" || (record2.harness ?? "claude-code") !== "claude-code" || readSettings === void 0)
51865
52150
  return draft;
51866
52151
  const model = typeof draft.body["model"] === "string" ? draft.body["model"] : void 0;
51867
52152
  const facts = claudeSettingsFacts(
51868
52153
  { ...env, HOME: env["HOME"] ?? homedir6() },
51869
52154
  record2.cwd ?? input.cwd,
51870
52155
  model,
51871
- deps.readText
52156
+ readSettings
51872
52157
  );
51873
52158
  return Object.keys(facts).length === 0 ? draft : { ...draft, body: { ...draft.body, ...facts } };
51874
52159
  };
@@ -52443,15 +52728,15 @@ function subagentMetaFor(record2, input, deps) {
52443
52728
  if (input.hook_event_name !== "SubagentStart" && input.hook_event_name !== "SubagentStop")
52444
52729
  return void 0;
52445
52730
  if ((record2.harness ?? "claude-code") !== "claude-code") return void 0;
52446
- if (input.agent_id === void 0 || deps.readText === void 0)
52447
- return void 0;
52731
+ const readText3 = deps.readAgentText ?? deps.readText;
52732
+ if (input.agent_id === void 0 || readText3 === void 0) return void 0;
52448
52733
  const agentTranscript = input["agent_transcript_path"];
52449
52734
  const paths = subagentMetaPaths(
52450
52735
  record2.transcriptPath ?? input.transcript_path,
52451
52736
  input.agent_id,
52452
52737
  typeof agentTranscript === "string" ? agentTranscript : void 0
52453
52738
  );
52454
- return readSubagentMeta(deps.readText, paths) ?? null;
52739
+ return readSubagentMeta(readText3, paths) ?? null;
52455
52740
  }
52456
52741
  function writtenDir(input) {
52457
52742
  const path2 = writtenPath(input);
@@ -52706,7 +52991,7 @@ var init_steer_waiters = __esm({
52706
52991
  });
52707
52992
 
52708
52993
  // ../../packages/tacho/src/collector/hook-id-journal.ts
52709
- import { appendFileSync as appendFileSync4, existsSync as existsSync23, readFileSync as readFileSync18, rmSync as rmSync9 } from "node:fs";
52994
+ import { appendFileSync as appendFileSync4, existsSync as existsSync23, readFileSync as readFileSync19, rmSync as rmSync9 } from "node:fs";
52710
52995
  function hookIdJournalEntry(session, key, at2, events) {
52711
52996
  const highest = /* @__PURE__ */ new Map();
52712
52997
  for (const event of events) {
@@ -52733,7 +53018,7 @@ function isEntry(value) {
52733
53018
  function readHookIdJournal(path2) {
52734
53019
  if (!existsSync23(path2)) return [];
52735
53020
  const entries2 = [];
52736
- for (const line of readFileSync18(path2, "utf8").split("\n")) {
53021
+ for (const line of readFileSync19(path2, "utf8").split("\n")) {
52737
53022
  if (line.trim().length === 0) continue;
52738
53023
  try {
52739
53024
  const value = JSON.parse(line);
@@ -53246,9 +53531,9 @@ var init_inbox = __esm({
53246
53531
 
53247
53532
  // ../../packages/tacho/src/collector/gateway-frame.ts
53248
53533
  function gatewayFrameBody(call2) {
53249
- const refused2 = call2.status === "rejected";
53534
+ const refused3 = call2.status === "rejected";
53250
53535
  return {
53251
- kind: refused2 ? "policy_decision" : "tool_call",
53536
+ kind: refused3 ? "policy_decision" : "tool_call",
53252
53537
  body: {
53253
53538
  tool_name: call2.toolName,
53254
53539
  tool_source: "mcp",
@@ -53264,7 +53549,7 @@ function gatewayFrameBody(call2) {
53264
53549
  tool_output_digest: call2.outputDigest,
53265
53550
  tool_output_bytes: call2.outputBytes
53266
53551
  },
53267
- ...refused2 ? {
53552
+ ...refused3 ? {
53268
53553
  policy_decision: "deny",
53269
53554
  policy_source: "kernel",
53270
53555
  policy_reason_code: "mcp_refused",
@@ -54183,88 +54468,9 @@ var init_memory_send = __esm({
54183
54468
  }
54184
54469
  });
54185
54470
 
54186
- // ../../packages/tacho/src/collector/memory-capture/memory-text.ts
54187
- function clip2(text6, max2) {
54188
- if (text6.length <= max2) return text6;
54189
- let end = max2;
54190
- const last = text6.charCodeAt(end - 1);
54191
- if (last >= 55296 && last <= 56319) end -= 1;
54192
- return text6.slice(0, end).trimEnd();
54193
- }
54194
- function frontmatterScalar(raw) {
54195
- const value = raw.trim();
54196
- if (/^[|>][+-]?$/.test(value)) return void 0;
54197
- if (value.length >= 2 && value.startsWith('"') && value.endsWith('"'))
54198
- return value.slice(1, -1).replace(/\\"/g, '"');
54199
- if (value.length >= 2 && value.startsWith("'") && value.endsWith("'"))
54200
- return value.slice(1, -1).replace(/''/g, "'");
54201
- return value;
54202
- }
54203
- function frontmatterOf(block) {
54204
- const fields = {};
54205
- let inMetadata = false;
54206
- for (const line of block.split(/\r?\n/)) {
54207
- const match = FRONTMATTER_LINE.exec(line);
54208
- if (match === null) continue;
54209
- const [, indent = "", key = "", raw = ""] = match;
54210
- if (indent === "") {
54211
- inMetadata = key === "metadata" && raw.trim() === "";
54212
- if (key === "name" || key === "description" || key === "type") {
54213
- const value = frontmatterScalar(raw);
54214
- if (value !== void 0) fields[key] = value;
54215
- }
54216
- continue;
54217
- }
54218
- if (inMetadata && key === "type") {
54219
- const value = frontmatterScalar(raw);
54220
- if (value !== void 0) fields.metadataType = value;
54221
- }
54222
- }
54223
- return fields;
54224
- }
54225
- function textField(value, max2) {
54226
- if (value === void 0) return void 0;
54227
- const text6 = clip2(value.trim(), max2);
54228
- return text6.length > 0 ? text6 : void 0;
54229
- }
54230
- function typeField(fields) {
54231
- const value = (fields.metadataType ?? fields.type)?.trim().toLowerCase();
54232
- return value !== void 0 && MEMORY_TYPE_PATTERN.test(value) ? value : void 0;
54233
- }
54234
- function memoryTextOf(text6) {
54235
- const unmarked = text6.replace(/^\uFEFF/, "");
54236
- const match = FRONTMATTER.exec(unmarked);
54237
- const body2 = match === null ? unmarked : unmarked.slice(match[0].length);
54238
- const fields = match === null ? {} : frontmatterOf(match[1] ?? "");
54239
- const label = textField(fields.name, MEMORY_LABEL_MAX_CHARS);
54240
- const summary = textField(fields.description, MEMORY_SUMMARY_MAX_CHARS);
54241
- const memoryType = typeField(fields);
54242
- return {
54243
- statement: clip2(body2.trim(), MEMORY_STATEMENT_MAX_CHARS),
54244
- ...label !== void 0 ? { label } : {},
54245
- ...summary !== void 0 ? { summary } : {},
54246
- ...memoryType !== void 0 ? { memoryType } : {}
54247
- };
54248
- }
54249
- function claudeCodeProjectName(dir) {
54250
- return dir.replace(/[^a-zA-Z0-9]/g, "-");
54251
- }
54252
- var MEMORY_STATEMENT_MAX_CHARS, MEMORY_LABEL_MAX_CHARS, MEMORY_SUMMARY_MAX_CHARS, MEMORY_TYPE_PATTERN, FRONTMATTER, FRONTMATTER_LINE;
54253
- var init_memory_text = __esm({
54254
- "../../packages/tacho/src/collector/memory-capture/memory-text.ts"() {
54255
- "use strict";
54256
- MEMORY_STATEMENT_MAX_CHARS = 2e3;
54257
- MEMORY_LABEL_MAX_CHARS = 200;
54258
- MEMORY_SUMMARY_MAX_CHARS = 1e3;
54259
- MEMORY_TYPE_PATTERN = /^[a-z][a-z0-9_-]{0,31}$/;
54260
- FRONTMATTER = /^---[ \t]*\r?\n(?:([\s\S]*?)\r?\n)?---[ \t]*(?:\r?\n|$)/;
54261
- FRONTMATTER_LINE = /^([ \t]*)([A-Za-z_][\w-]*)[ \t]*:[ \t]*(.*)$/;
54262
- }
54263
- });
54264
-
54265
54471
  // ../../packages/tacho/src/collector/memory-capture/memory-reader.ts
54266
54472
  import { createRequire as createRequire2 } from "node:module";
54267
- import { basename as basename7, dirname as dirname28, isAbsolute as isAbsolute10, join as join47, resolve as resolve15, sep as sep7 } from "node:path";
54473
+ import { basename as basename7, dirname as dirname28, isAbsolute as isAbsolute10, join as join48, resolve as resolve15, sep as sep7 } from "node:path";
54268
54474
  function claudeCodeLocation(projectsDir, memoryDir, scope) {
54269
54475
  return {
54270
54476
  harness: "claude-code",
@@ -54277,19 +54483,19 @@ function claudeCodeLocation(projectsDir, memoryDir, scope) {
54277
54483
  }
54278
54484
  function claudeCodeMemoryLocations(configDir, projectDirs = []) {
54279
54485
  const locations = [
54280
- claudeCodeLocation(() => join47(configDir, "projects"), "memory", {
54486
+ claudeCodeLocation(() => join48(configDir, "projects"), "memory", {
54281
54487
  kind: "project-folders"
54282
54488
  }),
54283
- claudeCodeLocation(() => join47(configDir, "agent-memory"), "", {
54489
+ claudeCodeLocation(() => join48(configDir, "agent-memory"), "", {
54284
54490
  kind: "personal"
54285
54491
  })
54286
54492
  ];
54287
54493
  for (const dir of projectDirs.slice(0, MEMORY_PROJECT_DIRS_MAX)) {
54288
54494
  const scope = { kind: "directory", dir };
54289
54495
  locations.push(
54290
- claudeCodeLocation(() => join47(dir, ".claude", "agent-memory"), "", scope),
54496
+ claudeCodeLocation(() => join48(dir, ".claude", "agent-memory"), "", scope),
54291
54497
  claudeCodeLocation(
54292
- () => join47(dir, ".claude", "agent-memory-local"),
54498
+ () => join48(dir, ".claude", "agent-memory-local"),
54293
54499
  "",
54294
54500
  scope
54295
54501
  )
@@ -54350,8 +54556,8 @@ function locate(file, locations, home) {
54350
54556
  const top = location.projectsDir(home);
54351
54557
  if (dirname28(projectDir) !== resolve15(top)) continue;
54352
54558
  const project2 = basename7(projectDir);
54353
- const dir = location.memoryDir === "" ? join47(top, project2) : join47(top, project2, location.memoryDir);
54354
- return { location, top, project: project2, dir, path: join47(dir, name2) };
54559
+ const dir = location.memoryDir === "" ? join48(top, project2) : join48(top, project2, location.memoryDir);
54560
+ return { location, top, project: project2, dir, path: join48(dir, name2) };
54355
54561
  }
54356
54562
  return void 0;
54357
54563
  }
@@ -54430,7 +54636,7 @@ function createMemoryReader(deps) {
54430
54636
  saveTimer = setTimeout(persist, MEMORY_SENT_SAVE_DELAY_MS);
54431
54637
  saveTimer.unref?.();
54432
54638
  }
54433
- const refused2 = /* @__PURE__ */ new Map();
54639
+ const refused3 = /* @__PURE__ */ new Map();
54434
54640
  const uploading = /* @__PURE__ */ new Set();
54435
54641
  let running;
54436
54642
  let reads = 0;
@@ -54500,10 +54706,10 @@ function createMemoryReader(deps) {
54500
54706
  continue;
54501
54707
  }
54502
54708
  if (outcome === "refused") {
54503
- refused2.set(key, { digest: digest6, at: now() });
54709
+ refused3.set(key, { digest: digest6, at: now() });
54504
54710
  return "held";
54505
54711
  }
54506
- refused2.delete(key);
54712
+ refused3.delete(key);
54507
54713
  sent.set(key, digest6);
54508
54714
  sentRead.set(key, read2);
54509
54715
  dirty = true;
@@ -54520,7 +54726,7 @@ function createMemoryReader(deps) {
54520
54726
  if (superseded || (sentRead.get(key) ?? 0) > read2) return "unchanged";
54521
54727
  const digest6 = sentDigest(entry2);
54522
54728
  if (sent.get(key) === digest6) return "unchanged";
54523
- if (stillHeld(refused2.get(key), digest6, now())) return "held";
54729
+ if (stillHeld(refused3.get(key), digest6, now())) return "held";
54524
54730
  const send5 = sendOnce(entry2, key, digest6, budget, read2).finally(() => {
54525
54731
  sending.delete(key);
54526
54732
  });
@@ -54574,13 +54780,13 @@ function createMemoryReader(deps) {
54574
54780
  const whole = [];
54575
54781
  const read2 = /* @__PURE__ */ new Set();
54576
54782
  const seen = /* @__PURE__ */ new Set();
54577
- const known = /* @__PURE__ */ new Set([...sent.keys(), ...refused2.keys()]);
54783
+ const known = /* @__PURE__ */ new Set([...sent.keys(), ...refused3.keys()]);
54578
54784
  const budget = { max: MEMORY_SCAN_WAIT_MAX_MS, waited: 0 };
54579
54785
  async function readFolder(location, dir, names2, where, paths) {
54580
54786
  for (const name2 of names2) {
54581
54787
  if (!name2.endsWith(location.extension)) continue;
54582
54788
  if (location.skip.includes(name2)) continue;
54583
- const path2 = join47(dir, name2);
54789
+ const path2 = join48(dir, name2);
54584
54790
  const file = await readAt2(location.harness, path2);
54585
54791
  if (file.kind === "absent" || file.kind === "empty") continue;
54586
54792
  paths.push(path2);
@@ -54609,7 +54815,7 @@ function createMemoryReader(deps) {
54609
54815
  if (location.scope.kind === "project-folders") {
54610
54816
  const projects = await list2(top);
54611
54817
  for (const project2 of projects.names) {
54612
- const dir = join47(top, project2, location.memoryDir);
54818
+ const dir = join48(top, project2, location.memoryDir);
54613
54819
  const files2 = await list2(dir);
54614
54820
  if (!files2.found) continue;
54615
54821
  const where2 = await scoper.projectFolder(project2);
@@ -54635,7 +54841,7 @@ function createMemoryReader(deps) {
54635
54841
  const folders = await list2(top);
54636
54842
  let complete = folders.complete;
54637
54843
  for (const folder of folders.names) {
54638
- const dir = location.memoryDir === "" ? join47(top, folder) : join47(top, folder, location.memoryDir);
54844
+ const dir = location.memoryDir === "" ? join48(top, folder) : join48(top, folder, location.memoryDir);
54639
54845
  const files2 = await list2(dir);
54640
54846
  if (!files2.complete) complete = false;
54641
54847
  if (!await readFolder(location, dir, files2.names, where, paths))
@@ -54682,7 +54888,7 @@ function createMemoryReader(deps) {
54682
54888
  sentRead.delete(key);
54683
54889
  dirty = true;
54684
54890
  }
54685
- for (const key of [...refused2.keys()]) if (gone(key)) refused2.delete(key);
54891
+ for (const key of [...refused3.keys()]) if (gone(key)) refused3.delete(key);
54686
54892
  return { sent: count14, scans, counts: counts2 };
54687
54893
  }
54688
54894
  async function sendFile(given) {
@@ -54780,10 +54986,10 @@ var init_memory_reader = __esm({
54780
54986
  MEMORY_WRITE_WAIT_MAX_MS = 2 * MEMORY_RATE_WAIT_MAX_MS;
54781
54987
  MEMORY_PROJECT_DIRS_MAX = 200;
54782
54988
  HARNESS_MEMORY_LOCATIONS = [
54783
- claudeCodeLocation((home) => join47(home, ".claude", "projects"), "memory", {
54989
+ claudeCodeLocation((home) => join48(home, ".claude", "projects"), "memory", {
54784
54990
  kind: "project-folders"
54785
54991
  }),
54786
- claudeCodeLocation((home) => join47(home, ".claude", "agent-memory"), "", {
54992
+ claudeCodeLocation((home) => join48(home, ".claude", "agent-memory"), "", {
54787
54993
  kind: "personal"
54788
54994
  })
54789
54995
  ];
@@ -55172,9 +55378,9 @@ var init_memory_recall = __esm({
55172
55378
  });
55173
55379
 
55174
55380
  // ../../packages/tacho/src/collector/memory-capture/memory-scope.ts
55175
- import { join as join48, resolve as resolve16 } from "node:path";
55381
+ import { join as join49, resolve as resolve16 } from "node:path";
55176
55382
  function machineWideDirs(home) {
55177
- return [resolve16(home), resolve16(join48(home, "Projects"))];
55383
+ return [resolve16(home), resolve16(join49(home, "Projects"))];
55178
55384
  }
55179
55385
  async function decodeProjectName(name2, readdir6) {
55180
55386
  if (!name2.startsWith("-")) return void 0;
@@ -55200,7 +55406,7 @@ async function decodeProjectName(name2, readdir6) {
55200
55406
  for (const entry2 of names2) {
55201
55407
  const part = `-${claudeCodeProjectName(entry2)}`;
55202
55408
  if (rest === part || rest.startsWith(`${part}-`))
55203
- await walk2(join48(dir, entry2), rest.slice(part.length));
55409
+ await walk2(join49(dir, entry2), rest.slice(part.length));
55204
55410
  if (found.length > 1 || cut) return;
55205
55411
  }
55206
55412
  }
@@ -55449,8 +55655,8 @@ var init_store_watch = __esm({
55449
55655
  });
55450
55656
 
55451
55657
  // ../../packages/tacho/src/collector/memory-capture/memory-uses.ts
55452
- import { readFileSync as readFileSync19, statSync as statSync12 } from "node:fs";
55453
- import { basename as basename9, dirname as dirname30, isAbsolute as isAbsolute12, join as join49, resolve as resolve18 } from "node:path";
55658
+ import { readFileSync as readFileSync20, statSync as statSync12 } from "node:fs";
55659
+ import { basename as basename9, dirname as dirname30, isAbsolute as isAbsolute12, join as join50, resolve as resolve18 } from "node:path";
55454
55660
  function memoryFileOf(path2, locations, home) {
55455
55661
  if (!isAbsolute12(path2)) return void 0;
55456
55662
  const file = resolve18(path2);
@@ -55468,7 +55674,7 @@ function memoryFileOf(path2, locations, home) {
55468
55674
  return void 0;
55469
55675
  }
55470
55676
  function pathOf(word2, cwd, home) {
55471
- const expanded = /^(?:~|\$HOME|\$\{HOME\})\//.test(word2) ? join49(home, word2.slice(word2.indexOf("/") + 1)) : word2;
55677
+ const expanded = /^(?:~|\$HOME|\$\{HOME\})\//.test(word2) ? join50(home, word2.slice(word2.indexOf("/") + 1)) : word2;
55472
55678
  if (isAbsolute12(expanded)) return expanded;
55473
55679
  if (cwd !== void 0 && isAbsolute12(cwd)) return resolve18(cwd, expanded);
55474
55680
  return void 0;
@@ -55501,14 +55707,14 @@ function claudeCodeProjectSlug(root) {
55501
55707
  function claudeCodeProjectRoot(cwd, files2) {
55502
55708
  const start = resolve18(cwd);
55503
55709
  for (let dir = start; ; dir = dirname30(dir)) {
55504
- const dotGit = join49(dir, ".git");
55710
+ const dotGit = join50(dir, ".git");
55505
55711
  if (files2.isDirectory(dotGit)) return dir;
55506
55712
  const pointer = files2.readText(dotGit);
55507
55713
  if (pointer !== void 0) {
55508
55714
  const gitDir = /^gitdir:\s*(.+)$/m.exec(pointer)?.[1]?.trim();
55509
55715
  if (gitDir === void 0) return dir;
55510
55716
  const own = resolve18(dir, gitDir);
55511
- const common = files2.readText(join49(own, "commondir"))?.trim();
55717
+ const common = files2.readText(join50(own, "commondir"))?.trim();
55512
55718
  const commonDir = common === void 0 ? own : resolve18(own, common);
55513
55719
  return basename9(commonDir) === ".git" ? dirname30(commonDir) : dir;
55514
55720
  }
@@ -55537,12 +55743,12 @@ function indexedMemoriesOf(cwd, home, locations, files2 = hostIndexFiles) {
55537
55743
  if (indexName === void 0) return [];
55538
55744
  const roots = /* @__PURE__ */ new Set([claudeCodeProjectRoot(cwd, files2), resolve18(cwd)]);
55539
55745
  for (const root of roots) {
55540
- const folder = join49(
55746
+ const folder = join50(
55541
55747
  projects.projectsDir(home),
55542
55748
  claudeCodeProjectSlug(root),
55543
55749
  projects.memoryDir
55544
55750
  );
55545
- const index = files2.readText(join49(folder, indexName));
55751
+ const index = files2.readText(join50(folder, indexName));
55546
55752
  if (index !== void 0)
55547
55753
  return memoriesListedIn(index, folder, locations, home);
55548
55754
  }
@@ -55836,7 +56042,7 @@ var init_memory_uses = __esm({
55836
56042
  hostIndexFiles = {
55837
56043
  readText: (path2) => {
55838
56044
  try {
55839
- return readFileSync19(path2, "utf8");
56045
+ return readFileSync20(path2, "utf8");
55840
56046
  } catch {
55841
56047
  return void 0;
55842
56048
  }
@@ -55864,7 +56070,7 @@ ${use.path}`;
55864
56070
  });
55865
56071
 
55866
56072
  // ../../packages/tacho/src/collector/memory-capture/stella-store.ts
55867
- import { dirname as dirname31, isAbsolute as isAbsolute13, join as join50, resolve as resolve19 } from "node:path";
56073
+ import { dirname as dirname31, isAbsolute as isAbsolute13, join as join51, resolve as resolve19 } from "node:path";
55868
56074
  function queryStellaStore(path2, afterSeq, limit) {
55869
56075
  const db = new (nodeSqlite()).DatabaseSync(path2, { readOnly: true });
55870
56076
  try {
@@ -55954,7 +56160,7 @@ async function stellaStoreOf(dir, exists) {
55954
56160
  if (!isAbsolute13(dir)) return void 0;
55955
56161
  let at2 = resolve19(dir);
55956
56162
  for (let depth = 0; depth < WORKSPACE_SEARCH_DEPTH; depth += 1) {
55957
- const candidate = join50(at2, STELLA_CONTEXT_DB);
56163
+ const candidate = join51(at2, STELLA_CONTEXT_DB);
55958
56164
  if (await exists(candidate)) return candidate;
55959
56165
  const up = dirname31(at2);
55960
56166
  if (up === at2) return void 0;
@@ -55967,7 +56173,7 @@ var init_stella_store = __esm({
55967
56173
  "../../packages/tacho/src/collector/memory-capture/stella-store.ts"() {
55968
56174
  "use strict";
55969
56175
  init_memory_reader();
55970
- STELLA_CONTEXT_DB = join50(".stella", "private", "context.db");
56176
+ STELLA_CONTEXT_DB = join51(".stella", "private", "context.db");
55971
56177
  STELLA_MEMORIES_VIEW = "export_memories_v1";
55972
56178
  STELLA_USES_VIEW = "export_memory_uses_v1";
55973
56179
  STELLA_USES_PER_READ = 5e3;
@@ -56057,7 +56263,7 @@ function createStellaMemories(deps) {
56057
56263
  }
56058
56264
  const gone = /* @__PURE__ */ new Set();
56059
56265
  const sent = /* @__PURE__ */ new Map();
56060
- const refused2 = /* @__PURE__ */ new Map();
56266
+ const refused3 = /* @__PURE__ */ new Map();
56061
56267
  const failures = /* @__PURE__ */ new Map();
56062
56268
  const viewsMissingLogged = /* @__PURE__ */ new Set();
56063
56269
  let running;
@@ -56134,7 +56340,7 @@ ${lineage}`;
56134
56340
  const key = sentKey(store, memory.lineage);
56135
56341
  const digest6 = sentDigest2(memory);
56136
56342
  if (sent.get(key) === digest6) continue;
56137
- if (stillHeld(refused2.get(key), digest6, deps.now())) continue;
56343
+ if (stillHeld(refused3.get(key), digest6, deps.now())) continue;
56138
56344
  let outcome;
56139
56345
  try {
56140
56346
  outcome = await deps.send(entryOf2(memory, store));
@@ -56143,10 +56349,10 @@ ${lineage}`;
56143
56349
  break;
56144
56350
  }
56145
56351
  if (outcome === "refused") {
56146
- refused2.set(key, { digest: digest6, at: deps.now() });
56352
+ refused3.set(key, { digest: digest6, at: deps.now() });
56147
56353
  continue;
56148
56354
  }
56149
- refused2.delete(key);
56355
+ refused3.delete(key);
56150
56356
  sent.set(key, digest6);
56151
56357
  result2.sent += 1;
56152
56358
  }
@@ -56706,7 +56912,7 @@ var init_cloud_link = __esm({
56706
56912
 
56707
56913
  // ../../packages/tacho/src/collector/local-servers/digest.ts
56708
56914
  import { createHash as createHash14 } from "node:crypto";
56709
- import { join as join51 } from "node:path";
56915
+ import { join as join52 } from "node:path";
56710
56916
  function rememberBounded(map, key, value) {
56711
56917
  if (!map.has(key) && map.size >= MAX_REMEMBERED_DIGESTS) {
56712
56918
  const oldest = map.keys().next();
@@ -56743,7 +56949,7 @@ function npmNameSegment(name2) {
56743
56949
  return name2.startsWith("@") ? `@${encodeURIComponent(name2.slice(1))}` : encodeURIComponent(name2);
56744
56950
  }
56745
56951
  async function whichOnPath(command2, pathValue, search) {
56746
- const candidates = command2.includes("/") || command2.includes("\\") ? [command2] : (pathValue ?? "").split(search.delimiter).filter((dir) => dir.length > 0).map((dir) => join51(dir, command2));
56952
+ const candidates = command2.includes("/") || command2.includes("\\") ? [command2] : (pathValue ?? "").split(search.delimiter).filter((dir) => dir.length > 0).map((dir) => join52(dir, command2));
56747
56953
  for (const candidate of candidates) {
56748
56954
  for (const extension2 of search.extensions) {
56749
56955
  if (await search.isExecutable(candidate + extension2))
@@ -57607,7 +57813,7 @@ function createLocalServers(options) {
57607
57813
  } catch {
57608
57814
  }
57609
57815
  }
57610
- function refused2(id2, refusal, toolsChanged = false) {
57816
+ function refused3(id2, refusal, toolsChanged = false) {
57611
57817
  options.log(`The local gateway refused ${id2}. ${refusalText(refusal)}`);
57612
57818
  return {
57613
57819
  kind: "refused",
@@ -57641,7 +57847,7 @@ function createLocalServers(options) {
57641
57847
  now: now(),
57642
57848
  skewMs
57643
57849
  });
57644
- if (!check3.ok) return refused2(envelope2.nonce, check3.refusal);
57850
+ if (!check3.ok) return refused3(envelope2.nonce, check3.refusal);
57645
57851
  const launch = await launchFor(delivery.launch, signal);
57646
57852
  const result2 = await callTool(
57647
57853
  {
@@ -57675,7 +57881,7 @@ function createLocalServers(options) {
57675
57881
  now: now(),
57676
57882
  skewMs
57677
57883
  });
57678
- if (!check3.ok) return refused2(envelope2.nonce, check3.refusal);
57884
+ if (!check3.ok) return refused3(envelope2.nonce, check3.refusal);
57679
57885
  const launch = await launchFor(delivery.launch, signal);
57680
57886
  const listed = await listTools({
57681
57887
  spawn: options.spawn,
@@ -57700,8 +57906,8 @@ function createLocalServers(options) {
57700
57906
  return delivery.kind === "call" ? await runCall(delivery, signal, notice) : await runDiscover(delivery, signal);
57701
57907
  } catch (error2) {
57702
57908
  if (error2 instanceof LocalServerError)
57703
- return refused2(id2, error2.refusal(), notice.toolsChanged);
57704
- return refused2(
57909
+ return refused3(id2, error2.refusal(), notice.toolsChanged);
57910
+ return refused3(
57705
57911
  id2,
57706
57912
  serverFailed(
57707
57913
  delivery.launch.server,
@@ -57797,7 +58003,7 @@ var init_local_servers = __esm({
57797
58003
 
57798
58004
  // ../../packages/tacho/src/collector/local-servers/machine.ts
57799
58005
  import { spawn as nodeSpawn } from "node:child_process";
57800
- import { access, constants as constants4, readFile as readFile2, realpath, stat } from "node:fs/promises";
58006
+ import { access, constants as constants5, readFile as readFile2, realpath, stat } from "node:fs/promises";
57801
58007
  function machineParked(host) {
57802
58008
  if (host.revoked_at !== null || host.host_status === "revoked")
57803
58009
  return "the enrollment is revoked";
@@ -57822,7 +58028,7 @@ function createMachineLink(host, fetch2, env) {
57822
58028
  async function isExecutable(path2) {
57823
58029
  try {
57824
58030
  if (!(await stat(path2)).isFile()) return false;
57825
- await access(path2, constants4.X_OK);
58031
+ await access(path2, constants5.X_OK);
57826
58032
  return true;
57827
58033
  } catch {
57828
58034
  return false;
@@ -57978,7 +58184,7 @@ import {
57978
58184
  rmSync as rmSync10,
57979
58185
  writeFileSync as writeFileSync4
57980
58186
  } from "node:fs";
57981
- import { join as join52 } from "node:path";
58187
+ import { join as join53 } from "node:path";
57982
58188
  function remoteName(url2) {
57983
58189
  let trimmed = url2.trim().replace(/\/+$/, "");
57984
58190
  if (trimmed.endsWith(".git")) trimmed = trimmed.slice(0, -".git".length);
@@ -58053,7 +58259,7 @@ function graphDir(root, repo) {
58053
58259
  const char = String.fromCharCode(byte);
58054
58260
  segment += /[A-Za-z0-9._-]/.test(char) ? char : `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
58055
58261
  }
58056
- return join52(root, segment);
58262
+ return join53(root, segment);
58057
58263
  }
58058
58264
  async function checkoutOf(git5, path2) {
58059
58265
  let url2;
@@ -58143,23 +58349,23 @@ async function fetchBaseDocument(fetch2, host, checkout, timeoutMs = BASE_TIMEOU
58143
58349
  return { ok: true, base: document, repoKey, fullName };
58144
58350
  }
58145
58351
  function saveBaseDocument(dir, document) {
58146
- const folder = join52(dir, BASE_DIR);
58352
+ const folder = join53(dir, BASE_DIR);
58147
58353
  mkdirSync6(folder, { recursive: true, mode: 448 });
58148
58354
  const name2 = `${document.commit}.json`;
58149
- const path2 = join52(folder, name2);
58150
- const temp = join52(folder, `.${name2}.${process.pid}.part`);
58355
+ const path2 = join53(folder, name2);
58356
+ const temp = join53(folder, `.${name2}.${process.pid}.part`);
58151
58357
  writeFileSync4(temp, JSON.stringify(document), { mode: 384 });
58152
58358
  renameSync4(temp, path2);
58153
58359
  for (const entry2 of readdirSync15(folder)) {
58154
58360
  if (entry2 !== name2 && entry2.endsWith(".json"))
58155
- rmSync10(join52(folder, entry2), { force: true });
58361
+ rmSync10(join53(folder, entry2), { force: true });
58156
58362
  }
58157
58363
  return path2;
58158
58364
  }
58159
58365
  function saveBinding(dir, repoKey, now = /* @__PURE__ */ new Date(), fullName = null) {
58160
58366
  mkdirSync6(dir, { recursive: true, mode: 448 });
58161
- const path2 = join52(dir, BINDING_FILE);
58162
- const temp = join52(dir, `.${BINDING_FILE}.${process.pid}.part`);
58367
+ const path2 = join53(dir, BINDING_FILE);
58368
+ const temp = join53(dir, `.${BINDING_FILE}.${process.pid}.part`);
58163
58369
  const body2 = {
58164
58370
  repoKey,
58165
58371
  fullName: repoKey === null ? null : fullName,
@@ -58239,7 +58445,7 @@ import {
58239
58445
  rmSync as rmSync11,
58240
58446
  writeFileSync as writeFileSync5
58241
58447
  } from "node:fs";
58242
- import { join as join53 } from "node:path";
58448
+ import { join as join54 } from "node:path";
58243
58449
  function codegraphTriple(platform2, arch) {
58244
58450
  if (platform2 === "darwin" && arch === "arm64") return "aarch64-apple-darwin";
58245
58451
  if (platform2 === "darwin" && arch === "x64") return "x86_64-apple-darwin";
@@ -58314,8 +58520,8 @@ async function downloadCodegraph(input) {
58314
58520
  failures.push(answer.message);
58315
58521
  continue;
58316
58522
  }
58317
- const dir = join53(input.home, ".oxagen", "bin");
58318
- const path2 = join53(
58523
+ const dir = join54(input.home, ".oxagen", "bin");
58524
+ const path2 = join54(
58319
58525
  dir,
58320
58526
  input.platform === "win32" ? "codegraph.exe" : "codegraph"
58321
58527
  );
@@ -58351,8 +58557,8 @@ import { createHash as createHash16, randomBytes as randomBytes11, timingSafeEqu
58351
58557
  import {
58352
58558
  createServer as createServer4
58353
58559
  } from "node:http";
58354
- import { mkdirSync as mkdirSync8, readFileSync as readFileSync20, writeFileSync as writeFileSync6 } from "node:fs";
58355
- import { join as join54 } from "node:path";
58560
+ import { mkdirSync as mkdirSync8, readFileSync as readFileSync21, writeFileSync as writeFileSync6 } from "node:fs";
58561
+ import { join as join55 } from "node:path";
58356
58562
  function oxagenCardHash(text6) {
58357
58563
  return createHash16("sha256").update(
58358
58564
  JSON.stringify({
@@ -58591,14 +58797,14 @@ function createEmbedRelay(deps) {
58591
58797
  cache.set(hash4, found);
58592
58798
  return Array.from(found);
58593
58799
  }
58594
- function refused2(answer) {
58800
+ function refused3(answer) {
58595
58801
  failure4.failed(`${answer.refusal.reason}: ${answer.refusal.message}`);
58596
58802
  deps.onRefusal?.(answer.refusal);
58597
58803
  return answer;
58598
58804
  }
58599
58805
  function hold(answer, ms) {
58600
58806
  held = { until: now() + ms, answer };
58601
- return refused2(answer);
58807
+ return refused3(answer);
58602
58808
  }
58603
58809
  function heldAnswer() {
58604
58810
  if (held === void 0) return void 0;
@@ -58640,7 +58846,7 @@ function createEmbedRelay(deps) {
58640
58846
  return outOfTime(lane, "rate_limited");
58641
58847
  const host = deps.host();
58642
58848
  if (host === void 0)
58643
- return refused2({
58849
+ return refused3({
58644
58850
  status: 424,
58645
58851
  refusal: {
58646
58852
  reason: "not_enrolled",
@@ -58669,7 +58875,7 @@ function createEmbedRelay(deps) {
58669
58875
  if (answer.ok) {
58670
58876
  const vectors = vectorsOf(answer.text, cards.length);
58671
58877
  if (vectors === void 0)
58672
- return refused2({
58878
+ return refused3({
58673
58879
  status: 424,
58674
58880
  refusal: {
58675
58881
  reason: "bad_answer",
@@ -58709,7 +58915,7 @@ function createEmbedRelay(deps) {
58709
58915
  }
58710
58916
  const refusal = worded(refusalOf2(answer));
58711
58917
  const out = { status: answer.status, refusal };
58712
- return refusal.reason === "spend_refused" ? hold(out, SPEND_HOLD_MS) : refused2(out);
58918
+ return refusal.reason === "spend_refused" ? hold(out, SPEND_HOLD_MS) : refused3(out);
58713
58919
  }
58714
58920
  }
58715
58921
  function relayFailure(error2) {
@@ -58897,7 +59103,7 @@ function createEmbedRelay(deps) {
58897
59103
  function savedPort() {
58898
59104
  try {
58899
59105
  const port = Number(
58900
- readFileSync20(join54(deps.root, RELAY_PORT_FILE), "utf8").trim()
59106
+ readFileSync21(join55(deps.root, RELAY_PORT_FILE), "utf8").trim()
58901
59107
  );
58902
59108
  return Number.isInteger(port) && port > 0 && port < 65536 ? port : void 0;
58903
59109
  } catch {
@@ -58923,7 +59129,7 @@ function createEmbedRelay(deps) {
58923
59129
  server = bound.server;
58924
59130
  base2 = `http://127.0.0.1:${bound.port}/v1`;
58925
59131
  if (bound.port !== saved)
58926
- writeFileSync6(join54(deps.root, RELAY_PORT_FILE), `${bound.port}
59132
+ writeFileSync6(join55(deps.root, RELAY_PORT_FILE), `${bound.port}
58927
59133
  `, {
58928
59134
  mode: 384
58929
59135
  });
@@ -59003,15 +59209,15 @@ var init_embed_relay = __esm({
59003
59209
  import { spawn as spawnChild } from "node:child_process";
59004
59210
  import {
59005
59211
  accessSync as accessSync3,
59006
- constants as constants5,
59212
+ constants as constants6,
59007
59213
  existsSync as existsSync24,
59008
59214
  mkdirSync as mkdirSync9,
59009
- readFileSync as readFileSync21,
59215
+ readFileSync as readFileSync22,
59010
59216
  realpathSync as realpathSync6,
59011
59217
  statSync as statSync13
59012
59218
  } from "node:fs";
59013
59219
  import { homedir as homedir7, totalmem } from "node:os";
59014
- import { delimiter as delimiter3, dirname as dirname32, isAbsolute as isAbsolute15, join as join55 } from "node:path";
59220
+ import { delimiter as delimiter3, dirname as dirname32, isAbsolute as isAbsolute15, join as join56 } from "node:path";
59015
59221
  import { createInterface as createInterface2 } from "node:readline";
59016
59222
  function serveMemoryMb(env, totalBytes) {
59017
59223
  const text6 = env[MEMORY_OVERRIDE]?.trim();
@@ -59030,11 +59236,11 @@ function machineMemory(totalBytes) {
59030
59236
  }
59031
59237
  function codegraphRoot(env, home) {
59032
59238
  const named2 = env["OXAGEN_CODEGRAPH_ROOT"];
59033
- return named2 !== void 0 && named2.length > 0 ? named2 : join55(home, ".oxagen", "codegraph");
59239
+ return named2 !== void 0 && named2.length > 0 ? named2 : join56(home, ".oxagen", "codegraph");
59034
59240
  }
59035
59241
  function defaultIsExecutable(path2) {
59036
59242
  try {
59037
- accessSync3(path2, constants5.X_OK);
59243
+ accessSync3(path2, constants6.X_OK);
59038
59244
  return statSync13(path2).isFile();
59039
59245
  } catch {
59040
59246
  return false;
@@ -59059,9 +59265,9 @@ function locateCodegraphBinary(input) {
59059
59265
  return named2;
59060
59266
  }
59061
59267
  const candidates = [
59062
- ...input.selfDirs.map((dir) => join55(dir, exe)),
59063
- join55(input.home, ".oxagen", "bin", exe),
59064
- ...(input.env["PATH"] ?? "").split(delimiter3).filter((dir) => dir.length > 0 && isAbsolute15(dir)).map((dir) => join55(dir, exe))
59268
+ ...input.selfDirs.map((dir) => join56(dir, exe)),
59269
+ join56(input.home, ".oxagen", "bin", exe),
59270
+ ...(input.env["PATH"] ?? "").split(delimiter3).filter((dir) => dir.length > 0 && isAbsolute15(dir)).map((dir) => join56(dir, exe))
59065
59271
  ];
59066
59272
  return candidates.find((candidate) => input.isExecutable(candidate));
59067
59273
  }
@@ -59179,7 +59385,7 @@ function createCodeGraphSupervisor(deps) {
59179
59385
  if (!downloaded.ok) {
59180
59386
  facts.binary = void 0;
59181
59387
  throw new CodeGraphUnavailableError(
59182
- `no codegraph binary was found, and the download failed (${downloaded.message}). Install it at ${join55(home, ".oxagen", "bin", "codegraph")}, put it on PATH, or set OXAGEN_CODEGRAPH_BIN to its path`
59388
+ `no codegraph binary was found, and the download failed (${downloaded.message}). Install it at ${join56(home, ".oxagen", "bin", "codegraph")}, put it on PATH, or set OXAGEN_CODEGRAPH_BIN to its path`
59183
59389
  );
59184
59390
  }
59185
59391
  found = downloaded.path;
@@ -59209,7 +59415,7 @@ function createCodeGraphSupervisor(deps) {
59209
59415
  async function ensureGrammars(bin) {
59210
59416
  const named2 = deps.env["CODEGRAPH_GRAMMAR_DIR"];
59211
59417
  if (named2 !== void 0 && named2.length > 0) return;
59212
- if (existsSync24(join55(root, "grammars"))) return;
59418
+ if (existsSync24(join56(root, "grammars"))) return;
59213
59419
  deps.log("codegraph: fetching the grammar pack");
59214
59420
  const code = await runOnce(bin, ["fetch-grammars", "--root", root]);
59215
59421
  if (code !== 0)
@@ -59381,11 +59587,11 @@ function createCodeGraphSupervisor(deps) {
59381
59587
  }
59382
59588
  let token;
59383
59589
  try {
59384
- token = readFileSync21(join55(root, "token"), "utf8").trim();
59590
+ token = readFileSync22(join56(root, "token"), "utf8").trim();
59385
59591
  } catch (error2) {
59386
59592
  child.kill("SIGTERM");
59387
59593
  throw new CodeGraphUnavailableError(
59388
- `codegraph serve started but its token could not be read from ${join55(root, "token")}: ${error2 instanceof Error ? error2.message : String(error2)}`
59594
+ `codegraph serve started but its token could not be read from ${join56(root, "token")}: ${error2 instanceof Error ? error2.message : String(error2)}`
59389
59595
  );
59390
59596
  }
59391
59597
  const started = { child, base: base2, token };
@@ -60813,12 +61019,32 @@ function modelSteeringAttributes(manifest) {
60813
61019
  );
60814
61020
  return attrs2;
60815
61021
  }
60816
- function mandatorySteeringCut(manifest) {
60817
- return manifest.cut.some(
61022
+ function requiredBudgetCuts(manifest) {
61023
+ return manifest.cut.filter(
60818
61024
  (record2) => record2.reason === "budget" && (record2.force === "must" || record2.force === "should")
60819
61025
  );
60820
61026
  }
60821
- var MODEL_STEERING_BUDGET_TOKENS, MODEL_STEERING_TIMEOUT_MS, MODEL_STEERING_MANIFEST_ATTR, MODEL_STEERING_STATUS_ATTR, MODEL_STEERING_RUN_HEADER, MODEL_STEERING_PATH, entrySchema2, modelSteeringManifestSchema, renderedModelSteeringSchema, modelSteeringContextSchema, INSTRUCTION_HEADING, INSTRUCTION_BULLET, INSTRUCTION_BOUNDARY;
61027
+ function mandatorySteeringCut(manifest) {
61028
+ return requiredBudgetCuts(manifest).length > 0;
61029
+ }
61030
+ function overBudgetAction(rendered) {
61031
+ if (!mandatorySteeringCut(rendered.manifest)) return null;
61032
+ return rendered.over_budget ?? "stop";
61033
+ }
61034
+ function overBudgetWarning(manifest) {
61035
+ const cut = requiredBudgetCuts(manifest);
61036
+ const shown3 = cut.slice(0, 5).map((record2) => record2.lineage);
61037
+ const more = cut.length > shown3.length ? ` and ${cut.length - shown3.length} more` : "";
61038
+ const budget = manifest.budget_tokens === null ? "the steering budget" : `the steering budget of ${manifest.budget_tokens} tokens`;
61039
+ return `${OVER_BUDGET_WARNING_PREFIX} ${budget}, so ${cut.length === 1 ? "1 required record was" : `${cut.length} required records were`} left out of this call: ${shown3.join(", ")}${more}. Tell the person once, so a workspace Admin can shorten the required steering or change [steering] over_budget in steering/governance.toml.`;
61040
+ }
61041
+ function withOverBudgetWarning(text6, manifest) {
61042
+ const warning = overBudgetWarning(manifest);
61043
+ return text6 === "" ? warning : `${warning}
61044
+
61045
+ ${text6}`;
61046
+ }
61047
+ var MODEL_STEERING_BUDGET_TOKENS, MODEL_STEERING_TIMEOUT_MS, MODEL_STEERING_MANIFEST_ATTR, MODEL_STEERING_STATUS_ATTR, MODEL_STEERING_RUN_HEADER, MODEL_STEERING_PATH, MODEL_STEERING_OVER_BUDGET_ATTR, STEERING_OVER_BUDGET_ACTIONS, steeringOverBudgetActionSchema, entrySchema2, modelSteeringManifestSchema, renderedModelSteeringSchema, modelSteeringContextSchema, INSTRUCTION_HEADING, INSTRUCTION_BULLET, INSTRUCTION_BOUNDARY, OVER_BUDGET_WARNING_PREFIX;
60822
61048
  var init_model_steering = __esm({
60823
61049
  "../../packages/tacho/src/model-steering.ts"() {
60824
61050
  "use strict";
@@ -60830,6 +61056,16 @@ var init_model_steering = __esm({
60830
61056
  MODEL_STEERING_STATUS_ATTR = "oxagen.steering_status";
60831
61057
  MODEL_STEERING_RUN_HEADER = "x-oxagen-session-uuid";
60832
61058
  MODEL_STEERING_PATH = "/v1/tacho/steering/render";
61059
+ MODEL_STEERING_OVER_BUDGET_ATTR = "oxagen.steering_over_budget";
61060
+ STEERING_OVER_BUDGET_ACTIONS = [
61061
+ "none",
61062
+ "recorded",
61063
+ "warn",
61064
+ "stop"
61065
+ ];
61066
+ steeringOverBudgetActionSchema = external_exports.enum(
61067
+ STEERING_OVER_BUDGET_ACTIONS
61068
+ );
60833
61069
  entrySchema2 = external_exports.object({
60834
61070
  lineage: external_exports.string().min(1),
60835
61071
  as: external_exports.enum(["body", "index"]),
@@ -60860,7 +61096,13 @@ var init_model_steering = __esm({
60860
61096
  renderedModelSteeringSchema = external_exports.object({
60861
61097
  text: external_exports.string().max(MODEL_STEERING_BUDGET_TOKENS * 4),
60862
61098
  prefix_length: external_exports.number().int().nonnegative(),
60863
- manifest: modelSteeringManifestSchema
61099
+ manifest: modelSteeringManifestSchema,
61100
+ /**
61101
+ * The workspace's choice for required steering that does not fit. The
61102
+ * control plane sends it only to a caller that asked for it, because an
61103
+ * older recorder reads this object strictly. Absent, the caller stops.
61104
+ */
61105
+ over_budget: steeringOverBudgetActionSchema.optional()
60864
61106
  }).strict();
60865
61107
  modelSteeringContextSchema = external_exports.object({
60866
61108
  repository: external_exports.string().max(512).nullable(),
@@ -60872,6 +61114,7 @@ var init_model_steering = __esm({
60872
61114
  INSTRUCTION_HEADING = /^(?:#{1,3} [^\n]*|MUST|SHOULD|MAY|INFO)\n/gm;
60873
61115
  INSTRUCTION_BULLET = /^- /gm;
60874
61116
  INSTRUCTION_BOUNDARY = /^(?:#{1,3} [^\n]*\n|MUST\n|SHOULD\n|MAY\n|INFO\n|- )/gm;
61117
+ OVER_BUDGET_WARNING_PREFIX = "Oxagen warning: this workspace's required steering does not fit";
60875
61118
  }
60876
61119
  });
60877
61120
 
@@ -61664,7 +61907,7 @@ function createModelProxy(deps) {
61664
61907
  const observed = /* @__PURE__ */ new Map();
61665
61908
  const priors = new RequestPrefixMemory();
61666
61909
  let callsObserved = 0;
61667
- let refused2 = 0;
61910
+ let refused3 = 0;
61668
61911
  const handoffs = /* @__PURE__ */ new WeakMap();
61669
61912
  retireIdleSockets(httpAgent);
61670
61913
  retireIdleSockets(httpsAgent);
@@ -61770,7 +62013,7 @@ function createModelProxy(deps) {
61770
62013
  return verdict.ok ? { claims: verdict.claims } : void 0;
61771
62014
  }
61772
62015
  function refuseUnrouted(req, res, route, message2) {
61773
- refused2 += 1;
62016
+ refused3 += 1;
61774
62017
  const attempt = {
61775
62018
  startedAt: deps.now(),
61776
62019
  bytesRead: 0,
@@ -62663,7 +62906,7 @@ function createModelProxy(deps) {
62663
62906
  status: credentialRefusalStatus(credential.refusal.code)
62664
62907
  } : void 0) ?? unrunnablePatternRefusal(gatewayPolicy) ?? (screen === "reject" ? sensitiveRequestRefusal(json2()) : void 0);
62665
62908
  const refuse3 = async (refusal) => {
62666
- refused2 += 1;
62909
+ refused3 += 1;
62667
62910
  const view = deps.policy();
62668
62911
  const decision = {
62669
62912
  policy_decision: "deny",
@@ -62842,9 +63085,11 @@ function createModelProxy(deps) {
62842
63085
  }
62843
63086
  if (result2.steeringStatus !== void 0)
62844
63087
  attrs2[MODEL_STEERING_STATUS_ATTR] = result2.steeringStatus;
63088
+ if (result2.steeringOverBudget !== void 0)
63089
+ attrs2[MODEL_STEERING_OVER_BUDGET_ATTR] = result2.steeringOverBudget;
62845
63090
  steeringManifest = result2.steeringManifest;
62846
63091
  if (result2.steeringStatus === "unavailable" && abortReason === void 0 && record2 !== void 0 && metered) {
62847
- refused2 += 1;
63092
+ refused3 += 1;
62848
63093
  if (steeringManifest)
62849
63094
  Object.assign(attrs2, modelSteeringAttributes(steeringManifest));
62850
63095
  admitted.release?.();
@@ -63069,6 +63314,9 @@ function createModelProxy(deps) {
63069
63314
  ) : {},
63070
63315
  ...attrs2[MODEL_STEERING_STATUS_ATTR] !== void 0 ? {
63071
63316
  [MODEL_STEERING_STATUS_ATTR]: attrs2[MODEL_STEERING_STATUS_ATTR]
63317
+ } : {},
63318
+ ...attrs2[MODEL_STEERING_OVER_BUDGET_ATTR] !== void 0 ? {
63319
+ [MODEL_STEERING_OVER_BUDGET_ATTR]: attrs2[MODEL_STEERING_OVER_BUDGET_ATTR]
63072
63320
  } : {}
63073
63321
  },
63074
63322
  target,
@@ -63681,7 +63929,7 @@ function createModelProxy(deps) {
63681
63929
  stats: () => {
63682
63930
  let open7 = 0;
63683
63931
  for (const calls of inFlight.values()) open7 += calls.size;
63684
- return { callsObserved, refused: refused2, inFlight: open7 };
63932
+ return { callsObserved, refused: refused3, inFlight: open7 };
63685
63933
  },
63686
63934
  close: () => {
63687
63935
  clearInterval(keepAliveTimer);
@@ -64069,6 +64317,9 @@ function createModelSteering(deps) {
64069
64317
  const failures = changedFailureLog(
64070
64318
  (detail) => deps.log(`model steering: ${detail}; the model call was refused`)
64071
64319
  );
64320
+ const overBudgetLog = changedFailureLog(
64321
+ (detail) => deps.log(`model steering: ${detail}`)
64322
+ );
64072
64323
  return async (request4) => {
64073
64324
  if (!request4.session || request4.api === "other")
64074
64325
  return { ...request4, steeringStatus: "unbound" };
@@ -64108,7 +64359,11 @@ function createModelSteering(deps) {
64108
64359
  MODEL_STEERING_PATH,
64109
64360
  {
64110
64361
  session_uuid: request4.session.sessionUuid,
64111
- context: { ...context, ...observed, files: files2 }
64362
+ context: { ...context, ...observed, files: files2 },
64363
+ // Ask for the workspace's over-budget choice. A control plane that
64364
+ // predates it would refuse the field, but the API deploys before
64365
+ // the CLI that sends it is published.
64366
+ over_budget: true
64112
64367
  },
64113
64368
  signal
64114
64369
  );
@@ -64129,7 +64384,8 @@ function createModelSteering(deps) {
64129
64384
  const rendered = renderedModelSteeringSchema.parse(
64130
64385
  JSON.parse(answer.text)
64131
64386
  );
64132
- if (mandatorySteeringCut(rendered.manifest)) {
64387
+ const overBudget = overBudgetAction(rendered);
64388
+ if (overBudget === "stop") {
64133
64389
  failures.failed("required steering exceeds the added-text budget");
64134
64390
  return {
64135
64391
  ...request4,
@@ -64138,12 +64394,22 @@ function createModelSteering(deps) {
64138
64394
  steeringFailure: { reason: "budget" }
64139
64395
  };
64140
64396
  }
64397
+ if (overBudget === "warn")
64398
+ overBudgetLog.failed(
64399
+ `${requiredBudgetCuts(rendered.manifest).length} required records did not fit the steering budget; the call was sent with the steering that fit, because the workspace's over_budget is warn`
64400
+ );
64401
+ else overBudgetLog.clear();
64141
64402
  failures.clear();
64142
64403
  return {
64143
64404
  ...request4,
64144
- json: withModelSteering(request4.json, request4.api, rendered.text),
64405
+ json: withModelSteering(
64406
+ request4.json,
64407
+ request4.api,
64408
+ overBudget === "warn" ? withOverBudgetWarning(rendered.text, rendered.manifest) : rendered.text
64409
+ ),
64145
64410
  steeringManifest: rendered.manifest,
64146
- steeringStatus: "rendered"
64411
+ steeringStatus: "rendered",
64412
+ ...overBudget === "recorded" || overBudget === "warn" ? { steeringOverBudget: overBudget } : {}
64147
64413
  };
64148
64414
  } catch (error2) {
64149
64415
  failures.failed(error2 instanceof Error ? error2.message : String(error2));
@@ -64965,13 +65231,13 @@ var init_session_router = __esm({
64965
65231
  });
64966
65232
 
64967
65233
  // ../../packages/tacho/src/collector/refused.ts
64968
- import { readdirSync as readdirSync16, readFileSync as readFileSync22, statSync as statSync15 } from "node:fs";
64969
- import { join as join56 } from "node:path";
65234
+ import { readdirSync as readdirSync16, readFileSync as readFileSync23, statSync as statSync15 } from "node:fs";
65235
+ import { join as join57 } from "node:path";
64970
65236
  function refusalRetryable(refusal) {
64971
65237
  return refusal === "malformed" || refusal === "parked";
64972
65238
  }
64973
65239
  function refusedRecordPath(dir, event) {
64974
- return join56(
65240
+ return join57(
64975
65241
  dir,
64976
65242
  `${event.session_uuid}-${String(event.seq).padStart(8, "0")}.json`
64977
65243
  );
@@ -65020,7 +65286,7 @@ function readRefusedEntry(file) {
65020
65286
  let record2;
65021
65287
  let mtimeMs;
65022
65288
  try {
65023
- record2 = JSON.parse(readFileSync22(file, "utf8"));
65289
+ record2 = JSON.parse(readFileSync23(file, "utf8"));
65024
65290
  mtimeMs = statSync15(file).mtimeMs;
65025
65291
  } catch {
65026
65292
  return void 0;
@@ -65053,7 +65319,7 @@ function scanRefused(dir, now, limit = MAX_REFUSED_RETRIES_PER_PASS) {
65053
65319
  };
65054
65320
  const due = [];
65055
65321
  for (const name2 of names2) {
65056
- const entry2 = readRefusedEntry(join56(dir, name2));
65322
+ const entry2 = readRefusedEntry(join57(dir, name2));
65057
65323
  if (entry2 === void 0) continue;
65058
65324
  summary.total += 1;
65059
65325
  if (summary.lastRefusedAt === void 0 || entry2.refusedAt > summary.lastRefusedAt)
@@ -65089,8 +65355,8 @@ var init_refused = __esm({
65089
65355
  });
65090
65356
 
65091
65357
  // ../../packages/tacho/src/collector/spool.ts
65092
- import { existsSync as existsSync26, readFileSync as readFileSync23, unlinkSync as unlinkSync14 } from "node:fs";
65093
- import { join as join57 } from "node:path";
65358
+ import { existsSync as existsSync26, readFileSync as readFileSync24, unlinkSync as unlinkSync14 } from "node:fs";
65359
+ import { join as join58 } from "node:path";
65094
65360
  function sessionOwnedElsewhere(error2) {
65095
65361
  return error2.status === 403 && error2.body.includes(SESSION_OWNED_ELSEWHERE) && !sessionFramesRefused(error2);
65096
65362
  }
@@ -65358,12 +65624,12 @@ var init_spool = __esm({
65358
65624
  }
65359
65625
  /** Add a body to a quarantine record that was written without one. */
65360
65626
  stashBodyBeside(event, body2) {
65361
- const path2 = join57(
65627
+ const path2 = join58(
65362
65628
  this.options.quarantineDir,
65363
65629
  `${event.session_uuid}-${String(event.seq).padStart(8, "0")}.json`
65364
65630
  );
65365
65631
  try {
65366
- const record2 = JSON.parse(readFileSync23(path2, "utf8"));
65632
+ const record2 = JSON.parse(readFileSync24(path2, "utf8"));
65367
65633
  if (record2["body"] !== void 0) return;
65368
65634
  writeSensitiveFileAtomic(
65369
65635
  path2,
@@ -65531,11 +65797,11 @@ var init_spool = __esm({
65531
65797
  const now = this.options.now();
65532
65798
  for (const [session, until] of this.foreignSessions)
65533
65799
  if (until <= now) this.foreignSessions.delete(session);
65534
- const refused2 = batch.filter(
65800
+ const refused3 = batch.filter(
65535
65801
  (e) => this.foreignSessions.has(e.session_uuid)
65536
65802
  );
65537
- if (refused2.length === 0) return this.sendBatch(batch, bodies);
65538
- for (const event of refused2) {
65803
+ if (refused3.length === 0) return this.sendBatch(batch, bodies);
65804
+ for (const event of refused3) {
65539
65805
  const until = this.foreignSessions.get(event.session_uuid) ?? Infinity;
65540
65806
  const permanent = until === Infinity;
65541
65807
  this.stash(
@@ -65546,19 +65812,19 @@ var init_spool = __esm({
65546
65812
  permanent ? void 0 : until
65547
65813
  );
65548
65814
  }
65549
- this.markShipped(refused2);
65815
+ this.markShipped(refused3);
65550
65816
  this.options.log(
65551
- `quarantined ${refused2.length} event(s) from session(s) the control plane refuses`
65817
+ `quarantined ${refused3.length} event(s) from session(s) the control plane refuses`
65552
65818
  );
65553
65819
  const rest = batch.filter((e) => !this.foreignSessions.has(e.session_uuid));
65554
65820
  if (rest.length === 0)
65555
65821
  return {
65556
65822
  shipped: 0,
65557
- quarantined: refused2.length,
65823
+ quarantined: refused3.length,
65558
65824
  reachable: this.reachable
65559
65825
  };
65560
65826
  const result2 = await this.sendBatch(rest, bodies);
65561
- return { ...result2, quarantined: result2.quarantined + refused2.length };
65827
+ return { ...result2, quarantined: result2.quarantined + refused3.length };
65562
65828
  }
65563
65829
  /** Halve a refused batch and ship each half, stopping at the first that stalls. */
65564
65830
  async bisect(batch, bodies) {
@@ -66146,14 +66412,14 @@ __export(daemon_exports, {
66146
66412
  import {
66147
66413
  existsSync as existsSync27,
66148
66414
  readdirSync as readdirSync17,
66149
- readFileSync as readFileSync24,
66415
+ readFileSync as readFileSync25,
66150
66416
  renameSync as renameSync6,
66151
66417
  statSync as statSync16,
66152
66418
  unlinkSync as unlinkSync15
66153
66419
  } from "node:fs";
66154
66420
  import { readdir as readdir3, readFile as readFile3, stat as stat2 } from "node:fs/promises";
66155
66421
  import { homedir as homedir9, hostname as osHostname2 } from "node:os";
66156
- import { dirname as dirname33, join as join58 } from "node:path";
66422
+ import { dirname as dirname33, join as join59 } from "node:path";
66157
66423
  import { spawnSync as spawnSync6 } from "node:child_process";
66158
66424
  function cloudGatewayUpstreams(origin = CLOUD_GATEWAY_ORIGIN) {
66159
66425
  const base2 = new URL(origin).origin;
@@ -66194,7 +66460,7 @@ function cloudGatewayCredentialStore(disk, runToken) {
66194
66460
  }
66195
66461
  function readTextOrUndefined(path2) {
66196
66462
  try {
66197
- return readFileSync24(path2, "utf8");
66463
+ return readFileSync25(path2, "utf8");
66198
66464
  } catch {
66199
66465
  return void 0;
66200
66466
  }
@@ -67216,7 +67482,7 @@ async function initializeDaemon(options, server, port, ready, clock2) {
67216
67482
  controlReachable: lastControlAt !== void 0 && now() - lastControlAt < 2 * timers.bundleRefreshMs
67217
67483
  };
67218
67484
  }
67219
- const bodyPurgeOwedPath = join58(paths.wal, "body-purge-owed");
67485
+ const bodyPurgeOwedPath = join59(paths.wal, "body-purge-owed");
67220
67486
  function markBodyPurgeOwed(retention, dropped) {
67221
67487
  try {
67222
67488
  ensureDir(paths.wal);
@@ -67238,7 +67504,7 @@ async function initializeDaemon(options, server, port, ready, clock2) {
67238
67504
  if (!existsSync27(bodyPurgeOwedPath)) return void 0;
67239
67505
  let text6;
67240
67506
  try {
67241
- text6 = readFileSync24(bodyPurgeOwedPath, "utf8");
67507
+ text6 = readFileSync25(bodyPurgeOwedPath, "utf8");
67242
67508
  } catch (error2) {
67243
67509
  log(
67244
67510
  `cannot read the owed body purge at ${bodyPurgeOwedPath}: ${error2 instanceof Error ? error2.message : String(error2)}; the retry sweeps against the clause in force. Check the file's permissions`
@@ -67572,7 +67838,7 @@ async function initializeDaemon(options, server, port, ready, clock2) {
67572
67838
  }
67573
67839
  void workOrderAutostart.reconcile();
67574
67840
  }
67575
- const lastIngestFile = join58(paths.dir, "last-ingest.json");
67841
+ const lastIngestFile = join59(paths.dir, "last-ingest.json");
67576
67842
  const shipper = new Shipper({
67577
67843
  wal,
67578
67844
  client,
@@ -67609,7 +67875,7 @@ async function initializeDaemon(options, server, port, ready, clock2) {
67609
67875
  read: () => {
67610
67876
  try {
67611
67877
  const at2 = Date.parse(
67612
- JSON.parse(readFileSync24(lastIngestFile, "utf8")).at ?? ""
67878
+ JSON.parse(readFileSync25(lastIngestFile, "utf8")).at ?? ""
67613
67879
  );
67614
67880
  return Number.isFinite(at2) ? at2 : void 0;
67615
67881
  } catch {
@@ -67800,7 +68066,7 @@ async function initializeDaemon(options, server, port, ready, clock2) {
67800
68066
  `subagent transcript ${path2} not read: this collector holds no session ${sessionId}`
67801
68067
  );
67802
68068
  else if ((session.harness ?? "claude-code") !== "claude-code" || readSubagentMeta(
67803
- readTextOrUndefined,
68069
+ (file) => readAgentTextOrUndefined(file),
67804
68070
  subagentMetaPaths(session.transcriptPath, agentId, path2)
67805
68071
  ) !== void 0)
67806
68072
  log(
@@ -68126,7 +68392,7 @@ async function initializeDaemon(options, server, port, ready, clock2) {
68126
68392
  async function readSpoolFile(name2) {
68127
68393
  try {
68128
68394
  const file = parseSpoolFile(
68129
- await readFile3(join58(paths.spool, name2), "utf8")
68395
+ await readFile3(join59(paths.spool, name2), "utf8")
68130
68396
  );
68131
68397
  spoolFacts.set(name2, spoolFactsOf(file));
68132
68398
  return file;
@@ -68176,6 +68442,7 @@ async function initializeDaemon(options, server, port, ready, clock2) {
68176
68442
  registry: registry3,
68177
68443
  policy,
68178
68444
  readText: readTextOrUndefined,
68445
+ readAgentText: (path2) => readAgentTextOrUndefined(path2),
68179
68446
  skillFolders: diskSkillFolderReader,
68180
68447
  home: options.home ?? homedir9(),
68181
68448
  // A hook waits a bounded time for a refresh and none during a
@@ -68345,7 +68612,7 @@ async function initializeDaemon(options, server, port, ready, clock2) {
68345
68612
  function setAsideConflictingTerminal(uuid2, pending, conflict) {
68346
68613
  const name2 = `${uuid2}-terminal-conflict-${String(conflict.seq).padStart(8, "0")}.json`;
68347
68614
  writeSensitiveFileAtomic(
68348
- join58(paths.quarantine, name2),
68615
+ join59(paths.quarantine, name2),
68349
68616
  JSON.stringify(
68350
68617
  {
68351
68618
  reason: conflict.message,
@@ -68429,8 +68696,8 @@ async function initializeDaemon(options, server, port, ready, clock2) {
68429
68696
  function moveToFailedSpool(path2, name2, reason3) {
68430
68697
  log(`spool file ${name2} moved to spool/failed/: ${reason3}`);
68431
68698
  try {
68432
- ensureDir(join58(paths.spool, "failed"));
68433
- renameSync6(path2, join58(paths.spool, "failed", name2));
68699
+ ensureDir(join59(paths.spool, "failed"));
68700
+ renameSync6(path2, join59(paths.spool, "failed", name2));
68434
68701
  } catch (error2) {
68435
68702
  log(
68436
68703
  `spool file ${name2} could not be moved to spool/failed/: ${error2 instanceof Error ? error2.message : String(error2)}`
@@ -68483,7 +68750,7 @@ async function initializeDaemon(options, server, port, ready, clock2) {
68483
68750
  continue;
68484
68751
  }
68485
68752
  reads += 1;
68486
- const path2 = join58(paths.spool, name2);
68753
+ const path2 = join59(paths.spool, name2);
68487
68754
  let file;
68488
68755
  try {
68489
68756
  file = await readSpoolFile(name2);
@@ -69405,7 +69672,7 @@ async function initializeDaemon(options, server, port, ready, clock2) {
69405
69672
  }
69406
69673
  function moveSpoolFile(path2, name2, target) {
69407
69674
  ensureDir(target.spoolDir);
69408
- renameSync6(path2, join58(target.spoolDir, name2));
69675
+ renameSync6(path2, join59(target.spoolDir, name2));
69409
69676
  spoolFacts.delete(name2);
69410
69677
  log(
69411
69678
  `spool file ${name2} moved to enrollment ${target.enrollmentId}, which owns its session`
@@ -69736,7 +70003,7 @@ async function initializeDaemon(options, server, port, ready, clock2) {
69736
70003
  let removed = 0;
69737
70004
  for (const name2 of readdirSync17(paths.quarantine)) {
69738
70005
  if (!name2.endsWith(".json")) continue;
69739
- const file = join58(paths.quarantine, name2);
70006
+ const file = join59(paths.quarantine, name2);
69740
70007
  try {
69741
70008
  const refusedAt = readRefusedEntry(file)?.refusedAt ?? statSync16(file).mtimeMs;
69742
70009
  if (at2 - refusedAt < retainMs) continue;
@@ -70151,7 +70418,7 @@ async function initializeDaemon(options, server, port, ready, clock2) {
70151
70418
  const memorySends = /* @__PURE__ */ new Set();
70152
70419
  let memoryStoreWatch;
70153
70420
  if (options.listen ?? true) {
70154
- const codexStore = join58(dirname33(paths.codexHooks), CODEX_MEMORY_STORE_FILE);
70421
+ const codexStore = join59(dirname33(paths.codexHooks), CODEX_MEMORY_STORE_FILE);
70155
70422
  const codexMemories = createCodexMemoryStore({
70156
70423
  path: codexStore,
70157
70424
  stat: (path2) => stat2(path2),
@@ -70492,6 +70759,7 @@ var init_daemon = __esm({
70492
70759
  init_interjection2();
70493
70760
  init_refused();
70494
70761
  init_session_heads();
70762
+ init_agent_file();
70495
70763
  init_subagent_meta();
70496
70764
  init_transcript_tailer();
70497
70765
  IDLE_COMMAND_POLL_FACTOR = 8;
@@ -70796,7 +71064,7 @@ var init_sandbox_launch = __esm({
70796
71064
  // ../../packages/tacho/src/cli/agent-run.ts
70797
71065
  import { spawn as spawn7 } from "node:child_process";
70798
71066
  import { randomUUID as randomUUID3 } from "node:crypto";
70799
- import { constants as constants6 } from "node:os";
71067
+ import { constants as constants7 } from "node:os";
70800
71068
  import { posix as posix5, win32 as win325 } from "node:path";
70801
71069
  function programName(program2) {
70802
71070
  const base2 = (program2.includes("\\") ? win325 : posix5).basename(program2);
@@ -70822,7 +71090,7 @@ function sessionRefusal2(stdout) {
70822
71090
  function exitCodeOf3(exit) {
70823
71091
  if (exit.error !== void 0) return 1;
70824
71092
  if (exit.code !== null) return exit.code;
70825
- const number5 = exit.signal !== null ? constants6.signals[exit.signal] : void 0;
71093
+ const number5 = exit.signal !== null ? constants7.signals[exit.signal] : void 0;
70826
71094
  return number5 !== void 0 ? 128 + number5 : 1;
70827
71095
  }
70828
71096
  function spawnAgent(command2, args, options) {
@@ -71614,7 +71882,7 @@ async function switchLocked(home, target, options) {
71614
71882
  }
71615
71883
  }
71616
71884
  const generations = { ...connection.generations };
71617
- const refused2 = [];
71885
+ const refused3 = [];
71618
71886
  for (const agent of toConnect) {
71619
71887
  try {
71620
71888
  const answer = await clientFor2(agent).setConnection("pending");
@@ -71627,14 +71895,14 @@ async function switchLocked(home, target, options) {
71627
71895
  });
71628
71896
  } catch (error2) {
71629
71897
  const message2 = messageOf5(error2);
71630
- refused2.push(`${agent.host.agent_key}: ${message2}`);
71898
+ refused3.push(`${agent.host.agent_key}: ${message2}`);
71631
71899
  outcomes.push({ ...described(agent.host), state: "failed", message: message2 });
71632
71900
  }
71633
71901
  }
71634
71902
  connection = {
71635
71903
  ...connection,
71636
71904
  generations,
71637
- ...refused2.length > 0 ? { state: "failed", failure: refused2.join(" ") } : {},
71905
+ ...refused3.length > 0 ? { state: "failed", failure: refused3.join(" ") } : {},
71638
71906
  changed_at: now().toISOString()
71639
71907
  };
71640
71908
  writeWorkspaceConnection(home, connection);
@@ -71756,11 +72024,11 @@ var init_workspace_switch = __esm({
71756
72024
  });
71757
72025
 
71758
72026
  // ../../packages/tacho/src/codegraph/harness-entries.ts
71759
- import { existsSync as existsSync28, readFileSync as readFileSync25 } from "node:fs";
71760
- import { dirname as dirname34, join as join59 } from "node:path";
72027
+ import { existsSync as existsSync28, readFileSync as readFileSync26 } from "node:fs";
72028
+ import { dirname as dirname34, join as join60 } from "node:path";
71761
72029
  function codexEntry(config2, deps) {
71762
72030
  const codexHome = dirname34(deps.paths.codexHooks);
71763
- const path2 = join59(codexHome, "config.toml");
72031
+ const path2 = join60(codexHome, "config.toml");
71764
72032
  if (!existsSync28(codexHome))
71765
72033
  return {
71766
72034
  harness: "codex",
@@ -71799,9 +72067,9 @@ function stellaEntry(host, deps, target) {
71799
72067
  }
71800
72068
  function repositoryStellaEntry(target) {
71801
72069
  if (target === void 0) return void 0;
71802
- const file = join59(target, ".stella", "mcp.toml");
72070
+ const file = join60(target, ".stella", "mcp.toml");
71803
72071
  try {
71804
- return namesOxagenServer(readFileSync25(file, "utf8")) ? `${file} has its own oxagen server, which Stella uses in place of this one in a trusted checkout` : void 0;
72072
+ return namesOxagenServer(readFileSync26(file, "utf8")) ? `${file} has its own oxagen server, which Stella uses in place of this one in a trusted checkout` : void 0;
71805
72073
  } catch {
71806
72074
  return void 0;
71807
72075
  }
@@ -73207,7 +73475,7 @@ var require_command = __commonJS({
73207
73475
  var EventEmitter = __require("node:events").EventEmitter;
73208
73476
  var childProcess = __require("node:child_process");
73209
73477
  var path2 = __require("node:path");
73210
- var fs4 = __require("node:fs");
73478
+ var fs3 = __require("node:fs");
73211
73479
  var process2 = __require("node:process");
73212
73480
  var { Argument: Argument2, humanReadableArgName } = require_argument();
73213
73481
  var { CommanderError: CommanderError2 } = require_error();
@@ -74140,10 +74408,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
74140
74408
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
74141
74409
  function findFile(baseDir, baseName) {
74142
74410
  const localBin = path2.resolve(baseDir, baseName);
74143
- if (fs4.existsSync(localBin)) return localBin;
74411
+ if (fs3.existsSync(localBin)) return localBin;
74144
74412
  if (sourceExt.includes(path2.extname(baseName))) return void 0;
74145
74413
  const foundExt = sourceExt.find(
74146
- (ext) => fs4.existsSync(`${localBin}${ext}`)
74414
+ (ext) => fs3.existsSync(`${localBin}${ext}`)
74147
74415
  );
74148
74416
  if (foundExt) return `${localBin}${foundExt}`;
74149
74417
  return void 0;
@@ -74155,7 +74423,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
74155
74423
  if (this._scriptPath) {
74156
74424
  let resolvedScriptPath;
74157
74425
  try {
74158
- resolvedScriptPath = fs4.realpathSync(this._scriptPath);
74426
+ resolvedScriptPath = fs3.realpathSync(this._scriptPath);
74159
74427
  } catch (err2) {
74160
74428
  resolvedScriptPath = this._scriptPath;
74161
74429
  }
@@ -75291,8 +75559,8 @@ var init_esm = __esm({
75291
75559
  });
75292
75560
 
75293
75561
  // ../../packages/tacho/src/collector/run.ts
75294
- import { readFileSync as readFileSync26, realpathSync as realpathSync7, statSync as statSync17, unlinkSync as unlinkSync16 } from "node:fs";
75295
- import { dirname as dirname35, join as join60 } from "node:path";
75562
+ import { readFileSync as readFileSync27, realpathSync as realpathSync7, statSync as statSync17, unlinkSync as unlinkSync16 } from "node:fs";
75563
+ import { dirname as dirname35, join as join61 } from "node:path";
75296
75564
  function stopWithin(stop, graceMs, exit, log) {
75297
75565
  const timer = setTimeout(() => {
75298
75566
  log(`recorderd: stop did not finish within ${graceMs} ms, exiting
@@ -75354,7 +75622,7 @@ function writeDaemonPid(path2, now = /* @__PURE__ */ new Date(), execPath = proc
75354
75622
  420
75355
75623
  );
75356
75624
  }
75357
- function installedCliVersion(entry2 = process.argv[1], read2 = (path2) => readFileSync26(path2, "utf8"), realpath4 = realpathSync7) {
75625
+ function installedCliVersion(entry2 = process.argv[1], read2 = (path2) => readFileSync27(path2, "utf8"), realpath4 = realpathSync7) {
75358
75626
  if (entry2 === void 0) return void 0;
75359
75627
  let dir;
75360
75628
  try {
@@ -75364,7 +75632,7 @@ function installedCliVersion(entry2 = process.argv[1], read2 = (path2) => readFi
75364
75632
  }
75365
75633
  for (let depth = 0; depth < CLI_PACKAGE_DEPTH_MAX; depth += 1) {
75366
75634
  try {
75367
- const pkg = JSON.parse(read2(join60(dir, "package.json")));
75635
+ const pkg = JSON.parse(read2(join61(dir, "package.json")));
75368
75636
  if (pkg.name === "@oxagen/cli")
75369
75637
  return typeof pkg.version === "string" ? pkg.version : void 0;
75370
75638
  } catch {
@@ -75381,7 +75649,7 @@ function processProbe() {
75381
75649
  native: isNativeBuild(),
75382
75650
  execPath: process.execPath,
75383
75651
  platform: process.platform,
75384
- read: (path2) => readFileSync26(path2, "utf8"),
75652
+ read: (path2) => readFileSync27(path2, "utf8"),
75385
75653
  realpath: realpathSync7,
75386
75654
  stat: statSync17,
75387
75655
  exists: (path2) => {
@@ -75441,14 +75709,14 @@ function ownProcStart() {
75441
75709
  }
75442
75710
  function readPidFile(path2) {
75443
75711
  try {
75444
- return readFileSync26(path2, "utf8");
75712
+ return readFileSync27(path2, "utf8");
75445
75713
  } catch {
75446
75714
  return void 0;
75447
75715
  }
75448
75716
  }
75449
75717
  function releaseDaemonPid(path2, previous) {
75450
75718
  try {
75451
- if (parseDaemonPid(readFileSync26(path2, "utf8"))?.pid !== process.pid) return;
75719
+ if (parseDaemonPid(readFileSync27(path2, "utf8"))?.pid !== process.pid) return;
75452
75720
  if (previous === void 0) unlinkSync16(path2);
75453
75721
  else writeSensitiveFileAtomic(path2, previous, 420);
75454
75722
  } catch {
@@ -75625,17 +75893,17 @@ var init_run2 = __esm({
75625
75893
 
75626
75894
  // ../../packages/tacho/src/arp/bundle.ts
75627
75895
  import {
75628
- closeSync as closeSync9,
75629
- constants as constants7,
75630
- fstatSync as fstatSync2,
75896
+ closeSync as closeSync10,
75897
+ constants as constants8,
75898
+ fstatSync as fstatSync3,
75631
75899
  lstatSync as lstatSync11,
75632
75900
  mkdirSync as mkdirSync10,
75633
- openSync as openSync9,
75901
+ openSync as openSync10,
75634
75902
  readSync as readSync5,
75635
75903
  realpathSync as realpathSync8,
75636
75904
  writeFileSync as writeFileSync7
75637
75905
  } from "node:fs";
75638
- import { dirname as dirname36, join as join61, resolve as resolve22 } from "node:path";
75906
+ import { dirname as dirname36, join as join62, resolve as resolve22 } from "node:path";
75639
75907
  function bundlePath(root, relative11, create2 = false) {
75640
75908
  const absolute = resolve22(root);
75641
75909
  if (create2) mkdirSync10(absolute, { recursive: true, mode: 448 });
@@ -75646,7 +75914,7 @@ function bundlePath(root, relative11, create2 = false) {
75646
75914
  let current = base2;
75647
75915
  const parts = relative11.split("/");
75648
75916
  for (let i2 = 0; i2 < parts.length; i2++) {
75649
- current = join61(current, parts[i2]);
75917
+ current = join62(current, parts[i2]);
75650
75918
  try {
75651
75919
  const stat7 = lstatSync11(current);
75652
75920
  if (stat7.isSymbolicLink() || i2 < parts.length - 1 && !stat7.isDirectory()) {
@@ -75667,9 +75935,9 @@ function bundlePath(root, relative11, create2 = false) {
75667
75935
  }
75668
75936
  function readBounded(root, relative11, limit = ARP_MAX_BLOB_BYTES) {
75669
75937
  const path2 = bundlePath(root, relative11);
75670
- const fd2 = openSync9(path2, constants7.O_RDONLY | constants7.O_NOFOLLOW);
75938
+ const fd2 = openSync10(path2, constants8.O_RDONLY | constants8.O_NOFOLLOW);
75671
75939
  try {
75672
- const stat7 = fstatSync2(fd2);
75940
+ const stat7 = fstatSync3(fd2);
75673
75941
  if (!stat7.isFile() || stat7.size > limit)
75674
75942
  arpFail(
75675
75943
  `The bundle file ${relative11} is not a regular file of at most ${limit} bytes.`
@@ -75686,20 +75954,20 @@ function readBounded(root, relative11, limit = ARP_MAX_BLOB_BYTES) {
75686
75954
  arpFail(`The bundle file ${relative11} changed while it was read.`);
75687
75955
  return bytes;
75688
75956
  } finally {
75689
- closeSync9(fd2);
75957
+ closeSync10(fd2);
75690
75958
  }
75691
75959
  }
75692
75960
  function writeNew2(root, relative11, bytes) {
75693
75961
  const path2 = bundlePath(root, relative11, true);
75694
- const fd2 = openSync9(
75962
+ const fd2 = openSync10(
75695
75963
  path2,
75696
- constants7.O_WRONLY | constants7.O_CREAT | constants7.O_EXCL | constants7.O_NOFOLLOW,
75964
+ constants8.O_WRONLY | constants8.O_CREAT | constants8.O_EXCL | constants8.O_NOFOLLOW,
75697
75965
  384
75698
75966
  );
75699
75967
  try {
75700
75968
  writeFileSync7(fd2, bytes);
75701
75969
  } finally {
75702
- closeSync9(fd2);
75970
+ closeSync10(fd2);
75703
75971
  }
75704
75972
  }
75705
75973
  function blobPath(ref) {
@@ -76599,18 +76867,18 @@ var init_oracles = __esm({
76599
76867
  // ../../packages/tacho/src/arp/transfer.ts
76600
76868
  import { randomUUID as randomUUID4 } from "node:crypto";
76601
76869
  import {
76602
- closeSync as closeSync10,
76603
- constants as constants8,
76604
- fstatSync as fstatSync3,
76870
+ closeSync as closeSync11,
76871
+ constants as constants9,
76872
+ fstatSync as fstatSync4,
76605
76873
  lstatSync as lstatSync12,
76606
76874
  mkdirSync as mkdirSync11,
76607
- openSync as openSync10,
76875
+ openSync as openSync11,
76608
76876
  readSync as readSync6,
76609
76877
  realpathSync as realpathSync9,
76610
76878
  rmSync as rmSync13,
76611
76879
  writeFileSync as writeFileSync8
76612
76880
  } from "node:fs";
76613
- import { dirname as dirname37, isAbsolute as isAbsolute16, join as join62, relative as relative6, resolve as resolve23, sep as sep8 } from "node:path";
76881
+ import { dirname as dirname37, isAbsolute as isAbsolute16, join as join63, relative as relative6, resolve as resolve23, sep as sep8 } from "node:path";
76614
76882
  function outsideProfile(path2) {
76615
76883
  return HARNESS_CONFIG_PATH.test(path2) || CREDENTIAL_PATH.test(path2);
76616
76884
  }
@@ -76621,9 +76889,9 @@ function sameJson(bytes, expected) {
76621
76889
  return jcs(JSON.parse(bytes.toString("utf8"))) === jcs(expected);
76622
76890
  }
76623
76891
  function readRegular(label, path2, limit) {
76624
- const fd2 = openSync10(path2, constants8.O_RDONLY | constants8.O_NOFOLLOW);
76892
+ const fd2 = openSync11(path2, constants9.O_RDONLY | constants9.O_NOFOLLOW);
76625
76893
  try {
76626
- const before = fstatSync3(fd2);
76894
+ const before = fstatSync4(fd2);
76627
76895
  if (!before.isFile() || before.size > limit)
76628
76896
  arpFail(`${label} ${path2} is not a regular file of at most ${limit} bytes.`);
76629
76897
  const bytes = Buffer.alloc(before.size);
@@ -76640,7 +76908,7 @@ function readRegular(label, path2, limit) {
76640
76908
  arpFail(
76641
76909
  `${label} ${path2} grew while it was read. Stop its writer and capture again.`
76642
76910
  );
76643
- const after = fstatSync3(fd2);
76911
+ const after = fstatSync4(fd2);
76644
76912
  if (before.size !== after.size || before.mtimeMs !== after.mtimeMs || before.ctimeMs !== after.ctimeMs) {
76645
76913
  arpFail(
76646
76914
  `${label} ${path2} changed while it was read. Stop its writer and capture again.`
@@ -76648,7 +76916,7 @@ function readRegular(label, path2, limit) {
76648
76916
  }
76649
76917
  return { bytes, mode: before.mode };
76650
76918
  } finally {
76651
- closeSync10(fd2);
76919
+ closeSync11(fd2);
76652
76920
  }
76653
76921
  }
76654
76922
  function rejectSecrets(label, bytes) {
@@ -76664,7 +76932,7 @@ function within2(root, path2) {
76664
76932
  }
76665
76933
  function newPath(path2) {
76666
76934
  const full = resolve23(path2);
76667
- return join62(
76935
+ return join63(
76668
76936
  realpathSync9(dirname37(full)),
76669
76937
  full.slice(dirname37(full).length + 1)
76670
76938
  );
@@ -76678,7 +76946,7 @@ function sourcePath(root, path2) {
76678
76946
  }
76679
76947
  let current = root;
76680
76948
  for (const part of path2.split("/")) {
76681
- current = join62(current, part);
76949
+ current = join63(current, part);
76682
76950
  if (lstatSync12(current).isSymbolicLink())
76683
76951
  arpFail(
76684
76952
  `${path2} is a symlink or passes through one. Symlinks require a resource adapter.`
@@ -76945,10 +77213,10 @@ function prepareCheckpoint(options) {
76945
77213
  });
76946
77214
  mkdirSync11(destination, { mode: 448 });
76947
77215
  try {
76948
- const restored = join62(destination, "workspace");
77216
+ const restored = join63(destination, "workspace");
76949
77217
  mkdirSync11(restored, { mode: 448 });
76950
77218
  for (const item of restore) {
76951
- const path2 = join62(restored, item.path);
77219
+ const path2 = join63(restored, item.path);
76952
77220
  if (item.kind === "directory")
76953
77221
  mkdirSync11(path2, { recursive: true, mode: 448 });
76954
77222
  else {
@@ -76959,9 +77227,9 @@ function prepareCheckpoint(options) {
76959
77227
  });
76960
77228
  }
76961
77229
  }
76962
- const promptDir = join62(restored, ".arp");
77230
+ const promptDir = join63(restored, ".arp");
76963
77231
  mkdirSync11(promptDir, { mode: 448 });
76964
- const promptFile = join62(promptDir, "handoff.json");
77232
+ const promptFile = join63(promptDir, "handoff.json");
76965
77233
  const prompt = {
76966
77234
  checkpoint_digest: checkpointDigest,
76967
77235
  task: task.data.request,
@@ -76978,7 +77246,7 @@ function prepareCheckpoint(options) {
76978
77246
  flag: "wx",
76979
77247
  mode: 384
76980
77248
  });
76981
- const reportPath = join62(destination, "report.json");
77249
+ const reportPath = join63(destination, "report.json");
76982
77250
  writeFileSync8(
76983
77251
  reportPath,
76984
77252
  jcs(
@@ -77246,7 +77514,7 @@ __export(main_exports, {
77246
77514
  recordedCliDeps: () => recordedCliDeps,
77247
77515
  tokenOption: () => tokenOption
77248
77516
  });
77249
- import { readFileSync as readFileSync27 } from "node:fs";
77517
+ import { readFileSync as readFileSync28 } from "node:fs";
77250
77518
  function parsePort(value) {
77251
77519
  const port = Number(value);
77252
77520
  if (!/^\d+$/.test(value) || port < 1024 || port > 65535)
@@ -77283,7 +77551,7 @@ function parseOneHarness(value) {
77283
77551
  throw new InvalidArgumentError("name one harness");
77284
77552
  return harness;
77285
77553
  }
77286
- function tokenOption(opts, err2, readStdin3 = () => readFileSync27(0, "utf8")) {
77554
+ function tokenOption(opts, err2, readStdin3 = () => readFileSync28(0, "utf8")) {
77287
77555
  const flag2 = opts.token;
77288
77556
  if (opts.tokenStdin !== true) {
77289
77557
  if (flag2 !== void 0)
@@ -77786,7 +78054,7 @@ var init_package = __esm({
77786
78054
  "package.json"() {
77787
78055
  package_default = {
77788
78056
  name: "@oxagen/cli",
77789
- version: "5.5.1-22",
78057
+ version: "5.5.1-95",
77790
78058
  description: "Oxagen governance CLI: spend, source tracking, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
77791
78059
  type: "module",
77792
78060
  main: "./dist/index.js",
@@ -77855,10 +78123,10 @@ var init_package = __esm({
77855
78123
 
77856
78124
  // src/lib/atomic-write.ts
77857
78125
  import { writeFileSync as writeFileSync9, renameSync as renameSync7, unlinkSync as unlinkSync17, existsSync as existsSync29 } from "node:fs";
77858
- import { dirname as dirname38, join as join63 } from "node:path";
78126
+ import { dirname as dirname38, join as join64 } from "node:path";
77859
78127
  function atomicWriteFileSync(path2, data, mode) {
77860
78128
  const dir = dirname38(path2);
77861
- const tmp = join63(
78129
+ const tmp = join64(
77862
78130
  dir,
77863
78131
  `.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`
77864
78132
  );
@@ -77883,8 +78151,8 @@ var init_atomic_write = __esm({
77883
78151
 
77884
78152
  // src/lib/config.ts
77885
78153
  import { homedir as homedir10 } from "os";
77886
- import { join as join64 } from "path";
77887
- import { readFileSync as readFileSync28, mkdirSync as mkdirSync12, existsSync as existsSync30, statSync as statSync18 } from "fs";
78154
+ import { join as join65 } from "path";
78155
+ import { readFileSync as readFileSync29, mkdirSync as mkdirSync12, existsSync as existsSync30, statSync as statSync18 } from "fs";
77888
78156
  function getConfigDir() {
77889
78157
  return CONFIG_DIR;
77890
78158
  }
@@ -77930,7 +78198,7 @@ function readConfig() {
77930
78198
  }
77931
78199
  if (cached2?.identity === identity) return structuredClone(cached2.config);
77932
78200
  try {
77933
- const config2 = parseConfig(JSON.parse(readFileSync28(CONFIG_FILE, "utf8")));
78201
+ const config2 = parseConfig(JSON.parse(readFileSync29(CONFIG_FILE, "utf8")));
77934
78202
  cached2 = { identity, config: config2 };
77935
78203
  return structuredClone(config2);
77936
78204
  } catch (err2) {
@@ -77981,8 +78249,8 @@ var CONFIG_DIR, CONFIG_FILE, STRING_FIELDS, LINK_FIELDS, TELEMETRY_FIELDS, cache
77981
78249
  var init_config = __esm({
77982
78250
  "src/lib/config.ts"() {
77983
78251
  init_atomic_write();
77984
- CONFIG_DIR = join64(homedir10(), ".config", "oxagen");
77985
- CONFIG_FILE = join64(CONFIG_DIR, "config.json");
78252
+ CONFIG_DIR = join65(homedir10(), ".config", "oxagen");
78253
+ CONFIG_FILE = join65(CONFIG_DIR, "config.json");
77986
78254
  STRING_FIELDS = [
77987
78255
  "token",
77988
78256
  "orgSlug",
@@ -78035,16 +78303,16 @@ import {
78035
78303
  writeFile as writeFile2
78036
78304
  } from "node:fs/promises";
78037
78305
  import { homedir as homedir11 } from "node:os";
78038
- import { join as join65 } from "node:path";
78306
+ import { join as join66 } from "node:path";
78039
78307
  function isDebugEnabled() {
78040
78308
  const v = process.env[DEBUG_ENV];
78041
78309
  return v === "1" || v === "true";
78042
78310
  }
78043
78311
  function logsDir() {
78044
- return join65(homedir11(), ".oxagen", "logs");
78312
+ return join66(homedir11(), ".oxagen", "logs");
78045
78313
  }
78046
78314
  function debugLogFile() {
78047
- return join65(logsDir(), "cli.output");
78315
+ return join66(logsDir(), "cli.output");
78048
78316
  }
78049
78317
  function sanitize(value, depth = 0) {
78050
78318
  if (value === null || value === void 0) return value;
@@ -80651,7 +80919,7 @@ var init_revision = __esm({
80651
80919
  observations: unique(external_exports.string().min(1)),
80652
80920
  /** Each graph file the revision serves. */
80653
80921
  graphFiles: external_exports.array(graphFileRefSchema).min(1).refine(
80654
- (fs4) => new Set(fs4.map((f) => f.name)).size === fs4.length,
80922
+ (fs3) => new Set(fs3.map((f) => f.name)).size === fs3.length,
80655
80923
  "names a graph file twice"
80656
80924
  )
80657
80925
  }).strict();
@@ -89530,14 +89798,14 @@ var require_parser = __commonJS({
89530
89798
  case "scalar":
89531
89799
  case "single-quoted-scalar":
89532
89800
  case "double-quoted-scalar": {
89533
- const fs4 = this.flowScalar(this.type);
89801
+ const fs3 = this.flowScalar(this.type);
89534
89802
  if (atNextItem || it.value) {
89535
- map.items.push({ start, key: fs4, sep: [] });
89803
+ map.items.push({ start, key: fs3, sep: [] });
89536
89804
  this.onKeyLine = true;
89537
89805
  } else if (it.sep) {
89538
- this.stack.push(fs4);
89806
+ this.stack.push(fs3);
89539
89807
  } else {
89540
- Object.assign(it, { key: fs4, sep: [] });
89808
+ Object.assign(it, { key: fs3, sep: [] });
89541
89809
  this.onKeyLine = true;
89542
89810
  }
89543
89811
  return;
@@ -89665,13 +89933,13 @@ var require_parser = __commonJS({
89665
89933
  case "scalar":
89666
89934
  case "single-quoted-scalar":
89667
89935
  case "double-quoted-scalar": {
89668
- const fs4 = this.flowScalar(this.type);
89936
+ const fs3 = this.flowScalar(this.type);
89669
89937
  if (!it || it.value)
89670
- fc.items.push({ start: [], key: fs4, sep: [] });
89938
+ fc.items.push({ start: [], key: fs3, sep: [] });
89671
89939
  else if (it.sep)
89672
- this.stack.push(fs4);
89940
+ this.stack.push(fs3);
89673
89941
  else
89674
- Object.assign(it, { key: fs4, sep: [] });
89942
+ Object.assign(it, { key: fs3, sep: [] });
89675
89943
  return;
89676
89944
  }
89677
89945
  case "flow-map-end":
@@ -90633,7 +90901,7 @@ var init_src3 = __esm({
90633
90901
 
90634
90902
  // src/commands/codegraph-upload/files.ts
90635
90903
  import { readdir as readdir4, realpath as realpath2, stat as stat4 } from "node:fs/promises";
90636
- import { isAbsolute as isAbsolute17, join as join66, relative as relative7, sep as sep9 } from "node:path";
90904
+ import { isAbsolute as isAbsolute17, join as join67, relative as relative7, sep as sep9 } from "node:path";
90637
90905
  function hasGlobChars(pattern) {
90638
90906
  return /[*?[\]{}]/.test(pattern);
90639
90907
  }
@@ -90649,7 +90917,7 @@ async function walk(root, dir, out) {
90649
90917
  const entries2 = await readdir4(dir, { withFileTypes: true });
90650
90918
  for (const entry2 of entries2) {
90651
90919
  if (entry2.isSymbolicLink()) continue;
90652
- const full = join66(dir, entry2.name);
90920
+ const full = join67(dir, entry2.name);
90653
90921
  if (entry2.isDirectory()) {
90654
90922
  if (!SKIP_DIRS.has(entry2.name)) await walk(root, full, out);
90655
90923
  } else if (entry2.isFile()) {
@@ -90663,7 +90931,7 @@ async function expandPattern(root, pattern) {
90663
90931
  try {
90664
90932
  const [base2, file] = await Promise.all([
90665
90933
  realpath2(root),
90666
- realpath2(join66(root, wanted))
90934
+ realpath2(join67(root, wanted))
90667
90935
  ]);
90668
90936
  if (!isInside2(base2, file)) return [];
90669
90937
  const info = await stat4(file);
@@ -90743,12 +91011,12 @@ async function uploadFile(input) {
90743
91011
  message: `The endpoint answered ${response.status} with a body this step does not read. Update @oxagen/cli.`
90744
91012
  };
90745
91013
  }
90746
- const refused2 = uploadErrorSchema.safeParse(json2);
91014
+ const refused3 = uploadErrorSchema.safeParse(json2);
90747
91015
  return {
90748
91016
  ok: false,
90749
91017
  status: response.status,
90750
- code: refused2.success ? refused2.data.error.code : `http_${response.status}`,
90751
- message: refused2.success ? refused2.data.error.message : `The endpoint answered ${response.status}.`
91018
+ code: refused3.success ? refused3.data.error.code : `http_${response.status}`,
91019
+ message: refused3.success ? refused3.data.error.message : `The endpoint answered ${response.status}.`
90752
91020
  };
90753
91021
  }
90754
91022
  var VERSION;
@@ -90817,7 +91085,7 @@ var init_token = __esm({
90817
91085
  });
90818
91086
 
90819
91087
  // src/commands/codegraph-upload/run.ts
90820
- import { join as join67 } from "node:path";
91088
+ import { join as join68 } from "node:path";
90821
91089
  function addDropped(into, more) {
90822
91090
  into.sensitiveValues += more.sensitiveValues;
90823
91091
  into.secretData += more.secretData;
@@ -90835,7 +91103,7 @@ async function uploadOne(deps, config2, token, group, path2, totals2) {
90835
91103
  const label = `${group.kind}/${group.source} ${path2}`;
90836
91104
  let bytes;
90837
91105
  try {
90838
- bytes = await deps.readFile(join67(deps.cwd, path2));
91106
+ bytes = await deps.readFile(join68(deps.cwd, path2));
90839
91107
  } catch (error2) {
90840
91108
  totals2.failed += 1;
90841
91109
  deps.log(`error: ${label}: cannot read the file: ${error2.message}`);
@@ -91351,7 +91619,7 @@ __export(sandbox_run_exports, {
91351
91619
  sandboxesNotReleased: () => sandboxesNotReleased,
91352
91620
  scopeOrRefuse: () => scopeOrRefuse
91353
91621
  });
91354
- import { readFileSync as readFileSync29 } from "node:fs";
91622
+ import { readFileSync as readFileSync30 } from "node:fs";
91355
91623
  function refusalOf3(err2) {
91356
91624
  const text6 = errorMessage3(err2);
91357
91625
  const match = /^Error \d+ from \S+: ([\s\S]*)$/.exec(text6);
@@ -91441,7 +91709,7 @@ async function sandboxRun(opts, writer = stdoutWriter, deps = {}) {
91441
91709
  let prompt = opts.prompt;
91442
91710
  if (opts.promptFile !== void 0) {
91443
91711
  try {
91444
- prompt = (deps.readFile ?? ((p) => readFileSync29(p, "utf8")))(
91712
+ prompt = (deps.readFile ?? ((p) => readFileSync30(p, "utf8")))(
91445
91713
  opts.promptFile
91446
91714
  );
91447
91715
  } catch (err2) {
@@ -95480,7 +95748,7 @@ function der(tag, content) {
95480
95748
  out.set(content, head3.length);
95481
95749
  return out;
95482
95750
  }
95483
- function join68(parts) {
95751
+ function join69(parts) {
95484
95752
  const out = new Uint8Array(parts.reduce((n2, p) => n2 + p.length, 0));
95485
95753
  let at2 = 0;
95486
95754
  for (const p of parts) {
@@ -95547,10 +95815,10 @@ var init_der = __esm({
95547
95815
  SEQUENCE: 48,
95548
95816
  SET: 49
95549
95817
  };
95550
- seq = (...parts) => der(TAG.SEQUENCE, join68(parts));
95818
+ seq = (...parts) => der(TAG.SEQUENCE, join69(parts));
95551
95819
  setOf = (...parts) => der(
95552
95820
  TAG.SET,
95553
- join68(
95821
+ join69(
95554
95822
  [...parts].sort((a, b3) => {
95555
95823
  const n2 = Math.min(a.length, b3.length);
95556
95824
  for (let i2 = 0; i2 < n2; i2 += 1) {
@@ -95566,7 +95834,7 @@ var init_der = __esm({
95566
95834
  nullValue = () => der(TAG.NULL, new Uint8Array());
95567
95835
  bool3 = (v) => der(TAG.BOOLEAN, Uint8Array.of(v ? 255 : 0));
95568
95836
  utf8 = (text6) => der(TAG.UTF8_STRING, new TextEncoder().encode(text6));
95569
- bitString = (bytes) => der(TAG.BIT_STRING, join68([Uint8Array.of(0), bytes]));
95837
+ bitString = (bytes) => der(TAG.BIT_STRING, join69([Uint8Array.of(0), bytes]));
95570
95838
  }
95571
95839
  });
95572
95840
 
@@ -98263,9 +98531,9 @@ var init_host = __esm({
98263
98531
  });
98264
98532
 
98265
98533
  // src/lib/harnesses.ts
98266
- import { accessSync as accessSync4, constants as constants9, statSync as statSync19 } from "node:fs";
98534
+ import { accessSync as accessSync4, constants as constants10, statSync as statSync19 } from "node:fs";
98267
98535
  import { homedir as homedir12 } from "node:os";
98268
- import { delimiter as delimiter4, join as join69 } from "node:path";
98536
+ import { delimiter as delimiter4, join as join70 } from "node:path";
98269
98537
  async function terminalDirs() {
98270
98538
  const { harnessPath: harnessPath2, loginShellPath: loginShellPath2 } = await Promise.resolve().then(() => (init_host(), host_exports));
98271
98539
  const env = process.env;
@@ -98275,7 +98543,7 @@ async function terminalDirs() {
98275
98543
  function isExecutableFile(path2) {
98276
98544
  try {
98277
98545
  if (!statSync19(path2).isFile()) return false;
98278
- accessSync4(path2, constants9.X_OK);
98546
+ accessSync4(path2, constants10.X_OK);
98279
98547
  return true;
98280
98548
  } catch {
98281
98549
  return false;
@@ -98291,7 +98559,7 @@ async function detectHarnesses(deps = {}) {
98291
98559
  const found = [];
98292
98560
  for (const harness of WRAPPED_HARNESSES) {
98293
98561
  const names2 = commandNames(HARNESS_BINARY[harness], platform2);
98294
- const path2 = dirs.flatMap((dir) => names2.map((name2) => join69(dir, name2))).find(isExecutable2);
98562
+ const path2 = dirs.flatMap((dir) => names2.map((name2) => join70(dir, name2))).find(isExecutable2);
98295
98563
  if (path2 !== void 0) {
98296
98564
  found.push({ harness, label: harnessLabel2(harness), path: path2 });
98297
98565
  }
@@ -98338,13 +98606,13 @@ import {
98338
98606
  existsSync as existsSync31,
98339
98607
  lstatSync as lstatSync13,
98340
98608
  mkdirSync as mkdirSync13,
98341
- readFileSync as readFileSync30,
98609
+ readFileSync as readFileSync31,
98342
98610
  readdirSync as readdirSync18,
98343
98611
  realpathSync as realpathSync10,
98344
98612
  writeFileSync as writeFileSync10
98345
98613
  } from "node:fs";
98346
98614
  import { homedir as homedir13, hostname as osHostname3 } from "node:os";
98347
- import { join as join70, resolve as resolve24, sep as sep10 } from "node:path";
98615
+ import { join as join71, resolve as resolve24, sep as sep10 } from "node:path";
98348
98616
  function git3(cwd, args) {
98349
98617
  return new Promise((done) => {
98350
98618
  try {
@@ -98391,7 +98659,7 @@ function parseRemoteRepository(url2) {
98391
98659
  }
98392
98660
  function oxagenPresent(root) {
98393
98661
  try {
98394
- return readdirSync18(join70(root, ".oxagen")).some(
98662
+ return readdirSync18(join71(root, ".oxagen")).some(
98395
98663
  (name2) => name2 !== "workspace.json"
98396
98664
  );
98397
98665
  } catch {
@@ -98400,18 +98668,18 @@ function oxagenPresent(root) {
98400
98668
  }
98401
98669
  function symlinkState(root) {
98402
98670
  try {
98403
- if (!lstatSync13(join70(root, ".stella")).isDirectory()) return "none";
98671
+ if (!lstatSync13(join71(root, ".stella")).isDirectory()) return "none";
98404
98672
  } catch {
98405
98673
  return "none";
98406
98674
  }
98407
98675
  let oxagenReal;
98408
98676
  try {
98409
- oxagenReal = realpathSync10(join70(root, ".oxagen"));
98677
+ oxagenReal = realpathSync10(join71(root, ".oxagen"));
98410
98678
  } catch {
98411
98679
  return "missing";
98412
98680
  }
98413
98681
  for (const link of STELLA_LINKS) {
98414
- const at2 = join70(root, link);
98682
+ const at2 = join71(root, link);
98415
98683
  try {
98416
98684
  if (!lstatSync13(at2).isSymbolicLink()) return "missing";
98417
98685
  const target = realpathSync10(at2);
@@ -98425,11 +98693,11 @@ function symlinkState(root) {
98425
98693
  return "linked";
98426
98694
  }
98427
98695
  function machineId(configDir = getConfigDir()) {
98428
- const file = join70(configDir, MACHINE_ID_FILE);
98696
+ const file = join71(configDir, MACHINE_ID_FILE);
98429
98697
  let secret = null;
98430
98698
  try {
98431
98699
  if (existsSync31(file)) {
98432
- const stored = readFileSync30(file, "utf8").trim();
98700
+ const stored = readFileSync31(file, "utf8").trim();
98433
98701
  if (/^[0-9a-f]{64}$/.test(stored)) secret = stored;
98434
98702
  }
98435
98703
  if (secret === null) {
@@ -98887,10 +99155,10 @@ function scopeOf(opts, out) {
98887
99155
  }
98888
99156
  async function machineRegister(opts, writer = stdoutWriter, deps = {}) {
98889
99157
  const out = createOutput({ json: opts.json }, writer);
98890
- const refused2 = { ok: false, enrolled: false };
99158
+ const refused3 = { ok: false, enrolled: false };
98891
99159
  if (!opts.harness) {
98892
99160
  out.error(`Pass --harness: ${HARNESS_CHOICES}.`, "usage");
98893
- return refused2;
99161
+ return refused3;
98894
99162
  }
98895
99163
  const harness = harnessName(opts.harness);
98896
99164
  if (!isMachineHarness(harness)) {
@@ -98898,7 +99166,7 @@ async function machineRegister(opts, writer = stdoutWriter, deps = {}) {
98898
99166
  `--harness takes ${HARNESS_CHOICES}. "${opts.harness}" is not one.`,
98899
99167
  "usage"
98900
99168
  );
98901
- return refused2;
99169
+ return refused3;
98902
99170
  }
98903
99171
  const machineName = (opts.machineName ?? (deps.hostname ?? hostname2)()).trim();
98904
99172
  if (machineName === "") {
@@ -98906,10 +99174,10 @@ async function machineRegister(opts, writer = stdoutWriter, deps = {}) {
98906
99174
  opts.machineName === void 0 ? "This machine reports no host name. Pass --machine-name <name>." : "--machine-name is empty. Pass the machine's host name.",
98907
99175
  "usage"
98908
99176
  );
98909
- return refused2;
99177
+ return refused3;
98910
99178
  }
98911
99179
  const scope = scopeOf(opts, out);
98912
- if (!scope) return refused2;
99180
+ if (!scope) return refused3;
98913
99181
  let answer;
98914
99182
  try {
98915
99183
  answer = await apiPostOrThrow(
@@ -98927,7 +99195,7 @@ async function machineRegister(opts, writer = stdoutWriter, deps = {}) {
98927
99195
  } catch (err2) {
98928
99196
  const refusal = refusalOf3(err2);
98929
99197
  out.error(refusal.message, refusal.reason ?? "api");
98930
- return refused2;
99198
+ return refused3;
98931
99199
  }
98932
99200
  if (opts.enroll !== true) {
98933
99201
  if (out.isJson) {
@@ -99870,8 +100138,8 @@ async function workspaceConnect(argument, opts, writer = stdoutWriter, deps = {}
99870
100138
  const connection = await device.read();
99871
100139
  if (connection !== void 0 && connection.workspace_id !== found.id) {
99872
100140
  servedElsewhere = `${connection.org_slug}/${connection.workspace_slug}`;
99873
- const { failed: refused2 } = await device.standByOutside();
99874
- for (const outcome of refused2)
100141
+ const { failed: refused3 } = await device.standByOutside();
100142
+ for (const outcome of refused3)
99875
100143
  out.warn(
99876
100144
  `${outcome.agentKey} could not stop taking sends from ${outcome.workspace}: ${outcome.message ?? ""} This machine still refuses that work when it arrives.`
99877
100145
  );
@@ -101299,7 +101567,7 @@ function dayRangeSchemaOf(maxDays) {
101299
101567
  path: ["to"]
101300
101568
  });
101301
101569
  }
101302
- var costBasisSchema, microsSchema, moneySchema, costSchema, daySchema, monthSchema, SPEND_RANGE_DAYS_MAX, DAY_MS, dayRangeSchema, principalPublicIdSchema, tokenCountsSchema, standingTokensSchema, spendGroupKindSchema, ratioSchema, spendFigureSchema, spendDaySchema, unmeteredRunsSchema;
101570
+ var costBasisSchema, microsSchema, moneySchema, costSchema, daySchema, monthSchema, SPEND_RANGE_DAYS_MAX, DAY_MS, dayRangeSchema, principalPublicIdSchema, tokenCountsSchema, standingTokensSchema, spendGroupKindSchema, ratioSchema, FIGURES_PULL_REQUEST_URL_MAX, runFiguresSchema, spendFigureSchema, spendDaySchema, unmeteredRunsSchema;
101303
101571
  var init_spend_shared = __esm({
101304
101572
  "../../packages/oxagen/src/contracts/spend.shared.ts"() {
101305
101573
  "use strict";
@@ -101356,13 +101624,53 @@ var init_spend_shared = __esm({
101356
101624
  "cost_center"
101357
101625
  ]);
101358
101626
  ratioSchema = external_exports.number().min(0).max(1);
101627
+ FIGURES_PULL_REQUEST_URL_MAX = 50;
101628
+ runFiguresSchema = external_exports.object({
101629
+ tokens: external_exports.object({
101630
+ /** Every input class: uncached input, cache reads and cache writes. */
101631
+ input: external_exports.number().int().nonnegative(),
101632
+ /** Output and reasoning. */
101633
+ output: external_exports.number().int().nonnegative(),
101634
+ /** Input the cache served, inside `input`. */
101635
+ cacheRead: external_exports.number().int().nonnegative(),
101636
+ /** Input written to the cache, both lifetimes, inside `input`. */
101637
+ cacheWrite: external_exports.number().int().nonnegative(),
101638
+ /** `input` plus `output`. */
101639
+ total: external_exports.number().int().nonnegative()
101640
+ }).strict(),
101641
+ /**
101642
+ * Zero for a run that used no model. Null when a model was used and the
101643
+ * rollup could price none of it, or when a work item's runs cost in more
101644
+ * than one currency.
101645
+ */
101646
+ cost: costSchema.nullable(),
101647
+ /** A sum: zero when nothing shows a change. */
101648
+ lines: external_exports.object({
101649
+ added: external_exports.number().int().nonnegative(),
101650
+ removed: external_exports.number().int().nonnegative()
101651
+ }).strict(),
101652
+ /** How many pull requests, each once. */
101653
+ pullRequests: external_exports.number().int().nonnegative(),
101654
+ /** Their URLs in one standard form, sorted, up to FIGURES_PULL_REQUEST_URL_MAX. */
101655
+ pullRequestUrls: external_exports.array(external_exports.string().url()).max(FIGURES_PULL_REQUEST_URL_MAX),
101656
+ /**
101657
+ * True until the run ends and the rollup that read its end lands. A
101658
+ * work item's figures are an estimate while any of its runs' are.
101659
+ */
101660
+ estimate: external_exports.boolean()
101661
+ }).strict();
101359
101662
  spendFigureSchema = external_exports.object({
101360
101663
  /** Null when no frame in the group was priced. */
101361
101664
  cost: costSchema.nullable(),
101362
101665
  calls: external_exports.number().int().nonnegative(),
101363
101666
  runs: external_exports.number().int().nonnegative(),
101364
101667
  accepted: moneySchema.nullable(),
101365
- productiveRatio: ratioSchema.nullable()
101668
+ /**
101669
+ * Advanced steps over graded steps (ADR-199). It counts steps, never
101670
+ * spend: unproductive spend is what finding claims price (ADR-208,
101671
+ * ADR-8994). Null when no run in the group was graded.
101672
+ */
101673
+ advancedStepShare: ratioSchema.nullable()
101366
101674
  }).strict();
101367
101675
  spendDaySchema = external_exports.object({
101368
101676
  day: daySchema,
@@ -101546,6 +101854,8 @@ var init_workspace_settings = __esm({
101546
101854
  alwaysOnTokens: "alwaysOnTokens",
101547
101855
  /** The memory half-life: steering-repo/governance.ts. */
101548
101856
  memoryHalfLifeDays: "memoryHalfLifeDays",
101857
+ /** What a model call does when required steering does not fit: steering-repo/governance.ts. */
101858
+ steeringOverBudget: "steeringOverBudget",
101549
101859
  /** The provider search mode ranks with: steering-repo/workspace.ts. */
101550
101860
  embeddings: "embeddings",
101551
101861
  /** The Stella archive delay in days: steering-repo/workspace.ts. */
@@ -106745,6 +107055,9 @@ var init_steering_markdown_import_shared = __esm({
106745
107055
  function findingIdentity(finding) {
106746
107056
  return IDENTITIES.get(finding) ?? finding.message;
106747
107057
  }
107058
+ function identityIgnoresField(finding) {
107059
+ return FIELDLESS.has(finding);
107060
+ }
106748
107061
  function finder(check3) {
106749
107062
  return (init) => {
106750
107063
  const finding = {
@@ -106760,6 +107073,7 @@ function finder(check3) {
106760
107073
  };
106761
107074
  if (init.detail !== void 0) finding.detail = init.detail;
106762
107075
  if (init.identity !== void 0) IDENTITIES.set(finding, init.identity);
107076
+ if (init.identityIgnoresField === true) FIELDLESS.add(finding);
106763
107077
  return finding;
106764
107078
  };
106765
107079
  }
@@ -106774,11 +107088,12 @@ function sentence(message2) {
106774
107088
  const first = trimmed.charAt(0).toUpperCase() + trimmed.slice(1);
106775
107089
  return /[.?]$/.test(first) ? first : `${first}.`;
106776
107090
  }
106777
- var IDENTITIES;
107091
+ var IDENTITIES, FIELDLESS;
106778
107092
  var init_finding = __esm({
106779
107093
  "../../packages/steering-check/src/finding.ts"() {
106780
107094
  "use strict";
106781
107095
  IDENTITIES = /* @__PURE__ */ new WeakMap();
107096
+ FIELDLESS = /* @__PURE__ */ new WeakSet();
106782
107097
  }
106783
107098
  });
106784
107099
 
@@ -106809,7 +107124,7 @@ var init_toolbelt_shared = __esm({
106809
107124
  });
106810
107125
 
106811
107126
  // ../../packages/oxagen/src/contracts/agent.list.ts
106812
- var instant4, agentHarnessSchema, agentIdentityStatusSchema, agentEnforcementTierSchema, agentListItem, agentList;
107127
+ var instant4, AGENT_LIST_ORDERS, agentHarnessSchema, agentIdentityStatusSchema, agentEnforcementTierSchema, agentListItem, agentList;
106813
107128
  var init_agent_list = __esm({
106814
107129
  "../../packages/oxagen/src/contracts/agent.list.ts"() {
106815
107130
  "use strict";
@@ -106819,6 +107134,7 @@ var init_agent_list = __esm({
106819
107134
  init_spend_shared();
106820
107135
  init_toolbelt_shared();
106821
107136
  instant4 = external_exports.string().datetime({ offset: true });
107137
+ AGENT_LIST_ORDERS = ["slug", "updated"];
106822
107138
  agentHarnessSchema = external_exports.enum([
106823
107139
  "stella",
106824
107140
  "claude-code",
@@ -106943,7 +107259,13 @@ var init_agent_list = __esm({
106943
107259
  hosts: external_exports.number().int().nonnegative(),
106944
107260
  /** The hostname of the live host seen most recently; null when none is live. */
106945
107261
  host: external_exports.string().nullable(),
106946
- registeredAt: instant4
107262
+ registeredAt: instant4,
107263
+ /**
107264
+ * When a person last changed the agent: the later of the last write to its
107265
+ * row and to its principal, since a suspend or resume writes the principal
107266
+ * alone.
107267
+ */
107268
+ updatedAt: instant4
106947
107269
  }).strict();
106948
107270
  agentList = registerCapability({
106949
107271
  name: "list_agents",
@@ -106976,7 +107298,15 @@ var init_agent_list = __esm({
106976
107298
  * agent for work never sees one unless it asks. Pass the same value on
106977
107299
  * every page of one walk. The totals ignore it.
106978
107300
  */
106979
- includeRetired: external_exports.boolean().default(false)
107301
+ includeRetired: external_exports.boolean().default(false),
107302
+ /**
107303
+ * The walk's order: `slug`, or `updated` for the newest change first, by
107304
+ * the time `items[].updatedAt` carries. A caller that shows the newest
107305
+ * changes reads them from the first page this way. Pass the same value
107306
+ * on every page of one walk, because a cursor from the other order
107307
+ * starts over at the first page.
107308
+ */
107309
+ order: external_exports.enum(AGENT_LIST_ORDERS).default("slug")
106980
107310
  }).strict(),
106981
107311
  output: external_exports.object({
106982
107312
  items: external_exports.array(agentListItem).max(100),
@@ -109306,7 +109636,7 @@ var init_codegraph_settings = __esm({
109306
109636
  }).strict(),
109307
109637
  "repos"
109308
109638
  ).optional().describe(
109309
- "One row per linked code repository: its source tags and what its builds read. A repository with no row takes the defaults."
109639
+ "One row per linked code repository: its source tags and what its builds read. A repository with no row takes the defaults. Only a repository with a row gets the Code graph freshness check on its pull requests."
109310
109640
  )
109311
109641
  }).strict();
109312
109642
  CODEGRAPH_SOURCES_DEFAULTS = {
@@ -110010,10 +110340,11 @@ var init_delivery = __esm({
110010
110340
  });
110011
110341
 
110012
110342
  // ../../packages/oxagen/src/steering-repo/governance.ts
110013
- var ledgerRotationSchema, governanceSchema, ALWAYS_ON_TOKENS_SETTING, MEMORY_HALF_LIFE_SETTING;
110343
+ var ledgerRotationSchema, governanceSchema, ALWAYS_ON_TOKENS_SETTING, MEMORY_HALF_LIFE_SETTING, STEERING_OVER_BUDGET_SETTING;
110014
110344
  var init_governance = __esm({
110015
110345
  "../../packages/oxagen/src/steering-repo/governance.ts"() {
110016
110346
  "use strict";
110347
+ init_model_steering();
110017
110348
  init_zod();
110018
110349
  init_context_steering_shared();
110019
110350
  init_settings_bag();
@@ -110030,6 +110361,9 @@ var init_governance = __esm({
110030
110361
  steering: external_exports.object({
110031
110362
  always_on_tokens: external_exports.union([external_exports.number().int().positive(), external_exports.literal("off")]).optional().describe(
110032
110363
  "The always-on budget per code repository, or off. Unset inherits Oxagen's default, the largest harness hook limit. A budget above that limit fails the budget check."
110364
+ ),
110365
+ over_budget: steeringOverBudgetActionSchema.optional().describe(
110366
+ "What a model call does when the workspace's required steering does not fit the steering budget. none: send it with the steering that fits. recorded: send it and mark the run. warn: send it, mark the run, and warn the person. stop: refuse it until the steering fits. Unset is warn."
110033
110367
  )
110034
110368
  }).strict().optional(),
110035
110369
  ledger: external_exports.object({
@@ -110066,6 +110400,7 @@ var init_governance = __esm({
110066
110400
  );
110067
110401
  ALWAYS_ON_TOKENS_SETTING = WORKSPACE_SETTINGS_KEYS.alwaysOnTokens;
110068
110402
  MEMORY_HALF_LIFE_SETTING = WORKSPACE_SETTINGS_KEYS.memoryHalfLifeDays;
110403
+ STEERING_OVER_BUDGET_SETTING = WORKSPACE_SETTINGS_KEYS.steeringOverBudget;
110069
110404
  }
110070
110405
  });
110071
110406
 
@@ -111981,7 +112316,16 @@ var init_hash2 = __esm({
111981
112316
  field,
111982
112317
  message: published ? "The record changed, but its id and hash still name the published version." : "The record carries an id and hash that Oxagen did not write for this content.",
111983
112318
  expected: `id ${stamp.id} and hash ${stamp.hash}, or no id and hash before the merge.`,
111984
- fix: "Delete the id and hash lines. Oxagen writes them when the steering PR merges."
112319
+ fix: "Delete the id and hash lines. Oxagen writes them when the steering PR merges.",
112320
+ // Whether the record counts as published depends on the base: the
112321
+ // head run knows the base's records, and the base run, which has no
112322
+ // base of its own, knows only the index. An archived record leaves the
112323
+ // index, so the same stale stamp read as unpublished on the base and
112324
+ // published on the head, and every steering PR was blamed for it. The
112325
+ // stamp itself is the identity, so a stamp already on the production
112326
+ // branch stays old.
112327
+ identity: `${file.lineage} ${String(id2)} ${String(hash4)}`,
112328
+ identityIgnoresField: true
111985
112329
  })
111986
112330
  );
111987
112331
  }
@@ -113348,7 +113692,7 @@ function findingKey(finding) {
113348
113692
  finding.check,
113349
113693
  finding.rule,
113350
113694
  finding.path,
113351
- finding.field,
113695
+ identityIgnoresField(finding) ? null : finding.field,
113352
113696
  findingIdentity(finding)
113353
113697
  ]);
113354
113698
  }
@@ -114124,7 +114468,7 @@ __export(steering_import_exports, {
114124
114468
  });
114125
114469
  import { readdir as readdir5, realpath as realpath3, stat as stat5 } from "node:fs/promises";
114126
114470
  import { homedir as homedir14 } from "node:os";
114127
- import { basename as basename11, extname, join as join71, relative as relative9, sep as sep12 } from "node:path";
114471
+ import { basename as basename11, extname, join as join72, relative as relative9, sep as sep12 } from "node:path";
114128
114472
  function envDir2(env, key) {
114129
114473
  const value = env[key];
114130
114474
  return value === void 0 || value.trim() === "" ? null : value;
@@ -114132,34 +114476,34 @@ function envDir2(env, key) {
114132
114476
  function harnessHome(harness, env = process.env, home = homedir14()) {
114133
114477
  switch (harness) {
114134
114478
  case "claude-code": {
114135
- const config2 = envDir2(env, "CLAUDE_CONFIG_DIR") ?? join71(home, ".claude");
114479
+ const config2 = envDir2(env, "CLAUDE_CONFIG_DIR") ?? join72(home, ".claude");
114136
114480
  return {
114137
114481
  harness,
114138
114482
  folders: [
114139
114483
  {
114140
- dir: skillsRoot("claude-code", env, home) ?? join71(config2, "skills"),
114484
+ dir: skillsRoot("claude-code", env, home) ?? join72(config2, "skills"),
114141
114485
  mount: ".claude/skills"
114142
114486
  },
114143
- { dir: join71(config2, "commands"), mount: ".claude/commands" },
114144
- { dir: join71(config2, "agents"), mount: ".claude/agents" }
114487
+ { dir: join72(config2, "commands"), mount: ".claude/commands" },
114488
+ { dir: join72(config2, "agents"), mount: ".claude/agents" }
114145
114489
  ],
114146
114490
  instructions: [
114147
- { file: join71(config2, "CLAUDE.md"), filename: ".claude/CLAUDE.md" }
114491
+ { file: join72(config2, "CLAUDE.md"), filename: ".claude/CLAUDE.md" }
114148
114492
  ]
114149
114493
  };
114150
114494
  }
114151
114495
  case "codex": {
114152
- const codexHome = envDir2(env, "CODEX_HOME") ?? join71(home, ".codex");
114496
+ const codexHome = envDir2(env, "CODEX_HOME") ?? join72(home, ".codex");
114153
114497
  return {
114154
114498
  harness,
114155
114499
  folders: [
114156
114500
  {
114157
- dir: skillsRoot("codex", env, home) ?? join71(home, ".agents", "skills"),
114501
+ dir: skillsRoot("codex", env, home) ?? join72(home, ".agents", "skills"),
114158
114502
  mount: ".agents/skills"
114159
114503
  }
114160
114504
  ],
114161
114505
  instructions: ["AGENTS.override.md", "AGENTS.md"].map((name2) => ({
114162
- file: join71(codexHome, name2),
114506
+ file: join72(codexHome, name2),
114163
114507
  filename: `.codex/${name2}`
114164
114508
  }))
114165
114509
  };
@@ -114168,8 +114512,8 @@ function harnessHome(harness, env = process.env, home = homedir14()) {
114168
114512
  return {
114169
114513
  harness,
114170
114514
  folders: [
114171
- { dir: join71(home, ".cursor", "skills"), mount: ".cursor/skills" },
114172
- { dir: join71(home, ".cursor", "commands"), mount: ".cursor/commands" }
114515
+ { dir: join72(home, ".cursor", "skills"), mount: ".cursor/skills" },
114516
+ { dir: join72(home, ".cursor", "commands"), mount: ".cursor/commands" }
114173
114517
  ],
114174
114518
  instructions: []
114175
114519
  };
@@ -114215,7 +114559,7 @@ async function findMarkdownFiles(paths, harness) {
114215
114559
  }
114216
114560
  const found = [];
114217
114561
  for (const entry2 of entries2.sort(byName)) {
114218
- const path2 = join71(dir, entry2.name);
114562
+ const path2 = join72(dir, entry2.name);
114219
114563
  if (entry2.isDirectory()) {
114220
114564
  if (!entry2.name.startsWith(".") && entry2.name !== "node_modules")
114221
114565
  found.push(...await filesUnder(path2, from));
@@ -114237,7 +114581,7 @@ async function findMarkdownFiles(paths, harness) {
114237
114581
  const { folder } = frame2;
114238
114582
  const named2 = (rel) => frame2.fixedNames ? { filename: rel } : {};
114239
114583
  for (const entry2 of entries2) {
114240
- const path2 = join71(dir, entry2.name);
114584
+ const path2 = join72(dir, entry2.name);
114241
114585
  const rel = frame2.relOf(path2);
114242
114586
  if (entry2.isDirectory()) {
114243
114587
  if (entry2.name === "node_modules") continue;
@@ -114296,7 +114640,7 @@ async function findMarkdownFiles(paths, harness) {
114296
114640
  }
114297
114641
  if (folderGiven) {
114298
114642
  const catalogue = CATALOGUE_FOLDERS.has(basename11(path2));
114299
- const root = catalogue ? join71(path2, "..") : path2;
114643
+ const root = catalogue ? join72(path2, "..") : path2;
114300
114644
  await walk2(path2, {
114301
114645
  relOf: (p) => under(root, p),
114302
114646
  folder: path2,
@@ -115304,6 +115648,7 @@ var init_steering_suggestions = __esm({
115304
115648
  // src/commands/tools.ts
115305
115649
  var tools_exports = {};
115306
115650
  __export(tools_exports, {
115651
+ toolsApproveSchema: () => toolsApproveSchema,
115307
115652
  toolsMigrate: () => toolsMigrate
115308
115653
  });
115309
115654
  async function toolsMigrate(opts = {}, writer = stdoutWriter) {
@@ -115326,6 +115671,29 @@ async function toolsMigrate(opts = {}, writer = stdoutWriter) {
115326
115671
  for (const pr of result2.pullRequests)
115327
115672
  writer.write(`#${pr.number} ${pr.url}`);
115328
115673
  }
115674
+ async function toolsApproveSchema(toolVersionId, opts, writer = stdoutWriter) {
115675
+ const cmd = createOutput({ json: opts.json }, writer);
115676
+ let result2;
115677
+ try {
115678
+ result2 = await apiPostOrThrow(
115679
+ "tools/versions/observed-schema/approve",
115680
+ { toolVersionId, schemaHash: opts.hash }
115681
+ );
115682
+ } catch (err2) {
115683
+ cmd.error(err2, "api");
115684
+ return;
115685
+ }
115686
+ if (cmd.isJson) {
115687
+ cmd.data(result2);
115688
+ return;
115689
+ }
115690
+ writer.write(
115691
+ `Approved the observed output schema of ${result2.toolVersionId} at hash ${result2.schemaHash}.`
115692
+ );
115693
+ writer.write(
115694
+ "An output that fits it now counts as checked against a schema. One that does not puts the schema back up for approval."
115695
+ );
115696
+ }
115329
115697
  var HEADLINES;
115330
115698
  var init_tools2 = __esm({
115331
115699
  "src/commands/tools.ts"() {
@@ -116659,7 +117027,7 @@ __export(credentials_exports, {
116659
117027
  });
116660
117028
  import { spawn as spawn8 } from "node:child_process";
116661
117029
  import { homedir as homedir15 } from "node:os";
116662
- import { join as join72 } from "node:path";
117030
+ import { join as join73 } from "node:path";
116663
117031
  function sharedBody(opts) {
116664
117032
  return opts.shared ? { scope: "workspace" } : {};
116665
117033
  }
@@ -116846,7 +117214,7 @@ async function runHarnessLogin(harness) {
116846
117214
  }
116847
117215
  async function readCodexAuthFile() {
116848
117216
  const host = await Promise.resolve().then(() => (init_host(), host_exports));
116849
- const path2 = join72(host.codexHomeFor(process.env, homedir15()), "auth.json");
117217
+ const path2 = join73(host.codexHomeFor(process.env, homedir15()), "auth.json");
116850
117218
  return { path: path2, text: host.readTextIfExists(path2) };
116851
117219
  }
116852
117220
  function keyFlagOf(key) {
@@ -118541,11 +118909,11 @@ import {
118541
118909
  existsSync as existsSync32,
118542
118910
  mkdirSync as mkdirSync14,
118543
118911
  readdirSync as readdirSync19,
118544
- readFileSync as readFileSync31,
118912
+ readFileSync as readFileSync32,
118545
118913
  statSync as statSync20,
118546
118914
  writeFileSync as writeFileSync11
118547
118915
  } from "node:fs";
118548
- import { dirname as dirname40, join as join73 } from "node:path";
118916
+ import { dirname as dirname40, join as join74 } from "node:path";
118549
118917
  function isBundleName(name2) {
118550
118918
  return BUNDLE_FILES.has(name2) || isClaimBundleName(name2);
118551
118919
  }
@@ -118557,7 +118925,7 @@ function readDirectoryEntries(dir) {
118557
118925
  const entries2 = /* @__PURE__ */ new Map();
118558
118926
  const walk2 = (folder, prefix) => {
118559
118927
  for (const entry2 of readdirSync19(folder)) {
118560
- const path2 = join73(folder, entry2);
118928
+ const path2 = join74(folder, entry2);
118561
118929
  const name2 = `${prefix}${entry2}`;
118562
118930
  if (statSync20(path2).isDirectory()) {
118563
118931
  if (prefix === "" && (entry2 === "heads" || entry2 === "trust"))
@@ -118566,7 +118934,7 @@ function readDirectoryEntries(dir) {
118566
118934
  } else {
118567
118935
  entries2.set(
118568
118936
  name2,
118569
- isBundleName(name2) ? new Uint8Array(readFileSync31(path2)) : UNREAD
118937
+ isBundleName(name2) ? new Uint8Array(readFileSync32(path2)) : UNREAD
118570
118938
  );
118571
118939
  }
118572
118940
  }
@@ -118578,7 +118946,7 @@ function readZipEntries(path2) {
118578
118946
  let raw;
118579
118947
  const skipped2 = [];
118580
118948
  try {
118581
- raw = unzipSync(new Uint8Array(readFileSync31(path2)), {
118949
+ raw = unzipSync(new Uint8Array(readFileSync32(path2)), {
118582
118950
  filter: (file) => {
118583
118951
  const inner = underOneFolder(file.name);
118584
118952
  const read2 = file.originalSize <= MAX_ENTRY_BYTES && (isBundleName(file.name) || inner !== null && isBundleName(inner));
@@ -118789,7 +119157,7 @@ async function writeSampleBundle(dir, writer = stdoutWriter) {
118789
119157
  const { files: files2, pins } = buildSampleClaimBundle();
118790
119158
  const zipped = {};
118791
119159
  for (const [name2, bytes] of files2) {
118792
- const path2 = join73(dir, name2);
119160
+ const path2 = join74(dir, name2);
118793
119161
  mkdirSync14(dirname40(path2), { recursive: true });
118794
119162
  writeFileSync11(path2, bytes);
118795
119163
  zipped[name2] = bytes;
@@ -128686,11 +129054,11 @@ var require_codegen = __commonJS({
128686
129054
  const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
128687
129055
  return `${varKind} ${this.name}${rhs};` + _n;
128688
129056
  }
128689
- optimizeNames(names2, constants10) {
129057
+ optimizeNames(names2, constants11) {
128690
129058
  if (!names2[this.name.str])
128691
129059
  return;
128692
129060
  if (this.rhs)
128693
- this.rhs = optimizeExpr(this.rhs, names2, constants10);
129061
+ this.rhs = optimizeExpr(this.rhs, names2, constants11);
128694
129062
  return this;
128695
129063
  }
128696
129064
  get names() {
@@ -128707,10 +129075,10 @@ var require_codegen = __commonJS({
128707
129075
  render({ _n }) {
128708
129076
  return `${this.lhs} = ${this.rhs};` + _n;
128709
129077
  }
128710
- optimizeNames(names2, constants10) {
129078
+ optimizeNames(names2, constants11) {
128711
129079
  if (this.lhs instanceof code_1.Name && !names2[this.lhs.str] && !this.sideEffects)
128712
129080
  return;
128713
- this.rhs = optimizeExpr(this.rhs, names2, constants10);
129081
+ this.rhs = optimizeExpr(this.rhs, names2, constants11);
128714
129082
  return this;
128715
129083
  }
128716
129084
  get names() {
@@ -128771,8 +129139,8 @@ var require_codegen = __commonJS({
128771
129139
  optimizeNodes() {
128772
129140
  return `${this.code}` ? this : void 0;
128773
129141
  }
128774
- optimizeNames(names2, constants10) {
128775
- this.code = optimizeExpr(this.code, names2, constants10);
129142
+ optimizeNames(names2, constants11) {
129143
+ this.code = optimizeExpr(this.code, names2, constants11);
128776
129144
  return this;
128777
129145
  }
128778
129146
  get names() {
@@ -128801,12 +129169,12 @@ var require_codegen = __commonJS({
128801
129169
  }
128802
129170
  return nodes.length > 0 ? this : void 0;
128803
129171
  }
128804
- optimizeNames(names2, constants10) {
129172
+ optimizeNames(names2, constants11) {
128805
129173
  const { nodes } = this;
128806
129174
  let i2 = nodes.length;
128807
129175
  while (i2--) {
128808
129176
  const n2 = nodes[i2];
128809
- if (n2.optimizeNames(names2, constants10))
129177
+ if (n2.optimizeNames(names2, constants11))
128810
129178
  continue;
128811
129179
  subtractNames(names2, n2.names);
128812
129180
  nodes.splice(i2, 1);
@@ -128859,12 +129227,12 @@ var require_codegen = __commonJS({
128859
129227
  return void 0;
128860
129228
  return this;
128861
129229
  }
128862
- optimizeNames(names2, constants10) {
129230
+ optimizeNames(names2, constants11) {
128863
129231
  var _a2;
128864
- this.else = (_a2 = this.else) === null || _a2 === void 0 ? void 0 : _a2.optimizeNames(names2, constants10);
128865
- if (!(super.optimizeNames(names2, constants10) || this.else))
129232
+ this.else = (_a2 = this.else) === null || _a2 === void 0 ? void 0 : _a2.optimizeNames(names2, constants11);
129233
+ if (!(super.optimizeNames(names2, constants11) || this.else))
128866
129234
  return;
128867
- this.condition = optimizeExpr(this.condition, names2, constants10);
129235
+ this.condition = optimizeExpr(this.condition, names2, constants11);
128868
129236
  return this;
128869
129237
  }
128870
129238
  get names() {
@@ -128887,10 +129255,10 @@ var require_codegen = __commonJS({
128887
129255
  render(opts) {
128888
129256
  return `for(${this.iteration})` + super.render(opts);
128889
129257
  }
128890
- optimizeNames(names2, constants10) {
128891
- if (!super.optimizeNames(names2, constants10))
129258
+ optimizeNames(names2, constants11) {
129259
+ if (!super.optimizeNames(names2, constants11))
128892
129260
  return;
128893
- this.iteration = optimizeExpr(this.iteration, names2, constants10);
129261
+ this.iteration = optimizeExpr(this.iteration, names2, constants11);
128894
129262
  return this;
128895
129263
  }
128896
129264
  get names() {
@@ -128926,10 +129294,10 @@ var require_codegen = __commonJS({
128926
129294
  render(opts) {
128927
129295
  return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
128928
129296
  }
128929
- optimizeNames(names2, constants10) {
128930
- if (!super.optimizeNames(names2, constants10))
129297
+ optimizeNames(names2, constants11) {
129298
+ if (!super.optimizeNames(names2, constants11))
128931
129299
  return;
128932
- this.iterable = optimizeExpr(this.iterable, names2, constants10);
129300
+ this.iterable = optimizeExpr(this.iterable, names2, constants11);
128933
129301
  return this;
128934
129302
  }
128935
129303
  get names() {
@@ -128971,11 +129339,11 @@ var require_codegen = __commonJS({
128971
129339
  (_b2 = this.finally) === null || _b2 === void 0 ? void 0 : _b2.optimizeNodes();
128972
129340
  return this;
128973
129341
  }
128974
- optimizeNames(names2, constants10) {
129342
+ optimizeNames(names2, constants11) {
128975
129343
  var _a2, _b2;
128976
- super.optimizeNames(names2, constants10);
128977
- (_a2 = this.catch) === null || _a2 === void 0 ? void 0 : _a2.optimizeNames(names2, constants10);
128978
- (_b2 = this.finally) === null || _b2 === void 0 ? void 0 : _b2.optimizeNames(names2, constants10);
129344
+ super.optimizeNames(names2, constants11);
129345
+ (_a2 = this.catch) === null || _a2 === void 0 ? void 0 : _a2.optimizeNames(names2, constants11);
129346
+ (_b2 = this.finally) === null || _b2 === void 0 ? void 0 : _b2.optimizeNames(names2, constants11);
128979
129347
  return this;
128980
129348
  }
128981
129349
  get names() {
@@ -129276,7 +129644,7 @@ var require_codegen = __commonJS({
129276
129644
  function addExprNames(names2, from) {
129277
129645
  return from instanceof code_1._CodeOrName ? addNames(names2, from.names) : names2;
129278
129646
  }
129279
- function optimizeExpr(expr, names2, constants10) {
129647
+ function optimizeExpr(expr, names2, constants11) {
129280
129648
  if (expr instanceof code_1.Name)
129281
129649
  return replaceName(expr);
129282
129650
  if (!canOptimize(expr))
@@ -129291,14 +129659,14 @@ var require_codegen = __commonJS({
129291
129659
  return items;
129292
129660
  }, []));
129293
129661
  function replaceName(n2) {
129294
- const c = constants10[n2.str];
129662
+ const c = constants11[n2.str];
129295
129663
  if (c === void 0 || names2[n2.str] !== 1)
129296
129664
  return n2;
129297
129665
  delete names2[n2.str];
129298
129666
  return c;
129299
129667
  }
129300
129668
  function canOptimize(e) {
129301
- return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names2[c.str] === 1 && constants10[c.str] !== void 0);
129669
+ return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names2[c.str] === 1 && constants11[c.str] !== void 0);
129302
129670
  }
129303
129671
  }
129304
129672
  function subtractNames(names2, from) {
@@ -135461,12 +135829,12 @@ var require_dist2 = __commonJS({
135461
135829
  throw new Error(`Unknown format "${name2}"`);
135462
135830
  return f;
135463
135831
  };
135464
- function addFormats(ajv, list2, fs4, exportName) {
135832
+ function addFormats(ajv, list2, fs3, exportName) {
135465
135833
  var _a2;
135466
135834
  var _b2;
135467
135835
  (_a2 = (_b2 = ajv.opts.code).formats) !== null && _a2 !== void 0 ? _a2 : _b2.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
135468
135836
  for (const f of list2)
135469
- ajv.addFormat(f, fs4[f]);
135837
+ ajv.addFormat(f, fs3[f]);
135470
135838
  }
135471
135839
  module.exports = exports = formatsPlugin;
135472
135840
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -149081,17 +149449,17 @@ var require_codegen2 = __commonJS({
149081
149449
  var require_fs = __commonJS({
149082
149450
  "../../node_modules/.pnpm/@protobufjs+fetch@1.1.1/node_modules/@protobufjs/fetch/util/fs.js"(exports, module) {
149083
149451
  "use strict";
149084
- var fs4 = null;
149452
+ var fs3 = null;
149085
149453
  try {
149086
- fs4 = __require(
149454
+ fs3 = __require(
149087
149455
  /* webpackIgnore: true */
149088
149456
  "fs"
149089
149457
  );
149090
- if (!fs4 || !fs4.readFile || !fs4.readFileSync)
149091
- fs4 = null;
149458
+ if (!fs3 || !fs3.readFile || !fs3.readFileSync)
149459
+ fs3 = null;
149092
149460
  } catch (e) {
149093
149461
  }
149094
- module.exports = fs4;
149462
+ module.exports = fs3;
149095
149463
  }
149096
149464
  });
149097
149465
 
@@ -149101,7 +149469,7 @@ var require_fetch = __commonJS({
149101
149469
  "use strict";
149102
149470
  module.exports = fetch2;
149103
149471
  var asPromise = require_aspromise();
149104
- var fs4 = require_fs();
149472
+ var fs3 = require_fs();
149105
149473
  function fetch2(filename, options, callback) {
149106
149474
  if (typeof options === "function") {
149107
149475
  callback = options;
@@ -149110,8 +149478,8 @@ var require_fetch = __commonJS({
149110
149478
  options = {};
149111
149479
  if (!callback)
149112
149480
  return asPromise(fetch2, this, filename, options);
149113
- if (!options.xhr && fs4 && fs4.readFile)
149114
- return fs4.readFile(filename, function fetchReadFileCallback(err2, contents) {
149481
+ if (!options.xhr && fs3 && fs3.readFile)
149482
+ return fs3.readFile(filename, function fetchReadFileCallback(err2, contents) {
149115
149483
  return err2 && typeof XMLHttpRequest !== "undefined" ? fetch2.xhr(filename, options, callback) : err2 ? callback(err2) : callback(null, options.binary ? contents : contents.toString("utf8"));
149116
149484
  });
149117
149485
  return fetch2.xhr(filename, options, callback);
@@ -149214,17 +149582,17 @@ var require_patterns = __commonJS({
149214
149582
  var require_fs2 = __commonJS({
149215
149583
  "../../node_modules/.pnpm/protobufjs@7.6.5/node_modules/protobufjs/src/util/fs.js"(exports, module) {
149216
149584
  "use strict";
149217
- var fs4 = null;
149585
+ var fs3 = null;
149218
149586
  try {
149219
- fs4 = __require(
149587
+ fs3 = __require(
149220
149588
  /* webpackIgnore: true */
149221
149589
  "fs"
149222
149590
  );
149223
- if (!fs4 || !fs4.readFile || !fs4.readFileSync)
149224
- fs4 = null;
149591
+ if (!fs3 || !fs3.readFile || !fs3.readFileSync)
149592
+ fs3 = null;
149225
149593
  } catch (e) {
149226
149594
  }
149227
- module.exports = fs4;
149595
+ module.exports = fs3;
149228
149596
  }
149229
149597
  });
149230
149598
 
@@ -161952,14 +162320,14 @@ var require_tls_helpers = __commonJS({
161952
162320
  Object.defineProperty(exports, "__esModule", { value: true });
161953
162321
  exports.CIPHER_SUITES = void 0;
161954
162322
  exports.getDefaultRootsData = getDefaultRootsData;
161955
- var fs4 = __require("fs");
162323
+ var fs3 = __require("fs");
161956
162324
  exports.CIPHER_SUITES = process.env.GRPC_SSL_CIPHER_SUITES;
161957
162325
  var DEFAULT_ROOTS_FILE_PATH = process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH;
161958
162326
  var defaultRootsData = null;
161959
162327
  function getDefaultRootsData() {
161960
162328
  if (DEFAULT_ROOTS_FILE_PATH) {
161961
162329
  if (defaultRootsData === null) {
161962
- defaultRootsData = fs4.readFileSync(DEFAULT_ROOTS_FILE_PATH);
162330
+ defaultRootsData = fs3.readFileSync(DEFAULT_ROOTS_FILE_PATH);
161963
162331
  }
161964
162332
  return defaultRootsData;
161965
162333
  }
@@ -168375,7 +168743,7 @@ var require_util3 = __commonJS({
168375
168743
  "use strict";
168376
168744
  Object.defineProperty(exports, "__esModule", { value: true });
168377
168745
  exports.addCommonProtos = exports.loadProtosWithOptionsSync = exports.loadProtosWithOptions = void 0;
168378
- var fs4 = __require("fs");
168746
+ var fs3 = __require("fs");
168379
168747
  var path2 = __require("path");
168380
168748
  var Protobuf = require_protobufjs();
168381
168749
  function addIncludePathResolver(root, includePaths) {
@@ -168387,7 +168755,7 @@ var require_util3 = __commonJS({
168387
168755
  for (const directory of includePaths) {
168388
168756
  const fullPath = path2.join(directory, target);
168389
168757
  try {
168390
- fs4.accessSync(fullPath, fs4.constants.R_OK);
168758
+ fs3.accessSync(fullPath, fs3.constants.R_OK);
168391
168759
  return fullPath;
168392
168760
  } catch (err2) {
168393
168761
  continue;
@@ -177483,7 +177851,7 @@ var require_certificate_provider = __commonJS({
177483
177851
  "use strict";
177484
177852
  Object.defineProperty(exports, "__esModule", { value: true });
177485
177853
  exports.FileWatcherCertificateProvider = void 0;
177486
- var fs4 = __require("fs");
177854
+ var fs3 = __require("fs");
177487
177855
  var logging = require_logging();
177488
177856
  var constants_1 = require_constants();
177489
177857
  var util_1 = __require("util");
@@ -177491,7 +177859,7 @@ var require_certificate_provider = __commonJS({
177491
177859
  function trace(text6) {
177492
177860
  logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text6);
177493
177861
  }
177494
- var readFilePromise = (0, util_1.promisify)(fs4.readFile);
177862
+ var readFilePromise = (0, util_1.promisify)(fs3.readFile);
177495
177863
  var FileWatcherCertificateProvider = class {
177496
177864
  constructor(config2) {
177497
177865
  this.config = config2;
@@ -182387,11 +182755,11 @@ import { createHash as createHash32 } from "node:crypto";
182387
182755
  import {
182388
182756
  lstatSync as lstatSync14,
182389
182757
  mkdirSync as mkdirSync15,
182390
- readFileSync as readFileSync32,
182758
+ readFileSync as readFileSync33,
182391
182759
  readlinkSync as readlinkSync4,
182392
182760
  statSync as statSync21
182393
182761
  } from "node:fs";
182394
- import { dirname as dirname41, isAbsolute as isAbsolute19, join as join74, relative as relative10, resolve as resolve28, sep as sep13 } from "node:path";
182762
+ import { dirname as dirname41, isAbsolute as isAbsolute19, join as join75, relative as relative10, resolve as resolve28, sep as sep13 } from "node:path";
182395
182763
  function cloneRepoKind(root) {
182396
182764
  const out = git4(root, ["remote", "get-url", "origin"]);
182397
182765
  const url2 = out?.toString("utf8").trim() ?? "";
@@ -182431,11 +182799,11 @@ function commitOf(root, ref) {
182431
182799
  return sha2.length > 0 ? sha2 : null;
182432
182800
  }
182433
182801
  function readWorkingFile(root, path2) {
182434
- const abs = join74(root, ...path2.split("/"));
182802
+ const abs = join75(root, ...path2.split("/"));
182435
182803
  try {
182436
182804
  const stat7 = lstatSync14(abs);
182437
182805
  if (stat7.isSymbolicLink()) return readlinkSync4(abs, "utf8");
182438
- return stat7.isFile() ? readFileSync32(abs, "utf8") : null;
182806
+ return stat7.isFile() ? readFileSync33(abs, "utf8") : null;
182439
182807
  } catch {
182440
182808
  return null;
182441
182809
  }
@@ -182525,7 +182893,7 @@ function isDir(path2) {
182525
182893
  function findSteeringRoot(start) {
182526
182894
  let dir = resolve28(start);
182527
182895
  for (; ; ) {
182528
- if (isFile(join74(dir, WORKSPACE_TOML_PATH)) || isFile(join74(dir, AGENTS_MD_PATH)) && isDir(join74(dir, STEERING_DIR))) {
182896
+ if (isFile(join75(dir, WORKSPACE_TOML_PATH)) || isFile(join75(dir, AGENTS_MD_PATH)) && isDir(join75(dir, STEERING_DIR))) {
182529
182897
  return dir;
182530
182898
  }
182531
182899
  const parent = dirname41(dir);
@@ -182605,12 +182973,12 @@ function cacheFile(cacheDir, root) {
182605
182973
  key: token === void 0 ? null : createHash32("sha256").update(token).digest("hex").slice(0, 16)
182606
182974
  };
182607
182975
  const key = createHash32("sha256").update(JSON.stringify([root, identity])).digest("hex").slice(0, 32);
182608
- return join74(cacheDir, `${key}.json`);
182976
+ return join75(cacheDir, `${key}.json`);
182609
182977
  }
182610
182978
  function readCache(file, now) {
182611
182979
  let entry2;
182612
182980
  try {
182613
- entry2 = JSON.parse(readFileSync32(file, "utf8"));
182981
+ entry2 = JSON.parse(readFileSync33(file, "utf8"));
182614
182982
  } catch {
182615
182983
  return null;
182616
182984
  }
@@ -182719,7 +183087,7 @@ function defaultDeps2() {
182719
183087
  return {
182720
183088
  fetchPublished: fetchSteeringIndex,
182721
183089
  cedar: cedarHooks,
182722
- cacheDir: join74(getConfigDir(), "cache", "steering-check"),
183090
+ cacheDir: join75(getConfigDir(), "cache", "steering-check"),
182723
183091
  now: () => Date.now()
182724
183092
  };
182725
183093
  }
@@ -184685,7 +185053,7 @@ __export(secret_exports, {
184685
185053
  handleSecretReveal: () => handleSecretReveal,
184686
185054
  handleSecretSet: () => handleSecretSet
184687
185055
  });
184688
- import { readFileSync as readFileSync33, writeFileSync as writeFileSync12 } from "fs";
185056
+ import { readFileSync as readFileSync34, writeFileSync as writeFileSync12 } from "fs";
184689
185057
  async function readStdin2() {
184690
185058
  const chunks = [];
184691
185059
  for await (const chunk of process.stdin) chunks.push(chunk);
@@ -184798,7 +185166,7 @@ async function handleSecretReveal(key, opts, writer = stdoutWriter) {
184798
185166
  async function handleSecretImport(opts, writer = stdoutWriter) {
184799
185167
  const out = createOutput({}, writer);
184800
185168
  try {
184801
- const text6 = opts.file ? readFileSync33(opts.file, "utf8") : await readStdin2();
185169
+ const text6 = opts.file ? readFileSync34(opts.file, "utf8") : await readStdin2();
184802
185170
  const environmentId = opts.env ? await resolveEnvironmentId(opts.env) : null;
184803
185171
  const { rows, committed } = await apiPostOrThrow("secret/import-env", { text: text6, environmentId, commit: !!opts.yes });
184804
185172
  const newCount = rows.filter((r) => r.isNewKey).length;
@@ -185930,6 +186298,17 @@ function buildProgram() {
185930
186298
  const { toolsMigrate: toolsMigrate2 } = await Promise.resolve().then(() => (init_tools2(), tools_exports));
185931
186299
  await toolsMigrate2(opts);
185932
186300
  });
186301
+ toolsCmd.command("approve-schema").description(
186302
+ "Approve the output schema the gateway observed for a tool version whose server declares none"
186303
+ ).argument("<toolVersionId>", "The tlv_\u2026 version").requiredOption(
186304
+ "--hash <sha256>",
186305
+ "The observed schema's hash, as list_tool_versions reports it"
186306
+ ).option("--json", "Output JSON").action(
186307
+ async (toolVersionId, opts) => {
186308
+ const { toolsApproveSchema: toolsApproveSchema2 } = await Promise.resolve().then(() => (init_tools2(), tools_exports));
186309
+ await toolsApproveSchema2(toolVersionId, opts);
186310
+ }
186311
+ );
185933
186312
  const runCmd = program2.command("run").description(
185934
186313
  "Start an agent under the contained launcher (`oxagen run -- claude -p <task>`), start a run in its own sandbox (`oxagen run --harness claude --workspace-slug <slug> --repo <owner/name>`), or read a recorded run: its chain, Oxagen's lock on it, and its locked evidence export"
185935
186314
  ).option("--image <ref>", "The contained image (or OXAGEN_CONTAINED_IMAGE)").option(