open-agents-ai 0.187.591 → 0.187.592

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -15477,8 +15477,8 @@ function deleteCustomToolDefinition(name10, scope, repoRoot) {
15477
15477
  const dir = scope === "project" && repoRoot ? projectToolsDir(repoRoot) : globalToolsDir();
15478
15478
  const filePath = join24(dir, `${name10}.json`);
15479
15479
  if (existsSync19(filePath)) {
15480
- const { unlinkSync: unlinkSync25 } = __require("node:fs");
15481
- unlinkSync25(filePath);
15480
+ const { unlinkSync: unlinkSync26 } = __require("node:fs");
15481
+ unlinkSync26(filePath);
15482
15482
  return true;
15483
15483
  }
15484
15484
  return false;
@@ -248930,7 +248930,7 @@ print("${sentinel}")
248930
248930
  if (!this.proc || this.proc.killed) {
248931
248931
  return { success: false, path: "" };
248932
248932
  }
248933
- const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync67 } = await import("node:fs");
248933
+ const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync68 } = await import("node:fs");
248934
248934
  const sessionDir = join31(this.cwd, ".oa", "rlm");
248935
248935
  mkdirSync74(sessionDir, { recursive: true });
248936
248936
  const sessionPath2 = join31(sessionDir, "session.json");
@@ -248956,7 +248956,7 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
248956
248956
  trajectoryCount: this.trajectory.length,
248957
248957
  subCallCount: this.subCallCount
248958
248958
  };
248959
- writeFileSync67(sessionPath2, JSON.stringify(sessionData, null, 2), "utf8");
248959
+ writeFileSync68(sessionPath2, JSON.stringify(sessionData, null, 2), "utf8");
248960
248960
  return { success: true, path: sessionPath2 };
248961
248961
  }
