open-agents-ai 0.140.3 → 0.141.0

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 +961 -551
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -12657,11 +12657,11 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
12657
12657
  * what was previously computed. */
12658
12658
  async loadSessionInfo() {
12659
12659
  try {
12660
- const { readFileSync: readFileSync34, existsSync: existsSync46 } = await import("node:fs");
12660
+ const { readFileSync: readFileSync35, existsSync: existsSync47 } = await import("node:fs");
12661
12661
  const sessionPath = join20(this.cwd, ".oa", "rlm", "session.json");
12662
- if (!existsSync46(sessionPath))
12662
+ if (!existsSync47(sessionPath))
12663
12663
  return null;
12664
- return JSON.parse(readFileSync34(sessionPath, "utf8"));
12664
+ return JSON.parse(readFileSync35(sessionPath, "utf8"));
12665
12665
  } catch {
12666
12666
  return null;
12667
12667
  }
@@ -12838,10 +12838,10 @@ var init_memory_metabolism = __esm({
12838
12838
  const trajDir = join21(this.cwd, ".oa", "rlm-trajectories");
12839
12839
  let lessons = [];
12840
12840
  try {
12841
- const { readdirSync: readdirSync18, readFileSync: readFileSync34 } = await import("node:fs");
12841
+ const { readdirSync: readdirSync18, readFileSync: readFileSync35 } = await import("node:fs");
12842
12842
  const files = readdirSync18(trajDir).filter((f) => f.endsWith(".jsonl")).sort().reverse().slice(0, 3);
12843
12843
  for (const file of files) {
12844
- const lines = readFileSync34(join21(trajDir, file), "utf8").split("\n").filter((l) => l.trim());
12844
+ const lines = readFileSync35(join21(trajDir, file), "utf8").split("\n").filter((l) => l.trim());
12845
12845
  for (const line of lines) {
12846
12846
  try {
12847
12847
  const entry = JSON.parse(line);
@@ -13225,14 +13225,14 @@ ${issues.map((i) => ` - ${i}`).join("\n")}` : " No issues found."),
13225
13225
  * Optionally filter by task type for phase-aware context (FSM paper insight).
13226
13226
  */
13227
13227
  getTopMemoriesSync(k = 5, taskType) {
13228
- const { readFileSync: readFileSync34, existsSync: existsSync46 } = __require("node:fs");
13228
+ const { readFileSync: readFileSync35, existsSync: existsSync47 } = __require("node:fs");
13229
13229
  const metaDir = join21(this.cwd, ".oa", "memory", "metabolism");
13230
13230
  const storeFile = join21(metaDir, "store.json");
13231
- if (!existsSync46(storeFile))
13231
+ if (!existsSync47(storeFile))
13232
13232
  return "";
13233
13233
  let store = [];
13234
13234
  try {
13235
- store = JSON.parse(readFileSync34(storeFile, "utf8"));
13235
+ store = JSON.parse(readFileSync35(storeFile, "utf8"));
13236
13236
  } catch {
13237
13237
  return "";
13238
13238
  }
@@ -13254,14 +13254,14 @@ ${issues.map((i) => ` - ${i}`).join("\n")}` : " No issues found."),
13254
13254
  /** Update memory scores based on task outcome. Called after task completion.
13255
13255
  * Memories used in successful tasks get boosted. Memories present during failures get decayed. */
13256
13256
  updateFromOutcomeSync(surfacedMemoryText, succeeded) {
13257
- const { readFileSync: readFileSync34, writeFileSync: writeFileSync21, existsSync: existsSync46, mkdirSync: mkdirSync22 } = __require("node:fs");
13257
+ const { readFileSync: readFileSync35, writeFileSync: writeFileSync21, existsSync: existsSync47, mkdirSync: mkdirSync22 } = __require("node:fs");
13258
13258
  const metaDir = join21(this.cwd, ".oa", "memory", "metabolism");
13259
13259
  const storeFile = join21(metaDir, "store.json");
13260
- if (!existsSync46(storeFile))
13260
+ if (!existsSync47(storeFile))
13261
13261
  return;
13262
13262
  let store = [];
13263
13263
  try {
13264
- store = JSON.parse(readFileSync34(storeFile, "utf8"));
13264
+ store = JSON.parse(readFileSync35(storeFile, "utf8"));
13265
13265
  } catch {
13266
13266
  return;
13267
13267
  }
@@ -13708,13 +13708,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
13708
13708
  // Per EvoSkill (arXiv:2603.02766): retrieve relevant strategies from archive.
13709
13709
  /** Retrieve top-K strategies for context injection. Returns "" if none. */
13710
13710
  getRelevantStrategiesSync(k = 3, taskType) {
13711
- const { readFileSync: readFileSync34, existsSync: existsSync46 } = __require("node:fs");
13711
+ const { readFileSync: readFileSync35, existsSync: existsSync47 } = __require("node:fs");
13712
13712
  const archiveFile = join23(this.cwd, ".oa", "arche", "variants.json");
13713
- if (!existsSync46(archiveFile))
13713
+ if (!existsSync47(archiveFile))
13714
13714
  return "";
13715
13715
  let variants = [];
13716
13716
  try {
13717
- variants = JSON.parse(readFileSync34(archiveFile, "utf8"));
13717
+ variants = JSON.parse(readFileSync35(archiveFile, "utf8"));
13718
13718
  } catch {
13719
13719
  return "";
13720
13720
  }
@@ -13732,13 +13732,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
13732
13732
  }
13733
13733
  /** Archive a strategy variant synchronously (for task completion path) */
13734
13734
  archiveVariantSync(strategy, outcome, tags = []) {
13735
- const { readFileSync: readFileSync34, writeFileSync: writeFileSync21, existsSync: existsSync46, mkdirSync: mkdirSync22 } = __require("node:fs");
13735
+ const { readFileSync: readFileSync35, writeFileSync: writeFileSync21, existsSync: existsSync47, mkdirSync: mkdirSync22 } = __require("node:fs");
13736
13736
  const dir = join23(this.cwd, ".oa", "arche");
13737
13737
  const archiveFile = join23(dir, "variants.json");
13738
13738
  let variants = [];
13739
13739
  try {
13740
- if (existsSync46(archiveFile))
13741
- variants = JSON.parse(readFileSync34(archiveFile, "utf8"));
13740
+ if (existsSync47(archiveFile))
13741
+ variants = JSON.parse(readFileSync35(archiveFile, "utf8"));
13742
13742
  } catch {
13743
13743
  }
13744
13744
  variants.push({
@@ -18804,6 +18804,157 @@ ${truncated}`, durationMs: performance.now() - start };
18804
18804
  }
18805
18805
  });
18806
18806
 
18807
+ // packages/execution/dist/tools/fortemi-bridge.js
18808
+ import { existsSync as existsSync24, readFileSync as readFileSync17 } from "node:fs";
18809
+ import { join as join38 } from "node:path";
18810
+ function loadBridgeState(repoRoot) {
18811
+ const bridgeFile = join38(repoRoot, ".oa", "fortemi-bridge.json");
18812
+ if (!existsSync24(bridgeFile))
18813
+ return null;
18814
+ try {
18815
+ return JSON.parse(readFileSync17(bridgeFile, "utf8"));
18816
+ } catch {
18817
+ return null;
18818
+ }
18819
+ }
18820
+ function createFortemiBridgeTool(def, bridgeUrl) {
18821
+ return {
18822
+ name: def.name,
18823
+ description: def.description,
18824
+ parameters: def.parameters,
18825
+ async execute(args) {
18826
+ const start = performance.now();
18827
+ try {
18828
+ const body = def.buildBody(args);
18829
+ const resp = await fetch(`${bridgeUrl}${def.endpoint}`, {
18830
+ method: "POST",
18831
+ headers: { "Content-Type": "application/json" },
18832
+ body: JSON.stringify(body),
18833
+ signal: AbortSignal.timeout(3e4)
18834
+ });
18835
+ if (!resp.ok) {
18836
+ const errText = await resp.text().catch(() => "");
18837
+ return {
18838
+ success: false,
18839
+ output: `Fortemi error: HTTP ${resp.status} \u2014 ${errText.slice(0, 200)}`,
18840
+ durationMs: performance.now() - start
18841
+ };
18842
+ }
18843
+ const data = await resp.json();
18844
+ return {
18845
+ success: true,
18846
+ output: JSON.stringify(data, null, 2).slice(0, 3e3),
18847
+ durationMs: performance.now() - start
18848
+ };
18849
+ } catch (err) {
18850
+ return {
18851
+ success: false,
18852
+ output: `Fortemi bridge error: ${err instanceof Error ? err.message : String(err)}`,
18853
+ durationMs: performance.now() - start
18854
+ };
18855
+ }
18856
+ }
18857
+ };
18858
+ }
18859
+ function createFortemiBridgeTools(repoRoot) {
18860
+ const state = loadBridgeState(repoRoot);
18861
+ if (!state)
18862
+ return [];
18863
+ try {
18864
+ process.kill(state.pid, 0);
18865
+ } catch {
18866
+ return [];
18867
+ }
18868
+ return FORTEMI_TOOLS.map((def) => createFortemiBridgeTool(def, state.url));
18869
+ }
18870
+ async function isFortemiAvailable(repoRoot) {
18871
+ const state = loadBridgeState(repoRoot);
18872
+ if (!state)
18873
+ return false;
18874
+ try {
18875
+ const resp = await fetch(`${state.url}/api/v1/tools/list_notes`, {
18876
+ signal: AbortSignal.timeout(3e3)
18877
+ });
18878
+ return resp.ok;
18879
+ } catch {
18880
+ return false;
18881
+ }
18882
+ }
18883
+ var FORTEMI_TOOLS;
18884
+ var init_fortemi_bridge = __esm({
18885
+ "packages/execution/dist/tools/fortemi-bridge.js"() {
18886
+ "use strict";
18887
+ FORTEMI_TOOLS = [
18888
+ {
18889
+ name: "fortemi_capture",
18890
+ description: "Capture knowledge into fortemi-react \u2014 creates a note with optional tags. Content is auto-processed (embeddings, linking, AI revision).",
18891
+ parameters: {
18892
+ type: "object",
18893
+ properties: {
18894
+ content: { type: "string", description: "The text content to capture" },
18895
+ title: { type: "string", description: "Optional title" },
18896
+ tags: { type: "array", items: { type: "string" }, description: "Optional tags" }
18897
+ },
18898
+ required: ["content"]
18899
+ },
18900
+ endpoint: "/api/v1/tools/capture_knowledge",
18901
+ buildBody: (args) => ({
18902
+ action: "create",
18903
+ content: String(args.content ?? ""),
18904
+ title: args.title ? String(args.title) : void 0,
18905
+ tags: Array.isArray(args.tags) ? args.tags : void 0
18906
+ })
18907
+ },
18908
+ {
18909
+ name: "fortemi_search",
18910
+ description: "Search fortemi-react notes with full-text or semantic search. Returns matching notes with relevance scores.",
18911
+ parameters: {
18912
+ type: "object",
18913
+ properties: {
18914
+ query: { type: "string", description: "Search query" },
18915
+ limit: { type: "number", description: "Max results (default 10)" }
18916
+ },
18917
+ required: ["query"]
18918
+ },
18919
+ endpoint: "/api/v1/tools/search",
18920
+ buildBody: (args) => ({
18921
+ query: String(args.query ?? ""),
18922
+ limit: Number(args.limit ?? 10)
18923
+ })
18924
+ },
18925
+ {
18926
+ name: "fortemi_list",
18927
+ description: "List recent notes from fortemi-react with pagination.",
18928
+ parameters: {
18929
+ type: "object",
18930
+ properties: {
18931
+ limit: { type: "number", description: "Max results (default 20)" },
18932
+ offset: { type: "number", description: "Pagination offset" }
18933
+ }
18934
+ },
18935
+ endpoint: "/api/v1/tools/list_notes",
18936
+ buildBody: (args) => ({
18937
+ limit: Number(args.limit ?? 20),
18938
+ offset: Number(args.offset ?? 0)
18939
+ })
18940
+ },
18941
+ {
18942
+ name: "fortemi_get",
18943
+ description: "Get a specific note by ID from fortemi-react.",
18944
+ parameters: {
18945
+ type: "object",
18946
+ properties: {
18947
+ id: { type: "string", description: "Note ID" }
18948
+ },
18949
+ required: ["id"]
18950
+ },
18951
+ endpoint: "/api/v1/tools/get_note",
18952
+ buildBody: (args) => ({ id: String(args.id ?? "") })
18953
+ }
18954
+ ];
18955
+ }
18956
+ });
18957
+
18807
18958
  // packages/execution/dist/shellRunner.js
18808
18959
  import { spawn as spawn13 } from "node:child_process";
18809
18960
  async function runShell(options) {
@@ -18909,7 +19060,7 @@ var init_gitWorktree = __esm({
18909
19060
  });
18910
19061
 
18911
19062
  // packages/execution/dist/patchApplier.js
18912
- import { readFileSync as readFileSync17, writeFileSync as writeFileSync7, existsSync as existsSync24, mkdirSync as mkdirSync7 } from "node:fs";
19063
+ import { readFileSync as readFileSync18, writeFileSync as writeFileSync7, existsSync as existsSync25, mkdirSync as mkdirSync7 } from "node:fs";
18913
19064
  import { dirname as dirname11 } from "node:path";
18914
19065
  import { spawn as spawn14 } from "node:child_process";
18915
19066
  async function applyPatch(patch) {
@@ -18925,7 +19076,7 @@ async function applyPatch(patch) {
18925
19076
  }
18926
19077
  }
18927
19078
  function applyBlockReplace(patch) {
18928
- const original = readFileSync17(patch.filePath, "utf-8");
19079
+ const original = readFileSync18(patch.filePath, "utf-8");
18929
19080
  if (!original.includes(patch.oldContent)) {
18930
19081
  throw new Error(`Block not found in "${patch.filePath}": the oldContent string was not found in the file.`);
18931
19082
  }
@@ -18936,7 +19087,7 @@ function applyRewrite(patch) {
18936
19087
  writeFileSync7(patch.filePath, patch.newContent, "utf-8");
18937
19088
  }
18938
19089
  function applyNewFile(patch) {
18939
- if (existsSync24(patch.filePath)) {
19090
+ if (existsSync25(patch.filePath)) {
18940
19091
  throw new Error(`Cannot create new file: "${patch.filePath}" already exists.`);
18941
19092
  }
18942
19093
  mkdirSync7(dirname11(patch.filePath), { recursive: true });
@@ -19474,6 +19625,7 @@ __export(dist_exports, {
19474
19625
  buildCustomTools: () => buildCustomTools,
19475
19626
  buildSkillsSummary: () => buildSkillsSummary,
19476
19627
  checkDesktopDeps: () => checkDesktopDeps,
19628
+ createFortemiBridgeTools: () => createFortemiBridgeTools,
19477
19629
  createWorktree: () => createWorktree,
19478
19630
  detectSearchProvider: () => detectSearchProvider,
19479
19631
  discoverSkills: () => discoverSkills,
@@ -19482,6 +19634,7 @@ __export(dist_exports, {
19482
19634
  ensureDepsForGroup: () => ensureDepsForGroup,
19483
19635
  getActiveAttentionItems: () => getActiveAttentionItems,
19484
19636
  getDueReminders: () => getDueReminders,
19637
+ isFortemiAvailable: () => isFortemiAvailable,
19485
19638
  isImagePath: () => isImagePath,
19486
19639
  listCustomToolFiles: () => listCustomToolFiles,
19487
19640
  loadCustomTools: () => loadCustomTools,
@@ -19558,6 +19711,7 @@ var init_dist2 = __esm({
19558
19711
  init_factory();
19559
19712
  init_cron_agent();
19560
19713
  init_nexus();
19714
+ init_fortemi_bridge();
19561
19715
  init_system_deps();
19562
19716
  init_shellRunner();
19563
19717
  init_gitWorktree();
@@ -20242,17 +20396,17 @@ var init_dist3 = __esm({
20242
20396
  });
20243
20397
 
20244
20398
  // packages/orchestrator/dist/promptLoader.js
20245
- import { readFileSync as readFileSync18, existsSync as existsSync25 } from "node:fs";
20246
- import { join as join38, dirname as dirname12 } from "node:path";
20399
+ import { readFileSync as readFileSync19, existsSync as existsSync26 } from "node:fs";
20400
+ import { join as join39, dirname as dirname12 } from "node:path";
20247
20401
  import { fileURLToPath as fileURLToPath7 } from "node:url";
20248
20402
  function loadPrompt(promptPath, vars) {
20249
20403
  let content = cache.get(promptPath);
20250
20404
  if (content === void 0) {
20251
- const fullPath = join38(PROMPTS_DIR, promptPath);
20252
- if (!existsSync25(fullPath)) {
20405
+ const fullPath = join39(PROMPTS_DIR, promptPath);
20406
+ if (!existsSync26(fullPath)) {
20253
20407
  throw new Error(`Prompt file not found: ${fullPath}`);
20254
20408
  }
20255
- content = readFileSync18(fullPath, "utf-8");
20409
+ content = readFileSync19(fullPath, "utf-8");
20256
20410
  cache.set(promptPath, content);
20257
20411
  }
20258
20412
  if (!vars)
@@ -20265,7 +20419,7 @@ var init_promptLoader = __esm({
20265
20419
  "use strict";
20266
20420
  __filename = fileURLToPath7(import.meta.url);
20267
20421
  __dirname4 = dirname12(__filename);
20268
- PROMPTS_DIR = join38(__dirname4, "..", "prompts");
20422
+ PROMPTS_DIR = join39(__dirname4, "..", "prompts");
20269
20423
  cache = /* @__PURE__ */ new Map();
20270
20424
  }
20271
20425
  });
@@ -20645,7 +20799,7 @@ var init_code_retriever = __esm({
20645
20799
  import { execFile as execFile5 } from "node:child_process";
20646
20800
  import { promisify as promisify4 } from "node:util";
20647
20801
  import { readFile as readFile19, readdir as readdir5, stat as stat3 } from "node:fs/promises";
20648
- import { join as join39, extname as extname7 } from "node:path";
20802
+ import { join as join40, extname as extname7 } from "node:path";
20649
20803
  async function searchByPath(pathPattern, options) {
20650
20804
  const allFiles = await collectFiles(options.rootDir, options.includeGlobs ?? DEFAULT_INCLUDE_GLOBS, options.excludeGlobs ?? DEFAULT_EXCLUDE_GLOBS);
20651
20805
  const pattern = options.caseInsensitive ? pathPattern.toLowerCase() : pathPattern;
@@ -20787,7 +20941,7 @@ async function walkForFiles(rootDir, dir, excludeGlobs, results) {
20787
20941
  continue;
20788
20942
  if (excludeGlobs.some((g) => entry.name === g || matchesGlob(entry.name, g)))
20789
20943
  continue;
20790
- const absPath = join39(dir, entry.name);
20944
+ const absPath = join40(dir, entry.name);
20791
20945
  if (entry.isDirectory()) {
20792
20946
  await walkForFiles(rootDir, absPath, excludeGlobs, results);
20793
20947
  } else if (entry.isFile()) {
@@ -21094,7 +21248,7 @@ var init_graphExpand = __esm({
21094
21248
 
21095
21249
  // packages/retrieval/dist/snippetPacker.js
21096
21250
  import { readFile as readFile20 } from "node:fs/promises";
21097
- import { join as join40 } from "node:path";
21251
+ import { join as join41 } from "node:path";
21098
21252
  async function packSnippets(requests, opts = {}) {
21099
21253
  const maxTokens = opts.maxTokens ?? DEFAULT_MAX_TOKENS;
21100
21254
  const contextLines = opts.contextLines ?? DEFAULT_CONTEXT_LINES;
@@ -21120,7 +21274,7 @@ async function packSnippets(requests, opts = {}) {
21120
21274
  return { packed, dropped, totalTokens };
21121
21275
  }
21122
21276
  async function extractSnippet(req, repoRoot, contextLines = DEFAULT_CONTEXT_LINES) {
21123
- const absPath = req.filePath.startsWith("/") ? req.filePath : join40(repoRoot, req.filePath);
21277
+ const absPath = req.filePath.startsWith("/") ? req.filePath : join41(repoRoot, req.filePath);
21124
21278
  let content;
21125
21279
  try {
21126
21280
  content = await readFile20(absPath, "utf-8");
@@ -23844,8 +23998,8 @@ ${marker}` : marker);
23844
23998
  return;
23845
23999
  try {
23846
24000
  const { mkdirSync: mkdirSync22, writeFileSync: writeFileSync21 } = __require("node:fs");
23847
- const { join: join65 } = __require("node:path");
23848
- const sessionDir = join65(this._workingDirectory, ".oa", "session", this._sessionId);
24001
+ const { join: join66 } = __require("node:path");
24002
+ const sessionDir = join66(this._workingDirectory, ".oa", "session", this._sessionId);
23849
24003
  mkdirSync22(sessionDir, { recursive: true });
23850
24004
  const checkpoint = {
23851
24005
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -23858,7 +24012,7 @@ ${marker}` : marker);
23858
24012
  memexEntryCount: this._memexArchive.size,
23859
24013
  fileRegistrySize: this._fileRegistry.size
23860
24014
  };
23861
- writeFileSync21(join65(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
24015
+ writeFileSync21(join66(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
23862
24016
  } catch {
23863
24017
  }
23864
24018
  }
@@ -25165,9 +25319,9 @@ ${transcript}`
25165
25319
  });
25166
25320
 
25167
25321
  // packages/orchestrator/dist/nexusBackend.js
25168
- import { existsSync as existsSync26, statSync as statSync9, openSync, readSync, closeSync, unlinkSync as unlinkSync4, writeFileSync as writeFileSync8 } from "node:fs";
25322
+ import { existsSync as existsSync27, statSync as statSync9, openSync, readSync, closeSync, unlinkSync as unlinkSync4, writeFileSync as writeFileSync8 } from "node:fs";
25169
25323
  import { watch as fsWatch } from "node:fs";
25170
- import { join as join41 } from "node:path";
25324
+ import { join as join42 } from "node:path";
25171
25325
  import { tmpdir as tmpdir7 } from "node:os";
25172
25326
  import { randomBytes as randomBytes8 } from "node:crypto";
25173
25327
  var NexusAgenticBackend;
@@ -25317,7 +25471,7 @@ var init_nexusBackend = __esm({
25317
25471
  * Falls back to unary + word-split if streaming setup fails.
25318
25472
  */
25319
25473
  async *chatCompletionStream(request) {
25320
- const streamFile = join41(tmpdir7(), `nexus-stream-${randomBytes8(6).toString("hex")}.jsonl`);
25474
+ const streamFile = join42(tmpdir7(), `nexus-stream-${randomBytes8(6).toString("hex")}.jsonl`);
25321
25475
  writeFileSync8(streamFile, "", "utf8");
25322
25476
  const daemonArgs = {
25323
25477
  model: this.model,
@@ -26353,8 +26507,8 @@ __export(listen_exports, {
26353
26507
  waitForTranscribeCli: () => waitForTranscribeCli
26354
26508
  });
26355
26509
  import { spawn as spawn15, execSync as execSync22 } from "node:child_process";
26356
- import { existsSync as existsSync27, mkdirSync as mkdirSync8, writeFileSync as writeFileSync9, readdirSync as readdirSync6 } from "node:fs";
26357
- import { join as join42, dirname as dirname13 } from "node:path";
26510
+ import { existsSync as existsSync28, mkdirSync as mkdirSync8, writeFileSync as writeFileSync9, readdirSync as readdirSync6 } from "node:fs";
26511
+ import { join as join43, dirname as dirname13 } from "node:path";
26358
26512
  import { homedir as homedir8 } from "node:os";
26359
26513
  import { fileURLToPath as fileURLToPath8 } from "node:url";
26360
26514
  import { EventEmitter } from "node:events";
@@ -26440,15 +26594,15 @@ function findMicCaptureCommand() {
26440
26594
  function findLiveWhisperScript() {
26441
26595
  const thisDir = dirname13(fileURLToPath8(import.meta.url));
26442
26596
  const candidates = [
26443
- join42(thisDir, "../../../../packages/execution/scripts/live-whisper.py"),
26444
- join42(thisDir, "../../../packages/execution/scripts/live-whisper.py"),
26445
- join42(thisDir, "../../execution/scripts/live-whisper.py"),
26597
+ join43(thisDir, "../../../../packages/execution/scripts/live-whisper.py"),
26598
+ join43(thisDir, "../../../packages/execution/scripts/live-whisper.py"),
26599
+ join43(thisDir, "../../execution/scripts/live-whisper.py"),
26446
26600
  // npm install layout — scripts bundled alongside dist
26447
- join42(thisDir, "../scripts/live-whisper.py"),
26448
- join42(thisDir, "../../scripts/live-whisper.py")
26601
+ join43(thisDir, "../scripts/live-whisper.py"),
26602
+ join43(thisDir, "../../scripts/live-whisper.py")
26449
26603
  ];
26450
26604
  for (const p of candidates) {
26451
- if (existsSync27(p))
26605
+ if (existsSync28(p))
26452
26606
  return p;
26453
26607
  }
26454
26608
  try {
@@ -26458,21 +26612,21 @@ function findLiveWhisperScript() {
26458
26612
  stdio: ["pipe", "pipe", "pipe"]
26459
26613
  }).trim();
26460
26614
  const candidates2 = [
26461
- join42(globalRoot, "open-agents-ai", "dist", "scripts", "live-whisper.py"),
26462
- join42(globalRoot, "open-agents-ai", "scripts", "live-whisper.py")
26615
+ join43(globalRoot, "open-agents-ai", "dist", "scripts", "live-whisper.py"),
26616
+ join43(globalRoot, "open-agents-ai", "scripts", "live-whisper.py")
26463
26617
  ];
26464
26618
  for (const p of candidates2) {
26465
- if (existsSync27(p))
26619
+ if (existsSync28(p))
26466
26620
  return p;
26467
26621
  }
26468
26622
  } catch {
26469
26623
  }
26470
- const nvmBase = join42(homedir8(), ".nvm", "versions", "node");
26471
- if (existsSync27(nvmBase)) {
26624
+ const nvmBase = join43(homedir8(), ".nvm", "versions", "node");
26625
+ if (existsSync28(nvmBase)) {
26472
26626
  try {
26473
26627
  for (const ver of readdirSync6(nvmBase)) {
26474
- const p = join42(nvmBase, ver, "lib", "node_modules", "open-agents-ai", "dist", "scripts", "live-whisper.py");
26475
- if (existsSync27(p))
26628
+ const p = join43(nvmBase, ver, "lib", "node_modules", "open-agents-ai", "dist", "scripts", "live-whisper.py");
26629
+ if (existsSync28(p))
26476
26630
  return p;
26477
26631
  }
26478
26632
  } catch {
@@ -26490,7 +26644,7 @@ function ensureTranscribeCliBackground() {
26490
26644
  timeout: 5e3,
26491
26645
  stdio: ["pipe", "pipe", "pipe"]
26492
26646
  }).trim();
26493
- if (existsSync27(join42(globalRoot, "transcribe-cli", "dist", "index.js"))) {
26647
+ if (existsSync28(join43(globalRoot, "transcribe-cli", "dist", "index.js"))) {
26494
26648
  return true;
26495
26649
  }
26496
26650
  } catch {
@@ -26713,24 +26867,24 @@ var init_listen = __esm({
26713
26867
  timeout: 5e3,
26714
26868
  stdio: ["pipe", "pipe", "pipe"]
26715
26869
  }).trim();
26716
- const tcPath = join42(globalRoot, "transcribe-cli");
26717
- if (existsSync27(join42(tcPath, "dist", "index.js"))) {
26870
+ const tcPath = join43(globalRoot, "transcribe-cli");
26871
+ if (existsSync28(join43(tcPath, "dist", "index.js"))) {
26718
26872
  const { createRequire: createRequire4 } = await import("node:module");
26719
26873
  const req = createRequire4(import.meta.url);
26720
- return req(join42(tcPath, "dist", "index.js"));
26874
+ return req(join43(tcPath, "dist", "index.js"));
26721
26875
  }
26722
26876
  } catch {
26723
26877
  }
26724
- const nvmBase = join42(homedir8(), ".nvm", "versions", "node");
26725
- if (existsSync27(nvmBase)) {
26878
+ const nvmBase = join43(homedir8(), ".nvm", "versions", "node");
26879
+ if (existsSync28(nvmBase)) {
26726
26880
  try {
26727
26881
  const { readdirSync: readdirSync18 } = await import("node:fs");
26728
26882
  for (const ver of readdirSync18(nvmBase)) {
26729
- const tcPath = join42(nvmBase, ver, "lib", "node_modules", "transcribe-cli");
26730
- if (existsSync27(join42(tcPath, "dist", "index.js"))) {
26883
+ const tcPath = join43(nvmBase, ver, "lib", "node_modules", "transcribe-cli");
26884
+ if (existsSync28(join43(tcPath, "dist", "index.js"))) {
26731
26885
  const { createRequire: createRequire4 } = await import("node:module");
26732
26886
  const req = createRequire4(import.meta.url);
26733
- return req(join42(tcPath, "dist", "index.js"));
26887
+ return req(join43(tcPath, "dist", "index.js"));
26734
26888
  }
26735
26889
  }
26736
26890
  } catch {
@@ -27012,9 +27166,9 @@ transcribe-cli error: ${transcribeCliError}` : "";
27012
27166
  });
27013
27167
  if (outputDir) {
27014
27168
  const { basename: basename16 } = await import("node:path");
27015
- const transcriptDir = join42(outputDir, ".oa", "transcripts");
27169
+ const transcriptDir = join43(outputDir, ".oa", "transcripts");
27016
27170
  mkdirSync8(transcriptDir, { recursive: true });
27017
- const outFile = join42(transcriptDir, `${basename16(filePath)}.txt`);
27171
+ const outFile = join43(transcriptDir, `${basename16(filePath)}.txt`);
27018
27172
  writeFileSync9(outFile, result.text, "utf-8");
27019
27173
  }
27020
27174
  return {
@@ -32251,8 +32405,8 @@ import { EventEmitter as EventEmitter3 } from "node:events";
32251
32405
  import { randomBytes as randomBytes9 } from "node:crypto";
32252
32406
  import { URL as URL2 } from "node:url";
32253
32407
  import { loadavg, cpus, totalmem, freemem } from "node:os";
32254
- import { existsSync as existsSync28, readFileSync as readFileSync19, writeFileSync as writeFileSync10, unlinkSync as unlinkSync5, mkdirSync as mkdirSync9, readdirSync as readdirSync7, statSync as statSync10 } from "node:fs";
32255
- import { join as join43 } from "node:path";
32408
+ import { existsSync as existsSync29, readFileSync as readFileSync20, writeFileSync as writeFileSync10, unlinkSync as unlinkSync5, mkdirSync as mkdirSync9, readdirSync as readdirSync7, statSync as statSync10 } from "node:fs";
32409
+ import { join as join44 } from "node:path";
32256
32410
  function cleanForwardHeaders(raw, targetHost) {
32257
32411
  const out = {};
32258
32412
  for (const [key, value] of Object.entries(raw)) {
@@ -32280,10 +32434,10 @@ function fmtTokens(n) {
32280
32434
  }
32281
32435
  function readExposeState(stateDir) {
32282
32436
  try {
32283
- const path = join43(stateDir, STATE_FILE_NAME);
32284
- if (!existsSync28(path))
32437
+ const path = join44(stateDir, STATE_FILE_NAME);
32438
+ if (!existsSync29(path))
32285
32439
  return null;
32286
- const raw = readFileSync19(path, "utf8");
32440
+ const raw = readFileSync20(path, "utf8");
32287
32441
  const data = JSON.parse(raw);
32288
32442
  if (!data.pid || !data.tunnelUrl || !data.authKey || !data.proxyPort)
32289
32443
  return null;
@@ -32295,13 +32449,13 @@ function readExposeState(stateDir) {
32295
32449
  function writeExposeState(stateDir, state) {
32296
32450
  try {
32297
32451
  mkdirSync9(stateDir, { recursive: true });
32298
- writeFileSync10(join43(stateDir, STATE_FILE_NAME), JSON.stringify(state, null, 2));
32452
+ writeFileSync10(join44(stateDir, STATE_FILE_NAME), JSON.stringify(state, null, 2));
32299
32453
  } catch {
32300
32454
  }
32301
32455
  }
32302
32456
  function removeExposeState(stateDir) {
32303
32457
  try {
32304
- unlinkSync5(join43(stateDir, STATE_FILE_NAME));
32458
+ unlinkSync5(join44(stateDir, STATE_FILE_NAME));
32305
32459
  } catch {
32306
32460
  }
32307
32461
  }
@@ -32390,10 +32544,10 @@ async function collectSystemMetricsAsync() {
32390
32544
  }
32391
32545
  function readP2PExposeState(stateDir) {
32392
32546
  try {
32393
- const path = join43(stateDir, P2P_STATE_FILE_NAME);
32394
- if (!existsSync28(path))
32547
+ const path = join44(stateDir, P2P_STATE_FILE_NAME);
32548
+ if (!existsSync29(path))
32395
32549
  return null;
32396
- const raw = readFileSync19(path, "utf8");
32550
+ const raw = readFileSync20(path, "utf8");
32397
32551
  const data = JSON.parse(raw);
32398
32552
  if (!data.peerId || !data.authKey)
32399
32553
  return null;
@@ -32405,13 +32559,13 @@ function readP2PExposeState(stateDir) {
32405
32559
  function writeP2PExposeState(stateDir, state) {
32406
32560
  try {
32407
32561
  mkdirSync9(stateDir, { recursive: true });
32408
- writeFileSync10(join43(stateDir, P2P_STATE_FILE_NAME), JSON.stringify(state, null, 2));
32562
+ writeFileSync10(join44(stateDir, P2P_STATE_FILE_NAME), JSON.stringify(state, null, 2));
32409
32563
  } catch {
32410
32564
  }
32411
32565
  }
32412
32566
  function removeP2PExposeState(stateDir) {
32413
32567
  try {
32414
- unlinkSync5(join43(stateDir, P2P_STATE_FILE_NAME));
32568
+ unlinkSync5(join44(stateDir, P2P_STATE_FILE_NAME));
32415
32569
  } catch {
32416
32570
  }
32417
32571
  }
@@ -33259,10 +33413,10 @@ ${this.formatConnectionInfo()}`);
33259
33413
  throw new Error(`Expose failed: ${exposeResult.error}`);
33260
33414
  }
33261
33415
  const nexusDir = this._nexusTool.getNexusDir();
33262
- const statusPath = join43(nexusDir, "status.json");
33416
+ const statusPath = join44(nexusDir, "status.json");
33263
33417
  for (let i = 0; i < 80; i++) {
33264
33418
  try {
33265
- const raw = readFileSync19(statusPath, "utf8");
33419
+ const raw = readFileSync20(statusPath, "utf8");
33266
33420
  if (raw.length > 10) {
33267
33421
  const status = JSON.parse(raw);
33268
33422
  if (status.connected && status.peerId) {
@@ -33293,8 +33447,8 @@ ${this.formatConnectionInfo()}`);
33293
33447
  });
33294
33448
  }
33295
33449
  try {
33296
- const invocDir = join43(nexusDir, "invocations");
33297
- if (existsSync28(invocDir)) {
33450
+ const invocDir = join44(nexusDir, "invocations");
33451
+ if (existsSync29(invocDir)) {
33298
33452
  this._prevInvocCount = readdirSync7(invocDir).filter((f) => f.endsWith(".json")).length;
33299
33453
  this._stats.totalRequests = this._prevInvocCount;
33300
33454
  }
@@ -33323,13 +33477,13 @@ ${this.formatConnectionInfo()}`);
33323
33477
  if (!state)
33324
33478
  return null;
33325
33479
  const nexusDir = nexusTool.getNexusDir();
33326
- const statusPath = join43(nexusDir, "status.json");
33480
+ const statusPath = join44(nexusDir, "status.json");
33327
33481
  try {
33328
- if (!existsSync28(statusPath)) {
33482
+ if (!existsSync29(statusPath)) {
33329
33483
  removeP2PExposeState(stateDir);
33330
33484
  return null;
33331
33485
  }
33332
- const status = JSON.parse(readFileSync19(statusPath, "utf8"));
33486
+ const status = JSON.parse(readFileSync20(statusPath, "utf8"));
33333
33487
  if (!status.connected || !status.peerId) {
33334
33488
  removeP2PExposeState(stateDir);
33335
33489
  return null;
@@ -33382,8 +33536,8 @@ ${this.formatConnectionInfo()}`);
33382
33536
  let lastMeteringLineCount = 0;
33383
33537
  this._activityPollTimer = setInterval(() => {
33384
33538
  try {
33385
- const invocDir = join43(nexusDir, "invocations");
33386
- if (!existsSync28(invocDir))
33539
+ const invocDir = join44(nexusDir, "invocations");
33540
+ if (!existsSync29(invocDir))
33387
33541
  return;
33388
33542
  const files = readdirSync7(invocDir).filter((f) => f.endsWith(".json"));
33389
33543
  const invocCount = files.length;
@@ -33398,17 +33552,17 @@ ${this.formatConnectionInfo()}`);
33398
33552
  let recentActive = 0;
33399
33553
  for (const f of files.slice(-10)) {
33400
33554
  try {
33401
- const st = statSync10(join43(invocDir, f));
33555
+ const st = statSync10(join44(invocDir, f));
33402
33556
  if (now - st.mtimeMs < 1e4)
33403
33557
  recentActive++;
33404
33558
  } catch {
33405
33559
  }
33406
33560
  }
33407
- const meteringFile = join43(nexusDir, "metering.jsonl");
33561
+ const meteringFile = join44(nexusDir, "metering.jsonl");
33408
33562
  let meteringLines = lastMeteringLineCount;
33409
33563
  try {
33410
- if (existsSync28(meteringFile)) {
33411
- const content = readFileSync19(meteringFile, "utf8");
33564
+ if (existsSync29(meteringFile)) {
33565
+ const content = readFileSync20(meteringFile, "utf8");
33412
33566
  meteringLines = content.split("\n").filter((l) => l.trim()).length;
33413
33567
  }
33414
33568
  } catch {
@@ -33434,9 +33588,9 @@ ${this.formatConnectionInfo()}`);
33434
33588
  this._activityPollTimer.unref();
33435
33589
  this._pollTimer = setInterval(() => {
33436
33590
  try {
33437
- const statusPath = join43(nexusDir, "status.json");
33438
- if (existsSync28(statusPath)) {
33439
- const status = JSON.parse(readFileSync19(statusPath, "utf8"));
33591
+ const statusPath = join44(nexusDir, "status.json");
33592
+ if (existsSync29(statusPath)) {
33593
+ const status = JSON.parse(readFileSync20(statusPath, "utf8"));
33440
33594
  if (status.peerId && !this._peerId) {
33441
33595
  this._peerId = status.peerId;
33442
33596
  }
@@ -33445,8 +33599,8 @@ ${this.formatConnectionInfo()}`);
33445
33599
  } catch {
33446
33600
  }
33447
33601
  try {
33448
- const invocDir = join43(nexusDir, "invocations");
33449
- if (existsSync28(invocDir)) {
33602
+ const invocDir = join44(nexusDir, "invocations");
33603
+ if (existsSync29(invocDir)) {
33450
33604
  const files = readdirSync7(invocDir);
33451
33605
  const invocCount = files.filter((f) => f.endsWith(".json")).length;
33452
33606
  if (invocCount > this._stats.totalRequests) {
@@ -33457,9 +33611,9 @@ ${this.formatConnectionInfo()}`);
33457
33611
  } catch {
33458
33612
  }
33459
33613
  try {
33460
- const meteringFile = join43(nexusDir, "metering.jsonl");
33461
- if (existsSync28(meteringFile)) {
33462
- const content = readFileSync19(meteringFile, "utf8");
33614
+ const meteringFile = join44(nexusDir, "metering.jsonl");
33615
+ if (existsSync29(meteringFile)) {
33616
+ const content = readFileSync20(meteringFile, "utf8");
33463
33617
  if (content.length > lastMeteringSize) {
33464
33618
  const newContent = content.slice(lastMeteringSize);
33465
33619
  lastMeteringSize = content.length;
@@ -33668,8 +33822,8 @@ var init_types = __esm({
33668
33822
 
33669
33823
  // packages/cli/dist/tui/p2p/secret-vault.js
33670
33824
  import { createCipheriv as createCipheriv2, createDecipheriv as createDecipheriv2, randomBytes as randomBytes10, scryptSync as scryptSync2, createHash as createHash2 } from "node:crypto";
33671
- import { readFileSync as readFileSync20, writeFileSync as writeFileSync11, existsSync as existsSync29, mkdirSync as mkdirSync10 } from "node:fs";
33672
- import { join as join44, dirname as dirname14 } from "node:path";
33825
+ import { readFileSync as readFileSync21, writeFileSync as writeFileSync11, existsSync as existsSync30, mkdirSync as mkdirSync10 } from "node:fs";
33826
+ import { join as join45, dirname as dirname14 } from "node:path";
33673
33827
  var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
33674
33828
  var init_secret_vault = __esm({
33675
33829
  "packages/cli/dist/tui/p2p/secret-vault.js"() {
@@ -33881,7 +34035,7 @@ var init_secret_vault = __esm({
33881
34035
  const tag = cipher.getAuthTag();
33882
34036
  const blob = Buffer.concat([salt, iv, tag, encrypted]);
33883
34037
  const dir = dirname14(this.storePath);
33884
- if (!existsSync29(dir))
34038
+ if (!existsSync30(dir))
33885
34039
  mkdirSync10(dir, { recursive: true });
33886
34040
  writeFileSync11(this.storePath, blob, { mode: 384 });
33887
34041
  }
@@ -33890,9 +34044,9 @@ var init_secret_vault = __esm({
33890
34044
  * Returns the number of secrets loaded.
33891
34045
  */
33892
34046
  load(passphrase) {
33893
- if (!this.storePath || !existsSync29(this.storePath))
34047
+ if (!this.storePath || !existsSync30(this.storePath))
33894
34048
  return 0;
33895
- const blob = readFileSync20(this.storePath);
34049
+ const blob = readFileSync21(this.storePath);
33896
34050
  if (blob.length < SALT_LEN + IV_LEN + 16) {
33897
34051
  throw new Error("Vault file is corrupted (too small)");
33898
34052
  }
@@ -35013,26 +35167,26 @@ async function fetchOpenAIModels(baseUrl, apiKey) {
35013
35167
  async function fetchPeerModels(peerId, authKey) {
35014
35168
  try {
35015
35169
  const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
35016
- const { existsSync: existsSync46, readFileSync: readFileSync34 } = await import("node:fs");
35017
- const { join: join65 } = await import("node:path");
35170
+ const { existsSync: existsSync47, readFileSync: readFileSync35 } = await import("node:fs");
35171
+ const { join: join66 } = await import("node:path");
35018
35172
  const cwd4 = process.cwd();
35019
35173
  const nexusTool = new NexusTool2(cwd4);
35020
35174
  const nexusDir = nexusTool.getNexusDir();
35021
35175
  let isLocalPeer = false;
35022
35176
  try {
35023
- const statusPath = join65(nexusDir, "status.json");
35024
- if (existsSync46(statusPath)) {
35025
- const status = JSON.parse(readFileSync34(statusPath, "utf8"));
35177
+ const statusPath = join66(nexusDir, "status.json");
35178
+ if (existsSync47(statusPath)) {
35179
+ const status = JSON.parse(readFileSync35(statusPath, "utf8"));
35026
35180
  if (status.peerId === peerId)
35027
35181
  isLocalPeer = true;
35028
35182
  }
35029
35183
  } catch {
35030
35184
  }
35031
35185
  if (isLocalPeer) {
35032
- const pricingPath = join65(nexusDir, "pricing.json");
35033
- if (existsSync46(pricingPath)) {
35186
+ const pricingPath = join66(nexusDir, "pricing.json");
35187
+ if (existsSync47(pricingPath)) {
35034
35188
  try {
35035
- const pricing = JSON.parse(readFileSync34(pricingPath, "utf8"));
35189
+ const pricing = JSON.parse(readFileSync35(pricingPath, "utf8"));
35036
35190
  const localModels = (pricing.models || []).map((m) => ({
35037
35191
  name: m.model || "unknown",
35038
35192
  size: m.parameterSize || "",
@@ -35046,10 +35200,10 @@ async function fetchPeerModels(peerId, authKey) {
35046
35200
  }
35047
35201
  }
35048
35202
  }
35049
- const cachePath = join65(nexusDir, "peer-models-cache.json");
35050
- if (existsSync46(cachePath)) {
35203
+ const cachePath = join66(nexusDir, "peer-models-cache.json");
35204
+ if (existsSync47(cachePath)) {
35051
35205
  try {
35052
- const cache4 = JSON.parse(readFileSync34(cachePath, "utf8"));
35206
+ const cache4 = JSON.parse(readFileSync35(cachePath, "utf8"));
35053
35207
  if (cache4.peerId === peerId && cache4.models?.length > 0) {
35054
35208
  const age = Date.now() - new Date(cache4.cachedAt).getTime();
35055
35209
  if (age < 5 * 60 * 1e3) {
@@ -35164,10 +35318,10 @@ async function fetchPeerModels(peerId, authKey) {
35164
35318
  } catch {
35165
35319
  }
35166
35320
  if (isLocalPeer) {
35167
- const pricingPath = join65(nexusDir, "pricing.json");
35168
- if (existsSync46(pricingPath)) {
35321
+ const pricingPath = join66(nexusDir, "pricing.json");
35322
+ if (existsSync47(pricingPath)) {
35169
35323
  try {
35170
- const pricing = JSON.parse(readFileSync34(pricingPath, "utf8"));
35324
+ const pricing = JSON.parse(readFileSync35(pricingPath, "utf8"));
35171
35325
  return (pricing.models || []).map((m) => ({
35172
35326
  name: m.model || "unknown",
35173
35327
  size: m.parameterSize || "",
@@ -35447,17 +35601,17 @@ var init_render2 = __esm({
35447
35601
  });
35448
35602
 
35449
35603
  // packages/prompts/dist/promptLoader.js
35450
- import { readFileSync as readFileSync21, existsSync as existsSync30 } from "node:fs";
35451
- import { join as join45, dirname as dirname15 } from "node:path";
35604
+ import { readFileSync as readFileSync22, existsSync as existsSync31 } from "node:fs";
35605
+ import { join as join46, dirname as dirname15 } from "node:path";
35452
35606
  import { fileURLToPath as fileURLToPath9 } from "node:url";
35453
35607
  function loadPrompt2(promptPath, vars) {
35454
35608
  let content = cache2.get(promptPath);
35455
35609
  if (content === void 0) {
35456
- const fullPath = join45(PROMPTS_DIR2, promptPath);
35457
- if (!existsSync30(fullPath)) {
35610
+ const fullPath = join46(PROMPTS_DIR2, promptPath);
35611
+ if (!existsSync31(fullPath)) {
35458
35612
  throw new Error(`Prompt file not found: ${fullPath}`);
35459
35613
  }
35460
- content = readFileSync21(fullPath, "utf-8");
35614
+ content = readFileSync22(fullPath, "utf-8");
35461
35615
  cache2.set(promptPath, content);
35462
35616
  }
35463
35617
  if (!vars)
@@ -35470,9 +35624,9 @@ var init_promptLoader2 = __esm({
35470
35624
  "use strict";
35471
35625
  __filename2 = fileURLToPath9(import.meta.url);
35472
35626
  __dirname5 = dirname15(__filename2);
35473
- devPath = join45(__dirname5, "..", "templates");
35474
- publishedPath = join45(__dirname5, "..", "prompts", "templates");
35475
- PROMPTS_DIR2 = existsSync30(devPath) ? devPath : publishedPath;
35627
+ devPath = join46(__dirname5, "..", "templates");
35628
+ publishedPath = join46(__dirname5, "..", "prompts", "templates");
35629
+ PROMPTS_DIR2 = existsSync31(devPath) ? devPath : publishedPath;
35476
35630
  cache2 = /* @__PURE__ */ new Map();
35477
35631
  }
35478
35632
  });
@@ -35583,7 +35737,7 @@ var init_task_templates = __esm({
35583
35737
  });
35584
35738
 
35585
35739
  // packages/prompts/dist/index.js
35586
- import { join as join46, dirname as dirname16 } from "node:path";
35740
+ import { join as join47, dirname as dirname16 } from "node:path";
35587
35741
  import { fileURLToPath as fileURLToPath10 } from "node:url";
35588
35742
  var _dir, _packageRoot;
35589
35743
  var init_dist6 = __esm({
@@ -35594,7 +35748,7 @@ var init_dist6 = __esm({
35594
35748
  init_task_templates();
35595
35749
  init_render2();
35596
35750
  _dir = dirname16(fileURLToPath10(import.meta.url));
35597
- _packageRoot = join46(_dir, "..");
35751
+ _packageRoot = join47(_dir, "..");
35598
35752
  }
35599
35753
  });
35600
35754
 
@@ -35627,19 +35781,19 @@ __export(oa_directory_exports, {
35627
35781
  writeIndexData: () => writeIndexData,
35628
35782
  writeIndexMeta: () => writeIndexMeta
35629
35783
  });
35630
- import { existsSync as existsSync31, mkdirSync as mkdirSync11, readFileSync as readFileSync22, writeFileSync as writeFileSync12, readdirSync as readdirSync8, statSync as statSync11, unlinkSync as unlinkSync6 } from "node:fs";
35631
- import { join as join47, relative as relative2, basename as basename9, extname as extname8 } from "node:path";
35784
+ import { existsSync as existsSync32, mkdirSync as mkdirSync11, readFileSync as readFileSync23, writeFileSync as writeFileSync12, readdirSync as readdirSync8, statSync as statSync11, unlinkSync as unlinkSync6 } from "node:fs";
35785
+ import { join as join48, relative as relative2, basename as basename9, extname as extname8 } from "node:path";
35632
35786
  import { homedir as homedir9 } from "node:os";
35633
35787
  function initOaDirectory(repoRoot) {
35634
- const oaPath = join47(repoRoot, OA_DIR);
35788
+ const oaPath = join48(repoRoot, OA_DIR);
35635
35789
  for (const sub of SUBDIRS) {
35636
- mkdirSync11(join47(oaPath, sub), { recursive: true });
35790
+ mkdirSync11(join48(oaPath, sub), { recursive: true });
35637
35791
  }
35638
35792
  try {
35639
- const gitignorePath = join47(repoRoot, ".gitignore");
35793
+ const gitignorePath = join48(repoRoot, ".gitignore");
35640
35794
  const settingsPattern = ".oa/settings.json";
35641
- if (existsSync31(gitignorePath)) {
35642
- const content = readFileSync22(gitignorePath, "utf-8");
35795
+ if (existsSync32(gitignorePath)) {
35796
+ const content = readFileSync23(gitignorePath, "utf-8");
35643
35797
  if (!content.includes(settingsPattern)) {
35644
35798
  writeFileSync12(gitignorePath, content.trimEnd() + "\n" + settingsPattern + "\n", "utf-8");
35645
35799
  }
@@ -35649,41 +35803,41 @@ function initOaDirectory(repoRoot) {
35649
35803
  return oaPath;
35650
35804
  }
35651
35805
  function hasOaDirectory(repoRoot) {
35652
- return existsSync31(join47(repoRoot, OA_DIR, "index"));
35806
+ return existsSync32(join48(repoRoot, OA_DIR, "index"));
35653
35807
  }
35654
35808
  function loadProjectSettings(repoRoot) {
35655
- const settingsPath = join47(repoRoot, OA_DIR, "settings.json");
35809
+ const settingsPath = join48(repoRoot, OA_DIR, "settings.json");
35656
35810
  try {
35657
- if (existsSync31(settingsPath)) {
35658
- return JSON.parse(readFileSync22(settingsPath, "utf-8"));
35811
+ if (existsSync32(settingsPath)) {
35812
+ return JSON.parse(readFileSync23(settingsPath, "utf-8"));
35659
35813
  }
35660
35814
  } catch {
35661
35815
  }
35662
35816
  return {};
35663
35817
  }
35664
35818
  function saveProjectSettings(repoRoot, settings) {
35665
- const oaPath = join47(repoRoot, OA_DIR);
35819
+ const oaPath = join48(repoRoot, OA_DIR);
35666
35820
  mkdirSync11(oaPath, { recursive: true });
35667
35821
  const existing = loadProjectSettings(repoRoot);
35668
35822
  const merged = { ...existing, ...settings };
35669
- writeFileSync12(join47(oaPath, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
35823
+ writeFileSync12(join48(oaPath, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
35670
35824
  }
35671
35825
  function loadGlobalSettings() {
35672
- const settingsPath = join47(homedir9(), ".open-agents", "settings.json");
35826
+ const settingsPath = join48(homedir9(), ".open-agents", "settings.json");
35673
35827
  try {
35674
- if (existsSync31(settingsPath)) {
35675
- return JSON.parse(readFileSync22(settingsPath, "utf-8"));
35828
+ if (existsSync32(settingsPath)) {
35829
+ return JSON.parse(readFileSync23(settingsPath, "utf-8"));
35676
35830
  }
35677
35831
  } catch {
35678
35832
  }
35679
35833
  return {};
35680
35834
  }
35681
35835
  function saveGlobalSettings(settings) {
35682
- const dir = join47(homedir9(), ".open-agents");
35836
+ const dir = join48(homedir9(), ".open-agents");
35683
35837
  mkdirSync11(dir, { recursive: true });
35684
35838
  const existing = loadGlobalSettings();
35685
35839
  const merged = { ...existing, ...settings };
35686
- writeFileSync12(join47(dir, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
35840
+ writeFileSync12(join48(dir, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
35687
35841
  }
35688
35842
  function resolveSettings(repoRoot) {
35689
35843
  const global = loadGlobalSettings();
@@ -35698,12 +35852,12 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
35698
35852
  while (dir && !visited.has(dir)) {
35699
35853
  visited.add(dir);
35700
35854
  for (const name of CONTEXT_FILES) {
35701
- const filePath = join47(dir, name);
35855
+ const filePath = join48(dir, name);
35702
35856
  const normalizedName = name.toLowerCase();
35703
- if (existsSync31(filePath) && !seen.has(filePath)) {
35857
+ if (existsSync32(filePath) && !seen.has(filePath)) {
35704
35858
  seen.add(filePath);
35705
35859
  try {
35706
- let content = readFileSync22(filePath, "utf-8");
35860
+ let content = readFileSync23(filePath, "utf-8");
35707
35861
  if (content.length > maxContentLen) {
35708
35862
  content = content.slice(0, maxContentLen) + "\n\n...(truncated)";
35709
35863
  }
@@ -35717,11 +35871,11 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
35717
35871
  }
35718
35872
  }
35719
35873
  }
35720
- const projectMap = join47(dir, OA_DIR, "context", "project-map.md");
35721
- if (existsSync31(projectMap) && !seen.has(projectMap)) {
35874
+ const projectMap = join48(dir, OA_DIR, "context", "project-map.md");
35875
+ if (existsSync32(projectMap) && !seen.has(projectMap)) {
35722
35876
  seen.add(projectMap);
35723
35877
  try {
35724
- let content = readFileSync22(projectMap, "utf-8");
35878
+ let content = readFileSync23(projectMap, "utf-8");
35725
35879
  if (content.length > maxContentLen) {
35726
35880
  content = content.slice(0, maxContentLen) + "\n\n...(truncated)";
35727
35881
  }
@@ -35733,7 +35887,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
35733
35887
  } catch {
35734
35888
  }
35735
35889
  }
35736
- const parent = join47(dir, "..");
35890
+ const parent = join48(dir, "..");
35737
35891
  if (parent === dir)
35738
35892
  break;
35739
35893
  dir = parent;
@@ -35751,29 +35905,29 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
35751
35905
  return found;
35752
35906
  }
35753
35907
  function readIndexMeta(repoRoot) {
35754
- const metaPath = join47(repoRoot, OA_DIR, "index", "meta.json");
35908
+ const metaPath = join48(repoRoot, OA_DIR, "index", "meta.json");
35755
35909
  try {
35756
- return JSON.parse(readFileSync22(metaPath, "utf-8"));
35910
+ return JSON.parse(readFileSync23(metaPath, "utf-8"));
35757
35911
  } catch {
35758
35912
  return null;
35759
35913
  }
35760
35914
  }
35761
35915
  function writeIndexMeta(repoRoot, meta) {
35762
- const metaPath = join47(repoRoot, OA_DIR, "index", "meta.json");
35763
- mkdirSync11(join47(repoRoot, OA_DIR, "index"), { recursive: true });
35916
+ const metaPath = join48(repoRoot, OA_DIR, "index", "meta.json");
35917
+ mkdirSync11(join48(repoRoot, OA_DIR, "index"), { recursive: true });
35764
35918
  writeFileSync12(metaPath, JSON.stringify(meta, null, 2), "utf-8");
35765
35919
  }
35766
35920
  function readIndexData(repoRoot, filename) {
35767
- const filePath = join47(repoRoot, OA_DIR, "index", filename);
35921
+ const filePath = join48(repoRoot, OA_DIR, "index", filename);
35768
35922
  try {
35769
- return JSON.parse(readFileSync22(filePath, "utf-8"));
35923
+ return JSON.parse(readFileSync23(filePath, "utf-8"));
35770
35924
  } catch {
35771
35925
  return null;
35772
35926
  }
35773
35927
  }
35774
35928
  function writeIndexData(repoRoot, filename, data) {
35775
- const filePath = join47(repoRoot, OA_DIR, "index", filename);
35776
- mkdirSync11(join47(repoRoot, OA_DIR, "index"), { recursive: true });
35929
+ const filePath = join48(repoRoot, OA_DIR, "index", filename);
35930
+ mkdirSync11(join48(repoRoot, OA_DIR, "index"), { recursive: true });
35777
35931
  writeFileSync12(filePath, JSON.stringify(data, null, 2), "utf-8");
35778
35932
  }
35779
35933
  function generateProjectMap(repoRoot) {
@@ -35822,28 +35976,28 @@ ${tree}\`\`\`
35822
35976
  sections.push("");
35823
35977
  }
35824
35978
  const content = sections.join("\n");
35825
- const contextDir = join47(repoRoot, OA_DIR, "context");
35979
+ const contextDir = join48(repoRoot, OA_DIR, "context");
35826
35980
  mkdirSync11(contextDir, { recursive: true });
35827
- writeFileSync12(join47(contextDir, "project-map.md"), content, "utf-8");
35981
+ writeFileSync12(join48(contextDir, "project-map.md"), content, "utf-8");
35828
35982
  return content;
35829
35983
  }
35830
35984
  function saveSession(repoRoot, session) {
35831
- const historyDir = join47(repoRoot, OA_DIR, "history");
35985
+ const historyDir = join48(repoRoot, OA_DIR, "history");
35832
35986
  mkdirSync11(historyDir, { recursive: true });
35833
- writeFileSync12(join47(historyDir, `${session.id}.json`), JSON.stringify(session, null, 2), "utf-8");
35987
+ writeFileSync12(join48(historyDir, `${session.id}.json`), JSON.stringify(session, null, 2), "utf-8");
35834
35988
  }
35835
35989
  function loadRecentSessions(repoRoot, limit = 5) {
35836
- const historyDir = join47(repoRoot, OA_DIR, "history");
35837
- if (!existsSync31(historyDir))
35990
+ const historyDir = join48(repoRoot, OA_DIR, "history");
35991
+ if (!existsSync32(historyDir))
35838
35992
  return [];
35839
35993
  try {
35840
35994
  const files = readdirSync8(historyDir).filter((f) => f.endsWith(".json") && f !== "pending-task.json").map((f) => {
35841
- const stat5 = statSync11(join47(historyDir, f));
35995
+ const stat5 = statSync11(join48(historyDir, f));
35842
35996
  return { file: f, mtime: stat5.mtimeMs };
35843
35997
  }).sort((a, b) => b.mtime - a.mtime).slice(0, limit);
35844
35998
  return files.map((f) => {
35845
35999
  try {
35846
- return JSON.parse(readFileSync22(join47(historyDir, f.file), "utf-8"));
36000
+ return JSON.parse(readFileSync23(join48(historyDir, f.file), "utf-8"));
35847
36001
  } catch {
35848
36002
  return null;
35849
36003
  }
@@ -35853,16 +36007,16 @@ function loadRecentSessions(repoRoot, limit = 5) {
35853
36007
  }
35854
36008
  }
35855
36009
  function savePendingTask(repoRoot, task) {
35856
- const historyDir = join47(repoRoot, OA_DIR, "history");
36010
+ const historyDir = join48(repoRoot, OA_DIR, "history");
35857
36011
  mkdirSync11(historyDir, { recursive: true });
35858
- writeFileSync12(join47(historyDir, PENDING_TASK_FILE), JSON.stringify(task, null, 2) + "\n", "utf-8");
36012
+ writeFileSync12(join48(historyDir, PENDING_TASK_FILE), JSON.stringify(task, null, 2) + "\n", "utf-8");
35859
36013
  }
35860
36014
  function loadPendingTask(repoRoot) {
35861
- const filePath = join47(repoRoot, OA_DIR, "history", PENDING_TASK_FILE);
36015
+ const filePath = join48(repoRoot, OA_DIR, "history", PENDING_TASK_FILE);
35862
36016
  try {
35863
- if (!existsSync31(filePath))
36017
+ if (!existsSync32(filePath))
35864
36018
  return null;
35865
- const data = JSON.parse(readFileSync22(filePath, "utf-8"));
36019
+ const data = JSON.parse(readFileSync23(filePath, "utf-8"));
35866
36020
  try {
35867
36021
  unlinkSync6(filePath);
35868
36022
  } catch {
@@ -35873,13 +36027,13 @@ function loadPendingTask(repoRoot) {
35873
36027
  }
35874
36028
  }
35875
36029
  function saveSessionContext(repoRoot, entry) {
35876
- const contextDir = join47(repoRoot, OA_DIR, "context");
36030
+ const contextDir = join48(repoRoot, OA_DIR, "context");
35877
36031
  mkdirSync11(contextDir, { recursive: true });
35878
- const filePath = join47(contextDir, CONTEXT_SAVE_FILE);
36032
+ const filePath = join48(contextDir, CONTEXT_SAVE_FILE);
35879
36033
  let ctx;
35880
36034
  try {
35881
- if (existsSync31(filePath)) {
35882
- ctx = JSON.parse(readFileSync22(filePath, "utf-8"));
36035
+ if (existsSync32(filePath)) {
36036
+ ctx = JSON.parse(readFileSync23(filePath, "utf-8"));
35883
36037
  } else {
35884
36038
  ctx = { entries: [], maxEntries: MAX_CONTEXT_ENTRIES, updatedAt: "" };
35885
36039
  }
@@ -35894,11 +36048,11 @@ function saveSessionContext(repoRoot, entry) {
35894
36048
  writeFileSync12(filePath, JSON.stringify(ctx, null, 2) + "\n", "utf-8");
35895
36049
  }
35896
36050
  function loadSessionContext(repoRoot) {
35897
- const filePath = join47(repoRoot, OA_DIR, "context", CONTEXT_SAVE_FILE);
36051
+ const filePath = join48(repoRoot, OA_DIR, "context", CONTEXT_SAVE_FILE);
35898
36052
  try {
35899
- if (!existsSync31(filePath))
36053
+ if (!existsSync32(filePath))
35900
36054
  return null;
35901
- return JSON.parse(readFileSync22(filePath, "utf-8"));
36055
+ return JSON.parse(readFileSync23(filePath, "utf-8"));
35902
36056
  } catch {
35903
36057
  return null;
35904
36058
  }
@@ -35944,12 +36098,12 @@ function detectManifests(repoRoot) {
35944
36098
  { file: "docker-compose.yaml", type: "Docker Compose" }
35945
36099
  ];
35946
36100
  for (const check of checks) {
35947
- const filePath = join47(repoRoot, check.file);
35948
- if (existsSync31(filePath)) {
36101
+ const filePath = join48(repoRoot, check.file);
36102
+ if (existsSync32(filePath)) {
35949
36103
  let name;
35950
36104
  if (check.nameField) {
35951
36105
  try {
35952
- const data = JSON.parse(readFileSync22(filePath, "utf-8"));
36106
+ const data = JSON.parse(readFileSync23(filePath, "utf-8"));
35953
36107
  name = data[check.nameField];
35954
36108
  } catch {
35955
36109
  }
@@ -35978,7 +36132,7 @@ function findKeyFiles(repoRoot) {
35978
36132
  { pattern: "CLAUDE.md", description: "Claude Code context" }
35979
36133
  ];
35980
36134
  for (const check of checks) {
35981
- if (existsSync31(join47(repoRoot, check.pattern))) {
36135
+ if (existsSync32(join48(repoRoot, check.pattern))) {
35982
36136
  keyFiles.push({ path: check.pattern, description: check.description });
35983
36137
  }
35984
36138
  }
@@ -36004,12 +36158,12 @@ function buildDirTree(root, maxDepth, prefix = "", depth = 0) {
36004
36158
  if (entry.isDirectory()) {
36005
36159
  let fileCount = 0;
36006
36160
  try {
36007
- fileCount = readdirSync8(join47(root, entry.name)).filter((f) => !f.startsWith(".")).length;
36161
+ fileCount = readdirSync8(join48(root, entry.name)).filter((f) => !f.startsWith(".")).length;
36008
36162
  } catch {
36009
36163
  }
36010
36164
  result += `${prefix}${connector}${entry.name}/ (${fileCount})
36011
36165
  `;
36012
- result += buildDirTree(join47(root, entry.name), maxDepth, childPrefix, depth + 1);
36166
+ result += buildDirTree(join48(root, entry.name), maxDepth, childPrefix, depth + 1);
36013
36167
  } else if (depth < maxDepth) {
36014
36168
  result += `${prefix}${connector}${entry.name}
36015
36169
  `;
@@ -36021,15 +36175,15 @@ function buildDirTree(root, maxDepth, prefix = "", depth = 0) {
36021
36175
  }
36022
36176
  function loadUsageFile(filePath) {
36023
36177
  try {
36024
- if (existsSync31(filePath)) {
36025
- return JSON.parse(readFileSync22(filePath, "utf-8"));
36178
+ if (existsSync32(filePath)) {
36179
+ return JSON.parse(readFileSync23(filePath, "utf-8"));
36026
36180
  }
36027
36181
  } catch {
36028
36182
  }
36029
36183
  return { records: [] };
36030
36184
  }
36031
36185
  function saveUsageFile(filePath, data) {
36032
- const dir = join47(filePath, "..");
36186
+ const dir = join48(filePath, "..");
36033
36187
  mkdirSync11(dir, { recursive: true });
36034
36188
  writeFileSync12(filePath, JSON.stringify(data, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
36035
36189
  }
@@ -36059,15 +36213,15 @@ function recordUsage(kind, value, opts) {
36059
36213
  }
36060
36214
  saveUsageFile(filePath, data);
36061
36215
  };
36062
- update(join47(homedir9(), ".open-agents", USAGE_HISTORY_FILE));
36216
+ update(join48(homedir9(), ".open-agents", USAGE_HISTORY_FILE));
36063
36217
  if (opts?.repoRoot) {
36064
- update(join47(opts.repoRoot, OA_DIR, USAGE_HISTORY_FILE));
36218
+ update(join48(opts.repoRoot, OA_DIR, USAGE_HISTORY_FILE));
36065
36219
  }
36066
36220
  }
36067
36221
  function loadUsageHistory(kind, repoRoot) {
36068
- const globalPath = join47(homedir9(), ".open-agents", USAGE_HISTORY_FILE);
36222
+ const globalPath = join48(homedir9(), ".open-agents", USAGE_HISTORY_FILE);
36069
36223
  const globalData = loadUsageFile(globalPath);
36070
- const localData = repoRoot ? loadUsageFile(join47(repoRoot, OA_DIR, USAGE_HISTORY_FILE)) : { records: [] };
36224
+ const localData = repoRoot ? loadUsageFile(join48(repoRoot, OA_DIR, USAGE_HISTORY_FILE)) : { records: [] };
36071
36225
  const map = /* @__PURE__ */ new Map();
36072
36226
  for (const r of globalData.records) {
36073
36227
  if (r.kind !== kind)
@@ -36098,9 +36252,9 @@ function deleteUsageRecord(kind, value, repoRoot) {
36098
36252
  saveUsageFile(filePath, data);
36099
36253
  }
36100
36254
  };
36101
- remove(join47(homedir9(), ".open-agents", USAGE_HISTORY_FILE));
36255
+ remove(join48(homedir9(), ".open-agents", USAGE_HISTORY_FILE));
36102
36256
  if (repoRoot) {
36103
- remove(join47(repoRoot, OA_DIR, USAGE_HISTORY_FILE));
36257
+ remove(join48(repoRoot, OA_DIR, USAGE_HISTORY_FILE));
36104
36258
  }
36105
36259
  }
36106
36260
  var OA_DIR, SUBDIRS, CONTEXT_FILES, PENDING_TASK_FILE, CONTEXT_SAVE_FILE, MAX_CONTEXT_ENTRIES, SKIP_DIRS, USAGE_HISTORY_FILE, MAX_HISTORY_RECORDS;
@@ -36150,8 +36304,8 @@ var init_oa_directory = __esm({
36150
36304
  import * as readline from "node:readline";
36151
36305
  import { execSync as execSync24, spawn as spawn18, exec as exec2 } from "node:child_process";
36152
36306
  import { promisify as promisify5 } from "node:util";
36153
- import { existsSync as existsSync32, writeFileSync as writeFileSync13, readFileSync as readFileSync23, appendFileSync as appendFileSync2, mkdirSync as mkdirSync12 } from "node:fs";
36154
- import { join as join48 } from "node:path";
36307
+ import { existsSync as existsSync33, writeFileSync as writeFileSync13, readFileSync as readFileSync24, appendFileSync as appendFileSync2, mkdirSync as mkdirSync12 } from "node:fs";
36308
+ import { join as join49 } from "node:path";
36155
36309
  import { homedir as homedir10, platform } from "node:os";
36156
36310
  function detectSystemSpecs() {
36157
36311
  let totalRamGB = 0;
@@ -36438,7 +36592,7 @@ async function installOllamaMac(_rl) {
36438
36592
  execSync24('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"', { stdio: "inherit", timeout: 6e5 });
36439
36593
  if (!hasCmd("brew")) {
36440
36594
  try {
36441
- const brewPrefix = existsSync32("/opt/homebrew/bin/brew") ? "/opt/homebrew" : "/usr/local";
36595
+ const brewPrefix = existsSync33("/opt/homebrew/bin/brew") ? "/opt/homebrew" : "/usr/local";
36442
36596
  process.env["PATH"] = `${brewPrefix}/bin:${process.env["PATH"]}`;
36443
36597
  } catch {
36444
36598
  }
@@ -37192,9 +37346,9 @@ async function doSetup(config, rl) {
37192
37346
  `PARAMETER num_predict ${numPredict}`,
37193
37347
  `PARAMETER stop "<|endoftext|>"`
37194
37348
  ].join("\n");
37195
- const modelDir2 = join48(homedir10(), ".open-agents", "models");
37349
+ const modelDir2 = join49(homedir10(), ".open-agents", "models");
37196
37350
  mkdirSync12(modelDir2, { recursive: true });
37197
- const modelfilePath = join48(modelDir2, `Modelfile.${customName}`);
37351
+ const modelfilePath = join49(modelDir2, `Modelfile.${customName}`);
37198
37352
  writeFileSync13(modelfilePath, modelfileContent + "\n", "utf8");
37199
37353
  process.stdout.write(` ${c2.dim("Creating model...")} `);
37200
37354
  execSync24(`ollama create ${customName} -f ${modelfilePath}`, {
@@ -37240,7 +37394,7 @@ async function isModelAvailable(config) {
37240
37394
  }
37241
37395
  function isFirstRun() {
37242
37396
  try {
37243
- return !existsSync32(join48(homedir10(), ".open-agents", "config.json"));
37397
+ return !existsSync33(join49(homedir10(), ".open-agents", "config.json"));
37244
37398
  } catch {
37245
37399
  return true;
37246
37400
  }
@@ -37277,7 +37431,7 @@ function detectPkgManager() {
37277
37431
  return null;
37278
37432
  }
37279
37433
  function getVenvDir() {
37280
- return join48(homedir10(), ".open-agents", "venv");
37434
+ return join49(homedir10(), ".open-agents", "venv");
37281
37435
  }
37282
37436
  function hasVenvModule() {
37283
37437
  try {
@@ -37289,8 +37443,8 @@ function hasVenvModule() {
37289
37443
  }
37290
37444
  function ensureVenv(log) {
37291
37445
  const venvDir = getVenvDir();
37292
- const venvPip = join48(venvDir, "bin", "pip");
37293
- if (existsSync32(venvPip))
37446
+ const venvPip = join49(venvDir, "bin", "pip");
37447
+ if (existsSync33(venvPip))
37294
37448
  return venvDir;
37295
37449
  log("Creating Python venv for vision deps...");
37296
37450
  if (!hasCmd("python3")) {
@@ -37302,9 +37456,9 @@ function ensureVenv(log) {
37302
37456
  return null;
37303
37457
  }
37304
37458
  try {
37305
- mkdirSync12(join48(homedir10(), ".open-agents"), { recursive: true });
37459
+ mkdirSync12(join49(homedir10(), ".open-agents"), { recursive: true });
37306
37460
  execSync24(`python3 -m venv "${venvDir}"`, { stdio: "pipe", timeout: 3e4 });
37307
- execSync24(`"${join48(venvDir, "bin", "pip")}" install --upgrade pip`, {
37461
+ execSync24(`"${join49(venvDir, "bin", "pip")}" install --upgrade pip`, {
37308
37462
  stdio: "pipe",
37309
37463
  timeout: 6e4
37310
37464
  });
@@ -37495,15 +37649,15 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
37495
37649
  }
37496
37650
  }
37497
37651
  const venvDir = getVenvDir();
37498
- const venvBin = join48(venvDir, "bin");
37499
- const venvMoondream = join48(venvBin, "moondream-station");
37652
+ const venvBin = join49(venvDir, "bin");
37653
+ const venvMoondream = join49(venvBin, "moondream-station");
37500
37654
  const venv = ensureVenv(log);
37501
- if (venv && !hasCmd("moondream-station") && !existsSync32(venvMoondream)) {
37502
- const venvPip = join48(venvBin, "pip");
37655
+ if (venv && !hasCmd("moondream-station") && !existsSync33(venvMoondream)) {
37656
+ const venvPip = join49(venvBin, "pip");
37503
37657
  log("Installing moondream-station in ~/.open-agents/venv...");
37504
37658
  try {
37505
37659
  execSync24(`"${venvPip}" install moondream-station`, { stdio: "pipe", timeout: 3e5 });
37506
- if (existsSync32(venvMoondream)) {
37660
+ if (existsSync33(venvMoondream)) {
37507
37661
  log("moondream-station installed successfully.");
37508
37662
  } else {
37509
37663
  try {
@@ -37520,8 +37674,8 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
37520
37674
  }
37521
37675
  }
37522
37676
  if (venv) {
37523
- const venvPython = join48(venvBin, "python");
37524
- const venvPip2 = join48(venvBin, "pip");
37677
+ const venvPython = join49(venvBin, "python");
37678
+ const venvPip2 = join49(venvBin, "pip");
37525
37679
  let ocrStackInstalled = false;
37526
37680
  try {
37527
37681
  execSync24(`"${venvPython}" -c "import cv2, pytesseract, numpy, PIL"`, { stdio: "pipe", timeout: 1e4 });
@@ -37665,9 +37819,9 @@ async function createExpandedVariantAsync(baseModel, specs, sizeGB, kvBytesPerTo
37665
37819
  `PARAMETER num_predict ${numPredict}`,
37666
37820
  `PARAMETER stop "<|endoftext|>"`
37667
37821
  ].join("\n");
37668
- const modelDir2 = join48(homedir10(), ".open-agents", "models");
37822
+ const modelDir2 = join49(homedir10(), ".open-agents", "models");
37669
37823
  mkdirSync12(modelDir2, { recursive: true });
37670
- const modelfilePath = join48(modelDir2, `Modelfile.${customName}`);
37824
+ const modelfilePath = join49(modelDir2, `Modelfile.${customName}`);
37671
37825
  writeFileSync13(modelfilePath, modelfileContent + "\n", "utf8");
37672
37826
  await execAsync(`ollama create ${customName} -f ${modelfilePath}`, {
37673
37827
  timeout: 12e4
@@ -37742,8 +37896,8 @@ async function ensureNeovim() {
37742
37896
  const platform5 = process.platform;
37743
37897
  const arch = process.arch;
37744
37898
  if (platform5 === "linux") {
37745
- const binDir = join48(homedir10(), ".local", "bin");
37746
- const nvimDest = join48(binDir, "nvim");
37899
+ const binDir = join49(homedir10(), ".local", "bin");
37900
+ const nvimDest = join49(binDir, "nvim");
37747
37901
  try {
37748
37902
  mkdirSync12(binDir, { recursive: true });
37749
37903
  } catch {
@@ -37814,9 +37968,9 @@ async function ensureNeovim() {
37814
37968
  }
37815
37969
  function ensurePathInShellRc(binDir) {
37816
37970
  const shell = process.env.SHELL ?? "";
37817
- const rcFile = shell.includes("zsh") ? join48(homedir10(), ".zshrc") : join48(homedir10(), ".bashrc");
37971
+ const rcFile = shell.includes("zsh") ? join49(homedir10(), ".zshrc") : join49(homedir10(), ".bashrc");
37818
37972
  try {
37819
- const rcContent = existsSync32(rcFile) ? readFileSync23(rcFile, "utf8") : "";
37973
+ const rcContent = existsSync33(rcFile) ? readFileSync24(rcFile, "utf8") : "";
37820
37974
  if (rcContent.includes(binDir))
37821
37975
  return;
37822
37976
  const exportLine = `
@@ -38052,7 +38206,7 @@ function tuiSelect(opts) {
38052
38206
  }
38053
38207
  stdin.resume();
38054
38208
  enterOverlay();
38055
- overlayWrite("\x1B[?1049h\x1B[48;5;234m\x1B[2J\x1B[H\x1B[?25l\x1B[?1002h\x1B[?1006h");
38209
+ overlayWrite("\x1B[?1049h\x1B[48;5;234m\x1B[2J\x1B[H\x1B[?25l\x1B[?1003h\x1B[?1006h");
38056
38210
  let listRowOffset = 0;
38057
38211
  function clampScroll(displayList) {
38058
38212
  const cursorPos = displayList.indexOf(cursor);
@@ -38155,7 +38309,7 @@ function tuiSelect(opts) {
38155
38309
  function cleanup() {
38156
38310
  stdin.removeListener("data", onData);
38157
38311
  process.stdout.removeListener("resize", onResize);
38158
- overlayWrite("\x1B[?1002l\x1B[?1006l\x1B[?1049l\x1B[?25h");
38312
+ overlayWrite("\x1B[?1003l\x1B[?1002l\x1B[?1006l\x1B[?1049l\x1B[?25h");
38159
38313
  leaveOverlay();
38160
38314
  if (typeof stdin.setRawMode === "function") {
38161
38315
  stdin.setRawMode(hadRawMode ?? false);
@@ -38169,12 +38323,16 @@ function tuiSelect(opts) {
38169
38323
  }
38170
38324
  }
38171
38325
  function onData(chunk) {
38172
- const seq = chunk.toString("utf8");
38173
- const mouseMatch = seq.match(/\x1B\[<(\d+);(\d+);(\d+)([Mm])/);
38174
- if (mouseMatch) {
38175
- const btn = parseInt(mouseMatch[1]);
38176
- const mRow = parseInt(mouseMatch[3]);
38177
- const suffix = mouseMatch[4];
38326
+ let seq = chunk.toString("utf8");
38327
+ const mouseRe = /\x1B\[<(\d+);(\d+);(\d+)([Mm])/g;
38328
+ let mouseProcessed = false;
38329
+ let mouseM;
38330
+ while ((mouseM = mouseRe.exec(seq)) !== null) {
38331
+ mouseProcessed = true;
38332
+ const btn = parseInt(mouseM[1]);
38333
+ const mCol = parseInt(mouseM[2]);
38334
+ const mRow = parseInt(mouseM[3]);
38335
+ const suffix = mouseM[4];
38178
38336
  if (btn === 0 && suffix === "M") {
38179
38337
  const listIdx = mRow - listRowOffset - 1;
38180
38338
  if (listIdx >= 0 && listIdx < maxVisible) {
@@ -38213,8 +38371,56 @@ function tuiSelect(opts) {
38213
38371
  }
38214
38372
  }
38215
38373
  }
38216
- return;
38374
+ if ((btn === 35 || btn === 32 || btn === 67) && suffix === "M") {
38375
+ const listIdx = mRow - listRowOffset - 1;
38376
+ if (listIdx >= 0 && listIdx < maxVisible) {
38377
+ let displayList;
38378
+ if (filter) {
38379
+ displayList = [];
38380
+ for (let i = 0; i < items.length; i++) {
38381
+ if (matchSet.has(i) || isSkippable(i))
38382
+ displayList.push(i);
38383
+ }
38384
+ displayList = displayList.filter((idx, pos) => {
38385
+ if (!isSkippable(idx))
38386
+ return true;
38387
+ for (let j = pos + 1; j < displayList.length; j++) {
38388
+ if (!isSkippable(displayList[j]))
38389
+ return true;
38390
+ break;
38391
+ }
38392
+ return false;
38393
+ });
38394
+ } else {
38395
+ displayList = items.map((_, i) => i);
38396
+ }
38397
+ const vi = scrollOffset + listIdx;
38398
+ if (vi < displayList.length) {
38399
+ const itemIdx = displayList[vi];
38400
+ if (!isSkippable(itemIdx) && itemIdx !== cursor) {
38401
+ cursor = itemIdx;
38402
+ render();
38403
+ }
38404
+ }
38405
+ }
38406
+ }
38407
+ if (btn === 64) {
38408
+ const next = findSelectable(cursor - 1, -1);
38409
+ if (next >= 0 && next !== cursor) {
38410
+ cursor = next;
38411
+ render();
38412
+ }
38413
+ } else if (btn === 65) {
38414
+ const next = findSelectable(cursor + 1, 1);
38415
+ if (next >= 0 && next !== cursor) {
38416
+ cursor = next;
38417
+ render();
38418
+ }
38419
+ }
38217
38420
  }
38421
+ seq = seq.replace(mouseRe, "");
38422
+ if (!seq && mouseProcessed)
38423
+ return;
38218
38424
  if (deleteConfirmIdx >= 0) {
38219
38425
  if (seq === "\x1B[D") {
38220
38426
  deleteConfirmSel = true;
@@ -38479,7 +38685,7 @@ var init_tui_select = __esm({
38479
38685
  });
38480
38686
 
38481
38687
  // packages/cli/dist/tui/drop-panel.js
38482
- import { existsSync as existsSync33 } from "node:fs";
38688
+ import { existsSync as existsSync34 } from "node:fs";
38483
38689
  import { extname as extname9, resolve as resolve27 } from "node:path";
38484
38690
  function ansi4(code, text) {
38485
38691
  return isTTY4 ? `\x1B[${code}m${text}\x1B[0m` : text;
@@ -38594,7 +38800,7 @@ function showDropPanel(opts) {
38594
38800
  filePath = decodeURIComponent(filePath.slice(7));
38595
38801
  }
38596
38802
  filePath = resolve27(filePath);
38597
- if (!existsSync33(filePath)) {
38803
+ if (!existsSync34(filePath)) {
38598
38804
  errorMsg = `File not found: ${filePath}`;
38599
38805
  render();
38600
38806
  return;
@@ -38665,9 +38871,9 @@ var init_drop_panel = __esm({
38665
38871
  });
38666
38872
 
38667
38873
  // packages/cli/dist/tui/neovim-mode.js
38668
- import { existsSync as existsSync34, unlinkSync as unlinkSync7 } from "node:fs";
38874
+ import { existsSync as existsSync35, unlinkSync as unlinkSync7 } from "node:fs";
38669
38875
  import { tmpdir as tmpdir8 } from "node:os";
38670
- import { join as join49 } from "node:path";
38876
+ import { join as join50 } from "node:path";
38671
38877
  import { execSync as execSync25 } from "node:child_process";
38672
38878
  function isNeovimActive() {
38673
38879
  return _state !== null && !_state.cleanedUp;
@@ -38715,9 +38921,9 @@ async function startNeovimMode(opts) {
38715
38921
  );
38716
38922
  } catch {
38717
38923
  }
38718
- const socketPath = join49(tmpdir8(), `oa-nvim-${process.pid}-${Date.now()}.sock`);
38924
+ const socketPath = join50(tmpdir8(), `oa-nvim-${process.pid}-${Date.now()}.sock`);
38719
38925
  try {
38720
- if (existsSync34(socketPath))
38926
+ if (existsSync35(socketPath))
38721
38927
  unlinkSync7(socketPath);
38722
38928
  } catch {
38723
38929
  }
@@ -38944,13 +39150,13 @@ function resizeNeovim(cols, contentRows) {
38944
39150
  }
38945
39151
  async function connectRPC(state, neovimPkg, cols) {
38946
39152
  let attempts = 0;
38947
- while (!existsSync34(state.socketPath) && attempts < 30) {
39153
+ while (!existsSync35(state.socketPath) && attempts < 30) {
38948
39154
  await new Promise((r) => setTimeout(r, 200));
38949
39155
  attempts++;
38950
39156
  if (state.cleanedUp)
38951
39157
  return;
38952
39158
  }
38953
- if (!existsSync34(state.socketPath))
39159
+ if (!existsSync35(state.socketPath))
38954
39160
  return;
38955
39161
  const nvim = neovimPkg.attach({ socket: state.socketPath });
38956
39162
  state.nvim = nvim;
@@ -39087,7 +39293,7 @@ function doCleanup(state) {
39087
39293
  state.pty = null;
39088
39294
  }
39089
39295
  try {
39090
- if (existsSync34(state.socketPath))
39296
+ if (existsSync35(state.socketPath))
39091
39297
  unlinkSync7(state.socketPath);
39092
39298
  } catch {
39093
39299
  }
@@ -39144,8 +39350,8 @@ __export(voice_exports, {
39144
39350
  registerCustomOnnxModel: () => registerCustomOnnxModel,
39145
39351
  resetNarrationContext: () => resetNarrationContext
39146
39352
  });
39147
- import { existsSync as existsSync35, mkdirSync as mkdirSync13, writeFileSync as writeFileSync14, readFileSync as readFileSync24, unlinkSync as unlinkSync8, readdirSync as readdirSync9, renameSync, statSync as statSync12 } from "node:fs";
39148
- import { join as join50, dirname as dirname17 } from "node:path";
39353
+ import { existsSync as existsSync36, mkdirSync as mkdirSync13, writeFileSync as writeFileSync14, readFileSync as readFileSync25, unlinkSync as unlinkSync8, readdirSync as readdirSync9, renameSync, statSync as statSync12 } from "node:fs";
39354
+ import { join as join51, dirname as dirname17 } from "node:path";
39149
39355
  import { homedir as homedir11, tmpdir as tmpdir9, platform as platform2 } from "node:os";
39150
39356
  import { execSync as execSync26, spawn as nodeSpawn } from "node:child_process";
39151
39357
  import { createRequire } from "node:module";
@@ -39170,37 +39376,37 @@ function listVoiceModels() {
39170
39376
  }));
39171
39377
  }
39172
39378
  function voiceDir() {
39173
- return join50(homedir11(), ".open-agents", "voice");
39379
+ return join51(homedir11(), ".open-agents", "voice");
39174
39380
  }
39175
39381
  function modelsDir() {
39176
- return join50(voiceDir(), "models");
39382
+ return join51(voiceDir(), "models");
39177
39383
  }
39178
39384
  function modelDir(id) {
39179
- return join50(modelsDir(), id);
39385
+ return join51(modelsDir(), id);
39180
39386
  }
39181
39387
  function modelOnnxPath(id) {
39182
- return join50(modelDir(id), "model.onnx");
39388
+ return join51(modelDir(id), "model.onnx");
39183
39389
  }
39184
39390
  function modelConfigPath(id) {
39185
- return join50(modelDir(id), "config.json");
39391
+ return join51(modelDir(id), "config.json");
39186
39392
  }
39187
39393
  function luxttsVenvDir() {
39188
- return join50(voiceDir(), "luxtts-venv");
39394
+ return join51(voiceDir(), "luxtts-venv");
39189
39395
  }
39190
39396
  function luxttsVenvPy() {
39191
- return platform2() === "win32" ? join50(luxttsVenvDir(), "Scripts", "python.exe") : join50(luxttsVenvDir(), "bin", "python3");
39397
+ return platform2() === "win32" ? join51(luxttsVenvDir(), "Scripts", "python.exe") : join51(luxttsVenvDir(), "bin", "python3");
39192
39398
  }
39193
39399
  function luxttsRepoDir() {
39194
- return join50(voiceDir(), "LuxTTS");
39400
+ return join51(voiceDir(), "LuxTTS");
39195
39401
  }
39196
39402
  function luxttsCloneRefsDir() {
39197
- return join50(voiceDir(), "clone-refs");
39403
+ return join51(voiceDir(), "clone-refs");
39198
39404
  }
39199
39405
  function luxttsInferScript() {
39200
- return join50(voiceDir(), "luxtts-infer.py");
39406
+ return join51(voiceDir(), "luxtts-infer.py");
39201
39407
  }
39202
39408
  function writeDetectTorchScript(targetPath) {
39203
- if (existsSync35(targetPath))
39409
+ if (existsSync36(targetPath))
39204
39410
  return;
39205
39411
  try {
39206
39412
  mkdirSync13(dirname17(targetPath), { recursive: true });
@@ -40086,8 +40292,8 @@ var init_voice = __esm({
40086
40292
  const refsDir = luxttsCloneRefsDir();
40087
40293
  const targets = ["glados", "overwatch"];
40088
40294
  for (const modelId of targets) {
40089
- const refFile = join50(refsDir, `${modelId}-ref.wav`);
40090
- if (existsSync35(refFile))
40295
+ const refFile = join51(refsDir, `${modelId}-ref.wav`);
40296
+ if (existsSync36(refFile))
40091
40297
  continue;
40092
40298
  try {
40093
40299
  await this.generateCloneRef(modelId);
@@ -40166,23 +40372,23 @@ var init_voice = __esm({
40166
40372
  }
40167
40373
  p = p.replace(/\\ /g, " ");
40168
40374
  if (p.startsWith("~/") || p === "~") {
40169
- p = join50(homedir11(), p.slice(1));
40375
+ p = join51(homedir11(), p.slice(1));
40170
40376
  }
40171
- if (!existsSync35(p)) {
40377
+ if (!existsSync36(p)) {
40172
40378
  return `File not found: ${p}
40173
40379
  (original input: ${audioPath})`;
40174
40380
  }
40175
40381
  audioPath = p;
40176
40382
  const refsDir = luxttsCloneRefsDir();
40177
- if (!existsSync35(refsDir))
40383
+ if (!existsSync36(refsDir))
40178
40384
  mkdirSync13(refsDir, { recursive: true });
40179
40385
  const ext = audioPath.split(".").pop() || "wav";
40180
40386
  const srcName = (audioPath.split("/").pop() ?? "clone").replace(/\.[^.]+$/, "").replace(/[^a-zA-Z0-9_-]/g, "-");
40181
40387
  const ts = Date.now().toString(36);
40182
40388
  const destFilename = `clone-${srcName}-${ts}.${ext}`;
40183
- const destPath = join50(refsDir, destFilename);
40389
+ const destPath = join51(refsDir, destFilename);
40184
40390
  try {
40185
- const data = readFileSync24(audioPath);
40391
+ const data = readFileSync25(audioPath);
40186
40392
  writeFileSync14(destPath, data);
40187
40393
  } catch (err) {
40188
40394
  return `Failed to copy audio file: ${err instanceof Error ? err.message : String(err)}`;
@@ -40223,9 +40429,9 @@ var init_voice = __esm({
40223
40429
  return `Failed to synthesize reference audio from ${source.label}.`;
40224
40430
  }
40225
40431
  const refsDir = luxttsCloneRefsDir();
40226
- if (!existsSync35(refsDir))
40432
+ if (!existsSync36(refsDir))
40227
40433
  mkdirSync13(refsDir, { recursive: true });
40228
- const destPath = join50(refsDir, `${sourceModelId}-ref.wav`);
40434
+ const destPath = join51(refsDir, `${sourceModelId}-ref.wav`);
40229
40435
  const sampleRate = this.config?.audio?.sample_rate ?? 22050;
40230
40436
  this.writeWav(audioData, sampleRate, destPath);
40231
40437
  this.luxttsCloneRef = destPath;
@@ -40241,21 +40447,21 @@ var init_voice = __esm({
40241
40447
  // -------------------------------------------------------------------------
40242
40448
  /** Metadata file for friendly names of clone refs */
40243
40449
  static cloneMetaFile() {
40244
- return join50(luxttsCloneRefsDir(), "meta.json");
40450
+ return join51(luxttsCloneRefsDir(), "meta.json");
40245
40451
  }
40246
40452
  loadCloneMeta() {
40247
40453
  const p = _VoiceEngine.cloneMetaFile();
40248
- if (!existsSync35(p))
40454
+ if (!existsSync36(p))
40249
40455
  return {};
40250
40456
  try {
40251
- return JSON.parse(readFileSync24(p, "utf8"));
40457
+ return JSON.parse(readFileSync25(p, "utf8"));
40252
40458
  } catch {
40253
40459
  return {};
40254
40460
  }
40255
40461
  }
40256
40462
  saveCloneMeta(meta) {
40257
40463
  const dir = luxttsCloneRefsDir();
40258
- if (!existsSync35(dir))
40464
+ if (!existsSync36(dir))
40259
40465
  mkdirSync13(dir, { recursive: true });
40260
40466
  writeFileSync14(_VoiceEngine.cloneMetaFile(), JSON.stringify(meta, null, 2));
40261
40467
  }
@@ -40267,7 +40473,7 @@ var init_voice = __esm({
40267
40473
  */
40268
40474
  listCloneRefs() {
40269
40475
  const dir = luxttsCloneRefsDir();
40270
- if (!existsSync35(dir))
40476
+ if (!existsSync36(dir))
40271
40477
  return [];
40272
40478
  const meta = this.loadCloneMeta();
40273
40479
  const files = readdirSync9(dir).filter((f) => {
@@ -40275,7 +40481,7 @@ var init_voice = __esm({
40275
40481
  return _VoiceEngine.AUDIO_EXTS.has(ext);
40276
40482
  });
40277
40483
  return files.map((f) => {
40278
- const p = join50(dir, f);
40484
+ const p = join51(dir, f);
40279
40485
  let size = 0;
40280
40486
  try {
40281
40487
  size = statSync12(p).size;
@@ -40292,8 +40498,8 @@ var init_voice = __esm({
40292
40498
  }
40293
40499
  /** Delete a clone reference file by filename. Returns true if deleted. */
40294
40500
  deleteCloneRef(filename) {
40295
- const p = join50(luxttsCloneRefsDir(), filename);
40296
- if (!existsSync35(p))
40501
+ const p = join51(luxttsCloneRefsDir(), filename);
40502
+ if (!existsSync36(p))
40297
40503
  return false;
40298
40504
  try {
40299
40505
  unlinkSync8(p);
@@ -40317,8 +40523,8 @@ var init_voice = __esm({
40317
40523
  }
40318
40524
  /** Set the active clone reference by filename. */
40319
40525
  setActiveCloneRef(filename) {
40320
- const p = join50(luxttsCloneRefsDir(), filename);
40321
- if (!existsSync35(p))
40526
+ const p = join51(luxttsCloneRefsDir(), filename);
40527
+ if (!existsSync36(p))
40322
40528
  return `File not found: ${filename}`;
40323
40529
  this.luxttsCloneRef = p;
40324
40530
  return `Active clone voice set to: ${filename}`;
@@ -40643,7 +40849,7 @@ var init_voice = __esm({
40643
40849
  }
40644
40850
  this.onPCMOutput(Buffer.from(int16.buffer), sampleRate);
40645
40851
  }
40646
- const wavPath = join50(tmpdir9(), `oa-voice-${Date.now()}.wav`);
40852
+ const wavPath = join51(tmpdir9(), `oa-voice-${Date.now()}.wav`);
40647
40853
  this.writeStereoWav(stereo.left, stereo.right, sampleRate, wavPath);
40648
40854
  await this.playWav(wavPath);
40649
40855
  try {
@@ -41036,7 +41242,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
41036
41242
  const mlxModelId = model.mlxModelId ?? "mlx-community/Kokoro-82M-bf16";
41037
41243
  const mlxVoice = model.mlxVoice ?? "af_heart";
41038
41244
  const mlxLangCode = model.mlxLangCode ?? "a";
41039
- const wavPath = join50(tmpdir9(), `oa-mlx-${Date.now()}.wav`);
41245
+ const wavPath = join51(tmpdir9(), `oa-mlx-${Date.now()}.wav`);
41040
41246
  const pyScript = [
41041
41247
  "import sys, json",
41042
41248
  "from mlx_audio.tts import generate as tts_gen",
@@ -41053,11 +41259,11 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
41053
41259
  return;
41054
41260
  }
41055
41261
  }
41056
- if (!existsSync35(wavPath))
41262
+ if (!existsSync36(wavPath))
41057
41263
  return;
41058
41264
  if (volume !== 1) {
41059
41265
  try {
41060
- const wavData = readFileSync24(wavPath);
41266
+ const wavData = readFileSync25(wavPath);
41061
41267
  if (wavData.length > 44) {
41062
41268
  const header = wavData.subarray(0, 44);
41063
41269
  const samples = new Int16Array(wavData.buffer, wavData.byteOffset + 44, (wavData.length - 44) / 2);
@@ -41072,7 +41278,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
41072
41278
  }
41073
41279
  if (this.onPCMOutput) {
41074
41280
  try {
41075
- const wavData = readFileSync24(wavPath);
41281
+ const wavData = readFileSync25(wavPath);
41076
41282
  if (wavData.length > 44) {
41077
41283
  const pcm = Buffer.from(wavData.buffer, wavData.byteOffset + 44, wavData.length - 44);
41078
41284
  const sampleRate = wavData.readUInt32LE(24);
@@ -41104,7 +41310,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
41104
41310
  const mlxModelId = model.mlxModelId ?? "mlx-community/Kokoro-82M-bf16";
41105
41311
  const mlxVoice = model.mlxVoice ?? "af_heart";
41106
41312
  const mlxLangCode = model.mlxLangCode ?? "a";
41107
- const wavPath = join50(tmpdir9(), `oa-mlx-buf-${Date.now()}.wav`);
41313
+ const wavPath = join51(tmpdir9(), `oa-mlx-buf-${Date.now()}.wav`);
41108
41314
  const pyScript = [
41109
41315
  "import sys, json",
41110
41316
  "from mlx_audio.tts import generate as tts_gen",
@@ -41121,10 +41327,10 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
41121
41327
  return null;
41122
41328
  }
41123
41329
  }
41124
- if (!existsSync35(wavPath))
41330
+ if (!existsSync36(wavPath))
41125
41331
  return null;
41126
41332
  try {
41127
- const data = readFileSync24(wavPath);
41333
+ const data = readFileSync25(wavPath);
41128
41334
  unlinkSync8(wavPath);
41129
41335
  return data;
41130
41336
  } catch {
@@ -41147,7 +41353,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
41147
41353
  }
41148
41354
  const venvDir = luxttsVenvDir();
41149
41355
  const venvPy = luxttsVenvPy();
41150
- if (existsSync35(venvPy)) {
41356
+ if (existsSync36(venvPy)) {
41151
41357
  try {
41152
41358
  await this.asyncShell(`${venvPy} -c "import sys; sys.path.insert(0, '${luxttsRepoDir()}'); from zipvoice.luxvoice import LuxTTS; print('ok')"`, 3e4);
41153
41359
  let hasCudaSys = false;
@@ -41161,7 +41367,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
41161
41367
  if (torchCheck === "cpu") {
41162
41368
  renderWarning("GPU detected but PyTorch is CPU-only. Reinstalling with CUDA support in background...");
41163
41369
  try {
41164
- const detectScript = join50(voiceDir(), "detect-torch.py");
41370
+ const detectScript = join51(voiceDir(), "detect-torch.py");
41165
41371
  writeDetectTorchScript(detectScript);
41166
41372
  let pipArgs = `torch torchaudio --index-url https://download.pytorch.org/whl/cu124`;
41167
41373
  try {
@@ -41186,7 +41392,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
41186
41392
  }
41187
41393
  }
41188
41394
  renderInfo("Setting up LuxTTS voice cloning (first-time setup, this takes several minutes)...");
41189
- if (!existsSync35(venvDir)) {
41395
+ if (!existsSync36(venvDir)) {
41190
41396
  renderInfo(" Creating Python virtual environment...");
41191
41397
  try {
41192
41398
  await this.asyncShell(`${py} -m venv ${JSON.stringify(venvDir)}`, 6e4);
@@ -41195,7 +41401,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
41195
41401
  }
41196
41402
  }
41197
41403
  {
41198
- const detectScript = join50(voiceDir(), "detect-torch.py");
41404
+ const detectScript = join51(voiceDir(), "detect-torch.py");
41199
41405
  writeDetectTorchScript(detectScript);
41200
41406
  let pipArgsStr = "torch torchaudio";
41201
41407
  let torchDesc = "unknown platform";
@@ -41232,10 +41438,10 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
41232
41438
  }
41233
41439
  }
41234
41440
  const repoDir = luxttsRepoDir();
41235
- if (!existsSync35(join50(repoDir, "zipvoice", "luxvoice.py"))) {
41441
+ if (!existsSync36(join51(repoDir, "zipvoice", "luxvoice.py"))) {
41236
41442
  renderInfo(" Cloning LuxTTS repository...");
41237
41443
  try {
41238
- if (existsSync35(repoDir)) {
41444
+ if (existsSync36(repoDir)) {
41239
41445
  await this.asyncShell(`rm -rf ${JSON.stringify(repoDir)}`, 3e4);
41240
41446
  }
41241
41447
  await this.asyncShell(`git clone --depth 1 https://github.com/ysharma3501/LuxTTS.git ${JSON.stringify(repoDir)}`, 12e4);
@@ -41273,7 +41479,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
41273
41479
  renderWarning(` Could not install system build deps: ${err instanceof Error ? err.message : String(err)}`);
41274
41480
  }
41275
41481
  }
41276
- const isJetson = isArm && (existsSync35("/etc/nv_tegra_release") || existsSync35("/usr/local/cuda/targets/aarch64-linux") || (process.env.JETSON_L4T_VERSION ?? "") !== "");
41482
+ const isJetson = isArm && (existsSync36("/etc/nv_tegra_release") || existsSync36("/usr/local/cuda/targets/aarch64-linux") || (process.env.JETSON_L4T_VERSION ?? "") !== "");
41277
41483
  const installSteps = isArm ? [
41278
41484
  // ARM: install individually so we get clear error messages per package.
41279
41485
  // ALL are fatal because LuxTTS hard-imports them (no lazy/optional imports).
@@ -41335,14 +41541,14 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
41335
41541
  }
41336
41542
  /** Auto-detect an existing clone reference in the refs directory */
41337
41543
  autoDetectCloneRef() {
41338
- if (this.luxttsCloneRef && existsSync35(this.luxttsCloneRef))
41544
+ if (this.luxttsCloneRef && existsSync36(this.luxttsCloneRef))
41339
41545
  return;
41340
41546
  const refsDir = luxttsCloneRefsDir();
41341
- if (!existsSync35(refsDir))
41547
+ if (!existsSync36(refsDir))
41342
41548
  return;
41343
41549
  for (const name of ["custom-clone.wav", "custom-clone.mp3", "glados-ref.wav", "overwatch-ref.wav"]) {
41344
- const p = join50(refsDir, name);
41345
- if (existsSync35(p)) {
41550
+ const p = join51(refsDir, name);
41551
+ if (existsSync36(p)) {
41346
41552
  this.luxttsCloneRef = p;
41347
41553
  return;
41348
41554
  }
@@ -41450,7 +41656,7 @@ if __name__ == '__main__':
41450
41656
  if (this._luxttsDaemon && !this._luxttsDaemon.killed)
41451
41657
  return true;
41452
41658
  const venvPy = luxttsVenvPy();
41453
- if (!existsSync35(venvPy))
41659
+ if (!existsSync36(venvPy))
41454
41660
  return false;
41455
41661
  return new Promise((resolve32) => {
41456
41662
  const env = { ...process.env, LUXTTS_REPO_PATH: luxttsRepoDir() };
@@ -41534,7 +41740,7 @@ if __name__ == '__main__':
41534
41740
  * Used by drainQueue's pre-fetch pipeline for gapless back-to-back playback.
41535
41741
  */
41536
41742
  async synthesizeLuxttsWav(text, speedFactor = 1) {
41537
- if (!this.luxttsCloneRef || !existsSync35(this.luxttsCloneRef))
41743
+ if (!this.luxttsCloneRef || !existsSync36(this.luxttsCloneRef))
41538
41744
  return null;
41539
41745
  const cleaned = text.replace(/\*/g, "").trim();
41540
41746
  if (!cleaned)
@@ -41542,7 +41748,7 @@ if __name__ == '__main__':
41542
41748
  const ready = await this.ensureLuxttsDaemon();
41543
41749
  if (!ready)
41544
41750
  return null;
41545
- const wavPath = join50(tmpdir9(), `oa-luxtts-${Date.now()}-${Math.random().toString(36).slice(2, 6)}.wav`);
41751
+ const wavPath = join51(tmpdir9(), `oa-luxtts-${Date.now()}-${Math.random().toString(36).slice(2, 6)}.wav`);
41546
41752
  try {
41547
41753
  await this.luxttsRequest({
41548
41754
  action: "synthesize",
@@ -41554,17 +41760,17 @@ if __name__ == '__main__':
41554
41760
  } catch {
41555
41761
  return null;
41556
41762
  }
41557
- return existsSync35(wavPath) ? wavPath : null;
41763
+ return existsSync36(wavPath) ? wavPath : null;
41558
41764
  }
41559
41765
  /**
41560
41766
  * Post-process (fade-in, volume, pitch, stereo) and play a LuxTTS WAV file.
41561
41767
  * Cleans up the WAV file after playback.
41562
41768
  */
41563
41769
  async postProcessAndPlayLuxtts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
41564
- if (!existsSync35(wavPath))
41770
+ if (!existsSync36(wavPath))
41565
41771
  return;
41566
41772
  try {
41567
- const wavData = readFileSync24(wavPath);
41773
+ const wavData = readFileSync25(wavPath);
41568
41774
  if (wavData.length > 44) {
41569
41775
  const sampleRate = wavData.readUInt32LE(24);
41570
41776
  const samples = new Int16Array(wavData.buffer, wavData.byteOffset + 44, (wavData.length - 44) / 2);
@@ -41585,7 +41791,7 @@ if __name__ == '__main__':
41585
41791
  }
41586
41792
  if (pitchFactor !== 1) {
41587
41793
  try {
41588
- const wavData = readFileSync24(wavPath);
41794
+ const wavData = readFileSync25(wavPath);
41589
41795
  if (wavData.length > 44) {
41590
41796
  const int16 = new Int16Array(wavData.buffer, wavData.byteOffset + 44, (wavData.length - 44) / 2);
41591
41797
  const float32 = new Float32Array(int16.length);
@@ -41600,7 +41806,7 @@ if __name__ == '__main__':
41600
41806
  }
41601
41807
  if (this.onPCMOutput) {
41602
41808
  try {
41603
- const wavData = readFileSync24(wavPath);
41809
+ const wavData = readFileSync25(wavPath);
41604
41810
  if (wavData.length > 44) {
41605
41811
  const pcm = Buffer.from(wavData.buffer, wavData.byteOffset + 44, wavData.length - 44);
41606
41812
  const sampleRate = wavData.readUInt32LE(24);
@@ -41611,7 +41817,7 @@ if __name__ == '__main__':
41611
41817
  }
41612
41818
  if (stereoDelayMs > 0) {
41613
41819
  try {
41614
- const wavData = readFileSync24(wavPath);
41820
+ const wavData = readFileSync25(wavPath);
41615
41821
  if (wavData.length > 44) {
41616
41822
  const sampleRate = wavData.readUInt32LE(24);
41617
41823
  const numChannels = wavData.readUInt16LE(22);
@@ -41647,7 +41853,7 @@ if __name__ == '__main__':
41647
41853
  * Used for Telegram voice messages and WebSocket streaming.
41648
41854
  */
41649
41855
  async synthesizeLuxttsToBuffer(text) {
41650
- if (!this.luxttsCloneRef || !existsSync35(this.luxttsCloneRef))
41856
+ if (!this.luxttsCloneRef || !existsSync36(this.luxttsCloneRef))
41651
41857
  return null;
41652
41858
  const cleaned = text.replace(/\*/g, "").trim();
41653
41859
  if (!cleaned)
@@ -41655,7 +41861,7 @@ if __name__ == '__main__':
41655
41861
  const ready = await this.ensureLuxttsDaemon();
41656
41862
  if (!ready)
41657
41863
  return null;
41658
- const wavPath = join50(tmpdir9(), `oa-luxtts-buf-${Date.now()}.wav`);
41864
+ const wavPath = join51(tmpdir9(), `oa-luxtts-buf-${Date.now()}.wav`);
41659
41865
  try {
41660
41866
  await this.luxttsRequest({
41661
41867
  action: "synthesize",
@@ -41667,10 +41873,10 @@ if __name__ == '__main__':
41667
41873
  } catch {
41668
41874
  return null;
41669
41875
  }
41670
- if (!existsSync35(wavPath))
41876
+ if (!existsSync36(wavPath))
41671
41877
  return null;
41672
41878
  try {
41673
- const data = readFileSync24(wavPath);
41879
+ const data = readFileSync25(wavPath);
41674
41880
  unlinkSync8(wavPath);
41675
41881
  return data;
41676
41882
  } catch {
@@ -41685,14 +41891,14 @@ if __name__ == '__main__':
41685
41891
  return;
41686
41892
  const arch = process.arch;
41687
41893
  mkdirSync13(voiceDir(), { recursive: true });
41688
- const pkgPath = join50(voiceDir(), "package.json");
41894
+ const pkgPath = join51(voiceDir(), "package.json");
41689
41895
  const expectedDeps = {
41690
41896
  "onnxruntime-node": "^1.21.0",
41691
41897
  "phonemizer": "^1.2.1"
41692
41898
  };
41693
- if (existsSync35(pkgPath)) {
41899
+ if (existsSync36(pkgPath)) {
41694
41900
  try {
41695
- const existing = JSON.parse(readFileSync24(pkgPath, "utf8"));
41901
+ const existing = JSON.parse(readFileSync25(pkgPath, "utf8"));
41696
41902
  if (!existing.dependencies?.["phonemizer"]) {
41697
41903
  existing.dependencies = { ...existing.dependencies, ...expectedDeps };
41698
41904
  writeFileSync14(pkgPath, JSON.stringify(existing, null, 2));
@@ -41700,24 +41906,24 @@ if __name__ == '__main__':
41700
41906
  } catch {
41701
41907
  }
41702
41908
  }
41703
- if (!existsSync35(pkgPath)) {
41909
+ if (!existsSync36(pkgPath)) {
41704
41910
  writeFileSync14(pkgPath, JSON.stringify({
41705
41911
  name: "open-agents-voice",
41706
41912
  private: true,
41707
41913
  dependencies: expectedDeps
41708
41914
  }, null, 2));
41709
41915
  }
41710
- const voiceRequire = createRequire(join50(voiceDir(), "index.js"));
41916
+ const voiceRequire = createRequire(join51(voiceDir(), "index.js"));
41711
41917
  const probeOnnx = async () => {
41712
41918
  try {
41713
- const output = await this.asyncShell(`NODE_PATH="${join50(voiceDir(), "node_modules")}" node -e "try { require('onnxruntime-node'); console.log('OK'); } catch(e) { console.log('FAIL:' + e.message); }"`, 15e3);
41919
+ const output = await this.asyncShell(`NODE_PATH="${join51(voiceDir(), "node_modules")}" node -e "try { require('onnxruntime-node'); console.log('OK'); } catch(e) { console.log('FAIL:' + e.message); }"`, 15e3);
41714
41920
  return output.trim() === "OK";
41715
41921
  } catch {
41716
41922
  return false;
41717
41923
  }
41718
41924
  };
41719
- const onnxNodeModules = join50(voiceDir(), "node_modules", "onnxruntime-node");
41720
- const onnxInstalled = existsSync35(onnxNodeModules);
41925
+ const onnxNodeModules = join51(voiceDir(), "node_modules", "onnxruntime-node");
41926
+ const onnxInstalled = existsSync36(onnxNodeModules);
41721
41927
  if (onnxInstalled && !await probeOnnx()) {
41722
41928
  throw new Error(`Voice synthesis unavailable: ONNX runtime crashes on this CPU (${process.platform}-${arch}). This is a known issue with some ARM SoCs where the CPU vendor is not recognized. Voice feedback will be disabled but all other features work normally.`);
41723
41929
  }
@@ -41767,10 +41973,10 @@ Error: ${err instanceof Error ? err.message : String(err)}`);
41767
41973
  const dir = modelDir(id);
41768
41974
  const onnxPath = modelOnnxPath(id);
41769
41975
  const configPath = modelConfigPath(id);
41770
- if (existsSync35(onnxPath) && existsSync35(configPath))
41976
+ if (existsSync36(onnxPath) && existsSync36(configPath))
41771
41977
  return;
41772
41978
  mkdirSync13(dir, { recursive: true });
41773
- if (!existsSync35(configPath)) {
41979
+ if (!existsSync36(configPath)) {
41774
41980
  renderInfo(`Downloading ${model.label} voice config...`);
41775
41981
  const configResp = await fetch(model.configUrl);
41776
41982
  if (!configResp.ok)
@@ -41778,7 +41984,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`);
41778
41984
  const configText = await configResp.text();
41779
41985
  writeFileSync14(configPath, configText);
41780
41986
  }
41781
- if (!existsSync35(onnxPath)) {
41987
+ if (!existsSync36(onnxPath)) {
41782
41988
  renderInfo(`Downloading ${model.label} voice model (this may take a minute)...`);
41783
41989
  const onnxResp = await fetch(model.onnxUrl);
41784
41990
  if (!onnxResp.ok)
@@ -41815,10 +42021,10 @@ Error: ${err instanceof Error ? err.message : String(err)}`);
41815
42021
  throw new Error("ONNX runtime not loaded");
41816
42022
  const onnxPath = modelOnnxPath(this.modelId);
41817
42023
  const configPath = modelConfigPath(this.modelId);
41818
- if (!existsSync35(onnxPath) || !existsSync35(configPath)) {
42024
+ if (!existsSync36(onnxPath) || !existsSync36(configPath)) {
41819
42025
  throw new Error(`Model files not found for ${this.modelId}`);
41820
42026
  }
41821
- this.config = JSON.parse(readFileSync24(configPath, "utf8"));
42027
+ this.config = JSON.parse(readFileSync25(configPath, "utf8"));
41822
42028
  this.session = await this.ort.InferenceSession.create(onnxPath, {
41823
42029
  executionProviders: ["cpu"],
41824
42030
  graphOptimizationLevel: "all"
@@ -41845,8 +42051,8 @@ Error: ${err instanceof Error ? err.message : String(err)}`);
41845
42051
  // packages/cli/dist/tui/commands.js
41846
42052
  import * as nodeOs from "node:os";
41847
42053
  import { execSync as nodeExecSync } from "node:child_process";
41848
- import { existsSync as existsSync36, readFileSync as readFileSync25, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, readdirSync as readdirSync10, statSync as statSync13, rmSync } from "node:fs";
41849
- import { join as join51 } from "node:path";
42054
+ import { existsSync as existsSync37, readFileSync as readFileSync26, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, readdirSync as readdirSync10, statSync as statSync13, rmSync } from "node:fs";
42055
+ import { join as join52 } from "node:path";
41850
42056
  function safeLog(text) {
41851
42057
  if (isNeovimActive()) {
41852
42058
  writeToNeovimOutput(text + "\n");
@@ -42330,22 +42536,22 @@ async function handleSlashCommand(input, ctx) {
42330
42536
  let content = "";
42331
42537
  let metadata = {};
42332
42538
  if (shareType === "tool") {
42333
- const toolDir = join51(ctx.repoRoot, ".oa", "tools");
42334
- const toolFile = join51(toolDir, shareName.endsWith(".json") ? shareName : `${shareName}.json`);
42335
- if (!existsSync36(toolFile)) {
42539
+ const toolDir = join52(ctx.repoRoot, ".oa", "tools");
42540
+ const toolFile = join52(toolDir, shareName.endsWith(".json") ? shareName : `${shareName}.json`);
42541
+ if (!existsSync37(toolFile)) {
42336
42542
  renderWarning(`Tool not found: ${toolFile}`);
42337
42543
  return "handled";
42338
42544
  }
42339
- content = readFileSync25(toolFile, "utf8");
42545
+ content = readFileSync26(toolFile, "utf8");
42340
42546
  metadata = { type: "tool", name: shareName };
42341
42547
  } else if (shareType === "skill") {
42342
- const skillDir = join51(ctx.repoRoot, ".oa", "skills", shareName);
42343
- const skillFile = join51(skillDir, "SKILL.md");
42344
- if (!existsSync36(skillFile)) {
42548
+ const skillDir = join52(ctx.repoRoot, ".oa", "skills", shareName);
42549
+ const skillFile = join52(skillDir, "SKILL.md");
42550
+ if (!existsSync37(skillFile)) {
42345
42551
  renderWarning(`Skill not found: ${skillFile}`);
42346
42552
  return "handled";
42347
42553
  }
42348
- content = readFileSync25(skillFile, "utf8");
42554
+ content = readFileSync26(skillFile, "utf8");
42349
42555
  metadata = { type: "skill", name: shareName };
42350
42556
  } else {
42351
42557
  renderWarning(`Unknown share type: ${shareType}. Use 'tool' or 'skill'.`);
@@ -42384,9 +42590,9 @@ async function handleSlashCommand(input, ctx) {
42384
42590
  const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
42385
42591
  const nexus = new NexusTool2(ctx.repoRoot);
42386
42592
  await nexus.execute({ action: "ipfs_pin", cid: importCid, source: "import" });
42387
- const regFile = join51(ctx.repoRoot, ".oa", "nexus", "ipfs", "cid-registry", "learning-cids.json");
42388
- if (existsSync36(regFile)) {
42389
- const reg = JSON.parse(readFileSync25(regFile, "utf8"));
42593
+ const regFile = join52(ctx.repoRoot, ".oa", "nexus", "ipfs", "cid-registry", "learning-cids.json");
42594
+ if (existsSync37(regFile)) {
42595
+ const reg = JSON.parse(readFileSync26(regFile, "utf8"));
42390
42596
  const pinned = Object.values(reg).some((e) => e.cid === importCid && e.pinned);
42391
42597
  if (pinned) {
42392
42598
  renderInfo(`CID ${importCid.slice(0, 20)}... pinned successfully.`);
@@ -42438,33 +42644,33 @@ async function handleSlashCommand(input, ctx) {
42438
42644
  lines.push(`
42439
42645
  ${c2.bold("IPFS / Helia Status")}
42440
42646
  `);
42441
- const ipfsDir = join51(ctx.repoRoot, ".oa", "ipfs");
42442
- const ipfsLocalDir = join51(ipfsDir, "local");
42647
+ const ipfsDir = join52(ctx.repoRoot, ".oa", "ipfs");
42648
+ const ipfsLocalDir = join52(ipfsDir, "local");
42443
42649
  let ipfsFiles = 0;
42444
42650
  let ipfsBytes = 0;
42445
42651
  let heliaBlocks = 0;
42446
42652
  let heliaBytes = 0;
42447
42653
  try {
42448
- if (existsSync36(ipfsLocalDir)) {
42654
+ if (existsSync37(ipfsLocalDir)) {
42449
42655
  const files = readdirSync10(ipfsLocalDir).filter((f) => f.endsWith(".json"));
42450
42656
  ipfsFiles = files.length;
42451
42657
  for (const f of files) {
42452
42658
  try {
42453
- ipfsBytes += statSync13(join51(ipfsLocalDir, f)).size;
42659
+ ipfsBytes += statSync13(join52(ipfsLocalDir, f)).size;
42454
42660
  } catch {
42455
42661
  }
42456
42662
  }
42457
42663
  }
42458
- const heliaBlockDir = join51(ipfsDir, "blocks");
42459
- if (existsSync36(heliaBlockDir)) {
42664
+ const heliaBlockDir = join52(ipfsDir, "blocks");
42665
+ if (existsSync37(heliaBlockDir)) {
42460
42666
  const walkDir = (dir) => {
42461
42667
  for (const entry of readdirSync10(dir, { withFileTypes: true })) {
42462
42668
  if (entry.isDirectory())
42463
- walkDir(join51(dir, entry.name));
42669
+ walkDir(join52(dir, entry.name));
42464
42670
  else {
42465
42671
  heliaBlocks++;
42466
42672
  try {
42467
- heliaBytes += statSync13(join51(dir, entry.name)).size;
42673
+ heliaBytes += statSync13(join52(dir, entry.name)).size;
42468
42674
  } catch {
42469
42675
  }
42470
42676
  }
@@ -42480,9 +42686,9 @@ async function handleSlashCommand(input, ctx) {
42480
42686
  lines.push(` Blocks: ${c2.bold(String(heliaBlocks))} Size: ${c2.bold(formatFileSize(heliaBytes))}`);
42481
42687
  lines.push(` Backend: ${heliaBlocks > 0 ? c2.green("helia-ipfs") : c2.yellow("sha256-local (Helia not initialized)")}`);
42482
42688
  try {
42483
- const statusFile = join51(ctx.repoRoot, ".oa", "nexus", "status.json");
42484
- if (existsSync36(statusFile)) {
42485
- const status = JSON.parse(readFileSync25(statusFile, "utf8"));
42689
+ const statusFile = join52(ctx.repoRoot, ".oa", "nexus", "status.json");
42690
+ if (existsSync37(statusFile)) {
42691
+ const status = JSON.parse(readFileSync26(statusFile, "utf8"));
42486
42692
  if (status.peerId) {
42487
42693
  lines.push(`
42488
42694
  ${c2.bold("Peer Info")}`);
@@ -42501,11 +42707,11 @@ async function handleSlashCommand(input, ctx) {
42501
42707
  ${c2.dim("Commands: /ipfs pin <CID> /ipfs publish /ipfs cids")}`);
42502
42708
  lines.push(`
42503
42709
  ${c2.bold("Identity Kernel")}`);
42504
- const idDir = join51(ctx.repoRoot, ".oa", "identity");
42710
+ const idDir = join52(ctx.repoRoot, ".oa", "identity");
42505
42711
  try {
42506
- const stateFile = join51(idDir, "self-state.json");
42507
- if (existsSync36(stateFile)) {
42508
- const state = JSON.parse(readFileSync25(stateFile, "utf8"));
42712
+ const stateFile = join52(idDir, "self-state.json");
42713
+ if (existsSync37(stateFile)) {
42714
+ const state = JSON.parse(readFileSync26(stateFile, "utf8"));
42509
42715
  lines.push(` Version: ${c2.bold("v" + (state.version ?? "?"))} Sessions: ${c2.bold(String(state.session_count ?? 0))}`);
42510
42716
  if (state.narrative_summary) {
42511
42717
  lines.push(` Narrative: ${c2.dim(state.narrative_summary.slice(0, 60))}${state.narrative_summary.length > 60 ? "..." : ""}`);
@@ -42514,9 +42720,9 @@ async function handleSlashCommand(input, ctx) {
42514
42720
  const traits = typeof state.personality_traits === "object" ? Object.entries(state.personality_traits).map(([k, v]) => `${k}:${v}`).join(", ") : String(state.personality_traits);
42515
42721
  lines.push(` Traits: ${c2.dim(traits.slice(0, 60))}`);
42516
42722
  }
42517
- const cidFile = join51(idDir, "cids.json");
42518
- if (existsSync36(cidFile)) {
42519
- const cids = JSON.parse(readFileSync25(cidFile, "utf8"));
42723
+ const cidFile = join52(idDir, "cids.json");
42724
+ if (existsSync37(cidFile)) {
42725
+ const cids = JSON.parse(readFileSync26(cidFile, "utf8"));
42520
42726
  const lastCid = Array.isArray(cids) ? cids[cids.length - 1] : cids.latest;
42521
42727
  if (lastCid)
42522
42728
  lines.push(` Last CID: ${c2.dim(String(lastCid).slice(0, 50))}`);
@@ -42529,9 +42735,9 @@ async function handleSlashCommand(input, ctx) {
42529
42735
  lines.push(`
42530
42736
  ${c2.bold("Memory Sentiment")}`);
42531
42737
  try {
42532
- const metaFile = join51(ctx.repoRoot, ".oa", "memory", "metabolism", "store.json");
42533
- if (existsSync36(metaFile)) {
42534
- const store = JSON.parse(readFileSync25(metaFile, "utf8"));
42738
+ const metaFile = join52(ctx.repoRoot, ".oa", "memory", "metabolism", "store.json");
42739
+ if (existsSync37(metaFile)) {
42740
+ const store = JSON.parse(readFileSync26(metaFile, "utf8"));
42535
42741
  const active = store.filter((m) => m.type !== "quarantine");
42536
42742
  const recoveries = active.filter((m) => m.content?.startsWith("[recovery]")).length;
42537
42743
  const strategies = active.filter((m) => m.content?.startsWith("[strategy]")).length;
@@ -42549,8 +42755,8 @@ async function handleSlashCommand(input, ctx) {
42549
42755
  } catch {
42550
42756
  }
42551
42757
  try {
42552
- const dbPath = join51(ctx.repoRoot, ".oa", "memory", "structured.db");
42553
- if (existsSync36(dbPath)) {
42758
+ const dbPath = join52(ctx.repoRoot, ".oa", "memory", "structured.db");
42759
+ if (existsSync37(dbPath)) {
42554
42760
  const { initDb: initDb2, closeDb: cDb, ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
42555
42761
  const db = initDb2(dbPath);
42556
42762
  const memStore = new ProceduralMemoryStore2(db);
@@ -42571,8 +42777,8 @@ async function handleSlashCommand(input, ctx) {
42571
42777
  lines.push(`
42572
42778
  ${c2.bold("Storage Overview")}
42573
42779
  `);
42574
- const oaDir = join51(ctx.repoRoot, ".oa");
42575
- if (!existsSync36(oaDir)) {
42780
+ const oaDir = join52(ctx.repoRoot, ".oa");
42781
+ if (!existsSync37(oaDir)) {
42576
42782
  lines.push(` ${c2.dim("No .oa/ directory found.")}`);
42577
42783
  safeLog(lines.join("\n") + "\n");
42578
42784
  return "handled";
@@ -42582,7 +42788,7 @@ async function handleSlashCommand(input, ctx) {
42582
42788
  const walkStorage = (dir, category) => {
42583
42789
  try {
42584
42790
  for (const entry of readdirSync10(dir, { withFileTypes: true })) {
42585
- const full = join51(dir, entry.name);
42791
+ const full = join52(dir, entry.name);
42586
42792
  if (entry.isDirectory()) {
42587
42793
  const subCat = category || entry.name;
42588
42794
  walkStorage(full, subCat);
@@ -42618,10 +42824,10 @@ async function handleSlashCommand(input, ctx) {
42618
42824
  for (const entry of readdirSync10(dir, { withFileTypes: true })) {
42619
42825
  const name = entry.name.toLowerCase();
42620
42826
  if (sensitivePatterns.some((p) => name.includes(p))) {
42621
- sensitiveFound.push(join51(dir, entry.name).replace(oaDir + "/", ""));
42827
+ sensitiveFound.push(join52(dir, entry.name).replace(oaDir + "/", ""));
42622
42828
  }
42623
42829
  if (entry.isDirectory())
42624
- checkSensitive(join51(dir, entry.name));
42830
+ checkSensitive(join52(dir, entry.name));
42625
42831
  }
42626
42832
  } catch {
42627
42833
  }
@@ -42641,6 +42847,210 @@ async function handleSlashCommand(input, ctx) {
42641
42847
  safeLog(lines.join("\n"));
42642
42848
  return "handled";
42643
42849
  }
42850
+ case "ingest":
42851
+ case "transcribe": {
42852
+ const filePath = (arg || "").trim();
42853
+ if (!filePath) {
42854
+ renderInfo("Usage: /ingest <file> \u2014 ingest audio, PDF, or text file into memory");
42855
+ renderInfo("Supported: .wav .mp3 .flac .ogg (audio\u2192transcribe) | .pdf .txt .md (text\u2192chunk)");
42856
+ return "handled";
42857
+ }
42858
+ const resolvedPath = join52(ctx.repoRoot, filePath);
42859
+ if (!existsSync37(resolvedPath)) {
42860
+ renderWarning(`File not found: ${resolvedPath}`);
42861
+ return "handled";
42862
+ }
42863
+ const ext = filePath.split(".").pop()?.toLowerCase() || "";
42864
+ const audioExts = ["wav", "mp3", "flac", "ogg", "m4a", "webm"];
42865
+ const textExts = ["txt", "md", "markdown", "text", "rst"];
42866
+ const isAudio = audioExts.includes(ext);
42867
+ const isPdf = ext === "pdf";
42868
+ const isText = textExts.includes(ext);
42869
+ if (!isAudio && !isPdf && !isText) {
42870
+ renderWarning(`Unsupported file type: .${ext}`);
42871
+ return "handled";
42872
+ }
42873
+ try {
42874
+ const { initDb: initDb2, closeDb: cDb, ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
42875
+ const dbDir = join52(ctx.repoRoot, ".oa", "memory");
42876
+ mkdirSync14(dbDir, { recursive: true });
42877
+ const db = initDb2(join52(dbDir, "structured.db"));
42878
+ const memStore = new ProceduralMemoryStore2(db);
42879
+ if (isAudio) {
42880
+ renderInfo(`Transcribing: ${filePath}...`);
42881
+ let transcript = "";
42882
+ try {
42883
+ transcript = nodeExecSync(`transcribe-cli "${resolvedPath}" --format text 2>/dev/null || whisper "${resolvedPath}" --output-format txt 2>/dev/null`, { encoding: "utf8", timeout: 12e4 }).trim();
42884
+ } catch {
42885
+ renderWarning("Transcription failed. Install transcribe-cli or whisper.");
42886
+ cDb(db);
42887
+ return "handled";
42888
+ }
42889
+ if (!transcript) {
42890
+ renderWarning("No transcription output.");
42891
+ cDb(db);
42892
+ return "handled";
42893
+ }
42894
+ memStore.create({
42895
+ content: transcript.slice(0, 2e3),
42896
+ type: "episodic",
42897
+ category: "strategy",
42898
+ triggerPattern: `Transcription of ${filePath}`,
42899
+ sourceTrace: "audio-ingest",
42900
+ utility: 0.6,
42901
+ confidence: 0.7
42902
+ });
42903
+ renderInfo(`Transcribed ${transcript.length} chars \u2192 stored as episodic memory`);
42904
+ } else {
42905
+ let content = "";
42906
+ if (isPdf) {
42907
+ try {
42908
+ content = nodeExecSync(`pdftotext "${resolvedPath}" - 2>/dev/null`, {
42909
+ encoding: "utf8",
42910
+ timeout: 3e4
42911
+ }).trim();
42912
+ } catch {
42913
+ renderWarning("PDF extraction failed. Install poppler-utils: sudo apt-get install poppler-utils");
42914
+ cDb(db);
42915
+ return "handled";
42916
+ }
42917
+ } else {
42918
+ content = readFileSync26(resolvedPath, "utf8");
42919
+ }
42920
+ if (!content.trim()) {
42921
+ renderWarning("No content extracted.");
42922
+ cDb(db);
42923
+ return "handled";
42924
+ }
42925
+ const chunks = [];
42926
+ const chunkSize = 800;
42927
+ const overlap = 100;
42928
+ for (let i = 0; i < content.length; i += chunkSize - overlap) {
42929
+ chunks.push(content.slice(i, i + chunkSize));
42930
+ }
42931
+ renderInfo(`Ingesting ${chunks.length} chunks from ${filePath}...`);
42932
+ let stored = 0;
42933
+ for (const chunk of chunks) {
42934
+ if (chunk.trim().length < 20)
42935
+ continue;
42936
+ memStore.create({
42937
+ content: chunk.slice(0, 2e3),
42938
+ type: "semantic",
42939
+ category: "strategy",
42940
+ triggerPattern: `Document chunk from ${filePath}`,
42941
+ sourceTrace: "document-ingest",
42942
+ utility: 0.5,
42943
+ confidence: 0.8
42944
+ });
42945
+ stored++;
42946
+ }
42947
+ renderInfo(`Ingested ${stored} chunks \u2192 stored as semantic memories`);
42948
+ }
42949
+ cDb(db);
42950
+ } catch (e) {
42951
+ renderWarning(`Ingest failed: ${e.message ?? e}`);
42952
+ }
42953
+ return "handled";
42954
+ }
42955
+ case "fortemi": {
42956
+ const fortemiSubCmd = (arg || "").trim().toLowerCase();
42957
+ const fortemiDir = join52(ctx.repoRoot, "..", "fortemi-react");
42958
+ const altFortemiDir = join52(nodeOs.homedir(), "fortemi-react");
42959
+ const fDir = existsSync37(fortemiDir) ? fortemiDir : existsSync37(altFortemiDir) ? altFortemiDir : null;
42960
+ if (fortemiSubCmd === "start" || fortemiSubCmd === "") {
42961
+ if (!fDir) {
42962
+ renderWarning("fortemi-react not found adjacent or in home directory.");
42963
+ renderInfo("Clone it: git clone https://github.com/robit-man/fortemi-react.git");
42964
+ return "handled";
42965
+ }
42966
+ const jwtPayload = {
42967
+ iss: "open-agents",
42968
+ sub: ctx.config.model || "agent",
42969
+ iat: Math.floor(Date.now() / 1e3),
42970
+ exp: Math.floor(Date.now() / 1e3) + 86400,
42971
+ // 24h
42972
+ nonce: Math.random().toString(36).slice(2, 10)
42973
+ };
42974
+ const jwtFile = join52(ctx.repoRoot, ".oa", "fortemi-jwt.json");
42975
+ mkdirSync14(join52(ctx.repoRoot, ".oa"), { recursive: true });
42976
+ writeFileSync15(jwtFile, JSON.stringify(jwtPayload, null, 2));
42977
+ renderInfo(`Launching fortemi-react from ${fDir}...`);
42978
+ try {
42979
+ const { spawn: spawn20 } = __require("node:child_process");
42980
+ const child = spawn20("npx", ["vite", "dev", "--host", "0.0.0.0", "--port", "3000"], {
42981
+ cwd: join52(fDir, "apps", "standalone"),
42982
+ stdio: "ignore",
42983
+ detached: true,
42984
+ env: { ...process.env, OA_JWT: JSON.stringify(jwtPayload) }
42985
+ });
42986
+ child.unref();
42987
+ renderInfo("Fortemi-React starting on http://localhost:3000");
42988
+ renderInfo(`JWT saved to ${jwtFile}`);
42989
+ renderInfo("Memory operations will proxy to fortemi when available.");
42990
+ const bridgeFile = join52(ctx.repoRoot, ".oa", "fortemi-bridge.json");
42991
+ writeFileSync15(bridgeFile, JSON.stringify({
42992
+ url: "http://localhost:3000",
42993
+ pid: child.pid,
42994
+ startedAt: (/* @__PURE__ */ new Date()).toISOString(),
42995
+ jwtFile
42996
+ }, null, 2));
42997
+ } catch (e) {
42998
+ renderWarning(`Failed to launch: ${e.message ?? e}`);
42999
+ }
43000
+ return "handled";
43001
+ }
43002
+ if (fortemiSubCmd === "status") {
43003
+ const bridgeFile = join52(ctx.repoRoot, ".oa", "fortemi-bridge.json");
43004
+ if (!existsSync37(bridgeFile)) {
43005
+ renderInfo("Fortemi bridge: not connected. Run /fortemi start");
43006
+ return "handled";
43007
+ }
43008
+ const bridge = JSON.parse(readFileSync26(bridgeFile, "utf8"));
43009
+ let alive = false;
43010
+ try {
43011
+ process.kill(bridge.pid, 0);
43012
+ alive = true;
43013
+ } catch {
43014
+ }
43015
+ let httpOk = false;
43016
+ try {
43017
+ const resp = await fetch(`${bridge.url}/api/v1/tools/list_notes`, { signal: AbortSignal.timeout(3e3) });
43018
+ httpOk = resp.ok;
43019
+ } catch {
43020
+ }
43021
+ const lines = [`
43022
+ ${c2.bold("Fortemi Bridge Status")}
43023
+ `];
43024
+ lines.push(` URL: ${bridge.url}`);
43025
+ lines.push(` Process: ${alive ? c2.green("running") : c2.yellow("not running")} (PID ${bridge.pid})`);
43026
+ lines.push(` HTTP: ${httpOk ? c2.green("connected") : c2.yellow("unreachable")}`);
43027
+ lines.push(` Started: ${bridge.startedAt}`);
43028
+ lines.push(` JWT: ${existsSync37(bridge.jwtFile) ? c2.green("valid") : c2.yellow("missing")}`);
43029
+ lines.push("");
43030
+ safeLog(lines.join("\n"));
43031
+ return "handled";
43032
+ }
43033
+ if (fortemiSubCmd === "stop") {
43034
+ const bridgeFile = join52(ctx.repoRoot, ".oa", "fortemi-bridge.json");
43035
+ if (existsSync37(bridgeFile)) {
43036
+ const bridge = JSON.parse(readFileSync26(bridgeFile, "utf8"));
43037
+ try {
43038
+ process.kill(bridge.pid, "SIGTERM");
43039
+ } catch {
43040
+ }
43041
+ try {
43042
+ rmSync(bridgeFile);
43043
+ } catch {
43044
+ }
43045
+ renderInfo("Fortemi bridge stopped.");
43046
+ } else {
43047
+ renderInfo("No active fortemi bridge.");
43048
+ }
43049
+ return "handled";
43050
+ }
43051
+ renderInfo("Usage: /fortemi [start|status|stop]");
43052
+ return "handled";
43053
+ }
42644
43054
  case "model":
42645
43055
  if (arg) {
42646
43056
  await switchModel(arg, ctx, hasLocal);
@@ -44095,9 +44505,9 @@ async function handleVoiceMenu(ctx, save, hasLocal) {
44095
44505
  }
44096
44506
  const { basename: basename16, join: pathJoin } = await import("node:path");
44097
44507
  const { copyFileSync: copyFileSync2, mkdirSync: mkdirSync22, existsSync: exists } = await import("node:fs");
44098
- const { homedir: homedir15 } = await import("node:os");
44508
+ const { homedir: homedir16 } = await import("node:os");
44099
44509
  const modelName = basename16(onnxDrop.path, ".onnx").replace(/[^a-zA-Z0-9_-]/g, "-");
44100
- const destDir = pathJoin(homedir15(), ".open-agents", "voice", "models", modelName);
44510
+ const destDir = pathJoin(homedir16(), ".open-agents", "voice", "models", modelName);
44101
44511
  if (!exists(destDir))
44102
44512
  mkdirSync22(destDir, { recursive: true });
44103
44513
  copyFileSync2(onnxDrop.path, pathJoin(destDir, "model.onnx"));
@@ -44592,8 +45002,8 @@ async function handlePeerEndpoint(peerId, authKey, ctx, local) {
44592
45002
  if (models.length > 0) {
44593
45003
  try {
44594
45004
  const { writeFileSync: writeFileSync21, mkdirSync: mkdirSync22 } = await import("node:fs");
44595
- const { join: join65, dirname: dirname21 } = await import("node:path");
44596
- const cachePath = join65(ctx.repoRoot || process.cwd(), ".oa", "nexus", "peer-models-cache.json");
45005
+ const { join: join66, dirname: dirname21 } = await import("node:path");
45006
+ const cachePath = join66(ctx.repoRoot || process.cwd(), ".oa", "nexus", "peer-models-cache.json");
44597
45007
  mkdirSync22(dirname21(cachePath), { recursive: true });
44598
45008
  writeFileSync21(cachePath, JSON.stringify({
44599
45009
  peerId,
@@ -44794,17 +45204,17 @@ async function handleUpdate(subcommand, ctx) {
44794
45204
  try {
44795
45205
  const { createRequire: createRequire4 } = await import("node:module");
44796
45206
  const { fileURLToPath: fileURLToPath14 } = await import("node:url");
44797
- const { dirname: dirname21, join: join65 } = await import("node:path");
44798
- const { existsSync: existsSync46 } = await import("node:fs");
45207
+ const { dirname: dirname21, join: join66 } = await import("node:path");
45208
+ const { existsSync: existsSync47 } = await import("node:fs");
44799
45209
  const req = createRequire4(import.meta.url);
44800
45210
  const thisDir = dirname21(fileURLToPath14(import.meta.url));
44801
45211
  const candidates = [
44802
- join65(thisDir, "..", "package.json"),
44803
- join65(thisDir, "..", "..", "package.json"),
44804
- join65(thisDir, "..", "..", "..", "package.json")
45212
+ join66(thisDir, "..", "package.json"),
45213
+ join66(thisDir, "..", "..", "package.json"),
45214
+ join66(thisDir, "..", "..", "..", "package.json")
44805
45215
  ];
44806
45216
  for (const pkgPath of candidates) {
44807
- if (existsSync46(pkgPath)) {
45217
+ if (existsSync47(pkgPath)) {
44808
45218
  const pkg = req(pkgPath);
44809
45219
  if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli") {
44810
45220
  currentVersion = pkg.version ?? "0.0.0";
@@ -45641,10 +46051,10 @@ var init_commands = __esm({
45641
46051
  });
45642
46052
 
45643
46053
  // packages/cli/dist/tui/project-context.js
45644
- import { existsSync as existsSync37, readFileSync as readFileSync26, readdirSync as readdirSync11 } from "node:fs";
45645
- import { join as join52, basename as basename10 } from "node:path";
46054
+ import { existsSync as existsSync38, readFileSync as readFileSync27, readdirSync as readdirSync11 } from "node:fs";
46055
+ import { join as join53, basename as basename10 } from "node:path";
45646
46056
  import { execSync as execSync27 } from "node:child_process";
45647
- import { homedir as homedir12, platform as platform3, release } from "node:os";
46057
+ import { homedir as homedir13, platform as platform3, release } from "node:os";
45648
46058
  function getModelTier(modelName) {
45649
46059
  const m = modelName.toLowerCase();
45650
46060
  const sizeMatch = m.match(/\b(\d+)b\b/);
@@ -45677,10 +46087,10 @@ function loadProjectMap(repoRoot) {
45677
46087
  if (!hasOaDirectory(repoRoot)) {
45678
46088
  initOaDirectory(repoRoot);
45679
46089
  }
45680
- const mapPath = join52(repoRoot, OA_DIR, "context", "project-map.md");
45681
- if (existsSync37(mapPath)) {
46090
+ const mapPath = join53(repoRoot, OA_DIR, "context", "project-map.md");
46091
+ if (existsSync38(mapPath)) {
45682
46092
  try {
45683
- const content = readFileSync26(mapPath, "utf-8");
46093
+ const content = readFileSync27(mapPath, "utf-8");
45684
46094
  return content;
45685
46095
  } catch {
45686
46096
  }
@@ -45721,31 +46131,31 @@ ${log}`);
45721
46131
  }
45722
46132
  function loadMemoryContext(repoRoot) {
45723
46133
  const sections = [];
45724
- const oaMemDir = join52(repoRoot, OA_DIR, "memory");
46134
+ const oaMemDir = join53(repoRoot, OA_DIR, "memory");
45725
46135
  const oaEntries = loadMemoryDir(oaMemDir, "project");
45726
46136
  if (oaEntries)
45727
46137
  sections.push(oaEntries);
45728
- const legacyMemDir = join52(repoRoot, ".open-agents", "memory");
45729
- if (legacyMemDir !== oaMemDir && existsSync37(legacyMemDir)) {
46138
+ const legacyMemDir = join53(repoRoot, ".open-agents", "memory");
46139
+ if (legacyMemDir !== oaMemDir && existsSync38(legacyMemDir)) {
45730
46140
  const legacyEntries = loadMemoryDir(legacyMemDir, "project/legacy");
45731
46141
  if (legacyEntries)
45732
46142
  sections.push(legacyEntries);
45733
46143
  }
45734
- const globalMemDir = join52(homedir12(), ".open-agents", "memory");
46144
+ const globalMemDir = join53(homedir13(), ".open-agents", "memory");
45735
46145
  const globalEntries = loadMemoryDir(globalMemDir, "global");
45736
46146
  if (globalEntries)
45737
46147
  sections.push(globalEntries);
45738
46148
  return sections.join("\n\n");
45739
46149
  }
45740
46150
  function loadMemoryDir(memDir, scope) {
45741
- if (!existsSync37(memDir))
46151
+ if (!existsSync38(memDir))
45742
46152
  return "";
45743
46153
  const lines = [];
45744
46154
  try {
45745
46155
  const files = readdirSync11(memDir).filter((f) => f.endsWith(".json"));
45746
46156
  for (const file of files.slice(0, 10)) {
45747
46157
  try {
45748
- const raw = readFileSync26(join52(memDir, file), "utf-8");
46158
+ const raw = readFileSync27(join53(memDir, file), "utf-8");
45749
46159
  const entries = JSON.parse(raw);
45750
46160
  const topic = basename10(file, ".json");
45751
46161
  const keys = Object.keys(entries);
@@ -47264,22 +47674,22 @@ var init_banner = __esm({
47264
47674
  });
47265
47675
 
47266
47676
  // packages/cli/dist/tui/carousel-descriptors.js
47267
- import { existsSync as existsSync38, readFileSync as readFileSync27, writeFileSync as writeFileSync16, mkdirSync as mkdirSync15, readdirSync as readdirSync12 } from "node:fs";
47268
- import { join as join53, basename as basename11 } from "node:path";
47677
+ import { existsSync as existsSync39, readFileSync as readFileSync28, writeFileSync as writeFileSync16, mkdirSync as mkdirSync15, readdirSync as readdirSync12 } from "node:fs";
47678
+ import { join as join54, basename as basename11 } from "node:path";
47269
47679
  function loadToolProfile(repoRoot) {
47270
- const filePath = join53(repoRoot, OA_DIR, "context", TOOL_PROFILE_FILE);
47680
+ const filePath = join54(repoRoot, OA_DIR, "context", TOOL_PROFILE_FILE);
47271
47681
  try {
47272
- if (!existsSync38(filePath))
47682
+ if (!existsSync39(filePath))
47273
47683
  return null;
47274
- return JSON.parse(readFileSync27(filePath, "utf-8"));
47684
+ return JSON.parse(readFileSync28(filePath, "utf-8"));
47275
47685
  } catch {
47276
47686
  return null;
47277
47687
  }
47278
47688
  }
47279
47689
  function saveToolProfile(repoRoot, profile) {
47280
- const contextDir = join53(repoRoot, OA_DIR, "context");
47690
+ const contextDir = join54(repoRoot, OA_DIR, "context");
47281
47691
  mkdirSync15(contextDir, { recursive: true });
47282
- writeFileSync16(join53(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
47692
+ writeFileSync16(join54(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
47283
47693
  }
47284
47694
  function categorizeToolCall(toolName) {
47285
47695
  for (const cat of TOOL_CATEGORIES) {
@@ -47337,25 +47747,25 @@ function weightedColor(profile) {
47337
47747
  return selectedCat.colors[Math.floor(Math.random() * selectedCat.colors.length)];
47338
47748
  }
47339
47749
  function loadCachedDescriptors(repoRoot) {
47340
- const filePath = join53(repoRoot, OA_DIR, "context", DESCRIPTOR_FILE);
47750
+ const filePath = join54(repoRoot, OA_DIR, "context", DESCRIPTOR_FILE);
47341
47751
  try {
47342
- if (!existsSync38(filePath))
47752
+ if (!existsSync39(filePath))
47343
47753
  return null;
47344
- const cached = JSON.parse(readFileSync27(filePath, "utf-8"));
47754
+ const cached = JSON.parse(readFileSync28(filePath, "utf-8"));
47345
47755
  return cached.phrases.length > 0 ? cached.phrases : null;
47346
47756
  } catch {
47347
47757
  return null;
47348
47758
  }
47349
47759
  }
47350
47760
  function saveCachedDescriptors(repoRoot, phrases, sourceHash) {
47351
- const contextDir = join53(repoRoot, OA_DIR, "context");
47761
+ const contextDir = join54(repoRoot, OA_DIR, "context");
47352
47762
  mkdirSync15(contextDir, { recursive: true });
47353
47763
  const cached = {
47354
47764
  phrases,
47355
47765
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
47356
47766
  sourceHash
47357
47767
  };
47358
- writeFileSync16(join53(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
47768
+ writeFileSync16(join54(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
47359
47769
  }
47360
47770
  function generateDescriptors(repoRoot) {
47361
47771
  const profile = loadToolProfile(repoRoot);
@@ -47403,11 +47813,11 @@ function generateDescriptors(repoRoot) {
47403
47813
  return phrases;
47404
47814
  }
47405
47815
  function extractFromPackageJson(repoRoot, tags) {
47406
- const pkgPath = join53(repoRoot, "package.json");
47816
+ const pkgPath = join54(repoRoot, "package.json");
47407
47817
  try {
47408
- if (!existsSync38(pkgPath))
47818
+ if (!existsSync39(pkgPath))
47409
47819
  return;
47410
- const pkg = JSON.parse(readFileSync27(pkgPath, "utf-8"));
47820
+ const pkg = JSON.parse(readFileSync28(pkgPath, "utf-8"));
47411
47821
  if (pkg.name && typeof pkg.name === "string") {
47412
47822
  const parts = pkg.name.replace(/^@/, "").split("/");
47413
47823
  for (const p of parts)
@@ -47451,7 +47861,7 @@ function extractFromManifests(repoRoot, tags) {
47451
47861
  { file: ".github/workflows", tag: "ci/cd" }
47452
47862
  ];
47453
47863
  for (const check of manifestChecks) {
47454
- if (existsSync38(join53(repoRoot, check.file))) {
47864
+ if (existsSync39(join54(repoRoot, check.file))) {
47455
47865
  tags.push(check.tag);
47456
47866
  }
47457
47867
  }
@@ -47473,16 +47883,16 @@ function extractFromSessions(repoRoot, tags) {
47473
47883
  }
47474
47884
  }
47475
47885
  function extractFromMemory(repoRoot, tags) {
47476
- const memoryDir = join53(repoRoot, OA_DIR, "memory");
47886
+ const memoryDir = join54(repoRoot, OA_DIR, "memory");
47477
47887
  try {
47478
- if (!existsSync38(memoryDir))
47888
+ if (!existsSync39(memoryDir))
47479
47889
  return;
47480
47890
  const files = readdirSync12(memoryDir).filter((f) => f.endsWith(".json"));
47481
47891
  for (const file of files) {
47482
47892
  const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
47483
47893
  tags.push(topic);
47484
47894
  try {
47485
- const data = JSON.parse(readFileSync27(join53(memoryDir, file), "utf-8"));
47895
+ const data = JSON.parse(readFileSync28(join54(memoryDir, file), "utf-8"));
47486
47896
  if (data && typeof data === "object") {
47487
47897
  const keys = Object.keys(data).slice(0, 3);
47488
47898
  for (const key of keys) {
@@ -48116,10 +48526,10 @@ var init_stream_renderer = __esm({
48116
48526
 
48117
48527
  // packages/cli/dist/tui/edit-history.js
48118
48528
  import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync16 } from "node:fs";
48119
- import { join as join54 } from "node:path";
48529
+ import { join as join55 } from "node:path";
48120
48530
  function createEditHistoryLogger(repoRoot, sessionId) {
48121
- const historyDir = join54(repoRoot, ".oa", "history");
48122
- const logPath = join54(historyDir, "edits.jsonl");
48531
+ const historyDir = join55(repoRoot, ".oa", "history");
48532
+ const logPath = join55(historyDir, "edits.jsonl");
48123
48533
  try {
48124
48534
  mkdirSync16(historyDir, { recursive: true });
48125
48535
  } catch {
@@ -48230,17 +48640,17 @@ var init_edit_history = __esm({
48230
48640
  });
48231
48641
 
48232
48642
  // packages/cli/dist/tui/promptLoader.js
48233
- import { readFileSync as readFileSync28, existsSync as existsSync39 } from "node:fs";
48234
- import { join as join55, dirname as dirname18 } from "node:path";
48643
+ import { readFileSync as readFileSync29, existsSync as existsSync40 } from "node:fs";
48644
+ import { join as join56, dirname as dirname18 } from "node:path";
48235
48645
  import { fileURLToPath as fileURLToPath11 } from "node:url";
48236
48646
  function loadPrompt3(promptPath, vars) {
48237
48647
  let content = cache3.get(promptPath);
48238
48648
  if (content === void 0) {
48239
- const fullPath = join55(PROMPTS_DIR3, promptPath);
48240
- if (!existsSync39(fullPath)) {
48649
+ const fullPath = join56(PROMPTS_DIR3, promptPath);
48650
+ if (!existsSync40(fullPath)) {
48241
48651
  throw new Error(`Prompt file not found: ${fullPath}`);
48242
48652
  }
48243
- content = readFileSync28(fullPath, "utf-8");
48653
+ content = readFileSync29(fullPath, "utf-8");
48244
48654
  cache3.set(promptPath, content);
48245
48655
  }
48246
48656
  if (!vars)
@@ -48253,23 +48663,23 @@ var init_promptLoader3 = __esm({
48253
48663
  "use strict";
48254
48664
  __filename3 = fileURLToPath11(import.meta.url);
48255
48665
  __dirname6 = dirname18(__filename3);
48256
- devPath2 = join55(__dirname6, "..", "..", "prompts");
48257
- publishedPath2 = join55(__dirname6, "..", "prompts");
48258
- PROMPTS_DIR3 = existsSync39(devPath2) ? devPath2 : publishedPath2;
48666
+ devPath2 = join56(__dirname6, "..", "..", "prompts");
48667
+ publishedPath2 = join56(__dirname6, "..", "prompts");
48668
+ PROMPTS_DIR3 = existsSync40(devPath2) ? devPath2 : publishedPath2;
48259
48669
  cache3 = /* @__PURE__ */ new Map();
48260
48670
  }
48261
48671
  });
48262
48672
 
48263
48673
  // packages/cli/dist/tui/dream-engine.js
48264
- import { mkdirSync as mkdirSync17, writeFileSync as writeFileSync17, readFileSync as readFileSync29, existsSync as existsSync40, cpSync, rmSync as rmSync2, readdirSync as readdirSync13 } from "node:fs";
48265
- import { join as join56, basename as basename12 } from "node:path";
48674
+ import { mkdirSync as mkdirSync17, writeFileSync as writeFileSync17, readFileSync as readFileSync30, existsSync as existsSync41, cpSync, rmSync as rmSync2, readdirSync as readdirSync13 } from "node:fs";
48675
+ import { join as join57, basename as basename12 } from "node:path";
48266
48676
  import { execSync as execSync28 } from "node:child_process";
48267
48677
  function loadAutoresearchMemory(repoRoot) {
48268
- const memoryPath = join56(repoRoot, ".oa", "memory", "autoresearch.json");
48269
- if (!existsSync40(memoryPath))
48678
+ const memoryPath = join57(repoRoot, ".oa", "memory", "autoresearch.json");
48679
+ if (!existsSync41(memoryPath))
48270
48680
  return "";
48271
48681
  try {
48272
- const raw = readFileSync29(memoryPath, "utf-8");
48682
+ const raw = readFileSync30(memoryPath, "utf-8");
48273
48683
  const data = JSON.parse(raw);
48274
48684
  const sections = [];
48275
48685
  for (const key of AUTORESEARCH_MEMORY_KEYS) {
@@ -48459,12 +48869,12 @@ var init_dream_engine = __esm({
48459
48869
  const content = String(args["content"] ?? "");
48460
48870
  if (!rawPath)
48461
48871
  return { success: false, output: "", error: "path is required", durationMs: Date.now() - start };
48462
- const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join56(this.autoresearchDir, basename12(rawPath)) : join56(this.autoresearchDir, rawPath);
48872
+ const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join57(this.autoresearchDir, basename12(rawPath)) : join57(this.autoresearchDir, rawPath);
48463
48873
  if (!targetPath.startsWith(this.autoresearchDir)) {
48464
48874
  return { success: false, output: "", error: "Autoresearch mode: writes are confined to .oa/autoresearch/", durationMs: Date.now() - start };
48465
48875
  }
48466
48876
  try {
48467
- const dir = join56(targetPath, "..");
48877
+ const dir = join57(targetPath, "..");
48468
48878
  mkdirSync17(dir, { recursive: true });
48469
48879
  writeFileSync17(targetPath, content, "utf-8");
48470
48880
  return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start };
@@ -48494,15 +48904,15 @@ var init_dream_engine = __esm({
48494
48904
  const rawPath = String(args["path"] ?? "");
48495
48905
  const oldStr = String(args["old_string"] ?? "");
48496
48906
  const newStr = String(args["new_string"] ?? "");
48497
- const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join56(this.autoresearchDir, basename12(rawPath)) : join56(this.autoresearchDir, rawPath);
48907
+ const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join57(this.autoresearchDir, basename12(rawPath)) : join57(this.autoresearchDir, rawPath);
48498
48908
  if (!targetPath.startsWith(this.autoresearchDir)) {
48499
48909
  return { success: false, output: "", error: "Autoresearch mode: edits are confined to .oa/autoresearch/", durationMs: Date.now() - start };
48500
48910
  }
48501
48911
  try {
48502
- if (!existsSync40(targetPath)) {
48912
+ if (!existsSync41(targetPath)) {
48503
48913
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start };
48504
48914
  }
48505
- let content = readFileSync29(targetPath, "utf-8");
48915
+ let content = readFileSync30(targetPath, "utf-8");
48506
48916
  if (!content.includes(oldStr)) {
48507
48917
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start };
48508
48918
  }
@@ -48548,12 +48958,12 @@ var init_dream_engine = __esm({
48548
48958
  const content = String(args["content"] ?? "");
48549
48959
  if (!rawPath)
48550
48960
  return { success: false, output: "", error: "path is required", durationMs: Date.now() - start };
48551
- const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join56(this.dreamsDir, basename12(rawPath)) : join56(this.dreamsDir, rawPath);
48961
+ const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join57(this.dreamsDir, basename12(rawPath)) : join57(this.dreamsDir, rawPath);
48552
48962
  if (!targetPath.startsWith(this.dreamsDir)) {
48553
48963
  return { success: false, output: "", error: "Dream mode: writes are confined to .oa/dreams/", durationMs: Date.now() - start };
48554
48964
  }
48555
48965
  try {
48556
- const dir = join56(targetPath, "..");
48966
+ const dir = join57(targetPath, "..");
48557
48967
  mkdirSync17(dir, { recursive: true });
48558
48968
  writeFileSync17(targetPath, content, "utf-8");
48559
48969
  return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start };
@@ -48583,15 +48993,15 @@ var init_dream_engine = __esm({
48583
48993
  const rawPath = String(args["path"] ?? "");
48584
48994
  const oldStr = String(args["old_string"] ?? "");
48585
48995
  const newStr = String(args["new_string"] ?? "");
48586
- const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join56(this.dreamsDir, basename12(rawPath)) : join56(this.dreamsDir, rawPath);
48996
+ const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join57(this.dreamsDir, basename12(rawPath)) : join57(this.dreamsDir, rawPath);
48587
48997
  if (!targetPath.startsWith(this.dreamsDir)) {
48588
48998
  return { success: false, output: "", error: "Dream mode: edits are confined to .oa/dreams/", durationMs: Date.now() - start };
48589
48999
  }
48590
49000
  try {
48591
- if (!existsSync40(targetPath)) {
49001
+ if (!existsSync41(targetPath)) {
48592
49002
  return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start };
48593
49003
  }
48594
- let content = readFileSync29(targetPath, "utf-8");
49004
+ let content = readFileSync30(targetPath, "utf-8");
48595
49005
  if (!content.includes(oldStr)) {
48596
49006
  return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start };
48597
49007
  }
@@ -48650,7 +49060,7 @@ var init_dream_engine = __esm({
48650
49060
  constructor(config, repoRoot) {
48651
49061
  this.config = config;
48652
49062
  this.repoRoot = repoRoot;
48653
- this.dreamsDir = join56(repoRoot, ".oa", "dreams");
49063
+ this.dreamsDir = join57(repoRoot, ".oa", "dreams");
48654
49064
  this.state = {
48655
49065
  mode: "default",
48656
49066
  active: false,
@@ -48734,7 +49144,7 @@ ${result.summary}`;
48734
49144
  if (mode !== "default" || cycle === totalCycles) {
48735
49145
  renderDreamContraction(cycle);
48736
49146
  const cycleSummary = this.buildCycleSummary(cycle, previousFindings);
48737
- const summaryPath = join56(this.dreamsDir, `cycle-${cycle}-summary.md`);
49147
+ const summaryPath = join57(this.dreamsDir, `cycle-${cycle}-summary.md`);
48738
49148
  writeFileSync17(summaryPath, cycleSummary, "utf-8");
48739
49149
  }
48740
49150
  if (mode === "lucid" && !this.abortController.signal.aborted) {
@@ -48947,7 +49357,7 @@ After synthesis, call task_complete with the final prioritized summary.`, toolMo
48947
49357
  }
48948
49358
  /** Build role-specific tool sets for swarm agents */
48949
49359
  buildSwarmTools(role, _workspace) {
48950
- const autoresearchDir = join56(this.repoRoot, ".oa", "autoresearch");
49360
+ const autoresearchDir = join57(this.repoRoot, ".oa", "autoresearch");
48951
49361
  const taskComplete = this.createSwarmTaskCompleteTool(role);
48952
49362
  switch (role) {
48953
49363
  case "researcher": {
@@ -49311,7 +49721,7 @@ INSTRUCTIONS:
49311
49721
  2. Summarize the key learnings and next steps
49312
49722
 
49313
49723
  Call task_complete with a human-readable summary of the autoresearch session.`, workspace, onEvent);
49314
- const reportPath = join56(this.dreamsDir, `cycle-${cycleNum}-autoresearch-report.md`);
49724
+ const reportPath = join57(this.dreamsDir, `cycle-${cycleNum}-autoresearch-report.md`);
49315
49725
  const report = `# Autoresearch Swarm Report \u2014 Cycle ${cycleNum}
49316
49726
 
49317
49727
  **Date**: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}
@@ -49400,7 +49810,7 @@ ${summaryResult}
49400
49810
  }
49401
49811
  /** Save workspace backup for lucid mode */
49402
49812
  saveVersionCheckpoint(cycle) {
49403
- const checkpointDir = join56(this.dreamsDir, "checkpoints", `cycle-${cycle}`);
49813
+ const checkpointDir = join57(this.dreamsDir, "checkpoints", `cycle-${cycle}`);
49404
49814
  try {
49405
49815
  mkdirSync17(checkpointDir, { recursive: true });
49406
49816
  try {
@@ -49419,10 +49829,10 @@ ${summaryResult}
49419
49829
  encoding: "utf-8",
49420
49830
  timeout: 5e3
49421
49831
  }).trim();
49422
- writeFileSync17(join56(checkpointDir, "git-status.txt"), gitStatus, "utf-8");
49423
- writeFileSync17(join56(checkpointDir, "git-diff.patch"), gitDiff, "utf-8");
49424
- writeFileSync17(join56(checkpointDir, "git-hash.txt"), gitHash, "utf-8");
49425
- writeFileSync17(join56(checkpointDir, "checkpoint.json"), JSON.stringify({
49832
+ writeFileSync17(join57(checkpointDir, "git-status.txt"), gitStatus, "utf-8");
49833
+ writeFileSync17(join57(checkpointDir, "git-diff.patch"), gitDiff, "utf-8");
49834
+ writeFileSync17(join57(checkpointDir, "git-hash.txt"), gitHash, "utf-8");
49835
+ writeFileSync17(join57(checkpointDir, "checkpoint.json"), JSON.stringify({
49426
49836
  cycle,
49427
49837
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
49428
49838
  gitHash,
@@ -49430,7 +49840,7 @@ ${summaryResult}
49430
49840
  }, null, 2), "utf-8");
49431
49841
  renderInfo(`Checkpoint saved: cycle ${cycle} (${gitHash.slice(0, 8)})`);
49432
49842
  } catch {
49433
- writeFileSync17(join56(checkpointDir, "checkpoint.json"), JSON.stringify({ cycle, timestamp: (/* @__PURE__ */ new Date()).toISOString(), mode: this.state.mode }, null, 2), "utf-8");
49843
+ writeFileSync17(join57(checkpointDir, "checkpoint.json"), JSON.stringify({ cycle, timestamp: (/* @__PURE__ */ new Date()).toISOString(), mode: this.state.mode }, null, 2), "utf-8");
49434
49844
  renderInfo(`Checkpoint saved: cycle ${cycle} (no git)`);
49435
49845
  }
49436
49846
  } catch (err) {
@@ -49488,14 +49898,14 @@ ${files.map((f) => `- [\`${f}\`](./${f})`).join("\n")}
49488
49898
  ---
49489
49899
  *Auto-generated by open-agents dream engine*
49490
49900
  `;
49491
- writeFileSync17(join56(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
49901
+ writeFileSync17(join57(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
49492
49902
  } catch {
49493
49903
  }
49494
49904
  }
49495
49905
  /** Save dream state for resume/inspection */
49496
49906
  saveDreamState() {
49497
49907
  try {
49498
- writeFileSync17(join56(this.dreamsDir, "dream-state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
49908
+ writeFileSync17(join57(this.dreamsDir, "dream-state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
49499
49909
  } catch {
49500
49910
  }
49501
49911
  }
@@ -49869,8 +50279,8 @@ var init_bless_engine = __esm({
49869
50279
  });
49870
50280
 
49871
50281
  // packages/cli/dist/tui/dmn-engine.js
49872
- import { existsSync as existsSync41, readFileSync as readFileSync30, writeFileSync as writeFileSync18, mkdirSync as mkdirSync18, readdirSync as readdirSync14, unlinkSync as unlinkSync9 } from "node:fs";
49873
- import { join as join57, basename as basename13 } from "node:path";
50282
+ import { existsSync as existsSync42, readFileSync as readFileSync31, writeFileSync as writeFileSync18, mkdirSync as mkdirSync18, readdirSync as readdirSync14, unlinkSync as unlinkSync9 } from "node:fs";
50283
+ import { join as join58, basename as basename13 } from "node:path";
49874
50284
  function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities, competence, reflectionBuffer) {
49875
50285
  const competenceReport = competence.length > 0 ? competence.map((c3) => {
49876
50286
  const rate = c3.attempts > 0 ? Math.round(c3.successes / c3.attempts * 100) : 0;
@@ -49983,8 +50393,8 @@ var init_dmn_engine = __esm({
49983
50393
  constructor(config, repoRoot) {
49984
50394
  this.config = config;
49985
50395
  this.repoRoot = repoRoot;
49986
- this.stateDir = join57(repoRoot, ".oa", "dmn");
49987
- this.historyDir = join57(repoRoot, ".oa", "dmn", "cycles");
50396
+ this.stateDir = join58(repoRoot, ".oa", "dmn");
50397
+ this.historyDir = join58(repoRoot, ".oa", "dmn", "cycles");
49988
50398
  mkdirSync18(this.historyDir, { recursive: true });
49989
50399
  this.loadState();
49990
50400
  }
@@ -50574,11 +50984,11 @@ OUTPUT: Call task_complete with JSON:
50574
50984
  async gatherMemoryTopics() {
50575
50985
  const topics = [];
50576
50986
  const dirs = [
50577
- join57(this.repoRoot, ".oa", "memory"),
50578
- join57(this.repoRoot, ".open-agents", "memory")
50987
+ join58(this.repoRoot, ".oa", "memory"),
50988
+ join58(this.repoRoot, ".open-agents", "memory")
50579
50989
  ];
50580
50990
  for (const dir of dirs) {
50581
- if (!existsSync41(dir))
50991
+ if (!existsSync42(dir))
50582
50992
  continue;
50583
50993
  try {
50584
50994
  const files = readdirSync14(dir).filter((f) => f.endsWith(".json"));
@@ -50594,29 +51004,29 @@ OUTPUT: Call task_complete with JSON:
50594
51004
  }
50595
51005
  // ── State persistence ─────────────────────────────────────────────────
50596
51006
  loadState() {
50597
- const path = join57(this.stateDir, "state.json");
50598
- if (existsSync41(path)) {
51007
+ const path = join58(this.stateDir, "state.json");
51008
+ if (existsSync42(path)) {
50599
51009
  try {
50600
- this.state = JSON.parse(readFileSync30(path, "utf-8"));
51010
+ this.state = JSON.parse(readFileSync31(path, "utf-8"));
50601
51011
  } catch {
50602
51012
  }
50603
51013
  }
50604
51014
  }
50605
51015
  saveState() {
50606
51016
  try {
50607
- writeFileSync18(join57(this.stateDir, "state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
51017
+ writeFileSync18(join58(this.stateDir, "state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
50608
51018
  } catch {
50609
51019
  }
50610
51020
  }
50611
51021
  saveCycleResult(result) {
50612
51022
  try {
50613
51023
  const filename = `cycle-${result.cycleNumber}-${Date.now()}.json`;
50614
- writeFileSync18(join57(this.historyDir, filename), JSON.stringify(result, null, 2) + "\n", "utf-8");
51024
+ writeFileSync18(join58(this.historyDir, filename), JSON.stringify(result, null, 2) + "\n", "utf-8");
50615
51025
  const files = readdirSync14(this.historyDir).filter((f) => f.startsWith("cycle-") && f.endsWith(".json")).sort();
50616
51026
  if (files.length > 50) {
50617
51027
  for (const old of files.slice(0, files.length - 50)) {
50618
51028
  try {
50619
- unlinkSync9(join57(this.historyDir, old));
51029
+ unlinkSync9(join58(this.historyDir, old));
50620
51030
  } catch {
50621
51031
  }
50622
51032
  }
@@ -50629,8 +51039,8 @@ OUTPUT: Call task_complete with JSON:
50629
51039
  });
50630
51040
 
50631
51041
  // packages/cli/dist/tui/snr-engine.js
50632
- import { existsSync as existsSync42, readdirSync as readdirSync15, readFileSync as readFileSync31 } from "node:fs";
50633
- import { join as join58, basename as basename14 } from "node:path";
51042
+ import { existsSync as existsSync43, readdirSync as readdirSync15, readFileSync as readFileSync32 } from "node:fs";
51043
+ import { join as join59, basename as basename14 } from "node:path";
50634
51044
  function computeDPrime(signalScores, noiseScores) {
50635
51045
  if (signalScores.length === 0 || noiseScores.length === 0)
50636
51046
  return 0;
@@ -50870,11 +51280,11 @@ Call task_complete with the JSON array when done.`, onEvent)
50870
51280
  loadMemoryEntries(topics) {
50871
51281
  const entries = [];
50872
51282
  const dirs = [
50873
- join58(this.repoRoot, ".oa", "memory"),
50874
- join58(this.repoRoot, ".open-agents", "memory")
51283
+ join59(this.repoRoot, ".oa", "memory"),
51284
+ join59(this.repoRoot, ".open-agents", "memory")
50875
51285
  ];
50876
51286
  for (const dir of dirs) {
50877
- if (!existsSync42(dir))
51287
+ if (!existsSync43(dir))
50878
51288
  continue;
50879
51289
  try {
50880
51290
  const files = readdirSync15(dir).filter((f) => f.endsWith(".json"));
@@ -50883,7 +51293,7 @@ Call task_complete with the JSON array when done.`, onEvent)
50883
51293
  if (topics.length > 0 && !topics.includes(topic))
50884
51294
  continue;
50885
51295
  try {
50886
- const data = JSON.parse(readFileSync31(join58(dir, f), "utf-8"));
51296
+ const data = JSON.parse(readFileSync32(join59(dir, f), "utf-8"));
50887
51297
  for (const [key, val] of Object.entries(data)) {
50888
51298
  const value = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
50889
51299
  entries.push({ topic, key, value });
@@ -51450,8 +51860,8 @@ var init_tool_policy = __esm({
51450
51860
  });
51451
51861
 
51452
51862
  // packages/cli/dist/tui/telegram-bridge.js
51453
- import { mkdirSync as mkdirSync19, existsSync as existsSync43, unlinkSync as unlinkSync10, readdirSync as readdirSync16, statSync as statSync14 } from "node:fs";
51454
- import { join as join59, resolve as resolve28 } from "node:path";
51863
+ import { mkdirSync as mkdirSync19, existsSync as existsSync44, unlinkSync as unlinkSync10, readdirSync as readdirSync16, statSync as statSync14 } from "node:fs";
51864
+ import { join as join60, resolve as resolve28 } from "node:path";
51455
51865
  import { writeFile as writeFileAsync } from "node:fs/promises";
51456
51866
  function convertMarkdownToTelegramHTML(md) {
51457
51867
  let html = md;
@@ -52216,7 +52626,7 @@ Telegram admin: @${msg.username}` : `Telegram ${isGroup ? "group" : "public"} ch
52216
52626
  return null;
52217
52627
  const buffer = Buffer.from(await res.arrayBuffer());
52218
52628
  const fileName = `${Date.now()}-${fileId.slice(0, 8)}${extension}`;
52219
- const localPath = join59(this.mediaCacheDir, fileName);
52629
+ const localPath = join60(this.mediaCacheDir, fileName);
52220
52630
  await writeFileAsync(localPath, buffer);
52221
52631
  return localPath;
52222
52632
  } catch {
@@ -53550,7 +53960,7 @@ var init_text_selection = __esm({
53550
53960
  });
53551
53961
 
53552
53962
  // packages/cli/dist/tui/status-bar.js
53553
- import { readFileSync as readFileSync32 } from "node:fs";
53963
+ import { readFileSync as readFileSync33 } from "node:fs";
53554
53964
  function setTerminalTitle(task, version) {
53555
53965
  if (!process.stdout.isTTY)
53556
53966
  return;
@@ -54225,7 +54635,7 @@ var init_status_bar = __esm({
54225
54635
  if (nexusDir) {
54226
54636
  try {
54227
54637
  const metricsPath = nexusDir + "/remote-metrics.json";
54228
- const raw = readFileSync32(metricsPath, "utf8");
54638
+ const raw = readFileSync33(metricsPath, "utf8");
54229
54639
  const cached = JSON.parse(raw);
54230
54640
  if (cached && cached.ts && Date.now() - cached.ts < 6e4) {
54231
54641
  const m = cached.data;
@@ -55656,13 +56066,13 @@ var init_mouse_filter = __esm({
55656
56066
  import * as readline2 from "node:readline";
55657
56067
  import { Writable } from "node:stream";
55658
56068
  import { cwd } from "node:process";
55659
- import { resolve as resolve29, join as join60, dirname as dirname19, extname as extname10 } from "node:path";
56069
+ import { resolve as resolve29, join as join61, dirname as dirname19, extname as extname10 } from "node:path";
55660
56070
  import { createRequire as createRequire2 } from "node:module";
55661
56071
  import { fileURLToPath as fileURLToPath12 } from "node:url";
55662
- import { readFileSync as readFileSync33, writeFileSync as writeFileSync19, appendFileSync as appendFileSync4, rmSync as rmSync3, readdirSync as readdirSync17, mkdirSync as mkdirSync20 } from "node:fs";
55663
- import { existsSync as existsSync44 } from "node:fs";
56072
+ import { readFileSync as readFileSync34, writeFileSync as writeFileSync19, appendFileSync as appendFileSync4, rmSync as rmSync3, readdirSync as readdirSync17, mkdirSync as mkdirSync20 } from "node:fs";
56073
+ import { existsSync as existsSync45 } from "node:fs";
55664
56074
  import { execSync as execSync30 } from "node:child_process";
55665
- import { homedir as homedir13 } from "node:os";
56075
+ import { homedir as homedir14 } from "node:os";
55666
56076
  function formatTimeAgo(date) {
55667
56077
  const seconds = Math.floor((Date.now() - date.getTime()) / 1e3);
55668
56078
  if (seconds < 60)
@@ -55681,12 +56091,12 @@ function getVersion3() {
55681
56091
  const require2 = createRequire2(import.meta.url);
55682
56092
  const thisDir = dirname19(fileURLToPath12(import.meta.url));
55683
56093
  const candidates = [
55684
- join60(thisDir, "..", "package.json"),
55685
- join60(thisDir, "..", "..", "package.json"),
55686
- join60(thisDir, "..", "..", "..", "package.json")
56094
+ join61(thisDir, "..", "package.json"),
56095
+ join61(thisDir, "..", "..", "package.json"),
56096
+ join61(thisDir, "..", "..", "..", "package.json")
55687
56097
  ];
55688
56098
  for (const pkgPath of candidates) {
55689
- if (existsSync44(pkgPath)) {
56099
+ if (existsSync45(pkgPath)) {
55690
56100
  const pkg = require2(pkgPath);
55691
56101
  if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli") {
55692
56102
  return pkg.version ?? "0.0.0";
@@ -55907,15 +56317,15 @@ Use task_status("${taskId}") or task_output("${taskId}") to check progress.`
55907
56317
  function gatherMemorySnippets(root) {
55908
56318
  const snippets = [];
55909
56319
  const dirs = [
55910
- join60(root, ".oa", "memory"),
55911
- join60(root, ".open-agents", "memory")
56320
+ join61(root, ".oa", "memory"),
56321
+ join61(root, ".open-agents", "memory")
55912
56322
  ];
55913
56323
  for (const dir of dirs) {
55914
- if (!existsSync44(dir))
56324
+ if (!existsSync45(dir))
55915
56325
  continue;
55916
56326
  try {
55917
56327
  for (const f of readdirSync17(dir).filter((f2) => f2.endsWith(".json"))) {
55918
- const data = JSON.parse(readFileSync33(join60(dir, f), "utf-8"));
56328
+ const data = JSON.parse(readFileSync34(join61(dir, f), "utf-8"));
55919
56329
  for (const val of Object.values(data)) {
55920
56330
  const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
55921
56331
  if (v.length > 10)
@@ -56050,9 +56460,9 @@ ${metabolismMemories}
56050
56460
  } catch {
56051
56461
  }
56052
56462
  try {
56053
- const archeFile = join60(repoRoot, ".oa", "arche", "variants.json");
56054
- if (existsSync44(archeFile)) {
56055
- const variants = JSON.parse(readFileSync33(archeFile, "utf8"));
56463
+ const archeFile = join61(repoRoot, ".oa", "arche", "variants.json");
56464
+ if (existsSync45(archeFile)) {
56465
+ const variants = JSON.parse(readFileSync34(archeFile, "utf8"));
56056
56466
  if (variants.length > 0) {
56057
56467
  let filtered = variants;
56058
56468
  if (taskType) {
@@ -56189,9 +56599,9 @@ ${lines.join("\n")}
56189
56599
  const compactionThreshold = modelTier === "small" ? 12e3 : modelTier === "medium" ? 24e3 : 4e4;
56190
56600
  let identityInjection = "";
56191
56601
  try {
56192
- const ikStateFile = join60(repoRoot, ".oa", "identity", "self-state.json");
56193
- if (existsSync44(ikStateFile)) {
56194
- const selfState = JSON.parse(readFileSync33(ikStateFile, "utf8"));
56602
+ const ikStateFile = join61(repoRoot, ".oa", "identity", "self-state.json");
56603
+ if (existsSync45(ikStateFile)) {
56604
+ const selfState = JSON.parse(readFileSync34(ikStateFile, "utf8"));
56195
56605
  const lines = [
56196
56606
  `[Identity State v${selfState.version}]`,
56197
56607
  `Self: ${selfState.narrative_summary}`,
@@ -56828,11 +57238,11 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
56828
57238
  });
56829
57239
  }
56830
57240
  try {
56831
- const ikDir = join60(repoRoot, ".oa", "identity");
56832
- const ikFile = join60(ikDir, "self-state.json");
57241
+ const ikDir = join61(repoRoot, ".oa", "identity");
57242
+ const ikFile = join61(ikDir, "self-state.json");
56833
57243
  let ikState;
56834
- if (existsSync44(ikFile)) {
56835
- ikState = JSON.parse(readFileSync33(ikFile, "utf8"));
57244
+ if (existsSync45(ikFile)) {
57245
+ ikState = JSON.parse(readFileSync34(ikFile, "utf8"));
56836
57246
  } else {
56837
57247
  mkdirSync20(ikDir, { recursive: true });
56838
57248
  const machineId = Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
@@ -56875,9 +57285,9 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
56875
57285
  } else {
56876
57286
  renderTaskIncomplete(result.turns, result.toolCalls, result.durationMs, tokens);
56877
57287
  try {
56878
- const ikFile = join60(repoRoot, ".oa", "identity", "self-state.json");
56879
- if (existsSync44(ikFile)) {
56880
- const ikState = JSON.parse(readFileSync33(ikFile, "utf8"));
57288
+ const ikFile = join61(repoRoot, ".oa", "identity", "self-state.json");
57289
+ if (existsSync45(ikFile)) {
57290
+ const ikState = JSON.parse(readFileSync34(ikFile, "utf8"));
56881
57291
  ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
56882
57292
  ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.05);
56883
57293
  ikState.session_count = (ikState.session_count || 0) + 1;
@@ -57205,7 +57615,7 @@ async function startInteractive(config, repoPath) {
57205
57615
  let p2pGateway = null;
57206
57616
  let peerMesh = null;
57207
57617
  let inferenceRouter = null;
57208
- const secretVault = new SecretVault(join60(repoRoot, ".oa", "vault.enc"));
57618
+ const secretVault = new SecretVault(join61(repoRoot, ".oa", "vault.enc"));
57209
57619
  let adminSessionKey = null;
57210
57620
  const callSubAgents = /* @__PURE__ */ new Map();
57211
57621
  const streamRenderer = new StreamRenderer();
@@ -57425,13 +57835,13 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
57425
57835
  const hits = allCompletions.filter((c3) => c3.toLowerCase().startsWith(lower));
57426
57836
  return [hits, line];
57427
57837
  }
57428
- const HISTORY_DIR = join60(homedir13(), ".open-agents");
57429
- const HISTORY_FILE = join60(HISTORY_DIR, "repl-history");
57838
+ const HISTORY_DIR = join61(homedir14(), ".open-agents");
57839
+ const HISTORY_FILE = join61(HISTORY_DIR, "repl-history");
57430
57840
  const MAX_HISTORY_LINES = 500;
57431
57841
  let savedHistory = [];
57432
57842
  try {
57433
- if (existsSync44(HISTORY_FILE)) {
57434
- const raw = readFileSync33(HISTORY_FILE, "utf8").trim();
57843
+ if (existsSync45(HISTORY_FILE)) {
57844
+ const raw = readFileSync34(HISTORY_FILE, "utf8").trim();
57435
57845
  if (raw)
57436
57846
  savedHistory = raw.split("\n").reverse();
57437
57847
  }
@@ -57520,7 +57930,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
57520
57930
  mkdirSync20(HISTORY_DIR, { recursive: true });
57521
57931
  appendFileSync4(HISTORY_FILE, line + "\n", "utf8");
57522
57932
  if (Math.random() < 0.02) {
57523
- const all = readFileSync33(HISTORY_FILE, "utf8").trim().split("\n");
57933
+ const all = readFileSync34(HISTORY_FILE, "utf8").trim().split("\n");
57524
57934
  if (all.length > MAX_HISTORY_LINES) {
57525
57935
  writeFileSync19(HISTORY_FILE, all.slice(-MAX_HISTORY_LINES).join("\n") + "\n", "utf8");
57526
57936
  }
@@ -57698,7 +58108,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
57698
58108
  } catch {
57699
58109
  }
57700
58110
  try {
57701
- const oaDir = join60(repoRoot, ".oa");
58111
+ const oaDir = join61(repoRoot, ".oa");
57702
58112
  const reconnected = await ExposeGateway.checkAndReconnect(oaDir, {
57703
58113
  onInfo: (msg) => writeContent(() => renderInfo(msg)),
57704
58114
  onError: (msg) => writeContent(() => renderWarning(msg))
@@ -57721,7 +58131,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
57721
58131
  } catch {
57722
58132
  }
57723
58133
  try {
57724
- const oaDir = join60(repoRoot, ".oa");
58134
+ const oaDir = join61(repoRoot, ".oa");
57725
58135
  const reconnectedP2P = await ExposeP2PGateway.checkAndReconnect(oaDir, new NexusTool(repoRoot), {
57726
58136
  onInfo: (msg) => writeContent(() => renderInfo(msg)),
57727
58137
  onError: (msg) => writeContent(() => renderWarning(msg))
@@ -58578,7 +58988,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
58578
58988
  kind,
58579
58989
  targetUrl,
58580
58990
  authKey,
58581
- stateDir: join60(repoRoot, ".oa"),
58991
+ stateDir: join61(repoRoot, ".oa"),
58582
58992
  passthrough: passthrough ?? false,
58583
58993
  loadbalance: loadbalance ?? false,
58584
58994
  endpointAuth: passthrough ? currentConfig.apiKey : void 0,
@@ -58626,7 +59036,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
58626
59036
  await tunnelGateway.stop();
58627
59037
  tunnelGateway = null;
58628
59038
  }
58629
- const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir: join60(repoRoot, ".oa") });
59039
+ const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir: join61(repoRoot, ".oa") });
58630
59040
  newTunnel.on("stats", (stats) => {
58631
59041
  statusBar.setExposeStatus({
58632
59042
  status: stats.status,
@@ -58895,10 +59305,10 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
58895
59305
  writeContent(() => renderInfo(`Killed ${bgKilled} background task(s).`));
58896
59306
  }
58897
59307
  try {
58898
- const nexusDir = join60(repoRoot, OA_DIR, "nexus");
58899
- const pidFile = join60(nexusDir, "daemon.pid");
58900
- if (existsSync44(pidFile)) {
58901
- const pid = parseInt(readFileSync33(pidFile, "utf8").trim(), 10);
59308
+ const nexusDir = join61(repoRoot, OA_DIR, "nexus");
59309
+ const pidFile = join61(nexusDir, "daemon.pid");
59310
+ if (existsSync45(pidFile)) {
59311
+ const pid = parseInt(readFileSync34(pidFile, "utf8").trim(), 10);
58902
59312
  if (pid > 0) {
58903
59313
  try {
58904
59314
  if (process.platform === "win32") {
@@ -58920,13 +59330,13 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
58920
59330
  } catch {
58921
59331
  }
58922
59332
  try {
58923
- const voiceDir2 = join60(homedir13(), ".open-agents", "voice");
59333
+ const voiceDir2 = join61(homedir14(), ".open-agents", "voice");
58924
59334
  const voicePidFiles = ["luxtts-daemon.pid", "piper-daemon.pid"];
58925
59335
  for (const pf of voicePidFiles) {
58926
- const pidPath = join60(voiceDir2, pf);
58927
- if (existsSync44(pidPath)) {
59336
+ const pidPath = join61(voiceDir2, pf);
59337
+ if (existsSync45(pidPath)) {
58928
59338
  try {
58929
- const pid = parseInt(readFileSync33(pidPath, "utf8").trim(), 10);
59339
+ const pid = parseInt(readFileSync34(pidPath, "utf8").trim(), 10);
58930
59340
  if (pid > 0) {
58931
59341
  if (process.platform === "win32") {
58932
59342
  try {
@@ -58950,8 +59360,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
58950
59360
  execSync30(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.5", { timeout: 3e3, stdio: "ignore" });
58951
59361
  } catch {
58952
59362
  }
58953
- const oaPath = join60(repoRoot, OA_DIR);
58954
- if (existsSync44(oaPath)) {
59363
+ const oaPath = join61(repoRoot, OA_DIR);
59364
+ if (existsSync45(oaPath)) {
58955
59365
  let deleted = false;
58956
59366
  for (let attempt = 0; attempt < 3; attempt++) {
58957
59367
  try {
@@ -59323,8 +59733,8 @@ Execute this skill now. Follow the behavioral guidance above.`;
59323
59733
  }
59324
59734
  }
59325
59735
  const cleanPath = input.replace(/^['"]|['"]$/g, "").trim();
59326
- const isImage = isImagePath(cleanPath) && existsSync44(resolve29(repoRoot, cleanPath));
59327
- const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync44(resolve29(repoRoot, cleanPath));
59736
+ const isImage = isImagePath(cleanPath) && existsSync45(resolve29(repoRoot, cleanPath));
59737
+ const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync45(resolve29(repoRoot, cleanPath));
59328
59738
  if (activeTask) {
59329
59739
  if (activeTask.runner.isPaused) {
59330
59740
  activeTask.runner.resume();
@@ -59333,7 +59743,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
59333
59743
  if (isImage) {
59334
59744
  try {
59335
59745
  const imgPath = resolve29(repoRoot, cleanPath);
59336
- const imgBuffer = readFileSync33(imgPath);
59746
+ const imgBuffer = readFileSync34(imgPath);
59337
59747
  const base64 = imgBuffer.toString("base64");
59338
59748
  const ext = extname10(cleanPath).toLowerCase();
59339
59749
  const mime = ext === ".png" ? "image/png" : ext === ".gif" ? "image/gif" : ext === ".webp" ? "image/webp" : "image/jpeg";
@@ -59831,11 +60241,11 @@ async function runWithTUI(task, config, repoPath) {
59831
60241
  const handle = startTask(task, config, repoRoot);
59832
60242
  await handle.promise;
59833
60243
  try {
59834
- const ikDir = join60(repoRoot, ".oa", "identity");
59835
- const ikFile = join60(ikDir, "self-state.json");
60244
+ const ikDir = join61(repoRoot, ".oa", "identity");
60245
+ const ikFile = join61(ikDir, "self-state.json");
59836
60246
  let ikState;
59837
- if (existsSync44(ikFile)) {
59838
- ikState = JSON.parse(readFileSync33(ikFile, "utf8"));
60247
+ if (existsSync45(ikFile)) {
60248
+ ikState = JSON.parse(readFileSync34(ikFile, "utf8"));
59839
60249
  } else {
59840
60250
  mkdirSync20(ikDir, { recursive: true });
59841
60251
  ikState = {
@@ -59868,12 +60278,12 @@ async function runWithTUI(task, config, repoPath) {
59868
60278
  ec.archiveVariantSync(`Task: ${task.slice(0, 200)}`, "success \u2014 completed", ["general"]);
59869
60279
  } catch {
59870
60280
  try {
59871
- const archeDir = join60(repoRoot, ".oa", "arche");
59872
- const archeFile = join60(archeDir, "variants.json");
60281
+ const archeDir = join61(repoRoot, ".oa", "arche");
60282
+ const archeFile = join61(archeDir, "variants.json");
59873
60283
  let variants = [];
59874
60284
  try {
59875
- if (existsSync44(archeFile))
59876
- variants = JSON.parse(readFileSync33(archeFile, "utf8"));
60285
+ if (existsSync45(archeFile))
60286
+ variants = JSON.parse(readFileSync34(archeFile, "utf8"));
59877
60287
  } catch {
59878
60288
  }
59879
60289
  variants.push({
@@ -59894,9 +60304,9 @@ async function runWithTUI(task, config, repoPath) {
59894
60304
  }
59895
60305
  }
59896
60306
  try {
59897
- const metaFile = join60(repoRoot, ".oa", "memory", "metabolism", "store.json");
59898
- if (existsSync44(metaFile)) {
59899
- const store = JSON.parse(readFileSync33(metaFile, "utf8"));
60307
+ const metaFile = join61(repoRoot, ".oa", "memory", "metabolism", "store.json");
60308
+ if (existsSync45(metaFile)) {
60309
+ const store = JSON.parse(readFileSync34(metaFile, "utf8"));
59900
60310
  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);
59901
60311
  let updated = false;
59902
60312
  for (const item of surfaced) {
@@ -59960,9 +60370,9 @@ Rules:
59960
60370
  try {
59961
60371
  const { initDb: initDb2 } = __require("@open-agents/memory");
59962
60372
  const { ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
59963
- const dbDir = join60(repoRoot, ".oa", "memory");
60373
+ const dbDir = join61(repoRoot, ".oa", "memory");
59964
60374
  mkdirSync20(dbDir, { recursive: true });
59965
- const db = initDb2(join60(dbDir, "structured.db"));
60375
+ const db = initDb2(join61(dbDir, "structured.db"));
59966
60376
  const memStore = new ProceduralMemoryStore2(db);
59967
60377
  memStore.createWithEmbedding({
59968
60378
  content: content.slice(0, 600),
@@ -59977,12 +60387,12 @@ Rules:
59977
60387
  db.close();
59978
60388
  } catch {
59979
60389
  }
59980
- const metaDir = join60(repoRoot, ".oa", "memory", "metabolism");
59981
- const storeFile = join60(metaDir, "store.json");
60390
+ const metaDir = join61(repoRoot, ".oa", "memory", "metabolism");
60391
+ const storeFile = join61(metaDir, "store.json");
59982
60392
  let store = [];
59983
60393
  try {
59984
- if (existsSync44(storeFile))
59985
- store = JSON.parse(readFileSync33(storeFile, "utf8"));
60394
+ if (existsSync45(storeFile))
60395
+ store = JSON.parse(readFileSync34(storeFile, "utf8"));
59986
60396
  } catch {
59987
60397
  }
59988
60398
  store.push({
@@ -60005,19 +60415,19 @@ Rules:
60005
60415
  } catch {
60006
60416
  }
60007
60417
  try {
60008
- const cohereSettingsFile = join60(repoRoot, ".oa", "settings.json");
60418
+ const cohereSettingsFile = join61(repoRoot, ".oa", "settings.json");
60009
60419
  let cohereActive = false;
60010
60420
  try {
60011
- if (existsSync44(cohereSettingsFile)) {
60012
- const settings = JSON.parse(readFileSync33(cohereSettingsFile, "utf8"));
60421
+ if (existsSync45(cohereSettingsFile)) {
60422
+ const settings = JSON.parse(readFileSync34(cohereSettingsFile, "utf8"));
60013
60423
  cohereActive = settings.cohere === true;
60014
60424
  }
60015
60425
  } catch {
60016
60426
  }
60017
60427
  if (cohereActive) {
60018
- const metaFile = join60(repoRoot, ".oa", "memory", "metabolism", "store.json");
60019
- if (existsSync44(metaFile)) {
60020
- const store = JSON.parse(readFileSync33(metaFile, "utf8"));
60428
+ const metaFile = join61(repoRoot, ".oa", "memory", "metabolism", "store.json");
60429
+ if (existsSync45(metaFile)) {
60430
+ const store = JSON.parse(readFileSync34(metaFile, "utf8"));
60021
60431
  const latest = store.filter((m) => m.sourceTrace === "trajectory-extraction" || m.sourceTrace === "llm-trajectory-extraction").slice(-1)[0];
60022
60432
  if (latest && latest.scores?.confidence >= 0.6) {
60023
60433
  try {
@@ -60042,18 +60452,18 @@ Rules:
60042
60452
  }
60043
60453
  } catch (err) {
60044
60454
  try {
60045
- const ikFile = join60(repoRoot, ".oa", "identity", "self-state.json");
60046
- if (existsSync44(ikFile)) {
60047
- const ikState = JSON.parse(readFileSync33(ikFile, "utf8"));
60455
+ const ikFile = join61(repoRoot, ".oa", "identity", "self-state.json");
60456
+ if (existsSync45(ikFile)) {
60457
+ const ikState = JSON.parse(readFileSync34(ikFile, "utf8"));
60048
60458
  ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
60049
60459
  ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.05);
60050
60460
  ikState.session_count = (ikState.session_count || 0) + 1;
60051
60461
  ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
60052
60462
  writeFileSync19(ikFile, JSON.stringify(ikState, null, 2));
60053
60463
  }
60054
- const metaFile = join60(repoRoot, ".oa", "memory", "metabolism", "store.json");
60055
- if (existsSync44(metaFile)) {
60056
- const store = JSON.parse(readFileSync33(metaFile, "utf8"));
60464
+ const metaFile = join61(repoRoot, ".oa", "memory", "metabolism", "store.json");
60465
+ if (existsSync45(metaFile)) {
60466
+ const store = JSON.parse(readFileSync34(metaFile, "utf8"));
60057
60467
  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);
60058
60468
  for (const item of surfaced) {
60059
60469
  item.accessCount = (item.accessCount || 0) + 1;
@@ -60064,12 +60474,12 @@ Rules:
60064
60474
  writeFileSync19(metaFile, JSON.stringify(store, null, 2));
60065
60475
  }
60066
60476
  try {
60067
- const archeDir = join60(repoRoot, ".oa", "arche");
60068
- const archeFile = join60(archeDir, "variants.json");
60477
+ const archeDir = join61(repoRoot, ".oa", "arche");
60478
+ const archeFile = join61(archeDir, "variants.json");
60069
60479
  let variants = [];
60070
60480
  try {
60071
- if (existsSync44(archeFile))
60072
- variants = JSON.parse(readFileSync33(archeFile, "utf8"));
60481
+ if (existsSync45(archeFile))
60482
+ variants = JSON.parse(readFileSync34(archeFile, "utf8"));
60073
60483
  } catch {
60074
60484
  }
60075
60485
  variants.push({
@@ -60170,7 +60580,7 @@ import { glob } from "glob";
60170
60580
  import ignore from "ignore";
60171
60581
  import { readFile as readFile22, stat as stat4 } from "node:fs/promises";
60172
60582
  import { createHash as createHash4 } from "node:crypto";
60173
- import { join as join61, relative as relative3, extname as extname11, basename as basename15 } from "node:path";
60583
+ import { join as join62, relative as relative3, extname as extname11, basename as basename15 } from "node:path";
60174
60584
  var DEFAULT_EXCLUDE, LANGUAGE_MAP, CodebaseIndexer;
60175
60585
  var init_codebase_indexer = __esm({
60176
60586
  "packages/indexer/dist/codebase-indexer.js"() {
@@ -60214,7 +60624,7 @@ var init_codebase_indexer = __esm({
60214
60624
  const ig = ignore.default();
60215
60625
  if (this.config.respectGitignore) {
60216
60626
  try {
60217
- const gitignoreContent = await readFile22(join61(this.config.rootDir, ".gitignore"), "utf-8");
60627
+ const gitignoreContent = await readFile22(join62(this.config.rootDir, ".gitignore"), "utf-8");
60218
60628
  ig.add(gitignoreContent);
60219
60629
  } catch {
60220
60630
  }
@@ -60229,7 +60639,7 @@ var init_codebase_indexer = __esm({
60229
60639
  for (const relativePath of files) {
60230
60640
  if (ig.ignores(relativePath))
60231
60641
  continue;
60232
- const fullPath = join61(this.config.rootDir, relativePath);
60642
+ const fullPath = join62(this.config.rootDir, relativePath);
60233
60643
  try {
60234
60644
  const fileStat = await stat4(fullPath);
60235
60645
  if (fileStat.size > this.config.maxFileSize)
@@ -60275,7 +60685,7 @@ var init_codebase_indexer = __esm({
60275
60685
  if (!child) {
60276
60686
  child = {
60277
60687
  name: part,
60278
- path: join61(current.path, part),
60688
+ path: join62(current.path, part),
60279
60689
  type: "directory",
60280
60690
  children: []
60281
60691
  };
@@ -60358,13 +60768,13 @@ __export(index_repo_exports, {
60358
60768
  indexRepoCommand: () => indexRepoCommand
60359
60769
  });
60360
60770
  import { resolve as resolve30 } from "node:path";
60361
- import { existsSync as existsSync45, statSync as statSync15 } from "node:fs";
60771
+ import { existsSync as existsSync46, statSync as statSync15 } from "node:fs";
60362
60772
  import { cwd as cwd2 } from "node:process";
60363
60773
  async function indexRepoCommand(opts, _config) {
60364
60774
  const repoRoot = resolve30(opts.repoPath ?? cwd2());
60365
60775
  printHeader("Index Repository");
60366
60776
  printInfo(`Indexing: ${repoRoot}`);
60367
- if (!existsSync45(repoRoot)) {
60777
+ if (!existsSync46(repoRoot)) {
60368
60778
  printError(`Path does not exist: ${repoRoot}`);
60369
60779
  process.exit(1);
60370
60780
  }
@@ -60616,8 +61026,8 @@ var config_exports = {};
60616
61026
  __export(config_exports, {
60617
61027
  configCommand: () => configCommand
60618
61028
  });
60619
- import { join as join62, resolve as resolve31 } from "node:path";
60620
- import { homedir as homedir14 } from "node:os";
61029
+ import { join as join63, resolve as resolve31 } from "node:path";
61030
+ import { homedir as homedir15 } from "node:os";
60621
61031
  import { cwd as cwd3 } from "node:process";
60622
61032
  function redactIfSensitive(key, value) {
60623
61033
  if (SENSITIVE_KEYS.has(key) && typeof value === "string" && value.length > 0) {
@@ -60699,7 +61109,7 @@ function handleShow(opts, config) {
60699
61109
  }
60700
61110
  }
60701
61111
  printSection("Config File");
60702
- printInfo(`~/.open-agents/config.json (${join62(homedir14(), ".open-agents", "config.json")})`);
61112
+ printInfo(`~/.open-agents/config.json (${join63(homedir15(), ".open-agents", "config.json")})`);
60703
61113
  printSection("Priority Chain");
60704
61114
  printInfo(" 1. CLI flags (--model, --backend-url, etc.)");
60705
61115
  printInfo(" 2. Project .oa/settings.json (--local)");
@@ -60738,7 +61148,7 @@ function handleSet(opts, _config) {
60738
61148
  const coerced = coerceForSettings(key, value);
60739
61149
  saveProjectSettings(repoRoot, { [key]: coerced });
60740
61150
  printSuccess(`Project override set: ${key} = ${redactIfSensitive(key, value)}`);
60741
- printInfo(`Saved to ${join62(repoRoot, ".oa", "settings.json")}`);
61151
+ printInfo(`Saved to ${join63(repoRoot, ".oa", "settings.json")}`);
60742
61152
  printInfo("This override applies only when running in this workspace.");
60743
61153
  } catch (err) {
60744
61154
  printError(`Failed to save: ${err instanceof Error ? err.message : String(err)}`);
@@ -60997,7 +61407,7 @@ __export(eval_exports, {
60997
61407
  });
60998
61408
  import { tmpdir as tmpdir10 } from "node:os";
60999
61409
  import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync20 } from "node:fs";
61000
- import { join as join63 } from "node:path";
61410
+ import { join as join64 } from "node:path";
61001
61411
  async function evalCommand(opts, config) {
61002
61412
  const suiteName = opts.suite ?? "basic";
61003
61413
  const suite = SUITES[suiteName];
@@ -61122,9 +61532,9 @@ async function evalCommand(opts, config) {
61122
61532
  process.exit(failed > 0 ? 1 : 0);
61123
61533
  }
61124
61534
  function createTempEvalRepo() {
61125
- const dir = join63(tmpdir10(), `open-agents-eval-${Date.now()}`);
61535
+ const dir = join64(tmpdir10(), `open-agents-eval-${Date.now()}`);
61126
61536
  mkdirSync21(dir, { recursive: true });
61127
- writeFileSync20(join63(dir, "package.json"), JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n", "utf8");
61537
+ writeFileSync20(join64(dir, "package.json"), JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n", "utf8");
61128
61538
  return dir;
61129
61539
  }
61130
61540
  var BASIC_SUITE, FULL_SUITE, SUITES;
@@ -61184,7 +61594,7 @@ init_updater();
61184
61594
  import { parseArgs as nodeParseArgs2 } from "node:util";
61185
61595
  import { createRequire as createRequire3 } from "node:module";
61186
61596
  import { fileURLToPath as fileURLToPath13 } from "node:url";
61187
- import { dirname as dirname20, join as join64 } from "node:path";
61597
+ import { dirname as dirname20, join as join65 } from "node:path";
61188
61598
 
61189
61599
  // packages/cli/dist/cli.js
61190
61600
  import { createInterface } from "node:readline";
@@ -61291,7 +61701,7 @@ init_output();
61291
61701
  function getVersion4() {
61292
61702
  try {
61293
61703
  const require2 = createRequire3(import.meta.url);
61294
- const pkgPath = join64(dirname20(fileURLToPath13(import.meta.url)), "..", "package.json");
61704
+ const pkgPath = join65(dirname20(fileURLToPath13(import.meta.url)), "..", "package.json");
61295
61705
  const pkg = require2(pkgPath);
61296
61706
  return pkg.version;
61297
61707
  } catch {