open-agents-ai 0.187.159 → 0.187.161

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1168 -795
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -245714,9 +245714,9 @@ print("${sentinel}")
245714
245714
  if (!this.proc || this.proc.killed) {
245715
245715
  return { success: false, path: "" };
245716
245716
  }
245717
- const { mkdirSync: mkdirSync45, writeFileSync: writeFileSync41 } = await import("node:fs");
245717
+ const { mkdirSync: mkdirSync46, writeFileSync: writeFileSync41 } = await import("node:fs");
245718
245718
  const sessionDir = join24(this.cwd, ".oa", "rlm");
245719
- mkdirSync45(sessionDir, { recursive: true });
245719
+ mkdirSync46(sessionDir, { recursive: true });
245720
245720
  const sessionPath = join24(sessionDir, "session.json");
245721
245721
  try {
245722
245722
  const inspectCode = `
@@ -245752,9 +245752,9 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
245752
245752
  * what was previously computed. */
245753
245753
  async loadSessionInfo() {
245754
245754
  try {
245755
- const { readFileSync: readFileSync60, existsSync: existsSync77 } = await import("node:fs");
245755
+ const { readFileSync: readFileSync60, existsSync: existsSync78 } = await import("node:fs");
245756
245756
  const sessionPath = join24(this.cwd, ".oa", "rlm", "session.json");
245757
- if (!existsSync77(sessionPath))
245757
+ if (!existsSync78(sessionPath))
245758
245758
  return null;
245759
245759
  return JSON.parse(readFileSync60(sessionPath, "utf8"));
245760
245760
  } catch {
@@ -246320,10 +246320,10 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
246320
246320
  * Optionally filter by task type for phase-aware context (FSM paper insight).
246321
246321
  */
246322
246322
  getTopMemoriesSync(k = 5, taskType) {
246323
- const { readFileSync: readFileSync60, existsSync: existsSync77 } = __require("node:fs");
246323
+ const { readFileSync: readFileSync60, existsSync: existsSync78 } = __require("node:fs");
246324
246324
  const metaDir = join25(this.cwd, ".oa", "memory", "metabolism");
246325
246325
  const storeFile = join25(metaDir, "store.json");
246326
- if (!existsSync77(storeFile))
246326
+ if (!existsSync78(storeFile))
246327
246327
  return "";
246328
246328
  let store2 = [];
246329
246329
  try {
@@ -246349,10 +246349,10 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
246349
246349
  /** Update memory scores based on task outcome. Called after task completion.
246350
246350
  * Memories used in successful tasks get boosted. Memories present during failures get decayed. */
246351
246351
  updateFromOutcomeSync(surfacedMemoryText, succeeded) {
246352
- const { readFileSync: readFileSync60, writeFileSync: writeFileSync41, existsSync: existsSync77, mkdirSync: mkdirSync45 } = __require("node:fs");
246352
+ const { readFileSync: readFileSync60, writeFileSync: writeFileSync41, existsSync: existsSync78, mkdirSync: mkdirSync46 } = __require("node:fs");
246353
246353
  const metaDir = join25(this.cwd, ".oa", "memory", "metabolism");
246354
246354
  const storeFile = join25(metaDir, "store.json");
246355
- if (!existsSync77(storeFile))
246355
+ if (!existsSync78(storeFile))
246356
246356
  return;
246357
246357
  let store2 = [];
246358
246358
  try {
@@ -246380,7 +246380,7 @@ ${issues.map((i2) => ` - ${i2}`).join("\n")}` : " No issues found."),
246380
246380
  updated = true;
246381
246381
  }
246382
246382
  if (updated) {
246383
- mkdirSync45(metaDir, { recursive: true });
246383
+ mkdirSync46(metaDir, { recursive: true });
246384
246384
  writeFileSync41(storeFile, JSON.stringify(store2, null, 2));
246385
246385
  }
246386
246386
  }
@@ -246803,9 +246803,9 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
246803
246803
  // Per EvoSkill (arXiv:2603.02766): retrieve relevant strategies from archive.
246804
246804
  /** Retrieve top-K strategies for context injection. Returns "" if none. */
246805
246805
  getRelevantStrategiesSync(k = 3, taskType) {
246806
- const { readFileSync: readFileSync60, existsSync: existsSync77 } = __require("node:fs");
246806
+ const { readFileSync: readFileSync60, existsSync: existsSync78 } = __require("node:fs");
246807
246807
  const archiveFile = join27(this.cwd, ".oa", "arche", "variants.json");
246808
- if (!existsSync77(archiveFile))
246808
+ if (!existsSync78(archiveFile))
246809
246809
  return "";
246810
246810
  let variants = [];
246811
246811
  try {
@@ -246827,12 +246827,12 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
246827
246827
  }
246828
246828
  /** Archive a strategy variant synchronously (for task completion path) */
246829
246829
  archiveVariantSync(strategy, outcome, tags = []) {
246830
- const { readFileSync: readFileSync60, writeFileSync: writeFileSync41, existsSync: existsSync77, mkdirSync: mkdirSync45 } = __require("node:fs");
246830
+ const { readFileSync: readFileSync60, writeFileSync: writeFileSync41, existsSync: existsSync78, mkdirSync: mkdirSync46 } = __require("node:fs");
246831
246831
  const dir = join27(this.cwd, ".oa", "arche");
246832
246832
  const archiveFile = join27(dir, "variants.json");
246833
246833
  let variants = [];
246834
246834
  try {
246835
- if (existsSync77(archiveFile))
246835
+ if (existsSync78(archiveFile))
246836
246836
  variants = JSON.parse(readFileSync60(archiveFile, "utf8"));
246837
246837
  } catch {
246838
246838
  }
@@ -246848,7 +246848,7 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
246848
246848
  });
246849
246849
  if (variants.length > 50)
246850
246850
  variants = variants.slice(-50);
246851
- mkdirSync45(dir, { recursive: true });
246851
+ mkdirSync46(dir, { recursive: true });
246852
246852
  writeFileSync41(archiveFile, JSON.stringify(variants, null, 2));
246853
246853
  }
246854
246854
  async saveArchive(variants) {
@@ -264833,10 +264833,287 @@ var init_episodeStore = __esm({
264833
264833
  }
264834
264834
  });
264835
264835
 
264836
+ // packages/memory/dist/temporalGraph.js
264837
+ import { join as join61 } from "node:path";
264838
+ import { mkdirSync as mkdirSync21, existsSync as existsSync46 } from "node:fs";
264839
+ import { randomUUID as randomUUID5 } from "node:crypto";
264840
+ var TemporalGraph;
264841
+ var init_temporalGraph = __esm({
264842
+ "packages/memory/dist/temporalGraph.js"() {
264843
+ "use strict";
264844
+ init_db();
264845
+ TemporalGraph = class {
264846
+ db;
264847
+ constructor(dbPath) {
264848
+ const dir = dbPath === ":memory:" ? null : join61(dbPath, "..");
264849
+ if (dir && !existsSync46(dir))
264850
+ mkdirSync21(dir, { recursive: true });
264851
+ this.db = initDb(dbPath);
264852
+ this.db.exec(`
264853
+ CREATE TABLE IF NOT EXISTS kg_nodes (
264854
+ id TEXT PRIMARY KEY,
264855
+ text TEXT NOT NULL,
264856
+ node_type TEXT DEFAULT 'entity',
264857
+ embedding BLOB,
264858
+ first_seen INTEGER NOT NULL,
264859
+ last_seen INTEGER NOT NULL,
264860
+ mention_count INTEGER DEFAULT 1
264861
+ )
264862
+ `);
264863
+ this.db.exec(`
264864
+ CREATE TABLE IF NOT EXISTS kg_edges (
264865
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
264866
+ src_id TEXT NOT NULL REFERENCES kg_nodes(id),
264867
+ dst_id TEXT NOT NULL REFERENCES kg_nodes(id),
264868
+ relation TEXT NOT NULL,
264869
+ fact TEXT,
264870
+ edge_type TEXT DEFAULT 'triple',
264871
+ valid_from INTEGER NOT NULL,
264872
+ valid_until INTEGER,
264873
+ confidence REAL DEFAULT 1.0,
264874
+ source_episode_id TEXT,
264875
+ modality TEXT DEFAULT 'text'
264876
+ )
264877
+ `);
264878
+ this.db.exec(`CREATE INDEX IF NOT EXISTS idx_kgn_text ON kg_nodes(text)`);
264879
+ this.db.exec(`CREATE INDEX IF NOT EXISTS idx_kge_src ON kg_edges(src_id)`);
264880
+ this.db.exec(`CREATE INDEX IF NOT EXISTS idx_kge_dst ON kg_edges(dst_id)`);
264881
+ this.db.exec(`CREATE INDEX IF NOT EXISTS idx_kge_valid ON kg_edges(valid_from, valid_until)`);
264882
+ this.db.pragma("journal_mode = WAL");
264883
+ this.db.pragma("synchronous = NORMAL");
264884
+ }
264885
+ // ─── Node operations ─────────────────────────────────────────────────────
264886
+ /** Get or create a node. If it exists, increment mention_count and update last_seen. */
264887
+ upsertNode(insert) {
264888
+ const now = Date.now();
264889
+ const existing = this.db.prepare("SELECT id, mention_count FROM kg_nodes WHERE text = ? AND node_type = ?").get(insert.text, insert.nodeType);
264890
+ if (existing) {
264891
+ this.db.prepare("UPDATE kg_nodes SET mention_count = mention_count + 1, last_seen = ? WHERE id = ?").run(now, existing.id);
264892
+ return existing.id;
264893
+ }
264894
+ const id = randomUUID5();
264895
+ const embBuf = insert.embedding ? Buffer.from(insert.embedding.buffer) : null;
264896
+ this.db.prepare(`
264897
+ INSERT INTO kg_nodes (id, text, node_type, embedding, first_seen, last_seen, mention_count)
264898
+ VALUES (?, ?, ?, ?, ?, ?, 1)
264899
+ `).run(id, insert.text, insert.nodeType, embBuf, now, now);
264900
+ return id;
264901
+ }
264902
+ /** Find a node by text (case-insensitive). */
264903
+ findNode(text, nodeType) {
264904
+ const sql = nodeType ? "SELECT * FROM kg_nodes WHERE text = ? AND node_type = ? LIMIT 1" : "SELECT * FROM kg_nodes WHERE text = ? LIMIT 1";
264905
+ const row = nodeType ? this.db.prepare(sql).get(text, nodeType) : this.db.prepare(sql).get(text);
264906
+ return row ? this.rowToNode(row) : null;
264907
+ }
264908
+ /** Get a node by ID. */
264909
+ getNode(id) {
264910
+ const row = this.db.prepare("SELECT * FROM kg_nodes WHERE id = ?").get(id);
264911
+ return row ? this.rowToNode(row) : null;
264912
+ }
264913
+ /** List all nodes of a given type. */
264914
+ nodesByType(nodeType, limit = 100) {
264915
+ return this.db.prepare("SELECT * FROM kg_nodes WHERE node_type = ? ORDER BY mention_count DESC LIMIT ?").all(nodeType, limit).map((r2) => this.rowToNode(r2));
264916
+ }
264917
+ // ─── Edge operations ─────────────────────────────────────────────────────
264918
+ /** Add an edge. If a conflicting edge exists (same src, dst, relation), supersede it. */
264919
+ addEdge(insert) {
264920
+ const now = Date.now();
264921
+ this.db.prepare(`
264922
+ UPDATE kg_edges SET valid_until = ?
264923
+ WHERE src_id = ? AND dst_id = ? AND relation = ? AND valid_until IS NULL
264924
+ `).run(now, insert.srcId, insert.dstId, insert.relation);
264925
+ const result = this.db.prepare(`
264926
+ INSERT INTO kg_edges (src_id, dst_id, relation, fact, edge_type, valid_from, valid_until, confidence, source_episode_id, modality)
264927
+ VALUES (?, ?, ?, ?, ?, ?, NULL, ?, ?, ?)
264928
+ `).run(
264929
+ insert.srcId,
264930
+ insert.dstId,
264931
+ insert.relation,
264932
+ insert.fact ?? null,
264933
+ insert.edgeType ?? "triple",
264934
+ now,
264935
+ // valid_from = now
264936
+ insert.confidence ?? 1,
264937
+ insert.sourceEpisodeId ?? null,
264938
+ insert.modality ?? "text"
264939
+ );
264940
+ return result.lastInsertRowid;
264941
+ }
264942
+ // ─── Temporal queries ────────────────────────────────────────────────────
264943
+ /** Get currently valid edges for a node. */
264944
+ currentEdges(nodeId) {
264945
+ return this.db.prepare(`
264946
+ SELECT * FROM kg_edges
264947
+ WHERE (src_id = ? OR dst_id = ?) AND valid_until IS NULL
264948
+ ORDER BY valid_from DESC
264949
+ `).all(nodeId, nodeId).map((r2) => this.rowToEdge(r2));
264950
+ }
264951
+ /** Get edges valid at a specific time. */
264952
+ edgesAtTime(nodeId, timestamp) {
264953
+ return this.db.prepare(`
264954
+ SELECT * FROM kg_edges
264955
+ WHERE (src_id = ? OR dst_id = ?)
264956
+ AND valid_from <= ?
264957
+ AND (valid_until IS NULL OR valid_until > ?)
264958
+ ORDER BY valid_from DESC
264959
+ `).all(nodeId, nodeId, timestamp, timestamp).map((r2) => this.rowToEdge(r2));
264960
+ }
264961
+ /** Get full history of a node (all edges, including superseded). */
264962
+ nodeHistory(nodeId) {
264963
+ return this.db.prepare(`
264964
+ SELECT * FROM kg_edges
264965
+ WHERE src_id = ? OR dst_id = ?
264966
+ ORDER BY valid_from ASC
264967
+ `).all(nodeId, nodeId).map((r2) => this.rowToEdge(r2));
264968
+ }
264969
+ /** Get edges that changed between two timestamps. */
264970
+ changedBetween(start2, end) {
264971
+ return this.db.prepare(`
264972
+ SELECT * FROM kg_edges
264973
+ WHERE valid_from BETWEEN ? AND ?
264974
+ ORDER BY valid_from ASC
264975
+ `).all(start2, end).map((r2) => this.rowToEdge(r2));
264976
+ }
264977
+ /** Find neighbors of a node (1-hop traversal). */
264978
+ neighbors(nodeId, relation) {
264979
+ let sql = `
264980
+ SELECT e.*, n.id as n_id, n.text as n_text, n.node_type as n_type,
264981
+ n.first_seen as n_first, n.last_seen as n_last, n.mention_count as n_mentions
264982
+ FROM kg_edges e
264983
+ JOIN kg_nodes n ON (e.dst_id = n.id AND e.src_id = ?) OR (e.src_id = n.id AND e.dst_id = ?)
264984
+ WHERE e.valid_until IS NULL
264985
+ `;
264986
+ const params = [nodeId, nodeId];
264987
+ if (relation) {
264988
+ sql += " AND e.relation = ?";
264989
+ params.push(relation);
264990
+ }
264991
+ sql += " ORDER BY e.valid_from DESC";
264992
+ return this.db.prepare(sql).all(...params).map((r2) => ({
264993
+ node: { id: r2.n_id, text: r2.n_text, nodeType: r2.n_type, embedding: null, firstSeen: r2.n_first, lastSeen: r2.n_last, mentionCount: r2.n_mentions },
264994
+ edge: this.rowToEdge(r2)
264995
+ }));
264996
+ }
264997
+ // ─── Statistics ──────────────────────────────────────────────────────────
264998
+ nodeCount() {
264999
+ return this.db.prepare("SELECT COUNT(*) as n FROM kg_nodes").get().n;
265000
+ }
265001
+ edgeCount() {
265002
+ return this.db.prepare("SELECT COUNT(*) as n FROM kg_edges").get().n;
265003
+ }
265004
+ activeEdgeCount() {
265005
+ return this.db.prepare("SELECT COUNT(*) as n FROM kg_edges WHERE valid_until IS NULL").get().n;
265006
+ }
265007
+ close() {
265008
+ try {
265009
+ this.db.close();
265010
+ } catch {
265011
+ }
265012
+ }
265013
+ // ─── Internal ────────────────────────────────────────────────────────────
265014
+ rowToNode(row) {
265015
+ return {
265016
+ id: row.id,
265017
+ text: row.text,
265018
+ nodeType: row.node_type,
265019
+ embedding: row.embedding ? new Float32Array(new Uint8Array(row.embedding).buffer) : null,
265020
+ firstSeen: row.first_seen,
265021
+ lastSeen: row.last_seen,
265022
+ mentionCount: row.mention_count
265023
+ };
265024
+ }
265025
+ rowToEdge(row) {
265026
+ return {
265027
+ id: row.id,
265028
+ srcId: row.src_id,
265029
+ dstId: row.dst_id,
265030
+ relation: row.relation,
265031
+ fact: row.fact,
265032
+ edgeType: row.edge_type,
265033
+ validFrom: row.valid_from,
265034
+ validUntil: row.valid_until,
265035
+ confidence: row.confidence,
265036
+ sourceEpisodeId: row.source_episode_id,
265037
+ modality: row.modality
265038
+ };
265039
+ }
265040
+ };
265041
+ }
265042
+ });
265043
+
264836
265044
  // packages/memory/dist/embeddings.js
265045
+ async function generateEmbedding(text, config) {
265046
+ const cfg = { ...DEFAULT_CONFIG4, ...config };
265047
+ try {
265048
+ const url = `${cfg.baseUrl}/api/embed`;
265049
+ const resp = await fetch(url, {
265050
+ method: "POST",
265051
+ headers: { "Content-Type": "application/json" },
265052
+ body: JSON.stringify({
265053
+ model: cfg.model,
265054
+ input: text
265055
+ }),
265056
+ signal: AbortSignal.timeout(cfg.timeoutMs)
265057
+ });
265058
+ if (!resp.ok) {
265059
+ if (resp.status === 404) {
265060
+ const pulled = await pullEmbeddingModel(cfg.baseUrl, cfg.model, cfg.timeoutMs);
265061
+ if (!pulled)
265062
+ return null;
265063
+ return generateEmbedding(text, config);
265064
+ }
265065
+ return null;
265066
+ }
265067
+ const data = await resp.json();
265068
+ const rawVector = data.embeddings?.[0] ?? data.embedding;
265069
+ if (!rawVector || rawVector.length === 0)
265070
+ return null;
265071
+ return {
265072
+ vector: new Float32Array(rawVector),
265073
+ model: cfg.model,
265074
+ dimensions: rawVector.length
265075
+ };
265076
+ } catch {
265077
+ return null;
265078
+ }
265079
+ }
265080
+ async function checkEmbeddingAvailable(config) {
265081
+ const cfg = { ...DEFAULT_CONFIG4, ...config };
265082
+ try {
265083
+ const resp = await fetch(`${cfg.baseUrl}/api/tags`, {
265084
+ signal: AbortSignal.timeout(5e3)
265085
+ });
265086
+ if (!resp.ok)
265087
+ return false;
265088
+ const data = await resp.json();
265089
+ return data.models?.some((m2) => m2.name.startsWith(cfg.model)) ?? false;
265090
+ } catch {
265091
+ return false;
265092
+ }
265093
+ }
265094
+ async function pullEmbeddingModel(baseUrl, model, timeoutMs) {
265095
+ try {
265096
+ const resp = await fetch(`${baseUrl}/api/pull`, {
265097
+ method: "POST",
265098
+ headers: { "Content-Type": "application/json" },
265099
+ body: JSON.stringify({ name: model, stream: false }),
265100
+ signal: AbortSignal.timeout(timeoutMs * 10)
265101
+ // pulling can take minutes
265102
+ });
265103
+ return resp.ok;
265104
+ } catch {
265105
+ return false;
265106
+ }
265107
+ }
265108
+ var DEFAULT_CONFIG4;
264837
265109
  var init_embeddings = __esm({
264838
265110
  "packages/memory/dist/embeddings.js"() {
264839
265111
  "use strict";
265112
+ DEFAULT_CONFIG4 = {
265113
+ baseUrl: "http://localhost:11434",
265114
+ model: "nomic-embed-text",
265115
+ timeoutMs: 3e4
265116
+ };
264840
265117
  }
264841
265118
  });
264842
265119
 
