open-agents-ai 0.166.0 → 0.168.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 +381 -337
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15277,7 +15277,10 @@ async function probeStation(endpoint) {
|
|
|
15277
15277
|
}
|
|
15278
15278
|
}
|
|
15279
15279
|
function findStationBinary() {
|
|
15280
|
-
const
|
|
15280
|
+
const isWin2 = process.platform === "win32";
|
|
15281
|
+
const homeDir = process.env["HOME"] || process.env["USERPROFILE"] || "/root";
|
|
15282
|
+
const venvBase = join28(homeDir, ".open-agents", "venv");
|
|
15283
|
+
const oaVenvPython = isWin2 ? join28(venvBase, "Scripts", "python.exe") : join28(venvBase, "bin", "python");
|
|
15281
15284
|
if (existsSync17(oaVenvPython)) {
|
|
15282
15285
|
try {
|
|
15283
15286
|
execSync11(`${JSON.stringify(oaVenvPython)} -c "import moondream_station"`, { stdio: "pipe", timeout: 5e3 });
|
|
@@ -15285,13 +15288,14 @@ function findStationBinary() {
|
|
|
15285
15288
|
} catch {
|
|
15286
15289
|
}
|
|
15287
15290
|
}
|
|
15288
|
-
const oaVenvBin = join28(
|
|
15291
|
+
const oaVenvBin = isWin2 ? join28(venvBase, "Scripts", "moondream-station.exe") : join28(venvBase, "bin", "moondream-station");
|
|
15289
15292
|
if (existsSync17(oaVenvBin))
|
|
15290
15293
|
return oaVenvBin;
|
|
15291
15294
|
const thisDir = dirname6(fileURLToPath2(import.meta.url));
|
|
15295
|
+
const pyBin = isWin2 ? "Scripts/python.exe" : "bin/python";
|
|
15292
15296
|
const localVenvPaths = [
|
|
15293
|
-
resolve18(thisDir,
|
|
15294
|
-
resolve18(thisDir,
|
|
15297
|
+
resolve18(thisDir, `../../../../.moondream-venv/${pyBin}`),
|
|
15298
|
+
resolve18(thisDir, `../../../.moondream-venv/${pyBin}`)
|
|
15295
15299
|
];
|
|
15296
15300
|
for (const p of localVenvPaths) {
|
|
15297
15301
|
if (existsSync17(p)) {
|
|
@@ -15761,7 +15765,8 @@ for i in range(${clicks}):
|
|
|
15761
15765
|
} catch {
|
|
15762
15766
|
}
|
|
15763
15767
|
try {
|
|
15764
|
-
const
|
|
15768
|
+
const pyBin = process.platform === "win32" ? "Scripts/python.exe" : "bin/python";
|
|
15769
|
+
const venvPy = join29(__dirname2, `../../../../.moondream-venv/${pyBin}`);
|
|
15765
15770
|
execSync12(`DISPLAY=:0 ${JSON.stringify(venvPy)} -c "${pyScript}"`, { stdio: "pipe", timeout: 5e3 });
|
|
15766
15771
|
return;
|
|
15767
15772
|
} catch {
|
|
@@ -16470,14 +16475,15 @@ function findOcrScript() {
|
|
|
16470
16475
|
return null;
|
|
16471
16476
|
}
|
|
16472
16477
|
function findPython() {
|
|
16473
|
-
const
|
|
16474
|
-
|
|
16478
|
+
const isWin2 = process.platform === "win32";
|
|
16479
|
+
const venvPython2 = isWin2 ? join31(homedir7(), ".open-agents", "venv", "Scripts", "python.exe") : join31(homedir7(), ".open-agents", "venv", "bin", "python");
|
|
16480
|
+
if (existsSync21(venvPython2)) {
|
|
16475
16481
|
try {
|
|
16476
|
-
execSync15(`${JSON.stringify(
|
|
16482
|
+
execSync15(`${JSON.stringify(venvPython2)} -c "import cv2, pytesseract, numpy, PIL"`, {
|
|
16477
16483
|
stdio: "pipe",
|
|
16478
16484
|
timeout: 5e3
|
|
16479
16485
|
});
|
|
16480
|
-
return
|
|
16486
|
+
return venvPython2;
|
|
16481
16487
|
} catch {
|
|
16482
16488
|
}
|
|
16483
16489
|
}
|
|
@@ -21195,11 +21201,33 @@ var init_environment_snapshot = __esm({
|
|
|
21195
21201
|
}
|
|
21196
21202
|
});
|
|
21197
21203
|
|
|
21204
|
+
// packages/execution/dist/venv-paths.js
|
|
21205
|
+
import { join as join41 } from "node:path";
|
|
21206
|
+
function venvPython(venvDir) {
|
|
21207
|
+
return isWin ? join41(venvDir, "Scripts", "python.exe") : join41(venvDir, "bin", "python");
|
|
21208
|
+
}
|
|
21209
|
+
function venvPip(venvDir) {
|
|
21210
|
+
return isWin ? join41(venvDir, "Scripts", "pip.exe") : join41(venvDir, "bin", "pip");
|
|
21211
|
+
}
|
|
21212
|
+
function venvBinDir(venvDir) {
|
|
21213
|
+
return isWin ? join41(venvDir, "Scripts") : join41(venvDir, "bin");
|
|
21214
|
+
}
|
|
21215
|
+
function venvExe(venvDir, name) {
|
|
21216
|
+
return isWin ? join41(venvDir, "Scripts", `${name}.exe`) : join41(venvDir, "bin", name);
|
|
21217
|
+
}
|
|
21218
|
+
var isWin;
|
|
21219
|
+
var init_venv_paths = __esm({
|
|
21220
|
+
"packages/execution/dist/venv-paths.js"() {
|
|
21221
|
+
"use strict";
|
|
21222
|
+
isWin = process.platform === "win32";
|
|
21223
|
+
}
|
|
21224
|
+
});
|
|
21225
|
+
|
|
21198
21226
|
// packages/execution/dist/tools/fortemi-bridge.js
|
|
21199
21227
|
import { existsSync as existsSync27, readFileSync as readFileSync20 } from "node:fs";
|
|
21200
|
-
import { join as
|
|
21228
|
+
import { join as join42 } from "node:path";
|
|
21201
21229
|
function loadBridgeState(repoRoot) {
|
|
21202
|
-
const bridgeFile =
|
|
21230
|
+
const bridgeFile = join42(repoRoot, ".oa", "fortemi-bridge.json");
|
|
21203
21231
|
if (!existsSync27(bridgeFile))
|
|
21204
21232
|
return null;
|
|
21205
21233
|
try {
|
|
@@ -22077,7 +22105,11 @@ __export(dist_exports, {
|
|
|
22077
22105
|
setSudoPassword: () => setSudoPassword,
|
|
22078
22106
|
spawnFullSubAgent: () => spawnFullSubAgent,
|
|
22079
22107
|
stopFullSubAgent: () => stopFullSubAgent,
|
|
22080
|
-
touchFile: () => touchFile
|
|
22108
|
+
touchFile: () => touchFile,
|
|
22109
|
+
venvBinDir: () => venvBinDir,
|
|
22110
|
+
venvExe: () => venvExe,
|
|
22111
|
+
venvPip: () => venvPip,
|
|
22112
|
+
venvPython: () => venvPython
|
|
22081
22113
|
});
|
|
22082
22114
|
var init_dist2 = __esm({
|
|
22083
22115
|
"packages/execution/dist/index.js"() {
|
|
@@ -22143,6 +22175,7 @@ var init_dist2 = __esm({
|
|
|
22143
22175
|
init_process_health();
|
|
22144
22176
|
init_full_sub_agent();
|
|
22145
22177
|
init_environment_snapshot();
|
|
22178
|
+
init_venv_paths();
|
|
22146
22179
|
init_nexus();
|
|
22147
22180
|
init_fortemi_bridge();
|
|
22148
22181
|
init_system_deps();
|
|
@@ -22830,12 +22863,12 @@ var init_dist3 = __esm({
|
|
|
22830
22863
|
|
|
22831
22864
|
// packages/orchestrator/dist/promptLoader.js
|
|
22832
22865
|
import { readFileSync as readFileSync22, existsSync as existsSync29 } from "node:fs";
|
|
22833
|
-
import { join as
|
|
22866
|
+
import { join as join43, dirname as dirname13 } from "node:path";
|
|
22834
22867
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
22835
22868
|
function loadPrompt(promptPath, vars) {
|
|
22836
22869
|
let content = cache.get(promptPath);
|
|
22837
22870
|
if (content === void 0) {
|
|
22838
|
-
const fullPath =
|
|
22871
|
+
const fullPath = join43(PROMPTS_DIR, promptPath);
|
|
22839
22872
|
if (!existsSync29(fullPath)) {
|
|
22840
22873
|
throw new Error(`Prompt file not found: ${fullPath}`);
|
|
22841
22874
|
}
|
|
@@ -22852,7 +22885,7 @@ var init_promptLoader = __esm({
|
|
|
22852
22885
|
"use strict";
|
|
22853
22886
|
__filename = fileURLToPath7(import.meta.url);
|
|
22854
22887
|
__dirname4 = dirname13(__filename);
|
|
22855
|
-
PROMPTS_DIR =
|
|
22888
|
+
PROMPTS_DIR = join43(__dirname4, "..", "prompts");
|
|
22856
22889
|
cache = /* @__PURE__ */ new Map();
|
|
22857
22890
|
}
|
|
22858
22891
|
});
|
|
@@ -23232,7 +23265,7 @@ var init_code_retriever = __esm({
|
|
|
23232
23265
|
import { execFile as execFile6 } from "node:child_process";
|
|
23233
23266
|
import { promisify as promisify5 } from "node:util";
|
|
23234
23267
|
import { readFile as readFile20, readdir as readdir5, stat as stat3 } from "node:fs/promises";
|
|
23235
|
-
import { join as
|
|
23268
|
+
import { join as join44, extname as extname8 } from "node:path";
|
|
23236
23269
|
async function searchByPath(pathPattern, options) {
|
|
23237
23270
|
const allFiles = await collectFiles(options.rootDir, options.includeGlobs ?? DEFAULT_INCLUDE_GLOBS, options.excludeGlobs ?? DEFAULT_EXCLUDE_GLOBS);
|
|
23238
23271
|
const pattern = options.caseInsensitive ? pathPattern.toLowerCase() : pathPattern;
|
|
@@ -23374,7 +23407,7 @@ async function walkForFiles(rootDir, dir, excludeGlobs, results) {
|
|
|
23374
23407
|
continue;
|
|
23375
23408
|
if (excludeGlobs.some((g) => entry.name === g || matchesGlob(entry.name, g)))
|
|
23376
23409
|
continue;
|
|
23377
|
-
const absPath =
|
|
23410
|
+
const absPath = join44(dir, entry.name);
|
|
23378
23411
|
if (entry.isDirectory()) {
|
|
23379
23412
|
await walkForFiles(rootDir, absPath, excludeGlobs, results);
|
|
23380
23413
|
} else if (entry.isFile()) {
|
|
@@ -23681,7 +23714,7 @@ var init_graphExpand = __esm({
|
|
|
23681
23714
|
|
|
23682
23715
|
// packages/retrieval/dist/snippetPacker.js
|
|
23683
23716
|
import { readFile as readFile21 } from "node:fs/promises";
|
|
23684
|
-
import { join as
|
|
23717
|
+
import { join as join45 } from "node:path";
|
|
23685
23718
|
async function packSnippets(requests, opts = {}) {
|
|
23686
23719
|
const maxTokens = opts.maxTokens ?? DEFAULT_MAX_TOKENS;
|
|
23687
23720
|
const contextLines = opts.contextLines ?? DEFAULT_CONTEXT_LINES;
|
|
@@ -23707,7 +23740,7 @@ async function packSnippets(requests, opts = {}) {
|
|
|
23707
23740
|
return { packed, dropped, totalTokens };
|
|
23708
23741
|
}
|
|
23709
23742
|
async function extractSnippet(req, repoRoot, contextLines = DEFAULT_CONTEXT_LINES) {
|
|
23710
|
-
const absPath = req.filePath.startsWith("/") ? req.filePath :
|
|
23743
|
+
const absPath = req.filePath.startsWith("/") ? req.filePath : join45(repoRoot, req.filePath);
|
|
23711
23744
|
let content;
|
|
23712
23745
|
try {
|
|
23713
23746
|
content = await readFile21(absPath, "utf-8");
|
|
@@ -26441,8 +26474,8 @@ ${marker}` : marker);
|
|
|
26441
26474
|
return;
|
|
26442
26475
|
try {
|
|
26443
26476
|
const { mkdirSync: mkdirSync24, writeFileSync: writeFileSync23 } = __require("node:fs");
|
|
26444
|
-
const { join:
|
|
26445
|
-
const sessionDir =
|
|
26477
|
+
const { join: join70 } = __require("node:path");
|
|
26478
|
+
const sessionDir = join70(this._workingDirectory, ".oa", "session", this._sessionId);
|
|
26446
26479
|
mkdirSync24(sessionDir, { recursive: true });
|
|
26447
26480
|
const checkpoint = {
|
|
26448
26481
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -26455,7 +26488,7 @@ ${marker}` : marker);
|
|
|
26455
26488
|
memexEntryCount: this._memexArchive.size,
|
|
26456
26489
|
fileRegistrySize: this._fileRegistry.size
|
|
26457
26490
|
};
|
|
26458
|
-
writeFileSync23(
|
|
26491
|
+
writeFileSync23(join70(sessionDir, "checkpoint.json"), JSON.stringify(checkpoint, null, 2));
|
|
26459
26492
|
} catch {
|
|
26460
26493
|
}
|
|
26461
26494
|
}
|
|
@@ -27786,7 +27819,7 @@ ${transcript}`
|
|
|
27786
27819
|
// packages/orchestrator/dist/nexusBackend.js
|
|
27787
27820
|
import { existsSync as existsSync30, statSync as statSync10, openSync, readSync, closeSync, unlinkSync as unlinkSync4, writeFileSync as writeFileSync10 } from "node:fs";
|
|
27788
27821
|
import { watch as fsWatch } from "node:fs";
|
|
27789
|
-
import { join as
|
|
27822
|
+
import { join as join46 } from "node:path";
|
|
27790
27823
|
import { tmpdir as tmpdir7 } from "node:os";
|
|
27791
27824
|
import { randomBytes as randomBytes11 } from "node:crypto";
|
|
27792
27825
|
var NexusAgenticBackend;
|
|
@@ -27936,7 +27969,7 @@ var init_nexusBackend = __esm({
|
|
|
27936
27969
|
* Falls back to unary + word-split if streaming setup fails.
|
|
27937
27970
|
*/
|
|
27938
27971
|
async *chatCompletionStream(request) {
|
|
27939
|
-
const streamFile =
|
|
27972
|
+
const streamFile = join46(tmpdir7(), `nexus-stream-${randomBytes11(6).toString("hex")}.jsonl`);
|
|
27940
27973
|
writeFileSync10(streamFile, "", "utf8");
|
|
27941
27974
|
const daemonArgs = {
|
|
27942
27975
|
model: this.model,
|
|
@@ -28973,7 +29006,7 @@ __export(listen_exports, {
|
|
|
28973
29006
|
});
|
|
28974
29007
|
import { spawn as spawn16, execSync as execSync24 } from "node:child_process";
|
|
28975
29008
|
import { existsSync as existsSync31, mkdirSync as mkdirSync10, writeFileSync as writeFileSync11, readdirSync as readdirSync7 } from "node:fs";
|
|
28976
|
-
import { join as
|
|
29009
|
+
import { join as join47, dirname as dirname14 } from "node:path";
|
|
28977
29010
|
import { homedir as homedir10 } from "node:os";
|
|
28978
29011
|
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
28979
29012
|
import { EventEmitter } from "node:events";
|
|
@@ -29059,12 +29092,12 @@ function findMicCaptureCommand() {
|
|
|
29059
29092
|
function findLiveWhisperScript() {
|
|
29060
29093
|
const thisDir = dirname14(fileURLToPath8(import.meta.url));
|
|
29061
29094
|
const candidates = [
|
|
29062
|
-
|
|
29063
|
-
|
|
29064
|
-
|
|
29095
|
+
join47(thisDir, "../../../../packages/execution/scripts/live-whisper.py"),
|
|
29096
|
+
join47(thisDir, "../../../packages/execution/scripts/live-whisper.py"),
|
|
29097
|
+
join47(thisDir, "../../execution/scripts/live-whisper.py"),
|
|
29065
29098
|
// npm install layout — scripts bundled alongside dist
|
|
29066
|
-
|
|
29067
|
-
|
|
29099
|
+
join47(thisDir, "../scripts/live-whisper.py"),
|
|
29100
|
+
join47(thisDir, "../../scripts/live-whisper.py")
|
|
29068
29101
|
];
|
|
29069
29102
|
for (const p of candidates) {
|
|
29070
29103
|
if (existsSync31(p))
|
|
@@ -29077,8 +29110,8 @@ function findLiveWhisperScript() {
|
|
|
29077
29110
|
stdio: ["pipe", "pipe", "pipe"]
|
|
29078
29111
|
}).trim();
|
|
29079
29112
|
const candidates2 = [
|
|
29080
|
-
|
|
29081
|
-
|
|
29113
|
+
join47(globalRoot, "open-agents-ai", "dist", "scripts", "live-whisper.py"),
|
|
29114
|
+
join47(globalRoot, "open-agents-ai", "scripts", "live-whisper.py")
|
|
29082
29115
|
];
|
|
29083
29116
|
for (const p of candidates2) {
|
|
29084
29117
|
if (existsSync31(p))
|
|
@@ -29086,11 +29119,11 @@ function findLiveWhisperScript() {
|
|
|
29086
29119
|
}
|
|
29087
29120
|
} catch {
|
|
29088
29121
|
}
|
|
29089
|
-
const nvmBase =
|
|
29122
|
+
const nvmBase = join47(homedir10(), ".nvm", "versions", "node");
|
|
29090
29123
|
if (existsSync31(nvmBase)) {
|
|
29091
29124
|
try {
|
|
29092
29125
|
for (const ver of readdirSync7(nvmBase)) {
|
|
29093
|
-
const p =
|
|
29126
|
+
const p = join47(nvmBase, ver, "lib", "node_modules", "open-agents-ai", "dist", "scripts", "live-whisper.py");
|
|
29094
29127
|
if (existsSync31(p))
|
|
29095
29128
|
return p;
|
|
29096
29129
|
}
|
|
@@ -29109,7 +29142,7 @@ function ensureTranscribeCliBackground() {
|
|
|
29109
29142
|
timeout: 5e3,
|
|
29110
29143
|
stdio: ["pipe", "pipe", "pipe"]
|
|
29111
29144
|
}).trim();
|
|
29112
|
-
if (existsSync31(
|
|
29145
|
+
if (existsSync31(join47(globalRoot, "transcribe-cli", "dist", "index.js"))) {
|
|
29113
29146
|
return true;
|
|
29114
29147
|
}
|
|
29115
29148
|
} catch {
|
|
@@ -29332,24 +29365,24 @@ var init_listen = __esm({
|
|
|
29332
29365
|
timeout: 5e3,
|
|
29333
29366
|
stdio: ["pipe", "pipe", "pipe"]
|
|
29334
29367
|
}).trim();
|
|
29335
|
-
const tcPath =
|
|
29336
|
-
if (existsSync31(
|
|
29368
|
+
const tcPath = join47(globalRoot, "transcribe-cli");
|
|
29369
|
+
if (existsSync31(join47(tcPath, "dist", "index.js"))) {
|
|
29337
29370
|
const { createRequire: createRequire4 } = await import("node:module");
|
|
29338
29371
|
const req = createRequire4(import.meta.url);
|
|
29339
|
-
return req(
|
|
29372
|
+
return req(join47(tcPath, "dist", "index.js"));
|
|
29340
29373
|
}
|
|
29341
29374
|
} catch {
|
|
29342
29375
|
}
|
|
29343
|
-
const nvmBase =
|
|
29376
|
+
const nvmBase = join47(homedir10(), ".nvm", "versions", "node");
|
|
29344
29377
|
if (existsSync31(nvmBase)) {
|
|
29345
29378
|
try {
|
|
29346
29379
|
const { readdirSync: readdirSync19 } = await import("node:fs");
|
|
29347
29380
|
for (const ver of readdirSync19(nvmBase)) {
|
|
29348
|
-
const tcPath =
|
|
29349
|
-
if (existsSync31(
|
|
29381
|
+
const tcPath = join47(nvmBase, ver, "lib", "node_modules", "transcribe-cli");
|
|
29382
|
+
if (existsSync31(join47(tcPath, "dist", "index.js"))) {
|
|
29350
29383
|
const { createRequire: createRequire4 } = await import("node:module");
|
|
29351
29384
|
const req = createRequire4(import.meta.url);
|
|
29352
|
-
return req(
|
|
29385
|
+
return req(join47(tcPath, "dist", "index.js"));
|
|
29353
29386
|
}
|
|
29354
29387
|
}
|
|
29355
29388
|
} catch {
|
|
@@ -29631,9 +29664,9 @@ transcribe-cli error: ${transcribeCliError}` : "";
|
|
|
29631
29664
|
});
|
|
29632
29665
|
if (outputDir) {
|
|
29633
29666
|
const { basename: basename17 } = await import("node:path");
|
|
29634
|
-
const transcriptDir =
|
|
29667
|
+
const transcriptDir = join47(outputDir, ".oa", "transcripts");
|
|
29635
29668
|
mkdirSync10(transcriptDir, { recursive: true });
|
|
29636
|
-
const outFile =
|
|
29669
|
+
const outFile = join47(transcriptDir, `${basename17(filePath)}.txt`);
|
|
29637
29670
|
writeFileSync11(outFile, result.text, "utf-8");
|
|
29638
29671
|
}
|
|
29639
29672
|
return {
|
|
@@ -34855,7 +34888,7 @@ import { randomBytes as randomBytes12 } from "node:crypto";
|
|
|
34855
34888
|
import { URL as URL2 } from "node:url";
|
|
34856
34889
|
import { loadavg, cpus as cpus2, totalmem as totalmem2, freemem as freemem2 } from "node:os";
|
|
34857
34890
|
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";
|
|
34858
|
-
import { join as
|
|
34891
|
+
import { join as join48 } from "node:path";
|
|
34859
34892
|
function cleanForwardHeaders(raw, targetHost) {
|
|
34860
34893
|
const out = {};
|
|
34861
34894
|
for (const [key, value] of Object.entries(raw)) {
|
|
@@ -34883,7 +34916,7 @@ function fmtTokens(n) {
|
|
|
34883
34916
|
}
|
|
34884
34917
|
function readExposeState(stateDir) {
|
|
34885
34918
|
try {
|
|
34886
|
-
const path =
|
|
34919
|
+
const path = join48(stateDir, STATE_FILE_NAME);
|
|
34887
34920
|
if (!existsSync32(path))
|
|
34888
34921
|
return null;
|
|
34889
34922
|
const raw = readFileSync23(path, "utf8");
|
|
@@ -34898,13 +34931,13 @@ function readExposeState(stateDir) {
|
|
|
34898
34931
|
function writeExposeState(stateDir, state) {
|
|
34899
34932
|
try {
|
|
34900
34933
|
mkdirSync11(stateDir, { recursive: true });
|
|
34901
|
-
writeFileSync12(
|
|
34934
|
+
writeFileSync12(join48(stateDir, STATE_FILE_NAME), JSON.stringify(state, null, 2));
|
|
34902
34935
|
} catch {
|
|
34903
34936
|
}
|
|
34904
34937
|
}
|
|
34905
34938
|
function removeExposeState(stateDir) {
|
|
34906
34939
|
try {
|
|
34907
|
-
unlinkSync5(
|
|
34940
|
+
unlinkSync5(join48(stateDir, STATE_FILE_NAME));
|
|
34908
34941
|
} catch {
|
|
34909
34942
|
}
|
|
34910
34943
|
}
|
|
@@ -34993,7 +35026,7 @@ async function collectSystemMetricsAsync() {
|
|
|
34993
35026
|
}
|
|
34994
35027
|
function readP2PExposeState(stateDir) {
|
|
34995
35028
|
try {
|
|
34996
|
-
const path =
|
|
35029
|
+
const path = join48(stateDir, P2P_STATE_FILE_NAME);
|
|
34997
35030
|
if (!existsSync32(path))
|
|
34998
35031
|
return null;
|
|
34999
35032
|
const raw = readFileSync23(path, "utf8");
|
|
@@ -35008,13 +35041,13 @@ function readP2PExposeState(stateDir) {
|
|
|
35008
35041
|
function writeP2PExposeState(stateDir, state) {
|
|
35009
35042
|
try {
|
|
35010
35043
|
mkdirSync11(stateDir, { recursive: true });
|
|
35011
|
-
writeFileSync12(
|
|
35044
|
+
writeFileSync12(join48(stateDir, P2P_STATE_FILE_NAME), JSON.stringify(state, null, 2));
|
|
35012
35045
|
} catch {
|
|
35013
35046
|
}
|
|
35014
35047
|
}
|
|
35015
35048
|
function removeP2PExposeState(stateDir) {
|
|
35016
35049
|
try {
|
|
35017
|
-
unlinkSync5(
|
|
35050
|
+
unlinkSync5(join48(stateDir, P2P_STATE_FILE_NAME));
|
|
35018
35051
|
} catch {
|
|
35019
35052
|
}
|
|
35020
35053
|
}
|
|
@@ -35862,7 +35895,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
35862
35895
|
throw new Error(`Expose failed: ${exposeResult.error}`);
|
|
35863
35896
|
}
|
|
35864
35897
|
const nexusDir = this._nexusTool.getNexusDir();
|
|
35865
|
-
const statusPath =
|
|
35898
|
+
const statusPath = join48(nexusDir, "status.json");
|
|
35866
35899
|
for (let i = 0; i < 80; i++) {
|
|
35867
35900
|
try {
|
|
35868
35901
|
const raw = readFileSync23(statusPath, "utf8");
|
|
@@ -35896,7 +35929,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
35896
35929
|
});
|
|
35897
35930
|
}
|
|
35898
35931
|
try {
|
|
35899
|
-
const invocDir =
|
|
35932
|
+
const invocDir = join48(nexusDir, "invocations");
|
|
35900
35933
|
if (existsSync32(invocDir)) {
|
|
35901
35934
|
this._prevInvocCount = readdirSync8(invocDir).filter((f) => f.endsWith(".json")).length;
|
|
35902
35935
|
this._stats.totalRequests = this._prevInvocCount;
|
|
@@ -35926,7 +35959,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
35926
35959
|
if (!state)
|
|
35927
35960
|
return null;
|
|
35928
35961
|
const nexusDir = nexusTool.getNexusDir();
|
|
35929
|
-
const statusPath =
|
|
35962
|
+
const statusPath = join48(nexusDir, "status.json");
|
|
35930
35963
|
try {
|
|
35931
35964
|
if (!existsSync32(statusPath)) {
|
|
35932
35965
|
removeP2PExposeState(stateDir);
|
|
@@ -35985,7 +36018,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
35985
36018
|
let lastMeteringLineCount = 0;
|
|
35986
36019
|
this._activityPollTimer = setInterval(() => {
|
|
35987
36020
|
try {
|
|
35988
|
-
const invocDir =
|
|
36021
|
+
const invocDir = join48(nexusDir, "invocations");
|
|
35989
36022
|
if (!existsSync32(invocDir))
|
|
35990
36023
|
return;
|
|
35991
36024
|
const files = readdirSync8(invocDir).filter((f) => f.endsWith(".json"));
|
|
@@ -36001,13 +36034,13 @@ ${this.formatConnectionInfo()}`);
|
|
|
36001
36034
|
let recentActive = 0;
|
|
36002
36035
|
for (const f of files.slice(-10)) {
|
|
36003
36036
|
try {
|
|
36004
|
-
const st = statSync11(
|
|
36037
|
+
const st = statSync11(join48(invocDir, f));
|
|
36005
36038
|
if (now - st.mtimeMs < 1e4)
|
|
36006
36039
|
recentActive++;
|
|
36007
36040
|
} catch {
|
|
36008
36041
|
}
|
|
36009
36042
|
}
|
|
36010
|
-
const meteringFile =
|
|
36043
|
+
const meteringFile = join48(nexusDir, "metering.jsonl");
|
|
36011
36044
|
let meteringLines = lastMeteringLineCount;
|
|
36012
36045
|
try {
|
|
36013
36046
|
if (existsSync32(meteringFile)) {
|
|
@@ -36037,7 +36070,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
36037
36070
|
this._activityPollTimer.unref();
|
|
36038
36071
|
this._pollTimer = setInterval(() => {
|
|
36039
36072
|
try {
|
|
36040
|
-
const statusPath =
|
|
36073
|
+
const statusPath = join48(nexusDir, "status.json");
|
|
36041
36074
|
if (existsSync32(statusPath)) {
|
|
36042
36075
|
const status = JSON.parse(readFileSync23(statusPath, "utf8"));
|
|
36043
36076
|
if (status.peerId && !this._peerId) {
|
|
@@ -36048,7 +36081,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
36048
36081
|
} catch {
|
|
36049
36082
|
}
|
|
36050
36083
|
try {
|
|
36051
|
-
const invocDir =
|
|
36084
|
+
const invocDir = join48(nexusDir, "invocations");
|
|
36052
36085
|
if (existsSync32(invocDir)) {
|
|
36053
36086
|
const files = readdirSync8(invocDir);
|
|
36054
36087
|
const invocCount = files.filter((f) => f.endsWith(".json")).length;
|
|
@@ -36060,7 +36093,7 @@ ${this.formatConnectionInfo()}`);
|
|
|
36060
36093
|
} catch {
|
|
36061
36094
|
}
|
|
36062
36095
|
try {
|
|
36063
|
-
const meteringFile =
|
|
36096
|
+
const meteringFile = join48(nexusDir, "metering.jsonl");
|
|
36064
36097
|
if (existsSync32(meteringFile)) {
|
|
36065
36098
|
const content = readFileSync23(meteringFile, "utf8");
|
|
36066
36099
|
if (content.length > lastMeteringSize) {
|
|
@@ -36272,7 +36305,7 @@ var init_types = __esm({
|
|
|
36272
36305
|
// packages/cli/dist/tui/p2p/secret-vault.js
|
|
36273
36306
|
import { createCipheriv as createCipheriv2, createDecipheriv as createDecipheriv2, randomBytes as randomBytes13, scryptSync as scryptSync2, createHash as createHash2 } from "node:crypto";
|
|
36274
36307
|
import { readFileSync as readFileSync24, writeFileSync as writeFileSync13, existsSync as existsSync33, mkdirSync as mkdirSync12 } from "node:fs";
|
|
36275
|
-
import { join as
|
|
36308
|
+
import { join as join49, dirname as dirname15 } from "node:path";
|
|
36276
36309
|
var PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, CIPHER_ALGO, SALT_LEN, IV_LEN, KEY_LEN, SecretVault;
|
|
36277
36310
|
var init_secret_vault = __esm({
|
|
36278
36311
|
"packages/cli/dist/tui/p2p/secret-vault.js"() {
|
|
@@ -37617,13 +37650,13 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
37617
37650
|
try {
|
|
37618
37651
|
const { NexusTool: NexusTool2 } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
|
|
37619
37652
|
const { existsSync: existsSync50, readFileSync: readFileSync38 } = await import("node:fs");
|
|
37620
|
-
const { join:
|
|
37653
|
+
const { join: join70 } = await import("node:path");
|
|
37621
37654
|
const cwd4 = process.cwd();
|
|
37622
37655
|
const nexusTool = new NexusTool2(cwd4);
|
|
37623
37656
|
const nexusDir = nexusTool.getNexusDir();
|
|
37624
37657
|
let isLocalPeer = false;
|
|
37625
37658
|
try {
|
|
37626
|
-
const statusPath =
|
|
37659
|
+
const statusPath = join70(nexusDir, "status.json");
|
|
37627
37660
|
if (existsSync50(statusPath)) {
|
|
37628
37661
|
const status = JSON.parse(readFileSync38(statusPath, "utf8"));
|
|
37629
37662
|
if (status.peerId === peerId)
|
|
@@ -37632,7 +37665,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
37632
37665
|
} catch {
|
|
37633
37666
|
}
|
|
37634
37667
|
if (isLocalPeer) {
|
|
37635
|
-
const pricingPath =
|
|
37668
|
+
const pricingPath = join70(nexusDir, "pricing.json");
|
|
37636
37669
|
if (existsSync50(pricingPath)) {
|
|
37637
37670
|
try {
|
|
37638
37671
|
const pricing = JSON.parse(readFileSync38(pricingPath, "utf8"));
|
|
@@ -37649,7 +37682,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
37649
37682
|
}
|
|
37650
37683
|
}
|
|
37651
37684
|
}
|
|
37652
|
-
const cachePath =
|
|
37685
|
+
const cachePath = join70(nexusDir, "peer-models-cache.json");
|
|
37653
37686
|
if (existsSync50(cachePath)) {
|
|
37654
37687
|
try {
|
|
37655
37688
|
const cache4 = JSON.parse(readFileSync38(cachePath, "utf8"));
|
|
@@ -37767,7 +37800,7 @@ async function fetchPeerModels(peerId, authKey) {
|
|
|
37767
37800
|
} catch {
|
|
37768
37801
|
}
|
|
37769
37802
|
if (isLocalPeer) {
|
|
37770
|
-
const pricingPath =
|
|
37803
|
+
const pricingPath = join70(nexusDir, "pricing.json");
|
|
37771
37804
|
if (existsSync50(pricingPath)) {
|
|
37772
37805
|
try {
|
|
37773
37806
|
const pricing = JSON.parse(readFileSync38(pricingPath, "utf8"));
|
|
@@ -38051,12 +38084,12 @@ var init_render2 = __esm({
|
|
|
38051
38084
|
|
|
38052
38085
|
// packages/prompts/dist/promptLoader.js
|
|
38053
38086
|
import { readFileSync as readFileSync25, existsSync as existsSync34 } from "node:fs";
|
|
38054
|
-
import { join as
|
|
38087
|
+
import { join as join50, dirname as dirname16 } from "node:path";
|
|
38055
38088
|
import { fileURLToPath as fileURLToPath9 } from "node:url";
|
|
38056
38089
|
function loadPrompt2(promptPath, vars) {
|
|
38057
38090
|
let content = cache2.get(promptPath);
|
|
38058
38091
|
if (content === void 0) {
|
|
38059
|
-
const fullPath =
|
|
38092
|
+
const fullPath = join50(PROMPTS_DIR2, promptPath);
|
|
38060
38093
|
if (!existsSync34(fullPath)) {
|
|
38061
38094
|
throw new Error(`Prompt file not found: ${fullPath}`);
|
|
38062
38095
|
}
|
|
@@ -38073,8 +38106,8 @@ var init_promptLoader2 = __esm({
|
|
|
38073
38106
|
"use strict";
|
|
38074
38107
|
__filename2 = fileURLToPath9(import.meta.url);
|
|
38075
38108
|
__dirname5 = dirname16(__filename2);
|
|
38076
|
-
devPath =
|
|
38077
|
-
publishedPath =
|
|
38109
|
+
devPath = join50(__dirname5, "..", "templates");
|
|
38110
|
+
publishedPath = join50(__dirname5, "..", "prompts", "templates");
|
|
38078
38111
|
PROMPTS_DIR2 = existsSync34(devPath) ? devPath : publishedPath;
|
|
38079
38112
|
cache2 = /* @__PURE__ */ new Map();
|
|
38080
38113
|
}
|
|
@@ -38186,7 +38219,7 @@ var init_task_templates = __esm({
|
|
|
38186
38219
|
});
|
|
38187
38220
|
|
|
38188
38221
|
// packages/prompts/dist/index.js
|
|
38189
|
-
import { join as
|
|
38222
|
+
import { join as join51, dirname as dirname17 } from "node:path";
|
|
38190
38223
|
import { fileURLToPath as fileURLToPath10 } from "node:url";
|
|
38191
38224
|
var _dir, _packageRoot;
|
|
38192
38225
|
var init_dist6 = __esm({
|
|
@@ -38197,7 +38230,7 @@ var init_dist6 = __esm({
|
|
|
38197
38230
|
init_task_templates();
|
|
38198
38231
|
init_render2();
|
|
38199
38232
|
_dir = dirname17(fileURLToPath10(import.meta.url));
|
|
38200
|
-
_packageRoot =
|
|
38233
|
+
_packageRoot = join51(_dir, "..");
|
|
38201
38234
|
}
|
|
38202
38235
|
});
|
|
38203
38236
|
|
|
@@ -38231,15 +38264,15 @@ __export(oa_directory_exports, {
|
|
|
38231
38264
|
writeIndexMeta: () => writeIndexMeta
|
|
38232
38265
|
});
|
|
38233
38266
|
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";
|
|
38234
|
-
import { join as
|
|
38267
|
+
import { join as join52, relative as relative3, basename as basename10, extname as extname9 } from "node:path";
|
|
38235
38268
|
import { homedir as homedir11 } from "node:os";
|
|
38236
38269
|
function initOaDirectory(repoRoot) {
|
|
38237
|
-
const oaPath =
|
|
38270
|
+
const oaPath = join52(repoRoot, OA_DIR);
|
|
38238
38271
|
for (const sub of SUBDIRS) {
|
|
38239
|
-
mkdirSync13(
|
|
38272
|
+
mkdirSync13(join52(oaPath, sub), { recursive: true });
|
|
38240
38273
|
}
|
|
38241
38274
|
try {
|
|
38242
|
-
const gitignorePath =
|
|
38275
|
+
const gitignorePath = join52(repoRoot, ".gitignore");
|
|
38243
38276
|
const settingsPattern = ".oa/settings.json";
|
|
38244
38277
|
if (existsSync35(gitignorePath)) {
|
|
38245
38278
|
const content = readFileSync26(gitignorePath, "utf-8");
|
|
@@ -38252,10 +38285,10 @@ function initOaDirectory(repoRoot) {
|
|
|
38252
38285
|
return oaPath;
|
|
38253
38286
|
}
|
|
38254
38287
|
function hasOaDirectory(repoRoot) {
|
|
38255
|
-
return existsSync35(
|
|
38288
|
+
return existsSync35(join52(repoRoot, OA_DIR, "index"));
|
|
38256
38289
|
}
|
|
38257
38290
|
function loadProjectSettings(repoRoot) {
|
|
38258
|
-
const settingsPath =
|
|
38291
|
+
const settingsPath = join52(repoRoot, OA_DIR, "settings.json");
|
|
38259
38292
|
try {
|
|
38260
38293
|
if (existsSync35(settingsPath)) {
|
|
38261
38294
|
return JSON.parse(readFileSync26(settingsPath, "utf-8"));
|
|
@@ -38265,14 +38298,14 @@ function loadProjectSettings(repoRoot) {
|
|
|
38265
38298
|
return {};
|
|
38266
38299
|
}
|
|
38267
38300
|
function saveProjectSettings(repoRoot, settings) {
|
|
38268
|
-
const oaPath =
|
|
38301
|
+
const oaPath = join52(repoRoot, OA_DIR);
|
|
38269
38302
|
mkdirSync13(oaPath, { recursive: true });
|
|
38270
38303
|
const existing = loadProjectSettings(repoRoot);
|
|
38271
38304
|
const merged = { ...existing, ...settings };
|
|
38272
|
-
writeFileSync14(
|
|
38305
|
+
writeFileSync14(join52(oaPath, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
|
|
38273
38306
|
}
|
|
38274
38307
|
function loadGlobalSettings() {
|
|
38275
|
-
const settingsPath =
|
|
38308
|
+
const settingsPath = join52(homedir11(), ".open-agents", "settings.json");
|
|
38276
38309
|
try {
|
|
38277
38310
|
if (existsSync35(settingsPath)) {
|
|
38278
38311
|
return JSON.parse(readFileSync26(settingsPath, "utf-8"));
|
|
@@ -38282,11 +38315,11 @@ function loadGlobalSettings() {
|
|
|
38282
38315
|
return {};
|
|
38283
38316
|
}
|
|
38284
38317
|
function saveGlobalSettings(settings) {
|
|
38285
|
-
const dir =
|
|
38318
|
+
const dir = join52(homedir11(), ".open-agents");
|
|
38286
38319
|
mkdirSync13(dir, { recursive: true });
|
|
38287
38320
|
const existing = loadGlobalSettings();
|
|
38288
38321
|
const merged = { ...existing, ...settings };
|
|
38289
|
-
writeFileSync14(
|
|
38322
|
+
writeFileSync14(join52(dir, "settings.json"), JSON.stringify(merged, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
|
|
38290
38323
|
}
|
|
38291
38324
|
function resolveSettings(repoRoot) {
|
|
38292
38325
|
const global = loadGlobalSettings();
|
|
@@ -38301,7 +38334,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
|
|
|
38301
38334
|
while (dir && !visited.has(dir)) {
|
|
38302
38335
|
visited.add(dir);
|
|
38303
38336
|
for (const name of CONTEXT_FILES) {
|
|
38304
|
-
const filePath =
|
|
38337
|
+
const filePath = join52(dir, name);
|
|
38305
38338
|
const normalizedName = name.toLowerCase();
|
|
38306
38339
|
if (existsSync35(filePath) && !seen.has(filePath)) {
|
|
38307
38340
|
seen.add(filePath);
|
|
@@ -38320,7 +38353,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
|
|
|
38320
38353
|
}
|
|
38321
38354
|
}
|
|
38322
38355
|
}
|
|
38323
|
-
const projectMap =
|
|
38356
|
+
const projectMap = join52(dir, OA_DIR, "context", "project-map.md");
|
|
38324
38357
|
if (existsSync35(projectMap) && !seen.has(projectMap)) {
|
|
38325
38358
|
seen.add(projectMap);
|
|
38326
38359
|
try {
|
|
@@ -38336,7 +38369,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
|
|
|
38336
38369
|
} catch {
|
|
38337
38370
|
}
|
|
38338
38371
|
}
|
|
38339
|
-
const parent =
|
|
38372
|
+
const parent = join52(dir, "..");
|
|
38340
38373
|
if (parent === dir)
|
|
38341
38374
|
break;
|
|
38342
38375
|
dir = parent;
|
|
@@ -38354,7 +38387,7 @@ function discoverContextFiles(repoRoot, maxContentLen = 8e3) {
|
|
|
38354
38387
|
return found;
|
|
38355
38388
|
}
|
|
38356
38389
|
function readIndexMeta(repoRoot) {
|
|
38357
|
-
const metaPath =
|
|
38390
|
+
const metaPath = join52(repoRoot, OA_DIR, "index", "meta.json");
|
|
38358
38391
|
try {
|
|
38359
38392
|
return JSON.parse(readFileSync26(metaPath, "utf-8"));
|
|
38360
38393
|
} catch {
|
|
@@ -38362,12 +38395,12 @@ function readIndexMeta(repoRoot) {
|
|
|
38362
38395
|
}
|
|
38363
38396
|
}
|
|
38364
38397
|
function writeIndexMeta(repoRoot, meta) {
|
|
38365
|
-
const metaPath =
|
|
38366
|
-
mkdirSync13(
|
|
38398
|
+
const metaPath = join52(repoRoot, OA_DIR, "index", "meta.json");
|
|
38399
|
+
mkdirSync13(join52(repoRoot, OA_DIR, "index"), { recursive: true });
|
|
38367
38400
|
writeFileSync14(metaPath, JSON.stringify(meta, null, 2), "utf-8");
|
|
38368
38401
|
}
|
|
38369
38402
|
function readIndexData(repoRoot, filename) {
|
|
38370
|
-
const filePath =
|
|
38403
|
+
const filePath = join52(repoRoot, OA_DIR, "index", filename);
|
|
38371
38404
|
try {
|
|
38372
38405
|
return JSON.parse(readFileSync26(filePath, "utf-8"));
|
|
38373
38406
|
} catch {
|
|
@@ -38375,8 +38408,8 @@ function readIndexData(repoRoot, filename) {
|
|
|
38375
38408
|
}
|
|
38376
38409
|
}
|
|
38377
38410
|
function writeIndexData(repoRoot, filename, data) {
|
|
38378
|
-
const filePath =
|
|
38379
|
-
mkdirSync13(
|
|
38411
|
+
const filePath = join52(repoRoot, OA_DIR, "index", filename);
|
|
38412
|
+
mkdirSync13(join52(repoRoot, OA_DIR, "index"), { recursive: true });
|
|
38380
38413
|
writeFileSync14(filePath, JSON.stringify(data, null, 2), "utf-8");
|
|
38381
38414
|
}
|
|
38382
38415
|
function generateProjectMap(repoRoot) {
|
|
@@ -38425,28 +38458,28 @@ ${tree}\`\`\`
|
|
|
38425
38458
|
sections.push("");
|
|
38426
38459
|
}
|
|
38427
38460
|
const content = sections.join("\n");
|
|
38428
|
-
const contextDir =
|
|
38461
|
+
const contextDir = join52(repoRoot, OA_DIR, "context");
|
|
38429
38462
|
mkdirSync13(contextDir, { recursive: true });
|
|
38430
|
-
writeFileSync14(
|
|
38463
|
+
writeFileSync14(join52(contextDir, "project-map.md"), content, "utf-8");
|
|
38431
38464
|
return content;
|
|
38432
38465
|
}
|
|
38433
38466
|
function saveSession(repoRoot, session) {
|
|
38434
|
-
const historyDir =
|
|
38467
|
+
const historyDir = join52(repoRoot, OA_DIR, "history");
|
|
38435
38468
|
mkdirSync13(historyDir, { recursive: true });
|
|
38436
|
-
writeFileSync14(
|
|
38469
|
+
writeFileSync14(join52(historyDir, `${session.id}.json`), JSON.stringify(session, null, 2), "utf-8");
|
|
38437
38470
|
}
|
|
38438
38471
|
function loadRecentSessions(repoRoot, limit = 5) {
|
|
38439
|
-
const historyDir =
|
|
38472
|
+
const historyDir = join52(repoRoot, OA_DIR, "history");
|
|
38440
38473
|
if (!existsSync35(historyDir))
|
|
38441
38474
|
return [];
|
|
38442
38475
|
try {
|
|
38443
38476
|
const files = readdirSync9(historyDir).filter((f) => f.endsWith(".json") && f !== "pending-task.json").map((f) => {
|
|
38444
|
-
const stat5 = statSync12(
|
|
38477
|
+
const stat5 = statSync12(join52(historyDir, f));
|
|
38445
38478
|
return { file: f, mtime: stat5.mtimeMs };
|
|
38446
38479
|
}).sort((a, b) => b.mtime - a.mtime).slice(0, limit);
|
|
38447
38480
|
return files.map((f) => {
|
|
38448
38481
|
try {
|
|
38449
|
-
return JSON.parse(readFileSync26(
|
|
38482
|
+
return JSON.parse(readFileSync26(join52(historyDir, f.file), "utf-8"));
|
|
38450
38483
|
} catch {
|
|
38451
38484
|
return null;
|
|
38452
38485
|
}
|
|
@@ -38456,12 +38489,12 @@ function loadRecentSessions(repoRoot, limit = 5) {
|
|
|
38456
38489
|
}
|
|
38457
38490
|
}
|
|
38458
38491
|
function savePendingTask(repoRoot, task) {
|
|
38459
|
-
const historyDir =
|
|
38492
|
+
const historyDir = join52(repoRoot, OA_DIR, "history");
|
|
38460
38493
|
mkdirSync13(historyDir, { recursive: true });
|
|
38461
|
-
writeFileSync14(
|
|
38494
|
+
writeFileSync14(join52(historyDir, PENDING_TASK_FILE), JSON.stringify(task, null, 2) + "\n", "utf-8");
|
|
38462
38495
|
}
|
|
38463
38496
|
function loadPendingTask(repoRoot) {
|
|
38464
|
-
const filePath =
|
|
38497
|
+
const filePath = join52(repoRoot, OA_DIR, "history", PENDING_TASK_FILE);
|
|
38465
38498
|
try {
|
|
38466
38499
|
if (!existsSync35(filePath))
|
|
38467
38500
|
return null;
|
|
@@ -38476,9 +38509,9 @@ function loadPendingTask(repoRoot) {
|
|
|
38476
38509
|
}
|
|
38477
38510
|
}
|
|
38478
38511
|
function saveSessionContext(repoRoot, entry) {
|
|
38479
|
-
const contextDir =
|
|
38512
|
+
const contextDir = join52(repoRoot, OA_DIR, "context");
|
|
38480
38513
|
mkdirSync13(contextDir, { recursive: true });
|
|
38481
|
-
const filePath =
|
|
38514
|
+
const filePath = join52(contextDir, CONTEXT_SAVE_FILE);
|
|
38482
38515
|
let ctx;
|
|
38483
38516
|
try {
|
|
38484
38517
|
if (existsSync35(filePath)) {
|
|
@@ -38497,7 +38530,7 @@ function saveSessionContext(repoRoot, entry) {
|
|
|
38497
38530
|
writeFileSync14(filePath, JSON.stringify(ctx, null, 2) + "\n", "utf-8");
|
|
38498
38531
|
}
|
|
38499
38532
|
function loadSessionContext(repoRoot) {
|
|
38500
|
-
const filePath =
|
|
38533
|
+
const filePath = join52(repoRoot, OA_DIR, "context", CONTEXT_SAVE_FILE);
|
|
38501
38534
|
try {
|
|
38502
38535
|
if (!existsSync35(filePath))
|
|
38503
38536
|
return null;
|
|
@@ -38547,7 +38580,7 @@ function detectManifests(repoRoot) {
|
|
|
38547
38580
|
{ file: "docker-compose.yaml", type: "Docker Compose" }
|
|
38548
38581
|
];
|
|
38549
38582
|
for (const check of checks) {
|
|
38550
|
-
const filePath =
|
|
38583
|
+
const filePath = join52(repoRoot, check.file);
|
|
38551
38584
|
if (existsSync35(filePath)) {
|
|
38552
38585
|
let name;
|
|
38553
38586
|
if (check.nameField) {
|
|
@@ -38581,7 +38614,7 @@ function findKeyFiles(repoRoot) {
|
|
|
38581
38614
|
{ pattern: "CLAUDE.md", description: "Claude Code context" }
|
|
38582
38615
|
];
|
|
38583
38616
|
for (const check of checks) {
|
|
38584
|
-
if (existsSync35(
|
|
38617
|
+
if (existsSync35(join52(repoRoot, check.pattern))) {
|
|
38585
38618
|
keyFiles.push({ path: check.pattern, description: check.description });
|
|
38586
38619
|
}
|
|
38587
38620
|
}
|
|
@@ -38607,12 +38640,12 @@ function buildDirTree(root, maxDepth, prefix = "", depth = 0) {
|
|
|
38607
38640
|
if (entry.isDirectory()) {
|
|
38608
38641
|
let fileCount = 0;
|
|
38609
38642
|
try {
|
|
38610
|
-
fileCount = readdirSync9(
|
|
38643
|
+
fileCount = readdirSync9(join52(root, entry.name)).filter((f) => !f.startsWith(".")).length;
|
|
38611
38644
|
} catch {
|
|
38612
38645
|
}
|
|
38613
38646
|
result += `${prefix}${connector}${entry.name}/ (${fileCount})
|
|
38614
38647
|
`;
|
|
38615
|
-
result += buildDirTree(
|
|
38648
|
+
result += buildDirTree(join52(root, entry.name), maxDepth, childPrefix, depth + 1);
|
|
38616
38649
|
} else if (depth < maxDepth) {
|
|
38617
38650
|
result += `${prefix}${connector}${entry.name}
|
|
38618
38651
|
`;
|
|
@@ -38632,7 +38665,7 @@ function loadUsageFile(filePath) {
|
|
|
38632
38665
|
return { records: [] };
|
|
38633
38666
|
}
|
|
38634
38667
|
function saveUsageFile(filePath, data) {
|
|
38635
|
-
const dir =
|
|
38668
|
+
const dir = join52(filePath, "..");
|
|
38636
38669
|
mkdirSync13(dir, { recursive: true });
|
|
38637
38670
|
writeFileSync14(filePath, JSON.stringify(data, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
|
|
38638
38671
|
}
|
|
@@ -38662,15 +38695,15 @@ function recordUsage(kind, value, opts) {
|
|
|
38662
38695
|
}
|
|
38663
38696
|
saveUsageFile(filePath, data);
|
|
38664
38697
|
};
|
|
38665
|
-
update(
|
|
38698
|
+
update(join52(homedir11(), ".open-agents", USAGE_HISTORY_FILE));
|
|
38666
38699
|
if (opts?.repoRoot) {
|
|
38667
|
-
update(
|
|
38700
|
+
update(join52(opts.repoRoot, OA_DIR, USAGE_HISTORY_FILE));
|
|
38668
38701
|
}
|
|
38669
38702
|
}
|
|
38670
38703
|
function loadUsageHistory(kind, repoRoot) {
|
|
38671
|
-
const globalPath =
|
|
38704
|
+
const globalPath = join52(homedir11(), ".open-agents", USAGE_HISTORY_FILE);
|
|
38672
38705
|
const globalData = loadUsageFile(globalPath);
|
|
38673
|
-
const localData = repoRoot ? loadUsageFile(
|
|
38706
|
+
const localData = repoRoot ? loadUsageFile(join52(repoRoot, OA_DIR, USAGE_HISTORY_FILE)) : { records: [] };
|
|
38674
38707
|
const map = /* @__PURE__ */ new Map();
|
|
38675
38708
|
for (const r of globalData.records) {
|
|
38676
38709
|
if (r.kind !== kind)
|
|
@@ -38701,9 +38734,9 @@ function deleteUsageRecord(kind, value, repoRoot) {
|
|
|
38701
38734
|
saveUsageFile(filePath, data);
|
|
38702
38735
|
}
|
|
38703
38736
|
};
|
|
38704
|
-
remove(
|
|
38737
|
+
remove(join52(homedir11(), ".open-agents", USAGE_HISTORY_FILE));
|
|
38705
38738
|
if (repoRoot) {
|
|
38706
|
-
remove(
|
|
38739
|
+
remove(join52(repoRoot, OA_DIR, USAGE_HISTORY_FILE));
|
|
38707
38740
|
}
|
|
38708
38741
|
}
|
|
38709
38742
|
var OA_DIR, SUBDIRS, CONTEXT_FILES, PENDING_TASK_FILE, CONTEXT_SAVE_FILE, MAX_CONTEXT_ENTRIES, SKIP_DIRS, USAGE_HISTORY_FILE, MAX_HISTORY_RECORDS;
|
|
@@ -38754,7 +38787,7 @@ import * as readline from "node:readline";
|
|
|
38754
38787
|
import { execSync as execSync26, spawn as spawn19, exec as exec2 } from "node:child_process";
|
|
38755
38788
|
import { promisify as promisify6 } from "node:util";
|
|
38756
38789
|
import { existsSync as existsSync36, writeFileSync as writeFileSync15, readFileSync as readFileSync27, appendFileSync as appendFileSync2, mkdirSync as mkdirSync14 } from "node:fs";
|
|
38757
|
-
import { join as
|
|
38790
|
+
import { join as join53 } from "node:path";
|
|
38758
38791
|
import { homedir as homedir12, platform as platform2 } from "node:os";
|
|
38759
38792
|
function detectSystemSpecs() {
|
|
38760
38793
|
let totalRamGB = 0;
|
|
@@ -39795,9 +39828,9 @@ async function doSetup(config, rl) {
|
|
|
39795
39828
|
`PARAMETER num_predict ${numPredict}`,
|
|
39796
39829
|
`PARAMETER stop "<|endoftext|>"`
|
|
39797
39830
|
].join("\n");
|
|
39798
|
-
const modelDir2 =
|
|
39831
|
+
const modelDir2 = join53(homedir12(), ".open-agents", "models");
|
|
39799
39832
|
mkdirSync14(modelDir2, { recursive: true });
|
|
39800
|
-
const modelfilePath =
|
|
39833
|
+
const modelfilePath = join53(modelDir2, `Modelfile.${customName}`);
|
|
39801
39834
|
writeFileSync15(modelfilePath, modelfileContent + "\n", "utf8");
|
|
39802
39835
|
process.stdout.write(` ${c2.dim("Creating model...")} `);
|
|
39803
39836
|
execSync26(`ollama create ${customName} -f ${modelfilePath}`, {
|
|
@@ -39843,7 +39876,7 @@ async function isModelAvailable(config) {
|
|
|
39843
39876
|
}
|
|
39844
39877
|
function isFirstRun() {
|
|
39845
39878
|
try {
|
|
39846
|
-
return !existsSync36(
|
|
39879
|
+
return !existsSync36(join53(homedir12(), ".open-agents", "config.json"));
|
|
39847
39880
|
} catch {
|
|
39848
39881
|
return true;
|
|
39849
39882
|
}
|
|
@@ -39880,7 +39913,7 @@ function detectPkgManager() {
|
|
|
39880
39913
|
return null;
|
|
39881
39914
|
}
|
|
39882
39915
|
function getVenvDir() {
|
|
39883
|
-
return
|
|
39916
|
+
return join53(homedir12(), ".open-agents", "venv");
|
|
39884
39917
|
}
|
|
39885
39918
|
function hasVenvModule() {
|
|
39886
39919
|
try {
|
|
@@ -39892,22 +39925,25 @@ function hasVenvModule() {
|
|
|
39892
39925
|
}
|
|
39893
39926
|
function ensureVenv(log) {
|
|
39894
39927
|
const venvDir = getVenvDir();
|
|
39895
|
-
const
|
|
39896
|
-
|
|
39928
|
+
const isWin2 = process.platform === "win32";
|
|
39929
|
+
const pipPath = isWin2 ? join53(venvDir, "Scripts", "pip.exe") : join53(venvDir, "bin", "pip");
|
|
39930
|
+
const pythonCmd = isWin2 ? "python" : "python3";
|
|
39931
|
+
if (existsSync36(pipPath))
|
|
39897
39932
|
return venvDir;
|
|
39898
39933
|
log("Creating Python venv for vision deps...");
|
|
39899
|
-
if (!hasCmd("python3")) {
|
|
39900
|
-
log(
|
|
39934
|
+
if (!hasCmd(pythonCmd) && !hasCmd("python3")) {
|
|
39935
|
+
log(`${pythonCmd} not found \u2014 cannot create venv.`);
|
|
39901
39936
|
return null;
|
|
39902
39937
|
}
|
|
39903
|
-
if (!hasVenvModule()) {
|
|
39938
|
+
if (!isWin2 && !hasVenvModule()) {
|
|
39904
39939
|
log("python3 venv module not available \u2014 venv creation skipped.");
|
|
39905
39940
|
return null;
|
|
39906
39941
|
}
|
|
39907
39942
|
try {
|
|
39908
|
-
mkdirSync14(
|
|
39909
|
-
|
|
39910
|
-
execSync26(
|
|
39943
|
+
mkdirSync14(join53(homedir12(), ".open-agents"), { recursive: true });
|
|
39944
|
+
const pyCmd = hasCmd(pythonCmd) ? pythonCmd : "python3";
|
|
39945
|
+
execSync26(`${pyCmd} -m venv "${venvDir}"`, { stdio: "pipe", timeout: 3e4 });
|
|
39946
|
+
execSync26(`"${pipPath}" install --upgrade pip`, {
|
|
39911
39947
|
stdio: "pipe",
|
|
39912
39948
|
timeout: 6e4
|
|
39913
39949
|
});
|
|
@@ -40098,19 +40134,19 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
40098
40134
|
}
|
|
40099
40135
|
}
|
|
40100
40136
|
const venvDir = getVenvDir();
|
|
40101
|
-
const venvBin =
|
|
40102
|
-
const venvMoondream =
|
|
40137
|
+
const venvBin = join53(venvDir, "bin");
|
|
40138
|
+
const venvMoondream = join53(venvBin, "moondream-station");
|
|
40103
40139
|
const venv = ensureVenv(log);
|
|
40104
40140
|
if (venv && !hasCmd("moondream-station") && !existsSync36(venvMoondream)) {
|
|
40105
|
-
const
|
|
40141
|
+
const venvPip2 = join53(venvBin, "pip");
|
|
40106
40142
|
log("Installing moondream-station in ~/.open-agents/venv...");
|
|
40107
40143
|
try {
|
|
40108
|
-
execSync26(`"${
|
|
40144
|
+
execSync26(`"${venvPip2}" install moondream-station`, { stdio: "pipe", timeout: 3e5 });
|
|
40109
40145
|
if (existsSync36(venvMoondream)) {
|
|
40110
40146
|
log("moondream-station installed successfully.");
|
|
40111
40147
|
} else {
|
|
40112
40148
|
try {
|
|
40113
|
-
const check = execSync26(`"${
|
|
40149
|
+
const check = execSync26(`"${venvPip2}" show moondream-station`, { encoding: "utf8", stdio: "pipe", timeout: 5e3 });
|
|
40114
40150
|
if (check.includes("moondream")) {
|
|
40115
40151
|
log("moondream-station package installed.");
|
|
40116
40152
|
}
|
|
@@ -40123,11 +40159,11 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
40123
40159
|
}
|
|
40124
40160
|
}
|
|
40125
40161
|
if (venv) {
|
|
40126
|
-
const
|
|
40127
|
-
const venvPip2 =
|
|
40162
|
+
const venvPython2 = join53(venvBin, "python");
|
|
40163
|
+
const venvPip2 = join53(venvBin, "pip");
|
|
40128
40164
|
let ocrStackInstalled = false;
|
|
40129
40165
|
try {
|
|
40130
|
-
execSync26(`"${
|
|
40166
|
+
execSync26(`"${venvPython2}" -c "import cv2, pytesseract, numpy, PIL"`, { stdio: "pipe", timeout: 1e4 });
|
|
40131
40167
|
ocrStackInstalled = true;
|
|
40132
40168
|
} catch {
|
|
40133
40169
|
}
|
|
@@ -40137,7 +40173,7 @@ async function ensureVisionDeps(onInfo, getSudoPassword) {
|
|
|
40137
40173
|
try {
|
|
40138
40174
|
execSync26(`"${venvPip2}" install ${ocrPackages}`, { stdio: "pipe", timeout: 3e5 });
|
|
40139
40175
|
try {
|
|
40140
|
-
execSync26(`"${
|
|
40176
|
+
execSync26(`"${venvPython2}" -c "import cv2, pytesseract, numpy, PIL"`, { stdio: "pipe", timeout: 1e4 });
|
|
40141
40177
|
log("OCR Python stack installed successfully.");
|
|
40142
40178
|
} catch {
|
|
40143
40179
|
log("OCR Python stack install completed but import verification failed.");
|
|
@@ -40268,9 +40304,9 @@ async function createExpandedVariantAsync(baseModel, specs, sizeGB, kvBytesPerTo
|
|
|
40268
40304
|
`PARAMETER num_predict ${numPredict}`,
|
|
40269
40305
|
`PARAMETER stop "<|endoftext|>"`
|
|
40270
40306
|
].join("\n");
|
|
40271
|
-
const modelDir2 =
|
|
40307
|
+
const modelDir2 = join53(homedir12(), ".open-agents", "models");
|
|
40272
40308
|
mkdirSync14(modelDir2, { recursive: true });
|
|
40273
|
-
const modelfilePath =
|
|
40309
|
+
const modelfilePath = join53(modelDir2, `Modelfile.${customName}`);
|
|
40274
40310
|
writeFileSync15(modelfilePath, modelfileContent + "\n", "utf8");
|
|
40275
40311
|
await execAsync(`ollama create ${customName} -f ${modelfilePath}`, {
|
|
40276
40312
|
timeout: 12e4
|
|
@@ -40345,8 +40381,8 @@ async function ensureNeovim() {
|
|
|
40345
40381
|
const platform6 = process.platform;
|
|
40346
40382
|
const arch2 = process.arch;
|
|
40347
40383
|
if (platform6 === "linux") {
|
|
40348
|
-
const binDir =
|
|
40349
|
-
const nvimDest =
|
|
40384
|
+
const binDir = join53(homedir12(), ".local", "bin");
|
|
40385
|
+
const nvimDest = join53(binDir, "nvim");
|
|
40350
40386
|
try {
|
|
40351
40387
|
mkdirSync14(binDir, { recursive: true });
|
|
40352
40388
|
} catch {
|
|
@@ -40417,7 +40453,7 @@ async function ensureNeovim() {
|
|
|
40417
40453
|
}
|
|
40418
40454
|
function ensurePathInShellRc(binDir) {
|
|
40419
40455
|
const shell = process.env.SHELL ?? "";
|
|
40420
|
-
const rcFile = shell.includes("zsh") ?
|
|
40456
|
+
const rcFile = shell.includes("zsh") ? join53(homedir12(), ".zshrc") : join53(homedir12(), ".bashrc");
|
|
40421
40457
|
try {
|
|
40422
40458
|
const rcContent = existsSync36(rcFile) ? readFileSync27(rcFile, "utf8") : "";
|
|
40423
40459
|
if (rcContent.includes(binDir))
|
|
@@ -41322,7 +41358,7 @@ var init_drop_panel = __esm({
|
|
|
41322
41358
|
// packages/cli/dist/tui/neovim-mode.js
|
|
41323
41359
|
import { existsSync as existsSync38, unlinkSync as unlinkSync7 } from "node:fs";
|
|
41324
41360
|
import { tmpdir as tmpdir8 } from "node:os";
|
|
41325
|
-
import { join as
|
|
41361
|
+
import { join as join54 } from "node:path";
|
|
41326
41362
|
import { execSync as execSync27 } from "node:child_process";
|
|
41327
41363
|
function isNeovimActive() {
|
|
41328
41364
|
return _state !== null && !_state.cleanedUp;
|
|
@@ -41370,7 +41406,7 @@ async function startNeovimMode(opts) {
|
|
|
41370
41406
|
);
|
|
41371
41407
|
} catch {
|
|
41372
41408
|
}
|
|
41373
|
-
const socketPath =
|
|
41409
|
+
const socketPath = join54(tmpdir8(), `oa-nvim-${process.pid}-${Date.now()}.sock`);
|
|
41374
41410
|
try {
|
|
41375
41411
|
if (existsSync38(socketPath))
|
|
41376
41412
|
unlinkSync7(socketPath);
|
|
@@ -41800,7 +41836,7 @@ __export(voice_exports, {
|
|
|
41800
41836
|
resetNarrationContext: () => resetNarrationContext
|
|
41801
41837
|
});
|
|
41802
41838
|
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";
|
|
41803
|
-
import { join as
|
|
41839
|
+
import { join as join55, dirname as dirname18 } from "node:path";
|
|
41804
41840
|
import { homedir as homedir13, tmpdir as tmpdir9, platform as platform3 } from "node:os";
|
|
41805
41841
|
import { execSync as execSync28, spawn as nodeSpawn } from "node:child_process";
|
|
41806
41842
|
import { createRequire } from "node:module";
|
|
@@ -41825,34 +41861,34 @@ function listVoiceModels() {
|
|
|
41825
41861
|
}));
|
|
41826
41862
|
}
|
|
41827
41863
|
function voiceDir() {
|
|
41828
|
-
return
|
|
41864
|
+
return join55(homedir13(), ".open-agents", "voice");
|
|
41829
41865
|
}
|
|
41830
41866
|
function modelsDir() {
|
|
41831
|
-
return
|
|
41867
|
+
return join55(voiceDir(), "models");
|
|
41832
41868
|
}
|
|
41833
41869
|
function modelDir(id) {
|
|
41834
|
-
return
|
|
41870
|
+
return join55(modelsDir(), id);
|
|
41835
41871
|
}
|
|
41836
41872
|
function modelOnnxPath(id) {
|
|
41837
|
-
return
|
|
41873
|
+
return join55(modelDir(id), "model.onnx");
|
|
41838
41874
|
}
|
|
41839
41875
|
function modelConfigPath(id) {
|
|
41840
|
-
return
|
|
41876
|
+
return join55(modelDir(id), "config.json");
|
|
41841
41877
|
}
|
|
41842
41878
|
function luxttsVenvDir() {
|
|
41843
|
-
return
|
|
41879
|
+
return join55(voiceDir(), "luxtts-venv");
|
|
41844
41880
|
}
|
|
41845
41881
|
function luxttsVenvPy() {
|
|
41846
|
-
return platform3() === "win32" ?
|
|
41882
|
+
return platform3() === "win32" ? join55(luxttsVenvDir(), "Scripts", "python.exe") : join55(luxttsVenvDir(), "bin", "python3");
|
|
41847
41883
|
}
|
|
41848
41884
|
function luxttsRepoDir() {
|
|
41849
|
-
return
|
|
41885
|
+
return join55(voiceDir(), "LuxTTS");
|
|
41850
41886
|
}
|
|
41851
41887
|
function luxttsCloneRefsDir() {
|
|
41852
|
-
return
|
|
41888
|
+
return join55(voiceDir(), "clone-refs");
|
|
41853
41889
|
}
|
|
41854
41890
|
function luxttsInferScript() {
|
|
41855
|
-
return
|
|
41891
|
+
return join55(voiceDir(), "luxtts-infer.py");
|
|
41856
41892
|
}
|
|
41857
41893
|
function writeDetectTorchScript(targetPath) {
|
|
41858
41894
|
if (existsSync39(targetPath))
|
|
@@ -42741,7 +42777,7 @@ var init_voice = __esm({
|
|
|
42741
42777
|
const refsDir = luxttsCloneRefsDir();
|
|
42742
42778
|
const targets = ["glados", "overwatch"];
|
|
42743
42779
|
for (const modelId of targets) {
|
|
42744
|
-
const refFile =
|
|
42780
|
+
const refFile = join55(refsDir, `${modelId}-ref.wav`);
|
|
42745
42781
|
if (existsSync39(refFile))
|
|
42746
42782
|
continue;
|
|
42747
42783
|
try {
|
|
@@ -42821,7 +42857,7 @@ var init_voice = __esm({
|
|
|
42821
42857
|
}
|
|
42822
42858
|
p = p.replace(/\\ /g, " ");
|
|
42823
42859
|
if (p.startsWith("~/") || p === "~") {
|
|
42824
|
-
p =
|
|
42860
|
+
p = join55(homedir13(), p.slice(1));
|
|
42825
42861
|
}
|
|
42826
42862
|
if (!existsSync39(p)) {
|
|
42827
42863
|
return `File not found: ${p}
|
|
@@ -42835,7 +42871,7 @@ var init_voice = __esm({
|
|
|
42835
42871
|
const srcName = (audioPath.split("/").pop() ?? "clone").replace(/\.[^.]+$/, "").replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
42836
42872
|
const ts = Date.now().toString(36);
|
|
42837
42873
|
const destFilename = `clone-${srcName}-${ts}.${ext}`;
|
|
42838
|
-
const destPath =
|
|
42874
|
+
const destPath = join55(refsDir, destFilename);
|
|
42839
42875
|
try {
|
|
42840
42876
|
const data = readFileSync28(audioPath);
|
|
42841
42877
|
writeFileSync16(destPath, data);
|
|
@@ -42880,7 +42916,7 @@ var init_voice = __esm({
|
|
|
42880
42916
|
const refsDir = luxttsCloneRefsDir();
|
|
42881
42917
|
if (!existsSync39(refsDir))
|
|
42882
42918
|
mkdirSync15(refsDir, { recursive: true });
|
|
42883
|
-
const destPath =
|
|
42919
|
+
const destPath = join55(refsDir, `${sourceModelId}-ref.wav`);
|
|
42884
42920
|
const sampleRate = this.config?.audio?.sample_rate ?? 22050;
|
|
42885
42921
|
this.writeWav(audioData, sampleRate, destPath);
|
|
42886
42922
|
this.luxttsCloneRef = destPath;
|
|
@@ -42896,7 +42932,7 @@ var init_voice = __esm({
|
|
|
42896
42932
|
// -------------------------------------------------------------------------
|
|
42897
42933
|
/** Metadata file for friendly names of clone refs */
|
|
42898
42934
|
static cloneMetaFile() {
|
|
42899
|
-
return
|
|
42935
|
+
return join55(luxttsCloneRefsDir(), "meta.json");
|
|
42900
42936
|
}
|
|
42901
42937
|
loadCloneMeta() {
|
|
42902
42938
|
const p = _VoiceEngine.cloneMetaFile();
|
|
@@ -42930,7 +42966,7 @@ var init_voice = __esm({
|
|
|
42930
42966
|
return _VoiceEngine.AUDIO_EXTS.has(ext);
|
|
42931
42967
|
});
|
|
42932
42968
|
return files.map((f) => {
|
|
42933
|
-
const p =
|
|
42969
|
+
const p = join55(dir, f);
|
|
42934
42970
|
let size = 0;
|
|
42935
42971
|
try {
|
|
42936
42972
|
size = statSync13(p).size;
|
|
@@ -42947,7 +42983,7 @@ var init_voice = __esm({
|
|
|
42947
42983
|
}
|
|
42948
42984
|
/** Delete a clone reference file by filename. Returns true if deleted. */
|
|
42949
42985
|
deleteCloneRef(filename) {
|
|
42950
|
-
const p =
|
|
42986
|
+
const p = join55(luxttsCloneRefsDir(), filename);
|
|
42951
42987
|
if (!existsSync39(p))
|
|
42952
42988
|
return false;
|
|
42953
42989
|
try {
|
|
@@ -42972,7 +43008,7 @@ var init_voice = __esm({
|
|
|
42972
43008
|
}
|
|
42973
43009
|
/** Set the active clone reference by filename. */
|
|
42974
43010
|
setActiveCloneRef(filename) {
|
|
42975
|
-
const p =
|
|
43011
|
+
const p = join55(luxttsCloneRefsDir(), filename);
|
|
42976
43012
|
if (!existsSync39(p))
|
|
42977
43013
|
return `File not found: ${filename}`;
|
|
42978
43014
|
this.luxttsCloneRef = p;
|
|
@@ -43298,7 +43334,7 @@ var init_voice = __esm({
|
|
|
43298
43334
|
}
|
|
43299
43335
|
this.onPCMOutput(Buffer.from(int16.buffer), sampleRate);
|
|
43300
43336
|
}
|
|
43301
|
-
const wavPath =
|
|
43337
|
+
const wavPath = join55(tmpdir9(), `oa-voice-${Date.now()}.wav`);
|
|
43302
43338
|
this.writeStereoWav(stereo.left, stereo.right, sampleRate, wavPath);
|
|
43303
43339
|
await this.playWav(wavPath);
|
|
43304
43340
|
try {
|
|
@@ -43691,7 +43727,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
43691
43727
|
const mlxModelId = model.mlxModelId ?? "mlx-community/Kokoro-82M-bf16";
|
|
43692
43728
|
const mlxVoice = model.mlxVoice ?? "af_heart";
|
|
43693
43729
|
const mlxLangCode = model.mlxLangCode ?? "a";
|
|
43694
|
-
const wavPath =
|
|
43730
|
+
const wavPath = join55(tmpdir9(), `oa-mlx-${Date.now()}.wav`);
|
|
43695
43731
|
const pyScript = [
|
|
43696
43732
|
"import sys, json",
|
|
43697
43733
|
"from mlx_audio.tts import generate as tts_gen",
|
|
@@ -43759,7 +43795,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
43759
43795
|
const mlxModelId = model.mlxModelId ?? "mlx-community/Kokoro-82M-bf16";
|
|
43760
43796
|
const mlxVoice = model.mlxVoice ?? "af_heart";
|
|
43761
43797
|
const mlxLangCode = model.mlxLangCode ?? "a";
|
|
43762
|
-
const wavPath =
|
|
43798
|
+
const wavPath = join55(tmpdir9(), `oa-mlx-buf-${Date.now()}.wav`);
|
|
43763
43799
|
const pyScript = [
|
|
43764
43800
|
"import sys, json",
|
|
43765
43801
|
"from mlx_audio.tts import generate as tts_gen",
|
|
@@ -43816,7 +43852,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
43816
43852
|
if (torchCheck === "cpu") {
|
|
43817
43853
|
renderWarning("GPU detected but PyTorch is CPU-only. Reinstalling with CUDA support in background...");
|
|
43818
43854
|
try {
|
|
43819
|
-
const detectScript =
|
|
43855
|
+
const detectScript = join55(voiceDir(), "detect-torch.py");
|
|
43820
43856
|
writeDetectTorchScript(detectScript);
|
|
43821
43857
|
let pipArgs = `torch torchaudio --index-url https://download.pytorch.org/whl/cu124`;
|
|
43822
43858
|
try {
|
|
@@ -43850,7 +43886,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
43850
43886
|
}
|
|
43851
43887
|
}
|
|
43852
43888
|
{
|
|
43853
|
-
const detectScript =
|
|
43889
|
+
const detectScript = join55(voiceDir(), "detect-torch.py");
|
|
43854
43890
|
writeDetectTorchScript(detectScript);
|
|
43855
43891
|
let pipArgsStr = "torch torchaudio";
|
|
43856
43892
|
let torchDesc = "unknown platform";
|
|
@@ -43887,11 +43923,12 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
43887
43923
|
}
|
|
43888
43924
|
}
|
|
43889
43925
|
const repoDir = luxttsRepoDir();
|
|
43890
|
-
if (!existsSync39(
|
|
43926
|
+
if (!existsSync39(join55(repoDir, "zipvoice", "luxvoice.py"))) {
|
|
43891
43927
|
renderInfo(" Cloning LuxTTS repository...");
|
|
43892
43928
|
try {
|
|
43893
43929
|
if (existsSync39(repoDir)) {
|
|
43894
|
-
|
|
43930
|
+
const rmCmd = process.platform === "win32" ? `rmdir /s /q ${JSON.stringify(repoDir)}` : `rm -rf ${JSON.stringify(repoDir)}`;
|
|
43931
|
+
await this.asyncShell(rmCmd, 3e4);
|
|
43895
43932
|
}
|
|
43896
43933
|
await this.asyncShell(`git clone --depth 1 https://github.com/ysharma3501/LuxTTS.git ${JSON.stringify(repoDir)}`, 12e4);
|
|
43897
43934
|
} catch (err) {
|
|
@@ -43938,17 +43975,23 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
43938
43975
|
{ cmd: `${pipCmd} -m pip install --quiet torch --index-url https://developer.download.nvidia.com/compute/redist/jp/v60/pytorch/ 2>/dev/null || ${pipCmd} -m pip install --quiet torch`, fatal: true, label: "PyTorch (Jetson L4T)" },
|
|
43939
43976
|
{ cmd: `${pipCmd} -m pip install --quiet onnxruntime-gpu 2>/dev/null || true`, fatal: false, label: "onnxruntime-gpu (Jetson, optional)" }
|
|
43940
43977
|
] : [
|
|
43941
|
-
// Non-Jetson ARM:
|
|
43942
|
-
|
|
43978
|
+
// Non-Jetson ARM: use default PyPI (has aarch64 wheels).
|
|
43979
|
+
// DO NOT use --index-url https://download.pytorch.org/whl/cpu — that index
|
|
43980
|
+
// only has x86_64 wheels. ARM needs the standard PyPI torch package.
|
|
43981
|
+
{ cmd: `${pipCmd} -m pip install --quiet torch torchaudio`, fatal: true, label: "PyTorch (ARM aarch64 from PyPI)" }
|
|
43943
43982
|
],
|
|
43944
43983
|
{ cmd: `${pipCmd} -m pip install --quiet numpy`, fatal: true, label: "numpy" },
|
|
43945
43984
|
{ cmd: `${pipCmd} -m pip install --quiet huggingface_hub safetensors`, fatal: true, label: "huggingface_hub + safetensors" },
|
|
43946
43985
|
{ cmd: `${pipCmd} -m pip install --quiet "transformers<=4.57.6"`, fatal: true, label: "transformers" },
|
|
43947
43986
|
{ cmd: `${pipCmd} -m pip install --quiet pydub inflect`, fatal: true, label: "pydub + inflect" },
|
|
43948
|
-
//
|
|
43949
|
-
{ cmd: `${pipCmd} -m pip install --quiet
|
|
43987
|
+
// llvmlite (needed by numba, needed by librosa): try prebuilt first, then compile
|
|
43988
|
+
{ cmd: `${pipCmd} -m pip install --quiet llvmlite 2>/dev/null || LLVM_CONFIG=$(which llvm-config || which llvm-config-14 || echo llvm-config) ${pipCmd} -m pip install --quiet llvmlite`, fatal: false, label: "llvmlite (ARM \u2014 trying prebuilt, then compiling)" },
|
|
43989
|
+
{ cmd: `${pipCmd} -m pip install --quiet numba`, fatal: false, label: "numba" },
|
|
43990
|
+
// librosa: if numba/llvmlite failed, librosa degrades but still works for basic audio loading
|
|
43991
|
+
{ cmd: `${pipCmd} -m pip install --quiet librosa`, fatal: true, label: "librosa" },
|
|
43950
43992
|
{ cmd: `${pipCmd} -m pip install --quiet lhotse`, fatal: true, label: "lhotse" },
|
|
43951
|
-
|
|
43993
|
+
// vocos: try pip, fallback to building from source if wheels missing
|
|
43994
|
+
{ cmd: `${pipCmd} -m pip install --quiet vocos 2>/dev/null || ${pipCmd} -m pip install --quiet --no-build-isolation vocos`, fatal: true, label: "vocos" },
|
|
43952
43995
|
{ cmd: `${pipCmd} -m pip install --quiet "git+https://github.com/ysharma3501/LinaCodec.git"`, fatal: true, label: "LinaCodec" },
|
|
43953
43996
|
// Non-fatal (not hard-imported by LuxTTS):
|
|
43954
43997
|
{ cmd: `${pipCmd} -m pip install --quiet piper-phonemize --find-links https://k2-fsa.github.io/icefall/piper_phonemize.html`, fatal: false, label: "piper-phonemize (optional)" },
|
|
@@ -43996,7 +44039,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
43996
44039
|
if (!existsSync39(refsDir))
|
|
43997
44040
|
return;
|
|
43998
44041
|
for (const name of ["custom-clone.wav", "custom-clone.mp3", "glados-ref.wav", "overwatch-ref.wav"]) {
|
|
43999
|
-
const p =
|
|
44042
|
+
const p = join55(refsDir, name);
|
|
44000
44043
|
if (existsSync39(p)) {
|
|
44001
44044
|
this.luxttsCloneRef = p;
|
|
44002
44045
|
return;
|
|
@@ -44197,7 +44240,7 @@ if __name__ == '__main__':
|
|
|
44197
44240
|
const ready = await this.ensureLuxttsDaemon();
|
|
44198
44241
|
if (!ready)
|
|
44199
44242
|
return null;
|
|
44200
|
-
const wavPath =
|
|
44243
|
+
const wavPath = join55(tmpdir9(), `oa-luxtts-${Date.now()}-${Math.random().toString(36).slice(2, 6)}.wav`);
|
|
44201
44244
|
try {
|
|
44202
44245
|
await this.luxttsRequest({
|
|
44203
44246
|
action: "synthesize",
|
|
@@ -44310,7 +44353,7 @@ if __name__ == '__main__':
|
|
|
44310
44353
|
const ready = await this.ensureLuxttsDaemon();
|
|
44311
44354
|
if (!ready)
|
|
44312
44355
|
return null;
|
|
44313
|
-
const wavPath =
|
|
44356
|
+
const wavPath = join55(tmpdir9(), `oa-luxtts-buf-${Date.now()}.wav`);
|
|
44314
44357
|
try {
|
|
44315
44358
|
await this.luxttsRequest({
|
|
44316
44359
|
action: "synthesize",
|
|
@@ -44340,7 +44383,7 @@ if __name__ == '__main__':
|
|
|
44340
44383
|
return;
|
|
44341
44384
|
const arch2 = process.arch;
|
|
44342
44385
|
mkdirSync15(voiceDir(), { recursive: true });
|
|
44343
|
-
const pkgPath =
|
|
44386
|
+
const pkgPath = join55(voiceDir(), "package.json");
|
|
44344
44387
|
const expectedDeps = {
|
|
44345
44388
|
"onnxruntime-node": "^1.21.0",
|
|
44346
44389
|
"phonemizer": "^1.2.1"
|
|
@@ -44362,16 +44405,16 @@ if __name__ == '__main__':
|
|
|
44362
44405
|
dependencies: expectedDeps
|
|
44363
44406
|
}, null, 2));
|
|
44364
44407
|
}
|
|
44365
|
-
const voiceRequire = createRequire(
|
|
44408
|
+
const voiceRequire = createRequire(join55(voiceDir(), "index.js"));
|
|
44366
44409
|
const probeOnnx = async () => {
|
|
44367
44410
|
try {
|
|
44368
|
-
const output = await this.asyncShell(`NODE_PATH="${
|
|
44411
|
+
const output = await this.asyncShell(`NODE_PATH="${join55(voiceDir(), "node_modules")}" node -e "try { require('onnxruntime-node'); console.log('OK'); } catch(e) { console.log('FAIL:' + e.message); }"`, 15e3);
|
|
44369
44412
|
return output.trim() === "OK";
|
|
44370
44413
|
} catch {
|
|
44371
44414
|
return false;
|
|
44372
44415
|
}
|
|
44373
44416
|
};
|
|
44374
|
-
const onnxNodeModules =
|
|
44417
|
+
const onnxNodeModules = join55(voiceDir(), "node_modules", "onnxruntime-node");
|
|
44375
44418
|
const onnxInstalled = existsSync39(onnxNodeModules);
|
|
44376
44419
|
if (onnxInstalled && !await probeOnnx()) {
|
|
44377
44420
|
throw new Error(`Voice synthesis unavailable: ONNX runtime crashes on this CPU (${process.platform}-${arch2}). This is a known issue with some ARM SoCs where the CPU vendor is not recognized. Voice feedback will be disabled but all other features work normally.`);
|
|
@@ -44501,7 +44544,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
|
44501
44544
|
import * as nodeOs from "node:os";
|
|
44502
44545
|
import { execSync as nodeExecSync } from "node:child_process";
|
|
44503
44546
|
import { existsSync as existsSync40, readFileSync as readFileSync29, writeFileSync as writeFileSync17, mkdirSync as mkdirSync16, readdirSync as readdirSync11, statSync as statSync14, rmSync } from "node:fs";
|
|
44504
|
-
import { join as
|
|
44547
|
+
import { join as join56 } from "node:path";
|
|
44505
44548
|
function safeLog(text) {
|
|
44506
44549
|
if (isNeovimActive()) {
|
|
44507
44550
|
writeToNeovimOutput(text + "\n");
|
|
@@ -45110,8 +45153,8 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45110
45153
|
let content = "";
|
|
45111
45154
|
let metadata = {};
|
|
45112
45155
|
if (shareType === "tool") {
|
|
45113
|
-
const toolDir =
|
|
45114
|
-
const toolFile =
|
|
45156
|
+
const toolDir = join56(ctx.repoRoot, ".oa", "tools");
|
|
45157
|
+
const toolFile = join56(toolDir, shareName.endsWith(".json") ? shareName : `${shareName}.json`);
|
|
45115
45158
|
if (!existsSync40(toolFile)) {
|
|
45116
45159
|
renderWarning(`Tool not found: ${toolFile}`);
|
|
45117
45160
|
return "handled";
|
|
@@ -45119,8 +45162,8 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45119
45162
|
content = readFileSync29(toolFile, "utf8");
|
|
45120
45163
|
metadata = { type: "tool", name: shareName };
|
|
45121
45164
|
} else if (shareType === "skill") {
|
|
45122
|
-
const skillDir =
|
|
45123
|
-
const skillFile =
|
|
45165
|
+
const skillDir = join56(ctx.repoRoot, ".oa", "skills", shareName);
|
|
45166
|
+
const skillFile = join56(skillDir, "SKILL.md");
|
|
45124
45167
|
if (!existsSync40(skillFile)) {
|
|
45125
45168
|
renderWarning(`Skill not found: ${skillFile}`);
|
|
45126
45169
|
return "handled";
|
|
@@ -45164,7 +45207,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45164
45207
|
const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
|
|
45165
45208
|
const nexus = new NexusTool2(ctx.repoRoot);
|
|
45166
45209
|
await nexus.execute({ action: "ipfs_pin", cid: importCid, source: "import" });
|
|
45167
|
-
const regFile =
|
|
45210
|
+
const regFile = join56(ctx.repoRoot, ".oa", "nexus", "ipfs", "cid-registry", "learning-cids.json");
|
|
45168
45211
|
if (existsSync40(regFile)) {
|
|
45169
45212
|
const reg = JSON.parse(readFileSync29(regFile, "utf8"));
|
|
45170
45213
|
const pinned = Object.values(reg).some((e) => e.cid === importCid && e.pinned);
|
|
@@ -45219,8 +45262,8 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45219
45262
|
lines.push(`
|
|
45220
45263
|
${c2.bold("IPFS / Helia Status")}
|
|
45221
45264
|
`);
|
|
45222
|
-
const ipfsDir =
|
|
45223
|
-
const ipfsLocalDir =
|
|
45265
|
+
const ipfsDir = join56(ctx.repoRoot, ".oa", "ipfs");
|
|
45266
|
+
const ipfsLocalDir = join56(ipfsDir, "local");
|
|
45224
45267
|
let ipfsFiles = 0;
|
|
45225
45268
|
let ipfsBytes = 0;
|
|
45226
45269
|
let heliaBlocks = 0;
|
|
@@ -45231,21 +45274,21 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45231
45274
|
ipfsFiles = files.length;
|
|
45232
45275
|
for (const f of files) {
|
|
45233
45276
|
try {
|
|
45234
|
-
ipfsBytes += statSync14(
|
|
45277
|
+
ipfsBytes += statSync14(join56(ipfsLocalDir, f)).size;
|
|
45235
45278
|
} catch {
|
|
45236
45279
|
}
|
|
45237
45280
|
}
|
|
45238
45281
|
}
|
|
45239
|
-
const heliaBlockDir =
|
|
45282
|
+
const heliaBlockDir = join56(ipfsDir, "blocks");
|
|
45240
45283
|
if (existsSync40(heliaBlockDir)) {
|
|
45241
45284
|
const walkDir = (dir) => {
|
|
45242
45285
|
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
45243
45286
|
if (entry.isDirectory())
|
|
45244
|
-
walkDir(
|
|
45287
|
+
walkDir(join56(dir, entry.name));
|
|
45245
45288
|
else {
|
|
45246
45289
|
heliaBlocks++;
|
|
45247
45290
|
try {
|
|
45248
|
-
heliaBytes += statSync14(
|
|
45291
|
+
heliaBytes += statSync14(join56(dir, entry.name)).size;
|
|
45249
45292
|
} catch {
|
|
45250
45293
|
}
|
|
45251
45294
|
}
|
|
@@ -45261,7 +45304,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45261
45304
|
lines.push(` Blocks: ${c2.bold(String(heliaBlocks))} Size: ${c2.bold(formatFileSize(heliaBytes))}`);
|
|
45262
45305
|
lines.push(` Backend: ${heliaBlocks > 0 ? c2.green("helia-ipfs") : c2.yellow("sha256-local (Helia not initialized)")}`);
|
|
45263
45306
|
try {
|
|
45264
|
-
const statusFile =
|
|
45307
|
+
const statusFile = join56(ctx.repoRoot, ".oa", "nexus", "status.json");
|
|
45265
45308
|
if (existsSync40(statusFile)) {
|
|
45266
45309
|
const status = JSON.parse(readFileSync29(statusFile, "utf8"));
|
|
45267
45310
|
if (status.peerId) {
|
|
@@ -45282,9 +45325,9 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45282
45325
|
${c2.dim("Commands: /ipfs pin <CID> /ipfs publish /ipfs cids")}`);
|
|
45283
45326
|
lines.push(`
|
|
45284
45327
|
${c2.bold("Identity Kernel")}`);
|
|
45285
|
-
const idDir =
|
|
45328
|
+
const idDir = join56(ctx.repoRoot, ".oa", "identity");
|
|
45286
45329
|
try {
|
|
45287
|
-
const stateFile =
|
|
45330
|
+
const stateFile = join56(idDir, "self-state.json");
|
|
45288
45331
|
if (existsSync40(stateFile)) {
|
|
45289
45332
|
const state = JSON.parse(readFileSync29(stateFile, "utf8"));
|
|
45290
45333
|
lines.push(` Version: ${c2.bold("v" + (state.version ?? "?"))} Sessions: ${c2.bold(String(state.session_count ?? 0))}`);
|
|
@@ -45295,7 +45338,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45295
45338
|
const traits = typeof state.personality_traits === "object" ? Object.entries(state.personality_traits).map(([k, v]) => `${k}:${v}`).join(", ") : String(state.personality_traits);
|
|
45296
45339
|
lines.push(` Traits: ${c2.dim(traits.slice(0, 60))}`);
|
|
45297
45340
|
}
|
|
45298
|
-
const cidFile =
|
|
45341
|
+
const cidFile = join56(idDir, "cids.json");
|
|
45299
45342
|
if (existsSync40(cidFile)) {
|
|
45300
45343
|
const cids = JSON.parse(readFileSync29(cidFile, "utf8"));
|
|
45301
45344
|
const lastCid = Array.isArray(cids) ? cids[cids.length - 1] : cids.latest;
|
|
@@ -45310,7 +45353,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45310
45353
|
lines.push(`
|
|
45311
45354
|
${c2.bold("Memory Sentiment")}`);
|
|
45312
45355
|
try {
|
|
45313
|
-
const metaFile =
|
|
45356
|
+
const metaFile = join56(ctx.repoRoot, ".oa", "memory", "metabolism", "store.json");
|
|
45314
45357
|
if (existsSync40(metaFile)) {
|
|
45315
45358
|
const store = JSON.parse(readFileSync29(metaFile, "utf8"));
|
|
45316
45359
|
const active = store.filter((m) => m.type !== "quarantine");
|
|
@@ -45330,7 +45373,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45330
45373
|
} catch {
|
|
45331
45374
|
}
|
|
45332
45375
|
try {
|
|
45333
|
-
const dbPath =
|
|
45376
|
+
const dbPath = join56(ctx.repoRoot, ".oa", "memory", "structured.db");
|
|
45334
45377
|
if (existsSync40(dbPath)) {
|
|
45335
45378
|
const { initDb: initDb2, closeDb: cDb, ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
|
|
45336
45379
|
const db = initDb2(dbPath);
|
|
@@ -45352,7 +45395,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45352
45395
|
lines.push(`
|
|
45353
45396
|
${c2.bold("Storage Overview")}
|
|
45354
45397
|
`);
|
|
45355
|
-
const oaDir =
|
|
45398
|
+
const oaDir = join56(ctx.repoRoot, ".oa");
|
|
45356
45399
|
if (!existsSync40(oaDir)) {
|
|
45357
45400
|
lines.push(` ${c2.dim("No .oa/ directory found.")}`);
|
|
45358
45401
|
safeLog(lines.join("\n") + "\n");
|
|
@@ -45363,7 +45406,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45363
45406
|
const walkStorage = (dir, category) => {
|
|
45364
45407
|
try {
|
|
45365
45408
|
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
45366
|
-
const full =
|
|
45409
|
+
const full = join56(dir, entry.name);
|
|
45367
45410
|
if (entry.isDirectory()) {
|
|
45368
45411
|
const subCat = category || entry.name;
|
|
45369
45412
|
walkStorage(full, subCat);
|
|
@@ -45399,10 +45442,10 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45399
45442
|
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
45400
45443
|
const name = entry.name.toLowerCase();
|
|
45401
45444
|
if (sensitivePatterns.some((p) => name.includes(p))) {
|
|
45402
|
-
sensitiveFound.push(
|
|
45445
|
+
sensitiveFound.push(join56(dir, entry.name).replace(oaDir + "/", ""));
|
|
45403
45446
|
}
|
|
45404
45447
|
if (entry.isDirectory())
|
|
45405
|
-
checkSensitive(
|
|
45448
|
+
checkSensitive(join56(dir, entry.name));
|
|
45406
45449
|
}
|
|
45407
45450
|
} catch {
|
|
45408
45451
|
}
|
|
@@ -45430,7 +45473,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45430
45473
|
renderInfo("Supported: .wav .mp3 .flac .ogg (audio\u2192transcribe) | .pdf .txt .md (text\u2192chunk)");
|
|
45431
45474
|
return "handled";
|
|
45432
45475
|
}
|
|
45433
|
-
const resolvedPath =
|
|
45476
|
+
const resolvedPath = join56(ctx.repoRoot, filePath);
|
|
45434
45477
|
if (!existsSync40(resolvedPath)) {
|
|
45435
45478
|
renderWarning(`File not found: ${resolvedPath}`);
|
|
45436
45479
|
return "handled";
|
|
@@ -45447,9 +45490,9 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45447
45490
|
}
|
|
45448
45491
|
try {
|
|
45449
45492
|
const { initDb: initDb2, closeDb: cDb, ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
|
|
45450
|
-
const dbDir =
|
|
45493
|
+
const dbDir = join56(ctx.repoRoot, ".oa", "memory");
|
|
45451
45494
|
mkdirSync16(dbDir, { recursive: true });
|
|
45452
|
-
const db = initDb2(
|
|
45495
|
+
const db = initDb2(join56(dbDir, "structured.db"));
|
|
45453
45496
|
const memStore = new ProceduralMemoryStore2(db);
|
|
45454
45497
|
if (isAudio) {
|
|
45455
45498
|
renderInfo(`Transcribing: ${filePath}...`);
|
|
@@ -45529,8 +45572,8 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45529
45572
|
}
|
|
45530
45573
|
case "fortemi": {
|
|
45531
45574
|
const fortemiSubCmd = (arg || "").trim().toLowerCase();
|
|
45532
|
-
const fortemiDir =
|
|
45533
|
-
const altFortemiDir =
|
|
45575
|
+
const fortemiDir = join56(ctx.repoRoot, "..", "fortemi-react");
|
|
45576
|
+
const altFortemiDir = join56(nodeOs.homedir(), "fortemi-react");
|
|
45534
45577
|
const fDir = existsSync40(fortemiDir) ? fortemiDir : existsSync40(altFortemiDir) ? altFortemiDir : null;
|
|
45535
45578
|
if (fortemiSubCmd === "start" || fortemiSubCmd === "") {
|
|
45536
45579
|
if (!fDir) {
|
|
@@ -45546,14 +45589,14 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45546
45589
|
// 24h
|
|
45547
45590
|
nonce: Math.random().toString(36).slice(2, 10)
|
|
45548
45591
|
};
|
|
45549
|
-
const jwtFile =
|
|
45550
|
-
mkdirSync16(
|
|
45592
|
+
const jwtFile = join56(ctx.repoRoot, ".oa", "fortemi-jwt.json");
|
|
45593
|
+
mkdirSync16(join56(ctx.repoRoot, ".oa"), { recursive: true });
|
|
45551
45594
|
writeFileSync17(jwtFile, JSON.stringify(jwtPayload, null, 2));
|
|
45552
45595
|
renderInfo(`Launching fortemi-react from ${fDir}...`);
|
|
45553
45596
|
try {
|
|
45554
45597
|
const { spawn: spawn21 } = __require("node:child_process");
|
|
45555
45598
|
const child = spawn21("npx", ["vite", "dev", "--host", "0.0.0.0", "--port", "3000"], {
|
|
45556
|
-
cwd:
|
|
45599
|
+
cwd: join56(fDir, "apps", "standalone"),
|
|
45557
45600
|
stdio: "ignore",
|
|
45558
45601
|
detached: true,
|
|
45559
45602
|
env: { ...process.env, OA_JWT: JSON.stringify(jwtPayload) }
|
|
@@ -45562,7 +45605,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45562
45605
|
renderInfo("Fortemi-React starting on http://localhost:3000");
|
|
45563
45606
|
renderInfo(`JWT saved to ${jwtFile}`);
|
|
45564
45607
|
renderInfo("Memory operations will proxy to fortemi when available.");
|
|
45565
|
-
const bridgeFile =
|
|
45608
|
+
const bridgeFile = join56(ctx.repoRoot, ".oa", "fortemi-bridge.json");
|
|
45566
45609
|
writeFileSync17(bridgeFile, JSON.stringify({
|
|
45567
45610
|
url: "http://localhost:3000",
|
|
45568
45611
|
pid: child.pid,
|
|
@@ -45575,7 +45618,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45575
45618
|
return "handled";
|
|
45576
45619
|
}
|
|
45577
45620
|
if (fortemiSubCmd === "status") {
|
|
45578
|
-
const bridgeFile =
|
|
45621
|
+
const bridgeFile = join56(ctx.repoRoot, ".oa", "fortemi-bridge.json");
|
|
45579
45622
|
if (!existsSync40(bridgeFile)) {
|
|
45580
45623
|
renderInfo("Fortemi bridge: not connected. Run /fortemi start");
|
|
45581
45624
|
return "handled";
|
|
@@ -45606,7 +45649,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45606
45649
|
return "handled";
|
|
45607
45650
|
}
|
|
45608
45651
|
if (fortemiSubCmd === "stop") {
|
|
45609
|
-
const bridgeFile =
|
|
45652
|
+
const bridgeFile = join56(ctx.repoRoot, ".oa", "fortemi-bridge.json");
|
|
45610
45653
|
if (existsSync40(bridgeFile)) {
|
|
45611
45654
|
const bridge = JSON.parse(readFileSync29(bridgeFile, "utf8"));
|
|
45612
45655
|
try {
|
|
@@ -46987,13 +47030,13 @@ async function showCohereDashboard(ctx) {
|
|
|
46987
47030
|
} else if (idResult.key === "view") {
|
|
46988
47031
|
await ik.execute({ operation: "hydrate" });
|
|
46989
47032
|
} else if (idResult.key === "history") {
|
|
46990
|
-
const snapDir =
|
|
47033
|
+
const snapDir = join56(ctx.repoRoot, ".oa", "identity", "snapshots");
|
|
46991
47034
|
if (existsSync40(snapDir)) {
|
|
46992
47035
|
const snaps = readdirSync11(snapDir).filter((f) => f.endsWith(".json")).sort().reverse();
|
|
46993
47036
|
const snapItems = snaps.slice(0, 20).map((f) => ({
|
|
46994
47037
|
key: f,
|
|
46995
47038
|
label: f.replace(".json", ""),
|
|
46996
|
-
detail: `${formatFileSize(statSync14(
|
|
47039
|
+
detail: `${formatFileSize(statSync14(join56(snapDir, f)).size)}`
|
|
46997
47040
|
}));
|
|
46998
47041
|
if (snapItems.length > 0) {
|
|
46999
47042
|
await tuiSelect({
|
|
@@ -47807,8 +47850,8 @@ async function handlePeerEndpoint(peerId, authKey, ctx, local) {
|
|
|
47807
47850
|
if (models.length > 0) {
|
|
47808
47851
|
try {
|
|
47809
47852
|
const { writeFileSync: writeFileSync23, mkdirSync: mkdirSync24 } = await import("node:fs");
|
|
47810
|
-
const { join:
|
|
47811
|
-
const cachePath =
|
|
47853
|
+
const { join: join70, dirname: dirname22 } = await import("node:path");
|
|
47854
|
+
const cachePath = join70(ctx.repoRoot || process.cwd(), ".oa", "nexus", "peer-models-cache.json");
|
|
47812
47855
|
mkdirSync24(dirname22(cachePath), { recursive: true });
|
|
47813
47856
|
writeFileSync23(cachePath, JSON.stringify({
|
|
47814
47857
|
peerId,
|
|
@@ -48009,14 +48052,14 @@ async function handleUpdate(subcommand, ctx) {
|
|
|
48009
48052
|
try {
|
|
48010
48053
|
const { createRequire: createRequire4 } = await import("node:module");
|
|
48011
48054
|
const { fileURLToPath: fileURLToPath14 } = await import("node:url");
|
|
48012
|
-
const { dirname: dirname22, join:
|
|
48055
|
+
const { dirname: dirname22, join: join70 } = await import("node:path");
|
|
48013
48056
|
const { existsSync: existsSync50 } = await import("node:fs");
|
|
48014
48057
|
const req = createRequire4(import.meta.url);
|
|
48015
48058
|
const thisDir = dirname22(fileURLToPath14(import.meta.url));
|
|
48016
48059
|
const candidates = [
|
|
48017
|
-
|
|
48018
|
-
|
|
48019
|
-
|
|
48060
|
+
join70(thisDir, "..", "package.json"),
|
|
48061
|
+
join70(thisDir, "..", "..", "package.json"),
|
|
48062
|
+
join70(thisDir, "..", "..", "..", "package.json")
|
|
48020
48063
|
];
|
|
48021
48064
|
for (const pkgPath of candidates) {
|
|
48022
48065
|
if (existsSync50(pkgPath)) {
|
|
@@ -48340,11 +48383,12 @@ async function handleUpdate(subcommand, ctx) {
|
|
|
48340
48383
|
}
|
|
48341
48384
|
}
|
|
48342
48385
|
const venvDir = pathJoin(getHome(), ".open-agents", "venv");
|
|
48343
|
-
const
|
|
48344
|
-
|
|
48386
|
+
const isWin2 = process.platform === "win32";
|
|
48387
|
+
const venvPip2 = isWin2 ? pathJoin(venvDir, "Scripts", "pip.exe") : pathJoin(venvDir, "bin", "pip");
|
|
48388
|
+
if (fsExists(venvPip2)) {
|
|
48345
48389
|
installOverlay.setStatus("Upgrading Python packages...");
|
|
48346
48390
|
await new Promise((resolve34) => {
|
|
48347
|
-
const child = exec4(`"${
|
|
48391
|
+
const child = exec4(`"${venvPip2}" install --upgrade moondream-station pytesseract Pillow opencv-python-headless numpy 2>/dev/null || true`, { timeout: 3e5 }, (err) => resolve34(!err));
|
|
48348
48392
|
child.stdout?.resume();
|
|
48349
48393
|
child.stderr?.resume();
|
|
48350
48394
|
});
|
|
@@ -48857,7 +48901,7 @@ var init_commands = __esm({
|
|
|
48857
48901
|
|
|
48858
48902
|
// packages/cli/dist/tui/project-context.js
|
|
48859
48903
|
import { existsSync as existsSync41, readFileSync as readFileSync30, readdirSync as readdirSync12 } from "node:fs";
|
|
48860
|
-
import { join as
|
|
48904
|
+
import { join as join57, basename as basename11 } from "node:path";
|
|
48861
48905
|
import { execSync as execSync29 } from "node:child_process";
|
|
48862
48906
|
import { homedir as homedir15, platform as platform4, release } from "node:os";
|
|
48863
48907
|
function getModelTier(modelName) {
|
|
@@ -48892,7 +48936,7 @@ function loadProjectMap(repoRoot) {
|
|
|
48892
48936
|
if (!hasOaDirectory(repoRoot)) {
|
|
48893
48937
|
initOaDirectory(repoRoot);
|
|
48894
48938
|
}
|
|
48895
|
-
const mapPath2 =
|
|
48939
|
+
const mapPath2 = join57(repoRoot, OA_DIR, "context", "project-map.md");
|
|
48896
48940
|
if (existsSync41(mapPath2)) {
|
|
48897
48941
|
try {
|
|
48898
48942
|
const content = readFileSync30(mapPath2, "utf-8");
|
|
@@ -48936,17 +48980,17 @@ ${log}`);
|
|
|
48936
48980
|
}
|
|
48937
48981
|
function loadMemoryContext(repoRoot) {
|
|
48938
48982
|
const sections = [];
|
|
48939
|
-
const oaMemDir =
|
|
48983
|
+
const oaMemDir = join57(repoRoot, OA_DIR, "memory");
|
|
48940
48984
|
const oaEntries = loadMemoryDir(oaMemDir, "project");
|
|
48941
48985
|
if (oaEntries)
|
|
48942
48986
|
sections.push(oaEntries);
|
|
48943
|
-
const legacyMemDir =
|
|
48987
|
+
const legacyMemDir = join57(repoRoot, ".open-agents", "memory");
|
|
48944
48988
|
if (legacyMemDir !== oaMemDir && existsSync41(legacyMemDir)) {
|
|
48945
48989
|
const legacyEntries = loadMemoryDir(legacyMemDir, "project/legacy");
|
|
48946
48990
|
if (legacyEntries)
|
|
48947
48991
|
sections.push(legacyEntries);
|
|
48948
48992
|
}
|
|
48949
|
-
const globalMemDir =
|
|
48993
|
+
const globalMemDir = join57(homedir15(), ".open-agents", "memory");
|
|
48950
48994
|
const globalEntries = loadMemoryDir(globalMemDir, "global");
|
|
48951
48995
|
if (globalEntries)
|
|
48952
48996
|
sections.push(globalEntries);
|
|
@@ -48960,7 +49004,7 @@ function loadMemoryDir(memDir, scope) {
|
|
|
48960
49004
|
const files = readdirSync12(memDir).filter((f) => f.endsWith(".json"));
|
|
48961
49005
|
for (const file of files.slice(0, 10)) {
|
|
48962
49006
|
try {
|
|
48963
|
-
const raw = readFileSync30(
|
|
49007
|
+
const raw = readFileSync30(join57(memDir, file), "utf-8");
|
|
48964
49008
|
const entries = JSON.parse(raw);
|
|
48965
49009
|
const topic = basename11(file, ".json");
|
|
48966
49010
|
const keys = Object.keys(entries);
|
|
@@ -50480,9 +50524,9 @@ var init_banner = __esm({
|
|
|
50480
50524
|
|
|
50481
50525
|
// packages/cli/dist/tui/carousel-descriptors.js
|
|
50482
50526
|
import { existsSync as existsSync42, readFileSync as readFileSync31, writeFileSync as writeFileSync18, mkdirSync as mkdirSync17, readdirSync as readdirSync13 } from "node:fs";
|
|
50483
|
-
import { join as
|
|
50527
|
+
import { join as join58, basename as basename12 } from "node:path";
|
|
50484
50528
|
function loadToolProfile(repoRoot) {
|
|
50485
|
-
const filePath =
|
|
50529
|
+
const filePath = join58(repoRoot, OA_DIR, "context", TOOL_PROFILE_FILE);
|
|
50486
50530
|
try {
|
|
50487
50531
|
if (!existsSync42(filePath))
|
|
50488
50532
|
return null;
|
|
@@ -50492,9 +50536,9 @@ function loadToolProfile(repoRoot) {
|
|
|
50492
50536
|
}
|
|
50493
50537
|
}
|
|
50494
50538
|
function saveToolProfile(repoRoot, profile) {
|
|
50495
|
-
const contextDir =
|
|
50539
|
+
const contextDir = join58(repoRoot, OA_DIR, "context");
|
|
50496
50540
|
mkdirSync17(contextDir, { recursive: true });
|
|
50497
|
-
writeFileSync18(
|
|
50541
|
+
writeFileSync18(join58(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
|
|
50498
50542
|
}
|
|
50499
50543
|
function categorizeToolCall(toolName) {
|
|
50500
50544
|
for (const cat of TOOL_CATEGORIES) {
|
|
@@ -50552,7 +50596,7 @@ function weightedColor(profile) {
|
|
|
50552
50596
|
return selectedCat.colors[Math.floor(Math.random() * selectedCat.colors.length)];
|
|
50553
50597
|
}
|
|
50554
50598
|
function loadCachedDescriptors(repoRoot) {
|
|
50555
|
-
const filePath =
|
|
50599
|
+
const filePath = join58(repoRoot, OA_DIR, "context", DESCRIPTOR_FILE);
|
|
50556
50600
|
try {
|
|
50557
50601
|
if (!existsSync42(filePath))
|
|
50558
50602
|
return null;
|
|
@@ -50563,14 +50607,14 @@ function loadCachedDescriptors(repoRoot) {
|
|
|
50563
50607
|
}
|
|
50564
50608
|
}
|
|
50565
50609
|
function saveCachedDescriptors(repoRoot, phrases, sourceHash) {
|
|
50566
|
-
const contextDir =
|
|
50610
|
+
const contextDir = join58(repoRoot, OA_DIR, "context");
|
|
50567
50611
|
mkdirSync17(contextDir, { recursive: true });
|
|
50568
50612
|
const cached = {
|
|
50569
50613
|
phrases,
|
|
50570
50614
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
50571
50615
|
sourceHash
|
|
50572
50616
|
};
|
|
50573
|
-
writeFileSync18(
|
|
50617
|
+
writeFileSync18(join58(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
|
|
50574
50618
|
}
|
|
50575
50619
|
function generateDescriptors(repoRoot) {
|
|
50576
50620
|
const profile = loadToolProfile(repoRoot);
|
|
@@ -50618,7 +50662,7 @@ function generateDescriptors(repoRoot) {
|
|
|
50618
50662
|
return phrases;
|
|
50619
50663
|
}
|
|
50620
50664
|
function extractFromPackageJson(repoRoot, tags) {
|
|
50621
|
-
const pkgPath =
|
|
50665
|
+
const pkgPath = join58(repoRoot, "package.json");
|
|
50622
50666
|
try {
|
|
50623
50667
|
if (!existsSync42(pkgPath))
|
|
50624
50668
|
return;
|
|
@@ -50666,7 +50710,7 @@ function extractFromManifests(repoRoot, tags) {
|
|
|
50666
50710
|
{ file: ".github/workflows", tag: "ci/cd" }
|
|
50667
50711
|
];
|
|
50668
50712
|
for (const check of manifestChecks) {
|
|
50669
|
-
if (existsSync42(
|
|
50713
|
+
if (existsSync42(join58(repoRoot, check.file))) {
|
|
50670
50714
|
tags.push(check.tag);
|
|
50671
50715
|
}
|
|
50672
50716
|
}
|
|
@@ -50688,7 +50732,7 @@ function extractFromSessions(repoRoot, tags) {
|
|
|
50688
50732
|
}
|
|
50689
50733
|
}
|
|
50690
50734
|
function extractFromMemory(repoRoot, tags) {
|
|
50691
|
-
const memoryDir =
|
|
50735
|
+
const memoryDir = join58(repoRoot, OA_DIR, "memory");
|
|
50692
50736
|
try {
|
|
50693
50737
|
if (!existsSync42(memoryDir))
|
|
50694
50738
|
return;
|
|
@@ -50697,7 +50741,7 @@ function extractFromMemory(repoRoot, tags) {
|
|
|
50697
50741
|
const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
|
|
50698
50742
|
tags.push(topic);
|
|
50699
50743
|
try {
|
|
50700
|
-
const data = JSON.parse(readFileSync31(
|
|
50744
|
+
const data = JSON.parse(readFileSync31(join58(memoryDir, file), "utf-8"));
|
|
50701
50745
|
if (data && typeof data === "object") {
|
|
50702
50746
|
const keys = Object.keys(data).slice(0, 3);
|
|
50703
50747
|
for (const key of keys) {
|
|
@@ -51331,10 +51375,10 @@ var init_stream_renderer = __esm({
|
|
|
51331
51375
|
|
|
51332
51376
|
// packages/cli/dist/tui/edit-history.js
|
|
51333
51377
|
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync18 } from "node:fs";
|
|
51334
|
-
import { join as
|
|
51378
|
+
import { join as join59 } from "node:path";
|
|
51335
51379
|
function createEditHistoryLogger(repoRoot, sessionId) {
|
|
51336
|
-
const historyDir =
|
|
51337
|
-
const logPath2 =
|
|
51380
|
+
const historyDir = join59(repoRoot, ".oa", "history");
|
|
51381
|
+
const logPath2 = join59(historyDir, "edits.jsonl");
|
|
51338
51382
|
try {
|
|
51339
51383
|
mkdirSync18(historyDir, { recursive: true });
|
|
51340
51384
|
} catch {
|
|
@@ -51446,12 +51490,12 @@ var init_edit_history = __esm({
|
|
|
51446
51490
|
|
|
51447
51491
|
// packages/cli/dist/tui/promptLoader.js
|
|
51448
51492
|
import { readFileSync as readFileSync32, existsSync as existsSync43 } from "node:fs";
|
|
51449
|
-
import { join as
|
|
51493
|
+
import { join as join60, dirname as dirname19 } from "node:path";
|
|
51450
51494
|
import { fileURLToPath as fileURLToPath11 } from "node:url";
|
|
51451
51495
|
function loadPrompt3(promptPath, vars) {
|
|
51452
51496
|
let content = cache3.get(promptPath);
|
|
51453
51497
|
if (content === void 0) {
|
|
51454
|
-
const fullPath =
|
|
51498
|
+
const fullPath = join60(PROMPTS_DIR3, promptPath);
|
|
51455
51499
|
if (!existsSync43(fullPath)) {
|
|
51456
51500
|
throw new Error(`Prompt file not found: ${fullPath}`);
|
|
51457
51501
|
}
|
|
@@ -51468,8 +51512,8 @@ var init_promptLoader3 = __esm({
|
|
|
51468
51512
|
"use strict";
|
|
51469
51513
|
__filename3 = fileURLToPath11(import.meta.url);
|
|
51470
51514
|
__dirname6 = dirname19(__filename3);
|
|
51471
|
-
devPath2 =
|
|
51472
|
-
publishedPath2 =
|
|
51515
|
+
devPath2 = join60(__dirname6, "..", "..", "prompts");
|
|
51516
|
+
publishedPath2 = join60(__dirname6, "..", "prompts");
|
|
51473
51517
|
PROMPTS_DIR3 = existsSync43(devPath2) ? devPath2 : publishedPath2;
|
|
51474
51518
|
cache3 = /* @__PURE__ */ new Map();
|
|
51475
51519
|
}
|
|
@@ -51477,10 +51521,10 @@ var init_promptLoader3 = __esm({
|
|
|
51477
51521
|
|
|
51478
51522
|
// packages/cli/dist/tui/dream-engine.js
|
|
51479
51523
|
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync19, readFileSync as readFileSync33, existsSync as existsSync44, cpSync, rmSync as rmSync2, readdirSync as readdirSync14 } from "node:fs";
|
|
51480
|
-
import { join as
|
|
51524
|
+
import { join as join61, basename as basename13 } from "node:path";
|
|
51481
51525
|
import { execSync as execSync30 } from "node:child_process";
|
|
51482
51526
|
function loadAutoresearchMemory(repoRoot) {
|
|
51483
|
-
const memoryPath =
|
|
51527
|
+
const memoryPath = join61(repoRoot, ".oa", "memory", "autoresearch.json");
|
|
51484
51528
|
if (!existsSync44(memoryPath))
|
|
51485
51529
|
return "";
|
|
51486
51530
|
try {
|
|
@@ -51674,12 +51718,12 @@ var init_dream_engine = __esm({
|
|
|
51674
51718
|
const content = String(args["content"] ?? "");
|
|
51675
51719
|
if (!rawPath)
|
|
51676
51720
|
return { success: false, output: "", error: "path is required", durationMs: Date.now() - start };
|
|
51677
|
-
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ?
|
|
51721
|
+
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join61(this.autoresearchDir, basename13(rawPath)) : join61(this.autoresearchDir, rawPath);
|
|
51678
51722
|
if (!targetPath.startsWith(this.autoresearchDir)) {
|
|
51679
51723
|
return { success: false, output: "", error: "Autoresearch mode: writes are confined to .oa/autoresearch/", durationMs: Date.now() - start };
|
|
51680
51724
|
}
|
|
51681
51725
|
try {
|
|
51682
|
-
const dir =
|
|
51726
|
+
const dir = join61(targetPath, "..");
|
|
51683
51727
|
mkdirSync19(dir, { recursive: true });
|
|
51684
51728
|
writeFileSync19(targetPath, content, "utf-8");
|
|
51685
51729
|
return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start };
|
|
@@ -51709,7 +51753,7 @@ var init_dream_engine = __esm({
|
|
|
51709
51753
|
const rawPath = String(args["path"] ?? "");
|
|
51710
51754
|
const oldStr = String(args["old_string"] ?? "");
|
|
51711
51755
|
const newStr = String(args["new_string"] ?? "");
|
|
51712
|
-
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ?
|
|
51756
|
+
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join61(this.autoresearchDir, basename13(rawPath)) : join61(this.autoresearchDir, rawPath);
|
|
51713
51757
|
if (!targetPath.startsWith(this.autoresearchDir)) {
|
|
51714
51758
|
return { success: false, output: "", error: "Autoresearch mode: edits are confined to .oa/autoresearch/", durationMs: Date.now() - start };
|
|
51715
51759
|
}
|
|
@@ -51763,12 +51807,12 @@ var init_dream_engine = __esm({
|
|
|
51763
51807
|
const content = String(args["content"] ?? "");
|
|
51764
51808
|
if (!rawPath)
|
|
51765
51809
|
return { success: false, output: "", error: "path is required", durationMs: Date.now() - start };
|
|
51766
|
-
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ?
|
|
51810
|
+
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join61(this.dreamsDir, basename13(rawPath)) : join61(this.dreamsDir, rawPath);
|
|
51767
51811
|
if (!targetPath.startsWith(this.dreamsDir)) {
|
|
51768
51812
|
return { success: false, output: "", error: "Dream mode: writes are confined to .oa/dreams/", durationMs: Date.now() - start };
|
|
51769
51813
|
}
|
|
51770
51814
|
try {
|
|
51771
|
-
const dir =
|
|
51815
|
+
const dir = join61(targetPath, "..");
|
|
51772
51816
|
mkdirSync19(dir, { recursive: true });
|
|
51773
51817
|
writeFileSync19(targetPath, content, "utf-8");
|
|
51774
51818
|
return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start };
|
|
@@ -51798,7 +51842,7 @@ var init_dream_engine = __esm({
|
|
|
51798
51842
|
const rawPath = String(args["path"] ?? "");
|
|
51799
51843
|
const oldStr = String(args["old_string"] ?? "");
|
|
51800
51844
|
const newStr = String(args["new_string"] ?? "");
|
|
51801
|
-
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ?
|
|
51845
|
+
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join61(this.dreamsDir, basename13(rawPath)) : join61(this.dreamsDir, rawPath);
|
|
51802
51846
|
if (!targetPath.startsWith(this.dreamsDir)) {
|
|
51803
51847
|
return { success: false, output: "", error: "Dream mode: edits are confined to .oa/dreams/", durationMs: Date.now() - start };
|
|
51804
51848
|
}
|
|
@@ -51865,7 +51909,7 @@ var init_dream_engine = __esm({
|
|
|
51865
51909
|
constructor(config, repoRoot) {
|
|
51866
51910
|
this.config = config;
|
|
51867
51911
|
this.repoRoot = repoRoot;
|
|
51868
|
-
this.dreamsDir =
|
|
51912
|
+
this.dreamsDir = join61(repoRoot, ".oa", "dreams");
|
|
51869
51913
|
this.state = {
|
|
51870
51914
|
mode: "default",
|
|
51871
51915
|
active: false,
|
|
@@ -51949,7 +51993,7 @@ ${result.summary}`;
|
|
|
51949
51993
|
if (mode !== "default" || cycle === totalCycles) {
|
|
51950
51994
|
renderDreamContraction(cycle);
|
|
51951
51995
|
const cycleSummary = this.buildCycleSummary(cycle, previousFindings);
|
|
51952
|
-
const summaryPath =
|
|
51996
|
+
const summaryPath = join61(this.dreamsDir, `cycle-${cycle}-summary.md`);
|
|
51953
51997
|
writeFileSync19(summaryPath, cycleSummary, "utf-8");
|
|
51954
51998
|
}
|
|
51955
51999
|
if (mode === "lucid" && !this.abortController.signal.aborted) {
|
|
@@ -52162,7 +52206,7 @@ After synthesis, call task_complete with the final prioritized summary.`, toolMo
|
|
|
52162
52206
|
}
|
|
52163
52207
|
/** Build role-specific tool sets for swarm agents */
|
|
52164
52208
|
buildSwarmTools(role, _workspace) {
|
|
52165
|
-
const autoresearchDir =
|
|
52209
|
+
const autoresearchDir = join61(this.repoRoot, ".oa", "autoresearch");
|
|
52166
52210
|
const taskComplete = this.createSwarmTaskCompleteTool(role);
|
|
52167
52211
|
switch (role) {
|
|
52168
52212
|
case "researcher": {
|
|
@@ -52526,7 +52570,7 @@ INSTRUCTIONS:
|
|
|
52526
52570
|
2. Summarize the key learnings and next steps
|
|
52527
52571
|
|
|
52528
52572
|
Call task_complete with a human-readable summary of the autoresearch session.`, workspace, onEvent);
|
|
52529
|
-
const reportPath =
|
|
52573
|
+
const reportPath = join61(this.dreamsDir, `cycle-${cycleNum}-autoresearch-report.md`);
|
|
52530
52574
|
const report = `# Autoresearch Swarm Report \u2014 Cycle ${cycleNum}
|
|
52531
52575
|
|
|
52532
52576
|
**Date**: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}
|
|
@@ -52615,7 +52659,7 @@ ${summaryResult}
|
|
|
52615
52659
|
}
|
|
52616
52660
|
/** Save workspace backup for lucid mode */
|
|
52617
52661
|
saveVersionCheckpoint(cycle) {
|
|
52618
|
-
const checkpointDir =
|
|
52662
|
+
const checkpointDir = join61(this.dreamsDir, "checkpoints", `cycle-${cycle}`);
|
|
52619
52663
|
try {
|
|
52620
52664
|
mkdirSync19(checkpointDir, { recursive: true });
|
|
52621
52665
|
try {
|
|
@@ -52634,10 +52678,10 @@ ${summaryResult}
|
|
|
52634
52678
|
encoding: "utf-8",
|
|
52635
52679
|
timeout: 5e3
|
|
52636
52680
|
}).trim();
|
|
52637
|
-
writeFileSync19(
|
|
52638
|
-
writeFileSync19(
|
|
52639
|
-
writeFileSync19(
|
|
52640
|
-
writeFileSync19(
|
|
52681
|
+
writeFileSync19(join61(checkpointDir, "git-status.txt"), gitStatus, "utf-8");
|
|
52682
|
+
writeFileSync19(join61(checkpointDir, "git-diff.patch"), gitDiff, "utf-8");
|
|
52683
|
+
writeFileSync19(join61(checkpointDir, "git-hash.txt"), gitHash, "utf-8");
|
|
52684
|
+
writeFileSync19(join61(checkpointDir, "checkpoint.json"), JSON.stringify({
|
|
52641
52685
|
cycle,
|
|
52642
52686
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
52643
52687
|
gitHash,
|
|
@@ -52645,7 +52689,7 @@ ${summaryResult}
|
|
|
52645
52689
|
}, null, 2), "utf-8");
|
|
52646
52690
|
renderInfo(`Checkpoint saved: cycle ${cycle} (${gitHash.slice(0, 8)})`);
|
|
52647
52691
|
} catch {
|
|
52648
|
-
writeFileSync19(
|
|
52692
|
+
writeFileSync19(join61(checkpointDir, "checkpoint.json"), JSON.stringify({ cycle, timestamp: (/* @__PURE__ */ new Date()).toISOString(), mode: this.state.mode }, null, 2), "utf-8");
|
|
52649
52693
|
renderInfo(`Checkpoint saved: cycle ${cycle} (no git)`);
|
|
52650
52694
|
}
|
|
52651
52695
|
} catch (err) {
|
|
@@ -52703,14 +52747,14 @@ ${files.map((f) => `- [\`${f}\`](./${f})`).join("\n")}
|
|
|
52703
52747
|
---
|
|
52704
52748
|
*Auto-generated by open-agents dream engine*
|
|
52705
52749
|
`;
|
|
52706
|
-
writeFileSync19(
|
|
52750
|
+
writeFileSync19(join61(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
|
|
52707
52751
|
} catch {
|
|
52708
52752
|
}
|
|
52709
52753
|
}
|
|
52710
52754
|
/** Save dream state for resume/inspection */
|
|
52711
52755
|
saveDreamState() {
|
|
52712
52756
|
try {
|
|
52713
|
-
writeFileSync19(
|
|
52757
|
+
writeFileSync19(join61(this.dreamsDir, "dream-state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
|
|
52714
52758
|
} catch {
|
|
52715
52759
|
}
|
|
52716
52760
|
}
|
|
@@ -53085,7 +53129,7 @@ var init_bless_engine = __esm({
|
|
|
53085
53129
|
|
|
53086
53130
|
// packages/cli/dist/tui/dmn-engine.js
|
|
53087
53131
|
import { existsSync as existsSync45, readFileSync as readFileSync34, writeFileSync as writeFileSync20, mkdirSync as mkdirSync20, readdirSync as readdirSync15, unlinkSync as unlinkSync9 } from "node:fs";
|
|
53088
|
-
import { join as
|
|
53132
|
+
import { join as join62, basename as basename14 } from "node:path";
|
|
53089
53133
|
function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities, competence, reflectionBuffer) {
|
|
53090
53134
|
const competenceReport = competence.length > 0 ? competence.map((c3) => {
|
|
53091
53135
|
const rate = c3.attempts > 0 ? Math.round(c3.successes / c3.attempts * 100) : 0;
|
|
@@ -53205,8 +53249,8 @@ var init_dmn_engine = __esm({
|
|
|
53205
53249
|
constructor(config, repoRoot) {
|
|
53206
53250
|
this.config = config;
|
|
53207
53251
|
this.repoRoot = repoRoot;
|
|
53208
|
-
this.stateDir =
|
|
53209
|
-
this.historyDir =
|
|
53252
|
+
this.stateDir = join62(repoRoot, ".oa", "dmn");
|
|
53253
|
+
this.historyDir = join62(repoRoot, ".oa", "dmn", "cycles");
|
|
53210
53254
|
mkdirSync20(this.historyDir, { recursive: true });
|
|
53211
53255
|
this.loadState();
|
|
53212
53256
|
}
|
|
@@ -53796,8 +53840,8 @@ OUTPUT: Call task_complete with JSON:
|
|
|
53796
53840
|
async gatherMemoryTopics() {
|
|
53797
53841
|
const topics = [];
|
|
53798
53842
|
const dirs = [
|
|
53799
|
-
|
|
53800
|
-
|
|
53843
|
+
join62(this.repoRoot, ".oa", "memory"),
|
|
53844
|
+
join62(this.repoRoot, ".open-agents", "memory")
|
|
53801
53845
|
];
|
|
53802
53846
|
for (const dir of dirs) {
|
|
53803
53847
|
if (!existsSync45(dir))
|
|
@@ -53816,7 +53860,7 @@ OUTPUT: Call task_complete with JSON:
|
|
|
53816
53860
|
}
|
|
53817
53861
|
// ── State persistence ─────────────────────────────────────────────────
|
|
53818
53862
|
loadState() {
|
|
53819
|
-
const path =
|
|
53863
|
+
const path = join62(this.stateDir, "state.json");
|
|
53820
53864
|
if (existsSync45(path)) {
|
|
53821
53865
|
try {
|
|
53822
53866
|
this.state = JSON.parse(readFileSync34(path, "utf-8"));
|
|
@@ -53826,19 +53870,19 @@ OUTPUT: Call task_complete with JSON:
|
|
|
53826
53870
|
}
|
|
53827
53871
|
saveState() {
|
|
53828
53872
|
try {
|
|
53829
|
-
writeFileSync20(
|
|
53873
|
+
writeFileSync20(join62(this.stateDir, "state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
|
|
53830
53874
|
} catch {
|
|
53831
53875
|
}
|
|
53832
53876
|
}
|
|
53833
53877
|
saveCycleResult(result) {
|
|
53834
53878
|
try {
|
|
53835
53879
|
const filename = `cycle-${result.cycleNumber}-${Date.now()}.json`;
|
|
53836
|
-
writeFileSync20(
|
|
53880
|
+
writeFileSync20(join62(this.historyDir, filename), JSON.stringify(result, null, 2) + "\n", "utf-8");
|
|
53837
53881
|
const files = readdirSync15(this.historyDir).filter((f) => f.startsWith("cycle-") && f.endsWith(".json")).sort();
|
|
53838
53882
|
if (files.length > 50) {
|
|
53839
53883
|
for (const old of files.slice(0, files.length - 50)) {
|
|
53840
53884
|
try {
|
|
53841
|
-
unlinkSync9(
|
|
53885
|
+
unlinkSync9(join62(this.historyDir, old));
|
|
53842
53886
|
} catch {
|
|
53843
53887
|
}
|
|
53844
53888
|
}
|
|
@@ -53852,7 +53896,7 @@ OUTPUT: Call task_complete with JSON:
|
|
|
53852
53896
|
|
|
53853
53897
|
// packages/cli/dist/tui/snr-engine.js
|
|
53854
53898
|
import { existsSync as existsSync46, readdirSync as readdirSync16, readFileSync as readFileSync35 } from "node:fs";
|
|
53855
|
-
import { join as
|
|
53899
|
+
import { join as join63, basename as basename15 } from "node:path";
|
|
53856
53900
|
function computeDPrime(signalScores, noiseScores) {
|
|
53857
53901
|
if (signalScores.length === 0 || noiseScores.length === 0)
|
|
53858
53902
|
return 0;
|
|
@@ -54092,8 +54136,8 @@ Call task_complete with the JSON array when done.`, onEvent)
|
|
|
54092
54136
|
loadMemoryEntries(topics) {
|
|
54093
54137
|
const entries = [];
|
|
54094
54138
|
const dirs = [
|
|
54095
|
-
|
|
54096
|
-
|
|
54139
|
+
join63(this.repoRoot, ".oa", "memory"),
|
|
54140
|
+
join63(this.repoRoot, ".open-agents", "memory")
|
|
54097
54141
|
];
|
|
54098
54142
|
for (const dir of dirs) {
|
|
54099
54143
|
if (!existsSync46(dir))
|
|
@@ -54105,7 +54149,7 @@ Call task_complete with the JSON array when done.`, onEvent)
|
|
|
54105
54149
|
if (topics.length > 0 && !topics.includes(topic))
|
|
54106
54150
|
continue;
|
|
54107
54151
|
try {
|
|
54108
|
-
const data = JSON.parse(readFileSync35(
|
|
54152
|
+
const data = JSON.parse(readFileSync35(join63(dir, f), "utf-8"));
|
|
54109
54153
|
for (const [key, val] of Object.entries(data)) {
|
|
54110
54154
|
const value = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
54111
54155
|
entries.push({ topic, key, value });
|
|
@@ -54673,7 +54717,7 @@ var init_tool_policy = __esm({
|
|
|
54673
54717
|
|
|
54674
54718
|
// packages/cli/dist/tui/telegram-bridge.js
|
|
54675
54719
|
import { mkdirSync as mkdirSync21, existsSync as existsSync47, unlinkSync as unlinkSync10, readdirSync as readdirSync17, statSync as statSync15 } from "node:fs";
|
|
54676
|
-
import { join as
|
|
54720
|
+
import { join as join64, resolve as resolve30 } from "node:path";
|
|
54677
54721
|
import { writeFile as writeFileAsync } from "node:fs/promises";
|
|
54678
54722
|
function convertMarkdownToTelegramHTML(md) {
|
|
54679
54723
|
let html = md;
|
|
@@ -55438,7 +55482,7 @@ Telegram admin: @${msg.username}` : `Telegram ${isGroup ? "group" : "public"} ch
|
|
|
55438
55482
|
return null;
|
|
55439
55483
|
const buffer = Buffer.from(await res.arrayBuffer());
|
|
55440
55484
|
const fileName = `${Date.now()}-${fileId.slice(0, 8)}${extension}`;
|
|
55441
|
-
const localPath =
|
|
55485
|
+
const localPath = join64(this.mediaCacheDir, fileName);
|
|
55442
55486
|
await writeFileAsync(localPath, buffer);
|
|
55443
55487
|
return localPath;
|
|
55444
55488
|
} catch {
|
|
@@ -59075,7 +59119,7 @@ var init_mouse_filter = __esm({
|
|
|
59075
59119
|
import * as readline2 from "node:readline";
|
|
59076
59120
|
import { Writable } from "node:stream";
|
|
59077
59121
|
import { cwd } from "node:process";
|
|
59078
|
-
import { resolve as resolve31, join as
|
|
59122
|
+
import { resolve as resolve31, join as join65, dirname as dirname20, extname as extname11 } from "node:path";
|
|
59079
59123
|
import { createRequire as createRequire2 } from "node:module";
|
|
59080
59124
|
import { fileURLToPath as fileURLToPath12 } from "node:url";
|
|
59081
59125
|
import { readFileSync as readFileSync37, writeFileSync as writeFileSync21, appendFileSync as appendFileSync4, rmSync as rmSync3, readdirSync as readdirSync18, mkdirSync as mkdirSync22 } from "node:fs";
|
|
@@ -59100,9 +59144,9 @@ function getVersion3() {
|
|
|
59100
59144
|
const require2 = createRequire2(import.meta.url);
|
|
59101
59145
|
const thisDir = dirname20(fileURLToPath12(import.meta.url));
|
|
59102
59146
|
const candidates = [
|
|
59103
|
-
|
|
59104
|
-
|
|
59105
|
-
|
|
59147
|
+
join65(thisDir, "..", "package.json"),
|
|
59148
|
+
join65(thisDir, "..", "..", "package.json"),
|
|
59149
|
+
join65(thisDir, "..", "..", "..", "package.json")
|
|
59106
59150
|
];
|
|
59107
59151
|
for (const pkgPath of candidates) {
|
|
59108
59152
|
if (existsSync48(pkgPath)) {
|
|
@@ -59339,15 +59383,15 @@ Use task_status("${taskId}") or task_output("${taskId}") to check progress.`
|
|
|
59339
59383
|
function gatherMemorySnippets(root) {
|
|
59340
59384
|
const snippets = [];
|
|
59341
59385
|
const dirs = [
|
|
59342
|
-
|
|
59343
|
-
|
|
59386
|
+
join65(root, ".oa", "memory"),
|
|
59387
|
+
join65(root, ".open-agents", "memory")
|
|
59344
59388
|
];
|
|
59345
59389
|
for (const dir of dirs) {
|
|
59346
59390
|
if (!existsSync48(dir))
|
|
59347
59391
|
continue;
|
|
59348
59392
|
try {
|
|
59349
59393
|
for (const f of readdirSync18(dir).filter((f2) => f2.endsWith(".json"))) {
|
|
59350
|
-
const data = JSON.parse(readFileSync37(
|
|
59394
|
+
const data = JSON.parse(readFileSync37(join65(dir, f), "utf-8"));
|
|
59351
59395
|
for (const val of Object.values(data)) {
|
|
59352
59396
|
const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
59353
59397
|
if (v.length > 10)
|
|
@@ -59504,7 +59548,7 @@ ${metabolismMemories}
|
|
|
59504
59548
|
} catch {
|
|
59505
59549
|
}
|
|
59506
59550
|
try {
|
|
59507
|
-
const archeFile =
|
|
59551
|
+
const archeFile = join65(repoRoot, ".oa", "arche", "variants.json");
|
|
59508
59552
|
if (existsSync48(archeFile)) {
|
|
59509
59553
|
const variants = JSON.parse(readFileSync37(archeFile, "utf8"));
|
|
59510
59554
|
if (variants.length > 0) {
|
|
@@ -59643,7 +59687,7 @@ ${lines.join("\n")}
|
|
|
59643
59687
|
const compactionThreshold = modelTier === "small" ? 12e3 : modelTier === "medium" ? 24e3 : 4e4;
|
|
59644
59688
|
let identityInjection = "";
|
|
59645
59689
|
try {
|
|
59646
|
-
const ikStateFile =
|
|
59690
|
+
const ikStateFile = join65(repoRoot, ".oa", "identity", "self-state.json");
|
|
59647
59691
|
if (existsSync48(ikStateFile)) {
|
|
59648
59692
|
const selfState = JSON.parse(readFileSync37(ikStateFile, "utf8"));
|
|
59649
59693
|
const lines = [
|
|
@@ -60284,8 +60328,8 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
60284
60328
|
});
|
|
60285
60329
|
}
|
|
60286
60330
|
try {
|
|
60287
|
-
const ikDir =
|
|
60288
|
-
const ikFile =
|
|
60331
|
+
const ikDir = join65(repoRoot, ".oa", "identity");
|
|
60332
|
+
const ikFile = join65(ikDir, "self-state.json");
|
|
60289
60333
|
let ikState;
|
|
60290
60334
|
if (existsSync48(ikFile)) {
|
|
60291
60335
|
ikState = JSON.parse(readFileSync37(ikFile, "utf8"));
|
|
@@ -60331,7 +60375,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
60331
60375
|
} else {
|
|
60332
60376
|
renderTaskIncomplete(result.turns, result.toolCalls, result.durationMs, tokens);
|
|
60333
60377
|
try {
|
|
60334
|
-
const ikFile =
|
|
60378
|
+
const ikFile = join65(repoRoot, ".oa", "identity", "self-state.json");
|
|
60335
60379
|
if (existsSync48(ikFile)) {
|
|
60336
60380
|
const ikState = JSON.parse(readFileSync37(ikFile, "utf8"));
|
|
60337
60381
|
ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
|
|
@@ -60681,7 +60725,7 @@ Review its full output in the [${id}] tab or via full_sub_agent(action='output',
|
|
|
60681
60725
|
let p2pGateway = null;
|
|
60682
60726
|
let peerMesh = null;
|
|
60683
60727
|
let inferenceRouter = null;
|
|
60684
|
-
const secretVault = new SecretVault(
|
|
60728
|
+
const secretVault = new SecretVault(join65(repoRoot, ".oa", "vault.enc"));
|
|
60685
60729
|
let adminSessionKey = null;
|
|
60686
60730
|
const callSubAgents = /* @__PURE__ */ new Map();
|
|
60687
60731
|
const streamRenderer = new StreamRenderer();
|
|
@@ -60901,8 +60945,8 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
60901
60945
|
const hits = allCompletions.filter((c3) => c3.toLowerCase().startsWith(lower));
|
|
60902
60946
|
return [hits, line];
|
|
60903
60947
|
}
|
|
60904
|
-
const HISTORY_DIR =
|
|
60905
|
-
const HISTORY_FILE =
|
|
60948
|
+
const HISTORY_DIR = join65(homedir16(), ".open-agents");
|
|
60949
|
+
const HISTORY_FILE = join65(HISTORY_DIR, "repl-history");
|
|
60906
60950
|
const MAX_HISTORY_LINES = 500;
|
|
60907
60951
|
let savedHistory = [];
|
|
60908
60952
|
try {
|
|
@@ -61168,7 +61212,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
61168
61212
|
} catch {
|
|
61169
61213
|
}
|
|
61170
61214
|
try {
|
|
61171
|
-
const oaDir =
|
|
61215
|
+
const oaDir = join65(repoRoot, ".oa");
|
|
61172
61216
|
const reconnected = await ExposeGateway.checkAndReconnect(oaDir, {
|
|
61173
61217
|
onInfo: (msg) => writeContent(() => renderInfo(msg)),
|
|
61174
61218
|
onError: (msg) => writeContent(() => renderWarning(msg))
|
|
@@ -61191,7 +61235,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
61191
61235
|
} catch {
|
|
61192
61236
|
}
|
|
61193
61237
|
try {
|
|
61194
|
-
const oaDir =
|
|
61238
|
+
const oaDir = join65(repoRoot, ".oa");
|
|
61195
61239
|
const reconnectedP2P = await ExposeP2PGateway.checkAndReconnect(oaDir, new NexusTool(repoRoot), {
|
|
61196
61240
|
onInfo: (msg) => writeContent(() => renderInfo(msg)),
|
|
61197
61241
|
onError: (msg) => writeContent(() => renderWarning(msg))
|
|
@@ -62075,7 +62119,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
62075
62119
|
kind,
|
|
62076
62120
|
targetUrl,
|
|
62077
62121
|
authKey,
|
|
62078
|
-
stateDir:
|
|
62122
|
+
stateDir: join65(repoRoot, ".oa"),
|
|
62079
62123
|
passthrough: passthrough ?? false,
|
|
62080
62124
|
loadbalance: loadbalance ?? false,
|
|
62081
62125
|
endpointAuth: passthrough ? currentConfig.apiKey : void 0,
|
|
@@ -62123,7 +62167,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
62123
62167
|
await tunnelGateway.stop();
|
|
62124
62168
|
tunnelGateway = null;
|
|
62125
62169
|
}
|
|
62126
|
-
const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir:
|
|
62170
|
+
const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir: join65(repoRoot, ".oa") });
|
|
62127
62171
|
newTunnel.on("stats", (stats) => {
|
|
62128
62172
|
statusBar.setExposeStatus({
|
|
62129
62173
|
status: stats.status,
|
|
@@ -62392,8 +62436,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
62392
62436
|
writeContent(() => renderInfo(`Killed ${bgKilled} background task(s).`));
|
|
62393
62437
|
}
|
|
62394
62438
|
try {
|
|
62395
|
-
const nexusDir =
|
|
62396
|
-
const pidFile =
|
|
62439
|
+
const nexusDir = join65(repoRoot, OA_DIR, "nexus");
|
|
62440
|
+
const pidFile = join65(nexusDir, "daemon.pid");
|
|
62397
62441
|
if (existsSync48(pidFile)) {
|
|
62398
62442
|
const pid = parseInt(readFileSync37(pidFile, "utf8").trim(), 10);
|
|
62399
62443
|
if (pid > 0) {
|
|
@@ -62417,10 +62461,10 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
62417
62461
|
} catch {
|
|
62418
62462
|
}
|
|
62419
62463
|
try {
|
|
62420
|
-
const voiceDir2 =
|
|
62464
|
+
const voiceDir2 = join65(homedir16(), ".open-agents", "voice");
|
|
62421
62465
|
const voicePidFiles = ["luxtts-daemon.pid", "piper-daemon.pid"];
|
|
62422
62466
|
for (const pf of voicePidFiles) {
|
|
62423
|
-
const pidPath =
|
|
62467
|
+
const pidPath = join65(voiceDir2, pf);
|
|
62424
62468
|
if (existsSync48(pidPath)) {
|
|
62425
62469
|
try {
|
|
62426
62470
|
const pid = parseInt(readFileSync37(pidPath, "utf8").trim(), 10);
|
|
@@ -62447,7 +62491,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
62447
62491
|
execSync32(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.5", { timeout: 3e3, stdio: "ignore" });
|
|
62448
62492
|
} catch {
|
|
62449
62493
|
}
|
|
62450
|
-
const oaPath =
|
|
62494
|
+
const oaPath = join65(repoRoot, OA_DIR);
|
|
62451
62495
|
if (existsSync48(oaPath)) {
|
|
62452
62496
|
let deleted = false;
|
|
62453
62497
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
@@ -63329,8 +63373,8 @@ async function runWithTUI(task, config, repoPath) {
|
|
|
63329
63373
|
const handle = startTask(task, config, repoRoot);
|
|
63330
63374
|
await handle.promise;
|
|
63331
63375
|
try {
|
|
63332
|
-
const ikDir =
|
|
63333
|
-
const ikFile =
|
|
63376
|
+
const ikDir = join65(repoRoot, ".oa", "identity");
|
|
63377
|
+
const ikFile = join65(ikDir, "self-state.json");
|
|
63334
63378
|
let ikState;
|
|
63335
63379
|
if (existsSync48(ikFile)) {
|
|
63336
63380
|
ikState = JSON.parse(readFileSync37(ikFile, "utf8"));
|
|
@@ -63366,8 +63410,8 @@ async function runWithTUI(task, config, repoPath) {
|
|
|
63366
63410
|
ec.archiveVariantSync(`Task: ${task.slice(0, 200)}`, "success \u2014 completed", ["general"]);
|
|
63367
63411
|
} catch {
|
|
63368
63412
|
try {
|
|
63369
|
-
const archeDir =
|
|
63370
|
-
const archeFile =
|
|
63413
|
+
const archeDir = join65(repoRoot, ".oa", "arche");
|
|
63414
|
+
const archeFile = join65(archeDir, "variants.json");
|
|
63371
63415
|
let variants = [];
|
|
63372
63416
|
try {
|
|
63373
63417
|
if (existsSync48(archeFile))
|
|
@@ -63392,7 +63436,7 @@ async function runWithTUI(task, config, repoPath) {
|
|
|
63392
63436
|
}
|
|
63393
63437
|
}
|
|
63394
63438
|
try {
|
|
63395
|
-
const metaFile =
|
|
63439
|
+
const metaFile = join65(repoRoot, ".oa", "memory", "metabolism", "store.json");
|
|
63396
63440
|
if (existsSync48(metaFile)) {
|
|
63397
63441
|
const store = JSON.parse(readFileSync37(metaFile, "utf8"));
|
|
63398
63442
|
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);
|
|
@@ -63458,9 +63502,9 @@ Rules:
|
|
|
63458
63502
|
try {
|
|
63459
63503
|
const { initDb: initDb2 } = __require("@open-agents/memory");
|
|
63460
63504
|
const { ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
|
|
63461
|
-
const dbDir =
|
|
63505
|
+
const dbDir = join65(repoRoot, ".oa", "memory");
|
|
63462
63506
|
mkdirSync22(dbDir, { recursive: true });
|
|
63463
|
-
const db = initDb2(
|
|
63507
|
+
const db = initDb2(join65(dbDir, "structured.db"));
|
|
63464
63508
|
const memStore = new ProceduralMemoryStore2(db);
|
|
63465
63509
|
memStore.createWithEmbedding({
|
|
63466
63510
|
content: content.slice(0, 600),
|
|
@@ -63475,8 +63519,8 @@ Rules:
|
|
|
63475
63519
|
db.close();
|
|
63476
63520
|
} catch {
|
|
63477
63521
|
}
|
|
63478
|
-
const metaDir =
|
|
63479
|
-
const storeFile =
|
|
63522
|
+
const metaDir = join65(repoRoot, ".oa", "memory", "metabolism");
|
|
63523
|
+
const storeFile = join65(metaDir, "store.json");
|
|
63480
63524
|
let store = [];
|
|
63481
63525
|
try {
|
|
63482
63526
|
if (existsSync48(storeFile))
|
|
@@ -63503,7 +63547,7 @@ Rules:
|
|
|
63503
63547
|
} catch {
|
|
63504
63548
|
}
|
|
63505
63549
|
try {
|
|
63506
|
-
const cohereSettingsFile =
|
|
63550
|
+
const cohereSettingsFile = join65(repoRoot, ".oa", "settings.json");
|
|
63507
63551
|
let cohereActive = false;
|
|
63508
63552
|
try {
|
|
63509
63553
|
if (existsSync48(cohereSettingsFile)) {
|
|
@@ -63513,7 +63557,7 @@ Rules:
|
|
|
63513
63557
|
} catch {
|
|
63514
63558
|
}
|
|
63515
63559
|
if (cohereActive) {
|
|
63516
|
-
const metaFile =
|
|
63560
|
+
const metaFile = join65(repoRoot, ".oa", "memory", "metabolism", "store.json");
|
|
63517
63561
|
if (existsSync48(metaFile)) {
|
|
63518
63562
|
const store = JSON.parse(readFileSync37(metaFile, "utf8"));
|
|
63519
63563
|
const latest = store.filter((m) => m.sourceTrace === "trajectory-extraction" || m.sourceTrace === "llm-trajectory-extraction").slice(-1)[0];
|
|
@@ -63540,7 +63584,7 @@ Rules:
|
|
|
63540
63584
|
}
|
|
63541
63585
|
} catch (err) {
|
|
63542
63586
|
try {
|
|
63543
|
-
const ikFile =
|
|
63587
|
+
const ikFile = join65(repoRoot, ".oa", "identity", "self-state.json");
|
|
63544
63588
|
if (existsSync48(ikFile)) {
|
|
63545
63589
|
const ikState = JSON.parse(readFileSync37(ikFile, "utf8"));
|
|
63546
63590
|
ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
|
|
@@ -63549,7 +63593,7 @@ Rules:
|
|
|
63549
63593
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
63550
63594
|
writeFileSync21(ikFile, JSON.stringify(ikState, null, 2));
|
|
63551
63595
|
}
|
|
63552
|
-
const metaFile =
|
|
63596
|
+
const metaFile = join65(repoRoot, ".oa", "memory", "metabolism", "store.json");
|
|
63553
63597
|
if (existsSync48(metaFile)) {
|
|
63554
63598
|
const store = JSON.parse(readFileSync37(metaFile, "utf8"));
|
|
63555
63599
|
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);
|
|
@@ -63562,8 +63606,8 @@ Rules:
|
|
|
63562
63606
|
writeFileSync21(metaFile, JSON.stringify(store, null, 2));
|
|
63563
63607
|
}
|
|
63564
63608
|
try {
|
|
63565
|
-
const archeDir =
|
|
63566
|
-
const archeFile =
|
|
63609
|
+
const archeDir = join65(repoRoot, ".oa", "arche");
|
|
63610
|
+
const archeFile = join65(archeDir, "variants.json");
|
|
63567
63611
|
let variants = [];
|
|
63568
63612
|
try {
|
|
63569
63613
|
if (existsSync48(archeFile))
|
|
@@ -63672,7 +63716,7 @@ import { glob } from "glob";
|
|
|
63672
63716
|
import ignore from "ignore";
|
|
63673
63717
|
import { readFile as readFile23, stat as stat4 } from "node:fs/promises";
|
|
63674
63718
|
import { createHash as createHash4 } from "node:crypto";
|
|
63675
|
-
import { join as
|
|
63719
|
+
import { join as join66, relative as relative4, extname as extname12, basename as basename16 } from "node:path";
|
|
63676
63720
|
var DEFAULT_EXCLUDE, LANGUAGE_MAP, CodebaseIndexer;
|
|
63677
63721
|
var init_codebase_indexer = __esm({
|
|
63678
63722
|
"packages/indexer/dist/codebase-indexer.js"() {
|
|
@@ -63716,7 +63760,7 @@ var init_codebase_indexer = __esm({
|
|
|
63716
63760
|
const ig = ignore.default();
|
|
63717
63761
|
if (this.config.respectGitignore) {
|
|
63718
63762
|
try {
|
|
63719
|
-
const gitignoreContent = await readFile23(
|
|
63763
|
+
const gitignoreContent = await readFile23(join66(this.config.rootDir, ".gitignore"), "utf-8");
|
|
63720
63764
|
ig.add(gitignoreContent);
|
|
63721
63765
|
} catch {
|
|
63722
63766
|
}
|
|
@@ -63731,7 +63775,7 @@ var init_codebase_indexer = __esm({
|
|
|
63731
63775
|
for (const relativePath of files) {
|
|
63732
63776
|
if (ig.ignores(relativePath))
|
|
63733
63777
|
continue;
|
|
63734
|
-
const fullPath =
|
|
63778
|
+
const fullPath = join66(this.config.rootDir, relativePath);
|
|
63735
63779
|
try {
|
|
63736
63780
|
const fileStat = await stat4(fullPath);
|
|
63737
63781
|
if (fileStat.size > this.config.maxFileSize)
|
|
@@ -63777,7 +63821,7 @@ var init_codebase_indexer = __esm({
|
|
|
63777
63821
|
if (!child) {
|
|
63778
63822
|
child = {
|
|
63779
63823
|
name: part,
|
|
63780
|
-
path:
|
|
63824
|
+
path: join66(current.path, part),
|
|
63781
63825
|
type: "directory",
|
|
63782
63826
|
children: []
|
|
63783
63827
|
};
|
|
@@ -64118,7 +64162,7 @@ var config_exports = {};
|
|
|
64118
64162
|
__export(config_exports, {
|
|
64119
64163
|
configCommand: () => configCommand
|
|
64120
64164
|
});
|
|
64121
|
-
import { join as
|
|
64165
|
+
import { join as join67, resolve as resolve33 } from "node:path";
|
|
64122
64166
|
import { homedir as homedir17 } from "node:os";
|
|
64123
64167
|
import { cwd as cwd3 } from "node:process";
|
|
64124
64168
|
function redactIfSensitive(key, value) {
|
|
@@ -64201,7 +64245,7 @@ function handleShow(opts, config) {
|
|
|
64201
64245
|
}
|
|
64202
64246
|
}
|
|
64203
64247
|
printSection("Config File");
|
|
64204
|
-
printInfo(`~/.open-agents/config.json (${
|
|
64248
|
+
printInfo(`~/.open-agents/config.json (${join67(homedir17(), ".open-agents", "config.json")})`);
|
|
64205
64249
|
printSection("Priority Chain");
|
|
64206
64250
|
printInfo(" 1. CLI flags (--model, --backend-url, etc.)");
|
|
64207
64251
|
printInfo(" 2. Project .oa/settings.json (--local)");
|
|
@@ -64240,7 +64284,7 @@ function handleSet(opts, _config) {
|
|
|
64240
64284
|
const coerced = coerceForSettings(key, value);
|
|
64241
64285
|
saveProjectSettings(repoRoot, { [key]: coerced });
|
|
64242
64286
|
printSuccess(`Project override set: ${key} = ${redactIfSensitive(key, value)}`);
|
|
64243
|
-
printInfo(`Saved to ${
|
|
64287
|
+
printInfo(`Saved to ${join67(repoRoot, ".oa", "settings.json")}`);
|
|
64244
64288
|
printInfo("This override applies only when running in this workspace.");
|
|
64245
64289
|
} catch (err) {
|
|
64246
64290
|
printError(`Failed to save: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -64499,7 +64543,7 @@ __export(eval_exports, {
|
|
|
64499
64543
|
});
|
|
64500
64544
|
import { tmpdir as tmpdir10 } from "node:os";
|
|
64501
64545
|
import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync22 } from "node:fs";
|
|
64502
|
-
import { join as
|
|
64546
|
+
import { join as join68 } from "node:path";
|
|
64503
64547
|
async function evalCommand(opts, config) {
|
|
64504
64548
|
const suiteName = opts.suite ?? "basic";
|
|
64505
64549
|
const suite = SUITES[suiteName];
|
|
@@ -64624,9 +64668,9 @@ async function evalCommand(opts, config) {
|
|
|
64624
64668
|
process.exit(failed > 0 ? 1 : 0);
|
|
64625
64669
|
}
|
|
64626
64670
|
function createTempEvalRepo() {
|
|
64627
|
-
const dir =
|
|
64671
|
+
const dir = join68(tmpdir10(), `open-agents-eval-${Date.now()}`);
|
|
64628
64672
|
mkdirSync23(dir, { recursive: true });
|
|
64629
|
-
writeFileSync22(
|
|
64673
|
+
writeFileSync22(join68(dir, "package.json"), JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n", "utf8");
|
|
64630
64674
|
return dir;
|
|
64631
64675
|
}
|
|
64632
64676
|
var BASIC_SUITE, FULL_SUITE, SUITES;
|
|
@@ -64686,7 +64730,7 @@ init_updater();
|
|
|
64686
64730
|
import { parseArgs as nodeParseArgs2 } from "node:util";
|
|
64687
64731
|
import { createRequire as createRequire3 } from "node:module";
|
|
64688
64732
|
import { fileURLToPath as fileURLToPath13 } from "node:url";
|
|
64689
|
-
import { dirname as dirname21, join as
|
|
64733
|
+
import { dirname as dirname21, join as join69 } from "node:path";
|
|
64690
64734
|
|
|
64691
64735
|
// packages/cli/dist/cli.js
|
|
64692
64736
|
import { createInterface } from "node:readline";
|
|
@@ -64793,7 +64837,7 @@ init_output();
|
|
|
64793
64837
|
function getVersion4() {
|
|
64794
64838
|
try {
|
|
64795
64839
|
const require2 = createRequire3(import.meta.url);
|
|
64796
|
-
const pkgPath =
|
|
64840
|
+
const pkgPath = join69(dirname21(fileURLToPath13(import.meta.url)), "..", "package.json");
|
|
64797
64841
|
const pkg = require2(pkgPath);
|
|
64798
64842
|
return pkg.version;
|
|
64799
64843
|
} catch {
|