omnius 1.0.413 → 1.0.415

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
@@ -41700,28 +41700,26 @@ var init_transcribe_tool = __esm({
41700
41700
  }
41701
41701
  if (effectiveModel !== askedModel)
41702
41702
  model = effectiveModel;
41703
- const failures = [];
41704
- let managedPython = "";
41705
- try {
41706
- managedPython = await this.ensureManagedWhisperRuntime();
41707
- process.env.TRANSCRIBE_PYTHON = managedPython;
41708
- await ensureTranscribeCliPythonModule(managedPython);
41709
- } catch (err) {
41710
- failures.push(`managed ASR runtime bootstrap: ${err instanceof Error ? err.message : String(err)}`);
41711
- }
41712
41703
  if (backend === "managed-whisper") {
41713
41704
  const managed2 = await this.execViaManagedWhisper(filePath, model, start2);
41714
41705
  if (managed2.success)
41715
41706
  return managed2;
41716
- if (managed2.error)
41717
- failures.push(managed2.error);
41718
41707
  return {
41719
41708
  success: false,
41720
41709
  output: "",
41721
- error: `Managed Whisper ASR failed. ${failures.join(" | ").slice(0, 1200)}`,
41710
+ error: `Managed Whisper ASR failed. ${String(managed2.error || managed2.output || "unknown error").slice(0, 1200)}`,
41722
41711
  durationMs: performance.now() - start2
41723
41712
  };
41724
41713
  }
41714
+ const failures = [];
41715
+ let managedPython = "";
41716
+ try {
41717
+ managedPython = await this.ensureManagedWhisperRuntime();
41718
+ process.env.TRANSCRIBE_PYTHON = managedPython;
41719
+ await ensureTranscribeCliPythonModule(managedPython);
41720
+ } catch (err) {
41721
+ failures.push(`managed ASR runtime bootstrap: ${err instanceof Error ? err.message : String(err)}`);
41722
+ }
41725
41723
  const tc = await loadTranscribeCli() ?? await ensureManagedTranscribeCliRuntime();
41726
41724
  if (tc && backend !== "managed-whisper") {
41727
41725
  try {
@@ -146130,7 +146128,7 @@ var require_client_h1 = __commonJS({
146130
146128
  kHTTPContext,
146131
146129
  kClosed
146132
146130
  } = require_symbols();
146133
- var constants3 = require_constants2();
146131
+ var constants2 = require_constants2();
146134
146132
  var EMPTY_BUF = Buffer.alloc(0);
146135
146133
  var FastBuffer = Buffer[Symbol.species];
146136
146134
  var removeAllListeners = util2.removeAllListeners;
@@ -146256,7 +146254,7 @@ var require_client_h1 = __commonJS({
146256
146254
  */
146257
146255
  constructor(client, socket, { exports: exports2 }) {
146258
146256
  this.llhttp = exports2;
146259
- this.ptr = this.llhttp.llhttp_alloc(constants3.TYPE.RESPONSE);
146257
+ this.ptr = this.llhttp.llhttp_alloc(constants2.TYPE.RESPONSE);
146260
146258
  this.client = client;
146261
146259
  this.socket = socket;
146262
146260
  this.timeout = null;
@@ -146351,11 +146349,11 @@ var require_client_h1 = __commonJS({
146351
146349
  currentParser = null;
146352
146350
  currentBufferRef = null;
146353
146351
  }
146354
- if (ret !== constants3.ERROR.OK) {
146352
+ if (ret !== constants2.ERROR.OK) {
146355
146353
  const data = chunk.subarray(llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr);
146356
- if (ret === constants3.ERROR.PAUSED_UPGRADE) {
146354
+ if (ret === constants2.ERROR.PAUSED_UPGRADE) {
146357
146355
  this.onUpgrade(data);
146358
- } else if (ret === constants3.ERROR.PAUSED) {
146356
+ } else if (ret === constants2.ERROR.PAUSED) {
146359
146357
  this.paused = true;
146360
146358
  socket.unshift(data);
146361
146359
  } else {
@@ -146365,7 +146363,7 @@ var require_client_h1 = __commonJS({
146365
146363
  const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0);
146366
146364
  message2 = "Response does not match the HTTP/1.1 protocol (" + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + ")";
146367
146365
  }
146368
- throw new HTTPParserError(message2, constants3.ERROR[ret], data);
146366
+ throw new HTTPParserError(message2, constants2.ERROR[ret], data);
146369
146367
  }
146370
146368
  }
146371
146369
  } catch (err) {
@@ -146572,7 +146570,7 @@ var require_client_h1 = __commonJS({
146572
146570
  socket[kBlocking] = false;
146573
146571
  client[kResume]();
146574
146572
  }
146575
- return pause ? constants3.ERROR.PAUSED : 0;
146573
+ return pause ? constants2.ERROR.PAUSED : 0;
146576
146574
  }
146577
146575
  /**
146578
146576
  * @param {Buffer} buf
@@ -146598,7 +146596,7 @@ var require_client_h1 = __commonJS({
146598
146596
  }
146599
146597
  this.bytesRead += buf.length;
146600
146598
  if (request.onData(buf) === false) {
146601
- return constants3.ERROR.PAUSED;
146599
+ return constants2.ERROR.PAUSED;
146602
146600
  }
146603
146601
  return 0;
146604
146602
  }
@@ -146637,13 +146635,13 @@ var require_client_h1 = __commonJS({
146637
146635
  if (socket[kWriting]) {
146638
146636
  assert(client[kRunning] === 0);
146639
146637
  util2.destroy(socket, new InformationalError("reset"));
146640
- return constants3.ERROR.PAUSED;
146638
+ return constants2.ERROR.PAUSED;
146641
146639
  } else if (!shouldKeepAlive) {
146642
146640
  util2.destroy(socket, new InformationalError("reset"));
146643
- return constants3.ERROR.PAUSED;
146641
+ return constants2.ERROR.PAUSED;
146644
146642
  } else if (socket[kReset] && client[kRunning] === 0) {
146645
146643
  util2.destroy(socket, new InformationalError("reset"));
146646
- return constants3.ERROR.PAUSED;
146644
+ return constants2.ERROR.PAUSED;
146647
146645
  } else if (client[kPipelining] == null || client[kPipelining] === 1) {
146648
146646
  setImmediate(client[kResume]);
146649
146647
  } else {
@@ -269505,7 +269503,7 @@ var require_scan = __commonJS({
269505
269503
  var require_parse3 = __commonJS({
269506
269504
  "../node_modules/picomatch/lib/parse.js"(exports, module) {
269507
269505
  "use strict";
269508
- var constants3 = require_constants8();
269506
+ var constants2 = require_constants8();
269509
269507
  var utils = require_utils4();
269510
269508
  var {
269511
269509
  MAX_LENGTH,
@@ -269513,7 +269511,7 @@ var require_parse3 = __commonJS({
269513
269511
  REGEX_NON_SPECIAL_CHARS,
269514
269512
  REGEX_SPECIAL_CHARS_BACKREF,
269515
269513
  REPLACEMENTS
269516
- } = constants3;
269514
+ } = constants2;
269517
269515
  var expandRange = (args, options2) => {
269518
269516
  if (typeof options2.expandRange === "function") {
269519
269517
  return options2.expandRange(...args, options2);
@@ -269719,7 +269717,7 @@ var require_parse3 = __commonJS({
269719
269717
  if (options2.maxExtglobRecursion === false) {
269720
269718
  return { risky: false };
269721
269719
  }
269722
- const max = typeof options2.maxExtglobRecursion === "number" ? options2.maxExtglobRecursion : constants3.DEFAULT_MAX_EXTGLOB_RECURSION;
269720
+ const max = typeof options2.maxExtglobRecursion === "number" ? options2.maxExtglobRecursion : constants2.DEFAULT_MAX_EXTGLOB_RECURSION;
269723
269721
  const branches = splitTopLevel(body).map((branch) => branch.trim());
269724
269722
  if (branches.length > 1) {
269725
269723
  if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
@@ -269752,8 +269750,8 @@ var require_parse3 = __commonJS({
269752
269750
  const tokens = [bos];
269753
269751
  const capture = opts.capture ? "" : "?:";
269754
269752
  const win32 = utils.isWindows(options2);
269755
- const PLATFORM_CHARS = constants3.globChars(win32);
269756
- const EXTGLOB_CHARS = constants3.extglobChars(PLATFORM_CHARS);
269753
+ const PLATFORM_CHARS = constants2.globChars(win32);
269754
+ const EXTGLOB_CHARS = constants2.extglobChars(PLATFORM_CHARS);
269757
269755
  const {
269758
269756
  DOT_LITERAL,
269759
269757
  PLUS_LITERAL,
@@ -270452,7 +270450,7 @@ var require_parse3 = __commonJS({
270452
270450
  NO_DOTS_SLASH,
270453
270451
  STAR,
270454
270452
  START_ANCHOR
270455
- } = constants3.globChars(win32);
270453
+ } = constants2.globChars(win32);
270456
270454
  const nodot = opts.dot ? NO_DOTS : NO_DOT;
270457
270455
  const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
270458
270456
  const capture = opts.capture ? "" : "?:";
@@ -270511,7 +270509,7 @@ var require_picomatch = __commonJS({
270511
270509
  var scan = require_scan();
270512
270510
  var parse3 = require_parse3();
270513
270511
  var utils = require_utils4();
270514
- var constants3 = require_constants8();
270512
+ var constants2 = require_constants8();
270515
270513
  var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
270516
270514
  var picomatch = (glob3, options2, returnState = false) => {
270517
270515
  if (Array.isArray(glob3)) {
@@ -270639,7 +270637,7 @@ var require_picomatch = __commonJS({
270639
270637
  return /$^/;
270640
270638
  }
270641
270639
  };
270642
- picomatch.constants = constants3;
270640
+ picomatch.constants = constants2;
270643
270641
  module.exports = picomatch;
270644
270642
  }
270645
270643
  });
@@ -274829,11 +274827,11 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
274829
274827
  * what was previously computed. */
274830
274828
  async loadSessionInfo() {
274831
274829
  try {
274832
- const { readFileSync: readFileSync137, existsSync: existsSync169 } = await import("node:fs");
274830
+ const { readFileSync: readFileSync138, existsSync: existsSync169 } = await import("node:fs");
274833
274831
  const sessionPath2 = join44(this.cwd, ".omnius", "rlm", "session.json");
274834
274832
  if (!existsSync169(sessionPath2))
274835
274833
  return null;
274836
- return JSON.parse(readFileSync137(sessionPath2, "utf8"));
274834
+ return JSON.parse(readFileSync138(sessionPath2, "utf8"));
274837
274835
  } catch {
274838
274836
  return null;
274839
274837
  }
@@ -275020,10 +275018,10 @@ var init_memory_metabolism = __esm({
275020
275018
  const trajDir = join45(this.cwd, ".omnius", "rlm-trajectories");
275021
275019
  let lessons = [];
275022
275020
  try {
275023
- const { readdirSync: readdirSync61, readFileSync: readFileSync137 } = await import("node:fs");
275021
+ const { readdirSync: readdirSync61, readFileSync: readFileSync138 } = await import("node:fs");
275024
275022
  const files = readdirSync61(trajDir).filter((f2) => f2.endsWith(".jsonl")).sort().reverse().slice(0, 3);
275025
275023
  for (const file of files) {
275026
- const lines = readFileSync137(join45(trajDir, file), "utf8").split("\n").filter((l2) => l2.trim());
275024
+ const lines = readFileSync138(join45(trajDir, file), "utf8").split("\n").filter((l2) => l2.trim());
275027
275025
  for (const line of lines) {
275028
275026
  try {
275029
275027
  const entry = JSON.parse(line);
@@ -275407,14 +275405,14 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
275407
275405
  * Optionally filter by task type for phase-aware context (FSM paper insight).
275408
275406
  */
275409
275407
  getTopMemoriesSync(k = 5, taskType) {
275410
- const { readFileSync: readFileSync137, existsSync: existsSync169 } = __require("node:fs");
275408
+ const { readFileSync: readFileSync138, existsSync: existsSync169 } = __require("node:fs");
275411
275409
  const metaDir = join45(this.cwd, ".omnius", "memory", "metabolism");
275412
275410
  const storeFile = join45(metaDir, "store.json");
275413
275411
  if (!existsSync169(storeFile))
275414
275412
  return "";
275415
275413
  let store2 = [];
275416
275414
  try {
275417
- store2 = JSON.parse(readFileSync137(storeFile, "utf8"));
275415
+ store2 = JSON.parse(readFileSync138(storeFile, "utf8"));
275418
275416
  } catch {
275419
275417
  return "";
275420
275418
  }
@@ -275436,14 +275434,14 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
275436
275434
  /** Update memory scores based on task outcome. Called after task completion.
275437
275435
  * Memories used in successful tasks get boosted. Memories present during failures get decayed. */
275438
275436
  updateFromOutcomeSync(surfacedMemoryText, succeeded) {
275439
- const { readFileSync: readFileSync137, writeFileSync: writeFileSync95, existsSync: existsSync169, mkdirSync: mkdirSync111 } = __require("node:fs");
275437
+ const { readFileSync: readFileSync138, writeFileSync: writeFileSync95, existsSync: existsSync169, mkdirSync: mkdirSync111 } = __require("node:fs");
275440
275438
  const metaDir = join45(this.cwd, ".omnius", "memory", "metabolism");
275441
275439
  const storeFile = join45(metaDir, "store.json");
275442
275440
  if (!existsSync169(storeFile))
275443
275441
  return;
275444
275442
  let store2 = [];
275445
275443
  try {
275446
- store2 = JSON.parse(readFileSync137(storeFile, "utf8"));
275444
+ store2 = JSON.parse(readFileSync138(storeFile, "utf8"));
275447
275445
  } catch {
275448
275446
  return;
275449
275447
  }
@@ -275890,13 +275888,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
275890
275888
  // Per EvoSkill (arXiv:2603.02766): retrieve relevant strategies from archive.
275891
275889
  /** Retrieve top-K strategies for context injection. Returns "" if none. */
275892
275890
  getRelevantStrategiesSync(k = 3, taskType) {
275893
- const { readFileSync: readFileSync137, existsSync: existsSync169 } = __require("node:fs");
275891
+ const { readFileSync: readFileSync138, existsSync: existsSync169 } = __require("node:fs");
275894
275892
  const archiveFile = join47(this.cwd, ".omnius", "arche", "variants.json");
275895
275893
  if (!existsSync169(archiveFile))
275896
275894
  return "";
275897
275895
  let variants = [];
275898
275896
  try {
275899
- variants = JSON.parse(readFileSync137(archiveFile, "utf8"));
275897
+ variants = JSON.parse(readFileSync138(archiveFile, "utf8"));
275900
275898
  } catch {
275901
275899
  return "";
275902
275900
  }
@@ -275914,13 +275912,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
275914
275912
  }
275915
275913
  /** Archive a strategy variant synchronously (for task completion path) */
275916
275914
  archiveVariantSync(strategy, outcome, tags = []) {
275917
- const { readFileSync: readFileSync137, writeFileSync: writeFileSync95, existsSync: existsSync169, mkdirSync: mkdirSync111 } = __require("node:fs");
275915
+ const { readFileSync: readFileSync138, writeFileSync: writeFileSync95, existsSync: existsSync169, mkdirSync: mkdirSync111 } = __require("node:fs");
275918
275916
  const dir = join47(this.cwd, ".omnius", "arche");
275919
275917
  const archiveFile = join47(dir, "variants.json");
275920
275918
  let variants = [];
275921
275919
  try {
275922
275920
  if (existsSync169(archiveFile))
275923
- variants = JSON.parse(readFileSync137(archiveFile, "utf8"));
275921
+ variants = JSON.parse(readFileSync138(archiveFile, "utf8"));
275924
275922
  } catch {
275925
275923
  }
275926
275924
  variants.push({
@@ -514517,7 +514515,7 @@ var require_scan2 = __commonJS({
514517
514515
  var require_parse4 = __commonJS({
514518
514516
  "node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js"(exports, module) {
514519
514517
  "use strict";
514520
- var constants3 = require_constants10();
514518
+ var constants2 = require_constants10();
514521
514519
  var utils = require_utils7();
514522
514520
  var {
514523
514521
  MAX_LENGTH,
@@ -514525,7 +514523,7 @@ var require_parse4 = __commonJS({
514525
514523
  REGEX_NON_SPECIAL_CHARS,
514526
514524
  REGEX_SPECIAL_CHARS_BACKREF,
514527
514525
  REPLACEMENTS
514528
- } = constants3;
514526
+ } = constants2;
514529
514527
  var expandRange = (args, options2) => {
514530
514528
  if (typeof options2.expandRange === "function") {
514531
514529
  return options2.expandRange(...args, options2);
@@ -514731,7 +514729,7 @@ var require_parse4 = __commonJS({
514731
514729
  if (options2.maxExtglobRecursion === false) {
514732
514730
  return { risky: false };
514733
514731
  }
514734
- const max = typeof options2.maxExtglobRecursion === "number" ? options2.maxExtglobRecursion : constants3.DEFAULT_MAX_EXTGLOB_RECURSION;
514732
+ const max = typeof options2.maxExtglobRecursion === "number" ? options2.maxExtglobRecursion : constants2.DEFAULT_MAX_EXTGLOB_RECURSION;
514735
514733
  const branches = splitTopLevel(body).map((branch) => branch.trim());
514736
514734
  if (branches.length > 1) {
514737
514735
  if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
@@ -514763,8 +514761,8 @@ var require_parse4 = __commonJS({
514763
514761
  const bos = { type: "bos", value: "", output: opts.prepend || "" };
514764
514762
  const tokens = [bos];
514765
514763
  const capture = opts.capture ? "" : "?:";
514766
- const PLATFORM_CHARS = constants3.globChars(opts.windows);
514767
- const EXTGLOB_CHARS = constants3.extglobChars(PLATFORM_CHARS);
514764
+ const PLATFORM_CHARS = constants2.globChars(opts.windows);
514765
+ const EXTGLOB_CHARS = constants2.extglobChars(PLATFORM_CHARS);
514768
514766
  const {
514769
514767
  DOT_LITERAL,
514770
514768
  PLUS_LITERAL,
@@ -515459,7 +515457,7 @@ var require_parse4 = __commonJS({
515459
515457
  NO_DOTS_SLASH,
515460
515458
  STAR,
515461
515459
  START_ANCHOR
515462
- } = constants3.globChars(opts.windows);
515460
+ } = constants2.globChars(opts.windows);
515463
515461
  const nodot = opts.dot ? NO_DOTS : NO_DOT;
515464
515462
  const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
515465
515463
  const capture = opts.capture ? "" : "?:";
@@ -515517,7 +515515,7 @@ var require_picomatch3 = __commonJS({
515517
515515
  var scan = require_scan2();
515518
515516
  var parse3 = require_parse4();
515519
515517
  var utils = require_utils7();
515520
- var constants3 = require_constants10();
515518
+ var constants2 = require_constants10();
515521
515519
  var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
515522
515520
  var picomatch = (glob3, options2, returnState = false) => {
515523
515521
  if (Array.isArray(glob3)) {
@@ -515645,7 +515643,7 @@ var require_picomatch3 = __commonJS({
515645
515643
  return /$^/;
515646
515644
  }
515647
515645
  };
515648
- picomatch.constants = constants3;
515646
+ picomatch.constants = constants2;
515649
515647
  module.exports = picomatch;
515650
515648
  }
515651
515649
  });
@@ -568895,9 +568893,9 @@ var init_reflectionBuffer = __esm({
568895
568893
  this.persistPath = persistPath ?? null;
568896
568894
  if (this.persistPath) {
568897
568895
  try {
568898
- const { readFileSync: readFileSync137, existsSync: existsSync169 } = __require("node:fs");
568896
+ const { readFileSync: readFileSync138, existsSync: existsSync169 } = __require("node:fs");
568899
568897
  if (existsSync169(this.persistPath)) {
568900
- this.state = JSON.parse(readFileSync137(this.persistPath, "utf-8"));
568898
+ this.state = JSON.parse(readFileSync138(this.persistPath, "utf-8"));
568901
568899
  return;
568902
568900
  }
568903
568901
  } catch {
@@ -573147,9 +573145,9 @@ var init_adversaryStream = __esm({
573147
573145
  if (!this.persistPath)
573148
573146
  return;
573149
573147
  try {
573150
- const { readFileSync: readFileSync137, existsSync: existsSync169 } = __require("node:fs");
573148
+ const { readFileSync: readFileSync138, existsSync: existsSync169 } = __require("node:fs");
573151
573149
  if (existsSync169(this.persistPath)) {
573152
- const data = JSON.parse(readFileSync137(this.persistPath, "utf-8"));
573150
+ const data = JSON.parse(readFileSync138(this.persistPath, "utf-8"));
573153
573151
  if (Array.isArray(data?.ledger))
573154
573152
  this.ledger = data.ledger.slice(-100);
573155
573153
  }
@@ -591797,8 +591795,8 @@ ${telegramPersonaHead}` : stripped
591797
591795
  let recoveredTokens = 0;
591798
591796
  for (const [filePath, entry] of entries) {
591799
591797
  try {
591800
- const { readFileSync: readFileSync137 } = await import("node:fs");
591801
- const content = readFileSync137(filePath, "utf8");
591798
+ const { readFileSync: readFileSync138 } = await import("node:fs");
591799
+ const content = readFileSync138(filePath, "utf8");
591802
591800
  const tokenEst = Math.ceil(content.length / 4);
591803
591801
  if (recoveredTokens + tokenEst > fileRecoveryBudget)
591804
591802
  break;
@@ -593772,7 +593770,7 @@ ${result}`
593772
593770
  const buffer2 = Buffer.from(rawBase64, "base64");
593773
593771
  let resizedBase64 = null;
593774
593772
  try {
593775
- const { writeFileSync: writeFileSync95, readFileSync: readFileSync137, unlinkSync: unlinkSync37 } = await import("node:fs");
593773
+ const { writeFileSync: writeFileSync95, readFileSync: readFileSync138, unlinkSync: unlinkSync37 } = await import("node:fs");
593776
593774
  const { join: join186 } = await import("node:path");
593777
593775
  const { tmpdir: tmpdir26 } = await import("node:os");
593778
593776
  const tmpIn = join186(tmpdir26(), `omnius_img_in_${Date.now()}.png`);
@@ -593787,7 +593785,7 @@ ${result}`
593787
593785
  `img.save(${JSON.stringify(tmpOut)}, 'JPEG', quality=75)`
593788
593786
  ].join("; ");
593789
593787
  await execFileText3(pyBin, ["-c", resizeScript], { timeout: 1e4 });
593790
- const resizedBuf = readFileSync137(tmpOut);
593788
+ const resizedBuf = readFileSync138(tmpOut);
593791
593789
  resizedBase64 = `data:image/jpeg;base64,${resizedBuf.toString("base64")}`;
593792
593790
  try {
593793
593791
  unlinkSync37(tmpIn);
@@ -603158,6 +603156,16 @@ function isAudioFailureText(value2) {
603158
603156
  if (!text2) return false;
603159
603157
  return /^(?:ASR|VAD|Transcription)\s+(?:failed|unavailable)|No module named ['"]?transcribe_cli|torchcodec|torchaudio version/i.test(text2);
603160
603158
  }
603159
+ function sanitizeLiveAudioError(value2) {
603160
+ const text2 = String(value2 ?? "").trim();
603161
+ if (!text2) return "";
603162
+ if (/transcribe-cli module:\s*No module named ['"]?transcribe_cli/i.test(text2) || /No module named ['"]?transcribe_cli/i.test(text2)) {
603163
+ const parts = text2.split(/\s*\|\s*/g).map((part) => part.trim()).filter((part) => part && !/transcribe-cli module:\s*No module named ['"]?transcribe_cli/i.test(part) && !/No module named ['"]?transcribe_cli/i.test(part));
603164
+ const preserved = parts.join(" | ").trim();
603165
+ return preserved || "ASR unavailable: managed Whisper runtime is still bootstrapping or failed; transcribe-cli is not required for live ASR.";
603166
+ }
603167
+ return text2;
603168
+ }
603161
603169
  function readPcm16WavActivity(filePath, bins = 36) {
603162
603170
  try {
603163
603171
  const buf = readFileSync88(filePath);
@@ -603272,39 +603280,12 @@ function parseLiveSpeechDecision(value2) {
603272
603280
  };
603273
603281
  }
603274
603282
  function fallbackLiveSpeechDecision(proposal) {
603275
- if (proposal.kind === "unknown_person") {
603276
- return {
603277
- speak: true,
603278
- text: proposal.defaultText,
603279
- confidence: 0.72,
603280
- action: "speak",
603281
- reason: "unknown person visible and identity clarification is useful"
603282
- };
603283
- }
603284
- if (proposal.kind === "audio_intent") {
603285
- return {
603286
- speak: true,
603287
- text: proposal.defaultText,
603288
- confidence: 0.68,
603289
- action: "speak",
603290
- reason: "audio intake classified speech as addressed to Omnius"
603291
- };
603292
- }
603293
- if (proposal.urgency === "high") {
603294
- return {
603295
- speak: true,
603296
- text: proposal.defaultText,
603297
- confidence: 0.6,
603298
- action: "speak",
603299
- reason: "high-urgency live trigger"
603300
- };
603301
- }
603302
603283
  return {
603303
603284
  speak: false,
603304
603285
  text: "",
603305
603286
  confidence: 0.55,
603306
- action: "silent",
603307
- reason: "ambient event did not justify interrupting with speech"
603287
+ action: proposal.urgency === "high" ? "queue_review" : "silent",
603288
+ reason: "live speech arbiter unavailable; refusing canned vocal fallback"
603308
603289
  };
603309
603290
  }
603310
603291
  async function classifyLiveSpeech(proposal, config) {
@@ -603337,7 +603318,7 @@ async function classifyLiveSpeech(proposal, config) {
603337
603318
  `urgency=${proposal.urgency}`,
603338
603319
  `summary=${proposal.summary}`,
603339
603320
  `evidence=${proposal.evidence}`,
603340
- `default_utterance=${proposal.defaultText}`
603321
+ proposal.speechGoal ? `speech_goal=${proposal.speechGoal}` : ""
603341
603322
  ].join("\n").slice(0, 1600)
603342
603323
  }
603343
603324
  ]
@@ -603637,7 +603618,7 @@ function formatLiveDashboardFromSnapshot(snapshot, opts = {}) {
603637
603618
  lines.push(`├${horizontal}┤`);
603638
603619
  const transcriptFailure = isAudioFailureText(snapshot.audio.transcript) ? snapshot.audio.transcript : "";
603639
603620
  const transcript = transcriptFailure ? "" : snapshot.audio.transcript;
603640
- const audioError = [snapshot.audio.error, transcriptFailure].filter(Boolean).join(" | ");
603621
+ const audioError = sanitizeLiveAudioError([snapshot.audio.error, transcriptFailure].filter(Boolean).join(" | "));
603641
603622
  const audioBits = [
603642
603623
  `audio input=${snapshot.audio.input || snapshot.config.selectedAudioInput || "none"}`,
603643
603624
  snapshot.audio.activity ? `activity ${snapshot.audio.activity.waveform} rms=${snapshot.audio.activity.rmsDb.toFixed(1)}dB active=${Math.round(snapshot.audio.activity.activeRatio * 100)}%` : "",
@@ -604020,7 +604001,7 @@ function formatLiveSensorContextFromSnapshot(snapshot, opts = {}) {
604020
604001
  if (snapshot.audio) {
604021
604002
  const transcriptFailure = isAudioFailureText(snapshot.audio.transcript) ? snapshot.audio.transcript : "";
604022
604003
  const transcript = transcriptFailure ? "" : snapshot.audio.transcript;
604023
- const audioError = [snapshot.audio.error, transcriptFailure].filter(Boolean).join(" | ");
604004
+ const audioError = sanitizeLiveAudioError([snapshot.audio.error, transcriptFailure].filter(Boolean).join(" | "));
604024
604005
  const audioEvents = (snapshot.events ?? []).filter((event) => event.kind === "audio_transcript" || event.kind === "audio_sound").sort((a2, b) => b.observedAt - a2.observedAt).slice(0, 8);
604025
604006
  if (audioEvents.length > 0) {
604026
604007
  lines.push("");
@@ -604464,6 +604445,10 @@ var init_live_sensors = __esm({
604464
604445
  setCameraRotation(device, rotation, source, evidence, confidence2) {
604465
604446
  const target = device || this.config.selectedCamera || firstDeviceId(this.devices.video);
604466
604447
  if (!target) return null;
604448
+ const current = this.config.cameraOrientation?.[target];
604449
+ if (source === "auto" && current?.source === "manual") {
604450
+ return current;
604451
+ }
604467
604452
  const orientation = {
604468
604453
  rotation,
604469
604454
  source,
@@ -604929,7 +604914,7 @@ var init_live_sensors = __esm({
604929
604914
  source,
604930
604915
  summary: `${unknownPeople.length} unknown individual(s) observed on live camera ${source}`,
604931
604916
  evidence: unknownPeople.map((entry) => `${entry.cropPath || entry.trackId || entry.source} ${entry.evidence || ""}`).join("; "),
604932
- defaultText: "I see someone here, but I do not know who. Who is there?",
604917
+ speechGoal: "If appropriate, ask the visible unknown person for the name Omnius should associate with the face crop. Do not claim an identity.",
604933
604918
  urgency: "high",
604934
604919
  observedAt: sampledAt
604935
604920
  }, 9e4);
@@ -604946,7 +604931,7 @@ var init_live_sensors = __esm({
604946
604931
  source,
604947
604932
  summary: `Visual trigger hit in live camera stream ${source}`,
604948
604933
  evidence: triggerEvents.map((entry) => entry.summary).join("; "),
604949
- defaultText: "I noticed something important in view. Should I inspect it?",
604934
+ speechGoal: "If immediate clarification is warranted, ask whether Omnius should inspect the visible trigger.",
604950
604935
  urgency: "high",
604951
604936
  observedAt: sampledAt
604952
604937
  }, 45e3);
@@ -605143,7 +605128,7 @@ ${output}`).join("\n\n");
605143
605128
  source: capture.device,
605144
605129
  summary: "Live audio intake classified speech as intended for Omnius",
605145
605130
  evidence: `transcript=${transcript}; confidence=${intake.confidence.toFixed(2)}; reason=${intake.reason}`,
605146
- defaultText: "I heard you. I am checking the live context now.",
605131
+ speechGoal: "Respond naturally to the addressed utterance using live context; keep it brief.",
605147
605132
  urgency: "high",
605148
605133
  observedAt: this.snapshot.audio.updatedAt
605149
605134
  }, 2e4);
@@ -605771,8 +605756,6 @@ __export(listen_exports, {
605771
605756
  });
605772
605757
  import { spawn as spawn29 } from "node:child_process";
605773
605758
  import {
605774
- accessSync as accessSync2,
605775
- constants as constants2,
605776
605759
  existsSync as existsSync111,
605777
605760
  mkdirSync as mkdirSync69,
605778
605761
  writeFileSync as writeFileSync58,
@@ -606015,7 +605998,21 @@ async function ensureVenvForTranscribeCli() {
606015
605998
  const exe = process.platform === "win32" ? "python.exe" : "python3";
606016
605999
  const venvBin = join127(homedir39(), ".omnius", "venv", bin);
606017
606000
  const venvPython2 = join127(venvBin, exe);
606018
- if (!existsSync111(venvPython2)) return false;
606001
+ if (!existsSync111(venvPython2)) {
606002
+ try {
606003
+ const mod3 = await Promise.resolve().then(() => (init_py_embed(), py_embed_exports));
606004
+ if (typeof mod3.ensureEmbedDeps === "function") mod3.ensureEmbedDeps();
606005
+ } catch {
606006
+ }
606007
+ }
606008
+ if (!existsSync111(venvPython2)) {
606009
+ try {
606010
+ mkdirSync69(join127(homedir39(), ".omnius", "venv"), { recursive: true });
606011
+ await execFileText4("python3", ["-m", "venv", join127(homedir39(), ".omnius", "venv")], { timeout: 6e4 });
606012
+ } catch {
606013
+ return false;
606014
+ }
606015
+ }
606019
606016
  process.env.TRANSCRIBE_PYTHON = venvPython2;
606020
606017
  const pathSep2 = process.platform === "win32" ? ";" : ":";
606021
606018
  const currentPath = process.env.PATH || "";
@@ -606024,65 +606021,79 @@ async function ensureVenvForTranscribeCli() {
606024
606021
  }
606025
606022
  try {
606026
606023
  await execFileText4(venvPython2, ["-c", "import numpy"], { timeout: 1e4 });
606024
+ } catch {
606025
+ try {
606026
+ await execFileText4(venvPython2, ["-m", "pip", "install", "-U", "pip", "setuptools", "wheel", "numpy==1.26.4"], { timeout: 3e5 });
606027
+ } catch {
606028
+ return false;
606029
+ }
606030
+ }
606031
+ try {
606032
+ await execFileText4(venvPython2, ["-c", "import transcribe_cli"], { timeout: 1e4 });
606033
+ return true;
606034
+ } catch {
606035
+ }
606036
+ try {
606037
+ await execFileText4(venvPython2, ["-m", "pip", "install", "-U", "transcribe-cli"], { timeout: 3e5 });
606038
+ await execFileText4(venvPython2, ["-c", "import transcribe_cli"], { timeout: 1e4 });
606027
606039
  return true;
606028
606040
  } catch {
606029
606041
  return false;
606030
606042
  }
606031
606043
  }
606032
- function ensureTranscribeCliBackground() {
606033
- if (_bgInstallPromise) return _bgInstallPromise;
606034
- _bgInstallPromise = (async () => {
606035
- try {
606036
- const globalRoot = (await execFileText4("npm", ["root", "-g"], { timeout: 5e3 })).trim();
606037
- if (existsSync111(join127(globalRoot, "transcribe-cli", "dist", "index.js"))) {
606038
- return true;
606039
- }
606040
- } catch {
606041
- }
606044
+ async function requireTranscribeCliFrom2(packageDir) {
606045
+ try {
606046
+ const { createRequire: createRequire11 } = await import("node:module");
606047
+ const req3 = createRequire11(import.meta.url);
606048
+ const distPath = join127(packageDir, "dist", "index.js");
606049
+ if (existsSync111(distPath)) return req3(distPath);
606050
+ return req3(packageDir);
606051
+ } catch {
606052
+ return null;
606053
+ }
606054
+ }
606055
+ async function loadManagedTranscribeCli() {
606056
+ const packageDir = join127(MANAGED_TRANSCRIBE_CLI_DIR2, "node_modules", "transcribe-cli");
606057
+ if (!existsSync111(join127(packageDir, "dist", "index.js"))) return null;
606058
+ return requireTranscribeCliFrom2(packageDir);
606059
+ }
606060
+ async function ensureManagedTranscribeCliNode() {
606061
+ if (await loadManagedTranscribeCli()) return true;
606062
+ if (_managedTranscribeCliInstallPromise) return _managedTranscribeCliInstallPromise;
606063
+ _managedTranscribeCliInstallPromise = (async () => {
606042
606064
  try {
606043
- let needsSudo = false;
606044
- try {
606045
- const prefix = (await execFileText4("npm", ["prefix", "-g"], { timeout: 5e3 })).trim();
606046
- accessSync2(prefix, constants2.W_OK);
606047
- } catch {
606048
- needsSudo = process.platform !== "win32";
606065
+ mkdirSync69(MANAGED_TRANSCRIBE_CLI_DIR2, { recursive: true });
606066
+ if (!existsSync111(join127(MANAGED_TRANSCRIBE_CLI_DIR2, "package.json"))) {
606067
+ writeFileSync58(
606068
+ join127(MANAGED_TRANSCRIBE_CLI_DIR2, "package.json"),
606069
+ JSON.stringify({ private: true, dependencies: {} }, null, 2),
606070
+ "utf8"
606071
+ );
606049
606072
  }
606050
- const terminalElevation = process.env["OMNIUS_ELEVATION_MODE"] === "terminal" && process.stdin.isTTY && process.stdout.isTTY;
606051
- const command = terminalElevation && needsSudo ? "sudo" : "npm";
606052
- const args = terminalElevation && needsSudo ? ["npm", "i", "-g", "transcribe-cli"] : ["i", "-g", "transcribe-cli"];
606053
- return new Promise((resolve76) => {
606054
- const child = spawn29(command, args, {
606055
- stdio: terminalElevation ? "inherit" : "ignore",
606056
- timeout: 18e4
606057
- });
606058
- const timeout2 = setTimeout(() => {
606059
- try {
606060
- child.kill("SIGTERM");
606061
- } catch {
606062
- }
606063
- resolve76(false);
606064
- }, 18e4);
606065
- timeout2.unref?.();
606066
- onChildClose(child, (code8) => {
606067
- clearTimeout(timeout2);
606068
- resolve76(code8 === 0);
606069
- });
606070
- onChildError(child, () => {
606071
- clearTimeout(timeout2);
606072
- resolve76(false);
606073
- });
606073
+ await execFileText4("npm", ["install", "--prefix", MANAGED_TRANSCRIBE_CLI_DIR2, "transcribe-cli@^2.0.1"], {
606074
+ timeout: 18e4
606074
606075
  });
606076
+ return Boolean(await loadManagedTranscribeCli());
606075
606077
  } catch {
606076
606078
  return false;
606077
606079
  }
606078
606080
  })();
606081
+ return _managedTranscribeCliInstallPromise;
606082
+ }
606083
+ function ensureTranscribeCliBackground() {
606084
+ if (_bgInstallPromise) return _bgInstallPromise;
606085
+ _bgInstallPromise = (async () => {
606086
+ const nodeReady = await ensureManagedTranscribeCliNode();
606087
+ const pyReady = await ensureVenvForTranscribeCli();
606088
+ return nodeReady && pyReady;
606089
+ })();
606079
606090
  return _bgInstallPromise;
606080
606091
  }
606081
606092
  async function waitForTranscribeCli() {
606082
606093
  if (_bgInstallPromise) {
606083
606094
  return _bgInstallPromise;
606084
606095
  }
606085
- return false;
606096
+ return Boolean(await loadManagedTranscribeCli()) && await ensureVenvForTranscribeCli();
606086
606097
  }
606087
606098
  function getListenEngine(config) {
606088
606099
  if (!_engine) {
@@ -606090,12 +606101,13 @@ function getListenEngine(config) {
606090
606101
  }
606091
606102
  return _engine;
606092
606103
  }
606093
- var AUDIO_EXTENSIONS, VIDEO_EXTENSIONS2, WhisperFallbackTranscriber, ListenEngine, _bgInstallPromise, _engine;
606104
+ var MANAGED_TRANSCRIBE_CLI_DIR2, AUDIO_EXTENSIONS, VIDEO_EXTENSIONS2, WhisperFallbackTranscriber, ListenEngine, _bgInstallPromise, _managedTranscribeCliInstallPromise, _engine;
606094
606105
  var init_listen = __esm({
606095
606106
  "packages/cli/src/tui/listen.ts"() {
606096
606107
  "use strict";
606097
606108
  init_typed_node_events();
606098
606109
  init_async_process();
606110
+ MANAGED_TRANSCRIBE_CLI_DIR2 = join127(homedir39(), ".omnius", "runtimes", "asr", "transcribe-cli-node");
606099
606111
  AUDIO_EXTENSIONS = /* @__PURE__ */ new Set([
606100
606112
  ".mp3",
606101
606113
  ".wav",
@@ -606287,20 +606299,10 @@ var init_listen = __esm({
606287
606299
  async isAvailable() {
606288
606300
  if (this.transcribeCliAvailable !== null)
606289
606301
  return this.transcribeCliAvailable;
606290
- try {
606291
- const mod3 = await this.loadTranscribeCli();
606292
- this.transcribeCliAvailable = mod3 !== null;
606293
- } catch {
606294
- this.transcribeCliAvailable = false;
606295
- }
606296
- if (!this.transcribeCliAvailable) {
606297
- try {
606298
- await execFileText4("transcribe-cli", ["--version"], { timeout: 5e3 });
606299
- this.transcribeCliAvailable = true;
606300
- } catch {
606301
- this.transcribeCliAvailable = false;
606302
- }
606303
- }
606302
+ const tc = await this.loadTranscribeCli() || (await ensureManagedTranscribeCliNode() ? await this.loadTranscribeCli() : null);
606303
+ const transcribeCliReady = Boolean(tc && await ensureVenvForTranscribeCli());
606304
+ const whisperFallbackReady = Boolean(await findLiveWhisperScript());
606305
+ this.transcribeCliAvailable = transcribeCliReady || whisperFallbackReady;
606304
606306
  return this.transcribeCliAvailable;
606305
606307
  }
606306
606308
  /** Load transcribe-cli — bundled as a dependency of omnius. */
@@ -606311,13 +606313,14 @@ var init_listen = __esm({
606311
606313
  return req3("transcribe-cli");
606312
606314
  } catch {
606313
606315
  }
606316
+ const managed = await loadManagedTranscribeCli();
606317
+ if (managed) return managed;
606314
606318
  try {
606315
606319
  const globalRoot = (await execFileText4("npm", ["root", "-g"], { timeout: 5e3 })).trim();
606316
606320
  const tcPath = join127(globalRoot, "transcribe-cli");
606317
606321
  if (existsSync111(join127(tcPath, "dist", "index.js"))) {
606318
- const { createRequire: createRequire11 } = await import("node:module");
606319
- const req3 = createRequire11(import.meta.url);
606320
- return req3(join127(tcPath, "dist", "index.js"));
606322
+ const loaded = await requireTranscribeCliFrom2(tcPath);
606323
+ if (loaded) return loaded;
606321
606324
  }
606322
606325
  } catch {
606323
606326
  }
@@ -606334,9 +606337,8 @@ var init_listen = __esm({
606334
606337
  "transcribe-cli"
606335
606338
  );
606336
606339
  if (existsSync111(join127(tcPath, "dist", "index.js"))) {
606337
- const { createRequire: createRequire11 } = await import("node:module");
606338
- const req3 = createRequire11(import.meta.url);
606339
- return req3(join127(tcPath, "dist", "index.js"));
606340
+ const loaded = await requireTranscribeCliFrom2(tcPath);
606341
+ if (loaded) return loaded;
606340
606342
  }
606341
606343
  }
606342
606344
  } catch {
@@ -606363,7 +606365,7 @@ var init_listen = __esm({
606363
606365
  }
606364
606366
  if (!tc) {
606365
606367
  try {
606366
- await execFileText4("npm", ["i", "-g", "transcribe-cli"], { timeout: 18e4 });
606368
+ await ensureManagedTranscribeCliNode();
606367
606369
  this.transcribeCliAvailable = null;
606368
606370
  tc = await this.loadTranscribeCli();
606369
606371
  } catch {
@@ -606400,7 +606402,7 @@ var init_listen = __esm({
606400
606402
  }
606401
606403
  if (!tcUpToDate) {
606402
606404
  try {
606403
- await execFileText4("npm", ["i", "-g", "transcribe-cli@latest"], { timeout: 12e4 });
606405
+ await ensureManagedTranscribeCliNode();
606404
606406
  this.transcribeCliAvailable = null;
606405
606407
  const reloaded = await this.loadTranscribeCli();
606406
606408
  if (reloaded?.TranscribeLive) {
@@ -606665,7 +606667,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
606665
606667
  }
606666
606668
  if (!tc) {
606667
606669
  try {
606668
- await execFileText4("npm", ["i", "-g", "transcribe-cli"], { timeout: 18e4 });
606670
+ await ensureManagedTranscribeCliNode();
606669
606671
  this.transcribeCliAvailable = null;
606670
606672
  tc = await this.loadTranscribeCli();
606671
606673
  } catch {
@@ -606724,7 +606726,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
606724
606726
  }
606725
606727
  if (!tc) {
606726
606728
  try {
606727
- await execFileText4("npm", ["i", "-g", "transcribe-cli"], { timeout: 18e4 });
606729
+ await ensureManagedTranscribeCliNode();
606728
606730
  this.transcribeCliAvailable = null;
606729
606731
  tc = await this.loadTranscribeCli();
606730
606732
  } catch {
@@ -606802,6 +606804,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
606802
606804
  }
606803
606805
  };
606804
606806
  _bgInstallPromise = null;
606807
+ _managedTranscribeCliInstallPromise = null;
606805
606808
  _engine = null;
606806
606809
  }
606807
606810
  });
@@ -613070,7 +613073,7 @@ async function fetchOpenAIModels(baseUrl2, apiKey) {
613070
613073
  async function fetchPeerModels(peerId, authKey) {
613071
613074
  try {
613072
613075
  const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports2));
613073
- const { existsSync: existsSync169, readFileSync: readFileSync137 } = await import("node:fs");
613076
+ const { existsSync: existsSync169, readFileSync: readFileSync138 } = await import("node:fs");
613074
613077
  const { join: join186 } = await import("node:path");
613075
613078
  const cwd4 = process.cwd();
613076
613079
  const nexusTool = new NexusTool2(cwd4);
@@ -613079,7 +613082,7 @@ async function fetchPeerModels(peerId, authKey) {
613079
613082
  try {
613080
613083
  const statusPath = join186(nexusDir, "status.json");
613081
613084
  if (existsSync169(statusPath)) {
613082
- const status = JSON.parse(readFileSync137(statusPath, "utf8"));
613085
+ const status = JSON.parse(readFileSync138(statusPath, "utf8"));
613083
613086
  if (status.peerId === peerId) isLocalPeer = true;
613084
613087
  }
613085
613088
  } catch {
@@ -613088,7 +613091,7 @@ async function fetchPeerModels(peerId, authKey) {
613088
613091
  const pricingPath = join186(nexusDir, "pricing.json");
613089
613092
  if (existsSync169(pricingPath)) {
613090
613093
  try {
613091
- const pricing = JSON.parse(readFileSync137(pricingPath, "utf8"));
613094
+ const pricing = JSON.parse(readFileSync138(pricingPath, "utf8"));
613092
613095
  const localModels = (pricing.models || []).map((m2) => ({
613093
613096
  name: m2.model || "unknown",
613094
613097
  size: m2.parameterSize || "",
@@ -613104,7 +613107,7 @@ async function fetchPeerModels(peerId, authKey) {
613104
613107
  const cachePath2 = join186(nexusDir, "peer-models-cache.json");
613105
613108
  if (existsSync169(cachePath2)) {
613106
613109
  try {
613107
- const cache8 = JSON.parse(readFileSync137(cachePath2, "utf8"));
613110
+ const cache8 = JSON.parse(readFileSync138(cachePath2, "utf8"));
613108
613111
  if (cache8.peerId === peerId && cache8.models?.length > 0) {
613109
613112
  const age = Date.now() - new Date(cache8.cachedAt).getTime();
613110
613113
  if (age < 5 * 60 * 1e3) {
@@ -613219,7 +613222,7 @@ async function fetchPeerModels(peerId, authKey) {
613219
613222
  const pricingPath = join186(nexusDir, "pricing.json");
613220
613223
  if (existsSync169(pricingPath)) {
613221
613224
  try {
613222
- const pricing = JSON.parse(readFileSync137(pricingPath, "utf8"));
613225
+ const pricing = JSON.parse(readFileSync138(pricingPath, "utf8"));
613223
613226
  return (pricing.models || []).map((m2) => ({
613224
613227
  name: m2.model || "unknown",
613225
613228
  size: m2.parameterSize || "",
@@ -616757,7 +616760,7 @@ var init_voice_session = __esm({
616757
616760
 
616758
616761
  // packages/cli/src/tui/scoped-personality.ts
616759
616762
  import { createHash as createHash32 } from "node:crypto";
616760
- import { appendFileSync as appendFileSync12, existsSync as existsSync112, mkdirSync as mkdirSync70, readFileSync as readFileSync90, writeFileSync as writeFileSync59 } from "node:fs";
616763
+ import { appendFileSync as appendFileSync12, existsSync as existsSync112, mkdirSync as mkdirSync70, readFileSync as readFileSync91, writeFileSync as writeFileSync59 } from "node:fs";
616761
616764
  import { join as join128, resolve as resolve55 } from "node:path";
616762
616765
  function safeName(input) {
616763
616766
  return input.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 80) || "default";
@@ -616912,7 +616915,7 @@ function loadScopedPersonality(scope) {
616912
616915
  const paths = scopedPersonalityPaths(scope);
616913
616916
  if (!existsSync112(paths.json)) return newDocument(scope);
616914
616917
  try {
616915
- const parsed = JSON.parse(readFileSync90(paths.json, "utf8"));
616918
+ const parsed = JSON.parse(readFileSync91(paths.json, "utf8"));
616916
616919
  if (parsed.version !== PROFILE_VERSION) return newDocument(scope);
616917
616920
  return normalizeDocument(scope, parsed);
616918
616921
  } catch {
@@ -617136,7 +617139,7 @@ var init_scoped_personality = __esm({
617136
617139
 
617137
617140
  // packages/cli/src/tui/voice-soul.ts
617138
617141
  import { createHash as createHash33 } from "node:crypto";
617139
- import { existsSync as existsSync113, readdirSync as readdirSync37, readFileSync as readFileSync91 } from "node:fs";
617142
+ import { existsSync as existsSync113, readdirSync as readdirSync37, readFileSync as readFileSync92 } from "node:fs";
617140
617143
  import { basename as basename24, join as join129, resolve as resolve56 } from "node:path";
617141
617144
  function compactText(text2, limit) {
617142
617145
  const compact4 = text2.replace(/\s+/g, " ").trim();
@@ -617163,7 +617166,7 @@ function loadSoulRuntimeState(input) {
617163
617166
  const path12 = soulRuntimeStatePath(input);
617164
617167
  if (!existsSync113(path12)) return { version: 1 };
617165
617168
  try {
617166
- const parsed = JSON.parse(readFileSync91(path12, "utf8"));
617169
+ const parsed = JSON.parse(readFileSync92(path12, "utf8"));
617167
617170
  if (!parsed || parsed.version !== 1) return { version: 1 };
617168
617171
  return {
617169
617172
  version: 1,
@@ -617281,7 +617284,7 @@ function findProjectSoul(scope) {
617281
617284
  ]) {
617282
617285
  if (!existsSync113(candidate)) continue;
617283
617286
  try {
617284
- return { path: candidate, content: readFileSync91(candidate, "utf8") };
617287
+ return { path: candidate, content: readFileSync92(candidate, "utf8") };
617285
617288
  } catch {
617286
617289
  return null;
617287
617290
  }
@@ -617300,7 +617303,7 @@ function findProjectVoice(scope) {
617300
617303
  const first2 = files[0];
617301
617304
  if (!first2) return null;
617302
617305
  const path12 = join129(voiceDir3, first2);
617303
- return { path: path12, content: readFileSync91(path12, "utf8") };
617306
+ return { path: path12, content: readFileSync92(path12, "utf8") };
617304
617307
  } catch {
617305
617308
  return null;
617306
617309
  }
@@ -617565,7 +617568,7 @@ import { EventEmitter as EventEmitter8 } from "node:events";
617565
617568
  import { randomBytes as randomBytes22, timingSafeEqual } from "node:crypto";
617566
617569
  import { URL as URL2 } from "node:url";
617567
617570
  import { loadavg, cpus as cpus3, totalmem as totalmem6, freemem as freemem4 } from "node:os";
617568
- import { existsSync as existsSync114, readFileSync as readFileSync92, writeFileSync as writeFileSync60, unlinkSync as unlinkSync20, mkdirSync as mkdirSync71, readdirSync as readdirSync38, statSync as statSync43, statfsSync as statfsSync7 } from "node:fs";
617571
+ import { existsSync as existsSync114, readFileSync as readFileSync93, writeFileSync as writeFileSync60, unlinkSync as unlinkSync20, mkdirSync as mkdirSync71, readdirSync as readdirSync38, statSync as statSync43, statfsSync as statfsSync7 } from "node:fs";
617569
617572
  import { join as join130 } from "node:path";
617570
617573
  function cleanForwardHeaders(raw, targetHost) {
617571
617574
  const out = {};
@@ -617736,7 +617739,7 @@ function readSponsorUsageState(stateDir) {
617736
617739
  try {
617737
617740
  const path12 = join130(stateDir, "sponsor", SPONSOR_USAGE_FILE_NAME);
617738
617741
  if (!existsSync114(path12)) return null;
617739
- const parsed = JSON.parse(readFileSync92(path12, "utf8"));
617742
+ const parsed = JSON.parse(readFileSync93(path12, "utf8"));
617740
617743
  const dailyTokensUsed = safeNonNegativeInt(parsed.dailyTokensUsed);
617741
617744
  const dailyTokensResetAt = safeNonNegativeInt(parsed.dailyTokensResetAt);
617742
617745
  if (!dailyTokensResetAt) return null;
@@ -617761,7 +617764,7 @@ function readExposeState(stateDir) {
617761
617764
  try {
617762
617765
  const path12 = join130(stateDir, STATE_FILE_NAME);
617763
617766
  if (!existsSync114(path12)) return null;
617764
- const raw = readFileSync92(path12, "utf8");
617767
+ const raw = readFileSync93(path12, "utf8");
617765
617768
  const data = JSON.parse(raw);
617766
617769
  if (!data.pid || !data.tunnelUrl || !data.authKey || !data.proxyPort) return null;
617767
617770
  return data;
@@ -617899,7 +617902,7 @@ function readP2PExposeState(stateDir) {
617899
617902
  try {
617900
617903
  const path12 = join130(stateDir, P2P_STATE_FILE_NAME);
617901
617904
  if (!existsSync114(path12)) return null;
617902
- const raw = readFileSync92(path12, "utf8");
617905
+ const raw = readFileSync93(path12, "utf8");
617903
617906
  const data = JSON.parse(raw);
617904
617907
  if (!data.peerId || !data.authKey) return null;
617905
617908
  return data;
@@ -619303,7 +619306,7 @@ ${this.formatConnectionInfo()}`);
619303
619306
  const statusPath = join130(nexusDir, "status.json");
619304
619307
  for (let i2 = 0; i2 < 80; i2++) {
619305
619308
  try {
619306
- const raw = readFileSync92(statusPath, "utf8");
619309
+ const raw = readFileSync93(statusPath, "utf8");
619307
619310
  if (raw.length > 10) {
619308
619311
  const status = JSON.parse(raw);
619309
619312
  if (status.connected && status.peerId) {
@@ -619368,7 +619371,7 @@ ${this.formatConnectionInfo()}`);
619368
619371
  removeP2PExposeState(stateDir);
619369
619372
  return null;
619370
619373
  }
619371
- const status = JSON.parse(readFileSync92(statusPath, "utf8"));
619374
+ const status = JSON.parse(readFileSync93(statusPath, "utf8"));
619372
619375
  if (!status.connected || !status.peerId) {
619373
619376
  removeP2PExposeState(stateDir);
619374
619377
  return null;
@@ -619446,7 +619449,7 @@ ${this.formatConnectionInfo()}`);
619446
619449
  let meteringLines = lastMeteringLineCount;
619447
619450
  try {
619448
619451
  if (existsSync114(meteringFile)) {
619449
- const content = readFileSync92(meteringFile, "utf8");
619452
+ const content = readFileSync93(meteringFile, "utf8");
619450
619453
  meteringLines = content.split("\n").filter((l2) => l2.trim()).length;
619451
619454
  }
619452
619455
  } catch {
@@ -619475,7 +619478,7 @@ ${this.formatConnectionInfo()}`);
619475
619478
  try {
619476
619479
  const statusPath = join130(nexusDir, "status.json");
619477
619480
  if (existsSync114(statusPath)) {
619478
- const status = JSON.parse(readFileSync92(statusPath, "utf8"));
619481
+ const status = JSON.parse(readFileSync93(statusPath, "utf8"));
619479
619482
  if (status.peerId && !this._peerId) {
619480
619483
  this._peerId = status.peerId;
619481
619484
  }
@@ -619498,7 +619501,7 @@ ${this.formatConnectionInfo()}`);
619498
619501
  try {
619499
619502
  const meteringFile = join130(nexusDir, "metering.jsonl");
619500
619503
  if (existsSync114(meteringFile)) {
619501
- const content = readFileSync92(meteringFile, "utf8");
619504
+ const content = readFileSync93(meteringFile, "utf8");
619502
619505
  if (content.length > lastMeteringSize) {
619503
619506
  const newContent = content.slice(lastMeteringSize);
619504
619507
  lastMeteringSize = content.length;
@@ -619795,7 +619798,7 @@ var init_types3 = __esm({
619795
619798
 
619796
619799
  // packages/cli/src/tui/p2p/secret-vault.ts
619797
619800
  import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes23, scryptSync as scryptSync2, createHash as createHash34 } from "node:crypto";
619798
- import { readFileSync as readFileSync93, writeFileSync as writeFileSync61, existsSync as existsSync115, mkdirSync as mkdirSync72 } from "node:fs";
619801
+ import { readFileSync as readFileSync94, writeFileSync as writeFileSync61, existsSync as existsSync115, mkdirSync as mkdirSync72 } from "node:fs";
619799
619802
  import { dirname as dirname39 } from "node:path";
619800
619803
  var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
619801
619804
  var init_secret_vault = __esm({
@@ -620013,7 +620016,7 @@ var init_secret_vault = __esm({
620013
620016
  */
620014
620017
  load(passphrase) {
620015
620018
  if (!this.storePath || !existsSync115(this.storePath)) return 0;
620016
- const blob = readFileSync93(this.storePath);
620019
+ const blob = readFileSync94(this.storePath);
620017
620020
  if (blob.length < SALT_LEN + IV_LEN + 16) {
620018
620021
  throw new Error("Vault file is corrupted (too small)");
620019
620022
  }
@@ -621051,7 +621054,7 @@ ${activitySummary}
621051
621054
  });
621052
621055
 
621053
621056
  // packages/cli/src/api/profiles.ts
621054
- import { existsSync as existsSync116, readFileSync as readFileSync94, writeFileSync as writeFileSync62, mkdirSync as mkdirSync73, readdirSync as readdirSync39, unlinkSync as unlinkSync21 } from "node:fs";
621057
+ import { existsSync as existsSync116, readFileSync as readFileSync95, writeFileSync as writeFileSync62, mkdirSync as mkdirSync73, readdirSync as readdirSync39, unlinkSync as unlinkSync21 } from "node:fs";
621055
621058
  import { join as join132 } from "node:path";
621056
621059
  import { homedir as homedir40 } from "node:os";
621057
621060
  import { createCipheriv as createCipheriv4, createDecipheriv as createDecipheriv4, randomBytes as randomBytes25, scryptSync as scryptSync3 } from "node:crypto";
@@ -621071,7 +621074,7 @@ function listProfiles(projectDir2) {
621071
621074
  if (existsSync116(projDir)) {
621072
621075
  for (const f2 of readdirSync39(projDir).filter((f3) => f3.endsWith(".json"))) {
621073
621076
  try {
621074
- const raw = JSON.parse(readFileSync94(join132(projDir, f2), "utf8"));
621077
+ const raw = JSON.parse(readFileSync95(join132(projDir, f2), "utf8"));
621075
621078
  const name10 = f2.replace(".json", "");
621076
621079
  seen.add(name10);
621077
621080
  result.push({
@@ -621090,7 +621093,7 @@ function listProfiles(projectDir2) {
621090
621093
  const name10 = f2.replace(".json", "");
621091
621094
  if (seen.has(name10)) continue;
621092
621095
  try {
621093
- const raw = JSON.parse(readFileSync94(join132(globDir, f2), "utf8"));
621096
+ const raw = JSON.parse(readFileSync95(join132(globDir, f2), "utf8"));
621094
621097
  result.push({
621095
621098
  name: name10,
621096
621099
  description: raw.description || "",
@@ -621126,7 +621129,7 @@ function loadProfileWithMeta(name10, password, projectDir2) {
621126
621129
  ];
621127
621130
  for (const candidate of candidates) {
621128
621131
  if (!existsSync116(candidate.path)) continue;
621129
- const raw = JSON.parse(readFileSync94(candidate.path, "utf8"));
621132
+ const raw = JSON.parse(readFileSync95(candidate.path, "utf8"));
621130
621133
  if (raw.encrypted === true) {
621131
621134
  if (!password) return null;
621132
621135
  const profile = decryptProfile(raw, password);
@@ -621433,7 +621436,7 @@ __export(omnius_directory_exports, {
621433
621436
  writeIndexMeta: () => writeIndexMeta,
621434
621437
  writeTaskHandoff: () => writeTaskHandoff2
621435
621438
  });
621436
- import { appendFileSync as appendFileSync13, cpSync as cpSync2, existsSync as existsSync117, mkdirSync as mkdirSync74, readFileSync as readFileSync95, writeFileSync as writeFileSync63, readdirSync as readdirSync40, statSync as statSync44, unlinkSync as unlinkSync22, openSync as openSync2, closeSync as closeSync2, renameSync as renameSync11, watch as fsWatch2 } from "node:fs";
621439
+ import { appendFileSync as appendFileSync13, cpSync as cpSync2, existsSync as existsSync117, mkdirSync as mkdirSync74, readFileSync as readFileSync96, writeFileSync as writeFileSync63, readdirSync as readdirSync40, statSync as statSync44, unlinkSync as unlinkSync22, openSync as openSync2, closeSync as closeSync2, renameSync as renameSync11, watch as fsWatch2 } from "node:fs";
621437
621440
  import { join as join133, relative as relative13, basename as basename25, dirname as dirname40, resolve as resolve57 } from "node:path";
621438
621441
  import { homedir as homedir41 } from "node:os";
621439
621442
  import { createHash as createHash37 } from "node:crypto";
@@ -621443,7 +621446,7 @@ function isGitRoot(dir) {
621443
621446
  try {
621444
621447
  const stat9 = statSync44(gitPath);
621445
621448
  if (stat9.isFile()) {
621446
- return readFileSync95(gitPath, "utf-8").trim().startsWith("gitdir:");
621449
+ return readFileSync96(gitPath, "utf-8").trim().startsWith("gitdir:");
621447
621450
  }
621448
621451
  if (!stat9.isDirectory()) return false;
621449
621452
  return existsSync117(join133(gitPath, "HEAD")) || existsSync117(join133(gitPath, "config")) || existsSync117(join133(gitPath, "commondir"));
@@ -621502,7 +621505,7 @@ function ensureOmniusIgnored(repoRoot) {
621502
621505
  const gitignoreDir = dirname40(gitignorePath);
621503
621506
  const relDir = relative13(gitignoreDir || ".", repoRoot).replace(/\\/g, "/");
621504
621507
  const ignorePattern = relDir && relDir !== "." ? `${relDir}/.omnius/` : ".omnius/";
621505
- const content = readFileSync95(gitignorePath, "utf-8");
621508
+ const content = readFileSync96(gitignorePath, "utf-8");
621506
621509
  const normalizedTarget = normalizeIgnoreRule(ignorePattern);
621507
621510
  const alreadyIgnored = content.split(/\r?\n/).some((line) => {
621508
621511
  const trimmed = line.trim();
@@ -621625,7 +621628,7 @@ function loadProjectSettings(repoRoot) {
621625
621628
  const settingsPath = join133(repoRoot, OMNIUS_DIR, "settings.json");
621626
621629
  try {
621627
621630
  if (existsSync117(settingsPath)) {
621628
- return JSON.parse(readFileSync95(settingsPath, "utf-8"));
621631
+ return JSON.parse(readFileSync96(settingsPath, "utf-8"));
621629
621632
  }
621630
621633
  } catch {
621631
621634
  }
@@ -621642,7 +621645,7 @@ function loadGlobalSettings() {
621642
621645
  const settingsPath = join133(homedir41(), ".omnius", "settings.json");
621643
621646
  try {
621644
621647
  if (existsSync117(settingsPath)) {
621645
- return JSON.parse(readFileSync95(settingsPath, "utf-8"));
621648
+ return JSON.parse(readFileSync96(settingsPath, "utf-8"));
621646
621649
  }
621647
621650
  } catch {
621648
621651
  }
@@ -621673,7 +621676,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
621673
621676
  if (existsSync117(filePath) && !seen.has(filePath)) {
621674
621677
  seen.add(filePath);
621675
621678
  try {
621676
- let content = readFileSync95(filePath, "utf-8");
621679
+ let content = readFileSync96(filePath, "utf-8");
621677
621680
  if (content.length > maxContentLen) {
621678
621681
  content = content.slice(0, maxContentLen) + "\n\n...(truncated)";
621679
621682
  }
@@ -621706,7 +621709,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
621706
621709
  function readIndexMeta(repoRoot) {
621707
621710
  const metaPath = join133(repoRoot, OMNIUS_DIR, "index", "meta.json");
621708
621711
  try {
621709
- return JSON.parse(readFileSync95(metaPath, "utf-8"));
621712
+ return JSON.parse(readFileSync96(metaPath, "utf-8"));
621710
621713
  } catch {
621711
621714
  return null;
621712
621715
  }
@@ -621719,7 +621722,7 @@ function writeIndexMeta(repoRoot, meta) {
621719
621722
  function readIndexData(repoRoot, filename) {
621720
621723
  const filePath = join133(repoRoot, OMNIUS_DIR, "index", filename);
621721
621724
  try {
621722
- return JSON.parse(readFileSync95(filePath, "utf-8"));
621725
+ return JSON.parse(readFileSync96(filePath, "utf-8"));
621723
621726
  } catch {
621724
621727
  return null;
621725
621728
  }
@@ -621798,7 +621801,7 @@ function loadRecentSessions(repoRoot, limit = 5) {
621798
621801
  }).sort((a2, b) => b.mtime - a2.mtime).slice(0, limit);
621799
621802
  return files.map((f2) => {
621800
621803
  try {
621801
- return JSON.parse(readFileSync95(join133(historyDir, f2.file), "utf-8"));
621804
+ return JSON.parse(readFileSync96(join133(historyDir, f2.file), "utf-8"));
621802
621805
  } catch {
621803
621806
  return null;
621804
621807
  }
@@ -621822,7 +621825,7 @@ function loadPendingTask(repoRoot) {
621822
621825
  const filePath = join133(repoRoot, OMNIUS_DIR, "history", PENDING_TASK_FILE);
621823
621826
  try {
621824
621827
  if (!existsSync117(filePath)) return null;
621825
- const data = JSON.parse(readFileSync95(filePath, "utf-8"));
621828
+ const data = JSON.parse(readFileSync96(filePath, "utf-8"));
621826
621829
  try {
621827
621830
  unlinkSync22(filePath);
621828
621831
  } catch {
@@ -621852,7 +621855,7 @@ function readTaskHandoff2(repoRoot) {
621852
621855
  const filePath = join133(repoRoot, OMNIUS_DIR, "context", HANDOFF_FILE);
621853
621856
  try {
621854
621857
  if (!existsSync117(filePath)) return null;
621855
- const data = JSON.parse(readFileSync95(filePath, "utf-8"));
621858
+ const data = JSON.parse(readFileSync96(filePath, "utf-8"));
621856
621859
  const handoffTime = new Date(data.handoffAt).getTime();
621857
621860
  const now2 = Date.now();
621858
621861
  const ageMs = now2 - handoffTime;
@@ -621938,7 +621941,7 @@ function acquireLock(lockPath) {
621938
621941
  } catch (err) {
621939
621942
  if (existsSync117(lockPath)) {
621940
621943
  try {
621941
- const lockContent = readFileSync95(lockPath, "utf-8");
621944
+ const lockContent = readFileSync96(lockPath, "utf-8");
621942
621945
  const lock = JSON.parse(lockContent);
621943
621946
  const lockAge = Date.now() - lock.acquiredAt;
621944
621947
  if (lockAge > LOCK_TIMEOUT_MS) {
@@ -621964,7 +621967,7 @@ function acquireLock(lockPath) {
621964
621967
  function releaseLock(lockPath) {
621965
621968
  try {
621966
621969
  if (existsSync117(lockPath)) {
621967
- const lockContent = readFileSync95(lockPath, "utf-8");
621970
+ const lockContent = readFileSync96(lockPath, "utf-8");
621968
621971
  const lock = JSON.parse(lockContent);
621969
621972
  if (lock.pid === process.pid) {
621970
621973
  unlinkSync22(lockPath);
@@ -622056,7 +622059,7 @@ function pruneContextLedger(ledgerPath) {
622056
622059
  if (!existsSync117(ledgerPath)) return;
622057
622060
  const st = statSync44(ledgerPath);
622058
622061
  if (st.size <= MAX_CONTEXT_LEDGER_BYTES) return;
622059
- const lines = readFileSync95(ledgerPath, "utf-8").split(/\r?\n/).filter((line) => line.trim().length > 0);
622062
+ const lines = readFileSync96(ledgerPath, "utf-8").split(/\r?\n/).filter((line) => line.trim().length > 0);
622060
622063
  if (lines.length <= MAX_CONTEXT_LEDGER_LINES) return;
622061
622064
  const kept = lines.slice(-MAX_CONTEXT_LEDGER_LINES);
622062
622065
  const archiveDir = join133(dirname40(ledgerPath), "archive");
@@ -622084,7 +622087,7 @@ function saveSessionContext(repoRoot, entry) {
622084
622087
  let ctx3;
622085
622088
  try {
622086
622089
  if (existsSync117(filePath)) {
622087
- ctx3 = JSON.parse(readFileSync95(filePath, "utf-8"));
622090
+ ctx3 = JSON.parse(readFileSync96(filePath, "utf-8"));
622088
622091
  } else {
622089
622092
  ctx3 = { entries: [], maxEntries: MAX_CONTEXT_ENTRIES, updatedAt: "" };
622090
622093
  }
@@ -622246,7 +622249,7 @@ function loadSessionContext(repoRoot) {
622246
622249
  const filePath = join133(repoRoot, OMNIUS_DIR, "context", CONTEXT_SAVE_FILE);
622247
622250
  try {
622248
622251
  if (!existsSync117(filePath)) return null;
622249
- return JSON.parse(readFileSync95(filePath, "utf-8"));
622252
+ return JSON.parse(readFileSync96(filePath, "utf-8"));
622250
622253
  } catch {
622251
622254
  return null;
622252
622255
  }
@@ -622254,7 +622257,7 @@ function loadSessionContext(repoRoot) {
622254
622257
  function readJsonOrNull(filePath) {
622255
622258
  try {
622256
622259
  if (!existsSync117(filePath)) return null;
622257
- return JSON.parse(readFileSync95(filePath, "utf-8"));
622260
+ return JSON.parse(readFileSync96(filePath, "utf-8"));
622258
622261
  } catch {
622259
622262
  return null;
622260
622263
  }
@@ -622465,7 +622468,7 @@ function updateSessionEntry(repoRoot, sessionId, patch) {
622465
622468
  const indexPath = join133(repoRoot, OMNIUS_DIR, SESSIONS_DIR, SESSIONS_INDEX);
622466
622469
  try {
622467
622470
  if (!existsSync117(indexPath)) return false;
622468
- const index = JSON.parse(readFileSync95(indexPath, "utf-8"));
622471
+ const index = JSON.parse(readFileSync96(indexPath, "utf-8"));
622469
622472
  const idx = index.findIndex((e2) => e2.id === sessionId);
622470
622473
  if (idx < 0) return false;
622471
622474
  index[idx] = { ...index[idx], ...patch };
@@ -622514,7 +622517,7 @@ function saveSessionHistory(repoRoot, sessionId, contentLines, meta) {
622514
622517
  let index = [];
622515
622518
  try {
622516
622519
  if (existsSync117(indexPath)) {
622517
- index = JSON.parse(readFileSync95(indexPath, "utf-8"));
622520
+ index = JSON.parse(readFileSync96(indexPath, "utf-8"));
622518
622521
  }
622519
622522
  } catch {
622520
622523
  }
@@ -622546,7 +622549,7 @@ function listSessions(repoRoot) {
622546
622549
  const indexPath = join133(repoRoot, OMNIUS_DIR, SESSIONS_DIR, SESSIONS_INDEX);
622547
622550
  try {
622548
622551
  if (!existsSync117(indexPath)) return [];
622549
- const index = JSON.parse(readFileSync95(indexPath, "utf-8"));
622552
+ const index = JSON.parse(readFileSync96(indexPath, "utf-8"));
622550
622553
  return index.map((entry) => sanitizeSessionHistoryEntry(repoRoot, entry)).sort((a2, b) => b.updatedAt.localeCompare(a2.updatedAt));
622551
622554
  } catch {
622552
622555
  return [];
@@ -622556,7 +622559,7 @@ function loadSessionHistory(repoRoot, sessionId) {
622556
622559
  const contentPath = join133(repoRoot, OMNIUS_DIR, SESSIONS_DIR, `${sessionId}.jsonl`);
622557
622560
  try {
622558
622561
  if (!existsSync117(contentPath)) return null;
622559
- return readFileSync95(contentPath, "utf-8").split("\n");
622562
+ return readFileSync96(contentPath, "utf-8").split("\n");
622560
622563
  } catch {
622561
622564
  return null;
622562
622565
  }
@@ -622568,7 +622571,7 @@ function deleteSession(repoRoot, sessionId) {
622568
622571
  const contentPath = join133(sessDir, `${sessionId}.jsonl`);
622569
622572
  if (existsSync117(contentPath)) unlinkSync22(contentPath);
622570
622573
  if (existsSync117(indexPath)) {
622571
- let index = JSON.parse(readFileSync95(indexPath, "utf-8"));
622574
+ let index = JSON.parse(readFileSync96(indexPath, "utf-8"));
622572
622575
  index = index.filter((s2) => s2.id !== sessionId);
622573
622576
  writeFileSync63(indexPath, JSON.stringify(index, null, 2), "utf-8");
622574
622577
  }
@@ -622625,7 +622628,7 @@ function detectManifests(repoRoot) {
622625
622628
  let name10;
622626
622629
  if (check.nameField) {
622627
622630
  try {
622628
- const data = JSON.parse(readFileSync95(filePath, "utf-8"));
622631
+ const data = JSON.parse(readFileSync96(filePath, "utf-8"));
622629
622632
  name10 = data[check.nameField];
622630
622633
  } catch {
622631
622634
  }
@@ -622696,7 +622699,7 @@ function buildDirTree(root, maxDepth, prefix = "", depth = 0) {
622696
622699
  function loadUsageFile(filePath) {
622697
622700
  try {
622698
622701
  if (existsSync117(filePath)) {
622699
- return JSON.parse(readFileSync95(filePath, "utf-8"));
622702
+ return JSON.parse(readFileSync96(filePath, "utf-8"));
622700
622703
  }
622701
622704
  } catch {
622702
622705
  }
@@ -623023,7 +623026,7 @@ var init_session_summary = __esm({
623023
623026
 
623024
623027
  // packages/cli/src/tui/cad-model-viewer.ts
623025
623028
  import { createServer as createServer7 } from "node:http";
623026
- import { existsSync as existsSync118, readFileSync as readFileSync96, statSync as statSync45 } from "node:fs";
623029
+ import { existsSync as existsSync118, readFileSync as readFileSync97, statSync as statSync45 } from "node:fs";
623027
623030
  import { basename as basename26, extname as extname16, resolve as resolve58 } from "node:path";
623028
623031
  function getCurrentCadModelViewer() {
623029
623032
  return currentViewer;
@@ -623083,7 +623086,7 @@ function handleViewerRequest(req3, res, filePath) {
623083
623086
  "Content-Disposition": `inline; filename="${basename26(filePath).replace(/"/g, "")}"`,
623084
623087
  "Cache-Control": "no-store"
623085
623088
  });
623086
- res.end(readFileSync96(filePath));
623089
+ res.end(readFileSync97(filePath));
623087
623090
  } catch (err) {
623088
623091
  sendText(res, 500, err instanceof Error ? err.message : String(err));
623089
623092
  }
@@ -623487,7 +623490,7 @@ var init_render2 = __esm({
623487
623490
  });
623488
623491
 
623489
623492
  // packages/prompts/dist/promptLoader.js
623490
- import { readFileSync as readFileSync98, existsSync as existsSync120 } from "node:fs";
623493
+ import { readFileSync as readFileSync99, existsSync as existsSync120 } from "node:fs";
623491
623494
  import { join as join135, dirname as dirname41 } from "node:path";
623492
623495
  import { fileURLToPath as fileURLToPath17 } from "node:url";
623493
623496
  function loadPrompt2(promptPath, vars) {
@@ -623497,7 +623500,7 @@ function loadPrompt2(promptPath, vars) {
623497
623500
  if (!existsSync120(fullPath)) {
623498
623501
  throw new Error(`Prompt file not found: ${fullPath}`);
623499
623502
  }
623500
- content = readFileSync98(fullPath, "utf-8");
623503
+ content = readFileSync99(fullPath, "utf-8");
623501
623504
  cache6.set(promptPath, content);
623502
623505
  }
623503
623506
  if (!vars)
@@ -624594,7 +624597,7 @@ __export(tui_tasks_renderer_exports, {
624594
624597
  setTuiTasksSession: () => setTuiTasksSession,
624595
624598
  teardownTuiTasks: () => teardownTuiTasks
624596
624599
  });
624597
- import { existsSync as existsSync121, readFileSync as readFileSync99, watch as fsWatch3 } from "node:fs";
624600
+ import { existsSync as existsSync121, readFileSync as readFileSync100, watch as fsWatch3 } from "node:fs";
624598
624601
  import { join as join137 } from "node:path";
624599
624602
  import { homedir as homedir43 } from "node:os";
624600
624603
  function setTasksRendererWriter(writer) {
@@ -624721,7 +624724,7 @@ function loadTodos() {
624721
624724
  _lastTodos = [];
624722
624725
  return;
624723
624726
  }
624724
- const parsed = JSON.parse(readFileSync99(fp, "utf-8"));
624727
+ const parsed = JSON.parse(readFileSync100(fp, "utf-8"));
624725
624728
  _lastTodos = Array.isArray(parsed) ? parsed : [];
624726
624729
  } catch {
624727
624730
  _lastTodos = [];
@@ -630566,7 +630569,7 @@ __export(personaplex_exports, {
630566
630569
  startPersonaPlexDaemon: () => startPersonaPlexDaemon,
630567
630570
  stopPersonaPlex: () => stopPersonaPlex
630568
630571
  });
630569
- import { existsSync as existsSync122, writeFileSync as writeFileSync65, readFileSync as readFileSync100, mkdirSync as mkdirSync76, copyFileSync as copyFileSync5, readdirSync as readdirSync41, statSync as statSync46 } from "node:fs";
630572
+ import { existsSync as existsSync122, writeFileSync as writeFileSync65, readFileSync as readFileSync101, mkdirSync as mkdirSync76, copyFileSync as copyFileSync5, readdirSync as readdirSync41, statSync as statSync46 } from "node:fs";
630570
630573
  import { join as join138, dirname as dirname43 } from "node:path";
630571
630574
  import { homedir as homedir44 } from "node:os";
630572
630575
  import { spawn as spawn32 } from "node:child_process";
@@ -630605,9 +630608,9 @@ function selectWeightTier(vramGB) {
630605
630608
  }
630606
630609
  function detectJetson() {
630607
630610
  try {
630608
- const model = readFileSync100("/proc/device-tree/model", "utf8").replace(/\0/g, "").trim();
630611
+ const model = readFileSync101("/proc/device-tree/model", "utf8").replace(/\0/g, "").trim();
630609
630612
  if (/jetson|orin|tegra/i.test(model)) {
630610
- const memInfo = readFileSync100("/proc/meminfo", "utf8");
630613
+ const memInfo = readFileSync101("/proc/meminfo", "utf8");
630611
630614
  const memKB = parseInt(memInfo.match(/(\d+)/)?.[1] ?? "0", 10);
630612
630615
  return { isJetson: true, model, totalMemGB: memKB / 1024 / 1024 };
630613
630616
  }
@@ -630682,7 +630685,7 @@ function fileLink2(filePath, label) {
630682
630685
  }
630683
630686
  async function isPersonaPlexRunning() {
630684
630687
  if (!existsSync122(PID_FILE)) return false;
630685
- const pid = parseInt(readFileSync100(PID_FILE, "utf8").trim(), 10);
630688
+ const pid = parseInt(readFileSync101(PID_FILE, "utf8").trim(), 10);
630686
630689
  if (isNaN(pid) || pid <= 0) return false;
630687
630690
  try {
630688
630691
  process.kill(pid, 0);
@@ -630694,7 +630697,7 @@ async function isPersonaPlexRunning() {
630694
630697
  async function getPersonaPlexWSUrl() {
630695
630698
  if (!await isPersonaPlexRunning()) return null;
630696
630699
  if (!existsSync122(PORT_FILE)) return null;
630697
- const port = parseInt(readFileSync100(PORT_FILE, "utf8").trim(), 10);
630700
+ const port = parseInt(readFileSync101(PORT_FILE, "utf8").trim(), 10);
630698
630701
  return isNaN(port) ? null : `wss://127.0.0.1:${port}`;
630699
630702
  }
630700
630703
  function isPersonaPlexInstalled() {
@@ -630704,7 +630707,7 @@ async function getWeightTier() {
630704
630707
  const detected = await detectPersonaPlexCapability();
630705
630708
  const tierFile = join138(PERSONAPLEX_DIR, "weight_tier");
630706
630709
  if (existsSync122(tierFile)) {
630707
- const saved = readFileSync100(tierFile, "utf8").trim();
630710
+ const saved = readFileSync101(tierFile, "utf8").trim();
630708
630711
  if (saved in WEIGHT_REPOS) {
630709
630712
  const vram = detected.vramGB;
630710
630713
  if (saved === "nf4-distilled" && vram < 24) {
@@ -630834,7 +630837,7 @@ async function installPersonaPlex(onInfo, weightTier) {
630834
630837
  })).trim();
630835
630838
  const serverFile = join138(sitePackages, "server.py");
630836
630839
  if (existsSync122(serverFile)) {
630837
- let src2 = readFileSync100(serverFile, "utf8");
630840
+ let src2 = readFileSync101(serverFile, "utf8");
630838
630841
  if (src2.includes('int(request["seed"])')) {
630839
630842
  src2 = src2.replace('int(request["seed"])', 'int(request.query["seed"])');
630840
630843
  writeFileSync65(serverFile, src2);
@@ -630850,7 +630853,7 @@ async function installPersonaPlex(onInfo, weightTier) {
630850
630853
  })).trim();
630851
630854
  const loadersFile = join138(sitePackages, "models", "loaders.py");
630852
630855
  if (existsSync122(loadersFile)) {
630853
- let src2 = readFileSync100(loadersFile, "utf8");
630856
+ let src2 = readFileSync101(loadersFile, "utf8");
630854
630857
  if (!src2.includes("_dequantize_2bit_state_dict")) {
630855
630858
  const dequantPatch = `
630856
630859
  import math
@@ -630953,28 +630956,28 @@ $2if filename.endswith(".safetensors"):`
630953
630956
  })).trim();
630954
630957
  const hybridDest = join138(sitePackages2, "hybrid_agent.py");
630955
630958
  const serverDest = join138(sitePackages2, "server.py");
630956
- if (!existsSync122(hybridDest) || !readFileSync100(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
630959
+ if (!existsSync122(hybridDest) || !readFileSync101(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
630957
630960
  log22("Deploying hybrid_agent.py (Omnius API integration)...");
630958
630961
  try {
630959
630962
  await execAsync(
630960
630963
  `curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/hybrid_agent.py" -o "${hybridDest}"`,
630961
630964
  { timeout: 3e4 }
630962
630965
  );
630963
- if (existsSync122(hybridDest) && readFileSync100(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
630966
+ if (existsSync122(hybridDest) && readFileSync101(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
630964
630967
  log22("hybrid_agent.py deployed (Omnius API + Ollama fallback).");
630965
630968
  }
630966
630969
  } catch {
630967
630970
  log22("hybrid_agent.py download failed — hybrid mode will be disabled.");
630968
630971
  }
630969
630972
  }
630970
- if (!readFileSync100(serverDest, "utf8").includes("hybrid_agent")) {
630973
+ if (!readFileSync101(serverDest, "utf8").includes("hybrid_agent")) {
630971
630974
  log22("Deploying patched server.py (hybrid mode + API endpoints)...");
630972
630975
  try {
630973
630976
  await execAsync(
630974
630977
  `curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/server.py" -o "${serverDest}"`,
630975
630978
  { timeout: 3e4 }
630976
630979
  );
630977
- if (readFileSync100(serverDest, "utf8").includes("hybrid_agent")) {
630980
+ if (readFileSync101(serverDest, "utf8").includes("hybrid_agent")) {
630978
630981
  log22("server.py patched with hybrid intercept + REST APIs.");
630979
630982
  }
630980
630983
  } catch {
@@ -631164,7 +631167,7 @@ print('Converted')
631164
631167
  let ollamaModel = process.env["HYBRID_LLM_MODEL"] || "";
631165
631168
  if (!ollamaModel) {
631166
631169
  try {
631167
- const omniusConfig = JSON.parse(readFileSync100(join138(homedir44(), ".omnius", "config.json"), "utf8"));
631170
+ const omniusConfig = JSON.parse(readFileSync101(join138(homedir44(), ".omnius", "config.json"), "utf8"));
631168
631171
  if (omniusConfig.model) ollamaModel = omniusConfig.model;
631169
631172
  } catch {
631170
631173
  }
@@ -631260,7 +631263,7 @@ print('Converted')
631260
631263
  }
631261
631264
  async function stopPersonaPlex() {
631262
631265
  if (!existsSync122(PID_FILE)) return;
631263
- const pid = parseInt(readFileSync100(PID_FILE, "utf8").trim(), 10);
631266
+ const pid = parseInt(readFileSync101(PID_FILE, "utf8").trim(), 10);
631264
631267
  if (isNaN(pid) || pid <= 0) return;
631265
631268
  try {
631266
631269
  if (process.platform === "win32") {
@@ -631457,7 +631460,7 @@ function patchFrontendVoiceList(onInfo) {
631457
631460
  for (const f2 of readdirSync41(distDir)) {
631458
631461
  if (!f2.startsWith("index-") || !f2.endsWith(".js")) continue;
631459
631462
  const jsPath = join138(distDir, f2);
631460
- let js = readFileSync100(jsPath, "utf8");
631463
+ let js = readFileSync101(jsPath, "utf8");
631461
631464
  const customVoices = [];
631462
631465
  if (existsSync122(CUSTOM_VOICES_DIR)) {
631463
631466
  for (const vf of readdirSync41(CUSTOM_VOICES_DIR)) {
@@ -631577,7 +631580,7 @@ __export(setup_exports, {
631577
631580
  import * as readline from "node:readline";
631578
631581
  import { spawn as spawn33, exec as exec5 } from "node:child_process";
631579
631582
  import { promisify as promisify7 } from "node:util";
631580
- import { existsSync as existsSync123, writeFileSync as writeFileSync66, readFileSync as readFileSync101, appendFileSync as appendFileSync14, mkdirSync as mkdirSync77, chmodSync as chmodSync3 } from "node:fs";
631583
+ import { existsSync as existsSync123, writeFileSync as writeFileSync66, readFileSync as readFileSync102, appendFileSync as appendFileSync14, mkdirSync as mkdirSync77, chmodSync as chmodSync3 } from "node:fs";
631581
631584
  import { delimiter as pathDelimiter, join as join139 } from "node:path";
631582
631585
  import { freemem as freemem6, homedir as homedir45, platform as platform5, totalmem as totalmem8 } from "node:os";
631583
631586
  function wrapText2(value2, width) {
@@ -631633,14 +631636,14 @@ function detectUnifiedMemory(hasDiscreteGpu = false) {
631633
631636
  }
631634
631637
  try {
631635
631638
  if (existsSync123("/sys/devices/soc0/family")) {
631636
- const family = readFileSync101("/sys/devices/soc0/family", "utf8").trim().toLowerCase();
631639
+ const family = readFileSync102("/sys/devices/soc0/family", "utf8").trim().toLowerCase();
631637
631640
  if (family.includes("tegra")) return true;
631638
631641
  }
631639
631642
  } catch {
631640
631643
  }
631641
631644
  try {
631642
631645
  if (existsSync123("/proc/device-tree/model")) {
631643
- const model = readFileSync101("/proc/device-tree/model", "utf8").replace(/\0+$/, "").toLowerCase();
631646
+ const model = readFileSync102("/proc/device-tree/model", "utf8").replace(/\0+$/, "").toLowerCase();
631644
631647
  if (/jetson|tegra|orin|xavier|nano|raspberry|rockchip|rk\d{4}|mt\d{4}/.test(model)) {
631645
631648
  return true;
631646
631649
  }
@@ -632794,7 +632797,7 @@ async function runOptionalDepsSetup(rl) {
632794
632797
  }
632795
632798
  const askTranscribe = await ask(rl, ` ${c3.bold("Install transcribe-cli for live transcription?")} (Y/n) `);
632796
632799
  if (askTranscribe.toLowerCase() !== "n") {
632797
- process.stdout.write(` ${c3.cyan("●")} Installing transcribe-cli (npm i -g transcribe-cli)...
632800
+ process.stdout.write(` ${c3.cyan("●")} Installing managed transcribe-cli runtime...
632798
632801
  `);
632799
632802
  try {
632800
632803
  const ok3 = await ensureTranscribeCliBackground();
@@ -633594,7 +633597,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
633594
633597
  let _visionPreviouslyInstalled = /* @__PURE__ */ new Set();
633595
633598
  try {
633596
633599
  if (existsSync123(_visionMarkerFile)) {
633597
- const _vm = JSON.parse(readFileSync101(_visionMarkerFile, "utf8"));
633600
+ const _vm = JSON.parse(readFileSync102(_visionMarkerFile, "utf8"));
633598
633601
  _visionPreviouslyInstalled = new Set(_vm.installed || []);
633599
633602
  }
633600
633603
  } catch {
@@ -634426,7 +634429,7 @@ function ensurePathInShellRc(binDir) {
634426
634429
  const shell = process.env.SHELL ?? "";
634427
634430
  const rcFile = shell.includes("zsh") ? join139(homedir45(), ".zshrc") : join139(homedir45(), ".bashrc");
634428
634431
  try {
634429
- const rcContent = existsSync123(rcFile) ? readFileSync101(rcFile, "utf8") : "";
634432
+ const rcContent = existsSync123(rcFile) ? readFileSync102(rcFile, "utf8") : "";
634430
634433
  if (rcContent.includes(binDir)) return;
634431
634434
  const exportLine = `
634432
634435
  export PATH="${binDir}:$PATH" # Added by omnius for nvim
@@ -635206,7 +635209,7 @@ var init_platforms = __esm({
635206
635209
  });
635207
635210
 
635208
635211
  // packages/cli/src/tui/workspace-explorer.ts
635209
- import { existsSync as existsSync125, readdirSync as readdirSync42, readFileSync as readFileSync102, statSync as statSync47 } from "node:fs";
635212
+ import { existsSync as existsSync125, readdirSync as readdirSync42, readFileSync as readFileSync103, statSync as statSync47 } from "node:fs";
635210
635213
  import { basename as basename27, extname as extname17, join as join140, relative as relative14, resolve as resolve59 } from "node:path";
635211
635214
  function exploreWorkspace(root, options2 = {}) {
635212
635215
  const query = (options2.query ?? "").trim().toLowerCase();
@@ -635305,7 +635308,7 @@ function previewWorkspaceFile(root, relPath, options2 = {}) {
635305
635308
  ""
635306
635309
  ].join("\n");
635307
635310
  }
635308
- const content = readFileSync102(full, "utf8");
635311
+ const content = readFileSync103(full, "utf8");
635309
635312
  const rawLines = content.split(/\r?\n/);
635310
635313
  const visible = rawLines.slice(0, maxLines);
635311
635314
  const gutter = String(Math.min(rawLines.length, maxLines)).length;
@@ -635481,7 +635484,7 @@ var init_pricing = __esm({
635481
635484
  });
635482
635485
 
635483
635486
  // packages/cli/src/insights/engine.ts
635484
- import { readdirSync as readdirSync43, readFileSync as readFileSync103, existsSync as existsSync126 } from "node:fs";
635487
+ import { readdirSync as readdirSync43, readFileSync as readFileSync104, existsSync as existsSync126 } from "node:fs";
635485
635488
  import { join as join141 } from "node:path";
635486
635489
  function formatDuration5(seconds) {
635487
635490
  if (seconds < 60) return `${Math.round(seconds)}s`;
@@ -635556,7 +635559,7 @@ var init_engine = __esm({
635556
635559
  return readdirSync43(this.historyDir).filter((f2) => f2.endsWith(".json") && f2 !== "pending-task.json").map((f2) => {
635557
635560
  try {
635558
635561
  const data = JSON.parse(
635559
- readFileSync103(join141(this.historyDir, f2), "utf-8")
635562
+ readFileSync104(join141(this.historyDir, f2), "utf-8")
635560
635563
  );
635561
635564
  return data;
635562
635565
  } catch {
@@ -635574,7 +635577,7 @@ var init_engine = __esm({
635574
635577
  loadUsageStore() {
635575
635578
  try {
635576
635579
  if (existsSync126(this.usageFile)) {
635577
- return JSON.parse(readFileSync103(this.usageFile, "utf-8"));
635580
+ return JSON.parse(readFileSync104(this.usageFile, "utf-8"));
635578
635581
  }
635579
635582
  } catch {
635580
635583
  }
@@ -638357,7 +638360,7 @@ var init_memory_menu = __esm({
638357
638360
  });
638358
638361
 
638359
638362
  // packages/cli/src/tui/audio-waveform.ts
638360
- import { readFileSync as readFileSync104 } from "node:fs";
638363
+ import { readFileSync as readFileSync105 } from "node:fs";
638361
638364
  import { createRequire as createRequire6 } from "node:module";
638362
638365
  function readAscii(buffer2, offset, length4) {
638363
638366
  return buffer2.subarray(offset, offset + length4).toString("ascii");
@@ -638431,7 +638434,7 @@ function renderAudioWaveform(file, options2 = {}) {
638431
638434
  } catch {
638432
638435
  return null;
638433
638436
  }
638434
- const buffer2 = readFileSync104(file);
638437
+ const buffer2 = readFileSync105(file);
638435
638438
  const info = parseWav(buffer2);
638436
638439
  if (!info) return null;
638437
638440
  const frameCount = Math.floor(info.dataSize / info.frameSize);
@@ -638987,7 +638990,7 @@ __export(daemon_exports, {
638987
638990
  stopDaemon: () => stopDaemon
638988
638991
  });
638989
638992
  import { spawn as spawn34 } from "node:child_process";
638990
- import { existsSync as existsSync130, readFileSync as readFileSync105, writeFileSync as writeFileSync67, mkdirSync as mkdirSync78, unlinkSync as unlinkSync25, openSync as openSync3, closeSync as closeSync3 } from "node:fs";
638993
+ import { existsSync as existsSync130, readFileSync as readFileSync106, writeFileSync as writeFileSync67, mkdirSync as mkdirSync78, unlinkSync as unlinkSync25, openSync as openSync3, closeSync as closeSync3 } from "node:fs";
638991
638994
  import { join as join144 } from "node:path";
638992
638995
  import { homedir as homedir47 } from "node:os";
638993
638996
  import { fileURLToPath as fileURLToPath20 } from "node:url";
@@ -639018,7 +639021,7 @@ function getLocalCliVersion() {
639018
639021
  for (const rel of ["../package.json", "../../package.json", "./package.json", "../../../package.json"]) {
639019
639022
  const p2 = join144(here, rel);
639020
639023
  if (existsSync130(p2)) {
639021
- const v = JSON.parse(readFileSync105(p2, "utf8"))?.version;
639024
+ const v = JSON.parse(readFileSync106(p2, "utf8"))?.version;
639022
639025
  if (v) return String(v);
639023
639026
  }
639024
639027
  }
@@ -639057,7 +639060,7 @@ async function restartDaemon(port) {
639057
639060
  function getDaemonPid() {
639058
639061
  if (!existsSync130(PID_FILE2)) return null;
639059
639062
  try {
639060
- const pid = parseInt(readFileSync105(PID_FILE2, "utf8").trim(), 10);
639063
+ const pid = parseInt(readFileSync106(PID_FILE2, "utf8").trim(), 10);
639061
639064
  if (!pid || pid <= 0) return null;
639062
639065
  process.kill(pid, 0);
639063
639066
  return pid;
@@ -639072,7 +639075,7 @@ function getDaemonPid() {
639072
639075
  function looksLikeNodeEntrypoint(path12) {
639073
639076
  if (/\.(?:mjs|cjs|js)$/i.test(path12)) return true;
639074
639077
  try {
639075
- const firstBytes = readFileSync105(path12, "utf8").slice(0, 200);
639078
+ const firstBytes = readFileSync106(path12, "utf8").slice(0, 200);
639076
639079
  return /^#!.*\bnode\b/.test(firstBytes);
639077
639080
  } catch {
639078
639081
  return false;
@@ -639746,7 +639749,7 @@ var init_types5 = __esm({
639746
639749
 
639747
639750
  // packages/cli/src/cron/store.ts
639748
639751
  import {
639749
- readFileSync as readFileSync106,
639752
+ readFileSync as readFileSync107,
639750
639753
  writeFileSync as writeFileSync68,
639751
639754
  mkdirSync as mkdirSync79,
639752
639755
  chmodSync as chmodSync4,
@@ -639933,7 +639936,7 @@ function loadJobs() {
639933
639936
  const path12 = jobsFilePath();
639934
639937
  if (!existsSync133(path12)) return [];
639935
639938
  try {
639936
- const data = JSON.parse(readFileSync106(path12, "utf-8"));
639939
+ const data = JSON.parse(readFileSync107(path12, "utf-8"));
639937
639940
  return data.jobs || [];
639938
639941
  } catch {
639939
639942
  return [];
@@ -640301,7 +640304,7 @@ import {
640301
640304
  closeSync as closeSync5,
640302
640305
  writeFileSync as writeFileSync69,
640303
640306
  unlinkSync as unlinkSync27,
640304
- readFileSync as readFileSync107
640307
+ readFileSync as readFileSync108
640305
640308
  } from "node:fs";
640306
640309
  import { join as join148 } from "node:path";
640307
640310
  import { homedir as homedir49 } from "node:os";
@@ -640318,7 +640321,7 @@ function acquireTickLock() {
640318
640321
  mkdirSync80(cronDir2(), { recursive: true });
640319
640322
  try {
640320
640323
  if (existsSync134(lockPath)) {
640321
- const content = readFileSync107(lockPath, "utf-8").trim();
640324
+ const content = readFileSync108(lockPath, "utf-8").trim();
640322
640325
  if (content) {
640323
640326
  const lock = JSON.parse(content);
640324
640327
  const age = Date.now() - lock.acquiredAt;
@@ -640686,7 +640689,7 @@ __export(sponsor_wizard_exports, {
640686
640689
  selectedModelsForEndpoint: () => selectedModelsForEndpoint,
640687
640690
  showSponsorDashboard: () => showSponsorDashboard
640688
640691
  });
640689
- import { existsSync as existsSync135, readFileSync as readFileSync108, writeFileSync as writeFileSync70, mkdirSync as mkdirSync81 } from "node:fs";
640692
+ import { existsSync as existsSync135, readFileSync as readFileSync109, writeFileSync as writeFileSync70, mkdirSync as mkdirSync81 } from "node:fs";
640690
640693
  import { join as join149 } from "node:path";
640691
640694
  function fmtTokens2(n2) {
640692
640695
  if (n2 < 1e3) return String(Math.max(0, Math.floor(n2)));
@@ -640707,7 +640710,7 @@ function loadSponsorConfig(projectDir2) {
640707
640710
  const p2 = configPath(projectDir2);
640708
640711
  if (!existsSync135(p2)) return null;
640709
640712
  try {
640710
- return JSON.parse(readFileSync108(p2, "utf8"));
640713
+ return JSON.parse(readFileSync109(p2, "utf8"));
640711
640714
  } catch {
640712
640715
  return null;
640713
640716
  }
@@ -642054,7 +642057,7 @@ import {
642054
642057
  existsSync as existsSync136,
642055
642058
  mkdirSync as mkdirSync82,
642056
642059
  writeFileSync as writeFileSync71,
642057
- readFileSync as readFileSync109,
642060
+ readFileSync as readFileSync110,
642058
642061
  unlinkSync as unlinkSync28,
642059
642062
  readdirSync as readdirSync45,
642060
642063
  statSync as statSync50,
@@ -643555,7 +643558,7 @@ except Exception as exc:
643555
643558
  const destFilename = `clone-${srcName}-${ts}.${ext}`;
643556
643559
  const destPath = join150(refsDir, destFilename);
643557
643560
  try {
643558
- const data = readFileSync109(audioPath);
643561
+ const data = readFileSync110(audioPath);
643559
643562
  writeFileSync71(destPath, data);
643560
643563
  } catch (err) {
643561
643564
  return `Failed to copy audio file: ${err instanceof Error ? err.message : String(err)}`;
@@ -643630,7 +643633,7 @@ except Exception as exc:
643630
643633
  const p2 = _VoiceEngine.cloneMetaFile();
643631
643634
  if (!existsSync136(p2)) return {};
643632
643635
  try {
643633
- const raw = JSON.parse(readFileSync109(p2, "utf8"));
643636
+ const raw = JSON.parse(readFileSync110(p2, "utf8"));
643634
643637
  if (typeof Object.values(raw)[0] === "string") {
643635
643638
  const migrated = {};
643636
643639
  for (const [k, v] of Object.entries(raw)) {
@@ -644516,7 +644519,7 @@ except Exception as exc:
644516
644519
  }
644517
644520
  loadMisottsStore() {
644518
644521
  try {
644519
- const raw = JSON.parse(readFileSync109(misottsProfilesFile(), "utf-8"));
644522
+ const raw = JSON.parse(readFileSync110(misottsProfilesFile(), "utf-8"));
644520
644523
  const profiles = {};
644521
644524
  for (const [name10, settings] of Object.entries(raw.profiles ?? {})) {
644522
644525
  profiles[name10] = normalizeMisottsSettings(settings);
@@ -644540,7 +644543,7 @@ except Exception as exc:
644540
644543
  loadSupertonicStore() {
644541
644544
  try {
644542
644545
  const raw = JSON.parse(
644543
- readFileSync109(supertonicProfilesFile(), "utf-8")
644546
+ readFileSync110(supertonicProfilesFile(), "utf-8")
644544
644547
  );
644545
644548
  const profiles = {};
644546
644549
  for (const [name10, settings] of Object.entries(raw.profiles ?? {})) {
@@ -644707,7 +644710,7 @@ except Exception as exc:
644707
644710
  const wavPath = await this.synthesizeSupertonicWav(text2, 1);
644708
644711
  if (!wavPath) return null;
644709
644712
  try {
644710
- const data = readFileSync109(wavPath);
644713
+ const data = readFileSync110(wavPath);
644711
644714
  unlinkSync28(wavPath);
644712
644715
  return data;
644713
644716
  } catch {
@@ -644855,7 +644858,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
644855
644858
  if (!existsSync136(wavPath)) return;
644856
644859
  if (volume !== 1) {
644857
644860
  try {
644858
- const wavData = readFileSync109(wavPath);
644861
+ const wavData = readFileSync110(wavPath);
644859
644862
  if (wavData.length > 44) {
644860
644863
  const header = wavData.subarray(0, 44);
644861
644864
  const samples = new Int16Array(
@@ -644877,7 +644880,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
644877
644880
  }
644878
644881
  if (this.onPCMOutput) {
644879
644882
  try {
644880
- const wavData = readFileSync109(wavPath);
644883
+ const wavData = readFileSync110(wavPath);
644881
644884
  if (wavData.length > 44) {
644882
644885
  const pcm = Buffer.from(
644883
644886
  wavData.buffer,
@@ -644935,7 +644938,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
644935
644938
  }
644936
644939
  if (!existsSync136(wavPath)) return null;
644937
644940
  try {
644938
- const data = readFileSync109(wavPath);
644941
+ const data = readFileSync110(wavPath);
644939
644942
  unlinkSync28(wavPath);
644940
644943
  return data;
644941
644944
  } catch {
@@ -645189,7 +645192,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
645189
645192
  ...isJetson ? (() => {
645190
645193
  let jpVer = "v60";
645191
645194
  try {
645192
- const tegra = existsSync136("/etc/nv_tegra_release") ? readFileSync109("/etc/nv_tegra_release", "utf8").trim() : "";
645195
+ const tegra = existsSync136("/etc/nv_tegra_release") ? readFileSync110("/etc/nv_tegra_release", "utf8").trim() : "";
645193
645196
  const ver = process.env.JETSON_L4T_VERSION || "";
645194
645197
  if (ver.startsWith("5.") || tegra.includes("R35") || tegra.includes("R34"))
645195
645198
  jpVer = "v51";
@@ -645799,7 +645802,7 @@ if __name__ == '__main__':
645799
645802
  async postProcessAndPlayLuxtts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
645800
645803
  if (!existsSync136(wavPath)) return;
645801
645804
  try {
645802
- const wavData = readFileSync109(wavPath);
645805
+ const wavData = readFileSync110(wavPath);
645803
645806
  if (wavData.length > 44) {
645804
645807
  const sampleRate = wavData.readUInt32LE(24);
645805
645808
  const samples = new Int16Array(
@@ -645830,7 +645833,7 @@ if __name__ == '__main__':
645830
645833
  }
645831
645834
  if (pitchFactor !== 1) {
645832
645835
  try {
645833
- const wavData = readFileSync109(wavPath);
645836
+ const wavData = readFileSync110(wavPath);
645834
645837
  if (wavData.length > 44) {
645835
645838
  const int16 = new Int16Array(
645836
645839
  wavData.buffer,
@@ -645849,7 +645852,7 @@ if __name__ == '__main__':
645849
645852
  }
645850
645853
  if (this.onPCMOutput) {
645851
645854
  try {
645852
- const wavData = readFileSync109(wavPath);
645855
+ const wavData = readFileSync110(wavPath);
645853
645856
  if (wavData.length > 44) {
645854
645857
  const pcm = Buffer.from(
645855
645858
  wavData.buffer,
@@ -645864,7 +645867,7 @@ if __name__ == '__main__':
645864
645867
  }
645865
645868
  if (stereoDelayMs > 0) {
645866
645869
  try {
645867
- const wavData = readFileSync109(wavPath);
645870
+ const wavData = readFileSync110(wavPath);
645868
645871
  if (wavData.length > 44) {
645869
645872
  const sampleRate = wavData.readUInt32LE(24);
645870
645873
  const numChannels = wavData.readUInt16LE(22);
@@ -645931,7 +645934,7 @@ if __name__ == '__main__':
645931
645934
  }
645932
645935
  if (!existsSync136(wavPath)) return null;
645933
645936
  try {
645934
- const data = readFileSync109(wavPath);
645937
+ const data = readFileSync110(wavPath);
645935
645938
  unlinkSync28(wavPath);
645936
645939
  return data;
645937
645940
  } catch {
@@ -646166,7 +646169,7 @@ if __name__ == "__main__":
646166
646169
  async postProcessAndPlayMisotts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
646167
646170
  if (!existsSync136(wavPath)) return;
646168
646171
  try {
646169
- const wavData = readFileSync109(wavPath);
646172
+ const wavData = readFileSync110(wavPath);
646170
646173
  if (wavData.length > 44) {
646171
646174
  const sampleRate = wavData.readUInt32LE(24);
646172
646175
  const samples = new Int16Array(
@@ -646197,7 +646200,7 @@ if __name__ == "__main__":
646197
646200
  }
646198
646201
  if (pitchFactor !== 1) {
646199
646202
  try {
646200
- const wavData = readFileSync109(wavPath);
646203
+ const wavData = readFileSync110(wavPath);
646201
646204
  if (wavData.length > 44) {
646202
646205
  const int16 = new Int16Array(
646203
646206
  wavData.buffer,
@@ -646216,7 +646219,7 @@ if __name__ == "__main__":
646216
646219
  }
646217
646220
  if (this.onPCMOutput) {
646218
646221
  try {
646219
- const wavData = readFileSync109(wavPath);
646222
+ const wavData = readFileSync110(wavPath);
646220
646223
  if (wavData.length > 44) {
646221
646224
  const pcm = Buffer.from(
646222
646225
  wavData.buffer,
@@ -646231,7 +646234,7 @@ if __name__ == "__main__":
646231
646234
  }
646232
646235
  if (stereoDelayMs > 0) {
646233
646236
  try {
646234
- const wavData = readFileSync109(wavPath);
646237
+ const wavData = readFileSync110(wavPath);
646235
646238
  if (wavData.length > 44) {
646236
646239
  const sampleRate = wavData.readUInt32LE(24);
646237
646240
  const numChannels = wavData.readUInt16LE(22);
@@ -646307,7 +646310,7 @@ if __name__ == "__main__":
646307
646310
  }
646308
646311
  if (!existsSync136(wavPath)) return null;
646309
646312
  try {
646310
- const data = readFileSync109(wavPath);
646313
+ const data = readFileSync110(wavPath);
646311
646314
  unlinkSync28(wavPath);
646312
646315
  return data;
646313
646316
  } catch {
@@ -646328,7 +646331,7 @@ if __name__ == "__main__":
646328
646331
  };
646329
646332
  if (existsSync136(pkgPath)) {
646330
646333
  try {
646331
- const existing = JSON.parse(readFileSync109(pkgPath, "utf8"));
646334
+ const existing = JSON.parse(readFileSync110(pkgPath, "utf8"));
646332
646335
  if (!existing.dependencies?.["phonemizer"]) {
646333
646336
  existing.dependencies = { ...existing.dependencies, ...expectedDeps };
646334
646337
  writeFileSync71(pkgPath, JSON.stringify(existing, null, 2));
@@ -646488,7 +646491,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
646488
646491
  if (!existsSync136(onnxPath) || !existsSync136(configPath2)) {
646489
646492
  throw new Error(`Model files not found for ${this.modelId}`);
646490
646493
  }
646491
- this.config = JSON.parse(readFileSync109(configPath2, "utf8"));
646494
+ this.config = JSON.parse(readFileSync110(configPath2, "utf8"));
646492
646495
  this.session = await this.ort.InferenceSession.create(onnxPath, {
646493
646496
  executionProviders: ["cpu"],
646494
646497
  graphOptimizationLevel: "all"
@@ -646648,7 +646651,7 @@ import { spawn as nodeSpawn2 } from "node:child_process";
646648
646651
  import { createHash as createHash38 } from "node:crypto";
646649
646652
  import {
646650
646653
  existsSync as existsSync137,
646651
- readFileSync as readFileSync110,
646654
+ readFileSync as readFileSync111,
646652
646655
  writeFileSync as writeFileSync72,
646653
646656
  mkdirSync as mkdirSync83,
646654
646657
  readdirSync as readdirSync46,
@@ -647969,10 +647972,10 @@ async function handleSlashCommand(input, ctx3) {
647969
647972
  if (!key) {
647970
647973
  try {
647971
647974
  const { homedir: homedir65 } = await import("node:os");
647972
- const { readFileSync: readFileSync137, existsSync: existsSync169 } = await import("node:fs");
647975
+ const { readFileSync: readFileSync138, existsSync: existsSync169 } = await import("node:fs");
647973
647976
  const { join: join186 } = await import("node:path");
647974
647977
  const p2 = join186(homedir65(), ".omnius", "api.key");
647975
- if (existsSync169(p2)) key = readFileSync137(p2, "utf8").trim();
647978
+ if (existsSync169(p2)) key = readFileSync138(p2, "utf8").trim();
647976
647979
  } catch {
647977
647980
  }
647978
647981
  }
@@ -648876,7 +648879,7 @@ async function handleSlashCommand(input, ctx3) {
648876
648879
  try {
648877
648880
  const pidFile = join151(nexus.getNexusDir(), "daemon.pid");
648878
648881
  if (existsSync137(pidFile)) {
648879
- const pid = parseInt(readFileSync110(pidFile, "utf8").trim(), 10);
648882
+ const pid = parseInt(readFileSync111(pidFile, "utf8").trim(), 10);
648880
648883
  if (pid > 0 && !registry2.daemons.has("Nexus")) {
648881
648884
  registry2.register({
648882
648885
  name: "Nexus",
@@ -649299,7 +649302,7 @@ async function handleSlashCommand(input, ctx3) {
649299
649302
  renderWarning(`Tool not found: ${toolFile}`);
649300
649303
  return "handled";
649301
649304
  }
649302
- content = readFileSync110(toolFile, "utf8");
649305
+ content = readFileSync111(toolFile, "utf8");
649303
649306
  metadata = { type: "tool", name: shareName };
649304
649307
  } else if (shareType === "skill") {
649305
649308
  const skillDir = join151(ctx3.repoRoot, ".omnius", "skills", shareName);
@@ -649308,7 +649311,7 @@ async function handleSlashCommand(input, ctx3) {
649308
649311
  renderWarning(`Skill not found: ${skillFile}`);
649309
649312
  return "handled";
649310
649313
  }
649311
- content = readFileSync110(skillFile, "utf8");
649314
+ content = readFileSync111(skillFile, "utf8");
649312
649315
  metadata = { type: "skill", name: shareName };
649313
649316
  } else {
649314
649317
  renderWarning(
@@ -649381,7 +649384,7 @@ async function handleSlashCommand(input, ctx3) {
649381
649384
  "learning-cids.json"
649382
649385
  );
649383
649386
  if (existsSync137(regFile)) {
649384
- const reg2 = JSON.parse(readFileSync110(regFile, "utf8"));
649387
+ const reg2 = JSON.parse(readFileSync111(regFile, "utf8"));
649385
649388
  const pinned = Object.values(reg2).some(
649386
649389
  (e2) => e2.cid === importCid && e2.pinned
649387
649390
  );
@@ -649499,7 +649502,7 @@ async function handleSlashCommand(input, ctx3) {
649499
649502
  ).getNexusDir();
649500
649503
  const statusFile = join151(nexusDir, "status.json");
649501
649504
  if (existsSync137(statusFile)) {
649502
- const status = JSON.parse(readFileSync110(statusFile, "utf8"));
649505
+ const status = JSON.parse(readFileSync111(statusFile, "utf8"));
649503
649506
  if (status.peerId) {
649504
649507
  lines.push(`
649505
649508
  ${c3.bold("Peer Info")}`);
@@ -649524,7 +649527,7 @@ async function handleSlashCommand(input, ctx3) {
649524
649527
  try {
649525
649528
  const stateFile = join151(idDir, "self-state.json");
649526
649529
  if (existsSync137(stateFile)) {
649527
- const state = JSON.parse(readFileSync110(stateFile, "utf8"));
649530
+ const state = JSON.parse(readFileSync111(stateFile, "utf8"));
649528
649531
  lines.push(
649529
649532
  ` Version: ${c3.bold("v" + (state.version ?? "?"))} Sessions: ${c3.bold(String(state.session_count ?? 0))}`
649530
649533
  );
@@ -649539,7 +649542,7 @@ async function handleSlashCommand(input, ctx3) {
649539
649542
  }
649540
649543
  const cidFile = join151(idDir, "cids.json");
649541
649544
  if (existsSync137(cidFile)) {
649542
- const cids = JSON.parse(readFileSync110(cidFile, "utf8"));
649545
+ const cids = JSON.parse(readFileSync111(cidFile, "utf8"));
649543
649546
  const lastCid = Array.isArray(cids) ? cids[cids.length - 1] : cids.latest;
649544
649547
  if (lastCid)
649545
649548
  lines.push(
@@ -649564,7 +649567,7 @@ async function handleSlashCommand(input, ctx3) {
649564
649567
  "store.json"
649565
649568
  );
649566
649569
  if (existsSync137(metaFile2)) {
649567
- const store2 = JSON.parse(readFileSync110(metaFile2, "utf8"));
649570
+ const store2 = JSON.parse(readFileSync111(metaFile2, "utf8"));
649568
649571
  const active = store2.filter((m2) => m2.type !== "quarantine");
649569
649572
  const recoveries = active.filter(
649570
649573
  (m2) => m2.content?.startsWith("[recovery]")
@@ -649802,7 +649805,7 @@ async function handleSlashCommand(input, ctx3) {
649802
649805
  return "handled";
649803
649806
  }
649804
649807
  } else {
649805
- content = readFileSync110(resolvedPath, "utf8");
649808
+ content = readFileSync111(resolvedPath, "utf8");
649806
649809
  }
649807
649810
  if (!content.trim()) {
649808
649811
  renderWarning("No content extracted.");
@@ -649910,7 +649913,7 @@ async function handleSlashCommand(input, ctx3) {
649910
649913
  renderInfo("Fortemi bridge: not connected. Run /fortemi start");
649911
649914
  return "handled";
649912
649915
  }
649913
- const bridge = JSON.parse(readFileSync110(bridgeFile, "utf8"));
649916
+ const bridge = JSON.parse(readFileSync111(bridgeFile, "utf8"));
649914
649917
  let alive = false;
649915
649918
  try {
649916
649919
  process.kill(bridge.pid, 0);
@@ -649946,7 +649949,7 @@ async function handleSlashCommand(input, ctx3) {
649946
649949
  if (fortemiSubCmd === "stop") {
649947
649950
  const bridgeFile = join151(ctx3.repoRoot, ".omnius", "fortemi-bridge.json");
649948
649951
  if (existsSync137(bridgeFile)) {
649949
- const bridge = JSON.parse(readFileSync110(bridgeFile, "utf8"));
649952
+ const bridge = JSON.parse(readFileSync111(bridgeFile, "utf8"));
649950
649953
  try {
649951
649954
  process.kill(bridge.pid, "SIGTERM");
649952
649955
  } catch {
@@ -651978,7 +651981,7 @@ sleep 1
651978
651981
  `daemon.pid exists: ${existsSync137(join151(checkedNexusDir, "daemon.pid"))}`
651979
651982
  );
651980
651983
  try {
651981
- const _statusRaw = readFileSync110(
651984
+ const _statusRaw = readFileSync111(
651982
651985
  join151(checkedNexusDir, "status.json"),
651983
651986
  "utf8"
651984
651987
  );
@@ -651987,7 +651990,7 @@ sleep 1
651987
651990
  _spLog(`status.json read error: ${e2}`);
651988
651991
  }
651989
651992
  try {
651990
- const _errRaw = readFileSync110(
651993
+ const _errRaw = readFileSync111(
651991
651994
  join151(checkedNexusDir, "daemon.err"),
651992
651995
  "utf8"
651993
651996
  );
@@ -652022,7 +652025,7 @@ sleep 1
652022
652025
  "agent-name"
652023
652026
  );
652024
652027
  if (existsSync137(namePath))
652025
- sponsorName = readFileSync110(namePath, "utf8").trim();
652028
+ sponsorName = readFileSync111(namePath, "utf8").trim();
652026
652029
  } catch {
652027
652030
  }
652028
652031
  if (!sponsorName) sponsorName = "Omnius Sponsor";
@@ -652126,7 +652129,7 @@ sleep 1
652126
652129
  );
652127
652130
  if (existsSync137(nexusPidFile)) {
652128
652131
  const nPid = parseInt(
652129
- readFileSync110(nexusPidFile, "utf8").trim(),
652132
+ readFileSync111(nexusPidFile, "utf8").trim(),
652130
652133
  10
652131
652134
  );
652132
652135
  if (nPid > 0) {
@@ -653425,7 +653428,7 @@ sleep 1
653425
653428
  if (existsSync137(projectSettingsPath)) {
653426
653429
  try {
653427
653430
  const projectJson = JSON.parse(
653428
- readFileSync110(projectSettingsPath, "utf8")
653431
+ readFileSync111(projectSettingsPath, "utf8")
653429
653432
  );
653430
653433
  projectHasKey = typeof projectJson?.telegramKey === "string" && projectJson.telegramKey.length > 0;
653431
653434
  } catch {
@@ -659144,7 +659147,7 @@ async function discoverSponsorMediaCandidates(ctx3, modality) {
659144
659147
  "known-sponsors.json"
659145
659148
  );
659146
659149
  if (existsSync137(knownFile)) {
659147
- const saved = JSON.parse(readFileSync110(knownFile, "utf8"));
659150
+ const saved = JSON.parse(readFileSync111(knownFile, "utf8"));
659148
659151
  if (Array.isArray(saved)) rawSponsors.push(...saved);
659149
659152
  }
659150
659153
  } catch {
@@ -659294,7 +659297,7 @@ async function collectSponsorMediaStream(args) {
659294
659297
  while (!done && Date.now() < deadline) {
659295
659298
  await new Promise((resolve76) => setTimeout(resolve76, 250));
659296
659299
  if (!existsSync137(args.streamFile)) continue;
659297
- const raw = readFileSync110(args.streamFile, "utf8");
659300
+ const raw = readFileSync111(args.streamFile, "utf8");
659298
659301
  if (raw.length <= offset) continue;
659299
659302
  pending2 += raw.slice(offset);
659300
659303
  offset = raw.length;
@@ -659618,7 +659621,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
659618
659621
  try {
659619
659622
  if (existsSync137(knownFile)) {
659620
659623
  const saved = JSON.parse(
659621
- readFileSync110(knownFile, "utf8")
659624
+ readFileSync111(knownFile, "utf8")
659622
659625
  );
659623
659626
  for (const s2 of saved) {
659624
659627
  if (!sponsors.some((sp) => sp.url === s2.url)) {
@@ -659794,7 +659797,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
659794
659797
  const saveKey = selected.url || selected.peerId || selected.name;
659795
659798
  try {
659796
659799
  mkdirSync83(sponsorDir2, { recursive: true });
659797
- const existing = existsSync137(knownFile) ? JSON.parse(readFileSync110(knownFile, "utf8")) : [];
659800
+ const existing = existsSync137(knownFile) ? JSON.parse(readFileSync111(knownFile, "utf8")) : [];
659798
659801
  const updated = existing.filter(
659799
659802
  (s2) => (s2.url || s2.peerId || s2.name) !== saveKey
659800
659803
  );
@@ -661218,9 +661221,9 @@ async function handleUpdate(subcommand, ctx3) {
661218
661221
  (async () => {
661219
661222
  try {
661220
661223
  const prefix = await execA("npm prefix -g", { timeout: 5e3 });
661221
- const { accessSync: accessSync3, constants: constants3 } = await import("node:fs");
661224
+ const { accessSync: accessSync2, constants: constants2 } = await import("node:fs");
661222
661225
  try {
661223
- accessSync3(prefix, constants3.W_OK);
661226
+ accessSync2(prefix, constants2.W_OK);
661224
661227
  return false;
661225
661228
  } catch {
661226
661229
  return true;
@@ -662067,16 +662070,8 @@ async function handleUpdate(subcommand, ctx3) {
662067
662070
  } else {
662068
662071
  installOverlay.setStatus("cloudflared ready");
662069
662072
  }
662070
- installOverlay.setStatus("Checking transcribe-cli...");
662071
- if (!await commandExists2("transcribe-cli", 3e3)) {
662072
- await withTransientTerminalPrivilegePrompt(
662073
- ctx3,
662074
- "Installing transcribe-cli may need administrator privileges.",
662075
- () => ensureTranscribeCliBackground()
662076
- ).catch(() => false);
662077
- } else {
662078
- await ensureTranscribeCliBackground().catch(() => false);
662079
- }
662073
+ installOverlay.setStatus("Checking managed transcribe-cli runtime...");
662074
+ await ensureTranscribeCliBackground().catch(() => false);
662080
662075
  installOverlay.setStatus("cloudflared/transcribe checks complete");
662081
662076
  }
662082
662077
  if (!primaryUpdated) {
@@ -662908,7 +662903,7 @@ var init_commands = __esm({
662908
662903
  });
662909
662904
 
662910
662905
  // packages/cli/src/tui/project-context.ts
662911
- import { existsSync as existsSync138, readFileSync as readFileSync111, readdirSync as readdirSync47, mkdirSync as mkdirSync84, statSync as statSync52, writeFileSync as writeFileSync73 } from "node:fs";
662906
+ import { existsSync as existsSync138, readFileSync as readFileSync112, readdirSync as readdirSync47, mkdirSync as mkdirSync84, statSync as statSync52, writeFileSync as writeFileSync73 } from "node:fs";
662912
662907
  import { dirname as dirname47, join as join152, basename as basename29, resolve as resolve62 } from "node:path";
662913
662908
  import { homedir as homedir52 } from "node:os";
662914
662909
  function projectContextUrlSpanAt(text2, index) {
@@ -662959,7 +662954,7 @@ function loadProjectMap(repoRoot) {
662959
662954
  const mapPath2 = join152(repoRoot, OMNIUS_DIR, "context", "project-map.md");
662960
662955
  if (existsSync138(mapPath2)) {
662961
662956
  try {
662962
- const content = readFileSync111(mapPath2, "utf-8");
662957
+ const content = readFileSync112(mapPath2, "utf-8");
662963
662958
  return content;
662964
662959
  } catch {
662965
662960
  }
@@ -662972,7 +662967,7 @@ function findGitDir(repoRoot) {
662972
662967
  const gitPath = join152(dir, ".git");
662973
662968
  if (existsSync138(gitPath)) {
662974
662969
  try {
662975
- const raw = readFileSync111(gitPath, "utf8").trim();
662970
+ const raw = readFileSync112(gitPath, "utf8").trim();
662976
662971
  const match = raw.match(/^gitdir:\s*(.+)$/i);
662977
662972
  if (match?.[1]) {
662978
662973
  return resolve62(dir, match[1]);
@@ -662992,12 +662987,12 @@ function getGitInfo(repoRoot) {
662992
662987
  if (!gitDir) return "";
662993
662988
  const lines = [];
662994
662989
  try {
662995
- const head = readFileSync111(join152(gitDir, "HEAD"), "utf-8").trim();
662990
+ const head = readFileSync112(join152(gitDir, "HEAD"), "utf-8").trim();
662996
662991
  const refMatch = head.match(/^ref:\s+refs\/heads\/(.+)$/);
662997
662992
  if (refMatch?.[1]) {
662998
662993
  lines.push(`Branch: ${refMatch[1]}`);
662999
662994
  try {
663000
- const refHash = readFileSync111(join152(gitDir, "refs", "heads", refMatch[1]), "utf-8").trim();
662995
+ const refHash = readFileSync112(join152(gitDir, "refs", "heads", refMatch[1]), "utf-8").trim();
663001
662996
  if (refHash) lines.push(`HEAD: ${refHash.slice(0, 12)}`);
663002
662997
  } catch {
663003
662998
  }
@@ -663025,7 +663020,7 @@ function countJsonMemoryEntries(dir) {
663025
663020
  if (!file.endsWith(".json")) continue;
663026
663021
  topics++;
663027
663022
  try {
663028
- const parsed = JSON.parse(readFileSync111(join152(dir, file), "utf8"));
663023
+ const parsed = JSON.parse(readFileSync112(join152(dir, file), "utf8"));
663029
663024
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
663030
663025
  entries += Object.keys(parsed).length;
663031
663026
  }
@@ -663041,7 +663036,7 @@ function countReflectionBuffer(repoRoot) {
663041
663036
  const path12 = join152(repoRoot, OMNIUS_DIR, "memory", "reflections.json");
663042
663037
  if (!existsSync138(path12)) return 0;
663043
663038
  try {
663044
- const parsed = JSON.parse(readFileSync111(path12, "utf8"));
663039
+ const parsed = JSON.parse(readFileSync112(path12, "utf8"));
663045
663040
  return Array.isArray(parsed.reflections) ? parsed.reflections.length : 0;
663046
663041
  } catch {
663047
663042
  return 0;
@@ -663050,7 +663045,7 @@ function countReflectionBuffer(repoRoot) {
663050
663045
  function countJsonlLines(path12, maxBytes = 1e6) {
663051
663046
  if (!existsSync138(path12)) return 0;
663052
663047
  try {
663053
- const text2 = readFileSync111(path12, "utf8").slice(-maxBytes);
663048
+ const text2 = readFileSync112(path12, "utf8").slice(-maxBytes);
663054
663049
  return text2.split(/\r?\n/).filter((line) => line.trim()).length;
663055
663050
  } catch {
663056
663051
  return 0;
@@ -663094,7 +663089,7 @@ function loadMemoryContextBundle(repoRoot, task = "", taskEmbedding) {
663094
663089
  const files = readdirSync47(dir).filter((f2) => f2.endsWith(".json"));
663095
663090
  for (const file of files.slice(0, 10)) {
663096
663091
  try {
663097
- const raw = readFileSync111(join152(dir, file), "utf-8");
663092
+ const raw = readFileSync112(join152(dir, file), "utf-8");
663098
663093
  const entries = JSON.parse(raw);
663099
663094
  const topic = basename29(file, ".json");
663100
663095
  for (const [k, v] of Object.entries(entries)) {
@@ -663584,7 +663579,7 @@ function extractMakeBootstrapTargets(repoRoot) {
663584
663579
  const makefile = ["Makefile", "makefile"].find((name10) => existsSync138(join152(repoRoot, name10)));
663585
663580
  if (!makefile) return [];
663586
663581
  try {
663587
- const text2 = readFileSync111(join152(repoRoot, makefile), "utf8");
663582
+ const text2 = readFileSync112(join152(repoRoot, makefile), "utf8");
663588
663583
  const targets = [];
663589
663584
  for (const line of text2.split(/\r?\n/)) {
663590
663585
  const match = line.match(/^([A-Za-z0-9_.-]+)\s*:(?![=])/);
@@ -663728,7 +663723,7 @@ function loadCustomToolsContext(repoRoot) {
663728
663723
  const registryPath = join152(repoRoot, ".omnius", "tools", "registry.json");
663729
663724
  const indexPath = join152(repoRoot, ".omnius", "tools", "README.md");
663730
663725
  if (!existsSync138(registryPath)) return "";
663731
- const registry4 = JSON.parse(readFileSync111(registryPath, "utf-8"));
663726
+ const registry4 = JSON.parse(readFileSync112(registryPath, "utf-8"));
663732
663727
  const tools = (registry4.tools ?? []).filter((tool) => tool.qualityGate?.lastTest?.status === "passed").sort((a2, b) => {
663733
663728
  const byRate = (b.analytics?.successRate ?? 0) - (a2.analytics?.successRate ?? 0);
663734
663729
  if (byRate !== 0) return byRate;
@@ -663904,7 +663899,7 @@ var init_project_context = __esm({
663904
663899
  });
663905
663900
 
663906
663901
  // packages/cli/src/realtime.ts
663907
- import { existsSync as existsSync139, readFileSync as readFileSync112, readdirSync as readdirSync48 } from "node:fs";
663902
+ import { existsSync as existsSync139, readFileSync as readFileSync113, readdirSync as readdirSync48 } from "node:fs";
663908
663903
  import { basename as basename30, join as join153, resolve as resolve63 } from "node:path";
663909
663904
  function clampInt2(value2, fallback, min, max) {
663910
663905
  const n2 = typeof value2 === "number" ? value2 : Number.parseInt(String(value2 ?? ""), 10);
@@ -663926,7 +663921,7 @@ function firstReadable(candidates) {
663926
663921
  for (const path12 of candidates) {
663927
663922
  if (!existsSync139(path12)) continue;
663928
663923
  try {
663929
- return { path: path12, content: readFileSync112(path12, "utf8") };
663924
+ return { path: path12, content: readFileSync113(path12, "utf8") };
663930
663925
  } catch {
663931
663926
  return null;
663932
663927
  }
@@ -663949,7 +663944,7 @@ function projectVoice(repoRoot) {
663949
663944
  return ap - bp || a2.localeCompare(b);
663950
663945
  });
663951
663946
  const first2 = files[0];
663952
- return first2 ? { path: join153(voiceDir3, first2), content: readFileSync112(join153(voiceDir3, first2), "utf8") } : null;
663947
+ return first2 ? { path: join153(voiceDir3, first2), content: readFileSync113(join153(voiceDir3, first2), "utf8") } : null;
663953
663948
  } catch {
663954
663949
  return null;
663955
663950
  }
@@ -664137,7 +664132,7 @@ __export(chat_session_exports, {
664137
664132
  import { randomUUID as randomUUID18 } from "node:crypto";
664138
664133
  import {
664139
664134
  existsSync as existsSync140,
664140
- readFileSync as readFileSync113,
664135
+ readFileSync as readFileSync114,
664141
664136
  readdirSync as readdirSync49,
664142
664137
  writeFileSync as writeFileSync74,
664143
664138
  renameSync as renameSync13,
@@ -664246,7 +664241,7 @@ function normalizeLoadedSession(parsed) {
664246
664241
  }
664247
664242
  function readSessionFile(fp) {
664248
664243
  try {
664249
- const parsed = JSON.parse(readFileSync113(fp, "utf-8"));
664244
+ const parsed = JSON.parse(readFileSync114(fp, "utf-8"));
664250
664245
  if (!parsed || typeof parsed !== "object" || !parsed.id) return null;
664251
664246
  return normalizeLoadedSession(parsed);
664252
664247
  } catch {
@@ -664279,7 +664274,7 @@ function loadPersistedSessions() {
664279
664274
  if (!f2.endsWith(".json") || f2.includes(".tmp.")) continue;
664280
664275
  const fp = join154(dir, f2);
664281
664276
  try {
664282
- const parsed = JSON.parse(readFileSync113(fp, "utf-8"));
664277
+ const parsed = JSON.parse(readFileSync114(fp, "utf-8"));
664283
664278
  if (f2.endsWith(".inflight.json")) {
664284
664279
  if (parsed && parsed.pid && parsed.status === "running") {
664285
664280
  try {
@@ -664321,7 +664316,7 @@ function buildSystemPrompt(cwd4) {
664321
664316
  const diaryPath = join154(cwd4, ".omnius", "context", "session-diary.md");
664322
664317
  if (existsSync140(diaryPath)) {
664323
664318
  try {
664324
- const diary = readFileSync113(diaryPath, "utf-8").slice(0, 1e3);
664319
+ const diary = readFileSync114(diaryPath, "utf-8").slice(0, 1e3);
664325
664320
  parts.push(`\\nPrevious session history:\\n${diary}`);
664326
664321
  } catch {
664327
664322
  }
@@ -664336,7 +664331,7 @@ function buildSystemPrompt(cwd4) {
664336
664331
  );
664337
664332
  for (const f2 of files.slice(0, 3)) {
664338
664333
  try {
664339
- const data = JSON.parse(readFileSync113(join154(memDir, f2), "utf-8"));
664334
+ const data = JSON.parse(readFileSync114(join154(memDir, f2), "utf-8"));
664340
664335
  const entries = Object.entries(data).slice(0, 3);
664341
664336
  if (entries.length > 0) {
664342
664337
  parts.push(
@@ -664356,7 +664351,7 @@ function buildSystemPrompt(cwd4) {
664356
664351
  const p2 = join154(cwd4, name10);
664357
664352
  if (existsSync140(p2)) {
664358
664353
  try {
664359
- const content = readFileSync113(p2, "utf-8").slice(0, 500);
664354
+ const content = readFileSync114(p2, "utf-8").slice(0, 500);
664360
664355
  parts.push(`\\nProject instructions (${name10}):\\n${content}`);
664361
664356
  } catch {
664362
664357
  }
@@ -664378,7 +664373,7 @@ function getSession2(sessionId, model, cwd4) {
664378
664373
  try {
664379
664374
  const fp = sessionPath(sessionId);
664380
664375
  if (existsSync140(fp)) {
664381
- const parsed = normalizeLoadedSession(JSON.parse(readFileSync113(fp, "utf-8")));
664376
+ const parsed = normalizeLoadedSession(JSON.parse(readFileSync114(fp, "utf-8")));
664382
664377
  if (parsed && parsed.id === sessionId) {
664383
664378
  parsed.lastActivity = Date.now();
664384
664379
  if (canonicalRoot && !parsed.projectRoot) parsed.projectRoot = canonicalRoot;
@@ -664565,7 +664560,7 @@ function drainCheckins(sessionId) {
664565
664560
  const fp = checkinPath(sessionId);
664566
664561
  if (!existsSync140(fp)) return [];
664567
664562
  try {
664568
- const raw = readFileSync113(fp, "utf-8");
664563
+ const raw = readFileSync114(fp, "utf-8");
664569
664564
  try {
664570
664565
  unlinkSync29(fp);
664571
664566
  } catch {
@@ -664631,7 +664626,7 @@ function lookupSession(id2) {
664631
664626
  try {
664632
664627
  const fp = sessionPath(id2);
664633
664628
  if (existsSync140(fp)) {
664634
- const parsed = normalizeLoadedSession(JSON.parse(readFileSync113(fp, "utf-8")));
664629
+ const parsed = normalizeLoadedSession(JSON.parse(readFileSync114(fp, "utf-8")));
664635
664630
  if (parsed && parsed.id === id2) {
664636
664631
  sessions2.set(id2, parsed);
664637
664632
  return parsed;
@@ -664684,7 +664679,7 @@ function getInFlightChat(sessionId) {
664684
664679
  try {
664685
664680
  const p2 = inFlightPath(sessionId);
664686
664681
  if (existsSync140(p2)) {
664687
- const parsed = JSON.parse(readFileSync113(p2, "utf-8"));
664682
+ const parsed = JSON.parse(readFileSync114(p2, "utf-8"));
664688
664683
  if (parsed && parsed.sessionId === sessionId) {
664689
664684
  return parsed;
664690
664685
  }
@@ -666089,7 +666084,7 @@ __export(banner_exports, {
666089
666084
  setBannerWriter: () => setBannerWriter,
666090
666085
  setGridText: () => setGridText
666091
666086
  });
666092
- import { existsSync as existsSync142, readFileSync as readFileSync114, writeFileSync as writeFileSync75, mkdirSync as mkdirSync86 } from "node:fs";
666087
+ import { existsSync as existsSync142, readFileSync as readFileSync115, writeFileSync as writeFileSync75, mkdirSync as mkdirSync86 } from "node:fs";
666093
666088
  import { join as join155 } from "node:path";
666094
666089
  function setBannerWriter(writer) {
666095
666090
  chromeWrite3 = writer;
@@ -666231,7 +666226,7 @@ function loadBannerDesign(workDir, id2) {
666231
666226
  const file = join155(workDir, ".omnius", "banners", `${id2}.json`);
666232
666227
  if (!existsSync142(file)) return null;
666233
666228
  try {
666234
- return JSON.parse(readFileSync114(file, "utf8"));
666229
+ return JSON.parse(readFileSync115(file, "utf8"));
666235
666230
  } catch {
666236
666231
  return null;
666237
666232
  }
@@ -666561,13 +666556,13 @@ var init_banner = __esm({
666561
666556
  });
666562
666557
 
666563
666558
  // packages/cli/src/tui/carousel-descriptors.ts
666564
- import { existsSync as existsSync143, readFileSync as readFileSync115, writeFileSync as writeFileSync76, mkdirSync as mkdirSync87, readdirSync as readdirSync50 } from "node:fs";
666559
+ import { existsSync as existsSync143, readFileSync as readFileSync116, writeFileSync as writeFileSync76, mkdirSync as mkdirSync87, readdirSync as readdirSync50 } from "node:fs";
666565
666560
  import { join as join156, basename as basename33 } from "node:path";
666566
666561
  function loadToolProfile(repoRoot) {
666567
666562
  const filePath = join156(repoRoot, OMNIUS_DIR, "context", TOOL_PROFILE_FILE);
666568
666563
  try {
666569
666564
  if (!existsSync143(filePath)) return null;
666570
- return JSON.parse(readFileSync115(filePath, "utf-8"));
666565
+ return JSON.parse(readFileSync116(filePath, "utf-8"));
666571
666566
  } catch {
666572
666567
  return null;
666573
666568
  }
@@ -666633,7 +666628,7 @@ function loadCachedDescriptors(repoRoot) {
666633
666628
  const filePath = join156(repoRoot, OMNIUS_DIR, "context", DESCRIPTOR_FILE);
666634
666629
  try {
666635
666630
  if (!existsSync143(filePath)) return null;
666636
- const cached = JSON.parse(readFileSync115(filePath, "utf-8"));
666631
+ const cached = JSON.parse(readFileSync116(filePath, "utf-8"));
666637
666632
  return cached.phrases.length > 0 ? cached.phrases : null;
666638
666633
  } catch {
666639
666634
  return null;
@@ -666697,7 +666692,7 @@ function extractFromPackageJson(repoRoot, tags) {
666697
666692
  const pkgPath = join156(repoRoot, "package.json");
666698
666693
  try {
666699
666694
  if (!existsSync143(pkgPath)) return;
666700
- const pkg = JSON.parse(readFileSync115(pkgPath, "utf-8"));
666695
+ const pkg = JSON.parse(readFileSync116(pkgPath, "utf-8"));
666701
666696
  if (pkg.name && typeof pkg.name === "string") {
666702
666697
  const parts = pkg.name.replace(/^@/, "").split("/");
666703
666698
  for (const p2 of parts) tags.push(p2);
@@ -666768,7 +666763,7 @@ function extractFromMemory(repoRoot, tags) {
666768
666763
  const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
666769
666764
  tags.push(topic);
666770
666765
  try {
666771
- const data = JSON.parse(readFileSync115(join156(memoryDir, file), "utf-8"));
666766
+ const data = JSON.parse(readFileSync116(join156(memoryDir, file), "utf-8"));
666772
666767
  if (data && typeof data === "object") {
666773
666768
  const keys = Object.keys(data).slice(0, 3);
666774
666769
  for (const key of keys) {
@@ -667811,7 +667806,7 @@ var init_edit_history = __esm({
667811
667806
  });
667812
667807
 
667813
667808
  // packages/cli/src/tui/snr-engine.ts
667814
- import { existsSync as existsSync144, readdirSync as readdirSync51, readFileSync as readFileSync116, writeFileSync as writeFileSync77, mkdirSync as mkdirSync89, rmSync as rmSync13 } from "node:fs";
667809
+ import { existsSync as existsSync144, readdirSync as readdirSync51, readFileSync as readFileSync117, writeFileSync as writeFileSync77, mkdirSync as mkdirSync89, rmSync as rmSync13 } from "node:fs";
667815
667810
  import { join as join158, basename as basename34 } from "node:path";
667816
667811
  function computeDPrime(signalScores, noiseScores) {
667817
667812
  if (signalScores.length === 0 || noiseScores.length === 0) return 0;
@@ -668118,7 +668113,7 @@ Call task_complete with the JSON array when done.`,
668118
668113
  const topic = basename34(f2, ".json");
668119
668114
  if (topics.length > 0 && !topics.includes(topic)) continue;
668120
668115
  try {
668121
- const data = JSON.parse(readFileSync116(join158(dir, f2), "utf-8"));
668116
+ const data = JSON.parse(readFileSync117(join158(dir, f2), "utf-8"));
668122
668117
  for (const [key, val] of Object.entries(data)) {
668123
668118
  const value2 = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
668124
668119
  entries.push({ topic, key, value: value2 });
@@ -668220,7 +668215,7 @@ Call task_complete with the JSON array when done.`,
668220
668215
  const file = join158(memDir, `${topic}.json`);
668221
668216
  if (!existsSync144(file)) continue;
668222
668217
  try {
668223
- const data = JSON.parse(readFileSync116(file, "utf-8"));
668218
+ const data = JSON.parse(readFileSync117(file, "utf-8"));
668224
668219
  const moved = {};
668225
668220
  for (const key of keys) {
668226
668221
  if (key in data) {
@@ -668235,7 +668230,7 @@ Call task_complete with the JSON array when done.`,
668235
668230
  let archiveData = {};
668236
668231
  if (existsSync144(archiveFile)) {
668237
668232
  try {
668238
- archiveData = JSON.parse(readFileSync116(archiveFile, "utf-8"));
668233
+ archiveData = JSON.parse(readFileSync117(archiveFile, "utf-8"));
668239
668234
  } catch {
668240
668235
  }
668241
668236
  }
@@ -668274,7 +668269,7 @@ Call task_complete with the JSON array when done.`,
668274
668269
  });
668275
668270
 
668276
668271
  // packages/cli/src/tui/promptLoader.ts
668277
- import { readFileSync as readFileSync117, existsSync as existsSync145 } from "node:fs";
668272
+ import { readFileSync as readFileSync118, existsSync as existsSync145 } from "node:fs";
668278
668273
  import { join as join159, dirname as dirname49 } from "node:path";
668279
668274
  import { fileURLToPath as fileURLToPath21 } from "node:url";
668280
668275
  function loadPrompt3(promptPath, vars) {
@@ -668284,7 +668279,7 @@ function loadPrompt3(promptPath, vars) {
668284
668279
  if (!existsSync145(fullPath)) {
668285
668280
  throw new Error(`Prompt file not found: ${fullPath}`);
668286
668281
  }
668287
- content = readFileSync117(fullPath, "utf-8");
668282
+ content = readFileSync118(fullPath, "utf-8");
668288
668283
  cache7.set(promptPath, content);
668289
668284
  }
668290
668285
  if (!vars) return content;
@@ -668304,7 +668299,7 @@ var init_promptLoader3 = __esm({
668304
668299
  });
668305
668300
 
668306
668301
  // packages/cli/src/tui/dream-engine.ts
668307
- import { mkdirSync as mkdirSync90, writeFileSync as writeFileSync78, readFileSync as readFileSync118, existsSync as existsSync146, readdirSync as readdirSync52 } from "node:fs";
668302
+ import { mkdirSync as mkdirSync90, writeFileSync as writeFileSync78, readFileSync as readFileSync119, existsSync as existsSync146, readdirSync as readdirSync52 } from "node:fs";
668308
668303
  import { join as join160, basename as basename35 } from "node:path";
668309
668304
  function setDreamWriteContent(fn) {
668310
668305
  _dreamWriteContent = fn;
@@ -668320,7 +668315,7 @@ function loadAutoresearchMemory(repoRoot) {
668320
668315
  const memoryPath = join160(repoRoot, ".omnius", "memory", "autoresearch.json");
668321
668316
  if (!existsSync146(memoryPath)) return "";
668322
668317
  try {
668323
- const raw = readFileSync118(memoryPath, "utf-8");
668318
+ const raw = readFileSync119(memoryPath, "utf-8");
668324
668319
  const data = JSON.parse(raw);
668325
668320
  const sections = [];
668326
668321
  for (const key of AUTORESEARCH_MEMORY_KEYS) {
@@ -668555,7 +668550,7 @@ var init_dream_engine = __esm({
668555
668550
  if (!existsSync146(targetPath)) {
668556
668551
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
668557
668552
  }
668558
- let content = readFileSync118(targetPath, "utf-8");
668553
+ let content = readFileSync119(targetPath, "utf-8");
668559
668554
  if (!content.includes(oldStr)) {
668560
668555
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
668561
668556
  }
@@ -668643,7 +668638,7 @@ var init_dream_engine = __esm({
668643
668638
  if (!existsSync146(targetPath)) {
668644
668639
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
668645
668640
  }
668646
- let content = readFileSync118(targetPath, "utf-8");
668641
+ let content = readFileSync119(targetPath, "utf-8");
668647
668642
  if (!content.includes(oldStr)) {
668648
668643
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
668649
668644
  }
@@ -669607,7 +669602,7 @@ ${summary}` };
669607
669602
  try {
669608
669603
  let notes = [];
669609
669604
  if (existsSync146(notesPath)) {
669610
- notes = JSON.parse(readFileSync118(notesPath, "utf-8"));
669605
+ notes = JSON.parse(readFileSync119(notesPath, "utf-8"));
669611
669606
  }
669612
669607
  if (action === "add") {
669613
669608
  const note = {
@@ -670247,7 +670242,7 @@ var init_bless_engine = __esm({
670247
670242
  });
670248
670243
 
670249
670244
  // packages/cli/src/tui/dmn-engine.ts
670250
- import { existsSync as existsSync147, readFileSync as readFileSync119, writeFileSync as writeFileSync79, mkdirSync as mkdirSync91, readdirSync as readdirSync53, unlinkSync as unlinkSync30 } from "node:fs";
670245
+ import { existsSync as existsSync147, readFileSync as readFileSync120, writeFileSync as writeFileSync79, mkdirSync as mkdirSync91, readdirSync as readdirSync53, unlinkSync as unlinkSync30 } from "node:fs";
670251
670246
  import { join as join161, basename as basename36 } from "node:path";
670252
670247
  import { exec as exec6 } from "node:child_process";
670253
670248
  import { promisify as promisify8 } from "node:util";
@@ -671132,7 +671127,7 @@ If decision is GO, selectedTask MUST be a fully-populated object (NEVER null)
671132
671127
  const path12 = join161(this.stateDir, "state.json");
671133
671128
  if (existsSync147(path12)) {
671134
671129
  try {
671135
- this.state = JSON.parse(readFileSync119(path12, "utf-8"));
671130
+ this.state = JSON.parse(readFileSync120(path12, "utf-8"));
671136
671131
  } catch {
671137
671132
  }
671138
671133
  }
@@ -671166,7 +671161,7 @@ If decision is GO, selectedTask MUST be a fully-populated object (NEVER null)
671166
671161
  const latestByFingerprint = /* @__PURE__ */ new Map();
671167
671162
  for (const file of files) {
671168
671163
  try {
671169
- const parsed = JSON.parse(readFileSync119(join161(this.historyDir, file), "utf-8"));
671164
+ const parsed = JSON.parse(readFileSync120(join161(this.historyDir, file), "utf-8"));
671170
671165
  latestByFingerprint.set(this.fingerprintCycle(parsed), file);
671171
671166
  } catch {
671172
671167
  keep.add(file);
@@ -672844,7 +672839,7 @@ import { createCipheriv as createCipheriv5, createDecipheriv as createDecipheriv
672844
672839
  import {
672845
672840
  existsSync as existsSync148,
672846
672841
  mkdirSync as mkdirSync92,
672847
- readFileSync as readFileSync120,
672842
+ readFileSync as readFileSync121,
672848
672843
  statSync as statSync53,
672849
672844
  unlinkSync as unlinkSync31,
672850
672845
  writeFileSync as writeFileSync80
@@ -673074,7 +673069,7 @@ function scopedTool(base3, root, mode) {
673074
673069
  );
673075
673070
  if (!materialized.ok) return denied(materialized.error);
673076
673071
  mkdirSync92(dirname50(guarded.path.abs), { recursive: true });
673077
- writeFileSync80(guarded.path.abs, readFileSync120(materialized.path));
673072
+ writeFileSync80(guarded.path.abs, readFileSync121(materialized.path));
673078
673073
  materialized.cleanup?.();
673079
673074
  restoredEditPath = guarded.path.abs;
673080
673075
  }
@@ -673198,7 +673193,7 @@ function readManifest(root) {
673198
673193
  ensureManifest(root);
673199
673194
  try {
673200
673195
  const parsed = JSON.parse(
673201
- readFileSync120(manifestPath(root), "utf8")
673196
+ readFileSync121(manifestPath(root), "utf8")
673202
673197
  );
673203
673198
  const objects = parsed.objects && typeof parsed.objects === "object" ? Object.fromEntries(
673204
673199
  Object.entries(parsed.objects).filter(
@@ -673250,7 +673245,7 @@ function rememberCreated(root, absPath) {
673250
673245
  }
673251
673246
  }
673252
673247
  mkdirSync92(join162(root, OBJECTS_DIR), { recursive: true });
673253
- const data = readFileSync120(guarded.path.abs);
673248
+ const data = readFileSync121(guarded.path.abs);
673254
673249
  const prefix = randomBytes26(48);
673255
673250
  const key = randomBytes26(32);
673256
673251
  const iv = randomBytes26(12);
@@ -673306,7 +673301,7 @@ function materializeTelegramCreativeArtifactForSend(root, rawPath) {
673306
673301
  error: `Scoped artifact storage is missing for ${rel}.`
673307
673302
  };
673308
673303
  }
673309
- const blob = readFileSync120(storedAbs);
673304
+ const blob = readFileSync121(storedAbs);
673310
673305
  if (blob.length < object.prefixBytes) {
673311
673306
  return {
673312
673307
  ok: false,
@@ -674277,7 +674272,7 @@ import {
674277
674272
  existsSync as existsSync149,
674278
674273
  mkdirSync as mkdirSync93,
674279
674274
  readdirSync as readdirSync54,
674280
- readFileSync as readFileSync121,
674275
+ readFileSync as readFileSync122,
674281
674276
  writeFileSync as writeFileSync81,
674282
674277
  unlinkSync as unlinkSync32
674283
674278
  } from "node:fs";
@@ -675046,7 +675041,7 @@ function latestTelegramChannelDaydream(repoRoot, sessionKey) {
675046
675041
  for (const file of files.reverse()) {
675047
675042
  try {
675048
675043
  return JSON.parse(
675049
- readFileSync121(join163(dir, file), "utf8")
675044
+ readFileSync122(join163(dir, file), "utf8")
675050
675045
  );
675051
675046
  } catch {
675052
675047
  }
@@ -676784,7 +676779,7 @@ __export(vision_ingress_exports, {
676784
676779
  resolveVisionModel: () => resolveVisionModel,
676785
676780
  runVisionIngress: () => runVisionIngress
676786
676781
  });
676787
- import { existsSync as existsSync150, readFileSync as readFileSync122, unlinkSync as unlinkSync33 } from "node:fs";
676782
+ import { existsSync as existsSync150, readFileSync as readFileSync123, unlinkSync as unlinkSync33 } from "node:fs";
676788
676783
  import { join as join164 } from "node:path";
676789
676784
  async function isTesseractAvailable() {
676790
676785
  try {
@@ -676839,7 +676834,7 @@ async function advancedOcr(imagePath) {
676839
676834
  ], { timeout: 15e3 });
676840
676835
  const txtFile = `${outFile}.txt`;
676841
676836
  if (existsSync150(txtFile)) {
676842
- const text2 = readFileSync122(txtFile, "utf-8").trim();
676837
+ const text2 = readFileSync123(txtFile, "utf-8").trim();
676843
676838
  if (text2.length > 0) results.push(text2);
676844
676839
  try {
676845
676840
  unlinkSync33(txtFile);
@@ -677025,7 +677020,7 @@ import {
677025
677020
  readdirSync as readdirSync55,
677026
677021
  statSync as statSync54,
677027
677022
  statfsSync as statfsSync8,
677028
- readFileSync as readFileSync123,
677023
+ readFileSync as readFileSync124,
677029
677024
  writeFileSync as writeFileSync82,
677030
677025
  appendFileSync as appendFileSync18
677031
677026
  } from "node:fs";
@@ -683171,7 +683166,7 @@ ${mediaContext}` : ""
683171
683166
  const path12 = this.telegramConversationPath(sessionKey);
683172
683167
  if (!existsSync151(path12)) return;
683173
683168
  try {
683174
- const parsed = JSON.parse(readFileSync123(path12, "utf8"));
683169
+ const parsed = JSON.parse(readFileSync124(path12, "utf8"));
683175
683170
  const loadedHistory = Array.isArray(parsed.history) ? parsed.history : [];
683176
683171
  if (Array.isArray(parsed.history)) {
683177
683172
  this.chatHistory.set(
@@ -683385,7 +683380,7 @@ ${mediaContext}` : ""
683385
683380
  for (const file of readdirSync55(this.telegramConversationDir)) {
683386
683381
  if (!file.endsWith(".json")) continue;
683387
683382
  try {
683388
- const raw = readFileSync123(
683383
+ const raw = readFileSync124(
683389
683384
  join165(this.telegramConversationDir, file),
683390
683385
  "utf8"
683391
683386
  );
@@ -688072,7 +688067,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
688072
688067
  const lockFile = join165(lockDir, `bot-${botUserId}.owner.lock`);
688073
688068
  if (existsSync151(lockFile)) {
688074
688069
  try {
688075
- const prior = JSON.parse(readFileSync123(lockFile, "utf8"));
688070
+ const prior = JSON.parse(readFileSync124(lockFile, "utf8"));
688076
688071
  const priorAlive = typeof prior.pid === "number" && prior.pid !== process.pid ? this.processIsAlive(prior.pid) : false;
688077
688072
  if (priorAlive) {
688078
688073
  throw new Error(
@@ -688105,7 +688100,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
688105
688100
  try {
688106
688101
  if (!existsSync151(lockFile)) return;
688107
688102
  try {
688108
- const prior = JSON.parse(readFileSync123(lockFile, "utf8"));
688103
+ const prior = JSON.parse(readFileSync124(lockFile, "utf8"));
688109
688104
  if (prior.pid !== process.pid) return;
688110
688105
  } catch {
688111
688106
  }
@@ -693048,7 +693043,7 @@ Scoped workspace: ${scopedRoot}`,
693048
693043
  readTelegramToolButtonState(nonce) {
693049
693044
  try {
693050
693045
  const parsed = JSON.parse(
693051
- readFileSync123(this.telegramToolButtonPath(nonce), "utf-8")
693046
+ readFileSync124(this.telegramToolButtonPath(nonce), "utf-8")
693052
693047
  );
693053
693048
  if (!parsed || parsed.expiresAt < Date.now()) return null;
693054
693049
  return parsed;
@@ -694502,7 +694497,7 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
694502
694497
  const ingressResult = await runVisionIngress2(
694503
694498
  {
694504
694499
  path: localPath,
694505
- buffer: readFileSync123(localPath),
694500
+ buffer: readFileSync124(localPath),
694506
694501
  mime: telegramImageMime(media)
694507
694502
  },
694508
694503
  this.agentConfig?.model ?? ""
@@ -694897,7 +694892,7 @@ ${text2}`.trim()
694897
694892
  }
694898
694893
  if (!existsSync151(media.value))
694899
694894
  throw new Error(`File does not exist: ${media.value}`);
694900
- const buffer2 = readFileSync123(media.value);
694895
+ const buffer2 = readFileSync124(media.value);
694901
694896
  const boundary = `----omnius-media-${Date.now()}-${Math.random().toString(36).slice(2)}`;
694902
694897
  const filename = basename39(media.value);
694903
694898
  const contentType = mimeForPath(media.value, media.kind);
@@ -695011,7 +695006,7 @@ Content-Type: ${contentType}\r
695011
695006
  const sidecarPath2 = `${imagePath}.json`;
695012
695007
  if (!existsSync151(sidecarPath2)) return null;
695013
695008
  try {
695014
- const raw = readFileSync123(sidecarPath2, "utf8");
695009
+ const raw = readFileSync124(sidecarPath2, "utf8");
695015
695010
  const parsed = JSON.parse(raw);
695016
695011
  if (!parsed || typeof parsed !== "object" || typeof parsed["original_prompt"] !== "string") {
695017
695012
  return null;
@@ -695071,7 +695066,7 @@ Content-Type: ${contentType}\r
695071
695066
  const sidecarPath2 = `${videoPath}.json`;
695072
695067
  if (!existsSync151(sidecarPath2)) return null;
695073
695068
  try {
695074
- const raw = readFileSync123(sidecarPath2, "utf8");
695069
+ const raw = readFileSync124(sidecarPath2, "utf8");
695075
695070
  const parsed = JSON.parse(raw);
695076
695071
  if (!parsed || typeof parsed !== "object" || typeof parsed["original_prompt"] !== "string") {
695077
695072
  return null;
@@ -695216,7 +695211,7 @@ Content-Type: ${contentType}\r
695216
695211
  addField(field, pathOrFileId);
695217
695212
  continue;
695218
695213
  }
695219
- const buffer2 = readFileSync123(pathOrFileId);
695214
+ const buffer2 = readFileSync124(pathOrFileId);
695220
695215
  const filename = basename39(pathOrFileId);
695221
695216
  parts.push(Buffer.from(`--${boundary}\r
695222
695217
  `));
@@ -695869,7 +695864,10 @@ var init_task_manager_singleton = __esm({
695869
695864
  // packages/cli/src/tui/voicechat.ts
695870
695865
  var voicechat_exports = {};
695871
695866
  __export(voicechat_exports, {
695872
- VoiceChatSession: () => VoiceChatSession
695867
+ VoiceChatSession: () => VoiceChatSession,
695868
+ buildRealtimeVoiceMessages: () => buildRealtimeVoiceMessages,
695869
+ extractVoiceModelReply: () => extractVoiceModelReply,
695870
+ isLikelyAgentSpeechEcho: () => isLikelyAgentSpeechEcho
695873
695871
  });
695874
695872
  import { EventEmitter as EventEmitter12 } from "node:events";
695875
695873
  function clamp0116(x) {
@@ -695966,19 +695964,138 @@ function stripToolJsonLines(text2) {
695966
695964
  });
695967
695965
  return kept.join("\n").trim();
695968
695966
  }
695969
- var VAD_SILENCE_MS, MAX_SEGMENT_MS, MAX_CONTEXT_TURNS, SYSTEM_PROMPT2, MIN_SIGNAL_SCORE, NOISE_ONLY_RE, VoiceChatSession;
695967
+ function compactSpeechText(value2, maxLength = 8e3) {
695968
+ const text2 = String(value2 ?? "").replace(/\s+/g, " ").replace(/\s+([,.!?;:])/g, "$1").trim();
695969
+ return text2 ? text2.slice(0, maxLength) : "";
695970
+ }
695971
+ function comparableSpeechText(value2) {
695972
+ return String(value2 ?? "").toLowerCase().replace(/[^a-z0-9]+/g, " ").trim();
695973
+ }
695974
+ function comparableTokens(value2) {
695975
+ return comparableSpeechText(value2).split(/\s+/).filter(Boolean);
695976
+ }
695977
+ function jaccardSimilarity(aTokens, bTokens) {
695978
+ const a2 = new Set(aTokens);
695979
+ const b = new Set(bTokens);
695980
+ if (!a2.size || !b.size) return 0;
695981
+ let overlap = 0;
695982
+ for (const token of a2) if (b.has(token)) overlap++;
695983
+ return overlap / Math.max(1, Math.min(a2.size, b.size));
695984
+ }
695985
+ function isMostlyContainedInOrder(needleTokens, haystackTokens) {
695986
+ if (!needleTokens.length || !haystackTokens.length) return false;
695987
+ let index = 0;
695988
+ for (const token of haystackTokens) {
695989
+ if (token === needleTokens[index]) index++;
695990
+ if (index >= needleTokens.length) return true;
695991
+ }
695992
+ return false;
695993
+ }
695994
+ function isLikelyAgentSpeechEcho({
695995
+ heardText,
695996
+ agentText,
695997
+ elapsedMs: elapsedMs2
695998
+ }) {
695999
+ const heard = compactSpeechText(heardText, 1200);
696000
+ if (!heard) return { likelyEcho: false, echoSimilarity: 0, reason: "empty" };
696001
+ if (!Number.isFinite(elapsedMs2) || elapsedMs2 > AGENT_ECHO_WINDOW_MS) {
696002
+ return { likelyEcho: false, echoSimilarity: 0, reason: "outside_window" };
696003
+ }
696004
+ const heardTokens = comparableTokens(heard);
696005
+ const agentTokens = comparableTokens(agentText);
696006
+ if (!agentTokens.length) return { likelyEcho: false, echoSimilarity: 0, reason: "no_agent_speech" };
696007
+ const agentComparable = agentTokens.join(" ");
696008
+ const heardComparable = heardTokens.join(" ");
696009
+ const echoSimilarity = jaccardSimilarity(heardTokens, agentTokens);
696010
+ const exactEcho = Boolean(heardComparable && agentComparable && (agentComparable.includes(heardComparable) || heardComparable.includes(agentComparable)));
696011
+ const orderedEcho = heardTokens.length >= 3 && isMostlyContainedInOrder(heardTokens, agentTokens);
696012
+ const likelyEcho = echoSimilarity >= AGENT_ECHO_SIMILARITY || exactEcho || orderedEcho;
696013
+ return {
696014
+ likelyEcho,
696015
+ echoSimilarity,
696016
+ reason: likelyEcho ? "speaker_echo" : "pass"
696017
+ };
696018
+ }
696019
+ function clipVoiceReply(text2, maxLength = MAX_VOICE_REPLY_CHARS) {
696020
+ const cleaned = String(text2 || "").replace(/\s+/g, " ").replace(/^[`"']+|[`"']+$/g, "").trim();
696021
+ return cleaned ? cleaned.slice(0, maxLength) : "";
696022
+ }
696023
+ function tryParseJsonObject(value2) {
696024
+ const text2 = value2.trim();
696025
+ if (!text2.startsWith("{") || !text2.endsWith("}")) return null;
696026
+ try {
696027
+ const parsed = JSON.parse(text2);
696028
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
696029
+ } catch {
696030
+ return null;
696031
+ }
696032
+ }
696033
+ function extractVoiceModelReply(value2) {
696034
+ const cleaned = String(value2 ?? "").replace(/^\s*```(?:json)?/i, "").replace(/```\s*$/i, "").trim();
696035
+ const start2 = cleaned.indexOf("{");
696036
+ const end = cleaned.lastIndexOf("}");
696037
+ const embedded = tryParseJsonObject(cleaned) || (start2 >= 0 && end > start2 ? tryParseJsonObject(cleaned.slice(start2, end + 1)) : null);
696038
+ if (embedded && typeof embedded["text"] === "string") {
696039
+ const actionRaw = String(embedded["action"] ?? "speak").toLowerCase();
696040
+ const action = actionRaw === "hangup" ? "hangup" : actionRaw === "silent" || actionRaw === "none" ? "silent" : "speak";
696041
+ return {
696042
+ action,
696043
+ text: clipVoiceReply(embedded["text"]),
696044
+ structured: true,
696045
+ internalReason: typeof embedded["internal_reason"] === "string" ? clipVoiceReply(embedded["internal_reason"], 500) : typeof embedded["internalReason"] === "string" ? clipVoiceReply(embedded["internalReason"], 500) : null
696046
+ };
696047
+ }
696048
+ const text2 = cleaned.replace(/^\s*```(?:[a-z]+)?\s*\n?/i, "").replace(/\n?```\s*$/i, "").replace(/^(?:agent|assistant|ai|voice|speaker|reply)\s*:\s*/i, "").trim();
696049
+ return {
696050
+ action: text2 ? "speak" : "silent",
696051
+ text: clipVoiceReply(text2),
696052
+ structured: false,
696053
+ internalReason: null
696054
+ };
696055
+ }
696056
+ function isContextSnapshotTurn(turn) {
696057
+ return turn.role === "system" && turn.content.startsWith(CONTEXT_SNAPSHOT_PREFIX);
696058
+ }
696059
+ function isPinnedSystemTurn(turn) {
696060
+ return turn.role === "system" && (turn.content === SYSTEM_PROMPT2 || turn.content.startsWith("Available tools (emit one-line JSON:"));
696061
+ }
696062
+ function buildRealtimeVoiceMessages(turns, maxMessages = MAX_REALTIME_MODEL_MESSAGES) {
696063
+ const pinned = [];
696064
+ const dynamic = [];
696065
+ let latestSnapshot = null;
696066
+ for (const turn of turns) {
696067
+ if (isPinnedSystemTurn(turn) && !pinned.some((p2) => p2.content === turn.content)) {
696068
+ pinned.push(turn);
696069
+ } else if (isContextSnapshotTurn(turn)) {
696070
+ latestSnapshot = turn;
696071
+ } else {
696072
+ dynamic.push(turn);
696073
+ }
696074
+ }
696075
+ if (latestSnapshot) dynamic.push(latestSnapshot);
696076
+ const available = Math.max(0, maxMessages - pinned.length);
696077
+ return [...pinned, ...dynamic.slice(-available)];
696078
+ }
696079
+ var VAD_SILENCE_MS, MAX_SEGMENT_MS, SUMMARY_INJECTION_INTERVAL, MAX_CONTEXT_TURNS, MAX_REALTIME_MODEL_MESSAGES, CONTEXT_SNAPSHOT_PREFIX, MAX_VOICE_REPLY_CHARS, AGENT_ECHO_WINDOW_MS, AGENT_ECHO_SIMILARITY, SYSTEM_PROMPT2, MIN_SIGNAL_SCORE, NOISE_ONLY_RE, VoiceChatSession;
695970
696080
  var init_voicechat = __esm({
695971
696081
  "packages/cli/src/tui/voicechat.ts"() {
695972
696082
  "use strict";
695973
696083
  VAD_SILENCE_MS = 3e3;
695974
696084
  MAX_SEGMENT_MS = 6500;
696085
+ SUMMARY_INJECTION_INTERVAL = 4;
695975
696086
  MAX_CONTEXT_TURNS = 20;
696087
+ MAX_REALTIME_MODEL_MESSAGES = 16;
696088
+ CONTEXT_SNAPSHOT_PREFIX = "Context snapshot (read-only):";
696089
+ MAX_VOICE_REPLY_CHARS = 700;
696090
+ AGENT_ECHO_WINDOW_MS = 12e3;
696091
+ AGENT_ECHO_SIMILARITY = 0.72;
695976
696092
  SYSTEM_PROMPT2 = `You are a voice assistant having a live spoken conversation. Keep responses extremely brief — 1-2 sentences max. You're speaking aloud, not writing. Be conversational, direct, and helpful. Don't use markdown or formatting — just natural speech.
695977
696093
 
695978
696094
  Rules:
695979
696095
  - Never invent environment facts (cwd, OS, specs, repo state). If you need a precise fact from the main agent, request a tool by outputting on a single line EXACTLY one JSON object: {"tool": string, "args": object} and nothing else. Then wait for the tool result before answering.
695980
696096
  - You may also request to relay a user task to the main agent by emitting {"tool":"voice_to_main","args":{"message":"...","start":true}}.
695981
- - Prefer tools for factual queries; otherwise, answer directly with a short reply.`;
696097
+ - Prefer tools for factual queries; otherwise, answer directly with a short reply.
696098
+ - Internal notes must never be spoken. If you need an internal reason, return compact JSON: {"action":"speak","text":"exact words to speak aloud","internal_reason":"brief nonspoken reason"}.`;
695982
696099
  MIN_SIGNAL_SCORE = 0.4;
695983
696100
  NOISE_ONLY_RE = /^(?:[.·…\s,;:!?\-–—_()\[\]{}"'`]+|(?:uh|um|erm|hmm|mm+|uhh+|umm+)[\s.!?]*)+$/i;
695984
696101
  VoiceChatSession = class extends EventEmitter12 {
@@ -696008,6 +696125,8 @@ Rules:
696008
696125
  silenceTimer = null;
696009
696126
  maxSegmentTimer = null;
696010
696127
  lastSignalScore = null;
696128
+ listenPausedForResponse = false;
696129
+ lastAgentSpeech = null;
696011
696130
  // Abort control for inference
696012
696131
  abortController = null;
696013
696132
  // Callbacks
@@ -696083,6 +696202,10 @@ Rules:
696083
696202
  this.context.push({ role: "system", content: this.toolCatalogNote });
696084
696203
  }
696085
696204
  this.turnCount = 0;
696205
+ this.voiceTranscript = [];
696206
+ this.relayTranscript = [];
696207
+ this.lastAgentSpeech = null;
696208
+ this.listenPausedForResponse = false;
696086
696209
  if (this.verbose) this.onStatus("VoiceChat active — LISTENING");
696087
696210
  this._onTranscript = (...args) => {
696088
696211
  let text2;
@@ -696172,6 +696295,12 @@ Rules:
696172
696295
  if (this._state !== "LISTENING" && this._state !== "CAPTURING") {
696173
696296
  return;
696174
696297
  }
696298
+ const echo = this.classifyAgentEcho(text2);
696299
+ if (echo.likelyEcho) {
696300
+ if (this.debugSnr) this.onStatus(`Ignoring likely agent-speaker echo (${echo.echoSimilarity.toFixed(2)}): ${truncateForLog(text2, 48)}`);
696301
+ this.emit("voiceEchoFiltered", echo);
696302
+ return;
696303
+ }
696175
696304
  if (this._state === "LISTENING") {
696176
696305
  this.setState("CAPTURING");
696177
696306
  this.captureBuffer = "";
@@ -696222,6 +696351,7 @@ Rules:
696222
696351
  return;
696223
696352
  }
696224
696353
  this.setState("TRANSCRIBING");
696354
+ this.pauseListenForResponse();
696225
696355
  this.onUserSpeech(text2);
696226
696356
  this.voiceTranscript.push({ role: "user", content: text2, ts: Date.now() });
696227
696357
  this.context.push({ role: "user", content: text2 });
@@ -696232,9 +696362,7 @@ Rules:
696232
696362
  } catch {
696233
696363
  }
696234
696364
  }
696235
- while (this.context.length > MAX_CONTEXT_TURNS + 1) {
696236
- this.context.splice(1, 1);
696237
- }
696365
+ this.trimContext();
696238
696366
  this.think();
696239
696367
  }
696240
696368
  // ---------------------------------------------------------------------------
@@ -696245,18 +696373,20 @@ Rules:
696245
696373
  this.setState("THINKING");
696246
696374
  if (this.verbose) this.onStatus("Thinking...");
696247
696375
  this.abortController = new AbortController();
696376
+ const lastUser = this.latestUserText();
696248
696377
  try {
696249
696378
  if (this.toolRelay?.contextSnapshot) {
696250
696379
  try {
696251
696380
  const snap = await Promise.resolve(this.toolRelay.contextSnapshot());
696252
696381
  if (snap && snap.trim()) {
696382
+ this.dropTransientSystemTurns();
696253
696383
  this.context.push({ role: "system", content: `Context snapshot (read-only):
696254
696384
  ${snap.trim()}` });
696385
+ this.trimContext();
696255
696386
  }
696256
696387
  } catch {
696257
696388
  }
696258
696389
  }
696259
- const lastUser = [...this.context].reverse().find((m2) => m2.role === "user")?.content || "";
696260
696390
  let preAnswered = false;
696261
696391
  if (this.heuristicsEnabled && this.toolRelay && lastUser) {
696262
696392
  const lower = lastUser.toLowerCase();
@@ -696310,6 +696440,7 @@ ${out}` });
696310
696440
  }
696311
696441
  this.context.push({ role: "system", content: `Tool ${name10} result (authoritative):
696312
696442
  ${toolOutput}` });
696443
+ this.trimContext();
696313
696444
  }
696314
696445
  if (!this.active) return;
696315
696446
  if (this.heuristicsEnabled && this.toolRelay && /\b(can't|cannot)\b/i.test(response) && this.toolCatalogNote) {
@@ -696317,18 +696448,25 @@ ${toolOutput}` });
696317
696448
  response = await this.streamOllamaInference(this.abortController.signal);
696318
696449
  }
696319
696450
  if (response.trim()) {
696320
- const finalSpoken = stripToolJsonLines(response.trim());
696451
+ const reply = extractVoiceModelReply(stripToolJsonLines(response.trim()));
696452
+ const finalSpoken = reply.text;
696453
+ if (!finalSpoken || reply.action === "silent") {
696454
+ return;
696455
+ }
696456
+ if (typeof this.voice.waitUntilIdle === "function") {
696457
+ try {
696458
+ await this.voice.waitUntilIdle();
696459
+ } catch {
696460
+ }
696461
+ }
696321
696462
  this.context.push({ role: "assistant", content: finalSpoken });
696463
+ this.trimContext();
696322
696464
  this.setState("SPEAKING");
696323
696465
  this.onAgentSpeech(finalSpoken);
696324
- try {
696325
- this.listen.pause();
696326
- } catch {
696327
- }
696466
+ this.lastAgentSpeech = { text: finalSpoken, startedAt: Date.now() };
696328
696467
  this.voice.speak(finalSpoken);
696329
696468
  this.voiceTranscript.push({ role: "assistant", content: finalSpoken, ts: Date.now() });
696330
- this.voiceTranscript.push({ role: "assistant", content: response.trim(), ts: Date.now() });
696331
- if (this.runner) {
696469
+ if (this.runner && this.turnCount % SUMMARY_INJECTION_INTERVAL === 0) {
696332
696470
  this.injectSummary();
696333
696471
  }
696334
696472
  if (typeof this.voice.waitUntilIdle === "function") {
@@ -696337,9 +696475,12 @@ ${toolOutput}` });
696337
696475
  } catch {
696338
696476
  }
696339
696477
  } else {
696340
- const estimatedMs = Math.max(1500, response.length / 5 * (6e4 / 150));
696478
+ const estimatedMs = Math.max(1500, finalSpoken.length / 5 * (6e4 / 150));
696341
696479
  await new Promise((r2) => setTimeout(r2, estimatedMs));
696342
696480
  }
696481
+ if (reply.action === "hangup") {
696482
+ this.active = false;
696483
+ }
696343
696484
  }
696344
696485
  } catch (err) {
696345
696486
  if (!this.active) return;
@@ -696351,14 +696492,44 @@ ${toolOutput}` });
696351
696492
  this.abortController = null;
696352
696493
  }
696353
696494
  if (this.active) {
696354
- try {
696355
- await this.listen.resume();
696356
- } catch {
696357
- }
696495
+ await this.resumeListenAfterResponse();
696358
696496
  this.setState("LISTENING");
696359
696497
  if (this.verbose) this.onStatus("LISTENING...");
696360
696498
  }
696361
696499
  }
696500
+ latestUserText() {
696501
+ return [...this.context].reverse().find((m2) => m2.role === "user")?.content || "";
696502
+ }
696503
+ pauseListenForResponse() {
696504
+ if (this.listenPausedForResponse) return;
696505
+ try {
696506
+ this.listen.pause();
696507
+ } catch {
696508
+ }
696509
+ this.listenPausedForResponse = true;
696510
+ }
696511
+ async resumeListenAfterResponse() {
696512
+ if (!this.listenPausedForResponse) return;
696513
+ try {
696514
+ await this.listen.resume();
696515
+ } catch {
696516
+ }
696517
+ this.listenPausedForResponse = false;
696518
+ }
696519
+ classifyAgentEcho(text2) {
696520
+ const agentText = this.lastAgentSpeech?.text || "";
696521
+ const elapsedMs2 = this.lastAgentSpeech ? Date.now() - this.lastAgentSpeech.startedAt : Number.POSITIVE_INFINITY;
696522
+ return isLikelyAgentSpeechEcho({ heardText: text2, agentText, elapsedMs: elapsedMs2 });
696523
+ }
696524
+ dropTransientSystemTurns() {
696525
+ this.context = this.context.filter((turn) => !isContextSnapshotTurn(turn));
696526
+ }
696527
+ trimContext() {
696528
+ this.context = buildRealtimeVoiceMessages(this.context, MAX_CONTEXT_TURNS + 2);
696529
+ }
696530
+ buildRealtimeMessagesForRequest() {
696531
+ return buildRealtimeVoiceMessages(this.context, MAX_REALTIME_MODEL_MESSAGES);
696532
+ }
696362
696533
  /**
696363
696534
  * Stream inference. Tries native Ollama /api/chat first (supports think:false
696364
696535
  * for reasoning models), falls back to OpenAI-compat /v1/chat/completions.
@@ -696370,11 +696541,11 @@ ${toolOutput}` });
696370
696541
  try {
696371
696542
  const nativeBody = JSON.stringify({
696372
696543
  model: this.model,
696373
- messages: this.context,
696544
+ messages: this.buildRealtimeMessagesForRequest(),
696374
696545
  stream: true,
696375
696546
  think: false,
696376
696547
  // Disable reasoning — voice chat needs fast, direct responses
696377
- options: { temperature: 0.7, num_predict: 256 }
696548
+ options: { temperature: 0.5, num_predict: 192 }
696378
696549
  });
696379
696550
  const res2 = await fetch(`${baseUrl2}/api/chat`, {
696380
696551
  method: "POST",
@@ -696391,10 +696562,10 @@ ${toolOutput}` });
696391
696562
  }
696392
696563
  const openaiBody = JSON.stringify({
696393
696564
  model: this.model,
696394
- messages: this.context,
696565
+ messages: this.buildRealtimeMessagesForRequest(),
696395
696566
  stream: true,
696396
- temperature: 0.7,
696397
- max_tokens: 1024
696567
+ temperature: 0.5,
696568
+ max_tokens: 384
696398
696569
  });
696399
696570
  const endpoint = baseUrl2.includes("/v1") ? `${baseUrl2}/chat/completions` : `${baseUrl2}/v1/chat/completions`;
696400
696571
  const res = await fetch(endpoint, { method: "POST", headers, body: openaiBody, signal });
@@ -697004,14 +697175,14 @@ __export(projects_exports, {
697004
697175
  setCurrentProject: () => setCurrentProject,
697005
697176
  unregisterProject: () => unregisterProject
697006
697177
  });
697007
- import { readFileSync as readFileSync124, writeFileSync as writeFileSync83, mkdirSync as mkdirSync95, existsSync as existsSync152, statSync as statSync55, renameSync as renameSync14 } from "node:fs";
697178
+ import { readFileSync as readFileSync125, writeFileSync as writeFileSync83, mkdirSync as mkdirSync95, existsSync as existsSync152, statSync as statSync55, renameSync as renameSync14 } from "node:fs";
697008
697179
  import { homedir as homedir55 } from "node:os";
697009
697180
  import { basename as basename40, join as join166, resolve as resolve68 } from "node:path";
697010
697181
  import { randomUUID as randomUUID19 } from "node:crypto";
697011
697182
  function readAll2() {
697012
697183
  try {
697013
697184
  if (!existsSync152(PROJECTS_FILE)) return { projects: [], schemaVersion: 1 };
697014
- const raw = readFileSync124(PROJECTS_FILE, "utf8");
697185
+ const raw = readFileSync125(PROJECTS_FILE, "utf8");
697015
697186
  const parsed = JSON.parse(raw);
697016
697187
  if (!parsed || !Array.isArray(parsed.projects)) return { projects: [], schemaVersion: 1 };
697017
697188
  return { projects: parsed.projects, schemaVersion: 1 };
@@ -697088,7 +697259,7 @@ function getCurrentProject() {
697088
697259
  if (!currentRoot) {
697089
697260
  try {
697090
697261
  if (existsSync152(CURRENT_FILE)) {
697091
- const persisted = readFileSync124(CURRENT_FILE, "utf8").trim();
697262
+ const persisted = readFileSync125(CURRENT_FILE, "utf8").trim();
697092
697263
  if (persisted) currentRoot = persisted;
697093
697264
  }
697094
697265
  } catch {
@@ -698002,7 +698173,7 @@ var init_access_policy = __esm({
698002
698173
 
698003
698174
  // packages/cli/src/api/project-preferences.ts
698004
698175
  import { createHash as createHash43 } from "node:crypto";
698005
- import { existsSync as existsSync153, mkdirSync as mkdirSync96, readFileSync as readFileSync125, renameSync as renameSync15, writeFileSync as writeFileSync84, unlinkSync as unlinkSync35 } from "node:fs";
698176
+ import { existsSync as existsSync153, mkdirSync as mkdirSync96, readFileSync as readFileSync126, renameSync as renameSync15, writeFileSync as writeFileSync84, unlinkSync as unlinkSync35 } from "node:fs";
698006
698177
  import { homedir as homedir56 } from "node:os";
698007
698178
  import { join as join167, resolve as resolve69 } from "node:path";
698008
698179
  import { randomUUID as randomUUID20 } from "node:crypto";
@@ -698035,7 +698206,7 @@ function readProjectPreferences(root) {
698035
698206
  try {
698036
698207
  const file = prefsPath(root);
698037
698208
  if (!existsSync153(file)) return { ...DEFAULT_PREFS };
698038
- const raw = readFileSync125(file, "utf8");
698209
+ const raw = readFileSync126(file, "utf8");
698039
698210
  const parsed = JSON.parse(raw);
698040
698211
  if (!parsed || parsed.v !== SCHEMA_VERSION) return { ...DEFAULT_PREFS };
698041
698212
  return { ...DEFAULT_PREFS, ...parsed, v: SCHEMA_VERSION };
@@ -698102,7 +698273,7 @@ __export(audit_log_exports, {
698102
698273
  recordAudit: () => recordAudit,
698103
698274
  sanitizeBody: () => sanitizeBody
698104
698275
  });
698105
- import { mkdirSync as mkdirSync97, appendFileSync as appendFileSync19, readFileSync as readFileSync126, existsSync as existsSync154 } from "node:fs";
698276
+ import { mkdirSync as mkdirSync97, appendFileSync as appendFileSync19, readFileSync as readFileSync127, existsSync as existsSync154 } from "node:fs";
698106
698277
  import { join as join168 } from "node:path";
698107
698278
  function initAuditLog(omniusDir) {
698108
698279
  auditDir = join168(omniusDir, "audit");
@@ -698139,7 +698310,7 @@ function sanitizeBody(body, maxLen = 200) {
698139
698310
  function queryAudit(opts) {
698140
698311
  if (!initialized || !existsSync154(auditFile)) return [];
698141
698312
  try {
698142
- const raw = readFileSync126(auditFile, "utf-8");
698313
+ const raw = readFileSync127(auditFile, "utf-8");
698143
698314
  const lines = raw.split("\n").filter(Boolean);
698144
698315
  let records = lines.map((l2) => {
698145
698316
  try {
@@ -699112,7 +699283,7 @@ var init_direct_tool_registry = __esm({
699112
699283
  });
699113
699284
 
699114
699285
  // packages/cli/src/api/external-tool-registry.ts
699115
- import { existsSync as existsSync157, mkdirSync as mkdirSync100, readFileSync as readFileSync127, writeFileSync as writeFileSync85, renameSync as renameSync16 } from "node:fs";
699286
+ import { existsSync as existsSync157, mkdirSync as mkdirSync100, readFileSync as readFileSync128, writeFileSync as writeFileSync85, renameSync as renameSync16 } from "node:fs";
699116
699287
  import { join as join170 } from "node:path";
699117
699288
  function externalToolStorePath(workingDir) {
699118
699289
  return join170(workingDir, ".omnius", "external-tools.json");
@@ -699121,7 +699292,7 @@ function loadExternalTools(workingDir) {
699121
699292
  const path12 = externalToolStorePath(workingDir);
699122
699293
  if (!existsSync157(path12)) return [];
699123
699294
  try {
699124
- const parsed = JSON.parse(readFileSync127(path12, "utf-8"));
699295
+ const parsed = JSON.parse(readFileSync128(path12, "utf-8"));
699125
699296
  if (!parsed || !Array.isArray(parsed.tools)) return [];
699126
699297
  return parsed.tools.filter(
699127
699298
  (t2) => t2 && typeof t2.name === "string" && t2.transport != null
@@ -699460,7 +699631,7 @@ __export(aiwg_exports, {
699460
699631
  resolveAiwgRoot: () => resolveAiwgRoot,
699461
699632
  tryRouteAiwg: () => tryRouteAiwg
699462
699633
  });
699463
- import { existsSync as existsSync158, readFileSync as readFileSync128, readdirSync as readdirSync56, statSync as statSync58 } from "node:fs";
699634
+ import { existsSync as existsSync158, readFileSync as readFileSync129, readdirSync as readdirSync56, statSync as statSync58 } from "node:fs";
699464
699635
  import { join as join171 } from "node:path";
699465
699636
  import { homedir as homedir57 } from "node:os";
699466
699637
  import { execSync as execSync38 } from "node:child_process";
@@ -699531,7 +699702,7 @@ function resolveAiwgRoot() {
699531
699702
  const pj = join171(cur, "package.json");
699532
699703
  if (existsSync158(pj)) {
699533
699704
  try {
699534
- const pkg = JSON.parse(readFileSync128(pj, "utf-8"));
699705
+ const pkg = JSON.parse(readFileSync129(pj, "utf-8"));
699535
699706
  if (pkg.name === "aiwg") {
699536
699707
  _cachedAiwgRoot = cur;
699537
699708
  return cur;
@@ -699621,7 +699792,7 @@ function readFirstLineDescription(dir) {
699621
699792
  const p2 = join171(dir, candidate);
699622
699793
  if (!existsSync158(p2)) continue;
699623
699794
  try {
699624
- const txt = readFileSync128(p2, "utf-8");
699795
+ const txt = readFileSync129(p2, "utf-8");
699625
699796
  const descMatch = txt.match(/^description:\s*(.+)$/m);
699626
699797
  if (descMatch) return descMatch[1].trim().slice(0, 200);
699627
699798
  for (const line of txt.split("\n")) {
@@ -699672,7 +699843,7 @@ function walkForItems(dir, out, depth) {
699672
699843
  }
699673
699844
  function parseItem(p2) {
699674
699845
  try {
699675
- const raw = readFileSync128(p2, "utf-8");
699846
+ const raw = readFileSync129(p2, "utf-8");
699676
699847
  const header = raw.slice(0, 3e3);
699677
699848
  const nameMatch = header.match(/^name:\s*(.+)$/m);
699678
699849
  const descMatch = header.match(/^description:\s*(.+)$/m);
@@ -699711,7 +699882,7 @@ function deriveSource(p2) {
699711
699882
  function loadAiwgItemContent(path12, maxBytes = 2e4) {
699712
699883
  try {
699713
699884
  if (!existsSync158(path12)) return null;
699714
- const raw = readFileSync128(path12, "utf-8");
699885
+ const raw = readFileSync129(path12, "utf-8");
699715
699886
  return raw.length > maxBytes ? raw.slice(0, maxBytes) + "\n\n...(truncated for context budget)" : raw;
699716
699887
  } catch {
699717
699888
  return null;
@@ -700247,7 +700418,7 @@ __export(runtime_keys_exports, {
700247
700418
  mintKey: () => mintKey,
700248
700419
  revokeByPrefix: () => revokeByPrefix
700249
700420
  });
700250
- import { existsSync as existsSync159, readFileSync as readFileSync129, writeFileSync as writeFileSync86, mkdirSync as mkdirSync101, chmodSync as chmodSync5 } from "node:fs";
700421
+ import { existsSync as existsSync159, readFileSync as readFileSync130, writeFileSync as writeFileSync86, mkdirSync as mkdirSync101, chmodSync as chmodSync5 } from "node:fs";
700251
700422
  import { join as join172 } from "node:path";
700252
700423
  import { homedir as homedir58 } from "node:os";
700253
700424
  import { randomBytes as randomBytes28 } from "node:crypto";
@@ -700258,7 +700429,7 @@ function ensureDir2() {
700258
700429
  function loadAll() {
700259
700430
  if (!existsSync159(KEYS_FILE)) return [];
700260
700431
  try {
700261
- const raw = readFileSync129(KEYS_FILE, "utf-8");
700432
+ const raw = readFileSync130(KEYS_FILE, "utf-8");
700262
700433
  const parsed = JSON.parse(raw);
700263
700434
  if (!Array.isArray(parsed)) return [];
700264
700435
  return parsed;
@@ -700344,7 +700515,7 @@ __export(tor_fallback_exports, {
700344
700515
  torIsReachable: () => torIsReachable,
700345
700516
  tunnelViaTor: () => tunnelViaTor
700346
700517
  });
700347
- import { existsSync as existsSync160, readFileSync as readFileSync130 } from "node:fs";
700518
+ import { existsSync as existsSync160, readFileSync as readFileSync131 } from "node:fs";
700348
700519
  import { homedir as homedir59 } from "node:os";
700349
700520
  import { join as join173 } from "node:path";
700350
700521
  import { createConnection as createConnection3 } from "node:net";
@@ -700357,7 +700528,7 @@ function getLocalOnion() {
700357
700528
  for (const p2 of candidates) {
700358
700529
  try {
700359
700530
  if (existsSync160(p2)) {
700360
- const v = readFileSync130(p2, "utf-8").trim();
700531
+ const v = readFileSync131(p2, "utf-8").trim();
700361
700532
  if (v && v.endsWith(".onion")) return v;
700362
700533
  }
700363
700534
  } catch {
@@ -700618,7 +700789,7 @@ var init_graphical_sudo = __esm({
700618
700789
  });
700619
700790
 
700620
700791
  // packages/cli/src/api/routes-v1.ts
700621
- import { existsSync as existsSync162, mkdirSync as mkdirSync103, readFileSync as readFileSync131, readdirSync as readdirSync57, statSync as statSync59 } from "node:fs";
700792
+ import { existsSync as existsSync162, mkdirSync as mkdirSync103, readFileSync as readFileSync132, readdirSync as readdirSync57, statSync as statSync59 } from "node:fs";
700622
700793
  import { join as join175, resolve as pathResolve3 } from "node:path";
700623
700794
  import { homedir as homedir60 } from "node:os";
700624
700795
  async function tryRouteV1(ctx3) {
@@ -700902,7 +701073,7 @@ function walkForSkills(dir, out, depth) {
700902
701073
  walkForSkills(p2, out, depth + 1);
700903
701074
  } else if (e2.isFile() && e2.name === "SKILL.md") {
700904
701075
  try {
700905
- const content = readFileSync131(p2, "utf-8").slice(0, 2e3);
701076
+ const content = readFileSync132(p2, "utf-8").slice(0, 2e3);
700906
701077
  const nameMatch = content.match(/^name:\s*(.+)$/m);
700907
701078
  const descMatch = content.match(/^description:\s*(.+)$/m);
700908
701079
  out.push({
@@ -701858,7 +702029,7 @@ async function handleFilesRead(ctx3) {
701858
702029
  }));
701859
702030
  return true;
701860
702031
  }
701861
- const content = readFileSync131(resolved, "utf-8");
702032
+ const content = readFileSync132(resolved, "utf-8");
701862
702033
  const offset = typeof body.offset === "number" && body.offset >= 0 ? body.offset : 0;
701863
702034
  const limit = typeof body.limit === "number" && body.limit > 0 ? body.limit : content.length;
701864
702035
  const slice2 = content.slice(offset, offset + limit);
@@ -702160,7 +702331,7 @@ async function handleNexusStatus(ctx3) {
702160
702331
  for (const p2 of statePaths) {
702161
702332
  if (!existsSync162(p2)) continue;
702162
702333
  try {
702163
- const raw = readFileSync131(p2, "utf-8");
702334
+ const raw = readFileSync132(p2, "utf-8");
702164
702335
  states2.push({ source: p2, data: JSON.parse(raw) });
702165
702336
  } catch (e2) {
702166
702337
  states2.push({ source: p2, error: String(e2) });
@@ -702188,7 +702359,7 @@ async function handleNexusStatus(ctx3) {
702188
702359
  function loadAgentName() {
702189
702360
  try {
702190
702361
  const p2 = join175(homedir60(), ".omnius", "agent-name");
702191
- if (existsSync162(p2)) return readFileSync131(p2, "utf-8").trim();
702362
+ if (existsSync162(p2)) return readFileSync132(p2, "utf-8").trim();
702192
702363
  } catch {
702193
702364
  }
702194
702365
  return null;
@@ -702204,7 +702375,7 @@ async function handleSponsors(ctx3) {
702204
702375
  for (const p2 of candidates) {
702205
702376
  if (!existsSync162(p2)) continue;
702206
702377
  try {
702207
- const raw = JSON.parse(readFileSync131(p2, "utf-8"));
702378
+ const raw = JSON.parse(readFileSync132(p2, "utf-8"));
702208
702379
  if (Array.isArray(raw)) {
702209
702380
  sponsors = raw;
702210
702381
  break;
@@ -702284,7 +702455,7 @@ async function handleEvaluate(ctx3) {
702284
702455
  }));
702285
702456
  return true;
702286
702457
  }
702287
- const job = JSON.parse(readFileSync131(jobPath, "utf-8"));
702458
+ const job = JSON.parse(readFileSync132(jobPath, "utf-8"));
702288
702459
  sendJson2(res, 200, {
702289
702460
  run_id: runId,
702290
702461
  task: job.task,
@@ -702424,7 +702595,7 @@ async function handleMintKey(ctx3) {
702424
702595
  function _readStatusFile(p2) {
702425
702596
  if (!existsSync162(p2)) return null;
702426
702597
  try {
702427
- const data = JSON.parse(readFileSync131(p2, "utf-8"));
702598
+ const data = JSON.parse(readFileSync132(p2, "utf-8"));
702428
702599
  if (data?.connected && typeof data.peerId === "string" && data.peerId.length > 10) {
702429
702600
  const pid = Number(data.pid);
702430
702601
  if (pid > 0) {
@@ -702467,7 +702638,7 @@ function resolveLocalPeerId() {
702467
702638
  try {
702468
702639
  const regPath = join175(homedir60(), ".omnius", "nexus-registry.json");
702469
702640
  if (existsSync162(regPath)) {
702470
- const reg = JSON.parse(readFileSync131(regPath, "utf-8"));
702641
+ const reg = JSON.parse(readFileSync132(regPath, "utf-8"));
702471
702642
  const entries = Array.isArray(reg?.dirs) ? reg.dirs : [];
702472
702643
  for (const entry of entries) {
702473
702644
  const dir = typeof entry === "string" ? entry : entry?.dir;
@@ -703980,7 +704151,7 @@ function aimsDir() {
703980
704151
  function readAimsFile(name10, fallback) {
703981
704152
  try {
703982
704153
  const p2 = join175(aimsDir(), name10);
703983
- if (existsSync162(p2)) return JSON.parse(readFileSync131(p2, "utf-8"));
704154
+ if (existsSync162(p2)) return JSON.parse(readFileSync132(p2, "utf-8"));
703984
704155
  } catch {
703985
704156
  }
703986
704157
  return fallback;
@@ -704357,7 +704528,7 @@ async function handleAimsSuppliers(ctx3) {
704357
704528
  for (const p2 of sponsorPaths) {
704358
704529
  if (!existsSync162(p2)) continue;
704359
704530
  try {
704360
- const raw = JSON.parse(readFileSync131(p2, "utf-8"));
704531
+ const raw = JSON.parse(readFileSync132(p2, "utf-8"));
704361
704532
  const list = Array.isArray(raw) ? raw : raw?.sponsors ?? [];
704362
704533
  for (const s2 of list) {
704363
704534
  suppliers.push({
@@ -716313,7 +716484,7 @@ var init_auth_oidc = __esm({
716313
716484
  });
716314
716485
 
716315
716486
  // packages/cli/src/api/usage-tracker.ts
716316
- import { mkdirSync as mkdirSync104, readFileSync as readFileSync132, writeFileSync as writeFileSync88, existsSync as existsSync163 } from "node:fs";
716487
+ import { mkdirSync as mkdirSync104, readFileSync as readFileSync133, writeFileSync as writeFileSync88, existsSync as existsSync163 } from "node:fs";
716317
716488
  import { join as join176 } from "node:path";
716318
716489
  function initUsageTracker(omniusDir) {
716319
716490
  const dir = join176(omniusDir, "usage");
@@ -716321,7 +716492,7 @@ function initUsageTracker(omniusDir) {
716321
716492
  usageFile = join176(dir, "token-usage.json");
716322
716493
  try {
716323
716494
  if (existsSync163(usageFile)) {
716324
- store = JSON.parse(readFileSync132(usageFile, "utf-8"));
716495
+ store = JSON.parse(readFileSync133(usageFile, "utf-8"));
716325
716496
  }
716326
716497
  } catch {
716327
716498
  store = { providers: {}, lastSaved: "" };
@@ -717020,7 +717191,7 @@ import {
717020
717191
  createReadStream as createReadStream2,
717021
717192
  mkdirSync as mkdirSync106,
717022
717193
  writeFileSync as writeFileSync90,
717023
- readFileSync as readFileSync133,
717194
+ readFileSync as readFileSync134,
717024
717195
  readdirSync as readdirSync58,
717025
717196
  existsSync as existsSync165,
717026
717197
  watch as fsWatch4,
@@ -717052,7 +717223,7 @@ function getVersion3() {
717052
717223
  for (const pkgPath of candidates) {
717053
717224
  try {
717054
717225
  if (!existsSync165(pkgPath)) continue;
717055
- const pkg = JSON.parse(readFileSync133(pkgPath, "utf8"));
717226
+ const pkg = JSON.parse(readFileSync134(pkgPath, "utf8"));
717056
717227
  if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
717057
717228
  return pkg.version ?? "0.0.0";
717058
717229
  }
@@ -717468,7 +717639,7 @@ function isOriginAllowed(origin) {
717468
717639
  try {
717469
717640
  const accessFile = join179(homedir62(), ".omnius", "access");
717470
717641
  if (existsSync165(accessFile)) {
717471
- const persisted = readFileSync133(accessFile, "utf8").trim().toLowerCase();
717642
+ const persisted = readFileSync134(accessFile, "utf8").trim().toLowerCase();
717472
717643
  if (persisted === "any" || persisted === "lan" || persisted === "loopback") {
717473
717644
  accessMode = persisted;
717474
717645
  }
@@ -718320,7 +718491,7 @@ function loadJob(id2) {
718320
718491
  const file = join179(jobsDir(), `${id2}.json`);
718321
718492
  if (!existsSync165(file)) return null;
718322
718493
  try {
718323
- return JSON.parse(readFileSync133(file, "utf-8"));
718494
+ return JSON.parse(readFileSync134(file, "utf-8"));
718324
718495
  } catch {
718325
718496
  return null;
718326
718497
  }
@@ -718333,7 +718504,7 @@ function listJobs2() {
718333
718504
  for (const file of files) {
718334
718505
  try {
718335
718506
  jobs.push(
718336
- JSON.parse(readFileSync133(join179(dir, file), "utf-8"))
718507
+ JSON.parse(readFileSync134(join179(dir, file), "utf-8"))
718337
718508
  );
718338
718509
  } catch {
718339
718510
  }
@@ -718351,7 +718522,7 @@ function pruneOldJobs() {
718351
718522
  if (!file.endsWith(".json")) continue;
718352
718523
  const path12 = join179(dir, file);
718353
718524
  try {
718354
- const job = JSON.parse(readFileSync133(path12, "utf-8"));
718525
+ const job = JSON.parse(readFileSync134(path12, "utf-8"));
718355
718526
  if (job.status === "running") {
718356
718527
  kept++;
718357
718528
  continue;
@@ -720507,7 +720678,7 @@ function readUpdateState() {
720507
720678
  try {
720508
720679
  const p2 = updateStateFile();
720509
720680
  if (!existsSync165(p2)) return null;
720510
- return JSON.parse(readFileSync133(p2, "utf-8"));
720681
+ return JSON.parse(readFileSync134(p2, "utf-8"));
720511
720682
  } catch {
720512
720683
  return null;
720513
720684
  }
@@ -720812,7 +720983,7 @@ function handleV1UpdateStatus(res) {
720812
720983
  let exitCode = null;
720813
720984
  try {
720814
720985
  if (existsSync165(logPath3)) {
720815
- const raw = readFileSync133(logPath3, "utf-8");
720986
+ const raw = readFileSync134(logPath3, "utf-8");
720816
720987
  const m2 = raw.match(/__EXIT_CODE=(\d+)/);
720817
720988
  if (m2) exitCode = parseInt(m2[1], 10);
720818
720989
  logTail = raw.slice(-2e3);
@@ -723087,7 +723258,7 @@ async function handleRequest(req3, res, ollamaUrl, verbose, runtimeDefaults = {}
723087
723258
  if (!result) {
723088
723259
  jsonResponse(res, 500, {
723089
723260
  error: "transcribe_unavailable",
723090
- message: "transcribe-cli not installed; run `npm i -g transcribe-cli` or install via /listen first run"
723261
+ message: "ASR runtime unavailable; Omnius attempted managed transcribe-cli and Whisper fallback setup. Run /listen once or inspect ~/.omnius/runtimes/asr and ~/.omnius/venv."
723091
723262
  });
723092
723263
  return;
723093
723264
  }
@@ -725293,7 +725464,7 @@ function listScheduledTasks() {
725293
725464
  if (dir.endsWith(`${join179(".omnius", "scheduled")}`) || dir.includes(`${join179(".omnius", "scheduled")}`)) {
725294
725465
  const file = join179(dir, "tasks.json");
725295
725466
  try {
725296
- const raw = readFileSync133(file, "utf-8");
725467
+ const raw = readFileSync134(file, "utf-8");
725297
725468
  const json = JSON.parse(raw);
725298
725469
  const tasks = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
725299
725470
  tasks.forEach((t2, i2) => {
@@ -725391,7 +725562,7 @@ function setScheduledEnabled(id2, enabled2) {
725391
725562
  const target = tasks.find((t2) => t2.id === id2);
725392
725563
  if (!target) return false;
725393
725564
  try {
725394
- const raw = readFileSync133(target.file, "utf-8");
725565
+ const raw = readFileSync134(target.file, "utf-8");
725395
725566
  const json = JSON.parse(raw);
725396
725567
  const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
725397
725568
  if (!arr[target.index]) return false;
@@ -725424,7 +725595,7 @@ function deleteScheduledById(id2) {
725424
725595
  const target = tasks.find((t2) => t2.id === id2);
725425
725596
  if (!target) return false;
725426
725597
  try {
725427
- const raw = readFileSync133(target.file, "utf-8");
725598
+ const raw = readFileSync134(target.file, "utf-8");
725428
725599
  const json = JSON.parse(raw);
725429
725600
  const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
725430
725601
  if (!arr[target.index]) return false;
@@ -725649,7 +725820,7 @@ function reconcileScheduledTasks(apply) {
725649
725820
  try {
725650
725821
  let json = { tasks: [] };
725651
725822
  try {
725652
- const raw = readFileSync133(file, "utf-8");
725823
+ const raw = readFileSync134(file, "utf-8");
725653
725824
  json = JSON.parse(raw);
725654
725825
  } catch {
725655
725826
  }
@@ -726028,7 +726199,7 @@ function startApiServer(options2 = {}) {
726028
726199
  const sid = f2.replace(/\.json$/, "");
726029
726200
  try {
726030
726201
  const items = JSON.parse(
726031
- readFileSync133(join179(dir, f2), "utf-8")
726202
+ readFileSync134(join179(dir, f2), "utf-8")
726032
726203
  );
726033
726204
  if (Array.isArray(items)) {
726034
726205
  cache8.set(sid, new Map(items.map((t2) => [t2.id, t2])));
@@ -726062,7 +726233,7 @@ function startApiServer(options2 = {}) {
726062
726233
  }
726063
726234
  return;
726064
726235
  }
726065
- next = JSON.parse(readFileSync133(fp, "utf-8"));
726236
+ next = JSON.parse(readFileSync134(fp, "utf-8"));
726066
726237
  if (!Array.isArray(next)) return;
726067
726238
  } catch {
726068
726239
  return;
@@ -726125,7 +726296,7 @@ function startApiServer(options2 = {}) {
726125
726296
  if (!f2.endsWith(".json")) continue;
726126
726297
  try {
726127
726298
  const jobPath = join179(jobsDir3, f2);
726128
- const job = JSON.parse(readFileSync133(jobPath, "utf-8"));
726299
+ const job = JSON.parse(readFileSync134(jobPath, "utf-8"));
726129
726300
  const jobTime = new Date(
726130
726301
  job.startedAt ?? job.completedAt ?? 0
726131
726302
  ).getTime();
@@ -726147,8 +726318,8 @@ function startApiServer(options2 = {}) {
726147
726318
  if (useTls) {
726148
726319
  try {
726149
726320
  tlsOpts = {
726150
- cert: readFileSync133(resolve71(tlsCert)),
726151
- key: readFileSync133(resolve71(tlsKey))
726321
+ cert: readFileSync134(resolve71(tlsCert)),
726322
+ key: readFileSync134(resolve71(tlsKey))
726152
726323
  };
726153
726324
  } catch (e2) {
726154
726325
  log22(`
@@ -726161,7 +726332,7 @@ function startApiServer(options2 = {}) {
726161
726332
  try {
726162
726333
  const accessFile = join179(homedir62(), ".omnius", "access");
726163
726334
  if (existsSync165(accessFile)) {
726164
- const persisted = readFileSync133(accessFile, "utf8").trim();
726335
+ const persisted = readFileSync134(accessFile, "utf8").trim();
726165
726336
  const resolved = resolveAccessMode(persisted, host);
726166
726337
  if (resolved) runtimeAccessMode = resolved;
726167
726338
  }
@@ -726592,7 +726763,7 @@ function startApiServer(options2 = {}) {
726592
726763
  for (const rel of ["../package.json", "../../package.json", "../../../package.json", "../../../../package.json"]) {
726593
726764
  const p2 = join179(here, rel);
726594
726765
  if (existsSync165(p2)) {
726595
- const pkg = JSON.parse(readFileSync133(p2, "utf8"));
726766
+ const pkg = JSON.parse(readFileSync134(p2, "utf8"));
726596
726767
  if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
726597
726768
  return pkg.version ?? null;
726598
726769
  }
@@ -727608,7 +727779,7 @@ var clipboard_media_exports = {};
727608
727779
  __export(clipboard_media_exports, {
727609
727780
  pasteClipboardImageToFile: () => pasteClipboardImageToFile
727610
727781
  });
727611
- import { mkdirSync as mkdirSync107, readFileSync as readFileSync134, rmSync as rmSync15, writeFileSync as writeFileSync91 } from "node:fs";
727782
+ import { mkdirSync as mkdirSync107, readFileSync as readFileSync135, rmSync as rmSync15, writeFileSync as writeFileSync91 } from "node:fs";
727612
727783
  import { join as join180 } from "node:path";
727613
727784
  async function pasteClipboardImageToFile(repoRoot) {
727614
727785
  const image = await readClipboardImage();
@@ -727625,7 +727796,7 @@ async function readClipboardImage() {
727625
727796
  if (!await commandExists2("pngpaste", 1e3)) return null;
727626
727797
  const tmp = `/tmp/omnius-clipboard-${Date.now()}.png`;
727627
727798
  await execFileBuffer("pngpaste", [tmp], { timeout: 3e3 });
727628
- const buffer2 = readFileSync134(tmp);
727799
+ const buffer2 = readFileSync135(tmp);
727629
727800
  try {
727630
727801
  rmSync15(tmp);
727631
727802
  } catch {
@@ -727685,7 +727856,7 @@ import { resolve as resolve72, join as join181, dirname as dirname54, extname as
727685
727856
  import { createRequire as createRequire9 } from "node:module";
727686
727857
  import { fileURLToPath as fileURLToPath24 } from "node:url";
727687
727858
  import {
727688
- readFileSync as readFileSync135,
727859
+ readFileSync as readFileSync136,
727689
727860
  writeFileSync as writeFileSync92,
727690
727861
  appendFileSync as appendFileSync20,
727691
727862
  rmSync as rmSync16,
@@ -729166,7 +729337,7 @@ function gatherMemorySnippets(root) {
729166
729337
  if (!existsSync166(dir)) continue;
729167
729338
  try {
729168
729339
  for (const f2 of readdirSync59(dir).filter((f3) => f3.endsWith(".json"))) {
729169
- const data = JSON.parse(readFileSync135(join181(dir, f2), "utf-8"));
729340
+ const data = JSON.parse(readFileSync136(join181(dir, f2), "utf-8"));
729170
729341
  for (const val of Object.values(data)) {
729171
729342
  const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
729172
729343
  if (v.length > 10) snippets.push(v);
@@ -729638,7 +729809,7 @@ ${metabolismMemories}
729638
729809
  try {
729639
729810
  const archeFile = join181(repoRoot, ".omnius", "arche", "variants.json");
729640
729811
  if (existsSync166(archeFile)) {
729641
- const variants = JSON.parse(readFileSync135(archeFile, "utf8"));
729812
+ const variants = JSON.parse(readFileSync136(archeFile, "utf8"));
729642
729813
  if (variants.length > 0) {
729643
729814
  let filtered = variants;
729644
729815
  if (taskType) {
@@ -729829,7 +730000,7 @@ ${skillPack}`;
729829
730000
  "self-state.json"
729830
730001
  );
729831
730002
  if (existsSync166(ikStateFile)) {
729832
- const selfState = JSON.parse(readFileSync135(ikStateFile, "utf8"));
730003
+ const selfState = JSON.parse(readFileSync136(ikStateFile, "utf8"));
729833
730004
  const lines = [
729834
730005
  `[Identity State v${selfState.version}]`,
729835
730006
  `Self: ${selfState.narrative_summary}`,
@@ -730168,7 +730339,7 @@ Review its full output via sub_agent(action='output', id='${id2}')`
730168
730339
  }
730169
730340
  }
730170
730341
  try {
730171
- const { readdirSync: readdirSync61, readFileSync: readFileSync137, existsSync: existsSync169 } = await import("node:fs");
730342
+ const { readdirSync: readdirSync61, readFileSync: readFileSync138, existsSync: existsSync169 } = await import("node:fs");
730172
730343
  const { join: pathJoin } = await import("node:path");
730173
730344
  const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
730174
730345
  if (existsSync169(chunksDir)) {
@@ -730178,7 +730349,7 @@ Review its full output via sub_agent(action='output', id='${id2}')`
730178
730349
  for (const f2 of files) {
730179
730350
  try {
730180
730351
  const data = JSON.parse(
730181
- readFileSync137(pathJoin(chunksDir, f2), "utf-8")
730352
+ readFileSync138(pathJoin(chunksDir, f2), "utf-8")
730182
730353
  );
730183
730354
  if (data._deleted) continue;
730184
730355
  if ((data.functionalSummary || "").toLowerCase().includes(q) || (data.detailSummary || "").toLowerCase().includes(q) || (data.keyFiles || []).some(
@@ -730244,7 +730415,7 @@ ${lines.join("\n")}`
730244
730415
  const expand2 = args.expand === true;
730245
730416
  if (expand2 && id2.startsWith("todo-ctx-")) {
730246
730417
  try {
730247
- const { readFileSync: readFileSync137, existsSync: existsSync169 } = await import("node:fs");
730418
+ const { readFileSync: readFileSync138, existsSync: existsSync169 } = await import("node:fs");
730248
730419
  const { join: pathJoin } = await import("node:path");
730249
730420
  const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
730250
730421
  const todoIdSuffix = id2.replace("todo-ctx-", "");
@@ -731759,7 +731930,7 @@ async function startInteractive(config, repoPath2) {
731759
731930
  const omniusDir = join181(repoRoot, ".omnius");
731760
731931
  const nexusPidFile = join181(omniusDir, "nexus", "daemon.pid");
731761
731932
  if (existsSync166(nexusPidFile)) {
731762
- const pid = parseInt(readFileSync135(nexusPidFile, "utf8").trim(), 10);
731933
+ const pid = parseInt(readFileSync136(nexusPidFile, "utf8").trim(), 10);
731763
731934
  if (pid > 0) {
731764
731935
  try {
731765
731936
  process.kill(pid, 0);
@@ -732953,7 +733124,7 @@ This is an independent background session started from /background.`
732953
733124
  try {
732954
733125
  const titleFile = join181(repoRoot, ".omnius", "session-title");
732955
733126
  if (existsSync166(titleFile))
732956
- sessionTitle = readFileSync135(titleFile, "utf8").trim() || null;
733127
+ sessionTitle = readFileSync136(titleFile, "utf8").trim() || null;
732957
733128
  } catch {
732958
733129
  }
732959
733130
  let carouselRetired = isResumed;
@@ -733068,7 +733239,7 @@ This is an independent background session started from /background.`
733068
733239
  let savedHistory = [];
733069
733240
  try {
733070
733241
  if (existsSync166(HISTORY_FILE)) {
733071
- const raw = readFileSync135(HISTORY_FILE, "utf8").trim();
733242
+ const raw = readFileSync136(HISTORY_FILE, "utf8").trim();
733072
733243
  if (raw) savedHistory = raw.split("\n").reverse();
733073
733244
  }
733074
733245
  } catch {
@@ -733223,7 +733394,7 @@ This is an independent background session started from /background.`
733223
733394
  mkdirSync108(HISTORY_DIR, { recursive: true });
733224
733395
  appendFileSync20(HISTORY_FILE, line + "\n", "utf8");
733225
733396
  if (Math.random() < 0.02) {
733226
- const all2 = readFileSync135(HISTORY_FILE, "utf8").trim().split("\n");
733397
+ const all2 = readFileSync136(HISTORY_FILE, "utf8").trim().split("\n");
733227
733398
  if (all2.length > MAX_HISTORY_LINES) {
733228
733399
  writeFileSync92(
733229
733400
  HISTORY_FILE,
@@ -733452,7 +733623,7 @@ This is an independent background session started from /background.`
733452
733623
  const nexusPidFile = join181(autoNexus.getNexusDir(), "daemon.pid");
733453
733624
  if (existsSync166(nexusPidFile)) {
733454
733625
  const nPid = parseInt(
733455
- readFileSync135(nexusPidFile, "utf8").trim(),
733626
+ readFileSync136(nexusPidFile, "utf8").trim(),
733456
733627
  10
733457
733628
  );
733458
733629
  if (nPid > 0 && !registry2.daemons.has("Nexus")) {
@@ -733634,7 +733805,7 @@ Log: ${nexusLogPath}`
733634
733805
  let agName = "";
733635
733806
  try {
733636
733807
  if (existsSync166(globalNamePath))
733637
- agName = readFileSync135(globalNamePath, "utf8").trim();
733808
+ agName = readFileSync136(globalNamePath, "utf8").trim();
733638
733809
  } catch {
733639
733810
  }
733640
733811
  if (!agName) {
@@ -733675,7 +733846,7 @@ Log: ${nexusLogPath}`
733675
733846
  try {
733676
733847
  if (existsSync166(savedSponsorsPath)) {
733677
733848
  savedSponsors = JSON.parse(
733678
- readFileSync135(savedSponsorsPath, "utf8")
733849
+ readFileSync136(savedSponsorsPath, "utf8")
733679
733850
  );
733680
733851
  const oneHourAgo = Date.now() - 36e5;
733681
733852
  savedSponsors = savedSponsors.filter(
@@ -735145,7 +735316,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
735145
735316
  }
735146
735317
  const available = await engine.isAvailable();
735147
735318
  if (!available) {
735148
- return "transcribe-cli not installed. Run: npm i -g transcribe-cli";
735319
+ return "ASR runtime unavailable. Omnius attempted managed transcribe-cli and Whisper fallback setup; check ~/.omnius/runtimes/asr and ~/.omnius/venv.";
735149
735320
  }
735150
735321
  engine.on("transcript", (text2, isFinal) => {
735151
735322
  if (engine.currentMode === "confirm") {
@@ -735838,7 +736009,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
735838
736009
  try {
735839
736010
  const nexusPidFile = join181(nexusTool.getNexusDir(), "daemon.pid");
735840
736011
  if (existsSync166(nexusPidFile)) {
735841
- const pid = parseInt(readFileSync135(nexusPidFile, "utf8").trim(), 10);
736012
+ const pid = parseInt(readFileSync136(nexusPidFile, "utf8").trim(), 10);
735842
736013
  if (pid > 0) {
735843
736014
  registry2.register({
735844
736015
  name: "Nexus",
@@ -736051,7 +736222,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
736051
736222
  const nexusDir = join181(repoRoot, OMNIUS_DIR, "nexus");
736052
736223
  const pidFile = join181(nexusDir, "daemon.pid");
736053
736224
  if (existsSync166(pidFile)) {
736054
- const pid = parseInt(readFileSync135(pidFile, "utf8").trim(), 10);
736225
+ const pid = parseInt(readFileSync136(pidFile, "utf8").trim(), 10);
736055
736226
  if (pid > 0) {
736056
736227
  try {
736057
736228
  if (process.platform === "win32") {
@@ -736081,7 +736252,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
736081
736252
  const pidPath = join181(voiceDir3, pf);
736082
736253
  if (existsSync166(pidPath)) {
736083
736254
  try {
736084
- const pid = parseInt(readFileSync135(pidPath, "utf8").trim(), 10);
736255
+ const pid = parseInt(readFileSync136(pidPath, "utf8").trim(), 10);
736085
736256
  if (pid > 0) {
736086
736257
  if (process.platform === "win32") {
736087
736258
  try {
@@ -736222,8 +736393,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
736222
736393
  "daemon.port"
736223
736394
  );
736224
736395
  if (existsSync166(ppPidFile)) {
736225
- const ppPid = parseInt(readFileSync135(ppPidFile, "utf8").trim(), 10);
736226
- const ppPort = existsSync166(ppPortFile) ? parseInt(readFileSync135(ppPortFile, "utf8").trim(), 10) : void 0;
736396
+ const ppPid = parseInt(readFileSync136(ppPidFile, "utf8").trim(), 10);
736397
+ const ppPort = existsSync166(ppPortFile) ? parseInt(readFileSync136(ppPortFile, "utf8").trim(), 10) : void 0;
736227
736398
  if (ppPid > 0 && !registry2.daemons.has("PersonaPlex")) {
736228
736399
  registry2.register({
736229
736400
  name: "PersonaPlex",
@@ -736240,7 +736411,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
736240
736411
  "daemon.pid"
736241
736412
  );
736242
736413
  if (existsSync166(nexusPidFile)) {
736243
- const nPid = parseInt(readFileSync135(nexusPidFile, "utf8").trim(), 10);
736414
+ const nPid = parseInt(readFileSync136(nexusPidFile, "utf8").trim(), 10);
736244
736415
  if (nPid > 0 && !registry2.daemons.has("Nexus")) {
736245
736416
  try {
736246
736417
  process.kill(nPid, 0);
@@ -736684,7 +736855,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
736684
736855
  if (isImage) {
736685
736856
  try {
736686
736857
  const imgPath = resolve72(repoRoot, cleanPath);
736687
- const imgBuffer = readFileSync135(imgPath);
736858
+ const imgBuffer = readFileSync136(imgPath);
736688
736859
  const base642 = imgBuffer.toString("base64");
736689
736860
  const ext = extname22(cleanPath).toLowerCase();
736690
736861
  const mime = ext === ".png" ? "image/png" : ext === ".gif" ? "image/gif" : ext === ".webp" ? "image/webp" : "image/jpeg";
@@ -736887,7 +737058,7 @@ ${result.text}`;
736887
737058
  try {
736888
737059
  const { runVisionIngress: runVisionIngress2, formatImageContextPrefix: formatImageContextPrefix2 } = await Promise.resolve().then(() => (init_vision_ingress(), vision_ingress_exports));
736889
737060
  const ingressResult = await runVisionIngress2(
736890
- { path: imgPath, buffer: readFileSync135(imgPath), mime },
737061
+ { path: imgPath, buffer: readFileSync136(imgPath), mime },
736891
737062
  currentConfig.model ?? ""
736892
737063
  );
736893
737064
  visionContext = formatImageContextPrefix2(ingressResult);
@@ -736955,7 +737126,7 @@ Use vision(image="${cleanPath}") for additional semantic detail, and image_read(
736955
737126
  if (isMarkdown && fullInput === input) {
736956
737127
  try {
736957
737128
  const mdPath = resolve72(repoRoot, cleanPath);
736958
- const mdContent = readFileSync135(mdPath, "utf8");
737129
+ const mdContent = readFileSync136(mdPath, "utf8");
736959
737130
  const { parseMcpMarkdown: parseMcpMarkdown2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports2));
736960
737131
  const result = parseMcpMarkdown2(mdContent);
736961
737132
  if (result.servers.length > 0) {
@@ -737615,7 +737786,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
737615
737786
  const ikFile = join181(ikDir, "self-state.json");
737616
737787
  let ikState;
737617
737788
  if (existsSync166(ikFile)) {
737618
- ikState = JSON.parse(readFileSync135(ikFile, "utf8"));
737789
+ ikState = JSON.parse(readFileSync136(ikFile, "utf8"));
737619
737790
  } else {
737620
737791
  mkdirSync108(ikDir, { recursive: true });
737621
737792
  ikState = {
@@ -737688,7 +737859,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
737688
737859
  let variants = [];
737689
737860
  try {
737690
737861
  if (existsSync166(archeFile))
737691
- variants = JSON.parse(readFileSync135(archeFile, "utf8"));
737862
+ variants = JSON.parse(readFileSync136(archeFile, "utf8"));
737692
737863
  } catch {
737693
737864
  }
737694
737865
  variants.push({
@@ -737716,7 +737887,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
737716
737887
  "store.json"
737717
737888
  );
737718
737889
  if (existsSync166(metaFile2)) {
737719
- const store2 = JSON.parse(readFileSync135(metaFile2, "utf8"));
737890
+ const store2 = JSON.parse(readFileSync136(metaFile2, "utf8"));
737720
737891
  const surfaced = store2.filter(
737721
737892
  (m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
737722
737893
  ).sort(
@@ -737819,7 +737990,7 @@ Rules:
737819
737990
  let store2 = [];
737820
737991
  try {
737821
737992
  if (existsSync166(storeFile))
737822
- store2 = JSON.parse(readFileSync135(storeFile, "utf8"));
737993
+ store2 = JSON.parse(readFileSync136(storeFile, "utf8"));
737823
737994
  } catch {
737824
737995
  }
737825
737996
  store2.push({
@@ -737853,7 +738024,7 @@ Rules:
737853
738024
  let cohereActive = false;
737854
738025
  try {
737855
738026
  if (existsSync166(cohereSettingsFile)) {
737856
- const settings = JSON.parse(readFileSync135(cohereSettingsFile, "utf8"));
738027
+ const settings = JSON.parse(readFileSync136(cohereSettingsFile, "utf8"));
737857
738028
  cohereActive = settings.cohere === true;
737858
738029
  }
737859
738030
  } catch {
@@ -737867,7 +738038,7 @@ Rules:
737867
738038
  "store.json"
737868
738039
  );
737869
738040
  if (existsSync166(metaFile2)) {
737870
- const store2 = JSON.parse(readFileSync135(metaFile2, "utf8"));
738041
+ const store2 = JSON.parse(readFileSync136(metaFile2, "utf8"));
737871
738042
  const latest = store2.filter(
737872
738043
  (m2) => m2.sourceTrace === "trajectory-extraction" || m2.sourceTrace === "llm-trajectory-extraction"
737873
738044
  ).slice(-1)[0];
@@ -737900,7 +738071,7 @@ Rules:
737900
738071
  try {
737901
738072
  const ikFile = join181(repoRoot, ".omnius", "identity", "self-state.json");
737902
738073
  if (existsSync166(ikFile)) {
737903
- const ikState = JSON.parse(readFileSync135(ikFile, "utf8"));
738074
+ const ikState = JSON.parse(readFileSync136(ikFile, "utf8"));
737904
738075
  ikState.homeostasis.uncertainty = Math.min(
737905
738076
  1,
737906
738077
  ikState.homeostasis.uncertainty + 0.1
@@ -737921,7 +738092,7 @@ Rules:
737921
738092
  "store.json"
737922
738093
  );
737923
738094
  if (existsSync166(metaFile2)) {
737924
- const store2 = JSON.parse(readFileSync135(metaFile2, "utf8"));
738095
+ const store2 = JSON.parse(readFileSync136(metaFile2, "utf8"));
737925
738096
  const surfaced = store2.filter(
737926
738097
  (m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
737927
738098
  ).sort(
@@ -737947,7 +738118,7 @@ Rules:
737947
738118
  let variants = [];
737948
738119
  try {
737949
738120
  if (existsSync166(archeFile))
737950
- variants = JSON.parse(readFileSync135(archeFile, "utf8"));
738121
+ variants = JSON.parse(readFileSync136(archeFile, "utf8"));
737951
738122
  } catch {
737952
738123
  }
737953
738124
  variants.push({
@@ -738086,7 +738257,7 @@ import { spawn as spawn38 } from "node:child_process";
738086
738257
  import {
738087
738258
  mkdirSync as mkdirSync109,
738088
738259
  writeFileSync as writeFileSync93,
738089
- readFileSync as readFileSync136,
738260
+ readFileSync as readFileSync137,
738090
738261
  readdirSync as readdirSync60,
738091
738262
  existsSync as existsSync167
738092
738263
  } from "node:fs";
@@ -738294,7 +738465,7 @@ function statusCommand(jobId, repoPath2) {
738294
738465
  console.log(`Available jobs: omnius jobs`);
738295
738466
  process.exit(1);
738296
738467
  }
738297
- const job = JSON.parse(readFileSync136(file, "utf-8"));
738468
+ const job = JSON.parse(readFileSync137(file, "utf-8"));
738298
738469
  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`;
738299
738470
  const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
738300
738471
  console.log(`${icon} ${job.id} [${job.status}] ${runtime}`);
@@ -738316,7 +738487,7 @@ function jobsCommand(repoPath2) {
738316
738487
  console.log("Jobs:");
738317
738488
  for (const file of files) {
738318
738489
  try {
738319
- const job = JSON.parse(readFileSync136(join182(dir, file), "utf-8"));
738490
+ const job = JSON.parse(readFileSync137(join182(dir, file), "utf-8"));
738320
738491
  const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
738321
738492
  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`;
738322
738493
  const cleanListTask = cleanForStorage(job.task) || job.task;