open-agents-ai 0.187.142 → 0.187.143

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +674 -477
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -245752,9 +245752,9 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
245752
245752
  * what was previously computed. */
245753
245753
  async loadSessionInfo() {
245754
245754
  try {
245755
- const { readFileSync: readFileSync57, existsSync: existsSync72 } = await import("node:fs");
245755
+ const { readFileSync: readFileSync57, existsSync: existsSync73 } = await import("node:fs");
245756
245756
  const sessionPath = join24(this.cwd, ".oa", "rlm", "session.json");
245757
- if (!existsSync72(sessionPath))
245757
+ if (!existsSync73(sessionPath))
245758
245758
  return null;
245759
245759
  return JSON.parse(readFileSync57(sessionPath, "utf8"));
245760
245760
  } catch {
@@ -246320,10 +246320,10 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
246320
246320
  * Optionally filter by task type for phase-aware context (FSM paper insight).
246321
246321
  */
246322
246322
  getTopMemoriesSync(k = 5, taskType) {
246323
- const { readFileSync: readFileSync57, existsSync: existsSync72 } = __require("node:fs");
246323
+ const { readFileSync: readFileSync57, existsSync: existsSync73 } = __require("node:fs");
246324
246324
  const metaDir = join25(this.cwd, ".oa", "memory", "metabolism");
246325
246325
  const storeFile = join25(metaDir, "store.json");
246326
- if (!existsSync72(storeFile))
246326
+ if (!existsSync73(storeFile))
246327
246327
  return "";
246328
246328
  let store2 = [];
246329
246329
  try {
@@ -246349,10 +246349,10 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
246349
246349
  /** Update memory scores based on task outcome. Called after task completion.
246350
246350
  * Memories used in successful tasks get boosted. Memories present during failures get decayed. */
246351
246351
  updateFromOutcomeSync(surfacedMemoryText, succeeded) {
246352
- const { readFileSync: readFileSync57, writeFileSync: writeFileSync38, existsSync: existsSync72, mkdirSync: mkdirSync41 } = __require("node:fs");
246352
+ const { readFileSync: readFileSync57, writeFileSync: writeFileSync38, existsSync: existsSync73, mkdirSync: mkdirSync41 } = __require("node:fs");
246353
246353
  const metaDir = join25(this.cwd, ".oa", "memory", "metabolism");
246354
246354
  const storeFile = join25(metaDir, "store.json");
246355
- if (!existsSync72(storeFile))
246355
+ if (!existsSync73(storeFile))
246356
246356
  return;
246357
246357
  let store2 = [];
246358
246358
  try {
@@ -246803,9 +246803,9 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
246803
246803
  // Per EvoSkill (arXiv:2603.02766): retrieve relevant strategies from archive.
246804
246804
  /** Retrieve top-K strategies for context injection. Returns "" if none. */
246805
246805
  getRelevantStrategiesSync(k = 3, taskType) {
246806
- const { readFileSync: readFileSync57, existsSync: existsSync72 } = __require("node:fs");
246806
+ const { readFileSync: readFileSync57, existsSync: existsSync73 } = __require("node:fs");
246807
246807
  const archiveFile = join27(this.cwd, ".oa", "arche", "variants.json");
246808
- if (!existsSync72(archiveFile))
246808
+ if (!existsSync73(archiveFile))
246809
246809
  return "";
246810
246810
  let variants = [];
246811
246811
  try {
@@ -246827,12 +246827,12 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
246827
246827
  }
246828
246828
  /** Archive a strategy variant synchronously (for task completion path) */
246829
246829
  archiveVariantSync(strategy, outcome, tags = []) {
246830
- const { readFileSync: readFileSync57, writeFileSync: writeFileSync38, existsSync: existsSync72, mkdirSync: mkdirSync41 } = __require("node:fs");
246830
+ const { readFileSync: readFileSync57, writeFileSync: writeFileSync38, existsSync: existsSync73, mkdirSync: mkdirSync41 } = __require("node:fs");
246831
246831
  const dir = join27(this.cwd, ".oa", "arche");
246832
246832
  const archiveFile = join27(dir, "variants.json");
246833
246833
  let variants = [];
246834
246834
  try {
246835
- if (existsSync72(archiveFile))
246835
+ if (existsSync73(archiveFile))
246836
246836
  variants = JSON.parse(readFileSync57(archiveFile, "utf8"));
246837
246837
  } catch {
246838
246838
  }
@@ -247838,9 +247838,9 @@ var init_vision = __esm({
247838
247838
  if (ollamaResult)
247839
247839
  return ollamaResult;
247840
247840
  try {
247841
- const { execSync: execSync50 } = await import("node:child_process");
247841
+ const { execSync: execSync51 } = await import("node:child_process");
247842
247842
  try {
247843
- execSync50("pip3 install --user moondream 2>/dev/null || pip install --user moondream 2>/dev/null", {
247843
+ execSync51("pip3 install --user moondream 2>/dev/null || pip install --user moondream 2>/dev/null", {
247844
247844
  timeout: 12e4,
247845
247845
  stdio: "pipe"
247846
247846
  });
@@ -247853,7 +247853,7 @@ var init_vision = __esm({
247853
247853
  } catch {
247854
247854
  }
247855
247855
  try {
247856
- execSync50("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
247856
+ execSync51("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
247857
247857
  const retryOllama = await this.tryOllamaVision(buffer2, filename, action, prompt, length4, start2);
247858
247858
  if (retryOllama)
247859
247859
  return retryOllama;
@@ -247961,8 +247961,8 @@ Coordinates are normalized (0-1). Multiply by image width/height for pixel value
247961
247961
  const errText = await res.text().catch(() => "");
247962
247962
  if (res.status === 404 || /not found|does not exist/i.test(errText)) {
247963
247963
  try {
247964
- const { execSync: execSync50 } = await import("node:child_process");
247965
- execSync50("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
247964
+ const { execSync: execSync51 } = await import("node:child_process");
247965
+ execSync51("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
247966
247966
  res = await fetch(`${ollamaHost}/api/generate`, {
247967
247967
  method: "POST",
247968
247968
  headers: { "Content-Type": "application/json" },
@@ -255559,11 +255559,16 @@ Tools installed but rtl_test failed \u2014 device may be in use by another proce
255559
255559
  mkdirSync12(captureDir, { recursive: true });
255560
255560
  const outFile = join46(captureDir, `scan-${Date.now()}.csv`);
255561
255561
  const gainArg = gain !== void 0 ? `-g ${gain}` : "";
255562
- const cmd = `timeout ${duration + 5} rtl_power -f ${startFreq}:${endFreq}:10k ${gainArg} -e ${duration}s ${outFile} 2>&1`;
255562
+ const cmd = `timeout ${duration + 15} rtl_power -f ${startFreq}:${endFreq}:10k ${gainArg} -i 1 -e ${duration}s ${outFile} 2>&1`;
255563
255563
  try {
255564
- const output = execSync32(cmd, { encoding: "utf8", timeout: (duration + 10) * 1e3 });
255565
- if (!existsSync31(outFile)) {
255566
- return { success: false, output, error: "Scan produced no output file. SDR device may be busy.", durationMs: performance.now() - start2 };
255564
+ let output = "";
255565
+ try {
255566
+ output = execSync32(cmd, { encoding: "utf8", timeout: (duration + 20) * 1e3 });
255567
+ } catch (cmdErr) {
255568
+ output = cmdErr.stdout?.toString() || cmdErr.stderr?.toString() || "";
255569
+ }
255570
+ if (!existsSync31(outFile) || statSync13(outFile).size === 0) {
255571
+ return { success: false, output: output.slice(0, 300), error: "Scan produced no data. SDR device may be busy or frequency range unsupported.", durationMs: performance.now() - start2 };
255567
255572
  }
255568
255573
  const csv = readFileSync23(outFile, "utf8");
255569
255574
  const lines = csv.trim().split("\n");
@@ -255890,6 +255895,195 @@ ${cleanOutput}`, durationMs: performance.now() - start2 };
255890
255895
  }
255891
255896
  });
255892
255897
 
255898
+ // packages/execution/dist/tools/meshtastic-tool.js
255899
+ import { execSync as execSync34 } from "node:child_process";
255900
+ import { existsSync as existsSync32 } from "node:fs";
255901
+ var MESH_VENV, MESH_CLI, MeshtasticTool;
255902
+ var init_meshtastic_tool = __esm({
255903
+ "packages/execution/dist/tools/meshtastic-tool.js"() {
255904
+ "use strict";
255905
+ init_system_auth();
255906
+ MESH_VENV = "/tmp/mesh-venv";
255907
+ MESH_CLI = `${MESH_VENV}/bin/meshtastic`;
255908
+ MeshtasticTool = class {
255909
+ name = "meshtastic";
255910
+ description = "Interact with a Meshtastic mesh network device. Actions: 'info' for device details, 'nodes' to list mesh nodes, 'send' to send a text message, 'position' for GPS coordinates, 'telemetry' for battery/signal metrics, 'channels' for channel config. Use this to communicate over long-range mesh networks, check device status, or discover other nodes in the mesh. Works with Heltec, T-Beam, RAK devices.";
255911
+ parameters = {
255912
+ type: "object",
255913
+ properties: {
255914
+ action: {
255915
+ type: "string",
255916
+ enum: ["info", "nodes", "send", "position", "telemetry", "channels"],
255917
+ description: "Action to perform"
255918
+ },
255919
+ message: {
255920
+ type: "string",
255921
+ description: "Text message to send (for 'send' action)"
255922
+ },
255923
+ channel: {
255924
+ type: "number",
255925
+ description: "Channel index to send on (default: 0 = primary)"
255926
+ },
255927
+ destination: {
255928
+ type: "string",
255929
+ description: "Destination node ID for direct message (default: broadcast). Use '!hexid' format."
255930
+ },
255931
+ port: {
255932
+ type: "string",
255933
+ description: "Serial port (default: auto-detect /dev/ttyACM0 or /dev/ttyUSB0)"
255934
+ }
255935
+ },
255936
+ required: ["action"]
255937
+ };
255938
+ async execute(args) {
255939
+ const action = args["action"];
255940
+ const start2 = performance.now();
255941
+ const cliReady = await this.ensureMeshtasticCli();
255942
+ if (!cliReady) {
255943
+ return { success: false, output: "", error: "Could not install meshtastic CLI. Run: pip install meshtastic", durationMs: performance.now() - start2 };
255944
+ }
255945
+ const port = args["port"] || this.findMeshtasticPort();
255946
+ if (!port) {
255947
+ return { success: false, output: "", error: "No Meshtastic device found. Connect a Meshtastic device via USB.", durationMs: performance.now() - start2 };
255948
+ }
255949
+ try {
255950
+ switch (action) {
255951
+ case "info":
255952
+ return this.getInfo(port, start2);
255953
+ case "nodes":
255954
+ return this.listNodes(port, start2);
255955
+ case "send":
255956
+ return this.sendMessage(port, args, start2);
255957
+ case "position":
255958
+ return this.getPosition(port, start2);
255959
+ case "telemetry":
255960
+ return this.getTelemetry(port, start2);
255961
+ case "channels":
255962
+ return this.getChannels(port, start2);
255963
+ default:
255964
+ return { success: false, output: "", error: `Unknown action: ${action}`, durationMs: performance.now() - start2 };
255965
+ }
255966
+ } catch (err) {
255967
+ return { success: false, output: "", error: `meshtastic error: ${err instanceof Error ? err.message : String(err)}`, durationMs: performance.now() - start2 };
255968
+ }
255969
+ }
255970
+ async getInfo(port, start2) {
255971
+ return this.runMeshCmd(port, "--info", start2, "Device info");
255972
+ }
255973
+ async listNodes(port, start2) {
255974
+ return this.runMeshCmd(port, "--nodes", start2, "Mesh nodes");
255975
+ }
255976
+ async sendMessage(port, args, start2) {
255977
+ const message2 = args["message"];
255978
+ if (!message2) {
255979
+ return { success: false, output: "", error: "Missing 'message'. Provide text to send.", durationMs: performance.now() - start2 };
255980
+ }
255981
+ const channel = args["channel"] ?? 0;
255982
+ const dest = args["destination"];
255983
+ let cmd = `--sendtext "${message2.replace(/"/g, '\\"')}" --ch-index ${channel}`;
255984
+ if (dest)
255985
+ cmd += ` --dest ${dest}`;
255986
+ return this.runMeshCmd(port, cmd, start2, `Sent: "${message2.slice(0, 50)}"`);
255987
+ }
255988
+ async getPosition(port, start2) {
255989
+ return this.runMeshCmd(port, "--info", start2, "Position", (output) => {
255990
+ const posMatch = output.match(/"position":\s*\{[^}]+\}/s);
255991
+ return posMatch ? `GPS Position:
255992
+ ${posMatch[0]}` : "Position data not available (device may not have GPS fix)";
255993
+ });
255994
+ }
255995
+ async getTelemetry(port, start2) {
255996
+ return this.runMeshCmd(port, "--info", start2, "Telemetry", (output) => {
255997
+ const metricMatch = output.match(/"deviceMetrics":\s*\{[^}]+\}/s);
255998
+ return metricMatch ? `Device Telemetry:
255999
+ ${metricMatch[0]}` : "Telemetry data not available";
256000
+ });
256001
+ }
256002
+ async getChannels(port, start2) {
256003
+ return this.runMeshCmd(port, "--ch-index 0 --get lora", start2, "Channel config");
256004
+ }
256005
+ // =========================================================================
256006
+ // Helpers
256007
+ // =========================================================================
256008
+ async runMeshCmd(port, cmdArgs, start2, label, transform) {
256009
+ await this.ensureSerialAccess(port);
256010
+ try {
256011
+ const output = execSync34(`${MESH_CLI} --port ${port} ${cmdArgs}`, { encoding: "utf8", timeout: 3e4, stdio: ["pipe", "pipe", "pipe"] });
256012
+ const result = transform ? transform(output) : output;
256013
+ return { success: true, output: `${label}:
256014
+ ${result.trim()}`, durationMs: performance.now() - start2 };
256015
+ } catch (err) {
256016
+ const stderr = err.stderr?.toString() || "";
256017
+ const stdout = err.stdout?.toString() || "";
256018
+ if (stderr.includes("Permission") || stderr.includes("denied")) {
256019
+ try {
256020
+ await runElevated(`chmod 666 ${port} && usermod -a -G dialout $(whoami)`, {
256021
+ timeout: 3e4,
256022
+ description: "Open Agents needs serial port access for Meshtastic device"
256023
+ });
256024
+ const output2 = execSync34(`${MESH_CLI} --port ${port} ${cmdArgs}`, { encoding: "utf8", timeout: 3e4, stdio: ["pipe", "pipe", "pipe"] });
256025
+ const result2 = transform ? transform(output2) : output2;
256026
+ return { success: true, output: `${label}:
256027
+ ${result2.trim()}`, durationMs: performance.now() - start2 };
256028
+ } catch {
256029
+ return { success: false, output: "", error: `Permission denied on ${port}. Run: sudo chmod 666 ${port}`, durationMs: performance.now() - start2 };
256030
+ }
256031
+ }
256032
+ if (stdout.includes("Connected to radio")) {
256033
+ const result = transform ? transform(stdout) : stdout;
256034
+ return { success: true, output: `${label}:
256035
+ ${result.trim()}`, durationMs: performance.now() - start2 };
256036
+ }
256037
+ return { success: false, output: stdout.slice(0, 500), error: `${label} failed: ${stderr.slice(0, 300)}`, durationMs: performance.now() - start2 };
256038
+ }
256039
+ }
256040
+ /** Ensure serial port is accessible without sudo */
256041
+ async ensureSerialAccess(port) {
256042
+ try {
256043
+ execSync34(`test -r ${port} && test -w ${port}`, { timeout: 2e3, stdio: "pipe" });
256044
+ } catch {
256045
+ try {
256046
+ await runElevated(`chmod 666 ${port} && echo 'SUBSYSTEM=="tty", ATTRS{idVendor}=="303a", MODE="0666"' > /etc/udev/rules.d/99-meshtastic.rules && udevadm control --reload-rules`, { timeout: 3e4, description: "Open Agents needs serial port access for Meshtastic" });
256047
+ } catch {
256048
+ }
256049
+ }
256050
+ }
256051
+ findMeshtasticPort() {
256052
+ for (const dev of ["/dev/ttyACM0", "/dev/ttyACM1", "/dev/ttyUSB0", "/dev/ttyUSB1"]) {
256053
+ if (!existsSync32(dev))
256054
+ continue;
256055
+ try {
256056
+ const udev = execSync34(`udevadm info --query=all --name=${dev} 2>/dev/null`, { encoding: "utf8", timeout: 3e3 });
256057
+ if (/heltec|meshtastic|t-beam|espressif|rak|wisblock/i.test(udev)) {
256058
+ return dev;
256059
+ }
256060
+ } catch {
256061
+ }
256062
+ }
256063
+ for (const dev of ["/dev/ttyACM0", "/dev/ttyUSB0"]) {
256064
+ if (existsSync32(dev))
256065
+ return dev;
256066
+ }
256067
+ return null;
256068
+ }
256069
+ /** Auto-install meshtastic CLI into a venv */
256070
+ async ensureMeshtasticCli() {
256071
+ if (existsSync32(MESH_CLI))
256072
+ return true;
256073
+ try {
256074
+ execSync34(`python3 -m venv ${MESH_VENV} && ${MESH_VENV}/bin/pip install meshtastic`, {
256075
+ timeout: 12e4,
256076
+ stdio: "pipe"
256077
+ });
256078
+ return existsSync32(MESH_CLI);
256079
+ } catch {
256080
+ return false;
256081
+ }
256082
+ }
256083
+ };
256084
+ }
256085
+ });
256086
+
255893
256087
  // packages/execution/dist/tools/full-sub-agent.js
255894
256088
  import { spawn as spawn13, ChildProcess } from "node:child_process";
255895
256089
  import { randomBytes as randomBytes13 } from "node:crypto";
@@ -256334,8 +256528,8 @@ var init_agent_tool = __esm({
256334
256528
  });
256335
256529
 
256336
256530
  // packages/execution/dist/tools/worktree.js
256337
- import { execSync as execSync34 } from "node:child_process";
256338
- import { existsSync as existsSync32, mkdirSync as mkdirSync13, rmSync } from "node:fs";
256531
+ import { execSync as execSync35 } from "node:child_process";
256532
+ import { existsSync as existsSync33, mkdirSync as mkdirSync13, rmSync } from "node:fs";
256339
256533
  import { join as join47, resolve as resolve30 } from "node:path";
256340
256534
  function validateSlug(slug) {
256341
256535
  if (!slug)
@@ -256353,7 +256547,7 @@ function flattenSlug(slug) {
256353
256547
  }
256354
256548
  function isGitRepo(cwd4) {
256355
256549
  try {
256356
- execSync34("git rev-parse --is-inside-work-tree", { cwd: cwd4, stdio: "pipe" });
256550
+ execSync35("git rev-parse --is-inside-work-tree", { cwd: cwd4, stdio: "pipe" });
256357
256551
  return true;
256358
256552
  } catch {
256359
256553
  return false;
@@ -256361,14 +256555,14 @@ function isGitRepo(cwd4) {
256361
256555
  }
256362
256556
  function getCurrentBranch(cwd4) {
256363
256557
  try {
256364
- return execSync34("git rev-parse --abbrev-ref HEAD", { cwd: cwd4, stdio: "pipe" }).toString().trim();
256558
+ return execSync35("git rev-parse --abbrev-ref HEAD", { cwd: cwd4, stdio: "pipe" }).toString().trim();
256365
256559
  } catch {
256366
256560
  return void 0;
256367
256561
  }
256368
256562
  }
256369
256563
  function getCurrentCommit(cwd4) {
256370
256564
  try {
256371
- return execSync34("git rev-parse --short HEAD", { cwd: cwd4, stdio: "pipe" }).toString().trim();
256565
+ return execSync35("git rev-parse --short HEAD", { cwd: cwd4, stdio: "pipe" }).toString().trim();
256372
256566
  } catch {
256373
256567
  return void 0;
256374
256568
  }
@@ -256384,7 +256578,7 @@ function createWorktree(repoRoot, slug) {
256384
256578
  const worktreeBase = join47(repoRoot, ".oa", "worktrees");
256385
256579
  const worktreePath = join47(worktreeBase, flat);
256386
256580
  const branchName = `worktree-${flat}`;
256387
- if (existsSync32(worktreePath)) {
256581
+ if (existsSync33(worktreePath)) {
256388
256582
  const session2 = {
256389
256583
  slug,
256390
256584
  worktreePath: resolve30(worktreePath),
@@ -256399,13 +256593,13 @@ function createWorktree(repoRoot, slug) {
256399
256593
  }
256400
256594
  mkdirSync13(worktreeBase, { recursive: true });
256401
256595
  try {
256402
- execSync34(`git worktree add "${worktreePath}" -b "${branchName}"`, {
256596
+ execSync35(`git worktree add "${worktreePath}" -b "${branchName}"`, {
256403
256597
  cwd: repoRoot,
256404
256598
  stdio: "pipe"
256405
256599
  });
256406
256600
  } catch (err) {
256407
256601
  try {
256408
- execSync34(`git worktree add "${worktreePath}" "${branchName}"`, {
256602
+ execSync35(`git worktree add "${worktreePath}" "${branchName}"`, {
256409
256603
  cwd: repoRoot,
256410
256604
  stdio: "pipe"
256411
256605
  });
@@ -256427,7 +256621,7 @@ function createWorktree(repoRoot, slug) {
256427
256621
  }
256428
256622
  function worktreeHasChanges(worktreePath) {
256429
256623
  try {
256430
- const status = execSync34("git status --porcelain", {
256624
+ const status = execSync35("git status --porcelain", {
256431
256625
  cwd: worktreePath,
256432
256626
  stdio: "pipe"
256433
256627
  }).toString().trim();
@@ -256440,7 +256634,7 @@ function removeWorktree(repoRoot, slug, force = false) {
256440
256634
  const flat = flattenSlug(slug);
256441
256635
  const worktreePath = join47(repoRoot, ".oa", "worktrees", flat);
256442
256636
  const branchName = `worktree-${flat}`;
256443
- if (!existsSync32(worktreePath)) {
256637
+ if (!existsSync33(worktreePath)) {
256444
256638
  _sessions.delete(slug);
256445
256639
  return true;
256446
256640
  }
@@ -256448,20 +256642,20 @@ function removeWorktree(repoRoot, slug, force = false) {
256448
256642
  return "Worktree has uncommitted changes. Use force=true to discard, or commit/stash first.";
256449
256643
  }
256450
256644
  try {
256451
- execSync34(`git worktree remove "${worktreePath}" ${force ? "--force" : ""}`, {
256645
+ execSync35(`git worktree remove "${worktreePath}" ${force ? "--force" : ""}`, {
256452
256646
  cwd: repoRoot,
256453
256647
  stdio: "pipe"
256454
256648
  });
256455
256649
  } catch (err) {
256456
256650
  try {
256457
256651
  rmSync(worktreePath, { recursive: true, force: true });
256458
- execSync34("git worktree prune", { cwd: repoRoot, stdio: "pipe" });
256652
+ execSync35("git worktree prune", { cwd: repoRoot, stdio: "pipe" });
256459
256653
  } catch {
256460
256654
  return `Failed to remove worktree: ${err}`;
256461
256655
  }
256462
256656
  }
256463
256657
  try {
256464
- execSync34(`git branch -D "${branchName}"`, { cwd: repoRoot, stdio: "pipe" });
256658
+ execSync35(`git branch -D "${branchName}"`, { cwd: repoRoot, stdio: "pipe" });
256465
256659
  } catch {
256466
256660
  }
256467
256661
  _sessions.delete(slug);
@@ -257112,13 +257306,13 @@ var init_client3 = __esm({
257112
257306
  });
257113
257307
 
257114
257308
  // packages/execution/dist/mcp/manager.js
257115
- import { existsSync as existsSync33, readFileSync as readFileSync24 } from "node:fs";
257309
+ import { existsSync as existsSync34, readFileSync as readFileSync24 } from "node:fs";
257116
257310
  import { join as join48 } from "node:path";
257117
257311
  import { homedir as homedir12 } from "node:os";
257118
257312
  function loadMcpConfig(repoRoot) {
257119
257313
  const servers = {};
257120
257314
  const globalPath = join48(homedir12(), ".open-agents", "mcp.json");
257121
- if (existsSync33(globalPath)) {
257315
+ if (existsSync34(globalPath)) {
257122
257316
  try {
257123
257317
  const global2 = JSON.parse(readFileSync24(globalPath, "utf8"));
257124
257318
  Object.assign(servers, global2.mcpServers ?? {});
@@ -257126,7 +257320,7 @@ function loadMcpConfig(repoRoot) {
257126
257320
  }
257127
257321
  }
257128
257322
  const localPath = join48(repoRoot, ".oa", "mcp.json");
257129
- if (existsSync33(localPath)) {
257323
+ if (existsSync34(localPath)) {
257130
257324
  try {
257131
257325
  const local = JSON.parse(readFileSync24(localPath, "utf8"));
257132
257326
  Object.assign(servers, local.mcpServers ?? {});
@@ -257134,7 +257328,7 @@ function loadMcpConfig(repoRoot) {
257134
257328
  }
257135
257329
  }
257136
257330
  const rootPath = join48(repoRoot, ".mcp.json");
257137
- if (existsSync33(rootPath)) {
257331
+ if (existsSync34(rootPath)) {
257138
257332
  try {
257139
257333
  const root = JSON.parse(readFileSync24(rootPath, "utf8"));
257140
257334
  Object.assign(servers, root.mcpServers ?? {});
@@ -257419,17 +257613,17 @@ var init_mcp = __esm({
257419
257613
  });
257420
257614
 
257421
257615
  // packages/execution/dist/plugins/plugin-system.js
257422
- import { existsSync as existsSync34, readdirSync as readdirSync7, readFileSync as readFileSync25 } from "node:fs";
257616
+ import { existsSync as existsSync35, readdirSync as readdirSync7, readFileSync as readFileSync25 } from "node:fs";
257423
257617
  import { join as join49 } from "node:path";
257424
257618
  import { homedir as homedir13 } from "node:os";
257425
257619
  function discoverPlugins(repoRoot) {
257426
257620
  const plugins = [];
257427
257621
  const globalDir = join49(homedir13(), ".open-agents", "plugins");
257428
- if (existsSync34(globalDir)) {
257622
+ if (existsSync35(globalDir)) {
257429
257623
  plugins.push(...loadPluginsFromDir(globalDir));
257430
257624
  }
257431
257625
  const localDir = join49(repoRoot, ".oa", "plugins");
257432
- if (existsSync34(localDir)) {
257626
+ if (existsSync35(localDir)) {
257433
257627
  plugins.push(...loadPluginsFromDir(localDir));
257434
257628
  }
257435
257629
  return plugins;
@@ -257452,7 +257646,7 @@ function loadPluginsFromDir(dir) {
257452
257646
  }
257453
257647
  function loadPlugin(pluginPath) {
257454
257648
  const oaManifestPath = join49(pluginPath, "oa-plugin.json");
257455
- if (existsSync34(oaManifestPath)) {
257649
+ if (existsSync35(oaManifestPath)) {
257456
257650
  try {
257457
257651
  const manifest = JSON.parse(readFileSync25(oaManifestPath, "utf8"));
257458
257652
  if (!manifest.name || !manifest.oa) {
@@ -257464,7 +257658,7 @@ function loadPlugin(pluginPath) {
257464
257658
  }
257465
257659
  }
257466
257660
  const pkgPath = join49(pluginPath, "package.json");
257467
- if (existsSync34(pkgPath)) {
257661
+ if (existsSync35(pkgPath)) {
257468
257662
  try {
257469
257663
  const pkg = JSON.parse(readFileSync25(pkgPath, "utf8"));
257470
257664
  if (pkg.oa) {
@@ -257525,7 +257719,7 @@ var init_plugin_system = __esm({
257525
257719
  if (skills) {
257526
257720
  for (const relPath of skills) {
257527
257721
  const absPath = join49(plugin.rootPath, relPath);
257528
- if (existsSync34(absPath))
257722
+ if (existsSync35(absPath))
257529
257723
  paths.push(absPath);
257530
257724
  }
257531
257725
  }
@@ -257579,9 +257773,9 @@ var init_plugin_system = __esm({
257579
257773
  });
257580
257774
 
257581
257775
  // packages/execution/dist/tools/notebook-edit.js
257582
- import { readFileSync as readFileSync26, writeFileSync as writeFileSync12, existsSync as existsSync35 } from "node:fs";
257776
+ import { readFileSync as readFileSync26, writeFileSync as writeFileSync12, existsSync as existsSync36 } from "node:fs";
257583
257777
  function readNotebook(path5) {
257584
- if (!existsSync35(path5))
257778
+ if (!existsSync36(path5))
257585
257779
  return `File not found: ${path5}`;
257586
257780
  if (!path5.endsWith(".ipynb"))
257587
257781
  return `Not a notebook file (must be .ipynb): ${path5}`;
@@ -257738,7 +257932,7 @@ var init_notebook_edit = __esm({
257738
257932
  });
257739
257933
 
257740
257934
  // packages/execution/dist/tools/environment-snapshot.js
257741
- import { execSync as execSync35 } from "node:child_process";
257935
+ import { execSync as execSync36 } from "node:child_process";
257742
257936
  import { cpus, totalmem, freemem, hostname as hostname2, platform, arch, uptime } from "node:os";
257743
257937
  import { statfsSync } from "node:fs";
257744
257938
  function collectSnapshot(workingDir) {
@@ -257756,7 +257950,7 @@ function collectSnapshot(workingDir) {
257756
257950
  }
257757
257951
  let gpu = void 0;
257758
257952
  try {
257759
- const nvOut = execSync35("nvidia-smi --query-gpu=name,memory.total,memory.used,temperature.gpu --format=csv,noheader,nounits", { encoding: "utf-8", timeout: 3e3, stdio: ["pipe", "pipe", "pipe"] }).trim().split(",").map((s2) => s2.trim());
257953
+ const nvOut = execSync36("nvidia-smi --query-gpu=name,memory.total,memory.used,temperature.gpu --format=csv,noheader,nounits", { encoding: "utf-8", timeout: 3e3, stdio: ["pipe", "pipe", "pipe"] }).trim().split(",").map((s2) => s2.trim());
257760
257954
  if (nvOut.length >= 3) {
257761
257955
  gpu = {
257762
257956
  name: nvOut[0],
@@ -257771,12 +257965,12 @@ function collectSnapshot(workingDir) {
257771
257965
  let battery = void 0;
257772
257966
  try {
257773
257967
  if (platform() === "linux") {
257774
- const cap = execSync35("cat /sys/class/power_supply/BAT0/capacity 2>/dev/null", { encoding: "utf-8", timeout: 1e3 }).trim();
257775
- const status = execSync35("cat /sys/class/power_supply/BAT0/status 2>/dev/null", { encoding: "utf-8", timeout: 1e3 }).trim();
257968
+ const cap = execSync36("cat /sys/class/power_supply/BAT0/capacity 2>/dev/null", { encoding: "utf-8", timeout: 1e3 }).trim();
257969
+ const status = execSync36("cat /sys/class/power_supply/BAT0/status 2>/dev/null", { encoding: "utf-8", timeout: 1e3 }).trim();
257776
257970
  if (cap)
257777
257971
  battery = { percent: parseInt(cap, 10), charging: status === "Charging" || status === "Full" };
257778
257972
  } else if (platform() === "darwin") {
257779
- const pmOut = execSync35("pmset -g batt", { encoding: "utf-8", timeout: 2e3 });
257973
+ const pmOut = execSync36("pmset -g batt", { encoding: "utf-8", timeout: 2e3 });
257780
257974
  const match = pmOut.match(/(\d+)%;\s*(charging|discharging|charged)/i);
257781
257975
  if (match)
257782
257976
  battery = { percent: parseInt(match[1], 10), charging: match[2].toLowerCase() !== "discharging" };
@@ -257797,8 +257991,8 @@ function collectSnapshot(workingDir) {
257797
257991
  }
257798
257992
  let processInfo = { total: 0, nodeCount: 0, oaSpawned: 0, topCpu: [] };
257799
257993
  try {
257800
- const psLines = execSync35("ps -eo pid,%cpu,args --sort=-%cpu --no-headers 2>/dev/null | head -50", { encoding: "utf-8", timeout: 3e3, stdio: ["pipe", "pipe", "pipe"] }).trim().split("\n");
257801
- const total = parseInt(execSync35("ps aux | wc -l", { encoding: "utf-8", timeout: 2e3 }).trim(), 10);
257994
+ const psLines = execSync36("ps -eo pid,%cpu,args --sort=-%cpu --no-headers 2>/dev/null | head -50", { encoding: "utf-8", timeout: 3e3, stdio: ["pipe", "pipe", "pipe"] }).trim().split("\n");
257995
+ const total = parseInt(execSync36("ps aux | wc -l", { encoding: "utf-8", timeout: 2e3 }).trim(), 10);
257802
257996
  let nodeCount = 0;
257803
257997
  let oaSpawned = 0;
257804
257998
  const topCpu = [];
@@ -257879,8 +258073,8 @@ var init_environment_snapshot = __esm({
257879
258073
  });
257880
258074
 
257881
258075
  // packages/execution/dist/tools/video-understand.js
257882
- import { execSync as execSync36 } from "node:child_process";
257883
- import { existsSync as existsSync36, mkdirSync as mkdirSync14, writeFileSync as writeFileSync13, readFileSync as readFileSync27, readdirSync as readdirSync8, unlinkSync as unlinkSync8 } from "node:fs";
258076
+ import { execSync as execSync37 } from "node:child_process";
258077
+ import { existsSync as existsSync37, mkdirSync as mkdirSync14, writeFileSync as writeFileSync13, readFileSync as readFileSync27, readdirSync as readdirSync8, unlinkSync as unlinkSync8 } from "node:fs";
257884
258078
  import { join as join50, basename as basename11 } from "node:path";
257885
258079
  import { createHash as createHash2 } from "node:crypto";
257886
258080
  function isYouTubeUrl2(url) {
@@ -257888,11 +258082,11 @@ function isYouTubeUrl2(url) {
257888
258082
  }
257889
258083
  function ensureYtDlp2() {
257890
258084
  try {
257891
- execSync36("yt-dlp --version", { timeout: 5e3, stdio: "pipe" });
258085
+ execSync37("yt-dlp --version", { timeout: 5e3, stdio: "pipe" });
257892
258086
  return true;
257893
258087
  } catch {
257894
258088
  try {
257895
- execSync36("pip3 install --break-system-packages yt-dlp 2>/dev/null || pip3 install --user yt-dlp 2>/dev/null", { timeout: 6e4, stdio: "pipe" });
258089
+ execSync37("pip3 install --break-system-packages yt-dlp 2>/dev/null || pip3 install --user yt-dlp 2>/dev/null", { timeout: 6e4, stdio: "pipe" });
257896
258090
  return true;
257897
258091
  } catch {
257898
258092
  return false;
@@ -257901,7 +258095,7 @@ function ensureYtDlp2() {
257901
258095
  }
257902
258096
  function ensureFfmpeg() {
257903
258097
  try {
257904
- execSync36("ffmpeg -version", { timeout: 3e3, stdio: "pipe" });
258098
+ execSync37("ffmpeg -version", { timeout: 3e3, stdio: "pipe" });
257905
258099
  return true;
257906
258100
  } catch {
257907
258101
  return false;
@@ -257981,32 +258175,32 @@ var init_video_understand = __esm({
257981
258175
  return { success: false, output: "", error: "yt-dlp required but not available. Install: pip3 install yt-dlp", durationMs: performance.now() - start2 };
257982
258176
  }
257983
258177
  try {
257984
- execSync36(`yt-dlp -f "worst[ext=mp4]" -o "${join50(tmpDir, "video.%(ext)s")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
258178
+ execSync37(`yt-dlp -f "worst[ext=mp4]" -o "${join50(tmpDir, "video.%(ext)s")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
257985
258179
  } catch {
257986
- execSync36(`yt-dlp -f worst -o "${join50(tmpDir, "video.%(ext)s")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
258180
+ execSync37(`yt-dlp -f worst -o "${join50(tmpDir, "video.%(ext)s")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
257987
258181
  }
257988
- execSync36(`yt-dlp -x --audio-format mp3 --audio-quality 5 -o "${join50(tmpDir, "audio.%(ext)s")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
258182
+ execSync37(`yt-dlp -x --audio-format mp3 --audio-quality 5 -o "${join50(tmpDir, "audio.%(ext)s")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
257989
258183
  try {
257990
- title = execSync36(`yt-dlp --get-title "${url}"`, { encoding: "utf-8", timeout: 15e3, stdio: ["pipe", "pipe", "pipe"] }).trim();
258184
+ title = execSync37(`yt-dlp --get-title "${url}"`, { encoding: "utf-8", timeout: 15e3, stdio: ["pipe", "pipe", "pipe"] }).trim();
257991
258185
  } catch {
257992
258186
  }
257993
258187
  } else {
257994
- execSync36(`curl -sL -o "${join50(tmpDir, "video.mp4")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
257995
- execSync36(`ffmpeg -i "${join50(tmpDir, "video.mp4")}" -vn -acodec libmp3lame -q:a 5 "${join50(tmpDir, "audio.mp3")}" -y`, { timeout: 12e4, stdio: "pipe" });
258188
+ execSync37(`curl -sL -o "${join50(tmpDir, "video.mp4")}" "${url}"`, { timeout: 3e5, stdio: "pipe" });
258189
+ execSync37(`ffmpeg -i "${join50(tmpDir, "video.mp4")}" -vn -acodec libmp3lame -q:a 5 "${join50(tmpDir, "audio.mp3")}" -y`, { timeout: 12e4, stdio: "pipe" });
257996
258190
  }
257997
258191
  videoPath = readdirSync8(tmpDir).find((f2) => f2.startsWith("video")) ? join50(tmpDir, readdirSync8(tmpDir).find((f2) => f2.startsWith("video"))) : join50(tmpDir, "video.mp4");
257998
258192
  audioPath = readdirSync8(tmpDir).find((f2) => f2.startsWith("audio")) ? join50(tmpDir, readdirSync8(tmpDir).find((f2) => f2.startsWith("audio"))) : join50(tmpDir, "audio.mp3");
257999
258193
  } else {
258000
258194
  videoPath = localPath;
258001
258195
  audioPath = join50(tmpDir, "audio.mp3");
258002
- execSync36(`ffmpeg -i "${videoPath}" -vn -acodec libmp3lame -q:a 5 "${audioPath}" -y`, { timeout: 12e4, stdio: "pipe" });
258196
+ execSync37(`ffmpeg -i "${videoPath}" -vn -acodec libmp3lame -q:a 5 "${audioPath}" -y`, { timeout: 12e4, stdio: "pipe" });
258003
258197
  }
258004
258198
  let segments = [];
258005
258199
  let language = "en";
258006
258200
  let duration = 0;
258007
258201
  try {
258008
258202
  const jsonOut = join50(tmpDir, "transcript.json");
258009
- execSync36(`transcribe-cli transcribe "${audioPath}" --model ${whisperModel} --format json -o "${tmpDir}"`, { timeout: 6e5, stdio: "pipe" });
258203
+ execSync37(`transcribe-cli transcribe "${audioPath}" --model ${whisperModel} --format json -o "${tmpDir}"`, { timeout: 6e5, stdio: "pipe" });
258010
258204
  const jsonFile = readdirSync8(tmpDir).find((f2) => f2.endsWith(".json") && f2 !== "result.json");
258011
258205
  if (jsonFile) {
258012
258206
  const data = JSON.parse(readFileSync27(join50(tmpDir, jsonFile), "utf-8"));
@@ -258023,13 +258217,13 @@ var init_video_understand = __esm({
258023
258217
  segments = [];
258024
258218
  }
258025
258219
  let frames = [];
258026
- if (!skipFrames && ensureFfmpeg() && existsSync36(videoPath)) {
258220
+ if (!skipFrames && ensureFfmpeg() && existsSync37(videoPath)) {
258027
258221
  const framesDir = join50(tmpDir, "frames");
258028
258222
  mkdirSync14(framesDir, { recursive: true });
258029
258223
  const fps = 25;
258030
258224
  const intervalFrames = Math.max(1, frameInterval * fps);
258031
258225
  try {
258032
- execSync36(`ffmpeg -i "${videoPath}" -vf "select='gt(scene\\,${sceneThreshold})+not(mod(n\\,${intervalFrames}))',showinfo" -vsync vfr "${join50(framesDir, "frame_%04d.jpg")}" -y`, { timeout: 3e5, stdio: "pipe" });
258226
+ execSync37(`ffmpeg -i "${videoPath}" -vf "select='gt(scene\\,${sceneThreshold})+not(mod(n\\,${intervalFrames}))',showinfo" -vsync vfr "${join50(framesDir, "frame_%04d.jpg")}" -y`, { timeout: 3e5, stdio: "pipe" });
258033
258227
  } catch {
258034
258228
  }
258035
258229
  const frameFiles = readdirSync8(framesDir).filter((f2) => f2.endsWith(".jpg")).sort();
@@ -258162,7 +258356,7 @@ Topic: ${segments.slice(0, 5).map((s2) => s2.text).join(" ").slice(0, 300)}`,
258162
258356
  }
258163
258357
  }
258164
258358
  try {
258165
- execSync36(`rm -rf "${tmpDir}"`, { timeout: 1e4, stdio: "pipe" });
258359
+ execSync37(`rm -rf "${tmpDir}"`, { timeout: 1e4, stdio: "pipe" });
258166
258360
  } catch {
258167
258361
  }
258168
258362
  return {
@@ -258206,11 +258400,11 @@ var init_venv_paths = __esm({
258206
258400
  });
258207
258401
 
258208
258402
  // packages/execution/dist/tools/fortemi-bridge.js
258209
- import { existsSync as existsSync37, readFileSync as readFileSync28 } from "node:fs";
258403
+ import { existsSync as existsSync38, readFileSync as readFileSync28 } from "node:fs";
258210
258404
  import { join as join52 } from "node:path";
258211
258405
  function loadBridgeState(repoRoot) {
258212
258406
  const bridgeFile = join52(repoRoot, ".oa", "fortemi-bridge.json");
258213
- if (!existsSync37(bridgeFile))
258407
+ if (!existsSync38(bridgeFile))
258214
258408
  return null;
258215
258409
  try {
258216
258410
  return JSON.parse(readFileSync28(bridgeFile, "utf8"));
@@ -258461,7 +258655,7 @@ var init_gitWorktree = __esm({
258461
258655
  });
258462
258656
 
258463
258657
  // packages/execution/dist/patchApplier.js
258464
- import { readFileSync as readFileSync29, writeFileSync as writeFileSync14, existsSync as existsSync38, mkdirSync as mkdirSync15 } from "node:fs";
258658
+ import { readFileSync as readFileSync29, writeFileSync as writeFileSync14, existsSync as existsSync39, mkdirSync as mkdirSync15 } from "node:fs";
258465
258659
  import { dirname as dirname14 } from "node:path";
258466
258660
  import { spawn as spawn16 } from "node:child_process";
258467
258661
  async function applyPatch(patch) {
@@ -258488,7 +258682,7 @@ function applyRewrite(patch) {
258488
258682
  writeFileSync14(patch.filePath, patch.newContent, "utf-8");
258489
258683
  }
258490
258684
  function applyNewFile(patch) {
258491
- if (existsSync38(patch.filePath)) {
258685
+ if (existsSync39(patch.filePath)) {
258492
258686
  throw new Error(`Cannot create new file: "${patch.filePath}" already exists.`);
258493
258687
  }
258494
258688
  mkdirSync15(dirname14(patch.filePath), { recursive: true });
@@ -258849,7 +259043,7 @@ var init_buildRunner = __esm({
258849
259043
  });
258850
259044
 
258851
259045
  // packages/execution/dist/constraints.js
258852
- import { existsSync as existsSync39, readFileSync as readFileSync30, writeFileSync as writeFileSync15, mkdirSync as mkdirSync16 } from "node:fs";
259046
+ import { existsSync as existsSync40, readFileSync as readFileSync30, writeFileSync as writeFileSync15, mkdirSync as mkdirSync16 } from "node:fs";
258853
259047
  import { join as join53 } from "node:path";
258854
259048
  import { homedir as homedir14 } from "node:os";
258855
259049
  function loadConstraints(projectRoot) {
@@ -258858,7 +259052,7 @@ function loadConstraints(projectRoot) {
258858
259052
  }
258859
259053
  function loadFile(path5) {
258860
259054
  try {
258861
- if (!existsSync39(path5))
259055
+ if (!existsSync40(path5))
258862
259056
  return [];
258863
259057
  const data = JSON.parse(readFileSync30(path5, "utf-8"));
258864
259058
  return data.constraints || [];
@@ -258875,7 +259069,7 @@ function addProjectConstraint(projectRoot, constraint) {
258875
259069
  const path5 = join53(projectRoot, ".oa", "constraints.json");
258876
259070
  let data = { version: 1, constraints: [] };
258877
259071
  try {
258878
- if (existsSync39(path5))
259072
+ if (existsSync40(path5))
258879
259073
  data = JSON.parse(readFileSync30(path5, "utf-8"));
258880
259074
  } catch {
258881
259075
  }
@@ -259097,6 +259291,7 @@ __export(dist_exports, {
259097
259291
  MemoryReadTool: () => MemoryReadTool,
259098
259292
  MemorySearchTool: () => MemorySearchTool,
259099
259293
  MemoryWriteTool: () => MemoryWriteTool,
259294
+ MeshtasticTool: () => MeshtasticTool,
259100
259295
  NexusTool: () => NexusTool,
259101
259296
  NotebookEditTool: () => NotebookEditTool,
259102
259297
  OCRTool: () => OCRTool,
@@ -259300,6 +259495,7 @@ var init_dist4 = __esm({
259300
259495
  init_bluetooth_scan();
259301
259496
  init_sdr_scan();
259302
259497
  init_flipper_zero();
259498
+ init_meshtastic_tool();
259303
259499
  init_system_auth();
259304
259500
  init_full_sub_agent();
259305
259501
  init_agent_tool();
@@ -259999,14 +260195,14 @@ var init_dist5 = __esm({
259999
260195
  });
260000
260196
 
260001
260197
  // packages/orchestrator/dist/promptLoader.js
260002
- import { readFileSync as readFileSync31, existsSync as existsSync40 } from "node:fs";
260198
+ import { readFileSync as readFileSync31, existsSync as existsSync41 } from "node:fs";
260003
260199
  import { join as join54, dirname as dirname15 } from "node:path";
260004
260200
  import { fileURLToPath as fileURLToPath8 } from "node:url";
260005
260201
  function loadPrompt(promptPath, vars) {
260006
260202
  let content = cache4.get(promptPath);
260007
260203
  if (content === void 0) {
260008
260204
  const fullPath = join54(PROMPTS_DIR, promptPath);
260009
- if (!existsSync40(fullPath)) {
260205
+ if (!existsSync41(fullPath)) {
260010
260206
  throw new Error(`Prompt file not found: ${fullPath}`);
260011
260207
  }
260012
260208
  content = readFileSync31(fullPath, "utf-8");
@@ -262204,12 +262400,12 @@ var init_tool_batching = __esm({
262204
262400
  });
262205
262401
 
262206
262402
  // packages/orchestrator/dist/hooks.js
262207
- import { execSync as execSync37 } from "node:child_process";
262403
+ import { execSync as execSync38 } from "node:child_process";
262208
262404
  function executeHook(hook, env2 = {}) {
262209
262405
  const start2 = performance.now();
262210
262406
  const timeout2 = hook.timeoutMs ?? DEFAULT_HOOK_TIMEOUT;
262211
262407
  try {
262212
- const output = execSync37(hook.command, {
262408
+ const output = execSync38(hook.command, {
262213
262409
  timeout: timeout2,
262214
262410
  env: { ...process.env, ...env2 },
262215
262411
  encoding: "utf8",
@@ -266433,7 +266629,7 @@ ${result}`
266433
266629
  const buffer2 = Buffer.from(rawBase64, "base64");
266434
266630
  let resizedBase64 = null;
266435
266631
  try {
266436
- const { execSync: execSync50 } = await import("node:child_process");
266632
+ const { execSync: execSync51 } = await import("node:child_process");
266437
266633
  const { writeFileSync: writeFileSync38, readFileSync: readFileSync57, unlinkSync: unlinkSync18 } = await import("node:fs");
266438
266634
  const { join: join92 } = await import("node:path");
266439
266635
  const { tmpdir: tmpdir15 } = await import("node:os");
@@ -266443,7 +266639,7 @@ ${result}`
266443
266639
  const pyBin = process.platform === "win32" ? "python" : "python3";
266444
266640
  const escapedIn = tmpIn.replace(/\\/g, "\\\\");
266445
266641
  const escapedOut = tmpOut.replace(/\\/g, "\\\\");
266446
- execSync50(`${pyBin} -c "from PIL import Image; img = Image.open('${escapedIn}'); img.thumbnail((512, 512), Image.LANCZOS); img = img.convert('RGB'); img.save('${escapedOut}', 'JPEG', quality=75)"`, { timeout: 1e4, stdio: "pipe" });
266642
+ execSync51(`${pyBin} -c "from PIL import Image; img = Image.open('${escapedIn}'); img.thumbnail((512, 512), Image.LANCZOS); img = img.convert('RGB'); img.save('${escapedOut}', 'JPEG', quality=75)"`, { timeout: 1e4, stdio: "pipe" });
266447
266643
  const resizedBuf = readFileSync57(tmpOut);
266448
266644
  resizedBase64 = `data:image/jpeg;base64,${resizedBuf.toString("base64")}`;
266449
266645
  try {
@@ -266497,8 +266693,8 @@ ${result}`
266497
266693
  if (!res.ok && model === "moondream" && res.status === 404) {
266498
266694
  this.emit({ type: "status", content: `Pulling moondream vision model...`, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
266499
266695
  try {
266500
- const { execSync: execSync50 } = await import("node:child_process");
266501
- execSync50("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
266696
+ const { execSync: execSync51 } = await import("node:child_process");
266697
+ execSync51("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
266502
266698
  res = await fetch(`${ollamaHost}/api/generate`, {
266503
266699
  method: "POST",
266504
266700
  headers: { "Content-Type": "application/json" },
@@ -267064,7 +267260,7 @@ var init_constraint_learner = __esm({
267064
267260
  });
267065
267261
 
267066
267262
  // packages/orchestrator/dist/nexusBackend.js
267067
- import { existsSync as existsSync41, statSync as statSync14, openSync, readSync, closeSync, unlinkSync as unlinkSync9, writeFileSync as writeFileSync16 } from "node:fs";
267263
+ import { existsSync as existsSync42, statSync as statSync14, openSync, readSync, closeSync, unlinkSync as unlinkSync9, writeFileSync as writeFileSync16 } from "node:fs";
267068
267264
  import { watch as fsWatch } from "node:fs";
267069
267265
  import { join as join57 } from "node:path";
267070
267266
  import { tmpdir as tmpdir11 } from "node:os";
@@ -268862,8 +269058,8 @@ __export(listen_exports, {
268862
269058
  isVideoPath: () => isVideoPath,
268863
269059
  waitForTranscribeCli: () => waitForTranscribeCli
268864
269060
  });
268865
- import { spawn as spawn17, execSync as execSync38 } from "node:child_process";
268866
- import { existsSync as existsSync42, mkdirSync as mkdirSync17, writeFileSync as writeFileSync17, readdirSync as readdirSync9 } from "node:fs";
269061
+ import { spawn as spawn17, execSync as execSync39 } from "node:child_process";
269062
+ import { existsSync as existsSync43, mkdirSync as mkdirSync17, writeFileSync as writeFileSync17, readdirSync as readdirSync9 } from "node:fs";
268867
269063
  import { join as join58, dirname as dirname16 } from "node:path";
268868
269064
  import { homedir as homedir15 } from "node:os";
268869
269065
  import { fileURLToPath as fileURLToPath9 } from "node:url";
@@ -268884,7 +269080,7 @@ function findMicCaptureCommand() {
268884
269080
  const platform6 = process.platform;
268885
269081
  if (platform6 === "linux") {
268886
269082
  try {
268887
- execSync38("which arecord", { stdio: "pipe" });
269083
+ execSync39("which arecord", { stdio: "pipe" });
268888
269084
  return {
268889
269085
  cmd: "arecord",
268890
269086
  args: ["-f", "S16_LE", "-r", "16000", "-c", "1", "-t", "raw", "-q", "-"]
@@ -268894,7 +269090,7 @@ function findMicCaptureCommand() {
268894
269090
  }
268895
269091
  if (platform6 === "darwin") {
268896
269092
  try {
268897
- execSync38("which sox", { stdio: "pipe" });
269093
+ execSync39("which sox", { stdio: "pipe" });
268898
269094
  return {
268899
269095
  cmd: "sox",
268900
269096
  args: ["-d", "-t", "raw", "-r", "16000", "-c", "1", "-b", "16", "-e", "signed-integer", "-"]
@@ -268903,7 +269099,7 @@ function findMicCaptureCommand() {
268903
269099
  }
268904
269100
  }
268905
269101
  try {
268906
- execSync38("which ffmpeg", { stdio: "pipe" });
269102
+ execSync39("which ffmpeg", { stdio: "pipe" });
268907
269103
  if (platform6 === "linux") {
268908
269104
  return {
268909
269105
  cmd: "ffmpeg",
@@ -268958,10 +269154,10 @@ function findLiveWhisperScript() {
268958
269154
  join58(thisDir, "../../scripts/live-whisper.py")
268959
269155
  ];
268960
269156
  for (const p2 of candidates) {
268961
- if (existsSync42(p2)) return p2;
269157
+ if (existsSync43(p2)) return p2;
268962
269158
  }
268963
269159
  try {
268964
- const globalRoot = execSync38("npm root -g", {
269160
+ const globalRoot = execSync39("npm root -g", {
268965
269161
  encoding: "utf-8",
268966
269162
  timeout: 5e3,
268967
269163
  stdio: ["pipe", "pipe", "pipe"]
@@ -268971,16 +269167,16 @@ function findLiveWhisperScript() {
268971
269167
  join58(globalRoot, "open-agents-ai", "scripts", "live-whisper.py")
268972
269168
  ];
268973
269169
  for (const p2 of candidates2) {
268974
- if (existsSync42(p2)) return p2;
269170
+ if (existsSync43(p2)) return p2;
268975
269171
  }
268976
269172
  } catch {
268977
269173
  }
268978
269174
  const nvmBase = join58(homedir15(), ".nvm", "versions", "node");
268979
- if (existsSync42(nvmBase)) {
269175
+ if (existsSync43(nvmBase)) {
268980
269176
  try {
268981
269177
  for (const ver of readdirSync9(nvmBase)) {
268982
269178
  const p2 = join58(nvmBase, ver, "lib", "node_modules", "open-agents-ai", "dist", "scripts", "live-whisper.py");
268983
- if (existsSync42(p2)) return p2;
269179
+ if (existsSync43(p2)) return p2;
268984
269180
  }
268985
269181
  } catch {
268986
269182
  }
@@ -268991,12 +269187,12 @@ function ensureTranscribeCliBackground() {
268991
269187
  if (_bgInstallPromise) return;
268992
269188
  _bgInstallPromise = (async () => {
268993
269189
  try {
268994
- const globalRoot = execSync38("npm root -g", {
269190
+ const globalRoot = execSync39("npm root -g", {
268995
269191
  encoding: "utf-8",
268996
269192
  timeout: 5e3,
268997
269193
  stdio: ["pipe", "pipe", "pipe"]
268998
269194
  }).trim();
268999
- if (existsSync42(join58(globalRoot, "transcribe-cli", "dist", "index.js"))) {
269195
+ if (existsSync43(join58(globalRoot, "transcribe-cli", "dist", "index.js"))) {
269000
269196
  return true;
269001
269197
  }
269002
269198
  } catch {
@@ -269193,7 +269389,7 @@ var init_listen = __esm({
269193
269389
  }
269194
269390
  if (!this.transcribeCliAvailable) {
269195
269391
  try {
269196
- execSync38("which transcribe-cli", { stdio: "pipe" });
269392
+ execSync39("which transcribe-cli", { stdio: "pipe" });
269197
269393
  this.transcribeCliAvailable = true;
269198
269394
  } catch {
269199
269395
  this.transcribeCliAvailable = false;
@@ -269210,13 +269406,13 @@ var init_listen = __esm({
269210
269406
  } catch {
269211
269407
  }
269212
269408
  try {
269213
- const globalRoot = execSync38("npm root -g", {
269409
+ const globalRoot = execSync39("npm root -g", {
269214
269410
  encoding: "utf-8",
269215
269411
  timeout: 5e3,
269216
269412
  stdio: ["pipe", "pipe", "pipe"]
269217
269413
  }).trim();
269218
269414
  const tcPath = join58(globalRoot, "transcribe-cli");
269219
- if (existsSync42(join58(tcPath, "dist", "index.js"))) {
269415
+ if (existsSync43(join58(tcPath, "dist", "index.js"))) {
269220
269416
  const { createRequire: createRequire7 } = await import("node:module");
269221
269417
  const req2 = createRequire7(import.meta.url);
269222
269418
  return req2(join58(tcPath, "dist", "index.js"));
@@ -269224,12 +269420,12 @@ var init_listen = __esm({
269224
269420
  } catch {
269225
269421
  }
269226
269422
  const nvmBase = join58(homedir15(), ".nvm", "versions", "node");
269227
- if (existsSync42(nvmBase)) {
269423
+ if (existsSync43(nvmBase)) {
269228
269424
  try {
269229
269425
  const { readdirSync: readdirSync26 } = await import("node:fs");
269230
269426
  for (const ver of readdirSync26(nvmBase)) {
269231
269427
  const tcPath = join58(nvmBase, ver, "lib", "node_modules", "transcribe-cli");
269232
- if (existsSync42(join58(tcPath, "dist", "index.js"))) {
269428
+ if (existsSync43(join58(tcPath, "dist", "index.js"))) {
269233
269429
  const { createRequire: createRequire7 } = await import("node:module");
269234
269430
  const req2 = createRequire7(import.meta.url);
269235
269431
  return req2(join58(tcPath, "dist", "index.js"));
@@ -269259,7 +269455,7 @@ var init_listen = __esm({
269259
269455
  }
269260
269456
  if (!tc) {
269261
269457
  try {
269262
- execSync38("npm i -g transcribe-cli", { stdio: "pipe", timeout: 18e4 });
269458
+ execSync39("npm i -g transcribe-cli", { stdio: "pipe", timeout: 18e4 });
269263
269459
  this.transcribeCliAvailable = null;
269264
269460
  tc = await this.loadTranscribeCli();
269265
269461
  } catch {
@@ -269437,7 +269633,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
269437
269633
  }
269438
269634
  if (!tc) {
269439
269635
  try {
269440
- execSync38("npm i -g transcribe-cli", { stdio: "pipe", timeout: 18e4 });
269636
+ execSync39("npm i -g transcribe-cli", { stdio: "pipe", timeout: 18e4 });
269441
269637
  this.transcribeCliAvailable = null;
269442
269638
  tc = await this.loadTranscribeCli();
269443
269639
  } catch {
@@ -269490,7 +269686,7 @@ transcribe-cli error: ${transcribeCliError}` : "";
269490
269686
  }
269491
269687
  if (!tc) {
269492
269688
  try {
269493
- execSync38("npm i -g transcribe-cli", { stdio: "pipe", timeout: 18e4 });
269689
+ execSync39("npm i -g transcribe-cli", { stdio: "pipe", timeout: 18e4 });
269494
269690
  this.transcribeCliAvailable = null;
269495
269691
  tc = await this.loadTranscribeCli();
269496
269692
  } catch {
@@ -274412,7 +274608,7 @@ var init_render = __esm({
274412
274608
 
274413
274609
  // packages/cli/src/tui/voice-session.ts
274414
274610
  import { createServer as createServer3 } from "node:http";
274415
- import { spawn as spawn18, execSync as execSync39 } from "node:child_process";
274611
+ import { spawn as spawn18, execSync as execSync40 } from "node:child_process";
274416
274612
  import { EventEmitter as EventEmitter4 } from "node:events";
274417
274613
  function generateFrontendHTML() {
274418
274614
  return `<!DOCTYPE html>
@@ -275535,7 +275731,7 @@ import { EventEmitter as EventEmitter5 } from "node:events";
275535
275731
  import { randomBytes as randomBytes15 } from "node:crypto";
275536
275732
  import { URL as URL2 } from "node:url";
275537
275733
  import { loadavg, cpus as cpus2, totalmem as totalmem2, freemem as freemem2 } from "node:os";
275538
- import { existsSync as existsSync43, readFileSync as readFileSync32, writeFileSync as writeFileSync18, unlinkSync as unlinkSync10, mkdirSync as mkdirSync18, readdirSync as readdirSync10, statSync as statSync15 } from "node:fs";
275734
+ import { existsSync as existsSync44, readFileSync as readFileSync32, writeFileSync as writeFileSync18, unlinkSync as unlinkSync10, mkdirSync as mkdirSync18, readdirSync as readdirSync10, statSync as statSync15 } from "node:fs";
275539
275735
  import { join as join59 } from "node:path";
275540
275736
  function cleanForwardHeaders(raw, targetHost) {
275541
275737
  const out = {};
@@ -275558,7 +275754,7 @@ function fmtTokens(n2) {
275558
275754
  function readExposeState(stateDir) {
275559
275755
  try {
275560
275756
  const path5 = join59(stateDir, STATE_FILE_NAME);
275561
- if (!existsSync43(path5)) return null;
275757
+ if (!existsSync44(path5)) return null;
275562
275758
  const raw = readFileSync32(path5, "utf8");
275563
275759
  const data = JSON.parse(raw);
275564
275760
  if (!data.pid || !data.tunnelUrl || !data.authKey || !data.proxyPort) return null;
@@ -275674,7 +275870,7 @@ async function collectSystemMetricsAsync() {
275674
275870
  function readP2PExposeState(stateDir) {
275675
275871
  try {
275676
275872
  const path5 = join59(stateDir, P2P_STATE_FILE_NAME);
275677
- if (!existsSync43(path5)) return null;
275873
+ if (!existsSync44(path5)) return null;
275678
275874
  const raw = readFileSync32(path5, "utf8");
275679
275875
  const data = JSON.parse(raw);
275680
275876
  if (!data.peerId || !data.authKey) return null;
@@ -276717,7 +276913,7 @@ ${this.formatConnectionInfo()}`);
276717
276913
  }
276718
276914
  try {
276719
276915
  const invocDir = join59(nexusDir, "invocations");
276720
- if (existsSync43(invocDir)) {
276916
+ if (existsSync44(invocDir)) {
276721
276917
  this._prevInvocCount = readdirSync10(invocDir).filter((f2) => f2.endsWith(".json")).length;
276722
276918
  this._stats.totalRequests = this._prevInvocCount;
276723
276919
  }
@@ -276746,7 +276942,7 @@ ${this.formatConnectionInfo()}`);
276746
276942
  const nexusDir = nexusTool.getNexusDir();
276747
276943
  const statusPath = join59(nexusDir, "status.json");
276748
276944
  try {
276749
- if (!existsSync43(statusPath)) {
276945
+ if (!existsSync44(statusPath)) {
276750
276946
  removeP2PExposeState(stateDir);
276751
276947
  return null;
276752
276948
  }
@@ -276804,7 +277000,7 @@ ${this.formatConnectionInfo()}`);
276804
277000
  this._activityPollTimer = setInterval(() => {
276805
277001
  try {
276806
277002
  const invocDir = join59(nexusDir, "invocations");
276807
- if (!existsSync43(invocDir)) return;
277003
+ if (!existsSync44(invocDir)) return;
276808
277004
  const files = readdirSync10(invocDir).filter((f2) => f2.endsWith(".json"));
276809
277005
  const invocCount = files.length;
276810
277006
  const newRequests = invocCount - this._prevInvocCount;
@@ -276826,7 +277022,7 @@ ${this.formatConnectionInfo()}`);
276826
277022
  const meteringFile = join59(nexusDir, "metering.jsonl");
276827
277023
  let meteringLines = lastMeteringLineCount;
276828
277024
  try {
276829
- if (existsSync43(meteringFile)) {
277025
+ if (existsSync44(meteringFile)) {
276830
277026
  const content = readFileSync32(meteringFile, "utf8");
276831
277027
  meteringLines = content.split("\n").filter((l2) => l2.trim()).length;
276832
277028
  }
@@ -276853,7 +277049,7 @@ ${this.formatConnectionInfo()}`);
276853
277049
  this._pollTimer = setInterval(() => {
276854
277050
  try {
276855
277051
  const statusPath = join59(nexusDir, "status.json");
276856
- if (existsSync43(statusPath)) {
277052
+ if (existsSync44(statusPath)) {
276857
277053
  const status = JSON.parse(readFileSync32(statusPath, "utf8"));
276858
277054
  if (status.peerId && !this._peerId) {
276859
277055
  this._peerId = status.peerId;
@@ -276864,7 +277060,7 @@ ${this.formatConnectionInfo()}`);
276864
277060
  }
276865
277061
  try {
276866
277062
  const invocDir = join59(nexusDir, "invocations");
276867
- if (existsSync43(invocDir)) {
277063
+ if (existsSync44(invocDir)) {
276868
277064
  const files = readdirSync10(invocDir);
276869
277065
  const invocCount = files.filter((f2) => f2.endsWith(".json")).length;
276870
277066
  if (invocCount > this._stats.totalRequests) {
@@ -276876,7 +277072,7 @@ ${this.formatConnectionInfo()}`);
276876
277072
  }
276877
277073
  try {
276878
277074
  const meteringFile = join59(nexusDir, "metering.jsonl");
276879
- if (existsSync43(meteringFile)) {
277075
+ if (existsSync44(meteringFile)) {
276880
277076
  const content = readFileSync32(meteringFile, "utf8");
276881
277077
  if (content.length > lastMeteringSize) {
276882
277078
  const newContent = content.slice(lastMeteringSize);
@@ -277088,7 +277284,7 @@ var init_types = __esm({
277088
277284
 
277089
277285
  // packages/cli/src/tui/p2p/secret-vault.ts
277090
277286
  import { createCipheriv as createCipheriv2, createDecipheriv as createDecipheriv2, randomBytes as randomBytes16, scryptSync as scryptSync2, createHash as createHash3 } from "node:crypto";
277091
- import { readFileSync as readFileSync33, writeFileSync as writeFileSync19, existsSync as existsSync44, mkdirSync as mkdirSync19 } from "node:fs";
277287
+ import { readFileSync as readFileSync33, writeFileSync as writeFileSync19, existsSync as existsSync45, mkdirSync as mkdirSync19 } from "node:fs";
277092
277288
  import { dirname as dirname17 } from "node:path";
277093
277289
  var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
277094
277290
  var init_secret_vault = __esm({
@@ -277296,7 +277492,7 @@ var init_secret_vault = __esm({
277296
277492
  const tag = cipher.getAuthTag();
277297
277493
  const blob = Buffer.concat([salt, iv, tag, encrypted]);
277298
277494
  const dir = dirname17(this.storePath);
277299
- if (!existsSync44(dir)) mkdirSync19(dir, { recursive: true });
277495
+ if (!existsSync45(dir)) mkdirSync19(dir, { recursive: true });
277300
277496
  writeFileSync19(this.storePath, blob, { mode: 384 });
277301
277497
  }
277302
277498
  /**
@@ -277304,7 +277500,7 @@ var init_secret_vault = __esm({
277304
277500
  * Returns the number of secrets loaded.
277305
277501
  */
277306
277502
  load(passphrase) {
277307
- if (!this.storePath || !existsSync44(this.storePath)) return 0;
277503
+ if (!this.storePath || !existsSync45(this.storePath)) return 0;
277308
277504
  const blob = readFileSync33(this.storePath);
277309
277505
  if (blob.length < SALT_LEN + IV_LEN + 16) {
277310
277506
  throw new Error("Vault file is corrupted (too small)");
@@ -278458,7 +278654,7 @@ async function fetchOpenAIModels(baseUrl, apiKey) {
278458
278654
  async function fetchPeerModels(peerId, authKey) {
278459
278655
  try {
278460
278656
  const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports));
278461
- const { existsSync: existsSync72, readFileSync: readFileSync57 } = await import("node:fs");
278657
+ const { existsSync: existsSync73, readFileSync: readFileSync57 } = await import("node:fs");
278462
278658
  const { join: join92 } = await import("node:path");
278463
278659
  const cwd4 = process.cwd();
278464
278660
  const nexusTool = new NexusTool2(cwd4);
@@ -278466,7 +278662,7 @@ async function fetchPeerModels(peerId, authKey) {
278466
278662
  let isLocalPeer = false;
278467
278663
  try {
278468
278664
  const statusPath = join92(nexusDir, "status.json");
278469
- if (existsSync72(statusPath)) {
278665
+ if (existsSync73(statusPath)) {
278470
278666
  const status = JSON.parse(readFileSync57(statusPath, "utf8"));
278471
278667
  if (status.peerId === peerId) isLocalPeer = true;
278472
278668
  }
@@ -278474,7 +278670,7 @@ async function fetchPeerModels(peerId, authKey) {
278474
278670
  }
278475
278671
  if (isLocalPeer) {
278476
278672
  const pricingPath = join92(nexusDir, "pricing.json");
278477
- if (existsSync72(pricingPath)) {
278673
+ if (existsSync73(pricingPath)) {
278478
278674
  try {
278479
278675
  const pricing = JSON.parse(readFileSync57(pricingPath, "utf8"));
278480
278676
  const localModels = (pricing.models || []).map((m2) => ({
@@ -278490,7 +278686,7 @@ async function fetchPeerModels(peerId, authKey) {
278490
278686
  }
278491
278687
  }
278492
278688
  const cachePath = join92(nexusDir, "peer-models-cache.json");
278493
- if (existsSync72(cachePath)) {
278689
+ if (existsSync73(cachePath)) {
278494
278690
  try {
278495
278691
  const cache7 = JSON.parse(readFileSync57(cachePath, "utf8"));
278496
278692
  if (cache7.peerId === peerId && cache7.models?.length > 0) {
@@ -278605,7 +278801,7 @@ async function fetchPeerModels(peerId, authKey) {
278605
278801
  }
278606
278802
  if (isLocalPeer) {
278607
278803
  const pricingPath = join92(nexusDir, "pricing.json");
278608
- if (existsSync72(pricingPath)) {
278804
+ if (existsSync73(pricingPath)) {
278609
278805
  try {
278610
278806
  const pricing = JSON.parse(readFileSync57(pricingPath, "utf8"));
278611
278807
  return (pricing.models || []).map((m2) => ({
@@ -278863,14 +279059,14 @@ var init_render2 = __esm({
278863
279059
  });
278864
279060
 
278865
279061
  // packages/prompts/dist/promptLoader.js
278866
- import { readFileSync as readFileSync34, existsSync as existsSync45 } from "node:fs";
279062
+ import { readFileSync as readFileSync34, existsSync as existsSync46 } from "node:fs";
278867
279063
  import { join as join61, dirname as dirname18 } from "node:path";
278868
279064
  import { fileURLToPath as fileURLToPath10 } from "node:url";
278869
279065
  function loadPrompt2(promptPath, vars) {
278870
279066
  let content = cache5.get(promptPath);
278871
279067
  if (content === void 0) {
278872
279068
  const fullPath = join61(PROMPTS_DIR2, promptPath);
278873
- if (!existsSync45(fullPath)) {
279069
+ if (!existsSync46(fullPath)) {
278874
279070
  throw new Error(`Prompt file not found: ${fullPath}`);
278875
279071
  }
278876
279072
  content = readFileSync34(fullPath, "utf-8");
@@ -278888,7 +279084,7 @@ var init_promptLoader2 = __esm({
278888
279084
  __dirname6 = dirname18(__filename4);
278889
279085
  devPath = join61(__dirname6, "..", "templates");
278890
279086
  publishedPath = join61(__dirname6, "..", "prompts", "templates");
278891
- PROMPTS_DIR2 = existsSync45(devPath) ? devPath : publishedPath;
279087
+ PROMPTS_DIR2 = existsSync46(devPath) ? devPath : publishedPath;
278892
279088
  cache5 = /* @__PURE__ */ new Map();
278893
279089
  }
278894
279090
  });
@@ -279047,7 +279243,7 @@ __export(oa_directory_exports, {
279047
279243
  writeIndexData: () => writeIndexData,
279048
279244
  writeIndexMeta: () => writeIndexMeta
279049
279245
  });
279050
- import { existsSync as existsSync46, mkdirSync as mkdirSync20, readFileSync as readFileSync35, writeFileSync as writeFileSync20, readdirSync as readdirSync11, statSync as statSync16, unlinkSync as unlinkSync11 } from "node:fs";
279246
+ import { existsSync as existsSync47, mkdirSync as mkdirSync20, readFileSync as readFileSync35, writeFileSync as writeFileSync20, readdirSync as readdirSync11, statSync as statSync16, unlinkSync as unlinkSync11 } from "node:fs";
279051
279247
  import { join as join63, relative as relative4, basename as basename12 } from "node:path";
279052
279248
  import { homedir as homedir16 } from "node:os";
279053
279249
  function initOaDirectory(repoRoot) {
@@ -279058,7 +279254,7 @@ function initOaDirectory(repoRoot) {
279058
279254
  try {
279059
279255
  const gitignorePath = join63(repoRoot, ".gitignore");
279060
279256
  const settingsPattern = ".oa/settings.json";
279061
- if (existsSync46(gitignorePath)) {
279257
+ if (existsSync47(gitignorePath)) {
279062
279258
  const content = readFileSync35(gitignorePath, "utf-8");
279063
279259
  if (!content.includes(settingsPattern)) {
279064
279260
  writeFileSync20(gitignorePath, content.trimEnd() + "\n" + settingsPattern + "\n", "utf-8");
@@ -279069,12 +279265,12 @@ function initOaDirectory(repoRoot) {
279069
279265
  return oaPath;
279070
279266
  }
279071
279267
  function hasOaDirectory(repoRoot) {
279072
- return existsSync46(join63(repoRoot, OA_DIR, "index"));
279268
+ return existsSync47(join63(repoRoot, OA_DIR, "index"));
279073
279269
  }
279074
279270
  function loadProjectSettings(repoRoot) {
279075
279271
  const settingsPath = join63(repoRoot, OA_DIR, "settings.json");
279076
279272
  try {
279077
- if (existsSync46(settingsPath)) {
279273
+ if (existsSync47(settingsPath)) {
279078
279274
  return JSON.parse(readFileSync35(settingsPath, "utf-8"));
279079
279275
  }
279080
279276
  } catch {
@@ -279091,7 +279287,7 @@ function saveProjectSettings(repoRoot, settings) {
279091
279287
  function loadGlobalSettings() {
279092
279288
  const settingsPath = join63(homedir16(), ".open-agents", "settings.json");
279093
279289
  try {
279094
- if (existsSync46(settingsPath)) {
279290
+ if (existsSync47(settingsPath)) {
279095
279291
  return JSON.parse(readFileSync35(settingsPath, "utf-8"));
279096
279292
  }
279097
279293
  } catch {
@@ -279120,7 +279316,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
279120
279316
  for (const name10 of CONTEXT_FILES) {
279121
279317
  const filePath = join63(dir, name10);
279122
279318
  const normalizedName = name10.toLowerCase();
279123
- if (existsSync46(filePath) && !seen.has(filePath)) {
279319
+ if (existsSync47(filePath) && !seen.has(filePath)) {
279124
279320
  seen.add(filePath);
279125
279321
  try {
279126
279322
  let content = readFileSync35(filePath, "utf-8");
@@ -279138,7 +279334,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
279138
279334
  }
279139
279335
  }
279140
279336
  const projectMap = join63(dir, OA_DIR, "context", "project-map.md");
279141
- if (existsSync46(projectMap) && !seen.has(projectMap)) {
279337
+ if (existsSync47(projectMap) && !seen.has(projectMap)) {
279142
279338
  seen.add(projectMap);
279143
279339
  try {
279144
279340
  let content = readFileSync35(projectMap, "utf-8");
@@ -279256,7 +279452,7 @@ function saveSession(repoRoot, session) {
279256
279452
  }
279257
279453
  function loadRecentSessions(repoRoot, limit = 5) {
279258
279454
  const historyDir = join63(repoRoot, OA_DIR, "history");
279259
- if (!existsSync46(historyDir)) return [];
279455
+ if (!existsSync47(historyDir)) return [];
279260
279456
  try {
279261
279457
  const files = readdirSync11(historyDir).filter((f2) => f2.endsWith(".json") && f2 !== "pending-task.json").map((f2) => {
279262
279458
  const stat6 = statSync16(join63(historyDir, f2));
@@ -279287,7 +279483,7 @@ function savePendingTask(repoRoot, task) {
279287
279483
  function loadPendingTask(repoRoot) {
279288
279484
  const filePath = join63(repoRoot, OA_DIR, "history", PENDING_TASK_FILE);
279289
279485
  try {
279290
- if (!existsSync46(filePath)) return null;
279486
+ if (!existsSync47(filePath)) return null;
279291
279487
  const data = JSON.parse(readFileSync35(filePath, "utf-8"));
279292
279488
  try {
279293
279489
  unlinkSync11(filePath);
@@ -279304,7 +279500,7 @@ function saveSessionContext(repoRoot, entry) {
279304
279500
  const filePath = join63(contextDir, CONTEXT_SAVE_FILE);
279305
279501
  let ctx3;
279306
279502
  try {
279307
- if (existsSync46(filePath)) {
279503
+ if (existsSync47(filePath)) {
279308
279504
  ctx3 = JSON.parse(readFileSync35(filePath, "utf-8"));
279309
279505
  } else {
279310
279506
  ctx3 = { entries: [], maxEntries: MAX_CONTEXT_ENTRIES, updatedAt: "" };
@@ -279338,7 +279534,7 @@ function saveSessionContext(repoRoot, entry) {
279338
279534
  function loadSessionContext(repoRoot) {
279339
279535
  const filePath = join63(repoRoot, OA_DIR, "context", CONTEXT_SAVE_FILE);
279340
279536
  try {
279341
- if (!existsSync46(filePath)) return null;
279537
+ if (!existsSync47(filePath)) return null;
279342
279538
  return JSON.parse(readFileSync35(filePath, "utf-8"));
279343
279539
  } catch {
279344
279540
  return null;
@@ -279378,7 +279574,7 @@ function saveSessionHistory(repoRoot, sessionId, contentLines, meta) {
279378
279574
  const indexPath = join63(sessDir, SESSIONS_INDEX);
279379
279575
  let index = [];
279380
279576
  try {
279381
- if (existsSync46(indexPath)) {
279577
+ if (existsSync47(indexPath)) {
279382
279578
  index = JSON.parse(readFileSync35(indexPath, "utf-8"));
279383
279579
  }
279384
279580
  } catch {
@@ -279410,7 +279606,7 @@ function saveSessionHistory(repoRoot, sessionId, contentLines, meta) {
279410
279606
  function listSessions(repoRoot) {
279411
279607
  const indexPath = join63(repoRoot, OA_DIR, SESSIONS_DIR, SESSIONS_INDEX);
279412
279608
  try {
279413
- if (!existsSync46(indexPath)) return [];
279609
+ if (!existsSync47(indexPath)) return [];
279414
279610
  const index = JSON.parse(readFileSync35(indexPath, "utf-8"));
279415
279611
  return index.sort((a2, b) => b.updatedAt.localeCompare(a2.updatedAt));
279416
279612
  } catch {
@@ -279420,7 +279616,7 @@ function listSessions(repoRoot) {
279420
279616
  function loadSessionHistory(repoRoot, sessionId) {
279421
279617
  const contentPath = join63(repoRoot, OA_DIR, SESSIONS_DIR, `${sessionId}.jsonl`);
279422
279618
  try {
279423
- if (!existsSync46(contentPath)) return null;
279619
+ if (!existsSync47(contentPath)) return null;
279424
279620
  return readFileSync35(contentPath, "utf-8").split("\n");
279425
279621
  } catch {
279426
279622
  return null;
@@ -279431,8 +279627,8 @@ function deleteSession(repoRoot, sessionId) {
279431
279627
  const indexPath = join63(sessDir, SESSIONS_INDEX);
279432
279628
  try {
279433
279629
  const contentPath = join63(sessDir, `${sessionId}.jsonl`);
279434
- if (existsSync46(contentPath)) unlinkSync11(contentPath);
279435
- if (existsSync46(indexPath)) {
279630
+ if (existsSync47(contentPath)) unlinkSync11(contentPath);
279631
+ if (existsSync47(indexPath)) {
279436
279632
  let index = JSON.parse(readFileSync35(indexPath, "utf-8"));
279437
279633
  index = index.filter((s2) => s2.id !== sessionId);
279438
279634
  writeFileSync20(indexPath, JSON.stringify(index, null, 2), "utf-8");
@@ -279487,7 +279683,7 @@ function detectManifests(repoRoot) {
279487
279683
  ];
279488
279684
  for (const check of checks) {
279489
279685
  const filePath = join63(repoRoot, check.file);
279490
- if (existsSync46(filePath)) {
279686
+ if (existsSync47(filePath)) {
279491
279687
  let name10;
279492
279688
  if (check.nameField) {
279493
279689
  try {
@@ -279520,7 +279716,7 @@ function findKeyFiles(repoRoot) {
279520
279716
  { pattern: "CLAUDE.md", description: "Claude Code context" }
279521
279717
  ];
279522
279718
  for (const check of checks) {
279523
- if (existsSync46(join63(repoRoot, check.pattern))) {
279719
+ if (existsSync47(join63(repoRoot, check.pattern))) {
279524
279720
  keyFiles.push({ path: check.pattern, description: check.description });
279525
279721
  }
279526
279722
  }
@@ -279560,7 +279756,7 @@ function buildDirTree(root, maxDepth, prefix = "", depth = 0) {
279560
279756
  }
279561
279757
  function loadUsageFile(filePath) {
279562
279758
  try {
279563
- if (existsSync46(filePath)) {
279759
+ if (existsSync47(filePath)) {
279564
279760
  return JSON.parse(readFileSync35(filePath, "utf-8"));
279565
279761
  }
279566
279762
  } catch {
@@ -280281,7 +280477,7 @@ __export(text_selection_exports, {
280281
280477
  stripAnsi: () => stripAnsi,
280282
280478
  visibleLength: () => visibleLength
280283
280479
  });
280284
- import { execSync as execSync40 } from "node:child_process";
280480
+ import { execSync as execSync41 } from "node:child_process";
280285
280481
  function stripAnsi(s2) {
280286
280482
  return s2.replace(/\x1B\[[0-9;]*[A-Za-z]|\x1B\].*?(?:\x07|\x1B\\)/g, "");
280287
280483
  }
@@ -280292,16 +280488,16 @@ function copyText(text) {
280292
280488
  try {
280293
280489
  const platform6 = process.platform;
280294
280490
  if (platform6 === "darwin") {
280295
- execSync40("pbcopy", { input: text, timeout: 3e3 });
280491
+ execSync41("pbcopy", { input: text, timeout: 3e3 });
280296
280492
  return true;
280297
280493
  }
280298
280494
  if (platform6 === "win32") {
280299
- execSync40("clip", { input: text, timeout: 3e3 });
280495
+ execSync41("clip", { input: text, timeout: 3e3 });
280300
280496
  return true;
280301
280497
  }
280302
280498
  for (const tool of ["xclip -selection clipboard", "xsel --clipboard --input", "wl-copy"]) {
280303
280499
  try {
280304
- execSync40(tool, { input: text, timeout: 3e3 });
280500
+ execSync41(tool, { input: text, timeout: 3e3 });
280305
280501
  return true;
280306
280502
  } catch {
280307
280503
  continue;
@@ -280310,10 +280506,10 @@ function copyText(text) {
280310
280506
  if (!_clipboardAutoInstallAttempted) {
280311
280507
  _clipboardAutoInstallAttempted = true;
280312
280508
  try {
280313
- execSync40("which apt-get", { timeout: 2e3, stdio: "pipe" });
280509
+ execSync41("which apt-get", { timeout: 2e3, stdio: "pipe" });
280314
280510
  try {
280315
- execSync40("sudo -n apt-get install -y xclip 2>/dev/null", { timeout: 15e3, stdio: "pipe" });
280316
- execSync40("xclip -selection clipboard", { input: text, timeout: 3e3 });
280511
+ execSync41("sudo -n apt-get install -y xclip 2>/dev/null", { timeout: 15e3, stdio: "pipe" });
280512
+ execSync41("xclip -selection clipboard", { input: text, timeout: 3e3 });
280317
280513
  return true;
280318
280514
  } catch {
280319
280515
  }
@@ -284188,10 +284384,10 @@ __export(personaplex_exports, {
284188
284384
  startPersonaPlexDaemon: () => startPersonaPlexDaemon,
284189
284385
  stopPersonaPlex: () => stopPersonaPlex
284190
284386
  });
284191
- import { existsSync as existsSync47, writeFileSync as writeFileSync21, readFileSync as readFileSync37, mkdirSync as mkdirSync21, copyFileSync as copyFileSync2, readdirSync as readdirSync12, statSync as statSync17 } from "node:fs";
284387
+ import { existsSync as existsSync48, writeFileSync as writeFileSync21, readFileSync as readFileSync37, mkdirSync as mkdirSync21, copyFileSync as copyFileSync2, readdirSync as readdirSync12, statSync as statSync17 } from "node:fs";
284192
284388
  import { join as join64, dirname as dirname20 } from "node:path";
284193
284389
  import { homedir as homedir17 } from "node:os";
284194
- import { execSync as execSync41, spawn as spawn20 } from "node:child_process";
284390
+ import { execSync as execSync42, spawn as spawn20 } from "node:child_process";
284195
284391
  import { fileURLToPath as fileURLToPath12 } from "node:url";
284196
284392
  function execAsync(cmd, opts = {}) {
284197
284393
  return new Promise((resolve39, reject) => {
@@ -284224,7 +284420,7 @@ function detectJetson() {
284224
284420
  try {
284225
284421
  const model = readFileSync37("/proc/device-tree/model", "utf8").replace(/\0/g, "").trim();
284226
284422
  if (/jetson|orin|tegra/i.test(model)) {
284227
- const memInfo = execSync41("grep MemTotal /proc/meminfo", { encoding: "utf8", timeout: 3e3, stdio: "pipe" });
284423
+ const memInfo = execSync42("grep MemTotal /proc/meminfo", { encoding: "utf8", timeout: 3e3, stdio: "pipe" });
284228
284424
  const memKB = parseInt(memInfo.match(/(\d+)/)?.[1] ?? "0", 10);
284229
284425
  return { isJetson: true, model, totalMemGB: memKB / 1024 / 1024 };
284230
284426
  }
@@ -284258,7 +284454,7 @@ function detectPersonaPlexCapability() {
284258
284454
  };
284259
284455
  }
284260
284456
  try {
284261
- const nvsmi = execSync41("nvidia-smi --query-gpu=name,memory.total --format=csv,noheader,nounits", {
284457
+ const nvsmi = execSync42("nvidia-smi --query-gpu=name,memory.total --format=csv,noheader,nounits", {
284262
284458
  encoding: "utf8",
284263
284459
  timeout: 5e3,
284264
284460
  stdio: "pipe"
@@ -284270,7 +284466,7 @@ function detectPersonaPlexCapability() {
284270
284466
  return { ...fail2(`GPU has ${vramGB.toFixed(1)}GB VRAM (need \u22658GB)`), gpuName: gpuName ?? "", vramGB };
284271
284467
  }
284272
284468
  try {
284273
- execSync41('python3 -c "import torch; assert torch.cuda.is_available()"', {
284469
+ execSync42('python3 -c "import torch; assert torch.cuda.is_available()"', {
284274
284470
  timeout: 1e4,
284275
284471
  stdio: "pipe"
284276
284472
  });
@@ -284299,7 +284495,7 @@ function fileLink2(filePath, label) {
284299
284495
  return `\x1B]8;;${url}\x1B\\${text}\x1B]8;;\x1B\\`;
284300
284496
  }
284301
284497
  function isPersonaPlexRunning() {
284302
- if (!existsSync47(PID_FILE)) return false;
284498
+ if (!existsSync48(PID_FILE)) return false;
284303
284499
  const pid = parseInt(readFileSync37(PID_FILE, "utf8").trim(), 10);
284304
284500
  if (isNaN(pid) || pid <= 0) return false;
284305
284501
  try {
@@ -284311,17 +284507,17 @@ function isPersonaPlexRunning() {
284311
284507
  }
284312
284508
  function getPersonaPlexWSUrl() {
284313
284509
  if (!isPersonaPlexRunning()) return null;
284314
- if (!existsSync47(PORT_FILE)) return null;
284510
+ if (!existsSync48(PORT_FILE)) return null;
284315
284511
  const port = parseInt(readFileSync37(PORT_FILE, "utf8").trim(), 10);
284316
284512
  return isNaN(port) ? null : `wss://127.0.0.1:${port}`;
284317
284513
  }
284318
284514
  function isPersonaPlexInstalled() {
284319
- return existsSync47(join64(PERSONAPLEX_DIR, "model_ready"));
284515
+ return existsSync48(join64(PERSONAPLEX_DIR, "model_ready"));
284320
284516
  }
284321
284517
  function getWeightTier() {
284322
284518
  const detected = detectPersonaPlexCapability();
284323
284519
  const tierFile = join64(PERSONAPLEX_DIR, "weight_tier");
284324
- if (existsSync47(tierFile)) {
284520
+ if (existsSync48(tierFile)) {
284325
284521
  const saved = readFileSync37(tierFile, "utf8").trim();
284326
284522
  if (saved in WEIGHT_REPOS) {
284327
284523
  const vram = detected.vramGB;
@@ -284343,13 +284539,13 @@ async function installPersonaPlex(onInfo, weightTier) {
284343
284539
  mkdirSync21(PERSONAPLEX_DIR, { recursive: true });
284344
284540
  let arch2 = "";
284345
284541
  try {
284346
- arch2 = execSync41("uname -m", { encoding: "utf8", timeout: 3e3, stdio: "pipe" }).trim();
284542
+ arch2 = execSync42("uname -m", { encoding: "utf8", timeout: 3e3, stdio: "pipe" }).trim();
284347
284543
  } catch {
284348
284544
  }
284349
284545
  const isAarch64 = arch2 === "aarch64" || arch2 === "arm64";
284350
284546
  if (isAarch64) log22(`Detected ARM64 platform (${arch2}) \u2014 Jetson/ARM install path`);
284351
284547
  const venvDir = join64(PERSONAPLEX_DIR, "venv");
284352
- if (!existsSync47(venvDir)) {
284548
+ if (!existsSync48(venvDir)) {
284353
284549
  log22("Creating Python virtual environment...");
284354
284550
  try {
284355
284551
  const ssp = isAarch64 ? " --system-site-packages" : "";
@@ -284364,16 +284560,16 @@ async function installPersonaPlex(onInfo, weightTier) {
284364
284560
  log22("Checking system dependencies (libopus)...");
284365
284561
  try {
284366
284562
  if (process.platform === "linux") {
284367
- execSync41("dpkg -l libopus-dev 2>/dev/null || sudo apt-get install -y libopus-dev", { timeout: 3e4, stdio: "pipe" });
284563
+ execSync42("dpkg -l libopus-dev 2>/dev/null || sudo apt-get install -y libopus-dev", { timeout: 3e4, stdio: "pipe" });
284368
284564
  } else if (process.platform === "darwin") {
284369
- execSync41("brew list opus 2>/dev/null || brew install opus", { timeout: 6e4, stdio: "pipe" });
284565
+ execSync42("brew list opus 2>/dev/null || brew install opus", { timeout: 6e4, stdio: "pipe" });
284370
284566
  }
284371
284567
  } catch {
284372
284568
  }
284373
284569
  if (isAarch64) {
284374
284570
  log22("ARM64: Checking Rust toolchain for sphn build...");
284375
284571
  try {
284376
- execSync41("rustc --version", { timeout: 5e3, stdio: "pipe" });
284572
+ execSync42("rustc --version", { timeout: 5e3, stdio: "pipe" });
284377
284573
  } catch {
284378
284574
  log22("ARM64: Installing Rust toolchain (needed for sphn audio codec)...");
284379
284575
  try {
@@ -284392,7 +284588,7 @@ async function installPersonaPlex(onInfo, weightTier) {
284392
284588
  log22("Installing PersonaPlex (moshi package)...");
284393
284589
  const repoDir = join64(PERSONAPLEX_DIR, "personaplex-repo");
284394
284590
  try {
284395
- if (!existsSync47(repoDir)) {
284591
+ if (!existsSync48(repoDir)) {
284396
284592
  await execAsync(
284397
284593
  `git clone https://github.com/NVIDIA/personaplex.git "${repoDir}"`,
284398
284594
  { timeout: 12e4 }
@@ -284446,13 +284642,13 @@ async function installPersonaPlex(onInfo, weightTier) {
284446
284642
  }
284447
284643
  const serverPy = join64(venvDir, "lib", `python3.${process.versions.node ? "12" : "10"}`, "site-packages", "moshi", "server.py");
284448
284644
  try {
284449
- const sitePackages = execSync41(`"${python}" -c "import moshi, os; print(os.path.dirname(moshi.__file__))"`, {
284645
+ const sitePackages = execSync42(`"${python}" -c "import moshi, os; print(os.path.dirname(moshi.__file__))"`, {
284450
284646
  encoding: "utf8",
284451
284647
  timeout: 5e3,
284452
284648
  stdio: "pipe"
284453
284649
  }).trim();
284454
284650
  const serverFile = join64(sitePackages, "server.py");
284455
- if (existsSync47(serverFile)) {
284651
+ if (existsSync48(serverFile)) {
284456
284652
  let src2 = readFileSync37(serverFile, "utf8");
284457
284653
  if (src2.includes('int(request["seed"])')) {
284458
284654
  src2 = src2.replace('int(request["seed"])', 'int(request.query["seed"])');
@@ -284463,13 +284659,13 @@ async function installPersonaPlex(onInfo, weightTier) {
284463
284659
  } catch {
284464
284660
  }
284465
284661
  try {
284466
- const sitePackages = execSync41(`"${python}" -c "import moshi, os; print(os.path.dirname(moshi.__file__))"`, {
284662
+ const sitePackages = execSync42(`"${python}" -c "import moshi, os; print(os.path.dirname(moshi.__file__))"`, {
284467
284663
  encoding: "utf8",
284468
284664
  timeout: 5e3,
284469
284665
  stdio: "pipe"
284470
284666
  }).trim();
284471
284667
  const loadersFile = join64(sitePackages, "models", "loaders.py");
284472
- if (existsSync47(loadersFile)) {
284668
+ if (existsSync48(loadersFile)) {
284473
284669
  let src2 = readFileSync37(loadersFile, "utf8");
284474
284670
  if (!src2.includes("_dequantize_2bit_state_dict")) {
284475
284671
  const dequantPatch = `
@@ -284567,21 +284763,21 @@ $2if filename.endswith(".safetensors"):`
284567
284763
  } catch {
284568
284764
  }
284569
284765
  try {
284570
- const sitePackages2 = execSync41(`"${python}" -c "import moshi, os; print(os.path.dirname(moshi.__file__))"`, {
284766
+ const sitePackages2 = execSync42(`"${python}" -c "import moshi, os; print(os.path.dirname(moshi.__file__))"`, {
284571
284767
  encoding: "utf8",
284572
284768
  timeout: 5e3,
284573
284769
  stdio: "pipe"
284574
284770
  }).trim();
284575
284771
  const hybridDest = join64(sitePackages2, "hybrid_agent.py");
284576
284772
  const serverDest = join64(sitePackages2, "server.py");
284577
- if (!existsSync47(hybridDest) || !readFileSync37(hybridDest, "utf8").includes("OA_API_BASE")) {
284773
+ if (!existsSync48(hybridDest) || !readFileSync37(hybridDest, "utf8").includes("OA_API_BASE")) {
284578
284774
  log22("Deploying hybrid_agent.py (OA API integration)...");
284579
284775
  try {
284580
284776
  await execAsync(
284581
284777
  `curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/hybrid_agent.py" -o "${hybridDest}"`,
284582
284778
  { timeout: 3e4 }
284583
284779
  );
284584
- if (existsSync47(hybridDest) && readFileSync37(hybridDest, "utf8").includes("OA_API_BASE")) {
284780
+ if (existsSync48(hybridDest) && readFileSync37(hybridDest, "utf8").includes("OA_API_BASE")) {
284585
284781
  log22("hybrid_agent.py deployed (OA API + Ollama fallback).");
284586
284782
  }
284587
284783
  } catch {
@@ -284702,14 +284898,14 @@ async function startPersonaPlexDaemon(onInfo) {
284702
284898
  if (tier === "nf4-distilled") {
284703
284899
  log22(`Weight tier: ${tier} \u2014 distilled NF4 (90% token match, ${repoInfo.sizeGB}GB)...`);
284704
284900
  try {
284705
- const weightPath = execSync41(
284901
+ const weightPath = execSync42(
284706
284902
  `"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', '${repoInfo.file}', token=False))"`,
284707
284903
  { encoding: "utf8", timeout: 6e4, stdio: "pipe" }
284708
284904
  ).trim();
284709
- if (existsSync47(weightPath)) {
284710
- if (!existsSync47(cachedBf16)) {
284905
+ if (existsSync48(weightPath)) {
284906
+ if (!existsSync48(cachedBf16)) {
284711
284907
  log22("Converting .pt checkpoint to safetensors (one-time)...");
284712
- execSync41(
284908
+ execSync42(
284713
284909
  `"${venvPython2}" -c "
284714
284910
  import torch; from safetensors.torch import save_file
284715
284911
  state = torch.load('${weightPath}', map_location='cpu', weights_only=True)
@@ -284720,7 +284916,7 @@ print('Converted')
284720
284916
  { timeout: 18e4, stdio: "pipe" }
284721
284917
  );
284722
284918
  }
284723
- if (existsSync47(cachedBf16)) {
284919
+ if (existsSync48(cachedBf16)) {
284724
284920
  extraArgs.push("--moshi-weight", cachedBf16);
284725
284921
  log22(`Using distilled weights: ${(statSync17(cachedBf16).size / 1024 ** 3).toFixed(1)}GB`);
284726
284922
  } else {
@@ -284733,25 +284929,25 @@ print('Converted')
284733
284929
  } else {
284734
284930
  log22(`Weight tier: ${tier} (${repoInfo.sizeGB}GB) \u2014 dequantizing to bf16 cache...`);
284735
284931
  const dequantScript = join64(PERSONAPLEX_DIR, "dequant-loader.py");
284736
- if (!existsSync47(dequantScript)) {
284932
+ if (!existsSync48(dequantScript)) {
284737
284933
  const shipped = getShippedVoicesDir();
284738
284934
  if (shipped) {
284739
284935
  const src2 = join64(shipped, "dequant-loader.py");
284740
- if (existsSync47(src2)) copyFileSync2(src2, dequantScript);
284936
+ if (existsSync48(src2)) copyFileSync2(src2, dequantScript);
284741
284937
  }
284742
284938
  }
284743
284939
  try {
284744
- const weightPath = execSync41(
284940
+ const weightPath = execSync42(
284745
284941
  `"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', '${repoInfo.file}'${repoInfo.needsToken ? "" : ", token=False"}))"`,
284746
284942
  { encoding: "utf8", timeout: 3e4, stdio: "pipe" }
284747
284943
  ).trim();
284748
- if (existsSync47(dequantScript) && existsSync47(weightPath)) {
284944
+ if (existsSync48(dequantScript) && existsSync48(weightPath)) {
284749
284945
  try {
284750
- execSync41(
284946
+ execSync42(
284751
284947
  `"${venvPython2}" "${dequantScript}" --input "${weightPath}" --output "${cachedBf16}"`,
284752
284948
  { timeout: 3e5, stdio: "pipe" }
284753
284949
  );
284754
- if (existsSync47(cachedBf16)) {
284950
+ if (existsSync48(cachedBf16)) {
284755
284951
  extraArgs.push("--moshi-weight", cachedBf16);
284756
284952
  log22(`Using dequantized cache: ${(statSync17(cachedBf16).size / 1024 ** 3).toFixed(1)}GB`);
284757
284953
  }
@@ -284760,19 +284956,19 @@ print('Converted')
284760
284956
  }
284761
284957
  }
284762
284958
  try {
284763
- const mimiPath = execSync41(
284959
+ const mimiPath = execSync42(
284764
284960
  `"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', 'tokenizer-e351c8d8-checkpoint125.safetensors', token=False))"`,
284765
284961
  { encoding: "utf8", timeout: 3e4, stdio: "pipe" }
284766
284962
  ).trim();
284767
- if (existsSync47(mimiPath)) extraArgs.push("--mimi-weight", mimiPath);
284963
+ if (existsSync48(mimiPath)) extraArgs.push("--mimi-weight", mimiPath);
284768
284964
  } catch {
284769
284965
  }
284770
284966
  try {
284771
- const tokPath = execSync41(
284967
+ const tokPath = execSync42(
284772
284968
  `"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', 'tokenizer_spm_32k_3.model', token=False))"`,
284773
284969
  { encoding: "utf8", timeout: 3e4, stdio: "pipe" }
284774
284970
  ).trim();
284775
- if (existsSync47(tokPath)) extraArgs.push("--tokenizer", tokPath);
284971
+ if (existsSync48(tokPath)) extraArgs.push("--tokenizer", tokPath);
284776
284972
  } catch {
284777
284973
  }
284778
284974
  } catch {
@@ -284792,7 +284988,7 @@ print('Converted')
284792
284988
  }
284793
284989
  if (!ollamaModel) ollamaModel = "qwen3.5:4b";
284794
284990
  try {
284795
- const ollamaCheck = execSync41("curl -s http://localhost:11434/api/tags", {
284991
+ const ollamaCheck = execSync42("curl -s http://localhost:11434/api/tags", {
284796
284992
  timeout: 3e3,
284797
284993
  stdio: "pipe",
284798
284994
  encoding: "utf8"
@@ -284866,7 +285062,7 @@ print('Converted')
284866
285062
  return null;
284867
285063
  }
284868
285064
  try {
284869
- execSync41(`curl -sk -o /dev/null -w "%{http_code}" https://127.0.0.1:${PORT}/`, {
285065
+ execSync42(`curl -sk -o /dev/null -w "%{http_code}" https://127.0.0.1:${PORT}/`, {
284870
285066
  timeout: 3e3,
284871
285067
  stdio: "pipe",
284872
285068
  encoding: "utf8"
@@ -284884,12 +285080,12 @@ print('Converted')
284884
285080
  return null;
284885
285081
  }
284886
285082
  function stopPersonaPlex() {
284887
- if (!existsSync47(PID_FILE)) return;
285083
+ if (!existsSync48(PID_FILE)) return;
284888
285084
  const pid = parseInt(readFileSync37(PID_FILE, "utf8").trim(), 10);
284889
285085
  if (isNaN(pid) || pid <= 0) return;
284890
285086
  try {
284891
285087
  if (process.platform === "win32") {
284892
- execSync41(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
285088
+ execSync42(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
284893
285089
  } else {
284894
285090
  process.kill(pid, "SIGTERM");
284895
285091
  }
@@ -284921,7 +285117,7 @@ function listPersonaPlexVoices() {
284921
285117
  for (const name10 of builtins) {
284922
285118
  voices.push({ name: name10, type: "builtin", path: `${name10}.pt` });
284923
285119
  }
284924
- if (existsSync47(CUSTOM_VOICES_DIR)) {
285120
+ if (existsSync48(CUSTOM_VOICES_DIR)) {
284925
285121
  try {
284926
285122
  for (const f2 of readdirSync12(CUSTOM_VOICES_DIR)) {
284927
285123
  if (f2.endsWith(".pt")) {
@@ -284941,19 +285137,19 @@ async function clonePersonaPlexVoice(inputWav, voiceName, onInfo) {
284941
285137
  log22("PersonaPlex not installed. Run /voice personaplex first.");
284942
285138
  return null;
284943
285139
  }
284944
- if (!existsSync47(inputWav)) {
285140
+ if (!existsSync48(inputWav)) {
284945
285141
  log22(`Input WAV not found: ${inputWav}`);
284946
285142
  return null;
284947
285143
  }
284948
285144
  mkdirSync21(CUSTOM_VOICES_DIR, { recursive: true });
284949
285145
  const outputPt = join64(CUSTOM_VOICES_DIR, `${voiceName}.pt`);
284950
- if (existsSync47(outputPt)) {
285146
+ if (existsSync48(outputPt)) {
284951
285147
  log22(`Voice "${voiceName}" already exists. Delete ${outputPt} to re-clone.`);
284952
285148
  return outputPt;
284953
285149
  }
284954
285150
  const venvPython2 = process.platform === "win32" ? join64(PERSONAPLEX_DIR, "venv", "Scripts", "python.exe") : join64(PERSONAPLEX_DIR, "venv", "bin", "python3");
284955
285151
  const cloneScript = join64(PERSONAPLEX_DIR, "clone-voice.py");
284956
- if (!existsSync47(cloneScript)) {
285152
+ if (!existsSync48(cloneScript)) {
284957
285153
  log22("clone-voice.py not found. Reinstall PersonaPlex.");
284958
285154
  return null;
284959
285155
  }
@@ -284985,7 +285181,7 @@ async function clonePersonaPlexVoice(inputWav, voiceName, onInfo) {
284985
285181
  output += d2.toString();
284986
285182
  });
284987
285183
  child.on("close", (code8) => {
284988
- if (code8 === 0 && existsSync47(outputPt)) {
285184
+ if (code8 === 0 && existsSync48(outputPt)) {
284989
285185
  log22(`Voice "${voiceName}" cloned successfully.`);
284990
285186
  resolve39(outputPt);
284991
285187
  } else {
@@ -285009,7 +285205,7 @@ function getShippedVoicesDir() {
285009
285205
  } catch {
285010
285206
  }
285011
285207
  for (const dir of candidates) {
285012
- if (existsSync47(dir)) {
285208
+ if (existsSync48(dir)) {
285013
285209
  try {
285014
285210
  const files = readdirSync12(dir);
285015
285211
  if (files.some((f2) => f2.endsWith(".pt"))) return dir;
@@ -285031,12 +285227,12 @@ function provisionShippedVoices(onInfo) {
285031
285227
  for (const f2 of readdirSync12(shippedDir)) {
285032
285228
  if (!f2.endsWith(".pt")) continue;
285033
285229
  const customDst = join64(CUSTOM_VOICES_DIR, f2);
285034
- if (!existsSync47(customDst)) {
285230
+ if (!existsSync48(customDst)) {
285035
285231
  copyFileSync2(join64(shippedDir, f2), customDst);
285036
285232
  }
285037
285233
  if (hfVoicesDir) {
285038
285234
  const hfDst = join64(hfVoicesDir, f2);
285039
- if (!existsSync47(hfDst)) {
285235
+ if (!existsSync48(hfDst)) {
285040
285236
  copyFileSync2(join64(shippedDir, f2), hfDst);
285041
285237
  log22(`Deployed voice: ${f2.replace(".pt", "")}`);
285042
285238
  deployed++;
@@ -285047,7 +285243,7 @@ function provisionShippedVoices(onInfo) {
285047
285243
  }
285048
285244
  const shippedScript = join64(shippedDir, "clone-voice.py");
285049
285245
  const targetScript = join64(PERSONAPLEX_DIR, "clone-voice.py");
285050
- if (existsSync47(shippedScript) && !existsSync47(targetScript)) {
285246
+ if (existsSync48(shippedScript) && !existsSync48(targetScript)) {
285051
285247
  try {
285052
285248
  copyFileSync2(shippedScript, targetScript);
285053
285249
  } catch {
@@ -285057,13 +285253,13 @@ function provisionShippedVoices(onInfo) {
285057
285253
  }
285058
285254
  function getHFVoicesDir() {
285059
285255
  const hfBase = join64(homedir17(), ".cache", "huggingface", "hub", "models--nvidia--personaplex-7b-v1");
285060
- if (!existsSync47(hfBase)) return null;
285256
+ if (!existsSync48(hfBase)) return null;
285061
285257
  try {
285062
285258
  const snapshots = join64(hfBase, "snapshots");
285063
- if (!existsSync47(snapshots)) return null;
285259
+ if (!existsSync48(snapshots)) return null;
285064
285260
  for (const snap of readdirSync12(snapshots)) {
285065
285261
  const voicesDir = join64(snapshots, snap, "voices");
285066
- if (existsSync47(voicesDir)) return voicesDir;
285262
+ if (existsSync48(voicesDir)) return voicesDir;
285067
285263
  }
285068
285264
  } catch {
285069
285265
  }
@@ -285073,18 +285269,18 @@ function patchFrontendVoiceList(onInfo) {
285073
285269
  const log22 = onInfo ?? (() => {
285074
285270
  });
285075
285271
  const hfBase = join64(homedir17(), ".cache", "huggingface", "hub", "models--nvidia--personaplex-7b-v1");
285076
- if (!existsSync47(hfBase)) return;
285272
+ if (!existsSync48(hfBase)) return;
285077
285273
  try {
285078
285274
  const snapshots = join64(hfBase, "snapshots");
285079
285275
  for (const snap of readdirSync12(snapshots)) {
285080
285276
  const distDir = join64(snapshots, snap, "dist", "assets");
285081
- if (!existsSync47(distDir)) continue;
285277
+ if (!existsSync48(distDir)) continue;
285082
285278
  for (const f2 of readdirSync12(distDir)) {
285083
285279
  if (!f2.startsWith("index-") || !f2.endsWith(".js")) continue;
285084
285280
  const jsPath = join64(distDir, f2);
285085
285281
  let js = readFileSync37(jsPath, "utf8");
285086
285282
  const customVoices = [];
285087
- if (existsSync47(CUSTOM_VOICES_DIR)) {
285283
+ if (existsSync48(CUSTOM_VOICES_DIR)) {
285088
285284
  for (const vf of readdirSync12(CUSTOM_VOICES_DIR)) {
285089
285285
  if (vf.endsWith(".pt")) {
285090
285286
  const name10 = vf.replace(".pt", "");
@@ -285193,9 +285389,9 @@ __export(setup_exports, {
285193
285389
  updateOllama: () => updateOllama
285194
285390
  });
285195
285391
  import * as readline from "node:readline";
285196
- import { execSync as execSync42, spawn as spawn21, exec as exec4 } from "node:child_process";
285392
+ import { execSync as execSync43, spawn as spawn21, exec as exec4 } from "node:child_process";
285197
285393
  import { promisify as promisify7 } from "node:util";
285198
- import { existsSync as existsSync48, writeFileSync as writeFileSync22, readFileSync as readFileSync38, appendFileSync as appendFileSync2, mkdirSync as mkdirSync22 } from "node:fs";
285394
+ import { existsSync as existsSync49, writeFileSync as writeFileSync22, readFileSync as readFileSync38, appendFileSync as appendFileSync2, mkdirSync as mkdirSync22 } from "node:fs";
285199
285395
  import { join as join65 } from "node:path";
285200
285396
  import { homedir as homedir18, platform as platform3 } from "node:os";
285201
285397
  async function checkToolSupport(modelName, backendUrl = "http://localhost:11434") {
@@ -285231,7 +285427,7 @@ function detectSystemSpecs() {
285231
285427
  let gpuVramGB = 0;
285232
285428
  let gpuName = "";
285233
285429
  try {
285234
- const memInfo = execSync42("free -b 2>/dev/null || sysctl -n hw.memsize 2>/dev/null", {
285430
+ const memInfo = execSync43("free -b 2>/dev/null || sysctl -n hw.memsize 2>/dev/null", {
285235
285431
  encoding: "utf8",
285236
285432
  timeout: 5e3
285237
285433
  });
@@ -285251,7 +285447,7 @@ function detectSystemSpecs() {
285251
285447
  } catch {
285252
285448
  }
285253
285449
  try {
285254
- const nvidiaSmi = execSync42(
285450
+ const nvidiaSmi = execSync43(
285255
285451
  "nvidia-smi --query-gpu=memory.total,name --format=csv,noheader,nounits 2>/dev/null",
285256
285452
  { encoding: "utf8", timeout: 5e3 }
285257
285453
  );
@@ -285425,7 +285621,7 @@ function ensureCurl() {
285425
285621
  for (const s2 of strategies) {
285426
285622
  if (hasCmd(s2.check)) {
285427
285623
  try {
285428
- execSync42(s2.install, { stdio: "inherit", timeout: 12e4 });
285624
+ execSync43(s2.install, { stdio: "inherit", timeout: 12e4 });
285429
285625
  if (hasCmd("curl")) {
285430
285626
  process.stdout.write(` ${c3.green("\u2714")} curl installed via ${s2.label}.
285431
285627
  `);
@@ -285439,7 +285635,7 @@ function ensureCurl() {
285439
285635
  }
285440
285636
  if (plat === "darwin") {
285441
285637
  try {
285442
- execSync42("xcode-select --install", { stdio: "inherit", timeout: 3e5 });
285638
+ execSync43("xcode-select --install", { stdio: "inherit", timeout: 3e5 });
285443
285639
  if (hasCmd("curl")) return true;
285444
285640
  } catch {
285445
285641
  }
@@ -285473,7 +285669,7 @@ function installOllamaLinux() {
285473
285669
 
285474
285670
  `);
285475
285671
  try {
285476
- execSync42("curl -fsSL https://ollama.com/install.sh | sh", {
285672
+ execSync43("curl -fsSL https://ollama.com/install.sh | sh", {
285477
285673
  stdio: "inherit",
285478
285674
  timeout: 3e5
285479
285675
  });
@@ -285501,13 +285697,13 @@ async function installOllamaMac(_rl) {
285501
285697
 
285502
285698
  `);
285503
285699
  try {
285504
- execSync42(
285700
+ execSync43(
285505
285701
  '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"',
285506
285702
  { stdio: "inherit", timeout: 6e5 }
285507
285703
  );
285508
285704
  if (!hasCmd("brew")) {
285509
285705
  try {
285510
- const brewPrefix = existsSync48("/opt/homebrew/bin/brew") ? "/opt/homebrew" : "/usr/local";
285706
+ const brewPrefix = existsSync49("/opt/homebrew/bin/brew") ? "/opt/homebrew" : "/usr/local";
285511
285707
  process.env["PATH"] = `${brewPrefix}/bin:${process.env["PATH"]}`;
285512
285708
  } catch {
285513
285709
  }
@@ -285537,7 +285733,7 @@ async function installOllamaMac(_rl) {
285537
285733
 
285538
285734
  `);
285539
285735
  try {
285540
- execSync42("brew install ollama", {
285736
+ execSync43("brew install ollama", {
285541
285737
  stdio: "inherit",
285542
285738
  timeout: 3e5
285543
285739
  });
@@ -285564,7 +285760,7 @@ function installOllamaWindows() {
285564
285760
 
285565
285761
  `);
285566
285762
  try {
285567
- execSync42('powershell -Command "irm https://ollama.com/install.ps1 | iex"', {
285763
+ execSync43('powershell -Command "irm https://ollama.com/install.ps1 | iex"', {
285568
285764
  stdio: "inherit",
285569
285765
  timeout: 3e5
285570
285766
  });
@@ -285644,7 +285840,7 @@ async function ensureOllamaRunning(backendUrl, rl) {
285644
285840
  }
285645
285841
  function getOllamaVersion() {
285646
285842
  try {
285647
- const out = execSync42("ollama --version", { encoding: "utf8", timeout: 5e3 });
285843
+ const out = execSync43("ollama --version", { encoding: "utf8", timeout: 5e3 });
285648
285844
  const match = out.match(/(\d+\.\d+\.\d+)/);
285649
285845
  return match ? match[1] : null;
285650
285846
  } catch {
@@ -285690,7 +285886,7 @@ function updateOllama() {
285690
285886
  return false;
285691
285887
  }
285692
285888
  try {
285693
- execSync42("curl -fsSL https://ollama.com/install.sh | sh", {
285889
+ execSync43("curl -fsSL https://ollama.com/install.sh | sh", {
285694
285890
  stdio: "inherit",
285695
285891
  timeout: 3e5
285696
285892
  });
@@ -285701,7 +285897,7 @@ function updateOllama() {
285701
285897
  }
285702
285898
  function pullModelWithAutoUpdate(tag) {
285703
285899
  try {
285704
- execSync42(`ollama pull ${tag}`, {
285900
+ execSync43(`ollama pull ${tag}`, {
285705
285901
  stdio: "inherit",
285706
285902
  timeout: 36e5
285707
285903
  // 1 hour max
@@ -285721,7 +285917,7 @@ function pullModelWithAutoUpdate(tag) {
285721
285917
 
285722
285918
  `);
285723
285919
  try {
285724
- execSync42("curl -fsSL https://ollama.com/install.sh | sh", {
285920
+ execSync43("curl -fsSL https://ollama.com/install.sh | sh", {
285725
285921
  stdio: "inherit",
285726
285922
  timeout: 3e5
285727
285923
  // 5 min max for install
@@ -285732,7 +285928,7 @@ function pullModelWithAutoUpdate(tag) {
285732
285928
  process.stdout.write(` ${c3.cyan("\u25CF")} Retrying pull of ${c3.bold(tag)}...
285733
285929
 
285734
285930
  `);
285735
- execSync42(`ollama pull ${tag}`, {
285931
+ execSync43(`ollama pull ${tag}`, {
285736
285932
  stdio: "inherit",
285737
285933
  timeout: 36e5
285738
285934
  });
@@ -285821,7 +286017,7 @@ function ensurePython3() {
285821
286017
  if (plat === "darwin") {
285822
286018
  if (hasCmd("brew")) {
285823
286019
  try {
285824
- execSync42("brew install python3", { stdio: "inherit", timeout: 3e5 });
286020
+ execSync43("brew install python3", { stdio: "inherit", timeout: 3e5 });
285825
286021
  if (hasCmd("python3")) {
285826
286022
  process.stdout.write(` ${c3.green("\u2714")} Python3 installed via Homebrew.
285827
286023
  `);
@@ -285834,7 +286030,7 @@ function ensurePython3() {
285834
286030
  for (const s2 of strategies) {
285835
286031
  if (hasCmd(s2.check)) {
285836
286032
  try {
285837
- execSync42(s2.install, { stdio: "inherit", timeout: 12e4 });
286033
+ execSync43(s2.install, { stdio: "inherit", timeout: 12e4 });
285838
286034
  if (hasCmd("python3") || hasCmd("python")) {
285839
286035
  process.stdout.write(` ${c3.green("\u2714")} Python3 installed via ${s2.label}.
285840
286036
  `);
@@ -285850,11 +286046,11 @@ function ensurePython3() {
285850
286046
  }
285851
286047
  function checkPythonVenv() {
285852
286048
  try {
285853
- execSync42("python3 -m venv --help", { stdio: "pipe", timeout: 5e3 });
286049
+ execSync43("python3 -m venv --help", { stdio: "pipe", timeout: 5e3 });
285854
286050
  return true;
285855
286051
  } catch {
285856
286052
  try {
285857
- execSync42("python -m venv --help", { stdio: "pipe", timeout: 5e3 });
286053
+ execSync43("python -m venv --help", { stdio: "pipe", timeout: 5e3 });
285858
286054
  return true;
285859
286055
  } catch {
285860
286056
  return false;
@@ -285873,7 +286069,7 @@ function ensurePythonVenv() {
285873
286069
  for (const s2 of strategies) {
285874
286070
  if (hasCmd(s2.check)) {
285875
286071
  try {
285876
- execSync42(s2.install, { stdio: "inherit", timeout: 12e4 });
286072
+ execSync43(s2.install, { stdio: "inherit", timeout: 12e4 });
285877
286073
  if (checkPythonVenv()) {
285878
286074
  process.stdout.write(` ${c3.green("\u2714")} python3-venv installed via ${s2.label}.
285879
286075
  `);
@@ -286301,7 +286497,7 @@ async function doSetup(config, rl) {
286301
286497
  const modelfilePath = join65(modelDir2, `Modelfile.${customName}`);
286302
286498
  writeFileSync22(modelfilePath, modelfileContent + "\n", "utf8");
286303
286499
  process.stdout.write(` ${c3.dim("Creating model...")} `);
286304
- execSync42(`ollama create ${customName} -f ${modelfilePath}`, {
286500
+ execSync43(`ollama create ${customName} -f ${modelfilePath}`, {
286305
286501
  stdio: "pipe",
286306
286502
  timeout: 12e4
286307
286503
  });
@@ -286344,7 +286540,7 @@ async function isModelAvailable(config) {
286344
286540
  }
286345
286541
  function isFirstRun() {
286346
286542
  try {
286347
- return !existsSync48(join65(homedir18(), ".open-agents", "config.json"));
286543
+ return !existsSync49(join65(homedir18(), ".open-agents", "config.json"));
286348
286544
  } catch {
286349
286545
  return true;
286350
286546
  }
@@ -286352,7 +286548,7 @@ function isFirstRun() {
286352
286548
  function hasCmd(cmd) {
286353
286549
  try {
286354
286550
  const whichCmd = process.platform === "win32" ? `where ${cmd}` : `which ${cmd}`;
286355
- execSync42(whichCmd, { stdio: "pipe", timeout: 3e3 });
286551
+ execSync43(whichCmd, { stdio: "pipe", timeout: 3e3 });
286356
286552
  return true;
286357
286553
  } catch {
286358
286554
  return false;
@@ -286364,7 +286560,7 @@ function detectPkgManager() {
286364
286560
  if (hasCmd("choco")) return "choco";
286365
286561
  if (hasCmd("winget")) return "winget";
286366
286562
  try {
286367
- execSync42(
286563
+ execSync43(
286368
286564
  `powershell -NoProfile -Command "Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))"`,
286369
286565
  { stdio: "pipe", timeout: 12e4 }
286370
286566
  );
@@ -286376,7 +286572,7 @@ function detectPkgManager() {
286376
286572
  if (plat === "darwin") {
286377
286573
  if (hasCmd("brew")) return "brew";
286378
286574
  try {
286379
- execSync42(
286575
+ execSync43(
286380
286576
  '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"',
286381
286577
  { stdio: "pipe", timeout: 3e5, env: { ...process.env, NONINTERACTIVE: "1" } }
286382
286578
  );
@@ -286396,7 +286592,7 @@ function getVenvDir() {
286396
286592
  }
286397
286593
  function hasVenvModule() {
286398
286594
  try {
286399
- execSync42("python3 -m venv --help", { stdio: "pipe", timeout: 5e3 });
286595
+ execSync43("python3 -m venv --help", { stdio: "pipe", timeout: 5e3 });
286400
286596
  return true;
286401
286597
  } catch {
286402
286598
  return false;
@@ -286407,7 +286603,7 @@ function ensureVenv(log22) {
286407
286603
  const isWin2 = process.platform === "win32";
286408
286604
  const pipPath = isWin2 ? join65(venvDir, "Scripts", "pip.exe") : join65(venvDir, "bin", "pip");
286409
286605
  const pythonCmd = isWin2 ? "python" : "python3";
286410
- if (existsSync48(pipPath)) return venvDir;
286606
+ if (existsSync49(pipPath)) return venvDir;
286411
286607
  log22("Creating Python venv for vision deps...");
286412
286608
  if (!hasCmd(pythonCmd) && !hasCmd("python3")) {
286413
286609
  log22(`${pythonCmd} not found \u2014 cannot create venv.`);
@@ -286420,8 +286616,8 @@ function ensureVenv(log22) {
286420
286616
  try {
286421
286617
  mkdirSync22(join65(homedir18(), ".open-agents"), { recursive: true });
286422
286618
  const pyCmd = hasCmd(pythonCmd) ? pythonCmd : "python3";
286423
- execSync42(`${pyCmd} -m venv "${venvDir}"`, { stdio: "pipe", timeout: 3e4 });
286424
- execSync42(`"${pipPath}" install --upgrade pip`, {
286619
+ execSync43(`${pyCmd} -m venv "${venvDir}"`, { stdio: "pipe", timeout: 3e4 });
286620
+ execSync43(`"${pipPath}" install --upgrade pip`, {
286425
286621
  stdio: "pipe",
286426
286622
  timeout: 6e4
286427
286623
  });
@@ -286434,7 +286630,7 @@ function ensureVenv(log22) {
286434
286630
  }
286435
286631
  function trySudoPasswordless(cmd, timeoutMs = 12e4) {
286436
286632
  try {
286437
- execSync42(`sudo -n ${cmd}`, {
286633
+ execSync43(`sudo -n ${cmd}`, {
286438
286634
  stdio: "pipe",
286439
286635
  timeout: timeoutMs,
286440
286636
  env: { ...process.env, DEBIAN_FRONTEND: "noninteractive" }
@@ -286447,7 +286643,7 @@ function trySudoPasswordless(cmd, timeoutMs = 12e4) {
286447
286643
  function runWithSudo(cmd, password, timeoutMs = 12e4) {
286448
286644
  try {
286449
286645
  const escaped = cmd.replace(/'/g, "'\\''");
286450
- execSync42(`sudo -S bash -c '${escaped}'`, {
286646
+ execSync43(`sudo -S bash -c '${escaped}'`, {
286451
286647
  input: password + "\n",
286452
286648
  stdio: ["pipe", "pipe", "pipe"],
286453
286649
  timeout: timeoutMs,
@@ -286522,7 +286718,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
286522
286718
  const _visionMarkerFile = join65(_visionMarkerDir, "vision-deps-installed.json");
286523
286719
  let _visionPreviouslyInstalled = /* @__PURE__ */ new Set();
286524
286720
  try {
286525
- if (existsSync48(_visionMarkerFile)) {
286721
+ if (existsSync49(_visionMarkerFile)) {
286526
286722
  const _vm = JSON.parse(readFileSync38(_visionMarkerFile, "utf8"));
286527
286723
  _visionPreviouslyInstalled = new Set(_vm.installed || []);
286528
286724
  }
@@ -286541,7 +286737,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
286541
286737
  let winNeedsElevation = false;
286542
286738
  if (process.platform === "win32") {
286543
286739
  try {
286544
- execSync42("net session", { stdio: "pipe", timeout: 3e3 });
286740
+ execSync43("net session", { stdio: "pipe", timeout: 3e3 });
286545
286741
  } catch {
286546
286742
  winNeedsElevation = true;
286547
286743
  log22(`Installing ${labels} via ${pm2} (requires admin \u2014 UAC prompt will appear)...`);
@@ -286588,12 +286784,12 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
286588
286784
  if (needsSudo) {
286589
286785
  await sudoInstall(installCmd, getPassword, log22, cachedPasswordRef, 18e4);
286590
286786
  } else if (winNeedsElevation) {
286591
- execSync42(
286787
+ execSync43(
286592
286788
  `powershell -NoProfile -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c ${installCmd.replace(/'/g, "''")}' -Verb RunAs -Wait"`,
286593
286789
  { stdio: "pipe", timeout: 18e4 }
286594
286790
  );
286595
286791
  } else {
286596
- execSync42(installCmd, { stdio: "pipe", timeout: 18e4 });
286792
+ execSync43(installCmd, { stdio: "pipe", timeout: 18e4 });
286597
286793
  }
286598
286794
  } catch (e2) {
286599
286795
  const stderr = e2.stderr?.toString?.()?.trim?.() ?? "";
@@ -286606,7 +286802,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
286606
286802
  if (!hasCmd(d2.binary) && pipPkg) {
286607
286803
  try {
286608
286804
  const pipCmd = process.platform === "win32" ? `pip install ${pipPkg}` : `pip3 install ${pipPkg}`;
286609
- execSync42(pipCmd, { stdio: "pipe", timeout: 12e4 });
286805
+ execSync43(pipCmd, { stdio: "pipe", timeout: 12e4 });
286610
286806
  lastError = "";
286611
286807
  } catch (e2) {
286612
286808
  const stderr = e2.stderr?.toString?.()?.trim?.() ?? "";
@@ -286618,7 +286814,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
286618
286814
  }
286619
286815
  if (process.platform === "win32" && !hasCmd(d2.binary)) {
286620
286816
  try {
286621
- const freshPath = execSync42(
286817
+ const freshPath = execSync43(
286622
286818
  `powershell -NoProfile -Command "[System.Environment]::GetEnvironmentVariable('Path','Machine') + ';' + [System.Environment]::GetEnvironmentVariable('Path','User')"`,
286623
286819
  { encoding: "utf8", timeout: 5e3, stdio: "pipe" }
286624
286820
  ).trim();
@@ -286664,7 +286860,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
286664
286860
  const venvCmds = {
286665
286861
  apt: () => {
286666
286862
  try {
286667
- const pyVer = execSync42(
286863
+ const pyVer = execSync43(
286668
286864
  `python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')"`,
286669
286865
  { encoding: "utf8", stdio: "pipe", timeout: 5e3 }
286670
286866
  ).trim();
@@ -286692,16 +286888,16 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
286692
286888
  const venvBin = join65(venvDir, isWin2 ? "Scripts" : "bin");
286693
286889
  const venvMoondream = join65(venvBin, isWin2 ? "moondream-station.exe" : "moondream-station");
286694
286890
  const venv = ensureVenv(log22);
286695
- if (venv && !hasCmd("moondream-station") && !existsSync48(venvMoondream)) {
286891
+ if (venv && !hasCmd("moondream-station") && !existsSync49(venvMoondream)) {
286696
286892
  const venvPip2 = join65(venvBin, "pip");
286697
286893
  log22("Installing moondream-station in ~/.open-agents/venv...");
286698
286894
  try {
286699
- execSync42(`"${venvPip2}" install moondream-station`, { stdio: "pipe", timeout: 3e5 });
286700
- if (existsSync48(venvMoondream)) {
286895
+ execSync43(`"${venvPip2}" install moondream-station`, { stdio: "pipe", timeout: 3e5 });
286896
+ if (existsSync49(venvMoondream)) {
286701
286897
  log22("moondream-station installed successfully.");
286702
286898
  } else {
286703
286899
  try {
286704
- const check = execSync42(`"${venvPip2}" show moondream-station`, { encoding: "utf8", stdio: "pipe", timeout: 5e3 });
286900
+ const check = execSync43(`"${venvPip2}" show moondream-station`, { encoding: "utf8", stdio: "pipe", timeout: 5e3 });
286705
286901
  if (check.includes("moondream")) {
286706
286902
  log22("moondream-station package installed.");
286707
286903
  }
@@ -286718,7 +286914,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
286718
286914
  const venvPip2 = join65(venvBin, isWin2 ? "pip.exe" : "pip");
286719
286915
  let ocrStackInstalled = false;
286720
286916
  try {
286721
- execSync42(
286917
+ execSync43(
286722
286918
  `"${venvPython2}" -c "import cv2, pytesseract, numpy, PIL"`,
286723
286919
  { stdio: "pipe", timeout: 1e4 }
286724
286920
  );
@@ -286729,12 +286925,12 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
286729
286925
  const ocrPackages = "pytesseract Pillow opencv-python-headless numpy";
286730
286926
  log22("Installing OCR Python stack (pytesseract, OpenCV, Pillow, numpy)...");
286731
286927
  try {
286732
- execSync42(
286928
+ execSync43(
286733
286929
  `"${venvPip2}" install ${ocrPackages}`,
286734
286930
  { stdio: "pipe", timeout: 3e5 }
286735
286931
  );
286736
286932
  try {
286737
- execSync42(
286933
+ execSync43(
286738
286934
  `"${venvPython2}" -c "import cv2, pytesseract, numpy, PIL"`,
286739
286935
  { stdio: "pipe", timeout: 1e4 }
286740
286936
  );
@@ -286770,7 +286966,7 @@ function ensureCloudflaredBackground(onInfo) {
286770
286966
  const archMap = { x64: "amd64", arm64: "arm64", arm: "arm" };
286771
286967
  const cfArch = archMap[arch2] ?? "amd64";
286772
286968
  try {
286773
- execSync42(
286969
+ execSync43(
286774
286970
  `curl -fsSL "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${cfArch}" -o /tmp/cloudflared && chmod +x /tmp/cloudflared && mkdir -p "${homedir18()}/.local/bin" && mv /tmp/cloudflared "${homedir18()}/.local/bin/cloudflared"`,
286775
286971
  { stdio: "pipe", timeout: 6e4 }
286776
286972
  );
@@ -286784,7 +286980,7 @@ function ensureCloudflaredBackground(onInfo) {
286784
286980
  } catch {
286785
286981
  }
286786
286982
  try {
286787
- execSync42(
286983
+ execSync43(
286788
286984
  `curl -fsSL "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-${cfArch}" -o /tmp/cloudflared && chmod +x /tmp/cloudflared && sudo mv /tmp/cloudflared /usr/local/bin/cloudflared 2>/dev/null`,
286789
286985
  { stdio: "pipe", timeout: 6e4 }
286790
286986
  );
@@ -286796,7 +286992,7 @@ function ensureCloudflaredBackground(onInfo) {
286796
286992
  }
286797
286993
  } else if (os8 === "darwin") {
286798
286994
  try {
286799
- execSync42("brew install cloudflared", { stdio: "pipe", timeout: 12e4 });
286995
+ execSync43("brew install cloudflared", { stdio: "pipe", timeout: 12e4 });
286800
286996
  if (hasCmd("cloudflared")) {
286801
286997
  log22("cloudflared installed via Homebrew.");
286802
286998
  return true;
@@ -286876,7 +287072,7 @@ function createExpandedVariant(baseModel, specs, sizeGB, kvBytesPerToken, archMa
286876
287072
  mkdirSync22(modelDir2, { recursive: true });
286877
287073
  const modelfilePath = join65(modelDir2, `Modelfile.${customName}`);
286878
287074
  writeFileSync22(modelfilePath, modelfileContent + "\n", "utf8");
286879
- execSync42(`ollama create ${customName} -f ${modelfilePath}`, {
287075
+ execSync43(`ollama create ${customName} -f ${modelfilePath}`, {
286880
287076
  stdio: "pipe",
286881
287077
  timeout: 12e4
286882
287078
  });
@@ -286962,7 +287158,7 @@ async function ensureExpandedContext(modelName, backendUrl) {
286962
287158
  }
286963
287159
  async function ensureNeovim() {
286964
287160
  try {
286965
- const nvimPath = execSync42("which nvim 2>/dev/null || where nvim 2>nul", {
287161
+ const nvimPath = execSync43("which nvim 2>/dev/null || where nvim 2>nul", {
286966
287162
  encoding: "utf8",
286967
287163
  stdio: "pipe",
286968
287164
  timeout: 5e3
@@ -286983,14 +287179,14 @@ async function ensureNeovim() {
286983
287179
  const url = `https://github.com/neovim/neovim/releases/latest/download/${appImageName}`;
286984
287180
  console.log(` Downloading Neovim (${appImageName})...`);
286985
287181
  try {
286986
- execSync42(`curl -fsSL "${url}" -o "${nvimDest}"`, { stdio: "pipe", timeout: 6e4 });
286987
- execSync42(`chmod +x "${nvimDest}"`, { stdio: "pipe", timeout: 3e3 });
287182
+ execSync43(`curl -fsSL "${url}" -o "${nvimDest}"`, { stdio: "pipe", timeout: 6e4 });
287183
+ execSync43(`chmod +x "${nvimDest}"`, { stdio: "pipe", timeout: 3e3 });
286988
287184
  } catch (err) {
286989
287185
  console.log(` Failed to download Neovim: ${err instanceof Error ? err.message : String(err)}`);
286990
287186
  return null;
286991
287187
  }
286992
287188
  try {
286993
- const ver = execSync42(`"${nvimDest}" --version`, { encoding: "utf8", stdio: "pipe", timeout: 5e3 }).split("\n")[0];
287189
+ const ver = execSync43(`"${nvimDest}" --version`, { encoding: "utf8", stdio: "pipe", timeout: 5e3 }).split("\n")[0];
286994
287190
  console.log(` Installed: ${ver}`);
286995
287191
  } catch {
286996
287192
  console.log(" Warning: nvim binary downloaded but may not work (missing FUSE? Try: nvim --appimage-extract)");
@@ -287005,8 +287201,8 @@ async function ensureNeovim() {
287005
287201
  if (hasCmd("brew")) {
287006
287202
  console.log(" Installing Neovim via Homebrew...");
287007
287203
  try {
287008
- execSync42("brew install neovim", { stdio: "inherit", timeout: 12e4 });
287009
- const nvimPath = execSync42("which nvim", { encoding: "utf8", stdio: "pipe", timeout: 3e3 }).trim();
287204
+ execSync43("brew install neovim", { stdio: "inherit", timeout: 12e4 });
287205
+ const nvimPath = execSync43("which nvim", { encoding: "utf8", stdio: "pipe", timeout: 3e3 }).trim();
287010
287206
  return nvimPath || null;
287011
287207
  } catch {
287012
287208
  console.log(" brew install neovim failed.");
@@ -287020,7 +287216,7 @@ async function ensureNeovim() {
287020
287216
  if (hasCmd("choco")) {
287021
287217
  console.log(" Installing Neovim via Chocolatey...");
287022
287218
  try {
287023
- execSync42("choco install neovim -y", { stdio: "inherit", timeout: 12e4 });
287219
+ execSync43("choco install neovim -y", { stdio: "inherit", timeout: 12e4 });
287024
287220
  return "nvim";
287025
287221
  } catch {
287026
287222
  console.log(" choco install neovim failed.");
@@ -287029,7 +287225,7 @@ async function ensureNeovim() {
287029
287225
  if (hasCmd("winget")) {
287030
287226
  console.log(" Installing Neovim via winget...");
287031
287227
  try {
287032
- execSync42("winget install Neovim.Neovim --accept-source-agreements --accept-package-agreements", {
287228
+ execSync43("winget install Neovim.Neovim --accept-source-agreements --accept-package-agreements", {
287033
287229
  stdio: "inherit",
287034
287230
  timeout: 12e4
287035
287231
  });
@@ -287047,7 +287243,7 @@ function ensurePathInShellRc(binDir) {
287047
287243
  const shell = process.env.SHELL ?? "";
287048
287244
  const rcFile = shell.includes("zsh") ? join65(homedir18(), ".zshrc") : join65(homedir18(), ".bashrc");
287049
287245
  try {
287050
- const rcContent = existsSync48(rcFile) ? readFileSync38(rcFile, "utf8") : "";
287246
+ const rcContent = existsSync49(rcFile) ? readFileSync38(rcFile, "utf8") : "";
287051
287247
  if (rcContent.includes(binDir)) return;
287052
287248
  const exportLine = `
287053
287249
  export PATH="${binDir}:$PATH" # Added by open-agents for nvim
@@ -287084,7 +287280,7 @@ var init_setup = __esm({
287084
287280
  });
287085
287281
 
287086
287282
  // packages/cli/src/tui/drop-panel.ts
287087
- import { existsSync as existsSync49 } from "node:fs";
287283
+ import { existsSync as existsSync50 } from "node:fs";
287088
287284
  import { extname as extname10, resolve as resolve31 } from "node:path";
287089
287285
  function ansi4(code8, text) {
287090
287286
  return isTTY4 ? `\x1B[${code8}m${text}\x1B[0m` : text;
@@ -287205,7 +287401,7 @@ function showDropPanel(opts) {
287205
287401
  filePath = decodeURIComponent(filePath.slice(7));
287206
287402
  }
287207
287403
  filePath = resolve31(filePath);
287208
- if (!existsSync49(filePath)) {
287404
+ if (!existsSync50(filePath)) {
287209
287405
  errorMsg = `File not found: ${filePath}`;
287210
287406
  render();
287211
287407
  return;
@@ -287277,10 +287473,10 @@ var init_drop_panel = __esm({
287277
287473
  });
287278
287474
 
287279
287475
  // packages/cli/src/tui/neovim-mode.ts
287280
- import { existsSync as existsSync50, unlinkSync as unlinkSync12 } from "node:fs";
287476
+ import { existsSync as existsSync51, unlinkSync as unlinkSync12 } from "node:fs";
287281
287477
  import { tmpdir as tmpdir12 } from "node:os";
287282
287478
  import { join as join66 } from "node:path";
287283
- import { execSync as execSync43 } from "node:child_process";
287479
+ import { execSync as execSync44 } from "node:child_process";
287284
287480
  function isNeovimActive() {
287285
287481
  return _state !== null && !_state.cleanedUp;
287286
287482
  }
@@ -287297,7 +287493,7 @@ async function startNeovimMode(opts) {
287297
287493
  }
287298
287494
  let nvimPath;
287299
287495
  try {
287300
- nvimPath = execSync43("which nvim 2>/dev/null", { encoding: "utf8" }).trim();
287496
+ nvimPath = execSync44("which nvim 2>/dev/null", { encoding: "utf8" }).trim();
287301
287497
  if (!nvimPath) throw new Error();
287302
287498
  } catch {
287303
287499
  const installed = await ensureNeovim();
@@ -287327,7 +287523,7 @@ async function startNeovimMode(opts) {
287327
287523
  }
287328
287524
  const socketPath = join66(tmpdir12(), `oa-nvim-${process.pid}-${Date.now()}.sock`);
287329
287525
  try {
287330
- if (existsSync50(socketPath)) unlinkSync12(socketPath);
287526
+ if (existsSync51(socketPath)) unlinkSync12(socketPath);
287331
287527
  } catch {
287332
287528
  }
287333
287529
  const ptyCols = opts.cols;
@@ -287574,12 +287770,12 @@ function resizeNeovim(cols, contentRows) {
287574
287770
  }
287575
287771
  async function connectRPC(state, neovimPkg, cols) {
287576
287772
  let attempts = 0;
287577
- while (!existsSync50(state.socketPath) && attempts < 30) {
287773
+ while (!existsSync51(state.socketPath) && attempts < 30) {
287578
287774
  await new Promise((r2) => setTimeout(r2, 200));
287579
287775
  attempts++;
287580
287776
  if (state.cleanedUp) return;
287581
287777
  }
287582
- if (!existsSync50(state.socketPath)) return;
287778
+ if (!existsSync51(state.socketPath)) return;
287583
287779
  const nvim = neovimPkg.attach({ socket: state.socketPath });
287584
287780
  state.nvim = nvim;
287585
287781
  await new Promise((r2) => setTimeout(r2, 300));
@@ -287716,7 +287912,7 @@ function doCleanup(state) {
287716
287912
  state.pty = null;
287717
287913
  }
287718
287914
  try {
287719
- if (existsSync50(state.socketPath)) unlinkSync12(state.socketPath);
287915
+ if (existsSync51(state.socketPath)) unlinkSync12(state.socketPath);
287720
287916
  } catch {
287721
287917
  }
287722
287918
  if (state.stdinHandler) {
@@ -287786,7 +287982,7 @@ __export(daemon_exports, {
287786
287982
  stopDaemon: () => stopDaemon
287787
287983
  });
287788
287984
  import { spawn as spawn22 } from "node:child_process";
287789
- import { existsSync as existsSync51, readFileSync as readFileSync39, writeFileSync as writeFileSync23, mkdirSync as mkdirSync23, unlinkSync as unlinkSync13 } from "node:fs";
287985
+ import { existsSync as existsSync52, readFileSync as readFileSync39, writeFileSync as writeFileSync23, mkdirSync as mkdirSync23, unlinkSync as unlinkSync13 } from "node:fs";
287790
287986
  import { join as join67 } from "node:path";
287791
287987
  import { homedir as homedir19 } from "node:os";
287792
287988
  import { fileURLToPath as fileURLToPath13 } from "node:url";
@@ -287812,7 +288008,7 @@ async function isDaemonRunning(port) {
287812
288008
  }
287813
288009
  }
287814
288010
  function getDaemonPid() {
287815
- if (!existsSync51(PID_FILE2)) return null;
288011
+ if (!existsSync52(PID_FILE2)) return null;
287816
288012
  try {
287817
288013
  const pid = parseInt(readFileSync39(PID_FILE2, "utf8").trim(), 10);
287818
288014
  if (!pid || pid <= 0) return null;
@@ -287832,8 +288028,8 @@ async function startDaemon() {
287832
288028
  let oaScript = process.argv[1];
287833
288029
  if (!oaScript) {
287834
288030
  try {
287835
- const { execSync: execSync50 } = await import("node:child_process");
287836
- const whichOa = execSync50("which oa 2>/dev/null || where oa 2>nul", { encoding: "utf8" }).trim();
288031
+ const { execSync: execSync51 } = await import("node:child_process");
288032
+ const whichOa = execSync51("which oa 2>/dev/null || where oa 2>nul", { encoding: "utf8" }).trim();
287837
288033
  if (whichOa) oaScript = whichOa;
287838
288034
  } catch {
287839
288035
  }
@@ -287841,7 +288037,7 @@ async function startDaemon() {
287841
288037
  if (!oaScript) {
287842
288038
  const thisDir = dirname21(fileURLToPath13(import.meta.url));
287843
288039
  const indexJs = join67(thisDir, "index.js");
287844
- if (existsSync51(indexJs)) oaScript = indexJs;
288040
+ if (existsSync52(indexJs)) oaScript = indexJs;
287845
288041
  }
287846
288042
  if (!oaScript) return null;
287847
288043
  try {
@@ -288325,7 +288521,7 @@ __export(sponsor_wizard_exports, {
288325
288521
  saveSponsorConfig: () => saveSponsorConfig,
288326
288522
  showSponsorDashboard: () => showSponsorDashboard
288327
288523
  });
288328
- import { existsSync as existsSync52, readFileSync as readFileSync40, writeFileSync as writeFileSync24, mkdirSync as mkdirSync24 } from "node:fs";
288524
+ import { existsSync as existsSync53, readFileSync as readFileSync40, writeFileSync as writeFileSync24, mkdirSync as mkdirSync24 } from "node:fs";
288329
288525
  import { join as join68 } from "node:path";
288330
288526
  function colorPreview(code8) {
288331
288527
  return `\x1B[38;5;${code8}m\u2588\u2588\u2588\u2588\x1B[0m (${code8})`;
@@ -288346,7 +288542,7 @@ function configPath(projectDir) {
288346
288542
  }
288347
288543
  function loadSponsorConfig(projectDir) {
288348
288544
  const p2 = configPath(projectDir);
288349
- if (!existsSync52(p2)) return null;
288545
+ if (!existsSync53(p2)) return null;
288350
288546
  try {
288351
288547
  return JSON.parse(readFileSync40(p2, "utf8"));
288352
288548
  } catch {
@@ -289237,10 +289433,10 @@ __export(voice_exports, {
289237
289433
  registerCustomOnnxModel: () => registerCustomOnnxModel,
289238
289434
  resetNarrationContext: () => resetNarrationContext
289239
289435
  });
289240
- import { existsSync as existsSync53, mkdirSync as mkdirSync25, writeFileSync as writeFileSync25, readFileSync as readFileSync41, unlinkSync as unlinkSync14, readdirSync as readdirSync13, statSync as statSync18 } from "node:fs";
289436
+ import { existsSync as existsSync54, mkdirSync as mkdirSync25, writeFileSync as writeFileSync25, readFileSync as readFileSync41, unlinkSync as unlinkSync14, readdirSync as readdirSync13, statSync as statSync18 } from "node:fs";
289241
289437
  import { join as join69, dirname as dirname22 } from "node:path";
289242
289438
  import { homedir as homedir20, tmpdir as tmpdir13, platform as platform4 } from "node:os";
289243
- import { execSync as execSync44, spawn as nodeSpawn } from "node:child_process";
289439
+ import { execSync as execSync45, spawn as nodeSpawn } from "node:child_process";
289244
289440
  import { createRequire as createRequire2 } from "node:module";
289245
289441
  function sanitizeForTTS(text) {
289246
289442
  return text.replace(/^#{1,6}\s+/gm, "").replace(/\*{1,3}([^*]+)\*{1,3}/g, "$1").replace(/_{1,3}([^_]+)_{1,3}/g, "$1").replace(/~~([^~]+)~~/g, "$1").replace(/`([^`]+)`/g, "$1").replace(/```[\s\S]*?```/g, "").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1").replace(/^[\s]*[-*+]\s+/gm, "").replace(/^[\s]*\d+\.\s+/gm, "").replace(/^>\s+/gm, "").replace(/^[-*_]{3,}$/gm, "").replace(/\[[ xX]\]\s*/g, "").replace(/[\u{1F600}-\u{1F64F}]/gu, "").replace(/[\u{1F300}-\u{1F5FF}]/gu, "").replace(/[\u{1F680}-\u{1F6FF}]/gu, "").replace(/[\u{1F1E0}-\u{1F1FF}]/gu, "").replace(/[\u{2600}-\u{26FF}]/gu, "").replace(/[\u{2700}-\u{27BF}]/gu, "").replace(/[\u{FE00}-\u{FE0F}]/gu, "").replace(/[\u{1F900}-\u{1F9FF}]/gu, "").replace(/[\u{1FA00}-\u{1FA6F}]/gu, "").replace(/[\u{1FA70}-\u{1FAFF}]/gu, "").replace(/[\u{200D}]/gu, "").replace(/[\u{20E3}]/gu, "").replace(/[✓✔✗✘✕✖⚠️⏸⏹⏵●○◆◇■□▪▫►▼▲◀⬆⬇⬅➡↑↓←→⇐⇒⇑⇓]/g, "").replace(/[─━│┃┌┐└┘├┤┬┴┼╔╗╚╝╠╣╦╩╬⎿⎾▕▏⏐░▒▓█⠀-⣿]/g, "").replace(/\s{2,}/g, " ").trim();
@@ -289293,7 +289489,7 @@ function luxttsInferScript() {
289293
289489
  return join69(voiceDir(), "luxtts-infer.py");
289294
289490
  }
289295
289491
  function writeDetectTorchScript(targetPath) {
289296
- if (existsSync53(targetPath)) return;
289492
+ if (existsSync54(targetPath)) return;
289297
289493
  try {
289298
289494
  mkdirSync25(dirname22(targetPath), { recursive: true });
289299
289495
  } catch {
@@ -290119,7 +290315,7 @@ var init_voice = __esm({
290119
290315
  const targets = ["glados", "overwatch"];
290120
290316
  for (const modelId of targets) {
290121
290317
  const refFile = join69(refsDir, `${modelId}-ref.wav`);
290122
- if (existsSync53(refFile)) continue;
290318
+ if (existsSync54(refFile)) continue;
290123
290319
  try {
290124
290320
  await this.generateCloneRef(modelId);
290125
290321
  const meta = this.loadCloneMeta();
@@ -290197,13 +290393,13 @@ var init_voice = __esm({
290197
290393
  if (p2.startsWith("~/") || p2 === "~") {
290198
290394
  p2 = join69(homedir20(), p2.slice(1));
290199
290395
  }
290200
- if (!existsSync53(p2)) {
290396
+ if (!existsSync54(p2)) {
290201
290397
  return `File not found: ${p2}
290202
290398
  (original input: ${audioPath})`;
290203
290399
  }
290204
290400
  audioPath = p2;
290205
290401
  const refsDir = luxttsCloneRefsDir();
290206
- if (!existsSync53(refsDir)) mkdirSync25(refsDir, { recursive: true });
290402
+ if (!existsSync54(refsDir)) mkdirSync25(refsDir, { recursive: true });
290207
290403
  const ext = audioPath.split(".").pop() || "wav";
290208
290404
  const srcName = (audioPath.split("/").pop() ?? "clone").replace(/\.[^.]+$/, "").replace(/[^a-zA-Z0-9_-]/g, "-");
290209
290405
  const ts = Date.now().toString(36);
@@ -290251,7 +290447,7 @@ var init_voice = __esm({
290251
290447
  return `Failed to synthesize reference audio from ${source.label}.`;
290252
290448
  }
290253
290449
  const refsDir = luxttsCloneRefsDir();
290254
- if (!existsSync53(refsDir)) mkdirSync25(refsDir, { recursive: true });
290450
+ if (!existsSync54(refsDir)) mkdirSync25(refsDir, { recursive: true });
290255
290451
  const destPath = join69(refsDir, `${sourceModelId}-ref.wav`);
290256
290452
  const sampleRate = this.config?.audio?.sample_rate ?? 22050;
290257
290453
  this.writeWav(audioData, sampleRate, destPath);
@@ -290272,7 +290468,7 @@ var init_voice = __esm({
290272
290468
  }
290273
290469
  loadCloneMeta() {
290274
290470
  const p2 = _VoiceEngine.cloneMetaFile();
290275
- if (!existsSync53(p2)) return {};
290471
+ if (!existsSync54(p2)) return {};
290276
290472
  try {
290277
290473
  return JSON.parse(readFileSync41(p2, "utf8"));
290278
290474
  } catch {
@@ -290281,7 +290477,7 @@ var init_voice = __esm({
290281
290477
  }
290282
290478
  saveCloneMeta(meta) {
290283
290479
  const dir = luxttsCloneRefsDir();
290284
- if (!existsSync53(dir)) mkdirSync25(dir, { recursive: true });
290480
+ if (!existsSync54(dir)) mkdirSync25(dir, { recursive: true });
290285
290481
  writeFileSync25(_VoiceEngine.cloneMetaFile(), JSON.stringify(meta, null, 2));
290286
290482
  }
290287
290483
  /** Audio file extensions recognized as clone references */
@@ -290292,7 +290488,7 @@ var init_voice = __esm({
290292
290488
  */
290293
290489
  listCloneRefs() {
290294
290490
  const dir = luxttsCloneRefsDir();
290295
- if (!existsSync53(dir)) return [];
290491
+ if (!existsSync54(dir)) return [];
290296
290492
  const meta = this.loadCloneMeta();
290297
290493
  const files = readdirSync13(dir).filter((f2) => {
290298
290494
  const ext = f2.split(".").pop()?.toLowerCase() ?? "";
@@ -290317,7 +290513,7 @@ var init_voice = __esm({
290317
290513
  /** Delete a clone reference file by filename. Returns true if deleted. */
290318
290514
  deleteCloneRef(filename) {
290319
290515
  const p2 = join69(luxttsCloneRefsDir(), filename);
290320
- if (!existsSync53(p2)) return false;
290516
+ if (!existsSync54(p2)) return false;
290321
290517
  try {
290322
290518
  unlinkSync14(p2);
290323
290519
  const meta = this.loadCloneMeta();
@@ -290341,7 +290537,7 @@ var init_voice = __esm({
290341
290537
  /** Set the active clone reference by filename. */
290342
290538
  setActiveCloneRef(filename) {
290343
290539
  const p2 = join69(luxttsCloneRefsDir(), filename);
290344
- if (!existsSync53(p2)) return `File not found: ${filename}`;
290540
+ if (!existsSync54(p2)) return `File not found: ${filename}`;
290345
290541
  this.luxttsCloneRef = p2;
290346
290542
  return `Active clone voice set to: ${filename}`;
290347
290543
  }
@@ -290928,7 +291124,7 @@ var init_voice = __esm({
290928
291124
  }
290929
291125
  for (const player of ["paplay", "pw-play", "aplay"]) {
290930
291126
  try {
290931
- execSync44(`which ${player}`, { stdio: "pipe" });
291127
+ execSync45(`which ${player}`, { stdio: "pipe" });
290932
291128
  return [player, path5];
290933
291129
  } catch {
290934
291130
  }
@@ -290956,7 +291152,7 @@ var init_voice = __esm({
290956
291152
  if (this.python3Path) return this.python3Path;
290957
291153
  for (const bin of ["python3", "python"]) {
290958
291154
  try {
290959
- const path5 = execSync44(`which ${bin}`, { stdio: "pipe", timeout: 5e3 }).toString().trim();
291155
+ const path5 = execSync45(`which ${bin}`, { stdio: "pipe", timeout: 5e3 }).toString().trim();
290960
291156
  if (path5) {
290961
291157
  this.python3Path = path5;
290962
291158
  return path5;
@@ -291018,7 +291214,7 @@ var init_voice = __esm({
291018
291214
  return false;
291019
291215
  }
291020
291216
  try {
291021
- execSync44(`${py} -c "import mlx_audio"`, { stdio: "pipe", timeout: 1e4 });
291217
+ execSync45(`${py} -c "import mlx_audio"`, { stdio: "pipe", timeout: 1e4 });
291022
291218
  this.mlxInstalled = true;
291023
291219
  return true;
291024
291220
  } catch {
@@ -291081,14 +291277,14 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
291081
291277
  `tts_gen.main(["--model", ${JSON.stringify(mlxModelId)}, "--text", text, "--voice", ${JSON.stringify(mlxVoice)}, "--lang_code", ${JSON.stringify(mlxLangCode)}, "--audio_path", ${JSON.stringify(wavPath)}])`
291082
291278
  ].join("; ");
291083
291279
  try {
291084
- execSync44(
291280
+ execSync45(
291085
291281
  `${py} -c ${JSON.stringify(pyScript)} ${JSON.stringify(JSON.stringify(cleaned))}`,
291086
291282
  { stdio: "pipe", timeout: 6e4, cwd: tmpdir13() }
291087
291283
  );
291088
291284
  } catch (err) {
291089
291285
  try {
291090
291286
  const safeText = cleaned.replace(/'/g, "'\\''");
291091
- execSync44(
291287
+ execSync45(
291092
291288
  `${py} -m mlx_audio.tts.generate --model ${mlxModelId} --text '${safeText}' --voice ${mlxVoice} --lang_code ${mlxLangCode} --audio_path ${JSON.stringify(wavPath)}`,
291093
291289
  { stdio: "pipe", timeout: 6e4, cwd: tmpdir13() }
291094
291290
  );
@@ -291096,7 +291292,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
291096
291292
  return;
291097
291293
  }
291098
291294
  }
291099
- if (!existsSync53(wavPath)) return;
291295
+ if (!existsSync54(wavPath)) return;
291100
291296
  if (volume !== 1) {
291101
291297
  try {
291102
291298
  const wavData = readFileSync41(wavPath);
@@ -291155,14 +291351,14 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
291155
291351
  `tts_gen.main(["--model", ${JSON.stringify(mlxModelId)}, "--text", text, "--voice", ${JSON.stringify(mlxVoice)}, "--lang_code", ${JSON.stringify(mlxLangCode)}, "--audio_path", ${JSON.stringify(wavPath)}])`
291156
291352
  ].join("; ");
291157
291353
  try {
291158
- execSync44(
291354
+ execSync45(
291159
291355
  `${py} -c ${JSON.stringify(pyScript)} ${JSON.stringify(JSON.stringify(cleaned))}`,
291160
291356
  { stdio: "pipe", timeout: 6e4, cwd: tmpdir13() }
291161
291357
  );
291162
291358
  } catch {
291163
291359
  try {
291164
291360
  const safeText = cleaned.replace(/'/g, "'\\''");
291165
- execSync44(
291361
+ execSync45(
291166
291362
  `${py} -m mlx_audio.tts.generate --model ${mlxModelId} --text '${safeText}' --voice ${mlxVoice} --lang_code ${mlxLangCode} --audio_path ${JSON.stringify(wavPath)}`,
291167
291363
  { stdio: "pipe", timeout: 6e4, cwd: tmpdir13() }
291168
291364
  );
@@ -291170,7 +291366,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
291170
291366
  return null;
291171
291367
  }
291172
291368
  }
291173
- if (!existsSync53(wavPath)) return null;
291369
+ if (!existsSync54(wavPath)) return null;
291174
291370
  try {
291175
291371
  const data = readFileSync41(wavPath);
291176
291372
  unlinkSync14(wavPath);
@@ -291197,7 +291393,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
291197
291393
  }
291198
291394
  const venvDir = luxttsVenvDir();
291199
291395
  const venvPy = luxttsVenvPy();
291200
- if (existsSync53(venvPy)) {
291396
+ if (existsSync54(venvPy)) {
291201
291397
  try {
291202
291398
  const quotedPy = `"${venvPy}"`;
291203
291399
  const repoPath = luxttsRepoDir().replace(/\\/g, "/");
@@ -291246,7 +291442,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
291246
291442
  }
291247
291443
  }
291248
291444
  renderInfo("Setting up LuxTTS voice cloning (first-time setup, this takes several minutes)...");
291249
- if (!existsSync53(venvDir)) {
291445
+ if (!existsSync54(venvDir)) {
291250
291446
  renderInfo(" Creating Python virtual environment...");
291251
291447
  try {
291252
291448
  await this.asyncShell(`${py} -m venv ${JSON.stringify(venvDir)}`, 6e4);
@@ -291302,10 +291498,10 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
291302
291498
  }
291303
291499
  }
291304
291500
  const repoDir = luxttsRepoDir();
291305
- if (!existsSync53(join69(repoDir, "zipvoice", "luxvoice.py"))) {
291501
+ if (!existsSync54(join69(repoDir, "zipvoice", "luxvoice.py"))) {
291306
291502
  renderInfo(" Cloning LuxTTS repository...");
291307
291503
  try {
291308
- if (existsSync53(repoDir)) {
291504
+ if (existsSync54(repoDir)) {
291309
291505
  const rmCmd = process.platform === "win32" ? `rmdir /s /q ${JSON.stringify(repoDir)}` : `rm -rf ${JSON.stringify(repoDir)}`;
291310
291506
  await this.asyncShell(rmCmd, 3e4);
291311
291507
  }
@@ -291394,7 +291590,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
291394
291590
  renderWarning(` Could not install system build deps: ${err instanceof Error ? err.message : String(err)}`);
291395
291591
  }
291396
291592
  }
291397
- const isJetson = isArm && (existsSync53("/etc/nv_tegra_release") || existsSync53("/usr/local/cuda/targets/aarch64-linux") || (process.env.JETSON_L4T_VERSION ?? "") !== "");
291593
+ const isJetson = isArm && (existsSync54("/etc/nv_tegra_release") || existsSync54("/usr/local/cuda/targets/aarch64-linux") || (process.env.JETSON_L4T_VERSION ?? "") !== "");
291398
291594
  const installSteps = isArm ? [
291399
291595
  // ARM: install individually so we get clear error messages per package.
291400
291596
  // ALL are fatal because LuxTTS hard-imports them (no lazy/optional imports).
@@ -291469,12 +291665,12 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
291469
291665
  }
291470
291666
  /** Auto-detect an existing clone reference in the refs directory */
291471
291667
  autoDetectCloneRef() {
291472
- if (this.luxttsCloneRef && existsSync53(this.luxttsCloneRef)) return;
291668
+ if (this.luxttsCloneRef && existsSync54(this.luxttsCloneRef)) return;
291473
291669
  const refsDir = luxttsCloneRefsDir();
291474
- if (!existsSync53(refsDir)) return;
291670
+ if (!existsSync54(refsDir)) return;
291475
291671
  for (const name10 of ["custom-clone.wav", "custom-clone.mp3", "glados-ref.wav", "overwatch-ref.wav"]) {
291476
291672
  const p2 = join69(refsDir, name10);
291477
- if (existsSync53(p2)) {
291673
+ if (existsSync54(p2)) {
291478
291674
  this.luxttsCloneRef = p2;
291479
291675
  return;
291480
291676
  }
@@ -291581,7 +291777,7 @@ if __name__ == '__main__':
291581
291777
  async ensureLuxttsDaemon() {
291582
291778
  if (this._luxttsDaemon && !this._luxttsDaemon.killed) return true;
291583
291779
  const venvPy = luxttsVenvPy();
291584
- if (!existsSync53(venvPy)) return false;
291780
+ if (!existsSync54(venvPy)) return false;
291585
291781
  return new Promise((resolve39) => {
291586
291782
  const env2 = { ...process.env, LUXTTS_REPO_PATH: luxttsRepoDir() };
291587
291783
  const daemon = nodeSpawn(venvPy, [luxttsInferScript()], {
@@ -291670,7 +291866,7 @@ if __name__ == '__main__':
291670
291866
  * Used by drainQueue's pre-fetch pipeline for gapless back-to-back playback.
291671
291867
  */
291672
291868
  async synthesizeLuxttsWav(text, speedFactor = 1) {
291673
- if (!this.luxttsCloneRef || !existsSync53(this.luxttsCloneRef)) return null;
291869
+ if (!this.luxttsCloneRef || !existsSync54(this.luxttsCloneRef)) return null;
291674
291870
  const cleaned = text.replace(/\*/g, "").trim();
291675
291871
  if (!cleaned) return null;
291676
291872
  const ready = await this.ensureLuxttsDaemon();
@@ -291687,14 +291883,14 @@ if __name__ == '__main__':
291687
291883
  } catch {
291688
291884
  return null;
291689
291885
  }
291690
- return existsSync53(wavPath) ? wavPath : null;
291886
+ return existsSync54(wavPath) ? wavPath : null;
291691
291887
  }
291692
291888
  /**
291693
291889
  * Post-process (fade-in, volume, pitch, stereo) and play a LuxTTS WAV file.
291694
291890
  * Cleans up the WAV file after playback.
291695
291891
  */
291696
291892
  async postProcessAndPlayLuxtts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
291697
- if (!existsSync53(wavPath)) return;
291893
+ if (!existsSync54(wavPath)) return;
291698
291894
  try {
291699
291895
  const wavData = readFileSync41(wavPath);
291700
291896
  if (wavData.length > 44) {
@@ -291790,7 +291986,7 @@ if __name__ == '__main__':
291790
291986
  * Used for Telegram voice messages and WebSocket streaming.
291791
291987
  */
291792
291988
  async synthesizeLuxttsToBuffer(text) {
291793
- if (!this.luxttsCloneRef || !existsSync53(this.luxttsCloneRef)) return null;
291989
+ if (!this.luxttsCloneRef || !existsSync54(this.luxttsCloneRef)) return null;
291794
291990
  const cleaned = text.replace(/\*/g, "").trim();
291795
291991
  if (!cleaned) return null;
291796
291992
  const ready = await this.ensureLuxttsDaemon();
@@ -291807,7 +292003,7 @@ if __name__ == '__main__':
291807
292003
  } catch {
291808
292004
  return null;
291809
292005
  }
291810
- if (!existsSync53(wavPath)) return null;
292006
+ if (!existsSync54(wavPath)) return null;
291811
292007
  try {
291812
292008
  const data = readFileSync41(wavPath);
291813
292009
  unlinkSync14(wavPath);
@@ -291828,7 +292024,7 @@ if __name__ == '__main__':
291828
292024
  "onnxruntime-node": "^1.21.0",
291829
292025
  "phonemizer": "^1.2.1"
291830
292026
  };
291831
- if (existsSync53(pkgPath)) {
292027
+ if (existsSync54(pkgPath)) {
291832
292028
  try {
291833
292029
  const existing = JSON.parse(readFileSync41(pkgPath, "utf8"));
291834
292030
  if (!existing.dependencies?.["phonemizer"]) {
@@ -291838,7 +292034,7 @@ if __name__ == '__main__':
291838
292034
  } catch {
291839
292035
  }
291840
292036
  }
291841
- if (!existsSync53(pkgPath)) {
292037
+ if (!existsSync54(pkgPath)) {
291842
292038
  writeFileSync25(pkgPath, JSON.stringify({
291843
292039
  name: "open-agents-voice",
291844
292040
  private: true,
@@ -291858,7 +292054,7 @@ if __name__ == '__main__':
291858
292054
  }
291859
292055
  };
291860
292056
  const onnxNodeModules = join69(voiceDir(), "node_modules", "onnxruntime-node");
291861
- const onnxInstalled = existsSync53(onnxNodeModules);
292057
+ const onnxInstalled = existsSync54(onnxNodeModules);
291862
292058
  if (onnxInstalled && !await probeOnnx()) {
291863
292059
  throw new Error(
291864
292060
  `Voice synthesis unavailable: ONNX runtime crashes on this CPU (${process.platform}-${arch2}). This is a known issue with some ARM SoCs where the CPU vendor is not recognized. Voice feedback will be disabled but all other features work normally.`
@@ -291917,16 +292113,16 @@ Error: ${err instanceof Error ? err.message : String(err)}`
291917
292113
  const dir = modelDir(id);
291918
292114
  const onnxPath = modelOnnxPath(id);
291919
292115
  const configPath2 = modelConfigPath(id);
291920
- if (existsSync53(onnxPath) && existsSync53(configPath2)) return;
292116
+ if (existsSync54(onnxPath) && existsSync54(configPath2)) return;
291921
292117
  mkdirSync25(dir, { recursive: true });
291922
- if (!existsSync53(configPath2)) {
292118
+ if (!existsSync54(configPath2)) {
291923
292119
  renderInfo(`Downloading ${model.label} voice config...`);
291924
292120
  const configResp = await fetch(model.configUrl);
291925
292121
  if (!configResp.ok) throw new Error(`Failed to download config: HTTP ${configResp.status}`);
291926
292122
  const configText = await configResp.text();
291927
292123
  writeFileSync25(configPath2, configText);
291928
292124
  }
291929
- if (!existsSync53(onnxPath)) {
292125
+ if (!existsSync54(onnxPath)) {
291930
292126
  renderInfo(`Downloading ${model.label} voice model (this may take a minute)...`);
291931
292127
  const onnxResp = await fetch(model.onnxUrl);
291932
292128
  if (!onnxResp.ok) throw new Error(`Failed to download model: HTTP ${onnxResp.status}`);
@@ -291959,7 +292155,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
291959
292155
  if (!this.ort) throw new Error("ONNX runtime not loaded");
291960
292156
  const onnxPath = modelOnnxPath(this.modelId);
291961
292157
  const configPath2 = modelConfigPath(this.modelId);
291962
- if (!existsSync53(onnxPath) || !existsSync53(configPath2)) {
292158
+ if (!existsSync54(onnxPath) || !existsSync54(configPath2)) {
291963
292159
  throw new Error(`Model files not found for ${this.modelId}`);
291964
292160
  }
291965
292161
  this.config = JSON.parse(readFileSync41(configPath2, "utf8"));
@@ -291989,7 +292185,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
291989
292185
  // packages/cli/src/tui/commands.ts
291990
292186
  import * as nodeOs from "node:os";
291991
292187
  import { execSync as nodeExecSync } from "node:child_process";
291992
- import { existsSync as existsSync54, readFileSync as readFileSync42, writeFileSync as writeFileSync26, mkdirSync as mkdirSync26, readdirSync as readdirSync14, statSync as statSync19, rmSync as rmSync2, appendFileSync as appendFileSync3 } from "node:fs";
292188
+ import { existsSync as existsSync55, readFileSync as readFileSync42, writeFileSync as writeFileSync26, mkdirSync as mkdirSync26, readdirSync as readdirSync14, statSync as statSync19, rmSync as rmSync2, appendFileSync as appendFileSync3 } from "node:fs";
291993
292189
  import { join as join70 } from "node:path";
291994
292190
  async function _immediateReregister(newUrl) {
291995
292191
  if (!_lastRegisteredSponsorPayload) return;
@@ -292504,7 +292700,7 @@ async function handleSlashCommand(input, ctx3) {
292504
292700
  renderInfo(out.split("\n").slice(0, 4).join("\n"));
292505
292701
  try {
292506
292702
  const pidFile = join70(ctx3.repoRoot ?? process.cwd(), ".oa", "nexus", "daemon.pid");
292507
- if (existsSync54(pidFile)) {
292703
+ if (existsSync55(pidFile)) {
292508
292704
  const pid = parseInt(readFileSync42(pidFile, "utf8").trim(), 10);
292509
292705
  if (pid > 0 && !registry2.daemons.has("Nexus")) {
292510
292706
  registry2.register({ name: "Nexus", pid, startedAt: Date.now(), status: "running" });
@@ -292811,7 +293007,7 @@ async function handleSlashCommand(input, ctx3) {
292811
293007
  if (shareType === "tool") {
292812
293008
  const toolDir = join70(ctx3.repoRoot, ".oa", "tools");
292813
293009
  const toolFile = join70(toolDir, shareName.endsWith(".json") ? shareName : `${shareName}.json`);
292814
- if (!existsSync54(toolFile)) {
293010
+ if (!existsSync55(toolFile)) {
292815
293011
  renderWarning(`Tool not found: ${toolFile}`);
292816
293012
  return "handled";
292817
293013
  }
@@ -292820,7 +293016,7 @@ async function handleSlashCommand(input, ctx3) {
292820
293016
  } else if (shareType === "skill") {
292821
293017
  const skillDir = join70(ctx3.repoRoot, ".oa", "skills", shareName);
292822
293018
  const skillFile = join70(skillDir, "SKILL.md");
292823
- if (!existsSync54(skillFile)) {
293019
+ if (!existsSync55(skillFile)) {
292824
293020
  renderWarning(`Skill not found: ${skillFile}`);
292825
293021
  return "handled";
292826
293022
  }
@@ -292862,7 +293058,7 @@ async function handleSlashCommand(input, ctx3) {
292862
293058
  const nexus = new NexusTool(ctx3.repoRoot);
292863
293059
  await nexus.execute({ action: "ipfs_pin", cid: importCid, source: "import" });
292864
293060
  const regFile = join70(ctx3.repoRoot, ".oa", "nexus", "ipfs", "cid-registry", "learning-cids.json");
292865
- if (existsSync54(regFile)) {
293061
+ if (existsSync55(regFile)) {
292866
293062
  const reg = JSON.parse(readFileSync42(regFile, "utf8"));
292867
293063
  const pinned = Object.values(reg).some((e2) => e2.cid === importCid && e2.pinned);
292868
293064
  if (pinned) {
@@ -292921,7 +293117,7 @@ async function handleSlashCommand(input, ctx3) {
292921
293117
  let heliaBlocks = 0;
292922
293118
  let heliaBytes = 0;
292923
293119
  try {
292924
- if (existsSync54(ipfsLocalDir)) {
293120
+ if (existsSync55(ipfsLocalDir)) {
292925
293121
  const files = readdirSync14(ipfsLocalDir).filter((f2) => f2.endsWith(".json"));
292926
293122
  ipfsFiles = files.length;
292927
293123
  for (const f2 of files) {
@@ -292932,7 +293128,7 @@ async function handleSlashCommand(input, ctx3) {
292932
293128
  }
292933
293129
  }
292934
293130
  const heliaBlockDir = join70(ipfsDir, "blocks");
292935
- if (existsSync54(heliaBlockDir)) {
293131
+ if (existsSync55(heliaBlockDir)) {
292936
293132
  const walkDir = (dir) => {
292937
293133
  for (const entry of readdirSync14(dir, { withFileTypes: true })) {
292938
293134
  if (entry.isDirectory()) walkDir(join70(dir, entry.name));
@@ -292956,7 +293152,7 @@ async function handleSlashCommand(input, ctx3) {
292956
293152
  lines.push(` Backend: ${heliaBlocks > 0 ? c3.green("helia-ipfs") : c3.yellow("sha256-local (Helia not initialized)")}`);
292957
293153
  try {
292958
293154
  const statusFile = join70(ctx3.repoRoot, ".oa", "nexus", "status.json");
292959
- if (existsSync54(statusFile)) {
293155
+ if (existsSync55(statusFile)) {
292960
293156
  const status = JSON.parse(readFileSync42(statusFile, "utf8"));
292961
293157
  if (status.peerId) {
292962
293158
  lines.push(`
@@ -292979,7 +293175,7 @@ async function handleSlashCommand(input, ctx3) {
292979
293175
  const idDir = join70(ctx3.repoRoot, ".oa", "identity");
292980
293176
  try {
292981
293177
  const stateFile = join70(idDir, "self-state.json");
292982
- if (existsSync54(stateFile)) {
293178
+ if (existsSync55(stateFile)) {
292983
293179
  const state = JSON.parse(readFileSync42(stateFile, "utf8"));
292984
293180
  lines.push(` Version: ${c3.bold("v" + (state.version ?? "?"))} Sessions: ${c3.bold(String(state.session_count ?? 0))}`);
292985
293181
  if (state.narrative_summary) {
@@ -292990,7 +293186,7 @@ async function handleSlashCommand(input, ctx3) {
292990
293186
  lines.push(` Traits: ${c3.dim(traits.slice(0, 60))}`);
292991
293187
  }
292992
293188
  const cidFile = join70(idDir, "cids.json");
292993
- if (existsSync54(cidFile)) {
293189
+ if (existsSync55(cidFile)) {
292994
293190
  const cids = JSON.parse(readFileSync42(cidFile, "utf8"));
292995
293191
  const lastCid = Array.isArray(cids) ? cids[cids.length - 1] : cids.latest;
292996
293192
  if (lastCid) lines.push(` Last CID: ${c3.dim(String(lastCid).slice(0, 50))}`);
@@ -293004,7 +293200,7 @@ async function handleSlashCommand(input, ctx3) {
293004
293200
  ${c3.bold("Memory Sentiment")}`);
293005
293201
  try {
293006
293202
  const metaFile = join70(ctx3.repoRoot, ".oa", "memory", "metabolism", "store.json");
293007
- if (existsSync54(metaFile)) {
293203
+ if (existsSync55(metaFile)) {
293008
293204
  const store2 = JSON.parse(readFileSync42(metaFile, "utf8"));
293009
293205
  const active = store2.filter((m2) => m2.type !== "quarantine");
293010
293206
  const recoveries = active.filter((m2) => m2.content?.startsWith("[recovery]")).length;
@@ -293024,7 +293220,7 @@ async function handleSlashCommand(input, ctx3) {
293024
293220
  }
293025
293221
  try {
293026
293222
  const dbPath = join70(ctx3.repoRoot, ".oa", "memory", "structured.db");
293027
- if (existsSync54(dbPath)) {
293223
+ if (existsSync55(dbPath)) {
293028
293224
  const { initDb: initDb2, closeDb: cDb, ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
293029
293225
  const db = initDb2(dbPath);
293030
293226
  const memStore = new ProceduralMemoryStore2(db);
@@ -293046,7 +293242,7 @@ async function handleSlashCommand(input, ctx3) {
293046
293242
  ${c3.bold("Storage Overview")}
293047
293243
  `);
293048
293244
  const oaDir = join70(ctx3.repoRoot, ".oa");
293049
- if (!existsSync54(oaDir)) {
293245
+ if (!existsSync55(oaDir)) {
293050
293246
  lines.push(` ${c3.dim("No .oa/ directory found.")}`);
293051
293247
  safeLog(lines.join("\n") + "\n");
293052
293248
  return "handled";
@@ -293122,7 +293318,7 @@ async function handleSlashCommand(input, ctx3) {
293122
293318
  return "handled";
293123
293319
  }
293124
293320
  const resolvedPath = join70(ctx3.repoRoot, filePath);
293125
- if (!existsSync54(resolvedPath)) {
293321
+ if (!existsSync55(resolvedPath)) {
293126
293322
  renderWarning(`File not found: ${resolvedPath}`);
293127
293323
  return "handled";
293128
293324
  }
@@ -293224,7 +293420,7 @@ async function handleSlashCommand(input, ctx3) {
293224
293420
  const fortemiSubCmd = (arg || "").trim().toLowerCase();
293225
293421
  const fortemiDir = join70(ctx3.repoRoot, "..", "fortemi-react");
293226
293422
  const altFortemiDir = join70(nodeOs.homedir(), "fortemi-react");
293227
- const fDir = existsSync54(fortemiDir) ? fortemiDir : existsSync54(altFortemiDir) ? altFortemiDir : null;
293423
+ const fDir = existsSync55(fortemiDir) ? fortemiDir : existsSync55(altFortemiDir) ? altFortemiDir : null;
293228
293424
  if (fortemiSubCmd === "start" || fortemiSubCmd === "") {
293229
293425
  if (!fDir) {
293230
293426
  renderWarning("fortemi-react not found adjacent or in home directory.");
@@ -293269,7 +293465,7 @@ async function handleSlashCommand(input, ctx3) {
293269
293465
  }
293270
293466
  if (fortemiSubCmd === "status") {
293271
293467
  const bridgeFile = join70(ctx3.repoRoot, ".oa", "fortemi-bridge.json");
293272
- if (!existsSync54(bridgeFile)) {
293468
+ if (!existsSync55(bridgeFile)) {
293273
293469
  renderInfo("Fortemi bridge: not connected. Run /fortemi start");
293274
293470
  return "handled";
293275
293471
  }
@@ -293293,14 +293489,14 @@ async function handleSlashCommand(input, ctx3) {
293293
293489
  lines.push(` Process: ${alive ? c3.green("running") : c3.yellow("not running")} (PID ${bridge.pid})`);
293294
293490
  lines.push(` HTTP: ${httpOk ? c3.green("connected") : c3.yellow("unreachable")}`);
293295
293491
  lines.push(` Started: ${bridge.startedAt}`);
293296
- lines.push(` JWT: ${existsSync54(bridge.jwtFile) ? c3.green("valid") : c3.yellow("missing")}`);
293492
+ lines.push(` JWT: ${existsSync55(bridge.jwtFile) ? c3.green("valid") : c3.yellow("missing")}`);
293297
293493
  lines.push("");
293298
293494
  safeLog(lines.join("\n"));
293299
293495
  return "handled";
293300
293496
  }
293301
293497
  if (fortemiSubCmd === "stop") {
293302
293498
  const bridgeFile = join70(ctx3.repoRoot, ".oa", "fortemi-bridge.json");
293303
- if (existsSync54(bridgeFile)) {
293499
+ if (existsSync55(bridgeFile)) {
293304
293500
  const bridge = JSON.parse(readFileSync42(bridgeFile, "utf8"));
293305
293501
  try {
293306
293502
  process.kill(bridge.pid, "SIGTERM");
@@ -294220,8 +294416,8 @@ The session corrections MUST become hard rules in the SKILL.md Rules section.`;
294220
294416
  if (!sponsorUrl && !sponsorPeerId) {
294221
294417
  _spLog("FAILED \u2014 no tunnelUrl and no peerId");
294222
294418
  _spLog(`nexusDir checked: ${join70(projectDir, ".oa", "nexus")}`);
294223
- _spLog(`status.json exists: ${existsSync54(join70(projectDir, ".oa", "nexus", "status.json"))}`);
294224
- _spLog(`daemon.pid exists: ${existsSync54(join70(projectDir, ".oa", "nexus", "daemon.pid"))}`);
294419
+ _spLog(`status.json exists: ${existsSync55(join70(projectDir, ".oa", "nexus", "status.json"))}`);
294420
+ _spLog(`daemon.pid exists: ${existsSync55(join70(projectDir, ".oa", "nexus", "daemon.pid"))}`);
294225
294421
  try {
294226
294422
  const _statusRaw = readFileSync42(join70(projectDir, ".oa", "nexus", "status.json"), "utf8");
294227
294423
  _spLog(`status.json content: ${_statusRaw.slice(0, 300)}`);
@@ -294248,7 +294444,7 @@ The session corrections MUST become hard rules in the SKILL.md Rules section.`;
294248
294444
  try {
294249
294445
  const { homedir: homedir27 } = __require("os");
294250
294446
  const namePath = __require("path").join(homedir27(), ".open-agents", "agent-name");
294251
- if (existsSync54(namePath)) sponsorName = readFileSync42(namePath, "utf8").trim();
294447
+ if (existsSync55(namePath)) sponsorName = readFileSync42(namePath, "utf8").trim();
294252
294448
  } catch {
294253
294449
  }
294254
294450
  if (!sponsorName) sponsorName = "OA Sponsor";
@@ -294324,7 +294520,7 @@ The session corrections MUST become hard rules in the SKILL.md Rules section.`;
294324
294520
  renderInfo("Sponsor wizard completed.");
294325
294521
  try {
294326
294522
  const nexusPidFile = join70(projectDir, ".oa", "nexus", "daemon.pid");
294327
- if (existsSync54(nexusPidFile)) {
294523
+ if (existsSync55(nexusPidFile)) {
294328
294524
  const nPid = parseInt(readFileSync42(nexusPidFile, "utf8").trim(), 10);
294329
294525
  if (nPid > 0) {
294330
294526
  registry2.register({ name: "Nexus", pid: nPid, startedAt: Date.now(), status: "running" });
@@ -295390,7 +295586,7 @@ async function showCohereDashboard(ctx3) {
295390
295586
  await ik.execute({ operation: "hydrate" });
295391
295587
  } else if (idResult.key === "history") {
295392
295588
  const snapDir = join70(ctx3.repoRoot, ".oa", "identity", "snapshots");
295393
- if (existsSync54(snapDir)) {
295589
+ if (existsSync55(snapDir)) {
295394
295590
  const snaps = readdirSync14(snapDir).filter((f2) => f2.endsWith(".json")).sort().reverse();
295395
295591
  const snapItems = snaps.slice(0, 20).map((f2) => ({
295396
295592
  key: f2,
@@ -296401,7 +296597,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
296401
296597
  const sponsorDir2 = join70(ctx3.repoRoot ?? process.cwd(), ".oa", "sponsor");
296402
296598
  const knownFile = join70(sponsorDir2, "known-sponsors.json");
296403
296599
  try {
296404
- if (existsSync54(knownFile)) {
296600
+ if (existsSync55(knownFile)) {
296405
296601
  const saved = JSON.parse(readFileSync42(knownFile, "utf8"));
296406
296602
  for (const s2 of saved) {
296407
296603
  if (!sponsors.some((sp) => sp.url === s2.url)) {
@@ -296553,7 +296749,7 @@ async function handleSponsoredEndpoint(ctx3, local) {
296553
296749
  const saveKey = selected.url || selected.peerId || selected.name;
296554
296750
  try {
296555
296751
  mkdirSync26(sponsorDir2, { recursive: true });
296556
- const existing = existsSync54(knownFile) ? JSON.parse(readFileSync42(knownFile, "utf8")) : [];
296752
+ const existing = existsSync55(knownFile) ? JSON.parse(readFileSync42(knownFile, "utf8")) : [];
296557
296753
  const updated = existing.filter((s2) => (s2.url || s2.peerId || s2.name) !== saveKey);
296558
296754
  updated.push(selected);
296559
296755
  writeFileSync26(knownFile, JSON.stringify(updated, null, 2), "utf8");
@@ -296677,7 +296873,7 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local) {
296677
296873
  }
296678
296874
  }
296679
296875
  async function handleParallel(arg, ctx3) {
296680
- const { execSync: execSync50 } = await import("node:child_process");
296876
+ const { execSync: execSync51 } = await import("node:child_process");
296681
296877
  const baseUrl = ctx3.config.backendUrl || "http://localhost:11434";
296682
296878
  const isRemote = ctx3.config.backendType === "nexus";
296683
296879
  if (isRemote) {
@@ -296701,7 +296897,7 @@ async function handleParallel(arg, ctx3) {
296701
296897
  }
296702
296898
  let systemdVal = "";
296703
296899
  try {
296704
- const out = execSync50("systemctl show ollama.service -p Environment 2>/dev/null || true", { encoding: "utf8" });
296900
+ const out = execSync51("systemctl show ollama.service -p Environment 2>/dev/null || true", { encoding: "utf8" });
296705
296901
  const match = out.match(/OLLAMA_NUM_PARALLEL=(\d+)/);
296706
296902
  if (match) systemdVal = match[1];
296707
296903
  } catch {
@@ -296729,7 +296925,7 @@ async function handleParallel(arg, ctx3) {
296729
296925
  }
296730
296926
  const isSystemd = (() => {
296731
296927
  try {
296732
- const out = execSync50("systemctl is-active ollama.service 2>/dev/null", { encoding: "utf8" }).trim();
296928
+ const out = execSync51("systemctl is-active ollama.service 2>/dev/null", { encoding: "utf8" }).trim();
296733
296929
  return out === "active" || out === "inactive";
296734
296930
  } catch {
296735
296931
  return false;
@@ -296743,10 +296939,10 @@ async function handleParallel(arg, ctx3) {
296743
296939
  const overrideContent = `[Service]
296744
296940
  Environment="OLLAMA_NUM_PARALLEL=${n2}"
296745
296941
  `;
296746
- execSync50(`sudo mkdir -p ${overrideDir}`, { stdio: "pipe" });
296747
- execSync50(`echo '${overrideContent}' | sudo tee ${overrideFile} > /dev/null`, { stdio: "pipe" });
296748
- execSync50("sudo systemctl daemon-reload", { stdio: "pipe" });
296749
- execSync50("sudo systemctl restart ollama.service", { stdio: "pipe" });
296942
+ execSync51(`sudo mkdir -p ${overrideDir}`, { stdio: "pipe" });
296943
+ execSync51(`echo '${overrideContent}' | sudo tee ${overrideFile} > /dev/null`, { stdio: "pipe" });
296944
+ execSync51("sudo systemctl daemon-reload", { stdio: "pipe" });
296945
+ execSync51("sudo systemctl restart ollama.service", { stdio: "pipe" });
296750
296946
  let ready = false;
296751
296947
  for (let i2 = 0; i2 < 30 && !ready; i2++) {
296752
296948
  await new Promise((r2) => setTimeout(r2, 500));
@@ -296772,7 +296968,7 @@ Environment="OLLAMA_NUM_PARALLEL=${n2}"
296772
296968
  renderInfo(`Setting OLLAMA_NUM_PARALLEL=${n2}...`);
296773
296969
  try {
296774
296970
  try {
296775
- execSync50("pkill -f 'ollama serve' 2>/dev/null || true", { stdio: "pipe" });
296971
+ execSync51("pkill -f 'ollama serve' 2>/dev/null || true", { stdio: "pipe" });
296776
296972
  } catch {
296777
296973
  }
296778
296974
  await new Promise((r2) => setTimeout(r2, 1e3));
@@ -296825,7 +297021,7 @@ async function handleUpdate(subcommand, ctx3) {
296825
297021
  const { createRequire: createRequire7 } = await import("node:module");
296826
297022
  const { fileURLToPath: fileURLToPath19 } = await import("node:url");
296827
297023
  const { dirname: dirname28, join: join92 } = await import("node:path");
296828
- const { existsSync: existsSync72 } = await import("node:fs");
297024
+ const { existsSync: existsSync73 } = await import("node:fs");
296829
297025
  const req2 = createRequire7(import.meta.url);
296830
297026
  const thisDir = dirname28(fileURLToPath19(import.meta.url));
296831
297027
  const candidates = [
@@ -296834,7 +297030,7 @@ async function handleUpdate(subcommand, ctx3) {
296834
297030
  join92(thisDir, "..", "..", "..", "package.json")
296835
297031
  ];
296836
297032
  for (const pkgPath of candidates) {
296837
- if (existsSync72(pkgPath)) {
297033
+ if (existsSync73(pkgPath)) {
296838
297034
  const pkg = req2(pkgPath);
296839
297035
  if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli") {
296840
297036
  currentVersion = pkg.version ?? "0.0.0";
@@ -297824,18 +298020,18 @@ async function showExposeDashboard(gateway, rl, ctx3) {
297824
298020
  const cmd = `/endpoint ${id} --auth ${gateway.authKey ?? ""}`;
297825
298021
  let copied = false;
297826
298022
  try {
297827
- const { execSync: execSync50 } = __require("node:child_process");
298023
+ const { execSync: execSync51 } = __require("node:child_process");
297828
298024
  const platform6 = process.platform;
297829
298025
  if (platform6 === "darwin") {
297830
- execSync50("pbcopy", { input: cmd, timeout: 3e3 });
298026
+ execSync51("pbcopy", { input: cmd, timeout: 3e3 });
297831
298027
  copied = true;
297832
298028
  } else if (platform6 === "win32") {
297833
- execSync50("clip", { input: cmd, timeout: 3e3 });
298029
+ execSync51("clip", { input: cmd, timeout: 3e3 });
297834
298030
  copied = true;
297835
298031
  } else {
297836
298032
  for (const tool of ["xclip -selection clipboard", "xsel --clipboard --input", "wl-copy"]) {
297837
298033
  try {
297838
- execSync50(tool, { input: cmd, timeout: 3e3, stdio: ["pipe", "pipe", "pipe"] });
298034
+ execSync51(tool, { input: cmd, timeout: 3e3, stdio: ["pipe", "pipe", "pipe"] });
297839
298035
  copied = true;
297840
298036
  break;
297841
298037
  } catch {
@@ -297928,9 +298124,9 @@ var init_commands = __esm({
297928
298124
  });
297929
298125
 
297930
298126
  // packages/cli/src/tui/project-context.ts
297931
- import { existsSync as existsSync55, readFileSync as readFileSync43, readdirSync as readdirSync15 } from "node:fs";
298127
+ import { existsSync as existsSync56, readFileSync as readFileSync43, readdirSync as readdirSync15 } from "node:fs";
297932
298128
  import { join as join71, basename as basename13 } from "node:path";
297933
- import { execSync as execSync45 } from "node:child_process";
298129
+ import { execSync as execSync46 } from "node:child_process";
297934
298130
  import { homedir as homedir22, platform as platform5, release } from "node:os";
297935
298131
  function getModelTier(modelName) {
297936
298132
  const m2 = modelName.toLowerCase();
@@ -297961,7 +298157,7 @@ function loadProjectMap(repoRoot) {
297961
298157
  initOaDirectory(repoRoot);
297962
298158
  }
297963
298159
  const mapPath2 = join71(repoRoot, OA_DIR, "context", "project-map.md");
297964
- if (existsSync55(mapPath2)) {
298160
+ if (existsSync56(mapPath2)) {
297965
298161
  try {
297966
298162
  const content = readFileSync43(mapPath2, "utf-8");
297967
298163
  return content;
@@ -297972,18 +298168,18 @@ function loadProjectMap(repoRoot) {
297972
298168
  }
297973
298169
  function getGitInfo(repoRoot) {
297974
298170
  try {
297975
- execSync45("git rev-parse --is-inside-work-tree", { cwd: repoRoot, stdio: "pipe" });
298171
+ execSync46("git rev-parse --is-inside-work-tree", { cwd: repoRoot, stdio: "pipe" });
297976
298172
  } catch {
297977
298173
  return "";
297978
298174
  }
297979
298175
  const lines = [];
297980
298176
  try {
297981
- const branch = execSync45("git branch --show-current", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
298177
+ const branch = execSync46("git branch --show-current", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
297982
298178
  if (branch) lines.push(`Branch: ${branch}`);
297983
298179
  } catch {
297984
298180
  }
297985
298181
  try {
297986
- const status = execSync45("git status --porcelain", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
298182
+ const status = execSync46("git status --porcelain", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
297987
298183
  if (status) {
297988
298184
  const changed = status.split("\n").length;
297989
298185
  lines.push(`Working tree: ${changed} changed file(s)`);
@@ -297993,7 +298189,7 @@ function getGitInfo(repoRoot) {
297993
298189
  } catch {
297994
298190
  }
297995
298191
  try {
297996
- const log22 = execSync45("git log --oneline -5 --no-decorate", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
298192
+ const log22 = execSync46("git log --oneline -5 --no-decorate", { cwd: repoRoot, encoding: "utf-8", stdio: "pipe" }).trim();
297997
298193
  if (log22) lines.push(`Recent commits:
297998
298194
  ${log22}`);
297999
298195
  } catch {
@@ -298006,7 +298202,7 @@ function loadMemoryContext(repoRoot) {
298006
298202
  const oaEntries = loadMemoryDir(oaMemDir, "project");
298007
298203
  if (oaEntries) sections.push(oaEntries);
298008
298204
  const legacyMemDir = join71(repoRoot, ".open-agents", "memory");
298009
- if (legacyMemDir !== oaMemDir && existsSync55(legacyMemDir)) {
298205
+ if (legacyMemDir !== oaMemDir && existsSync56(legacyMemDir)) {
298010
298206
  const legacyEntries = loadMemoryDir(legacyMemDir, "project/legacy");
298011
298207
  if (legacyEntries) sections.push(legacyEntries);
298012
298208
  }
@@ -298016,7 +298212,7 @@ function loadMemoryContext(repoRoot) {
298016
298212
  return sections.join("\n\n");
298017
298213
  }
298018
298214
  function loadMemoryDir(memDir, scope) {
298019
- if (!existsSync55(memDir)) return "";
298215
+ if (!existsSync56(memDir)) return "";
298020
298216
  const lines = [];
298021
298217
  try {
298022
298218
  const files = readdirSync15(memDir).filter((f2) => f2.endsWith(".json"));
@@ -299157,7 +299353,7 @@ __export(banner_exports, {
299157
299353
  saveBannerDesign: () => saveBannerDesign,
299158
299354
  setGridText: () => setGridText
299159
299355
  });
299160
- import { existsSync as existsSync56, readFileSync as readFileSync44, writeFileSync as writeFileSync27, mkdirSync as mkdirSync27 } from "node:fs";
299356
+ import { existsSync as existsSync57, readFileSync as readFileSync44, writeFileSync as writeFileSync27, mkdirSync as mkdirSync27 } from "node:fs";
299161
299357
  import { join as join72 } from "node:path";
299162
299358
  function generateMnemonic(seed) {
299163
299359
  let h = 2166136261;
@@ -299294,7 +299490,7 @@ function saveBannerDesign(workDir, design) {
299294
299490
  }
299295
299491
  function loadBannerDesign(workDir, id) {
299296
299492
  const file = join72(workDir, ".oa", "banners", `${id}.json`);
299297
- if (!existsSync56(file)) return null;
299493
+ if (!existsSync57(file)) return null;
299298
299494
  try {
299299
299495
  return JSON.parse(readFileSync44(file, "utf8"));
299300
299496
  } catch {
@@ -299303,7 +299499,7 @@ function loadBannerDesign(workDir, id) {
299303
299499
  }
299304
299500
  function listBannerDesigns(workDir) {
299305
299501
  const dir = join72(workDir, ".oa", "banners");
299306
- if (!existsSync56(dir)) return [];
299502
+ if (!existsSync57(dir)) return [];
299307
299503
  try {
299308
299504
  const { readdirSync: readdirSync26 } = __require("node:fs");
299309
299505
  return readdirSync26(dir).filter((f2) => f2.endsWith(".json")).map((f2) => f2.replace(".json", ""));
@@ -299610,12 +299806,12 @@ var init_banner = __esm({
299610
299806
  });
299611
299807
 
299612
299808
  // packages/cli/src/tui/carousel-descriptors.ts
299613
- import { existsSync as existsSync57, readFileSync as readFileSync45, writeFileSync as writeFileSync28, mkdirSync as mkdirSync28, readdirSync as readdirSync16 } from "node:fs";
299809
+ import { existsSync as existsSync58, readFileSync as readFileSync45, writeFileSync as writeFileSync28, mkdirSync as mkdirSync28, readdirSync as readdirSync16 } from "node:fs";
299614
299810
  import { join as join73, basename as basename14 } from "node:path";
299615
299811
  function loadToolProfile(repoRoot) {
299616
299812
  const filePath = join73(repoRoot, OA_DIR, "context", TOOL_PROFILE_FILE);
299617
299813
  try {
299618
- if (!existsSync57(filePath)) return null;
299814
+ if (!existsSync58(filePath)) return null;
299619
299815
  return JSON.parse(readFileSync45(filePath, "utf-8"));
299620
299816
  } catch {
299621
299817
  return null;
@@ -299681,7 +299877,7 @@ function weightedColor(profile) {
299681
299877
  function loadCachedDescriptors(repoRoot) {
299682
299878
  const filePath = join73(repoRoot, OA_DIR, "context", DESCRIPTOR_FILE);
299683
299879
  try {
299684
- if (!existsSync57(filePath)) return null;
299880
+ if (!existsSync58(filePath)) return null;
299685
299881
  const cached = JSON.parse(readFileSync45(filePath, "utf-8"));
299686
299882
  return cached.phrases.length > 0 ? cached.phrases : null;
299687
299883
  } catch {
@@ -299745,7 +299941,7 @@ function generateDescriptors(repoRoot) {
299745
299941
  function extractFromPackageJson(repoRoot, tags) {
299746
299942
  const pkgPath = join73(repoRoot, "package.json");
299747
299943
  try {
299748
- if (!existsSync57(pkgPath)) return;
299944
+ if (!existsSync58(pkgPath)) return;
299749
299945
  const pkg = JSON.parse(readFileSync45(pkgPath, "utf-8"));
299750
299946
  if (pkg.name && typeof pkg.name === "string") {
299751
299947
  const parts = pkg.name.replace(/^@/, "").split("/");
@@ -299787,7 +299983,7 @@ function extractFromManifests(repoRoot, tags) {
299787
299983
  { file: ".github/workflows", tag: "ci/cd" }
299788
299984
  ];
299789
299985
  for (const check of manifestChecks) {
299790
- if (existsSync57(join73(repoRoot, check.file))) {
299986
+ if (existsSync58(join73(repoRoot, check.file))) {
299791
299987
  tags.push(check.tag);
299792
299988
  }
299793
299989
  }
@@ -299811,7 +300007,7 @@ function extractFromSessions(repoRoot, tags) {
299811
300007
  function extractFromMemory(repoRoot, tags) {
299812
300008
  const memoryDir = join73(repoRoot, OA_DIR, "memory");
299813
300009
  try {
299814
- if (!existsSync57(memoryDir)) return;
300010
+ if (!existsSync58(memoryDir)) return;
299815
300011
  const files = readdirSync16(memoryDir).filter((f2) => f2.endsWith(".json"));
299816
300012
  for (const file of files) {
299817
300013
  const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
@@ -300625,14 +300821,14 @@ var init_edit_history = __esm({
300625
300821
  });
300626
300822
 
300627
300823
  // packages/cli/src/tui/promptLoader.ts
300628
- import { readFileSync as readFileSync46, existsSync as existsSync58 } from "node:fs";
300824
+ import { readFileSync as readFileSync46, existsSync as existsSync59 } from "node:fs";
300629
300825
  import { join as join75, dirname as dirname23 } from "node:path";
300630
300826
  import { fileURLToPath as fileURLToPath14 } from "node:url";
300631
300827
  function loadPrompt3(promptPath, vars) {
300632
300828
  let content = cache6.get(promptPath);
300633
300829
  if (content === void 0) {
300634
300830
  const fullPath = join75(PROMPTS_DIR3, promptPath);
300635
- if (!existsSync58(fullPath)) {
300831
+ if (!existsSync59(fullPath)) {
300636
300832
  throw new Error(`Prompt file not found: ${fullPath}`);
300637
300833
  }
300638
300834
  content = readFileSync46(fullPath, "utf-8");
@@ -300649,15 +300845,15 @@ var init_promptLoader3 = __esm({
300649
300845
  __dirname7 = dirname23(__filename5);
300650
300846
  devPath2 = join75(__dirname7, "..", "..", "prompts");
300651
300847
  publishedPath2 = join75(__dirname7, "..", "prompts");
300652
- PROMPTS_DIR3 = existsSync58(devPath2) ? devPath2 : publishedPath2;
300848
+ PROMPTS_DIR3 = existsSync59(devPath2) ? devPath2 : publishedPath2;
300653
300849
  cache6 = /* @__PURE__ */ new Map();
300654
300850
  }
300655
300851
  });
300656
300852
 
300657
300853
  // packages/cli/src/tui/dream-engine.ts
300658
- import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync29, readFileSync as readFileSync47, existsSync as existsSync59, readdirSync as readdirSync17 } from "node:fs";
300854
+ import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync29, readFileSync as readFileSync47, existsSync as existsSync60, readdirSync as readdirSync17 } from "node:fs";
300659
300855
  import { join as join76, basename as basename15 } from "node:path";
300660
- import { execSync as execSync46 } from "node:child_process";
300856
+ import { execSync as execSync47 } from "node:child_process";
300661
300857
  function setDreamWriteContent(fn) {
300662
300858
  _dreamWriteContent = fn;
300663
300859
  }
@@ -300670,7 +300866,7 @@ function dreamWrite(fn) {
300670
300866
  }
300671
300867
  function loadAutoresearchMemory(repoRoot) {
300672
300868
  const memoryPath = join76(repoRoot, ".oa", "memory", "autoresearch.json");
300673
- if (!existsSync59(memoryPath)) return "";
300869
+ if (!existsSync60(memoryPath)) return "";
300674
300870
  try {
300675
300871
  const raw = readFileSync47(memoryPath, "utf-8");
300676
300872
  const data = JSON.parse(raw);
@@ -300907,7 +301103,7 @@ var init_dream_engine = __esm({
300907
301103
  return { success: false, output: "", error: "Autoresearch mode: edits are confined to .oa/autoresearch/", durationMs: Date.now() - start2 };
300908
301104
  }
300909
301105
  try {
300910
- if (!existsSync59(targetPath)) {
301106
+ if (!existsSync60(targetPath)) {
300911
301107
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
300912
301108
  }
300913
301109
  let content = readFileSync47(targetPath, "utf-8");
@@ -300993,7 +301189,7 @@ var init_dream_engine = __esm({
300993
301189
  return { success: false, output: "", error: "Dream mode: edits are confined to .oa/dreams/", durationMs: Date.now() - start2 };
300994
301190
  }
300995
301191
  try {
300996
- if (!existsSync59(targetPath)) {
301192
+ if (!existsSync60(targetPath)) {
300997
301193
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
300998
301194
  }
300999
301195
  let content = readFileSync47(targetPath, "utf-8");
@@ -301031,7 +301227,7 @@ var init_dream_engine = __esm({
301031
301227
  }
301032
301228
  }
301033
301229
  try {
301034
- const output = execSync46(cmd, {
301230
+ const output = execSync47(cmd, {
301035
301231
  cwd: this.repoRoot,
301036
301232
  timeout: 3e4,
301037
301233
  encoding: "utf-8",
@@ -301890,17 +302086,17 @@ ${summaryResult}
301890
302086
  try {
301891
302087
  mkdirSync30(checkpointDir, { recursive: true });
301892
302088
  try {
301893
- const gitStatus = execSync46("git status --porcelain", {
302089
+ const gitStatus = execSync47("git status --porcelain", {
301894
302090
  cwd: this.repoRoot,
301895
302091
  encoding: "utf-8",
301896
302092
  timeout: 1e4
301897
302093
  });
301898
- const gitDiff = execSync46("git diff", {
302094
+ const gitDiff = execSync47("git diff", {
301899
302095
  cwd: this.repoRoot,
301900
302096
  encoding: "utf-8",
301901
302097
  timeout: 1e4
301902
302098
  });
301903
- const gitHash = execSync46("git rev-parse HEAD 2>/dev/null || echo 'no-git'", {
302099
+ const gitHash = execSync47("git rev-parse HEAD 2>/dev/null || echo 'no-git'", {
301904
302100
  cwd: this.repoRoot,
301905
302101
  encoding: "utf-8",
301906
302102
  timeout: 5e3
@@ -302457,7 +302653,7 @@ var init_bless_engine = __esm({
302457
302653
  });
302458
302654
 
302459
302655
  // packages/cli/src/tui/dmn-engine.ts
302460
- import { existsSync as existsSync60, readFileSync as readFileSync48, writeFileSync as writeFileSync30, mkdirSync as mkdirSync31, readdirSync as readdirSync18, unlinkSync as unlinkSync15 } from "node:fs";
302656
+ import { existsSync as existsSync61, readFileSync as readFileSync48, writeFileSync as writeFileSync30, mkdirSync as mkdirSync31, readdirSync as readdirSync18, unlinkSync as unlinkSync15 } from "node:fs";
302461
302657
  import { join as join77, basename as basename16 } from "node:path";
302462
302658
  function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities, competence, reflectionBuffer) {
302463
302659
  const competenceReport = competence.length > 0 ? competence.map((c7) => {
@@ -303200,7 +303396,7 @@ OUTPUT: Call task_complete with JSON:
303200
303396
  join77(this.repoRoot, ".open-agents", "memory")
303201
303397
  ];
303202
303398
  for (const dir of dirs) {
303203
- if (!existsSync60(dir)) continue;
303399
+ if (!existsSync61(dir)) continue;
303204
303400
  try {
303205
303401
  const files = readdirSync18(dir).filter((f2) => f2.endsWith(".json"));
303206
303402
  for (const f2 of files) {
@@ -303215,7 +303411,7 @@ OUTPUT: Call task_complete with JSON:
303215
303411
  // ── State persistence ─────────────────────────────────────────────────
303216
303412
  loadState() {
303217
303413
  const path5 = join77(this.stateDir, "state.json");
303218
- if (existsSync60(path5)) {
303414
+ if (existsSync61(path5)) {
303219
303415
  try {
303220
303416
  this.state = JSON.parse(readFileSync48(path5, "utf-8"));
303221
303417
  } catch {
@@ -303257,7 +303453,7 @@ OUTPUT: Call task_complete with JSON:
303257
303453
  });
303258
303454
 
303259
303455
  // packages/cli/src/tui/snr-engine.ts
303260
- import { existsSync as existsSync61, readdirSync as readdirSync19, readFileSync as readFileSync49 } from "node:fs";
303456
+ import { existsSync as existsSync62, readdirSync as readdirSync19, readFileSync as readFileSync49 } from "node:fs";
303261
303457
  import { join as join78, basename as basename17 } from "node:path";
303262
303458
  function computeDPrime(signalScores, noiseScores) {
303263
303459
  if (signalScores.length === 0 || noiseScores.length === 0) return 0;
@@ -303546,7 +303742,7 @@ Call task_complete with the JSON array when done.`,
303546
303742
  join78(this.repoRoot, ".open-agents", "memory")
303547
303743
  ];
303548
303744
  for (const dir of dirs) {
303549
- if (!existsSync61(dir)) continue;
303745
+ if (!existsSync62(dir)) continue;
303550
303746
  try {
303551
303747
  const files = readdirSync19(dir).filter((f2) => f2.endsWith(".json"));
303552
303748
  for (const f2 of files) {
@@ -305769,7 +305965,7 @@ var init_direct_input = __esm({
305769
305965
  });
305770
305966
 
305771
305967
  // packages/cli/src/api/audit-log.ts
305772
- import { mkdirSync as mkdirSync33, appendFileSync as appendFileSync5, readFileSync as readFileSync50, existsSync as existsSync63 } from "node:fs";
305968
+ import { mkdirSync as mkdirSync33, appendFileSync as appendFileSync5, readFileSync as readFileSync50, existsSync as existsSync64 } from "node:fs";
305773
305969
  import { join as join80 } from "node:path";
305774
305970
  function initAuditLog(oaDir) {
305775
305971
  auditDir = join80(oaDir, "audit");
@@ -305789,7 +305985,7 @@ function recordAudit(record) {
305789
305985
  }
305790
305986
  }
305791
305987
  function queryAudit(opts) {
305792
- if (!initialized || !existsSync63(auditFile)) return [];
305988
+ if (!initialized || !existsSync64(auditFile)) return [];
305793
305989
  try {
305794
305990
  const raw = readFileSync50(auditFile, "utf-8");
305795
305991
  const lines = raw.split("\n").filter(Boolean);
@@ -307111,7 +307307,7 @@ var init_auth_oidc = __esm({
307111
307307
 
307112
307308
  // packages/cli/src/api/chat-session.ts
307113
307309
  import { randomUUID as randomUUID4 } from "node:crypto";
307114
- import { existsSync as existsSync64, readFileSync as readFileSync51, readdirSync as readdirSync21 } from "node:fs";
307310
+ import { existsSync as existsSync65, readFileSync as readFileSync51, readdirSync as readdirSync21 } from "node:fs";
307115
307311
  import { join as join81 } from "node:path";
307116
307312
  function buildSystemPrompt(cwd4) {
307117
307313
  const parts = [];
@@ -307120,7 +307316,7 @@ function buildSystemPrompt(cwd4) {
307120
307316
  );
307121
307317
  parts.push(`\\nEnvironment: ${process.platform}, Node ${process.version}, CWD: ${cwd4}`);
307122
307318
  const diaryPath = join81(cwd4, ".oa", "context", "session-diary.md");
307123
- if (existsSync64(diaryPath)) {
307319
+ if (existsSync65(diaryPath)) {
307124
307320
  try {
307125
307321
  const diary = readFileSync51(diaryPath, "utf-8").slice(0, 1e3);
307126
307322
  parts.push(`\\nPrevious session history:\\n${diary}`);
@@ -307128,7 +307324,7 @@ function buildSystemPrompt(cwd4) {
307128
307324
  }
307129
307325
  }
307130
307326
  const memDir = join81(cwd4, ".oa", "memory");
307131
- if (existsSync64(memDir)) {
307327
+ if (existsSync65(memDir)) {
307132
307328
  try {
307133
307329
  const files = readdirSync21(memDir).filter((f2) => f2.endsWith(".json")).slice(0, 5);
307134
307330
  if (files.length > 0) {
@@ -307149,7 +307345,7 @@ function buildSystemPrompt(cwd4) {
307149
307345
  }
307150
307346
  for (const name10 of ["AGENTS.md", "OA.md", ".open-agents.md"]) {
307151
307347
  const p2 = join81(cwd4, name10);
307152
- if (existsSync64(p2)) {
307348
+ if (existsSync65(p2)) {
307153
307349
  try {
307154
307350
  const content = readFileSync51(p2, "utf-8").slice(0, 500);
307155
307351
  parts.push(`\\nProject instructions (${name10}):\\n${content}`);
@@ -307227,14 +307423,14 @@ var init_chat_session = __esm({
307227
307423
  });
307228
307424
 
307229
307425
  // packages/cli/src/api/usage-tracker.ts
307230
- import { mkdirSync as mkdirSync34, readFileSync as readFileSync52, writeFileSync as writeFileSync31, existsSync as existsSync65 } from "node:fs";
307426
+ import { mkdirSync as mkdirSync34, readFileSync as readFileSync52, writeFileSync as writeFileSync31, existsSync as existsSync66 } from "node:fs";
307231
307427
  import { join as join82 } from "node:path";
307232
307428
  function initUsageTracker(oaDir) {
307233
307429
  const dir = join82(oaDir, "usage");
307234
307430
  mkdirSync34(dir, { recursive: true });
307235
307431
  usageFile = join82(dir, "token-usage.json");
307236
307432
  try {
307237
- if (existsSync65(usageFile)) {
307433
+ if (existsSync66(usageFile)) {
307238
307434
  store = JSON.parse(readFileSync52(usageFile, "utf-8"));
307239
307435
  }
307240
307436
  } catch {
@@ -307299,7 +307495,7 @@ var init_usage_tracker = __esm({
307299
307495
  });
307300
307496
 
307301
307497
  // packages/cli/src/api/profiles.ts
307302
- import { existsSync as existsSync66, readFileSync as readFileSync53, writeFileSync as writeFileSync32, mkdirSync as mkdirSync35, readdirSync as readdirSync22, unlinkSync as unlinkSync17 } from "node:fs";
307498
+ import { existsSync as existsSync67, readFileSync as readFileSync53, writeFileSync as writeFileSync32, mkdirSync as mkdirSync35, readdirSync as readdirSync22, unlinkSync as unlinkSync17 } from "node:fs";
307303
307499
  import { join as join83 } from "node:path";
307304
307500
  import { homedir as homedir23 } from "node:os";
307305
307501
  import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes18, scryptSync as scryptSync3 } from "node:crypto";
@@ -307313,7 +307509,7 @@ function listProfiles(projectDir) {
307313
307509
  const result = [];
307314
307510
  const seen = /* @__PURE__ */ new Set();
307315
307511
  const projDir = projectProfileDir(projectDir);
307316
- if (existsSync66(projDir)) {
307512
+ if (existsSync67(projDir)) {
307317
307513
  for (const f2 of readdirSync22(projDir).filter((f3) => f3.endsWith(".json"))) {
307318
307514
  try {
307319
307515
  const raw = JSON.parse(readFileSync53(join83(projDir, f2), "utf8"));
@@ -307330,7 +307526,7 @@ function listProfiles(projectDir) {
307330
307526
  }
307331
307527
  }
307332
307528
  const globDir = globalProfileDir();
307333
- if (existsSync66(globDir)) {
307529
+ if (existsSync67(globDir)) {
307334
307530
  for (const f2 of readdirSync22(globDir).filter((f3) => f3.endsWith(".json"))) {
307335
307531
  const name10 = f2.replace(".json", "");
307336
307532
  if (seen.has(name10)) continue;
@@ -307352,7 +307548,7 @@ function loadProfile(name10, password, projectDir) {
307352
307548
  const sanitized = name10.replace(/[^a-zA-Z0-9_-]/g, "");
307353
307549
  const projPath = join83(projectProfileDir(projectDir), `${sanitized}.json`);
307354
307550
  const globPath = join83(globalProfileDir(), `${sanitized}.json`);
307355
- const filePath = existsSync66(projPath) ? projPath : existsSync66(globPath) ? globPath : null;
307551
+ const filePath = existsSync67(projPath) ? projPath : existsSync67(globPath) ? globPath : null;
307356
307552
  if (!filePath) return null;
307357
307553
  const raw = JSON.parse(readFileSync53(filePath, "utf8"));
307358
307554
  if (raw.encrypted === true) {
@@ -307379,7 +307575,7 @@ function deleteProfile(name10, scope = "global", projectDir) {
307379
307575
  const sanitized = name10.replace(/[^a-zA-Z0-9_-]/g, "");
307380
307576
  const dir = scope === "project" ? projectProfileDir(projectDir) : globalProfileDir();
307381
307577
  const filePath = join83(dir, `${sanitized}.json`);
307382
- if (existsSync66(filePath)) {
307578
+ if (existsSync67(filePath)) {
307383
307579
  unlinkSync17(filePath);
307384
307580
  return true;
307385
307581
  }
@@ -307493,8 +307689,8 @@ var init_profiles = __esm({
307493
307689
  });
307494
307690
 
307495
307691
  // packages/cli/src/docker.ts
307496
- import { execSync as execSync47, spawn as spawn23 } from "node:child_process";
307497
- import { existsSync as existsSync67, mkdirSync as mkdirSync36, writeFileSync as writeFileSync33 } from "node:fs";
307692
+ import { execSync as execSync48, spawn as spawn23 } from "node:child_process";
307693
+ import { existsSync as existsSync68, mkdirSync as mkdirSync36, writeFileSync as writeFileSync33 } from "node:fs";
307498
307694
  import { join as join84, resolve as resolve33, dirname as dirname24 } from "node:path";
307499
307695
  import { homedir as homedir24 } from "node:os";
307500
307696
  import { fileURLToPath as fileURLToPath15 } from "node:url";
@@ -307514,7 +307710,7 @@ function getDockerDir() {
307514
307710
  }
307515
307711
  function isDockerAvailable() {
307516
307712
  try {
307517
- execSync47("docker info", { stdio: "pipe", timeout: 1e4 });
307713
+ execSync48("docker info", { stdio: "pipe", timeout: 1e4 });
307518
307714
  return true;
307519
307715
  } catch {
307520
307716
  return false;
@@ -307522,7 +307718,7 @@ function isDockerAvailable() {
307522
307718
  }
307523
307719
  function isDockerInstalled() {
307524
307720
  try {
307525
- execSync47("docker --version", { stdio: "pipe", timeout: 5e3 });
307721
+ execSync48("docker --version", { stdio: "pipe", timeout: 5e3 });
307526
307722
  return true;
307527
307723
  } catch {
307528
307724
  return false;
@@ -307547,31 +307743,31 @@ async function ensureDocker() {
307547
307743
  }
307548
307744
  try {
307549
307745
  console.log("[oa-docker] Docker not found. Installing via get.docker.com...");
307550
- execSync47("curl -fsSL https://get.docker.com | sh", {
307746
+ execSync48("curl -fsSL https://get.docker.com | sh", {
307551
307747
  stdio: "inherit",
307552
307748
  timeout: 3e5
307553
307749
  });
307554
307750
  const user = process.env["USER"] || process.env["LOGNAME"];
307555
307751
  if (user) {
307556
307752
  try {
307557
- execSync47(`sudo usermod -aG docker ${user}`, { stdio: "pipe" });
307753
+ execSync48(`sudo usermod -aG docker ${user}`, { stdio: "pipe" });
307558
307754
  } catch {
307559
307755
  }
307560
307756
  }
307561
307757
  try {
307562
- execSync47("sudo systemctl start docker", { stdio: "pipe", timeout: 15e3 });
307758
+ execSync48("sudo systemctl start docker", { stdio: "pipe", timeout: 15e3 });
307563
307759
  } catch {
307564
307760
  }
307565
307761
  try {
307566
- execSync47("nvidia-smi", { stdio: "pipe", timeout: 5e3 });
307567
- const runtimes = execSync47("docker info --format '{{json .Runtimes}}'", {
307762
+ execSync48("nvidia-smi", { stdio: "pipe", timeout: 5e3 });
307763
+ const runtimes = execSync48("docker info --format '{{json .Runtimes}}'", {
307568
307764
  stdio: "pipe",
307569
307765
  timeout: 5e3
307570
307766
  }).toString();
307571
307767
  if (!runtimes.includes("nvidia")) {
307572
307768
  console.log("[oa-docker] NVIDIA GPU detected. Installing nvidia-container-toolkit...");
307573
307769
  try {
307574
- execSync47(`
307770
+ execSync48(`
307575
307771
  curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg 2>/dev/null
307576
307772
  curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list > /dev/null 2>&1
307577
307773
  sudo apt-get update -qq 2>/dev/null && sudo apt-get install -y -qq nvidia-container-toolkit 2>/dev/null || ( sudo dnf install -y nvidia-container-toolkit 2>/dev/null || sudo yum install -y nvidia-container-toolkit 2>/dev/null || true )
@@ -307601,7 +307797,7 @@ async function ensureDocker() {
307601
307797
  }
307602
307798
  async function ensureNvidiaToolkit() {
307603
307799
  try {
307604
- execSync47("nvidia-smi --query-gpu=name --format=csv,noheader", { stdio: "pipe", timeout: 5e3 });
307800
+ execSync48("nvidia-smi --query-gpu=name --format=csv,noheader", { stdio: "pipe", timeout: 5e3 });
307605
307801
  } catch {
307606
307802
  return { ok: false, message: "No NVIDIA GPU detected (nvidia-smi not found)" };
307607
307803
  }
@@ -307612,7 +307808,7 @@ async function ensureNvidiaToolkit() {
307612
307808
  return { ok: false, message: "Auto-install only supported on Linux. Install manually: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html" };
307613
307809
  }
307614
307810
  try {
307615
- execSync47(`
307811
+ execSync48(`
307616
307812
  curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg 2>/dev/null
307617
307813
  curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list > /dev/null 2>&1
307618
307814
  sudo apt-get update -qq 2>/dev/null && sudo apt-get install -y -qq nvidia-container-toolkit 2>/dev/null || ( sudo dnf install -y nvidia-container-toolkit 2>/dev/null || sudo yum install -y nvidia-container-toolkit 2>/dev/null || true )
@@ -307626,7 +307822,7 @@ async function ensureNvidiaToolkit() {
307626
307822
  }
307627
307823
  function isOaImageBuilt() {
307628
307824
  try {
307629
- const out = execSync47(`docker images -q ${OA_IMAGE}:${OA_IMAGE_TAG}`, {
307825
+ const out = execSync48(`docker images -q ${OA_IMAGE}:${OA_IMAGE_TAG}`, {
307630
307826
  stdio: "pipe",
307631
307827
  timeout: 5e3
307632
307828
  }).toString().trim();
@@ -307641,7 +307837,7 @@ async function ensureOaImage(force = false) {
307641
307837
  }
307642
307838
  let buildContext;
307643
307839
  const dockerDir = getDockerDir();
307644
- if (existsSync67(join84(dockerDir, "Dockerfile"))) {
307840
+ if (existsSync68(join84(dockerDir, "Dockerfile"))) {
307645
307841
  buildContext = dockerDir;
307646
307842
  } else {
307647
307843
  buildContext = join84(homedir24(), ".oa", "docker-build");
@@ -307650,7 +307846,7 @@ async function ensureOaImage(force = false) {
307650
307846
  }
307651
307847
  try {
307652
307848
  console.log(`[oa-docker] Building image ${OA_IMAGE}:${OA_IMAGE_TAG}...`);
307653
- execSync47(`docker build -t ${OA_IMAGE}:${OA_IMAGE_TAG} ${buildContext}`, {
307849
+ execSync48(`docker build -t ${OA_IMAGE}:${OA_IMAGE_TAG} ${buildContext}`, {
307654
307850
  stdio: "inherit",
307655
307851
  timeout: 6e5
307656
307852
  // 10 min
@@ -307724,11 +307920,11 @@ exec "$@"
307724
307920
  }
307725
307921
  function hasNvidiaGpu() {
307726
307922
  try {
307727
- execSync47("nvidia-smi --query-gpu=name --format=csv,noheader", {
307923
+ execSync48("nvidia-smi --query-gpu=name --format=csv,noheader", {
307728
307924
  stdio: "pipe",
307729
307925
  timeout: 5e3
307730
307926
  });
307731
- const runtimes = execSync47("docker info --format '{{json .Runtimes}}'", {
307927
+ const runtimes = execSync48("docker info --format '{{json .Runtimes}}'", {
307732
307928
  stdio: "pipe",
307733
307929
  timeout: 5e3
307734
307930
  }).toString();
@@ -307798,8 +307994,8 @@ import * as https3 from "node:https";
307798
307994
  import { createRequire as createRequire4 } from "node:module";
307799
307995
  import { fileURLToPath as fileURLToPath16 } from "node:url";
307800
307996
  import { dirname as dirname25, join as join85, resolve as resolve34 } from "node:path";
307801
- import { spawn as spawn24, execSync as execSync48 } from "node:child_process";
307802
- import { mkdirSync as mkdirSync37, writeFileSync as writeFileSync34, readFileSync as readFileSync54, readdirSync as readdirSync23, existsSync as existsSync68 } from "node:fs";
307997
+ import { spawn as spawn24, execSync as execSync49 } from "node:child_process";
307998
+ import { mkdirSync as mkdirSync37, writeFileSync as writeFileSync34, readFileSync as readFileSync54, readdirSync as readdirSync23, existsSync as existsSync69 } from "node:fs";
307803
307999
  import { randomBytes as randomBytes19, randomUUID as randomUUID5 } from "node:crypto";
307804
308000
  function getVersion3() {
307805
308001
  try {
@@ -307812,7 +308008,7 @@ function getVersion3() {
307812
308008
  ];
307813
308009
  for (const pkgPath of candidates) {
307814
308010
  try {
307815
- if (!existsSync68(pkgPath)) continue;
308011
+ if (!existsSync69(pkgPath)) continue;
307816
308012
  const pkg = require3(pkgPath);
307817
308013
  if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli" || pkg.name === "@open-agents/monorepo") {
307818
308014
  return pkg.version ?? "0.0.0";
@@ -308107,7 +308303,7 @@ function jobsDir() {
308107
308303
  }
308108
308304
  function loadJob(id) {
308109
308305
  const file = join85(jobsDir(), `${id}.json`);
308110
- if (!existsSync68(file)) return null;
308306
+ if (!existsSync69(file)) return null;
308111
308307
  try {
308112
308308
  return JSON.parse(readFileSync54(file, "utf-8"));
308113
308309
  } catch {
@@ -308116,7 +308312,7 @@ function loadJob(id) {
308116
308312
  }
308117
308313
  function listJobs() {
308118
308314
  const dir = jobsDir();
308119
- if (!existsSync68(dir)) return [];
308315
+ if (!existsSync69(dir)) return [];
308120
308316
  const files = readdirSync23(dir).filter((f2) => f2.endsWith(".json")).sort();
308121
308317
  const jobs = [];
308122
308318
  for (const file of files) {
@@ -308806,7 +309002,7 @@ function handleV1RunsDelete(res, id) {
308806
309002
  const containerName = `oa-${id}`;
308807
309003
  if (job.sandbox === "container") {
308808
309004
  try {
308809
- execSync48(`docker stop ${containerName}`, { timeout: 5e3, stdio: "ignore" });
309005
+ execSync49(`docker stop ${containerName}`, { timeout: 5e3, stdio: "ignore" });
308810
309006
  } catch {
308811
309007
  }
308812
309008
  }
@@ -309486,7 +309682,7 @@ function startApiServer(options2 = {}) {
309486
309682
  if (retentionDays > 0) {
309487
309683
  try {
309488
309684
  const jobsDir3 = join85(cwd4, ".oa", "jobs");
309489
- if (existsSync68(jobsDir3)) {
309685
+ if (existsSync69(jobsDir3)) {
309490
309686
  const cutoff = Date.now() - retentionDays * 864e5;
309491
309687
  for (const f2 of readdirSync23(jobsDir3)) {
309492
309688
  if (!f2.endsWith(".json")) continue;
@@ -309715,8 +309911,8 @@ import { resolve as resolve35, join as join86, dirname as dirname26, extname as
309715
309911
  import { createRequire as createRequire5 } from "node:module";
309716
309912
  import { fileURLToPath as fileURLToPath17 } from "node:url";
309717
309913
  import { readFileSync as readFileSync55, writeFileSync as writeFileSync35, appendFileSync as appendFileSync6, rmSync as rmSync4, readdirSync as readdirSync24, mkdirSync as mkdirSync38 } from "node:fs";
309718
- import { existsSync as existsSync69 } from "node:fs";
309719
- import { execSync as execSync49 } from "node:child_process";
309914
+ import { existsSync as existsSync70 } from "node:fs";
309915
+ import { execSync as execSync50 } from "node:child_process";
309720
309916
  import { homedir as homedir25 } from "node:os";
309721
309917
  function formatTimeAgo(date) {
309722
309918
  const seconds = Math.floor((Date.now() - date.getTime()) / 1e3);
@@ -309738,7 +309934,7 @@ function getVersion4() {
309738
309934
  join86(thisDir, "..", "..", "..", "package.json")
309739
309935
  ];
309740
309936
  for (const pkgPath of candidates) {
309741
- if (existsSync69(pkgPath)) {
309937
+ if (existsSync70(pkgPath)) {
309742
309938
  const pkg = require3(pkgPath);
309743
309939
  if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli" || pkg.name === "@open-agents/monorepo") {
309744
309940
  return pkg.version ?? "0.0.0";
@@ -309887,6 +310083,7 @@ function buildTools(repoRoot, config, contextWindowSize, modelTier) {
309887
310083
  new BluetoothScanTool(),
309888
310084
  new SdrScanTool(),
309889
310085
  new FlipperZeroTool(),
310086
+ new MeshtasticTool(),
309890
310087
  // Full OA sub-process — callbacks wired after runner + statusBar created
309891
310088
  (() => {
309892
310089
  _fullSubAgentToolRef = new FullSubAgentTool(repoRoot, config.model, config.backendUrl);
@@ -310242,7 +310439,7 @@ function gatherMemorySnippets(root) {
310242
310439
  join86(root, ".open-agents", "memory")
310243
310440
  ];
310244
310441
  for (const dir of dirs) {
310245
- if (!existsSync69(dir)) continue;
310442
+ if (!existsSync70(dir)) continue;
310246
310443
  try {
310247
310444
  for (const f2 of readdirSync24(dir).filter((f3) => f3.endsWith(".json"))) {
310248
310445
  const data = JSON.parse(readFileSync55(join86(dir, f2), "utf-8"));
@@ -310400,7 +310597,7 @@ ${metabolismMemories}
310400
310597
  }
310401
310598
  try {
310402
310599
  const archeFile = join86(repoRoot, ".oa", "arche", "variants.json");
310403
- if (existsSync69(archeFile)) {
310600
+ if (existsSync70(archeFile)) {
310404
310601
  const variants = JSON.parse(readFileSync55(archeFile, "utf8"));
310405
310602
  if (variants.length > 0) {
310406
310603
  let filtered = variants;
@@ -310571,7 +310768,7 @@ RULES:
310571
310768
  let identityInjection = "";
310572
310769
  try {
310573
310770
  const ikStateFile = join86(repoRoot, ".oa", "identity", "self-state.json");
310574
- if (existsSync69(ikStateFile)) {
310771
+ if (existsSync70(ikStateFile)) {
310575
310772
  const selfState = JSON.parse(readFileSync55(ikStateFile, "utf8"));
310576
310773
  const lines = [
310577
310774
  `[Identity State v${selfState.version}]`,
@@ -311303,7 +311500,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
311303
311500
  const ikDir = join86(repoRoot, ".oa", "identity");
311304
311501
  const ikFile = join86(ikDir, "self-state.json");
311305
311502
  let ikState;
311306
- if (existsSync69(ikFile)) {
311503
+ if (existsSync70(ikFile)) {
311307
311504
  ikState = JSON.parse(readFileSync55(ikFile, "utf8"));
311308
311505
  } else {
311309
311506
  mkdirSync38(ikDir, { recursive: true });
@@ -311382,7 +311579,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
311382
311579
  renderTaskIncomplete(result.turns, result.toolCalls, result.durationMs, tokens);
311383
311580
  try {
311384
311581
  const ikFile = join86(repoRoot, ".oa", "identity", "self-state.json");
311385
- if (existsSync69(ikFile)) {
311582
+ if (existsSync70(ikFile)) {
311386
311583
  const ikState = JSON.parse(readFileSync55(ikFile, "utf8"));
311387
311584
  if (!ikState.stats) ikState.stats = { queries_served: 0 };
311388
311585
  ikState.stats.queries_served = (ikState.stats.queries_served || 0) + 1;
@@ -311511,7 +311708,7 @@ async function startInteractive(config, repoPath) {
311511
311708
  try {
311512
311709
  const oaDir = join86(repoRoot, ".oa");
311513
311710
  const nexusPidFile = join86(oaDir, "nexus", "daemon.pid");
311514
- if (existsSync69(nexusPidFile)) {
311711
+ if (existsSync70(nexusPidFile)) {
311515
311712
  const pid = parseInt(readFileSync55(nexusPidFile, "utf8").trim(), 10);
311516
311713
  if (pid > 0) {
311517
311714
  try {
@@ -312281,7 +312478,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
312281
312478
  const MAX_HISTORY_LINES = 500;
312282
312479
  let savedHistory = [];
312283
312480
  try {
312284
- if (existsSync69(HISTORY_FILE)) {
312481
+ if (existsSync70(HISTORY_FILE)) {
312285
312482
  const raw = readFileSync55(HISTORY_FILE, "utf8").trim();
312286
312483
  if (raw) savedHistory = raw.split("\n").reverse();
312287
312484
  }
@@ -312589,7 +312786,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
312589
312786
  join86(repoRoot, ".oa", "nexus", "nexus-daemon.mjs"),
312590
312787
  join86(_hdir(), ".open-agents", ".oa", "nexus", "nexus-daemon.mjs")
312591
312788
  ]) {
312592
- if (existsSync69(dp)) try {
312789
+ if (existsSync70(dp)) try {
312593
312790
  _rmStale(dp);
312594
312791
  } catch {
312595
312792
  }
@@ -312601,7 +312798,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
312601
312798
  const _registerNexusDaemon = () => {
312602
312799
  try {
312603
312800
  const nexusPidFile = join86(repoRoot, ".oa", "nexus", "daemon.pid");
312604
- if (existsSync69(nexusPidFile)) {
312801
+ if (existsSync70(nexusPidFile)) {
312605
312802
  const nPid = parseInt(readFileSync55(nexusPidFile, "utf8").trim(), 10);
312606
312803
  if (nPid > 0 && !registry2.daemons.has("Nexus")) {
312607
312804
  registry2.register({ name: "Nexus", pid: nPid, startedAt: Date.now(), status: "running" });
@@ -312725,7 +312922,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
312725
312922
  const globalNamePath = join86(_hd(), ".open-agents", "agent-name");
312726
312923
  let agName = "";
312727
312924
  try {
312728
- if (existsSync69(globalNamePath)) agName = readFileSync55(globalNamePath, "utf8").trim();
312925
+ if (existsSync70(globalNamePath)) agName = readFileSync55(globalNamePath, "utf8").trim();
312729
312926
  } catch {
312730
312927
  }
312731
312928
  if (!agName) {
@@ -312757,7 +312954,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
312757
312954
  const savedSponsorsPath = join86(repoRoot, ".oa", "sponsor", "known-sponsors.json");
312758
312955
  let savedSponsors = [];
312759
312956
  try {
312760
- if (existsSync69(savedSponsorsPath)) {
312957
+ if (existsSync70(savedSponsorsPath)) {
312761
312958
  savedSponsors = JSON.parse(readFileSync55(savedSponsorsPath, "utf8"));
312762
312959
  const oneHourAgo = Date.now() - 36e5;
312763
312960
  savedSponsors = savedSponsors.filter((s2) => (s2.lastVerified || 0) > oneHourAgo);
@@ -313850,7 +314047,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
313850
314047
  if (!result.success) throw new Error(result.error || "Connect failed");
313851
314048
  try {
313852
314049
  const nexusPidFile = join86(repoRoot, ".oa", "nexus", "daemon.pid");
313853
- if (existsSync69(nexusPidFile)) {
314050
+ if (existsSync70(nexusPidFile)) {
313854
314051
  const pid = parseInt(readFileSync55(nexusPidFile, "utf8").trim(), 10);
313855
314052
  if (pid > 0) {
313856
314053
  registry2.register({
@@ -314039,13 +314236,13 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
314039
314236
  try {
314040
314237
  const nexusDir = join86(repoRoot, OA_DIR, "nexus");
314041
314238
  const pidFile = join86(nexusDir, "daemon.pid");
314042
- if (existsSync69(pidFile)) {
314239
+ if (existsSync70(pidFile)) {
314043
314240
  const pid = parseInt(readFileSync55(pidFile, "utf8").trim(), 10);
314044
314241
  if (pid > 0) {
314045
314242
  try {
314046
314243
  if (process.platform === "win32") {
314047
314244
  try {
314048
- execSync49(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
314245
+ execSync50(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
314049
314246
  } catch {
314050
314247
  }
314051
314248
  } else {
@@ -314066,13 +314263,13 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
314066
314263
  const voicePidFiles = ["luxtts-daemon.pid", "piper-daemon.pid"];
314067
314264
  for (const pf of voicePidFiles) {
314068
314265
  const pidPath = join86(voiceDir2, pf);
314069
- if (existsSync69(pidPath)) {
314266
+ if (existsSync70(pidPath)) {
314070
314267
  try {
314071
314268
  const pid = parseInt(readFileSync55(pidPath, "utf8").trim(), 10);
314072
314269
  if (pid > 0) {
314073
314270
  if (process.platform === "win32") {
314074
314271
  try {
314075
- execSync49(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
314272
+ execSync50(`taskkill /F /PID ${pid}`, { timeout: 5e3, stdio: "ignore" });
314076
314273
  } catch {
314077
314274
  }
314078
314275
  } else {
@@ -314089,11 +314286,11 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
314089
314286
  } catch {
314090
314287
  }
314091
314288
  try {
314092
- execSync49(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.5", { timeout: 3e3, stdio: "ignore" });
314289
+ execSync50(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.5", { timeout: 3e3, stdio: "ignore" });
314093
314290
  } catch {
314094
314291
  }
314095
314292
  const oaPath = join86(repoRoot, OA_DIR);
314096
- if (existsSync69(oaPath)) {
314293
+ if (existsSync70(oaPath)) {
314097
314294
  let deleted = false;
314098
314295
  for (let attempt = 0; attempt < 3; attempt++) {
314099
314296
  try {
@@ -314103,14 +314300,14 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
314103
314300
  } catch (err) {
314104
314301
  if (attempt < 2) {
314105
314302
  try {
314106
- execSync49(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.3", { timeout: 3e3, stdio: "ignore" });
314303
+ execSync50(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.3", { timeout: 3e3, stdio: "ignore" });
314107
314304
  } catch {
314108
314305
  }
314109
314306
  } else {
314110
314307
  writeContent(() => renderWarning(`Could not fully remove ${OA_DIR}/: ${err instanceof Error ? err.message : String(err)}`));
314111
314308
  if (process.platform === "win32") {
314112
314309
  try {
314113
- execSync49(`rd /s /q "${oaPath}"`, { timeout: 1e4, stdio: "ignore" });
314310
+ execSync50(`rd /s /q "${oaPath}"`, { timeout: 1e4, stdio: "ignore" });
314114
314311
  deleted = true;
314115
314312
  } catch {
314116
314313
  }
@@ -314177,16 +314374,16 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
314177
314374
  if (isPersonaPlexRunning2()) {
314178
314375
  const ppPidFile = join86(homedir25(), ".open-agents", "voice", "personaplex", "daemon.pid");
314179
314376
  const ppPortFile = join86(homedir25(), ".open-agents", "voice", "personaplex", "daemon.port");
314180
- if (existsSync69(ppPidFile)) {
314377
+ if (existsSync70(ppPidFile)) {
314181
314378
  const ppPid = parseInt(readFileSync55(ppPidFile, "utf8").trim(), 10);
314182
- const ppPort = existsSync69(ppPortFile) ? parseInt(readFileSync55(ppPortFile, "utf8").trim(), 10) : void 0;
314379
+ const ppPort = existsSync70(ppPortFile) ? parseInt(readFileSync55(ppPortFile, "utf8").trim(), 10) : void 0;
314183
314380
  if (ppPid > 0 && !registry2.daemons.has("PersonaPlex")) {
314184
314381
  registry2.register({ name: "PersonaPlex", pid: ppPid, port: ppPort, startedAt: Date.now(), status: "running" });
314185
314382
  }
314186
314383
  }
314187
314384
  }
314188
314385
  const nexusPidFile = join86(repoRoot, ".oa", "nexus", "daemon.pid");
314189
- if (existsSync69(nexusPidFile)) {
314386
+ if (existsSync70(nexusPidFile)) {
314190
314387
  const nPid = parseInt(readFileSync55(nexusPidFile, "utf8").trim(), 10);
314191
314388
  if (nPid > 0 && !registry2.daemons.has("Nexus")) {
314192
314389
  try {
@@ -314528,8 +314725,8 @@ Execute this skill now. Follow the behavioral guidance above.`;
314528
314725
  }
314529
314726
  }
314530
314727
  const cleanPath = input.replace(/^['"]|['"]$/g, "").trim();
314531
- const isImage = isImagePath(cleanPath) && existsSync69(resolve35(repoRoot, cleanPath));
314532
- const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync69(resolve35(repoRoot, cleanPath));
314728
+ const isImage = isImagePath(cleanPath) && existsSync70(resolve35(repoRoot, cleanPath));
314729
+ const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync70(resolve35(repoRoot, cleanPath));
314533
314730
  if (activeTask) {
314534
314731
  if (activeTask.runner.isPaused) {
314535
314732
  activeTask.runner.resume();
@@ -314757,7 +314954,7 @@ Summarize or analyze this transcription as appropriate.`;
314757
314954
 
314758
314955
  NEW TASK: ${fullInput}`;
314759
314956
  restoredSessionContext = null;
314760
- } else if (existsSync69(join86(repoRoot, ".oa", "context", "session-diary.md"))) {
314957
+ } else if (existsSync70(join86(repoRoot, ".oa", "context", "session-diary.md"))) {
314761
314958
  taskInput = `[Previous sessions exist \u2014 file_read(".oa/context/session-diary.md") to recall]
314762
314959
 
314763
314960
  ${fullInput}`;
@@ -315094,7 +315291,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
315094
315291
  const ikDir = join86(repoRoot, ".oa", "identity");
315095
315292
  const ikFile = join86(ikDir, "self-state.json");
315096
315293
  let ikState;
315097
- if (existsSync69(ikFile)) {
315294
+ if (existsSync70(ikFile)) {
315098
315295
  ikState = JSON.parse(readFileSync55(ikFile, "utf8"));
315099
315296
  } else {
315100
315297
  mkdirSync38(ikDir, { recursive: true });
@@ -315136,7 +315333,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
315136
315333
  const archeFile = join86(archeDir, "variants.json");
315137
315334
  let variants = [];
315138
315335
  try {
315139
- if (existsSync69(archeFile)) variants = JSON.parse(readFileSync55(archeFile, "utf8"));
315336
+ if (existsSync70(archeFile)) variants = JSON.parse(readFileSync55(archeFile, "utf8"));
315140
315337
  } catch {
315141
315338
  }
315142
315339
  variants.push({
@@ -315157,7 +315354,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
315157
315354
  }
315158
315355
  try {
315159
315356
  const metaFile = join86(repoRoot, ".oa", "memory", "metabolism", "store.json");
315160
- if (existsSync69(metaFile)) {
315357
+ if (existsSync70(metaFile)) {
315161
315358
  const store2 = JSON.parse(readFileSync55(metaFile, "utf8"));
315162
315359
  const surfaced = store2.filter((m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15).sort((a2, b) => b.scores.utility * b.scores.confidence - a2.scores.utility * a2.scores.confidence).slice(0, 5);
315163
315360
  let updated = false;
@@ -315243,7 +315440,7 @@ Rules:
315243
315440
  const storeFile = join86(metaDir, "store.json");
315244
315441
  let store2 = [];
315245
315442
  try {
315246
- if (existsSync69(storeFile)) store2 = JSON.parse(readFileSync55(storeFile, "utf8"));
315443
+ if (existsSync70(storeFile)) store2 = JSON.parse(readFileSync55(storeFile, "utf8"));
315247
315444
  } catch {
315248
315445
  }
315249
315446
  store2.push({
@@ -315268,7 +315465,7 @@ Rules:
315268
315465
  const cohereSettingsFile = join86(repoRoot, ".oa", "settings.json");
315269
315466
  let cohereActive = false;
315270
315467
  try {
315271
- if (existsSync69(cohereSettingsFile)) {
315468
+ if (existsSync70(cohereSettingsFile)) {
315272
315469
  const settings = JSON.parse(readFileSync55(cohereSettingsFile, "utf8"));
315273
315470
  cohereActive = settings.cohere === true;
315274
315471
  }
@@ -315276,7 +315473,7 @@ Rules:
315276
315473
  }
315277
315474
  if (cohereActive) {
315278
315475
  const metaFile = join86(repoRoot, ".oa", "memory", "metabolism", "store.json");
315279
- if (existsSync69(metaFile)) {
315476
+ if (existsSync70(metaFile)) {
315280
315477
  const store2 = JSON.parse(readFileSync55(metaFile, "utf8"));
315281
315478
  const latest = store2.filter((m2) => m2.sourceTrace === "trajectory-extraction" || m2.sourceTrace === "llm-trajectory-extraction").slice(-1)[0];
315282
315479
  if (latest && latest.scores?.confidence >= 0.6) {
@@ -315303,7 +315500,7 @@ Rules:
315303
315500
  } catch (err) {
315304
315501
  try {
315305
315502
  const ikFile = join86(repoRoot, ".oa", "identity", "self-state.json");
315306
- if (existsSync69(ikFile)) {
315503
+ if (existsSync70(ikFile)) {
315307
315504
  const ikState = JSON.parse(readFileSync55(ikFile, "utf8"));
315308
315505
  ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
315309
315506
  ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.05);
@@ -315312,7 +315509,7 @@ Rules:
315312
315509
  writeFileSync35(ikFile, JSON.stringify(ikState, null, 2));
315313
315510
  }
315314
315511
  const metaFile = join86(repoRoot, ".oa", "memory", "metabolism", "store.json");
315315
- if (existsSync69(metaFile)) {
315512
+ if (existsSync70(metaFile)) {
315316
315513
  const store2 = JSON.parse(readFileSync55(metaFile, "utf8"));
315317
315514
  const surfaced = store2.filter((m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15).sort((a2, b) => b.scores.utility * b.scores.confidence - a2.scores.utility * a2.scores.confidence).slice(0, 5);
315318
315515
  for (const item of surfaced) {
@@ -315328,7 +315525,7 @@ Rules:
315328
315525
  const archeFile = join86(archeDir, "variants.json");
315329
315526
  let variants = [];
315330
315527
  try {
315331
- if (existsSync69(archeFile)) variants = JSON.parse(readFileSync55(archeFile, "utf8"));
315528
+ if (existsSync70(archeFile)) variants = JSON.parse(readFileSync55(archeFile, "utf8"));
315332
315529
  } catch {
315333
315530
  }
315334
315531
  variants.push({
@@ -315425,7 +315622,7 @@ __export(run_exports, {
315425
315622
  });
315426
315623
  import { resolve as resolve36 } from "node:path";
315427
315624
  import { spawn as spawn25 } from "node:child_process";
315428
- import { mkdirSync as mkdirSync39, writeFileSync as writeFileSync36, readFileSync as readFileSync56, readdirSync as readdirSync25, existsSync as existsSync70 } from "node:fs";
315625
+ import { mkdirSync as mkdirSync39, writeFileSync as writeFileSync36, readFileSync as readFileSync56, readdirSync as readdirSync25, existsSync as existsSync71 } from "node:fs";
315429
315626
  import { randomBytes as randomBytes20 } from "node:crypto";
315430
315627
  import { join as join87 } from "node:path";
315431
315628
  function jobsDir2(repoPath) {
@@ -315579,7 +315776,7 @@ async function runBackground(task, config, opts) {
315579
315776
  function statusCommand(jobId, repoPath) {
315580
315777
  const dir = jobsDir2(repoPath);
315581
315778
  const file = join87(dir, `${jobId}.json`);
315582
- if (!existsSync70(file)) {
315779
+ if (!existsSync71(file)) {
315583
315780
  console.error(`Job not found: ${jobId}`);
315584
315781
  console.log(`Available jobs: oa jobs`);
315585
315782
  process.exit(1);
@@ -315837,13 +316034,13 @@ __export(index_repo_exports, {
315837
316034
  indexRepoCommand: () => indexRepoCommand
315838
316035
  });
315839
316036
  import { resolve as resolve37 } from "node:path";
315840
- import { existsSync as existsSync71, statSync as statSync21 } from "node:fs";
316037
+ import { existsSync as existsSync72, statSync as statSync21 } from "node:fs";
315841
316038
  import { cwd as cwd2 } from "node:process";
315842
316039
  async function indexRepoCommand(opts, _config3) {
315843
316040
  const repoRoot = resolve37(opts.repoPath ?? cwd2());
315844
316041
  printHeader("Index Repository");
315845
316042
  printInfo(`Indexing: ${repoRoot}`);
315846
- if (!existsSync71(repoRoot)) {
316043
+ if (!existsSync72(repoRoot)) {
315847
316044
  printError(`Path does not exist: ${repoRoot}`);
315848
316045
  process.exit(1);
315849
316046
  }