@@ -264861,6 +265138,7 @@ var init_dist7 = __esm({
264861
265138
  init_validationStore();
264862
265139
  init_toolPatternStore();
264863
265140
  init_episodeStore();
265141
+ init_temporalGraph();
264864
265142
  init_embeddings();
264865
265143
  init_proceduralMemoryStore();
264866
265144
  }
@@ -265598,11 +265876,40 @@ var init_agenticRunner = __esm({
265598
265876
  _errorPatterns = /* @__PURE__ */ new Map();
265599
265877
  _errorGuidanceInjected = /* @__PURE__ */ new Set();
265600
265878
  // prevent duplicate injection per turn
265601
- // ── WO-AM-01: Episode store for associative memory ──
265602
- // Captures every tool call/result as a persistent episode with importance scoring.
265603
- // Initialized lazily on first task run stored at {cwd}/.oa/episodes.db
265879
+ // ── WO-AM-01/04/10: Associative memory stores ──
265880
+ // Episode store: every tool call persistent episode with importance + decay
265881
+ // Temporal KG: entities + relations with temporal validity (valid_from/valid_until)
265882
+ // Embedding pipeline: background embedding computation for episodes
265604
265883
  _episodeStore = null;
265605
- _episodeStoreInitialized = false;
265884
+ _temporalGraph = null;
265885
+ _memoryInitialized = false;
265886
+ _embeddingAvailable = null;
265887
+ // null = not checked yet
265888
+ _pendingEmbeddings = [];
265889
+ _embeddingTimer = null;
265890
+ /** WO-AM-10: Process pending episode embeddings in background batches */
265891
+ async processPendingEmbeddings() {
265892
+ if (this._pendingEmbeddings.length === 0 || !this._episodeStore)
265893
+ return;
265894
+ const batch2 = this._pendingEmbeddings.splice(0, 20);
265895
+ const baseUrl = this.backend.baseUrl ?? "http://localhost:11434";
265896
+ for (const { id, content } of batch2) {
265897
+ try {
265898
+ const embResult = await generateEmbedding(content, { baseUrl });
265899
+ if (embResult?.vector) {
265900
+ this._episodeStore.setEmbedding(id, embResult.vector);
265901
+ }
265902
+ } catch {
265903
+ }
265904
+ }
265905
+ }
265906
+ /** Stop the embedding pipeline timer */
265907
+ stopEmbeddingPipeline() {
265908
+ if (this._embeddingTimer) {
265909
+ clearInterval(this._embeddingTimer);
265910
+ this._embeddingTimer = null;
265911
+ }
265912
+ }
265606
265913
  _loopBlockedTools;
265607
265914
  // Loop intervention: tools removed from schema
265608
265915
  // -- Session Checkpointing (Priority 5) --
@@ -266128,12 +266435,19 @@ Respond with your assessment, then take action.`;
266128
266435
  const toolCallLog = [];
266129
266436
  this.aborted = false;
266130
266437
  this._paused = false;
266131
- if (!this._episodeStoreInitialized) {
266438
+ if (!this._memoryInitialized) {
266132
266439
  try {
266133
266440
  const path5 = await import("node:path");
266134
- const dbPath = path5.join(process.cwd(), ".oa", "episodes.db");
266135
- this._episodeStore = new EpisodeStore(dbPath);
266136
- this._episodeStoreInitialized = true;
266441
+ const oaDir = path5.join(process.cwd(), ".oa");
266442
+ this._episodeStore = new EpisodeStore(path5.join(oaDir, "episodes.db"));
266443
+ this._temporalGraph = new TemporalGraph(path5.join(oaDir, "knowledge.db"));
266444
+ this._embeddingAvailable = await checkEmbeddingAvailable({
266445
+ baseUrl: this.backend.baseUrl ?? "http://localhost:11434"
266446
+ }).catch(() => false);
266447
+ if (this._embeddingAvailable && !this._embeddingTimer) {
266448
+ this._embeddingTimer = setInterval(() => this.processPendingEmbeddings(), 1e4);
266449
+ }
266450
+ this._memoryInitialized = true;
266137
266451
  } catch {
266138
266452
  }
266139
266453
  }
@@ -266902,18 +267216,62 @@ If you're stuck, try a completely different approach. Do NOT repeat what failed
266902
267216
  }
266903
267217
  if (this._episodeStore) {
266904
267218
  try {
266905
- this._episodeStore.insert({
267219
+ const episodeContent = result.success ? `${tc.name}: ${(result.output ?? "").slice(0, 500)}` : `${tc.name} ERROR: ${(result.error ?? result.output ?? "").slice(0, 500)}`;
267220
+ const episodeId = this._episodeStore.insert({
266906
267221
  sessionId: this._sessionId,
266907
267222
  turnNumber: turn,
266908
- modality: result.success ? "tool_result" : "tool_result",
267223
+ modality: "tool_result",
266909
267224
  toolName: tc.name,
266910
- content: result.success ? `${tc.name}: ${(result.output ?? "").slice(0, 500)}` : `${tc.name} ERROR: ${(result.error ?? result.output ?? "").slice(0, 500)}`,
267225
+ content: episodeContent,
266911
267226
  metadata: {
266912
267227
  args_fingerprint: argsKey.slice(0, 200),
266913
267228
  success: result.success,
266914
267229
  duration_ms: performance.now() - toolStart
266915
267230
  }
266916
267231
  });
267232
+ if (this._embeddingAvailable && episodeContent.length > 20) {
267233
+ this._pendingEmbeddings.push({ id: episodeId, content: episodeContent.slice(0, 500) });
267234
+ }
267235
+ if (this._temporalGraph) {
267236
+ try {
267237
+ const toolNodeId = this._temporalGraph.upsertNode({
267238
+ text: tc.name,
267239
+ nodeType: "tool"
267240
+ });
267241
+ const filePath2 = tc.arguments?.path || tc.arguments?.file_path || tc.arguments?.file;
267242
+ if (filePath2) {
267243
+ const fileNodeId = this._temporalGraph.upsertNode({
267244
+ text: filePath2,
267245
+ nodeType: "file"
267246
+ });
267247
+ const relation = ["file_write", "file_edit", "file_patch", "batch_edit"].includes(tc.name) ? "modified_by" : "related_to";
267248
+ this._temporalGraph.addEdge({
267249
+ srcId: fileNodeId,
267250
+ dstId: toolNodeId,
267251
+ relation,
267252
+ fact: `${filePath2} ${relation} ${tc.name}`,
267253
+ edgeType: "triple",
267254
+ sourceEpisodeId: episodeId
267255
+ });
267256
+ }
267257
+ if (!result.success && result.error) {
267258
+ const errorText = result.error.slice(0, 100);
267259
+ const errorNodeId = this._temporalGraph.upsertNode({
267260
+ text: errorText,
267261
+ nodeType: "error"
267262
+ });
267263
+ this._temporalGraph.addEdge({
267264
+ srcId: toolNodeId,
267265
+ dstId: errorNodeId,
267266
+ relation: "caused_by",
267267
+ fact: `${tc.name} caused: ${errorText}`,
267268
+ edgeType: "causal",
267269
+ sourceEpisodeId: episodeId
267270
+ });
267271
+ }
267272
+ } catch {
267273
+ }
267274
+ }
266917
267275
  } catch {
266918
267276
  }
266919
267277
  }
@@ -267776,6 +268134,21 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
267776
268134
  if (pruned > 0) {
267777
268135
  this.emit({ type: "status", content: `Pruned ${pruned} expired session episodes`, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
267778
268136
  }
268137
+ if (this._pendingEmbeddings.length > 0) {
268138
+ await this.processPendingEmbeddings();
268139
+ }
268140
+ this.stopEmbeddingPipeline();
268141
+ if (this._temporalGraph) {
268142
+ const nodes = this._temporalGraph.nodeCount();
268143
+ const edges = this._temporalGraph.activeEdgeCount();
268144
+ if (nodes > 0) {
268145
+ this.emit({ type: "status", content: `Knowledge graph: ${nodes} nodes, ${edges} active edges`, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
268146
+ }
268147
+ }
268148
+ const epCount = this._episodeStore.count(this._sessionId);
268149
+ if (epCount > 0) {
268150
+ this.emit({ type: "status", content: `Episodes captured: ${epCount} this session`, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
268151
+ }
267779
268152
  } catch {
267780
268153
  }
267781
268154
  }
@@ -267931,11 +268304,11 @@ ${errOutput}`;
267931
268304
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
267932
268305
  });
267933
268306
  try {
267934
- const { mkdirSync: mkdirSync45, writeFileSync: writeFileSync41 } = __require("node:fs");
267935
- const { join: join96 } = __require("node:path");
267936
- const resultsDir = join96(process.cwd(), ".oa", "tool-results");
267937
- mkdirSync45(resultsDir, { recursive: true });
267938
- writeFileSync41(join96(resultsDir, `${handleId}.txt`), `# Tool: ${toolName}
268307
+ const { mkdirSync: mkdirSync46, writeFileSync: writeFileSync41 } = __require("node:fs");
268308
+ const { join: join97 } = __require("node:path");
268309
+ const resultsDir = join97(process.cwd(), ".oa", "tool-results");
268310
+ mkdirSync46(resultsDir, { recursive: true });
268311
+ writeFileSync41(join97(resultsDir, `${handleId}.txt`), `# Tool: ${toolName}
267939
268312
  # Turn: ${turn}
267940
268313
  # Timestamp: ${(/* @__PURE__ */ new Date()).toISOString()}
267941
268314
  # Size: ${result.output.length} chars, ${lineCount} lines
@@ -268074,10 +268447,10 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
268074
268447
  if (!this._workingDirectory)
268075
268448
  return;
268076
268449
  try {
268077
- const { mkdirSync: mkdirSync45, writeFileSync: writeFileSync41 } = __require("node:fs");
268078
- const { join: join96 } = __require("node:path");
268079
- const sessionDir = join96(this._workingDirectory, ".oa", "session", this._sessionId);
268080
- mkdirSync45(sessionDir, { recursive: true });
268450
+ const { mkdirSync: mkdirSync46, writeFileSync: writeFileSync41 } = __require("node:fs");
268451
+ const { join: join97 } = __require("node:path");
268452
+ const sessionDir = join97(this._workingDirectory, ".oa", "session", this._sessionId);
268453
+ mkdirSync46(sessionDir, { recursive: true });
268081
268454
  const checkpoint = {
268082
268455
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
268083
268456
  sessionId: this._sessionId,
@@ -268089,7 +268462,7 @@ Actions: (1) list_directory on the parent directory to see what's there, (2) Che
268089
268462
  memexEntryCount: this._memexArchive.size,
268090
268463
  fileRegistrySize: this._fileRegistry.size
268091
268464
  };
268092
- writeFileSync41(join96(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
268465
+ writeFileSync41(join97(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
268093
268466
  } catch {
268094
268467
  }
268095
268468
  }
@@ -269511,10 +269884,10 @@ ${result}`
269511
269884
  try {
269512
269885
  const { execSync: execSync54 } = await import("node:child_process");
269513
269886
  const { writeFileSync: writeFileSync41, readFileSync: readFileSync60, unlinkSync: unlinkSync18 } = await import("node:fs");
269514
- const { join: join96 } = await import("node:path");
269887
+ const { join: join97 } = await import("node:path");
269515
269888
  const { tmpdir: tmpdir18 } = await import("node:os");
269516
- const tmpIn = join96(tmpdir18(), `oa_img_in_${Date.now()}.png`);
269517
- const tmpOut = join96(tmpdir18(), `oa_img_out_${Date.now()}.jpg`);
269889
+ const tmpIn = join97(tmpdir18(), `oa_img_in_${Date.now()}.png`);
269890
+ const tmpOut = join97(tmpdir18(), `oa_img_out_${Date.now()}.jpg`);
269518
269891
  writeFileSync41(tmpIn, buffer2);
269519
269892
  const pyBin = process.platform === "win32" ? "python" : "python3";
269520
269893
  const escapedIn = tmpIn.replace(/\\/g, "\\\\");
@@ -270163,9 +270536,9 @@ var init_constraint_learner = __esm({
270163
270536
  });
270164
270537
 
270165
270538
  // packages/orchestrator/dist/nexusBackend.js
270166
- import { existsSync as existsSync46, statSync as statSync14, openSync, readSync, closeSync, unlinkSync as unlinkSync9, writeFileSync as writeFileSync19 } from "node:fs";
270539
+ import { existsSync as existsSync47, statSync as statSync14, openSync, readSync, closeSync, unlinkSync as unlinkSync9, writeFileSync as writeFileSync19 } from "node:fs";
270167
270540
  import { watch as fsWatch } from "node:fs";
270168
- import { join as join61 } from "node:path";
270541
+ import { join as join62 } from "node:path";
270169
270542
  import { tmpdir as tmpdir14 } from "node:os";
270170
270543
  import { randomBytes as randomBytes14 } from "node:crypto";
270171
270544
  var NexusAgenticBackend;
@@ -270315,7 +270688,7 @@ var init_nexusBackend = __esm({
270315
270688
  * Falls back to unary + word-split if streaming setup fails.
270316
270689
  */
270317
270690
  async *chatCompletionStream(request) {
270318
- const streamFile = join61(tmpdir14(), `nexus-stream-${randomBytes14(6).toString("hex")}.jsonl`);
270691
+ const streamFile = join62(tmpdir14(), `nexus-stream-${randomBytes14(6).toString("hex")}.jsonl`);
270319
270692
  writeFileSync19(streamFile, "", "utf8");
270320
270693
  const daemonArgs = {
270321
270694
  model: this.model,
@@ -271962,8 +272335,8 @@ __export(listen_exports, {
271962
272335
  waitForTranscribeCli: () => waitForTranscribeCli
271963
272336
  });
271964
272337
  import { spawn as spawn17, execSync as execSync42 } from "node:child_process";
271965
- import { existsSync as existsSync47, mkdirSync as mkdirSync21, writeFileSync as writeFileSync20, readdirSync as readdirSync9 } from "node:fs";
271966
- import { join as join62, dirname as dirname16 } from "node:path";
272338
+ import { existsSync as existsSync48, mkdirSync as mkdirSync22, writeFileSync as writeFileSync20, readdirSync as readdirSync9 } from "node:fs";
272339
+ import { join as join63, dirname as dirname16 } from "node:path";
271967
272340
  import { homedir as homedir18 } from "node:os";
271968
272341
  import { fileURLToPath as fileURLToPath9 } from "node:url";
271969
272342
  import { EventEmitter as EventEmitter3 } from "node:events";
@@ -272049,15 +272422,15 @@ function findMicCaptureCommand() {
272049
272422
  function findLiveWhisperScript() {
272050
272423
  const thisDir = dirname16(fileURLToPath9(import.meta.url));
272051
272424
  const candidates = [
272052
- join62(thisDir, "../../../../packages/execution/scripts/live-whisper.py"),
272053
- join62(thisDir, "../../../packages/execution/scripts/live-whisper.py"),
272054
- join62(thisDir, "../../execution/scripts/live-whisper.py"),
272425
+ join63(thisDir, "../../../../packages/execution/scripts/live-whisper.py"),
272426
+ join63(thisDir, "../../../packages/execution/scripts/live-whisper.py"),
272427
+ join63(thisDir, "../../execution/scripts/live-whisper.py"),
272055
272428
  // npm install layout — scripts bundled alongside dist
272056
- join62(thisDir, "../scripts/live-whisper.py"),
272057
- join62(thisDir, "../../scripts/live-whisper.py")
272429
+ join63(thisDir, "../scripts/live-whisper.py"),
272430
+ join63(thisDir, "../../scripts/live-whisper.py")
272058
272431
  ];
272059
272432
  for (const p2 of candidates) {
272060
- if (existsSync47(p2)) return p2;
272433
+ if (existsSync48(p2)) return p2;
272061
272434
  }
272062
272435
  try {
272063
272436
  const globalRoot = execSync42("npm root -g", {
@@ -272066,20 +272439,20 @@ function findLiveWhisperScript() {
272066
272439
  stdio: ["pipe", "pipe", "pipe"]
272067
272440
  }).trim();
272068
272441
  const candidates2 = [
272069
- join62(globalRoot, "open-agents-ai", "dist", "scripts", "live-whisper.py"),
272070
- join62(globalRoot, "open-agents-ai", "scripts", "live-whisper.py")
272442
+ join63(globalRoot, "open-agents-ai", "dist", "scripts", "live-whisper.py"),
272443
+ join63(globalRoot, "open-agents-ai", "scripts", "live-whisper.py")
272071
272444
  ];
272072
272445
  for (const p2 of candidates2) {
272073
- if (existsSync47(p2)) return p2;
272446
+ if (existsSync48(p2)) return p2;
272074
272447
  }
272075
272448
  } catch {
272076
272449
  }
272077
- const nvmBase = join62(homedir18(), ".nvm", "versions", "node");
272078
- if (existsSync47(nvmBase)) {
272450
+ const nvmBase = join63(homedir18(), ".nvm", "versions", "node");
272451
+ if (existsSync48(nvmBase)) {
272079
272452
  try {
272080
272453
  for (const ver of readdirSync9(nvmBase)) {
272081
- const p2 = join62(nvmBase, ver, "lib", "node_modules", "open-agents-ai", "dist", "scripts", "live-whisper.py");
272082
- if (existsSync47(p2)) return p2;
272454
+ const p2 = join63(nvmBase, ver, "lib", "node_modules", "open-agents-ai", "dist", "scripts", "live-whisper.py");
272455
+ if (existsSync48(p2)) return p2;
272083
272456
  }
272084
272457
  } catch {
272085
272458
  }
@@ -272095,7 +272468,7 @@ function ensureTranscribeCliBackground() {
272095
272468
  timeout: 5e3,
272096
272469
  stdio: ["pipe", "pipe", "pipe"]
272097
272470
  }).trim();
272098
- if (existsSync47(join62(globalRoot, "transcribe-cli", "dist", "index.js"))) {
272471
+ if (existsSync48(join63(globalRoot, "transcribe-cli", "dist", "index.js"))) {
272099
272472
  return true;
272100
272473
  }
272101
272474
  } catch {
@@ -272314,24 +272687,24 @@ var init_listen = __esm({
272314
272687
  timeout: 5e3,
272315
272688
  stdio: ["pipe", "pipe", "pipe"]
272316
272689
  }).trim();
272317
- const tcPath = join62(globalRoot, "transcribe-cli");
272318
- if (existsSync47(join62(tcPath, "dist", "index.js"))) {
272690
+ const tcPath = join63(globalRoot, "transcribe-cli");
272691
+ if (existsSync48(join63(tcPath, "dist", "index.js"))) {
272319
272692
  const { createRequire: createRequire7 } = await import("node:module");
272320
272693
  const req2 = createRequire7(import.meta.url);
272321
- return req2(join62(tcPath, "dist", "index.js"));
272694
+ return req2(join63(tcPath, "dist", "index.js"));
272322
272695
  }
272323
272696
  } catch {
272324
272697
  }
272325
- const nvmBase = join62(homedir18(), ".nvm", "versions", "node");
272326
- if (existsSync47(nvmBase)) {
272698
+ const nvmBase = join63(homedir18(), ".nvm", "versions", "node");
272699
+ if (existsSync48(nvmBase)) {
272327
272700
  try {
272328
272701
  const { readdirSync: readdirSync26 } = await import("node:fs");
272329
272702
  for (const ver of readdirSync26(nvmBase)) {
272330
- const tcPath = join62(nvmBase, ver, "lib", "node_modules", "transcribe-cli");
272331
- if (existsSync47(join62(tcPath, "dist", "index.js"))) {
272703
+ const tcPath = join63(nvmBase, ver, "lib", "node_modules", "transcribe-cli");
272704
+ if (existsSync48(join63(tcPath, "dist", "index.js"))) {
272332
272705
  const { createRequire: createRequire7 } = await import("node:module");
272333
272706
  const req2 = createRequire7(import.meta.url);
272334
- return req2(join62(tcPath, "dist", "index.js"));
272707
+ return req2(join63(tcPath, "dist", "index.js"));
272335
272708
  }
272336
272709
  }
272337
272710
  } catch {
@@ -272605,9 +272978,9 @@ transcribe-cli error: ${transcribeCliError}` : "";
272605
272978
  });
272606
272979
  if (outputDir) {
272607
272980
  const { basename: basename19 } = await import("node:path");
272608
- const transcriptDir = join62(outputDir, ".oa", "transcripts");
272609
- mkdirSync21(transcriptDir, { recursive: true });
272610
- const outFile = join62(transcriptDir, `${basename19(filePath)}.txt`);
272981
+ const transcriptDir = join63(outputDir, ".oa", "transcripts");
272982
+ mkdirSync22(transcriptDir, { recursive: true });
272983
+ const outFile = join63(transcriptDir, `${basename19(filePath)}.txt`);
272611
272984
  writeFileSync20(outFile, result.text, "utf-8");
272612
272985
  }
272613
272986
  return {
@@ -278634,8 +279007,8 @@ import { EventEmitter as EventEmitter5 } from "node:events";
278634
279007
  import { randomBytes as randomBytes15 } from "node:crypto";
278635
279008
  import { URL as URL2 } from "node:url";
278636
279009
  import { loadavg, cpus as cpus2, totalmem as totalmem2, freemem as freemem2 } from "node:os";
278637
- import { existsSync as existsSync48, readFileSync as readFileSync35, writeFileSync as writeFileSync21, unlinkSync as unlinkSync10, mkdirSync as mkdirSync22, readdirSync as readdirSync10, statSync as statSync15 } from "node:fs";
278638
- import { join as join63 } from "node:path";
279010
+ import { existsSync as existsSync49, readFileSync as readFileSync35, writeFileSync as writeFileSync21, unlinkSync as unlinkSync10, mkdirSync as mkdirSync23, readdirSync as readdirSync10, statSync as statSync15 } from "node:fs";
279011
+ import { join as join64 } from "node:path";
278639
279012
  function cleanForwardHeaders(raw, targetHost) {
278640
279013
  const out = {};
278641
279014
  for (const [key, value2] of Object.entries(raw)) {
@@ -278656,8 +279029,8 @@ function fmtTokens(n2) {
278656
279029
  }
278657
279030
  function readExposeState(stateDir) {
278658
279031
  try {
278659
- const path5 = join63(stateDir, STATE_FILE_NAME);
278660
- if (!existsSync48(path5)) return null;
279032
+ const path5 = join64(stateDir, STATE_FILE_NAME);
279033
+ if (!existsSync49(path5)) return null;
278661
279034
  const raw = readFileSync35(path5, "utf8");
278662
279035
  const data = JSON.parse(raw);
278663
279036
  if (!data.pid || !data.tunnelUrl || !data.authKey || !data.proxyPort) return null;
@@ -278668,14 +279041,14 @@ function readExposeState(stateDir) {
278668
279041
  }
278669
279042
  function writeExposeState(stateDir, state) {
278670
279043
  try {
278671
- mkdirSync22(stateDir, { recursive: true });
278672
- writeFileSync21(join63(stateDir, STATE_FILE_NAME), JSON.stringify(state, null, 2));
279044
+ mkdirSync23(stateDir, { recursive: true });
279045
+ writeFileSync21(join64(stateDir, STATE_FILE_NAME), JSON.stringify(state, null, 2));
278673
279046
  } catch {
278674
279047
  }
278675
279048
  }
278676
279049
  function removeExposeState(stateDir) {
278677
279050
  try {
278678
- unlinkSync10(join63(stateDir, STATE_FILE_NAME));
279051
+ unlinkSync10(join64(stateDir, STATE_FILE_NAME));
278679
279052
  } catch {
278680
279053
  }
278681
279054
  }
@@ -278772,8 +279145,8 @@ async function collectSystemMetricsAsync() {
278772
279145
  }
278773
279146
  function readP2PExposeState(stateDir) {
278774
279147
  try {
278775
- const path5 = join63(stateDir, P2P_STATE_FILE_NAME);
278776
- if (!existsSync48(path5)) return null;
279148
+ const path5 = join64(stateDir, P2P_STATE_FILE_NAME);
279149
+ if (!existsSync49(path5)) return null;
278777
279150
  const raw = readFileSync35(path5, "utf8");
278778
279151
  const data = JSON.parse(raw);
278779
279152
  if (!data.peerId || !data.authKey) return null;
@@ -278784,14 +279157,14 @@ function readP2PExposeState(stateDir) {
278784
279157
  }
278785
279158
  function writeP2PExposeState(stateDir, state) {
278786
279159
  try {
278787
- mkdirSync22(stateDir, { recursive: true });
278788
- writeFileSync21(join63(stateDir, P2P_STATE_FILE_NAME), JSON.stringify(state, null, 2));
279160
+ mkdirSync23(stateDir, { recursive: true });
279161
+ writeFileSync21(join64(stateDir, P2P_STATE_FILE_NAME), JSON.stringify(state, null, 2));
278789
279162
  } catch {
278790
279163
  }
278791
279164
  }
278792
279165
  function removeP2PExposeState(stateDir) {
278793
279166
  try {
278794
- unlinkSync10(join63(stateDir, P2P_STATE_FILE_NAME));
279167
+ unlinkSync10(join64(stateDir, P2P_STATE_FILE_NAME));
278795
279168
  } catch {
278796
279169
  }
278797
279170
  }
@@ -279781,7 +280154,7 @@ ${this.formatConnectionInfo()}`);
279781
280154
  throw new Error(`Expose failed: ${exposeResult.error}`);
279782
280155
  }
279783
280156
  const nexusDir = this._nexusTool.getNexusDir();
279784
- const statusPath = join63(nexusDir, "status.json");
280157
+ const statusPath = join64(nexusDir, "status.json");
279785
280158
  for (let i2 = 0; i2 < 80; i2++) {
279786
280159
  try {
279787
280160
  const raw = readFileSync35(statusPath, "utf8");
@@ -279815,8 +280188,8 @@ ${this.formatConnectionInfo()}`);
279815
280188
  });
279816
280189
  }
279817
280190
  try {
279818
- const invocDir = join63(nexusDir, "invocations");
279819
- if (existsSync48(invocDir)) {
280191
+ const invocDir = join64(nexusDir, "invocations");
280192
+ if (existsSync49(invocDir)) {
279820
280193
  this._prevInvocCount = readdirSync10(invocDir).filter((f2) => f2.endsWith(".json")).length;
279821
280194
  this._stats.totalRequests = this._prevInvocCount;
279822
280195
  }
@@ -279843,9 +280216,9 @@ ${this.formatConnectionInfo()}`);
279843
280216
  const state = readP2PExposeState(stateDir);
279844
280217
  if (!state) return null;
279845
280218
  const nexusDir = nexusTool.getNexusDir();
279846
- const statusPath = join63(nexusDir, "status.json");
280219
+ const statusPath = join64(nexusDir, "status.json");
279847
280220
  try {
279848
- if (!existsSync48(statusPath)) {
280221
+ if (!existsSync49(statusPath)) {
279849
280222
  removeP2PExposeState(stateDir);
279850
280223
  return null;
279851
280224
  }
@@ -279902,8 +280275,8 @@ ${this.formatConnectionInfo()}`);
279902
280275
  let lastMeteringLineCount = 0;
279903
280276
  this._activityPollTimer = setInterval(() => {
279904
280277
  try {
279905
- const invocDir = join63(nexusDir, "invocations");
279906
- if (!existsSync48(invocDir)) return;
280278
+ const invocDir = join64(nexusDir, "invocations");
280279
+ if (!existsSync49(invocDir)) return;
279907
280280
  const files = readdirSync10(invocDir).filter((f2) => f2.endsWith(".json"));
279908
280281
  const invocCount = files.length;
279909
280282
  const newRequests = invocCount - this._prevInvocCount;
@@ -279917,15 +280290,15 @@ ${this.formatConnectionInfo()}`);
279917
280290
  let recentActive = 0;
279918
280291
  for (const f2 of files.slice(-10)) {
279919
280292
  try {
279920
- const st = statSync15(join63(invocDir, f2));
280293
+ const st = statSync15(join64(invocDir, f2));
279921
280294
  if (now - st.mtimeMs < 1e4) recentActive++;
279922
280295
  } catch {
279923
280296
  }
279924
280297
  }
279925
- const meteringFile = join63(nexusDir, "metering.jsonl");
280298
+ const meteringFile = join64(nexusDir, "metering.jsonl");
279926
280299
  let meteringLines = lastMeteringLineCount;
279927
280300
  try {
279928
- if (existsSync48(meteringFile)) {
280301
+ if (existsSync49(meteringFile)) {
279929
280302
  const content = readFileSync35(meteringFile, "utf8");
279930
280303
  meteringLines = content.split("\n").filter((l2) => l2.trim()).length;
279931
280304
  }
@@ -279951,8 +280324,8 @@ ${this.formatConnectionInfo()}`);
279951
280324
  this._activityPollTimer.unref();
279952
280325
  this._pollTimer = setInterval(() => {
279953
280326
  try {
279954
- const statusPath = join63(nexusDir, "status.json");
279955
- if (existsSync48(statusPath)) {
280327
+ const statusPath = join64(nexusDir, "status.json");
280328
+ if (existsSync49(statusPath)) {
279956
280329
  const status = JSON.parse(readFileSync35(statusPath, "utf8"));
279957
280330
  if (status.peerId && !this._peerId) {
279958
280331
  this._peerId = status.peerId;
@@ -279962,8 +280335,8 @@ ${this.formatConnectionInfo()}`);
279962
280335
  } catch {
279963
280336
  }
279964
280337
  try {
279965
- const invocDir = join63(nexusDir, "invocations");
279966
- if (existsSync48(invocDir)) {
280338
+ const invocDir = join64(nexusDir, "invocations");
280339
+ if (existsSync49(invocDir)) {
279967
280340
  const files = readdirSync10(invocDir);
279968
280341
  const invocCount = files.filter((f2) => f2.endsWith(".json")).length;
279969
280342
  if (invocCount > this._stats.totalRequests) {
@@ -279974,8 +280347,8 @@ ${this.formatConnectionInfo()}`);
279974
280347
  } catch {
279975
280348
  }
279976
280349
  try {
279977
- const meteringFile = join63(nexusDir, "metering.jsonl");
279978
- if (existsSync48(meteringFile)) {
280350
+ const meteringFile = join64(nexusDir, "metering.jsonl");
280351
+ if (existsSync49(meteringFile)) {
279979
280352
  const content = readFileSync35(meteringFile, "utf8");
279980
280353
  if (content.length > lastMeteringSize) {
279981
280354
  const newContent = content.slice(lastMeteringSize);
@@ -280187,7 +280560,7 @@ var init_types = __esm({
280187
280560
 
280188
280561
  // packages/cli/src/tui/p2p/secret-vault.ts
280189
280562
  import { createCipheriv as createCipheriv2, createDecipheriv as createDecipheriv2, randomBytes as randomBytes16, scryptSync as scryptSync2, createHash as createHash4 } from "node:crypto";
280190
- import { readFileSync as readFileSync36, writeFileSync as writeFileSync22, existsSync as existsSync49, mkdirSync as mkdirSync23 } from "node:fs";
280563
+ import { readFileSync as readFileSync36, writeFileSync as writeFileSync22, existsSync as existsSync50, mkdirSync as mkdirSync24 } from "node:fs";
280191
280564
  import { dirname as dirname17 } from "node:path";
280192
280565
  var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
280193
280566
  var init_secret_vault = __esm({
@@ -280395,7 +280768,7 @@ var init_secret_vault = __esm({
280395
280768
  const tag = cipher.getAuthTag();
280396
280769
  const blob = Buffer.concat([salt, iv, tag, encrypted]);
280397
280770
  const dir = dirname17(this.storePath);
280398
- if (!existsSync49(dir)) mkdirSync23(dir, { recursive: true });
280771
+ if (!existsSync50(dir)) mkdirSync24(dir, { recursive: true });
280399
280772
  writeFileSync22(this.storePath, blob, { mode: 384 });
280400
280773
  }
280401
280774
  /**
@@ -280403,7 +280776,7 @@ var init_secret_vault = __esm({
280403
280776
  * Returns the number of secrets loaded.
280404
280777
  */
280405
280778
  load(passphrase) {
280406
- if (!this.storePath || !existsSync49(this.storePath)) return 0;
280779
+ if (!this.storePath || !existsSync50(this.storePath)) return 0;
280407
280780
  const blob = readFileSync36(this.storePath);
280408
280781
  if (blob.length < SALT_LEN + IV_LEN + 16) {
280409
280782
  throw new Error("Vault file is corrupted (too small)");
@@ -281557,23 +281930,23 @@ async function fetchOpenAIModels(baseUrl, apiKey) {
281557
281930
  async function fetchPeerModels(peerId, authKey) {
281558
281931
  try {
281559
281932
  const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports));
281560
- const { existsSync: existsSync77, readFileSync: readFileSync60 } = await import("node:fs");
281561
- const { join: join96 } = await import("node:path");
281933
+ const { existsSync: existsSync78, readFileSync: readFileSync60 } = await import("node:fs");
281934
+ const { join: join97 } = await import("node:path");
281562
281935
  const cwd4 = process.cwd();
281563
281936
  const nexusTool = new NexusTool2(cwd4);
281564
281937
  const nexusDir = nexusTool.getNexusDir();
281565
281938
  let isLocalPeer = false;
281566
281939
  try {
281567
- const statusPath = join96(nexusDir, "status.json");
281568
- if (existsSync77(statusPath)) {
281940
+ const statusPath = join97(nexusDir, "status.json");
281941
+ if (existsSync78(statusPath)) {
281569
281942
  const status = JSON.parse(readFileSync60(statusPath, "utf8"));
281570
281943
  if (status.peerId === peerId) isLocalPeer = true;
281571
281944
  }
281572
281945
  } catch {
281573
281946
  }
281574
281947
  if (isLocalPeer) {
281575
- const pricingPath = join96(nexusDir, "pricing.json");
281576
- if (existsSync77(pricingPath)) {
281948
+ const pricingPath = join97(nexusDir, "pricing.json");
281949
+ if (existsSync78(pricingPath)) {
281577
281950
  try {
281578
281951
  const pricing = JSON.parse(readFileSync60(pricingPath, "utf8"));
281579
281952
  const localModels = (pricing.models || []).map((m2) => ({
@@ -281588,8 +281961,8 @@ async function fetchPeerModels(peerId, authKey) {
281588
281961
  }
281589
281962
  }
281590
281963
  }
281591
- const cachePath = join96(nexusDir, "peer-models-cache.json");
281592
- if (existsSync77(cachePath)) {
281964
+ const cachePath = join97(nexusDir, "peer-models-cache.json");
281965
+ if (existsSync78(cachePath)) {
281593
281966
  try {
281594
281967
  const cache7 = JSON.parse(readFileSync60(cachePath, "utf8"));
281595
281968
  if (cache7.peerId === peerId && cache7.models?.length > 0) {
@@ -281703,8 +282076,8 @@ async function fetchPeerModels(peerId, authKey) {
281703
282076
  } catch {
281704
282077
  }
281705
282078
  if (isLocalPeer) {
281706
- const pricingPath = join96(nexusDir, "pricing.json");
281707
- if (existsSync77(pricingPath)) {
282079
+ const pricingPath = join97(nexusDir, "pricing.json");
282080
+ if (existsSync78(pricingPath)) {
281708
282081
  try {
281709
282082
  const pricing = JSON.parse(readFileSync60(pricingPath, "utf8"));
281710
282083
  return (pricing.models || []).map((m2) => ({
@@ -281962,14 +282335,14 @@ var init_render2 = __esm({
281962
282335
  });
281963
282336
 
281964
282337
  // packages/prompts/dist/promptLoader.js
281965
- import { readFileSync as readFileSync37, existsSync as existsSync50 } from "node:fs";
281966
- import { join as join65, dirname as dirname18 } from "node:path";
282338
+ import { readFileSync as readFileSync37, existsSync as existsSync51 } from "node:fs";
282339
+ import { join as join66, dirname as dirname18 } from "node:path";
281967
282340
  import { fileURLToPath as fileURLToPath10 } from "node:url";
281968
282341
  function loadPrompt2(promptPath, vars) {
281969
282342
  let content = cache5.get(promptPath);
281970
282343
  if (content === void 0) {
281971
- const fullPath = join65(PROMPTS_DIR2, promptPath);
281972
- if (!existsSync50(fullPath)) {
282344
+ const fullPath = join66(PROMPTS_DIR2, promptPath);
282345
+ if (!existsSync51(fullPath)) {
281973
282346
  throw new Error(`Prompt file not found: ${fullPath}`);
281974
282347
  }
281975
282348
  content = readFileSync37(fullPath, "utf-8");
@@ -281985,9 +282358,9 @@ var init_promptLoader2 = __esm({
281985
282358
  "use strict";
281986
282359
  __filename4 = fileURLToPath10(import.meta.url);
281987
282360
  __dirname6 = dirname18(__filename4);
281988
- devPath = join65(__dirname6, "..", "templates");
281989
- publishedPath = join65(__dirname6, "..", "prompts", "templates");
281990
- PROMPTS_DIR2 = existsSync50(devPath) ? devPath : publishedPath;
282361
+ devPath = join66(__dirname6, "..", "templates");
282362
+ publishedPath = join66(__dirname6, "..", "prompts", "templates");
282363
+ PROMPTS_DIR2 = existsSync51(devPath) ? devPath : publishedPath;
281991
282364
  cache5 = /* @__PURE__ */ new Map();
281992
282365
  }
281993
282366
  });
@@ -282098,7 +282471,7 @@ var init_task_templates = __esm({
282098
282471
  });
282099
282472
 
282100
282473
  // packages/prompts/dist/index.js
282101
- import { join as join66, dirname as dirname19 } from "node:path";
282474
+ import { join as join67, dirname as dirname19 } from "node:path";
282102
282475
  import { fileURLToPath as fileURLToPath11 } from "node:url";
282103
282476
  var _dir, _packageRoot;
282104
282477
  var init_dist9 = __esm({
@@ -282109,7 +282482,7 @@ var init_dist9 = __esm({
282109
282482
  init_task_templates();
282110
282483
  init_render2();
282111
282484
  _dir = dirname19(fileURLToPath11(import.meta.url));
282112
- _packageRoot = join66(_dir, "..");
282485
+ _packageRoot = join67(_dir, "..");
282113
282486
  }
282114
282487
  });
282115
282488
 
@@ -282146,18 +282519,18 @@ __export(oa_directory_exports, {
282146
282519
  writeIndexData: () => writeIndexData,
282147
282520
  writeIndexMeta: () => writeIndexMeta
282148
282521
  });
282149
- import { existsSync as existsSync51, mkdirSync as mkdirSync24, readFileSync as readFileSync38, writeFileSync as writeFileSync23, readdirSync as readdirSync11, statSync as statSync16, unlinkSync as unlinkSync11 } from "node:fs";
282150
- import { join as join67, relative as relative4, basename as basename12 } from "node:path";
282522
+ import { existsSync as existsSync52, mkdirSync as mkdirSync25, readFileSync as readFileSync38, writeFileSync as writeFileSync23, readdirSync as readdirSync11, statSync as statSync16, unlinkSync as unlinkSync11 } from "node:fs";
282523
+ import { join as join68, relative as relative4, basename as basename12 } from "node:path";
282151
282524
  import { homedir as homedir19 } from "node:os";
282152
282525
  function initOaDirectory(repoRoot) {
282153
- const oaPath = join67(repoRoot, OA_DIR);
282526
+ const oaPath = join68(repoRoot, OA_DIR);
282154
282527
  for (const sub of SUBDIRS) {
282155
- mkdirSync24(join67(oaPath, sub), { recursive: true });
282528
+ mkdirSync25(join68(oaPath, sub), { recursive: true });
282156
282529
  }
282157
282530
  try {
282158
- const gitignorePath = join67(repoRoot, ".gitignore");
282531
+ const gitignorePath = join68(repoRoot, ".gitignore");
282159
282532
  const settingsPattern = ".oa/settings.json";
282160
- if (existsSync51(gitignorePath)) {
282533
+ if (existsSync52(gitignorePath)) {
282161
282534
  const content = readFileSync38(gitignorePath, "utf-8");
282162
282535
  if (!content.includes(settingsPattern)) {
282163
282536
  writeFileSync23(gitignorePath, content.trimEnd() + "\n" + settingsPattern + "\n", "utf-8");
@@ -282168,12 +282541,12 @@ function initOaDirectory(repoRoot) {
282168
282541
  return oaPath;
282169
282542
  }
282170
282543
  function hasOaDirectory(repoRoot) {
282171
- return existsSync51(join67(repoRoot, OA_DIR, "index"));
282544
+ return existsSync52(join68(repoRoot, OA_DIR, "index"));
282172
282545
  }
282173
282546
  function loadProjectSettings(repoRoot) {
282174
- const settingsPath = join67(repoRoot, OA_DIR, "settings.json");
282547
+ const settingsPath = join68(repoRoot, OA_DIR, "settings.json");
282175
282548
  try {
282176
- if (existsSync51(settingsPath)) {
282549
+ if (existsSync52(settingsPath)) {
282177
282550
  return JSON.parse(readFileSync38(settingsPath, "utf-8"));
282178
282551
  }
282179
282552
  } catch {
@@ -282181,16 +282554,16 @@ function loadProjectSettings(repoRoot) {
282181
282554
  return {};
282182
282555
  }
282183
282556
  function saveProjectSettings(repoRoot, settings) {
282184
- const oaPath = join67(repoRoot, OA_DIR);
282185
- mkdirSync24(oaPath, { recursive: true });
282557
+ const oaPath = join68(repoRoot, OA_DIR);
282558
+ mkdirSync25(oaPath, { recursive: true });
282186
282559
  const existing = loadProjectSettings(repoRoot);
282187
282560
  const merged = { ...existing, ...settings };
282188
- writeFileSync23(join67(oaPath, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
282561
+ writeFileSync23(join68(oaPath, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
282189
282562
  }
282190
282563
  function loadGlobalSettings() {
282191
- const settingsPath = join67(homedir19(), ".open-agents", "settings.json");
282564
+ const settingsPath = join68(homedir19(), ".open-agents", "settings.json");
282192
282565
  try {
282193
- if (existsSync51(settingsPath)) {
282566
+ if (existsSync52(settingsPath)) {
282194
282567
  return JSON.parse(readFileSync38(settingsPath, "utf-8"));
282195
282568
  }
282196
282569
  } catch {
@@ -282198,11 +282571,11 @@ function loadGlobalSettings() {
282198
282571
  return {};
282199
282572
  }
282200
282573
  function saveGlobalSettings(settings) {
282201
- const dir = join67(homedir19(), ".open-agents");
282202
- mkdirSync24(dir, { recursive: true });
282574
+ const dir = join68(homedir19(), ".open-agents");
282575
+ mkdirSync25(dir, { recursive: true });
282203
282576
  const existing = loadGlobalSettings();
282204
282577
  const merged = { ...existing, ...settings };
282205
- writeFileSync23(join67(dir, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
282578
+ writeFileSync23(join68(dir, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
282206
282579
  }
282207
282580
  function resolveSettings(repoRoot) {
282208
282581
  const global2 = loadGlobalSettings();
@@ -282217,9 +282590,9 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
282217
282590
  while (dir && !visited.has(dir)) {
282218
282591
  visited.add(dir);
282219
282592
  for (const name10 of CONTEXT_FILES) {
282220
- const filePath = join67(dir, name10);
282593
+ const filePath = join68(dir, name10);
282221
282594
  const normalizedName = name10.toLowerCase();
282222
- if (existsSync51(filePath) && !seen.has(filePath)) {
282595
+ if (existsSync52(filePath) && !seen.has(filePath)) {
282223
282596
  seen.add(filePath);
282224
282597
  try {
282225
282598
  let content = readFileSync38(filePath, "utf-8");
@@ -282236,8 +282609,8 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
282236
282609
  }
282237
282610
  }
282238
282611
  }
282239
- const projectMap = join67(dir, OA_DIR, "context", "project-map.md");
282240
- if (existsSync51(projectMap) && !seen.has(projectMap)) {
282612
+ const projectMap = join68(dir, OA_DIR, "context", "project-map.md");
282613
+ if (existsSync52(projectMap) && !seen.has(projectMap)) {
282241
282614
  seen.add(projectMap);
282242
282615
  try {
282243
282616
  let content = readFileSync38(projectMap, "utf-8");
@@ -282252,7 +282625,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
282252
282625
  } catch {
282253
282626
  }
282254
282627
  }
282255
- const parent = join67(dir, "..");
282628
+ const parent = join68(dir, "..");
282256
282629
  if (parent === dir) break;
282257
282630
  dir = parent;
282258
282631
  }
@@ -282269,7 +282642,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
282269
282642
  return found;
282270
282643
  }
282271
282644
  function readIndexMeta(repoRoot) {
282272
- const metaPath = join67(repoRoot, OA_DIR, "index", "meta.json");
282645
+ const metaPath = join68(repoRoot, OA_DIR, "index", "meta.json");
282273
282646
  try {
282274
282647
  return JSON.parse(readFileSync38(metaPath, "utf-8"));
282275
282648
  } catch {
@@ -282277,12 +282650,12 @@ function readIndexMeta(repoRoot) {
282277
282650
  }
282278
282651
  }
282279
282652
  function writeIndexMeta(repoRoot, meta) {
282280
- const metaPath = join67(repoRoot, OA_DIR, "index", "meta.json");
282281
- mkdirSync24(join67(repoRoot, OA_DIR, "index"), { recursive: true });
282653
+ const metaPath = join68(repoRoot, OA_DIR, "index", "meta.json");
282654
+ mkdirSync25(join68(repoRoot, OA_DIR, "index"), { recursive: true });
282282
282655
  writeFileSync23(metaPath, JSON.stringify(meta, null, 2), "utf-8");
282283
282656
  }
282284
282657
  function readIndexData(repoRoot, filename) {
282285
- const filePath = join67(repoRoot, OA_DIR, "index", filename);
282658
+ const filePath = join68(repoRoot, OA_DIR, "index", filename);
282286
282659
  try {
282287
282660
  return JSON.parse(readFileSync38(filePath, "utf-8"));
282288
282661
  } catch {
@@ -282290,8 +282663,8 @@ function readIndexData(repoRoot, filename) {
282290
282663
  }
282291
282664
  }
282292
282665
  function writeIndexData(repoRoot, filename, data) {
282293
- const filePath = join67(repoRoot, OA_DIR, "index", filename);
282294
- mkdirSync24(join67(repoRoot, OA_DIR, "index"), { recursive: true });
282666
+ const filePath = join68(repoRoot, OA_DIR, "index", filename);
282667
+ mkdirSync25(join68(repoRoot, OA_DIR, "index"), { recursive: true });
282295
282668
  writeFileSync23(filePath, JSON.stringify(data, null, 2), "utf-8");
282296
282669
  }
282297
282670
  function generateProjectMap(repoRoot) {
@@ -282339,31 +282712,31 @@ ${tree2}\`\`\`
282339
282712
  sections.push("");
282340
282713
  }
282341
282714
  const content = sections.join("\n");
282342
- const contextDir = join67(repoRoot, OA_DIR, "context");
282343
- mkdirSync24(contextDir, { recursive: true });
282344
- writeFileSync23(join67(contextDir, "project-map.md"), content, "utf-8");
282715
+ const contextDir = join68(repoRoot, OA_DIR, "context");
282716
+ mkdirSync25(contextDir, { recursive: true });
282717
+ writeFileSync23(join68(contextDir, "project-map.md"), content, "utf-8");
282345
282718
  return content;
282346
282719
  }
282347
282720
  function saveSession(repoRoot, session) {
282348
- const historyDir = join67(repoRoot, OA_DIR, "history");
282349
- mkdirSync24(historyDir, { recursive: true });
282721
+ const historyDir = join68(repoRoot, OA_DIR, "history");
282722
+ mkdirSync25(historyDir, { recursive: true });
282350
282723
  writeFileSync23(
282351
- join67(historyDir, `${session.id}.json`),
282724
+ join68(historyDir, `${session.id}.json`),
282352
282725
  JSON.stringify(session, null, 2),
282353
282726
  "utf-8"
282354
282727
  );
282355
282728
  }
282356
282729
  function loadRecentSessions(repoRoot, limit = 5) {
282357
- const historyDir = join67(repoRoot, OA_DIR, "history");
282358
- if (!existsSync51(historyDir)) return [];
282730
+ const historyDir = join68(repoRoot, OA_DIR, "history");
282731
+ if (!existsSync52(historyDir)) return [];
282359
282732
  try {
282360
282733
  const files = readdirSync11(historyDir).filter((f2) => f2.endsWith(".json") && f2 !== "pending-task.json").map((f2) => {
282361
- const stat6 = statSync16(join67(historyDir, f2));
282734
+ const stat6 = statSync16(join68(historyDir, f2));
282362
282735
  return { file: f2, mtime: stat6.mtimeMs };
282363
282736
  }).sort((a2, b) => b.mtime - a2.mtime).slice(0, limit);
282364
282737
  return files.map((f2) => {
282365
282738
  try {
282366
- return JSON.parse(readFileSync38(join67(historyDir, f2.file), "utf-8"));
282739
+ return JSON.parse(readFileSync38(join68(historyDir, f2.file), "utf-8"));
282367
282740
  } catch {
282368
282741
  return null;
282369
282742
  }
@@ -282375,18 +282748,18 @@ function loadRecentSessions(repoRoot, limit = 5) {
282375
282748
  }
282376
282749
  }
282377
282750
  function savePendingTask(repoRoot, task) {
282378
- const historyDir = join67(repoRoot, OA_DIR, "history");
282379
- mkdirSync24(historyDir, { recursive: true });
282751
+ const historyDir = join68(repoRoot, OA_DIR, "history");
282752
+ mkdirSync25(historyDir, { recursive: true });
282380
282753
  writeFileSync23(
282381
- join67(historyDir, PENDING_TASK_FILE),
282754
+ join68(historyDir, PENDING_TASK_FILE),
282382
282755
  JSON.stringify(task, null, 2) + "\n",
282383
282756
  "utf-8"
282384
282757
  );
282385
282758
  }
282386
282759
  function loadPendingTask(repoRoot) {
282387
- const filePath = join67(repoRoot, OA_DIR, "history", PENDING_TASK_FILE);
282760
+ const filePath = join68(repoRoot, OA_DIR, "history", PENDING_TASK_FILE);
282388
282761
  try {
282389
- if (!existsSync51(filePath)) return null;
282762
+ if (!existsSync52(filePath)) return null;
282390
282763
  const data = JSON.parse(readFileSync38(filePath, "utf-8"));
282391
282764
  try {
282392
282765
  unlinkSync11(filePath);
@@ -282398,12 +282771,12 @@ function loadPendingTask(repoRoot) {
282398
282771
  }
282399
282772
  }
282400
282773
  function saveSessionContext(repoRoot, entry) {
282401
- const contextDir = join67(repoRoot, OA_DIR, "context");
282402
- mkdirSync24(contextDir, { recursive: true });
282403
- const filePath = join67(contextDir, CONTEXT_SAVE_FILE);
282774
+ const contextDir = join68(repoRoot, OA_DIR, "context");
282775
+ mkdirSync25(contextDir, { recursive: true });
282776
+ const filePath = join68(contextDir, CONTEXT_SAVE_FILE);
282404
282777
  let ctx3;
282405
282778
  try {
282406
- if (existsSync51(filePath)) {
282779
+ if (existsSync52(filePath)) {
282407
282780
  ctx3 = JSON.parse(readFileSync38(filePath, "utf-8"));
282408
282781
  } else {
282409
282782
  ctx3 = { entries: [], maxEntries: MAX_CONTEXT_ENTRIES, updatedAt: "" };
@@ -282430,14 +282803,14 @@ function saveSessionContext(repoRoot, entry) {
282430
282803
  if (e2.summary) diaryLines.push(`Summary: ${e2.summary.slice(0, 200)}`);
282431
282804
  diaryLines.push("");
282432
282805
  }
282433
- writeFileSync23(join67(contextDir, "session-diary.md"), diaryLines.join("\n"), "utf-8");
282806
+ writeFileSync23(join68(contextDir, "session-diary.md"), diaryLines.join("\n"), "utf-8");
282434
282807
  } catch {
282435
282808
  }
282436
282809
  }
282437
282810
  function loadSessionContext(repoRoot) {
282438
- const filePath = join67(repoRoot, OA_DIR, "context", CONTEXT_SAVE_FILE);
282811
+ const filePath = join68(repoRoot, OA_DIR, "context", CONTEXT_SAVE_FILE);
282439
282812
  try {
282440
- if (!existsSync51(filePath)) return null;
282813
+ if (!existsSync52(filePath)) return null;
282441
282814
  return JSON.parse(readFileSync38(filePath, "utf-8"));
282442
282815
  } catch {
282443
282816
  return null;
@@ -282465,19 +282838,19 @@ function getLastTaskSummary(repoRoot) {
282465
282838
  return clean3.length > 40 ? clean3.slice(0, 37) + "..." : clean3;
282466
282839
  }
282467
282840
  function saveSessionHistory(repoRoot, sessionId, contentLines, meta) {
282468
- const sessDir = join67(repoRoot, OA_DIR, SESSIONS_DIR);
282469
- mkdirSync24(sessDir, { recursive: true });
282841
+ const sessDir = join68(repoRoot, OA_DIR, SESSIONS_DIR);
282842
+ mkdirSync25(sessDir, { recursive: true });
282470
282843
  const stripped = contentLines.map(
282471
282844
  (line) => typeof line === "string" ? line.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, "") : ""
282472
282845
  );
282473
282846
  const autoName = meta.name || generateSessionName(stripped);
282474
282847
  const autoDesc = meta.description || generateSessionDescription(stripped);
282475
- const contentPath = join67(sessDir, `${sessionId}.jsonl`);
282848
+ const contentPath = join68(sessDir, `${sessionId}.jsonl`);
282476
282849
  writeFileSync23(contentPath, stripped.join("\n"), "utf-8");
282477
- const indexPath = join67(sessDir, SESSIONS_INDEX);
282850
+ const indexPath = join68(sessDir, SESSIONS_INDEX);
282478
282851
  let index = [];
282479
282852
  try {
282480
- if (existsSync51(indexPath)) {
282853
+ if (existsSync52(indexPath)) {
282481
282854
  index = JSON.parse(readFileSync38(indexPath, "utf-8"));
282482
282855
  }
282483
282856
  } catch {
@@ -282500,16 +282873,16 @@ function saveSessionHistory(repoRoot, sessionId, contentLines, meta) {
282500
282873
  if (index.length > 50) {
282501
282874
  const removed = index.shift();
282502
282875
  try {
282503
- unlinkSync11(join67(sessDir, `${removed.id}.jsonl`));
282876
+ unlinkSync11(join68(sessDir, `${removed.id}.jsonl`));
282504
282877
  } catch {
282505
282878
  }
282506
282879
  }
282507
282880
  writeFileSync23(indexPath, JSON.stringify(index, null, 2), "utf-8");
282508
282881
  }
282509
282882
  function listSessions(repoRoot) {
282510
- const indexPath = join67(repoRoot, OA_DIR, SESSIONS_DIR, SESSIONS_INDEX);
282883
+ const indexPath = join68(repoRoot, OA_DIR, SESSIONS_DIR, SESSIONS_INDEX);
282511
282884
  try {
282512
- if (!existsSync51(indexPath)) return [];
282885
+ if (!existsSync52(indexPath)) return [];
282513
282886
  const index = JSON.parse(readFileSync38(indexPath, "utf-8"));
282514
282887
  return index.sort((a2, b) => b.updatedAt.localeCompare(a2.updatedAt));
282515
282888
  } catch {
@@ -282517,21 +282890,21 @@ function listSessions(repoRoot) {
282517
282890
  }
282518
282891
  }
282519
282892
  function loadSessionHistory(repoRoot, sessionId) {
282520
- const contentPath = join67(repoRoot, OA_DIR, SESSIONS_DIR, `${sessionId}.jsonl`);
282893
+ const contentPath = join68(repoRoot, OA_DIR, SESSIONS_DIR, `${sessionId}.jsonl`);
282521
282894
  try {
282522
- if (!existsSync51(contentPath)) return null;
282895
+ if (!existsSync52(contentPath)) return null;
282523
282896
  return readFileSync38(contentPath, "utf-8").split("\n");
282524
282897
  } catch {
282525
282898
  return null;
282526
282899
  }
282527
282900
  }
282528
282901
  function deleteSession(repoRoot, sessionId) {
282529
- const sessDir = join67(repoRoot, OA_DIR, SESSIONS_DIR);
282530
- const indexPath = join67(sessDir, SESSIONS_INDEX);
282902
+ const sessDir = join68(repoRoot, OA_DIR, SESSIONS_DIR);
282903
+ const indexPath = join68(sessDir, SESSIONS_INDEX);
282531
282904
  try {
282532
- const contentPath = join67(sessDir, `${sessionId}.jsonl`);
282533
- if (existsSync51(contentPath)) unlinkSync11(contentPath);
282534
- if (existsSync51(indexPath)) {
282905
+ const contentPath = join68(sessDir, `${sessionId}.jsonl`);
282906
+ if (existsSync52(contentPath)) unlinkSync11(contentPath);
282907
+ if (existsSync52(indexPath)) {
282535
282908
  let index = JSON.parse(readFileSync38(indexPath, "utf-8"));
282536
282909
  index = index.filter((s2) => s2.id !== sessionId);
282537
282910
  writeFileSync23(indexPath, JSON.stringify(index, null, 2), "utf-8");
@@ -282585,8 +282958,8 @@ function detectManifests(repoRoot) {
282585
282958
  { file: "docker-compose.yaml", type: "Docker Compose" }
282586
282959
  ];
282587
282960
  for (const check of checks) {
282588
- const filePath = join67(repoRoot, check.file);
282589
- if (existsSync51(filePath)) {
282961
+ const filePath = join68(repoRoot, check.file);
282962
+ if (existsSync52(filePath)) {
282590
282963
  let name10;
282591
282964
  if (check.nameField) {
282592
282965
  try {
@@ -282619,7 +282992,7 @@ function findKeyFiles(repoRoot) {
282619
282992
  { pattern: "CLAUDE.md", description: "Claude Code context" }
282620
282993
  ];
282621
282994
  for (const check of checks) {
282622
- if (existsSync51(join67(repoRoot, check.pattern))) {
282995
+ if (existsSync52(join68(repoRoot, check.pattern))) {
282623
282996
  keyFiles.push({ path: check.pattern, description: check.description });
282624
282997
  }
282625
282998
  }
@@ -282642,12 +283015,12 @@ function buildDirTree(root, maxDepth, prefix = "", depth = 0) {
282642
283015
  if (entry.isDirectory()) {
282643
283016
  let fileCount = 0;
282644
283017
  try {
282645
- fileCount = readdirSync11(join67(root, entry.name)).filter((f2) => !f2.startsWith(".")).length;
283018
+ fileCount = readdirSync11(join68(root, entry.name)).filter((f2) => !f2.startsWith(".")).length;
282646
283019
  } catch {
282647
283020
  }
282648
283021
  result += `${prefix}${connector}${entry.name}/ (${fileCount})
282649
283022
  `;
282650
- result += buildDirTree(join67(root, entry.name), maxDepth, childPrefix, depth + 1);
283023
+ result += buildDirTree(join68(root, entry.name), maxDepth, childPrefix, depth + 1);
282651
283024
  } else if (depth < maxDepth) {
282652
283025
  result += `${prefix}${connector}${entry.name}
282653
283026
  `;
@@ -282659,7 +283032,7 @@ function buildDirTree(root, maxDepth, prefix = "", depth = 0) {
282659
283032
  }
282660
283033
  function loadUsageFile(filePath) {
282661
283034
  try {
282662
- if (existsSync51(filePath)) {
283035
+ if (existsSync52(filePath)) {
282663
283036
  return JSON.parse(readFileSync38(filePath, "utf-8"));
282664
283037
  }
282665
283038
  } catch {
@@ -282667,8 +283040,8 @@ function loadUsageFile(filePath) {
282667
283040
  return { records: [] };
282668
283041
  }
282669
283042
  function saveUsageFile(filePath, data) {
282670
- const dir = join67(filePath, "..");
282671
- mkdirSync24(dir, { recursive: true });
283043
+ const dir = join68(filePath, "..");
283044
+ mkdirSync25(dir, { recursive: true });
282672
283045
  writeFileSync23(filePath, JSON.stringify(data, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
282673
283046
  }
282674
283047
  function recordUsage(kind, value2, opts) {
@@ -282696,15 +283069,15 @@ function recordUsage(kind, value2, opts) {
282696
283069
  }
282697
283070
  saveUsageFile(filePath, data);
282698
283071
  };
282699
- update2(join67(homedir19(), ".open-agents", USAGE_HISTORY_FILE));
283072
+ update2(join68(homedir19(), ".open-agents", USAGE_HISTORY_FILE));
282700
283073
  if (opts?.repoRoot) {
282701
- update2(join67(opts.repoRoot, OA_DIR, USAGE_HISTORY_FILE));
283074
+ update2(join68(opts.repoRoot, OA_DIR, USAGE_HISTORY_FILE));
282702
283075
  }
282703
283076
  }
282704
283077
  function loadUsageHistory(kind, repoRoot) {
282705
- const globalPath = join67(homedir19(), ".open-agents", USAGE_HISTORY_FILE);
283078
+ const globalPath = join68(homedir19(), ".open-agents", USAGE_HISTORY_FILE);
282706
283079
  const globalData = loadUsageFile(globalPath);
282707
- const localData = repoRoot ? loadUsageFile(join67(repoRoot, OA_DIR, USAGE_HISTORY_FILE)) : { records: [] };
283080
+ const localData = repoRoot ? loadUsageFile(join68(repoRoot, OA_DIR, USAGE_HISTORY_FILE)) : { records: [] };
282708
283081
  const map2 = /* @__PURE__ */ new Map();
282709
283082
  for (const r2 of globalData.records) {
282710
283083
  if (r2.kind !== kind) continue;
@@ -282733,9 +283106,9 @@ function deleteUsageRecord(kind, value2, repoRoot) {
282733
283106
  saveUsageFile(filePath, data);
282734
283107
  }
282735
283108
  };
282736
- remove(join67(homedir19(), ".open-agents", USAGE_HISTORY_FILE));
283109
+ remove(join68(homedir19(), ".open-agents", USAGE_HISTORY_FILE));
282737
283110
  if (repoRoot) {
282738
- remove(join67(repoRoot, OA_DIR, USAGE_HISTORY_FILE));
283111
+ remove(join68(repoRoot, OA_DIR, USAGE_HISTORY_FILE));
282739
283112
  }
282740
283113
  }
282741
283114
  var OA_DIR, SUBDIRS, CONTEXT_FILES, PENDING_TASK_FILE, CONTEXT_SAVE_FILE, MAX_CONTEXT_ENTRIES, SESSIONS_DIR, SESSIONS_INDEX, SKIP_DIRS, USAGE_HISTORY_FILE, MAX_HISTORY_RECORDS;
@@ -287287,8 +287660,8 @@ __export(personaplex_exports, {
287287
287660
  startPersonaPlexDaemon: () => startPersonaPlexDaemon,
287288
287661
  stopPersonaPlex: () => stopPersonaPlex
287289
287662
  });
287290
- import { existsSync as existsSync52, writeFileSync as writeFileSync24, readFileSync as readFileSync40, mkdirSync as mkdirSync25, copyFileSync as copyFileSync2, readdirSync as readdirSync12, statSync as statSync17 } from "node:fs";
287291
- import { join as join68, dirname as dirname20 } from "node:path";
287663
+ import { existsSync as existsSync53, writeFileSync as writeFileSync24, readFileSync as readFileSync40, mkdirSync as mkdirSync26, copyFileSync as copyFileSync2, readdirSync as readdirSync12, statSync as statSync17 } from "node:fs";
287664
+ import { join as join69, dirname as dirname20 } from "node:path";
287292
287665
  import { homedir as homedir20 } from "node:os";
287293
287666
  import { execSync as execSync45, spawn as spawn20 } from "node:child_process";
287294
287667
  import { fileURLToPath as fileURLToPath12 } from "node:url";
@@ -287398,7 +287771,7 @@ function fileLink2(filePath, label) {
287398
287771
  return `\x1B]8;;${url}\x1B\\${text}\x1B]8;;\x1B\\`;
287399
287772
  }
287400
287773
  function isPersonaPlexRunning() {
287401
- if (!existsSync52(PID_FILE)) return false;
287774
+ if (!existsSync53(PID_FILE)) return false;
287402
287775
  const pid = parseInt(readFileSync40(PID_FILE, "utf8").trim(), 10);
287403
287776
  if (isNaN(pid) || pid <= 0) return false;
287404
287777
  try {
@@ -287410,17 +287783,17 @@ function isPersonaPlexRunning() {
287410
287783
  }
287411
287784
  function getPersonaPlexWSUrl() {
287412
287785
  if (!isPersonaPlexRunning()) return null;
287413
- if (!existsSync52(PORT_FILE)) return null;
287786
+ if (!existsSync53(PORT_FILE)) return null;
287414
287787
  const port = parseInt(readFileSync40(PORT_FILE, "utf8").trim(), 10);
287415
287788
  return isNaN(port) ? null : `wss://127.0.0.1:${port}`;
287416
287789
  }
287417
287790
  function isPersonaPlexInstalled() {
287418
- return existsSync52(join68(PERSONAPLEX_DIR, "model_ready"));
287791
+ return existsSync53(join69(PERSONAPLEX_DIR, "model_ready"));
287419
287792
  }
287420
287793
  function getWeightTier() {
287421
287794
  const detected = detectPersonaPlexCapability();
287422
- const tierFile = join68(PERSONAPLEX_DIR, "weight_tier");
287423
- if (existsSync52(tierFile)) {
287795
+ const tierFile = join69(PERSONAPLEX_DIR, "weight_tier");
287796
+ if (existsSync53(tierFile)) {
287424
287797
  const saved = readFileSync40(tierFile, "utf8").trim();
287425
287798
  if (saved in WEIGHT_REPOS) {
287426
287799
  const vram = detected.vramGB;
@@ -287439,7 +287812,7 @@ function getWeightRepoInfo(tier) {
287439
287812
  async function installPersonaPlex(onInfo, weightTier) {
287440
287813
  const log22 = onInfo ?? (() => {
287441
287814
  });
287442
- mkdirSync25(PERSONAPLEX_DIR, { recursive: true });
287815
+ mkdirSync26(PERSONAPLEX_DIR, { recursive: true });
287443
287816
  let arch2 = "";
287444
287817
  try {
287445
287818
  arch2 = execSync45("uname -m", { encoding: "utf8", timeout: 3e3, stdio: "pipe" }).trim();
@@ -287447,8 +287820,8 @@ async function installPersonaPlex(onInfo, weightTier) {
287447
287820
  }
287448
287821
  const isAarch64 = arch2 === "aarch64" || arch2 === "arm64";
287449
287822
  if (isAarch64) log22(`Detected ARM64 platform (${arch2}) \u2014 Jetson/ARM install path`);
287450
- const venvDir = join68(PERSONAPLEX_DIR, "venv");
287451
- if (!existsSync52(venvDir)) {
287823
+ const venvDir = join69(PERSONAPLEX_DIR, "venv");
287824
+ if (!existsSync53(venvDir)) {
287452
287825
  log22("Creating Python virtual environment...");
287453
287826
  try {
287454
287827
  const ssp = isAarch64 ? " --system-site-packages" : "";
@@ -287458,8 +287831,8 @@ async function installPersonaPlex(onInfo, weightTier) {
287458
287831
  return false;
287459
287832
  }
287460
287833
  }
287461
- const pip = process.platform === "win32" ? join68(venvDir, "Scripts", "pip.exe") : join68(venvDir, "bin", "pip");
287462
- const python = process.platform === "win32" ? join68(venvDir, "Scripts", "python.exe") : join68(venvDir, "bin", "python3");
287834
+ const pip = process.platform === "win32" ? join69(venvDir, "Scripts", "pip.exe") : join69(venvDir, "bin", "pip");
287835
+ const python = process.platform === "win32" ? join69(venvDir, "Scripts", "python.exe") : join69(venvDir, "bin", "python3");
287463
287836
  log22("Checking system dependencies (libopus)...");
287464
287837
  try {
287465
287838
  if (process.platform === "linux") {
@@ -287489,9 +287862,9 @@ async function installPersonaPlex(onInfo, weightTier) {
287489
287862
  }
287490
287863
  }
287491
287864
  log22("Installing PersonaPlex (moshi package)...");
287492
- const repoDir = join68(PERSONAPLEX_DIR, "personaplex-repo");
287865
+ const repoDir = join69(PERSONAPLEX_DIR, "personaplex-repo");
287493
287866
  try {
287494
- if (!existsSync52(repoDir)) {
287867
+ if (!existsSync53(repoDir)) {
287495
287868
  await execAsync(
287496
287869
  `git clone https://github.com/NVIDIA/personaplex.git "${repoDir}"`,
287497
287870
  { timeout: 12e4 }
@@ -287515,7 +287888,7 @@ async function installPersonaPlex(onInfo, weightTier) {
287515
287888
  if (isAarch64) {
287516
287889
  log22("ARM64: Installing moshi (--no-deps to preserve JetPack torch)...");
287517
287890
  await execAsync(
287518
- `"${pip}" install --quiet --no-deps "${join68(repoDir, "moshi")}/."`,
287891
+ `"${pip}" install --quiet --no-deps "${join69(repoDir, "moshi")}/."`,
287519
287892
  { timeout: 3e5 }
287520
287893
  );
287521
287894
  log22("ARM64: Installing remaining moshi dependencies...");
@@ -287525,7 +287898,7 @@ async function installPersonaPlex(onInfo, weightTier) {
287525
287898
  );
287526
287899
  } else {
287527
287900
  await execAsync(
287528
- `"${pip}" install --quiet "${join68(repoDir, "moshi")}/."`,
287901
+ `"${pip}" install --quiet "${join69(repoDir, "moshi")}/."`,
287529
287902
  { timeout: 6e5 }
287530
287903
  // 10 min — torch download is ~2.5GB
287531
287904
  );
@@ -287543,15 +287916,15 @@ async function installPersonaPlex(onInfo, weightTier) {
287543
287916
  }
287544
287917
  return false;
287545
287918
  }
287546
- const serverPy = join68(venvDir, "lib", `python3.${process.versions.node ? "12" : "10"}`, "site-packages", "moshi", "server.py");
287919
+ const serverPy = join69(venvDir, "lib", `python3.${process.versions.node ? "12" : "10"}`, "site-packages", "moshi", "server.py");
287547
287920
  try {
287548
287921
  const sitePackages = execSync45(`"${python}" -c "import moshi, os; print(os.path.dirname(moshi.__file__))"`, {
287549
287922
  encoding: "utf8",
287550
287923
  timeout: 5e3,
287551
287924
  stdio: "pipe"
287552
287925
  }).trim();
287553
- const serverFile = join68(sitePackages, "server.py");
287554
- if (existsSync52(serverFile)) {
287926
+ const serverFile = join69(sitePackages, "server.py");
287927
+ if (existsSync53(serverFile)) {
287555
287928
  let src2 = readFileSync40(serverFile, "utf8");
287556
287929
  if (src2.includes('int(request["seed"])')) {
287557
287930
  src2 = src2.replace('int(request["seed"])', 'int(request.query["seed"])');
@@ -287567,8 +287940,8 @@ async function installPersonaPlex(onInfo, weightTier) {
287567
287940
  timeout: 5e3,
287568
287941
  stdio: "pipe"
287569
287942
  }).trim();
287570
- const loadersFile = join68(sitePackages, "models", "loaders.py");
287571
- if (existsSync52(loadersFile)) {
287943
+ const loadersFile = join69(sitePackages, "models", "loaders.py");
287944
+ if (existsSync53(loadersFile)) {
287572
287945
  let src2 = readFileSync40(loadersFile, "utf8");
287573
287946
  if (!src2.includes("_dequantize_2bit_state_dict")) {
287574
287947
  const dequantPatch = `
@@ -287671,16 +288044,16 @@ $2if filename.endswith(".safetensors"):`
287671
288044
  timeout: 5e3,
287672
288045
  stdio: "pipe"
287673
288046
  }).trim();
287674
- const hybridDest = join68(sitePackages2, "hybrid_agent.py");
287675
- const serverDest = join68(sitePackages2, "server.py");
287676
- if (!existsSync52(hybridDest) || !readFileSync40(hybridDest, "utf8").includes("OA_API_BASE")) {
288047
+ const hybridDest = join69(sitePackages2, "hybrid_agent.py");
288048
+ const serverDest = join69(sitePackages2, "server.py");
288049
+ if (!existsSync53(hybridDest) || !readFileSync40(hybridDest, "utf8").includes("OA_API_BASE")) {
287677
288050
  log22("Deploying hybrid_agent.py (OA API integration)...");
287678
288051
  try {
287679
288052
  await execAsync(
287680
288053
  `curl -sL "https://raw.githubusercontent.com/robit-man/personaplex/main/personaplex-setup/moshi/moshi/hybrid_agent.py" -o "${hybridDest}"`,
287681
288054
  { timeout: 3e4 }
287682
288055
  );
287683
- if (existsSync52(hybridDest) && readFileSync40(hybridDest, "utf8").includes("OA_API_BASE")) {
288056
+ if (existsSync53(hybridDest) && readFileSync40(hybridDest, "utf8").includes("OA_API_BASE")) {
287684
288057
  log22("hybrid_agent.py deployed (OA API + Ollama fallback).");
287685
288058
  }
287686
288059
  } catch {
@@ -287757,7 +288130,7 @@ $2if filename.endswith(".safetensors"):`
287757
288130
  await execAsync(`"${python}" -c "from huggingface_hub import hf_hub_download; hf_hub_download('${nf4.repo}', '${nf4.file}', token=False)"`, {
287758
288131
  timeout: 6e5
287759
288132
  });
287760
- writeFileSync24(join68(PERSONAPLEX_DIR, "weight_tier"), "nf4");
288133
+ writeFileSync24(join69(PERSONAPLEX_DIR, "weight_tier"), "nf4");
287761
288134
  log22(`Downloaded INT4 weights instead (${nf4.sizeGB}GB, public).`);
287762
288135
  } catch {
287763
288136
  log22("Weight download failed.");
@@ -287769,8 +288142,8 @@ $2if filename.endswith(".safetensors"):`
287769
288142
  log22("Weights will download on first server launch.");
287770
288143
  }
287771
288144
  }
287772
- writeFileSync24(join68(PERSONAPLEX_DIR, "weight_tier"), tier);
287773
- writeFileSync24(join68(PERSONAPLEX_DIR, "model_ready"), (/* @__PURE__ */ new Date()).toISOString());
288145
+ writeFileSync24(join69(PERSONAPLEX_DIR, "weight_tier"), tier);
288146
+ writeFileSync24(join69(PERSONAPLEX_DIR, "model_ready"), (/* @__PURE__ */ new Date()).toISOString());
287774
288147
  log22(`PersonaPlex installed (${tier} tier). Use /call to start voice session.`);
287775
288148
  return true;
287776
288149
  }
@@ -287789,15 +288162,15 @@ async function startPersonaPlexDaemon(onInfo) {
287789
288162
  log22("PersonaPlex not installed. Run /voice personaplex to set up.");
287790
288163
  return null;
287791
288164
  }
287792
- mkdirSync25(PERSONAPLEX_DIR, { recursive: true });
287793
- const venvPython2 = process.platform === "win32" ? join68(PERSONAPLEX_DIR, "venv", "Scripts", "python.exe") : join68(PERSONAPLEX_DIR, "venv", "bin", "python3");
287794
- const sslDir = join68(PERSONAPLEX_DIR, "ssl");
287795
- mkdirSync25(sslDir, { recursive: true });
288165
+ mkdirSync26(PERSONAPLEX_DIR, { recursive: true });
288166
+ const venvPython2 = process.platform === "win32" ? join69(PERSONAPLEX_DIR, "venv", "Scripts", "python.exe") : join69(PERSONAPLEX_DIR, "venv", "bin", "python3");
288167
+ const sslDir = join69(PERSONAPLEX_DIR, "ssl");
288168
+ mkdirSync26(sslDir, { recursive: true });
287796
288169
  const tier = getWeightTier();
287797
288170
  const repoInfo = WEIGHT_REPOS[tier];
287798
288171
  const extraArgs = [];
287799
288172
  if (tier !== "original") {
287800
- const cachedBf16 = join68(PERSONAPLEX_DIR, "model-bf16-cache.safetensors");
288173
+ const cachedBf16 = join69(PERSONAPLEX_DIR, "model-bf16-cache.safetensors");
287801
288174
  if (tier === "nf4-distilled") {
287802
288175
  log22(`Weight tier: ${tier} \u2014 distilled NF4 (90% token match, ${repoInfo.sizeGB}GB)...`);
287803
288176
  try {
@@ -287805,8 +288178,8 @@ async function startPersonaPlexDaemon(onInfo) {
287805
288178
  `"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', '${repoInfo.file}', token=False))"`,
287806
288179
  { encoding: "utf8", timeout: 6e4, stdio: "pipe" }
287807
288180
  ).trim();
287808
- if (existsSync52(weightPath)) {
287809
- if (!existsSync52(cachedBf16)) {
288181
+ if (existsSync53(weightPath)) {
288182
+ if (!existsSync53(cachedBf16)) {
287810
288183
  log22("Converting .pt checkpoint to safetensors (one-time)...");
287811
288184
  execSync45(
287812
288185
  `"${venvPython2}" -c "
@@ -287819,7 +288192,7 @@ print('Converted')
287819
288192
  { timeout: 18e4, stdio: "pipe" }
287820
288193
  );
287821
288194
  }
287822
- if (existsSync52(cachedBf16)) {
288195
+ if (existsSync53(cachedBf16)) {
287823
288196
  extraArgs.push("--moshi-weight", cachedBf16);
287824
288197
  log22(`Using distilled weights: ${(statSync17(cachedBf16).size / 1024 ** 3).toFixed(1)}GB`);
287825
288198
  } else {
@@ -287831,12 +288204,12 @@ print('Converted')
287831
288204
  }
287832
288205
  } else {
287833
288206
  log22(`Weight tier: ${tier} (${repoInfo.sizeGB}GB) \u2014 dequantizing to bf16 cache...`);
287834
- const dequantScript = join68(PERSONAPLEX_DIR, "dequant-loader.py");
287835
- if (!existsSync52(dequantScript)) {
288207
+ const dequantScript = join69(PERSONAPLEX_DIR, "dequant-loader.py");
288208
+ if (!existsSync53(dequantScript)) {
287836
288209
  const shipped = getShippedVoicesDir();
287837
288210
  if (shipped) {
287838
- const src2 = join68(shipped, "dequant-loader.py");
287839
- if (existsSync52(src2)) copyFileSync2(src2, dequantScript);
288211
+ const src2 = join69(shipped, "dequant-loader.py");
288212
+ if (existsSync53(src2)) copyFileSync2(src2, dequantScript);
287840
288213
  }
287841
288214
  }
287842
288215
  try {
@@ -287844,13 +288217,13 @@ print('Converted')
287844
288217
  `"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', '${repoInfo.file}'${repoInfo.needsToken ? "" : ", token=False"}))"`,
287845
288218
  { encoding: "utf8", timeout: 3e4, stdio: "pipe" }
287846
288219
  ).trim();
287847
- if (existsSync52(dequantScript) && existsSync52(weightPath)) {
288220
+ if (existsSync53(dequantScript) && existsSync53(weightPath)) {
287848
288221
  try {
287849
288222
  execSync45(
287850
288223
  `"${venvPython2}" "${dequantScript}" --input "${weightPath}" --output "${cachedBf16}"`,
287851
288224
  { timeout: 3e5, stdio: "pipe" }
287852
288225
  );
287853
- if (existsSync52(cachedBf16)) {
288226
+ if (existsSync53(cachedBf16)) {
287854
288227
  extraArgs.push("--moshi-weight", cachedBf16);
287855
288228
  log22(`Using dequantized cache: ${(statSync17(cachedBf16).size / 1024 ** 3).toFixed(1)}GB`);
287856
288229
  }
@@ -287863,7 +288236,7 @@ print('Converted')
287863
288236
  `"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', 'tokenizer-e351c8d8-checkpoint125.safetensors', token=False))"`,
287864
288237
  { encoding: "utf8", timeout: 3e4, stdio: "pipe" }
287865
288238
  ).trim();
287866
- if (existsSync52(mimiPath)) extraArgs.push("--mimi-weight", mimiPath);
288239
+ if (existsSync53(mimiPath)) extraArgs.push("--mimi-weight", mimiPath);
287867
288240
  } catch {
287868
288241
  }
287869
288242
  try {
@@ -287871,7 +288244,7 @@ print('Converted')
287871
288244
  `"${venvPython2}" -c "from huggingface_hub import hf_hub_download; print(hf_hub_download('${repoInfo.repo}', 'tokenizer_spm_32k_3.model', token=False))"`,
287872
288245
  { encoding: "utf8", timeout: 3e4, stdio: "pipe" }
287873
288246
  ).trim();
287874
- if (existsSync52(tokPath)) extraArgs.push("--tokenizer", tokPath);
288247
+ if (existsSync53(tokPath)) extraArgs.push("--tokenizer", tokPath);
287875
288248
  } catch {
287876
288249
  }
287877
288250
  } catch {
@@ -287884,7 +288257,7 @@ print('Converted')
287884
288257
  let ollamaModel = process.env["HYBRID_LLM_MODEL"] || "";
287885
288258
  if (!ollamaModel) {
287886
288259
  try {
287887
- const oaConfig = JSON.parse(readFileSync40(join68(homedir20(), ".open-agents", "config.json"), "utf8"));
288260
+ const oaConfig = JSON.parse(readFileSync40(join69(homedir20(), ".open-agents", "config.json"), "utf8"));
287888
288261
  if (oaConfig.model) ollamaModel = oaConfig.model;
287889
288262
  } catch {
287890
288263
  }
@@ -287983,7 +288356,7 @@ print('Converted')
287983
288356
  return null;
287984
288357
  }
287985
288358
  function stopPersonaPlex() {
287986
- if (!existsSync52(PID_FILE)) return;
288359
+ if (!existsSync53(PID_FILE)) return;
287987
288360
  const pid = parseInt(readFileSync40(PID_FILE, "utf8").trim(), 10);
287988
288361
  if (isNaN(pid) || pid <= 0) return;
287989
288362
  try {
@@ -288020,12 +288393,12 @@ function listPersonaPlexVoices() {
288020
288393
  for (const name10 of builtins) {
288021
288394
  voices.push({ name: name10, type: "builtin", path: `${name10}.pt` });
288022
288395
  }
288023
- if (existsSync52(CUSTOM_VOICES_DIR)) {
288396
+ if (existsSync53(CUSTOM_VOICES_DIR)) {
288024
288397
  try {
288025
288398
  for (const f2 of readdirSync12(CUSTOM_VOICES_DIR)) {
288026
288399
  if (f2.endsWith(".pt")) {
288027
288400
  const name10 = f2.replace(/\.pt$/, "");
288028
- voices.push({ name: name10, type: "custom", path: join68(CUSTOM_VOICES_DIR, f2) });
288401
+ voices.push({ name: name10, type: "custom", path: join69(CUSTOM_VOICES_DIR, f2) });
288029
288402
  }
288030
288403
  }
288031
288404
  } catch {
@@ -288040,19 +288413,19 @@ async function clonePersonaPlexVoice(inputWav, voiceName, onInfo) {
288040
288413
  log22("PersonaPlex not installed. Run /voice personaplex first.");
288041
288414
  return null;
288042
288415
  }
288043
- if (!existsSync52(inputWav)) {
288416
+ if (!existsSync53(inputWav)) {
288044
288417
  log22(`Input WAV not found: ${inputWav}`);
288045
288418
  return null;
288046
288419
  }
288047
- mkdirSync25(CUSTOM_VOICES_DIR, { recursive: true });
288048
- const outputPt = join68(CUSTOM_VOICES_DIR, `${voiceName}.pt`);
288049
- if (existsSync52(outputPt)) {
288420
+ mkdirSync26(CUSTOM_VOICES_DIR, { recursive: true });
288421
+ const outputPt = join69(CUSTOM_VOICES_DIR, `${voiceName}.pt`);
288422
+ if (existsSync53(outputPt)) {
288050
288423
  log22(`Voice "${voiceName}" already exists. Delete ${outputPt} to re-clone.`);
288051
288424
  return outputPt;
288052
288425
  }
288053
- const venvPython2 = process.platform === "win32" ? join68(PERSONAPLEX_DIR, "venv", "Scripts", "python.exe") : join68(PERSONAPLEX_DIR, "venv", "bin", "python3");
288054
- const cloneScript = join68(PERSONAPLEX_DIR, "clone-voice.py");
288055
- if (!existsSync52(cloneScript)) {
288426
+ const venvPython2 = process.platform === "win32" ? join69(PERSONAPLEX_DIR, "venv", "Scripts", "python.exe") : join69(PERSONAPLEX_DIR, "venv", "bin", "python3");
288427
+ const cloneScript = join69(PERSONAPLEX_DIR, "clone-voice.py");
288428
+ if (!existsSync53(cloneScript)) {
288056
288429
  log22("clone-voice.py not found. Reinstall PersonaPlex.");
288057
288430
  return null;
288058
288431
  }
@@ -288084,7 +288457,7 @@ async function clonePersonaPlexVoice(inputWav, voiceName, onInfo) {
288084
288457
  output += d2.toString();
288085
288458
  });
288086
288459
  child.on("close", (code8) => {
288087
- if (code8 === 0 && existsSync52(outputPt)) {
288460
+ if (code8 === 0 && existsSync53(outputPt)) {
288088
288461
  log22(`Voice "${voiceName}" cloned successfully.`);
288089
288462
  resolve39(outputPt);
288090
288463
  } else {
@@ -288096,19 +288469,19 @@ async function clonePersonaPlexVoice(inputWav, voiceName, onInfo) {
288096
288469
  }
288097
288470
  function getShippedVoicesDir() {
288098
288471
  const candidates = [
288099
- join68(PERSONAPLEX_DIR, "shipped_voices"),
288472
+ join69(PERSONAPLEX_DIR, "shipped_voices"),
288100
288473
  // cached copy
288101
- join68(process.cwd(), "voices", "personaplex")
288474
+ join69(process.cwd(), "voices", "personaplex")
288102
288475
  // repo root
288103
288476
  ];
288104
288477
  try {
288105
288478
  const modDir = dirname20(fileURLToPath12(import.meta.url));
288106
- candidates.push(join68(modDir, "..", "..", "..", "voices", "personaplex"));
288107
- candidates.push(join68(modDir, "..", "..", "..", "..", "voices", "personaplex"));
288479
+ candidates.push(join69(modDir, "..", "..", "..", "voices", "personaplex"));
288480
+ candidates.push(join69(modDir, "..", "..", "..", "..", "voices", "personaplex"));
288108
288481
  } catch {
288109
288482
  }
288110
288483
  for (const dir of candidates) {
288111
- if (existsSync52(dir)) {
288484
+ if (existsSync53(dir)) {
288112
288485
  try {
288113
288486
  const files = readdirSync12(dir);
288114
288487
  if (files.some((f2) => f2.endsWith(".pt"))) return dir;
@@ -288124,19 +288497,19 @@ function provisionShippedVoices(onInfo) {
288124
288497
  const shippedDir = getShippedVoicesDir();
288125
288498
  if (!shippedDir) return 0;
288126
288499
  const hfVoicesDir = getHFVoicesDir();
288127
- mkdirSync25(CUSTOM_VOICES_DIR, { recursive: true });
288500
+ mkdirSync26(CUSTOM_VOICES_DIR, { recursive: true });
288128
288501
  let deployed = 0;
288129
288502
  try {
288130
288503
  for (const f2 of readdirSync12(shippedDir)) {
288131
288504
  if (!f2.endsWith(".pt")) continue;
288132
- const customDst = join68(CUSTOM_VOICES_DIR, f2);
288133
- if (!existsSync52(customDst)) {
288134
- copyFileSync2(join68(shippedDir, f2), customDst);
288505
+ const customDst = join69(CUSTOM_VOICES_DIR, f2);
288506
+ if (!existsSync53(customDst)) {
288507
+ copyFileSync2(join69(shippedDir, f2), customDst);
288135
288508
  }
288136
288509
  if (hfVoicesDir) {
288137
- const hfDst = join68(hfVoicesDir, f2);
288138
- if (!existsSync52(hfDst)) {
288139
- copyFileSync2(join68(shippedDir, f2), hfDst);
288510
+ const hfDst = join69(hfVoicesDir, f2);
288511
+ if (!existsSync53(hfDst)) {
288512
+ copyFileSync2(join69(shippedDir, f2), hfDst);
288140
288513
  log22(`Deployed voice: ${f2.replace(".pt", "")}`);
288141
288514
  deployed++;
288142
288515
  }
@@ -288144,9 +288517,9 @@ function provisionShippedVoices(onInfo) {
288144
288517
  }
288145
288518
  } catch {
288146
288519
  }
288147
- const shippedScript = join68(shippedDir, "clone-voice.py");
288148
- const targetScript = join68(PERSONAPLEX_DIR, "clone-voice.py");
288149
- if (existsSync52(shippedScript) && !existsSync52(targetScript)) {
288520
+ const shippedScript = join69(shippedDir, "clone-voice.py");
288521
+ const targetScript = join69(PERSONAPLEX_DIR, "clone-voice.py");
288522
+ if (existsSync53(shippedScript) && !existsSync53(targetScript)) {
288150
288523
  try {
288151
288524
  copyFileSync2(shippedScript, targetScript);
288152
288525
  } catch {
@@ -288155,14 +288528,14 @@ function provisionShippedVoices(onInfo) {
288155
288528
  return deployed;
288156
288529
  }
288157
288530
  function getHFVoicesDir() {
288158
- const hfBase = join68(homedir20(), ".cache", "huggingface", "hub", "models--nvidia--personaplex-7b-v1");
288159
- if (!existsSync52(hfBase)) return null;
288531
+ const hfBase = join69(homedir20(), ".cache", "huggingface", "hub", "models--nvidia--personaplex-7b-v1");
288532
+ if (!existsSync53(hfBase)) return null;
288160
288533
  try {
288161
- const snapshots = join68(hfBase, "snapshots");
288162
- if (!existsSync52(snapshots)) return null;
288534
+ const snapshots = join69(hfBase, "snapshots");
288535
+ if (!existsSync53(snapshots)) return null;
288163
288536
  for (const snap of readdirSync12(snapshots)) {
288164
- const voicesDir = join68(snapshots, snap, "voices");
288165
- if (existsSync52(voicesDir)) return voicesDir;
288537
+ const voicesDir = join69(snapshots, snap, "voices");
288538
+ if (existsSync53(voicesDir)) return voicesDir;
288166
288539
  }
288167
288540
  } catch {
288168
288541
  }
@@ -288171,19 +288544,19 @@ function getHFVoicesDir() {
288171
288544
  function patchFrontendVoiceList(onInfo) {
288172
288545
  const log22 = onInfo ?? (() => {
288173
288546
  });
288174
- const hfBase = join68(homedir20(), ".cache", "huggingface", "hub", "models--nvidia--personaplex-7b-v1");
288175
- if (!existsSync52(hfBase)) return;
288547
+ const hfBase = join69(homedir20(), ".cache", "huggingface", "hub", "models--nvidia--personaplex-7b-v1");
288548
+ if (!existsSync53(hfBase)) return;
288176
288549
  try {
288177
- const snapshots = join68(hfBase, "snapshots");
288550
+ const snapshots = join69(hfBase, "snapshots");
288178
288551
  for (const snap of readdirSync12(snapshots)) {
288179
- const distDir = join68(snapshots, snap, "dist", "assets");
288180
- if (!existsSync52(distDir)) continue;
288552
+ const distDir = join69(snapshots, snap, "dist", "assets");
288553
+ if (!existsSync53(distDir)) continue;
288181
288554
  for (const f2 of readdirSync12(distDir)) {
288182
288555
  if (!f2.startsWith("index-") || !f2.endsWith(".js")) continue;
288183
- const jsPath = join68(distDir, f2);
288556
+ const jsPath = join69(distDir, f2);
288184
288557
  let js = readFileSync40(jsPath, "utf8");
288185
288558
  const customVoices = [];
288186
- if (existsSync52(CUSTOM_VOICES_DIR)) {
288559
+ if (existsSync53(CUSTOM_VOICES_DIR)) {
288187
288560
  for (const vf of readdirSync12(CUSTOM_VOICES_DIR)) {
288188
288561
  if (vf.endsWith(".pt")) {
288189
288562
  const name10 = vf.replace(".pt", "");
@@ -288249,11 +288622,11 @@ var init_personaplex = __esm({
288249
288622
  nf4: { repo: "cudabenchmarktest/personaplex-7b-nf4", file: "model-nf4.safetensors", sizeGB: 4.1, needsToken: false },
288250
288623
  "nf4-distilled": { repo: "cudabenchmarktest/personaplex-7b-nf4-distilled", file: "student_best.pt", sizeGB: 16.7, needsToken: false }
288251
288624
  };
288252
- PERSONAPLEX_DIR = join68(homedir20(), ".open-agents", "voice", "personaplex");
288253
- PID_FILE = join68(PERSONAPLEX_DIR, "daemon.pid");
288254
- PORT_FILE = join68(PERSONAPLEX_DIR, "daemon.port");
288255
- LOG_FILE = join68(PERSONAPLEX_DIR, "daemon.log");
288256
- CUSTOM_VOICES_DIR = join68(PERSONAPLEX_DIR, "custom_voices");
288625
+ PERSONAPLEX_DIR = join69(homedir20(), ".open-agents", "voice", "personaplex");
288626
+ PID_FILE = join69(PERSONAPLEX_DIR, "daemon.pid");
288627
+ PORT_FILE = join69(PERSONAPLEX_DIR, "daemon.port");
288628
+ LOG_FILE = join69(PERSONAPLEX_DIR, "daemon.log");
288629
+ CUSTOM_VOICES_DIR = join69(PERSONAPLEX_DIR, "custom_voices");
288257
288630
  }
288258
288631
  });
288259
288632
 
@@ -288294,8 +288667,8 @@ __export(setup_exports, {
288294
288667
  import * as readline from "node:readline";
288295
288668
  import { execSync as execSync46, spawn as spawn21, exec as exec4 } from "node:child_process";
288296
288669
  import { promisify as promisify7 } from "node:util";
288297
- import { existsSync as existsSync53, writeFileSync as writeFileSync25, readFileSync as readFileSync41, appendFileSync as appendFileSync2, mkdirSync as mkdirSync26 } from "node:fs";
288298
- import { join as join69 } from "node:path";
288670
+ import { existsSync as existsSync54, writeFileSync as writeFileSync25, readFileSync as readFileSync41, appendFileSync as appendFileSync2, mkdirSync as mkdirSync27 } from "node:fs";
288671
+ import { join as join70 } from "node:path";
288299
288672
  import { homedir as homedir21, platform as platform3 } from "node:os";
288300
288673
  async function checkToolSupport(modelName, backendUrl = "http://localhost:11434") {
288301
288674
  if (_toolSupportCache.has(modelName)) return _toolSupportCache.get(modelName);
@@ -288606,7 +288979,7 @@ async function installOllamaMac(_rl) {
288606
288979
  );
288607
288980
  if (!hasCmd("brew")) {
288608
288981
  try {
288609
- const brewPrefix = existsSync53("/opt/homebrew/bin/brew") ? "/opt/homebrew" : "/usr/local";
288982
+ const brewPrefix = existsSync54("/opt/homebrew/bin/brew") ? "/opt/homebrew" : "/usr/local";
288610
288983
  process.env["PATH"] = `${brewPrefix}/bin:${process.env["PATH"]}`;
288611
288984
  } catch {
288612
288985
  }
@@ -289395,9 +289768,9 @@ async function doSetup(config, rl) {
289395
289768
  `PARAMETER num_predict ${numPredict}`,
289396
289769
  `PARAMETER stop "<|endoftext|>"`
289397
289770
  ].join("\n");
289398
- const modelDir2 = join69(homedir21(), ".open-agents", "models");
289399
- mkdirSync26(modelDir2, { recursive: true });
289400
- const modelfilePath = join69(modelDir2, `Modelfile.${customName}`);
289771
+ const modelDir2 = join70(homedir21(), ".open-agents", "models");
289772
+ mkdirSync27(modelDir2, { recursive: true });
289773
+ const modelfilePath = join70(modelDir2, `Modelfile.${customName}`);
289401
289774
  writeFileSync25(modelfilePath, modelfileContent + "\n", "utf8");
289402
289775
  process.stdout.write(` ${c3.dim("Creating model...")} `);
289403
289776
  execSync46(`ollama create ${customName} -f ${modelfilePath}`, {
@@ -289443,7 +289816,7 @@ async function isModelAvailable(config) {
289443
289816
  }
289444
289817
  function isFirstRun() {
289445
289818
  try {
289446
- return !existsSync53(join69(homedir21(), ".open-agents", "config.json"));
289819
+ return !existsSync54(join70(homedir21(), ".open-agents", "config.json"));
289447
289820
  } catch {
289448
289821
  return true;
289449
289822
  }
@@ -289491,7 +289864,7 @@ function detectPkgManager() {
289491
289864
  return null;
289492
289865
  }
289493
289866
  function getVenvDir() {
289494
- return join69(homedir21(), ".open-agents", "venv");
289867
+ return join70(homedir21(), ".open-agents", "venv");
289495
289868
  }
289496
289869
  function hasVenvModule() {
289497
289870
  try {
@@ -289504,9 +289877,9 @@ function hasVenvModule() {
289504
289877
  function ensureVenv(log22) {
289505
289878
  const venvDir = getVenvDir();
289506
289879
  const isWin2 = process.platform === "win32";
289507
- const pipPath = isWin2 ? join69(venvDir, "Scripts", "pip.exe") : join69(venvDir, "bin", "pip");
289880
+ const pipPath = isWin2 ? join70(venvDir, "Scripts", "pip.exe") : join70(venvDir, "bin", "pip");
289508
289881
  const pythonCmd = isWin2 ? "python" : "python3";
289509
- if (existsSync53(pipPath)) return venvDir;
289882
+ if (existsSync54(pipPath)) return venvDir;
289510
289883
  log22("Creating Python venv for vision deps...");
289511
289884
  if (!hasCmd(pythonCmd) && !hasCmd("python3")) {
289512
289885
  log22(`${pythonCmd} not found \u2014 cannot create venv.`);
@@ -289517,7 +289890,7 @@ function ensureVenv(log22) {
289517
289890
  return null;
289518
289891
  }
289519
289892
  try {
289520
- mkdirSync26(join69(homedir21(), ".open-agents"), { recursive: true });
289893
+ mkdirSync27(join70(homedir21(), ".open-agents"), { recursive: true });
289521
289894
  const pyCmd = hasCmd(pythonCmd) ? pythonCmd : "python3";
289522
289895
  execSync46(`${pyCmd} -m venv "${venvDir}"`, { stdio: "pipe", timeout: 3e4 });
289523
289896
  execSync46(`"${pipPath}" install --upgrade pip`, {
@@ -289617,11 +289990,11 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
289617
289990
  ];
289618
289991
  {
289619
289992
  const pm2 = detectPkgManager();
289620
- const _visionMarkerDir = join69(homedir21(), ".open-agents");
289621
- const _visionMarkerFile = join69(_visionMarkerDir, "vision-deps-installed.json");
289993
+ const _visionMarkerDir = join70(homedir21(), ".open-agents");
289994
+ const _visionMarkerFile = join70(_visionMarkerDir, "vision-deps-installed.json");
289622
289995
  let _visionPreviouslyInstalled = /* @__PURE__ */ new Set();
289623
289996
  try {
289624
- if (existsSync53(_visionMarkerFile)) {
289997
+ if (existsSync54(_visionMarkerFile)) {
289625
289998
  const _vm = JSON.parse(readFileSync41(_visionMarkerFile, "utf8"));
289626
289999
  _visionPreviouslyInstalled = new Set(_vm.installed || []);
289627
290000
  }
@@ -289735,7 +290108,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
289735
290108
  }
289736
290109
  }
289737
290110
  try {
289738
- mkdirSync26(_visionMarkerDir, { recursive: true });
290111
+ mkdirSync27(_visionMarkerDir, { recursive: true });
289739
290112
  writeFileSync25(_visionMarkerFile, JSON.stringify({
289740
290113
  installed: [..._visionPreviouslyInstalled],
289741
290114
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
@@ -289788,15 +290161,15 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
289788
290161
  }
289789
290162
  const venvDir = getVenvDir();
289790
290163
  const isWin2 = process.platform === "win32";
289791
- const venvBin = join69(venvDir, isWin2 ? "Scripts" : "bin");
289792
- const venvMoondream = join69(venvBin, isWin2 ? "moondream-station.exe" : "moondream-station");
290164
+ const venvBin = join70(venvDir, isWin2 ? "Scripts" : "bin");
290165
+ const venvMoondream = join70(venvBin, isWin2 ? "moondream-station.exe" : "moondream-station");
289793
290166
  const venv = ensureVenv(log22);
289794
- if (venv && !hasCmd("moondream-station") && !existsSync53(venvMoondream)) {
289795
- const venvPip2 = join69(venvBin, "pip");
290167
+ if (venv && !hasCmd("moondream-station") && !existsSync54(venvMoondream)) {
290168
+ const venvPip2 = join70(venvBin, "pip");
289796
290169
  log22("Installing moondream-station in ~/.open-agents/venv...");
289797
290170
  try {
289798
290171
  execSync46(`"${venvPip2}" install moondream-station`, { stdio: "pipe", timeout: 3e5 });
289799
- if (existsSync53(venvMoondream)) {
290172
+ if (existsSync54(venvMoondream)) {
289800
290173
  log22("moondream-station installed successfully.");
289801
290174
  } else {
289802
290175
  try {
@@ -289813,8 +290186,8 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
289813
290186
  }
289814
290187
  }
289815
290188
  if (venv) {
289816
- const venvPython2 = join69(venvBin, isWin2 ? "python.exe" : "python");
289817
- const venvPip2 = join69(venvBin, isWin2 ? "pip.exe" : "pip");
290189
+ const venvPython2 = join70(venvBin, isWin2 ? "python.exe" : "python");
290190
+ const venvPip2 = join70(venvBin, isWin2 ? "pip.exe" : "pip");
289818
290191
  let ocrStackInstalled = false;
289819
290192
  try {
289820
290193
  execSync46(
@@ -289971,9 +290344,9 @@ function createExpandedVariant(baseModel, specs, sizeGB, kvBytesPerToken, archMa
289971
290344
  `PARAMETER num_predict ${numPredict}`,
289972
290345
  `PARAMETER stop "<|endoftext|>"`
289973
290346
  ].join("\n");
289974
- const modelDir2 = join69(homedir21(), ".open-agents", "models");
289975
- mkdirSync26(modelDir2, { recursive: true });
289976
- const modelfilePath = join69(modelDir2, `Modelfile.${customName}`);
290347
+ const modelDir2 = join70(homedir21(), ".open-agents", "models");
290348
+ mkdirSync27(modelDir2, { recursive: true });
290349
+ const modelfilePath = join70(modelDir2, `Modelfile.${customName}`);
289977
290350
  writeFileSync25(modelfilePath, modelfileContent + "\n", "utf8");
289978
290351
  execSync46(`ollama create ${customName} -f ${modelfilePath}`, {
289979
290352
  stdio: "pipe",
@@ -289996,9 +290369,9 @@ async function createExpandedVariantAsync(baseModel, specs, sizeGB, kvBytesPerTo
289996
290369
  `PARAMETER num_predict ${numPredict}`,
289997
290370
  `PARAMETER stop "<|endoftext|>"`
289998
290371
  ].join("\n");
289999
- const modelDir2 = join69(homedir21(), ".open-agents", "models");
290000
- mkdirSync26(modelDir2, { recursive: true });
290001
- const modelfilePath = join69(modelDir2, `Modelfile.${customName}`);
290372
+ const modelDir2 = join70(homedir21(), ".open-agents", "models");
290373
+ mkdirSync27(modelDir2, { recursive: true });
290374
+ const modelfilePath = join70(modelDir2, `Modelfile.${customName}`);
290002
290375
  writeFileSync25(modelfilePath, modelfileContent + "\n", "utf8");
290003
290376
  await execAsync2(`ollama create ${customName} -f ${modelfilePath}`, {
290004
290377
  timeout: 12e4
@@ -290072,10 +290445,10 @@ async function ensureNeovim() {
290072
290445
  const platform6 = process.platform;
290073
290446
  const arch2 = process.arch;
290074
290447
  if (platform6 === "linux") {
290075
- const binDir = join69(homedir21(), ".local", "bin");
290076
- const nvimDest = join69(binDir, "nvim");
290448
+ const binDir = join70(homedir21(), ".local", "bin");
290449
+ const nvimDest = join70(binDir, "nvim");
290077
290450
  try {
290078
- mkdirSync26(binDir, { recursive: true });
290451
+ mkdirSync27(binDir, { recursive: true });
290079
290452
  } catch {
290080
290453
  }
290081
290454
  const appImageName = arch2 === "arm64" ? "nvim-linux-arm64.appimage" : "nvim-linux-x86_64.appimage";
@@ -290144,9 +290517,9 @@ async function ensureNeovim() {
290144
290517
  }
290145
290518
  function ensurePathInShellRc(binDir) {
290146
290519
  const shell = process.env.SHELL ?? "";
290147
- const rcFile = shell.includes("zsh") ? join69(homedir21(), ".zshrc") : join69(homedir21(), ".bashrc");
290520
+ const rcFile = shell.includes("zsh") ? join70(homedir21(), ".zshrc") : join70(homedir21(), ".bashrc");
290148
290521
  try {
290149
- const rcContent = existsSync53(rcFile) ? readFileSync41(rcFile, "utf8") : "";
290522
+ const rcContent = existsSync54(rcFile) ? readFileSync41(rcFile, "utf8") : "";
290150
290523
  if (rcContent.includes(binDir)) return;
290151
290524
  const exportLine = `
290152
290525
  export PATH="${binDir}:$PATH" # Added by open-agents for nvim
@@ -290183,7 +290556,7 @@ var init_setup = __esm({
290183
290556
  });
290184
290557
 
290185
290558
  // packages/cli/src/tui/drop-panel.ts
290186
- import { existsSync as existsSync54 } from "node:fs";
290559
+ import { existsSync as existsSync55 } from "node:fs";
290187
290560
  import { extname as extname10, resolve as resolve31 } from "node:path";
290188
290561
  function ansi4(code8, text) {
290189
290562
  return isTTY4 ? `\x1B[${code8}m${text}\x1B[0m` : text;
@@ -290304,7 +290677,7 @@ function showDropPanel(opts) {
290304
290677
  filePath = decodeURIComponent(filePath.slice(7));
290305
290678
  }
290306
290679
  filePath = resolve31(filePath);
290307
- if (!existsSync54(filePath)) {
290680
+ if (!existsSync55(filePath)) {
290308
290681
  errorMsg = `File not found: ${filePath}`;
290309
290682
  render();
290310
290683
  return;
@@ -290376,9 +290749,9 @@ var init_drop_panel = __esm({
290376
290749
  });
290377
290750
 
290378
290751
  // packages/cli/src/tui/neovim-mode.ts
290379
- import { existsSync as existsSync55, unlinkSync as unlinkSync12 } from "node:fs";
290752
+ import { existsSync as existsSync56, unlinkSync as unlinkSync12 } from "node:fs";
290380
290753
  import { tmpdir as tmpdir15 } from "node:os";
290381
- import { join as join70 } from "node:path";
290754
+ import { join as join71 } from "node:path";
290382
290755
  import { execSync as execSync47 } from "node:child_process";
290383
290756
  function isNeovimActive() {
290384
290757
  return _state !== null && !_state.cleanedUp;
@@ -290424,9 +290797,9 @@ async function startNeovimMode(opts) {
290424
290797
  );
290425
290798
  } catch {
290426
290799
  }
290427
- const socketPath = join70(tmpdir15(), `oa-nvim-${process.pid}-${Date.now()}.sock`);
290800
+ const socketPath = join71(tmpdir15(), `oa-nvim-${process.pid}-${Date.now()}.sock`);
290428
290801
  try {
290429
- if (existsSync55(socketPath)) unlinkSync12(socketPath);
290802
+ if (existsSync56(socketPath)) unlinkSync12(socketPath);
290430
290803
  } catch {
290431
290804
  }
290432
290805
  const ptyCols = opts.cols;
@@ -290673,12 +291046,12 @@ function resizeNeovim(cols, contentRows) {
290673
291046
  }
290674
291047
  async function connectRPC(state, neovimPkg, cols) {
290675
291048
  let attempts = 0;
290676
- while (!existsSync55(state.socketPath) && attempts < 30) {
291049
+ while (!existsSync56(state.socketPath) && attempts < 30) {
290677
291050
  await new Promise((r2) => setTimeout(r2, 200));
290678
291051
  attempts++;
290679
291052
  if (state.cleanedUp) return;
290680
291053
  }
290681
- if (!existsSync55(state.socketPath)) return;
291054
+ if (!existsSync56(state.socketPath)) return;
290682
291055
  const nvim = neovimPkg.attach({ socket: state.socketPath });
290683
291056
  state.nvim = nvim;
290684
291057
  await new Promise((r2) => setTimeout(r2, 300));
@@ -290815,7 +291188,7 @@ function doCleanup(state) {
290815
291188
  state.pty = null;
290816
291189
  }
290817
291190
  try {
290818
- if (existsSync55(state.socketPath)) unlinkSync12(state.socketPath);
291191
+ if (existsSync56(state.socketPath)) unlinkSync12(state.socketPath);
290819
291192
  } catch {
290820
291193
  }
290821
291194
  if (state.stdinHandler) {
@@ -290885,8 +291258,8 @@ __export(daemon_exports, {
290885
291258
  stopDaemon: () => stopDaemon
290886
291259
  });
290887
291260
  import { spawn as spawn22 } from "node:child_process";
290888
- import { existsSync as existsSync56, readFileSync as readFileSync42, writeFileSync as writeFileSync26, mkdirSync as mkdirSync27, unlinkSync as unlinkSync13 } from "node:fs";
290889
- import { join as join71 } from "node:path";
291261
+ import { existsSync as existsSync57, readFileSync as readFileSync42, writeFileSync as writeFileSync26, mkdirSync as mkdirSync28, unlinkSync as unlinkSync13 } from "node:fs";
291262
+ import { join as join72 } from "node:path";
290890
291263
  import { homedir as homedir22 } from "node:os";
290891
291264
  import { fileURLToPath as fileURLToPath13 } from "node:url";
290892
291265
  import { dirname as dirname21 } from "node:path";
@@ -290911,7 +291284,7 @@ async function isDaemonRunning(port) {
290911
291284
  }
290912
291285
  }
290913
291286
  function getDaemonPid() {
290914
- if (!existsSync56(PID_FILE2)) return null;
291287
+ if (!existsSync57(PID_FILE2)) return null;
290915
291288
  try {
290916
291289
  const pid = parseInt(readFileSync42(PID_FILE2, "utf8").trim(), 10);
290917
291290
  if (!pid || pid <= 0) return null;
@@ -290926,7 +291299,7 @@ function getDaemonPid() {
290926
291299
  }
290927
291300
  }
290928
291301
  async function startDaemon() {
290929
- mkdirSync27(OA_DIR2, { recursive: true });
291302
+ mkdirSync28(OA_DIR2, { recursive: true });
290930
291303
  const nodeExe = process.execPath;
290931
291304
  let oaScript = process.argv[1];
290932
291305
  if (!oaScript) {
@@ -290939,8 +291312,8 @@ async function startDaemon() {
290939
291312
  }
290940
291313
  if (!oaScript) {
290941
291314
  const thisDir = dirname21(fileURLToPath13(import.meta.url));
290942
- const indexJs = join71(thisDir, "index.js");
290943
- if (existsSync56(indexJs)) oaScript = indexJs;
291315
+ const indexJs = join72(thisDir, "index.js");
291316
+ if (existsSync57(indexJs)) oaScript = indexJs;
290944
291317
  }
290945
291318
  if (!oaScript) return null;
290946
291319
  try {
@@ -291038,8 +291411,8 @@ var OA_DIR2, PID_FILE2, DEFAULT_PORT2;
291038
291411
  var init_daemon = __esm({
291039
291412
  "packages/cli/src/daemon.ts"() {
291040
291413
  "use strict";
291041
- OA_DIR2 = join71(homedir22(), ".open-agents");
291042
- PID_FILE2 = join71(OA_DIR2, "daemon.pid");
291414
+ OA_DIR2 = join72(homedir22(), ".open-agents");
291415
+ PID_FILE2 = join72(OA_DIR2, "daemon.pid");
291043
291416
  DEFAULT_PORT2 = 11435;
291044
291417
  }
291045
291418
  });
@@ -291424,8 +291797,8 @@ __export(sponsor_wizard_exports, {
291424
291797
  saveSponsorConfig: () => saveSponsorConfig,
291425
291798
  showSponsorDashboard: () => showSponsorDashboard
291426
291799
  });
291427
- import { existsSync as existsSync57, readFileSync as readFileSync43, writeFileSync as writeFileSync27, mkdirSync as mkdirSync28 } from "node:fs";
291428
- import { join as join72 } from "node:path";
291800
+ import { existsSync as existsSync58, readFileSync as readFileSync43, writeFileSync as writeFileSync27, mkdirSync as mkdirSync29 } from "node:fs";
291801
+ import { join as join73 } from "node:path";
291429
291802
  function colorPreview(code8) {
291430
291803
  return `\x1B[38;5;${code8}m\u2588\u2588\u2588\u2588\x1B[0m (${code8})`;
291431
291804
  }
@@ -291438,14 +291811,14 @@ function gradientPreview(start2, end) {
291438
291811
  return s2;
291439
291812
  }
291440
291813
  function sponsorDir(projectDir) {
291441
- return join72(projectDir, ".oa", "sponsor");
291814
+ return join73(projectDir, ".oa", "sponsor");
291442
291815
  }
291443
291816
  function configPath(projectDir) {
291444
- return join72(sponsorDir(projectDir), "config.json");
291817
+ return join73(sponsorDir(projectDir), "config.json");
291445
291818
  }
291446
291819
  function loadSponsorConfig(projectDir) {
291447
291820
  const p2 = configPath(projectDir);
291448
- if (!existsSync57(p2)) return null;
291821
+ if (!existsSync58(p2)) return null;
291449
291822
  try {
291450
291823
  return JSON.parse(readFileSync43(p2, "utf8"));
291451
291824
  } catch {
@@ -291454,7 +291827,7 @@ function loadSponsorConfig(projectDir) {
291454
291827
  }
291455
291828
  function saveSponsorConfig(projectDir, config) {
291456
291829
  const dir = sponsorDir(projectDir);
291457
- mkdirSync28(dir, { recursive: true });
291830
+ mkdirSync29(dir, { recursive: true });
291458
291831
  config.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
291459
291832
  writeFileSync27(configPath(projectDir), JSON.stringify(config, null, 2), "utf8");
291460
291833
  }
@@ -292336,8 +292709,8 @@ __export(voice_exports, {
292336
292709
  registerCustomOnnxModel: () => registerCustomOnnxModel,
292337
292710
  resetNarrationContext: () => resetNarrationContext
292338
292711
  });
292339
- import { existsSync as existsSync58, mkdirSync as mkdirSync29, writeFileSync as writeFileSync28, readFileSync as readFileSync44, unlinkSync as unlinkSync14, readdirSync as readdirSync13, statSync as statSync18 } from "node:fs";
292340
- import { join as join73, dirname as dirname22 } from "node:path";
292712
+ import { existsSync as existsSync59, mkdirSync as mkdirSync30, writeFileSync as writeFileSync28, readFileSync as readFileSync44, unlinkSync as unlinkSync14, readdirSync as readdirSync13, statSync as statSync18 } from "node:fs";
292713
+ import { join as join74, dirname as dirname22 } from "node:path";
292341
292714
  import { homedir as homedir23, tmpdir as tmpdir16, platform as platform4 } from "node:os";
292342
292715
  import { execSync as execSync48, spawn as nodeSpawn } from "node:child_process";
292343
292716
  import { createRequire as createRequire3 } from "node:module";
@@ -292362,39 +292735,39 @@ function listVoiceModels() {
292362
292735
  }));
292363
292736
  }
292364
292737
  function voiceDir() {
292365
- return join73(homedir23(), ".open-agents", "voice");
292738
+ return join74(homedir23(), ".open-agents", "voice");
292366
292739
  }
292367
292740
  function modelsDir() {
292368
- return join73(voiceDir(), "models");
292741
+ return join74(voiceDir(), "models");
292369
292742
  }
292370
292743
  function modelDir(id) {
292371
- return join73(modelsDir(), id);
292744
+ return join74(modelsDir(), id);
292372
292745
  }
292373
292746
  function modelOnnxPath(id) {
292374
- return join73(modelDir(id), "model.onnx");
292747
+ return join74(modelDir(id), "model.onnx");
292375
292748
  }
292376
292749
  function modelConfigPath(id) {
292377
- return join73(modelDir(id), "config.json");
292750
+ return join74(modelDir(id), "config.json");
292378
292751
  }
292379
292752
  function luxttsVenvDir() {
292380
- return join73(voiceDir(), "luxtts-venv");
292753
+ return join74(voiceDir(), "luxtts-venv");
292381
292754
  }
292382
292755
  function luxttsVenvPy() {
292383
- return platform4() === "win32" ? join73(luxttsVenvDir(), "Scripts", "python.exe") : join73(luxttsVenvDir(), "bin", "python3");
292756
+ return platform4() === "win32" ? join74(luxttsVenvDir(), "Scripts", "python.exe") : join74(luxttsVenvDir(), "bin", "python3");
292384
292757
  }
292385
292758
  function luxttsRepoDir() {
292386
- return join73(voiceDir(), "LuxTTS");
292759
+ return join74(voiceDir(), "LuxTTS");
292387
292760
  }
292388
292761
  function luxttsCloneRefsDir() {
292389
- return join73(voiceDir(), "clone-refs");
292762
+ return join74(voiceDir(), "clone-refs");
292390
292763
  }
292391
292764
  function luxttsInferScript() {
292392
- return join73(voiceDir(), "luxtts-infer.py");
292765
+ return join74(voiceDir(), "luxtts-infer.py");
292393
292766
  }
292394
292767
  function writeDetectTorchScript(targetPath) {
292395
- if (existsSync58(targetPath)) return;
292768
+ if (existsSync59(targetPath)) return;
292396
292769
  try {
292397
- mkdirSync29(dirname22(targetPath), { recursive: true });
292770
+ mkdirSync30(dirname22(targetPath), { recursive: true });
292398
292771
  } catch {
292399
292772
  }
292400
292773
  const script = `#!/usr/bin/env python3
@@ -293217,8 +293590,8 @@ var init_voice = __esm({
293217
293590
  const refsDir = luxttsCloneRefsDir();
293218
293591
  const targets = ["glados", "overwatch"];
293219
293592
  for (const modelId of targets) {
293220
- const refFile = join73(refsDir, `${modelId}-ref.wav`);
293221
- if (existsSync58(refFile)) continue;
293593
+ const refFile = join74(refsDir, `${modelId}-ref.wav`);
293594
+ if (existsSync59(refFile)) continue;
293222
293595
  try {
293223
293596
  await this.generateCloneRef(modelId);
293224
293597
  const meta = this.loadCloneMeta();
@@ -293294,20 +293667,20 @@ var init_voice = __esm({
293294
293667
  }
293295
293668
  p2 = p2.replace(/\\ /g, " ");
293296
293669
  if (p2.startsWith("~/") || p2 === "~") {
293297
- p2 = join73(homedir23(), p2.slice(1));
293670
+ p2 = join74(homedir23(), p2.slice(1));
293298
293671
  }
293299
- if (!existsSync58(p2)) {
293672
+ if (!existsSync59(p2)) {
293300
293673
  return `File not found: ${p2}
293301
293674
  (original input: ${audioPath})`;
293302
293675
  }
293303
293676
  audioPath = p2;
293304
293677
  const refsDir = luxttsCloneRefsDir();
293305
- if (!existsSync58(refsDir)) mkdirSync29(refsDir, { recursive: true });
293678
+ if (!existsSync59(refsDir)) mkdirSync30(refsDir, { recursive: true });
293306
293679
  const ext = audioPath.split(".").pop() || "wav";
293307
293680
  const srcName = (audioPath.split("/").pop() ?? "clone").replace(/\.[^.]+$/, "").replace(/[^a-zA-Z0-9_-]/g, "-");
293308
293681
  const ts = Date.now().toString(36);
293309
293682
  const destFilename = `clone-${srcName}-${ts}.${ext}`;
293310
- const destPath = join73(refsDir, destFilename);
293683
+ const destPath = join74(refsDir, destFilename);
293311
293684
  try {
293312
293685
  const data = readFileSync44(audioPath);
293313
293686
  writeFileSync28(destPath, data);
@@ -293350,8 +293723,8 @@ var init_voice = __esm({
293350
293723
  return `Failed to synthesize reference audio from ${source.label}.`;
293351
293724
  }
293352
293725
  const refsDir = luxttsCloneRefsDir();
293353
- if (!existsSync58(refsDir)) mkdirSync29(refsDir, { recursive: true });
293354
- const destPath = join73(refsDir, `${sourceModelId}-ref.wav`);
293726
+ if (!existsSync59(refsDir)) mkdirSync30(refsDir, { recursive: true });
293727
+ const destPath = join74(refsDir, `${sourceModelId}-ref.wav`);
293355
293728
  const sampleRate = this.config?.audio?.sample_rate ?? 22050;
293356
293729
  this.writeWav(audioData, sampleRate, destPath);
293357
293730
  this.luxttsCloneRef = destPath;
@@ -293367,11 +293740,11 @@ var init_voice = __esm({
293367
293740
  // -------------------------------------------------------------------------
293368
293741
  /** Metadata file for friendly names of clone refs */
293369
293742
  static cloneMetaFile() {
293370
- return join73(luxttsCloneRefsDir(), "meta.json");
293743
+ return join74(luxttsCloneRefsDir(), "meta.json");
293371
293744
  }
293372
293745
  loadCloneMeta() {
293373
293746
  const p2 = _VoiceEngine.cloneMetaFile();
293374
- if (!existsSync58(p2)) return {};
293747
+ if (!existsSync59(p2)) return {};
293375
293748
  try {
293376
293749
  return JSON.parse(readFileSync44(p2, "utf8"));
293377
293750
  } catch {
@@ -293380,7 +293753,7 @@ var init_voice = __esm({
293380
293753
  }
293381
293754
  saveCloneMeta(meta) {
293382
293755
  const dir = luxttsCloneRefsDir();
293383
- if (!existsSync58(dir)) mkdirSync29(dir, { recursive: true });
293756
+ if (!existsSync59(dir)) mkdirSync30(dir, { recursive: true });
293384
293757
  writeFileSync28(_VoiceEngine.cloneMetaFile(), JSON.stringify(meta, null, 2));
293385
293758
  }
293386
293759
  /** Audio file extensions recognized as clone references */
@@ -293391,14 +293764,14 @@ var init_voice = __esm({
293391
293764
  */
293392
293765
  listCloneRefs() {
293393
293766
  const dir = luxttsCloneRefsDir();
293394
- if (!existsSync58(dir)) return [];
293767
+ if (!existsSync59(dir)) return [];
293395
293768
  const meta = this.loadCloneMeta();
293396
293769
  const files = readdirSync13(dir).filter((f2) => {
293397
293770
  const ext = f2.split(".").pop()?.toLowerCase() ?? "";
293398
293771
  return _VoiceEngine.AUDIO_EXTS.has(ext);
293399
293772
  });
293400
293773
  return files.map((f2) => {
293401
- const p2 = join73(dir, f2);
293774
+ const p2 = join74(dir, f2);
293402
293775
  let size = 0;
293403
293776
  try {
293404
293777
  size = statSync18(p2).size;
@@ -293415,8 +293788,8 @@ var init_voice = __esm({
293415
293788
  }
293416
293789
  /** Delete a clone reference file by filename. Returns true if deleted. */
293417
293790
  deleteCloneRef(filename) {
293418
- const p2 = join73(luxttsCloneRefsDir(), filename);
293419
- if (!existsSync58(p2)) return false;
293791
+ const p2 = join74(luxttsCloneRefsDir(), filename);
293792
+ if (!existsSync59(p2)) return false;
293420
293793
  try {
293421
293794
  unlinkSync14(p2);
293422
293795
  const meta = this.loadCloneMeta();
@@ -293439,8 +293812,8 @@ var init_voice = __esm({
293439
293812
  }
293440
293813
  /** Set the active clone reference by filename. */
293441
293814
  setActiveCloneRef(filename) {
293442
- const p2 = join73(luxttsCloneRefsDir(), filename);
293443
- if (!existsSync58(p2)) return `File not found: ${filename}`;
293815
+ const p2 = join74(luxttsCloneRefsDir(), filename);
293816
+ if (!existsSync59(p2)) return `File not found: ${filename}`;
293444
293817
  this.luxttsCloneRef = p2;
293445
293818
  return `Active clone voice set to: ${filename}`;
293446
293819
  }
@@ -293777,7 +294150,7 @@ var init_voice = __esm({
293777
294150
  }
293778
294151
  this.onPCMOutput(Buffer.from(int16.buffer), sampleRate);
293779
294152
  }
293780
- const wavPath = join73(tmpdir16(), `oa-voice-${Date.now()}.wav`);
294153
+ const wavPath = join74(tmpdir16(), `oa-voice-${Date.now()}.wav`);
293781
294154
  this.writeStereoWav(stereo.left, stereo.right, sampleRate, wavPath);
293782
294155
  await this.playWav(wavPath);
293783
294156
  try {
@@ -294172,7 +294545,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
294172
294545
  const mlxModelId = model.mlxModelId ?? "mlx-community/Kokoro-82M-bf16";
294173
294546
  const mlxVoice = model.mlxVoice ?? "af_heart";
294174
294547
  const mlxLangCode = model.mlxLangCode ?? "a";
294175
- const wavPath = join73(tmpdir16(), `oa-mlx-${Date.now()}.wav`);
294548
+ const wavPath = join74(tmpdir16(), `oa-mlx-${Date.now()}.wav`);
294176
294549
  const pyScript = [
294177
294550
  "import sys, json",
294178
294551
  "from mlx_audio.tts import generate as tts_gen",
@@ -294195,7 +294568,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
294195
294568
  return;
294196
294569
  }
294197
294570
  }
294198
- if (!existsSync58(wavPath)) return;
294571
+ if (!existsSync59(wavPath)) return;
294199
294572
  if (volume !== 1) {
294200
294573
  try {
294201
294574
  const wavData = readFileSync44(wavPath);
@@ -294246,7 +294619,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
294246
294619
  const mlxModelId = model.mlxModelId ?? "mlx-community/Kokoro-82M-bf16";
294247
294620
  const mlxVoice = model.mlxVoice ?? "af_heart";
294248
294621
  const mlxLangCode = model.mlxLangCode ?? "a";
294249
- const wavPath = join73(tmpdir16(), `oa-mlx-buf-${Date.now()}.wav`);
294622
+ const wavPath = join74(tmpdir16(), `oa-mlx-buf-${Date.now()}.wav`);
294250
294623
  const pyScript = [
294251
294624
  "import sys, json",
294252
294625
  "from mlx_audio.tts import generate as tts_gen",
@@ -294269,7 +294642,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
294269
294642
  return null;
294270
294643
  }
294271
294644
  }
294272
- if (!existsSync58(wavPath)) return null;
294645
+ if (!existsSync59(wavPath)) return null;
294273
294646
  try {
294274
294647
  const data = readFileSync44(wavPath);
294275
294648
  unlinkSync14(wavPath);
@@ -294296,7 +294669,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
294296
294669
  }
294297
294670
  const venvDir = luxttsVenvDir();
294298
294671
  const venvPy = luxttsVenvPy();
294299
- if (existsSync58(venvPy)) {
294672
+ if (existsSync59(venvPy)) {
294300
294673
  try {
294301
294674
  const quotedPy = `"${venvPy}"`;
294302
294675
  const repoPath = luxttsRepoDir().replace(/\\/g, "/");
@@ -294318,7 +294691,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
294318
294691
  if (torchCheck === "cpu") {
294319
294692
  renderWarning("GPU detected but PyTorch is CPU-only. Reinstalling with CUDA support in background...");
294320
294693
  try {
294321
- const detectScript = join73(voiceDir(), "detect-torch.py");
294694
+ const detectScript = join74(voiceDir(), "detect-torch.py");
294322
294695
  writeDetectTorchScript(detectScript);
294323
294696
  let pipArgs = `torch torchaudio --index-url https://download.pytorch.org/whl/cu124`;
294324
294697
  try {
@@ -294345,7 +294718,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
294345
294718
  }
294346
294719
  }
294347
294720
  renderInfo("Setting up LuxTTS voice cloning (first-time setup, this takes several minutes)...");
294348
- if (!existsSync58(venvDir)) {
294721
+ if (!existsSync59(venvDir)) {
294349
294722
  renderInfo(" Creating Python virtual environment...");
294350
294723
  try {
294351
294724
  await this.asyncShell(`${py} -m venv ${JSON.stringify(venvDir)}`, 6e4);
@@ -294356,7 +294729,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
294356
294729
  }
294357
294730
  }
294358
294731
  {
294359
- const detectScript = join73(voiceDir(), "detect-torch.py");
294732
+ const detectScript = join74(voiceDir(), "detect-torch.py");
294360
294733
  writeDetectTorchScript(detectScript);
294361
294734
  let pipArgsStr = "torch torchaudio";
294362
294735
  let torchDesc = "unknown platform";
@@ -294401,10 +294774,10 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
294401
294774
  }
294402
294775
  }
294403
294776
  const repoDir = luxttsRepoDir();
294404
- if (!existsSync58(join73(repoDir, "zipvoice", "luxvoice.py"))) {
294777
+ if (!existsSync59(join74(repoDir, "zipvoice", "luxvoice.py"))) {
294405
294778
  renderInfo(" Cloning LuxTTS repository...");
294406
294779
  try {
294407
- if (existsSync58(repoDir)) {
294780
+ if (existsSync59(repoDir)) {
294408
294781
  const rmCmd = process.platform === "win32" ? `rmdir /s /q ${JSON.stringify(repoDir)}` : `rm -rf ${JSON.stringify(repoDir)}`;
294409
294782
  await this.asyncShell(rmCmd, 3e4);
294410
294783
  }
@@ -294493,7 +294866,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
294493
294866
  renderWarning(` Could not install system build deps: ${err instanceof Error ? err.message : String(err)}`);
294494
294867
  }
294495
294868
  }
294496
- const isJetson = isArm && (existsSync58("/etc/nv_tegra_release") || existsSync58("/usr/local/cuda/targets/aarch64-linux") || (process.env.JETSON_L4T_VERSION ?? "") !== "");
294869
+ const isJetson = isArm && (existsSync59("/etc/nv_tegra_release") || existsSync59("/usr/local/cuda/targets/aarch64-linux") || (process.env.JETSON_L4T_VERSION ?? "") !== "");
294497
294870
  const installSteps = isArm ? [
294498
294871
  // ARM: install individually so we get clear error messages per package.
294499
294872
  // ALL are fatal because LuxTTS hard-imports them (no lazy/optional imports).
@@ -294506,7 +294879,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
294506
294879
  ...isJetson ? (() => {
294507
294880
  let jpVer = "v60";
294508
294881
  try {
294509
- const tegra = existsSync58("/etc/nv_tegra_release") ? execSync48("cat /etc/nv_tegra_release 2>/dev/null", { encoding: "utf8", timeout: 3e3 }).trim() : "";
294882
+ const tegra = existsSync59("/etc/nv_tegra_release") ? execSync48("cat /etc/nv_tegra_release 2>/dev/null", { encoding: "utf8", timeout: 3e3 }).trim() : "";
294510
294883
  const dpkg = execSync48("dpkg -l nvidia-jetpack 2>/dev/null | grep nvidia-jetpack | awk '{print $3}'", { encoding: "utf8", timeout: 5e3 }).trim();
294511
294884
  const ver = dpkg || process.env.JETSON_L4T_VERSION || "";
294512
294885
  if (ver.startsWith("5.") || tegra.includes("R35") || tegra.includes("R34")) jpVer = "v51";
@@ -294586,12 +294959,12 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`
294586
294959
  }
294587
294960
  /** Auto-detect an existing clone reference in the refs directory */
294588
294961
  autoDetectCloneRef() {
294589
- if (this.luxttsCloneRef && existsSync58(this.luxttsCloneRef)) return;
294962
+ if (this.luxttsCloneRef && existsSync59(this.luxttsCloneRef)) return;
294590
294963
  const refsDir = luxttsCloneRefsDir();
294591
- if (!existsSync58(refsDir)) return;
294964
+ if (!existsSync59(refsDir)) return;
294592
294965
  for (const name10 of ["custom-clone.wav", "custom-clone.mp3", "glados-ref.wav", "overwatch-ref.wav"]) {
294593
- const p2 = join73(refsDir, name10);
294594
- if (existsSync58(p2)) {
294966
+ const p2 = join74(refsDir, name10);
294967
+ if (existsSync59(p2)) {
294595
294968
  this.luxttsCloneRef = p2;
294596
294969
  return;
294597
294970
  }
@@ -294691,14 +295064,14 @@ if __name__ == '__main__':
294691
295064
  main()
294692
295065
  `;
294693
295066
  const scriptPath2 = luxttsInferScript();
294694
- mkdirSync29(voiceDir(), { recursive: true });
295067
+ mkdirSync30(voiceDir(), { recursive: true });
294695
295068
  writeFileSync28(scriptPath2, script);
294696
295069
  }
294697
295070
  /** Ensure the LuxTTS daemon is running, spawn if needed */
294698
295071
  async ensureLuxttsDaemon() {
294699
295072
  if (this._luxttsDaemon && !this._luxttsDaemon.killed) return true;
294700
295073
  const venvPy = luxttsVenvPy();
294701
- if (!existsSync58(venvPy)) return false;
295074
+ if (!existsSync59(venvPy)) return false;
294702
295075
  return new Promise((resolve39) => {
294703
295076
  const env2 = { ...process.env, LUXTTS_REPO_PATH: luxttsRepoDir() };
294704
295077
  const daemon = nodeSpawn(venvPy, [luxttsInferScript()], {
@@ -294787,12 +295160,12 @@ if __name__ == '__main__':
294787
295160
  * Used by drainQueue's pre-fetch pipeline for gapless back-to-back playback.
294788
295161
  */
294789
295162
  async synthesizeLuxttsWav(text, speedFactor = 1) {
294790
- if (!this.luxttsCloneRef || !existsSync58(this.luxttsCloneRef)) return null;
295163
+ if (!this.luxttsCloneRef || !existsSync59(this.luxttsCloneRef)) return null;
294791
295164
  const cleaned = text.replace(/\*/g, "").trim();
294792
295165
  if (!cleaned) return null;
294793
295166
  const ready = await this.ensureLuxttsDaemon();
294794
295167
  if (!ready) return null;
294795
- const wavPath = join73(tmpdir16(), `oa-luxtts-${Date.now()}-${Math.random().toString(36).slice(2, 6)}.wav`);
295168
+ const wavPath = join74(tmpdir16(), `oa-luxtts-${Date.now()}-${Math.random().toString(36).slice(2, 6)}.wav`);
294796
295169
  try {
294797
295170
  await this.luxttsRequest({
294798
295171
  action: "synthesize",
@@ -294804,14 +295177,14 @@ if __name__ == '__main__':
294804
295177
  } catch {
294805
295178
  return null;
294806
295179
  }
294807
- return existsSync58(wavPath) ? wavPath : null;
295180
+ return existsSync59(wavPath) ? wavPath : null;
294808
295181
  }
294809
295182
  /**
294810
295183
  * Post-process (fade-in, volume, pitch, stereo) and play a LuxTTS WAV file.
294811
295184
  * Cleans up the WAV file after playback.
294812
295185
  */
294813
295186
  async postProcessAndPlayLuxtts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
294814
- if (!existsSync58(wavPath)) return;
295187
+ if (!existsSync59(wavPath)) return;
294815
295188
  try {
294816
295189
  const wavData = readFileSync44(wavPath);
294817
295190
  if (wavData.length > 44) {
@@ -294907,12 +295280,12 @@ if __name__ == '__main__':
294907
295280
  * Used for Telegram voice messages and WebSocket streaming.
294908
295281
  */
294909
295282
  async synthesizeLuxttsToBuffer(text) {
294910
- if (!this.luxttsCloneRef || !existsSync58(this.luxttsCloneRef)) return null;
295283
+ if (!this.luxttsCloneRef || !existsSync59(this.luxttsCloneRef)) return null;
294911
295284
  const cleaned = text.replace(/\*/g, "").trim();
294912
295285
  if (!cleaned) return null;
294913
295286
  const ready = await this.ensureLuxttsDaemon();
294914
295287
  if (!ready) return null;
294915
- const wavPath = join73(tmpdir16(), `oa-luxtts-buf-${Date.now()}.wav`);
295288
+ const wavPath = join74(tmpdir16(), `oa-luxtts-buf-${Date.now()}.wav`);
294916
295289
  try {
294917
295290
  await this.luxttsRequest({
294918
295291
  action: "synthesize",
@@ -294924,7 +295297,7 @@ if __name__ == '__main__':
294924
295297
  } catch {
294925
295298
  return null;
294926
295299
  }
294927
- if (!existsSync58(wavPath)) return null;
295300
+ if (!existsSync59(wavPath)) return null;
294928
295301
  try {
294929
295302
  const data = readFileSync44(wavPath);
294930
295303
  unlinkSync14(wavPath);
@@ -294939,13 +295312,13 @@ if __name__ == '__main__':
294939
295312
  async ensureRuntime() {
294940
295313
  if (this.ort) return;
294941
295314
  const arch2 = process.arch;
294942
- mkdirSync29(voiceDir(), { recursive: true });
294943
- const pkgPath = join73(voiceDir(), "package.json");
295315
+ mkdirSync30(voiceDir(), { recursive: true });
295316
+ const pkgPath = join74(voiceDir(), "package.json");
294944
295317
  const expectedDeps = {
294945
295318
  "onnxruntime-node": "^1.21.0",
294946
295319
  "phonemizer": "^1.2.1"
294947
295320
  };
294948
- if (existsSync58(pkgPath)) {
295321
+ if (existsSync59(pkgPath)) {
294949
295322
  try {
294950
295323
  const existing = JSON.parse(readFileSync44(pkgPath, "utf8"));
294951
295324
  if (!existing.dependencies?.["phonemizer"]) {
@@ -294955,18 +295328,18 @@ if __name__ == '__main__':
294955
295328
  } catch {
294956
295329
  }
294957
295330
  }
294958
- if (!existsSync58(pkgPath)) {
295331
+ if (!existsSync59(pkgPath)) {
294959
295332
  writeFileSync28(pkgPath, JSON.stringify({
294960
295333
  name: "open-agents-voice",
294961
295334
  private: true,
294962
295335
  dependencies: expectedDeps
294963
295336
  }, null, 2));
294964
295337
  }
294965
- const voiceRequire = createRequire3(join73(voiceDir(), "index.js"));
295338
+ const voiceRequire = createRequire3(join74(voiceDir(), "index.js"));
294966
295339
  const probeOnnx = async () => {
294967
295340
  try {
294968
295341
  const output = await this.asyncShell(
294969
- `NODE_PATH="${join73(voiceDir(), "node_modules")}" node -e "try { require('onnxruntime-node'); console.log('OK'); } catch(e) { console.log('FAIL:' + e.message); }"`,
295342
+ `NODE_PATH="${join74(voiceDir(), "node_modules")}" node -e "try { require('onnxruntime-node'); console.log('OK'); } catch(e) { console.log('FAIL:' + e.message); }"`,
294970
295343
  15e3
294971
295344
  );
294972
295345
  return output.trim() === "OK";
@@ -294974,8 +295347,8 @@ if __name__ == '__main__':
294974
295347
  return false;
294975
295348
  }
294976
295349
  };
294977
- const onnxNodeModules = join73(voiceDir(), "node_modules", "onnxruntime-node");
294978
- const onnxInstalled = existsSync58(onnxNodeModules);
295350
+ const onnxNodeModules = join74(voiceDir(), "node_modules", "onnxruntime-node");
295351
+ const onnxInstalled = existsSync59(onnxNodeModules);
294979
295352
  if (onnxInstalled && !await probeOnnx()) {
294980
295353
  throw new Error(
294981
295354
  `Voice synthesis unavailable: ONNX runtime crashes on this CPU (${process.platform}-${arch2}). This is a known issue with some ARM SoCs where the CPU vendor is not recognized. Voice feedback will be disabled but all other features work normally.`
@@ -295034,16 +295407,16 @@ Error: ${err instanceof Error ? err.message : String(err)}`
295034
295407
  const dir = modelDir(id);
295035
295408
  const onnxPath = modelOnnxPath(id);
295036
295409
  const configPath2 = modelConfigPath(id);
295037
- if (existsSync58(onnxPath) && existsSync58(configPath2)) return;
295038
- mkdirSync29(dir, { recursive: true });
295039
- if (!existsSync58(configPath2)) {
295410
+ if (existsSync59(onnxPath) && existsSync59(configPath2)) return;
295411
+ mkdirSync30(dir, { recursive: true });
295412
+ if (!existsSync59(configPath2)) {
295040
295413
  renderInfo(`Downloading ${model.label} voice config...`);
295041
295414
  const configResp = await fetch(model.configUrl);
295042
295415
  if (!configResp.ok) throw new Error(`Failed to download config: HTTP ${configResp.status}`);
295043
295416
  const configText = await configResp.text();
295044
295417
  writeFileSync28(configPath2, configText);
295045
295418
  }
295046
- if (!existsSync58(onnxPath)) {
295419
+ if (!existsSync59(onnxPath)) {
295047
295420
  renderInfo(`Downloading ${model.label} voice model (this may take a minute)...`);
295048
295421
  const onnxResp = await fetch(model.onnxUrl);
295049
295422
  if (!onnxResp.ok) throw new Error(`Failed to download model: HTTP ${onnxResp.status}`);
@@ -295076,7 +295449,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`
295076
295449
  if (!this.ort) throw new Error("ONNX runtime not loaded");
295077
295450
  const onnxPath = modelOnnxPath(this.modelId);
295078
295451
  const configPath2 = modelConfigPath(this.modelId);
295079
- if (!existsSync58(onnxPath) || !existsSync58(configPath2)) {
295452
+ if (!existsSync59(onnxPath) || !existsSync59(configPath2)) {
295080
295453
  throw new Error(`Model files not found for ${this.modelId}`);
295081
295454
  }
295082
295455
  this.config = JSON.parse(readFileSync44(configPath2, "utf8"));
@@ -295106,8 +295479,8 @@ Error: ${err instanceof Error ? err.message : String(err)}`
295106
295479
  // packages/cli/src/tui/commands.ts
295107
295480
  import * as nodeOs from "node:os";
295108
295481
  import { execSync as nodeExecSync } from "node:child_process";
295109
- import { existsSync as existsSync59, readFileSync as readFileSync45, writeFileSync as writeFileSync29, mkdirSync as mkdirSync30, readdirSync as readdirSync14, statSync as statSync19, rmSync as rmSync2, appendFileSync as appendFileSync3 } from "node:fs";
295110
- import { join as join74 } from "node:path";
295482
+ import { existsSync as existsSync60, readFileSync as readFileSync45, writeFileSync as writeFileSync29, mkdirSync as mkdirSync31, readdirSync as readdirSync14, statSync as statSync19, rmSync as rmSync2, appendFileSync as appendFileSync3 } from "node:fs";
295483
+ import { join as join75 } from "node:path";
295111
295484
  async function _immediateReregister(newUrl) {
295112
295485
  if (!_lastRegisteredSponsorPayload) return;
295113
295486
  _lastRegisteredSponsorPayload.tunnelUrl = newUrl;
@@ -295620,8 +295993,8 @@ async function handleSlashCommand(input, ctx3) {
295620
295993
  if (out.includes("Connected") || out.includes("Already connected")) {
295621
295994
  renderInfo(out.split("\n").slice(0, 4).join("\n"));
295622
295995
  try {
295623
- const pidFile = join74(ctx3.repoRoot ?? process.cwd(), ".oa", "nexus", "daemon.pid");
295624
- if (existsSync59(pidFile)) {
295996
+ const pidFile = join75(ctx3.repoRoot ?? process.cwd(), ".oa", "nexus", "daemon.pid");
295997
+ if (existsSync60(pidFile)) {
295625
295998
  const pid = parseInt(readFileSync45(pidFile, "utf8").trim(), 10);
295626
295999
  if (pid > 0 && !registry2.daemons.has("Nexus")) {
295627
296000
  registry2.register({ name: "Nexus", pid, startedAt: Date.now(), status: "running" });
@@ -295926,18 +296299,18 @@ async function handleSlashCommand(input, ctx3) {
295926
296299
  let content = "";
295927
296300
  let metadata = {};
295928
296301
  if (shareType === "tool") {
295929
- const toolDir = join74(ctx3.repoRoot, ".oa", "tools");
295930
- const toolFile = join74(toolDir, shareName.endsWith(".json") ? shareName : `${shareName}.json`);
295931
- if (!existsSync59(toolFile)) {
296302
+ const toolDir = join75(ctx3.repoRoot, ".oa", "tools");
296303
+ const toolFile = join75(toolDir, shareName.endsWith(".json") ? shareName : `${shareName}.json`);
296304
+ if (!existsSync60(toolFile)) {
295932
296305
  renderWarning(`Tool not found: ${toolFile}`);
295933
296306
  return "handled";
295934
296307
  }
295935
296308
  content = readFileSync45(toolFile, "utf8");
295936
296309
  metadata = { type: "tool", name: shareName };
295937
296310
  } else if (shareType === "skill") {
295938
- const skillDir = join74(ctx3.repoRoot, ".oa", "skills", shareName);
295939
- const skillFile = join74(skillDir, "SKILL.md");
295940
- if (!existsSync59(skillFile)) {
296311
+ const skillDir = join75(ctx3.repoRoot, ".oa", "skills", shareName);
296312
+ const skillFile = join75(skillDir, "SKILL.md");
296313
+ if (!existsSync60(skillFile)) {
295941
296314
  renderWarning(`Skill not found: ${skillFile}`);
295942
296315
  return "handled";
295943
296316
  }
@@ -295978,8 +296351,8 @@ async function handleSlashCommand(input, ctx3) {
295978
296351
  try {
295979
296352
  const nexus = new NexusTool(ctx3.repoRoot);
295980
296353
  await nexus.execute({ action: "ipfs_pin", cid: importCid, source: "import" });
295981
- const regFile = join74(ctx3.repoRoot, ".oa", "nexus", "ipfs", "cid-registry", "learning-cids.json");
295982
- if (existsSync59(regFile)) {
296354
+ const regFile = join75(ctx3.repoRoot, ".oa", "nexus", "ipfs", "cid-registry", "learning-cids.json");
296355
+ if (existsSync60(regFile)) {
295983
296356
  const reg = JSON.parse(readFileSync45(regFile, "utf8"));
295984
296357
  const pinned = Object.values(reg).some((e2) => e2.cid === importCid && e2.pinned);
295985
296358
  if (pinned) {
@@ -296031,32 +296404,32 @@ async function handleSlashCommand(input, ctx3) {
296031
296404
  lines.push(`
296032
296405
  ${c3.bold("IPFS / Helia Status")}
296033
296406
  `);
296034
- const ipfsDir = join74(ctx3.repoRoot, ".oa", "ipfs");
296035
- const ipfsLocalDir = join74(ipfsDir, "local");
296407
+ const ipfsDir = join75(ctx3.repoRoot, ".oa", "ipfs");
296408
+ const ipfsLocalDir = join75(ipfsDir, "local");
296036
296409
  let ipfsFiles = 0;
296037
296410
  let ipfsBytes = 0;
296038
296411
  let heliaBlocks = 0;
296039
296412
  let heliaBytes = 0;
296040
296413
  try {
296041
- if (existsSync59(ipfsLocalDir)) {
296414
+ if (existsSync60(ipfsLocalDir)) {
296042
296415
  const files = readdirSync14(ipfsLocalDir).filter((f2) => f2.endsWith(".json"));
296043
296416
  ipfsFiles = files.length;
296044
296417
  for (const f2 of files) {
296045
296418
  try {
296046
- ipfsBytes += statSync19(join74(ipfsLocalDir, f2)).size;
296419
+ ipfsBytes += statSync19(join75(ipfsLocalDir, f2)).size;
296047
296420
  } catch {
296048
296421
  }
296049
296422
  }
296050
296423
  }
296051
- const heliaBlockDir = join74(ipfsDir, "blocks");
296052
- if (existsSync59(heliaBlockDir)) {
296424
+ const heliaBlockDir = join75(ipfsDir, "blocks");
296425
+ if (existsSync60(heliaBlockDir)) {
296053
296426
  const walkDir = (dir) => {
296054
296427
  for (const entry of readdirSync14(dir, { withFileTypes: true })) {
296055
- if (entry.isDirectory()) walkDir(join74(dir, entry.name));
296428
+ if (entry.isDirectory()) walkDir(join75(dir, entry.name));
296056
296429
  else {
296057
296430
  heliaBlocks++;
296058
296431
  try {
296059
- heliaBytes += statSync19(join74(dir, entry.name)).size;
296432
+ heliaBytes += statSync19(join75(dir, entry.name)).size;
296060
296433
  } catch {
296061
296434
  }
296062
296435
  }
@@ -296072,8 +296445,8 @@ async function handleSlashCommand(input, ctx3) {
296072
296445
  lines.push(` Blocks: ${c3.bold(String(heliaBlocks))} Size: ${c3.bold(formatFileSize(heliaBytes))}`);
296073
296446
  lines.push(` Backend: ${heliaBlocks > 0 ? c3.green("helia-ipfs") : c3.yellow("sha256-local (Helia not initialized)")}`);
296074
296447
  try {
296075
- const statusFile = join74(ctx3.repoRoot, ".oa", "nexus", "status.json");
296076
- if (existsSync59(statusFile)) {
296448
+ const statusFile = join75(ctx3.repoRoot, ".oa", "nexus", "status.json");
296449
+ if (existsSync60(statusFile)) {
296077
296450
  const status = JSON.parse(readFileSync45(statusFile, "utf8"));
296078
296451
  if (status.peerId) {
296079
296452
  lines.push(`
@@ -296093,10 +296466,10 @@ async function handleSlashCommand(input, ctx3) {
296093
296466
  ${c3.dim("Commands: /ipfs pin <CID> /ipfs publish /ipfs cids")}`);
296094
296467
  lines.push(`
296095
296468
  ${c3.bold("Identity Kernel")}`);
296096
- const idDir = join74(ctx3.repoRoot, ".oa", "identity");
296469
+ const idDir = join75(ctx3.repoRoot, ".oa", "identity");
296097
296470
  try {
296098
- const stateFile = join74(idDir, "self-state.json");
296099
- if (existsSync59(stateFile)) {
296471
+ const stateFile = join75(idDir, "self-state.json");
296472
+ if (existsSync60(stateFile)) {
296100
296473
  const state = JSON.parse(readFileSync45(stateFile, "utf8"));
296101
296474
  lines.push(` Version: ${c3.bold("v" + (state.version ?? "?"))} Sessions: ${c3.bold(String(state.session_count ?? 0))}`);
296102
296475
  if (state.narrative_summary) {
@@ -296106,8 +296479,8 @@ async function handleSlashCommand(input, ctx3) {
296106
296479
  const traits = typeof state.personality_traits === "object" ? Object.entries(state.personality_traits).map(([k, v]) => `${k}:${v}`).join(", ") : String(state.personality_traits);
296107
296480
  lines.push(` Traits: ${c3.dim(traits.slice(0, 60))}`);
296108
296481
  }
296109
- const cidFile = join74(idDir, "cids.json");
296110
- if (existsSync59(cidFile)) {
296482
+ const cidFile = join75(idDir, "cids.json");
296483
+ if (existsSync60(cidFile)) {
296111
296484
  const cids = JSON.parse(readFileSync45(cidFile, "utf8"));
296112
296485
  const lastCid = Array.isArray(cids) ? cids[cids.length - 1] : cids.latest;
296113
296486
  if (lastCid) lines.push(` Last CID: ${c3.dim(String(lastCid).slice(0, 50))}`);
@@ -296120,8 +296493,8 @@ async function handleSlashCommand(input, ctx3) {
296120
296493
  lines.push(`
296121
296494
  ${c3.bold("Memory Sentiment")}`);
296122
296495
  try {
296123
- const metaFile = join74(ctx3.repoRoot, ".oa", "memory", "metabolism", "store.json");
296124
- if (existsSync59(metaFile)) {
296496
+ const metaFile = join75(ctx3.repoRoot, ".oa", "memory", "metabolism", "store.json");
296497
+ if (existsSync60(metaFile)) {
296125
296498
  const store2 = JSON.parse(readFileSync45(metaFile, "utf8"));
296126
296499
  const active = store2.filter((m2) => m2.type !== "quarantine");
296127
296500
  const recoveries = active.filter((m2) => m2.content?.startsWith("[recovery]")).length;
@@ -296140,8 +296513,8 @@ async function handleSlashCommand(input, ctx3) {
296140
296513
  } catch {
296141
296514
  }
296142
296515
  try {
296143
- const dbPath = join74(ctx3.repoRoot, ".oa", "memory", "structured.db");
296144
- if (existsSync59(dbPath)) {
296516
+ const dbPath = join75(ctx3.repoRoot, ".oa", "memory", "structured.db");
296517
+ if (existsSync60(dbPath)) {
296145
296518
  const { initDb: initDb2, closeDb: cDb, ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
296146
296519
  const db = initDb2(dbPath);
296147
296520
  const memStore = new ProceduralMemoryStore2(db);
@@ -296162,8 +296535,8 @@ async function handleSlashCommand(input, ctx3) {
296162
296535
  lines.push(`
296163
296536
  ${c3.bold("Storage Overview")}
296164
296537
  `);
296165
- const oaDir = join74(ctx3.repoRoot, ".oa");
296166
- if (!existsSync59(oaDir)) {
296538
+ const oaDir = join75(ctx3.repoRoot, ".oa");
296539
+ if (!existsSync60(oaDir)) {
296167
296540
  lines.push(` ${c3.dim("No .oa/ directory found.")}`);
296168
296541
  safeLog(lines.join("\n") + "\n");
296169
296542
  return "handled";
@@ -296173,7 +296546,7 @@ async function handleSlashCommand(input, ctx3) {
296173
296546
  const walkStorage = (dir, category) => {
296174
296547
  try {
296175
296548
  for (const entry of readdirSync14(dir, { withFileTypes: true })) {
296176
- const full = join74(dir, entry.name);
296549
+ const full = join75(dir, entry.name);
296177
296550
  if (entry.isDirectory()) {
296178
296551
  const subCat = category || entry.name;
296179
296552
  walkStorage(full, subCat);
@@ -296208,9 +296581,9 @@ async function handleSlashCommand(input, ctx3) {
296208
296581
  for (const entry of readdirSync14(dir, { withFileTypes: true })) {
296209
296582
  const name10 = entry.name.toLowerCase();
296210
296583
  if (sensitivePatterns.some((p2) => name10.includes(p2))) {
296211
- sensitiveFound.push(join74(dir, entry.name).replace(oaDir + "/", ""));
296584
+ sensitiveFound.push(join75(dir, entry.name).replace(oaDir + "/", ""));
296212
296585
  }
296213
- if (entry.isDirectory()) checkSensitive(join74(dir, entry.name));
296586
+ if (entry.isDirectory()) checkSensitive(join75(dir, entry.name));
296214
296587
  }
296215
296588
  } catch {
296216
296589
  }
@@ -296238,8 +296611,8 @@ async function handleSlashCommand(input, ctx3) {
296238
296611
  renderInfo("Supported: .wav .mp3 .flac .ogg (audio\u2192transcribe) | .pdf .txt .md (text\u2192chunk)");
296239
296612
  return "handled";
296240
296613
  }
296241
- const resolvedPath = join74(ctx3.repoRoot, filePath);
296242
- if (!existsSync59(resolvedPath)) {
296614
+ const resolvedPath = join75(ctx3.repoRoot, filePath);
296615
+ if (!existsSync60(resolvedPath)) {
296243
296616
  renderWarning(`File not found: ${resolvedPath}`);
296244
296617
  return "handled";
296245
296618
  }
@@ -296255,9 +296628,9 @@ async function handleSlashCommand(input, ctx3) {
296255
296628
  }
296256
296629
  try {
296257
296630
  const { initDb: initDb2, closeDb: cDb, ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
296258
- const dbDir = join74(ctx3.repoRoot, ".oa", "memory");
296259
- mkdirSync30(dbDir, { recursive: true });
296260
- const db = initDb2(join74(dbDir, "structured.db"));
296631
+ const dbDir = join75(ctx3.repoRoot, ".oa", "memory");
296632
+ mkdirSync31(dbDir, { recursive: true });
296633
+ const db = initDb2(join75(dbDir, "structured.db"));
296261
296634
  const memStore = new ProceduralMemoryStore2(db);
296262
296635
  if (isAudio) {
296263
296636
  renderInfo(`Transcribing: ${filePath}...`);
@@ -296339,9 +296712,9 @@ async function handleSlashCommand(input, ctx3) {
296339
296712
  }
296340
296713
  case "fortemi": {
296341
296714
  const fortemiSubCmd = (arg || "").trim().toLowerCase();
296342
- const fortemiDir = join74(ctx3.repoRoot, "..", "fortemi-react");
296343
- const altFortemiDir = join74(nodeOs.homedir(), "fortemi-react");
296344
- const fDir = existsSync59(fortemiDir) ? fortemiDir : existsSync59(altFortemiDir) ? altFortemiDir : null;
296715
+ const fortemiDir = join75(ctx3.repoRoot, "..", "fortemi-react");
296716
+ const altFortemiDir = join75(nodeOs.homedir(), "fortemi-react");
296717
+ const fDir = existsSync60(fortemiDir) ? fortemiDir : existsSync60(altFortemiDir) ? altFortemiDir : null;
296345
296718
  if (fortemiSubCmd === "start" || fortemiSubCmd === "") {
296346
296719
  if (!fDir) {
296347
296720
  renderWarning("fortemi-react not found adjacent or in home directory.");
@@ -296356,14 +296729,14 @@ async function handleSlashCommand(input, ctx3) {
296356
296729
  // 24h
296357
296730
  nonce: Math.random().toString(36).slice(2, 10)
296358
296731
  };
296359
- const jwtFile = join74(ctx3.repoRoot, ".oa", "fortemi-jwt.json");
296360
- mkdirSync30(join74(ctx3.repoRoot, ".oa"), { recursive: true });
296732
+ const jwtFile = join75(ctx3.repoRoot, ".oa", "fortemi-jwt.json");
296733
+ mkdirSync31(join75(ctx3.repoRoot, ".oa"), { recursive: true });
296361
296734
  writeFileSync29(jwtFile, JSON.stringify(jwtPayload, null, 2));
296362
296735
  renderInfo(`Launching fortemi-react from ${fDir}...`);
296363
296736
  try {
296364
296737
  const { spawn: spawn26 } = __require("node:child_process");
296365
296738
  const child = spawn26("npx", ["vite", "dev", "--host", "0.0.0.0", "--port", "3000"], {
296366
- cwd: join74(fDir, "apps", "standalone"),
296739
+ cwd: join75(fDir, "apps", "standalone"),
296367
296740
  stdio: "ignore",
296368
296741
  detached: true,
296369
296742
  env: { ...process.env, OA_JWT: JSON.stringify(jwtPayload) }
@@ -296372,7 +296745,7 @@ async function handleSlashCommand(input, ctx3) {
296372
296745
  renderInfo("Fortemi-React starting on http://localhost:3000");
296373
296746
  renderInfo(`JWT saved to ${jwtFile}`);
296374
296747
  renderInfo("Memory operations will proxy to fortemi when available.");
296375
- const bridgeFile = join74(ctx3.repoRoot, ".oa", "fortemi-bridge.json");
296748
+ const bridgeFile = join75(ctx3.repoRoot, ".oa", "fortemi-bridge.json");
296376
296749
  writeFileSync29(bridgeFile, JSON.stringify({
296377
296750
  url: "http://localhost:3000",
296378
296751
  pid: child.pid,
@@ -296385,8 +296758,8 @@ async function handleSlashCommand(input, ctx3) {
296385
296758
  return "handled";
296386
296759
  }
296387
296760
  if (fortemiSubCmd === "status") {
296388
- const bridgeFile = join74(ctx3.repoRoot, ".oa", "fortemi-bridge.json");
296389
- if (!existsSync59(bridgeFile)) {
296761
+ const bridgeFile = join75(ctx3.repoRoot, ".oa", "fortemi-bridge.json");
296762
+ if (!existsSync60(bridgeFile)) {
296390
296763
  renderInfo("Fortemi bridge: not connected. Run /fortemi start");
296391
296764
  return "handled";
296392
296765
  }
@@ -296410,14 +296783,14 @@ async function handleSlashCommand(input, ctx3) {
296410
296783
  lines.push(` Process: ${alive ? c3.green("running") : c3.yellow("not running")} (PID ${bridge.pid})`);
296411
296784
  lines.push(` HTTP: ${httpOk ? c3.green("connected") : c3.yellow("unreachable")}`);
296412
296785
  lines.push(` Started: ${bridge.startedAt}`);
296413
- lines.push(` JWT: ${existsSync59(bridge.jwtFile) ? c3.green("valid") : c3.yellow("missing")}`);
296786
+ lines.push(` JWT: ${existsSync60(bridge.jwtFile) ? c3.green("valid") : c3.yellow("missing")}`);
296414
296787
  lines.push("");
296415
296788
  safeLog(lines.join("\n"));
296416
296789
  return "handled";
296417
296790
  }
296418
296791
  if (fortemiSubCmd === "stop") {
296419
- const bridgeFile = join74(ctx3.repoRoot, ".oa", "fortemi-bridge.json");
296420
- if (existsSync59(bridgeFile)) {
296792
+ const bridgeFile = join75(ctx3.repoRoot, ".oa", "fortemi-bridge.json");
296793
+ if (existsSync60(bridgeFile)) {
296421
296794
  const bridge = JSON.parse(readFileSync45(bridgeFile, "utf8"));
296422
296795
  try {
296423
296796
  process.kill(bridge.pid, "SIGTERM");
@@ -297224,9 +297597,9 @@ The session corrections MUST become hard rules in the SKILL.md Rules section.`;
297224
297597
  }
297225
297598
  }
297226
297599
  }
297227
- const _spLogDir = join74(projectDir, ".oa", "sponsor");
297228
- mkdirSync30(_spLogDir, { recursive: true });
297229
- const _spLogFile = join74(_spLogDir, "sponsor-startup.log");
297600
+ const _spLogDir = join75(projectDir, ".oa", "sponsor");
297601
+ mkdirSync31(_spLogDir, { recursive: true });
297602
+ const _spLogFile = join75(_spLogDir, "sponsor-startup.log");
297230
297603
  const _spLog = (msg) => {
297231
297604
  const line = `[${(/* @__PURE__ */ new Date()).toISOString()}] ${msg}
297232
297605
  `;
@@ -297336,17 +297709,17 @@ The session corrections MUST become hard rules in the SKILL.md Rules section.`;
297336
297709
  }
297337
297710
  if (!sponsorUrl && !sponsorPeerId) {
297338
297711
  _spLog("FAILED \u2014 no tunnelUrl and no peerId");
297339
- _spLog(`nexusDir checked: ${join74(projectDir, ".oa", "nexus")}`);
297340
- _spLog(`status.json exists: ${existsSync59(join74(projectDir, ".oa", "nexus", "status.json"))}`);
297341
- _spLog(`daemon.pid exists: ${existsSync59(join74(projectDir, ".oa", "nexus", "daemon.pid"))}`);
297712
+ _spLog(`nexusDir checked: ${join75(projectDir, ".oa", "nexus")}`);
297713
+ _spLog(`status.json exists: ${existsSync60(join75(projectDir, ".oa", "nexus", "status.json"))}`);
297714
+ _spLog(`daemon.pid exists: ${existsSync60(join75(projectDir, ".oa", "nexus", "daemon.pid"))}`);
297342
297715
  try {
297343
- const _statusRaw = readFileSync45(join74(projectDir, ".oa", "nexus", "status.json"), "utf8");
297716
+ const _statusRaw = readFileSync45(join75(projectDir, ".oa", "nexus", "status.json"), "utf8");
297344
297717
  _spLog(`status.json content: ${_statusRaw.slice(0, 300)}`);
297345
297718
  } catch (e2) {
297346
297719
  _spLog(`status.json read error: ${e2}`);
297347
297720
  }
297348
297721
  try {
297349
- const _errRaw = readFileSync45(join74(projectDir, ".oa", "nexus", "daemon.err"), "utf8");
297722
+ const _errRaw = readFileSync45(join75(projectDir, ".oa", "nexus", "daemon.err"), "utf8");
297350
297723
  _spLog(`daemon.err (last 500): ${_errRaw.slice(-500)}`);
297351
297724
  } catch (e2) {
297352
297725
  _spLog(`daemon.err read error: ${e2}`);
@@ -297365,7 +297738,7 @@ The session corrections MUST become hard rules in the SKILL.md Rules section.`;
297365
297738
  try {
297366
297739
  const { homedir: homedir30 } = __require("os");
297367
297740
  const namePath = __require("path").join(homedir30(), ".open-agents", "agent-name");
297368
- if (existsSync59(namePath)) sponsorName = readFileSync45(namePath, "utf8").trim();
297741
+ if (existsSync60(namePath)) sponsorName = readFileSync45(namePath, "utf8").trim();
297369
297742
  } catch {
297370
297743
  }
297371
297744
  if (!sponsorName) sponsorName = "OA Sponsor";
@@ -297440,8 +297813,8 @@ The session corrections MUST become hard rules in the SKILL.md Rules section.`;
297440
297813
  if (result) {
297441
297814
  renderInfo("Sponsor wizard completed.");
297442
297815
  try {
297443
- const nexusPidFile = join74(projectDir, ".oa", "nexus", "daemon.pid");
297444
- if (existsSync59(nexusPidFile)) {
297816
+ const nexusPidFile = join75(projectDir, ".oa", "nexus", "daemon.pid");
297817
+ if (existsSync60(nexusPidFile)) {
297445
297818
  const nPid = parseInt(readFileSync45(nexusPidFile, "utf8").trim(), 10);
297446
297819
  if (nPid > 0) {
297447
297820
  registry2.register({ name: "Nexus", pid: nPid, startedAt: Date.now(), status: "running" });
@@ -298506,13 +298879,13 @@ async function showCohereDashboard(ctx3) {
298506
298879
  } else if (idResult.key === "view") {
298507
298880
  await ik.execute({ operation: "hydrate" });
298508
298881
  } else if (idResult.key === "history") {
298509
- const snapDir = join74(ctx3.repoRoot, ".oa", "identity", "snapshots");
298510
- if (existsSync59(snapDir)) {
298882
+ const snapDir = join75(ctx3.repoRoot, ".oa", "identity", "snapshots");
298883
+ if (existsSync60(snapDir)) {
298511
298884
  const snaps = readdirSync14(snapDir).filter((f2) => f2.endsWith(".json")).sort().reverse();
298512
298885
  const snapItems = snaps.slice(0, 20).map((f2) => ({
298513
298886
  key: f2,
298514
298887
  label: f2.replace(".json", ""),
298515
- detail: `${formatFileSize(statSync19(join74(snapDir, f2)).size)}`
298888
+ detail: `${formatFileSize(statSync19(join75(snapDir, f2)).size)}`
298516
298889
  }));
298517
298890
  if (snapItems.length > 0) {
298518
298891
  await tuiSelect({
@@ -298823,11 +299196,11 @@ async function handleVoiceMenu(ctx3, save2, hasLocal) {
298823
299196
  continue;
298824
299197
  }
298825
299198
  const { basename: basename19, join: pathJoin } = await import("node:path");
298826
- const { copyFileSync: copyFileSync3, mkdirSync: mkdirSync45, existsSync: exists2 } = await import("node:fs");
299199
+ const { copyFileSync: copyFileSync3, mkdirSync: mkdirSync46, existsSync: exists2 } = await import("node:fs");
298827
299200
  const { homedir: homedir30 } = await import("node:os");
298828
299201
  const modelName = basename19(onnxDrop.path, ".onnx").replace(/[^a-zA-Z0-9_-]/g, "-");
298829
299202
  const destDir = pathJoin(homedir30(), ".open-agents", "voice", "models", modelName);
298830
- if (!exists2(destDir)) mkdirSync45(destDir, { recursive: true });
299203
+ if (!exists2(destDir)) mkdirSync46(destDir, { recursive: true });
298831
299204
  copyFileSync3(onnxDrop.path, pathJoin(destDir, "model.onnx"));
298832
299205
  copyFileSync3(jsonDrop.path, pathJoin(destDir, "config.json"));
298833
299206
  const { registerCustomOnnxModel: registerCustomOnnxModel2 } = await Promise.resolve().then(() => (init_voice(), voice_exports));
@@ -299515,10 +299888,10 @@ async function handleSponsoredEndpoint(ctx3, local) {
299515
299888
  }
299516
299889
  } catch {
299517
299890
  }
299518
- const sponsorDir2 = join74(ctx3.repoRoot ?? process.cwd(), ".oa", "sponsor");
299519
- const knownFile = join74(sponsorDir2, "known-sponsors.json");
299891
+ const sponsorDir2 = join75(ctx3.repoRoot ?? process.cwd(), ".oa", "sponsor");
299892
+ const knownFile = join75(sponsorDir2, "known-sponsors.json");
299520
299893
  try {
299521
- if (existsSync59(knownFile)) {
299894
+ if (existsSync60(knownFile)) {
299522
299895
  const saved = JSON.parse(readFileSync45(knownFile, "utf8"));
299523
299896
  for (const s2 of saved) {
299524
299897
  if (!sponsors.some((sp) => sp.url === s2.url)) {
@@ -299573,8 +299946,8 @@ async function handleSponsoredEndpoint(ctx3, local) {
299573
299946
  sponsors.push(...verified);
299574
299947
  if (verified.length > 0) {
299575
299948
  try {
299576
- const { mkdirSync: mkdirSync45, writeFileSync: writeFileSync41 } = __require("node:fs");
299577
- mkdirSync45(sponsorDir2, { recursive: true });
299949
+ const { mkdirSync: mkdirSync46, writeFileSync: writeFileSync41 } = __require("node:fs");
299950
+ mkdirSync46(sponsorDir2, { recursive: true });
299578
299951
  const cached = verified.map((s2) => ({ ...s2, lastVerified: Date.now() }));
299579
299952
  writeFileSync41(knownFile, JSON.stringify(cached, null, 2));
299580
299953
  } catch {
@@ -299669,8 +300042,8 @@ async function handleSponsoredEndpoint(ctx3, local) {
299669
300042
  }
299670
300043
  const saveKey = selected.url || selected.peerId || selected.name;
299671
300044
  try {
299672
- mkdirSync30(sponsorDir2, { recursive: true });
299673
- const existing = existsSync59(knownFile) ? JSON.parse(readFileSync45(knownFile, "utf8")) : [];
300045
+ mkdirSync31(sponsorDir2, { recursive: true });
300046
+ const existing = existsSync60(knownFile) ? JSON.parse(readFileSync45(knownFile, "utf8")) : [];
299674
300047
  const updated = existing.filter((s2) => (s2.url || s2.peerId || s2.name) !== saveKey);
299675
300048
  updated.push(selected);
299676
300049
  writeFileSync29(knownFile, JSON.stringify(updated, null, 2), "utf8");
@@ -299741,10 +300114,10 @@ async function handlePeerEndpoint(peerId, authKey, ctx3, local) {
299741
300114
  const models = await fetchModels(peerUrl, authKey);
299742
300115
  if (models.length > 0) {
299743
300116
  try {
299744
- const { writeFileSync: writeFileSync41, mkdirSync: mkdirSync45 } = await import("node:fs");
299745
- const { join: join96, dirname: dirname28 } = await import("node:path");
299746
- const cachePath = join96(ctx3.repoRoot || process.cwd(), ".oa", "nexus", "peer-models-cache.json");
299747
- mkdirSync45(dirname28(cachePath), { recursive: true });
300117
+ const { writeFileSync: writeFileSync41, mkdirSync: mkdirSync46 } = await import("node:fs");
300118
+ const { join: join97, dirname: dirname28 } = await import("node:path");
300119
+ const cachePath = join97(ctx3.repoRoot || process.cwd(), ".oa", "nexus", "peer-models-cache.json");
300120
+ mkdirSync46(dirname28(cachePath), { recursive: true });
299748
300121
  writeFileSync41(cachePath, JSON.stringify({
299749
300122
  peerId,
299750
300123
  cachedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -299941,17 +300314,17 @@ async function handleUpdate(subcommand, ctx3) {
299941
300314
  try {
299942
300315
  const { createRequire: createRequire7 } = await import("node:module");
299943
300316
  const { fileURLToPath: fileURLToPath19 } = await import("node:url");
299944
- const { dirname: dirname28, join: join96 } = await import("node:path");
299945
- const { existsSync: existsSync77 } = await import("node:fs");
300317
+ const { dirname: dirname28, join: join97 } = await import("node:path");
300318
+ const { existsSync: existsSync78 } = await import("node:fs");
299946
300319
  const req2 = createRequire7(import.meta.url);
299947
300320
  const thisDir = dirname28(fileURLToPath19(import.meta.url));
299948
300321
  const candidates = [
299949
- join96(thisDir, "..", "package.json"),
299950
- join96(thisDir, "..", "..", "package.json"),
299951
- join96(thisDir, "..", "..", "..", "package.json")
300322
+ join97(thisDir, "..", "package.json"),
300323
+ join97(thisDir, "..", "..", "package.json"),
300324
+ join97(thisDir, "..", "..", "..", "package.json")
299952
300325
  ];
299953
300326
  for (const pkgPath of candidates) {
299954
- if (existsSync77(pkgPath)) {
300327
+ if (existsSync78(pkgPath)) {
299955
300328
  const pkg = req2(pkgPath);
299956
300329
  if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli") {
299957
300330
  currentVersion = pkg.version ?? "0.0.0";
@@ -301045,8 +301418,8 @@ var init_commands = __esm({
301045
301418
  });
301046
301419
 
301047
301420
  // packages/cli/src/tui/project-context.ts
301048
- import { existsSync as existsSync60, readFileSync as readFileSync46, readdirSync as readdirSync15 } from "node:fs";
301049
- import { join as join75, basename as basename13 } from "node:path";
301421
+ import { existsSync as existsSync61, readFileSync as readFileSync46, readdirSync as readdirSync15 } from "node:fs";
301422
+ import { join as join76, basename as basename13 } from "node:path";
301050
301423
  import { execSync as execSync49 } from "node:child_process";
301051
301424
  import { homedir as homedir25, platform as platform5, release } from "node:os";
301052
301425
  function getModelTier(modelName) {
@@ -301077,8 +301450,8 @@ function loadProjectMap(repoRoot) {
301077
301450
  if (!hasOaDirectory(repoRoot)) {
301078
301451
  initOaDirectory(repoRoot);
301079
301452
  }
301080
- const mapPath2 = join75(repoRoot, OA_DIR, "context", "project-map.md");
301081
- if (existsSync60(mapPath2)) {
301453
+ const mapPath2 = join76(repoRoot, OA_DIR, "context", "project-map.md");
301454
+ if (existsSync61(mapPath2)) {
301082
301455
  try {
301083
301456
  const content = readFileSync46(mapPath2, "utf-8");
301084
301457
  return content;
@@ -301119,27 +301492,27 @@ ${log22}`);
301119
301492
  }
301120
301493
  function loadMemoryContext(repoRoot) {
301121
301494
  const sections = [];
301122
- const oaMemDir = join75(repoRoot, OA_DIR, "memory");
301495
+ const oaMemDir = join76(repoRoot, OA_DIR, "memory");
301123
301496
  const oaEntries = loadMemoryDir(oaMemDir, "project");
301124
301497
  if (oaEntries) sections.push(oaEntries);
301125
- const legacyMemDir = join75(repoRoot, ".open-agents", "memory");
301126
- if (legacyMemDir !== oaMemDir && existsSync60(legacyMemDir)) {
301498
+ const legacyMemDir = join76(repoRoot, ".open-agents", "memory");
301499
+ if (legacyMemDir !== oaMemDir && existsSync61(legacyMemDir)) {
301127
301500
  const legacyEntries = loadMemoryDir(legacyMemDir, "project/legacy");
301128
301501
  if (legacyEntries) sections.push(legacyEntries);
301129
301502
  }
301130
- const globalMemDir = join75(homedir25(), ".open-agents", "memory");
301503
+ const globalMemDir = join76(homedir25(), ".open-agents", "memory");
301131
301504
  const globalEntries = loadMemoryDir(globalMemDir, "global");
301132
301505
  if (globalEntries) sections.push(globalEntries);
301133
301506
  return sections.join("\n\n");
301134
301507
  }
301135
301508
  function loadMemoryDir(memDir, scope) {
301136
- if (!existsSync60(memDir)) return "";
301509
+ if (!existsSync61(memDir)) return "";
301137
301510
  const lines = [];
301138
301511
  try {
301139
301512
  const files = readdirSync15(memDir).filter((f2) => f2.endsWith(".json"));
301140
301513
  for (const file of files.slice(0, 10)) {
301141
301514
  try {
301142
- const raw = readFileSync46(join75(memDir, file), "utf-8");
301515
+ const raw = readFileSync46(join76(memDir, file), "utf-8");
301143
301516
  const entries = JSON.parse(raw);
301144
301517
  const topic = basename13(file, ".json");
301145
301518
  const keys = Object.keys(entries);
@@ -301641,8 +302014,8 @@ __export(banner_exports, {
301641
302014
  saveBannerDesign: () => saveBannerDesign,
301642
302015
  setGridText: () => setGridText
301643
302016
  });
301644
- import { existsSync as existsSync61, readFileSync as readFileSync47, writeFileSync as writeFileSync30, mkdirSync as mkdirSync31 } from "node:fs";
301645
- import { join as join76 } from "node:path";
302017
+ import { existsSync as existsSync62, readFileSync as readFileSync47, writeFileSync as writeFileSync30, mkdirSync as mkdirSync32 } from "node:fs";
302018
+ import { join as join77 } from "node:path";
301646
302019
  function generateMnemonic(seed) {
301647
302020
  let h = 2166136261;
301648
302021
  for (let i2 = 0; i2 < seed.length; i2++) {
@@ -301772,13 +302145,13 @@ function createSponsorBanner(sponsorName, tagline, primaryColor = 214, bgColor =
301772
302145
  };
301773
302146
  }
301774
302147
  function saveBannerDesign(workDir, design) {
301775
- const dir = join76(workDir, ".oa", "banners");
301776
- mkdirSync31(dir, { recursive: true });
301777
- writeFileSync30(join76(dir, `${design.id}.json`), JSON.stringify(design, null, 2), "utf8");
302148
+ const dir = join77(workDir, ".oa", "banners");
302149
+ mkdirSync32(dir, { recursive: true });
302150
+ writeFileSync30(join77(dir, `${design.id}.json`), JSON.stringify(design, null, 2), "utf8");
301778
302151
  }
301779
302152
  function loadBannerDesign(workDir, id) {
301780
- const file = join76(workDir, ".oa", "banners", `${id}.json`);
301781
- if (!existsSync61(file)) return null;
302153
+ const file = join77(workDir, ".oa", "banners", `${id}.json`);
302154
+ if (!existsSync62(file)) return null;
301782
302155
  try {
301783
302156
  return JSON.parse(readFileSync47(file, "utf8"));
301784
302157
  } catch {
@@ -301786,8 +302159,8 @@ function loadBannerDesign(workDir, id) {
301786
302159
  }
301787
302160
  }
301788
302161
  function listBannerDesigns(workDir) {
301789
- const dir = join76(workDir, ".oa", "banners");
301790
- if (!existsSync61(dir)) return [];
302162
+ const dir = join77(workDir, ".oa", "banners");
302163
+ if (!existsSync62(dir)) return [];
301791
302164
  try {
301792
302165
  const { readdirSync: readdirSync26 } = __require("node:fs");
301793
302166
  return readdirSync26(dir).filter((f2) => f2.endsWith(".json")).map((f2) => f2.replace(".json", ""));
@@ -302094,21 +302467,21 @@ var init_banner = __esm({
302094
302467
  });
302095
302468
 
302096
302469
  // packages/cli/src/tui/carousel-descriptors.ts
302097
- import { existsSync as existsSync62, readFileSync as readFileSync48, writeFileSync as writeFileSync31, mkdirSync as mkdirSync32, readdirSync as readdirSync16 } from "node:fs";
302098
- import { join as join77, basename as basename14 } from "node:path";
302470
+ import { existsSync as existsSync63, readFileSync as readFileSync48, writeFileSync as writeFileSync31, mkdirSync as mkdirSync33, readdirSync as readdirSync16 } from "node:fs";
302471
+ import { join as join78, basename as basename14 } from "node:path";
302099
302472
  function loadToolProfile(repoRoot) {
302100
- const filePath = join77(repoRoot, OA_DIR, "context", TOOL_PROFILE_FILE);
302473
+ const filePath = join78(repoRoot, OA_DIR, "context", TOOL_PROFILE_FILE);
302101
302474
  try {
302102
- if (!existsSync62(filePath)) return null;
302475
+ if (!existsSync63(filePath)) return null;
302103
302476
  return JSON.parse(readFileSync48(filePath, "utf-8"));
302104
302477
  } catch {
302105
302478
  return null;
302106
302479
  }
302107
302480
  }
302108
302481
  function saveToolProfile(repoRoot, profile) {
302109
- const contextDir = join77(repoRoot, OA_DIR, "context");
302110
- mkdirSync32(contextDir, { recursive: true });
302111
- writeFileSync31(join77(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
302482
+ const contextDir = join78(repoRoot, OA_DIR, "context");
302483
+ mkdirSync33(contextDir, { recursive: true });
302484
+ writeFileSync31(join78(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
302112
302485
  }
302113
302486
  function categorizeToolCall(toolName) {
302114
302487
  for (const cat2 of TOOL_CATEGORIES) {
@@ -302163,9 +302536,9 @@ function weightedColor(profile) {
302163
302536
  return selectedCat.colors[Math.floor(Math.random() * selectedCat.colors.length)];
302164
302537
  }
302165
302538
  function loadCachedDescriptors(repoRoot) {
302166
- const filePath = join77(repoRoot, OA_DIR, "context", DESCRIPTOR_FILE);
302539
+ const filePath = join78(repoRoot, OA_DIR, "context", DESCRIPTOR_FILE);
302167
302540
  try {
302168
- if (!existsSync62(filePath)) return null;
302541
+ if (!existsSync63(filePath)) return null;
302169
302542
  const cached = JSON.parse(readFileSync48(filePath, "utf-8"));
302170
302543
  return cached.phrases.length > 0 ? cached.phrases : null;
302171
302544
  } catch {
@@ -302173,14 +302546,14 @@ function loadCachedDescriptors(repoRoot) {
302173
302546
  }
302174
302547
  }
302175
302548
  function saveCachedDescriptors(repoRoot, phrases, sourceHash) {
302176
- const contextDir = join77(repoRoot, OA_DIR, "context");
302177
- mkdirSync32(contextDir, { recursive: true });
302549
+ const contextDir = join78(repoRoot, OA_DIR, "context");
302550
+ mkdirSync33(contextDir, { recursive: true });
302178
302551
  const cached = {
302179
302552
  phrases,
302180
302553
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
302181
302554
  sourceHash
302182
302555
  };
302183
- writeFileSync31(join77(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
302556
+ writeFileSync31(join78(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
302184
302557
  }
302185
302558
  function generateDescriptors(repoRoot) {
302186
302559
  const profile = loadToolProfile(repoRoot);
@@ -302227,9 +302600,9 @@ function generateDescriptors(repoRoot) {
302227
302600
  return phrases;
302228
302601
  }
302229
302602
  function extractFromPackageJson(repoRoot, tags) {
302230
- const pkgPath = join77(repoRoot, "package.json");
302603
+ const pkgPath = join78(repoRoot, "package.json");
302231
302604
  try {
302232
- if (!existsSync62(pkgPath)) return;
302605
+ if (!existsSync63(pkgPath)) return;
302233
302606
  const pkg = JSON.parse(readFileSync48(pkgPath, "utf-8"));
302234
302607
  if (pkg.name && typeof pkg.name === "string") {
302235
302608
  const parts = pkg.name.replace(/^@/, "").split("/");
@@ -302271,7 +302644,7 @@ function extractFromManifests(repoRoot, tags) {
302271
302644
  { file: ".github/workflows", tag: "ci/cd" }
302272
302645
  ];
302273
302646
  for (const check of manifestChecks) {
302274
- if (existsSync62(join77(repoRoot, check.file))) {
302647
+ if (existsSync63(join78(repoRoot, check.file))) {
302275
302648
  tags.push(check.tag);
302276
302649
  }
302277
302650
  }
@@ -302293,15 +302666,15 @@ function extractFromSessions(repoRoot, tags) {
302293
302666
  }
302294
302667
  }
302295
302668
  function extractFromMemory(repoRoot, tags) {
302296
- const memoryDir = join77(repoRoot, OA_DIR, "memory");
302669
+ const memoryDir = join78(repoRoot, OA_DIR, "memory");
302297
302670
  try {
302298
- if (!existsSync62(memoryDir)) return;
302671
+ if (!existsSync63(memoryDir)) return;
302299
302672
  const files = readdirSync16(memoryDir).filter((f2) => f2.endsWith(".json"));
302300
302673
  for (const file of files) {
302301
302674
  const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
302302
302675
  tags.push(topic);
302303
302676
  try {
302304
- const data = JSON.parse(readFileSync48(join77(memoryDir, file), "utf-8"));
302677
+ const data = JSON.parse(readFileSync48(join78(memoryDir, file), "utf-8"));
302305
302678
  if (data && typeof data === "object") {
302306
302679
  const keys = Object.keys(data).slice(0, 3);
302307
302680
  for (const key of keys) {
@@ -302995,13 +303368,13 @@ var init_stream_renderer = __esm({
302995
303368
  });
302996
303369
 
302997
303370
  // packages/cli/src/tui/edit-history.ts
302998
- import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync33 } from "node:fs";
302999
- import { join as join78 } from "node:path";
303371
+ import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync34 } from "node:fs";
303372
+ import { join as join79 } from "node:path";
303000
303373
  function createEditHistoryLogger(repoRoot, sessionId) {
303001
- const historyDir = join78(repoRoot, ".oa", "history");
303002
- const logPath2 = join78(historyDir, "edits.jsonl");
303374
+ const historyDir = join79(repoRoot, ".oa", "history");
303375
+ const logPath2 = join79(historyDir, "edits.jsonl");
303003
303376
  try {
303004
- mkdirSync33(historyDir, { recursive: true });
303377
+ mkdirSync34(historyDir, { recursive: true });
303005
303378
  } catch {
303006
303379
  }
303007
303380
  function logToolCall(toolName, toolArgs, success) {
@@ -303109,14 +303482,14 @@ var init_edit_history = __esm({
303109
303482
  });
303110
303483
 
303111
303484
  // packages/cli/src/tui/promptLoader.ts
303112
- import { readFileSync as readFileSync49, existsSync as existsSync63 } from "node:fs";
303113
- import { join as join79, dirname as dirname23 } from "node:path";
303485
+ import { readFileSync as readFileSync49, existsSync as existsSync64 } from "node:fs";
303486
+ import { join as join80, dirname as dirname23 } from "node:path";
303114
303487
  import { fileURLToPath as fileURLToPath14 } from "node:url";
303115
303488
  function loadPrompt3(promptPath, vars) {
303116
303489
  let content = cache6.get(promptPath);
303117
303490
  if (content === void 0) {
303118
- const fullPath = join79(PROMPTS_DIR3, promptPath);
303119
- if (!existsSync63(fullPath)) {
303491
+ const fullPath = join80(PROMPTS_DIR3, promptPath);
303492
+ if (!existsSync64(fullPath)) {
303120
303493
  throw new Error(`Prompt file not found: ${fullPath}`);
303121
303494
  }
303122
303495
  content = readFileSync49(fullPath, "utf-8");
@@ -303131,16 +303504,16 @@ var init_promptLoader3 = __esm({
303131
303504
  "use strict";
303132
303505
  __filename5 = fileURLToPath14(import.meta.url);
303133
303506
  __dirname7 = dirname23(__filename5);
303134
- devPath2 = join79(__dirname7, "..", "..", "prompts");
303135
- publishedPath2 = join79(__dirname7, "..", "prompts");
303136
- PROMPTS_DIR3 = existsSync63(devPath2) ? devPath2 : publishedPath2;
303507
+ devPath2 = join80(__dirname7, "..", "..", "prompts");
303508
+ publishedPath2 = join80(__dirname7, "..", "prompts");
303509
+ PROMPTS_DIR3 = existsSync64(devPath2) ? devPath2 : publishedPath2;
303137
303510
  cache6 = /* @__PURE__ */ new Map();
303138
303511
  }
303139
303512
  });
303140
303513
 
303141
303514
  // packages/cli/src/tui/dream-engine.ts
303142
- import { mkdirSync as mkdirSync34, writeFileSync as writeFileSync32, readFileSync as readFileSync50, existsSync as existsSync64, readdirSync as readdirSync17 } from "node:fs";
303143
- import { join as join80, basename as basename15 } from "node:path";
303515
+ import { mkdirSync as mkdirSync35, writeFileSync as writeFileSync32, readFileSync as readFileSync50, existsSync as existsSync65, readdirSync as readdirSync17 } from "node:fs";
303516
+ import { join as join81, basename as basename15 } from "node:path";
303144
303517
  import { execSync as execSync50 } from "node:child_process";
303145
303518
  function setDreamWriteContent(fn) {
303146
303519
  _dreamWriteContent = fn;
@@ -303153,8 +303526,8 @@ function dreamWrite(fn) {
303153
303526
  }
303154
303527
  }
303155
303528
  function loadAutoresearchMemory(repoRoot) {
303156
- const memoryPath = join80(repoRoot, ".oa", "memory", "autoresearch.json");
303157
- if (!existsSync64(memoryPath)) return "";
303529
+ const memoryPath = join81(repoRoot, ".oa", "memory", "autoresearch.json");
303530
+ if (!existsSync65(memoryPath)) return "";
303158
303531
  try {
303159
303532
  const raw = readFileSync50(memoryPath, "utf-8");
303160
303533
  const data = JSON.parse(raw);
@@ -303352,13 +303725,13 @@ var init_dream_engine = __esm({
303352
303725
  const rawPath = String(args["path"] ?? "");
303353
303726
  const content = String(args["content"] ?? "");
303354
303727
  if (!rawPath) return { success: false, output: "", error: "path is required", durationMs: Date.now() - start2 };
303355
- const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join80(this.autoresearchDir, basename15(rawPath)) : join80(this.autoresearchDir, rawPath);
303728
+ const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join81(this.autoresearchDir, basename15(rawPath)) : join81(this.autoresearchDir, rawPath);
303356
303729
  if (!targetPath.startsWith(this.autoresearchDir)) {
303357
303730
  return { success: false, output: "", error: "Autoresearch mode: writes are confined to .oa/autoresearch/", durationMs: Date.now() - start2 };
303358
303731
  }
303359
303732
  try {
303360
- const dir = join80(targetPath, "..");
303361
- mkdirSync34(dir, { recursive: true });
303733
+ const dir = join81(targetPath, "..");
303734
+ mkdirSync35(dir, { recursive: true });
303362
303735
  writeFileSync32(targetPath, content, "utf-8");
303363
303736
  return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start2 };
303364
303737
  } catch (err) {
@@ -303386,12 +303759,12 @@ var init_dream_engine = __esm({
303386
303759
  const rawPath = String(args["path"] ?? "");
303387
303760
  const oldStr = String(args["old_string"] ?? "");
303388
303761
  const newStr = String(args["new_string"] ?? "");
303389
- const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join80(this.autoresearchDir, basename15(rawPath)) : join80(this.autoresearchDir, rawPath);
303762
+ const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join81(this.autoresearchDir, basename15(rawPath)) : join81(this.autoresearchDir, rawPath);
303390
303763
  if (!targetPath.startsWith(this.autoresearchDir)) {
303391
303764
  return { success: false, output: "", error: "Autoresearch mode: edits are confined to .oa/autoresearch/", durationMs: Date.now() - start2 };
303392
303765
  }
303393
303766
  try {
303394
- if (!existsSync64(targetPath)) {
303767
+ if (!existsSync65(targetPath)) {
303395
303768
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
303396
303769
  }
303397
303770
  let content = readFileSync50(targetPath, "utf-8");
@@ -303438,13 +303811,13 @@ var init_dream_engine = __esm({
303438
303811
  const rawPath = String(args["path"] ?? "");
303439
303812
  const content = String(args["content"] ?? "");
303440
303813
  if (!rawPath) return { success: false, output: "", error: "path is required", durationMs: Date.now() - start2 };
303441
- const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join80(this.dreamsDir, basename15(rawPath)) : join80(this.dreamsDir, rawPath);
303814
+ const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join81(this.dreamsDir, basename15(rawPath)) : join81(this.dreamsDir, rawPath);
303442
303815
  if (!targetPath.startsWith(this.dreamsDir)) {
303443
303816
  return { success: false, output: "", error: "Dream mode: writes are confined to .oa/dreams/", durationMs: Date.now() - start2 };
303444
303817
  }
303445
303818
  try {
303446
- const dir = join80(targetPath, "..");
303447
- mkdirSync34(dir, { recursive: true });
303819
+ const dir = join81(targetPath, "..");
303820
+ mkdirSync35(dir, { recursive: true });
303448
303821
  writeFileSync32(targetPath, content, "utf-8");
303449
303822
  return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start2 };
303450
303823
  } catch (err) {
@@ -303472,12 +303845,12 @@ var init_dream_engine = __esm({
303472
303845
  const rawPath = String(args["path"] ?? "");
303473
303846
  const oldStr = String(args["old_string"] ?? "");
303474
303847
  const newStr = String(args["new_string"] ?? "");
303475
- const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join80(this.dreamsDir, basename15(rawPath)) : join80(this.dreamsDir, rawPath);
303848
+ const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join81(this.dreamsDir, basename15(rawPath)) : join81(this.dreamsDir, rawPath);
303476
303849
  if (!targetPath.startsWith(this.dreamsDir)) {
303477
303850
  return { success: false, output: "", error: "Dream mode: edits are confined to .oa/dreams/", durationMs: Date.now() - start2 };
303478
303851
  }
303479
303852
  try {
303480
- if (!existsSync64(targetPath)) {
303853
+ if (!existsSync65(targetPath)) {
303481
303854
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start2 };
303482
303855
  }
303483
303856
  let content = readFileSync50(targetPath, "utf-8");
@@ -303533,7 +303906,7 @@ var init_dream_engine = __esm({
303533
303906
  constructor(config, repoRoot) {
303534
303907
  this.config = config;
303535
303908
  this.repoRoot = repoRoot;
303536
- this.dreamsDir = join80(repoRoot, ".oa", "dreams");
303909
+ this.dreamsDir = join81(repoRoot, ".oa", "dreams");
303537
303910
  this.state = {
303538
303911
  mode: "default",
303539
303912
  active: false,
@@ -303570,7 +303943,7 @@ var init_dream_engine = __esm({
303570
303943
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
303571
303944
  results: []
303572
303945
  };
303573
- mkdirSync34(this.dreamsDir, { recursive: true });
303946
+ mkdirSync35(this.dreamsDir, { recursive: true });
303574
303947
  this.saveDreamState();
303575
303948
  try {
303576
303949
  for (let cycle = 1; cycle <= totalCycles; cycle++) {
@@ -303642,7 +304015,7 @@ ${result.summary}`;
303642
304015
  if (mode !== "default" || cycle === totalCycles) {
303643
304016
  renderDreamContraction(cycle);
303644
304017
  const cycleSummary = this.buildCycleSummary(cycle, previousFindings);
303645
- const summaryPath = join80(this.dreamsDir, `cycle-${cycle}-summary.md`);
304018
+ const summaryPath = join81(this.dreamsDir, `cycle-${cycle}-summary.md`);
303646
304019
  writeFileSync32(summaryPath, cycleSummary, "utf-8");
303647
304020
  }
303648
304021
  if (mode === "lucid" && !this.abortController.signal.aborted) {
@@ -303882,7 +304255,7 @@ After synthesis, call task_complete with the final prioritized summary.`,
303882
304255
  }
303883
304256
  /** Build role-specific tool sets for swarm agents */
303884
304257
  buildSwarmTools(role, _workspace) {
303885
- const autoresearchDir = join80(this.repoRoot, ".oa", "autoresearch");
304258
+ const autoresearchDir = join81(this.repoRoot, ".oa", "autoresearch");
303886
304259
  const taskComplete = this.createSwarmTaskCompleteTool(role);
303887
304260
  switch (role) {
303888
304261
  case "researcher": {
@@ -304281,7 +304654,7 @@ Call task_complete with a human-readable summary of the autoresearch session.`,
304281
304654
  workspace,
304282
304655
  onEvent
304283
304656
  );
304284
- const reportPath = join80(this.dreamsDir, `cycle-${cycleNum}-autoresearch-report.md`);
304657
+ const reportPath = join81(this.dreamsDir, `cycle-${cycleNum}-autoresearch-report.md`);
304285
304658
  const report = `# Autoresearch Swarm Report \u2014 Cycle ${cycleNum}
304286
304659
 
304287
304660
  **Date**: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}
@@ -304303,7 +304676,7 @@ ${summaryResult}
304303
304676
  *Generated by open-agents autoresearch swarm*
304304
304677
  `;
304305
304678
  try {
304306
- mkdirSync34(this.dreamsDir, { recursive: true });
304679
+ mkdirSync35(this.dreamsDir, { recursive: true });
304307
304680
  writeFileSync32(reportPath, report, "utf-8");
304308
304681
  } catch {
304309
304682
  }
@@ -304370,9 +304743,9 @@ ${summaryResult}
304370
304743
  }
304371
304744
  /** Save workspace backup for lucid mode */
304372
304745
  saveVersionCheckpoint(cycle) {
304373
- const checkpointDir = join80(this.dreamsDir, "checkpoints", `cycle-${cycle}`);
304746
+ const checkpointDir = join81(this.dreamsDir, "checkpoints", `cycle-${cycle}`);
304374
304747
  try {
304375
- mkdirSync34(checkpointDir, { recursive: true });
304748
+ mkdirSync35(checkpointDir, { recursive: true });
304376
304749
  try {
304377
304750
  const gitStatus = execSync50("git status --porcelain", {
304378
304751
  cwd: this.repoRoot,
@@ -304389,11 +304762,11 @@ ${summaryResult}
304389
304762
  encoding: "utf-8",
304390
304763
  timeout: 5e3
304391
304764
  }).trim();
304392
- writeFileSync32(join80(checkpointDir, "git-status.txt"), gitStatus, "utf-8");
304393
- writeFileSync32(join80(checkpointDir, "git-diff.patch"), gitDiff, "utf-8");
304394
- writeFileSync32(join80(checkpointDir, "git-hash.txt"), gitHash, "utf-8");
304765
+ writeFileSync32(join81(checkpointDir, "git-status.txt"), gitStatus, "utf-8");
304766
+ writeFileSync32(join81(checkpointDir, "git-diff.patch"), gitDiff, "utf-8");
304767
+ writeFileSync32(join81(checkpointDir, "git-hash.txt"), gitHash, "utf-8");
304395
304768
  writeFileSync32(
304396
- join80(checkpointDir, "checkpoint.json"),
304769
+ join81(checkpointDir, "checkpoint.json"),
304397
304770
  JSON.stringify({
304398
304771
  cycle,
304399
304772
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -304405,7 +304778,7 @@ ${summaryResult}
304405
304778
  renderInfo(`Checkpoint saved: cycle ${cycle} (${gitHash.slice(0, 8)})`);
304406
304779
  } catch {
304407
304780
  writeFileSync32(
304408
- join80(checkpointDir, "checkpoint.json"),
304781
+ join81(checkpointDir, "checkpoint.json"),
304409
304782
  JSON.stringify({ cycle, timestamp: (/* @__PURE__ */ new Date()).toISOString(), mode: this.state.mode }, null, 2),
304410
304783
  "utf-8"
304411
304784
  );
@@ -304466,7 +304839,7 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
304466
304839
  ---
304467
304840
  *Auto-generated by open-agents dream engine*
304468
304841
  `;
304469
- writeFileSync32(join80(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
304842
+ writeFileSync32(join81(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
304470
304843
  } catch {
304471
304844
  }
304472
304845
  }
@@ -304487,8 +304860,8 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
304487
304860
  results: []
304488
304861
  };
304489
304862
  renderInfo("Memory consolidation starting \u2014 Phase 1: Orient \u2192 Phase 2: Gather \u2192 Phase 3: Consolidate \u2192 Phase 4: Prune");
304490
- const memoryDir = join80(this.repoRoot, ".oa", "memory");
304491
- mkdirSync34(memoryDir, { recursive: true });
304863
+ const memoryDir = join81(this.repoRoot, ".oa", "memory");
304864
+ mkdirSync35(memoryDir, { recursive: true });
304492
304865
  let prompt;
304493
304866
  try {
304494
304867
  prompt = loadPrompt3("tui/dream-consolidate.md", {
@@ -304553,7 +304926,7 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
304553
304926
  });
304554
304927
  try {
304555
304928
  writeFileSync32(
304556
- join80(memoryDir, ".last-consolidation"),
304929
+ join81(memoryDir, ".last-consolidation"),
304557
304930
  JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString(), summary: result.summary?.slice(0, 500) }) + "\n"
304558
304931
  );
304559
304932
  } catch {
@@ -304571,7 +304944,7 @@ ${files.map((f2) => `- [\`${f2}\`](./${f2})`).join("\n")}
304571
304944
  saveDreamState() {
304572
304945
  try {
304573
304946
  writeFileSync32(
304574
- join80(this.dreamsDir, "dream-state.json"),
304947
+ join81(this.dreamsDir, "dream-state.json"),
304575
304948
  JSON.stringify(this.state, null, 2) + "\n",
304576
304949
  "utf-8"
304577
304950
  );
@@ -304941,8 +305314,8 @@ var init_bless_engine = __esm({
304941
305314
  });
304942
305315
 
304943
305316
  // packages/cli/src/tui/dmn-engine.ts
304944
- import { existsSync as existsSync65, readFileSync as readFileSync51, writeFileSync as writeFileSync33, mkdirSync as mkdirSync35, readdirSync as readdirSync18, unlinkSync as unlinkSync15 } from "node:fs";
304945
- import { join as join81, basename as basename16 } from "node:path";
305317
+ import { existsSync as existsSync66, readFileSync as readFileSync51, writeFileSync as writeFileSync33, mkdirSync as mkdirSync36, readdirSync as readdirSync18, unlinkSync as unlinkSync15 } from "node:fs";
305318
+ import { join as join82, basename as basename16 } from "node:path";
304946
305319
  function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities, competence, reflectionBuffer) {
304947
305320
  const competenceReport = competence.length > 0 ? competence.map((c7) => {
304948
305321
  const rate = c7.attempts > 0 ? Math.round(c7.successes / c7.attempts * 100) : 0;
@@ -305046,9 +305419,9 @@ var init_dmn_engine = __esm({
305046
305419
  constructor(config, repoRoot) {
305047
305420
  this.config = config;
305048
305421
  this.repoRoot = repoRoot;
305049
- this.stateDir = join81(repoRoot, ".oa", "dmn");
305050
- this.historyDir = join81(repoRoot, ".oa", "dmn", "cycles");
305051
- mkdirSync35(this.historyDir, { recursive: true });
305422
+ this.stateDir = join82(repoRoot, ".oa", "dmn");
305423
+ this.historyDir = join82(repoRoot, ".oa", "dmn", "cycles");
305424
+ mkdirSync36(this.historyDir, { recursive: true });
305052
305425
  this.loadState();
305053
305426
  }
305054
305427
  state = {
@@ -305680,11 +306053,11 @@ OUTPUT: Call task_complete with JSON:
305680
306053
  async gatherMemoryTopics() {
305681
306054
  const topics = [];
305682
306055
  const dirs = [
305683
- join81(this.repoRoot, ".oa", "memory"),
305684
- join81(this.repoRoot, ".open-agents", "memory")
306056
+ join82(this.repoRoot, ".oa", "memory"),
306057
+ join82(this.repoRoot, ".open-agents", "memory")
305685
306058
  ];
305686
306059
  for (const dir of dirs) {
305687
- if (!existsSync65(dir)) continue;
306060
+ if (!existsSync66(dir)) continue;
305688
306061
  try {
305689
306062
  const files = readdirSync18(dir).filter((f2) => f2.endsWith(".json"));
305690
306063
  for (const f2 of files) {
@@ -305698,8 +306071,8 @@ OUTPUT: Call task_complete with JSON:
305698
306071
  }
305699
306072
  // ── State persistence ─────────────────────────────────────────────────
305700
306073
  loadState() {
305701
- const path5 = join81(this.stateDir, "state.json");
305702
- if (existsSync65(path5)) {
306074
+ const path5 = join82(this.stateDir, "state.json");
306075
+ if (existsSync66(path5)) {
305703
306076
  try {
305704
306077
  this.state = JSON.parse(readFileSync51(path5, "utf-8"));
305705
306078
  } catch {
@@ -305709,7 +306082,7 @@ OUTPUT: Call task_complete with JSON:
305709
306082
  saveState() {
305710
306083
  try {
305711
306084
  writeFileSync33(
305712
- join81(this.stateDir, "state.json"),
306085
+ join82(this.stateDir, "state.json"),
305713
306086
  JSON.stringify(this.state, null, 2) + "\n",
305714
306087
  "utf-8"
305715
306088
  );
@@ -305720,7 +306093,7 @@ OUTPUT: Call task_complete with JSON:
305720
306093
  try {
305721
306094
  const filename = `cycle-${result.cycleNumber}-${Date.now()}.json`;
305722
306095
  writeFileSync33(
305723
- join81(this.historyDir, filename),
306096
+ join82(this.historyDir, filename),
305724
306097
  JSON.stringify(result, null, 2) + "\n",
305725
306098
  "utf-8"
305726
306099
  );
@@ -305728,7 +306101,7 @@ OUTPUT: Call task_complete with JSON:
305728
306101
  if (files.length > 50) {
305729
306102
  for (const old of files.slice(0, files.length - 50)) {
305730
306103
  try {
305731
- unlinkSync15(join81(this.historyDir, old));
306104
+ unlinkSync15(join82(this.historyDir, old));
305732
306105
  } catch {
305733
306106
  }
305734
306107
  }
@@ -305741,8 +306114,8 @@ OUTPUT: Call task_complete with JSON:
305741
306114
  });
305742
306115
 
305743
306116
  // packages/cli/src/tui/snr-engine.ts
305744
- import { existsSync as existsSync66, readdirSync as readdirSync19, readFileSync as readFileSync52 } from "node:fs";
305745
- import { join as join82, basename as basename17 } from "node:path";
306117
+ import { existsSync as existsSync67, readdirSync as readdirSync19, readFileSync as readFileSync52 } from "node:fs";
306118
+ import { join as join83, basename as basename17 } from "node:path";
305746
306119
  function computeDPrime(signalScores, noiseScores) {
305747
306120
  if (signalScores.length === 0 || noiseScores.length === 0) return 0;
305748
306121
  const mean = (arr) => arr.reduce((s2, v) => s2 + v, 0) / arr.length;
@@ -306026,18 +306399,18 @@ Call task_complete with the JSON array when done.`,
306026
306399
  loadMemoryEntries(topics) {
306027
306400
  const entries = [];
306028
306401
  const dirs = [
306029
- join82(this.repoRoot, ".oa", "memory"),
306030
- join82(this.repoRoot, ".open-agents", "memory")
306402
+ join83(this.repoRoot, ".oa", "memory"),
306403
+ join83(this.repoRoot, ".open-agents", "memory")
306031
306404
  ];
306032
306405
  for (const dir of dirs) {
306033
- if (!existsSync66(dir)) continue;
306406
+ if (!existsSync67(dir)) continue;
306034
306407
  try {
306035
306408
  const files = readdirSync19(dir).filter((f2) => f2.endsWith(".json"));
306036
306409
  for (const f2 of files) {
306037
306410
  const topic = basename17(f2, ".json");
306038
306411
  if (topics.length > 0 && !topics.includes(topic)) continue;
306039
306412
  try {
306040
- const data = JSON.parse(readFileSync52(join82(dir, f2), "utf-8"));
306413
+ const data = JSON.parse(readFileSync52(join83(dir, f2), "utf-8"));
306041
306414
  for (const [key, val] of Object.entries(data)) {
306042
306415
  const value2 = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
306043
306416
  entries.push({ topic, key, value: value2 });
@@ -306581,8 +306954,8 @@ var init_tool_policy = __esm({
306581
306954
  });
306582
306955
 
306583
306956
  // packages/cli/src/tui/telegram-bridge.ts
306584
- import { mkdirSync as mkdirSync36, unlinkSync as unlinkSync16 } from "node:fs";
306585
- import { join as join83, resolve as resolve32 } from "node:path";
306957
+ import { mkdirSync as mkdirSync37, unlinkSync as unlinkSync16 } from "node:fs";
306958
+ import { join as join84, resolve as resolve32 } from "node:path";
306586
306959
  import { writeFile as writeFileAsync } from "node:fs/promises";
306587
306960
  function convertMarkdownToTelegramHTML(md) {
306588
306961
  let html = md;
@@ -306905,7 +307278,7 @@ with summary "no_reply" to silently skip without responding.
306905
307278
  this.polling = true;
306906
307279
  this.abortController = new AbortController();
306907
307280
  try {
306908
- mkdirSync36(this.mediaCacheDir, { recursive: true });
307281
+ mkdirSync37(this.mediaCacheDir, { recursive: true });
306909
307282
  } catch {
306910
307283
  }
306911
307284
  this.mediaCacheCleanupTimer = setInterval(() => this.cleanupMediaCache(), 5 * 60 * 1e3);
@@ -307338,7 +307711,7 @@ Telegram admin: @${msg.username}` : `Telegram ${isGroup ? "group" : "public"} ch
307338
307711
  if (!res.ok) return null;
307339
307712
  const buffer2 = Buffer.from(await res.arrayBuffer());
307340
307713
  const fileName = `${Date.now()}-${fileId.slice(0, 8)}${extension2}`;
307341
- const localPath = join83(this.mediaCacheDir, fileName);
307714
+ const localPath = join84(this.mediaCacheDir, fileName);
307342
307715
  await writeFileAsync(localPath, buffer2);
307343
307716
  return localPath;
307344
307717
  } catch {
@@ -308253,13 +308626,13 @@ var init_direct_input = __esm({
308253
308626
  });
308254
308627
 
308255
308628
  // packages/cli/src/api/audit-log.ts
308256
- import { mkdirSync as mkdirSync37, appendFileSync as appendFileSync5, readFileSync as readFileSync53, existsSync as existsSync68 } from "node:fs";
308257
- import { join as join84 } from "node:path";
308629
+ import { mkdirSync as mkdirSync38, appendFileSync as appendFileSync5, readFileSync as readFileSync53, existsSync as existsSync69 } from "node:fs";
308630
+ import { join as join85 } from "node:path";
308258
308631
  function initAuditLog(oaDir) {
308259
- auditDir = join84(oaDir, "audit");
308260
- auditFile = join84(auditDir, "audit.jsonl");
308632
+ auditDir = join85(oaDir, "audit");
308633
+ auditFile = join85(auditDir, "audit.jsonl");
308261
308634
  try {
308262
- mkdirSync37(auditDir, { recursive: true });
308635
+ mkdirSync38(auditDir, { recursive: true });
308263
308636
  initialized = true;
308264
308637
  } catch {
308265
308638
  }
@@ -308273,7 +308646,7 @@ function recordAudit(record) {
308273
308646
  }
308274
308647
  }
308275
308648
  function queryAudit(opts) {
308276
- if (!initialized || !existsSync68(auditFile)) return [];
308649
+ if (!initialized || !existsSync69(auditFile)) return [];
308277
308650
  try {
308278
308651
  const raw = readFileSync53(auditFile, "utf-8");
308279
308652
  const lines = raw.split("\n").filter(Boolean);
@@ -309594,32 +309967,32 @@ var init_auth_oidc = __esm({
309594
309967
  });
309595
309968
 
309596
309969
  // packages/cli/src/api/chat-session.ts
309597
- import { randomUUID as randomUUID5 } from "node:crypto";
309598
- import { existsSync as existsSync69, readFileSync as readFileSync54, readdirSync as readdirSync21 } from "node:fs";
309599
- import { join as join85 } from "node:path";
309970
+ import { randomUUID as randomUUID6 } from "node:crypto";
309971
+ import { existsSync as existsSync70, readFileSync as readFileSync54, readdirSync as readdirSync21 } from "node:fs";
309972
+ import { join as join86 } from "node:path";
309600
309973
  function buildSystemPrompt(cwd4) {
309601
309974
  const parts = [];
309602
309975
  parts.push(
309603
309976
  "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."
309604
309977
  );
309605
309978
  parts.push(`\\nEnvironment: ${process.platform}, Node ${process.version}, CWD: ${cwd4}`);
309606
- const diaryPath = join85(cwd4, ".oa", "context", "session-diary.md");
309607
- if (existsSync69(diaryPath)) {
309979
+ const diaryPath = join86(cwd4, ".oa", "context", "session-diary.md");
309980
+ if (existsSync70(diaryPath)) {
309608
309981
  try {
309609
309982
  const diary = readFileSync54(diaryPath, "utf-8").slice(0, 1e3);
309610
309983
  parts.push(`\\nPrevious session history:\\n${diary}`);
309611
309984
  } catch {
309612
309985
  }
309613
309986
  }
309614
- const memDir = join85(cwd4, ".oa", "memory");
309615
- if (existsSync69(memDir)) {
309987
+ const memDir = join86(cwd4, ".oa", "memory");
309988
+ if (existsSync70(memDir)) {
309616
309989
  try {
309617
309990
  const files = readdirSync21(memDir).filter((f2) => f2.endsWith(".json")).slice(0, 5);
309618
309991
  if (files.length > 0) {
309619
309992
  parts.push("\\nPersistent memory topics: " + files.map((f2) => f2.replace(".json", "")).join(", "));
309620
309993
  for (const f2 of files.slice(0, 3)) {
309621
309994
  try {
309622
- const data = JSON.parse(readFileSync54(join85(memDir, f2), "utf-8"));
309995
+ const data = JSON.parse(readFileSync54(join86(memDir, f2), "utf-8"));
309623
309996
  const entries = Object.entries(data).slice(0, 3);
309624
309997
  if (entries.length > 0) {
309625
309998
  parts.push(`\\nMemory [${f2.replace(".json", "")}]: ` + entries.map(([k, v]) => `${k}: ${String(v.value ?? v).slice(0, 100)}`).join("; "));
@@ -309632,8 +310005,8 @@ function buildSystemPrompt(cwd4) {
309632
310005
  }
309633
310006
  }
309634
310007
  for (const name10 of ["AGENTS.md", "OA.md", ".open-agents.md"]) {
309635
- const p2 = join85(cwd4, name10);
309636
- if (existsSync69(p2)) {
310008
+ const p2 = join86(cwd4, name10);
310009
+ if (existsSync70(p2)) {
309637
310010
  try {
309638
310011
  const content = readFileSync54(p2, "utf-8").slice(0, 500);
309639
310012
  parts.push(`\\nProject instructions (${name10}):\\n${content}`);
@@ -309649,7 +310022,7 @@ function getSession(sessionId, model, cwd4) {
309649
310022
  s2.lastActivity = Date.now();
309650
310023
  return s2;
309651
310024
  }
309652
- const id = sessionId || randomUUID5();
310025
+ const id = sessionId || randomUUID6();
309653
310026
  const systemPrompt = buildSystemPrompt(cwd4);
309654
310027
  const session = {
309655
310028
  id,
@@ -309711,14 +310084,14 @@ var init_chat_session = __esm({
309711
310084
  });
309712
310085
 
309713
310086
  // packages/cli/src/api/usage-tracker.ts
309714
- import { mkdirSync as mkdirSync38, readFileSync as readFileSync55, writeFileSync as writeFileSync34, existsSync as existsSync70 } from "node:fs";
309715
- import { join as join86 } from "node:path";
310087
+ import { mkdirSync as mkdirSync39, readFileSync as readFileSync55, writeFileSync as writeFileSync34, existsSync as existsSync71 } from "node:fs";
310088
+ import { join as join87 } from "node:path";
309716
310089
  function initUsageTracker(oaDir) {
309717
- const dir = join86(oaDir, "usage");
309718
- mkdirSync38(dir, { recursive: true });
309719
- usageFile = join86(dir, "token-usage.json");
310090
+ const dir = join87(oaDir, "usage");
310091
+ mkdirSync39(dir, { recursive: true });
310092
+ usageFile = join87(dir, "token-usage.json");
309720
310093
  try {
309721
- if (existsSync70(usageFile)) {
310094
+ if (existsSync71(usageFile)) {
309722
310095
  store = JSON.parse(readFileSync55(usageFile, "utf-8"));
309723
310096
  }
309724
310097
  } catch {
@@ -309783,24 +310156,24 @@ var init_usage_tracker = __esm({
309783
310156
  });
309784
310157
 
309785
310158
  // packages/cli/src/api/profiles.ts
309786
- import { existsSync as existsSync71, readFileSync as readFileSync56, writeFileSync as writeFileSync35, mkdirSync as mkdirSync39, readdirSync as readdirSync22, unlinkSync as unlinkSync17 } from "node:fs";
309787
- import { join as join87 } from "node:path";
310159
+ import { existsSync as existsSync72, readFileSync as readFileSync56, writeFileSync as writeFileSync35, mkdirSync as mkdirSync40, readdirSync as readdirSync22, unlinkSync as unlinkSync17 } from "node:fs";
310160
+ import { join as join88 } from "node:path";
309788
310161
  import { homedir as homedir26 } from "node:os";
309789
310162
  import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes18, scryptSync as scryptSync3 } from "node:crypto";
309790
310163
  function globalProfileDir() {
309791
- return join87(homedir26(), ".open-agents", "profiles");
310164
+ return join88(homedir26(), ".open-agents", "profiles");
309792
310165
  }
309793
310166
  function projectProfileDir(projectDir) {
309794
- return join87(projectDir || process.cwd(), ".oa", "profiles");
310167
+ return join88(projectDir || process.cwd(), ".oa", "profiles");
309795
310168
  }
309796
310169
  function listProfiles(projectDir) {
309797
310170
  const result = [];
309798
310171
  const seen = /* @__PURE__ */ new Set();
309799
310172
  const projDir = projectProfileDir(projectDir);
309800
- if (existsSync71(projDir)) {
310173
+ if (existsSync72(projDir)) {
309801
310174
  for (const f2 of readdirSync22(projDir).filter((f3) => f3.endsWith(".json"))) {
309802
310175
  try {
309803
- const raw = JSON.parse(readFileSync56(join87(projDir, f2), "utf8"));
310176
+ const raw = JSON.parse(readFileSync56(join88(projDir, f2), "utf8"));
309804
310177
  const name10 = f2.replace(".json", "");
309805
310178
  seen.add(name10);
309806
310179
  result.push({
@@ -309814,12 +310187,12 @@ function listProfiles(projectDir) {
309814
310187
  }
309815
310188
  }
309816
310189
  const globDir = globalProfileDir();
309817
- if (existsSync71(globDir)) {
310190
+ if (existsSync72(globDir)) {
309818
310191
  for (const f2 of readdirSync22(globDir).filter((f3) => f3.endsWith(".json"))) {
309819
310192
  const name10 = f2.replace(".json", "");
309820
310193
  if (seen.has(name10)) continue;
309821
310194
  try {
309822
- const raw = JSON.parse(readFileSync56(join87(globDir, f2), "utf8"));
310195
+ const raw = JSON.parse(readFileSync56(join88(globDir, f2), "utf8"));
309823
310196
  result.push({
309824
310197
  name: name10,
309825
310198
  description: raw.description || "",
@@ -309834,9 +310207,9 @@ function listProfiles(projectDir) {
309834
310207
  }
309835
310208
  function loadProfile(name10, password, projectDir) {
309836
310209
  const sanitized = name10.replace(/[^a-zA-Z0-9_-]/g, "");
309837
- const projPath = join87(projectProfileDir(projectDir), `${sanitized}.json`);
309838
- const globPath = join87(globalProfileDir(), `${sanitized}.json`);
309839
- const filePath = existsSync71(projPath) ? projPath : existsSync71(globPath) ? globPath : null;
310210
+ const projPath = join88(projectProfileDir(projectDir), `${sanitized}.json`);
310211
+ const globPath = join88(globalProfileDir(), `${sanitized}.json`);
310212
+ const filePath = existsSync72(projPath) ? projPath : existsSync72(globPath) ? globPath : null;
309840
310213
  if (!filePath) return null;
309841
310214
  const raw = JSON.parse(readFileSync56(filePath, "utf8"));
309842
310215
  if (raw.encrypted === true) {
@@ -309847,9 +310220,9 @@ function loadProfile(name10, password, projectDir) {
309847
310220
  }
309848
310221
  function saveProfile(profile, password, scope = "global", projectDir) {
309849
310222
  const dir = scope === "project" ? projectProfileDir(projectDir) : globalProfileDir();
309850
- mkdirSync39(dir, { recursive: true });
310223
+ mkdirSync40(dir, { recursive: true });
309851
310224
  const sanitized = profile.name.replace(/[^a-zA-Z0-9_-]/g, "");
309852
- const filePath = join87(dir, `${sanitized}.json`);
310225
+ const filePath = join88(dir, `${sanitized}.json`);
309853
310226
  profile.modified = (/* @__PURE__ */ new Date()).toISOString();
309854
310227
  if (password) {
309855
310228
  const encrypted = encryptProfile(profile, password);
@@ -309862,8 +310235,8 @@ function saveProfile(profile, password, scope = "global", projectDir) {
309862
310235
  function deleteProfile(name10, scope = "global", projectDir) {
309863
310236
  const sanitized = name10.replace(/[^a-zA-Z0-9_-]/g, "");
309864
310237
  const dir = scope === "project" ? projectProfileDir(projectDir) : globalProfileDir();
309865
- const filePath = join87(dir, `${sanitized}.json`);
309866
- if (existsSync71(filePath)) {
310238
+ const filePath = join88(dir, `${sanitized}.json`);
310239
+ if (existsSync72(filePath)) {
309867
310240
  unlinkSync17(filePath);
309868
310241
  return true;
309869
310242
  }
@@ -309978,23 +310351,23 @@ var init_profiles = __esm({
309978
310351
 
309979
310352
  // packages/cli/src/docker.ts
309980
310353
  import { execSync as execSync51, spawn as spawn23 } from "node:child_process";
309981
- import { existsSync as existsSync72, mkdirSync as mkdirSync40, writeFileSync as writeFileSync36 } from "node:fs";
309982
- import { join as join88, resolve as resolve33, dirname as dirname24 } from "node:path";
310354
+ import { existsSync as existsSync73, mkdirSync as mkdirSync41, writeFileSync as writeFileSync36 } from "node:fs";
310355
+ import { join as join89, resolve as resolve33, dirname as dirname24 } from "node:path";
309983
310356
  import { homedir as homedir27 } from "node:os";
309984
310357
  import { fileURLToPath as fileURLToPath15 } from "node:url";
309985
310358
  function getDockerDir() {
309986
310359
  try {
309987
310360
  if (typeof __dirname !== "undefined") {
309988
- return join88(__dirname, "..", "..", "..", "docker");
310361
+ return join89(__dirname, "..", "..", "..", "docker");
309989
310362
  }
309990
310363
  } catch {
309991
310364
  }
309992
310365
  try {
309993
310366
  const thisDir = dirname24(fileURLToPath15(import.meta.url));
309994
- return join88(thisDir, "..", "..", "..", "docker");
310367
+ return join89(thisDir, "..", "..", "..", "docker");
309995
310368
  } catch {
309996
310369
  }
309997
- return join88(process.cwd(), "docker");
310370
+ return join89(process.cwd(), "docker");
309998
310371
  }
309999
310372
  function isDockerAvailable() {
310000
310373
  try {
@@ -310125,11 +310498,11 @@ async function ensureOaImage(force = false) {
310125
310498
  }
310126
310499
  let buildContext;
310127
310500
  const dockerDir = getDockerDir();
310128
- if (existsSync72(join88(dockerDir, "Dockerfile"))) {
310501
+ if (existsSync73(join89(dockerDir, "Dockerfile"))) {
310129
310502
  buildContext = dockerDir;
310130
310503
  } else {
310131
- buildContext = join88(homedir27(), ".oa", "docker-build");
310132
- mkdirSync40(buildContext, { recursive: true });
310504
+ buildContext = join89(homedir27(), ".oa", "docker-build");
310505
+ mkdirSync41(buildContext, { recursive: true });
310133
310506
  writeDockerfiles(buildContext);
310134
310507
  }
310135
310508
  try {
@@ -310203,8 +310576,8 @@ chown -R node:node /workspace /home/node/.oa /home/node/.open-agents 2>/dev/null
310203
310576
  if [ "$1" = "oa" ]; then shift; exec su - node -c "cd /workspace && oa $*"; fi
310204
310577
  exec "$@"
310205
310578
  `;
310206
- writeFileSync36(join88(dir, "Dockerfile"), dockerfile);
310207
- writeFileSync36(join88(dir, "docker-entrypoint.sh"), entrypoint, { mode: 493 });
310579
+ writeFileSync36(join89(dir, "Dockerfile"), dockerfile);
310580
+ writeFileSync36(join89(dir, "docker-entrypoint.sh"), entrypoint, { mode: 493 });
310208
310581
  }
310209
310582
  function hasNvidiaGpu() {
310210
310583
  try {
@@ -310281,22 +310654,22 @@ import * as http5 from "node:http";
310281
310654
  import * as https3 from "node:https";
310282
310655
  import { createRequire as createRequire4 } from "node:module";
310283
310656
  import { fileURLToPath as fileURLToPath16 } from "node:url";
310284
- import { dirname as dirname25, join as join89, resolve as resolve34 } from "node:path";
310657
+ import { dirname as dirname25, join as join90, resolve as resolve34 } from "node:path";
310285
310658
  import { spawn as spawn24, execSync as execSync52 } from "node:child_process";
310286
- import { mkdirSync as mkdirSync41, writeFileSync as writeFileSync37, readFileSync as readFileSync57, readdirSync as readdirSync23, existsSync as existsSync73 } from "node:fs";
310287
- import { randomBytes as randomBytes19, randomUUID as randomUUID6 } from "node:crypto";
310659
+ import { mkdirSync as mkdirSync42, writeFileSync as writeFileSync37, readFileSync as readFileSync57, readdirSync as readdirSync23, existsSync as existsSync74 } from "node:fs";
310660
+ import { randomBytes as randomBytes19, randomUUID as randomUUID7 } from "node:crypto";
310288
310661
  function getVersion3() {
310289
310662
  try {
310290
310663
  const require3 = createRequire4(import.meta.url);
310291
310664
  const thisDir = dirname25(fileURLToPath16(import.meta.url));
310292
310665
  const candidates = [
310293
- join89(thisDir, "..", "package.json"),
310294
- join89(thisDir, "..", "..", "package.json"),
310295
- join89(thisDir, "..", "..", "..", "package.json")
310666
+ join90(thisDir, "..", "package.json"),
310667
+ join90(thisDir, "..", "..", "package.json"),
310668
+ join90(thisDir, "..", "..", "..", "package.json")
310296
310669
  ];
310297
310670
  for (const pkgPath of candidates) {
310298
310671
  try {
310299
- if (!existsSync73(pkgPath)) continue;
310672
+ if (!existsSync74(pkgPath)) continue;
310300
310673
  const pkg = require3(pkgPath);
310301
310674
  if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli" || pkg.name === "@open-agents/monorepo") {
310302
310675
  return pkg.version ?? "0.0.0";
@@ -310585,13 +310958,13 @@ function ollamaStream(ollamaUrl, path5, method, body, onData, onEnd, onError) {
310585
310958
  }
310586
310959
  function jobsDir() {
310587
310960
  const root = resolve34(process.cwd());
310588
- const dir = join89(root, ".oa", "jobs");
310589
- mkdirSync41(dir, { recursive: true });
310961
+ const dir = join90(root, ".oa", "jobs");
310962
+ mkdirSync42(dir, { recursive: true });
310590
310963
  return dir;
310591
310964
  }
310592
310965
  function loadJob(id) {
310593
- const file = join89(jobsDir(), `${id}.json`);
310594
- if (!existsSync73(file)) return null;
310966
+ const file = join90(jobsDir(), `${id}.json`);
310967
+ if (!existsSync74(file)) return null;
310595
310968
  try {
310596
310969
  return JSON.parse(readFileSync57(file, "utf-8"));
310597
310970
  } catch {
@@ -310600,12 +310973,12 @@ function loadJob(id) {
310600
310973
  }
310601
310974
  function listJobs() {
310602
310975
  const dir = jobsDir();
310603
- if (!existsSync73(dir)) return [];
310976
+ if (!existsSync74(dir)) return [];
310604
310977
  const files = readdirSync23(dir).filter((f2) => f2.endsWith(".json")).sort();
310605
310978
  const jobs = [];
310606
310979
  for (const file of files) {
310607
310980
  try {
310608
- jobs.push(JSON.parse(readFileSync57(join89(dir, file), "utf-8")));
310981
+ jobs.push(JSON.parse(readFileSync57(join90(dir, file), "utf-8")));
310609
310982
  } catch {
310610
310983
  }
310611
310984
  }
@@ -311079,8 +311452,8 @@ async function handleV1Run(req2, res) {
311079
311452
  if (workingDir) {
311080
311453
  cwd4 = resolve34(workingDir);
311081
311454
  } else if (isolate) {
311082
- const wsDir = join89(dir, "..", "workspaces", id);
311083
- mkdirSync41(wsDir, { recursive: true });
311455
+ const wsDir = join90(dir, "..", "workspaces", id);
311456
+ mkdirSync42(wsDir, { recursive: true });
311084
311457
  cwd4 = wsDir;
311085
311458
  } else {
311086
311459
  cwd4 = resolve34(process.cwd());
@@ -311164,7 +311537,7 @@ async function handleV1Run(req2, res) {
311164
311537
  job.sandbox = sandbox;
311165
311538
  }
311166
311539
  job.pid = child.pid ?? 0;
311167
- writeFileSync37(join89(dir, `${id}.json`), JSON.stringify(job, null, 2));
311540
+ writeFileSync37(join90(dir, `${id}.json`), JSON.stringify(job, null, 2));
311168
311541
  runningProcesses.set(id, child);
311169
311542
  if (streamMode) {
311170
311543
  res.writeHead(200, {
@@ -311191,7 +311564,7 @@ async function handleV1Run(req2, res) {
311191
311564
  job.status = code8 === 0 ? "completed" : "failed";
311192
311565
  job.completedAt = (/* @__PURE__ */ new Date()).toISOString();
311193
311566
  try {
311194
- writeFileSync37(join89(dir, `${id}.json`), JSON.stringify(job, null, 2));
311567
+ writeFileSync37(join90(dir, `${id}.json`), JSON.stringify(job, null, 2));
311195
311568
  } catch {
311196
311569
  }
311197
311570
  runningProcesses.delete(id);
@@ -311231,7 +311604,7 @@ async function handleV1Run(req2, res) {
311231
311604
  job.completedAt = (/* @__PURE__ */ new Date()).toISOString();
311232
311605
  }
311233
311606
  try {
311234
- writeFileSync37(join89(dir, `${id}.json`), JSON.stringify(job, null, 2));
311607
+ writeFileSync37(join90(dir, `${id}.json`), JSON.stringify(job, null, 2));
311235
311608
  } catch {
311236
311609
  }
311237
311610
  runningProcesses.delete(id);
@@ -311299,7 +311672,7 @@ function handleV1RunsDelete(res, id) {
311299
311672
  job.error = "Aborted via API";
311300
311673
  const dir = jobsDir();
311301
311674
  try {
311302
- writeFileSync37(join89(dir, `${id}.json`), JSON.stringify(job, null, 2));
311675
+ writeFileSync37(join90(dir, `${id}.json`), JSON.stringify(job, null, 2));
311303
311676
  } catch {
311304
311677
  }
311305
311678
  runningProcesses.delete(id);
@@ -311433,7 +311806,7 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
311433
311806
  const urlObj = new URL(req2.url ?? "/", `http://${req2.headers.host ?? "localhost"}`);
311434
311807
  const pathname = urlObj.pathname;
311435
311808
  const startMs = performance.now();
311436
- const requestId = req2.headers["x-request-id"] || randomUUID6();
311809
+ const requestId = req2.headers["x-request-id"] || randomUUID7();
311437
311810
  res.setHeader("X-Request-ID", requestId);
311438
311811
  if (method === "OPTIONS") {
311439
311812
  if (!corsHeaders(req2, res)) return;
@@ -311964,18 +312337,18 @@ function startApiServer(options2 = {}) {
311964
312337
  const config = loadConfig();
311965
312338
  const ollamaUrl = options2.ollamaUrl ?? config.backendUrl;
311966
312339
  const cwd4 = process.cwd();
311967
- initAuditLog(join89(cwd4, ".oa"));
311968
- initUsageTracker(join89(cwd4, ".oa"));
312340
+ initAuditLog(join90(cwd4, ".oa"));
312341
+ initUsageTracker(join90(cwd4, ".oa"));
311969
312342
  const retentionDays = parseInt(process.env["OA_JOB_RETENTION_DAYS"] ?? "30", 10);
311970
312343
  if (retentionDays > 0) {
311971
312344
  try {
311972
- const jobsDir3 = join89(cwd4, ".oa", "jobs");
311973
- if (existsSync73(jobsDir3)) {
312345
+ const jobsDir3 = join90(cwd4, ".oa", "jobs");
312346
+ if (existsSync74(jobsDir3)) {
311974
312347
  const cutoff = Date.now() - retentionDays * 864e5;
311975
312348
  for (const f2 of readdirSync23(jobsDir3)) {
311976
312349
  if (!f2.endsWith(".json")) continue;
311977
312350
  try {
311978
- const jobPath = join89(jobsDir3, f2);
312351
+ const jobPath = join90(jobsDir3, f2);
311979
312352
  const job = JSON.parse(readFileSync57(jobPath, "utf-8"));
311980
312353
  const jobTime = new Date(job.startedAt ?? job.completedAt ?? 0).getTime();
311981
312354
  if (jobTime > 0 && jobTime < cutoff && job.status !== "running") {
@@ -312195,11 +312568,11 @@ var init_serve = __esm({
312195
312568
 
312196
312569
  // packages/cli/src/tui/interactive.ts
312197
312570
  import { cwd } from "node:process";
312198
- import { resolve as resolve35, join as join90, dirname as dirname26, extname as extname11 } from "node:path";
312571
+ import { resolve as resolve35, join as join91, dirname as dirname26, extname as extname11 } from "node:path";
312199
312572
  import { createRequire as createRequire5 } from "node:module";
312200
312573
  import { fileURLToPath as fileURLToPath17 } from "node:url";
312201
- import { readFileSync as readFileSync58, writeFileSync as writeFileSync38, appendFileSync as appendFileSync6, rmSync as rmSync4, readdirSync as readdirSync24, mkdirSync as mkdirSync42 } from "node:fs";
312202
- import { existsSync as existsSync74 } from "node:fs";
312574
+ import { readFileSync as readFileSync58, writeFileSync as writeFileSync38, appendFileSync as appendFileSync6, rmSync as rmSync4, readdirSync as readdirSync24, mkdirSync as mkdirSync43 } from "node:fs";
312575
+ import { existsSync as existsSync75 } from "node:fs";
312203
312576
  import { execSync as execSync53 } from "node:child_process";
312204
312577
  import { homedir as homedir28 } from "node:os";
312205
312578
  function formatTimeAgo(date) {
@@ -312217,12 +312590,12 @@ function getVersion4() {
312217
312590
  const require3 = createRequire5(import.meta.url);
312218
312591
  const thisDir = dirname26(fileURLToPath17(import.meta.url));
312219
312592
  const candidates = [
312220
- join90(thisDir, "..", "package.json"),
312221
- join90(thisDir, "..", "..", "package.json"),
312222
- join90(thisDir, "..", "..", "..", "package.json")
312593
+ join91(thisDir, "..", "package.json"),
312594
+ join91(thisDir, "..", "..", "package.json"),
312595
+ join91(thisDir, "..", "..", "..", "package.json")
312223
312596
  ];
312224
312597
  for (const pkgPath of candidates) {
312225
- if (existsSync74(pkgPath)) {
312598
+ if (existsSync75(pkgPath)) {
312226
312599
  const pkg = require3(pkgPath);
312227
312600
  if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli" || pkg.name === "@open-agents/monorepo") {
312228
312601
  return pkg.version ?? "0.0.0";
@@ -312726,14 +313099,14 @@ Meta-critique: quality ${meta.quality}/5, thorough: ${meta.thorough}`;
312726
313099
  function gatherMemorySnippets(root) {
312727
313100
  const snippets = [];
312728
313101
  const dirs = [
312729
- join90(root, ".oa", "memory"),
312730
- join90(root, ".open-agents", "memory")
313102
+ join91(root, ".oa", "memory"),
313103
+ join91(root, ".open-agents", "memory")
312731
313104
  ];
312732
313105
  for (const dir of dirs) {
312733
- if (!existsSync74(dir)) continue;
313106
+ if (!existsSync75(dir)) continue;
312734
313107
  try {
312735
313108
  for (const f2 of readdirSync24(dir).filter((f3) => f3.endsWith(".json"))) {
312736
- const data = JSON.parse(readFileSync58(join90(dir, f2), "utf-8"));
313109
+ const data = JSON.parse(readFileSync58(join91(dir, f2), "utf-8"));
312737
313110
  for (const val of Object.values(data)) {
312738
313111
  const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
312739
313112
  if (v.length > 10) snippets.push(v);
@@ -312887,8 +313260,8 @@ ${metabolismMemories}
312887
313260
  } catch {
312888
313261
  }
312889
313262
  try {
312890
- const archeFile = join90(repoRoot, ".oa", "arche", "variants.json");
312891
- if (existsSync74(archeFile)) {
313263
+ const archeFile = join91(repoRoot, ".oa", "arche", "variants.json");
313264
+ if (existsSync75(archeFile)) {
312892
313265
  const variants = JSON.parse(readFileSync58(archeFile, "utf8"));
312893
313266
  if (variants.length > 0) {
312894
313267
  let filtered = variants;
@@ -313058,8 +313431,8 @@ RULES:
313058
313431
  const compactionThreshold = modelTier === "small" ? 12e3 : modelTier === "medium" ? 24e3 : 4e4;
313059
313432
  let identityInjection = "";
313060
313433
  try {
313061
- const ikStateFile = join90(repoRoot, ".oa", "identity", "self-state.json");
313062
- if (existsSync74(ikStateFile)) {
313434
+ const ikStateFile = join91(repoRoot, ".oa", "identity", "self-state.json");
313435
+ if (existsSync75(ikStateFile)) {
313063
313436
  const selfState = JSON.parse(readFileSync58(ikStateFile, "utf8"));
313064
313437
  const lines = [
313065
313438
  `[Identity State v${selfState.version}]`,
@@ -313788,13 +314161,13 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
313788
314161
  });
313789
314162
  }
313790
314163
  try {
313791
- const ikDir = join90(repoRoot, ".oa", "identity");
313792
- const ikFile = join90(ikDir, "self-state.json");
314164
+ const ikDir = join91(repoRoot, ".oa", "identity");
314165
+ const ikFile = join91(ikDir, "self-state.json");
313793
314166
  let ikState;
313794
- if (existsSync74(ikFile)) {
314167
+ if (existsSync75(ikFile)) {
313795
314168
  ikState = JSON.parse(readFileSync58(ikFile, "utf8"));
313796
314169
  } else {
313797
- mkdirSync42(ikDir, { recursive: true });
314170
+ mkdirSync43(ikDir, { recursive: true });
313798
314171
  const machineId = Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
313799
314172
  ikState = {
313800
314173
  self_id: `oa-${machineId}`,
@@ -313869,8 +314242,8 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
313869
314242
  } else {
313870
314243
  renderTaskIncomplete(result.turns, result.toolCalls, result.durationMs, tokens);
313871
314244
  try {
313872
- const ikFile = join90(repoRoot, ".oa", "identity", "self-state.json");
313873
- if (existsSync74(ikFile)) {
314245
+ const ikFile = join91(repoRoot, ".oa", "identity", "self-state.json");
314246
+ if (existsSync75(ikFile)) {
313874
314247
  const ikState = JSON.parse(readFileSync58(ikFile, "utf8"));
313875
314248
  if (!ikState.stats) ikState.stats = { queries_served: 0 };
313876
314249
  ikState.stats.queries_served = (ikState.stats.queries_served || 0) + 1;
@@ -313997,9 +314370,9 @@ async function startInteractive(config, repoPath) {
313997
314370
  process.stdin.pause();
313998
314371
  }
313999
314372
  try {
314000
- const oaDir = join90(repoRoot, ".oa");
314001
- const nexusPidFile = join90(oaDir, "nexus", "daemon.pid");
314002
- if (existsSync74(nexusPidFile)) {
314373
+ const oaDir = join91(repoRoot, ".oa");
314374
+ const nexusPidFile = join91(oaDir, "nexus", "daemon.pid");
314375
+ if (existsSync75(nexusPidFile)) {
314003
314376
  const pid = parseInt(readFileSync58(nexusPidFile, "utf8").trim(), 10);
314004
314377
  if (pid > 0) {
314005
314378
  try {
@@ -314545,7 +314918,7 @@ ${opts.systemPromptAddition}` : `Working directory: ${repoRoot}`;
314545
314918
  let p2pGateway = null;
314546
314919
  let peerMesh = null;
314547
314920
  let inferenceRouter = null;
314548
- const secretVault = new SecretVault(join90(repoRoot, ".oa", "vault.enc"));
314921
+ const secretVault = new SecretVault(join91(repoRoot, ".oa", "vault.enc"));
314549
314922
  let adminSessionKey = null;
314550
314923
  const callSubAgents = /* @__PURE__ */ new Map();
314551
314924
  const streamRenderer = new StreamRenderer();
@@ -314764,12 +315137,12 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
314764
315137
  const hits = allCompletions.filter((c7) => c7.toLowerCase().startsWith(lower));
314765
315138
  return [hits, line];
314766
315139
  }
314767
- const HISTORY_DIR = join90(homedir28(), ".open-agents");
314768
- const HISTORY_FILE = join90(HISTORY_DIR, "repl-history");
315140
+ const HISTORY_DIR = join91(homedir28(), ".open-agents");
315141
+ const HISTORY_FILE = join91(HISTORY_DIR, "repl-history");
314769
315142
  const MAX_HISTORY_LINES = 500;
314770
315143
  let savedHistory = [];
314771
315144
  try {
314772
- if (existsSync74(HISTORY_FILE)) {
315145
+ if (existsSync75(HISTORY_FILE)) {
314773
315146
  const raw = readFileSync58(HISTORY_FILE, "utf8").trim();
314774
315147
  if (raw) savedHistory = raw.split("\n").reverse();
314775
315148
  }
@@ -314895,7 +315268,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
314895
315268
  function persistHistoryLine(line) {
314896
315269
  if (!line.trim()) return;
314897
315270
  try {
314898
- mkdirSync42(HISTORY_DIR, { recursive: true });
315271
+ mkdirSync43(HISTORY_DIR, { recursive: true });
314899
315272
  appendFileSync6(HISTORY_FILE, line + "\n", "utf8");
314900
315273
  if (Math.random() < 0.02) {
314901
315274
  const all2 = readFileSync58(HISTORY_FILE, "utf8").trim().split("\n");
@@ -315074,10 +315447,10 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
315074
315447
  const { unlinkSync: _rmStale } = await import("node:fs");
315075
315448
  const { homedir: _hdir } = await import("node:os");
315076
315449
  for (const dp of [
315077
- join90(repoRoot, ".oa", "nexus", "nexus-daemon.mjs"),
315078
- join90(_hdir(), ".open-agents", ".oa", "nexus", "nexus-daemon.mjs")
315450
+ join91(repoRoot, ".oa", "nexus", "nexus-daemon.mjs"),
315451
+ join91(_hdir(), ".open-agents", ".oa", "nexus", "nexus-daemon.mjs")
315079
315452
  ]) {
315080
- if (existsSync74(dp)) try {
315453
+ if (existsSync75(dp)) try {
315081
315454
  _rmStale(dp);
315082
315455
  } catch {
315083
315456
  }
@@ -315088,8 +315461,8 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
315088
315461
  const autoNexus = new NexusTool(repoRoot);
315089
315462
  const _registerNexusDaemon = () => {
315090
315463
  try {
315091
- const nexusPidFile = join90(repoRoot, ".oa", "nexus", "daemon.pid");
315092
- if (existsSync74(nexusPidFile)) {
315464
+ const nexusPidFile = join91(repoRoot, ".oa", "nexus", "daemon.pid");
315465
+ if (existsSync75(nexusPidFile)) {
315093
315466
  const nPid = parseInt(readFileSync58(nexusPidFile, "utf8").trim(), 10);
315094
315467
  if (nPid > 0 && !registry2.daemons.has("Nexus")) {
315095
315468
  registry2.register({ name: "Nexus", pid: nPid, startedAt: Date.now(), status: "running" });
@@ -315137,7 +315510,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
315137
315510
  } catch {
315138
315511
  }
315139
315512
  try {
315140
- const oaDir = join90(repoRoot, ".oa");
315513
+ const oaDir = join91(repoRoot, ".oa");
315141
315514
  const reconnected = await ExposeGateway.checkAndReconnect(oaDir, {
315142
315515
  onInfo: (msg) => writeContent(() => renderInfo(msg)),
315143
315516
  onError: (msg) => writeContent(() => renderWarning(msg))
@@ -315169,7 +315542,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
315169
315542
  } catch {
315170
315543
  }
315171
315544
  try {
315172
- const oaDir = join90(repoRoot, ".oa");
315545
+ const oaDir = join91(repoRoot, ".oa");
315173
315546
  const reconnectedP2P = await ExposeP2PGateway.checkAndReconnect(oaDir, new NexusTool(repoRoot), {
315174
315547
  onInfo: (msg) => writeContent(() => renderInfo(msg)),
315175
315548
  onError: (msg) => writeContent(() => renderWarning(msg))
@@ -315210,10 +315583,10 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
315210
315583
  }
315211
315584
  try {
315212
315585
  const { homedir: _hd, hostname: _hn, userInfo: _ui } = await import("node:os");
315213
- const globalNamePath = join90(_hd(), ".open-agents", "agent-name");
315586
+ const globalNamePath = join91(_hd(), ".open-agents", "agent-name");
315214
315587
  let agName = "";
315215
315588
  try {
315216
- if (existsSync74(globalNamePath)) agName = readFileSync58(globalNamePath, "utf8").trim();
315589
+ if (existsSync75(globalNamePath)) agName = readFileSync58(globalNamePath, "utf8").trim();
315217
315590
  } catch {
315218
315591
  }
315219
315592
  if (!agName) {
@@ -315242,10 +315615,10 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
315242
315615
  }
315243
315616
  if (!ollamaAlive) {
315244
315617
  try {
315245
- const savedSponsorsPath = join90(repoRoot, ".oa", "sponsor", "known-sponsors.json");
315618
+ const savedSponsorsPath = join91(repoRoot, ".oa", "sponsor", "known-sponsors.json");
315246
315619
  let savedSponsors = [];
315247
315620
  try {
315248
- if (existsSync74(savedSponsorsPath)) {
315621
+ if (existsSync75(savedSponsorsPath)) {
315249
315622
  savedSponsors = JSON.parse(readFileSync58(savedSponsorsPath, "utf8"));
315250
315623
  const oneHourAgo = Date.now() - 36e5;
315251
315624
  savedSponsors = savedSponsors.filter((s2) => (s2.lastVerified || 0) > oneHourAgo);
@@ -316204,7 +316577,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
316204
316577
  kind,
316205
316578
  targetUrl,
316206
316579
  authKey,
316207
- stateDir: join90(repoRoot, ".oa"),
316580
+ stateDir: join91(repoRoot, ".oa"),
316208
316581
  passthrough: passthrough ?? false,
316209
316582
  loadbalance: loadbalance ?? false,
316210
316583
  endpointAuth: passthrough ? currentConfig.apiKey : void 0,
@@ -316250,7 +316623,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
316250
316623
  await tunnelGateway.stop();
316251
316624
  tunnelGateway = null;
316252
316625
  }
316253
- const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir: join90(repoRoot, ".oa") });
316626
+ const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir: join91(repoRoot, ".oa") });
316254
316627
  newTunnel.on("stats", (stats) => {
316255
316628
  statusBar.setExposeStatus({
316256
316629
  status: stats.status,
@@ -316337,8 +316710,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
316337
316710
  });
316338
316711
  if (!result.success) throw new Error(result.error || "Connect failed");
316339
316712
  try {
316340
- const nexusPidFile = join90(repoRoot, ".oa", "nexus", "daemon.pid");
316341
- if (existsSync74(nexusPidFile)) {
316713
+ const nexusPidFile = join91(repoRoot, ".oa", "nexus", "daemon.pid");
316714
+ if (existsSync75(nexusPidFile)) {
316342
316715
  const pid = parseInt(readFileSync58(nexusPidFile, "utf8").trim(), 10);
316343
316716
  if (pid > 0) {
316344
316717
  registry2.register({
@@ -316525,9 +316898,9 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
316525
316898
  writeContent(() => renderInfo(`Killed ${bgKilled} background task(s).`));
316526
316899
  }
316527
316900
  try {
316528
- const nexusDir = join90(repoRoot, OA_DIR, "nexus");
316529
- const pidFile = join90(nexusDir, "daemon.pid");
316530
- if (existsSync74(pidFile)) {
316901
+ const nexusDir = join91(repoRoot, OA_DIR, "nexus");
316902
+ const pidFile = join91(nexusDir, "daemon.pid");
316903
+ if (existsSync75(pidFile)) {
316531
316904
  const pid = parseInt(readFileSync58(pidFile, "utf8").trim(), 10);
316532
316905
  if (pid > 0) {
316533
316906
  try {
@@ -316550,11 +316923,11 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
316550
316923
  } catch {
316551
316924
  }
316552
316925
  try {
316553
- const voiceDir2 = join90(homedir28(), ".open-agents", "voice");
316926
+ const voiceDir2 = join91(homedir28(), ".open-agents", "voice");
316554
316927
  const voicePidFiles = ["luxtts-daemon.pid", "piper-daemon.pid"];
316555
316928
  for (const pf of voicePidFiles) {
316556
- const pidPath = join90(voiceDir2, pf);
316557
- if (existsSync74(pidPath)) {
316929
+ const pidPath = join91(voiceDir2, pf);
316930
+ if (existsSync75(pidPath)) {
316558
316931
  try {
316559
316932
  const pid = parseInt(readFileSync58(pidPath, "utf8").trim(), 10);
316560
316933
  if (pid > 0) {
@@ -316580,8 +316953,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
316580
316953
  execSync53(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.5", { timeout: 3e3, stdio: "ignore" });
316581
316954
  } catch {
316582
316955
  }
316583
- const oaPath = join90(repoRoot, OA_DIR);
316584
- if (existsSync74(oaPath)) {
316956
+ const oaPath = join91(repoRoot, OA_DIR);
316957
+ if (existsSync75(oaPath)) {
316585
316958
  let deleted = false;
316586
316959
  for (let attempt = 0; attempt < 3; attempt++) {
316587
316960
  try {
@@ -316663,18 +317036,18 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
316663
317036
  try {
316664
317037
  const { isPersonaPlexRunning: isPersonaPlexRunning2 } = await Promise.resolve().then(() => (init_personaplex(), personaplex_exports));
316665
317038
  if (isPersonaPlexRunning2()) {
316666
- const ppPidFile = join90(homedir28(), ".open-agents", "voice", "personaplex", "daemon.pid");
316667
- const ppPortFile = join90(homedir28(), ".open-agents", "voice", "personaplex", "daemon.port");
316668
- if (existsSync74(ppPidFile)) {
317039
+ const ppPidFile = join91(homedir28(), ".open-agents", "voice", "personaplex", "daemon.pid");
317040
+ const ppPortFile = join91(homedir28(), ".open-agents", "voice", "personaplex", "daemon.port");
317041
+ if (existsSync75(ppPidFile)) {
316669
317042
  const ppPid = parseInt(readFileSync58(ppPidFile, "utf8").trim(), 10);
316670
- const ppPort = existsSync74(ppPortFile) ? parseInt(readFileSync58(ppPortFile, "utf8").trim(), 10) : void 0;
317043
+ const ppPort = existsSync75(ppPortFile) ? parseInt(readFileSync58(ppPortFile, "utf8").trim(), 10) : void 0;
316671
317044
  if (ppPid > 0 && !registry2.daemons.has("PersonaPlex")) {
316672
317045
  registry2.register({ name: "PersonaPlex", pid: ppPid, port: ppPort, startedAt: Date.now(), status: "running" });
316673
317046
  }
316674
317047
  }
316675
317048
  }
316676
- const nexusPidFile = join90(repoRoot, ".oa", "nexus", "daemon.pid");
316677
- if (existsSync74(nexusPidFile)) {
317049
+ const nexusPidFile = join91(repoRoot, ".oa", "nexus", "daemon.pid");
317050
+ if (existsSync75(nexusPidFile)) {
316678
317051
  const nPid = parseInt(readFileSync58(nexusPidFile, "utf8").trim(), 10);
316679
317052
  if (nPid > 0 && !registry2.daemons.has("Nexus")) {
316680
317053
  try {
@@ -317016,8 +317389,8 @@ Execute this skill now. Follow the behavioral guidance above.`;
317016
317389
  }
317017
317390
  }
317018
317391
  const cleanPath = input.replace(/^['"]|['"]$/g, "").trim();
317019
- const isImage = isImagePath(cleanPath) && existsSync74(resolve35(repoRoot, cleanPath));
317020
- const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync74(resolve35(repoRoot, cleanPath));
317392
+ const isImage = isImagePath(cleanPath) && existsSync75(resolve35(repoRoot, cleanPath));
317393
+ const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync75(resolve35(repoRoot, cleanPath));
317021
317394
  if (activeTask) {
317022
317395
  if (activeTask.runner.isPaused) {
317023
317396
  activeTask.runner.resume();
@@ -317245,7 +317618,7 @@ Summarize or analyze this transcription as appropriate.`;
317245
317618
 
317246
317619
  NEW TASK: ${fullInput}`;
317247
317620
  restoredSessionContext = null;
317248
- } else if (existsSync74(join90(repoRoot, ".oa", "context", "session-diary.md"))) {
317621
+ } else if (existsSync75(join91(repoRoot, ".oa", "context", "session-diary.md"))) {
317249
317622
  taskInput = `[Previous sessions exist \u2014 file_read(".oa/context/session-diary.md") to recall]
317250
317623
 
317251
317624
  ${fullInput}`;
@@ -317579,13 +317952,13 @@ async function runWithTUI(task, config, repoPath, callbacks) {
317579
317952
  const handle2 = startTask(task, config, repoRoot);
317580
317953
  await handle2.promise;
317581
317954
  try {
317582
- const ikDir = join90(repoRoot, ".oa", "identity");
317583
- const ikFile = join90(ikDir, "self-state.json");
317955
+ const ikDir = join91(repoRoot, ".oa", "identity");
317956
+ const ikFile = join91(ikDir, "self-state.json");
317584
317957
  let ikState;
317585
- if (existsSync74(ikFile)) {
317958
+ if (existsSync75(ikFile)) {
317586
317959
  ikState = JSON.parse(readFileSync58(ikFile, "utf8"));
317587
317960
  } else {
317588
- mkdirSync42(ikDir, { recursive: true });
317961
+ mkdirSync43(ikDir, { recursive: true });
317589
317962
  ikState = {
317590
317963
  self_id: `oa-${Date.now().toString(36)}`,
317591
317964
  version: 1,
@@ -317620,11 +317993,11 @@ async function runWithTUI(task, config, repoPath, callbacks) {
317620
317993
  );
317621
317994
  } catch {
317622
317995
  try {
317623
- const archeDir = join90(repoRoot, ".oa", "arche");
317624
- const archeFile = join90(archeDir, "variants.json");
317996
+ const archeDir = join91(repoRoot, ".oa", "arche");
317997
+ const archeFile = join91(archeDir, "variants.json");
317625
317998
  let variants = [];
317626
317999
  try {
317627
- if (existsSync74(archeFile)) variants = JSON.parse(readFileSync58(archeFile, "utf8"));
318000
+ if (existsSync75(archeFile)) variants = JSON.parse(readFileSync58(archeFile, "utf8"));
317628
318001
  } catch {
317629
318002
  }
317630
318003
  variants.push({
@@ -317638,14 +318011,14 @@ async function runWithTUI(task, config, repoPath, callbacks) {
317638
318011
  tags: ["general"]
317639
318012
  });
317640
318013
  if (variants.length > 50) variants = variants.slice(-50);
317641
- mkdirSync42(archeDir, { recursive: true });
318014
+ mkdirSync43(archeDir, { recursive: true });
317642
318015
  writeFileSync38(archeFile, JSON.stringify(variants, null, 2));
317643
318016
  } catch {
317644
318017
  }
317645
318018
  }
317646
318019
  try {
317647
- const metaFile = join90(repoRoot, ".oa", "memory", "metabolism", "store.json");
317648
- if (existsSync74(metaFile)) {
318020
+ const metaFile = join91(repoRoot, ".oa", "memory", "metabolism", "store.json");
318021
+ if (existsSync75(metaFile)) {
317649
318022
  const store2 = JSON.parse(readFileSync58(metaFile, "utf8"));
317650
318023
  const surfaced = store2.filter((m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15).sort((a2, b) => b.scores.utility * b.scores.confidence - a2.scores.utility * a2.scores.confidence).slice(0, 5);
317651
318024
  let updated = false;
@@ -317710,9 +318083,9 @@ Rules:
317710
318083
  try {
317711
318084
  const { initDb: initDb2 } = __require("@open-agents/memory");
317712
318085
  const { ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
317713
- const dbDir = join90(repoRoot, ".oa", "memory");
317714
- mkdirSync42(dbDir, { recursive: true });
317715
- const db = initDb2(join90(dbDir, "structured.db"));
318086
+ const dbDir = join91(repoRoot, ".oa", "memory");
318087
+ mkdirSync43(dbDir, { recursive: true });
318088
+ const db = initDb2(join91(dbDir, "structured.db"));
317716
318089
  const memStore = new ProceduralMemoryStore2(db);
317717
318090
  memStore.createWithEmbedding({
317718
318091
  content: content.slice(0, 600),
@@ -317727,11 +318100,11 @@ Rules:
317727
318100
  db.close();
317728
318101
  } catch {
317729
318102
  }
317730
- const metaDir = join90(repoRoot, ".oa", "memory", "metabolism");
317731
- const storeFile = join90(metaDir, "store.json");
318103
+ const metaDir = join91(repoRoot, ".oa", "memory", "metabolism");
318104
+ const storeFile = join91(metaDir, "store.json");
317732
318105
  let store2 = [];
317733
318106
  try {
317734
- if (existsSync74(storeFile)) store2 = JSON.parse(readFileSync58(storeFile, "utf8"));
318107
+ if (existsSync75(storeFile)) store2 = JSON.parse(readFileSync58(storeFile, "utf8"));
317735
318108
  } catch {
317736
318109
  }
317737
318110
  store2.push({
@@ -317746,25 +318119,25 @@ Rules:
317746
318119
  accessCount: 0
317747
318120
  });
317748
318121
  if (store2.length > 100) store2 = store2.slice(-100);
317749
- mkdirSync42(metaDir, { recursive: true });
318122
+ mkdirSync43(metaDir, { recursive: true });
317750
318123
  writeFileSync38(storeFile, JSON.stringify(store2, null, 2));
317751
318124
  }
317752
318125
  }
317753
318126
  } catch {
317754
318127
  }
317755
318128
  try {
317756
- const cohereSettingsFile = join90(repoRoot, ".oa", "settings.json");
318129
+ const cohereSettingsFile = join91(repoRoot, ".oa", "settings.json");
317757
318130
  let cohereActive = false;
317758
318131
  try {
317759
- if (existsSync74(cohereSettingsFile)) {
318132
+ if (existsSync75(cohereSettingsFile)) {
317760
318133
  const settings = JSON.parse(readFileSync58(cohereSettingsFile, "utf8"));
317761
318134
  cohereActive = settings.cohere === true;
317762
318135
  }
317763
318136
  } catch {
317764
318137
  }
317765
318138
  if (cohereActive) {
317766
- const metaFile = join90(repoRoot, ".oa", "memory", "metabolism", "store.json");
317767
- if (existsSync74(metaFile)) {
318139
+ const metaFile = join91(repoRoot, ".oa", "memory", "metabolism", "store.json");
318140
+ if (existsSync75(metaFile)) {
317768
318141
  const store2 = JSON.parse(readFileSync58(metaFile, "utf8"));
317769
318142
  const latest = store2.filter((m2) => m2.sourceTrace === "trajectory-extraction" || m2.sourceTrace === "llm-trajectory-extraction").slice(-1)[0];
317770
318143
  if (latest && latest.scores?.confidence >= 0.6) {
@@ -317790,8 +318163,8 @@ Rules:
317790
318163
  }
317791
318164
  } catch (err) {
317792
318165
  try {
317793
- const ikFile = join90(repoRoot, ".oa", "identity", "self-state.json");
317794
- if (existsSync74(ikFile)) {
318166
+ const ikFile = join91(repoRoot, ".oa", "identity", "self-state.json");
318167
+ if (existsSync75(ikFile)) {
317795
318168
  const ikState = JSON.parse(readFileSync58(ikFile, "utf8"));
317796
318169
  ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
317797
318170
  ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.05);
@@ -317799,8 +318172,8 @@ Rules:
317799
318172
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
317800
318173
  writeFileSync38(ikFile, JSON.stringify(ikState, null, 2));
317801
318174
  }
317802
- const metaFile = join90(repoRoot, ".oa", "memory", "metabolism", "store.json");
317803
- if (existsSync74(metaFile)) {
318175
+ const metaFile = join91(repoRoot, ".oa", "memory", "metabolism", "store.json");
318176
+ if (existsSync75(metaFile)) {
317804
318177
  const store2 = JSON.parse(readFileSync58(metaFile, "utf8"));
317805
318178
  const surfaced = store2.filter((m2) => m2.type !== "quarantine" && m2.scores?.confidence > 0.15).sort((a2, b) => b.scores.utility * b.scores.confidence - a2.scores.utility * a2.scores.confidence).slice(0, 5);
317806
318179
  for (const item of surfaced) {
@@ -317812,11 +318185,11 @@ Rules:
317812
318185
  writeFileSync38(metaFile, JSON.stringify(store2, null, 2));
317813
318186
  }
317814
318187
  try {
317815
- const archeDir = join90(repoRoot, ".oa", "arche");
317816
- const archeFile = join90(archeDir, "variants.json");
318188
+ const archeDir = join91(repoRoot, ".oa", "arche");
318189
+ const archeFile = join91(archeDir, "variants.json");
317817
318190
  let variants = [];
317818
318191
  try {
317819
- if (existsSync74(archeFile)) variants = JSON.parse(readFileSync58(archeFile, "utf8"));
318192
+ if (existsSync75(archeFile)) variants = JSON.parse(readFileSync58(archeFile, "utf8"));
317820
318193
  } catch {
317821
318194
  }
317822
318195
  variants.push({
@@ -317830,7 +318203,7 @@ Rules:
317830
318203
  tags: ["general"]
317831
318204
  });
317832
318205
  if (variants.length > 50) variants = variants.slice(-50);
317833
- mkdirSync42(archeDir, { recursive: true });
318206
+ mkdirSync43(archeDir, { recursive: true });
317834
318207
  writeFileSync38(archeFile, JSON.stringify(variants, null, 2));
317835
318208
  } catch {
317836
318209
  }
@@ -317913,13 +318286,13 @@ __export(run_exports, {
317913
318286
  });
317914
318287
  import { resolve as resolve36 } from "node:path";
317915
318288
  import { spawn as spawn25 } from "node:child_process";
317916
- import { mkdirSync as mkdirSync43, writeFileSync as writeFileSync39, readFileSync as readFileSync59, readdirSync as readdirSync25, existsSync as existsSync75 } from "node:fs";
318289
+ import { mkdirSync as mkdirSync44, writeFileSync as writeFileSync39, readFileSync as readFileSync59, readdirSync as readdirSync25, existsSync as existsSync76 } from "node:fs";
317917
318290
  import { randomBytes as randomBytes20 } from "node:crypto";
317918
- import { join as join91 } from "node:path";
318291
+ import { join as join92 } from "node:path";
317919
318292
  function jobsDir2(repoPath) {
317920
318293
  const root = resolve36(repoPath ?? process.cwd());
317921
- const dir = join91(root, ".oa", "jobs");
317922
- mkdirSync43(dir, { recursive: true });
318294
+ const dir = join92(root, ".oa", "jobs");
318295
+ mkdirSync44(dir, { recursive: true });
317923
318296
  return dir;
317924
318297
  }
317925
318298
  async function runCommand(opts, config) {
@@ -318034,7 +318407,7 @@ async function runBackground(task, config, opts) {
318034
318407
  }
318035
318408
  });
318036
318409
  job.pid = child.pid ?? 0;
318037
- writeFileSync39(join91(dir, `${id}.json`), JSON.stringify(job, null, 2));
318410
+ writeFileSync39(join92(dir, `${id}.json`), JSON.stringify(job, null, 2));
318038
318411
  let output = "";
318039
318412
  child.stdout?.on("data", (chunk) => {
318040
318413
  output += chunk.toString();
@@ -318050,7 +318423,7 @@ async function runBackground(task, config, opts) {
318050
318423
  job.summary = result.summary;
318051
318424
  job.durationMs = result.durationMs;
318052
318425
  job.error = result.error;
318053
- writeFileSync39(join91(dir, `${id}.json`), JSON.stringify(job, null, 2));
318426
+ writeFileSync39(join92(dir, `${id}.json`), JSON.stringify(job, null, 2));
318054
318427
  } catch {
318055
318428
  }
318056
318429
  });
@@ -318066,8 +318439,8 @@ async function runBackground(task, config, opts) {
318066
318439
  }
318067
318440
  function statusCommand(jobId, repoPath) {
318068
318441
  const dir = jobsDir2(repoPath);
318069
- const file = join91(dir, `${jobId}.json`);
318070
- if (!existsSync75(file)) {
318442
+ const file = join92(dir, `${jobId}.json`);
318443
+ if (!existsSync76(file)) {
318071
318444
  console.error(`Job not found: ${jobId}`);
318072
318445
  console.log(`Available jobs: oa jobs`);
318073
318446
  process.exit(1);
@@ -318092,7 +318465,7 @@ function jobsCommand(repoPath) {
318092
318465
  console.log("Jobs:");
318093
318466
  for (const file of files) {
318094
318467
  try {
318095
- const job = JSON.parse(readFileSync59(join91(dir, file), "utf-8"));
318468
+ const job = JSON.parse(readFileSync59(join92(dir, file), "utf-8"));
318096
318469
  const icon = job.status === "completed" ? "\u2713" : job.status === "failed" ? "\u2717" : "\u25CF";
318097
318470
  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`;
318098
318471
  console.log(` ${icon} ${job.id} [${job.status}] ${runtime} \u2014 ${job.task.slice(0, 60)}`);
@@ -318112,7 +318485,7 @@ import { glob as glob2 } from "glob";
318112
318485
  import ignore from "ignore";
318113
318486
  import { readFile as readFile23, stat as stat5 } from "node:fs/promises";
318114
318487
  import { createHash as createHash7 } from "node:crypto";
318115
- import { join as join92, relative as relative5, extname as extname12, basename as basename18 } from "node:path";
318488
+ import { join as join93, relative as relative5, extname as extname12, basename as basename18 } from "node:path";
318116
318489
  var DEFAULT_EXCLUDE, LANGUAGE_MAP, CodebaseIndexer;
318117
318490
  var init_codebase_indexer = __esm({
318118
318491
  "packages/indexer/dist/codebase-indexer.js"() {
@@ -318156,7 +318529,7 @@ var init_codebase_indexer = __esm({
318156
318529
  const ig = ignore.default();
318157
318530
  if (this.config.respectGitignore) {
318158
318531
  try {
318159
- const gitignoreContent = await readFile23(join92(this.config.rootDir, ".gitignore"), "utf-8");
318532
+ const gitignoreContent = await readFile23(join93(this.config.rootDir, ".gitignore"), "utf-8");
318160
318533
  ig.add(gitignoreContent);
318161
318534
  } catch {
318162
318535
  }
@@ -318171,7 +318544,7 @@ var init_codebase_indexer = __esm({
318171
318544
  for (const relativePath of files) {
318172
318545
  if (ig.ignores(relativePath))
318173
318546
  continue;
318174
- const fullPath = join92(this.config.rootDir, relativePath);
318547
+ const fullPath = join93(this.config.rootDir, relativePath);
318175
318548
  try {
318176
318549
  const fileStat = await stat5(fullPath);
318177
318550
  if (fileStat.size > this.config.maxFileSize)
@@ -318217,7 +318590,7 @@ var init_codebase_indexer = __esm({
318217
318590
  if (!child) {
318218
318591
  child = {
318219
318592
  name: part,
318220
- path: join92(current.path, part),
318593
+ path: join93(current.path, part),
318221
318594
  type: "directory",
318222
318595
  children: []
318223
318596
  };
@@ -318325,13 +318698,13 @@ __export(index_repo_exports, {
318325
318698
  indexRepoCommand: () => indexRepoCommand
318326
318699
  });
318327
318700
  import { resolve as resolve37 } from "node:path";
318328
- import { existsSync as existsSync76, statSync as statSync21 } from "node:fs";
318701
+ import { existsSync as existsSync77, statSync as statSync21 } from "node:fs";
318329
318702
  import { cwd as cwd2 } from "node:process";
318330
318703
  async function indexRepoCommand(opts, _config3) {
318331
318704
  const repoRoot = resolve37(opts.repoPath ?? cwd2());
318332
318705
  printHeader("Index Repository");
318333
318706
  printInfo(`Indexing: ${repoRoot}`);
318334
- if (!existsSync76(repoRoot)) {
318707
+ if (!existsSync77(repoRoot)) {
318335
318708
  printError(`Path does not exist: ${repoRoot}`);
318336
318709
  process.exit(1);
318337
318710
  }
@@ -318583,7 +318956,7 @@ var config_exports2 = {};
318583
318956
  __export(config_exports2, {
318584
318957
  configCommand: () => configCommand
318585
318958
  });
318586
- import { join as join93, resolve as resolve38 } from "node:path";
318959
+ import { join as join94, resolve as resolve38 } from "node:path";
318587
318960
  import { homedir as homedir29 } from "node:os";
318588
318961
  import { cwd as cwd3 } from "node:process";
318589
318962
  function redactIfSensitive(key, value2) {
@@ -318665,7 +319038,7 @@ function handleShow(opts, config) {
318665
319038
  }
318666
319039
  }
318667
319040
  printSection("Config File");
318668
- printInfo(`~/.open-agents/config.json (${join93(homedir29(), ".open-agents", "config.json")})`);
319041
+ printInfo(`~/.open-agents/config.json (${join94(homedir29(), ".open-agents", "config.json")})`);
318669
319042
  printSection("Priority Chain");
318670
319043
  printInfo(" 1. CLI flags (--model, --backend-url, etc.)");
318671
319044
  printInfo(" 2. Project .oa/settings.json (--local)");
@@ -318704,7 +319077,7 @@ function handleSet(opts, _config3) {
318704
319077
  const coerced = coerceForSettings(key, value2);
318705
319078
  saveProjectSettings(repoRoot, { [key]: coerced });
318706
319079
  printSuccess(`Project override set: ${key} = ${redactIfSensitive(key, value2)}`);
318707
- printInfo(`Saved to ${join93(repoRoot, ".oa", "settings.json")}`);
319080
+ printInfo(`Saved to ${join94(repoRoot, ".oa", "settings.json")}`);
318708
319081
  printInfo("This override applies only when running in this workspace.");
318709
319082
  } catch (err) {
318710
319083
  printError(`Failed to save: ${err instanceof Error ? err.message : String(err)}`);
@@ -318873,8 +319246,8 @@ __export(eval_exports, {
318873
319246
  evalCommand: () => evalCommand
318874
319247
  });
318875
319248
  import { tmpdir as tmpdir17 } from "node:os";
318876
- import { mkdirSync as mkdirSync44, writeFileSync as writeFileSync40 } from "node:fs";
318877
- import { join as join94 } from "node:path";
319249
+ import { mkdirSync as mkdirSync45, writeFileSync as writeFileSync40 } from "node:fs";
319250
+ import { join as join95 } from "node:path";
318878
319251
  async function evalCommand(opts, config) {
318879
319252
  const suiteName = opts.suite ?? "basic";
318880
319253
  const suite = SUITES[suiteName];
@@ -319003,10 +319376,10 @@ async function evalCommand(opts, config) {
319003
319376
  process.exit(failed > 0 ? 1 : 0);
319004
319377
  }
319005
319378
  function createTempEvalRepo() {
319006
- const dir = join94(tmpdir17(), `open-agents-eval-${Date.now()}`);
319007
- mkdirSync44(dir, { recursive: true });
319379
+ const dir = join95(tmpdir17(), `open-agents-eval-${Date.now()}`);
319380
+ mkdirSync45(dir, { recursive: true });
319008
319381
  writeFileSync40(
319009
- join94(dir, "package.json"),
319382
+ join95(dir, "package.json"),
319010
319383
  JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n",
319011
319384
  "utf8"
319012
319385
  );
@@ -319069,7 +319442,7 @@ init_updater();
319069
319442
  import { parseArgs as nodeParseArgs2 } from "node:util";
319070
319443
  import { createRequire as createRequire6 } from "node:module";
319071
319444
  import { fileURLToPath as fileURLToPath18 } from "node:url";
319072
- import { dirname as dirname27, join as join95 } from "node:path";
319445
+ import { dirname as dirname27, join as join96 } from "node:path";
319073
319446
 
319074
319447
  // packages/cli/src/cli.ts
319075
319448
  import { createInterface } from "node:readline";
@@ -319176,7 +319549,7 @@ init_output();
319176
319549
  function getVersion5() {
319177
319550
  try {
319178
319551
  const require3 = createRequire6(import.meta.url);
319179
- const pkgPath = join95(dirname27(fileURLToPath18(import.meta.url)), "..", "package.json");
319552
+ const pkgPath = join96(dirname27(fileURLToPath18(import.meta.url)), "..", "package.json");
319180
319553
  const pkg = require3(pkgPath);
319181
319554
  return pkg.version;
319182
319555
  } catch {
@@ -319468,12 +319841,12 @@ function crashLog(label, err) {
319468
319841
  const logLine = `[${timestamp}] ${label}: ${msg}
319469
319842
  `;
319470
319843
  try {
319471
- const { appendFileSync: appendFileSync7, mkdirSync: mkdirSync45 } = __require("node:fs");
319472
- const { join: join96 } = __require("node:path");
319844
+ const { appendFileSync: appendFileSync7, mkdirSync: mkdirSync46 } = __require("node:fs");
319845
+ const { join: join97 } = __require("node:path");
319473
319846
  const { homedir: homedir30 } = __require("node:os");
319474
- const logDir = join96(homedir30(), ".open-agents");
319475
- mkdirSync45(logDir, { recursive: true });
319476
- appendFileSync7(join96(logDir, "crash.log"), logLine);
319847
+ const logDir = join97(homedir30(), ".open-agents");
319848
+ mkdirSync46(logDir, { recursive: true });
319849
+ appendFileSync7(join97(logDir, "crash.log"), logLine);
319477
319850
  } catch {
319478
319851
  }
319479
319852
  try {