omnius 1.0.348 → 1.0.350

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({
@@ -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
  }
@@ -582853,8 +582853,8 @@ ${telegramPersonaHead}` : stripped
582853
582853
  let recoveredTokens = 0;
582854
582854
  for (const [filePath, entry] of entries) {
582855
582855
  try {
582856
- const { readFileSync: readFileSync134 } = await import("node:fs");
582857
- const content = readFileSync134(filePath, "utf8");
582856
+ const { readFileSync: readFileSync133 } = await import("node:fs");
582857
+ const content = readFileSync133(filePath, "utf8");
582858
582858
  const tokenEst = Math.ceil(content.length / 4);
582859
582859
  if (recoveredTokens + tokenEst > fileRecoveryBudget)
582860
582860
  break;
@@ -584784,7 +584784,7 @@ ${result}`
584784
584784
  let resizedBase64 = null;
584785
584785
  try {
584786
584786
  const { execSync: execSync63 } = await import("node:child_process");
584787
- const { writeFileSync: writeFileSync91, readFileSync: readFileSync134, unlinkSync: unlinkSync35 } = await import("node:fs");
584787
+ const { writeFileSync: writeFileSync91, readFileSync: readFileSync133, unlinkSync: unlinkSync35 } = await import("node:fs");
584788
584788
  const { join: join179 } = await import("node:path");
584789
584789
  const { tmpdir: tmpdir24 } = await import("node:os");
584790
584790
  const tmpIn = join179(tmpdir24(), `omnius_img_in_${Date.now()}.png`);
@@ -584794,7 +584794,7 @@ ${result}`
584794
584794
  const escapedIn = tmpIn.replace(/\\/g, "\\\\");
584795
584795
  const escapedOut = tmpOut.replace(/\\/g, "\\\\");
584796
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" });
584797
- const resizedBuf = readFileSync134(tmpOut);
584797
+ const resizedBuf = readFileSync133(tmpOut);
584798
584798
  resizedBase64 = `data:image/jpeg;base64,${resizedBuf.toString("base64")}`;
584799
584799
  try {
584800
584800
  unlinkSync35(tmpIn);
@@ -600005,7 +600005,7 @@ async function fetchOpenAIModels(baseUrl2, apiKey) {
600005
600005
  async function fetchPeerModels(peerId, authKey) {
600006
600006
  try {
600007
600007
  const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports2));
600008
- const { existsSync: existsSync164, readFileSync: readFileSync134 } = await import("node:fs");
600008
+ const { existsSync: existsSync164, readFileSync: readFileSync133 } = await import("node:fs");
600009
600009
  const { join: join179 } = await import("node:path");
600010
600010
  const cwd4 = process.cwd();
600011
600011
  const nexusTool = new NexusTool2(cwd4);
@@ -600014,7 +600014,7 @@ async function fetchPeerModels(peerId, authKey) {
600014
600014
  try {
600015
600015
  const statusPath = join179(nexusDir, "status.json");
600016
600016
  if (existsSync164(statusPath)) {
600017
- const status = JSON.parse(readFileSync134(statusPath, "utf8"));
600017
+ const status = JSON.parse(readFileSync133(statusPath, "utf8"));
600018
600018
  if (status.peerId === peerId) isLocalPeer = true;
600019
600019
  }
600020
600020
  } catch {
@@ -600023,7 +600023,7 @@ async function fetchPeerModels(peerId, authKey) {
600023
600023
  const pricingPath = join179(nexusDir, "pricing.json");
600024
600024
  if (existsSync164(pricingPath)) {
600025
600025
  try {
600026
- const pricing = JSON.parse(readFileSync134(pricingPath, "utf8"));
600026
+ const pricing = JSON.parse(readFileSync133(pricingPath, "utf8"));
600027
600027
  const localModels = (pricing.models || []).map((m2) => ({
600028
600028
  name: m2.model || "unknown",
600029
600029
  size: m2.parameterSize || "",
@@ -600039,7 +600039,7 @@ async function fetchPeerModels(peerId, authKey) {
600039
600039
  const cachePath2 = join179(nexusDir, "peer-models-cache.json");
600040
600040
  if (existsSync164(cachePath2)) {
600041
600041
  try {
600042
- const cache8 = JSON.parse(readFileSync134(cachePath2, "utf8"));
600042
+ const cache8 = JSON.parse(readFileSync133(cachePath2, "utf8"));
600043
600043
  if (cache8.peerId === peerId && cache8.models?.length > 0) {
600044
600044
  const age = Date.now() - new Date(cache8.cachedAt).getTime();
600045
600045
  if (age < 5 * 60 * 1e3) {
@@ -600154,7 +600154,7 @@ async function fetchPeerModels(peerId, authKey) {
600154
600154
  const pricingPath = join179(nexusDir, "pricing.json");
600155
600155
  if (existsSync164(pricingPath)) {
600156
600156
  try {
600157
- const pricing = JSON.parse(readFileSync134(pricingPath, "utf8"));
600157
+ const pricing = JSON.parse(readFileSync133(pricingPath, "utf8"));
600158
600158
  return (pricing.models || []).map((m2) => ({
600159
600159
  name: m2.model || "unknown",
600160
600160
  size: m2.parameterSize || "",
@@ -611686,7 +611686,7 @@ __export(status_bar_exports, {
611686
611686
  setTerminalTitle: () => setTerminalTitle,
611687
611687
  unlockFooterRedraws: () => unlockFooterRedraws
611688
611688
  });
611689
- import { readFileSync as readFileSync95 } from "node:fs";
611689
+ import { readFile as readFileAsync } from "node:fs/promises";
611690
611690
  function headerButtonGlyphFg() {
611691
611691
  const a2 = tuiAccent();
611692
611692
  return a2 < 0 ? "\x1B[39m" : `\x1B[38;5;${a2}m`;
@@ -613364,7 +613364,7 @@ var init_status_bar = __esm({
613364
613364
  if (nexusDir) {
613365
613365
  try {
613366
613366
  const metricsPath = nexusDir + "/remote-metrics.json";
613367
- const raw = readFileSync95(metricsPath, "utf8");
613367
+ const raw = await readFileAsync(metricsPath, "utf8");
613368
613368
  const cached = JSON.parse(raw);
613369
613369
  if (cached && cached.ts && Date.now() - cached.ts < 6e4) {
613370
613370
  const m2 = cached.data;
@@ -614567,11 +614567,20 @@ ${CONTENT_BG_SEQ}`);
614567
614567
  * many times per second (e.g. the shell timer) refreshes without the whole
614568
614568
  * TUI flashing. Implements the DynamicBlockHost.refreshDynamicBlocks contract.
614569
614569
  */
614570
+ _dynamicRefreshCoalesceTimer = null;
614570
614571
  refreshDynamicBlocks() {
614571
614572
  if (!this.active) return;
614572
614573
  if (this._contentScrollOffset > 0 || this._mouseSelecting) return;
614573
614574
  if (isOverlayActive() || this._suspendContentLayer) return;
614574
- this.repaintContent();
614575
+ if (this._dynamicRefreshCoalesceTimer) return;
614576
+ this._dynamicRefreshCoalesceTimer = setTimeout(() => {
614577
+ this._dynamicRefreshCoalesceTimer = null;
614578
+ if (!this.active) return;
614579
+ if (this._contentScrollOffset > 0 || this._mouseSelecting) return;
614580
+ if (isOverlayActive() || this._suspendContentLayer) return;
614581
+ this.repaintContent();
614582
+ }, 16);
614583
+ this._dynamicRefreshCoalesceTimer.unref?.();
614575
614584
  }
614576
614585
  clearStreamingRepaintTimer() {
614577
614586
  if (!this._streamingRepaintTimer) return;
@@ -614690,7 +614699,23 @@ ${CONTENT_BG_SEQ}`);
614690
614699
  }));
614691
614700
  });
614692
614701
  }
614702
+ // Memoize per-line reflow: it is a PURE function of (line, width), and
614703
+ // reflowContentLines re-wraps the entire scrollback every repaint. Caching
614704
+ // it makes a static line reflow ONCE instead of on every paint (which, for a
614705
+ // long session, was the O(n) per-repaint cost behind the freeze). Callers map
614706
+ // over the result (never mutate it), so a shared cached array is safe. Key
614707
+ // includes width, so a resize naturally re-keys; bounded with clear-on-grow.
614708
+ _reflowLineCache = /* @__PURE__ */ new Map();
614693
614709
  reflowContentLine(line, width) {
614710
+ const key = `${width}\0${line}`;
614711
+ const cached = this._reflowLineCache.get(key);
614712
+ if (cached) return cached;
614713
+ const result = this._reflowContentLineUncached(line, width);
614714
+ if (this._reflowLineCache.size > 8e3) this._reflowLineCache.clear();
614715
+ this._reflowLineCache.set(key, result);
614716
+ return result;
614717
+ }
614718
+ _reflowContentLineUncached(line, width) {
614694
614719
  const visible = stripAnsi(line);
614695
614720
  if (visible.length <= width) return [line];
614696
614721
  const continuationIndent = this.hangingIndentForVisibleLine(visible, width);
@@ -614943,7 +614968,21 @@ ${CONTENT_BG_SEQ}`);
614943
614968
  const h = this.contentHeight;
614944
614969
  const livePartialLine = this.getLiveBufferedLine();
614945
614970
  const w = termCols();
614971
+ const _perfOn = process.env["OMNIUS_TUI_PERF"] === "1";
614972
+ const _t0 = _perfOn ? performance.now() : 0;
614946
614973
  const reflowedLines = this.reflowContentLines(livePartialLine, w);
614974
+ if (_perfOn) {
614975
+ const _ms = performance.now() - _t0;
614976
+ if (_ms > 8) {
614977
+ try {
614978
+ process.stderr.write(
614979
+ `[TUI-PERF] reflow ${_ms.toFixed(1)}ms (lines=${reflowedLines.length}, w=${w})
614980
+ `
614981
+ );
614982
+ } catch {
614983
+ }
614984
+ }
614985
+ }
614947
614986
  const totalLines = reflowedLines.length;
614948
614987
  const maxOffset = Math.max(0, totalLines - h);
614949
614988
  if (this._contentScrollOffset > maxOffset) {
@@ -616992,7 +617031,7 @@ __export(personaplex_exports, {
616992
617031
  startPersonaPlexDaemon: () => startPersonaPlexDaemon,
616993
617032
  stopPersonaPlex: () => stopPersonaPlex
616994
617033
  });
616995
- 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";
617034
+ 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";
616996
617035
  import { join as join131, dirname as dirname42 } from "node:path";
616997
617036
  import { homedir as homedir41 } from "node:os";
616998
617037
  import { execSync as execSync52, spawn as spawn28 } from "node:child_process";
@@ -617031,7 +617070,7 @@ function selectWeightTier(vramGB) {
617031
617070
  }
617032
617071
  function detectJetson() {
617033
617072
  try {
617034
- const model = readFileSync96("/proc/device-tree/model", "utf8").replace(/\0/g, "").trim();
617073
+ const model = readFileSync95("/proc/device-tree/model", "utf8").replace(/\0/g, "").trim();
617035
617074
  if (/jetson|orin|tegra/i.test(model)) {
617036
617075
  const memInfo = execSync52("grep MemTotal /proc/meminfo", { encoding: "utf8", timeout: 3e3, stdio: "pipe" });
617037
617076
  const memKB = parseInt(memInfo.match(/(\d+)/)?.[1] ?? "0", 10);
@@ -617110,7 +617149,7 @@ function fileLink2(filePath, label) {
617110
617149
  }
617111
617150
  function isPersonaPlexRunning() {
617112
617151
  if (!existsSync117(PID_FILE)) return false;
617113
- const pid = parseInt(readFileSync96(PID_FILE, "utf8").trim(), 10);
617152
+ const pid = parseInt(readFileSync95(PID_FILE, "utf8").trim(), 10);
617114
617153
  if (isNaN(pid) || pid <= 0) return false;
617115
617154
  try {
617116
617155
  process.kill(pid, 0);
@@ -617122,7 +617161,7 @@ function isPersonaPlexRunning() {
617122
617161
  function getPersonaPlexWSUrl() {
617123
617162
  if (!isPersonaPlexRunning()) return null;
617124
617163
  if (!existsSync117(PORT_FILE)) return null;
617125
- const port = parseInt(readFileSync96(PORT_FILE, "utf8").trim(), 10);
617164
+ const port = parseInt(readFileSync95(PORT_FILE, "utf8").trim(), 10);
617126
617165
  return isNaN(port) ? null : `wss://127.0.0.1:${port}`;
617127
617166
  }
617128
617167
  function isPersonaPlexInstalled() {
@@ -617132,7 +617171,7 @@ function getWeightTier() {
617132
617171
  const detected = detectPersonaPlexCapability();
617133
617172
  const tierFile = join131(PERSONAPLEX_DIR, "weight_tier");
617134
617173
  if (existsSync117(tierFile)) {
617135
- const saved = readFileSync96(tierFile, "utf8").trim();
617174
+ const saved = readFileSync95(tierFile, "utf8").trim();
617136
617175
  if (saved in WEIGHT_REPOS) {
617137
617176
  const vram = detected.vramGB;
617138
617177
  if (saved === "nf4-distilled" && vram < 24) {
@@ -617264,7 +617303,7 @@ async function installPersonaPlex(onInfo, weightTier) {
617264
617303
  }).trim();
617265
617304
  const serverFile = join131(sitePackages, "server.py");
617266
617305
  if (existsSync117(serverFile)) {
617267
- let src2 = readFileSync96(serverFile, "utf8");
617306
+ let src2 = readFileSync95(serverFile, "utf8");
617268
617307
  if (src2.includes('int(request["seed"])')) {
617269
617308
  src2 = src2.replace('int(request["seed"])', 'int(request.query["seed"])');
617270
617309
  writeFileSync60(serverFile, src2);
@@ -617282,7 +617321,7 @@ async function installPersonaPlex(onInfo, weightTier) {
617282
617321
  }).trim();
617283
617322
  const loadersFile = join131(sitePackages, "models", "loaders.py");
617284
617323
  if (existsSync117(loadersFile)) {
617285
- let src2 = readFileSync96(loadersFile, "utf8");
617324
+ let src2 = readFileSync95(loadersFile, "utf8");
617286
617325
  if (!src2.includes("_dequantize_2bit_state_dict")) {
617287
617326
  const dequantPatch = `
617288
617327
  import math
@@ -617387,28 +617426,28 @@ $2if filename.endswith(".safetensors"):`
617387
617426
  }).trim();
617388
617427
  const hybridDest = join131(sitePackages2, "hybrid_agent.py");
617389
617428
  const serverDest = join131(sitePackages2, "server.py");
617390
- if (!existsSync117(hybridDest) || !readFileSync96(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
617429
+ if (!existsSync117(hybridDest) || !readFileSync95(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
617391
617430
  log22("Deploying hybrid_agent.py (Omnius API integration)...");
617392
617431
  try {
617393
617432
  await execAsync(
617394
617433
  `curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/hybrid_agent.py" -o "${hybridDest}"`,
617395
617434
  { timeout: 3e4 }
617396
617435
  );
617397
- if (existsSync117(hybridDest) && readFileSync96(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
617436
+ if (existsSync117(hybridDest) && readFileSync95(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
617398
617437
  log22("hybrid_agent.py deployed (Omnius API + Ollama fallback).");
617399
617438
  }
617400
617439
  } catch {
617401
617440
  log22("hybrid_agent.py download failed — hybrid mode will be disabled.");
617402
617441
  }
617403
617442
  }
617404
- if (!readFileSync96(serverDest, "utf8").includes("hybrid_agent")) {
617443
+ if (!readFileSync95(serverDest, "utf8").includes("hybrid_agent")) {
617405
617444
  log22("Deploying patched server.py (hybrid mode + API endpoints)...");
617406
617445
  try {
617407
617446
  await execAsync(
617408
617447
  `curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/server.py" -o "${serverDest}"`,
617409
617448
  { timeout: 3e4 }
617410
617449
  );
617411
- if (readFileSync96(serverDest, "utf8").includes("hybrid_agent")) {
617450
+ if (readFileSync95(serverDest, "utf8").includes("hybrid_agent")) {
617412
617451
  log22("server.py patched with hybrid intercept + REST APIs.");
617413
617452
  }
617414
617453
  } catch {
@@ -617598,7 +617637,7 @@ print('Converted')
617598
617637
  let ollamaModel = process.env["HYBRID_LLM_MODEL"] || "";
617599
617638
  if (!ollamaModel) {
617600
617639
  try {
617601
- const omniusConfig = JSON.parse(readFileSync96(join131(homedir41(), ".omnius", "config.json"), "utf8"));
617640
+ const omniusConfig = JSON.parse(readFileSync95(join131(homedir41(), ".omnius", "config.json"), "utf8"));
617602
617641
  if (omniusConfig.model) ollamaModel = omniusConfig.model;
617603
617642
  } catch {
617604
617643
  }
@@ -617698,7 +617737,7 @@ print('Converted')
617698
617737
  }
617699
617738
  function stopPersonaPlex() {
617700
617739
  if (!existsSync117(PID_FILE)) return;
617701
- const pid = parseInt(readFileSync96(PID_FILE, "utf8").trim(), 10);
617740
+ const pid = parseInt(readFileSync95(PID_FILE, "utf8").trim(), 10);
617702
617741
  if (isNaN(pid) || pid <= 0) return;
617703
617742
  try {
617704
617743
  if (process.platform === "win32") {
@@ -617895,7 +617934,7 @@ function patchFrontendVoiceList(onInfo) {
617895
617934
  for (const f2 of readdirSync39(distDir)) {
617896
617935
  if (!f2.startsWith("index-") || !f2.endsWith(".js")) continue;
617897
617936
  const jsPath = join131(distDir, f2);
617898
- let js = readFileSync96(jsPath, "utf8");
617937
+ let js = readFileSync95(jsPath, "utf8");
617899
617938
  const customVoices = [];
617900
617939
  if (existsSync117(CUSTOM_VOICES_DIR)) {
617901
617940
  for (const vf of readdirSync39(CUSTOM_VOICES_DIR)) {
@@ -618015,7 +618054,7 @@ __export(setup_exports, {
618015
618054
  import * as readline from "node:readline";
618016
618055
  import { execSync as execSync53, spawn as spawn29, exec as exec5 } from "node:child_process";
618017
618056
  import { promisify as promisify7 } from "node:util";
618018
- import { existsSync as existsSync118, writeFileSync as writeFileSync61, readFileSync as readFileSync97, appendFileSync as appendFileSync11, mkdirSync as mkdirSync71 } from "node:fs";
618057
+ import { existsSync as existsSync118, writeFileSync as writeFileSync61, readFileSync as readFileSync96, appendFileSync as appendFileSync11, mkdirSync as mkdirSync71 } from "node:fs";
618019
618058
  import { join as join132 } from "node:path";
618020
618059
  import { homedir as homedir42, platform as platform5 } from "node:os";
618021
618060
  function wrapText2(value2, width) {
@@ -618071,14 +618110,14 @@ function detectUnifiedMemory(hasDiscreteGpu = false) {
618071
618110
  }
618072
618111
  try {
618073
618112
  if (existsSync118("/sys/devices/soc0/family")) {
618074
- const family = readFileSync97("/sys/devices/soc0/family", "utf8").trim().toLowerCase();
618113
+ const family = readFileSync96("/sys/devices/soc0/family", "utf8").trim().toLowerCase();
618075
618114
  if (family.includes("tegra")) return true;
618076
618115
  }
618077
618116
  } catch {
618078
618117
  }
618079
618118
  try {
618080
618119
  if (existsSync118("/proc/device-tree/model")) {
618081
- const model = readFileSync97("/proc/device-tree/model", "utf8").replace(/\0+$/, "").toLowerCase();
618120
+ const model = readFileSync96("/proc/device-tree/model", "utf8").replace(/\0+$/, "").toLowerCase();
618082
618121
  if (/jetson|tegra|orin|xavier|nano|raspberry|rockchip|rk\d{4}|mt\d{4}/.test(model)) {
618083
618122
  return true;
618084
618123
  }
@@ -620014,7 +620053,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
620014
620053
  let _visionPreviouslyInstalled = /* @__PURE__ */ new Set();
620015
620054
  try {
620016
620055
  if (existsSync118(_visionMarkerFile)) {
620017
- const _vm = JSON.parse(readFileSync97(_visionMarkerFile, "utf8"));
620056
+ const _vm = JSON.parse(readFileSync96(_visionMarkerFile, "utf8"));
620018
620057
  _visionPreviouslyInstalled = new Set(_vm.installed || []);
620019
620058
  }
620020
620059
  } catch {
@@ -620857,7 +620896,7 @@ function ensurePathInShellRc(binDir) {
620857
620896
  const shell = process.env.SHELL ?? "";
620858
620897
  const rcFile = shell.includes("zsh") ? join132(homedir42(), ".zshrc") : join132(homedir42(), ".bashrc");
620859
620898
  try {
620860
- const rcContent = existsSync118(rcFile) ? readFileSync97(rcFile, "utf8") : "";
620899
+ const rcContent = existsSync118(rcFile) ? readFileSync96(rcFile, "utf8") : "";
620861
620900
  if (rcContent.includes(binDir)) return;
620862
620901
  const exportLine = `
620863
620902
  export PATH="${binDir}:$PATH" # Added by omnius for nvim
@@ -621637,7 +621676,7 @@ var init_platforms = __esm({
621637
621676
  });
621638
621677
 
621639
621678
  // packages/cli/src/tui/workspace-explorer.ts
621640
- import { existsSync as existsSync120, readdirSync as readdirSync40, readFileSync as readFileSync98, statSync as statSync44 } from "node:fs";
621679
+ import { existsSync as existsSync120, readdirSync as readdirSync40, readFileSync as readFileSync97, statSync as statSync44 } from "node:fs";
621641
621680
  import { basename as basename24, extname as extname17, join as join133, relative as relative13, resolve as resolve54 } from "node:path";
621642
621681
  function exploreWorkspace(root, options2 = {}) {
621643
621682
  const query = (options2.query ?? "").trim().toLowerCase();
@@ -621736,7 +621775,7 @@ function previewWorkspaceFile(root, relPath, options2 = {}) {
621736
621775
  ""
621737
621776
  ].join("\n");
621738
621777
  }
621739
- const content = readFileSync98(full, "utf8");
621778
+ const content = readFileSync97(full, "utf8");
621740
621779
  const rawLines = content.split(/\r?\n/);
621741
621780
  const visible = rawLines.slice(0, maxLines);
621742
621781
  const gutter = String(Math.min(rawLines.length, maxLines)).length;
@@ -621912,7 +621951,7 @@ var init_pricing = __esm({
621912
621951
  });
621913
621952
 
621914
621953
  // packages/cli/src/insights/engine.ts
621915
- import { readdirSync as readdirSync41, readFileSync as readFileSync99, existsSync as existsSync121 } from "node:fs";
621954
+ import { readdirSync as readdirSync41, readFileSync as readFileSync98, existsSync as existsSync121 } from "node:fs";
621916
621955
  import { join as join134 } from "node:path";
621917
621956
  function formatDuration5(seconds) {
621918
621957
  if (seconds < 60) return `${Math.round(seconds)}s`;
@@ -621987,7 +622026,7 @@ var init_engine = __esm({
621987
622026
  return readdirSync41(this.historyDir).filter((f2) => f2.endsWith(".json") && f2 !== "pending-task.json").map((f2) => {
621988
622027
  try {
621989
622028
  const data = JSON.parse(
621990
- readFileSync99(join134(this.historyDir, f2), "utf-8")
622029
+ readFileSync98(join134(this.historyDir, f2), "utf-8")
621991
622030
  );
621992
622031
  return data;
621993
622032
  } catch {
@@ -622005,7 +622044,7 @@ var init_engine = __esm({
622005
622044
  loadUsageStore() {
622006
622045
  try {
622007
622046
  if (existsSync121(this.usageFile)) {
622008
- return JSON.parse(readFileSync99(this.usageFile, "utf-8"));
622047
+ return JSON.parse(readFileSync98(this.usageFile, "utf-8"));
622009
622048
  }
622010
622049
  } catch {
622011
622050
  }
@@ -624788,7 +624827,7 @@ var init_memory_menu = __esm({
624788
624827
  });
624789
624828
 
624790
624829
  // packages/cli/src/tui/audio-waveform.ts
624791
- import { readFileSync as readFileSync100 } from "node:fs";
624830
+ import { readFileSync as readFileSync99 } from "node:fs";
624792
624831
  import { createRequire as createRequire5 } from "node:module";
624793
624832
  function readAscii(buffer2, offset, length4) {
624794
624833
  return buffer2.subarray(offset, offset + length4).toString("ascii");
@@ -624862,7 +624901,7 @@ function renderAudioWaveform(file, options2 = {}) {
624862
624901
  } catch {
624863
624902
  return null;
624864
624903
  }
624865
- const buffer2 = readFileSync100(file);
624904
+ const buffer2 = readFileSync99(file);
624866
624905
  const info = parseWav(buffer2);
624867
624906
  if (!info) return null;
624868
624907
  const frameCount = Math.floor(info.dataSize / info.frameSize);
@@ -625418,7 +625457,7 @@ __export(daemon_exports, {
625418
625457
  stopDaemon: () => stopDaemon
625419
625458
  });
625420
625459
  import { spawn as spawn30 } from "node:child_process";
625421
- 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";
625460
+ 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";
625422
625461
  import { join as join137 } from "node:path";
625423
625462
  import { homedir as homedir44 } from "node:os";
625424
625463
  import { fileURLToPath as fileURLToPath17 } from "node:url";
@@ -625449,7 +625488,7 @@ function getLocalCliVersion() {
625449
625488
  for (const rel of ["../package.json", "../../package.json", "./package.json", "../../../package.json"]) {
625450
625489
  const p2 = join137(here, rel);
625451
625490
  if (existsSync125(p2)) {
625452
- const v = JSON.parse(readFileSync101(p2, "utf8"))?.version;
625491
+ const v = JSON.parse(readFileSync100(p2, "utf8"))?.version;
625453
625492
  if (v) return String(v);
625454
625493
  }
625455
625494
  }
@@ -625488,7 +625527,7 @@ async function restartDaemon(port) {
625488
625527
  function getDaemonPid() {
625489
625528
  if (!existsSync125(PID_FILE2)) return null;
625490
625529
  try {
625491
- const pid = parseInt(readFileSync101(PID_FILE2, "utf8").trim(), 10);
625530
+ const pid = parseInt(readFileSync100(PID_FILE2, "utf8").trim(), 10);
625492
625531
  if (!pid || pid <= 0) return null;
625493
625532
  process.kill(pid, 0);
625494
625533
  return pid;
@@ -625503,7 +625542,7 @@ function getDaemonPid() {
625503
625542
  function looksLikeNodeEntrypoint(path12) {
625504
625543
  if (/\.(?:mjs|cjs|js)$/i.test(path12)) return true;
625505
625544
  try {
625506
- const firstBytes = readFileSync101(path12, "utf8").slice(0, 200);
625545
+ const firstBytes = readFileSync100(path12, "utf8").slice(0, 200);
625507
625546
  return /^#!.*\bnode\b/.test(firstBytes);
625508
625547
  } catch {
625509
625548
  return false;
@@ -625852,7 +625891,7 @@ var init_types5 = __esm({
625852
625891
 
625853
625892
  // packages/cli/src/cron/store.ts
625854
625893
  import {
625855
- readFileSync as readFileSync102,
625894
+ readFileSync as readFileSync101,
625856
625895
  writeFileSync as writeFileSync63,
625857
625896
  mkdirSync as mkdirSync73,
625858
625897
  chmodSync as chmodSync3,
@@ -626039,7 +626078,7 @@ function loadJobs() {
626039
626078
  const path12 = jobsFilePath();
626040
626079
  if (!existsSync127(path12)) return [];
626041
626080
  try {
626042
- const data = JSON.parse(readFileSync102(path12, "utf-8"));
626081
+ const data = JSON.parse(readFileSync101(path12, "utf-8"));
626043
626082
  return data.jobs || [];
626044
626083
  } catch {
626045
626084
  return [];
@@ -626407,7 +626446,7 @@ import {
626407
626446
  closeSync as closeSync5,
626408
626447
  writeFileSync as writeFileSync64,
626409
626448
  unlinkSync as unlinkSync26,
626410
- readFileSync as readFileSync103
626449
+ readFileSync as readFileSync102
626411
626450
  } from "node:fs";
626412
626451
  import { join as join140 } from "node:path";
626413
626452
  import { homedir as homedir46 } from "node:os";
@@ -626424,7 +626463,7 @@ function acquireTickLock() {
626424
626463
  mkdirSync74(cronDir2(), { recursive: true });
626425
626464
  try {
626426
626465
  if (existsSync128(lockPath)) {
626427
- const content = readFileSync103(lockPath, "utf-8").trim();
626466
+ const content = readFileSync102(lockPath, "utf-8").trim();
626428
626467
  if (content) {
626429
626468
  const lock = JSON.parse(content);
626430
626469
  const age = Date.now() - lock.acquiredAt;
@@ -626792,7 +626831,7 @@ __export(sponsor_wizard_exports, {
626792
626831
  selectedModelsForEndpoint: () => selectedModelsForEndpoint,
626793
626832
  showSponsorDashboard: () => showSponsorDashboard
626794
626833
  });
626795
- import { existsSync as existsSync129, readFileSync as readFileSync104, writeFileSync as writeFileSync65, mkdirSync as mkdirSync75 } from "node:fs";
626834
+ import { existsSync as existsSync129, readFileSync as readFileSync103, writeFileSync as writeFileSync65, mkdirSync as mkdirSync75 } from "node:fs";
626796
626835
  import { join as join141 } from "node:path";
626797
626836
  function fmtTokens2(n2) {
626798
626837
  if (n2 < 1e3) return String(Math.max(0, Math.floor(n2)));
@@ -626813,7 +626852,7 @@ function loadSponsorConfig(projectDir2) {
626813
626852
  const p2 = configPath(projectDir2);
626814
626853
  if (!existsSync129(p2)) return null;
626815
626854
  try {
626816
- return JSON.parse(readFileSync104(p2, "utf8"));
626855
+ return JSON.parse(readFileSync103(p2, "utf8"));
626817
626856
  } catch {
626818
626857
  return null;
626819
626858
  }
@@ -628152,7 +628191,7 @@ __export(image_ascii_preview_exports, {
628152
628191
  });
628153
628192
  import { execFileSync as execFileSync9 } from "node:child_process";
628154
628193
  import { createRequire as createRequire6 } from "node:module";
628155
- import { existsSync as existsSync130, readFileSync as readFileSync105, statSync as statSync46 } from "node:fs";
628194
+ import { existsSync as existsSync130, readFileSync as readFileSync104, statSync as statSync46 } from "node:fs";
628156
628195
  import { resolve as resolve56 } from "node:path";
628157
628196
  function clamp8(n2, min, max) {
628158
628197
  if (!Number.isFinite(n2)) return min;
@@ -628168,7 +628207,7 @@ function defaultAsciiPreviewSize(dimensions) {
628168
628207
  }
628169
628208
  function readImageDimensions2(imagePath) {
628170
628209
  try {
628171
- const buf = readFileSync105(imagePath);
628210
+ const buf = readFileSync104(imagePath);
628172
628211
  if (buf.length >= 24 && buf.toString("ascii", 1, 4) === "PNG") {
628173
628212
  return { width: buf.readUInt32BE(16), height: buf.readUInt32BE(20) };
628174
628213
  }
@@ -628534,7 +628573,7 @@ import {
628534
628573
  existsSync as existsSync131,
628535
628574
  mkdirSync as mkdirSync76,
628536
628575
  writeFileSync as writeFileSync66,
628537
- readFileSync as readFileSync106,
628576
+ readFileSync as readFileSync105,
628538
628577
  unlinkSync as unlinkSync27,
628539
628578
  readdirSync as readdirSync43,
628540
628579
  statSync as statSync47,
@@ -630030,7 +630069,7 @@ except Exception as exc:
630030
630069
  const destFilename = `clone-${srcName}-${ts}.${ext}`;
630031
630070
  const destPath = join142(refsDir, destFilename);
630032
630071
  try {
630033
- const data = readFileSync106(audioPath);
630072
+ const data = readFileSync105(audioPath);
630034
630073
  writeFileSync66(destPath, data);
630035
630074
  } catch (err) {
630036
630075
  return `Failed to copy audio file: ${err instanceof Error ? err.message : String(err)}`;
@@ -630105,7 +630144,7 @@ except Exception as exc:
630105
630144
  const p2 = _VoiceEngine.cloneMetaFile();
630106
630145
  if (!existsSync131(p2)) return {};
630107
630146
  try {
630108
- const raw = JSON.parse(readFileSync106(p2, "utf8"));
630147
+ const raw = JSON.parse(readFileSync105(p2, "utf8"));
630109
630148
  if (typeof Object.values(raw)[0] === "string") {
630110
630149
  const migrated = {};
630111
630150
  for (const [k, v] of Object.entries(raw)) {
@@ -630988,7 +631027,7 @@ except Exception as exc:
630988
631027
  }
630989
631028
  loadMisottsStore() {
630990
631029
  try {
630991
- const raw = JSON.parse(readFileSync106(misottsProfilesFile(), "utf-8"));
631030
+ const raw = JSON.parse(readFileSync105(misottsProfilesFile(), "utf-8"));
630992
631031
  const profiles = {};
630993
631032
  for (const [name10, settings] of Object.entries(raw.profiles ?? {})) {
630994
631033
  profiles[name10] = normalizeMisottsSettings(settings);
@@ -631012,7 +631051,7 @@ except Exception as exc:
631012
631051
  loadSupertonicStore() {
631013
631052
  try {
631014
631053
  const raw = JSON.parse(
631015
- readFileSync106(supertonicProfilesFile(), "utf-8")
631054
+ readFileSync105(supertonicProfilesFile(), "utf-8")
631016
631055
  );
631017
631056
  const profiles = {};
631018
631057
  for (const [name10, settings] of Object.entries(raw.profiles ?? {})) {
@@ -631182,7 +631221,7 @@ except Exception as exc:
631182
631221
  const wavPath = await this.synthesizeSupertonicWav(text2, 1);
631183
631222
  if (!wavPath) return null;
631184
631223
  try {
631185
- const data = readFileSync106(wavPath);
631224
+ const data = readFileSync105(wavPath);
631186
631225
  unlinkSync27(wavPath);
631187
631226
  return data;
631188
631227
  } catch {
@@ -631352,7 +631391,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
631352
631391
  if (!existsSync131(wavPath)) return;
631353
631392
  if (volume !== 1) {
631354
631393
  try {
631355
- const wavData = readFileSync106(wavPath);
631394
+ const wavData = readFileSync105(wavPath);
631356
631395
  if (wavData.length > 44) {
631357
631396
  const header = wavData.subarray(0, 44);
631358
631397
  const samples = new Int16Array(
@@ -631374,7 +631413,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
631374
631413
  }
631375
631414
  if (this.onPCMOutput) {
631376
631415
  try {
631377
- const wavData = readFileSync106(wavPath);
631416
+ const wavData = readFileSync105(wavPath);
631378
631417
  if (wavData.length > 44) {
631379
631418
  const pcm = Buffer.from(
631380
631419
  wavData.buffer,
@@ -631432,7 +631471,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
631432
631471
  }
631433
631472
  if (!existsSync131(wavPath)) return null;
631434
631473
  try {
631435
- const data = readFileSync106(wavPath);
631474
+ const data = readFileSync105(wavPath);
631436
631475
  unlinkSync27(wavPath);
631437
631476
  return data;
631438
631477
  } catch {
@@ -632335,7 +632374,7 @@ if __name__ == '__main__':
632335
632374
  async postProcessAndPlayLuxtts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
632336
632375
  if (!existsSync131(wavPath)) return;
632337
632376
  try {
632338
- const wavData = readFileSync106(wavPath);
632377
+ const wavData = readFileSync105(wavPath);
632339
632378
  if (wavData.length > 44) {
632340
632379
  const sampleRate = wavData.readUInt32LE(24);
632341
632380
  const samples = new Int16Array(
@@ -632366,7 +632405,7 @@ if __name__ == '__main__':
632366
632405
  }
632367
632406
  if (pitchFactor !== 1) {
632368
632407
  try {
632369
- const wavData = readFileSync106(wavPath);
632408
+ const wavData = readFileSync105(wavPath);
632370
632409
  if (wavData.length > 44) {
632371
632410
  const int16 = new Int16Array(
632372
632411
  wavData.buffer,
@@ -632385,7 +632424,7 @@ if __name__ == '__main__':
632385
632424
  }
632386
632425
  if (this.onPCMOutput) {
632387
632426
  try {
632388
- const wavData = readFileSync106(wavPath);
632427
+ const wavData = readFileSync105(wavPath);
632389
632428
  if (wavData.length > 44) {
632390
632429
  const pcm = Buffer.from(
632391
632430
  wavData.buffer,
@@ -632400,7 +632439,7 @@ if __name__ == '__main__':
632400
632439
  }
632401
632440
  if (stereoDelayMs > 0) {
632402
632441
  try {
632403
- const wavData = readFileSync106(wavPath);
632442
+ const wavData = readFileSync105(wavPath);
632404
632443
  if (wavData.length > 44) {
632405
632444
  const sampleRate = wavData.readUInt32LE(24);
632406
632445
  const numChannels = wavData.readUInt16LE(22);
@@ -632467,7 +632506,7 @@ if __name__ == '__main__':
632467
632506
  }
632468
632507
  if (!existsSync131(wavPath)) return null;
632469
632508
  try {
632470
- const data = readFileSync106(wavPath);
632509
+ const data = readFileSync105(wavPath);
632471
632510
  unlinkSync27(wavPath);
632472
632511
  return data;
632473
632512
  } catch {
@@ -632702,7 +632741,7 @@ if __name__ == "__main__":
632702
632741
  async postProcessAndPlayMisotts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
632703
632742
  if (!existsSync131(wavPath)) return;
632704
632743
  try {
632705
- const wavData = readFileSync106(wavPath);
632744
+ const wavData = readFileSync105(wavPath);
632706
632745
  if (wavData.length > 44) {
632707
632746
  const sampleRate = wavData.readUInt32LE(24);
632708
632747
  const samples = new Int16Array(
@@ -632733,7 +632772,7 @@ if __name__ == "__main__":
632733
632772
  }
632734
632773
  if (pitchFactor !== 1) {
632735
632774
  try {
632736
- const wavData = readFileSync106(wavPath);
632775
+ const wavData = readFileSync105(wavPath);
632737
632776
  if (wavData.length > 44) {
632738
632777
  const int16 = new Int16Array(
632739
632778
  wavData.buffer,
@@ -632752,7 +632791,7 @@ if __name__ == "__main__":
632752
632791
  }
632753
632792
  if (this.onPCMOutput) {
632754
632793
  try {
632755
- const wavData = readFileSync106(wavPath);
632794
+ const wavData = readFileSync105(wavPath);
632756
632795
  if (wavData.length > 44) {
632757
632796
  const pcm = Buffer.from(
632758
632797
  wavData.buffer,
@@ -632767,7 +632806,7 @@ if __name__ == "__main__":
632767
632806
  }
632768
632807
  if (stereoDelayMs > 0) {
632769
632808
  try {
632770
- const wavData = readFileSync106(wavPath);
632809
+ const wavData = readFileSync105(wavPath);
632771
632810
  if (wavData.length > 44) {
632772
632811
  const sampleRate = wavData.readUInt32LE(24);
632773
632812
  const numChannels = wavData.readUInt16LE(22);
@@ -632843,7 +632882,7 @@ if __name__ == "__main__":
632843
632882
  }
632844
632883
  if (!existsSync131(wavPath)) return null;
632845
632884
  try {
632846
- const data = readFileSync106(wavPath);
632885
+ const data = readFileSync105(wavPath);
632847
632886
  unlinkSync27(wavPath);
632848
632887
  return data;
632849
632888
  } catch {
@@ -632864,7 +632903,7 @@ if __name__ == "__main__":
632864
632903
  };
632865
632904
  if (existsSync131(pkgPath)) {
632866
632905
  try {
632867
- const existing = JSON.parse(readFileSync106(pkgPath, "utf8"));
632906
+ const existing = JSON.parse(readFileSync105(pkgPath, "utf8"));
632868
632907
  if (!existing.dependencies?.["phonemizer"]) {
632869
632908
  existing.dependencies = { ...existing.dependencies, ...expectedDeps };
632870
632909
  writeFileSync66(pkgPath, JSON.stringify(existing, null, 2));
@@ -633024,7 +633063,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
633024
633063
  if (!existsSync131(onnxPath) || !existsSync131(configPath2)) {
633025
633064
  throw new Error(`Model files not found for ${this.modelId}`);
633026
633065
  }
633027
- this.config = JSON.parse(readFileSync106(configPath2, "utf8"));
633066
+ this.config = JSON.parse(readFileSync105(configPath2, "utf8"));
633028
633067
  this.session = await this.ort.InferenceSession.create(onnxPath, {
633029
633068
  executionProviders: ["cpu"],
633030
633069
  graphOptimizationLevel: "all"
@@ -633184,7 +633223,7 @@ import { execSync as nodeExecSync, spawn as nodeSpawn2 } from "node:child_proces
633184
633223
  import { createHash as createHash36 } from "node:crypto";
633185
633224
  import {
633186
633225
  existsSync as existsSync132,
633187
- readFileSync as readFileSync107,
633226
+ readFileSync as readFileSync106,
633188
633227
  writeFileSync as writeFileSync67,
633189
633228
  mkdirSync as mkdirSync77,
633190
633229
  readdirSync as readdirSync44,
@@ -634498,10 +634537,10 @@ async function handleSlashCommand(input, ctx3) {
634498
634537
  if (!key) {
634499
634538
  try {
634500
634539
  const { homedir: homedir62 } = await import("node:os");
634501
- const { readFileSync: readFileSync134, existsSync: existsSync164 } = await import("node:fs");
634540
+ const { readFileSync: readFileSync133, existsSync: existsSync164 } = await import("node:fs");
634502
634541
  const { join: join179 } = await import("node:path");
634503
634542
  const p2 = join179(homedir62(), ".omnius", "api.key");
634504
- if (existsSync164(p2)) key = readFileSync134(p2, "utf8").trim();
634543
+ if (existsSync164(p2)) key = readFileSync133(p2, "utf8").trim();
634505
634544
  } catch {
634506
634545
  }
634507
634546
  }
@@ -635353,7 +635392,7 @@ async function handleSlashCommand(input, ctx3) {
635353
635392
  try {
635354
635393
  const pidFile = join143(nexus.getNexusDir(), "daemon.pid");
635355
635394
  if (existsSync132(pidFile)) {
635356
- const pid = parseInt(readFileSync107(pidFile, "utf8").trim(), 10);
635395
+ const pid = parseInt(readFileSync106(pidFile, "utf8").trim(), 10);
635357
635396
  if (pid > 0 && !registry2.daemons.has("Nexus")) {
635358
635397
  registry2.register({
635359
635398
  name: "Nexus",
@@ -635776,7 +635815,7 @@ async function handleSlashCommand(input, ctx3) {
635776
635815
  renderWarning(`Tool not found: ${toolFile}`);
635777
635816
  return "handled";
635778
635817
  }
635779
- content = readFileSync107(toolFile, "utf8");
635818
+ content = readFileSync106(toolFile, "utf8");
635780
635819
  metadata = { type: "tool", name: shareName };
635781
635820
  } else if (shareType === "skill") {
635782
635821
  const skillDir = join143(ctx3.repoRoot, ".omnius", "skills", shareName);
@@ -635785,7 +635824,7 @@ async function handleSlashCommand(input, ctx3) {
635785
635824
  renderWarning(`Skill not found: ${skillFile}`);
635786
635825
  return "handled";
635787
635826
  }
635788
- content = readFileSync107(skillFile, "utf8");
635827
+ content = readFileSync106(skillFile, "utf8");
635789
635828
  metadata = { type: "skill", name: shareName };
635790
635829
  } else {
635791
635830
  renderWarning(
@@ -635858,7 +635897,7 @@ async function handleSlashCommand(input, ctx3) {
635858
635897
  "learning-cids.json"
635859
635898
  );
635860
635899
  if (existsSync132(regFile)) {
635861
- const reg2 = JSON.parse(readFileSync107(regFile, "utf8"));
635900
+ const reg2 = JSON.parse(readFileSync106(regFile, "utf8"));
635862
635901
  const pinned = Object.values(reg2).some(
635863
635902
  (e2) => e2.cid === importCid && e2.pinned
635864
635903
  );
@@ -635976,7 +636015,7 @@ async function handleSlashCommand(input, ctx3) {
635976
636015
  ).getNexusDir();
635977
636016
  const statusFile = join143(nexusDir, "status.json");
635978
636017
  if (existsSync132(statusFile)) {
635979
- const status = JSON.parse(readFileSync107(statusFile, "utf8"));
636018
+ const status = JSON.parse(readFileSync106(statusFile, "utf8"));
635980
636019
  if (status.peerId) {
635981
636020
  lines.push(`
635982
636021
  ${c3.bold("Peer Info")}`);
@@ -636001,7 +636040,7 @@ async function handleSlashCommand(input, ctx3) {
636001
636040
  try {
636002
636041
  const stateFile = join143(idDir, "self-state.json");
636003
636042
  if (existsSync132(stateFile)) {
636004
- const state = JSON.parse(readFileSync107(stateFile, "utf8"));
636043
+ const state = JSON.parse(readFileSync106(stateFile, "utf8"));
636005
636044
  lines.push(
636006
636045
  ` Version: ${c3.bold("v" + (state.version ?? "?"))} Sessions: ${c3.bold(String(state.session_count ?? 0))}`
636007
636046
  );
@@ -636016,7 +636055,7 @@ async function handleSlashCommand(input, ctx3) {
636016
636055
  }
636017
636056
  const cidFile = join143(idDir, "cids.json");
636018
636057
  if (existsSync132(cidFile)) {
636019
- const cids = JSON.parse(readFileSync107(cidFile, "utf8"));
636058
+ const cids = JSON.parse(readFileSync106(cidFile, "utf8"));
636020
636059
  const lastCid = Array.isArray(cids) ? cids[cids.length - 1] : cids.latest;
636021
636060
  if (lastCid)
636022
636061
  lines.push(
@@ -636041,7 +636080,7 @@ async function handleSlashCommand(input, ctx3) {
636041
636080
  "store.json"
636042
636081
  );
636043
636082
  if (existsSync132(metaFile2)) {
636044
- const store2 = JSON.parse(readFileSync107(metaFile2, "utf8"));
636083
+ const store2 = JSON.parse(readFileSync106(metaFile2, "utf8"));
636045
636084
  const active = store2.filter((m2) => m2.type !== "quarantine");
636046
636085
  const recoveries = active.filter(
636047
636086
  (m2) => m2.content?.startsWith("[recovery]")
@@ -636282,7 +636321,7 @@ async function handleSlashCommand(input, ctx3) {
636282
636321
  return "handled";
636283
636322
  }
636284
636323
  } else {
636285
- content = readFileSync107(resolvedPath, "utf8");
636324
+ content = readFileSync106(resolvedPath, "utf8");
636286
636325
  }
636287
636326
  if (!content.trim()) {
636288
636327
  renderWarning("No content extracted.");
@@ -636390,7 +636429,7 @@ async function handleSlashCommand(input, ctx3) {
636390
636429
  renderInfo("Fortemi bridge: not connected. Run /fortemi start");
636391
636430
  return "handled";
636392
636431
  }
636393
- const bridge = JSON.parse(readFileSync107(bridgeFile, "utf8"));
636432
+ const bridge = JSON.parse(readFileSync106(bridgeFile, "utf8"));
636394
636433
  let alive = false;
636395
636434
  try {
636396
636435
  process.kill(bridge.pid, 0);
@@ -636426,7 +636465,7 @@ async function handleSlashCommand(input, ctx3) {
636426
636465
  if (fortemiSubCmd === "stop") {
636427
636466
  const bridgeFile = join143(ctx3.repoRoot, ".omnius", "fortemi-bridge.json");
636428
636467
  if (existsSync132(bridgeFile)) {
636429
- const bridge = JSON.parse(readFileSync107(bridgeFile, "utf8"));
636468
+ const bridge = JSON.parse(readFileSync106(bridgeFile, "utf8"));
636430
636469
  try {
636431
636470
  process.kill(bridge.pid, "SIGTERM");
636432
636471
  } catch {
@@ -638431,7 +638470,7 @@ sleep 1
638431
638470
  `daemon.pid exists: ${existsSync132(join143(checkedNexusDir, "daemon.pid"))}`
638432
638471
  );
638433
638472
  try {
638434
- const _statusRaw = readFileSync107(
638473
+ const _statusRaw = readFileSync106(
638435
638474
  join143(checkedNexusDir, "status.json"),
638436
638475
  "utf8"
638437
638476
  );
@@ -638440,7 +638479,7 @@ sleep 1
638440
638479
  _spLog(`status.json read error: ${e2}`);
638441
638480
  }
638442
638481
  try {
638443
- const _errRaw = readFileSync107(
638482
+ const _errRaw = readFileSync106(
638444
638483
  join143(checkedNexusDir, "daemon.err"),
638445
638484
  "utf8"
638446
638485
  );
@@ -638475,7 +638514,7 @@ sleep 1
638475
638514
  "agent-name"
638476
638515
  );
638477
638516
  if (existsSync132(namePath))
638478
- sponsorName = readFileSync107(namePath, "utf8").trim();
638517
+ sponsorName = readFileSync106(namePath, "utf8").trim();
638479
638518
  } catch {
638480
638519
  }
638481
638520
  if (!sponsorName) sponsorName = "Omnius Sponsor";
@@ -638579,7 +638618,7 @@ sleep 1
638579
638618
  );
638580
638619
  if (existsSync132(nexusPidFile)) {
638581
638620
  const nPid = parseInt(
638582
- readFileSync107(nexusPidFile, "utf8").trim(),
638621
+ readFileSync106(nexusPidFile, "utf8").trim(),
638583
638622
  10
638584
638623
  );
638585
638624
  if (nPid > 0) {
@@ -639878,7 +639917,7 @@ sleep 1
639878
639917
  if (existsSync132(projectSettingsPath)) {
639879
639918
  try {
639880
639919
  const projectJson = JSON.parse(
639881
- readFileSync107(projectSettingsPath, "utf8")
639920
+ readFileSync106(projectSettingsPath, "utf8")
639882
639921
  );
639883
639922
  projectHasKey = typeof projectJson?.telegramKey === "string" && projectJson.telegramKey.length > 0;
639884
639923
  } catch {
@@ -645056,7 +645095,7 @@ async function discoverSponsorMediaCandidates(ctx3, modality) {
645056
645095
  "known-sponsors.json"
645057
645096
  );
645058
645097
  if (existsSync132(knownFile)) {
645059
- const saved = JSON.parse(readFileSync107(knownFile, "utf8"));
645098
+ const saved = JSON.parse(readFileSync106(knownFile, "utf8"));
645060
645099
  if (Array.isArray(saved)) rawSponsors.push(...saved);
645061
645100
  }
645062
645101
  } catch {
@@ -645206,7 +645245,7 @@ async function collectSponsorMediaStream(args) {
645206
645245
  while (!done && Date.now() < deadline) {
645207
645246
  await new Promise((resolve71) => setTimeout(resolve71, 250));
645208
645247
  if (!existsSync132(args.streamFile)) continue;
645209
- const raw = readFileSync107(args.streamFile, "utf8");
645248
+ const raw = readFileSync106(args.streamFile, "utf8");
645210
645249
  if (raw.length <= offset) continue;
645211
645250
  pending2 += raw.slice(offset);
645212
645251
  offset = raw.length;
@@ -645530,7 +645569,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
645530
645569
  try {
645531
645570
  if (existsSync132(knownFile)) {
645532
645571
  const saved = JSON.parse(
645533
- readFileSync107(knownFile, "utf8")
645572
+ readFileSync106(knownFile, "utf8")
645534
645573
  );
645535
645574
  for (const s2 of saved) {
645536
645575
  if (!sponsors.some((sp) => sp.url === s2.url)) {
@@ -645706,7 +645745,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
645706
645745
  const saveKey = selected.url || selected.peerId || selected.name;
645707
645746
  try {
645708
645747
  mkdirSync77(sponsorDir2, { recursive: true });
645709
- const existing = existsSync132(knownFile) ? JSON.parse(readFileSync107(knownFile, "utf8")) : [];
645748
+ const existing = existsSync132(knownFile) ? JSON.parse(readFileSync106(knownFile, "utf8")) : [];
645710
645749
  const updated = existing.filter(
645711
645750
  (s2) => (s2.url || s2.peerId || s2.name) !== saveKey
645712
645751
  );
@@ -648823,7 +648862,7 @@ var init_commands = __esm({
648823
648862
  });
648824
648863
 
648825
648864
  // packages/cli/src/tui/project-context.ts
648826
- import { existsSync as existsSync133, readFileSync as readFileSync108, readdirSync as readdirSync45, mkdirSync as mkdirSync78, writeFileSync as writeFileSync68 } from "node:fs";
648865
+ import { existsSync as existsSync133, readFileSync as readFileSync107, readdirSync as readdirSync45, mkdirSync as mkdirSync78, writeFileSync as writeFileSync68 } from "node:fs";
648827
648866
  import { join as join144, basename as basename26 } from "node:path";
648828
648867
  import { execSync as execSync56 } from "node:child_process";
648829
648868
  import { homedir as homedir49 } from "node:os";
@@ -648875,7 +648914,7 @@ function loadProjectMap(repoRoot) {
648875
648914
  const mapPath2 = join144(repoRoot, OMNIUS_DIR, "context", "project-map.md");
648876
648915
  if (existsSync133(mapPath2)) {
648877
648916
  try {
648878
- const content = readFileSync108(mapPath2, "utf-8");
648917
+ const content = readFileSync107(mapPath2, "utf-8");
648879
648918
  return content;
648880
648919
  } catch {
648881
648920
  }
@@ -648924,7 +648963,7 @@ function countJsonMemoryEntries(dir) {
648924
648963
  if (!file.endsWith(".json")) continue;
648925
648964
  topics++;
648926
648965
  try {
648927
- const parsed = JSON.parse(readFileSync108(join144(dir, file), "utf8"));
648966
+ const parsed = JSON.parse(readFileSync107(join144(dir, file), "utf8"));
648928
648967
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
648929
648968
  entries += Object.keys(parsed).length;
648930
648969
  }
@@ -648940,7 +648979,7 @@ function countReflectionBuffer(repoRoot) {
648940
648979
  const path12 = join144(repoRoot, OMNIUS_DIR, "memory", "reflections.json");
648941
648980
  if (!existsSync133(path12)) return 0;
648942
648981
  try {
648943
- const parsed = JSON.parse(readFileSync108(path12, "utf8"));
648982
+ const parsed = JSON.parse(readFileSync107(path12, "utf8"));
648944
648983
  return Array.isArray(parsed.reflections) ? parsed.reflections.length : 0;
648945
648984
  } catch {
648946
648985
  return 0;
@@ -648949,7 +648988,7 @@ function countReflectionBuffer(repoRoot) {
648949
648988
  function countJsonlLines(path12, maxBytes = 1e6) {
648950
648989
  if (!existsSync133(path12)) return 0;
648951
648990
  try {
648952
- const text2 = readFileSync108(path12, "utf8").slice(-maxBytes);
648991
+ const text2 = readFileSync107(path12, "utf8").slice(-maxBytes);
648953
648992
  return text2.split(/\r?\n/).filter((line) => line.trim()).length;
648954
648993
  } catch {
648955
648994
  return 0;
@@ -648993,7 +649032,7 @@ function loadMemoryContextBundle(repoRoot, task = "", taskEmbedding) {
648993
649032
  const files = readdirSync45(dir).filter((f2) => f2.endsWith(".json"));
648994
649033
  for (const file of files.slice(0, 10)) {
648995
649034
  try {
648996
- const raw = readFileSync108(join144(dir, file), "utf-8");
649035
+ const raw = readFileSync107(join144(dir, file), "utf-8");
648997
649036
  const entries = JSON.parse(raw);
648998
649037
  const topic = basename26(file, ".json");
648999
649038
  for (const [k, v] of Object.entries(entries)) {
@@ -649482,7 +649521,7 @@ function loadCustomToolsContext(repoRoot) {
649482
649521
  const registryPath = join144(repoRoot, ".omnius", "tools", "registry.json");
649483
649522
  const indexPath = join144(repoRoot, ".omnius", "tools", "README.md");
649484
649523
  if (!existsSync133(registryPath)) return "";
649485
- const registry4 = JSON.parse(readFileSync108(registryPath, "utf-8"));
649524
+ const registry4 = JSON.parse(readFileSync107(registryPath, "utf-8"));
649486
649525
  const tools = (registry4.tools ?? []).filter((tool) => tool.qualityGate?.lastTest?.status === "passed").sort((a2, b) => {
649487
649526
  const byRate = (b.analytics?.successRate ?? 0) - (a2.analytics?.successRate ?? 0);
649488
649527
  if (byRate !== 0) return byRate;
@@ -649658,7 +649697,7 @@ var init_project_context = __esm({
649658
649697
  });
649659
649698
 
649660
649699
  // packages/cli/src/realtime.ts
649661
- import { existsSync as existsSync134, readFileSync as readFileSync109, readdirSync as readdirSync46 } from "node:fs";
649700
+ import { existsSync as existsSync134, readFileSync as readFileSync108, readdirSync as readdirSync46 } from "node:fs";
649662
649701
  import { basename as basename27, join as join145, resolve as resolve58 } from "node:path";
649663
649702
  function clampInt2(value2, fallback, min, max) {
649664
649703
  const n2 = typeof value2 === "number" ? value2 : Number.parseInt(String(value2 ?? ""), 10);
@@ -649680,7 +649719,7 @@ function firstReadable(candidates) {
649680
649719
  for (const path12 of candidates) {
649681
649720
  if (!existsSync134(path12)) continue;
649682
649721
  try {
649683
- return { path: path12, content: readFileSync109(path12, "utf8") };
649722
+ return { path: path12, content: readFileSync108(path12, "utf8") };
649684
649723
  } catch {
649685
649724
  return null;
649686
649725
  }
@@ -649703,7 +649742,7 @@ function projectVoice(repoRoot) {
649703
649742
  return ap - bp || a2.localeCompare(b);
649704
649743
  });
649705
649744
  const first2 = files[0];
649706
- return first2 ? { path: join145(voiceDir3, first2), content: readFileSync109(join145(voiceDir3, first2), "utf8") } : null;
649745
+ return first2 ? { path: join145(voiceDir3, first2), content: readFileSync108(join145(voiceDir3, first2), "utf8") } : null;
649707
649746
  } catch {
649708
649747
  return null;
649709
649748
  }
@@ -649891,7 +649930,7 @@ __export(chat_session_exports, {
649891
649930
  import { randomUUID as randomUUID18 } from "node:crypto";
649892
649931
  import {
649893
649932
  existsSync as existsSync135,
649894
- readFileSync as readFileSync110,
649933
+ readFileSync as readFileSync109,
649895
649934
  readdirSync as readdirSync47,
649896
649935
  writeFileSync as writeFileSync69,
649897
649936
  renameSync as renameSync11,
@@ -650000,7 +650039,7 @@ function normalizeLoadedSession(parsed) {
650000
650039
  }
650001
650040
  function readSessionFile(fp) {
650002
650041
  try {
650003
- const parsed = JSON.parse(readFileSync110(fp, "utf-8"));
650042
+ const parsed = JSON.parse(readFileSync109(fp, "utf-8"));
650004
650043
  if (!parsed || typeof parsed !== "object" || !parsed.id) return null;
650005
650044
  return normalizeLoadedSession(parsed);
650006
650045
  } catch {
@@ -650033,7 +650072,7 @@ function loadPersistedSessions() {
650033
650072
  if (!f2.endsWith(".json") || f2.includes(".tmp.")) continue;
650034
650073
  const fp = join146(dir, f2);
650035
650074
  try {
650036
- const parsed = JSON.parse(readFileSync110(fp, "utf-8"));
650075
+ const parsed = JSON.parse(readFileSync109(fp, "utf-8"));
650037
650076
  if (f2.endsWith(".inflight.json")) {
650038
650077
  if (parsed && parsed.pid && parsed.status === "running") {
650039
650078
  try {
@@ -650075,7 +650114,7 @@ function buildSystemPrompt(cwd4) {
650075
650114
  const diaryPath = join146(cwd4, ".omnius", "context", "session-diary.md");
650076
650115
  if (existsSync135(diaryPath)) {
650077
650116
  try {
650078
- const diary = readFileSync110(diaryPath, "utf-8").slice(0, 1e3);
650117
+ const diary = readFileSync109(diaryPath, "utf-8").slice(0, 1e3);
650079
650118
  parts.push(`\\nPrevious session history:\\n${diary}`);
650080
650119
  } catch {
650081
650120
  }
@@ -650090,7 +650129,7 @@ function buildSystemPrompt(cwd4) {
650090
650129
  );
650091
650130
  for (const f2 of files.slice(0, 3)) {
650092
650131
  try {
650093
- const data = JSON.parse(readFileSync110(join146(memDir, f2), "utf-8"));
650132
+ const data = JSON.parse(readFileSync109(join146(memDir, f2), "utf-8"));
650094
650133
  const entries = Object.entries(data).slice(0, 3);
650095
650134
  if (entries.length > 0) {
650096
650135
  parts.push(
@@ -650110,7 +650149,7 @@ function buildSystemPrompt(cwd4) {
650110
650149
  const p2 = join146(cwd4, name10);
650111
650150
  if (existsSync135(p2)) {
650112
650151
  try {
650113
- const content = readFileSync110(p2, "utf-8").slice(0, 500);
650152
+ const content = readFileSync109(p2, "utf-8").slice(0, 500);
650114
650153
  parts.push(`\\nProject instructions (${name10}):\\n${content}`);
650115
650154
  } catch {
650116
650155
  }
@@ -650132,7 +650171,7 @@ function getSession2(sessionId, model, cwd4) {
650132
650171
  try {
650133
650172
  const fp = sessionPath(sessionId);
650134
650173
  if (existsSync135(fp)) {
650135
- const parsed = normalizeLoadedSession(JSON.parse(readFileSync110(fp, "utf-8")));
650174
+ const parsed = normalizeLoadedSession(JSON.parse(readFileSync109(fp, "utf-8")));
650136
650175
  if (parsed && parsed.id === sessionId) {
650137
650176
  parsed.lastActivity = Date.now();
650138
650177
  if (canonicalRoot && !parsed.projectRoot) parsed.projectRoot = canonicalRoot;
@@ -650319,7 +650358,7 @@ function drainCheckins(sessionId) {
650319
650358
  const fp = checkinPath(sessionId);
650320
650359
  if (!existsSync135(fp)) return [];
650321
650360
  try {
650322
- const raw = readFileSync110(fp, "utf-8");
650361
+ const raw = readFileSync109(fp, "utf-8");
650323
650362
  try {
650324
650363
  unlinkSync28(fp);
650325
650364
  } catch {
@@ -650385,7 +650424,7 @@ function lookupSession(id) {
650385
650424
  try {
650386
650425
  const fp = sessionPath(id);
650387
650426
  if (existsSync135(fp)) {
650388
- const parsed = normalizeLoadedSession(JSON.parse(readFileSync110(fp, "utf-8")));
650427
+ const parsed = normalizeLoadedSession(JSON.parse(readFileSync109(fp, "utf-8")));
650389
650428
  if (parsed && parsed.id === id) {
650390
650429
  sessions2.set(id, parsed);
650391
650430
  return parsed;
@@ -650438,7 +650477,7 @@ function getInFlightChat(sessionId) {
650438
650477
  try {
650439
650478
  const p2 = inFlightPath(sessionId);
650440
650479
  if (existsSync135(p2)) {
650441
- const parsed = JSON.parse(readFileSync110(p2, "utf-8"));
650480
+ const parsed = JSON.parse(readFileSync109(p2, "utf-8"));
650442
650481
  if (parsed && parsed.sessionId === sessionId) {
650443
650482
  return parsed;
650444
650483
  }
@@ -651626,7 +651665,7 @@ __export(banner_exports, {
651626
651665
  setBannerWriter: () => setBannerWriter,
651627
651666
  setGridText: () => setGridText
651628
651667
  });
651629
- import { existsSync as existsSync137, readFileSync as readFileSync111, writeFileSync as writeFileSync70, mkdirSync as mkdirSync81 } from "node:fs";
651668
+ import { existsSync as existsSync137, readFileSync as readFileSync110, writeFileSync as writeFileSync70, mkdirSync as mkdirSync81 } from "node:fs";
651630
651669
  import { join as join148 } from "node:path";
651631
651670
  function setBannerWriter(writer) {
651632
651671
  chromeWrite3 = writer;
@@ -651768,7 +651807,7 @@ function loadBannerDesign(workDir, id) {
651768
651807
  const file = join148(workDir, ".omnius", "banners", `${id}.json`);
651769
651808
  if (!existsSync137(file)) return null;
651770
651809
  try {
651771
- return JSON.parse(readFileSync111(file, "utf8"));
651810
+ return JSON.parse(readFileSync110(file, "utf8"));
651772
651811
  } catch {
651773
651812
  return null;
651774
651813
  }
@@ -652098,13 +652137,13 @@ var init_banner = __esm({
652098
652137
  });
652099
652138
 
652100
652139
  // packages/cli/src/tui/carousel-descriptors.ts
652101
- import { existsSync as existsSync138, readFileSync as readFileSync112, writeFileSync as writeFileSync71, mkdirSync as mkdirSync82, readdirSync as readdirSync48 } from "node:fs";
652140
+ import { existsSync as existsSync138, readFileSync as readFileSync111, writeFileSync as writeFileSync71, mkdirSync as mkdirSync82, readdirSync as readdirSync48 } from "node:fs";
652102
652141
  import { join as join149, basename as basename30 } from "node:path";
652103
652142
  function loadToolProfile(repoRoot) {
652104
652143
  const filePath = join149(repoRoot, OMNIUS_DIR, "context", TOOL_PROFILE_FILE);
652105
652144
  try {
652106
652145
  if (!existsSync138(filePath)) return null;
652107
- return JSON.parse(readFileSync112(filePath, "utf-8"));
652146
+ return JSON.parse(readFileSync111(filePath, "utf-8"));
652108
652147
  } catch {
652109
652148
  return null;
652110
652149
  }
@@ -652170,7 +652209,7 @@ function loadCachedDescriptors(repoRoot) {
652170
652209
  const filePath = join149(repoRoot, OMNIUS_DIR, "context", DESCRIPTOR_FILE);
652171
652210
  try {
652172
652211
  if (!existsSync138(filePath)) return null;
652173
- const cached = JSON.parse(readFileSync112(filePath, "utf-8"));
652212
+ const cached = JSON.parse(readFileSync111(filePath, "utf-8"));
652174
652213
  return cached.phrases.length > 0 ? cached.phrases : null;
652175
652214
  } catch {
652176
652215
  return null;
@@ -652234,7 +652273,7 @@ function extractFromPackageJson(repoRoot, tags) {
652234
652273
  const pkgPath = join149(repoRoot, "package.json");
652235
652274
  try {
652236
652275
  if (!existsSync138(pkgPath)) return;
652237
- const pkg = JSON.parse(readFileSync112(pkgPath, "utf-8"));
652276
+ const pkg = JSON.parse(readFileSync111(pkgPath, "utf-8"));
652238
652277
  if (pkg.name && typeof pkg.name === "string") {
652239
652278
  const parts = pkg.name.replace(/^@/, "").split("/");
652240
652279
  for (const p2 of parts) tags.push(p2);
@@ -652305,7 +652344,7 @@ function extractFromMemory(repoRoot, tags) {
652305
652344
  const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
652306
652345
  tags.push(topic);
652307
652346
  try {
652308
- const data = JSON.parse(readFileSync112(join149(memoryDir, file), "utf-8"));
652347
+ const data = JSON.parse(readFileSync111(join149(memoryDir, file), "utf-8"));
652309
652348
  if (data && typeof data === "object") {
652310
652349
  const keys = Object.keys(data).slice(0, 3);
652311
652350
  for (const key of keys) {
@@ -653348,7 +653387,7 @@ var init_edit_history = __esm({
653348
653387
  });
653349
653388
 
653350
653389
  // packages/cli/src/tui/snr-engine.ts
653351
- import { existsSync as existsSync139, readdirSync as readdirSync49, readFileSync as readFileSync113, writeFileSync as writeFileSync72, mkdirSync as mkdirSync84, rmSync as rmSync11 } from "node:fs";
653390
+ import { existsSync as existsSync139, readdirSync as readdirSync49, readFileSync as readFileSync112, writeFileSync as writeFileSync72, mkdirSync as mkdirSync84, rmSync as rmSync11 } from "node:fs";
653352
653391
  import { join as join151, basename as basename31 } from "node:path";
653353
653392
  function computeDPrime(signalScores, noiseScores) {
653354
653393
  if (signalScores.length === 0 || noiseScores.length === 0) return 0;
@@ -653654,7 +653693,7 @@ Call task_complete with the JSON array when done.`,
653654
653693
  const topic = basename31(f2, ".json");
653655
653694
  if (topics.length > 0 && !topics.includes(topic)) continue;
653656
653695
  try {
653657
- const data = JSON.parse(readFileSync113(join151(dir, f2), "utf-8"));
653696
+ const data = JSON.parse(readFileSync112(join151(dir, f2), "utf-8"));
653658
653697
  for (const [key, val] of Object.entries(data)) {
653659
653698
  const value2 = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
653660
653699
  entries.push({ topic, key, value: value2 });
@@ -653756,7 +653795,7 @@ Call task_complete with the JSON array when done.`,
653756
653795
  const file = join151(memDir, `${topic}.json`);
653757
653796
  if (!existsSync139(file)) continue;
653758
653797
  try {
653759
- const data = JSON.parse(readFileSync113(file, "utf-8"));
653798
+ const data = JSON.parse(readFileSync112(file, "utf-8"));
653760
653799
  const moved = {};
653761
653800
  for (const key of keys) {
653762
653801
  if (key in data) {
@@ -653771,7 +653810,7 @@ Call task_complete with the JSON array when done.`,
653771
653810
  let archiveData = {};
653772
653811
  if (existsSync139(archiveFile)) {
653773
653812
  try {
653774
- archiveData = JSON.parse(readFileSync113(archiveFile, "utf-8"));
653813
+ archiveData = JSON.parse(readFileSync112(archiveFile, "utf-8"));
653775
653814
  } catch {
653776
653815
  }
653777
653816
  }
@@ -653810,7 +653849,7 @@ Call task_complete with the JSON array when done.`,
653810
653849
  });
653811
653850
 
653812
653851
  // packages/cli/src/tui/promptLoader.ts
653813
- import { readFileSync as readFileSync114, existsSync as existsSync140 } from "node:fs";
653852
+ import { readFileSync as readFileSync113, existsSync as existsSync140 } from "node:fs";
653814
653853
  import { join as join152, dirname as dirname47 } from "node:path";
653815
653854
  import { fileURLToPath as fileURLToPath18 } from "node:url";
653816
653855
  function loadPrompt3(promptPath, vars) {
@@ -653820,7 +653859,7 @@ function loadPrompt3(promptPath, vars) {
653820
653859
  if (!existsSync140(fullPath)) {
653821
653860
  throw new Error(`Prompt file not found: ${fullPath}`);
653822
653861
  }
653823
- content = readFileSync114(fullPath, "utf-8");
653862
+ content = readFileSync113(fullPath, "utf-8");
653824
653863
  cache7.set(promptPath, content);
653825
653864
  }
653826
653865
  if (!vars) return content;
@@ -653840,7 +653879,7 @@ var init_promptLoader3 = __esm({
653840
653879
  });
653841
653880
 
653842
653881
  // packages/cli/src/tui/dream-engine.ts
653843
- import { mkdirSync as mkdirSync85, writeFileSync as writeFileSync73, readFileSync as readFileSync115, existsSync as existsSync141, readdirSync as readdirSync50 } from "node:fs";
653882
+ import { mkdirSync as mkdirSync85, writeFileSync as writeFileSync73, readFileSync as readFileSync114, existsSync as existsSync141, readdirSync as readdirSync50 } from "node:fs";
653844
653883
  import { join as join153, basename as basename32 } from "node:path";
653845
653884
  import { execSync as execSync57 } from "node:child_process";
653846
653885
  function setDreamWriteContent(fn) {
@@ -653857,7 +653896,7 @@ function loadAutoresearchMemory(repoRoot) {
653857
653896
  const memoryPath = join153(repoRoot, ".omnius", "memory", "autoresearch.json");
653858
653897
  if (!existsSync141(memoryPath)) return "";
653859
653898
  try {
653860
- const raw = readFileSync115(memoryPath, "utf-8");
653899
+ const raw = readFileSync114(memoryPath, "utf-8");
653861
653900
  const data = JSON.parse(raw);
653862
653901
  const sections = [];
653863
653902
  for (const key of AUTORESEARCH_MEMORY_KEYS) {
@@ -654091,7 +654130,7 @@ var init_dream_engine = __esm({
654091
654130
  if (!existsSync141(targetPath)) {
654092
654131
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
654093
654132
  }
654094
- let content = readFileSync115(targetPath, "utf-8");
654133
+ let content = readFileSync114(targetPath, "utf-8");
654095
654134
  if (!content.includes(oldStr)) {
654096
654135
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
654097
654136
  }
@@ -654179,7 +654218,7 @@ var init_dream_engine = __esm({
654179
654218
  if (!existsSync141(targetPath)) {
654180
654219
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
654181
654220
  }
654182
- let content = readFileSync115(targetPath, "utf-8");
654221
+ let content = readFileSync114(targetPath, "utf-8");
654183
654222
  if (!content.includes(oldStr)) {
654184
654223
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
654185
654224
  }
@@ -655139,7 +655178,7 @@ ${summary}` };
655139
655178
  try {
655140
655179
  let notes = [];
655141
655180
  if (existsSync141(notesPath)) {
655142
- notes = JSON.parse(readFileSync115(notesPath, "utf-8"));
655181
+ notes = JSON.parse(readFileSync114(notesPath, "utf-8"));
655143
655182
  }
655144
655183
  if (action === "add") {
655145
655184
  const note = {
@@ -655782,7 +655821,7 @@ var init_bless_engine = __esm({
655782
655821
  });
655783
655822
 
655784
655823
  // packages/cli/src/tui/dmn-engine.ts
655785
- import { existsSync as existsSync142, readFileSync as readFileSync116, writeFileSync as writeFileSync74, mkdirSync as mkdirSync86, readdirSync as readdirSync51, unlinkSync as unlinkSync29 } from "node:fs";
655824
+ import { existsSync as existsSync142, readFileSync as readFileSync115, writeFileSync as writeFileSync74, mkdirSync as mkdirSync86, readdirSync as readdirSync51, unlinkSync as unlinkSync29 } from "node:fs";
655786
655825
  import { join as join154, basename as basename33 } from "node:path";
655787
655826
  function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities, competence, reflectionBuffer) {
655788
655827
  const competenceReport = competence.length > 0 ? competence.map((c8) => {
@@ -656540,7 +656579,7 @@ OUTPUT: Call task_complete with JSON:
656540
656579
  const path12 = join154(this.stateDir, "state.json");
656541
656580
  if (existsSync142(path12)) {
656542
656581
  try {
656543
- this.state = JSON.parse(readFileSync116(path12, "utf-8"));
656582
+ this.state = JSON.parse(readFileSync115(path12, "utf-8"));
656544
656583
  } catch {
656545
656584
  }
656546
656585
  }
@@ -656574,7 +656613,7 @@ OUTPUT: Call task_complete with JSON:
656574
656613
  const latestByFingerprint = /* @__PURE__ */ new Map();
656575
656614
  for (const file of files) {
656576
656615
  try {
656577
- const parsed = JSON.parse(readFileSync116(join154(this.historyDir, file), "utf-8"));
656616
+ const parsed = JSON.parse(readFileSync115(join154(this.historyDir, file), "utf-8"));
656578
656617
  latestByFingerprint.set(this.fingerprintCycle(parsed), file);
656579
656618
  } catch {
656580
656619
  keep.add(file);
@@ -658374,7 +658413,7 @@ import { createCipheriv as createCipheriv5, createDecipheriv as createDecipheriv
658374
658413
  import {
658375
658414
  existsSync as existsSync143,
658376
658415
  mkdirSync as mkdirSync87,
658377
- readFileSync as readFileSync117,
658416
+ readFileSync as readFileSync116,
658378
658417
  statSync as statSync49,
658379
658418
  unlinkSync as unlinkSync30,
658380
658419
  writeFileSync as writeFileSync75
@@ -658604,7 +658643,7 @@ function scopedTool(base3, root, mode) {
658604
658643
  );
658605
658644
  if (!materialized.ok) return denied(materialized.error);
658606
658645
  mkdirSync87(dirname48(guarded.path.abs), { recursive: true });
658607
- writeFileSync75(guarded.path.abs, readFileSync117(materialized.path));
658646
+ writeFileSync75(guarded.path.abs, readFileSync116(materialized.path));
658608
658647
  materialized.cleanup?.();
658609
658648
  restoredEditPath = guarded.path.abs;
658610
658649
  }
@@ -658728,7 +658767,7 @@ function readManifest(root) {
658728
658767
  ensureManifest(root);
658729
658768
  try {
658730
658769
  const parsed = JSON.parse(
658731
- readFileSync117(manifestPath(root), "utf8")
658770
+ readFileSync116(manifestPath(root), "utf8")
658732
658771
  );
658733
658772
  const objects = parsed.objects && typeof parsed.objects === "object" ? Object.fromEntries(
658734
658773
  Object.entries(parsed.objects).filter(
@@ -658780,7 +658819,7 @@ function rememberCreated(root, absPath) {
658780
658819
  }
658781
658820
  }
658782
658821
  mkdirSync87(join155(root, OBJECTS_DIR), { recursive: true });
658783
- const data = readFileSync117(guarded.path.abs);
658822
+ const data = readFileSync116(guarded.path.abs);
658784
658823
  const prefix = randomBytes25(48);
658785
658824
  const key = randomBytes25(32);
658786
658825
  const iv = randomBytes25(12);
@@ -658836,7 +658875,7 @@ function materializeTelegramCreativeArtifactForSend(root, rawPath) {
658836
658875
  error: `Scoped artifact storage is missing for ${rel}.`
658837
658876
  };
658838
658877
  }
658839
- const blob = readFileSync117(storedAbs);
658878
+ const blob = readFileSync116(storedAbs);
658840
658879
  if (blob.length < object.prefixBytes) {
658841
658880
  return {
658842
658881
  ok: false,
@@ -659634,7 +659673,7 @@ var init_soul_observations = __esm({
659634
659673
  });
659635
659674
 
659636
659675
  // packages/cli/src/tui/telegram-channel-dmn.ts
659637
- import { existsSync as existsSync144, mkdirSync as mkdirSync88, readdirSync as readdirSync52, readFileSync as readFileSync118, writeFileSync as writeFileSync76 } from "node:fs";
659676
+ import { existsSync as existsSync144, mkdirSync as mkdirSync88, readdirSync as readdirSync52, readFileSync as readFileSync117, writeFileSync as writeFileSync76 } from "node:fs";
659638
659677
  import { join as join156 } from "node:path";
659639
659678
  import { createHash as createHash37 } from "node:crypto";
659640
659679
  function safeFilePart(value2) {
@@ -660208,7 +660247,7 @@ function latestTelegramChannelDaydream(repoRoot, sessionKey) {
660208
660247
  const files = readdirSync52(dir).filter((file) => file.endsWith(".json")).sort();
660209
660248
  for (const file of files.reverse()) {
660210
660249
  try {
660211
- return JSON.parse(readFileSync118(join156(dir, file), "utf8"));
660250
+ return JSON.parse(readFileSync117(join156(dir, file), "utf8"));
660212
660251
  } catch {
660213
660252
  }
660214
660253
  }
@@ -661831,7 +661870,7 @@ __export(vision_ingress_exports, {
661831
661870
  runVisionIngress: () => runVisionIngress
661832
661871
  });
661833
661872
  import { execFileSync as execFileSync10 } from "node:child_process";
661834
- import { existsSync as existsSync145, readFileSync as readFileSync119, unlinkSync as unlinkSync31 } from "node:fs";
661873
+ import { existsSync as existsSync145, readFileSync as readFileSync118, unlinkSync as unlinkSync31 } from "node:fs";
661835
661874
  import { join as join157 } from "node:path";
661836
661875
  function isTesseractAvailable() {
661837
661876
  try {
@@ -661886,7 +661925,7 @@ function advancedOcr(imagePath) {
661886
661925
  ], { timeout: 15e3, stdio: "pipe" });
661887
661926
  const txtFile = `${outFile}.txt`;
661888
661927
  if (existsSync145(txtFile)) {
661889
- const text2 = readFileSync119(txtFile, "utf-8").trim();
661928
+ const text2 = readFileSync118(txtFile, "utf-8").trim();
661890
661929
  if (text2.length > 0) results.push(text2);
661891
661930
  try {
661892
661931
  unlinkSync31(txtFile);
@@ -661903,7 +661942,7 @@ function advancedOcr(imagePath) {
661903
661942
  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.") {
661904
661943
  if (!isVisionModel(modelName)) return "";
661905
661944
  if (!existsSync145(imagePath)) return "";
661906
- const imageBuffer = readFileSync119(imagePath);
661945
+ const imageBuffer = readFileSync118(imagePath);
661907
661946
  const base64Image = imageBuffer.toString("base64");
661908
661947
  const broker = getModelBroker();
661909
661948
  const decision2 = await broker.ensureModelLoadable({
@@ -662014,7 +662053,7 @@ import {
662014
662053
  readdirSync as readdirSync53,
662015
662054
  statSync as statSync50,
662016
662055
  statfsSync as statfsSync7,
662017
- readFileSync as readFileSync120,
662056
+ readFileSync as readFileSync119,
662018
662057
  writeFileSync as writeFileSync78,
662019
662058
  appendFileSync as appendFileSync15
662020
662059
  } from "node:fs";
@@ -668137,7 +668176,7 @@ ${mediaContext}` : ""
668137
668176
  const path12 = this.telegramConversationPath(sessionKey);
668138
668177
  if (!existsSync146(path12)) return;
668139
668178
  try {
668140
- const parsed = JSON.parse(readFileSync120(path12, "utf8"));
668179
+ const parsed = JSON.parse(readFileSync119(path12, "utf8"));
668141
668180
  const loadedHistory = Array.isArray(parsed.history) ? parsed.history : [];
668142
668181
  if (Array.isArray(parsed.history)) {
668143
668182
  this.chatHistory.set(
@@ -668349,7 +668388,7 @@ ${mediaContext}` : ""
668349
668388
  for (const file of readdirSync53(this.telegramConversationDir)) {
668350
668389
  if (!file.endsWith(".json")) continue;
668351
668390
  try {
668352
- const raw = readFileSync120(
668391
+ const raw = readFileSync119(
668353
668392
  join158(this.telegramConversationDir, file),
668354
668393
  "utf8"
668355
668394
  );
@@ -672971,7 +673010,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
672971
673010
  const lockFile = join158(lockDir, `bot-${botUserId}.owner.lock`);
672972
673011
  if (existsSync146(lockFile)) {
672973
673012
  try {
672974
- const prior = JSON.parse(readFileSync120(lockFile, "utf8"));
673013
+ const prior = JSON.parse(readFileSync119(lockFile, "utf8"));
672975
673014
  const priorAlive = typeof prior.pid === "number" && prior.pid !== process.pid ? this.processIsAlive(prior.pid) : false;
672976
673015
  if (priorAlive) {
672977
673016
  throw new Error(
@@ -673004,7 +673043,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
673004
673043
  try {
673005
673044
  if (!existsSync146(lockFile)) return;
673006
673045
  try {
673007
- const prior = JSON.parse(readFileSync120(lockFile, "utf8"));
673046
+ const prior = JSON.parse(readFileSync119(lockFile, "utf8"));
673008
673047
  if (prior.pid !== process.pid) return;
673009
673048
  } catch {
673010
673049
  }
@@ -677918,7 +677957,7 @@ Scoped workspace: ${scopedRoot}`,
677918
677957
  readTelegramToolButtonState(nonce) {
677919
677958
  try {
677920
677959
  const parsed = JSON.parse(
677921
- readFileSync120(this.telegramToolButtonPath(nonce), "utf-8")
677960
+ readFileSync119(this.telegramToolButtonPath(nonce), "utf-8")
677922
677961
  );
677923
677962
  if (!parsed || parsed.expiresAt < Date.now()) return null;
677924
677963
  return parsed;
@@ -679271,7 +679310,7 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
679271
679310
  const ingressResult = await runVisionIngress2(
679272
679311
  {
679273
679312
  path: localPath,
679274
- buffer: readFileSync120(localPath),
679313
+ buffer: readFileSync119(localPath),
679275
679314
  mime: telegramImageMime(media)
679276
679315
  },
679277
679316
  this.agentConfig?.model ?? ""
@@ -679636,7 +679675,7 @@ ${text2}`.trim()
679636
679675
  }
679637
679676
  if (!existsSync146(media.value))
679638
679677
  throw new Error(`File does not exist: ${media.value}`);
679639
- const buffer2 = readFileSync120(media.value);
679678
+ const buffer2 = readFileSync119(media.value);
679640
679679
  const boundary = `----omnius-media-${Date.now()}-${Math.random().toString(36).slice(2)}`;
679641
679680
  const filename = basename35(media.value);
679642
679681
  const contentType = mimeForPath(media.value, media.kind);
@@ -679750,7 +679789,7 @@ Content-Type: ${contentType}\r
679750
679789
  const sidecarPath2 = `${imagePath}.json`;
679751
679790
  if (!existsSync146(sidecarPath2)) return null;
679752
679791
  try {
679753
- const raw = readFileSync120(sidecarPath2, "utf8");
679792
+ const raw = readFileSync119(sidecarPath2, "utf8");
679754
679793
  const parsed = JSON.parse(raw);
679755
679794
  if (!parsed || typeof parsed !== "object" || typeof parsed["original_prompt"] !== "string") {
679756
679795
  return null;
@@ -679810,7 +679849,7 @@ Content-Type: ${contentType}\r
679810
679849
  const sidecarPath2 = `${videoPath}.json`;
679811
679850
  if (!existsSync146(sidecarPath2)) return null;
679812
679851
  try {
679813
- const raw = readFileSync120(sidecarPath2, "utf8");
679852
+ const raw = readFileSync119(sidecarPath2, "utf8");
679814
679853
  const parsed = JSON.parse(raw);
679815
679854
  if (!parsed || typeof parsed !== "object" || typeof parsed["original_prompt"] !== "string") {
679816
679855
  return null;
@@ -679955,7 +679994,7 @@ Content-Type: ${contentType}\r
679955
679994
  addField(field, pathOrFileId);
679956
679995
  continue;
679957
679996
  }
679958
- const buffer2 = readFileSync120(pathOrFileId);
679997
+ const buffer2 = readFileSync119(pathOrFileId);
679959
679998
  const filename = basename35(pathOrFileId);
679960
679999
  parts.push(Buffer.from(`--${boundary}\r
679961
680000
  `));
@@ -681729,14 +681768,14 @@ __export(projects_exports, {
681729
681768
  setCurrentProject: () => setCurrentProject,
681730
681769
  unregisterProject: () => unregisterProject
681731
681770
  });
681732
- import { readFileSync as readFileSync121, writeFileSync as writeFileSync79, mkdirSync as mkdirSync90, existsSync as existsSync147, statSync as statSync51, renameSync as renameSync12 } from "node:fs";
681771
+ import { readFileSync as readFileSync120, writeFileSync as writeFileSync79, mkdirSync as mkdirSync90, existsSync as existsSync147, statSync as statSync51, renameSync as renameSync12 } from "node:fs";
681733
681772
  import { homedir as homedir52 } from "node:os";
681734
681773
  import { basename as basename36, join as join159, resolve as resolve63 } from "node:path";
681735
681774
  import { randomUUID as randomUUID19 } from "node:crypto";
681736
681775
  function readAll2() {
681737
681776
  try {
681738
681777
  if (!existsSync147(PROJECTS_FILE)) return { projects: [], schemaVersion: 1 };
681739
- const raw = readFileSync121(PROJECTS_FILE, "utf8");
681778
+ const raw = readFileSync120(PROJECTS_FILE, "utf8");
681740
681779
  const parsed = JSON.parse(raw);
681741
681780
  if (!parsed || !Array.isArray(parsed.projects)) return { projects: [], schemaVersion: 1 };
681742
681781
  return { projects: parsed.projects, schemaVersion: 1 };
@@ -681813,7 +681852,7 @@ function getCurrentProject() {
681813
681852
  if (!currentRoot) {
681814
681853
  try {
681815
681854
  if (existsSync147(CURRENT_FILE)) {
681816
- const persisted = readFileSync121(CURRENT_FILE, "utf8").trim();
681855
+ const persisted = readFileSync120(CURRENT_FILE, "utf8").trim();
681817
681856
  if (persisted) currentRoot = persisted;
681818
681857
  }
681819
681858
  } catch {
@@ -682727,7 +682766,7 @@ var init_access_policy = __esm({
682727
682766
 
682728
682767
  // packages/cli/src/api/project-preferences.ts
682729
682768
  import { createHash as createHash41 } from "node:crypto";
682730
- import { existsSync as existsSync148, mkdirSync as mkdirSync91, readFileSync as readFileSync122, renameSync as renameSync13, writeFileSync as writeFileSync80, unlinkSync as unlinkSync33 } from "node:fs";
682769
+ import { existsSync as existsSync148, mkdirSync as mkdirSync91, readFileSync as readFileSync121, renameSync as renameSync13, writeFileSync as writeFileSync80, unlinkSync as unlinkSync33 } from "node:fs";
682731
682770
  import { homedir as homedir53 } from "node:os";
682732
682771
  import { join as join160, resolve as resolve64 } from "node:path";
682733
682772
  import { randomUUID as randomUUID20 } from "node:crypto";
@@ -682760,7 +682799,7 @@ function readProjectPreferences(root) {
682760
682799
  try {
682761
682800
  const file = prefsPath(root);
682762
682801
  if (!existsSync148(file)) return { ...DEFAULT_PREFS };
682763
- const raw = readFileSync122(file, "utf8");
682802
+ const raw = readFileSync121(file, "utf8");
682764
682803
  const parsed = JSON.parse(raw);
682765
682804
  if (!parsed || parsed.v !== SCHEMA_VERSION) return { ...DEFAULT_PREFS };
682766
682805
  return { ...DEFAULT_PREFS, ...parsed, v: SCHEMA_VERSION };
@@ -682827,7 +682866,7 @@ __export(audit_log_exports, {
682827
682866
  recordAudit: () => recordAudit,
682828
682867
  sanitizeBody: () => sanitizeBody
682829
682868
  });
682830
- import { mkdirSync as mkdirSync92, appendFileSync as appendFileSync16, readFileSync as readFileSync123, existsSync as existsSync149 } from "node:fs";
682869
+ import { mkdirSync as mkdirSync92, appendFileSync as appendFileSync16, readFileSync as readFileSync122, existsSync as existsSync149 } from "node:fs";
682831
682870
  import { join as join161 } from "node:path";
682832
682871
  function initAuditLog(omniusDir) {
682833
682872
  auditDir = join161(omniusDir, "audit");
@@ -682864,7 +682903,7 @@ function sanitizeBody(body, maxLen = 200) {
682864
682903
  function queryAudit(opts) {
682865
682904
  if (!initialized || !existsSync149(auditFile)) return [];
682866
682905
  try {
682867
- const raw = readFileSync123(auditFile, "utf-8");
682906
+ const raw = readFileSync122(auditFile, "utf-8");
682868
682907
  const lines = raw.split("\n").filter(Boolean);
682869
682908
  let records = lines.map((l2) => {
682870
682909
  try {
@@ -683827,7 +683866,7 @@ var init_direct_tool_registry = __esm({
683827
683866
  });
683828
683867
 
683829
683868
  // packages/cli/src/api/external-tool-registry.ts
683830
- import { existsSync as existsSync152, mkdirSync as mkdirSync95, readFileSync as readFileSync124, writeFileSync as writeFileSync81, renameSync as renameSync14 } from "node:fs";
683869
+ import { existsSync as existsSync152, mkdirSync as mkdirSync95, readFileSync as readFileSync123, writeFileSync as writeFileSync81, renameSync as renameSync14 } from "node:fs";
683831
683870
  import { join as join163 } from "node:path";
683832
683871
  function externalToolStorePath(workingDir) {
683833
683872
  return join163(workingDir, ".omnius", "external-tools.json");
@@ -683836,7 +683875,7 @@ function loadExternalTools(workingDir) {
683836
683875
  const path12 = externalToolStorePath(workingDir);
683837
683876
  if (!existsSync152(path12)) return [];
683838
683877
  try {
683839
- const parsed = JSON.parse(readFileSync124(path12, "utf-8"));
683878
+ const parsed = JSON.parse(readFileSync123(path12, "utf-8"));
683840
683879
  if (!parsed || !Array.isArray(parsed.tools)) return [];
683841
683880
  return parsed.tools.filter(
683842
683881
  (t2) => t2 && typeof t2.name === "string" && t2.transport != null
@@ -684175,7 +684214,7 @@ __export(aiwg_exports, {
684175
684214
  resolveAiwgRoot: () => resolveAiwgRoot,
684176
684215
  tryRouteAiwg: () => tryRouteAiwg
684177
684216
  });
684178
- import { existsSync as existsSync153, readFileSync as readFileSync125, readdirSync as readdirSync54, statSync as statSync54 } from "node:fs";
684217
+ import { existsSync as existsSync153, readFileSync as readFileSync124, readdirSync as readdirSync54, statSync as statSync54 } from "node:fs";
684179
684218
  import { join as join164 } from "node:path";
684180
684219
  import { homedir as homedir54 } from "node:os";
684181
684220
  import { execSync as execSync58 } from "node:child_process";
@@ -684246,7 +684285,7 @@ function resolveAiwgRoot() {
684246
684285
  const pj = join164(cur, "package.json");
684247
684286
  if (existsSync153(pj)) {
684248
684287
  try {
684249
- const pkg = JSON.parse(readFileSync125(pj, "utf-8"));
684288
+ const pkg = JSON.parse(readFileSync124(pj, "utf-8"));
684250
684289
  if (pkg.name === "aiwg") {
684251
684290
  _cachedAiwgRoot = cur;
684252
684291
  return cur;
@@ -684336,7 +684375,7 @@ function readFirstLineDescription(dir) {
684336
684375
  const p2 = join164(dir, candidate);
684337
684376
  if (!existsSync153(p2)) continue;
684338
684377
  try {
684339
- const txt = readFileSync125(p2, "utf-8");
684378
+ const txt = readFileSync124(p2, "utf-8");
684340
684379
  const descMatch = txt.match(/^description:\s*(.+)$/m);
684341
684380
  if (descMatch) return descMatch[1].trim().slice(0, 200);
684342
684381
  for (const line of txt.split("\n")) {
@@ -684387,7 +684426,7 @@ function walkForItems(dir, out, depth) {
684387
684426
  }
684388
684427
  function parseItem(p2) {
684389
684428
  try {
684390
- const raw = readFileSync125(p2, "utf-8");
684429
+ const raw = readFileSync124(p2, "utf-8");
684391
684430
  const header = raw.slice(0, 3e3);
684392
684431
  const nameMatch = header.match(/^name:\s*(.+)$/m);
684393
684432
  const descMatch = header.match(/^description:\s*(.+)$/m);
@@ -684426,7 +684465,7 @@ function deriveSource(p2) {
684426
684465
  function loadAiwgItemContent(path12, maxBytes = 2e4) {
684427
684466
  try {
684428
684467
  if (!existsSync153(path12)) return null;
684429
- const raw = readFileSync125(path12, "utf-8");
684468
+ const raw = readFileSync124(path12, "utf-8");
684430
684469
  return raw.length > maxBytes ? raw.slice(0, maxBytes) + "\n\n...(truncated for context budget)" : raw;
684431
684470
  } catch {
684432
684471
  return null;
@@ -684962,7 +685001,7 @@ __export(runtime_keys_exports, {
684962
685001
  mintKey: () => mintKey,
684963
685002
  revokeByPrefix: () => revokeByPrefix
684964
685003
  });
684965
- import { existsSync as existsSync154, readFileSync as readFileSync126, writeFileSync as writeFileSync82, mkdirSync as mkdirSync96, chmodSync as chmodSync4 } from "node:fs";
685004
+ import { existsSync as existsSync154, readFileSync as readFileSync125, writeFileSync as writeFileSync82, mkdirSync as mkdirSync96, chmodSync as chmodSync4 } from "node:fs";
684966
685005
  import { join as join165 } from "node:path";
684967
685006
  import { homedir as homedir55 } from "node:os";
684968
685007
  import { randomBytes as randomBytes27 } from "node:crypto";
@@ -684973,7 +685012,7 @@ function ensureDir2() {
684973
685012
  function loadAll() {
684974
685013
  if (!existsSync154(KEYS_FILE)) return [];
684975
685014
  try {
684976
- const raw = readFileSync126(KEYS_FILE, "utf-8");
685015
+ const raw = readFileSync125(KEYS_FILE, "utf-8");
684977
685016
  const parsed = JSON.parse(raw);
684978
685017
  if (!Array.isArray(parsed)) return [];
684979
685018
  return parsed;
@@ -685059,7 +685098,7 @@ __export(tor_fallback_exports, {
685059
685098
  torIsReachable: () => torIsReachable,
685060
685099
  tunnelViaTor: () => tunnelViaTor
685061
685100
  });
685062
- import { existsSync as existsSync155, readFileSync as readFileSync127 } from "node:fs";
685101
+ import { existsSync as existsSync155, readFileSync as readFileSync126 } from "node:fs";
685063
685102
  import { homedir as homedir56 } from "node:os";
685064
685103
  import { join as join166 } from "node:path";
685065
685104
  import { createConnection as createConnection3 } from "node:net";
@@ -685072,7 +685111,7 @@ function getLocalOnion() {
685072
685111
  for (const p2 of candidates) {
685073
685112
  try {
685074
685113
  if (existsSync155(p2)) {
685075
- const v = readFileSync127(p2, "utf-8").trim();
685114
+ const v = readFileSync126(p2, "utf-8").trim();
685076
685115
  if (v && v.endsWith(".onion")) return v;
685077
685116
  }
685078
685117
  } catch {
@@ -685333,7 +685372,7 @@ var init_graphical_sudo = __esm({
685333
685372
  });
685334
685373
 
685335
685374
  // packages/cli/src/api/routes-v1.ts
685336
- import { existsSync as existsSync157, mkdirSync as mkdirSync98, readFileSync as readFileSync128, readdirSync as readdirSync55, statSync as statSync55 } from "node:fs";
685375
+ import { existsSync as existsSync157, mkdirSync as mkdirSync98, readFileSync as readFileSync127, readdirSync as readdirSync55, statSync as statSync55 } from "node:fs";
685337
685376
  import { join as join168, resolve as pathResolve3 } from "node:path";
685338
685377
  import { homedir as homedir57 } from "node:os";
685339
685378
  async function tryRouteV1(ctx3) {
@@ -685610,7 +685649,7 @@ function walkForSkills(dir, out, depth) {
685610
685649
  walkForSkills(p2, out, depth + 1);
685611
685650
  } else if (e2.isFile() && e2.name === "SKILL.md") {
685612
685651
  try {
685613
- const content = readFileSync128(p2, "utf-8").slice(0, 2e3);
685652
+ const content = readFileSync127(p2, "utf-8").slice(0, 2e3);
685614
685653
  const nameMatch = content.match(/^name:\s*(.+)$/m);
685615
685654
  const descMatch = content.match(/^description:\s*(.+)$/m);
685616
685655
  out.push({
@@ -686566,7 +686605,7 @@ async function handleFilesRead(ctx3) {
686566
686605
  }));
686567
686606
  return true;
686568
686607
  }
686569
- const content = readFileSync128(resolved, "utf-8");
686608
+ const content = readFileSync127(resolved, "utf-8");
686570
686609
  const offset = typeof body.offset === "number" && body.offset >= 0 ? body.offset : 0;
686571
686610
  const limit = typeof body.limit === "number" && body.limit > 0 ? body.limit : content.length;
686572
686611
  const slice2 = content.slice(offset, offset + limit);
@@ -686806,7 +686845,7 @@ async function handleNexusStatus(ctx3) {
686806
686845
  for (const p2 of statePaths) {
686807
686846
  if (!existsSync157(p2)) continue;
686808
686847
  try {
686809
- const raw = readFileSync128(p2, "utf-8");
686848
+ const raw = readFileSync127(p2, "utf-8");
686810
686849
  states2.push({ source: p2, data: JSON.parse(raw) });
686811
686850
  } catch (e2) {
686812
686851
  states2.push({ source: p2, error: String(e2) });
@@ -686834,7 +686873,7 @@ async function handleNexusStatus(ctx3) {
686834
686873
  function loadAgentName() {
686835
686874
  try {
686836
686875
  const p2 = join168(homedir57(), ".omnius", "agent-name");
686837
- if (existsSync157(p2)) return readFileSync128(p2, "utf-8").trim();
686876
+ if (existsSync157(p2)) return readFileSync127(p2, "utf-8").trim();
686838
686877
  } catch {
686839
686878
  }
686840
686879
  return null;
@@ -686850,7 +686889,7 @@ async function handleSponsors(ctx3) {
686850
686889
  for (const p2 of candidates) {
686851
686890
  if (!existsSync157(p2)) continue;
686852
686891
  try {
686853
- const raw = JSON.parse(readFileSync128(p2, "utf-8"));
686892
+ const raw = JSON.parse(readFileSync127(p2, "utf-8"));
686854
686893
  if (Array.isArray(raw)) {
686855
686894
  sponsors = raw;
686856
686895
  break;
@@ -686930,7 +686969,7 @@ async function handleEvaluate(ctx3) {
686930
686969
  }));
686931
686970
  return true;
686932
686971
  }
686933
- const job = JSON.parse(readFileSync128(jobPath, "utf-8"));
686972
+ const job = JSON.parse(readFileSync127(jobPath, "utf-8"));
686934
686973
  sendJson2(res, 200, {
686935
686974
  run_id: runId,
686936
686975
  task: job.task,
@@ -687070,7 +687109,7 @@ async function handleMintKey(ctx3) {
687070
687109
  function _readStatusFile(p2) {
687071
687110
  if (!existsSync157(p2)) return null;
687072
687111
  try {
687073
- const data = JSON.parse(readFileSync128(p2, "utf-8"));
687112
+ const data = JSON.parse(readFileSync127(p2, "utf-8"));
687074
687113
  if (data?.connected && typeof data.peerId === "string" && data.peerId.length > 10) {
687075
687114
  const pid = Number(data.pid);
687076
687115
  if (pid > 0) {
@@ -687113,7 +687152,7 @@ function resolveLocalPeerId() {
687113
687152
  try {
687114
687153
  const regPath = join168(homedir57(), ".omnius", "nexus-registry.json");
687115
687154
  if (existsSync157(regPath)) {
687116
- const reg = JSON.parse(readFileSync128(regPath, "utf-8"));
687155
+ const reg = JSON.parse(readFileSync127(regPath, "utf-8"));
687117
687156
  const entries = Array.isArray(reg?.dirs) ? reg.dirs : [];
687118
687157
  for (const entry of entries) {
687119
687158
  const dir = typeof entry === "string" ? entry : entry?.dir;
@@ -688625,7 +688664,7 @@ function aimsDir() {
688625
688664
  function readAimsFile(name10, fallback) {
688626
688665
  try {
688627
688666
  const p2 = join168(aimsDir(), name10);
688628
- if (existsSync157(p2)) return JSON.parse(readFileSync128(p2, "utf-8"));
688667
+ if (existsSync157(p2)) return JSON.parse(readFileSync127(p2, "utf-8"));
688629
688668
  } catch {
688630
688669
  }
688631
688670
  return fallback;
@@ -689002,7 +689041,7 @@ async function handleAimsSuppliers(ctx3) {
689002
689041
  for (const p2 of sponsorPaths) {
689003
689042
  if (!existsSync157(p2)) continue;
689004
689043
  try {
689005
- const raw = JSON.parse(readFileSync128(p2, "utf-8"));
689044
+ const raw = JSON.parse(readFileSync127(p2, "utf-8"));
689006
689045
  const list = Array.isArray(raw) ? raw : raw?.sponsors ?? [];
689007
689046
  for (const s2 of list) {
689008
689047
  suppliers.push({
@@ -700289,7 +700328,7 @@ var init_auth_oidc = __esm({
700289
700328
  });
700290
700329
 
700291
700330
  // packages/cli/src/api/usage-tracker.ts
700292
- import { mkdirSync as mkdirSync99, readFileSync as readFileSync129, writeFileSync as writeFileSync84, existsSync as existsSync158 } from "node:fs";
700331
+ import { mkdirSync as mkdirSync99, readFileSync as readFileSync128, writeFileSync as writeFileSync84, existsSync as existsSync158 } from "node:fs";
700293
700332
  import { join as join169 } from "node:path";
700294
700333
  function initUsageTracker(omniusDir) {
700295
700334
  const dir = join169(omniusDir, "usage");
@@ -700297,7 +700336,7 @@ function initUsageTracker(omniusDir) {
700297
700336
  usageFile = join169(dir, "token-usage.json");
700298
700337
  try {
700299
700338
  if (existsSync158(usageFile)) {
700300
- store = JSON.parse(readFileSync129(usageFile, "utf-8"));
700339
+ store = JSON.parse(readFileSync128(usageFile, "utf-8"));
700301
700340
  }
700302
700341
  } catch {
700303
700342
  store = { providers: {}, lastSaved: "" };
@@ -700996,7 +701035,7 @@ import {
700996
701035
  createReadStream as createReadStream2,
700997
701036
  mkdirSync as mkdirSync101,
700998
701037
  writeFileSync as writeFileSync86,
700999
- readFileSync as readFileSync130,
701038
+ readFileSync as readFileSync129,
701000
701039
  readdirSync as readdirSync56,
701001
701040
  existsSync as existsSync160,
701002
701041
  watch as fsWatch4,
@@ -701028,7 +701067,7 @@ function getVersion3() {
701028
701067
  for (const pkgPath of candidates) {
701029
701068
  try {
701030
701069
  if (!existsSync160(pkgPath)) continue;
701031
- const pkg = JSON.parse(readFileSync130(pkgPath, "utf8"));
701070
+ const pkg = JSON.parse(readFileSync129(pkgPath, "utf8"));
701032
701071
  if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
701033
701072
  return pkg.version ?? "0.0.0";
701034
701073
  }
@@ -701444,7 +701483,7 @@ function isOriginAllowed(origin) {
701444
701483
  try {
701445
701484
  const accessFile = join172(homedir59(), ".omnius", "access");
701446
701485
  if (existsSync160(accessFile)) {
701447
- const persisted = readFileSync130(accessFile, "utf8").trim().toLowerCase();
701486
+ const persisted = readFileSync129(accessFile, "utf8").trim().toLowerCase();
701448
701487
  if (persisted === "any" || persisted === "lan" || persisted === "loopback") {
701449
701488
  accessMode = persisted;
701450
701489
  }
@@ -702296,7 +702335,7 @@ function loadJob(id) {
702296
702335
  const file = join172(jobsDir(), `${id}.json`);
702297
702336
  if (!existsSync160(file)) return null;
702298
702337
  try {
702299
- return JSON.parse(readFileSync130(file, "utf-8"));
702338
+ return JSON.parse(readFileSync129(file, "utf-8"));
702300
702339
  } catch {
702301
702340
  return null;
702302
702341
  }
@@ -702309,7 +702348,7 @@ function listJobs2() {
702309
702348
  for (const file of files) {
702310
702349
  try {
702311
702350
  jobs.push(
702312
- JSON.parse(readFileSync130(join172(dir, file), "utf-8"))
702351
+ JSON.parse(readFileSync129(join172(dir, file), "utf-8"))
702313
702352
  );
702314
702353
  } catch {
702315
702354
  }
@@ -702327,7 +702366,7 @@ function pruneOldJobs() {
702327
702366
  if (!file.endsWith(".json")) continue;
702328
702367
  const path12 = join172(dir, file);
702329
702368
  try {
702330
- const job = JSON.parse(readFileSync130(path12, "utf-8"));
702369
+ const job = JSON.parse(readFileSync129(path12, "utf-8"));
702331
702370
  if (job.status === "running") {
702332
702371
  kept++;
702333
702372
  continue;
@@ -704481,7 +704520,7 @@ function readUpdateState() {
704481
704520
  try {
704482
704521
  const p2 = updateStateFile();
704483
704522
  if (!existsSync160(p2)) return null;
704484
- return JSON.parse(readFileSync130(p2, "utf-8"));
704523
+ return JSON.parse(readFileSync129(p2, "utf-8"));
704485
704524
  } catch {
704486
704525
  return null;
704487
704526
  }
@@ -704786,7 +704825,7 @@ function handleV1UpdateStatus(res) {
704786
704825
  let exitCode = null;
704787
704826
  try {
704788
704827
  if (existsSync160(logPath3)) {
704789
- const raw = readFileSync130(logPath3, "utf-8");
704828
+ const raw = readFileSync129(logPath3, "utf-8");
704790
704829
  const m2 = raw.match(/__EXIT_CODE=(\d+)/);
704791
704830
  if (m2) exitCode = parseInt(m2[1], 10);
704792
704831
  logTail = raw.slice(-2e3);
@@ -709266,7 +709305,7 @@ function listScheduledTasks() {
709266
709305
  if (dir.endsWith(`${join172(".omnius", "scheduled")}`) || dir.includes(`${join172(".omnius", "scheduled")}`)) {
709267
709306
  const file = join172(dir, "tasks.json");
709268
709307
  try {
709269
- const raw = readFileSync130(file, "utf-8");
709308
+ const raw = readFileSync129(file, "utf-8");
709270
709309
  const json = JSON.parse(raw);
709271
709310
  const tasks = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
709272
709311
  tasks.forEach((t2, i2) => {
@@ -709364,7 +709403,7 @@ function setScheduledEnabled(id, enabled2) {
709364
709403
  const target = tasks.find((t2) => t2.id === id);
709365
709404
  if (!target) return false;
709366
709405
  try {
709367
- const raw = readFileSync130(target.file, "utf-8");
709406
+ const raw = readFileSync129(target.file, "utf-8");
709368
709407
  const json = JSON.parse(raw);
709369
709408
  const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
709370
709409
  if (!arr[target.index]) return false;
@@ -709397,7 +709436,7 @@ function deleteScheduledById(id) {
709397
709436
  const target = tasks.find((t2) => t2.id === id);
709398
709437
  if (!target) return false;
709399
709438
  try {
709400
- const raw = readFileSync130(target.file, "utf-8");
709439
+ const raw = readFileSync129(target.file, "utf-8");
709401
709440
  const json = JSON.parse(raw);
709402
709441
  const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
709403
709442
  if (!arr[target.index]) return false;
@@ -709622,7 +709661,7 @@ function reconcileScheduledTasks(apply) {
709622
709661
  try {
709623
709662
  let json = { tasks: [] };
709624
709663
  try {
709625
- const raw = readFileSync130(file, "utf-8");
709664
+ const raw = readFileSync129(file, "utf-8");
709626
709665
  json = JSON.parse(raw);
709627
709666
  } catch {
709628
709667
  }
@@ -710001,7 +710040,7 @@ function startApiServer(options2 = {}) {
710001
710040
  const sid = f2.replace(/\.json$/, "");
710002
710041
  try {
710003
710042
  const items = JSON.parse(
710004
- readFileSync130(join172(dir, f2), "utf-8")
710043
+ readFileSync129(join172(dir, f2), "utf-8")
710005
710044
  );
710006
710045
  if (Array.isArray(items)) {
710007
710046
  cache8.set(sid, new Map(items.map((t2) => [t2.id, t2])));
@@ -710035,7 +710074,7 @@ function startApiServer(options2 = {}) {
710035
710074
  }
710036
710075
  return;
710037
710076
  }
710038
- next = JSON.parse(readFileSync130(fp, "utf-8"));
710077
+ next = JSON.parse(readFileSync129(fp, "utf-8"));
710039
710078
  if (!Array.isArray(next)) return;
710040
710079
  } catch {
710041
710080
  return;
@@ -710098,7 +710137,7 @@ function startApiServer(options2 = {}) {
710098
710137
  if (!f2.endsWith(".json")) continue;
710099
710138
  try {
710100
710139
  const jobPath = join172(jobsDir3, f2);
710101
- const job = JSON.parse(readFileSync130(jobPath, "utf-8"));
710140
+ const job = JSON.parse(readFileSync129(jobPath, "utf-8"));
710102
710141
  const jobTime = new Date(
710103
710142
  job.startedAt ?? job.completedAt ?? 0
710104
710143
  ).getTime();
@@ -710120,8 +710159,8 @@ function startApiServer(options2 = {}) {
710120
710159
  if (useTls) {
710121
710160
  try {
710122
710161
  tlsOpts = {
710123
- cert: readFileSync130(resolve66(tlsCert)),
710124
- key: readFileSync130(resolve66(tlsKey))
710162
+ cert: readFileSync129(resolve66(tlsCert)),
710163
+ key: readFileSync129(resolve66(tlsKey))
710125
710164
  };
710126
710165
  } catch (e2) {
710127
710166
  log22(`
@@ -710134,7 +710173,7 @@ function startApiServer(options2 = {}) {
710134
710173
  try {
710135
710174
  const accessFile = join172(homedir59(), ".omnius", "access");
710136
710175
  if (existsSync160(accessFile)) {
710137
- const persisted = readFileSync130(accessFile, "utf8").trim();
710176
+ const persisted = readFileSync129(accessFile, "utf8").trim();
710138
710177
  const resolved = resolveAccessMode(persisted, host);
710139
710178
  if (resolved) runtimeAccessMode = resolved;
710140
710179
  }
@@ -710565,7 +710604,7 @@ function startApiServer(options2 = {}) {
710565
710604
  for (const rel of ["../package.json", "../../package.json", "../../../package.json", "../../../../package.json"]) {
710566
710605
  const p2 = join172(here, rel);
710567
710606
  if (existsSync160(p2)) {
710568
- const pkg = JSON.parse(readFileSync130(p2, "utf8"));
710607
+ const pkg = JSON.parse(readFileSync129(p2, "utf8"));
710569
710608
  if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
710570
710609
  return pkg.version ?? null;
710571
710610
  }
@@ -711513,7 +711552,7 @@ __export(clipboard_media_exports, {
711513
711552
  pasteClipboardImageToFile: () => pasteClipboardImageToFile
711514
711553
  });
711515
711554
  import { execFileSync as execFileSync11, execSync as execSync61 } from "node:child_process";
711516
- import { mkdirSync as mkdirSync102, readFileSync as readFileSync131, rmSync as rmSync13, writeFileSync as writeFileSync87 } from "node:fs";
711555
+ import { mkdirSync as mkdirSync102, readFileSync as readFileSync130, rmSync as rmSync13, writeFileSync as writeFileSync87 } from "node:fs";
711517
711556
  import { join as join173 } from "node:path";
711518
711557
  function pasteClipboardImageToFile(repoRoot) {
711519
711558
  const image = readClipboardImage();
@@ -711530,7 +711569,7 @@ function readClipboardImage() {
711530
711569
  execSync61("command -v pngpaste", { stdio: "ignore", timeout: 1e3 });
711531
711570
  const tmp = `/tmp/omnius-clipboard-${Date.now()}.png`;
711532
711571
  execFileSync11("pngpaste", [tmp], { timeout: 3e3 });
711533
- const buffer2 = readFileSync131(tmp);
711572
+ const buffer2 = readFileSync130(tmp);
711534
711573
  try {
711535
711574
  rmSync13(tmp);
711536
711575
  } catch {
@@ -711589,7 +711628,7 @@ import { resolve as resolve67, join as join174, dirname as dirname52, extname as
711589
711628
  import { createRequire as createRequire9 } from "node:module";
711590
711629
  import { fileURLToPath as fileURLToPath21 } from "node:url";
711591
711630
  import {
711592
- readFileSync as readFileSync132,
711631
+ readFileSync as readFileSync131,
711593
711632
  writeFileSync as writeFileSync88,
711594
711633
  appendFileSync as appendFileSync17,
711595
711634
  rmSync as rmSync14,
@@ -711598,6 +711637,11 @@ import {
711598
711637
  mkdirSync as mkdirSync103
711599
711638
  } from "node:fs";
711600
711639
  import { existsSync as existsSync161 } from "node:fs";
711640
+ import {
711641
+ readFile as readFileAsync2,
711642
+ writeFile as writeFileAsync2,
711643
+ mkdir as mkdirAsync
711644
+ } from "node:fs/promises";
711601
711645
  import { execSync as execSync62 } from "node:child_process";
711602
711646
  import { homedir as homedir60 } from "node:os";
711603
711647
  function formatTimeAgo2(date) {
@@ -711765,13 +711809,14 @@ ${incompleteList}${more}
711765
711809
  const scripts = pkg.scripts || {};
711766
711810
  const checkScript = scripts["typecheck"] ? "typecheck" : scripts["build"] ? "build" : null;
711767
711811
  if (checkScript) {
711768
- const { execSync: execSync63 } = await import("node:child_process");
711812
+ const { exec: exec6 } = await import("node:child_process");
711813
+ const { promisify: promisify8 } = await import("node:util");
711769
711814
  try {
711770
- execSync63(`npm run ${checkScript} --silent 2>&1`, {
711815
+ await promisify8(exec6)(`npm run ${checkScript} --silent 2>&1`, {
711771
711816
  cwd: cwd4,
711772
- stdio: "pipe",
711773
711817
  timeout: 12e4,
711774
- encoding: "utf-8"
711818
+ encoding: "utf-8",
711819
+ maxBuffer: 10 * 1024 * 1024
711775
711820
  });
711776
711821
  } catch (e2) {
711777
711822
  const out = ((e2?.stdout || "") + (e2?.stderr || "")).toString().slice(0, 2e3);
@@ -712979,7 +713024,7 @@ function gatherMemorySnippets(root) {
712979
713024
  if (!existsSync161(dir)) continue;
712980
713025
  try {
712981
713026
  for (const f2 of readdirSync57(dir).filter((f3) => f3.endsWith(".json"))) {
712982
- const data = JSON.parse(readFileSync132(join174(dir, f2), "utf-8"));
713027
+ const data = JSON.parse(readFileSync131(join174(dir, f2), "utf-8"));
712983
713028
  for (const val of Object.values(data)) {
712984
713029
  const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
712985
713030
  if (v.length > 10) snippets.push(v);
@@ -713415,7 +713460,7 @@ ${metabolismMemories}
713415
713460
  try {
713416
713461
  const archeFile = join174(repoRoot, ".omnius", "arche", "variants.json");
713417
713462
  if (existsSync161(archeFile)) {
713418
- const variants = JSON.parse(readFileSync132(archeFile, "utf8"));
713463
+ const variants = JSON.parse(readFileSync131(archeFile, "utf8"));
713419
713464
  if (variants.length > 0) {
713420
713465
  let filtered = variants;
713421
713466
  if (taskType) {
@@ -713530,8 +713575,8 @@ RULES:
713530
713575
  const localCheckResp = (() => {
713531
713576
  try {
713532
713577
  return __require("node:child_process").execSync(
713533
- "curl -s http://localhost:11434/api/tags 2>/dev/null",
713534
- { encoding: "utf8", timeout: 3e3 }
713578
+ "curl -s --max-time 1 http://localhost:11434/api/tags 2>/dev/null",
713579
+ { encoding: "utf8", timeout: 1500 }
713535
713580
  );
713536
713581
  } catch {
713537
713582
  return "";
@@ -713672,7 +713717,7 @@ RULES:
713672
713717
  "self-state.json"
713673
713718
  );
713674
713719
  if (existsSync161(ikStateFile)) {
713675
- const selfState = JSON.parse(readFileSync132(ikStateFile, "utf8"));
713720
+ const selfState = JSON.parse(readFileSync131(ikStateFile, "utf8"));
713676
713721
  const lines = [
713677
713722
  `[Identity State v${selfState.version}]`,
713678
713723
  `Self: ${selfState.narrative_summary}`,
@@ -714010,7 +714055,7 @@ Review its full output via sub_agent(action='output', id='${id}')`
714010
714055
  }
714011
714056
  }
714012
714057
  try {
714013
- const { readdirSync: readdirSync59, readFileSync: readFileSync134, existsSync: existsSync164 } = await import("node:fs");
714058
+ const { readdirSync: readdirSync59, readFileSync: readFileSync133, existsSync: existsSync164 } = await import("node:fs");
714014
714059
  const { join: pathJoin } = await import("node:path");
714015
714060
  const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
714016
714061
  if (existsSync164(chunksDir)) {
@@ -714020,7 +714065,7 @@ Review its full output via sub_agent(action='output', id='${id}')`
714020
714065
  for (const f2 of files) {
714021
714066
  try {
714022
714067
  const data = JSON.parse(
714023
- readFileSync134(pathJoin(chunksDir, f2), "utf-8")
714068
+ readFileSync133(pathJoin(chunksDir, f2), "utf-8")
714024
714069
  );
714025
714070
  if (data._deleted) continue;
714026
714071
  if ((data.functionalSummary || "").toLowerCase().includes(q) || (data.detailSummary || "").toLowerCase().includes(q) || (data.keyFiles || []).some(
@@ -714086,7 +714131,7 @@ ${lines.join("\n")}`
714086
714131
  const expand2 = args.expand === true;
714087
714132
  if (expand2 && id.startsWith("todo-ctx-")) {
714088
714133
  try {
714089
- const { readFileSync: readFileSync134, existsSync: existsSync164 } = await import("node:fs");
714134
+ const { readFileSync: readFileSync133, existsSync: existsSync164 } = await import("node:fs");
714090
714135
  const { join: pathJoin } = await import("node:path");
714091
714136
  const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
714092
714137
  const todoIdSuffix = id.replace("todo-ctx-", "");
@@ -715102,136 +715147,139 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
715102
715147
  runSelfImprovementCycle(repoRoot).catch(() => {
715103
715148
  });
715104
715149
  }
715105
- try {
715106
- const ikDir = join174(repoRoot, ".omnius", "identity");
715107
- const ikFile = join174(ikDir, "self-state.json");
715108
- let ikState;
715109
- if (existsSync161(ikFile)) {
715110
- ikState = JSON.parse(readFileSync132(ikFile, "utf8"));
715111
- } else {
715112
- mkdirSync103(ikDir, { recursive: true });
715113
- const machineId = Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
715114
- ikState = {
715115
- self_id: `omnius-${machineId}`,
715116
- version: 1,
715117
- 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.",
715118
- active_commitments: [
715119
- "assist the user effectively",
715120
- "maintain code quality"
715121
- ],
715122
- active_goals: [],
715123
- open_contradictions: [],
715124
- values_stack: [
715125
- "correctness",
715126
- "efficiency",
715127
- "transparency",
715128
- "user-alignment"
715129
- ],
715130
- interaction_style: {
715131
- tone: "collaborative",
715132
- depth_default: "balanced",
715133
- speech_style: "concise"
715134
- },
715135
- relationship_models: [],
715136
- homeostasis: {
715137
- uncertainty: 0.1,
715138
- coherence: 1,
715139
- goal_tension: 0,
715140
- memory_trust: 0.9,
715141
- boundary_breach: 0,
715142
- latency_stress: 0
715143
- },
715144
- created_at: (/* @__PURE__ */ new Date()).toISOString(),
715145
- updated_at: (/* @__PURE__ */ new Date()).toISOString(),
715146
- session_count: 0,
715147
- version_history: [
715148
- {
715149
- version: 1,
715150
- change: "Initial identity creation",
715151
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
715152
- }
715153
- ]
715154
- };
715155
- }
715156
- if (!ikState.stats)
715157
- ikState.stats = {
715158
- queries_served: 0,
715159
- self_play_cycles: 0,
715160
- learnings_published: 0,
715161
- learnings_ingested: 0,
715162
- reviews_given: 0,
715163
- reviews_received: 0,
715164
- avg_latency_ms: 0,
715165
- tool_use_count: 0
715166
- };
715167
- if (!ikState.specializations) ikState.specializations = [];
715168
- if (!ikState.completed_goals) ikState.completed_goals = [];
715169
- if (!ikState.version_history) ikState.version_history = [];
715170
- ikState.stats.queries_served++;
715171
- const event = `Task completed: ${result.summary.slice(0, 200)}`;
715172
- if (/success|pass|complete|done|fixed/i.test(event)) {
715173
- ikState.homeostasis.uncertainty = Math.max(
715174
- 0,
715175
- ikState.homeostasis.uncertainty - 0.01
715176
- );
715177
- ikState.homeostasis.coherence = Math.min(
715178
- 1,
715179
- ikState.homeostasis.coherence + 5e-3
715180
- );
715181
- }
715182
- if (result.durationMs) {
715183
- const n2 = ikState.stats.queries_served;
715184
- ikState.stats.avg_latency_ms = n2 > 1 ? Math.round(
715185
- ((ikState.stats.avg_latency_ms || 0) * (n2 - 1) + result.durationMs) / n2
715186
- ) : result.durationMs;
715187
- ikState.homeostasis.latency_stress = result.durationMs > 3e4 ? Math.min(
715188
- 1,
715189
- (ikState.homeostasis.latency_stress || 0) + 0.02
715190
- ) : Math.max(
715191
- 0,
715192
- (ikState.homeostasis.latency_stress || 0) - 0.01
715193
- );
715194
- }
715195
- if (result.toolCalls > 0) {
715196
- const toolEvidence = result.summary || "";
715197
- if (/web_search|web_fetch|searched|search.*web|fetched.*http|url/i.test(
715198
- toolEvidence
715199
- ) && !ikState.specializations.includes("web-research")) {
715200
- ikState.specializations.push("web-research");
715201
- }
715202
- if (/shell|grep_search|glob_find|executed.*command/i.test(
715203
- toolEvidence
715204
- ) && !ikState.specializations.includes("code-execution")) {
715205
- ikState.specializations.push("code-execution");
715206
- }
715207
- if (/file_write|file_edit|wrote.*file|edited.*file/i.test(
715208
- toolEvidence
715209
- ) && !ikState.specializations.includes("file-operations")) {
715210
- ikState.specializations.push("file-operations");
715211
- }
715212
- ikState.stats.tool_use_count = (ikState.stats.tool_use_count || 0) + result.toolCalls;
715213
- }
715214
- ikState.version = (ikState.version || 1) + 1;
715215
- ikState.version_history.push({
715216
- version: ikState.version,
715217
- change: "query_served: " + cleanForStorage(result.summary).slice(0, 60),
715218
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
715219
- });
715220
- if (ikState.version_history.length > 200)
715221
- ikState.version_history = ikState.version_history.slice(-200);
715222
- if (ikState.version % 10 === 0) {
715223
- const specList = (ikState.specializations || []).join(", ") || "general-purpose";
715224
- 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)}.`;
715225
- }
715226
- ikState.session_count = (ikState.session_count || 0) + 1;
715227
- ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
715228
- writeFileSync88(ikFile, JSON.stringify(ikState, null, 2));
715229
- } catch (ikErr) {
715150
+ void (async () => {
715230
715151
  try {
715231
- console.error("[IK-OBSERVE]", ikErr);
715232
- } catch {
715152
+ const ikDir = join174(repoRoot, ".omnius", "identity");
715153
+ const ikFile = join174(ikDir, "self-state.json");
715154
+ let ikState;
715155
+ if (existsSync161(ikFile)) {
715156
+ ikState = JSON.parse(await readFileAsync2(ikFile, "utf8"));
715157
+ } else {
715158
+ await mkdirAsync(ikDir, { recursive: true });
715159
+ const machineId = Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
715160
+ ikState = {
715161
+ self_id: `omnius-${machineId}`,
715162
+ version: 1,
715163
+ 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.",
715164
+ active_commitments: [
715165
+ "assist the user effectively",
715166
+ "maintain code quality"
715167
+ ],
715168
+ active_goals: [],
715169
+ open_contradictions: [],
715170
+ values_stack: [
715171
+ "correctness",
715172
+ "efficiency",
715173
+ "transparency",
715174
+ "user-alignment"
715175
+ ],
715176
+ interaction_style: {
715177
+ tone: "collaborative",
715178
+ depth_default: "balanced",
715179
+ speech_style: "concise"
715180
+ },
715181
+ relationship_models: [],
715182
+ homeostasis: {
715183
+ uncertainty: 0.1,
715184
+ coherence: 1,
715185
+ goal_tension: 0,
715186
+ memory_trust: 0.9,
715187
+ boundary_breach: 0,
715188
+ latency_stress: 0
715189
+ },
715190
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
715191
+ updated_at: (/* @__PURE__ */ new Date()).toISOString(),
715192
+ session_count: 0,
715193
+ version_history: [
715194
+ {
715195
+ version: 1,
715196
+ change: "Initial identity creation",
715197
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
715198
+ }
715199
+ ]
715200
+ };
715201
+ }
715202
+ if (!ikState.stats)
715203
+ ikState.stats = {
715204
+ queries_served: 0,
715205
+ self_play_cycles: 0,
715206
+ learnings_published: 0,
715207
+ learnings_ingested: 0,
715208
+ reviews_given: 0,
715209
+ reviews_received: 0,
715210
+ avg_latency_ms: 0,
715211
+ tool_use_count: 0
715212
+ };
715213
+ if (!ikState.specializations) ikState.specializations = [];
715214
+ if (!ikState.completed_goals) ikState.completed_goals = [];
715215
+ if (!ikState.version_history) ikState.version_history = [];
715216
+ ikState.stats.queries_served++;
715217
+ const event = `Task completed: ${result.summary.slice(0, 200)}`;
715218
+ if (/success|pass|complete|done|fixed/i.test(event)) {
715219
+ ikState.homeostasis.uncertainty = Math.max(
715220
+ 0,
715221
+ ikState.homeostasis.uncertainty - 0.01
715222
+ );
715223
+ ikState.homeostasis.coherence = Math.min(
715224
+ 1,
715225
+ ikState.homeostasis.coherence + 5e-3
715226
+ );
715227
+ }
715228
+ if (result.durationMs) {
715229
+ const n2 = ikState.stats.queries_served;
715230
+ ikState.stats.avg_latency_ms = n2 > 1 ? Math.round(
715231
+ ((ikState.stats.avg_latency_ms || 0) * (n2 - 1) + result.durationMs) / n2
715232
+ ) : result.durationMs;
715233
+ ikState.homeostasis.latency_stress = result.durationMs > 3e4 ? Math.min(
715234
+ 1,
715235
+ (ikState.homeostasis.latency_stress || 0) + 0.02
715236
+ ) : Math.max(
715237
+ 0,
715238
+ (ikState.homeostasis.latency_stress || 0) - 0.01
715239
+ );
715240
+ }
715241
+ if (result.toolCalls > 0) {
715242
+ const toolEvidence = result.summary || "";
715243
+ if (/web_search|web_fetch|searched|search.*web|fetched.*http|url/i.test(
715244
+ toolEvidence
715245
+ ) && !ikState.specializations.includes("web-research")) {
715246
+ ikState.specializations.push("web-research");
715247
+ }
715248
+ if (/shell|grep_search|glob_find|executed.*command/i.test(
715249
+ toolEvidence
715250
+ ) && !ikState.specializations.includes("code-execution")) {
715251
+ ikState.specializations.push("code-execution");
715252
+ }
715253
+ if (/file_write|file_edit|wrote.*file|edited.*file/i.test(
715254
+ toolEvidence
715255
+ ) && !ikState.specializations.includes("file-operations")) {
715256
+ ikState.specializations.push("file-operations");
715257
+ }
715258
+ ikState.stats.tool_use_count = (ikState.stats.tool_use_count || 0) + result.toolCalls;
715259
+ }
715260
+ ikState.version = (ikState.version || 1) + 1;
715261
+ ikState.version_history.push({
715262
+ version: ikState.version,
715263
+ change: "query_served: " + cleanForStorage(result.summary).slice(0, 60),
715264
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
715265
+ });
715266
+ if (ikState.version_history.length > 200)
715267
+ ikState.version_history = ikState.version_history.slice(-200);
715268
+ if (ikState.version % 10 === 0) {
715269
+ const specList = (ikState.specializations || []).join(", ") || "general-purpose";
715270
+ 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)}.`;
715271
+ }
715272
+ ikState.session_count = (ikState.session_count || 0) + 1;
715273
+ ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
715274
+ await writeFileAsync2(ikFile, JSON.stringify(ikState, null, 2));
715275
+ } catch (ikErr) {
715276
+ try {
715277
+ console.error("[IK-OBSERVE]", ikErr);
715278
+ } catch {
715279
+ }
715233
715280
  }
715234
- }
715281
+ })().catch(() => {
715282
+ });
715235
715283
  if (voice?.enabled && result.summary) {
715236
715284
  const alreadySpoken = voice._spokenStreamText;
715237
715285
  voice._spokenStreamText = false;
@@ -715256,40 +715304,43 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
715256
715304
  result.durationMs,
715257
715305
  tokens
715258
715306
  );
715259
- try {
715260
- const ikFile = join174(
715261
- repoRoot,
715262
- ".omnius",
715263
- "identity",
715264
- "self-state.json"
715265
- );
715266
- if (existsSync161(ikFile)) {
715267
- const ikState = JSON.parse(readFileSync132(ikFile, "utf8"));
715268
- if (!ikState.stats) ikState.stats = { queries_served: 0 };
715269
- ikState.stats.queries_served = (ikState.stats.queries_served || 0) + 1;
715270
- ikState.homeostasis.uncertainty = Math.min(
715271
- 1,
715272
- ikState.homeostasis.uncertainty + 0.03
715273
- );
715274
- ikState.homeostasis.coherence = Math.max(
715275
- 0,
715276
- ikState.homeostasis.coherence - 0.02
715307
+ void (async () => {
715308
+ try {
715309
+ const ikFile = join174(
715310
+ repoRoot,
715311
+ ".omnius",
715312
+ "identity",
715313
+ "self-state.json"
715277
715314
  );
715278
- ikState.version = (ikState.version || 1) + 1;
715279
- if (!ikState.version_history) ikState.version_history = [];
715280
- ikState.version_history.push({
715281
- version: ikState.version,
715282
- change: "query_failed: task incomplete",
715283
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
715284
- });
715285
- if (ikState.version_history.length > 200)
715286
- ikState.version_history = ikState.version_history.slice(-200);
715287
- ikState.session_count = (ikState.session_count || 0) + 1;
715288
- ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
715289
- writeFileSync88(ikFile, JSON.stringify(ikState, null, 2));
715315
+ if (existsSync161(ikFile)) {
715316
+ const ikState = JSON.parse(await readFileAsync2(ikFile, "utf8"));
715317
+ if (!ikState.stats) ikState.stats = { queries_served: 0 };
715318
+ ikState.stats.queries_served = (ikState.stats.queries_served || 0) + 1;
715319
+ ikState.homeostasis.uncertainty = Math.min(
715320
+ 1,
715321
+ ikState.homeostasis.uncertainty + 0.03
715322
+ );
715323
+ ikState.homeostasis.coherence = Math.max(
715324
+ 0,
715325
+ ikState.homeostasis.coherence - 0.02
715326
+ );
715327
+ ikState.version = (ikState.version || 1) + 1;
715328
+ if (!ikState.version_history) ikState.version_history = [];
715329
+ ikState.version_history.push({
715330
+ version: ikState.version,
715331
+ change: "query_failed: task incomplete",
715332
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
715333
+ });
715334
+ if (ikState.version_history.length > 200)
715335
+ ikState.version_history = ikState.version_history.slice(-200);
715336
+ ikState.session_count = (ikState.session_count || 0) + 1;
715337
+ ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
715338
+ await writeFileAsync2(ikFile, JSON.stringify(ikState, null, 2));
715339
+ }
715340
+ } catch {
715290
715341
  }
715291
- } catch {
715292
- }
715342
+ })().catch(() => {
715343
+ });
715293
715344
  if (voice?.enabled) {
715294
715345
  const emoFinal2 = emotionEngine?.getState();
715295
715346
  const emoCtxFinal2 = emoFinal2 ? {
@@ -715589,7 +715640,7 @@ async function startInteractive(config, repoPath2) {
715589
715640
  const omniusDir = join174(repoRoot, ".omnius");
715590
715641
  const nexusPidFile = join174(omniusDir, "nexus", "daemon.pid");
715591
715642
  if (existsSync161(nexusPidFile)) {
715592
- const pid = parseInt(readFileSync132(nexusPidFile, "utf8").trim(), 10);
715643
+ const pid = parseInt(readFileSync131(nexusPidFile, "utf8").trim(), 10);
715593
715644
  if (pid > 0) {
715594
715645
  try {
715595
715646
  process.kill(pid, 0);
@@ -716738,7 +716789,7 @@ This is an independent background session started from /background.`
716738
716789
  try {
716739
716790
  const titleFile = join174(repoRoot, ".omnius", "session-title");
716740
716791
  if (existsSync161(titleFile))
716741
- sessionTitle = readFileSync132(titleFile, "utf8").trim() || null;
716792
+ sessionTitle = readFileSync131(titleFile, "utf8").trim() || null;
716742
716793
  } catch {
716743
716794
  }
716744
716795
  let carouselRetired = isResumed;
@@ -716853,7 +716904,7 @@ This is an independent background session started from /background.`
716853
716904
  let savedHistory = [];
716854
716905
  try {
716855
716906
  if (existsSync161(HISTORY_FILE)) {
716856
- const raw = readFileSync132(HISTORY_FILE, "utf8").trim();
716907
+ const raw = readFileSync131(HISTORY_FILE, "utf8").trim();
716857
716908
  if (raw) savedHistory = raw.split("\n").reverse();
716858
716909
  }
716859
716910
  } catch {
@@ -717008,7 +717059,7 @@ This is an independent background session started from /background.`
717008
717059
  mkdirSync103(HISTORY_DIR, { recursive: true });
717009
717060
  appendFileSync17(HISTORY_FILE, line + "\n", "utf8");
717010
717061
  if (Math.random() < 0.02) {
717011
- const all2 = readFileSync132(HISTORY_FILE, "utf8").trim().split("\n");
717062
+ const all2 = readFileSync131(HISTORY_FILE, "utf8").trim().split("\n");
717012
717063
  if (all2.length > MAX_HISTORY_LINES) {
717013
717064
  writeFileSync88(
717014
717065
  HISTORY_FILE,
@@ -717237,7 +717288,7 @@ This is an independent background session started from /background.`
717237
717288
  const nexusPidFile = join174(autoNexus.getNexusDir(), "daemon.pid");
717238
717289
  if (existsSync161(nexusPidFile)) {
717239
717290
  const nPid = parseInt(
717240
- readFileSync132(nexusPidFile, "utf8").trim(),
717291
+ readFileSync131(nexusPidFile, "utf8").trim(),
717241
717292
  10
717242
717293
  );
717243
717294
  if (nPid > 0 && !registry2.daemons.has("Nexus")) {
@@ -717419,7 +717470,7 @@ Log: ${nexusLogPath}`
717419
717470
  let agName = "";
717420
717471
  try {
717421
717472
  if (existsSync161(globalNamePath))
717422
- agName = readFileSync132(globalNamePath, "utf8").trim();
717473
+ agName = readFileSync131(globalNamePath, "utf8").trim();
717423
717474
  } catch {
717424
717475
  }
717425
717476
  if (!agName) {
@@ -717460,7 +717511,7 @@ Log: ${nexusLogPath}`
717460
717511
  try {
717461
717512
  if (existsSync161(savedSponsorsPath)) {
717462
717513
  savedSponsors = JSON.parse(
717463
- readFileSync132(savedSponsorsPath, "utf8")
717514
+ readFileSync131(savedSponsorsPath, "utf8")
717464
717515
  );
717465
717516
  const oneHourAgo = Date.now() - 36e5;
717466
717517
  savedSponsors = savedSponsors.filter(
@@ -719600,7 +719651,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
719600
719651
  try {
719601
719652
  const nexusPidFile = join174(nexusTool.getNexusDir(), "daemon.pid");
719602
719653
  if (existsSync161(nexusPidFile)) {
719603
- const pid = parseInt(readFileSync132(nexusPidFile, "utf8").trim(), 10);
719654
+ const pid = parseInt(readFileSync131(nexusPidFile, "utf8").trim(), 10);
719604
719655
  if (pid > 0) {
719605
719656
  registry2.register({
719606
719657
  name: "Nexus",
@@ -719813,7 +719864,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
719813
719864
  const nexusDir = join174(repoRoot, OMNIUS_DIR, "nexus");
719814
719865
  const pidFile = join174(nexusDir, "daemon.pid");
719815
719866
  if (existsSync161(pidFile)) {
719816
- const pid = parseInt(readFileSync132(pidFile, "utf8").trim(), 10);
719867
+ const pid = parseInt(readFileSync131(pidFile, "utf8").trim(), 10);
719817
719868
  if (pid > 0) {
719818
719869
  try {
719819
719870
  if (process.platform === "win32") {
@@ -719846,7 +719897,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
719846
719897
  const pidPath = join174(voiceDir3, pf);
719847
719898
  if (existsSync161(pidPath)) {
719848
719899
  try {
719849
- const pid = parseInt(readFileSync132(pidPath, "utf8").trim(), 10);
719900
+ const pid = parseInt(readFileSync131(pidPath, "utf8").trim(), 10);
719850
719901
  if (pid > 0) {
719851
719902
  if (process.platform === "win32") {
719852
719903
  try {
@@ -720003,8 +720054,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
720003
720054
  "daemon.port"
720004
720055
  );
720005
720056
  if (existsSync161(ppPidFile)) {
720006
- const ppPid = parseInt(readFileSync132(ppPidFile, "utf8").trim(), 10);
720007
- const ppPort = existsSync161(ppPortFile) ? parseInt(readFileSync132(ppPortFile, "utf8").trim(), 10) : void 0;
720057
+ const ppPid = parseInt(readFileSync131(ppPidFile, "utf8").trim(), 10);
720058
+ const ppPort = existsSync161(ppPortFile) ? parseInt(readFileSync131(ppPortFile, "utf8").trim(), 10) : void 0;
720008
720059
  if (ppPid > 0 && !registry2.daemons.has("PersonaPlex")) {
720009
720060
  registry2.register({
720010
720061
  name: "PersonaPlex",
@@ -720021,7 +720072,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
720021
720072
  "daemon.pid"
720022
720073
  );
720023
720074
  if (existsSync161(nexusPidFile)) {
720024
- const nPid = parseInt(readFileSync132(nexusPidFile, "utf8").trim(), 10);
720075
+ const nPid = parseInt(readFileSync131(nexusPidFile, "utf8").trim(), 10);
720025
720076
  if (nPid > 0 && !registry2.daemons.has("Nexus")) {
720026
720077
  try {
720027
720078
  process.kill(nPid, 0);
@@ -720462,7 +720513,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
720462
720513
  if (isImage) {
720463
720514
  try {
720464
720515
  const imgPath = resolve67(repoRoot, cleanPath);
720465
- const imgBuffer = readFileSync132(imgPath);
720516
+ const imgBuffer = readFileSync131(imgPath);
720466
720517
  const base642 = imgBuffer.toString("base64");
720467
720518
  const ext = extname22(cleanPath).toLowerCase();
720468
720519
  const mime = ext === ".png" ? "image/png" : ext === ".gif" ? "image/gif" : ext === ".webp" ? "image/webp" : "image/jpeg";
@@ -720695,7 +720746,7 @@ Read it with image_read or vision if more detail is needed. Describe what you se
720695
720746
  if (isMarkdown && fullInput === input) {
720696
720747
  try {
720697
720748
  const mdPath = resolve67(repoRoot, cleanPath);
720698
- const mdContent = readFileSync132(mdPath, "utf8");
720749
+ const mdContent = readFileSync131(mdPath, "utf8");
720699
720750
  const { parseMcpMarkdown: parseMcpMarkdown2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports2));
720700
720751
  const result = parseMcpMarkdown2(mdContent);
720701
720752
  if (result.servers.length > 0) {
@@ -721336,7 +721387,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
721336
721387
  const ikFile = join174(ikDir, "self-state.json");
721337
721388
  let ikState;
721338
721389
  if (existsSync161(ikFile)) {
721339
- ikState = JSON.parse(readFileSync132(ikFile, "utf8"));
721390
+ ikState = JSON.parse(readFileSync131(ikFile, "utf8"));
721340
721391
  } else {
721341
721392
  mkdirSync103(ikDir, { recursive: true });
721342
721393
  ikState = {
@@ -721409,7 +721460,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
721409
721460
  let variants = [];
721410
721461
  try {
721411
721462
  if (existsSync161(archeFile))
721412
- variants = JSON.parse(readFileSync132(archeFile, "utf8"));
721463
+ variants = JSON.parse(readFileSync131(archeFile, "utf8"));
721413
721464
  } catch {
721414
721465
  }
721415
721466
  variants.push({
@@ -721437,7 +721488,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
721437
721488
  "store.json"
721438
721489
  );
721439
721490
  if (existsSync161(metaFile2)) {
721440
- const store2 = JSON.parse(readFileSync132(metaFile2, "utf8"));
721491
+ const store2 = JSON.parse(readFileSync131(metaFile2, "utf8"));
721441
721492
  const surfaced = store2.filter(
721442
721493
  (m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
721443
721494
  ).sort(
@@ -721540,7 +721591,7 @@ Rules:
721540
721591
  let store2 = [];
721541
721592
  try {
721542
721593
  if (existsSync161(storeFile))
721543
- store2 = JSON.parse(readFileSync132(storeFile, "utf8"));
721594
+ store2 = JSON.parse(readFileSync131(storeFile, "utf8"));
721544
721595
  } catch {
721545
721596
  }
721546
721597
  store2.push({
@@ -721574,7 +721625,7 @@ Rules:
721574
721625
  let cohereActive = false;
721575
721626
  try {
721576
721627
  if (existsSync161(cohereSettingsFile)) {
721577
- const settings = JSON.parse(readFileSync132(cohereSettingsFile, "utf8"));
721628
+ const settings = JSON.parse(readFileSync131(cohereSettingsFile, "utf8"));
721578
721629
  cohereActive = settings.cohere === true;
721579
721630
  }
721580
721631
  } catch {
@@ -721588,7 +721639,7 @@ Rules:
721588
721639
  "store.json"
721589
721640
  );
721590
721641
  if (existsSync161(metaFile2)) {
721591
- const store2 = JSON.parse(readFileSync132(metaFile2, "utf8"));
721642
+ const store2 = JSON.parse(readFileSync131(metaFile2, "utf8"));
721592
721643
  const latest = store2.filter(
721593
721644
  (m2) => m2.sourceTrace === "trajectory-extraction" || m2.sourceTrace === "llm-trajectory-extraction"
721594
721645
  ).slice(-1)[0];
@@ -721617,7 +721668,7 @@ Rules:
721617
721668
  try {
721618
721669
  const ikFile = join174(repoRoot, ".omnius", "identity", "self-state.json");
721619
721670
  if (existsSync161(ikFile)) {
721620
- const ikState = JSON.parse(readFileSync132(ikFile, "utf8"));
721671
+ const ikState = JSON.parse(readFileSync131(ikFile, "utf8"));
721621
721672
  ikState.homeostasis.uncertainty = Math.min(
721622
721673
  1,
721623
721674
  ikState.homeostasis.uncertainty + 0.1
@@ -721638,7 +721689,7 @@ Rules:
721638
721689
  "store.json"
721639
721690
  );
721640
721691
  if (existsSync161(metaFile2)) {
721641
- const store2 = JSON.parse(readFileSync132(metaFile2, "utf8"));
721692
+ const store2 = JSON.parse(readFileSync131(metaFile2, "utf8"));
721642
721693
  const surfaced = store2.filter(
721643
721694
  (m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
721644
721695
  ).sort(
@@ -721664,7 +721715,7 @@ Rules:
721664
721715
  let variants = [];
721665
721716
  try {
721666
721717
  if (existsSync161(archeFile))
721667
- variants = JSON.parse(readFileSync132(archeFile, "utf8"));
721718
+ variants = JSON.parse(readFileSync131(archeFile, "utf8"));
721668
721719
  } catch {
721669
721720
  }
721670
721721
  variants.push({
@@ -721793,7 +721844,7 @@ import { spawn as spawn34 } from "node:child_process";
721793
721844
  import {
721794
721845
  mkdirSync as mkdirSync104,
721795
721846
  writeFileSync as writeFileSync89,
721796
- readFileSync as readFileSync133,
721847
+ readFileSync as readFileSync132,
721797
721848
  readdirSync as readdirSync58,
721798
721849
  existsSync as existsSync162
721799
721850
  } from "node:fs";
@@ -721970,7 +722021,7 @@ function statusCommand(jobId, repoPath2) {
721970
722021
  console.log(`Available jobs: omnius jobs`);
721971
722022
  process.exit(1);
721972
722023
  }
721973
- const job = JSON.parse(readFileSync133(file, "utf-8"));
722024
+ const job = JSON.parse(readFileSync132(file, "utf-8"));
721974
722025
  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`;
721975
722026
  const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
721976
722027
  console.log(`${icon} ${job.id} [${job.status}] ${runtime}`);
@@ -721992,7 +722043,7 @@ function jobsCommand(repoPath2) {
721992
722043
  console.log("Jobs:");
721993
722044
  for (const file of files) {
721994
722045
  try {
721995
- const job = JSON.parse(readFileSync133(join175(dir, file), "utf-8"));
722046
+ const job = JSON.parse(readFileSync132(join175(dir, file), "utf-8"));
721996
722047
  const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
721997
722048
  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`;
721998
722049
  const cleanListTask = cleanForStorage(job.task) || job.task;