open-agents-ai 0.165.0 → 0.167.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 +372 -333
- 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,7 +43923,7 @@ 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)) {
|
|
@@ -43996,7 +44032,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
43996
44032
|
if (!existsSync39(refsDir))
|
|
43997
44033
|
return;
|
|
43998
44034
|
for (const name of ["custom-clone.wav", "custom-clone.mp3", "glados-ref.wav", "overwatch-ref.wav"]) {
|
|
43999
|
-
const p =
|
|
44035
|
+
const p = join55(refsDir, name);
|
|
44000
44036
|
if (existsSync39(p)) {
|
|
44001
44037
|
this.luxttsCloneRef = p;
|
|
44002
44038
|
return;
|
|
@@ -44197,7 +44233,7 @@ if __name__ == '__main__':
|
|
|
44197
44233
|
const ready = await this.ensureLuxttsDaemon();
|
|
44198
44234
|
if (!ready)
|
|
44199
44235
|
return null;
|
|
44200
|
-
const wavPath =
|
|
44236
|
+
const wavPath = join55(tmpdir9(), `oa-luxtts-${Date.now()}-${Math.random().toString(36).slice(2, 6)}.wav`);
|
|
44201
44237
|
try {
|
|
44202
44238
|
await this.luxttsRequest({
|
|
44203
44239
|
action: "synthesize",
|
|
@@ -44310,7 +44346,7 @@ if __name__ == '__main__':
|
|
|
44310
44346
|
const ready = await this.ensureLuxttsDaemon();
|
|
44311
44347
|
if (!ready)
|
|
44312
44348
|
return null;
|
|
44313
|
-
const wavPath =
|
|
44349
|
+
const wavPath = join55(tmpdir9(), `oa-luxtts-buf-${Date.now()}.wav`);
|
|
44314
44350
|
try {
|
|
44315
44351
|
await this.luxttsRequest({
|
|
44316
44352
|
action: "synthesize",
|
|
@@ -44340,7 +44376,7 @@ if __name__ == '__main__':
|
|
|
44340
44376
|
return;
|
|
44341
44377
|
const arch2 = process.arch;
|
|
44342
44378
|
mkdirSync15(voiceDir(), { recursive: true });
|
|
44343
|
-
const pkgPath =
|
|
44379
|
+
const pkgPath = join55(voiceDir(), "package.json");
|
|
44344
44380
|
const expectedDeps = {
|
|
44345
44381
|
"onnxruntime-node": "^1.21.0",
|
|
44346
44382
|
"phonemizer": "^1.2.1"
|
|
@@ -44362,16 +44398,16 @@ if __name__ == '__main__':
|
|
|
44362
44398
|
dependencies: expectedDeps
|
|
44363
44399
|
}, null, 2));
|
|
44364
44400
|
}
|
|
44365
|
-
const voiceRequire = createRequire(
|
|
44401
|
+
const voiceRequire = createRequire(join55(voiceDir(), "index.js"));
|
|
44366
44402
|
const probeOnnx = async () => {
|
|
44367
44403
|
try {
|
|
44368
|
-
const output = await this.asyncShell(`NODE_PATH="${
|
|
44404
|
+
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
44405
|
return output.trim() === "OK";
|
|
44370
44406
|
} catch {
|
|
44371
44407
|
return false;
|
|
44372
44408
|
}
|
|
44373
44409
|
};
|
|
44374
|
-
const onnxNodeModules =
|
|
44410
|
+
const onnxNodeModules = join55(voiceDir(), "node_modules", "onnxruntime-node");
|
|
44375
44411
|
const onnxInstalled = existsSync39(onnxNodeModules);
|
|
44376
44412
|
if (onnxInstalled && !await probeOnnx()) {
|
|
44377
44413
|
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 +44537,7 @@ Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
|
44501
44537
|
import * as nodeOs from "node:os";
|
|
44502
44538
|
import { execSync as nodeExecSync } from "node:child_process";
|
|
44503
44539
|
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
|
|
44540
|
+
import { join as join56 } from "node:path";
|
|
44505
44541
|
function safeLog(text) {
|
|
44506
44542
|
if (isNeovimActive()) {
|
|
44507
44543
|
writeToNeovimOutput(text + "\n");
|
|
@@ -45110,8 +45146,8 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45110
45146
|
let content = "";
|
|
45111
45147
|
let metadata = {};
|
|
45112
45148
|
if (shareType === "tool") {
|
|
45113
|
-
const toolDir =
|
|
45114
|
-
const toolFile =
|
|
45149
|
+
const toolDir = join56(ctx.repoRoot, ".oa", "tools");
|
|
45150
|
+
const toolFile = join56(toolDir, shareName.endsWith(".json") ? shareName : `${shareName}.json`);
|
|
45115
45151
|
if (!existsSync40(toolFile)) {
|
|
45116
45152
|
renderWarning(`Tool not found: ${toolFile}`);
|
|
45117
45153
|
return "handled";
|
|
@@ -45119,8 +45155,8 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45119
45155
|
content = readFileSync29(toolFile, "utf8");
|
|
45120
45156
|
metadata = { type: "tool", name: shareName };
|
|
45121
45157
|
} else if (shareType === "skill") {
|
|
45122
|
-
const skillDir =
|
|
45123
|
-
const skillFile =
|
|
45158
|
+
const skillDir = join56(ctx.repoRoot, ".oa", "skills", shareName);
|
|
45159
|
+
const skillFile = join56(skillDir, "SKILL.md");
|
|
45124
45160
|
if (!existsSync40(skillFile)) {
|
|
45125
45161
|
renderWarning(`Skill not found: ${skillFile}`);
|
|
45126
45162
|
return "handled";
|
|
@@ -45164,7 +45200,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45164
45200
|
const { NexusTool: NexusTool2 } = __require("@open-agents/execution");
|
|
45165
45201
|
const nexus = new NexusTool2(ctx.repoRoot);
|
|
45166
45202
|
await nexus.execute({ action: "ipfs_pin", cid: importCid, source: "import" });
|
|
45167
|
-
const regFile =
|
|
45203
|
+
const regFile = join56(ctx.repoRoot, ".oa", "nexus", "ipfs", "cid-registry", "learning-cids.json");
|
|
45168
45204
|
if (existsSync40(regFile)) {
|
|
45169
45205
|
const reg = JSON.parse(readFileSync29(regFile, "utf8"));
|
|
45170
45206
|
const pinned = Object.values(reg).some((e) => e.cid === importCid && e.pinned);
|
|
@@ -45219,8 +45255,8 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45219
45255
|
lines.push(`
|
|
45220
45256
|
${c2.bold("IPFS / Helia Status")}
|
|
45221
45257
|
`);
|
|
45222
|
-
const ipfsDir =
|
|
45223
|
-
const ipfsLocalDir =
|
|
45258
|
+
const ipfsDir = join56(ctx.repoRoot, ".oa", "ipfs");
|
|
45259
|
+
const ipfsLocalDir = join56(ipfsDir, "local");
|
|
45224
45260
|
let ipfsFiles = 0;
|
|
45225
45261
|
let ipfsBytes = 0;
|
|
45226
45262
|
let heliaBlocks = 0;
|
|
@@ -45231,21 +45267,21 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45231
45267
|
ipfsFiles = files.length;
|
|
45232
45268
|
for (const f of files) {
|
|
45233
45269
|
try {
|
|
45234
|
-
ipfsBytes += statSync14(
|
|
45270
|
+
ipfsBytes += statSync14(join56(ipfsLocalDir, f)).size;
|
|
45235
45271
|
} catch {
|
|
45236
45272
|
}
|
|
45237
45273
|
}
|
|
45238
45274
|
}
|
|
45239
|
-
const heliaBlockDir =
|
|
45275
|
+
const heliaBlockDir = join56(ipfsDir, "blocks");
|
|
45240
45276
|
if (existsSync40(heliaBlockDir)) {
|
|
45241
45277
|
const walkDir = (dir) => {
|
|
45242
45278
|
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
45243
45279
|
if (entry.isDirectory())
|
|
45244
|
-
walkDir(
|
|
45280
|
+
walkDir(join56(dir, entry.name));
|
|
45245
45281
|
else {
|
|
45246
45282
|
heliaBlocks++;
|
|
45247
45283
|
try {
|
|
45248
|
-
heliaBytes += statSync14(
|
|
45284
|
+
heliaBytes += statSync14(join56(dir, entry.name)).size;
|
|
45249
45285
|
} catch {
|
|
45250
45286
|
}
|
|
45251
45287
|
}
|
|
@@ -45261,7 +45297,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45261
45297
|
lines.push(` Blocks: ${c2.bold(String(heliaBlocks))} Size: ${c2.bold(formatFileSize(heliaBytes))}`);
|
|
45262
45298
|
lines.push(` Backend: ${heliaBlocks > 0 ? c2.green("helia-ipfs") : c2.yellow("sha256-local (Helia not initialized)")}`);
|
|
45263
45299
|
try {
|
|
45264
|
-
const statusFile =
|
|
45300
|
+
const statusFile = join56(ctx.repoRoot, ".oa", "nexus", "status.json");
|
|
45265
45301
|
if (existsSync40(statusFile)) {
|
|
45266
45302
|
const status = JSON.parse(readFileSync29(statusFile, "utf8"));
|
|
45267
45303
|
if (status.peerId) {
|
|
@@ -45282,9 +45318,9 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45282
45318
|
${c2.dim("Commands: /ipfs pin <CID> /ipfs publish /ipfs cids")}`);
|
|
45283
45319
|
lines.push(`
|
|
45284
45320
|
${c2.bold("Identity Kernel")}`);
|
|
45285
|
-
const idDir =
|
|
45321
|
+
const idDir = join56(ctx.repoRoot, ".oa", "identity");
|
|
45286
45322
|
try {
|
|
45287
|
-
const stateFile =
|
|
45323
|
+
const stateFile = join56(idDir, "self-state.json");
|
|
45288
45324
|
if (existsSync40(stateFile)) {
|
|
45289
45325
|
const state = JSON.parse(readFileSync29(stateFile, "utf8"));
|
|
45290
45326
|
lines.push(` Version: ${c2.bold("v" + (state.version ?? "?"))} Sessions: ${c2.bold(String(state.session_count ?? 0))}`);
|
|
@@ -45295,7 +45331,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45295
45331
|
const traits = typeof state.personality_traits === "object" ? Object.entries(state.personality_traits).map(([k, v]) => `${k}:${v}`).join(", ") : String(state.personality_traits);
|
|
45296
45332
|
lines.push(` Traits: ${c2.dim(traits.slice(0, 60))}`);
|
|
45297
45333
|
}
|
|
45298
|
-
const cidFile =
|
|
45334
|
+
const cidFile = join56(idDir, "cids.json");
|
|
45299
45335
|
if (existsSync40(cidFile)) {
|
|
45300
45336
|
const cids = JSON.parse(readFileSync29(cidFile, "utf8"));
|
|
45301
45337
|
const lastCid = Array.isArray(cids) ? cids[cids.length - 1] : cids.latest;
|
|
@@ -45310,7 +45346,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45310
45346
|
lines.push(`
|
|
45311
45347
|
${c2.bold("Memory Sentiment")}`);
|
|
45312
45348
|
try {
|
|
45313
|
-
const metaFile =
|
|
45349
|
+
const metaFile = join56(ctx.repoRoot, ".oa", "memory", "metabolism", "store.json");
|
|
45314
45350
|
if (existsSync40(metaFile)) {
|
|
45315
45351
|
const store = JSON.parse(readFileSync29(metaFile, "utf8"));
|
|
45316
45352
|
const active = store.filter((m) => m.type !== "quarantine");
|
|
@@ -45330,7 +45366,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45330
45366
|
} catch {
|
|
45331
45367
|
}
|
|
45332
45368
|
try {
|
|
45333
|
-
const dbPath =
|
|
45369
|
+
const dbPath = join56(ctx.repoRoot, ".oa", "memory", "structured.db");
|
|
45334
45370
|
if (existsSync40(dbPath)) {
|
|
45335
45371
|
const { initDb: initDb2, closeDb: cDb, ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
|
|
45336
45372
|
const db = initDb2(dbPath);
|
|
@@ -45352,7 +45388,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45352
45388
|
lines.push(`
|
|
45353
45389
|
${c2.bold("Storage Overview")}
|
|
45354
45390
|
`);
|
|
45355
|
-
const oaDir =
|
|
45391
|
+
const oaDir = join56(ctx.repoRoot, ".oa");
|
|
45356
45392
|
if (!existsSync40(oaDir)) {
|
|
45357
45393
|
lines.push(` ${c2.dim("No .oa/ directory found.")}`);
|
|
45358
45394
|
safeLog(lines.join("\n") + "\n");
|
|
@@ -45363,7 +45399,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45363
45399
|
const walkStorage = (dir, category) => {
|
|
45364
45400
|
try {
|
|
45365
45401
|
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
45366
|
-
const full =
|
|
45402
|
+
const full = join56(dir, entry.name);
|
|
45367
45403
|
if (entry.isDirectory()) {
|
|
45368
45404
|
const subCat = category || entry.name;
|
|
45369
45405
|
walkStorage(full, subCat);
|
|
@@ -45399,10 +45435,10 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45399
45435
|
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
45400
45436
|
const name = entry.name.toLowerCase();
|
|
45401
45437
|
if (sensitivePatterns.some((p) => name.includes(p))) {
|
|
45402
|
-
sensitiveFound.push(
|
|
45438
|
+
sensitiveFound.push(join56(dir, entry.name).replace(oaDir + "/", ""));
|
|
45403
45439
|
}
|
|
45404
45440
|
if (entry.isDirectory())
|
|
45405
|
-
checkSensitive(
|
|
45441
|
+
checkSensitive(join56(dir, entry.name));
|
|
45406
45442
|
}
|
|
45407
45443
|
} catch {
|
|
45408
45444
|
}
|
|
@@ -45430,7 +45466,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45430
45466
|
renderInfo("Supported: .wav .mp3 .flac .ogg (audio\u2192transcribe) | .pdf .txt .md (text\u2192chunk)");
|
|
45431
45467
|
return "handled";
|
|
45432
45468
|
}
|
|
45433
|
-
const resolvedPath =
|
|
45469
|
+
const resolvedPath = join56(ctx.repoRoot, filePath);
|
|
45434
45470
|
if (!existsSync40(resolvedPath)) {
|
|
45435
45471
|
renderWarning(`File not found: ${resolvedPath}`);
|
|
45436
45472
|
return "handled";
|
|
@@ -45447,9 +45483,9 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45447
45483
|
}
|
|
45448
45484
|
try {
|
|
45449
45485
|
const { initDb: initDb2, closeDb: cDb, ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
|
|
45450
|
-
const dbDir =
|
|
45486
|
+
const dbDir = join56(ctx.repoRoot, ".oa", "memory");
|
|
45451
45487
|
mkdirSync16(dbDir, { recursive: true });
|
|
45452
|
-
const db = initDb2(
|
|
45488
|
+
const db = initDb2(join56(dbDir, "structured.db"));
|
|
45453
45489
|
const memStore = new ProceduralMemoryStore2(db);
|
|
45454
45490
|
if (isAudio) {
|
|
45455
45491
|
renderInfo(`Transcribing: ${filePath}...`);
|
|
@@ -45529,8 +45565,8 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45529
45565
|
}
|
|
45530
45566
|
case "fortemi": {
|
|
45531
45567
|
const fortemiSubCmd = (arg || "").trim().toLowerCase();
|
|
45532
|
-
const fortemiDir =
|
|
45533
|
-
const altFortemiDir =
|
|
45568
|
+
const fortemiDir = join56(ctx.repoRoot, "..", "fortemi-react");
|
|
45569
|
+
const altFortemiDir = join56(nodeOs.homedir(), "fortemi-react");
|
|
45534
45570
|
const fDir = existsSync40(fortemiDir) ? fortemiDir : existsSync40(altFortemiDir) ? altFortemiDir : null;
|
|
45535
45571
|
if (fortemiSubCmd === "start" || fortemiSubCmd === "") {
|
|
45536
45572
|
if (!fDir) {
|
|
@@ -45546,14 +45582,14 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45546
45582
|
// 24h
|
|
45547
45583
|
nonce: Math.random().toString(36).slice(2, 10)
|
|
45548
45584
|
};
|
|
45549
|
-
const jwtFile =
|
|
45550
|
-
mkdirSync16(
|
|
45585
|
+
const jwtFile = join56(ctx.repoRoot, ".oa", "fortemi-jwt.json");
|
|
45586
|
+
mkdirSync16(join56(ctx.repoRoot, ".oa"), { recursive: true });
|
|
45551
45587
|
writeFileSync17(jwtFile, JSON.stringify(jwtPayload, null, 2));
|
|
45552
45588
|
renderInfo(`Launching fortemi-react from ${fDir}...`);
|
|
45553
45589
|
try {
|
|
45554
45590
|
const { spawn: spawn21 } = __require("node:child_process");
|
|
45555
45591
|
const child = spawn21("npx", ["vite", "dev", "--host", "0.0.0.0", "--port", "3000"], {
|
|
45556
|
-
cwd:
|
|
45592
|
+
cwd: join56(fDir, "apps", "standalone"),
|
|
45557
45593
|
stdio: "ignore",
|
|
45558
45594
|
detached: true,
|
|
45559
45595
|
env: { ...process.env, OA_JWT: JSON.stringify(jwtPayload) }
|
|
@@ -45562,7 +45598,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45562
45598
|
renderInfo("Fortemi-React starting on http://localhost:3000");
|
|
45563
45599
|
renderInfo(`JWT saved to ${jwtFile}`);
|
|
45564
45600
|
renderInfo("Memory operations will proxy to fortemi when available.");
|
|
45565
|
-
const bridgeFile =
|
|
45601
|
+
const bridgeFile = join56(ctx.repoRoot, ".oa", "fortemi-bridge.json");
|
|
45566
45602
|
writeFileSync17(bridgeFile, JSON.stringify({
|
|
45567
45603
|
url: "http://localhost:3000",
|
|
45568
45604
|
pid: child.pid,
|
|
@@ -45575,7 +45611,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45575
45611
|
return "handled";
|
|
45576
45612
|
}
|
|
45577
45613
|
if (fortemiSubCmd === "status") {
|
|
45578
|
-
const bridgeFile =
|
|
45614
|
+
const bridgeFile = join56(ctx.repoRoot, ".oa", "fortemi-bridge.json");
|
|
45579
45615
|
if (!existsSync40(bridgeFile)) {
|
|
45580
45616
|
renderInfo("Fortemi bridge: not connected. Run /fortemi start");
|
|
45581
45617
|
return "handled";
|
|
@@ -45606,7 +45642,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
45606
45642
|
return "handled";
|
|
45607
45643
|
}
|
|
45608
45644
|
if (fortemiSubCmd === "stop") {
|
|
45609
|
-
const bridgeFile =
|
|
45645
|
+
const bridgeFile = join56(ctx.repoRoot, ".oa", "fortemi-bridge.json");
|
|
45610
45646
|
if (existsSync40(bridgeFile)) {
|
|
45611
45647
|
const bridge = JSON.parse(readFileSync29(bridgeFile, "utf8"));
|
|
45612
45648
|
try {
|
|
@@ -46987,13 +47023,13 @@ async function showCohereDashboard(ctx) {
|
|
|
46987
47023
|
} else if (idResult.key === "view") {
|
|
46988
47024
|
await ik.execute({ operation: "hydrate" });
|
|
46989
47025
|
} else if (idResult.key === "history") {
|
|
46990
|
-
const snapDir =
|
|
47026
|
+
const snapDir = join56(ctx.repoRoot, ".oa", "identity", "snapshots");
|
|
46991
47027
|
if (existsSync40(snapDir)) {
|
|
46992
47028
|
const snaps = readdirSync11(snapDir).filter((f) => f.endsWith(".json")).sort().reverse();
|
|
46993
47029
|
const snapItems = snaps.slice(0, 20).map((f) => ({
|
|
46994
47030
|
key: f,
|
|
46995
47031
|
label: f.replace(".json", ""),
|
|
46996
|
-
detail: `${formatFileSize(statSync14(
|
|
47032
|
+
detail: `${formatFileSize(statSync14(join56(snapDir, f)).size)}`
|
|
46997
47033
|
}));
|
|
46998
47034
|
if (snapItems.length > 0) {
|
|
46999
47035
|
await tuiSelect({
|
|
@@ -47807,8 +47843,8 @@ async function handlePeerEndpoint(peerId, authKey, ctx, local) {
|
|
|
47807
47843
|
if (models.length > 0) {
|
|
47808
47844
|
try {
|
|
47809
47845
|
const { writeFileSync: writeFileSync23, mkdirSync: mkdirSync24 } = await import("node:fs");
|
|
47810
|
-
const { join:
|
|
47811
|
-
const cachePath =
|
|
47846
|
+
const { join: join70, dirname: dirname22 } = await import("node:path");
|
|
47847
|
+
const cachePath = join70(ctx.repoRoot || process.cwd(), ".oa", "nexus", "peer-models-cache.json");
|
|
47812
47848
|
mkdirSync24(dirname22(cachePath), { recursive: true });
|
|
47813
47849
|
writeFileSync23(cachePath, JSON.stringify({
|
|
47814
47850
|
peerId,
|
|
@@ -48009,14 +48045,14 @@ async function handleUpdate(subcommand, ctx) {
|
|
|
48009
48045
|
try {
|
|
48010
48046
|
const { createRequire: createRequire4 } = await import("node:module");
|
|
48011
48047
|
const { fileURLToPath: fileURLToPath14 } = await import("node:url");
|
|
48012
|
-
const { dirname: dirname22, join:
|
|
48048
|
+
const { dirname: dirname22, join: join70 } = await import("node:path");
|
|
48013
48049
|
const { existsSync: existsSync50 } = await import("node:fs");
|
|
48014
48050
|
const req = createRequire4(import.meta.url);
|
|
48015
48051
|
const thisDir = dirname22(fileURLToPath14(import.meta.url));
|
|
48016
48052
|
const candidates = [
|
|
48017
|
-
|
|
48018
|
-
|
|
48019
|
-
|
|
48053
|
+
join70(thisDir, "..", "package.json"),
|
|
48054
|
+
join70(thisDir, "..", "..", "package.json"),
|
|
48055
|
+
join70(thisDir, "..", "..", "..", "package.json")
|
|
48020
48056
|
];
|
|
48021
48057
|
for (const pkgPath of candidates) {
|
|
48022
48058
|
if (existsSync50(pkgPath)) {
|
|
@@ -48340,11 +48376,12 @@ async function handleUpdate(subcommand, ctx) {
|
|
|
48340
48376
|
}
|
|
48341
48377
|
}
|
|
48342
48378
|
const venvDir = pathJoin(getHome(), ".open-agents", "venv");
|
|
48343
|
-
const
|
|
48344
|
-
|
|
48379
|
+
const isWin2 = process.platform === "win32";
|
|
48380
|
+
const venvPip2 = isWin2 ? pathJoin(venvDir, "Scripts", "pip.exe") : pathJoin(venvDir, "bin", "pip");
|
|
48381
|
+
if (fsExists(venvPip2)) {
|
|
48345
48382
|
installOverlay.setStatus("Upgrading Python packages...");
|
|
48346
48383
|
await new Promise((resolve34) => {
|
|
48347
|
-
const child = exec4(`"${
|
|
48384
|
+
const child = exec4(`"${venvPip2}" install --upgrade moondream-station pytesseract Pillow opencv-python-headless numpy 2>/dev/null || true`, { timeout: 3e5 }, (err) => resolve34(!err));
|
|
48348
48385
|
child.stdout?.resume();
|
|
48349
48386
|
child.stderr?.resume();
|
|
48350
48387
|
});
|
|
@@ -48857,7 +48894,7 @@ var init_commands = __esm({
|
|
|
48857
48894
|
|
|
48858
48895
|
// packages/cli/dist/tui/project-context.js
|
|
48859
48896
|
import { existsSync as existsSync41, readFileSync as readFileSync30, readdirSync as readdirSync12 } from "node:fs";
|
|
48860
|
-
import { join as
|
|
48897
|
+
import { join as join57, basename as basename11 } from "node:path";
|
|
48861
48898
|
import { execSync as execSync29 } from "node:child_process";
|
|
48862
48899
|
import { homedir as homedir15, platform as platform4, release } from "node:os";
|
|
48863
48900
|
function getModelTier(modelName) {
|
|
@@ -48892,7 +48929,7 @@ function loadProjectMap(repoRoot) {
|
|
|
48892
48929
|
if (!hasOaDirectory(repoRoot)) {
|
|
48893
48930
|
initOaDirectory(repoRoot);
|
|
48894
48931
|
}
|
|
48895
|
-
const mapPath2 =
|
|
48932
|
+
const mapPath2 = join57(repoRoot, OA_DIR, "context", "project-map.md");
|
|
48896
48933
|
if (existsSync41(mapPath2)) {
|
|
48897
48934
|
try {
|
|
48898
48935
|
const content = readFileSync30(mapPath2, "utf-8");
|
|
@@ -48936,17 +48973,17 @@ ${log}`);
|
|
|
48936
48973
|
}
|
|
48937
48974
|
function loadMemoryContext(repoRoot) {
|
|
48938
48975
|
const sections = [];
|
|
48939
|
-
const oaMemDir =
|
|
48976
|
+
const oaMemDir = join57(repoRoot, OA_DIR, "memory");
|
|
48940
48977
|
const oaEntries = loadMemoryDir(oaMemDir, "project");
|
|
48941
48978
|
if (oaEntries)
|
|
48942
48979
|
sections.push(oaEntries);
|
|
48943
|
-
const legacyMemDir =
|
|
48980
|
+
const legacyMemDir = join57(repoRoot, ".open-agents", "memory");
|
|
48944
48981
|
if (legacyMemDir !== oaMemDir && existsSync41(legacyMemDir)) {
|
|
48945
48982
|
const legacyEntries = loadMemoryDir(legacyMemDir, "project/legacy");
|
|
48946
48983
|
if (legacyEntries)
|
|
48947
48984
|
sections.push(legacyEntries);
|
|
48948
48985
|
}
|
|
48949
|
-
const globalMemDir =
|
|
48986
|
+
const globalMemDir = join57(homedir15(), ".open-agents", "memory");
|
|
48950
48987
|
const globalEntries = loadMemoryDir(globalMemDir, "global");
|
|
48951
48988
|
if (globalEntries)
|
|
48952
48989
|
sections.push(globalEntries);
|
|
@@ -48960,7 +48997,7 @@ function loadMemoryDir(memDir, scope) {
|
|
|
48960
48997
|
const files = readdirSync12(memDir).filter((f) => f.endsWith(".json"));
|
|
48961
48998
|
for (const file of files.slice(0, 10)) {
|
|
48962
48999
|
try {
|
|
48963
|
-
const raw = readFileSync30(
|
|
49000
|
+
const raw = readFileSync30(join57(memDir, file), "utf-8");
|
|
48964
49001
|
const entries = JSON.parse(raw);
|
|
48965
49002
|
const topic = basename11(file, ".json");
|
|
48966
49003
|
const keys = Object.keys(entries);
|
|
@@ -50480,9 +50517,9 @@ var init_banner = __esm({
|
|
|
50480
50517
|
|
|
50481
50518
|
// packages/cli/dist/tui/carousel-descriptors.js
|
|
50482
50519
|
import { existsSync as existsSync42, readFileSync as readFileSync31, writeFileSync as writeFileSync18, mkdirSync as mkdirSync17, readdirSync as readdirSync13 } from "node:fs";
|
|
50483
|
-
import { join as
|
|
50520
|
+
import { join as join58, basename as basename12 } from "node:path";
|
|
50484
50521
|
function loadToolProfile(repoRoot) {
|
|
50485
|
-
const filePath =
|
|
50522
|
+
const filePath = join58(repoRoot, OA_DIR, "context", TOOL_PROFILE_FILE);
|
|
50486
50523
|
try {
|
|
50487
50524
|
if (!existsSync42(filePath))
|
|
50488
50525
|
return null;
|
|
@@ -50492,9 +50529,9 @@ function loadToolProfile(repoRoot) {
|
|
|
50492
50529
|
}
|
|
50493
50530
|
}
|
|
50494
50531
|
function saveToolProfile(repoRoot, profile) {
|
|
50495
|
-
const contextDir =
|
|
50532
|
+
const contextDir = join58(repoRoot, OA_DIR, "context");
|
|
50496
50533
|
mkdirSync17(contextDir, { recursive: true });
|
|
50497
|
-
writeFileSync18(
|
|
50534
|
+
writeFileSync18(join58(contextDir, TOOL_PROFILE_FILE), JSON.stringify(profile, null, 2), "utf-8");
|
|
50498
50535
|
}
|
|
50499
50536
|
function categorizeToolCall(toolName) {
|
|
50500
50537
|
for (const cat of TOOL_CATEGORIES) {
|
|
@@ -50552,7 +50589,7 @@ function weightedColor(profile) {
|
|
|
50552
50589
|
return selectedCat.colors[Math.floor(Math.random() * selectedCat.colors.length)];
|
|
50553
50590
|
}
|
|
50554
50591
|
function loadCachedDescriptors(repoRoot) {
|
|
50555
|
-
const filePath =
|
|
50592
|
+
const filePath = join58(repoRoot, OA_DIR, "context", DESCRIPTOR_FILE);
|
|
50556
50593
|
try {
|
|
50557
50594
|
if (!existsSync42(filePath))
|
|
50558
50595
|
return null;
|
|
@@ -50563,14 +50600,14 @@ function loadCachedDescriptors(repoRoot) {
|
|
|
50563
50600
|
}
|
|
50564
50601
|
}
|
|
50565
50602
|
function saveCachedDescriptors(repoRoot, phrases, sourceHash) {
|
|
50566
|
-
const contextDir =
|
|
50603
|
+
const contextDir = join58(repoRoot, OA_DIR, "context");
|
|
50567
50604
|
mkdirSync17(contextDir, { recursive: true });
|
|
50568
50605
|
const cached = {
|
|
50569
50606
|
phrases,
|
|
50570
50607
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
50571
50608
|
sourceHash
|
|
50572
50609
|
};
|
|
50573
|
-
writeFileSync18(
|
|
50610
|
+
writeFileSync18(join58(contextDir, DESCRIPTOR_FILE), JSON.stringify(cached, null, 2), "utf-8");
|
|
50574
50611
|
}
|
|
50575
50612
|
function generateDescriptors(repoRoot) {
|
|
50576
50613
|
const profile = loadToolProfile(repoRoot);
|
|
@@ -50618,7 +50655,7 @@ function generateDescriptors(repoRoot) {
|
|
|
50618
50655
|
return phrases;
|
|
50619
50656
|
}
|
|
50620
50657
|
function extractFromPackageJson(repoRoot, tags) {
|
|
50621
|
-
const pkgPath =
|
|
50658
|
+
const pkgPath = join58(repoRoot, "package.json");
|
|
50622
50659
|
try {
|
|
50623
50660
|
if (!existsSync42(pkgPath))
|
|
50624
50661
|
return;
|
|
@@ -50666,7 +50703,7 @@ function extractFromManifests(repoRoot, tags) {
|
|
|
50666
50703
|
{ file: ".github/workflows", tag: "ci/cd" }
|
|
50667
50704
|
];
|
|
50668
50705
|
for (const check of manifestChecks) {
|
|
50669
|
-
if (existsSync42(
|
|
50706
|
+
if (existsSync42(join58(repoRoot, check.file))) {
|
|
50670
50707
|
tags.push(check.tag);
|
|
50671
50708
|
}
|
|
50672
50709
|
}
|
|
@@ -50688,7 +50725,7 @@ function extractFromSessions(repoRoot, tags) {
|
|
|
50688
50725
|
}
|
|
50689
50726
|
}
|
|
50690
50727
|
function extractFromMemory(repoRoot, tags) {
|
|
50691
|
-
const memoryDir =
|
|
50728
|
+
const memoryDir = join58(repoRoot, OA_DIR, "memory");
|
|
50692
50729
|
try {
|
|
50693
50730
|
if (!existsSync42(memoryDir))
|
|
50694
50731
|
return;
|
|
@@ -50697,7 +50734,7 @@ function extractFromMemory(repoRoot, tags) {
|
|
|
50697
50734
|
const topic = file.replace(/\.json$/, "").replace(/[-_]/g, " ");
|
|
50698
50735
|
tags.push(topic);
|
|
50699
50736
|
try {
|
|
50700
|
-
const data = JSON.parse(readFileSync31(
|
|
50737
|
+
const data = JSON.parse(readFileSync31(join58(memoryDir, file), "utf-8"));
|
|
50701
50738
|
if (data && typeof data === "object") {
|
|
50702
50739
|
const keys = Object.keys(data).slice(0, 3);
|
|
50703
50740
|
for (const key of keys) {
|
|
@@ -51331,10 +51368,10 @@ var init_stream_renderer = __esm({
|
|
|
51331
51368
|
|
|
51332
51369
|
// packages/cli/dist/tui/edit-history.js
|
|
51333
51370
|
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync18 } from "node:fs";
|
|
51334
|
-
import { join as
|
|
51371
|
+
import { join as join59 } from "node:path";
|
|
51335
51372
|
function createEditHistoryLogger(repoRoot, sessionId) {
|
|
51336
|
-
const historyDir =
|
|
51337
|
-
const logPath2 =
|
|
51373
|
+
const historyDir = join59(repoRoot, ".oa", "history");
|
|
51374
|
+
const logPath2 = join59(historyDir, "edits.jsonl");
|
|
51338
51375
|
try {
|
|
51339
51376
|
mkdirSync18(historyDir, { recursive: true });
|
|
51340
51377
|
} catch {
|
|
@@ -51446,12 +51483,12 @@ var init_edit_history = __esm({
|
|
|
51446
51483
|
|
|
51447
51484
|
// packages/cli/dist/tui/promptLoader.js
|
|
51448
51485
|
import { readFileSync as readFileSync32, existsSync as existsSync43 } from "node:fs";
|
|
51449
|
-
import { join as
|
|
51486
|
+
import { join as join60, dirname as dirname19 } from "node:path";
|
|
51450
51487
|
import { fileURLToPath as fileURLToPath11 } from "node:url";
|
|
51451
51488
|
function loadPrompt3(promptPath, vars) {
|
|
51452
51489
|
let content = cache3.get(promptPath);
|
|
51453
51490
|
if (content === void 0) {
|
|
51454
|
-
const fullPath =
|
|
51491
|
+
const fullPath = join60(PROMPTS_DIR3, promptPath);
|
|
51455
51492
|
if (!existsSync43(fullPath)) {
|
|
51456
51493
|
throw new Error(`Prompt file not found: ${fullPath}`);
|
|
51457
51494
|
}
|
|
@@ -51468,8 +51505,8 @@ var init_promptLoader3 = __esm({
|
|
|
51468
51505
|
"use strict";
|
|
51469
51506
|
__filename3 = fileURLToPath11(import.meta.url);
|
|
51470
51507
|
__dirname6 = dirname19(__filename3);
|
|
51471
|
-
devPath2 =
|
|
51472
|
-
publishedPath2 =
|
|
51508
|
+
devPath2 = join60(__dirname6, "..", "..", "prompts");
|
|
51509
|
+
publishedPath2 = join60(__dirname6, "..", "prompts");
|
|
51473
51510
|
PROMPTS_DIR3 = existsSync43(devPath2) ? devPath2 : publishedPath2;
|
|
51474
51511
|
cache3 = /* @__PURE__ */ new Map();
|
|
51475
51512
|
}
|
|
@@ -51477,10 +51514,10 @@ var init_promptLoader3 = __esm({
|
|
|
51477
51514
|
|
|
51478
51515
|
// packages/cli/dist/tui/dream-engine.js
|
|
51479
51516
|
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
|
|
51517
|
+
import { join as join61, basename as basename13 } from "node:path";
|
|
51481
51518
|
import { execSync as execSync30 } from "node:child_process";
|
|
51482
51519
|
function loadAutoresearchMemory(repoRoot) {
|
|
51483
|
-
const memoryPath =
|
|
51520
|
+
const memoryPath = join61(repoRoot, ".oa", "memory", "autoresearch.json");
|
|
51484
51521
|
if (!existsSync44(memoryPath))
|
|
51485
51522
|
return "";
|
|
51486
51523
|
try {
|
|
@@ -51674,12 +51711,12 @@ var init_dream_engine = __esm({
|
|
|
51674
51711
|
const content = String(args["content"] ?? "");
|
|
51675
51712
|
if (!rawPath)
|
|
51676
51713
|
return { success: false, output: "", error: "path is required", durationMs: Date.now() - start };
|
|
51677
|
-
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ?
|
|
51714
|
+
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join61(this.autoresearchDir, basename13(rawPath)) : join61(this.autoresearchDir, rawPath);
|
|
51678
51715
|
if (!targetPath.startsWith(this.autoresearchDir)) {
|
|
51679
51716
|
return { success: false, output: "", error: "Autoresearch mode: writes are confined to .oa/autoresearch/", durationMs: Date.now() - start };
|
|
51680
51717
|
}
|
|
51681
51718
|
try {
|
|
51682
|
-
const dir =
|
|
51719
|
+
const dir = join61(targetPath, "..");
|
|
51683
51720
|
mkdirSync19(dir, { recursive: true });
|
|
51684
51721
|
writeFileSync19(targetPath, content, "utf-8");
|
|
51685
51722
|
return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start };
|
|
@@ -51709,7 +51746,7 @@ var init_dream_engine = __esm({
|
|
|
51709
51746
|
const rawPath = String(args["path"] ?? "");
|
|
51710
51747
|
const oldStr = String(args["old_string"] ?? "");
|
|
51711
51748
|
const newStr = String(args["new_string"] ?? "");
|
|
51712
|
-
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ?
|
|
51749
|
+
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/autoresearch") ? join61(this.autoresearchDir, basename13(rawPath)) : join61(this.autoresearchDir, rawPath);
|
|
51713
51750
|
if (!targetPath.startsWith(this.autoresearchDir)) {
|
|
51714
51751
|
return { success: false, output: "", error: "Autoresearch mode: edits are confined to .oa/autoresearch/", durationMs: Date.now() - start };
|
|
51715
51752
|
}
|
|
@@ -51763,12 +51800,12 @@ var init_dream_engine = __esm({
|
|
|
51763
51800
|
const content = String(args["content"] ?? "");
|
|
51764
51801
|
if (!rawPath)
|
|
51765
51802
|
return { success: false, output: "", error: "path is required", durationMs: Date.now() - start };
|
|
51766
|
-
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ?
|
|
51803
|
+
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join61(this.dreamsDir, basename13(rawPath)) : join61(this.dreamsDir, rawPath);
|
|
51767
51804
|
if (!targetPath.startsWith(this.dreamsDir)) {
|
|
51768
51805
|
return { success: false, output: "", error: "Dream mode: writes are confined to .oa/dreams/", durationMs: Date.now() - start };
|
|
51769
51806
|
}
|
|
51770
51807
|
try {
|
|
51771
|
-
const dir =
|
|
51808
|
+
const dir = join61(targetPath, "..");
|
|
51772
51809
|
mkdirSync19(dir, { recursive: true });
|
|
51773
51810
|
writeFileSync19(targetPath, content, "utf-8");
|
|
51774
51811
|
return { success: true, output: `Wrote ${content.length} bytes to ${rawPath}`, durationMs: Date.now() - start };
|
|
@@ -51798,7 +51835,7 @@ var init_dream_engine = __esm({
|
|
|
51798
51835
|
const rawPath = String(args["path"] ?? "");
|
|
51799
51836
|
const oldStr = String(args["old_string"] ?? "");
|
|
51800
51837
|
const newStr = String(args["new_string"] ?? "");
|
|
51801
|
-
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ?
|
|
51838
|
+
const targetPath = rawPath.startsWith("/") || rawPath.startsWith(".oa/dreams") ? join61(this.dreamsDir, basename13(rawPath)) : join61(this.dreamsDir, rawPath);
|
|
51802
51839
|
if (!targetPath.startsWith(this.dreamsDir)) {
|
|
51803
51840
|
return { success: false, output: "", error: "Dream mode: edits are confined to .oa/dreams/", durationMs: Date.now() - start };
|
|
51804
51841
|
}
|
|
@@ -51865,7 +51902,7 @@ var init_dream_engine = __esm({
|
|
|
51865
51902
|
constructor(config, repoRoot) {
|
|
51866
51903
|
this.config = config;
|
|
51867
51904
|
this.repoRoot = repoRoot;
|
|
51868
|
-
this.dreamsDir =
|
|
51905
|
+
this.dreamsDir = join61(repoRoot, ".oa", "dreams");
|
|
51869
51906
|
this.state = {
|
|
51870
51907
|
mode: "default",
|
|
51871
51908
|
active: false,
|
|
@@ -51949,7 +51986,7 @@ ${result.summary}`;
|
|
|
51949
51986
|
if (mode !== "default" || cycle === totalCycles) {
|
|
51950
51987
|
renderDreamContraction(cycle);
|
|
51951
51988
|
const cycleSummary = this.buildCycleSummary(cycle, previousFindings);
|
|
51952
|
-
const summaryPath =
|
|
51989
|
+
const summaryPath = join61(this.dreamsDir, `cycle-${cycle}-summary.md`);
|
|
51953
51990
|
writeFileSync19(summaryPath, cycleSummary, "utf-8");
|
|
51954
51991
|
}
|
|
51955
51992
|
if (mode === "lucid" && !this.abortController.signal.aborted) {
|
|
@@ -52162,7 +52199,7 @@ After synthesis, call task_complete with the final prioritized summary.`, toolMo
|
|
|
52162
52199
|
}
|
|
52163
52200
|
/** Build role-specific tool sets for swarm agents */
|
|
52164
52201
|
buildSwarmTools(role, _workspace) {
|
|
52165
|
-
const autoresearchDir =
|
|
52202
|
+
const autoresearchDir = join61(this.repoRoot, ".oa", "autoresearch");
|
|
52166
52203
|
const taskComplete = this.createSwarmTaskCompleteTool(role);
|
|
52167
52204
|
switch (role) {
|
|
52168
52205
|
case "researcher": {
|
|
@@ -52526,7 +52563,7 @@ INSTRUCTIONS:
|
|
|
52526
52563
|
2. Summarize the key learnings and next steps
|
|
52527
52564
|
|
|
52528
52565
|
Call task_complete with a human-readable summary of the autoresearch session.`, workspace, onEvent);
|
|
52529
|
-
const reportPath =
|
|
52566
|
+
const reportPath = join61(this.dreamsDir, `cycle-${cycleNum}-autoresearch-report.md`);
|
|
52530
52567
|
const report = `# Autoresearch Swarm Report \u2014 Cycle ${cycleNum}
|
|
52531
52568
|
|
|
52532
52569
|
**Date**: ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}
|
|
@@ -52615,7 +52652,7 @@ ${summaryResult}
|
|
|
52615
52652
|
}
|
|
52616
52653
|
/** Save workspace backup for lucid mode */
|
|
52617
52654
|
saveVersionCheckpoint(cycle) {
|
|
52618
|
-
const checkpointDir =
|
|
52655
|
+
const checkpointDir = join61(this.dreamsDir, "checkpoints", `cycle-${cycle}`);
|
|
52619
52656
|
try {
|
|
52620
52657
|
mkdirSync19(checkpointDir, { recursive: true });
|
|
52621
52658
|
try {
|
|
@@ -52634,10 +52671,10 @@ ${summaryResult}
|
|
|
52634
52671
|
encoding: "utf-8",
|
|
52635
52672
|
timeout: 5e3
|
|
52636
52673
|
}).trim();
|
|
52637
|
-
writeFileSync19(
|
|
52638
|
-
writeFileSync19(
|
|
52639
|
-
writeFileSync19(
|
|
52640
|
-
writeFileSync19(
|
|
52674
|
+
writeFileSync19(join61(checkpointDir, "git-status.txt"), gitStatus, "utf-8");
|
|
52675
|
+
writeFileSync19(join61(checkpointDir, "git-diff.patch"), gitDiff, "utf-8");
|
|
52676
|
+
writeFileSync19(join61(checkpointDir, "git-hash.txt"), gitHash, "utf-8");
|
|
52677
|
+
writeFileSync19(join61(checkpointDir, "checkpoint.json"), JSON.stringify({
|
|
52641
52678
|
cycle,
|
|
52642
52679
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
52643
52680
|
gitHash,
|
|
@@ -52645,7 +52682,7 @@ ${summaryResult}
|
|
|
52645
52682
|
}, null, 2), "utf-8");
|
|
52646
52683
|
renderInfo(`Checkpoint saved: cycle ${cycle} (${gitHash.slice(0, 8)})`);
|
|
52647
52684
|
} catch {
|
|
52648
|
-
writeFileSync19(
|
|
52685
|
+
writeFileSync19(join61(checkpointDir, "checkpoint.json"), JSON.stringify({ cycle, timestamp: (/* @__PURE__ */ new Date()).toISOString(), mode: this.state.mode }, null, 2), "utf-8");
|
|
52649
52686
|
renderInfo(`Checkpoint saved: cycle ${cycle} (no git)`);
|
|
52650
52687
|
}
|
|
52651
52688
|
} catch (err) {
|
|
@@ -52703,14 +52740,14 @@ ${files.map((f) => `- [\`${f}\`](./${f})`).join("\n")}
|
|
|
52703
52740
|
---
|
|
52704
52741
|
*Auto-generated by open-agents dream engine*
|
|
52705
52742
|
`;
|
|
52706
|
-
writeFileSync19(
|
|
52743
|
+
writeFileSync19(join61(this.dreamsDir, "PROPOSAL-INDEX.md"), index, "utf-8");
|
|
52707
52744
|
} catch {
|
|
52708
52745
|
}
|
|
52709
52746
|
}
|
|
52710
52747
|
/** Save dream state for resume/inspection */
|
|
52711
52748
|
saveDreamState() {
|
|
52712
52749
|
try {
|
|
52713
|
-
writeFileSync19(
|
|
52750
|
+
writeFileSync19(join61(this.dreamsDir, "dream-state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
|
|
52714
52751
|
} catch {
|
|
52715
52752
|
}
|
|
52716
52753
|
}
|
|
@@ -53085,7 +53122,7 @@ var init_bless_engine = __esm({
|
|
|
53085
53122
|
|
|
53086
53123
|
// packages/cli/dist/tui/dmn-engine.js
|
|
53087
53124
|
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
|
|
53125
|
+
import { join as join62, basename as basename14 } from "node:path";
|
|
53089
53126
|
function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities, competence, reflectionBuffer) {
|
|
53090
53127
|
const competenceReport = competence.length > 0 ? competence.map((c3) => {
|
|
53091
53128
|
const rate = c3.attempts > 0 ? Math.round(c3.successes / c3.attempts * 100) : 0;
|
|
@@ -53205,8 +53242,8 @@ var init_dmn_engine = __esm({
|
|
|
53205
53242
|
constructor(config, repoRoot) {
|
|
53206
53243
|
this.config = config;
|
|
53207
53244
|
this.repoRoot = repoRoot;
|
|
53208
|
-
this.stateDir =
|
|
53209
|
-
this.historyDir =
|
|
53245
|
+
this.stateDir = join62(repoRoot, ".oa", "dmn");
|
|
53246
|
+
this.historyDir = join62(repoRoot, ".oa", "dmn", "cycles");
|
|
53210
53247
|
mkdirSync20(this.historyDir, { recursive: true });
|
|
53211
53248
|
this.loadState();
|
|
53212
53249
|
}
|
|
@@ -53796,8 +53833,8 @@ OUTPUT: Call task_complete with JSON:
|
|
|
53796
53833
|
async gatherMemoryTopics() {
|
|
53797
53834
|
const topics = [];
|
|
53798
53835
|
const dirs = [
|
|
53799
|
-
|
|
53800
|
-
|
|
53836
|
+
join62(this.repoRoot, ".oa", "memory"),
|
|
53837
|
+
join62(this.repoRoot, ".open-agents", "memory")
|
|
53801
53838
|
];
|
|
53802
53839
|
for (const dir of dirs) {
|
|
53803
53840
|
if (!existsSync45(dir))
|
|
@@ -53816,7 +53853,7 @@ OUTPUT: Call task_complete with JSON:
|
|
|
53816
53853
|
}
|
|
53817
53854
|
// ── State persistence ─────────────────────────────────────────────────
|
|
53818
53855
|
loadState() {
|
|
53819
|
-
const path =
|
|
53856
|
+
const path = join62(this.stateDir, "state.json");
|
|
53820
53857
|
if (existsSync45(path)) {
|
|
53821
53858
|
try {
|
|
53822
53859
|
this.state = JSON.parse(readFileSync34(path, "utf-8"));
|
|
@@ -53826,19 +53863,19 @@ OUTPUT: Call task_complete with JSON:
|
|
|
53826
53863
|
}
|
|
53827
53864
|
saveState() {
|
|
53828
53865
|
try {
|
|
53829
|
-
writeFileSync20(
|
|
53866
|
+
writeFileSync20(join62(this.stateDir, "state.json"), JSON.stringify(this.state, null, 2) + "\n", "utf-8");
|
|
53830
53867
|
} catch {
|
|
53831
53868
|
}
|
|
53832
53869
|
}
|
|
53833
53870
|
saveCycleResult(result) {
|
|
53834
53871
|
try {
|
|
53835
53872
|
const filename = `cycle-${result.cycleNumber}-${Date.now()}.json`;
|
|
53836
|
-
writeFileSync20(
|
|
53873
|
+
writeFileSync20(join62(this.historyDir, filename), JSON.stringify(result, null, 2) + "\n", "utf-8");
|
|
53837
53874
|
const files = readdirSync15(this.historyDir).filter((f) => f.startsWith("cycle-") && f.endsWith(".json")).sort();
|
|
53838
53875
|
if (files.length > 50) {
|
|
53839
53876
|
for (const old of files.slice(0, files.length - 50)) {
|
|
53840
53877
|
try {
|
|
53841
|
-
unlinkSync9(
|
|
53878
|
+
unlinkSync9(join62(this.historyDir, old));
|
|
53842
53879
|
} catch {
|
|
53843
53880
|
}
|
|
53844
53881
|
}
|
|
@@ -53852,7 +53889,7 @@ OUTPUT: Call task_complete with JSON:
|
|
|
53852
53889
|
|
|
53853
53890
|
// packages/cli/dist/tui/snr-engine.js
|
|
53854
53891
|
import { existsSync as existsSync46, readdirSync as readdirSync16, readFileSync as readFileSync35 } from "node:fs";
|
|
53855
|
-
import { join as
|
|
53892
|
+
import { join as join63, basename as basename15 } from "node:path";
|
|
53856
53893
|
function computeDPrime(signalScores, noiseScores) {
|
|
53857
53894
|
if (signalScores.length === 0 || noiseScores.length === 0)
|
|
53858
53895
|
return 0;
|
|
@@ -54092,8 +54129,8 @@ Call task_complete with the JSON array when done.`, onEvent)
|
|
|
54092
54129
|
loadMemoryEntries(topics) {
|
|
54093
54130
|
const entries = [];
|
|
54094
54131
|
const dirs = [
|
|
54095
|
-
|
|
54096
|
-
|
|
54132
|
+
join63(this.repoRoot, ".oa", "memory"),
|
|
54133
|
+
join63(this.repoRoot, ".open-agents", "memory")
|
|
54097
54134
|
];
|
|
54098
54135
|
for (const dir of dirs) {
|
|
54099
54136
|
if (!existsSync46(dir))
|
|
@@ -54105,7 +54142,7 @@ Call task_complete with the JSON array when done.`, onEvent)
|
|
|
54105
54142
|
if (topics.length > 0 && !topics.includes(topic))
|
|
54106
54143
|
continue;
|
|
54107
54144
|
try {
|
|
54108
|
-
const data = JSON.parse(readFileSync35(
|
|
54145
|
+
const data = JSON.parse(readFileSync35(join63(dir, f), "utf-8"));
|
|
54109
54146
|
for (const [key, val] of Object.entries(data)) {
|
|
54110
54147
|
const value = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
54111
54148
|
entries.push({ topic, key, value });
|
|
@@ -54673,7 +54710,7 @@ var init_tool_policy = __esm({
|
|
|
54673
54710
|
|
|
54674
54711
|
// packages/cli/dist/tui/telegram-bridge.js
|
|
54675
54712
|
import { mkdirSync as mkdirSync21, existsSync as existsSync47, unlinkSync as unlinkSync10, readdirSync as readdirSync17, statSync as statSync15 } from "node:fs";
|
|
54676
|
-
import { join as
|
|
54713
|
+
import { join as join64, resolve as resolve30 } from "node:path";
|
|
54677
54714
|
import { writeFile as writeFileAsync } from "node:fs/promises";
|
|
54678
54715
|
function convertMarkdownToTelegramHTML(md) {
|
|
54679
54716
|
let html = md;
|
|
@@ -55438,7 +55475,7 @@ Telegram admin: @${msg.username}` : `Telegram ${isGroup ? "group" : "public"} ch
|
|
|
55438
55475
|
return null;
|
|
55439
55476
|
const buffer = Buffer.from(await res.arrayBuffer());
|
|
55440
55477
|
const fileName = `${Date.now()}-${fileId.slice(0, 8)}${extension}`;
|
|
55441
|
-
const localPath =
|
|
55478
|
+
const localPath = join64(this.mediaCacheDir, fileName);
|
|
55442
55479
|
await writeFileAsync(localPath, buffer);
|
|
55443
55480
|
return localPath;
|
|
55444
55481
|
} catch {
|
|
@@ -59075,7 +59112,7 @@ var init_mouse_filter = __esm({
|
|
|
59075
59112
|
import * as readline2 from "node:readline";
|
|
59076
59113
|
import { Writable } from "node:stream";
|
|
59077
59114
|
import { cwd } from "node:process";
|
|
59078
|
-
import { resolve as resolve31, join as
|
|
59115
|
+
import { resolve as resolve31, join as join65, dirname as dirname20, extname as extname11 } from "node:path";
|
|
59079
59116
|
import { createRequire as createRequire2 } from "node:module";
|
|
59080
59117
|
import { fileURLToPath as fileURLToPath12 } from "node:url";
|
|
59081
59118
|
import { readFileSync as readFileSync37, writeFileSync as writeFileSync21, appendFileSync as appendFileSync4, rmSync as rmSync3, readdirSync as readdirSync18, mkdirSync as mkdirSync22 } from "node:fs";
|
|
@@ -59100,9 +59137,9 @@ function getVersion3() {
|
|
|
59100
59137
|
const require2 = createRequire2(import.meta.url);
|
|
59101
59138
|
const thisDir = dirname20(fileURLToPath12(import.meta.url));
|
|
59102
59139
|
const candidates = [
|
|
59103
|
-
|
|
59104
|
-
|
|
59105
|
-
|
|
59140
|
+
join65(thisDir, "..", "package.json"),
|
|
59141
|
+
join65(thisDir, "..", "..", "package.json"),
|
|
59142
|
+
join65(thisDir, "..", "..", "..", "package.json")
|
|
59106
59143
|
];
|
|
59107
59144
|
for (const pkgPath of candidates) {
|
|
59108
59145
|
if (existsSync48(pkgPath)) {
|
|
@@ -59339,15 +59376,15 @@ Use task_status("${taskId}") or task_output("${taskId}") to check progress.`
|
|
|
59339
59376
|
function gatherMemorySnippets(root) {
|
|
59340
59377
|
const snippets = [];
|
|
59341
59378
|
const dirs = [
|
|
59342
|
-
|
|
59343
|
-
|
|
59379
|
+
join65(root, ".oa", "memory"),
|
|
59380
|
+
join65(root, ".open-agents", "memory")
|
|
59344
59381
|
];
|
|
59345
59382
|
for (const dir of dirs) {
|
|
59346
59383
|
if (!existsSync48(dir))
|
|
59347
59384
|
continue;
|
|
59348
59385
|
try {
|
|
59349
59386
|
for (const f of readdirSync18(dir).filter((f2) => f2.endsWith(".json"))) {
|
|
59350
|
-
const data = JSON.parse(readFileSync37(
|
|
59387
|
+
const data = JSON.parse(readFileSync37(join65(dir, f), "utf-8"));
|
|
59351
59388
|
for (const val of Object.values(data)) {
|
|
59352
59389
|
const v = typeof val === "object" && val !== null && "value" in val ? String(val.value) : String(val);
|
|
59353
59390
|
if (v.length > 10)
|
|
@@ -59504,7 +59541,7 @@ ${metabolismMemories}
|
|
|
59504
59541
|
} catch {
|
|
59505
59542
|
}
|
|
59506
59543
|
try {
|
|
59507
|
-
const archeFile =
|
|
59544
|
+
const archeFile = join65(repoRoot, ".oa", "arche", "variants.json");
|
|
59508
59545
|
if (existsSync48(archeFile)) {
|
|
59509
59546
|
const variants = JSON.parse(readFileSync37(archeFile, "utf8"));
|
|
59510
59547
|
if (variants.length > 0) {
|
|
@@ -59643,7 +59680,7 @@ ${lines.join("\n")}
|
|
|
59643
59680
|
const compactionThreshold = modelTier === "small" ? 12e3 : modelTier === "medium" ? 24e3 : 4e4;
|
|
59644
59681
|
let identityInjection = "";
|
|
59645
59682
|
try {
|
|
59646
|
-
const ikStateFile =
|
|
59683
|
+
const ikStateFile = join65(repoRoot, ".oa", "identity", "self-state.json");
|
|
59647
59684
|
if (existsSync48(ikStateFile)) {
|
|
59648
59685
|
const selfState = JSON.parse(readFileSync37(ikStateFile, "utf8"));
|
|
59649
59686
|
const lines = [
|
|
@@ -60284,8 +60321,8 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
60284
60321
|
});
|
|
60285
60322
|
}
|
|
60286
60323
|
try {
|
|
60287
|
-
const ikDir =
|
|
60288
|
-
const ikFile =
|
|
60324
|
+
const ikDir = join65(repoRoot, ".oa", "identity");
|
|
60325
|
+
const ikFile = join65(ikDir, "self-state.json");
|
|
60289
60326
|
let ikState;
|
|
60290
60327
|
if (existsSync48(ikFile)) {
|
|
60291
60328
|
ikState = JSON.parse(readFileSync37(ikFile, "utf8"));
|
|
@@ -60331,7 +60368,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
60331
60368
|
} else {
|
|
60332
60369
|
renderTaskIncomplete(result.turns, result.toolCalls, result.durationMs, tokens);
|
|
60333
60370
|
try {
|
|
60334
|
-
const ikFile =
|
|
60371
|
+
const ikFile = join65(repoRoot, ".oa", "identity", "self-state.json");
|
|
60335
60372
|
if (existsSync48(ikFile)) {
|
|
60336
60373
|
const ikState = JSON.parse(readFileSync37(ikFile, "utf8"));
|
|
60337
60374
|
ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
|
|
@@ -60681,7 +60718,7 @@ Review its full output in the [${id}] tab or via full_sub_agent(action='output',
|
|
|
60681
60718
|
let p2pGateway = null;
|
|
60682
60719
|
let peerMesh = null;
|
|
60683
60720
|
let inferenceRouter = null;
|
|
60684
|
-
const secretVault = new SecretVault(
|
|
60721
|
+
const secretVault = new SecretVault(join65(repoRoot, ".oa", "vault.enc"));
|
|
60685
60722
|
let adminSessionKey = null;
|
|
60686
60723
|
const callSubAgents = /* @__PURE__ */ new Map();
|
|
60687
60724
|
const streamRenderer = new StreamRenderer();
|
|
@@ -60901,8 +60938,8 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
60901
60938
|
const hits = allCompletions.filter((c3) => c3.toLowerCase().startsWith(lower));
|
|
60902
60939
|
return [hits, line];
|
|
60903
60940
|
}
|
|
60904
|
-
const HISTORY_DIR =
|
|
60905
|
-
const HISTORY_FILE =
|
|
60941
|
+
const HISTORY_DIR = join65(homedir16(), ".open-agents");
|
|
60942
|
+
const HISTORY_FILE = join65(HISTORY_DIR, "repl-history");
|
|
60906
60943
|
const MAX_HISTORY_LINES = 500;
|
|
60907
60944
|
let savedHistory = [];
|
|
60908
60945
|
try {
|
|
@@ -61168,7 +61205,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
61168
61205
|
} catch {
|
|
61169
61206
|
}
|
|
61170
61207
|
try {
|
|
61171
|
-
const oaDir =
|
|
61208
|
+
const oaDir = join65(repoRoot, ".oa");
|
|
61172
61209
|
const reconnected = await ExposeGateway.checkAndReconnect(oaDir, {
|
|
61173
61210
|
onInfo: (msg) => writeContent(() => renderInfo(msg)),
|
|
61174
61211
|
onError: (msg) => writeContent(() => renderWarning(msg))
|
|
@@ -61191,7 +61228,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
61191
61228
|
} catch {
|
|
61192
61229
|
}
|
|
61193
61230
|
try {
|
|
61194
|
-
const oaDir =
|
|
61231
|
+
const oaDir = join65(repoRoot, ".oa");
|
|
61195
61232
|
const reconnectedP2P = await ExposeP2PGateway.checkAndReconnect(oaDir, new NexusTool(repoRoot), {
|
|
61196
61233
|
onInfo: (msg) => writeContent(() => renderInfo(msg)),
|
|
61197
61234
|
onError: (msg) => writeContent(() => renderWarning(msg))
|
|
@@ -62075,7 +62112,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
62075
62112
|
kind,
|
|
62076
62113
|
targetUrl,
|
|
62077
62114
|
authKey,
|
|
62078
|
-
stateDir:
|
|
62115
|
+
stateDir: join65(repoRoot, ".oa"),
|
|
62079
62116
|
passthrough: passthrough ?? false,
|
|
62080
62117
|
loadbalance: loadbalance ?? false,
|
|
62081
62118
|
endpointAuth: passthrough ? currentConfig.apiKey : void 0,
|
|
@@ -62123,7 +62160,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
62123
62160
|
await tunnelGateway.stop();
|
|
62124
62161
|
tunnelGateway = null;
|
|
62125
62162
|
}
|
|
62126
|
-
const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir:
|
|
62163
|
+
const newTunnel = new ExposeGateway({ kind, targetUrl, authKey, fullAccess, stateDir: join65(repoRoot, ".oa") });
|
|
62127
62164
|
newTunnel.on("stats", (stats) => {
|
|
62128
62165
|
statusBar.setExposeStatus({
|
|
62129
62166
|
status: stats.status,
|
|
@@ -62392,8 +62429,8 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
62392
62429
|
writeContent(() => renderInfo(`Killed ${bgKilled} background task(s).`));
|
|
62393
62430
|
}
|
|
62394
62431
|
try {
|
|
62395
|
-
const nexusDir =
|
|
62396
|
-
const pidFile =
|
|
62432
|
+
const nexusDir = join65(repoRoot, OA_DIR, "nexus");
|
|
62433
|
+
const pidFile = join65(nexusDir, "daemon.pid");
|
|
62397
62434
|
if (existsSync48(pidFile)) {
|
|
62398
62435
|
const pid = parseInt(readFileSync37(pidFile, "utf8").trim(), 10);
|
|
62399
62436
|
if (pid > 0) {
|
|
@@ -62417,10 +62454,10 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
62417
62454
|
} catch {
|
|
62418
62455
|
}
|
|
62419
62456
|
try {
|
|
62420
|
-
const voiceDir2 =
|
|
62457
|
+
const voiceDir2 = join65(homedir16(), ".open-agents", "voice");
|
|
62421
62458
|
const voicePidFiles = ["luxtts-daemon.pid", "piper-daemon.pid"];
|
|
62422
62459
|
for (const pf of voicePidFiles) {
|
|
62423
|
-
const pidPath =
|
|
62460
|
+
const pidPath = join65(voiceDir2, pf);
|
|
62424
62461
|
if (existsSync48(pidPath)) {
|
|
62425
62462
|
try {
|
|
62426
62463
|
const pid = parseInt(readFileSync37(pidPath, "utf8").trim(), 10);
|
|
@@ -62447,7 +62484,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
62447
62484
|
execSync32(process.platform === "win32" ? "timeout /t 1 /nobreak >nul" : "sleep 0.5", { timeout: 3e3, stdio: "ignore" });
|
|
62448
62485
|
} catch {
|
|
62449
62486
|
}
|
|
62450
|
-
const oaPath =
|
|
62487
|
+
const oaPath = join65(repoRoot, OA_DIR);
|
|
62451
62488
|
if (existsSync48(oaPath)) {
|
|
62452
62489
|
let deleted = false;
|
|
62453
62490
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
@@ -63106,10 +63143,11 @@ NEW TASK: ${fullInput}`;
|
|
|
63106
63143
|
setTerminalTitle(void 0, version);
|
|
63107
63144
|
}
|
|
63108
63145
|
const updateMode = savedSettings.updateMode ?? "auto";
|
|
63109
|
-
if (updateMode !== "manual") {
|
|
63146
|
+
if (updateMode !== "manual" && !_autoUpdatedThisSession) {
|
|
63110
63147
|
try {
|
|
63111
63148
|
const updateInfo = await checkForUpdate(version);
|
|
63112
63149
|
if (updateInfo) {
|
|
63150
|
+
_autoUpdatedThisSession = true;
|
|
63113
63151
|
const { exec: exec4 } = await import("node:child_process");
|
|
63114
63152
|
exec4(`npm install -g open-agents-ai@latest --prefer-online`, { timeout: 18e4 }, (err) => {
|
|
63115
63153
|
if (!err) {
|
|
@@ -63328,8 +63366,8 @@ async function runWithTUI(task, config, repoPath) {
|
|
|
63328
63366
|
const handle = startTask(task, config, repoRoot);
|
|
63329
63367
|
await handle.promise;
|
|
63330
63368
|
try {
|
|
63331
|
-
const ikDir =
|
|
63332
|
-
const ikFile =
|
|
63369
|
+
const ikDir = join65(repoRoot, ".oa", "identity");
|
|
63370
|
+
const ikFile = join65(ikDir, "self-state.json");
|
|
63333
63371
|
let ikState;
|
|
63334
63372
|
if (existsSync48(ikFile)) {
|
|
63335
63373
|
ikState = JSON.parse(readFileSync37(ikFile, "utf8"));
|
|
@@ -63365,8 +63403,8 @@ async function runWithTUI(task, config, repoPath) {
|
|
|
63365
63403
|
ec.archiveVariantSync(`Task: ${task.slice(0, 200)}`, "success \u2014 completed", ["general"]);
|
|
63366
63404
|
} catch {
|
|
63367
63405
|
try {
|
|
63368
|
-
const archeDir =
|
|
63369
|
-
const archeFile =
|
|
63406
|
+
const archeDir = join65(repoRoot, ".oa", "arche");
|
|
63407
|
+
const archeFile = join65(archeDir, "variants.json");
|
|
63370
63408
|
let variants = [];
|
|
63371
63409
|
try {
|
|
63372
63410
|
if (existsSync48(archeFile))
|
|
@@ -63391,7 +63429,7 @@ async function runWithTUI(task, config, repoPath) {
|
|
|
63391
63429
|
}
|
|
63392
63430
|
}
|
|
63393
63431
|
try {
|
|
63394
|
-
const metaFile =
|
|
63432
|
+
const metaFile = join65(repoRoot, ".oa", "memory", "metabolism", "store.json");
|
|
63395
63433
|
if (existsSync48(metaFile)) {
|
|
63396
63434
|
const store = JSON.parse(readFileSync37(metaFile, "utf8"));
|
|
63397
63435
|
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);
|
|
@@ -63457,9 +63495,9 @@ Rules:
|
|
|
63457
63495
|
try {
|
|
63458
63496
|
const { initDb: initDb2 } = __require("@open-agents/memory");
|
|
63459
63497
|
const { ProceduralMemoryStore: ProceduralMemoryStore2 } = __require("@open-agents/memory");
|
|
63460
|
-
const dbDir =
|
|
63498
|
+
const dbDir = join65(repoRoot, ".oa", "memory");
|
|
63461
63499
|
mkdirSync22(dbDir, { recursive: true });
|
|
63462
|
-
const db = initDb2(
|
|
63500
|
+
const db = initDb2(join65(dbDir, "structured.db"));
|
|
63463
63501
|
const memStore = new ProceduralMemoryStore2(db);
|
|
63464
63502
|
memStore.createWithEmbedding({
|
|
63465
63503
|
content: content.slice(0, 600),
|
|
@@ -63474,8 +63512,8 @@ Rules:
|
|
|
63474
63512
|
db.close();
|
|
63475
63513
|
} catch {
|
|
63476
63514
|
}
|
|
63477
|
-
const metaDir =
|
|
63478
|
-
const storeFile =
|
|
63515
|
+
const metaDir = join65(repoRoot, ".oa", "memory", "metabolism");
|
|
63516
|
+
const storeFile = join65(metaDir, "store.json");
|
|
63479
63517
|
let store = [];
|
|
63480
63518
|
try {
|
|
63481
63519
|
if (existsSync48(storeFile))
|
|
@@ -63502,7 +63540,7 @@ Rules:
|
|
|
63502
63540
|
} catch {
|
|
63503
63541
|
}
|
|
63504
63542
|
try {
|
|
63505
|
-
const cohereSettingsFile =
|
|
63543
|
+
const cohereSettingsFile = join65(repoRoot, ".oa", "settings.json");
|
|
63506
63544
|
let cohereActive = false;
|
|
63507
63545
|
try {
|
|
63508
63546
|
if (existsSync48(cohereSettingsFile)) {
|
|
@@ -63512,7 +63550,7 @@ Rules:
|
|
|
63512
63550
|
} catch {
|
|
63513
63551
|
}
|
|
63514
63552
|
if (cohereActive) {
|
|
63515
|
-
const metaFile =
|
|
63553
|
+
const metaFile = join65(repoRoot, ".oa", "memory", "metabolism", "store.json");
|
|
63516
63554
|
if (existsSync48(metaFile)) {
|
|
63517
63555
|
const store = JSON.parse(readFileSync37(metaFile, "utf8"));
|
|
63518
63556
|
const latest = store.filter((m) => m.sourceTrace === "trajectory-extraction" || m.sourceTrace === "llm-trajectory-extraction").slice(-1)[0];
|
|
@@ -63539,7 +63577,7 @@ Rules:
|
|
|
63539
63577
|
}
|
|
63540
63578
|
} catch (err) {
|
|
63541
63579
|
try {
|
|
63542
|
-
const ikFile =
|
|
63580
|
+
const ikFile = join65(repoRoot, ".oa", "identity", "self-state.json");
|
|
63543
63581
|
if (existsSync48(ikFile)) {
|
|
63544
63582
|
const ikState = JSON.parse(readFileSync37(ikFile, "utf8"));
|
|
63545
63583
|
ikState.homeostasis.uncertainty = Math.min(1, ikState.homeostasis.uncertainty + 0.1);
|
|
@@ -63548,7 +63586,7 @@ Rules:
|
|
|
63548
63586
|
ikState.updated_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
63549
63587
|
writeFileSync21(ikFile, JSON.stringify(ikState, null, 2));
|
|
63550
63588
|
}
|
|
63551
|
-
const metaFile =
|
|
63589
|
+
const metaFile = join65(repoRoot, ".oa", "memory", "metabolism", "store.json");
|
|
63552
63590
|
if (existsSync48(metaFile)) {
|
|
63553
63591
|
const store = JSON.parse(readFileSync37(metaFile, "utf8"));
|
|
63554
63592
|
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);
|
|
@@ -63561,8 +63599,8 @@ Rules:
|
|
|
63561
63599
|
writeFileSync21(metaFile, JSON.stringify(store, null, 2));
|
|
63562
63600
|
}
|
|
63563
63601
|
try {
|
|
63564
|
-
const archeDir =
|
|
63565
|
-
const archeFile =
|
|
63602
|
+
const archeDir = join65(repoRoot, ".oa", "arche");
|
|
63603
|
+
const archeFile = join65(archeDir, "variants.json");
|
|
63566
63604
|
let variants = [];
|
|
63567
63605
|
try {
|
|
63568
63606
|
if (existsSync48(archeFile))
|
|
@@ -63591,7 +63629,7 @@ Rules:
|
|
|
63591
63629
|
process.exit(1);
|
|
63592
63630
|
}
|
|
63593
63631
|
}
|
|
63594
|
-
var taskManager, _shellToolRef, _fullSubAgentToolRef, _activeRunnerRef, SELF_IMPROVE_INTERVAL, _tasksSinceImprove;
|
|
63632
|
+
var taskManager, _shellToolRef, _fullSubAgentToolRef, _activeRunnerRef, _autoUpdatedThisSession, SELF_IMPROVE_INTERVAL, _tasksSinceImprove;
|
|
63595
63633
|
var init_interactive = __esm({
|
|
63596
63634
|
"packages/cli/dist/tui/interactive.js"() {
|
|
63597
63635
|
"use strict";
|
|
@@ -63634,6 +63672,7 @@ var init_interactive = __esm({
|
|
|
63634
63672
|
_shellToolRef = null;
|
|
63635
63673
|
_fullSubAgentToolRef = null;
|
|
63636
63674
|
_activeRunnerRef = null;
|
|
63675
|
+
_autoUpdatedThisSession = false;
|
|
63637
63676
|
SELF_IMPROVE_INTERVAL = 5;
|
|
63638
63677
|
_tasksSinceImprove = 0;
|
|
63639
63678
|
}
|
|
@@ -63670,7 +63709,7 @@ import { glob } from "glob";
|
|
|
63670
63709
|
import ignore from "ignore";
|
|
63671
63710
|
import { readFile as readFile23, stat as stat4 } from "node:fs/promises";
|
|
63672
63711
|
import { createHash as createHash4 } from "node:crypto";
|
|
63673
|
-
import { join as
|
|
63712
|
+
import { join as join66, relative as relative4, extname as extname12, basename as basename16 } from "node:path";
|
|
63674
63713
|
var DEFAULT_EXCLUDE, LANGUAGE_MAP, CodebaseIndexer;
|
|
63675
63714
|
var init_codebase_indexer = __esm({
|
|
63676
63715
|
"packages/indexer/dist/codebase-indexer.js"() {
|
|
@@ -63714,7 +63753,7 @@ var init_codebase_indexer = __esm({
|
|
|
63714
63753
|
const ig = ignore.default();
|
|
63715
63754
|
if (this.config.respectGitignore) {
|
|
63716
63755
|
try {
|
|
63717
|
-
const gitignoreContent = await readFile23(
|
|
63756
|
+
const gitignoreContent = await readFile23(join66(this.config.rootDir, ".gitignore"), "utf-8");
|
|
63718
63757
|
ig.add(gitignoreContent);
|
|
63719
63758
|
} catch {
|
|
63720
63759
|
}
|
|
@@ -63729,7 +63768,7 @@ var init_codebase_indexer = __esm({
|
|
|
63729
63768
|
for (const relativePath of files) {
|
|
63730
63769
|
if (ig.ignores(relativePath))
|
|
63731
63770
|
continue;
|
|
63732
|
-
const fullPath =
|
|
63771
|
+
const fullPath = join66(this.config.rootDir, relativePath);
|
|
63733
63772
|
try {
|
|
63734
63773
|
const fileStat = await stat4(fullPath);
|
|
63735
63774
|
if (fileStat.size > this.config.maxFileSize)
|
|
@@ -63775,7 +63814,7 @@ var init_codebase_indexer = __esm({
|
|
|
63775
63814
|
if (!child) {
|
|
63776
63815
|
child = {
|
|
63777
63816
|
name: part,
|
|
63778
|
-
path:
|
|
63817
|
+
path: join66(current.path, part),
|
|
63779
63818
|
type: "directory",
|
|
63780
63819
|
children: []
|
|
63781
63820
|
};
|
|
@@ -64116,7 +64155,7 @@ var config_exports = {};
|
|
|
64116
64155
|
__export(config_exports, {
|
|
64117
64156
|
configCommand: () => configCommand
|
|
64118
64157
|
});
|
|
64119
|
-
import { join as
|
|
64158
|
+
import { join as join67, resolve as resolve33 } from "node:path";
|
|
64120
64159
|
import { homedir as homedir17 } from "node:os";
|
|
64121
64160
|
import { cwd as cwd3 } from "node:process";
|
|
64122
64161
|
function redactIfSensitive(key, value) {
|
|
@@ -64199,7 +64238,7 @@ function handleShow(opts, config) {
|
|
|
64199
64238
|
}
|
|
64200
64239
|
}
|
|
64201
64240
|
printSection("Config File");
|
|
64202
|
-
printInfo(`~/.open-agents/config.json (${
|
|
64241
|
+
printInfo(`~/.open-agents/config.json (${join67(homedir17(), ".open-agents", "config.json")})`);
|
|
64203
64242
|
printSection("Priority Chain");
|
|
64204
64243
|
printInfo(" 1. CLI flags (--model, --backend-url, etc.)");
|
|
64205
64244
|
printInfo(" 2. Project .oa/settings.json (--local)");
|
|
@@ -64238,7 +64277,7 @@ function handleSet(opts, _config) {
|
|
|
64238
64277
|
const coerced = coerceForSettings(key, value);
|
|
64239
64278
|
saveProjectSettings(repoRoot, { [key]: coerced });
|
|
64240
64279
|
printSuccess(`Project override set: ${key} = ${redactIfSensitive(key, value)}`);
|
|
64241
|
-
printInfo(`Saved to ${
|
|
64280
|
+
printInfo(`Saved to ${join67(repoRoot, ".oa", "settings.json")}`);
|
|
64242
64281
|
printInfo("This override applies only when running in this workspace.");
|
|
64243
64282
|
} catch (err) {
|
|
64244
64283
|
printError(`Failed to save: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -64497,7 +64536,7 @@ __export(eval_exports, {
|
|
|
64497
64536
|
});
|
|
64498
64537
|
import { tmpdir as tmpdir10 } from "node:os";
|
|
64499
64538
|
import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync22 } from "node:fs";
|
|
64500
|
-
import { join as
|
|
64539
|
+
import { join as join68 } from "node:path";
|
|
64501
64540
|
async function evalCommand(opts, config) {
|
|
64502
64541
|
const suiteName = opts.suite ?? "basic";
|
|
64503
64542
|
const suite = SUITES[suiteName];
|
|
@@ -64622,9 +64661,9 @@ async function evalCommand(opts, config) {
|
|
|
64622
64661
|
process.exit(failed > 0 ? 1 : 0);
|
|
64623
64662
|
}
|
|
64624
64663
|
function createTempEvalRepo() {
|
|
64625
|
-
const dir =
|
|
64664
|
+
const dir = join68(tmpdir10(), `open-agents-eval-${Date.now()}`);
|
|
64626
64665
|
mkdirSync23(dir, { recursive: true });
|
|
64627
|
-
writeFileSync22(
|
|
64666
|
+
writeFileSync22(join68(dir, "package.json"), JSON.stringify({ name: "eval-repo", version: "0.0.0" }, null, 2) + "\n", "utf8");
|
|
64628
64667
|
return dir;
|
|
64629
64668
|
}
|
|
64630
64669
|
var BASIC_SUITE, FULL_SUITE, SUITES;
|
|
@@ -64684,7 +64723,7 @@ init_updater();
|
|
|
64684
64723
|
import { parseArgs as nodeParseArgs2 } from "node:util";
|
|
64685
64724
|
import { createRequire as createRequire3 } from "node:module";
|
|
64686
64725
|
import { fileURLToPath as fileURLToPath13 } from "node:url";
|
|
64687
|
-
import { dirname as dirname21, join as
|
|
64726
|
+
import { dirname as dirname21, join as join69 } from "node:path";
|
|
64688
64727
|
|
|
64689
64728
|
// packages/cli/dist/cli.js
|
|
64690
64729
|
import { createInterface } from "node:readline";
|
|
@@ -64791,7 +64830,7 @@ init_output();
|
|
|
64791
64830
|
function getVersion4() {
|
|
64792
64831
|
try {
|
|
64793
64832
|
const require2 = createRequire3(import.meta.url);
|
|
64794
|
-
const pkgPath =
|
|
64833
|
+
const pkgPath = join69(dirname21(fileURLToPath13(import.meta.url)), "..", "package.json");
|
|
64795
64834
|
const pkg = require2(pkgPath);
|
|
64796
64835
|
return pkg.version;
|
|
64797
64836
|
} catch {
|