open-agents-ai 0.146.0 → 0.148.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.
- package/dist/index.js +978 -624
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11638,8 +11638,8 @@ async function loadTranscribeCli() {
|
|
|
11638
11638
|
const nvmBase = join19(homedir6(), ".nvm", "versions", "node");
|
|
11639
11639
|
if (existsSync16(nvmBase)) {
|
|
11640
11640
|
try {
|
|
11641
|
-
const { readdirSync:
|
|
11642
|
-
for (const ver of
|
|
11641
|
+
const { readdirSync: readdirSync19 } = await import("node:fs");
|
|
11642
|
+
for (const ver of readdirSync19(nvmBase)) {
|
|
11643
11643
|
const tcPath = join19(nvmBase, ver, "lib", "node_modules", "transcribe-cli");
|
|
11644
11644
|
if (existsSync16(join19(tcPath, "dist", "index.js"))) {
|
|
11645
11645
|
const { createRequire: createRequire4 } = await import("node:module");
|
|
@@ -13315,11 +13315,11 @@ print("__SESSION__" + json.dumps(_session) + "__SESSION__")
|
|
|
13315
13315
|
* what was previously computed. */
|
|
13316
13316
|
async loadSessionInfo() {
|
|
13317
13317
|
try {
|
|
13318
|
-
const { readFileSync:
|
|
13318
|
+
const { readFileSync: readFileSync38, existsSync: existsSync50 } = await import("node:fs");
|
|
13319
13319
|
const sessionPath = join22(this.cwd, ".oa", "rlm", "session.json");
|
|
13320
|
-
if (!
|
|
13320
|
+
if (!existsSync50(sessionPath))
|
|
13321
13321
|
return null;
|
|
13322
|
-
return JSON.parse(
|
|
13322
|
+
return JSON.parse(readFileSync38(sessionPath, "utf8"));
|
|
13323
13323
|
} catch {
|
|
13324
13324
|
return null;
|
|
13325
13325
|
}
|
|
@@ -13496,10 +13496,10 @@ var init_memory_metabolism = __esm({
|
|
|
13496
13496
|
const trajDir = join23(this.cwd, ".oa", "rlm-trajectories");
|
|
13497
13497
|
let lessons = [];
|
|
13498
13498
|
try {
|
|
13499
|
-
const { readdirSync:
|
|
13500
|
-
const files =
|
|
13499
|
+
const { readdirSync: readdirSync19, readFileSync: readFileSync38 } = await import("node:fs");
|
|
13500
|
+
const files = readdirSync19(trajDir).filter((f) => f.endsWith(".jsonl")).sort().reverse().slice(0, 3);
|
|
13501
13501
|
for (const file of files) {
|
|
13502
|
-
const lines =
|
|
13502
|
+
const lines = readFileSync38(join23(trajDir, file), "utf8").split("\n").filter((l) => l.trim());
|
|
13503
13503
|
for (const line of lines) {
|
|
13504
13504
|
try {
|
|
13505
13505
|
const entry = JSON.parse(line);
|
|
@@ -13883,14 +13883,14 @@ ${issues.map((i) => ` - ${i}`).join("\n")}` : " No issues found."),
|
|
|
13883
13883
|
* Optionally filter by task type for phase-aware context (FSM paper insight).
|
|
13884
13884
|
*/
|
|
13885
13885
|
getTopMemoriesSync(k = 5, taskType) {
|
|
13886
|
-
const { readFileSync:
|
|
13886
|
+
const { readFileSync: readFileSync38, existsSync: existsSync50 } = __require("node:fs");
|
|
13887
13887
|
const metaDir = join23(this.cwd, ".oa", "memory", "metabolism");
|
|
13888
13888
|
const storeFile = join23(metaDir, "store.json");
|
|
13889
|
-
if (!
|
|
13889
|
+
if (!existsSync50(storeFile))
|
|
13890
13890
|
return "";
|
|
13891
13891
|
let store = [];
|
|
13892
13892
|
try {
|
|
13893
|
-
store = JSON.parse(
|
|
13893
|
+
store = JSON.parse(readFileSync38(storeFile, "utf8"));
|
|
13894
13894
|
} catch {
|
|
13895
13895
|
return "";
|
|
13896
13896
|
}
|
|
@@ -13912,14 +13912,14 @@ ${issues.map((i) => ` - ${i}`).join("\n")}` : " No issues found."),
|
|
|
13912
13912
|
/** Update memory scores based on task outcome. Called after task completion.
|
|
13913
13913
|
* Memories used in successful tasks get boosted. Memories present during failures get decayed. */
|
|
13914
13914
|
updateFromOutcomeSync(surfacedMemoryText, succeeded) {
|
|
13915
|
-
const { readFileSync:
|
|
13915
|
+
const { readFileSync: readFileSync38, writeFileSync: writeFileSync23, existsSync: existsSync50, mkdirSync: mkdirSync24 } = __require("node:fs");
|
|
13916
13916
|
const metaDir = join23(this.cwd, ".oa", "memory", "metabolism");
|
|
13917
13917
|
const storeFile = join23(metaDir, "store.json");
|
|
13918
|
-
if (!
|
|
13918
|
+
if (!existsSync50(storeFile))
|
|
13919
13919
|
return;
|
|
13920
13920
|
let store = [];
|
|
13921
13921
|
try {
|
|
13922
|
-
store = JSON.parse(
|
|
13922
|
+
store = JSON.parse(readFileSync38(storeFile, "utf8"));
|
|
13923
13923
|
} catch {
|
|
13924
13924
|
return;
|
|
13925
13925
|
}
|
|
@@ -14366,13 +14366,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
14366
14366
|
// Per EvoSkill (arXiv:2603.02766): retrieve relevant strategies from archive.
|
|
14367
14367
|
/** Retrieve top-K strategies for context injection. Returns "" if none. */
|
|
14368
14368
|
getRelevantStrategiesSync(k = 3, taskType) {
|
|
14369
|
-
const { readFileSync:
|
|
14369
|
+
const { readFileSync: readFileSync38, existsSync: existsSync50 } = __require("node:fs");
|
|
14370
14370
|
const archiveFile = join25(this.cwd, ".oa", "arche", "variants.json");
|
|
14371
|
-
if (!
|
|
14371
|
+
if (!existsSync50(archiveFile))
|
|
14372
14372
|
return "";
|
|
14373
14373
|
let variants = [];
|
|
14374
14374
|
try {
|
|
14375
|
-
variants = JSON.parse(
|
|
14375
|
+
variants = JSON.parse(readFileSync38(archiveFile, "utf8"));
|
|
14376
14376
|
} catch {
|
|
14377
14377
|
return "";
|
|
14378
14378
|
}
|
|
@@ -14390,13 +14390,13 @@ Recommendation: Strategy ${scored[0].index + 1} scores highest.`;
|
|
|
14390
14390
|
}
|
|
14391
14391
|
/** Archive a strategy variant synchronously (for task completion path) */
|
|
14392
14392
|
archiveVariantSync(strategy, outcome, tags = []) {
|
|
14393
|
-
const { readFileSync:
|
|
14393
|
+
const { readFileSync: readFileSync38, writeFileSync: writeFileSync23, existsSync: existsSync50, mkdirSync: mkdirSync24 } = __require("node:fs");
|
|
14394
14394
|
const dir = join25(this.cwd, ".oa", "arche");
|
|
14395
14395
|
const archiveFile = join25(dir, "variants.json");
|
|
14396
14396
|
let variants = [];
|
|
14397
14397
|
try {
|
|
14398
|
-
if (
|
|
14399
|
-
variants = JSON.parse(
|
|
14398
|
+
if (existsSync50(archiveFile))
|
|
14399
|
+
variants = JSON.parse(readFileSync38(archiveFile, "utf8"));
|
|
14400
14400
|
} catch {
|
|
14401
14401
|
}
|
|
14402
14402
|
variants.push({
|
|
@@ -20155,15 +20155,356 @@ var init_working_notes = __esm({
|
|
|
20155
20155
|
}
|
|
20156
20156
|
});
|
|
20157
20157
|
|
|
20158
|
+
// packages/execution/dist/tools/repo-map.js
|
|
20159
|
+
import { readdirSync as readdirSync6, readFileSync as readFileSync19, statSync as statSync9, existsSync as existsSync26 } from "node:fs";
|
|
20160
|
+
import { join as join40, relative as relative2, extname as extname7, dirname as dirname11, basename as basename9 } from "node:path";
|
|
20161
|
+
function parseJSImports(content, filePath) {
|
|
20162
|
+
const imports = [];
|
|
20163
|
+
const dir = dirname11(filePath);
|
|
20164
|
+
const esRegex = /(?:import|export)\s+(?:[\s\S]*?)\s+from\s+['"]([^'"]+)['"]/g;
|
|
20165
|
+
let m;
|
|
20166
|
+
while ((m = esRegex.exec(content)) !== null) {
|
|
20167
|
+
const target = m[1];
|
|
20168
|
+
if (target.startsWith(".")) {
|
|
20169
|
+
imports.push(resolveImportPath(dir, target));
|
|
20170
|
+
}
|
|
20171
|
+
}
|
|
20172
|
+
const dynRegex = /import\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
20173
|
+
while ((m = dynRegex.exec(content)) !== null) {
|
|
20174
|
+
const target = m[1];
|
|
20175
|
+
if (target.startsWith(".")) {
|
|
20176
|
+
imports.push(resolveImportPath(dir, target));
|
|
20177
|
+
}
|
|
20178
|
+
}
|
|
20179
|
+
const cjsRegex = /require\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
20180
|
+
while ((m = cjsRegex.exec(content)) !== null) {
|
|
20181
|
+
const target = m[1];
|
|
20182
|
+
if (target.startsWith(".")) {
|
|
20183
|
+
imports.push(resolveImportPath(dir, target));
|
|
20184
|
+
}
|
|
20185
|
+
}
|
|
20186
|
+
return imports;
|
|
20187
|
+
}
|
|
20188
|
+
function parsePyImports(content, _filePath) {
|
|
20189
|
+
const imports = [];
|
|
20190
|
+
const fromRegex = /from\s+(\.+[\w.]*)\s+import/g;
|
|
20191
|
+
let m;
|
|
20192
|
+
while ((m = fromRegex.exec(content)) !== null) {
|
|
20193
|
+
imports.push(m[1].replace(/\./g, "/") + ".py");
|
|
20194
|
+
}
|
|
20195
|
+
return imports;
|
|
20196
|
+
}
|
|
20197
|
+
function resolveImportPath(fromDir, importPath) {
|
|
20198
|
+
let resolved = join40(fromDir, importPath);
|
|
20199
|
+
resolved = resolved.replace(/\.(js|ts|jsx|tsx|mjs|cjs)$/, "");
|
|
20200
|
+
return resolved.replace(/\\/g, "/");
|
|
20201
|
+
}
|
|
20202
|
+
function resolveToFile(target, files) {
|
|
20203
|
+
if (files.has(target))
|
|
20204
|
+
return target;
|
|
20205
|
+
for (const ext of [".ts", ".tsx", ".js", ".jsx", ".mjs", ".py"]) {
|
|
20206
|
+
if (files.has(target + ext))
|
|
20207
|
+
return target + ext;
|
|
20208
|
+
}
|
|
20209
|
+
for (const ext of [".ts", ".tsx", ".js", ".jsx"]) {
|
|
20210
|
+
if (files.has(target + "/index" + ext))
|
|
20211
|
+
return target + "/index" + ext;
|
|
20212
|
+
}
|
|
20213
|
+
return null;
|
|
20214
|
+
}
|
|
20215
|
+
function extractSymbols(content, filePath) {
|
|
20216
|
+
const ext = extname7(filePath);
|
|
20217
|
+
const patterns = /\.py$/.test(ext) ? PY_PATTERNS : TS_PATTERNS;
|
|
20218
|
+
const symbols = [];
|
|
20219
|
+
const lines = content.split("\n");
|
|
20220
|
+
for (let i = 0; i < lines.length; i++) {
|
|
20221
|
+
const line = lines[i];
|
|
20222
|
+
for (const { kind, re } of patterns) {
|
|
20223
|
+
const match = re.exec(line);
|
|
20224
|
+
if (match) {
|
|
20225
|
+
const exported = /export/.test(line);
|
|
20226
|
+
let name = "";
|
|
20227
|
+
for (let g = match.length - 1; g >= 1; g--) {
|
|
20228
|
+
if (match[g] && /^\w+$/.test(match[g]) && match[g] !== "export" && match[g] !== "async" && match[g] !== "abstract" && match[g] !== "const" && match[g] !== "let" && match[g] !== "var" && match[g] !== "public" && match[g] !== "private" && match[g] !== "protected" && match[g] !== "static" && match[g] !== "get" && match[g] !== "set") {
|
|
20229
|
+
name = match[g];
|
|
20230
|
+
break;
|
|
20231
|
+
}
|
|
20232
|
+
}
|
|
20233
|
+
if (!name)
|
|
20234
|
+
continue;
|
|
20235
|
+
symbols.push({
|
|
20236
|
+
name,
|
|
20237
|
+
kind,
|
|
20238
|
+
line: i + 1,
|
|
20239
|
+
signature: line.trimEnd().slice(0, 120),
|
|
20240
|
+
exported
|
|
20241
|
+
});
|
|
20242
|
+
break;
|
|
20243
|
+
}
|
|
20244
|
+
}
|
|
20245
|
+
}
|
|
20246
|
+
return symbols;
|
|
20247
|
+
}
|
|
20248
|
+
function buildGraph(rootDir, maxFiles = 2e3) {
|
|
20249
|
+
const files = /* @__PURE__ */ new Map();
|
|
20250
|
+
const allPaths = [];
|
|
20251
|
+
function scan(dir, depth) {
|
|
20252
|
+
if (depth > 10)
|
|
20253
|
+
return;
|
|
20254
|
+
let entries;
|
|
20255
|
+
try {
|
|
20256
|
+
entries = readdirSync6(dir);
|
|
20257
|
+
} catch {
|
|
20258
|
+
return;
|
|
20259
|
+
}
|
|
20260
|
+
for (const entry of entries) {
|
|
20261
|
+
if (IGNORE_DIRS.has(entry))
|
|
20262
|
+
continue;
|
|
20263
|
+
if (entry.startsWith("."))
|
|
20264
|
+
continue;
|
|
20265
|
+
const full = join40(dir, entry);
|
|
20266
|
+
let stat5;
|
|
20267
|
+
try {
|
|
20268
|
+
stat5 = statSync9(full);
|
|
20269
|
+
} catch {
|
|
20270
|
+
continue;
|
|
20271
|
+
}
|
|
20272
|
+
if (stat5.isDirectory()) {
|
|
20273
|
+
scan(full, depth + 1);
|
|
20274
|
+
} else if (stat5.isFile() && SOURCE_EXTS.has(extname7(entry))) {
|
|
20275
|
+
if (allPaths.length >= maxFiles)
|
|
20276
|
+
return;
|
|
20277
|
+
const relPath = relative2(rootDir, full).replace(/\\/g, "/");
|
|
20278
|
+
allPaths.push(relPath);
|
|
20279
|
+
}
|
|
20280
|
+
}
|
|
20281
|
+
}
|
|
20282
|
+
scan(rootDir, 0);
|
|
20283
|
+
let totalSymbols = 0;
|
|
20284
|
+
for (const relPath of allPaths) {
|
|
20285
|
+
const fullPath = join40(rootDir, relPath);
|
|
20286
|
+
let content;
|
|
20287
|
+
try {
|
|
20288
|
+
content = readFileSync19(fullPath, "utf-8");
|
|
20289
|
+
} catch {
|
|
20290
|
+
continue;
|
|
20291
|
+
}
|
|
20292
|
+
const symbols = extractSymbols(content, relPath);
|
|
20293
|
+
const ext = extname7(relPath);
|
|
20294
|
+
const imports = /\.(ts|tsx|js|jsx|mjs|cjs)$/.test(ext) ? parseJSImports(content, relPath) : /\.py$/.test(ext) ? parsePyImports(content, relPath) : [];
|
|
20295
|
+
totalSymbols += symbols.length;
|
|
20296
|
+
files.set(relPath, {
|
|
20297
|
+
path: relPath,
|
|
20298
|
+
symbols,
|
|
20299
|
+
imports,
|
|
20300
|
+
importedBy: [],
|
|
20301
|
+
score: 0
|
|
20302
|
+
});
|
|
20303
|
+
}
|
|
20304
|
+
for (const [filePath, node] of files) {
|
|
20305
|
+
const resolvedImports = [];
|
|
20306
|
+
for (const imp of node.imports) {
|
|
20307
|
+
const target = resolveToFile(imp, files);
|
|
20308
|
+
if (target && target !== filePath) {
|
|
20309
|
+
resolvedImports.push(target);
|
|
20310
|
+
files.get(target).importedBy.push(filePath);
|
|
20311
|
+
}
|
|
20312
|
+
}
|
|
20313
|
+
node.imports = resolvedImports;
|
|
20314
|
+
}
|
|
20315
|
+
return { files, totalFiles: allPaths.length, totalSymbols };
|
|
20316
|
+
}
|
|
20317
|
+
function runPageRank(graph, iterations = 15, damping = 0.85) {
|
|
20318
|
+
const n = graph.files.size;
|
|
20319
|
+
if (n === 0)
|
|
20320
|
+
return;
|
|
20321
|
+
const nodes = Array.from(graph.files.values());
|
|
20322
|
+
const scores = new Float64Array(n).fill(1 / n);
|
|
20323
|
+
const newScores = new Float64Array(n);
|
|
20324
|
+
const nodeIndex = /* @__PURE__ */ new Map();
|
|
20325
|
+
nodes.forEach((node, i) => nodeIndex.set(node.path, i));
|
|
20326
|
+
for (let iter = 0; iter < iterations; iter++) {
|
|
20327
|
+
newScores.fill((1 - damping) / n);
|
|
20328
|
+
for (let i = 0; i < n; i++) {
|
|
20329
|
+
const node = nodes[i];
|
|
20330
|
+
const outDegree = node.imports.length;
|
|
20331
|
+
if (outDegree === 0) {
|
|
20332
|
+
const share = scores[i] * damping / n;
|
|
20333
|
+
for (let j = 0; j < n; j++)
|
|
20334
|
+
newScores[j] += share;
|
|
20335
|
+
} else {
|
|
20336
|
+
const share = scores[i] * damping / outDegree;
|
|
20337
|
+
for (const target of node.imports) {
|
|
20338
|
+
const j = nodeIndex.get(target);
|
|
20339
|
+
if (j !== void 0)
|
|
20340
|
+
newScores[j] += share;
|
|
20341
|
+
}
|
|
20342
|
+
}
|
|
20343
|
+
}
|
|
20344
|
+
for (let i = 0; i < n; i++)
|
|
20345
|
+
scores[i] = newScores[i];
|
|
20346
|
+
}
|
|
20347
|
+
for (let i = 0; i < n; i++) {
|
|
20348
|
+
nodes[i].score = scores[i];
|
|
20349
|
+
}
|
|
20350
|
+
}
|
|
20351
|
+
function serializeMap(graph, tokenBudget, focusPath) {
|
|
20352
|
+
const nodes = Array.from(graph.files.values());
|
|
20353
|
+
nodes.sort((a, b) => b.score - a.score);
|
|
20354
|
+
if (focusPath) {
|
|
20355
|
+
const focusNode = graph.files.get(focusPath);
|
|
20356
|
+
if (focusNode) {
|
|
20357
|
+
const boosted = /* @__PURE__ */ new Set([focusPath, ...focusNode.imports, ...focusNode.importedBy]);
|
|
20358
|
+
nodes.sort((a, b) => {
|
|
20359
|
+
const aBoost = boosted.has(a.path) ? 1e3 : 0;
|
|
20360
|
+
const bBoost = boosted.has(b.path) ? 1e3 : 0;
|
|
20361
|
+
return b.score + bBoost - (a.score + aBoost);
|
|
20362
|
+
});
|
|
20363
|
+
}
|
|
20364
|
+
}
|
|
20365
|
+
const lines = [];
|
|
20366
|
+
let estimatedTokens = 0;
|
|
20367
|
+
const charsPerToken = 4;
|
|
20368
|
+
lines.push(`# Repository Map (${graph.totalFiles} files, ${graph.totalSymbols} symbols)
|
|
20369
|
+
`);
|
|
20370
|
+
estimatedTokens += 15;
|
|
20371
|
+
for (const node of nodes) {
|
|
20372
|
+
if (estimatedTokens >= tokenBudget)
|
|
20373
|
+
break;
|
|
20374
|
+
const exported = node.symbols.filter((s) => s.exported);
|
|
20375
|
+
if (exported.length === 0 && node.importedBy.length < 2)
|
|
20376
|
+
continue;
|
|
20377
|
+
const fileHeader = `${node.path}:`;
|
|
20378
|
+
let fileTokens = fileHeader.length / charsPerToken;
|
|
20379
|
+
const fileLines = [fileHeader];
|
|
20380
|
+
for (const sym of exported) {
|
|
20381
|
+
const symLine = ` ${sym.kind} ${sym.name}`;
|
|
20382
|
+
fileTokens += symLine.length / charsPerToken;
|
|
20383
|
+
fileLines.push(symLine);
|
|
20384
|
+
}
|
|
20385
|
+
if (node.importedBy.length > 0 && node.score > 1e-3) {
|
|
20386
|
+
const importedByStr = ` \u2190 imported by: ${node.importedBy.slice(0, 5).map((p) => basename9(p, extname7(p))).join(", ")}${node.importedBy.length > 5 ? ` +${node.importedBy.length - 5} more` : ""}`;
|
|
20387
|
+
fileTokens += importedByStr.length / charsPerToken;
|
|
20388
|
+
fileLines.push(importedByStr);
|
|
20389
|
+
}
|
|
20390
|
+
if (estimatedTokens + fileTokens > tokenBudget)
|
|
20391
|
+
break;
|
|
20392
|
+
lines.push(...fileLines);
|
|
20393
|
+
estimatedTokens += fileTokens;
|
|
20394
|
+
}
|
|
20395
|
+
return lines.join("\n");
|
|
20396
|
+
}
|
|
20397
|
+
var IGNORE_DIRS, SOURCE_EXTS, TS_PATTERNS, PY_PATTERNS, RepoMapTool;
|
|
20398
|
+
var init_repo_map = __esm({
|
|
20399
|
+
"packages/execution/dist/tools/repo-map.js"() {
|
|
20400
|
+
"use strict";
|
|
20401
|
+
IGNORE_DIRS = /* @__PURE__ */ new Set([
|
|
20402
|
+
"node_modules",
|
|
20403
|
+
".git",
|
|
20404
|
+
"dist",
|
|
20405
|
+
"build",
|
|
20406
|
+
".oa",
|
|
20407
|
+
".open-agents",
|
|
20408
|
+
"__pycache__",
|
|
20409
|
+
".pytest_cache",
|
|
20410
|
+
".mypy_cache",
|
|
20411
|
+
".tox",
|
|
20412
|
+
"venv",
|
|
20413
|
+
"coverage",
|
|
20414
|
+
".next",
|
|
20415
|
+
".nuxt",
|
|
20416
|
+
".svelte-kit",
|
|
20417
|
+
"target",
|
|
20418
|
+
".cargo"
|
|
20419
|
+
]);
|
|
20420
|
+
SOURCE_EXTS = /* @__PURE__ */ new Set([
|
|
20421
|
+
".ts",
|
|
20422
|
+
".tsx",
|
|
20423
|
+
".js",
|
|
20424
|
+
".jsx",
|
|
20425
|
+
".mjs",
|
|
20426
|
+
".cjs",
|
|
20427
|
+
".py",
|
|
20428
|
+
".rs",
|
|
20429
|
+
".go",
|
|
20430
|
+
".java",
|
|
20431
|
+
".kt",
|
|
20432
|
+
".swift",
|
|
20433
|
+
".c",
|
|
20434
|
+
".cpp",
|
|
20435
|
+
".h",
|
|
20436
|
+
".hpp",
|
|
20437
|
+
".cs"
|
|
20438
|
+
]);
|
|
20439
|
+
TS_PATTERNS = [
|
|
20440
|
+
{ kind: "function", re: /^\s*(export\s+)?(async\s+)?function\s+(\w+)/m },
|
|
20441
|
+
{ kind: "class", re: /^\s*(export\s+)?(abstract\s+)?class\s+(\w+)/m },
|
|
20442
|
+
{ kind: "interface", re: /^\s*(export\s+)?interface\s+(\w+)/m },
|
|
20443
|
+
{ kind: "type", re: /^\s*(export\s+)?type\s+(\w+)\s*[=<]/m },
|
|
20444
|
+
{ kind: "enum", re: /^\s*(export\s+)?enum\s+(\w+)/m },
|
|
20445
|
+
{ kind: "const", re: /^\s*(export\s+)?(const|let|var)\s+(\w+)\s*[:=]/m },
|
|
20446
|
+
{ kind: "method", re: /^\s*(?:public|private|protected|static|async|get|set)\s+(\w+)\s*[(<]/m }
|
|
20447
|
+
];
|
|
20448
|
+
PY_PATTERNS = [
|
|
20449
|
+
{ kind: "function", re: /^\s*(async\s+)?def\s+(\w+)/m },
|
|
20450
|
+
{ kind: "class", re: /^\s*class\s+(\w+)/m }
|
|
20451
|
+
];
|
|
20452
|
+
RepoMapTool = class {
|
|
20453
|
+
name = "repo_map";
|
|
20454
|
+
description = "Generate a compact semantic map of the codebase. Shows the most cross-referenced symbols ranked by importance (PageRank on the import graph). Use at task start to understand the codebase structure. Optional: focus_path to boost a specific file and its dependencies. Token budget scales to model size.";
|
|
20455
|
+
parameters = {
|
|
20456
|
+
type: "object",
|
|
20457
|
+
properties: {
|
|
20458
|
+
focus_path: {
|
|
20459
|
+
type: "string",
|
|
20460
|
+
description: "Optional file path to focus on \u2014 boosts this file and its import neighbors"
|
|
20461
|
+
},
|
|
20462
|
+
token_budget: {
|
|
20463
|
+
type: "number",
|
|
20464
|
+
description: "Max tokens for output (default: 1500). Use 800 for 9B, 2000 for 30B+."
|
|
20465
|
+
}
|
|
20466
|
+
},
|
|
20467
|
+
required: []
|
|
20468
|
+
};
|
|
20469
|
+
workingDir;
|
|
20470
|
+
constructor(workingDir) {
|
|
20471
|
+
this.workingDir = workingDir;
|
|
20472
|
+
}
|
|
20473
|
+
async execute(args) {
|
|
20474
|
+
const start = performance.now();
|
|
20475
|
+
const focusPath = args["focus_path"];
|
|
20476
|
+
const tokenBudget = Number(args["token_budget"] ?? 1500);
|
|
20477
|
+
try {
|
|
20478
|
+
const graph = buildGraph(this.workingDir);
|
|
20479
|
+
runPageRank(graph);
|
|
20480
|
+
const output = serializeMap(graph, tokenBudget, focusPath);
|
|
20481
|
+
return {
|
|
20482
|
+
success: true,
|
|
20483
|
+
output,
|
|
20484
|
+
durationMs: performance.now() - start
|
|
20485
|
+
};
|
|
20486
|
+
} catch (error) {
|
|
20487
|
+
return {
|
|
20488
|
+
success: false,
|
|
20489
|
+
output: "",
|
|
20490
|
+
error: `repo_map error: ${error instanceof Error ? error.message : String(error)}`,
|
|
20491
|
+
durationMs: performance.now() - start
|
|
20492
|
+
};
|
|
20493
|
+
}
|
|
20494
|
+
}
|
|
20495
|
+
};
|
|
20496
|
+
}
|
|
20497
|
+
});
|
|
20498
|
+
|
|
20158
20499
|
// packages/execution/dist/tools/fortemi-bridge.js
|
|
20159
|
-
import { existsSync as
|
|
20160
|
-
import { join as
|
|
20500
|
+
import { existsSync as existsSync27, readFileSync as readFileSync20 } from "node:fs";
|
|
20501
|
+
import { join as join41 } from "node:path";
|
|
20161
20502
|
function loadBridgeState(repoRoot) {
|
|
20162
|
-
const bridgeFile =
|
|
20163
|
-
if (!
|
|
20503
|
+
const bridgeFile = join41(repoRoot, ".oa", "fortemi-bridge.json");
|
|
20504
|
+
if (!existsSync27(bridgeFile))
|
|
20164
20505
|
return null;
|
|
20165
20506
|
try {
|
|
20166
|
-
return JSON.parse(
|
|
20507
|
+
return JSON.parse(readFileSync20(bridgeFile, "utf8"));
|
|
20167
20508
|
} catch {
|
|
20168
20509
|
return null;
|
|
20169
20510
|
}
|
|
@@ -20411,8 +20752,8 @@ var init_gitWorktree = __esm({
|
|
|
20411
20752
|
});
|
|
20412
20753
|
|
|
20413
20754
|
// packages/execution/dist/patchApplier.js
|
|
20414
|
-
import { readFileSync as
|
|
20415
|
-
import { dirname as
|
|
20755
|
+
import { readFileSync as readFileSync21, writeFileSync as writeFileSync9, existsSync as existsSync28, mkdirSync as mkdirSync9 } from "node:fs";
|
|
20756
|
+
import { dirname as dirname12 } from "node:path";
|
|
20416
20757
|
import { spawn as spawn14 } from "node:child_process";
|
|
20417
20758
|
async function applyPatch(patch) {
|
|
20418
20759
|
switch (patch.type) {
|
|
@@ -20427,7 +20768,7 @@ async function applyPatch(patch) {
|
|
|
20427
20768
|
}
|
|
20428
20769
|
}
|
|
20429
20770
|
function applyBlockReplace(patch) {
|
|
20430
|
-
const original =
|
|
20771
|
+
const original = readFileSync21(patch.filePath, "utf-8");
|
|
20431
20772
|
if (!original.includes(patch.oldContent)) {
|
|
20432
20773
|
throw new Error(`Block not found in "${patch.filePath}": the oldContent string was not found in the file.`);
|
|
20433
20774
|
}
|
|
@@ -20438,10 +20779,10 @@ function applyRewrite(patch) {
|
|
|
20438
20779
|
writeFileSync9(patch.filePath, patch.newContent, "utf-8");
|
|
20439
20780
|
}
|
|
20440
20781
|
function applyNewFile(patch) {
|
|
20441
|
-
if (
|
|
20782
|
+
if (existsSync28(patch.filePath)) {
|
|
20442
20783
|
throw new Error(`Cannot create new file: "${patch.filePath}" already exists.`);
|
|
20443
20784
|
}
|
|
20444
|
-
mkdirSync9(
|
|
20785
|
+
mkdirSync9(dirname12(patch.filePath), { recursive: true });
|
|
20445
20786
|
writeFileSync9(patch.filePath, patch.newContent, "utf-8");
|
|
20446
20787
|
}
|
|
20447
20788
|
async function applyUnifiedDiff(patch) {
|
|
@@ -20453,7 +20794,7 @@ async function applyUnifiedDiff(patch) {
|
|
|
20453
20794
|
"-p1",
|
|
20454
20795
|
filePath
|
|
20455
20796
|
],
|
|
20456
|
-
cwd:
|
|
20797
|
+
cwd: dirname12(filePath),
|
|
20457
20798
|
stdin: diff
|
|
20458
20799
|
});
|
|
20459
20800
|
if (!result.success) {
|
|
@@ -20955,6 +21296,7 @@ __export(dist_exports, {
|
|
|
20955
21296
|
ReflectionIntegrityTool: () => ReflectionIntegrityTool,
|
|
20956
21297
|
ReminderTool: () => ReminderTool,
|
|
20957
21298
|
ReplTool: () => ReplTool,
|
|
21299
|
+
RepoMapTool: () => RepoMapTool,
|
|
20958
21300
|
SchedulerTool: () => SchedulerTool,
|
|
20959
21301
|
ScreenshotTool: () => ScreenshotTool,
|
|
20960
21302
|
SemanticMapTool: () => SemanticMapTool,
|
|
@@ -20978,6 +21320,7 @@ __export(dist_exports, {
|
|
|
20978
21320
|
applyPatch: () => applyPatch,
|
|
20979
21321
|
buildCompactDiff: () => buildCompactDiff,
|
|
20980
21322
|
buildCustomTools: () => buildCustomTools,
|
|
21323
|
+
buildGraph: () => buildGraph,
|
|
20981
21324
|
buildSkillsSummary: () => buildSkillsSummary,
|
|
20982
21325
|
checkDesktopDeps: () => checkDesktopDeps,
|
|
20983
21326
|
clearExploreNotes: () => clearExploreNotes,
|
|
@@ -21015,11 +21358,13 @@ __export(dist_exports, {
|
|
|
21015
21358
|
runBuild: () => runBuild,
|
|
21016
21359
|
runFormatter: () => runFormatter,
|
|
21017
21360
|
runLinter: () => runLinter,
|
|
21361
|
+
runPageRank: () => runPageRank,
|
|
21018
21362
|
runShell: () => runShell,
|
|
21019
21363
|
runTests: () => runTests,
|
|
21020
21364
|
runTypecheck: () => runTypecheck,
|
|
21021
21365
|
runValidationPipeline: () => runValidationPipeline,
|
|
21022
21366
|
saveCustomToolDefinition: () => saveCustomToolDefinition,
|
|
21367
|
+
serializeMap: () => serializeMap,
|
|
21023
21368
|
setChangeLogSession: () => setChangeLogSession,
|
|
21024
21369
|
setSudoPassword: () => setSudoPassword,
|
|
21025
21370
|
touchFile: () => touchFile
|
|
@@ -21084,6 +21429,7 @@ var init_dist2 = __esm({
|
|
|
21084
21429
|
init_working_notes();
|
|
21085
21430
|
init_semantic_map();
|
|
21086
21431
|
init_change_log();
|
|
21432
|
+
init_repo_map();
|
|
21087
21433
|
init_nexus();
|
|
21088
21434
|
init_fortemi_bridge();
|
|
21089
21435
|
init_system_deps();
|
|
@@ -21770,17 +22116,17 @@ var init_dist3 = __esm({
|
|
|
21770
22116
|
});
|
|
21771
22117
|
|
|
21772
22118
|
// packages/orchestrator/dist/promptLoader.js
|
|
21773
|
-
import { readFileSync as
|
|
21774
|
-
import { join as
|
|
22119
|
+
import { readFileSync as readFileSync22, existsSync as existsSync29 } from "node:fs";
|
|
22120
|
+
import { join as join42, dirname as dirname13 } from "node:path";
|
|
21775
22121
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
21776
22122
|
function loadPrompt(promptPath, vars) {
|
|
21777
22123
|
let content = cache.get(promptPath);
|
|
21778
22124
|
if (content === void 0) {
|
|
21779
|
-
const fullPath =
|
|
21780
|
-
if (!
|
|
22125
|
+
const fullPath = join42(PROMPTS_DIR, promptPath);
|
|
22126
|
+
if (!existsSync29(fullPath)) {
|
|
21781
22127
|
throw new Error(`Prompt file not found: ${fullPath}`);
|
|
21782
22128
|
}
|
|
21783
|
-
content =
|
|
22129
|
+
content = readFileSync22(fullPath, "utf-8");
|
|
21784
22130
|
cache.set(promptPath, content);
|
|
21785
22131
|
}
|
|
21786
22132
|
if (!vars)
|
|
@@ -21792,8 +22138,8 @@ var init_promptLoader = __esm({
|
|
|
21792
22138
|
"packages/orchestrator/dist/promptLoader.js"() {
|
|
21793
22139
|
"use strict";
|
|
21794
22140
|
__filename = fileURLToPath7(import.meta.url);
|
|
21795
|
-
__dirname4 =
|
|
21796
|
-
PROMPTS_DIR =
|
|
22141
|
+
__dirname4 = dirname13(__filename);
|
|
22142
|
+
PROMPTS_DIR = join42(__dirname4, "..", "prompts");
|
|
21797
22143
|
cache = /* @__PURE__ */ new Map();
|
|
21798
22144
|
}
|
|
21799
22145
|
});
|
|
@@ -22173,7 +22519,7 @@ var init_code_retriever = __esm({
|
|
|
22173
22519
|
import { execFile as execFile6 } from "node:child_process";
|
|
22174
22520
|
import { promisify as promisify5 } from "node:util";
|
|
22175
22521
|
import { readFile as readFile20, readdir as readdir5, stat as stat3 } from "node:fs/promises";
|
|
22176
|
-
import { join as
|
|
22522
|
+
import { join as join43, extname as extname8 } from "node:path";
|
|
22177
22523
|
async function searchByPath(pathPattern, options) {
|
|
22178
22524
|
const allFiles = await collectFiles(options.rootDir, options.includeGlobs ?? DEFAULT_INCLUDE_GLOBS, options.excludeGlobs ?? DEFAULT_EXCLUDE_GLOBS);
|
|
22179
22525
|
const pattern = options.caseInsensitive ? pathPattern.toLowerCase() : pathPattern;
|
|
@@ -22315,11 +22661,11 @@ async function walkForFiles(rootDir, dir, excludeGlobs, results) {
|
|
|
22315
22661
|
continue;
|
|
22316
22662
|
if (excludeGlobs.some((g) => entry.name === g || matchesGlob(entry.name, g)))
|
|
22317
22663
|
continue;
|
|
22318
|
-
const absPath =
|
|
22664
|
+
const absPath = join43(dir, entry.name);
|
|
22319
22665
|
if (entry.isDirectory()) {
|
|
22320
22666
|
await walkForFiles(rootDir, absPath, excludeGlobs, results);
|
|
22321
22667
|
} else if (entry.isFile()) {
|
|
22322
|
-
const ext =
|
|
22668
|
+
const ext = extname8(entry.name);
|
|
22323
22669
|
if (!ALL_CODE_EXTS.has(ext))
|
|
22324
22670
|
continue;
|
|
22325
22671
|
const relativePath = absPath.startsWith(rootDir) ? absPath.slice(rootDir.length).replace(/^\//, "") : absPath;
|
|
@@ -22622,7 +22968,7 @@ var init_graphExpand = __esm({
|
|
|
22622
22968
|
|
|
22623
22969
|
// packages/retrieval/dist/snippetPacker.js
|
|
22624
22970
|
import { readFile as readFile21 } from "node:fs/promises";
|
|
22625
|
-
import { join as
|
|
22971
|
+
import { join as join44 } from "node:path";
|
|
22626
22972
|
async function packSnippets(requests, opts = {}) {
|
|
22627
22973
|
const maxTokens = opts.maxTokens ?? DEFAULT_MAX_TOKENS;
|
|
22628
22974
|
const contextLines = opts.contextLines ?? DEFAULT_CONTEXT_LINES;
|
|
@@ -22648,7 +22994,7 @@ async function packSnippets(requests, opts = {}) {
|
|
|
22648
22994
|
return { packed, dropped, totalTokens };
|
|
22649
22995
|
}
|
|
22650
22996
|
async function extractSnippet(req, repoRoot, contextLines = DEFAULT_CONTEXT_LINES) {
|
|
22651
|
-
const absPath = req.filePath.startsWith("/") ? req.filePath :
|
|
22997
|
+
const absPath = req.filePath.startsWith("/") ? req.filePath : join44(repoRoot, req.filePath);
|
|
22652
22998
|
let content;
|
|
22653
22999
|
try {
|
|
22654
23000
|
content = await readFile21(absPath, "utf-8");
|
|
@@ -25373,8 +25719,8 @@ ${marker}` : marker);
|
|
|
25373
25719
|
return;
|
|
25374
25720
|
try {
|
|
25375
25721
|
const { mkdirSync: mkdirSync24, writeFileSync: writeFileSync23 } = __require("node:fs");
|
|
25376
|
-
const { join:
|
|
25377
|
-
const sessionDir =
|
|
25722
|
+
const { join: join69 } = __require("node:path");
|
|
25723
|
+
const sessionDir = join69(this._workingDirectory, ".oa", "session", this._sessionId);
|
|
25378
25724
|
mkdirSync24(sessionDir, { recursive: true });
|
|
25379
25725
|
const checkpoint = {
|
|
25380
25726
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -25387,7 +25733,7 @@ ${marker}` : marker);
|
|
|
25387
25733
|
memexEntryCount: this._memexArchive.size,
|
|
25388
25734
|
fileRegistrySize: this._fileRegistry.size
|
|
25389
25735
|
};
|
|
25390
|
-
writeFileSync23(
|
|
25736
|
+
writeFileSync23(join69(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
|
|
25391
25737
|
} catch {
|
|
25392
25738
|
}
|
|
25393
25739
|
}
|
|
@@ -26706,9 +27052,9 @@ ${transcript}`
|
|
|
26706
27052
|
});
|
|
26707
27053
|
|
|
26708
27054
|
// packages/orchestrator/dist/nexusBackend.js
|
|
26709
|
-
import { existsSync as
|
|
27055
|
+
import { existsSync as existsSync30, statSync as statSync10, openSync, readSync, closeSync, unlinkSync as unlinkSync4, writeFileSync as writeFileSync10 } from "node:fs";
|
|
26710
27056
|
import { watch as fsWatch } from "node:fs";
|
|
26711
|
-
import { join as
|
|
27057
|
+
import { join as join45 } from "node:path";
|
|
26712
27058
|
import { tmpdir as tmpdir7 } from "node:os";
|
|
26713
27059
|
import { randomBytes as randomBytes10 } from "node:crypto";
|
|
26714
27060
|
var NexusAgenticBackend;
|
|
@@ -26858,7 +27204,7 @@ var init_nexusBackend = __esm({
|
|
|
26858
27204
|
* Falls back to unary + word-split if streaming setup fails.
|
|
26859
27205
|
*/
|
|
26860
27206
|
async *chatCompletionStream(request) {
|
|
26861
|
-
const streamFile =
|
|
27207
|
+
const streamFile = join45(tmpdir7(), `nexus-stream-${randomBytes10(6).toString("hex")}.jsonl`);
|
|
26862
27208
|
writeFileSync10(streamFile, "", "utf8");
|
|
26863
27209
|
const daemonArgs = {
|
|
26864
27210
|
model: this.model,
|
|
@@ -26978,7 +27324,7 @@ var init_nexusBackend = __esm({
|
|
|
26978
27324
|
finish();
|
|
26979
27325
|
}, 50);
|
|
26980
27326
|
});
|
|
26981
|
-
const stat5 =
|
|
27327
|
+
const stat5 = statSync10(streamFile, { throwIfNoEntry: false });
|
|
26982
27328
|
if (!stat5 || stat5.size <= position)
|
|
26983
27329
|
continue;
|
|
26984
27330
|
const fd = openSync(streamFile, "r");
|
|
@@ -27894,8 +28240,8 @@ __export(listen_exports, {
|
|
|
27894
28240
|
waitForTranscribeCli: () => waitForTranscribeCli
|
|
27895
28241
|
});
|
|
27896
28242
|
import { spawn as spawn15, execSync as execSync22 } from "node:child_process";
|
|
27897
|
-
import { existsSync as
|
|
27898
|
-
import { join as
|
|
28243
|
+
import { existsSync as existsSync31, mkdirSync as mkdirSync10, writeFileSync as writeFileSync11, readdirSync as readdirSync7 } from "node:fs";
|
|
28244
|
+
import { join as join46, dirname as dirname14 } from "node:path";
|
|
27899
28245
|
import { homedir as homedir10 } from "node:os";
|
|
27900
28246
|
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
27901
28247
|
import { EventEmitter } from "node:events";
|
|
@@ -27979,17 +28325,17 @@ function findMicCaptureCommand() {
|
|
|
27979
28325
|
return null;
|
|
27980
28326
|
}
|
|
27981
28327
|
function findLiveWhisperScript() {
|
|
27982
|
-
const thisDir =
|
|
28328
|
+
const thisDir = dirname14(fileURLToPath8(import.meta.url));
|
|
27983
28329
|
const candidates = [
|
|
27984
|
-
|
|
27985
|
-
|
|
27986
|
-
|
|
28330
|
+
join46(thisDir, "../../../../packages/execution/scripts/live-whisper.py"),
|
|
28331
|
+
join46(thisDir, "../../../packages/execution/scripts/live-whisper.py"),
|
|
28332
|
+
join46(thisDir, "../../execution/scripts/live-whisper.py"),
|
|
27987
28333
|
// npm install layout — scripts bundled alongside dist
|
|
27988
|
-
|
|
27989
|
-
|
|
28334
|
+
join46(thisDir, "../scripts/live-whisper.py"),
|
|
28335
|
+
join46(thisDir, "../../scripts/live-whisper.py")
|
|
27990
28336
|
];
|
|
27991
28337
|
for (const p of candidates) {
|
|
27992
|
-
if (
|
|
28338
|
+
if (existsSync31(p))
|
|
27993
28339
|
return p;
|
|
27994
28340
|
}
|
|
27995
28341
|
try {
|
|
@@ -27999,21 +28345,21 @@ function findLiveWhisperScript() {
|
|
|
27999
28345
|
stdio: ["pipe", "pipe", "pipe"]
|
|
28000
28346
|
}).trim();
|
|
28001
28347
|
const candidates2 = [
|
|
28002
|
-
|
|
28003
|
-
|
|
28348
|
+
join46(globalRoot, "open-agents-ai", "dist", "scripts", "live-whisper.py"),
|
|
28349
|
+
join46(globalRoot, "open-agents-ai", "scripts", "live-whisper.py")
|
|
28004
28350
|
];
|
|
28005
28351
|
for (const p of candidates2) {
|
|
28006
|
-
if (
|
|
28352
|
+
if (existsSync31(p))
|
|
28007
28353
|
return p;
|
|
28008
28354
|
}
|
|
28009
28355
|
} catch {
|
|
28010
28356
|
}
|
|
28011
|
-
const nvmBase =
|
|
28012
|
-
if (
|
|
28357
|
+
const nvmBase = join46(homedir10(), ".nvm", "versions", "node");
|
|
28358
|
+
if (existsSync31(nvmBase)) {
|
|
28013
28359
|
try {
|
|
28014
|
-
for (const ver of
|
|
28015
|
-
const p =
|
|
28016
|
-
if (
|
|
28360
|
+
for (const ver of readdirSync7(nvmBase)) {
|
|
28361
|
+
const p = join46(nvmBase, ver, "lib", "node_modules", "open-agents-ai", "dist", "scripts", "live-whisper.py");
|
|
28362
|
+
if (existsSync31(p))
|
|
28017
28363
|
return p;
|
|
28018
28364
|
}
|
|
28019
28365
|
} catch {
|
|
@@ -28031,7 +28377,7 @@ function ensureTranscribeCliBackground() {
|
|
|
28031
28377
|
timeout: 5e3,
|
|
28032
28378
|
stdio: ["pipe", "pipe", "pipe"]
|
|
28033
28379
|
}).trim();
|
|
28034
|
-
if (
|
|
28380
|
+
if (existsSync31(join46(globalRoot, "transcribe-cli", "dist", "index.js"))) {
|
|
28035
28381
|
return true;
|
|
28036
28382
|
}
|
|
28037
28383
|
} catch {
|
|
@@ -28254,24 +28600,24 @@ var init_listen = __esm({
|
|
|
28254
28600
|
timeout: 5e3,
|
|
28255
28601
|
stdio: ["pipe", "pipe", "pipe"]
|
|
28256
28602
|
}).trim();
|
|
28257
|
-
const tcPath =
|
|
28258
|
-
if (
|
|
28603
|
+
const tcPath = join46(globalRoot, "transcribe-cli");
|
|
28604
|
+
if (existsSync31(join46(tcPath, "dist", "index.js"))) {
|
|
28259
28605
|
const { createRequire: createRequire4 } = await import("node:module");
|
|
28260
28606
|
const req = createRequire4(import.meta.url);
|
|
28261
|
-
return req(
|
|
28607
|
+
return req(join46(tcPath, "dist", "index.js"));
|
|
28262
28608
|
}
|
|
28263
28609
|
} catch {
|
|
28264
28610
|
}
|
|
28265
|
-
const nvmBase =
|
|
28266
|
-
if (
|
|
28611
|
+
const nvmBase = join46(homedir10(), ".nvm", "versions", "node");
|
|
28612
|
+
if (existsSync31(nvmBase)) {
|
|
28267
28613
|
try {
|
|
28268
|
-
const { readdirSync:
|
|
28269
|
-
for (const ver of
|
|
28270
|
-
const tcPath =
|
|
28271
|
-
if (
|
|
28614
|
+
const { readdirSync: readdirSync19 } = await import("node:fs");
|
|
28615
|
+
for (const ver of readdirSync19(nvmBase)) {
|
|
28616
|
+
const tcPath = join46(nvmBase, ver, "lib", "node_modules", "transcribe-cli");
|
|
28617
|
+
if (existsSync31(join46(tcPath, "dist", "index.js"))) {
|
|
28272
28618
|
const { createRequire: createRequire4 } = await import("node:module");
|
|
28273
28619
|
const req = createRequire4(import.meta.url);
|
|
28274
|
-
return req(
|
|
28620
|
+
return req(join46(tcPath, "dist", "index.js"));
|
|
28275
28621
|
}
|
|
28276
28622
|
}
|
|
28277
28623
|
} catch {
|
|
@@ -28552,10 +28898,10 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
28552
28898
|
wordTimestamps: false
|
|
28553
28899
|
});
|
|
28554
28900
|
if (outputDir) {
|
|
28555
|
-
const { basename:
|
|
28556
|
-
const transcriptDir =
|
|
28901
|
+
const { basename: basename17 } = await import("node:path");
|
|
28902
|
+
const transcriptDir = join46(outputDir, ".oa", "transcripts");
|
|
28557
28903
|
mkdirSync10(transcriptDir, { recursive: true });
|
|
28558
|
-
const outFile =
|
|
28904
|
+
const outFile = join46(transcriptDir, `${basename17(filePath)}.txt`);
|
|
28559
28905
|
writeFileSync11(outFile, result.text, "utf-8");
|
|
28560
28906
|
}
|
|
28561
28907
|
return {
|
|
@@ -33774,8 +34120,8 @@ import { EventEmitter as EventEmitter3 } from "node:events";
|
|
|
33774
34120
|
import { randomBytes as randomBytes11 } from "node:crypto";
|
|
33775
34121
|
import { URL as URL2 } from "node:url";
|
|
33776
34122
|
import { loadavg, cpus, totalmem, freemem } from "node:os";
|
|
33777
|
-
import { existsSync as
|
|
33778
|
-
import { join as
|
|
34123
|
+
import { existsSync as existsSync32, readFileSync as readFileSync23, writeFileSync as writeFileSync12, unlinkSync as unlinkSync5, mkdirSync as mkdirSync11, readdirSync as readdirSync8, statSync as statSync11 } from "node:fs";
|
|
34124
|
+
import { join as join47 } from "node:path";
|
|
33779
34125
|
function cleanForwardHeaders(raw, targetHost) {
|
|
33780
34126
|
const out = {};
|
|
33781
34127
|
for (const [key, value] of Object.entries(raw)) {
|
|
@@ -33803,10 +34149,10 @@ function fmtTokens(n) {
|
|
|
33803
34149
|
}
|
|
33804
34150
|
function readExposeState(stateDir) {
|
|
33805
34151
|
try {
|
|
33806
|
-
const path =
|
|
33807
|
-
if (!
|
|
34152
|
+
const path = join47(stateDir, STATE_FILE_NAME);
|
|
34153
|
+
if (!existsSync32(path))
|
|
33808
34154
|
return null;
|
|
33809
|
-
const raw =
|
|
34155
|
+
const raw = readFileSync23(path, "utf8");
|
|
33810
34156
|
const data = JSON.parse(raw);
|
|
33811
34157
|
if (!data.pid || !data.tunnelUrl || !data.authKey || !data.proxyPort)
|
|
33812
34158
|
return null;
|
|
@@ -33818,13 +34164,13 @@ function readExposeState(stateDir) {
|
|
|
33818
34164
|
function writeExposeState(stateDir, state) {
|
|
33819
34165
|
try {
|
|
33820
34166
|
mkdirSync11(stateDir, { recursive: true });
|
|
33821
|
-
writeFileSync12(
|
|
34167
|
+
writeFileSync12(join47(stateDir, STATE_FILE_NAME), JSON.stringify(state, null, 2));
|
|
33822
34168
|
} catch {
|
|
33823
34169
|
}
|
|
33824
34170
|
}
|
|
33825
34171
|
function removeExposeState(stateDir) {
|
|
33826
34172
|
try {
|
|
33827
|
-
unlinkSync5(
|
|
34173
|
+
unlinkSync5(join47(stateDir, STATE_FILE_NAME));
|
|
33828
34174
|
} catch {
|
|
33829
34175
|
}
|
|
33830
34176
|
}
|
|
@@ -33913,10 +34259,10 @@ async function collectSystemMetricsAsync() {
|
|
|
33913
34259
|
}
|
|
33914
34260
|
function readP2PExposeState(stateDir) {
|
|
33915
34261
|
try {
|
|
33916
|
-
const path =
|
|
33917
|
-
if (!
|
|
34262
|
+
const path = join47(stateDir, P2P_STATE_FILE_NAME);
|
|
34263
|
+
if (!existsSync32(path))
|
|
33918
34264
|
return null;
|
|
33919
|
-
const raw =
|
|
34265
|
+
const raw = readFileSync23(path, "utf8");
|
|
33920
34266
|
const data = JSON.parse(raw);
|
|
33921
34267
|
if (!data.peerId || !data.authKey)
|
|
33922
34268
|
return null;
|
|
@@ -33928,13 +34274,13 @@ function readP2PExposeState(stateDir) {
|
|
|
33928
34274
|
function writeP2PExposeState(stateDir, state) {
|
|
33929
34275
|
try {
|
|
33930
34276
|
mkdirSync11(stateDir, { recursive: true });
|
|
33931
|
-
writeFileSync12(
|
|
34277
|
+
writeFileSync12(join47(stateDir, P2P_STATE_FILE_NAME), JSON.stringify(state, null, 2));
|
|
33932
34278
|
} catch {
|
|
33933
34279
|
}
|
|
33934
34280
|
}
|
|
33935
34281
|
function removeP2PExposeState(stateDir) {
|
|
33936
34282
|
try {
|
|
33937
|
-
unlinkSync5(
|
|
34283
|
+
unlinkSync5(join47(stateDir, P2P_STATE_FILE_NAME));
|
|
33938
34284
|
} catch {
|
|
33939
34285
|
}
|
|
33940
34286
|
}
|
|
@@ -34782,10 +35128,10 @@ ${this.formatConnectionInfo()}`);
|
|
|
34782
35128
|
throw new Error(`Expose failed: ${exposeResult.error}`);
|
|
34783
35129
|
}
|
|
34784
35130
|
const nexusDir = this._nexusTool.getNexusDir();
|
|
34785
|
-
const statusPath =
|
|
35131
|
+
const statusPath = join47(nexusDir, "status.json");
|
|
34786
35132
|
for (let i = 0; i < 80; i++) {
|
|
34787
35133
|
try {
|
|
34788
|
-
const raw =
|
|
35134
|
+
const raw = readFileSync23(statusPath, "utf8");
|
|
34789
35135
|
if (raw.length > 10) {
|
|
34790
35136
|
const status = JSON.parse(raw);
|
|
34791
35137
|
if (status.connected && status.peerId) {
|
|
@@ -34816,9 +35162,9 @@ ${this.formatConnectionInfo()}`);
|
|
|
34816
35162
|
});
|
|
34817
35163
|
}
|
|
34818
35164
|
try {
|
|
34819
|
-
const invocDir =
|
|
34820
|
-
if (
|
|
34821
|
-
this._prevInvocCount =
|
|
35165
|
+
const invocDir = join47(nexusDir, "invocations");
|
|
35166
|
+
if (existsSync32(invocDir)) {
|
|
35167
|
+
this._prevInvocCount = readdirSync8(invocDir).filter((f) => f.endsWith(".json")).length;
|
|
34822
35168
|
this._stats.totalRequests = this._prevInvocCount;
|
|
34823
35169
|
}
|
|
34824
35170
|
} catch {
|
|
@@ -34846,13 +35192,13 @@ ${this.formatConnectionInfo()}`);
|
|
|
34846
35192
|
if (!state)
|
|
34847
35193
|
return null;
|
|
34848
35194
|
const nexusDir = nexusTool.getNexusDir();
|
|
34849
|
-
const statusPath =
|
|
35195
|
+
const statusPath = join47(nexusDir, "status.json");
|
|
34850
35196
|
try {
|
|
34851
|
-
if (!
|
|
35197
|
+
if (!existsSync32(statusPath)) {
|
|
34852
35198
|
removeP2PExposeState(stateDir);
|
|
34853
35199
|
return null;
|
|
34854
35200
|
}
|
|
34855
|
-
const status = JSON.parse(
|
|
35201
|
+
const status = JSON.parse(readFileSync23(statusPath, "utf8"));
|
|
34856
35202
|
if (!status.connected || !status.peerId) {
|
|
34857
35203
|
removeP2PExposeState(stateDir);
|
|
34858
35204
|
return null;
|
|
@@ -34905,10 +35251,10 @@ ${this.formatConnectionInfo()}`);
|
|
|
34905
35251
|
let lastMeteringLineCount = 0;
|
|
34906
35252
|
this._activityPollTimer = setInterval(() => {
|
|
34907
35253
|
try {
|
|
34908
|
-
const invocDir =
|
|
34909
|
-
if (!
|
|
35254
|
+
const invocDir = join47(nexusDir, "invocations");
|
|
35255
|
+
if (!existsSync32(invocDir))
|
|
34910
35256
|
return;
|
|
34911
|
-
const files =
|
|
35257
|
+
const files = readdirSync8(invocDir).filter((f) => f.endsWith(".json"));
|
|
34912
35258
|
const invocCount = files.length;
|
|
34913
35259
|
const newRequests = invocCount - this._prevInvocCount;
|
|
34914
35260
|
if (newRequests > 0) {
|
|
@@ -34921,17 +35267,17 @@ ${this.formatConnectionInfo()}`);
|
|
|
34921
35267
|
let recentActive = 0;
|
|
34922
35268
|
for (const f of files.slice(-10)) {
|
|
34923
35269
|
try {
|
|
34924
|
-
const st =
|
|
35270
|
+
const st = statSync11(join47(invocDir, f));
|
|
34925
35271
|
if (now - st.mtimeMs < 1e4)
|
|
34926
35272
|
recentActive++;
|
|
34927
35273
|
} catch {
|
|
34928
35274
|
}
|
|
34929
35275
|
}
|
|
34930
|
-
const meteringFile =
|
|
35276
|
+
const meteringFile = join47(nexusDir, "metering.jsonl");
|
|
34931
35277
|
let meteringLines = lastMeteringLineCount;
|
|
34932
35278
|
try {
|
|
34933
|
-
if (
|
|
34934
|
-
const content =
|
|
35279
|
+
if (existsSync32(meteringFile)) {
|
|
35280
|
+
const content = readFileSync23(meteringFile, "utf8");
|
|
34935
35281
|
meteringLines = content.split("\n").filter((l) => l.trim()).length;
|
|
34936
35282
|
}
|
|
34937
35283
|
} catch {
|
|
@@ -34957,9 +35303,9 @@ ${this.formatConnectionInfo()}`);
|
|
|
34957
35303
|
this._activityPollTimer.unref();
|
|
34958
35304
|
this._pollTimer = setInterval(() => {
|
|
34959
35305
|
try {
|
|
34960
|
-
const statusPath =
|
|
34961
|
-
if (
|
|
34962
|
-
const status = JSON.parse(
|
|
35306
|
+
const statusPath = join47(nexusDir, "status.json");
|
|
35307
|
+
if (existsSync32(statusPath)) {
|
|
35308
|
+
const status = JSON.parse(readFileSync23(statusPath, "utf8"));
|
|
34963
35309
|
if (status.peerId && !this._peerId) {
|
|
34964
35310
|
this._peerId = status.peerId;
|
|
34965
35311
|
}
|
|
@@ -34968,9 +35314,9 @@ ${this.formatConnectionInfo()}`);
|
|
|
34968
35314
|
} catch {
|
|
34969
35315
|
}
|
|
34970
35316
|
try {
|
|
34971
|
-
const invocDir =
|
|
34972
|
-
if (
|
|
34973
|
-
const files =
|
|
35317
|
+
const invocDir = join47(nexusDir, "invocations");
|
|
35318
|
+
if (existsSync32(invocDir)) {
|
|
35319
|
+
const files = readdirSync8(invocDir);
|
|
34974
35320
|
const invocCount = files.filter((f) => f.endsWith(".json")).length;
|
|
34975
35321
|
if (invocCount > this._stats.totalRequests) {
|
|
34976
35322
|
this._stats.totalRequests = invocCount;
|
|
@@ -34980,9 +35326,9 @@ ${this.formatConnectionInfo()}`);
|
|
|
34980
35326
|
} catch {
|
|
34981
35327
|
}
|
|
34982
35328
|
try {
|
|
34983
|
-
const meteringFile =
|
|
34984
|
-
if (
|
|
34985
|
-
const content =
|
|
35329
|
+
const meteringFile = join47(nexusDir, "metering.jsonl");
|
|
35330
|
+
if (existsSync32(meteringFile)) {
|
|
35331
|
+
const content = readFileSync23(meteringFile, "utf8");
|
|
34986
35332
|
if (content.length > lastMeteringSize) {
|
|
34987
35333
|
const newContent = content.slice(lastMeteringSize);
|
|
34988
35334
|
lastMeteringSize = content.length;
|
|
@@ -35191,8 +35537,8 @@ var init_types = __esm({
|
|
|
35191
35537
|
|
|
35192
35538
|
// packages/cli/dist/tui/p2p/secret-vault.js
|
|
35193
35539
|
import { createCipheriv as createCipheriv2, createDecipheriv as createDecipheriv2, randomBytes as randomBytes12, scryptSync as scryptSync2, createHash as createHash2 } from "node:crypto";
|
|
35194
|
-
import { readFileSync as
|
|
35195
|
-
import { join as
|
|
35540
|
+
import { readFileSync as readFileSync24, writeFileSync as writeFileSync13, existsSync as existsSync33, mkdirSync as mkdirSync12 } from "node:fs";
|
|
35541
|
+
import { join as join48, dirname as dirname15 } from "node:path";
|
|
35196
35542
|
var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
|
|
35197
35543
|
var init_secret_vault = __esm({
|
|
35198
35544
|
"packages/cli/dist/tui/p2p/secret-vault.js"() {
|
|
@@ -35403,8 +35749,8 @@ var init_secret_vault = __esm({
|
|
|
35403
35749
|
const encrypted = Buffer.concat([cipher.update(data, "utf8"), cipher.final()]);
|
|
35404
35750
|
const tag = cipher.getAuthTag();
|
|
35405
35751
|
const blob = Buffer.concat([salt, iv, tag, encrypted]);
|
|
35406
|
-
const dir =
|
|
35407
|
-
if (!
|
|
35752
|
+
const dir = dirname15(this.storePath);
|
|
35753
|
+
if (!existsSync33(dir))
|
|
35408
35754
|
mkdirSync12(dir, { recursive: true });
|
|
35409
35755
|
writeFileSync13(this.storePath, blob, { mode: 384 });
|
|
35410
35756
|
}
|
|
@@ -35413,9 +35759,9 @@ var init_secret_vault = __esm({
|
|
|
35413
35759
|
* Returns the number of secrets loaded.
|
|
35414
35760
|
*/
|
|
35415
35761
|
load(passphrase) {
|
|
35416
|
-
if (!this.storePath || !
|
|
35762
|
+
if (!this.storePath || !existsSync33(this.storePath))
|
|
35417
35763
|
return 0;
|
|
35418
|
-
const blob =
|
|
35764
|
+
const blob = readFileSync24(this.storePath);
|
|
35419
35765
|
if (blob.length < SALT_LEN + IV_LEN + 16) {
|
|
35420
35766
|
throw new Error("Vault file is corrupted (too small)");
|
|
35421
35767
|
}
|
|
@@ -36536,26 +36882,26 @@ async function fetchOpenAIModels(baseUrl, apiKey) {
|
|
|
36536
36882
|
async function fetchPeerModels(peerId, authKey) {
|
|
36537
36883
|
try {
|
|
36538
36884
|
const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
|
|
36539
|
-
const { existsSync:
|
|
36540
|
-
const { join:
|
|
36885
|
+
const { existsSync: existsSync50, readFileSync: readFileSync38 } = await import("node:fs");
|
|
36886
|
+
const { join: join69 } = await import("node:path");
|
|
36541
36887
|
const cwd4 = process.cwd();
|
|
36542
36888
|
const nexusTool = new NexusTool2(cwd4);
|
|
36543
36889
|
const nexusDir = nexusTool.getNexusDir();
|
|
36544
36890
|
let isLocalPeer = false;
|
|
36545
36891
|
try {
|
|
36546
|
-
const statusPath =
|
|
36547
|
-
if (
|
|
36548
|
-
const status = JSON.parse(
|
|
36892
|
+
const statusPath = join69(nexusDir, "status.json");
|
|
36893
|
+
if (existsSync50(statusPath)) {
|
|
36894
|
+
const status = JSON.parse(readFileSync38(statusPath, "utf8"));
|
|
36549
36895
|
if (status.peerId === peerId)
|
|
36550
36896
|
isLocalPeer = true;
|
|
36551
36897
|
}
|
|
36552
36898
|
} catch {
|
|
36553
36899
|
}
|
|
36554
36900
|
if (isLocalPeer) {
|
|
36555
|
-
const pricingPath =
|
|
36556
|
-
if (
|
|
36901
|
+
const pricingPath = join69(nexusDir, "pricing.json");
|
|
36902
|
+
if (existsSync50(pricingPath)) {
|
|
36557
36903
|
try {
|
|
36558
|
-
const pricing = JSON.parse(
|
|
36904
|
+
const pricing = JSON.parse(readFileSync38(pricingPath, "utf8"));
|
|
36559
36905
|
const localModels = (pricing.models || []).map((m) => ({
|
|
36560
36906
|
name: m.model || "unknown",
|
|
36561
36907
|
size: m.parameterSize || "",
|
|
@@ -36569,10 +36915,10 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
36569
36915
|
}
|
|
36570
36916
|
}
|
|
36571
36917
|
}
|
|
36572
|
-
const cachePath =
|
|
36573
|
-
if (
|
|
36918
|
+
const cachePath = join69(nexusDir, "peer-models-cache.json");
|
|
36919
|
+
if (existsSync50(cachePath)) {
|
|
36574
36920
|
try {
|
|
36575
|
-
const cache4 = JSON.parse(
|
|
36921
|
+
const cache4 = JSON.parse(readFileSync38(cachePath, "utf8"));
|
|
36576
36922
|
if (cache4.peerId === peerId && cache4.models?.length > 0) {
|
|
36577
36923
|
const age = Date.now() - new Date(cache4.cachedAt).getTime();
|
|
36578
36924
|
if (age < 5 * 60 * 1e3) {
|
|
@@ -36687,10 +37033,10 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
36687
37033
|
} catch {
|
|
36688
37034
|
}
|
|
36689
37035
|
if (isLocalPeer) {
|
|
36690
|
-
const pricingPath =
|
|
36691
|
-
if (
|
|
37036
|
+
const pricingPath = join69(nexusDir, "pricing.json");
|
|
37037
|
+
if (existsSync50(pricingPath)) {
|
|
36692
37038
|
try {
|
|
36693
|
-
const pricing = JSON.parse(
|
|
37039
|
+
const pricing = JSON.parse(readFileSync38(pricingPath, "utf8"));
|
|
36694
37040
|
return (pricing.models || []).map((m) => ({
|
|
36695
37041
|
name: m.model || "unknown",
|
|
36696
37042
|
size: m.parameterSize || "",
|
|
@@ -36970,17 +37316,17 @@ var init_render2 = __esm({
|
|
|
36970
37316
|
});
|
|
36971
37317
|
|
|
36972
37318
|
// packages/prompts/dist/promptLoader.js
|
|
36973
|
-
import { readFileSync as
|
|
36974
|
-
import { join as
|
|
37319
|
+
import { readFileSync as readFileSync25, existsSync as existsSync34 } from "node:fs";
|
|
37320
|
+
import { join as join49, dirname as dirname16 } from "node:path";
|
|
36975
37321
|
import { fileURLToPath as fileURLToPath9 } from "node:url";
|
|
36976
37322
|
function loadPrompt2(promptPath, vars) {
|
|
36977
37323
|
let content = cache2.get(promptPath);
|
|
36978
37324
|
if (content === void 0) {
|
|
36979
|
-
const fullPath =
|
|
36980
|
-
if (!
|
|
37325
|
+
const fullPath = join49(PROMPTS_DIR2, promptPath);
|
|
37326
|
+
if (!existsSync34(fullPath)) {
|
|
36981
37327
|
throw new Error(`Prompt file not found: ${fullPath}`);
|
|
36982
37328
|
}
|
|
36983
|
-
content =
|
|
37329
|
+
content = readFileSync25(fullPath, "utf-8");
|
|
36984
37330
|
cache2.set(promptPath, content);
|
|
36985
37331
|
}
|
|
36986
37332
|
if (!vars)
|
|
@@ -36992,10 +37338,10 @@ var init_promptLoader2 = __esm({
|
|
|
36992
37338
|
"packages/prompts/dist/promptLoader.js"() {
|
|
36993
37339
|
"use strict";
|
|
36994
37340
|
__filename2 = fileURLToPath9(import.meta.url);
|
|
36995
|
-
__dirname5 =
|
|
36996
|
-
devPath =
|
|
36997
|
-
publishedPath =
|
|
36998
|
-
PROMPTS_DIR2 =
|
|
37341
|
+
__dirname5 = dirname16(__filename2);
|
|
37342
|
+
devPath = join49(__dirname5, "..", "templates");
|
|
37343
|
+
publishedPath = join49(__dirname5, "..", "prompts", "templates");
|
|
37344
|
+
PROMPTS_DIR2 = existsSync34(devPath) ? devPath : publishedPath;
|
|
36999
37345
|
cache2 = /* @__PURE__ */ new Map();
|
|
37000
37346
|
}
|
|
37001
37347
|
});
|
|
@@ -37106,7 +37452,7 @@ var init_task_templates = __esm({
|
|
|
37106
37452
|
});
|
|
37107
37453
|
|
|
37108
37454
|
// packages/prompts/dist/index.js
|
|
37109
|
-
import { join as
|
|
37455
|
+
import { join as join50, dirname as dirname17 } from "node:path";
|
|
37110
37456
|
import { fileURLToPath as fileURLToPath10 } from "node:url";
|
|
37111
37457
|
var _dir, _packageRoot;
|
|
37112
37458
|
var init_dist6 = __esm({
|
|
@@ -37116,8 +37462,8 @@ var init_dist6 = __esm({
|
|
|
37116
37462
|
init_render2();
|
|
37117
37463
|
init_task_templates();
|
|
37118
37464
|
init_render2();
|
|
37119
|
-
_dir =
|
|
37120
|
-
_packageRoot =
|
|
37465
|
+
_dir = dirname17(fileURLToPath10(import.meta.url));
|
|
37466
|
+
_packageRoot = join50(_dir, "..");
|
|
37121
37467
|
}
|
|
37122
37468
|
});
|
|
37123
37469
|
|
|
@@ -37150,19 +37496,19 @@ __export(oa_directory_exports, {
|
|
|
37150
37496
|
writeIndexData: () => writeIndexData,
|
|
37151
37497
|
writeIndexMeta: () => writeIndexMeta
|
|
37152
37498
|
});
|
|
37153
|
-
import { existsSync as
|
|
37154
|
-
import { join as
|
|
37499
|
+
import { existsSync as existsSync35, mkdirSync as mkdirSync13, readFileSync as readFileSync26, writeFileSync as writeFileSync14, readdirSync as readdirSync9, statSync as statSync12, unlinkSync as unlinkSync6 } from "node:fs";
|
|
37500
|
+
import { join as join51, relative as relative3, basename as basename10, extname as extname9 } from "node:path";
|
|
37155
37501
|
import { homedir as homedir11 } from "node:os";
|
|
37156
37502
|
function initOaDirectory(repoRoot) {
|
|
37157
|
-
const oaPath =
|
|
37503
|
+
const oaPath = join51(repoRoot, OA_DIR);
|
|
37158
37504
|
for (const sub of SUBDIRS) {
|
|
37159
|
-
mkdirSync13(
|
|
37505
|
+
mkdirSync13(join51(oaPath, sub), { recursive: true });
|
|
37160
37506
|
}
|
|
37161
37507
|
try {
|
|
37162
|
-
const gitignorePath =
|
|
37508
|
+
const gitignorePath = join51(repoRoot, ".gitignore");
|
|
37163
37509
|
const settingsPattern = ".oa/settings.json";
|
|
37164
|
-
if (
|
|
37165
|
-
const content =
|
|
37510
|
+
if (existsSync35(gitignorePath)) {
|
|
37511
|
+
const content = readFileSync26(gitignorePath, "utf-8");
|
|
37166
37512
|
if (!content.includes(settingsPattern)) {
|
|
37167
37513
|
writeFileSync14(gitignorePath, content.trimEnd() + "\n" + settingsPattern + "\n", "utf-8");
|
|
37168
37514
|
}
|
|
@@ -37172,41 +37518,41 @@ function initOaDirectory(repoRoot) {
|
|
|
37172
37518
|
return oaPath;
|
|
37173
37519
|
}
|
|
37174
37520
|
function hasOaDirectory(repoRoot) {
|
|
37175
|
-
return
|
|
37521
|
+
return existsSync35(join51(repoRoot, OA_DIR, "index"));
|
|
37176
37522
|
}
|
|
37177
37523
|
function loadProjectSettings(repoRoot) {
|
|
37178
|
-
const settingsPath =
|
|
37524
|
+
const settingsPath = join51(repoRoot, OA_DIR, "settings.json");
|
|
37179
37525
|
try {
|
|
37180
|
-
if (
|
|
37181
|
-
return JSON.parse(
|
|
37526
|
+
if (existsSync35(settingsPath)) {
|
|
37527
|
+
return JSON.parse(readFileSync26(settingsPath, "utf-8"));
|
|
37182
37528
|
}
|
|
37183
37529
|
} catch {
|
|
37184
37530
|
}
|
|
37185
37531
|
return {};
|
|
37186
37532
|
}
|
|
37187
37533
|
function saveProjectSettings(repoRoot, settings) {
|
|
37188
|
-
const oaPath =
|
|
37534
|
+
const oaPath = join51(repoRoot, OA_DIR);
|
|
37189
37535
|
mkdirSync13(oaPath, { recursive: true });
|
|
37190
37536
|
const existing = loadProjectSettings(repoRoot);
|
|
37191
37537
|
const merged = { ...existing, ...settings };
|
|
37192
|
-
writeFileSync14(
|
|
37538
|
+
writeFileSync14(join51(oaPath, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
|
|
37193
37539
|
}
|
|
37194
37540
|
function loadGlobalSettings() {
|
|
37195
|
-
const settingsPath =
|
|
37541
|
+
const settingsPath = join51(homedir11(), ".open-agents", "settings.json");
|
|
37196
37542
|
try {
|
|
37197
|
-
if (
|
|
37198
|
-
return JSON.parse(
|
|
37543
|
+
if (existsSync35(settingsPath)) {
|
|
37544
|
+
return JSON.parse(readFileSync26(settingsPath, "utf-8"));
|
|
37199
37545
|
}
|
|
37200
37546
|
} catch {
|
|
37201
37547
|
}
|
|
37202
37548
|
return {};
|
|
37203
37549
|
}
|
|
37204
37550
|
function saveGlobalSettings(settings) {
|
|
37205
|
-
const dir =
|
|
37551
|
+
const dir = join51(homedir11(), ".open-agents");
|
|
37206
37552
|
mkdirSync13(dir, { recursive: true });
|
|
37207
37553
|
const existing = loadGlobalSettings();
|
|
37208
37554
|
const merged = { ...existing, ...settings };
|
|
37209
|
-
writeFileSync14(
|
|
37555
|
+
writeFileSync14(join51(dir, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
|
|
37210
37556
|
}
|
|
37211
37557
|
function resolveSettings(repoRoot) {
|
|
37212
37558
|
const global = loadGlobalSettings();
|
|
@@ -37221,18 +37567,18 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
|
|
|
37221
37567
|
while (dir && !visited.has(dir)) {
|
|
37222
37568
|
visited.add(dir);
|
|
37223
37569
|
for (const name of CONTEXT_FILES) {
|
|
37224
|
-
const filePath =
|
|
37570
|
+
const filePath = join51(dir, name);
|
|
37225
37571
|
const normalizedName = name.toLowerCase();
|
|
37226
|
-
if (
|
|
37572
|
+
if (existsSync35(filePath) && !seen.has(filePath)) {
|
|
37227
37573
|
seen.add(filePath);
|
|
37228
37574
|
try {
|
|
37229
|
-
let content =
|
|
37575
|
+
let content = readFileSync26(filePath, "utf-8");
|
|
37230
37576
|
if (content.length > maxContentLen) {
|
|
37231
37577
|
content = content.slice(0, maxContentLen) + "\n\n...(truncated)";
|
|
37232
37578
|
}
|
|
37233
37579
|
const type = normalizedName.includes("agents") ? "agents" : normalizedName === "oa.md" || normalizedName === ".open-agents.md" ? "oa" : normalizedName.includes("claude") ? "claude" : normalizedName.includes("readme") ? "readme" : normalizedName.includes("architect") ? "architecture" : normalizedName.includes("contribut") ? "contributing" : "other";
|
|
37234
37580
|
found.push({
|
|
37235
|
-
path:
|
|
37581
|
+
path: relative3(repoRoot, filePath) || name,
|
|
37236
37582
|
content,
|
|
37237
37583
|
type
|
|
37238
37584
|
});
|
|
@@ -37240,23 +37586,23 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
|
|
|
37240
37586
|
}
|
|
37241
37587
|
}
|
|
37242
37588
|
}
|
|
37243
|
-
const projectMap =
|
|
37244
|
-
if (
|
|
37589
|
+
const projectMap = join51(dir, OA_DIR, "context", "project-map.md");
|
|
37590
|
+
if (existsSync35(projectMap) && !seen.has(projectMap)) {
|
|
37245
37591
|
seen.add(projectMap);
|
|
37246
37592
|
try {
|
|
37247
|
-
let content =
|
|
37593
|
+
let content = readFileSync26(projectMap, "utf-8");
|
|
37248
37594
|
if (content.length > maxContentLen) {
|
|
37249
37595
|
content = content.slice(0, maxContentLen) + "\n\n...(truncated)";
|
|
37250
37596
|
}
|
|
37251
37597
|
found.push({
|
|
37252
|
-
path:
|
|
37598
|
+
path: relative3(repoRoot, projectMap),
|
|
37253
37599
|
content,
|
|
37254
37600
|
type: "oa"
|
|
37255
37601
|
});
|
|
37256
37602
|
} catch {
|
|
37257
37603
|
}
|
|
37258
37604
|
}
|
|
37259
|
-
const parent =
|
|
37605
|
+
const parent = join51(dir, "..");
|
|
37260
37606
|
if (parent === dir)
|
|
37261
37607
|
break;
|
|
37262
37608
|
dir = parent;
|
|
@@ -37274,34 +37620,34 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
|
|
|
37274
37620
|
return found;
|
|
37275
37621
|
}
|
|
37276
37622
|
function readIndexMeta(repoRoot) {
|
|
37277
|
-
const metaPath =
|
|
37623
|
+
const metaPath = join51(repoRoot, OA_DIR, "index", "meta.json");
|
|
37278
37624
|
try {
|
|
37279
|
-
return JSON.parse(
|
|
37625
|
+
return JSON.parse(readFileSync26(metaPath, "utf-8"));
|
|
37280
37626
|
} catch {
|
|
37281
37627
|
return null;
|
|
37282
37628
|
}
|
|
37283
37629
|
}
|
|
37284
37630
|
function writeIndexMeta(repoRoot, meta) {
|
|
37285
|
-
const metaPath =
|
|
37286
|
-
mkdirSync13(
|
|
37631
|
+
const metaPath = join51(repoRoot, OA_DIR, "index", "meta.json");
|
|
37632
|
+
mkdirSync13(join51(repoRoot, OA_DIR, "index"), { recursive: true });
|
|
37287
37633
|
writeFileSync14(metaPath, JSON.stringify(meta, null, 2), "utf-8");
|
|
37288
37634
|
}
|
|
37289
37635
|
function readIndexData(repoRoot, filename) {
|
|
37290
|
-
const filePath =
|
|
37636
|
+
const filePath = join51(repoRoot, OA_DIR, "index", filename);
|
|
37291
37637
|
try {
|
|
37292
|
-
return JSON.parse(
|
|
37638
|
+
return JSON.parse(readFileSync26(filePath, "utf-8"));
|
|
37293
37639
|
} catch {
|
|
37294
37640
|
return null;
|
|
37295
37641
|
}
|
|
37296
37642
|
}
|
|
37297
37643
|
function writeIndexData(repoRoot, filename, data) {
|
|
37298
|
-
const filePath =
|
|
37299
|
-
mkdirSync13(
|
|
37644
|
+
const filePath = join51(repoRoot, OA_DIR, "index", filename);
|
|
37645
|
+
mkdirSync13(join51(repoRoot, OA_DIR, "index"), { recursive: true });
|
|
37300
37646
|
writeFileSync14(filePath, JSON.stringify(data, null, 2), "utf-8");
|
|
37301
37647
|
}
|
|
37302
37648
|
function generateProjectMap(repoRoot) {
|
|
37303
37649
|
const sections = [];
|
|
37304
|
-
const repoName2 =
|
|
37650
|
+
const repoName2 = basename10(repoRoot);
|
|
37305
37651
|
sections.push(`# Project Map: ${repoName2}
|
|
37306
37652
|
`);
|
|
37307
37653
|
sections.push(`> Auto-generated by open-agents. Updated: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}
|
|
@@ -37345,28 +37691,28 @@ ${tree}\`\`\`
|
|
|
37345
37691
|
sections.push("");
|
|
37346
37692
|
}
|
|
37347
37693
|
const content = sections.join("\n");
|
|
37348
|
-
const contextDir =
|
|
37694
|
+
const contextDir = join51(repoRoot, OA_DIR, "context");
|
|
37349
37695
|
mkdirSync13(contextDir, { recursive: true });
|
|
37350
|
-
writeFileSync14(
|
|
37696
|
+
writeFileSync14(join51(contextDir, "project-map.md"), content, "utf-8");
|
|
37351
37697
|
return content;
|
|
37352
37698
|
}
|
|
37353
37699
|
function saveSession(repoRoot, session) {
|
|
37354
|
-
const historyDir =
|
|
37700
|
+
const historyDir = join51(repoRoot, OA_DIR, "history");
|
|
37355
37701
|
mkdirSync13(historyDir, { recursive: true });
|
|
37356
|
-
writeFileSync14(
|
|
37702
|
+
writeFileSync14(join51(historyDir, `${session.id}.json`), JSON.stringify(session, null, 2), "utf-8");
|
|
37357
37703
|
}
|
|
37358
37704
|
function loadRecentSessions(repoRoot, limit = 5) {
|
|
37359
|
-
const historyDir =
|
|
37360
|
-
if (!
|
|
37705
|
+
const historyDir = join51(repoRoot, OA_DIR, "history");
|
|
37706
|
+
if (!existsSync35(historyDir))
|
|
37361
37707
|
return [];
|
|
37362
37708
|
try {
|
|
37363
|
-
const files =
|
|
37364
|
-
const stat5 =
|
|
37709
|
+
const files = readdirSync9(historyDir).filter((f) => f.endsWith(".json") && f !== "pending-task.json").map((f) => {
|
|
37710
|
+
const stat5 = statSync12(join51(historyDir, f));
|
|
37365
37711
|
return { file: f, mtime: stat5.mtimeMs };
|
|
37366
37712
|
}).sort((a, b) => b.mtime - a.mtime).slice(0, limit);
|
|
37367
37713
|
return files.map((f) => {
|
|
37368
37714
|
try {
|
|
37369
|
-
return JSON.parse(
|
|
37715
|
+
return JSON.parse(readFileSync26(join51(historyDir, f.file), "utf-8"));
|
|
37370
37716
|
} catch {
|
|
37371
37717
|
return null;
|
|
37372
37718
|
}
|
|
@@ -37376,16 +37722,16 @@ function loadRecentSessions(repoRoot, limit = 5) {
|
|
|
37376
37722
|
}
|
|
37377
37723
|
}
|
|
37378
37724
|
function savePendingTask(repoRoot, task) {
|
|
37379
|
-
const historyDir =
|
|
37725
|
+
const historyDir = join51(repoRoot, OA_DIR, "history");
|
|
37380
37726
|
mkdirSync13(historyDir, { recursive: true });
|
|
37381
|
-
writeFileSync14(
|
|
37727
|
+
writeFileSync14(join51(historyDir, PENDING_TASK_FILE), JSON.stringify(task, null, 2) + "\n", "utf-8");
|
|
37382
37728
|
}
|
|
37383
37729
|
function loadPendingTask(repoRoot) {
|
|
37384
|
-
const filePath =
|
|
37730
|
+
const filePath = join51(repoRoot, OA_DIR, "history", PENDING_TASK_FILE);
|
|
37385
37731
|
try {
|
|
37386
|
-
if (!
|
|
37732
|
+
if (!existsSync35(filePath))
|
|
37387
37733
|
return null;
|
|
37388
|
-
const data = JSON.parse(
|
|
37734
|
+
const data = JSON.parse(readFileSync26(filePath, "utf-8"));
|
|
37389
37735
|
try {
|
|
37390
37736
|
unlinkSync6(filePath);
|
|
37391
37737
|
} catch {
|
|
@@ -37396,13 +37742,13 @@ function loadPendingTask(repoRoot) {
|
|
|
37396
37742
|
}
|
|
37397
37743
|
}
|
|
37398
37744
|
function saveSessionContext(repoRoot, entry) {
|
|
37399
|
-
const contextDir =
|
|
37745
|
+
const contextDir = join51(repoRoot, OA_DIR, "context");
|
|
37400
37746
|
mkdirSync13(contextDir, { recursive: true });
|
|
37401
|
-
const filePath =
|
|
37747
|
+
const filePath = join51(contextDir, CONTEXT_SAVE_FILE);
|
|
37402
37748
|
let ctx;
|
|
37403
37749
|
try {
|
|
37404
|
-
if (
|
|
37405
|
-
ctx = JSON.parse(
|
|
37750
|
+
if (existsSync35(filePath)) {
|
|
37751
|
+
ctx = JSON.parse(readFileSync26(filePath, "utf-8"));
|
|
37406
37752
|
} else {
|
|
37407
37753
|
ctx = { entries: [], maxEntries: MAX_CONTEXT_ENTRIES, updatedAt: "" };
|
|
37408
37754
|
}
|
|
@@ -37417,11 +37763,11 @@ function saveSessionContext(repoRoot, entry) {
|
|
|
37417
37763
|
writeFileSync14(filePath, JSON.stringify(ctx, null, 2) + "\n", "utf-8");
|
|
37418
37764
|
}
|
|
37419
37765
|
function loadSessionContext(repoRoot) {
|
|
37420
|
-
const filePath =
|
|
37766
|
+
const filePath = join51(repoRoot, OA_DIR, "context", CONTEXT_SAVE_FILE);
|
|
37421
37767
|
try {
|
|
37422
|
-
if (!
|
|
37768
|
+
if (!existsSync35(filePath))
|
|
37423
37769
|
return null;
|
|
37424
|
-
return JSON.parse(
|
|
37770
|
+
return JSON.parse(readFileSync26(filePath, "utf-8"));
|
|
37425
37771
|
} catch {
|
|
37426
37772
|
return null;
|
|
37427
37773
|
}
|
|
@@ -37467,12 +37813,12 @@ function detectManifests(repoRoot) {
|
|
|
37467
37813
|
{ file: "docker-compose.yaml", type: "Docker Compose" }
|
|
37468
37814
|
];
|
|
37469
37815
|
for (const check of checks) {
|
|
37470
|
-
const filePath =
|
|
37471
|
-
if (
|
|
37816
|
+
const filePath = join51(repoRoot, check.file);
|
|
37817
|
+
if (existsSync35(filePath)) {
|
|
37472
37818
|
let name;
|
|
37473
37819
|
if (check.nameField) {
|
|
37474
37820
|
try {
|
|
37475
|
-
const data = JSON.parse(
|
|
37821
|
+
const data = JSON.parse(readFileSync26(filePath, "utf-8"));
|
|
37476
37822
|
name = data[check.nameField];
|
|
37477
37823
|
} catch {
|
|
37478
37824
|
}
|
|
@@ -37501,7 +37847,7 @@ function findKeyFiles(repoRoot) {
|
|
|
37501
37847
|
{ pattern: "CLAUDE.md", description: "Claude Code context" }
|
|
37502
37848
|
];
|
|
37503
37849
|
for (const check of checks) {
|
|
37504
|
-
if (
|
|
37850
|
+
if (existsSync35(join51(repoRoot, check.pattern))) {
|
|
37505
37851
|
keyFiles.push({ path: check.pattern, description: check.description });
|
|
37506
37852
|
}
|
|
37507
37853
|
}
|
|
@@ -37512,7 +37858,7 @@ function buildDirTree(root, maxDepth, prefix = "", depth = 0) {
|
|
|
37512
37858
|
return "";
|
|
37513
37859
|
let result = "";
|
|
37514
37860
|
try {
|
|
37515
|
-
const entries =
|
|
37861
|
+
const entries = readdirSync9(root, { withFileTypes: true }).filter((e) => !e.name.startsWith(".") || e.name === ".github").filter((e) => !SKIP_DIRS.has(e.name)).sort((a, b) => {
|
|
37516
37862
|
if (a.isDirectory() && !b.isDirectory())
|
|
37517
37863
|
return -1;
|
|
37518
37864
|
if (!a.isDirectory() && b.isDirectory())
|
|
@@ -37527,12 +37873,12 @@ function buildDirTree(root, maxDepth, prefix = "", depth = 0) {
|
|
|
37527
37873
|
if (entry.isDirectory()) {
|
|
37528
37874
|
let fileCount = 0;
|
|
37529
37875
|
try {
|
|
37530
|
-
fileCount =
|
|
37876
|
+
fileCount = readdirSync9(join51(root, entry.name)).filter((f) => !f.startsWith(".")).length;
|
|
37531
37877
|
} catch {
|
|
37532
37878
|
}
|
|
37533
37879
|
result += `${prefix}${connector}${entry.name}/ (${fileCount})
|
|
37534
37880
|
`;
|
|
37535
|
-
result += buildDirTree(
|
|
37881
|
+
result += buildDirTree(join51(root, entry.name), maxDepth, childPrefix, depth + 1);
|
|
37536
37882
|
} else if (depth < maxDepth) {
|
|
37537
37883
|
result += `${prefix}${connector}${entry.name}
|
|
37538
37884
|
`;
|
|
@@ -37544,15 +37890,15 @@ function buildDirTree(root, maxDepth, prefix = "", depth = 0) {
|
|
|
37544
37890
|
}
|
|
37545
37891
|
function loadUsageFile(filePath) {
|
|
37546
37892
|
try {
|
|
37547
|
-
if (
|
|
37548
|
-
return JSON.parse(
|
|
37893
|
+
if (existsSync35(filePath)) {
|
|
37894
|
+
return JSON.parse(readFileSync26(filePath, "utf-8"));
|
|
37549
37895
|
}
|
|
37550
37896
|
} catch {
|
|
37551
37897
|
}
|
|
37552
37898
|
return { records: [] };
|
|
37553
37899
|
}
|
|
37554
37900
|
function saveUsageFile(filePath, data) {
|
|
37555
|
-
const dir =
|
|
37901
|
+
const dir = join51(filePath, "..");
|
|
37556
37902
|
mkdirSync13(dir, { recursive: true });
|
|
37557
37903
|
writeFileSync14(filePath, JSON.stringify(data, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
|
|
37558
37904
|
}
|
|
@@ -37582,15 +37928,15 @@ function recordUsage(kind, value, opts) {
|
|
|
37582
37928
|
}
|
|
37583
37929
|
saveUsageFile(filePath, data);
|
|
37584
37930
|
};
|
|
37585
|
-
update(
|
|
37931
|
+
update(join51(homedir11(), ".open-agents", USAGE_HISTORY_FILE));
|
|
37586
37932
|
if (opts?.repoRoot) {
|
|
37587
|
-
update(
|
|
37933
|
+
update(join51(opts.repoRoot, OA_DIR, USAGE_HISTORY_FILE));
|
|
37588
37934
|
}
|
|
37589
37935
|
}
|
|
37590
37936
|
function loadUsageHistory(kind, repoRoot) {
|
|
37591
|
-
const globalPath =
|
|
37937
|
+
const globalPath = join51(homedir11(), ".open-agents", USAGE_HISTORY_FILE);
|
|
37592
37938
|
const globalData = loadUsageFile(globalPath);
|
|
37593
|
-
const localData = repoRoot ? loadUsageFile(
|
|
37939
|
+
const localData = repoRoot ? loadUsageFile(join51(repoRoot, OA_DIR, USAGE_HISTORY_FILE)) : { records: [] };
|
|
37594
37940
|
const map = /* @__PURE__ */ new Map();
|
|
37595
37941
|
for (const r of globalData.records) {
|
|
37596
37942
|
if (r.kind !== kind)
|
|
@@ -37621,9 +37967,9 @@ function deleteUsageRecord(kind, value, repoRoot) {
|
|
|
37621
37967
|
saveUsageFile(filePath, data);
|
|
37622
37968
|
}
|
|
37623
37969
|
};
|
|
37624
|
-
remove(
|
|
37970
|
+
remove(join51(homedir11(), ".open-agents", USAGE_HISTORY_FILE));
|
|
37625
37971
|
if (repoRoot) {
|
|
37626
|
-
remove(
|
|
37972
|
+
remove(join51(repoRoot, OA_DIR, USAGE_HISTORY_FILE));
|
|
37627
37973
|
}
|
|
37628
37974
|
}
|
|
37629
37975
|
var OA_DIR, SUBDIRS, CONTEXT_FILES, PENDING_TASK_FILE, CONTEXT_SAVE_FILE, MAX_CONTEXT_ENTRIES, SKIP_DIRS, USAGE_HISTORY_FILE, MAX_HISTORY_RECORDS;
|
|
@@ -37673,8 +38019,8 @@ var init_oa_directory = __esm({
|
|
|
37673
38019
|
import * as readline from "node:readline";
|
|
37674
38020
|
import { execSync as execSync24, spawn as spawn18, exec as exec2 } from "node:child_process";
|
|
37675
38021
|
import { promisify as promisify6 } from "node:util";
|
|
37676
|
-
import { existsSync as
|
|
37677
|
-
import { join as
|
|
38022
|
+
import { existsSync as existsSync36, writeFileSync as writeFileSync15, readFileSync as readFileSync27, appendFileSync as appendFileSync2, mkdirSync as mkdirSync14 } from "node:fs";
|
|
38023
|
+
import { join as join52 } from "node:path";
|
|
37678
38024
|
import { homedir as homedir12, platform } from "node:os";
|
|
37679
38025
|
function detectSystemSpecs() {
|
|
37680
38026
|
let totalRamGB = 0;
|
|
@@ -37961,7 +38307,7 @@ async function installOllamaMac(_rl) {
|
|
|
37961
38307
|
execSync24('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"', { stdio: "inherit", timeout: 6e5 });
|
|
37962
38308
|
if (!hasCmd("brew")) {
|
|
37963
38309
|
try {
|
|
37964
|
-
const brewPrefix =
|
|
38310
|
+
const brewPrefix = existsSync36("/opt/homebrew/bin/brew") ? "/opt/homebrew" : "/usr/local";
|
|
37965
38311
|
process.env["PATH"] = `${brewPrefix}/bin:${process.env["PATH"]}`;
|
|
37966
38312
|
} catch {
|
|
37967
38313
|
}
|
|
@@ -38715,9 +39061,9 @@ async function doSetup(config, rl) {
|
|
|
38715
39061
|
`PARAMETER num_predict ${numPredict}`,
|
|
38716
39062
|
`PARAMETER stop "<|endoftext|>"`
|
|
38717
39063
|
].join("\n");
|
|
38718
|
-
const modelDir2 =
|
|
39064
|
+
const modelDir2 = join52(homedir12(), ".open-agents", "models");
|
|
38719
39065
|
mkdirSync14(modelDir2, { recursive: true });
|
|
38720
|
-
const modelfilePath =
|
|
39066
|
+
const modelfilePath = join52(modelDir2, `Modelfile.${customName}`);
|
|
38721
39067
|
writeFileSync15(modelfilePath, modelfileContent + "\n", "utf8");
|
|
38722
39068
|
process.stdout.write(` ${c2.dim("Creating model...")} `);
|
|
38723
39069
|
execSync24(`ollama create ${customName} -f ${modelfilePath}`, {
|
|
@@ -38763,7 +39109,7 @@ async function isModelAvailable(config) {
|
|
|
38763
39109
|
}
|
|
38764
39110
|
function isFirstRun() {
|
|
38765
39111
|
try {
|
|
38766
|
-
return !
|
|
39112
|
+
return !existsSync36(join52(homedir12(), ".open-agents", "config.json"));
|
|
38767
39113
|
} catch {
|
|
38768
39114
|
return true;
|
|
38769
39115
|
}
|
|
@@ -38800,7 +39146,7 @@ function detectPkgManager() {
|
|
|
38800
39146
|
return null;
|
|
38801
39147
|
}
|
|
38802
39148
|
function getVenvDir() {
|
|
38803
|
-
return
|
|
39149
|
+
return join52(homedir12(), ".open-agents", "venv");
|
|
38804
39150
|
}
|
|
38805
39151
|
function hasVenvModule() {
|
|
38806
39152
|
try {
|
|
@@ -38812,8 +39158,8 @@ function hasVenvModule() {
|
|
|
38812
39158
|
}
|
|
38813
39159
|
function ensureVenv(log) {
|
|
38814
39160
|
const venvDir = getVenvDir();
|
|
38815
|
-
const venvPip =
|
|
38816
|
-
if (
|
|
39161
|
+
const venvPip = join52(venvDir, "bin", "pip");
|
|
39162
|
+
if (existsSync36(venvPip))
|
|
38817
39163
|
return venvDir;
|
|
38818
39164
|
log("Creating Python venv for vision deps...");
|
|
38819
39165
|
if (!hasCmd("python3")) {
|
|
@@ -38825,9 +39171,9 @@ function ensureVenv(log) {
|
|
|
38825
39171
|
return null;
|
|
38826
39172
|
}
|
|
38827
39173
|
try {
|
|
38828
|
-
mkdirSync14(
|
|
39174
|
+
mkdirSync14(join52(homedir12(), ".open-agents"), { recursive: true });
|
|
38829
39175
|
execSync24(`python3 -m venv "${venvDir}"`, { stdio: "pipe", timeout: 3e4 });
|
|
38830
|
-
execSync24(`"${
|
|
39176
|
+
execSync24(`"${join52(venvDir, "bin", "pip")}" install --upgrade pip`, {
|
|
38831
39177
|
stdio: "pipe",
|
|
38832
39178
|
timeout: 6e4
|
|
38833
39179
|
});
|
|
@@ -39018,15 +39364,15 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
39018
39364
|
}
|
|
39019
39365
|
}
|
|
39020
39366
|
const venvDir = getVenvDir();
|
|
39021
|
-
const venvBin =
|
|
39022
|
-
const venvMoondream =
|
|
39367
|
+
const venvBin = join52(venvDir, "bin");
|
|
39368
|
+
const venvMoondream = join52(venvBin, "moondream-station");
|
|
39023
39369
|
const venv = ensureVenv(log);
|
|
39024
|
-
if (venv && !hasCmd("moondream-station") && !
|
|
39025
|
-
const venvPip =
|
|
39370
|
+
if (venv && !hasCmd("moondream-station") && !existsSync36(venvMoondream)) {
|
|
39371
|
+
const venvPip = join52(venvBin, "pip");
|
|
39026
39372
|
log("Installing moondream-station in ~/.open-agents/venv...");
|
|
39027
39373
|
try {
|
|
39028
39374
|
execSync24(`"${venvPip}" install moondream-station`, { stdio: "pipe", timeout: 3e5 });
|
|
39029
|
-
if (
|
|
39375
|
+
if (existsSync36(venvMoondream)) {
|
|
39030
39376
|
log("moondream-station installed successfully.");
|
|
39031
39377
|
} else {
|
|
39032
39378
|
try {
|
|
@@ -39043,8 +39389,8 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
39043
39389
|
}
|
|
39044
39390
|
}
|
|
39045
39391
|
if (venv) {
|
|
39046
|
-
const venvPython =
|
|
39047
|
-
const venvPip2 =
|
|
39392
|
+
const venvPython = join52(venvBin, "python");
|
|
39393
|
+
const venvPip2 = join52(venvBin, "pip");
|
|
39048
39394
|
let ocrStackInstalled = false;
|
|
39049
39395
|
try {
|
|
39050
39396
|
execSync24(`"${venvPython}" -c "import cv2, pytesseract, numpy, PIL"`, { stdio: "pipe", timeout: 1e4 });
|
|
@@ -39188,9 +39534,9 @@ async function createExpandedVariantAsync(baseModel, specs, sizeGB, kvBytesPerTo
|
|
|
39188
39534
|
`PARAMETER num_predict ${numPredict}`,
|
|
39189
39535
|
`PARAMETER stop "<|endoftext|>"`
|
|
39190
39536
|
].join("\n");
|
|
39191
|
-
const modelDir2 =
|
|
39537
|
+
const modelDir2 = join52(homedir12(), ".open-agents", "models");
|
|
39192
39538
|
mkdirSync14(modelDir2, { recursive: true });
|
|
39193
|
-
const modelfilePath =
|
|
39539
|
+
const modelfilePath = join52(modelDir2, `Modelfile.${customName}`);
|
|
39194
39540
|
writeFileSync15(modelfilePath, modelfileContent + "\n", "utf8");
|
|
39195
39541
|
await execAsync(`ollama create ${customName} -f ${modelfilePath}`, {
|
|
39196
39542
|
timeout: 12e4
|
|
@@ -39265,8 +39611,8 @@ async function ensureNeovim() {
|
|
|
39265
39611
|
const platform5 = process.platform;
|
|
39266
39612
|
const arch = process.arch;
|
|
39267
39613
|
if (platform5 === "linux") {
|
|
39268
|
-
const binDir =
|
|
39269
|
-
const nvimDest =
|
|
39614
|
+
const binDir = join52(homedir12(), ".local", "bin");
|
|
39615
|
+
const nvimDest = join52(binDir, "nvim");
|
|
39270
39616
|
try {
|
|
39271
39617
|
mkdirSync14(binDir, { recursive: true });
|
|
39272
39618
|
} catch {
|
|
@@ -39337,9 +39683,9 @@ async function ensureNeovim() {
|
|
|
39337
39683
|
}
|
|
39338
39684
|
function ensurePathInShellRc(binDir) {
|
|
39339
39685
|
const shell = process.env.SHELL ?? "";
|
|
39340
|
-
const rcFile = shell.includes("zsh") ?
|
|
39686
|
+
const rcFile = shell.includes("zsh") ? join52(homedir12(), ".zshrc") : join52(homedir12(), ".bashrc");
|
|
39341
39687
|
try {
|
|
39342
|
-
const rcContent =
|
|
39688
|
+
const rcContent = existsSync36(rcFile) ? readFileSync27(rcFile, "utf8") : "";
|
|
39343
39689
|
if (rcContent.includes(binDir))
|
|
39344
39690
|
return;
|
|
39345
39691
|
const exportLine = `
|
|
@@ -40054,8 +40400,8 @@ var init_tui_select = __esm({
|
|
|
40054
40400
|
});
|
|
40055
40401
|
|
|
40056
40402
|
// packages/cli/dist/tui/drop-panel.js
|
|
40057
|
-
import { existsSync as
|
|
40058
|
-
import { extname as
|
|
40403
|
+
import { existsSync as existsSync37 } from "node:fs";
|
|
40404
|
+
import { extname as extname10, resolve as resolve29 } from "node:path";
|
|
40059
40405
|
function ansi4(code, text) {
|
|
40060
40406
|
return isTTY4 ? `\x1B[${code}m${text}\x1B[0m` : text;
|
|
40061
40407
|
}
|
|
@@ -40169,13 +40515,13 @@ function showDropPanel(opts) {
|
|
|
40169
40515
|
filePath = decodeURIComponent(filePath.slice(7));
|
|
40170
40516
|
}
|
|
40171
40517
|
filePath = resolve29(filePath);
|
|
40172
|
-
if (!
|
|
40518
|
+
if (!existsSync37(filePath)) {
|
|
40173
40519
|
errorMsg = `File not found: ${filePath}`;
|
|
40174
40520
|
render();
|
|
40175
40521
|
return;
|
|
40176
40522
|
}
|
|
40177
40523
|
if (allowedExtensions.length > 0) {
|
|
40178
|
-
const ext =
|
|
40524
|
+
const ext = extname10(filePath).toLowerCase();
|
|
40179
40525
|
if (!allowedExtensions.includes(ext)) {
|
|
40180
40526
|
errorMsg = `Invalid file type: ${ext}. Expected: ${allowedExtensions.join(", ")}`;
|
|
40181
40527
|
render();
|
|
@@ -40240,9 +40586,9 @@ var init_drop_panel = __esm({
|
|
|
40240
40586
|
});
|
|
40241
40587
|
|
|
40242
40588
|
// packages/cli/dist/tui/neovim-mode.js
|
|
40243
|
-
import { existsSync as
|
|
40589
|
+
import { existsSync as existsSync38, unlinkSync as unlinkSync7 } from "node:fs";
|
|
40244
40590
|
import { tmpdir as tmpdir8 } from "node:os";
|
|
40245
|
-
import { join as
|
|
40591
|
+
import { join as join53 } from "node:path";
|
|
40246
40592
|
import { execSync as execSync25 } from "node:child_process";
|
|
40247
40593
|
function isNeovimActive() {
|
|
40248
40594
|
return _state !== null && !_state.cleanedUp;
|
|
@@ -40290,9 +40636,9 @@ async function startNeovimMode(opts) {
|
|
|
40290
40636
|
);
|
|
40291
40637
|
} catch {
|
|
40292
40638
|
}
|
|
40293
|
-
const socketPath =
|
|
40639
|
+
const socketPath = join53(tmpdir8(), `oa-nvim-${process.pid}-${Date.now()}.sock`);
|
|
40294
40640
|
try {
|
|
40295
|
-
if (
|
|
40641
|
+
if (existsSync38(socketPath))
|
|
40296
40642
|
unlinkSync7(socketPath);
|
|
40297
40643
|
} catch {
|
|
40298
40644
|
}
|
|
@@ -40519,13 +40865,13 @@ function resizeNeovim(cols, contentRows) {
|
|
|
40519
40865
|
}
|
|
40520
40866
|
async function connectRPC(state, neovimPkg, cols) {
|
|
40521
40867
|
let attempts = 0;
|
|
40522
|
-
while (!
|
|
40868
|
+
while (!existsSync38(state.socketPath) && attempts < 30) {
|
|
40523
40869
|
await new Promise((r) => setTimeout(r, 200));
|
|
40524
40870
|
attempts++;
|
|
40525
40871
|
if (state.cleanedUp)
|
|
40526
40872
|
return;
|
|
40527
40873
|
}
|
|
40528
|
-
if (!
|
|
40874
|
+
if (!existsSync38(state.socketPath))
|
|
40529
40875
|
return;
|
|
40530
40876
|
const nvim = neovimPkg.attach({ socket: state.socketPath });
|
|
40531
40877
|
state.nvim = nvim;
|
|
@@ -40662,7 +41008,7 @@ function doCleanup(state) {
|
|
|
40662
41008
|
state.pty = null;
|
|
40663
41009
|
}
|
|
40664
41010
|
try {
|
|
40665
|
-
if (
|
|
41011
|
+
if (existsSync38(state.socketPath))
|
|
40666
41012
|
unlinkSync7(state.socketPath);
|
|
40667
41013
|
} catch {
|
|
40668
41014
|
}
|
|
@@ -40719,8 +41065,8 @@ __export(voice_exports, {
|
|
|
40719
41065
|
registerCustomOnnxModel: () => registerCustomOnnxModel,
|
|
40720
41066
|
resetNarrationContext: () => resetNarrationContext
|
|
40721
41067
|
});
|
|
40722
|
-
import { existsSync as
|
|
40723
|
-
import { join as
|
|
41068
|
+
import { existsSync as existsSync39, mkdirSync as mkdirSync15, writeFileSync as writeFileSync16, readFileSync as readFileSync28, unlinkSync as unlinkSync8, readdirSync as readdirSync10, renameSync, statSync as statSync13 } from "node:fs";
|
|
41069
|
+
import { join as join54, dirname as dirname18 } from "node:path";
|
|
40724
41070
|
import { homedir as homedir13, tmpdir as tmpdir9, platform as platform2 } from "node:os";
|
|
40725
41071
|
import { execSync as execSync26, spawn as nodeSpawn } from "node:child_process";
|
|
40726
41072
|
import { createRequire } from "node:module";
|
|
@@ -40745,40 +41091,40 @@ function listVoiceModels() {
|
|
|
40745
41091
|
}));
|
|
40746
41092
|
}
|
|
40747
41093
|
function voiceDir() {
|
|
40748
|
-
return
|
|
41094
|
+
return join54(homedir13(), ".open-agents", "voice");
|
|
40749
41095
|
}
|
|
40750
41096
|
function modelsDir() {
|
|
40751
|
-
return
|
|
41097
|
+
return join54(voiceDir(), "models");
|
|
40752
41098
|
}
|
|
40753
41099
|
function modelDir(id) {
|
|
40754
|
-
return
|
|
41100
|
+
return join54(modelsDir(), id);
|
|
40755
41101
|
}
|
|
40756
41102
|
function modelOnnxPath(id) {
|
|
40757
|
-
return
|
|
41103
|
+
return join54(modelDir(id), "model.onnx");
|
|
40758
41104
|
}
|
|
40759
41105
|
function modelConfigPath(id) {
|
|
40760
|
-
return
|
|
41106
|
+
return join54(modelDir(id), "config.json");
|
|
40761
41107
|
}
|
|
40762
41108
|
function luxttsVenvDir() {
|
|
40763
|
-
return
|
|
41109
|
+
return join54(voiceDir(), "luxtts-venv");
|
|
40764
41110
|
}
|
|
40765
41111
|
function luxttsVenvPy() {
|
|
40766
|
-
return platform2() === "win32" ?
|
|
41112
|
+
return platform2() === "win32" ? join54(luxttsVenvDir(), "Scripts", "python.exe") : join54(luxttsVenvDir(), "bin", "python3");
|
|
40767
41113
|
}
|
|
40768
41114
|
function luxttsRepoDir() {
|
|
40769
|
-
return
|
|
41115
|
+
return join54(voiceDir(), "LuxTTS");
|
|
40770
41116
|
}
|
|
40771
41117
|
function luxttsCloneRefsDir() {
|
|
40772
|
-
return
|
|
41118
|
+
return join54(voiceDir(), "clone-refs");
|
|
40773
41119
|
}
|
|
40774
41120
|
function luxttsInferScript() {
|
|
40775
|
-
return
|
|
41121
|
+
return join54(voiceDir(), "luxtts-infer.py");
|
|
40776
41122
|
}
|
|
40777
41123
|
function writeDetectTorchScript(targetPath) {
|
|
40778
|
-
if (
|
|
41124
|
+
if (existsSync39(targetPath))
|
|
40779
41125
|
return;
|
|
40780
41126
|
try {
|
|
40781
|
-
mkdirSync15(
|
|
41127
|
+
mkdirSync15(dirname18(targetPath), { recursive: true });
|
|
40782
41128
|
} catch {
|
|
40783
41129
|
}
|
|
40784
41130
|
const script = `#!/usr/bin/env python3
|
|
@@ -41661,8 +42007,8 @@ var init_voice = __esm({
|
|
|
41661
42007
|
const refsDir = luxttsCloneRefsDir();
|
|
41662
42008
|
const targets = ["glados", "overwatch"];
|
|
41663
42009
|
for (const modelId of targets) {
|
|
41664
|
-
const refFile =
|
|
41665
|
-
if (
|
|
42010
|
+
const refFile = join54(refsDir, `${modelId}-ref.wav`);
|
|
42011
|
+
if (existsSync39(refFile))
|
|
41666
42012
|
continue;
|
|
41667
42013
|
try {
|
|
41668
42014
|
await this.generateCloneRef(modelId);
|
|
@@ -41741,23 +42087,23 @@ var init_voice = __esm({
|
|
|
41741
42087
|
}
|
|
41742
42088
|
p = p.replace(/\\ /g, " ");
|
|
41743
42089
|
if (p.startsWith("~/") || p === "~") {
|
|
41744
|
-
p =
|
|
42090
|
+
p = join54(homedir13(), p.slice(1));
|
|
41745
42091
|
}
|
|
41746
|
-
if (!
|
|
42092
|
+
if (!existsSync39(p)) {
|
|
41747
42093
|
return `File not found: ${p}
|
|
41748
42094
|
(original input: ${audioPath})`;
|
|
41749
42095
|
}
|
|
41750
42096
|
audioPath = p;
|
|
41751
42097
|
const refsDir = luxttsCloneRefsDir();
|
|
41752
|
-
if (!
|
|
42098
|
+
if (!existsSync39(refsDir))
|
|
41753
42099
|
mkdirSync15(refsDir, { recursive: true });
|
|
41754
42100
|
const ext = audioPath.split(".").pop() || "wav";
|
|
41755
42101
|
const srcName = (audioPath.split("/").pop() ?? "clone").replace(/\.[^.]+$/, "").replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
41756
42102
|
const ts = Date.now().toString(36);
|
|
41757
42103
|
const destFilename = `clone-${srcName}-${ts}.${ext}`;
|
|
41758
|
-
const destPath =
|
|
42104
|
+
const destPath = join54(refsDir, destFilename);
|
|
41759
42105
|
try {
|
|
41760
|
-
const data =
|
|
42106
|
+
const data = readFileSync28(audioPath);
|
|
41761
42107
|
writeFileSync16(destPath, data);
|
|
41762
42108
|
} catch (err) {
|
|
41763
42109
|
return `Failed to copy audio file: ${err instanceof Error ? err.message : String(err)}`;
|
|
@@ -41798,9 +42144,9 @@ var init_voice = __esm({
|
|
|
41798
42144
|
return `Failed to synthesize reference audio from ${source.label}.`;
|
|
41799
42145
|
}
|
|
41800
42146
|
const refsDir = luxttsCloneRefsDir();
|
|
41801
|
-
if (!
|
|
42147
|
+
if (!existsSync39(refsDir))
|
|
41802
42148
|
mkdirSync15(refsDir, { recursive: true });
|
|
41803
|
-
const destPath =
|
|
42149
|
+
const destPath = join54(refsDir, `${sourceModelId}-ref.wav`);
|
|
41804
42150
|
const sampleRate = this.config?.audio?.sample_rate ?? 22050;
|
|
41805
42151
|
this.writeWav(audioData, sampleRate, destPath);
|
|
41806
42152
|
this.luxttsCloneRef = destPath;
|
|
@@ -41816,21 +42162,21 @@ var init_voice = __esm({
|
|
|
41816
42162
|
// -------------------------------------------------------------------------
|
|
41817
42163
|
/** Metadata file for friendly names of clone refs */
|
|
41818
42164
|
static cloneMetaFile() {
|
|
41819
|
-
return
|
|
42165
|
+
return join54(luxttsCloneRefsDir(), "meta.json");
|
|
41820
42166
|
}
|
|
41821
42167
|
loadCloneMeta() {
|
|
41822
42168
|
const p = _VoiceEngine.cloneMetaFile();
|
|
41823
|
-
if (!
|
|
42169
|
+
if (!existsSync39(p))
|
|
41824
42170
|
return {};
|
|
41825
42171
|
try {
|
|
41826
|
-
return JSON.parse(
|
|
42172
|
+
return JSON.parse(readFileSync28(p, "utf8"));
|
|
41827
42173
|
} catch {
|
|
41828
42174
|
return {};
|
|
41829
42175
|
}
|
|
41830
42176
|
}
|
|
41831
42177
|
saveCloneMeta(meta) {
|
|
41832
42178
|
const dir = luxttsCloneRefsDir();
|
|
41833
|
-
if (!
|
|
42179
|
+
if (!existsSync39(dir))
|
|
41834
42180
|
mkdirSync15(dir, { recursive: true });
|
|
41835
42181
|
writeFileSync16(_VoiceEngine.cloneMetaFile(), JSON.stringify(meta, null, 2));
|
|
41836
42182
|
}
|
|
@@ -41842,18 +42188,18 @@ var init_voice = __esm({
|
|
|
41842
42188
|
*/
|
|
41843
42189
|
listCloneRefs() {
|
|
41844
42190
|
const dir = luxttsCloneRefsDir();
|
|
41845
|
-
if (!
|
|
42191
|
+
if (!existsSync39(dir))
|
|
41846
42192
|
return [];
|
|
41847
42193
|
const meta = this.loadCloneMeta();
|
|
41848
|
-
const files =
|
|
42194
|
+
const files = readdirSync10(dir).filter((f) => {
|
|
41849
42195
|
const ext = f.split(".").pop()?.toLowerCase() ?? "";
|
|
41850
42196
|
return _VoiceEngine.AUDIO_EXTS.has(ext);
|
|
41851
42197
|
});
|
|
41852
42198
|
return files.map((f) => {
|
|
41853
|
-
const p =
|
|
42199
|
+
const p = join54(dir, f);
|
|
41854
42200
|
let size = 0;
|
|
41855
42201
|
try {
|
|
41856
|
-
size =
|
|
42202
|
+
size = statSync13(p).size;
|
|
41857
42203
|
} catch {
|
|
41858
42204
|
}
|
|
41859
42205
|
return {
|
|
@@ -41867,8 +42213,8 @@ var init_voice = __esm({
|
|
|
41867
42213
|
}
|
|
41868
42214
|
/** Delete a clone reference file by filename. Returns true if deleted. */
|
|
41869
42215
|
deleteCloneRef(filename) {
|
|
41870
|
-
const p =
|
|
41871
|
-
if (!
|
|
42216
|
+
const p = join54(luxttsCloneRefsDir(), filename);
|
|
42217
|
+
if (!existsSync39(p))
|
|
41872
42218
|
return false;
|
|
41873
42219
|
try {
|
|
41874
42220
|
unlinkSync8(p);
|
|
@@ -41892,8 +42238,8 @@ var init_voice = __esm({
|
|
|
41892
42238
|
}
|
|
41893
42239
|
/** Set the active clone reference by filename. */
|
|
41894
42240
|
setActiveCloneRef(filename) {
|
|
41895
|
-
const p =
|
|
41896
|
-
if (!
|
|
42241
|
+
const p = join54(luxttsCloneRefsDir(), filename);
|
|
42242
|
+
if (!existsSync39(p))
|
|
41897
42243
|
return `File not found: ${filename}`;
|
|
41898
42244
|
this.luxttsCloneRef = p;
|
|
41899
42245
|
return `Active clone voice set to: ${filename}`;
|
|
@@ -42218,7 +42564,7 @@ var init_voice = __esm({
|
|
|
42218
42564
|
}
|
|
42219
42565
|
this.onPCMOutput(Buffer.from(int16.buffer), sampleRate);
|
|
42220
42566
|
}
|
|
42221
|
-
const wavPath =
|
|
42567
|
+
const wavPath = join54(tmpdir9(), `oa-voice-${Date.now()}.wav`);
|
|
42222
42568
|
this.writeStereoWav(stereo.left, stereo.right, sampleRate, wavPath);
|
|
42223
42569
|
await this.playWav(wavPath);
|
|
42224
42570
|
try {
|
|
@@ -42611,7 +42957,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
42611
42957
|
const mlxModelId = model.mlxModelId ?? "mlx-community/Kokoro-82M-bf16";
|
|
42612
42958
|
const mlxVoice = model.mlxVoice ?? "af_heart";
|
|
42613
42959
|
const mlxLangCode = model.mlxLangCode ?? "a";
|
|
42614
|
-
const wavPath =
|
|
42960
|
+
const wavPath = join54(tmpdir9(), `oa-mlx-${Date.now()}.wav`);
|
|
42615
42961
|
const pyScript = [
|
|
42616
42962
|
"import sys, json",
|
|
42617
42963
|
"from mlx_audio.tts import generate as tts_gen",
|
|
@@ -42628,11 +42974,11 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
42628
42974
|
return;
|
|
42629
42975
|
}
|
|
42630
42976
|
}
|
|
42631
|
-
if (!
|
|
42977
|
+
if (!existsSync39(wavPath))
|
|
42632
42978
|
return;
|
|
42633
42979
|
if (volume !== 1) {
|
|
42634
42980
|
try {
|
|
42635
|
-
const wavData =
|
|
42981
|
+
const wavData = readFileSync28(wavPath);
|
|
42636
42982
|
if (wavData.length > 44) {
|
|
42637
42983
|
const header = wavData.subarray(0, 44);
|
|
42638
42984
|
const samples = new Int16Array(wavData.buffer, wavData.byteOffset + 44, (wavData.length - 44) / 2);
|
|
@@ -42647,7 +42993,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
42647
42993
|
}
|
|
42648
42994
|
if (this.onPCMOutput) {
|
|
42649
42995
|
try {
|
|
42650
|
-
const wavData =
|
|
42996
|
+
const wavData = readFileSync28(wavPath);
|
|
42651
42997
|
if (wavData.length > 44) {
|
|
42652
42998
|
const pcm = Buffer.from(wavData.buffer, wavData.byteOffset + 44, wavData.length - 44);
|
|
42653
42999
|
const sampleRate = wavData.readUInt32LE(24);
|
|
@@ -42679,7 +43025,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
42679
43025
|
const mlxModelId = model.mlxModelId ?? "mlx-community/Kokoro-82M-bf16";
|
|
42680
43026
|
const mlxVoice = model.mlxVoice ?? "af_heart";
|
|
42681
43027
|
const mlxLangCode = model.mlxLangCode ?? "a";
|
|
42682
|
-
const wavPath =
|
|
43028
|
+
const wavPath = join54(tmpdir9(), `oa-mlx-buf-${Date.now()}.wav`);
|
|
42683
43029
|
const pyScript = [
|
|
42684
43030
|
"import sys, json",
|
|
42685
43031
|
"from mlx_audio.tts import generate as tts_gen",
|
|
@@ -42696,10 +43042,10 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
42696
43042
|
return null;
|
|
42697
43043
|
}
|
|
42698
43044
|
}
|
|
42699
|
-
if (!
|
|
43045
|
+
if (!existsSync39(wavPath))
|
|
42700
43046
|
return null;
|
|
42701
43047
|
try {
|
|
42702
|
-
const data =
|
|
43048
|
+
const data = readFileSync28(wavPath);
|
|
42703
43049
|
unlinkSync8(wavPath);
|
|
42704
43050
|
return data;
|
|
42705
43051
|
} catch {
|
|
@@ -42722,7 +43068,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
42722
43068
|
}
|
|
42723
43069
|
const venvDir = luxttsVenvDir();
|
|
42724
43070
|
const venvPy = luxttsVenvPy();
|
|
42725
|
-
if (
|
|
43071
|
+
if (existsSync39(venvPy)) {
|
|
42726
43072
|
try {
|
|
42727
43073
|
await this.asyncShell(`${venvPy} -c "import sys; sys.path.insert(0, '${luxttsRepoDir()}'); from zipvoice.luxvoice import LuxTTS; print('ok')"`, 3e4);
|
|
42728
43074
|
let hasCudaSys = false;
|
|
@@ -42736,7 +43082,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
42736
43082
|
if (torchCheck === "cpu") {
|
|
42737
43083
|
renderWarning("GPU detected but PyTorch is CPU-only. Reinstalling with CUDA support in background...");
|
|
42738
43084
|
try {
|
|
42739
|
-
const detectScript =
|
|
43085
|
+
const detectScript = join54(voiceDir(), "detect-torch.py");
|
|
42740
43086
|
writeDetectTorchScript(detectScript);
|
|
42741
43087
|
let pipArgs = `torch torchaudio --index-url https://download.pytorch.org/whl/cu124`;
|
|
42742
43088
|
try {
|
|
@@ -42761,7 +43107,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
42761
43107
|
}
|
|
42762
43108
|
}
|
|
42763
43109
|
renderInfo("Setting up LuxTTS voice cloning (first-time setup, this takes several minutes)...");
|
|
42764
|
-
if (!
|
|
43110
|
+
if (!existsSync39(venvDir)) {
|
|
42765
43111
|
renderInfo(" Creating Python virtual environment...");
|
|
42766
43112
|
try {
|
|
42767
43113
|
await this.asyncShell(`${py} -m venv ${JSON.stringify(venvDir)}`, 6e4);
|
|
@@ -42770,7 +43116,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
42770
43116
|
}
|
|
42771
43117
|
}
|
|
42772
43118
|
{
|
|
42773
|
-
const detectScript =
|
|
43119
|
+
const detectScript = join54(voiceDir(), "detect-torch.py");
|
|
42774
43120
|
writeDetectTorchScript(detectScript);
|
|
42775
43121
|
let pipArgsStr = "torch torchaudio";
|
|
42776
43122
|
let torchDesc = "unknown platform";
|
|
@@ -42807,10 +43153,10 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
42807
43153
|
}
|
|
42808
43154
|
}
|
|
42809
43155
|
const repoDir = luxttsRepoDir();
|
|
42810
|
-
if (!
|
|
43156
|
+
if (!existsSync39(join54(repoDir, "zipvoice", "luxvoice.py"))) {
|
|
42811
43157
|
renderInfo(" Cloning LuxTTS repository...");
|
|
42812
43158
|
try {
|
|
42813
|
-
if (
|
|
43159
|
+
if (existsSync39(repoDir)) {
|
|
42814
43160
|
await this.asyncShell(`rm -rf ${JSON.stringify(repoDir)}`, 3e4);
|
|
42815
43161
|
}
|
|
42816
43162
|
await this.asyncShell(`git clone --depth 1 https://github.com/ysharma3501/LuxTTS.git ${JSON.stringify(repoDir)}`, 12e4);
|
|
@@ -42848,7 +43194,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
42848
43194
|
renderWarning(` Could not install system build deps: ${err instanceof Error ? err.message : String(err)}`);
|
|
42849
43195
|
}
|
|
42850
43196
|
}
|
|
42851
|
-
const isJetson = isArm && (
|
|
43197
|
+
const isJetson = isArm && (existsSync39("/etc/nv_tegra_release") || existsSync39("/usr/local/cuda/targets/aarch64-linux") || (process.env.JETSON_L4T_VERSION ?? "") !== "");
|
|
42852
43198
|
const installSteps = isArm ? [
|
|
42853
43199
|
// ARM: install individually so we get clear error messages per package.
|
|
42854
43200
|
// ALL are fatal because LuxTTS hard-imports them (no lazy/optional imports).
|
|
@@ -42910,14 +43256,14 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
42910
43256
|
}
|
|
42911
43257
|
/** Auto-detect an existing clone reference in the refs directory */
|
|
42912
43258
|
autoDetectCloneRef() {
|
|
42913
|
-
if (this.luxttsCloneRef &&
|
|
43259
|
+
if (this.luxttsCloneRef && existsSync39(this.luxttsCloneRef))
|
|
42914
43260
|
return;
|
|
42915
43261
|
const refsDir = luxttsCloneRefsDir();
|
|
42916
|
-
if (!
|
|
43262
|
+
if (!existsSync39(refsDir))
|
|
42917
43263
|
return;
|
|
42918
43264
|
for (const name of ["custom-clone.wav", "custom-clone.mp3", "glados-ref.wav", "overwatch-ref.wav"]) {
|
|
42919
|
-
const p =
|
|
42920
|
-
if (
|
|
43265
|
+
const p = join54(refsDir, name);
|
|
43266
|
+
if (existsSync39(p)) {
|
|
42921
43267
|
this.luxttsCloneRef = p;
|
|
42922
43268
|
return;
|
|
42923
43269
|
}
|
|
@@ -43025,7 +43371,7 @@ if __name__ == '__main__':
|
|
|
43025
43371
|
if (this._luxttsDaemon && !this._luxttsDaemon.killed)
|
|
43026
43372
|
return true;
|
|
43027
43373
|
const venvPy = luxttsVenvPy();
|
|
43028
|
-
if (!
|
|
43374
|
+
if (!existsSync39(venvPy))
|
|
43029
43375
|
return false;
|
|
43030
43376
|
return new Promise((resolve34) => {
|
|
43031
43377
|
const env = { ...process.env, LUXTTS_REPO_PATH: luxttsRepoDir() };
|
|
@@ -43109,7 +43455,7 @@ if __name__ == '__main__':
|
|
|
43109
43455
|
* Used by drainQueue's pre-fetch pipeline for gapless back-to-back playback.
|
|
43110
43456
|
*/
|
|
43111
43457
|
async synthesizeLuxttsWav(text, speedFactor = 1) {
|
|
43112
|
-
if (!this.luxttsCloneRef || !
|
|
43458
|
+
if (!this.luxttsCloneRef || !existsSync39(this.luxttsCloneRef))
|
|
43113
43459
|
return null;
|
|
43114
43460
|
const cleaned = text.replace(/\*/g, "").trim();
|
|
43115
43461
|
if (!cleaned)
|
|
@@ -43117,7 +43463,7 @@ if __name__ == '__main__':
|
|
|
43117
43463
|
const ready = await this.ensureLuxttsDaemon();
|
|
43118
43464
|
if (!ready)
|
|
43119
43465
|
return null;
|
|
43120
|
-
const wavPath =
|
|
43466
|
+
const wavPath = join54(tmpdir9(), `oa-luxtts-${Date.now()}-${Math.random().toString(36).slice(2, 6)}.wav`);
|
|
43121
43467
|
try {
|
|
43122
43468
|
await this.luxttsRequest({
|
|
43123
43469
|
action: "synthesize",
|
|
@@ -43129,17 +43475,17 @@ if __name__ == '__main__':
|
|
|
43129
43475
|
} catch {
|
|
43130
43476
|
return null;
|
|
43131
43477
|
}
|
|
43132
|
-
return
|
|
43478
|
+
return existsSync39(wavPath) ? wavPath : null;
|
|
43133
43479
|
}
|
|
43134
43480
|
/**
|
|
43135
43481
|
* Post-process (fade-in, volume, pitch, stereo) and play a LuxTTS WAV file.
|
|
43136
43482
|
* Cleans up the WAV file after playback.
|
|
43137
43483
|
*/
|
|
43138
43484
|
async postProcessAndPlayLuxtts(wavPath, volume = 1, pitchFactor = 1, stereoDelayMs = 0.6) {
|
|
43139
|
-
if (!
|
|
43485
|
+
if (!existsSync39(wavPath))
|
|
43140
43486
|
return;
|
|
43141
43487
|
try {
|
|
43142
|
-
const wavData =
|
|
43488
|
+
const wavData = readFileSync28(wavPath);
|
|
43143
43489
|
if (wavData.length > 44) {
|
|
43144
43490
|
const sampleRate = wavData.readUInt32LE(24);
|
|
43145
43491
|
const samples = new Int16Array(wavData.buffer, wavData.byteOffset + 44, (wavData.length - 44) / 2);
|
|
@@ -43160,7 +43506,7 @@ if __name__ == '__main__':
|
|
|
43160
43506
|
}
|
|
43161
43507
|
if (pitchFactor !== 1) {
|
|
43162
43508
|
try {
|
|
43163
|
-
const wavData =
|
|
43509
|
+
const wavData = readFileSync28(wavPath);
|
|
43164
43510
|
if (wavData.length > 44) {
|
|
43165
43511
|
const int16 = new Int16Array(wavData.buffer, wavData.byteOffset + 44, (wavData.length - 44) / 2);
|
|
43166
43512
|
const float32 = new Float32Array(int16.length);
|
|
@@ -43175,7 +43521,7 @@ if __name__ == '__main__':
|
|
|
43175
43521
|
}
|
|
43176
43522
|
if (this.onPCMOutput) {
|
|
43177
43523
|
try {
|
|
43178
|
-
const wavData =
|
|
43524
|
+
const wavData = readFileSync28(wavPath);
|
|
43179
43525
|
if (wavData.length > 44) {
|
|
43180
43526
|
const pcm = Buffer.from(wavData.buffer, wavData.byteOffset + 44, wavData.length - 44);
|
|
43181
43527
|
const sampleRate = wavData.readUInt32LE(24);
|
|
@@ -43186,7 +43532,7 @@ if __name__ == '__main__':
|
|
|
43186
43532
|
}
|
|
43187
43533
|
if (stereoDelayMs > 0) {
|
|
43188
43534
|
try {
|
|
43189
|
-
const wavData =
|
|
43535
|
+
const wavData = readFileSync28(wavPath);
|
|
43190
43536
|
if (wavData.length > 44) {
|
|
43191
43537
|
const sampleRate = wavData.readUInt32LE(24);
|
|
43192
43538
|
const numChannels = wavData.readUInt16LE(22);
|
|
@@ -43222,7 +43568,7 @@ if __name__ == '__main__':
|
|
|
43222
43568
|
* Used for Telegram voice messages and WebSocket streaming.
|
|
43223
43569
|
*/
|
|
43224
43570
|
async synthesizeLuxttsToBuffer(text) {
|
|
43225
|
-
if (!this.luxttsCloneRef || !
|
|
43571
|
+
if (!this.luxttsCloneRef || !existsSync39(this.luxttsCloneRef))
|
|
43226
43572
|
return null;
|
|
43227
43573
|
const cleaned = text.replace(/\*/g, "").trim();
|
|
43228
43574
|
if (!cleaned)
|
|
@@ -43230,7 +43576,7 @@ if __name__ == '__main__':
|
|
|
43230
43576
|
const ready = await this.ensureLuxttsDaemon();
|
|
43231
43577
|
if (!ready)
|
|
43232
43578
|
return null;
|
|
43233
|
-
const wavPath =
|
|
43579
|
+
const wavPath = join54(tmpdir9(), `oa-luxtts-buf-${Date.now()}.wav`);
|
|
43234
43580
|
try {
|
|
43235
43581
|
await this.luxttsRequest({
|
|
43236
43582
|
action: "synthesize",
|
|
@@ -43242,10 +43588,10 @@ if __name__ == '__main__':
|
|
|
43242
43588
|
} catch {
|
|
43243
43589
|
return null;
|
|
43244
43590
|
}
|
|
43245
|
-
if (!
|
|
43591
|
+
if (!existsSync39(wavPath))
|
|
43246
43592
|
return null;
|
|
43247
43593
|
try {
|
|
43248
|
-
const data =
|
|
43594
|
+
const data = readFileSync28(wavPath);
|
|
43249
43595
|
unlinkSync8(wavPath);
|
|
43250
43596
|
return data;
|
|
43251
43597
|
} catch {
|
|
@@ -43260,14 +43606,14 @@ if __name__ == '__main__':
|
|
|
43260
43606
|
return;
|
|
43261
43607
|
const arch = process.arch;
|
|
43262
43608
|
mkdirSync15(voiceDir(), { recursive: true });
|
|
43263
|
-
const pkgPath =
|
|
43609
|
+
const pkgPath = join54(voiceDir(), "package.json");
|
|
43264
43610
|
const expectedDeps = {
|
|
43265
43611
|
"onnxruntime-node": "^1.21.0",
|
|
43266
43612
|
"phonemizer": "^1.2.1"
|
|
43267
43613
|
};
|
|
43268
|
-
if (
|
|
43614
|
+
if (existsSync39(pkgPath)) {
|
|
43269
43615
|
try {
|
|
43270
|
-
const existing = JSON.parse(
|
|
43616
|
+
const existing = JSON.parse(readFileSync28(pkgPath, "utf8"));
|
|
43271
43617
|
if (!existing.dependencies?.["phonemizer"]) {
|
|
43272
43618
|
existing.dependencies = { ...existing.dependencies, ...expectedDeps };
|
|
43273
43619
|
writeFileSync16(pkgPath, JSON.stringify(existing, null, 2));
|
|
@@ -43275,24 +43621,24 @@ if __name__ == '__main__':
|
|
|
43275
43621
|
} catch {
|
|
43276
43622
|
}
|
|
43277
43623
|
}
|
|
43278
|
-
if (!
|
|
43624
|
+
if (!existsSync39(pkgPath)) {
|
|
43279
43625
|
writeFileSync16(pkgPath, JSON.stringify({
|
|
43280
43626
|
name: "open-agents-voice",
|
|
43281
43627
|
private: true,
|
|
43282
43628
|
dependencies: expectedDeps
|
|
43283
43629
|
}, null, 2));
|
|
43284
43630
|
}
|
|
43285
|
-
const voiceRequire = createRequire(
|
|
43631
|
+
const voiceRequire = createRequire(join54(voiceDir(), "index.js"));
|
|
43286
43632
|
const probeOnnx = async () => {
|
|
43287
43633
|
try {
|
|
43288
|
-
const output = await this.asyncShell(`NODE_PATH="${
|
|
43634
|
+
const output = await this.asyncShell(`NODE_PATH="${join54(voiceDir(), "node_modules")}" node -e "try { require('onnxruntime-node'); console.log('OK'); } catch(e) { console.log('FAIL:' + e.message); }"`, 15e3);
|
|
43289
43635
|
return output.trim() === "OK";
|
|
43290
43636
|
} catch {
|
|
43291
43637
|
return false;
|
|
43292
43638
|
}
|
|
43293
43639
|
};
|
|
43294
|
-
const onnxNodeModules =
|
|
43295
|
-
const onnxInstalled =
|
|
43640
|
+
const onnxNodeModules = join54(voiceDir(), "node_modules", "onnxruntime-node");
|
|
43641
|
+
const onnxInstalled = existsSync39(onnxNodeModules);
|
|
43296
43642
|
if (onnxInstalled && !await probeOnnx()) {
|
|
43297
43643
|
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.`);
|
|
43298
43644
|
}
|
|
@@ -43342,10 +43688,10 @@ Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
|
43342
43688
|
const dir = modelDir(id);
|
|
43343
43689
|
const onnxPath = modelOnnxPath(id);
|
|
43344
43690
|
const configPath = modelConfigPath(id);
|
|
43345
|
-
if (
|
|
43691
|
+
if (existsSync39(onnxPath) && existsSync39(configPath))
|
|
43346
43692
|
return;
|
|
43347
43693
|
mkdirSync15(dir, { recursive: true });
|
|
43348
|
-
if (!
|
|
43694
|
+
if (!existsSync39(configPath)) {
|
|
43349
43695
|
renderInfo(`Downloading ${model.label} voice config...`);
|
|
43350
43696
|
const configResp = await fetch(model.configUrl);
|
|
43351
43697
|
if (!configResp.ok)
|
|
@@ -43353,7 +43699,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
|
43353
43699
|
const configText = await configResp.text();
|
|
43354
43700
|
writeFileSync16(configPath, configText);
|
|
43355
43701
|
}
|
|
43356
|
-
if (!
|
|
43702
|
+
if (!existsSync39(onnxPath)) {
|
|
43357
43703
|
renderInfo(`Downloading ${model.label} voice model (this may take a minute)...`);
|
|
43358
43704
|
const onnxResp = await fetch(model.onnxUrl);
|
|
43359
43705
|
if (!onnxResp.ok)
|
|
@@ -43390,10 +43736,10 @@ Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
|
43390
43736
|
throw new Error("ONNX runtime not loaded");
|
|
43391
43737
|
const onnxPath = modelOnnxPath(this.modelId);
|
|
43392
43738
|
const configPath = modelConfigPath(this.modelId);
|
|
43393
|
-
if (!
|
|
43739
|
+
if (!existsSync39(onnxPath) || !existsSync39(configPath)) {
|
|
43394
43740
|
throw new Error(`Model files not found for ${this.modelId}`);
|
|
43395
43741
|
}
|
|
43396
|
-
this.config = JSON.parse(
|
|
43742
|
+
this.config = JSON.parse(readFileSync28(configPath, "utf8"));
|
|
43397
43743
|
this.session = await this.ort.InferenceSession.create(onnxPath, {
|
|
43398
43744
|
executionProviders: ["cpu"],
|
|
43399
43745
|
graphOptimizationLevel: "all"
|
|
@@ -43420,8 +43766,8 @@ Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
|
43420
43766
|
// packages/cli/dist/tui/commands.js
|
|
43421
43767
|
import * as nodeOs from "node:os";
|
|
43422
43768
|
import { execSync as nodeExecSync } from "node:child_process";
|
|
43423
|
-
import { existsSync as
|
|
43424
|
-
import { join as
|
|
43769
|
+
import { existsSync as existsSync40, readFileSync as readFileSync29, writeFileSync as writeFileSync17, mkdirSync as mkdirSync16, readdirSync as readdirSync11, statSync as statSync14, rmSync } from "node:fs";
|
|
43770
|
+
import { join as join55 } from "node:path";
|
|
43425
43771
|
function safeLog(text) {
|
|
43426
43772
|
if (isNeovimActive()) {
|
|
43427
43773
|
writeToNeovimOutput(text + "\n");
|
|
@@ -43927,22 +44273,22 @@ async function handleSlashCommand(input, ctx) {
|
|
|
43927
44273
|
let content = "";
|
|
43928
44274
|
let metadata = {};
|
|
43929
44275
|
if (shareType === "tool") {
|
|
43930
|
-
const toolDir =
|
|
43931
|
-
const toolFile =
|
|
43932
|
-
if (!
|
|
44276
|
+
const toolDir = join55(ctx.repoRoot, ".oa", "tools");
|
|
44277
|
+
const toolFile = join55(toolDir, shareName.endsWith(".json") ? shareName : `${shareName}.json`);
|
|
44278
|
+
if (!existsSync40(toolFile)) {
|
|
43933
44279
|
renderWarning(`Tool not found: ${toolFile}`);
|
|
43934
44280
|
return "handled";
|
|
43935
44281
|
}
|
|
43936
|
-
content =
|
|
44282
|
+
content = readFileSync29(toolFile, "utf8");
|
|
43937
44283
|
metadata = { type: "tool", name: shareName };
|
|
43938
44284
|
} else if (shareType === "skill") {
|
|
43939
|
-
const skillDir =
|
|
43940
|
-
const skillFile =
|
|
43941
|
-
if (!
|
|
44285
|
+
const skillDir = join55(ctx.repoRoot, ".oa", "skills", shareName);
|
|
44286
|
+
const skillFile = join55(skillDir, "SKILL.md");
|
|
44287
|
+
if (!existsSync40(skillFile)) {
|
|
43942
44288
|
renderWarning(`Skill not found: ${skillFile}`);
|
|
43943
44289
|
return "handled";
|
|
43944
44290
|
}
|
|
43945
|
-
content =
|
|
44291
|
+
content = readFileSync29(skillFile, "utf8");
|
|
43946
44292
|
metadata = { type: "skill", name: shareName };
|
|
43947
44293
|
} else {
|
|
43948
44294
|
renderWarning(`Unknown share type: ${shareType}. Use 'tool' or 'skill'.`);
|
|
@@ -43981,9 +44327,9 @@ async function handleSlashCommand(input, ctx) {
|
|
|
43981
44327
|
const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
|
|
43982
44328
|
const nexus = new NexusTool2(ctx.repoRoot);
|
|
43983
44329
|
await nexus.execute({ action: "ipfs_pin", cid: importCid, source: "import" });
|
|
43984
|
-
const regFile =
|
|
43985
|
-
if (
|
|
43986
|
-
const reg = JSON.parse(
|
|
44330
|
+
const regFile = join55(ctx.repoRoot, ".oa", "nexus", "ipfs", "cid-registry", "learning-cids.json");
|
|
44331
|
+
if (existsSync40(regFile)) {
|
|
44332
|
+
const reg = JSON.parse(readFileSync29(regFile, "utf8"));
|
|
43987
44333
|
const pinned = Object.values(reg).some((e) => e.cid === importCid && e.pinned);
|
|
43988
44334
|
if (pinned) {
|
|
43989
44335
|
renderInfo(`CID ${importCid.slice(0, 20)}... pinned successfully.`);
|
|
@@ -44036,33 +44382,33 @@ async function handleSlashCommand(input, ctx) {
|
|
|
44036
44382
|
lines.push(`
|
|
44037
44383
|
${c2.bold("IPFS / Helia Status")}
|
|
44038
44384
|
`);
|
|
44039
|
-
const ipfsDir =
|
|
44040
|
-
const ipfsLocalDir =
|
|
44385
|
+
const ipfsDir = join55(ctx.repoRoot, ".oa", "ipfs");
|
|
44386
|
+
const ipfsLocalDir = join55(ipfsDir, "local");
|
|
44041
44387
|
let ipfsFiles = 0;
|
|
44042
44388
|
let ipfsBytes = 0;
|
|
44043
44389
|
let heliaBlocks = 0;
|
|
44044
44390
|
let heliaBytes = 0;
|
|
44045
44391
|
try {
|
|
44046
|
-
if (
|
|
44047
|
-
const files =
|
|
44392
|
+
if (existsSync40(ipfsLocalDir)) {
|
|
44393
|
+
const files = readdirSync11(ipfsLocalDir).filter((f) => f.endsWith(".json"));
|
|
44048
44394
|
ipfsFiles = files.length;
|
|
44049
44395
|
for (const f of files) {
|
|
44050
44396
|
try {
|
|
44051
|
-
ipfsBytes +=
|
|
44397
|
+
ipfsBytes += statSync14(join55(ipfsLocalDir, f)).size;
|
|
44052
44398
|
} catch {
|
|
44053
44399
|
}
|
|
44054
44400
|
}
|
|
44055
44401
|
}
|
|
44056
|
-
const heliaBlockDir =
|
|
44057
|
-
if (
|
|
44402
|
+
const heliaBlockDir = join55(ipfsDir, "blocks");
|
|
44403
|
+
if (existsSync40(heliaBlockDir)) {
|
|
44058
44404
|
const walkDir = (dir) => {
|
|
44059
|
-
for (const entry of
|
|
44405
|
+
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
44060
44406
|
if (entry.isDirectory())
|
|
44061
|
-
walkDir(
|
|
44407
|
+
walkDir(join55(dir, entry.name));
|
|
44062
44408
|
else {
|
|
44063
44409
|
heliaBlocks++;
|
|
44064
44410
|
try {
|
|
44065
|
-
heliaBytes +=
|
|
44411
|
+
heliaBytes += statSync14(join55(dir, entry.name)).size;
|
|
44066
44412
|
} catch {
|
|
44067
44413
|
}
|
|
44068
44414
|
}
|
|
@@ -44078,9 +44424,9 @@ async function handleSlashCommand(input, ctx) {
|
|
|
44078
44424
|
lines.push(` Blocks: ${c2.bold(String(heliaBlocks))} Size: ${c2.bold(formatFileSize(heliaBytes))}`);
|
|
44079
44425
|
lines.push(` Backend: ${heliaBlocks > 0 ? c2.green("helia-ipfs") : c2.yellow("sha256-local (Helia not initialized)")}`);
|
|
44080
44426
|
try {
|
|
44081
|
-
const statusFile =
|
|
44082
|
-
if (
|
|
44083
|
-
const status = JSON.parse(
|
|
44427
|
+
const statusFile = join55(ctx.repoRoot, ".oa", "nexus", "status.json");
|
|
44428
|
+
if (existsSync40(statusFile)) {
|
|
44429
|
+
const status = JSON.parse(readFileSync29(statusFile, "utf8"));
|
|
44084
44430
|
if (status.peerId) {
|
|
44085
44431
|
lines.push(`
|
|
44086
44432
|
${c2.bold("Peer Info")}`);
|
|
@@ -44099,11 +44445,11 @@ async function handleSlashCommand(input, ctx) {
|
|
|
44099
44445
|
${c2.dim("Commands: /ipfs pin <CID> /ipfs publish /ipfs cids")}`);
|
|
44100
44446
|
lines.push(`
|
|
44101
44447
|
${c2.bold("Identity Kernel")}`);
|
|
44102
|
-
const idDir =
|
|
44448
|
+
const idDir = join55(ctx.repoRoot, ".oa", "identity");
|
|
44103
44449
|
try {
|
|
44104
|
-
const stateFile =
|
|
44105
|
-
if (
|
|
44106
|
-
const state = JSON.parse(
|
|
44450
|
+
const stateFile = join55(idDir, "self-state.json");
|
|
44451
|
+
if (existsSync40(stateFile)) {
|
|
44452
|
+
const state = JSON.parse(readFileSync29(stateFile, "utf8"));
|
|
44107
44453
|
lines.push(` Version: ${c2.bold("v" + (state.version ?? "?"))} Sessions: ${c2.bold(String(state.session_count ?? 0))}`);
|
|
44108
44454
|
if (state.narrative_summary) {
|
|
44109
44455
|
lines.push(` Narrative: ${c2.dim(state.narrative_summary.slice(0, 60))}${state.narrative_summary.length > 60 ? "..." : ""}`);
|
|
@@ -44112,9 +44458,9 @@ async function handleSlashCommand(input, ctx) {
|
|
|
44112
44458
|
const traits = typeof state.personality_traits === "object" ? Object.entries(state.personality_traits).map(([k, v]) => `${k}:${v}`).join(", ") : String(state.personality_traits);
|
|
44113
44459
|
lines.push(` Traits: ${c2.dim(traits.slice(0, 60))}`);
|
|
44114
44460
|
}
|
|
44115
|
-
const cidFile =
|
|
44116
|
-
if (
|
|
44117
|
-
const cids = JSON.parse(
|
|
44461
|
+
const cidFile = join55(idDir, "cids.json");
|
|
44462
|
+
if (existsSync40(cidFile)) {
|
|
44463
|
+
const cids = JSON.parse(readFileSync29(cidFile, "utf8"));
|
|
44118
44464
|
const lastCid = Array.isArray(cids) ? cids[cids.length - 1] : cids.latest;
|
|
44119
44465
|
if (lastCid)
|
|
44120
44466
|
lines.push(` Last CID: ${c2.dim(String(lastCid).slice(0, 50))}`);
|
|
@@ -44127,9 +44473,9 @@ async function handleSlashCommand(input, ctx) {
|
|
|
44127
44473
|
lines.push(`
|
|
44128
44474
|
${c2.bold("Memory Sentiment")}`);
|
|
44129
44475
|
try {
|
|
44130
|
-
const metaFile =
|
|
44131
|
-
if (
|
|
44132
|
-
const store = JSON.parse(
|
|
44476
|
+
const metaFile = join55(ctx.repoRoot, ".oa", "memory", "metabolism", "store.json");
|
|
44477
|
+
if (existsSync40(metaFile)) {
|
|
44478
|
+
const store = JSON.parse(readFileSync29(metaFile, "utf8"));
|
|
44133
44479
|
const active = store.filter((m) => m.type !== "quarantine");
|
|
44134
44480
|
const recoveries = active.filter((m) => m.content?.startsWith("[recovery]")).length;
|
|
44135
44481
|
const strategies = active.filter((m) => m.content?.startsWith("[strategy]")).length;
|
|
@@ -44147,15 +44493,15 @@ async function handleSlashCommand(input, ctx) {
|
|
|
44147
44493
|
} catch {
|
|
44148
44494
|
}
|
|
44149
44495
|
try {
|
|
44150
|
-
const dbPath =
|
|
44151
|
-
if (
|
|
44496
|
+
const dbPath = join55(ctx.repoRoot, ".oa", "memory", "structured.db");
|
|
44497
|
+
if (existsSync40(dbPath)) {
|
|
44152
44498
|
const { initDb: initDb2, closeDb: cDb, ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
|
|
44153
44499
|
const db = initDb2(dbPath);
|
|
44154
44500
|
const memStore = new ProceduralMemoryStore2(db);
|
|
44155
44501
|
const count = memStore.count();
|
|
44156
44502
|
lines.push(`
|
|
44157
44503
|
${c2.bold("Structured Memory (SQLite)")}`);
|
|
44158
|
-
lines.push(` Memories: ${c2.bold(String(count))} DB: ${c2.dim(formatFileSize(
|
|
44504
|
+
lines.push(` Memories: ${c2.bold(String(count))} DB: ${c2.dim(formatFileSize(statSync14(dbPath).size))}`);
|
|
44159
44505
|
cDb(db);
|
|
44160
44506
|
}
|
|
44161
44507
|
} catch {
|
|
@@ -44169,8 +44515,8 @@ async function handleSlashCommand(input, ctx) {
|
|
|
44169
44515
|
lines.push(`
|
|
44170
44516
|
${c2.bold("Storage Overview")}
|
|
44171
44517
|
`);
|
|
44172
|
-
const oaDir =
|
|
44173
|
-
if (!
|
|
44518
|
+
const oaDir = join55(ctx.repoRoot, ".oa");
|
|
44519
|
+
if (!existsSync40(oaDir)) {
|
|
44174
44520
|
lines.push(` ${c2.dim("No .oa/ directory found.")}`);
|
|
44175
44521
|
safeLog(lines.join("\n") + "\n");
|
|
44176
44522
|
return "handled";
|
|
@@ -44179,14 +44525,14 @@ async function handleSlashCommand(input, ctx) {
|
|
|
44179
44525
|
const categories = {};
|
|
44180
44526
|
const walkStorage = (dir, category) => {
|
|
44181
44527
|
try {
|
|
44182
|
-
for (const entry of
|
|
44183
|
-
const full =
|
|
44528
|
+
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
44529
|
+
const full = join55(dir, entry.name);
|
|
44184
44530
|
if (entry.isDirectory()) {
|
|
44185
44531
|
const subCat = category || entry.name;
|
|
44186
44532
|
walkStorage(full, subCat);
|
|
44187
44533
|
} else {
|
|
44188
44534
|
try {
|
|
44189
|
-
const sz =
|
|
44535
|
+
const sz = statSync14(full).size;
|
|
44190
44536
|
totalBytes += sz;
|
|
44191
44537
|
if (!categories[category])
|
|
44192
44538
|
categories[category] = { files: 0, bytes: 0 };
|
|
@@ -44213,13 +44559,13 @@ async function handleSlashCommand(input, ctx) {
|
|
|
44213
44559
|
const sensitiveFound = [];
|
|
44214
44560
|
const checkSensitive = (dir) => {
|
|
44215
44561
|
try {
|
|
44216
|
-
for (const entry of
|
|
44562
|
+
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
44217
44563
|
const name = entry.name.toLowerCase();
|
|
44218
44564
|
if (sensitivePatterns.some((p) => name.includes(p))) {
|
|
44219
|
-
sensitiveFound.push(
|
|
44565
|
+
sensitiveFound.push(join55(dir, entry.name).replace(oaDir + "/", ""));
|
|
44220
44566
|
}
|
|
44221
44567
|
if (entry.isDirectory())
|
|
44222
|
-
checkSensitive(
|
|
44568
|
+
checkSensitive(join55(dir, entry.name));
|
|
44223
44569
|
}
|
|
44224
44570
|
} catch {
|
|
44225
44571
|
}
|
|
@@ -44247,8 +44593,8 @@ async function handleSlashCommand(input, ctx) {
|
|
|
44247
44593
|
renderInfo("Supported: .wav .mp3 .flac .ogg (audio\u2192transcribe) | .pdf .txt .md (text\u2192chunk)");
|
|
44248
44594
|
return "handled";
|
|
44249
44595
|
}
|
|
44250
|
-
const resolvedPath =
|
|
44251
|
-
if (!
|
|
44596
|
+
const resolvedPath = join55(ctx.repoRoot, filePath);
|
|
44597
|
+
if (!existsSync40(resolvedPath)) {
|
|
44252
44598
|
renderWarning(`File not found: ${resolvedPath}`);
|
|
44253
44599
|
return "handled";
|
|
44254
44600
|
}
|
|
@@ -44264,9 +44610,9 @@ async function handleSlashCommand(input, ctx) {
|
|
|
44264
44610
|
}
|
|
44265
44611
|
try {
|
|
44266
44612
|
const { initDb: initDb2, closeDb: cDb, ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
|
|
44267
|
-
const dbDir =
|
|
44613
|
+
const dbDir = join55(ctx.repoRoot, ".oa", "memory");
|
|
44268
44614
|
mkdirSync16(dbDir, { recursive: true });
|
|
44269
|
-
const db = initDb2(
|
|
44615
|
+
const db = initDb2(join55(dbDir, "structured.db"));
|
|
44270
44616
|
const memStore = new ProceduralMemoryStore2(db);
|
|
44271
44617
|
if (isAudio) {
|
|
44272
44618
|
renderInfo(`Transcribing: ${filePath}...`);
|
|
@@ -44307,7 +44653,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
44307
44653
|
return "handled";
|
|
44308
44654
|
}
|
|
44309
44655
|
} else {
|
|
44310
|
-
content =
|
|
44656
|
+
content = readFileSync29(resolvedPath, "utf8");
|
|
44311
44657
|
}
|
|
44312
44658
|
if (!content.trim()) {
|
|
44313
44659
|
renderWarning("No content extracted.");
|
|
@@ -44346,9 +44692,9 @@ async function handleSlashCommand(input, ctx) {
|
|
|
44346
44692
|
}
|
|
44347
44693
|
case "fortemi": {
|
|
44348
44694
|
const fortemiSubCmd = (arg || "").trim().toLowerCase();
|
|
44349
|
-
const fortemiDir =
|
|
44350
|
-
const altFortemiDir =
|
|
44351
|
-
const fDir =
|
|
44695
|
+
const fortemiDir = join55(ctx.repoRoot, "..", "fortemi-react");
|
|
44696
|
+
const altFortemiDir = join55(nodeOs.homedir(), "fortemi-react");
|
|
44697
|
+
const fDir = existsSync40(fortemiDir) ? fortemiDir : existsSync40(altFortemiDir) ? altFortemiDir : null;
|
|
44352
44698
|
if (fortemiSubCmd === "start" || fortemiSubCmd === "") {
|
|
44353
44699
|
if (!fDir) {
|
|
44354
44700
|
renderWarning("fortemi-react not found adjacent or in home directory.");
|
|
@@ -44363,14 +44709,14 @@ async function handleSlashCommand(input, ctx) {
|
|
|
44363
44709
|
// 24h
|
|
44364
44710
|
nonce: Math.random().toString(36).slice(2, 10)
|
|
44365
44711
|
};
|
|
44366
|
-
const jwtFile =
|
|
44367
|
-
mkdirSync16(
|
|
44712
|
+
const jwtFile = join55(ctx.repoRoot, ".oa", "fortemi-jwt.json");
|
|
44713
|
+
mkdirSync16(join55(ctx.repoRoot, ".oa"), { recursive: true });
|
|
44368
44714
|
writeFileSync17(jwtFile, JSON.stringify(jwtPayload, null, 2));
|
|
44369
44715
|
renderInfo(`Launching fortemi-react from ${fDir}...`);
|
|
44370
44716
|
try {
|
|
44371
44717
|
const { spawn: spawn20 } = __require("node:child_process");
|
|
44372
44718
|
const child = spawn20("npx", ["vite", "dev", "--host", "0.0.0.0", "--port", "3000"], {
|
|
44373
|
-
cwd:
|
|
44719
|
+
cwd: join55(fDir, "apps", "standalone"),
|
|
44374
44720
|
stdio: "ignore",
|
|
44375
44721
|
detached: true,
|
|
44376
44722
|
env: { ...process.env, OA_JWT: JSON.stringify(jwtPayload) }
|
|
@@ -44379,7 +44725,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
44379
44725
|
renderInfo("Fortemi-React starting on http://localhost:3000");
|
|
44380
44726
|
renderInfo(`JWT saved to ${jwtFile}`);
|
|
44381
44727
|
renderInfo("Memory operations will proxy to fortemi when available.");
|
|
44382
|
-
const bridgeFile =
|
|
44728
|
+
const bridgeFile = join55(ctx.repoRoot, ".oa", "fortemi-bridge.json");
|
|
44383
44729
|
writeFileSync17(bridgeFile, JSON.stringify({
|
|
44384
44730
|
url: "http://localhost:3000",
|
|
44385
44731
|
pid: child.pid,
|
|
@@ -44392,12 +44738,12 @@ async function handleSlashCommand(input, ctx) {
|
|
|
44392
44738
|
return "handled";
|
|
44393
44739
|
}
|
|
44394
44740
|
if (fortemiSubCmd === "status") {
|
|
44395
|
-
const bridgeFile =
|
|
44396
|
-
if (!
|
|
44741
|
+
const bridgeFile = join55(ctx.repoRoot, ".oa", "fortemi-bridge.json");
|
|
44742
|
+
if (!existsSync40(bridgeFile)) {
|
|
44397
44743
|
renderInfo("Fortemi bridge: not connected. Run /fortemi start");
|
|
44398
44744
|
return "handled";
|
|
44399
44745
|
}
|
|
44400
|
-
const bridge = JSON.parse(
|
|
44746
|
+
const bridge = JSON.parse(readFileSync29(bridgeFile, "utf8"));
|
|
44401
44747
|
let alive = false;
|
|
44402
44748
|
try {
|
|
44403
44749
|
process.kill(bridge.pid, 0);
|
|
@@ -44417,15 +44763,15 @@ async function handleSlashCommand(input, ctx) {
|
|
|
44417
44763
|
lines.push(` Process: ${alive ? c2.green("running") : c2.yellow("not running")} (PID ${bridge.pid})`);
|
|
44418
44764
|
lines.push(` HTTP: ${httpOk ? c2.green("connected") : c2.yellow("unreachable")}`);
|
|
44419
44765
|
lines.push(` Started: ${bridge.startedAt}`);
|
|
44420
|
-
lines.push(` JWT: ${
|
|
44766
|
+
lines.push(` JWT: ${existsSync40(bridge.jwtFile) ? c2.green("valid") : c2.yellow("missing")}`);
|
|
44421
44767
|
lines.push("");
|
|
44422
44768
|
safeLog(lines.join("\n"));
|
|
44423
44769
|
return "handled";
|
|
44424
44770
|
}
|
|
44425
44771
|
if (fortemiSubCmd === "stop") {
|
|
44426
|
-
const bridgeFile =
|
|
44427
|
-
if (
|
|
44428
|
-
const bridge = JSON.parse(
|
|
44772
|
+
const bridgeFile = join55(ctx.repoRoot, ".oa", "fortemi-bridge.json");
|
|
44773
|
+
if (existsSync40(bridgeFile)) {
|
|
44774
|
+
const bridge = JSON.parse(readFileSync29(bridgeFile, "utf8"));
|
|
44429
44775
|
try {
|
|
44430
44776
|
process.kill(bridge.pid, "SIGTERM");
|
|
44431
44777
|
} catch {
|
|
@@ -45789,13 +46135,13 @@ async function showCohereDashboard(ctx) {
|
|
|
45789
46135
|
} else if (idResult.key === "view") {
|
|
45790
46136
|
await ik.execute({ operation: "hydrate" });
|
|
45791
46137
|
} else if (idResult.key === "history") {
|
|
45792
|
-
const snapDir =
|
|
45793
|
-
if (
|
|
45794
|
-
const snaps =
|
|
46138
|
+
const snapDir = join55(ctx.repoRoot, ".oa", "identity", "snapshots");
|
|
46139
|
+
if (existsSync40(snapDir)) {
|
|
46140
|
+
const snaps = readdirSync11(snapDir).filter((f) => f.endsWith(".json")).sort().reverse();
|
|
45795
46141
|
const snapItems = snaps.slice(0, 20).map((f) => ({
|
|
45796
46142
|
key: f,
|
|
45797
46143
|
label: f.replace(".json", ""),
|
|
45798
|
-
detail: `${formatFileSize(
|
|
46144
|
+
detail: `${formatFileSize(statSync14(join55(snapDir, f)).size)}`
|
|
45799
46145
|
}));
|
|
45800
46146
|
if (snapItems.length > 0) {
|
|
45801
46147
|
await tuiSelect({
|
|
@@ -46110,10 +46456,10 @@ async function handleVoiceMenu(ctx, save, hasLocal) {
|
|
|
46110
46456
|
if (!jsonDrop.confirmed || !jsonDrop.path) {
|
|
46111
46457
|
continue;
|
|
46112
46458
|
}
|
|
46113
|
-
const { basename:
|
|
46459
|
+
const { basename: basename17, join: pathJoin } = await import("node:path");
|
|
46114
46460
|
const { copyFileSync: copyFileSync2, mkdirSync: mkdirSync24, existsSync: exists } = await import("node:fs");
|
|
46115
46461
|
const { homedir: homedir18 } = await import("node:os");
|
|
46116
|
-
const modelName =
|
|
46462
|
+
const modelName = basename17(onnxDrop.path, ".onnx").replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
46117
46463
|
const destDir = pathJoin(homedir18(), ".open-agents", "voice", "models", modelName);
|
|
46118
46464
|
if (!exists(destDir))
|
|
46119
46465
|
mkdirSync24(destDir, { recursive: true });
|
|
@@ -46261,7 +46607,7 @@ async function handleVoiceList(ctx, focusFilename) {
|
|
|
46261
46607
|
const src = srcPath.trim();
|
|
46262
46608
|
try {
|
|
46263
46609
|
const { existsSync: fe, copyFileSync: cpf, mkdirSync: mkd } = __require("node:fs");
|
|
46264
|
-
const { basename:
|
|
46610
|
+
const { basename: basename17, join: pjoin } = __require("node:path");
|
|
46265
46611
|
if (!fe(src)) {
|
|
46266
46612
|
renderError(`File not found: ${src}`);
|
|
46267
46613
|
helpers.render();
|
|
@@ -46269,7 +46615,7 @@ async function handleVoiceList(ctx, focusFilename) {
|
|
|
46269
46615
|
}
|
|
46270
46616
|
const refsDir = pjoin(__require("node:os").homedir(), ".open-agents", "voice", "clone-refs");
|
|
46271
46617
|
mkd(refsDir, { recursive: true });
|
|
46272
|
-
const destName =
|
|
46618
|
+
const destName = basename17(src);
|
|
46273
46619
|
const dest = pjoin(refsDir, destName);
|
|
46274
46620
|
cpf(src, dest);
|
|
46275
46621
|
renderInfo(`Imported "${destName}" \u2192 ${dest}`);
|
|
@@ -46609,9 +46955,9 @@ async function handlePeerEndpoint(peerId, authKey, ctx, local) {
|
|
|
46609
46955
|
if (models.length > 0) {
|
|
46610
46956
|
try {
|
|
46611
46957
|
const { writeFileSync: writeFileSync23, mkdirSync: mkdirSync24 } = await import("node:fs");
|
|
46612
|
-
const { join:
|
|
46613
|
-
const cachePath =
|
|
46614
|
-
mkdirSync24(
|
|
46958
|
+
const { join: join69, dirname: dirname22 } = await import("node:path");
|
|
46959
|
+
const cachePath = join69(ctx.repoRoot || process.cwd(), ".oa", "nexus", "peer-models-cache.json");
|
|
46960
|
+
mkdirSync24(dirname22(cachePath), { recursive: true });
|
|
46615
46961
|
writeFileSync23(cachePath, JSON.stringify({
|
|
46616
46962
|
peerId,
|
|
46617
46963
|
cachedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -46811,17 +47157,17 @@ async function handleUpdate(subcommand, ctx) {
|
|
|
46811
47157
|
try {
|
|
46812
47158
|
const { createRequire: createRequire4 } = await import("node:module");
|
|
46813
47159
|
const { fileURLToPath: fileURLToPath14 } = await import("node:url");
|
|
46814
|
-
const { dirname:
|
|
46815
|
-
const { existsSync:
|
|
47160
|
+
const { dirname: dirname22, join: join69 } = await import("node:path");
|
|
47161
|
+
const { existsSync: existsSync50 } = await import("node:fs");
|
|
46816
47162
|
const req = createRequire4(import.meta.url);
|
|
46817
|
-
const thisDir =
|
|
47163
|
+
const thisDir = dirname22(fileURLToPath14(import.meta.url));
|
|
46818
47164
|
const candidates = [
|
|
46819
|
-
|
|
46820
|
-
|
|
46821
|
-
|
|
47165
|
+
join69(thisDir, "..", "package.json"),
|
|
47166
|
+
join69(thisDir, "..", "..", "package.json"),
|
|
47167
|
+
join69(thisDir, "..", "..", "..", "package.json")
|
|
46822
47168
|
];
|
|
46823
47169
|
for (const pkgPath of candidates) {
|
|
46824
|
-
if (
|
|
47170
|
+
if (existsSync50(pkgPath)) {
|
|
46825
47171
|
const pkg = req(pkgPath);
|
|
46826
47172
|
if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli") {
|
|
46827
47173
|
currentVersion = pkg.version ?? "0.0.0";
|
|
@@ -47658,8 +48004,8 @@ var init_commands = __esm({
|
|
|
47658
48004
|
});
|
|
47659
48005
|
|
|
47660
48006
|
// packages/cli/dist/tui/project-context.js
|
|
47661
|
-
import { existsSync as
|
|
47662
|
-
import { join as
|
|
48007
|
+
import { existsSync as existsSync41, readFileSync as readFileSync30, readdirSync as readdirSync12 } from "node:fs";
|
|
48008
|
+
import { join as join56, basename as basename11 } from "node:path";
|
|
47663
48009
|
import { execSync as execSync27 } from "node:child_process";
|
|
47664
48010
|
import { homedir as homedir15, platform as platform3, release } from "node:os";
|
|
47665
48011
|
function getModelTier(modelName) {
|
|
@@ -47694,10 +48040,10 @@ function loadProjectMap(repoRoot) {
|
|
|
47694
48040
|
if (!hasOaDirectory(repoRoot)) {
|
|
47695
48041
|
initOaDirectory(repoRoot);
|
|
47696
48042
|
}
|
|
47697
|
-
const mapPath2 =
|
|
47698
|
-
if (
|
|
48043
|
+
const mapPath2 = join56(repoRoot, OA_DIR, "context", "project-map.md");
|
|
48044
|
+
if (existsSync41(mapPath2)) {
|
|
47699
48045
|
try {
|
|
47700
|
-
const content =
|
|
48046
|
+
const content = readFileSync30(mapPath2, "utf-8");
|
|
47701
48047
|
return content;
|
|
47702
48048
|
} catch {
|
|
47703
48049
|
}
|
|
@@ -47738,33 +48084,33 @@ ${log}`);
|
|
|
47738
48084
|
}
|
|
47739
48085
|
function loadMemoryContext(repoRoot) {
|
|
47740
48086
|
const sections = [];
|
|
47741
|
-
const oaMemDir =
|
|
48087
|
+
const oaMemDir = join56(repoRoot, OA_DIR, "memory");
|
|
47742
48088
|
const oaEntries = loadMemoryDir(oaMemDir, "project");
|
|
47743
48089
|
if (oaEntries)
|
|
47744
48090
|
sections.push(oaEntries);
|
|
47745
|
-
const legacyMemDir =
|
|
47746
|
-
if (legacyMemDir !== oaMemDir &&
|
|
48091
|
+
const legacyMemDir = join56(repoRoot, ".open-agents", "memory");
|
|
48092
|
+
if (legacyMemDir !== oaMemDir && existsSync41(legacyMemDir)) {
|
|
47747
48093
|
const legacyEntries = loadMemoryDir(legacyMemDir, "project/legacy");
|
|
47748
48094
|
if (legacyEntries)
|
|
47749
48095
|
sections.push(legacyEntries);
|
|
47750
48096
|
}
|
|
47751
|
-
const globalMemDir =
|
|
48097
|
+
const globalMemDir = join56(homedir15(), ".open-agents", "memory");
|
|
47752
48098
|
const globalEntries = loadMemoryDir(globalMemDir, "global");
|
|
47753
48099
|
if (globalEntries)
|
|
47754
48100
|
sections.push(globalEntries);
|
|
47755
48101
|
return sections.join("\n\n");
|
|
47756
48102
|
}
|
|
47757
48103
|
function loadMemoryDir(memDir, scope) {
|
|
47758
|
-
if (!
|
|
48104
|
+
if (!existsSync41(memDir))
|
|
47759
48105
|
return "";
|
|
47760
48106
|
const lines = [];
|
|
47761
48107
|
try {
|
|
47762
|
-
const files =
|
|
48108
|
+
const files = readdirSync12(memDir).filter((f) => f.endsWith(".json"));
|
|
47763
48109
|
for (const file of files.slice(0, 10)) {
|
|
47764
48110
|
try {
|
|
47765
|
-
const raw =
|
|
48111
|
+
const raw = readFileSync30(join56(memDir, file), "utf-8");
|
|
47766
48112
|
const entries = JSON.parse(raw);
|
|
47767
|
-
const topic =
|
|
48113
|
+
const topic = basename11(file, ".json");
|
|
47768
48114
|
const keys = Object.keys(entries);
|
|
47769
48115
|
if (keys.length === 0)
|
|
47770
48116
|
continue;
|
|
@@ -49281,22 +49627,22 @@ var init_banner = __esm({
|
|
|
49281
49627
|
});
|
|
49282
49628
|
|
|
49283
49629
|
// packages/cli/dist/tui/carousel-descriptors.js
|
|
49284
|
-
import { existsSync as
|
|
49285
|
-
import { join as
|
|
49630
|
+
import { existsSync as existsSync42, readFileSync as readFileSync31, writeFileSync as writeFileSync18, mkdirSync as mkdirSync17, readdirSync as readdirSync13 } from "node:fs";
|
|
49631
|
+
import { join as join57, basename as basename12 } from "node:path";
|
|
49286
49632
|
function loadToolProfile(repoRoot) {
|
|
49287
|
-
const filePath =
|
|
49633
|
+
const filePath = join57(repoRoot, OA_DIR, "context", TOOL_PROFILE_FILE);
|
|
49288
49634
|
try {
|
|
49289
|
-
if (!
|
|
49635
|
+
if (!existsSync42(filePath))
|
|
49290
49636
|
return null;
|
|
49291
|
-
return JSON.parse(
|
|
49637
|
+
return JSON.parse(readFileSync31(filePath, "utf-8"));
|
|
49292
49638
|
} catch {
|
|
49293
49639
|
return null;
|
|
49294
49640
|
}
|
|
49295
49641
|
}
|
|
49296
49642
|
function saveToolProfile(repoRoot, profile) {
|
|
49297
|
-
const contextDir =
|
|
49643
|
+
const contextDir = join57(repoRoot, OA_DIR, "context");
|
|
49298
49644
|
mkdirSync17(contextDir, { recursive: true });
|
|
49299
|
-
writeFileSync18(
|
|
49645
|
+
writeFileSync18(join57(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
|
|
49300
49646
|
}
|
|
49301
49647
|
function categorizeToolCall(toolName) {
|
|
49302
49648
|
for (const cat of TOOL_CATEGORIES) {
|
|
@@ -49354,25 +49700,25 @@ function weightedColor(profile) {
|
|
|
49354
49700
|
return selectedCat.colors[Math.floor(Math.random() * selectedCat.colors.length)];
|
|
49355
49701
|
}
|
|
49356
49702
|
function loadCachedDescriptors(repoRoot) {
|
|
49357
|
-
const filePath =
|
|
49703
|
+
const filePath = join57(repoRoot, OA_DIR, "context", DESCRIPTOR_FILE);
|
|
49358
49704
|
try {
|
|
49359
|
-
if (!
|
|
49705
|
+
if (!existsSync42(filePath))
|
|
49360
49706
|
return null;
|
|
49361
|
-
const cached = JSON.parse(
|
|
49707
|
+
const cached = JSON.parse(readFileSync31(filePath, "utf-8"));
|
|
49362
49708
|
return cached.phrases.length > 0 ? cached.phrases : null;
|
|
49363
49709
|
} catch {
|
|
49364
49710
|
return null;
|
|
49365
49711
|
}
|
|
49366
49712
|
}
|
|
49367
49713
|
function saveCachedDescriptors(repoRoot, phrases, sourceHash) {
|
|
49368
|
-
const contextDir =
|
|
49714
|
+
const contextDir = join57(repoRoot, OA_DIR, "context");
|
|
49369
49715
|
mkdirSync17(contextDir, { recursive: true });
|
|
49370
49716
|
const cached = {
|
|
49371
49717
|
phrases,
|
|
49372
49718
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
49373
49719
|
sourceHash
|
|
49374
49720
|
};
|
|
49375
|
-
writeFileSync18(
|
|
49721
|
+
writeFileSync18(join57(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
|
|
49376
49722
|
}
|
|
49377
49723
|
function generateDescriptors(repoRoot) {
|
|
49378
49724
|
const profile = loadToolProfile(repoRoot);
|
|
@@ -49383,7 +49729,7 @@ function generateDescriptors(repoRoot) {
|
|
|
49383
49729
|
extractFromSessions(repoRoot, tags);
|
|
49384
49730
|
extractFromMemory(repoRoot, tags);
|
|
49385
49731
|
extractFromToolProfile(profile, tags);
|
|
49386
|
-
const repoName2 =
|
|
49732
|
+
const repoName2 = basename12(repoRoot);
|
|
49387
49733
|
if (repoName2 && !tags.includes(repoName2)) {
|
|
49388
49734
|
tags.push(repoName2);
|
|
49389
49735
|
}
|
|
@@ -49420,11 +49766,11 @@ function generateDescriptors(repoRoot) {
|
|
|
49420
49766
|
return phrases;
|
|
49421
49767
|
}
|
|
49422
49768
|
function extractFromPackageJson(repoRoot, tags) {
|
|
49423
|
-
const pkgPath =
|
|
49769
|
+
const pkgPath = join57(repoRoot, "package.json");
|
|
49424
49770
|
try {
|
|
49425
|
-
if (!
|
|
49771
|
+
if (!existsSync42(pkgPath))
|
|
49426
49772
|
return;
|
|
49427
|
-
const pkg = JSON.parse(
|
|
49773
|
+
const pkg = JSON.parse(readFileSync31(pkgPath, "utf-8"));
|
|
49428
49774
|
if (pkg.name && typeof pkg.name === "string") {
|
|
49429
49775
|
const parts = pkg.name.replace(/^@/, "").split("/");
|
|
49430
49776
|
for (const p of parts)
|
|
@@ -49468,7 +49814,7 @@ function extractFromManifests(repoRoot, tags) {
|
|
|
49468
49814
|
{ file: ".github/workflows", tag: "ci/cd" }
|
|
49469
49815
|
];
|
|
49470
49816
|
for (const check of manifestChecks) {
|
|
49471
|
-
if (
|
|
49817
|
+
if (existsSync42(join57(repoRoot, check.file))) {
|
|
49472
49818
|
tags.push(check.tag);
|
|
49473
49819
|
}
|
|
49474
49820
|
}
|
|
@@ -49490,16 +49836,16 @@ function extractFromSessions(repoRoot, tags) {
|
|
|
49490
49836
|
}
|
|
49491
49837
|
}
|
|
49492
49838
|
function extractFromMemory(repoRoot, tags) {
|
|
49493
|
-
const memoryDir =
|
|
49839
|
+
const memoryDir = join57(repoRoot, OA_DIR, "memory");
|
|
49494
49840
|
try {
|
|
49495
|
-
if (!
|
|
49841
|
+
if (!existsSync42(memoryDir))
|
|
49496
49842
|
return;
|
|
49497
|
-
const files =
|
|
49843
|
+
const files = readdirSync13(memoryDir).filter((f) => f.endsWith(".json"));
|
|
49498
49844
|
for (const file of files) {
|
|
49499
49845
|
const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
|
|
49500
49846
|
tags.push(topic);
|
|
49501
49847
|
try {
|
|
49502
|
-
const data = JSON.parse(
|
|
49848
|
+
const data = JSON.parse(readFileSync31(join57(memoryDir, file), "utf-8"));
|
|
49503
49849
|
if (data && typeof data === "object") {
|
|
49504
49850
|
const keys = Object.keys(data).slice(0, 3);
|
|
49505
49851
|
for (const key of keys) {
|
|
@@ -50133,10 +50479,10 @@ var init_stream_renderer = __esm({
|
|
|
50133
50479
|
|
|
50134
50480
|
// packages/cli/dist/tui/edit-history.js
|
|
50135
50481
|
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync18 } from "node:fs";
|
|
50136
|
-
import { join as
|
|
50482
|
+
import { join as join58 } from "node:path";
|
|
50137
50483
|
function createEditHistoryLogger(repoRoot, sessionId) {
|
|
50138
|
-
const historyDir =
|
|
50139
|
-
const logPath2 =
|
|
50484
|
+
const historyDir = join58(repoRoot, ".oa", "history");
|
|
50485
|
+
const logPath2 = join58(historyDir, "edits.jsonl");
|
|
50140
50486
|
try {
|
|
50141
50487
|
mkdirSync18(historyDir, { recursive: true });
|
|
50142
50488
|
} catch {
|
|
@@ -50247,17 +50593,17 @@ var init_edit_history = __esm({
|
|
|
50247
50593
|
});
|
|
50248
50594
|
|
|
50249
50595
|
// packages/cli/dist/tui/promptLoader.js
|
|
50250
|
-
import { readFileSync as
|
|
50251
|
-
import { join as
|
|
50596
|
+
import { readFileSync as readFileSync32, existsSync as existsSync43 } from "node:fs";
|
|
50597
|
+
import { join as join59, dirname as dirname19 } from "node:path";
|
|
50252
50598
|
import { fileURLToPath as fileURLToPath11 } from "node:url";
|
|
50253
50599
|
function loadPrompt3(promptPath, vars) {
|
|
50254
50600
|
let content = cache3.get(promptPath);
|
|
50255
50601
|
if (content === void 0) {
|
|
50256
|
-
const fullPath =
|
|
50257
|
-
if (!
|
|
50602
|
+
const fullPath = join59(PROMPTS_DIR3, promptPath);
|
|
50603
|
+
if (!existsSync43(fullPath)) {
|
|
50258
50604
|
throw new Error(`Prompt file not found: ${fullPath}`);
|
|
50259
50605
|
}
|
|
50260
|
-
content =
|
|
50606
|
+
content = readFileSync32(fullPath, "utf-8");
|
|
50261
50607
|
cache3.set(promptPath, content);
|
|
50262
50608
|
}
|
|
50263
50609
|
if (!vars)
|
|
@@ -50269,24 +50615,24 @@ var init_promptLoader3 = __esm({
|
|
|
50269
50615
|
"packages/cli/dist/tui/promptLoader.js"() {
|
|
50270
50616
|
"use strict";
|
|
50271
50617
|
__filename3 = fileURLToPath11(import.meta.url);
|
|
50272
|
-
__dirname6 =
|
|
50273
|
-
devPath2 =
|
|
50274
|
-
publishedPath2 =
|
|
50275
|
-
PROMPTS_DIR3 =
|
|
50618
|
+
__dirname6 = dirname19(__filename3);
|
|
50619
|
+
devPath2 = join59(__dirname6, "..", "..", "prompts");
|
|
50620
|
+
publishedPath2 = join59(__dirname6, "..", "prompts");
|
|
50621
|
+
PROMPTS_DIR3 = existsSync43(devPath2) ? devPath2 : publishedPath2;
|
|
50276
50622
|
cache3 = /* @__PURE__ */ new Map();
|
|
50277
50623
|
}
|
|
50278
50624
|
});
|
|
50279
50625
|
|
|
50280
50626
|
// packages/cli/dist/tui/dream-engine.js
|
|
50281
|
-
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync19, readFileSync as
|
|
50282
|
-
import { join as
|
|
50627
|
+
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync19, readFileSync as readFileSync33, existsSync as existsSync44, cpSync, rmSync as rmSync2, readdirSync as readdirSync14 } from "node:fs";
|
|
50628
|
+
import { join as join60, basename as basename13 } from "node:path";
|
|
50283
50629
|
import { execSync as execSync28 } from "node:child_process";
|
|
50284
50630
|
function loadAutoresearchMemory(repoRoot) {
|
|
50285
|
-
const memoryPath =
|
|
50286
|
-
if (!
|
|
50631
|
+
const memoryPath = join60(repoRoot, ".oa", "memory", "autoresearch.json");
|
|
50632
|
+
if (!existsSync44(memoryPath))
|
|
50287
50633
|
return "";
|
|
50288
50634
|
try {
|
|
50289
|
-
const raw =
|
|
50635
|
+
const raw = readFileSync33(memoryPath, "utf-8");
|
|
50290
50636
|
const data = JSON.parse(raw);
|
|
50291
50637
|
const sections = [];
|
|
50292
50638
|
for (const key of AUTORESEARCH_MEMORY_KEYS) {
|
|
@@ -50476,12 +50822,12 @@ var init_dream_engine = __esm({
|
|
|
50476
50822
|
const content = String(args["content"] ?? "");
|
|
50477
50823
|
if (!rawPath)
|
|
50478
50824
|
return { success: false, output: "", error: "path is required", durationMs: Date.now() - start };
|
|
50479
|
-
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ?
|
|
50825
|
+
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join60(this.autoresearchDir, basename13(rawPath)) : join60(this.autoresearchDir, rawPath);
|
|
50480
50826
|
if (!targetPath.startsWith(this.autoresearchDir)) {
|
|
50481
50827
|
return { success: false, output: "", error: "Autoresearch mode: writes are confined to .oa/autoresearch/", durationMs: Date.now() - start };
|
|
50482
50828
|
}
|
|
50483
50829
|
try {
|
|
50484
|
-
const dir =
|
|
50830
|
+
const dir = join60(targetPath, "..");
|
|
50485
50831
|
mkdirSync19(dir, { recursive: true });
|
|
50486
50832
|
writeFileSync19(targetPath, content, "utf-8");
|
|
50487
50833
|
return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start };
|
|
@@ -50511,15 +50857,15 @@ var init_dream_engine = __esm({
|
|
|
50511
50857
|
const rawPath = String(args["path"] ?? "");
|
|
50512
50858
|
const oldStr = String(args["old_string"] ?? "");
|
|
50513
50859
|
const newStr = String(args["new_string"] ?? "");
|
|
50514
|
-
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ?
|
|
50860
|
+
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join60(this.autoresearchDir, basename13(rawPath)) : join60(this.autoresearchDir, rawPath);
|
|
50515
50861
|
if (!targetPath.startsWith(this.autoresearchDir)) {
|
|
50516
50862
|
return { success: false, output: "", error: "Autoresearch mode: edits are confined to .oa/autoresearch/", durationMs: Date.now() - start };
|
|
50517
50863
|
}
|
|
50518
50864
|
try {
|
|
50519
|
-
if (!
|
|
50865
|
+
if (!existsSync44(targetPath)) {
|
|
50520
50866
|
return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start };
|
|
50521
50867
|
}
|
|
50522
|
-
let content =
|
|
50868
|
+
let content = readFileSync33(targetPath, "utf-8");
|
|
50523
50869
|
if (!content.includes(oldStr)) {
|
|
50524
50870
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start };
|
|
50525
50871
|
}
|
|
@@ -50565,12 +50911,12 @@ var init_dream_engine = __esm({
|
|
|
50565
50911
|
const content = String(args["content"] ?? "");
|
|
50566
50912
|
if (!rawPath)
|
|
50567
50913
|
return { success: false, output: "", error: "path is required", durationMs: Date.now() - start };
|
|
50568
|
-
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ?
|
|
50914
|
+
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join60(this.dreamsDir, basename13(rawPath)) : join60(this.dreamsDir, rawPath);
|
|
50569
50915
|
if (!targetPath.startsWith(this.dreamsDir)) {
|
|
50570
50916
|
return { success: false, output: "", error: "Dream mode: writes are confined to .oa/dreams/", durationMs: Date.now() - start };
|
|
50571
50917
|
}
|
|
50572
50918
|
try {
|
|
50573
|
-
const dir =
|
|
50919
|
+
const dir = join60(targetPath, "..");
|
|
50574
50920
|
mkdirSync19(dir, { recursive: true });
|
|
50575
50921
|
writeFileSync19(targetPath, content, "utf-8");
|
|
50576
50922
|
return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start };
|
|
@@ -50600,15 +50946,15 @@ var init_dream_engine = __esm({
|
|
|
50600
50946
|
const rawPath = String(args["path"] ?? "");
|
|
50601
50947
|
const oldStr = String(args["old_string"] ?? "");
|
|
50602
50948
|
const newStr = String(args["new_string"] ?? "");
|
|
50603
|
-
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ?
|
|
50949
|
+
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join60(this.dreamsDir, basename13(rawPath)) : join60(this.dreamsDir, rawPath);
|
|
50604
50950
|
if (!targetPath.startsWith(this.dreamsDir)) {
|
|
50605
50951
|
return { success: false, output: "", error: "Dream mode: edits are confined to .oa/dreams/", durationMs: Date.now() - start };
|
|
50606
50952
|
}
|
|
50607
50953
|
try {
|
|
50608
|
-
if (!
|
|
50954
|
+
if (!existsSync44(targetPath)) {
|
|
50609
50955
|
return { success: false, output: "", error: `File not found: ${rawPath}`, durationMs: Date.now() - start };
|
|
50610
50956
|
}
|
|
50611
|
-
let content =
|
|
50957
|
+
let content = readFileSync33(targetPath, "utf-8");
|
|
50612
50958
|
if (!content.includes(oldStr)) {
|
|
50613
50959
|
return { success: false, output: "", error: "old_string not found in file", durationMs: Date.now() - start };
|
|
50614
50960
|
}
|
|
@@ -50667,7 +51013,7 @@ var init_dream_engine = __esm({
|
|
|
50667
51013
|
constructor(config, repoRoot) {
|
|
50668
51014
|
this.config = config;
|
|
50669
51015
|
this.repoRoot = repoRoot;
|
|
50670
|
-
this.dreamsDir =
|
|
51016
|
+
this.dreamsDir = join60(repoRoot, ".oa", "dreams");
|
|
50671
51017
|
this.state = {
|
|
50672
51018
|
mode: "default",
|
|
50673
51019
|
active: false,
|
|
@@ -50751,7 +51097,7 @@ ${result.summary}`;
|
|
|
50751
51097
|
if (mode !== "default" || cycle === totalCycles) {
|
|
50752
51098
|
renderDreamContraction(cycle);
|
|
50753
51099
|
const cycleSummary = this.buildCycleSummary(cycle, previousFindings);
|
|
50754
|
-
const summaryPath =
|
|
51100
|
+
const summaryPath = join60(this.dreamsDir, `cycle-${cycle}-summary.md`);
|
|
50755
51101
|
writeFileSync19(summaryPath, cycleSummary, "utf-8");
|
|
50756
51102
|
}
|
|
50757
51103
|
if (mode === "lucid" && !this.abortController.signal.aborted) {
|
|
@@ -50964,7 +51310,7 @@ After synthesis, call task_complete with the final prioritized summary.`, toolMo
|
|
|
50964
51310
|
}
|
|
50965
51311
|
/** Build role-specific tool sets for swarm agents */
|
|
50966
51312
|
buildSwarmTools(role, _workspace) {
|
|
50967
|
-
const autoresearchDir =
|
|
51313
|
+
const autoresearchDir = join60(this.repoRoot, ".oa", "autoresearch");
|
|
50968
51314
|
const taskComplete = this.createSwarmTaskCompleteTool(role);
|
|
50969
51315
|
switch (role) {
|
|
50970
51316
|
case "researcher": {
|
|
@@ -51328,7 +51674,7 @@ INSTRUCTIONS:
|
|
|
51328
51674
|
2. Summarize the key learnings and next steps
|
|
51329
51675
|
|
|
51330
51676
|
Call task_complete with a human-readable summary of the autoresearch session.`, workspace, onEvent);
|
|
51331
|
-
const reportPath =
|
|
51677
|
+
const reportPath = join60(this.dreamsDir, `cycle-${cycleNum}-autoresearch-report.md`);
|
|
51332
51678
|
const report = `# Autoresearch Swarm Report \u2014 Cycle ${cycleNum}
|
|
51333
51679
|
|
|
51334
51680
|
**Date**: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}
|
|
@@ -51417,7 +51763,7 @@ ${summaryResult}
|
|
|
51417
51763
|
}
|
|
51418
51764
|
/** Save workspace backup for lucid mode */
|
|
51419
51765
|
saveVersionCheckpoint(cycle) {
|
|
51420
|
-
const checkpointDir =
|
|
51766
|
+
const checkpointDir = join60(this.dreamsDir, "checkpoints", `cycle-${cycle}`);
|
|
51421
51767
|
try {
|
|
51422
51768
|
mkdirSync19(checkpointDir, { recursive: true });
|
|
51423
51769
|
try {
|
|
@@ -51436,10 +51782,10 @@ ${summaryResult}
|
|
|
51436
51782
|
encoding: "utf-8",
|
|
51437
51783
|
timeout: 5e3
|
|
51438
51784
|
}).trim();
|
|
51439
|
-
writeFileSync19(
|
|
51440
|
-
writeFileSync19(
|
|
51441
|
-
writeFileSync19(
|
|
51442
|
-
writeFileSync19(
|
|
51785
|
+
writeFileSync19(join60(checkpointDir, "git-status.txt"), gitStatus, "utf-8");
|
|
51786
|
+
writeFileSync19(join60(checkpointDir, "git-diff.patch"), gitDiff, "utf-8");
|
|
51787
|
+
writeFileSync19(join60(checkpointDir, "git-hash.txt"), gitHash, "utf-8");
|
|
51788
|
+
writeFileSync19(join60(checkpointDir, "checkpoint.json"), JSON.stringify({
|
|
51443
51789
|
cycle,
|
|
51444
51790
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
51445
51791
|
gitHash,
|
|
@@ -51447,7 +51793,7 @@ ${summaryResult}
|
|
|
51447
51793
|
}, null, 2), "utf-8");
|
|
51448
51794
|
renderInfo(`Checkpoint saved: cycle ${cycle} (${gitHash.slice(0, 8)})`);
|
|
51449
51795
|
} catch {
|
|
51450
|
-
writeFileSync19(
|
|
51796
|
+
writeFileSync19(join60(checkpointDir, "checkpoint.json"), JSON.stringify({ cycle, timestamp: (/* @__PURE__ */ new Date()).toISOString(), mode: this.state.mode }, null, 2), "utf-8");
|
|
51451
51797
|
renderInfo(`Checkpoint saved: cycle ${cycle} (no git)`);
|
|
51452
51798
|
}
|
|
51453
51799
|
} catch (err) {
|
|
@@ -51484,7 +51830,7 @@ Each proposal includes implementation entrypoints and estimated effort.
|
|
|
51484
51830
|
/** Update the master proposal index */
|
|
51485
51831
|
updateProposalIndex() {
|
|
51486
51832
|
try {
|
|
51487
|
-
const files =
|
|
51833
|
+
const files = readdirSync14(this.dreamsDir).filter((f) => f.endsWith(".md") && f !== "PROPOSAL-INDEX.md" && f !== "dream-state.json").sort();
|
|
51488
51834
|
const index = `# Dream Proposals Index
|
|
51489
51835
|
|
|
51490
51836
|
**Last updated**: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}
|
|
@@ -51505,14 +51851,14 @@ ${files.map((f) => `- [\`${f}\`](./${f})`).join("\n")}
|
|
|
51505
51851
|
---
|
|
51506
51852
|
*Auto-generated by open-agents dream engine*
|
|
51507
51853
|
`;
|
|
51508
|
-
writeFileSync19(
|
|
51854
|
+
writeFileSync19(join60(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
|
|
51509
51855
|
} catch {
|
|
51510
51856
|
}
|
|
51511
51857
|
}
|
|
51512
51858
|
/** Save dream state for resume/inspection */
|
|
51513
51859
|
saveDreamState() {
|
|
51514
51860
|
try {
|
|
51515
|
-
writeFileSync19(
|
|
51861
|
+
writeFileSync19(join60(this.dreamsDir, "dream-state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
|
|
51516
51862
|
} catch {
|
|
51517
51863
|
}
|
|
51518
51864
|
}
|
|
@@ -51886,8 +52232,8 @@ var init_bless_engine = __esm({
|
|
|
51886
52232
|
});
|
|
51887
52233
|
|
|
51888
52234
|
// packages/cli/dist/tui/dmn-engine.js
|
|
51889
|
-
import { existsSync as
|
|
51890
|
-
import { join as
|
|
52235
|
+
import { existsSync as existsSync45, readFileSync as readFileSync34, writeFileSync as writeFileSync20, mkdirSync as mkdirSync20, readdirSync as readdirSync15, unlinkSync as unlinkSync9 } from "node:fs";
|
|
52236
|
+
import { join as join61, basename as basename14 } from "node:path";
|
|
51891
52237
|
function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities, competence, reflectionBuffer) {
|
|
51892
52238
|
const competenceReport = competence.length > 0 ? competence.map((c3) => {
|
|
51893
52239
|
const rate = c3.attempts > 0 ? Math.round(c3.successes / c3.attempts * 100) : 0;
|
|
@@ -52000,8 +52346,8 @@ var init_dmn_engine = __esm({
|
|
|
52000
52346
|
constructor(config, repoRoot) {
|
|
52001
52347
|
this.config = config;
|
|
52002
52348
|
this.repoRoot = repoRoot;
|
|
52003
|
-
this.stateDir =
|
|
52004
|
-
this.historyDir =
|
|
52349
|
+
this.stateDir = join61(repoRoot, ".oa", "dmn");
|
|
52350
|
+
this.historyDir = join61(repoRoot, ".oa", "dmn", "cycles");
|
|
52005
52351
|
mkdirSync20(this.historyDir, { recursive: true });
|
|
52006
52352
|
this.loadState();
|
|
52007
52353
|
}
|
|
@@ -52591,16 +52937,16 @@ OUTPUT: Call task_complete with JSON:
|
|
|
52591
52937
|
async gatherMemoryTopics() {
|
|
52592
52938
|
const topics = [];
|
|
52593
52939
|
const dirs = [
|
|
52594
|
-
|
|
52595
|
-
|
|
52940
|
+
join61(this.repoRoot, ".oa", "memory"),
|
|
52941
|
+
join61(this.repoRoot, ".open-agents", "memory")
|
|
52596
52942
|
];
|
|
52597
52943
|
for (const dir of dirs) {
|
|
52598
|
-
if (!
|
|
52944
|
+
if (!existsSync45(dir))
|
|
52599
52945
|
continue;
|
|
52600
52946
|
try {
|
|
52601
|
-
const files =
|
|
52947
|
+
const files = readdirSync15(dir).filter((f) => f.endsWith(".json"));
|
|
52602
52948
|
for (const f of files) {
|
|
52603
|
-
const topic =
|
|
52949
|
+
const topic = basename14(f, ".json");
|
|
52604
52950
|
if (!topics.includes(topic))
|
|
52605
52951
|
topics.push(topic);
|
|
52606
52952
|
}
|
|
@@ -52611,29 +52957,29 @@ OUTPUT: Call task_complete with JSON:
|
|
|
52611
52957
|
}
|
|
52612
52958
|
// ── State persistence ─────────────────────────────────────────────────
|
|
52613
52959
|
loadState() {
|
|
52614
|
-
const path =
|
|
52615
|
-
if (
|
|
52960
|
+
const path = join61(this.stateDir, "state.json");
|
|
52961
|
+
if (existsSync45(path)) {
|
|
52616
52962
|
try {
|
|
52617
|
-
this.state = JSON.parse(
|
|
52963
|
+
this.state = JSON.parse(readFileSync34(path, "utf-8"));
|
|
52618
52964
|
} catch {
|
|
52619
52965
|
}
|
|
52620
52966
|
}
|
|
52621
52967
|
}
|
|
52622
52968
|
saveState() {
|
|
52623
52969
|
try {
|
|
52624
|
-
writeFileSync20(
|
|
52970
|
+
writeFileSync20(join61(this.stateDir, "state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
|
|
52625
52971
|
} catch {
|
|
52626
52972
|
}
|
|
52627
52973
|
}
|
|
52628
52974
|
saveCycleResult(result) {
|
|
52629
52975
|
try {
|
|
52630
52976
|
const filename = `cycle-${result.cycleNumber}-${Date.now()}.json`;
|
|
52631
|
-
writeFileSync20(
|
|
52632
|
-
const files =
|
|
52977
|
+
writeFileSync20(join61(this.historyDir, filename), JSON.stringify(result, null, 2) + "\n", "utf-8");
|
|
52978
|
+
const files = readdirSync15(this.historyDir).filter((f) => f.startsWith("cycle-") && f.endsWith(".json")).sort();
|
|
52633
52979
|
if (files.length > 50) {
|
|
52634
52980
|
for (const old of files.slice(0, files.length - 50)) {
|
|
52635
52981
|
try {
|
|
52636
|
-
unlinkSync9(
|
|
52982
|
+
unlinkSync9(join61(this.historyDir, old));
|
|
52637
52983
|
} catch {
|
|
52638
52984
|
}
|
|
52639
52985
|
}
|
|
@@ -52646,8 +52992,8 @@ OUTPUT: Call task_complete with JSON:
|
|
|
52646
52992
|
});
|
|
52647
52993
|
|
|
52648
52994
|
// packages/cli/dist/tui/snr-engine.js
|
|
52649
|
-
import { existsSync as
|
|
52650
|
-
import { join as
|
|
52995
|
+
import { existsSync as existsSync46, readdirSync as readdirSync16, readFileSync as readFileSync35 } from "node:fs";
|
|
52996
|
+
import { join as join62, basename as basename15 } from "node:path";
|
|
52651
52997
|
function computeDPrime(signalScores, noiseScores) {
|
|
52652
52998
|
if (signalScores.length === 0 || noiseScores.length === 0)
|
|
52653
52999
|
return 0;
|
|
@@ -52887,20 +53233,20 @@ Call task_complete with the JSON array when done.`, onEvent)
|
|
|
52887
53233
|
loadMemoryEntries(topics) {
|
|
52888
53234
|
const entries = [];
|
|
52889
53235
|
const dirs = [
|
|
52890
|
-
|
|
52891
|
-
|
|
53236
|
+
join62(this.repoRoot, ".oa", "memory"),
|
|
53237
|
+
join62(this.repoRoot, ".open-agents", "memory")
|
|
52892
53238
|
];
|
|
52893
53239
|
for (const dir of dirs) {
|
|
52894
|
-
if (!
|
|
53240
|
+
if (!existsSync46(dir))
|
|
52895
53241
|
continue;
|
|
52896
53242
|
try {
|
|
52897
|
-
const files =
|
|
53243
|
+
const files = readdirSync16(dir).filter((f) => f.endsWith(".json"));
|
|
52898
53244
|
for (const f of files) {
|
|
52899
|
-
const topic =
|
|
53245
|
+
const topic = basename15(f, ".json");
|
|
52900
53246
|
if (topics.length > 0 && !topics.includes(topic))
|
|
52901
53247
|
continue;
|
|
52902
53248
|
try {
|
|
52903
|
-
const data = JSON.parse(
|
|
53249
|
+
const data = JSON.parse(readFileSync35(join62(dir, f), "utf-8"));
|
|
52904
53250
|
for (const [key, val] of Object.entries(data)) {
|
|
52905
53251
|
const value = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
52906
53252
|
entries.push({ topic, key, value });
|
|
@@ -53467,8 +53813,8 @@ var init_tool_policy = __esm({
|
|
|
53467
53813
|
});
|
|
53468
53814
|
|
|
53469
53815
|
// packages/cli/dist/tui/telegram-bridge.js
|
|
53470
|
-
import { mkdirSync as mkdirSync21, existsSync as
|
|
53471
|
-
import { join as
|
|
53816
|
+
import { mkdirSync as mkdirSync21, existsSync as existsSync47, unlinkSync as unlinkSync10, readdirSync as readdirSync17, statSync as statSync15 } from "node:fs";
|
|
53817
|
+
import { join as join63, resolve as resolve30 } from "node:path";
|
|
53472
53818
|
import { writeFile as writeFileAsync } from "node:fs/promises";
|
|
53473
53819
|
function convertMarkdownToTelegramHTML(md) {
|
|
53474
53820
|
let html = md;
|
|
@@ -54233,7 +54579,7 @@ Telegram admin: @${msg.username}` : `Telegram ${isGroup ? "group" : "public"} ch
|
|
|
54233
54579
|
return null;
|
|
54234
54580
|
const buffer = Buffer.from(await res.arrayBuffer());
|
|
54235
54581
|
const fileName = `${Date.now()}-${fileId.slice(0, 8)}${extension}`;
|
|
54236
|
-
const localPath =
|
|
54582
|
+
const localPath = join63(this.mediaCacheDir, fileName);
|
|
54237
54583
|
await writeFileAsync(localPath, buffer);
|
|
54238
54584
|
return localPath;
|
|
54239
54585
|
} catch {
|
|
@@ -55567,7 +55913,7 @@ var init_text_selection = __esm({
|
|
|
55567
55913
|
});
|
|
55568
55914
|
|
|
55569
55915
|
// packages/cli/dist/tui/status-bar.js
|
|
55570
|
-
import { readFileSync as
|
|
55916
|
+
import { readFileSync as readFileSync36 } from "node:fs";
|
|
55571
55917
|
function setTerminalTitle(task, version) {
|
|
55572
55918
|
if (!process.stdout.isTTY)
|
|
55573
55919
|
return;
|
|
@@ -56242,7 +56588,7 @@ var init_status_bar = __esm({
|
|
|
56242
56588
|
if (nexusDir) {
|
|
56243
56589
|
try {
|
|
56244
56590
|
const metricsPath = nexusDir + "/remote-metrics.json";
|
|
56245
|
-
const raw =
|
|
56591
|
+
const raw = readFileSync36(metricsPath, "utf8");
|
|
56246
56592
|
const cached = JSON.parse(raw);
|
|
56247
56593
|
if (cached && cached.ts && Date.now() - cached.ts < 6e4) {
|
|
56248
56594
|
const m = cached.data;
|
|
@@ -56486,6 +56832,8 @@ var init_status_bar = __esm({
|
|
|
56486
56832
|
return false;
|
|
56487
56833
|
const ok = this._textSelection.copyToClipboard();
|
|
56488
56834
|
if (ok) {
|
|
56835
|
+
this._textSelection.clear();
|
|
56836
|
+
this.repaintContent();
|
|
56489
56837
|
const rows = process.stdout.rows ?? 24;
|
|
56490
56838
|
const pos = this.rowPositions(rows);
|
|
56491
56839
|
const writer = this._origWrite ?? process.stdout.write.bind(process.stdout);
|
|
@@ -57474,6 +57822,11 @@ ${CONTENT_BG_SEQ}`);
|
|
|
57474
57822
|
if (key?.name === "escape" || s === "\x1B") {
|
|
57475
57823
|
sawEscape = true;
|
|
57476
57824
|
sawEscapeTime = Date.now();
|
|
57825
|
+
if (self._textSelection.hasSelection && s.length === 1) {
|
|
57826
|
+
self._textSelection.clear();
|
|
57827
|
+
self.repaintContent();
|
|
57828
|
+
return;
|
|
57829
|
+
}
|
|
57477
57830
|
if (onEscape && s.length === 1)
|
|
57478
57831
|
onEscape();
|
|
57479
57832
|
return;
|
|
@@ -57682,11 +58035,11 @@ var init_mouse_filter = __esm({
|
|
|
57682
58035
|
import * as readline2 from "node:readline";
|
|
57683
58036
|
import { Writable } from "node:stream";
|
|
57684
58037
|
import { cwd } from "node:process";
|
|
57685
|
-
import { resolve as resolve31, join as
|
|
58038
|
+
import { resolve as resolve31, join as join64, dirname as dirname20, extname as extname11 } from "node:path";
|
|
57686
58039
|
import { createRequire as createRequire2 } from "node:module";
|
|
57687
58040
|
import { fileURLToPath as fileURLToPath12 } from "node:url";
|
|
57688
|
-
import { readFileSync as
|
|
57689
|
-
import { existsSync as
|
|
58041
|
+
import { readFileSync as readFileSync37, writeFileSync as writeFileSync21, appendFileSync as appendFileSync4, rmSync as rmSync3, readdirSync as readdirSync18, mkdirSync as mkdirSync22 } from "node:fs";
|
|
58042
|
+
import { existsSync as existsSync48 } from "node:fs";
|
|
57690
58043
|
import { execSync as execSync30 } from "node:child_process";
|
|
57691
58044
|
import { homedir as homedir16 } from "node:os";
|
|
57692
58045
|
function formatTimeAgo(date) {
|
|
@@ -57705,14 +58058,14 @@ function formatTimeAgo(date) {
|
|
|
57705
58058
|
function getVersion3() {
|
|
57706
58059
|
try {
|
|
57707
58060
|
const require2 = createRequire2(import.meta.url);
|
|
57708
|
-
const thisDir =
|
|
58061
|
+
const thisDir = dirname20(fileURLToPath12(import.meta.url));
|
|
57709
58062
|
const candidates = [
|
|
57710
|
-
|
|
57711
|
-
|
|
57712
|
-
|
|
58063
|
+
join64(thisDir, "..", "package.json"),
|
|
58064
|
+
join64(thisDir, "..", "..", "package.json"),
|
|
58065
|
+
join64(thisDir, "..", "..", "..", "package.json")
|
|
57713
58066
|
];
|
|
57714
58067
|
for (const pkgPath of candidates) {
|
|
57715
|
-
if (
|
|
58068
|
+
if (existsSync48(pkgPath)) {
|
|
57716
58069
|
const pkg = require2(pkgPath);
|
|
57717
58070
|
if (pkg.name === "open-agents-ai" || pkg.name === "@open-agents/cli") {
|
|
57718
58071
|
return pkg.version ?? "0.0.0";
|
|
@@ -57841,6 +58194,7 @@ function buildTools(repoRoot, config, contextWindowSize) {
|
|
|
57841
58194
|
new FileExploreTool(repoRoot),
|
|
57842
58195
|
new WorkingNotesTool(),
|
|
57843
58196
|
new SemanticMapTool(repoRoot),
|
|
58197
|
+
new RepoMapTool(repoRoot),
|
|
57844
58198
|
// Nexus P2P networking + x402 micropayments
|
|
57845
58199
|
new NexusTool(repoRoot)
|
|
57846
58200
|
];
|
|
@@ -57937,15 +58291,15 @@ Use task_status("${taskId}") or task_output("${taskId}") to check progress.`
|
|
|
57937
58291
|
function gatherMemorySnippets(root) {
|
|
57938
58292
|
const snippets = [];
|
|
57939
58293
|
const dirs = [
|
|
57940
|
-
|
|
57941
|
-
|
|
58294
|
+
join64(root, ".oa", "memory"),
|
|
58295
|
+
join64(root, ".open-agents", "memory")
|
|
57942
58296
|
];
|
|
57943
58297
|
for (const dir of dirs) {
|
|
57944
|
-
if (!
|
|
58298
|
+
if (!existsSync48(dir))
|
|
57945
58299
|
continue;
|
|
57946
58300
|
try {
|
|
57947
|
-
for (const f of
|
|
57948
|
-
const data = JSON.parse(
|
|
58301
|
+
for (const f of readdirSync18(dir).filter((f2) => f2.endsWith(".json"))) {
|
|
58302
|
+
const data = JSON.parse(readFileSync37(join64(dir, f), "utf-8"));
|
|
57949
58303
|
for (const val of Object.values(data)) {
|
|
57950
58304
|
const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
57951
58305
|
if (v.length > 10)
|
|
@@ -58080,9 +58434,9 @@ ${metabolismMemories}
|
|
|
58080
58434
|
} catch {
|
|
58081
58435
|
}
|
|
58082
58436
|
try {
|
|
58083
|
-
const archeFile =
|
|
58084
|
-
if (
|
|
58085
|
-
const variants = JSON.parse(
|
|
58437
|
+
const archeFile = join64(repoRoot, ".oa", "arche", "variants.json");
|
|
58438
|
+
if (existsSync48(archeFile)) {
|
|
58439
|
+
const variants = JSON.parse(readFileSync37(archeFile, "utf8"));
|
|
58086
58440
|
if (variants.length > 0) {
|
|
58087
58441
|
let filtered = variants;
|
|
58088
58442
|
if (taskType) {
|
|
@@ -58219,9 +58573,9 @@ ${lines.join("\n")}
|
|
|
58219
58573
|
const compactionThreshold = modelTier === "small" ? 12e3 : modelTier === "medium" ? 24e3 : 4e4;
|
|
58220
58574
|
let identityInjection = "";
|
|
58221
58575
|
try {
|
|
58222
|
-
const ikStateFile =
|
|
58223
|
-
if (
|
|
58224
|
-
const selfState = JSON.parse(
|
|
58576
|
+
const ikStateFile = join64(repoRoot, ".oa", "identity", "self-state.json");
|
|
58577
|
+
if (existsSync48(ikStateFile)) {
|
|
58578
|
+
const selfState = JSON.parse(readFileSync37(ikStateFile, "utf8"));
|
|
58225
58579
|
const lines = [
|
|
58226
58580
|
`[Identity State v${selfState.version}]`,
|
|
58227
58581
|
`Self: ${selfState.narrative_summary}`,
|
|
@@ -58858,11 +59212,11 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
58858
59212
|
});
|
|
58859
59213
|
}
|
|
58860
59214
|
try {
|
|
58861
|
-
const ikDir =
|
|
58862
|
-
const ikFile =
|
|
59215
|
+
const ikDir = join64(repoRoot, ".oa", "identity");
|
|
59216
|
+
const ikFile = join64(ikDir, "self-state.json");
|
|
58863
59217
|
let ikState;
|
|
58864
|
-
if (
|
|
58865
|
-
ikState = JSON.parse(
|
|
59218
|
+
if (existsSync48(ikFile)) {
|
|
59219
|
+
ikState = JSON.parse(readFileSync37(ikFile, "utf8"));
|
|
58866
59220
|
} else {
|
|
58867
59221
|
mkdirSync22(ikDir, { recursive: true });
|
|
58868
59222
|
const machineId = Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
|
|
@@ -58905,9 +59259,9 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
58905
59259
|
} else {
|
|
58906
59260
|
renderTaskIncomplete(result.turns, result.toolCalls, result.durationMs, tokens);
|
|
58907
59261
|
try {
|
|
58908
|
-
const ikFile =
|
|
58909
|
-
if (
|
|
58910
|
-
const ikState = JSON.parse(
|
|
59262
|
+
const ikFile = join64(repoRoot, ".oa", "identity", "self-state.json");
|
|
59263
|
+
if (existsSync48(ikFile)) {
|
|
59264
|
+
const ikState = JSON.parse(readFileSync37(ikFile, "utf8"));
|
|
58911
59265
|
ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
|
|
58912
59266
|
ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.05);
|
|
58913
59267
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
@@ -59237,7 +59591,7 @@ async function startInteractive(config, repoPath) {
|
|
|
59237
59591
|
let p2pGateway = null;
|
|
59238
59592
|
let peerMesh = null;
|
|
59239
59593
|
let inferenceRouter = null;
|
|
59240
|
-
const secretVault = new SecretVault(
|
|
59594
|
+
const secretVault = new SecretVault(join64(repoRoot, ".oa", "vault.enc"));
|
|
59241
59595
|
let adminSessionKey = null;
|
|
59242
59596
|
const callSubAgents = /* @__PURE__ */ new Map();
|
|
59243
59597
|
const streamRenderer = new StreamRenderer();
|
|
@@ -59457,13 +59811,13 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
59457
59811
|
const hits = allCompletions.filter((c3) => c3.toLowerCase().startsWith(lower));
|
|
59458
59812
|
return [hits, line];
|
|
59459
59813
|
}
|
|
59460
|
-
const HISTORY_DIR =
|
|
59461
|
-
const HISTORY_FILE =
|
|
59814
|
+
const HISTORY_DIR = join64(homedir16(), ".open-agents");
|
|
59815
|
+
const HISTORY_FILE = join64(HISTORY_DIR, "repl-history");
|
|
59462
59816
|
const MAX_HISTORY_LINES = 500;
|
|
59463
59817
|
let savedHistory = [];
|
|
59464
59818
|
try {
|
|
59465
|
-
if (
|
|
59466
|
-
const raw =
|
|
59819
|
+
if (existsSync48(HISTORY_FILE)) {
|
|
59820
|
+
const raw = readFileSync37(HISTORY_FILE, "utf8").trim();
|
|
59467
59821
|
if (raw)
|
|
59468
59822
|
savedHistory = raw.split("\n").reverse();
|
|
59469
59823
|
}
|
|
@@ -59546,7 +59900,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
59546
59900
|
mkdirSync22(HISTORY_DIR, { recursive: true });
|
|
59547
59901
|
appendFileSync4(HISTORY_FILE, line + "\n", "utf8");
|
|
59548
59902
|
if (Math.random() < 0.02) {
|
|
59549
|
-
const all =
|
|
59903
|
+
const all = readFileSync37(HISTORY_FILE, "utf8").trim().split("\n");
|
|
59550
59904
|
if (all.length > MAX_HISTORY_LINES) {
|
|
59551
59905
|
writeFileSync21(HISTORY_FILE, all.slice(-MAX_HISTORY_LINES).join("\n") + "\n", "utf8");
|
|
59552
59906
|
}
|
|
@@ -59724,7 +60078,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
59724
60078
|
} catch {
|
|
59725
60079
|
}
|
|
59726
60080
|
try {
|
|
59727
|
-
const oaDir =
|
|
60081
|
+
const oaDir = join64(repoRoot, ".oa");
|
|
59728
60082
|
const reconnected = await ExposeGateway.checkAndReconnect(oaDir, {
|
|
59729
60083
|
onInfo: (msg) => writeContent(() => renderInfo(msg)),
|
|
59730
60084
|
onError: (msg) => writeContent(() => renderWarning(msg))
|
|
@@ -59747,7 +60101,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
59747
60101
|
} catch {
|
|
59748
60102
|
}
|
|
59749
60103
|
try {
|
|
59750
|
-
const oaDir =
|
|
60104
|
+
const oaDir = join64(repoRoot, ".oa");
|
|
59751
60105
|
const reconnectedP2P = await ExposeP2PGateway.checkAndReconnect(oaDir, new NexusTool(repoRoot), {
|
|
59752
60106
|
onInfo: (msg) => writeContent(() => renderInfo(msg)),
|
|
59753
60107
|
onError: (msg) => writeContent(() => renderWarning(msg))
|
|
@@ -60631,7 +60985,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
60631
60985
|
kind,
|
|
60632
60986
|
targetUrl,
|
|
60633
60987
|
authKey,
|
|
60634
|
-
stateDir:
|
|
60988
|
+
stateDir: join64(repoRoot, ".oa"),
|
|
60635
60989
|
passthrough: passthrough ?? false,
|
|
60636
60990
|
loadbalance: loadbalance ?? false,
|
|
60637
60991
|
endpointAuth: passthrough ? currentConfig.apiKey : void 0,
|
|
@@ -60679,7 +61033,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
60679
61033
|
await tunnelGateway.stop();
|
|
60680
61034
|
tunnelGateway = null;
|
|
60681
61035
|
}
|
|
60682
|
-
const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir:
|
|
61036
|
+
const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir: join64(repoRoot, ".oa") });
|
|
60683
61037
|
newTunnel.on("stats", (stats) => {
|
|
60684
61038
|
statusBar.setExposeStatus({
|
|
60685
61039
|
status: stats.status,
|
|
@@ -60948,10 +61302,10 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
60948
61302
|
writeContent(() => renderInfo(`Killed ${bgKilled} background task(s).`));
|
|
60949
61303
|
}
|
|
60950
61304
|
try {
|
|
60951
|
-
const nexusDir =
|
|
60952
|
-
const pidFile =
|
|
60953
|
-
if (
|
|
60954
|
-
const pid = parseInt(
|
|
61305
|
+
const nexusDir = join64(repoRoot, OA_DIR, "nexus");
|
|
61306
|
+
const pidFile = join64(nexusDir, "daemon.pid");
|
|
61307
|
+
if (existsSync48(pidFile)) {
|
|
61308
|
+
const pid = parseInt(readFileSync37(pidFile, "utf8").trim(), 10);
|
|
60955
61309
|
if (pid > 0) {
|
|
60956
61310
|
try {
|
|
60957
61311
|
if (process.platform === "win32") {
|
|
@@ -60973,13 +61327,13 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
60973
61327
|
} catch {
|
|
60974
61328
|
}
|
|
60975
61329
|
try {
|
|
60976
|
-
const voiceDir2 =
|
|
61330
|
+
const voiceDir2 = join64(homedir16(), ".open-agents", "voice");
|
|
60977
61331
|
const voicePidFiles = ["luxtts-daemon.pid", "piper-daemon.pid"];
|
|
60978
61332
|
for (const pf of voicePidFiles) {
|
|
60979
|
-
const pidPath =
|
|
60980
|
-
if (
|
|
61333
|
+
const pidPath = join64(voiceDir2, pf);
|
|
61334
|
+
if (existsSync48(pidPath)) {
|
|
60981
61335
|
try {
|
|
60982
|
-
const pid = parseInt(
|
|
61336
|
+
const pid = parseInt(readFileSync37(pidPath, "utf8").trim(), 10);
|
|
60983
61337
|
if (pid > 0) {
|
|
60984
61338
|
if (process.platform === "win32") {
|
|
60985
61339
|
try {
|
|
@@ -61003,8 +61357,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
61003
61357
|
execSync30(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.5", { timeout: 3e3, stdio: "ignore" });
|
|
61004
61358
|
} catch {
|
|
61005
61359
|
}
|
|
61006
|
-
const oaPath =
|
|
61007
|
-
if (
|
|
61360
|
+
const oaPath = join64(repoRoot, OA_DIR);
|
|
61361
|
+
if (existsSync48(oaPath)) {
|
|
61008
61362
|
let deleted = false;
|
|
61009
61363
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
61010
61364
|
try {
|
|
@@ -61376,8 +61730,8 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
61376
61730
|
}
|
|
61377
61731
|
}
|
|
61378
61732
|
const cleanPath = input.replace(/^['"]|['"]$/g, "").trim();
|
|
61379
|
-
const isImage = isImagePath(cleanPath) &&
|
|
61380
|
-
const isMedia = !isImage && isTranscribablePath(cleanPath) &&
|
|
61733
|
+
const isImage = isImagePath(cleanPath) && existsSync48(resolve31(repoRoot, cleanPath));
|
|
61734
|
+
const isMedia = !isImage && isTranscribablePath(cleanPath) && existsSync48(resolve31(repoRoot, cleanPath));
|
|
61381
61735
|
if (activeTask) {
|
|
61382
61736
|
if (activeTask.runner.isPaused) {
|
|
61383
61737
|
activeTask.runner.resume();
|
|
@@ -61386,9 +61740,9 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
61386
61740
|
if (isImage) {
|
|
61387
61741
|
try {
|
|
61388
61742
|
const imgPath = resolve31(repoRoot, cleanPath);
|
|
61389
|
-
const imgBuffer =
|
|
61743
|
+
const imgBuffer = readFileSync37(imgPath);
|
|
61390
61744
|
const base64 = imgBuffer.toString("base64");
|
|
61391
|
-
const ext =
|
|
61745
|
+
const ext = extname11(cleanPath).toLowerCase();
|
|
61392
61746
|
const mime = ext === ".png" ? "image/png" : ext === ".gif" ? "image/gif" : ext === ".webp" ? "image/webp" : "image/jpeg";
|
|
61393
61747
|
activeTask.runner.injectImage(base64, mime, `User shared image: ${cleanPath}`);
|
|
61394
61748
|
writeContent(() => renderUserInterrupt(`[Image: ${cleanPath}]`));
|
|
@@ -61884,11 +62238,11 @@ async function runWithTUI(task, config, repoPath) {
|
|
|
61884
62238
|
const handle = startTask(task, config, repoRoot);
|
|
61885
62239
|
await handle.promise;
|
|
61886
62240
|
try {
|
|
61887
|
-
const ikDir =
|
|
61888
|
-
const ikFile =
|
|
62241
|
+
const ikDir = join64(repoRoot, ".oa", "identity");
|
|
62242
|
+
const ikFile = join64(ikDir, "self-state.json");
|
|
61889
62243
|
let ikState;
|
|
61890
|
-
if (
|
|
61891
|
-
ikState = JSON.parse(
|
|
62244
|
+
if (existsSync48(ikFile)) {
|
|
62245
|
+
ikState = JSON.parse(readFileSync37(ikFile, "utf8"));
|
|
61892
62246
|
} else {
|
|
61893
62247
|
mkdirSync22(ikDir, { recursive: true });
|
|
61894
62248
|
ikState = {
|
|
@@ -61921,12 +62275,12 @@ async function runWithTUI(task, config, repoPath) {
|
|
|
61921
62275
|
ec.archiveVariantSync(`Task: ${task.slice(0, 200)}`, "success \u2014 completed", ["general"]);
|
|
61922
62276
|
} catch {
|
|
61923
62277
|
try {
|
|
61924
|
-
const archeDir =
|
|
61925
|
-
const archeFile =
|
|
62278
|
+
const archeDir = join64(repoRoot, ".oa", "arche");
|
|
62279
|
+
const archeFile = join64(archeDir, "variants.json");
|
|
61926
62280
|
let variants = [];
|
|
61927
62281
|
try {
|
|
61928
|
-
if (
|
|
61929
|
-
variants = JSON.parse(
|
|
62282
|
+
if (existsSync48(archeFile))
|
|
62283
|
+
variants = JSON.parse(readFileSync37(archeFile, "utf8"));
|
|
61930
62284
|
} catch {
|
|
61931
62285
|
}
|
|
61932
62286
|
variants.push({
|
|
@@ -61947,9 +62301,9 @@ async function runWithTUI(task, config, repoPath) {
|
|
|
61947
62301
|
}
|
|
61948
62302
|
}
|
|
61949
62303
|
try {
|
|
61950
|
-
const metaFile =
|
|
61951
|
-
if (
|
|
61952
|
-
const store = JSON.parse(
|
|
62304
|
+
const metaFile = join64(repoRoot, ".oa", "memory", "metabolism", "store.json");
|
|
62305
|
+
if (existsSync48(metaFile)) {
|
|
62306
|
+
const store = JSON.parse(readFileSync37(metaFile, "utf8"));
|
|
61953
62307
|
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);
|
|
61954
62308
|
let updated = false;
|
|
61955
62309
|
for (const item of surfaced) {
|
|
@@ -62013,9 +62367,9 @@ Rules:
|
|
|
62013
62367
|
try {
|
|
62014
62368
|
const { initDb: initDb2 } = __require("@open-agents/memory");
|
|
62015
62369
|
const { ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
|
|
62016
|
-
const dbDir =
|
|
62370
|
+
const dbDir = join64(repoRoot, ".oa", "memory");
|
|
62017
62371
|
mkdirSync22(dbDir, { recursive: true });
|
|
62018
|
-
const db = initDb2(
|
|
62372
|
+
const db = initDb2(join64(dbDir, "structured.db"));
|
|
62019
62373
|
const memStore = new ProceduralMemoryStore2(db);
|
|
62020
62374
|
memStore.createWithEmbedding({
|
|
62021
62375
|
content: content.slice(0, 600),
|
|
@@ -62030,12 +62384,12 @@ Rules:
|
|
|
62030
62384
|
db.close();
|
|
62031
62385
|
} catch {
|
|
62032
62386
|
}
|
|
62033
|
-
const metaDir =
|
|
62034
|
-
const storeFile =
|
|
62387
|
+
const metaDir = join64(repoRoot, ".oa", "memory", "metabolism");
|
|
62388
|
+
const storeFile = join64(metaDir, "store.json");
|
|
62035
62389
|
let store = [];
|
|
62036
62390
|
try {
|
|
62037
|
-
if (
|
|
62038
|
-
store = JSON.parse(
|
|
62391
|
+
if (existsSync48(storeFile))
|
|
62392
|
+
store = JSON.parse(readFileSync37(storeFile, "utf8"));
|
|
62039
62393
|
} catch {
|
|
62040
62394
|
}
|
|
62041
62395
|
store.push({
|
|
@@ -62058,19 +62412,19 @@ Rules:
|
|
|
62058
62412
|
} catch {
|
|
62059
62413
|
}
|
|
62060
62414
|
try {
|
|
62061
|
-
const cohereSettingsFile =
|
|
62415
|
+
const cohereSettingsFile = join64(repoRoot, ".oa", "settings.json");
|
|
62062
62416
|
let cohereActive = false;
|
|
62063
62417
|
try {
|
|
62064
|
-
if (
|
|
62065
|
-
const settings = JSON.parse(
|
|
62418
|
+
if (existsSync48(cohereSettingsFile)) {
|
|
62419
|
+
const settings = JSON.parse(readFileSync37(cohereSettingsFile, "utf8"));
|
|
62066
62420
|
cohereActive = settings.cohere === true;
|
|
62067
62421
|
}
|
|
62068
62422
|
} catch {
|
|
62069
62423
|
}
|
|
62070
62424
|
if (cohereActive) {
|
|
62071
|
-
const metaFile =
|
|
62072
|
-
if (
|
|
62073
|
-
const store = JSON.parse(
|
|
62425
|
+
const metaFile = join64(repoRoot, ".oa", "memory", "metabolism", "store.json");
|
|
62426
|
+
if (existsSync48(metaFile)) {
|
|
62427
|
+
const store = JSON.parse(readFileSync37(metaFile, "utf8"));
|
|
62074
62428
|
const latest = store.filter((m) => m.sourceTrace === "trajectory-extraction" || m.sourceTrace === "llm-trajectory-extraction").slice(-1)[0];
|
|
62075
62429
|
if (latest && latest.scores?.confidence >= 0.6) {
|
|
62076
62430
|
try {
|
|
@@ -62095,18 +62449,18 @@ Rules:
|
|
|
62095
62449
|
}
|
|
62096
62450
|
} catch (err) {
|
|
62097
62451
|
try {
|
|
62098
|
-
const ikFile =
|
|
62099
|
-
if (
|
|
62100
|
-
const ikState = JSON.parse(
|
|
62452
|
+
const ikFile = join64(repoRoot, ".oa", "identity", "self-state.json");
|
|
62453
|
+
if (existsSync48(ikFile)) {
|
|
62454
|
+
const ikState = JSON.parse(readFileSync37(ikFile, "utf8"));
|
|
62101
62455
|
ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
|
|
62102
62456
|
ikState.homeostasis.coherence = Math.max(0, ikState.homeostasis.coherence - 0.05);
|
|
62103
62457
|
ikState.session_count = (ikState.session_count || 0) + 1;
|
|
62104
62458
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
62105
62459
|
writeFileSync21(ikFile, JSON.stringify(ikState, null, 2));
|
|
62106
62460
|
}
|
|
62107
|
-
const metaFile =
|
|
62108
|
-
if (
|
|
62109
|
-
const store = JSON.parse(
|
|
62461
|
+
const metaFile = join64(repoRoot, ".oa", "memory", "metabolism", "store.json");
|
|
62462
|
+
if (existsSync48(metaFile)) {
|
|
62463
|
+
const store = JSON.parse(readFileSync37(metaFile, "utf8"));
|
|
62110
62464
|
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);
|
|
62111
62465
|
for (const item of surfaced) {
|
|
62112
62466
|
item.accessCount = (item.accessCount || 0) + 1;
|
|
@@ -62117,12 +62471,12 @@ Rules:
|
|
|
62117
62471
|
writeFileSync21(metaFile, JSON.stringify(store, null, 2));
|
|
62118
62472
|
}
|
|
62119
62473
|
try {
|
|
62120
|
-
const archeDir =
|
|
62121
|
-
const archeFile =
|
|
62474
|
+
const archeDir = join64(repoRoot, ".oa", "arche");
|
|
62475
|
+
const archeFile = join64(archeDir, "variants.json");
|
|
62122
62476
|
let variants = [];
|
|
62123
62477
|
try {
|
|
62124
|
-
if (
|
|
62125
|
-
variants = JSON.parse(
|
|
62478
|
+
if (existsSync48(archeFile))
|
|
62479
|
+
variants = JSON.parse(readFileSync37(archeFile, "utf8"));
|
|
62126
62480
|
} catch {
|
|
62127
62481
|
}
|
|
62128
62482
|
variants.push({
|
|
@@ -62223,7 +62577,7 @@ import { glob } from "glob";
|
|
|
62223
62577
|
import ignore from "ignore";
|
|
62224
62578
|
import { readFile as readFile23, stat as stat4 } from "node:fs/promises";
|
|
62225
62579
|
import { createHash as createHash4 } from "node:crypto";
|
|
62226
|
-
import { join as
|
|
62580
|
+
import { join as join65, relative as relative4, extname as extname12, basename as basename16 } from "node:path";
|
|
62227
62581
|
var DEFAULT_EXCLUDE, LANGUAGE_MAP, CodebaseIndexer;
|
|
62228
62582
|
var init_codebase_indexer = __esm({
|
|
62229
62583
|
"packages/indexer/dist/codebase-indexer.js"() {
|
|
@@ -62267,7 +62621,7 @@ var init_codebase_indexer = __esm({
|
|
|
62267
62621
|
const ig = ignore.default();
|
|
62268
62622
|
if (this.config.respectGitignore) {
|
|
62269
62623
|
try {
|
|
62270
|
-
const gitignoreContent = await readFile23(
|
|
62624
|
+
const gitignoreContent = await readFile23(join65(this.config.rootDir, ".gitignore"), "utf-8");
|
|
62271
62625
|
ig.add(gitignoreContent);
|
|
62272
62626
|
} catch {
|
|
62273
62627
|
}
|
|
@@ -62282,14 +62636,14 @@ var init_codebase_indexer = __esm({
|
|
|
62282
62636
|
for (const relativePath of files) {
|
|
62283
62637
|
if (ig.ignores(relativePath))
|
|
62284
62638
|
continue;
|
|
62285
|
-
const fullPath =
|
|
62639
|
+
const fullPath = join65(this.config.rootDir, relativePath);
|
|
62286
62640
|
try {
|
|
62287
62641
|
const fileStat = await stat4(fullPath);
|
|
62288
62642
|
if (fileStat.size > this.config.maxFileSize)
|
|
62289
62643
|
continue;
|
|
62290
62644
|
const content = await readFile23(fullPath);
|
|
62291
62645
|
const hash = createHash4("sha256").update(content).digest("hex");
|
|
62292
|
-
const ext =
|
|
62646
|
+
const ext = extname12(relativePath);
|
|
62293
62647
|
indexed.push({
|
|
62294
62648
|
path: fullPath,
|
|
62295
62649
|
relativePath,
|
|
@@ -62305,7 +62659,7 @@ var init_codebase_indexer = __esm({
|
|
|
62305
62659
|
}
|
|
62306
62660
|
buildTree(files) {
|
|
62307
62661
|
const root = {
|
|
62308
|
-
name:
|
|
62662
|
+
name: basename16(this.config.rootDir),
|
|
62309
62663
|
path: this.config.rootDir,
|
|
62310
62664
|
type: "directory",
|
|
62311
62665
|
children: []
|
|
@@ -62328,7 +62682,7 @@ var init_codebase_indexer = __esm({
|
|
|
62328
62682
|
if (!child) {
|
|
62329
62683
|
child = {
|
|
62330
62684
|
name: part,
|
|
62331
|
-
path:
|
|
62685
|
+
path: join65(current.path, part),
|
|
62332
62686
|
type: "directory",
|
|
62333
62687
|
children: []
|
|
62334
62688
|
};
|
|
@@ -62411,17 +62765,17 @@ __export(index_repo_exports, {
|
|
|
62411
62765
|
indexRepoCommand: () => indexRepoCommand
|
|
62412
62766
|
});
|
|
62413
62767
|
import { resolve as resolve32 } from "node:path";
|
|
62414
|
-
import { existsSync as
|
|
62768
|
+
import { existsSync as existsSync49, statSync as statSync16 } from "node:fs";
|
|
62415
62769
|
import { cwd as cwd2 } from "node:process";
|
|
62416
62770
|
async function indexRepoCommand(opts, _config) {
|
|
62417
62771
|
const repoRoot = resolve32(opts.repoPath ?? cwd2());
|
|
62418
62772
|
printHeader("Index Repository");
|
|
62419
62773
|
printInfo(`Indexing: ${repoRoot}`);
|
|
62420
|
-
if (!
|
|
62774
|
+
if (!existsSync49(repoRoot)) {
|
|
62421
62775
|
printError(`Path does not exist: ${repoRoot}`);
|
|
62422
62776
|
process.exit(1);
|
|
62423
62777
|
}
|
|
62424
|
-
const stat5 =
|
|
62778
|
+
const stat5 = statSync16(repoRoot);
|
|
62425
62779
|
if (!stat5.isDirectory()) {
|
|
62426
62780
|
printError(`Path is not a directory: ${repoRoot}`);
|
|
62427
62781
|
process.exit(1);
|
|
@@ -62669,7 +63023,7 @@ var config_exports = {};
|
|
|
62669
63023
|
__export(config_exports, {
|
|
62670
63024
|
configCommand: () => configCommand
|
|
62671
63025
|
});
|
|
62672
|
-
import { join as
|
|
63026
|
+
import { join as join66, resolve as resolve33 } from "node:path";
|
|
62673
63027
|
import { homedir as homedir17 } from "node:os";
|
|
62674
63028
|
import { cwd as cwd3 } from "node:process";
|
|
62675
63029
|
function redactIfSensitive(key, value) {
|
|
@@ -62752,7 +63106,7 @@ function handleShow(opts, config) {
|
|
|
62752
63106
|
}
|
|
62753
63107
|
}
|
|
62754
63108
|
printSection("Config File");
|
|
62755
|
-
printInfo(`~/.open-agents/config.json (${
|
|
63109
|
+
printInfo(`~/.open-agents/config.json (${join66(homedir17(), ".open-agents", "config.json")})`);
|
|
62756
63110
|
printSection("Priority Chain");
|
|
62757
63111
|
printInfo(" 1. CLI flags (--model, --backend-url, etc.)");
|
|
62758
63112
|
printInfo(" 2. Project .oa/settings.json (--local)");
|
|
@@ -62791,7 +63145,7 @@ function handleSet(opts, _config) {
|
|
|
62791
63145
|
const coerced = coerceForSettings(key, value);
|
|
62792
63146
|
saveProjectSettings(repoRoot, { [key]: coerced });
|
|
62793
63147
|
printSuccess(`Project override set: ${key} = ${redactIfSensitive(key, value)}`);
|
|
62794
|
-
printInfo(`Saved to ${
|
|
63148
|
+
printInfo(`Saved to ${join66(repoRoot, ".oa", "settings.json")}`);
|
|
62795
63149
|
printInfo("This override applies only when running in this workspace.");
|
|
62796
63150
|
} catch (err) {
|
|
62797
63151
|
printError(`Failed to save: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -63050,7 +63404,7 @@ __export(eval_exports, {
|
|
|
63050
63404
|
});
|
|
63051
63405
|
import { tmpdir as tmpdir10 } from "node:os";
|
|
63052
63406
|
import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync22 } from "node:fs";
|
|
63053
|
-
import { join as
|
|
63407
|
+
import { join as join67 } from "node:path";
|
|
63054
63408
|
async function evalCommand(opts, config) {
|
|
63055
63409
|
const suiteName = opts.suite ?? "basic";
|
|
63056
63410
|
const suite = SUITES[suiteName];
|
|
@@ -63175,9 +63529,9 @@ async function evalCommand(opts, config) {
|
|
|
63175
63529
|
process.exit(failed > 0 ? 1 : 0);
|
|
63176
63530
|
}
|
|
63177
63531
|
function createTempEvalRepo() {
|
|
63178
|
-
const dir =
|
|
63532
|
+
const dir = join67(tmpdir10(), `open-agents-eval-${Date.now()}`);
|
|
63179
63533
|
mkdirSync23(dir, { recursive: true });
|
|
63180
|
-
writeFileSync22(
|
|
63534
|
+
writeFileSync22(join67(dir, "package.json"), JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n", "utf8");
|
|
63181
63535
|
return dir;
|
|
63182
63536
|
}
|
|
63183
63537
|
var BASIC_SUITE, FULL_SUITE, SUITES;
|
|
@@ -63237,7 +63591,7 @@ init_updater();
|
|
|
63237
63591
|
import { parseArgs as nodeParseArgs2 } from "node:util";
|
|
63238
63592
|
import { createRequire as createRequire3 } from "node:module";
|
|
63239
63593
|
import { fileURLToPath as fileURLToPath13 } from "node:url";
|
|
63240
|
-
import { dirname as
|
|
63594
|
+
import { dirname as dirname21, join as join68 } from "node:path";
|
|
63241
63595
|
|
|
63242
63596
|
// packages/cli/dist/cli.js
|
|
63243
63597
|
import { createInterface } from "node:readline";
|
|
@@ -63344,7 +63698,7 @@ init_output();
|
|
|
63344
63698
|
function getVersion4() {
|
|
63345
63699
|
try {
|
|
63346
63700
|
const require2 = createRequire3(import.meta.url);
|
|
63347
|
-
const pkgPath =
|
|
63701
|
+
const pkgPath = join68(dirname21(fileURLToPath13(import.meta.url)), "..", "package.json");
|
|
63348
63702
|
const pkg = require2(pkgPath);
|
|
63349
63703
|
return pkg.version;
|
|
63350
63704
|
} catch {
|