open-agents-ai 0.139.8 → 0.139.9

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 +482 -292
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10892,8 +10892,8 @@ async function loadTranscribeCli() {
10892
10892
  const nvmBase = join17(homedir6(), ".nvm", "versions", "node");
10893
10893
  if (existsSync14(nvmBase)) {
10894
10894
  try {
10895
- const { readdirSync: readdirSync17 } = await import("node:fs");
10896
- for (const ver of readdirSync17(nvmBase)) {
10895
+ const { readdirSync: readdirSync18 } = await import("node:fs");
10896
+ for (const ver of readdirSync18(nvmBase)) {
10897
10897
  const tcPath = join17(nvmBase, ver, "lib", "node_modules", "transcribe-cli");
10898
10898
  if (existsSync14(join17(tcPath, "dist", "index.js"))) {
10899
10899
  const { createRequire: createRequire4 } = await import("node:module");
@@ -12531,9 +12531,9 @@ print("${sentinel}")
12531
12531
  if (!this.proc || this.proc.killed) {
12532
12532
  return { success: false, path: "" };
12533
12533
  }
12534
- const { mkdirSync: mkdirSync21, writeFileSync: writeFileSync20 } = await import("node:fs");
12534
+ const { mkdirSync: mkdirSync22, writeFileSync: writeFileSync21 } = await import("node:fs");
12535
12535
  const sessionDir = join20(this.cwd, ".oa", "rlm");
12536
- mkdirSync21(sessionDir, { recursive: true });
12536
+ mkdirSync22(sessionDir, { recursive: true });
12537
12537
  const sessionPath = join20(sessionDir, "session.json");
12538
12538
  try {
12539
12539
  const inspectCode = `
@@ -12557,7 +12557,7 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
12557
12557
  trajectoryCount: this.trajectory.length,
12558
12558
  subCallCount: this.subCallCount
12559
12559
  };
12560
- writeFileSync20(sessionPath, JSON.stringify(sessionData, null, 2), "utf8");
12560
+ writeFileSync21(sessionPath, JSON.stringify(sessionData, null, 2), "utf8");
12561
12561
  return { success: true, path: sessionPath };
12562
12562
  }
12563
12563
  } catch {
@@ -12569,11 +12569,11 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
12569
12569
  * what was previously computed. */
12570
12570
  async loadSessionInfo() {
12571
12571
  try {
12572
- const { readFileSync: readFileSync33, existsSync: existsSync45 } = await import("node:fs");
12572
+ const { readFileSync: readFileSync34, existsSync: existsSync46 } = await import("node:fs");
12573
12573
  const sessionPath = join20(this.cwd, ".oa", "rlm", "session.json");
12574
- if (!existsSync45(sessionPath))
12574
+ if (!existsSync46(sessionPath))
12575
12575
  return null;
12576
- return JSON.parse(readFileSync33(sessionPath, "utf8"));
12576
+ return JSON.parse(readFileSync34(sessionPath, "utf8"));
12577
12577
  } catch {
12578
12578
  return null;
12579
12579
  }
@@ -12750,10 +12750,10 @@ var init_memory_metabolism = __esm({
12750
12750
  const trajDir = join21(this.cwd, ".oa", "rlm-trajectories");
12751
12751
  let lessons = [];
12752
12752
  try {
12753
- const { readdirSync: readdirSync17, readFileSync: readFileSync33 } = await import("node:fs");
12754
- const files = readdirSync17(trajDir).filter((f) => f.endsWith(".jsonl")).sort().reverse().slice(0, 3);
12753
+ const { readdirSync: readdirSync18, readFileSync: readFileSync34 } = await import("node:fs");
12754
+ const files = readdirSync18(trajDir).filter((f) => f.endsWith(".jsonl")).sort().reverse().slice(0, 3);
12755
12755
  for (const file of files) {
12756
- const lines = readFileSync33(join21(trajDir, file), "utf8").split("\n").filter((l) => l.trim());
12756
+ const lines = readFileSync34(join21(trajDir, file), "utf8").split("\n").filter((l) => l.trim());
12757
12757
  for (const line of lines) {
12758
12758
  try {
12759
12759
  const entry = JSON.parse(line);
@@ -13137,14 +13137,14 @@ ${issues.map((i) => ` - ${i}`).join("\n")}` : " No issues found."),
13137
13137
  * Optionally filter by task type for phase-aware context (FSM paper insight).
13138
13138
  */
13139
13139
  getTopMemoriesSync(k = 5, taskType) {
13140
- const { readFileSync: readFileSync33, existsSync: existsSync45 } = __require("node:fs");
13140
+ const { readFileSync: readFileSync34, existsSync: existsSync46 } = __require("node:fs");
13141
13141
  const metaDir = join21(this.cwd, ".oa", "memory", "metabolism");
13142
13142
  const storeFile = join21(metaDir, "store.json");
13143
- if (!existsSync45(storeFile))
13143
+ if (!existsSync46(storeFile))
13144
13144
  return "";
13145
13145
  let store = [];
13146
13146
  try {
13147
- store = JSON.parse(readFileSync33(storeFile, "utf8"));
13147
+ store = JSON.parse(readFileSync34(storeFile, "utf8"));
13148
13148
  } catch {
13149
13149
  return "";
13150
13150
  }
@@ -13166,14 +13166,14 @@ ${issues.map((i) => ` - ${i}`).join("\n")}` : " No issues found."),
13166
13166
  /** Update memory scores based on task outcome. Called after task completion.
13167
13167
  * Memories used in successful tasks get boosted. Memories present during failures get decayed. */
13168
13168
  updateFromOutcomeSync(surfacedMemoryText, succeeded) {
13169
- const { readFileSync: readFileSync33, writeFileSync: writeFileSync20, existsSync: existsSync45, mkdirSync: mkdirSync21 } = __require("node:fs");
13169
+ const { readFileSync: readFileSync34, writeFileSync: writeFileSync21, existsSync: existsSync46, mkdirSync: mkdirSync22 } = __require("node:fs");
13170
13170
  const metaDir = join21(this.cwd, ".oa", "memory", "metabolism");
13171
13171
  const storeFile = join21(metaDir, "store.json");
13172
- if (!existsSync45(storeFile))
13172
+ if (!existsSync46(storeFile))
13173
13173
  return;
13174
13174
  let store = [];
13175
13175
  try {
13176
- store = JSON.parse(readFileSync33(storeFile, "utf8"));
13176
+ store = JSON.parse(readFileSync34(storeFile, "utf8"));
13177
13177
  } catch {
13178
13178
  return;
13179
13179
  }
@@ -13197,8 +13197,8 @@ ${issues.map((i) => ` - ${i}`).join("\n")}` : " No issues found."),
13197
13197
  updated = true;
13198
13198
  }
13199
13199
  if (updated) {
13200
- mkdirSync21(metaDir, { recursive: true });
13201
- writeFileSync20(storeFile, JSON.stringify(store, null, 2));
13200
+ mkdirSync22(metaDir, { recursive: true });
13201
+ writeFileSync21(storeFile, JSON.stringify(store, null, 2));
13202
13202
  }
13203
13203
  }
13204
13204
  // ── Storage ──────────────────────────────────────────────────────────
@@ -13620,13 +13620,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
13620
13620
  // Per EvoSkill (arXiv:2603.02766): retrieve relevant strategies from archive.
13621
13621
  /** Retrieve top-K strategies for context injection. Returns "" if none. */
13622
13622
  getRelevantStrategiesSync(k = 3, taskType) {
13623
- const { readFileSync: readFileSync33, existsSync: existsSync45 } = __require("node:fs");
13623
+ const { readFileSync: readFileSync34, existsSync: existsSync46 } = __require("node:fs");
13624
13624
  const archiveFile = join23(this.cwd, ".oa", "arche", "variants.json");
13625
- if (!existsSync45(archiveFile))
13625
+ if (!existsSync46(archiveFile))
13626
13626
  return "";
13627
13627
  let variants = [];
13628
13628
  try {
13629
- variants = JSON.parse(readFileSync33(archiveFile, "utf8"));
13629
+ variants = JSON.parse(readFileSync34(archiveFile, "utf8"));
13630
13630
  } catch {
13631
13631
  return "";
13632
13632
  }
@@ -13644,13 +13644,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
13644
13644
  }
13645
13645
  /** Archive a strategy variant synchronously (for task completion path) */
13646
13646
  archiveVariantSync(strategy, outcome, tags = []) {
13647
- const { readFileSync: readFileSync33, writeFileSync: writeFileSync20, existsSync: existsSync45, mkdirSync: mkdirSync21 } = __require("node:fs");
13647
+ const { readFileSync: readFileSync34, writeFileSync: writeFileSync21, existsSync: existsSync46, mkdirSync: mkdirSync22 } = __require("node:fs");
13648
13648
  const dir = join23(this.cwd, ".oa", "arche");
13649
13649
  const archiveFile = join23(dir, "variants.json");
13650
13650
  let variants = [];
13651
13651
  try {
13652
- if (existsSync45(archiveFile))
13653
- variants = JSON.parse(readFileSync33(archiveFile, "utf8"));
13652
+ if (existsSync46(archiveFile))
13653
+ variants = JSON.parse(readFileSync34(archiveFile, "utf8"));
13654
13654
  } catch {
13655
13655
  }
13656
13656
  variants.push({
@@ -13665,8 +13665,8 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
13665
13665
  });
13666
13666
  if (variants.length > 50)
13667
13667
  variants = variants.slice(-50);
13668
- mkdirSync21(dir, { recursive: true });
13669
- writeFileSync20(archiveFile, JSON.stringify(variants, null, 2));
13668
+ mkdirSync22(dir, { recursive: true });
13669
+ writeFileSync21(archiveFile, JSON.stringify(variants, null, 2));
13670
13670
  }
13671
13671
  async saveArchive(variants) {
13672
13672
  const dir = join23(this.cwd, ".oa", "arche");
@@ -23755,10 +23755,10 @@ ${marker}` : marker);
23755
23755
  if (!this._workingDirectory)
23756
23756
  return;
23757
23757
  try {
23758
- const { mkdirSync: mkdirSync21, writeFileSync: writeFileSync20 } = __require("node:fs");
23759
- const { join: join64 } = __require("node:path");
23760
- const sessionDir = join64(this._workingDirectory, ".oa", "session", this._sessionId);
23761
- mkdirSync21(sessionDir, { recursive: true });
23758
+ const { mkdirSync: mkdirSync22, writeFileSync: writeFileSync21 } = __require("node:fs");
23759
+ const { join: join65 } = __require("node:path");
23760
+ const sessionDir = join65(this._workingDirectory, ".oa", "session", this._sessionId);
23761
+ mkdirSync22(sessionDir, { recursive: true });
23762
23762
  const checkpoint = {
23763
23763
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
23764
23764
  sessionId: this._sessionId,
@@ -23770,7 +23770,7 @@ ${marker}` : marker);
23770
23770
  memexEntryCount: this._memexArchive.size,
23771
23771
  fileRegistrySize: this._fileRegistry.size
23772
23772
  };
23773
- writeFileSync20(join64(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
23773
+ writeFileSync21(join65(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
23774
23774
  } catch {
23775
23775
  }
23776
23776
  }
@@ -26636,8 +26636,8 @@ var init_listen = __esm({
26636
26636
  const nvmBase = join42(homedir8(), ".nvm", "versions", "node");
26637
26637
  if (existsSync27(nvmBase)) {
26638
26638
  try {
26639
- const { readdirSync: readdirSync17 } = await import("node:fs");
26640
- for (const ver of readdirSync17(nvmBase)) {
26639
+ const { readdirSync: readdirSync18 } = await import("node:fs");
26640
+ for (const ver of readdirSync18(nvmBase)) {
26641
26641
  const tcPath = join42(nvmBase, ver, "lib", "node_modules", "transcribe-cli");
26642
26642
  if (existsSync27(join42(tcPath, "dist", "index.js"))) {
26643
26643
  const { createRequire: createRequire4 } = await import("node:module");
@@ -34926,26 +34926,26 @@ async function fetchOpenAIModels(baseUrl, apiKey) {
34926
34926
  async function fetchPeerModels(peerId, authKey) {
34927
34927
  try {
34928
34928
  const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
34929
- const { existsSync: existsSync45, readFileSync: readFileSync33 } = await import("node:fs");
34930
- const { join: join64 } = await import("node:path");
34929
+ const { existsSync: existsSync46, readFileSync: readFileSync34 } = await import("node:fs");
34930
+ const { join: join65 } = await import("node:path");
34931
34931
  const cwd4 = process.cwd();
34932
34932
  const nexusTool = new NexusTool2(cwd4);
34933
34933
  const nexusDir = nexusTool.getNexusDir();
34934
34934
  let isLocalPeer = false;
34935
34935
  try {
34936
- const statusPath = join64(nexusDir, "status.json");
34937
- if (existsSync45(statusPath)) {
34938
- const status = JSON.parse(readFileSync33(statusPath, "utf8"));
34936
+ const statusPath = join65(nexusDir, "status.json");
34937
+ if (existsSync46(statusPath)) {
34938
+ const status = JSON.parse(readFileSync34(statusPath, "utf8"));
34939
34939
  if (status.peerId === peerId)
34940
34940
  isLocalPeer = true;
34941
34941
  }
34942
34942
  } catch {
34943
34943
  }
34944
34944
  if (isLocalPeer) {
34945
- const pricingPath = join64(nexusDir, "pricing.json");
34946
- if (existsSync45(pricingPath)) {
34945
+ const pricingPath = join65(nexusDir, "pricing.json");
34946
+ if (existsSync46(pricingPath)) {
34947
34947
  try {
34948
- const pricing = JSON.parse(readFileSync33(pricingPath, "utf8"));
34948
+ const pricing = JSON.parse(readFileSync34(pricingPath, "utf8"));
34949
34949
  const localModels = (pricing.models || []).map((m) => ({
34950
34950
  name: m.model || "unknown",
34951
34951
  size: m.parameterSize || "",
@@ -34959,10 +34959,10 @@ async function fetchPeerModels(peerId, authKey) {
34959
34959
  }
34960
34960
  }
34961
34961
  }
34962
- const cachePath = join64(nexusDir, "peer-models-cache.json");
34963
- if (existsSync45(cachePath)) {
34962
+ const cachePath = join65(nexusDir, "peer-models-cache.json");
34963
+ if (existsSync46(cachePath)) {
34964
34964
  try {
34965
- const cache4 = JSON.parse(readFileSync33(cachePath, "utf8"));
34965
+ const cache4 = JSON.parse(readFileSync34(cachePath, "utf8"));
34966
34966
  if (cache4.peerId === peerId && cache4.models?.length > 0) {
34967
34967
  const age = Date.now() - new Date(cache4.cachedAt).getTime();
34968
34968
  if (age < 5 * 60 * 1e3) {
@@ -35077,10 +35077,10 @@ async function fetchPeerModels(peerId, authKey) {
35077
35077
  } catch {
35078
35078
  }
35079
35079
  if (isLocalPeer) {
35080
- const pricingPath = join64(nexusDir, "pricing.json");
35081
- if (existsSync45(pricingPath)) {
35080
+ const pricingPath = join65(nexusDir, "pricing.json");
35081
+ if (existsSync46(pricingPath)) {
35082
35082
  try {
35083
- const pricing = JSON.parse(readFileSync33(pricingPath, "utf8"));
35083
+ const pricing = JSON.parse(readFileSync34(pricingPath, "utf8"));
35084
35084
  return (pricing.models || []).map((m) => ({
35085
35085
  name: m.model || "unknown",
35086
35086
  size: m.parameterSize || "",
@@ -41696,6 +41696,8 @@ Error: ${err instanceof Error ? err.message : String(err)}`);
41696
41696
  // packages/cli/dist/tui/commands.js
41697
41697
  import * as nodeOs from "node:os";
41698
41698
  import { execSync as nodeExecSync } from "node:child_process";
41699
+ import { existsSync as existsSync36, readFileSync as readFileSync25, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, readdirSync as readdirSync10, statSync as statSync13, rmSync } from "node:fs";
41700
+ import { join as join51 } from "node:path";
41699
41701
  function safeLog(text) {
41700
41702
  if (isNeovimActive()) {
41701
41703
  writeToNeovimOutput(text + "\n");
@@ -42121,6 +42123,194 @@ async function handleSlashCommand(input, ctx) {
42121
42123
  safeLog(lines.join("\n"));
42122
42124
  return "handled";
42123
42125
  }
42126
+ case "ipfs": {
42127
+ const lines = [];
42128
+ lines.push(`
42129
+ ${c2.bold("IPFS / Helia Status")}
42130
+ `);
42131
+ const ipfsDir = join51(ctx.repoRoot, ".oa", "ipfs");
42132
+ const ipfsLocalDir = join51(ipfsDir, "local");
42133
+ let ipfsFiles = 0;
42134
+ let ipfsBytes = 0;
42135
+ let heliaBlocks = 0;
42136
+ let heliaBytes = 0;
42137
+ try {
42138
+ if (existsSync36(ipfsLocalDir)) {
42139
+ const files = readdirSync10(ipfsLocalDir).filter((f) => f.endsWith(".json"));
42140
+ ipfsFiles = files.length;
42141
+ for (const f of files) {
42142
+ try {
42143
+ ipfsBytes += statSync13(join51(ipfsLocalDir, f)).size;
42144
+ } catch {
42145
+ }
42146
+ }
42147
+ }
42148
+ const heliaBlockDir = join51(ipfsDir, "blocks");
42149
+ if (existsSync36(heliaBlockDir)) {
42150
+ const walkDir = (dir) => {
42151
+ for (const entry of readdirSync10(dir, { withFileTypes: true })) {
42152
+ if (entry.isDirectory())
42153
+ walkDir(join51(dir, entry.name));
42154
+ else {
42155
+ heliaBlocks++;
42156
+ try {
42157
+ heliaBytes += statSync13(join51(dir, entry.name)).size;
42158
+ } catch {
42159
+ }
42160
+ }
42161
+ }
42162
+ };
42163
+ walkDir(heliaBlockDir);
42164
+ }
42165
+ } catch {
42166
+ }
42167
+ lines.push(` ${c2.dim("Local fallback (SHA-256):")}`);
42168
+ lines.push(` Files: ${c2.bold(String(ipfsFiles))} Size: ${c2.bold(formatFileSize(ipfsBytes))}`);
42169
+ lines.push(` ${c2.dim("Helia blocks:")}`);
42170
+ lines.push(` Blocks: ${c2.bold(String(heliaBlocks))} Size: ${c2.bold(formatFileSize(heliaBytes))}`);
42171
+ lines.push(` Backend: ${heliaBlocks > 0 ? c2.green("helia-ipfs") : c2.yellow("sha256-local (Helia not initialized)")}`);
42172
+ lines.push(`
42173
+ ${c2.bold("Identity Kernel")}`);
42174
+ const idDir = join51(ctx.repoRoot, ".oa", "identity");
42175
+ try {
42176
+ const stateFile = join51(idDir, "self-state.json");
42177
+ if (existsSync36(stateFile)) {
42178
+ const state = JSON.parse(readFileSync25(stateFile, "utf8"));
42179
+ lines.push(` Version: ${c2.bold("v" + (state.version ?? "?"))} Sessions: ${c2.bold(String(state.session_count ?? 0))}`);
42180
+ if (state.narrative_summary) {
42181
+ lines.push(` Narrative: ${c2.dim(state.narrative_summary.slice(0, 60))}${state.narrative_summary.length > 60 ? "..." : ""}`);
42182
+ }
42183
+ if (state.personality_traits) {
42184
+ const traits = typeof state.personality_traits === "object" ? Object.entries(state.personality_traits).map(([k, v]) => `${k}:${v}`).join(", ") : String(state.personality_traits);
42185
+ lines.push(` Traits: ${c2.dim(traits.slice(0, 60))}`);
42186
+ }
42187
+ const cidFile = join51(idDir, "cids.json");
42188
+ if (existsSync36(cidFile)) {
42189
+ const cids = JSON.parse(readFileSync25(cidFile, "utf8"));
42190
+ const lastCid = Array.isArray(cids) ? cids[cids.length - 1] : cids.latest;
42191
+ if (lastCid)
42192
+ lines.push(` Last CID: ${c2.dim(String(lastCid).slice(0, 50))}`);
42193
+ }
42194
+ } else {
42195
+ lines.push(` ${c2.dim("Not initialized (run 5+ tasks to generate)")}`);
42196
+ }
42197
+ } catch {
42198
+ }
42199
+ lines.push(`
42200
+ ${c2.bold("Memory Sentiment")}`);
42201
+ try {
42202
+ const metaFile = join51(ctx.repoRoot, ".oa", "memory", "metabolism", "store.json");
42203
+ if (existsSync36(metaFile)) {
42204
+ const store = JSON.parse(readFileSync25(metaFile, "utf8"));
42205
+ const active = store.filter((m) => m.type !== "quarantine");
42206
+ const recoveries = active.filter((m) => m.content?.startsWith("[recovery]")).length;
42207
+ const strategies = active.filter((m) => m.content?.startsWith("[strategy]")).length;
42208
+ const optimizations = active.filter((m) => m.content?.startsWith("[optimization]")).length;
42209
+ const avgUtil = active.length > 0 ? active.reduce((s, m) => s + (m.scores?.utility ?? 0), 0) / active.length : 0;
42210
+ const avgConf = active.length > 0 ? active.reduce((s, m) => s + (m.scores?.confidence ?? 0), 0) / active.length : 0;
42211
+ lines.push(` Memories: ${c2.bold(String(active.length))} (${recoveries} recovery, ${strategies} strategy, ${optimizations} optimization)`);
42212
+ lines.push(` Avg utility: ${c2.bold(avgUtil.toFixed(2))} Avg confidence: ${c2.bold(avgConf.toFixed(2))}`);
42213
+ const sentiment = strategies + optimizations > recoveries ? "proactive" : recoveries > 0 ? "defensive" : "neutral";
42214
+ const sentimentColor = sentiment === "proactive" ? c2.green : sentiment === "defensive" ? c2.yellow : c2.dim;
42215
+ lines.push(` Overall: ${sentimentColor(sentiment)} (${strategies + optimizations} proactive / ${recoveries} defensive)`);
42216
+ } else {
42217
+ lines.push(` ${c2.dim("No memories yet (complete tasks to learn)")}`);
42218
+ }
42219
+ } catch {
42220
+ }
42221
+ try {
42222
+ const dbPath = join51(ctx.repoRoot, ".oa", "memory", "structured.db");
42223
+ if (existsSync36(dbPath)) {
42224
+ const { initDb: initDb2, closeDb: cDb, ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
42225
+ const db = initDb2(dbPath);
42226
+ const memStore = new ProceduralMemoryStore2(db);
42227
+ const count = memStore.count();
42228
+ lines.push(`
42229
+ ${c2.bold("Structured Memory (SQLite)")}`);
42230
+ lines.push(` Memories: ${c2.bold(String(count))} DB: ${c2.dim(formatFileSize(statSync13(dbPath).size))}`);
42231
+ cDb(db);
42232
+ }
42233
+ } catch {
42234
+ }
42235
+ lines.push("");
42236
+ safeLog(lines.join("\n"));
42237
+ return "handled";
42238
+ }
42239
+ case "storage": {
42240
+ const lines = [];
42241
+ lines.push(`
42242
+ ${c2.bold("Storage Overview")}
42243
+ `);
42244
+ const oaDir = join51(ctx.repoRoot, ".oa");
42245
+ if (!existsSync36(oaDir)) {
42246
+ lines.push(` ${c2.dim("No .oa/ directory found.")}`);
42247
+ safeLog(lines.join("\n") + "\n");
42248
+ return "handled";
42249
+ }
42250
+ let totalBytes = 0;
42251
+ const categories = {};
42252
+ const walkStorage = (dir, category) => {
42253
+ try {
42254
+ for (const entry of readdirSync10(dir, { withFileTypes: true })) {
42255
+ const full = join51(dir, entry.name);
42256
+ if (entry.isDirectory()) {
42257
+ const subCat = category || entry.name;
42258
+ walkStorage(full, subCat);
42259
+ } else {
42260
+ try {
42261
+ const sz = statSync13(full).size;
42262
+ totalBytes += sz;
42263
+ if (!categories[category])
42264
+ categories[category] = { files: 0, bytes: 0 };
42265
+ categories[category].files++;
42266
+ categories[category].bytes += sz;
42267
+ } catch {
42268
+ }
42269
+ }
42270
+ }
42271
+ } catch {
42272
+ }
42273
+ };
42274
+ walkStorage(oaDir, "");
42275
+ const sorted = Object.entries(categories).sort((a, b) => b[1].bytes - a[1].bytes);
42276
+ for (const [cat, info] of sorted) {
42277
+ const name = cat || "root";
42278
+ const pct = totalBytes > 0 ? Math.round(info.bytes / totalBytes * 100) : 0;
42279
+ const bar = "\u2588".repeat(Math.max(1, Math.round(pct / 5))) + "\u2591".repeat(Math.max(0, 20 - Math.round(pct / 5)));
42280
+ lines.push(` ${c2.bold(name.padEnd(20))} ${bar} ${formatFileSize(info.bytes).padStart(8)} ${String(info.files).padStart(4)} files ${String(pct).padStart(2)}%`);
42281
+ }
42282
+ lines.push(`
42283
+ ${c2.bold("Total:")} ${c2.bold(formatFileSize(totalBytes))} across ${sorted.reduce((s, [, v]) => s + v.files, 0)} files`);
42284
+ const sensitivePatterns = [".env", "credentials", "secret", "private_key", "token.json"];
42285
+ const sensitiveFound = [];
42286
+ const checkSensitive = (dir) => {
42287
+ try {
42288
+ for (const entry of readdirSync10(dir, { withFileTypes: true })) {
42289
+ const name = entry.name.toLowerCase();
42290
+ if (sensitivePatterns.some((p) => name.includes(p))) {
42291
+ sensitiveFound.push(join51(dir, entry.name).replace(oaDir + "/", ""));
42292
+ }
42293
+ if (entry.isDirectory())
42294
+ checkSensitive(join51(dir, entry.name));
42295
+ }
42296
+ } catch {
42297
+ }
42298
+ };
42299
+ checkSensitive(oaDir);
42300
+ if (sensitiveFound.length > 0) {
42301
+ lines.push(`
42302
+ ${c2.yellow("\u26A0")} ${c2.bold("Sensitive files detected (excluded from IPFS/COHERE):")}`);
42303
+ for (const f of sensitiveFound.slice(0, 5)) {
42304
+ lines.push(` ${c2.yellow(f)}`);
42305
+ }
42306
+ } else {
42307
+ lines.push(`
42308
+ ${c2.green("\u2713")} No sensitive files detected in .oa/ storage`);
42309
+ }
42310
+ lines.push("");
42311
+ safeLog(lines.join("\n"));
42312
+ return "handled";
42313
+ }
42124
42314
  case "model":
42125
42315
  if (arg) {
42126
42316
  await switchModel(arg, ctx, hasLocal);
@@ -43574,12 +43764,12 @@ async function handleVoiceMenu(ctx, save, hasLocal) {
43574
43764
  continue;
43575
43765
  }
43576
43766
  const { basename: basename16, join: pathJoin } = await import("node:path");
43577
- const { copyFileSync: copyFileSync2, mkdirSync: mkdirSync21, existsSync: exists } = await import("node:fs");
43767
+ const { copyFileSync: copyFileSync2, mkdirSync: mkdirSync22, existsSync: exists } = await import("node:fs");
43578
43768
  const { homedir: homedir15 } = await import("node:os");
43579
43769
  const modelName = basename16(onnxDrop.path, ".onnx").replace(/[^a-zA-Z0-9_-]/g, "-");
43580
43770
  const destDir = pathJoin(homedir15(), ".open-agents", "voice", "models", modelName);
43581
43771
  if (!exists(destDir))
43582
- mkdirSync21(destDir, { recursive: true });
43772
+ mkdirSync22(destDir, { recursive: true });
43583
43773
  copyFileSync2(onnxDrop.path, pathJoin(destDir, "model.onnx"));
43584
43774
  copyFileSync2(jsonDrop.path, pathJoin(destDir, "config.json"));
43585
43775
  const { registerCustomOnnxModel: registerCustomOnnxModel2 } = await Promise.resolve().then(() => (init_voice(), voice_exports));
@@ -44071,11 +44261,11 @@ async function handlePeerEndpoint(peerId, authKey, ctx, local) {
44071
44261
  const models = await fetchModels(peerUrl, authKey);
44072
44262
  if (models.length > 0) {
44073
44263
  try {
44074
- const { writeFileSync: writeFileSync20, mkdirSync: mkdirSync21 } = await import("node:fs");
44075
- const { join: join64, dirname: dirname21 } = await import("node:path");
44076
- const cachePath = join64(ctx.repoRoot || process.cwd(), ".oa", "nexus", "peer-models-cache.json");
44077
- mkdirSync21(dirname21(cachePath), { recursive: true });
44078
- writeFileSync20(cachePath, JSON.stringify({
44264
+ const { writeFileSync: writeFileSync21, mkdirSync: mkdirSync22 } = await import("node:fs");
44265
+ const { join: join65, dirname: dirname21 } = await import("node:path");
44266
+ const cachePath = join65(ctx.repoRoot || process.cwd(), ".oa", "nexus", "peer-models-cache.json");
44267
+ mkdirSync22(dirname21(cachePath), { recursive: true });
44268
+ writeFileSync21(cachePath, JSON.stringify({
44079
44269
  peerId,
44080
44270
  cachedAt: (/* @__PURE__ */ new Date()).toISOString(),
44081
44271
  models: models.map((m) => ({ name: m.name, size: m.size, parameterSize: m.parameterSize }))
@@ -44274,17 +44464,17 @@ async function handleUpdate(subcommand, ctx) {
44274
44464
  try {
44275
44465
  const { createRequire: createRequire4 } = await import("node:module");
44276
44466
  const { fileURLToPath: fileURLToPath14 } = await import("node:url");
44277
- const { dirname: dirname21, join: join64 } = await import("node:path");
44278
- const { existsSync: existsSync45 } = await import("node:fs");
44467
+ const { dirname: dirname21, join: join65 } = await import("node:path");
44468
+ const { existsSync: existsSync46 } = await import("node:fs");
44279
44469
  const req = createRequire4(import.meta.url);
44280
44470
  const thisDir = dirname21(fileURLToPath14(import.meta.url));
44281
44471
  const candidates = [
44282
- join64(thisDir, "..", "package.json"),
44283
- join64(thisDir, "..", "..", "package.json"),
44284
- join64(thisDir, "..", "..", "..", "package.json")
44472
+ join65(thisDir, "..", "package.json"),
44473
+ join65(thisDir, "..", "..", "package.json"),
44474
+ join65(thisDir, "..", "..", "..", "package.json")
44285
44475
  ];
44286
44476
  for (const pkgPath of candidates) {
44287
- if (existsSync45(pkgPath)) {
44477
+ if (existsSync46(pkgPath)) {
44288
44478
  const pkg = req(pkgPath);
44289
44479
  if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli") {
44290
44480
  currentVersion = pkg.version ?? "0.0.0";
@@ -45121,8 +45311,8 @@ var init_commands = __esm({
45121
45311
  });
45122
45312
 
45123
45313
  // packages/cli/dist/tui/project-context.js
45124
- import { existsSync as existsSync36, readFileSync as readFileSync25, readdirSync as readdirSync10 } from "node:fs";
45125
- import { join as join51, basename as basename10 } from "node:path";
45314
+ import { existsSync as existsSync37, readFileSync as readFileSync26, readdirSync as readdirSync11 } from "node:fs";
45315
+ import { join as join52, basename as basename10 } from "node:path";
45126
45316
  import { execSync as execSync27 } from "node:child_process";
45127
45317
  import { homedir as homedir12, platform as platform3, release } from "node:os";
45128
45318
  function getModelTier(modelName) {
@@ -45157,10 +45347,10 @@ function loadProjectMap(repoRoot) {
45157
45347
  if (!hasOaDirectory(repoRoot)) {
45158
45348
  initOaDirectory(repoRoot);
45159
45349
  }
45160
- const mapPath = join51(repoRoot, OA_DIR, "context", "project-map.md");
45161
- if (existsSync36(mapPath)) {
45350
+ const mapPath = join52(repoRoot, OA_DIR, "context", "project-map.md");
45351
+ if (existsSync37(mapPath)) {
45162
45352
  try {
45163
- const content = readFileSync25(mapPath, "utf-8");
45353
+ const content = readFileSync26(mapPath, "utf-8");
45164
45354
  return content;
45165
45355
  } catch {
45166
45356
  }
@@ -45201,31 +45391,31 @@ ${log}`);
45201
45391
  }
45202
45392
  function loadMemoryContext(repoRoot) {
45203
45393
  const sections = [];
45204
- const oaMemDir = join51(repoRoot, OA_DIR, "memory");
45394
+ const oaMemDir = join52(repoRoot, OA_DIR, "memory");
45205
45395
  const oaEntries = loadMemoryDir(oaMemDir, "project");
45206
45396
  if (oaEntries)
45207
45397
  sections.push(oaEntries);
45208
- const legacyMemDir = join51(repoRoot, ".open-agents", "memory");
45209
- if (legacyMemDir !== oaMemDir && existsSync36(legacyMemDir)) {
45398
+ const legacyMemDir = join52(repoRoot, ".open-agents", "memory");
45399
+ if (legacyMemDir !== oaMemDir && existsSync37(legacyMemDir)) {
45210
45400
  const legacyEntries = loadMemoryDir(legacyMemDir, "project/legacy");
45211
45401
  if (legacyEntries)
45212
45402
  sections.push(legacyEntries);
45213
45403
  }
45214
- const globalMemDir = join51(homedir12(), ".open-agents", "memory");
45404
+ const globalMemDir = join52(homedir12(), ".open-agents", "memory");
45215
45405
  const globalEntries = loadMemoryDir(globalMemDir, "global");
45216
45406
  if (globalEntries)
45217
45407
  sections.push(globalEntries);
45218
45408
  return sections.join("\n\n");
45219
45409
  }
45220
45410
  function loadMemoryDir(memDir, scope) {
45221
- if (!existsSync36(memDir))
45411
+ if (!existsSync37(memDir))
45222
45412
  return "";
45223
45413
  const lines = [];
45224
45414
  try {
45225
- const files = readdirSync10(memDir).filter((f) => f.endsWith(".json"));
45415
+ const files = readdirSync11(memDir).filter((f) => f.endsWith(".json"));
45226
45416
  for (const file of files.slice(0, 10)) {
45227
45417
  try {
45228
- const raw = readFileSync25(join51(memDir, file), "utf-8");
45418
+ const raw = readFileSync26(join52(memDir, file), "utf-8");
45229
45419
  const entries = JSON.parse(raw);
45230
45420
  const topic = basename10(file, ".json");
45231
45421
  const keys = Object.keys(entries);
@@ -46744,22 +46934,22 @@ var init_banner = __esm({
46744
46934
  });
46745
46935
 
46746
46936
  // packages/cli/dist/tui/carousel-descriptors.js
46747
- import { existsSync as existsSync37, readFileSync as readFileSync26, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, readdirSync as readdirSync11 } from "node:fs";
46748
- import { join as join52, basename as basename11 } from "node:path";
46937
+ import { existsSync as existsSync38, readFileSync as readFileSync27, writeFileSync as writeFileSync16, mkdirSync as mkdirSync15, readdirSync as readdirSync12 } from "node:fs";
46938
+ import { join as join53, basename as basename11 } from "node:path";
46749
46939
  function loadToolProfile(repoRoot) {
46750
- const filePath = join52(repoRoot, OA_DIR, "context", TOOL_PROFILE_FILE);
46940
+ const filePath = join53(repoRoot, OA_DIR, "context", TOOL_PROFILE_FILE);
46751
46941
  try {
46752
- if (!existsSync37(filePath))
46942
+ if (!existsSync38(filePath))
46753
46943
  return null;
46754
- return JSON.parse(readFileSync26(filePath, "utf-8"));
46944
+ return JSON.parse(readFileSync27(filePath, "utf-8"));
46755
46945
  } catch {
46756
46946
  return null;
46757
46947
  }
46758
46948
  }
46759
46949
  function saveToolProfile(repoRoot, profile) {
46760
- const contextDir = join52(repoRoot, OA_DIR, "context");
46761
- mkdirSync14(contextDir, { recursive: true });
46762
- writeFileSync15(join52(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
46950
+ const contextDir = join53(repoRoot, OA_DIR, "context");
46951
+ mkdirSync15(contextDir, { recursive: true });
46952
+ writeFileSync16(join53(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
46763
46953
  }
46764
46954
  function categorizeToolCall(toolName) {
46765
46955
  for (const cat of TOOL_CATEGORIES) {
@@ -46817,25 +47007,25 @@ function weightedColor(profile) {
46817
47007
  return selectedCat.colors[Math.floor(Math.random() * selectedCat.colors.length)];
46818
47008
  }
46819
47009
  function loadCachedDescriptors(repoRoot) {
46820
- const filePath = join52(repoRoot, OA_DIR, "context", DESCRIPTOR_FILE);
47010
+ const filePath = join53(repoRoot, OA_DIR, "context", DESCRIPTOR_FILE);
46821
47011
  try {
46822
- if (!existsSync37(filePath))
47012
+ if (!existsSync38(filePath))
46823
47013
  return null;
46824
- const cached = JSON.parse(readFileSync26(filePath, "utf-8"));
47014
+ const cached = JSON.parse(readFileSync27(filePath, "utf-8"));
46825
47015
  return cached.phrases.length > 0 ? cached.phrases : null;
46826
47016
  } catch {
46827
47017
  return null;
46828
47018
  }
46829
47019
  }
46830
47020
  function saveCachedDescriptors(repoRoot, phrases, sourceHash) {
46831
- const contextDir = join52(repoRoot, OA_DIR, "context");
46832
- mkdirSync14(contextDir, { recursive: true });
47021
+ const contextDir = join53(repoRoot, OA_DIR, "context");
47022
+ mkdirSync15(contextDir, { recursive: true });
46833
47023
  const cached = {
46834
47024
  phrases,
46835
47025
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
46836
47026
  sourceHash
46837
47027
  };
46838
- writeFileSync15(join52(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
47028
+ writeFileSync16(join53(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
46839
47029
  }
46840
47030
  function generateDescriptors(repoRoot) {
46841
47031
  const profile = loadToolProfile(repoRoot);
@@ -46883,11 +47073,11 @@ function generateDescriptors(repoRoot) {
46883
47073
  return phrases;
46884
47074
  }
46885
47075
  function extractFromPackageJson(repoRoot, tags) {
46886
- const pkgPath = join52(repoRoot, "package.json");
47076
+ const pkgPath = join53(repoRoot, "package.json");
46887
47077
  try {
46888
- if (!existsSync37(pkgPath))
47078
+ if (!existsSync38(pkgPath))
46889
47079
  return;
46890
- const pkg = JSON.parse(readFileSync26(pkgPath, "utf-8"));
47080
+ const pkg = JSON.parse(readFileSync27(pkgPath, "utf-8"));
46891
47081
  if (pkg.name && typeof pkg.name === "string") {
46892
47082
  const parts = pkg.name.replace(/^@/, "").split("/");
46893
47083
  for (const p of parts)
@@ -46931,7 +47121,7 @@ function extractFromManifests(repoRoot, tags) {
46931
47121
  { file: ".github/workflows", tag: "ci/cd" }
46932
47122
  ];
46933
47123
  for (const check of manifestChecks) {
46934
- if (existsSync37(join52(repoRoot, check.file))) {
47124
+ if (existsSync38(join53(repoRoot, check.file))) {
46935
47125
  tags.push(check.tag);
46936
47126
  }
46937
47127
  }
@@ -46953,16 +47143,16 @@ function extractFromSessions(repoRoot, tags) {
46953
47143
  }
46954
47144
  }
46955
47145
  function extractFromMemory(repoRoot, tags) {
46956
- const memoryDir = join52(repoRoot, OA_DIR, "memory");
47146
+ const memoryDir = join53(repoRoot, OA_DIR, "memory");
46957
47147
  try {
46958
- if (!existsSync37(memoryDir))
47148
+ if (!existsSync38(memoryDir))
46959
47149
  return;
46960
- const files = readdirSync11(memoryDir).filter((f) => f.endsWith(".json"));
47150
+ const files = readdirSync12(memoryDir).filter((f) => f.endsWith(".json"));
46961
47151
  for (const file of files) {
46962
47152
  const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
46963
47153
  tags.push(topic);
46964
47154
  try {
46965
- const data = JSON.parse(readFileSync26(join52(memoryDir, file), "utf-8"));
47155
+ const data = JSON.parse(readFileSync27(join53(memoryDir, file), "utf-8"));
46966
47156
  if (data && typeof data === "object") {
46967
47157
  const keys = Object.keys(data).slice(0, 3);
46968
47158
  for (const key of keys) {
@@ -47595,13 +47785,13 @@ var init_stream_renderer = __esm({
47595
47785
  });
47596
47786
 
47597
47787
  // packages/cli/dist/tui/edit-history.js
47598
- import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync15 } from "node:fs";
47599
- import { join as join53 } from "node:path";
47788
+ import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync16 } from "node:fs";
47789
+ import { join as join54 } from "node:path";
47600
47790
  function createEditHistoryLogger(repoRoot, sessionId) {
47601
- const historyDir = join53(repoRoot, ".oa", "history");
47602
- const logPath = join53(historyDir, "edits.jsonl");
47791
+ const historyDir = join54(repoRoot, ".oa", "history");
47792
+ const logPath = join54(historyDir, "edits.jsonl");
47603
47793
  try {
47604
- mkdirSync15(historyDir, { recursive: true });
47794
+ mkdirSync16(historyDir, { recursive: true });
47605
47795
  } catch {
47606
47796
  }
47607
47797
  function logToolCall(toolName, toolArgs, success) {
@@ -47710,17 +47900,17 @@ var init_edit_history = __esm({
47710
47900
  });
47711
47901
 
47712
47902
  // packages/cli/dist/tui/promptLoader.js
47713
- import { readFileSync as readFileSync27, existsSync as existsSync38 } from "node:fs";
47714
- import { join as join54, dirname as dirname18 } from "node:path";
47903
+ import { readFileSync as readFileSync28, existsSync as existsSync39 } from "node:fs";
47904
+ import { join as join55, dirname as dirname18 } from "node:path";
47715
47905
  import { fileURLToPath as fileURLToPath11 } from "node:url";
47716
47906
  function loadPrompt3(promptPath, vars) {
47717
47907
  let content = cache3.get(promptPath);
47718
47908
  if (content === void 0) {
47719
- const fullPath = join54(PROMPTS_DIR3, promptPath);
47720
- if (!existsSync38(fullPath)) {
47909
+ const fullPath = join55(PROMPTS_DIR3, promptPath);
47910
+ if (!existsSync39(fullPath)) {
47721
47911
  throw new Error(`Prompt file not found: ${fullPath}`);
47722
47912
  }
47723
- content = readFileSync27(fullPath, "utf-8");
47913
+ content = readFileSync28(fullPath, "utf-8");
47724
47914
  cache3.set(promptPath, content);
47725
47915
  }
47726
47916
  if (!vars)
@@ -47733,23 +47923,23 @@ var init_promptLoader3 = __esm({
47733
47923
  "use strict";
47734
47924
  __filename3 = fileURLToPath11(import.meta.url);
47735
47925
  __dirname6 = dirname18(__filename3);
47736
- devPath2 = join54(__dirname6, "..", "..", "prompts");
47737
- publishedPath2 = join54(__dirname6, "..", "prompts");
47738
- PROMPTS_DIR3 = existsSync38(devPath2) ? devPath2 : publishedPath2;
47926
+ devPath2 = join55(__dirname6, "..", "..", "prompts");
47927
+ publishedPath2 = join55(__dirname6, "..", "prompts");
47928
+ PROMPTS_DIR3 = existsSync39(devPath2) ? devPath2 : publishedPath2;
47739
47929
  cache3 = /* @__PURE__ */ new Map();
47740
47930
  }
47741
47931
  });
47742
47932
 
47743
47933
  // packages/cli/dist/tui/dream-engine.js
47744
- import { mkdirSync as mkdirSync16, writeFileSync as writeFileSync16, readFileSync as readFileSync28, existsSync as existsSync39, cpSync, rmSync, readdirSync as readdirSync12 } from "node:fs";
47745
- import { join as join55, basename as basename12 } from "node:path";
47934
+ import { mkdirSync as mkdirSync17, writeFileSync as writeFileSync17, readFileSync as readFileSync29, existsSync as existsSync40, cpSync, rmSync as rmSync2, readdirSync as readdirSync13 } from "node:fs";
47935
+ import { join as join56, basename as basename12 } from "node:path";
47746
47936
  import { execSync as execSync28 } from "node:child_process";
47747
47937
  function loadAutoresearchMemory(repoRoot) {
47748
- const memoryPath = join55(repoRoot, ".oa", "memory", "autoresearch.json");
47749
- if (!existsSync39(memoryPath))
47938
+ const memoryPath = join56(repoRoot, ".oa", "memory", "autoresearch.json");
47939
+ if (!existsSync40(memoryPath))
47750
47940
  return "";
47751
47941
  try {
47752
- const raw = readFileSync28(memoryPath, "utf-8");
47942
+ const raw = readFileSync29(memoryPath, "utf-8");
47753
47943
  const data = JSON.parse(raw);
47754
47944
  const sections = [];
47755
47945
  for (const key of AUTORESEARCH_MEMORY_KEYS) {
@@ -47939,14 +48129,14 @@ var init_dream_engine = __esm({
47939
48129
  const content = String(args["content"] ?? "");
47940
48130
  if (!rawPath)
47941
48131
  return { success: false, output: "", error: "path is required", durationMs: Date.now() - start };
47942
- const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join55(this.autoresearchDir, basename12(rawPath)) : join55(this.autoresearchDir, rawPath);
48132
+ const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join56(this.autoresearchDir, basename12(rawPath)) : join56(this.autoresearchDir, rawPath);
47943
48133
  if (!targetPath.startsWith(this.autoresearchDir)) {
47944
48134
  return { success: false, output: "", error: "Autoresearch mode: writes are confined to .oa/autoresearch/", durationMs: Date.now() - start };
47945
48135
  }
47946
48136
  try {
47947
- const dir = join55(targetPath, "..");
47948
- mkdirSync16(dir, { recursive: true });
47949
- writeFileSync16(targetPath, content, "utf-8");
48137
+ const dir = join56(targetPath, "..");
48138
+ mkdirSync17(dir, { recursive: true });
48139
+ writeFileSync17(targetPath, content, "utf-8");
47950
48140
  return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start };
47951
48141
  } catch (err) {
47952
48142
  return { success: false, output: "", error: String(err), durationMs: Date.now() - start };
@@ -47974,20 +48164,20 @@ var init_dream_engine = __esm({
47974
48164
  const rawPath = String(args["path"] ?? "");
47975
48165
  const oldStr = String(args["old_string"] ?? "");
47976
48166
  const newStr = String(args["new_string"] ?? "");
47977
- const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join55(this.autoresearchDir, basename12(rawPath)) : join55(this.autoresearchDir, rawPath);
48167
+ const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join56(this.autoresearchDir, basename12(rawPath)) : join56(this.autoresearchDir, rawPath);
47978
48168
  if (!targetPath.startsWith(this.autoresearchDir)) {
47979
48169
  return { success: false, output: "", error: "Autoresearch mode: edits are confined to .oa/autoresearch/", durationMs: Date.now() - start };
47980
48170
  }
47981
48171
  try {
47982
- if (!existsSync39(targetPath)) {
48172
+ if (!existsSync40(targetPath)) {
47983
48173
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start };
47984
48174
  }
47985
- let content = readFileSync28(targetPath, "utf-8");
48175
+ let content = readFileSync29(targetPath, "utf-8");
47986
48176
  if (!content.includes(oldStr)) {
47987
48177
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start };
47988
48178
  }
47989
48179
  content = content.replace(oldStr, newStr);
47990
- writeFileSync16(targetPath, content, "utf-8");
48180
+ writeFileSync17(targetPath, content, "utf-8");
47991
48181
  return { success: true, output: `Edited ${rawPath}`, durationMs: Date.now() - start };
47992
48182
  } catch (err) {
47993
48183
  return { success: false, output: "", error: String(err), durationMs: Date.now() - start };
@@ -48028,14 +48218,14 @@ var init_dream_engine = __esm({
48028
48218
  const content = String(args["content"] ?? "");
48029
48219
  if (!rawPath)
48030
48220
  return { success: false, output: "", error: "path is required", durationMs: Date.now() - start };
48031
- const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join55(this.dreamsDir, basename12(rawPath)) : join55(this.dreamsDir, rawPath);
48221
+ const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join56(this.dreamsDir, basename12(rawPath)) : join56(this.dreamsDir, rawPath);
48032
48222
  if (!targetPath.startsWith(this.dreamsDir)) {
48033
48223
  return { success: false, output: "", error: "Dream mode: writes are confined to .oa/dreams/", durationMs: Date.now() - start };
48034
48224
  }
48035
48225
  try {
48036
- const dir = join55(targetPath, "..");
48037
- mkdirSync16(dir, { recursive: true });
48038
- writeFileSync16(targetPath, content, "utf-8");
48226
+ const dir = join56(targetPath, "..");
48227
+ mkdirSync17(dir, { recursive: true });
48228
+ writeFileSync17(targetPath, content, "utf-8");
48039
48229
  return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start };
48040
48230
  } catch (err) {
48041
48231
  return { success: false, output: "", error: String(err), durationMs: Date.now() - start };
@@ -48063,20 +48253,20 @@ var init_dream_engine = __esm({
48063
48253
  const rawPath = String(args["path"] ?? "");
48064
48254
  const oldStr = String(args["old_string"] ?? "");
48065
48255
  const newStr = String(args["new_string"] ?? "");
48066
- const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join55(this.dreamsDir, basename12(rawPath)) : join55(this.dreamsDir, rawPath);
48256
+ const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join56(this.dreamsDir, basename12(rawPath)) : join56(this.dreamsDir, rawPath);
48067
48257
  if (!targetPath.startsWith(this.dreamsDir)) {
48068
48258
  return { success: false, output: "", error: "Dream mode: edits are confined to .oa/dreams/", durationMs: Date.now() - start };
48069
48259
  }
48070
48260
  try {
48071
- if (!existsSync39(targetPath)) {
48261
+ if (!existsSync40(targetPath)) {
48072
48262
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start };
48073
48263
  }
48074
- let content = readFileSync28(targetPath, "utf-8");
48264
+ let content = readFileSync29(targetPath, "utf-8");
48075
48265
  if (!content.includes(oldStr)) {
48076
48266
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start };
48077
48267
  }
48078
48268
  content = content.replace(oldStr, newStr);
48079
- writeFileSync16(targetPath, content, "utf-8");
48269
+ writeFileSync17(targetPath, content, "utf-8");
48080
48270
  return { success: true, output: `Edited ${rawPath}`, durationMs: Date.now() - start };
48081
48271
  } catch (err) {
48082
48272
  return { success: false, output: "", error: String(err), durationMs: Date.now() - start };
@@ -48130,7 +48320,7 @@ var init_dream_engine = __esm({
48130
48320
  constructor(config, repoRoot) {
48131
48321
  this.config = config;
48132
48322
  this.repoRoot = repoRoot;
48133
- this.dreamsDir = join55(repoRoot, ".oa", "dreams");
48323
+ this.dreamsDir = join56(repoRoot, ".oa", "dreams");
48134
48324
  this.state = {
48135
48325
  mode: "default",
48136
48326
  active: false,
@@ -48161,7 +48351,7 @@ var init_dream_engine = __esm({
48161
48351
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
48162
48352
  results: []
48163
48353
  };
48164
- mkdirSync16(this.dreamsDir, { recursive: true });
48354
+ mkdirSync17(this.dreamsDir, { recursive: true });
48165
48355
  this.saveDreamState();
48166
48356
  try {
48167
48357
  for (let cycle = 1; cycle <= totalCycles; cycle++) {
@@ -48214,8 +48404,8 @@ ${result.summary}`;
48214
48404
  if (mode !== "default" || cycle === totalCycles) {
48215
48405
  renderDreamContraction(cycle);
48216
48406
  const cycleSummary = this.buildCycleSummary(cycle, previousFindings);
48217
- const summaryPath = join55(this.dreamsDir, `cycle-${cycle}-summary.md`);
48218
- writeFileSync16(summaryPath, cycleSummary, "utf-8");
48407
+ const summaryPath = join56(this.dreamsDir, `cycle-${cycle}-summary.md`);
48408
+ writeFileSync17(summaryPath, cycleSummary, "utf-8");
48219
48409
  }
48220
48410
  if (mode === "lucid" && !this.abortController.signal.aborted) {
48221
48411
  this.saveVersionCheckpoint(cycle);
@@ -48427,7 +48617,7 @@ After synthesis, call task_complete with the final prioritized summary.`, toolMo
48427
48617
  }
48428
48618
  /** Build role-specific tool sets for swarm agents */
48429
48619
  buildSwarmTools(role, _workspace) {
48430
- const autoresearchDir = join55(this.repoRoot, ".oa", "autoresearch");
48620
+ const autoresearchDir = join56(this.repoRoot, ".oa", "autoresearch");
48431
48621
  const taskComplete = this.createSwarmTaskCompleteTool(role);
48432
48622
  switch (role) {
48433
48623
  case "researcher": {
@@ -48791,7 +48981,7 @@ INSTRUCTIONS:
48791
48981
  2. Summarize the key learnings and next steps
48792
48982
 
48793
48983
  Call task_complete with a human-readable summary of the autoresearch session.`, workspace, onEvent);
48794
- const reportPath = join55(this.dreamsDir, `cycle-${cycleNum}-autoresearch-report.md`);
48984
+ const reportPath = join56(this.dreamsDir, `cycle-${cycleNum}-autoresearch-report.md`);
48795
48985
  const report = `# Autoresearch Swarm Report \u2014 Cycle ${cycleNum}
48796
48986
 
48797
48987
  **Date**: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}
@@ -48813,8 +49003,8 @@ ${summaryResult}
48813
49003
  *Generated by open-agents autoresearch swarm*
48814
49004
  `;
48815
49005
  try {
48816
- mkdirSync16(this.dreamsDir, { recursive: true });
48817
- writeFileSync16(reportPath, report, "utf-8");
49006
+ mkdirSync17(this.dreamsDir, { recursive: true });
49007
+ writeFileSync17(reportPath, report, "utf-8");
48818
49008
  } catch {
48819
49009
  }
48820
49010
  renderSwarmComplete(workspace);
@@ -48880,9 +49070,9 @@ ${summaryResult}
48880
49070
  }
48881
49071
  /** Save workspace backup for lucid mode */
48882
49072
  saveVersionCheckpoint(cycle) {
48883
- const checkpointDir = join55(this.dreamsDir, "checkpoints", `cycle-${cycle}`);
49073
+ const checkpointDir = join56(this.dreamsDir, "checkpoints", `cycle-${cycle}`);
48884
49074
  try {
48885
- mkdirSync16(checkpointDir, { recursive: true });
49075
+ mkdirSync17(checkpointDir, { recursive: true });
48886
49076
  try {
48887
49077
  const gitStatus = execSync28("git status --porcelain", {
48888
49078
  cwd: this.repoRoot,
@@ -48899,10 +49089,10 @@ ${summaryResult}
48899
49089
  encoding: "utf-8",
48900
49090
  timeout: 5e3
48901
49091
  }).trim();
48902
- writeFileSync16(join55(checkpointDir, "git-status.txt"), gitStatus, "utf-8");
48903
- writeFileSync16(join55(checkpointDir, "git-diff.patch"), gitDiff, "utf-8");
48904
- writeFileSync16(join55(checkpointDir, "git-hash.txt"), gitHash, "utf-8");
48905
- writeFileSync16(join55(checkpointDir, "checkpoint.json"), JSON.stringify({
49092
+ writeFileSync17(join56(checkpointDir, "git-status.txt"), gitStatus, "utf-8");
49093
+ writeFileSync17(join56(checkpointDir, "git-diff.patch"), gitDiff, "utf-8");
49094
+ writeFileSync17(join56(checkpointDir, "git-hash.txt"), gitHash, "utf-8");
49095
+ writeFileSync17(join56(checkpointDir, "checkpoint.json"), JSON.stringify({
48906
49096
  cycle,
48907
49097
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
48908
49098
  gitHash,
@@ -48910,7 +49100,7 @@ ${summaryResult}
48910
49100
  }, null, 2), "utf-8");
48911
49101
  renderInfo(`Checkpoint saved: cycle ${cycle} (${gitHash.slice(0, 8)})`);
48912
49102
  } catch {
48913
- writeFileSync16(join55(checkpointDir, "checkpoint.json"), JSON.stringify({ cycle, timestamp: (/* @__PURE__ */ new Date()).toISOString(), mode: this.state.mode }, null, 2), "utf-8");
49103
+ writeFileSync17(join56(checkpointDir, "checkpoint.json"), JSON.stringify({ cycle, timestamp: (/* @__PURE__ */ new Date()).toISOString(), mode: this.state.mode }, null, 2), "utf-8");
48914
49104
  renderInfo(`Checkpoint saved: cycle ${cycle} (no git)`);
48915
49105
  }
48916
49106
  } catch (err) {
@@ -48947,7 +49137,7 @@ Each proposal includes implementation entrypoints and estimated effort.
48947
49137
  /** Update the master proposal index */
48948
49138
  updateProposalIndex() {
48949
49139
  try {
48950
- const files = readdirSync12(this.dreamsDir).filter((f) => f.endsWith(".md") && f !== "PROPOSAL-INDEX.md" && f !== "dream-state.json").sort();
49140
+ const files = readdirSync13(this.dreamsDir).filter((f) => f.endsWith(".md") && f !== "PROPOSAL-INDEX.md" && f !== "dream-state.json").sort();
48951
49141
  const index = `# Dream Proposals Index
48952
49142
 
48953
49143
  **Last updated**: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}
@@ -48968,14 +49158,14 @@ ${files.map((f) => `- [\`${f}\`](./${f})`).join("\n")}
48968
49158
  ---
48969
49159
  *Auto-generated by open-agents dream engine*
48970
49160
  `;
48971
- writeFileSync16(join55(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
49161
+ writeFileSync17(join56(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
48972
49162
  } catch {
48973
49163
  }
48974
49164
  }
48975
49165
  /** Save dream state for resume/inspection */
48976
49166
  saveDreamState() {
48977
49167
  try {
48978
- writeFileSync16(join55(this.dreamsDir, "dream-state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
49168
+ writeFileSync17(join56(this.dreamsDir, "dream-state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
48979
49169
  } catch {
48980
49170
  }
48981
49171
  }
@@ -49349,8 +49539,8 @@ var init_bless_engine = __esm({
49349
49539
  });
49350
49540
 
49351
49541
  // packages/cli/dist/tui/dmn-engine.js
49352
- import { existsSync as existsSync40, readFileSync as readFileSync29, writeFileSync as writeFileSync17, mkdirSync as mkdirSync17, readdirSync as readdirSync13, unlinkSync as unlinkSync9 } from "node:fs";
49353
- import { join as join56, basename as basename13 } from "node:path";
49542
+ import { existsSync as existsSync41, readFileSync as readFileSync30, writeFileSync as writeFileSync18, mkdirSync as mkdirSync18, readdirSync as readdirSync14, unlinkSync as unlinkSync9 } from "node:fs";
49543
+ import { join as join57, basename as basename13 } from "node:path";
49354
49544
  function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities, competence, reflectionBuffer) {
49355
49545
  const competenceReport = competence.length > 0 ? competence.map((c3) => {
49356
49546
  const rate = c3.attempts > 0 ? Math.round(c3.successes / c3.attempts * 100) : 0;
@@ -49463,9 +49653,9 @@ var init_dmn_engine = __esm({
49463
49653
  constructor(config, repoRoot) {
49464
49654
  this.config = config;
49465
49655
  this.repoRoot = repoRoot;
49466
- this.stateDir = join56(repoRoot, ".oa", "dmn");
49467
- this.historyDir = join56(repoRoot, ".oa", "dmn", "cycles");
49468
- mkdirSync17(this.historyDir, { recursive: true });
49656
+ this.stateDir = join57(repoRoot, ".oa", "dmn");
49657
+ this.historyDir = join57(repoRoot, ".oa", "dmn", "cycles");
49658
+ mkdirSync18(this.historyDir, { recursive: true });
49469
49659
  this.loadState();
49470
49660
  }
49471
49661
  get stats() {
@@ -50054,14 +50244,14 @@ OUTPUT: Call task_complete with JSON:
50054
50244
  async gatherMemoryTopics() {
50055
50245
  const topics = [];
50056
50246
  const dirs = [
50057
- join56(this.repoRoot, ".oa", "memory"),
50058
- join56(this.repoRoot, ".open-agents", "memory")
50247
+ join57(this.repoRoot, ".oa", "memory"),
50248
+ join57(this.repoRoot, ".open-agents", "memory")
50059
50249
  ];
50060
50250
  for (const dir of dirs) {
50061
- if (!existsSync40(dir))
50251
+ if (!existsSync41(dir))
50062
50252
  continue;
50063
50253
  try {
50064
- const files = readdirSync13(dir).filter((f) => f.endsWith(".json"));
50254
+ const files = readdirSync14(dir).filter((f) => f.endsWith(".json"));
50065
50255
  for (const f of files) {
50066
50256
  const topic = basename13(f, ".json");
50067
50257
  if (!topics.includes(topic))
@@ -50074,29 +50264,29 @@ OUTPUT: Call task_complete with JSON:
50074
50264
  }
50075
50265
  // ── State persistence ─────────────────────────────────────────────────
50076
50266
  loadState() {
50077
- const path = join56(this.stateDir, "state.json");
50078
- if (existsSync40(path)) {
50267
+ const path = join57(this.stateDir, "state.json");
50268
+ if (existsSync41(path)) {
50079
50269
  try {
50080
- this.state = JSON.parse(readFileSync29(path, "utf-8"));
50270
+ this.state = JSON.parse(readFileSync30(path, "utf-8"));
50081
50271
  } catch {
50082
50272
  }
50083
50273
  }
50084
50274
  }
50085
50275
  saveState() {
50086
50276
  try {
50087
- writeFileSync17(join56(this.stateDir, "state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
50277
+ writeFileSync18(join57(this.stateDir, "state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
50088
50278
  } catch {
50089
50279
  }
50090
50280
  }
50091
50281
  saveCycleResult(result) {
50092
50282
  try {
50093
50283
  const filename = `cycle-${result.cycleNumber}-${Date.now()}.json`;
50094
- writeFileSync17(join56(this.historyDir, filename), JSON.stringify(result, null, 2) + "\n", "utf-8");
50095
- const files = readdirSync13(this.historyDir).filter((f) => f.startsWith("cycle-") && f.endsWith(".json")).sort();
50284
+ writeFileSync18(join57(this.historyDir, filename), JSON.stringify(result, null, 2) + "\n", "utf-8");
50285
+ const files = readdirSync14(this.historyDir).filter((f) => f.startsWith("cycle-") && f.endsWith(".json")).sort();
50096
50286
  if (files.length > 50) {
50097
50287
  for (const old of files.slice(0, files.length - 50)) {
50098
50288
  try {
50099
- unlinkSync9(join56(this.historyDir, old));
50289
+ unlinkSync9(join57(this.historyDir, old));
50100
50290
  } catch {
50101
50291
  }
50102
50292
  }
@@ -50109,8 +50299,8 @@ OUTPUT: Call task_complete with JSON:
50109
50299
  });
50110
50300
 
50111
50301
  // packages/cli/dist/tui/snr-engine.js
50112
- import { existsSync as existsSync41, readdirSync as readdirSync14, readFileSync as readFileSync30 } from "node:fs";
50113
- import { join as join57, basename as basename14 } from "node:path";
50302
+ import { existsSync as existsSync42, readdirSync as readdirSync15, readFileSync as readFileSync31 } from "node:fs";
50303
+ import { join as join58, basename as basename14 } from "node:path";
50114
50304
  function computeDPrime(signalScores, noiseScores) {
50115
50305
  if (signalScores.length === 0 || noiseScores.length === 0)
50116
50306
  return 0;
@@ -50350,20 +50540,20 @@ Call task_complete with the JSON array when done.`, onEvent)
50350
50540
  loadMemoryEntries(topics) {
50351
50541
  const entries = [];
50352
50542
  const dirs = [
50353
- join57(this.repoRoot, ".oa", "memory"),
50354
- join57(this.repoRoot, ".open-agents", "memory")
50543
+ join58(this.repoRoot, ".oa", "memory"),
50544
+ join58(this.repoRoot, ".open-agents", "memory")
50355
50545
  ];
50356
50546
  for (const dir of dirs) {
50357
- if (!existsSync41(dir))
50547
+ if (!existsSync42(dir))
50358
50548
  continue;
50359
50549
  try {
50360
- const files = readdirSync14(dir).filter((f) => f.endsWith(".json"));
50550
+ const files = readdirSync15(dir).filter((f) => f.endsWith(".json"));
50361
50551
  for (const f of files) {
50362
50552
  const topic = basename14(f, ".json");
50363
50553
  if (topics.length > 0 && !topics.includes(topic))
50364
50554
  continue;
50365
50555
  try {
50366
- const data = JSON.parse(readFileSync30(join57(dir, f), "utf-8"));
50556
+ const data = JSON.parse(readFileSync31(join58(dir, f), "utf-8"));
50367
50557
  for (const [key, val] of Object.entries(data)) {
50368
50558
  const value = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
50369
50559
  entries.push({ topic, key, value });
@@ -50930,8 +51120,8 @@ var init_tool_policy = __esm({
50930
51120
  });
50931
51121
 
50932
51122
  // packages/cli/dist/tui/telegram-bridge.js
50933
- import { mkdirSync as mkdirSync18, existsSync as existsSync42, unlinkSync as unlinkSync10, readdirSync as readdirSync15, statSync as statSync13 } from "node:fs";
50934
- import { join as join58, resolve as resolve28 } from "node:path";
51123
+ import { mkdirSync as mkdirSync19, existsSync as existsSync43, unlinkSync as unlinkSync10, readdirSync as readdirSync16, statSync as statSync14 } from "node:fs";
51124
+ import { join as join59, resolve as resolve28 } from "node:path";
50935
51125
  import { writeFile as writeFileAsync } from "node:fs/promises";
50936
51126
  function convertMarkdownToTelegramHTML(md) {
50937
51127
  let html = md;
@@ -51259,7 +51449,7 @@ with summary "no_reply" to silently skip without responding.
51259
51449
  this.polling = true;
51260
51450
  this.abortController = new AbortController();
51261
51451
  try {
51262
- mkdirSync18(this.mediaCacheDir, { recursive: true });
51452
+ mkdirSync19(this.mediaCacheDir, { recursive: true });
51263
51453
  } catch {
51264
51454
  }
51265
51455
  this.mediaCacheCleanupTimer = setInterval(() => this.cleanupMediaCache(), 5 * 60 * 1e3);
@@ -51696,7 +51886,7 @@ Telegram admin: @${msg.username}` : `Telegram ${isGroup ? "group" : "public"} ch
51696
51886
  return null;
51697
51887
  const buffer = Buffer.from(await res.arrayBuffer());
51698
51888
  const fileName = `${Date.now()}-${fileId.slice(0, 8)}${extension}`;
51699
- const localPath = join58(this.mediaCacheDir, fileName);
51889
+ const localPath = join59(this.mediaCacheDir, fileName);
51700
51890
  await writeFileAsync(localPath, buffer);
51701
51891
  return localPath;
51702
51892
  } catch {
@@ -53030,7 +53220,7 @@ var init_text_selection = __esm({
53030
53220
  });
53031
53221
 
53032
53222
  // packages/cli/dist/tui/status-bar.js
53033
- import { readFileSync as readFileSync31 } from "node:fs";
53223
+ import { readFileSync as readFileSync32 } from "node:fs";
53034
53224
  function setTerminalTitle(task, version) {
53035
53225
  if (!process.stdout.isTTY)
53036
53226
  return;
@@ -53705,7 +53895,7 @@ var init_status_bar = __esm({
53705
53895
  if (nexusDir) {
53706
53896
  try {
53707
53897
  const metricsPath = nexusDir + "/remote-metrics.json";
53708
- const raw = readFileSync31(metricsPath, "utf8");
53898
+ const raw = readFileSync32(metricsPath, "utf8");
53709
53899
  const cached = JSON.parse(raw);
53710
53900
  if (cached && cached.ts && Date.now() - cached.ts < 6e4) {
53711
53901
  const m = cached.data;
@@ -55136,11 +55326,11 @@ var init_mouse_filter = __esm({
55136
55326
  import * as readline2 from "node:readline";
55137
55327
  import { Writable } from "node:stream";
55138
55328
  import { cwd } from "node:process";
55139
- import { resolve as resolve29, join as join59, dirname as dirname19, extname as extname10 } from "node:path";
55329
+ import { resolve as resolve29, join as join60, dirname as dirname19, extname as extname10 } from "node:path";
55140
55330
  import { createRequire as createRequire2 } from "node:module";
55141
55331
  import { fileURLToPath as fileURLToPath12 } from "node:url";
55142
- import { readFileSync as readFileSync32, writeFileSync as writeFileSync18, appendFileSync as appendFileSync4, rmSync as rmSync2, readdirSync as readdirSync16, mkdirSync as mkdirSync19 } from "node:fs";
55143
- import { existsSync as existsSync43 } from "node:fs";
55332
+ import { readFileSync as readFileSync33, writeFileSync as writeFileSync19, appendFileSync as appendFileSync4, rmSync as rmSync3, readdirSync as readdirSync17, mkdirSync as mkdirSync20 } from "node:fs";
55333
+ import { existsSync as existsSync44 } from "node:fs";
55144
55334
  import { execSync as execSync30 } from "node:child_process";
55145
55335
  import { homedir as homedir13 } from "node:os";
55146
55336
  function formatTimeAgo(date) {
@@ -55161,12 +55351,12 @@ function getVersion3() {
55161
55351
  const require2 = createRequire2(import.meta.url);
55162
55352
  const thisDir = dirname19(fileURLToPath12(import.meta.url));
55163
55353
  const candidates = [
55164
- join59(thisDir, "..", "package.json"),
55165
- join59(thisDir, "..", "..", "package.json"),
55166
- join59(thisDir, "..", "..", "..", "package.json")
55354
+ join60(thisDir, "..", "package.json"),
55355
+ join60(thisDir, "..", "..", "package.json"),
55356
+ join60(thisDir, "..", "..", "..", "package.json")
55167
55357
  ];
55168
55358
  for (const pkgPath of candidates) {
55169
- if (existsSync43(pkgPath)) {
55359
+ if (existsSync44(pkgPath)) {
55170
55360
  const pkg = require2(pkgPath);
55171
55361
  if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli") {
55172
55362
  return pkg.version ?? "0.0.0";
@@ -55387,15 +55577,15 @@ Use task_status("${taskId}") or task_output("${taskId}") to check progress.`
55387
55577
  function gatherMemorySnippets(root) {
55388
55578
  const snippets = [];
55389
55579
  const dirs = [
55390
- join59(root, ".oa", "memory"),
55391
- join59(root, ".open-agents", "memory")
55580
+ join60(root, ".oa", "memory"),
55581
+ join60(root, ".open-agents", "memory")
55392
55582
  ];
55393
55583
  for (const dir of dirs) {
55394
- if (!existsSync43(dir))
55584
+ if (!existsSync44(dir))
55395
55585
  continue;
55396
55586
  try {
55397
- for (const f of readdirSync16(dir).filter((f2) => f2.endsWith(".json"))) {
55398
- const data = JSON.parse(readFileSync32(join59(dir, f), "utf-8"));
55587
+ for (const f of readdirSync17(dir).filter((f2) => f2.endsWith(".json"))) {
55588
+ const data = JSON.parse(readFileSync33(join60(dir, f), "utf-8"));
55399
55589
  for (const val of Object.values(data)) {
55400
55590
  const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
55401
55591
  if (v.length > 10)
@@ -55530,9 +55720,9 @@ ${metabolismMemories}
55530
55720
  } catch {
55531
55721
  }
55532
55722
  try {
55533
- const archeFile = join59(repoRoot, ".oa", "arche", "variants.json");
55534
- if (existsSync43(archeFile)) {
55535
- const variants = JSON.parse(readFileSync32(archeFile, "utf8"));
55723
+ const archeFile = join60(repoRoot, ".oa", "arche", "variants.json");
55724
+ if (existsSync44(archeFile)) {
55725
+ const variants = JSON.parse(readFileSync33(archeFile, "utf8"));
55536
55726
  if (variants.length > 0) {
55537
55727
  let filtered = variants;
55538
55728
  if (taskType) {
@@ -55669,9 +55859,9 @@ ${lines.join("\n")}
55669
55859
  const compactionThreshold = modelTier === "small" ? 12e3 : modelTier === "medium" ? 24e3 : 4e4;
55670
55860
  let identityInjection = "";
55671
55861
  try {
55672
- const ikStateFile = join59(repoRoot, ".oa", "identity", "self-state.json");
55673
- if (existsSync43(ikStateFile)) {
55674
- const selfState = JSON.parse(readFileSync32(ikStateFile, "utf8"));
55862
+ const ikStateFile = join60(repoRoot, ".oa", "identity", "self-state.json");
55863
+ if (existsSync44(ikStateFile)) {
55864
+ const selfState = JSON.parse(readFileSync33(ikStateFile, "utf8"));
55675
55865
  const lines = [
55676
55866
  `[Identity State v${selfState.version}]`,
55677
55867
  `Self: ${selfState.narrative_summary}`,
@@ -56309,13 +56499,13 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
56309
56499
  });
56310
56500
  }
56311
56501
  try {
56312
- const ikDir = join59(repoRoot, ".oa", "identity");
56313
- const ikFile = join59(ikDir, "self-state.json");
56502
+ const ikDir = join60(repoRoot, ".oa", "identity");
56503
+ const ikFile = join60(ikDir, "self-state.json");
56314
56504
  let ikState;
56315
- if (existsSync43(ikFile)) {
56316
- ikState = JSON.parse(readFileSync32(ikFile, "utf8"));
56505
+ if (existsSync44(ikFile)) {
56506
+ ikState = JSON.parse(readFileSync33(ikFile, "utf8"));
56317
56507
  } else {
56318
- mkdirSync19(ikDir, { recursive: true });
56508
+ mkdirSync20(ikDir, { recursive: true });
56319
56509
  const machineId = Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
56320
56510
  ikState = {
56321
56511
  self_id: `oa-${machineId}`,
@@ -56341,7 +56531,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
56341
56531
  }
56342
56532
  ikState.session_count = (ikState.session_count || 0) + 1;
56343
56533
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
56344
- writeFileSync18(ikFile, JSON.stringify(ikState, null, 2));
56534
+ writeFileSync19(ikFile, JSON.stringify(ikState, null, 2));
56345
56535
  } catch (ikErr) {
56346
56536
  try {
56347
56537
  console.error("[IK-OBSERVE]", ikErr);
@@ -56356,14 +56546,14 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
56356
56546
  } else {
56357
56547
  renderTaskIncomplete(result.turns, result.toolCalls, result.durationMs, tokens);
56358
56548
  try {
56359
- const ikFile = join59(repoRoot, ".oa", "identity", "self-state.json");
56360
- if (existsSync43(ikFile)) {
56361
- const ikState = JSON.parse(readFileSync32(ikFile, "utf8"));
56549
+ const ikFile = join60(repoRoot, ".oa", "identity", "self-state.json");
56550
+ if (existsSync44(ikFile)) {
56551
+ const ikState = JSON.parse(readFileSync33(ikFile, "utf8"));
56362
56552
  ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
56363
56553
  ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.05);
56364
56554
  ikState.session_count = (ikState.session_count || 0) + 1;
56365
56555
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
56366
- writeFileSync18(ikFile, JSON.stringify(ikState, null, 2));
56556
+ writeFileSync19(ikFile, JSON.stringify(ikState, null, 2));
56367
56557
  }
56368
56558
  } catch {
56369
56559
  }
@@ -56686,7 +56876,7 @@ async function startInteractive(config, repoPath) {
56686
56876
  let p2pGateway = null;
56687
56877
  let peerMesh = null;
56688
56878
  let inferenceRouter = null;
56689
- const secretVault = new SecretVault(join59(repoRoot, ".oa", "vault.enc"));
56879
+ const secretVault = new SecretVault(join60(repoRoot, ".oa", "vault.enc"));
56690
56880
  let adminSessionKey = null;
56691
56881
  const callSubAgents = /* @__PURE__ */ new Map();
56692
56882
  const streamRenderer = new StreamRenderer();
@@ -56906,13 +57096,13 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
56906
57096
  const hits = allCompletions.filter((c3) => c3.toLowerCase().startsWith(lower));
56907
57097
  return [hits, line];
56908
57098
  }
56909
- const HISTORY_DIR = join59(homedir13(), ".open-agents");
56910
- const HISTORY_FILE = join59(HISTORY_DIR, "repl-history");
57099
+ const HISTORY_DIR = join60(homedir13(), ".open-agents");
57100
+ const HISTORY_FILE = join60(HISTORY_DIR, "repl-history");
56911
57101
  const MAX_HISTORY_LINES = 500;
56912
57102
  let savedHistory = [];
56913
57103
  try {
56914
- if (existsSync43(HISTORY_FILE)) {
56915
- const raw = readFileSync32(HISTORY_FILE, "utf8").trim();
57104
+ if (existsSync44(HISTORY_FILE)) {
57105
+ const raw = readFileSync33(HISTORY_FILE, "utf8").trim();
56916
57106
  if (raw)
56917
57107
  savedHistory = raw.split("\n").reverse();
56918
57108
  }
@@ -56998,12 +57188,12 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
56998
57188
  if (!line.trim())
56999
57189
  return;
57000
57190
  try {
57001
- mkdirSync19(HISTORY_DIR, { recursive: true });
57191
+ mkdirSync20(HISTORY_DIR, { recursive: true });
57002
57192
  appendFileSync4(HISTORY_FILE, line + "\n", "utf8");
57003
57193
  if (Math.random() < 0.02) {
57004
- const all = readFileSync32(HISTORY_FILE, "utf8").trim().split("\n");
57194
+ const all = readFileSync33(HISTORY_FILE, "utf8").trim().split("\n");
57005
57195
  if (all.length > MAX_HISTORY_LINES) {
57006
- writeFileSync18(HISTORY_FILE, all.slice(-MAX_HISTORY_LINES).join("\n") + "\n", "utf8");
57196
+ writeFileSync19(HISTORY_FILE, all.slice(-MAX_HISTORY_LINES).join("\n") + "\n", "utf8");
57007
57197
  }
57008
57198
  }
57009
57199
  } catch {
@@ -57179,7 +57369,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
57179
57369
  } catch {
57180
57370
  }
57181
57371
  try {
57182
- const oaDir = join59(repoRoot, ".oa");
57372
+ const oaDir = join60(repoRoot, ".oa");
57183
57373
  const reconnected = await ExposeGateway.checkAndReconnect(oaDir, {
57184
57374
  onInfo: (msg) => writeContent(() => renderInfo(msg)),
57185
57375
  onError: (msg) => writeContent(() => renderWarning(msg))
@@ -57202,7 +57392,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
57202
57392
  } catch {
57203
57393
  }
57204
57394
  try {
57205
- const oaDir = join59(repoRoot, ".oa");
57395
+ const oaDir = join60(repoRoot, ".oa");
57206
57396
  const reconnectedP2P = await ExposeP2PGateway.checkAndReconnect(oaDir, new NexusTool(repoRoot), {
57207
57397
  onInfo: (msg) => writeContent(() => renderInfo(msg)),
57208
57398
  onError: (msg) => writeContent(() => renderWarning(msg))
@@ -58054,7 +58244,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
58054
58244
  kind,
58055
58245
  targetUrl,
58056
58246
  authKey,
58057
- stateDir: join59(repoRoot, ".oa"),
58247
+ stateDir: join60(repoRoot, ".oa"),
58058
58248
  passthrough: passthrough ?? false,
58059
58249
  loadbalance: loadbalance ?? false,
58060
58250
  endpointAuth: passthrough ? currentConfig.apiKey : void 0,
@@ -58102,7 +58292,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
58102
58292
  await tunnelGateway.stop();
58103
58293
  tunnelGateway = null;
58104
58294
  }
58105
- const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir: join59(repoRoot, ".oa") });
58295
+ const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir: join60(repoRoot, ".oa") });
58106
58296
  newTunnel.on("stats", (stats) => {
58107
58297
  statusBar.setExposeStatus({
58108
58298
  status: stats.status,
@@ -58371,10 +58561,10 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
58371
58561
  writeContent(() => renderInfo(`Killed ${bgKilled} background task(s).`));
58372
58562
  }
58373
58563
  try {
58374
- const nexusDir = join59(repoRoot, OA_DIR, "nexus");
58375
- const pidFile = join59(nexusDir, "daemon.pid");
58376
- if (existsSync43(pidFile)) {
58377
- const pid = parseInt(readFileSync32(pidFile, "utf8").trim(), 10);
58564
+ const nexusDir = join60(repoRoot, OA_DIR, "nexus");
58565
+ const pidFile = join60(nexusDir, "daemon.pid");
58566
+ if (existsSync44(pidFile)) {
58567
+ const pid = parseInt(readFileSync33(pidFile, "utf8").trim(), 10);
58378
58568
  if (pid > 0) {
58379
58569
  try {
58380
58570
  if (process.platform === "win32") {
@@ -58396,13 +58586,13 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
58396
58586
  } catch {
58397
58587
  }
58398
58588
  try {
58399
- const voiceDir2 = join59(homedir13(), ".open-agents", "voice");
58589
+ const voiceDir2 = join60(homedir13(), ".open-agents", "voice");
58400
58590
  const voicePidFiles = ["luxtts-daemon.pid", "piper-daemon.pid"];
58401
58591
  for (const pf of voicePidFiles) {
58402
- const pidPath = join59(voiceDir2, pf);
58403
- if (existsSync43(pidPath)) {
58592
+ const pidPath = join60(voiceDir2, pf);
58593
+ if (existsSync44(pidPath)) {
58404
58594
  try {
58405
- const pid = parseInt(readFileSync32(pidPath, "utf8").trim(), 10);
58595
+ const pid = parseInt(readFileSync33(pidPath, "utf8").trim(), 10);
58406
58596
  if (pid > 0) {
58407
58597
  if (process.platform === "win32") {
58408
58598
  try {
@@ -58426,12 +58616,12 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
58426
58616
  execSync30(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.5", { timeout: 3e3, stdio: "ignore" });
58427
58617
  } catch {
58428
58618
  }
58429
- const oaPath = join59(repoRoot, OA_DIR);
58430
- if (existsSync43(oaPath)) {
58619
+ const oaPath = join60(repoRoot, OA_DIR);
58620
+ if (existsSync44(oaPath)) {
58431
58621
  let deleted = false;
58432
58622
  for (let attempt = 0; attempt < 3; attempt++) {
58433
58623
  try {
58434
- rmSync2(oaPath, { recursive: true, force: true });
58624
+ rmSync3(oaPath, { recursive: true, force: true });
58435
58625
  deleted = true;
58436
58626
  break;
58437
58627
  } catch (err) {
@@ -58799,8 +58989,8 @@ Execute this skill now. Follow the behavioral guidance above.`;
58799
58989
  }
58800
58990
  }
58801
58991
  const cleanPath = input.replace(/^['"]|['"]$/g, "").trim();
58802
- const isImage = isImagePath(cleanPath) && existsSync43(resolve29(repoRoot, cleanPath));
58803
- const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync43(resolve29(repoRoot, cleanPath));
58992
+ const isImage = isImagePath(cleanPath) && existsSync44(resolve29(repoRoot, cleanPath));
58993
+ const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync44(resolve29(repoRoot, cleanPath));
58804
58994
  if (activeTask) {
58805
58995
  if (activeTask.runner.isPaused) {
58806
58996
  activeTask.runner.resume();
@@ -58809,7 +58999,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
58809
58999
  if (isImage) {
58810
59000
  try {
58811
59001
  const imgPath = resolve29(repoRoot, cleanPath);
58812
- const imgBuffer = readFileSync32(imgPath);
59002
+ const imgBuffer = readFileSync33(imgPath);
58813
59003
  const base64 = imgBuffer.toString("base64");
58814
59004
  const ext = extname10(cleanPath).toLowerCase();
58815
59005
  const mime = ext === ".png" ? "image/png" : ext === ".gif" ? "image/gif" : ext === ".webp" ? "image/webp" : "image/jpeg";
@@ -59307,13 +59497,13 @@ async function runWithTUI(task, config, repoPath) {
59307
59497
  const handle = startTask(task, config, repoRoot);
59308
59498
  await handle.promise;
59309
59499
  try {
59310
- const ikDir = join59(repoRoot, ".oa", "identity");
59311
- const ikFile = join59(ikDir, "self-state.json");
59500
+ const ikDir = join60(repoRoot, ".oa", "identity");
59501
+ const ikFile = join60(ikDir, "self-state.json");
59312
59502
  let ikState;
59313
- if (existsSync43(ikFile)) {
59314
- ikState = JSON.parse(readFileSync32(ikFile, "utf8"));
59503
+ if (existsSync44(ikFile)) {
59504
+ ikState = JSON.parse(readFileSync33(ikFile, "utf8"));
59315
59505
  } else {
59316
- mkdirSync19(ikDir, { recursive: true });
59506
+ mkdirSync20(ikDir, { recursive: true });
59317
59507
  ikState = {
59318
59508
  self_id: `oa-${Date.now().toString(36)}`,
59319
59509
  version: 1,
@@ -59335,7 +59525,7 @@ async function runWithTUI(task, config, repoPath) {
59335
59525
  ikState.homeostasis.coherence = Math.min(1, ikState.homeostasis.coherence + 0.05);
59336
59526
  ikState.session_count = (ikState.session_count || 0) + 1;
59337
59527
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
59338
- writeFileSync18(ikFile, JSON.stringify(ikState, null, 2));
59528
+ writeFileSync19(ikFile, JSON.stringify(ikState, null, 2));
59339
59529
  } catch (ikErr) {
59340
59530
  }
59341
59531
  try {
@@ -59344,12 +59534,12 @@ async function runWithTUI(task, config, repoPath) {
59344
59534
  ec.archiveVariantSync(`Task: ${task.slice(0, 200)}`, "success \u2014 completed", ["general"]);
59345
59535
  } catch {
59346
59536
  try {
59347
- const archeDir = join59(repoRoot, ".oa", "arche");
59348
- const archeFile = join59(archeDir, "variants.json");
59537
+ const archeDir = join60(repoRoot, ".oa", "arche");
59538
+ const archeFile = join60(archeDir, "variants.json");
59349
59539
  let variants = [];
59350
59540
  try {
59351
- if (existsSync43(archeFile))
59352
- variants = JSON.parse(readFileSync32(archeFile, "utf8"));
59541
+ if (existsSync44(archeFile))
59542
+ variants = JSON.parse(readFileSync33(archeFile, "utf8"));
59353
59543
  } catch {
59354
59544
  }
59355
59545
  variants.push({
@@ -59364,15 +59554,15 @@ async function runWithTUI(task, config, repoPath) {
59364
59554
  });
59365
59555
  if (variants.length > 50)
59366
59556
  variants = variants.slice(-50);
59367
- mkdirSync19(archeDir, { recursive: true });
59368
- writeFileSync18(archeFile, JSON.stringify(variants, null, 2));
59557
+ mkdirSync20(archeDir, { recursive: true });
59558
+ writeFileSync19(archeFile, JSON.stringify(variants, null, 2));
59369
59559
  } catch {
59370
59560
  }
59371
59561
  }
59372
59562
  try {
59373
- const metaFile = join59(repoRoot, ".oa", "memory", "metabolism", "store.json");
59374
- if (existsSync43(metaFile)) {
59375
- const store = JSON.parse(readFileSync32(metaFile, "utf8"));
59563
+ const metaFile = join60(repoRoot, ".oa", "memory", "metabolism", "store.json");
59564
+ if (existsSync44(metaFile)) {
59565
+ const store = JSON.parse(readFileSync33(metaFile, "utf8"));
59376
59566
  const surfaced = store.filter((m) => m.type !== "quarantine" && m.scores?.confidence > 0.15).sort((a, b) => b.scores.utility * b.scores.confidence - a.scores.utility * a.scores.confidence).slice(0, 5);
59377
59567
  let updated = false;
59378
59568
  for (const item of surfaced) {
@@ -59383,7 +59573,7 @@ async function runWithTUI(task, config, repoPath) {
59383
59573
  updated = true;
59384
59574
  }
59385
59575
  if (updated) {
59386
- writeFileSync18(metaFile, JSON.stringify(store, null, 2));
59576
+ writeFileSync19(metaFile, JSON.stringify(store, null, 2));
59387
59577
  }
59388
59578
  }
59389
59579
  } catch {
@@ -59436,9 +59626,9 @@ Rules:
59436
59626
  try {
59437
59627
  const { initDb: initDb2 } = __require("@open-agents/memory");
59438
59628
  const { ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
59439
- const dbDir = join59(repoRoot, ".oa", "memory");
59440
- mkdirSync19(dbDir, { recursive: true });
59441
- const db = initDb2(join59(dbDir, "structured.db"));
59629
+ const dbDir = join60(repoRoot, ".oa", "memory");
59630
+ mkdirSync20(dbDir, { recursive: true });
59631
+ const db = initDb2(join60(dbDir, "structured.db"));
59442
59632
  const memStore = new ProceduralMemoryStore2(db);
59443
59633
  memStore.createWithEmbedding({
59444
59634
  content: content.slice(0, 600),
@@ -59453,12 +59643,12 @@ Rules:
59453
59643
  db.close();
59454
59644
  } catch {
59455
59645
  }
59456
- const metaDir = join59(repoRoot, ".oa", "memory", "metabolism");
59457
- const storeFile = join59(metaDir, "store.json");
59646
+ const metaDir = join60(repoRoot, ".oa", "memory", "metabolism");
59647
+ const storeFile = join60(metaDir, "store.json");
59458
59648
  let store = [];
59459
59649
  try {
59460
- if (existsSync43(storeFile))
59461
- store = JSON.parse(readFileSync32(storeFile, "utf8"));
59650
+ if (existsSync44(storeFile))
59651
+ store = JSON.parse(readFileSync33(storeFile, "utf8"));
59462
59652
  } catch {
59463
59653
  }
59464
59654
  store.push({
@@ -59474,26 +59664,26 @@ Rules:
59474
59664
  });
59475
59665
  if (store.length > 100)
59476
59666
  store = store.slice(-100);
59477
- mkdirSync19(metaDir, { recursive: true });
59478
- writeFileSync18(storeFile, JSON.stringify(store, null, 2));
59667
+ mkdirSync20(metaDir, { recursive: true });
59668
+ writeFileSync19(storeFile, JSON.stringify(store, null, 2));
59479
59669
  }
59480
59670
  }
59481
59671
  } catch {
59482
59672
  }
59483
59673
  try {
59484
- const cohereSettingsFile = join59(repoRoot, ".oa", "settings.json");
59674
+ const cohereSettingsFile = join60(repoRoot, ".oa", "settings.json");
59485
59675
  let cohereActive = false;
59486
59676
  try {
59487
- if (existsSync43(cohereSettingsFile)) {
59488
- const settings = JSON.parse(readFileSync32(cohereSettingsFile, "utf8"));
59677
+ if (existsSync44(cohereSettingsFile)) {
59678
+ const settings = JSON.parse(readFileSync33(cohereSettingsFile, "utf8"));
59489
59679
  cohereActive = settings.cohere === true;
59490
59680
  }
59491
59681
  } catch {
59492
59682
  }
59493
59683
  if (cohereActive) {
59494
- const metaFile = join59(repoRoot, ".oa", "memory", "metabolism", "store.json");
59495
- if (existsSync43(metaFile)) {
59496
- const store = JSON.parse(readFileSync32(metaFile, "utf8"));
59684
+ const metaFile = join60(repoRoot, ".oa", "memory", "metabolism", "store.json");
59685
+ if (existsSync44(metaFile)) {
59686
+ const store = JSON.parse(readFileSync33(metaFile, "utf8"));
59497
59687
  const latest = store.filter((m) => m.sourceTrace === "trajectory-extraction" || m.sourceTrace === "llm-trajectory-extraction").slice(-1)[0];
59498
59688
  if (latest && latest.scores?.confidence >= 0.6) {
59499
59689
  try {
@@ -59518,18 +59708,18 @@ Rules:
59518
59708
  }
59519
59709
  } catch (err) {
59520
59710
  try {
59521
- const ikFile = join59(repoRoot, ".oa", "identity", "self-state.json");
59522
- if (existsSync43(ikFile)) {
59523
- const ikState = JSON.parse(readFileSync32(ikFile, "utf8"));
59711
+ const ikFile = join60(repoRoot, ".oa", "identity", "self-state.json");
59712
+ if (existsSync44(ikFile)) {
59713
+ const ikState = JSON.parse(readFileSync33(ikFile, "utf8"));
59524
59714
  ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
59525
59715
  ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.05);
59526
59716
  ikState.session_count = (ikState.session_count || 0) + 1;
59527
59717
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
59528
- writeFileSync18(ikFile, JSON.stringify(ikState, null, 2));
59718
+ writeFileSync19(ikFile, JSON.stringify(ikState, null, 2));
59529
59719
  }
59530
- const metaFile = join59(repoRoot, ".oa", "memory", "metabolism", "store.json");
59531
- if (existsSync43(metaFile)) {
59532
- const store = JSON.parse(readFileSync32(metaFile, "utf8"));
59720
+ const metaFile = join60(repoRoot, ".oa", "memory", "metabolism", "store.json");
59721
+ if (existsSync44(metaFile)) {
59722
+ const store = JSON.parse(readFileSync33(metaFile, "utf8"));
59533
59723
  const surfaced = store.filter((m) => m.type !== "quarantine" && m.scores?.confidence > 0.15).sort((a, b) => b.scores.utility * b.scores.confidence - a.scores.utility * a.scores.confidence).slice(0, 5);
59534
59724
  for (const item of surfaced) {
59535
59725
  item.accessCount = (item.accessCount || 0) + 1;
@@ -59537,15 +59727,15 @@ Rules:
59537
59727
  item.scores.utility = Math.max(0, (item.scores.utility || 0.5) - 0.05);
59538
59728
  item.scores.confidence = Math.max(0, (item.scores.confidence || 0.5) - 0.02);
59539
59729
  }
59540
- writeFileSync18(metaFile, JSON.stringify(store, null, 2));
59730
+ writeFileSync19(metaFile, JSON.stringify(store, null, 2));
59541
59731
  }
59542
59732
  try {
59543
- const archeDir = join59(repoRoot, ".oa", "arche");
59544
- const archeFile = join59(archeDir, "variants.json");
59733
+ const archeDir = join60(repoRoot, ".oa", "arche");
59734
+ const archeFile = join60(archeDir, "variants.json");
59545
59735
  let variants = [];
59546
59736
  try {
59547
- if (existsSync43(archeFile))
59548
- variants = JSON.parse(readFileSync32(archeFile, "utf8"));
59737
+ if (existsSync44(archeFile))
59738
+ variants = JSON.parse(readFileSync33(archeFile, "utf8"));
59549
59739
  } catch {
59550
59740
  }
59551
59741
  variants.push({
@@ -59560,8 +59750,8 @@ Rules:
59560
59750
  });
59561
59751
  if (variants.length > 50)
59562
59752
  variants = variants.slice(-50);
59563
- mkdirSync19(archeDir, { recursive: true });
59564
- writeFileSync18(archeFile, JSON.stringify(variants, null, 2));
59753
+ mkdirSync20(archeDir, { recursive: true });
59754
+ writeFileSync19(archeFile, JSON.stringify(variants, null, 2));
59565
59755
  } catch {
59566
59756
  }
59567
59757
  } catch {
@@ -59646,7 +59836,7 @@ import { glob } from "glob";
59646
59836
  import ignore from "ignore";
59647
59837
  import { readFile as readFile22, stat as stat4 } from "node:fs/promises";
59648
59838
  import { createHash as createHash4 } from "node:crypto";
59649
- import { join as join60, relative as relative3, extname as extname11, basename as basename15 } from "node:path";
59839
+ import { join as join61, relative as relative3, extname as extname11, basename as basename15 } from "node:path";
59650
59840
  var DEFAULT_EXCLUDE, LANGUAGE_MAP, CodebaseIndexer;
59651
59841
  var init_codebase_indexer = __esm({
59652
59842
  "packages/indexer/dist/codebase-indexer.js"() {
@@ -59690,7 +59880,7 @@ var init_codebase_indexer = __esm({
59690
59880
  const ig = ignore.default();
59691
59881
  if (this.config.respectGitignore) {
59692
59882
  try {
59693
- const gitignoreContent = await readFile22(join60(this.config.rootDir, ".gitignore"), "utf-8");
59883
+ const gitignoreContent = await readFile22(join61(this.config.rootDir, ".gitignore"), "utf-8");
59694
59884
  ig.add(gitignoreContent);
59695
59885
  } catch {
59696
59886
  }
@@ -59705,7 +59895,7 @@ var init_codebase_indexer = __esm({
59705
59895
  for (const relativePath of files) {
59706
59896
  if (ig.ignores(relativePath))
59707
59897
  continue;
59708
- const fullPath = join60(this.config.rootDir, relativePath);
59898
+ const fullPath = join61(this.config.rootDir, relativePath);
59709
59899
  try {
59710
59900
  const fileStat = await stat4(fullPath);
59711
59901
  if (fileStat.size > this.config.maxFileSize)
@@ -59751,7 +59941,7 @@ var init_codebase_indexer = __esm({
59751
59941
  if (!child) {
59752
59942
  child = {
59753
59943
  name: part,
59754
- path: join60(current.path, part),
59944
+ path: join61(current.path, part),
59755
59945
  type: "directory",
59756
59946
  children: []
59757
59947
  };
@@ -59834,17 +60024,17 @@ __export(index_repo_exports, {
59834
60024
  indexRepoCommand: () => indexRepoCommand
59835
60025
  });
59836
60026
  import { resolve as resolve30 } from "node:path";
59837
- import { existsSync as existsSync44, statSync as statSync14 } from "node:fs";
60027
+ import { existsSync as existsSync45, statSync as statSync15 } from "node:fs";
59838
60028
  import { cwd as cwd2 } from "node:process";
59839
60029
  async function indexRepoCommand(opts, _config) {
59840
60030
  const repoRoot = resolve30(opts.repoPath ?? cwd2());
59841
60031
  printHeader("Index Repository");
59842
60032
  printInfo(`Indexing: ${repoRoot}`);
59843
- if (!existsSync44(repoRoot)) {
60033
+ if (!existsSync45(repoRoot)) {
59844
60034
  printError(`Path does not exist: ${repoRoot}`);
59845
60035
  process.exit(1);
59846
60036
  }
59847
- const stat5 = statSync14(repoRoot);
60037
+ const stat5 = statSync15(repoRoot);
59848
60038
  if (!stat5.isDirectory()) {
59849
60039
  printError(`Path is not a directory: ${repoRoot}`);
59850
60040
  process.exit(1);
@@ -60092,7 +60282,7 @@ var config_exports = {};
60092
60282
  __export(config_exports, {
60093
60283
  configCommand: () => configCommand
60094
60284
  });
60095
- import { join as join61, resolve as resolve31 } from "node:path";
60285
+ import { join as join62, resolve as resolve31 } from "node:path";
60096
60286
  import { homedir as homedir14 } from "node:os";
60097
60287
  import { cwd as cwd3 } from "node:process";
60098
60288
  function redactIfSensitive(key, value) {
@@ -60175,7 +60365,7 @@ function handleShow(opts, config) {
60175
60365
  }
60176
60366
  }
60177
60367
  printSection("Config File");
60178
- printInfo(`~/.open-agents/config.json (${join61(homedir14(), ".open-agents", "config.json")})`);
60368
+ printInfo(`~/.open-agents/config.json (${join62(homedir14(), ".open-agents", "config.json")})`);
60179
60369
  printSection("Priority Chain");
60180
60370
  printInfo(" 1. CLI flags (--model, --backend-url, etc.)");
60181
60371
  printInfo(" 2. Project .oa/settings.json (--local)");
@@ -60214,7 +60404,7 @@ function handleSet(opts, _config) {
60214
60404
  const coerced = coerceForSettings(key, value);
60215
60405
  saveProjectSettings(repoRoot, { [key]: coerced });
60216
60406
  printSuccess(`Project override set: ${key} = ${redactIfSensitive(key, value)}`);
60217
- printInfo(`Saved to ${join61(repoRoot, ".oa", "settings.json")}`);
60407
+ printInfo(`Saved to ${join62(repoRoot, ".oa", "settings.json")}`);
60218
60408
  printInfo("This override applies only when running in this workspace.");
60219
60409
  } catch (err) {
60220
60410
  printError(`Failed to save: ${err instanceof Error ? err.message : String(err)}`);
@@ -60472,8 +60662,8 @@ __export(eval_exports, {
60472
60662
  evalCommand: () => evalCommand
60473
60663
  });
60474
60664
  import { tmpdir as tmpdir10 } from "node:os";
60475
- import { mkdirSync as mkdirSync20, writeFileSync as writeFileSync19 } from "node:fs";
60476
- import { join as join62 } from "node:path";
60665
+ import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync20 } from "node:fs";
60666
+ import { join as join63 } from "node:path";
60477
60667
  async function evalCommand(opts, config) {
60478
60668
  const suiteName = opts.suite ?? "basic";
60479
60669
  const suite = SUITES[suiteName];
@@ -60598,9 +60788,9 @@ async function evalCommand(opts, config) {
60598
60788
  process.exit(failed > 0 ? 1 : 0);
60599
60789
  }
60600
60790
  function createTempEvalRepo() {
60601
- const dir = join62(tmpdir10(), `open-agents-eval-${Date.now()}`);
60602
- mkdirSync20(dir, { recursive: true });
60603
- writeFileSync19(join62(dir, "package.json"), JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n", "utf8");
60791
+ const dir = join63(tmpdir10(), `open-agents-eval-${Date.now()}`);
60792
+ mkdirSync21(dir, { recursive: true });
60793
+ writeFileSync20(join63(dir, "package.json"), JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n", "utf8");
60604
60794
  return dir;
60605
60795
  }
60606
60796
  var BASIC_SUITE, FULL_SUITE, SUITES;
@@ -60660,7 +60850,7 @@ init_updater();
60660
60850
  import { parseArgs as nodeParseArgs2 } from "node:util";
60661
60851
  import { createRequire as createRequire3 } from "node:module";
60662
60852
  import { fileURLToPath as fileURLToPath13 } from "node:url";
60663
- import { dirname as dirname20, join as join63 } from "node:path";
60853
+ import { dirname as dirname20, join as join64 } from "node:path";
60664
60854
 
60665
60855
  // packages/cli/dist/cli.js
60666
60856
  import { createInterface } from "node:readline";
@@ -60767,7 +60957,7 @@ init_output();
60767
60957
  function getVersion4() {
60768
60958
  try {
60769
60959
  const require2 = createRequire3(import.meta.url);
60770
- const pkgPath = join63(dirname20(fileURLToPath13(import.meta.url)), "..", "package.json");
60960
+ const pkgPath = join64(dirname20(fileURLToPath13(import.meta.url)), "..", "package.json");
60771
60961
  const pkg = require2(pkgPath);
60772
60962
  return pkg.version;
60773
60963
  } catch {