open-agents-ai 0.184.43 → 0.184.44

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 +445 -320
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -13598,9 +13598,9 @@ print("${sentinel}")
13598
13598
  if (!this.proc || this.proc.killed) {
13599
13599
  return { success: false, path: "" };
13600
13600
  }
13601
- const { mkdirSync: mkdirSync29, writeFileSync: writeFileSync28 } = await import("node:fs");
13601
+ const { mkdirSync: mkdirSync30, writeFileSync: writeFileSync29 } = await import("node:fs");
13602
13602
  const sessionDir = join22(this.cwd, ".oa", "rlm");
13603
- mkdirSync29(sessionDir, { recursive: true });
13603
+ mkdirSync30(sessionDir, { recursive: true });
13604
13604
  const sessionPath = join22(sessionDir, "session.json");
13605
13605
  try {
13606
13606
  const inspectCode = `
@@ -13624,7 +13624,7 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
13624
13624
  trajectoryCount: this.trajectory.length,
13625
13625
  subCallCount: this.subCallCount
13626
13626
  };
13627
- writeFileSync28(sessionPath, JSON.stringify(sessionData, null, 2), "utf8");
13627
+ writeFileSync29(sessionPath, JSON.stringify(sessionData, null, 2), "utf8");
13628
13628
  return { success: true, path: sessionPath };
13629
13629
  }
13630
13630
  } catch {
@@ -13636,11 +13636,11 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
13636
13636
  * what was previously computed. */
13637
13637
  async loadSessionInfo() {
13638
13638
  try {
13639
- const { readFileSync: readFileSync43, existsSync: existsSync55 } = await import("node:fs");
13639
+ const { readFileSync: readFileSync44, existsSync: existsSync56 } = await import("node:fs");
13640
13640
  const sessionPath = join22(this.cwd, ".oa", "rlm", "session.json");
13641
- if (!existsSync55(sessionPath))
13641
+ if (!existsSync56(sessionPath))
13642
13642
  return null;
13643
- return JSON.parse(readFileSync43(sessionPath, "utf8"));
13643
+ return JSON.parse(readFileSync44(sessionPath, "utf8"));
13644
13644
  } catch {
13645
13645
  return null;
13646
13646
  }
@@ -13817,10 +13817,10 @@ var init_memory_metabolism = __esm({
13817
13817
  const trajDir = join23(this.cwd, ".oa", "rlm-trajectories");
13818
13818
  let lessons = [];
13819
13819
  try {
13820
- const { readdirSync: readdirSync23, readFileSync: readFileSync43 } = await import("node:fs");
13820
+ const { readdirSync: readdirSync23, readFileSync: readFileSync44 } = await import("node:fs");
13821
13821
  const files = readdirSync23(trajDir).filter((f) => f.endsWith(".jsonl")).sort().reverse().slice(0, 3);
13822
13822
  for (const file of files) {
13823
- const lines = readFileSync43(join23(trajDir, file), "utf8").split("\n").filter((l) => l.trim());
13823
+ const lines = readFileSync44(join23(trajDir, file), "utf8").split("\n").filter((l) => l.trim());
13824
13824
  for (const line of lines) {
13825
13825
  try {
13826
13826
  const entry = JSON.parse(line);
@@ -14204,14 +14204,14 @@ ${issues.map((i) => ` - ${i}`).join("\n")}` : " No issues found."),
14204
14204
  * Optionally filter by task type for phase-aware context (FSM paper insight).
14205
14205
  */
14206
14206
  getTopMemoriesSync(k = 5, taskType) {
14207
- const { readFileSync: readFileSync43, existsSync: existsSync55 } = __require("node:fs");
14207
+ const { readFileSync: readFileSync44, existsSync: existsSync56 } = __require("node:fs");
14208
14208
  const metaDir = join23(this.cwd, ".oa", "memory", "metabolism");
14209
14209
  const storeFile = join23(metaDir, "store.json");
14210
- if (!existsSync55(storeFile))
14210
+ if (!existsSync56(storeFile))
14211
14211
  return "";
14212
14212
  let store = [];
14213
14213
  try {
14214
- store = JSON.parse(readFileSync43(storeFile, "utf8"));
14214
+ store = JSON.parse(readFileSync44(storeFile, "utf8"));
14215
14215
  } catch {
14216
14216
  return "";
14217
14217
  }
@@ -14233,14 +14233,14 @@ ${issues.map((i) => ` - ${i}`).join("\n")}` : " No issues found."),
14233
14233
  /** Update memory scores based on task outcome. Called after task completion.
14234
14234
  * Memories used in successful tasks get boosted. Memories present during failures get decayed. */
14235
14235
  updateFromOutcomeSync(surfacedMemoryText, succeeded) {
14236
- const { readFileSync: readFileSync43, writeFileSync: writeFileSync28, existsSync: existsSync55, mkdirSync: mkdirSync29 } = __require("node:fs");
14236
+ const { readFileSync: readFileSync44, writeFileSync: writeFileSync29, existsSync: existsSync56, mkdirSync: mkdirSync30 } = __require("node:fs");
14237
14237
  const metaDir = join23(this.cwd, ".oa", "memory", "metabolism");
14238
14238
  const storeFile = join23(metaDir, "store.json");
14239
- if (!existsSync55(storeFile))
14239
+ if (!existsSync56(storeFile))
14240
14240
  return;
14241
14241
  let store = [];
14242
14242
  try {
14243
- store = JSON.parse(readFileSync43(storeFile, "utf8"));
14243
+ store = JSON.parse(readFileSync44(storeFile, "utf8"));
14244
14244
  } catch {
14245
14245
  return;
14246
14246
  }
@@ -14264,8 +14264,8 @@ ${issues.map((i) => ` - ${i}`).join("\n")}` : " No issues found."),
14264
14264
  updated = true;
14265
14265
  }
14266
14266
  if (updated) {
14267
- mkdirSync29(metaDir, { recursive: true });
14268
- writeFileSync28(storeFile, JSON.stringify(store, null, 2));
14267
+ mkdirSync30(metaDir, { recursive: true });
14268
+ writeFileSync29(storeFile, JSON.stringify(store, null, 2));
14269
14269
  }
14270
14270
  }
14271
14271
  // ── Storage ──────────────────────────────────────────────────────────
@@ -14687,13 +14687,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
14687
14687
  // Per EvoSkill (arXiv:2603.02766): retrieve relevant strategies from archive.
14688
14688
  /** Retrieve top-K strategies for context injection. Returns "" if none. */
14689
14689
  getRelevantStrategiesSync(k = 3, taskType) {
14690
- const { readFileSync: readFileSync43, existsSync: existsSync55 } = __require("node:fs");
14690
+ const { readFileSync: readFileSync44, existsSync: existsSync56 } = __require("node:fs");
14691
14691
  const archiveFile = join25(this.cwd, ".oa", "arche", "variants.json");
14692
- if (!existsSync55(archiveFile))
14692
+ if (!existsSync56(archiveFile))
14693
14693
  return "";
14694
14694
  let variants = [];
14695
14695
  try {
14696
- variants = JSON.parse(readFileSync43(archiveFile, "utf8"));
14696
+ variants = JSON.parse(readFileSync44(archiveFile, "utf8"));
14697
14697
  } catch {
14698
14698
  return "";
14699
14699
  }
@@ -14711,13 +14711,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
14711
14711
  }
14712
14712
  /** Archive a strategy variant synchronously (for task completion path) */
14713
14713
  archiveVariantSync(strategy, outcome, tags = []) {
14714
- const { readFileSync: readFileSync43, writeFileSync: writeFileSync28, existsSync: existsSync55, mkdirSync: mkdirSync29 } = __require("node:fs");
14714
+ const { readFileSync: readFileSync44, writeFileSync: writeFileSync29, existsSync: existsSync56, mkdirSync: mkdirSync30 } = __require("node:fs");
14715
14715
  const dir = join25(this.cwd, ".oa", "arche");
14716
14716
  const archiveFile = join25(dir, "variants.json");
14717
14717
  let variants = [];
14718
14718
  try {
14719
- if (existsSync55(archiveFile))
14720
- variants = JSON.parse(readFileSync43(archiveFile, "utf8"));
14719
+ if (existsSync56(archiveFile))
14720
+ variants = JSON.parse(readFileSync44(archiveFile, "utf8"));
14721
14721
  } catch {
14722
14722
  }
14723
14723
  variants.push({
@@ -14732,8 +14732,8 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
14732
14732
  });
14733
14733
  if (variants.length > 50)
14734
14734
  variants = variants.slice(-50);
14735
- mkdirSync29(dir, { recursive: true });
14736
- writeFileSync28(archiveFile, JSON.stringify(variants, null, 2));
14735
+ mkdirSync30(dir, { recursive: true });
14736
+ writeFileSync29(archiveFile, JSON.stringify(variants, null, 2));
14737
14737
  }
14738
14738
  async saveArchive(variants) {
14739
14739
  const dir = join25(this.cwd, ".oa", "arche");
@@ -27091,10 +27091,10 @@ ${marker}` : marker);
27091
27091
  if (!this._workingDirectory)
27092
27092
  return;
27093
27093
  try {
27094
- const { mkdirSync: mkdirSync29, writeFileSync: writeFileSync28 } = __require("node:fs");
27095
- const { join: join75 } = __require("node:path");
27096
- const sessionDir = join75(this._workingDirectory, ".oa", "session", this._sessionId);
27097
- mkdirSync29(sessionDir, { recursive: true });
27094
+ const { mkdirSync: mkdirSync30, writeFileSync: writeFileSync29 } = __require("node:fs");
27095
+ const { join: join76 } = __require("node:path");
27096
+ const sessionDir = join76(this._workingDirectory, ".oa", "session", this._sessionId);
27097
+ mkdirSync30(sessionDir, { recursive: true });
27098
27098
  const checkpoint = {
27099
27099
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
27100
27100
  sessionId: this._sessionId,
@@ -27106,7 +27106,7 @@ ${marker}` : marker);
27106
27106
  memexEntryCount: this._memexArchive.size,
27107
27107
  fileRegistrySize: this._fileRegistry.size
27108
27108
  };