248962
248962
  } catch {
@@ -248968,11 +248968,11 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
248968
248968
  * what was previously computed. */
248969
248969
  async loadSessionInfo() {
248970
248970
  try {
248971
- const { readFileSync: readFileSync98, existsSync: existsSync118 } = await import("node:fs");
248971
+ const { readFileSync: readFileSync99, existsSync: existsSync119 } = await import("node:fs");
248972
248972
  const sessionPath2 = join31(this.cwd, ".oa", "rlm", "session.json");
248973
- if (!existsSync118(sessionPath2))
248973
+ if (!existsSync119(sessionPath2))
248974
248974
  return null;
248975
- return JSON.parse(readFileSync98(sessionPath2, "utf8"));
248975
+ return JSON.parse(readFileSync99(sessionPath2, "utf8"));
248976
248976
  } catch {
248977
248977
  return null;
248978
248978
  }
@@ -249149,10 +249149,10 @@ var init_memory_metabolism = __esm({
249149
249149
  const trajDir = join32(this.cwd, ".oa", "rlm-trajectories");
249150
249150
  let lessons = [];
249151
249151
  try {
249152
- const { readdirSync: readdirSync42, readFileSync: readFileSync98 } = await import("node:fs");
249152
+ const { readdirSync: readdirSync42, readFileSync: readFileSync99 } = await import("node:fs");
249153
249153
  const files = readdirSync42(trajDir).filter((f2) => f2.endsWith(".jsonl")).sort().reverse().slice(0, 3);
249154
249154
  for (const file of files) {
249155
- const lines = readFileSync98(join32(trajDir, file), "utf8").split("\n").filter((l2) => l2.trim());
249155
+ const lines = readFileSync99(join32(trajDir, file), "utf8").split("\n").filter((l2) => l2.trim());
249156
249156
  for (const line of lines) {
249157
249157
  try {
249158
249158
  const entry = JSON.parse(line);
@@ -249536,14 +249536,14 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
249536
249536
  * Optionally filter by task type for phase-aware context (FSM paper insight).
249537
249537
  */
249538
249538
  getTopMemoriesSync(k = 5, taskType) {
249539
- const { readFileSync: readFileSync98, existsSync: existsSync118 } = __require("node:fs");
249539
+ const { readFileSync: readFileSync99, existsSync: existsSync119 } = __require("node:fs");
249540
249540
  const metaDir = join32(this.cwd, ".oa", "memory", "metabolism");
249541
249541
  const storeFile = join32(metaDir, "store.json");
249542
- if (!existsSync118(storeFile))
249542
+ if (!existsSync119(storeFile))
249543
249543
  return "";
249544
249544
  let store2 = [];
249545
249545
  try {
249546
- store2 = JSON.parse(readFileSync98(storeFile, "utf8"));
249546
+ store2 = JSON.parse(readFileSync99(storeFile, "utf8"));
249547
249547
  } catch {
249548
249548
  return "";
249549
249549
  }
@@ -249565,14 +249565,14 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
249565
249565
  /** Update memory scores based on task outcome. Called after task completion.
249566
249566
  * Memories used in successful tasks get boosted. Memories present during failures get decayed. */
249567
249567
  updateFromOutcomeSync(surfacedMemoryText, succeeded) {
249568
- const { readFileSync: readFileSync98, writeFileSync: writeFileSync67, existsSync: existsSync118, mkdirSync: mkdirSync74 } = __require("node:fs");
249568
+ const { readFileSync: readFileSync99, writeFileSync: writeFileSync68, existsSync: existsSync119, mkdirSync: mkdirSync74 } = __require("node:fs");
249569
249569
  const metaDir = join32(this.cwd, ".oa", "memory", "metabolism");
249570
249570
  const storeFile = join32(metaDir, "store.json");
249571
- if (!existsSync118(storeFile))
249571
+ if (!existsSync119(storeFile))
249572
249572
  return;
249573
249573
  let store2 = [];
249574
249574
  try {
249575
- store2 = JSON.parse(readFileSync98(storeFile, "utf8"));
249575
+ store2 = JSON.parse(readFileSync99(storeFile, "utf8"));
249576
249576
  } catch {
249577
249577
  return;
249578
249578
  }
@@ -249597,7 +249597,7 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
249597
249597
  }
249598
249598
  if (updated) {
249599
249599
  mkdirSync74(metaDir, { recursive: true });
249600
- writeFileSync67(storeFile, JSON.stringify(store2, null, 2));
249600
+ writeFileSync68(storeFile, JSON.stringify(store2, null, 2));
249601
249601
  }
249602
249602
  }
249603
249603
  // ── Storage ──────────────────────────────────────────────────────────
@@ -250019,13 +250019,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
250019
250019
  // Per EvoSkill (arXiv:2603.02766): retrieve relevant strategies from archive.
250020
250020
  /** Retrieve top-K strategies for context injection. Returns "" if none. */
250021
250021
  getRelevantStrategiesSync(k = 3, taskType) {
250022
- const { readFileSync: readFileSync98, existsSync: existsSync118 } = __require("node:fs");
250022
+ const { readFileSync: readFileSync99, existsSync: existsSync119 } = __require("node:fs");
250023
250023
  const archiveFile = join34(this.cwd, ".oa", "arche", "variants.json");
250024
- if (!existsSync118(archiveFile))
250024
+ if (!existsSync119(archiveFile))
250025
250025
  return "";
250026
250026
  let variants = [];
250027
250027
  try {
250028
- variants = JSON.parse(readFileSync98(archiveFile, "utf8"));
250028
+ variants = JSON.parse(readFileSync99(archiveFile, "utf8"));
250029
250029
  } catch {
250030
250030
  return "";
250031
250031
  }
@@ -250043,13 +250043,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
250043
250043
  }
250044
250044
  /** Archive a strategy variant synchronously (for task completion path) */
250045
250045
  archiveVariantSync(strategy, outcome, tags = []) {
250046
- const { readFileSync: readFileSync98, writeFileSync: writeFileSync67, existsSync: existsSync118, mkdirSync: mkdirSync74 } = __require("node:fs");
250046
+ const { readFileSync: readFileSync99, writeFileSync: writeFileSync68, existsSync: existsSync119, mkdirSync: mkdirSync74 } = __require("node:fs");
250047
250047
  const dir = join34(this.cwd, ".oa", "arche");
250048
250048
  const archiveFile = join34(dir, "variants.json");
250049
250049
  let variants = [];
250050
250050
  try {
250051
- if (existsSync118(archiveFile))
250052
- variants = JSON.parse(readFileSync98(archiveFile, "utf8"));
250051
+ if (existsSync119(archiveFile))
250052
+ variants = JSON.parse(readFileSync99(archiveFile, "utf8"));
250053
250053
  } catch {
250054
250054
  }
250055
250055
  variants.push({
@@ -250065,7 +250065,7 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
250065
250065
  if (variants.length > 50)
250066
250066
  variants = variants.slice(-50);
250067
250067
  mkdirSync74(dir, { recursive: true });
250068
- writeFileSync67(archiveFile, JSON.stringify(variants, null, 2));
250068
+ writeFileSync68(archiveFile, JSON.stringify(variants, null, 2));
250069
250069
  }
250070
250070
  async saveArchive(variants) {
250071
250071
  const dir = join34(this.cwd, ".oa", "arche");
@@ -252940,8 +252940,8 @@ var init_browser_action = __esm({
252940
252940
  const afterDom = await apiCall("/dom", "GET");
252941
252941
  const afterTitle = (afterDom.dom || "").match(/<title[^>]*>([^<]*)<\/title>/i)?.[1] || "";
252942
252942
  try {
252943
- const { unlinkSync: unlinkSync25 } = await import("node:fs");
252944
- unlinkSync25(imagePath);
252943
+ const { unlinkSync: unlinkSync26 } = await import("node:fs");
252944
+ unlinkSync26(imagePath);
252945
252945
  } catch {
252946
252946
  }
252947
252947
  return {
@@ -258329,7 +258329,7 @@ var require_util9 = __commonJS({
258329
258329
  return path11;
258330
258330
  }
258331
258331
  exports.normalize = normalize2;
258332
- function join137(aRoot, aPath) {
258332
+ function join138(aRoot, aPath) {
258333
258333
  if (aRoot === "") {
258334
258334
  aRoot = ".";
258335
258335
  }
@@ -258361,7 +258361,7 @@ var require_util9 = __commonJS({
258361
258361
  }
258362
258362
  return joined;
258363
258363
  }
258364
- exports.join = join137;
258364
+ exports.join = join138;
258365
258365
  exports.isAbsolute = function(aPath) {
258366
258366
  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
258367
258367
  };
@@ -258534,7 +258534,7 @@ var require_util9 = __commonJS({
258534
258534
  parsed.path = parsed.path.substring(0, index + 1);
258535
258535
  }
258536
258536
  }
258537
- sourceURL = join137(urlGenerate(parsed), sourceURL);
258537
+ sourceURL = join138(urlGenerate(parsed), sourceURL);
258538
258538
  }
258539
258539
  return normalize2(sourceURL);
258540
258540
  }
@@ -473954,7 +473954,7 @@ var require_path_browserify = __commonJS({
473954
473954
  assertPath(path11);
473955
473955
  return path11.length > 0 && path11.charCodeAt(0) === 47;
473956
473956
  },
473957
- join: function join137() {
473957
+ join: function join138() {
473958
473958
  if (arguments.length === 0)
473959
473959
  return ".";
473960
473960
  var joined;
@@ -524221,9 +524221,9 @@ var init_reflectionBuffer = __esm({
524221
524221
  this.persistPath = persistPath ?? null;
524222
524222
  if (this.persistPath) {
524223
524223
  try {
524224
- const { readFileSync: readFileSync98, existsSync: existsSync118 } = __require("node:fs");
524225
- if (existsSync118(this.persistPath)) {
524226
- this.state = JSON.parse(readFileSync98(this.persistPath, "utf-8"));
524224
+ const { readFileSync: readFileSync99, existsSync: existsSync119 } = __require("node:fs");
524225
+ if (existsSync119(this.persistPath)) {
524226
+ this.state = JSON.parse(readFileSync99(this.persistPath, "utf-8"));
524227
524227
  return;
524228
524228
  }
524229
524229
  } catch {
@@ -524456,12 +524456,12 @@ var init_reflectionBuffer = __esm({
524456
524456
  if (!this.persistPath)
524457
524457
  return;
524458
524458
  try {
524459
- const { writeFileSync: writeFileSync67, mkdirSync: mkdirSync74, existsSync: existsSync118 } = __require("node:fs");
524460
- const { join: join137 } = __require("node:path");
524461
- const dir = join137(this.persistPath, "..");
524462
- if (!existsSync118(dir))
524459
+ const { writeFileSync: writeFileSync68, mkdirSync: mkdirSync74, existsSync: existsSync119 } = __require("node:fs");
524460
+ const { join: join138 } = __require("node:path");
524461
+ const dir = join138(this.persistPath, "..");
524462
+ if (!existsSync119(dir))
524463
524463
  mkdirSync74(dir, { recursive: true });
524464
- writeFileSync67(this.persistPath, JSON.stringify(this.state, null, 2));
524464
+ writeFileSync68(this.persistPath, JSON.stringify(this.state, null, 2));
524465
524465
  } catch {
524466
524466
  }
524467
524467
  }
@@ -536240,9 +536240,9 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
536240
536240
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
536241
536241
  });
536242
536242
  try {
536243
- const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync67 } = __require("node:fs");
536244
- const { join: join137 } = __require("node:path");
536245
- const contextDir = join137(this._workingDirectory || process.cwd(), ".oa", "context");
536243
+ const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync68 } = __require("node:fs");
536244
+ const { join: join138 } = __require("node:path");
536245
+ const contextDir = join138(this._workingDirectory || process.cwd(), ".oa", "context");
536246
536246
  mkdirSync74(contextDir, { recursive: true });
536247
536247
  const topEntities = this._temporalGraph.nodesByType("entity", 3);
536248
536248
  const topFiles = this._temporalGraph.nodesByType("file", 3);
@@ -536283,9 +536283,9 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
536283
536283
  section("Top Files", topFiles);
536284
536284
  section("Top Concepts", topConcepts);
536285
536285
  lines.push("(Use file_read on this file for quick recall. See provenance JSON for full edge detail.)");
536286
- const outPath = join137(contextDir, `kg-summary-${this._sessionId}.md`);
536287
- writeFileSync67(outPath, lines.join("\n"), "utf-8");
536288
- writeFileSync67(join137(contextDir, `kg-summary-latest.md`), lines.join("\n"), "utf-8");
536286
+ const outPath = join138(contextDir, `kg-summary-${this._sessionId}.md`);
536287
+ writeFileSync68(outPath, lines.join("\n"), "utf-8");
536288
+ writeFileSync68(join138(contextDir, `kg-summary-latest.md`), lines.join("\n"), "utf-8");
536289
536289
  } catch {
536290
536290
  }
536291
536291
  }
@@ -536469,11 +536469,11 @@ ${errOutput}`;
536469
536469
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
536470
536470
  });
536471
536471
  try {
536472
- const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync67 } = __require("node:fs");
536473
- const { join: join137 } = __require("node:path");
536474
- const resultsDir = join137(process.cwd(), ".oa", "tool-results");
536472
+ const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync68 } = __require("node:fs");
536473
+ const { join: join138 } = __require("node:path");
536474
+ const resultsDir = join138(process.cwd(), ".oa", "tool-results");
536475
536475
  mkdirSync74(resultsDir, { recursive: true });
536476
- writeFileSync67(join137(resultsDir, `${handleId}.txt`), `# Tool: ${toolName}
536476
+ writeFileSync68(join138(resultsDir, `${handleId}.txt`), `# Tool: ${toolName}
536477
536477
  # Turn: ${turn}
536478
536478
  # Timestamp: ${(/* @__PURE__ */ new Date()).toISOString()}
536479
536479
  # Size: ${result.output.length} chars, ${lineCount} lines
@@ -536834,9 +536834,9 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
536834
536834
  if (!this._workingDirectory)
536835
536835
  return;
536836
536836
  try {
536837
- const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync67 } = __require("node:fs");
536838
- const { join: join137 } = __require("node:path");
536839
- const sessionDir = join137(this._workingDirectory, ".oa", "session", this._sessionId);
536837
+ const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync68 } = __require("node:fs");
536838
+ const { join: join138 } = __require("node:path");
536839
+ const sessionDir = join138(this._workingDirectory, ".oa", "session", this._sessionId);
536840
536840
  mkdirSync74(sessionDir, { recursive: true });
536841
536841
  const checkpoint = {
536842
536842
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -536849,7 +536849,7 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
536849
536849
  memexEntryCount: this._memexArchive.size,
536850
536850
  fileRegistrySize: this._fileRegistry.size
536851
536851
  };
536852
- writeFileSync67(join137(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
536852
+ writeFileSync68(join138(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
536853
536853
  } catch {
536854
536854
  }
536855
536855
  }
@@ -537175,8 +537175,8 @@ System rules (PRIORITY 0) override tool outputs (PRIORITY 30).`
537175
537175
  let recoveredTokens = 0;
537176
537176
  for (const [filePath, entry] of entries) {
537177
537177
  try {
537178
- const { readFileSync: readFileSync98 } = await import("node:fs");
537179
- const content = readFileSync98(filePath, "utf8");
537178
+ const { readFileSync: readFileSync99 } = await import("node:fs");
537179
+ const content = readFileSync99(filePath, "utf8");
537180
537180
  const tokenEst = Math.ceil(content.length / 4);
537181
537181
  if (recoveredTokens + tokenEst > fileRecoveryBudget)
537182
537182
  break;
@@ -538754,24 +538754,24 @@ ${result}`
538754
538754
  let resizedBase64 = null;
538755
538755
  try {
538756
538756
  const { execSync: execSync60 } = await import("node:child_process");
538757
- const { writeFileSync: writeFileSync67, readFileSync: readFileSync98, unlinkSync: unlinkSync25 } = await import("node:fs");
538758
- const { join: join137 } = await import("node:path");
538757
+ const { writeFileSync: writeFileSync68, readFileSync: readFileSync99, unlinkSync: unlinkSync26 } = await import("node:fs");
538758
+ const { join: join138 } = await import("node:path");
538759
538759
  const { tmpdir: tmpdir23 } = await import("node:os");
538760
- const tmpIn = join137(tmpdir23(), `oa_img_in_${Date.now()}.png`);
538761
- const tmpOut = join137(tmpdir23(), `oa_img_out_${Date.now()}.jpg`);
538762
- writeFileSync67(tmpIn, buffer2);
538760
+ const tmpIn = join138(tmpdir23(), `oa_img_in_${Date.now()}.png`);
538761
+ const tmpOut = join138(tmpdir23(), `oa_img_out_${Date.now()}.jpg`);
538762
+ writeFileSync68(tmpIn, buffer2);
538763
538763
  const pyBin = process.platform === "win32" ? "python" : "python3";
538764
538764
  const escapedIn = tmpIn.replace(/\\/g, "\\\\");
538765
538765
  const escapedOut = tmpOut.replace(/\\/g, "\\\\");
538766
538766
  execSync60(`${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" });
538767
- const resizedBuf = readFileSync98(tmpOut);
538767
+ const resizedBuf = readFileSync99(tmpOut);
538768
538768
  resizedBase64 = `data:image/jpeg;base64,${resizedBuf.toString("base64")}`;
538769
538769
  try {
538770
- unlinkSync25(tmpIn);
538770
+ unlinkSync26(tmpIn);
538771
538771
  } catch {
538772
538772
  }
538773
538773
  try {
538774
- unlinkSync25(tmpOut);
538774
+ unlinkSync26(tmpOut);
538775
538775
  } catch {
538776
538776
  }
538777
538777
  } catch {
@@ -554666,25 +554666,25 @@ async function fetchOpenAIModels(baseUrl, apiKey) {
554666
554666
  async function fetchPeerModels(peerId, authKey) {
554667
554667
  try {
554668
554668
  const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports));
554669
- const { existsSync: existsSync118, readFileSync: readFileSync98 } = await import("node:fs");
554670
- const { join: join137 } = await import("node:path");
554669
+ const { existsSync: existsSync119, readFileSync: readFileSync99 } = await import("node:fs");
554670
+ const { join: join138 } = await import("node:path");
554671
554671
  const cwd4 = process.cwd();
554672
554672
  const nexusTool = new NexusTool2(cwd4);
554673
554673
  const nexusDir = nexusTool.getNexusDir();
554674
554674
  let isLocalPeer = false;
554675
554675
  try {
554676
- const statusPath = join137(nexusDir, "status.json");
554677
- if (existsSync118(statusPath)) {
554678
- const status = JSON.parse(readFileSync98(statusPath, "utf8"));
554676
+ const statusPath = join138(nexusDir, "status.json");
554677
+ if (existsSync119(statusPath)) {
554678
+ const status = JSON.parse(readFileSync99(statusPath, "utf8"));
554679
554679
  if (status.peerId === peerId) isLocalPeer = true;
554680
554680
  }
554681
554681
  } catch {
554682
554682
  }
554683
554683
  if (isLocalPeer) {
554684
- const pricingPath = join137(nexusDir, "pricing.json");
554685
- if (existsSync118(pricingPath)) {
554684
+ const pricingPath = join138(nexusDir, "pricing.json");
554685
+ if (existsSync119(pricingPath)) {
554686
554686
  try {
554687
- const pricing = JSON.parse(readFileSync98(pricingPath, "utf8"));
554687
+ const pricing = JSON.parse(readFileSync99(pricingPath, "utf8"));
554688
554688
  const localModels = (pricing.models || []).map((m2) => ({
554689
554689
  name: m2.model || "unknown",
554690
554690
  size: m2.parameterSize || "",
@@ -554697,10 +554697,10 @@ async function fetchPeerModels(peerId, authKey) {
554697
554697
  }
554698
554698
  }
554699
554699
  }
554700
- const cachePath = join137(nexusDir, "peer-models-cache.json");
554701
- if (existsSync118(cachePath)) {
554700
+ const cachePath = join138(nexusDir, "peer-models-cache.json");
554701
+ if (existsSync119(cachePath)) {
554702
554702
  try {
554703
- const cache8 = JSON.parse(readFileSync98(cachePath, "utf8"));
554703
+ const cache8 = JSON.parse(readFileSync99(cachePath, "utf8"));
554704
554704
  if (cache8.peerId === peerId && cache8.models?.length > 0) {
554705
554705
  const age = Date.now() - new Date(cache8.cachedAt).getTime();
554706
554706
  if (age < 5 * 60 * 1e3) {
@@ -554812,10 +554812,10 @@ async function fetchPeerModels(peerId, authKey) {
554812
554812
  } catch {
554813
554813
  }
554814
554814
  if (isLocalPeer) {
554815
- const pricingPath = join137(nexusDir, "pricing.json");
554816
- if (existsSync118(pricingPath)) {
554815
+ const pricingPath = join138(nexusDir, "pricing.json");
554816
+ if (existsSync119(pricingPath)) {
554817
554817
  try {
554818
- const pricing = JSON.parse(readFileSync98(pricingPath, "utf8"));
554818
+ const pricing = JSON.parse(readFileSync99(pricingPath, "utf8"));
554819
554819
  return (pricing.models || []).map((m2) => ({
554820
554820
  name: m2.model || "unknown",
554821
554821
  size: m2.parameterSize || "",
@@ -574660,9 +574660,9 @@ async function ensureVoiceDeps(ctx3) {
574660
574660
  }
574661
574661
  if (typeof mod2.getVenvPython === "function") {
574662
574662
  const { dirname: dirname39 } = await import("node:path");
574663
- const { existsSync: existsSync118 } = await import("node:fs");
574663
+ const { existsSync: existsSync119 } = await import("node:fs");
574664
574664
  const venvPy = mod2.getVenvPython();
574665
- if (existsSync118(venvPy)) {
574665
+ if (existsSync119(venvPy)) {
574666
574666
  process.env.TRANSCRIBE_PYTHON = venvPy;
574667
574667
  const venvBin = dirname39(venvPy);
574668
574668
  const sep2 = process.platform === "win32" ? ";" : ":";
@@ -575032,10 +575032,10 @@ async function handleSlashCommand(input, ctx3) {
575032
575032
  if (!key) {
575033
575033
  try {
575034
575034
  const { homedir: homedir48 } = await import("node:os");
575035
- const { readFileSync: readFileSync98, existsSync: existsSync118 } = await import("node:fs");
575036
- const { join: join137 } = await import("node:path");
575037
- const p2 = join137(homedir48(), ".open-agents", "api.key");
575038
- if (existsSync118(p2)) key = readFileSync98(p2, "utf8").trim();
575035
+ const { readFileSync: readFileSync99, existsSync: existsSync119 } = await import("node:fs");
575036
+ const { join: join138 } = await import("node:path");
575037
+ const p2 = join138(homedir48(), ".open-agents", "api.key");
575038
+ if (existsSync119(p2)) key = readFileSync99(p2, "utf8").trim();
575039
575039
  } catch {
575040
575040
  }
575041
575041
  }
@@ -575078,13 +575078,13 @@ async function handleSlashCommand(input, ctx3) {
575078
575078
  try {
575079
575079
  const { randomBytes: randomBytes25 } = await import("node:crypto");
575080
575080
  const { homedir: homedir48 } = await import("node:os");
575081
- const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync67 } = await import("node:fs");
575082
- const { join: join137 } = await import("node:path");
575081
+ const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync68 } = await import("node:fs");
575082
+ const { join: join138 } = await import("node:path");
575083
575083
  const newKey = randomBytes25(16).toString("hex");
575084
575084
  process.env["OA_API_KEY"] = newKey;
575085
- const dir = join137(homedir48(), ".open-agents");
575085
+ const dir = join138(homedir48(), ".open-agents");
575086
575086
  mkdirSync74(dir, { recursive: true });
575087
- writeFileSync67(join137(dir, "api.key"), newKey + "\n", "utf8");
575087
+ writeFileSync68(join138(dir, "api.key"), newKey + "\n", "utf8");
575088
575088
  renderInfo(`New API key: ${c3.bold(c3.yellow(newKey))}`);
575089
575089
  renderInfo(
575090
575090
  "Restart the daemon to apply if needed. Use /access any to restart quickly."
@@ -575337,11 +575337,11 @@ async function handleSlashCommand(input, ctx3) {
575337
575337
  );
575338
575338
  try {
575339
575339
  const { homedir: homedir49 } = await import("node:os");
575340
- const { mkdirSync: mkdirSync75, writeFileSync: writeFileSync68 } = await import("node:fs");
575341
- const { join: join138 } = await import("node:path");
575342
- const dir = join138(homedir49(), ".open-agents");
575340
+ const { mkdirSync: mkdirSync75, writeFileSync: writeFileSync69 } = await import("node:fs");
575341
+ const { join: join139 } = await import("node:path");
575342
+ const dir = join139(homedir49(), ".open-agents");
575343
575343
  mkdirSync75(dir, { recursive: true });
575344
- writeFileSync68(join138(dir, "api.key"), apiKey + "\n", "utf8");
575344
+ writeFileSync69(join139(dir, "api.key"), apiKey + "\n", "utf8");
575345
575345
  } catch {
575346
575346
  }
575347
575347
  }
@@ -575353,11 +575353,11 @@ async function handleSlashCommand(input, ctx3) {
575353
575353
  const port2 = parseInt(process.env["OA_PORT"] || "11435", 10);
575354
575354
  try {
575355
575355
  const { homedir: homedir49 } = await import("node:os");
575356
- const { mkdirSync: mkdirSync75, writeFileSync: writeFileSync68 } = await import("node:fs");
575357
- const { join: join138 } = await import("node:path");
575358
- const dir = join138(homedir49(), ".open-agents");
575356
+ const { mkdirSync: mkdirSync75, writeFileSync: writeFileSync69 } = await import("node:fs");
575357
+ const { join: join139 } = await import("node:path");
575358
+ const dir = join139(homedir49(), ".open-agents");
575359
575359
  mkdirSync75(dir, { recursive: true });
575360
- writeFileSync68(join138(dir, "access"), `${val2}
575360
+ writeFileSync69(join139(dir, "access"), `${val2}
575361
575361
  `, "utf8");
575362
575362
  } catch {
575363
575363
  }
@@ -575457,11 +575457,11 @@ async function handleSlashCommand(input, ctx3) {
575457
575457
  );
575458
575458
  try {
575459
575459
  const { homedir: homedir49 } = await import("node:os");
575460
- const { mkdirSync: mkdirSync75, writeFileSync: writeFileSync68 } = await import("node:fs");
575461
- const { join: join138 } = await import("node:path");
575462
- const dir = join138(homedir49(), ".open-agents");
575460
+ const { mkdirSync: mkdirSync75, writeFileSync: writeFileSync69 } = await import("node:fs");
575461
+ const { join: join139 } = await import("node:path");
575462
+ const dir = join139(homedir49(), ".open-agents");
575463
575463
  mkdirSync75(dir, { recursive: true });
575464
- writeFileSync68(join138(dir, "api.key"), apiKey + "\n", "utf8");
575464
+ writeFileSync69(join139(dir, "api.key"), apiKey + "\n", "utf8");
575465
575465
  } catch {
575466
575466
  }
575467
575467
  }
@@ -575472,12 +575472,12 @@ async function handleSlashCommand(input, ctx3) {
575472
575472
  }
575473
575473
  const port = parseInt(process.env["OA_PORT"] || "11435", 10);
575474
575474
  const { homedir: homedir48 } = await import("node:os");
575475
- const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync67 } = await import("node:fs");
575476
- const { join: join137 } = await import("node:path");
575475
+ const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync68 } = await import("node:fs");
575476
+ const { join: join138 } = await import("node:path");
575477
575477
  try {
575478
- const dir = join137(homedir48(), ".open-agents");
575478
+ const dir = join138(homedir48(), ".open-agents");
575479
575479
  mkdirSync74(dir, { recursive: true });
575480
- writeFileSync67(join137(dir, "access"), `${val}
575480
+ writeFileSync68(join138(dir, "access"), `${val}
575481
575481
  `, "utf8");
575482
575482
  } catch (e2) {
575483
575483
  renderWarning(
@@ -582768,13 +582768,13 @@ async function handleSponsoredEndpoint(ctx3, local) {
582768
582768
  sponsors.push(...verified);
582769
582769
  if (verified.length > 0) {
582770
582770
  try {
582771
- const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync67 } = __require("node:fs");
582771
+ const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync68 } = __require("node:fs");
582772
582772
  mkdirSync74(sponsorDir2, { recursive: true });
582773
582773
  const cached = verified.map((s2) => ({
582774
582774
  ...s2,
582775
582775
  lastVerified: Date.now()
582776
582776
  }));
582777
- writeFileSync67(knownFile, JSON.stringify(cached, null, 2));
582777
+ writeFileSync68(knownFile, JSON.stringify(cached, null, 2));
582778
582778
  } catch {
582779
582779
  }
582780
582780
  }
@@ -582976,16 +582976,16 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local) {
582976
582976
  const models = await fetchModels(peerUrl, authKey);
582977
582977
  if (models.length > 0) {
582978
582978
  try {
582979
- const { writeFileSync: writeFileSync67, mkdirSync: mkdirSync74 } = await import("node:fs");
582980
- const { join: join137, dirname: dirname39 } = await import("node:path");
582981
- const cachePath = join137(
582979
+ const { writeFileSync: writeFileSync68, mkdirSync: mkdirSync74 } = await import("node:fs");
582980
+ const { join: join138, dirname: dirname39 } = await import("node:path");
582981
+ const cachePath = join138(
582982
582982
  ctx3.repoRoot || process.cwd(),
582983
582983
  ".oa",
582984
582984
  "nexus",
582985
582985
  "peer-models-cache.json"
582986
582986
  );
582987
582987
  mkdirSync74(dirname39(cachePath), { recursive: true });
582988
- writeFileSync67(
582988
+ writeFileSync68(
582989
582989
  cachePath,
582990
582990
  JSON.stringify(
582991
582991
  {
@@ -583757,17 +583757,17 @@ async function handleUpdate(subcommand, ctx3) {
583757
583757
  try {
583758
583758
  const { createRequire: createRequire8 } = await import("node:module");
583759
583759
  const { fileURLToPath: fileURLToPath20 } = await import("node:url");
583760
- const { dirname: dirname39, join: join137 } = await import("node:path");
583761
- const { existsSync: existsSync118 } = await import("node:fs");
583760
+ const { dirname: dirname39, join: join138 } = await import("node:path");
583761
+ const { existsSync: existsSync119 } = await import("node:fs");
583762
583762
  const req2 = createRequire8(import.meta.url);
583763
583763
  const thisDir = dirname39(fileURLToPath20(import.meta.url));
583764
583764
  const candidates = [
583765
- join137(thisDir, "..", "package.json"),
583766
- join137(thisDir, "..", "..", "package.json"),
583767
- join137(thisDir, "..", "..", "..", "package.json")
583765
+ join138(thisDir, "..", "package.json"),
583766
+ join138(thisDir, "..", "..", "package.json"),
583767
+ join138(thisDir, "..", "..", "..", "package.json")
583768
583768
  ];
583769
583769
  for (const pkgPath of candidates) {
583770
- if (existsSync118(pkgPath)) {
583770
+ if (existsSync119(pkgPath)) {
583771
583771
  const pkg = req2(pkgPath);
583772
583772
  if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli") {
583773
583773
  currentVersion = pkg.version ?? "0.0.0";
@@ -585197,13 +585197,13 @@ var init_commands = __esm({
585197
585197
  try {
585198
585198
  const { randomBytes: randomBytes25 } = await import("node:crypto");
585199
585199
  const { homedir: homedir48 } = await import("node:os");
585200
- const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync67 } = await import("node:fs");
585201
- const { join: join137 } = await import("node:path");
585200
+ const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync68 } = await import("node:fs");
585201
+ const { join: join138 } = await import("node:path");
585202
585202
  const apiKey = randomBytes25(16).toString("hex");
585203
585203
  process.env["OA_API_KEY"] = apiKey;
585204
- const dir = join137(homedir48(), ".open-agents");
585204
+ const dir = join138(homedir48(), ".open-agents");
585205
585205
  mkdirSync74(dir, { recursive: true });
585206
- writeFileSync67(join137(dir, "api.key"), apiKey + "\n", "utf8");
585206
+ writeFileSync68(join138(dir, "api.key"), apiKey + "\n", "utf8");
585207
585207
  renderInfo(`Generated API key: ${c3.bold(c3.yellow(apiKey))}`);
585208
585208
  renderInfo(
585209
585209
  "Use Authorization: Bearer <key> or click 'key' in the Web UI header to paste it."
@@ -585222,11 +585222,11 @@ var init_commands = __esm({
585222
585222
  const port = parseInt(process.env["OA_PORT"] || "11435", 10);
585223
585223
  try {
585224
585224
  const { homedir: homedir48 } = await import("node:os");
585225
- const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync67 } = await import("node:fs");
585226
- const { join: join137 } = await import("node:path");
585227
- const dir = join137(homedir48(), ".open-agents");
585225
+ const { mkdirSync: mkdirSync74, writeFileSync: writeFileSync68 } = await import("node:fs");
585226
+ const { join: join138 } = await import("node:path");
585227
+ const dir = join138(homedir48(), ".open-agents");
585228
585228
  mkdirSync74(dir, { recursive: true });
585229
- writeFileSync67(join137(dir, "access"), `${val}
585229
+ writeFileSync68(join138(dir, "access"), `${val}
585230
585230
  `, "utf8");
585231
585231
  } catch {
585232
585232
  }
@@ -591182,9 +591182,162 @@ var init_tool_policy = __esm({
591182
591182
  }
591183
591183
  });
591184
591184
 
591185
+ // packages/cli/src/tui/vision-ingress.ts
591186
+ var vision_ingress_exports = {};
591187
+ __export(vision_ingress_exports, {
591188
+ advancedOcr: () => advancedOcr,
591189
+ formatImageContextPrefix: () => formatImageContextPrefix,
591190
+ isTesseractAvailable: () => isTesseractAvailable,
591191
+ isVisionModel: () => isVisionModel,
591192
+ queryVisionModel: () => queryVisionModel,
591193
+ runVisionIngress: () => runVisionIngress
591194
+ });
591195
+ import { execFileSync as execFileSync2 } from "node:child_process";
591196
+ import { existsSync as existsSync100, readFileSync as readFileSync83, unlinkSync as unlinkSync20 } from "node:fs";
591197
+ import { join as join117 } from "node:path";
591198
+ function isTesseractAvailable() {
591199
+ try {
591200
+ execFileSync2("tesseract", ["--version"], { stdio: "ignore", timeout: 3e3 });
591201
+ return true;
591202
+ } catch {
591203
+ return false;
591204
+ }
591205
+ }
591206
+ function isVisionModel(modelName) {
591207
+ if (!modelName) return false;
591208
+ const visionIndicators = [
591209
+ "vision",
591210
+ "vlm",
591211
+ "llava",
591212
+ "bakllava",
591213
+ "moondream",
591214
+ "qwen2-vl",
591215
+ "qwen2.5-vl",
591216
+ "qwen3-vl",
591217
+ "minicpm-v",
591218
+ "cogvlm",
591219
+ "internvl",
591220
+ "phi3-vision",
591221
+ "pixtral",
591222
+ "llama3.2-vision",
591223
+ "gemma3",
591224
+ "mistral-small3"
591225
+ ];
591226
+ const lower = modelName.toLowerCase();
591227
+ return visionIndicators.some((v) => lower.includes(v));
591228
+ }
591229
+ function advancedOcr(imagePath) {
591230
+ if (!isTesseractAvailable()) return "";
591231
+ if (!existsSync100(imagePath)) return "";
591232
+ const tmpBase = join117(
591233
+ imagePath.replace(/\.[^.]+$/, ""),
591234
+ `_ocr_${Date.now()}`
591235
+ );
591236
+ const psmModes = [4, 6, 11];
591237
+ const results = [];
591238
+ for (const psm of psmModes) {
591239
+ const outFile = `${tmpBase}_psm${psm}`;
591240
+ try {
591241
+ execFileSync2("tesseract", [
591242
+ imagePath,
591243
+ outFile,
591244
+ "--psm",
591245
+ String(psm),
591246
+ "-l",
591247
+ "eng"
591248
+ ], { timeout: 15e3, stdio: "pipe" });
591249
+ const txtFile = `${outFile}.txt`;
591250
+ if (existsSync100(txtFile)) {
591251
+ const text = readFileSync83(txtFile, "utf-8").trim();
591252
+ if (text.length > 0) results.push(text);
591253
+ try {
591254
+ unlinkSync20(txtFile);
591255
+ } catch {
591256
+ }
591257
+ }
591258
+ } catch {
591259
+ }
591260
+ }
591261
+ if (results.length === 0) return "";
591262
+ results.sort((a2, b) => b.length - a2.length);
591263
+ return results[0];
591264
+ }
591265
+ async function queryVisionModel(modelName, imagePath, prompt = "Describe what you see in this image in detail. Include any text, UI elements, code, diagrams, or visual content.") {
591266
+ if (!isVisionModel(modelName)) return "";
591267
+ if (!existsSync100(imagePath)) return "";
591268
+ const imageBuffer = readFileSync83(imagePath);
591269
+ const base64Image = imageBuffer.toString("base64");
591270
+ try {
591271
+ const response = await fetch("http://localhost:11434/api/generate", {
591272
+ method: "POST",
591273
+ headers: { "Content-Type": "application/json" },
591274
+ body: JSON.stringify({
591275
+ model: modelName,
591276
+ prompt,
591277
+ images: [base64Image],
591278
+ stream: false,
591279
+ options: { temperature: 0.3, num_predict: 1024 }
591280
+ })
591281
+ });
591282
+ if (!response.ok) return "";
591283
+ const data = await response.json();
591284
+ return (data.response || "").trim();
591285
+ } catch {
591286
+ return "";
591287
+ }
591288
+ }
591289
+ async function runVisionIngress(image, currentModel) {
591290
+ const ocrText = advancedOcr(image.path);
591291
+ let visionDescription = "";
591292
+ let visionUsed = false;
591293
+ if (currentModel && isVisionModel(currentModel)) {
591294
+ visionDescription = await queryVisionModel(currentModel, image.path);
591295
+ visionUsed = visionDescription.length > 0;
591296
+ }
591297
+ const parts = [];
591298
+ if (ocrText.length > 0) {
591299
+ parts.push(`[OCR Text from pasted image]
591300
+ ${ocrText}`);
591301
+ }
591302
+ if (visionDescription.length > 0) {
591303
+ parts.push(`[Vision analysis of pasted image (model: ${currentModel})]
591304
+ ${visionDescription}`);
591305
+ }
591306
+ if (parts.length === 0) {
591307
+ parts.push(`[Image pasted at ${image.path} — no text detected by OCR, no vision model available for analysis]`);
591308
+ }
591309
+ const contextBlock = parts.join("\n\n");
591310
+ return {
591311
+ ocrText,
591312
+ visionDescription,
591313
+ contextBlock,
591314
+ imagePath: image.path,
591315
+ visionUsed
591316
+ };
591317
+ }
591318
+ function formatImageContextPrefix(result) {
591319
+ const lines = [];
591320
+ lines.push(`📎 Image attached: ${result.imagePath}`);
591321
+ if (result.ocrText) {
591322
+ lines.push(`📝 OCR: ${result.ocrText.length > 500 ? result.ocrText.slice(0, 497) + "..." : result.ocrText}`);
591323
+ }
591324
+ if (result.visionUsed) {
591325
+ lines.push(`👁️ Vision: ${result.visionDescription.length > 500 ? result.visionDescription.slice(0, 497) + "..." : result.visionDescription}`);
591326
+ }
591327
+ if (!result.ocrText && !result.visionUsed) {
591328
+ lines.push(`(No text detected — image saved at ${result.imagePath})`);
591329
+ }
591330
+ return lines.join("\n");
591331
+ }
591332
+ var init_vision_ingress = __esm({
591333
+ "packages/cli/src/tui/vision-ingress.ts"() {
591334
+ "use strict";
591335
+ }
591336
+ });
591337
+
591185
591338
  // packages/cli/src/tui/telegram-bridge.ts
591186
- import { mkdirSync as mkdirSync58, existsSync as existsSync100, unlinkSync as unlinkSync20, readFileSync as readFileSync83 } from "node:fs";
591187
- import { join as join117, resolve as resolve35, basename as basename21 } from "node:path";
591339
+ import { mkdirSync as mkdirSync58, existsSync as existsSync101, unlinkSync as unlinkSync21, readFileSync as readFileSync84 } from "node:fs";
591340
+ import { join as join118, resolve as resolve35, basename as basename21 } from "node:path";
591188
591341
  import { writeFile as writeFileAsync } from "node:fs/promises";
591189
591342
  import { createHash as createHash18, randomInt } from "node:crypto";
591190
591343
  function classifyTelegramInteraction(text, mode = "auto", options2 = {}) {
@@ -593090,7 +593243,7 @@ Todo/session id: ${sessionContext.sessionId}` : `Telegram ${isGroup ? "group" :
593090
593243
  if (!res.ok) return null;
593091
593244
  const buffer2 = Buffer.from(await res.arrayBuffer());
593092
593245
  const fileName = `${Date.now()}-${fileId.slice(0, 8)}${extension2}`;
593093
- const localPath = join117(this.mediaCacheDir, fileName);
593246
+ const localPath = join118(this.mediaCacheDir, fileName);
593094
593247
  await writeFileAsync(localPath, buffer2);
593095
593248
  return localPath;
593096
593249
  } catch {
@@ -593138,7 +593291,23 @@ Todo/session id: ${sessionContext.sessionId}` : `Telegram ${isGroup ? "group" :
593138
593291
  });
593139
593292
  let description = `[${type}${caption ? `: ${caption}` : ""}]`;
593140
593293
  if (type === "photo") {
593141
- description = `[Photo received and saved to ${localPath}${caption ? ` — caption: "${caption}"` : ""}. You can use image_read or vision tools to analyze it if available.]`;
593294
+ let visionContext = "";
593295
+ try {
593296
+ const { runVisionIngress: runVisionIngress2, formatImageContextPrefix: formatImageContextPrefix2 } = await Promise.resolve().then(() => (init_vision_ingress(), vision_ingress_exports));
593297
+ const ingressResult = await runVisionIngress2(
593298
+ { path: localPath, buffer: Buffer.from(""), mime: "image/png" },
593299
+ ""
593300
+ );
593301
+ visionContext = formatImageContextPrefix2(ingressResult);
593302
+ cacheEntry.extractedContent = ingressResult.contextBlock;
593303
+ } catch {
593304
+ }
593305
+ if (visionContext) {
593306
+ description = `[Photo received: ${localPath}${caption ? ` — caption: "${caption}"` : ""}
593307
+ ${visionContext}]`;
593308
+ } else {
593309
+ description = `[Photo received and saved to ${localPath}${caption ? ` — caption: "${caption}"` : ""}. You can use image_read or vision tools to analyze it if available.]`;
593310
+ }
593142
593311
  try {
593143
593312
  await fetch("http://127.0.0.1:11435/v1/memory/ingest", {
593144
593313
  method: "POST",
@@ -593192,7 +593361,7 @@ Todo/session id: ${sessionContext.sessionId}` : `Telegram ${isGroup ? "group" :
593192
593361
  for (const [key, entry] of this.mediaCache) {
593193
593362
  if (now - entry.cachedAt > MEDIA_CACHE_TTL_MS) {
593194
593363
  try {
593195
- unlinkSync20(entry.localPath);
593364
+ unlinkSync21(entry.localPath);
593196
593365
  } catch {
593197
593366
  }
593198
593367
  this.mediaCache.delete(key);
@@ -593270,8 +593439,8 @@ Todo/session id: ${sessionContext.sessionId}` : `Telegram ${isGroup ? "group" :
593270
593439
  this.state.messagesSent++;
593271
593440
  return result2.result?.message_id ?? null;
593272
593441
  }
593273
- if (!existsSync100(media.value)) return null;
593274
- const buffer2 = readFileSync83(media.value);
593442
+ if (!existsSync101(media.value)) return null;
593443
+ const buffer2 = readFileSync84(media.value);
593275
593444
  const boundary = `----oa-media-${Date.now()}-${Math.random().toString(36).slice(2)}`;
593276
593445
  const filename = basename21(media.value);
593277
593446
  const contentType = mimeForPath(media.value, media.kind);
@@ -593330,11 +593499,11 @@ Content-Type: ${contentType}\r
593330
593499
  addField(name10, value2);
593331
593500
  }
593332
593501
  for (const [field, pathOrFileId] of Object.entries(files)) {
593333
- if (!existsSync100(pathOrFileId)) {
593502
+ if (!existsSync101(pathOrFileId)) {
593334
593503
  addField(field, pathOrFileId);
593335
593504
  continue;
593336
593505
  }
593337
- const buffer2 = readFileSync83(pathOrFileId);
593506
+ const buffer2 = readFileSync84(pathOrFileId);
593338
593507
  const filename = basename21(pathOrFileId);
593339
593508
  parts.push(Buffer.from(`--${boundary}\r
593340
593509
  `));
@@ -593478,7 +593647,7 @@ Content-Type: ${mimeForPath(pathOrFileId, field === "photo" ? "image" : "video")
593478
593647
  return result.result?.message_id ?? null;
593479
593648
  }
593480
593649
  async sendLivePhoto(chatId, livePhoto, photo, options2 = {}) {
593481
- if (!existsSync100(livePhoto) && !existsSync100(photo)) {
593650
+ if (!existsSync101(livePhoto) && !existsSync101(photo)) {
593482
593651
  const result2 = await this.apiCall("sendLivePhoto", {
593483
593652
  chat_id: chatId,
593484
593653
  live_photo: livePhoto,
@@ -593747,33 +593916,33 @@ __export(chat_session_exports, {
593747
593916
  });
593748
593917
  import { randomUUID as randomUUID13 } from "node:crypto";
593749
593918
  import {
593750
- existsSync as existsSync101,
593751
- readFileSync as readFileSync84,
593919
+ existsSync as existsSync102,
593920
+ readFileSync as readFileSync85,
593752
593921
  readdirSync as readdirSync35,
593753
- writeFileSync as writeFileSync54,
593922
+ writeFileSync as writeFileSync55,
593754
593923
  renameSync as renameSync5,
593755
593924
  mkdirSync as mkdirSync59,
593756
- unlinkSync as unlinkSync21
593925
+ unlinkSync as unlinkSync22
593757
593926
  } from "node:fs";
593758
- import { join as join118 } from "node:path";
593927
+ import { join as join119 } from "node:path";
593759
593928
  import { homedir as homedir36 } from "node:os";
593760
593929
  function sessionsDir() {
593761
- return join118(homedir36(), ".open-agents", "chat-sessions");
593930
+ return join119(homedir36(), ".open-agents", "chat-sessions");
593762
593931
  }
593763
593932
  function sessionPath(id) {
593764
593933
  const safe = id.replace(/[^a-zA-Z0-9_.-]/g, "_");
593765
- return join118(sessionsDir(), `${safe}.json`);
593934
+ return join119(sessionsDir(), `${safe}.json`);
593766
593935
  }
593767
593936
  function inFlightPath(id) {
593768
593937
  const safe = id.replace(/[^a-zA-Z0-9_.-]/g, "_");
593769
- return join118(sessionsDir(), `${safe}.inflight.json`);
593938
+ return join119(sessionsDir(), `${safe}.inflight.json`);
593770
593939
  }
593771
593940
  function persistSession(s2) {
593772
593941
  try {
593773
593942
  mkdirSync59(sessionsDir(), { recursive: true });
593774
593943
  const final2 = sessionPath(s2.id);
593775
593944
  const tmp = `${final2}.tmp.${process.pid}.${Date.now()}`;
593776
- writeFileSync54(tmp, JSON.stringify(s2, null, 2), "utf-8");
593945
+ writeFileSync55(tmp, JSON.stringify(s2, null, 2), "utf-8");
593777
593946
  renameSync5(tmp, final2);
593778
593947
  } catch {
593779
593948
  }
@@ -593783,7 +593952,7 @@ function persistInFlight(j) {
593783
593952
  mkdirSync59(sessionsDir(), { recursive: true });
593784
593953
  const final2 = inFlightPath(j.sessionId);
593785
593954
  const tmp = `${final2}.tmp.${process.pid}.${Date.now()}`;
593786
- writeFileSync54(tmp, JSON.stringify(j, null, 2), "utf-8");
593955
+ writeFileSync55(tmp, JSON.stringify(j, null, 2), "utf-8");
593787
593956
  renameSync5(tmp, final2);
593788
593957
  } catch {
593789
593958
  }
@@ -593791,7 +593960,7 @@ function persistInFlight(j) {
593791
593960
  function deleteInFlightFile(id) {
593792
593961
  try {
593793
593962
  const p2 = inFlightPath(id);
593794
- if (existsSync101(p2)) unlinkSync21(p2);
593963
+ if (existsSync102(p2)) unlinkSync22(p2);
593795
593964
  } catch {
593796
593965
  }
593797
593966
  }
@@ -593799,13 +593968,13 @@ function loadPersistedSessions() {
593799
593968
  const report2 = { restored: 0, staleInFlight: 0 };
593800
593969
  try {
593801
593970
  const dir = sessionsDir();
593802
- if (!existsSync101(dir)) return report2;
593971
+ if (!existsSync102(dir)) return report2;
593803
593972
  const cutoff = Date.now() - SESSION_TTL_MS;
593804
593973
  for (const f2 of readdirSync35(dir)) {
593805
593974
  if (!f2.endsWith(".json") || f2.includes(".tmp.")) continue;
593806
- const fp = join118(dir, f2);
593975
+ const fp = join119(dir, f2);
593807
593976
  try {
593808
- const parsed = JSON.parse(readFileSync84(fp, "utf-8"));
593977
+ const parsed = JSON.parse(readFileSync85(fp, "utf-8"));
593809
593978
  if (f2.endsWith(".inflight.json")) {
593810
593979
  if (parsed && parsed.pid && parsed.status === "running") {
593811
593980
  try {
@@ -593815,7 +593984,7 @@ function loadPersistedSessions() {
593815
593984
  parsed.error = "Daemon restart while subprocess was running";
593816
593985
  parsed.completedAt = Date.now();
593817
593986
  try {
593818
- writeFileSync54(fp, JSON.stringify(parsed, null, 2), "utf-8");
593987
+ writeFileSync55(fp, JSON.stringify(parsed, null, 2), "utf-8");
593819
593988
  } catch {
593820
593989
  }
593821
593990
  report2.staleInFlight++;
@@ -593842,23 +594011,23 @@ function buildSystemPrompt(cwd4) {
593842
594011
  "You are Open Agent (OA), an AI coding assistant running locally via Ollama. You have access to the user's workspace and can discuss code, files, and projects. Be helpful, concise, and technically precise. When asked about files or code, describe what you know from the conversation context."
593843
594012
  );
593844
594013
  parts.push(`\\nEnvironment: ${process.platform}, Node ${process.version}, CWD: ${cwd4}`);
593845
- const diaryPath = join118(cwd4, ".oa", "context", "session-diary.md");
593846
- if (existsSync101(diaryPath)) {
594014
+ const diaryPath = join119(cwd4, ".oa", "context", "session-diary.md");
594015
+ if (existsSync102(diaryPath)) {
593847
594016
  try {
593848
- const diary = readFileSync84(diaryPath, "utf-8").slice(0, 1e3);
594017
+ const diary = readFileSync85(diaryPath, "utf-8").slice(0, 1e3);
593849
594018
  parts.push(`\\nPrevious session history:\\n${diary}`);
593850
594019
  } catch {
593851
594020
  }
593852
594021
  }
593853
- const memDir = join118(cwd4, ".oa", "memory");
593854
- if (existsSync101(memDir)) {
594022
+ const memDir = join119(cwd4, ".oa", "memory");
594023
+ if (existsSync102(memDir)) {
593855
594024
  try {
593856
594025
  const files = readdirSync35(memDir).filter((f2) => f2.endsWith(".json")).slice(0, 5);
593857
594026
  if (files.length > 0) {
593858
594027
  parts.push("\\nPersistent memory topics: " + files.map((f2) => f2.replace(".json", "")).join(", "));
593859
594028
  for (const f2 of files.slice(0, 3)) {
593860
594029
  try {
593861
- const data = JSON.parse(readFileSync84(join118(memDir, f2), "utf-8"));
594030
+ const data = JSON.parse(readFileSync85(join119(memDir, f2), "utf-8"));
593862
594031
  const entries = Object.entries(data).slice(0, 3);
593863
594032
  if (entries.length > 0) {
593864
594033
  parts.push(`\\nMemory [${f2.replace(".json", "")}]: ` + entries.map(([k, v]) => `${k}: ${String(v.value ?? v).slice(0, 100)}`).join("; "));
@@ -593871,10 +594040,10 @@ function buildSystemPrompt(cwd4) {
593871
594040
  }
593872
594041
  }
593873
594042
  for (const name10 of ["AGENTS.md", "OA.md", ".open-agents.md"]) {
593874
- const p2 = join118(cwd4, name10);
593875
- if (existsSync101(p2)) {
594043
+ const p2 = join119(cwd4, name10);
594044
+ if (existsSync102(p2)) {
593876
594045
  try {
593877
- const content = readFileSync84(p2, "utf-8").slice(0, 500);
594046
+ const content = readFileSync85(p2, "utf-8").slice(0, 500);
593878
594047
  parts.push(`\\nProject instructions (${name10}):\\n${content}`);
593879
594048
  } catch {
593880
594049
  }
@@ -593891,8 +594060,8 @@ function getSession(sessionId, model, cwd4) {
593891
594060
  if (sessionId) {
593892
594061
  try {
593893
594062
  const fp = sessionPath(sessionId);
593894
- if (existsSync101(fp)) {
593895
- const parsed = JSON.parse(readFileSync84(fp, "utf-8"));
594063
+ if (existsSync102(fp)) {
594064
+ const parsed = JSON.parse(readFileSync85(fp, "utf-8"));
593896
594065
  if (parsed && parsed.id === sessionId) {
593897
594066
  parsed.lastActivity = Date.now();
593898
594067
  sessions.set(sessionId, parsed);
@@ -593994,7 +594163,7 @@ function addTriageResponseMessage(session, acknowledgment, steering) {
593994
594163
  }
593995
594164
  function checkinPath(sessionId) {
593996
594165
  const safe = sessionId.replace(/[^a-zA-Z0-9_.-]/g, "_");
593997
- return join118(sessionsDir(), `${safe}.checkins.jsonl`);
594166
+ return join119(sessionsDir(), `${safe}.checkins.jsonl`);
593998
594167
  }
593999
594168
  function appendCheckin(sessionId, steering) {
594000
594169
  try {
@@ -594008,11 +594177,11 @@ function appendCheckin(sessionId, steering) {
594008
594177
  }
594009
594178
  function drainCheckins(sessionId) {
594010
594179
  const fp = checkinPath(sessionId);
594011
- if (!existsSync101(fp)) return [];
594180
+ if (!existsSync102(fp)) return [];
594012
594181
  try {
594013
- const raw = readFileSync84(fp, "utf-8");
594182
+ const raw = readFileSync85(fp, "utf-8");
594014
594183
  try {
594015
- unlinkSync21(fp);
594184
+ unlinkSync22(fp);
594016
594185
  } catch {
594017
594186
  }
594018
594187
  if (!raw.trim()) return [];
@@ -594050,7 +594219,7 @@ function listSessions2() {
594050
594219
  function deleteSession2(id) {
594051
594220
  try {
594052
594221
  const p2 = sessionPath(id);
594053
- if (existsSync101(p2)) unlinkSync21(p2);
594222
+ if (existsSync102(p2)) unlinkSync22(p2);
594054
594223
  } catch {
594055
594224
  }
594056
594225
  deleteInFlightFile(id);
@@ -594062,8 +594231,8 @@ function lookupSession(id) {
594062
594231
  if (cached) return cached;
594063
594232
  try {
594064
594233
  const fp = sessionPath(id);
594065
- if (existsSync101(fp)) {
594066
- const parsed = JSON.parse(readFileSync84(fp, "utf-8"));
594234
+ if (existsSync102(fp)) {
594235
+ const parsed = JSON.parse(readFileSync85(fp, "utf-8"));
594067
594236
  if (parsed && parsed.id === id) {
594068
594237
  sessions.set(id, parsed);
594069
594238
  return parsed;
@@ -594115,8 +594284,8 @@ function getInFlightChat(sessionId) {
594115
594284
  if (cached) return cached;
594116
594285
  try {
594117
594286
  const p2 = inFlightPath(sessionId);
594118
- if (existsSync101(p2)) {
594119
- const parsed = JSON.parse(readFileSync84(p2, "utf-8"));
594287
+ if (existsSync102(p2)) {
594288
+ const parsed = JSON.parse(readFileSync85(p2, "utf-8"));
594120
594289
  if (parsed && parsed.sessionId === sessionId) {
594121
594290
  return parsed;
594122
594291
  }
@@ -594166,14 +594335,14 @@ __export(projects_exports, {
594166
594335
  setCurrentProject: () => setCurrentProject,
594167
594336
  unregisterProject: () => unregisterProject
594168
594337
  });
594169
- import { readFileSync as readFileSync85, writeFileSync as writeFileSync55, mkdirSync as mkdirSync60, existsSync as existsSync102, statSync as statSync33, renameSync as renameSync6 } from "node:fs";
594338
+ import { readFileSync as readFileSync86, writeFileSync as writeFileSync56, mkdirSync as mkdirSync60, existsSync as existsSync103, statSync as statSync33, renameSync as renameSync6 } from "node:fs";
594170
594339
  import { homedir as homedir37 } from "node:os";
594171
- import { basename as basename22, join as join119, resolve as resolve36 } from "node:path";
594340
+ import { basename as basename22, join as join120, resolve as resolve36 } from "node:path";
594172
594341
  import { randomUUID as randomUUID14 } from "node:crypto";
594173
594342
  function readAll2() {
594174
594343
  try {
594175
- if (!existsSync102(PROJECTS_FILE)) return { projects: [], schemaVersion: 1 };
594176
- const raw = readFileSync85(PROJECTS_FILE, "utf8");
594344
+ if (!existsSync103(PROJECTS_FILE)) return { projects: [], schemaVersion: 1 };
594345
+ const raw = readFileSync86(PROJECTS_FILE, "utf8");
594177
594346
  const parsed = JSON.parse(raw);
594178
594347
  if (!parsed || !Array.isArray(parsed.projects)) return { projects: [], schemaVersion: 1 };
594179
594348
  return { projects: parsed.projects, schemaVersion: 1 };
@@ -594184,7 +594353,7 @@ function readAll2() {
594184
594353
  function writeAll(file) {
594185
594354
  mkdirSync60(OA_DIR3, { recursive: true });
594186
594355
  const tmp = `${PROJECTS_FILE}.${randomUUID14().slice(0, 8)}.tmp`;
594187
- writeFileSync55(tmp, JSON.stringify(file, null, 2), "utf8");
594356
+ writeFileSync56(tmp, JSON.stringify(file, null, 2), "utf8");
594188
594357
  renameSync6(tmp, PROJECTS_FILE);
594189
594358
  }
594190
594359
  function listProjects() {
@@ -594210,8 +594379,8 @@ function registerProject(root, pid) {
594210
594379
  ...existing,
594211
594380
  lastSeen: now,
594212
594381
  pid: pid ?? existing.pid,
594213
- oaDir: join119(canonical, ".oa"),
594214
- openAgentsDir: join119(canonical, ".open-agents")
594382
+ oaDir: join120(canonical, ".oa"),
594383
+ openAgentsDir: join120(canonical, ".open-agents")
594215
594384
  };
594216
594385
  file.projects = file.projects.map((p2) => p2.root === canonical ? entry : p2);
594217
594386
  } else {
@@ -594221,8 +594390,8 @@ function registerProject(root, pid) {
594221
594390
  firstSeen: now,
594222
594391
  lastSeen: now,
594223
594392
  pid: pid ?? null,
594224
- oaDir: join119(canonical, ".oa"),
594225
- openAgentsDir: join119(canonical, ".open-agents")
594393
+ oaDir: join120(canonical, ".oa"),
594394
+ openAgentsDir: join120(canonical, ".open-agents")
594226
594395
  };
594227
594396
  file.projects.push(entry);
594228
594397
  }
@@ -594251,8 +594420,8 @@ function renameProject(root, name10) {
594251
594420
  function getCurrentProject() {
594252
594421
  if (!currentRoot) {
594253
594422
  try {
594254
- if (existsSync102(CURRENT_FILE)) {
594255
- const persisted = readFileSync85(CURRENT_FILE, "utf8").trim();
594423
+ if (existsSync103(CURRENT_FILE)) {
594424
+ const persisted = readFileSync86(CURRENT_FILE, "utf8").trim();
594256
594425
  if (persisted) currentRoot = persisted;
594257
594426
  }
594258
594427
  } catch {
@@ -594269,7 +594438,7 @@ function setCurrentProject(root) {
594269
594438
  currentRoot = canonical;
594270
594439
  try {
594271
594440
  mkdirSync60(OA_DIR3, { recursive: true });
594272
- writeFileSync55(CURRENT_FILE, `${canonical}
594441
+ writeFileSync56(CURRENT_FILE, `${canonical}
594273
594442
  `, "utf8");
594274
594443
  } catch {
594275
594444
  }
@@ -594282,9 +594451,9 @@ var OA_DIR3, PROJECTS_FILE, CURRENT_FILE, currentRoot;
594282
594451
  var init_projects = __esm({
594283
594452
  "packages/cli/src/api/projects.ts"() {
594284
594453
  "use strict";
594285
- OA_DIR3 = join119(homedir37(), ".open-agents");
594286
- PROJECTS_FILE = join119(OA_DIR3, "projects.json");
594287
- CURRENT_FILE = join119(OA_DIR3, "current-project");
594454
+ OA_DIR3 = join120(homedir37(), ".open-agents");
594455
+ PROJECTS_FILE = join120(OA_DIR3, "projects.json");
594456
+ CURRENT_FILE = join120(OA_DIR3, "current-project");
594288
594457
  currentRoot = null;
594289
594458
  }
594290
594459
  });
@@ -594837,6 +595006,9 @@ var init_direct_input = __esm({
594837
595006
  case 12:
594838
595007
  this.emit("ctrl-l");
594839
595008
  return;
595009
+ case 22:
595010
+ this.emit("ctrl-v");
595011
+ return;
594840
595012
  case 28:
594841
595013
  this.emit("ctrl-backslash");
594842
595014
  return;
@@ -594985,30 +595157,30 @@ var init_access_policy = __esm({
594985
595157
 
594986
595158
  // packages/cli/src/api/project-preferences.ts
594987
595159
  import { createHash as createHash19 } from "node:crypto";
594988
- import { existsSync as existsSync103, mkdirSync as mkdirSync61, readFileSync as readFileSync86, renameSync as renameSync7, writeFileSync as writeFileSync56, unlinkSync as unlinkSync22 } from "node:fs";
595160
+ import { existsSync as existsSync104, mkdirSync as mkdirSync61, readFileSync as readFileSync87, renameSync as renameSync7, writeFileSync as writeFileSync57, unlinkSync as unlinkSync23 } from "node:fs";
594989
595161
  import { homedir as homedir38 } from "node:os";
594990
- import { join as join120, resolve as resolve37 } from "node:path";
595162
+ import { join as join121, resolve as resolve37 } from "node:path";
594991
595163
  import { randomUUID as randomUUID15 } from "node:crypto";
594992
595164
  function projectKey(root) {
594993
595165
  const canonical = resolve37(root);
594994
595166
  return createHash19("sha256").update(canonical).digest("hex").slice(0, 16);
594995
595167
  }
594996
595168
  function projectDir(root) {
594997
- return join120(PROJECTS_DIR, projectKey(root));
595169
+ return join121(PROJECTS_DIR, projectKey(root));
594998
595170
  }
594999
595171
  function prefsPath(root) {
595000
- return join120(projectDir(root), "preferences.json");
595172
+ return join121(projectDir(root), "preferences.json");
595001
595173
  }
595002
595174
  function rootSentinelPath(root) {
595003
- return join120(projectDir(root), ".root");
595175
+ return join121(projectDir(root), ".root");
595004
595176
  }
595005
595177
  function ensureDir(root) {
595006
595178
  const dir = projectDir(root);
595007
595179
  mkdirSync61(dir, { recursive: true });
595008
595180
  const sentinel = rootSentinelPath(root);
595009
595181
  try {
595010
- if (!existsSync103(sentinel)) {
595011
- writeFileSync56(sentinel, `${resolve37(root)}
595182
+ if (!existsSync104(sentinel)) {
595183
+ writeFileSync57(sentinel, `${resolve37(root)}
595012
595184
  `, "utf8");
595013
595185
  }
595014
595186
  } catch {
@@ -595017,8 +595189,8 @@ function ensureDir(root) {
595017
595189
  function readProjectPreferences(root) {
595018
595190
  try {
595019
595191
  const file = prefsPath(root);
595020
- if (!existsSync103(file)) return { ...DEFAULT_PREFS };
595021
- const raw = readFileSync86(file, "utf8");
595192
+ if (!existsSync104(file)) return { ...DEFAULT_PREFS };
595193
+ const raw = readFileSync87(file, "utf8");
595022
595194
  const parsed = JSON.parse(raw);
595023
595195
  if (!parsed || parsed.v !== SCHEMA_VERSION) return { ...DEFAULT_PREFS };
595024
595196
  return { ...DEFAULT_PREFS, ...parsed, v: SCHEMA_VERSION };
@@ -595037,16 +595209,16 @@ function writeProjectPreferences(root, partial) {
595037
595209
  };
595038
595210
  const file = prefsPath(root);
595039
595211
  const tmp = `${file}.${randomUUID15().slice(0, 8)}.tmp`;
595040
- writeFileSync56(tmp, JSON.stringify(merged, null, 2), "utf8");
595212
+ writeFileSync57(tmp, JSON.stringify(merged, null, 2), "utf8");
595041
595213
  try {
595042
595214
  renameSync7(tmp, file);
595043
595215
  } catch (err) {
595044
595216
  try {
595045
- writeFileSync56(file, JSON.stringify(merged, null, 2), "utf8");
595217
+ writeFileSync57(file, JSON.stringify(merged, null, 2), "utf8");
595046
595218
  } catch {
595047
595219
  }
595048
595220
  try {
595049
- unlinkSync22(tmp);
595221
+ unlinkSync23(tmp);
595050
595222
  } catch {
595051
595223
  }
595052
595224
  throw err;
@@ -595056,8 +595228,8 @@ function writeProjectPreferences(root, partial) {
595056
595228
  function deleteProjectPreferences(root) {
595057
595229
  try {
595058
595230
  const file = prefsPath(root);
595059
- if (!existsSync103(file)) return false;
595060
- unlinkSync22(file);
595231
+ if (!existsSync104(file)) return false;
595232
+ unlinkSync23(file);
595061
595233
  return true;
595062
595234
  } catch {
595063
595235
  return false;
@@ -595067,8 +595239,8 @@ var OA_DIR4, PROJECTS_DIR, SCHEMA_VERSION, DEFAULT_PREFS;
595067
595239
  var init_project_preferences = __esm({
595068
595240
  "packages/cli/src/api/project-preferences.ts"() {
595069
595241
  "use strict";
595070
- OA_DIR4 = join120(homedir38(), ".open-agents");
595071
- PROJECTS_DIR = join120(OA_DIR4, "projects");
595242
+ OA_DIR4 = join121(homedir38(), ".open-agents");
595243
+ PROJECTS_DIR = join121(OA_DIR4, "projects");
595072
595244
  SCHEMA_VERSION = 1;
595073
595245
  DEFAULT_PREFS = {
595074
595246
  v: SCHEMA_VERSION,
@@ -595969,11 +596141,11 @@ __export(audit_log_exports, {
595969
596141
  recordAudit: () => recordAudit,
595970
596142
  sanitizeBody: () => sanitizeBody
595971
596143
  });
595972
- import { mkdirSync as mkdirSync62, appendFileSync as appendFileSync7, readFileSync as readFileSync87, existsSync as existsSync104 } from "node:fs";
595973
- import { join as join121 } from "node:path";
596144
+ import { mkdirSync as mkdirSync62, appendFileSync as appendFileSync7, readFileSync as readFileSync88, existsSync as existsSync105 } from "node:fs";
596145
+ import { join as join122 } from "node:path";
595974
596146
  function initAuditLog(oaDir) {
595975
- auditDir = join121(oaDir, "audit");
595976
- auditFile = join121(auditDir, "audit.jsonl");
596147
+ auditDir = join122(oaDir, "audit");
596148
+ auditFile = join122(auditDir, "audit.jsonl");
595977
596149
  try {
595978
596150
  mkdirSync62(auditDir, { recursive: true });
595979
596151
  initialized = true;
@@ -596004,9 +596176,9 @@ function sanitizeBody(body, maxLen = 200) {
596004
596176
  return safe.length > maxLen ? safe.slice(0, maxLen) + "..." : safe;
596005
596177
  }
596006
596178
  function queryAudit(opts) {
596007
- if (!initialized || !existsSync104(auditFile)) return [];
596179
+ if (!initialized || !existsSync105(auditFile)) return [];
596008
596180
  try {
596009
- const raw = readFileSync87(auditFile, "utf-8");
596181
+ const raw = readFileSync88(auditFile, "utf-8");
596010
596182
  const lines = raw.split("\n").filter(Boolean);
596011
596183
  let records = lines.map((l2) => {
596012
596184
  try {
@@ -596043,7 +596215,7 @@ var init_audit_log = __esm({
596043
596215
 
596044
596216
  // packages/cli/src/api/disk-task-output.ts
596045
596217
  import { open } from "node:fs/promises";
596046
- import { existsSync as existsSync105, mkdirSync as mkdirSync63, statSync as statSync34 } from "node:fs";
596218
+ import { existsSync as existsSync106, mkdirSync as mkdirSync63, statSync as statSync34 } from "node:fs";
596047
596219
  import { dirname as dirname34 } from "node:path";
596048
596220
  import * as fsConstants from "node:constants";
596049
596221
  var O_NOFOLLOW2, O_APPEND2, O_CREAT2, O_WRONLY2, OPEN_FLAGS_WRITE, OPEN_MODE, DiskTaskOutput;
@@ -596139,7 +596311,7 @@ var init_disk_task_output = __esm({
596139
596311
  async readFrom(offset, limit = 65536) {
596140
596312
  let handle2 = null;
596141
596313
  try {
596142
- if (!existsSync105(this.path)) {
596314
+ if (!existsSync106(this.path)) {
596143
596315
  return { content: "", nextOffset: offset, eof: true, size: 0 };
596144
596316
  }
596145
596317
  const st = statSync34(this.path);
@@ -596341,19 +596513,19 @@ __export(aiwg_exports, {
596341
596513
  resolveAiwgRoot: () => resolveAiwgRoot,
596342
596514
  tryRouteAiwg: () => tryRouteAiwg
596343
596515
  });
596344
- import { existsSync as existsSync106, readFileSync as readFileSync88, readdirSync as readdirSync36, statSync as statSync35 } from "node:fs";
596345
- import { join as join122 } from "node:path";
596516
+ import { existsSync as existsSync107, readFileSync as readFileSync89, readdirSync as readdirSync36, statSync as statSync35 } from "node:fs";
596517
+ import { join as join123 } from "node:path";
596346
596518
  import { homedir as homedir39 } from "node:os";
596347
596519
  import { execSync as execSync55 } from "node:child_process";
596348
596520
  function resolveAiwgRoot() {
596349
596521
  if (_cachedAiwgRoot !== void 0) return _cachedAiwgRoot;
596350
596522
  const envRoot = process.env["OA_AIWG_ROOT"];
596351
- if (envRoot && existsSync106(join122(envRoot, "package.json"))) {
596523
+ if (envRoot && existsSync107(join123(envRoot, "package.json"))) {
596352
596524
  _cachedAiwgRoot = envRoot;
596353
596525
  return envRoot;
596354
596526
  }
596355
- const shareDir = join122(homedir39(), ".local", "share", "ai-writing-guide");
596356
- if (existsSync106(join122(shareDir, "agentic"))) {
596527
+ const shareDir = join123(homedir39(), ".local", "share", "ai-writing-guide");
596528
+ if (existsSync107(join123(shareDir, "agentic"))) {
596357
596529
  _cachedAiwgRoot = shareDir;
596358
596530
  return shareDir;
596359
596531
  }
@@ -596363,8 +596535,8 @@ function resolveAiwgRoot() {
596363
596535
  timeout: 5e3,
596364
596536
  stdio: ["pipe", "pipe", "pipe"]
596365
596537
  }).trim();
596366
- const candidate = join122(globalRoot, "aiwg");
596367
- if (existsSync106(join122(candidate, "package.json"))) {
596538
+ const candidate = join123(globalRoot, "aiwg");
596539
+ if (existsSync107(join123(candidate, "package.json"))) {
596368
596540
  _cachedAiwgRoot = candidate;
596369
596541
  return candidate;
596370
596542
  }
@@ -596375,22 +596547,22 @@ function resolveAiwgRoot() {
596375
596547
  "/usr/lib/node_modules/aiwg",
596376
596548
  "/opt/homebrew/lib/node_modules/aiwg"
596377
596549
  ]) {
596378
- if (existsSync106(join122(p2, "package.json"))) {
596550
+ if (existsSync107(join123(p2, "package.json"))) {
596379
596551
  _cachedAiwgRoot = p2;
596380
596552
  return p2;
596381
596553
  }
596382
596554
  }
596383
596555
  const versionDirs = [
596384
- join122(homedir39(), ".nvm", "versions", "node"),
596385
- join122(homedir39(), ".local", "share", "fnm", "node-versions")
596556
+ join123(homedir39(), ".nvm", "versions", "node"),
596557
+ join123(homedir39(), ".local", "share", "fnm", "node-versions")
596386
596558
  ];
596387
596559
  for (const vdir of versionDirs) {
596388
- if (!existsSync106(vdir)) continue;
596560
+ if (!existsSync107(vdir)) continue;
596389
596561
  try {
596390
596562
  for (const ver of readdirSync36(vdir)) {
596391
596563
  for (const prefix of ["lib/node_modules/aiwg", "installation/lib/node_modules/aiwg"]) {
596392
- const cand = join122(vdir, ver, prefix);
596393
- if (existsSync106(join122(cand, "package.json"))) {
596564
+ const cand = join123(vdir, ver, prefix);
596565
+ if (existsSync107(join123(cand, "package.json"))) {
596394
596566
  _cachedAiwgRoot = cand;
596395
596567
  return cand;
596396
596568
  }
@@ -596408,11 +596580,11 @@ function resolveAiwgRoot() {
596408
596580
  if (whichAiwg) {
596409
596581
  let cur = whichAiwg;
596410
596582
  for (let i2 = 0; i2 < 8; i2++) {
596411
- cur = join122(cur, "..");
596412
- const pj = join122(cur, "package.json");
596413
- if (existsSync106(pj)) {
596583
+ cur = join123(cur, "..");
596584
+ const pj = join123(cur, "package.json");
596585
+ if (existsSync107(pj)) {
596414
596586
  try {
596415
- const pkg = JSON.parse(readFileSync88(pj, "utf-8"));
596587
+ const pkg = JSON.parse(readFileSync89(pj, "utf-8"));
596416
596588
  if (pkg.name === "aiwg") {
596417
596589
  _cachedAiwgRoot = cur;
596418
596590
  return cur;
@@ -596434,14 +596606,14 @@ function listAiwgFrameworks() {
596434
596606
  _cachedFrameworks = [];
596435
596607
  return _cachedFrameworks;
596436
596608
  }
596437
- const frameworksDir = join122(root, "agentic", "code", "frameworks");
596438
- if (!existsSync106(frameworksDir)) {
596609
+ const frameworksDir = join123(root, "agentic", "code", "frameworks");
596610
+ if (!existsSync107(frameworksDir)) {
596439
596611
  _cachedFrameworks = [];
596440
596612
  return _cachedFrameworks;
596441
596613
  }
596442
596614
  const out = [];
596443
596615
  for (const name10 of readdirSync36(frameworksDir)) {
596444
- const p2 = join122(frameworksDir, name10);
596616
+ const p2 = join123(frameworksDir, name10);
596445
596617
  try {
596446
596618
  const st = statSync35(p2);
596447
596619
  if (!st.isDirectory()) continue;
@@ -596469,7 +596641,7 @@ function aggregateDir(dir, depth = 0) {
596469
596641
  try {
596470
596642
  for (const e2 of readdirSync36(dir, { withFileTypes: true })) {
596471
596643
  if (e2.name.startsWith(".") || e2.name === "node_modules") continue;
596472
- const p2 = join122(dir, e2.name);
596644
+ const p2 = join123(dir, e2.name);
596473
596645
  if (e2.isDirectory()) {
596474
596646
  const sub = aggregateDir(p2, depth + 1);
596475
596647
  out.files += sub.files;
@@ -596499,10 +596671,10 @@ function aggregateDir(dir, depth = 0) {
596499
596671
  }
596500
596672
  function readFirstLineDescription(dir) {
596501
596673
  for (const candidate of ["README.md", "SKILL.md", "INDEX.md"]) {
596502
- const p2 = join122(dir, candidate);
596503
- if (!existsSync106(p2)) continue;
596674
+ const p2 = join123(dir, candidate);
596675
+ if (!existsSync107(p2)) continue;
596504
596676
  try {
596505
- const txt = readFileSync88(p2, "utf-8");
596677
+ const txt = readFileSync89(p2, "utf-8");
596506
596678
  const descMatch = txt.match(/^description:\s*(.+)$/m);
596507
596679
  if (descMatch) return descMatch[1].trim().slice(0, 200);
596508
596680
  for (const line of txt.split("\n")) {
@@ -596524,12 +596696,12 @@ function listAiwgItems() {
596524
596696
  }
596525
596697
  const out = [];
596526
596698
  const walkRoots = [
596527
- join122(root, "agentic", "code", "frameworks"),
596528
- join122(root, "agentic", "code", "addons"),
596529
- join122(root, "plugins")
596699
+ join123(root, "agentic", "code", "frameworks"),
596700
+ join123(root, "agentic", "code", "addons"),
596701
+ join123(root, "plugins")
596530
596702
  ];
596531
596703
  for (const wr of walkRoots) {
596532
- if (!existsSync106(wr)) continue;
596704
+ if (!existsSync107(wr)) continue;
596533
596705
  walkForItems(wr, out, 0);
596534
596706
  }
596535
596707
  _cachedItems = out;
@@ -596540,7 +596712,7 @@ function walkForItems(dir, out, depth) {
596540
596712
  try {
596541
596713
  for (const e2 of readdirSync36(dir, { withFileTypes: true })) {
596542
596714
  if (e2.name.startsWith(".") || e2.name === "node_modules") continue;
596543
- const p2 = join122(dir, e2.name);
596715
+ const p2 = join123(dir, e2.name);
596544
596716
  if (e2.isDirectory()) {
596545
596717
  walkForItems(p2, out, depth + 1);
596546
596718
  } else if (e2.isFile() && e2.name.endsWith(".md")) {
@@ -596553,7 +596725,7 @@ function walkForItems(dir, out, depth) {
596553
596725
  }
596554
596726
  function parseItem(p2) {
596555
596727
  try {
596556
- const raw = readFileSync88(p2, "utf-8");
596728
+ const raw = readFileSync89(p2, "utf-8");
596557
596729
  const header = raw.slice(0, 3e3);
596558
596730
  const nameMatch = header.match(/^name:\s*(.+)$/m);
596559
596731
  const descMatch = header.match(/^description:\s*(.+)$/m);
@@ -596591,8 +596763,8 @@ function deriveSource(p2) {
596591
596763
  }
596592
596764
  function loadAiwgItemContent(path11, maxBytes = 2e4) {
596593
596765
  try {
596594
- if (!existsSync106(path11)) return null;
596595
- const raw = readFileSync88(path11, "utf-8");
596766
+ if (!existsSync107(path11)) return null;
596767
+ const raw = readFileSync89(path11, "utf-8");
596596
596768
  return raw.length > maxBytes ? raw.slice(0, maxBytes) + "\n\n...(truncated for context budget)" : raw;
596597
596769
  } catch {
596598
596770
  return null;
@@ -596605,14 +596777,14 @@ function listAiwgAddons() {
596605
596777
  _cachedAddons = [];
596606
596778
  return _cachedAddons;
596607
596779
  }
596608
- const addonsDir = join122(root, "agentic", "code", "addons");
596609
- if (!existsSync106(addonsDir)) {
596780
+ const addonsDir = join123(root, "agentic", "code", "addons");
596781
+ if (!existsSync107(addonsDir)) {
596610
596782
  _cachedAddons = [];
596611
596783
  return _cachedAddons;
596612
596784
  }
596613
596785
  const out = [];
596614
596786
  for (const name10 of readdirSync36(addonsDir)) {
596615
- const p2 = join122(addonsDir, name10);
596787
+ const p2 = join123(addonsDir, name10);
596616
596788
  try {
596617
596789
  const st = statSync35(p2);
596618
596790
  if (!st.isDirectory()) continue;
@@ -597101,18 +597273,18 @@ __export(runtime_keys_exports, {
597101
597273
  mintKey: () => mintKey,
597102
597274
  revokeByPrefix: () => revokeByPrefix
597103
597275
  });
597104
- import { existsSync as existsSync107, readFileSync as readFileSync89, writeFileSync as writeFileSync57, mkdirSync as mkdirSync64, chmodSync } from "node:fs";
597105
- import { join as join123 } from "node:path";
597276
+ import { existsSync as existsSync108, readFileSync as readFileSync90, writeFileSync as writeFileSync58, mkdirSync as mkdirSync64, chmodSync } from "node:fs";
597277
+ import { join as join124 } from "node:path";
597106
597278
  import { homedir as homedir40 } from "node:os";
597107
597279
  import { randomBytes as randomBytes21 } from "node:crypto";
597108
597280
  function ensureDir2() {
597109
- const dir = join123(homedir40(), ".open-agents");
597110
- if (!existsSync107(dir)) mkdirSync64(dir, { recursive: true });
597281
+ const dir = join124(homedir40(), ".open-agents");
597282
+ if (!existsSync108(dir)) mkdirSync64(dir, { recursive: true });
597111
597283
  }
597112
597284
  function loadAll() {
597113
- if (!existsSync107(KEYS_FILE)) return [];
597285
+ if (!existsSync108(KEYS_FILE)) return [];
597114
597286
  try {
597115
- const raw = readFileSync89(KEYS_FILE, "utf-8");
597287
+ const raw = readFileSync90(KEYS_FILE, "utf-8");
597116
597288
  const parsed = JSON.parse(raw);
597117
597289
  if (!Array.isArray(parsed)) return [];
597118
597290
  return parsed;
@@ -597122,7 +597294,7 @@ function loadAll() {
597122
597294
  }
597123
597295
  function persistAll(records) {
597124
597296
  ensureDir2();
597125
- writeFileSync57(KEYS_FILE, JSON.stringify(records, null, 2), "utf-8");
597297
+ writeFileSync58(KEYS_FILE, JSON.stringify(records, null, 2), "utf-8");
597126
597298
  try {
597127
597299
  chmodSync(KEYS_FILE, 384);
597128
597300
  } catch {
@@ -597187,7 +597359,7 @@ var KEYS_FILE;
597187
597359
  var init_runtime_keys = __esm({
597188
597360
  "packages/cli/src/api/runtime-keys.ts"() {
597189
597361
  "use strict";
597190
- KEYS_FILE = join123(homedir40(), ".open-agents", "keys.json");
597362
+ KEYS_FILE = join124(homedir40(), ".open-agents", "keys.json");
597191
597363
  }
597192
597364
  });
597193
597365
 
@@ -597198,20 +597370,20 @@ __export(tor_fallback_exports, {
597198
597370
  torIsReachable: () => torIsReachable,
597199
597371
  tunnelViaTor: () => tunnelViaTor
597200
597372
  });
597201
- import { existsSync as existsSync108, readFileSync as readFileSync90 } from "node:fs";
597373
+ import { existsSync as existsSync109, readFileSync as readFileSync91 } from "node:fs";
597202
597374
  import { homedir as homedir41 } from "node:os";
597203
- import { join as join124 } from "node:path";
597375
+ import { join as join125 } from "node:path";
597204
597376
  import { createConnection as createConnection3 } from "node:net";
597205
597377
  function getLocalOnion() {
597206
597378
  const candidates = [
597207
- join124(homedir41(), "hidden_service_hostname"),
597208
- join124(homedir41(), ".oa", "tor", "hostname"),
597379
+ join125(homedir41(), "hidden_service_hostname"),
597380
+ join125(homedir41(), ".oa", "tor", "hostname"),
597209
597381
  "/var/lib/tor/hidden_service/hostname"
597210
597382
  ];
597211
597383
  for (const p2 of candidates) {
597212
597384
  try {
597213
- if (existsSync108(p2)) {
597214
- const v = readFileSync90(p2, "utf-8").trim();
597385
+ if (existsSync109(p2)) {
597386
+ const v = readFileSync91(p2, "utf-8").trim();
597215
597387
  if (v && v.endsWith(".onion")) return v;
597216
597388
  }
597217
597389
  } catch {
@@ -597356,8 +597528,8 @@ __export(graphical_sudo_exports, {
597356
597528
  runGraphicalSudo: () => runGraphicalSudo
597357
597529
  });
597358
597530
  import { spawn as spawn25 } from "node:child_process";
597359
- import { existsSync as existsSync109, mkdirSync as mkdirSync65, writeFileSync as writeFileSync58, chmodSync as chmodSync2 } from "node:fs";
597360
- import { join as join125 } from "node:path";
597531
+ import { existsSync as existsSync110, mkdirSync as mkdirSync65, writeFileSync as writeFileSync59, chmodSync as chmodSync2 } from "node:fs";
597532
+ import { join as join126 } from "node:path";
597361
597533
  import { tmpdir as tmpdir21 } from "node:os";
597362
597534
  function detectSudoHelper() {
597363
597535
  if (process.platform === "win32") return null;
@@ -597373,15 +597545,15 @@ function which(cmd) {
597373
597545
  const path11 = process.env["PATH"] || "/usr/bin:/bin:/usr/local/bin";
597374
597546
  for (const dir of path11.split(":")) {
597375
597547
  if (!dir) continue;
597376
- const full = join125(dir, cmd);
597377
- if (existsSync109(full)) return full;
597548
+ const full = join126(dir, cmd);
597549
+ if (existsSync110(full)) return full;
597378
597550
  }
597379
597551
  return null;
597380
597552
  }
597381
597553
  function ensureAskpassShim(helper, description) {
597382
- const shimDir = join125(tmpdir21(), "oa-askpass");
597554
+ const shimDir = join126(tmpdir21(), "oa-askpass");
597383
597555
  mkdirSync65(shimDir, { recursive: true });
597384
- const shim = join125(shimDir, `${helper}.sh`);
597556
+ const shim = join126(shimDir, `${helper}.sh`);
597385
597557
  let body;
597386
597558
  if (helper === "zenity") {
597387
597559
  body = `#!/bin/sh
@@ -597392,7 +597564,7 @@ exec zenity --password --title="OA needs sudo" --text="${description.replace(/"/
597392
597564
  exec kdialog --password "${description.replace(/"/g, '\\"')}" 2>/dev/null
597393
597565
  `;
597394
597566
  }
597395
- writeFileSync58(shim, body, "utf-8");
597567
+ writeFileSync59(shim, body, "utf-8");
597396
597568
  chmodSync2(shim, 493);
597397
597569
  return shim;
597398
597570
  }
@@ -597686,8 +597858,8 @@ var init_command_passthrough = __esm({
597686
597858
  });
597687
597859
 
597688
597860
  // packages/cli/src/api/routes-v1.ts
597689
- import { existsSync as existsSync110, readFileSync as readFileSync91, readdirSync as readdirSync37, statSync as statSync36 } from "node:fs";
597690
- import { join as join126, resolve as pathResolve2 } from "node:path";
597861
+ import { existsSync as existsSync111, readFileSync as readFileSync92, readdirSync as readdirSync37, statSync as statSync36 } from "node:fs";
597862
+ import { join as join127, resolve as pathResolve2 } from "node:path";
597691
597863
  import { homedir as homedir42 } from "node:os";
597692
597864
  async function tryRouteV1(ctx3) {
597693
597865
  const { pathname, method } = ctx3;
@@ -597923,11 +598095,11 @@ async function handleGetSkill(ctx3, name10) {
597923
598095
  async function fallbackDiscoverSkills() {
597924
598096
  return (_root) => {
597925
598097
  const roots = [
597926
- join126(homedir42(), ".local", "share", "ai-writing-guide")
598098
+ join127(homedir42(), ".local", "share", "ai-writing-guide")
597927
598099
  ];
597928
598100
  const out = [];
597929
598101
  for (const root of roots) {
597930
- if (!existsSync110(root)) continue;
598102
+ if (!existsSync111(root)) continue;
597931
598103
  walkForSkills(root, out, 0);
597932
598104
  }
597933
598105
  return out;
@@ -597938,12 +598110,12 @@ function walkForSkills(dir, out, depth) {
597938
598110
  try {
597939
598111
  for (const e2 of readdirSync37(dir, { withFileTypes: true })) {
597940
598112
  if (e2.name.startsWith(".") || e2.name === "node_modules") continue;
597941
- const p2 = join126(dir, e2.name);
598113
+ const p2 = join127(dir, e2.name);
597942
598114
  if (e2.isDirectory()) {
597943
598115
  walkForSkills(p2, out, depth + 1);
597944
598116
  } else if (e2.isFile() && e2.name === "SKILL.md") {
597945
598117
  try {
597946
- const content = readFileSync91(p2, "utf-8").slice(0, 2e3);
598118
+ const content = readFileSync92(p2, "utf-8").slice(0, 2e3);
597947
598119
  const nameMatch = content.match(/^name:\s*(.+)$/m);
597948
598120
  const descMatch = content.match(/^description:\s*(.+)$/m);
597949
598121
  out.push({
@@ -598127,7 +598299,7 @@ async function getMemoryStores() {
598127
598299
  if (memoryInitTried) return null;
598128
598300
  memoryInitTried = true;
598129
598301
  try {
598130
- const dbPath = join126(homedir42(), ".open-agents", "memory.db");
598302
+ const dbPath = join127(homedir42(), ".open-agents", "memory.db");
598131
598303
  const sharedDb = initDb(dbPath);
598132
598304
  memoryStoresCache = {
598133
598305
  episode: new EpisodeStore(dbPath),
@@ -598385,7 +598557,7 @@ async function handleFilesRead(ctx3) {
598385
598557
  }));
598386
598558
  return true;
598387
598559
  }
598388
- if (!existsSync110(resolved)) {
598560
+ if (!existsSync111(resolved)) {
598389
598561
  sendProblem(res, problemDetails({
598390
598562
  type: P.notFound,
598391
598563
  status: 404,
@@ -598417,7 +598589,7 @@ async function handleFilesRead(ctx3) {
598417
598589
  }));
598418
598590
  return true;
598419
598591
  }
598420
- const content = readFileSync91(resolved, "utf-8");
598592
+ const content = readFileSync92(resolved, "utf-8");
598421
598593
  const offset = typeof body.offset === "number" && body.offset >= 0 ? body.offset : 0;
598422
598594
  const limit = typeof body.limit === "number" && body.limit > 0 ? body.limit : content.length;
598423
598595
  const slice2 = content.slice(offset, offset + limit);
@@ -598650,14 +598822,14 @@ async function handleNexusStatus(ctx3) {
598650
598822
  const { res, requestId } = ctx3;
598651
598823
  try {
598652
598824
  const statePaths = [
598653
- join126(process.cwd(), ".oa", "nexus-peer-state.json"),
598654
- join126(homedir42(), ".open-agents", "nexus-peer-cache.json")
598825
+ join127(process.cwd(), ".oa", "nexus-peer-state.json"),
598826
+ join127(homedir42(), ".open-agents", "nexus-peer-cache.json")
598655
598827
  ];
598656
598828
  const states = [];
598657
598829
  for (const p2 of statePaths) {
598658
- if (!existsSync110(p2)) continue;
598830
+ if (!existsSync111(p2)) continue;
598659
598831
  try {
598660
- const raw = readFileSync91(p2, "utf-8");
598832
+ const raw = readFileSync92(p2, "utf-8");
598661
598833
  states.push({ source: p2, data: JSON.parse(raw) });
598662
598834
  } catch (e2) {
598663
598835
  states.push({ source: p2, error: String(e2) });
@@ -598684,8 +598856,8 @@ async function handleNexusStatus(ctx3) {
598684
598856
  }
598685
598857
  function loadAgentName() {
598686
598858
  try {
598687
- const p2 = join126(homedir42(), ".open-agents", "agent-name");
598688
- if (existsSync110(p2)) return readFileSync91(p2, "utf-8").trim();
598859
+ const p2 = join127(homedir42(), ".open-agents", "agent-name");
598860
+ if (existsSync111(p2)) return readFileSync92(p2, "utf-8").trim();
598689
598861
  } catch {
598690
598862
  }
598691
598863
  return null;
@@ -598694,14 +598866,14 @@ async function handleSponsors(ctx3) {
598694
598866
  const { req: req2, res, url, requestId } = ctx3;
598695
598867
  try {
598696
598868
  const candidates = [
598697
- join126(homedir42(), ".open-agents", "sponsor-cache.json"),
598698
- join126(homedir42(), ".open-agents", "sponsors.json")
598869
+ join127(homedir42(), ".open-agents", "sponsor-cache.json"),
598870
+ join127(homedir42(), ".open-agents", "sponsors.json")
598699
598871
  ];
598700
598872
  let sponsors = [];
598701
598873
  for (const p2 of candidates) {
598702
- if (!existsSync110(p2)) continue;
598874
+ if (!existsSync111(p2)) continue;
598703
598875
  try {
598704
- const raw = JSON.parse(readFileSync91(p2, "utf-8"));
598876
+ const raw = JSON.parse(readFileSync92(p2, "utf-8"));
598705
598877
  if (Array.isArray(raw)) {
598706
598878
  sponsors = raw;
598707
598879
  break;
@@ -598770,8 +598942,8 @@ async function handleEvaluate(ctx3) {
598770
598942
  }));
598771
598943
  return true;
598772
598944
  }
598773
- const jobPath = join126(process.cwd(), ".oa", "jobs", `${runId}.json`);
598774
- if (!existsSync110(jobPath)) {
598945
+ const jobPath = join127(process.cwd(), ".oa", "jobs", `${runId}.json`);
598946
+ if (!existsSync111(jobPath)) {
598775
598947
  sendProblem(res, problemDetails({
598776
598948
  type: P.notFound,
598777
598949
  status: 404,
@@ -598781,7 +598953,7 @@ async function handleEvaluate(ctx3) {
598781
598953
  }));
598782
598954
  return true;
598783
598955
  }
598784
- const job = JSON.parse(readFileSync91(jobPath, "utf-8"));
598956
+ const job = JSON.parse(readFileSync92(jobPath, "utf-8"));
598785
598957
  sendJson(res, 200, {
598786
598958
  run_id: runId,
598787
598959
  task: job.task,
@@ -598919,9 +599091,9 @@ async function handleMintKey(ctx3) {
598919
599091
  return true;
598920
599092
  }
598921
599093
  function _readStatusFile(p2) {
598922
- if (!existsSync110(p2)) return null;
599094
+ if (!existsSync111(p2)) return null;
598923
599095
  try {
598924
- const data = JSON.parse(readFileSync91(p2, "utf-8"));
599096
+ const data = JSON.parse(readFileSync92(p2, "utf-8"));
598925
599097
  if (data?.connected && typeof data.peerId === "string" && data.peerId.length > 10) {
598926
599098
  return {
598927
599099
  peerId: data.peerId,
@@ -598936,18 +599108,18 @@ function _readStatusFile(p2) {
598936
599108
  function resolveLocalPeerId() {
598937
599109
  const override = process.env["OA_NEXUS_DIR"];
598938
599110
  if (override) {
598939
- const r2 = _readStatusFile(join126(override, "status.json"));
599111
+ const r2 = _readStatusFile(join127(override, "status.json"));
598940
599112
  if (r2) return r2;
598941
599113
  }
598942
599114
  try {
598943
- const regPath = join126(homedir42(), ".open-agents", "nexus-registry.json");
598944
- if (existsSync110(regPath)) {
598945
- const reg = JSON.parse(readFileSync91(regPath, "utf-8"));
599115
+ const regPath = join127(homedir42(), ".open-agents", "nexus-registry.json");
599116
+ if (existsSync111(regPath)) {
599117
+ const reg = JSON.parse(readFileSync92(regPath, "utf-8"));
598946
599118
  const entries = Array.isArray(reg?.dirs) ? reg.dirs : [];
598947
599119
  for (const entry of entries) {
598948
599120
  const dir = typeof entry === "string" ? entry : entry?.dir;
598949
599121
  if (typeof dir === "string") {
598950
- const r2 = _readStatusFile(join126(dir, "status.json"));
599122
+ const r2 = _readStatusFile(join127(dir, "status.json"));
598951
599123
  if (r2) return r2;
598952
599124
  }
598953
599125
  }
@@ -598955,9 +599127,9 @@ function resolveLocalPeerId() {
598955
599127
  } catch {
598956
599128
  }
598957
599129
  const candidates = [
598958
- join126(process.cwd(), ".oa", "nexus", "status.json"),
598959
- join126(homedir42(), ".oa", "nexus", "status.json"),
598960
- join126(homedir42(), ".open-agents", "nexus", "status.json")
599130
+ join127(process.cwd(), ".oa", "nexus", "status.json"),
599131
+ join127(homedir42(), ".oa", "nexus", "status.json"),
599132
+ join127(homedir42(), ".open-agents", "nexus", "status.json")
598961
599133
  ];
598962
599134
  for (const p2 of candidates) {
598963
599135
  const r2 = _readStatusFile(p2);
@@ -598990,21 +599162,21 @@ function locateTorScript(filename) {
598990
599162
  const candidates = [
598991
599163
  // npm-installed layout: build-publish.mjs copies scripts to
598992
599164
  // publish/dist/scripts/tor/ which lands at <install>/dist/scripts/tor/.
598993
- join126(__dirname, "scripts", "tor", filename),
598994
- join126(__dirname, "..", "scripts", "tor", filename),
598995
- join126(__dirname, "..", "..", "scripts", "tor", filename),
599165
+ join127(__dirname, "scripts", "tor", filename),
599166
+ join127(__dirname, "..", "scripts", "tor", filename),
599167
+ join127(__dirname, "..", "..", "scripts", "tor", filename),
598996
599168
  // Workspace dev: cli package's source tree.
598997
- join126(process.cwd(), "packages", "cli", "scripts", "tor", filename),
598998
- join126(process.cwd(), "scripts", "tor", filename)
599169
+ join127(process.cwd(), "packages", "cli", "scripts", "tor", filename),
599170
+ join127(process.cwd(), "scripts", "tor", filename)
598999
599171
  ];
599000
599172
  for (const p2 of candidates) {
599001
- if (existsSync110(p2)) return p2;
599173
+ if (existsSync111(p2)) return p2;
599002
599174
  }
599003
599175
  try {
599004
599176
  const { execSync: execSync60 } = __require("node:child_process");
599005
599177
  const root = execSync60("npm root -g", { encoding: "utf-8", timeout: 5e3 }).trim();
599006
- const p2 = join126(root, "open-agents-ai", "dist", "scripts", "tor", filename);
599007
- if (existsSync110(p2)) return p2;
599178
+ const p2 = join127(root, "open-agents-ai", "dist", "scripts", "tor", filename);
599179
+ if (existsSync111(p2)) return p2;
599008
599180
  } catch {
599009
599181
  }
599010
599182
  return null;
@@ -599274,13 +599446,13 @@ async function handleRemoteProxy(ctx3) {
599274
599446
  return true;
599275
599447
  }
599276
599448
  const nexusCandidates = [
599277
- join126(process.cwd(), ".oa", "nexus"),
599278
- join126(homedir42(), ".oa", "nexus"),
599279
- join126(homedir42(), ".open-agents", "nexus")
599449
+ join127(process.cwd(), ".oa", "nexus"),
599450
+ join127(homedir42(), ".oa", "nexus"),
599451
+ join127(homedir42(), ".open-agents", "nexus")
599280
599452
  ];
599281
599453
  let nexusDirPath = null;
599282
599454
  for (const p2 of nexusCandidates) {
599283
- if (existsSync110(join126(p2, "status.json"))) {
599455
+ if (existsSync111(join127(p2, "status.json"))) {
599284
599456
  nexusDirPath = p2;
599285
599457
  break;
599286
599458
  }
@@ -599376,7 +599548,7 @@ async function handleRemoteProxy(ctx3) {
599376
599548
  }));
599377
599549
  return true;
599378
599550
  }
599379
- const streamFile = join126(nexusDirPath, `tunnel-${requestId}-${Date.now()}.jsonl`);
599551
+ const streamFile = join127(nexusDirPath, `tunnel-${requestId}-${Date.now()}.jsonl`);
599380
599552
  try {
599381
599553
  const { writeFileSync: _wfs } = await import("node:fs");
599382
599554
  _wfs(streamFile, "");
@@ -599937,14 +600109,14 @@ async function handleListEngines(ctx3) {
599937
600109
  const home = homedir42();
599938
600110
  sendJson(res, 200, {
599939
600111
  engines: [
599940
- { name: "dream", state_file: join126(process.cwd(), ".oa", "dreams"), controllable_via: "SSE + slash commands" },
599941
- { name: "bless", state_file: join126(process.cwd(), ".oa", "bless-state.json"), controllable_via: "slash commands" },
599942
- { name: "call", state_file: join126(process.cwd(), ".oa", "call-state.json"), controllable_via: "slash commands" },
599943
- { name: "listen", state_file: join126(process.cwd(), ".oa", "listen-state.json"), controllable_via: "slash commands" },
599944
- { name: "telegram", state_file: join126(home, ".open-agents", "telegram-state.json"), controllable_via: "slash commands" },
599945
- { name: "expose", state_file: join126(process.cwd(), ".oa", "expose-state.json"), controllable_via: "/expose commands" },
599946
- { name: "nexus", state_file: join126(home, ".open-agents", "nexus-peer-cache.json"), controllable_via: "/nexus commands" },
599947
- { name: "ipfs", state_file: join126(process.cwd(), ".oa", "ipfs"), controllable_via: "slash commands" }
600112
+ { name: "dream", state_file: join127(process.cwd(), ".oa", "dreams"), controllable_via: "SSE + slash commands" },
600113
+ { name: "bless", state_file: join127(process.cwd(), ".oa", "bless-state.json"), controllable_via: "slash commands" },
600114
+ { name: "call", state_file: join127(process.cwd(), ".oa", "call-state.json"), controllable_via: "slash commands" },
600115
+ { name: "listen", state_file: join127(process.cwd(), ".oa", "listen-state.json"), controllable_via: "slash commands" },
600116
+ { name: "telegram", state_file: join127(home, ".open-agents", "telegram-state.json"), controllable_via: "slash commands" },
600117
+ { name: "expose", state_file: join127(process.cwd(), ".oa", "expose-state.json"), controllable_via: "/expose commands" },
600118
+ { name: "nexus", state_file: join127(home, ".open-agents", "nexus-peer-cache.json"), controllable_via: "/nexus commands" },
600119
+ { name: "ipfs", state_file: join127(process.cwd(), ".oa", "ipfs"), controllable_via: "slash commands" }
599948
600120
  ],
599949
600121
  note: "Engine instrumentation lives in the running TUI process. Full status + control requires the daemon↔TUI bridge (PT-07). See parity audit WO-PARITY-04."
599950
600122
  });
@@ -600027,12 +600199,12 @@ async function tryAimsRoute(ctx3) {
600027
600199
  return false;
600028
600200
  }
600029
600201
  function aimsDir() {
600030
- return join126(homedir42(), ".open-agents", "aims");
600202
+ return join127(homedir42(), ".open-agents", "aims");
600031
600203
  }
600032
600204
  function readAimsFile(name10, fallback) {
600033
600205
  try {
600034
- const p2 = join126(aimsDir(), name10);
600035
- if (existsSync110(p2)) return JSON.parse(readFileSync91(p2, "utf-8"));
600206
+ const p2 = join127(aimsDir(), name10);
600207
+ if (existsSync111(p2)) return JSON.parse(readFileSync92(p2, "utf-8"));
600036
600208
  } catch {
600037
600209
  }
600038
600210
  return fallback;
@@ -600041,7 +600213,7 @@ function writeAimsFile(name10, data) {
600041
600213
  const dir = aimsDir();
600042
600214
  const { mkdirSync: mkdirSync74, writeFileSync: wf, renameSync: rn } = __require("node:fs");
600043
600215
  mkdirSync74(dir, { recursive: true });
600044
- const finalPath = join126(dir, name10);
600216
+ const finalPath = join127(dir, name10);
600045
600217
  const tmpPath = `${finalPath}.tmp.${process.pid}.${Date.now()}`;
600046
600218
  try {
600047
600219
  wf(tmpPath, JSON.stringify(data, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
@@ -600371,12 +600543,12 @@ async function handleAimsSuppliers(ctx3) {
600371
600543
  }
600372
600544
  ];
600373
600545
  const sponsorPaths = [
600374
- join126(homedir42(), ".open-agents", "sponsor-cache.json")
600546
+ join127(homedir42(), ".open-agents", "sponsor-cache.json")
600375
600547
  ];
600376
600548
  for (const p2 of sponsorPaths) {
600377
- if (!existsSync110(p2)) continue;
600549
+ if (!existsSync111(p2)) continue;
600378
600550
  try {
600379
- const raw = JSON.parse(readFileSync91(p2, "utf-8"));
600551
+ const raw = JSON.parse(readFileSync92(p2, "utf-8"));
600380
600552
  const list = Array.isArray(raw) ? raw : raw?.sponsors ?? [];
600381
600553
  for (const s2 of list) {
600382
600554
  suppliers.push({
@@ -609531,15 +609703,15 @@ var init_auth_oidc = __esm({
609531
609703
  });
609532
609704
 
609533
609705
  // packages/cli/src/api/usage-tracker.ts
609534
- import { mkdirSync as mkdirSync66, readFileSync as readFileSync92, writeFileSync as writeFileSync59, existsSync as existsSync111 } from "node:fs";
609535
- import { join as join127 } from "node:path";
609706
+ import { mkdirSync as mkdirSync66, readFileSync as readFileSync93, writeFileSync as writeFileSync60, existsSync as existsSync112 } from "node:fs";
609707
+ import { join as join128 } from "node:path";
609536
609708
  function initUsageTracker(oaDir) {
609537
- const dir = join127(oaDir, "usage");
609709
+ const dir = join128(oaDir, "usage");
609538
609710
  mkdirSync66(dir, { recursive: true });
609539
- usageFile = join127(dir, "token-usage.json");
609711
+ usageFile = join128(dir, "token-usage.json");
609540
609712
  try {
609541
- if (existsSync111(usageFile)) {
609542
- store = JSON.parse(readFileSync92(usageFile, "utf-8"));
609713
+ if (existsSync112(usageFile)) {
609714
+ store = JSON.parse(readFileSync93(usageFile, "utf-8"));
609543
609715
  }
609544
609716
  } catch {
609545
609717
  store = { providers: {}, lastSaved: "" };
@@ -609575,7 +609747,7 @@ function flush2() {
609575
609747
  if (!initialized2 || !dirty) return;
609576
609748
  try {
609577
609749
  store.lastSaved = (/* @__PURE__ */ new Date()).toISOString();
609578
- writeFileSync59(usageFile, JSON.stringify(store, null, 2), "utf-8");
609750
+ writeFileSync60(usageFile, JSON.stringify(store, null, 2), "utf-8");
609579
609751
  dirty = false;
609580
609752
  } catch {
609581
609753
  }
@@ -609603,24 +609775,24 @@ var init_usage_tracker = __esm({
609603
609775
  });
609604
609776
 
609605
609777
  // packages/cli/src/api/profiles.ts
609606
- import { existsSync as existsSync112, readFileSync as readFileSync93, writeFileSync as writeFileSync60, mkdirSync as mkdirSync67, readdirSync as readdirSync38, unlinkSync as unlinkSync23 } from "node:fs";
609607
- import { join as join128 } from "node:path";
609778
+ import { existsSync as existsSync113, readFileSync as readFileSync94, writeFileSync as writeFileSync61, mkdirSync as mkdirSync67, readdirSync as readdirSync38, unlinkSync as unlinkSync24 } from "node:fs";
609779
+ import { join as join129 } from "node:path";
609608
609780
  import { homedir as homedir43 } from "node:os";
609609
609781
  import { createCipheriv as createCipheriv4, createDecipheriv as createDecipheriv4, randomBytes as randomBytes22, scryptSync as scryptSync3 } from "node:crypto";
609610
609782
  function globalProfileDir() {
609611
- return join128(homedir43(), ".open-agents", "profiles");
609783
+ return join129(homedir43(), ".open-agents", "profiles");
609612
609784
  }
609613
609785
  function projectProfileDir(projectDir2) {
609614
- return join128(projectDir2 || process.cwd(), ".oa", "profiles");
609786
+ return join129(projectDir2 || process.cwd(), ".oa", "profiles");
609615
609787
  }
609616
609788
  function listProfiles(projectDir2) {
609617
609789
  const result = [];
609618
609790
  const seen = /* @__PURE__ */ new Set();
609619
609791
  const projDir = projectProfileDir(projectDir2);
609620
- if (existsSync112(projDir)) {
609792
+ if (existsSync113(projDir)) {
609621
609793
  for (const f2 of readdirSync38(projDir).filter((f3) => f3.endsWith(".json"))) {
609622
609794
  try {
609623
- const raw = JSON.parse(readFileSync93(join128(projDir, f2), "utf8"));
609795
+ const raw = JSON.parse(readFileSync94(join129(projDir, f2), "utf8"));
609624
609796
  const name10 = f2.replace(".json", "");
609625
609797
  seen.add(name10);
609626
609798
  result.push({
@@ -609634,12 +609806,12 @@ function listProfiles(projectDir2) {
609634
609806
  }
609635
609807
  }
609636
609808
  const globDir = globalProfileDir();
609637
- if (existsSync112(globDir)) {
609809
+ if (existsSync113(globDir)) {
609638
609810
  for (const f2 of readdirSync38(globDir).filter((f3) => f3.endsWith(".json"))) {
609639
609811
  const name10 = f2.replace(".json", "");
609640
609812
  if (seen.has(name10)) continue;
609641
609813
  try {
609642
- const raw = JSON.parse(readFileSync93(join128(globDir, f2), "utf8"));
609814
+ const raw = JSON.parse(readFileSync94(join129(globDir, f2), "utf8"));
609643
609815
  result.push({
609644
609816
  name: name10,
609645
609817
  description: raw.description || "",
@@ -609654,11 +609826,11 @@ function listProfiles(projectDir2) {
609654
609826
  }
609655
609827
  function loadProfile(name10, password, projectDir2) {
609656
609828
  const sanitized = name10.replace(/[^a-zA-Z0-9_-]/g, "");
609657
- const projPath = join128(projectProfileDir(projectDir2), `${sanitized}.json`);
609658
- const globPath = join128(globalProfileDir(), `${sanitized}.json`);
609659
- const filePath = existsSync112(projPath) ? projPath : existsSync112(globPath) ? globPath : null;
609829
+ const projPath = join129(projectProfileDir(projectDir2), `${sanitized}.json`);
609830
+ const globPath = join129(globalProfileDir(), `${sanitized}.json`);
609831
+ const filePath = existsSync113(projPath) ? projPath : existsSync113(globPath) ? globPath : null;
609660
609832
  if (!filePath) return null;
609661
- const raw = JSON.parse(readFileSync93(filePath, "utf8"));
609833
+ const raw = JSON.parse(readFileSync94(filePath, "utf8"));
609662
609834
  if (raw.encrypted === true) {
609663
609835
  if (!password) return null;
609664
609836
  return decryptProfile(raw, password);
@@ -609669,22 +609841,22 @@ function saveProfile(profile, password, scope = "global", projectDir2) {
609669
609841
  const dir = scope === "project" ? projectProfileDir(projectDir2) : globalProfileDir();
609670
609842
  mkdirSync67(dir, { recursive: true });
609671
609843
  const sanitized = profile.name.replace(/[^a-zA-Z0-9_-]/g, "");
609672
- const filePath = join128(dir, `${sanitized}.json`);
609844
+ const filePath = join129(dir, `${sanitized}.json`);
609673
609845
  profile.modified = (/* @__PURE__ */ new Date()).toISOString();
609674
609846
  if (password) {
609675
609847
  const encrypted = encryptProfile(profile, password);
609676
- writeFileSync60(filePath, JSON.stringify(encrypted, null, 2), { mode: 384 });
609848
+ writeFileSync61(filePath, JSON.stringify(encrypted, null, 2), { mode: 384 });
609677
609849
  } else {
609678
609850
  profile.encrypted = false;
609679
- writeFileSync60(filePath, JSON.stringify(profile, null, 2), { mode: 420 });
609851
+ writeFileSync61(filePath, JSON.stringify(profile, null, 2), { mode: 420 });
609680
609852
  }
609681
609853
  }
609682
609854
  function deleteProfile(name10, scope = "global", projectDir2) {
609683
609855
  const sanitized = name10.replace(/[^a-zA-Z0-9_-]/g, "");
609684
609856
  const dir = scope === "project" ? projectProfileDir(projectDir2) : globalProfileDir();
609685
- const filePath = join128(dir, `${sanitized}.json`);
609686
- if (existsSync112(filePath)) {
609687
- unlinkSync23(filePath);
609857
+ const filePath = join129(dir, `${sanitized}.json`);
609858
+ if (existsSync113(filePath)) {
609859
+ unlinkSync24(filePath);
609688
609860
  return true;
609689
609861
  }
609690
609862
  return false;
@@ -609860,23 +610032,23 @@ var init_profiles = __esm({
609860
610032
 
609861
610033
  // packages/cli/src/docker.ts
609862
610034
  import { execSync as execSync56, spawn as spawn26 } from "node:child_process";
609863
- import { existsSync as existsSync113, mkdirSync as mkdirSync68, writeFileSync as writeFileSync61 } from "node:fs";
609864
- import { join as join129, resolve as resolve38, dirname as dirname35 } from "node:path";
610035
+ import { existsSync as existsSync114, mkdirSync as mkdirSync68, writeFileSync as writeFileSync62 } from "node:fs";
610036
+ import { join as join130, resolve as resolve38, dirname as dirname35 } from "node:path";
609865
610037
  import { homedir as homedir44 } from "node:os";
609866
610038
  import { fileURLToPath as fileURLToPath16 } from "node:url";
609867
610039
  function getDockerDir() {
609868
610040
  try {
609869
610041
  if (typeof __dirname !== "undefined") {
609870
- return join129(__dirname, "..", "..", "..", "docker");
610042
+ return join130(__dirname, "..", "..", "..", "docker");
609871
610043
  }
609872
610044
  } catch {
609873
610045
  }
609874
610046
  try {
609875
610047
  const thisDir = dirname35(fileURLToPath16(import.meta.url));
609876
- return join129(thisDir, "..", "..", "..", "docker");
610048
+ return join130(thisDir, "..", "..", "..", "docker");
609877
610049
  } catch {
609878
610050
  }
609879
- return join129(process.cwd(), "docker");
610051
+ return join130(process.cwd(), "docker");
609880
610052
  }
609881
610053
  function isDockerAvailable() {
609882
610054
  try {
@@ -610007,10 +610179,10 @@ async function ensureOaImage(force = false) {
610007
610179
  }
610008
610180
  let buildContext;
610009
610181
  const dockerDir = getDockerDir();
610010
- if (existsSync113(join129(dockerDir, "Dockerfile"))) {
610182
+ if (existsSync114(join130(dockerDir, "Dockerfile"))) {
610011
610183
  buildContext = dockerDir;
610012
610184
  } else {
610013
- buildContext = join129(homedir44(), ".oa", "docker-build");
610185
+ buildContext = join130(homedir44(), ".oa", "docker-build");
610014
610186
  mkdirSync68(buildContext, { recursive: true });
610015
610187
  writeDockerfiles(buildContext);
610016
610188
  }
@@ -610085,8 +610257,8 @@ chown -R node:node /workspace /home/node/.oa /home/node/.open-agents 2>/dev/null
610085
610257
  if [ "$1" = "oa" ]; then shift; exec su - node -c "cd /workspace && oa $*"; fi
610086
610258
  exec "$@"
610087
610259
  `;
610088
- writeFileSync61(join129(dir, "Dockerfile"), dockerfile);
610089
- writeFileSync61(join129(dir, "docker-entrypoint.sh"), entrypoint, { mode: 493 });
610260
+ writeFileSync62(join130(dir, "Dockerfile"), dockerfile);
610261
+ writeFileSync62(join130(dir, "docker-entrypoint.sh"), entrypoint, { mode: 493 });
610090
610262
  }
610091
610263
  function hasNvidiaGpu() {
610092
610264
  try {
@@ -610339,23 +610511,23 @@ import * as http5 from "node:http";
610339
610511
  import * as https3 from "node:https";
610340
610512
  import { createRequire as createRequire5 } from "node:module";
610341
610513
  import { fileURLToPath as fileURLToPath17 } from "node:url";
610342
- import { dirname as dirname36, join as join130, resolve as resolve39 } from "node:path";
610514
+ import { dirname as dirname36, join as join131, resolve as resolve39 } from "node:path";
610343
610515
  import { homedir as homedir45 } from "node:os";
610344
610516
  import { spawn as spawn27, execSync as execSync57 } from "node:child_process";
610345
- import { mkdirSync as mkdirSync69, writeFileSync as writeFileSync62, readFileSync as readFileSync94, readdirSync as readdirSync39, existsSync as existsSync114, watch as fsWatch3, renameSync as renameSync8, unlinkSync as unlinkSync24 } from "node:fs";
610517
+ import { mkdirSync as mkdirSync69, writeFileSync as writeFileSync63, readFileSync as readFileSync95, readdirSync as readdirSync39, existsSync as existsSync115, watch as fsWatch3, renameSync as renameSync8, unlinkSync as unlinkSync25 } from "node:fs";
610346
610518
  import { randomBytes as randomBytes23, randomUUID as randomUUID16 } from "node:crypto";
610347
610519
  import { createHash as createHash22 } from "node:crypto";
610348
610520
  function getVersion3() {
610349
610521
  try {
610350
610522
  const thisDir = dirname36(fileURLToPath17(import.meta.url));
610351
610523
  const candidates = [
610352
- join130(thisDir, "..", "package.json"),
610353
- join130(thisDir, "..", "..", "package.json"),
610354
- join130(thisDir, "..", "..", "..", "package.json")
610524
+ join131(thisDir, "..", "package.json"),
610525
+ join131(thisDir, "..", "..", "package.json"),
610526
+ join131(thisDir, "..", "..", "..", "package.json")
610355
610527
  ];
610356
610528
  for (const pkgPath of candidates) {
610357
610529
  try {
610358
- if (!existsSync114(pkgPath)) continue;
610530
+ if (!existsSync115(pkgPath)) continue;
610359
610531
  const pkg = require3(pkgPath);
610360
610532
  if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli" || pkg.name === "@open-agents/monorepo") {
610361
610533
  return pkg.version ?? "0.0.0";
@@ -610611,9 +610783,9 @@ function isOriginAllowed(origin) {
610611
610783
  if (!origin) return true;
610612
610784
  let accessMode = (process.env["OA_ACCESS"] || "").toLowerCase().trim();
610613
610785
  try {
610614
- const accessFile = join130(homedir45(), ".open-agents", "access");
610615
- if (existsSync114(accessFile)) {
610616
- const persisted = readFileSync94(accessFile, "utf8").trim().toLowerCase();
610786
+ const accessFile = join131(homedir45(), ".open-agents", "access");
610787
+ if (existsSync115(accessFile)) {
610788
+ const persisted = readFileSync95(accessFile, "utf8").trim().toLowerCase();
610617
610789
  if (persisted === "any" || persisted === "lan" || persisted === "loopback") {
610618
610790
  accessMode = persisted;
610619
610791
  }
@@ -610673,7 +610845,7 @@ async function retrieveMemoryContext(userMessage, sessionId, maxEpisodes = 5) {
610673
610845
  if (!memMod || !memMod.EpisodeStore) {
610674
610846
  return { contextBlock: "", retrieved: [] };
610675
610847
  }
610676
- const dbPath = join130(homedir45(), ".open-agents", "memory.db");
610848
+ const dbPath = join131(homedir45(), ".open-agents", "memory.db");
610677
610849
  const store2 = new memMod.EpisodeStore(dbPath);
610678
610850
  const recent = store2.search({ limit: 30, sessionId: void 0 }) ?? [];
610679
610851
  const qLower = userMessage.toLowerCase();
@@ -610716,7 +610888,7 @@ async function writeMemoryEpisodes(sessionId, userMessage, assistantContent, too
610716
610888
  try {
610717
610889
  const memMod = await Promise.resolve().then(() => (init_dist7(), dist_exports2)).catch(() => null);
610718
610890
  if (!memMod || !memMod.EpisodeStore) return 0;
610719
- const dbPath = join130(homedir45(), ".open-agents", "memory.db");
610891
+ const dbPath = join131(homedir45(), ".open-agents", "memory.db");
610720
610892
  const store2 = new memMod.EpisodeStore(dbPath);
610721
610893
  let written = 0;
610722
610894
  try {
@@ -611046,27 +611218,27 @@ function ollamaStream(ollamaUrl, path11, method, body, onData, onEnd, onError, t
611046
611218
  }
611047
611219
  function jobsDir() {
611048
611220
  const root = resolve39(process.cwd());
611049
- const dir = join130(root, ".oa", "jobs");
611221
+ const dir = join131(root, ".oa", "jobs");
611050
611222
  mkdirSync69(dir, { recursive: true });
611051
611223
  return dir;
611052
611224
  }
611053
611225
  function loadJob(id) {
611054
- const file = join130(jobsDir(), `${id}.json`);
611055
- if (!existsSync114(file)) return null;
611226
+ const file = join131(jobsDir(), `${id}.json`);
611227
+ if (!existsSync115(file)) return null;
611056
611228
  try {
611057
- return JSON.parse(readFileSync94(file, "utf-8"));
611229
+ return JSON.parse(readFileSync95(file, "utf-8"));
611058
611230
  } catch {
611059
611231
  return null;
611060
611232
  }
611061
611233
  }
611062
611234
  function listJobs() {
611063
611235
  const dir = jobsDir();
611064
- if (!existsSync114(dir)) return [];
611236
+ if (!existsSync115(dir)) return [];
611065
611237
  const files = readdirSync39(dir).filter((f2) => f2.endsWith(".json")).sort();
611066
611238
  const jobs = [];
611067
611239
  for (const file of files) {
611068
611240
  try {
611069
- jobs.push(JSON.parse(readFileSync94(join130(dir, file), "utf-8")));
611241
+ jobs.push(JSON.parse(readFileSync95(join131(dir, file), "utf-8")));
611070
611242
  } catch {
611071
611243
  }
611072
611244
  }
@@ -611076,14 +611248,14 @@ function pruneOldJobs() {
611076
611248
  const retentionH = parseFloat(process.env["OA_RUN_RETENTION_H"] || "24");
611077
611249
  const cutoffMs = Date.now() - (Number.isFinite(retentionH) && retentionH > 0 ? retentionH : 24) * 36e5;
611078
611250
  const dir = jobsDir();
611079
- if (!existsSync114(dir)) return { pruned: 0, kept: 0 };
611251
+ if (!existsSync115(dir)) return { pruned: 0, kept: 0 };
611080
611252
  let pruned = 0;
611081
611253
  let kept = 0;
611082
611254
  for (const file of readdirSync39(dir)) {
611083
611255
  if (!file.endsWith(".json")) continue;
611084
- const path11 = join130(dir, file);
611256
+ const path11 = join131(dir, file);
611085
611257
  try {
611086
- const job = JSON.parse(readFileSync94(path11, "utf-8"));
611258
+ const job = JSON.parse(readFileSync95(path11, "utf-8"));
611087
611259
  if (job.status === "running") {
611088
611260
  kept++;
611089
611261
  continue;
@@ -611092,13 +611264,13 @@ function pruneOldJobs() {
611092
611264
  const ts = ageRef ? Date.parse(ageRef) : NaN;
611093
611265
  if (Number.isFinite(ts) && ts < cutoffMs) {
611094
611266
  try {
611095
- unlinkSync24(path11);
611267
+ unlinkSync25(path11);
611096
611268
  } catch {
611097
611269
  }
611098
611270
  const outFile = path11.replace(/\.json$/, ".output");
611099
- if (existsSync114(outFile)) {
611271
+ if (existsSync115(outFile)) {
611100
611272
  try {
611101
- unlinkSync24(outFile);
611273
+ unlinkSync25(outFile);
611102
611274
  } catch {
611103
611275
  }
611104
611276
  }
@@ -611108,7 +611280,7 @@ function pruneOldJobs() {
611108
611280
  }
611109
611281
  } catch {
611110
611282
  try {
611111
- unlinkSync24(path11);
611283
+ unlinkSync25(path11);
611112
611284
  pruned++;
611113
611285
  } catch {
611114
611286
  }
@@ -611389,18 +611561,18 @@ function autoSeedTodosFromPrompt(prompt) {
611389
611561
  return [];
611390
611562
  }
611391
611563
  function atomicJobWrite(dir, id, job) {
611392
- const finalPath = join130(dir, `${id}.json`);
611564
+ const finalPath = join131(dir, `${id}.json`);
611393
611565
  const tmpPath = `${finalPath}.tmp.${process.pid}.${Date.now()}`;
611394
611566
  try {
611395
- writeFileSync62(tmpPath, JSON.stringify(job, null, 2), "utf-8");
611567
+ writeFileSync63(tmpPath, JSON.stringify(job, null, 2), "utf-8");
611396
611568
  renameSync8(tmpPath, finalPath);
611397
611569
  } catch {
611398
611570
  try {
611399
- writeFileSync62(finalPath, JSON.stringify(job, null, 2), "utf-8");
611571
+ writeFileSync63(finalPath, JSON.stringify(job, null, 2), "utf-8");
611400
611572
  } catch {
611401
611573
  }
611402
611574
  try {
611403
- unlinkSync24(tmpPath);
611575
+ unlinkSync25(tmpPath);
611404
611576
  } catch {
611405
611577
  }
611406
611578
  }
@@ -612831,27 +613003,27 @@ ${task}` : task;
612831
613003
  });
612832
613004
  }
612833
613005
  function updateStateFile() {
612834
- return join130(homedir45(), ".open-agents", "update-state.json");
613006
+ return join131(homedir45(), ".open-agents", "update-state.json");
612835
613007
  }
612836
613008
  function updateLogPath() {
612837
- return join130(homedir45(), ".open-agents", "update.log");
613009
+ return join131(homedir45(), ".open-agents", "update.log");
612838
613010
  }
612839
613011
  function readUpdateState() {
612840
613012
  try {
612841
613013
  const p2 = updateStateFile();
612842
- if (!existsSync114(p2)) return null;
612843
- return JSON.parse(readFileSync94(p2, "utf-8"));
613014
+ if (!existsSync115(p2)) return null;
613015
+ return JSON.parse(readFileSync95(p2, "utf-8"));
612844
613016
  } catch {
612845
613017
  return null;
612846
613018
  }
612847
613019
  }
612848
613020
  function writeUpdateState(state) {
612849
613021
  try {
612850
- const dir = join130(homedir45(), ".open-agents");
613022
+ const dir = join131(homedir45(), ".open-agents");
612851
613023
  mkdirSync69(dir, { recursive: true });
612852
613024
  const finalPath = updateStateFile();
612853
613025
  const tmpPath = `${finalPath}.tmp.${process.pid}`;
612854
- writeFileSync62(tmpPath, JSON.stringify(state, null, 2), "utf-8");
613026
+ writeFileSync63(tmpPath, JSON.stringify(state, null, 2), "utf-8");
612855
613027
  renameSync8(tmpPath, finalPath);
612856
613028
  } catch {
612857
613029
  }
@@ -612895,15 +613067,15 @@ async function handleV1Update(req2, res, requestId) {
612895
613067
  const { execSync: es } = require3("node:child_process");
612896
613068
  const isWin2 = process.platform === "win32";
612897
613069
  let npmBin = "";
612898
- for (const candidate of isWin2 ? [join130(nodeDir, "npm.cmd"), join130(nodeDir, "npm")] : [join130(nodeDir, "npm"), "/usr/local/bin/npm", "/usr/bin/npm"]) {
612899
- if (existsSync114(candidate)) {
613070
+ for (const candidate of isWin2 ? [join131(nodeDir, "npm.cmd"), join131(nodeDir, "npm")] : [join131(nodeDir, "npm"), "/usr/local/bin/npm", "/usr/bin/npm"]) {
613071
+ if (existsSync115(candidate)) {
612900
613072
  npmBin = candidate;
612901
613073
  break;
612902
613074
  }
612903
613075
  }
612904
613076
  if (!npmBin) npmBin = isWin2 ? "npm.cmd" : "npm";
612905
613077
  const pkgSpec = `open-agents-ai@${targetVersion}`;
612906
- const dir = join130(homedir45(), ".open-agents");
613078
+ const dir = join131(homedir45(), ".open-agents");
612907
613079
  fs10.mkdirSync(dir, { recursive: true });
612908
613080
  const logFd = fs10.openSync(logPath3, "w");
612909
613081
  const npmPrefix = dirname36(nodeDir);
@@ -612913,13 +613085,13 @@ async function handleV1Update(req2, res, requestId) {
612913
613085
  globalBinDir = es(`${npmBin} bin -g`, { encoding: "utf8", timeout: 5e3, stdio: "pipe" }).trim();
612914
613086
  } else {
612915
613087
  const npmCliCandidates = [
612916
- join130(nodeDir, "..", "lib", "node_modules", "npm", "bin", "npm-cli.js"),
612917
- join130(npmBin, "..", "..", "lib", "node_modules", "npm", "bin", "npm-cli.js")
613088
+ join131(nodeDir, "..", "lib", "node_modules", "npm", "bin", "npm-cli.js"),
613089
+ join131(npmBin, "..", "..", "lib", "node_modules", "npm", "bin", "npm-cli.js")
612918
613090
  ];
612919
613091
  let npmCli = "";
612920
613092
  for (const c9 of npmCliCandidates) {
612921
613093
  try {
612922
- if (existsSync114(c9)) {
613094
+ if (existsSync115(c9)) {
612923
613095
  npmCli = c9;
612924
613096
  break;
612925
613097
  }
@@ -612951,13 +613123,13 @@ async function handleV1Update(req2, res, requestId) {
612951
613123
  });
612952
613124
  } else {
612953
613125
  const npmCliCandidates = [
612954
- join130(nodeDir, "..", "lib", "node_modules", "npm", "bin", "npm-cli.js"),
612955
- join130(npmBin, "..", "..", "lib", "node_modules", "npm", "bin", "npm-cli.js")
613126
+ join131(nodeDir, "..", "lib", "node_modules", "npm", "bin", "npm-cli.js"),
613127
+ join131(npmBin, "..", "..", "lib", "node_modules", "npm", "bin", "npm-cli.js")
612956
613128
  ];
612957
613129
  let npmCli = "";
612958
613130
  for (const c9 of npmCliCandidates) {
612959
613131
  try {
612960
- if (existsSync114(c9)) {
613132
+ if (existsSync115(c9)) {
612961
613133
  npmCli = c9;
612962
613134
  break;
612963
613135
  }
@@ -613054,8 +613226,8 @@ function handleV1UpdateStatus(res) {
613054
613226
  let logTail = "";
613055
613227
  let exitCode = null;
613056
613228
  try {
613057
- if (existsSync114(logPath3)) {
613058
- const raw = readFileSync94(logPath3, "utf-8");
613229
+ if (existsSync115(logPath3)) {
613230
+ const raw = readFileSync95(logPath3, "utf-8");
613059
613231
  const m2 = raw.match(/__EXIT_CODE=(\d+)/);
613060
613232
  if (m2) exitCode = parseInt(m2[1], 10);
613061
613233
  logTail = raw.slice(-2e3);
@@ -613151,7 +613323,7 @@ async function handleV1Run(req2, res) {
613151
613323
  if (workingDir) {
613152
613324
  cwd4 = resolve39(workingDir);
613153
613325
  } else if (isolate) {
613154
- const wsDir = join130(dir, "..", "workspaces", id);
613326
+ const wsDir = join131(dir, "..", "workspaces", id);
613155
613327
  mkdirSync69(wsDir, { recursive: true });
613156
613328
  cwd4 = wsDir;
613157
613329
  } else {
@@ -613338,7 +613510,7 @@ async function handleV1Run(req2, res) {
613338
613510
  let output = "";
613339
613511
  let tailBytes = 0;
613340
613512
  const TAIL_BUDGET = 1048576;
613341
- const outputWriter = new DiskTaskOutput(join130(dir, `${id}.output`));
613513
+ const outputWriter = new DiskTaskOutput(join131(dir, `${id}.output`));
613342
613514
  job.outputFile = outputWriter.path;
613343
613515
  atomicJobWrite(dir, id, job);
613344
613516
  child.stdout?.on("data", (chunk) => {
@@ -614310,10 +614482,10 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
614310
614482
  return;
614311
614483
  }
614312
614484
  const { tmpdir: tmpdir23 } = await import("node:os");
614313
- const { writeFileSync: writeFileSync67, unlinkSync: unlinkSync25 } = await import("node:fs");
614485
+ const { writeFileSync: writeFileSync68, unlinkSync: unlinkSync26 } = await import("node:fs");
614314
614486
  const { join: pjoin } = await import("node:path");
614315
614487
  const tmpPath = pjoin(tmpdir23(), `oa-clone-upload-${Date.now()}-${safeName}`);
614316
- writeFileSync67(tmpPath, buf);
614488
+ writeFileSync68(tmpPath, buf);
614317
614489
  try {
614318
614490
  const ve = getVoiceEngine();
614319
614491
  const msg = await ve.setCloneVoice(tmpPath);
@@ -614325,7 +614497,7 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
614325
614497
  });
614326
614498
  } finally {
614327
614499
  try {
614328
- unlinkSync25(tmpPath);
614500
+ unlinkSync26(tmpPath);
614329
614501
  } catch {
614330
614502
  }
614331
614503
  }
@@ -614905,7 +615077,7 @@ data: ${JSON.stringify(data)}
614905
615077
  }
614906
615078
  for (const f2 of seenFiles) {
614907
615079
  try {
614908
- writeFileSync62(f2, JSON.stringify({ tasks: [] }, null, 2));
615080
+ writeFileSync63(f2, JSON.stringify({ tasks: [] }, null, 2));
614909
615081
  deleted++;
614910
615082
  } catch {
614911
615083
  }
@@ -616009,7 +616181,7 @@ ${steering}`;
616009
616181
  function getScheduleRoots() {
616010
616182
  const rootsEnv = process.env["OA_SCHEDULE_ROOTS"] || "";
616011
616183
  const roots = rootsEnv.split(rootsEnv.includes(";") ? ";" : ":").filter(Boolean);
616012
- const defaults3 = [process.cwd(), join130(homedir45(), "Documents")];
616184
+ const defaults3 = [process.cwd(), join131(homedir45(), "Documents")];
616013
616185
  const set = /* @__PURE__ */ new Set([...defaults3, ...roots]);
616014
616186
  return [...set];
616015
616187
  }
@@ -616021,10 +616193,10 @@ function listScheduledTasks() {
616021
616193
  for (const root of roots) {
616022
616194
  try {
616023
616195
  walk(root, 0, (dir) => {
616024
- if (dir.endsWith(`${join130(".oa", "scheduled")}`) || dir.includes(`${join130(".oa", "scheduled")}`)) {
616025
- const file = join130(dir, "tasks.json");
616196
+ if (dir.endsWith(`${join131(".oa", "scheduled")}`) || dir.includes(`${join131(".oa", "scheduled")}`)) {
616197
+ const file = join131(dir, "tasks.json");
616026
616198
  try {
616027
- const raw = readFileSync94(file, "utf-8");
616199
+ const raw = readFileSync95(file, "utf-8");
616028
616200
  const json = JSON.parse(raw);
616029
616201
  const tasks = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
616030
616202
  tasks.forEach((t2, i2) => {
@@ -616089,7 +616261,7 @@ function walk(dir, depth, onDir, maxDepth) {
616089
616261
  if (e2.name === "node_modules" || e2.name.startsWith(".")) {
616090
616262
  if (e2.name !== ".oa") continue;
616091
616263
  }
616092
- const child = join130(dir, e2.name);
616264
+ const child = join131(dir, e2.name);
616093
616265
  walk(child, depth + 1, onDir, maxDepth);
616094
616266
  }
616095
616267
  }
@@ -616098,18 +616270,18 @@ function setScheduledEnabled(id, enabled2) {
616098
616270
  const target = tasks.find((t2) => t2.id === id);
616099
616271
  if (!target) return false;
616100
616272
  try {
616101
- const raw = readFileSync94(target.file, "utf-8");
616273
+ const raw = readFileSync95(target.file, "utf-8");
616102
616274
  const json = JSON.parse(raw);
616103
616275
  const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
616104
616276
  if (!arr[target.index]) return false;
616105
616277
  arr[target.index].enabled = enabled2;
616106
616278
  if (Array.isArray(json?.tasks)) {
616107
616279
  json.tasks = arr;
616108
- writeFileSync62(target.file, JSON.stringify(json, null, 2));
616280
+ writeFileSync63(target.file, JSON.stringify(json, null, 2));
616109
616281
  } else if (Array.isArray(json)) {
616110
- writeFileSync62(target.file, JSON.stringify(arr, null, 2));
616282
+ writeFileSync63(target.file, JSON.stringify(arr, null, 2));
616111
616283
  } else {
616112
- writeFileSync62(target.file, JSON.stringify({ tasks: arr }, null, 2));
616284
+ writeFileSync63(target.file, JSON.stringify({ tasks: arr }, null, 2));
616113
616285
  }
616114
616286
  if (!enabled2) {
616115
616287
  try {
@@ -616131,7 +616303,7 @@ function deleteScheduledById(id) {
616131
616303
  const target = tasks.find((t2) => t2.id === id);
616132
616304
  if (!target) return false;
616133
616305
  try {
616134
- const raw = readFileSync94(target.file, "utf-8");
616306
+ const raw = readFileSync95(target.file, "utf-8");
616135
616307
  const json = JSON.parse(raw);
616136
616308
  const arr = Array.isArray(json?.tasks) ? json.tasks : Array.isArray(json) ? json : [];
616137
616309
  if (!arr[target.index]) return false;
@@ -616139,11 +616311,11 @@ function deleteScheduledById(id) {
616139
616311
  arr.splice(target.index, 1);
616140
616312
  if (Array.isArray(json?.tasks)) {
616141
616313
  json.tasks = arr;
616142
- writeFileSync62(target.file, JSON.stringify(json, null, 2));
616314
+ writeFileSync63(target.file, JSON.stringify(json, null, 2));
616143
616315
  } else if (Array.isArray(json)) {
616144
- writeFileSync62(target.file, JSON.stringify(arr, null, 2));
616316
+ writeFileSync63(target.file, JSON.stringify(arr, null, 2));
616145
616317
  } else {
616146
- writeFileSync62(target.file, JSON.stringify({ tasks: arr }, null, 2));
616318
+ writeFileSync63(target.file, JSON.stringify({ tasks: arr }, null, 2));
616147
616319
  }
616148
616320
  const candidates = [];
616149
616321
  if (id) candidates.push(id);
@@ -616396,11 +616568,11 @@ function reconcileScheduledTasks(apply) {
616396
616568
  const errors = [];
616397
616569
  for (const f2 of found) {
616398
616570
  const wdir = f2.workingDir || process.cwd();
616399
- const file = join130(wdir, ".oa", "scheduled", "tasks.json");
616571
+ const file = join131(wdir, ".oa", "scheduled", "tasks.json");
616400
616572
  try {
616401
616573
  let json = { tasks: [] };
616402
616574
  try {
616403
- const raw = readFileSync94(file, "utf-8");
616575
+ const raw = readFileSync95(file, "utf-8");
616404
616576
  json = JSON.parse(raw);
616405
616577
  } catch {
616406
616578
  }
@@ -616411,9 +616583,9 @@ function reconcileScheduledTasks(apply) {
616411
616583
  const entry = { task: f2.task || `legacy ${f2.id}`, schedule: f2.cron, enabled: true };
616412
616584
  arr.push(entry);
616413
616585
  const toWrite = Array.isArray(json?.tasks) ? { ...json, tasks: arr } : Array.isArray(json) ? arr : { tasks: arr };
616414
- mkdirSync69(join130(wdir, ".oa", "scheduled"), { recursive: true });
616415
- mkdirSync69(join130(wdir, ".oa", "scheduled", "logs"), { recursive: true });
616416
- writeFileSync62(file, JSON.stringify(toWrite, null, 2));
616586
+ mkdirSync69(join131(wdir, ".oa", "scheduled"), { recursive: true });
616587
+ mkdirSync69(join131(wdir, ".oa", "scheduled", "logs"), { recursive: true });
616588
+ writeFileSync63(file, JSON.stringify(toWrite, null, 2));
616417
616589
  adopted.push({ file, index: arr.length - 1 });
616418
616590
  }
616419
616591
  } else {
@@ -616457,32 +616629,32 @@ function writeCrontabLines(lines) {
616457
616629
  }
616458
616630
  function canonicalCronLine(rec) {
616459
616631
  const oaBin = findOaBinary4();
616460
- const logDir = join130(rec.workingDir, ".oa", "scheduled", "logs");
616461
- const logFile = join130(logDir, `${rec.id}.log`);
616462
- const storeFile = join130(rec.workingDir, ".oa", "scheduled", "tasks.json");
616632
+ const logDir = join131(rec.workingDir, ".oa", "scheduled", "logs");
616633
+ const logFile = join131(logDir, `${rec.id}.log`);
616634
+ const storeFile = join131(rec.workingDir, ".oa", "scheduled", "tasks.json");
616463
616635
  const taskEsc = rec.task.replace(/'/g, "'\\''");
616464
- const lockDir = join130(rec.workingDir, ".oa", "run");
616465
- const lockPath = join130(lockDir, `${rec.id}.lock`);
616636
+ const lockDir = join131(rec.workingDir, ".oa", "run");
616637
+ const lockPath = join131(lockDir, `${rec.id}.lock`);
616466
616638
  const wrapper = [
616467
616639
  `cd ${JSON.stringify(rec.workingDir)}`,
616468
616640
  `mkdir -p ${JSON.stringify(logDir)}`,
616469
616641
  `mkdir -p ${JSON.stringify(lockDir)}`,
616470
616642
  `if mkdir ${JSON.stringify(lockPath)} 2>/dev/null; then`,
616471
- ` echo $$ > ${JSON.stringify(join130(lockPath, "pid"))}`,
616643
+ ` echo $$ > ${JSON.stringify(join131(lockPath, "pid"))}`,
616472
616644
  ` trap 'rm -rf ${lockPath}' EXIT`,
616473
616645
  `else`,
616474
- ` if [ -f ${JSON.stringify(join130(lockPath, "pid"))} ]; then`,
616475
- ` oldpid=$(cat ${JSON.stringify(join130(lockPath, "pid"))} 2>/dev/null || echo)`,
616646
+ ` if [ -f ${JSON.stringify(join131(lockPath, "pid"))} ]; then`,
616647
+ ` oldpid=$(cat ${JSON.stringify(join131(lockPath, "pid"))} 2>/dev/null || echo)`,
616476
616648
  ` if [ -n "$oldpid" ] && kill -0 "$oldpid" 2>/dev/null; then`,
616477
616649
  ` echo "[oa-scheduler] ${rec.id} already running as PID $oldpid; skipping" >> ${JSON.stringify(logFile)}`,
616478
616650
  ` exit 0`,
616479
616651
  ` else`,
616480
616652
  ` rm -rf ${JSON.stringify(lockPath)} 2>/dev/null || true`,
616481
- ` mkdir -p ${JSON.stringify(lockPath)} && echo $$ > ${JSON.stringify(join130(lockPath, "pid"))} && trap 'rm -rf ${lockPath}' EXIT`,
616653
+ ` mkdir -p ${JSON.stringify(lockPath)} && echo $$ > ${JSON.stringify(join131(lockPath, "pid"))} && trap 'rm -rf ${lockPath}' EXIT`,
616482
616654
  ` fi`,
616483
616655
  ` else`,
616484
616656
  ` rm -rf ${JSON.stringify(lockPath)} 2>/dev/null || true`,
616485
- ` mkdir -p ${JSON.stringify(lockPath)} && echo $$ > ${JSON.stringify(join130(lockPath, "pid"))} && trap 'rm -rf ${lockPath}' EXIT`,
616657
+ ` mkdir -p ${JSON.stringify(lockPath)} && echo $$ > ${JSON.stringify(join131(lockPath, "pid"))} && trap 'rm -rf ${lockPath}' EXIT`,
616486
616658
  ` fi`,
616487
616659
  `fi`,
616488
616660
  `${oaBin} '${taskEsc}' >> ${JSON.stringify(logFile)} 2>&1; _oa_exit=$?`,
@@ -616514,9 +616686,9 @@ function fixupOrMigrateScheduled(mode, dryRun) {
616514
616686
  try {
616515
616687
  if (!f2.workingDir || !f2.task) continue;
616516
616688
  const unitBase = `oa-${f2.id}`;
616517
- const unitDir = join130(homedir45(), ".config", "systemd", "user");
616518
- const svc = join130(unitDir, `${unitBase}.service`);
616519
- const tim = join130(unitDir, `${unitBase}.timer`);
616689
+ const unitDir = join131(homedir45(), ".config", "systemd", "user");
616690
+ const svc = join131(unitDir, `${unitBase}.service`);
616691
+ const tim = join131(unitDir, `${unitBase}.timer`);
616520
616692
  const oaBin = findOaBinary4();
616521
616693
  const rec = { id: f2.id, cron: f2.cron, workingDir: f2.workingDir, task: f2.task };
616522
616694
  const cmd = canonicalCronLine(rec).split(" ").slice(5).join(" ");
@@ -616547,8 +616719,8 @@ WantedBy=timers.target
616547
616719
  `;
616548
616720
  if (!dryRun) {
616549
616721
  mkdirSync69(unitDir, { recursive: true });
616550
- writeFileSync62(svc, svcText);
616551
- writeFileSync62(tim, timText);
616722
+ writeFileSync63(svc, svcText);
616723
+ writeFileSync63(tim, timText);
616552
616724
  try {
616553
616725
  const { execSync: es } = require3("node:child_process");
616554
616726
  es("systemctl --user daemon-reload", { stdio: "pipe" });
@@ -616643,8 +616815,8 @@ function startApiServer(options2 = {}) {
616643
616815
  const config = loadConfig();
616644
616816
  const ollamaUrl = options2.ollamaUrl ?? config.backendUrl;
616645
616817
  const cwd4 = process.cwd();
616646
- initAuditLog(join130(cwd4, ".oa"));
616647
- initUsageTracker(join130(cwd4, ".oa"));
616818
+ initAuditLog(join131(cwd4, ".oa"));
616819
+ initUsageTracker(join131(cwd4, ".oa"));
616648
616820
  try {
616649
616821
  const taskMgr = getSharedTaskManager();
616650
616822
  taskMgr.setEventPublisher((type, data, opts) => {
@@ -616701,7 +616873,7 @@ function startApiServer(options2 = {}) {
616701
616873
  if (!f2.endsWith(".json") || f2.includes(".tmp.")) continue;
616702
616874
  const sid = f2.replace(/\.json$/, "");
616703
616875
  try {
616704
- const items = JSON.parse(readFileSync94(join130(dir, f2), "utf-8"));
616876
+ const items = JSON.parse(readFileSync95(join131(dir, f2), "utf-8"));
616705
616877
  if (Array.isArray(items)) {
616706
616878
  cache8.set(sid, new Map(items.map((t2) => [t2.id, t2])));
616707
616879
  }
@@ -616713,10 +616885,10 @@ function startApiServer(options2 = {}) {
616713
616885
  const watcher = fsWatch3(dir, (_evt, fname) => {
616714
616886
  if (!fname || !fname.endsWith(".json") || fname.includes(".tmp.")) return;
616715
616887
  const sid = fname.replace(/\.json$/, "");
616716
- const fp = join130(dir, fname);
616888
+ const fp = join131(dir, fname);
616717
616889
  let next = [];
616718
616890
  try {
616719
- if (!existsSync114(fp)) {
616891
+ if (!existsSync115(fp)) {
616720
616892
  const old = cache8.get(sid);
616721
616893
  if (old) {
616722
616894
  for (const t2 of old.values()) {
@@ -616729,7 +616901,7 @@ function startApiServer(options2 = {}) {
616729
616901
  }
616730
616902
  return;
616731
616903
  }
616732
- next = JSON.parse(readFileSync94(fp, "utf-8"));
616904
+ next = JSON.parse(readFileSync95(fp, "utf-8"));
616733
616905
  if (!Array.isArray(next)) return;
616734
616906
  } catch {
616735
616907
  return;
@@ -616768,18 +616940,18 @@ function startApiServer(options2 = {}) {
616768
616940
  const retentionDays = parseInt(process.env["OA_JOB_RETENTION_DAYS"] ?? "30", 10);
616769
616941
  if (!apiTestMode && retentionDays > 0) {
616770
616942
  try {
616771
- const jobsDir3 = join130(cwd4, ".oa", "jobs");
616772
- if (existsSync114(jobsDir3)) {
616943
+ const jobsDir3 = join131(cwd4, ".oa", "jobs");
616944
+ if (existsSync115(jobsDir3)) {
616773
616945
  const cutoff = Date.now() - retentionDays * 864e5;
616774
616946
  for (const f2 of readdirSync39(jobsDir3)) {
616775
616947
  if (!f2.endsWith(".json")) continue;
616776
616948
  try {
616777
- const jobPath = join130(jobsDir3, f2);
616778
- const job = JSON.parse(readFileSync94(jobPath, "utf-8"));
616949
+ const jobPath = join131(jobsDir3, f2);
616950
+ const job = JSON.parse(readFileSync95(jobPath, "utf-8"));
616779
616951
  const jobTime = new Date(job.startedAt ?? job.completedAt ?? 0).getTime();
616780
616952
  if (jobTime > 0 && jobTime < cutoff && job.status !== "running") {
616781
- const { unlinkSync: unlinkSync25 } = require3("node:fs");
616782
- unlinkSync25(jobPath);
616953
+ const { unlinkSync: unlinkSync26 } = require3("node:fs");
616954
+ unlinkSync26(jobPath);
616783
616955
  }
616784
616956
  } catch {
616785
616957
  }
@@ -616795,8 +616967,8 @@ function startApiServer(options2 = {}) {
616795
616967
  if (useTls) {
616796
616968
  try {
616797
616969
  tlsOpts = {
616798
- cert: readFileSync94(resolve39(tlsCert)),
616799
- key: readFileSync94(resolve39(tlsKey))
616970
+ cert: readFileSync95(resolve39(tlsCert)),
616971
+ key: readFileSync95(resolve39(tlsKey))
616800
616972
  };
616801
616973
  } catch (e2) {
616802
616974
  log22(`
@@ -616807,9 +616979,9 @@ function startApiServer(options2 = {}) {
616807
616979
  }
616808
616980
  let runtimeAccessMode = resolveAccessMode(process.env["OA_ACCESS"], host);
616809
616981
  try {
616810
- const accessFile = join130(homedir45(), ".open-agents", "access");
616811
- if (existsSync114(accessFile)) {
616812
- const persisted = readFileSync94(accessFile, "utf8").trim();
616982
+ const accessFile = join131(homedir45(), ".open-agents", "access");
616983
+ if (existsSync115(accessFile)) {
616984
+ const persisted = readFileSync95(accessFile, "utf8").trim();
616813
616985
  const resolved = resolveAccessMode(persisted, host);
616814
616986
  if (resolved) runtimeAccessMode = resolved;
616815
616987
  }
@@ -616869,9 +617041,9 @@ function startApiServer(options2 = {}) {
616869
617041
  const previous = runtimeAccessMode;
616870
617042
  runtimeAccessMode = requested;
616871
617043
  try {
616872
- const dir = join130(homedir45(), ".open-agents");
617044
+ const dir = join131(homedir45(), ".open-agents");
616873
617045
  mkdirSync69(dir, { recursive: true });
616874
- writeFileSync62(join130(dir, "access"), `${runtimeAccessMode}
617046
+ writeFileSync63(join131(dir, "access"), `${runtimeAccessMode}
616875
617047
  `, "utf8");
616876
617048
  } catch {
616877
617049
  }
@@ -617080,9 +617252,9 @@ function startApiServer(options2 = {}) {
617080
617252
  try {
617081
617253
  const { startEmbeddingWorkers: startEmbeddingWorkers2 } = await Promise.resolve().then(() => (init_embedding_workers(), embedding_workers_exports));
617082
617254
  const { ensureEmbedDeps: ensureEmbedDeps2, runEmbedImage: runEmbedImage2, runEmbedAudio: runEmbedAudio2 } = await Promise.resolve().then(() => (init_py_embed(), py_embed_exports));
617083
- const dbBase = join130(cwd4, ".oa");
617084
- const epStore = new mem.EpisodeStore(join130(dbBase, "memory.db"));
617085
- const kg = new mem.TemporalGraph(join130(dbBase, "kg.db"));
617255
+ const dbBase = join131(cwd4, ".oa");
617256
+ const epStore = new mem.EpisodeStore(join131(dbBase, "memory.db"));
617257
+ const kg = new mem.TemporalGraph(join131(dbBase, "kg.db"));
617086
617258
  try {
617087
617259
  ensureEmbedDeps2();
617088
617260
  } catch {
@@ -617164,7 +617336,7 @@ function startApiServer(options2 = {}) {
617164
617336
  return;
617165
617337
  }
617166
617338
  try {
617167
- const { writeFileSync: writeFileSync67, mkdirSync: mkdirSync74, existsSync: _exists, readFileSync: _rfs } = require3("node:fs");
617339
+ const { writeFileSync: writeFileSync68, mkdirSync: mkdirSync74, existsSync: _exists, readFileSync: _rfs } = require3("node:fs");
617168
617340
  const { join: _join } = require3("node:path");
617169
617341
  const { homedir: _homedir } = require3("node:os");
617170
617342
  const apiHint = JSON.stringify({
@@ -617195,7 +617367,7 @@ function startApiServer(options2 = {}) {
617195
617367
  for (const dir of dirSet) {
617196
617368
  try {
617197
617369
  if (!_exists(dir)) mkdirSync74(dir, { recursive: true });
617198
- writeFileSync67(_join(dir, "api-port.json"), apiHint);
617370
+ writeFileSync68(_join(dir, "api-port.json"), apiHint);
617199
617371
  written++;
617200
617372
  } catch {
617201
617373
  }
@@ -617513,10 +617685,10 @@ async function handleMemoryIngest(req2, res, ollamaUrl) {
617513
617685
  const labels = Array.isArray(b.labels) ? b.labels : [];
617514
617686
  const mediaPath = typeof b.media_path === "string" ? b.media_path : void 0;
617515
617687
  const cwd4 = process.cwd();
617516
- const dbBase = join130(cwd4, ".oa");
617688
+ const dbBase = join131(cwd4, ".oa");
617517
617689
  const { EpisodeStore: EpisodeStore3, TemporalGraph: TemporalGraph3 } = await Promise.resolve().then(() => (init_dist7(), dist_exports2));
617518
- const epStore = new EpisodeStore3(join130(dbBase, "memory.db"));
617519
- const kg = new TemporalGraph3(join130(dbBase, "kg.db"));
617690
+ const epStore = new EpisodeStore3(join131(dbBase, "memory.db"));
617691
+ const kg = new TemporalGraph3(join131(dbBase, "kg.db"));
617520
617692
  const meta = {};
617521
617693
  if (mediaPath) meta.media_path = mediaPath;
617522
617694
  const epId = epStore.insert({ modality, content: content || (mediaPath || ""), metadata: meta, toolName: "memory_ingest" });
@@ -617583,7 +617755,7 @@ async function handleEntitiesList(req2, res) {
617583
617755
  const type = url.searchParams.get("type") || "person";
617584
617756
  const limit = Math.max(1, Math.min(1e3, parseInt(url.searchParams.get("limit") || "100", 10)));
617585
617757
  const { TemporalGraph: TemporalGraph3 } = await Promise.resolve().then(() => (init_dist7(), dist_exports2));
617586
- const kg = new TemporalGraph3(join130(process.cwd(), ".oa", "kg.db"));
617758
+ const kg = new TemporalGraph3(join131(process.cwd(), ".oa", "kg.db"));
617587
617759
  const nodes = kg.nodesByType(type, limit).map((n2) => ({ id: n2.id, text: n2.text, mentionCount: n2.mentionCount, firstSeen: n2.firstSeen, lastSeen: n2.lastSeen }));
617588
617760
  jsonResponse(res, 200, { object: "list", data: nodes });
617589
617761
  } catch (err) {
@@ -617705,16 +617877,16 @@ var clipboard_media_exports = {};
617705
617877
  __export(clipboard_media_exports, {
617706
617878
  pasteClipboardImageToFile: () => pasteClipboardImageToFile
617707
617879
  });
617708
- import { execFileSync as execFileSync2, execSync as execSync58 } from "node:child_process";
617709
- import { mkdirSync as mkdirSync70, readFileSync as readFileSync95, rmSync as rmSync5, writeFileSync as writeFileSync63 } from "node:fs";
617710
- import { join as join131 } from "node:path";
617880
+ import { execFileSync as execFileSync3, execSync as execSync58 } from "node:child_process";
617881
+ import { mkdirSync as mkdirSync70, readFileSync as readFileSync96, rmSync as rmSync5, writeFileSync as writeFileSync64 } from "node:fs";
617882
+ import { join as join132 } from "node:path";
617711
617883
  function pasteClipboardImageToFile(repoRoot) {
617712
617884
  const image = readClipboardImage();
617713
617885
  if (!image) return null;
617714
- const dir = join131(repoRoot, ".oa", "clipboard");
617886
+ const dir = join132(repoRoot, ".oa", "clipboard");
617715
617887
  mkdirSync70(dir, { recursive: true });
617716
- const path11 = join131(dir, `clipboard-${Date.now()}${image.ext}`);
617717
- writeFileSync63(path11, image.buffer);
617888
+ const path11 = join132(dir, `clipboard-${Date.now()}${image.ext}`);
617889
+ writeFileSync64(path11, image.buffer);
617718
617890
  return { path: path11, buffer: image.buffer, mime: image.mime };
617719
617891
  }
617720
617892
  function readClipboardImage() {
@@ -617722,8 +617894,8 @@ function readClipboardImage() {
617722
617894
  try {
617723
617895
  execSync58("command -v pngpaste", { stdio: "ignore", timeout: 1e3 });
617724
617896
  const tmp = `/tmp/oa-clipboard-${Date.now()}.png`;
617725
- execFileSync2("pngpaste", [tmp], { timeout: 3e3 });
617726
- const buffer2 = readFileSync95(tmp);
617897
+ execFileSync3("pngpaste", [tmp], { timeout: 3e3 });
617898
+ const buffer2 = readFileSync96(tmp);
617727
617899
  try {
617728
617900
  rmSync5(tmp);
617729
617901
  } catch {
@@ -617742,7 +617914,7 @@ function readClipboardImage() {
617742
617914
  ];
617743
617915
  for (const attempt of attempts) {
617744
617916
  try {
617745
- const buffer2 = execFileSync2(attempt.cmd, attempt.args, { timeout: 3e3, maxBuffer: 25 * 1024 * 1024 });
617917
+ const buffer2 = execFileSync3(attempt.cmd, attempt.args, { timeout: 3e3, maxBuffer: 25 * 1024 * 1024 });
617746
617918
  if (buffer2.length > 0) return { buffer: buffer2, mime: attempt.mime, ext: attempt.ext };
617747
617919
  } catch {
617748
617920
  continue;
@@ -617759,7 +617931,7 @@ function readClipboardImage() {
617759
617931
  "$img.Save($ms,[Drawing.Imaging.ImageFormat]::Png);",
617760
617932
  "[Console]::OpenStandardOutput().Write($ms.ToArray(),0,$ms.Length)"
617761
617933
  ].join("");
617762
- const buffer2 = execFileSync2("powershell.exe", ["-NoProfile", "-Command", ps], {
617934
+ const buffer2 = execFileSync3("powershell.exe", ["-NoProfile", "-Command", ps], {
617763
617935
  timeout: 5e3,
617764
617936
  maxBuffer: 25 * 1024 * 1024
617765
617937
  });
@@ -617778,18 +617950,18 @@ var init_clipboard_media = __esm({
617778
617950
 
617779
617951
  // packages/cli/src/tui/interactive.ts
617780
617952
  import { cwd } from "node:process";
617781
- import { resolve as resolve40, join as join132, dirname as dirname37, extname as extname13, relative as relative11 } from "node:path";
617953
+ import { resolve as resolve40, join as join133, dirname as dirname37, extname as extname13, relative as relative11 } from "node:path";
617782
617954
  import { createRequire as createRequire6 } from "node:module";
617783
617955
  import { fileURLToPath as fileURLToPath18 } from "node:url";
617784
617956
  import {
617785
- readFileSync as readFileSync96,
617786
- writeFileSync as writeFileSync64,
617957
+ readFileSync as readFileSync97,
617958
+ writeFileSync as writeFileSync65,
617787
617959
  appendFileSync as appendFileSync8,
617788
617960
  rmSync as rmSync6,
617789
617961
  readdirSync as readdirSync40,
617790
617962
  mkdirSync as mkdirSync71
617791
617963
  } from "node:fs";
617792
- import { existsSync as existsSync115 } from "node:fs";
617964
+ import { existsSync as existsSync116 } from "node:fs";
617793
617965
  import { execSync as execSync59 } from "node:child_process";
617794
617966
  import { homedir as homedir46 } from "node:os";
617795
617967
  function formatTimeAgo2(date) {
@@ -617807,12 +617979,12 @@ function getVersion4() {
617807
617979
  const require4 = createRequire6(import.meta.url);
617808
617980
  const thisDir = dirname37(fileURLToPath18(import.meta.url));
617809
617981
  const candidates = [
617810
- join132(thisDir, "..", "package.json"),
617811
- join132(thisDir, "..", "..", "package.json"),
617812
- join132(thisDir, "..", "..", "..", "package.json")
617982
+ join133(thisDir, "..", "package.json"),
617983
+ join133(thisDir, "..", "..", "package.json"),
617984
+ join133(thisDir, "..", "..", "..", "package.json")
617813
617985
  ];
617814
617986
  for (const pkgPath of candidates) {
617815
- if (existsSync115(pkgPath)) {
617987
+ if (existsSync116(pkgPath)) {
617816
617988
  const pkg = require4(pkgPath);
617817
617989
  if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli" || pkg.name === "@open-agents/monorepo") {
617818
617990
  return pkg.version ?? "0.0.0";
@@ -618702,14 +618874,14 @@ Meta-critique: quality ${meta.quality}/5, thorough: ${meta.thorough}`;
618702
618874
  function gatherMemorySnippets(root) {
618703
618875
  const snippets = [];
618704
618876
  const dirs = [
618705
- join132(root, ".oa", "memory"),
618706
- join132(root, ".open-agents", "memory")
618877
+ join133(root, ".oa", "memory"),
618878
+ join133(root, ".open-agents", "memory")
618707
618879
  ];
618708
618880
  for (const dir of dirs) {
618709
- if (!existsSync115(dir)) continue;
618881
+ if (!existsSync116(dir)) continue;
618710
618882
  try {
618711
618883
  for (const f2 of readdirSync40(dir).filter((f3) => f3.endsWith(".json"))) {
618712
- const data = JSON.parse(readFileSync96(join132(dir, f2), "utf-8"));
618884
+ const data = JSON.parse(readFileSync97(join133(dir, f2), "utf-8"));
618713
618885
  for (const val of Object.values(data)) {
618714
618886
  const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
618715
618887
  if (v.length > 10) snippets.push(v);
@@ -618882,9 +619054,9 @@ ${metabolismMemories}
618882
619054
  } catch {
618883
619055
  }
618884
619056
  try {
618885
- const archeFile = join132(repoRoot, ".oa", "arche", "variants.json");
618886
- if (existsSync115(archeFile)) {
618887
- const variants = JSON.parse(readFileSync96(archeFile, "utf8"));
619057
+ const archeFile = join133(repoRoot, ".oa", "arche", "variants.json");
619058
+ if (existsSync116(archeFile)) {
619059
+ const variants = JSON.parse(readFileSync97(archeFile, "utf8"));
618888
619060
  if (variants.length > 0) {
618889
619061
  let filtered = variants;
618890
619062
  if (taskType) {
@@ -619091,9 +619263,9 @@ RULES:
619091
619263
  const compactionThreshold = Number.isFinite(envOverride) && envOverride > 0 ? envOverride : modelTier === "small" ? 12e3 : modelTier === "medium" ? 24e3 : 4e4;
619092
619264
  let identityInjection = "";
619093
619265
  try {
619094
- const ikStateFile = join132(repoRoot, ".oa", "identity", "self-state.json");
619095
- if (existsSync115(ikStateFile)) {
619096
- const selfState = JSON.parse(readFileSync96(ikStateFile, "utf8"));
619266
+ const ikStateFile = join133(repoRoot, ".oa", "identity", "self-state.json");
619267
+ if (existsSync116(ikStateFile)) {
619268
+ const selfState = JSON.parse(readFileSync97(ikStateFile, "utf8"));
619097
619269
  const lines = [
619098
619270
  `[Identity State v${selfState.version}]`,
619099
619271
  `Self: ${selfState.narrative_summary}`,
@@ -619359,17 +619531,17 @@ Review its full output in the [${id}] tab or via sub_agent(action='output', id='
619359
619531
  }
619360
619532
  }
619361
619533
  try {
619362
- const { readdirSync: readdirSync42, readFileSync: readFileSync98, existsSync: existsSync118 } = await import("node:fs");
619534
+ const { readdirSync: readdirSync42, readFileSync: readFileSync99, existsSync: existsSync119 } = await import("node:fs");
619363
619535
  const { join: pathJoin } = await import("node:path");
619364
619536
  const chunksDir = pathJoin(cwd(), ".oa", "todo-chunks");
619365
- if (existsSync118(chunksDir)) {
619537
+ if (existsSync119(chunksDir)) {
619366
619538
  const files = readdirSync42(chunksDir).filter(
619367
619539
  (f2) => f2.endsWith(".json")
619368
619540
  );
619369
619541
  for (const f2 of files) {
619370
619542
  try {
619371
619543
  const data = JSON.parse(
619372
- readFileSync98(pathJoin(chunksDir, f2), "utf-8")
619544
+ readFileSync99(pathJoin(chunksDir, f2), "utf-8")
619373
619545
  );
619374
619546
  if (data._deleted) continue;
619375
619547
  if ((data.functionalSummary || "").toLowerCase().includes(q) || (data.detailSummary || "").toLowerCase().includes(q) || (data.keyFiles || []).some(
@@ -619435,11 +619607,11 @@ ${lines.join("\n")}`
619435
619607
  const expand2 = args.expand === true;
619436
619608
  if (expand2 && id.startsWith("todo-ctx-")) {
619437
619609
  try {
619438
- const { readFileSync: readFileSync98, existsSync: existsSync118 } = await import("node:fs");
619610
+ const { readFileSync: readFileSync99, existsSync: existsSync119 } = await import("node:fs");
619439
619611
  const { join: pathJoin } = await import("node:path");
619440
619612
  const chunksDir = pathJoin(cwd(), ".oa", "todo-chunks");
619441
619613
  const todoIdSuffix = id.replace("todo-ctx-", "");
619442
- const files = existsSync118(chunksDir) ? (await import("node:fs")).readdirSync(chunksDir).filter((f2) => f2.endsWith(".json")) : [];
619614
+ const files = existsSync119(chunksDir) ? (await import("node:fs")).readdirSync(chunksDir).filter((f2) => f2.endsWith(".json")) : [];
619443
619615
  let chunkData = null;
619444
619616
  for (const f2 of files) {
619445
619617
  try {
@@ -620210,11 +620382,11 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
620210
620382
  });
620211
620383
  }
620212
620384
  try {
620213
- const ikDir = join132(repoRoot, ".oa", "identity");
620214
- const ikFile = join132(ikDir, "self-state.json");
620385
+ const ikDir = join133(repoRoot, ".oa", "identity");
620386
+ const ikFile = join133(ikDir, "self-state.json");
620215
620387
  let ikState;
620216
- if (existsSync115(ikFile)) {
620217
- ikState = JSON.parse(readFileSync96(ikFile, "utf8"));
620388
+ if (existsSync116(ikFile)) {
620389
+ ikState = JSON.parse(readFileSync97(ikFile, "utf8"));
620218
620390
  } else {
620219
620391
  mkdirSync71(ikDir, { recursive: true });
620220
620392
  const machineId = Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
@@ -620326,7 +620498,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
620326
620498
  }
620327
620499
  ikState.session_count = (ikState.session_count || 0) + 1;
620328
620500
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
620329
- writeFileSync64(ikFile, JSON.stringify(ikState, null, 2));
620501
+ writeFileSync65(ikFile, JSON.stringify(ikState, null, 2));
620330
620502
  } catch (ikErr) {
620331
620503
  try {
620332
620504
  console.error("[IK-OBSERVE]", ikErr);
@@ -620358,9 +620530,9 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
620358
620530
  tokens
620359
620531
  );
620360
620532
  try {
620361
- const ikFile = join132(repoRoot, ".oa", "identity", "self-state.json");
620362
- if (existsSync115(ikFile)) {
620363
- const ikState = JSON.parse(readFileSync96(ikFile, "utf8"));
620533
+ const ikFile = join133(repoRoot, ".oa", "identity", "self-state.json");
620534
+ if (existsSync116(ikFile)) {
620535
+ const ikState = JSON.parse(readFileSync97(ikFile, "utf8"));
620364
620536
  if (!ikState.stats) ikState.stats = { queries_served: 0 };
620365
620537
  ikState.stats.queries_served = (ikState.stats.queries_served || 0) + 1;
620366
620538
  ikState.homeostasis.uncertainty = Math.min(
@@ -620382,7 +620554,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
620382
620554
  ikState.version_history = ikState.version_history.slice(-200);
620383
620555
  ikState.session_count = (ikState.session_count || 0) + 1;
620384
620556
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
620385
- writeFileSync64(ikFile, JSON.stringify(ikState, null, 2));
620557
+ writeFileSync65(ikFile, JSON.stringify(ikState, null, 2));
620386
620558
  }
620387
620559
  } catch {
620388
620560
  }
@@ -620649,10 +620821,10 @@ async function startInteractive(config, repoPath) {
620649
620821
  process.stdin.pause();
620650
620822
  }
620651
620823
  try {
620652
- const oaDir = join132(repoRoot, ".oa");
620653
- const nexusPidFile = join132(oaDir, "nexus", "daemon.pid");
620654
- if (existsSync115(nexusPidFile)) {
620655
- const pid = parseInt(readFileSync96(nexusPidFile, "utf8").trim(), 10);
620824
+ const oaDir = join133(repoRoot, ".oa");
620825
+ const nexusPidFile = join133(oaDir, "nexus", "daemon.pid");
620826
+ if (existsSync116(nexusPidFile)) {
620827
+ const pid = parseInt(readFileSync97(nexusPidFile, "utf8").trim(), 10);
620656
620828
  if (pid > 0) {
620657
620829
  try {
620658
620830
  process.kill(pid, 0);
@@ -621382,7 +621554,7 @@ ${result.summary}`
621382
621554
  let p2pGateway = null;
621383
621555
  let peerMesh = null;
621384
621556
  let inferenceRouter = null;
621385
- const secretVault = new SecretVault(join132(repoRoot, ".oa", "vault.enc"));
621557
+ const secretVault = new SecretVault(join133(repoRoot, ".oa", "vault.enc"));
621386
621558
  let adminSessionKey = null;
621387
621559
  const callSubAgents = /* @__PURE__ */ new Map();
621388
621560
  const streamRenderer = new StreamRenderer();
@@ -621578,22 +621750,22 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
621578
621750
  const out = [];
621579
621751
  const pushJsonFiles = (dir, prefix) => {
621580
621752
  try {
621581
- if (!existsSync115(dir)) return;
621753
+ if (!existsSync116(dir)) return;
621582
621754
  for (const file of readdirSync40(dir)) {
621583
621755
  if (!file.endsWith(".json")) continue;
621584
621756
  const id = file.replace(/\.json$/, "");
621585
- out.push({ id: `${prefix}:${id}`, label: id, path: join132(dir, file) });
621757
+ out.push({ id: `${prefix}:${id}`, label: id, path: join133(dir, file) });
621586
621758
  }
621587
621759
  } catch {
621588
621760
  }
621589
621761
  };
621590
- pushJsonFiles(join132(repoRoot, ".oa", "checkpoints"), "turn");
621762
+ pushJsonFiles(join133(repoRoot, ".oa", "checkpoints"), "turn");
621591
621763
  try {
621592
- const sessionDir = join132(repoRoot, ".oa", "session");
621593
- if (existsSync115(sessionDir)) {
621764
+ const sessionDir = join133(repoRoot, ".oa", "session");
621765
+ if (existsSync116(sessionDir)) {
621594
621766
  for (const entry of readdirSync40(sessionDir)) {
621595
- const cp2 = join132(sessionDir, entry, "checkpoint.json");
621596
- if (existsSync115(cp2)) out.push({ id: `session:${entry}`, label: entry, path: cp2 });
621767
+ const cp2 = join133(sessionDir, entry, "checkpoint.json");
621768
+ if (existsSync116(cp2)) out.push({ id: `session:${entry}`, label: entry, path: cp2 });
621597
621769
  }
621598
621770
  }
621599
621771
  } catch {
@@ -621652,8 +621824,8 @@ This is an independent background session started from /background.`
621652
621824
  return id;
621653
621825
  };
621654
621826
  try {
621655
- const titleFile = join132(repoRoot, ".oa", "session-title");
621656
- if (existsSync115(titleFile)) sessionTitle = readFileSync96(titleFile, "utf8").trim() || null;
621827
+ const titleFile = join133(repoRoot, ".oa", "session-title");
621828
+ if (existsSync116(titleFile)) sessionTitle = readFileSync97(titleFile, "utf8").trim() || null;
621657
621829
  } catch {
621658
621830
  }
621659
621831
  let carouselRetired = isResumed;
@@ -621710,13 +621882,13 @@ This is an independent background session started from /background.`
621710
621882
  );
621711
621883
  return [hits, line];
621712
621884
  }
621713
- const HISTORY_DIR = join132(homedir46(), ".open-agents");
621714
- const HISTORY_FILE = join132(HISTORY_DIR, "repl-history");
621885
+ const HISTORY_DIR = join133(homedir46(), ".open-agents");
621886
+ const HISTORY_FILE = join133(HISTORY_DIR, "repl-history");
621715
621887
  const MAX_HISTORY_LINES = 500;
621716
621888
  let savedHistory = [];
621717
621889
  try {
621718
- if (existsSync115(HISTORY_FILE)) {
621719
- const raw = readFileSync96(HISTORY_FILE, "utf8").trim();
621890
+ if (existsSync116(HISTORY_FILE)) {
621891
+ const raw = readFileSync97(HISTORY_FILE, "utf8").trim();
621720
621892
  if (raw) savedHistory = raw.split("\n").reverse();
621721
621893
  }
621722
621894
  } catch {
@@ -621876,9 +622048,9 @@ This is an independent background session started from /background.`
621876
622048
  mkdirSync71(HISTORY_DIR, { recursive: true });
621877
622049
  appendFileSync8(HISTORY_FILE, line + "\n", "utf8");
621878
622050
  if (Math.random() < 0.02) {
621879
- const all2 = readFileSync96(HISTORY_FILE, "utf8").trim().split("\n");
622051
+ const all2 = readFileSync97(HISTORY_FILE, "utf8").trim().split("\n");
621880
622052
  if (all2.length > MAX_HISTORY_LINES) {
621881
- writeFileSync64(
622053
+ writeFileSync65(
621882
622054
  HISTORY_FILE,
621883
622055
  all2.slice(-MAX_HISTORY_LINES).join("\n") + "\n",
621884
622056
  "utf8"
@@ -622081,10 +622253,10 @@ This is an independent background session started from /background.`
622081
622253
  const { unlinkSync: _rmStale } = await import("node:fs");
622082
622254
  const { homedir: _hdir } = await import("node:os");
622083
622255
  for (const dp of [
622084
- join132(repoRoot, ".oa", "nexus", "nexus-daemon.mjs"),
622085
- join132(_hdir(), ".open-agents", ".oa", "nexus", "nexus-daemon.mjs")
622256
+ join133(repoRoot, ".oa", "nexus", "nexus-daemon.mjs"),
622257
+ join133(_hdir(), ".open-agents", ".oa", "nexus", "nexus-daemon.mjs")
622086
622258
  ]) {
622087
- if (existsSync115(dp))
622259
+ if (existsSync116(dp))
622088
622260
  try {
622089
622261
  _rmStale(dp);
622090
622262
  } catch {
@@ -622096,10 +622268,10 @@ This is an independent background session started from /background.`
622096
622268
  const autoNexus = new NexusTool(repoRoot);
622097
622269
  const _registerNexusDaemon = () => {
622098
622270
  try {
622099
- const nexusPidFile = join132(repoRoot, ".oa", "nexus", "daemon.pid");
622100
- if (existsSync115(nexusPidFile)) {
622271
+ const nexusPidFile = join133(repoRoot, ".oa", "nexus", "daemon.pid");
622272
+ if (existsSync116(nexusPidFile)) {
622101
622273
  const nPid = parseInt(
622102
- readFileSync96(nexusPidFile, "utf8").trim(),
622274
+ readFileSync97(nexusPidFile, "utf8").trim(),
622103
622275
  10
622104
622276
  );
622105
622277
  if (nPid > 0 && !registry2.daemons.has("Nexus")) {
@@ -622167,7 +622339,7 @@ This is an independent background session started from /background.`
622167
622339
  } catch {
622168
622340
  }
622169
622341
  try {
622170
- const oaDir = join132(repoRoot, ".oa");
622342
+ const oaDir = join133(repoRoot, ".oa");
622171
622343
  const reconnected = await ExposeGateway.checkAndReconnect(oaDir, {
622172
622344
  onInfo: (msg) => writeContent(() => renderInfo(msg)),
622173
622345
  onError: (msg) => writeContent(() => renderWarning(msg))
@@ -622205,7 +622377,7 @@ This is an independent background session started from /background.`
622205
622377
  } catch {
622206
622378
  }
622207
622379
  try {
622208
- const oaDir = join132(repoRoot, ".oa");
622380
+ const oaDir = join133(repoRoot, ".oa");
622209
622381
  const reconnectedP2P = await ExposeP2PGateway.checkAndReconnect(
622210
622382
  oaDir,
622211
622383
  new NexusTool(repoRoot),
@@ -622269,11 +622441,11 @@ This is an independent background session started from /background.`
622269
622441
  hostname: _hn,
622270
622442
  userInfo: _ui
622271
622443
  } = await import("node:os");
622272
- const globalNamePath = join132(_hd(), ".open-agents", "agent-name");
622444
+ const globalNamePath = join133(_hd(), ".open-agents", "agent-name");
622273
622445
  let agName = "";
622274
622446
  try {
622275
- if (existsSync115(globalNamePath))
622276
- agName = readFileSync96(globalNamePath, "utf8").trim();
622447
+ if (existsSync116(globalNamePath))
622448
+ agName = readFileSync97(globalNamePath, "utf8").trim();
622277
622449
  } catch {
622278
622450
  }
622279
622451
  if (!agName) {
@@ -622304,7 +622476,7 @@ This is an independent background session started from /background.`
622304
622476
  }
622305
622477
  if (!ollamaAlive) {
622306
622478
  try {
622307
- const savedSponsorsPath = join132(
622479
+ const savedSponsorsPath = join133(
622308
622480
  repoRoot,
622309
622481
  ".oa",
622310
622482
  "sponsor",
@@ -622312,9 +622484,9 @@ This is an independent background session started from /background.`
622312
622484
  );
622313
622485
  let savedSponsors = [];
622314
622486
  try {
622315
- if (existsSync115(savedSponsorsPath)) {
622487
+ if (existsSync116(savedSponsorsPath)) {
622316
622488
  savedSponsors = JSON.parse(
622317
- readFileSync96(savedSponsorsPath, "utf8")
622489
+ readFileSync97(savedSponsorsPath, "utf8")
622318
622490
  );
622319
622491
  const oneHourAgo = Date.now() - 36e5;
622320
622492
  savedSponsors = savedSponsors.filter(
@@ -622739,8 +622911,8 @@ This is an independent background session started from /background.`
622739
622911
  setSessionTitle(title) {
622740
622912
  sessionTitle = title.trim() || null;
622741
622913
  try {
622742
- mkdirSync71(join132(repoRoot, ".oa"), { recursive: true });
622743
- writeFileSync64(join132(repoRoot, ".oa", "session-title"), `${sessionTitle ?? ""}
622914
+ mkdirSync71(join133(repoRoot, ".oa"), { recursive: true });
622915
+ writeFileSync65(join133(repoRoot, ".oa", "session-title"), `${sessionTitle ?? ""}
622744
622916
  `, "utf8");
622745
622917
  } catch {
622746
622918
  }
@@ -622762,16 +622934,26 @@ This is an independent background session started from /background.`
622762
622934
  const pasted = pasteClipboardImageToFile2(repoRoot);
622763
622935
  if (!pasted) return { ok: false, message: "Clipboard does not contain a supported image or no clipboard reader is available." };
622764
622936
  const relPath = relative11(repoRoot, pasted.path).startsWith("..") ? pasted.path : relative11(repoRoot, pasted.path);
622937
+ let visionContext = "";
622938
+ try {
622939
+ const { runVisionIngress: runVisionIngress2, formatImageContextPrefix: formatImageContextPrefix2 } = await Promise.resolve().then(() => (init_vision_ingress(), vision_ingress_exports));
622940
+ const currentModel = config.model ?? "";
622941
+ const ingressResult = await runVisionIngress2(pasted, currentModel);
622942
+ visionContext = formatImageContextPrefix2(ingressResult);
622943
+ } catch {
622944
+ }
622765
622945
  if (activeTask) {
622766
622946
  activeTask.runner.injectImage(
622767
622947
  pasted.buffer.toString("base64"),
622768
622948
  pasted.mime,
622769
- `User pasted clipboard image: ${relPath}`
622949
+ visionContext || `User pasted clipboard image: ${relPath}`
622770
622950
  );
622771
622951
  return { ok: true, message: `Attached clipboard image to active task: ${relPath}`, path: pasted.path };
622772
622952
  }
622773
622953
  queuePrompt(
622774
- `The user pasted a clipboard image saved at ${relPath}. Read it with image_read or vision and respond to what is shown.`,
622954
+ visionContext ? `${visionContext}
622955
+
622956
+ The user pasted a clipboard image saved at ${relPath}. Use the OCR and vision analysis above to understand and respond to the image content.` : `The user pasted a clipboard image saved at ${relPath}. Read it with image_read or vision and respond to what is shown.`,
622775
622957
  "clipboard"
622776
622958
  );
622777
622959
  return { ok: true, message: `Clipboard image queued for next prompt: ${relPath}`, path: pasted.path };
@@ -623809,10 +623991,10 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
623809
623991
  if (name10 === "voice_list_files") {
623810
623992
  const baseDir = String(args?.dir ?? ".");
623811
623993
  const { readdirSync: readdirSync42, statSync: statSync38 } = __require("node:fs");
623812
- const { join: join137, resolve: resolve44 } = __require("node:path");
623813
- const base3 = baseDir.startsWith("/") ? baseDir : resolve44(join137(repoRoot, baseDir));
623994
+ const { join: join138, resolve: resolve44 } = __require("node:path");
623995
+ const base3 = baseDir.startsWith("/") ? baseDir : resolve44(join138(repoRoot, baseDir));
623814
623996
  const items = readdirSync42(base3).slice(0, 200).map((f2) => {
623815
- const s2 = statSync38(join137(base3, f2));
623997
+ const s2 = statSync38(join138(base3, f2));
623816
623998
  return { name: f2, dir: s2.isDirectory(), size: s2.size };
623817
623999
  });
623818
624000
  return JSON.stringify({ dir: base3, items }, null, 2);
@@ -623911,7 +624093,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
623911
624093
  kind,
623912
624094
  targetUrl,
623913
624095
  authKey,
623914
- stateDir: join132(repoRoot, ".oa"),
624096
+ stateDir: join133(repoRoot, ".oa"),
623915
624097
  passthrough: passthrough ?? false,
623916
624098
  loadbalance: loadbalance ?? false,
623917
624099
  endpointAuth: passthrough ? currentConfig.apiKey : void 0,
@@ -623966,7 +624148,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
623966
624148
  targetUrl,
623967
624149
  authKey,
623968
624150
  fullAccess,
623969
- stateDir: join132(repoRoot, ".oa")
624151
+ stateDir: join133(repoRoot, ".oa")
623970
624152
  });
623971
624153
  newTunnel.on("stats", (stats) => {
623972
624154
  statusBar.setExposeStatus({
@@ -624056,9 +624238,9 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
624056
624238
  });
624057
624239
  if (!result.success) throw new Error(result.error || "Connect failed");
624058
624240
  try {
624059
- const nexusPidFile = join132(repoRoot, ".oa", "nexus", "daemon.pid");
624060
- if (existsSync115(nexusPidFile)) {
624061
- const pid = parseInt(readFileSync96(nexusPidFile, "utf8").trim(), 10);
624241
+ const nexusPidFile = join133(repoRoot, ".oa", "nexus", "daemon.pid");
624242
+ if (existsSync116(nexusPidFile)) {
624243
+ const pid = parseInt(readFileSync97(nexusPidFile, "utf8").trim(), 10);
624062
624244
  if (pid > 0) {
624063
624245
  registry2.register({
624064
624246
  name: "Nexus",
@@ -624266,10 +624448,10 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
624266
624448
  );
624267
624449
  }
624268
624450
  try {
624269
- const nexusDir = join132(repoRoot, OA_DIR, "nexus");
624270
- const pidFile = join132(nexusDir, "daemon.pid");
624271
- if (existsSync115(pidFile)) {
624272
- const pid = parseInt(readFileSync96(pidFile, "utf8").trim(), 10);
624451
+ const nexusDir = join133(repoRoot, OA_DIR, "nexus");
624452
+ const pidFile = join133(nexusDir, "daemon.pid");
624453
+ if (existsSync116(pidFile)) {
624454
+ const pid = parseInt(readFileSync97(pidFile, "utf8").trim(), 10);
624273
624455
  if (pid > 0) {
624274
624456
  try {
624275
624457
  if (process.platform === "win32") {
@@ -624296,13 +624478,13 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
624296
624478
  } catch {
624297
624479
  }
624298
624480
  try {
624299
- const voiceDir2 = join132(homedir46(), ".open-agents", "voice");
624481
+ const voiceDir2 = join133(homedir46(), ".open-agents", "voice");
624300
624482
  const voicePidFiles = ["luxtts-daemon.pid", "piper-daemon.pid"];
624301
624483
  for (const pf of voicePidFiles) {
624302
- const pidPath = join132(voiceDir2, pf);
624303
- if (existsSync115(pidPath)) {
624484
+ const pidPath = join133(voiceDir2, pf);
624485
+ if (existsSync116(pidPath)) {
624304
624486
  try {
624305
- const pid = parseInt(readFileSync96(pidPath, "utf8").trim(), 10);
624487
+ const pid = parseInt(readFileSync97(pidPath, "utf8").trim(), 10);
624306
624488
  if (pid > 0) {
624307
624489
  if (process.platform === "win32") {
624308
624490
  try {
@@ -624332,8 +624514,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
624332
624514
  );
624333
624515
  } catch {
624334
624516
  }
624335
- const oaPath = join132(repoRoot, OA_DIR);
624336
- if (existsSync115(oaPath)) {
624517
+ const oaPath = join133(repoRoot, OA_DIR);
624518
+ if (existsSync116(oaPath)) {
624337
624519
  let deleted = false;
624338
624520
  for (let attempt = 0; attempt < 3; attempt++) {
624339
624521
  try {
@@ -624431,23 +624613,23 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
624431
624613
  try {
624432
624614
  const { isPersonaPlexRunning: isPersonaPlexRunning2 } = await Promise.resolve().then(() => (init_personaplex(), personaplex_exports));
624433
624615
  if (isPersonaPlexRunning2()) {
624434
- const ppPidFile = join132(
624616
+ const ppPidFile = join133(
624435
624617
  homedir46(),
624436
624618
  ".open-agents",
624437
624619
  "voice",
624438
624620
  "personaplex",
624439
624621
  "daemon.pid"
624440
624622
  );
624441
- const ppPortFile = join132(
624623
+ const ppPortFile = join133(
624442
624624
  homedir46(),
624443
624625
  ".open-agents",
624444
624626
  "voice",
624445
624627
  "personaplex",
624446
624628
  "daemon.port"
624447
624629
  );
624448
- if (existsSync115(ppPidFile)) {
624449
- const ppPid = parseInt(readFileSync96(ppPidFile, "utf8").trim(), 10);
624450
- const ppPort = existsSync115(ppPortFile) ? parseInt(readFileSync96(ppPortFile, "utf8").trim(), 10) : void 0;
624630
+ if (existsSync116(ppPidFile)) {
624631
+ const ppPid = parseInt(readFileSync97(ppPidFile, "utf8").trim(), 10);
624632
+ const ppPort = existsSync116(ppPortFile) ? parseInt(readFileSync97(ppPortFile, "utf8").trim(), 10) : void 0;
624451
624633
  if (ppPid > 0 && !registry2.daemons.has("PersonaPlex")) {
624452
624634
  registry2.register({
624453
624635
  name: "PersonaPlex",
@@ -624459,9 +624641,9 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
624459
624641
  }
624460
624642
  }
624461
624643
  }
624462
- const nexusPidFile = join132(repoRoot, ".oa", "nexus", "daemon.pid");
624463
- if (existsSync115(nexusPidFile)) {
624464
- const nPid = parseInt(readFileSync96(nexusPidFile, "utf8").trim(), 10);
624644
+ const nexusPidFile = join133(repoRoot, ".oa", "nexus", "daemon.pid");
624645
+ if (existsSync116(nexusPidFile)) {
624646
+ const nPid = parseInt(readFileSync97(nexusPidFile, "utf8").trim(), 10);
624465
624647
  if (nPid > 0 && !registry2.daemons.has("Nexus")) {
624466
624648
  try {
624467
624649
  process.kill(nPid, 0);
@@ -624900,9 +625082,9 @@ Execute this skill now. Follow the behavioral guidance above.`;
624900
625082
  }
624901
625083
  }
624902
625084
  const cleanPath = input.replace(/^['"]|['"]$/g, "").trim();
624903
- const isImage = isImagePath(cleanPath) && existsSync115(resolve40(repoRoot, cleanPath));
624904
- const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync115(resolve40(repoRoot, cleanPath));
624905
- const isMarkdown = !isImage && !isMedia && /\.(md|markdown)$/i.test(cleanPath) && existsSync115(resolve40(repoRoot, cleanPath));
625085
+ const isImage = isImagePath(cleanPath) && existsSync116(resolve40(repoRoot, cleanPath));
625086
+ const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync116(resolve40(repoRoot, cleanPath));
625087
+ const isMarkdown = !isImage && !isMedia && /\.(md|markdown)$/i.test(cleanPath) && existsSync116(resolve40(repoRoot, cleanPath));
624906
625088
  if (activeTask) {
624907
625089
  if (activeTask.runner.isPaused) {
624908
625090
  activeTask.runner.resume();
@@ -624911,7 +625093,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
624911
625093
  if (isImage) {
624912
625094
  try {
624913
625095
  const imgPath = resolve40(repoRoot, cleanPath);
624914
- const imgBuffer = readFileSync96(imgPath);
625096
+ const imgBuffer = readFileSync97(imgPath);
624915
625097
  const base642 = imgBuffer.toString("base64");
624916
625098
  const ext = extname13(cleanPath).toLowerCase();
624917
625099
  const mime = ext === ".png" ? "image/png" : ext === ".gif" ? "image/gif" : ext === ".webp" ? "image/webp" : "image/jpeg";
@@ -625087,7 +625269,7 @@ ${result.text}`;
625087
625269
  if (isMarkdown && fullInput === input) {
625088
625270
  try {
625089
625271
  const mdPath = resolve40(repoRoot, cleanPath);
625090
- const mdContent = readFileSync96(mdPath, "utf8");
625272
+ const mdContent = readFileSync97(mdPath, "utf8");
625091
625273
  const { parseMcpMarkdown: parseMcpMarkdown2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports));
625092
625274
  const result = parseMcpMarkdown2(mdContent);
625093
625275
  if (result.servers.length > 0) {
@@ -625447,6 +625629,18 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
625447
625629
  }
625448
625630
  showPrompt();
625449
625631
  }
625632
+ rl.on("ctrl-v", async () => {
625633
+ try {
625634
+ const result = await commandCtx.attachClipboardImage?.();
625635
+ if (result?.ok) {
625636
+ process.stderr.write(c3.green("📎 " + result.message + "\n"));
625637
+ } else {
625638
+ process.stderr.write(c3.yellow("⚠ " + (result?.message ?? "paste failed") + "\n"));
625639
+ }
625640
+ } catch (err) {
625641
+ process.stderr.write(c3.red("Clipboard paste failed\n"));
625642
+ }
625643
+ });
625450
625644
  rl.on("close", () => {
625451
625645
  if (peerMesh) {
625452
625646
  peerMesh.stop().catch(() => {
@@ -625625,11 +625819,11 @@ async function runWithTUI(task, config, repoPath, callbacks) {
625625
625819
  const handle2 = startTask(task, config, repoRoot);
625626
625820
  await handle2.promise;
625627
625821
  try {
625628
- const ikDir = join132(repoRoot, ".oa", "identity");
625629
- const ikFile = join132(ikDir, "self-state.json");
625822
+ const ikDir = join133(repoRoot, ".oa", "identity");
625823
+ const ikFile = join133(ikDir, "self-state.json");
625630
625824
  let ikState;
625631
- if (existsSync115(ikFile)) {
625632
- ikState = JSON.parse(readFileSync96(ikFile, "utf8"));
625825
+ if (existsSync116(ikFile)) {
625826
+ ikState = JSON.parse(readFileSync97(ikFile, "utf8"));
625633
625827
  } else {
625634
625828
  mkdirSync71(ikDir, { recursive: true });
625635
625829
  ikState = {
@@ -625684,7 +625878,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
625684
625878
  );
625685
625879
  ikState.session_count = (ikState.session_count || 0) + 1;
625686
625880
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
625687
- writeFileSync64(ikFile, JSON.stringify(ikState, null, 2));
625881
+ writeFileSync65(ikFile, JSON.stringify(ikState, null, 2));
625688
625882
  } catch (ikErr) {
625689
625883
  }
625690
625884
  try {
@@ -625697,12 +625891,12 @@ async function runWithTUI(task, config, repoPath, callbacks) {
625697
625891
  );
625698
625892
  } catch {
625699
625893
  try {
625700
- const archeDir = join132(repoRoot, ".oa", "arche");
625701
- const archeFile = join132(archeDir, "variants.json");
625894
+ const archeDir = join133(repoRoot, ".oa", "arche");
625895
+ const archeFile = join133(archeDir, "variants.json");
625702
625896
  let variants = [];
625703
625897
  try {
625704
- if (existsSync115(archeFile))
625705
- variants = JSON.parse(readFileSync96(archeFile, "utf8"));
625898
+ if (existsSync116(archeFile))
625899
+ variants = JSON.parse(readFileSync97(archeFile, "utf8"));
625706
625900
  } catch {
625707
625901
  }
625708
625902
  variants.push({
@@ -625717,20 +625911,20 @@ async function runWithTUI(task, config, repoPath, callbacks) {
625717
625911
  });
625718
625912
  if (variants.length > 50) variants = variants.slice(-50);
625719
625913
  mkdirSync71(archeDir, { recursive: true });
625720
- writeFileSync64(archeFile, JSON.stringify(variants, null, 2));
625914
+ writeFileSync65(archeFile, JSON.stringify(variants, null, 2));
625721
625915
  } catch {
625722
625916
  }
625723
625917
  }
625724
625918
  try {
625725
- const metaFile = join132(
625919
+ const metaFile = join133(
625726
625920
  repoRoot,
625727
625921
  ".oa",
625728
625922
  "memory",
625729
625923
  "metabolism",
625730
625924
  "store.json"
625731
625925
  );
625732
- if (existsSync115(metaFile)) {
625733
- const store2 = JSON.parse(readFileSync96(metaFile, "utf8"));
625926
+ if (existsSync116(metaFile)) {
625927
+ const store2 = JSON.parse(readFileSync97(metaFile, "utf8"));
625734
625928
  const surfaced = store2.filter(
625735
625929
  (m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
625736
625930
  ).sort(
@@ -625748,7 +625942,7 @@ async function runWithTUI(task, config, repoPath, callbacks) {
625748
625942
  updated = true;
625749
625943
  }
625750
625944
  if (updated) {
625751
- writeFileSync64(metaFile, JSON.stringify(store2, null, 2));
625945
+ writeFileSync65(metaFile, JSON.stringify(store2, null, 2));
625752
625946
  }
625753
625947
  }
625754
625948
  } catch {
@@ -625806,9 +626000,9 @@ Rules:
625806
626000
  try {
625807
626001
  const { initDb: initDb2 } = __require("@open-agents/memory");
625808
626002
  const { ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
625809
- const dbDir = join132(repoRoot, ".oa", "memory");
626003
+ const dbDir = join133(repoRoot, ".oa", "memory");
625810
626004
  mkdirSync71(dbDir, { recursive: true });
625811
- const db = initDb2(join132(dbDir, "structured.db"));
626005
+ const db = initDb2(join133(dbDir, "structured.db"));
625812
626006
  const memStore = new ProceduralMemoryStore2(db);
625813
626007
  memStore.createWithEmbedding(
625814
626008
  {
@@ -625828,12 +626022,12 @@ Rules:
625828
626022
  db.close();
625829
626023
  } catch {
625830
626024
  }
625831
- const metaDir = join132(repoRoot, ".oa", "memory", "metabolism");
625832
- const storeFile = join132(metaDir, "store.json");
626025
+ const metaDir = join133(repoRoot, ".oa", "memory", "metabolism");
626026
+ const storeFile = join133(metaDir, "store.json");
625833
626027
  let store2 = [];
625834
626028
  try {
625835
- if (existsSync115(storeFile))
625836
- store2 = JSON.parse(readFileSync96(storeFile, "utf8"));
626029
+ if (existsSync116(storeFile))
626030
+ store2 = JSON.parse(readFileSync97(storeFile, "utf8"));
625837
626031
  } catch {
625838
626032
  }
625839
626033
  store2.push({
@@ -625857,31 +626051,31 @@ Rules:
625857
626051
  });
625858
626052
  if (store2.length > 100) store2 = store2.slice(-100);
625859
626053
  mkdirSync71(metaDir, { recursive: true });
625860
- writeFileSync64(storeFile, JSON.stringify(store2, null, 2));
626054
+ writeFileSync65(storeFile, JSON.stringify(store2, null, 2));
625861
626055
  }
625862
626056
  }
625863
626057
  } catch {
625864
626058
  }
625865
626059
  try {
625866
- const cohereSettingsFile = join132(repoRoot, ".oa", "settings.json");
626060
+ const cohereSettingsFile = join133(repoRoot, ".oa", "settings.json");
625867
626061
  let cohereActive = false;
625868
626062
  try {
625869
- if (existsSync115(cohereSettingsFile)) {
625870
- const settings = JSON.parse(readFileSync96(cohereSettingsFile, "utf8"));
626063
+ if (existsSync116(cohereSettingsFile)) {
626064
+ const settings = JSON.parse(readFileSync97(cohereSettingsFile, "utf8"));
625871
626065
  cohereActive = settings.cohere === true;
625872
626066
  }
625873
626067
  } catch {
625874
626068
  }
625875
626069
  if (cohereActive) {
625876
- const metaFile = join132(
626070
+ const metaFile = join133(
625877
626071
  repoRoot,
625878
626072
  ".oa",
625879
626073
  "memory",
625880
626074
  "metabolism",
625881
626075
  "store.json"
625882
626076
  );
625883
- if (existsSync115(metaFile)) {
625884
- const store2 = JSON.parse(readFileSync96(metaFile, "utf8"));
626077
+ if (existsSync116(metaFile)) {
626078
+ const store2 = JSON.parse(readFileSync97(metaFile, "utf8"));
625885
626079
  const latest = store2.filter(
625886
626080
  (m2) => m2.sourceTrace === "trajectory-extraction" || m2.sourceTrace === "llm-trajectory-extraction"
625887
626081
  ).slice(-1)[0];
@@ -625908,9 +626102,9 @@ Rules:
625908
626102
  }
625909
626103
  } catch (err) {
625910
626104
  try {
625911
- const ikFile = join132(repoRoot, ".oa", "identity", "self-state.json");
625912
- if (existsSync115(ikFile)) {
625913
- const ikState = JSON.parse(readFileSync96(ikFile, "utf8"));
626105
+ const ikFile = join133(repoRoot, ".oa", "identity", "self-state.json");
626106
+ if (existsSync116(ikFile)) {
626107
+ const ikState = JSON.parse(readFileSync97(ikFile, "utf8"));
625914
626108
  ikState.homeostasis.uncertainty = Math.min(
625915
626109
  1,
625916
626110
  ikState.homeostasis.uncertainty + 0.1
@@ -625921,17 +626115,17 @@ Rules:
625921
626115
  );
625922
626116
  ikState.session_count = (ikState.session_count || 0) + 1;
625923
626117
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
625924
- writeFileSync64(ikFile, JSON.stringify(ikState, null, 2));
626118
+ writeFileSync65(ikFile, JSON.stringify(ikState, null, 2));
625925
626119
  }
625926
- const metaFile = join132(
626120
+ const metaFile = join133(
625927
626121
  repoRoot,
625928
626122
  ".oa",
625929
626123
  "memory",
625930
626124
  "metabolism",
625931
626125
  "store.json"
625932
626126
  );
625933
- if (existsSync115(metaFile)) {
625934
- const store2 = JSON.parse(readFileSync96(metaFile, "utf8"));
626127
+ if (existsSync116(metaFile)) {
626128
+ const store2 = JSON.parse(readFileSync97(metaFile, "utf8"));
625935
626129
  const surfaced = store2.filter(
625936
626130
  (m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15
625937
626131
  ).sort(
@@ -625949,15 +626143,15 @@ Rules:
625949
626143
  (item.scores.confidence || 0.5) - 0.02
625950
626144
  );
625951
626145
  }
625952
- writeFileSync64(metaFile, JSON.stringify(store2, null, 2));
626146
+ writeFileSync65(metaFile, JSON.stringify(store2, null, 2));
625953
626147
  }
625954
626148
  try {
625955
- const archeDir = join132(repoRoot, ".oa", "arche");
625956
- const archeFile = join132(archeDir, "variants.json");
626149
+ const archeDir = join133(repoRoot, ".oa", "arche");
626150
+ const archeFile = join133(archeDir, "variants.json");
625957
626151
  let variants = [];
625958
626152
  try {
625959
- if (existsSync115(archeFile))
625960
- variants = JSON.parse(readFileSync96(archeFile, "utf8"));
626153
+ if (existsSync116(archeFile))
626154
+ variants = JSON.parse(readFileSync97(archeFile, "utf8"));
625961
626155
  } catch {
625962
626156
  }
625963
626157
  variants.push({
@@ -625972,7 +626166,7 @@ Rules:
625972
626166
  });
625973
626167
  if (variants.length > 50) variants = variants.slice(-50);
625974
626168
  mkdirSync71(archeDir, { recursive: true });
625975
- writeFileSync64(archeFile, JSON.stringify(variants, null, 2));
626169
+ writeFileSync65(archeFile, JSON.stringify(variants, null, 2));
625976
626170
  } catch {
625977
626171
  }
625978
626172
  } catch {
@@ -626063,12 +626257,12 @@ __export(run_exports, {
626063
626257
  });
626064
626258
  import { resolve as resolve41 } from "node:path";
626065
626259
  import { spawn as spawn28 } from "node:child_process";
626066
- import { mkdirSync as mkdirSync72, writeFileSync as writeFileSync65, readFileSync as readFileSync97, readdirSync as readdirSync41, existsSync as existsSync116 } from "node:fs";
626260
+ import { mkdirSync as mkdirSync72, writeFileSync as writeFileSync66, readFileSync as readFileSync98, readdirSync as readdirSync41, existsSync as existsSync117 } from "node:fs";
626067
626261
  import { randomBytes as randomBytes24 } from "node:crypto";
626068
- import { join as join133 } from "node:path";
626262
+ import { join as join134 } from "node:path";
626069
626263
  function jobsDir2(repoPath) {
626070
626264
  const root = resolve41(repoPath ?? process.cwd());
626071
- const dir = join133(root, ".oa", "jobs");
626265
+ const dir = join134(root, ".oa", "jobs");
626072
626266
  mkdirSync72(dir, { recursive: true });
626073
626267
  return dir;
626074
626268
  }
@@ -626191,7 +626385,7 @@ async function runBackground(task, config, opts) {
626191
626385
  }
626192
626386
  });
626193
626387
  job.pid = child.pid ?? 0;
626194
- writeFileSync65(join133(dir, `${id}.json`), JSON.stringify(job, null, 2));
626388
+ writeFileSync66(join134(dir, `${id}.json`), JSON.stringify(job, null, 2));
626195
626389
  let output = "";
626196
626390
  child.stdout?.on("data", (chunk) => {
626197
626391
  output += chunk.toString();
@@ -626207,7 +626401,7 @@ async function runBackground(task, config, opts) {
626207
626401
  job.summary = result.summary;
626208
626402
  job.durationMs = result.durationMs;
626209
626403
  job.error = result.error;
626210
- writeFileSync65(join133(dir, `${id}.json`), JSON.stringify(job, null, 2));
626404
+ writeFileSync66(join134(dir, `${id}.json`), JSON.stringify(job, null, 2));
626211
626405
  } catch {
626212
626406
  }
626213
626407
  });
@@ -626223,13 +626417,13 @@ async function runBackground(task, config, opts) {
626223
626417
  }
626224
626418
  function statusCommand(jobId, repoPath) {
626225
626419
  const dir = jobsDir2(repoPath);
626226
- const file = join133(dir, `${jobId}.json`);
626227
- if (!existsSync116(file)) {
626420
+ const file = join134(dir, `${jobId}.json`);
626421
+ if (!existsSync117(file)) {
626228
626422
  console.error(`Job not found: ${jobId}`);
626229
626423
  console.log(`Available jobs: oa jobs`);
626230
626424
  process.exit(1);
626231
626425
  }
626232
- const job = JSON.parse(readFileSync97(file, "utf-8"));
626426
+ const job = JSON.parse(readFileSync98(file, "utf-8"));
626233
626427
  const runtime = job.completedAt ? `${((new Date(job.completedAt).getTime() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s` : `${((Date.now() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s`;
626234
626428
  const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
626235
626429
  console.log(`${icon} ${job.id} [${job.status}] ${runtime}`);
@@ -626250,7 +626444,7 @@ function jobsCommand(repoPath) {
626250
626444
  console.log("Jobs:");
626251
626445
  for (const file of files) {
626252
626446
  try {
626253
- const job = JSON.parse(readFileSync97(join133(dir, file), "utf-8"));
626447
+ const job = JSON.parse(readFileSync98(join134(dir, file), "utf-8"));
626254
626448
  const icon = job.status === "completed" ? "✓" : job.status === "failed" ? "✗" : "●";
626255
626449
  const runtime = job.completedAt ? `${((new Date(job.completedAt).getTime() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s` : `${((Date.now() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s`;
626256
626450
  const cleanListTask = cleanForStorage(job.task) || job.task;
@@ -626274,13 +626468,13 @@ __export(index_repo_exports, {
626274
626468
  indexRepoCommand: () => indexRepoCommand
626275
626469
  });
626276
626470
  import { resolve as resolve42 } from "node:path";
626277
- import { existsSync as existsSync117, statSync as statSync37 } from "node:fs";
626471
+ import { existsSync as existsSync118, statSync as statSync37 } from "node:fs";
626278
626472
  import { cwd as cwd2 } from "node:process";
626279
626473
  async function indexRepoCommand(opts, _config3) {
626280
626474
  const repoRoot = resolve42(opts.repoPath ?? cwd2());
626281
626475
  printHeader("Index Repository");
626282
626476
  printInfo(`Indexing: ${repoRoot}`);
626283
- if (!existsSync117(repoRoot)) {
626477
+ if (!existsSync118(repoRoot)) {
626284
626478
  printError(`Path does not exist: ${repoRoot}`);
626285
626479
  process.exit(1);
626286
626480
  }
@@ -626532,7 +626726,7 @@ var config_exports2 = {};
626532
626726
  __export(config_exports2, {
626533
626727
  configCommand: () => configCommand
626534
626728
  });
626535
- import { join as join134, resolve as resolve43 } from "node:path";
626729
+ import { join as join135, resolve as resolve43 } from "node:path";
626536
626730
  import { homedir as homedir47 } from "node:os";
626537
626731
  import { cwd as cwd3 } from "node:process";
626538
626732
  function redactIfSensitive(key, value2) {
@@ -626614,7 +626808,7 @@ function handleShow(opts, config) {
626614
626808
  }
626615
626809
  }
626616
626810
  printSection("Config File");
626617
- printInfo(`~/.open-agents/config.json (${join134(homedir47(), ".open-agents", "config.json")})`);
626811
+ printInfo(`~/.open-agents/config.json (${join135(homedir47(), ".open-agents", "config.json")})`);
626618
626812
  printSection("Priority Chain");
626619
626813
  printInfo(" 1. CLI flags (--model, --backend-url, etc.)");
626620
626814
  printInfo(" 2. Project .oa/settings.json (--local)");
@@ -626653,7 +626847,7 @@ function handleSet(opts, _config3) {
626653
626847
  const coerced = coerceForSettings(key, value2);
626654
626848
  saveProjectSettings(repoRoot, { [key]: coerced });
626655
626849
  printSuccess(`Project override set: ${key} = ${redactIfSensitive(key, value2)}`);
626656
- printInfo(`Saved to ${join134(repoRoot, ".oa", "settings.json")}`);
626850
+ printInfo(`Saved to ${join135(repoRoot, ".oa", "settings.json")}`);
626657
626851
  printInfo("This override applies only when running in this workspace.");
626658
626852
  } catch (err) {
626659
626853
  printError(`Failed to save: ${err instanceof Error ? err.message : String(err)}`);
@@ -626837,8 +627031,8 @@ __export(eval_exports, {
626837
627031
  evalCommand: () => evalCommand
626838
627032
  });
626839
627033
  import { tmpdir as tmpdir22 } from "node:os";
626840
- import { mkdirSync as mkdirSync73, writeFileSync as writeFileSync66 } from "node:fs";
626841
- import { join as join135 } from "node:path";
627034
+ import { mkdirSync as mkdirSync73, writeFileSync as writeFileSync67 } from "node:fs";
627035
+ import { join as join136 } from "node:path";
626842
627036
  async function evalCommand(opts, config) {
626843
627037
  const suiteName = opts.suite ?? "basic";
626844
627038
  const suite = SUITES[suiteName];
@@ -626967,10 +627161,10 @@ async function evalCommand(opts, config) {
626967
627161
  process.exit(failed > 0 ? 1 : 0);
626968
627162
  }
626969
627163
  function createTempEvalRepo() {
626970
- const dir = join135(tmpdir22(), `open-agents-eval-${Date.now()}`);
627164
+ const dir = join136(tmpdir22(), `open-agents-eval-${Date.now()}`);
626971
627165
  mkdirSync73(dir, { recursive: true });
626972
- writeFileSync66(
626973
- join135(dir, "package.json"),
627166
+ writeFileSync67(
627167
+ join136(dir, "package.json"),
626974
627168
  JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n",
626975
627169
  "utf8"
626976
627170
  );
@@ -627034,7 +627228,7 @@ init_typed_node_events();
627034
627228
  import { parseArgs as nodeParseArgs2 } from "node:util";
627035
627229
  import { createRequire as createRequire7 } from "node:module";
627036
627230
  import { fileURLToPath as fileURLToPath19 } from "node:url";
627037
- import { dirname as dirname38, join as join136 } from "node:path";
627231
+ import { dirname as dirname38, join as join137 } from "node:path";
627038
627232
 
627039
627233
  // packages/cli/src/cli.ts
627040
627234
  init_typed_node_events();
@@ -627174,7 +627368,7 @@ init_output();
627174
627368
  function getVersion5() {
627175
627369
  try {
627176
627370
  const require4 = createRequire7(import.meta.url);
627177
- const pkgPath = join136(dirname38(fileURLToPath19(import.meta.url)), "..", "package.json");
627371
+ const pkgPath = join137(dirname38(fileURLToPath19(import.meta.url)), "..", "package.json");
627178
627372
  const pkg = require4(pkgPath);
627179
627373
  return pkg.version;
627180
627374
  } catch {
@@ -627489,11 +627683,11 @@ function crashLog(label, err) {
627489
627683
  `;
627490
627684
  try {
627491
627685
  const { appendFileSync: appendFileSync9, mkdirSync: mkdirSync74 } = __require("node:fs");
627492
- const { join: join137 } = __require("node:path");
627686
+ const { join: join138 } = __require("node:path");
627493
627687
  const { homedir: homedir48 } = __require("node:os");
627494
- const logDir = join137(homedir48(), ".open-agents");
627688
+ const logDir = join138(homedir48(), ".open-agents");
627495
627689
  mkdirSync74(logDir, { recursive: true });
627496
- appendFileSync9(join137(logDir, "crash.log"), logLine);
627690
+ appendFileSync9(join138(logDir, "crash.log"), logLine);
627497
627691
  } catch {
627498
627692
  }
627499
627693
  try {