omnius 1.0.347 → 1.0.349

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -273173,11 +273173,11 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
273173
273173
  * what was previously computed. */
273174
273174
  async loadSessionInfo() {
273175
273175
  try {
273176
- const { readFileSync: readFileSync134, existsSync: existsSync164 } = await import("node:fs");
273176
+ const { readFileSync: readFileSync133, existsSync: existsSync164 } = await import("node:fs");
273177
273177
  const sessionPath2 = join43(this.cwd, ".omnius", "rlm", "session.json");
273178
273178
  if (!existsSync164(sessionPath2))
273179
273179
  return null;
273180
- return JSON.parse(readFileSync134(sessionPath2, "utf8"));
273180
+ return JSON.parse(readFileSync133(sessionPath2, "utf8"));
273181
273181
  } catch {
273182
273182
  return null;
273183
273183
  }
@@ -273364,10 +273364,10 @@ var init_memory_metabolism = __esm({
273364
273364
  const trajDir = join44(this.cwd, ".omnius", "rlm-trajectories");
273365
273365
  let lessons = [];
273366
273366
  try {
273367
- const { readdirSync: readdirSync59, readFileSync: readFileSync134 } = await import("node:fs");
273367
+ const { readdirSync: readdirSync59, readFileSync: readFileSync133 } = await import("node:fs");
273368
273368
  const files = readdirSync59(trajDir).filter((f2) => f2.endsWith(".jsonl")).sort().reverse().slice(0, 3);
273369
273369
  for (const file of files) {
273370
- const lines = readFileSync134(join44(trajDir, file), "utf8").split("\n").filter((l2) => l2.trim());
273370
+ const lines = readFileSync133(join44(trajDir, file), "utf8").split("\n").filter((l2) => l2.trim());
273371
273371
  for (const line of lines) {
273372
273372
  try {
273373
273373
  const entry = JSON.parse(line);
@@ -273751,14 +273751,14 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
273751
273751
  * Optionally filter by task type for phase-aware context (FSM paper insight).
273752
273752
  */
273753
273753
  getTopMemoriesSync(k = 5, taskType) {
273754
- const { readFileSync: readFileSync134, existsSync: existsSync164 } = __require("node:fs");
273754
+ const { readFileSync: readFileSync133, existsSync: existsSync164 } = __require("node:fs");
273755
273755
  const metaDir = join44(this.cwd, ".omnius", "memory", "metabolism");
273756
273756
  const storeFile = join44(metaDir, "store.json");
273757
273757
  if (!existsSync164(storeFile))
273758
273758
  return "";
273759
273759
  let store2 = [];
273760
273760
  try {
273761
- store2 = JSON.parse(readFileSync134(storeFile, "utf8"));
273761
+ store2 = JSON.parse(readFileSync133(storeFile, "utf8"));
273762
273762
  } catch {
273763
273763
  return "";
273764
273764
  }
@@ -273780,14 +273780,14 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
273780
273780
  /** Update memory scores based on task outcome. Called after task completion.
273781
273781
  * Memories used in successful tasks get boosted. Memories present during failures get decayed. */
273782
273782
  updateFromOutcomeSync(surfacedMemoryText, succeeded) {
273783
- const { readFileSync: readFileSync134, writeFileSync: writeFileSync91, existsSync: existsSync164, mkdirSync: mkdirSync106 } = __require("node:fs");
273783
+ const { readFileSync: readFileSync133, writeFileSync: writeFileSync91, existsSync: existsSync164, mkdirSync: mkdirSync106 } = __require("node:fs");
273784
273784
  const metaDir = join44(this.cwd, ".omnius", "memory", "metabolism");
273785
273785
  const storeFile = join44(metaDir, "store.json");
273786
273786
  if (!existsSync164(storeFile))
273787
273787
  return;
273788
273788
  let store2 = [];
273789
273789
  try {
273790
- store2 = JSON.parse(readFileSync134(storeFile, "utf8"));
273790
+ store2 = JSON.parse(readFileSync133(storeFile, "utf8"));
273791
273791
  } catch {
273792
273792
  return;
273793
273793
  }
@@ -274234,13 +274234,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
274234
274234
  // Per EvoSkill (arXiv:2603.02766): retrieve relevant strategies from archive.
274235
274235
  /** Retrieve top-K strategies for context injection. Returns "" if none. */
274236
274236
  getRelevantStrategiesSync(k = 3, taskType) {
274237
- const { readFileSync: readFileSync134, existsSync: existsSync164 } = __require("node:fs");
274237
+ const { readFileSync: readFileSync133, existsSync: existsSync164 } = __require("node:fs");
274238
274238
  const archiveFile = join46(this.cwd, ".omnius", "arche", "variants.json");
274239
274239
  if (!existsSync164(archiveFile))
274240
274240
  return "";
274241
274241
  let variants = [];
274242
274242
  try {
274243
- variants = JSON.parse(readFileSync134(archiveFile, "utf8"));
274243
+ variants = JSON.parse(readFileSync133(archiveFile, "utf8"));
274244
274244
  } catch {
274245
274245
  return "";
274246
274246
  }
@@ -274258,13 +274258,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
274258
274258
  }
274259
274259
  /** Archive a strategy variant synchronously (for task completion path) */
274260
274260
  archiveVariantSync(strategy, outcome, tags = []) {
274261
- const { readFileSync: readFileSync134, writeFileSync: writeFileSync91, existsSync: existsSync164, mkdirSync: mkdirSync106 } = __require("node:fs");
274261
+ const { readFileSync: readFileSync133, writeFileSync: writeFileSync91, existsSync: existsSync164, mkdirSync: mkdirSync106 } = __require("node:fs");
274262
274262
  const dir = join46(this.cwd, ".omnius", "arche");
274263
274263
  const archiveFile = join46(dir, "variants.json");
274264
274264
  let variants = [];
274265
274265
  try {
274266
274266
  if (existsSync164(archiveFile))
274267
- variants = JSON.parse(readFileSync134(archiveFile, "utf8"));
274267
+ variants = JSON.parse(readFileSync133(archiveFile, "utf8"));
274268
274268
  } catch {
274269
274269
  }
274270
274270
  variants.push({
@@ -547778,9 +547778,9 @@ function _findNemotronScript() {
547778
547778
  return null;
547779
547779
  }
547780
547780
  function _wordSimilarity(a2, b) {
547781
- const tokenize6 = (s2) => new Set(s2.toLowerCase().replace(/[^a-z0-9\s']/g, " ").split(/\s+/).filter(Boolean));
547782
- const sa = tokenize6(a2);
547783
- const sb = tokenize6(b);
547781
+ const tokenize7 = (s2) => new Set(s2.toLowerCase().replace(/[^a-z0-9\s']/g, " ").split(/\s+/).filter(Boolean));
547782
+ const sa = tokenize7(a2);
547783
+ const sb = tokenize7(b);
547784
547784
  if (sa.size === 0 && sb.size === 0)
547785
547785
  return 1;
547786
547786
  let inter = 0;
@@ -563673,9 +563673,9 @@ var init_reflectionBuffer = __esm({
563673
563673
  this.persistPath = persistPath ?? null;
563674
563674
  if (this.persistPath) {
563675
563675
  try {
563676
- const { readFileSync: readFileSync134, existsSync: existsSync164 } = __require("node:fs");
563676
+ const { readFileSync: readFileSync133, existsSync: existsSync164 } = __require("node:fs");
563677
563677
  if (existsSync164(this.persistPath)) {
563678
- this.state = JSON.parse(readFileSync134(this.persistPath, "utf-8"));
563678
+ this.state = JSON.parse(readFileSync133(this.persistPath, "utf-8"));
563679
563679
  return;
563680
563680
  }
563681
563681
  } catch {
@@ -567414,9 +567414,9 @@ var init_adversaryStream = __esm({
567414
567414
  if (!this.persistPath)
567415
567415
  return;
567416
567416
  try {
567417
- const { readFileSync: readFileSync134, existsSync: existsSync164 } = __require("node:fs");
567417
+ const { readFileSync: readFileSync133, existsSync: existsSync164 } = __require("node:fs");
567418
567418
  if (existsSync164(this.persistPath)) {
567419
- const data = JSON.parse(readFileSync134(this.persistPath, "utf-8"));
567419
+ const data = JSON.parse(readFileSync133(this.persistPath, "utf-8"));
567420
567420
  if (Array.isArray(data?.ledger))
567421
567421
  this.ledger = data.ledger.slice(-100);
567422
567422
  }
@@ -567686,6 +567686,164 @@ var init_evidenceBranch = __esm({
567686
567686
  }
567687
567687
  });
567688
567688
 
567689
+ // packages/orchestrator/dist/resolution-memory.js
567690
+ function tokenize6(command) {
567691
+ return command.replace(/[|&;]+/g, " ").split(/\s+/).map((t2) => t2.trim()).filter((t2) => t2.length > 0);
567692
+ }
567693
+ function normalizeErrorKey(error) {
567694
+ const e2 = error.toLowerCase();
567695
+ if (/command not found|not found|no such file|enoent/.test(e2))
567696
+ return "not found";
567697
+ if (/permission denied|eacces/.test(e2))
567698
+ return "permission denied";
567699
+ if (/unrecognized|unknown option|invalid option|no such option/.test(e2))
567700
+ return "bad option";
567701
+ if (/unexpected keyword|got an unexpected/.test(e2))
567702
+ return "bad argument";
567703
+ if (/syntax error|invalid syntax/.test(e2))
567704
+ return "syntax error";
567705
+ if (/module|importerror|modulenotfound/.test(e2))
567706
+ return "missing module";
567707
+ return e2.replace(/['"`].*?['"`]/g, "").replace(/\d+/g, "").replace(/\s+/g, " ").trim().split(" ").slice(0, 6).join(" ");
567708
+ }
567709
+ function isNearVariant(a2, b) {
567710
+ if (a2.length === 0 || b.length === 0)
567711
+ return false;
567712
+ const setA = new Set(a2);
567713
+ const setB = new Set(b);
567714
+ const shared = [...setA].filter((t2) => setB.has(t2));
567715
+ const sharedOperative = shared.some((t2) => t2.length >= 3 && !t2.startsWith("-"));
567716
+ if (!sharedOperative)
567717
+ return false;
567718
+ const onlyA = [...setA].filter((t2) => !setB.has(t2));
567719
+ const onlyB = [...setB].filter((t2) => !setA.has(t2));
567720
+ return onlyA.length > 0 && onlyA.length <= MAX_DELTA_TOKENS && onlyB.length <= MAX_DELTA_TOKENS;
567721
+ }
567722
+ function computeDelta(failed, worked) {
567723
+ const setF = new Set(failed);
567724
+ const setW = new Set(worked);
567725
+ const from3 = failed.filter((t2) => !setW.has(t2));
567726
+ const to = worked.filter((t2) => !setF.has(t2));
567727
+ if (from3.length === 0 || from3.length > MAX_DELTA_TOKENS || to.length > MAX_DELTA_TOKENS) {
567728
+ return null;
567729
+ }
567730
+ return { from: from3, to };
567731
+ }
567732
+ function sameFix(a2, from3, to, errorKey) {
567733
+ return a2.errorKey === errorKey && a2.from.join(" ") === from3.join(" ") && a2.to.join(" ") === to.join(" ");
567734
+ }
567735
+ var WINDOW_TURNS, MAX_DELTA_TOKENS, MAX_FIXES, ResolutionMemory;
567736
+ var init_resolution_memory = __esm({
567737
+ "packages/orchestrator/dist/resolution-memory.js"() {
567738
+ "use strict";
567739
+ WINDOW_TURNS = 6;
567740
+ MAX_DELTA_TOKENS = 3;
567741
+ MAX_FIXES = 200;
567742
+ ResolutionMemory = class {
567743
+ fixes = [];
567744
+ recentFailures = [];
567745
+ /** Load prior fixes (cross-session). */
567746
+ loadFixes(fixes) {
567747
+ for (const f2 of fixes) {
567748
+ if (Array.isArray(f2.from) && Array.isArray(f2.to) && f2.from.length > 0) {
567749
+ this.fixes.push(f2);
567750
+ }
567751
+ }
567752
+ this.fixes.sort((a2, b) => b.count - a2.count);
567753
+ if (this.fixes.length > MAX_FIXES)
567754
+ this.fixes = this.fixes.slice(0, MAX_FIXES);
567755
+ }
567756
+ exportFixes() {
567757
+ return this.fixes;
567758
+ }
567759
+ get size() {
567760
+ return this.fixes.length;
567761
+ }
567762
+ /** Record a failed command (buffered until a resolving success is seen). */
567763
+ recordFailure(input) {
567764
+ if (!input.command)
567765
+ return;
567766
+ this.recentFailures.push({
567767
+ tool: input.tool,
567768
+ command: input.command,
567769
+ tokens: tokenize6(input.command),
567770
+ errorKey: normalizeErrorKey(input.error || ""),
567771
+ turn: input.turn
567772
+ });
567773
+ this.recentFailures = this.recentFailures.filter((f2) => input.turn - f2.turn <= WINDOW_TURNS).slice(-12);
567774
+ }
567775
+ /**
567776
+ * Record a successful command. If it is a near-variant of a recent failure
567777
+ * of the same tool, learn the fix. Returns the learned fix, if any.
567778
+ */
567779
+ recordSuccess(input) {
567780
+ if (!input.command)
567781
+ return null;
567782
+ const workedTokens = tokenize6(input.command);
567783
+ let learned = null;
567784
+ for (let i2 = this.recentFailures.length - 1; i2 >= 0; i2--) {
567785
+ const fail3 = this.recentFailures[i2];
567786
+ if (fail3.tool !== input.tool)
567787
+ continue;
567788
+ if (input.turn - fail3.turn > WINDOW_TURNS)
567789
+ continue;
567790
+ if (fail3.command === input.command)
567791
+ continue;
567792
+ if (!isNearVariant(fail3.tokens, workedTokens))
567793
+ continue;
567794
+ const delta = computeDelta(fail3.tokens, workedTokens);
567795
+ if (!delta)
567796
+ continue;
567797
+ const existing = this.fixes.find((f2) => sameFix(f2, delta.from, delta.to, fail3.errorKey));
567798
+ if (existing) {
567799
+ existing.count++;
567800
+ existing.lastSeen = Date.now();
567801
+ existing.example = { failed: fail3.command, worked: input.command };
567802
+ learned = existing;
567803
+ } else {
567804
+ learned = {
567805
+ from: delta.from,
567806
+ to: delta.to,
567807
+ errorKey: fail3.errorKey,
567808
+ example: { failed: fail3.command, worked: input.command },
567809
+ count: 1,
567810
+ lastSeen: Date.now()
567811
+ };
567812
+ this.fixes.push(learned);
567813
+ }
567814
+ this.recentFailures.splice(i2, 1);
567815
+ break;
567816
+ }
567817
+ if (this.fixes.length > MAX_FIXES) {
567818
+ this.fixes.sort((a2, b) => b.count - a2.count);
567819
+ this.fixes = this.fixes.slice(0, MAX_FIXES);
567820
+ }
567821
+ return learned;
567822
+ }
567823
+ /**
567824
+ * Suggest a learned fix for a command about to run, or null. Matches when the
567825
+ * command contains the fix's `from` token sequence.
567826
+ */
567827
+ suggest(command) {
567828
+ if (!command)
567829
+ return null;
567830
+ const tokens = new Set(tokenize6(command));
567831
+ let best = null;
567832
+ for (const f2 of this.fixes) {
567833
+ if (f2.from.every((t2) => tokens.has(t2))) {
567834
+ if (!best || f2.count > best.count)
567835
+ best = f2;
567836
+ }
567837
+ }
567838
+ if (!best)
567839
+ return null;
567840
+ const message2 = `[LEARNED FIX — from a prior session] A command using \`${best.from.join(" ")}\` failed with "${best.errorKey}"; the working form replaced it with \`${best.to.join(" ")}\` (confirmed ${best.count}× — e.g. \`${best.example.worked}\`). Apply that change here before running, instead of re-discovering it.`;
567841
+ return { fix: best, message: message2 };
567842
+ }
567843
+ };
567844
+ }
567845
+ });
567846
+
567689
567847
  // packages/orchestrator/dist/contextEngine.js
567690
567848
  function estimateTokens3(messages2) {
567691
567849
  const chars = messages2.reduce((sum, message2) => sum + message2.content.length + message2.role.length + (message2.name?.length ?? 0), 0);
@@ -569449,6 +569607,7 @@ var init_agenticRunner = __esm({
569449
569607
  init_evidenceLedger();
569450
569608
  init_adversaryStream();
569451
569609
  init_evidenceBranch();
569610
+ init_resolution_memory();
569452
569611
  init_contextEngine();
569453
569612
  init_prompt_cache();
569454
569613
  TOOL_SUBSETS = {
@@ -569950,6 +570109,12 @@ var init_agenticRunner = __esm({
569950
570109
  // adjacent to the main loop. Initialized per run when the step critic is
569951
570110
  // enabled and a backend is available. See adversaryStream.ts.
569952
570111
  _adversaryStream = null;
570112
+ // Generic, cross-session failure→resolution learning: learns the token-level
570113
+ // change that turned a failed command into a working one (e.g. python→python3)
570114
+ // from observed pairs, and surfaces it before a matching command runs — so
570115
+ // the loop stops re-discovering the same fix every session. See
570116
+ // resolution-memory.ts. Persisted to ~/.omnius/resolution-memory.json.
570117
+ _resolutionMemory = new ResolutionMemory();
569953
570118
  _lastContextFrameDiagnostics = null;
569954
570119
  _lastContextPressureSnapshot = null;
569955
570120
  _lastActiveForgettingReport = null;
@@ -570673,6 +570838,46 @@ Your hypotheses MUST address this specific error, not generic causes.
570673
570838
  }
570674
570839
  };
570675
570840
  }
570841
+ /** Cross-session resolution-memory stores: global (machine-wide) + local. */
570842
+ _resolutionMemoryPaths() {
570843
+ const global2 = _pathJoin(_osHomedir(), ".omnius", "resolution-memory.json");
570844
+ const local = _pathJoin(this.omniusStateDir(), "resolution-memory.json");
570845
+ return [global2, local];
570846
+ }
570847
+ _loadResolutionMemory() {
570848
+ const seen = /* @__PURE__ */ new Set();
570849
+ const merged = [];
570850
+ for (const p2 of this._resolutionMemoryPaths()) {
570851
+ try {
570852
+ if (!_fsExistsSync(p2))
570853
+ continue;
570854
+ const data = JSON.parse(_fsReadFileSync(p2, "utf-8"));
570855
+ const arr = Array.isArray(data) ? data : Array.isArray(data?.fixes) ? data.fixes : [];
570856
+ for (const f2 of arr) {
570857
+ const key = `${(f2.from ?? []).join(" ")}=>${(f2.to ?? []).join(" ")}|${f2.errorKey ?? ""}`;
570858
+ if (seen.has(key))
570859
+ continue;
570860
+ seen.add(key);
570861
+ merged.push(f2);
570862
+ }
570863
+ } catch {
570864
+ }
570865
+ }
570866
+ if (merged.length > 0)
570867
+ this._resolutionMemory.loadFixes(merged);
570868
+ }
570869
+ _persistResolutionMemory() {
570870
+ const fixes = this._resolutionMemory.exportFixes();
570871
+ if (fixes.length === 0)
570872
+ return;
570873
+ for (const p2 of this._resolutionMemoryPaths()) {
570874
+ try {
570875
+ _fsMkdirSync(_pathJoin(p2, ".."), { recursive: true });
570876
+ _fsWriteFileSync(p2, JSON.stringify(fixes, null, 2), { mode: 384 });
570877
+ } catch {
570878
+ }
570879
+ }
570880
+ }
570676
570881
  /**
570677
570882
  * Detect a failing approach and return a decisive root-cause directive, or
570678
570883
  * null. Fires when a non-transient error recurs ≥3× in the recent window
@@ -574799,6 +575004,7 @@ Respond with your assessment, then take action.`;
574799
575004
  }
574800
575005
  } catch {
574801
575006
  }
575007
+ this._loadResolutionMemory();
574802
575008
  this._pauseResolve = null;
574803
575009
  this.pendingUserMessages.length = 0;
574804
575010
  this._taskState = {
@@ -577374,6 +577580,23 @@ Root cause hypothesis: the argument family may be wrong, a prerequisite may be m
577374
577580
  Corrective action: try a different approach first: read relevant files, adjust arguments, or verify prerequisites.`);
577375
577581
  }
577376
577582
  }
577583
+ if (tc.name === "shell") {
577584
+ const _cmd = typeof tc.arguments?.["command"] === "string" ? tc.arguments["command"] : typeof tc.arguments?.["cmd"] === "string" ? tc.arguments["cmd"] : "";
577585
+ const _sug = _cmd ? this._resolutionMemory.suggest(_cmd) : null;
577586
+ if (_sug) {
577587
+ const _injKey = `resfix:${_sug.fix.from.join(" ")}=>${_sug.fix.to.join(" ")}`;
577588
+ if (!this._errorGuidanceInjected.has(_injKey)) {
577589
+ this._errorGuidanceInjected.add(_injKey);
577590
+ this.pendingUserMessages.push(_sug.message);
577591
+ this.emit({
577592
+ type: "status",
577593
+ content: `Resolution memory: suggested \`${_sug.fix.from.join(" ")}\`→\`${_sug.fix.to.join(" ")}\` before shell call`,
577594
+ turn,
577595
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
577596
+ });
577597
+ }
577598
+ }
577599
+ }
577377
577600
  if (this._errorPatterns.size > 0) {
577378
577601
  for (const [sig, pattern] of this._errorPatterns) {
577379
577602
  if (pattern.tool === tc.name && pattern.count >= 2 && !this._errorGuidanceInjected.has(sig)) {
@@ -578480,6 +578703,34 @@ Respond with EXACTLY this structure before your next tool call:
578480
578703
  } catch {
578481
578704
  }
578482
578705
  }
578706
+ {
578707
+ const _cmd = typeof tc.arguments?.["command"] === "string" ? tc.arguments["command"] : typeof tc.arguments?.["cmd"] === "string" ? tc.arguments["cmd"] : "";
578708
+ if (_cmd && tc.name === "shell") {
578709
+ if (!result.success) {
578710
+ this._resolutionMemory.recordFailure({
578711
+ tool: tc.name,
578712
+ command: _cmd,
578713
+ error: result.error ?? result.output ?? "",
578714
+ turn
578715
+ });
578716
+ } else {
578717
+ const _learned = this._resolutionMemory.recordSuccess({
578718
+ tool: tc.name,
578719
+ command: _cmd,
578720
+ turn
578721
+ });
578722
+ if (_learned) {
578723
+ this._persistResolutionMemory();
578724
+ this.emit({
578725
+ type: "status",
578726
+ content: `Learned fix: \`${_learned.from.join(" ")}\` → \`${_learned.to.join(" ")}\` (after "${_learned.errorKey}") — saved for future sessions`,
578727
+ turn,
578728
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
578729
+ });
578730
+ }
578731
+ }
578732
+ }
578733
+ }
578483
578734
  if (!result.success && result.error) {
578484
578735
  const errorText = result.error;
578485
578736
  let errorType = "unknown";
@@ -582602,8 +582853,8 @@ ${telegramPersonaHead}` : stripped
582602
582853
  let recoveredTokens = 0;
582603
582854
  for (const [filePath, entry] of entries) {
582604
582855
  try {
582605
- const { readFileSync: readFileSync134 } = await import("node:fs");
582606
- const content = readFileSync134(filePath, "utf8");
582856
+ const { readFileSync: readFileSync133 } = await import("node:fs");
582857
+ const content = readFileSync133(filePath, "utf8");
582607
582858
  const tokenEst = Math.ceil(content.length / 4);
582608
582859
  if (recoveredTokens + tokenEst > fileRecoveryBudget)
582609
582860
  break;
@@ -584533,7 +584784,7 @@ ${result}`
584533
584784
  let resizedBase64 = null;
584534
584785
  try {
584535
584786
  const { execSync: execSync63 } = await import("node:child_process");
584536
- const { writeFileSync: writeFileSync91, readFileSync: readFileSync134, unlinkSync: unlinkSync35 } = await import("node:fs");
584787
+ const { writeFileSync: writeFileSync91, readFileSync: readFileSync133, unlinkSync: unlinkSync35 } = await import("node:fs");
584537
584788
  const { join: join179 } = await import("node:path");
584538
584789
  const { tmpdir: tmpdir24 } = await import("node:os");
584539
584790
  const tmpIn = join179(tmpdir24(), `omnius_img_in_${Date.now()}.png`);
@@ -584543,7 +584794,7 @@ ${result}`
584543
584794
  const escapedIn = tmpIn.replace(/\\/g, "\\\\");
584544
584795
  const escapedOut = tmpOut.replace(/\\/g, "\\\\");
584545
584796
  execSync63(`${pyBin} -c "from PIL import Image; img = Image.open('${escapedIn}'); img.thumbnail((512, 512), Image.LANCZOS); img = img.convert('RGB'); img.save('${escapedOut}', 'JPEG', quality=75)"`, { timeout: 1e4, stdio: "pipe" });
584546
- const resizedBuf = readFileSync134(tmpOut);
584797
+ const resizedBuf = readFileSync133(tmpOut);
584547
584798
  resizedBase64 = `data:image/jpeg;base64,${resizedBuf.toString("base64")}`;
584548
584799
  try {
584549
584800
  unlinkSync35(tmpIn);
@@ -599754,7 +600005,7 @@ async function fetchOpenAIModels(baseUrl2, apiKey) {
599754
600005
  async function fetchPeerModels(peerId, authKey) {
599755
600006
  try {
599756
600007
  const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports2));
599757
- const { existsSync: existsSync164, readFileSync: readFileSync134 } = await import("node:fs");
600008
+ const { existsSync: existsSync164, readFileSync: readFileSync133 } = await import("node:fs");
599758
600009
  const { join: join179 } = await import("node:path");
599759
600010
  const cwd4 = process.cwd();
599760
600011
  const nexusTool = new NexusTool2(cwd4);
@@ -599763,7 +600014,7 @@ async function fetchPeerModels(peerId, authKey) {
599763
600014
  try {
599764
600015
  const statusPath = join179(nexusDir, "status.json");
599765
600016
  if (existsSync164(statusPath)) {
599766
- const status = JSON.parse(readFileSync134(statusPath, "utf8"));
600017
+ const status = JSON.parse(readFileSync133(statusPath, "utf8"));
599767
600018
  if (status.peerId === peerId) isLocalPeer = true;
599768
600019
  }
599769
600020
  } catch {
@@ -599772,7 +600023,7 @@ async function fetchPeerModels(peerId, authKey) {
599772
600023
  const pricingPath = join179(nexusDir, "pricing.json");
599773
600024
  if (existsSync164(pricingPath)) {
599774
600025
  try {
599775
- const pricing = JSON.parse(readFileSync134(pricingPath, "utf8"));
600026
+ const pricing = JSON.parse(readFileSync133(pricingPath, "utf8"));
599776
600027
  const localModels = (pricing.models || []).map((m2) => ({
599777
600028
  name: m2.model || "unknown",
599778
600029
  size: m2.parameterSize || "",
@@ -599788,7 +600039,7 @@ async function fetchPeerModels(peerId, authKey) {
599788
600039
  const cachePath2 = join179(nexusDir, "peer-models-cache.json");
599789
600040
  if (existsSync164(cachePath2)) {
599790
600041
  try {
599791
- const cache8 = JSON.parse(readFileSync134(cachePath2, "utf8"));
600042
+ const cache8 = JSON.parse(readFileSync133(cachePath2, "utf8"));
599792
600043
  if (cache8.peerId === peerId && cache8.models?.length > 0) {
599793
600044
  const age = Date.now() - new Date(cache8.cachedAt).getTime();
599794
600045
  if (age < 5 * 60 * 1e3) {
@@ -599903,7 +600154,7 @@ async function fetchPeerModels(peerId, authKey) {
599903
600154
  const pricingPath = join179(nexusDir, "pricing.json");
599904
600155
  if (existsSync164(pricingPath)) {
599905
600156
  try {
599906
- const pricing = JSON.parse(readFileSync134(pricingPath, "utf8"));
600157
+ const pricing = JSON.parse(readFileSync133(pricingPath, "utf8"));
599907
600158
  return (pricing.models || []).map((m2) => ({
599908
600159
  name: m2.model || "unknown",
599909
600160
  size: m2.parameterSize || "",
@@ -611435,7 +611686,7 @@ __export(status_bar_exports, {
611435
611686
  setTerminalTitle: () => setTerminalTitle,
611436
611687
  unlockFooterRedraws: () => unlockFooterRedraws
611437
611688
  });
611438
- import { readFileSync as readFileSync95 } from "node:fs";
611689
+ import { readFile as readFileAsync } from "node:fs/promises";
611439
611690
  function headerButtonGlyphFg() {
611440
611691
  const a2 = tuiAccent();
611441
611692
  return a2 < 0 ? "\x1B[39m" : `\x1B[38;5;${a2}m`;
@@ -613113,7 +613364,7 @@ var init_status_bar = __esm({
613113
613364
  if (nexusDir) {
613114
613365
  try {
613115
613366
  const metricsPath = nexusDir + "/remote-metrics.json";
613116
- const raw = readFileSync95(metricsPath, "utf8");
613367
+ const raw = await readFileAsync(metricsPath, "utf8");
613117
613368
  const cached = JSON.parse(raw);
613118
613369
  if (cached && cached.ts && Date.now() - cached.ts < 6e4) {
613119
613370
  const m2 = cached.data;
@@ -616741,7 +616992,7 @@ __export(personaplex_exports, {
616741
616992
  startPersonaPlexDaemon: () => startPersonaPlexDaemon,
616742
616993
  stopPersonaPlex: () => stopPersonaPlex
616743
616994
  });
616744
- import { existsSync as existsSync117, writeFileSync as writeFileSync60, readFileSync as readFileSync96, mkdirSync as mkdirSync70, copyFileSync as copyFileSync5, readdirSync as readdirSync39, statSync as statSync43 } from "node:fs";
616995
+ import { existsSync as existsSync117, writeFileSync as writeFileSync60, readFileSync as readFileSync95, mkdirSync as mkdirSync70, copyFileSync as copyFileSync5, readdirSync as readdirSync39, statSync as statSync43 } from "node:fs";
616745
616996
  import { join as join131, dirname as dirname42 } from "node:path";
616746
616997
  import { homedir as homedir41 } from "node:os";
616747
616998
  import { execSync as execSync52, spawn as spawn28 } from "node:child_process";
@@ -616780,7 +617031,7 @@ function selectWeightTier(vramGB) {
616780
617031
  }
616781
617032
  function detectJetson() {
616782
617033
  try {
616783
- const model = readFileSync96("/proc/device-tree/model", "utf8").replace(/\0/g, "").trim();
617034
+ const model = readFileSync95("/proc/device-tree/model", "utf8").replace(/\0/g, "").trim();
616784
617035
  if (/jetson|orin|tegra/i.test(model)) {
616785
617036
  const memInfo = execSync52("grep MemTotal /proc/meminfo", { encoding: "utf8", timeout: 3e3, stdio: "pipe" });
616786
617037
  const memKB = parseInt(memInfo.match(/(\d+)/)?.[1] ?? "0", 10);
@@ -616859,7 +617110,7 @@ function fileLink2(filePath, label) {
616859
617110
  }
616860
617111
  function isPersonaPlexRunning() {
616861
617112
  if (!existsSync117(PID_FILE)) return false;
616862
- const pid = parseInt(readFileSync96(PID_FILE, "utf8").trim(), 10);
617113
+ const pid = parseInt(readFileSync95(PID_FILE, "utf8").trim(), 10);
616863
617114
  if (isNaN(pid) || pid <= 0) return false;
616864
617115
  try {
616865
617116
  process.kill(pid, 0);
@@ -616871,7 +617122,7 @@ function isPersonaPlexRunning() {
616871
617122
  function getPersonaPlexWSUrl() {
616872
617123
  if (!isPersonaPlexRunning()) return null;
616873
617124
  if (!existsSync117(PORT_FILE)) return null;
616874
- const port = parseInt(readFileSync96(PORT_FILE, "utf8").trim(), 10);
617125
+ const port = parseInt(readFileSync95(PORT_FILE, "utf8").trim(), 10);
616875
617126
  return isNaN(port) ? null : `wss://127.0.0.1:${port}`;
616876
617127
  }
616877
617128
  function isPersonaPlexInstalled() {
@@ -616881,7 +617132,7 @@ function getWeightTier() {
616881
617132
  const detected = detectPersonaPlexCapability();
616882
617133
  const tierFile = join131(PERSONAPLEX_DIR, "weight_tier");
616883
617134
  if (existsSync117(tierFile)) {
616884
- const saved = readFileSync96(tierFile, "utf8").trim();
617135
+ const saved = readFileSync95(tierFile, "utf8").trim();
616885
617136
  if (saved in WEIGHT_REPOS) {
616886
617137
  const vram = detected.vramGB;
616887
617138
  if (saved === "nf4-distilled" && vram < 24) {
@@ -617013,7 +617264,7 @@ async function installPersonaPlex(onInfo, weightTier) {
617013
617264
  }).trim();
617014
617265
  const serverFile = join131(sitePackages, "server.py");
617015
617266
  if (existsSync117(serverFile)) {
617016
- let src2 = readFileSync96(serverFile, "utf8");
617267
+ let src2 = readFileSync95(serverFile, "utf8");
617017
617268
  if (src2.includes('int(request["seed"])')) {
617018
617269
  src2 = src2.replace('int(request["seed"])', 'int(request.query["seed"])');
617019
617270
  writeFileSync60(serverFile, src2);
@@ -617031,7 +617282,7 @@ async function installPersonaPlex(onInfo, weightTier) {
617031
617282
  }).trim();
617032
617283
  const loadersFile = join131(sitePackages, "models", "loaders.py");
617033
617284
  if (existsSync117(loadersFile)) {
617034
- let src2 = readFileSync96(loadersFile, "utf8");
617285
+ let src2 = readFileSync95(loadersFile, "utf8");
617035
617286
  if (!src2.includes("_dequantize_2bit_state_dict")) {
617036
617287
  const dequantPatch = `
617037
617288
  import math
@@ -617136,28 +617387,28 @@ $2if filename.endswith(".safetensors"):`
617136
617387
  }).trim();
617137
617388
  const hybridDest = join131(sitePackages2, "hybrid_agent.py");
617138
617389
  const serverDest = join131(sitePackages2, "server.py");
617139
- if (!existsSync117(hybridDest) || !readFileSync96(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
617390
+ if (!existsSync117(hybridDest) || !readFileSync95(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
617140
617391
  log22("Deploying hybrid_agent.py (Omnius API integration)...");
617141
617392
  try {
617142
617393
  await execAsync(
617143
617394
  `curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/hybrid_agent.py" -o "${hybridDest}"`,
617144
617395
  { timeout: 3e4 }
617145
617396
  );
617146
- if (existsSync117(hybridDest) && readFileSync96(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
617397
+ if (existsSync117(hybridDest) && readFileSync95(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
617147
617398
  log22("hybrid_agent.py deployed (Omnius API + Ollama fallback).");
617148
617399
  }
617149
617400
  } catch {
617150
617401
  log22("hybrid_agent.py download failed — hybrid mode will be disabled.");
617151
617402
  }
617152
617403
  }
617153
- if (!readFileSync96(serverDest, "utf8").includes("hybrid_agent")) {
617404
+ if (!readFileSync95(serverDest, "utf8").includes("hybrid_agent")) {
617154
617405
  log22("Deploying patched server.py (hybrid mode + API endpoints)...");
617155
617406
  try {
617156
617407
  await execAsync(
617157
617408
  `curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/server.py" -o "${serverDest}"`,
617158
617409
  { timeout: 3e4 }
617159
617410
  );
617160
- if (readFileSync96(serverDest, "utf8").includes("hybrid_agent")) {
617411
+ if (readFileSync95(serverDest, "utf8").includes("hybrid_agent")) {
617161
617412
  log22("server.py patched with hybrid intercept + REST APIs.");
617162
617413
  }
617163
617414
  } catch {
@@ -617347,7 +617598,7 @@ print('Converted')
617347
617598
  let ollamaModel = process.env["HYBRID_LLM_MODEL"] || "";
617348
617599
  if (!ollamaModel) {
617349
617600
  try {
617350
- const omniusConfig = JSON.parse(readFileSync96(join131(homedir41(), ".omnius", "config.json"), "utf8"));
617601
+ const omniusConfig = JSON.parse(readFileSync95(join131(homedir41(), ".omnius", "config.json"), "utf8"));
617351
617602
  if (omniusConfig.model) ollamaModel = omniusConfig.model;
617352
617603
  } catch {
617353
617604
  }
@@ -617447,7 +617698,7 @@ print('Converted')
617447
617698
  }
617448
617699
  function stopPersonaPlex() {
617449
617700
  if (!existsSync117(PID_FILE)) return;
617450
- const pid = parseInt(readFileSync96(PID_FILE, "utf8").trim(), 10);
617701
+ const pid = parseInt(readFileSync95(PID_FILE, "utf8").trim(), 10);
617451
617702
  if (isNaN(pid) || pid <= 0) return;
617452
617703
  try {
617453
617704
  if (process.platform === "win32") {
@@ -617644,7 +617895,7 @@ function patchFrontendVoiceList(onInfo) {
617644
617895
  for (const f2 of readdirSync39(distDir)) {
617645
617896
  if (!f2.startsWith("index-") || !f2.endsWith(".js")) continue;
617646
617897
  const jsPath = join131(distDir, f2);
617647
- let js = readFileSync96(jsPath, "utf8");
617898
+ let js = readFileSync95(jsPath, "utf8");
617648
617899
  const customVoices = [];
617649
617900
  if (existsSync117(CUSTOM_VOICES_DIR)) {
617650
617901
  for (const vf of readdirSync39(CUSTOM_VOICES_DIR)) {
@@ -617764,7 +618015,7 @@ __export(setup_exports, {
617764
618015
  import * as readline from "node:readline";
617765
618016
  import { execSync as execSync53, spawn as spawn29, exec as exec5 } from "node:child_process";
617766
618017
  import { promisify as promisify7 } from "node:util";
617767
- import { existsSync as existsSync118, writeFileSync as writeFileSync61, readFileSync as readFileSync97, appendFileSync as appendFileSync11, mkdirSync as mkdirSync71 } from "node:fs";
618018
+ import { existsSync as existsSync118, writeFileSync as writeFileSync61, readFileSync as readFileSync96, appendFileSync as appendFileSync11, mkdirSync as mkdirSync71 } from "node:fs";
617768
618019
  import { join as join132 } from "node:path";
617769
618020
  import { homedir as homedir42, platform as platform5 } from "node:os";
617770
618021
  function wrapText2(value2, width) {
@@ -617820,14 +618071,14 @@ function detectUnifiedMemory(hasDiscreteGpu = false) {
617820
618071
  }
617821
618072
  try {
617822
618073
  if (existsSync118("/sys/devices/soc0/family")) {
617823
- const family = readFileSync97("/sys/devices/soc0/family", "utf8").trim().toLowerCase();
618074
+ const family = readFileSync96("/sys/devices/soc0/family", "utf8").trim().toLowerCase();
617824
618075
  if (family.includes("tegra")) return true;
617825
618076
  }
617826
618077
  } catch {
617827
618078
  }
617828
618079
  try {
617829
618080
  if (existsSync118("/proc/device-tree/model")) {
617830
- const model = readFileSync97("/proc/device-tree/model", "utf8").replace(/\0+$/, "").toLowerCase();
618081
+ const model = readFileSync96("/proc/device-tree/model", "utf8").replace(/\0+$/, "").toLowerCase();
617831
618082
  if (/jetson|tegra|orin|xavier|nano|raspberry|rockchip|rk\d{4}|mt\d{4}/.test(model)) {
617832
618083
  return true;
617833
618084
  }
@@ -619763,7 +620014,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
619763
620014
  let _visionPreviouslyInstalled = /* @__PURE__ */ new Set();
619764
620015
  try {
619765
620016
  if (existsSync118(_visionMarkerFile)) {
619766
- const _vm = JSON.parse(readFileSync97(_visionMarkerFile, "utf8"));
620017
+ const _vm = JSON.parse(readFileSync96(_visionMarkerFile, "utf8"));
619767
620018
  _visionPreviouslyInstalled = new Set(_vm.installed || []);
619768
620019
  }
619769
620020
  } catch {
@@ -620606,7 +620857,7 @@ function ensurePathInShellRc(binDir) {
620606
620857
  const shell = process.env.SHELL ?? "";
620607
620858
  const rcFile = shell.includes("zsh") ? join132(homedir42(), ".zshrc") : join132(homedir42(), ".bashrc");
620608
620859
  try {
620609
- const rcContent = existsSync118(rcFile) ? readFileSync97(rcFile, "utf8") : "";
620860
+ const rcContent = existsSync118(rcFile) ? readFileSync96(rcFile, "utf8") : "";
620610
620861
  if (rcContent.includes(binDir)) return;
620611
620862
  const exportLine = `
620612
620863
  export PATH="${binDir}:$PATH" # Added by omnius for nvim
@@ -621386,7 +621637,7 @@ var init_platforms = __esm({
621386
621637
  });
621387
621638
 
621388
621639
  // packages/cli/src/tui/workspace-explorer.ts
621389
- import { existsSync as existsSync120, readdirSync as readdirSync40, readFileSync as readFileSync98, statSync as statSync44 } from "node:fs";
621640
+ import { existsSync as existsSync120, readdirSync as readdirSync40, readFileSync as readFileSync97, statSync as statSync44 } from "node:fs";
621390
621641
  import { basename as basename24, extname as extname17, join as join133, relative as relative13, resolve as resolve54 } from "node:path";
621391
621642
  function exploreWorkspace(root, options2 = {}) {
621392
621643
  const query = (options2.query ?? "").trim().toLowerCase();
@@ -621485,7 +621736,7 @@ function previewWorkspaceFile(root, relPath, options2 = {}) {
621485
621736
  ""
621486
621737
  ].join("\n");
621487
621738
  }
621488
- const content = readFileSync98(full, "utf8");
621739
+ const content = readFileSync97(full, "utf8");
621489
621740
  const rawLines = content.split(/\r?\n/);
621490
621741
  const visible = rawLines.slice(0, maxLines);
621491
621742
  const gutter = String(Math.min(rawLines.length, maxLines)).length;
@@ -621661,7 +621912,7 @@ var init_pricing = __esm({
621661
621912
  });
621662
621913
 
621663
621914
  // packages/cli/src/insights/engine.ts
621664
- import { readdirSync as readdirSync41, readFileSync as readFileSync99, existsSync as existsSync121 } from "node:fs";
621915
+ import { readdirSync as readdirSync41, readFileSync as readFileSync98, existsSync as existsSync121 } from "node:fs";
621665
621916
  import { join as join134 } from "node:path";
621666
621917
  function formatDuration5(seconds) {
621667
621918
  if (seconds < 60) return `${Math.round(seconds)}s`;
@@ -621736,7 +621987,7 @@ var init_engine = __esm({
621736
621987
  return readdirSync41(this.historyDir).filter((f2) => f2.endsWith(".json") && f2 !== "pending-task.json").map((f2) => {
621737
621988
  try {
621738
621989
  const data = JSON.parse(
621739
- readFileSync99(join134(this.historyDir, f2), "utf-8")
621990
+ readFileSync98(join134(this.historyDir, f2), "utf-8")
621740
621991
  );
621741
621992
  return data;
621742
621993
  } catch {
@@ -621754,7 +622005,7 @@ var init_engine = __esm({
621754
622005
  loadUsageStore() {
621755
622006
  try {
621756
622007
  if (existsSync121(this.usageFile)) {
621757
- return JSON.parse(readFileSync99(this.usageFile, "utf-8"));
622008
+ return JSON.parse(readFileSync98(this.usageFile, "utf-8"));
621758
622009
  }
621759
622010
  } catch {
621760
622011
  }
@@ -624537,7 +624788,7 @@ var init_memory_menu = __esm({
624537
624788
  });
624538
624789
 
624539
624790
  // packages/cli/src/tui/audio-waveform.ts
624540
- import { readFileSync as readFileSync100 } from "node:fs";
624791
+ import { readFileSync as readFileSync99 } from "node:fs";
624541
624792
  import { createRequire as createRequire5 } from "node:module";
624542
624793
  function readAscii(buffer2, offset, length4) {
624543
624794
  return buffer2.subarray(offset, offset + length4).toString("ascii");
@@ -624611,7 +624862,7 @@ function renderAudioWaveform(file, options2 = {}) {
624611
624862
  } catch {
624612
624863
  return null;
624613
624864
  }
624614
- const buffer2 = readFileSync100(file);
624865
+ const buffer2 = readFileSync99(file);
624615
624866
  const info = parseWav(buffer2);
624616
624867
  if (!info) return null;
624617
624868
  const frameCount = Math.floor(info.dataSize / info.frameSize);
@@ -625167,7 +625418,7 @@ __export(daemon_exports, {
625167
625418
  stopDaemon: () => stopDaemon
625168
625419
  });
625169
625420
  import { spawn as spawn30 } from "node:child_process";
625170
- import { existsSync as existsSync125, readFileSync as readFileSync101, writeFileSync as writeFileSync62, mkdirSync as mkdirSync72, unlinkSync as unlinkSync24, openSync as openSync3, closeSync as closeSync3 } from "node:fs";
625421
+ import { existsSync as existsSync125, readFileSync as readFileSync100, writeFileSync as writeFileSync62, mkdirSync as mkdirSync72, unlinkSync as unlinkSync24, openSync as openSync3, closeSync as closeSync3 } from "node:fs";
625171
625422
  import { join as join137 } from "node:path";
625172
625423
  import { homedir as homedir44 } from "node:os";
625173
625424
  import { fileURLToPath as fileURLToPath17 } from "node:url";
@@ -625198,7 +625449,7 @@ function getLocalCliVersion() {
625198
625449
  for (const rel of ["../package.json", "../../package.json", "./package.json", "../../../package.json"]) {
625199
625450
  const p2 = join137(here, rel);
625200
625451
  if (existsSync125(p2)) {
625201
- const v = JSON.parse(readFileSync101(p2, "utf8"))?.version;
625452
+ const v = JSON.parse(readFileSync100(p2, "utf8"))?.version;
625202
625453
  if (v) return String(v);
625203
625454
  }
625204
625455
  }
@@ -625237,7 +625488,7 @@ async function restartDaemon(port) {
625237
625488
  function getDaemonPid() {
625238
625489
  if (!existsSync125(PID_FILE2)) return null;
625239
625490
  try {
625240
- const pid = parseInt(readFileSync101(PID_FILE2, "utf8").trim(), 10);
625491
+ const pid = parseInt(readFileSync100(PID_FILE2, "utf8").trim(), 10);
625241
625492
  if (!pid || pid <= 0) return null;
625242
625493
  process.kill(pid, 0);
625243
625494
  return pid;
@@ -625252,7 +625503,7 @@ function getDaemonPid() {
625252
625503
  function looksLikeNodeEntrypoint(path12) {
625253
625504
  if (/\.(?:mjs|cjs|js)$/i.test(path12)) return true;
625254
625505
  try {
625255
- const firstBytes = readFileSync101(path12, "utf8").slice(0, 200);
625506
+ const firstBytes = readFileSync100(path12, "utf8").slice(0, 200);
625256
625507
  return /^#!.*\bnode\b/.test(firstBytes);
625257
625508
  } catch {
625258
625509
  return false;
@@ -625601,7 +625852,7 @@ var init_types5 = __esm({
625601
625852
 
625602
625853
  // packages/cli/src/cron/store.ts
625603
625854
  import {
625604
- readFileSync as readFileSync102,
625855
+ readFileSync as readFileSync101,
625605
625856
  writeFileSync as writeFileSync63,
625606
625857
  mkdirSync as mkdirSync73,
625607
625858
  chmodSync as chmodSync3,
@@ -625788,7 +626039,7 @@ function loadJobs() {
625788
626039
  const path12 = jobsFilePath();
625789
626040
  if (!existsSync127(path12)) return [];
625790
626041
  try {
625791
- const data = JSON.parse(readFileSync102(path12, "utf-8"));
626042
+ const data = JSON.parse(readFileSync101(path12, "utf-8"));
625792
626043
  return data.jobs || [];
625793
626044
  } catch {
625794
626045
  return [];
@@ -626156,7 +626407,7 @@ import {
626156
626407
  closeSync as closeSync5,
626157
626408
  writeFileSync as writeFileSync64,
626158
626409
  unlinkSync as unlinkSync26,
626159
- readFileSync as readFileSync103
626410
+ readFileSync as readFileSync102
626160
626411
  } from "node:fs";
626161
626412
  import { join as join140 } from "node:path";
626162
626413
  import { homedir as homedir46 } from "node:os";
@@ -626173,7 +626424,7 @@ function acquireTickLock() {
626173
626424
  mkdirSync74(cronDir2(), { recursive: true });
626174
626425
  try {
626175
626426
  if (existsSync128(lockPath)) {
626176
- const content = readFileSync103(lockPath, "utf-8").trim();
626427
+ const content = readFileSync102(lockPath, "utf-8").trim();
626177
626428
  if (content) {
626178
626429
  const lock = JSON.parse(content);
626179
626430
  const age = Date.now() - lock.acquiredAt;
@@ -626541,7 +626792,7 @@ __export(sponsor_wizard_exports, {
626541
626792
  selectedModelsForEndpoint: () => selectedModelsForEndpoint,
626542
626793
  showSponsorDashboard: () => showSponsorDashboard
626543
626794
  });
626544
- import { existsSync as existsSync129, readFileSync as readFileSync104, writeFileSync as writeFileSync65, mkdirSync as mkdirSync75 } from "node:fs";
626795
+ import { existsSync as existsSync129, readFileSync as readFileSync103, writeFileSync as writeFileSync65, mkdirSync as mkdirSync75 } from "node:fs";
626545
626796
  import { join as join141 } from "node:path";
626546
626797
  function fmtTokens2(n2) {
626547
626798
  if (n2 < 1e3) return String(Math.max(0, Math.floor(n2)));
@@ -626562,7 +626813,7 @@ function loadSponsorConfig(projectDir2) {
626562
626813
  const p2 = configPath(projectDir2);
626563
626814
  if (!existsSync129(p2)) return null;
626564
626815
  try {
626565
- return JSON.parse(readFileSync104(p2, "utf8"));
626816
+ return JSON.parse(readFileSync103(p2, "utf8"));
626566
626817
  } catch {
626567
626818
  return null;
626568
626819
  }
@@ -627901,7 +628152,7 @@ __export(image_ascii_preview_exports, {
627901
628152
  });
627902
628153
  import { execFileSync as execFileSync9 } from "node:child_process";
627903
628154
  import { createRequire as createRequire6 } from "node:module";
627904
- import { existsSync as existsSync130, readFileSync as readFileSync105, statSync as statSync46 } from "node:fs";
628155
+ import { existsSync as existsSync130, readFileSync as readFileSync104, statSync as statSync46 } from "node:fs";
627905
628156
  import { resolve as resolve56 } from "node:path";
627906
628157
  function clamp8(n2, min, max) {
627907
628158
  if (!Number.isFinite(n2)) return min;
@@ -627917,7 +628168,7 @@ function defaultAsciiPreviewSize(dimensions) {
627917
628168
  }
627918
628169
  function readImageDimensions2(imagePath) {
627919
628170
  try {
627920
- const buf = readFileSync105(imagePath);
628171
+ const buf = readFileSync104(imagePath);
627921
628172
  if (buf.length >= 24 && buf.toString("ascii", 1, 4) === "PNG") {
627922
628173
  return { width: buf.readUInt32BE(16), height: buf.readUInt32BE(20) };
627923
628174
  }
@@ -628283,7 +628534,7 @@ import {
628283
628534
  existsSync as existsSync131,
628284
628535
  mkdirSync as mkdirSync76,
628285
628536
  writeFileSync as writeFileSync66,
628286
- readFileSync as readFileSync106,
628537
+ readFileSync as readFileSync105,
628287
628538
  unlinkSync as unlinkSync27,
628288
628539
  readdirSync as readdirSync43,
628289
628540
  statSync as statSync47,
@@ -629779,7 +630030,7 @@ except Exception as exc:
629779
630030
  const destFilename = `clone-${srcName}-${ts}.${ext}`;
629780
630031
  const destPath = join142(refsDir, destFilename);
629781
630032
  try {
629782
- const data = readFileSync106(audioPath);
630033
+ const data = readFileSync105(audioPath);
629783
630034
  writeFileSync66(destPath, data);
629784
630035
  } catch (err) {
629785
630036
  return `Failed to copy audio file: ${err instanceof Error ? err.message : String(err)}`;
@@ -629854,7 +630105,7 @@ except Exception as exc:
629854
630105
  const p2 = _VoiceEngine.cloneMetaFile();
629855
630106
  if (!existsSync131(p2)) return {};
629856
630107
  try {
629857
- const raw = JSON.parse(readFileSync106(p2, "utf8"));
630108
+ const raw = JSON.parse(readFileSync105(p2, "utf8"));
629858
630109
  if (typeof Object.values(raw)[0] === "string") {
629859
630110
  const migrated = {};
629860
630111
  for (const [k, v] of Object.entries(raw)) {
@@ -630737,7 +630988,7 @@ except Exception as exc:
630737
630988
  }
630738
630989
  loadMisottsStore() {
630739
630990
  try {
630740
- const raw = JSON.parse(readFileSync106(misottsProfilesFile(), "utf-8"));
630991
+ const raw = JSON.parse(readFileSync105(misottsProfilesFile(), "utf-8"));
630741
630992
  const profiles = {};
630742
630993
  for (const [name10, settings] of Object.entries(raw.profiles ?? {})) {
630743
630994
  profiles[name10] = normalizeMisottsSettings(settings);
@@ -630761,7 +631012,7 @@ except Exception as exc:
630761
631012
  loadSupertonicStore() {
630762
631013
  try {
630763
631014
  const raw = JSON.parse(
630764
- readFileSync106(supertonicProfilesFile(), "utf-8")
631015
+ readFileSync105(supertonicProfilesFile(), "utf-8")
630765
631016
  );
630766
631017
  const profiles = {};
630767
631018
  for (const [name10, settings] of Object.entries(raw.profiles ?? {})) {
@@ -630931,7 +631182,7 @@ except Exception as exc:
630931
631182
  const wavPath = await this.synthesizeSupertonicWav(text2, 1);
630932
631183
  if (!wavPath) return null;
630933
631184
  try {
630934
- const data = readFileSync106(wavPath);
631185
+ const data = readFileSync105(wavPath);
630935
631186
  unlinkSync27(wavPath);
630936
631187
  return data;
630937
631188
  } catch {
@@ -631101,7 +631352,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
631101
631352
  if (!existsSync131(wavPath)) return;
631102
631353
  if (volume !== 1) {
631103
631354
  try {
631104
- const wavData = readFileSync106(wavPath);
631355
+ const wavData = readFileSync105(wavPath);
631105
631356
  if (wavData.length > 44) {
631106
631357
  const header = wavData.subarray(0, 44);
631107
631358
  const samples = new Int16Array(
@@ -631123,7 +631374,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
631123
631374
  }
631124
631375
  if (this.onPCMOutput) {
631125
631376
  try {
631126
- const wavData = readFileSync106(wavPath);
631377
+ const wavData = readFileSync105(wavPath);
631127
631378
  if (wavData.length > 44) {
631128
631379
  const pcm = Buffer.from(
631129
631380
  wavData.buffer,
@@ -631181,7 +631432,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
631181
631432
  }
631182
631433
  if (!existsSync131(wavPath)) return null;
631183
631434
  try {
631184
- const data = readFileSync106(wavPath);
631435
+ const data = readFileSync105(wavPath);
631185
631436
  unlinkSync27(wavPath);
631186
631437
  return data;
631187
631438
  } catch {
@@ -632084,7 +632335,7 @@ if __name__ == '__main__':
632084
632335
  async postProcessAndPlayLuxtts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
632085
632336
  if (!existsSync131(wavPath)) return;
632086
632337
  try {
632087
- const wavData = readFileSync106(wavPath);
632338
+ const wavData = readFileSync105(wavPath);
632088
632339
  if (wavData.length > 44) {
632089
632340
  const sampleRate = wavData.readUInt32LE(24);
632090
632341
  const samples = new Int16Array(
@@ -632115,7 +632366,7 @@ if __name__ == '__main__':
632115
632366
  }
632116
632367
  if (pitchFactor !== 1) {
632117
632368
  try {
632118
- const wavData = readFileSync106(wavPath);
632369
+ const wavData = readFileSync105(wavPath);
632119
632370
  if (wavData.length > 44) {
632120
632371
  const int16 = new Int16Array(
632121
632372
  wavData.buffer,
@@ -632134,7 +632385,7 @@ if __name__ == '__main__':
632134
632385
  }
632135
632386
  if (this.onPCMOutput) {
632136
632387
  try {
632137
- const wavData = readFileSync106(wavPath);
632388
+ const wavData = readFileSync105(wavPath);
632138
632389
  if (wavData.length > 44) {
632139
632390
  const pcm = Buffer.from(
632140
632391
  wavData.buffer,
@@ -632149,7 +632400,7 @@ if __name__ == '__main__':
632149
632400
  }
632150
632401
  if (stereoDelayMs > 0) {
632151
632402
  try {
632152
- const wavData = readFileSync106(wavPath);
632403
+ const wavData = readFileSync105(wavPath);
632153
632404
  if (wavData.length > 44) {
632154
632405
  const sampleRate = wavData.readUInt32LE(24);
632155
632406
  const numChannels = wavData.readUInt16LE(22);
@@ -632216,7 +632467,7 @@ if __name__ == '__main__':
632216
632467
  }
632217
632468
  if (!existsSync131(wavPath)) return null;
632218
632469
  try {
632219
- const data = readFileSync106(wavPath);
632470
+ const data = readFileSync105(wavPath);
632220
632471
  unlinkSync27(wavPath);
632221
632472
  return data;
632222
632473
  } catch {
@@ -632451,7 +632702,7 @@ if __name__ == "__main__":
632451
632702
  async postProcessAndPlayMisotts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
632452
632703
  if (!existsSync131(wavPath)) return;
632453
632704
  try {
632454
- const wavData = readFileSync106(wavPath);
632705
+ const wavData = readFileSync105(wavPath);
632455
632706
  if (wavData.length > 44) {
632456
632707
  const sampleRate = wavData.readUInt32LE(24);
632457
632708
  const samples = new Int16Array(
@@ -632482,7 +632733,7 @@ if __name__ == "__main__":
632482
632733
  }
632483
632734
  if (pitchFactor !== 1) {
632484
632735
  try {
632485
- const wavData = readFileSync106(wavPath);
632736
+ const wavData = readFileSync105(wavPath);
632486
632737
  if (wavData.length > 44) {
632487
632738
  const int16 = new Int16Array(
632488
632739
  wavData.buffer,
@@ -632501,7 +632752,7 @@ if __name__ == "__main__":
632501
632752
  }
632502
632753
  if (this.onPCMOutput) {
632503
632754
  try {
632504
- const wavData = readFileSync106(wavPath);
632755
+ const wavData = readFileSync105(wavPath);
632505
632756
  if (wavData.length > 44) {
632506
632757
  const pcm = Buffer.from(
632507
632758
  wavData.buffer,
@@ -632516,7 +632767,7 @@ if __name__ == "__main__":
632516
632767
  }
632517
632768
  if (stereoDelayMs > 0) {
632518
632769
  try {
632519
- const wavData = readFileSync106(wavPath);
632770
+ const wavData = readFileSync105(wavPath);
632520
632771
  if (wavData.length > 44) {
632521
632772
  const sampleRate = wavData.readUInt32LE(24);
632522
632773
  const numChannels = wavData.readUInt16LE(22);
@@ -632592,7 +632843,7 @@ if __name__ == "__main__":
632592
632843
  }
632593
632844
  if (!existsSync131(wavPath)) return null;
632594
632845
  try {
632595
- const data = readFileSync106(wavPath);
632846
+ const data = readFileSync105(wavPath);
632596
632847
  unlinkSync27(wavPath);
632597
632848
  return data;
632598
632849
  } catch {
@@ -632613,7 +632864,7 @@ if __name__ == "__main__":
632613
632864
  };
632614
632865
  if (existsSync131(pkgPath)) {
632615
632866
  try {
632616
- const existing = JSON.parse(readFileSync106(pkgPath, "utf8"));
632867
+ const existing = JSON.parse(readFileSync105(pkgPath, "utf8"));
632617
632868
  if (!existing.dependencies?.["phonemizer"]) {
632618
632869
  existing.dependencies = { ...existing.dependencies, ...expectedDeps };
632619
632870
  writeFileSync66(pkgPath, JSON.stringify(existing, null, 2));
@@ -632773,7 +633024,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
632773
633024
  if (!existsSync131(onnxPath) || !existsSync131(configPath2)) {
632774
633025
  throw new Error(`Model files not found for ${this.modelId}`);
632775
633026
  }
632776
- this.config = JSON.parse(readFileSync106(configPath2, "utf8"));
633027
+ this.config = JSON.parse(readFileSync105(configPath2, "utf8"));
632777
633028
  this.session = await this.ort.InferenceSession.create(onnxPath, {
632778
633029
  executionProviders: ["cpu"],
632779
633030
  graphOptimizationLevel: "all"
@@ -632933,7 +633184,7 @@ import { execSync as nodeExecSync, spawn as nodeSpawn2 } from "node:child_proces
632933
633184
  import { createHash as createHash36 } from "node:crypto";
632934
633185
  import {
632935
633186
  existsSync as existsSync132,
632936
- readFileSync as readFileSync107,
633187
+ readFileSync as readFileSync106,
632937
633188
  writeFileSync as writeFileSync67,
632938
633189
  mkdirSync as mkdirSync77,
632939
633190
  readdirSync as readdirSync44,
@@ -634247,10 +634498,10 @@ async function handleSlashCommand(input, ctx3) {
634247
634498
  if (!key) {
634248
634499
  try {
634249
634500
  const { homedir: homedir62 } = await import("node:os");
634250
- const { readFileSync: readFileSync134, existsSync: existsSync164 } = await import("node:fs");
634501
+ const { readFileSync: readFileSync133, existsSync: existsSync164 } = await import("node:fs");
634251
634502
  const { join: join179 } = await import("node:path");
634252
634503
  const p2 = join179(homedir62(), ".omnius", "api.key");
634253
- if (existsSync164(p2)) key = readFileSync134(p2, "utf8").trim();
634504
+ if (existsSync164(p2)) key = readFileSync133(p2, "utf8").trim();
634254
634505
  } catch {
634255
634506
  }
634256
634507
  }
@@ -635102,7 +635353,7 @@ async function handleSlashCommand(input, ctx3) {
635102
635353
  try {
635103
635354
  const pidFile = join143(nexus.getNexusDir(), "daemon.pid");
635104
635355
  if (existsSync132(pidFile)) {
635105
- const pid = parseInt(readFileSync107(pidFile, "utf8").trim(), 10);
635356
+ const pid = parseInt(readFileSync106(pidFile, "utf8").trim(), 10);
635106
635357
  if (pid > 0 && !registry2.daemons.has("Nexus")) {
635107
635358
  registry2.register({
635108
635359
  name: "Nexus",
@@ -635525,7 +635776,7 @@ async function handleSlashCommand(input, ctx3) {
635525
635776
  renderWarning(`Tool not found: ${toolFile}`);
635526
635777
  return "handled";
635527
635778
  }
635528
- content = readFileSync107(toolFile, "utf8");
635779
+ content = readFileSync106(toolFile, "utf8");
635529
635780
  metadata = { type: "tool", name: shareName };
635530
635781
  } else if (shareType === "skill") {
635531
635782
  const skillDir = join143(ctx3.repoRoot, ".omnius", "skills", shareName);
@@ -635534,7 +635785,7 @@ async function handleSlashCommand(input, ctx3) {
635534
635785
  renderWarning(`Skill not found: ${skillFile}`);
635535
635786
  return "handled";
635536
635787
  }
635537
- content = readFileSync107(skillFile, "utf8");
635788
+ content = readFileSync106(skillFile, "utf8");
635538
635789
  metadata = { type: "skill", name: shareName };
635539
635790
  } else {
635540
635791
  renderWarning(
@@ -635607,7 +635858,7 @@ async function handleSlashCommand(input, ctx3) {
635607
635858
  "learning-cids.json"
635608
635859
  );
635609
635860
  if (existsSync132(regFile)) {
635610
- const reg2 = JSON.parse(readFileSync107(regFile, "utf8"));
635861
+ const reg2 = JSON.parse(readFileSync106(regFile, "utf8"));
635611
635862
  const pinned = Object.values(reg2).some(
635612
635863
  (e2) => e2.cid === importCid && e2.pinned
635613
635864
  );
@@ -635725,7 +635976,7 @@ async function handleSlashCommand(input, ctx3) {
635725
635976
  ).getNexusDir();
635726
635977
  const statusFile = join143(nexusDir, "status.json");
635727
635978
  if (existsSync132(statusFile)) {
635728
- const status = JSON.parse(readFileSync107(statusFile, "utf8"));
635979
+ const status = JSON.parse(readFileSync106(statusFile, "utf8"));
635729
635980
  if (status.peerId) {
635730
635981
  lines.push(`
635731
635982
  ${c3.bold("Peer Info")}`);
@@ -635750,7 +636001,7 @@ async function handleSlashCommand(input, ctx3) {
635750
636001
  try {
635751
636002
  const stateFile = join143(idDir, "self-state.json");
635752
636003
  if (existsSync132(stateFile)) {
635753
- const state = JSON.parse(readFileSync107(stateFile, "utf8"));
636004
+ const state = JSON.parse(readFileSync106(stateFile, "utf8"));
635754
636005
  lines.push(
635755
636006
  ` Version: ${c3.bold("v" + (state.version ?? "?"))} Sessions: ${c3.bold(String(state.session_count ?? 0))}`
635756
636007
  );
@@ -635765,7 +636016,7 @@ async function handleSlashCommand(input, ctx3) {
635765
636016
  }
635766
636017
  const cidFile = join143(idDir, "cids.json");
635767
636018
  if (existsSync132(cidFile)) {
635768
- const cids = JSON.parse(readFileSync107(cidFile, "utf8"));
636019
+ const cids = JSON.parse(readFileSync106(cidFile, "utf8"));
635769
636020
  const lastCid = Array.isArray(cids) ? cids[cids.length - 1] : cids.latest;
635770
636021
  if (lastCid)
635771
636022
  lines.push(
@@ -635790,7 +636041,7 @@ async function handleSlashCommand(input, ctx3) {
635790
636041
  "store.json"
635791
636042
  );
635792
636043
  if (existsSync132(metaFile2)) {
635793
- const store2 = JSON.parse(readFileSync107(metaFile2, "utf8"));
636044
+ const store2 = JSON.parse(readFileSync106(metaFile2, "utf8"));
635794
636045
  const active = store2.filter((m2) => m2.type !== "quarantine");
635795
636046
  const recoveries = active.filter(
635796
636047
  (m2) => m2.content?.startsWith("[recovery]")
@@ -636031,7 +636282,7 @@ async function handleSlashCommand(input, ctx3) {
636031
636282
  return "handled";
636032
636283
  }
636033
636284
  } else {
636034
- content = readFileSync107(resolvedPath, "utf8");
636285
+ content = readFileSync106(resolvedPath, "utf8");
636035
636286
  }
636036
636287
  if (!content.trim()) {
636037
636288
  renderWarning("No content extracted.");
@@ -636139,7 +636390,7 @@ async function handleSlashCommand(input, ctx3) {
636139
636390
  renderInfo("Fortemi bridge: not connected. Run /fortemi start");
636140
636391
  return "handled";
636141
636392
  }
636142
- const bridge = JSON.parse(readFileSync107(bridgeFile, "utf8"));
636393
+ const bridge = JSON.parse(readFileSync106(bridgeFile, "utf8"));
636143
636394
  let alive = false;
636144
636395
  try {
636145
636396
  process.kill(bridge.pid, 0);
@@ -636175,7 +636426,7 @@ async function handleSlashCommand(input, ctx3) {
636175
636426
  if (fortemiSubCmd === "stop") {
636176
636427
  const bridgeFile = join143(ctx3.repoRoot, ".omnius", "fortemi-bridge.json");
636177
636428
  if (existsSync132(bridgeFile)) {
636178
- const bridge = JSON.parse(readFileSync107(bridgeFile, "utf8"));
636429
+ const bridge = JSON.parse(readFileSync106(bridgeFile, "utf8"));
636179
636430
  try {
636180
636431
  process.kill(bridge.pid, "SIGTERM");
636181
636432
  } catch {
@@ -638180,7 +638431,7 @@ sleep 1
638180
638431
  `daemon.pid exists: ${existsSync132(join143(checkedNexusDir, "daemon.pid"))}`
638181
638432
  );
638182
638433
  try {
638183
- const _statusRaw = readFileSync107(
638434
+ const _statusRaw = readFileSync106(
638184
638435
  join143(checkedNexusDir, "status.json"),
638185
638436
  "utf8"
638186
638437
  );
@@ -638189,7 +638440,7 @@ sleep 1
638189
638440
  _spLog(`status.json read error: ${e2}`);
638190
638441
  }
638191
638442
  try {
638192
- const _errRaw = readFileSync107(
638443
+ const _errRaw = readFileSync106(
638193
638444
  join143(checkedNexusDir, "daemon.err"),
638194
638445
  "utf8"
638195
638446
  );
@@ -638224,7 +638475,7 @@ sleep 1
638224
638475
  "agent-name"
638225
638476
  );
638226
638477
  if (existsSync132(namePath))
638227
- sponsorName = readFileSync107(namePath, "utf8").trim();
638478
+ sponsorName = readFileSync106(namePath, "utf8").trim();
638228
638479
  } catch {
638229
638480
  }
638230
638481
  if (!sponsorName) sponsorName = "Omnius Sponsor";
@@ -638328,7 +638579,7 @@ sleep 1
638328
638579
  );
638329
638580
  if (existsSync132(nexusPidFile)) {
638330
638581
  const nPid = parseInt(
638331
- readFileSync107(nexusPidFile, "utf8").trim(),
638582
+ readFileSync106(nexusPidFile, "utf8").trim(),
638332
638583
  10
638333
638584
  );
638334
638585
  if (nPid > 0) {
@@ -639627,7 +639878,7 @@ sleep 1
639627
639878
  if (existsSync132(projectSettingsPath)) {
639628
639879
  try {
639629
639880
  const projectJson = JSON.parse(
639630
- readFileSync107(projectSettingsPath, "utf8")
639881
+ readFileSync106(projectSettingsPath, "utf8")
639631
639882
  );
639632
639883
  projectHasKey = typeof projectJson?.telegramKey === "string" && projectJson.telegramKey.length > 0;
639633
639884
  } catch {
@@ -644805,7 +645056,7 @@ async function discoverSponsorMediaCandidates(ctx3, modality) {
644805
645056
  "known-sponsors.json"
644806
645057
  );
644807
645058
  if (existsSync132(knownFile)) {
644808
- const saved = JSON.parse(readFileSync107(knownFile, "utf8"));
645059
+ const saved = JSON.parse(readFileSync106(knownFile, "utf8"));
644809
645060
  if (Array.isArray(saved)) rawSponsors.push(...saved);
644810
645061
  }
644811
645062
  } catch {
@@ -644955,7 +645206,7 @@ async function collectSponsorMediaStream(args) {
644955
645206
  while (!done && Date.now() < deadline) {
644956
645207
  await new Promise((resolve71) => setTimeout(resolve71, 250));
644957
645208
  if (!existsSync132(args.streamFile)) continue;
644958
- const raw = readFileSync107(args.streamFile, "utf8");
645209
+ const raw = readFileSync106(args.streamFile, "utf8");
644959
645210
  if (raw.length <= offset) continue;
644960
645211
  pending2 += raw.slice(offset);
644961
645212
  offset = raw.length;
@@ -645279,7 +645530,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
645279
645530
  try {
645280
645531
  if (existsSync132(knownFile)) {
645281
645532
  const saved = JSON.parse(
645282
- readFileSync107(knownFile, "utf8")
645533
+ readFileSync106(knownFile, "utf8")
645283
645534
  );
645284
645535
  for (const s2 of saved) {
645285
645536
  if (!sponsors.some((sp) => sp.url === s2.url)) {
@@ -645455,7 +645706,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
645455
645706
  const saveKey = selected.url || selected.peerId || selected.name;
645456
645707
  try {
645457
645708
  mkdirSync77(sponsorDir2, { recursive: true });
645458
- const existing = existsSync132(knownFile) ? JSON.parse(readFileSync107(knownFile, "utf8")) : [];
645709
+ const existing = existsSync132(knownFile) ? JSON.parse(readFileSync106(knownFile, "utf8")) : [];
645459
645710
  const updated = existing.filter(
645460
645711
  (s2) => (s2.url || s2.peerId || s2.name) !== saveKey
645461
645712
  );
@@ -648572,7 +648823,7 @@ var init_commands = __esm({
648572
648823
  });
648573
648824
 
648574
648825
  // packages/cli/src/tui/project-context.ts
648575
- import { existsSync as existsSync133, readFileSync as readFileSync108, readdirSync as readdirSync45, mkdirSync as mkdirSync78, writeFileSync as writeFileSync68 } from "node:fs";
648826
+ import { existsSync as existsSync133, readFileSync as readFileSync107, readdirSync as readdirSync45, mkdirSync as mkdirSync78, writeFileSync as writeFileSync68 } from "node:fs";
648576
648827
  import { join as join144, basename as basename26 } from "node:path";
648577
648828
  import { execSync as execSync56 } from "node:child_process";
648578
648829
  import { homedir as homedir49 } from "node:os";
@@ -648624,7 +648875,7 @@ function loadProjectMap(repoRoot) {
648624
648875
  const mapPath2 = join144(repoRoot, OMNIUS_DIR, "context", "project-map.md");
648625
648876
  if (existsSync133(mapPath2)) {
648626
648877
  try {
648627
- const content = readFileSync108(mapPath2, "utf-8");
648878
+ const content = readFileSync107(mapPath2, "utf-8");
648628
648879
  return content;
648629
648880
  } catch {
648630
648881
  }
@@ -648673,7 +648924,7 @@ function countJsonMemoryEntries(dir) {
648673
648924
  if (!file.endsWith(".json")) continue;
648674
648925
  topics++;
648675
648926
  try {
648676
- const parsed = JSON.parse(readFileSync108(join144(dir, file), "utf8"));
648927
+ const parsed = JSON.parse(readFileSync107(join144(dir, file), "utf8"));
648677
648928
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
648678
648929
  entries += Object.keys(parsed).length;
648679
648930
  }
@@ -648689,7 +648940,7 @@ function countReflectionBuffer(repoRoot) {
648689
648940
  const path12 = join144(repoRoot, OMNIUS_DIR, "memory", "reflections.json");
648690
648941
  if (!existsSync133(path12)) return 0;
648691
648942
  try {
648692
- const parsed = JSON.parse(readFileSync108(path12, "utf8"));
648943
+ const parsed = JSON.parse(readFileSync107(path12, "utf8"));
648693
648944
  return Array.isArray(parsed.reflections) ? parsed.reflections.length : 0;
648694
648945
  } catch {
648695
648946
  return 0;
@@ -648698,7 +648949,7 @@ function countReflectionBuffer(repoRoot) {
648698
648949
  function countJsonlLines(path12, maxBytes = 1e6) {
648699
648950
  if (!existsSync133(path12)) return 0;
648700
648951
  try {
648701
- const text2 = readFileSync108(path12, "utf8").slice(-maxBytes);
648952
+ const text2 = readFileSync107(path12, "utf8").slice(-maxBytes);
648702
648953
  return text2.split(/\r?\n/).filter((line) => line.trim()).length;
648703
648954
  } catch {
648704
648955
  return 0;
@@ -648742,7 +648993,7 @@ function loadMemoryContextBundle(repoRoot, task = "", taskEmbedding) {
648742
648993
  const files = readdirSync45(dir).filter((f2) => f2.endsWith(".json"));
648743
648994
  for (const file of files.slice(0, 10)) {
648744
648995
  try {
648745
- const raw = readFileSync108(join144(dir, file), "utf-8");
648996
+ const raw = readFileSync107(join144(dir, file), "utf-8");
648746
648997
  const entries = JSON.parse(raw);
648747
648998
  const topic = basename26(file, ".json");
648748
648999
  for (const [k, v] of Object.entries(entries)) {
@@ -649231,7 +649482,7 @@ function loadCustomToolsContext(repoRoot) {
649231
649482
  const registryPath = join144(repoRoot, ".omnius", "tools", "registry.json");
649232
649483
  const indexPath = join144(repoRoot, ".omnius", "tools", "README.md");
649233
649484
  if (!existsSync133(registryPath)) return "";
649234
- const registry4 = JSON.parse(readFileSync108(registryPath, "utf-8"));
649485
+ const registry4 = JSON.parse(readFileSync107(registryPath, "utf-8"));
649235
649486
  const tools = (registry4.tools ?? []).filter((tool) => tool.qualityGate?.lastTest?.status === "passed").sort((a2, b) => {
649236
649487
  const byRate = (b.analytics?.successRate ?? 0) - (a2.analytics?.successRate ?? 0);
649237
649488
  if (byRate !== 0) return byRate;
@@ -649407,7 +649658,7 @@ var init_project_context = __esm({
649407
649658
  });
649408
649659
 
649409
649660
  // packages/cli/src/realtime.ts
649410
- import { existsSync as existsSync134, readFileSync as readFileSync109, readdirSync as readdirSync46 } from "node:fs";
649661
+ import { existsSync as existsSync134, readFileSync as readFileSync108, readdirSync as readdirSync46 } from "node:fs";
649411
649662
  import { basename as basename27, join as join145, resolve as resolve58 } from "node:path";
649412
649663
  function clampInt2(value2, fallback, min, max) {
649413
649664
  const n2 = typeof value2 === "number" ? value2 : Number.parseInt(String(value2 ?? ""), 10);
@@ -649429,7 +649680,7 @@ function firstReadable(candidates) {
649429
649680
  for (const path12 of candidates) {
649430
649681
  if (!existsSync134(path12)) continue;
649431
649682
  try {
649432
- return { path: path12, content: readFileSync109(path12, "utf8") };
649683
+ return { path: path12, content: readFileSync108(path12, "utf8") };
649433
649684
  } catch {
649434
649685
  return null;
649435
649686
  }
@@ -649452,7 +649703,7 @@ function projectVoice(repoRoot) {
649452
649703
  return ap - bp || a2.localeCompare(b);
649453
649704
  });
649454
649705
  const first2 = files[0];
649455
- return first2 ? { path: join145(voiceDir3, first2), content: readFileSync109(join145(voiceDir3, first2), "utf8") } : null;
649706
+ return first2 ? { path: join145(voiceDir3, first2), content: readFileSync108(join145(voiceDir3, first2), "utf8") } : null;
649456
649707
  } catch {
649457
649708
  return null;
649458
649709
  }
@@ -649640,7 +649891,7 @@ __export(chat_session_exports, {
649640
649891
  import { randomUUID as randomUUID18 } from "node:crypto";
649641
649892
  import {
649642
649893
  existsSync as existsSync135,
649643
- readFileSync as readFileSync110,
649894
+ readFileSync as readFileSync109,
649644
649895
  readdirSync as readdirSync47,
649645
649896
  writeFileSync as writeFileSync69,
649646
649897
  renameSync as renameSync11,
@@ -649749,7 +650000,7 @@ function normalizeLoadedSession(parsed) {
649749
650000
  }
649750
650001
  function readSessionFile(fp) {
649751
650002
  try {
649752
- const parsed = JSON.parse(readFileSync110(fp, "utf-8"));
650003
+ const parsed = JSON.parse(readFileSync109(fp, "utf-8"));
649753
650004
  if (!parsed || typeof parsed !== "object" || !parsed.id) return null;
649754
650005
  return normalizeLoadedSession(parsed);
649755
650006
  } catch {
@@ -649782,7 +650033,7 @@ function loadPersistedSessions() {
649782
650033
  if (!f2.endsWith(".json") || f2.includes(".tmp.")) continue;
649783
650034
  const fp = join146(dir, f2);
649784
650035
  try {
649785
- const parsed = JSON.parse(readFileSync110(fp, "utf-8"));
650036
+ const parsed = JSON.parse(readFileSync109(fp, "utf-8"));
649786
650037
  if (f2.endsWith(".inflight.json")) {
649787
650038
  if (parsed && parsed.pid && parsed.status === "running") {
649788
650039
  try {
@@ -649824,7 +650075,7 @@ function buildSystemPrompt(cwd4) {
649824
650075
  const diaryPath = join146(cwd4, ".omnius", "context", "session-diary.md");
649825
650076
  if (existsSync135(diaryPath)) {
649826
650077
  try {
649827
- const diary = readFileSync110(diaryPath, "utf-8").slice(0, 1e3);
650078
+ const diary = readFileSync109(diaryPath, "utf-8").slice(0, 1e3);
649828
650079
  parts.push(`\\nPrevious session history:\\n${diary}`);
649829
650080
  } catch {
649830
650081
  }
@@ -649839,7 +650090,7 @@ function buildSystemPrompt(cwd4) {
649839
650090
  );
649840
650091
  for (const f2 of files.slice(0, 3)) {
649841
650092
  try {
649842
- const data = JSON.parse(readFileSync110(join146(memDir, f2), "utf-8"));
650093
+ const data = JSON.parse(readFileSync109(join146(memDir, f2), "utf-8"));
649843
650094
  const entries = Object.entries(data).slice(0, 3);
649844
650095
  if (entries.length > 0) {
649845
650096
  parts.push(
@@ -649859,7 +650110,7 @@ function buildSystemPrompt(cwd4) {
649859
650110
  const p2 = join146(cwd4, name10);
649860
650111
  if (existsSync135(p2)) {
649861
650112
  try {
649862
- const content = readFileSync110(p2, "utf-8").slice(0, 500);
650113
+ const content = readFileSync109(p2, "utf-8").slice(0, 500);
649863
650114
  parts.push(`\\nProject instructions (${name10}):\\n${content}`);
649864
650115
  } catch {
649865
650116
  }
@@ -649881,7 +650132,7 @@ function getSession2(sessionId, model, cwd4) {
649881
650132
  try {
649882
650133
  const fp = sessionPath(sessionId);
649883
650134
  if (existsSync135(fp)) {
649884
- const parsed = normalizeLoadedSession(JSON.parse(readFileSync110(fp, "utf-8")));
650135
+ const parsed = normalizeLoadedSession(JSON.parse(readFileSync109(fp, "utf-8")));
649885
650136
  if (parsed && parsed.id === sessionId) {
649886
650137
  parsed.lastActivity = Date.now();
649887
650138
  if (canonicalRoot && !parsed.projectRoot) parsed.projectRoot = canonicalRoot;
@@ -650068,7 +650319,7 @@ function drainCheckins(sessionId) {
650068
650319
  const fp = checkinPath(sessionId);
650069
650320
  if (!existsSync135(fp)) return [];
650070
650321
  try {
650071
- const raw = readFileSync110(fp, "utf-8");
650322
+ const raw = readFileSync109(fp, "utf-8");
650072
650323
  try {
650073
650324
  unlinkSync28(fp);
650074
650325
  } catch {
@@ -650134,7 +650385,7 @@ function lookupSession(id) {
650134
650385
  try {
650135
650386
  const fp = sessionPath(id);
650136
650387
  if (existsSync135(fp)) {
650137
- const parsed = normalizeLoadedSession(JSON.parse(readFileSync110(fp, "utf-8")));
650388
+ const parsed = normalizeLoadedSession(JSON.parse(readFileSync109(fp, "utf-8")));
650138
650389
  if (parsed && parsed.id === id) {
650139
650390
  sessions2.set(id, parsed);
650140
650391
  return parsed;
@@ -650187,7 +650438,7 @@ function getInFlightChat(sessionId) {
650187
650438
  try {
650188
650439
  const p2 = inFlightPath(sessionId);
650189
650440
  if (existsSync135(p2)) {
650190
- const parsed = JSON.parse(readFileSync110(p2, "utf-8"));
650441
+ const parsed = JSON.parse(readFileSync109(p2, "utf-8"));
650191
650442
  if (parsed && parsed.sessionId === sessionId) {
650192
650443
  return parsed;
650193
650444
  }
@@ -651375,7 +651626,7 @@ __export(banner_exports, {
651375
651626
  setBannerWriter: () => setBannerWriter,
651376
651627
  setGridText: () => setGridText
651377
651628
  });
651378
- import { existsSync as existsSync137, readFileSync as readFileSync111, writeFileSync as writeFileSync70, mkdirSync as mkdirSync81 } from "node:fs";
651629
+ import { existsSync as existsSync137, readFileSync as readFileSync110, writeFileSync as writeFileSync70, mkdirSync as mkdirSync81 } from "node:fs";
651379
651630
  import { join as join148 } from "node:path";
651380
651631
  function setBannerWriter(writer) {
651381
651632
  chromeWrite3 = writer;
@@ -651517,7 +651768,7 @@ function loadBannerDesign(workDir, id) {
651517
651768
  const file = join148(workDir, ".omnius", "banners", `${id}.json`);
651518
651769
  if (!existsSync137(file)) return null;
651519
651770
  try {
651520
- return JSON.parse(readFileSync111(file, "utf8"));
651771
+ return JSON.parse(readFileSync110(file, "utf8"));
651521
651772
  } catch {
651522
651773
  return null;
651523
651774
  }
@@ -651847,13 +652098,13 @@ var init_banner = __esm({
651847
652098
  });
651848
652099
 
651849
652100
  // packages/cli/src/tui/carousel-descriptors.ts
651850
- import { existsSync as existsSync138, readFileSync as readFileSync112, writeFileSync as writeFileSync71, mkdirSync as mkdirSync82, readdirSync as readdirSync48 } from "node:fs";
652101
+ import { existsSync as existsSync138, readFileSync as readFileSync111, writeFileSync as writeFileSync71, mkdirSync as mkdirSync82, readdirSync as readdirSync48 } from "node:fs";
651851
652102
  import { join as join149, basename as basename30 } from "node:path";
651852
652103
  function loadToolProfile(repoRoot) {
651853
652104
  const filePath = join149(repoRoot, OMNIUS_DIR, "context", TOOL_PROFILE_FILE);
651854
652105
  try {
651855
652106
  if (!existsSync138(filePath)) return null;
651856
- return JSON.parse(readFileSync112(filePath, "utf-8"));
652107
+ return JSON.parse(readFileSync111(filePath, "utf-8"));
651857
652108
  } catch {
651858
652109
  return null;
651859
652110
  }
@@ -651919,7 +652170,7 @@ function loadCachedDescriptors(repoRoot) {
651919
652170
  const filePath = join149(repoRoot, OMNIUS_DIR, "context", DESCRIPTOR_FILE);
651920
652171
  try {
651921
652172
  if (!existsSync138(filePath)) return null;
651922
- const cached = JSON.parse(readFileSync112(filePath, "utf-8"));
652173
+ const cached = JSON.parse(readFileSync111(filePath, "utf-8"));
651923
652174
  return cached.phrases.length > 0 ? cached.phrases : null;
651924
652175
  } catch {
651925
652176
  return null;
@@ -651983,7 +652234,7 @@ function extractFromPackageJson(repoRoot, tags) {
651983
652234
  const pkgPath = join149(repoRoot, "package.json");
651984
652235
  try {
651985
652236
  if (!existsSync138(pkgPath)) return;
651986
- const pkg = JSON.parse(readFileSync112(pkgPath, "utf-8"));
652237
+ const pkg = JSON.parse(readFileSync111(pkgPath, "utf-8"));
651987
652238
  if (pkg.name && typeof pkg.name === "string") {
651988
652239
  const parts = pkg.name.replace(/^@/, "").split("/");
651989
652240
  for (const p2 of parts) tags.push(p2);
@@ -652054,7 +652305,7 @@ function extractFromMemory(repoRoot, tags) {
652054
652305
  const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
652055
652306
  tags.push(topic);
652056
652307
  try {
652057
- const data = JSON.parse(readFileSync112(join149(memoryDir, file), "utf-8"));
652308
+ const data = JSON.parse(readFileSync111(join149(memoryDir, file), "utf-8"));
652058
652309
  if (data && typeof data === "object") {
652059
652310
  const keys = Object.keys(data).slice(0, 3);
652060
652311
  for (const key of keys) {
@@ -653097,7 +653348,7 @@ var init_edit_history = __esm({
653097
653348
  });
653098
653349
 
653099
653350
  // packages/cli/src/tui/snr-engine.ts
653100
- import { existsSync as existsSync139, readdirSync as readdirSync49, readFileSync as readFileSync113, writeFileSync as writeFileSync72, mkdirSync as mkdirSync84, rmSync as rmSync11 } from "node:fs";
653351
+ import { existsSync as existsSync139, readdirSync as readdirSync49, readFileSync as readFileSync112, writeFileSync as writeFileSync72, mkdirSync as mkdirSync84, rmSync as rmSync11 } from "node:fs";
653101
653352
  import { join as join151, basename as basename31 } from "node:path";
653102
653353
  function computeDPrime(signalScores, noiseScores) {
653103
653354
  if (signalScores.length === 0 || noiseScores.length === 0) return 0;
@@ -653403,7 +653654,7 @@ Call task_complete with the JSON array when done.`,
653403
653654
  const topic = basename31(f2, ".json");
653404
653655
  if (topics.length > 0 && !topics.includes(topic)) continue;
653405
653656
  try {
653406
- const data = JSON.parse(readFileSync113(join151(dir, f2), "utf-8"));
653657
+ const data = JSON.parse(readFileSync112(join151(dir, f2), "utf-8"));
653407
653658
  for (const [key, val] of Object.entries(data)) {
653408
653659
  const value2 = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
653409
653660
  entries.push({ topic, key, value: value2 });
@@ -653505,7 +653756,7 @@ Call task_complete with the JSON array when done.`,
653505
653756
  const file = join151(memDir, `${topic}.json`);
653506
653757
  if (!existsSync139(file)) continue;
653507
653758
  try {
653508
- const data = JSON.parse(readFileSync113(file, "utf-8"));
653759
+ const data = JSON.parse(readFileSync112(file, "utf-8"));
653509
653760
  const moved = {};
653510
653761
  for (const key of keys) {
653511
653762
  if (key in data) {
@@ -653520,7 +653771,7 @@ Call task_complete with the JSON array when done.`,
653520
653771
  let archiveData = {};
653521
653772
  if (existsSync139(archiveFile)) {
653522
653773
  try {
653523
- archiveData = JSON.parse(readFileSync113(archiveFile, "utf-8"));
653774
+ archiveData = JSON.parse(readFileSync112(archiveFile, "utf-8"));
653524
653775
  } catch {
653525
653776
  }
653526
653777
  }
@@ -653559,7 +653810,7 @@ Call task_complete with the JSON array when done.`,
653559
653810
  });
653560
653811
 
653561
653812
  // packages/cli/src/tui/promptLoader.ts
653562
- import { readFileSync as readFileSync114, existsSync as existsSync140 } from "node:fs";
653813
+ import { readFileSync as readFileSync113, existsSync as existsSync140 } from "node:fs";
653563
653814
  import { join as join152, dirname as dirname47 } from "node:path";
653564
653815
  import { fileURLToPath as fileURLToPath18 } from "node:url";
653565
653816
  function loadPrompt3(promptPath, vars) {
@@ -653569,7 +653820,7 @@ function loadPrompt3(promptPath, vars) {
653569
653820
  if (!existsSync140(fullPath)) {
653570
653821
  throw new Error(`Prompt file not found: ${fullPath}`);
653571
653822
  }
653572
- content = readFileSync114(fullPath, "utf-8");
653823
+ content = readFileSync113(fullPath, "utf-8");
653573
653824
  cache7.set(promptPath, content);
653574
653825
  }
653575
653826
  if (!vars) return content;
@@ -653589,7 +653840,7 @@ var init_promptLoader3 = __esm({
653589
653840
  });
653590
653841
 
653591
653842
  // packages/cli/src/tui/dream-engine.ts
653592
- import { mkdirSync as mkdirSync85, writeFileSync as writeFileSync73, readFileSync as readFileSync115, existsSync as existsSync141, readdirSync as readdirSync50 } from "node:fs";
653843
+ import { mkdirSync as mkdirSync85, writeFileSync as writeFileSync73, readFileSync as readFileSync114, existsSync as existsSync141, readdirSync as readdirSync50 } from "node:fs";
653593
653844
  import { join as join153, basename as basename32 } from "node:path";
653594
653845
  import { execSync as execSync57 } from "node:child_process";
653595
653846
  function setDreamWriteContent(fn) {
@@ -653606,7 +653857,7 @@ function loadAutoresearchMemory(repoRoot) {
653606
653857
  const memoryPath = join153(repoRoot, ".omnius", "memory", "autoresearch.json");
653607
653858
  if (!existsSync141(memoryPath)) return "";
653608
653859
  try {
653609
- const raw = readFileSync115(memoryPath, "utf-8");
653860
+ const raw = readFileSync114(memoryPath, "utf-8");
653610
653861
  const data = JSON.parse(raw);
653611
653862
  const sections = [];
653612
653863
  for (const key of AUTORESEARCH_MEMORY_KEYS) {
@@ -653840,7 +654091,7 @@ var init_dream_engine = __esm({
653840
654091
  if (!existsSync141(targetPath)) {
653841
654092
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
653842
654093
  }
653843
- let content = readFileSync115(targetPath, "utf-8");
654094
+ let content = readFileSync114(targetPath, "utf-8");
653844
654095
  if (!content.includes(oldStr)) {
653845
654096
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
653846
654097
  }
@@ -653928,7 +654179,7 @@ var init_dream_engine = __esm({
653928
654179
  if (!existsSync141(targetPath)) {
653929
654180
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
653930
654181
  }
653931
- let content = readFileSync115(targetPath, "utf-8");
654182
+ let content = readFileSync114(targetPath, "utf-8");
653932
654183
  if (!content.includes(oldStr)) {
653933
654184
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
653934
654185
  }
@@ -654888,7 +655139,7 @@ ${summary}` };
654888
655139
  try {
654889
655140
  let notes = [];
654890
655141
  if (existsSync141(notesPath)) {
654891
- notes = JSON.parse(readFileSync115(notesPath, "utf-8"));
655142
+ notes = JSON.parse(readFileSync114(notesPath, "utf-8"));
654892
655143
  }
654893
655144
  if (action === "add") {
654894
655145
  const note = {
@@ -655531,7 +655782,7 @@ var init_bless_engine = __esm({
655531
655782
  });
655532
655783
 
655533
655784
  // packages/cli/src/tui/dmn-engine.ts
655534
- import { existsSync as existsSync142, readFileSync as readFileSync116, writeFileSync as writeFileSync74, mkdirSync as mkdirSync86, readdirSync as readdirSync51, unlinkSync as unlinkSync29 } from "node:fs";
655785
+ import { existsSync as existsSync142, readFileSync as readFileSync115, writeFileSync as writeFileSync74, mkdirSync as mkdirSync86, readdirSync as readdirSync51, unlinkSync as unlinkSync29 } from "node:fs";
655535
655786
  import { join as join154, basename as basename33 } from "node:path";
655536
655787
  function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities, competence, reflectionBuffer) {
655537
655788
  const competenceReport = competence.length > 0 ? competence.map((c8) => {
@@ -656289,7 +656540,7 @@ OUTPUT: Call task_complete with JSON:
656289
656540
  const path12 = join154(this.stateDir, "state.json");
656290
656541
  if (existsSync142(path12)) {
656291
656542
  try {
656292
- this.state = JSON.parse(readFileSync116(path12, "utf-8"));
656543
+ this.state = JSON.parse(readFileSync115(path12, "utf-8"));
656293
656544
  } catch {
656294
656545
  }
656295
656546
  }
@@ -656323,7 +656574,7 @@ OUTPUT: Call task_complete with JSON:
656323
656574
  const latestByFingerprint = /* @__PURE__ */ new Map();
656324
656575
  for (const file of files) {
656325
656576
  try {
656326
- const parsed = JSON.parse(readFileSync116(join154(this.historyDir, file), "utf-8"));
656577
+ const parsed = JSON.parse(readFileSync115(join154(this.historyDir, file), "utf-8"));
656327
656578
  latestByFingerprint.set(this.fingerprintCycle(parsed), file);
656328
656579
  } catch {
656329
656580
  keep.add(file);
@@ -658123,7 +658374,7 @@ import { createCipheriv as createCipheriv5, createDecipheriv as createDecipheriv
658123
658374
  import {
658124
658375
  existsSync as existsSync143,
658125
658376
  mkdirSync as mkdirSync87,
658126
- readFileSync as readFileSync117,
658377
+ readFileSync as readFileSync116,
658127
658378
  statSync as statSync49,
658128
658379
  unlinkSync as unlinkSync30,
658129
658380
  writeFileSync as writeFileSync75
@@ -658353,7 +658604,7 @@ function scopedTool(base3, root, mode) {
658353
658604
  );
658354
658605
  if (!materialized.ok) return denied(materialized.error);
658355
658606
  mkdirSync87(dirname48(guarded.path.abs), { recursive: true });
658356
- writeFileSync75(guarded.path.abs, readFileSync117(materialized.path));
658607
+ writeFileSync75(guarded.path.abs, readFileSync116(materialized.path));
658357
658608
  materialized.cleanup?.();
658358
658609
  restoredEditPath = guarded.path.abs;
658359
658610
  }
@@ -658477,7 +658728,7 @@ function readManifest(root) {
658477
658728
  ensureManifest(root);
658478
658729
  try {
658479
658730
  const parsed = JSON.parse(
658480
- readFileSync117(manifestPath(root), "utf8")
658731
+ readFileSync116(manifestPath(root), "utf8")
658481
658732
  );
658482
658733
  const objects = parsed.objects && typeof parsed.objects === "object" ? Object.fromEntries(
658483
658734
  Object.entries(parsed.objects).filter(
@@ -658529,7 +658780,7 @@ function rememberCreated(root, absPath) {
658529
658780
  }
658530
658781
  }
658531
658782
  mkdirSync87(join155(root, OBJECTS_DIR), { recursive: true });
658532
- const data = readFileSync117(guarded.path.abs);
658783
+ const data = readFileSync116(guarded.path.abs);
658533
658784
  const prefix = randomBytes25(48);
658534
658785
  const key = randomBytes25(32);
658535
658786
  const iv = randomBytes25(12);
@@ -658585,7 +658836,7 @@ function materializeTelegramCreativeArtifactForSend(root, rawPath) {
658585
658836
  error: `Scoped artifact storage is missing for ${rel}.`
658586
658837
  };
658587
658838
  }
658588
- const blob = readFileSync117(storedAbs);
658839
+ const blob = readFileSync116(storedAbs);
658589
658840
  if (blob.length < object.prefixBytes) {
658590
658841
  return {
658591
658842
  ok: false,
@@ -659383,7 +659634,7 @@ var init_soul_observations = __esm({
659383
659634
  });
659384
659635
 
659385
659636
  // packages/cli/src/tui/telegram-channel-dmn.ts
659386
- import { existsSync as existsSync144, mkdirSync as mkdirSync88, readdirSync as readdirSync52, readFileSync as readFileSync118, writeFileSync as writeFileSync76 } from "node:fs";
659637
+ import { existsSync as existsSync144, mkdirSync as mkdirSync88, readdirSync as readdirSync52, readFileSync as readFileSync117, writeFileSync as writeFileSync76 } from "node:fs";
659387
659638
  import { join as join156 } from "node:path";
659388
659639
  import { createHash as createHash37 } from "node:crypto";
659389
659640
  function safeFilePart(value2) {
@@ -659957,7 +660208,7 @@ function latestTelegramChannelDaydream(repoRoot, sessionKey) {
659957
660208
  const files = readdirSync52(dir).filter((file) => file.endsWith(".json")).sort();
659958
660209
  for (const file of files.reverse()) {
659959
660210
  try {
659960
- return JSON.parse(readFileSync118(join156(dir, file), "utf8"));
660211
+ return JSON.parse(readFileSync117(join156(dir, file), "utf8"));
659961
660212
  } catch {
659962
660213
  }
659963
660214
  }
@@ -661580,7 +661831,7 @@ __export(vision_ingress_exports, {
661580
661831
  runVisionIngress: () => runVisionIngress
661581
661832
  });
661582
661833
  import { execFileSync as execFileSync10 } from "node:child_process";
661583
- import { existsSync as existsSync145, readFileSync as readFileSync119, unlinkSync as unlinkSync31 } from "node:fs";
661834
+ import { existsSync as existsSync145, readFileSync as readFileSync118, unlinkSync as unlinkSync31 } from "node:fs";
661584
661835
  import { join as join157 } from "node:path";
661585
661836
  function isTesseractAvailable() {
661586
661837
  try {
@@ -661635,7 +661886,7 @@ function advancedOcr(imagePath) {
661635
661886
  ], { timeout: 15e3, stdio: "pipe" });
661636
661887
  const txtFile = `${outFile}.txt`;
661637
661888
  if (existsSync145(txtFile)) {
661638
- const text2 = readFileSync119(txtFile, "utf-8").trim();
661889
+ const text2 = readFileSync118(txtFile, "utf-8").trim();
661639
661890
  if (text2.length > 0) results.push(text2);
661640
661891
  try {
661641
661892
  unlinkSync31(txtFile);
@@ -661652,7 +661903,7 @@ function advancedOcr(imagePath) {
661652
661903
  async function queryVisionModel(modelName, imagePath, prompt = "Describe what you see in this image in detail. Include any text, UI elements, code, diagrams, or visual content.") {
661653
661904
  if (!isVisionModel(modelName)) return "";
661654
661905
  if (!existsSync145(imagePath)) return "";
661655
- const imageBuffer = readFileSync119(imagePath);
661906
+ const imageBuffer = readFileSync118(imagePath);
661656
661907
  const base64Image = imageBuffer.toString("base64");
661657
661908
  const broker = getModelBroker();
661658
661909
  const decision2 = await broker.ensureModelLoadable({
@@ -661763,7 +662014,7 @@ import {
661763
662014
  readdirSync as readdirSync53,
661764
662015
  statSync as statSync50,
661765
662016
  statfsSync as statfsSync7,
661766
- readFileSync as readFileSync120,
662017
+ readFileSync as readFileSync119,
661767
662018
  writeFileSync as writeFileSync78,
661768
662019
  appendFileSync as appendFileSync15
661769
662020
  } from "node:fs";
@@ -667886,7 +668137,7 @@ ${mediaContext}` : ""
667886
668137
  const path12 = this.telegramConversationPath(sessionKey);
667887
668138
  if (!existsSync146(path12)) return;
667888
668139
  try {
667889
- const parsed = JSON.parse(readFileSync120(path12, "utf8"));
668140
+ const parsed = JSON.parse(readFileSync119(path12, "utf8"));
667890
668141
  const loadedHistory = Array.isArray(parsed.history) ? parsed.history : [];
667891
668142
  if (Array.isArray(parsed.history)) {
667892
668143
  this.chatHistory.set(
@@ -668098,7 +668349,7 @@ ${mediaContext}` : ""
668098
668349
  for (const file of readdirSync53(this.telegramConversationDir)) {
668099
668350
  if (!file.endsWith(".json")) continue;
668100
668351
  try {
668101
- const raw = readFileSync120(
668352
+ const raw = readFileSync119(
668102
668353
  join158(this.telegramConversationDir, file),
668103
668354
  "utf8"
668104
668355
  );
@@ -672720,7 +672971,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
672720
672971
  const lockFile = join158(lockDir, `bot-${botUserId}.owner.lock`);
672721
672972
  if (existsSync146(lockFile)) {
672722
672973
  try {
672723
- const prior = JSON.parse(readFileSync120(lockFile, "utf8"));
672974
+ const prior = JSON.parse(readFileSync119(lockFile, "utf8"));
672724
672975
  const priorAlive = typeof prior.pid === "number" && prior.pid !== process.pid ? this.processIsAlive(prior.pid) : false;
672725
672976
  if (priorAlive) {
672726
672977
  throw new Error(
@@ -672753,7 +673004,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
672753
673004
  try {
672754
673005
  if (!existsSync146(lockFile)) return;
672755
673006
  try {
672756
- const prior = JSON.parse(readFileSync120(lockFile, "utf8"));
673007
+ const prior = JSON.parse(readFileSync119(lockFile, "utf8"));
672757
673008
  if (prior.pid !== process.pid) return;
672758
673009
  } catch {
672759
673010
  }
@@ -677667,7 +677918,7 @@ Scoped workspace: ${scopedRoot}`,
677667
677918
  readTelegramToolButtonState(nonce) {
677668
677919
  try {
677669
677920
  const parsed = JSON.parse(
677670
- readFileSync120(this.telegramToolButtonPath(nonce), "utf-8")
677921
+ readFileSync119(this.telegramToolButtonPath(nonce), "utf-8")
677671
677922
  );
677672
677923
  if (!parsed || parsed.expiresAt < Date.now()) return null;
677673
677924
  return parsed;
@@ -679020,7 +679271,7 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
679020
679271
  const ingressResult = await runVisionIngress2(
679021
679272
  {
679022
679273
  path: localPath,
679023
- buffer: readFileSync120(localPath),
679274
+ buffer: readFileSync119(localPath),
679024
679275
  mime: telegramImageMime(media)
679025
679276
  },
679026
679277
  this.agentConfig?.model ?? ""
@@ -679385,7 +679636,7 @@ ${text2}`.trim()
679385
679636
  }
679386
679637
  if (!existsSync146(media.value))
679387
679638
  throw new Error(`File does not exist: ${media.value}`);
679388
- const buffer2 = readFileSync120(media.value);
679639
+ const buffer2 = readFileSync119(media.value);
679389
679640
  const boundary = `----omnius-media-${Date.now()}-${Math.random().toString(36).slice(2)}`;
679390
679641
  const filename = basename35(media.value);
679391
679642
  const contentType = mimeForPath(media.value, media.kind);
@@ -679499,7 +679750,7 @@ Content-Type: ${contentType}\r
679499
679750
  const sidecarPath2 = `${imagePath}.json`;
679500
679751
  if (!existsSync146(sidecarPath2)) return null;
679501
679752
  try {
679502
- const raw = readFileSync120(sidecarPath2, "utf8");
679753
+ const raw = readFileSync119(sidecarPath2, "utf8");
679503
679754
  const parsed = JSON.parse(raw);
679504
679755
  if (!parsed || typeof parsed !== "object" || typeof parsed["original_prompt"] !== "string") {
679505
679756
  return null;
@@ -679559,7 +679810,7 @@ Content-Type: ${contentType}\r
679559
679810
  const sidecarPath2 = `${videoPath}.json`;
679560
679811
  if (!existsSync146(sidecarPath2)) return null;
679561
679812
  try {
679562
- const raw = readFileSync120(sidecarPath2, "utf8");
679813
+ const raw = readFileSync119(sidecarPath2, "utf8");
679563
679814
  const parsed = JSON.parse(raw);
679564
679815
  if (!parsed || typeof parsed !== "object" || typeof parsed["original_prompt"] !== "string") {
679565
679816
  return null;
@@ -679704,7 +679955,7 @@ Content-Type: ${contentType}\r
679704
679955
  addField(field, pathOrFileId);
679705
679956
  continue;
679706
679957
  }
679707
- const buffer2 = readFileSync120(pathOrFileId);
679958
+ const buffer2 = readFileSync119(pathOrFileId);
679708
679959
  const filename = basename35(pathOrFileId);
679709
679960
  parts.push(Buffer.from(`--${boundary}\r
679710
679961
  `));
@@ -681478,14 +681729,14 @@ __export(projects_exports, {
681478
681729
  setCurrentProject: () => setCurrentProject,
681479
681730
  unregisterProject: () => unregisterProject
681480
681731
  });
681481
- import { readFileSync as readFileSync121, writeFileSync as writeFileSync79, mkdirSync as mkdirSync90, existsSync as existsSync147, statSync as statSync51, renameSync as renameSync12 } from "node:fs";
681732
+ import { readFileSync as readFileSync120, writeFileSync as writeFileSync79, mkdirSync as mkdirSync90, existsSync as existsSync147, statSync as statSync51, renameSync as renameSync12 } from "node:fs";
681482
681733
  import { homedir as homedir52 } from "node:os";
681483
681734
  import { basename as basename36, join as join159, resolve as resolve63 } from "node:path";
681484
681735
  import { randomUUID as randomUUID19 } from "node:crypto";
681485
681736
  function readAll2() {
681486
681737
  try {
681487
681738
  if (!existsSync147(PROJECTS_FILE)) return { projects: [], schemaVersion: 1 };
681488
- const raw = readFileSync121(PROJECTS_FILE, "utf8");
681739
+ const raw = readFileSync120(PROJECTS_FILE, "utf8");
681489
681740
  const parsed = JSON.parse(raw);
681490
681741
  if (!parsed || !Array.isArray(parsed.projects)) return { projects: [], schemaVersion: 1 };
681491
681742
  return { projects: parsed.projects, schemaVersion: 1 };
@@ -681562,7 +681813,7 @@ function getCurrentProject() {
681562
681813
  if (!currentRoot) {
681563
681814
  try {
681564
681815
  if (existsSync147(CURRENT_FILE)) {
681565
- const persisted = readFileSync121(CURRENT_FILE, "utf8").trim();
681816
+ const persisted = readFileSync120(CURRENT_FILE, "utf8").trim();
681566
681817
  if (persisted) currentRoot = persisted;
681567
681818
  }
681568
681819
  } catch {
@@ -682476,7 +682727,7 @@ var init_access_policy = __esm({
682476
682727
 
682477
682728
  // packages/cli/src/api/project-preferences.ts
682478
682729
  import { createHash as createHash41 } from "node:crypto";
682479
- import { existsSync as existsSync148, mkdirSync as mkdirSync91, readFileSync as readFileSync122, renameSync as renameSync13, writeFileSync as writeFileSync80, unlinkSync as unlinkSync33 } from "node:fs";
682730
+ import { existsSync as existsSync148, mkdirSync as mkdirSync91, readFileSync as readFileSync121, renameSync as renameSync13, writeFileSync as writeFileSync80, unlinkSync as unlinkSync33 } from "node:fs";
682480
682731
  import { homedir as homedir53 } from "node:os";
682481
682732
  import { join as join160, resolve as resolve64 } from "node:path";
682482
682733
  import { randomUUID as randomUUID20 } from "node:crypto";
@@ -682509,7 +682760,7 @@ function readProjectPreferences(root) {
682509
682760
  try {
682510
682761
  const file = prefsPath(root);
682511
682762
  if (!existsSync148(file)) return { ...DEFAULT_PREFS };
682512
- const raw = readFileSync122(file, "utf8");
682763
+ const raw = readFileSync121(file, "utf8");
682513
682764
  const parsed = JSON.parse(raw);
682514
682765
  if (!parsed || parsed.v !== SCHEMA_VERSION) return { ...DEFAULT_PREFS };
682515
682766
  return { ...DEFAULT_PREFS, ...parsed, v: SCHEMA_VERSION };
@@ -682576,7 +682827,7 @@ __export(audit_log_exports, {
682576
682827
  recordAudit: () => recordAudit,
682577
682828
  sanitizeBody: () => sanitizeBody
682578
682829
  });
682579
- import { mkdirSync as mkdirSync92, appendFileSync as appendFileSync16, readFileSync as readFileSync123, existsSync as existsSync149 } from "node:fs";
682830
+ import { mkdirSync as mkdirSync92, appendFileSync as appendFileSync16, readFileSync as readFileSync122, existsSync as existsSync149 } from "node:fs";
682580
682831
  import { join as join161 } from "node:path";
682581
682832
  function initAuditLog(omniusDir) {
682582
682833
  auditDir = join161(omniusDir, "audit");
@@ -682613,7 +682864,7 @@ function sanitizeBody(body, maxLen = 200) {
682613
682864
  function queryAudit(opts) {
682614
682865
  if (!initialized || !existsSync149(auditFile)) return [];
682615
682866
  try {
682616
- const raw = readFileSync123(auditFile, "utf-8");
682867
+ const raw = readFileSync122(auditFile, "utf-8");
682617
682868
  const lines = raw.split("\n").filter(Boolean);
682618
682869
  let records = lines.map((l2) => {
682619
682870
  try {
@@ -683576,7 +683827,7 @@ var init_direct_tool_registry = __esm({
683576
683827
  });
683577
683828
 
683578
683829
  // packages/cli/src/api/external-tool-registry.ts
683579
- import { existsSync as existsSync152, mkdirSync as mkdirSync95, readFileSync as readFileSync124, writeFileSync as writeFileSync81, renameSync as renameSync14 } from "node:fs";
683830
+ import { existsSync as existsSync152, mkdirSync as mkdirSync95, readFileSync as readFileSync123, writeFileSync as writeFileSync81, renameSync as renameSync14 } from "node:fs";
683580
683831
  import { join as join163 } from "node:path";
683581
683832
  function externalToolStorePath(workingDir) {
683582
683833
  return join163(workingDir, ".omnius", "external-tools.json");
@@ -683585,7 +683836,7 @@ function loadExternalTools(workingDir) {
683585
683836
  const path12 = externalToolStorePath(workingDir);
683586
683837
  if (!existsSync152(path12)) return [];
683587
683838
  try {
683588
- const parsed = JSON.parse(readFileSync124(path12, "utf-8"));
683839
+ const parsed = JSON.parse(readFileSync123(path12, "utf-8"));
683589
683840
  if (!parsed || !Array.isArray(parsed.tools)) return [];
683590
683841
  return parsed.tools.filter(
683591
683842
  (t2) => t2 && typeof t2.name === "string" && t2.transport != null
@@ -683924,7 +684175,7 @@ __export(aiwg_exports, {
683924
684175
  resolveAiwgRoot: () => resolveAiwgRoot,
683925
684176
  tryRouteAiwg: () => tryRouteAiwg
683926
684177
  });
683927
- import { existsSync as existsSync153, readFileSync as readFileSync125, readdirSync as readdirSync54, statSync as statSync54 } from "node:fs";
684178
+ import { existsSync as existsSync153, readFileSync as readFileSync124, readdirSync as readdirSync54, statSync as statSync54 } from "node:fs";
683928
684179
  import { join as join164 } from "node:path";
683929
684180
  import { homedir as homedir54 } from "node:os";
683930
684181
  import { execSync as execSync58 } from "node:child_process";
@@ -683995,7 +684246,7 @@ function resolveAiwgRoot() {
683995
684246
  const pj = join164(cur, "package.json");
683996
684247
  if (existsSync153(pj)) {
683997
684248
  try {
683998
- const pkg = JSON.parse(readFileSync125(pj, "utf-8"));
684249
+ const pkg = JSON.parse(readFileSync124(pj, "utf-8"));
683999
684250
  if (pkg.name === "aiwg") {
684000
684251
  _cachedAiwgRoot = cur;
684001
684252
  return cur;
@@ -684085,7 +684336,7 @@ function readFirstLineDescription(dir) {
684085
684336
  const p2 = join164(dir, candidate);
684086
684337
  if (!existsSync153(p2)) continue;
684087
684338
  try {
684088
- const txt = readFileSync125(p2, "utf-8");
684339
+ const txt = readFileSync124(p2, "utf-8");
684089
684340
  const descMatch = txt.match(/^description:\s*(.+)$/m);
684090
684341
  if (descMatch) return descMatch[1].trim().slice(0, 200);
684091
684342
  for (const line of txt.split("\n")) {
@@ -684136,7 +684387,7 @@ function walkForItems(dir, out, depth) {
684136
684387
  }
684137
684388
  function parseItem(p2) {
684138
684389
  try {
684139
- const raw = readFileSync125(p2, "utf-8");
684390
+ const raw = readFileSync124(p2, "utf-8");
684140
684391
  const header = raw.slice(0, 3e3);
684141
684392
  const nameMatch = header.match(/^name:\s*(.+)$/m);
684142
684393
  const descMatch = header.match(/^description:\s*(.+)$/m);
@@ -684175,7 +684426,7 @@ function deriveSource(p2) {
684175
684426
  function loadAiwgItemContent(path12, maxBytes = 2e4) {
684176
684427
  try {
684177
684428
  if (!existsSync153(path12)) return null;
684178
- const raw = readFileSync125(path12, "utf-8");
684429
+ const raw = readFileSync124(path12, "utf-8");
684179
684430
  return raw.length > maxBytes ? raw.slice(0, maxBytes) + "\n\n...(truncated for context budget)" : raw;
684180
684431
  } catch {
684181
684432
  return null;
@@ -684711,7 +684962,7 @@ __export(runtime_keys_exports, {
684711
684962
  mintKey: () => mintKey,
684712
684963
  revokeByPrefix: () => revokeByPrefix
684713
684964
  });
684714
- import { existsSync as existsSync154, readFileSync as readFileSync126, writeFileSync as writeFileSync82, mkdirSync as mkdirSync96, chmodSync as chmodSync4 } from "node:fs";
684965
+ import { existsSync as existsSync154, readFileSync as readFileSync125, writeFileSync as writeFileSync82, mkdirSync as mkdirSync96, chmodSync as chmodSync4 } from "node:fs";
684715
684966
  import { join as join165 } from "node:path";
684716
684967
  import { homedir as homedir55 } from "node:os";
684717
684968
  import { randomBytes as randomBytes27 } from "node:crypto";
@@ -684722,7 +684973,7 @@ function ensureDir2() {
684722
684973
  function loadAll() {
684723
684974
  if (!existsSync154(KEYS_FILE)) return [];
684724
684975
  try {
684725
- const raw = readFileSync126(KEYS_FILE, "utf-8");
684976
+ const raw = readFileSync125(KEYS_FILE, "utf-8");
684726
684977
  const parsed = JSON.parse(raw);
684727
684978
  if (!Array.isArray(parsed)) return [];
684728
684979
  return parsed;
@@ -684808,7 +685059,7 @@ __export(tor_fallback_exports, {
684808
685059
  torIsReachable: () => torIsReachable,
684809
685060
  tunnelViaTor: () => tunnelViaTor
684810
685061
  });
684811
- import { existsSync as existsSync155, readFileSync as readFileSync127 } from "node:fs";
685062
+ import { existsSync as existsSync155, readFileSync as readFileSync126 } from "node:fs";
684812
685063
  import { homedir as homedir56 } from "node:os";
684813
685064
  import { join as join166 } from "node:path";
684814
685065
  import { createConnection as createConnection3 } from "node:net";
@@ -684821,7 +685072,7 @@ function getLocalOnion() {
684821
685072
  for (const p2 of candidates) {
684822
685073
  try {
684823
685074
  if (existsSync155(p2)) {
684824
- const v = readFileSync127(p2, "utf-8").trim();
685075
+ const v = readFileSync126(p2, "utf-8").trim();
684825
685076
  if (v && v.endsWith(".onion")) return v;
684826
685077
  }
684827
685078
  } catch {
@@ -685082,7 +685333,7 @@ var init_graphical_sudo = __esm({
685082
685333
  });
685083
685334
 
685084
685335
  // packages/cli/src/api/routes-v1.ts
685085
- import { existsSync as existsSync157, mkdirSync as mkdirSync98, readFileSync as readFileSync128, readdirSync as readdirSync55, statSync as statSync55 } from "node:fs";
685336
+ import { existsSync as existsSync157, mkdirSync as mkdirSync98, readFileSync as readFileSync127, readdirSync as readdirSync55, statSync as statSync55 } from "node:fs";
685086
685337
  import { join as join168, resolve as pathResolve3 } from "node:path";
685087
685338
  import { homedir as homedir57 } from "node:os";
685088
685339
  async function tryRouteV1(ctx3) {
@@ -685359,7 +685610,7 @@ function walkForSkills(dir, out, depth) {
685359
685610
  walkForSkills(p2, out, depth + 1);
685360
685611
  } else if (e2.isFile() && e2.name === "SKILL.md") {
685361
685612
  try {
685362
- const content = readFileSync128(p2, "utf-8").slice(0, 2e3);
685613
+ const content = readFileSync127(p2, "utf-8").slice(0, 2e3);
685363
685614
  const nameMatch = content.match(/^name:\s*(.+)$/m);
685364
685615
  const descMatch = content.match(/^description:\s*(.+)$/m);
685365
685616
  out.push({
@@ -686315,7 +686566,7 @@ async function handleFilesRead(ctx3) {
686315
686566
  }));
686316
686567
  return true;
686317
686568
  }
686318
- const content = readFileSync128(resolved, "utf-8");
686569
+ const content = readFileSync127(resolved, "utf-8");
686319
686570
  const offset = typeof body.offset === "number" && body.offset >= 0 ? body.offset : 0;
686320
686571
  const limit = typeof body.limit === "number" && body.limit > 0 ? body.limit : content.length;
686321
686572
  const slice2 = content.slice(offset, offset + limit);
@@ -686555,7 +686806,7 @@ async function handleNexusStatus(ctx3) {
686555
686806
  for (const p2 of statePaths) {
686556
686807
  if (!existsSync157(p2)) continue;
686557
686808
  try {
686558
- const raw = readFileSync128(p2, "utf-8");
686809
+ const raw = readFileSync127(p2, "utf-8");
686559
686810
  states2.push({ source: p2, data: JSON.parse(raw) });
686560
686811
  } catch (e2) {
686561
686812
  states2.push({ source: p2, error: String(e2) });
@@ -686583,7 +686834,7 @@ async function handleNexusStatus(ctx3) {
686583
686834
  function loadAgentName() {
686584
686835
  try {
686585
686836
  const p2 = join168(homedir57(), ".omnius", "agent-name");
686586
- if (existsSync157(p2)) return readFileSync128(p2, "utf-8").trim();
686837
+ if (existsSync157(p2)) return readFileSync127(p2, "utf-8").trim();
686587
686838
  } catch {
686588
686839
  }
686589
686840
  return null;
@@ -686599,7 +686850,7 @@ async function handleSponsors(ctx3) {
686599
686850
  for (const p2 of candidates) {
686600
686851
  if (!existsSync157(p2)) continue;
686601
686852
  try {
686602
- const raw = JSON.parse(readFileSync128(p2, "utf-8"));
686853
+ const raw = JSON.parse(readFileSync127(p2, "utf-8"));
686603
686854
  if (Array.isArray(raw)) {
686604
686855
  sponsors = raw;
686605
686856
  break;
@@ -686679,7 +686930,7 @@ async function handleEvaluate(ctx3) {
686679
686930
  }));
686680
686931
  return true;
686681
686932
  }
686682
- const job = JSON.parse(readFileSync128(jobPath, "utf-8"));
686933
+ const job = JSON.parse(readFileSync127(jobPath, "utf-8"));
686683
686934
  sendJson2(res, 200, {
686684
686935
  run_id: runId,
686685
686936
  task: job.task,
@@ -686819,7 +687070,7 @@ async function handleMintKey(ctx3) {
686819
687070
  function _readStatusFile(p2) {
686820
687071
  if (!existsSync157(p2)) return null;
686821
687072
  try {
686822
- const data = JSON.parse(readFileSync128(p2, "utf-8"));
687073
+ const data = JSON.parse(readFileSync127(p2, "utf-8"));
686823
687074
  if (data?.connected && typeof data.peerId === "string" && data.peerId.length > 10) {
686824
687075
  const pid = Number(data.pid);
686825
687076
  if (pid > 0) {
@@ -686862,7 +687113,7 @@ function resolveLocalPeerId() {
686862
687113
  try {
686863
687114
  const regPath = join168(homedir57(), ".omnius", "nexus-registry.json");
686864
687115
  if (existsSync157(regPath)) {
686865
- const reg = JSON.parse(readFileSync128(regPath, "utf-8"));
687116
+ const reg = JSON.parse(readFileSync127(regPath, "utf-8"));
686866
687117
  const entries = Array.isArray(reg?.dirs) ? reg.dirs : [];
686867
687118
  for (const entry of entries) {
686868
687119
  const dir = typeof entry === "string" ? entry : entry?.dir;
@@ -688374,7 +688625,7 @@ function aimsDir() {
688374
688625
  function readAimsFile(name10, fallback) {
688375
688626
  try {
688376
688627
  const p2 = join168(aimsDir(), name10);
688377
- if (existsSync157(p2)) return JSON.parse(readFileSync128(p2, "utf-8"));
688628
+ if (existsSync157(p2)) return JSON.parse(readFileSync127(p2, "utf-8"));
688378
688629
  } catch {
688379
688630
  }
688380
688631
  return fallback;
@@ -688751,7 +689002,7 @@ async function handleAimsSuppliers(ctx3) {
688751
689002
  for (const p2 of sponsorPaths) {
688752
689003
  if (!existsSync157(p2)) continue;
688753
689004
  try {
688754
- const raw = JSON.parse(readFileSync128(p2, "utf-8"));
689005
+ const raw = JSON.parse(readFileSync127(p2, "utf-8"));
688755
689006
  const list = Array.isArray(raw) ? raw : raw?.sponsors ?? [];
688756
689007
  for (const s2 of list) {
688757
689008
  suppliers.push({
@@ -700038,7 +700289,7 @@ var init_auth_oidc = __esm({
700038
700289
  });
700039
700290
 
700040
700291
  // packages/cli/src/api/usage-tracker.ts
700041
- import { mkdirSync as mkdirSync99, readFileSync as readFileSync129, writeFileSync as writeFileSync84, existsSync as existsSync158 } from "node:fs";
700292
+ import { mkdirSync as mkdirSync99, readFileSync as readFileSync128, writeFileSync as writeFileSync84, existsSync as existsSync158 } from "node:fs";
700042
700293
  import { join as join169 } from "node:path";
700043
700294
  function initUsageTracker(omniusDir) {
700044
700295
  const dir = join169(omniusDir, "usage");
@@ -700046,7 +700297,7 @@ function initUsageTracker(omniusDir) {
700046
700297
  usageFile = join169(dir, "token-usage.json");
700047
700298
  try {
700048
700299
  if (existsSync158(usageFile)) {
700049
- store = JSON.parse(readFileSync129(usageFile, "utf-8"));
700300
+ store = JSON.parse(readFileSync128(usageFile, "utf-8"));
700050
700301
  }
700051
700302
  } catch {
700052
700303
  store = { providers: {}, lastSaved: "" };
@@ -700745,7 +700996,7 @@ import {
700745
700996
  createReadStream as createReadStream2,
700746
700997
  mkdirSync as mkdirSync101,
700747
700998
  writeFileSync as writeFileSync86,
700748
- readFileSync as readFileSync130,
700999
+ readFileSync as readFileSync129,
700749
701000
  readdirSync as readdirSync56,
700750
701001
  existsSync as existsSync160,
700751
701002
  watch as fsWatch4,
@@ -700777,7 +701028,7 @@ function getVersion3() {
700777
701028
  for (const pkgPath of candidates) {
700778
701029
  try {
700779
701030
  if (!existsSync160(pkgPath)) continue;
700780
- const pkg = JSON.parse(readFileSync130(pkgPath, "utf8"));
701031
+ const pkg = JSON.parse(readFileSync129(pkgPath, "utf8"));
700781
701032
  if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
700782
701033
  return pkg.version ?? "0.0.0";
700783
701034
  }
@@ -701193,7 +701444,7 @@ function isOriginAllowed(origin) {
701193
701444
  try {
701194
701445
  const accessFile = join172(homedir59(), ".omnius", "access");
701195
701446
  if (existsSync160(accessFile)) {
701196
- const persisted = readFileSync130(accessFile, "utf8").trim().toLowerCase();
701447
+ const persisted = readFileSync129(accessFile, "utf8").trim().toLowerCase();
701197
701448
  if (persisted === "any" || persisted === "lan" || persisted === "loopback") {
701198
701449
  accessMode = persisted;
701199
701450
  }
@@ -702045,7 +702296,7 @@ function loadJob(id) {
702045
702296
  const file = join172(jobsDir(), `${id}.json`);
702046
702297
  if (!existsSync160(file)) return null;
702047
702298
  try {
702048
- return JSON.parse(readFileSync130(file, "utf-8"));
702299
+ return JSON.parse(readFileSync129(file, "utf-8"));
702049
702300
  } catch {
702050
702301
  return null;
702051
702302
  }
@@ -702058,7 +702309,7 @@ function listJobs2() {
702058
702309
  for (const file of files) {
702059
702310
  try {
702060
702311
  jobs.push(
702061
- JSON.parse(readFileSync130(join172(dir, file), "utf-8"))
702312
+ JSON.parse(readFileSync129(join172(dir, file), "utf-8"))
702062
702313
  );
702063
702314
  } catch {
702064
702315
  }
@@ -702076,7 +702327,7 @@ function pruneOldJobs() {
702076
702327
  if (!file.endsWith(".json")) continue;
702077
702328
  const path12 = join172(dir, file);
702078
702329
  try {
702079
- const job = JSON.parse(readFileSync130(path12, "utf-8"));
702330
+ const job = JSON.parse(readFileSync129(path12, "utf-8"));
702080
702331
  if (job.status === "running") {
702081
702332
  kept++;
702082
702333
  continue;
@@ -704230,7 +704481,7 @@ function readUpdateState() {
704230
704481
  try {
704231
704482
  const p2 = updateStateFile();
704232
704483
  if (!existsSync160(p2)) return null;
704233
- return JSON.parse(readFileSync130(p2, "utf-8"));
704484
+ return JSON.parse(readFileSync129(p2, "utf-8"));
704234
704485
  } catch {
704235
704486
  return null;
704236
704487
  }
@@ -704535,7 +704786,7 @@ function handleV1UpdateStatus(res) {
704535
704786
  let exitCode = null;
704536
704787
  try {
704537
704788
  if (existsSync160(logPath3)) {
704538
- const raw = readFileSync130(logPath3, "utf-8");
704789
+ const raw = readFileSync129(logPath3, "utf-8");
704539
704790
  const m2 = raw.match(/__EXIT_CODE=(\d+)/);
704540
704791
  if (m2) exitCode = parseInt(m2[1], 10);
704541
704792
  logTail = raw.slice(-2e3);
@@ -709015,7 +709266,7 @@ function listScheduledTasks() {
709015
709266
  if (dir.endsWith(`${join172(".omnius", "scheduled")}`) || dir.includes(`${join172(".omnius", "scheduled")}`)) {
709016
709267
  const file = join172(dir, "tasks.json");
709017
709268
  try {
709018
- const raw = readFileSync130(file, "utf-8");
709269
+ const raw = readFileSync129(file, "utf-8");
709019
709270
  const json = JSON.parse(raw);
709020
709271
  const tasks = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
709021
709272
  tasks.forEach((t2, i2) => {
@@ -709113,7 +709364,7 @@ function setScheduledEnabled(id, enabled2) {
709113
709364
  const target = tasks.find((t2) => t2.id === id);
709114
709365
  if (!target) return false;
709115
709366
  try {
709116
- const raw = readFileSync130(target.file, "utf-8");
709367
+ const raw = readFileSync129(target.file, "utf-8");
709117
709368
  const json = JSON.parse(raw);
709118
709369
  const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
709119
709370
  if (!arr[target.index]) return false;
@@ -709146,7 +709397,7 @@ function deleteScheduledById(id) {
709146
709397
  const target = tasks.find((t2) => t2.id === id);
709147
709398
  if (!target) return false;
709148
709399
  try {
709149
- const raw = readFileSync130(target.file, "utf-8");
709400
+ const raw = readFileSync129(target.file, "utf-8");
709150
709401
  const json = JSON.parse(raw);
709151
709402
  const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
709152
709403
  if (!arr[target.index]) return false;
@@ -709371,7 +709622,7 @@ function reconcileScheduledTasks(apply) {
709371
709622
  try {
709372
709623
  let json = { tasks: [] };
709373
709624
  try {
709374
- const raw = readFileSync130(file, "utf-8");
709625
+ const raw = readFileSync129(file, "utf-8");
709375
709626
  json = JSON.parse(raw);
709376
709627
  } catch {
709377
709628
  }
@@ -709750,7 +710001,7 @@ function startApiServer(options2 = {}) {
709750
710001
  const sid = f2.replace(/\.json$/, "");
709751
710002
  try {
709752
710003
  const items = JSON.parse(
709753
- readFileSync130(join172(dir, f2), "utf-8")
710004
+ readFileSync129(join172(dir, f2), "utf-8")
709754
710005
  );
709755
710006
  if (Array.isArray(items)) {
709756
710007
  cache8.set(sid, new Map(items.map((t2) => [t2.id, t2])));
@@ -709784,7 +710035,7 @@ function startApiServer(options2 = {}) {
709784
710035
  }
709785
710036
  return;
709786
710037
  }
709787
- next = JSON.parse(readFileSync130(fp, "utf-8"));
710038
+ next = JSON.parse(readFileSync129(fp, "utf-8"));
709788
710039
  if (!Array.isArray(next)) return;
709789
710040
  } catch {
709790
710041
  return;
@@ -709847,7 +710098,7 @@ function startApiServer(options2 = {}) {
709847
710098
  if (!f2.endsWith(".json")) continue;
709848
710099
  try {
709849
710100
  const jobPath = join172(jobsDir3, f2);
709850
- const job = JSON.parse(readFileSync130(jobPath, "utf-8"));
710101
+ const job = JSON.parse(readFileSync129(jobPath, "utf-8"));
709851
710102
  const jobTime = new Date(
709852
710103
  job.startedAt ?? job.completedAt ?? 0
709853
710104
  ).getTime();
@@ -709869,8 +710120,8 @@ function startApiServer(options2 = {}) {
709869
710120
  if (useTls) {
709870
710121
  try {
709871
710122
  tlsOpts = {
709872
- cert: readFileSync130(resolve66(tlsCert)),
709873
- key: readFileSync130(resolve66(tlsKey))
710123
+ cert: readFileSync129(resolve66(tlsCert)),
710124
+ key: readFileSync129(resolve66(tlsKey))
709874
710125
  };
709875
710126
  } catch (e2) {
709876
710127
  log22(`
@@ -709883,7 +710134,7 @@ function startApiServer(options2 = {}) {
709883
710134
  try {
709884
710135
  const accessFile = join172(homedir59(), ".omnius", "access");
709885
710136
  if (existsSync160(accessFile)) {
709886
- const persisted = readFileSync130(accessFile, "utf8").trim();
710137
+ const persisted = readFileSync129(accessFile, "utf8").trim();
709887
710138
  const resolved = resolveAccessMode(persisted, host);
709888
710139
  if (resolved) runtimeAccessMode = resolved;
709889
710140
  }
@@ -710314,7 +710565,7 @@ function startApiServer(options2 = {}) {
710314
710565
  for (const rel of ["../package.json", "../../package.json", "../../../package.json", "../../../../package.json"]) {
710315
710566
  const p2 = join172(here, rel);
710316
710567
  if (existsSync160(p2)) {
710317
- const pkg = JSON.parse(readFileSync130(p2, "utf8"));
710568
+ const pkg = JSON.parse(readFileSync129(p2, "utf8"));
710318
710569
  if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
710319
710570
  return pkg.version ?? null;
710320
710571
  }
@@ -711262,7 +711513,7 @@ __export(clipboard_media_exports, {
711262
711513
  pasteClipboardImageToFile: () => pasteClipboardImageToFile
711263
711514
  });
711264
711515
  import { execFileSync as execFileSync11, execSync as execSync61 } from "node:child_process";
711265
- import { mkdirSync as mkdirSync102, readFileSync as readFileSync131, rmSync as rmSync13, writeFileSync as writeFileSync87 } from "node:fs";
711516
+ import { mkdirSync as mkdirSync102, readFileSync as readFileSync130, rmSync as rmSync13, writeFileSync as writeFileSync87 } from "node:fs";
711266
711517
  import { join as join173 } from "node:path";
711267
711518
  function pasteClipboardImageToFile(repoRoot) {
711268
711519
  const image = readClipboardImage();
@@ -711279,7 +711530,7 @@ function readClipboardImage() {
711279
711530
  execSync61("command -v pngpaste", { stdio: "ignore", timeout: 1e3 });
711280
711531
  const tmp = `/tmp/omnius-clipboard-${Date.now()}.png`;
711281
711532
  execFileSync11("pngpaste", [tmp], { timeout: 3e3 });
711282
- const buffer2 = readFileSync131(tmp);
711533
+ const buffer2 = readFileSync130(tmp);
711283
711534
  try {
711284
711535
  rmSync13(tmp);
711285
711536
  } catch {
@@ -711338,7 +711589,7 @@ import { resolve as resolve67, join as join174, dirname as dirname52, extname as
711338
711589
  import { createRequire as createRequire9 } from "node:module";
711339
711590
  import { fileURLToPath as fileURLToPath21 } from "node:url";
711340
711591
  import {
711341
- readFileSync as readFileSync132,
711592
+ readFileSync as readFileSync131,
711342
711593
  writeFileSync as writeFileSync88,
711343
711594
  appendFileSync as appendFileSync17,
711344
711595
  rmSync as rmSync14,
@@ -711347,6 +711598,11 @@ import {
711347
711598
  mkdirSync as mkdirSync103
711348
711599
  } from "node:fs";
711349
711600
  import { existsSync as existsSync161 } from "node:fs";
711601
+ import {
711602
+ readFile as readFileAsync2,
711603
+ writeFile as writeFileAsync2,
711604
+ mkdir as mkdirAsync
711605
+ } from "node:fs/promises";
711350
711606
  import { execSync as execSync62 } from "node:child_process";
711351
711607
  import { homedir as homedir60 } from "node:os";
711352
711608
  function formatTimeAgo2(date) {
@@ -711514,13 +711770,14 @@ ${incompleteList}${more}
711514
711770
  const scripts = pkg.scripts || {};
711515
711771
  const checkScript = scripts["typecheck"] ? "typecheck" : scripts["build"] ? "build" : null;
711516
711772
  if (checkScript) {
711517
- const { execSync: execSync63 } = await import("node:child_process");
711773
+ const { exec: exec6 } = await import("node:child_process");
711774
+ const { promisify: promisify8 } = await import("node:util");
711518
711775
  try {
711519
- execSync63(`npm run ${checkScript} --silent 2>&1`, {
711776
+ await promisify8(exec6)(`npm run ${checkScript} --silent 2>&1`, {
711520
711777
  cwd: cwd4,
711521
- stdio: "pipe",
711522
711778
  timeout: 12e4,
711523
- encoding: "utf-8"
711779
+ encoding: "utf-8",
711780
+ maxBuffer: 10 * 1024 * 1024
711524
711781
  });
711525
711782
  } catch (e2) {
711526
711783
  const out = ((e2?.stdout || "") + (e2?.stderr || "")).toString().slice(0, 2e3);
@@ -712728,7 +712985,7 @@ function gatherMemorySnippets(root) {
712728
712985
  if (!existsSync161(dir)) continue;
712729
712986
  try {
712730
712987
  for (const f2 of readdirSync57(dir).filter((f3) => f3.endsWith(".json"))) {
712731
- const data = JSON.parse(readFileSync132(join174(dir, f2), "utf-8"));
712988
+ const data = JSON.parse(readFileSync131(join174(dir, f2), "utf-8"));
712732
712989
  for (const val of Object.values(data)) {
712733
712990
  const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
712734
712991
  if (v.length > 10) snippets.push(v);
@@ -713164,7 +713421,7 @@ ${metabolismMemories}
713164
713421
  try {
713165
713422
  const archeFile = join174(repoRoot, ".omnius", "arche", "variants.json");
713166
713423
  if (existsSync161(archeFile)) {
713167
- const variants = JSON.parse(readFileSync132(archeFile, "utf8"));
713424
+ const variants = JSON.parse(readFileSync131(archeFile, "utf8"));
713168
713425
  if (variants.length > 0) {
713169
713426
  let filtered = variants;
713170
713427
  if (taskType) {
@@ -713279,8 +713536,8 @@ RULES:
713279
713536
  const localCheckResp = (() => {
713280
713537
  try {
713281
713538
  return __require("node:child_process").execSync(
713282
- "curl -s http://localhost:11434/api/tags 2>/dev/null",
713283
- { encoding: "utf8", timeout: 3e3 }
713539
+ "curl -s --max-time 1 http://localhost:11434/api/tags 2>/dev/null",
713540
+ { encoding: "utf8", timeout: 1500 }
713284
713541
  );
713285
713542
  } catch {
713286
713543
  return "";
@@ -713421,7 +713678,7 @@ RULES:
713421
713678
  "self-state.json"
713422
713679
  );
713423
713680
  if (existsSync161(ikStateFile)) {
713424
- const selfState = JSON.parse(readFileSync132(ikStateFile, "utf8"));
713681
+ const selfState = JSON.parse(readFileSync131(ikStateFile, "utf8"));
713425
713682
  const lines = [
713426
713683
  `[Identity State v${selfState.version}]`,
713427
713684
  `Self: ${selfState.narrative_summary}`,
@@ -713759,7 +714016,7 @@ Review its full output via sub_agent(action='output', id='${id}')`
713759
714016
  }
713760
714017
  }
713761
714018
  try {
713762
- const { readdirSync: readdirSync59, readFileSync: readFileSync134, existsSync: existsSync164 } = await import("node:fs");
714019
+ const { readdirSync: readdirSync59, readFileSync: readFileSync133, existsSync: existsSync164 } = await import("node:fs");
713763
714020
  const { join: pathJoin } = await import("node:path");
713764
714021
  const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
713765
714022
  if (existsSync164(chunksDir)) {
@@ -713769,7 +714026,7 @@ Review its full output via sub_agent(action='output', id='${id}')`
713769
714026
  for (const f2 of files) {
713770
714027
  try {
713771
714028
  const data = JSON.parse(
713772
- readFileSync134(pathJoin(chunksDir, f2), "utf-8")
714029
+ readFileSync133(pathJoin(chunksDir, f2), "utf-8")
713773
714030
  );
713774
714031
  if (data._deleted) continue;
713775
714032
  if ((data.functionalSummary || "").toLowerCase().includes(q) || (data.detailSummary || "").toLowerCase().includes(q) || (data.keyFiles || []).some(
@@ -713835,7 +714092,7 @@ ${lines.join("\n")}`
713835
714092
  const expand2 = args.expand === true;
713836
714093
  if (expand2 && id.startsWith("todo-ctx-")) {
713837
714094
  try {
713838
- const { readFileSync: readFileSync134, existsSync: existsSync164 } = await import("node:fs");
714095
+ const { readFileSync: readFileSync133, existsSync: existsSync164 } = await import("node:fs");
713839
714096
  const { join: pathJoin } = await import("node:path");
713840
714097
  const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
713841
714098
  const todoIdSuffix = id.replace("todo-ctx-", "");
@@ -714851,136 +715108,139 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
714851
715108
  runSelfImprovementCycle(repoRoot).catch(() => {
714852
715109
  });
714853
715110
  }
714854
- try {
714855
- const ikDir = join174(repoRoot, ".omnius", "identity");
714856
- const ikFile = join174(ikDir, "self-state.json");
714857
- let ikState;
714858
- if (existsSync161(ikFile)) {
714859
- ikState = JSON.parse(readFileSync132(ikFile, "utf8"));
714860
- } else {
714861
- mkdirSync103(ikDir, { recursive: true });
714862
- const machineId = Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
714863
- ikState = {
714864
- self_id: `omnius-${machineId}`,
714865
- version: 1,
714866
- narrative_summary: "I am an AI coding agent powered by open-weight models. I help with software engineering tasks by reading code, making changes, and running tests.",
714867
- active_commitments: [
714868
- "assist the user effectively",
714869
- "maintain code quality"
714870
- ],
714871
- active_goals: [],
714872
- open_contradictions: [],
714873
- values_stack: [
714874
- "correctness",
714875
- "efficiency",
714876
- "transparency",
714877
- "user-alignment"
714878
- ],
714879
- interaction_style: {
714880
- tone: "collaborative",
714881
- depth_default: "balanced",
714882
- speech_style: "concise"
714883
- },
714884
- relationship_models: [],
714885
- homeostasis: {
714886
- uncertainty: 0.1,
714887
- coherence: 1,
714888
- goal_tension: 0,
714889
- memory_trust: 0.9,
714890
- boundary_breach: 0,
714891
- latency_stress: 0
714892
- },
714893
- created_at: (/* @__PURE__ */ new Date()).toISOString(),
714894
- updated_at: (/* @__PURE__ */ new Date()).toISOString(),
714895
- session_count: 0,
714896
- version_history: [
714897
- {
714898
- version: 1,
714899
- change: "Initial identity creation",
714900
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
714901
- }
714902
- ]
714903
- };
714904
- }
714905
- if (!ikState.stats)
714906
- ikState.stats = {
714907
- queries_served: 0,
714908
- self_play_cycles: 0,
714909
- learnings_published: 0,
714910
- learnings_ingested: 0,
714911
- reviews_given: 0,
714912
- reviews_received: 0,
714913
- avg_latency_ms: 0,
714914
- tool_use_count: 0
714915
- };
714916
- if (!ikState.specializations) ikState.specializations = [];
714917
- if (!ikState.completed_goals) ikState.completed_goals = [];
714918
- if (!ikState.version_history) ikState.version_history = [];
714919
- ikState.stats.queries_served++;
714920
- const event = `Task completed: ${result.summary.slice(0, 200)}`;
714921
- if (/success|pass|complete|done|fixed/i.test(event)) {
714922
- ikState.homeostasis.uncertainty = Math.max(
714923
- 0,
714924
- ikState.homeostasis.uncertainty - 0.01
714925
- );
714926
- ikState.homeostasis.coherence = Math.min(
714927
- 1,
714928
- ikState.homeostasis.coherence + 5e-3
714929
- );
714930
- }
714931
- if (result.durationMs) {
714932
- const n2 = ikState.stats.queries_served;
714933
- ikState.stats.avg_latency_ms = n2 > 1 ? Math.round(
714934
- ((ikState.stats.avg_latency_ms || 0) * (n2 - 1) + result.durationMs) / n2
714935
- ) : result.durationMs;
714936
- ikState.homeostasis.latency_stress = result.durationMs > 3e4 ? Math.min(
714937
- 1,
714938
- (ikState.homeostasis.latency_stress || 0) + 0.02
714939
- ) : Math.max(
714940
- 0,
714941
- (ikState.homeostasis.latency_stress || 0) - 0.01
714942
- );
714943
- }
714944
- if (result.toolCalls > 0) {
714945
- const toolEvidence = result.summary || "";
714946
- if (/web_search|web_fetch|searched|search.*web|fetched.*http|url/i.test(
714947
- toolEvidence
714948
- ) && !ikState.specializations.includes("web-research")) {
714949
- ikState.specializations.push("web-research");
714950
- }
714951
- if (/shell|grep_search|glob_find|executed.*command/i.test(
714952
- toolEvidence
714953
- ) && !ikState.specializations.includes("code-execution")) {
714954
- ikState.specializations.push("code-execution");
714955
- }
714956
- if (/file_write|file_edit|wrote.*file|edited.*file/i.test(
714957
- toolEvidence
714958
- ) && !ikState.specializations.includes("file-operations")) {
714959
- ikState.specializations.push("file-operations");
714960
- }
714961
- ikState.stats.tool_use_count = (ikState.stats.tool_use_count || 0) + result.toolCalls;
714962
- }
714963
- ikState.version = (ikState.version || 1) + 1;
714964
- ikState.version_history.push({
714965
- version: ikState.version,
714966
- change: "query_served: " + cleanForStorage(result.summary).slice(0, 60),
714967
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
714968
- });
714969
- if (ikState.version_history.length > 200)
714970
- ikState.version_history = ikState.version_history.slice(-200);
714971
- if (ikState.version % 10 === 0) {
714972
- const specList = (ikState.specializations || []).join(", ") || "general-purpose";
714973
- ikState.narrative_summary = `Agent ${ikState.self_id || "omnius"} — ${ikState.stats.queries_served} queries served` + (ikState.specializations.length > 0 ? `, specializes in ${specList}` : "") + `. Coherence: ${(ikState.homeostasis.coherence || 0).toFixed(2)}, uncertainty: ${(ikState.homeostasis.uncertainty || 0).toFixed(2)}.`;
714974
- }
714975
- ikState.session_count = (ikState.session_count || 0) + 1;
714976
- ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
714977
- writeFileSync88(ikFile, JSON.stringify(ikState, null, 2));
714978
- } catch (ikErr) {
715111
+ void (async () => {
714979
715112
  try {
714980
- console.error("[IK-OBSERVE]", ikErr);
714981
- } catch {
715113
+ const ikDir = join174(repoRoot, ".omnius", "identity");
715114
+ const ikFile = join174(ikDir, "self-state.json");
715115
+ let ikState;
715116
+ if (existsSync161(ikFile)) {
715117
+ ikState = JSON.parse(await readFileAsync2(ikFile, "utf8"));
715118
+ } else {
715119
+ await mkdirAsync(ikDir, { recursive: true });
715120
+ const machineId = Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
715121
+ ikState = {
715122
+ self_id: `omnius-${machineId}`,
715123
+ version: 1,
715124
+ narrative_summary: "I am an AI coding agent powered by open-weight models. I help with software engineering tasks by reading code, making changes, and running tests.",
715125
+ active_commitments: [
715126
+ "assist the user effectively",
715127
+ "maintain code quality"
715128
+ ],
715129
+ active_goals: [],
715130
+ open_contradictions: [],
715131
+ values_stack: [
715132
+ "correctness",
715133
+ "efficiency",
715134
+ "transparency",
715135
+ "user-alignment"
715136
+ ],
715137
+ interaction_style: {
715138
+ tone: "collaborative",
715139
+ depth_default: "balanced",
715140
+ speech_style: "concise"
715141
+ },
715142
+ relationship_models: [],
715143
+ homeostasis: {
715144
+ uncertainty: 0.1,
715145
+ coherence: 1,
715146
+ goal_tension: 0,
715147
+ memory_trust: 0.9,
715148
+ boundary_breach: 0,
715149
+ latency_stress: 0
715150
+ },
715151
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
715152
+ updated_at: (/* @__PURE__ */ new Date()).toISOString(),
715153
+ session_count: 0,
715154
+ version_history: [
715155
+ {
715156
+ version: 1,
715157
+ change: "Initial identity creation",
715158
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
715159
+ }
715160
+ ]
715161
+ };
715162
+ }
715163
+ if (!ikState.stats)
715164
+ ikState.stats = {
715165
+ queries_served: 0,
715166
+ self_play_cycles: 0,
715167
+ learnings_published: 0,
715168
+ learnings_ingested: 0,
715169
+ reviews_given: 0,
715170
+ reviews_received: 0,
715171
+ avg_latency_ms: 0,
715172
+ tool_use_count: 0
715173
+ };
715174
+ if (!ikState.specializations) ikState.specializations = [];
715175
+ if (!ikState.completed_goals) ikState.completed_goals = [];
715176
+ if (!ikState.version_history) ikState.version_history = [];
715177
+ ikState.stats.queries_served++;
715178
+ const event = `Task completed: ${result.summary.slice(0, 200)}`;
715179
+ if (/success|pass|complete|done|fixed/i.test(event)) {
715180
+ ikState.homeostasis.uncertainty = Math.max(
715181
+ 0,
715182
+ ikState.homeostasis.uncertainty - 0.01
715183
+ );
715184
+ ikState.homeostasis.coherence = Math.min(
715185
+ 1,
715186
+ ikState.homeostasis.coherence + 5e-3
715187
+ );
715188
+ }
715189
+ if (result.durationMs) {
715190
+ const n2 = ikState.stats.queries_served;
715191
+ ikState.stats.avg_latency_ms = n2 > 1 ? Math.round(
715192
+ ((ikState.stats.avg_latency_ms || 0) * (n2 - 1) + result.durationMs) / n2
715193
+ ) : result.durationMs;
715194
+ ikState.homeostasis.latency_stress = result.durationMs > 3e4 ? Math.min(
715195
+ 1,
715196
+ (ikState.homeostasis.latency_stress || 0) + 0.02
715197
+ ) : Math.max(
715198
+ 0,
715199
+ (ikState.homeostasis.latency_stress || 0) - 0.01
715200
+ );
715201
+ }
715202
+ if (result.toolCalls > 0) {
715203
+ const toolEvidence = result.summary || "";
715204
+ if (/web_search|web_fetch|searched|search.*web|fetched.*http|url/i.test(
715205
+ toolEvidence
715206
+ ) && !ikState.specializations.includes("web-research")) {
715207
+ ikState.specializations.push("web-research");
715208
+ }
715209
+ if (/shell|grep_search|glob_find|executed.*command/i.test(
715210
+ toolEvidence
715211
+ ) && !ikState.specializations.includes("code-execution")) {
715212
+ ikState.specializations.push("code-execution");
715213
+ }
715214
+ if (/file_write|file_edit|wrote.*file|edited.*file/i.test(
715215
+ toolEvidence
715216
+ ) && !ikState.specializations.includes("file-operations")) {
715217
+ ikState.specializations.push("file-operations");
715218
+ }
715219
+ ikState.stats.tool_use_count = (ikState.stats.tool_use_count || 0) + result.toolCalls;
715220
+ }
715221
+ ikState.version = (ikState.version || 1) + 1;
715222
+ ikState.version_history.push({
715223
+ version: ikState.version,
715224
+ change: "query_served: " + cleanForStorage(result.summary).slice(0, 60),
715225
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
715226
+ });
715227
+ if (ikState.version_history.length > 200)
715228
+ ikState.version_history = ikState.version_history.slice(-200);
715229
+ if (ikState.version % 10 === 0) {
715230
+ const specList = (ikState.specializations || []).join(", ") || "general-purpose";
715231
+ ikState.narrative_summary = `Agent ${ikState.self_id || "omnius"} — ${ikState.stats.queries_served} queries served` + (ikState.specializations.length > 0 ? `, specializes in ${specList}` : "") + `. Coherence: ${(ikState.homeostasis.coherence || 0).toFixed(2)}, uncertainty: ${(ikState.homeostasis.uncertainty || 0).toFixed(2)}.`;
715232
+ }
715233
+ ikState.session_count = (ikState.session_count || 0) + 1;
715234
+ ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
715235
+ await writeFileAsync2(ikFile, JSON.stringify(ikState, null, 2));
715236
+ } catch (ikErr) {
715237
+ try {
715238
+ console.error("[IK-OBSERVE]", ikErr);
715239
+ } catch {
715240
+ }
714982
715241
  }
714983
- }
715242
+ })().catch(() => {
715243
+ });
714984
715244
  if (voice?.enabled && result.summary) {
714985
715245
  const alreadySpoken = voice._spokenStreamText;
714986
715246
  voice._spokenStreamText = false;
@@ -715005,40 +715265,43 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
715005
715265
  result.durationMs,
715006
715266
  tokens
715007
715267
  );
715008
- try {
715009
- const ikFile = join174(
715010
- repoRoot,
715011
- ".omnius",
715012
- "identity",
715013
- "self-state.json"
715014
- );
715015
- if (existsSync161(ikFile)) {
715016
- const ikState = JSON.parse(readFileSync132(ikFile, "utf8"));
715017
- if (!ikState.stats) ikState.stats = { queries_served: 0 };
715018
- ikState.stats.queries_served = (ikState.stats.queries_served || 0) + 1;
715019
- ikState.homeostasis.uncertainty = Math.min(
715020
- 1,
715021
- ikState.homeostasis.uncertainty + 0.03
715022
- );
715023
- ikState.homeostasis.coherence = Math.max(
715024
- 0,
715025
- ikState.homeostasis.coherence - 0.02
715268
+ void (async () => {
715269
+ try {
715270
+ const ikFile = join174(
715271
+ repoRoot,
715272
+ ".omnius",
715273
+ "identity",
715274
+ "self-state.json"
715026
715275
  );
715027
- ikState.version = (ikState.version || 1) + 1;
715028
- if (!ikState.version_history) ikState.version_history = [];
715029
- ikState.version_history.push({
715030
- version: ikState.version,
715031
- change: "query_failed: task incomplete",
715032
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
715033
- });
715034
- if (ikState.version_history.length > 200)
715035
- ikState.version_history = ikState.version_history.slice(-200);
715036
- ikState.session_count = (ikState.session_count || 0) + 1;
715037
- ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
715038
- writeFileSync88(ikFile, JSON.stringify(ikState, null, 2));
715276
+ if (existsSync161(ikFile)) {
715277
+ const ikState = JSON.parse(await readFileAsync2(ikFile, "utf8"));
715278
+ if (!ikState.stats) ikState.stats = { queries_served: 0 };
715279
+ ikState.stats.queries_served = (ikState.stats.queries_served || 0) + 1;
715280
+ ikState.homeostasis.uncertainty = Math.min(
715281
+ 1,
715282
+ ikState.homeostasis.uncertainty + 0.03
715283
+ );
715284
+ ikState.homeostasis.coherence = Math.max(
715285
+ 0,
715286
+ ikState.homeostasis.coherence - 0.02
715287
+ );
715288
+ ikState.version = (ikState.version || 1) + 1;
715289
+ if (!ikState.version_history) ikState.version_history = [];
715290
+ ikState.version_history.push({
715291
+ version: ikState.version,
715292
+ change: "query_failed: task incomplete",
715293
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
715294
+ });
715295
+ if (ikState.version_history.length > 200)
715296
+ ikState.version_history = ikState.version_history.slice(-200);
715297
+ ikState.session_count = (ikState.session_count || 0) + 1;
715298
+ ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
715299
+ await writeFileAsync2(ikFile, JSON.stringify(ikState, null, 2));
715300
+ }
715301
+ } catch {
715039
715302
  }
715040
- } catch {
715041
- }
715303
+ })().catch(() => {
715304
+ });
715042
715305
  if (voice?.enabled) {
715043
715306
  const emoFinal2 = emotionEngine?.getState();
715044
715307
  const emoCtxFinal2 = emoFinal2 ? {
@@ -715338,7 +715601,7 @@ async function startInteractive(config, repoPath2) {
715338
715601
  const omniusDir = join174(repoRoot, ".omnius");
715339
715602
  const nexusPidFile = join174(omniusDir, "nexus", "daemon.pid");
715340
715603
  if (existsSync161(nexusPidFile)) {
715341
- const pid = parseInt(readFileSync132(nexusPidFile, "utf8").trim(), 10);
715604
+ const pid = parseInt(readFileSync131(nexusPidFile, "utf8").trim(), 10);
715342
715605
  if (pid > 0) {
715343
715606
  try {
715344
715607
  process.kill(pid, 0);
@@ -716487,7 +716750,7 @@ This is an independent background session started from /background.`
716487
716750
  try {
716488
716751
  const titleFile = join174(repoRoot, ".omnius", "session-title");
716489
716752
  if (existsSync161(titleFile))
716490
- sessionTitle = readFileSync132(titleFile, "utf8").trim() || null;
716753
+ sessionTitle = readFileSync131(titleFile, "utf8").trim() || null;
716491
716754
  } catch {
716492
716755
  }
716493
716756
  let carouselRetired = isResumed;
@@ -716602,7 +716865,7 @@ This is an independent background session started from /background.`
716602
716865
  let savedHistory = [];
716603
716866
  try {
716604
716867
  if (existsSync161(HISTORY_FILE)) {
716605
- const raw = readFileSync132(HISTORY_FILE, "utf8").trim();
716868
+ const raw = readFileSync131(HISTORY_FILE, "utf8").trim();
716606
716869
  if (raw) savedHistory = raw.split("\n").reverse();
716607
716870
  }
716608
716871
  } catch {
@@ -716757,7 +717020,7 @@ This is an independent background session started from /background.`
716757
717020
  mkdirSync103(HISTORY_DIR, { recursive: true });
716758
717021
  appendFileSync17(HISTORY_FILE, line + "\n", "utf8");
716759
717022
  if (Math.random() < 0.02) {
716760
- const all2 = readFileSync132(HISTORY_FILE, "utf8").trim().split("\n");
717023
+ const all2 = readFileSync131(HISTORY_FILE, "utf8").trim().split("\n");
716761
717024
  if (all2.length > MAX_HISTORY_LINES) {
716762
717025
  writeFileSync88(
716763
717026
  HISTORY_FILE,
@@ -716986,7 +717249,7 @@ This is an independent background session started from /background.`
716986
717249
  const nexusPidFile = join174(autoNexus.getNexusDir(), "daemon.pid");
716987
717250
  if (existsSync161(nexusPidFile)) {
716988
717251
  const nPid = parseInt(
716989
- readFileSync132(nexusPidFile, "utf8").trim(),
717252
+ readFileSync131(nexusPidFile, "utf8").trim(),
716990
717253
  10
716991
717254
  );
716992
717255
  if (nPid > 0 && !registry2.daemons.has("Nexus")) {
@@ -717168,7 +717431,7 @@ Log: ${nexusLogPath}`
717168
717431
  let agName = "";
717169
717432
  try {
717170
717433
  if (existsSync161(globalNamePath))
717171
- agName = readFileSync132(globalNamePath, "utf8").trim();
717434
+ agName = readFileSync131(globalNamePath, "utf8").trim();
717172
717435
  } catch {
717173
717436
  }
717174
717437
  if (!agName) {
@@ -717209,7 +717472,7 @@ Log: ${nexusLogPath}`
717209
717472
  try {
717210
717473
  if (existsSync161(savedSponsorsPath)) {
717211
717474
  savedSponsors = JSON.parse(
717212
- readFileSync132(savedSponsorsPath, "utf8")
717475
+ readFileSync131(savedSponsorsPath, "utf8")
717213
717476
  );
717214
717477
  const oneHourAgo = Date.now() - 36e5;
717215
717478
  savedSponsors = savedSponsors.filter(
@@ -719349,7 +719612,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
719349
719612
  try {
719350
719613
  const nexusPidFile = join174(nexusTool.getNexusDir(), "daemon.pid");
719351
719614
  if (existsSync161(nexusPidFile)) {
719352
- const pid = parseInt(readFileSync132(nexusPidFile, "utf8").trim(), 10);
719615
+ const pid = parseInt(readFileSync131(nexusPidFile, "utf8").trim(), 10);
719353
719616
  if (pid > 0) {
719354
719617
  registry2.register({
719355
719618
  name: "Nexus",
@@ -719562,7 +719825,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
719562
719825
  const nexusDir = join174(repoRoot, OMNIUS_DIR, "nexus");
719563
719826
  const pidFile = join174(nexusDir, "daemon.pid");
719564
719827
  if (existsSync161(pidFile)) {
719565
- const pid = parseInt(readFileSync132(pidFile, "utf8").trim(), 10);
719828
+ const pid = parseInt(readFileSync131(pidFile, "utf8").trim(), 10);
719566
719829
  if (pid > 0) {
719567
719830
  try {
719568
719831
  if (process.platform === "win32") {
@@ -719595,7 +719858,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
719595
719858
  const pidPath = join174(voiceDir3, pf);
719596
719859
  if (existsSync161(pidPath)) {
719597
719860
  try {
719598
- const pid = parseInt(readFileSync132(pidPath, "utf8").trim(), 10);
719861
+ const pid = parseInt(readFileSync131(pidPath, "utf8").trim(), 10);
719599
719862
  if (pid > 0) {
719600
719863
  if (process.platform === "win32") {
719601
719864
  try {
@@ -719752,8 +720015,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
719752
720015
  "daemon.port"
719753
720016
  );
719754
720017
  if (existsSync161(ppPidFile)) {
719755
- const ppPid = parseInt(readFileSync132(ppPidFile, "utf8").trim(), 10);
719756
- const ppPort = existsSync161(ppPortFile) ? parseInt(readFileSync132(ppPortFile, "utf8").trim(), 10) : void 0;
720018
+ const ppPid = parseInt(readFileSync131(ppPidFile, "utf8").trim(), 10);
720019
+ const ppPort = existsSync161(ppPortFile) ? parseInt(readFileSync131(ppPortFile, "utf8").trim(), 10) : void 0;
719757
720020
  if (ppPid > 0 && !registry2.daemons.has("PersonaPlex")) {
719758
720021
  registry2.register({
719759
720022
  name: "PersonaPlex",
@@ -719770,7 +720033,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
719770
720033
  "daemon.pid"
719771
720034
  );
719772
720035
  if (existsSync161(nexusPidFile)) {
719773
- const nPid = parseInt(readFileSync132(nexusPidFile, "utf8").trim(), 10);
720036
+ const nPid = parseInt(readFileSync131(nexusPidFile, "utf8").trim(), 10);
719774
720037
  if (nPid > 0 && !registry2.daemons.has("Nexus")) {
719775
720038
  try {
719776
720039
  process.kill(nPid, 0);
@@ -720211,7 +720474,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
720211
720474
  if (isImage) {
720212
720475
  try {
720213
720476
  const imgPath = resolve67(repoRoot, cleanPath);
720214
- const imgBuffer = readFileSync132(imgPath);
720477
+ const imgBuffer = readFileSync131(imgPath);
720215
720478
  const base642 = imgBuffer.toString("base64");
720216
720479
  const ext = extname22(cleanPath).toLowerCase();
720217
720480
  const mime = ext === ".png" ? "image/png" : ext === ".gif" ? "image/gif" : ext === ".webp" ? "image/webp" : "image/jpeg";
@@ -720444,7 +720707,7 @@ Read it with image_read or vision if more detail is needed. Describe what you se
720444
720707
  if (isMarkdown && fullInput === input) {
720445
720708
  try {
720446
720709
  const mdPath = resolve67(repoRoot, cleanPath);
720447
- const mdContent = readFileSync132(mdPath, "utf8");
720710
+ const mdContent = readFileSync131(mdPath, "utf8");
720448
720711
  const { parseMcpMarkdown: parseMcpMarkdown2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports2));
720449
720712
  const result = parseMcpMarkdown2(mdContent);
720450
720713
  if (result.servers.length > 0) {
@@ -721085,7 +721348,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
721085
721348
  const ikFile = join174(ikDir, "self-state.json");
721086
721349
  let ikState;
721087
721350
  if (existsSync161(ikFile)) {
721088
- ikState = JSON.parse(readFileSync132(ikFile, "utf8"));
721351
+ ikState = JSON.parse(readFileSync131(ikFile, "utf8"));
721089
721352
  } else {
721090
721353
  mkdirSync103(ikDir, { recursive: true });
721091
721354
  ikState = {
@@ -721158,7 +721421,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
721158
721421
  let variants = [];
721159
721422
  try {
721160
721423
  if (existsSync161(archeFile))
721161
- variants = JSON.parse(readFileSync132(archeFile, "utf8"));
721424
+ variants = JSON.parse(readFileSync131(archeFile, "utf8"));
721162
721425
  } catch {
721163
721426
  }
721164
721427
  variants.push({
@@ -721186,7 +721449,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
721186
721449
  "store.json"
721187
721450
  );
721188
721451
  if (existsSync161(metaFile2)) {
721189
- const store2 = JSON.parse(readFileSync132(metaFile2, "utf8"));
721452
+ const store2 = JSON.parse(readFileSync131(metaFile2, "utf8"));
721190
721453
  const surfaced = store2.filter(
721191
721454
  (m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
721192
721455
  ).sort(
@@ -721289,7 +721552,7 @@ Rules:
721289
721552
  let store2 = [];
721290
721553
  try {
721291
721554
  if (existsSync161(storeFile))
721292
- store2 = JSON.parse(readFileSync132(storeFile, "utf8"));
721555
+ store2 = JSON.parse(readFileSync131(storeFile, "utf8"));
721293
721556
  } catch {
721294
721557
  }
721295
721558
  store2.push({
@@ -721323,7 +721586,7 @@ Rules:
721323
721586
  let cohereActive = false;
721324
721587
  try {
721325
721588
  if (existsSync161(cohereSettingsFile)) {
721326
- const settings = JSON.parse(readFileSync132(cohereSettingsFile, "utf8"));
721589
+ const settings = JSON.parse(readFileSync131(cohereSettingsFile, "utf8"));
721327
721590
  cohereActive = settings.cohere === true;
721328
721591
  }
721329
721592
  } catch {
@@ -721337,7 +721600,7 @@ Rules:
721337
721600
  "store.json"
721338
721601
  );
721339
721602
  if (existsSync161(metaFile2)) {
721340
- const store2 = JSON.parse(readFileSync132(metaFile2, "utf8"));
721603
+ const store2 = JSON.parse(readFileSync131(metaFile2, "utf8"));
721341
721604
  const latest = store2.filter(
721342
721605
  (m2) => m2.sourceTrace === "trajectory-extraction" || m2.sourceTrace === "llm-trajectory-extraction"
721343
721606
  ).slice(-1)[0];
@@ -721366,7 +721629,7 @@ Rules:
721366
721629
  try {
721367
721630
  const ikFile = join174(repoRoot, ".omnius", "identity", "self-state.json");
721368
721631
  if (existsSync161(ikFile)) {
721369
- const ikState = JSON.parse(readFileSync132(ikFile, "utf8"));
721632
+ const ikState = JSON.parse(readFileSync131(ikFile, "utf8"));
721370
721633
  ikState.homeostasis.uncertainty = Math.min(
721371
721634
  1,
721372
721635
  ikState.homeostasis.uncertainty + 0.1
@@ -721387,7 +721650,7 @@ Rules:
721387
721650
  "store.json"
721388
721651
  );
721389
721652
  if (existsSync161(metaFile2)) {
721390
- const store2 = JSON.parse(readFileSync132(metaFile2, "utf8"));
721653
+ const store2 = JSON.parse(readFileSync131(metaFile2, "utf8"));
721391
721654
  const surfaced = store2.filter(
721392
721655
  (m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
721393
721656
  ).sort(
@@ -721413,7 +721676,7 @@ Rules:
721413
721676
  let variants = [];
721414
721677
  try {
721415
721678
  if (existsSync161(archeFile))
721416
- variants = JSON.parse(readFileSync132(archeFile, "utf8"));
721679
+ variants = JSON.parse(readFileSync131(archeFile, "utf8"));
721417
721680
  } catch {
721418
721681
  }
721419
721682
  variants.push({
@@ -721542,7 +721805,7 @@ import { spawn as spawn34 } from "node:child_process";
721542
721805
  import {
721543
721806
  mkdirSync as mkdirSync104,
721544
721807
  writeFileSync as writeFileSync89,
721545
- readFileSync as readFileSync133,
721808
+ readFileSync as readFileSync132,
721546
721809
  readdirSync as readdirSync58,
721547
721810
  existsSync as existsSync162
721548
721811
  } from "node:fs";
@@ -721719,7 +721982,7 @@ function statusCommand(jobId, repoPath2) {
721719
721982
  console.log(`Available jobs: omnius jobs`);
721720
721983
  process.exit(1);
721721
721984
  }
721722
- const job = JSON.parse(readFileSync133(file, "utf-8"));
721985
+ const job = JSON.parse(readFileSync132(file, "utf-8"));
721723
721986
  const runtime = job.completedAt ? `${((new Date(job.completedAt).getTime() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s` : `${((Date.now() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s`;
721724
721987
  const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
721725
721988
  console.log(`${icon} ${job.id} [${job.status}] ${runtime}`);
@@ -721741,7 +722004,7 @@ function jobsCommand(repoPath2) {
721741
722004
  console.log("Jobs:");
721742
722005
  for (const file of files) {
721743
722006
  try {
721744
- const job = JSON.parse(readFileSync133(join175(dir, file), "utf-8"));
722007
+ const job = JSON.parse(readFileSync132(join175(dir, file), "utf-8"));
721745
722008
  const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
721746
722009
  const runtime = job.completedAt ? `${((new Date(job.completedAt).getTime() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s` : `${((Date.now() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s`;
721747
722010
  const cleanListTask = cleanForStorage(job.task) || job.task;