27109
- writeFileSync28(join75(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
27109
+ writeFileSync29(join76(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
27110
27110
  } catch {
27111
27111
  }
27112
27112
  }
@@ -38470,26 +38470,26 @@ async function fetchOpenAIModels(baseUrl, apiKey) {
38470
38470
  async function fetchPeerModels(peerId, authKey) {
38471
38471
  try {
38472
38472
  const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
38473
- const { existsSync: existsSync55, readFileSync: readFileSync43 } = await import("node:fs");
38474
- const { join: join75 } = await import("node:path");
38473
+ const { existsSync: existsSync56, readFileSync: readFileSync44 } = await import("node:fs");
38474
+ const { join: join76 } = await import("node:path");
38475
38475
  const cwd4 = process.cwd();
38476
38476
  const nexusTool = new NexusTool2(cwd4);
38477
38477
  const nexusDir = nexusTool.getNexusDir();
38478
38478
  let isLocalPeer = false;
38479
38479
  try {
38480
- const statusPath = join75(nexusDir, "status.json");
38481
- if (existsSync55(statusPath)) {
38482
- const status = JSON.parse(readFileSync43(statusPath, "utf8"));
38480
+ const statusPath = join76(nexusDir, "status.json");
38481
+ if (existsSync56(statusPath)) {
38482
+ const status = JSON.parse(readFileSync44(statusPath, "utf8"));
38483
38483
  if (status.peerId === peerId)
38484
38484
  isLocalPeer = true;
38485
38485
  }
38486
38486
  } catch {
38487
38487
  }
38488
38488
  if (isLocalPeer) {
38489
- const pricingPath = join75(nexusDir, "pricing.json");
38490
- if (existsSync55(pricingPath)) {
38489
+ const pricingPath = join76(nexusDir, "pricing.json");
38490
+ if (existsSync56(pricingPath)) {
38491
38491
  try {
38492
- const pricing = JSON.parse(readFileSync43(pricingPath, "utf8"));
38492
+ const pricing = JSON.parse(readFileSync44(pricingPath, "utf8"));
38493
38493
  const localModels = (pricing.models || []).map((m) => ({
38494
38494
  name: m.model || "unknown",
38495
38495
  size: m.parameterSize || "",
@@ -38503,10 +38503,10 @@ async function fetchPeerModels(peerId, authKey) {
38503
38503
  }
38504
38504
  }
38505
38505
  }
38506
- const cachePath = join75(nexusDir, "peer-models-cache.json");
38507
- if (existsSync55(cachePath)) {
38506
+ const cachePath = join76(nexusDir, "peer-models-cache.json");
38507
+ if (existsSync56(cachePath)) {
38508
38508
  try {
38509
- const cache4 = JSON.parse(readFileSync43(cachePath, "utf8"));
38509
+ const cache4 = JSON.parse(readFileSync44(cachePath, "utf8"));
38510
38510
  if (cache4.peerId === peerId && cache4.models?.length > 0) {
38511
38511
  const age = Date.now() - new Date(cache4.cachedAt).getTime();
38512
38512
  if (age < 5 * 60 * 1e3) {
@@ -38621,10 +38621,10 @@ async function fetchPeerModels(peerId, authKey) {
38621
38621
  } catch {
38622
38622
  }
38623
38623
  if (isLocalPeer) {
38624
- const pricingPath = join75(nexusDir, "pricing.json");
38625
- if (existsSync55(pricingPath)) {
38624
+ const pricingPath = join76(nexusDir, "pricing.json");
38625
+ if (existsSync56(pricingPath)) {
38626
38626
  try {
38627
- const pricing = JSON.parse(readFileSync43(pricingPath, "utf8"));
38627
+ const pricing = JSON.parse(readFileSync44(pricingPath, "utf8"));
38628
38628
  return (pricing.models || []).map((m) => ({
38629
38629
  name: m.model || "unknown",
38630
38630
  size: m.parameterSize || "",
@@ -49621,12 +49621,12 @@ async function handleVoiceMenu(ctx, save, hasLocal) {
49621
49621
  continue;
49622
49622
  }
49623
49623
  const { basename: basename18, join: pathJoin } = await import("node:path");
49624
- const { copyFileSync: copyFileSync2, mkdirSync: mkdirSync29, existsSync: exists } = await import("node:fs");
49624
+ const { copyFileSync: copyFileSync2, mkdirSync: mkdirSync30, existsSync: exists } = await import("node:fs");
49625
49625
  const { homedir: homedir20 } = await import("node:os");
49626
49626
  const modelName = basename18(onnxDrop.path, ".onnx").replace(/[^a-zA-Z0-9_-]/g, "-");
49627
49627
  const destDir = pathJoin(homedir20(), ".open-agents", "voice", "models", modelName);
49628
49628
  if (!exists(destDir))
49629
- mkdirSync29(destDir, { recursive: true });
49629
+ mkdirSync30(destDir, { recursive: true });
49630
49630
  copyFileSync2(onnxDrop.path, pathJoin(destDir, "model.onnx"));
49631
49631
  copyFileSync2(jsonDrop.path, pathJoin(destDir, "config.json"));
49632
49632
  const { registerCustomOnnxModel: registerCustomOnnxModel2 } = await Promise.resolve().then(() => (init_voice(), voice_exports));
@@ -50304,11 +50304,11 @@ async function handlePeerEndpoint(peerId, authKey, ctx, local) {
50304
50304
  const models = await fetchModels(peerUrl, authKey);
50305
50305
  if (models.length > 0) {
50306
50306
  try {
50307
- const { writeFileSync: writeFileSync28, mkdirSync: mkdirSync29 } = await import("node:fs");
50308
- const { join: join75, dirname: dirname23 } = await import("node:path");
50309
- const cachePath = join75(ctx.repoRoot || process.cwd(), ".oa", "nexus", "peer-models-cache.json");
50310
- mkdirSync29(dirname23(cachePath), { recursive: true });
50311
- writeFileSync28(cachePath, JSON.stringify({
50307
+ const { writeFileSync: writeFileSync29, mkdirSync: mkdirSync30 } = await import("node:fs");
50308
+ const { join: join76, dirname: dirname23 } = await import("node:path");
50309
+ const cachePath = join76(ctx.repoRoot || process.cwd(), ".oa", "nexus", "peer-models-cache.json");
50310
+ mkdirSync30(dirname23(cachePath), { recursive: true });
50311
+ writeFileSync29(cachePath, JSON.stringify({
50312
50312
  peerId,
50313
50313
  cachedAt: (/* @__PURE__ */ new Date()).toISOString(),
50314
50314
  models: models.map((m) => ({ name: m.name, size: m.size, parameterSize: m.parameterSize }))
@@ -50507,17 +50507,17 @@ async function handleUpdate(subcommand, ctx) {
50507
50507
  try {
50508
50508
  const { createRequire: createRequire5 } = await import("node:module");
50509
50509
  const { fileURLToPath: fileURLToPath15 } = await import("node:url");
50510
- const { dirname: dirname23, join: join75 } = await import("node:path");
50511
- const { existsSync: existsSync55 } = await import("node:fs");
50510
+ const { dirname: dirname23, join: join76 } = await import("node:path");
50511
+ const { existsSync: existsSync56 } = await import("node:fs");
50512
50512
  const req = createRequire5(import.meta.url);
50513
50513
  const thisDir = dirname23(fileURLToPath15(import.meta.url));
50514
50514
  const candidates = [
50515
- join75(thisDir, "..", "package.json"),
50516
- join75(thisDir, "..", "..", "package.json"),
50517
- join75(thisDir, "..", "..", "..", "package.json")
50515
+ join76(thisDir, "..", "package.json"),
50516
+ join76(thisDir, "..", "..", "package.json"),
50517
+ join76(thisDir, "..", "..", "..", "package.json")
50518
50518
  ];
50519
50519
  for (const pkgPath of candidates) {
50520
- if (existsSync55(pkgPath)) {
50520
+ if (existsSync56(pkgPath)) {
50521
50521
  const pkg = req(pkgPath);
50522
50522
  if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli") {
50523
50523
  currentVersion = pkg.version ?? "0.0.0";
@@ -52569,6 +52569,24 @@ var init_carousel = __esm({
52569
52569
  });
52570
52570
 
52571
52571
  // packages/cli/dist/tui/banner.js
52572
+ var banner_exports = {};
52573
+ __export(banner_exports, {
52574
+ BannerRenderer: () => BannerRenderer,
52575
+ createAnimatedBanner: () => createAnimatedBanner,
52576
+ createCohereBanner: () => createCohereBanner,
52577
+ createDefaultBanner: () => createDefaultBanner,
52578
+ createEmptyGrid: () => createEmptyGrid,
52579
+ createSponsorBanner: () => createSponsorBanner,
52580
+ fillGridRegion: () => fillGridRegion,
52581
+ generateMnemonic: () => generateMnemonic,
52582
+ getNodeMnemonic: () => getNodeMnemonic,
52583
+ listBannerDesigns: () => listBannerDesigns,
52584
+ loadBannerDesign: () => loadBannerDesign,
52585
+ saveBannerDesign: () => saveBannerDesign,
52586
+ setGridText: () => setGridText
52587
+ });
52588
+ import { existsSync as existsSync44, readFileSync as readFileSync33, writeFileSync as writeFileSync20, mkdirSync as mkdirSync19 } from "node:fs";
52589
+ import { join as join60 } from "node:path";
52572
52590
  function generateMnemonic(seed) {
52573
52591
  let h = 2166136261;
52574
52592
  for (let i = 0; i < seed.length; i++) {
@@ -52661,7 +52679,8 @@ function createDefaultBanner(version = "0.120.0") {
52661
52679
  alignment: ["left", "center", "left"],
52662
52680
  flowSpeed: [0, 0, 0],
52663
52681
  author: "system",
52664
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
52682
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
52683
+ version
52665
52684
  };
52666
52685
  }
52667
52686
  function createCohereBanner() {
@@ -52698,6 +52717,108 @@ function createCohereBanner() {
52698
52717
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
52699
52718
  };
52700
52719
  }
52720
+ function createSponsorBanner(sponsorName, tagline, primaryColor = 214, bgColor = 0) {
52721
+ const width = process.stdout.columns ?? 80;
52722
+ const rows = 3;
52723
+ const grid = [];
52724
+ for (let r = 0; r < rows; r++) {
52725
+ const row = [];
52726
+ for (let c3 = 0; c3 < width; c3++) {
52727
+ row.push({ char: " ", fg: primaryColor, bg: bgColor, bold: false });
52728
+ }
52729
+ grid.push(row);
52730
+ }
52731
+ const nameText = ` ${sponsorName}`;
52732
+ for (let i = 0; i < nameText.length && i < width; i++) {
52733
+ grid[0][i] = { char: nameText[i], fg: primaryColor, bg: bgColor, bold: true };
52734
+ }
52735
+ const startCol = Math.max(0, Math.floor((width - tagline.length) / 2));
52736
+ for (let i = 0; i < tagline.length && startCol + i < width; i++) {
52737
+ grid[1][startCol + i] = { char: tagline[i], fg: primaryColor, bg: bgColor, bold: false };
52738
+ }
52739
+ for (let c3 = 0; c3 < width; c3++) {
52740
+ grid[2][c3] = { char: c3 % 2 === 0 ? "\u2500" : "\u2550", fg: primaryColor, bg: bgColor, bold: false };
52741
+ }
52742
+ return {
52743
+ id: `sponsor-${sponsorName.toLowerCase().replace(/\s+/g, "-")}`,
52744
+ name: `Sponsor: ${sponsorName}`,
52745
+ type: "sponsor",
52746
+ frames: [{ grid, durationMs: 0 }],
52747
+ alignment: ["left", "center", "left"],
52748
+ flowSpeed: [0, 0, 0],
52749
+ author: sponsorName,
52750
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
52751
+ };
52752
+ }
52753
+ function saveBannerDesign(workDir, design) {
52754
+ const dir = join60(workDir, ".oa", "banners");
52755
+ mkdirSync19(dir, { recursive: true });
52756
+ writeFileSync20(join60(dir, `${design.id}.json`), JSON.stringify(design, null, 2), "utf8");
52757
+ }
52758
+ function loadBannerDesign(workDir, id) {
52759
+ const file = join60(workDir, ".oa", "banners", `${id}.json`);
52760
+ if (!existsSync44(file))
52761
+ return null;
52762
+ try {
52763
+ return JSON.parse(readFileSync33(file, "utf8"));
52764
+ } catch {
52765
+ return null;
52766
+ }
52767
+ }
52768
+ function listBannerDesigns(workDir) {
52769
+ const dir = join60(workDir, ".oa", "banners");
52770
+ if (!existsSync44(dir))
52771
+ return [];
52772
+ try {
52773
+ const { readdirSync: readdirSync23 } = __require("node:fs");
52774
+ return readdirSync23(dir).filter((f) => f.endsWith(".json")).map((f) => f.replace(".json", ""));
52775
+ } catch {
52776
+ return [];
52777
+ }
52778
+ }
52779
+ function createEmptyGrid(width, rows = 3) {
52780
+ const grid = [];
52781
+ for (let r = 0; r < rows; r++) {
52782
+ const row = [];
52783
+ for (let c3 = 0; c3 < width; c3++) {
52784
+ row.push({ char: " ", fg: -1, bg: -1, bold: false });
52785
+ }
52786
+ grid.push(row);
52787
+ }
52788
+ return grid;
52789
+ }
52790
+ function setGridText(grid, row, col, text, fg2 = -1, bg = -1, bold = false) {
52791
+ if (!grid[row])
52792
+ return;
52793
+ for (let i = 0; i < text.length; i++) {
52794
+ if (col + i < grid[row].length) {
52795
+ grid[row][col + i] = { char: text[i], fg: fg2, bg, bold };
52796
+ }
52797
+ }
52798
+ }
52799
+ function fillGridRegion(grid, startRow, startCol, endRow, endCol, cell) {
52800
+ for (let r = startRow; r <= endRow && r < grid.length; r++) {
52801
+ for (let c3 = startCol; c3 <= endCol && grid[r] && c3 < grid[r].length; c3++) {
52802
+ grid[r][c3] = { ...cell };
52803
+ }
52804
+ }
52805
+ }
52806
+ function createAnimatedBanner(id, name, frameBuilders, frameDurationMs, author = "user") {
52807
+ const width = process.stdout.columns ?? 80;
52808
+ return {
52809
+ id,
52810
+ name,
52811
+ type: "custom",
52812
+ frames: frameBuilders.map((builder) => ({
52813
+ grid: builder(width),
52814
+ durationMs: frameDurationMs
52815
+ })),
52816
+ alignment: ["left", "center", "left"],
52817
+ flowSpeed: [0, 0, 0],
52818
+ author,
52819
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
52820
+ };
52821
+ }
52701
52822
  var isTTY7, MNEMONIC_ADJECTIVES, MNEMONIC_NOUNS, BannerRenderer;
52702
52823
  var init_banner = __esm({
52703
52824
  "packages/cli/dist/tui/banner.js"() {
@@ -52841,7 +52962,7 @@ var init_banner = __esm({
52841
52962
  this.width = process.stdout.columns ?? 80;
52842
52963
  if (this.currentDesign) {
52843
52964
  if (this.currentDesign.type === "default") {
52844
- const version = this.currentDesign.frames[0]?.grid[1]?.filter((c3) => c3.bold && c3.fg === 226).map((c3) => c3.char).join("").replace("OA-", "") || "0.0.0";
52965
+ const version = this.currentDesign.version ?? "0.0.0";
52845
52966
  this.currentDesign = createDefaultBanner(version);
52846
52967
  } else if (this.currentDesign.type === "cohere") {
52847
52968
  this.currentDesign = createCohereBanner();
@@ -52978,22 +53099,22 @@ var init_banner = __esm({
52978
53099
  });
52979
53100
 
52980
53101
  // packages/cli/dist/tui/carousel-descriptors.js
52981
- import { existsSync as existsSync44, readFileSync as readFileSync33, writeFileSync as writeFileSync20, mkdirSync as mkdirSync19, readdirSync as readdirSync14 } from "node:fs";
52982
- import { join as join60, basename as basename13 } from "node:path";
53102
+ import { existsSync as existsSync45, readFileSync as readFileSync34, writeFileSync as writeFileSync21, mkdirSync as mkdirSync20, readdirSync as readdirSync14 } from "node:fs";
53103
+ import { join as join61, basename as basename13 } from "node:path";
52983
53104
  function loadToolProfile(repoRoot) {
52984
- const filePath = join60(repoRoot, OA_DIR, "context", TOOL_PROFILE_FILE);
53105
+ const filePath = join61(repoRoot, OA_DIR, "context", TOOL_PROFILE_FILE);
52985
53106
  try {
52986
- if (!existsSync44(filePath))
53107
+ if (!existsSync45(filePath))
52987
53108
  return null;
52988
- return JSON.parse(readFileSync33(filePath, "utf-8"));
53109
+ return JSON.parse(readFileSync34(filePath, "utf-8"));
52989
53110
  } catch {
52990
53111
  return null;
52991
53112
  }
52992
53113
  }
52993
53114
  function saveToolProfile(repoRoot, profile) {
52994
- const contextDir = join60(repoRoot, OA_DIR, "context");
52995
- mkdirSync19(contextDir, { recursive: true });
52996
- writeFileSync20(join60(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
53115
+ const contextDir = join61(repoRoot, OA_DIR, "context");
53116
+ mkdirSync20(contextDir, { recursive: true });
53117
+ writeFileSync21(join61(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
52997
53118
  }
52998
53119
  function categorizeToolCall(toolName) {
52999
53120
  for (const cat of TOOL_CATEGORIES) {
@@ -53051,25 +53172,25 @@ function weightedColor(profile) {
53051
53172
  return selectedCat.colors[Math.floor(Math.random() * selectedCat.colors.length)];
53052
53173
  }
53053
53174
  function loadCachedDescriptors(repoRoot) {
53054
- const filePath = join60(repoRoot, OA_DIR, "context", DESCRIPTOR_FILE);
53175
+ const filePath = join61(repoRoot, OA_DIR, "context", DESCRIPTOR_FILE);
53055
53176
  try {
53056
- if (!existsSync44(filePath))
53177
+ if (!existsSync45(filePath))
53057
53178
  return null;
53058
- const cached = JSON.parse(readFileSync33(filePath, "utf-8"));
53179
+ const cached = JSON.parse(readFileSync34(filePath, "utf-8"));
53059
53180
  return cached.phrases.length > 0 ? cached.phrases : null;
53060
53181
  } catch {
53061
53182
  return null;
53062
53183
  }
53063
53184
  }
53064
53185
  function saveCachedDescriptors(repoRoot, phrases, sourceHash) {
53065
- const contextDir = join60(repoRoot, OA_DIR, "context");
53066
- mkdirSync19(contextDir, { recursive: true });
53186
+ const contextDir = join61(repoRoot, OA_DIR, "context");
53187
+ mkdirSync20(contextDir, { recursive: true });
53067
53188
  const cached = {
53068
53189
  phrases,
53069
53190
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
53070
53191
  sourceHash
53071
53192
  };
53072
- writeFileSync20(join60(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
53193
+ writeFileSync21(join61(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
53073
53194
  }
53074
53195
  function generateDescriptors(repoRoot) {
53075
53196
  const profile = loadToolProfile(repoRoot);
@@ -53117,11 +53238,11 @@ function generateDescriptors(repoRoot) {
53117
53238
  return phrases;
53118
53239
  }
53119
53240
  function extractFromPackageJson(repoRoot, tags) {
53120
- const pkgPath = join60(repoRoot, "package.json");
53241
+ const pkgPath = join61(repoRoot, "package.json");
53121
53242
  try {
53122
- if (!existsSync44(pkgPath))
53243
+ if (!existsSync45(pkgPath))
53123
53244
  return;
53124
- const pkg = JSON.parse(readFileSync33(pkgPath, "utf-8"));
53245
+ const pkg = JSON.parse(readFileSync34(pkgPath, "utf-8"));
53125
53246
  if (pkg.name && typeof pkg.name === "string") {
53126
53247
  const parts = pkg.name.replace(/^@/, "").split("/");
53127
53248
  for (const p of parts)
@@ -53165,7 +53286,7 @@ function extractFromManifests(repoRoot, tags) {
53165
53286
  { file: ".github/workflows", tag: "ci/cd" }
53166
53287
  ];
53167
53288
  for (const check of manifestChecks) {
53168
- if (existsSync44(join60(repoRoot, check.file))) {
53289
+ if (existsSync45(join61(repoRoot, check.file))) {
53169
53290
  tags.push(check.tag);
53170
53291
  }
53171
53292
  }
@@ -53187,16 +53308,16 @@ function extractFromSessions(repoRoot, tags) {
53187
53308
  }
53188
53309
  }
53189
53310
  function extractFromMemory(repoRoot, tags) {
53190
- const memoryDir = join60(repoRoot, OA_DIR, "memory");
53311
+ const memoryDir = join61(repoRoot, OA_DIR, "memory");
53191
53312
  try {
53192
- if (!existsSync44(memoryDir))
53313
+ if (!existsSync45(memoryDir))
53193
53314
  return;
53194
53315
  const files = readdirSync14(memoryDir).filter((f) => f.endsWith(".json"));
53195
53316
  for (const file of files) {
53196
53317
  const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
53197
53318
  tags.push(topic);
53198
53319
  try {
53199
- const data = JSON.parse(readFileSync33(join60(memoryDir, file), "utf-8"));
53320
+ const data = JSON.parse(readFileSync34(join61(memoryDir, file), "utf-8"));
53200
53321
  if (data && typeof data === "object") {
53201
53322
  const keys = Object.keys(data).slice(0, 3);
53202
53323
  for (const key of keys) {
@@ -53851,13 +53972,13 @@ var init_stream_renderer = __esm({
53851
53972
  });
53852
53973
 
53853
53974
  // packages/cli/dist/tui/edit-history.js
53854
- import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync20 } from "node:fs";
53855
- import { join as join61 } from "node:path";
53975
+ import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync21 } from "node:fs";
53976
+ import { join as join62 } from "node:path";
53856
53977
  function createEditHistoryLogger(repoRoot, sessionId) {
53857
- const historyDir = join61(repoRoot, ".oa", "history");
53858
- const logPath2 = join61(historyDir, "edits.jsonl");
53978
+ const historyDir = join62(repoRoot, ".oa", "history");
53979
+ const logPath2 = join62(historyDir, "edits.jsonl");
53859
53980
  try {
53860
- mkdirSync20(historyDir, { recursive: true });
53981
+ mkdirSync21(historyDir, { recursive: true });
53861
53982
  } catch {
53862
53983
  }
53863
53984
  function logToolCall(toolName, toolArgs, success) {
@@ -53966,17 +54087,17 @@ var init_edit_history = __esm({
53966
54087
  });
53967
54088
 
53968
54089
  // packages/cli/dist/tui/promptLoader.js
53969
- import { readFileSync as readFileSync34, existsSync as existsSync45 } from "node:fs";
53970
- import { join as join62, dirname as dirname19 } from "node:path";
54090
+ import { readFileSync as readFileSync35, existsSync as existsSync46 } from "node:fs";
54091
+ import { join as join63, dirname as dirname19 } from "node:path";
53971
54092
  import { fileURLToPath as fileURLToPath11 } from "node:url";
53972
54093
  function loadPrompt3(promptPath, vars) {
53973
54094
  let content = cache3.get(promptPath);
53974
54095
  if (content === void 0) {
53975
- const fullPath = join62(PROMPTS_DIR3, promptPath);
53976
- if (!existsSync45(fullPath)) {
54096
+ const fullPath = join63(PROMPTS_DIR3, promptPath);
54097
+ if (!existsSync46(fullPath)) {
53977
54098
  throw new Error(`Prompt file not found: ${fullPath}`);
53978
54099
  }
53979
- content = readFileSync34(fullPath, "utf-8");
54100
+ content = readFileSync35(fullPath, "utf-8");
53980
54101
  cache3.set(promptPath, content);
53981
54102
  }
53982
54103
  if (!vars)
@@ -53989,23 +54110,23 @@ var init_promptLoader3 = __esm({
53989
54110
  "use strict";
53990
54111
  __filename3 = fileURLToPath11(import.meta.url);
53991
54112
  __dirname6 = dirname19(__filename3);
53992
- devPath2 = join62(__dirname6, "..", "..", "prompts");
53993
- publishedPath2 = join62(__dirname6, "..", "prompts");
53994
- PROMPTS_DIR3 = existsSync45(devPath2) ? devPath2 : publishedPath2;
54113
+ devPath2 = join63(__dirname6, "..", "..", "prompts");
54114
+ publishedPath2 = join63(__dirname6, "..", "prompts");
54115
+ PROMPTS_DIR3 = existsSync46(devPath2) ? devPath2 : publishedPath2;
53995
54116
  cache3 = /* @__PURE__ */ new Map();
53996
54117
  }
53997
54118
  });
53998
54119
 
53999
54120
  // packages/cli/dist/tui/dream-engine.js
54000
- import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync21, readFileSync as readFileSync35, existsSync as existsSync46, cpSync, rmSync as rmSync2, readdirSync as readdirSync15 } from "node:fs";
54001
- import { join as join63, basename as basename14 } from "node:path";
54121
+ import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync22, readFileSync as readFileSync36, existsSync as existsSync47, cpSync, rmSync as rmSync2, readdirSync as readdirSync15 } from "node:fs";
54122
+ import { join as join64, basename as basename14 } from "node:path";
54002
54123
  import { execSync as execSync31 } from "node:child_process";
54003
54124
  function loadAutoresearchMemory(repoRoot) {
54004
- const memoryPath = join63(repoRoot, ".oa", "memory", "autoresearch.json");
54005
- if (!existsSync46(memoryPath))
54125
+ const memoryPath = join64(repoRoot, ".oa", "memory", "autoresearch.json");
54126
+ if (!existsSync47(memoryPath))
54006
54127
  return "";
54007
54128
  try {
54008
- const raw = readFileSync35(memoryPath, "utf-8");
54129
+ const raw = readFileSync36(memoryPath, "utf-8");
54009
54130
  const data = JSON.parse(raw);
54010
54131
  const sections = [];
54011
54132
  for (const key of AUTORESEARCH_MEMORY_KEYS) {
@@ -54195,14 +54316,14 @@ var init_dream_engine = __esm({
54195
54316
  const content = String(args["content"] ?? "");
54196
54317
  if (!rawPath)
54197
54318
  return { success: false, output: "", error: "path is required", durationMs: Date.now() - start };
54198
- const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join63(this.autoresearchDir, basename14(rawPath)) : join63(this.autoresearchDir, rawPath);
54319
+ const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join64(this.autoresearchDir, basename14(rawPath)) : join64(this.autoresearchDir, rawPath);
54199
54320
  if (!targetPath.startsWith(this.autoresearchDir)) {
54200
54321
  return { success: false, output: "", error: "Autoresearch mode: writes are confined to .oa/autoresearch/", durationMs: Date.now() - start };
54201
54322
  }
54202
54323
  try {
54203
- const dir = join63(targetPath, "..");
54204
- mkdirSync21(dir, { recursive: true });
54205
- writeFileSync21(targetPath, content, "utf-8");
54324
+ const dir = join64(targetPath, "..");
54325
+ mkdirSync22(dir, { recursive: true });
54326
+ writeFileSync22(targetPath, content, "utf-8");
54206
54327
  return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start };
54207
54328
  } catch (err) {
54208
54329
  return { success: false, output: "", error: String(err), durationMs: Date.now() - start };
@@ -54230,20 +54351,20 @@ var init_dream_engine = __esm({
54230
54351
  const rawPath = String(args["path"] ?? "");
54231
54352
  const oldStr = String(args["old_string"] ?? "");
54232
54353
  const newStr = String(args["new_string"] ?? "");
54233
- const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join63(this.autoresearchDir, basename14(rawPath)) : join63(this.autoresearchDir, rawPath);
54354
+ const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join64(this.autoresearchDir, basename14(rawPath)) : join64(this.autoresearchDir, rawPath);
54234
54355
  if (!targetPath.startsWith(this.autoresearchDir)) {
54235
54356
  return { success: false, output: "", error: "Autoresearch mode: edits are confined to .oa/autoresearch/", durationMs: Date.now() - start };
54236
54357
  }
54237
54358
  try {
54238
- if (!existsSync46(targetPath)) {
54359
+ if (!existsSync47(targetPath)) {
54239
54360
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start };
54240
54361
  }
54241
- let content = readFileSync35(targetPath, "utf-8");
54362
+ let content = readFileSync36(targetPath, "utf-8");
54242
54363
  if (!content.includes(oldStr)) {
54243
54364
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start };
54244
54365
  }
54245
54366
  content = content.replace(oldStr, newStr);
54246
- writeFileSync21(targetPath, content, "utf-8");
54367
+ writeFileSync22(targetPath, content, "utf-8");
54247
54368
  return { success: true, output: `Edited ${rawPath}`, durationMs: Date.now() - start };
54248
54369
  } catch (err) {
54249
54370
  return { success: false, output: "", error: String(err), durationMs: Date.now() - start };
@@ -54284,14 +54405,14 @@ var init_dream_engine = __esm({
54284
54405
  const content = String(args["content"] ?? "");
54285
54406
  if (!rawPath)
54286
54407
  return { success: false, output: "", error: "path is required", durationMs: Date.now() - start };
54287
- const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join63(this.dreamsDir, basename14(rawPath)) : join63(this.dreamsDir, rawPath);
54408
+ const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join64(this.dreamsDir, basename14(rawPath)) : join64(this.dreamsDir, rawPath);
54288
54409
  if (!targetPath.startsWith(this.dreamsDir)) {
54289
54410
  return { success: false, output: "", error: "Dream mode: writes are confined to .oa/dreams/", durationMs: Date.now() - start };
54290
54411
  }
54291
54412
  try {
54292
- const dir = join63(targetPath, "..");
54293
- mkdirSync21(dir, { recursive: true });
54294
- writeFileSync21(targetPath, content, "utf-8");
54413
+ const dir = join64(targetPath, "..");
54414
+ mkdirSync22(dir, { recursive: true });
54415
+ writeFileSync22(targetPath, content, "utf-8");
54295
54416
  return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start };
54296
54417
  } catch (err) {
54297
54418
  return { success: false, output: "", error: String(err), durationMs: Date.now() - start };
@@ -54319,20 +54440,20 @@ var init_dream_engine = __esm({
54319
54440
  const rawPath = String(args["path"] ?? "");
54320
54441
  const oldStr = String(args["old_string"] ?? "");
54321
54442
  const newStr = String(args["new_string"] ?? "");
54322
- const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join63(this.dreamsDir, basename14(rawPath)) : join63(this.dreamsDir, rawPath);
54443
+ const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join64(this.dreamsDir, basename14(rawPath)) : join64(this.dreamsDir, rawPath);
54323
54444
  if (!targetPath.startsWith(this.dreamsDir)) {
54324
54445
  return { success: false, output: "", error: "Dream mode: edits are confined to .oa/dreams/", durationMs: Date.now() - start };
54325
54446
  }
54326
54447
  try {
54327
- if (!existsSync46(targetPath)) {
54448
+ if (!existsSync47(targetPath)) {
54328
54449
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start };
54329
54450
  }
54330
- let content = readFileSync35(targetPath, "utf-8");
54451
+ let content = readFileSync36(targetPath, "utf-8");
54331
54452
  if (!content.includes(oldStr)) {
54332
54453
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start };
54333
54454
  }
54334
54455
  content = content.replace(oldStr, newStr);
54335
- writeFileSync21(targetPath, content, "utf-8");
54456
+ writeFileSync22(targetPath, content, "utf-8");
54336
54457
  return { success: true, output: `Edited ${rawPath}`, durationMs: Date.now() - start };
54337
54458
  } catch (err) {
54338
54459
  return { success: false, output: "", error: String(err), durationMs: Date.now() - start };
@@ -54386,7 +54507,7 @@ var init_dream_engine = __esm({
54386
54507
  constructor(config, repoRoot) {
54387
54508
  this.config = config;
54388
54509
  this.repoRoot = repoRoot;
54389
- this.dreamsDir = join63(repoRoot, ".oa", "dreams");
54510
+ this.dreamsDir = join64(repoRoot, ".oa", "dreams");
54390
54511
  this.state = {
54391
54512
  mode: "default",
54392
54513
  active: false,
@@ -54417,7 +54538,7 @@ var init_dream_engine = __esm({
54417
54538
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
54418
54539
  results: []
54419
54540
  };
54420
- mkdirSync21(this.dreamsDir, { recursive: true });
54541
+ mkdirSync22(this.dreamsDir, { recursive: true });
54421
54542
  this.saveDreamState();
54422
54543
  try {
54423
54544
  for (let cycle = 1; cycle <= totalCycles; cycle++) {
@@ -54470,8 +54591,8 @@ ${result.summary}`;
54470
54591
  if (mode !== "default" || cycle === totalCycles) {
54471
54592
  renderDreamContraction(cycle);
54472
54593
  const cycleSummary = this.buildCycleSummary(cycle, previousFindings);
54473
- const summaryPath = join63(this.dreamsDir, `cycle-${cycle}-summary.md`);
54474
- writeFileSync21(summaryPath, cycleSummary, "utf-8");
54594
+ const summaryPath = join64(this.dreamsDir, `cycle-${cycle}-summary.md`);
54595
+ writeFileSync22(summaryPath, cycleSummary, "utf-8");
54475
54596
  }
54476
54597
  if (mode === "lucid" && !this.abortController.signal.aborted) {
54477
54598
  this.saveVersionCheckpoint(cycle);
@@ -54683,7 +54804,7 @@ After synthesis, call task_complete with the final prioritized summary.`, toolMo
54683
54804
  }
54684
54805
  /** Build role-specific tool sets for swarm agents */
54685
54806
  buildSwarmTools(role, _workspace) {
54686
- const autoresearchDir = join63(this.repoRoot, ".oa", "autoresearch");
54807
+ const autoresearchDir = join64(this.repoRoot, ".oa", "autoresearch");
54687
54808
  const taskComplete = this.createSwarmTaskCompleteTool(role);
54688
54809
  switch (role) {
54689
54810
  case "researcher": {
@@ -55047,7 +55168,7 @@ INSTRUCTIONS:
55047
55168
  2. Summarize the key learnings and next steps
55048
55169
 
55049
55170
  Call task_complete with a human-readable summary of the autoresearch session.`, workspace, onEvent);
55050
- const reportPath = join63(this.dreamsDir, `cycle-${cycleNum}-autoresearch-report.md`);
55171
+ const reportPath = join64(this.dreamsDir, `cycle-${cycleNum}-autoresearch-report.md`);
55051
55172
  const report = `# Autoresearch Swarm Report \u2014 Cycle ${cycleNum}
55052
55173
 
55053
55174
  **Date**: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}
@@ -55069,8 +55190,8 @@ ${summaryResult}
55069
55190
  *Generated by open-agents autoresearch swarm*
55070
55191
  `;
55071
55192
  try {
55072
- mkdirSync21(this.dreamsDir, { recursive: true });
55073
- writeFileSync21(reportPath, report, "utf-8");
55193
+ mkdirSync22(this.dreamsDir, { recursive: true });
55194
+ writeFileSync22(reportPath, report, "utf-8");
55074
55195
  } catch {
55075
55196
  }
55076
55197
  renderSwarmComplete(workspace);
@@ -55136,9 +55257,9 @@ ${summaryResult}
55136
55257
  }
55137
55258
  /** Save workspace backup for lucid mode */
55138
55259
  saveVersionCheckpoint(cycle) {
55139
- const checkpointDir = join63(this.dreamsDir, "checkpoints", `cycle-${cycle}`);
55260
+ const checkpointDir = join64(this.dreamsDir, "checkpoints", `cycle-${cycle}`);
55140
55261
  try {
55141
- mkdirSync21(checkpointDir, { recursive: true });
55262
+ mkdirSync22(checkpointDir, { recursive: true });
55142
55263
  try {
55143
55264
  const gitStatus = execSync31("git status --porcelain", {
55144
55265
  cwd: this.repoRoot,
@@ -55155,10 +55276,10 @@ ${summaryResult}
55155
55276
  encoding: "utf-8",
55156
55277
  timeout: 5e3
55157
55278
  }).trim();
55158
- writeFileSync21(join63(checkpointDir, "git-status.txt"), gitStatus, "utf-8");
55159
- writeFileSync21(join63(checkpointDir, "git-diff.patch"), gitDiff, "utf-8");
55160
- writeFileSync21(join63(checkpointDir, "git-hash.txt"), gitHash, "utf-8");
55161
- writeFileSync21(join63(checkpointDir, "checkpoint.json"), JSON.stringify({
55279
+ writeFileSync22(join64(checkpointDir, "git-status.txt"), gitStatus, "utf-8");
55280
+ writeFileSync22(join64(checkpointDir, "git-diff.patch"), gitDiff, "utf-8");
55281
+ writeFileSync22(join64(checkpointDir, "git-hash.txt"), gitHash, "utf-8");
55282
+ writeFileSync22(join64(checkpointDir, "checkpoint.json"), JSON.stringify({
55162
55283
  cycle,
55163
55284
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
55164
55285
  gitHash,
@@ -55166,7 +55287,7 @@ ${summaryResult}
55166
55287
  }, null, 2), "utf-8");
55167
55288
  renderInfo(`Checkpoint saved: cycle ${cycle} (${gitHash.slice(0, 8)})`);
55168
55289
  } catch {
55169
- writeFileSync21(join63(checkpointDir, "checkpoint.json"), JSON.stringify({ cycle, timestamp: (/* @__PURE__ */ new Date()).toISOString(), mode: this.state.mode }, null, 2), "utf-8");
55290
+ writeFileSync22(join64(checkpointDir, "checkpoint.json"), JSON.stringify({ cycle, timestamp: (/* @__PURE__ */ new Date()).toISOString(), mode: this.state.mode }, null, 2), "utf-8");
55170
55291
  renderInfo(`Checkpoint saved: cycle ${cycle} (no git)`);
55171
55292
  }
55172
55293
  } catch (err) {
@@ -55224,14 +55345,14 @@ ${files.map((f) => `- [\`${f}\`](./${f})`).join("\n")}
55224
55345
  ---
55225
55346
  *Auto-generated by open-agents dream engine*
55226
55347
  `;
55227
- writeFileSync21(join63(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
55348
+ writeFileSync22(join64(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
55228
55349
  } catch {
55229
55350
  }
55230
55351
  }
55231
55352
  /** Save dream state for resume/inspection */
55232
55353
  saveDreamState() {
55233
55354
  try {
55234
- writeFileSync21(join63(this.dreamsDir, "dream-state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
55355
+ writeFileSync22(join64(this.dreamsDir, "dream-state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
55235
55356
  } catch {
55236
55357
  }
55237
55358
  }
@@ -55605,8 +55726,8 @@ var init_bless_engine = __esm({
55605
55726
  });
55606
55727
 
55607
55728
  // packages/cli/dist/tui/dmn-engine.js
55608
- import { existsSync as existsSync47, readFileSync as readFileSync36, writeFileSync as writeFileSync22, mkdirSync as mkdirSync22, readdirSync as readdirSync16, unlinkSync as unlinkSync10 } from "node:fs";
55609
- import { join as join64, basename as basename15 } from "node:path";
55729
+ import { existsSync as existsSync48, readFileSync as readFileSync37, writeFileSync as writeFileSync23, mkdirSync as mkdirSync23, readdirSync as readdirSync16, unlinkSync as unlinkSync10 } from "node:fs";
55730
+ import { join as join65, basename as basename15 } from "node:path";
55610
55731
  function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities, competence, reflectionBuffer) {
55611
55732
  const competenceReport = competence.length > 0 ? competence.map((c3) => {
55612
55733
  const rate = c3.attempts > 0 ? Math.round(c3.successes / c3.attempts * 100) : 0;
@@ -55726,9 +55847,9 @@ var init_dmn_engine = __esm({
55726
55847
  constructor(config, repoRoot) {
55727
55848
  this.config = config;
55728
55849
  this.repoRoot = repoRoot;
55729
- this.stateDir = join64(repoRoot, ".oa", "dmn");
55730
- this.historyDir = join64(repoRoot, ".oa", "dmn", "cycles");
55731
- mkdirSync22(this.historyDir, { recursive: true });
55850
+ this.stateDir = join65(repoRoot, ".oa", "dmn");
55851
+ this.historyDir = join65(repoRoot, ".oa", "dmn", "cycles");
55852
+ mkdirSync23(this.historyDir, { recursive: true });
55732
55853
  this.loadState();
55733
55854
  }
55734
55855
  get stats() {
@@ -56317,11 +56438,11 @@ OUTPUT: Call task_complete with JSON:
56317
56438
  async gatherMemoryTopics() {
56318
56439
  const topics = [];
56319
56440
  const dirs = [
56320
- join64(this.repoRoot, ".oa", "memory"),
56321
- join64(this.repoRoot, ".open-agents", "memory")
56441
+ join65(this.repoRoot, ".oa", "memory"),
56442
+ join65(this.repoRoot, ".open-agents", "memory")
56322
56443
  ];
56323
56444
  for (const dir of dirs) {
56324
- if (!existsSync47(dir))
56445
+ if (!existsSync48(dir))
56325
56446
  continue;
56326
56447
  try {
56327
56448
  const files = readdirSync16(dir).filter((f) => f.endsWith(".json"));
@@ -56337,29 +56458,29 @@ OUTPUT: Call task_complete with JSON:
56337
56458
  }
56338
56459
  // ── State persistence ─────────────────────────────────────────────────
56339
56460
  loadState() {
56340
- const path = join64(this.stateDir, "state.json");
56341
- if (existsSync47(path)) {
56461
+ const path = join65(this.stateDir, "state.json");
56462
+ if (existsSync48(path)) {
56342
56463
  try {
56343
- this.state = JSON.parse(readFileSync36(path, "utf-8"));
56464
+ this.state = JSON.parse(readFileSync37(path, "utf-8"));
56344
56465
  } catch {
56345
56466
  }
56346
56467
  }
56347
56468
  }
56348
56469
  saveState() {
56349
56470
  try {
56350
- writeFileSync22(join64(this.stateDir, "state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
56471
+ writeFileSync23(join65(this.stateDir, "state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
56351
56472
  } catch {
56352
56473
  }
56353
56474
  }
56354
56475
  saveCycleResult(result) {
56355
56476
  try {
56356
56477
  const filename = `cycle-${result.cycleNumber}-${Date.now()}.json`;
56357
- writeFileSync22(join64(this.historyDir, filename), JSON.stringify(result, null, 2) + "\n", "utf-8");
56478
+ writeFileSync23(join65(this.historyDir, filename), JSON.stringify(result, null, 2) + "\n", "utf-8");
56358
56479
  const files = readdirSync16(this.historyDir).filter((f) => f.startsWith("cycle-") && f.endsWith(".json")).sort();
56359
56480
  if (files.length > 50) {
56360
56481
  for (const old of files.slice(0, files.length - 50)) {
56361
56482
  try {
56362
- unlinkSync10(join64(this.historyDir, old));
56483
+ unlinkSync10(join65(this.historyDir, old));
56363
56484
  } catch {
56364
56485
  }
56365
56486
  }
@@ -56372,8 +56493,8 @@ OUTPUT: Call task_complete with JSON:
56372
56493
  });
56373
56494
 
56374
56495
  // packages/cli/dist/tui/snr-engine.js
56375
- import { existsSync as existsSync48, readdirSync as readdirSync17, readFileSync as readFileSync37 } from "node:fs";
56376
- import { join as join65, basename as basename16 } from "node:path";
56496
+ import { existsSync as existsSync49, readdirSync as readdirSync17, readFileSync as readFileSync38 } from "node:fs";
56497
+ import { join as join66, basename as basename16 } from "node:path";
56377
56498
  function computeDPrime(signalScores, noiseScores) {
56378
56499
  if (signalScores.length === 0 || noiseScores.length === 0)
56379
56500
  return 0;
@@ -56613,11 +56734,11 @@ Call task_complete with the JSON array when done.`, onEvent)
56613
56734
  loadMemoryEntries(topics) {
56614
56735
  const entries = [];
56615
56736
  const dirs = [
56616
- join65(this.repoRoot, ".oa", "memory"),
56617
- join65(this.repoRoot, ".open-agents", "memory")
56737
+ join66(this.repoRoot, ".oa", "memory"),
56738
+ join66(this.repoRoot, ".open-agents", "memory")
56618
56739
  ];
56619
56740
  for (const dir of dirs) {
56620
- if (!existsSync48(dir))
56741
+ if (!existsSync49(dir))
56621
56742
  continue;
56622
56743
  try {
56623
56744
  const files = readdirSync17(dir).filter((f) => f.endsWith(".json"));
@@ -56626,7 +56747,7 @@ Call task_complete with the JSON array when done.`, onEvent)
56626
56747
  if (topics.length > 0 && !topics.includes(topic))
56627
56748
  continue;
56628
56749
  try {
56629
- const data = JSON.parse(readFileSync37(join65(dir, f), "utf-8"));
56750
+ const data = JSON.parse(readFileSync38(join66(dir, f), "utf-8"));
56630
56751
  for (const [key, val] of Object.entries(data)) {
56631
56752
  const value = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
56632
56753
  entries.push({ topic, key, value });
@@ -57193,8 +57314,8 @@ var init_tool_policy = __esm({
57193
57314
  });
57194
57315
 
57195
57316
  // packages/cli/dist/tui/telegram-bridge.js
57196
- import { mkdirSync as mkdirSync23, existsSync as existsSync49, unlinkSync as unlinkSync11, readdirSync as readdirSync18, statSync as statSync15 } from "node:fs";
57197
- import { join as join66, resolve as resolve30 } from "node:path";
57317
+ import { mkdirSync as mkdirSync24, existsSync as existsSync50, unlinkSync as unlinkSync11, readdirSync as readdirSync18, statSync as statSync15 } from "node:fs";
57318
+ import { join as join67, resolve as resolve30 } from "node:path";
57198
57319
  import { writeFile as writeFileAsync } from "node:fs/promises";
57199
57320
  function convertMarkdownToTelegramHTML(md) {
57200
57321
  let html = md;
@@ -57522,7 +57643,7 @@ with summary "no_reply" to silently skip without responding.
57522
57643
  this.polling = true;
57523
57644
  this.abortController = new AbortController();
57524
57645
  try {
57525
- mkdirSync23(this.mediaCacheDir, { recursive: true });
57646
+ mkdirSync24(this.mediaCacheDir, { recursive: true });
57526
57647
  } catch {
57527
57648
  }
57528
57649
  this.mediaCacheCleanupTimer = setInterval(() => this.cleanupMediaCache(), 5 * 60 * 1e3);
@@ -57959,7 +58080,7 @@ Telegram admin: @${msg.username}` : `Telegram ${isGroup ? "group" : "public"} ch
57959
58080
  return null;
57960
58081
  const buffer = Buffer.from(await res.arrayBuffer());
57961
58082
  const fileName = `${Date.now()}-${fileId.slice(0, 8)}${extension}`;
57962
- const localPath = join66(this.mediaCacheDir, fileName);
58083
+ const localPath = join67(this.mediaCacheDir, fileName);
57963
58084
  await writeFileAsync(localPath, buffer);
57964
58085
  return localPath;
57965
58086
  } catch {
@@ -59315,7 +59436,7 @@ var init_text_selection = __esm({
59315
59436
  });
59316
59437
 
59317
59438
  // packages/cli/dist/tui/status-bar.js
59318
- import { readFileSync as readFileSync38 } from "node:fs";
59439
+ import { readFileSync as readFileSync39 } from "node:fs";
59319
59440
  function setTerminalTitle(task, version) {
59320
59441
  if (!process.stdout.isTTY)
59321
59442
  return;
@@ -59997,7 +60118,7 @@ var init_status_bar = __esm({
59997
60118
  if (nexusDir) {
59998
60119
  try {
59999
60120
  const metricsPath = nexusDir + "/remote-metrics.json";
60000
- const raw = readFileSync38(metricsPath, "utf8");
60121
+ const raw = readFileSync39(metricsPath, "utf8");
60001
60122
  const cached = JSON.parse(raw);
60002
60123
  if (cached && cached.ts && Date.now() - cached.ts < 6e4) {
60003
60124
  const m = cached.data;
@@ -61598,24 +61719,24 @@ var init_mouse_filter = __esm({
61598
61719
  });
61599
61720
 
61600
61721
  // packages/cli/dist/api/profiles.js
61601
- import { existsSync as existsSync50, readFileSync as readFileSync39, writeFileSync as writeFileSync23, mkdirSync as mkdirSync24, readdirSync as readdirSync19, unlinkSync as unlinkSync12 } from "node:fs";
61602
- import { join as join67 } from "node:path";
61722
+ import { existsSync as existsSync51, readFileSync as readFileSync40, writeFileSync as writeFileSync24, mkdirSync as mkdirSync25, readdirSync as readdirSync19, unlinkSync as unlinkSync12 } from "node:fs";
61723
+ import { join as join68 } from "node:path";
61603
61724
  import { homedir as homedir17 } from "node:os";
61604
61725
  import { createCipheriv as createCipheriv3, createDecipheriv as createDecipheriv3, randomBytes as randomBytes15, scryptSync as scryptSync3, createHash as createHash5 } from "node:crypto";
61605
61726
  function globalProfileDir() {
61606
- return join67(homedir17(), ".open-agents", "profiles");
61727
+ return join68(homedir17(), ".open-agents", "profiles");
61607
61728
  }
61608
61729
  function projectProfileDir(projectDir) {
61609
- return join67(projectDir || process.cwd(), ".oa", "profiles");
61730
+ return join68(projectDir || process.cwd(), ".oa", "profiles");
61610
61731
  }
61611
61732
  function listProfiles(projectDir) {
61612
61733
  const result = [];
61613
61734
  const seen = /* @__PURE__ */ new Set();
61614
61735
  const projDir = projectProfileDir(projectDir);
61615
- if (existsSync50(projDir)) {
61736
+ if (existsSync51(projDir)) {
61616
61737
  for (const f of readdirSync19(projDir).filter((f2) => f2.endsWith(".json"))) {
61617
61738
  try {
61618
- const raw = JSON.parse(readFileSync39(join67(projDir, f), "utf8"));
61739
+ const raw = JSON.parse(readFileSync40(join68(projDir, f), "utf8"));
61619
61740
  const name = f.replace(".json", "");
61620
61741
  seen.add(name);
61621
61742
  result.push({
@@ -61629,13 +61750,13 @@ function listProfiles(projectDir) {
61629
61750
  }
61630
61751
  }
61631
61752
  const globDir = globalProfileDir();
61632
- if (existsSync50(globDir)) {
61753
+ if (existsSync51(globDir)) {
61633
61754
  for (const f of readdirSync19(globDir).filter((f2) => f2.endsWith(".json"))) {
61634
61755
  const name = f.replace(".json", "");
61635
61756
  if (seen.has(name))
61636
61757
  continue;
61637
61758
  try {
61638
- const raw = JSON.parse(readFileSync39(join67(globDir, f), "utf8"));
61759
+ const raw = JSON.parse(readFileSync40(join68(globDir, f), "utf8"));
61639
61760
  result.push({
61640
61761
  name,
61641
61762
  description: raw.description || "",
@@ -61650,12 +61771,12 @@ function listProfiles(projectDir) {
61650
61771
  }
61651
61772
  function loadProfile(name, password, projectDir) {
61652
61773
  const sanitized = name.replace(/[^a-zA-Z0-9_-]/g, "");
61653
- const projPath = join67(projectProfileDir(projectDir), `${sanitized}.json`);
61654
- const globPath = join67(globalProfileDir(), `${sanitized}.json`);
61655
- const filePath = existsSync50(projPath) ? projPath : existsSync50(globPath) ? globPath : null;
61774
+ const projPath = join68(projectProfileDir(projectDir), `${sanitized}.json`);
61775
+ const globPath = join68(globalProfileDir(), `${sanitized}.json`);
61776
+ const filePath = existsSync51(projPath) ? projPath : existsSync51(globPath) ? globPath : null;
61656
61777
  if (!filePath)
61657
61778
  return null;
61658
- const raw = JSON.parse(readFileSync39(filePath, "utf8"));
61779
+ const raw = JSON.parse(readFileSync40(filePath, "utf8"));
61659
61780
  if (raw.encrypted === true) {
61660
61781
  if (!password)
61661
61782
  return null;
@@ -61665,23 +61786,23 @@ function loadProfile(name, password, projectDir) {
61665
61786
  }
61666
61787
  function saveProfile(profile, password, scope = "global", projectDir) {
61667
61788
  const dir = scope === "project" ? projectProfileDir(projectDir) : globalProfileDir();
61668
- mkdirSync24(dir, { recursive: true });
61789
+ mkdirSync25(dir, { recursive: true });
61669
61790
  const sanitized = profile.name.replace(/[^a-zA-Z0-9_-]/g, "");
61670
- const filePath = join67(dir, `${sanitized}.json`);
61791
+ const filePath = join68(dir, `${sanitized}.json`);
61671
61792
  profile.modified = (/* @__PURE__ */ new Date()).toISOString();
61672
61793
  if (password) {
61673
61794
  const encrypted = encryptProfile(profile, password);
61674
- writeFileSync23(filePath, JSON.stringify(encrypted, null, 2), { mode: 384 });
61795
+ writeFileSync24(filePath, JSON.stringify(encrypted, null, 2), { mode: 384 });
61675
61796
  } else {
61676
61797
  profile.encrypted = false;
61677
- writeFileSync23(filePath, JSON.stringify(profile, null, 2), { mode: 420 });
61798
+ writeFileSync24(filePath, JSON.stringify(profile, null, 2), { mode: 420 });
61678
61799
  }
61679
61800
  }
61680
61801
  function deleteProfile(name, scope = "global", projectDir) {
61681
61802
  const sanitized = name.replace(/[^a-zA-Z0-9_-]/g, "");
61682
61803
  const dir = scope === "project" ? projectProfileDir(projectDir) : globalProfileDir();
61683
- const filePath = join67(dir, `${sanitized}.json`);
61684
- if (existsSync50(filePath)) {
61804
+ const filePath = join68(dir, `${sanitized}.json`);
61805
+ if (existsSync51(filePath)) {
61685
61806
  unlinkSync12(filePath);
61686
61807
  return true;
61687
61808
  }
@@ -61773,14 +61894,14 @@ __export(serve_exports, {
61773
61894
  import * as http from "node:http";
61774
61895
  import { createRequire as createRequire2 } from "node:module";
61775
61896
  import { fileURLToPath as fileURLToPath12 } from "node:url";
61776
- import { dirname as dirname20, join as join68, resolve as resolve31 } from "node:path";
61897
+ import { dirname as dirname20, join as join69, resolve as resolve31 } from "node:path";
61777
61898
  import { spawn as spawn20 } from "node:child_process";
61778
- import { mkdirSync as mkdirSync25, writeFileSync as writeFileSync24, readFileSync as readFileSync40, readdirSync as readdirSync20, existsSync as existsSync51 } from "node:fs";
61899
+ import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync25, readFileSync as readFileSync41, readdirSync as readdirSync20, existsSync as existsSync52 } from "node:fs";
61779
61900
  import { randomBytes as randomBytes16 } from "node:crypto";
61780
61901
  function getVersion3() {
61781
61902
  try {
61782
61903
  const require2 = createRequire2(import.meta.url);
61783
- const pkgPath = join68(dirname20(fileURLToPath12(import.meta.url)), "..", "..", "package.json");
61904
+ const pkgPath = join69(dirname20(fileURLToPath12(import.meta.url)), "..", "..", "package.json");
61784
61905
  const pkg = require2(pkgPath);
61785
61906
  return pkg.version;
61786
61907
  } catch {
@@ -61916,29 +62037,29 @@ function ollamaStream(ollamaUrl, path, method, body, onData, onEnd, onError) {
61916
62037
  }
61917
62038
  function jobsDir() {
61918
62039
  const root = resolve31(process.cwd());
61919
- const dir = join68(root, ".oa", "jobs");
61920
- mkdirSync25(dir, { recursive: true });
62040
+ const dir = join69(root, ".oa", "jobs");
62041
+ mkdirSync26(dir, { recursive: true });
61921
62042
  return dir;
61922
62043
  }
61923
62044
  function loadJob(id) {
61924
- const file = join68(jobsDir(), `${id}.json`);
61925
- if (!existsSync51(file))
62045
+ const file = join69(jobsDir(), `${id}.json`);
62046
+ if (!existsSync52(file))
61926
62047
  return null;
61927
62048
  try {
61928
- return JSON.parse(readFileSync40(file, "utf-8"));
62049
+ return JSON.parse(readFileSync41(file, "utf-8"));
61929
62050
  } catch {
61930
62051
  return null;
61931
62052
  }
61932
62053
  }
61933
62054
  function listJobs() {
61934
62055
  const dir = jobsDir();
61935
- if (!existsSync51(dir))
62056
+ if (!existsSync52(dir))
61936
62057
  return [];
61937
62058
  const files = readdirSync20(dir).filter((f) => f.endsWith(".json")).sort();
61938
62059
  const jobs = [];
61939
62060
  for (const file of files) {
61940
62061
  try {
61941
- jobs.push(JSON.parse(readFileSync40(join68(dir, file), "utf-8")));
62062
+ jobs.push(JSON.parse(readFileSync41(join69(dir, file), "utf-8")));
61942
62063
  } catch {
61943
62064
  }
61944
62065
  }
@@ -62261,8 +62382,8 @@ async function handleV1Run(req, res) {
62261
62382
  if (workingDir) {
62262
62383
  cwd4 = resolve31(workingDir);
62263
62384
  } else if (isolate) {
62264
- const wsDir = join68(dir, "..", "workspaces", id);
62265
- mkdirSync25(wsDir, { recursive: true });
62385
+ const wsDir = join69(dir, "..", "workspaces", id);
62386
+ mkdirSync26(wsDir, { recursive: true });
62266
62387
  cwd4 = wsDir;
62267
62388
  } else {
62268
62389
  cwd4 = resolve31(process.cwd());
@@ -62334,7 +62455,7 @@ async function handleV1Run(req, res) {
62334
62455
  });
62335
62456
  child.unref();
62336
62457
  job.pid = child.pid ?? 0;
62337
- writeFileSync24(join68(dir, `${id}.json`), JSON.stringify(job, null, 2));
62458
+ writeFileSync25(join69(dir, `${id}.json`), JSON.stringify(job, null, 2));
62338
62459
  runningProcesses.set(id, child);
62339
62460
  if (streamMode) {
62340
62461
  res.writeHead(200, {
@@ -62364,7 +62485,7 @@ async function handleV1Run(req, res) {
62364
62485
  job.status = code === 0 ? "completed" : "failed";
62365
62486
  job.completedAt = (/* @__PURE__ */ new Date()).toISOString();
62366
62487
  try {
62367
- writeFileSync24(join68(dir, `${id}.json`), JSON.stringify(job, null, 2));
62488
+ writeFileSync25(join69(dir, `${id}.json`), JSON.stringify(job, null, 2));
62368
62489
  } catch {
62369
62490
  }
62370
62491
  runningProcesses.delete(id);
@@ -62395,7 +62516,7 @@ async function handleV1Run(req, res) {
62395
62516
  job.completedAt = (/* @__PURE__ */ new Date()).toISOString();
62396
62517
  }
62397
62518
  try {
62398
- writeFileSync24(join68(dir, `${id}.json`), JSON.stringify(job, null, 2));
62519
+ writeFileSync25(join69(dir, `${id}.json`), JSON.stringify(job, null, 2));
62399
62520
  } catch {
62400
62521
  }
62401
62522
  runningProcesses.delete(id);
@@ -62436,7 +62557,7 @@ function handleV1RunsDelete(res, id) {
62436
62557
  job.error = "Aborted via API";
62437
62558
  const dir = jobsDir();
62438
62559
  try {
62439
- writeFileSync24(join68(dir, `${id}.json`), JSON.stringify(job, null, 2));
62560
+ writeFileSync25(join69(dir, `${id}.json`), JSON.stringify(job, null, 2));
62440
62561
  } catch {
62441
62562
  }
62442
62563
  runningProcesses.delete(id);
@@ -62882,11 +63003,11 @@ var init_serve = __esm({
62882
63003
  import * as readline2 from "node:readline";
62883
63004
  import { Writable } from "node:stream";
62884
63005
  import { cwd } from "node:process";
62885
- import { resolve as resolve32, join as join69, dirname as dirname21, extname as extname11 } from "node:path";
63006
+ import { resolve as resolve32, join as join70, dirname as dirname21, extname as extname11 } from "node:path";
62886
63007
  import { createRequire as createRequire3 } from "node:module";
62887
63008
  import { fileURLToPath as fileURLToPath13 } from "node:url";
62888
- import { readFileSync as readFileSync41, writeFileSync as writeFileSync25, appendFileSync as appendFileSync4, rmSync as rmSync3, readdirSync as readdirSync21, mkdirSync as mkdirSync26 } from "node:fs";
62889
- import { existsSync as existsSync52 } from "node:fs";
63009
+ import { readFileSync as readFileSync42, writeFileSync as writeFileSync26, appendFileSync as appendFileSync4, rmSync as rmSync3, readdirSync as readdirSync21, mkdirSync as mkdirSync27 } from "node:fs";
63010
+ import { existsSync as existsSync53 } from "node:fs";
62890
63011
  import { execSync as execSync33 } from "node:child_process";
62891
63012
  import { homedir as homedir18 } from "node:os";
62892
63013
  function formatTimeAgo(date) {
@@ -62907,14 +63028,14 @@ function getVersion4() {
62907
63028
  const require2 = createRequire3(import.meta.url);
62908
63029
  const thisDir = dirname21(fileURLToPath13(import.meta.url));
62909
63030
  const candidates = [
62910
- join69(thisDir, "..", "package.json"),
62911
- join69(thisDir, "..", "..", "package.json"),
62912
- join69(thisDir, "..", "..", "..", "package.json")
63031
+ join70(thisDir, "..", "package.json"),
63032
+ join70(thisDir, "..", "..", "package.json"),
63033
+ join70(thisDir, "..", "..", "..", "package.json")
62913
63034
  ];
62914
63035
  for (const pkgPath of candidates) {
62915
- if (existsSync52(pkgPath)) {
63036
+ if (existsSync53(pkgPath)) {
62916
63037
  const pkg = require2(pkgPath);
62917
- if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli") {
63038
+ if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli" || pkg.name === "@open-agents/monorepo") {
62918
63039
  return pkg.version ?? "0.0.0";
62919
63040
  }
62920
63041
  }
@@ -63147,15 +63268,15 @@ Use task_status("${taskId}") or task_output("${taskId}") to check progress.`
63147
63268
  function gatherMemorySnippets(root) {
63148
63269
  const snippets = [];
63149
63270
  const dirs = [
63150
- join69(root, ".oa", "memory"),
63151
- join69(root, ".open-agents", "memory")
63271
+ join70(root, ".oa", "memory"),
63272
+ join70(root, ".open-agents", "memory")
63152
63273
  ];
63153
63274
  for (const dir of dirs) {
63154
- if (!existsSync52(dir))
63275
+ if (!existsSync53(dir))
63155
63276
  continue;
63156
63277
  try {
63157
63278
  for (const f of readdirSync21(dir).filter((f2) => f2.endsWith(".json"))) {
63158
- const data = JSON.parse(readFileSync41(join69(dir, f), "utf-8"));
63279
+ const data = JSON.parse(readFileSync42(join70(dir, f), "utf-8"));
63159
63280
  for (const val of Object.values(data)) {
63160
63281
  const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
63161
63282
  if (v.length > 10)
@@ -63312,9 +63433,9 @@ ${metabolismMemories}
63312
63433
  } catch {
63313
63434
  }
63314
63435
  try {
63315
- const archeFile = join69(repoRoot, ".oa", "arche", "variants.json");
63316
- if (existsSync52(archeFile)) {
63317
- const variants = JSON.parse(readFileSync41(archeFile, "utf8"));
63436
+ const archeFile = join70(repoRoot, ".oa", "arche", "variants.json");
63437
+ if (existsSync53(archeFile)) {
63438
+ const variants = JSON.parse(readFileSync42(archeFile, "utf8"));
63318
63439
  if (variants.length > 0) {
63319
63440
  let filtered = variants;
63320
63441
  if (taskType) {
@@ -63451,9 +63572,9 @@ ${lines.join("\n")}
63451
63572
  const compactionThreshold = modelTier === "small" ? 12e3 : modelTier === "medium" ? 24e3 : 4e4;
63452
63573
  let identityInjection = "";
63453
63574
  try {
63454
- const ikStateFile = join69(repoRoot, ".oa", "identity", "self-state.json");
63455
- if (existsSync52(ikStateFile)) {
63456
- const selfState = JSON.parse(readFileSync41(ikStateFile, "utf8"));
63575
+ const ikStateFile = join70(repoRoot, ".oa", "identity", "self-state.json");
63576
+ if (existsSync53(ikStateFile)) {
63577
+ const selfState = JSON.parse(readFileSync42(ikStateFile, "utf8"));
63457
63578
  const lines = [
63458
63579
  `[Identity State v${selfState.version}]`,
63459
63580
  `Self: ${selfState.narrative_summary}`,
@@ -64094,13 +64215,13 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
64094
64215
  });
64095
64216
  }
64096
64217
  try {
64097
- const ikDir = join69(repoRoot, ".oa", "identity");
64098
- const ikFile = join69(ikDir, "self-state.json");
64218
+ const ikDir = join70(repoRoot, ".oa", "identity");
64219
+ const ikFile = join70(ikDir, "self-state.json");
64099
64220
  let ikState;
64100
- if (existsSync52(ikFile)) {
64101
- ikState = JSON.parse(readFileSync41(ikFile, "utf8"));
64221
+ if (existsSync53(ikFile)) {
64222
+ ikState = JSON.parse(readFileSync42(ikFile, "utf8"));
64102
64223
  } else {
64103
- mkdirSync26(ikDir, { recursive: true });
64224
+ mkdirSync27(ikDir, { recursive: true });
64104
64225
  const machineId = Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
64105
64226
  ikState = {
64106
64227
  self_id: `oa-${machineId}`,
@@ -64126,7 +64247,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
64126
64247
  }
64127
64248
  ikState.session_count = (ikState.session_count || 0) + 1;
64128
64249
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
64129
- writeFileSync25(ikFile, JSON.stringify(ikState, null, 2));
64250
+ writeFileSync26(ikFile, JSON.stringify(ikState, null, 2));
64130
64251
  } catch (ikErr) {
64131
64252
  try {
64132
64253
  console.error("[IK-OBSERVE]", ikErr);
@@ -64141,14 +64262,14 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
64141
64262
  } else {
64142
64263
  renderTaskIncomplete(result.turns, result.toolCalls, result.durationMs, tokens);
64143
64264
  try {
64144
- const ikFile = join69(repoRoot, ".oa", "identity", "self-state.json");
64145
- if (existsSync52(ikFile)) {
64146
- const ikState = JSON.parse(readFileSync41(ikFile, "utf8"));
64265
+ const ikFile = join70(repoRoot, ".oa", "identity", "self-state.json");
64266
+ if (existsSync53(ikFile)) {
64267
+ const ikState = JSON.parse(readFileSync42(ikFile, "utf8"));
64147
64268
  ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
64148
64269
  ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.05);
64149
64270
  ikState.session_count = (ikState.session_count || 0) + 1;
64150
64271
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
64151
- writeFileSync25(ikFile, JSON.stringify(ikState, null, 2));
64272
+ writeFileSync26(ikFile, JSON.stringify(ikState, null, 2));
64152
64273
  }
64153
64274
  } catch {
64154
64275
  }
@@ -64491,7 +64612,7 @@ Review its full output in the [${id}] tab or via full_sub_agent(action='output',
64491
64612
  let p2pGateway = null;
64492
64613
  let peerMesh = null;
64493
64614
  let inferenceRouter = null;
64494
- const secretVault = new SecretVault(join69(repoRoot, ".oa", "vault.enc"));
64615
+ const secretVault = new SecretVault(join70(repoRoot, ".oa", "vault.enc"));
64495
64616
  let adminSessionKey = null;
64496
64617
  const callSubAgents = /* @__PURE__ */ new Map();
64497
64618
  const streamRenderer = new StreamRenderer();
@@ -64712,13 +64833,13 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
64712
64833
  const hits = allCompletions.filter((c3) => c3.toLowerCase().startsWith(lower));
64713
64834
  return [hits, line];
64714
64835
  }
64715
- const HISTORY_DIR = join69(homedir18(), ".open-agents");
64716
- const HISTORY_FILE = join69(HISTORY_DIR, "repl-history");
64836
+ const HISTORY_DIR = join70(homedir18(), ".open-agents");
64837
+ const HISTORY_FILE = join70(HISTORY_DIR, "repl-history");
64717
64838
  const MAX_HISTORY_LINES = 500;
64718
64839
  let savedHistory = [];
64719
64840
  try {
64720
- if (existsSync52(HISTORY_FILE)) {
64721
- const raw = readFileSync41(HISTORY_FILE, "utf8").trim();
64841
+ if (existsSync53(HISTORY_FILE)) {
64842
+ const raw = readFileSync42(HISTORY_FILE, "utf8").trim();
64722
64843
  if (raw)
64723
64844
  savedHistory = raw.split("\n").reverse();
64724
64845
  }
@@ -64810,12 +64931,12 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
64810
64931
  if (!line.trim())
64811
64932
  return;
64812
64933
  try {
64813
- mkdirSync26(HISTORY_DIR, { recursive: true });
64934
+ mkdirSync27(HISTORY_DIR, { recursive: true });
64814
64935
  appendFileSync4(HISTORY_FILE, line + "\n", "utf8");
64815
64936
  if (Math.random() < 0.02) {
64816
- const all = readFileSync41(HISTORY_FILE, "utf8").trim().split("\n");
64937
+ const all = readFileSync42(HISTORY_FILE, "utf8").trim().split("\n");
64817
64938
  if (all.length > MAX_HISTORY_LINES) {
64818
- writeFileSync25(HISTORY_FILE, all.slice(-MAX_HISTORY_LINES).join("\n") + "\n", "utf8");
64939
+ writeFileSync26(HISTORY_FILE, all.slice(-MAX_HISTORY_LINES).join("\n") + "\n", "utf8");
64819
64940
  }
64820
64941
  }
64821
64942
  } catch {
@@ -64991,7 +65112,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
64991
65112
  } catch {
64992
65113
  }
64993
65114
  try {
64994
- const oaDir = join69(repoRoot, ".oa");
65115
+ const oaDir = join70(repoRoot, ".oa");
64995
65116
  const reconnected = await ExposeGateway.checkAndReconnect(oaDir, {
64996
65117
  onInfo: (msg) => writeContent(() => renderInfo(msg)),
64997
65118
  onError: (msg) => writeContent(() => renderWarning(msg))
@@ -65023,7 +65144,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
65023
65144
  } catch {
65024
65145
  }
65025
65146
  try {
65026
- const oaDir = join69(repoRoot, ".oa");
65147
+ const oaDir = join70(repoRoot, ".oa");
65027
65148
  const reconnectedP2P = await ExposeP2PGateway.checkAndReconnect(oaDir, new NexusTool(repoRoot), {
65028
65149
  onInfo: (msg) => writeContent(() => renderInfo(msg)),
65029
65150
  onError: (msg) => writeContent(() => renderWarning(msg))
@@ -65063,19 +65184,23 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
65063
65184
  } catch {
65064
65185
  }
65065
65186
  try {
65066
- const { homedir: _hd } = await import("node:os");
65067
- const globalNamePath = join69(_hd(), ".open-agents", "agent-name");
65068
- let agName = "oa-node";
65187
+ const { homedir: _hd, hostname: _hn, userInfo: _ui } = await import("node:os");
65188
+ const globalNamePath = join70(_hd(), ".open-agents", "agent-name");
65189
+ let agName = "";
65069
65190
  try {
65070
- if (existsSync52(globalNamePath))
65071
- agName = readFileSync41(globalNamePath, "utf8").trim() || agName;
65191
+ if (existsSync53(globalNamePath))
65192
+ agName = readFileSync42(globalNamePath, "utf8").trim();
65072
65193
  } catch {
65073
65194
  }
65195
+ if (!agName) {
65196
+ const { getNodeMnemonic: getNodeMnemonic2 } = await Promise.resolve().then(() => (init_banner(), banner_exports));
65197
+ agName = getNodeMnemonic2();
65198
+ }
65074
65199
  fetch("https://openagents.nexus/api/v1/directory", {
65075
65200
  method: "POST",
65076
65201
  headers: { "Content-Type": "application/json" },
65077
65202
  body: JSON.stringify({
65078
- peerId: agName + "-" + Date.now(),
65203
+ peerId: agName,
65079
65204
  agentName: agName,
65080
65205
  multiaddrs: [],
65081
65206
  rooms: []
@@ -65974,7 +66099,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
65974
66099
  kind,
65975
66100
  targetUrl,
65976
66101
  authKey,
65977
- stateDir: join69(repoRoot, ".oa"),
66102
+ stateDir: join70(repoRoot, ".oa"),
65978
66103
  passthrough: passthrough ?? false,
65979
66104
  loadbalance: loadbalance ?? false,
65980
66105
  endpointAuth: passthrough ? currentConfig.apiKey : void 0,
@@ -66022,7 +66147,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
66022
66147
  await tunnelGateway.stop();
66023
66148
  tunnelGateway = null;
66024
66149
  }
66025
- const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir: join69(repoRoot, ".oa") });
66150
+ const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir: join70(repoRoot, ".oa") });
66026
66151
  newTunnel.on("stats", (stats) => {
66027
66152
  statusBar.setExposeStatus({
66028
66153
  status: stats.status,
@@ -66294,10 +66419,10 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
66294
66419
  writeContent(() => renderInfo(`Killed ${bgKilled} background task(s).`));
66295
66420
  }
66296
66421
  try {
66297
- const nexusDir = join69(repoRoot, OA_DIR, "nexus");
66298
- const pidFile = join69(nexusDir, "daemon.pid");
66299
- if (existsSync52(pidFile)) {
66300
- const pid = parseInt(readFileSync41(pidFile, "utf8").trim(), 10);
66422
+ const nexusDir = join70(repoRoot, OA_DIR, "nexus");
66423
+ const pidFile = join70(nexusDir, "daemon.pid");
66424
+ if (existsSync53(pidFile)) {
66425
+ const pid = parseInt(readFileSync42(pidFile, "utf8").trim(), 10);
66301
66426
  if (pid > 0) {
66302
66427
  try {
66303
66428
  if (process.platform === "win32") {
@@ -66319,13 +66444,13 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
66319
66444
  } catch {
66320
66445
  }
66321
66446
  try {
66322
- const voiceDir2 = join69(homedir18(), ".open-agents", "voice");
66447
+ const voiceDir2 = join70(homedir18(), ".open-agents", "voice");
66323
66448
  const voicePidFiles = ["luxtts-daemon.pid", "piper-daemon.pid"];
66324
66449
  for (const pf of voicePidFiles) {
66325
- const pidPath = join69(voiceDir2, pf);
66326
- if (existsSync52(pidPath)) {
66450
+ const pidPath = join70(voiceDir2, pf);
66451
+ if (existsSync53(pidPath)) {
66327
66452
  try {
66328
- const pid = parseInt(readFileSync41(pidPath, "utf8").trim(), 10);
66453
+ const pid = parseInt(readFileSync42(pidPath, "utf8").trim(), 10);
66329
66454
  if (pid > 0) {
66330
66455
  if (process.platform === "win32") {
66331
66456
  try {
@@ -66349,8 +66474,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
66349
66474
  execSync33(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.5", { timeout: 3e3, stdio: "ignore" });
66350
66475
  } catch {
66351
66476
  }
66352
- const oaPath = join69(repoRoot, OA_DIR);
66353
- if (existsSync52(oaPath)) {
66477
+ const oaPath = join70(repoRoot, OA_DIR);
66478
+ if (existsSync53(oaPath)) {
66354
66479
  let deleted = false;
66355
66480
  for (let attempt = 0; attempt < 3; attempt++) {
66356
66481
  try {
@@ -66736,8 +66861,8 @@ Execute this skill now. Follow the behavioral guidance above.`;
66736
66861
  }
66737
66862
  }
66738
66863
  const cleanPath = input.replace(/^['"]|['"]$/g, "").trim();
66739
- const isImage = isImagePath(cleanPath) && existsSync52(resolve32(repoRoot, cleanPath));
66740
- const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync52(resolve32(repoRoot, cleanPath));
66864
+ const isImage = isImagePath(cleanPath) && existsSync53(resolve32(repoRoot, cleanPath));
66865
+ const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync53(resolve32(repoRoot, cleanPath));
66741
66866
  if (activeTask) {
66742
66867
  if (activeTask.runner.isPaused) {
66743
66868
  activeTask.runner.resume();
@@ -66746,7 +66871,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
66746
66871
  if (isImage) {
66747
66872
  try {
66748
66873
  const imgPath = resolve32(repoRoot, cleanPath);
66749
- const imgBuffer = readFileSync41(imgPath);
66874
+ const imgBuffer = readFileSync42(imgPath);
66750
66875
  const base64 = imgBuffer.toString("base64");
66751
66876
  const ext = extname11(cleanPath).toLowerCase();
66752
66877
  const mime = ext === ".png" ? "image/png" : ext === ".gif" ? "image/gif" : ext === ".webp" ? "image/webp" : "image/jpeg";
@@ -67245,13 +67370,13 @@ async function runWithTUI(task, config, repoPath) {
67245
67370
  const handle = startTask(task, config, repoRoot);
67246
67371
  await handle.promise;
67247
67372
  try {
67248
- const ikDir = join69(repoRoot, ".oa", "identity");
67249
- const ikFile = join69(ikDir, "self-state.json");
67373
+ const ikDir = join70(repoRoot, ".oa", "identity");
67374
+ const ikFile = join70(ikDir, "self-state.json");
67250
67375
  let ikState;
67251
- if (existsSync52(ikFile)) {
67252
- ikState = JSON.parse(readFileSync41(ikFile, "utf8"));
67376
+ if (existsSync53(ikFile)) {
67377
+ ikState = JSON.parse(readFileSync42(ikFile, "utf8"));
67253
67378
  } else {
67254
- mkdirSync26(ikDir, { recursive: true });
67379
+ mkdirSync27(ikDir, { recursive: true });
67255
67380
  ikState = {
67256
67381
  self_id: `oa-${Date.now().toString(36)}`,
67257
67382
  version: 1,
@@ -67273,7 +67398,7 @@ async function runWithTUI(task, config, repoPath) {
67273
67398
  ikState.homeostasis.coherence = Math.min(1, ikState.homeostasis.coherence + 0.05);
67274
67399
  ikState.session_count = (ikState.session_count || 0) + 1;
67275
67400
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
67276
- writeFileSync25(ikFile, JSON.stringify(ikState, null, 2));
67401
+ writeFileSync26(ikFile, JSON.stringify(ikState, null, 2));
67277
67402
  } catch (ikErr) {
67278
67403
  }
67279
67404
  try {
@@ -67282,12 +67407,12 @@ async function runWithTUI(task, config, repoPath) {
67282
67407
  ec.archiveVariantSync(`Task: ${task.slice(0, 200)}`, "success \u2014 completed", ["general"]);
67283
67408
  } catch {
67284
67409
  try {
67285
- const archeDir = join69(repoRoot, ".oa", "arche");
67286
- const archeFile = join69(archeDir, "variants.json");
67410
+ const archeDir = join70(repoRoot, ".oa", "arche");
67411
+ const archeFile = join70(archeDir, "variants.json");
67287
67412
  let variants = [];
67288
67413
  try {
67289
- if (existsSync52(archeFile))
67290
- variants = JSON.parse(readFileSync41(archeFile, "utf8"));
67414
+ if (existsSync53(archeFile))
67415
+ variants = JSON.parse(readFileSync42(archeFile, "utf8"));
67291
67416
  } catch {
67292
67417
  }
67293
67418
  variants.push({
@@ -67302,15 +67427,15 @@ async function runWithTUI(task, config, repoPath) {
67302
67427
  });
67303
67428
  if (variants.length > 50)
67304
67429
  variants = variants.slice(-50);
67305
- mkdirSync26(archeDir, { recursive: true });
67306
- writeFileSync25(archeFile, JSON.stringify(variants, null, 2));
67430
+ mkdirSync27(archeDir, { recursive: true });
67431
+ writeFileSync26(archeFile, JSON.stringify(variants, null, 2));
67307
67432
  } catch {
67308
67433
  }
67309
67434
  }
67310
67435
  try {
67311
- const metaFile = join69(repoRoot, ".oa", "memory", "metabolism", "store.json");
67312
- if (existsSync52(metaFile)) {
67313
- const store = JSON.parse(readFileSync41(metaFile, "utf8"));
67436
+ const metaFile = join70(repoRoot, ".oa", "memory", "metabolism", "store.json");
67437
+ if (existsSync53(metaFile)) {
67438
+ const store = JSON.parse(readFileSync42(metaFile, "utf8"));
67314
67439
  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);
67315
67440
  let updated = false;
67316
67441
  for (const item of surfaced) {
@@ -67321,7 +67446,7 @@ async function runWithTUI(task, config, repoPath) {
67321
67446
  updated = true;
67322
67447
  }
67323
67448
  if (updated) {
67324
- writeFileSync25(metaFile, JSON.stringify(store, null, 2));
67449
+ writeFileSync26(metaFile, JSON.stringify(store, null, 2));
67325
67450
  }
67326
67451
  }
67327
67452
  } catch {
@@ -67374,9 +67499,9 @@ Rules:
67374
67499
  try {
67375
67500
  const { initDb: initDb2 } = __require("@open-agents/memory");
67376
67501
  const { ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
67377
- const dbDir = join69(repoRoot, ".oa", "memory");
67378
- mkdirSync26(dbDir, { recursive: true });
67379
- const db = initDb2(join69(dbDir, "structured.db"));
67502
+ const dbDir = join70(repoRoot, ".oa", "memory");
67503
+ mkdirSync27(dbDir, { recursive: true });
67504
+ const db = initDb2(join70(dbDir, "structured.db"));
67380
67505
  const memStore = new ProceduralMemoryStore2(db);
67381
67506
  memStore.createWithEmbedding({
67382
67507
  content: content.slice(0, 600),
@@ -67391,12 +67516,12 @@ Rules:
67391
67516
  db.close();
67392
67517
  } catch {
67393
67518
  }
67394
- const metaDir = join69(repoRoot, ".oa", "memory", "metabolism");
67395
- const storeFile = join69(metaDir, "store.json");
67519
+ const metaDir = join70(repoRoot, ".oa", "memory", "metabolism");
67520
+ const storeFile = join70(metaDir, "store.json");
67396
67521
  let store = [];
67397
67522
  try {
67398
- if (existsSync52(storeFile))
67399
- store = JSON.parse(readFileSync41(storeFile, "utf8"));
67523
+ if (existsSync53(storeFile))
67524
+ store = JSON.parse(readFileSync42(storeFile, "utf8"));
67400
67525
  } catch {
67401
67526
  }
67402
67527
  store.push({
@@ -67412,26 +67537,26 @@ Rules:
67412
67537
  });
67413
67538
  if (store.length > 100)
67414
67539
  store = store.slice(-100);
67415
- mkdirSync26(metaDir, { recursive: true });
67416
- writeFileSync25(storeFile, JSON.stringify(store, null, 2));
67540
+ mkdirSync27(metaDir, { recursive: true });
67541
+ writeFileSync26(storeFile, JSON.stringify(store, null, 2));
67417
67542
  }
67418
67543
  }
67419
67544
  } catch {
67420
67545
  }
67421
67546
  try {
67422
- const cohereSettingsFile = join69(repoRoot, ".oa", "settings.json");
67547
+ const cohereSettingsFile = join70(repoRoot, ".oa", "settings.json");
67423
67548
  let cohereActive = false;
67424
67549
  try {
67425
- if (existsSync52(cohereSettingsFile)) {
67426
- const settings = JSON.parse(readFileSync41(cohereSettingsFile, "utf8"));
67550
+ if (existsSync53(cohereSettingsFile)) {
67551
+ const settings = JSON.parse(readFileSync42(cohereSettingsFile, "utf8"));
67427
67552
  cohereActive = settings.cohere === true;
67428
67553
  }
67429
67554
  } catch {
67430
67555
  }
67431
67556
  if (cohereActive) {
67432
- const metaFile = join69(repoRoot, ".oa", "memory", "metabolism", "store.json");
67433
- if (existsSync52(metaFile)) {
67434
- const store = JSON.parse(readFileSync41(metaFile, "utf8"));
67557
+ const metaFile = join70(repoRoot, ".oa", "memory", "metabolism", "store.json");
67558
+ if (existsSync53(metaFile)) {
67559
+ const store = JSON.parse(readFileSync42(metaFile, "utf8"));
67435
67560
  const latest = store.filter((m) => m.sourceTrace === "trajectory-extraction" || m.sourceTrace === "llm-trajectory-extraction").slice(-1)[0];
67436
67561
  if (latest && latest.scores?.confidence >= 0.6) {
67437
67562
  try {
@@ -67456,18 +67581,18 @@ Rules:
67456
67581
  }
67457
67582
  } catch (err) {
67458
67583
  try {
67459
- const ikFile = join69(repoRoot, ".oa", "identity", "self-state.json");
67460
- if (existsSync52(ikFile)) {
67461
- const ikState = JSON.parse(readFileSync41(ikFile, "utf8"));
67584
+ const ikFile = join70(repoRoot, ".oa", "identity", "self-state.json");
67585
+ if (existsSync53(ikFile)) {
67586
+ const ikState = JSON.parse(readFileSync42(ikFile, "utf8"));
67462
67587
  ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
67463
67588
  ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.05);
67464
67589
  ikState.session_count = (ikState.session_count || 0) + 1;
67465
67590
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
67466
- writeFileSync25(ikFile, JSON.stringify(ikState, null, 2));
67591
+ writeFileSync26(ikFile, JSON.stringify(ikState, null, 2));
67467
67592
  }
67468
- const metaFile = join69(repoRoot, ".oa", "memory", "metabolism", "store.json");
67469
- if (existsSync52(metaFile)) {
67470
- const store = JSON.parse(readFileSync41(metaFile, "utf8"));
67593
+ const metaFile = join70(repoRoot, ".oa", "memory", "metabolism", "store.json");
67594
+ if (existsSync53(metaFile)) {
67595
+ const store = JSON.parse(readFileSync42(metaFile, "utf8"));
67471
67596
  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);
67472
67597
  for (const item of surfaced) {
67473
67598
  item.accessCount = (item.accessCount || 0) + 1;
@@ -67475,15 +67600,15 @@ Rules:
67475
67600
  item.scores.utility = Math.max(0, (item.scores.utility || 0.5) - 0.05);
67476
67601
  item.scores.confidence = Math.max(0, (item.scores.confidence || 0.5) - 0.02);
67477
67602
  }
67478
- writeFileSync25(metaFile, JSON.stringify(store, null, 2));
67603
+ writeFileSync26(metaFile, JSON.stringify(store, null, 2));
67479
67604
  }
67480
67605
  try {
67481
- const archeDir = join69(repoRoot, ".oa", "arche");
67482
- const archeFile = join69(archeDir, "variants.json");
67606
+ const archeDir = join70(repoRoot, ".oa", "arche");
67607
+ const archeFile = join70(archeDir, "variants.json");
67483
67608
  let variants = [];
67484
67609
  try {
67485
- if (existsSync52(archeFile))
67486
- variants = JSON.parse(readFileSync41(archeFile, "utf8"));
67610
+ if (existsSync53(archeFile))
67611
+ variants = JSON.parse(readFileSync42(archeFile, "utf8"));
67487
67612
  } catch {
67488
67613
  }
67489
67614
  variants.push({
@@ -67498,8 +67623,8 @@ Rules:
67498
67623
  });
67499
67624
  if (variants.length > 50)
67500
67625
  variants = variants.slice(-50);
67501
- mkdirSync26(archeDir, { recursive: true });
67502
- writeFileSync25(archeFile, JSON.stringify(variants, null, 2));
67626
+ mkdirSync27(archeDir, { recursive: true });
67627
+ writeFileSync26(archeFile, JSON.stringify(variants, null, 2));
67503
67628
  } catch {
67504
67629
  }
67505
67630
  } catch {
@@ -67566,13 +67691,13 @@ __export(run_exports, {
67566
67691
  });
67567
67692
  import { resolve as resolve33 } from "node:path";
67568
67693
  import { spawn as spawn21 } from "node:child_process";
67569
- import { mkdirSync as mkdirSync27, writeFileSync as writeFileSync26, readFileSync as readFileSync42, readdirSync as readdirSync22, existsSync as existsSync53 } from "node:fs";
67694
+ import { mkdirSync as mkdirSync28, writeFileSync as writeFileSync27, readFileSync as readFileSync43, readdirSync as readdirSync22, existsSync as existsSync54 } from "node:fs";
67570
67695
  import { randomBytes as randomBytes17 } from "node:crypto";
67571
- import { join as join70 } from "node:path";
67696
+ import { join as join71 } from "node:path";
67572
67697
  function jobsDir2(repoPath) {
67573
67698
  const root = resolve33(repoPath ?? process.cwd());
67574
- const dir = join70(root, ".oa", "jobs");
67575
- mkdirSync27(dir, { recursive: true });
67699
+ const dir = join71(root, ".oa", "jobs");
67700
+ mkdirSync28(dir, { recursive: true });
67576
67701
  return dir;
67577
67702
  }
67578
67703
  async function runCommand(opts, config) {
@@ -67657,7 +67782,7 @@ async function runBackground(task, config, opts) {
67657
67782
  });
67658
67783
  child.unref();
67659
67784
  job.pid = child.pid ?? 0;
67660
- writeFileSync26(join70(dir, `${id}.json`), JSON.stringify(job, null, 2));
67785
+ writeFileSync27(join71(dir, `${id}.json`), JSON.stringify(job, null, 2));
67661
67786
  let output = "";
67662
67787
  child.stdout?.on("data", (chunk) => {
67663
67788
  output += chunk.toString();
@@ -67673,7 +67798,7 @@ async function runBackground(task, config, opts) {
67673
67798
  job.summary = result.summary;
67674
67799
  job.durationMs = result.durationMs;
67675
67800
  job.error = result.error;
67676
- writeFileSync26(join70(dir, `${id}.json`), JSON.stringify(job, null, 2));
67801
+ writeFileSync27(join71(dir, `${id}.json`), JSON.stringify(job, null, 2));
67677
67802
  } catch {
67678
67803
  }
67679
67804
  });
@@ -67689,13 +67814,13 @@ async function runBackground(task, config, opts) {
67689
67814
  }
67690
67815
  function statusCommand(jobId, repoPath) {
67691
67816
  const dir = jobsDir2(repoPath);
67692
- const file = join70(dir, `${jobId}.json`);
67693
- if (!existsSync53(file)) {
67817
+ const file = join71(dir, `${jobId}.json`);
67818
+ if (!existsSync54(file)) {
67694
67819
  console.error(`Job not found: ${jobId}`);
67695
67820
  console.log(`Available jobs: oa jobs`);
67696
67821
  process.exit(1);
67697
67822
  }
67698
- const job = JSON.parse(readFileSync42(file, "utf-8"));
67823
+ const job = JSON.parse(readFileSync43(file, "utf-8"));
67699
67824
  const runtime = job.completedAt ? `${((new Date(job.completedAt).getTime() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s` : `${((Date.now() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s`;
67700
67825
  const icon = job.status === "completed" ? "\u2713" : job.status === "failed" ? "\u2717" : "\u25CF";
67701
67826
  console.log(`${icon} ${job.id} [${job.status}] ${runtime}`);
@@ -67718,7 +67843,7 @@ function jobsCommand(repoPath) {
67718
67843
  console.log("Jobs:");
67719
67844
  for (const file of files) {
67720
67845
  try {
67721
- const job = JSON.parse(readFileSync42(join70(dir, file), "utf-8"));
67846
+ const job = JSON.parse(readFileSync43(join71(dir, file), "utf-8"));
67722
67847
  const icon = job.status === "completed" ? "\u2713" : job.status === "failed" ? "\u2717" : "\u25CF";
67723
67848
  const runtime = job.completedAt ? `${((new Date(job.completedAt).getTime() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s` : `${((Date.now() - new Date(job.startedAt).getTime()) / 1e3).toFixed(0)}s`;
67724
67849
  console.log(` ${icon} ${job.id} [${job.status}] ${runtime} \u2014 ${job.task.slice(0, 60)}`);
@@ -67738,7 +67863,7 @@ import { glob } from "glob";
67738
67863
  import ignore from "ignore";
67739
67864
  import { readFile as readFile23, stat as stat4 } from "node:fs/promises";
67740
67865
  import { createHash as createHash6 } from "node:crypto";
67741
- import { join as join71, relative as relative4, extname as extname12, basename as basename17 } from "node:path";
67866
+ import { join as join72, relative as relative4, extname as extname12, basename as basename17 } from "node:path";
67742
67867
  var DEFAULT_EXCLUDE, LANGUAGE_MAP, CodebaseIndexer;
67743
67868
  var init_codebase_indexer = __esm({
67744
67869
  "packages/indexer/dist/codebase-indexer.js"() {
@@ -67782,7 +67907,7 @@ var init_codebase_indexer = __esm({
67782
67907
  const ig = ignore.default();
67783
67908
  if (this.config.respectGitignore) {
67784
67909
  try {
67785
- const gitignoreContent = await readFile23(join71(this.config.rootDir, ".gitignore"), "utf-8");
67910
+ const gitignoreContent = await readFile23(join72(this.config.rootDir, ".gitignore"), "utf-8");
67786
67911
  ig.add(gitignoreContent);
67787
67912
  } catch {
67788
67913
  }
@@ -67797,7 +67922,7 @@ var init_codebase_indexer = __esm({
67797
67922
  for (const relativePath of files) {
67798
67923
  if (ig.ignores(relativePath))
67799
67924
  continue;
67800
- const fullPath = join71(this.config.rootDir, relativePath);
67925
+ const fullPath = join72(this.config.rootDir, relativePath);
67801
67926
  try {
67802
67927
  const fileStat = await stat4(fullPath);
67803
67928
  if (fileStat.size > this.config.maxFileSize)
@@ -67843,7 +67968,7 @@ var init_codebase_indexer = __esm({
67843
67968
  if (!child) {
67844
67969
  child = {
67845
67970
  name: part,
67846
- path: join71(current.path, part),
67971
+ path: join72(current.path, part),
67847
67972
  type: "directory",
67848
67973
  children: []
67849
67974
  };
@@ -67926,13 +68051,13 @@ __export(index_repo_exports, {
67926
68051
  indexRepoCommand: () => indexRepoCommand
67927
68052
  });
67928
68053
  import { resolve as resolve34 } from "node:path";
67929
- import { existsSync as existsSync54, statSync as statSync16 } from "node:fs";
68054
+ import { existsSync as existsSync55, statSync as statSync16 } from "node:fs";
67930
68055
  import { cwd as cwd2 } from "node:process";
67931
68056
  async function indexRepoCommand(opts, _config) {
67932
68057
  const repoRoot = resolve34(opts.repoPath ?? cwd2());
67933
68058
  printHeader("Index Repository");
67934
68059
  printInfo(`Indexing: ${repoRoot}`);
67935
- if (!existsSync54(repoRoot)) {
68060
+ if (!existsSync55(repoRoot)) {
67936
68061
  printError(`Path does not exist: ${repoRoot}`);
67937
68062
  process.exit(1);
67938
68063
  }
@@ -68184,7 +68309,7 @@ var config_exports = {};
68184
68309
  __export(config_exports, {
68185
68310
  configCommand: () => configCommand
68186
68311
  });
68187
- import { join as join72, resolve as resolve35 } from "node:path";
68312
+ import { join as join73, resolve as resolve35 } from "node:path";
68188
68313
  import { homedir as homedir19 } from "node:os";
68189
68314
  import { cwd as cwd3 } from "node:process";
68190
68315
  function redactIfSensitive(key, value) {
@@ -68267,7 +68392,7 @@ function handleShow(opts, config) {
68267
68392
  }
68268
68393
  }
68269
68394
  printSection("Config File");
68270
- printInfo(`~/.open-agents/config.json (${join72(homedir19(), ".open-agents", "config.json")})`);
68395
+ printInfo(`~/.open-agents/config.json (${join73(homedir19(), ".open-agents", "config.json")})`);
68271
68396
  printSection("Priority Chain");
68272
68397
  printInfo(" 1. CLI flags (--model, --backend-url, etc.)");
68273
68398
  printInfo(" 2. Project .oa/settings.json (--local)");
@@ -68306,7 +68431,7 @@ function handleSet(opts, _config) {
68306
68431
  const coerced = coerceForSettings(key, value);
68307
68432
  saveProjectSettings(repoRoot, { [key]: coerced });
68308
68433
  printSuccess(`Project override set: ${key} = ${redactIfSensitive(key, value)}`);
68309
- printInfo(`Saved to ${join72(repoRoot, ".oa", "settings.json")}`);
68434
+ printInfo(`Saved to ${join73(repoRoot, ".oa", "settings.json")}`);
68310
68435
  printInfo("This override applies only when running in this workspace.");
68311
68436
  } catch (err) {
68312
68437
  printError(`Failed to save: ${err instanceof Error ? err.message : String(err)}`);
@@ -68449,8 +68574,8 @@ __export(eval_exports, {
68449
68574
  evalCommand: () => evalCommand
68450
68575
  });
68451
68576
  import { tmpdir as tmpdir10 } from "node:os";
68452
- import { mkdirSync as mkdirSync28, writeFileSync as writeFileSync27 } from "node:fs";
68453
- import { join as join73 } from "node:path";
68577
+ import { mkdirSync as mkdirSync29, writeFileSync as writeFileSync28 } from "node:fs";
68578
+ import { join as join74 } from "node:path";
68454
68579
  async function evalCommand(opts, config) {
68455
68580
  const suiteName = opts.suite ?? "basic";
68456
68581
  const suite = SUITES[suiteName];
@@ -68575,9 +68700,9 @@ async function evalCommand(opts, config) {
68575
68700
  process.exit(failed > 0 ? 1 : 0);
68576
68701
  }
68577
68702
  function createTempEvalRepo() {
68578
- const dir = join73(tmpdir10(), `open-agents-eval-${Date.now()}`);
68579
- mkdirSync28(dir, { recursive: true });
68580
- writeFileSync27(join73(dir, "package.json"), JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n", "utf8");
68703
+ const dir = join74(tmpdir10(), `open-agents-eval-${Date.now()}`);
68704
+ mkdirSync29(dir, { recursive: true });
68705
+ writeFileSync28(join74(dir, "package.json"), JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n", "utf8");
68581
68706
  return dir;
68582
68707
  }
68583
68708
  var BASIC_SUITE, FULL_SUITE, SUITES;
@@ -68637,7 +68762,7 @@ init_updater();
68637
68762
  import { parseArgs as nodeParseArgs2 } from "node:util";
68638
68763
  import { createRequire as createRequire4 } from "node:module";
68639
68764
  import { fileURLToPath as fileURLToPath14 } from "node:url";
68640
- import { dirname as dirname22, join as join74 } from "node:path";
68765
+ import { dirname as dirname22, join as join75 } from "node:path";
68641
68766
 
68642
68767
  // packages/cli/dist/cli.js
68643
68768
  import { createInterface } from "node:readline";
@@ -68744,7 +68869,7 @@ init_output();
68744
68869
  function getVersion5() {
68745
68870
  try {
68746
68871
  const require2 = createRequire4(import.meta.url);
68747
- const pkgPath = join74(dirname22(fileURLToPath14(import.meta.url)), "..", "package.json");
68872
+ const pkgPath = join75(dirname22(fileURLToPath14(import.meta.url)), "..", "package.json");
68748
68873
  const pkg = require2(pkgPath);
68749
68874
  return pkg.version;
68750
68875
  } catch {