omnius 1.0.436 → 1.0.438

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
@@ -11530,7 +11530,11 @@ var init_vision = __esm({
11530
11530
  },
11531
11531
  device: {
11532
11532
  type: "string",
11533
- description: "Optional camera device for auto-capture when image/path/file is omitted."
11533
+ description: "Optional camera device for auto-capture when image/path/file is omitted. Uses the shared /live or /camera preset for rotation, resolution, and FPS."
11534
+ },
11535
+ camera: {
11536
+ type: "string",
11537
+ description: "Alias for device when auto-capturing from a camera."
11534
11538
  },
11535
11539
  length: {
11536
11540
  type: "string",
@@ -11701,7 +11705,8 @@ ${lastPointDiagnostics.slice(-8).map((line) => ` - ${line}`).join("\n")}
11701
11705
  }
11702
11706
  }
11703
11707
  async captureEnvironmentFrame(args) {
11704
- const liveFrame = this.latestLiveFramePath();
11708
+ const requestedDevice = typeof args["device"] === "string" ? args["device"] : typeof args["camera"] === "string" ? args["camera"] : void 0;
11709
+ const liveFrame = requestedDevice ? null : this.latestLiveFramePath();
11705
11710
  if (liveFrame)
11706
11711
  return { ok: true, path: liveFrame };
11707
11712
  const captureDir = join14(process.env["TMPDIR"] || "/tmp", "omnius-vision");
@@ -11713,9 +11718,7 @@ ${lastPointDiagnostics.slice(-8).map((line) => ` - ${line}`).join("\n")}
11713
11718
  const result = await new CameraCaptureTool().execute({
11714
11719
  action: "capture",
11715
11720
  output_path: outputPath3,
11716
- device: typeof args["device"] === "string" ? args["device"] : void 0,
11717
- width: 1920,
11718
- height: 1080
11721
+ device: requestedDevice
11719
11722
  });
11720
11723
  if (result.success && existsSync16(outputPath3))
11721
11724
  return { ok: true, path: outputPath3 };
@@ -276282,11 +276285,11 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
276282
276285
  * what was previously computed. */
276283
276286
  async loadSessionInfo() {
276284
276287
  try {
276285
- const { readFileSync: readFileSync141, existsSync: existsSync173 } = await import("node:fs");
276288
+ const { readFileSync: readFileSync142, existsSync: existsSync173 } = await import("node:fs");
276286
276289
  const sessionPath2 = join45(this.cwd, ".omnius", "rlm", "session.json");
276287
276290
  if (!existsSync173(sessionPath2))
276288
276291
  return null;
276289
- return JSON.parse(readFileSync141(sessionPath2, "utf8"));
276292
+ return JSON.parse(readFileSync142(sessionPath2, "utf8"));
276290
276293
  } catch {
276291
276294
  return null;
276292
276295
  }
@@ -276473,10 +276476,10 @@ var init_memory_metabolism = __esm({
276473
276476
  const trajDir = join46(this.cwd, ".omnius", "rlm-trajectories");
276474
276477
  let lessons = [];
276475
276478
  try {
276476
- const { readdirSync: readdirSync62, readFileSync: readFileSync141 } = await import("node:fs");
276479
+ const { readdirSync: readdirSync62, readFileSync: readFileSync142 } = await import("node:fs");
276477
276480
  const files = readdirSync62(trajDir).filter((f2) => f2.endsWith(".jsonl")).sort().reverse().slice(0, 3);
276478
276481
  for (const file of files) {
276479
- const lines = readFileSync141(join46(trajDir, file), "utf8").split("\n").filter((l2) => l2.trim());
276482
+ const lines = readFileSync142(join46(trajDir, file), "utf8").split("\n").filter((l2) => l2.trim());
276480
276483
  for (const line of lines) {
276481
276484
  try {
276482
276485
  const entry = JSON.parse(line);
@@ -276860,14 +276863,14 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
276860
276863
  * Optionally filter by task type for phase-aware context (FSM paper insight).
276861
276864
  */
276862
276865
  getTopMemoriesSync(k = 5, taskType) {
276863
- const { readFileSync: readFileSync141, existsSync: existsSync173 } = __require("node:fs");
276866
+ const { readFileSync: readFileSync142, existsSync: existsSync173 } = __require("node:fs");
276864
276867
  const metaDir = join46(this.cwd, ".omnius", "memory", "metabolism");
276865
276868
  const storeFile = join46(metaDir, "store.json");
276866
276869
  if (!existsSync173(storeFile))
276867
276870
  return "";
276868
276871
  let store2 = [];
276869
276872
  try {
276870
- store2 = JSON.parse(readFileSync141(storeFile, "utf8"));
276873
+ store2 = JSON.parse(readFileSync142(storeFile, "utf8"));
276871
276874
  } catch {
276872
276875
  return "";
276873
276876
  }
@@ -276889,14 +276892,14 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
276889
276892
  /** Update memory scores based on task outcome. Called after task completion.
276890
276893
  * Memories used in successful tasks get boosted. Memories present during failures get decayed. */
276891
276894
  updateFromOutcomeSync(surfacedMemoryText, succeeded) {
276892
- const { readFileSync: readFileSync141, writeFileSync: writeFileSync95, existsSync: existsSync173, mkdirSync: mkdirSync112 } = __require("node:fs");
276895
+ const { readFileSync: readFileSync142, writeFileSync: writeFileSync95, existsSync: existsSync173, mkdirSync: mkdirSync112 } = __require("node:fs");
276893
276896
  const metaDir = join46(this.cwd, ".omnius", "memory", "metabolism");
276894
276897
  const storeFile = join46(metaDir, "store.json");
276895
276898
  if (!existsSync173(storeFile))
276896
276899
  return;
276897
276900
  let store2 = [];
276898
276901
  try {
276899
- store2 = JSON.parse(readFileSync141(storeFile, "utf8"));
276902
+ store2 = JSON.parse(readFileSync142(storeFile, "utf8"));
276900
276903
  } catch {
276901
276904
  return;
276902
276905
  }
@@ -277343,13 +277346,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
277343
277346
  // Per EvoSkill (arXiv:2603.02766): retrieve relevant strategies from archive.
277344
277347
  /** Retrieve top-K strategies for context injection. Returns "" if none. */
277345
277348
  getRelevantStrategiesSync(k = 3, taskType) {
277346
- const { readFileSync: readFileSync141, existsSync: existsSync173 } = __require("node:fs");
277349
+ const { readFileSync: readFileSync142, existsSync: existsSync173 } = __require("node:fs");
277347
277350
  const archiveFile = join48(this.cwd, ".omnius", "arche", "variants.json");
277348
277351
  if (!existsSync173(archiveFile))
277349
277352
  return "";
277350
277353
  let variants = [];
277351
277354
  try {
277352
- variants = JSON.parse(readFileSync141(archiveFile, "utf8"));
277355
+ variants = JSON.parse(readFileSync142(archiveFile, "utf8"));
277353
277356
  } catch {
277354
277357
  return "";
277355
277358
  }
@@ -277367,13 +277370,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
277367
277370
  }
277368
277371
  /** Archive a strategy variant synchronously (for task completion path) */
277369
277372
  archiveVariantSync(strategy, outcome, tags = []) {
277370
- const { readFileSync: readFileSync141, writeFileSync: writeFileSync95, existsSync: existsSync173, mkdirSync: mkdirSync112 } = __require("node:fs");
277373
+ const { readFileSync: readFileSync142, writeFileSync: writeFileSync95, existsSync: existsSync173, mkdirSync: mkdirSync112 } = __require("node:fs");
277371
277374
  const dir = join48(this.cwd, ".omnius", "arche");
277372
277375
  const archiveFile = join48(dir, "variants.json");
277373
277376
  let variants = [];
277374
277377
  try {
277375
277378
  if (existsSync173(archiveFile))
277376
- variants = JSON.parse(readFileSync141(archiveFile, "utf8"));
277379
+ variants = JSON.parse(readFileSync142(archiveFile, "utf8"));
277377
277380
  } catch {
277378
277381
  }
277379
277382
  variants.push({
@@ -556571,6 +556574,9 @@ def main():
556571
556574
  source = cfg["source"]
556572
556575
  media_path = None
556573
556576
  rotate_degrees = int(cfg.get("rotate_degrees") or 0)
556577
+ capture_width = int(cfg.get("width") or 0)
556578
+ capture_height = int(cfg.get("height") or 0)
556579
+ capture_fps = float(cfg.get("fps") or cfg.get("framerate") or 0)
556574
556580
 
556575
556581
  try:
556576
556582
  import cv2
@@ -556620,6 +556626,13 @@ def main():
556620
556626
  if not cap.isOpened():
556621
556627
  print(json.dumps({"success": False, "error": "could not open media source: " + str(source_for_cv)}))
556622
556628
  return
556629
+ if source_kind == "camera":
556630
+ if capture_width > 0:
556631
+ cap.set(cv2.CAP_PROP_FRAME_WIDTH, capture_width)
556632
+ if capture_height > 0:
556633
+ cap.set(cv2.CAP_PROP_FRAME_HEIGHT, capture_height)
556634
+ if capture_fps > 0:
556635
+ cap.set(cv2.CAP_PROP_FPS, capture_fps)
556623
556636
 
556624
556637
  yolo_model = cfg.get("yolo_model") or "yolo26n.pt"
556625
556638
  yoloe_classes = [str(x).strip() for x in (cfg.get("yoloe_classes") or []) if str(x).strip()]
@@ -556907,6 +556920,10 @@ var init_live_media_loop = __esm({
556907
556920
  rotate_degrees: { type: "number", enum: [0, 90, 180, 270], description: "Clockwise correction applied to sampled frames before object tracking and face crops." },
556908
556921
  rotation_degrees: { type: "number", enum: [0, 90, 180, 270], description: "Alias for rotate_degrees." },
556909
556922
  rotate: { type: "string", enum: ["none", "cw", "ccw", "180", "clockwise", "counterclockwise"], description: "Optional human-readable rotation alias." },
556923
+ width: { type: "number", description: "Requested camera capture width when source_kind=camera. /live passes the shared /camera preset." },
556924
+ height: { type: "number", description: "Requested camera capture height when source_kind=camera. /live passes the shared /camera preset." },
556925
+ fps: { type: "number", description: "Requested camera FPS when source_kind=camera. /live passes the shared /camera preset." },
556926
+ framerate: { type: "number", description: "Alias for fps." },
556910
556927
  duration_sec: { type: "number", description: "Bounded watch duration, default 8" },
556911
556928
  sample_interval_sec: { type: "number", description: "Seconds between sampled frames, default 1" },
556912
556929
  max_frames: { type: "number", description: "Max sampled frames, default 8" },
@@ -557080,6 +557097,9 @@ var init_live_media_loop = __esm({
557080
557097
  sample_interval_sec: Number(args["sample_interval_sec"] ?? 1),
557081
557098
  max_frames: Number(args["max_frames"] ?? 8),
557082
557099
  rotate_degrees: rotation,
557100
+ width: Number(args["width"] ?? 0),
557101
+ height: Number(args["height"] ?? 0),
557102
+ fps: Number(args["fps"] ?? args["framerate"] ?? 0),
557083
557103
  end2end: optionalBoolean(args, "end2end"),
557084
557104
  yoloe_classes: stringListFromArg(args["yoloe_classes"] ?? args["classes"]),
557085
557105
  yoloe_prompt_mode: String(args["yoloe_prompt_mode"] ?? args["prompt_mode"] ?? ""),
@@ -569345,9 +569365,9 @@ var init_reflectionBuffer = __esm({
569345
569365
  this.persistPath = persistPath ?? null;
569346
569366
  if (this.persistPath) {
569347
569367
  try {
569348
- const { readFileSync: readFileSync141, existsSync: existsSync173 } = __require("node:fs");
569368
+ const { readFileSync: readFileSync142, existsSync: existsSync173 } = __require("node:fs");
569349
569369
  if (existsSync173(this.persistPath)) {
569350
- this.state = JSON.parse(readFileSync141(this.persistPath, "utf-8"));
569370
+ this.state = JSON.parse(readFileSync142(this.persistPath, "utf-8"));
569351
569371
  return;
569352
569372
  }
569353
569373
  } catch {
@@ -573597,9 +573617,9 @@ var init_adversaryStream = __esm({
573597
573617
  if (!this.persistPath)
573598
573618
  return;
573599
573619
  try {
573600
- const { readFileSync: readFileSync141, existsSync: existsSync173 } = __require("node:fs");
573620
+ const { readFileSync: readFileSync142, existsSync: existsSync173 } = __require("node:fs");
573601
573621
  if (existsSync173(this.persistPath)) {
573602
- const data = JSON.parse(readFileSync141(this.persistPath, "utf-8"));
573622
+ const data = JSON.parse(readFileSync142(this.persistPath, "utf-8"));
573603
573623
  if (Array.isArray(data?.ledger))
573604
573624
  this.ledger = data.ledger.slice(-100);
573605
573625
  }
@@ -573637,7 +573657,7 @@ function resolveFocusSupervisorMode(configured, envValue = process.env["OMNIUS_F
573637
573657
  }
573638
573658
  function violatesDirective(directive, input) {
573639
573659
  if (input.toolName === "task_complete") {
573640
- return directive.requiredNextAction !== "report_blocked" && directive.requiredNextAction !== "report_incomplete";
573660
+ return directive.requiredNextAction !== "report_blocked" && directive.requiredNextAction !== "report_incomplete" && directive.requiredNextAction !== "use_cached_evidence";
573641
573661
  }
573642
573662
  if (input.toolName === "ask_user")
573643
573663
  return false;
@@ -592270,8 +592290,8 @@ ${telegramPersonaHead}` : stripped
592270
592290
  let recoveredTokens = 0;
592271
592291
  for (const [filePath, entry] of entries) {
592272
592292
  try {
592273
- const { readFileSync: readFileSync141 } = await import("node:fs");
592274
- const content = readFileSync141(filePath, "utf8");
592293
+ const { readFileSync: readFileSync142 } = await import("node:fs");
592294
+ const content = readFileSync142(filePath, "utf8");
592275
592295
  const tokenEst = Math.ceil(content.length / 4);
592276
592296
  if (recoveredTokens + tokenEst > fileRecoveryBudget)
592277
592297
  break;
@@ -594245,7 +594265,7 @@ ${result}`
594245
594265
  const buffer2 = Buffer.from(rawBase64, "base64");
594246
594266
  let resizedBase64 = null;
594247
594267
  try {
594248
- const { writeFileSync: writeFileSync95, readFileSync: readFileSync141, unlinkSync: unlinkSync38 } = await import("node:fs");
594268
+ const { writeFileSync: writeFileSync95, readFileSync: readFileSync142, unlinkSync: unlinkSync38 } = await import("node:fs");
594249
594269
  const { join: join188 } = await import("node:path");
594250
594270
  const { tmpdir: tmpdir26 } = await import("node:os");
594251
594271
  const tmpIn = join188(tmpdir26(), `omnius_img_in_${Date.now()}.png`);
@@ -594260,7 +594280,7 @@ ${result}`
594260
594280
  `img.save(${JSON.stringify(tmpOut)}, 'JPEG', quality=75)`
594261
594281
  ].join("; ");
594262
594282
  await execFileText4(pyBin, ["-c", resizeScript], { timeout: 1e4 });
594263
- const resizedBuf = readFileSync141(tmpOut);
594283
+ const resizedBuf = readFileSync142(tmpOut);
594264
594284
  resizedBase64 = `data:image/jpeg;base64,${resizedBuf.toString("base64")}`;
594265
594285
  try {
594266
594286
  unlinkSync38(tmpIn);
@@ -603330,7 +603350,7 @@ __export(py_embed_exports, {
603330
603350
  runTranscribeFile: () => runTranscribeFile
603331
603351
  });
603332
603352
  import { spawnSync as spawnSync8 } from "node:child_process";
603333
- import { existsSync as existsSync110, mkdirSync as mkdirSync67, writeFileSync as writeFileSync56 } from "node:fs";
603353
+ import { existsSync as existsSync110, mkdirSync as mkdirSync67, readFileSync as readFileSync90, writeFileSync as writeFileSync56 } from "node:fs";
603334
603354
  import { join as join125 } from "node:path";
603335
603355
  import { homedir as homedir39 } from "node:os";
603336
603356
  function getVenvDir() {
@@ -603342,6 +603362,172 @@ function getVenvPython() {
603342
603362
  const exe = process.platform === "win32" ? "python.exe" : "python3";
603343
603363
  return join125(base3, bin, exe);
603344
603364
  }
603365
+ function asrCpuAllowed() {
603366
+ const raw = String(process.env["OMNIUS_ASR_ALLOW_CPU"] ?? "").trim().toLowerCase();
603367
+ return raw === "1" || raw === "true" || raw === "yes" || raw === "on";
603368
+ }
603369
+ function isJetsonHost2() {
603370
+ if (process.arch !== "arm64" && process.arch !== "arm") return false;
603371
+ if (existsSync110("/etc/nv_tegra_release")) return true;
603372
+ if (existsSync110("/usr/local/cuda/targets/aarch64-linux")) return true;
603373
+ if (process.env["JETSON_L4T_VERSION"]) return true;
603374
+ try {
603375
+ const model = readFileSync90("/proc/device-tree/model", "utf8").replace(/\0/g, " ");
603376
+ return /\b(nvidia|jetson|orin|tegra)\b/i.test(model);
603377
+ } catch {
603378
+ return false;
603379
+ }
603380
+ }
603381
+ function enableVenvSystemSitePackages(venv = getVenvDir()) {
603382
+ const cfg = join125(venv, "pyvenv.cfg");
603383
+ if (!existsSync110(cfg)) return;
603384
+ try {
603385
+ const raw = readFileSync90(cfg, "utf8");
603386
+ const next = /include-system-site-packages\s*=/.test(raw) ? raw.replace(/include-system-site-packages\s*=\s*(?:true|false)/i, "include-system-site-packages = true") : `${raw.trimEnd()}
603387
+ include-system-site-packages = true
603388
+ `;
603389
+ if (next !== raw) writeFileSync56(cfg, next, "utf8");
603390
+ } catch {
603391
+ }
603392
+ }
603393
+ function cudaHardwarePresent() {
603394
+ if (existsSync110("/dev/nvidiactl")) return true;
603395
+ if (existsSync110("/sys/devices/gpu.0")) return true;
603396
+ if (existsSync110("/usr/local/cuda")) return true;
603397
+ return isJetsonHost2();
603398
+ }
603399
+ function detectCudaToolkitVersion() {
603400
+ for (const path12 of ["/usr/local/cuda/version.json", "/usr/local/cuda/version.txt"]) {
603401
+ if (!existsSync110(path12)) continue;
603402
+ try {
603403
+ const raw = readFileSync90(path12, "utf8");
603404
+ const match2 = raw.match(/CUDA(?: Toolkit)?[^0-9]*(\d+\.\d+)/i) || raw.match(/"cuda"\s*:\s*"(\d+\.\d+)/i);
603405
+ if (match2?.[1]) return match2[1];
603406
+ } catch {
603407
+ }
603408
+ }
603409
+ const nvcc = spawnSync8("nvcc", ["--version"], { encoding: "utf8", timeout: 5e3 });
603410
+ const match = `${nvcc.stdout || ""}${nvcc.stderr || ""}`.match(/release\s+(\d+\.\d+)/i);
603411
+ return match?.[1] ?? "";
603412
+ }
603413
+ function jetsonPytorchDirs() {
603414
+ let primary = "v60";
603415
+ try {
603416
+ const tegra = existsSync110("/etc/nv_tegra_release") ? readFileSync90("/etc/nv_tegra_release", "utf8") : "";
603417
+ const env2 = process.env["JETSON_L4T_VERSION"] || "";
603418
+ const cuda = detectCudaToolkitVersion();
603419
+ if (env2.startsWith("5.") || tegra.includes("R35") || tegra.includes("R34")) primary = "v51";
603420
+ else if (env2.startsWith("6.2")) primary = "v62";
603421
+ else if (env2.startsWith("6.1") || tegra.includes("R36.4")) primary = cuda.startsWith("12.2") ? "v60" : "v61";
603422
+ else if (env2.startsWith("6.") || tegra.includes("R36") || cuda.startsWith("12.2")) primary = "v60";
603423
+ } catch {
603424
+ }
603425
+ const fallbacks = primary === "v51" ? ["v51", "v511"] : primary === "v62" ? ["v62", "v61", "v60"] : primary === "v61" ? ["v61", "v60"] : ["v60", "v60dp", "v61"];
603426
+ return [...new Set(fallbacks)];
603427
+ }
603428
+ function jetsonPytorchIndex() {
603429
+ const jpVer = jetsonPytorchDirs()[0] ?? "v60";
603430
+ return `https://developer.download.nvidia.com/compute/redist/jp/${jpVer}/pytorch/`;
603431
+ }
603432
+ function pythonAbiTag(py = getVenvPython()) {
603433
+ const probe = spawnSync8(
603434
+ py,
603435
+ ["-c", "import sys; print(f'cp{sys.version_info.major}{sys.version_info.minor}')"],
603436
+ { encoding: "utf8", timeout: 5e3 }
603437
+ );
603438
+ const tag = String(probe.stdout || "").trim();
603439
+ return /^cp\d+$/.test(tag) ? tag : "cp310";
603440
+ }
603441
+ function discoverJetsonTorchWheel(py = getVenvPython()) {
603442
+ const envWheel = String(process.env["OMNIUS_JETSON_TORCH_WHEEL"] || process.env["JETSON_TORCH_WHEEL"] || "").trim();
603443
+ if (envWheel) return envWheel;
603444
+ const abi = pythonAbiTag(py);
603445
+ const dirs = jetsonPytorchDirs();
603446
+ const urls = dirs.flatMap((dir) => [
603447
+ `https://developer.download.nvidia.com/compute/redist/jp/${dir}/pytorch/`,
603448
+ `https://developer.download.nvidia.cn/compute/redist/jp/${dir}/pytorch/`
603449
+ ]);
603450
+ const probe = spawnSync8(
603451
+ "python3",
603452
+ [
603453
+ "-c",
603454
+ [
603455
+ "import json, re, sys, urllib.parse, urllib.request",
603456
+ "abi = sys.argv[1]",
603457
+ "urls = sys.argv[2:]",
603458
+ "for url in urls:",
603459
+ " try:",
603460
+ " html = urllib.request.urlopen(url, timeout=20).read().decode('utf-8', 'ignore')",
603461
+ " except Exception:",
603462
+ " continue",
603463
+ " wheels = []",
603464
+ ` for href in re.findall("href=[\\\\\\"']([^\\\\\\"']+\\\\.whl)[\\\\\\"']", html, flags=re.I):`,
603465
+ " name = urllib.parse.unquote(href.rsplit('/', 1)[-1])",
603466
+ " if not name.startswith('torch-'):",
603467
+ " continue",
603468
+ " if 'linux_aarch64' not in name or abi not in name:",
603469
+ " continue",
603470
+ " wheels.append(urllib.parse.urljoin(url, href))",
603471
+ " if wheels:",
603472
+ " print(json.dumps(sorted(wheels)[-1]))",
603473
+ " raise SystemExit(0)",
603474
+ "print(json.dumps(''))"
603475
+ ].join("\n"),
603476
+ abi,
603477
+ ...urls
603478
+ ],
603479
+ { encoding: "utf8", timeout: 9e4 }
603480
+ );
603481
+ try {
603482
+ return String(JSON.parse(probe.stdout || '""') || "");
603483
+ } catch {
603484
+ return "";
603485
+ }
603486
+ }
603487
+ function purgeVenvTorch(pip) {
603488
+ const purge = spawnSync8(
603489
+ pip,
603490
+ ["uninstall", "-y", "torch", "torchvision", "torchaudio", "triton"],
603491
+ { encoding: "utf8", timeout: 3e5 }
603492
+ );
603493
+ return `${purge.stdout || ""}${purge.stderr || ""}`;
603494
+ }
603495
+ function jetsonTorchInstallSource() {
603496
+ const wheel = discoverJetsonTorchWheel();
603497
+ if (wheel) {
603498
+ return {
603499
+ source: wheel,
603500
+ args: ["install", "--upgrade", "--force-reinstall", "--no-deps", "--no-cache-dir", wheel]
603501
+ };
603502
+ }
603503
+ const indexUrl = jetsonPytorchIndex();
603504
+ return {
603505
+ source: indexUrl,
603506
+ args: ["install", "--upgrade", "--force-reinstall", "--no-deps", "--no-cache-dir", "--index-url", indexUrl, "torch"]
603507
+ };
603508
+ }
603509
+ function torchCudaProbe(py = getVenvPython()) {
603510
+ const probe = spawnSync8(
603511
+ py,
603512
+ [
603513
+ "-c",
603514
+ [
603515
+ "import json",
603516
+ "try:",
603517
+ " import torch",
603518
+ " ok=bool(torch.cuda.is_available() and torch.cuda.device_count()>0)",
603519
+ " print(json.dumps({'ok':ok,'torch':getattr(torch,'__version__','unknown'),'cuda':getattr(getattr(torch,'version',None),'cuda',None),'devices':torch.cuda.device_count() if hasattr(torch,'cuda') else 0}))",
603520
+ " raise SystemExit(0 if ok else 2)",
603521
+ "except Exception as e:",
603522
+ " print(json.dumps({'ok':False,'error':str(e)}))",
603523
+ " raise SystemExit(2)"
603524
+ ].join("\n")
603525
+ ],
603526
+ { encoding: "utf8", timeout: 3e4 }
603527
+ );
603528
+ const log22 = `${probe.stdout || ""}${probe.stderr || ""}`.trim();
603529
+ return { ok: probe.status === 0, log: log22 };
603530
+ }
603345
603531
  function ensureEmbedDeps() {
603346
603532
  const venv = getVenvDir();
603347
603533
  let log22 = "";
@@ -603351,40 +603537,151 @@ function ensureEmbedDeps() {
603351
603537
  }
603352
603538
  const venvExisted = existsSync110(getVenvPython());
603353
603539
  if (!venvExisted) {
603354
- const mk = spawnSync8("python3", ["-m", "venv", venv], { encoding: "utf8" });
603540
+ const mk = spawnSync8("python3", ["-m", "venv", ...isJetsonHost2() ? ["--system-site-packages"] : [], venv], { encoding: "utf8" });
603355
603541
  log22 += mk.stdout + mk.stderr;
603356
603542
  }
603543
+ if (isJetsonHost2() && cudaHardwarePresent() && !asrCpuAllowed()) {
603544
+ enableVenvSystemSitePackages(venv);
603545
+ }
603357
603546
  if (venvExisted && !(process.env["OMNIUS_INSTALL_FULL_EMBED_DEPS"] === "1")) {
603358
603547
  const check = spawnSync8(
603359
603548
  getVenvPython(),
603360
- ["-c", "import numpy, soundfile, whisper, faster_whisper, PIL"],
603549
+ ["-c", "import numpy, soundfile, whisper, PIL"],
603361
603550
  { encoding: "utf8", timeout: 3e4 }
603362
603551
  );
603363
603552
  if (check.status === 0) {
603364
- return { ok: true, log: "embed deps already satisfied" };
603553
+ if (!cudaHardwarePresent() || asrCpuAllowed()) {
603554
+ return { ok: true, log: "embed deps already satisfied" };
603555
+ }
603556
+ const cudaProbe = torchCudaProbe();
603557
+ if (cudaProbe.ok) {
603558
+ return { ok: true, log: `embed deps already satisfied; torch CUDA OK ${cudaProbe.log}` };
603559
+ }
603560
+ log22 += `embed deps import OK but torch CUDA probe failed; repairing ASR torch. ${cudaProbe.log}
603561
+ `;
603365
603562
  }
603366
603563
  }
603367
603564
  const pip = process.platform === "win32" ? join125(venv, "Scripts", "pip.exe") : join125(venv, "bin", "pip");
603368
603565
  const up = spawnSync8(pip, ["install", "--upgrade", "pip", "setuptools<81", "wheel"], { encoding: "utf8", timeout: 3e5 });
603369
603566
  log22 += up.stdout + up.stderr;
603370
- const asrPkgs = [
603371
- "numpy==1.26.4",
603372
- "soundfile",
603373
- "faster-whisper",
603374
- "openai-whisper",
603375
- // Embedding helpers used elsewhere (kept lightweight compared to full torch stack)
603376
- "Pillow"
603377
- ];
603378
- const ins = spawnSync8(pip, ["install", ...asrPkgs], { encoding: "utf8", timeout: 9e5 });
603379
- log22 += ins.stdout + ins.stderr;
603567
+ let torchOk = true;
603568
+ if (cudaHardwarePresent() && !asrCpuAllowed()) {
603569
+ const before = torchCudaProbe();
603570
+ torchOk = before.ok;
603571
+ if (!torchOk && isJetsonHost2()) {
603572
+ const systemTorch = torchCudaProbe("python3");
603573
+ if (systemTorch.ok) {
603574
+ log22 += `Venv torch CUDA probe failed, but system Jetson torch CUDA works; enabling system site packages and removing venv-local torch.
603575
+ venv=${before.log}
603576
+ system=${systemTorch.log}
603577
+ `;
603578
+ const uninstall = spawnSync8(
603579
+ pip,
603580
+ ["uninstall", "-y", "torch", "torchvision", "torchaudio"],
603581
+ { encoding: "utf8", timeout: 3e5 }
603582
+ );
603583
+ log22 += uninstall.stdout + uninstall.stderr;
603584
+ enableVenvSystemSitePackages(venv);
603585
+ const inherited = torchCudaProbe();
603586
+ torchOk = inherited.ok;
603587
+ log22 += `Torch CUDA probe after inheriting system Jetson torch: ${inherited.log}
603588
+ `;
603589
+ }
603590
+ }
603591
+ if (!torchOk && isJetsonHost2()) {
603592
+ log22 += purgeVenvTorch(pip);
603593
+ const torchDeps = spawnSync8(
603594
+ pip,
603595
+ ["install", "--upgrade", "numpy==1.26.4", "filelock", "typing-extensions", "networkx", "jinja2", "fsspec", "sympy"],
603596
+ { encoding: "utf8", timeout: 3e5 }
603597
+ );
603598
+ log22 += torchDeps.stdout + torchDeps.stderr;
603599
+ const torchSource = jetsonTorchInstallSource();
603600
+ log22 += `Torch CUDA probe failed on Jetson; installing JetPack-compatible PyTorch from ${torchSource.source}
603601
+ ${before.log}
603602
+ `;
603603
+ const torchInstall = spawnSync8(
603604
+ pip,
603605
+ torchSource.args,
603606
+ { encoding: "utf8", timeout: 9e5 }
603607
+ );
603608
+ log22 += torchInstall.stdout + torchInstall.stderr;
603609
+ const after = torchCudaProbe();
603610
+ torchOk = after.ok;
603611
+ log22 += `Torch CUDA probe after Jetson install: ${after.log}
603612
+ `;
603613
+ } else if (!torchOk) {
603614
+ log22 += `Torch CUDA probe failed on CUDA host; not allowing ASR CPU fallback. ${before.log}
603615
+ `;
603616
+ }
603617
+ }
603618
+ let asrDepsOk = true;
603619
+ if (isJetsonHost2() && cudaHardwarePresent() && !asrCpuAllowed()) {
603620
+ const asrSupportPkgs = [
603621
+ "numpy==1.26.4",
603622
+ "soundfile",
603623
+ "Pillow",
603624
+ "numba",
603625
+ "tqdm",
603626
+ "more-itertools",
603627
+ "tiktoken"
603628
+ ];
603629
+ const support = spawnSync8(pip, ["install", ...asrSupportPkgs], { encoding: "utf8", timeout: 9e5 });
603630
+ log22 += support.stdout + support.stderr;
603631
+ const whisper = spawnSync8(pip, ["install", "--no-deps", "openai-whisper"], { encoding: "utf8", timeout: 9e5 });
603632
+ log22 += whisper.stdout + whisper.stderr;
603633
+ asrDepsOk = support.status === 0 && whisper.status === 0;
603634
+ } else {
603635
+ const asrPkgs = [
603636
+ "numpy==1.26.4",
603637
+ "soundfile",
603638
+ "openai-whisper",
603639
+ // Embedding helpers used elsewhere (kept lightweight compared to full torch stack)
603640
+ "Pillow"
603641
+ ];
603642
+ const ins = spawnSync8(pip, ["install", ...asrPkgs], { encoding: "utf8", timeout: 9e5 });
603643
+ log22 += ins.stdout + ins.stderr;
603644
+ asrDepsOk = ins.status === 0;
603645
+ }
603646
+ if (cudaHardwarePresent() && !asrCpuAllowed()) {
603647
+ const finalTorch = torchCudaProbe();
603648
+ torchOk = finalTorch.ok;
603649
+ if (!torchOk) {
603650
+ log22 += `Torch CUDA probe still failed after ASR dependency install. ${finalTorch.log}
603651
+ `;
603652
+ if (isJetsonHost2()) {
603653
+ log22 += "Retrying Jetson torch repair after ASR dependency install to remove any incompatible torch resolver side effects.\n";
603654
+ log22 += purgeVenvTorch(pip);
603655
+ const torchSource = jetsonTorchInstallSource();
603656
+ const retry = spawnSync8(
603657
+ pip,
603658
+ torchSource.args,
603659
+ { encoding: "utf8", timeout: 9e5 }
603660
+ );
603661
+ log22 += retry.stdout + retry.stderr;
603662
+ const repaired = torchCudaProbe();
603663
+ torchOk = repaired.ok;
603664
+ log22 += `Torch CUDA probe after final Jetson repair from ${torchSource.source}: ${repaired.log}
603665
+ `;
603666
+ }
603667
+ }
603668
+ }
603380
603669
  let fullOk = true;
603381
603670
  if (process.env["OMNIUS_INSTALL_FULL_EMBED_DEPS"] === "1") {
603382
- const fullPkgs = ["torch", "torchaudio", "open_clip_torch", "speechbrain"];
603383
- const full = spawnSync8(pip, ["install", "--upgrade", ...fullPkgs], { encoding: "utf8", timeout: 18e5 });
603671
+ const jetsonCudaRequired = isJetsonHost2() && cudaHardwarePresent() && !asrCpuAllowed();
603672
+ const fullPkgs = jetsonCudaRequired ? ["open_clip_torch", "speechbrain"] : ["torch", "torchaudio", "open_clip_torch", "speechbrain"];
603673
+ if (jetsonCudaRequired) {
603674
+ log22 += "Jetson CUDA ASR active; installing optional embed deps without resolving generic torch/torchaudio from PyPI.\n";
603675
+ }
603676
+ const full = spawnSync8(
603677
+ pip,
603678
+ jetsonCudaRequired ? ["install", "--upgrade", "--no-deps", ...fullPkgs] : ["install", "--upgrade", ...fullPkgs],
603679
+ { encoding: "utf8", timeout: 18e5 }
603680
+ );
603384
603681
  log22 += full.stdout + full.stderr;
603385
603682
  fullOk = full.status === 0;
603386
603683
  }
603387
- const ok3 = ins.status === 0 && up.status === 0 && fullOk;
603684
+ const ok3 = asrDepsOk && up.status === 0 && fullOk && torchOk;
603388
603685
  return { ok: ok3, log: log22 };
603389
603686
  }
603390
603687
  function runEmbedImage(input) {
@@ -603998,16 +604295,19 @@ var init_listen = __esm({
603998
604295
  const ensure = mod3.ensureEmbedDeps;
603999
604296
  const getPy = mod3.getVenvPython;
604000
604297
  if (typeof ensure === "function") {
604001
- try {
604002
- const res = ensure();
604003
- if (res?.log) this.emit("status", res.log.slice(-500));
604004
- } catch {
604298
+ const res = ensure();
604299
+ if (res?.log) this.emit("status", res.log.slice(-500));
604300
+ if (res && res.ok === false) {
604301
+ throw new Error(`ASR Python dependency setup failed: ${String(res.log ?? "").slice(-1200)}`);
604005
604302
  }
604006
604303
  }
604007
604304
  if (typeof getPy === "function") {
604008
604305
  pyPath = getPy();
604009
604306
  }
604010
- } catch {
604307
+ } catch (err) {
604308
+ if (err instanceof Error && err.message.startsWith("ASR Python dependency setup failed:")) {
604309
+ throw err;
604310
+ }
604011
604311
  }
604012
604312
  updateListenLiveState({
604013
604313
  phase: "loading-model",
@@ -604094,7 +604394,13 @@ var init_listen = __esm({
604094
604394
  break;
604095
604395
  }
604096
604396
  case "error":
604097
- this.emit("error", new Error(evt.message));
604397
+ {
604398
+ const err = new Error(String(evt.message ?? "Whisper worker error"));
604399
+ clearTimeout(timeout2);
604400
+ updateListenLiveState({ phase: "error", lastStatus: err.message.slice(0, 160) });
604401
+ this.emit("error", err);
604402
+ reject(err);
604403
+ }
604098
604404
  break;
604099
604405
  }
604100
604406
  } catch {
@@ -605049,7 +605355,7 @@ var init_camera_streamer = __esm({
605049
605355
  });
605050
605356
 
605051
605357
  // packages/cli/src/tui/live-vlm.ts
605052
- import { existsSync as existsSync113, readFileSync as readFileSync91, statSync as statSync44 } from "node:fs";
605358
+ import { existsSync as existsSync113, readFileSync as readFileSync92, statSync as statSync44 } from "node:fs";
605053
605359
  var DEFAULT_LIVE_VLM_MODEL, MAX_IMAGE_BYTES, VLM_SYSTEM_PROMPT, LiveVlmEngine;
605054
605360
  var init_live_vlm = __esm({
605055
605361
  "packages/cli/src/tui/live-vlm.ts"() {
@@ -605178,7 +605484,7 @@ var init_live_vlm = __esm({
605178
605484
  this.describeInFlight = true;
605179
605485
  try {
605180
605486
  if (!await this.ensureModel()) return null;
605181
- const image = readFileSync91(framePath).toString("base64");
605487
+ const image = readFileSync92(framePath).toString("base64");
605182
605488
  const heard = String(opts.heard ?? "").trim();
605183
605489
  const userText = [
605184
605490
  opts.source ? `Camera: ${opts.source}` : "",
@@ -605611,7 +605917,7 @@ var init_live_resource_arbiter = __esm({
605611
605917
  });
605612
605918
 
605613
605919
  // packages/cli/src/tui/live-sensors.ts
605614
- import { existsSync as existsSync114, mkdirSync as mkdirSync70, readFileSync as readFileSync92, writeFileSync as writeFileSync58 } from "node:fs";
605920
+ import { existsSync as existsSync114, mkdirSync as mkdirSync70, readFileSync as readFileSync93, writeFileSync as writeFileSync58 } from "node:fs";
605615
605921
  import { arch as arch3, freemem as freemem5 } from "node:os";
605616
605922
  import { basename as basename23, join as join128, relative as relative11 } from "node:path";
605617
605923
  function liveDir(repoRoot) {
@@ -606049,7 +606355,7 @@ function sanitizeLiveAudioError(value2) {
606049
606355
  }
606050
606356
  function readPcm16WavActivity(filePath, bins = 36) {
606051
606357
  try {
606052
- const buf = readFileSync92(filePath);
606358
+ const buf = readFileSync93(filePath);
606053
606359
  if (buf.length < 44 || buf.toString("ascii", 0, 4) !== "RIFF" || buf.toString("ascii", 8, 12) !== "WAVE") return void 0;
606054
606360
  let offset = 12;
606055
606361
  let channels = 1;
@@ -606942,7 +607248,7 @@ function parseCameraListText(raw) {
606942
607248
  }
606943
607249
  function loadLiveSensorConfig(repoRoot) {
606944
607250
  try {
606945
- const parsed = JSON.parse(readFileSync92(liveConfigPath(repoRoot), "utf8"));
607251
+ const parsed = JSON.parse(readFileSync93(liveConfigPath(repoRoot), "utf8"));
606946
607252
  return {
606947
607253
  ...DEFAULT_CONFIG7,
606948
607254
  ...parsed,
@@ -606957,7 +607263,7 @@ function loadLiveSensorConfig(repoRoot) {
606957
607263
  }
606958
607264
  function readLiveSensorSnapshot(repoRoot) {
606959
607265
  try {
606960
- const parsed = JSON.parse(readFileSync92(liveSnapshotPath(repoRoot), "utf8"));
607266
+ const parsed = JSON.parse(readFileSync93(liveSnapshotPath(repoRoot), "utf8"));
606961
607267
  return parsed?.version === 1 ? parsed : null;
606962
607268
  } catch {
606963
607269
  return null;
@@ -607361,7 +607667,7 @@ async function recordAudioSampleWithRecovery(preferred, devices, durationSec, ou
607361
607667
  device: candidate,
607362
607668
  method,
607363
607669
  activity,
607364
- bytes: readFileSync92(outputPath3),
607670
+ bytes: readFileSync93(outputPath3),
607365
607671
  errors: [...errors]
607366
607672
  };
607367
607673
  }
@@ -607424,7 +607730,7 @@ function isJetsonUnifiedMemoryHost() {
607424
607730
  if (!["arm64", "aarch64"].includes(arch3())) return false;
607425
607731
  if (existsSync114("/etc/nv_tegra_release")) return true;
607426
607732
  try {
607427
- const model = readFileSync92("/proc/device-tree/model", "utf8");
607733
+ const model = readFileSync93("/proc/device-tree/model", "utf8");
607428
607734
  return /nvidia|jetson|orin|tegra/i.test(model);
607429
607735
  } catch {
607430
607736
  return false;
@@ -608453,6 +608759,7 @@ var init_live_sensors = __esm({
608453
608759
  this.lastInferenceAt.set(source, sampledAt);
608454
608760
  const loop = new LiveMediaLoopTool(this.repoRoot);
608455
608761
  const inferFromCapturedFrame = preview.ok && Boolean(preview.framePath);
608762
+ const captureSize = liveCameraResolutionSize(this.getCameraStreamResolution(source));
608456
608763
  const mediaAbortController = new AbortController();
608457
608764
  this.liveMediaAbortControllers.add(mediaAbortController);
608458
608765
  const result = await this.runSequentialLiveVision(() => loop.execute({
@@ -608467,6 +608774,8 @@ var init_live_sensors = __esm({
608467
608774
  sample_interval_sec: inferFromCapturedFrame ? 0.1 : 0.25,
608468
608775
  max_frames: 1,
608469
608776
  rotate_degrees: inferFromCapturedFrame ? 0 : orientation?.rotation ?? 0,
608777
+ ...inferFromCapturedFrame || !captureSize ? {} : { width: captureSize.width, height: captureSize.height },
608778
+ ...inferFromCapturedFrame ? {} : { fps: this.getCameraStreamFps(source) },
608470
608779
  auto_bootstrap: true,
608471
608780
  audio_mode: "none",
608472
608781
  detect_objects: true,
@@ -609296,7 +609605,7 @@ var init_tool_adapter = __esm({
609296
609605
  });
609297
609606
 
609298
609607
  // packages/cli/src/tui/runtime-verification.ts
609299
- import { existsSync as existsSync115, readFileSync as readFileSync93, readdirSync as readdirSync37 } from "node:fs";
609608
+ import { existsSync as existsSync115, readFileSync as readFileSync94, readdirSync as readdirSync37 } from "node:fs";
609300
609609
  import { dirname as dirname38, extname as extname14, join as join129, relative as relative12, resolve as resolve54 } from "node:path";
609301
609610
  function safeRelative(root, file) {
609302
609611
  const rel = relative12(root, file);
@@ -609350,7 +609659,7 @@ function resolveScriptSource(root, htmlFile, src2) {
609350
609659
  function referencedScriptAssets(root, htmlFile) {
609351
609660
  let html = "";
609352
609661
  try {
609353
- html = readFileSync93(htmlFile, "utf8");
609662
+ html = readFileSync94(htmlFile, "utf8");
609354
609663
  } catch {
609355
609664
  return [];
609356
609665
  }
@@ -609393,7 +609702,7 @@ async function runStaticRuntimeAssetSyntaxCheck(projectRoot, options2 = {}) {
609393
609702
  if (issueByAsset.has(assetFile)) continue;
609394
609703
  let source = "";
609395
609704
  try {
609396
- source = readFileSync93(assetFile, "utf8");
609705
+ source = readFileSync94(assetFile, "utf8");
609397
609706
  } catch {
609398
609707
  continue;
609399
609708
  }
@@ -615736,7 +616045,7 @@ async function fetchOpenAIModels(baseUrl2, apiKey) {
615736
616045
  async function fetchPeerModels(peerId, authKey) {
615737
616046
  try {
615738
616047
  const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports2));
615739
- const { existsSync: existsSync173, readFileSync: readFileSync141 } = await import("node:fs");
616048
+ const { existsSync: existsSync173, readFileSync: readFileSync142 } = await import("node:fs");
615740
616049
  const { join: join188 } = await import("node:path");
615741
616050
  const cwd4 = process.cwd();
615742
616051
  const nexusTool = new NexusTool2(cwd4);
@@ -615745,7 +616054,7 @@ async function fetchPeerModels(peerId, authKey) {
615745
616054
  try {
615746
616055
  const statusPath = join188(nexusDir, "status.json");
615747
616056
  if (existsSync173(statusPath)) {
615748
- const status = JSON.parse(readFileSync141(statusPath, "utf8"));
616057
+ const status = JSON.parse(readFileSync142(statusPath, "utf8"));
615749
616058
  if (status.peerId === peerId) isLocalPeer = true;
615750
616059
  }
615751
616060
  } catch {
@@ -615754,7 +616063,7 @@ async function fetchPeerModels(peerId, authKey) {
615754
616063
  const pricingPath = join188(nexusDir, "pricing.json");
615755
616064
  if (existsSync173(pricingPath)) {
615756
616065
  try {
615757
- const pricing = JSON.parse(readFileSync141(pricingPath, "utf8"));
616066
+ const pricing = JSON.parse(readFileSync142(pricingPath, "utf8"));
615758
616067
  const localModels = (pricing.models || []).map((m2) => ({
615759
616068
  name: m2.model || "unknown",
615760
616069
  size: m2.parameterSize || "",
@@ -615770,7 +616079,7 @@ async function fetchPeerModels(peerId, authKey) {
615770
616079
  const cachePath2 = join188(nexusDir, "peer-models-cache.json");
615771
616080
  if (existsSync173(cachePath2)) {
615772
616081
  try {
615773
- const cache8 = JSON.parse(readFileSync141(cachePath2, "utf8"));
616082
+ const cache8 = JSON.parse(readFileSync142(cachePath2, "utf8"));
615774
616083
  if (cache8.peerId === peerId && cache8.models?.length > 0) {
615775
616084
  const age = Date.now() - new Date(cache8.cachedAt).getTime();
615776
616085
  if (age < 5 * 60 * 1e3) {
@@ -615885,7 +616194,7 @@ async function fetchPeerModels(peerId, authKey) {
615885
616194
  const pricingPath = join188(nexusDir, "pricing.json");
615886
616195
  if (existsSync173(pricingPath)) {
615887
616196
  try {
615888
- const pricing = JSON.parse(readFileSync141(pricingPath, "utf8"));
616197
+ const pricing = JSON.parse(readFileSync142(pricingPath, "utf8"));
615889
616198
  return (pricing.models || []).map((m2) => ({
615890
616199
  name: m2.model || "unknown",
615891
616200
  size: m2.parameterSize || "",
@@ -619556,7 +619865,7 @@ var init_voice_session = __esm({
619556
619865
 
619557
619866
  // packages/cli/src/tui/scoped-personality.ts
619558
619867
  import { createHash as createHash32 } from "node:crypto";
619559
- import { appendFileSync as appendFileSync12, existsSync as existsSync116, mkdirSync as mkdirSync71, readFileSync as readFileSync94, writeFileSync as writeFileSync59 } from "node:fs";
619868
+ import { appendFileSync as appendFileSync12, existsSync as existsSync116, mkdirSync as mkdirSync71, readFileSync as readFileSync95, writeFileSync as writeFileSync59 } from "node:fs";
619560
619869
  import { join as join130, resolve as resolve55 } from "node:path";
619561
619870
  function safeName(input) {
619562
619871
  return input.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 80) || "default";
@@ -619711,7 +620020,7 @@ function loadScopedPersonality(scope) {
619711
620020
  const paths = scopedPersonalityPaths(scope);
619712
620021
  if (!existsSync116(paths.json)) return newDocument(scope);
619713
620022
  try {
619714
- const parsed = JSON.parse(readFileSync94(paths.json, "utf8"));
620023
+ const parsed = JSON.parse(readFileSync95(paths.json, "utf8"));
619715
620024
  if (parsed.version !== PROFILE_VERSION) return newDocument(scope);
619716
620025
  return normalizeDocument(scope, parsed);
619717
620026
  } catch {
@@ -619935,7 +620244,7 @@ var init_scoped_personality = __esm({
619935
620244
 
619936
620245
  // packages/cli/src/tui/voice-soul.ts
619937
620246
  import { createHash as createHash33 } from "node:crypto";
619938
- import { existsSync as existsSync117, readdirSync as readdirSync38, readFileSync as readFileSync95 } from "node:fs";
620247
+ import { existsSync as existsSync117, readdirSync as readdirSync38, readFileSync as readFileSync96 } from "node:fs";
619939
620248
  import { basename as basename24, join as join131, resolve as resolve56 } from "node:path";
619940
620249
  function compactText(text2, limit) {
619941
620250
  const compact4 = text2.replace(/\s+/g, " ").trim();
@@ -619962,7 +620271,7 @@ function loadSoulRuntimeState(input) {
619962
620271
  const path12 = soulRuntimeStatePath(input);
619963
620272
  if (!existsSync117(path12)) return { version: 1 };
619964
620273
  try {
619965
- const parsed = JSON.parse(readFileSync95(path12, "utf8"));
620274
+ const parsed = JSON.parse(readFileSync96(path12, "utf8"));
619966
620275
  if (!parsed || parsed.version !== 1) return { version: 1 };
619967
620276
  return {
619968
620277
  version: 1,
@@ -620080,7 +620389,7 @@ function findProjectSoul(scope) {
620080
620389
  ]) {
620081
620390
  if (!existsSync117(candidate)) continue;
620082
620391
  try {
620083
- return { path: candidate, content: readFileSync95(candidate, "utf8") };
620392
+ return { path: candidate, content: readFileSync96(candidate, "utf8") };
620084
620393
  } catch {
620085
620394
  return null;
620086
620395
  }
@@ -620099,7 +620408,7 @@ function findProjectVoice(scope) {
620099
620408
  const first2 = files[0];
620100
620409
  if (!first2) return null;
620101
620410
  const path12 = join131(voiceDir3, first2);
620102
- return { path: path12, content: readFileSync95(path12, "utf8") };
620411
+ return { path: path12, content: readFileSync96(path12, "utf8") };
620103
620412
  } catch {
620104
620413
  return null;
620105
620414
  }
@@ -620364,7 +620673,7 @@ import { EventEmitter as EventEmitter8 } from "node:events";
620364
620673
  import { randomBytes as randomBytes22, timingSafeEqual } from "node:crypto";
620365
620674
  import { URL as URL2 } from "node:url";
620366
620675
  import { loadavg as loadavg2, cpus as cpus4, totalmem as totalmem7, freemem as freemem6 } from "node:os";
620367
- import { existsSync as existsSync118, readFileSync as readFileSync96, writeFileSync as writeFileSync60, unlinkSync as unlinkSync21, mkdirSync as mkdirSync72, readdirSync as readdirSync39, statSync as statSync45, statfsSync as statfsSync7 } from "node:fs";
620676
+ import { existsSync as existsSync118, readFileSync as readFileSync97, writeFileSync as writeFileSync60, unlinkSync as unlinkSync21, mkdirSync as mkdirSync72, readdirSync as readdirSync39, statSync as statSync45, statfsSync as statfsSync7 } from "node:fs";
620368
620677
  import { join as join132 } from "node:path";
620369
620678
  function cleanForwardHeaders(raw, targetHost) {
620370
620679
  const out = {};
@@ -620535,7 +620844,7 @@ function readSponsorUsageState(stateDir) {
620535
620844
  try {
620536
620845
  const path12 = join132(stateDir, "sponsor", SPONSOR_USAGE_FILE_NAME);
620537
620846
  if (!existsSync118(path12)) return null;
620538
- const parsed = JSON.parse(readFileSync96(path12, "utf8"));
620847
+ const parsed = JSON.parse(readFileSync97(path12, "utf8"));
620539
620848
  const dailyTokensUsed = safeNonNegativeInt(parsed.dailyTokensUsed);
620540
620849
  const dailyTokensResetAt = safeNonNegativeInt(parsed.dailyTokensResetAt);
620541
620850
  if (!dailyTokensResetAt) return null;
@@ -620560,7 +620869,7 @@ function readExposeState(stateDir) {
620560
620869
  try {
620561
620870
  const path12 = join132(stateDir, STATE_FILE_NAME);
620562
620871
  if (!existsSync118(path12)) return null;
620563
- const raw = readFileSync96(path12, "utf8");
620872
+ const raw = readFileSync97(path12, "utf8");
620564
620873
  const data = JSON.parse(raw);
620565
620874
  if (!data.pid || !data.tunnelUrl || !data.authKey || !data.proxyPort) return null;
620566
620875
  return data;
@@ -620698,7 +621007,7 @@ function readP2PExposeState(stateDir) {
620698
621007
  try {
620699
621008
  const path12 = join132(stateDir, P2P_STATE_FILE_NAME);
620700
621009
  if (!existsSync118(path12)) return null;
620701
- const raw = readFileSync96(path12, "utf8");
621010
+ const raw = readFileSync97(path12, "utf8");
620702
621011
  const data = JSON.parse(raw);
620703
621012
  if (!data.peerId || !data.authKey) return null;
620704
621013
  return data;
@@ -622102,7 +622411,7 @@ ${this.formatConnectionInfo()}`);
622102
622411
  const statusPath = join132(nexusDir, "status.json");
622103
622412
  for (let i2 = 0; i2 < 80; i2++) {
622104
622413
  try {
622105
- const raw = readFileSync96(statusPath, "utf8");
622414
+ const raw = readFileSync97(statusPath, "utf8");
622106
622415
  if (raw.length > 10) {
622107
622416
  const status = JSON.parse(raw);
622108
622417
  if (status.connected && status.peerId) {
@@ -622167,7 +622476,7 @@ ${this.formatConnectionInfo()}`);
622167
622476
  removeP2PExposeState(stateDir);
622168
622477
  return null;
622169
622478
  }
622170
- const status = JSON.parse(readFileSync96(statusPath, "utf8"));
622479
+ const status = JSON.parse(readFileSync97(statusPath, "utf8"));
622171
622480
  if (!status.connected || !status.peerId) {
622172
622481
  removeP2PExposeState(stateDir);
622173
622482
  return null;
@@ -622245,7 +622554,7 @@ ${this.formatConnectionInfo()}`);
622245
622554
  let meteringLines = lastMeteringLineCount;
622246
622555
  try {
622247
622556
  if (existsSync118(meteringFile)) {
622248
- const content = readFileSync96(meteringFile, "utf8");
622557
+ const content = readFileSync97(meteringFile, "utf8");
622249
622558
  meteringLines = content.split("\n").filter((l2) => l2.trim()).length;
622250
622559
  }
622251
622560
  } catch {
@@ -622274,7 +622583,7 @@ ${this.formatConnectionInfo()}`);
622274
622583
  try {
622275
622584
  const statusPath = join132(nexusDir, "status.json");
622276
622585
  if (existsSync118(statusPath)) {
622277
- const status = JSON.parse(readFileSync96(statusPath, "utf8"));
622586
+ const status = JSON.parse(readFileSync97(statusPath, "utf8"));
622278
622587
  if (status.peerId && !this._peerId) {
622279
622588
  this._peerId = status.peerId;
622280
622589
  }
@@ -622297,7 +622606,7 @@ ${this.formatConnectionInfo()}`);
622297
622606
  try {
622298
622607
  const meteringFile = join132(nexusDir, "metering.jsonl");
622299
622608
  if (existsSync118(meteringFile)) {
622300
- const content = readFileSync96(meteringFile, "utf8");
622609
+ const content = readFileSync97(meteringFile, "utf8");
622301
622610
  if (content.length > lastMeteringSize) {
622302
622611
  const newContent = content.slice(lastMeteringSize);
622303
622612
  lastMeteringSize = content.length;
@@ -622594,7 +622903,7 @@ var init_types3 = __esm({
622594
622903
 
622595
622904
  // packages/cli/src/tui/p2p/secret-vault.ts
622596
622905
  import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes23, scryptSync as scryptSync2, createHash as createHash34 } from "node:crypto";
622597
- import { readFileSync as readFileSync97, writeFileSync as writeFileSync61, existsSync as existsSync119, mkdirSync as mkdirSync73 } from "node:fs";
622906
+ import { readFileSync as readFileSync98, writeFileSync as writeFileSync61, existsSync as existsSync119, mkdirSync as mkdirSync73 } from "node:fs";
622598
622907
  import { dirname as dirname39 } from "node:path";
622599
622908
  var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
622600
622909
  var init_secret_vault = __esm({
@@ -622812,7 +623121,7 @@ var init_secret_vault = __esm({
622812
623121
  */
622813
623122
  load(passphrase) {
622814
623123
  if (!this.storePath || !existsSync119(this.storePath)) return 0;
622815
- const blob = readFileSync97(this.storePath);
623124
+ const blob = readFileSync98(this.storePath);
622816
623125
  if (blob.length < SALT_LEN + IV_LEN + 16) {
622817
623126
  throw new Error("Vault file is corrupted (too small)");
622818
623127
  }
@@ -623850,7 +624159,7 @@ ${activitySummary}
623850
624159
  });
623851
624160
 
623852
624161
  // packages/cli/src/api/profiles.ts
623853
- import { existsSync as existsSync120, readFileSync as readFileSync98, writeFileSync as writeFileSync62, mkdirSync as mkdirSync74, readdirSync as readdirSync40, unlinkSync as unlinkSync22 } from "node:fs";
624162
+ import { existsSync as existsSync120, readFileSync as readFileSync99, writeFileSync as writeFileSync62, mkdirSync as mkdirSync74, readdirSync as readdirSync40, unlinkSync as unlinkSync22 } from "node:fs";
623854
624163
  import { join as join134 } from "node:path";
623855
624164
  import { homedir as homedir41 } from "node:os";
623856
624165
  import { createCipheriv as createCipheriv4, createDecipheriv as createDecipheriv4, randomBytes as randomBytes25, scryptSync as scryptSync3 } from "node:crypto";
@@ -623870,7 +624179,7 @@ function listProfiles(projectDir2) {
623870
624179
  if (existsSync120(projDir)) {
623871
624180
  for (const f2 of readdirSync40(projDir).filter((f3) => f3.endsWith(".json"))) {
623872
624181
  try {
623873
- const raw = JSON.parse(readFileSync98(join134(projDir, f2), "utf8"));
624182
+ const raw = JSON.parse(readFileSync99(join134(projDir, f2), "utf8"));
623874
624183
  const name10 = f2.replace(".json", "");
623875
624184
  seen.add(name10);
623876
624185
  result.push({
@@ -623889,7 +624198,7 @@ function listProfiles(projectDir2) {
623889
624198
  const name10 = f2.replace(".json", "");
623890
624199
  if (seen.has(name10)) continue;
623891
624200
  try {
623892
- const raw = JSON.parse(readFileSync98(join134(globDir, f2), "utf8"));
624201
+ const raw = JSON.parse(readFileSync99(join134(globDir, f2), "utf8"));
623893
624202
  result.push({
623894
624203
  name: name10,
623895
624204
  description: raw.description || "",
@@ -623925,7 +624234,7 @@ function loadProfileWithMeta(name10, password, projectDir2) {
623925
624234
  ];
623926
624235
  for (const candidate of candidates) {
623927
624236
  if (!existsSync120(candidate.path)) continue;
623928
- const raw = JSON.parse(readFileSync98(candidate.path, "utf8"));
624237
+ const raw = JSON.parse(readFileSync99(candidate.path, "utf8"));
623929
624238
  if (raw.encrypted === true) {
623930
624239
  if (!password) return null;
623931
624240
  const profile = decryptProfile(raw, password);
@@ -624232,7 +624541,7 @@ __export(omnius_directory_exports, {
624232
624541
  writeIndexMeta: () => writeIndexMeta,
624233
624542
  writeTaskHandoff: () => writeTaskHandoff2
624234
624543
  });
624235
- import { appendFileSync as appendFileSync13, cpSync as cpSync2, existsSync as existsSync121, mkdirSync as mkdirSync75, readFileSync as readFileSync99, writeFileSync as writeFileSync63, readdirSync as readdirSync41, statSync as statSync46, unlinkSync as unlinkSync23, openSync as openSync2, closeSync as closeSync2, renameSync as renameSync11, watch as fsWatch2 } from "node:fs";
624544
+ import { appendFileSync as appendFileSync13, cpSync as cpSync2, existsSync as existsSync121, mkdirSync as mkdirSync75, readFileSync as readFileSync100, writeFileSync as writeFileSync63, readdirSync as readdirSync41, statSync as statSync46, unlinkSync as unlinkSync23, openSync as openSync2, closeSync as closeSync2, renameSync as renameSync11, watch as fsWatch2 } from "node:fs";
624236
624545
  import { join as join135, relative as relative13, basename as basename25, dirname as dirname40, resolve as resolve57 } from "node:path";
624237
624546
  import { homedir as homedir42 } from "node:os";
624238
624547
  import { createHash as createHash37 } from "node:crypto";
@@ -624242,7 +624551,7 @@ function isGitRoot(dir) {
624242
624551
  try {
624243
624552
  const stat9 = statSync46(gitPath);
624244
624553
  if (stat9.isFile()) {
624245
- return readFileSync99(gitPath, "utf-8").trim().startsWith("gitdir:");
624554
+ return readFileSync100(gitPath, "utf-8").trim().startsWith("gitdir:");
624246
624555
  }
624247
624556
  if (!stat9.isDirectory()) return false;
624248
624557
  return existsSync121(join135(gitPath, "HEAD")) || existsSync121(join135(gitPath, "config")) || existsSync121(join135(gitPath, "commondir"));
@@ -624301,7 +624610,7 @@ function ensureOmniusIgnored(repoRoot) {
624301
624610
  const gitignoreDir = dirname40(gitignorePath);
624302
624611
  const relDir = relative13(gitignoreDir || ".", repoRoot).replace(/\\/g, "/");
624303
624612
  const ignorePattern = relDir && relDir !== "." ? `${relDir}/.omnius/` : ".omnius/";
624304
- const content = readFileSync99(gitignorePath, "utf-8");
624613
+ const content = readFileSync100(gitignorePath, "utf-8");
624305
624614
  const normalizedTarget = normalizeIgnoreRule(ignorePattern);
624306
624615
  const alreadyIgnored = content.split(/\r?\n/).some((line) => {
624307
624616
  const trimmed = line.trim();
@@ -624424,7 +624733,7 @@ function loadProjectSettings(repoRoot) {
624424
624733
  const settingsPath = join135(repoRoot, OMNIUS_DIR, "settings.json");
624425
624734
  try {
624426
624735
  if (existsSync121(settingsPath)) {
624427
- return JSON.parse(readFileSync99(settingsPath, "utf-8"));
624736
+ return JSON.parse(readFileSync100(settingsPath, "utf-8"));
624428
624737
  }
624429
624738
  } catch {
624430
624739
  }
@@ -624441,7 +624750,7 @@ function loadGlobalSettings() {
624441
624750
  const settingsPath = join135(homedir42(), ".omnius", "settings.json");
624442
624751
  try {
624443
624752
  if (existsSync121(settingsPath)) {
624444
- return JSON.parse(readFileSync99(settingsPath, "utf-8"));
624753
+ return JSON.parse(readFileSync100(settingsPath, "utf-8"));
624445
624754
  }
624446
624755
  } catch {
624447
624756
  }
@@ -624472,7 +624781,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
624472
624781
  if (existsSync121(filePath) && !seen.has(filePath)) {
624473
624782
  seen.add(filePath);
624474
624783
  try {
624475
- let content = readFileSync99(filePath, "utf-8");
624784
+ let content = readFileSync100(filePath, "utf-8");
624476
624785
  if (content.length > maxContentLen) {
624477
624786
  content = content.slice(0, maxContentLen) + "\n\n...(truncated)";
624478
624787
  }
@@ -624505,7 +624814,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
624505
624814
  function readIndexMeta(repoRoot) {
624506
624815
  const metaPath = join135(repoRoot, OMNIUS_DIR, "index", "meta.json");
624507
624816
  try {
624508
- return JSON.parse(readFileSync99(metaPath, "utf-8"));
624817
+ return JSON.parse(readFileSync100(metaPath, "utf-8"));
624509
624818
  } catch {
624510
624819
  return null;
624511
624820
  }
@@ -624518,7 +624827,7 @@ function writeIndexMeta(repoRoot, meta) {
624518
624827
  function readIndexData(repoRoot, filename) {
624519
624828
  const filePath = join135(repoRoot, OMNIUS_DIR, "index", filename);
624520
624829
  try {
624521
- return JSON.parse(readFileSync99(filePath, "utf-8"));
624830
+ return JSON.parse(readFileSync100(filePath, "utf-8"));
624522
624831
  } catch {
624523
624832
  return null;
624524
624833
  }
@@ -624597,7 +624906,7 @@ function loadRecentSessions(repoRoot, limit = 5) {
624597
624906
  }).sort((a2, b) => b.mtime - a2.mtime).slice(0, limit);
624598
624907
  return files.map((f2) => {
624599
624908
  try {
624600
- return JSON.parse(readFileSync99(join135(historyDir, f2.file), "utf-8"));
624909
+ return JSON.parse(readFileSync100(join135(historyDir, f2.file), "utf-8"));
624601
624910
  } catch {
624602
624911
  return null;
624603
624912
  }
@@ -624621,7 +624930,7 @@ function loadPendingTask(repoRoot) {
624621
624930
  const filePath = join135(repoRoot, OMNIUS_DIR, "history", PENDING_TASK_FILE);
624622
624931
  try {
624623
624932
  if (!existsSync121(filePath)) return null;
624624
- const data = JSON.parse(readFileSync99(filePath, "utf-8"));
624933
+ const data = JSON.parse(readFileSync100(filePath, "utf-8"));
624625
624934
  try {
624626
624935
  unlinkSync23(filePath);
624627
624936
  } catch {
@@ -624651,7 +624960,7 @@ function readTaskHandoff2(repoRoot) {
624651
624960
  const filePath = join135(repoRoot, OMNIUS_DIR, "context", HANDOFF_FILE);
624652
624961
  try {
624653
624962
  if (!existsSync121(filePath)) return null;
624654
- const data = JSON.parse(readFileSync99(filePath, "utf-8"));
624963
+ const data = JSON.parse(readFileSync100(filePath, "utf-8"));
624655
624964
  const handoffTime = new Date(data.handoffAt).getTime();
624656
624965
  const now2 = Date.now();
624657
624966
  const ageMs = now2 - handoffTime;
@@ -624737,7 +625046,7 @@ function acquireLock(lockPath) {
624737
625046
  } catch (err) {
624738
625047
  if (existsSync121(lockPath)) {
624739
625048
  try {
624740
- const lockContent = readFileSync99(lockPath, "utf-8");
625049
+ const lockContent = readFileSync100(lockPath, "utf-8");
624741
625050
  const lock = JSON.parse(lockContent);
624742
625051
  const lockAge = Date.now() - lock.acquiredAt;
624743
625052
  if (lockAge > LOCK_TIMEOUT_MS) {
@@ -624763,7 +625072,7 @@ function acquireLock(lockPath) {
624763
625072
  function releaseLock(lockPath) {
624764
625073
  try {
624765
625074
  if (existsSync121(lockPath)) {
624766
- const lockContent = readFileSync99(lockPath, "utf-8");
625075
+ const lockContent = readFileSync100(lockPath, "utf-8");
624767
625076
  const lock = JSON.parse(lockContent);
624768
625077
  if (lock.pid === process.pid) {
624769
625078
  unlinkSync23(lockPath);
@@ -624855,7 +625164,7 @@ function pruneContextLedger(ledgerPath) {
624855
625164
  if (!existsSync121(ledgerPath)) return;
624856
625165
  const st = statSync46(ledgerPath);
624857
625166
  if (st.size <= MAX_CONTEXT_LEDGER_BYTES) return;
624858
- const lines = readFileSync99(ledgerPath, "utf-8").split(/\r?\n/).filter((line) => line.trim().length > 0);
625167
+ const lines = readFileSync100(ledgerPath, "utf-8").split(/\r?\n/).filter((line) => line.trim().length > 0);
624859
625168
  if (lines.length <= MAX_CONTEXT_LEDGER_LINES) return;
624860
625169
  const kept = lines.slice(-MAX_CONTEXT_LEDGER_LINES);
624861
625170
  const archiveDir = join135(dirname40(ledgerPath), "archive");
@@ -624883,7 +625192,7 @@ function saveSessionContext(repoRoot, entry) {
624883
625192
  let ctx3;
624884
625193
  try {
624885
625194
  if (existsSync121(filePath)) {
624886
- ctx3 = JSON.parse(readFileSync99(filePath, "utf-8"));
625195
+ ctx3 = JSON.parse(readFileSync100(filePath, "utf-8"));
624887
625196
  } else {
624888
625197
  ctx3 = { entries: [], maxEntries: MAX_CONTEXT_ENTRIES, updatedAt: "" };
624889
625198
  }
@@ -625045,7 +625354,7 @@ function loadSessionContext(repoRoot) {
625045
625354
  const filePath = join135(repoRoot, OMNIUS_DIR, "context", CONTEXT_SAVE_FILE);
625046
625355
  try {
625047
625356
  if (!existsSync121(filePath)) return null;
625048
- return JSON.parse(readFileSync99(filePath, "utf-8"));
625357
+ return JSON.parse(readFileSync100(filePath, "utf-8"));
625049
625358
  } catch {
625050
625359
  return null;
625051
625360
  }
@@ -625053,7 +625362,7 @@ function loadSessionContext(repoRoot) {
625053
625362
  function readJsonOrNull(filePath) {
625054
625363
  try {
625055
625364
  if (!existsSync121(filePath)) return null;
625056
- return JSON.parse(readFileSync99(filePath, "utf-8"));
625365
+ return JSON.parse(readFileSync100(filePath, "utf-8"));
625057
625366
  } catch {
625058
625367
  return null;
625059
625368
  }
@@ -625264,7 +625573,7 @@ function updateSessionEntry(repoRoot, sessionId, patch) {
625264
625573
  const indexPath = join135(repoRoot, OMNIUS_DIR, SESSIONS_DIR, SESSIONS_INDEX);
625265
625574
  try {
625266
625575
  if (!existsSync121(indexPath)) return false;
625267
- const index = JSON.parse(readFileSync99(indexPath, "utf-8"));
625576
+ const index = JSON.parse(readFileSync100(indexPath, "utf-8"));
625268
625577
  const idx = index.findIndex((e2) => e2.id === sessionId);
625269
625578
  if (idx < 0) return false;
625270
625579
  index[idx] = { ...index[idx], ...patch };
@@ -625313,7 +625622,7 @@ function saveSessionHistory(repoRoot, sessionId, contentLines, meta) {
625313
625622
  let index = [];
625314
625623
  try {
625315
625624
  if (existsSync121(indexPath)) {
625316
- index = JSON.parse(readFileSync99(indexPath, "utf-8"));
625625
+ index = JSON.parse(readFileSync100(indexPath, "utf-8"));
625317
625626
  }
625318
625627
  } catch {
625319
625628
  }
@@ -625345,7 +625654,7 @@ function listSessions(repoRoot) {
625345
625654
  const indexPath = join135(repoRoot, OMNIUS_DIR, SESSIONS_DIR, SESSIONS_INDEX);
625346
625655
  try {
625347
625656
  if (!existsSync121(indexPath)) return [];
625348
- const index = JSON.parse(readFileSync99(indexPath, "utf-8"));
625657
+ const index = JSON.parse(readFileSync100(indexPath, "utf-8"));
625349
625658
  return index.map((entry) => sanitizeSessionHistoryEntry(repoRoot, entry)).sort((a2, b) => b.updatedAt.localeCompare(a2.updatedAt));
625350
625659
  } catch {
625351
625660
  return [];
@@ -625355,7 +625664,7 @@ function loadSessionHistory(repoRoot, sessionId) {
625355
625664
  const contentPath = join135(repoRoot, OMNIUS_DIR, SESSIONS_DIR, `${sessionId}.jsonl`);
625356
625665
  try {
625357
625666
  if (!existsSync121(contentPath)) return null;
625358
- return readFileSync99(contentPath, "utf-8").split("\n");
625667
+ return readFileSync100(contentPath, "utf-8").split("\n");
625359
625668
  } catch {
625360
625669
  return null;
625361
625670
  }
@@ -625367,7 +625676,7 @@ function deleteSession(repoRoot, sessionId) {
625367
625676
  const contentPath = join135(sessDir, `${sessionId}.jsonl`);
625368
625677
  if (existsSync121(contentPath)) unlinkSync23(contentPath);
625369
625678
  if (existsSync121(indexPath)) {
625370
- let index = JSON.parse(readFileSync99(indexPath, "utf-8"));
625679
+ let index = JSON.parse(readFileSync100(indexPath, "utf-8"));
625371
625680
  index = index.filter((s2) => s2.id !== sessionId);
625372
625681
  writeFileSync63(indexPath, JSON.stringify(index, null, 2), "utf-8");
625373
625682
  }
@@ -625424,7 +625733,7 @@ function detectManifests(repoRoot) {
625424
625733
  let name10;
625425
625734
  if (check.nameField) {
625426
625735
  try {
625427
- const data = JSON.parse(readFileSync99(filePath, "utf-8"));
625736
+ const data = JSON.parse(readFileSync100(filePath, "utf-8"));
625428
625737
  name10 = data[check.nameField];
625429
625738
  } catch {
625430
625739
  }
@@ -625495,7 +625804,7 @@ function buildDirTree(root, maxDepth, prefix = "", depth = 0) {
625495
625804
  function loadUsageFile(filePath) {
625496
625805
  try {
625497
625806
  if (existsSync121(filePath)) {
625498
- return JSON.parse(readFileSync99(filePath, "utf-8"));
625807
+ return JSON.parse(readFileSync100(filePath, "utf-8"));
625499
625808
  }
625500
625809
  } catch {
625501
625810
  }
@@ -625822,7 +626131,7 @@ var init_session_summary = __esm({
625822
626131
 
625823
626132
  // packages/cli/src/tui/cad-model-viewer.ts
625824
626133
  import { createServer as createServer7 } from "node:http";
625825
- import { existsSync as existsSync122, readFileSync as readFileSync100, statSync as statSync47 } from "node:fs";
626134
+ import { existsSync as existsSync122, readFileSync as readFileSync101, statSync as statSync47 } from "node:fs";
625826
626135
  import { basename as basename26, extname as extname16, resolve as resolve58 } from "node:path";
625827
626136
  function getCurrentCadModelViewer() {
625828
626137
  return currentViewer;
@@ -625882,7 +626191,7 @@ function handleViewerRequest(req3, res, filePath) {
625882
626191
  "Content-Disposition": `inline; filename="${basename26(filePath).replace(/"/g, "")}"`,
625883
626192
  "Cache-Control": "no-store"
625884
626193
  });
625885
- res.end(readFileSync100(filePath));
626194
+ res.end(readFileSync101(filePath));
625886
626195
  } catch (err) {
625887
626196
  sendText(res, 500, err instanceof Error ? err.message : String(err));
625888
626197
  }
@@ -626286,7 +626595,7 @@ var init_render2 = __esm({
626286
626595
  });
626287
626596
 
626288
626597
  // packages/prompts/dist/promptLoader.js
626289
- import { readFileSync as readFileSync102, existsSync as existsSync124 } from "node:fs";
626598
+ import { readFileSync as readFileSync103, existsSync as existsSync124 } from "node:fs";
626290
626599
  import { join as join137, dirname as dirname41 } from "node:path";
626291
626600
  import { fileURLToPath as fileURLToPath17 } from "node:url";
626292
626601
  function loadPrompt2(promptPath, vars) {
@@ -626296,7 +626605,7 @@ function loadPrompt2(promptPath, vars) {
626296
626605
  if (!existsSync124(fullPath)) {
626297
626606
  throw new Error(`Prompt file not found: ${fullPath}`);
626298
626607
  }
626299
- content = readFileSync102(fullPath, "utf-8");
626608
+ content = readFileSync103(fullPath, "utf-8");
626300
626609
  cache6.set(promptPath, content);
626301
626610
  }
626302
626611
  if (!vars)
@@ -627415,7 +627724,7 @@ __export(tui_tasks_renderer_exports, {
627415
627724
  setTuiTasksSession: () => setTuiTasksSession,
627416
627725
  teardownTuiTasks: () => teardownTuiTasks
627417
627726
  });
627418
- import { existsSync as existsSync125, readFileSync as readFileSync103, watch as fsWatch3 } from "node:fs";
627727
+ import { existsSync as existsSync125, readFileSync as readFileSync104, watch as fsWatch3 } from "node:fs";
627419
627728
  import { join as join139 } from "node:path";
627420
627729
  import { homedir as homedir44 } from "node:os";
627421
627730
  function setTasksRendererWriter(writer) {
@@ -627542,7 +627851,7 @@ function loadTodos() {
627542
627851
  _lastTodos = [];
627543
627852
  return;
627544
627853
  }
627545
- const parsed = JSON.parse(readFileSync103(fp, "utf-8"));
627854
+ const parsed = JSON.parse(readFileSync104(fp, "utf-8"));
627546
627855
  _lastTodos = Array.isArray(parsed) ? parsed : [];
627547
627856
  } catch {
627548
627857
  _lastTodos = [];
@@ -633415,7 +633724,7 @@ __export(personaplex_exports, {
633415
633724
  startPersonaPlexDaemon: () => startPersonaPlexDaemon,
633416
633725
  stopPersonaPlex: () => stopPersonaPlex
633417
633726
  });
633418
- import { existsSync as existsSync126, writeFileSync as writeFileSync65, readFileSync as readFileSync104, mkdirSync as mkdirSync77, copyFileSync as copyFileSync5, readdirSync as readdirSync42, statSync as statSync48 } from "node:fs";
633727
+ import { existsSync as existsSync126, writeFileSync as writeFileSync65, readFileSync as readFileSync105, mkdirSync as mkdirSync77, copyFileSync as copyFileSync5, readdirSync as readdirSync42, statSync as statSync48 } from "node:fs";
633419
633728
  import { join as join140, dirname as dirname43 } from "node:path";
633420
633729
  import { homedir as homedir45 } from "node:os";
633421
633730
  import { spawn as spawn33 } from "node:child_process";
@@ -633454,9 +633763,9 @@ function selectWeightTier(vramGB) {
633454
633763
  }
633455
633764
  function detectJetson() {
633456
633765
  try {
633457
- const model = readFileSync104("/proc/device-tree/model", "utf8").replace(/\0/g, "").trim();
633766
+ const model = readFileSync105("/proc/device-tree/model", "utf8").replace(/\0/g, "").trim();
633458
633767
  if (/jetson|orin|tegra/i.test(model)) {
633459
- const memInfo = readFileSync104("/proc/meminfo", "utf8");
633768
+ const memInfo = readFileSync105("/proc/meminfo", "utf8");
633460
633769
  const memKB = parseInt(memInfo.match(/(\d+)/)?.[1] ?? "0", 10);
633461
633770
  return { isJetson: true, model, totalMemGB: memKB / 1024 / 1024 };
633462
633771
  }
@@ -633531,7 +633840,7 @@ function fileLink2(filePath, label) {
633531
633840
  }
633532
633841
  async function isPersonaPlexRunning() {
633533
633842
  if (!existsSync126(PID_FILE)) return false;
633534
- const pid = parseInt(readFileSync104(PID_FILE, "utf8").trim(), 10);
633843
+ const pid = parseInt(readFileSync105(PID_FILE, "utf8").trim(), 10);
633535
633844
  if (isNaN(pid) || pid <= 0) return false;
633536
633845
  try {
633537
633846
  process.kill(pid, 0);
@@ -633543,7 +633852,7 @@ async function isPersonaPlexRunning() {
633543
633852
  async function getPersonaPlexWSUrl() {
633544
633853
  if (!await isPersonaPlexRunning()) return null;
633545
633854
  if (!existsSync126(PORT_FILE)) return null;
633546
- const port = parseInt(readFileSync104(PORT_FILE, "utf8").trim(), 10);
633855
+ const port = parseInt(readFileSync105(PORT_FILE, "utf8").trim(), 10);
633547
633856
  return isNaN(port) ? null : `wss://127.0.0.1:${port}`;
633548
633857
  }
633549
633858
  function isPersonaPlexInstalled() {
@@ -633553,7 +633862,7 @@ async function getWeightTier() {
633553
633862
  const detected = await detectPersonaPlexCapability();
633554
633863
  const tierFile = join140(PERSONAPLEX_DIR, "weight_tier");
633555
633864
  if (existsSync126(tierFile)) {
633556
- const saved = readFileSync104(tierFile, "utf8").trim();
633865
+ const saved = readFileSync105(tierFile, "utf8").trim();
633557
633866
  if (saved in WEIGHT_REPOS) {
633558
633867
  const vram = detected.vramGB;
633559
633868
  if (saved === "nf4-distilled" && vram < 24) {
@@ -633683,7 +633992,7 @@ async function installPersonaPlex(onInfo, weightTier) {
633683
633992
  })).trim();
633684
633993
  const serverFile = join140(sitePackages, "server.py");
633685
633994
  if (existsSync126(serverFile)) {
633686
- let src2 = readFileSync104(serverFile, "utf8");
633995
+ let src2 = readFileSync105(serverFile, "utf8");
633687
633996
  if (src2.includes('int(request["seed"])')) {
633688
633997
  src2 = src2.replace('int(request["seed"])', 'int(request.query["seed"])');
633689
633998
  writeFileSync65(serverFile, src2);
@@ -633699,7 +634008,7 @@ async function installPersonaPlex(onInfo, weightTier) {
633699
634008
  })).trim();
633700
634009
  const loadersFile = join140(sitePackages, "models", "loaders.py");
633701
634010
  if (existsSync126(loadersFile)) {
633702
- let src2 = readFileSync104(loadersFile, "utf8");
634011
+ let src2 = readFileSync105(loadersFile, "utf8");
633703
634012
  if (!src2.includes("_dequantize_2bit_state_dict")) {
633704
634013
  const dequantPatch = `
633705
634014
  import math
@@ -633802,28 +634111,28 @@ $2if filename.endswith(".safetensors"):`
633802
634111
  })).trim();
633803
634112
  const hybridDest = join140(sitePackages2, "hybrid_agent.py");
633804
634113
  const serverDest = join140(sitePackages2, "server.py");
633805
- if (!existsSync126(hybridDest) || !readFileSync104(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
634114
+ if (!existsSync126(hybridDest) || !readFileSync105(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
633806
634115
  log22("Deploying hybrid_agent.py (Omnius API integration)...");
633807
634116
  try {
633808
634117
  await execAsync(
633809
634118
  `curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/hybrid_agent.py" -o "${hybridDest}"`,
633810
634119
  { timeout: 3e4 }
633811
634120
  );
633812
- if (existsSync126(hybridDest) && readFileSync104(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
634121
+ if (existsSync126(hybridDest) && readFileSync105(hybridDest, "utf8").includes("OMNIUS_API_BASE")) {
633813
634122
  log22("hybrid_agent.py deployed (Omnius API + Ollama fallback).");
633814
634123
  }
633815
634124
  } catch {
633816
634125
  log22("hybrid_agent.py download failed — hybrid mode will be disabled.");
633817
634126
  }
633818
634127
  }
633819
- if (!readFileSync104(serverDest, "utf8").includes("hybrid_agent")) {
634128
+ if (!readFileSync105(serverDest, "utf8").includes("hybrid_agent")) {
633820
634129
  log22("Deploying patched server.py (hybrid mode + API endpoints)...");
633821
634130
  try {
633822
634131
  await execAsync(
633823
634132
  `curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/server.py" -o "${serverDest}"`,
633824
634133
  { timeout: 3e4 }
633825
634134
  );
633826
- if (readFileSync104(serverDest, "utf8").includes("hybrid_agent")) {
634135
+ if (readFileSync105(serverDest, "utf8").includes("hybrid_agent")) {
633827
634136
  log22("server.py patched with hybrid intercept + REST APIs.");
633828
634137
  }
633829
634138
  } catch {
@@ -634013,7 +634322,7 @@ print('Converted')
634013
634322
  let ollamaModel = process.env["HYBRID_LLM_MODEL"] || "";
634014
634323
  if (!ollamaModel) {
634015
634324
  try {
634016
- const omniusConfig = JSON.parse(readFileSync104(join140(homedir45(), ".omnius", "config.json"), "utf8"));
634325
+ const omniusConfig = JSON.parse(readFileSync105(join140(homedir45(), ".omnius", "config.json"), "utf8"));
634017
634326
  if (omniusConfig.model) ollamaModel = omniusConfig.model;
634018
634327
  } catch {
634019
634328
  }
@@ -634108,7 +634417,7 @@ print('Converted')
634108
634417
  }
634109
634418
  async function stopPersonaPlex() {
634110
634419
  if (!existsSync126(PID_FILE)) return;
634111
- const pid = parseInt(readFileSync104(PID_FILE, "utf8").trim(), 10);
634420
+ const pid = parseInt(readFileSync105(PID_FILE, "utf8").trim(), 10);
634112
634421
  if (isNaN(pid) || pid <= 0) return;
634113
634422
  try {
634114
634423
  if (process.platform === "win32") {
@@ -634305,7 +634614,7 @@ function patchFrontendVoiceList(onInfo) {
634305
634614
  for (const f2 of readdirSync42(distDir)) {
634306
634615
  if (!f2.startsWith("index-") || !f2.endsWith(".js")) continue;
634307
634616
  const jsPath = join140(distDir, f2);
634308
- let js = readFileSync104(jsPath, "utf8");
634617
+ let js = readFileSync105(jsPath, "utf8");
634309
634618
  const customVoices = [];
634310
634619
  if (existsSync126(CUSTOM_VOICES_DIR)) {
634311
634620
  for (const vf of readdirSync42(CUSTOM_VOICES_DIR)) {
@@ -634425,7 +634734,7 @@ __export(setup_exports, {
634425
634734
  import * as readline from "node:readline";
634426
634735
  import { spawn as spawn34, exec as exec5 } from "node:child_process";
634427
634736
  import { promisify as promisify7 } from "node:util";
634428
- import { existsSync as existsSync127, writeFileSync as writeFileSync66, readFileSync as readFileSync105, appendFileSync as appendFileSync14, mkdirSync as mkdirSync78, chmodSync as chmodSync3 } from "node:fs";
634737
+ import { existsSync as existsSync127, writeFileSync as writeFileSync66, readFileSync as readFileSync106, appendFileSync as appendFileSync14, mkdirSync as mkdirSync78, chmodSync as chmodSync3 } from "node:fs";
634429
634738
  import { delimiter as pathDelimiter, join as join141 } from "node:path";
634430
634739
  import { freemem as freemem8, homedir as homedir46, platform as platform6, totalmem as totalmem9 } from "node:os";
634431
634740
  function wrapText2(value2, width) {
@@ -634481,14 +634790,14 @@ function detectUnifiedMemory(hasDiscreteGpu = false) {
634481
634790
  }
634482
634791
  try {
634483
634792
  if (existsSync127("/sys/devices/soc0/family")) {
634484
- const family = readFileSync105("/sys/devices/soc0/family", "utf8").trim().toLowerCase();
634793
+ const family = readFileSync106("/sys/devices/soc0/family", "utf8").trim().toLowerCase();
634485
634794
  if (family.includes("tegra")) return true;
634486
634795
  }
634487
634796
  } catch {
634488
634797
  }
634489
634798
  try {
634490
634799
  if (existsSync127("/proc/device-tree/model")) {
634491
- const model = readFileSync105("/proc/device-tree/model", "utf8").replace(/\0+$/, "").toLowerCase();
634800
+ const model = readFileSync106("/proc/device-tree/model", "utf8").replace(/\0+$/, "").toLowerCase();
634492
634801
  if (/jetson|tegra|orin|xavier|nano|raspberry|rockchip|rk\d{4}|mt\d{4}/.test(model)) {
634493
634802
  return true;
634494
634803
  }
@@ -636440,7 +636749,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
636440
636749
  let _visionPreviouslyInstalled = /* @__PURE__ */ new Set();
636441
636750
  try {
636442
636751
  if (existsSync127(_visionMarkerFile)) {
636443
- const _vm = JSON.parse(readFileSync105(_visionMarkerFile, "utf8"));
636752
+ const _vm = JSON.parse(readFileSync106(_visionMarkerFile, "utf8"));
636444
636753
  _visionPreviouslyInstalled = new Set(_vm.installed || []);
636445
636754
  }
636446
636755
  } catch {
@@ -637276,7 +637585,7 @@ function ensurePathInShellRc(binDir) {
637276
637585
  const shell = process.env.SHELL ?? "";
637277
637586
  const rcFile = shell.includes("zsh") ? join141(homedir46(), ".zshrc") : join141(homedir46(), ".bashrc");
637278
637587
  try {
637279
- const rcContent = existsSync127(rcFile) ? readFileSync105(rcFile, "utf8") : "";
637588
+ const rcContent = existsSync127(rcFile) ? readFileSync106(rcFile, "utf8") : "";
637280
637589
  if (rcContent.includes(binDir)) return;
637281
637590
  const exportLine = `
637282
637591
  export PATH="${binDir}:$PATH" # Added by omnius for nvim
@@ -638049,7 +638358,7 @@ var init_platforms = __esm({
638049
638358
  });
638050
638359
 
638051
638360
  // packages/cli/src/tui/workspace-explorer.ts
638052
- import { existsSync as existsSync129, readdirSync as readdirSync43, readFileSync as readFileSync106, statSync as statSync49 } from "node:fs";
638361
+ import { existsSync as existsSync129, readdirSync as readdirSync43, readFileSync as readFileSync107, statSync as statSync49 } from "node:fs";
638053
638362
  import { basename as basename27, extname as extname17, join as join142, relative as relative14, resolve as resolve59 } from "node:path";
638054
638363
  function exploreWorkspace(root, options2 = {}) {
638055
638364
  const query = (options2.query ?? "").trim().toLowerCase();
@@ -638148,7 +638457,7 @@ function previewWorkspaceFile(root, relPath, options2 = {}) {
638148
638457
  ""
638149
638458
  ].join("\n");
638150
638459
  }
638151
- const content = readFileSync106(full, "utf8");
638460
+ const content = readFileSync107(full, "utf8");
638152
638461
  const rawLines = content.split(/\r?\n/);
638153
638462
  const visible = rawLines.slice(0, maxLines);
638154
638463
  const gutter = String(Math.min(rawLines.length, maxLines)).length;
@@ -638324,7 +638633,7 @@ var init_pricing = __esm({
638324
638633
  });
638325
638634
 
638326
638635
  // packages/cli/src/insights/engine.ts
638327
- import { readdirSync as readdirSync44, readFileSync as readFileSync107, existsSync as existsSync130 } from "node:fs";
638636
+ import { readdirSync as readdirSync44, readFileSync as readFileSync108, existsSync as existsSync130 } from "node:fs";
638328
638637
  import { join as join143 } from "node:path";
638329
638638
  function formatDuration5(seconds) {
638330
638639
  if (seconds < 60) return `${Math.round(seconds)}s`;
@@ -638399,7 +638708,7 @@ var init_engine = __esm({
638399
638708
  return readdirSync44(this.historyDir).filter((f2) => f2.endsWith(".json") && f2 !== "pending-task.json").map((f2) => {
638400
638709
  try {
638401
638710
  const data = JSON.parse(
638402
- readFileSync107(join143(this.historyDir, f2), "utf-8")
638711
+ readFileSync108(join143(this.historyDir, f2), "utf-8")
638403
638712
  );
638404
638713
  return data;
638405
638714
  } catch {
@@ -638417,7 +638726,7 @@ var init_engine = __esm({
638417
638726
  loadUsageStore() {
638418
638727
  try {
638419
638728
  if (existsSync130(this.usageFile)) {
638420
- return JSON.parse(readFileSync107(this.usageFile, "utf-8"));
638729
+ return JSON.parse(readFileSync108(this.usageFile, "utf-8"));
638421
638730
  }
638422
638731
  } catch {
638423
638732
  }
@@ -641200,7 +641509,7 @@ var init_memory_menu = __esm({
641200
641509
  });
641201
641510
 
641202
641511
  // packages/cli/src/tui/audio-waveform.ts
641203
- import { readFileSync as readFileSync108 } from "node:fs";
641512
+ import { readFileSync as readFileSync109 } from "node:fs";
641204
641513
  import { createRequire as createRequire6 } from "node:module";
641205
641514
  function readAscii(buffer2, offset, length4) {
641206
641515
  return buffer2.subarray(offset, offset + length4).toString("ascii");
@@ -641274,7 +641583,7 @@ function renderAudioWaveform(file, options2 = {}) {
641274
641583
  } catch {
641275
641584
  return null;
641276
641585
  }
641277
- const buffer2 = readFileSync108(file);
641586
+ const buffer2 = readFileSync109(file);
641278
641587
  const info = parseWav(buffer2);
641279
641588
  if (!info) return null;
641280
641589
  const frameCount = Math.floor(info.dataSize / info.frameSize);
@@ -641830,7 +642139,7 @@ __export(daemon_exports, {
641830
642139
  stopDaemon: () => stopDaemon
641831
642140
  });
641832
642141
  import { spawn as spawn35 } from "node:child_process";
641833
- import { existsSync as existsSync134, readFileSync as readFileSync109, writeFileSync as writeFileSync67, mkdirSync as mkdirSync79, unlinkSync as unlinkSync26, openSync as openSync3, closeSync as closeSync3 } from "node:fs";
642142
+ import { existsSync as existsSync134, readFileSync as readFileSync110, writeFileSync as writeFileSync67, mkdirSync as mkdirSync79, unlinkSync as unlinkSync26, openSync as openSync3, closeSync as closeSync3 } from "node:fs";
641834
642143
  import { join as join146 } from "node:path";
641835
642144
  import { homedir as homedir48 } from "node:os";
641836
642145
  import { fileURLToPath as fileURLToPath20 } from "node:url";
@@ -641861,7 +642170,7 @@ function getLocalCliVersion() {
641861
642170
  for (const rel of ["../package.json", "../../package.json", "./package.json", "../../../package.json"]) {
641862
642171
  const p2 = join146(here, rel);
641863
642172
  if (existsSync134(p2)) {
641864
- const v = JSON.parse(readFileSync109(p2, "utf8"))?.version;
642173
+ const v = JSON.parse(readFileSync110(p2, "utf8"))?.version;
641865
642174
  if (v) return String(v);
641866
642175
  }
641867
642176
  }
@@ -641900,7 +642209,7 @@ async function restartDaemon(port) {
641900
642209
  function getDaemonPid() {
641901
642210
  if (!existsSync134(PID_FILE2)) return null;
641902
642211
  try {
641903
- const pid = parseInt(readFileSync109(PID_FILE2, "utf8").trim(), 10);
642212
+ const pid = parseInt(readFileSync110(PID_FILE2, "utf8").trim(), 10);
641904
642213
  if (!pid || pid <= 0) return null;
641905
642214
  process.kill(pid, 0);
641906
642215
  return pid;
@@ -641915,7 +642224,7 @@ function getDaemonPid() {
641915
642224
  function looksLikeNodeEntrypoint(path12) {
641916
642225
  if (/\.(?:mjs|cjs|js)$/i.test(path12)) return true;
641917
642226
  try {
641918
- const firstBytes = readFileSync109(path12, "utf8").slice(0, 200);
642227
+ const firstBytes = readFileSync110(path12, "utf8").slice(0, 200);
641919
642228
  return /^#!.*\bnode\b/.test(firstBytes);
641920
642229
  } catch {
641921
642230
  return false;
@@ -642589,7 +642898,7 @@ var init_types5 = __esm({
642589
642898
 
642590
642899
  // packages/cli/src/cron/store.ts
642591
642900
  import {
642592
- readFileSync as readFileSync110,
642901
+ readFileSync as readFileSync111,
642593
642902
  writeFileSync as writeFileSync68,
642594
642903
  mkdirSync as mkdirSync80,
642595
642904
  chmodSync as chmodSync4,
@@ -642776,7 +643085,7 @@ function loadJobs() {
642776
643085
  const path12 = jobsFilePath();
642777
643086
  if (!existsSync137(path12)) return [];
642778
643087
  try {
642779
- const data = JSON.parse(readFileSync110(path12, "utf-8"));
643088
+ const data = JSON.parse(readFileSync111(path12, "utf-8"));
642780
643089
  return data.jobs || [];
642781
643090
  } catch {
642782
643091
  return [];
@@ -643144,7 +643453,7 @@ import {
643144
643453
  closeSync as closeSync5,
643145
643454
  writeFileSync as writeFileSync69,
643146
643455
  unlinkSync as unlinkSync28,
643147
- readFileSync as readFileSync111
643456
+ readFileSync as readFileSync112
643148
643457
  } from "node:fs";
643149
643458
  import { join as join150 } from "node:path";
643150
643459
  import { homedir as homedir50 } from "node:os";
@@ -643161,7 +643470,7 @@ function acquireTickLock() {
643161
643470
  mkdirSync81(cronDir2(), { recursive: true });
643162
643471
  try {
643163
643472
  if (existsSync138(lockPath)) {
643164
- const content = readFileSync111(lockPath, "utf-8").trim();
643473
+ const content = readFileSync112(lockPath, "utf-8").trim();
643165
643474
  if (content) {
643166
643475
  const lock = JSON.parse(content);
643167
643476
  const age = Date.now() - lock.acquiredAt;
@@ -643529,7 +643838,7 @@ __export(sponsor_wizard_exports, {
643529
643838
  selectedModelsForEndpoint: () => selectedModelsForEndpoint,
643530
643839
  showSponsorDashboard: () => showSponsorDashboard
643531
643840
  });
643532
- import { existsSync as existsSync139, readFileSync as readFileSync112, writeFileSync as writeFileSync70, mkdirSync as mkdirSync82 } from "node:fs";
643841
+ import { existsSync as existsSync139, readFileSync as readFileSync113, writeFileSync as writeFileSync70, mkdirSync as mkdirSync82 } from "node:fs";
643533
643842
  import { join as join151 } from "node:path";
643534
643843
  function fmtTokens2(n2) {
643535
643844
  if (n2 < 1e3) return String(Math.max(0, Math.floor(n2)));
@@ -643550,7 +643859,7 @@ function loadSponsorConfig(projectDir2) {
643550
643859
  const p2 = configPath(projectDir2);
643551
643860
  if (!existsSync139(p2)) return null;
643552
643861
  try {
643553
- return JSON.parse(readFileSync112(p2, "utf8"));
643862
+ return JSON.parse(readFileSync113(p2, "utf8"));
643554
643863
  } catch {
643555
643864
  return null;
643556
643865
  }
@@ -644897,7 +645206,7 @@ import {
644897
645206
  existsSync as existsSync140,
644898
645207
  mkdirSync as mkdirSync83,
644899
645208
  writeFileSync as writeFileSync71,
644900
- readFileSync as readFileSync113,
645209
+ readFileSync as readFileSync114,
644901
645210
  unlinkSync as unlinkSync29,
644902
645211
  readdirSync as readdirSync46,
644903
645212
  statSync as statSync52,
@@ -646398,7 +646707,7 @@ except Exception as exc:
646398
646707
  const destFilename = `clone-${srcName}-${ts}.${ext}`;
646399
646708
  const destPath = join152(refsDir, destFilename);
646400
646709
  try {
646401
- const data = readFileSync113(audioPath);
646710
+ const data = readFileSync114(audioPath);
646402
646711
  writeFileSync71(destPath, data);
646403
646712
  } catch (err) {
646404
646713
  return `Failed to copy audio file: ${err instanceof Error ? err.message : String(err)}`;
@@ -646473,7 +646782,7 @@ except Exception as exc:
646473
646782
  const p2 = _VoiceEngine.cloneMetaFile();
646474
646783
  if (!existsSync140(p2)) return {};
646475
646784
  try {
646476
- const raw = JSON.parse(readFileSync113(p2, "utf8"));
646785
+ const raw = JSON.parse(readFileSync114(p2, "utf8"));
646477
646786
  if (typeof Object.values(raw)[0] === "string") {
646478
646787
  const migrated = {};
646479
646788
  for (const [k, v] of Object.entries(raw)) {
@@ -647359,7 +647668,7 @@ except Exception as exc:
647359
647668
  }
647360
647669
  loadMisottsStore() {
647361
647670
  try {
647362
- const raw = JSON.parse(readFileSync113(misottsProfilesFile(), "utf-8"));
647671
+ const raw = JSON.parse(readFileSync114(misottsProfilesFile(), "utf-8"));
647363
647672
  const profiles = {};
647364
647673
  for (const [name10, settings] of Object.entries(raw.profiles ?? {})) {
647365
647674
  profiles[name10] = normalizeMisottsSettings(settings);
@@ -647383,7 +647692,7 @@ except Exception as exc:
647383
647692
  loadSupertonicStore() {
647384
647693
  try {
647385
647694
  const raw = JSON.parse(
647386
- readFileSync113(supertonicProfilesFile(), "utf-8")
647695
+ readFileSync114(supertonicProfilesFile(), "utf-8")
647387
647696
  );
647388
647697
  const profiles = {};
647389
647698
  for (const [name10, settings] of Object.entries(raw.profiles ?? {})) {
@@ -647550,7 +647859,7 @@ except Exception as exc:
647550
647859
  const wavPath = await this.synthesizeSupertonicWav(text2, 1);
647551
647860
  if (!wavPath) return null;
647552
647861
  try {
647553
- const data = readFileSync113(wavPath);
647862
+ const data = readFileSync114(wavPath);
647554
647863
  unlinkSync29(wavPath);
647555
647864
  return data;
647556
647865
  } catch {
@@ -647698,7 +648007,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
647698
648007
  if (!existsSync140(wavPath)) return;
647699
648008
  if (volume !== 1) {
647700
648009
  try {
647701
- const wavData = readFileSync113(wavPath);
648010
+ const wavData = readFileSync114(wavPath);
647702
648011
  if (wavData.length > 44) {
647703
648012
  const header = wavData.subarray(0, 44);
647704
648013
  const samples = new Int16Array(
@@ -647720,7 +648029,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
647720
648029
  }
647721
648030
  if (this.onPCMOutput) {
647722
648031
  try {
647723
- const wavData = readFileSync113(wavPath);
648032
+ const wavData = readFileSync114(wavPath);
647724
648033
  if (wavData.length > 44) {
647725
648034
  const pcm = Buffer.from(
647726
648035
  wavData.buffer,
@@ -647778,7 +648087,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
647778
648087
  }
647779
648088
  if (!existsSync140(wavPath)) return null;
647780
648089
  try {
647781
- const data = readFileSync113(wavPath);
648090
+ const data = readFileSync114(wavPath);
647782
648091
  unlinkSync29(wavPath);
647783
648092
  return data;
647784
648093
  } catch {
@@ -648032,7 +648341,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
648032
648341
  ...isJetson ? (() => {
648033
648342
  let jpVer = "v60";
648034
648343
  try {
648035
- const tegra = existsSync140("/etc/nv_tegra_release") ? readFileSync113("/etc/nv_tegra_release", "utf8").trim() : "";
648344
+ const tegra = existsSync140("/etc/nv_tegra_release") ? readFileSync114("/etc/nv_tegra_release", "utf8").trim() : "";
648036
648345
  const ver = process.env.JETSON_L4T_VERSION || "";
648037
648346
  if (ver.startsWith("5.") || tegra.includes("R35") || tegra.includes("R34"))
648038
648347
  jpVer = "v51";
@@ -648642,7 +648951,7 @@ if __name__ == '__main__':
648642
648951
  async postProcessAndPlayLuxtts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
648643
648952
  if (!existsSync140(wavPath)) return;
648644
648953
  try {
648645
- const wavData = readFileSync113(wavPath);
648954
+ const wavData = readFileSync114(wavPath);
648646
648955
  if (wavData.length > 44) {
648647
648956
  const sampleRate = wavData.readUInt32LE(24);
648648
648957
  const samples = new Int16Array(
@@ -648673,7 +648982,7 @@ if __name__ == '__main__':
648673
648982
  }
648674
648983
  if (pitchFactor !== 1) {
648675
648984
  try {
648676
- const wavData = readFileSync113(wavPath);
648985
+ const wavData = readFileSync114(wavPath);
648677
648986
  if (wavData.length > 44) {
648678
648987
  const int16 = new Int16Array(
648679
648988
  wavData.buffer,
@@ -648692,7 +649001,7 @@ if __name__ == '__main__':
648692
649001
  }
648693
649002
  if (this.onPCMOutput) {
648694
649003
  try {
648695
- const wavData = readFileSync113(wavPath);
649004
+ const wavData = readFileSync114(wavPath);
648696
649005
  if (wavData.length > 44) {
648697
649006
  const pcm = Buffer.from(
648698
649007
  wavData.buffer,
@@ -648707,7 +649016,7 @@ if __name__ == '__main__':
648707
649016
  }
648708
649017
  if (stereoDelayMs > 0) {
648709
649018
  try {
648710
- const wavData = readFileSync113(wavPath);
649019
+ const wavData = readFileSync114(wavPath);
648711
649020
  if (wavData.length > 44) {
648712
649021
  const sampleRate = wavData.readUInt32LE(24);
648713
649022
  const numChannels = wavData.readUInt16LE(22);
@@ -648774,7 +649083,7 @@ if __name__ == '__main__':
648774
649083
  }
648775
649084
  if (!existsSync140(wavPath)) return null;
648776
649085
  try {
648777
- const data = readFileSync113(wavPath);
649086
+ const data = readFileSync114(wavPath);
648778
649087
  unlinkSync29(wavPath);
648779
649088
  return data;
648780
649089
  } catch {
@@ -649009,7 +649318,7 @@ if __name__ == "__main__":
649009
649318
  async postProcessAndPlayMisotts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
649010
649319
  if (!existsSync140(wavPath)) return;
649011
649320
  try {
649012
- const wavData = readFileSync113(wavPath);
649321
+ const wavData = readFileSync114(wavPath);
649013
649322
  if (wavData.length > 44) {
649014
649323
  const sampleRate = wavData.readUInt32LE(24);
649015
649324
  const samples = new Int16Array(
@@ -649040,7 +649349,7 @@ if __name__ == "__main__":
649040
649349
  }
649041
649350
  if (pitchFactor !== 1) {
649042
649351
  try {
649043
- const wavData = readFileSync113(wavPath);
649352
+ const wavData = readFileSync114(wavPath);
649044
649353
  if (wavData.length > 44) {
649045
649354
  const int16 = new Int16Array(
649046
649355
  wavData.buffer,
@@ -649059,7 +649368,7 @@ if __name__ == "__main__":
649059
649368
  }
649060
649369
  if (this.onPCMOutput) {
649061
649370
  try {
649062
- const wavData = readFileSync113(wavPath);
649371
+ const wavData = readFileSync114(wavPath);
649063
649372
  if (wavData.length > 44) {
649064
649373
  const pcm = Buffer.from(
649065
649374
  wavData.buffer,
@@ -649074,7 +649383,7 @@ if __name__ == "__main__":
649074
649383
  }
649075
649384
  if (stereoDelayMs > 0) {
649076
649385
  try {
649077
- const wavData = readFileSync113(wavPath);
649386
+ const wavData = readFileSync114(wavPath);
649078
649387
  if (wavData.length > 44) {
649079
649388
  const sampleRate = wavData.readUInt32LE(24);
649080
649389
  const numChannels = wavData.readUInt16LE(22);
@@ -649150,7 +649459,7 @@ if __name__ == "__main__":
649150
649459
  }
649151
649460
  if (!existsSync140(wavPath)) return null;
649152
649461
  try {
649153
- const data = readFileSync113(wavPath);
649462
+ const data = readFileSync114(wavPath);
649154
649463
  unlinkSync29(wavPath);
649155
649464
  return data;
649156
649465
  } catch {
@@ -649171,7 +649480,7 @@ if __name__ == "__main__":
649171
649480
  };
649172
649481
  if (existsSync140(pkgPath)) {
649173
649482
  try {
649174
- const existing = JSON.parse(readFileSync113(pkgPath, "utf8"));
649483
+ const existing = JSON.parse(readFileSync114(pkgPath, "utf8"));
649175
649484
  if (!existing.dependencies?.["phonemizer"]) {
649176
649485
  existing.dependencies = { ...existing.dependencies, ...expectedDeps };
649177
649486
  writeFileSync71(pkgPath, JSON.stringify(existing, null, 2));
@@ -649331,7 +649640,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
649331
649640
  if (!existsSync140(onnxPath) || !existsSync140(configPath2)) {
649332
649641
  throw new Error(`Model files not found for ${this.modelId}`);
649333
649642
  }
649334
- this.config = JSON.parse(readFileSync113(configPath2, "utf8"));
649643
+ this.config = JSON.parse(readFileSync114(configPath2, "utf8"));
649335
649644
  this.session = await this.ort.InferenceSession.create(onnxPath, {
649336
649645
  executionProviders: ["cpu"],
649337
649646
  graphOptimizationLevel: "all"
@@ -649491,7 +649800,7 @@ import { spawn as nodeSpawn2 } from "node:child_process";
649491
649800
  import { createHash as createHash38 } from "node:crypto";
649492
649801
  import {
649493
649802
  existsSync as existsSync141,
649494
- readFileSync as readFileSync114,
649803
+ readFileSync as readFileSync115,
649495
649804
  writeFileSync as writeFileSync72,
649496
649805
  mkdirSync as mkdirSync84,
649497
649806
  readdirSync as readdirSync47,
@@ -649928,6 +650237,9 @@ async function ensureVoiceDeps(ctx3) {
649928
650237
  const res = mod3.ensureEmbedDeps();
649929
650238
  if (res?.log)
649930
650239
  renderInfo(res.log.split("\n").slice(-3).join(" ").slice(0, 200));
650240
+ if (res && res.ok === false) {
650241
+ throw new Error(`ASR Python dependency setup failed: ${String(res.log ?? "").slice(-1200)}`);
650242
+ }
649931
650243
  }
649932
650244
  if (typeof mod3.getVenvPython === "function") {
649933
650245
  const { dirname: dirname56 } = await import("node:path");
@@ -650812,10 +651124,10 @@ async function handleSlashCommand(input, ctx3) {
650812
651124
  if (!key) {
650813
651125
  try {
650814
651126
  const { homedir: homedir66 } = await import("node:os");
650815
- const { readFileSync: readFileSync141, existsSync: existsSync173 } = await import("node:fs");
651127
+ const { readFileSync: readFileSync142, existsSync: existsSync173 } = await import("node:fs");
650816
651128
  const { join: join188 } = await import("node:path");
650817
651129
  const p2 = join188(homedir66(), ".omnius", "api.key");
650818
- if (existsSync173(p2)) key = readFileSync141(p2, "utf8").trim();
651130
+ if (existsSync173(p2)) key = readFileSync142(p2, "utf8").trim();
650819
651131
  } catch {
650820
651132
  }
650821
651133
  }
@@ -651719,7 +652031,7 @@ async function handleSlashCommand(input, ctx3) {
651719
652031
  try {
651720
652032
  const pidFile = join153(nexus.getNexusDir(), "daemon.pid");
651721
652033
  if (existsSync141(pidFile)) {
651722
- const pid = parseInt(readFileSync114(pidFile, "utf8").trim(), 10);
652034
+ const pid = parseInt(readFileSync115(pidFile, "utf8").trim(), 10);
651723
652035
  if (pid > 0 && !registry2.daemons.has("Nexus")) {
651724
652036
  registry2.register({
651725
652037
  name: "Nexus",
@@ -652142,7 +652454,7 @@ async function handleSlashCommand(input, ctx3) {
652142
652454
  renderWarning(`Tool not found: ${toolFile}`);
652143
652455
  return "handled";
652144
652456
  }
652145
- content = readFileSync114(toolFile, "utf8");
652457
+ content = readFileSync115(toolFile, "utf8");
652146
652458
  metadata = { type: "tool", name: shareName };
652147
652459
  } else if (shareType === "skill") {
652148
652460
  const skillDir = join153(ctx3.repoRoot, ".omnius", "skills", shareName);
@@ -652151,7 +652463,7 @@ async function handleSlashCommand(input, ctx3) {
652151
652463
  renderWarning(`Skill not found: ${skillFile}`);
652152
652464
  return "handled";
652153
652465
  }
652154
- content = readFileSync114(skillFile, "utf8");
652466
+ content = readFileSync115(skillFile, "utf8");
652155
652467
  metadata = { type: "skill", name: shareName };
652156
652468
  } else {
652157
652469
  renderWarning(
@@ -652224,7 +652536,7 @@ async function handleSlashCommand(input, ctx3) {
652224
652536
  "learning-cids.json"
652225
652537
  );
652226
652538
  if (existsSync141(regFile)) {
652227
- const reg2 = JSON.parse(readFileSync114(regFile, "utf8"));
652539
+ const reg2 = JSON.parse(readFileSync115(regFile, "utf8"));
652228
652540
  const pinned = Object.values(reg2).some(
652229
652541
  (e2) => e2.cid === importCid && e2.pinned
652230
652542
  );
@@ -652342,7 +652654,7 @@ async function handleSlashCommand(input, ctx3) {
652342
652654
  ).getNexusDir();
652343
652655
  const statusFile = join153(nexusDir, "status.json");
652344
652656
  if (existsSync141(statusFile)) {
652345
- const status = JSON.parse(readFileSync114(statusFile, "utf8"));
652657
+ const status = JSON.parse(readFileSync115(statusFile, "utf8"));
652346
652658
  if (status.peerId) {
652347
652659
  lines.push(`
652348
652660
  ${c3.bold("Peer Info")}`);
@@ -652367,7 +652679,7 @@ async function handleSlashCommand(input, ctx3) {
652367
652679
  try {
652368
652680
  const stateFile = join153(idDir, "self-state.json");
652369
652681
  if (existsSync141(stateFile)) {
652370
- const state = JSON.parse(readFileSync114(stateFile, "utf8"));
652682
+ const state = JSON.parse(readFileSync115(stateFile, "utf8"));
652371
652683
  lines.push(
652372
652684
  ` Version: ${c3.bold("v" + (state.version ?? "?"))} Sessions: ${c3.bold(String(state.session_count ?? 0))}`
652373
652685
  );
@@ -652382,7 +652694,7 @@ async function handleSlashCommand(input, ctx3) {
652382
652694
  }
652383
652695
  const cidFile = join153(idDir, "cids.json");
652384
652696
  if (existsSync141(cidFile)) {
652385
- const cids = JSON.parse(readFileSync114(cidFile, "utf8"));
652697
+ const cids = JSON.parse(readFileSync115(cidFile, "utf8"));
652386
652698
  const lastCid = Array.isArray(cids) ? cids[cids.length - 1] : cids.latest;
652387
652699
  if (lastCid)
652388
652700
  lines.push(
@@ -652407,7 +652719,7 @@ async function handleSlashCommand(input, ctx3) {
652407
652719
  "store.json"
652408
652720
  );
652409
652721
  if (existsSync141(metaFile2)) {
652410
- const store2 = JSON.parse(readFileSync114(metaFile2, "utf8"));
652722
+ const store2 = JSON.parse(readFileSync115(metaFile2, "utf8"));
652411
652723
  const active = store2.filter((m2) => m2.type !== "quarantine");
652412
652724
  const recoveries = active.filter(
652413
652725
  (m2) => m2.content?.startsWith("[recovery]")
@@ -652645,7 +652957,7 @@ async function handleSlashCommand(input, ctx3) {
652645
652957
  return "handled";
652646
652958
  }
652647
652959
  } else {
652648
- content = readFileSync114(resolvedPath, "utf8");
652960
+ content = readFileSync115(resolvedPath, "utf8");
652649
652961
  }
652650
652962
  if (!content.trim()) {
652651
652963
  renderWarning("No content extracted.");
@@ -652753,7 +653065,7 @@ async function handleSlashCommand(input, ctx3) {
652753
653065
  renderInfo("Fortemi bridge: not connected. Run /fortemi start");
652754
653066
  return "handled";
652755
653067
  }
652756
- const bridge = JSON.parse(readFileSync114(bridgeFile, "utf8"));
653068
+ const bridge = JSON.parse(readFileSync115(bridgeFile, "utf8"));
652757
653069
  let alive = false;
652758
653070
  try {
652759
653071
  process.kill(bridge.pid, 0);
@@ -652789,7 +653101,7 @@ async function handleSlashCommand(input, ctx3) {
652789
653101
  if (fortemiSubCmd === "stop") {
652790
653102
  const bridgeFile = join153(ctx3.repoRoot, ".omnius", "fortemi-bridge.json");
652791
653103
  if (existsSync141(bridgeFile)) {
652792
- const bridge = JSON.parse(readFileSync114(bridgeFile, "utf8"));
653104
+ const bridge = JSON.parse(readFileSync115(bridgeFile, "utf8"));
652793
653105
  try {
652794
653106
  process.kill(bridge.pid, "SIGTERM");
652795
653107
  } catch {
@@ -654825,7 +655137,7 @@ sleep 1
654825
655137
  `daemon.pid exists: ${existsSync141(join153(checkedNexusDir, "daemon.pid"))}`
654826
655138
  );
654827
655139
  try {
654828
- const _statusRaw = readFileSync114(
655140
+ const _statusRaw = readFileSync115(
654829
655141
  join153(checkedNexusDir, "status.json"),
654830
655142
  "utf8"
654831
655143
  );
@@ -654834,7 +655146,7 @@ sleep 1
654834
655146
  _spLog(`status.json read error: ${e2}`);
654835
655147
  }
654836
655148
  try {
654837
- const _errRaw = readFileSync114(
655149
+ const _errRaw = readFileSync115(
654838
655150
  join153(checkedNexusDir, "daemon.err"),
654839
655151
  "utf8"
654840
655152
  );
@@ -654869,7 +655181,7 @@ sleep 1
654869
655181
  "agent-name"
654870
655182
  );
654871
655183
  if (existsSync141(namePath))
654872
- sponsorName = readFileSync114(namePath, "utf8").trim();
655184
+ sponsorName = readFileSync115(namePath, "utf8").trim();
654873
655185
  } catch {
654874
655186
  }
654875
655187
  if (!sponsorName) sponsorName = "Omnius Sponsor";
@@ -654973,7 +655285,7 @@ sleep 1
654973
655285
  );
654974
655286
  if (existsSync141(nexusPidFile)) {
654975
655287
  const nPid = parseInt(
654976
- readFileSync114(nexusPidFile, "utf8").trim(),
655288
+ readFileSync115(nexusPidFile, "utf8").trim(),
654977
655289
  10
654978
655290
  );
654979
655291
  if (nPid > 0) {
@@ -656272,7 +656584,7 @@ sleep 1
656272
656584
  if (existsSync141(projectSettingsPath)) {
656273
656585
  try {
656274
656586
  const projectJson = JSON.parse(
656275
- readFileSync114(projectSettingsPath, "utf8")
656587
+ readFileSync115(projectSettingsPath, "utf8")
656276
656588
  );
656277
656589
  projectHasKey = typeof projectJson?.telegramKey === "string" && projectJson.telegramKey.length > 0;
656278
656590
  } catch {
@@ -659952,8 +660264,8 @@ function attachLiveSinks(ctx3, manager, agentEnabled = false, speechEnabledOverr
659952
660264
  manager.setAgentActionSink(void 0);
659953
660265
  }
659954
660266
  }
659955
- async function ensureLiveStreamingAsr(ctx3, manager) {
659956
- if (!manager.getConfig().asrEnabled) return;
660267
+ async function ensureLiveStreamingAsr(ctx3, manager, force = false) {
660268
+ if (!force && !manager.getConfig().asrEnabled) return;
659957
660269
  if (!ctx3.listenStart) return;
659958
660270
  ctx3.listenSetMode?.("auto");
659959
660271
  const msg = await ctx3.listenStart("live");
@@ -660214,8 +660526,8 @@ async function handleLiveCommand(ctx3, arg) {
660214
660526
  renderWarning("Live PFC agent review is unavailable in this context; starting visual/audio feedback only.");
660215
660527
  }
660216
660528
  await ensureLiveInventory(manager);
660529
+ await ensureLiveStreamingAsr(ctx3, manager, true);
660217
660530
  renderInfo(manager.startRunMode({ agent: effectiveAgent, lowLatency: true, speech: effectiveAgent && Boolean(ctx3.voiceSpeak) }));
660218
- await ensureLiveStreamingAsr(ctx3, manager);
660219
660531
  return;
660220
660532
  }
660221
660533
  if (sub2 === "chat" || sub2 === "voicechat" || sub2 === "voice") {
@@ -660766,16 +661078,16 @@ async function showLiveMenu(ctx3, manager) {
660766
661078
  continue;
660767
661079
  case "run-live":
660768
661080
  attachLiveSinks(ctx3, manager, false);
661081
+ await ensureLiveStreamingAsr(ctx3, manager, true);
660769
661082
  renderInfo(manager.startRunMode({ agent: false, lowLatency: true, speech: false }));
660770
- await ensureLiveStreamingAsr(ctx3, manager);
660771
661083
  continue;
660772
661084
  case "run-agent":
660773
661085
  attachLiveSinks(ctx3, manager, true);
660774
661086
  if (!ctx3.startBackgroundPrompt) {
660775
661087
  renderWarning("Live PFC agent review is unavailable in this context; starting visual/audio feedback only.");
660776
661088
  }
661089
+ await ensureLiveStreamingAsr(ctx3, manager, true);
660777
661090
  renderInfo(manager.startRunMode({ agent: Boolean(ctx3.startBackgroundPrompt), lowLatency: true, speech: Boolean(ctx3.startBackgroundPrompt && ctx3.voiceSpeak) }));
660778
- await ensureLiveStreamingAsr(ctx3, manager);
660779
661091
  continue;
660780
661092
  case "run-chat":
660781
661093
  await startLiveVoicechat(ctx3, manager);
@@ -662505,7 +662817,7 @@ async function discoverSponsorMediaCandidates(ctx3, modality) {
662505
662817
  "known-sponsors.json"
662506
662818
  );
662507
662819
  if (existsSync141(knownFile)) {
662508
- const saved = JSON.parse(readFileSync114(knownFile, "utf8"));
662820
+ const saved = JSON.parse(readFileSync115(knownFile, "utf8"));
662509
662821
  if (Array.isArray(saved)) rawSponsors.push(...saved);
662510
662822
  }
662511
662823
  } catch {
@@ -662655,7 +662967,7 @@ async function collectSponsorMediaStream(args) {
662655
662967
  while (!done && Date.now() < deadline) {
662656
662968
  await new Promise((resolve76) => setTimeout(resolve76, 250));
662657
662969
  if (!existsSync141(args.streamFile)) continue;
662658
- const raw = readFileSync114(args.streamFile, "utf8");
662970
+ const raw = readFileSync115(args.streamFile, "utf8");
662659
662971
  if (raw.length <= offset) continue;
662660
662972
  pending2 += raw.slice(offset);
662661
662973
  offset = raw.length;
@@ -662979,7 +663291,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
662979
663291
  try {
662980
663292
  if (existsSync141(knownFile)) {
662981
663293
  const saved = JSON.parse(
662982
- readFileSync114(knownFile, "utf8")
663294
+ readFileSync115(knownFile, "utf8")
662983
663295
  );
662984
663296
  for (const s2 of saved) {
662985
663297
  if (!sponsors.some((sp) => sp.url === s2.url)) {
@@ -663155,7 +663467,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
663155
663467
  const saveKey = selected.url || selected.peerId || selected.name;
663156
663468
  try {
663157
663469
  mkdirSync84(sponsorDir2, { recursive: true });
663158
- const existing = existsSync141(knownFile) ? JSON.parse(readFileSync114(knownFile, "utf8")) : [];
663470
+ const existing = existsSync141(knownFile) ? JSON.parse(readFileSync115(knownFile, "utf8")) : [];
663159
663471
  const updated = existing.filter(
663160
663472
  (s2) => (s2.url || s2.peerId || s2.name) !== saveKey
663161
663473
  );
@@ -666262,7 +666574,7 @@ var init_commands = __esm({
666262
666574
  });
666263
666575
 
666264
666576
  // packages/cli/src/tui/project-context.ts
666265
- import { existsSync as existsSync142, readFileSync as readFileSync115, readdirSync as readdirSync48, mkdirSync as mkdirSync85, statSync as statSync54, writeFileSync as writeFileSync73 } from "node:fs";
666577
+ import { existsSync as existsSync142, readFileSync as readFileSync116, readdirSync as readdirSync48, mkdirSync as mkdirSync85, statSync as statSync54, writeFileSync as writeFileSync73 } from "node:fs";
666266
666578
  import { dirname as dirname47, join as join154, basename as basename29, resolve as resolve62 } from "node:path";
666267
666579
  import { homedir as homedir53 } from "node:os";
666268
666580
  function projectContextUrlSpanAt(text2, index) {
@@ -666313,7 +666625,7 @@ function loadProjectMap(repoRoot) {
666313
666625
  const mapPath2 = join154(repoRoot, OMNIUS_DIR, "context", "project-map.md");
666314
666626
  if (existsSync142(mapPath2)) {
666315
666627
  try {
666316
- const content = readFileSync115(mapPath2, "utf-8");
666628
+ const content = readFileSync116(mapPath2, "utf-8");
666317
666629
  return content;
666318
666630
  } catch {
666319
666631
  }
@@ -666326,7 +666638,7 @@ function findGitDir(repoRoot) {
666326
666638
  const gitPath = join154(dir, ".git");
666327
666639
  if (existsSync142(gitPath)) {
666328
666640
  try {
666329
- const raw = readFileSync115(gitPath, "utf8").trim();
666641
+ const raw = readFileSync116(gitPath, "utf8").trim();
666330
666642
  const match = raw.match(/^gitdir:\s*(.+)$/i);
666331
666643
  if (match?.[1]) {
666332
666644
  return resolve62(dir, match[1]);
@@ -666346,12 +666658,12 @@ function getGitInfo(repoRoot) {
666346
666658
  if (!gitDir) return "";
666347
666659
  const lines = [];
666348
666660
  try {
666349
- const head = readFileSync115(join154(gitDir, "HEAD"), "utf-8").trim();
666661
+ const head = readFileSync116(join154(gitDir, "HEAD"), "utf-8").trim();
666350
666662
  const refMatch = head.match(/^ref:\s+refs\/heads\/(.+)$/);
666351
666663
  if (refMatch?.[1]) {
666352
666664
  lines.push(`Branch: ${refMatch[1]}`);
666353
666665
  try {
666354
- const refHash = readFileSync115(join154(gitDir, "refs", "heads", refMatch[1]), "utf-8").trim();
666666
+ const refHash = readFileSync116(join154(gitDir, "refs", "heads", refMatch[1]), "utf-8").trim();
666355
666667
  if (refHash) lines.push(`HEAD: ${refHash.slice(0, 12)}`);
666356
666668
  } catch {
666357
666669
  }
@@ -666379,7 +666691,7 @@ function countJsonMemoryEntries(dir) {
666379
666691
  if (!file.endsWith(".json")) continue;
666380
666692
  topics++;
666381
666693
  try {
666382
- const parsed = JSON.parse(readFileSync115(join154(dir, file), "utf8"));
666694
+ const parsed = JSON.parse(readFileSync116(join154(dir, file), "utf8"));
666383
666695
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
666384
666696
  entries += Object.keys(parsed).length;
666385
666697
  }
@@ -666395,7 +666707,7 @@ function countReflectionBuffer(repoRoot) {
666395
666707
  const path12 = join154(repoRoot, OMNIUS_DIR, "memory", "reflections.json");
666396
666708
  if (!existsSync142(path12)) return 0;
666397
666709
  try {
666398
- const parsed = JSON.parse(readFileSync115(path12, "utf8"));
666710
+ const parsed = JSON.parse(readFileSync116(path12, "utf8"));
666399
666711
  return Array.isArray(parsed.reflections) ? parsed.reflections.length : 0;
666400
666712
  } catch {
666401
666713
  return 0;
@@ -666404,7 +666716,7 @@ function countReflectionBuffer(repoRoot) {
666404
666716
  function countJsonlLines(path12, maxBytes = 1e6) {
666405
666717
  if (!existsSync142(path12)) return 0;
666406
666718
  try {
666407
- const text2 = readFileSync115(path12, "utf8").slice(-maxBytes);
666719
+ const text2 = readFileSync116(path12, "utf8").slice(-maxBytes);
666408
666720
  return text2.split(/\r?\n/).filter((line) => line.trim()).length;
666409
666721
  } catch {
666410
666722
  return 0;
@@ -666448,7 +666760,7 @@ function loadMemoryContextBundle(repoRoot, task = "", taskEmbedding) {
666448
666760
  const files = readdirSync48(dir).filter((f2) => f2.endsWith(".json"));
666449
666761
  for (const file of files.slice(0, 10)) {
666450
666762
  try {
666451
- const raw = readFileSync115(join154(dir, file), "utf-8");
666763
+ const raw = readFileSync116(join154(dir, file), "utf-8");
666452
666764
  const entries = JSON.parse(raw);
666453
666765
  const topic = basename29(file, ".json");
666454
666766
  for (const [k, v] of Object.entries(entries)) {
@@ -666938,7 +667250,7 @@ function extractMakeBootstrapTargets(repoRoot) {
666938
667250
  const makefile = ["Makefile", "makefile"].find((name10) => existsSync142(join154(repoRoot, name10)));
666939
667251
  if (!makefile) return [];
666940
667252
  try {
666941
- const text2 = readFileSync115(join154(repoRoot, makefile), "utf8");
667253
+ const text2 = readFileSync116(join154(repoRoot, makefile), "utf8");
666942
667254
  const targets = [];
666943
667255
  for (const line of text2.split(/\r?\n/)) {
666944
667256
  const match = line.match(/^([A-Za-z0-9_.-]+)\s*:(?![=])/);
@@ -667151,7 +667463,7 @@ function loadCustomToolsContext(repoRoot) {
667151
667463
  const registryPath = join154(repoRoot, ".omnius", "tools", "registry.json");
667152
667464
  const indexPath = join154(repoRoot, ".omnius", "tools", "README.md");
667153
667465
  if (!existsSync142(registryPath)) return "";
667154
- const registry4 = JSON.parse(readFileSync115(registryPath, "utf-8"));
667466
+ const registry4 = JSON.parse(readFileSync116(registryPath, "utf-8"));
667155
667467
  const tools = (registry4.tools ?? []).filter((tool) => tool.qualityGate?.lastTest?.status === "passed").sort((a2, b) => {
667156
667468
  const byRate = (b.analytics?.successRate ?? 0) - (a2.analytics?.successRate ?? 0);
667157
667469
  if (byRate !== 0) return byRate;
@@ -667361,7 +667673,7 @@ var init_project_context = __esm({
667361
667673
  });
667362
667674
 
667363
667675
  // packages/cli/src/realtime.ts
667364
- import { existsSync as existsSync143, readFileSync as readFileSync116, readdirSync as readdirSync49 } from "node:fs";
667676
+ import { existsSync as existsSync143, readFileSync as readFileSync117, readdirSync as readdirSync49 } from "node:fs";
667365
667677
  import { basename as basename30, join as join155, resolve as resolve63 } from "node:path";
667366
667678
  function clampInt2(value2, fallback, min, max) {
667367
667679
  const n2 = typeof value2 === "number" ? value2 : Number.parseInt(String(value2 ?? ""), 10);
@@ -667383,7 +667695,7 @@ function firstReadable(candidates) {
667383
667695
  for (const path12 of candidates) {
667384
667696
  if (!existsSync143(path12)) continue;
667385
667697
  try {
667386
- return { path: path12, content: readFileSync116(path12, "utf8") };
667698
+ return { path: path12, content: readFileSync117(path12, "utf8") };
667387
667699
  } catch {
667388
667700
  return null;
667389
667701
  }
@@ -667406,7 +667718,7 @@ function projectVoice(repoRoot) {
667406
667718
  return ap - bp || a2.localeCompare(b);
667407
667719
  });
667408
667720
  const first2 = files[0];
667409
- return first2 ? { path: join155(voiceDir3, first2), content: readFileSync116(join155(voiceDir3, first2), "utf8") } : null;
667721
+ return first2 ? { path: join155(voiceDir3, first2), content: readFileSync117(join155(voiceDir3, first2), "utf8") } : null;
667410
667722
  } catch {
667411
667723
  return null;
667412
667724
  }
@@ -667594,7 +667906,7 @@ __export(chat_session_exports, {
667594
667906
  import { randomUUID as randomUUID18 } from "node:crypto";
667595
667907
  import {
667596
667908
  existsSync as existsSync144,
667597
- readFileSync as readFileSync117,
667909
+ readFileSync as readFileSync118,
667598
667910
  readdirSync as readdirSync50,
667599
667911
  writeFileSync as writeFileSync74,
667600
667912
  renameSync as renameSync13,
@@ -667703,7 +668015,7 @@ function normalizeLoadedSession(parsed) {
667703
668015
  }
667704
668016
  function readSessionFile(fp) {
667705
668017
  try {
667706
- const parsed = JSON.parse(readFileSync117(fp, "utf-8"));
668018
+ const parsed = JSON.parse(readFileSync118(fp, "utf-8"));
667707
668019
  if (!parsed || typeof parsed !== "object" || !parsed.id) return null;
667708
668020
  return normalizeLoadedSession(parsed);
667709
668021
  } catch {
@@ -667736,7 +668048,7 @@ function loadPersistedSessions() {
667736
668048
  if (!f2.endsWith(".json") || f2.includes(".tmp.")) continue;
667737
668049
  const fp = join156(dir, f2);
667738
668050
  try {
667739
- const parsed = JSON.parse(readFileSync117(fp, "utf-8"));
668051
+ const parsed = JSON.parse(readFileSync118(fp, "utf-8"));
667740
668052
  if (f2.endsWith(".inflight.json")) {
667741
668053
  if (parsed && parsed.pid && parsed.status === "running") {
667742
668054
  try {
@@ -667778,7 +668090,7 @@ function buildSystemPrompt(cwd4) {
667778
668090
  const diaryPath = join156(cwd4, ".omnius", "context", "session-diary.md");
667779
668091
  if (existsSync144(diaryPath)) {
667780
668092
  try {
667781
- const diary = readFileSync117(diaryPath, "utf-8").slice(0, 1e3);
668093
+ const diary = readFileSync118(diaryPath, "utf-8").slice(0, 1e3);
667782
668094
  parts.push(`\\nPrevious session history:\\n${diary}`);
667783
668095
  } catch {
667784
668096
  }
@@ -667793,7 +668105,7 @@ function buildSystemPrompt(cwd4) {
667793
668105
  );
667794
668106
  for (const f2 of files.slice(0, 3)) {
667795
668107
  try {
667796
- const data = JSON.parse(readFileSync117(join156(memDir, f2), "utf-8"));
668108
+ const data = JSON.parse(readFileSync118(join156(memDir, f2), "utf-8"));
667797
668109
  const entries = Object.entries(data).slice(0, 3);
667798
668110
  if (entries.length > 0) {
667799
668111
  parts.push(
@@ -667813,7 +668125,7 @@ function buildSystemPrompt(cwd4) {
667813
668125
  const p2 = join156(cwd4, name10);
667814
668126
  if (existsSync144(p2)) {
667815
668127
  try {
667816
- const content = readFileSync117(p2, "utf-8").slice(0, 500);
668128
+ const content = readFileSync118(p2, "utf-8").slice(0, 500);
667817
668129
  parts.push(`\\nProject instructions (${name10}):\\n${content}`);
667818
668130
  } catch {
667819
668131
  }
@@ -667835,7 +668147,7 @@ function getSession2(sessionId, model, cwd4) {
667835
668147
  try {
667836
668148
  const fp = sessionPath(sessionId);
667837
668149
  if (existsSync144(fp)) {
667838
- const parsed = normalizeLoadedSession(JSON.parse(readFileSync117(fp, "utf-8")));
668150
+ const parsed = normalizeLoadedSession(JSON.parse(readFileSync118(fp, "utf-8")));
667839
668151
  if (parsed && parsed.id === sessionId) {
667840
668152
  parsed.lastActivity = Date.now();
667841
668153
  if (canonicalRoot && !parsed.projectRoot) parsed.projectRoot = canonicalRoot;
@@ -668022,7 +668334,7 @@ function drainCheckins(sessionId) {
668022
668334
  const fp = checkinPath(sessionId);
668023
668335
  if (!existsSync144(fp)) return [];
668024
668336
  try {
668025
- const raw = readFileSync117(fp, "utf-8");
668337
+ const raw = readFileSync118(fp, "utf-8");
668026
668338
  try {
668027
668339
  unlinkSync30(fp);
668028
668340
  } catch {
@@ -668088,7 +668400,7 @@ function lookupSession(id2) {
668088
668400
  try {
668089
668401
  const fp = sessionPath(id2);
668090
668402
  if (existsSync144(fp)) {
668091
- const parsed = normalizeLoadedSession(JSON.parse(readFileSync117(fp, "utf-8")));
668403
+ const parsed = normalizeLoadedSession(JSON.parse(readFileSync118(fp, "utf-8")));
668092
668404
  if (parsed && parsed.id === id2) {
668093
668405
  sessions2.set(id2, parsed);
668094
668406
  return parsed;
@@ -668141,7 +668453,7 @@ function getInFlightChat(sessionId) {
668141
668453
  try {
668142
668454
  const p2 = inFlightPath(sessionId);
668143
668455
  if (existsSync144(p2)) {
668144
- const parsed = JSON.parse(readFileSync117(p2, "utf-8"));
668456
+ const parsed = JSON.parse(readFileSync118(p2, "utf-8"));
668145
668457
  if (parsed && parsed.sessionId === sessionId) {
668146
668458
  return parsed;
668147
668459
  }
@@ -669546,7 +669858,7 @@ __export(banner_exports, {
669546
669858
  setBannerWriter: () => setBannerWriter,
669547
669859
  setGridText: () => setGridText
669548
669860
  });
669549
- import { existsSync as existsSync146, readFileSync as readFileSync118, writeFileSync as writeFileSync75, mkdirSync as mkdirSync87 } from "node:fs";
669861
+ import { existsSync as existsSync146, readFileSync as readFileSync119, writeFileSync as writeFileSync75, mkdirSync as mkdirSync87 } from "node:fs";
669550
669862
  import { join as join157 } from "node:path";
669551
669863
  function setBannerWriter(writer) {
669552
669864
  chromeWrite3 = writer;
@@ -669688,7 +670000,7 @@ function loadBannerDesign(workDir, id2) {
669688
670000
  const file = join157(workDir, ".omnius", "banners", `${id2}.json`);
669689
670001
  if (!existsSync146(file)) return null;
669690
670002
  try {
669691
- return JSON.parse(readFileSync118(file, "utf8"));
670003
+ return JSON.parse(readFileSync119(file, "utf8"));
669692
670004
  } catch {
669693
670005
  return null;
669694
670006
  }
@@ -670018,13 +670330,13 @@ var init_banner = __esm({
670018
670330
  });
670019
670331
 
670020
670332
  // packages/cli/src/tui/carousel-descriptors.ts
670021
- import { existsSync as existsSync147, readFileSync as readFileSync119, writeFileSync as writeFileSync76, mkdirSync as mkdirSync88, readdirSync as readdirSync51 } from "node:fs";
670333
+ import { existsSync as existsSync147, readFileSync as readFileSync120, writeFileSync as writeFileSync76, mkdirSync as mkdirSync88, readdirSync as readdirSync51 } from "node:fs";
670022
670334
  import { join as join158, basename as basename33 } from "node:path";
670023
670335
  function loadToolProfile(repoRoot) {
670024
670336
  const filePath = join158(repoRoot, OMNIUS_DIR, "context", TOOL_PROFILE_FILE);
670025
670337
  try {
670026
670338
  if (!existsSync147(filePath)) return null;
670027
- return JSON.parse(readFileSync119(filePath, "utf-8"));
670339
+ return JSON.parse(readFileSync120(filePath, "utf-8"));
670028
670340
  } catch {
670029
670341
  return null;
670030
670342
  }
@@ -670090,7 +670402,7 @@ function loadCachedDescriptors(repoRoot) {
670090
670402
  const filePath = join158(repoRoot, OMNIUS_DIR, "context", DESCRIPTOR_FILE);
670091
670403
  try {
670092
670404
  if (!existsSync147(filePath)) return null;
670093
- const cached = JSON.parse(readFileSync119(filePath, "utf-8"));
670405
+ const cached = JSON.parse(readFileSync120(filePath, "utf-8"));
670094
670406
  return cached.phrases.length > 0 ? cached.phrases : null;
670095
670407
  } catch {
670096
670408
  return null;
@@ -670154,7 +670466,7 @@ function extractFromPackageJson(repoRoot, tags) {
670154
670466
  const pkgPath = join158(repoRoot, "package.json");
670155
670467
  try {
670156
670468
  if (!existsSync147(pkgPath)) return;
670157
- const pkg = JSON.parse(readFileSync119(pkgPath, "utf-8"));
670469
+ const pkg = JSON.parse(readFileSync120(pkgPath, "utf-8"));
670158
670470
  if (pkg.name && typeof pkg.name === "string") {
670159
670471
  const parts = pkg.name.replace(/^@/, "").split("/");
670160
670472
  for (const p2 of parts) tags.push(p2);
@@ -670225,7 +670537,7 @@ function extractFromMemory(repoRoot, tags) {
670225
670537
  const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
670226
670538
  tags.push(topic);
670227
670539
  try {
670228
- const data = JSON.parse(readFileSync119(join158(memoryDir, file), "utf-8"));
670540
+ const data = JSON.parse(readFileSync120(join158(memoryDir, file), "utf-8"));
670229
670541
  if (data && typeof data === "object") {
670230
670542
  const keys = Object.keys(data).slice(0, 3);
670231
670543
  for (const key of keys) {
@@ -671268,7 +671580,7 @@ var init_edit_history = __esm({
671268
671580
  });
671269
671581
 
671270
671582
  // packages/cli/src/tui/snr-engine.ts
671271
- import { existsSync as existsSync148, readdirSync as readdirSync52, readFileSync as readFileSync120, writeFileSync as writeFileSync77, mkdirSync as mkdirSync90, rmSync as rmSync13 } from "node:fs";
671583
+ import { existsSync as existsSync148, readdirSync as readdirSync52, readFileSync as readFileSync121, writeFileSync as writeFileSync77, mkdirSync as mkdirSync90, rmSync as rmSync13 } from "node:fs";
671272
671584
  import { join as join160, basename as basename34 } from "node:path";
671273
671585
  function computeDPrime(signalScores, noiseScores) {
671274
671586
  if (signalScores.length === 0 || noiseScores.length === 0) return 0;
@@ -671575,7 +671887,7 @@ Call task_complete with the JSON array when done.`,
671575
671887
  const topic = basename34(f2, ".json");
671576
671888
  if (topics.length > 0 && !topics.includes(topic)) continue;
671577
671889
  try {
671578
- const data = JSON.parse(readFileSync120(join160(dir, f2), "utf-8"));
671890
+ const data = JSON.parse(readFileSync121(join160(dir, f2), "utf-8"));
671579
671891
  for (const [key, val] of Object.entries(data)) {
671580
671892
  const value2 = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
671581
671893
  entries.push({ topic, key, value: value2 });
@@ -671677,7 +671989,7 @@ Call task_complete with the JSON array when done.`,
671677
671989
  const file = join160(memDir, `${topic}.json`);
671678
671990
  if (!existsSync148(file)) continue;
671679
671991
  try {
671680
- const data = JSON.parse(readFileSync120(file, "utf-8"));
671992
+ const data = JSON.parse(readFileSync121(file, "utf-8"));
671681
671993
  const moved = {};
671682
671994
  for (const key of keys) {
671683
671995
  if (key in data) {
@@ -671692,7 +672004,7 @@ Call task_complete with the JSON array when done.`,
671692
672004
  let archiveData = {};
671693
672005
  if (existsSync148(archiveFile)) {
671694
672006
  try {
671695
- archiveData = JSON.parse(readFileSync120(archiveFile, "utf-8"));
672007
+ archiveData = JSON.parse(readFileSync121(archiveFile, "utf-8"));
671696
672008
  } catch {
671697
672009
  }
671698
672010
  }
@@ -671731,7 +672043,7 @@ Call task_complete with the JSON array when done.`,
671731
672043
  });
671732
672044
 
671733
672045
  // packages/cli/src/tui/promptLoader.ts
671734
- import { readFileSync as readFileSync121, existsSync as existsSync149 } from "node:fs";
672046
+ import { readFileSync as readFileSync122, existsSync as existsSync149 } from "node:fs";
671735
672047
  import { join as join161, dirname as dirname49 } from "node:path";
671736
672048
  import { fileURLToPath as fileURLToPath21 } from "node:url";
671737
672049
  function loadPrompt3(promptPath, vars) {
@@ -671741,7 +672053,7 @@ function loadPrompt3(promptPath, vars) {
671741
672053
  if (!existsSync149(fullPath)) {
671742
672054
  throw new Error(`Prompt file not found: ${fullPath}`);
671743
672055
  }
671744
- content = readFileSync121(fullPath, "utf-8");
672056
+ content = readFileSync122(fullPath, "utf-8");
671745
672057
  cache7.set(promptPath, content);
671746
672058
  }
671747
672059
  if (!vars) return content;
@@ -671761,7 +672073,7 @@ var init_promptLoader3 = __esm({
671761
672073
  });
671762
672074
 
671763
672075
  // packages/cli/src/tui/dream-engine.ts
671764
- import { mkdirSync as mkdirSync91, writeFileSync as writeFileSync78, readFileSync as readFileSync122, existsSync as existsSync150, readdirSync as readdirSync53 } from "node:fs";
672076
+ import { mkdirSync as mkdirSync91, writeFileSync as writeFileSync78, readFileSync as readFileSync123, existsSync as existsSync150, readdirSync as readdirSync53 } from "node:fs";
671765
672077
  import { join as join162, basename as basename35 } from "node:path";
671766
672078
  function setDreamWriteContent(fn) {
671767
672079
  _dreamWriteContent = fn;
@@ -671777,7 +672089,7 @@ function loadAutoresearchMemory(repoRoot) {
671777
672089
  const memoryPath = join162(repoRoot, ".omnius", "memory", "autoresearch.json");
671778
672090
  if (!existsSync150(memoryPath)) return "";
671779
672091
  try {
671780
- const raw = readFileSync122(memoryPath, "utf-8");
672092
+ const raw = readFileSync123(memoryPath, "utf-8");
671781
672093
  const data = JSON.parse(raw);
671782
672094
  const sections = [];
671783
672095
  for (const key of AUTORESEARCH_MEMORY_KEYS) {
@@ -672012,7 +672324,7 @@ var init_dream_engine = __esm({
672012
672324
  if (!existsSync150(targetPath)) {
672013
672325
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
672014
672326
  }
672015
- let content = readFileSync122(targetPath, "utf-8");
672327
+ let content = readFileSync123(targetPath, "utf-8");
672016
672328
  if (!content.includes(oldStr)) {
672017
672329
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
672018
672330
  }
@@ -672100,7 +672412,7 @@ var init_dream_engine = __esm({
672100
672412
  if (!existsSync150(targetPath)) {
672101
672413
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
672102
672414
  }
672103
- let content = readFileSync122(targetPath, "utf-8");
672415
+ let content = readFileSync123(targetPath, "utf-8");
672104
672416
  if (!content.includes(oldStr)) {
672105
672417
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start2 };
672106
672418
  }
@@ -673064,7 +673376,7 @@ ${summary}` };
673064
673376
  try {
673065
673377
  let notes = [];
673066
673378
  if (existsSync150(notesPath)) {
673067
- notes = JSON.parse(readFileSync122(notesPath, "utf-8"));
673379
+ notes = JSON.parse(readFileSync123(notesPath, "utf-8"));
673068
673380
  }
673069
673381
  if (action === "add") {
673070
673382
  const note = {
@@ -673704,7 +674016,7 @@ var init_bless_engine = __esm({
673704
674016
  });
673705
674017
 
673706
674018
  // packages/cli/src/tui/dmn-engine.ts
673707
- import { existsSync as existsSync151, readFileSync as readFileSync123, writeFileSync as writeFileSync79, mkdirSync as mkdirSync92, readdirSync as readdirSync54, unlinkSync as unlinkSync31 } from "node:fs";
674019
+ import { existsSync as existsSync151, readFileSync as readFileSync124, writeFileSync as writeFileSync79, mkdirSync as mkdirSync92, readdirSync as readdirSync54, unlinkSync as unlinkSync31 } from "node:fs";
673708
674020
  import { join as join163, basename as basename36 } from "node:path";
673709
674021
  import { exec as exec6 } from "node:child_process";
673710
674022
  import { promisify as promisify8 } from "node:util";
@@ -674589,7 +674901,7 @@ If decision is GO, selectedTask MUST be a fully-populated object (NEVER null)
674589
674901
  const path12 = join163(this.stateDir, "state.json");
674590
674902
  if (existsSync151(path12)) {
674591
674903
  try {
674592
- this.state = JSON.parse(readFileSync123(path12, "utf-8"));
674904
+ this.state = JSON.parse(readFileSync124(path12, "utf-8"));
674593
674905
  } catch {
674594
674906
  }
674595
674907
  }
@@ -674623,7 +674935,7 @@ If decision is GO, selectedTask MUST be a fully-populated object (NEVER null)
674623
674935
  const latestByFingerprint = /* @__PURE__ */ new Map();
674624
674936
  for (const file of files) {
674625
674937
  try {
674626
- const parsed = JSON.parse(readFileSync123(join163(this.historyDir, file), "utf-8"));
674938
+ const parsed = JSON.parse(readFileSync124(join163(this.historyDir, file), "utf-8"));
674627
674939
  latestByFingerprint.set(this.fingerprintCycle(parsed), file);
674628
674940
  } catch {
674629
674941
  keep.add(file);
@@ -676442,7 +676754,7 @@ import { createCipheriv as createCipheriv5, createDecipheriv as createDecipheriv
676442
676754
  import {
676443
676755
  existsSync as existsSync152,
676444
676756
  mkdirSync as mkdirSync93,
676445
- readFileSync as readFileSync124,
676757
+ readFileSync as readFileSync125,
676446
676758
  statSync as statSync55,
676447
676759
  unlinkSync as unlinkSync32,
676448
676760
  writeFileSync as writeFileSync80
@@ -676672,7 +676984,7 @@ function scopedTool(base3, root, mode) {
676672
676984
  );
676673
676985
  if (!materialized.ok) return denied(materialized.error);
676674
676986
  mkdirSync93(dirname50(guarded.path.abs), { recursive: true });
676675
- writeFileSync80(guarded.path.abs, readFileSync124(materialized.path));
676987
+ writeFileSync80(guarded.path.abs, readFileSync125(materialized.path));
676676
676988
  materialized.cleanup?.();
676677
676989
  restoredEditPath = guarded.path.abs;
676678
676990
  }
@@ -676796,7 +677108,7 @@ function readManifest(root) {
676796
677108
  ensureManifest(root);
676797
677109
  try {
676798
677110
  const parsed = JSON.parse(
676799
- readFileSync124(manifestPath(root), "utf8")
677111
+ readFileSync125(manifestPath(root), "utf8")
676800
677112
  );
676801
677113
  const objects = parsed.objects && typeof parsed.objects === "object" ? Object.fromEntries(
676802
677114
  Object.entries(parsed.objects).filter(
@@ -676848,7 +677160,7 @@ function rememberCreated(root, absPath) {
676848
677160
  }
676849
677161
  }
676850
677162
  mkdirSync93(join164(root, OBJECTS_DIR), { recursive: true });
676851
- const data = readFileSync124(guarded.path.abs);
677163
+ const data = readFileSync125(guarded.path.abs);
676852
677164
  const prefix = randomBytes26(48);
676853
677165
  const key = randomBytes26(32);
676854
677166
  const iv = randomBytes26(12);
@@ -676904,7 +677216,7 @@ function materializeTelegramCreativeArtifactForSend(root, rawPath) {
676904
677216
  error: `Scoped artifact storage is missing for ${rel}.`
676905
677217
  };
676906
677218
  }
676907
- const blob = readFileSync124(storedAbs);
677219
+ const blob = readFileSync125(storedAbs);
676908
677220
  if (blob.length < object.prefixBytes) {
676909
677221
  return {
676910
677222
  ok: false,
@@ -677875,7 +678187,7 @@ import {
677875
678187
  existsSync as existsSync153,
677876
678188
  mkdirSync as mkdirSync94,
677877
678189
  readdirSync as readdirSync55,
677878
- readFileSync as readFileSync125,
678190
+ readFileSync as readFileSync126,
677879
678191
  writeFileSync as writeFileSync81,
677880
678192
  unlinkSync as unlinkSync33
677881
678193
  } from "node:fs";
@@ -678644,7 +678956,7 @@ function latestTelegramChannelDaydream(repoRoot, sessionKey) {
678644
678956
  for (const file of files.reverse()) {
678645
678957
  try {
678646
678958
  return JSON.parse(
678647
- readFileSync125(join165(dir, file), "utf8")
678959
+ readFileSync126(join165(dir, file), "utf8")
678648
678960
  );
678649
678961
  } catch {
678650
678962
  }
@@ -680382,7 +680694,7 @@ __export(vision_ingress_exports, {
680382
680694
  resolveVisionModel: () => resolveVisionModel,
680383
680695
  runVisionIngress: () => runVisionIngress
680384
680696
  });
680385
- import { existsSync as existsSync154, readFileSync as readFileSync126, unlinkSync as unlinkSync34 } from "node:fs";
680697
+ import { existsSync as existsSync154, readFileSync as readFileSync127, unlinkSync as unlinkSync34 } from "node:fs";
680386
680698
  import { join as join166 } from "node:path";
680387
680699
  async function isTesseractAvailable() {
680388
680700
  try {
@@ -680437,7 +680749,7 @@ async function advancedOcr(imagePath) {
680437
680749
  ], { timeout: 15e3 });
680438
680750
  const txtFile = `${outFile}.txt`;
680439
680751
  if (existsSync154(txtFile)) {
680440
- const text2 = readFileSync126(txtFile, "utf-8").trim();
680752
+ const text2 = readFileSync127(txtFile, "utf-8").trim();
680441
680753
  if (text2.length > 0) results.push(text2);
680442
680754
  try {
680443
680755
  unlinkSync34(txtFile);
@@ -680622,7 +680934,7 @@ import {
680622
680934
  unlinkSync as unlinkSync35,
680623
680935
  readdirSync as readdirSync56,
680624
680936
  statSync as statSync56,
680625
- readFileSync as readFileSync127,
680937
+ readFileSync as readFileSync128,
680626
680938
  writeFileSync as writeFileSync82,
680627
680939
  appendFileSync as appendFileSync18
680628
680940
  } from "node:fs";
@@ -686734,7 +687046,7 @@ ${mediaContext}` : ""
686734
687046
  const path12 = this.telegramConversationPath(sessionKey);
686735
687047
  if (!existsSync155(path12)) return;
686736
687048
  try {
686737
- const parsed = JSON.parse(readFileSync127(path12, "utf8"));
687049
+ const parsed = JSON.parse(readFileSync128(path12, "utf8"));
686738
687050
  const loadedHistory = Array.isArray(parsed.history) ? parsed.history : [];
686739
687051
  if (Array.isArray(parsed.history)) {
686740
687052
  this.chatHistory.set(
@@ -686948,7 +687260,7 @@ ${mediaContext}` : ""
686948
687260
  for (const file of readdirSync56(this.telegramConversationDir)) {
686949
687261
  if (!file.endsWith(".json")) continue;
686950
687262
  try {
686951
- const raw = readFileSync127(
687263
+ const raw = readFileSync128(
686952
687264
  join167(this.telegramConversationDir, file),
686953
687265
  "utf8"
686954
687266
  );
@@ -691635,7 +691947,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
691635
691947
  const lockFile = join167(lockDir, `bot-${botUserId}.owner.lock`);
691636
691948
  if (existsSync155(lockFile)) {
691637
691949
  try {
691638
- const prior = JSON.parse(readFileSync127(lockFile, "utf8"));
691950
+ const prior = JSON.parse(readFileSync128(lockFile, "utf8"));
691639
691951
  const priorAlive = typeof prior.pid === "number" && prior.pid !== process.pid ? this.processIsAlive(prior.pid) : false;
691640
691952
  if (priorAlive) {
691641
691953
  throw new Error(
@@ -691668,7 +691980,7 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
691668
691980
  try {
691669
691981
  if (!existsSync155(lockFile)) return;
691670
691982
  try {
691671
- const prior = JSON.parse(readFileSync127(lockFile, "utf8"));
691983
+ const prior = JSON.parse(readFileSync128(lockFile, "utf8"));
691672
691984
  if (prior.pid !== process.pid) return;
691673
691985
  } catch {
691674
691986
  }
@@ -696611,7 +696923,7 @@ Scoped workspace: ${scopedRoot}`,
696611
696923
  readTelegramToolButtonState(nonce) {
696612
696924
  try {
696613
696925
  const parsed = JSON.parse(
696614
- readFileSync127(this.telegramToolButtonPath(nonce), "utf-8")
696926
+ readFileSync128(this.telegramToolButtonPath(nonce), "utf-8")
696615
696927
  );
696616
696928
  if (!parsed || parsed.expiresAt < Date.now()) return null;
696617
696929
  return parsed;
@@ -698065,7 +698377,7 @@ ${knownList}` : "Private-user telegram_send_file target must be this DM or a kno
698065
698377
  const ingressResult = await runVisionIngress2(
698066
698378
  {
698067
698379
  path: localPath,
698068
- buffer: readFileSync127(localPath),
698380
+ buffer: readFileSync128(localPath),
698069
698381
  mime: telegramImageMime(media)
698070
698382
  },
698071
698383
  this.agentConfig?.model ?? ""
@@ -698460,7 +698772,7 @@ ${text2}`.trim()
698460
698772
  }
698461
698773
  if (!existsSync155(media.value))
698462
698774
  throw new Error(`File does not exist: ${media.value}`);
698463
- const buffer2 = readFileSync127(media.value);
698775
+ const buffer2 = readFileSync128(media.value);
698464
698776
  const boundary = `----omnius-media-${Date.now()}-${Math.random().toString(36).slice(2)}`;
698465
698777
  const filename = basename39(media.value);
698466
698778
  const contentType = mimeForPath(media.value, media.kind);
@@ -698574,7 +698886,7 @@ Content-Type: ${contentType}\r
698574
698886
  const sidecarPath2 = `${imagePath}.json`;
698575
698887
  if (!existsSync155(sidecarPath2)) return null;
698576
698888
  try {
698577
- const raw = readFileSync127(sidecarPath2, "utf8");
698889
+ const raw = readFileSync128(sidecarPath2, "utf8");
698578
698890
  const parsed = JSON.parse(raw);
698579
698891
  if (!parsed || typeof parsed !== "object" || typeof parsed["original_prompt"] !== "string") {
698580
698892
  return null;
@@ -698634,7 +698946,7 @@ Content-Type: ${contentType}\r
698634
698946
  const sidecarPath2 = `${videoPath}.json`;
698635
698947
  if (!existsSync155(sidecarPath2)) return null;
698636
698948
  try {
698637
- const raw = readFileSync127(sidecarPath2, "utf8");
698949
+ const raw = readFileSync128(sidecarPath2, "utf8");
698638
698950
  const parsed = JSON.parse(raw);
698639
698951
  if (!parsed || typeof parsed !== "object" || typeof parsed["original_prompt"] !== "string") {
698640
698952
  return null;
@@ -698779,7 +699091,7 @@ Content-Type: ${contentType}\r
698779
699091
  addField(field, pathOrFileId);
698780
699092
  continue;
698781
699093
  }
698782
- const buffer2 = readFileSync127(pathOrFileId);
699094
+ const buffer2 = readFileSync128(pathOrFileId);
698783
699095
  const filename = basename39(pathOrFileId);
698784
699096
  parts.push(Buffer.from(`--${boundary}\r
698785
699097
  `));
@@ -700897,14 +701209,14 @@ __export(projects_exports, {
700897
701209
  setCurrentProject: () => setCurrentProject,
700898
701210
  unregisterProject: () => unregisterProject
700899
701211
  });
700900
- import { readFileSync as readFileSync128, writeFileSync as writeFileSync83, mkdirSync as mkdirSync96, existsSync as existsSync156, statSync as statSync57, renameSync as renameSync14 } from "node:fs";
701212
+ import { readFileSync as readFileSync129, writeFileSync as writeFileSync83, mkdirSync as mkdirSync96, existsSync as existsSync156, statSync as statSync57, renameSync as renameSync14 } from "node:fs";
700901
701213
  import { homedir as homedir56 } from "node:os";
700902
701214
  import { basename as basename40, join as join168, resolve as resolve68 } from "node:path";
700903
701215
  import { randomUUID as randomUUID19 } from "node:crypto";
700904
701216
  function readAll2() {
700905
701217
  try {
700906
701218
  if (!existsSync156(PROJECTS_FILE)) return { projects: [], schemaVersion: 1 };
700907
- const raw = readFileSync128(PROJECTS_FILE, "utf8");
701219
+ const raw = readFileSync129(PROJECTS_FILE, "utf8");
700908
701220
  const parsed = JSON.parse(raw);
700909
701221
  if (!parsed || !Array.isArray(parsed.projects)) return { projects: [], schemaVersion: 1 };
700910
701222
  return { projects: parsed.projects, schemaVersion: 1 };
@@ -700981,7 +701293,7 @@ function getCurrentProject() {
700981
701293
  if (!currentRoot) {
700982
701294
  try {
700983
701295
  if (existsSync156(CURRENT_FILE)) {
700984
- const persisted = readFileSync128(CURRENT_FILE, "utf8").trim();
701296
+ const persisted = readFileSync129(CURRENT_FILE, "utf8").trim();
700985
701297
  if (persisted) currentRoot = persisted;
700986
701298
  }
700987
701299
  } catch {
@@ -701895,7 +702207,7 @@ var init_access_policy = __esm({
701895
702207
 
701896
702208
  // packages/cli/src/api/project-preferences.ts
701897
702209
  import { createHash as createHash43 } from "node:crypto";
701898
- import { existsSync as existsSync157, mkdirSync as mkdirSync97, readFileSync as readFileSync129, renameSync as renameSync15, writeFileSync as writeFileSync84, unlinkSync as unlinkSync36 } from "node:fs";
702210
+ import { existsSync as existsSync157, mkdirSync as mkdirSync97, readFileSync as readFileSync130, renameSync as renameSync15, writeFileSync as writeFileSync84, unlinkSync as unlinkSync36 } from "node:fs";
701899
702211
  import { homedir as homedir57 } from "node:os";
701900
702212
  import { join as join169, resolve as resolve69 } from "node:path";
701901
702213
  import { randomUUID as randomUUID20 } from "node:crypto";
@@ -701928,7 +702240,7 @@ function readProjectPreferences(root) {
701928
702240
  try {
701929
702241
  const file = prefsPath(root);
701930
702242
  if (!existsSync157(file)) return { ...DEFAULT_PREFS };
701931
- const raw = readFileSync129(file, "utf8");
702243
+ const raw = readFileSync130(file, "utf8");
701932
702244
  const parsed = JSON.parse(raw);
701933
702245
  if (!parsed || parsed.v !== SCHEMA_VERSION) return { ...DEFAULT_PREFS };
701934
702246
  return { ...DEFAULT_PREFS, ...parsed, v: SCHEMA_VERSION };
@@ -701995,7 +702307,7 @@ __export(audit_log_exports, {
701995
702307
  recordAudit: () => recordAudit,
701996
702308
  sanitizeBody: () => sanitizeBody
701997
702309
  });
701998
- import { mkdirSync as mkdirSync98, appendFileSync as appendFileSync19, readFileSync as readFileSync130, existsSync as existsSync158 } from "node:fs";
702310
+ import { mkdirSync as mkdirSync98, appendFileSync as appendFileSync19, readFileSync as readFileSync131, existsSync as existsSync158 } from "node:fs";
701999
702311
  import { join as join170 } from "node:path";
702000
702312
  function initAuditLog(omniusDir) {
702001
702313
  auditDir = join170(omniusDir, "audit");
@@ -702032,7 +702344,7 @@ function sanitizeBody(body, maxLen = 200) {
702032
702344
  function queryAudit(opts) {
702033
702345
  if (!initialized || !existsSync158(auditFile)) return [];
702034
702346
  try {
702035
- const raw = readFileSync130(auditFile, "utf-8");
702347
+ const raw = readFileSync131(auditFile, "utf-8");
702036
702348
  const lines = raw.split("\n").filter(Boolean);
702037
702349
  let records = lines.map((l2) => {
702038
702350
  try {
@@ -703005,7 +703317,7 @@ var init_direct_tool_registry = __esm({
703005
703317
  });
703006
703318
 
703007
703319
  // packages/cli/src/api/external-tool-registry.ts
703008
- import { existsSync as existsSync161, mkdirSync as mkdirSync101, readFileSync as readFileSync131, writeFileSync as writeFileSync85, renameSync as renameSync16 } from "node:fs";
703320
+ import { existsSync as existsSync161, mkdirSync as mkdirSync101, readFileSync as readFileSync132, writeFileSync as writeFileSync85, renameSync as renameSync16 } from "node:fs";
703009
703321
  import { join as join172 } from "node:path";
703010
703322
  function externalToolStorePath(workingDir) {
703011
703323
  return join172(workingDir, ".omnius", "external-tools.json");
@@ -703014,7 +703326,7 @@ function loadExternalTools(workingDir) {
703014
703326
  const path12 = externalToolStorePath(workingDir);
703015
703327
  if (!existsSync161(path12)) return [];
703016
703328
  try {
703017
- const parsed = JSON.parse(readFileSync131(path12, "utf-8"));
703329
+ const parsed = JSON.parse(readFileSync132(path12, "utf-8"));
703018
703330
  if (!parsed || !Array.isArray(parsed.tools)) return [];
703019
703331
  return parsed.tools.filter(
703020
703332
  (t2) => t2 && typeof t2.name === "string" && t2.transport != null
@@ -703353,7 +703665,7 @@ __export(aiwg_exports, {
703353
703665
  resolveAiwgRoot: () => resolveAiwgRoot,
703354
703666
  tryRouteAiwg: () => tryRouteAiwg
703355
703667
  });
703356
- import { existsSync as existsSync162, readFileSync as readFileSync132, readdirSync as readdirSync57, statSync as statSync60 } from "node:fs";
703668
+ import { existsSync as existsSync162, readFileSync as readFileSync133, readdirSync as readdirSync57, statSync as statSync60 } from "node:fs";
703357
703669
  import { join as join173 } from "node:path";
703358
703670
  import { homedir as homedir58 } from "node:os";
703359
703671
  import { execSync as execSync38 } from "node:child_process";
@@ -703424,7 +703736,7 @@ function resolveAiwgRoot() {
703424
703736
  const pj = join173(cur, "package.json");
703425
703737
  if (existsSync162(pj)) {
703426
703738
  try {
703427
- const pkg = JSON.parse(readFileSync132(pj, "utf-8"));
703739
+ const pkg = JSON.parse(readFileSync133(pj, "utf-8"));
703428
703740
  if (pkg.name === "aiwg") {
703429
703741
  _cachedAiwgRoot = cur;
703430
703742
  return cur;
@@ -703514,7 +703826,7 @@ function readFirstLineDescription(dir) {
703514
703826
  const p2 = join173(dir, candidate);
703515
703827
  if (!existsSync162(p2)) continue;
703516
703828
  try {
703517
- const txt = readFileSync132(p2, "utf-8");
703829
+ const txt = readFileSync133(p2, "utf-8");
703518
703830
  const descMatch = txt.match(/^description:\s*(.+)$/m);
703519
703831
  if (descMatch) return descMatch[1].trim().slice(0, 200);
703520
703832
  for (const line of txt.split("\n")) {
@@ -703565,7 +703877,7 @@ function walkForItems(dir, out, depth) {
703565
703877
  }
703566
703878
  function parseItem(p2) {
703567
703879
  try {
703568
- const raw = readFileSync132(p2, "utf-8");
703880
+ const raw = readFileSync133(p2, "utf-8");
703569
703881
  const header = raw.slice(0, 3e3);
703570
703882
  const nameMatch = header.match(/^name:\s*(.+)$/m);
703571
703883
  const descMatch = header.match(/^description:\s*(.+)$/m);
@@ -703604,7 +703916,7 @@ function deriveSource(p2) {
703604
703916
  function loadAiwgItemContent(path12, maxBytes = 2e4) {
703605
703917
  try {
703606
703918
  if (!existsSync162(path12)) return null;
703607
- const raw = readFileSync132(path12, "utf-8");
703919
+ const raw = readFileSync133(path12, "utf-8");
703608
703920
  return raw.length > maxBytes ? raw.slice(0, maxBytes) + "\n\n...(truncated for context budget)" : raw;
703609
703921
  } catch {
703610
703922
  return null;
@@ -704140,7 +704452,7 @@ __export(runtime_keys_exports, {
704140
704452
  mintKey: () => mintKey,
704141
704453
  revokeByPrefix: () => revokeByPrefix
704142
704454
  });
704143
- import { existsSync as existsSync163, readFileSync as readFileSync133, writeFileSync as writeFileSync86, mkdirSync as mkdirSync102, chmodSync as chmodSync5 } from "node:fs";
704455
+ import { existsSync as existsSync163, readFileSync as readFileSync134, writeFileSync as writeFileSync86, mkdirSync as mkdirSync102, chmodSync as chmodSync5 } from "node:fs";
704144
704456
  import { join as join174 } from "node:path";
704145
704457
  import { homedir as homedir59 } from "node:os";
704146
704458
  import { randomBytes as randomBytes28 } from "node:crypto";
@@ -704151,7 +704463,7 @@ function ensureDir2() {
704151
704463
  function loadAll() {
704152
704464
  if (!existsSync163(KEYS_FILE)) return [];
704153
704465
  try {
704154
- const raw = readFileSync133(KEYS_FILE, "utf-8");
704466
+ const raw = readFileSync134(KEYS_FILE, "utf-8");
704155
704467
  const parsed = JSON.parse(raw);
704156
704468
  if (!Array.isArray(parsed)) return [];
704157
704469
  return parsed;
@@ -704237,7 +704549,7 @@ __export(tor_fallback_exports, {
704237
704549
  torIsReachable: () => torIsReachable,
704238
704550
  tunnelViaTor: () => tunnelViaTor
704239
704551
  });
704240
- import { existsSync as existsSync164, readFileSync as readFileSync134 } from "node:fs";
704552
+ import { existsSync as existsSync164, readFileSync as readFileSync135 } from "node:fs";
704241
704553
  import { homedir as homedir60 } from "node:os";
704242
704554
  import { join as join175 } from "node:path";
704243
704555
  import { createConnection as createConnection3 } from "node:net";
@@ -704250,7 +704562,7 @@ function getLocalOnion() {
704250
704562
  for (const p2 of candidates) {
704251
704563
  try {
704252
704564
  if (existsSync164(p2)) {
704253
- const v = readFileSync134(p2, "utf-8").trim();
704565
+ const v = readFileSync135(p2, "utf-8").trim();
704254
704566
  if (v && v.endsWith(".onion")) return v;
704255
704567
  }
704256
704568
  } catch {
@@ -704511,7 +704823,7 @@ var init_graphical_sudo = __esm({
704511
704823
  });
704512
704824
 
704513
704825
  // packages/cli/src/api/routes-v1.ts
704514
- import { existsSync as existsSync166, mkdirSync as mkdirSync104, readFileSync as readFileSync135, readdirSync as readdirSync58, statSync as statSync61 } from "node:fs";
704826
+ import { existsSync as existsSync166, mkdirSync as mkdirSync104, readFileSync as readFileSync136, readdirSync as readdirSync58, statSync as statSync61 } from "node:fs";
704515
704827
  import { join as join177, resolve as pathResolve3 } from "node:path";
704516
704828
  import { homedir as homedir61 } from "node:os";
704517
704829
  async function tryRouteV1(ctx3) {
@@ -704795,7 +705107,7 @@ function walkForSkills(dir, out, depth) {
704795
705107
  walkForSkills(p2, out, depth + 1);
704796
705108
  } else if (e2.isFile() && e2.name === "SKILL.md") {
704797
705109
  try {
704798
- const content = readFileSync135(p2, "utf-8").slice(0, 2e3);
705110
+ const content = readFileSync136(p2, "utf-8").slice(0, 2e3);
704799
705111
  const nameMatch = content.match(/^name:\s*(.+)$/m);
704800
705112
  const descMatch = content.match(/^description:\s*(.+)$/m);
704801
705113
  out.push({
@@ -705751,7 +706063,7 @@ async function handleFilesRead(ctx3) {
705751
706063
  }));
705752
706064
  return true;
705753
706065
  }
705754
- const content = readFileSync135(resolved, "utf-8");
706066
+ const content = readFileSync136(resolved, "utf-8");
705755
706067
  const offset = typeof body.offset === "number" && body.offset >= 0 ? body.offset : 0;
705756
706068
  const limit = typeof body.limit === "number" && body.limit > 0 ? body.limit : content.length;
705757
706069
  const slice2 = content.slice(offset, offset + limit);
@@ -706053,7 +706365,7 @@ async function handleNexusStatus(ctx3) {
706053
706365
  for (const p2 of statePaths) {
706054
706366
  if (!existsSync166(p2)) continue;
706055
706367
  try {
706056
- const raw = readFileSync135(p2, "utf-8");
706368
+ const raw = readFileSync136(p2, "utf-8");
706057
706369
  states2.push({ source: p2, data: JSON.parse(raw) });
706058
706370
  } catch (e2) {
706059
706371
  states2.push({ source: p2, error: String(e2) });
@@ -706081,7 +706393,7 @@ async function handleNexusStatus(ctx3) {
706081
706393
  function loadAgentName() {
706082
706394
  try {
706083
706395
  const p2 = join177(homedir61(), ".omnius", "agent-name");
706084
- if (existsSync166(p2)) return readFileSync135(p2, "utf-8").trim();
706396
+ if (existsSync166(p2)) return readFileSync136(p2, "utf-8").trim();
706085
706397
  } catch {
706086
706398
  }
706087
706399
  return null;
@@ -706097,7 +706409,7 @@ async function handleSponsors(ctx3) {
706097
706409
  for (const p2 of candidates) {
706098
706410
  if (!existsSync166(p2)) continue;
706099
706411
  try {
706100
- const raw = JSON.parse(readFileSync135(p2, "utf-8"));
706412
+ const raw = JSON.parse(readFileSync136(p2, "utf-8"));
706101
706413
  if (Array.isArray(raw)) {
706102
706414
  sponsors = raw;
706103
706415
  break;
@@ -706177,7 +706489,7 @@ async function handleEvaluate(ctx3) {
706177
706489
  }));
706178
706490
  return true;
706179
706491
  }
706180
- const job = JSON.parse(readFileSync135(jobPath, "utf-8"));
706492
+ const job = JSON.parse(readFileSync136(jobPath, "utf-8"));
706181
706493
  sendJson2(res, 200, {
706182
706494
  run_id: runId,
706183
706495
  task: job.task,
@@ -706317,7 +706629,7 @@ async function handleMintKey(ctx3) {
706317
706629
  function _readStatusFile(p2) {
706318
706630
  if (!existsSync166(p2)) return null;
706319
706631
  try {
706320
- const data = JSON.parse(readFileSync135(p2, "utf-8"));
706632
+ const data = JSON.parse(readFileSync136(p2, "utf-8"));
706321
706633
  if (data?.connected && typeof data.peerId === "string" && data.peerId.length > 10) {
706322
706634
  const pid = Number(data.pid);
706323
706635
  if (pid > 0) {
@@ -706360,7 +706672,7 @@ function resolveLocalPeerId() {
706360
706672
  try {
706361
706673
  const regPath = join177(homedir61(), ".omnius", "nexus-registry.json");
706362
706674
  if (existsSync166(regPath)) {
706363
- const reg = JSON.parse(readFileSync135(regPath, "utf-8"));
706675
+ const reg = JSON.parse(readFileSync136(regPath, "utf-8"));
706364
706676
  const entries = Array.isArray(reg?.dirs) ? reg.dirs : [];
706365
706677
  for (const entry of entries) {
706366
706678
  const dir = typeof entry === "string" ? entry : entry?.dir;
@@ -707873,7 +708185,7 @@ function aimsDir() {
707873
708185
  function readAimsFile(name10, fallback) {
707874
708186
  try {
707875
708187
  const p2 = join177(aimsDir(), name10);
707876
- if (existsSync166(p2)) return JSON.parse(readFileSync135(p2, "utf-8"));
708188
+ if (existsSync166(p2)) return JSON.parse(readFileSync136(p2, "utf-8"));
707877
708189
  } catch {
707878
708190
  }
707879
708191
  return fallback;
@@ -708250,7 +708562,7 @@ async function handleAimsSuppliers(ctx3) {
708250
708562
  for (const p2 of sponsorPaths) {
708251
708563
  if (!existsSync166(p2)) continue;
708252
708564
  try {
708253
- const raw = JSON.parse(readFileSync135(p2, "utf-8"));
708565
+ const raw = JSON.parse(readFileSync136(p2, "utf-8"));
708254
708566
  const list = Array.isArray(raw) ? raw : raw?.sponsors ?? [];
708255
708567
  for (const s2 of list) {
708256
708568
  suppliers.push({
@@ -720206,7 +720518,7 @@ var init_auth_oidc = __esm({
720206
720518
  });
720207
720519
 
720208
720520
  // packages/cli/src/api/usage-tracker.ts
720209
- import { mkdirSync as mkdirSync105, readFileSync as readFileSync136, writeFileSync as writeFileSync88, existsSync as existsSync167 } from "node:fs";
720521
+ import { mkdirSync as mkdirSync105, readFileSync as readFileSync137, writeFileSync as writeFileSync88, existsSync as existsSync167 } from "node:fs";
720210
720522
  import { join as join178 } from "node:path";
720211
720523
  function initUsageTracker(omniusDir) {
720212
720524
  const dir = join178(omniusDir, "usage");
@@ -720214,7 +720526,7 @@ function initUsageTracker(omniusDir) {
720214
720526
  usageFile = join178(dir, "token-usage.json");
720215
720527
  try {
720216
720528
  if (existsSync167(usageFile)) {
720217
- store = JSON.parse(readFileSync136(usageFile, "utf-8"));
720529
+ store = JSON.parse(readFileSync137(usageFile, "utf-8"));
720218
720530
  }
720219
720531
  } catch {
720220
720532
  store = { providers: {}, lastSaved: "" };
@@ -720913,7 +721225,7 @@ import {
720913
721225
  createReadStream as createReadStream2,
720914
721226
  mkdirSync as mkdirSync107,
720915
721227
  writeFileSync as writeFileSync90,
720916
- readFileSync as readFileSync137,
721228
+ readFileSync as readFileSync138,
720917
721229
  readdirSync as readdirSync59,
720918
721230
  existsSync as existsSync169,
720919
721231
  watch as fsWatch4,
@@ -720945,7 +721257,7 @@ function getVersion3() {
720945
721257
  for (const pkgPath of candidates) {
720946
721258
  try {
720947
721259
  if (!existsSync169(pkgPath)) continue;
720948
- const pkg = JSON.parse(readFileSync137(pkgPath, "utf8"));
721260
+ const pkg = JSON.parse(readFileSync138(pkgPath, "utf8"));
720949
721261
  if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
720950
721262
  return pkg.version ?? "0.0.0";
720951
721263
  }
@@ -721361,7 +721673,7 @@ function isOriginAllowed(origin) {
721361
721673
  try {
721362
721674
  const accessFile = join181(homedir63(), ".omnius", "access");
721363
721675
  if (existsSync169(accessFile)) {
721364
- const persisted = readFileSync137(accessFile, "utf8").trim().toLowerCase();
721676
+ const persisted = readFileSync138(accessFile, "utf8").trim().toLowerCase();
721365
721677
  if (persisted === "any" || persisted === "lan" || persisted === "loopback") {
721366
721678
  accessMode = persisted;
721367
721679
  }
@@ -722208,7 +722520,7 @@ function loadJob(id2) {
722208
722520
  const file = join181(jobsDir(), `${id2}.json`);
722209
722521
  if (!existsSync169(file)) return null;
722210
722522
  try {
722211
- return JSON.parse(readFileSync137(file, "utf-8"));
722523
+ return JSON.parse(readFileSync138(file, "utf-8"));
722212
722524
  } catch {
722213
722525
  return null;
722214
722526
  }
@@ -722221,7 +722533,7 @@ function listJobs2() {
722221
722533
  for (const file of files) {
722222
722534
  try {
722223
722535
  jobs.push(
722224
- JSON.parse(readFileSync137(join181(dir, file), "utf-8"))
722536
+ JSON.parse(readFileSync138(join181(dir, file), "utf-8"))
722225
722537
  );
722226
722538
  } catch {
722227
722539
  }
@@ -722239,7 +722551,7 @@ function pruneOldJobs() {
722239
722551
  if (!file.endsWith(".json")) continue;
722240
722552
  const path12 = join181(dir, file);
722241
722553
  try {
722242
- const job = JSON.parse(readFileSync137(path12, "utf-8"));
722554
+ const job = JSON.parse(readFileSync138(path12, "utf-8"));
722243
722555
  if (job.status === "running") {
722244
722556
  kept++;
722245
722557
  continue;
@@ -724395,7 +724707,7 @@ function readUpdateState() {
724395
724707
  try {
724396
724708
  const p2 = updateStateFile();
724397
724709
  if (!existsSync169(p2)) return null;
724398
- return JSON.parse(readFileSync137(p2, "utf-8"));
724710
+ return JSON.parse(readFileSync138(p2, "utf-8"));
724399
724711
  } catch {
724400
724712
  return null;
724401
724713
  }
@@ -724700,7 +725012,7 @@ function handleV1UpdateStatus(res) {
724700
725012
  let exitCode = null;
724701
725013
  try {
724702
725014
  if (existsSync169(logPath3)) {
724703
- const raw = readFileSync137(logPath3, "utf-8");
725015
+ const raw = readFileSync138(logPath3, "utf-8");
724704
725016
  const m2 = raw.match(/__EXIT_CODE=(\d+)/);
724705
725017
  if (m2) exitCode = parseInt(m2[1], 10);
724706
725018
  logTail = raw.slice(-2e3);
@@ -729181,7 +729493,7 @@ function listScheduledTasks() {
729181
729493
  if (dir.endsWith(`${join181(".omnius", "scheduled")}`) || dir.includes(`${join181(".omnius", "scheduled")}`)) {
729182
729494
  const file = join181(dir, "tasks.json");
729183
729495
  try {
729184
- const raw = readFileSync137(file, "utf-8");
729496
+ const raw = readFileSync138(file, "utf-8");
729185
729497
  const json = JSON.parse(raw);
729186
729498
  const tasks = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
729187
729499
  tasks.forEach((t2, i2) => {
@@ -729279,7 +729591,7 @@ function setScheduledEnabled(id2, enabled2) {
729279
729591
  const target = tasks.find((t2) => t2.id === id2);
729280
729592
  if (!target) return false;
729281
729593
  try {
729282
- const raw = readFileSync137(target.file, "utf-8");
729594
+ const raw = readFileSync138(target.file, "utf-8");
729283
729595
  const json = JSON.parse(raw);
729284
729596
  const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
729285
729597
  if (!arr[target.index]) return false;
@@ -729312,7 +729624,7 @@ function deleteScheduledById(id2) {
729312
729624
  const target = tasks.find((t2) => t2.id === id2);
729313
729625
  if (!target) return false;
729314
729626
  try {
729315
- const raw = readFileSync137(target.file, "utf-8");
729627
+ const raw = readFileSync138(target.file, "utf-8");
729316
729628
  const json = JSON.parse(raw);
729317
729629
  const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
729318
729630
  if (!arr[target.index]) return false;
@@ -729537,7 +729849,7 @@ function reconcileScheduledTasks(apply) {
729537
729849
  try {
729538
729850
  let json = { tasks: [] };
729539
729851
  try {
729540
- const raw = readFileSync137(file, "utf-8");
729852
+ const raw = readFileSync138(file, "utf-8");
729541
729853
  json = JSON.parse(raw);
729542
729854
  } catch {
729543
729855
  }
@@ -729916,7 +730228,7 @@ function startApiServer(options2 = {}) {
729916
730228
  const sid = f2.replace(/\.json$/, "");
729917
730229
  try {
729918
730230
  const items = JSON.parse(
729919
- readFileSync137(join181(dir, f2), "utf-8")
730231
+ readFileSync138(join181(dir, f2), "utf-8")
729920
730232
  );
729921
730233
  if (Array.isArray(items)) {
729922
730234
  cache8.set(sid, new Map(items.map((t2) => [t2.id, t2])));
@@ -729950,7 +730262,7 @@ function startApiServer(options2 = {}) {
729950
730262
  }
729951
730263
  return;
729952
730264
  }
729953
- next = JSON.parse(readFileSync137(fp, "utf-8"));
730265
+ next = JSON.parse(readFileSync138(fp, "utf-8"));
729954
730266
  if (!Array.isArray(next)) return;
729955
730267
  } catch {
729956
730268
  return;
@@ -730013,7 +730325,7 @@ function startApiServer(options2 = {}) {
730013
730325
  if (!f2.endsWith(".json")) continue;
730014
730326
  try {
730015
730327
  const jobPath = join181(jobsDir3, f2);
730016
- const job = JSON.parse(readFileSync137(jobPath, "utf-8"));
730328
+ const job = JSON.parse(readFileSync138(jobPath, "utf-8"));
730017
730329
  const jobTime = new Date(
730018
730330
  job.startedAt ?? job.completedAt ?? 0
730019
730331
  ).getTime();
@@ -730035,8 +730347,8 @@ function startApiServer(options2 = {}) {
730035
730347
  if (useTls) {
730036
730348
  try {
730037
730349
  tlsOpts = {
730038
- cert: readFileSync137(resolve71(tlsCert)),
730039
- key: readFileSync137(resolve71(tlsKey))
730350
+ cert: readFileSync138(resolve71(tlsCert)),
730351
+ key: readFileSync138(resolve71(tlsKey))
730040
730352
  };
730041
730353
  } catch (e2) {
730042
730354
  log22(`
@@ -730049,7 +730361,7 @@ function startApiServer(options2 = {}) {
730049
730361
  try {
730050
730362
  const accessFile = join181(homedir63(), ".omnius", "access");
730051
730363
  if (existsSync169(accessFile)) {
730052
- const persisted = readFileSync137(accessFile, "utf8").trim();
730364
+ const persisted = readFileSync138(accessFile, "utf8").trim();
730053
730365
  const resolved = resolveAccessMode(persisted, host);
730054
730366
  if (resolved) runtimeAccessMode = resolved;
730055
730367
  }
@@ -730480,7 +730792,7 @@ function startApiServer(options2 = {}) {
730480
730792
  for (const rel of ["../package.json", "../../package.json", "../../../package.json", "../../../../package.json"]) {
730481
730793
  const p2 = join181(here, rel);
730482
730794
  if (existsSync169(p2)) {
730483
- const pkg = JSON.parse(readFileSync137(p2, "utf8"));
730795
+ const pkg = JSON.parse(readFileSync138(p2, "utf8"));
730484
730796
  if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
730485
730797
  return pkg.version ?? null;
730486
730798
  }
@@ -731496,7 +731808,7 @@ var clipboard_media_exports = {};
731496
731808
  __export(clipboard_media_exports, {
731497
731809
  pasteClipboardImageToFile: () => pasteClipboardImageToFile
731498
731810
  });
731499
- import { mkdirSync as mkdirSync108, readFileSync as readFileSync138, rmSync as rmSync15, writeFileSync as writeFileSync91 } from "node:fs";
731811
+ import { mkdirSync as mkdirSync108, readFileSync as readFileSync139, rmSync as rmSync15, writeFileSync as writeFileSync91 } from "node:fs";
731500
731812
  import { join as join182 } from "node:path";
731501
731813
  async function pasteClipboardImageToFile(repoRoot) {
731502
731814
  const image = await readClipboardImage();
@@ -731513,7 +731825,7 @@ async function readClipboardImage() {
731513
731825
  if (!await commandExists2("pngpaste", 1e3)) return null;
731514
731826
  const tmp = `/tmp/omnius-clipboard-${Date.now()}.png`;
731515
731827
  await execFileBuffer("pngpaste", [tmp], { timeout: 3e3 });
731516
- const buffer2 = readFileSync138(tmp);
731828
+ const buffer2 = readFileSync139(tmp);
731517
731829
  try {
731518
731830
  rmSync15(tmp);
731519
731831
  } catch {
@@ -731573,7 +731885,7 @@ import { resolve as resolve72, join as join183, dirname as dirname54, extname as
731573
731885
  import { createRequire as createRequire9 } from "node:module";
731574
731886
  import { fileURLToPath as fileURLToPath24 } from "node:url";
731575
731887
  import {
731576
- readFileSync as readFileSync139,
731888
+ readFileSync as readFileSync140,
731577
731889
  writeFileSync as writeFileSync92,
731578
731890
  appendFileSync as appendFileSync20,
731579
731891
  rmSync as rmSync16,
@@ -733054,7 +733366,7 @@ function gatherMemorySnippets(root) {
733054
733366
  if (!existsSync170(dir)) continue;
733055
733367
  try {
733056
733368
  for (const f2 of readdirSync60(dir).filter((f3) => f3.endsWith(".json"))) {
733057
- const data = JSON.parse(readFileSync139(join183(dir, f2), "utf-8"));
733369
+ const data = JSON.parse(readFileSync140(join183(dir, f2), "utf-8"));
733058
733370
  for (const val of Object.values(data)) {
733059
733371
  const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
733060
733372
  if (v.length > 10) snippets.push(v);
@@ -733526,7 +733838,7 @@ ${metabolismMemories}
733526
733838
  try {
733527
733839
  const archeFile = join183(repoRoot, ".omnius", "arche", "variants.json");
733528
733840
  if (existsSync170(archeFile)) {
733529
- const variants = JSON.parse(readFileSync139(archeFile, "utf8"));
733841
+ const variants = JSON.parse(readFileSync140(archeFile, "utf8"));
733530
733842
  if (variants.length > 0) {
733531
733843
  let filtered = variants;
733532
733844
  if (taskType) {
@@ -733717,7 +734029,7 @@ ${skillPack}`;
733717
734029
  "self-state.json"
733718
734030
  );
733719
734031
  if (existsSync170(ikStateFile)) {
733720
- const selfState = JSON.parse(readFileSync139(ikStateFile, "utf8"));
734032
+ const selfState = JSON.parse(readFileSync140(ikStateFile, "utf8"));
733721
734033
  const lines = [
733722
734034
  `[Identity State v${selfState.version}]`,
733723
734035
  `Self: ${selfState.narrative_summary}`,
@@ -734056,7 +734368,7 @@ Review its full output via sub_agent(action='output', id='${id2}')`
734056
734368
  }
734057
734369
  }
734058
734370
  try {
734059
- const { readdirSync: readdirSync62, readFileSync: readFileSync141, existsSync: existsSync173 } = await import("node:fs");
734371
+ const { readdirSync: readdirSync62, readFileSync: readFileSync142, existsSync: existsSync173 } = await import("node:fs");
734060
734372
  const { join: pathJoin } = await import("node:path");
734061
734373
  const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
734062
734374
  if (existsSync173(chunksDir)) {
@@ -734066,7 +734378,7 @@ Review its full output via sub_agent(action='output', id='${id2}')`
734066
734378
  for (const f2 of files) {
734067
734379
  try {
734068
734380
  const data = JSON.parse(
734069
- readFileSync141(pathJoin(chunksDir, f2), "utf-8")
734381
+ readFileSync142(pathJoin(chunksDir, f2), "utf-8")
734070
734382
  );
734071
734383
  if (data._deleted) continue;
734072
734384
  if ((data.functionalSummary || "").toLowerCase().includes(q) || (data.detailSummary || "").toLowerCase().includes(q) || (data.keyFiles || []).some(
@@ -734132,7 +734444,7 @@ ${lines.join("\n")}`
734132
734444
  const expand2 = args.expand === true;
734133
734445
  if (expand2 && id2.startsWith("todo-ctx-")) {
734134
734446
  try {
734135
- const { readFileSync: readFileSync141, existsSync: existsSync173 } = await import("node:fs");
734447
+ const { readFileSync: readFileSync142, existsSync: existsSync173 } = await import("node:fs");
734136
734448
  const { join: pathJoin } = await import("node:path");
734137
734449
  const chunksDir = pathJoin(cwd(), ".omnius", "todo-chunks");
734138
734450
  const todoIdSuffix = id2.replace("todo-ctx-", "");
@@ -735670,7 +735982,7 @@ async function startInteractive(config, repoPath2) {
735670
735982
  const omniusDir = join183(repoRoot, ".omnius");
735671
735983
  const nexusPidFile = join183(omniusDir, "nexus", "daemon.pid");
735672
735984
  if (existsSync170(nexusPidFile)) {
735673
- const pid = parseInt(readFileSync139(nexusPidFile, "utf8").trim(), 10);
735985
+ const pid = parseInt(readFileSync140(nexusPidFile, "utf8").trim(), 10);
735674
735986
  if (pid > 0) {
735675
735987
  try {
735676
735988
  process.kill(pid, 0);
@@ -736866,7 +737178,7 @@ This is an independent background session started from /background.`
736866
737178
  try {
736867
737179
  const titleFile = join183(repoRoot, ".omnius", "session-title");
736868
737180
  if (existsSync170(titleFile))
736869
- sessionTitle = readFileSync139(titleFile, "utf8").trim() || null;
737181
+ sessionTitle = readFileSync140(titleFile, "utf8").trim() || null;
736870
737182
  } catch {
736871
737183
  }
736872
737184
  let carouselRetired = isResumed;
@@ -736981,7 +737293,7 @@ This is an independent background session started from /background.`
736981
737293
  let savedHistory = [];
736982
737294
  try {
736983
737295
  if (existsSync170(HISTORY_FILE)) {
736984
- const raw = readFileSync139(HISTORY_FILE, "utf8").trim();
737296
+ const raw = readFileSync140(HISTORY_FILE, "utf8").trim();
736985
737297
  if (raw) savedHistory = raw.split("\n").reverse();
736986
737298
  }
736987
737299
  } catch {
@@ -737140,7 +737452,7 @@ This is an independent background session started from /background.`
737140
737452
  mkdirSync109(HISTORY_DIR, { recursive: true });
737141
737453
  appendFileSync20(HISTORY_FILE, line + "\n", "utf8");
737142
737454
  if (Math.random() < 0.02) {
737143
- const all2 = readFileSync139(HISTORY_FILE, "utf8").trim().split("\n");
737455
+ const all2 = readFileSync140(HISTORY_FILE, "utf8").trim().split("\n");
737144
737456
  if (all2.length > MAX_HISTORY_LINES) {
737145
737457
  writeFileSync92(
737146
737458
  HISTORY_FILE,
@@ -737369,7 +737681,7 @@ This is an independent background session started from /background.`
737369
737681
  const nexusPidFile = join183(autoNexus.getNexusDir(), "daemon.pid");
737370
737682
  if (existsSync170(nexusPidFile)) {
737371
737683
  const nPid = parseInt(
737372
- readFileSync139(nexusPidFile, "utf8").trim(),
737684
+ readFileSync140(nexusPidFile, "utf8").trim(),
737373
737685
  10
737374
737686
  );
737375
737687
  if (nPid > 0 && !registry2.daemons.has("Nexus")) {
@@ -737551,7 +737863,7 @@ Log: ${nexusLogPath}`
737551
737863
  let agName = "";
737552
737864
  try {
737553
737865
  if (existsSync170(globalNamePath))
737554
- agName = readFileSync139(globalNamePath, "utf8").trim();
737866
+ agName = readFileSync140(globalNamePath, "utf8").trim();
737555
737867
  } catch {
737556
737868
  }
737557
737869
  if (!agName) {
@@ -737592,7 +737904,7 @@ Log: ${nexusLogPath}`
737592
737904
  try {
737593
737905
  if (existsSync170(savedSponsorsPath)) {
737594
737906
  savedSponsors = JSON.parse(
737595
- readFileSync139(savedSponsorsPath, "utf8")
737907
+ readFileSync140(savedSponsorsPath, "utf8")
737596
737908
  );
737597
737909
  const oneHourAgo = Date.now() - 36e5;
737598
737910
  savedSponsors = savedSponsors.filter(
@@ -739888,7 +740200,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
739888
740200
  try {
739889
740201
  const nexusPidFile = join183(nexusTool.getNexusDir(), "daemon.pid");
739890
740202
  if (existsSync170(nexusPidFile)) {
739891
- const pid = parseInt(readFileSync139(nexusPidFile, "utf8").trim(), 10);
740203
+ const pid = parseInt(readFileSync140(nexusPidFile, "utf8").trim(), 10);
739892
740204
  if (pid > 0) {
739893
740205
  registry2.register({
739894
740206
  name: "Nexus",
@@ -740101,7 +740413,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
740101
740413
  const nexusDir = join183(repoRoot, OMNIUS_DIR, "nexus");
740102
740414
  const pidFile = join183(nexusDir, "daemon.pid");
740103
740415
  if (existsSync170(pidFile)) {
740104
- const pid = parseInt(readFileSync139(pidFile, "utf8").trim(), 10);
740416
+ const pid = parseInt(readFileSync140(pidFile, "utf8").trim(), 10);
740105
740417
  if (pid > 0) {
740106
740418
  try {
740107
740419
  if (process.platform === "win32") {
@@ -740131,7 +740443,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
740131
740443
  const pidPath = join183(voiceDir3, pf);
740132
740444
  if (existsSync170(pidPath)) {
740133
740445
  try {
740134
- const pid = parseInt(readFileSync139(pidPath, "utf8").trim(), 10);
740446
+ const pid = parseInt(readFileSync140(pidPath, "utf8").trim(), 10);
740135
740447
  if (pid > 0) {
740136
740448
  if (process.platform === "win32") {
740137
740449
  try {
@@ -740272,8 +740584,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
740272
740584
  "daemon.port"
740273
740585
  );
740274
740586
  if (existsSync170(ppPidFile)) {
740275
- const ppPid = parseInt(readFileSync139(ppPidFile, "utf8").trim(), 10);
740276
- const ppPort = existsSync170(ppPortFile) ? parseInt(readFileSync139(ppPortFile, "utf8").trim(), 10) : void 0;
740587
+ const ppPid = parseInt(readFileSync140(ppPidFile, "utf8").trim(), 10);
740588
+ const ppPort = existsSync170(ppPortFile) ? parseInt(readFileSync140(ppPortFile, "utf8").trim(), 10) : void 0;
740277
740589
  if (ppPid > 0 && !registry2.daemons.has("PersonaPlex")) {
740278
740590
  registry2.register({
740279
740591
  name: "PersonaPlex",
@@ -740290,7 +740602,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
740290
740602
  "daemon.pid"
740291
740603
  );
740292
740604
  if (existsSync170(nexusPidFile)) {
740293
- const nPid = parseInt(readFileSync139(nexusPidFile, "utf8").trim(), 10);
740605
+ const nPid = parseInt(readFileSync140(nexusPidFile, "utf8").trim(), 10);
740294
740606
  if (nPid > 0 && !registry2.daemons.has("Nexus")) {
740295
740607
  try {
740296
740608
  process.kill(nPid, 0);
@@ -740735,7 +741047,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
740735
741047
  if (isImage) {
740736
741048
  try {
740737
741049
  const imgPath = resolve72(repoRoot, cleanPath);
740738
- const imgBuffer = readFileSync139(imgPath);
741050
+ const imgBuffer = readFileSync140(imgPath);
740739
741051
  const base642 = imgBuffer.toString("base64");
740740
741052
  const ext = extname22(cleanPath).toLowerCase();
740741
741053
  const mime = ext === ".png" ? "image/png" : ext === ".gif" ? "image/gif" : ext === ".webp" ? "image/webp" : "image/jpeg";
@@ -740938,7 +741250,7 @@ ${result.text}`;
740938
741250
  try {
740939
741251
  const { runVisionIngress: runVisionIngress2, formatImageContextPrefix: formatImageContextPrefix2 } = await Promise.resolve().then(() => (init_vision_ingress(), vision_ingress_exports));
740940
741252
  const ingressResult = await runVisionIngress2(
740941
- { path: imgPath, buffer: readFileSync139(imgPath), mime },
741253
+ { path: imgPath, buffer: readFileSync140(imgPath), mime },
740942
741254
  currentConfig.model ?? ""
740943
741255
  );
740944
741256
  visionContext = formatImageContextPrefix2(ingressResult);
@@ -741006,7 +741318,7 @@ Use vision(image="${cleanPath}") for additional semantic detail, and image_read(
741006
741318
  if (isMarkdown && fullInput === input) {
741007
741319
  try {
741008
741320
  const mdPath = resolve72(repoRoot, cleanPath);
741009
- const mdContent = readFileSync139(mdPath, "utf8");
741321
+ const mdContent = readFileSync140(mdPath, "utf8");
741010
741322
  const { parseMcpMarkdown: parseMcpMarkdown2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports2));
741011
741323
  const result = parseMcpMarkdown2(mdContent);
741012
741324
  if (result.servers.length > 0) {
@@ -741667,7 +741979,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
741667
741979
  const ikFile = join183(ikDir, "self-state.json");
741668
741980
  let ikState;
741669
741981
  if (existsSync170(ikFile)) {
741670
- ikState = JSON.parse(readFileSync139(ikFile, "utf8"));
741982
+ ikState = JSON.parse(readFileSync140(ikFile, "utf8"));
741671
741983
  } else {
741672
741984
  mkdirSync109(ikDir, { recursive: true });
741673
741985
  ikState = {
@@ -741740,7 +742052,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
741740
742052
  let variants = [];
741741
742053
  try {
741742
742054
  if (existsSync170(archeFile))
741743
- variants = JSON.parse(readFileSync139(archeFile, "utf8"));
742055
+ variants = JSON.parse(readFileSync140(archeFile, "utf8"));
741744
742056
  } catch {
741745
742057
  }
741746
742058
  variants.push({
@@ -741768,7 +742080,7 @@ async function runWithTUI(task, config, repoPath2, callbacks) {
741768
742080
  "store.json"
741769
742081
  );
741770
742082
  if (existsSync170(metaFile2)) {
741771
- const store2 = JSON.parse(readFileSync139(metaFile2, "utf8"));
742083
+ const store2 = JSON.parse(readFileSync140(metaFile2, "utf8"));
741772
742084
  const surfaced = store2.filter(
741773
742085
  (m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
741774
742086
  ).sort(
@@ -741871,7 +742183,7 @@ Rules:
741871
742183
  let store2 = [];
741872
742184
  try {
741873
742185
  if (existsSync170(storeFile))
741874
- store2 = JSON.parse(readFileSync139(storeFile, "utf8"));
742186
+ store2 = JSON.parse(readFileSync140(storeFile, "utf8"));
741875
742187
  } catch {
741876
742188
  }
741877
742189
  store2.push({
@@ -741905,7 +742217,7 @@ Rules:
741905
742217
  let cohereActive = false;
741906
742218
  try {
741907
742219
  if (existsSync170(cohereSettingsFile)) {
741908
- const settings = JSON.parse(readFileSync139(cohereSettingsFile, "utf8"));
742220
+ const settings = JSON.parse(readFileSync140(cohereSettingsFile, "utf8"));
741909
742221
  cohereActive = settings.cohere === true;
741910
742222
  }
741911
742223
  } catch {
@@ -741919,7 +742231,7 @@ Rules:
741919
742231
  "store.json"
741920
742232
  );
741921
742233
  if (existsSync170(metaFile2)) {
741922
- const store2 = JSON.parse(readFileSync139(metaFile2, "utf8"));
742234
+ const store2 = JSON.parse(readFileSync140(metaFile2, "utf8"));
741923
742235
  const latest = store2.filter(
741924
742236
  (m2) => m2.sourceTrace === "trajectory-extraction" || m2.sourceTrace === "llm-trajectory-extraction"
741925
742237
  ).slice(-1)[0];
@@ -741952,7 +742264,7 @@ Rules:
741952
742264
  try {
741953
742265
  const ikFile = join183(repoRoot, ".omnius", "identity", "self-state.json");
741954
742266
  if (existsSync170(ikFile)) {
741955
- const ikState = JSON.parse(readFileSync139(ikFile, "utf8"));
742267
+ const ikState = JSON.parse(readFileSync140(ikFile, "utf8"));
741956
742268
  ikState.homeostasis.uncertainty = Math.min(
741957
742269
  1,
741958
742270
  ikState.homeostasis.uncertainty + 0.1
@@ -741973,7 +742285,7 @@ Rules:
741973
742285
  "store.json"
741974
742286
  );
741975
742287
  if (existsSync170(metaFile2)) {
741976
- const store2 = JSON.parse(readFileSync139(metaFile2, "utf8"));
742288
+ const store2 = JSON.parse(readFileSync140(metaFile2, "utf8"));
741977
742289
  const surfaced = store2.filter(
741978
742290
  (m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
741979
742291
  ).sort(
@@ -741999,7 +742311,7 @@ Rules:
741999
742311
  let variants = [];
742000
742312
  try {
742001
742313
  if (existsSync170(archeFile))
742002
- variants = JSON.parse(readFileSync139(archeFile, "utf8"));
742314
+ variants = JSON.parse(readFileSync140(archeFile, "utf8"));
742003
742315
  } catch {
742004
742316
  }
742005
742317
  variants.push({
@@ -742139,7 +742451,7 @@ import { spawn as spawn39 } from "node:child_process";
742139
742451
  import {
742140
742452
  mkdirSync as mkdirSync110,
742141
742453
  writeFileSync as writeFileSync93,
742142
- readFileSync as readFileSync140,
742454
+ readFileSync as readFileSync141,
742143
742455
  readdirSync as readdirSync61,
742144
742456
  existsSync as existsSync171
742145
742457
  } from "node:fs";
@@ -742347,7 +742659,7 @@ function statusCommand(jobId, repoPath2) {
742347
742659
  console.log(`Available jobs: omnius jobs`);
742348
742660
  process.exit(1);
742349
742661
  }
742350
- const job = JSON.parse(readFileSync140(file, "utf-8"));
742662
+ const job = JSON.parse(readFileSync141(file, "utf-8"));
742351
742663
  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`;
742352
742664
  const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
742353
742665
  console.log(`${icon} ${job.id} [${job.status}] ${runtime}`);
@@ -742369,7 +742681,7 @@ function jobsCommand(repoPath2) {
742369
742681
  console.log("Jobs:");
742370
742682
  for (const file of files) {
742371
742683
  try {
742372
- const job = JSON.parse(readFileSync140(join184(dir, file), "utf-8"));
742684
+ const job = JSON.parse(readFileSync141(join184(dir, file), "utf-8"));
742373
742685
  const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
742374
742686
  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`;
742375
742687
  const cleanListTask = cleanForStorage(job.task) || job.task;